diff options
author | Erik Kundiman <erik@megapahit.org> | 2024-07-27 15:17:57 +0800 |
---|---|---|
committer | Erik Kundiman <erik@megapahit.org> | 2024-07-28 08:24:59 +0800 |
commit | 96a81b5ecbe3bffb582ded930752c0523df5e80a (patch) | |
tree | a87a0bd09fd980562e88150dbfea3819d28d9f12 /indra | |
parent | 06e8f0c443c1ba7858d000c6d695b7e988e02053 (diff) | |
parent | ed73208eb96b862b97fa285036edea1e792ca3c6 (diff) |
Merge remote-tracking branch 'secondlife/release/2024.06-atlasaurus' into 2024.06-atlasaurus
Diffstat (limited to 'indra')
2121 files changed, 40176 insertions, 38589 deletions
diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 7de12d0063..afe20a6dd3 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -88,7 +88,7 @@ if (WINDOWS) if( ADDRESS_SIZE EQUAL 32 ) add_compile_options( /arch:SSE2 ) endif() - + # Are we using the crummy Visual Studio KDU build workaround? if (NOT VS_DISABLE_FATAL_WARNINGS) add_compile_options(/WX) @@ -109,6 +109,9 @@ if (WINDOWS) # https://github.com/actions/runner-images/issues/10004#issuecomment-2153445161 # can be removed after the above issue is resolved and deployed across GHA add_compile_definitions(_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR) + + # Allow use of sprintf etc + add_compile_definitions(_CRT_SECURE_NO_WARNINGS) endif (WINDOWS) if (LINUX OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD") diff --git a/indra/cmake/CMakeLists.txt b/indra/cmake/CMakeLists.txt index be56ef102d..bed7878118 100644 --- a/indra/cmake/CMakeLists.txt +++ b/indra/cmake/CMakeLists.txt @@ -22,13 +22,11 @@ set(cmake_SOURCE_FILES DragDrop.cmake EXPAT.cmake FindAutobuild.cmake - FMODSTUDIO.cmake FreeType.cmake GLEXT.cmake GLH.cmake Havok.cmake Hunspell.cmake - JsonCpp.cmake LLAddBuildTest.cmake LLAppearance.cmake LLAudio.cmake diff --git a/indra/cmake/Copy3rdPartyLibs.cmake b/indra/cmake/Copy3rdPartyLibs.cmake index a1a67512c4..d78f2b90b8 100644 --- a/indra/cmake/Copy3rdPartyLibs.cmake +++ b/indra/cmake/Copy3rdPartyLibs.cmake @@ -7,7 +7,6 @@ include(CMakeCopyIfDifferent) include(Linking) include(OPENAL) -include(FMODSTUDIO) # When we copy our dependent libraries, we almost always want to copy them to # both the Release and the RelWithDebInfo staging directories. This has @@ -50,7 +49,7 @@ if(WINDOWS) endif (ADDRESS_SIZE EQUAL 64) #******************************* - # Misc shared libs + # Misc shared libs set(release_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}") set(release_files @@ -85,12 +84,6 @@ if(WINDOWS) endif(ADDRESS_SIZE EQUAL 32) endif (USE_BUGSPLAT) - if (TARGET ll::fmodstudio) - # fmodL is included for logging, only one should be picked by manifest - set(release_files ${release_files} fmodL.dll) - set(release_files ${release_files} fmod.dll) - endif () - if (TARGET ll::openal) list(APPEND release_files openal32.dll alut.dll) endif () @@ -105,14 +98,27 @@ if(WINDOWS) set(MSVC_VER 120) elseif (MSVC_VERSION GREATER_EQUAL 1910 AND MSVC_VERSION LESS 1920) # Visual Studio 2017 set(MSVC_VER 140) + set(MSVC_TOOLSET_VER 141) elseif (MSVC_VERSION GREATER_EQUAL 1920 AND MSVC_VERSION LESS 1930) # Visual Studio 2019 set(MSVC_VER 140) + set(MSVC_TOOLSET_VER 142) elseif (MSVC_VERSION GREATER_EQUAL 1930 AND MSVC_VERSION LESS 1950) # Visual Studio 2022 set(MSVC_VER 140) + set(MSVC_TOOLSET_VER 143) else (MSVC80) MESSAGE(WARNING "New MSVC_VERSION ${MSVC_VERSION} of MSVC: adapt Copy3rdPartyLibs.cmake") endif (MSVC80) + if (MSVC_TOOLSET_VER AND DEFINED ENV{VCTOOLSREDISTDIR}) + if(ADDRESS_SIZE EQUAL 32) + set(redist_find_path "$ENV{VCTOOLSREDISTDIR}x86\\Microsoft.VC${MSVC_TOOLSET_VER}.CRT") + else(ADDRESS_SIZE EQUAL 32) + set(redist_find_path "$ENV{VCTOOLSREDISTDIR}x64\\Microsoft.VC${MSVC_TOOLSET_VER}.CRT") + endif(ADDRESS_SIZE EQUAL 32) + get_filename_component(redist_path "${redist_find_path}" ABSOLUTE) + MESSAGE(STATUS "VC Runtime redist path: ${redist_path}") + endif (MSVC_TOOLSET_VER AND DEFINED ENV{VCTOOLSREDISTDIR}) + if(ADDRESS_SIZE EQUAL 32) # this folder contains the 32bit DLLs.. (yes really!) set(registry_find_path "[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Windows;Directory]/SysWOW64") @@ -135,7 +141,14 @@ if(WINDOWS) vcruntime${MSVC_VER}.dll vcruntime${MSVC_VER}_1.dll ) - if(EXISTS "${registry_path}/${release_msvc_file}") + if(redist_path AND EXISTS "${redist_path}/${release_msvc_file}") + MESSAGE(STATUS "Copying redist file from ${redist_path}/${release_msvc_file}") + to_staging_dirs( + ${redist_path} + third_party_targets + ${release_msvc_file}) + elseif(EXISTS "${registry_path}/${release_msvc_file}") + MESSAGE(STATUS "Copying redist file from ${registry_path}/${release_msvc_file}") to_staging_dirs( ${registry_path} third_party_targets @@ -177,9 +190,8 @@ elseif(DARWIN) liburiparser.1.0.27.dylib ) - if (TARGET ll::fmodstudio) - set(debug_files ${debug_files} libfmodL.dylib) - set(release_files ${release_files} libfmod.dylib) + if (TARGET ll::openal) + list(APPEND release_files libalut.dylib libopenal.dylib) endif () elseif(LINUX) @@ -219,11 +231,6 @@ elseif(LINUX) ) endif() - if (TARGET ll::fmodstudio) - set(debug_files ${debug_files} "libfmodL.so") - set(release_files ${release_files} "libfmod.so") - endif () - else(WINDOWS) message(STATUS "WARNING: unrecognized platform for staging 3rd party libs, skipping...") set(vivox_lib_dir "${CMAKE_SOURCE_DIR}/newview/vivox-runtime/i686-linux") diff --git a/indra/cmake/FMODSTUDIO.cmake b/indra/cmake/FMODSTUDIO.cmake deleted file mode 100644 index 38437b7bfb..0000000000 --- a/indra/cmake/FMODSTUDIO.cmake +++ /dev/null @@ -1,52 +0,0 @@ -# -*- cmake -*- - -include_guard() - -# FMODSTUDIO can be set when launching the make using the argument -DUSE_FMODSTUDIO:BOOL=ON -# When building using proprietary binaries though (i.e. having access to LL private servers), -# we always build with FMODSTUDIO. -if (INSTALL_PROPRIETARY) - set(USE_FMODSTUDIO ON CACHE BOOL "Using FMODSTUDIO sound library.") -endif (INSTALL_PROPRIETARY) - -# ND: To streamline arguments passed, switch from FMODSTUDIO to USE_FMODSTUDIO -# To not break all old build scripts convert old arguments but warn about it -if(FMODSTUDIO) - message( WARNING "Use of the FMODSTUDIO argument is deprecated, please switch to USE_FMODSTUDIO") - set(USE_FMODSTUDIO ${FMODSTUDIO}) -endif() - -if (USE_FMODSTUDIO) - add_library( ll::fmodstudio INTERFACE IMPORTED ) - target_compile_definitions( ll::fmodstudio INTERFACE LL_FMODSTUDIO=1) - - if (FMODSTUDIO_LIBRARY AND FMODSTUDIO_INCLUDE_DIR) - # If the path have been specified in the arguments, use that - - target_link_libraries(ll::fmodstudio INTERFACE ${FMODSTUDIO_LIBRARY}) - target_include_directories( ll::fmodstudio SYSTEM INTERFACE ${FMODSTUDIO_INCLUDE_DIR}) - else (FMODSTUDIO_LIBRARY AND FMODSTUDIO_INCLUDE_DIR) - # If not, we're going to try to get the package listed in autobuild.xml - # Note: if you're not using INSTALL_PROPRIETARY, the package URL should be local (file:/// URL) - # as accessing the private LL location will fail if you don't have the credential - include(Prebuilt) - if (NOT USESYSTEMLIBS) - use_prebuilt_binary(fmodstudio) - endif () - if (WINDOWS) - target_link_libraries( ll::fmodstudio INTERFACE fmod_vc) - elseif (DARWIN) - #despite files being called libfmod.dylib, we are searching for fmod - target_link_libraries( ll::fmodstudio INTERFACE fmod) - elseif (LINUX) - target_link_libraries( ll::fmodstudio INTERFACE fmod) - endif (WINDOWS) - - if (NOT USESYSTEMLIBS) - target_include_directories( ll::fmodstudio SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/fmodstudio) - endif () - endif (FMODSTUDIO_LIBRARY AND FMODSTUDIO_INCLUDE_DIR) -else() - set( USE_FMODSTUDIO "OFF") -endif () - diff --git a/indra/cmake/GLM.cmake b/indra/cmake/GLM.cmake new file mode 100644 index 0000000000..84b155f6c5 --- /dev/null +++ b/indra/cmake/GLM.cmake @@ -0,0 +1,7 @@ +# -*- cmake -*- +include(Prebuilt) + +add_library( ll::glm INTERFACE IMPORTED ) + +use_system_binary( glm ) +use_prebuilt_binary(glm) diff --git a/indra/cmake/JsonCpp.cmake b/indra/cmake/JsonCpp.cmake deleted file mode 100644 index a9b992ab20..0000000000 --- a/indra/cmake/JsonCpp.cmake +++ /dev/null @@ -1,17 +0,0 @@ -# -*- cmake -*- - -include(Prebuilt) -include_guard() -add_library( ll::jsoncpp INTERFACE IMPORTED ) - -use_system_binary(jsoncpp) - -use_prebuilt_binary(jsoncpp) -if (WINDOWS) - target_link_libraries( ll::jsoncpp INTERFACE json_libmd.lib ) -elseif (DARWIN) - target_link_libraries( ll::jsoncpp INTERFACE libjson_darwin_libmt.a ) -elseif (LINUX) - target_link_libraries( ll::jsoncpp INTERFACE libjson_linux-gcc-11_libmt.a ) -endif (WINDOWS) -target_include_directories( ll::jsoncpp SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include) diff --git a/indra/cmake/LLCommon.cmake b/indra/cmake/LLCommon.cmake index 869d5805f2..9e3707ff17 100644 --- a/indra/cmake/LLCommon.cmake +++ b/indra/cmake/LLCommon.cmake @@ -6,6 +6,5 @@ include(EXPAT) include(Tracy) include(xxHash) include(ZLIBNG) -include(JsonCpp) include(XmlRpcEpi) diff --git a/indra/cmake/OPENAL.cmake b/indra/cmake/OPENAL.cmake index cc7deac2d9..6555027dc1 100644 --- a/indra/cmake/OPENAL.cmake +++ b/indra/cmake/OPENAL.cmake @@ -44,6 +44,9 @@ if (USE_OPENAL) alut ) else() - message(FATAL_ERROR "OpenAL is not available for this platform") + target_link_libraries( ll::openal INTERFACE + openal + alut + ) endif() endif () diff --git a/indra/cmake/TinyEXR.cmake b/indra/cmake/TinyEXR.cmake index c3053b8149..7500b774d8 100644 --- a/indra/cmake/TinyEXR.cmake +++ b/indra/cmake/TinyEXR.cmake @@ -5,5 +5,5 @@ if (NOT USESYSTEMLIBS) use_prebuilt_binary(tinyexr) endif () -set(TINYEXR_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/tinyexr) +set(TINYEXR_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/tinyexr) diff --git a/indra/cmake/Variables.cmake b/indra/cmake/Variables.cmake index ab8add8af8..f746cdab78 100644 --- a/indra/cmake/Variables.cmake +++ b/indra/cmake/Variables.cmake @@ -5,7 +5,7 @@ # # Platform variables: # -# DARWIN - Mac OS X +# DARWIN - macOS # LINUX - Linux # WINDOWS - Windows diff --git a/indra/cmake/WebRTC.cmake b/indra/cmake/WebRTC.cmake index d336dcdb10..3120968560 100644 --- a/indra/cmake/WebRTC.cmake +++ b/indra/cmake/WebRTC.cmake @@ -18,7 +18,7 @@ elseif (DARWIN) FIND_LIBRARY(AUDIOTOOLBOX_LIBRARY AudioToolbox) FIND_LIBRARY(COREFOUNDATION_LIBRARY CoreFoundation) FIND_LIBRARY(COCOA_LIBRARY Cocoa) - + target_link_libraries( ll::webrtc INTERFACE libwebrtc.a ${COREAUDIO_LIBRARY} diff --git a/indra/lib/python/indra/util/llmanifest.py b/indra/lib/python/indra/util/llmanifest.py index 5f873df425..38de9c7cf1 100755 --- a/indra/lib/python/indra/util/llmanifest.py +++ b/indra/lib/python/indra/util/llmanifest.py @@ -116,7 +116,7 @@ BASE_ARGUMENTS=[ dict(name='build', description='Build directory.', default=DEFAULT_SRCTREE), dict(name='buildtype', description='Build type (i.e. Debug, Release, RelWithDebInfo).', default=None), dict(name='bundleid', - description="""The Mac OS X Bundle identifier.""", + description="""The macOS Bundle identifier.""", default="com.secondlife.indra.viewer"), dict(name='channel', description="""The channel to use for updates, packaging, settings name, etc.""", @@ -146,7 +146,7 @@ BASE_ARGUMENTS=[ dict(name='signature', description="""This specifies an identity to sign the viewer with, if any. If no value is supplied, the default signature will be used, if any. Currently - only used on Mac OS X.""", + only used on macOS.""", default=None), dict(name='source', description='Source directory.', diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp index 83e43b11b7..95d55c835f 100644 --- a/indra/llappearance/llavatarappearance.cpp +++ b/indra/llappearance/llavatarappearance.cpp @@ -64,19 +64,19 @@ class LLAvatarBoneInfo friend class LLAvatarAppearance; friend class LLAvatarSkeletonInfo; public: - LLAvatarBoneInfo() : mIsJoint(FALSE) {} + LLAvatarBoneInfo() : mIsJoint(false) {} ~LLAvatarBoneInfo() { std::for_each(mChildren.begin(), mChildren.end(), DeletePointer()); mChildren.clear(); } - BOOL parseXml(LLXmlTreeNode* node); + bool parseXml(LLXmlTreeNode* node); private: std::string mName; std::string mSupport; std::string mAliases; - BOOL mIsJoint; + bool mIsJoint; LLVector3 mPos; LLVector3 mEnd; LLVector3 mRot; @@ -101,7 +101,7 @@ public: std::for_each(mBoneInfoList.begin(), mBoneInfoList.end(), DeletePointer()); mBoneInfoList.clear(); } - BOOL parseXml(LLXmlTreeNode* node); + bool parseXml(LLXmlTreeNode* node); S32 getNumBones() const { return mNumBones; } S32 getNumCollisionVolumes() const { return mNumCollisionVolumes; } @@ -164,19 +164,7 @@ LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary* LLAvatarAppearance::sAv LLAvatarAppearance::LLAvatarAppearance(LLWearableData* wearable_data) : LLCharacter(), - mIsDummy(FALSE), - mTexSkinColor( NULL ), - mTexHairColor( NULL ), - mTexEyeColor( NULL ), - mPelvisToFoot(0.f), - mHeadOffset(), - mRoot(NULL), - mWearableData(wearable_data), - mNumBones(0), - mNumCollisionVolumes(0), - mCollisionVolumes(NULL), - mIsBuilt(FALSE), - mInitFlags(0) + mWearableData(wearable_data) { llassert_always(mWearableData); mBakedTextureDatas.resize(LLAvatarAppearanceDefines::BAKED_NUM_INDICES); @@ -222,14 +210,14 @@ void LLAvatarAppearance::initInstance() mesh->setName(mesh_name); mesh->setMeshID(mesh_index); mesh->setPickName(mesh_dict->mPickName); - mesh->setIsTransparent(FALSE); + mesh->setIsTransparent(false); switch((S32)mesh_index) { case MESH_ID_HAIR: - mesh->setIsTransparent(TRUE); + mesh->setIsTransparent(true); break; case MESH_ID_SKIRT: - mesh->setIsTransparent(TRUE); + mesh->setIsTransparent(true); break; case MESH_ID_EYEBALL_LEFT: case MESH_ID_EYEBALL_RIGHT: @@ -331,7 +319,7 @@ void LLAvatarAppearance::initClass(const std::string& avatar_file_name_arg, cons avatar_file_name = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,AVATAR_DEFAULT_CHAR + "_lad.xml"); } LLXmlTree xml_tree; - BOOL success = xml_tree.parseFile( avatar_file_name, FALSE ); + bool success = xml_tree.parseFile( avatar_file_name, false ); if (!success) { LL_ERRS() << "Problem reading avatar configuration file:" << avatar_file_name << LL_ENDL; @@ -537,11 +525,11 @@ void LLAvatarAppearance::computeBodySize() new_body_size.mV[VZ] = mPelvisToFoot + // the sqrt(2) correction below is an approximate // correction to get to the top of the head - F_SQRT2 * (skull.mV[VZ] * head_scale.mV[VZ]) + - head.mV[VZ] * neck_scale.mV[VZ] + - neck.mV[VZ] * chest_scale.mV[VZ] + - chest.mV[VZ] * torso_scale.mV[VZ] + - torso.mV[VZ] * pelvis_scale.mV[VZ]; + F_SQRT2 * (skull.mV[VZ] * head_scale.mV[VZ]) + + head.mV[VZ] * neck_scale.mV[VZ] + + neck.mV[VZ] * chest_scale.mV[VZ] + + chest.mV[VZ] * torso_scale.mV[VZ] + + torso.mV[VZ] * pelvis_scale.mV[VZ]; // TODO -- measure the real depth and width new_body_size.mV[VX] = DEFAULT_AGENT_DEPTH; @@ -561,17 +549,17 @@ void LLAvatarAppearance::computeBodySize() //----------------------------------------------------------------------------- // parseSkeletonFile() //----------------------------------------------------------------------------- -BOOL LLAvatarAppearance::parseSkeletonFile(const std::string& filename, LLXmlTree& skeleton_xml_tree) +bool LLAvatarAppearance::parseSkeletonFile(const std::string& filename, LLXmlTree& skeleton_xml_tree) { //------------------------------------------------------------------------- // parse the file //------------------------------------------------------------------------- - BOOL parsesuccess = skeleton_xml_tree.parseFile( filename, FALSE ); + bool parsesuccess = skeleton_xml_tree.parseFile( filename, false ); if (!parsesuccess) { LL_ERRS() << "Can't parse skeleton file: " << filename << LL_ENDL; - return FALSE; + return false; } // now sanity check xml file @@ -579,13 +567,13 @@ BOOL LLAvatarAppearance::parseSkeletonFile(const std::string& filename, LLXmlTre if (!root) { LL_ERRS() << "No root node found in avatar skeleton file: " << filename << LL_ENDL; - return FALSE; + return false; } if( !root->hasName( "linden_skeleton" ) ) { LL_ERRS() << "Invalid avatar skeleton file header: " << filename << LL_ENDL; - return FALSE; + return false; } std::string version; @@ -593,16 +581,16 @@ BOOL LLAvatarAppearance::parseSkeletonFile(const std::string& filename, LLXmlTre if( !root->getFastAttributeString( version_string, version ) || ((version != "1.0") && (version != "2.0"))) { LL_ERRS() << "Invalid avatar skeleton file version: " << version << " in file: " << filename << LL_ENDL; - return FALSE; + return false; } - return TRUE; + return true; } //----------------------------------------------------------------------------- // setupBone() //----------------------------------------------------------------------------- -BOOL LLAvatarAppearance::setupBone(const LLAvatarBoneInfo* info, LLJoint* parent, S32 &volume_num, S32 &joint_num) +bool LLAvatarAppearance::setupBone(const LLAvatarBoneInfo* info, LLJoint* parent, S32 &volume_num, S32 &joint_num) { LLJoint* joint = NULL; @@ -618,7 +606,7 @@ BOOL LLAvatarAppearance::setupBone(const LLAvatarBoneInfo* info, LLJoint* parent if (!joint) { LL_WARNS() << "Too many bones" << LL_ENDL; - return FALSE; + return false; } joint->setName( info->mName ); } @@ -627,7 +615,7 @@ BOOL LLAvatarAppearance::setupBone(const LLAvatarBoneInfo* info, LLJoint* parent if (volume_num >= (S32)mNumCollisionVolumes) { LL_WARNS() << "Too many collision volumes" << LL_ENDL; - return FALSE; + return false; } joint = (&mCollisionVolumes[volume_num]); joint->setName( info->mName ); @@ -667,17 +655,17 @@ BOOL LLAvatarAppearance::setupBone(const LLAvatarBoneInfo* info, LLJoint* parent { if (!setupBone(child_info, joint, volume_num, joint_num)) { - return FALSE; + return false; } } - return TRUE; + return true; } //----------------------------------------------------------------------------- // allocateCharacterJoints() //----------------------------------------------------------------------------- -BOOL LLAvatarAppearance::allocateCharacterJoints( U32 num ) +bool LLAvatarAppearance::allocateCharacterJoints( U32 num ) { if (mSkeleton.size() != num) { @@ -686,14 +674,14 @@ BOOL LLAvatarAppearance::allocateCharacterJoints( U32 num ) mNumBones = num; } - return TRUE; + return true; } //----------------------------------------------------------------------------- // buildSkeleton() //----------------------------------------------------------------------------- -BOOL LLAvatarAppearance::buildSkeleton(const LLAvatarSkeletonInfo *info) +bool LLAvatarAppearance::buildSkeleton(const LLAvatarSkeletonInfo *info) { LL_DEBUGS("BVH") << "numBones " << info->mNumBones << " numCollisionVolumes " << info->mNumCollisionVolumes << LL_ENDL; @@ -701,7 +689,7 @@ BOOL LLAvatarAppearance::buildSkeleton(const LLAvatarSkeletonInfo *info) if (!allocateCharacterJoints(info->mNumBones)) { LL_ERRS() << "Can't allocate " << info->mNumBones << " joints" << LL_ENDL; - return FALSE; + return false; } // allocate volumes @@ -710,7 +698,7 @@ BOOL LLAvatarAppearance::buildSkeleton(const LLAvatarSkeletonInfo *info) if (!allocateCollisionVolumes(info->mNumCollisionVolumes)) { LL_ERRS() << "Can't allocate " << info->mNumCollisionVolumes << " collision volumes" << LL_ENDL; - return FALSE; + return false; } } @@ -721,11 +709,11 @@ BOOL LLAvatarAppearance::buildSkeleton(const LLAvatarSkeletonInfo *info) if (!setupBone(bone_info, NULL, current_volume_num, current_joint_num)) { LL_ERRS() << "Error parsing bone in skeleton file" << LL_ENDL; - return FALSE; + return false; } } - return TRUE; + return true; } //----------------------------------------------------------------------------- @@ -790,7 +778,7 @@ void LLAvatarAppearance::buildCharacter() //------------------------------------------------------------------------- mRoot->removeAllChildren(); mJointMap.clear(); - mIsBuilt = FALSE; + mIsBuilt = false; //------------------------------------------------------------------------- // clear mesh data @@ -808,10 +796,10 @@ void LLAvatarAppearance::buildCharacter() //------------------------------------------------------------------------- LLTimer timer; - BOOL status = loadAvatar(); + bool status = loadAvatar(); stop_glerror(); -// gPrintMessagesThisFrame = TRUE; +// gPrintMessagesThisFrame = true; LL_DEBUGS() << "Avatar load took " << timer.getElapsedTimeF32() << " seconds." << LL_ENDL; if (!status) @@ -881,12 +869,12 @@ void LLAvatarAppearance::buildCharacter() // SL-315 mPelvisp->setPosition( LLVector3(0.0f, 0.0f, 0.0f) ); - mIsBuilt = TRUE; + mIsBuilt = true; stop_glerror(); } -BOOL LLAvatarAppearance::loadAvatar() +bool LLAvatarAppearance::loadAvatar() { // LL_RECORD_BLOCK_TIME(FTM_LOAD_AVATAR); @@ -894,7 +882,7 @@ BOOL LLAvatarAppearance::loadAvatar() if( !buildSkeleton(sAvatarSkeletonInfo) ) { LL_ERRS() << "avatar file: buildSkeleton() failed" << LL_ENDL; - return FALSE; + return false; } // initialize mJointAliasMap @@ -904,14 +892,14 @@ BOOL LLAvatarAppearance::loadAvatar() if( !loadSkeletonNode() ) { LL_ERRS() << "avatar file: loadNodeSkeleton() failed" << LL_ENDL; - return FALSE; + return false; } // avatar_lad.xml : <mesh> if( !loadMeshNodes() ) { LL_ERRS() << "avatar file: loadNodeMesh() failed" << LL_ENDL; - return FALSE; + return false; } // avatar_lad.xml : <global_color> @@ -921,13 +909,13 @@ BOOL LLAvatarAppearance::loadAvatar() if( !mTexSkinColor->setInfo( sAvatarXmlInfo->mTexSkinColorInfo ) ) { LL_ERRS() << "avatar file: mTexSkinColor->setInfo() failed" << LL_ENDL; - return FALSE; + return false; } } else { LL_ERRS() << "<global_color> name=\"skin_color\" not found" << LL_ENDL; - return FALSE; + return false; } if( sAvatarXmlInfo->mTexHairColorInfo ) { @@ -935,13 +923,13 @@ BOOL LLAvatarAppearance::loadAvatar() if( !mTexHairColor->setInfo( sAvatarXmlInfo->mTexHairColorInfo ) ) { LL_ERRS() << "avatar file: mTexHairColor->setInfo() failed" << LL_ENDL; - return FALSE; + return false; } } else { LL_ERRS() << "<global_color> name=\"hair_color\" not found" << LL_ENDL; - return FALSE; + return false; } if( sAvatarXmlInfo->mTexEyeColorInfo ) { @@ -949,26 +937,26 @@ BOOL LLAvatarAppearance::loadAvatar() if( !mTexEyeColor->setInfo( sAvatarXmlInfo->mTexEyeColorInfo ) ) { LL_ERRS() << "avatar file: mTexEyeColor->setInfo() failed" << LL_ENDL; - return FALSE; + return false; } } else { LL_ERRS() << "<global_color> name=\"eye_color\" not found" << LL_ENDL; - return FALSE; + return false; } // avatar_lad.xml : <layer_set> if (sAvatarXmlInfo->mLayerInfoList.empty()) { LL_ERRS() << "avatar file: missing <layer_set> node" << LL_ENDL; - return FALSE; + return false; } if (sAvatarXmlInfo->mMorphMaskInfoList.empty()) { LL_ERRS() << "avatar file: missing <morph_masks> node" << LL_ENDL; - return FALSE; + return false; } // avatar_lad.xml : <morph_masks> @@ -982,7 +970,7 @@ BOOL LLAvatarAppearance::loadAvatar() morph_param = getVisualParam(name->c_str()); if (morph_param) { - BOOL invert = info->mInvert; + bool invert = info->mInvert; addMaskedMorph(baked, morph_param, invert, info->mLayer); } } @@ -1010,24 +998,24 @@ BOOL LLAvatarAppearance::loadAvatar() { delete driver_param; LL_WARNS() << "avatar file: driver_param->parseData() failed" << LL_ENDL; - return FALSE; + return false; } } - return TRUE; + return true; } //----------------------------------------------------------------------------- // loadSkeletonNode(): loads <skeleton> node from XML tree //----------------------------------------------------------------------------- -BOOL LLAvatarAppearance::loadSkeletonNode () +bool LLAvatarAppearance::loadSkeletonNode () { mRoot->addChild( mSkeleton[0] ); // make meshes children before calling parent version of the function for (LLAvatarJoint* joint : mMeshLOD) { - joint->mUpdateXform = FALSE; + joint->mUpdateXform = false; joint->setMeshesToChildren(); } @@ -1064,7 +1052,7 @@ BOOL LLAvatarAppearance::loadSkeletonNode () if (!param->setInfo(info)) { delete param; - return FALSE; + return false; } else { @@ -1075,13 +1063,13 @@ BOOL LLAvatarAppearance::loadSkeletonNode () } - return TRUE; + return true; } //----------------------------------------------------------------------------- // loadMeshNodes(): loads <mesh> nodes from XML tree //----------------------------------------------------------------------------- -BOOL LLAvatarAppearance::loadMeshNodes() +bool LLAvatarAppearance::loadMeshNodes() { for (const LLAvatarXmlInfo::LLAvatarMeshInfo* info : sAvatarXmlInfo->mMeshInfoList) { @@ -1090,7 +1078,7 @@ BOOL LLAvatarAppearance::loadMeshNodes() LLAvatarJointMesh* mesh = NULL; U8 mesh_id = 0; - BOOL found_mesh_id = FALSE; + bool found_mesh_id = false; /* if (type == "hairMesh") switch(lod) @@ -1103,7 +1091,7 @@ BOOL LLAvatarAppearance::loadMeshNodes() if (type.compare(mesh_dict->mName) == 0) { mesh_id = mesh_index; - found_mesh_id = TRUE; + found_mesh_id = true; break; } } @@ -1117,13 +1105,13 @@ BOOL LLAvatarAppearance::loadMeshNodes() else { LL_WARNS() << "Avatar file: <mesh> has invalid lod setting " << lod << LL_ENDL; - return FALSE; + return false; } } else { LL_WARNS() << "Ignoring unrecognized mesh type: " << type << LL_ENDL; - return FALSE; + return false; } // LL_INFOS() << "Parsing mesh data for " << type << "..." << LL_ENDL; @@ -1146,7 +1134,7 @@ BOOL LLAvatarAppearance::loadMeshNodes() { // This should never happen LL_WARNS("Avatar") << "Could not find avatar mesh: " << info->mReferenceMeshName << LL_ENDL; - return FALSE; + return false; } } else @@ -1158,7 +1146,7 @@ BOOL LLAvatarAppearance::loadMeshNodes() if( !poly_mesh ) { LL_WARNS() << "Failed to load mesh of type " << type << LL_ENDL; - return FALSE; + return false; } // Multimap insert @@ -1173,7 +1161,7 @@ BOOL LLAvatarAppearance::loadMeshNodes() if (!param->setInfo((LLPolyMorphTargetInfo*)info_pair.first)) { delete param; - return FALSE; + return false; } else { @@ -1191,15 +1179,15 @@ BOOL LLAvatarAppearance::loadMeshNodes() } } - return TRUE; + return true; } //----------------------------------------------------------------------------- // loadLayerSets() //----------------------------------------------------------------------------- -BOOL LLAvatarAppearance::loadLayersets() +bool LLAvatarAppearance::loadLayersets() { - BOOL success = TRUE; + bool success = true; for (LLTexLayerSetInfo* layerset_info : sAvatarXmlInfo->mLayerInfoList) { if (isSelf()) @@ -1212,7 +1200,7 @@ BOOL LLAvatarAppearance::loadLayersets() stop_glerror(); delete layer_set; LL_WARNS() << "avatar file: layer_set->setInfo() failed" << LL_ENDL; - return FALSE; + return false; } // scan baked textures and associate the layerset with the appropriate one @@ -1234,7 +1222,7 @@ BOOL LLAvatarAppearance::loadLayersets() { LL_WARNS() << "<layer_set> has invalid body_region attribute" << LL_ENDL; delete layer_set; - return FALSE; + return false; } // scan morph masks and let any affected layers know they have an associated morph @@ -1243,12 +1231,12 @@ BOOL LLAvatarAppearance::loadLayersets() LLTexLayerInterface* layer = layer_set->findLayerByName(morph->mLayer); if (layer) { - layer->setHasMorph(TRUE); + layer->setHasMorph(true); } else { LL_WARNS() << "Could not find layer named " << morph->mLayer << " to set morph flag" << LL_ENDL; - success = FALSE; + success = false; } } } @@ -1341,19 +1329,19 @@ LLPolyMesh* LLAvatarAppearance::getUpperBodyMesh() // virtual -BOOL LLAvatarAppearance::isValid() const +bool LLAvatarAppearance::isValid() const { // This should only be called on ourself. if (!isSelf()) { LL_ERRS() << "Called LLAvatarAppearance::isValid() on when isSelf() == false" << LL_ENDL; } - return TRUE; + return true; } // adds a morph mask to the appropriate baked texture structure -void LLAvatarAppearance::addMaskedMorph(EBakedTextureIndex index, LLVisualParam* morph_target, BOOL invert, std::string layer) +void LLAvatarAppearance::addMaskedMorph(EBakedTextureIndex index, LLVisualParam* morph_target, bool invert, std::string layer) { if (index < BAKED_NUM_INDICES) { @@ -1364,7 +1352,7 @@ void LLAvatarAppearance::addMaskedMorph(EBakedTextureIndex index, LLVisualParam* //static -BOOL LLAvatarAppearance::teToColorParams( ETextureIndex te, U32 *param_name ) +bool LLAvatarAppearance::teToColorParams( ETextureIndex te, U32 *param_name ) { switch( te ) { @@ -1448,10 +1436,10 @@ BOOL LLAvatarAppearance::teToColorParams( ETextureIndex te, U32 *param_name ) default: llassert(0); - return FALSE; + return false; } - return TRUE; + return true; } void LLAvatarAppearance::setClothesColor( ETextureIndex te, const LLColor4& new_color) @@ -1459,9 +1447,9 @@ void LLAvatarAppearance::setClothesColor( ETextureIndex te, const LLColor4& new_ U32 param_name[3]; if( teToColorParams( te, param_name ) ) { - setVisualParamWeight( param_name[0], new_color.mV[VX]); - setVisualParamWeight( param_name[1], new_color.mV[VY]); - setVisualParamWeight( param_name[2], new_color.mV[VZ]); + setVisualParamWeight( param_name[0], new_color.mV[VRED]); + setVisualParamWeight( param_name[1], new_color.mV[VGREEN]); + setVisualParamWeight( param_name[2], new_color.mV[VBLUE]); } } @@ -1471,9 +1459,9 @@ LLColor4 LLAvatarAppearance::getClothesColor( ETextureIndex te ) U32 param_name[3]; if( teToColorParams( te, param_name ) ) { - color.mV[VX] = getVisualParamWeight( param_name[0] ); - color.mV[VY] = getVisualParamWeight( param_name[1] ); - color.mV[VZ] = getVisualParamWeight( param_name[2] ); + color.mV[VRED] = getVisualParamWeight( param_name[0] ); + color.mV[VGREEN] = getVisualParamWeight( param_name[1] ); + color.mV[VBLUE] = getVisualParamWeight( param_name[2] ); } return color; } @@ -1507,7 +1495,7 @@ LLColor4 LLAvatarAppearance::getGlobalColor( const std::string& color_name ) con // Unlike most wearable functions, this works for both self and other. // virtual -BOOL LLAvatarAppearance::isWearingWearableType(LLWearableType::EType type) const +bool LLAvatarAppearance::isWearingWearableType(LLWearableType::EType type) const { return mWearableData->getWearableCount(type) > 0; } @@ -1524,7 +1512,7 @@ LLTexLayerSet* LLAvatarAppearance::getAvatarLayerSet(EBakedTextureIndex baked_in //----------------------------------------------------------------------------- // allocateCollisionVolumes() //----------------------------------------------------------------------------- -BOOL LLAvatarAppearance::allocateCollisionVolumes( U32 num ) +bool LLAvatarAppearance::allocateCollisionVolumes( U32 num ) { if (mNumCollisionVolumes !=num) { @@ -1535,27 +1523,27 @@ BOOL LLAvatarAppearance::allocateCollisionVolumes( U32 num ) if (!mCollisionVolumes) { LL_WARNS() << "Failed to allocate collision volumes" << LL_ENDL; - return FALSE; + return false; } mNumCollisionVolumes = num; } - return TRUE; + return true; } //----------------------------------------------------------------------------- // LLAvatarBoneInfo::parseXml() //----------------------------------------------------------------------------- -BOOL LLAvatarBoneInfo::parseXml(LLXmlTreeNode* node) +bool LLAvatarBoneInfo::parseXml(LLXmlTreeNode* node) { if (node->hasName("bone")) { - mIsJoint = TRUE; + mIsJoint = true; static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); if (!node->getFastAttributeString(name_string, mName)) { LL_WARNS() << "Bone without name" << LL_ENDL; - return FALSE; + return false; } static LLStdStringHandle aliases_string = LLXmlTree::addAttributeString("aliases"); @@ -1563,7 +1551,7 @@ BOOL LLAvatarBoneInfo::parseXml(LLXmlTreeNode* node) } else if (node->hasName("collision_volume")) { - mIsJoint = FALSE; + mIsJoint = false; static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); if (!node->getFastAttributeString(name_string, mName)) { @@ -1573,28 +1561,28 @@ BOOL LLAvatarBoneInfo::parseXml(LLXmlTreeNode* node) else { LL_WARNS() << "Invalid node " << node->getName() << LL_ENDL; - return FALSE; + return false; } static LLStdStringHandle pos_string = LLXmlTree::addAttributeString("pos"); if (!node->getFastAttributeVector3(pos_string, mPos)) { LL_WARNS() << "Bone without position" << LL_ENDL; - return FALSE; + return false; } static LLStdStringHandle rot_string = LLXmlTree::addAttributeString("rot"); if (!node->getFastAttributeVector3(rot_string, mRot)) { LL_WARNS() << "Bone without rotation" << LL_ENDL; - return FALSE; + return false; } static LLStdStringHandle scale_string = LLXmlTree::addAttributeString("scale"); if (!node->getFastAttributeVector3(scale_string, mScale)) { LL_WARNS() << "Bone without scale" << LL_ENDL; - return FALSE; + return false; } static LLStdStringHandle end_string = LLXmlTree::addAttributeString("end"); @@ -1617,7 +1605,7 @@ BOOL LLAvatarBoneInfo::parseXml(LLXmlTreeNode* node) if (!node->getFastAttributeVector3(pivot_string, mPivot)) { LL_WARNS() << "Bone without pivot" << LL_ENDL; - return FALSE; + return false; } } @@ -1629,23 +1617,23 @@ BOOL LLAvatarBoneInfo::parseXml(LLXmlTreeNode* node) if (!child_info->parseXml(child)) { delete child_info; - return FALSE; + return false; } mChildren.push_back(child_info); } - return TRUE; + return true; } //----------------------------------------------------------------------------- // LLAvatarSkeletonInfo::parseXml() //----------------------------------------------------------------------------- -BOOL LLAvatarSkeletonInfo::parseXml(LLXmlTreeNode* node) +bool LLAvatarSkeletonInfo::parseXml(LLXmlTreeNode* node) { static LLStdStringHandle num_bones_string = LLXmlTree::addAttributeString("num_bones"); if (!node->getFastAttributeS32(num_bones_string, mNumBones)) { LL_WARNS() << "Couldn't find number of bones." << LL_ENDL; - return FALSE; + return false; } static LLStdStringHandle num_collision_volumes_string = LLXmlTree::addAttributeString("num_collision_volumes"); @@ -1659,11 +1647,11 @@ BOOL LLAvatarSkeletonInfo::parseXml(LLXmlTreeNode* node) { delete info; LL_WARNS() << "Error parsing bone in skeleton file" << LL_ENDL; - return FALSE; + return false; } mBoneInfoList.push_back(info); } - return TRUE; + return true; } //Make aliases for joint and push to map. @@ -1731,13 +1719,13 @@ const LLAvatarAppearance::joint_alias_map_t& LLAvatarAppearance::getJointAliases //----------------------------------------------------------------------------- // parseXmlSkeletonNode(): parses <skeleton> nodes from XML tree //----------------------------------------------------------------------------- -BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* root) +bool LLAvatarAppearance::LLAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* root) { LLXmlTreeNode* node = root->getChildByName( "skeleton" ); if( !node ) { LL_WARNS() << "avatar file: missing <skeleton>" << LL_ENDL; - return FALSE; + return false; } LLXmlTreeNode* child; @@ -1757,14 +1745,14 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* ro { LL_WARNS() << "Unknown param type." << LL_ENDL; } - return FALSE; + return false; } LLPolySkeletalDistortionInfo *info = new LLPolySkeletalDistortionInfo; if (!info->parseXml(child)) { delete info; - return FALSE; + return false; } mSkeletalDistortionInfoList.push_back(info); @@ -1782,7 +1770,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* ro { LL_WARNS() << "No name supplied for attachment point." << LL_ENDL; delete info; - return FALSE; + return false; } static LLStdStringHandle joint_string = LLXmlTree::addAttributeString("joint"); @@ -1790,19 +1778,19 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* ro { LL_WARNS() << "No bone declared in attachment point " << info->mName << LL_ENDL; delete info; - return FALSE; + return false; } static LLStdStringHandle position_string = LLXmlTree::addAttributeString("position"); if (child->getFastAttributeVector3(position_string, info->mPosition)) { - info->mHasPosition = TRUE; + info->mHasPosition = true; } static LLStdStringHandle rotation_string = LLXmlTree::addAttributeString("rotation"); if (child->getFastAttributeVector3(rotation_string, info->mRotationEuler)) { - info->mHasRotation = TRUE; + info->mHasRotation = true; } static LLStdStringHandle group_string = LLXmlTree::addAttributeString("group"); if (child->getFastAttributeS32(group_string, info->mGroup)) @@ -1816,7 +1804,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* ro { LL_WARNS() << "No id supplied for attachment point " << info->mName << LL_ENDL; delete info; - return FALSE; + return false; } static LLStdStringHandle slot_string = LLXmlTree::addAttributeString("pie_slice"); @@ -1831,13 +1819,13 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* ro mAttachmentInfoList.push_back(info); } - return TRUE; + return true; } //----------------------------------------------------------------------------- // parseXmlMeshNodes(): parses <mesh> nodes from XML tree //----------------------------------------------------------------------------- -BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root) +bool LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root) { for (LLXmlTreeNode* node = root->getChildByName( "mesh" ); node; @@ -1851,7 +1839,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root) { LL_WARNS() << "Avatar file: <mesh> is missing type attribute. Ignoring element. " << LL_ENDL; delete info; - return FALSE; // Ignore this element + return false; // Ignore this element } static LLStdStringHandle lod_string = LLXmlTree::addAttributeString("lod"); @@ -1859,7 +1847,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root) { LL_WARNS() << "Avatar file: <mesh> is missing lod attribute. Ignoring element. " << LL_ENDL; delete info; - return FALSE; // Ignore this element + return false; // Ignore this element } static LLStdStringHandle file_name_string = LLXmlTree::addAttributeString("file_name"); @@ -1867,7 +1855,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root) { LL_WARNS() << "Avatar file: <mesh> is missing file_name attribute. Ignoring: " << info->mType << LL_ENDL; delete info; - return FALSE; // Ignore this element + return false; // Ignore this element } static LLStdStringHandle reference_string = LLXmlTree::addAttributeString("reference"); @@ -1902,7 +1890,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root) { LL_WARNS() << "Unknown param type." << LL_ENDL; } - return FALSE; + return false; } LLPolyMorphTargetInfo *morphinfo = new LLPolyMorphTargetInfo(); @@ -1910,9 +1898,9 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root) { delete morphinfo; delete info; - return -1; + return false; } - BOOL shared = FALSE; + bool shared = false; static LLStdStringHandle shared_string = LLXmlTree::addAttributeString("shared"); child->getFastAttributeBOOL(shared_string, shared); @@ -1921,13 +1909,13 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root) mMeshInfoList.push_back(info); } - return TRUE; + return true; } //----------------------------------------------------------------------------- // parseXmlColorNodes(): parses <global_color> nodes from XML tree //----------------------------------------------------------------------------- -BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlColorNodes(LLXmlTreeNode* root) +bool LLAvatarAppearance::LLAvatarXmlInfo::parseXmlColorNodes(LLXmlTreeNode* root) { for (LLXmlTreeNode* color_node = root->getChildByName( "global_color" ); color_node; @@ -1942,14 +1930,14 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlColorNodes(LLXmlTreeNode* root if (mTexSkinColorInfo) { LL_WARNS() << "avatar file: multiple instances of skin_color" << LL_ENDL; - return FALSE; + return false; } mTexSkinColorInfo = new LLTexGlobalColorInfo; if( !mTexSkinColorInfo->parseXml( color_node ) ) { delete_and_clear(mTexSkinColorInfo); LL_WARNS() << "avatar file: mTexSkinColor->parseXml() failed" << LL_ENDL; - return FALSE; + return false; } } else if( global_color_name == "hair_color" ) @@ -1957,14 +1945,14 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlColorNodes(LLXmlTreeNode* root if (mTexHairColorInfo) { LL_WARNS() << "avatar file: multiple instances of hair_color" << LL_ENDL; - return FALSE; + return false; } mTexHairColorInfo = new LLTexGlobalColorInfo; if( !mTexHairColorInfo->parseXml( color_node ) ) { delete_and_clear(mTexHairColorInfo); LL_WARNS() << "avatar file: mTexHairColor->parseXml() failed" << LL_ENDL; - return FALSE; + return false; } } else if( global_color_name == "eye_color" ) @@ -1972,24 +1960,24 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlColorNodes(LLXmlTreeNode* root if (mTexEyeColorInfo) { LL_WARNS() << "avatar file: multiple instances of eye_color" << LL_ENDL; - return FALSE; + return false; } mTexEyeColorInfo = new LLTexGlobalColorInfo; if( !mTexEyeColorInfo->parseXml( color_node ) ) { LL_WARNS() << "avatar file: mTexEyeColor->parseXml() failed" << LL_ENDL; - return FALSE; + return false; } } } } - return TRUE; + return true; } //----------------------------------------------------------------------------- // parseXmlLayerNodes(): parses <layer_set> nodes from XML tree //----------------------------------------------------------------------------- -BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlLayerNodes(LLXmlTreeNode* root) +bool LLAvatarAppearance::LLAvatarXmlInfo::parseXmlLayerNodes(LLXmlTreeNode* root) { for (LLXmlTreeNode* layer_node = root->getChildByName( "layer_set" ); layer_node; @@ -2004,16 +1992,16 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlLayerNodes(LLXmlTreeNode* root { delete layer_info; LL_WARNS() << "avatar file: layer_set->parseXml() failed" << LL_ENDL; - return FALSE; + return false; } } - return TRUE; + return true; } //----------------------------------------------------------------------------- // parseXmlDriverNodes(): parses <driver_parameters> nodes from XML tree //----------------------------------------------------------------------------- -BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlDriverNodes(LLXmlTreeNode* root) +bool LLAvatarAppearance::LLAvatarXmlInfo::parseXmlDriverNodes(LLXmlTreeNode* root) { LLXmlTreeNode* driver = root->getChildByName( "driver_parameters" ); if( driver ) @@ -2033,23 +2021,23 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlDriverNodes(LLXmlTreeNode* roo { delete driver_info; LL_WARNS() << "avatar file: driver_param->parseXml() failed" << LL_ENDL; - return FALSE; + return false; } } } } - return TRUE; + return true; } //----------------------------------------------------------------------------- // parseXmlDriverNodes(): parses <driver_parameters> nodes from XML tree //----------------------------------------------------------------------------- -BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMorphNodes(LLXmlTreeNode* root) +bool LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMorphNodes(LLXmlTreeNode* root) { LLXmlTreeNode* masks = root->getChildByName( "morph_masks" ); if( !masks ) { - return FALSE; + return false; } for (LLXmlTreeNode* grand_child = masks->getChildByName( "mask" ); @@ -2063,7 +2051,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMorphNodes(LLXmlTreeNode* root { LL_WARNS() << "No name supplied for morph mask." << LL_ENDL; delete info; - return FALSE; + return false; } static LLStdStringHandle region_string = LLXmlTree::addAttributeString("body_region"); @@ -2071,7 +2059,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMorphNodes(LLXmlTreeNode* root { LL_WARNS() << "No region supplied for morph mask." << LL_ENDL; delete info; - return FALSE; + return false; } static LLStdStringHandle layer_string = LLXmlTree::addAttributeString("layer"); @@ -2079,7 +2067,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMorphNodes(LLXmlTreeNode* root { LL_WARNS() << "No layer supplied for morph mask." << LL_ENDL; delete info; - return FALSE; + return false; } // optional parameter. don't throw a warning if not present. @@ -2089,11 +2077,11 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMorphNodes(LLXmlTreeNode* root mMorphMaskInfoList.push_back(info); } - return TRUE; + return true; } //virtual -LLAvatarAppearance::LLMaskedMorph::LLMaskedMorph(LLVisualParam *morph_target, BOOL invert, std::string layer) : +LLAvatarAppearance::LLMaskedMorph::LLMaskedMorph(LLVisualParam *morph_target, bool invert, std::string layer) : mMorphTarget(morph_target), mInvert(invert), mLayer(layer) diff --git a/indra/llappearance/llavatarappearance.h b/indra/llappearance/llavatarappearance.h index dc2d48fb74..13e504e639 100644 --- a/indra/llappearance/llavatarappearance.h +++ b/indra/llappearance/llavatarappearance.h @@ -70,10 +70,10 @@ public: static void initClass(); static void cleanupClass(); // Cleanup data that's only init'd once per class. virtual void initInstance(); // Called after construction to initialize the instance. - S32 mInitFlags; - virtual BOOL loadSkeletonNode(); - BOOL loadMeshNodes(); - BOOL loadLayersets(); + S32 mInitFlags{ 0 }; + virtual bool loadSkeletonNode(); + bool loadMeshNodes(); + bool loadLayersets(); /** Initialization @@ -108,9 +108,9 @@ public: **/ public: virtual bool isSelf() const { return false; } // True if this avatar is for this viewer's agent - virtual BOOL isValid() const; - virtual BOOL isUsingLocalAppearance() const = 0; - virtual BOOL isEditingAppearance() const = 0; + virtual bool isValid() const; + virtual bool isUsingLocalAppearance() const = 0; + virtual bool isEditingAppearance() const = 0; bool isBuilt() const { return mIsBuilt; } @@ -135,8 +135,8 @@ public: F32 getPelvisToFoot() const { return mPelvisToFoot; } /*virtual*/ LLJoint* getRootJoint() { return mRoot; } - LLVector3 mHeadOffset; // current head position - LLAvatarJoint *mRoot; + LLVector3 mHeadOffset{}; // current head position + LLAvatarJoint* mRoot{ nullptr }; typedef std::map<std::string, LLJoint*> joint_map_t; joint_map_t mJointMap; @@ -146,7 +146,7 @@ public: joint_state_map_t mCurrBodySizeState; void compareJointStateMaps(joint_state_map_t& last_state, joint_state_map_t& curr_state); - void computeBodySize(); + void computeBodySize(); public: typedef std::vector<LLAvatarJoint*> avatar_joint_list_t; @@ -156,16 +156,16 @@ public: protected: - static BOOL parseSkeletonFile(const std::string& filename, LLXmlTree& skeleton_xml_tree); + static bool parseSkeletonFile(const std::string& filename, LLXmlTree& skeleton_xml_tree); virtual void buildCharacter(); - virtual BOOL loadAvatar(); + virtual bool loadAvatar(); - BOOL setupBone(const LLAvatarBoneInfo* info, LLJoint* parent, S32 ¤t_volume_num, S32 ¤t_joint_num); - BOOL allocateCharacterJoints(U32 num); - BOOL buildSkeleton(const LLAvatarSkeletonInfo *info); + bool setupBone(const LLAvatarBoneInfo* info, LLJoint* parent, S32 ¤t_volume_num, S32 ¤t_joint_num); + bool allocateCharacterJoints(U32 num); + bool buildSkeleton(const LLAvatarSkeletonInfo *info); void clearSkeleton(); - BOOL mIsBuilt; // state of deferred character building + bool mIsBuilt{ false }; // state of deferred character building avatar_joint_list_t mSkeleton; LLVector3OverrideMap mPelvisFixups; joint_alias_map_t mJointAliasMap; @@ -182,30 +182,30 @@ public: LLVector3 mBodySize; LLVector3 mAvatarOffset; protected: - F32 mPelvisToFoot; + F32 mPelvisToFoot{ 0.f }; //-------------------------------------------------------------------- // Cached pointers to well known joints //-------------------------------------------------------------------- public: - LLJoint* mPelvisp; - LLJoint* mTorsop; - LLJoint* mChestp; - LLJoint* mNeckp; - LLJoint* mHeadp; - LLJoint* mSkullp; - LLJoint* mEyeLeftp; - LLJoint* mEyeRightp; - LLJoint* mHipLeftp; - LLJoint* mHipRightp; - LLJoint* mKneeLeftp; - LLJoint* mKneeRightp; - LLJoint* mAnkleLeftp; - LLJoint* mAnkleRightp; - LLJoint* mFootLeftp; - LLJoint* mFootRightp; - LLJoint* mWristLeftp; - LLJoint* mWristRightp; + LLJoint* mPelvisp{nullptr}; + LLJoint* mTorsop{ nullptr }; + LLJoint* mChestp{ nullptr }; + LLJoint* mNeckp{ nullptr }; + LLJoint* mHeadp{ nullptr }; + LLJoint* mSkullp{ nullptr }; + LLJoint* mEyeLeftp{ nullptr }; + LLJoint* mEyeRightp{ nullptr }; + LLJoint* mHipLeftp{ nullptr }; + LLJoint* mHipRightp{ nullptr }; + LLJoint* mKneeLeftp{ nullptr }; + LLJoint* mKneeRightp{ nullptr }; + LLJoint* mAnkleLeftp{ nullptr }; + LLJoint* mAnkleRightp{ nullptr }; + LLJoint* mFootLeftp{ nullptr }; + LLJoint* mFootRightp{ nullptr }; + LLJoint* mWristLeftp{ nullptr }; + LLJoint* mWristRightp{ nullptr }; //-------------------------------------------------------------------- // XML parse tree @@ -225,14 +225,14 @@ protected: ** RENDERING **/ public: - BOOL mIsDummy; // for special views and animated object controllers; local to viewer + bool mIsDummy{ false }; // for special views and animated object controllers; local to viewer //-------------------------------------------------------------------- // Morph masks //-------------------------------------------------------------------- public: - void addMaskedMorph(LLAvatarAppearanceDefines::EBakedTextureIndex index, LLVisualParam* morph_target, BOOL invert, std::string layer); - virtual void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLAvatarAppearanceDefines::EBakedTextureIndex index = LLAvatarAppearanceDefines::BAKED_NUM_INDICES) = 0; + void addMaskedMorph(LLAvatarAppearanceDefines::EBakedTextureIndex index, LLVisualParam* morph_target, bool invert, std::string layer); + virtual void applyMorphMask(const U8* tex_data, S32 width, S32 height, S32 num_components, LLAvatarAppearanceDefines::EBakedTextureIndex index = LLAvatarAppearanceDefines::BAKED_NUM_INDICES) = 0; /** Rendering ** ** @@ -279,7 +279,7 @@ protected: public: void setClothesColor(LLAvatarAppearanceDefines::ETextureIndex te, const LLColor4& new_color); LLColor4 getClothesColor(LLAvatarAppearanceDefines::ETextureIndex te); - static BOOL teToColorParams(LLAvatarAppearanceDefines::ETextureIndex te, U32 *param_name); + static bool teToColorParams(LLAvatarAppearanceDefines::ETextureIndex te, U32 *param_name); //-------------------------------------------------------------------- // Global colors @@ -288,9 +288,9 @@ public: LLColor4 getGlobalColor(const std::string& color_name ) const; virtual void onGlobalColorChanged(const LLTexGlobalColor* global_color) = 0; protected: - LLTexGlobalColor* mTexSkinColor; - LLTexGlobalColor* mTexHairColor; - LLTexGlobalColor* mTexEyeColor; + LLTexGlobalColor* mTexSkinColor{ nullptr }; + LLTexGlobalColor* mTexHairColor{ nullptr }; + LLTexGlobalColor* mTexEyeColor{ nullptr }; //-------------------------------------------------------------------- // Visibility @@ -309,11 +309,11 @@ public: public: LLWearableData* getWearableData() { return mWearableData; } const LLWearableData* getWearableData() const { return mWearableData; } - virtual BOOL isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex te, U32 index = 0 ) const = 0; - virtual BOOL isWearingWearableType(LLWearableType::EType type ) const; + virtual bool isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex te, U32 index = 0 ) const = 0; + virtual bool isWearingWearableType(LLWearableType::EType type ) const; private: - LLWearableData* mWearableData; + LLWearableData* mWearableData{ nullptr }; /******************************************************************************** ** ** @@ -331,11 +331,11 @@ protected: struct BakedTextureData { LLUUID mLastTextureID; - LLTexLayerSet* mTexLayerSet; // Only exists for self - bool mIsLoaded; - bool mIsUsed; - LLAvatarAppearanceDefines::ETextureIndex mTextureIndex; - U32 mMaskTexName; + LLTexLayerSet* mTexLayerSet{ nullptr }; // Only exists for self + bool mIsLoaded{ false }; + bool mIsUsed{ false }; + LLAvatarAppearanceDefines::ETextureIndex mTextureIndex{ LLAvatarAppearanceDefines::ETextureIndex::TEX_INVALID }; + U32 mMaskTexName{ 0 }; // Stores pointers to the joint meshes that this baked texture deals with avatar_joint_mesh_list_t mJointMeshes; morph_list_t mMaskedMorphs; @@ -352,11 +352,11 @@ protected: // Collision volumes //-------------------------------------------------------------------- public: - S32 mNumBones; - S32 mNumCollisionVolumes; - LLAvatarJointCollisionVolume* mCollisionVolumes; + S32 mNumBones{ 0 }; + S32 mNumCollisionVolumes{ 0 }; + LLAvatarJointCollisionVolume* mCollisionVolumes{ nullptr }; protected: - BOOL allocateCollisionVolumes(U32 num); + bool allocateCollisionVolumes(U32 num); /** Physics ** ** @@ -372,16 +372,16 @@ protected: LLAvatarXmlInfo(); ~LLAvatarXmlInfo(); - BOOL parseXmlSkeletonNode(LLXmlTreeNode* root); - BOOL parseXmlMeshNodes(LLXmlTreeNode* root); - BOOL parseXmlColorNodes(LLXmlTreeNode* root); - BOOL parseXmlLayerNodes(LLXmlTreeNode* root); - BOOL parseXmlDriverNodes(LLXmlTreeNode* root); - BOOL parseXmlMorphNodes(LLXmlTreeNode* root); + bool parseXmlSkeletonNode(LLXmlTreeNode* root); + bool parseXmlMeshNodes(LLXmlTreeNode* root); + bool parseXmlColorNodes(LLXmlTreeNode* root); + bool parseXmlLayerNodes(LLXmlTreeNode* root); + bool parseXmlDriverNodes(LLXmlTreeNode* root); + bool parseXmlMorphNodes(LLXmlTreeNode* root); struct LLAvatarMeshInfo { - typedef std::pair<LLViewerVisualParamInfo*,BOOL> morph_info_pair_t; // LLPolyMorphTargetInfo stored here + typedef std::pair<LLViewerVisualParamInfo*,bool> morph_info_pair_t; // LLPolyMorphTargetInfo stored here typedef std::vector<morph_info_pair_t> morph_info_list_t; LLAvatarMeshInfo() : mLOD(0), mMinPixelArea(.1f) {} @@ -410,8 +410,8 @@ protected: struct LLAvatarAttachmentInfo { LLAvatarAttachmentInfo() - : mGroup(-1), mAttachmentID(-1), mPieMenuSlice(-1), mVisibleFirstPerson(FALSE), - mIsHUDAttachment(FALSE), mHasPosition(FALSE), mHasRotation(FALSE) {} + : mGroup(-1), mAttachmentID(-1), mPieMenuSlice(-1), mVisibleFirstPerson(false), + mIsHUDAttachment(false), mHasPosition(false), mHasRotation(false) {} std::string mName; std::string mJointName; LLVector3 mPosition; @@ -419,10 +419,10 @@ protected: S32 mGroup; S32 mAttachmentID; S32 mPieMenuSlice; - BOOL mVisibleFirstPerson; - BOOL mIsHUDAttachment; - BOOL mHasPosition; - BOOL mHasRotation; + bool mVisibleFirstPerson; + bool mIsHUDAttachment; + bool mHasPosition; + bool mHasRotation; }; typedef std::vector<LLAvatarAttachmentInfo*> attachment_info_list_t; attachment_info_list_t mAttachmentInfoList; @@ -440,11 +440,11 @@ protected: struct LLAvatarMorphInfo { LLAvatarMorphInfo() - : mInvert(FALSE) {} + : mInvert(false) {} std::string mName; std::string mRegion; std::string mLayer; - BOOL mInvert; + bool mInvert; }; typedef std::vector<LLAvatarMorphInfo*> morph_info_list_t; @@ -455,10 +455,10 @@ protected: class LLMaskedMorph { public: - LLMaskedMorph(LLVisualParam *morph_target, BOOL invert, std::string layer); + LLMaskedMorph(LLVisualParam *morph_target, bool invert, std::string layer); LLVisualParam *mMorphTarget; - BOOL mInvert; + bool mInvert; std::string mLayer; }; /** Support Classes diff --git a/indra/llappearance/llavatarappearancedefines.cpp b/indra/llappearance/llavatarappearancedefines.cpp index 0e51fd459e..c69517cb22 100644 --- a/indra/llappearance/llavatarappearancedefines.cpp +++ b/indra/llappearance/llavatarappearancedefines.cpp @@ -39,56 +39,56 @@ using namespace LLAvatarAppearanceDefines; LLAvatarAppearanceDictionary::Textures::Textures() { - addEntry(TEX_HEAD_BODYPAINT, new TextureEntry("head_bodypaint", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_SKIN)); - addEntry(TEX_UPPER_SHIRT, new TextureEntry("upper_shirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultShirtUUID", LLWearableType::WT_SHIRT)); - addEntry(TEX_LOWER_PANTS, new TextureEntry("lower_pants", TRUE, BAKED_NUM_INDICES, "UIImgDefaultPantsUUID", LLWearableType::WT_PANTS)); - addEntry(TEX_EYES_IRIS, new TextureEntry("eyes_iris", TRUE, BAKED_NUM_INDICES, "UIImgDefaultEyesUUID", LLWearableType::WT_EYES)); - addEntry(TEX_HAIR, new TextureEntry("hair_grain", TRUE, BAKED_NUM_INDICES, "UIImgDefaultHairUUID", LLWearableType::WT_HAIR)); - addEntry(TEX_UPPER_BODYPAINT, new TextureEntry("upper_bodypaint", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_SKIN)); - addEntry(TEX_LOWER_BODYPAINT, new TextureEntry("lower_bodypaint", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_SKIN)); - addEntry(TEX_LOWER_SHOES, new TextureEntry("lower_shoes", TRUE, BAKED_NUM_INDICES, "UIImgDefaultShoesUUID", LLWearableType::WT_SHOES)); - addEntry(TEX_LOWER_SOCKS, new TextureEntry("lower_socks", TRUE, BAKED_NUM_INDICES, "UIImgDefaultSocksUUID", LLWearableType::WT_SOCKS)); - addEntry(TEX_UPPER_JACKET, new TextureEntry("upper_jacket", TRUE, BAKED_NUM_INDICES, "UIImgDefaultJacketUUID", LLWearableType::WT_JACKET)); - addEntry(TEX_LOWER_JACKET, new TextureEntry("lower_jacket", TRUE, BAKED_NUM_INDICES, "UIImgDefaultJacketUUID", LLWearableType::WT_JACKET)); - addEntry(TEX_UPPER_GLOVES, new TextureEntry("upper_gloves", TRUE, BAKED_NUM_INDICES, "UIImgDefaultGlovesUUID", LLWearableType::WT_GLOVES)); - addEntry(TEX_UPPER_UNDERSHIRT, new TextureEntry("upper_undershirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultUnderwearUUID", LLWearableType::WT_UNDERSHIRT)); - addEntry(TEX_LOWER_UNDERPANTS, new TextureEntry("lower_underpants", TRUE, BAKED_NUM_INDICES, "UIImgDefaultUnderwearUUID", LLWearableType::WT_UNDERPANTS)); - addEntry(TEX_SKIRT, new TextureEntry("skirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultSkirtUUID", LLWearableType::WT_SKIRT)); - - addEntry(TEX_LOWER_ALPHA, new TextureEntry("lower_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA)); - addEntry(TEX_UPPER_ALPHA, new TextureEntry("upper_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA)); - addEntry(TEX_HEAD_ALPHA, new TextureEntry("head_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA)); - addEntry(TEX_EYES_ALPHA, new TextureEntry("eyes_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA)); - addEntry(TEX_HAIR_ALPHA, new TextureEntry("hair_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA)); - - addEntry(TEX_HEAD_TATTOO, new TextureEntry("head_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO)); - addEntry(TEX_UPPER_TATTOO, new TextureEntry("upper_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO)); - addEntry(TEX_LOWER_TATTOO, new TextureEntry("lower_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO)); - - addEntry(TEX_HEAD_UNIVERSAL_TATTOO, new TextureEntry("head_universal_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL)); - addEntry(TEX_UPPER_UNIVERSAL_TATTOO, new TextureEntry("upper_universal_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL)); - addEntry(TEX_LOWER_UNIVERSAL_TATTOO, new TextureEntry("lower_universal_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL)); - addEntry(TEX_SKIRT_TATTOO, new TextureEntry("skirt_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL)); - addEntry(TEX_HAIR_TATTOO, new TextureEntry("hair_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL)); - addEntry(TEX_EYES_TATTOO, new TextureEntry("eyes_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL)); - addEntry(TEX_LEFT_ARM_TATTOO, new TextureEntry("leftarm_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL)); - addEntry(TEX_LEFT_LEG_TATTOO, new TextureEntry("leftleg_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL)); - addEntry(TEX_AUX1_TATTOO, new TextureEntry("aux1_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL)); - addEntry(TEX_AUX2_TATTOO, new TextureEntry("aux2_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL)); - addEntry(TEX_AUX3_TATTOO, new TextureEntry("aux3_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL)); - - - addEntry(TEX_HEAD_BAKED, new TextureEntry("head-baked", FALSE, BAKED_HEAD, "head")); - addEntry(TEX_UPPER_BAKED, new TextureEntry("upper-baked", FALSE, BAKED_UPPER, "upper")); - addEntry(TEX_LOWER_BAKED, new TextureEntry("lower-baked", FALSE, BAKED_LOWER, "lower")); - addEntry(TEX_EYES_BAKED, new TextureEntry("eyes-baked", FALSE, BAKED_EYES, "eyes")); - addEntry(TEX_HAIR_BAKED, new TextureEntry("hair-baked", FALSE, BAKED_HAIR, "hair")); - addEntry(TEX_SKIRT_BAKED, new TextureEntry("skirt-baked", FALSE, BAKED_SKIRT, "skirt")); - addEntry(TEX_LEFT_ARM_BAKED, new TextureEntry("leftarm-baked", FALSE, BAKED_LEFT_ARM, "leftarm")); - addEntry(TEX_LEFT_LEG_BAKED, new TextureEntry("leftleg-baked", FALSE, BAKED_LEFT_LEG, "leftleg")); - addEntry(TEX_AUX1_BAKED, new TextureEntry("aux1-baked", FALSE, BAKED_AUX1, "aux1")); - addEntry(TEX_AUX2_BAKED, new TextureEntry("aux2-baked", FALSE, BAKED_AUX2, "aux2")); - addEntry(TEX_AUX3_BAKED, new TextureEntry("aux3-baked", FALSE, BAKED_AUX3, "aux3")); + addEntry(TEX_HEAD_BODYPAINT, new TextureEntry("head_bodypaint", true, BAKED_NUM_INDICES, "", LLWearableType::WT_SKIN)); + addEntry(TEX_UPPER_SHIRT, new TextureEntry("upper_shirt", true, BAKED_NUM_INDICES, "UIImgDefaultShirtUUID", LLWearableType::WT_SHIRT)); + addEntry(TEX_LOWER_PANTS, new TextureEntry("lower_pants", true, BAKED_NUM_INDICES, "UIImgDefaultPantsUUID", LLWearableType::WT_PANTS)); + addEntry(TEX_EYES_IRIS, new TextureEntry("eyes_iris", true, BAKED_NUM_INDICES, "UIImgDefaultEyesUUID", LLWearableType::WT_EYES)); + addEntry(TEX_HAIR, new TextureEntry("hair_grain", true, BAKED_NUM_INDICES, "UIImgDefaultHairUUID", LLWearableType::WT_HAIR)); + addEntry(TEX_UPPER_BODYPAINT, new TextureEntry("upper_bodypaint", true, BAKED_NUM_INDICES, "", LLWearableType::WT_SKIN)); + addEntry(TEX_LOWER_BODYPAINT, new TextureEntry("lower_bodypaint", true, BAKED_NUM_INDICES, "", LLWearableType::WT_SKIN)); + addEntry(TEX_LOWER_SHOES, new TextureEntry("lower_shoes", true, BAKED_NUM_INDICES, "UIImgDefaultShoesUUID", LLWearableType::WT_SHOES)); + addEntry(TEX_LOWER_SOCKS, new TextureEntry("lower_socks", true, BAKED_NUM_INDICES, "UIImgDefaultSocksUUID", LLWearableType::WT_SOCKS)); + addEntry(TEX_UPPER_JACKET, new TextureEntry("upper_jacket", true, BAKED_NUM_INDICES, "UIImgDefaultJacketUUID", LLWearableType::WT_JACKET)); + addEntry(TEX_LOWER_JACKET, new TextureEntry("lower_jacket", true, BAKED_NUM_INDICES, "UIImgDefaultJacketUUID", LLWearableType::WT_JACKET)); + addEntry(TEX_UPPER_GLOVES, new TextureEntry("upper_gloves", true, BAKED_NUM_INDICES, "UIImgDefaultGlovesUUID", LLWearableType::WT_GLOVES)); + addEntry(TEX_UPPER_UNDERSHIRT, new TextureEntry("upper_undershirt", true, BAKED_NUM_INDICES, "UIImgDefaultUnderwearUUID", LLWearableType::WT_UNDERSHIRT)); + addEntry(TEX_LOWER_UNDERPANTS, new TextureEntry("lower_underpants", true, BAKED_NUM_INDICES, "UIImgDefaultUnderwearUUID", LLWearableType::WT_UNDERPANTS)); + addEntry(TEX_SKIRT, new TextureEntry("skirt", true, BAKED_NUM_INDICES, "UIImgDefaultSkirtUUID", LLWearableType::WT_SKIRT)); + + addEntry(TEX_LOWER_ALPHA, new TextureEntry("lower_alpha", true, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA)); + addEntry(TEX_UPPER_ALPHA, new TextureEntry("upper_alpha", true, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA)); + addEntry(TEX_HEAD_ALPHA, new TextureEntry("head_alpha", true, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA)); + addEntry(TEX_EYES_ALPHA, new TextureEntry("eyes_alpha", true, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA)); + addEntry(TEX_HAIR_ALPHA, new TextureEntry("hair_alpha", true, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA)); + + addEntry(TEX_HEAD_TATTOO, new TextureEntry("head_tattoo", true, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO)); + addEntry(TEX_UPPER_TATTOO, new TextureEntry("upper_tattoo", true, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO)); + addEntry(TEX_LOWER_TATTOO, new TextureEntry("lower_tattoo", true, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO)); + + addEntry(TEX_HEAD_UNIVERSAL_TATTOO, new TextureEntry("head_universal_tattoo", true, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL)); + addEntry(TEX_UPPER_UNIVERSAL_TATTOO, new TextureEntry("upper_universal_tattoo", true, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL)); + addEntry(TEX_LOWER_UNIVERSAL_TATTOO, new TextureEntry("lower_universal_tattoo", true, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL)); + addEntry(TEX_SKIRT_TATTOO, new TextureEntry("skirt_tattoo", true, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL)); + addEntry(TEX_HAIR_TATTOO, new TextureEntry("hair_tattoo", true, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL)); + addEntry(TEX_EYES_TATTOO, new TextureEntry("eyes_tattoo", true, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL)); + addEntry(TEX_LEFT_ARM_TATTOO, new TextureEntry("leftarm_tattoo", true, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL)); + addEntry(TEX_LEFT_LEG_TATTOO, new TextureEntry("leftleg_tattoo", true, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL)); + addEntry(TEX_AUX1_TATTOO, new TextureEntry("aux1_tattoo", true, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL)); + addEntry(TEX_AUX2_TATTOO, new TextureEntry("aux2_tattoo", true, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL)); + addEntry(TEX_AUX3_TATTOO, new TextureEntry("aux3_tattoo", true, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL)); + + + addEntry(TEX_HEAD_BAKED, new TextureEntry("head-baked", false, BAKED_HEAD, "head")); + addEntry(TEX_UPPER_BAKED, new TextureEntry("upper-baked", false, BAKED_UPPER, "upper")); + addEntry(TEX_LOWER_BAKED, new TextureEntry("lower-baked", false, BAKED_LOWER, "lower")); + addEntry(TEX_EYES_BAKED, new TextureEntry("eyes-baked", false, BAKED_EYES, "eyes")); + addEntry(TEX_HAIR_BAKED, new TextureEntry("hair-baked", false, BAKED_HAIR, "hair")); + addEntry(TEX_SKIRT_BAKED, new TextureEntry("skirt-baked", false, BAKED_SKIRT, "skirt")); + addEntry(TEX_LEFT_ARM_BAKED, new TextureEntry("leftarm-baked", false, BAKED_LEFT_ARM, "leftarm")); + addEntry(TEX_LEFT_LEG_BAKED, new TextureEntry("leftleg-baked", false, BAKED_LEFT_LEG, "leftleg")); + addEntry(TEX_AUX1_BAKED, new TextureEntry("aux1-baked", false, BAKED_AUX1, "aux1")); + addEntry(TEX_AUX2_BAKED, new TextureEntry("aux2-baked", false, BAKED_AUX2, "aux2")); + addEntry(TEX_AUX3_BAKED, new TextureEntry("aux3-baked", false, BAKED_AUX3, "aux3")); } LLAvatarAppearanceDictionary::BakedTextures::BakedTextures() @@ -303,15 +303,15 @@ LLWearableType::EType LLAvatarAppearanceDictionary::getTEWearableType(ETextureIn } // static -BOOL LLAvatarAppearanceDictionary::isBakedImageId(const LLUUID& id) +bool LLAvatarAppearanceDictionary::isBakedImageId(const LLUUID& id) { if ((id == IMG_USE_BAKED_EYES) || (id == IMG_USE_BAKED_HAIR) || (id == IMG_USE_BAKED_HEAD) || (id == IMG_USE_BAKED_LOWER) || (id == IMG_USE_BAKED_SKIRT) || (id == IMG_USE_BAKED_UPPER) || (id == IMG_USE_BAKED_LEFTARM) || (id == IMG_USE_BAKED_LEFTLEG) || (id == IMG_USE_BAKED_AUX1) || (id == IMG_USE_BAKED_AUX2) || (id == IMG_USE_BAKED_AUX3) ) { - return TRUE; + return true; } - return FALSE; + return false; } // static diff --git a/indra/llappearance/llavatarappearancedefines.h b/indra/llappearance/llavatarappearancedefines.h index 414bf8bbc1..50a72a45a5 100644 --- a/indra/llappearance/llavatarappearancedefines.h +++ b/indra/llappearance/llavatarappearancedefines.h @@ -40,7 +40,7 @@ namespace LLAvatarAppearanceDefines extern const S32 SCRATCH_TEX_WIDTH; extern const S32 SCRATCH_TEX_HEIGHT; -static const U32 AVATAR_HOVER = 11001; +static constexpr U32 AVATAR_HOVER = 11001; //-------------------------------------------------------------------- // Enums @@ -167,10 +167,10 @@ public: const std::string mDefaultImageName; const LLWearableType::EType mWearableType; // It's either a local texture xor baked - BOOL mIsLocalTexture; - BOOL mIsBakedTexture; + bool mIsLocalTexture; + bool mIsBakedTexture; // If it's a local texture, it may be used by a baked texture - BOOL mIsUsedByBakedTexture; + bool mIsUsedByBakedTexture; EBakedTextureIndex mBakedTextureIndex; }; @@ -244,7 +244,7 @@ public: // Given a texture entry, determine which wearable type owns it. LLWearableType::EType getTEWearableType(ETextureIndex index) const; - static BOOL isBakedImageId(const LLUUID& id); + static bool isBakedImageId(const LLUUID& id); static EBakedTextureIndex assetIdToBakedTextureIndex(const LLUUID& id); static LLUUID localTextureIndexToMagicId(ETextureIndex t); diff --git a/indra/llappearance/llavatarjoint.cpp b/indra/llappearance/llavatarjoint.cpp index 5dae4c86cb..2aa6cb63e1 100644 --- a/indra/llappearance/llavatarjoint.cpp +++ b/indra/llappearance/llavatarjoint.cpp @@ -40,7 +40,7 @@ const F32 DEFAULT_AVATAR_JOINT_LOD = 0.0f; //----------------------------------------------------------------------------- // Static Data //----------------------------------------------------------------------------- -BOOL LLAvatarJoint::sDisableLOD = FALSE; +bool LLAvatarJoint::sDisableLOD = false; //----------------------------------------------------------------------------- // LLAvatarJoint() @@ -66,13 +66,13 @@ LLAvatarJoint::LLAvatarJoint(const std::string &name, LLJoint *parent) : void LLAvatarJoint::init() { - mValid = FALSE; + mValid = false; mComponents = SC_JOINT | SC_BONE | SC_AXES; mMinPixelArea = DEFAULT_AVATAR_JOINT_LOD; mPickName = PN_DEFAULT; - mVisible = TRUE; + mVisible = true; mMeshID = 0; - mIsTransparent = FALSE; + mIsTransparent = false; } @@ -88,7 +88,7 @@ LLAvatarJoint::~LLAvatarJoint() //-------------------------------------------------------------------- // setValid() //-------------------------------------------------------------------- -void LLAvatarJoint::setValid( BOOL valid, BOOL recursive ) +void LLAvatarJoint::setValid( bool valid, bool recursive ) { //---------------------------------------------------------------- // set visibility for this joint @@ -103,7 +103,7 @@ void LLAvatarJoint::setValid( BOOL valid, BOOL recursive ) for (LLJoint* child : mChildren) { LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(child); - joint->setValid(valid, TRUE); + joint->setValid(valid, true); } } @@ -112,7 +112,7 @@ void LLAvatarJoint::setValid( BOOL valid, BOOL recursive ) //-------------------------------------------------------------------- // setSkeletonComponents() //-------------------------------------------------------------------- -void LLAvatarJoint::setSkeletonComponents( U32 comp, BOOL recursive ) +void LLAvatarJoint::setSkeletonComponents( U32 comp, bool recursive ) { mComponents = comp; if (recursive) @@ -125,7 +125,7 @@ void LLAvatarJoint::setSkeletonComponents( U32 comp, BOOL recursive ) } } -void LLAvatarJoint::setVisible(BOOL visible, BOOL recursive) +void LLAvatarJoint::setVisible(bool visible, bool recursive) { mVisible = visible; @@ -148,7 +148,7 @@ void LLAvatarJoint::updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pix } } -void LLAvatarJoint::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind, bool terse_update) +void LLAvatarJoint::updateFaceData(LLFace *face, F32 pixel_area, bool damp_wind, bool terse_update) { for (LLJoint* child : mChildren) { @@ -167,10 +167,10 @@ void LLAvatarJoint::updateJointGeometry() } -BOOL LLAvatarJoint::updateLOD(F32 pixel_area, BOOL activate) +bool LLAvatarJoint::updateLOD(F32 pixel_area, bool activate) { - BOOL lod_changed = FALSE; - BOOL found_lod = FALSE; + bool lod_changed = false; + bool found_lod = false; for (LLJoint* child : mChildren) { @@ -180,18 +180,18 @@ BOOL LLAvatarJoint::updateLOD(F32 pixel_area, BOOL activate) if (found_lod || jointLOD == DEFAULT_AVATAR_JOINT_LOD) { // we've already found a joint to enable, so enable the rest as alternatives - lod_changed |= joint->updateLOD(pixel_area, TRUE); + lod_changed |= joint->updateLOD(pixel_area, true); } else { if (pixel_area >= jointLOD || sDisableLOD) { - lod_changed |= joint->updateLOD(pixel_area, TRUE); - found_lod = TRUE; + lod_changed |= joint->updateLOD(pixel_area, true); + found_lod = true; } else { - lod_changed |= joint->updateLOD(pixel_area, FALSE); + lod_changed |= joint->updateLOD(pixel_area, false); } } } @@ -222,11 +222,11 @@ void LLAvatarJoint::setMeshesToChildren() LLAvatarJointCollisionVolume::LLAvatarJointCollisionVolume() { - mUpdateXform = FALSE; + mUpdateXform = false; } /*virtual*/ -U32 LLAvatarJointCollisionVolume::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy ) +U32 LLAvatarJointCollisionVolume::render( F32 pixelArea, bool first_pass, bool is_dummy ) { LL_ERRS() << "Cannot call render() on LLAvatarJointCollisionVolume" << LL_ENDL; return 0; @@ -234,7 +234,7 @@ U32 LLAvatarJointCollisionVolume::render( F32 pixelArea, BOOL first_pass, BOOL i LLVector3 LLAvatarJointCollisionVolume::getVolumePos(LLVector3 &offset) { - mUpdateXform = TRUE; + mUpdateXform = true; LLVector3 result = offset; result.scaleVec(getScale()); diff --git a/indra/llappearance/llavatarjoint.h b/indra/llappearance/llavatarjoint.h index bc7c932955..13f025fd5f 100644 --- a/indra/llappearance/llavatarjoint.h +++ b/indra/llappearance/llavatarjoint.h @@ -52,17 +52,17 @@ public: virtual ~LLAvatarJoint(); // Gets the validity of this joint - BOOL getValid() { return mValid; } + bool getValid() { return mValid; } // Sets the validity of this joint - virtual void setValid( BOOL valid, BOOL recursive=FALSE ); + virtual void setValid( bool valid, bool recursive=false ); // Returns true if this object is transparent. // This is used to determine in which order to draw objects. - virtual BOOL isTransparent() { return mIsTransparent; } + virtual bool isTransparent() { return mIsTransparent; } // Returns true if this object should inherit scale modifiers from its immediate parent - virtual BOOL inheritScale() { return FALSE; } + virtual bool inheritScale() { return false; } enum Components { @@ -72,7 +72,7 @@ public: }; // Selects which skeleton components to draw - void setSkeletonComponents( U32 comp, BOOL recursive = TRUE ); + void setSkeletonComponents( U32 comp, bool recursive = true ); // Returns which skeleton components are enables for drawing U32 getSkeletonComponents() { return mComponents; } @@ -90,34 +90,34 @@ public: void setPickName(LLJointPickName name) { mPickName = name; } LLJointPickName getPickName() { return mPickName; } - void setVisible( BOOL visible, BOOL recursive ); + void setVisible( bool visible, bool recursive ); // Takes meshes in mMeshParts and sets each one as a child joint void setMeshesToChildren(); // LLViewerJoint interface - virtual U32 render( F32 pixelArea, BOOL first_pass = TRUE, BOOL is_dummy = FALSE ) = 0; + virtual U32 render( F32 pixelArea, bool first_pass = true, bool is_dummy = false ) = 0; virtual void updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area); - virtual void updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind = FALSE, bool terse_update = false); - virtual BOOL updateLOD(F32 pixel_area, BOOL activate); + virtual void updateFaceData(LLFace *face, F32 pixel_area, bool damp_wind = false, bool terse_update = false); + virtual bool updateLOD(F32 pixel_area, bool activate); virtual void updateJointGeometry(); virtual void dump(); public: - static BOOL sDisableLOD; + static bool sDisableLOD; avatar_joint_mesh_list_t mMeshParts; //LLViewerJointMesh* void setMeshID( S32 id ) {mMeshID = id;} protected: void init(); - BOOL mValid; - BOOL mIsTransparent; + bool mValid; + bool mIsTransparent; U32 mComponents; F32 mMinPixelArea; LLJointPickName mPickName; - BOOL mVisible; + bool mVisible; S32 mMeshID; }; @@ -127,8 +127,8 @@ public: LLAvatarJointCollisionVolume(); virtual ~LLAvatarJointCollisionVolume() {}; - /*virtual*/ BOOL inheritScale() { return TRUE; } - /*virtual*/ U32 render( F32 pixelArea, BOOL first_pass = TRUE, BOOL is_dummy = FALSE ); + /*virtual*/ bool inheritScale() { return true; } + /*virtual*/ U32 render( F32 pixelArea, bool first_pass = true, bool is_dummy = false ); void renderCollision(); diff --git a/indra/llappearance/llavatarjointmesh.cpp b/indra/llappearance/llavatarjointmesh.cpp index aeac33b601..69a9023994 100644 --- a/indra/llappearance/llavatarjointmesh.cpp +++ b/indra/llappearance/llavatarjointmesh.cpp @@ -102,7 +102,7 @@ LLSkinJoint::~LLSkinJoint() //----------------------------------------------------------------------------- // LLSkinJoint::setupSkinJoint() //----------------------------------------------------------------------------- -BOOL LLSkinJoint::setupSkinJoint( LLAvatarJoint *joint) +bool LLSkinJoint::setupSkinJoint( LLAvatarJoint *joint) { // find the named joint mJoint = joint; @@ -119,7 +119,7 @@ BOOL LLSkinJoint::setupSkinJoint( LLAvatarJoint *joint) mRootToParentJointSkinOffset = totalSkinOffset(getBaseSkeletonAncestor(joint)); mRootToParentJointSkinOffset = -mRootToParentJointSkinOffset; - return TRUE; + return true; } @@ -129,7 +129,7 @@ BOOL LLSkinJoint::setupSkinJoint( LLAvatarJoint *joint) //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -BOOL LLAvatarJointMesh::sPipelineRender = FALSE; +bool LLAvatarJointMesh::sPipelineRender = false; U32 LLAvatarJointMesh::sClothingMaskImageName = 0; LLColor4 LLAvatarJointMesh::sClothingInnerColor; @@ -149,7 +149,7 @@ LLAvatarJointMesh::LLAvatarJointMesh() mColor[2] = 1.0f; mColor[3] = 1.0f; mShiny = 0.0f; - mCullBackFaces = TRUE; + mCullBackFaces = true; mMesh = NULL; @@ -159,11 +159,11 @@ LLAvatarJointMesh::LLAvatarJointMesh() mFace = NULL; mMeshID = 0; - mUpdateXform = FALSE; + mUpdateXform = false; - mValid = FALSE; + mValid = false; - mIsTransparent = FALSE; + mIsTransparent = false; } @@ -182,11 +182,11 @@ LLAvatarJointMesh::~LLAvatarJointMesh() //----------------------------------------------------------------------------- // LLAvatarJointMesh::allocateSkinData() //----------------------------------------------------------------------------- -BOOL LLAvatarJointMesh::allocateSkinData( U32 numSkinJoints ) +bool LLAvatarJointMesh::allocateSkinData( U32 numSkinJoints ) { mSkinJoints = new LLSkinJoint[ numSkinJoints ]; mNumSkinJoints = numSkinJoints; - return TRUE; + return true; } //----------------------------------------------------------------------------- @@ -247,12 +247,12 @@ void LLAvatarJointMesh::setTexture( LLGLTexture *texture ) { mLayerSet = NULL; //texture->bindTexture(0); - //texture->setClamp(TRUE, TRUE); + //texture->setClamp(true, true); } } -BOOL LLAvatarJointMesh::hasGLTexture() const +bool LLAvatarJointMesh::hasGLTexture() const { return mTexture.notNull() && mTexture->hasGLTexture(); } @@ -272,7 +272,7 @@ void LLAvatarJointMesh::setLayerSet( LLTexLayerSet* layer_set ) } } -BOOL LLAvatarJointMesh::hasComposite() const +bool LLAvatarJointMesh::hasComposite() const { return (mLayerSet && mLayerSet->hasComposite()); } diff --git a/indra/llappearance/llavatarjointmesh.h b/indra/llappearance/llavatarjointmesh.h index 80db7f6f15..33f50fce00 100644 --- a/indra/llappearance/llavatarjointmesh.h +++ b/indra/llappearance/llavatarjointmesh.h @@ -49,7 +49,7 @@ class LLSkinJoint public: LLSkinJoint(); ~LLSkinJoint(); - BOOL setupSkinJoint( LLAvatarJoint *joint); + bool setupSkinJoint( LLAvatarJoint *joint); LLAvatarJoint *mJoint; LLVector3 mRootToJointSkinOffset; @@ -69,7 +69,7 @@ protected: LLTexLayerSet* mLayerSet; // ptr to a layer set owned by the avatar U32 mTestImageName; // handle to a temporary texture for previewing uploads LLPolyMesh* mMesh; // ptr to a global polymesh - BOOL mCullBackFaces; // true by default + bool mCullBackFaces; // true by default LLFace* mFace; // ptr to a face w/ AGP copy of mesh U32 mFaceIndexCount; @@ -79,7 +79,7 @@ protected: S32 mMeshID; public: - static BOOL sPipelineRender; + static bool sPipelineRender; //RN: this is here for testing purposes static U32 sClothingMaskImageName; static LLColor4 sClothingInnerColor; @@ -104,14 +104,14 @@ public: // Sets the shape texture void setTexture( LLGLTexture *texture ); - BOOL hasGLTexture() const; + bool hasGLTexture() const; void setTestTexture( U32 name ) { mTestImageName = name; } // Sets layer set responsible for a dynamic shape texture (takes precedence over normal texture) void setLayerSet( LLTexLayerSet* layer_set ); - BOOL hasComposite() const; + bool hasComposite() const; // Gets the poly mesh LLPolyMesh *getMesh(); @@ -122,20 +122,17 @@ public: // Sets up joint matrix data for rendering void setupJoint(LLAvatarJoint* current_joint); - // Render time method to upload batches of joint matrices - void uploadJointMatrices(); - // Sets ID for picking void setMeshID( S32 id ) {mMeshID = id;} // Gets ID for picking S32 getMeshID() { return mMeshID; } - void setIsTransparent(BOOL is_transparent) { mIsTransparent = is_transparent; } + void setIsTransparent(bool is_transparent) { mIsTransparent = is_transparent; } private: // Allocate skin data - BOOL allocateSkinData( U32 numSkinJoints ); + bool allocateSkinData( U32 numSkinJoints ); // Free skin data void freeSkinData(); diff --git a/indra/llappearance/lldriverparam.cpp b/indra/llappearance/lldriverparam.cpp index 4a2db2aefb..2e933f9357 100644 --- a/indra/llappearance/lldriverparam.cpp +++ b/indra/llappearance/lldriverparam.cpp @@ -41,16 +41,16 @@ LLDriverParamInfo::LLDriverParamInfo() : { } -BOOL LLDriverParamInfo::parseXml(LLXmlTreeNode* node) +bool LLDriverParamInfo::parseXml(LLXmlTreeNode* node) { llassert( node->hasName( "param" ) && node->getChildByName( "param_driver" ) ); if( !LLViewerVisualParamInfo::parseXml( node )) - return FALSE; + return false; LLXmlTreeNode* param_driver_node = node->getChildByName( "param_driver" ); if( !param_driver_node ) - return FALSE; + return false; for (LLXmlTreeNode* child = param_driver_node->getChildByName( "driven" ); child; @@ -90,10 +90,10 @@ BOOL LLDriverParamInfo::parseXml(LLXmlTreeNode* node) else { LL_ERRS() << "<driven> Unable to resolve driven parameter: " << driven_id << LL_ENDL; - return FALSE; + return false; } } - return TRUE; + return true; } //virtual @@ -187,18 +187,18 @@ LLDriverParam::~LLDriverParam() { } -BOOL LLDriverParam::setInfo(LLDriverParamInfo *info) +bool LLDriverParam::setInfo(LLDriverParamInfo *info) { llassert(mInfo == NULL); if (info->mID < 0) - return FALSE; + return false; mInfo = info; mID = info->mID; info->mDriverParam = this; setWeight(getDefaultWeight()); - return TRUE; + return true; } /*virtual*/ LLViewerVisualParam* LLDriverParam::cloneParam(LLWearable* wearable) const @@ -422,7 +422,7 @@ const LLVector4a* LLDriverParam::getNextDistortion(U32 *index, LLPolyMesh **po S32 LLDriverParam::getDrivenParamsCount() const { - return mDriven.size(); + return static_cast<S32>(mDriven.size()); } const LLViewerVisualParam* LLDriverParam::getDrivenParam(S32 index) const @@ -461,25 +461,25 @@ void LLDriverParam::stopAnimating() for(LLDrivenEntry& driven : mDriven) { - driven.mParam->setAnimating(FALSE); + driven.mParam->setAnimating(false); } } /*virtual*/ -BOOL LLDriverParam::linkDrivenParams(visual_param_mapper mapper, BOOL only_cross_params) +bool LLDriverParam::linkDrivenParams(visual_param_mapper mapper, bool only_cross_params) { - BOOL success = TRUE; + bool success = true; for (LLDrivenEntryInfo& driven_info : getInfo()->mDrivenInfoList) { S32 driven_id = driven_info.mDrivenID; // check for already existing links. Do not overwrite. - BOOL found = FALSE; + bool found = false; for (auto& driven : mDriven) { if (driven.mInfo->mDrivenID == driven_id) { - found = TRUE; + found = true; } } @@ -494,7 +494,7 @@ BOOL LLDriverParam::linkDrivenParams(visual_param_mapper mapper, BOOL only_cross } else { - success = FALSE; + success = false; } } } diff --git a/indra/llappearance/lldriverparam.h b/indra/llappearance/lldriverparam.h index f93660dba3..59092988dd 100644 --- a/indra/llappearance/lldriverparam.h +++ b/indra/llappearance/lldriverparam.h @@ -65,7 +65,7 @@ public: LLDriverParamInfo(); /*virtual*/ ~LLDriverParamInfo() {}; - /*virtual*/ BOOL parseXml(LLXmlTreeNode* node); + /*virtual*/ bool parseXml(LLXmlTreeNode* node); /*virtual*/ void toStream(std::ostream &out); @@ -90,7 +90,7 @@ public: // Special: These functions are overridden by child classes LLDriverParamInfo* getInfo() const { return (LLDriverParamInfo*)mInfo; } // This sets mInfo and calls initialization functions - BOOL setInfo(LLDriverParamInfo* info); + bool setInfo(LLDriverParamInfo* info); LLAvatarAppearance* getAvatarAppearance() { return mAvatarAppearance; } const LLAvatarAppearance* getAvatarAppearance() const { return mAvatarAppearance; } @@ -104,7 +104,7 @@ public: /*virtual*/ void setWeight(F32 weight); /*virtual*/ void setAnimationTarget(F32 target_value); /*virtual*/ void stopAnimating(); - /*virtual*/ BOOL linkDrivenParams(visual_param_mapper mapper, BOOL only_cross_params); + /*virtual*/ bool linkDrivenParams(visual_param_mapper mapper, bool only_cross_params); /*virtual*/ void resetDrivenParams(); // LLViewerVisualParam Virtual functions @@ -130,10 +130,10 @@ protected: LL_ALIGN_16(LLVector4a mDefaultVec); // temp holder entry_list_t mDriven; - LLViewerVisualParam* mCurrentDistortionParam; + LLViewerVisualParam* mCurrentDistortionParam{ nullptr }; // Backlink only; don't make this an LLPointer. - LLAvatarAppearance* mAvatarAppearance; - LLWearable* mWearablep; + LLAvatarAppearance* mAvatarAppearance{ nullptr }; + LLWearable* mWearablep{ nullptr }; }; #endif // LL_LLDRIVERPARAM_H diff --git a/indra/llappearance/lllocaltextureobject.cpp b/indra/llappearance/lllocaltextureobject.cpp index dfc61382ea..f743f7b517 100644 --- a/indra/llappearance/lllocaltextureobject.cpp +++ b/indra/llappearance/lllocaltextureobject.cpp @@ -36,14 +36,14 @@ LLLocalTextureObject::LLLocalTextureObject() : - mIsBakedReady(FALSE), + mIsBakedReady(false), mDiscard(MAX_DISCARD_LEVEL+1) { mImage = NULL; } LLLocalTextureObject::LLLocalTextureObject(LLGLTexture* image, const LLUUID& id) : - mIsBakedReady(FALSE), + mIsBakedReady(false), mDiscard(MAX_DISCARD_LEVEL+1) { mImage = image; @@ -109,7 +109,7 @@ LLTexLayer* LLLocalTextureObject::getTexLayer(const std::string &name) U32 LLLocalTextureObject::getNumTexLayers() const { - return mTexLayers.size(); + return static_cast<U32>(mTexLayers.size()); } LLUUID LLLocalTextureObject::getID() const @@ -122,7 +122,7 @@ S32 LLLocalTextureObject::getDiscard() const return mDiscard; } -BOOL LLLocalTextureObject::getBakedReady() const +bool LLLocalTextureObject::getBakedReady() const { return mIsBakedReady; } @@ -132,11 +132,11 @@ void LLLocalTextureObject::setImage(LLGLTexture* new_image) mImage = new_image; } -BOOL LLLocalTextureObject::setTexLayer(LLTexLayer *new_tex_layer, U32 index) +bool LLLocalTextureObject::setTexLayer(LLTexLayer *new_tex_layer, U32 index) { if (index >= getNumTexLayers() ) { - return FALSE; + return false; } if (new_tex_layer == NULL) @@ -153,47 +153,47 @@ BOOL LLLocalTextureObject::setTexLayer(LLTexLayer *new_tex_layer, U32 index) } mTexLayers[index] = layer; - return TRUE; + return true; } -BOOL LLLocalTextureObject::addTexLayer(LLTexLayer *new_tex_layer, LLWearable *wearable) +bool LLLocalTextureObject::addTexLayer(LLTexLayer *new_tex_layer, LLWearable *wearable) { if (new_tex_layer == NULL) { - return FALSE; + return false; } LLTexLayer *layer = new LLTexLayer(*new_tex_layer, wearable); layer->setLTO(this); mTexLayers.push_back(layer); - return TRUE; + return true; } -BOOL LLLocalTextureObject::addTexLayer(LLTexLayerTemplate *new_tex_layer, LLWearable *wearable) +bool LLLocalTextureObject::addTexLayer(LLTexLayerTemplate *new_tex_layer, LLWearable *wearable) { if (new_tex_layer == NULL) { - return FALSE; + return false; } LLTexLayer *layer = new LLTexLayer(*new_tex_layer, this, wearable); layer->setLTO(this); mTexLayers.push_back(layer); - return TRUE; + return true; } -BOOL LLLocalTextureObject::removeTexLayer(U32 index) +bool LLLocalTextureObject::removeTexLayer(U32 index) { if (index >= getNumTexLayers()) { - return FALSE; + return false; } tex_layer_vec_t::iterator iter = mTexLayers.begin(); iter += index; delete *iter; mTexLayers.erase(iter); - return TRUE; + return true; } void LLLocalTextureObject::setID(LLUUID new_id) @@ -206,7 +206,7 @@ void LLLocalTextureObject::setDiscard(S32 new_discard) mDiscard = new_discard; } -void LLLocalTextureObject::setBakedReady(BOOL ready) +void LLLocalTextureObject::setBakedReady(bool ready) { mIsBakedReady = ready; } diff --git a/indra/llappearance/lllocaltextureobject.h b/indra/llappearance/lllocaltextureobject.h index f981e73789..5505ef205a 100644 --- a/indra/llappearance/lllocaltextureobject.h +++ b/indra/llappearance/lllocaltextureobject.h @@ -53,17 +53,17 @@ public: U32 getNumTexLayers() const; LLUUID getID() const; S32 getDiscard() const; - BOOL getBakedReady() const; + bool getBakedReady() const; void setImage(LLGLTexture* new_image); - BOOL setTexLayer(LLTexLayer *new_tex_layer, U32 index); - BOOL addTexLayer(LLTexLayer *new_tex_layer, LLWearable *wearable); - BOOL addTexLayer(LLTexLayerTemplate *new_tex_layer, LLWearable *wearable); - BOOL removeTexLayer(U32 index); + bool setTexLayer(LLTexLayer *new_tex_layer, U32 index); + bool addTexLayer(LLTexLayer *new_tex_layer, LLWearable *wearable); + bool addTexLayer(LLTexLayerTemplate *new_tex_layer, LLWearable *wearable); + bool removeTexLayer(U32 index); void setID(LLUUID new_id); void setDiscard(S32 new_discard); - void setBakedReady(BOOL ready); + void setBakedReady(bool ready); protected: @@ -78,7 +78,7 @@ private: LLUUID mID; - BOOL mIsBakedReady; + bool mIsBakedReady; S32 mDiscard; }; diff --git a/indra/llappearance/llpolymesh.cpp b/indra/llappearance/llpolymesh.cpp index 819e95ef52..719381b4fc 100644 --- a/indra/llappearance/llpolymesh.cpp +++ b/indra/llappearance/llpolymesh.cpp @@ -72,8 +72,8 @@ LLPolyMeshSharedData::LLPolyMeshSharedData() mTexCoords = NULL; mDetailTexCoords = NULL; mWeights = NULL; - mHasWeights = FALSE; - mHasDetailTexCoords = FALSE; + mHasWeights = false; + mHasDetailTexCoords = false; mNumFaces = 0; mFaces = NULL; @@ -225,7 +225,7 @@ U32 LLPolyMeshSharedData::getNumKB() //----------------------------------------------------------------------------- // LLPolyMeshSharedData::allocateVertexData() //----------------------------------------------------------------------------- -BOOL LLPolyMeshSharedData::allocateVertexData( U32 numVertices ) +bool LLPolyMeshSharedData::allocateVertexData( U32 numVertices ) { U32 i; mBaseCoords = (LLVector4a*) ll_aligned_malloc_16(numVertices*sizeof(LLVector4a)); @@ -243,34 +243,34 @@ BOOL LLPolyMeshSharedData::allocateVertexData( U32 numVertices ) mWeights[i] = 0.f; } mNumVertices = numVertices; - return TRUE; + return true; } //----------------------------------------------------------------------------- // LLPolyMeshSharedData::allocateFaceData() //----------------------------------------------------------------------------- -BOOL LLPolyMeshSharedData::allocateFaceData( U32 numFaces ) +bool LLPolyMeshSharedData::allocateFaceData( U32 numFaces ) { mFaces = new LLPolyFace[ numFaces ]; mNumFaces = numFaces; mNumTriangleIndices = mNumFaces * 3; - return TRUE; + return true; } //----------------------------------------------------------------------------- // LLPolyMeshSharedData::allocateJointNames() //----------------------------------------------------------------------------- -BOOL LLPolyMeshSharedData::allocateJointNames( U32 numJointNames ) +bool LLPolyMeshSharedData::allocateJointNames( U32 numJointNames ) { mJointNames = new std::string[ numJointNames ]; mNumJointNames = numJointNames; - return TRUE; + return true; } //-------------------------------------------------------------------- // LLPolyMeshSharedData::loadMesh() //-------------------------------------------------------------------- -BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) +bool LLPolyMeshSharedData::loadMesh( const std::string& fileName ) { //------------------------------------------------------------------------- // Open the file @@ -278,13 +278,13 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) if(fileName.empty()) { LL_ERRS() << "Filename is Empty!" << LL_ENDL; - return FALSE; + return false; } LLFILE* fp = LLFile::fopen(fileName, "rb"); /*Flawfinder: ignore*/ if (!fp) { LL_ERRS() << "can't open: " << fileName << LL_ENDL; - return FALSE; + return false; } //------------------------------------------------------------------------- @@ -299,7 +299,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) //------------------------------------------------------------------------- // Check for proper binary header //------------------------------------------------------------------------- - BOOL status = FALSE; + bool status = false; if ( strncmp(header, HEADER_BINARY, strlen(HEADER_BINARY)) == 0 ) /*Flawfinder: ignore*/ { LL_DEBUGS() << "Loading " << fileName << LL_ENDL; @@ -317,11 +317,11 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) if (numRead != 1) { LL_ERRS() << "can't read HasWeights flag from " << fileName << LL_ENDL; - return FALSE; + return false; } if (!isLOD()) { - mHasWeights = (hasWeights==0) ? FALSE : TRUE; + mHasWeights = hasWeights > 0; } //---------------------------------------------------------------- @@ -332,7 +332,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) if (numRead != 1) { LL_ERRS() << "can't read HasDetailTexCoords flag from " << fileName << LL_ENDL; - return FALSE; + return false; } //---------------------------------------------------------------- @@ -344,7 +344,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) if (numRead != 3) { LL_ERRS() << "can't read Position from " << fileName << LL_ENDL; - return FALSE; + return false; } setPosition( position ); @@ -357,7 +357,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) if (numRead != 3) { LL_ERRS() << "can't read RotationAngles from " << fileName << LL_ENDL; - return FALSE; + return false; } U8 rotationOrder; @@ -366,7 +366,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) if (numRead != 1) { LL_ERRS() << "can't read RotationOrder from " << fileName << LL_ENDL; - return FALSE; + return false; } rotationOrder = 0; @@ -385,7 +385,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) if (numRead != 3) { LL_ERRS() << "can't read Scale from " << fileName << LL_ENDL; - return FALSE; + return false; } setScale( scale ); @@ -406,7 +406,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) if (numRead != 1) { LL_ERRS() << "can't read NumVertices from " << fileName << LL_ENDL; - return FALSE; + return false; } allocateVertexData( numVertices ); @@ -421,7 +421,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) if (numRead != 3) { LL_ERRS() << "can't read Coordinates from " << fileName << LL_ENDL; - return FALSE; + return false; } } @@ -435,7 +435,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) if (numRead != 3) { LL_ERRS() << " can't read Normals from " << fileName << LL_ENDL; - return FALSE; + return false; } } @@ -449,7 +449,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) if (numRead != 3) { LL_ERRS() << " can't read Binormals from " << fileName << LL_ENDL; - return FALSE; + return false; } } @@ -461,7 +461,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) if (numRead != numVertices) { LL_ERRS() << "can't read TexCoords from " << fileName << LL_ENDL; - return FALSE; + return false; } //---------------------------------------------------------------- @@ -474,7 +474,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) if (numRead != numVertices) { LL_ERRS() << "can't read DetailTexCoords from " << fileName << LL_ENDL; - return FALSE; + return false; } } @@ -488,7 +488,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) if (numRead != numVertices) { LL_ERRS() << "can't read Weights from " << fileName << LL_ENDL; - return FALSE; + return false; } } } @@ -502,7 +502,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) if (numRead != 1) { LL_ERRS() << "can't read NumFaces from " << fileName << LL_ENDL; - return FALSE; + return false; } allocateFaceData( numFaces ); @@ -520,7 +520,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) if (numRead != 3) { LL_ERRS() << "can't read Face[" << i << "] from " << fileName << LL_ENDL; - return FALSE; + return false; } if (mReferenceData) { @@ -577,7 +577,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) if (numRead != 1) { LL_ERRS() << "can't read NumSkinJoints from " << fileName << LL_ENDL; - return FALSE; + return false; } allocateJointNames( numSkinJoints ); } @@ -593,7 +593,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) if (numRead != 1) { LL_ERRS() << "can't read Skin[" << i << "].Name from " << fileName << LL_ENDL; - return FALSE; + return false; } std::string *jn = &mJointNames[i]; @@ -615,7 +615,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) std::string morph_name(morphName); LLPolyMorphData* morph_data = new LLPolyMorphData(morph_name); - BOOL result = morph_data->loadBinary(fp, this); + bool result = morph_data->loadBinary(fp, this); if (!result) { @@ -705,12 +705,12 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) } } - status = TRUE; + status = true; } else { LL_ERRS() << "invalid mesh file header: " << fileName << LL_ENDL; - status = FALSE; + status = false; } if (0 == mNumJointNames) @@ -983,7 +983,7 @@ void LLPolyMesh::initializeForMorph() LLVector4a::memcpyNonAliased16((F32*) mScaledBinormals, (F32*) mSharedData->mBaseNormals, sizeof(LLVector4a) * mSharedData->mNumVertices); memcpy((F32*) mTexCoords, (F32*) mSharedData->mTexCoords, sizeof(LLVector2) * (mSharedData->mNumVertices)); // allocated in LLPolyMeshSharedData::allocateVertexData - for (U32 i = 0; i < mSharedData->mNumVertices; ++i) + for (S32 i = 0; i < mSharedData->mNumVertices; ++i) { mClothingWeights[i].clear(); } diff --git a/indra/llappearance/llpolymesh.h b/indra/llappearance/llpolymesh.h index b8906e378f..5f8b4eab02 100644 --- a/indra/llappearance/llpolymesh.h +++ b/indra/llappearance/llpolymesh.h @@ -79,8 +79,8 @@ private: LLVector2 *mDetailTexCoords; F32 *mWeights; - BOOL mHasWeights; - BOOL mHasDetailTexCoords; + bool mHasWeights; + bool mHasDetailTexCoords; // face data S32 mNumFaces; @@ -119,17 +119,17 @@ private: void setRotation( const LLQuaternion &rot ) { mRotation = rot; } void setScale( const LLVector3 &scale ) { mScale = scale; } - BOOL allocateVertexData( U32 numVertices ); + bool allocateVertexData( U32 numVertices ); - BOOL allocateFaceData( U32 numFaces ); + bool allocateFaceData( U32 numFaces ); - BOOL allocateJointNames( U32 numJointNames ); + bool allocateJointNames( U32 numJointNames ); // Retrieve the number of KB of memory used by this instance U32 getNumKB(); // Load mesh data from file - BOOL loadMesh( const std::string& fileName ); + bool loadMesh( const std::string& fileName ); public: void genIndices(S32 offset); @@ -138,7 +138,7 @@ public: const S32 *getSharedVert(S32 vert); - BOOL isLOD() { return (mReferenceData != NULL); } + bool isLOD() { return (mReferenceData != NULL); } }; @@ -204,13 +204,13 @@ public: } // Returns whether or not the mesh has detail texture coords - BOOL hasDetailTexCoords() { + bool hasDetailTexCoords() { llassert (mSharedData); return mSharedData->mHasDetailTexCoords; } // Returns whether or not the mesh has vertex weights - BOOL hasWeights() const{ + bool hasWeights() const{ llassert (mSharedData); return mSharedData->mHasWeights; } @@ -316,7 +316,7 @@ public: // Get indices U32* getIndices() { return mSharedData ? mSharedData->mTriangleIndices : NULL; } - BOOL isLOD() { return mSharedData && mSharedData->isLOD(); } + bool isLOD() { return mSharedData && mSharedData->isLOD(); } void setAvatar(LLAvatarAppearance* avatarp) { mAvatarp = avatarp; } LLAvatarAppearance* getAvatar() { return mAvatarp; } diff --git a/indra/llappearance/llpolymorph.cpp b/indra/llappearance/llpolymorph.cpp index c780778c7b..7ae760d312 100644 --- a/indra/llappearance/llpolymorph.cpp +++ b/indra/llappearance/llpolymorph.cpp @@ -104,17 +104,17 @@ LLPolyMorphData::~LLPolyMorphData() //----------------------------------------------------------------------------- // loadBinary() //----------------------------------------------------------------------------- -BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh) +bool LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh) { S32 numVertices; - S32 numRead; + size_t numRead; numRead = fread(&numVertices, sizeof(S32), 1, fp); llendianswizzle(&numVertices, sizeof(S32), 1); if (numRead != 1) { LL_WARNS() << "Can't read number of morph target vertices" << LL_ENDL; - return FALSE; + return false; } //------------------------------------------------------------------------- @@ -151,14 +151,14 @@ BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh) if (numRead != 1) { LL_WARNS() << "Can't read morph target vertex number" << LL_ENDL; - return FALSE; + return false; } if (mVertexIndices[v] > 10000) { // Bad install? These are usually .llm files from 'character' fodler LL_WARNS() << "Bad morph index " << v << ": " << mVertexIndices[v] << LL_ENDL; - return FALSE; + return false; } @@ -167,7 +167,7 @@ BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh) if (numRead != 3) { LL_WARNS() << "Can't read morph target vertex coordinates" << LL_ENDL; - return FALSE; + return false; } F32 magnitude = mCoords[v].getLength3().getF32(); @@ -187,7 +187,7 @@ BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh) if (numRead != 3) { LL_WARNS() << "Can't read morph target normal" << LL_ENDL; - return FALSE; + return false; } numRead = fread(&mBinormals[v], sizeof(F32), 3, fp); @@ -195,7 +195,7 @@ BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh) if (numRead != 3) { LL_WARNS() << "Can't read morph target binormal" << LL_ENDL; - return FALSE; + return false; } @@ -204,7 +204,7 @@ BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh) if (numRead != 2) { LL_WARNS() << "Can't read morph target uv" << LL_ENDL; - return FALSE; + return false; } mNumIndices++; @@ -213,7 +213,7 @@ BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh) mAvgDistortion.mul(1.f/(F32)mNumIndices); mAvgDistortion.normalize3fast(); - return TRUE; + return true; } //----------------------------------------------------------------------------- @@ -256,23 +256,23 @@ void LLPolyMorphData::freeData() // LLPolyMorphTargetInfo() //----------------------------------------------------------------------------- LLPolyMorphTargetInfo::LLPolyMorphTargetInfo() - : mIsClothingMorph(FALSE) + : mIsClothingMorph(false) { } -BOOL LLPolyMorphTargetInfo::parseXml(LLXmlTreeNode* node) +bool LLPolyMorphTargetInfo::parseXml(LLXmlTreeNode* node) { llassert( node->hasName( "param" ) && node->getChildByName( "param_morph" ) ); if (!LLViewerVisualParamInfo::parseXml(node)) - return FALSE; + return false; // Get mixed-case name static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); if( !node->getFastAttributeString( name_string, mMorphName ) ) { LL_WARNS() << "Avatar file: <param> is missing name attribute" << LL_ENDL; - return FALSE; // Continue, ignoring this tag + return false; // Continue, ignoring this tag } static LLStdStringHandle clothing_morph_string = LLXmlTree::addAttributeString("clothing_morph"); @@ -284,7 +284,7 @@ BOOL LLPolyMorphTargetInfo::parseXml(LLXmlTreeNode* node) { LL_WARNS() << "Failed to getChildByName(\"param_morph\")" << LL_ENDL; - return FALSE; + return false; } for (LLXmlTreeNode* child_node = paramNode->getFirstChild(); @@ -310,7 +310,7 @@ BOOL LLPolyMorphTargetInfo::parseXml(LLXmlTreeNode* node) } } - return TRUE; + return true; } //----------------------------------------------------------------------------- @@ -353,11 +353,11 @@ LLPolyMorphTarget::~LLPolyMorphTarget() //----------------------------------------------------------------------------- // setInfo() //----------------------------------------------------------------------------- -BOOL LLPolyMorphTarget::setInfo(LLPolyMorphTargetInfo* info) +bool LLPolyMorphTarget::setInfo(LLPolyMorphTargetInfo* info) { llassert(mInfo == NULL); if (info->mID < 0) - return FALSE; + return false; mInfo = info; mID = info->mID; setWeight(getDefaultWeight()); @@ -384,8 +384,8 @@ BOOL LLPolyMorphTarget::setInfo(LLPolyMorphTargetInfo* info) if (!mMorphData) { const std::string driven_tag = "_Driven"; - U32 pos = morph_param_name.find(driven_tag); - if (pos > 0) + auto pos = morph_param_name.find(driven_tag); + if (pos != std::string::npos && pos > 0) { morph_param_name = morph_param_name.substr(0,pos); mMorphData = mMesh->getMorphData(morph_param_name); @@ -394,9 +394,9 @@ BOOL LLPolyMorphTarget::setInfo(LLPolyMorphTargetInfo* info) if (!mMorphData) { LL_WARNS() << "No morph target named " << morph_param_name << " found in mesh." << LL_ENDL; - return FALSE; // Continue, ignoring this tag + return false; // Continue, ignoring this tag } - return TRUE; + return true; } /*virtual*/ LLViewerVisualParam* LLPolyMorphTarget::cloneParam(LLWearable* wearable) const @@ -408,7 +408,7 @@ BOOL LLPolyMorphTarget::setInfo(LLPolyMorphTargetInfo* info) //----------------------------------------------------------------------------- // parseData() //----------------------------------------------------------------------------- -BOOL LLPolyMorphTarget::parseData(LLXmlTreeNode* node) +bool LLPolyMorphTarget::parseData(LLXmlTreeNode* node) { LLPolyMorphTargetInfo* info = new LLPolyMorphTargetInfo; @@ -416,9 +416,9 @@ BOOL LLPolyMorphTarget::parseData(LLXmlTreeNode* node) if (!setInfo(info)) { delete info; - return FALSE; + return false; } - return TRUE; + return true; } #endif @@ -659,7 +659,7 @@ void LLPolyMorphTarget::apply( ESex avatar_sex ) //----------------------------------------------------------------------------- // applyMask() //----------------------------------------------------------------------------- -void LLPolyMorphTarget::applyMask(U8 *maskTextureData, S32 width, S32 height, S32 num_components, BOOL invert) +void LLPolyMorphTarget::applyMask(const U8 *maskTextureData, S32 width, S32 height, S32 num_components, bool invert) { LLVector4a *clothing_weights = getInfo()->mIsClothingMorph ? mMesh->getWritableClothingWeights() : NULL; @@ -749,7 +749,7 @@ void LLPolyMorphTarget::applyVolumeChanges(F32 delta_weight) LLPolyVertexMask::LLPolyVertexMask(LLPolyMorphData* morph_data) : mWeights(new F32[morph_data->mNumIndices]), mMorphData(morph_data), - mWeightsGenerated(FALSE) + mWeightsGenerated(false) { llassert(mMorphData != NULL); llassert(mMorphData->mNumIndices > 0); @@ -780,10 +780,10 @@ LLPolyVertexMask::~LLPolyVertexMask() //----------------------------------------------------------------------------- // generateMask() //----------------------------------------------------------------------------- -void LLPolyVertexMask::generateMask(U8 *maskTextureData, S32 width, S32 height, S32 num_components, BOOL invert, LLVector4a *clothing_weights) +void LLPolyVertexMask::generateMask(const U8 *maskTextureData, S32 width, S32 height, S32 num_components, bool invert, LLVector4a *clothing_weights) { // RN debug output that uses Image Debugger (http://www.cs.unc.edu/~baxter/projects/imdebug/) -// BOOL debugImg = FALSE; +// bool debugImg = false; // if (debugImg) // { // if (invert) @@ -827,7 +827,7 @@ void LLPolyVertexMask::generateMask(U8 *maskTextureData, S32 width, S32 height, clothing_weights[vertIndex].getF32ptr()[VW] = mWeights[index]; } } - mWeightsGenerated = TRUE; + mWeightsGenerated = true; } //----------------------------------------------------------------------------- diff --git a/indra/llappearance/llpolymorph.h b/indra/llappearance/llpolymorph.h index 5235e83097..8c76689f2c 100644 --- a/indra/llappearance/llpolymorph.h +++ b/indra/llappearance/llpolymorph.h @@ -49,7 +49,7 @@ public: ~LLPolyMorphData(); LLPolyMorphData(const LLPolyMorphData &rhs); - BOOL loadBinary(LLFILE* fp, LLPolyMeshSharedData *mesh); + bool loadBinary(LLFILE* fp, LLPolyMeshSharedData *mesh); const std::string& getName() { return mName; } public: @@ -84,14 +84,14 @@ public: LLPolyVertexMask(const LLPolyVertexMask& pOther); ~LLPolyVertexMask(); - void generateMask(U8 *maskData, S32 width, S32 height, S32 num_components, BOOL invert, LLVector4a *clothing_weights); + void generateMask(const U8 *maskData, S32 width, S32 height, S32 num_components, bool invert, LLVector4a *clothing_weights); F32* getMorphMaskWeights(); protected: F32* mWeights; LLPolyMorphData *mMorphData; - BOOL mWeightsGenerated; + bool mWeightsGenerated; }; @@ -129,11 +129,11 @@ public: LLPolyMorphTargetInfo(); /*virtual*/ ~LLPolyMorphTargetInfo() {}; - /*virtual*/ BOOL parseXml(LLXmlTreeNode* node); + /*virtual*/ bool parseXml(LLXmlTreeNode* node); protected: std::string mMorphName; - BOOL mIsClothingMorph; + bool mIsClothingMorph; typedef std::vector<LLPolyVolumeMorphInfo> volume_info_list_t; volume_info_list_t mVolumeInfoList; }; @@ -154,12 +154,12 @@ public: // Special: These functions are overridden by child classes LLPolyMorphTargetInfo* getInfo() const { return (LLPolyMorphTargetInfo*)mInfo; } // This sets mInfo and calls initialization functions - BOOL setInfo(LLPolyMorphTargetInfo *info); + bool setInfo(LLPolyMorphTargetInfo *info); /*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const; // LLVisualParam Virtual functions - ///*virtual*/ BOOL parseData(LLXmlTreeNode* node); + ///*virtual*/ bool parseData(LLXmlTreeNode* node); /*virtual*/ void apply( ESex sex ); // LLViewerVisualParam Virtual functions @@ -170,7 +170,7 @@ public: /*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh); /*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh); - void applyMask(U8 *maskData, S32 width, S32 height, S32 num_components, BOOL invert); + void applyMask(const U8 *maskData, S32 width, S32 height, S32 num_components, bool invert); void addPendingMorphMask() { mNumMorphMasksPending++; } void applyVolumeChanges(F32 delta_weight); // SL-315 - for resetSkeleton() @@ -183,7 +183,7 @@ protected: LLPolyVertexMask * mVertMask; ESex mLastSex; // number of morph masks that haven't been generated, must be 0 before this morph is applied - BOOL mNumMorphMasksPending; + S32 mNumMorphMasksPending; typedef std::vector<LLPolyVolumeMorph> volume_list_t; volume_list_t mVolumeMorphs; diff --git a/indra/llappearance/llpolyskeletaldistortion.cpp b/indra/llappearance/llpolyskeletaldistortion.cpp index 1d2ff6ef4f..18c64282f1 100644 --- a/indra/llappearance/llpolyskeletaldistortion.cpp +++ b/indra/llappearance/llpolyskeletaldistortion.cpp @@ -45,12 +45,12 @@ LLPolySkeletalDistortionInfo::LLPolySkeletalDistortionInfo() { } -BOOL LLPolySkeletalDistortionInfo::parseXml(LLXmlTreeNode* node) +bool LLPolySkeletalDistortionInfo::parseXml(LLXmlTreeNode* node) { llassert( node->hasName( "param" ) && node->getChildByName( "param_skeleton" ) ); if (!LLViewerVisualParamInfo::parseXml(node)) - return FALSE; + return false; LLXmlTreeNode* skeletalParam = node->getChildByName("param_skeleton"); @@ -58,7 +58,7 @@ BOOL LLPolySkeletalDistortionInfo::parseXml(LLXmlTreeNode* node) { LL_WARNS() << "Failed to getChildByName(\"param_skeleton\")" << LL_ENDL; - return FALSE; + return false; } for( LLXmlTreeNode* bone = skeletalParam->getFirstChild(); bone; bone = skeletalParam->getNextChild() ) @@ -68,7 +68,7 @@ BOOL LLPolySkeletalDistortionInfo::parseXml(LLXmlTreeNode* node) std::string name; LLVector3 scale; LLVector3 pos; - BOOL haspos = FALSE; + bool haspos = false; static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); if (!bone->getFastAttributeString(name_string, name)) @@ -88,7 +88,7 @@ BOOL LLPolySkeletalDistortionInfo::parseXml(LLXmlTreeNode* node) static LLStdStringHandle offset_string = LLXmlTree::addAttributeString("offset"); if (bone->getFastAttributeVector3(offset_string, pos)) { - haspos = TRUE; + haspos = true; } mBoneInfoList.push_back(LLPolySkeletalBoneInfo(name, scale, pos, haspos)); } @@ -98,7 +98,7 @@ BOOL LLPolySkeletalDistortionInfo::parseXml(LLXmlTreeNode* node) continue; } } - return TRUE; + return true; } //----------------------------------------------------------------------------- @@ -133,11 +133,11 @@ LLPolySkeletalDistortion::~LLPolySkeletalDistortion() { } -BOOL LLPolySkeletalDistortion::setInfo(LLPolySkeletalDistortionInfo *info) +bool LLPolySkeletalDistortion::setInfo(LLPolySkeletalDistortionInfo *info) { if (info->mID < 0) { - return FALSE; + return false; } mInfo = info; mID = info->mID; @@ -151,7 +151,7 @@ BOOL LLPolySkeletalDistortion::setInfo(LLPolySkeletalDistortionInfo *info) // There's no point continuing after this error - means // that either the skeleton or lad file is broken. LL_WARNS() << "Joint " << bone_info.mBoneName << " not found." << LL_ENDL; - return FALSE; + return false; } // store it @@ -174,7 +174,7 @@ BOOL LLPolySkeletalDistortion::setInfo(LLPolySkeletalDistortionInfo *info) mJointOffsets[joint] = bone_info.mPositionDeformation; } } - return TRUE; + return true; } /*virtual*/ LLViewerVisualParam* LLPolySkeletalDistortion::cloneParam(LLWearable* wearable) const diff --git a/indra/llappearance/llpolyskeletaldistortion.h b/indra/llappearance/llpolyskeletaldistortion.h index 818c363c39..9ba4cf66e9 100644 --- a/indra/llappearance/llpolyskeletaldistortion.h +++ b/indra/llappearance/llpolyskeletaldistortion.h @@ -51,7 +51,7 @@ class LLAvatarAppearance; //----------------------------------------------------------------------------- struct LLPolySkeletalBoneInfo { - LLPolySkeletalBoneInfo(std::string &name, LLVector3 &scale, LLVector3 &pos, BOOL haspos) + LLPolySkeletalBoneInfo(std::string &name, LLVector3 &scale, LLVector3 &pos, bool haspos) : mBoneName(name), mScaleDeformation(scale), mPositionDeformation(pos), @@ -59,7 +59,7 @@ struct LLPolySkeletalBoneInfo std::string mBoneName; LLVector3 mScaleDeformation; LLVector3 mPositionDeformation; - BOOL mHasPositionDeformation; + bool mHasPositionDeformation; }; class alignas(16) LLPolySkeletalDistortionInfo : public LLViewerVisualParamInfo @@ -71,7 +71,7 @@ public: LLPolySkeletalDistortionInfo(); /*virtual*/ ~LLPolySkeletalDistortionInfo() {}; - /*virtual*/ BOOL parseXml(LLXmlTreeNode* node); + /*virtual*/ bool parseXml(LLXmlTreeNode* node); protected: typedef std::vector<LLPolySkeletalBoneInfo> bone_info_list_t; @@ -92,12 +92,12 @@ public: // Special: These functions are overridden by child classes LLPolySkeletalDistortionInfo* getInfo() const { return (LLPolySkeletalDistortionInfo*)mInfo; } // This sets mInfo and calls initialization functions - BOOL setInfo(LLPolySkeletalDistortionInfo *info); + bool setInfo(LLPolySkeletalDistortionInfo *info); /*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const; // LLVisualParam Virtual functions - ///*virtual*/ BOOL parseData(LLXmlTreeNode* node); + ///*virtual*/ bool parseData(LLXmlTreeNode* node); /*virtual*/ void apply( ESex sex ); // LLViewerVisualParam Virtual functions diff --git a/indra/llappearance/lltexglobalcolor.cpp b/indra/llappearance/lltexglobalcolor.cpp index a90e159820..e39a856b78 100644 --- a/indra/llappearance/lltexglobalcolor.cpp +++ b/indra/llappearance/lltexglobalcolor.cpp @@ -48,7 +48,7 @@ LLTexGlobalColor::~LLTexGlobalColor() //std::for_each(mParamColorList.begin(), mParamColorList.end(), DeletePointer()); } -BOOL LLTexGlobalColor::setInfo(LLTexGlobalColorInfo *info) +bool LLTexGlobalColor::setInfo(LLTexGlobalColorInfo *info) { llassert(mInfo == NULL); mInfo = info; @@ -58,15 +58,15 @@ BOOL LLTexGlobalColor::setInfo(LLTexGlobalColorInfo *info) for (LLTexLayerParamColorInfo* color_info : mInfo->mParamColorInfoList) { LLTexParamGlobalColor* param_color = new LLTexParamGlobalColor(this); - if (!param_color->setInfo(color_info, TRUE)) + if (!param_color->setInfo(color_info, true)) { mInfo = NULL; - return FALSE; + return false; } mParamGlobalColorList.push_back(param_color); } - return TRUE; + return true; } LLColor4 LLTexGlobalColor::getColor() const @@ -135,14 +135,14 @@ LLTexGlobalColorInfo::~LLTexGlobalColorInfo() mParamColorInfoList.clear(); } -BOOL LLTexGlobalColorInfo::parseXml(LLXmlTreeNode* node) +bool LLTexGlobalColorInfo::parseXml(LLXmlTreeNode* node) { // name attribute static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); if (!node->getFastAttributeString(name_string, mName)) { LL_WARNS() << "<global_color> element is missing name attribute." << LL_ENDL; - return FALSE; + return false; } // <param> sub-element for (LLXmlTreeNode* child = node->getChildByName("param"); @@ -156,10 +156,10 @@ BOOL LLTexGlobalColorInfo::parseXml(LLXmlTreeNode* node) if (!info->parseXml(child)) { delete info; - return FALSE; + return false; } mParamColorInfoList.push_back(info); } } - return TRUE; + return true; } diff --git a/indra/llappearance/lltexglobalcolor.h b/indra/llappearance/lltexglobalcolor.h index 183eb47a4a..7561ea7df9 100644 --- a/indra/llappearance/lltexglobalcolor.h +++ b/indra/llappearance/lltexglobalcolor.h @@ -42,7 +42,7 @@ public: LLTexGlobalColorInfo* getInfo() const { return mInfo; } // This sets mInfo and calls initialization functions - BOOL setInfo(LLTexGlobalColorInfo *info); + bool setInfo(LLTexGlobalColorInfo *info); LLAvatarAppearance* getAvatarAppearance() const { return mAvatarAppearance; } LLColor4 getColor() const; @@ -62,7 +62,7 @@ public: LLTexGlobalColorInfo(); ~LLTexGlobalColorInfo(); - BOOL parseXml(LLXmlTreeNode* node); + bool parseXml(LLXmlTreeNode* node); private: param_color_info_list_t mParamColorInfoList; diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp index 4fc9ada15e..27656c8302 100644 --- a/indra/llappearance/lltexlayer.cpp +++ b/indra/llappearance/lltexlayer.cpp @@ -59,17 +59,17 @@ public: LLTexLayerInfo(); ~LLTexLayerInfo(); - BOOL parseXml(LLXmlTreeNode* node); - BOOL createVisualParams(LLAvatarAppearance *appearance); - BOOL isUserSettable() { return mLocalTexture != -1; } + bool parseXml(LLXmlTreeNode* node); + bool createVisualParams(LLAvatarAppearance *appearance); + bool isUserSettable() { return mLocalTexture != -1; } S32 getLocalTexture() const { return mLocalTexture; } - BOOL getOnlyAlpha() const { return mUseLocalTextureAlphaOnly; } + bool getOnlyAlpha() const { return mUseLocalTextureAlphaOnly; } std::string getName() const { return mName; } private: std::string mName; - BOOL mWriteAllChannels; // Don't use masking. Just write RGBA into buffer, + bool mWriteAllChannels; // Don't use masking. Just write RGBA into buffer, LLTexLayerInterface::ERenderPass mRenderPass; std::string mGlobalColor; @@ -77,11 +77,11 @@ private: S32 mLocalTexture; std::string mStaticImageFileName; - BOOL mStaticImageIsMask; - BOOL mUseLocalTextureAlphaOnly; // Ignore RGB channels from the input texture. Use alpha as a mask - BOOL mIsVisibilityMask; + bool mStaticImageIsMask; + bool mUseLocalTextureAlphaOnly; // Ignore RGB channels from the input texture. Use alpha as a mask + bool mIsVisibilityMask; - typedef std::vector< std::pair< std::string,BOOL > > morph_name_list_t; + typedef std::vector< std::pair< std::string,bool > > morph_name_list_t; morph_name_list_t mMorphNameList; param_color_info_list_t mParamColorInfoList; param_alpha_info_list_t mParamAlphaInfoList; @@ -130,17 +130,17 @@ void LLTexLayerSetBuffer::preRenderTexLayerSet() } // virtual -void LLTexLayerSetBuffer::postRenderTexLayerSet(BOOL success) +void LLTexLayerSetBuffer::postRenderTexLayerSet(bool success) { popProjection(); } -BOOL LLTexLayerSetBuffer::renderTexLayerSet(LLRenderTarget* bound_target) +bool LLTexLayerSetBuffer::renderTexLayerSet(LLRenderTarget* bound_target) { // Default color mask for tex layer render gGL.setColorMask(true, true); - BOOL success = TRUE; + bool success = true; gAlphaMaskProgram.bind(); gAlphaMaskProgram.setMinimumAlpha(0.004f); @@ -175,7 +175,7 @@ LLTexLayerSetInfo::LLTexLayerSetInfo() : mBodyRegion( "" ), mWidth( 512 ), mHeight( 512 ), - mClearAlpha( TRUE ) + mClearAlpha( true ) { } @@ -185,12 +185,12 @@ LLTexLayerSetInfo::~LLTexLayerSetInfo( ) mLayerInfoList.clear(); } -BOOL LLTexLayerSetInfo::parseXml(LLXmlTreeNode* node) +bool LLTexLayerSetInfo::parseXml(LLXmlTreeNode* node) { llassert( node->hasName( "layer_set" ) ); if( !node->hasName( "layer_set" ) ) { - return FALSE; + return false; } // body_region @@ -198,20 +198,20 @@ BOOL LLTexLayerSetInfo::parseXml(LLXmlTreeNode* node) if( !node->getFastAttributeString( body_region_string, mBodyRegion ) ) { LL_WARNS() << "<layer_set> is missing body_region attribute" << LL_ENDL; - return FALSE; + return false; } // width, height static LLStdStringHandle width_string = LLXmlTree::addAttributeString("width"); if( !node->getFastAttributeS32( width_string, mWidth ) ) { - return FALSE; + return false; } static LLStdStringHandle height_string = LLXmlTree::addAttributeString("height"); if( !node->getFastAttributeS32( height_string, mHeight ) ) { - return FALSE; + return false; } // Optional alpha component to apply after all compositing is complete. @@ -230,11 +230,11 @@ BOOL LLTexLayerSetInfo::parseXml(LLXmlTreeNode* node) if( !info->parseXml( child )) { delete info; - return FALSE; + return false; } mLayerInfoList.push_back( info ); } - return TRUE; + return true; } // creates visual params without generating layersets or layers @@ -252,11 +252,11 @@ void LLTexLayerSetInfo::createVisualParams(LLAvatarAppearance *appearance) // An ordered set of texture layers that get composited into a single texture. //----------------------------------------------------------------------------- -BOOL LLTexLayerSet::sHasCaches = FALSE; +bool LLTexLayerSet::sHasCaches = false; LLTexLayerSet::LLTexLayerSet(LLAvatarAppearance* const appearance) : mAvatarAppearance( appearance ), - mIsVisible( TRUE ), + mIsVisible( true ), mBakedTexIndex(LLAvatarAppearanceDefines::BAKED_HEAD), mInfo( NULL ) { @@ -277,7 +277,7 @@ LLTexLayerSet::~LLTexLayerSet() // setInfo //----------------------------------------------------------------------------- -BOOL LLTexLayerSet::setInfo(const LLTexLayerSetInfo *info) +bool LLTexLayerSet::setInfo(const LLTexLayerSetInfo *info) { llassert(mInfo == NULL); mInfo = info; @@ -299,7 +299,7 @@ BOOL LLTexLayerSet::setInfo(const LLTexLayerSetInfo *info) if (!layer->setInfo(layer_info, NULL)) { mInfo = NULL; - return FALSE; + return false; } if (!layer->isVisibilityMask()) { @@ -315,7 +315,7 @@ BOOL LLTexLayerSet::setInfo(const LLTexLayerSetInfo *info) stop_glerror(); - return TRUE; + return true; } #if 0 // obsolete @@ -323,21 +323,21 @@ BOOL LLTexLayerSet::setInfo(const LLTexLayerSetInfo *info) // parseData //----------------------------------------------------------------------------- -BOOL LLTexLayerSet::parseData(LLXmlTreeNode* node) +bool LLTexLayerSet::parseData(LLXmlTreeNode* node) { LLTexLayerSetInfo *info = new LLTexLayerSetInfo; if (!info->parseXml(node)) { delete info; - return FALSE; + return false; } if (!setInfo(info)) { delete info; - return FALSE; + return false; } - return TRUE; + return true; } #endif @@ -354,10 +354,10 @@ void LLTexLayerSet::deleteCaches() } -BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bound_target ) +bool LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bound_target ) { - BOOL success = TRUE; - mIsVisible = TRUE; + bool success = true; + mIsVisible = true; if (mMaskLayerList.size() > 0) { @@ -365,7 +365,7 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height, LLRenderTarget* { if (layer->isInvisibleAlphaMask()) { - mIsVisible = FALSE; + mIsVisible = false; } } } @@ -425,7 +425,7 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height, LLRenderTarget* } -BOOL LLTexLayerSet::isBodyRegion(const std::string& region) const +bool LLTexLayerSet::isBodyRegion(const std::string& region) const { return mInfo->mBodyRegion == region; } @@ -484,7 +484,7 @@ void LLTexLayerSet::renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height, { gGL.flush(); { - LLGLTexture* tex = LLTexLayerStaticImageList::getInstance()->getTexture(info->mStaticAlphaFileName, TRUE); + LLGLTexture* tex = LLTexLayerStaticImageList::getInstance()->getTexture(info->mStaticAlphaFileName, true); if( tex ) { LLGLSUIDefault gls_ui; @@ -528,21 +528,21 @@ void LLTexLayerSet::renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height, gGL.setSceneBlendType(LLRender::BT_ALPHA); } -void LLTexLayerSet::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components) +void LLTexLayerSet::applyMorphMask(const U8* tex_data, S32 width, S32 height, S32 num_components) { mAvatarAppearance->applyMorphMask(tex_data, width, height, num_components, mBakedTexIndex); } -BOOL LLTexLayerSet::isMorphValid() const +bool LLTexLayerSet::isMorphValid() const { for(const LLTexLayerInterface* layer : mLayerList) { if (layer && !layer->isMorphValid()) { - return FALSE; + return false; } } - return TRUE; + return true; } void LLTexLayerSet::invalidateMorphMasks() @@ -561,13 +561,13 @@ void LLTexLayerSet::invalidateMorphMasks() // LLTexLayerInfo //----------------------------------------------------------------------------- LLTexLayerInfo::LLTexLayerInfo() : - mWriteAllChannels( FALSE ), + mWriteAllChannels( false ), mRenderPass(LLTexLayer::RP_COLOR), mFixedColor( 0.f, 0.f, 0.f, 0.f ), mLocalTexture( -1 ), - mStaticImageIsMask( FALSE ), - mUseLocalTextureAlphaOnly(FALSE), - mIsVisibilityMask(FALSE) + mStaticImageIsMask( false ), + mUseLocalTextureAlphaOnly(false), + mIsVisibilityMask(false) { } @@ -579,7 +579,7 @@ LLTexLayerInfo::~LLTexLayerInfo( ) mParamAlphaInfoList.clear(); } -BOOL LLTexLayerInfo::parseXml(LLXmlTreeNode* node) +bool LLTexLayerInfo::parseXml(LLXmlTreeNode* node) { llassert( node->hasName( "layer" ) ); @@ -587,7 +587,7 @@ BOOL LLTexLayerInfo::parseXml(LLXmlTreeNode* node) static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); if( !node->getFastAttributeString( name_string, mName ) ) { - return FALSE; + return false; } static LLStdStringHandle write_all_channels_string = LLXmlTree::addAttributeString("write_all_channels"); @@ -609,7 +609,7 @@ BOOL LLTexLayerInfo::parseXml(LLXmlTreeNode* node) node->getFastAttributeString( global_color_string, mGlobalColor ); // Visibility mask (optional) - BOOL is_visibility; + bool is_visibility; static LLStdStringHandle visibility_mask_string = LLXmlTree::addAttributeString("visibility_mask"); if (node->getFastAttributeBOOL(visibility_mask_string, is_visibility)) { @@ -657,13 +657,13 @@ BOOL LLTexLayerInfo::parseXml(LLXmlTreeNode* node) if (mLocalTexture == TEX_NUM_INDICES) { LL_WARNS() << "<texture> element has invalid local_texture attribute: " << mName << " " << local_texture_name << LL_ENDL; - return FALSE; + return false; } } else { LL_WARNS() << "<texture> element is missing a required attribute. " << mName << LL_ENDL; - return FALSE; + return false; } } @@ -675,10 +675,10 @@ BOOL LLTexLayerInfo::parseXml(LLXmlTreeNode* node) static LLStdStringHandle morph_name_string = LLXmlTree::addAttributeString("morph_name"); if (maskNode->getFastAttributeString(morph_name_string, morph_name)) { - BOOL invert = FALSE; + bool invert = false; static LLStdStringHandle invert_string = LLXmlTree::addAttributeString("invert"); maskNode->getFastAttributeBOOL(invert_string, invert); - mMorphNameList.push_back(std::pair<std::string,BOOL>(morph_name,invert)); + mMorphNameList.push_back(std::pair<std::string,bool>(morph_name,invert)); } } @@ -694,7 +694,7 @@ BOOL LLTexLayerInfo::parseXml(LLXmlTreeNode* node) if (!info->parseXml(child)) { delete info; - return FALSE; + return false; } mParamColorInfoList.push_back(info); } @@ -705,37 +705,37 @@ BOOL LLTexLayerInfo::parseXml(LLXmlTreeNode* node) if (!info->parseXml(child)) { delete info; - return FALSE; + return false; } mParamAlphaInfoList.push_back(info); } } - return TRUE; + return true; } -BOOL LLTexLayerInfo::createVisualParams(LLAvatarAppearance *appearance) +bool LLTexLayerInfo::createVisualParams(LLAvatarAppearance *appearance) { - BOOL success = TRUE; + bool success = true; for (LLTexLayerParamColorInfo* color_info : mParamColorInfoList) { LLTexLayerParamColor* param_color = new LLTexLayerParamColor(appearance); - if (!param_color->setInfo(color_info, TRUE)) + if (!param_color->setInfo(color_info, true)) { LL_WARNS() << "NULL TexLayer Color Param could not be added to visual param list. Deleting." << LL_ENDL; delete param_color; - success = FALSE; + success = false; } } for (LLTexLayerParamAlphaInfo* alpha_info : mParamAlphaInfoList) { LLTexLayerParamAlpha* param_alpha = new LLTexLayerParamAlpha(appearance); - if (!param_alpha->setInfo(alpha_info, TRUE)) + if (!param_alpha->setInfo(alpha_info, true)) { LL_WARNS() << "NULL TexLayer Alpha Param could not be added to visual param list. Deleting." << LL_ENDL; delete param_alpha; - success = FALSE; + success = false; } } @@ -744,9 +744,9 @@ BOOL LLTexLayerInfo::createVisualParams(LLAvatarAppearance *appearance) LLTexLayerInterface::LLTexLayerInterface(LLTexLayerSet* const layer_set): mTexLayerSet( layer_set ), - mMorphMasksValid( FALSE ), + mMorphMasksValid( false ), mInfo(NULL), - mHasMorph(FALSE) + mHasMorph(false) { } @@ -760,7 +760,7 @@ LLTexLayerInterface::LLTexLayerInterface(const LLTexLayerInterface &layer, LLWea mHasMorph = layer.mHasMorph; } -BOOL LLTexLayerInterface::setInfo(const LLTexLayerInfo *info, LLWearable* wearable ) // This sets mInfo and calls initialization functions +bool LLTexLayerInterface::setInfo(const LLTexLayerInfo *info, LLWearable* wearable ) // This sets mInfo and calls initialization functions { // setInfo should only be called once. Code is not robust enough to handle redefinition of a texlayer. // Not a critical warning, but could be useful for debugging later issues. -Nyx @@ -778,10 +778,10 @@ BOOL LLTexLayerInterface::setInfo(const LLTexLayerInfo *info, LLWearable* wearab if (!wearable) { param_color = new LLTexLayerParamColor(this); - if (!param_color->setInfo(color_info, TRUE)) + if (!param_color->setInfo(color_info, true)) { mInfo = NULL; - return FALSE; + return false; } } else @@ -790,7 +790,7 @@ BOOL LLTexLayerInterface::setInfo(const LLTexLayerInfo *info, LLWearable* wearab if (!param_color) { mInfo = NULL; - return FALSE; + return false; } } mParamColorList.push_back( param_color ); @@ -803,10 +803,10 @@ BOOL LLTexLayerInterface::setInfo(const LLTexLayerInfo *info, LLWearable* wearab if (!wearable) { param_alpha = new LLTexLayerParamAlpha( this ); - if (!param_alpha->setInfo(alpha_info, TRUE)) + if (!param_alpha->setInfo(alpha_info, true)) { mInfo = NULL; - return FALSE; + return false; } } else @@ -815,13 +815,13 @@ BOOL LLTexLayerInterface::setInfo(const LLTexLayerInfo *info, LLWearable* wearab if (!param_alpha) { mInfo = NULL; - return FALSE; + return false; } } mParamAlphaList.push_back( param_alpha ); } - return TRUE; + return true; } /*virtual*/ void LLTexLayerInterface::requestUpdate() @@ -893,14 +893,14 @@ const std::string& LLTexLayerInterface::getGlobalColor() const return mInfo->mGlobalColor; } -BOOL LLTexLayerInterface::isVisibilityMask() const +bool LLTexLayerInterface::isVisibilityMask() const { return mInfo->mIsVisibilityMask; } void LLTexLayerInterface::invalidateMorphMasks() { - mMorphMasksValid = FALSE; + mMorphMasksValid = false; } LLViewerVisualParam* LLTexLayerInterface::getVisualParamPtr(S32 index) const @@ -980,7 +980,7 @@ void LLTexLayer::asLLSD(LLSD& sd) const // setInfo //----------------------------------------------------------------------------- -BOOL LLTexLayer::setInfo(const LLTexLayerInfo* info, LLWearable* wearable ) +bool LLTexLayer::setInfo(const LLTexLayerInfo* info, LLWearable* wearable ) { return LLTexLayerInterface::setInfo(info, wearable); } @@ -1020,14 +1020,14 @@ void LLTexLayer::calculateTexLayerColor(const param_color_list_t ¶m_list, LL } } -BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bound_target) +bool LLTexLayer::render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bound_target) { // *TODO: Is this correct? //gPipeline.disableLights(); stop_glerror(); LLColor4 net_color; - BOOL color_specified = findNetColor(&net_color); + bool color_specified = findNetColor(&net_color); if (mTexLayerSet->getAvatarAppearance()->mIsDummy) { @@ -1035,15 +1035,15 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bou net_color = LLAvatarAppearance::getDummyColor(); } - BOOL success = TRUE; + bool success = true; // If you can't see the layer, don't render it. - if( is_approx_zero( net_color.mV[VW] ) ) + if( is_approx_zero( net_color.mV[VALPHA] ) ) { return success; } - BOOL alpha_mask_specified = FALSE; + bool alpha_mask_specified = false; param_alpha_list_t::const_iterator iter = mParamAlphaList.begin(); if( iter != mParamAlphaList.end() ) { @@ -1051,7 +1051,7 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bou // However, we can't do this optimization if we have morph masks that need updating. /* if (!mHasMorph) { - BOOL skip_layer = TRUE; + bool skip_layer = true; while( iter != mParamAlphaList.end() ) { @@ -1059,7 +1059,7 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bou if( !param->getSkip() ) { - skip_layer = FALSE; + skip_layer = false; break; } @@ -1074,7 +1074,7 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bou const bool force_render = true; renderMorphMasks(x, y, width, height, net_color, bound_target, force_render); - alpha_mask_specified = TRUE; + alpha_mask_specified = true; gGL.flush(); gGL.blendFunc(LLRender::BF_DEST_ALPHA, LLRender::BF_ONE_MINUS_DEST_ALPHA); } @@ -1115,7 +1115,7 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bou LLTexUnit::eTextureAddressMode old_mode = tex->getAddressMode(); - gGL.getTexUnit(0)->bind(tex, TRUE); + gGL.getTexUnit(0)->bind(tex, true); gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); gl_rect_2d_simple_tex( width, height ); @@ -1130,7 +1130,7 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bou } // else // { -// success = FALSE; +// success = false; // } } } @@ -1141,13 +1141,13 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bou LLGLTexture* tex = LLTexLayerStaticImageList::getInstance()->getTexture(getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask); if( tex ) { - gGL.getTexUnit(0)->bind(tex, TRUE); + gGL.getTexUnit(0)->bind(tex, true); gl_rect_2d_simple_tex( width, height ); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } else { - success = FALSE; + success = false; } } } @@ -1199,7 +1199,7 @@ const U8* LLTexLayer::getAlphaData() const return (iter2 == mAlphaCache.end()) ? 0 : iter2->second; } -BOOL LLTexLayer::findNetColor(LLColor4* net_color) const +bool LLTexLayer::findNetColor(LLColor4* net_color) const { // Color is either: // * one or more color parameters (weighted colors) (which may make use of a global color or fixed color) @@ -1213,7 +1213,7 @@ BOOL LLTexLayer::findNetColor(LLColor4* net_color) const { net_color->setVec( mTexLayerSet->getAvatarAppearance()->getGlobalColor( getInfo()->mGlobalColor ) ); } - else if (getInfo()->mFixedColor.mV[VW]) + else if (getInfo()->mFixedColor.mV[VALPHA]) { net_color->setVec( getInfo()->mFixedColor ); } @@ -1223,29 +1223,29 @@ BOOL LLTexLayer::findNetColor(LLColor4* net_color) const } calculateTexLayerColor(mParamColorList, *net_color); - return TRUE; + return true; } if( !getGlobalColor().empty() ) { net_color->setVec( mTexLayerSet->getAvatarAppearance()->getGlobalColor( getGlobalColor() ) ); - return TRUE; + return true; } - if( getInfo()->mFixedColor.mV[VW] ) + if( getInfo()->mFixedColor.mV[VALPHA] ) { net_color->setVec( getInfo()->mFixedColor ); - return TRUE; + return true; } net_color->setToWhite(); - return FALSE; // No need to draw a separate colored polygon + return false; // No need to draw a separate colored polygon } -BOOL LLTexLayer::blendAlphaTexture(S32 x, S32 y, S32 width, S32 height) +bool LLTexLayer::blendAlphaTexture(S32 x, S32 y, S32 width, S32 height) { - BOOL success = TRUE; + bool success = true; gGL.flush(); @@ -1255,14 +1255,14 @@ BOOL LLTexLayer::blendAlphaTexture(S32 x, S32 y, S32 width, S32 height) if( tex ) { gAlphaMaskProgram.setMinimumAlpha(0.f); - gGL.getTexUnit(0)->bind(tex, TRUE); + gGL.getTexUnit(0)->bind(tex, true); gl_rect_2d_simple_tex( width, height ); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gAlphaMaskProgram.setMinimumAlpha(0.004f); } else { - success = FALSE; + success = false; } } else @@ -1297,7 +1297,7 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC return; } LL_PROFILE_ZONE_SCOPED; - BOOL success = TRUE; + bool success = true; llassert( !mParamAlphaList.empty() ); @@ -1342,7 +1342,7 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC { LLTexUnit::eTextureAddressMode old_mode = tex->getAddressMode(); - gGL.getTexUnit(0)->bind(tex, TRUE); + gGL.getTexUnit(0)->bind(tex, true); gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); gl_rect_2d_simple_tex( width, height ); @@ -1359,7 +1359,7 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC { if( (tex->getComponents() == 4) || (tex->getComponents() == 1) ) { - gGL.getTexUnit(0)->bind(tex, TRUE); + gGL.getTexUnit(0)->bind(tex, true); gl_rect_2d_simple_tex( width, height ); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } @@ -1373,7 +1373,7 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC // Draw a rectangle with the layer color to multiply the alpha by that color's alpha. // Note: we're still using gGL.blendFunc( GL_DST_ALPHA, GL_ZERO ); - if ( !is_approx_equal(layer_color.mV[VW], 1.f) ) + if ( !is_approx_equal(layer_color.mV[VALPHA], 1.f) ) { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.color4fv(layer_color.mV); @@ -1482,7 +1482,7 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC getTexLayerSet()->getAvatarAppearance()->dirtyMesh(); - mMorphMasksValid = TRUE; + mMorphMasksValid = true; getTexLayerSet()->applyMorphMask(alpha_data, width, height, 1); } } @@ -1515,17 +1515,17 @@ void LLTexLayer::addAlphaMask(U8 *data, S32 originX, S32 originY, S32 width, S32 } } -/*virtual*/ BOOL LLTexLayer::isInvisibleAlphaMask() const +/*virtual*/ bool LLTexLayer::isInvisibleAlphaMask() const { if (mLocalTextureObject) { if (mLocalTextureObject->getID() == IMG_INVISIBLE) { - return TRUE; + return true; } } - return FALSE; + return false; } LLUUID LLTexLayer::getUUID() const @@ -1584,7 +1584,7 @@ LLTexLayerTemplate::~LLTexLayerTemplate() // setInfo //----------------------------------------------------------------------------- -/*virtual*/ BOOL LLTexLayerTemplate::setInfo(const LLTexLayerInfo* info, LLWearable* wearable ) +/*virtual*/ bool LLTexLayerTemplate::setInfo(const LLTexLayerInfo* info, LLWearable* wearable ) { return LLTexLayerInterface::setInfo(info, wearable); } @@ -1633,14 +1633,14 @@ LLTexLayer* LLTexLayerTemplate::getLayer(U32 i) const return layer; } -/*virtual*/ BOOL LLTexLayerTemplate::render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bound_target) +/*virtual*/ bool LLTexLayerTemplate::render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bound_target) { if(!mInfo) { - return FALSE ; + return false ; } - BOOL success = TRUE; + bool success = true; updateWearableCache(); for (LLWearable* wearable : mWearableCache) { @@ -1665,9 +1665,9 @@ LLTexLayer* LLTexLayerTemplate::getLayer(U32 i) const return success; } -/*virtual*/ BOOL LLTexLayerTemplate::blendAlphaTexture( S32 x, S32 y, S32 width, S32 height) // Multiplies a single alpha texture against the frame buffer +/*virtual*/ bool LLTexLayerTemplate::blendAlphaTexture( S32 x, S32 y, S32 width, S32 height) // Multiplies a single alpha texture against the frame buffer { - BOOL success = TRUE; + bool success = true; U32 num_wearables = updateWearableCache(); for (U32 i = 0; i < num_wearables; i++) { @@ -1691,7 +1691,7 @@ LLTexLayer* LLTexLayerTemplate::getLayer(U32 i) const } } -/*virtual*/ void LLTexLayerTemplate::setHasMorph(BOOL newval) +/*virtual*/ void LLTexLayerTemplate::setHasMorph(bool newval) { mHasMorph = newval; U32 num_wearables = updateWearableCache(); @@ -1718,7 +1718,7 @@ LLTexLayer* LLTexLayerTemplate::getLayer(U32 i) const } } -/*virtual*/ BOOL LLTexLayerTemplate::isInvisibleAlphaMask() const +/*virtual*/ bool LLTexLayerTemplate::isInvisibleAlphaMask() const { U32 num_wearables = updateWearableCache(); for (U32 i = 0; i < num_wearables; i++) @@ -1728,12 +1728,12 @@ LLTexLayer* LLTexLayerTemplate::getLayer(U32 i) const { if (layer->isInvisibleAlphaMask()) { - return TRUE; + return true; } } } - return FALSE; + return false; } @@ -1855,7 +1855,7 @@ LLImageTGA* LLTexLayerStaticImageList::getImageTGA(const std::string& file_name) // Returns a GL Image (without a backing ImageRaw) that contains the decoded data from a tga file named file_name. // Caches the result to speed identical subsequent requests. -LLGLTexture* LLTexLayerStaticImageList::getTexture(const std::string& file_name, BOOL is_mask) +LLGLTexture* LLTexLayerStaticImageList::getTexture(const std::string& file_name, bool is_mask) { LL_PROFILE_ZONE_SCOPED; LLPointer<LLGLTexture> tex; @@ -1869,7 +1869,7 @@ LLGLTexture* LLTexLayerStaticImageList::getTexture(const std::string& file_name, else { llassert(gTextureManagerBridgep); - tex = gTextureManagerBridgep->getLocalTexture( FALSE ); + tex = gTextureManagerBridgep->getLocalTexture( false ); LLPointer<LLImageRaw> image_raw = new LLImageRaw; if( loadImageRaw( file_name, image_raw ) ) { @@ -1885,7 +1885,7 @@ LLGLTexture* LLTexLayerStaticImageList::getTexture(const std::string& file_name, image_raw->copyUnscaledAlphaMask(alpha_image_raw, LLColor4U::black); } - tex->createGLTexture(0, image_raw, 0, TRUE, LLGLTexture::LOCAL); + tex->createGLTexture(0, image_raw, 0, true, LLGLTexture::LOCAL); gGL.getTexUnit(0)->bind(tex); tex->setAddressMode(LLTexUnit::TAM_CLAMP); @@ -1903,11 +1903,11 @@ LLGLTexture* LLTexLayerStaticImageList::getTexture(const std::string& file_name, } // Reads a .tga file, decodes it, and puts the decoded data in image_raw. -// Returns TRUE if successful. -BOOL LLTexLayerStaticImageList::loadImageRaw(const std::string& file_name, LLImageRaw* image_raw) +// Returns true if successful. +bool LLTexLayerStaticImageList::loadImageRaw(const std::string& file_name, LLImageRaw* image_raw) { LL_PROFILE_ZONE_SCOPED; - BOOL success = FALSE; + bool success = false; std::string path; path = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,file_name); LLPointer<LLImageTGA> image_tga = new LLImageTGA( path ); diff --git a/indra/llappearance/lltexlayer.h b/indra/llappearance/lltexlayer.h index 2b9913f883..876ea6f600 100644 --- a/indra/llappearance/lltexlayer.h +++ b/indra/llappearance/lltexlayer.h @@ -65,13 +65,13 @@ public: LLTexLayerInterface(const LLTexLayerInterface &layer, LLWearable *wearable); virtual ~LLTexLayerInterface() {} - virtual BOOL render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bound_target) = 0; + virtual bool render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bound_target) = 0; virtual void deleteCaches() = 0; - virtual BOOL blendAlphaTexture(S32 x, S32 y, S32 width, S32 height) = 0; - virtual BOOL isInvisibleAlphaMask() const = 0; + virtual bool blendAlphaTexture(S32 x, S32 y, S32 width, S32 height) = 0; + virtual bool isInvisibleAlphaMask() const = 0; const LLTexLayerInfo* getInfo() const { return mInfo; } - virtual BOOL setInfo(const LLTexLayerInfo *info, LLWearable* wearable); // sets mInfo, calls initialization functions + virtual bool setInfo(const LLTexLayerInfo *info, LLWearable* wearable); // sets mInfo, calls initialization functions LLWearableType::EType getWearableType() const; LLAvatarAppearanceDefines::ETextureIndex getLocalTextureIndex() const; @@ -80,16 +80,16 @@ public: LLTexLayerSet* const getTexLayerSet() { return mTexLayerSet; } void invalidateMorphMasks(); - virtual void setHasMorph(BOOL newval) { mHasMorph = newval; } - BOOL hasMorph() const { return mHasMorph; } - BOOL isMorphValid() const { return mMorphMasksValid; } + virtual void setHasMorph(bool newval) { mHasMorph = newval; } + bool hasMorph() const { return mHasMorph; } + bool isMorphValid() const { return mMorphMasksValid; } void requestUpdate(); virtual void gatherAlphaMasks(U8 *data, S32 originX, S32 originY, S32 width, S32 height, LLRenderTarget* bound_target) = 0; - BOOL hasAlphaParams() const { return !mParamAlphaList.empty(); } + bool hasAlphaParams() const { return !mParamAlphaList.empty(); } ERenderPass getRenderPass() const; - BOOL isVisibilityMask() const; + bool isVisibilityMask() const; virtual void asLLSD(LLSD& sd) const {} @@ -100,8 +100,8 @@ protected: protected: LLTexLayerSet* const mTexLayerSet; const LLTexLayerInfo* mInfo; - BOOL mMorphMasksValid; - BOOL mHasMorph; + bool mMorphMasksValid; + bool mHasMorph; // Layers can have either mParamColorList, mGlobalColor, or mFixedColor. They are looked for in that order. param_color_list_t mParamColorList; @@ -121,13 +121,13 @@ public: LLTexLayerTemplate(LLTexLayerSet* const layer_set, LLAvatarAppearance* const appearance); LLTexLayerTemplate(const LLTexLayerTemplate &layer); /*virtual*/ ~LLTexLayerTemplate(); - /*virtual*/ BOOL render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bound_target); - /*virtual*/ BOOL setInfo(const LLTexLayerInfo *info, LLWearable* wearable); // This sets mInfo and calls initialization functions - /*virtual*/ BOOL blendAlphaTexture(S32 x, S32 y, S32 width, S32 height); // Multiplies a single alpha texture against the frame buffer + /*virtual*/ bool render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bound_target); + /*virtual*/ bool setInfo(const LLTexLayerInfo *info, LLWearable* wearable); // This sets mInfo and calls initialization functions + /*virtual*/ bool blendAlphaTexture(S32 x, S32 y, S32 width, S32 height); // Multiplies a single alpha texture against the frame buffer /*virtual*/ void gatherAlphaMasks(U8 *data, S32 originX, S32 originY, S32 width, S32 height, LLRenderTarget* bound_target); - /*virtual*/ void setHasMorph(BOOL newval); + /*virtual*/ void setHasMorph(bool newval); /*virtual*/ void deleteCaches(); - /*virtual*/ BOOL isInvisibleAlphaMask() const; + /*virtual*/ bool isInvisibleAlphaMask() const; protected: U32 updateWearableCache() const; LLTexLayer* getLayer(U32 i) const; @@ -151,18 +151,18 @@ public: LLTexLayer(const LLTexLayerTemplate &layer_template, LLLocalTextureObject *lto, LLWearable *wearable); /*virtual*/ ~LLTexLayer(); - /*virtual*/ BOOL setInfo(const LLTexLayerInfo *info, LLWearable* wearable); // This sets mInfo and calls initialization functions - /*virtual*/ BOOL render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bound_target); + /*virtual*/ bool setInfo(const LLTexLayerInfo *info, LLWearable* wearable); // This sets mInfo and calls initialization functions + /*virtual*/ bool render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bound_target); /*virtual*/ void deleteCaches(); const U8* getAlphaData() const; - BOOL findNetColor(LLColor4* color) const; - /*virtual*/ BOOL blendAlphaTexture(S32 x, S32 y, S32 width, S32 height); // Multiplies a single alpha texture against the frame buffer + bool findNetColor(LLColor4* color) const; + /*virtual*/ bool blendAlphaTexture(S32 x, S32 y, S32 width, S32 height); // Multiplies a single alpha texture against the frame buffer /*virtual*/ void gatherAlphaMasks(U8 *data, S32 originX, S32 originY, S32 width, S32 height, LLRenderTarget* bound_target); void renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLColor4 &layer_color, LLRenderTarget* bound_target, bool force_render); void addAlphaMask(U8 *data, S32 originX, S32 originY, S32 width, S32 height, LLRenderTarget* bound_target); - /*virtual*/ BOOL isInvisibleAlphaMask() const; + /*virtual*/ bool isInvisibleAlphaMask() const; void setLTO(LLLocalTextureObject *lto) { mLocalTextureObject = lto; } LLLocalTextureObject* getLTO() { return mLocalTextureObject; } @@ -197,14 +197,14 @@ public: void gatherMorphMaskAlpha(U8 *data, S32 origin_x, S32 origin_y, S32 width, S32 height, LLRenderTarget* bound_target); const LLTexLayerSetInfo* getInfo() const { return mInfo; } - BOOL setInfo(const LLTexLayerSetInfo *info); // This sets mInfo and calls initialization functions + bool setInfo(const LLTexLayerSetInfo *info); // This sets mInfo and calls initialization functions - BOOL render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bound_target = nullptr); + bool render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bound_target = nullptr); void renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bound_target = nullptr, bool forceClear = false); - BOOL isBodyRegion(const std::string& region) const; - void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components); - BOOL isMorphValid() const; + bool isBodyRegion(const std::string& region) const; + void applyMorphMask(const U8* tex_data, S32 width, S32 height, S32 num_components); + bool isMorphValid() const; virtual void requestUpdate() = 0; void invalidateMorphMasks(); void deleteCaches(); @@ -213,12 +213,12 @@ public: LLAvatarAppearance* getAvatarAppearance() const { return mAvatarAppearance; } const std::string getBodyRegionName() const; - BOOL hasComposite() const { return (mComposite.notNull()); } + bool hasComposite() const { return (mComposite.notNull()); } LLAvatarAppearanceDefines::EBakedTextureIndex getBakedTexIndex() const { return mBakedTexIndex; } void setBakedTexIndex(LLAvatarAppearanceDefines::EBakedTextureIndex index) { mBakedTexIndex = index; } - BOOL isVisible() const { return mIsVisible; } + bool isVisible() const { return mIsVisible; } - static BOOL sHasCaches; + static bool sHasCaches; protected: typedef std::vector<LLTexLayerInterface *> layer_list_t; @@ -226,7 +226,7 @@ protected: layer_list_t mMaskLayerList; LLPointer<LLTexLayerSetBuffer> mComposite; LLAvatarAppearance* const mAvatarAppearance; // note: backlink only; don't make this an LLPointer. - BOOL mIsVisible; + bool mIsVisible; LLAvatarAppearanceDefines::EBakedTextureIndex mBakedTexIndex; const LLTexLayerSetInfo* mInfo; @@ -243,7 +243,7 @@ class LLTexLayerSetInfo public: LLTexLayerSetInfo(); ~LLTexLayerSetInfo(); - BOOL parseXml(LLXmlTreeNode* node); + bool parseXml(LLXmlTreeNode* node); void createVisualParams(LLAvatarAppearance *appearance); S32 getWidth() const { return mWidth; } S32 getHeight() const { return mHeight; } @@ -252,7 +252,7 @@ protected: S32 mWidth; S32 mHeight; std::string mStaticAlphaFileName; - BOOL mClearAlpha; // Set alpha to 1 for this layerset (if there is no mStaticAlphaFileName) + bool mClearAlpha; // Set alpha to 1 for this layerset (if there is no mStaticAlphaFileName) typedef std::vector<LLTexLayerInfo*> layer_info_list_t; layer_info_list_t mLayerInfoList; }; @@ -274,13 +274,13 @@ protected: void pushProjection() const; void popProjection() const; virtual void preRenderTexLayerSet(); - virtual void midRenderTexLayerSet(BOOL success) {} - virtual void postRenderTexLayerSet(BOOL success); + virtual void midRenderTexLayerSet(bool success) {} + virtual void postRenderTexLayerSet(bool success); virtual S32 getCompositeOriginX() const = 0; virtual S32 getCompositeOriginY() const = 0; virtual S32 getCompositeWidth() const = 0; virtual S32 getCompositeHeight() const = 0; - BOOL renderTexLayerSet(LLRenderTarget* bound_target); + bool renderTexLayerSet(LLRenderTarget* bound_target); LLTexLayerSet* const mTexLayerSet; }; @@ -294,12 +294,12 @@ class LLTexLayerStaticImageList : public LLSingleton<LLTexLayerStaticImageList> LLSINGLETON(LLTexLayerStaticImageList); ~LLTexLayerStaticImageList(); public: - LLGLTexture* getTexture(const std::string& file_name, BOOL is_mask); + LLGLTexture* getTexture(const std::string& file_name, bool is_mask); LLImageTGA* getImageTGA(const std::string& file_name); void deleteCachedImages(); void dumpByteCount() const; protected: - BOOL loadImageRaw(const std::string& file_name, LLImageRaw* image_raw); + bool loadImageRaw(const std::string& file_name, LLImageRaw* image_raw); private: LLStringTable mImageNames; typedef std::map<const char*, LLPointer<LLGLTexture> > texture_map_t; diff --git a/indra/llappearance/lltexlayerparams.cpp b/indra/llappearance/lltexlayerparams.cpp index 2e7495b55f..30551c115d 100644 --- a/indra/llappearance/lltexlayerparams.cpp +++ b/indra/llappearance/lltexlayerparams.cpp @@ -69,7 +69,7 @@ LLTexLayerParam::LLTexLayerParam(const LLTexLayerParam& pOther) { } -BOOL LLTexLayerParam::setInfo(LLViewerVisualParamInfo *info, BOOL add_to_appearance) +bool LLTexLayerParam::setInfo(LLViewerVisualParamInfo *info, bool add_to_appearance) { LLViewerVisualParam::setInfo(info); @@ -79,7 +79,7 @@ BOOL LLTexLayerParam::setInfo(LLViewerVisualParamInfo *info, BOOL add_to_appeara this->setParamLocation(mAvatarAppearance->isSelf() ? LOC_AV_SELF : LOC_AV_OTHER); } - return TRUE; + return true; } @@ -123,8 +123,8 @@ LLTexLayerParamAlpha::LLTexLayerParamAlpha(LLTexLayerInterface* layer) mCachedProcessedTexture(NULL), mStaticImageTGA(), mStaticImageRaw(), - mNeedsCreateTexture(FALSE), - mStaticImageInvalid(FALSE), + mNeedsCreateTexture(false), + mStaticImageInvalid(false), mAvgDistortionVec(1.f, 1.f, 1.f), mCachedEffectiveWeight(0.f) { @@ -136,8 +136,8 @@ LLTexLayerParamAlpha::LLTexLayerParamAlpha(LLAvatarAppearance* appearance) mCachedProcessedTexture(NULL), mStaticImageTGA(), mStaticImageRaw(), - mNeedsCreateTexture(FALSE), - mStaticImageInvalid(FALSE), + mNeedsCreateTexture(false), + mStaticImageInvalid(false), mAvgDistortionVec(1.f, 1.f, 1.f), mCachedEffectiveWeight(0.f) { @@ -173,10 +173,10 @@ void LLTexLayerParamAlpha::deleteCaches() mStaticImageTGA = NULL; // deletes image mCachedProcessedTexture = NULL; mStaticImageRaw = NULL; - mNeedsCreateTexture = FALSE; + mNeedsCreateTexture = false; } -BOOL LLTexLayerParamAlpha::getMultiplyBlend() const +bool LLTexLayerParamAlpha::getMultiplyBlend() const { return ((LLTexLayerParamAlphaInfo *)getInfo())->mMultiplyBlend; } @@ -216,7 +216,7 @@ void LLTexLayerParamAlpha::setAnimationTarget(F32 target_value) mTargetWeight = target_value; setWeight(target_value); - mIsAnimating = TRUE; + mIsAnimating = true; if (mNext) { mNext->setAnimationTarget(target_value); @@ -231,11 +231,11 @@ void LLTexLayerParamAlpha::animate(F32 delta) } } -BOOL LLTexLayerParamAlpha::getSkip() const +bool LLTexLayerParamAlpha::getSkip() const { if (!mTexLayer) { - return TRUE; + return true; } const LLAvatarAppearance *appearance = mTexLayer->getTexLayerSet()->getAvatarAppearance(); @@ -245,24 +245,24 @@ BOOL LLTexLayerParamAlpha::getSkip() const F32 effective_weight = (appearance->getSex() & getSex()) ? mCurWeight : getDefaultWeight(); if (is_approx_zero(effective_weight)) { - return TRUE; + return true; } } LLWearableType::EType type = (LLWearableType::EType)getWearableType(); if ((type != LLWearableType::WT_INVALID) && !appearance->isWearingWearableType(type)) { - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height) +bool LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height) { LL_PROFILE_ZONE_SCOPED; - BOOL success = TRUE; + bool success = true; if (!mTexLayer) { @@ -270,7 +270,7 @@ BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height) } F32 effective_weight = (mTexLayer->getTexLayerSet()->getAvatarAppearance()->getSex() & getSex()) ? mCurWeight : getDefaultWeight(); - BOOL weight_changed = effective_weight != mCachedEffectiveWeight; + bool weight_changed = effective_weight != mCachedEffectiveWeight; if (getSkip()) { return success; @@ -294,13 +294,13 @@ BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height) // Don't load the image file until we actually need it the first time. Like now. mStaticImageTGA = LLTexLayerStaticImageList::getInstance()->getImageTGA(info->mStaticImageFileName); // We now have something in one of our caches - LLTexLayerSet::sHasCaches |= mStaticImageTGA.notNull() ? TRUE : FALSE; + LLTexLayerSet::sHasCaches |= mStaticImageTGA.notNull(); if (mStaticImageTGA.isNull()) { LL_WARNS() << "Unable to load static file: " << info->mStaticImageFileName << LL_ENDL; - mStaticImageInvalid = TRUE; // don't try again. - return FALSE; + mStaticImageInvalid = true; // don't try again. + return false; } } @@ -316,10 +316,10 @@ BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height) if (!mCachedProcessedTexture) { llassert(gTextureManagerBridgep); - mCachedProcessedTexture = gTextureManagerBridgep->getLocalTexture(image_tga_width, image_tga_height, 1, FALSE); + mCachedProcessedTexture = gTextureManagerBridgep->getLocalTexture(image_tga_width, image_tga_height, 1, false); // We now have something in one of our caches - LLTexLayerSet::sHasCaches |= mCachedProcessedTexture ? TRUE : FALSE; + LLTexLayerSet::sHasCaches |= mCachedProcessedTexture.notNull(); mCachedProcessedTexture->setExplicitFormat(GL_ALPHA8, GL_ALPHA); } @@ -328,7 +328,7 @@ BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height) mStaticImageRaw = NULL; mStaticImageRaw = new LLImageRaw; mStaticImageTGA->decodeAndProcess(mStaticImageRaw, info->mDomain, effective_weight); - mNeedsCreateTexture = TRUE; + mNeedsCreateTexture = true; LL_DEBUGS() << "Built Cached Alpha: " << info->mStaticImageFileName << ": (" << mStaticImageRaw->getWidth() << ", " << mStaticImageRaw->getHeight() << ") " << "Domain: " << info->mDomain << " Weight: " << effective_weight << LL_ENDL; } @@ -339,7 +339,7 @@ BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height) if (mNeedsCreateTexture) { mCachedProcessedTexture->createGLTexture(0, mStaticImageRaw); - mNeedsCreateTexture = FALSE; + mNeedsCreateTexture = false; gGL.getTexUnit(0)->bind(mCachedProcessedTexture); mCachedProcessedTexture->setAddressMode(LLTexUnit::TAM_CLAMP); } @@ -372,23 +372,23 @@ BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height) // LLTexLayerParamAlphaInfo //----------------------------------------------------------------------------- LLTexLayerParamAlphaInfo::LLTexLayerParamAlphaInfo() : - mMultiplyBlend(FALSE), - mSkipIfZeroWeight(FALSE), + mMultiplyBlend(false), + mSkipIfZeroWeight(false), mDomain(0.f) { } -BOOL LLTexLayerParamAlphaInfo::parseXml(LLXmlTreeNode* node) +bool LLTexLayerParamAlphaInfo::parseXml(LLXmlTreeNode* node) { llassert(node->hasName("param") && node->getChildByName("param_alpha")); if (!LLViewerVisualParamInfo::parseXml(node)) - return FALSE; + return false; LLXmlTreeNode* param_alpha_node = node->getChildByName("param_alpha"); if (!param_alpha_node) { - return FALSE; + return false; } static LLStdStringHandle tga_file_string = LLXmlTree::addAttributeString("tga_file"); @@ -410,7 +410,7 @@ BOOL LLTexLayerParamAlphaInfo::parseXml(LLXmlTreeNode* node) static LLStdStringHandle domain_string = LLXmlTree::addAttributeString("domain"); param_alpha_node->getFastAttributeF32(domain_string, mDomain); - return TRUE; + return true; } @@ -464,10 +464,10 @@ LLColor4 LLTexLayerParamColor::getNetColor() const F32 weight = scaled_weight - index_start; const LLColor4 *start = &info->mColors[ index_start ]; const LLColor4 *end = &info->mColors[ index_end ]; - return LLColor4((1.f - weight) * start->mV[VX] + weight * end->mV[VX], - (1.f - weight) * start->mV[VY] + weight * end->mV[VY], - (1.f - weight) * start->mV[VZ] + weight * end->mV[VZ], - (1.f - weight) * start->mV[VW] + weight * end->mV[VW]); + return LLColor4((1.f - weight) * start->mV[VRED] + weight * end->mV[VRED], + (1.f - weight) * start->mV[VGREEN] + weight * end->mV[VGREEN], + (1.f - weight) * start->mV[VBLUE] + weight * end->mV[VBLUE], + (1.f - weight) * start->mV[VALPHA] + weight * end->mV[VALPHA]); } } @@ -514,7 +514,7 @@ void LLTexLayerParamColor::setAnimationTarget(F32 target_value) // set value first then set interpolating flag to ignore further updates mTargetWeight = target_value; setWeight(target_value); - mIsAnimating = TRUE; + mIsAnimating = true; if (mNext) { mNext->setAnimationTarget(target_value); @@ -538,17 +538,17 @@ LLTexLayerParamColorInfo::LLTexLayerParamColorInfo() : { } -BOOL LLTexLayerParamColorInfo::parseXml(LLXmlTreeNode *node) +bool LLTexLayerParamColorInfo::parseXml(LLXmlTreeNode *node) { llassert(node->hasName("param") && node->getChildByName("param_color")); if (!LLViewerVisualParamInfo::parseXml(node)) - return FALSE; + return false; LLXmlTreeNode* param_color_node = node->getChildByName("param_color"); if (!param_color_node) { - return FALSE; + return false; } std::string op_string; @@ -581,14 +581,14 @@ BOOL LLTexLayerParamColorInfo::parseXml(LLXmlTreeNode *node) if (!mNumColors) { LL_WARNS() << "<param_color> is missing <value> sub-elements" << LL_ENDL; - return FALSE; + return false; } if ((mOperation == LLTexLayerParamColor::OP_BLEND) && (mNumColors != 1)) { LL_WARNS() << "<param_color> with operation\"blend\" must have exactly one <value>" << LL_ENDL; - return FALSE; + return false; } - return TRUE; + return true; } diff --git a/indra/llappearance/lltexlayerparams.h b/indra/llappearance/lltexlayerparams.h index 54264c119a..5e785e4f3e 100644 --- a/indra/llappearance/lltexlayerparams.h +++ b/indra/llappearance/lltexlayerparams.h @@ -48,7 +48,7 @@ class LLTexLayerParam : public LLViewerVisualParam public: LLTexLayerParam(LLTexLayerInterface *layer); LLTexLayerParam(LLAvatarAppearance *appearance); - /*virtual*/ BOOL setInfo(LLViewerVisualParamInfo *info, BOOL add_to_appearance); + /*virtual*/ bool setInfo(LLViewerVisualParamInfo *info, bool add_to_appearance); /*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const = 0; protected: @@ -74,7 +74,7 @@ public: /*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable = NULL) const; // LLVisualParam Virtual functions - ///*virtual*/ BOOL parseData(LLXmlTreeNode* node); + ///*virtual*/ bool parseData(LLXmlTreeNode* node); /*virtual*/ void apply( ESex avatar_sex ) {} /*virtual*/ void setWeight(F32 weight); /*virtual*/ void setAnimationTarget(F32 target_value); @@ -89,10 +89,10 @@ public: /*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return NULL;}; // New functions - BOOL render( S32 x, S32 y, S32 width, S32 height ); - BOOL getSkip() const; + bool render( S32 x, S32 y, S32 width, S32 height ); + bool getSkip() const; void deleteCaches(); - BOOL getMultiplyBlend() const; + bool getMultiplyBlend() const; private: LLTexLayerParamAlpha(const LLTexLayerParamAlpha& pOther); @@ -100,8 +100,8 @@ private: LLPointer<LLGLTexture> mCachedProcessedTexture; LLPointer<LLImageTGA> mStaticImageTGA; LLPointer<LLImageRaw> mStaticImageRaw; - std::atomic<BOOL> mNeedsCreateTexture; - BOOL mStaticImageInvalid; + std::atomic<bool> mNeedsCreateTexture; + bool mStaticImageInvalid; LL_ALIGN_16(LLVector4a mAvgDistortionVec); F32 mCachedEffectiveWeight; @@ -120,12 +120,12 @@ public: LLTexLayerParamAlphaInfo(); /*virtual*/ ~LLTexLayerParamAlphaInfo() {}; - /*virtual*/ BOOL parseXml(LLXmlTreeNode* node); + /*virtual*/ bool parseXml(LLXmlTreeNode* node); private: std::string mStaticImageFileName; - BOOL mMultiplyBlend; - BOOL mSkipIfZeroWeight; + bool mMultiplyBlend; + bool mSkipIfZeroWeight; F32 mDomain; }; // @@ -157,7 +157,7 @@ public: /*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable = NULL) const; // LLVisualParam Virtual functions - ///*virtual*/ BOOL parseData(LLXmlTreeNode* node); + ///*virtual*/ bool parseData(LLXmlTreeNode* node); /*virtual*/ void apply( ESex avatar_sex ) {} /*virtual*/ void setWeight(F32 weight); /*virtual*/ void setAnimationTarget(F32 target_value); @@ -189,7 +189,7 @@ class LLTexLayerParamColorInfo : public LLViewerVisualParamInfo public: LLTexLayerParamColorInfo(); virtual ~LLTexLayerParamColorInfo() {}; - BOOL parseXml( LLXmlTreeNode* node ); + bool parseXml( LLXmlTreeNode* node ); LLTexLayerParamColor::EColorOperation getOperation() const { return mOperation; } private: enum { MAX_COLOR_VALUES = 20 }; diff --git a/indra/llappearance/llviewervisualparam.cpp b/indra/llappearance/llviewervisualparam.cpp index 2cc072fd13..00d6383ad0 100644 --- a/indra/llappearance/llviewervisualparam.cpp +++ b/indra/llappearance/llviewervisualparam.cpp @@ -39,12 +39,12 @@ LLViewerVisualParamInfo::LLViewerVisualParamInfo() : mWearableType( LLWearableType::WT_INVALID ), - mCrossWearable(FALSE), + mCrossWearable(false), mCamDist( 0.5f ), mCamAngle( 0.f ), mCamElevation( 0.f ), mEditGroupDisplayOrder( 0 ), - mShowSimple(FALSE), + mShowSimple(false), mSimpleMin(0.f), mSimpleMax(100.f) { @@ -57,12 +57,12 @@ LLViewerVisualParamInfo::~LLViewerVisualParamInfo() //----------------------------------------------------------------------------- // parseXml() //----------------------------------------------------------------------------- -BOOL LLViewerVisualParamInfo::parseXml(LLXmlTreeNode *node) +bool LLViewerVisualParamInfo::parseXml(LLXmlTreeNode *node) { llassert( node->hasName( "param" ) ); if (!LLVisualParamInfo::parseXml(node)) - return FALSE; + return false; // VIEWER SPECIFIC PARAMS @@ -82,7 +82,7 @@ BOOL LLViewerVisualParamInfo::parseXml(LLXmlTreeNode *node) static LLStdStringHandle cross_wearable_string = LLXmlTree::addAttributeString("cross_wearable"); if (!node->getFastAttributeBOOL(cross_wearable_string, mCrossWearable)) { - mCrossWearable = FALSE; + mCrossWearable = false; } // Optional camera offsets from the current joint center. Used for generating "hints" (thumbnails). @@ -107,7 +107,7 @@ BOOL LLViewerVisualParamInfo::parseXml(LLXmlTreeNode *node) params_loaded++; - return TRUE; + return true; } /*virtual*/ void LLViewerVisualParamInfo::toStream(std::ostream &out) @@ -146,15 +146,15 @@ LLViewerVisualParam::~LLViewerVisualParam() // setInfo() //----------------------------------------------------------------------------- -BOOL LLViewerVisualParam::setInfo(LLViewerVisualParamInfo *info) +bool LLViewerVisualParam::setInfo(LLViewerVisualParamInfo *info) { llassert(mInfo == NULL); if (info->mID < 0) - return FALSE; + return false; mInfo = info; mID = info->mID; setWeight(getDefaultWeight()); - return TRUE; + return true; } /* @@ -166,14 +166,14 @@ BOOL LLViewerVisualParam::setInfo(LLViewerVisualParamInfo *info) //----------------------------------------------------------------------------- // parseData() //----------------------------------------------------------------------------- -BOOL LLViewerVisualParam::parseData(LLXmlTreeNode *node) +bool LLViewerVisualParam::parseData(LLXmlTreeNode *node) { LLViewerVisualParamInfo* info = new LLViewerVisualParamInfo; info->parseXml(node); if (!setInfo(info)) - return FALSE; + return false; - return TRUE; + return true; } */ diff --git a/indra/llappearance/llviewervisualparam.h b/indra/llappearance/llviewervisualparam.h index 7e332875f5..b79983df8e 100644 --- a/indra/llappearance/llviewervisualparam.h +++ b/indra/llappearance/llviewervisualparam.h @@ -43,19 +43,19 @@ public: LLViewerVisualParamInfo(); /*virtual*/ ~LLViewerVisualParamInfo(); - /*virtual*/ BOOL parseXml(LLXmlTreeNode* node); + /*virtual*/ bool parseXml(LLXmlTreeNode* node); /*virtual*/ void toStream(std::ostream &out); protected: S32 mWearableType; - BOOL mCrossWearable; + bool mCrossWearable; std::string mEditGroup; F32 mCamDist; F32 mCamAngle; // degrees F32 mCamElevation; F32 mEditGroupDisplayOrder; - BOOL mShowSimple; // show edit controls when in "simple ui" mode? + bool mShowSimple; // show edit controls when in "simple ui" mode? F32 mSimpleMin; // when in simple UI, apply this minimum, range 0.f to 100.f F32 mSimpleMax; // when in simple UI, apply this maximum, range 0.f to 100.f }; @@ -75,12 +75,12 @@ public: // Special: These functions are overridden by child classes LLViewerVisualParamInfo *getInfo() const { return (LLViewerVisualParamInfo*)mInfo; }; // This sets mInfo and calls initialization functions - BOOL setInfo(LLViewerVisualParamInfo *info); + bool setInfo(LLViewerVisualParamInfo *info); virtual LLViewerVisualParam* cloneParam(LLWearable* wearable) const = 0; // LLVisualParam Virtual functions - ///*virtual*/ BOOL parseData(LLXmlTreeNode* node); + ///*virtual*/ bool parseData(LLXmlTreeNode* node); // New Virtual functions virtual F32 getTotalDistortion() = 0; @@ -99,11 +99,11 @@ public: F32 getCameraAngle() const { return getInfo()->mCamAngle; } // degrees F32 getCameraElevation() const { return getInfo()->mCamElevation; } - BOOL getShowSimple() const { return getInfo()->mShowSimple; } + bool getShowSimple() const { return getInfo()->mShowSimple; } F32 getSimpleMin() const { return getInfo()->mSimpleMin; } F32 getSimpleMax() const { return getInfo()->mSimpleMax; } - BOOL getCrossWearable() const { return getInfo()->mCrossWearable; } + bool getCrossWearable() const { return getInfo()->mCrossWearable; } protected: LLViewerVisualParam(const LLViewerVisualParam& pOther); diff --git a/indra/llappearance/llwearable.cpp b/indra/llappearance/llwearable.cpp index f04bae3d62..a7e5292fed 100644 --- a/indra/llappearance/llwearable.cpp +++ b/indra/llappearance/llwearable.cpp @@ -86,16 +86,16 @@ LLAssetType::EType LLWearable::getAssetType() const return LLWearableType::getInstance()->getAssetType(mType); } -BOOL LLWearable::exportFile(const std::string& filename) const +bool LLWearable::exportFile(const std::string& filename) const { llofstream ofs(filename.c_str(), std::ios_base::out | std::ios_base::trunc | std::ios_base::binary); return ofs.is_open() && exportStream(ofs); } // virtual -BOOL LLWearable::exportStream( std::ostream& output_stream ) const +bool LLWearable::exportStream( std::ostream& output_stream ) const { - if (!output_stream.good()) return FALSE; + if (!output_stream.good()) return false; // header and version output_stream << "LLWearable version " << mDefinitionVersion << "\n"; @@ -107,13 +107,13 @@ BOOL LLWearable::exportStream( std::ostream& output_stream ) const // permissions if( !mPermissions.exportLegacyStream( output_stream ) ) { - return FALSE; + return false; } // sale info if( !mSaleInfo.exportLegacyStream( output_stream ) ) { - return FALSE; + return false; } // wearable type @@ -139,7 +139,7 @@ BOOL LLWearable::exportStream( std::ostream& output_stream ) const const LLUUID& image_id = te_pair.second->getID(); output_stream << te << " " << image_id << "\n"; } - return TRUE; + return true; } void LLWearable::createVisualParams(LLAvatarAppearance *avatarp) @@ -307,7 +307,7 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, // permissions. Thus, we read that out, and fix legacy // objects. It's possible this op would fail, but it should pick // up the vast majority of the tasks. - BOOL has_perm_mask = FALSE; + bool has_perm_mask = false; U32 perm_mask = 0; if( !mSaleInfo.importLegacyStream(input_stream, has_perm_mask, perm_mask) ) { @@ -469,11 +469,11 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, return LLWearable::SUCCESS; } -BOOL LLWearable::getNextPopulatedLine(std::istream& input_stream, char* buffer, U32 buffer_size) +bool LLWearable::getNextPopulatedLine(std::istream& input_stream, char* buffer, U32 buffer_size) { if (!input_stream.good()) { - return FALSE; + return false; } do @@ -636,7 +636,7 @@ void LLWearable::addVisualParam(LLVisualParam *param) { delete mVisualParamIndexMap[param->getID()]; } - param->setIsDummy(FALSE); + param->setIsDummy(false); param->setParamLocation(LOC_WEARABLE); mVisualParamIndexMap[param->getID()] = param; mSavedVisualParamMap[param->getID()] = param->getDefaultWeight(); @@ -744,7 +744,7 @@ void LLWearable::writeToAvatar(LLAvatarAppearance* avatarp) std::string terse_F32_to_string(F32 f) { std::string r = llformat("%.2f", f); - S32 len = r.length(); + auto len = r.length(); // "1.20" -> "1.2" // "24.00" -> "24." diff --git a/indra/llappearance/llwearable.h b/indra/llappearance/llwearable.h index 22075e9d9b..c76e836a46 100644 --- a/indra/llappearance/llwearable.h +++ b/indra/llappearance/llwearable.h @@ -80,9 +80,9 @@ public: SUCCESS, BAD_HEADER }; - BOOL exportFile(const std::string& filename) const; + bool exportFile(const std::string& filename) const; EImportResult importFile(const std::string& filename, LLAvatarAppearance* avatarp ); - virtual BOOL exportStream( std::ostream& output_stream ) const; + virtual bool exportStream( std::ostream& output_stream ) const; virtual EImportResult importStream( std::istream& input_stream, LLAvatarAppearance* avatarp ); static void setCurrentDefinitionVersion( S32 version ) { LLWearable::sCurrentDefinitionVersion = version; } @@ -118,7 +118,7 @@ protected: void destroyTextures(); void createVisualParams(LLAvatarAppearance *avatarp); void createLayers(S32 te, LLAvatarAppearance *avatarp); - BOOL getNextPopulatedLine(std::istream& input_stream, char* buffer, U32 buffer_size); + bool getNextPopulatedLine(std::istream& input_stream, char* buffer, U32 buffer_size); static S32 sCurrentDefinitionVersion; // Depends on the current state of the avatar_lad.xml. S32 mDefinitionVersion; // Depends on the state of the avatar_lad.xml when this asset was created. diff --git a/indra/llappearance/llwearabledata.cpp b/indra/llappearance/llwearabledata.cpp index 55f8db8bda..7598ed67f3 100644 --- a/indra/llappearance/llwearabledata.cpp +++ b/indra/llappearance/llwearabledata.cpp @@ -86,7 +86,7 @@ void LLWearableData::setWearable(const LLWearableType::EType type, U32 index, LL { wearable_vec[index] = wearable; old_wearable->setUpdated(); - const BOOL removed = FALSE; + const bool removed = false; wearableUpdated(wearable, removed); } } @@ -105,14 +105,14 @@ void LLWearableData::pushWearable(const LLWearableType::EType type, mWearableDatas[type].push_back(wearable); if (trigger_updated) { - const BOOL removed = FALSE; + const bool removed = false; wearableUpdated(wearable, removed); } } } // virtual -void LLWearableData::wearableUpdated(LLWearable *wearable, BOOL removed) +void LLWearableData::wearableUpdated(LLWearable *wearable, bool removed) { wearable->setUpdated(); if (!removed) @@ -144,7 +144,7 @@ void LLWearableData::eraseWearable(const LLWearableType::EType type, U32 index) if (wearable) { mWearableDatas[type].erase(mWearableDatas[type].begin() + index); - const BOOL removed = TRUE; + const bool removed = true; wearableUpdated(wearable, removed); } } @@ -200,11 +200,11 @@ void LLWearableData::pullCrossWearableValues(const LLWearableType::EType type) } -BOOL LLWearableData::getWearableIndex(const LLWearable *wearable, U32& index_found) const +bool LLWearableData::getWearableIndex(const LLWearable *wearable, U32& index_found) const { if (wearable == NULL) { - return FALSE; + return false; } const LLWearableType::EType type = wearable->getType(); @@ -212,7 +212,7 @@ BOOL LLWearableData::getWearableIndex(const LLWearable *wearable, U32& index_fou if (wearable_iter == mWearableDatas.end()) { LL_WARNS() << "tried to get wearable index with an invalid type!" << LL_ENDL; - return FALSE; + return false; } const wearableentry_vec_t& wearable_vec = wearable_iter->second; for(U32 index = 0; index < wearable_vec.size(); index++) @@ -220,11 +220,11 @@ BOOL LLWearableData::getWearableIndex(const LLWearable *wearable, U32& index_fou if (wearable_vec[index] == wearable) { index_found = index; - return TRUE; + return true; } } - return FALSE; + return false; } U32 LLWearableData::getClothingLayerCount() const @@ -242,7 +242,7 @@ U32 LLWearableData::getClothingLayerCount() const return count; } -BOOL LLWearableData::canAddWearable(const LLWearableType::EType type) const +bool LLWearableData::canAddWearable(const LLWearableType::EType type) const { LLAssetType::EType a_type = LLWearableType::getInstance()->getAssetType(type); if (a_type==LLAssetType::AT_CLOTHING) @@ -255,13 +255,13 @@ BOOL LLWearableData::canAddWearable(const LLWearableType::EType type) const } else { - return FALSE; + return false; } } -BOOL LLWearableData::isOnTop(LLWearable* wearable) const +bool LLWearableData::isOnTop(LLWearable* wearable) const { - if (!wearable) return FALSE; + if (!wearable) return false; const LLWearableType::EType type = wearable->getType(); return ( getTopWearable(type) == wearable ); } @@ -334,7 +334,7 @@ U32 LLWearableData::getWearableCount(const LLWearableType::EType type) const return 0; } const wearableentry_vec_t& wearable_vec = wearable_iter->second; - return wearable_vec.size(); + return static_cast<U32>(wearable_vec.size()); } U32 LLWearableData::getWearableCount(const U32 tex_index) const diff --git a/indra/llappearance/llwearabledata.h b/indra/llappearance/llwearabledata.h index 4276335bd6..1266aed008 100644 --- a/indra/llappearance/llwearabledata.h +++ b/indra/llappearance/llwearabledata.h @@ -60,11 +60,11 @@ public: const LLWearable* getBottomWearable(const LLWearableType::EType type) const; U32 getWearableCount(const LLWearableType::EType type) const; U32 getWearableCount(const U32 tex_index) const; - BOOL getWearableIndex(const LLWearable *wearable, U32& index) const; + bool getWearableIndex(const LLWearable *wearable, U32& index) const; U32 getClothingLayerCount() const; - BOOL canAddWearable(const LLWearableType::EType type) const; + bool canAddWearable(const LLWearableType::EType type) const; - BOOL isOnTop(LLWearable* wearable) const; + bool isOnTop(LLWearable* wearable) const; static const U32 MAX_CLOTHING_LAYERS = 60; @@ -76,7 +76,7 @@ protected: void setWearable(const LLWearableType::EType type, U32 index, LLWearable *wearable); void pushWearable(const LLWearableType::EType type, LLWearable *wearable, bool trigger_updated = true); - virtual void wearableUpdated(LLWearable *wearable, BOOL removed); + virtual void wearableUpdated(LLWearable *wearable, bool removed); void eraseWearable(LLWearable *wearable); void eraseWearable(const LLWearableType::EType type, U32 index); void clearWearableType(const LLWearableType::EType type); diff --git a/indra/llappearance/llwearabletype.cpp b/indra/llappearance/llwearabletype.cpp index 3a6b3969f6..988304cbac 100644 --- a/indra/llappearance/llwearabletype.cpp +++ b/indra/llappearance/llwearabletype.cpp @@ -32,27 +32,27 @@ LLWearableType::LLWearableDictionary::LLWearableDictionary(LLTranslationBridge::ptr_t& trans) { - addEntry(LLWearableType::WT_SHAPE, new WearableEntry(trans, "shape", "New Shape", LLAssetType::AT_BODYPART, LLInventoryType::ICONNAME_BODYPART_SHAPE, FALSE, FALSE)); - addEntry(LLWearableType::WT_SKIN, new WearableEntry(trans, "skin", "New Skin", LLAssetType::AT_BODYPART, LLInventoryType::ICONNAME_BODYPART_SKIN, FALSE, FALSE)); - addEntry(LLWearableType::WT_HAIR, new WearableEntry(trans, "hair", "New Hair", LLAssetType::AT_BODYPART, LLInventoryType::ICONNAME_BODYPART_HAIR, FALSE, FALSE)); - addEntry(LLWearableType::WT_EYES, new WearableEntry(trans, "eyes", "New Eyes", LLAssetType::AT_BODYPART, LLInventoryType::ICONNAME_BODYPART_EYES, FALSE, FALSE)); - addEntry(LLWearableType::WT_SHIRT, new WearableEntry(trans, "shirt", "New Shirt", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_SHIRT, FALSE, TRUE)); - addEntry(LLWearableType::WT_PANTS, new WearableEntry(trans, "pants", "New Pants", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_PANTS, FALSE, TRUE)); - addEntry(LLWearableType::WT_SHOES, new WearableEntry(trans, "shoes", "New Shoes", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_SHOES, FALSE, TRUE)); - addEntry(LLWearableType::WT_SOCKS, new WearableEntry(trans, "socks", "New Socks", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_SOCKS, FALSE, TRUE)); - addEntry(LLWearableType::WT_JACKET, new WearableEntry(trans, "jacket", "New Jacket", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_JACKET, FALSE, TRUE)); - addEntry(LLWearableType::WT_GLOVES, new WearableEntry(trans, "gloves", "New Gloves", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_GLOVES, FALSE, TRUE)); - addEntry(LLWearableType::WT_UNDERSHIRT, new WearableEntry(trans, "undershirt", "New Undershirt", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_UNDERSHIRT, FALSE, TRUE)); - addEntry(LLWearableType::WT_UNDERPANTS, new WearableEntry(trans, "underpants", "New Underpants", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_UNDERPANTS, FALSE, TRUE)); - addEntry(LLWearableType::WT_SKIRT, new WearableEntry(trans, "skirt", "New Skirt", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_SKIRT, FALSE, TRUE)); - addEntry(LLWearableType::WT_ALPHA, new WearableEntry(trans, "alpha", "New Alpha", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_ALPHA, FALSE, TRUE)); - addEntry(LLWearableType::WT_TATTOO, new WearableEntry(trans, "tattoo", "New Tattoo", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_TATTOO, FALSE, TRUE)); - addEntry(LLWearableType::WT_UNIVERSAL, new WearableEntry(trans, "universal", "New Universal", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_UNIVERSAL, FALSE, TRUE)); - - addEntry(LLWearableType::WT_PHYSICS, new WearableEntry(trans, "physics", "New Physics", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_PHYSICS, TRUE, TRUE)); - - addEntry(LLWearableType::WT_INVALID, new WearableEntry(trans, "invalid", "Invalid Wearable", LLAssetType::AT_NONE, LLInventoryType::ICONNAME_UNKNOWN, FALSE, FALSE)); - addEntry(LLWearableType::WT_NONE, new WearableEntry(trans, "none", "Invalid Wearable", LLAssetType::AT_NONE, LLInventoryType::ICONNAME_NONE, FALSE, FALSE)); + addEntry(LLWearableType::WT_SHAPE, new WearableEntry(trans, "shape", "New Shape", LLAssetType::AT_BODYPART, LLInventoryType::ICONNAME_BODYPART_SHAPE, false, false)); + addEntry(LLWearableType::WT_SKIN, new WearableEntry(trans, "skin", "New Skin", LLAssetType::AT_BODYPART, LLInventoryType::ICONNAME_BODYPART_SKIN, false, false)); + addEntry(LLWearableType::WT_HAIR, new WearableEntry(trans, "hair", "New Hair", LLAssetType::AT_BODYPART, LLInventoryType::ICONNAME_BODYPART_HAIR, false, false)); + addEntry(LLWearableType::WT_EYES, new WearableEntry(trans, "eyes", "New Eyes", LLAssetType::AT_BODYPART, LLInventoryType::ICONNAME_BODYPART_EYES, false, false)); + addEntry(LLWearableType::WT_SHIRT, new WearableEntry(trans, "shirt", "New Shirt", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_SHIRT, false, true)); + addEntry(LLWearableType::WT_PANTS, new WearableEntry(trans, "pants", "New Pants", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_PANTS, false, true)); + addEntry(LLWearableType::WT_SHOES, new WearableEntry(trans, "shoes", "New Shoes", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_SHOES, false, true)); + addEntry(LLWearableType::WT_SOCKS, new WearableEntry(trans, "socks", "New Socks", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_SOCKS, false, true)); + addEntry(LLWearableType::WT_JACKET, new WearableEntry(trans, "jacket", "New Jacket", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_JACKET, false, true)); + addEntry(LLWearableType::WT_GLOVES, new WearableEntry(trans, "gloves", "New Gloves", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_GLOVES, false, true)); + addEntry(LLWearableType::WT_UNDERSHIRT, new WearableEntry(trans, "undershirt", "New Undershirt", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_UNDERSHIRT, false, true)); + addEntry(LLWearableType::WT_UNDERPANTS, new WearableEntry(trans, "underpants", "New Underpants", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_UNDERPANTS, false, true)); + addEntry(LLWearableType::WT_SKIRT, new WearableEntry(trans, "skirt", "New Skirt", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_SKIRT, false, true)); + addEntry(LLWearableType::WT_ALPHA, new WearableEntry(trans, "alpha", "New Alpha", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_ALPHA, false, true)); + addEntry(LLWearableType::WT_TATTOO, new WearableEntry(trans, "tattoo", "New Tattoo", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_TATTOO, false, true)); + addEntry(LLWearableType::WT_UNIVERSAL, new WearableEntry(trans, "universal", "New Universal", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_UNIVERSAL, false, true)); + + addEntry(LLWearableType::WT_PHYSICS, new WearableEntry(trans, "physics", "New Physics", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_PHYSICS, true, true)); + + addEntry(LLWearableType::WT_INVALID, new WearableEntry(trans, "invalid", "Invalid Wearable", LLAssetType::AT_NONE, LLInventoryType::ICONNAME_UNKNOWN, false, false)); + addEntry(LLWearableType::WT_NONE, new WearableEntry(trans, "none", "Invalid Wearable", LLAssetType::AT_NONE, LLInventoryType::ICONNAME_NONE, false, false)); } @@ -112,17 +112,17 @@ LLInventoryType::EIconName LLWearableType::getIconName(LLWearableType::EType typ return entry->mIconName; } -BOOL LLWearableType::getDisableCameraSwitch(LLWearableType::EType type) +bool LLWearableType::getDisableCameraSwitch(LLWearableType::EType type) { const WearableEntry *entry = mDictionary.lookup(type); - if (!entry) return FALSE; + if (!entry) return false; return entry->mDisableCameraSwitch; } -BOOL LLWearableType::getAllowMultiwear(LLWearableType::EType type) +bool LLWearableType::getAllowMultiwear(LLWearableType::EType type) { const WearableEntry *entry = mDictionary.lookup(type); - if (!entry) return FALSE; + if (!entry) return false; return entry->mAllowMultiwear; } diff --git a/indra/llappearance/llwearabletype.h b/indra/llappearance/llwearabletype.h index 99846586dc..206a344134 100644 --- a/indra/llappearance/llwearabletype.h +++ b/indra/llappearance/llwearabletype.h @@ -72,8 +72,8 @@ public: LLAssetType::EType getAssetType(EType type); EType typeNameToType(const std::string& type_name); LLInventoryType::EIconName getIconName(EType type); - BOOL getDisableCameraSwitch(EType type); - BOOL getAllowMultiwear(EType type); + bool getDisableCameraSwitch(EType type); + bool getAllowMultiwear(EType type); static EType inventoryFlagsToWearableType(U32 flags); @@ -85,8 +85,8 @@ private: const std::string& default_new_name, LLAssetType::EType assetType, LLInventoryType::EIconName iconName, - BOOL disable_camera_switch = FALSE, - BOOL allow_multiwear = TRUE) : + bool disable_camera_switch = false, + bool allow_multiwear = true) : LLDictionaryEntry(name), mAssetType(assetType), mDefaultNewName(default_new_name), @@ -101,8 +101,8 @@ private: const std::string mLabel; const std::string mDefaultNewName; LLInventoryType::EIconName mIconName; - BOOL mDisableCameraSwitch; - BOOL mAllowMultiwear; + bool mDisableCameraSwitch; + bool mAllowMultiwear; }; class LLWearableDictionary : public LLDictionary<LLWearableType::EType, WearableEntry> diff --git a/indra/llaudio/CMakeLists.txt b/indra/llaudio/CMakeLists.txt index f36da83c69..ba043f8fec 100644 --- a/indra/llaudio/CMakeLists.txt +++ b/indra/llaudio/CMakeLists.txt @@ -4,7 +4,6 @@ project(llaudio) include(00-Common) include(LLAudio) -include(FMODSTUDIO) include(OPENAL) include(LLCommon) @@ -25,20 +24,6 @@ set(llaudio_HEADER_FILES llwindgen.h ) -if (TARGET ll::fmodstudio) - list(APPEND llaudio_SOURCE_FILES - llaudioengine_fmodstudio.cpp - lllistener_fmodstudio.cpp - llstreamingaudio_fmodstudio.cpp - ) - - list(APPEND llaudio_HEADER_FILES - llaudioengine_fmodstudio.h - lllistener_fmodstudio.h - llstreamingaudio_fmodstudio.h - ) -endif () - if (TARGET ll::openal) list(APPEND llaudio_SOURCE_FILES llaudioengine_openal.cpp diff --git a/indra/llaudio/llaudiodecodemgr.cpp b/indra/llaudio/llaudiodecodemgr.cpp index ba4939f595..a46f9acc63 100755 --- a/indra/llaudio/llaudiodecodemgr.cpp +++ b/indra/llaudio/llaudiodecodemgr.cpp @@ -70,22 +70,22 @@ public: LLVorbisDecodeState(const LLUUID &uuid, const std::string &out_filename); - BOOL initDecode(); - BOOL decodeSection(); // Return TRUE if done. - BOOL finishDecode(); + bool initDecode(); + bool decodeSection(); // Return true if done. + bool finishDecode(); void flushBadFile(); void ioComplete(S32 bytes) { mBytesRead = bytes; } - BOOL isValid() const { return mValid; } - BOOL isDone() const { return mDone; } + bool isValid() const { return mValid; } + bool isDone() const { return mDone; } const LLUUID &getUUID() const { return mUUID; } protected: virtual ~LLVorbisDecodeState(); - BOOL mValid; - BOOL mDone; + bool mValid; + bool mDone; LLAtomicS32 mBytesRead; LLUUID mUUID; @@ -164,8 +164,8 @@ long cache_tell (void *datasource) LLVorbisDecodeState::LLVorbisDecodeState(const LLUUID &uuid, const std::string &out_filename) { - mDone = FALSE; - mValid = FALSE; + mDone = false; + mValid = false; mBytesRead = -1; mUUID = uuid; mInFilep = NULL; @@ -188,7 +188,7 @@ LLVorbisDecodeState::~LLVorbisDecodeState() } -BOOL LLVorbisDecodeState::initDecode() +bool LLVorbisDecodeState::initDecode() { ov_callbacks cache_callbacks; cache_callbacks.read_func = cache_read; @@ -204,14 +204,14 @@ BOOL LLVorbisDecodeState::initDecode() LL_WARNS("AudioEngine") << "unable to open vorbis source vfile for reading" << LL_ENDL; delete mInFilep; mInFilep = NULL; - return FALSE; + return false; } S32 r = ov_open_callbacks(mInFilep, &mVF, NULL, 0, cache_callbacks); if(r < 0) { LL_WARNS("AudioEngine") << r << " Input to vorbis decode does not appear to be an Ogg bitstream: " << mUUID << LL_ENDL; - return(FALSE); + return(false); } S32 sample_count = (S32)ov_pcm_total(&mVF, -1); @@ -260,7 +260,7 @@ BOOL LLVorbisDecodeState::initDecode() } delete mInFilep; mInFilep = NULL; - return FALSE; + return false; } try @@ -273,7 +273,7 @@ BOOL LLVorbisDecodeState::initDecode() LL_WARNS("AudioEngine") << "Out of memory when trying to alloc buffer: " << size_guess << LL_ENDL; delete mInFilep; mInFilep = NULL; - return FALSE; + return false; } { @@ -360,31 +360,31 @@ BOOL LLVorbisDecodeState::initDecode() // fprintf(stderr,"\nDecoded length: %ld samples\n", (long)ov_pcm_total(&vf,-1)); // fprintf(stderr,"Encoded by: %s\n\n",ov_comment(&vf,-1)->vendor); //} - return TRUE; + return true; } -BOOL LLVorbisDecodeState::decodeSection() +bool LLVorbisDecodeState::decodeSection() { if (!mInFilep) { LL_WARNS("AudioEngine") << "No cache file to decode in vorbis!" << LL_ENDL; - return TRUE; + return true; } if (mDone) { // LL_WARNS("AudioEngine") << "Already done with decode, aborting!" << LL_ENDL; - return TRUE; + return true; } char pcmout[4096]; /*Flawfinder: ignore*/ - BOOL eof = FALSE; + bool eof = false; long ret=ov_read(&mVF, pcmout, sizeof(pcmout), 0, 2, 1, &mCurrentSection); if (ret == 0) { /* EOF */ - eof = TRUE; - mDone = TRUE; - mValid = TRUE; + eof = true; + mDone = true; + mValid = true; // LL_INFOS("AudioEngine") << "Vorbis EOF" << LL_ENDL; } else if (ret < 0) @@ -394,10 +394,10 @@ BOOL LLVorbisDecodeState::decodeSection() LL_WARNS("AudioEngine") << "BAD vorbis decode in decodeSection." << LL_ENDL; - mValid = FALSE; - mDone = TRUE; - // We're done, return TRUE. - return TRUE; + mValid = false; + mDone = true; + // We're done, return true. + return true; } else { @@ -409,12 +409,12 @@ BOOL LLVorbisDecodeState::decodeSection() return eof; } -BOOL LLVorbisDecodeState::finishDecode() +bool LLVorbisDecodeState::finishDecode() { if (!isValid()) { LL_WARNS("AudioEngine") << "Bogus vorbis decode state for " << getUUID() << ", aborting!" << LL_ENDL; - return TRUE; // We've finished + return true; // We've finished } if (mFileHandle == LLLFSThread::nullHandle()) @@ -422,7 +422,7 @@ BOOL LLVorbisDecodeState::finishDecode() ov_clear(&mVF); // write "data" chunk length, in little-endian format - S32 data_length = mWAVBuffer.size() - WAV_HEADER_SIZE; + S32 data_length = static_cast<S32>(mWAVBuffer.size()) - WAV_HEADER_SIZE; mWAVBuffer[40] = (data_length) & 0x000000FF; mWAVBuffer[41] = (data_length >> 8) & 0x000000FF; mWAVBuffer[42] = (data_length >> 16) & 0x000000FF; @@ -463,7 +463,7 @@ BOOL LLVorbisDecodeState::finishDecode() { memcpy(&mWAVBuffer[WAV_HEADER_SIZE], pcmout, (2 * fade_length)); /*Flawfinder: ignore*/ } - S32 near_end = mWAVBuffer.size() - (2 * fade_length); + S32 near_end = static_cast<S32>(mWAVBuffer.size()) - (2 * fade_length); if ((S32)mWAVBuffer.size() >= ( near_end + 2* fade_length)) { memcpy(pcmout, &mWAVBuffer[near_end], (2 * fade_length)); /*Flawfinder: ignore*/ @@ -487,11 +487,11 @@ BOOL LLVorbisDecodeState::finishDecode() if (36 == data_length) { LL_WARNS("AudioEngine") << "BAD Vorbis decode in finishDecode!" << LL_ENDL; - mValid = FALSE; - return TRUE; // we've finished + mValid = false; + return true; // we've finished } mBytesRead = -1; - mFileHandle = LLLFSThread::sLocal->write(mOutFilename, &mWAVBuffer[0], 0, mWAVBuffer.size(), + mFileHandle = LLLFSThread::sLocal->write(mOutFilename, &mWAVBuffer[0], 0, static_cast<S32>(mWAVBuffer.size()), new WriteResponder(this)); } @@ -502,21 +502,21 @@ BOOL LLVorbisDecodeState::finishDecode() if (mBytesRead == 0) { LL_WARNS("AudioEngine") << "Unable to write file in LLVorbisDecodeState::finishDecode" << LL_ENDL; - mValid = FALSE; - return TRUE; // we've finished + mValid = false; + return true; // we've finished } } else { - return FALSE; // not done + return false; // not done } } - mDone = TRUE; + mDone = true; LL_DEBUGS("AudioEngine") << "Finished decode for " << getUUID() << LL_ENDL; - return TRUE; + return true; } void LLVorbisDecodeState::flushBadFile() @@ -779,13 +779,13 @@ void LLAudioDecodeMgr::processQueue() mImpl->processQueue(); } -BOOL LLAudioDecodeMgr::addDecodeRequest(const LLUUID &uuid) +bool LLAudioDecodeMgr::addDecodeRequest(const LLUUID &uuid) { if (gAudiop && gAudiop->hasDecodedFile(uuid)) { // Already have a decoded version, don't need to decode it. LL_DEBUGS("AudioEngine") << "addDecodeRequest for " << uuid << " has decoded file already" << LL_ENDL; - return TRUE; + return true; } if (gAssetStorage->hasLocalAsset(uuid, LLAssetType::AT_SOUND)) @@ -793,9 +793,9 @@ BOOL LLAudioDecodeMgr::addDecodeRequest(const LLUUID &uuid) // Just put it on the decode queue. LL_DEBUGS("AudioEngine") << "addDecodeRequest for " << uuid << " has local asset file already" << LL_ENDL; mImpl->mDecodeQueue.push_back(uuid); - return TRUE; + return true; } LL_DEBUGS("AudioEngine") << "addDecodeRequest for " << uuid << " no file available" << LL_ENDL; - return FALSE; + return false; } diff --git a/indra/llaudio/llaudiodecodemgr.h b/indra/llaudio/llaudiodecodemgr.h index 02d5c67587..79f8b8e92e 100644 --- a/indra/llaudio/llaudiodecodemgr.h +++ b/indra/llaudio/llaudiodecodemgr.h @@ -43,7 +43,7 @@ class LLAudioDecodeMgr : public LLSingleton<LLAudioDecodeMgr> ~LLAudioDecodeMgr(); public: void processQueue(); - BOOL addDecodeRequest(const LLUUID &uuid); + bool addDecodeRequest(const LLUUID &uuid); void addAudioRequest(const LLUUID &uuid); protected: diff --git a/indra/llaudio/llaudioengine.h b/indra/llaudio/llaudioengine.h index 2a16050c5b..a9a229c0a5 100755 --- a/indra/llaudio/llaudioengine.h +++ b/indra/llaudio/llaudioengine.h @@ -265,7 +265,7 @@ public: void preload(const LLUUID &audio_id); // Only used for preloading UI sounds, now. - void addAudioData(LLAudioData *adp, bool set_current = TRUE); + void addAudioData(LLAudioData *adp, bool set_current = true); void setForcedPriority(const bool ambient) { mForcedPriority = ambient; } bool isForcedPriority() const { return mForcedPriority; } diff --git a/indra/llaudio/llaudioengine_fmodstudio.cpp b/indra/llaudio/llaudioengine_fmodstudio.cpp deleted file mode 100644 index b4e8407083..0000000000 --- a/indra/llaudio/llaudioengine_fmodstudio.cpp +++ /dev/null @@ -1,756 +0,0 @@ -/** - * @file audioengine_fmodstudio.cpp - * @brief Implementation of LLAudioEngine class abstracting the audio - * support as a FMODSTUDIO implementation - * - * $LicenseInfo:firstyear=2020&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2020, 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 "llstreamingaudio.h" -#include "llstreamingaudio_fmodstudio.h" - -#include "llaudioengine_fmodstudio.h" -#include "lllistener_fmodstudio.h" - -#include "llerror.h" -#include "llmath.h" -#include "llrand.h" - -#include "fmodstudio/fmod.hpp" -#include "fmodstudio/fmod_errors.h" -#include "lldir.h" -#include "llapr.h" - -#include "sound_ids.h" - -FMOD_RESULT F_CALLBACK windCallback(FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, unsigned int length, int inchannels, int *outchannels); - -FMOD::ChannelGroup *LLAudioEngine_FMODSTUDIO::mChannelGroups[LLAudioEngine::AUDIO_TYPE_COUNT] = {0}; - -LLAudioEngine_FMODSTUDIO::LLAudioEngine_FMODSTUDIO(bool enable_profiler) -: mInited(false), - mWindGen(NULL), - mWindDSP(NULL), - mSystem(NULL), - mEnableProfiler(enable_profiler), - mWindDSPDesc(NULL) -{ -} - - -LLAudioEngine_FMODSTUDIO::~LLAudioEngine_FMODSTUDIO() -{ - // mWindDSPDesc, mWindGen and mWindDSP get cleaned up on cleanupWind in LLAudioEngine::shutdown() - // mSystem gets cleaned up at shutdown() -} - - -static inline bool Check_FMOD_Error(FMOD_RESULT result, const char *string) -{ - if (result == FMOD_OK) - return false; - LL_DEBUGS("FMOD") << string << " Error: " << FMOD_ErrorString(result) << LL_ENDL; - return true; -} - -bool LLAudioEngine_FMODSTUDIO::init(void* userdata, const std::string &app_title) -{ - U32 version; - FMOD_RESULT result; - - LL_DEBUGS("AppInit") << "LLAudioEngine_FMODSTUDIO::init() initializing FMOD" << LL_ENDL; - - result = FMOD::System_Create(&mSystem); - if (Check_FMOD_Error(result, "FMOD::System_Create")) - return false; - - //will call LLAudioEngine_FMODSTUDIO::allocateListener, which needs a valid mSystem pointer. - LLAudioEngine::init(userdata, app_title); - - result = mSystem->getVersion(&version); - Check_FMOD_Error(result, "FMOD::System::getVersion"); - - if (version < FMOD_VERSION) - { - LL_WARNS("AppInit") << "FMOD Studio version mismatch, actual: " << version - << " expected:" << FMOD_VERSION << LL_ENDL; - } - - // In this case, all sounds, PLUS wind and stream will be software. - result = mSystem->setSoftwareChannels(LL_MAX_AUDIO_CHANNELS + 2); - Check_FMOD_Error(result, "FMOD::System::setSoftwareChannels"); - - FMOD_ADVANCEDSETTINGS settings; - memset(&settings, 0, sizeof(settings)); - settings.cbSize = sizeof(FMOD_ADVANCEDSETTINGS); - settings.resamplerMethod = FMOD_DSP_RESAMPLER_LINEAR; - - result = mSystem->setAdvancedSettings(&settings); - Check_FMOD_Error(result, "FMOD::System::setAdvancedSettings"); - - // FMOD_INIT_THREAD_UNSAFE Disables thread safety for API calls. - // Only use this if FMOD is being called from a single thread, and if Studio API is not being used. - U32 fmod_flags = FMOD_INIT_NORMAL | FMOD_INIT_3D_RIGHTHANDED | FMOD_INIT_THREAD_UNSAFE; - if (mEnableProfiler) - { - fmod_flags |= FMOD_INIT_PROFILE_ENABLE; - } - -#if LL_LINUX - bool audio_ok = false; - - if (!audio_ok) - { - const char* env_string = getenv("LL_BAD_FMOD_PULSEAUDIO"); - if (NULL == env_string) - { - LL_DEBUGS("AppInit") << "Trying PulseAudio audio output..." << LL_ENDL; - if (mSystem->setOutput(FMOD_OUTPUTTYPE_PULSEAUDIO) == FMOD_OK && - (result = mSystem->init(LL_MAX_AUDIO_CHANNELS + 2, fmod_flags, const_cast<char*>(app_title.c_str()))) == FMOD_OK) - { - LL_DEBUGS("AppInit") << "PulseAudio output initialized OKAY" << LL_ENDL; - audio_ok = true; - } - else - { - Check_FMOD_Error(result, "PulseAudio audio output FAILED to initialize"); - } - } - else - { - LL_DEBUGS("AppInit") << "PulseAudio audio output SKIPPED" << LL_ENDL; - } - } - if (!audio_ok) - { - const char* env_string = getenv("LL_BAD_FMOD_ALSA"); - if (NULL == env_string) - { - LL_DEBUGS("AppInit") << "Trying ALSA audio output..." << LL_ENDL; - if (mSystem->setOutput(FMOD_OUTPUTTYPE_ALSA) == FMOD_OK && - (result = mSystem->init(LL_MAX_AUDIO_CHANNELS + 2, fmod_flags, 0)) == FMOD_OK) - { - LL_DEBUGS("AppInit") << "ALSA audio output initialized OKAY" << LL_ENDL; - audio_ok = true; - } - else - { - Check_FMOD_Error(result, "ALSA audio output FAILED to initialize"); - } - } - else - { - LL_DEBUGS("AppInit") << "ALSA audio output SKIPPED" << LL_ENDL; - } - } - if (!audio_ok) - { - LL_WARNS("AppInit") << "Overall audio init failure." << LL_ENDL; - return false; - } - - // We're interested in logging which output method we - // ended up with, for QA purposes. - FMOD_OUTPUTTYPE output_type; - mSystem->getOutput(&output_type); - switch (output_type) - { - case FMOD_OUTPUTTYPE_NOSOUND: - LL_INFOS("AppInit") << "Audio output: NoSound" << LL_ENDL; break; - case FMOD_OUTPUTTYPE_PULSEAUDIO: - LL_INFOS("AppInit") << "Audio output: PulseAudio" << LL_ENDL; break; - case FMOD_OUTPUTTYPE_ALSA: - LL_INFOS("AppInit") << "Audio output: ALSA" << LL_ENDL; break; - default: - LL_INFOS("AppInit") << "Audio output: Unknown!" << LL_ENDL; break; - }; -#else // LL_LINUX - - // initialize the FMOD engine - // number of channel in this case looks to be identiacal to number of max simultaneously - // playing objects and we can set practically any number - result = mSystem->init(LL_MAX_AUDIO_CHANNELS + 2, fmod_flags, 0); - if (Check_FMOD_Error(result, "Error initializing FMOD Studio with default settins, retrying with other format")) - { - result = mSystem->setSoftwareFormat(44100, FMOD_SPEAKERMODE_STEREO, 0/*- ignore*/); - if (Check_FMOD_Error(result, "Error setting sotware format. Can't init.")) - { - return false; - } - result = mSystem->init(LL_MAX_AUDIO_CHANNELS + 2, fmod_flags, 0); - } - if (Check_FMOD_Error(result, "Error initializing FMOD Studio")) - { - // If it fails here and (result == FMOD_ERR_OUTPUT_CREATEBUFFER), - // we can retry with other settings - return false; - } -#endif - - LL_INFOS("AppInit") << "LLAudioEngine_FMODSTUDIO::init() FMOD Studio initialized correctly" << LL_ENDL; - - int r_numbuffers, r_samplerate, r_channels; - unsigned int r_bufferlength; - char r_name[512]; - int latency = 100; - mSystem->getDSPBufferSize(&r_bufferlength, &r_numbuffers); - LL_INFOS("AppInit") << "LLAudioEngine_FMODSTUDIO::init(): r_bufferlength=" << r_bufferlength << " bytes" << LL_ENDL; - LL_INFOS("AppInit") << "LLAudioEngine_FMODSTUDIO::init(): r_numbuffers=" << r_numbuffers << LL_ENDL; - - mSystem->getDriverInfo(0, r_name, 511, NULL, &r_samplerate, NULL, &r_channels); - r_name[511] = '\0'; - LL_INFOS("AppInit") << "LLAudioEngine_FMODSTUDIO::init(): r_name=\"" << r_name << "\"" << LL_ENDL; - - if (r_samplerate != 0) - latency = (int)(1000.0f * r_bufferlength * r_numbuffers / r_samplerate); - LL_INFOS("AppInit") << "LLAudioEngine_FMODSTUDIO::init(): latency=" << latency << "ms" << LL_ENDL; - - mInited = true; - - LL_INFOS("AppInit") << "LLAudioEngine_FMODSTUDIO::init(): initialization complete." << LL_ENDL; - - return true; -} - - -std::string LLAudioEngine_FMODSTUDIO::getDriverName(bool verbose) -{ - llassert_always(mSystem); - if (verbose) - { - U32 version; - if (!Check_FMOD_Error(mSystem->getVersion(&version), "FMOD::System::getVersion")) - { - return llformat("FMOD Studio %1x.%02x.%02x (Firelight Technologies Pty Ltd)", version >> 16, version >> 8 & 0x000000FF, version & 0x000000FF); - } - } - return "FMOD STUDIO"; -} - - -// create our favourite FMOD-native streaming audio implementation -LLStreamingAudioInterface *LLAudioEngine_FMODSTUDIO::createDefaultStreamingAudioImpl() const -{ - return new LLStreamingAudio_FMODSTUDIO(mSystem); -} - - -void LLAudioEngine_FMODSTUDIO::allocateListener(void) -{ - mListenerp = (LLListener *) new LLListener_FMODSTUDIO(mSystem); - if (!mListenerp) - { - LL_WARNS("FMOD") << "Listener creation failed" << LL_ENDL; - } -} - - -void LLAudioEngine_FMODSTUDIO::shutdown() -{ - stopInternetStream(); - - LL_INFOS("FMOD") << "About to LLAudioEngine::shutdown()" << LL_ENDL; - LLAudioEngine::shutdown(); - - LL_INFOS("FMOD") << "LLAudioEngine_FMODSTUDIO::shutdown() closing FMOD Studio" << LL_ENDL; - if (mSystem) - { - mSystem->close(); - mSystem->release(); - } - LL_INFOS("FMOD") << "LLAudioEngine_FMODSTUDIO::shutdown() done closing FMOD Studio" << LL_ENDL; - - delete mListenerp; - mListenerp = NULL; -} - - -LLAudioBuffer * LLAudioEngine_FMODSTUDIO::createBuffer() -{ - return new LLAudioBufferFMODSTUDIO(mSystem); -} - - -LLAudioChannel * LLAudioEngine_FMODSTUDIO::createChannel() -{ - return new LLAudioChannelFMODSTUDIO(mSystem); -} - -bool LLAudioEngine_FMODSTUDIO::initWind() -{ - mNextWindUpdate = 0.0; - - if (!mWindDSPDesc) - { - mWindDSPDesc = new FMOD_DSP_DESCRIPTION(); - } - - if (!mWindDSP) - { - memset(mWindDSPDesc, 0, sizeof(*mWindDSPDesc)); //Set everything to zero - strncpy(mWindDSPDesc->name, "Wind Unit", sizeof(mWindDSPDesc->name)); - mWindDSPDesc->pluginsdkversion = FMOD_PLUGIN_SDK_VERSION; - mWindDSPDesc->read = &windCallback; // Assign callback - may be called from arbitrary threads - if (Check_FMOD_Error(mSystem->createDSP(mWindDSPDesc, &mWindDSP), "FMOD::createDSP")) - return false; - - if (mWindGen) - delete mWindGen; - - int frequency = 44100; - - FMOD_SPEAKERMODE mode; - if (Check_FMOD_Error(mSystem->getSoftwareFormat(&frequency, &mode, nullptr), "FMOD::System::getSoftwareFormat")) - { - cleanupWind(); - return false; - } - - mWindGen = new LLWindGen<MIXBUFFERFORMAT>((U32)frequency); - - if (Check_FMOD_Error(mWindDSP->setUserData((void*)mWindGen), "FMOD::DSP::setUserData")) - { - cleanupWind(); - return false; - } - if (Check_FMOD_Error(mWindDSP->setChannelFormat(FMOD_CHANNELMASK_STEREO, 2, mode), "FMOD::DSP::setChannelFormat")) - { - cleanupWind(); - return false; - } - } - - // *TODO: Should this guard against multiple plays? - if (Check_FMOD_Error(mSystem->playDSP(mWindDSP, nullptr, false, nullptr), "FMOD::System::playDSP")) - { - cleanupWind(); - return false; - } - return true; -} - - -void LLAudioEngine_FMODSTUDIO::cleanupWind() -{ - if (mWindDSP) - { - FMOD::ChannelGroup* master_group = NULL; - if (!Check_FMOD_Error(mSystem->getMasterChannelGroup(&master_group), "FMOD::System::getMasterChannelGroup") - && master_group) - { - master_group->removeDSP(mWindDSP); - } - mWindDSP->release(); - mWindDSP = NULL; - } - - delete mWindDSPDesc; - mWindDSPDesc = NULL; - - delete mWindGen; - mWindGen = NULL; -} - - -//----------------------------------------------------------------------- -void LLAudioEngine_FMODSTUDIO::updateWind(LLVector3 wind_vec, F32 camera_height_above_water) -{ - LLVector3 wind_pos; - F64 pitch; - F64 center_freq; - - if (!mEnableWind) - { - return; - } - - if (mWindUpdateTimer.checkExpirationAndReset(LL_WIND_UPDATE_INTERVAL)) - { - - // wind comes in as Linden coordinate (+X = forward, +Y = left, +Z = up) - // need to convert this to the conventional orientation DS3D and OpenAL use - // where +X = right, +Y = up, +Z = backwards - - wind_vec.setVec(-wind_vec.mV[1], wind_vec.mV[2], -wind_vec.mV[0]); - - // cerr << "Wind update" << endl; - - pitch = 1.0 + mapWindVecToPitch(wind_vec); - center_freq = 80.0 * pow(pitch, 2.5*(mapWindVecToGain(wind_vec) + 1.0)); - - mWindGen->mTargetFreq = (F32)center_freq; - mWindGen->mTargetGain = (F32)mapWindVecToGain(wind_vec) * mMaxWindGain; - mWindGen->mTargetPanGainR = (F32)mapWindVecToPan(wind_vec); - } -} - -//----------------------------------------------------------------------- -void LLAudioEngine_FMODSTUDIO::setInternalGain(F32 gain) -{ - if (!mInited) - { - return; - } - - gain = llclamp(gain, 0.0f, 1.0f); - - FMOD::ChannelGroup* master_group = NULL; - if (!Check_FMOD_Error(mSystem->getMasterChannelGroup(&master_group), "FMOD::System::getMasterChannelGroup") - && master_group) - { - master_group->setVolume(gain); - } - - LLStreamingAudioInterface *saimpl = getStreamingAudioImpl(); - if (saimpl) - { - // fmod likes its streaming audio channel gain re-asserted after - // master volume change. - saimpl->setGain(saimpl->getGain()); - } -} - -// -// LLAudioChannelFMODSTUDIO implementation -// - -LLAudioChannelFMODSTUDIO::LLAudioChannelFMODSTUDIO(FMOD::System *system) : LLAudioChannel(), mSystemp(system), mChannelp(NULL), mLastSamplePos(0) -{ -} - - -LLAudioChannelFMODSTUDIO::~LLAudioChannelFMODSTUDIO() -{ - cleanup(); -} - -bool LLAudioChannelFMODSTUDIO::updateBuffer() -{ - if (!mCurrentSourcep) - { - // This channel isn't associated with any source, nothing - // to be updated - return false; - } - - if (LLAudioChannel::updateBuffer()) - { - // Base class update returned true, which means that we need to actually - // set up the channel for a different buffer. - - LLAudioBufferFMODSTUDIO *bufferp = (LLAudioBufferFMODSTUDIO *)mCurrentSourcep->getCurrentBuffer(); - - // Grab the FMOD sample associated with the buffer - FMOD::Sound *soundp = bufferp->getSound(); - if (!soundp) - { - // This is bad, there should ALWAYS be a sound associated with a legit - // buffer. - LL_ERRS() << "No FMOD sound!" << LL_ENDL; - return false; - } - - - // Actually play the sound. Start it off paused so we can do all the necessary - // setup. - if (!mChannelp) - { - FMOD_RESULT result = getSystem()->playSound(soundp, NULL /*free channel?*/, true, &mChannelp); - Check_FMOD_Error(result, "FMOD::System::playSound"); - } - - // Setting up channel mChannelID - } - - // If we have a source for the channel, we need to update its gain. - if (mCurrentSourcep) - { - // SJB: warnings can spam and hurt framerate, disabling - //FMOD_RESULT result; - - mChannelp->setVolume(getSecondaryGain() * mCurrentSourcep->getGain()); - //Check_FMOD_Error(result, "FMOD::Channel::setVolume"); - - mChannelp->setMode(mCurrentSourcep->isLoop() ? FMOD_LOOP_NORMAL : FMOD_LOOP_OFF); - /*if(Check_FMOD_Error(result, "FMOD::Channel::setMode")) - { - S32 index; - mChannelp->getIndex(&index); - LL_WARNS() << "Channel " << index << "Source ID: " << mCurrentSourcep->getID() - << " at " << mCurrentSourcep->getPositionGlobal() << LL_ENDL; - }*/ - } - - return true; -} - - -void LLAudioChannelFMODSTUDIO::update3DPosition() -{ - if (!mChannelp) - { - // We're not actually a live channel (i.e., we're not playing back anything) - return; - } - - LLAudioBufferFMODSTUDIO *bufferp = (LLAudioBufferFMODSTUDIO *)mCurrentBufferp; - if (!bufferp) - { - // We don't have a buffer associated with us (should really have been picked up - // by the above if. - return; - } - - if (mCurrentSourcep->isForcedPriority()) - { - // Prioritized UI and preview sounds don't need to do any positional updates. - set3DMode(false); - } - else - { - // Localized sound. Update the position and velocity of the sound. - set3DMode(true); - - LLVector3 float_pos; - float_pos.setVec(mCurrentSourcep->getPositionGlobal()); - FMOD_RESULT result = mChannelp->set3DAttributes((FMOD_VECTOR*)float_pos.mV, (FMOD_VECTOR*)mCurrentSourcep->getVelocity().mV); - Check_FMOD_Error(result, "FMOD::Channel::set3DAttributes"); - } -} - - -void LLAudioChannelFMODSTUDIO::updateLoop() -{ - if (!mChannelp) - { - // May want to clear up the loop/sample counters. - return; - } - - // - // Hack: We keep track of whether we looped or not by seeing when the - // sample position looks like it's going backwards. Not reliable; may - // yield false negatives. - // - U32 cur_pos; - mChannelp->getPosition(&cur_pos, FMOD_TIMEUNIT_PCMBYTES); - - if (cur_pos < (U32)mLastSamplePos) - { - mLoopedThisFrame = true; - } - mLastSamplePos = cur_pos; -} - - -void LLAudioChannelFMODSTUDIO::cleanup() -{ - if (!mChannelp) - { - // Aborting cleanup with no channel handle. - return; - } - - //Cleaning up channel mChannelID - Check_FMOD_Error(mChannelp->stop(), "FMOD::Channel::stop"); - - mCurrentBufferp = NULL; - mChannelp = NULL; -} - - -void LLAudioChannelFMODSTUDIO::play() -{ - if (!mChannelp) - { - LL_WARNS() << "Playing without a channel handle, aborting" << LL_ENDL; - return; - } - - Check_FMOD_Error(mChannelp->setPaused(false), "FMOD::Channel::pause"); - - getSource()->setPlayedOnce(true); - - if (LLAudioEngine_FMODSTUDIO::mChannelGroups[getSource()->getType()]) - mChannelp->setChannelGroup(LLAudioEngine_FMODSTUDIO::mChannelGroups[getSource()->getType()]); -} - - -void LLAudioChannelFMODSTUDIO::playSynced(LLAudioChannel *channelp) -{ - LLAudioChannelFMODSTUDIO *fmod_channelp = (LLAudioChannelFMODSTUDIO*)channelp; - if (!(fmod_channelp->mChannelp && mChannelp)) - { - // Don't have channels allocated to both the master and the slave - return; - } - - U32 cur_pos; - if (Check_FMOD_Error(mChannelp->getPosition(&cur_pos, FMOD_TIMEUNIT_PCMBYTES), "Unable to retrieve current position")) - return; - - cur_pos %= mCurrentBufferp->getLength(); - - // Try to match the position of our sync master - Check_FMOD_Error(mChannelp->setPosition(cur_pos, FMOD_TIMEUNIT_PCMBYTES), "Unable to set current position"); - - // Start us playing - play(); -} - - -bool LLAudioChannelFMODSTUDIO::isPlaying() -{ - if (!mChannelp) - { - return false; - } - - bool paused, playing; - mChannelp->getPaused(&paused); - mChannelp->isPlaying(&playing); - return !paused && playing; -} - - -// -// LLAudioChannelFMODSTUDIO implementation -// - - -LLAudioBufferFMODSTUDIO::LLAudioBufferFMODSTUDIO(FMOD::System *system) : mSystemp(system), mSoundp(NULL) -{ -} - - -LLAudioBufferFMODSTUDIO::~LLAudioBufferFMODSTUDIO() -{ - if (mSoundp) - { - mSoundp->release(); - mSoundp = NULL; - } -} - - -bool LLAudioBufferFMODSTUDIO::loadWAV(const std::string& filename) -{ - // Try to open a wav file from disk. This will eventually go away, as we don't - // really want to block doing this. - if (filename.empty()) - { - // invalid filename, abort. - return false; - } - - if (!gDirUtilp->fileExists(filename)) - { - // File not found, abort. - return false; - } - - if (mSoundp) - { - // If there's already something loaded in this buffer, clean it up. - mSoundp->release(); - mSoundp = NULL; - } - - FMOD_MODE base_mode = FMOD_LOOP_NORMAL; - FMOD_CREATESOUNDEXINFO exinfo; - memset(&exinfo, 0, sizeof(exinfo)); - exinfo.cbsize = sizeof(exinfo); - exinfo.suggestedsoundtype = FMOD_SOUND_TYPE_WAV; //Hint to speed up loading. - // Load up the wav file into an fmod sample (since 1.05 fmod studio expects everything in UTF-8) - FMOD_RESULT result = getSystem()->createSound(filename.c_str(), base_mode, &exinfo, &mSoundp); - - if (result != FMOD_OK) - { - // We failed to load the file for some reason. - LL_WARNS() << "Could not load data '" << filename << "': " << FMOD_ErrorString(result) << LL_ENDL; - - // - // If we EVER want to load wav files provided by end users, we need - // to rethink this! - // - // file is probably corrupt - remove it. - LLFile::remove(filename); - return false; - } - - // Everything went well, return true - return true; -} - - -U32 LLAudioBufferFMODSTUDIO::getLength() -{ - if (!mSoundp) - { - return 0; - } - - U32 length; - mSoundp->getLength(&length, FMOD_TIMEUNIT_PCMBYTES); - return length; -} - - -void LLAudioChannelFMODSTUDIO::set3DMode(bool use3d) -{ - FMOD_MODE current_mode; - if (mChannelp->getMode(¤t_mode) != FMOD_OK) - return; - FMOD_MODE new_mode = current_mode; - new_mode &= ~(use3d ? FMOD_2D : FMOD_3D); - new_mode |= use3d ? FMOD_3D : FMOD_2D; - - if (current_mode != new_mode) - { - mChannelp->setMode(new_mode); - } -} - -// *NOTE: This is almost certainly being called on the mixer thread, -// not the main thread. May have implications for callees or audio -// engine shutdown. - -FMOD_RESULT F_CALLBACK windCallback(FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, unsigned int length, int inchannels, int *outchannels) -{ - // inbuffer = fmod's original mixbuffer. - // outbuffer = the buffer passed from the previous DSP unit. - // length = length in samples at this mix time. - - LLWindGen<LLAudioEngine_FMODSTUDIO::MIXBUFFERFORMAT> *windgen = NULL; - FMOD::DSP *thisdsp = (FMOD::DSP *)dsp_state->instance; - - thisdsp->getUserData((void **)&windgen); - - if (windgen) - { - windgen->windGenerate((LLAudioEngine_FMODSTUDIO::MIXBUFFERFORMAT *)outbuffer, length); - } - - return FMOD_OK; -} diff --git a/indra/llaudio/llaudioengine_fmodstudio.h b/indra/llaudio/llaudioengine_fmodstudio.h deleted file mode 100644 index eb346e0466..0000000000 --- a/indra/llaudio/llaudioengine_fmodstudio.h +++ /dev/null @@ -1,131 +0,0 @@ -/** - * @file audioengine_fmodstudio.h - * @brief Definition of LLAudioEngine class abstracting the audio - * support as a FMODSTUDIO implementation - * - * $LicenseInfo:firstyear=2020&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2020, 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_AUDIOENGINE_FMODSTUDIO_H -#define LL_AUDIOENGINE_FMODSTUDIO_H - -#include "llaudioengine.h" -#include "llwindgen.h" - -//Stubs -class LLAudioStreamManagerFMODSTUDIO; -namespace FMOD -{ - class System; - class Channel; - class ChannelGroup; - class Sound; - class DSP; -} -typedef struct FMOD_DSP_DESCRIPTION FMOD_DSP_DESCRIPTION; - -//Interfaces -class LLAudioEngine_FMODSTUDIO : public LLAudioEngine -{ -public: - LLAudioEngine_FMODSTUDIO(bool enable_profiler); - virtual ~LLAudioEngine_FMODSTUDIO(); - - // initialization/startup/shutdown - virtual bool init(void *user_data, const std::string &app_title); - virtual std::string getDriverName(bool verbose); - virtual LLStreamingAudioInterface* createDefaultStreamingAudioImpl() const; - virtual void allocateListener(); - - virtual void shutdown(); - - /*virtual*/ bool initWind(); - /*virtual*/ void cleanupWind(); - - /*virtual*/void updateWind(LLVector3 direction, F32 camera_height_above_water); - - typedef F32 MIXBUFFERFORMAT; - - FMOD::System *getSystem() const {return mSystem;} -protected: - /*virtual*/ LLAudioBuffer *createBuffer(); // Get a free buffer, or flush an existing one if you have to. - /*virtual*/ LLAudioChannel *createChannel(); // Create a new audio channel. - - /*virtual*/ void setInternalGain(F32 gain); - - bool mInited; - - LLWindGen<MIXBUFFERFORMAT> *mWindGen; - - FMOD_DSP_DESCRIPTION *mWindDSPDesc; - FMOD::DSP *mWindDSP; - FMOD::System *mSystem; - bool mEnableProfiler; - -public: - static FMOD::ChannelGroup *mChannelGroups[LLAudioEngine::AUDIO_TYPE_COUNT]; -}; - - -class LLAudioChannelFMODSTUDIO : public LLAudioChannel -{ -public: - LLAudioChannelFMODSTUDIO(FMOD::System *audioengine); - virtual ~LLAudioChannelFMODSTUDIO(); - -protected: - /*virtual*/ void play(); - /*virtual*/ void playSynced(LLAudioChannel *channelp); - /*virtual*/ void cleanup(); - /*virtual*/ bool isPlaying(); - - /*virtual*/ bool updateBuffer(); - /*virtual*/ void update3DPosition(); - /*virtual*/ void updateLoop(); - - void set3DMode(bool use3d); -protected: - FMOD::System *getSystem() const {return mSystemp;} - FMOD::System *mSystemp; - FMOD::Channel *mChannelp; - S32 mLastSamplePos; -}; - - -class LLAudioBufferFMODSTUDIO : public LLAudioBuffer -{ -public: - LLAudioBufferFMODSTUDIO(FMOD::System *audioengine); - virtual ~LLAudioBufferFMODSTUDIO(); - - /*virtual*/ bool loadWAV(const std::string& filename); - /*virtual*/ U32 getLength(); - friend class LLAudioChannelFMODSTUDIO; -protected: - FMOD::System *getSystem() const {return mSystemp;} - FMOD::System *mSystemp; - FMOD::Sound *getSound() const{ return mSoundp; } - FMOD::Sound *mSoundp; -}; - - -#endif // LL_AUDIOENGINE_FMODSTUDIO_H diff --git a/indra/llaudio/llaudioengine_openal.cpp b/indra/llaudio/llaudioengine_openal.cpp index 1c4c67e6f6..18d682b554 100644 --- a/indra/llaudio/llaudioengine_openal.cpp +++ b/indra/llaudio/llaudioengine_openal.cpp @@ -135,10 +135,19 @@ void LLAudioEngine_OpenAL::shutdown() LL_INFOS() << "About to LLAudioEngine::shutdown()" << LL_ENDL; LLAudioEngine::shutdown(); + // If a subsequent error occurs while there is still an error recorded + // internally, the second error will simply be ignored. + // Clear previous error to make sure we will captuare a valid failure reason + ALenum error = alutGetError(); + if (error != ALUT_ERROR_NO_ERROR) + { + LL_WARNS() << "Uncleared error state prior to shutdown: " + << alutGetErrorString(error) << LL_ENDL; + } + LL_INFOS() << "About to alutExit()" << LL_ENDL; if(!alutExit()) { - LL_WARNS() << "Nuts." << LL_ENDL; LL_WARNS() << "LLAudioEngine_OpenAL::shutdown() ALUT shutdown failed: " << alutGetErrorString (alutGetError ()) << LL_ENDL; } @@ -518,7 +527,7 @@ void LLAudioEngine_OpenAL::updateWind(LLVector3 wind_vec, F32 camera_altitude) } alBufferData(buffer, - AL_FORMAT_STEREO16, + AL_FORMAT_STEREO_FLOAT32, mWindGen->windGenerate(mWindBuf, mWindBufSamples), mWindBufBytes, diff --git a/indra/llaudio/llaudioengine_openal.h b/indra/llaudio/llaudioengine_openal.h index 9aadc84ddf..574bec416d 100644 --- a/indra/llaudio/llaudioengine_openal.h +++ b/indra/llaudio/llaudioengine_openal.h @@ -57,9 +57,9 @@ class LLAudioEngine_OpenAL : public LLAudioEngine /*virtual*/ void updateWind(LLVector3 direction, F32 camera_altitude); private: - typedef S16 WIND_SAMPLE_T; + typedef F32 WIND_SAMPLE_T; LLWindGen<WIND_SAMPLE_T> *mWindGen; - S16 *mWindBuf; + F32 *mWindBuf; U32 mWindBufFreq; U32 mWindBufSamples; U32 mWindBufBytes; diff --git a/indra/llaudio/lllistener_fmodstudio.cpp b/indra/llaudio/lllistener_fmodstudio.cpp deleted file mode 100644 index 9dc55eec79..0000000000 --- a/indra/llaudio/lllistener_fmodstudio.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/** - * @file listener_fmodstudio.cpp - * @brief Implementation of LISTENER class abstracting the audio - * support as a FMODSTUDIO implementation - * - * $LicenseInfo:firstyear=2020&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2020, 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 "llaudioengine.h" -#include "lllistener_fmodstudio.h" -#include "fmodstudio/fmod.hpp" - -//----------------------------------------------------------------------- -// constructor -//----------------------------------------------------------------------- -LLListener_FMODSTUDIO::LLListener_FMODSTUDIO(FMOD::System *system) -{ - mSystem = system; - init(); -} - -//----------------------------------------------------------------------- -LLListener_FMODSTUDIO::~LLListener_FMODSTUDIO() -{ -} - -//----------------------------------------------------------------------- -void LLListener_FMODSTUDIO::init(void) -{ - // do inherited - LLListener::init(); - mDopplerFactor = 1.0f; - mRolloffFactor = 1.0f; -} - -//----------------------------------------------------------------------- -void LLListener_FMODSTUDIO::translate(LLVector3 offset) -{ - LLListener::translate(offset); - - mSystem->set3DListenerAttributes(0, (FMOD_VECTOR*)mPosition.mV, NULL, (FMOD_VECTOR*)mListenAt.mV, (FMOD_VECTOR*)mListenUp.mV); -} - -//----------------------------------------------------------------------- -void LLListener_FMODSTUDIO::setPosition(LLVector3 pos) -{ - LLListener::setPosition(pos); - - mSystem->set3DListenerAttributes(0, (FMOD_VECTOR*)mPosition.mV, NULL, (FMOD_VECTOR*)mListenAt.mV, (FMOD_VECTOR*)mListenUp.mV); -} - -//----------------------------------------------------------------------- -void LLListener_FMODSTUDIO::setVelocity(LLVector3 vel) -{ - LLListener::setVelocity(vel); - - mSystem->set3DListenerAttributes(0, NULL, (FMOD_VECTOR*)mVelocity.mV, (FMOD_VECTOR*)mListenAt.mV, (FMOD_VECTOR*)mListenUp.mV); -} - -//----------------------------------------------------------------------- -void LLListener_FMODSTUDIO::orient(LLVector3 up, LLVector3 at) -{ - LLListener::orient(up, at); - - // at = -at; by default Fmod studio is 'left-handed' but we are providing - // flag FMOD_INIT_3D_RIGHTHANDED so no correction are needed - - mSystem->set3DListenerAttributes(0, NULL, NULL, (FMOD_VECTOR*)at.mV, (FMOD_VECTOR*)up.mV); -} - -//----------------------------------------------------------------------- -void LLListener_FMODSTUDIO::commitDeferredChanges() -{ - if (!mSystem) - { - return; - } - - mSystem->update(); -} - - -void LLListener_FMODSTUDIO::setRolloffFactor(F32 factor) -{ - //An internal FMOD optimization skips 3D updates if there have not been changes to the 3D sound environment. - // (this was true for FMODex, looks to be still true for FMOD STUDIO, but needs a recheck) - //Sadly, a change in rolloff is not accounted for, thus we must touch the listener properties as well. - //In short: Changing the position ticks a dirtyflag inside fmod, which makes it not skip 3D processing next update call. - if (mRolloffFactor != factor) - { - LLVector3 pos = mPosition - LLVector3(0.f, 0.f, .1f); - mSystem->set3DListenerAttributes(0, (FMOD_VECTOR*)pos.mV, NULL, NULL, NULL); - mSystem->set3DListenerAttributes(0, (FMOD_VECTOR*)mPosition.mV, NULL, NULL, NULL); - } - mRolloffFactor = factor; - mSystem->set3DSettings(mDopplerFactor, 1.f, mRolloffFactor); -} - - -F32 LLListener_FMODSTUDIO::getRolloffFactor() -{ - return mRolloffFactor; -} - - -void LLListener_FMODSTUDIO::setDopplerFactor(F32 factor) -{ - mDopplerFactor = factor; - mSystem->set3DSettings(mDopplerFactor, 1.f, mRolloffFactor); -} - - -F32 LLListener_FMODSTUDIO::getDopplerFactor() -{ - return mDopplerFactor; -} diff --git a/indra/llaudio/lllistener_fmodstudio.h b/indra/llaudio/lllistener_fmodstudio.h deleted file mode 100644 index 5287cbedc6..0000000000 --- a/indra/llaudio/lllistener_fmodstudio.h +++ /dev/null @@ -1,65 +0,0 @@ -/** - * @file listener_fmodstudio.h - * @brief Description of LISTENER class abstracting the audio support - * as an FMOD 3D implementation - * - * $LicenseInfo:firstyear=2020&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2020, 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_LISTENER_FMODSTUDIO_H -#define LL_LISTENER_FMODSTUDIO_H - -#include "lllistener.h" - -//Stubs -namespace FMOD -{ - class System; -} - -//Interfaces -class LLListener_FMODSTUDIO : public LLListener -{ -public: - LLListener_FMODSTUDIO(FMOD::System *system); - virtual ~LLListener_FMODSTUDIO(); - virtual void init(); - - virtual void translate(LLVector3 offset); - virtual void setPosition(LLVector3 pos); - virtual void setVelocity(LLVector3 vel); - virtual void orient(LLVector3 up, LLVector3 at); - virtual void commitDeferredChanges(); - - virtual void setDopplerFactor(F32 factor); - virtual F32 getDopplerFactor(); - virtual void setRolloffFactor(F32 factor); - virtual F32 getRolloffFactor(); -protected: - FMOD::System *mSystem; - F32 mDopplerFactor; - F32 mRolloffFactor; -}; - -#endif - - diff --git a/indra/llaudio/lllistener_openal.h b/indra/llaudio/lllistener_openal.h index a877270201..f1b69ddcef 100644 --- a/indra/llaudio/lllistener_openal.h +++ b/indra/llaudio/lllistener_openal.h @@ -32,6 +32,7 @@ #include "AL/al.h" #include "AL/alut.h" +#include "AL/alext.h" class LLListener_OpenAL : public LLListener { diff --git a/indra/llaudio/llstreamingaudio_fmodstudio.cpp b/indra/llaudio/llstreamingaudio_fmodstudio.cpp deleted file mode 100644 index 22fc86c0cd..0000000000 --- a/indra/llaudio/llstreamingaudio_fmodstudio.cpp +++ /dev/null @@ -1,481 +0,0 @@ -/** - * @file streamingaudio_fmodstudio.cpp - * @brief LLStreamingAudio_FMODSTUDIO implementation - * - * $LicenseInfo:firstyear=2020&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2020, 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 "llmath.h" - -#include "fmodstudio/fmod.hpp" -#include "fmodstudio/fmod_errors.h" - -#include "llstreamingaudio_fmodstudio.h" - - -class LLAudioStreamManagerFMODSTUDIO -{ -public: - LLAudioStreamManagerFMODSTUDIO(FMOD::System *system, const std::string& url); - FMOD::Channel* startStream(); - bool stopStream(); // Returns true if the stream was successfully stopped. - bool ready(); - - const std::string& getURL() { return mInternetStreamURL; } - - FMOD_OPENSTATE getOpenState(unsigned int* percentbuffered = NULL, bool* starving = NULL, bool* diskbusy = NULL); -protected: - FMOD::System* mSystem; - FMOD::Channel* mStreamChannel; - FMOD::Sound* mInternetStream; - bool mReady; - - std::string mInternetStreamURL; -}; - - - -//--------------------------------------------------------------------------- -// Internet Streaming -//--------------------------------------------------------------------------- -LLStreamingAudio_FMODSTUDIO::LLStreamingAudio_FMODSTUDIO(FMOD::System *system) : -mSystem(system), -mCurrentInternetStreamp(NULL), -mFMODInternetStreamChannelp(NULL), -mGain(1.0f), -mRetryCount(0) -{ - // Number of milliseconds of audio to buffer for the audio card. - // Must be larger than the usual Second Life frame stutter time. - const U32 buffer_seconds = 10; //sec - const U32 estimated_bitrate = 128; //kbit/sec - FMOD_RESULT result = mSystem->setStreamBufferSize(estimated_bitrate * buffer_seconds * 128/*bytes/kbit*/, FMOD_TIMEUNIT_RAWBYTES); - if (result != FMOD_OK) - { - LL_WARNS("FMOD") << "setStreamBufferSize error: " << FMOD_ErrorString(result) << LL_ENDL; - } - - // Here's where we set the size of the network buffer and some buffering - // parameters. In this case we want a network buffer of 16k, we want it - // to prebuffer 40% of that when we first connect, and we want it - // to rebuffer 80% of that whenever we encounter a buffer underrun. - - // Leave the net buffer properties at the default. - //FSOUND_Stream_Net_SetBufferProperties(20000, 40, 80); -} - - -LLStreamingAudio_FMODSTUDIO::~LLStreamingAudio_FMODSTUDIO() -{ - if (mCurrentInternetStreamp) - { - // Isn't supposed to hapen, stream should be clear by now, - // and if it does, we are likely going to crash. - LL_WARNS("FMOD") << "mCurrentInternetStreamp not null on shutdown!" << LL_ENDL; - stop(); - } - - // Kill dead internet streams, if possible - killDeadStreams(); - - if (!mDeadStreams.empty()) - { - // LLStreamingAudio_FMODSTUDIO was inited on startup - // and should be destroyed on shutdown, it should - // wait for streams to die to not cause crashes or - // leaks. - // Ideally we need to wait on some kind of callback - // to release() streams correctly, but 200 ms should - // be enough and we can't wait forever. - LL_INFOS("FMOD") << "Waiting for " << (S32)mDeadStreams.size() << " streams to stop" << LL_ENDL; - for (S32 i = 0; i < 20; i++) - { - const U32 ms_delay = 10; - ms_sleep(ms_delay); // rude, but not many options here - killDeadStreams(); - if (mDeadStreams.empty()) - { - LL_INFOS("FMOD") << "All streams stopped after " << (S32)((i + 1) * ms_delay) << "ms" << LL_ENDL; - break; - } - } - } - - if (!mDeadStreams.empty()) - { - LL_WARNS("FMOD") << "Failed to kill some audio streams" << LL_ENDL; - } -} - -void LLStreamingAudio_FMODSTUDIO::killDeadStreams() -{ - std::list<LLAudioStreamManagerFMODSTUDIO *>::iterator iter; - for (iter = mDeadStreams.begin(); iter != mDeadStreams.end();) - { - LLAudioStreamManagerFMODSTUDIO *streamp = *iter; - if (streamp->stopStream()) - { - LL_INFOS("FMOD") << "Closed dead stream" << LL_ENDL; - delete streamp; - iter = mDeadStreams.erase(iter); - } - else - { - iter++; - } - } -} - -void LLStreamingAudio_FMODSTUDIO::start(const std::string& url) -{ - //if (!mInited) - //{ - // LL_WARNS() << "startInternetStream before audio initialized" << LL_ENDL; - // return; - //} - - // "stop" stream but don't clear url, etc. in case url == mInternetStreamURL - stop(); - - if (!url.empty()) - { - LL_INFOS("FMOD") << "Starting internet stream: " << url << LL_ENDL; - mCurrentInternetStreamp = new LLAudioStreamManagerFMODSTUDIO(mSystem, url); - mURL = url; - } - else - { - LL_INFOS("FMOD") << "Set internet stream to null" << LL_ENDL; - mURL.clear(); - } - - mRetryCount = 0; -} - - -void LLStreamingAudio_FMODSTUDIO::update() -{ - // Kill dead internet streams, if possible - killDeadStreams(); - - // Don't do anything if there are no streams playing - if (!mCurrentInternetStreamp) - { - return; - } - - unsigned int progress; - bool starving; - bool diskbusy; - FMOD_OPENSTATE open_state = mCurrentInternetStreamp->getOpenState(&progress, &starving, &diskbusy); - - if (open_state == FMOD_OPENSTATE_READY) - { - // Stream is live - - // start the stream if it's ready - if (!mFMODInternetStreamChannelp && - (mFMODInternetStreamChannelp = mCurrentInternetStreamp->startStream())) - { - // Reset volume to previously set volume - setGain(getGain()); - mFMODInternetStreamChannelp->setPaused(false); - } - mRetryCount = 0; - } - else if (open_state == FMOD_OPENSTATE_ERROR) - { - LL_INFOS("FMOD") << "State: FMOD_OPENSTATE_ERROR" - << " Progress: " << U32(progress) - << " Starving: " << S32(starving) - << " Diskbusy: " << S32(diskbusy) << LL_ENDL; - if (mRetryCount < 2) - { - // Retry - std::string url = mURL; - stop(); // might drop mURL, drops mCurrentInternetStreamp - - mRetryCount++; - - if (!url.empty()) - { - LL_INFOS("FMOD") << "Restarting internet stream: " << url << ", attempt " << (mRetryCount + 1) << LL_ENDL; - mCurrentInternetStreamp = new LLAudioStreamManagerFMODSTUDIO(mSystem, url); - mURL = url; - } - } - else - { - stop(); - } - return; - } - - if (mFMODInternetStreamChannelp) - { - FMOD::Sound *sound = NULL; - - if (mFMODInternetStreamChannelp->getCurrentSound(&sound) == FMOD_OK && sound) - { - FMOD_TAG tag; - S32 tagcount, dirtytagcount; - - if (sound->getNumTags(&tagcount, &dirtytagcount) == FMOD_OK && dirtytagcount) - { - for (S32 i = 0; i < tagcount; ++i) - { - if (sound->getTag(NULL, i, &tag) != FMOD_OK) - continue; - - if (tag.type == FMOD_TAGTYPE_FMOD) - { - if (!strcmp(tag.name, "Sample Rate Change")) - { - LL_INFOS("FMOD") << "Stream forced changing sample rate to " << *((float *)tag.data) << LL_ENDL; - mFMODInternetStreamChannelp->setFrequency(*((float *)tag.data)); - } - continue; - } - } - } - - if (starving) - { - bool paused = false; - mFMODInternetStreamChannelp->getPaused(&paused); - if (!paused) - { - LL_INFOS("FMOD") << "Stream starvation detected! Pausing stream until buffer nearly full." << LL_ENDL; - LL_INFOS("FMOD") << " (diskbusy=" << diskbusy << ")" << LL_ENDL; - LL_INFOS("FMOD") << " (progress=" << progress << ")" << LL_ENDL; - mFMODInternetStreamChannelp->setPaused(true); - } - } - else if (progress > 80) - { - mFMODInternetStreamChannelp->setPaused(false); - } - } - } -} - -void LLStreamingAudio_FMODSTUDIO::stop() -{ - if (mFMODInternetStreamChannelp) - { - mFMODInternetStreamChannelp->setPaused(true); - mFMODInternetStreamChannelp->setPriority(0); - mFMODInternetStreamChannelp = NULL; - } - - if (mCurrentInternetStreamp) - { - LL_INFOS("FMOD") << "Stopping internet stream: " << mCurrentInternetStreamp->getURL() << LL_ENDL; - if (mCurrentInternetStreamp->stopStream()) - { - delete mCurrentInternetStreamp; - } - else - { - LL_WARNS("FMOD") << "Pushing stream to dead list: " << mCurrentInternetStreamp->getURL() << LL_ENDL; - mDeadStreams.push_back(mCurrentInternetStreamp); - } - mCurrentInternetStreamp = NULL; - //mURL.clear(); - } -} - -void LLStreamingAudio_FMODSTUDIO::pause(int pauseopt) -{ - if (pauseopt < 0) - { - pauseopt = mCurrentInternetStreamp ? 1 : 0; - } - - if (pauseopt) - { - if (mCurrentInternetStreamp) - { - LL_INFOS("FMOD") << "Pausing internet stream" << LL_ENDL; - stop(); - } - } - else - { - start(getURL()); - } -} - - -// A stream is "playing" if it has been requested to start. That -// doesn't necessarily mean audio is coming out of the speakers. -int LLStreamingAudio_FMODSTUDIO::isPlaying() -{ - if (mCurrentInternetStreamp) - { - return 1; // Active and playing - } - else if (!mURL.empty()) - { - return 2; // "Paused" - } - else - { - return 0; - } -} - - -F32 LLStreamingAudio_FMODSTUDIO::getGain() -{ - return mGain; -} - - -std::string LLStreamingAudio_FMODSTUDIO::getURL() -{ - return mURL; -} - - -void LLStreamingAudio_FMODSTUDIO::setGain(F32 vol) -{ - mGain = vol; - - if (mFMODInternetStreamChannelp) - { - vol = llclamp(vol * vol, 0.f, 1.f); //should vol be squared here? - - mFMODInternetStreamChannelp->setVolume(vol); - } -} - -/////////////////////////////////////////////////////// -// manager of possibly-multiple internet audio streams - -LLAudioStreamManagerFMODSTUDIO::LLAudioStreamManagerFMODSTUDIO(FMOD::System *system, const std::string& url) : -mSystem(system), -mStreamChannel(NULL), -mInternetStream(NULL), -mReady(false) -{ - mInternetStreamURL = url; - - FMOD_RESULT result = mSystem->createStream(url.c_str(), FMOD_2D | FMOD_NONBLOCKING | FMOD_IGNORETAGS, 0, &mInternetStream); - - if (result != FMOD_OK) - { - LL_WARNS("FMOD") << "Couldn't open fmod stream, error " - << FMOD_ErrorString(result) - << LL_ENDL; - mReady = false; - return; - } - - mReady = true; -} - -FMOD::Channel *LLAudioStreamManagerFMODSTUDIO::startStream() -{ - // We need a live and opened stream before we try and play it. - if (!mInternetStream || getOpenState() != FMOD_OPENSTATE_READY) - { - LL_WARNS("FMOD") << "No internet stream to start playing!" << LL_ENDL; - return NULL; - } - - if (mStreamChannel) - return mStreamChannel; //Already have a channel for this stream. - - FMOD_RESULT result = mSystem->playSound(mInternetStream, NULL, true, &mStreamChannel); - if (result != FMOD_OK) - { - LL_WARNS("FMOD") << FMOD_ErrorString(result) << LL_ENDL; - } - return mStreamChannel; -} - -bool LLAudioStreamManagerFMODSTUDIO::stopStream() -{ - if (mInternetStream) - { - - - bool close = true; - switch (getOpenState()) - { - case FMOD_OPENSTATE_CONNECTING: - close = false; - break; - default: - close = true; - } - - if (close) - { - mInternetStream->release(); - mStreamChannel = NULL; - mInternetStream = NULL; - return true; - } - else - { - return false; - } - } - else - { - return true; - } -} - -FMOD_OPENSTATE LLAudioStreamManagerFMODSTUDIO::getOpenState(unsigned int* percentbuffered, bool* starving, bool* diskbusy) -{ - FMOD_OPENSTATE state; - FMOD_RESULT result = mInternetStream->getOpenState(&state, percentbuffered, starving, diskbusy); - if (result != FMOD_OK) - { - LL_WARNS("FMOD") << FMOD_ErrorString(result) << LL_ENDL; - } - return state; -} - -void LLStreamingAudio_FMODSTUDIO::setBufferSizes(U32 streambuffertime, U32 decodebuffertime) -{ - FMOD_RESULT result = mSystem->setStreamBufferSize(streambuffertime / 1000 * 128 * 128, FMOD_TIMEUNIT_RAWBYTES); - if (result != FMOD_OK) - { - LL_WARNS("FMOD") << "setStreamBufferSize error: " << FMOD_ErrorString(result) << LL_ENDL; - return; - } - FMOD_ADVANCEDSETTINGS settings; - memset(&settings, 0, sizeof(settings)); - settings.cbSize = sizeof(settings); - settings.defaultDecodeBufferSize = decodebuffertime;//ms - result = mSystem->setAdvancedSettings(&settings); - if (result != FMOD_OK) - { - LL_WARNS("FMOD") << "setAdvancedSettings error: " << FMOD_ErrorString(result) << LL_ENDL; - } -} diff --git a/indra/llaudio/llstreamingaudio_fmodstudio.h b/indra/llaudio/llstreamingaudio_fmodstudio.h deleted file mode 100644 index 2127841809..0000000000 --- a/indra/llaudio/llstreamingaudio_fmodstudio.h +++ /dev/null @@ -1,76 +0,0 @@ -/** - * @file streamingaudio_fmodstudio.h - * @brief Definition of LLStreamingAudio_FMODSTUDIO implementation - * - * $LicenseInfo:firstyear=2020&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2020, 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_STREAMINGAUDIO_FMODSTUDIO_H -#define LL_STREAMINGAUDIO_FMODSTUDIO_H - -#include "stdtypes.h" // from llcommon - -#include "llstreamingaudio.h" -#include "lltimer.h" - -//Stubs -class LLAudioStreamManagerFMODSTUDIO; -namespace FMOD -{ - class System; - class Channel; -} - -//Interfaces -class LLStreamingAudio_FMODSTUDIO : public LLStreamingAudioInterface -{ -public: - LLStreamingAudio_FMODSTUDIO(FMOD::System *system); - /*virtual*/ ~LLStreamingAudio_FMODSTUDIO(); - - /*virtual*/ void start(const std::string& url); - /*virtual*/ void stop(); - /*virtual*/ void pause(S32 pause); - /*virtual*/ void update(); - /*virtual*/ S32 isPlaying(); - /*virtual*/ void setGain(F32 vol); - /*virtual*/ F32 getGain(); - /*virtual*/ std::string getURL(); - - /*virtual*/ bool supportsAdjustableBufferSizes(){return true;} - /*virtual*/ void setBufferSizes(U32 streambuffertime, U32 decodebuffertime); -private: - void killDeadStreams(); - - FMOD::System *mSystem; - - LLAudioStreamManagerFMODSTUDIO *mCurrentInternetStreamp; - FMOD::Channel *mFMODInternetStreamChannelp; - std::list<LLAudioStreamManagerFMODSTUDIO *> mDeadStreams; - - std::string mURL; - F32 mGain; - S32 mRetryCount; -}; - - -#endif // LL_STREAMINGAUDIO_FMODSTUDIO_H diff --git a/indra/llaudio/llvorbisencode.cpp b/indra/llaudio/llvorbisencode.cpp index 573c947764..83e7fad92f 100644 --- a/indra/llaudio/llvorbisencode.cpp +++ b/indra/llaudio/llvorbisencode.cpp @@ -75,7 +75,7 @@ S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& erro U32 chunk_length = 0; U32 raw_data_length = 0; U32 bytes_per_sec = 0; - BOOL uncompressed_pcm = FALSE; + bool uncompressed_pcm = false; unsigned char wav_header[44]; /*Flawfinder: ignore*/ @@ -133,7 +133,7 @@ S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& erro { if ((wav_header[8] == 0x01) && (wav_header[9] == 0x00)) { - uncompressed_pcm = TRUE; + uncompressed_pcm = true; } num_channels = ((U16) wav_header[11] << 8) + wav_header[10]; sample_rate = ((U32) wav_header[15] << 24) diff --git a/indra/llcharacter/llanimationstates.cpp b/indra/llcharacter/llanimationstates.cpp index b44dccbe6c..7710589b06 100644 --- a/indra/llcharacter/llanimationstates.cpp +++ b/indra/llcharacter/llanimationstates.cpp @@ -367,7 +367,7 @@ const char *LLAnimationLibrary::animStateToString( const LLUUID& state ) //----------------------------------------------------------------------------- // Return the animation state for a given name //----------------------------------------------------------------------------- -LLUUID LLAnimationLibrary::stringToAnimState( const std::string& name, BOOL allow_ids ) +LLUUID LLAnimationLibrary::stringToAnimState( const std::string& name, bool allow_ids ) { std::string lower_case_name(name); LLStringUtil::toLower(lower_case_name); @@ -391,7 +391,7 @@ LLUUID LLAnimationLibrary::stringToAnimState( const std::string& name, BOOL allo else if (allow_ids) { // try to convert string to LLUUID - id.set(name, FALSE); + id.set(name, false); } return id; diff --git a/indra/llcharacter/llanimationstates.h b/indra/llcharacter/llanimationstates.h index 70134c12ab..85232b6612 100644 --- a/indra/llcharacter/llanimationstates.h +++ b/indra/llcharacter/llanimationstates.h @@ -220,7 +220,7 @@ public: // Return the animation state for the given name. // Retun NULL if the name is invalid. //----------------------------------------------------------------------------- - LLUUID stringToAnimState( const std::string& name, BOOL allow_ids = TRUE ); + LLUUID stringToAnimState( const std::string& name, bool allow_ids = true ); //----------------------------------------------------------------------------- // Associate an anim state with a name diff --git a/indra/llcharacter/llbvhloader.cpp b/indra/llcharacter/llbvhloader.cpp index 3aa2c86aad..9dace08e6f 100644 --- a/indra/llcharacter/llbvhloader.cpp +++ b/indra/llcharacter/llbvhloader.cpp @@ -184,7 +184,7 @@ LLBVHLoader::LLBVHLoader(const char* buffer, ELoadStatus &loadStatus, S32 &error LL_DEBUGS("BVH") << "After translations and optimize" << LL_ENDL; dumpBVHInfo(); - mInitialized = TRUE; + mInitialized = true; } @@ -227,7 +227,7 @@ ELoadStatus LLBVHLoader::loadTranslationTable(const char *fileName) //-------------------------------------------------------------------- // load data one line at a time //-------------------------------------------------------------------- - BOOL loadingGlobals = FALSE; + bool loadingGlobals = false; while ( getLine(fp) ) { //---------------------------------------------------------------- @@ -251,7 +251,7 @@ ELoadStatus LLBVHLoader::loadTranslationTable(const char *fileName) if (strcmp(name, "GLOBALS")==0) { - loadingGlobals = TRUE; + loadingGlobals = true; continue; } } @@ -298,7 +298,7 @@ ELoadStatus LLBVHLoader::loadTranslationTable(const char *fileName) if ( sscanf(mLine, " %*s = %f %f", &loop_in, &loop_out) == 2 ) { - mLoop = TRUE; + mLoop = true; } else if ( sscanf(mLine, " %*s = %127s", trueFalse) == 1 ) /* Flawfinder: ignore */ { @@ -496,8 +496,8 @@ void LLBVHLoader::makeTranslation(std::string alias_name, std::string joint_name if (joint_name == "mPelvis") { - newTrans.mRelativePositionKey = TRUE; - newTrans.mRelativeRotationKey = TRUE; + newTrans.mRelativePositionKey = true; + newTrans.mRelativeRotationKey = true; } } @@ -609,7 +609,7 @@ ELoadStatus LLBVHLoader::loadBVHFile(const char *buffer, char* error_text, S32 & //-------------------------------------------------------------------- // consume joints //-------------------------------------------------------------------- - while (TRUE) + while (true) { //---------------------------------------------------------------- // get next line @@ -969,7 +969,7 @@ void LLBVHLoader::applyTranslations() if ( trans.mIgnore ) { //LL_INFOS() << "NOTE: Ignoring " << joint->mName.c_str() << LL_ENDL; - joint->mIgnore = TRUE; + joint->mIgnore = true; continue; } @@ -983,10 +983,10 @@ void LLBVHLoader::applyTranslations() } //Allow joint position changes as of SL-318 - joint->mIgnorePositions = FALSE; + joint->mIgnorePositions = false; if (joint->mNumChannels == 3) { - joint->mIgnorePositions = TRUE; + joint->mIgnorePositions = true; } //---------------------------------------------------------------- @@ -995,13 +995,13 @@ void LLBVHLoader::applyTranslations() if ( trans.mRelativePositionKey ) { // LL_INFOS() << "NOTE: Removing 1st position offset from all keys for " << joint->mOutName.c_str() << LL_ENDL; - joint->mRelativePositionKey = TRUE; + joint->mRelativePositionKey = true; } if ( trans.mRelativeRotationKey ) { // LL_INFOS() << "NOTE: Removing 1st rotation from all keys for " << joint->mOutName.c_str() << LL_ENDL; - joint->mRelativeRotationKey = TRUE; + joint->mRelativeRotationKey = true; } if ( trans.mRelativePosition.magVec() > 0.0f ) @@ -1065,8 +1065,8 @@ void LLBVHLoader::optimize() for (Joint* joint : mJoints) { - BOOL pos_changed = FALSE; - BOOL rot_changed = FALSE; + bool pos_changed = false; + bool rot_changed = false; if ( ! joint->mIgnore ) { @@ -1079,7 +1079,7 @@ void LLBVHLoader::optimize() // no keys? if (first_key == joint->mKeys.end()) { - joint->mIgnore = TRUE; + joint->mIgnore = true; continue; } @@ -1092,13 +1092,13 @@ void LLBVHLoader::optimize() { // *FIX: use single frame to move pelvis // if only one keyframe force output for this joint - rot_changed = TRUE; + rot_changed = true; } else { // if more than one keyframe, use first frame as reference and skip to second - first_key->mIgnorePos = TRUE; - first_key->mIgnoreRot = TRUE; + first_key->mIgnorePos = true; + first_key->mIgnoreRot = true; ++ki; } @@ -1119,7 +1119,7 @@ void LLBVHLoader::optimize() joint->mNumPosKeys++; if (dist_vec_squared(LLVector3(ki_prev->mPos), first_frame_pos) > POSITION_MOTION_THRESHOLD_SQUARED) { - pos_changed = TRUE; + pos_changed = true; } } else @@ -1132,12 +1132,12 @@ void LLBVHLoader::optimize() if (dist_vec_squared(current_pos, first_frame_pos) > POSITION_MOTION_THRESHOLD_SQUARED) { - pos_changed = TRUE; + pos_changed = true; } if (dist_vec_squared(interp_pos, test_pos) < POSITION_KEYFRAME_THRESHOLD_SQUARED) { - ki_prev->mIgnorePos = TRUE; + ki_prev->mIgnorePos = true; numPosFramesConsidered++; } else @@ -1158,7 +1158,7 @@ void LLBVHLoader::optimize() if (rot_test > ROTATION_MOTION_THRESHOLD) { - rot_changed = TRUE; + rot_changed = true; } } else @@ -1180,7 +1180,7 @@ void LLBVHLoader::optimize() rot_test = x_delta + y_delta; if (rot_test > ROTATION_MOTION_THRESHOLD) { - rot_changed = TRUE; + rot_changed = true; } x_delta = dist_vec(LLVector3::x_axis * interp_rot, LLVector3::x_axis * test_rot); y_delta = dist_vec(LLVector3::y_axis * interp_rot, LLVector3::y_axis * test_rot); @@ -1202,9 +1202,9 @@ void LLBVHLoader::optimize() // because it's significantly faster. if (diff_max > 0) { - if (ki_max->mIgnoreRot == TRUE) + if (ki_max->mIgnoreRot) { - ki_max->mIgnoreRot = FALSE; + ki_max->mIgnoreRot = false; joint->mNumRotKeys++; } diff_max = 0; @@ -1213,7 +1213,7 @@ void LLBVHLoader::optimize() else { // This keyframe isn't significant enough, throw it away. - ki_prev->mIgnoreRot = TRUE; + ki_prev->mIgnoreRot = true; numRotFramesConsidered++; // Store away the keyframe that has the largest deviation from the interpolated line, for insertion later. if (rot_test > diff_max) @@ -1232,7 +1232,7 @@ void LLBVHLoader::optimize() if (!(pos_changed || rot_changed)) { //LL_INFOS() << "Ignoring joint " << joint->mName << LL_ENDL; - joint->mIgnore = TRUE; + joint->mIgnore = true; } } } @@ -1245,13 +1245,13 @@ void LLBVHLoader::reset() mDuration = 0.0f; mPriority = 2; - mLoop = FALSE; + mLoop = false; mLoopInPoint = 0.f; mLoopOutPoint = 0.f; mEaseIn = 0.3f; mEaseOut = 0.3f; mHand = 1; - mInitialized = FALSE; + mInitialized = false; mEmoteName = ""; mLineNumber = 0; @@ -1262,19 +1262,19 @@ void LLBVHLoader::reset() //------------------------------------------------------------------------ // LLBVHLoader::getLine() //------------------------------------------------------------------------ -BOOL LLBVHLoader::getLine(apr_file_t* fp) +bool LLBVHLoader::getLine(apr_file_t* fp) { if (apr_file_eof(fp) == APR_EOF) { - return FALSE; + return false; } if ( apr_file_gets(mLine, BVH_PARSER_LINE_SIZE, fp) == APR_SUCCESS) { mLineNumber++; - return TRUE; + return true; } - return FALSE; + return false; } // returns required size of output buffer @@ -1287,7 +1287,7 @@ U32 LLBVHLoader::getOutputSize() } // writes contents to datapacker -BOOL LLBVHLoader::serialize(LLDataPacker& dp) +bool LLBVHLoader::serialize(LLDataPacker& dp) { F32 time; @@ -1496,5 +1496,5 @@ BOOL LLBVHLoader::serialize(LLDataPacker& dp) } - return TRUE; + return true; } diff --git a/indra/llcharacter/llbvhloader.h b/indra/llcharacter/llbvhloader.h index 7923666d5c..de31f76dd3 100644 --- a/indra/llcharacter/llbvhloader.h +++ b/indra/llcharacter/llbvhloader.h @@ -71,8 +71,8 @@ struct Key F32 mPos[3]; F32 mRot[3]; - BOOL mIgnorePos; - BOOL mIgnoreRot; + bool mIgnorePos; + bool mIgnoreRot; }; @@ -89,10 +89,10 @@ struct Joint Joint(const char *name) { mName = name; - mIgnore = FALSE; - mIgnorePositions = FALSE; - mRelativePositionKey = FALSE; - mRelativeRotationKey = FALSE; + mIgnore = false; + mIgnorePositions = false; + mRelativePositionKey = false; + mRelativeRotationKey = false; mOutName = name; mOrder[0] = 'X'; mOrder[1] = 'Y'; @@ -111,10 +111,10 @@ struct Joint LLVector3 mRelativePosition; // std::string mName; - BOOL mIgnore; - BOOL mIgnorePositions; - BOOL mRelativePositionKey; - BOOL mRelativeRotationKey; + bool mIgnore; + bool mIgnorePositions; + bool mRelativePositionKey; + bool mRelativeRotationKey; std::string mOutName; std::string mMergeParentName; std::string mMergeChildName; @@ -161,18 +161,18 @@ class Translation public: Translation() { - mIgnore = FALSE; - mIgnorePositions = FALSE; - mRelativePositionKey = FALSE; - mRelativeRotationKey = FALSE; + mIgnore = false; + mIgnorePositions = false; + mRelativePositionKey = false; + mRelativeRotationKey = false; mPriorityModifier = 0; } std::string mOutName; - BOOL mIgnore; - BOOL mIgnorePositions; - BOOL mRelativePositionKey; - BOOL mRelativeRotationKey; + bool mIgnore; + bool mIgnorePositions; + bool mRelativePositionKey; + bool mRelativeRotationKey; LLMatrix3 mFrameMatrix; LLMatrix3 mOffsetMatrix; LLVector3 mRelativePosition; @@ -293,7 +293,7 @@ public: U32 getOutputSize(); // writes contents to datapacker - BOOL serialize(LLDataPacker& dp); + bool serialize(LLDataPacker& dp); // flags redundant keyframe data void optimize(); @@ -302,13 +302,13 @@ public: F32 getDuration() { return mDuration; } - BOOL isInitialized() { return mInitialized; } + bool isInitialized() { return mInitialized; } ELoadStatus getStatus() { return mStatus; } protected: // Consumes one line of input from file. - BOOL getLine(apr_file_t *fp); + bool getLine(apr_file_t *fp); // parser state char mLine[BVH_PARSER_LINE_SIZE]; /* Flawfinder: ignore */ @@ -322,7 +322,7 @@ protected: TranslationMap mTranslations; S32 mPriority; - BOOL mLoop; + bool mLoop; F32 mLoopInPoint; F32 mLoopOutPoint; F32 mEaseIn; @@ -330,7 +330,7 @@ protected: S32 mHand; std::string mEmoteName; - BOOL mInitialized; + bool mInitialized; ELoadStatus mStatus; // computed values diff --git a/indra/llcharacter/llcharacter.cpp b/indra/llcharacter/llcharacter.cpp index f2aa55a32c..264b9a0be1 100644 --- a/indra/llcharacter/llcharacter.cpp +++ b/indra/llcharacter/llcharacter.cpp @@ -39,7 +39,7 @@ LLStringTable LLCharacter::sVisualParamNames(1024); std::vector< LLCharacter* > LLCharacter::sInstances; -BOOL LLCharacter::sAllowInstancesChange = TRUE ; +bool LLCharacter::sAllowInstancesChange = true ; //----------------------------------------------------------------------------- // LLCharacter() @@ -73,8 +73,8 @@ LLCharacter::~LLCharacter() delete param; } - U32 i ; - U32 size = sInstances.size() ; + size_t i ; + size_t size = sInstances.size() ; for(i = 0 ; i < size ; i++) { if(sInstances[i] == this) @@ -114,7 +114,7 @@ LLJoint *LLCharacter::getJoint( const std::string &name ) //----------------------------------------------------------------------------- // registerMotion() //----------------------------------------------------------------------------- -BOOL LLCharacter::registerMotion( const LLUUID& id, LLMotionConstructor create ) +bool LLCharacter::registerMotion( const LLUUID& id, LLMotionConstructor create ) { return mMotionController.registerMotion(id, create); } @@ -147,7 +147,7 @@ LLMotion* LLCharacter::createMotion( const LLUUID &id ) //----------------------------------------------------------------------------- // startMotion() //----------------------------------------------------------------------------- -BOOL LLCharacter::startMotion(const LLUUID &id, F32 start_offset) +bool LLCharacter::startMotion(const LLUUID &id, F32 start_offset) { return mMotionController.startMotion(id, start_offset); } @@ -156,7 +156,7 @@ BOOL LLCharacter::startMotion(const LLUUID &id, F32 start_offset) //----------------------------------------------------------------------------- // stopMotion() //----------------------------------------------------------------------------- -BOOL LLCharacter::stopMotion(const LLUUID& id, BOOL stop_immediate) +bool LLCharacter::stopMotion(const LLUUID& id, bool stop_immediate) { return mMotionController.stopMotionLocally(id, stop_immediate); } @@ -164,7 +164,7 @@ BOOL LLCharacter::stopMotion(const LLUUID& id, BOOL stop_immediate) //----------------------------------------------------------------------------- // isMotionActive() //----------------------------------------------------------------------------- -BOOL LLCharacter::isMotionActive(const LLUUID& id) +bool LLCharacter::isMotionActive(const LLUUID& id) { LLMotion *motionp = mMotionController.findMotion(id); if (motionp) @@ -172,7 +172,7 @@ BOOL LLCharacter::isMotionActive(const LLUUID& id) return mMotionController.isMotionActive(motionp); } - return FALSE; + return false; } @@ -279,22 +279,22 @@ void LLCharacter::removeAnimationData(std::string name) //----------------------------------------------------------------------------- // setVisualParamWeight() //----------------------------------------------------------------------------- -BOOL LLCharacter::setVisualParamWeight(const LLVisualParam* which_param, F32 weight) +bool LLCharacter::setVisualParamWeight(const LLVisualParam* which_param, F32 weight) { S32 index = which_param->getID(); visual_param_index_map_t::iterator index_iter = mVisualParamIndexMap.find(index); if (index_iter != mVisualParamIndexMap.end()) { index_iter->second->setWeight(weight); - return TRUE; + return true; } - return FALSE; + return false; } //----------------------------------------------------------------------------- // setVisualParamWeight() //----------------------------------------------------------------------------- -BOOL LLCharacter::setVisualParamWeight(const char* param_name, F32 weight) +bool LLCharacter::setVisualParamWeight(const char* param_name, F32 weight) { std::string tname(param_name); LLStringUtil::toLower(tname); @@ -303,25 +303,25 @@ BOOL LLCharacter::setVisualParamWeight(const char* param_name, F32 weight) if (name_iter != mVisualParamNameMap.end()) { name_iter->second->setWeight(weight); - return TRUE; + return true; } LL_WARNS() << "LLCharacter::setVisualParamWeight() Invalid visual parameter: " << param_name << LL_ENDL; - return FALSE; + return false; } //----------------------------------------------------------------------------- // setVisualParamWeight() //----------------------------------------------------------------------------- -BOOL LLCharacter::setVisualParamWeight(S32 index, F32 weight) +bool LLCharacter::setVisualParamWeight(S32 index, F32 weight) { visual_param_index_map_t::iterator index_iter = mVisualParamIndexMap.find(index); if (index_iter != mVisualParamIndexMap.end()) { index_iter->second->setWeight(weight); - return TRUE; + return true; } LL_WARNS() << "LLCharacter::setVisualParamWeight() Invalid visual parameter index: " << index << LL_ENDL; - return FALSE; + return false; } //----------------------------------------------------------------------------- diff --git a/indra/llcharacter/llcharacter.h b/indra/llcharacter/llcharacter.h index b186b9052e..b390960a75 100644 --- a/indra/llcharacter/llcharacter.h +++ b/indra/llcharacter/llcharacter.h @@ -125,7 +125,7 @@ public: //------------------------------------------------------------------------- // registers a motion with the character // returns true if successfull - BOOL registerMotion( const LLUUID& id, LLMotionConstructor create ); + bool registerMotion( const LLUUID& id, LLMotionConstructor create ); void removeMotion( const LLUUID& id ); @@ -137,13 +137,13 @@ public: // start a motion // returns true if successful, false if an error occurred - virtual BOOL startMotion( const LLUUID& id, F32 start_offset = 0.f); + virtual bool startMotion( const LLUUID& id, F32 start_offset = 0.f); // stop a motion - virtual BOOL stopMotion( const LLUUID& id, BOOL stop_immediate = FALSE ); + virtual bool stopMotion( const LLUUID& id, bool stop_immediate = false ); // is this motion active? - BOOL isMotionActive( const LLUUID& id ); + bool isMotionActive( const LLUUID& id ); // Event handler for motion deactivation. // Called when a motion has completely stopped and has been deactivated. @@ -156,7 +156,7 @@ public: void updateMotions(e_update_t update_type); LLAnimPauseRequest requestPause(); - BOOL areAnimationsPaused() const { return mMotionController.isPaused(); } + bool areAnimationsPaused() const { return mMotionController.isPaused(); } void setAnimTimeFactor(F32 factor) { mMotionController.setTimeFactor(factor); } void setTimeStep(F32 time_step) { mMotionController.setTimeStep(time_step); } @@ -190,9 +190,9 @@ public: void addVisualParam(LLVisualParam *param); void addSharedVisualParam(LLVisualParam *param); - virtual BOOL setVisualParamWeight(const LLVisualParam *which_param, F32 weight); - virtual BOOL setVisualParamWeight(const char* param_name, F32 weight); - virtual BOOL setVisualParamWeight(S32 index, F32 weight); + virtual bool setVisualParamWeight(const LLVisualParam *which_param, F32 weight); + virtual bool setVisualParamWeight(const char* param_name, F32 weight); + virtual bool setVisualParamWeight(S32 index, F32 weight); // get visual param weight by param or name F32 getVisualParamWeight(LLVisualParam *distortion); @@ -256,7 +256,7 @@ public: void setSkeletonSerialNum( U32 num ) { mSkeletonSerialNum = num; } static std::vector< LLCharacter* > sInstances; - static BOOL sAllowInstancesChange ; //debug use + 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; } diff --git a/indra/llcharacter/lleditingmotion.cpp b/indra/llcharacter/lleditingmotion.cpp index b46f210d2b..9fb2a931f9 100644 --- a/indra/llcharacter/lleditingmotion.cpp +++ b/indra/llcharacter/lleditingmotion.cpp @@ -141,7 +141,7 @@ LLMotion::LLMotionInitStatus LLEditingMotion::onInitialize(LLCharacter *characte //----------------------------------------------------------------------------- // LLEditingMotion::onActivate() //----------------------------------------------------------------------------- -BOOL LLEditingMotion::onActivate() +bool LLEditingMotion::onActivate() { // propagate joint positions to kinematic chain // SL-315 @@ -155,25 +155,25 @@ BOOL LLEditingMotion::onActivate() mShoulderJoint.setRotation( mShoulderState->getJoint()->getRotation() ); mElbowJoint.setRotation( mElbowState->getJoint()->getRotation() ); - return TRUE; + return true; } //----------------------------------------------------------------------------- // LLEditingMotion::onUpdate() //----------------------------------------------------------------------------- -BOOL LLEditingMotion::onUpdate(F32 time, U8* joint_mask) +bool LLEditingMotion::onUpdate(F32 time, U8* joint_mask) { LL_PROFILE_ZONE_SCOPED; LLVector3 focus_pt; LLVector3* pointAtPt = (LLVector3*)mCharacter->getAnimationData("PointAtPoint"); - BOOL result = TRUE; + bool result = true; if (!pointAtPt) { focus_pt = mLastSelectPt; - result = FALSE; + result = false; } else { diff --git a/indra/llcharacter/lleditingmotion.h b/indra/llcharacter/lleditingmotion.h index f8834ebdea..f94756d43d 100644 --- a/indra/llcharacter/lleditingmotion.h +++ b/indra/llcharacter/lleditingmotion.h @@ -69,7 +69,7 @@ public: //------------------------------------------------------------------------- // motions must specify whether or not they loop - virtual BOOL getLoop() { return TRUE; } + virtual bool getLoop() { return true; } // motions must report their total duration virtual F32 getDuration() { return 0.0; } @@ -94,14 +94,14 @@ public: virtual LLMotionInitStatus onInitialize(LLCharacter *character); // called when a motion is activated - // must return TRUE to indicate success, or else + // must return true to indicate success, or else // it will be deactivated - virtual BOOL onActivate(); + virtual bool onActivate(); // called per time step - // must return TRUE while it is active, and - // must return FALSE when the motion is completed. - virtual BOOL onUpdate(F32 time, U8* joint_mask); + // must return true while it is active, and + // must return false when the motion is completed. + virtual bool onUpdate(F32 time, U8* joint_mask); // called when a motion is deactivated virtual void onDeactivate(); diff --git a/indra/llcharacter/llgesture.cpp b/indra/llcharacter/llgesture.cpp index 8533605c2d..b69462ce28 100644 --- a/indra/llcharacter/llgesture.cpp +++ b/indra/llcharacter/llgesture.cpp @@ -91,17 +91,17 @@ const LLGesture &LLGesture::operator =(const LLGesture &rhs) } -BOOL LLGesture::trigger(KEY key, MASK mask) +bool LLGesture::trigger(KEY key, MASK mask) { LL_WARNS() << "Parent class trigger called: you probably didn't mean this." << LL_ENDL; - return FALSE; + return false; } -BOOL LLGesture::trigger(const std::string& trigger_string) +bool LLGesture::trigger(const std::string& trigger_string) { LL_WARNS() << "Parent class trigger called: you probably didn't mean this." << LL_ENDL; - return FALSE; + return false; } // NOT endian-neutral @@ -189,12 +189,12 @@ void LLGestureList::deleteAll() // Iterates through space delimited tokens in string, triggering any gestures found. // Generates a revised string that has the found tokens replaced by their replacement strings // and (as a minor side effect) has multiple spaces in a row replaced by single spaces. -BOOL LLGestureList::triggerAndReviseString(const std::string &string, std::string* revised_string) +bool LLGestureList::triggerAndReviseString(const std::string &string, std::string* revised_string) { std::string tokenized = string; - BOOL found_gestures = FALSE; - BOOL first_token = TRUE; + bool found_gestures = false; + bool first_token = true; typedef boost::tokenizer<boost::char_separator<char> > tokenizer; boost::char_separator<char> sep(" "); @@ -235,7 +235,7 @@ BOOL LLGestureList::triggerAndReviseString(const std::string &string, std::strin } } - found_gestures = TRUE; + found_gestures = true; break; } gesture = NULL; @@ -251,14 +251,14 @@ BOOL LLGestureList::triggerAndReviseString(const std::string &string, std::strin revised_string->append( cur_token ); } - first_token = FALSE; + first_token = false; } return found_gestures; } -BOOL LLGestureList::trigger(KEY key, MASK mask) +bool LLGestureList::trigger(KEY key, MASK mask) { for (U32 i = 0; i < mList.size(); i++) { @@ -267,7 +267,7 @@ BOOL LLGestureList::trigger(KEY key, MASK mask) { if (gesture->trigger(key, mask)) { - return TRUE; + return true; } } else @@ -275,14 +275,14 @@ BOOL LLGestureList::trigger(KEY key, MASK mask) LL_WARNS() << "NULL gesture in gesture list (" << i << ")" << LL_ENDL; } } - return FALSE; + return false; } // NOT endian-neutral U8 *LLGestureList::serialize(U8 *buffer) const { // a single S32 serves as the header that tells us how many to read - U32 count = mList.size(); + auto count = mList.size(); htolememcpy(buffer, &count, MVT_S32, 4); buffer += sizeof(count); diff --git a/indra/llcharacter/llgesture.h b/indra/llcharacter/llgesture.h index 4e7fb6d1cc..f8504d06d2 100644 --- a/indra/llcharacter/llgesture.h +++ b/indra/llcharacter/llgesture.h @@ -55,10 +55,10 @@ public: const std::string& getOutputString() const { return mOutputString; } // Triggers if a key/mask matches it - virtual BOOL trigger(KEY key, MASK mask); + virtual bool trigger(KEY key, MASK mask); // Triggers if case-insensitive substring matches (assumes string is lowercase) - virtual BOOL trigger(const std::string &string); + virtual bool trigger(const std::string &string); // non-endian-neutral serialization U8 *serialize(U8 *buffer) const; @@ -84,13 +84,13 @@ public: virtual ~LLGestureList(); // Triggers if a key/mask matches one in the list - BOOL trigger(KEY key, MASK mask); + bool trigger(KEY key, MASK mask); // Triggers if substring matches and generates revised string. - BOOL triggerAndReviseString(const std::string &string, std::string* revised_string); + bool triggerAndReviseString(const std::string &string, std::string* revised_string); // Used for construction from UI - S32 count() const { return mList.size(); } + S32 count() const { return static_cast<S32>(mList.size()); } virtual LLGesture* get(S32 i) const { return mList.at(i); } virtual void put(LLGesture* gesture) { mList.push_back( gesture ); } void deleteAll(); diff --git a/indra/llcharacter/llhandmotion.cpp b/indra/llcharacter/llhandmotion.cpp index 5fc98a4b4d..2c03ded841 100644 --- a/indra/llcharacter/llhandmotion.cpp +++ b/indra/llcharacter/llhandmotion.cpp @@ -98,7 +98,7 @@ LLMotion::LLMotionInitStatus LLHandMotion::onInitialize(LLCharacter *character) //----------------------------------------------------------------------------- // LLHandMotion::onActivate() //----------------------------------------------------------------------------- -BOOL LLHandMotion::onActivate() +bool LLHandMotion::onActivate() { LLPolyMesh *upperBodyMesh = mCharacter->getUpperBodyMesh(); @@ -112,14 +112,14 @@ BOOL LLHandMotion::onActivate() mCharacter->setVisualParamWeight(gHandPoseNames[mCurrentPose], 1.f); mCharacter->updateVisualParams(); } - return TRUE; + return true; } //----------------------------------------------------------------------------- // LLHandMotion::onUpdate() //----------------------------------------------------------------------------- -BOOL LLHandMotion::onUpdate(F32 time, U8* joint_mask) +bool LLHandMotion::onUpdate(F32 time, U8* joint_mask) { LL_PROFILE_ZONE_SCOPED; eHandPose *requestedHandPose; @@ -233,7 +233,7 @@ BOOL LLHandMotion::onUpdate(F32 time, U8* joint_mask) } } - return TRUE; + return true; } diff --git a/indra/llcharacter/llhandmotion.h b/indra/llcharacter/llhandmotion.h index a88a2aa85a..42f3411148 100644 --- a/indra/llcharacter/llhandmotion.h +++ b/indra/llcharacter/llhandmotion.h @@ -82,7 +82,7 @@ public: //------------------------------------------------------------------------- // motions must specify whether or not they loop - virtual BOOL getLoop() { return TRUE; } + virtual bool getLoop() { return true; } // motions must report their total duration virtual F32 getDuration() { return 0.0; } @@ -107,19 +107,19 @@ public: virtual LLMotionInitStatus onInitialize(LLCharacter *character); // called when a motion is activated - // must return TRUE to indicate success, or else + // must return true to indicate success, or else // it will be deactivated - virtual BOOL onActivate(); + virtual bool onActivate(); // called per time step - // must return TRUE while it is active, and - // must return FALSE when the motion is completed. - virtual BOOL onUpdate(F32 time, U8* joint_mask); + // must return true while it is active, and + // must return false when the motion is completed. + virtual bool onUpdate(F32 time, U8* joint_mask); // called when a motion is deactivated virtual void onDeactivate(); - virtual BOOL canDeprecate() { return FALSE; } + virtual bool canDeprecate() { return false; } static std::string getHandPoseName(eHandPose pose); static eHandPose getHandPose(std::string posename); diff --git a/indra/llcharacter/llheadrotmotion.cpp b/indra/llcharacter/llheadrotmotion.cpp index 55acb12490..6169647423 100644 --- a/indra/llcharacter/llheadrotmotion.cpp +++ b/indra/llcharacter/llheadrotmotion.cpp @@ -164,16 +164,16 @@ LLMotion::LLMotionInitStatus LLHeadRotMotion::onInitialize(LLCharacter *characte //----------------------------------------------------------------------------- // LLHeadRotMotion::onActivate() //----------------------------------------------------------------------------- -BOOL LLHeadRotMotion::onActivate() +bool LLHeadRotMotion::onActivate() { - return TRUE; + return true; } //----------------------------------------------------------------------------- // LLHeadRotMotion::onUpdate() //----------------------------------------------------------------------------- -BOOL LLHeadRotMotion::onUpdate(F32 time, U8* joint_mask) +bool LLHeadRotMotion::onUpdate(F32 time, U8* joint_mask) { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; LLQuaternion targetHeadRotWorld; @@ -251,7 +251,7 @@ BOOL LLHeadRotMotion::onUpdate(F32 time, U8* joint_mask) mHeadState->setRotation( nlerp(1.f - NECK_LAG, LLQuaternion::DEFAULT, head_rot_local)); } - return TRUE; + return true; } @@ -279,7 +279,7 @@ LLEyeMotion::LLEyeMotion(const LLUUID &id) : LLMotion(id) mEyeLookAwayPitch = 0.f; mEyeBlinkTime = 0.f; - mEyesClosed = FALSE; + mEyesClosed = false; mHeadJoint = NULL; @@ -362,9 +362,9 @@ LLMotion::LLMotionInitStatus LLEyeMotion::onInitialize(LLCharacter *character) //----------------------------------------------------------------------------- // LLEyeMotion::onActivate() //----------------------------------------------------------------------------- -BOOL LLEyeMotion::onActivate() +bool LLEyeMotion::onActivate() { - return TRUE; + return true; } //----------------------------------------------------------------------------- @@ -373,7 +373,7 @@ BOOL LLEyeMotion::onActivate() void LLEyeMotion::adjustEyeTarget(LLVector3* targetPos, LLJointState& left_eye_state, LLJointState& right_eye_state) { // Compute eye rotation. - BOOL has_eye_target = FALSE; + bool has_eye_target = false; LLQuaternion target_eye_rot; LLVector3 eye_look_at; F32 vergence; @@ -385,7 +385,7 @@ void LLEyeMotion::adjustEyeTarget(LLVector3* targetPos, LLJointState& left_eye_s LLVector3 up; eye_look_at = *targetPos; - has_eye_target = TRUE; + has_eye_target = true; F32 lookAtDistance = eye_look_at.normVec(); left.setVec(skyward % eye_look_at); @@ -457,7 +457,7 @@ void LLEyeMotion::adjustEyeTarget(LLVector3* targetPos, LLJointState& left_eye_s //----------------------------------------------------------------------------- // LLEyeMotion::onUpdate() //----------------------------------------------------------------------------- -BOOL LLEyeMotion::onUpdate(F32 time, U8* joint_mask) +bool LLEyeMotion::onUpdate(F32 time, U8* joint_mask) { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; //calculate jitter @@ -505,7 +505,7 @@ BOOL LLEyeMotion::onUpdate(F32 time, U8* joint_mask) if (rightEyeBlinkMorph == 1.f) { - mEyesClosed = TRUE; + mEyesClosed = true; mEyeBlinkTime = EYE_BLINK_CLOSE_TIME; mEyeBlinkTimer.reset(); } @@ -525,7 +525,7 @@ BOOL LLEyeMotion::onUpdate(F32 time, U8* joint_mask) if (rightEyeBlinkMorph == 0.f) { - mEyesClosed = FALSE; + mEyesClosed = false; mEyeBlinkTime = EYE_BLINK_MIN_TIME + ll_frand(EYE_BLINK_MAX_TIME - EYE_BLINK_MIN_TIME); mEyeBlinkTimer.reset(); } @@ -537,7 +537,7 @@ BOOL LLEyeMotion::onUpdate(F32 time, U8* joint_mask) adjustEyeTarget(targetPos, *mLeftEyeState, *mRightEyeState); adjustEyeTarget(targetPos, *mAltLeftEyeState, *mAltRightEyeState); - return TRUE; + return true; } diff --git a/indra/llcharacter/llheadrotmotion.h b/indra/llcharacter/llheadrotmotion.h index 3239008b92..50de4ffa26 100644 --- a/indra/llcharacter/llheadrotmotion.h +++ b/indra/llcharacter/llheadrotmotion.h @@ -64,7 +64,7 @@ public: //------------------------------------------------------------------------- // motions must specify whether or not they loop - virtual BOOL getLoop() { return TRUE; } + virtual bool getLoop() { return true; } // motions must report their total duration virtual F32 getDuration() { return 0.0; } @@ -89,14 +89,14 @@ public: virtual LLMotionInitStatus onInitialize(LLCharacter *character); // called when a motion is activated - // must return TRUE to indicate success, or else + // must return true to indicate success, or else // it will be deactivated - virtual BOOL onActivate(); + virtual bool onActivate(); // called per time step - // must return TRUE while it is active, and - // must return FALSE when the motion is completed. - virtual BOOL onUpdate(F32 time, U8* joint_mask); + // must return true while it is active, and + // must return false when the motion is completed. + virtual bool onUpdate(F32 time, U8* joint_mask); // called when a motion is deactivated virtual void onDeactivate(); @@ -147,7 +147,7 @@ public: //------------------------------------------------------------------------- // motions must specify whether or not they loop - virtual BOOL getLoop() { return TRUE; } + virtual bool getLoop() { return true; } // motions must report their total duration virtual F32 getDuration() { return 0.0; } @@ -172,16 +172,16 @@ public: virtual LLMotionInitStatus onInitialize(LLCharacter *character); // called when a motion is activated - // must return TRUE to indicate success, or else + // must return true to indicate success, or else // it will be deactivated - virtual BOOL onActivate(); + virtual bool onActivate(); void adjustEyeTarget(LLVector3* targetPos, LLJointState& left_eye_state, LLJointState& right_eye_state); // called per time step - // must return TRUE while it is active, and - // must return FALSE when the motion is completed. - virtual BOOL onUpdate(F32 time, U8* joint_mask); + // must return true while it is active, and + // must return false when the motion is completed. + virtual bool onUpdate(F32 time, U8* joint_mask); // called when a motion is deactivated virtual void onDeactivate(); @@ -209,7 +209,7 @@ public: // eye blinking LLFrameTimer mEyeBlinkTimer; F32 mEyeBlinkTime; - BOOL mEyesClosed; + bool mEyesClosed; }; #endif // LL_LLHEADROTMOTION_H diff --git a/indra/llcharacter/lljoint.cpp b/indra/llcharacter/lljoint.cpp index 4e66777c11..c2a10d969f 100644 --- a/indra/llcharacter/lljoint.cpp +++ b/indra/llcharacter/lljoint.cpp @@ -76,7 +76,7 @@ void LLVector3OverrideMap::showJointVector3Overrides( std::ostringstream& os ) c U32 LLVector3OverrideMap::count() const { - return m_map.size(); + return static_cast<U32>(m_map.size()); } void LLVector3OverrideMap::add(const LLUUID& mesh_id, const LLVector3& pos) @@ -86,7 +86,7 @@ void LLVector3OverrideMap::add(const LLUUID& mesh_id, const LLVector3& pos) bool LLVector3OverrideMap::remove(const LLUUID& mesh_id) { - U32 remove_count = m_map.erase(mesh_id); + auto remove_count = m_map.erase(mesh_id); return (remove_count > 0); } @@ -105,10 +105,10 @@ void LLJoint::init() { mName = "unnamed"; mParent = NULL; - mXform.setScaleChildOffset(TRUE); + mXform.setScaleChildOffset(true); mXform.setScale(LLVector3(1.0f, 1.0f, 1.0f)); mDirtyFlags = MATRIX_DIRTY | ROTATION_DIRTY | POSITION_DIRTY; - mUpdateXform = TRUE; + mUpdateXform = true; mSupport = SUPPORT_BASE; mEnd = LLVector3(0.0f, 0.0f, 0.0f); } @@ -135,7 +135,7 @@ LLJoint::LLJoint(const std::string &name, LLJoint *parent) : mJointNum(-2) { init(); - mUpdateXform = FALSE; + mUpdateXform = false; setName(name); if (parent) @@ -996,7 +996,7 @@ void LLJoint::updateWorldMatrix() if (mDirtyFlags & MATRIX_DIRTY) { sNumUpdates++; - mXform.updateMatrix(FALSE); + mXform.updateMatrix(false); mWorldMatrix.loadu(mXform.getWorldMatrix()); mDirtyFlags = 0x0; } diff --git a/indra/llcharacter/lljoint.h b/indra/llcharacter/lljoint.h index 1f08c9c91c..763c1e3865 100644 --- a/indra/llcharacter/lljoint.h +++ b/indra/llcharacter/lljoint.h @@ -40,21 +40,21 @@ #include "xform.h" #include "llmatrix4a.h" -const S32 LL_CHARACTER_MAX_JOINTS_PER_MESH = 15; +constexpr S32 LL_CHARACTER_MAX_JOINTS_PER_MESH = 15; // Need to set this to count of animate-able joints, // currently = #bones + #collision_volumes + #attachments + 2, // rounded to next multiple of 4. -const U32 LL_CHARACTER_MAX_ANIMATED_JOINTS = 216; // must be divisible by 4! -const U32 LL_MAX_JOINTS_PER_MESH_OBJECT = 110; +constexpr U32 LL_CHARACTER_MAX_ANIMATED_JOINTS = 216; // must be divisible by 4! +constexpr U32 LL_MAX_JOINTS_PER_MESH_OBJECT = 110; // These should be higher than the joint_num of any // other joint, to avoid conflicts in updateMotionsByType() -const U32 LL_HAND_JOINT_NUM = (LL_CHARACTER_MAX_ANIMATED_JOINTS-1); -const U32 LL_FACE_JOINT_NUM = (LL_CHARACTER_MAX_ANIMATED_JOINTS-2); -const S32 LL_CHARACTER_MAX_PRIORITY = 7; -const F32 LL_MAX_PELVIS_OFFSET = 5.f; +constexpr U32 LL_HAND_JOINT_NUM = (LL_CHARACTER_MAX_ANIMATED_JOINTS-1); +constexpr U32 LL_FACE_JOINT_NUM = (LL_CHARACTER_MAX_ANIMATED_JOINTS-2); +constexpr S32 LL_CHARACTER_MAX_PRIORITY = 7; +constexpr F32 LL_MAX_PELVIS_OFFSET = 5.f; -const F32 LL_JOINT_TRESHOLD_POS_OFFSET = 0.0001f; //0.1 mm +constexpr F32 LL_JOINT_TRESHOLD_POS_OFFSET = 0.0001f; //0.1 mm class LLVector3OverrideMap { @@ -133,7 +133,7 @@ protected: public: U32 mDirtyFlags; - BOOL mUpdateXform; + bool mUpdateXform; // describes the skin binding pose LLVector3 mSkinOffset; @@ -280,7 +280,7 @@ public: void clampRotation(LLQuaternion old_rot, LLQuaternion new_rot); - virtual BOOL isAnimatable() const { return TRUE; } + virtual bool isAnimatable() const { return true; } void addAttachmentPosOverride( const LLVector3& pos, const LLUUID& mesh_id, const std::string& av_info, bool& active_override_changed ); void removeAttachmentPosOverride( const LLUUID& mesh_id, const std::string& av_info, bool& active_override_changed ); diff --git a/indra/llcharacter/lljointsolverrp3.cpp b/indra/llcharacter/lljointsolverrp3.cpp index 6ec04bdb00..626029059e 100644 --- a/indra/llcharacter/lljointsolverrp3.cpp +++ b/indra/llcharacter/lljointsolverrp3.cpp @@ -53,9 +53,9 @@ LLJointSolverRP3::LLJointSolverRP3() mLengthAB = 1.0f; mLengthBC = 1.0f; mPoleVector.setVec( 1.0f, 0.0f, 0.0f ); - mbUseBAxis = FALSE; + mbUseBAxis = false; mTwist = 0.0f; - mFirstTime = TRUE; + mFirstTime = true; } @@ -114,7 +114,7 @@ void LLJointSolverRP3::setBAxis( const LLVector3& bAxis ) { mBAxis = bAxis; mBAxis.normVec(); - mbUseBAxis = TRUE; + mbUseBAxis = true; } //----------------------------------------------------------------------------- diff --git a/indra/llcharacter/lljointsolverrp3.h b/indra/llcharacter/lljointsolverrp3.h index d6080a1ab2..b5c8e24a64 100644 --- a/indra/llcharacter/lljointsolverrp3.h +++ b/indra/llcharacter/lljointsolverrp3.h @@ -97,11 +97,11 @@ protected: LLVector3 mPoleVector; LLVector3 mBAxis; - BOOL mbUseBAxis; + bool mbUseBAxis; F32 mTwist; - BOOL mFirstTime; + bool mFirstTime; LLMatrix4 mSavedJointAMat; LLMatrix4 mSavedInvPlaneMat; diff --git a/indra/llcharacter/lljointstate.h b/indra/llcharacter/lljointstate.h index 584b123046..1b17400200 100644 --- a/indra/llcharacter/lljointstate.h +++ b/indra/llcharacter/lljointstate.h @@ -80,7 +80,7 @@ public: // joint that this state is applied to LLJoint* getJoint() { return mJoint; } const LLJoint* getJoint() const { return mJoint; } - BOOL setJoint( LLJoint *joint ) { mJoint = joint; return mJoint != NULL; } + bool setJoint( LLJoint *joint ) { mJoint = joint; return mJoint != NULL; } // transform type (bitwise flags can be combined) // Note that these are set automatically when various diff --git a/indra/llcharacter/llkeyframefallmotion.cpp b/indra/llcharacter/llkeyframefallmotion.cpp index ba00ee8984..82ffc87843 100644 --- a/indra/llcharacter/llkeyframefallmotion.cpp +++ b/indra/llcharacter/llkeyframefallmotion.cpp @@ -91,7 +91,7 @@ LLMotion::LLMotionInitStatus LLKeyframeFallMotion::onInitialize(LLCharacter *cha //----------------------------------------------------------------------------- // LLKeyframeFallMotion::onActivate() //----------------------------------------------------------------------------- -BOOL LLKeyframeFallMotion::onActivate() +bool LLKeyframeFallMotion::onActivate() { LLVector3 ground_pos; LLVector3 ground_normal; @@ -119,10 +119,10 @@ BOOL LLKeyframeFallMotion::onActivate() //----------------------------------------------------------------------------- // LLKeyframeFallMotion::onUpdate() //----------------------------------------------------------------------------- -BOOL LLKeyframeFallMotion::onUpdate(F32 activeTime, U8* joint_mask) +bool LLKeyframeFallMotion::onUpdate(F32 activeTime, U8* joint_mask) { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; - BOOL result = LLKeyframeMotion::onUpdate(activeTime, joint_mask); + bool result = LLKeyframeMotion::onUpdate(activeTime, joint_mask); F32 slerp_amt = clamp_rescale(activeTime / getDuration(), 0.5f, 0.75f, 0.f, 1.f); if (mPelvisState.notNull()) diff --git a/indra/llcharacter/llkeyframefallmotion.h b/indra/llcharacter/llkeyframefallmotion.h index b0136d302f..8049aff328 100644 --- a/indra/llcharacter/llkeyframefallmotion.h +++ b/indra/llcharacter/llkeyframefallmotion.h @@ -60,9 +60,9 @@ public: // animation callbacks to be implemented by subclasses //------------------------------------------------------------------------- virtual LLMotionInitStatus onInitialize(LLCharacter *character); - virtual BOOL onActivate(); + virtual bool onActivate(); virtual F32 getEaseInDuration(); - virtual BOOL onUpdate(F32 activeTime, U8* joint_mask); + virtual bool onUpdate(F32 activeTime, U8* joint_mask); protected: //------------------------------------------------------------------------- diff --git a/indra/llcharacter/llkeyframemotion.cpp b/indra/llcharacter/llkeyframemotion.cpp index 10d35c4527..12212efb66 100644 --- a/indra/llcharacter/llkeyframemotion.cpp +++ b/indra/llcharacter/llkeyframemotion.cpp @@ -66,7 +66,7 @@ static F32 MAX_CONSTRAINTS = 10; //----------------------------------------------------------------------------- LLKeyframeMotion::JointMotionList::JointMotionList() : mDuration(0.f), - mLoop(FALSE), + mLoop(false), mLoopInPoint(0.f), mLoopOutPoint(0.f), mEaseInDuration(0.f), @@ -430,8 +430,9 @@ void LLKeyframeMotion::JointMotion::update(LLJointState* joint_state, F32 time, //----------------------------------------------------------------------------- LLKeyframeMotion::LLKeyframeMotion(const LLUUID &id) : LLMotion(id), - mJointMotionList(NULL), - mPelvisp(NULL), + mJointMotionList(nullptr), + mPelvisp(nullptr), + mCharacter(nullptr), mLastSkeletonSerialNum(0), mLastUpdateTime(0.f), mLastLoopedTime(0.f), @@ -505,11 +506,12 @@ LLMotion::LLMotionInitStatus LLKeyframeMotion::onInitialize(LLCharacter *charact LLAssetType::AT_ANIMATION, onLoadComplete, (void*)character_id, - FALSE); + false); } else { - LL_INFOS("Animation") << "Attempted to fetch animation " << mName << " with null id for character " << mCharacter->getID() << LL_ENDL; + LL_INFOS("Animation") << "Attempted to fetch animation '" << mName << "' with null id" + << " for character " << mCharacter->getID() << LL_ENDL; } return STATUS_HOLD; @@ -565,7 +567,7 @@ LLMotion::LLMotionInitStatus LLKeyframeMotion::onInitialize(LLCharacter *charact U8 *anim_data; S32 anim_file_size; - BOOL success = FALSE; + bool success = false; LLFileSystem* anim_file = new LLFileSystem(mID, LLAssetType::AT_ANIMATION); if (!anim_file || !anim_file->getSize()) { @@ -620,7 +622,7 @@ LLMotion::LLMotionInitStatus LLKeyframeMotion::onInitialize(LLCharacter *charact //----------------------------------------------------------------------------- // setupPose() //----------------------------------------------------------------------------- -BOOL LLKeyframeMotion::setupPose() +bool LLKeyframeMotion::setupPose() { // add all valid joint states to the pose for (U32 jm=0; jm<mJointMotionList->getNumJointMotions(); jm++) @@ -645,7 +647,7 @@ BOOL LLKeyframeMotion::setupPose() mPelvisp = mCharacter->getJoint("mPelvis"); if (!mPelvisp) { - return FALSE; + return false; } } @@ -653,34 +655,33 @@ BOOL LLKeyframeMotion::setupPose() setLoopIn(mJointMotionList->mLoopInPoint); setLoopOut(mJointMotionList->mLoopOutPoint); - return TRUE; + return true; } //----------------------------------------------------------------------------- // LLKeyframeMotion::onActivate() //----------------------------------------------------------------------------- -BOOL LLKeyframeMotion::onActivate() +bool LLKeyframeMotion::onActivate() { // If the keyframe anim has an associated emote, trigger it. - if( mJointMotionList->mEmoteName.length() > 0 ) + if (mJointMotionList->mEmoteID.notNull()) { - LLUUID emote_anim_id = gAnimLibrary.stringToAnimState(mJointMotionList->mEmoteName); // don't start emote if already active to avoid recursion - if (!mCharacter->isMotionActive(emote_anim_id)) + if (!mCharacter->isMotionActive(mJointMotionList->mEmoteID)) { - mCharacter->startMotion( emote_anim_id ); + mCharacter->startMotion(mJointMotionList->mEmoteID); } } mLastLoopedTime = 0.f; - return TRUE; + return true; } //----------------------------------------------------------------------------- // LLKeyframeMotion::onUpdate() //----------------------------------------------------------------------------- -BOOL LLKeyframeMotion::onUpdate(F32 time, U8* joint_mask) +bool LLKeyframeMotion::onUpdate(F32 time, U8* joint_mask) { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; // llassert(time >= 0.f); // This will fire @@ -869,7 +870,7 @@ void LLKeyframeMotion::initializeConstraint(JointConstraint* constraint) void LLKeyframeMotion::activateConstraint(JointConstraint* constraint) { JointConstraintSharedData *shared_data = constraint->mSharedData; - constraint->mActive = TRUE; + constraint->mActive = true; S32 joint_num; // grab ground position if we need to @@ -901,17 +902,17 @@ void LLKeyframeMotion::deactivateConstraint(JointConstraint *constraintp) { if (constraintp->mSourceVolume) { - constraintp->mSourceVolume->mUpdateXform = FALSE; + constraintp->mSourceVolume->mUpdateXform = false; } if (constraintp->mSharedData->mConstraintTargetType != CONSTRAINT_TARGET_TYPE_GROUND) { if (constraintp->mTargetVolume) { - constraintp->mTargetVolume->mUpdateXform = FALSE; + constraintp->mTargetVolume->mUpdateXform = false; } } - constraintp->mActive = FALSE; + constraintp->mActive = false; } //----------------------------------------------------------------------------- @@ -1088,9 +1089,9 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8 // convert intermediate joint positions to world coordinates positions[joint_num] = ( constraint->mPositions[joint_num] * mPelvisp->getWorldRotation()) + mPelvisp->getWorldPosition(); F32 time_constant = 1.f / clamp_rescale(constraint->mFixupDistanceRMS, 0.f, 0.5f, 0.2f, 8.f); -// LL_INFOS() << "Interpolant " << LLSmoothInterpolation::getInterpolant(time_constant, FALSE) << " and fixup distance " << constraint->mFixupDistanceRMS << " on " << mCharacter->findCollisionVolume(shared_data->mSourceConstraintVolume)->getName() << LL_ENDL; +// LL_INFOS() << "Interpolant " << LLSmoothInterpolation::getInterpolant(time_constant, false) << " and fixup distance " << constraint->mFixupDistanceRMS << " on " << mCharacter->findCollisionVolume(shared_data->mSourceConstraintVolume)->getName() << LL_ENDL; positions[joint_num] = lerp(positions[joint_num], kinematic_position, - LLSmoothInterpolation::getInterpolant(time_constant, FALSE)); + LLSmoothInterpolation::getInterpolant(time_constant, false)); } S32 iteration_count; @@ -1225,9 +1226,9 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8 // allow_invalid_joints should be true when handling existing content, to avoid breakage. // During upload, we should be more restrictive and reject such animations. //----------------------------------------------------------------------------- -BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, bool allow_invalid_joints) +bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, bool allow_invalid_joints) { - BOOL old_version = FALSE; + bool old_version = false; std::unique_ptr<LLKeyframeMotion::JointMotionList> joint_motion_list(new LLKeyframeMotion::JointMotionList); //------------------------------------------------------------------------- @@ -1237,39 +1238,47 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo U16 version; U16 sub_version; + // Amimation identifier for log messages + auto asset = [&]() -> std::string + { + return asset_id.asString() + ", char " + mCharacter->getID().asString(); + }; + if (!dp.unpackU16(version, "version")) { - LL_WARNS() << "can't read version number for animation " << asset_id << LL_ENDL; - return FALSE; + LL_WARNS() << "can't read version number" + << " for animation " << asset() << LL_ENDL; + return false; } if (!dp.unpackU16(sub_version, "sub_version")) { - LL_WARNS() << "can't read sub version number for animation " << asset_id << LL_ENDL; - return FALSE; + LL_WARNS() << "can't read sub version number" + << " for animation " << asset() << LL_ENDL; + return false; } if (version == 0 && sub_version == 1) { - old_version = TRUE; + old_version = true; } else if (version != KEYFRAME_MOTION_VERSION || sub_version != KEYFRAME_MOTION_SUBVERSION) { #if LL_RELEASE LL_WARNS() << "Bad animation version " << version << "." << sub_version - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; #else LL_ERRS() << "Bad animation version " << version << "." << sub_version - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; #endif } if (!dp.unpackS32(temp_priority, "base_priority")) { LL_WARNS() << "can't read animation base_priority" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } joint_motion_list->mBasePriority = (LLJoint::JointPriority) temp_priority; @@ -1281,8 +1290,8 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo else if (joint_motion_list->mBasePriority < LLJoint::USE_MOTION_PRIORITY) { LL_WARNS() << "bad animation base_priority " << joint_motion_list->mBasePriority - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } //------------------------------------------------------------------------- @@ -1291,16 +1300,16 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackF32(joint_motion_list->mDuration, "duration")) { LL_WARNS() << "can't read duration" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if (joint_motion_list->mDuration > MAX_ANIM_DURATION || !llfinite(joint_motion_list->mDuration)) { LL_WARNS() << "invalid animation duration" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } //------------------------------------------------------------------------- @@ -1308,16 +1317,34 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo //------------------------------------------------------------------------- if (!dp.unpackString(joint_motion_list->mEmoteName, "emote_name")) { - LL_WARNS() << "can't read optional_emote_animation" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + LL_WARNS() << "can't read emote_name" + << " for animation " << asset() << LL_ENDL; + return false; } - if(joint_motion_list->mEmoteName==mID.asString()) + if (!joint_motion_list->mEmoteName.empty()) { - LL_WARNS() << "Malformed animation mEmoteName==mID" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + if (joint_motion_list->mEmoteName == mID.asString()) + { + LL_WARNS() << "Malformed animation mEmoteName==mID" + << " for animation " << asset() << LL_ENDL; + return false; + } + // "Closed_Mouth" is a very popular emote name we should ignore + if (joint_motion_list->mEmoteName == "Closed_Mouth") + { + joint_motion_list->mEmoteName.clear(); + } + else + { + joint_motion_list->mEmoteID = gAnimLibrary.stringToAnimState(joint_motion_list->mEmoteName); + if (joint_motion_list->mEmoteID.isNull()) + { + LL_WARNS() << "unknown emote_name '" << joint_motion_list->mEmoteName << "'" + << " for animation " << asset() << LL_ENDL; + joint_motion_list->mEmoteName.clear(); + } + } } //------------------------------------------------------------------------- @@ -1327,32 +1354,34 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo !llfinite(joint_motion_list->mLoopInPoint)) { LL_WARNS() << "can't read loop point" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if (!dp.unpackF32(joint_motion_list->mLoopOutPoint, "loop_out_point") || !llfinite(joint_motion_list->mLoopOutPoint)) { LL_WARNS() << "can't read loop point" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } - if (!dp.unpackS32(joint_motion_list->mLoop, "loop")) + S32 loop{ 0 }; + if (!dp.unpackS32(loop, "loop")) { LL_WARNS() << "can't read loop" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } + joint_motion_list->mLoop = static_cast<bool>(loop); //SL-17206 hack to alter Female_land loop setting, while current behavior won't be changed serverside LLUUID const female_land_anim("ca1baf4d-0a18-5a1f-0330-e4bd1e71f09e"); LLUUID const formal_female_land_anim("6a9a173b-61fa-3ad5-01fa-a851cfc5f66a"); if (female_land_anim == asset_id || formal_female_land_anim == asset_id) { - LL_WARNS() << "Animation(" << asset_id << ") won't be looped." << LL_ENDL; - joint_motion_list->mLoop = FALSE; + LL_WARNS() << "Animation " << asset() << " won't be looped." << LL_ENDL; + joint_motion_list->mLoop = false; } //------------------------------------------------------------------------- @@ -1362,16 +1391,16 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo !llfinite(joint_motion_list->mEaseInDuration)) { LL_WARNS() << "can't read easeIn" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if (!dp.unpackF32(joint_motion_list->mEaseOutDuration, "ease_out_duration") || !llfinite(joint_motion_list->mEaseOutDuration)) { LL_WARNS() << "can't read easeOut" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } //------------------------------------------------------------------------- @@ -1381,15 +1410,15 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackU32(word, "hand_pose")) { LL_WARNS() << "can't read hand pose" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } - if(word > LLHandMotion::NUM_HAND_POSES) + if (word > LLHandMotion::NUM_HAND_POSES) { LL_WARNS() << "invalid LLHandMotion::eHandPose index: " << word - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } joint_motion_list->mHandPose = (LLHandMotion::eHandPose)word; @@ -1398,26 +1427,26 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo // get number of joint motions //------------------------------------------------------------------------- U32 num_motions = 0; - S32 rotation_dupplicates = 0; - S32 position_dupplicates = 0; + S32 rotation_duplicates = 0; + S32 position_duplicates = 0; if (!dp.unpackU32(num_motions, "num_joints")) { LL_WARNS() << "can't read number of joints" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if (num_motions == 0) { LL_WARNS() << "no joints" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } else if (num_motions > LL_CHARACTER_MAX_ANIMATED_JOINTS) { LL_WARNS() << "too many joints" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } joint_motion_list->mJointMotionArray.clear(); @@ -1429,7 +1458,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo // initialize joint motions //------------------------------------------------------------------------- - for(U32 i=0; i<num_motions; ++i) + for (U32 i = 0; i < num_motions; ++i) { JointMotion* joint_motion = new JointMotion; joint_motion_list->mJointMotionArray.push_back(joint_motion); @@ -1438,15 +1467,15 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackString(joint_name, "joint_name")) { LL_WARNS() << "can't read joint name" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if (joint_name == "mScreen" || joint_name == "mRoot") { LL_WARNS() << "attempted to animate special " << joint_name << " joint" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } //--------------------------------------------------------------------- @@ -1463,17 +1492,17 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo LL_WARNS() << "Joint will be omitted from animation: joint_num " << joint_num << " is outside of legal range [0-" << LL_CHARACTER_MAX_ANIMATED_JOINTS << ") for joint " << joint->getName() - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; joint = NULL; } } else { LL_WARNS() << "invalid joint name: " << joint_name - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; if (!allow_invalid_joints) { - return FALSE; + return false; } } @@ -1491,15 +1520,15 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackS32(joint_priority, "joint_priority")) { LL_WARNS() << "can't read joint priority." - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if (joint_priority < LLJoint::USE_MOTION_PRIORITY) { LL_WARNS() << "joint priority unknown - too low." - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } joint_motion->mPriority = (LLJoint::JointPriority)joint_priority; @@ -1517,8 +1546,8 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackS32(joint_motion->mRotationCurve.mNumKeys, "num_rot_keys") || joint_motion->mRotationCurve.mNumKeys < 0) { LL_WARNS() << "can't read number of rotation keys" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } joint_motion->mRotationCurve.mInterpolationType = IT_LINEAR; @@ -1543,8 +1572,8 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo !llfinite(time)) { LL_WARNS() << "can't read rotation key (" << k << ")" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } } @@ -1553,8 +1582,8 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackU16(time_short, "time")) { LL_WARNS() << "can't read rotation key (" << k << ")" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } time = U16_to_F32(time_short, 0.f, joint_motion_list->mDuration); @@ -1562,8 +1591,8 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (time < 0 || time > joint_motion_list->mDuration) { LL_WARNS() << "invalid frame time" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } } @@ -1576,13 +1605,15 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo { if (!dp.unpackVector3(rot_angles, "rot_angles")) { - LL_WARNS() << "can't read rot_angles in rotation key (" << k << ")" << LL_ENDL; - return FALSE; + LL_WARNS() << "can't read rot_angles in rotation key (" << k << ")" + << " for animation " << asset() << LL_ENDL; + return false; } if (!rot_angles.isFinite()) { - LL_WARNS() << "non-finite angle in rotation key (" << k << ")" << LL_ENDL; - return FALSE; + LL_WARNS() << "non-finite angle in rotation key (" << k << ")" + << " for animation " << asset() << LL_ENDL; + return false; } LLQuaternion::Order ro = StringToOrder("ZYX"); @@ -1592,18 +1623,21 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo { if (!dp.unpackU16(x, "rot_angle_x")) { - LL_WARNS() << "can't read rot_angle_x in rotation key (" << k << ")" << LL_ENDL; - return FALSE; + LL_WARNS() << "can't read rot_angle_x in rotation key (" << k << ")" + << " for animation " << asset() << LL_ENDL; + return false; } if (!dp.unpackU16(y, "rot_angle_y")) { - LL_WARNS() << "can't read rot_angle_y in rotation key (" << k << ")" << LL_ENDL; - return FALSE; + LL_WARNS() << "can't read rot_angle_y in rotation key (" << k << ")" + << " for animation " << asset() << LL_ENDL; + return false; } if (!dp.unpackU16(z, "rot_angle_z")) { - LL_WARNS() << "can't read rot_angle_z in rotation key (" << k << ")" << LL_ENDL; - return FALSE; + LL_WARNS() << "can't read rot_angle_z in rotation key (" << k << ")" + << " for animation " << asset() << LL_ENDL; + return false; } LLVector3 rot_vec; @@ -1611,20 +1645,20 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo rot_vec.mV[VY] = U16_to_F32(y, -1.f, 1.f); rot_vec.mV[VZ] = U16_to_F32(z, -1.f, 1.f); - if(!rot_vec.isFinite()) + if (!rot_vec.isFinite()) { LL_WARNS() << "non-finite angle in rotation key (" << k << ")" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } rot_key.mRotation.unpackFromVector3(rot_vec); } - if(!rot_key.mRotation.isFinite()) + if (!rot_key.mRotation.isFinite()) { LL_WARNS() << "non-finite angle in rotation key (" << k << ")" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } rCurve->mKeys[time] = rot_key; @@ -1632,8 +1666,10 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (joint_motion->mRotationCurve.mNumKeys > joint_motion->mRotationCurve.mKeys.size()) { - rotation_dupplicates++; - LL_INFOS() << "Motion: " << asset_id << " had dupplicate rotation keys that were removed" << LL_ENDL; + rotation_duplicates++; + LL_INFOS() << "Motion " << asset() << " had duplicated rotation keys that were removed: " + << joint_motion->mRotationCurve.mNumKeys << " > " << joint_motion->mRotationCurve.mKeys.size() + << " (" << rotation_duplicates << ")" << LL_ENDL; } //--------------------------------------------------------------------- @@ -1642,8 +1678,8 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackS32(joint_motion->mPositionCurve.mNumKeys, "num_pos_keys") || joint_motion->mPositionCurve.mNumKeys < 0) { LL_WARNS() << "can't read number of position keys" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } joint_motion->mPositionCurve.mInterpolationType = IT_LINEAR; @@ -1656,7 +1692,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo // scan position curve keys //--------------------------------------------------------------------- PositionCurve *pCurve = &joint_motion->mPositionCurve; - BOOL is_pelvis = joint_motion->mJointName == "mPelvis"; + bool is_pelvis = joint_motion->mJointName == "mPelvis"; for (S32 k = 0; k < joint_motion->mPositionCurve.mNumKeys; k++) { U16 time_short; @@ -1668,8 +1704,8 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo !llfinite(pos_key.mTime)) { LL_WARNS() << "can't read position key (" << k << ")" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } } else @@ -1677,8 +1713,8 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackU16(time_short, "time")) { LL_WARNS() << "can't read position key (" << k << ")" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } pos_key.mTime = U16_to_F32(time_short, 0.f, joint_motion_list->mDuration); @@ -1688,8 +1724,9 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo { if (!dp.unpackVector3(pos_key.mPosition, "pos")) { - LL_WARNS() << "can't read pos in position key (" << k << ")" << LL_ENDL; - return FALSE; + LL_WARNS() << "can't read pos in position key (" << k << ")" + << " for animation " << asset() << LL_ENDL; + return false; } //MAINT-6162 @@ -1704,18 +1741,21 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackU16(x, "pos_x")) { - LL_WARNS() << "can't read pos_x in position key (" << k << ")" << LL_ENDL; - return FALSE; + LL_WARNS() << "can't read pos_x in position key (" << k << ")" + << " for animation " << asset() << LL_ENDL; + return false; } if (!dp.unpackU16(y, "pos_y")) { - LL_WARNS() << "can't read pos_y in position key (" << k << ")" << LL_ENDL; - return FALSE; + LL_WARNS() << "can't read pos_y in position key (" << k << ")" + << " for animation " << asset() << LL_ENDL; + return false; } if (!dp.unpackU16(z, "pos_z")) { - LL_WARNS() << "can't read pos_z in position key (" << k << ")" << LL_ENDL; - return FALSE; + LL_WARNS() << "can't read pos_z in position key (" << k << ")" + << " for animation " << asset() << LL_ENDL; + return false; } pos_key.mPosition.mV[VX] = U16_to_F32(x, -LL_MAX_PELVIS_OFFSET, LL_MAX_PELVIS_OFFSET); @@ -1723,11 +1763,11 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo pos_key.mPosition.mV[VZ] = U16_to_F32(z, -LL_MAX_PELVIS_OFFSET, LL_MAX_PELVIS_OFFSET); } - if(!pos_key.mPosition.isFinite()) + if (!pos_key.mPosition.isFinite()) { LL_WARNS() << "non-finite position in key" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } pCurve->mKeys[pos_key.mTime] = pos_key; @@ -1740,20 +1780,25 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (joint_motion->mPositionCurve.mNumKeys > joint_motion->mPositionCurve.mKeys.size()) { - position_dupplicates++; + position_duplicates++; + LL_INFOS() << "Motion " << asset() << " had duplicated position keys that were removed: " + << joint_motion->mPositionCurve.mNumKeys << " > " << joint_motion->mPositionCurve.mKeys.size() + << " (" << position_duplicates << ")" << LL_ENDL; } joint_motion->mUsage = joint_state->getUsage(); } - if (rotation_dupplicates > 0) + if (rotation_duplicates > 0) { - LL_INFOS() << "Motion: " << asset_id << " had " << rotation_dupplicates << " dupplicate rotation keys that were removed" << LL_ENDL; + LL_INFOS() << "Motion " << asset() << " had " << rotation_duplicates + << " duplicated rotation keys that were removed" << LL_ENDL; } - if (position_dupplicates > 0) + if (position_duplicates > 0) { - LL_INFOS() << "Motion: " << asset_id << " had " << position_dupplicates << " dupplicate position keys that were removed" << LL_ENDL; + LL_INFOS() << "Motion " << asset() << " had " << position_duplicates + << " duplicated position keys that were removed" << LL_ENDL; } //------------------------------------------------------------------------- @@ -1763,14 +1808,14 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackS32(num_constraints, "num_constraints")) { LL_WARNS() << "can't read number of constraints" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if (num_constraints > MAX_CONSTRAINTS || num_constraints < 0) { LL_WARNS() << "Bad number of constraints... ignoring: " << num_constraints - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; } else { @@ -1787,30 +1832,30 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackU8(byte, "chain_length")) { LL_WARNS() << "can't read constraint chain length" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } constraintp->mChainLength = (S32) byte; if((U32)constraintp->mChainLength > joint_motion_list->getNumJointMotions()) { LL_WARNS() << "invalid constraint chain length" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if (!dp.unpackU8(byte, "constraint_type")) { LL_WARNS() << "can't read constraint type" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if( byte >= NUM_CONSTRAINT_TYPES ) { LL_WARNS() << "invalid constraint type" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } constraintp->mConstraintType = (EConstraintType)byte; @@ -1819,8 +1864,8 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackBinaryDataFixed(bin_data, BIN_DATA_LENGTH, "source_volume")) { LL_WARNS() << "can't read source volume name" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } bin_data[BIN_DATA_LENGTH] = 0; // Ensure null termination @@ -1829,29 +1874,29 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (constraintp->mSourceConstraintVolume == -1) { LL_WARNS() << "not a valid source constraint volume " << str - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if (!dp.unpackVector3(constraintp->mSourceConstraintOffset, "source_offset")) { LL_WARNS() << "can't read constraint source offset" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if( !(constraintp->mSourceConstraintOffset.isFinite()) ) { LL_WARNS() << "non-finite constraint source offset" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if (!dp.unpackBinaryDataFixed(bin_data, BIN_DATA_LENGTH, "target_volume")) { LL_WARNS() << "can't read target volume name" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } bin_data[BIN_DATA_LENGTH] = 0; // Ensure null termination @@ -1868,78 +1913,78 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (constraintp->mTargetConstraintVolume == -1) { LL_WARNS() << "not a valid target constraint volume " << str - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } } if (!dp.unpackVector3(constraintp->mTargetConstraintOffset, "target_offset")) { LL_WARNS() << "can't read constraint target offset" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if( !(constraintp->mTargetConstraintOffset.isFinite()) ) { LL_WARNS() << "non-finite constraint target offset" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if (!dp.unpackVector3(constraintp->mTargetConstraintDir, "target_dir")) { LL_WARNS() << "can't read constraint target direction" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if( !(constraintp->mTargetConstraintDir.isFinite()) ) { LL_WARNS() << "non-finite constraint target direction" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if (!constraintp->mTargetConstraintDir.isExactlyZero()) { - constraintp->mUseTargetOffset = TRUE; + constraintp->mUseTargetOffset = true; // constraintp->mTargetConstraintDir *= constraintp->mSourceConstraintOffset.magVec(); } if (!dp.unpackF32(constraintp->mEaseInStartTime, "ease_in_start") || !llfinite(constraintp->mEaseInStartTime)) { LL_WARNS() << "can't read constraint ease in start time" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if (!dp.unpackF32(constraintp->mEaseInStopTime, "ease_in_stop") || !llfinite(constraintp->mEaseInStopTime)) { LL_WARNS() << "can't read constraint ease in stop time" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if (!dp.unpackF32(constraintp->mEaseOutStartTime, "ease_out_start") || !llfinite(constraintp->mEaseOutStartTime)) { LL_WARNS() << "can't read constraint ease out start time" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if (!dp.unpackF32(constraintp->mEaseOutStopTime, "ease_out_stop") || !llfinite(constraintp->mEaseOutStopTime)) { LL_WARNS() << "can't read constraint ease out stop time" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } LLJoint* joint = mCharacter->findCollisionVolume(constraintp->mSourceConstraintVolume); // get joint to which this collision volume is attached if (!joint) { - return FALSE; + return false; } constraintp->mJointStateIndices = new S32[constraintp->mChainLength + 1]; // note: mChainLength is size-limited - comes from a byte @@ -1951,8 +1996,8 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo { LL_WARNS() << "Joint with no parent: " << joint->getName() << " Emote: " << joint_motion_list->mEmoteName - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } joint = parent; constraintp->mJointStateIndices[i] = -1; @@ -1963,8 +2008,8 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if ( !constraint_joint ) { LL_WARNS() << "Invalid joint " << j - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if(constraint_joint == joint) @@ -1976,8 +2021,8 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (constraintp->mJointStateIndices[i] < 0 ) { LL_WARNS() << "No joint index for constraint " << i - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } } @@ -1992,15 +2037,15 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo setupPose(); - return TRUE; + return true; } //----------------------------------------------------------------------------- // serialize() //----------------------------------------------------------------------------- -BOOL LLKeyframeMotion::serialize(LLDataPacker& dp) const +bool LLKeyframeMotion::serialize(LLDataPacker& dp) const { - BOOL success = TRUE; + bool success = true; LL_DEBUGS("BVH") << "serializing" << LL_ENDL; @@ -2035,7 +2080,7 @@ BOOL LLKeyframeMotion::serialize(LLDataPacker& dp) const JointMotion* joint_motionp = mJointMotionList->getJointMotion(i); success &= dp.packString(joint_motionp->mJointName, "joint_name"); success &= dp.packS32(joint_motionp->mPriority, "joint_priority"); - success &= dp.packS32(joint_motionp->mRotationCurve.mKeys.size(), "num_rot_keys"); + success &= dp.packS32(static_cast<S32>(joint_motionp->mRotationCurve.mKeys.size()), "num_rot_keys"); LL_DEBUGS("BVH") << "Joint " << i << " name: " << joint_motionp->mJointName @@ -2061,7 +2106,7 @@ BOOL LLKeyframeMotion::serialize(LLDataPacker& dp) const LL_DEBUGS("BVH") << " rot: t " << rot_key.mTime << " angles " << rot_angles.mV[VX] <<","<< rot_angles.mV[VY] <<","<< rot_angles.mV[VZ] << LL_ENDL; } - success &= dp.packS32(joint_motionp->mPositionCurve.mKeys.size(), "num_pos_keys"); + success &= dp.packS32(static_cast<S32>(joint_motionp->mPositionCurve.mKeys.size()), "num_pos_keys"); for (PositionCurve::key_map_t::value_type& pos_pair : joint_motionp->mPositionCurve.mKeys) { PositionKey& pos_key = pos_pair.second; @@ -2081,7 +2126,7 @@ BOOL LLKeyframeMotion::serialize(LLDataPacker& dp) const } } - success &= dp.packS32(mJointMotionList->mConstraints.size(), "num_constraints"); + success &= dp.packS32(static_cast<S32>(mJointMotionList->mConstraints.size()), "num_constraints"); LL_DEBUGS("BVH") << "num_constraints " << mJointMotionList->mConstraints.size() << LL_ENDL; for (JointConstraintSharedData* shared_constraintp : mJointMotionList->mConstraints) { @@ -2241,10 +2286,12 @@ void LLKeyframeMotion::setEmote(const LLUUID& emote_id) if (emote_name) { mJointMotionList->mEmoteName = emote_name; + mJointMotionList->mEmoteID = emote_id; } else { - mJointMotionList->mEmoteName = ""; + mJointMotionList->mEmoteName.clear(); + mJointMotionList->mEmoteID.setNull(); } } @@ -2283,7 +2330,7 @@ void LLKeyframeMotion::flushKeyframeCache() //----------------------------------------------------------------------------- // setLoop() //----------------------------------------------------------------------------- -void LLKeyframeMotion::setLoop(BOOL loop) +void LLKeyframeMotion::setLoop(bool loop) { if (mJointMotionList) { @@ -2515,7 +2562,7 @@ LLKeyframeMotion::JointConstraint::JointConstraint(JointConstraintSharedData* sh { mWeight = 0.f; mTotalLength = 0.f; - mActive = FALSE; + mActive = false; mSourceVolume = NULL; mTargetVolume = NULL; mFixupDistanceRMS = 0.f; diff --git a/indra/llcharacter/llkeyframemotion.h b/indra/llcharacter/llkeyframemotion.h index b1c4f5afb7..d5b27c8102 100644 --- a/indra/llcharacter/llkeyframemotion.h +++ b/indra/llcharacter/llkeyframemotion.h @@ -86,9 +86,9 @@ public: //------------------------------------------------------------------------- // motions must specify whether or not they loop - virtual BOOL getLoop() { + virtual bool getLoop() { if (mJointMotionList) return mJointMotionList->mLoop; - else return FALSE; + else return false; } // motions must report their total duration @@ -135,14 +135,14 @@ public: virtual LLMotionInitStatus onInitialize(LLCharacter *character); // called when a motion is activated - // must return TRUE to indicate success, or else + // must return true to indicate success, or else // it will be deactivated - virtual BOOL onActivate(); + virtual bool onActivate(); // called per time step - // must return TRUE while it is active, and - // must return FALSE when the motion is completed. - virtual BOOL onUpdate(F32 time, U8* joint_mask); + // must return true while it is active, and + // must return false when the motion is completed. + virtual bool onUpdate(F32 time, U8* joint_mask); // called when a motion is deactivated virtual void onDeactivate(); @@ -155,14 +155,14 @@ public: public: U32 getFileSize(); - BOOL serialize(LLDataPacker& dp) const; - BOOL deserialize(LLDataPacker& dp, const LLUUID& asset_id, bool allow_invalid_joints = true); - BOOL isLoaded() { return mJointMotionList != NULL; } + bool serialize(LLDataPacker& dp) const; + bool deserialize(LLDataPacker& dp, const LLUUID& asset_id, bool allow_invalid_joints = true); + bool isLoaded() { return mJointMotionList != NULL; } bool dumpToFile(const std::string& name); // setters for modifying a keyframe animation - void setLoop(BOOL loop); + void setLoop(bool loop); F32 getLoopIn() { return (mJointMotionList) ? mJointMotionList->mLoopInPoint : 0.f; @@ -211,7 +211,7 @@ protected: mEaseInStopTime(0.f), mEaseOutStartTime(0.f), mEaseOutStopTime(0.f), - mUseTargetOffset(FALSE), + mUseTargetOffset(false), mConstraintType(CONSTRAINT_TYPE_POINT), mConstraintTargetType(CONSTRAINT_TARGET_TYPE_BODY), mSourceConstraintVolume(0), @@ -231,7 +231,7 @@ protected: F32 mEaseInStopTime; F32 mEaseOutStartTime; F32 mEaseOutStopTime; - BOOL mUseTargetOffset; + bool mUseTargetOffset; EConstraintType mConstraintType; EConstraintTargetType mConstraintTargetType; }; @@ -251,7 +251,7 @@ protected: LLVector3 mPositions[MAX_CHAIN_LENGTH]; F32 mJointLengths[MAX_CHAIN_LENGTH]; F32 mJointLengthFractions[MAX_CHAIN_LENGTH]; - BOOL mActive; + bool mActive; LLVector3d mGroundPos; LLVector3 mGroundNorm; LLJoint* mSourceVolume; @@ -271,7 +271,7 @@ protected: void applyConstraint(JointConstraint* constraintp, F32 time, U8* joint_mask); - BOOL setupPose(); + bool setupPose(); public: enum AssetStatus { ASSET_LOADED, ASSET_FETCHED, ASSET_NEEDS_FETCH, ASSET_FETCH_FAILED, ASSET_UNDEFINED }; @@ -398,7 +398,7 @@ public: public: std::vector<JointMotion*> mJointMotionArray; F32 mDuration; - BOOL mLoop; + bool mLoop; F32 mLoopInPoint; F32 mLoopOutPoint; F32 mEaseInDuration; @@ -413,12 +413,14 @@ public: // TODO: LLKeyframeDataCache::getKeyframeData should probably return a class containing // JointMotionList and mEmoteName, see LLKeyframeMotion::onInitialize. std::string mEmoteName; + LLUUID mEmoteID; + public: JointMotionList(); ~JointMotionList(); U32 dumpDiagInfo(); JointMotion* getJointMotion(U32 index) const { llassert(index < mJointMotionArray.size()); return mJointMotionArray[index]; } - U32 getNumJointMotions() const { return mJointMotionArray.size(); } + U32 getNumJointMotions() const { return static_cast<U32>(mJointMotionArray.size()); } }; protected: diff --git a/indra/llcharacter/llkeyframemotionparam.cpp b/indra/llcharacter/llkeyframemotionparam.cpp index 3082d30897..e4552b96c9 100644 --- a/indra/llcharacter/llkeyframemotionparam.cpp +++ b/indra/llcharacter/llkeyframemotionparam.cpp @@ -133,7 +133,7 @@ LLMotion::LLMotionInitStatus LLKeyframeMotionParam::onInitialize(LLCharacter *ch //----------------------------------------------------------------------------- // LLKeyframeMotionParam::onActivate() //----------------------------------------------------------------------------- -BOOL LLKeyframeMotionParam::onActivate() +bool LLKeyframeMotionParam::onActivate() { for (motion_map_t::value_type& motion_pair : mParameterizedMotions) { @@ -143,14 +143,14 @@ BOOL LLKeyframeMotionParam::onActivate() paramMotion.mMotion->activate(mActivationTimestamp); } } - return TRUE; + return true; } //----------------------------------------------------------------------------- // LLKeyframeMotionParam::onUpdate() //----------------------------------------------------------------------------- -BOOL LLKeyframeMotionParam::onUpdate(F32 time, U8* joint_mask) +bool LLKeyframeMotionParam::onUpdate(F32 time, U8* joint_mask) { LL_PROFILE_ZONE_SCOPED; F32 weightFactor = 1.f / (F32)mParameterizedMotions.size(); @@ -262,7 +262,7 @@ BOOL LLKeyframeMotionParam::onUpdate(F32 time, U8* joint_mask) LL_INFOS() << "Param Motion weight " << mPoseBlender.getBlendedPose()->getWeight() << LL_ENDL; - return TRUE; + return true; } //----------------------------------------------------------------------------- @@ -283,13 +283,13 @@ void LLKeyframeMotionParam::onDeactivate() //----------------------------------------------------------------------------- // LLKeyframeMotionParam::addKeyframeMotion() //----------------------------------------------------------------------------- -BOOL LLKeyframeMotionParam::addKeyframeMotion(char *name, const LLUUID &id, char *param, F32 value) +bool LLKeyframeMotionParam::addKeyframeMotion(char *name, const LLUUID &id, char *param, F32 value) { LLMotion *newMotion = mCharacter->createMotion( id ); if (!newMotion) { - return FALSE; + return false; } newMotion->setName(name); @@ -297,7 +297,7 @@ BOOL LLKeyframeMotionParam::addKeyframeMotion(char *name, const LLUUID &id, char // now add motion to this list mParameterizedMotions[param].insert(ParameterizedMotion(newMotion, value)); - return TRUE; + return true; } @@ -322,7 +322,7 @@ void LLKeyframeMotionParam::setDefaultKeyframeMotion(char *name) //----------------------------------------------------------------------------- // loadMotions() //----------------------------------------------------------------------------- -BOOL LLKeyframeMotionParam::loadMotions() +bool LLKeyframeMotionParam::loadMotions() { //------------------------------------------------------------------------- // Load named file by concatenating the character prefix with the motion name. @@ -344,7 +344,7 @@ BOOL LLKeyframeMotionParam::loadMotions() if (!fp || fileSize == 0) { LL_INFOS() << "ERROR: can't open: " << path << LL_ENDL; - return FALSE; + return false; } // allocate a text buffer @@ -383,7 +383,7 @@ BOOL LLKeyframeMotionParam::loadMotions() if ( error ) { LL_INFOS() << "ERROR: error while reading from " << path << LL_ENDL; - return FALSE; + return false; } LL_INFOS() << "Loading parametric keyframe data for: " << getName() << LL_ENDL; @@ -401,7 +401,7 @@ BOOL LLKeyframeMotionParam::loadMotions() //------------------------------------------------------------------------- // get priority //------------------------------------------------------------------------- - BOOL isFirstMotion = TRUE; + bool isFirstMotion = true; num = sscanf(p, "%79s %79s %f", strA, strB, &floatA); /* Flawfinder: ignore */ while(1) @@ -410,13 +410,13 @@ BOOL LLKeyframeMotionParam::loadMotions() if ((num != 3)) { LL_INFOS() << "WARNING: can't read parametric motion" << LL_ENDL; - return FALSE; + return false; } addKeyframeMotion(strA, gAnimLibrary.stringToAnimState(std::string(strA)), strB, floatA); if (isFirstMotion) { - isFirstMotion = FALSE; + isFirstMotion = false; setDefaultKeyframeMotion(strA); } @@ -430,7 +430,7 @@ BOOL LLKeyframeMotionParam::loadMotions() num = sscanf(p, "%79s %79s %f", strA, strB, &floatA); /* Flawfinder: ignore */ } - return TRUE; + return true; } // End diff --git a/indra/llcharacter/llkeyframemotionparam.h b/indra/llcharacter/llkeyframemotionparam.h index c906a25ceb..8c57766e9b 100644 --- a/indra/llcharacter/llkeyframemotionparam.h +++ b/indra/llcharacter/llkeyframemotionparam.h @@ -67,8 +67,8 @@ public: //------------------------------------------------------------------------- // motions must specify whether or not they loop - virtual BOOL getLoop() { - return TRUE; + virtual bool getLoop() { + return true; } // motions must report their total duration @@ -102,14 +102,14 @@ public: virtual LLMotionInitStatus onInitialize(LLCharacter *character); // called when a motion is activated - // must return TRUE to indicate success, or else + // must return true to indicate success, or else // it will be deactivated - virtual BOOL onActivate(); + virtual bool onActivate(); // called per time step - // must return TRUE while it is active, and - // must return FALSE when the motion is completed. - virtual BOOL onUpdate(F32 time, U8* joint_mask); + // must return true while it is active, and + // must return false when the motion is completed. + virtual bool onUpdate(F32 time, U8* joint_mask); // called when a motion is deactivated virtual void onDeactivate(); @@ -128,12 +128,12 @@ protected: }; // add a motion and associated parameter triplet - BOOL addKeyframeMotion(char *name, const LLUUID &id, char *param, F32 value); + bool addKeyframeMotion(char *name, const LLUUID &id, char *param, F32 value); // set default motion for LOD and retrieving blend constants void setDefaultKeyframeMotion(char *); - BOOL loadMotions(); + bool loadMotions(); protected: //------------------------------------------------------------------------- diff --git a/indra/llcharacter/llkeyframestandmotion.cpp b/indra/llcharacter/llkeyframestandmotion.cpp index 16f4cdc115..a882ab3563 100644 --- a/indra/llcharacter/llkeyframestandmotion.cpp +++ b/indra/llcharacter/llkeyframestandmotion.cpp @@ -46,7 +46,7 @@ const F32 POSITION_THRESHOLD = 0.1f; //----------------------------------------------------------------------------- LLKeyframeStandMotion::LLKeyframeStandMotion(const LLUUID &id) : LLKeyframeMotion(id) { - mFlipFeet = FALSE; + mFlipFeet = false; mCharacter = NULL; // create kinematic hierarchy @@ -67,7 +67,7 @@ LLKeyframeStandMotion::LLKeyframeStandMotion(const LLUUID &id) : LLKeyframeMotio mKneeRightState = NULL; mAnkleRightState = NULL; - mTrackAnkles = TRUE; + mTrackAnkles = true; mFrameNum = 0; } @@ -90,7 +90,7 @@ LLMotion::LLMotionInitStatus LLKeyframeStandMotion::onInitialize(LLCharacter *ch // save character pointer for later use mCharacter = character; - mFlipFeet = FALSE; + mFlipFeet = false; // load keyframe data, setup pose and joint states LLMotion::LLMotionInitStatus status = LLKeyframeMotion::onInitialize(character); @@ -129,7 +129,7 @@ LLMotion::LLMotionInitStatus LLKeyframeStandMotion::onInitialize(LLCharacter *ch //----------------------------------------------------------------------------- // LLKeyframeStandMotion::onActivate() //----------------------------------------------------------------------------- -BOOL LLKeyframeStandMotion::onActivate() +bool LLKeyframeStandMotion::onActivate() { //------------------------------------------------------------------------- // setup the IK solvers @@ -158,15 +158,15 @@ void LLKeyframeStandMotion::onDeactivate() //----------------------------------------------------------------------------- // LLKeyframeStandMotion::onUpdate() //----------------------------------------------------------------------------- -BOOL LLKeyframeStandMotion::onUpdate(F32 time, U8* joint_mask) +bool LLKeyframeStandMotion::onUpdate(F32 time, U8* joint_mask) { //------------------------------------------------------------------------- // let the base class update the cycle //------------------------------------------------------------------------- - BOOL status = LLKeyframeMotion::onUpdate(time, joint_mask); + bool status = LLKeyframeMotion::onUpdate(time, joint_mask); if (!status) { - return FALSE; + return false; } LLVector3 root_world_pos = mPelvisState->getJoint()->getParent()->getWorldPosition(); @@ -174,7 +174,7 @@ BOOL LLKeyframeStandMotion::onUpdate(F32 time, U8* joint_mask) // have we received a valid world position for this avatar? if (root_world_pos.isExactlyZero()) { - return TRUE; + return true; } //------------------------------------------------------------------------- @@ -185,16 +185,16 @@ BOOL LLKeyframeStandMotion::onUpdate(F32 time, U8* joint_mask) { mLastGoodPelvisRotation = mPelvisState->getJoint()->getWorldRotation(); mLastGoodPelvisRotation.normalize(); - mTrackAnkles = TRUE; + mTrackAnkles = true; } else if ((mCharacter->getCharacterPosition() - mLastGoodPosition).magVecSquared() > POSITION_THRESHOLD) { mLastGoodPosition = mCharacter->getCharacterPosition(); - mTrackAnkles = TRUE; + mTrackAnkles = true; } else if (mPose.getWeight() < 1.f) { - mTrackAnkles = TRUE; + mTrackAnkles = true; } @@ -255,7 +255,7 @@ BOOL LLKeyframeStandMotion::onUpdate(F32 time, U8* joint_mask) else if (mFrameNum < 2) { mFrameNum++; - return TRUE; + return true; } mFrameNum++; @@ -336,7 +336,7 @@ BOOL LLKeyframeStandMotion::onUpdate(F32 time, U8* joint_mask) //LL_INFOS() << "Stand drift amount " << (mCharacter->getCharacterPosition() - mLastGoodPosition).magVec() << LL_ENDL; // LL_INFOS() << "DEBUG: " << speed << " : " << mTrackAnkles << LL_ENDL; - return TRUE; + return true; } // End diff --git a/indra/llcharacter/llkeyframestandmotion.h b/indra/llcharacter/llkeyframestandmotion.h index 2e3634828f..df458c7a0c 100644 --- a/indra/llcharacter/llkeyframestandmotion.h +++ b/indra/llcharacter/llkeyframestandmotion.h @@ -63,9 +63,9 @@ public: // animation callbacks to be implemented by subclasses //------------------------------------------------------------------------- virtual LLMotionInitStatus onInitialize(LLCharacter *character); - virtual BOOL onActivate(); + virtual bool onActivate(); void onDeactivate(); - virtual BOOL onUpdate(F32 time, U8* joint_mask); + virtual bool onUpdate(F32 time, U8* joint_mask); public: //------------------------------------------------------------------------- @@ -85,7 +85,7 @@ public: LLCharacter *mCharacter; - BOOL mFlipFeet; + bool mFlipFeet; LLPointer<LLJointState> mPelvisState; @@ -109,7 +109,7 @@ public: LLQuaternion mLastGoodPelvisRotation; LLVector3 mLastGoodPosition; - BOOL mTrackAnkles; + bool mTrackAnkles; S32 mFrameNum; } LL_ALIGN_POSTFIX(16); diff --git a/indra/llcharacter/llkeyframewalkmotion.cpp b/indra/llcharacter/llkeyframewalkmotion.cpp index 132fb85785..605e15f442 100644 --- a/indra/llcharacter/llkeyframewalkmotion.cpp +++ b/indra/llcharacter/llkeyframewalkmotion.cpp @@ -83,7 +83,7 @@ LLMotion::LLMotionInitStatus LLKeyframeWalkMotion::onInitialize(LLCharacter *cha //----------------------------------------------------------------------------- // LLKeyframeWalkMotion::onActivate() //----------------------------------------------------------------------------- -BOOL LLKeyframeWalkMotion::onActivate() +bool LLKeyframeWalkMotion::onActivate() { mRealTimeLast = 0.0f; mAdjTimeLast = 0.0f; @@ -103,7 +103,7 @@ void LLKeyframeWalkMotion::onDeactivate() //----------------------------------------------------------------------------- // LLKeyframeWalkMotion::onUpdate() //----------------------------------------------------------------------------- -BOOL LLKeyframeWalkMotion::onUpdate(F32 time, U8* joint_mask) +bool LLKeyframeWalkMotion::onUpdate(F32 time, U8* joint_mask) { LL_PROFILE_ZONE_SCOPED; // compute time since last update @@ -174,7 +174,7 @@ LLMotion::LLMotionInitStatus LLWalkAdjustMotion::onInitialize(LLCharacter *chara //----------------------------------------------------------------------------- // LLWalkAdjustMotion::onActivate() //----------------------------------------------------------------------------- -BOOL LLWalkAdjustMotion::onActivate() +bool LLWalkAdjustMotion::onActivate() { mAnimSpeed = 0.f; mAdjustedSpeed = 0.f; @@ -191,13 +191,13 @@ BOOL LLWalkAdjustMotion::onActivate() F32 rightAnkleOffset = (mRightAnkleJoint->getWorldPosition() - mCharacter->getCharacterPosition()).magVec(); mAnkleOffset = llmax(leftAnkleOffset, rightAnkleOffset); - return TRUE; + return true; } //----------------------------------------------------------------------------- // LLWalkAdjustMotion::onUpdate() //----------------------------------------------------------------------------- -BOOL LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask) +bool LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask) { LL_PROFILE_ZONE_SCOPED; // delta_time is guaranteed to be non zero @@ -315,7 +315,7 @@ BOOL LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask) // need to update *some* joint to keep this animation active mPelvisState->setPosition(mPelvisOffset); - return TRUE; + return true; } //----------------------------------------------------------------------------- @@ -362,18 +362,18 @@ LLMotion::LLMotionInitStatus LLFlyAdjustMotion::onInitialize(LLCharacter *charac //----------------------------------------------------------------------------- // LLFlyAdjustMotion::onActivate() //----------------------------------------------------------------------------- -BOOL LLFlyAdjustMotion::onActivate() +bool LLFlyAdjustMotion::onActivate() { mPelvisState->setPosition(LLVector3::zero); mPelvisState->setRotation(LLQuaternion::DEFAULT); mRoll = 0.f; - return TRUE; + return true; } //----------------------------------------------------------------------------- // LLFlyAdjustMotion::onUpdate() //----------------------------------------------------------------------------- -BOOL LLFlyAdjustMotion::onUpdate(F32 time, U8* joint_mask) +bool LLFlyAdjustMotion::onUpdate(F32 time, U8* joint_mask) { LL_PROFILE_ZONE_SCOPED; LLVector3 ang_vel = mCharacter->getCharacterAngularVelocity() * mCharacter->getTimeDilation(); @@ -388,6 +388,6 @@ BOOL LLFlyAdjustMotion::onUpdate(F32 time, U8* joint_mask) LLQuaternion roll(mRoll, LLVector3(0.f, 0.f, 1.f)); mPelvisState->setRotation(roll); - return TRUE; + return true; } diff --git a/indra/llcharacter/llkeyframewalkmotion.h b/indra/llcharacter/llkeyframewalkmotion.h index 110dbeeee3..6320c81399 100644 --- a/indra/llcharacter/llkeyframewalkmotion.h +++ b/indra/llcharacter/llkeyframewalkmotion.h @@ -65,9 +65,9 @@ public: // animation callbacks to be implemented by subclasses //------------------------------------------------------------------------- virtual LLMotionInitStatus onInitialize(LLCharacter *character); - virtual BOOL onActivate(); + virtual bool onActivate(); virtual void onDeactivate(); - virtual BOOL onUpdate(F32 time, U8* joint_mask); + virtual bool onUpdate(F32 time, U8* joint_mask); public: //------------------------------------------------------------------------- @@ -100,11 +100,11 @@ public: // animation callbacks to be implemented by subclasses //------------------------------------------------------------------------- virtual LLMotionInitStatus onInitialize(LLCharacter *character); - virtual BOOL onActivate(); + virtual bool onActivate(); virtual void onDeactivate(); - virtual BOOL onUpdate(F32 time, U8* joint_mask); + virtual bool onUpdate(F32 time, U8* joint_mask); virtual LLJoint::JointPriority getPriority(){return LLJoint::HIGH_PRIORITY;} - virtual BOOL getLoop() { return TRUE; } + virtual bool getLoop() { return true; } virtual F32 getDuration() { return 0.f; } virtual F32 getEaseInDuration() { return 0.f; } virtual F32 getEaseOutDuration() { return 0.f; } @@ -150,11 +150,11 @@ public: // animation callbacks to be implemented by subclasses //------------------------------------------------------------------------- virtual LLMotionInitStatus onInitialize(LLCharacter *character); - virtual BOOL onActivate(); + virtual bool onActivate(); virtual void onDeactivate() {}; - virtual BOOL onUpdate(F32 time, U8* joint_mask); + virtual bool onUpdate(F32 time, U8* joint_mask); virtual LLJoint::JointPriority getPriority(){return LLJoint::HIGHER_PRIORITY;} - virtual BOOL getLoop() { return TRUE; } + virtual bool getLoop() { return true; } virtual F32 getDuration() { return 0.f; } virtual F32 getEaseInDuration() { return 0.f; } virtual F32 getEaseOutDuration() { return 0.f; } diff --git a/indra/llcharacter/llmotion.cpp b/indra/llcharacter/llmotion.cpp index 0e0df26b04..bc9f578660 100644 --- a/indra/llcharacter/llmotion.cpp +++ b/indra/llcharacter/llmotion.cpp @@ -43,8 +43,8 @@ // Class Constructor //----------------------------------------------------------------------------- LLMotion::LLMotion( const LLUUID &id ) : - mStopped(TRUE), - mActive(FALSE), + mStopped(true), + mActive(false), mID(id), mActivationTimestamp(0.f), mStopTimestamp(0.f), @@ -132,10 +132,10 @@ void LLMotion::setDeactivateCallback( void (*cb)(void *), void* userdata ) void LLMotion::setStopTime(F32 time) { mStopTimestamp = time; - mStopped = TRUE; + mStopped = true; } -BOOL LLMotion::isBlending() +bool LLMotion::isBlending() { return mPose.getWeight() < 1.f; } @@ -146,8 +146,8 @@ BOOL LLMotion::isBlending() void LLMotion::activate(F32 time) { mActivationTimestamp = time; - mStopped = FALSE; - mActive = TRUE; + mStopped = false; + mActive = true; onActivate(); } @@ -156,7 +156,7 @@ void LLMotion::activate(F32 time) //----------------------------------------------------------------------------- void LLMotion::deactivate() { - mActive = FALSE; + mActive = false; mPose.setWeight(0.f); if (mDeactivateCallback) @@ -169,9 +169,9 @@ void LLMotion::deactivate() onDeactivate(); } -BOOL LLMotion::canDeprecate() +bool LLMotion::canDeprecate() { - return TRUE; + return true; } // End diff --git a/indra/llcharacter/llmotion.h b/indra/llcharacter/llmotion.h index d45b8bceb6..4120de76a5 100644 --- a/indra/llcharacter/llmotion.h +++ b/indra/llcharacter/llmotion.h @@ -91,21 +91,21 @@ public: virtual void setStopTime(F32 time); - BOOL isStopped() const { return mStopped; } + bool isStopped() const { return mStopped; } - void setStopped(BOOL stopped) { mStopped = stopped; } + void setStopped(bool stopped) { mStopped = stopped; } - BOOL isBlending(); + bool isBlending(); // Activation functions. // It is OK for other classes to activate a motion, // but only the controller can deactivate it. - // Thus, if mActive == TRUE, the motion *may* be on the controllers active list, - // but if mActive == FALSE, the motion is gauranteed not to be on the active list. + // Thus, if mActive == true, the motion *may* be on the controllers active list, + // but if mActive == false, the motion is gauranteed not to be on the active list. protected: // Used by LLMotionController only void deactivate(); - BOOL isActive() { return mActive; } + bool isActive() { return mActive; } public: void activate(F32 time); @@ -115,7 +115,7 @@ public: //------------------------------------------------------------------------- // motions must specify whether or not they loop - virtual BOOL getLoop() = 0; + virtual bool getLoop() = 0; // motions must report their total duration virtual F32 getDuration() = 0; @@ -144,33 +144,33 @@ public: virtual LLMotionInitStatus onInitialize(LLCharacter *character) = 0; // called per time step - // must return TRUE while it is active, and - // must return FALSE when the motion is completed. - virtual BOOL onUpdate(F32 activeTime, U8* joint_mask) = 0; + // must return true while it is active, and + // must return false when the motion is completed. + virtual bool onUpdate(F32 activeTime, U8* joint_mask) = 0; // called when a motion is deactivated virtual void onDeactivate() = 0; // can we crossfade this motion with a new instance when restarted? - // should ultimately always be TRUE, but lack of emote blending, etc + // should ultimately always be true, but lack of emote blending, etc // requires this - virtual BOOL canDeprecate(); + virtual bool canDeprecate(); // optional callback routine called when animation deactivated. void setDeactivateCallback( void (*cb)(void *), void* userdata ); protected: // called when a motion is activated - // must return TRUE to indicate success, or else + // must return true to indicate success, or else // it will be deactivated - virtual BOOL onActivate() = 0; + virtual bool onActivate() = 0; void addJointState(const LLPointer<LLJointState>& jointState); protected: LLPose mPose; - BOOL mStopped; // motion has been stopped; - BOOL mActive; // motion is on active list (can be stopped or not stopped) + bool mStopped; // motion has been stopped; + bool mActive; // motion is on active list (can be stopped or not stopped) //------------------------------------------------------------------------- // these are set implicitly by the motion controller and @@ -199,7 +199,7 @@ public: LLTestMotion(const LLUUID &id) : LLMotion(id){} ~LLTestMotion() {} static LLMotion *create(const LLUUID& id) { return new LLTestMotion(id); } - BOOL getLoop() { return FALSE; } + bool getLoop() { return false; } F32 getDuration() { return 0.0f; } F32 getEaseInDuration() { return 0.0f; } F32 getEaseOutDuration() { return 0.0f; } @@ -208,8 +208,8 @@ public: F32 getMinPixelArea() { return 0.f; } LLMotionInitStatus onInitialize(LLCharacter*) { LL_INFOS() << "LLTestMotion::onInitialize()" << LL_ENDL; return STATUS_SUCCESS; } - BOOL onActivate() { LL_INFOS() << "LLTestMotion::onActivate()" << LL_ENDL; return TRUE; } - BOOL onUpdate(F32 time, U8* joint_mask) { LL_INFOS() << "LLTestMotion::onUpdate(" << time << ")" << LL_ENDL; return TRUE; } + bool onActivate() { LL_INFOS() << "LLTestMotion::onActivate()" << LL_ENDL; return true; } + bool onUpdate(F32 time, U8* joint_mask) { LL_INFOS() << "LLTestMotion::onUpdate(" << time << ")" << LL_ENDL; return true; } void onDeactivate() { LL_INFOS() << "LLTestMotion::onDeactivate()" << LL_ENDL; } }; @@ -225,7 +225,7 @@ public: static LLMotion *create(const LLUUID &id) { return new LLNullMotion(id); } // motions must specify whether or not they loop - /*virtual*/ BOOL getLoop() { return TRUE; } + /*virtual*/ bool getLoop() { return true; } // motions must report their total duration /*virtual*/ F32 getDuration() { return 1.f; } @@ -251,14 +251,14 @@ public: /*virtual*/ LLMotionInitStatus onInitialize(LLCharacter *character) { return STATUS_SUCCESS; } // called when a motion is activated - // must return TRUE to indicate success, or else + // must return true to indicate success, or else // it will be deactivated - /*virtual*/ BOOL onActivate() { return TRUE; } + /*virtual*/ bool onActivate() { return true; } // called per time step - // must return TRUE while it is active, and - // must return FALSE when the motion is completed. - /*virtual*/ BOOL onUpdate(F32 activeTime, U8* joint_mask) { return TRUE; } + // must return true while it is active, and + // must return false when the motion is completed. + /*virtual*/ bool onUpdate(F32 activeTime, U8* joint_mask) { return true; } // called when a motion is deactivated /*virtual*/ void onDeactivate() {} diff --git a/indra/llcharacter/llmotioncontroller.cpp b/indra/llcharacter/llmotioncontroller.cpp index 689737a190..c204c96f6c 100644 --- a/indra/llcharacter/llmotioncontroller.cpp +++ b/indra/llcharacter/llmotioncontroller.cpp @@ -76,16 +76,16 @@ LLMotionRegistry::~LLMotionRegistry() //----------------------------------------------------------------------------- // addMotion() //----------------------------------------------------------------------------- -BOOL LLMotionRegistry::registerMotion( const LLUUID& id, LLMotionConstructor constructor ) +bool LLMotionRegistry::registerMotion( const LLUUID& id, LLMotionConstructor constructor ) { // LL_INFOS() << "Registering motion: " << name << LL_ENDL; if (!is_in_map(mMotionTable, id)) { mMotionTable[id] = constructor; - return TRUE; + return true; } - return FALSE; + return false; } //----------------------------------------------------------------------------- @@ -133,13 +133,13 @@ LLMotionController::LLMotionController() mAnimTime(0.f), mPrevTimerElapsed(0.f), mLastTime(0.0f), - mHasRunOnce(FALSE), - mPaused(FALSE), + mHasRunOnce(false), + mPaused(false), mPausedFrame(0), mTimeStep(0.f), mTimeStepCount(0), mLastInterp(0.f), - mIsSelf(FALSE), + mIsSelf(false), mLastCountAfterPurge(0) { } @@ -156,11 +156,11 @@ LLMotionController::~LLMotionController() void LLMotionController::incMotionCounts(S32& num_motions, S32& num_loading_motions, S32& num_loaded_motions, S32& num_active_motions, S32& num_deprecated_motions) { - num_motions += mAllMotions.size(); - num_loading_motions += mLoadingMotions.size(); - num_loaded_motions += mLoadedMotions.size(); - num_active_motions += mActiveMotions.size(); - num_deprecated_motions += mDeprecatedMotions.size(); + num_motions += static_cast<S32>(mAllMotions.size()); + num_loading_motions += static_cast<S32>(mLoadingMotions.size()); + num_loaded_motions += static_cast<S32>(mLoadedMotions.size()); + num_active_motions += static_cast<S32>(mActiveMotions.size()); + num_deprecated_motions += static_cast<S32>(mDeprecatedMotions.size()); } //----------------------------------------------------------------------------- @@ -222,7 +222,7 @@ void LLMotionController::purgeExcessMotions() } // clean up all inactive, loaded motions - for (LLUUID motion_id : motions_to_kill) + for (const LLUUID& motion_id : motions_to_kill) { // look up the motion again by ID to get canonical instance // and kill it only if that one is inactive @@ -233,7 +233,7 @@ void LLMotionController::purgeExcessMotions() } } - U32 loaded_count = mLoadedMotions.size(); + U32 loaded_count = static_cast<U32>(mLoadedMotions.size()); if (loaded_count > (2 * MAX_MOTION_INSTANCES) && loaded_count > mLastCountAfterPurge) { LL_WARNS_ONCE("Animation") << loaded_count << " Loaded Motions. Amount of motions is over limit." << LL_ENDL; @@ -275,7 +275,7 @@ void LLMotionController::setTimeStep(F32 step) LLMotion* motionp = *iter; F32 activation_time = motionp->mActivationTimestamp; motionp->mActivationTimestamp = (F32)(llfloor(activation_time / step)) * step; - BOOL stopped = motionp->isStopped(); + bool stopped = motionp->isStopped(); motionp->setStopTime((F32)(llfloor(motionp->getStopTime() / step)) * step); motionp->setStopped(stopped); motionp->mSendStopTimestamp = (F32)llfloor(motionp->mSendStopTimestamp / step) * step; @@ -303,7 +303,7 @@ void LLMotionController::setCharacter(LLCharacter *character) //----------------------------------------------------------------------------- // registerMotion() //----------------------------------------------------------------------------- -BOOL LLMotionController::registerMotion( const LLUUID& id, LLMotionConstructor constructor ) +bool LLMotionController::registerMotion( const LLUUID& id, LLMotionConstructor constructor ) { return sRegistry.registerMotion(id, constructor); } @@ -389,7 +389,7 @@ LLMotion* LLMotionController::createMotion( const LLUUID &id ) //----------------------------------------------------------------------------- // startMotion() //----------------------------------------------------------------------------- -BOOL LLMotionController::startMotion(const LLUUID &id, F32 start_offset) +bool LLMotionController::startMotion(const LLUUID &id, F32 start_offset) { // do we have an instance of this motion for this character? LLMotion *motion = findMotion(id); @@ -415,12 +415,12 @@ BOOL LLMotionController::startMotion(const LLUUID &id, F32 start_offset) if (!motion) { - return FALSE; + return false; } //if the motion is already active and allows deprecation, then let it keep playing else if (motion->canDeprecate() && isMotionActive(motion)) { - return TRUE; + return true; } // LL_INFOS() << "Starting motion " << name << LL_ENDL; @@ -431,7 +431,7 @@ BOOL LLMotionController::startMotion(const LLUUID &id, F32 start_offset) //----------------------------------------------------------------------------- // stopMotionLocally() //----------------------------------------------------------------------------- -BOOL LLMotionController::stopMotionLocally(const LLUUID &id, BOOL stop_immediate) +bool LLMotionController::stopMotionLocally(const LLUUID &id, bool stop_immediate) { // if already inactive, return false LLMotion *motion = findMotion(id); @@ -439,11 +439,11 @@ BOOL LLMotionController::stopMotionLocally(const LLUUID &id, BOOL stop_immediate return stopMotionInstance(motion, stop_immediate||mPaused); } -BOOL LLMotionController::stopMotionInstance(LLMotion* motion, BOOL stop_immediate) +bool LLMotionController::stopMotionInstance(LLMotion* motion, bool stop_immediate) { if (!motion) { - return FALSE; + return false; } @@ -455,15 +455,15 @@ BOOL LLMotionController::stopMotionInstance(LLMotion* motion, BOOL stop_immediat { deactivateMotionInstance(motion); } - return TRUE; + return true; } else if (isMotionLoading(motion)) { - motion->setStopped(TRUE); - return TRUE; + motion->setStopped(true); + return true; } - return FALSE; + return false; } //----------------------------------------------------------------------------- @@ -518,7 +518,7 @@ void LLMotionController::updateIdleMotion(LLMotion* motionp) if (mLastTime <= motionp->mSendStopTimestamp) { mCharacter->requestStopMotion( motionp ); - stopMotionInstance(motionp, FALSE); + stopMotionInstance(motionp, false); } } else if (mAnimTime >= motionp->mActivationTimestamp) @@ -552,7 +552,7 @@ void LLMotionController::updateIdleActiveMotions() void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_type) { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; - BOOL update_result = TRUE; + bool update_result = true; U8 last_joint_signature[LL_CHARACTER_MAX_ANIMATED_JOINTS]; memset(&last_joint_signature, 0, sizeof(U8) * LL_CHARACTER_MAX_ANIMATED_JOINTS); @@ -568,11 +568,11 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty continue; } - BOOL update_motion = FALSE; + bool update_motion = false; if (motionp->getPose()->getWeight() < 1.f) { - update_motion = TRUE; + update_motion = true; } else { @@ -584,7 +584,7 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty if ((*current_signature | test_signature) > (*current_signature)) { *current_signature |= test_signature; - update_motion = TRUE; + update_motion = true; } *((U32*)&last_joint_signature[i * 4]) = *(U32*)&(mJointSignature[1][i * 4]); @@ -594,7 +594,7 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty if ((*current_signature | test_signature) > (*current_signature)) { *current_signature |= test_signature; - update_motion = TRUE; + update_motion = true; } } } @@ -620,7 +620,7 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty if (mLastTime <= motionp->mSendStopTimestamp) { mCharacter->requestStopMotion( motionp ); - stopMotionInstance(motionp, FALSE); + stopMotionInstance(motionp, false); } } @@ -701,7 +701,7 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty if (mLastTime <= motionp->mSendStopTimestamp) { mCharacter->requestStopMotion( motionp ); - stopMotionInstance(motionp, FALSE); + stopMotionInstance(motionp, false); } } @@ -747,12 +747,12 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty // propagate this to the network // as not all viewers are guaranteed to have access to the same logic mCharacter->requestStopMotion( motionp ); - stopMotionInstance(motionp, FALSE); + stopMotionInstance(motionp, false); } } - // even if onupdate returns FALSE, add this motion in to the blend one last time + // even if onupdate returns false, add this motion in to the blend one last time mPoseBlender.addMotion(motionp); } } @@ -815,7 +815,7 @@ void LLMotionController::updateMotions(bool force_update) // The use_quantum optimization or possibly the associated code in setTimeStamp() // does not work as implemented. // Currently setting mTimeStep to nonzero is disabled elsewhere. - BOOL use_quantum = (mTimeStep != 0.f); + bool use_quantum = (mTimeStep != 0.f); // Always update mPrevTimerElapsed F32 cur_time = mTimer.getElapsedTimeF32(); @@ -885,7 +885,7 @@ void LLMotionController::updateMotions(bool force_update) if (use_quantum) { - mPoseBlender.blendAndCache(TRUE); + mPoseBlender.blendAndCache(true); } else { @@ -893,7 +893,7 @@ void LLMotionController::updateMotions(bool force_update) } } - mHasRunOnce = TRUE; + mHasRunOnce = true; // LL_INFOS() << "Motion controller time " << motionTimer.getElapsedTimeF32() << LL_ENDL; } @@ -913,28 +913,28 @@ void LLMotionController::updateMotionsMinimal() deactivateStoppedMotions(); - mHasRunOnce = TRUE; + mHasRunOnce = true; } //----------------------------------------------------------------------------- // activateMotionInstance() //----------------------------------------------------------------------------- -BOOL LLMotionController::activateMotionInstance(LLMotion *motion, F32 time) +bool LLMotionController::activateMotionInstance(LLMotion *motion, F32 time) { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; // It's not clear why the getWeight() line seems to be crashing this, but // hopefully this fixes it. if (motion == NULL || motion->getPose() == NULL) { - return FALSE; + return false; } if (mLoadingMotions.find(motion) != mLoadingMotions.end()) { // we want to start this motion, but we can't yet, so flag it as started - motion->setStopped(FALSE); + motion->setStopped(false); // report pending animations as activated - return TRUE; + return true; } motion->mResidualWeight = motion->getPose()->getWeight(); @@ -978,13 +978,13 @@ BOOL LLMotionController::activateMotionInstance(LLMotion *motion, F32 time) } } - return TRUE; + return true; } //----------------------------------------------------------------------------- // deactivateMotionInstance() //----------------------------------------------------------------------------- -BOOL LLMotionController::deactivateMotionInstance(LLMotion *motion) +bool LLMotionController::deactivateMotionInstance(LLMotion *motion) { motion->deactivate(); @@ -1001,7 +1001,7 @@ BOOL LLMotionController::deactivateMotionInstance(LLMotion *motion) mActiveMotions.remove(motion); } - return TRUE; + return true; } void LLMotionController::deprecateMotionInstance(LLMotion* motion) @@ -1009,7 +1009,7 @@ void LLMotionController::deprecateMotionInstance(LLMotion* motion) mDeprecatedMotions.insert(motion); //fade out deprecated motion - stopMotionInstance(motion, FALSE); + stopMotionInstance(motion, false); //no longer canonical mAllMotions.erase(motion->getID()); } @@ -1124,7 +1124,7 @@ void LLMotionController::pauseAllMotions() if (!mPaused) { //LL_INFOS() << "Pausing animations..." << LL_ENDL; - mPaused = TRUE; + mPaused = true; mPausedFrame = LLFrameTimer::getFrameCount(); } @@ -1138,7 +1138,7 @@ void LLMotionController::unpauseAllMotions() if (mPaused) { //LL_INFOS() << "Unpausing animations..." << LL_ENDL; - mPaused = FALSE; + mPaused = false; } } // End diff --git a/indra/llcharacter/llmotioncontroller.h b/indra/llcharacter/llmotioncontroller.h index 67193b0cf3..0c262bf24a 100644 --- a/indra/llcharacter/llmotioncontroller.h +++ b/indra/llcharacter/llmotioncontroller.h @@ -62,7 +62,7 @@ public: // adds motion classes to the registry // returns true if successfull - BOOL registerMotion( const LLUUID& id, LLMotionConstructor create); + bool registerMotion( const LLUUID& id, LLMotionConstructor create); // creates a new instance of a named motion // returns NULL motion is not registered @@ -85,7 +85,7 @@ class LLMotionController public: typedef std::list<LLMotion*> motion_list_t; typedef std::set<LLMotion*> motion_set_t; - BOOL mIsSelf; + bool mIsSelf; public: // Constructor @@ -102,7 +102,7 @@ public: // registers a motion with the controller // (actually just forwards call to motion registry) // returns true if successfull - BOOL registerMotion( const LLUUID& id, LLMotionConstructor create ); + bool registerMotion( const LLUUID& id, LLMotionConstructor create ); // creates a motion from the registry LLMotion *createMotion( const LLUUID &id ); @@ -115,13 +115,13 @@ public: // start motion // begins playing the specified motion // returns true if successful - BOOL startMotion( const LLUUID &id, F32 start_offset ); + bool startMotion( const LLUUID &id, F32 start_offset ); // stop motion // stops a playing motion // in reality, it begins the ease out transition phase // returns true if successful - BOOL stopMotionLocally( const LLUUID &id, BOOL stop_immediate ); + bool stopMotionLocally( const LLUUID &id, bool stop_immediate ); // Move motions from loading to loaded void updateLoadingMotions(); @@ -147,7 +147,7 @@ public: // pause and continue all motions void pauseAllMotions(); void unpauseAllMotions(); - BOOL isPaused() const { return mPaused; } + bool isPaused() const { return mPaused; } S32 getPausedFrame() const { return mPausedFrame; } void setTimeStep(F32 step); @@ -178,10 +178,10 @@ protected: // internal operations act on motion instances directly // as there can be duplicate motions per id during blending overlap void deleteAllMotions(); - BOOL activateMotionInstance(LLMotion *motion, F32 time); - BOOL deactivateMotionInstance(LLMotion *motion); + bool activateMotionInstance(LLMotion *motion, F32 time); + bool deactivateMotionInstance(LLMotion *motion); void deprecateMotionInstance(LLMotion* motion); - BOOL stopMotionInstance(LLMotion *motion, BOOL stop_imemdiate); + bool stopMotionInstance(LLMotion *motion, bool stop_imemdiate); void removeMotionInstance(LLMotion* motion); void updateRegularMotions(); void updateAdditiveMotions(); @@ -220,8 +220,8 @@ protected: F32 mPrevTimerElapsed; F32 mAnimTime; F32 mLastTime; - BOOL mHasRunOnce; - BOOL mPaused; + bool mHasRunOnce; + bool mPaused; S32 mPausedFrame; F32 mTimeStep; S32 mTimeStepCount; diff --git a/indra/llcharacter/llmultigesture.cpp b/indra/llcharacter/llmultigesture.cpp index e5ca051f82..a3118a401f 100644 --- a/indra/llcharacter/llmultigesture.cpp +++ b/indra/llcharacter/llmultigesture.cpp @@ -54,15 +54,15 @@ LLMultiGesture::~LLMultiGesture() void LLMultiGesture::reset() { - mPlaying = FALSE; + mPlaying = false; mCurrentStep = 0; mWaitTimer.reset(); - mWaitingAnimations = FALSE; - mWaitingKeyRelease = FALSE; - mWaitingTimer = FALSE; - mTriggeredByKey = FALSE; - mKeyReleased = FALSE; - mWaitingAtEnd = FALSE; + mWaitingAnimations = false; + mWaitingKeyRelease = false; + mWaitingTimer = false; + mTriggeredByKey = false; + mKeyReleased = false; + mWaitingAtEnd = false; mRequestedAnimIDs.clear(); mPlayingAnimIDs.clear(); } @@ -107,7 +107,7 @@ S32 LLMultiGesture::getMaxSerialSize() const return max_size; } -BOOL LLMultiGesture::serialize(LLDataPacker& dp) const +bool LLMultiGesture::serialize(LLDataPacker& dp) const { dp.packS32(GESTURE_VERSION, "version"); dp.packU8(mKey, "key"); @@ -123,16 +123,16 @@ BOOL LLMultiGesture::serialize(LLDataPacker& dp) const LLGestureStep* step = mSteps[i]; dp.packS32(step->getType(), "step_type"); - BOOL ok = step->serialize(dp); + bool ok = step->serialize(dp); if (!ok) { - return FALSE; + return false; } } - return TRUE; + return true; } -BOOL LLMultiGesture::deserialize(LLDataPacker& dp) +bool LLMultiGesture::deserialize(LLDataPacker& dp) { S32 version; dp.unpackS32(version, "version"); @@ -141,7 +141,7 @@ BOOL LLMultiGesture::deserialize(LLDataPacker& dp) LL_WARNS() << "Bad LLMultiGesture version " << version << " should be " << GESTURE_VERSION << LL_ENDL; - return FALSE; + return false; } dp.unpackU8(mKey, "key"); @@ -157,7 +157,7 @@ BOOL LLMultiGesture::deserialize(LLDataPacker& dp) if (count < 0) { LL_WARNS() << "Bad LLMultiGesture step count " << count << LL_ENDL; - return FALSE; + return false; } S32 i; @@ -172,43 +172,43 @@ BOOL LLMultiGesture::deserialize(LLDataPacker& dp) case STEP_ANIMATION: { LLGestureStepAnimation* step = new LLGestureStepAnimation(); - BOOL ok = step->deserialize(dp); - if (!ok) return FALSE; + bool ok = step->deserialize(dp); + if (!ok) return false; mSteps.push_back(step); break; } case STEP_SOUND: { LLGestureStepSound* step = new LLGestureStepSound(); - BOOL ok = step->deserialize(dp); - if (!ok) return FALSE; + bool ok = step->deserialize(dp); + if (!ok) return false; mSteps.push_back(step); break; } case STEP_CHAT: { LLGestureStepChat* step = new LLGestureStepChat(); - BOOL ok = step->deserialize(dp); - if (!ok) return FALSE; + bool ok = step->deserialize(dp); + if (!ok) return false; mSteps.push_back(step); break; } case STEP_WAIT: { LLGestureStepWait* step = new LLGestureStepWait(); - BOOL ok = step->deserialize(dp); - if (!ok) return FALSE; + bool ok = step->deserialize(dp); + if (!ok) return false; mSteps.push_back(step); break; } default: { LL_WARNS() << "Bad LLMultiGesture step type " << type << LL_ENDL; - return FALSE; + return false; } } } - return TRUE; + return true; } void LLMultiGesture::dump() @@ -255,15 +255,15 @@ S32 LLGestureStepAnimation::getMaxSerialSize() const return max_size; } -BOOL LLGestureStepAnimation::serialize(LLDataPacker& dp) const +bool LLGestureStepAnimation::serialize(LLDataPacker& dp) const { dp.packString(mAnimName, "anim_name"); dp.packUUID(mAnimAssetID, "asset_id"); dp.packU32(mFlags, "flags"); - return TRUE; + return true; } -BOOL LLGestureStepAnimation::deserialize(LLDataPacker& dp) +bool LLGestureStepAnimation::deserialize(LLDataPacker& dp) { dp.unpackString(mAnimName, "anim_name"); @@ -277,7 +277,7 @@ BOOL LLGestureStepAnimation::deserialize(LLDataPacker& dp) dp.unpackUUID(mAnimAssetID, "asset_id"); dp.unpackU32(mFlags, "flags"); - return TRUE; + return true; } // *NOTE: result is translated in LLPreviewGesture::getLabel() std::vector<std::string> LLGestureStepAnimation::getLabel() const @@ -337,21 +337,21 @@ S32 LLGestureStepSound::getMaxSerialSize() const return max_size; } -BOOL LLGestureStepSound::serialize(LLDataPacker& dp) const +bool LLGestureStepSound::serialize(LLDataPacker& dp) const { dp.packString(mSoundName, "sound_name"); dp.packUUID(mSoundAssetID, "asset_id"); dp.packU32(mFlags, "flags"); - return TRUE; + return true; } -BOOL LLGestureStepSound::deserialize(LLDataPacker& dp) +bool LLGestureStepSound::deserialize(LLDataPacker& dp) { dp.unpackString(mSoundName, "sound_name"); dp.unpackUUID(mSoundAssetID, "asset_id"); dp.unpackU32(mFlags, "flags"); - return TRUE; + return true; } // *NOTE: result is translated in LLPreviewGesture::getLabel() std::vector<std::string> LLGestureStepSound::getLabel() const @@ -397,19 +397,19 @@ S32 LLGestureStepChat::getMaxSerialSize() const return max_size; } -BOOL LLGestureStepChat::serialize(LLDataPacker& dp) const +bool LLGestureStepChat::serialize(LLDataPacker& dp) const { dp.packString(mChatText, "chat_text"); dp.packU32(mFlags, "flags"); - return TRUE; + return true; } -BOOL LLGestureStepChat::deserialize(LLDataPacker& dp) +bool LLGestureStepChat::deserialize(LLDataPacker& dp) { dp.unpackString(mChatText, "chat_text"); dp.unpackU32(mFlags, "flags"); - return TRUE; + return true; } // *NOTE: result is translated in LLPreviewGesture::getLabel() std::vector<std::string> LLGestureStepChat::getLabel() const @@ -452,18 +452,18 @@ S32 LLGestureStepWait::getMaxSerialSize() const return max_size; } -BOOL LLGestureStepWait::serialize(LLDataPacker& dp) const +bool LLGestureStepWait::serialize(LLDataPacker& dp) const { dp.packF32(mWaitSeconds, "wait_seconds"); dp.packU32(mFlags, "flags"); - return TRUE; + return true; } -BOOL LLGestureStepWait::deserialize(LLDataPacker& dp) +bool LLGestureStepWait::deserialize(LLDataPacker& dp) { dp.unpackF32(mWaitSeconds, "wait_seconds"); dp.unpackU32(mFlags, "flags"); - return TRUE; + return true; } // *NOTE: result is translated in LLPreviewGesture::getLabel() std::vector<std::string> LLGestureStepWait::getLabel() const diff --git a/indra/llcharacter/llmultigesture.h b/indra/llcharacter/llmultigesture.h index bc9963f2b1..af0cb08650 100644 --- a/indra/llcharacter/llmultigesture.h +++ b/indra/llcharacter/llmultigesture.h @@ -46,8 +46,8 @@ public: // Maximum number of bytes this could hold once serialized. S32 getMaxSerialSize() const; - BOOL serialize(LLDataPacker& dp) const; - BOOL deserialize(LLDataPacker& dp); + bool serialize(LLDataPacker& dp) const; + bool deserialize(LLDataPacker& dp); void dump(); @@ -75,28 +75,28 @@ public: std::vector<LLGestureStep*> mSteps; // Is the gesture currently playing? - BOOL mPlaying { FALSE }; + bool mPlaying { false }; // "instruction pointer" for steps S32 mCurrentStep { 0 }; // We're waiting for triggered animations to stop playing - BOOL mWaitingAnimations { FALSE }; + bool mWaitingAnimations { false }; // We're waiting for key release - BOOL mWaitingKeyRelease { FALSE }; + bool mWaitingKeyRelease { false }; // We're waiting a fixed amount of time - BOOL mWaitingTimer { FALSE }; + bool mWaitingTimer { false }; // We're waiting for triggered animations to stop playing - BOOL mTriggeredByKey { FALSE }; + bool mTriggeredByKey { false }; // Has the key been released? - BOOL mKeyReleased { FALSE }; + bool mKeyReleased { false }; // Waiting after the last step played for all animations to complete - BOOL mWaitingAtEnd { FALSE }; + bool mWaitingAtEnd { false }; // Timer for waiting LLFrameTimer mWaitTimer; @@ -138,8 +138,8 @@ public: virtual std::vector<std::string> getLabel() const = 0; virtual S32 getMaxSerialSize() const = 0; - virtual BOOL serialize(LLDataPacker& dp) const = 0; - virtual BOOL deserialize(LLDataPacker& dp) = 0; + virtual bool serialize(LLDataPacker& dp) const = 0; + virtual bool deserialize(LLDataPacker& dp) = 0; virtual void dump() = 0; }; @@ -160,8 +160,8 @@ public: virtual std::vector<std::string> getLabel() const; virtual S32 getMaxSerialSize() const; - virtual BOOL serialize(LLDataPacker& dp) const; - virtual BOOL deserialize(LLDataPacker& dp); + virtual bool serialize(LLDataPacker& dp) const; + virtual bool deserialize(LLDataPacker& dp); virtual void dump(); @@ -183,8 +183,8 @@ public: virtual std::vector<std::string> getLabel() const; virtual S32 getMaxSerialSize() const; - virtual BOOL serialize(LLDataPacker& dp) const; - virtual BOOL deserialize(LLDataPacker& dp); + virtual bool serialize(LLDataPacker& dp) const; + virtual bool deserialize(LLDataPacker& dp); virtual void dump(); @@ -206,8 +206,8 @@ public: virtual std::vector<std::string> getLabel() const; virtual S32 getMaxSerialSize() const; - virtual BOOL serialize(LLDataPacker& dp) const; - virtual BOOL deserialize(LLDataPacker& dp); + virtual bool serialize(LLDataPacker& dp) const; + virtual bool deserialize(LLDataPacker& dp); virtual void dump(); @@ -232,8 +232,8 @@ public: virtual std::vector<std::string> getLabel() const; virtual S32 getMaxSerialSize() const; - virtual BOOL serialize(LLDataPacker& dp) const; - virtual BOOL deserialize(LLDataPacker& dp); + virtual bool serialize(LLDataPacker& dp) const; + virtual bool deserialize(LLDataPacker& dp); virtual void dump(); diff --git a/indra/llcharacter/llpose.cpp b/indra/llcharacter/llpose.cpp index 723b68b0a3..0652e9eb25 100644 --- a/indra/llcharacter/llpose.cpp +++ b/indra/llcharacter/llpose.cpp @@ -81,31 +81,31 @@ LLJointState *LLPose::getNextJointState() //----------------------------------------------------------------------------- // addJointState() //----------------------------------------------------------------------------- -BOOL LLPose::addJointState(const LLPointer<LLJointState>& jointState) +bool LLPose::addJointState(const LLPointer<LLJointState>& jointState) { if (mJointMap.find(jointState->getJoint()->getName()) == mJointMap.end()) { mJointMap[jointState->getJoint()->getName()] = jointState; } - return TRUE; + return true; } //----------------------------------------------------------------------------- // removeJointState() //----------------------------------------------------------------------------- -BOOL LLPose::removeJointState(const LLPointer<LLJointState>& jointState) +bool LLPose::removeJointState(const LLPointer<LLJointState>& jointState) { mJointMap.erase(jointState->getJoint()->getName()); - return TRUE; + return true; } //----------------------------------------------------------------------------- // removeAllJointStates() //----------------------------------------------------------------------------- -BOOL LLPose::removeAllJointStates() +bool LLPose::removeAllJointStates() { mJointMap.clear(); - return TRUE; + return true; } //----------------------------------------------------------------------------- @@ -181,7 +181,7 @@ LLJointStateBlender::LLJointStateBlender() { mJointStates[i] = NULL; mPriorities[i] = S32_MIN; - mAdditiveBlends[i] = FALSE; + mAdditiveBlends[i] = false; } } @@ -193,13 +193,13 @@ LLJointStateBlender::~LLJointStateBlender() //----------------------------------------------------------------------------- // addJointState() //----------------------------------------------------------------------------- -BOOL LLJointStateBlender::addJointState(const LLPointer<LLJointState>& joint_state, S32 priority, BOOL additive_blend) +bool LLJointStateBlender::addJointState(const LLPointer<LLJointState>& joint_state, S32 priority, bool additive_blend) { llassert(joint_state); if (!joint_state->getJoint()) // this joint state doesn't point to an actual joint, so we don't care about applying it - return FALSE; + return false; for(S32 i = 0; i < JSB_NUM_JOINT_STATES; i++) { @@ -208,7 +208,7 @@ BOOL LLJointStateBlender::addJointState(const LLPointer<LLJointState>& joint_sta mJointStates[i] = joint_state; mPriorities[i] = priority; mAdditiveBlends[i] = additive_blend; - return TRUE; + return true; } else if (priority > mPriorities[i]) { @@ -225,17 +225,17 @@ BOOL LLJointStateBlender::addJointState(const LLPointer<LLJointState>& joint_sta mJointStates[i] = joint_state; mPriorities[i] = priority; mAdditiveBlends[i] = additive_blend; - return TRUE; + return true; } } - return FALSE; + return false; } //----------------------------------------------------------------------------- // blendJointStates() //----------------------------------------------------------------------------- -void LLJointStateBlender::blendJointStates(BOOL apply_now) +void LLJointStateBlender::blendJointStates(bool apply_now) { // we need at least one joint to blend // if there is one, it will be in slot zero according to insertion logic @@ -468,7 +468,7 @@ LLPoseBlender::~LLPoseBlender() //----------------------------------------------------------------------------- // addMotion() //----------------------------------------------------------------------------- -BOOL LLPoseBlender::addMotion(LLMotion* motion) +bool LLPoseBlender::addMotion(LLMotion* motion) { LLPose* pose = motion->getPose(); @@ -503,7 +503,7 @@ BOOL LLPoseBlender::addMotion(LLMotion* motion) mActiveBlenders.push_front(joint_blender); } } - return TRUE; + return true; } //----------------------------------------------------------------------------- @@ -525,7 +525,7 @@ void LLPoseBlender::blendAndApply() //----------------------------------------------------------------------------- // blendAndCache() //----------------------------------------------------------------------------- -void LLPoseBlender::blendAndCache(BOOL reset_cached_joints) +void LLPoseBlender::blendAndCache(bool reset_cached_joints) { for (blender_list_t::iterator iter = mActiveBlenders.begin(); iter != mActiveBlenders.end(); ++iter) @@ -535,7 +535,7 @@ void LLPoseBlender::blendAndCache(BOOL reset_cached_joints) { jsbp->resetCachedJoint(); } - jsbp->blendJointStates(FALSE); + jsbp->blendJointStates(false); } } diff --git a/indra/llcharacter/llpose.h b/indra/llcharacter/llpose.h index 8b488a8218..f2032220e0 100644 --- a/indra/llcharacter/llpose.h +++ b/indra/llcharacter/llpose.h @@ -65,11 +65,11 @@ public: // Destructor ~LLPose(); // add a joint state in this pose - BOOL addJointState(const LLPointer<LLJointState>& jointState); + bool addJointState(const LLPointer<LLJointState>& jointState); // remove a joint state from this pose - BOOL removeJointState(const LLPointer<LLJointState>& jointState); + bool removeJointState(const LLPointer<LLJointState>& jointState); // removes all joint states from this pose - BOOL removeAllJointStates(); + bool removeAllJointStates(); // set weight for all joint states in this pose void setWeight(F32 weight); // get weight for this pose @@ -87,12 +87,12 @@ class LLJointStateBlender protected: LLPointer<LLJointState> mJointStates[JSB_NUM_JOINT_STATES]; S32 mPriorities[JSB_NUM_JOINT_STATES]; - BOOL mAdditiveBlends[JSB_NUM_JOINT_STATES]; + bool mAdditiveBlends[JSB_NUM_JOINT_STATES]; public: LLJointStateBlender(); ~LLJointStateBlender(); - void blendJointStates(BOOL apply_now = TRUE); - BOOL addJointState(const LLPointer<LLJointState>& joint_state, S32 priority, BOOL additive_blend); + void blendJointStates(bool apply_now = true); + bool addJointState(const LLPointer<LLJointState>& joint_state, S32 priority, bool additive_blend); void interpolate(F32 u); void clear(); void resetCachedJoint(); @@ -120,7 +120,7 @@ public: ~LLPoseBlender(); // request motion joint states to be added to pose blender joint state records - BOOL addMotion(LLMotion* motion); + bool addMotion(LLMotion* motion); // blend all joint states and apply to skeleton void blendAndApply(); @@ -129,7 +129,7 @@ public: void clearBlenders(); // blend all joint states and cache results - void blendAndCache(BOOL reset_cached_joints); + void blendAndCache(bool reset_cached_joints); // interpolate all joints towards cached values void interpolate(F32 u); diff --git a/indra/llcharacter/llstatemachine.cpp b/indra/llcharacter/llstatemachine.cpp index beee6f386b..38e9ef444c 100644 --- a/indra/llcharacter/llstatemachine.cpp +++ b/indra/llcharacter/llstatemachine.cpp @@ -49,7 +49,7 @@ bool operator!=(const LLUniqueID &a, const LLUniqueID &b) LLStateDiagram::LLStateDiagram() { mDefaultState = NULL; - mUseDefaultState = FALSE; + mUseDefaultState = false; } LLStateDiagram::~LLStateDiagram() @@ -58,14 +58,14 @@ LLStateDiagram::~LLStateDiagram() } // add a state to the state graph -BOOL LLStateDiagram::addState(LLFSMState *state) +bool LLStateDiagram::addState(LLFSMState *state) { mStates[state] = Transitions(); - return TRUE; + return true; } // add a directed transition between 2 states -BOOL LLStateDiagram::addTransition(LLFSMState& start_state, LLFSMState& end_state, LLFSMTransition& transition) +bool LLStateDiagram::addTransition(LLFSMState& start_state, LLFSMState& end_state, LLFSMTransition& transition) { StateMap::iterator state_it; state_it = mStates.find(&start_state); @@ -89,17 +89,17 @@ BOOL LLStateDiagram::addTransition(LLFSMState& start_state, LLFSMState& end_stat if (transition_it != state_transitions->end()) { LL_ERRS() << "LLStateTable::addDirectedTransition() : transition already exists" << LL_ENDL; - return FALSE; // transition already exists + return false; // transition already exists } (*state_transitions)[&transition] = &end_state; - return TRUE; + return true; } // add an undirected transition between 2 states -BOOL LLStateDiagram::addUndirectedTransition(LLFSMState& start_state, LLFSMState& end_state, LLFSMTransition& transition) +bool LLStateDiagram::addUndirectedTransition(LLFSMState& start_state, LLFSMState& end_state, LLFSMTransition& transition) { - BOOL result; + bool result; result = addTransition(start_state, end_state, transition); if (result) { @@ -162,7 +162,7 @@ LLFSMState* LLStateDiagram::processTransition(LLFSMState& start_state, LLFSMTran void LLStateDiagram::setDefaultState(LLFSMState& default_state) { - mUseDefaultState = TRUE; + mUseDefaultState = true; mDefaultState = &default_state; } @@ -179,13 +179,13 @@ S32 LLStateDiagram::numDeadendStates() return numDeadends; } -BOOL LLStateDiagram::stateIsValid(LLFSMState& state) +bool LLStateDiagram::stateIsValid(LLFSMState& state) { if (mStates.find(&state) != mStates.end()) { - return TRUE; + return true; } - return FALSE; + return false; } LLFSMState* LLStateDiagram::getState(U32 state_id) @@ -200,7 +200,7 @@ LLFSMState* LLStateDiagram::getState(U32 state_id) return NULL; } -BOOL LLStateDiagram::saveDotFile(const std::string& filename) +bool LLStateDiagram::saveDotFile(const std::string& filename) { LLAPRFile outfile ; outfile.open(filename, LL_APR_W); @@ -209,7 +209,7 @@ BOOL LLStateDiagram::saveDotFile(const std::string& filename) if (!dot_file) { LL_WARNS() << "LLStateDiagram::saveDotFile() : Couldn't open " << filename << " to save state diagram." << LL_ENDL; - return FALSE; + return false; } apr_file_printf(dot_file, "digraph StateMachine {\n\tsize=\"100,100\";\n\tfontsize=40;\n\tlabel=\"Finite State Machine\";\n\torientation=landscape\n\tratio=.77\n"); @@ -248,7 +248,7 @@ BOOL LLStateDiagram::saveDotFile(const std::string& filename) apr_file_printf(dot_file, "}\n"); - return TRUE; + return true; } std::ostream& operator<<(std::ostream &s, LLStateDiagram &FSM) @@ -308,7 +308,7 @@ void LLStateMachine::runCurrentState(void *data) } // set current state -BOOL LLStateMachine::setCurrentState(LLFSMState *initial_state, void* user_data, BOOL skip_entry) +bool LLStateMachine::setCurrentState(LLFSMState *initial_state, void* user_data, bool skip_entry) { llassert(mStateDiagram); @@ -319,13 +319,13 @@ BOOL LLStateMachine::setCurrentState(LLFSMState *initial_state, void* user_data, { initial_state->onEntry(user_data); } - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLStateMachine::setCurrentState(U32 state_id, void* user_data, BOOL skip_entry) +bool LLStateMachine::setCurrentState(U32 state_id, void* user_data, bool skip_entry) { llassert(mStateDiagram); @@ -338,10 +338,10 @@ BOOL LLStateMachine::setCurrentState(U32 state_id, void* user_data, BOOL skip_en { state->onEntry(user_data); } - return TRUE; + return true; } - return FALSE; + return false; } void LLStateMachine::processTransition(LLFSMTransition& transition, void* user_data) diff --git a/indra/llcharacter/llstatemachine.h b/indra/llcharacter/llstatemachine.h index 2dfd106b18..9a33798d96 100644 --- a/indra/llcharacter/llstatemachine.h +++ b/indra/llcharacter/llstatemachine.h @@ -74,7 +74,7 @@ protected: StateMap mStates; Transitions mDefaultTransitions; LLFSMState* mDefaultState; - BOOL mUseDefaultState; + bool mUseDefaultState; public: LLStateDiagram(); @@ -82,13 +82,13 @@ public: protected: // add a state to the state graph, executed implicitly when adding transitions - BOOL addState(LLFSMState *state); + bool addState(LLFSMState *state); // add a directed transition between 2 states - BOOL addTransition(LLFSMState& start_state, LLFSMState& end_state, LLFSMTransition& transition); + bool addTransition(LLFSMState& start_state, LLFSMState& end_state, LLFSMTransition& transition); // add an undirected transition between 2 states - BOOL addUndirectedTransition(LLFSMState& start_state, LLFSMState& end_state, LLFSMTransition& transition); + bool addUndirectedTransition(LLFSMState& start_state, LLFSMState& end_state, LLFSMTransition& transition); // add a transition that is taken if none other exist void addDefaultTransition(LLFSMState& end_state, LLFSMTransition& transition); @@ -103,14 +103,14 @@ protected: S32 numDeadendStates(); // does this state exist in the state diagram? - BOOL stateIsValid(LLFSMState& state); + bool stateIsValid(LLFSMState& state); // get a state pointer by ID LLFSMState* getState(U32 state_id); public: // save the graph in a DOT file for rendering and visualization - BOOL saveDotFile(const std::string& filename); + bool saveDotFile(const std::string& filename); }; class LLStateMachine @@ -138,10 +138,10 @@ public: void runCurrentState(void *data); // set state by state pointer - BOOL setCurrentState(LLFSMState *initial_state, void* user_data, BOOL skip_entry = TRUE); + bool setCurrentState(LLFSMState *initial_state, void* user_data, bool skip_entry = true); // set state by unique ID - BOOL setCurrentState(U32 state_id, void* user_data, BOOL skip_entry = TRUE); + bool setCurrentState(U32 state_id, void* user_data, bool skip_entry = true); }; #endif //_LL_LLSTATEMACHINE_H diff --git a/indra/llcharacter/lltargetingmotion.cpp b/indra/llcharacter/lltargetingmotion.cpp index 38cba7b778..0683a1125c 100644 --- a/indra/llcharacter/lltargetingmotion.cpp +++ b/indra/llcharacter/lltargetingmotion.cpp @@ -93,15 +93,15 @@ LLMotion::LLMotionInitStatus LLTargetingMotion::onInitialize(LLCharacter *charac //----------------------------------------------------------------------------- // LLTargetingMotion::onActivate() //----------------------------------------------------------------------------- -BOOL LLTargetingMotion::onActivate() +bool LLTargetingMotion::onActivate() { - return TRUE; + return true; } //----------------------------------------------------------------------------- // LLTargetingMotion::onUpdate() //----------------------------------------------------------------------------- -BOOL LLTargetingMotion::onUpdate(F32 time, U8* joint_mask) +bool LLTargetingMotion::onUpdate(F32 time, U8* joint_mask) { LL_PROFILE_ZONE_SCOPED; F32 slerp_amt = LLSmoothInterpolation::getInterpolant(TORSO_TARGET_HALF_LIFE); @@ -109,11 +109,11 @@ BOOL LLTargetingMotion::onUpdate(F32 time, U8* joint_mask) LLVector3 target; LLVector3* lookAtPoint = (LLVector3*)mCharacter->getAnimationData("LookAtPoint"); - BOOL result = TRUE; + bool result = true; if (!lookAtPoint) { - return TRUE; + return true; } else { diff --git a/indra/llcharacter/lltargetingmotion.h b/indra/llcharacter/lltargetingmotion.h index 7a3f5566ac..9e46a76e33 100644 --- a/indra/llcharacter/lltargetingmotion.h +++ b/indra/llcharacter/lltargetingmotion.h @@ -66,7 +66,7 @@ public: //------------------------------------------------------------------------- // motions must specify whether or not they loop - virtual BOOL getLoop() { return TRUE; } + virtual bool getLoop() { return true; } // motions must report their total duration virtual F32 getDuration() { return 0.0; } @@ -91,14 +91,14 @@ public: virtual LLMotionInitStatus onInitialize(LLCharacter *character); // called when a motion is activated - // must return TRUE to indicate success, or else + // must return true to indicate success, or else // it will be deactivated - virtual BOOL onActivate(); + virtual bool onActivate(); // called per time step - // must return TRUE while it is active, and - // must return FALSE when the motion is completed. - virtual BOOL onUpdate(F32 time, U8* joint_mask); + // must return true while it is active, and + // must return true when the motion is completed. + virtual bool onUpdate(F32 time, U8* joint_mask); // called when a motion is deactivated virtual void onDeactivate(); diff --git a/indra/llcharacter/llvisualparam.cpp b/indra/llcharacter/llvisualparam.cpp index 3dbab7f081..105b31de65 100644 --- a/indra/llcharacter/llvisualparam.cpp +++ b/indra/llcharacter/llvisualparam.cpp @@ -48,7 +48,7 @@ LLVisualParamInfo::LLVisualParamInfo() //----------------------------------------------------------------------------- // parseXml() //----------------------------------------------------------------------------- -BOOL LLVisualParamInfo::parseXml(LLXmlTreeNode *node) +bool LLVisualParamInfo::parseXml(LLXmlTreeNode *node) { // attribute: id static LLStdStringHandle id_string = LLXmlTree::addAttributeString("id"); @@ -102,7 +102,7 @@ BOOL LLVisualParamInfo::parseXml(LLXmlTreeNode *node) else { LL_WARNS() << "Avatar file: <param> has invalid sex attribute: " << sex << LL_ENDL; - return FALSE; + return false; } // attribute: name @@ -110,7 +110,7 @@ BOOL LLVisualParamInfo::parseXml(LLXmlTreeNode *node) if( !node->getFastAttributeString( name_string, mName ) ) { LL_WARNS() << "Avatar file: <param> is missing name attribute" << LL_ENDL; - return FALSE; + return false; } // attribute: label @@ -138,7 +138,7 @@ BOOL LLVisualParamInfo::parseXml(LLXmlTreeNode *node) mMaxName = "More"; } - return TRUE; + return true; } //virtual @@ -164,8 +164,8 @@ LLVisualParam::LLVisualParam() mLastWeight( 0.f ), mNext( NULL ), mTargetWeight( 0.f ), - mIsAnimating( FALSE ), - mIsDummy(FALSE), + mIsAnimating( false ), + mIsDummy(false), mID( -1 ), mInfo( 0 ), mParamLocation(LOC_UNKNOWN) @@ -207,29 +207,29 @@ LLVisualParam::~LLVisualParam() // setInfo() //----------------------------------------------------------------------------- -BOOL LLVisualParam::setInfo(LLVisualParamInfo *info) +bool LLVisualParam::setInfo(LLVisualParamInfo *info) { llassert(mInfo == NULL); if (info->mID < 0) - return FALSE; + return false; mInfo = info; mID = info->mID; - setWeight(getDefaultWeight(), FALSE ); - return TRUE; + setWeight(getDefaultWeight(), false ); + return true; } //----------------------------------------------------------------------------- // parseData() //----------------------------------------------------------------------------- -BOOL LLVisualParam::parseData(LLXmlTreeNode *node) +bool LLVisualParam::parseData(LLXmlTreeNode *node) { LLVisualParamInfo *info = new LLVisualParamInfo; info->parseXml(node); if (!setInfo(info)) - return FALSE; + return false; - return TRUE; + return true; } */ @@ -282,7 +282,7 @@ void LLVisualParam::setAnimationTarget(F32 target_value) { mTargetWeight = target_value; } - mIsAnimating = TRUE; + mIsAnimating = true; if (mNext) { @@ -327,16 +327,16 @@ void LLVisualParam::stopAnimating() { if (mIsAnimating && isTweakable()) { - mIsAnimating = FALSE; + mIsAnimating = false; setWeight(mTargetWeight); } } //virtual -BOOL LLVisualParam::linkDrivenParams(visual_param_mapper mapper, BOOL only_cross_params) +bool LLVisualParam::linkDrivenParams(visual_param_mapper mapper, bool only_cross_params) { // nothing to do for non-driver parameters - return TRUE; + return true; } //virtual diff --git a/indra/llcharacter/llvisualparam.h b/indra/llcharacter/llvisualparam.h index 4d760ed6fa..3caddb9c62 100644 --- a/indra/llcharacter/llvisualparam.h +++ b/indra/llcharacter/llvisualparam.h @@ -74,7 +74,7 @@ public: LLVisualParamInfo(); virtual ~LLVisualParamInfo() {}; - virtual BOOL parseXml(LLXmlTreeNode *node); + virtual bool parseXml(LLXmlTreeNode *node); S32 getID() const { return mID; } @@ -113,11 +113,11 @@ public: // (They can not be virtual because they use specific derived Info classes) LLVisualParamInfo* getInfo() const { return mInfo; } // This sets mInfo and calls initialization functions - BOOL setInfo(LLVisualParamInfo *info); + bool setInfo(LLVisualParamInfo *info); // Virtual functions // Pure virtuals - //virtual BOOL parseData( LLXmlTreeNode *node ) = 0; + //virtual bool parseData( LLXmlTreeNode *node ) = 0; virtual void apply( ESex avatar_sex ) = 0; // Default functions virtual void setWeight(F32 weight); @@ -125,7 +125,7 @@ public: virtual void animate(F32 delta); virtual void stopAnimating(); - virtual BOOL linkDrivenParams(visual_param_mapper mapper, BOOL only_cross_params); + virtual bool linkDrivenParams(visual_param_mapper mapper, bool only_cross_params); virtual void resetDrivenParams(); // Interface methods @@ -151,17 +151,17 @@ public: F32 getCurrentWeight() const { return mCurWeight; } F32 getLastWeight() const { return mLastWeight; } void setLastWeight(F32 val) { mLastWeight = val; } - BOOL isAnimating() const { return mIsAnimating; } - BOOL isTweakable() const { return (getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE) || (getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT); } + bool isAnimating() const { return mIsAnimating; } + bool isTweakable() const { return (getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE) || (getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT); } LLVisualParam* getNextParam() { return mNext; } void setNextParam( LLVisualParam *next ); void clearNextParam(); - virtual void setAnimating(BOOL is_animating) { mIsAnimating = is_animating && !mIsDummy; } - BOOL getAnimating() const { return mIsAnimating; } + virtual void setAnimating(bool is_animating) { mIsAnimating = is_animating && !mIsDummy; } + bool getAnimating() const { return mIsAnimating; } - void setIsDummy(BOOL is_dummy) { mIsDummy = is_dummy; } + void setIsDummy(bool is_dummy) { mIsDummy = is_dummy; } void setParamLocation(EParamLocation loc); EParamLocation getParamLocation() const { return mParamLocation; } @@ -173,8 +173,8 @@ protected: F32 mLastWeight; // last weight LLVisualParam* mNext; // next param in a shared chain F32 mTargetWeight; // interpolation target - BOOL mIsAnimating; // this value has been given an interpolation target - BOOL mIsDummy; // this is used to prevent dummy visual params from animating + bool mIsAnimating; // this value has been given an interpolation target + bool mIsDummy; // this is used to prevent dummy visual params from animating S32 mID; // id for storing weight/morphtarget compares compactly diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 38fd05fae6..ad17754790 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -8,7 +8,6 @@ include(bugsplat) include(Linking) include(Boost) include(LLSharedLibs) -include(JsonCpp) if (USE_AUTOBUILD_3P OR USE_CONAN) include(Copy3rdPartyLibs) endif () @@ -283,7 +282,6 @@ target_link_libraries( llcommon ll::apr ll::expat - ll::jsoncpp ll::zlib-ng ll::boost ll::uriparser diff --git a/indra/llcommon/StackWalker.cpp b/indra/llcommon/StackWalker.cpp index 201eeed56b..e9ae1723fb 100644 --- a/indra/llcommon/StackWalker.cpp +++ b/indra/llcommon/StackWalker.cpp @@ -292,10 +292,10 @@ public: free(m_szSymPath); m_szSymPath = NULL; } - BOOL Init(LPCSTR szSymPath) + bool Init(LPCSTR szSymPath) { if (m_parent == NULL) - return FALSE; + return false; // Dynamically load the Entry-Points for dbghelp.dll: // First try to load the newsest one from TCHAR szTemp[4096]; @@ -364,7 +364,7 @@ public: if (m_hDbhHelp == NULL) // if not already loaded, try to load a default-one m_hDbhHelp = LoadLibrary( _T("dbghelp.dll") ); if (m_hDbhHelp == NULL) - return FALSE; + return false; pSI = (tSI) GetProcAddress(m_hDbhHelp, "SymInitialize" ); pSC = (tSC) GetProcAddress(m_hDbhHelp, "SymCleanup" ); @@ -388,7 +388,7 @@ public: FreeLibrary(m_hDbhHelp); m_hDbhHelp = NULL; pSC = NULL; - return FALSE; + return false; } // SymInitialize @@ -415,7 +415,7 @@ public: GetUserNameA(szUserName, &dwSize); this->m_parent->OnSymInit(buf, symOptions, szUserName); - return TRUE; + return true; } StackWalker *m_parent; @@ -555,7 +555,7 @@ private: typedef MODULEENTRY32 * LPMODULEENTRY32; #pragma pack( pop ) - BOOL GetModuleListTH32(HANDLE hProcess, DWORD pid) + bool GetModuleListTH32(HANDLE hProcess, DWORD pid) { // CreateToolhelp32Snapshot() typedef HANDLE (__stdcall *tCT32S)(DWORD dwFlags, DWORD th32ProcessID); @@ -592,13 +592,13 @@ private: } if (hToolhelp == NULL) - return FALSE; + return false; hSnap = pCT32S( TH32CS_SNAPMODULE, pid ); if (hSnap == (HANDLE) -1) { FreeLibrary(hToolhelp); - return FALSE; + return false; } keepGoing = !!pM32F( hSnap, &me ); @@ -612,8 +612,8 @@ private: CloseHandle(hSnap); FreeLibrary(hToolhelp); if (cnt <= 0) - return FALSE; - return TRUE; + return false; + return true; } // GetModuleListTH32 // **************************************** PSAPI ************************ @@ -623,7 +623,7 @@ private: LPVOID EntryPoint; } MODULEINFO, *LPMODULEINFO; - BOOL GetModuleListPSAPI(HANDLE hProcess) + bool GetModuleListPSAPI(HANDLE hProcess) { // EnumProcessModules() typedef BOOL (__stdcall *tEPM)(HANDLE hProcess, HMODULE *lphModule, DWORD cb, LPDWORD lpcbNeeded ); @@ -652,7 +652,7 @@ private: hPsapi = LoadLibrary( _T("psapi.dll") ); if (hPsapi == NULL) - return FALSE; + return false; pEPM = (tEPM) GetProcAddress( hPsapi, "EnumProcessModules" ); pGMFNE = (tGMFNE) GetProcAddress( hPsapi, "GetModuleFileNameExA" ); @@ -662,7 +662,7 @@ private: { // we couldn't find all functions FreeLibrary(hPsapi); - return FALSE; + return false; } hMods = (HMODULE*) malloc(sizeof(HMODULE) * (TTBUFLEN / sizeof(HMODULE))); @@ -797,7 +797,7 @@ private: return result; } public: - BOOL LoadModules(HANDLE hProcess, DWORD dwProcessId) + bool LoadModules(HANDLE hProcess, DWORD dwProcessId) { // first try toolhelp32 if (GetModuleListTH32(hProcess, dwProcessId)) @@ -807,13 +807,13 @@ public: } - BOOL GetModuleInfo(HANDLE hProcess, DWORD64 baseAddr, IMAGEHLP_MODULE64_V3 *pModuleInfo) + bool GetModuleInfo(HANDLE hProcess, DWORD64 baseAddr, IMAGEHLP_MODULE64_V3 *pModuleInfo) { memset(pModuleInfo, 0, sizeof(IMAGEHLP_MODULE64_V3)); if(this->pSGMI == NULL) { SetLastError(ERROR_DLL_INIT_FAILED); - return FALSE; + return false; } // First try to use the larger ModuleInfo-Structure pModuleInfo->SizeOfStruct = sizeof(IMAGEHLP_MODULE64_V3); @@ -821,7 +821,7 @@ public: if (pData == NULL) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; + return false; } memcpy(pData, pModuleInfo, sizeof(IMAGEHLP_MODULE64_V3)); static bool s_useV3Version = true; @@ -833,7 +833,7 @@ public: memcpy(pModuleInfo, pData, sizeof(IMAGEHLP_MODULE64_V3)); pModuleInfo->SizeOfStruct = sizeof(IMAGEHLP_MODULE64_V3); free(pData); - return TRUE; + return true; } s_useV3Version = false; // to prevent unneccessarry calls with the larger struct... } @@ -847,11 +847,11 @@ public: memcpy(pModuleInfo, pData, sizeof(IMAGEHLP_MODULE64_V2)); pModuleInfo->SizeOfStruct = sizeof(IMAGEHLP_MODULE64_V2); free(pData); - return TRUE; + return true; } free(pData); SetLastError(ERROR_DLL_INIT_FAILED); - return FALSE; + return false; } }; @@ -860,7 +860,7 @@ StackWalker::StackWalker(DWORD dwProcessId, HANDLE hProcess) { this->m_verbose = true; this->m_options = OptionsAll; - this->m_modulesLoaded = FALSE; + this->m_modulesLoaded = false; this->m_hProcess = hProcess; this->m_sw = new StackWalkerInternal(this, this->m_hProcess); this->m_dwProcessId = dwProcessId; @@ -871,7 +871,7 @@ StackWalker::StackWalker(bool verbose, int options, LPCSTR szSymPath, DWORD dwPr { this->m_verbose = verbose; this->m_options = options; - this->m_modulesLoaded = FALSE; + this->m_modulesLoaded = false; this->m_hProcess = hProcess; this->m_sw = new StackWalkerInternal(this, this->m_hProcess); this->m_dwProcessId = dwProcessId; @@ -895,15 +895,15 @@ StackWalker::~StackWalker() this->m_sw = NULL; } -BOOL StackWalker::LoadModules() +bool StackWalker::LoadModules() { if (this->m_sw == NULL) { SetLastError(ERROR_DLL_INIT_FAILED); - return FALSE; + return false; } if (m_modulesLoaded != FALSE) - return TRUE; + return true; // Build the sym-path: char *szSymPath = NULL; @@ -914,7 +914,7 @@ BOOL StackWalker::LoadModules() if (szSymPath == NULL) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; + return false; } szSymPath[0] = 0; // Now first add the (optional) provided sympath: @@ -994,18 +994,18 @@ BOOL StackWalker::LoadModules() } // if SymBuildPath // First Init the whole stuff... - BOOL bRet = this->m_sw->Init(szSymPath); + bool bRet = this->m_sw->Init(szSymPath); if (szSymPath != NULL) free(szSymPath); szSymPath = NULL; - if (bRet == FALSE) + if (!bRet) { this->OnDbgHelpErr("Error while initializing dbghelp.dll", 0, 0); SetLastError(ERROR_DLL_INIT_FAILED); - return FALSE; + return false; } bRet = this->m_sw->LoadModules(this->m_hProcess, this->m_dwProcessId); - if (bRet != FALSE) - m_modulesLoaded = TRUE; + if (bRet) + m_modulesLoaded = true; return bRet; } @@ -1017,7 +1017,7 @@ BOOL StackWalker::LoadModules() static StackWalker::PReadProcessMemoryRoutine s_readMemoryFunction = NULL; static LPVOID s_readMemoryFunction_UserData = NULL; -BOOL StackWalker::ShowCallstack(bool verbose, HANDLE hThread, const CONTEXT *context, PReadProcessMemoryRoutine readMemoryFunction, LPVOID pUserData) +bool StackWalker::ShowCallstack(bool verbose, HANDLE hThread, const CONTEXT *context, PReadProcessMemoryRoutine readMemoryFunction, LPVOID pUserData) { m_verbose = verbose; CONTEXT c; @@ -1029,13 +1029,13 @@ BOOL StackWalker::ShowCallstack(bool verbose, HANDLE hThread, const CONTEXT *con bool bLastEntryCalled = true; int curRecursionCount = 0; - if (m_modulesLoaded == FALSE) + if (!m_modulesLoaded) this->LoadModules(); // ignore the result... if (this->m_sw->m_hDbhHelp == NULL) { SetLastError(ERROR_DLL_INIT_FAILED); - return FALSE; + return false; } s_readMemoryFunction = readMemoryFunction; @@ -1062,7 +1062,7 @@ BOOL StackWalker::ShowCallstack(bool verbose, HANDLE hThread, const CONTEXT *con if (GetThreadContext(hThread, &c) == FALSE) { ResumeThread(hThread); - return FALSE; + return false; } } } @@ -1256,13 +1256,13 @@ BOOL StackWalker::ShowCallstack(bool verbose, HANDLE hThread, const CONTEXT *con cleanup: if (pSym) free( pSym ); - if (bLastEntryCalled == false) + if (!bLastEntryCalled) this->OnCallstackEntry(lastEntry, csEntry); if (context == NULL) ResumeThread(hThread); - return TRUE; + return true; } BOOL __stdcall StackWalker::myReadProcMem( diff --git a/indra/llcommon/StackWalker.h b/indra/llcommon/StackWalker.h index 91cd55bbaf..c76b07a739 100644 --- a/indra/llcommon/StackWalker.h +++ b/indra/llcommon/StackWalker.h @@ -112,9 +112,9 @@ public: LPVOID pUserData // optional data, which was passed in "ShowCallstack" ); - BOOL LoadModules(); + bool LoadModules(); - BOOL ShowCallstack( + bool ShowCallstack( bool verbose, HANDLE hThread = GetCurrentThread(), const CONTEXT *context = NULL, @@ -159,7 +159,7 @@ protected: StackWalkerInternal *m_sw; HANDLE m_hProcess; DWORD m_dwProcessId; - BOOL m_modulesLoaded; + bool m_modulesLoaded; LPSTR m_szSymPath; bool m_verbose; diff --git a/indra/llcommon/is_approx_equal_fraction.h b/indra/llcommon/is_approx_equal_fraction.h index 79f4f5ebbd..371a1307c1 100644 --- a/indra/llcommon/is_approx_equal_fraction.h +++ b/indra/llcommon/is_approx_equal_fraction.h @@ -43,9 +43,9 @@ * signatures. */ template <typename FTYPE> -inline BOOL is_approx_equal_fraction_impl(FTYPE x, FTYPE y, U32 frac_bits) +inline bool is_approx_equal_fraction_impl(FTYPE x, FTYPE y, U32 frac_bits) { - BOOL ret = TRUE; + bool ret = true; FTYPE diff = (FTYPE) fabs(x - y); S32 diffInt = (S32) diff; @@ -58,20 +58,20 @@ inline BOOL is_approx_equal_fraction_impl(FTYPE x, FTYPE y, U32 frac_bits) // based on the number of bits used for packing decimal portion. if (diffInt != 0 || diffFracTolerance > 1) { - ret = FALSE; + ret = false; } return ret; } /// F32 flavor -inline BOOL is_approx_equal_fraction(F32 x, F32 y, U32 frac_bits) +inline bool is_approx_equal_fraction(F32 x, F32 y, U32 frac_bits) { return is_approx_equal_fraction_impl<F32>(x, y, frac_bits); } /// F64 flavor -inline BOOL is_approx_equal_fraction(F64 x, F64 y, U32 frac_bits) +inline bool is_approx_equal_fraction(F64 x, F64 y, U32 frac_bits) { return is_approx_equal_fraction_impl<F64>(x, y, frac_bits); } diff --git a/indra/llcommon/llalignedarray.h b/indra/llcommon/llalignedarray.h index 0ba8b34cb6..8248f82186 100644 --- a/indra/llcommon/llalignedarray.h +++ b/indra/llcommon/llalignedarray.h @@ -116,7 +116,7 @@ void LLAlignedArray<T, alignment>::resize(U32 size) template <class T, U32 alignment> T& LLAlignedArray<T, alignment>::operator[](int idx) { - if(idx >= mElementCount || idx < 0) + if (idx < 0 || unsigned(idx) >= mElementCount) { LL_ERRS() << "Out of bounds LLAlignedArray, requested: " << (S32)idx << " size: " << mElementCount << LL_ENDL; } @@ -126,7 +126,7 @@ T& LLAlignedArray<T, alignment>::operator[](int idx) template <class T, U32 alignment> const T& LLAlignedArray<T, alignment>::operator[](int idx) const { - if (idx >= mElementCount || idx < 0) + if (idx < 0 || unsigned(idx) >= mElementCount) { LL_ERRS() << "Out of bounds LLAlignedArray, requested: " << (S32)idx << " size: " << mElementCount << LL_ENDL; } diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp index 9729f68d23..b85bd2573b 100644 --- a/indra/llcommon/llapp.cpp +++ b/indra/llcommon/llapp.cpp @@ -52,15 +52,7 @@ // // Signal handling -// -// Windows uses structured exceptions, so it's handled a bit differently. -// -#if LL_WINDOWS -#include "windows.h" - -LONG WINAPI default_windows_exception_handler(struct _EXCEPTION_POINTERS *exception_infop); -BOOL ConsoleCtrlHandler(DWORD fdwCtrlType); -#else +#ifndef LL_WINDOWS # include <signal.h> # include <unistd.h> // for fork() void setup_signals(); @@ -87,18 +79,18 @@ S32 LL_HEARTBEAT_SIGNAL = SIGUSR2; S32 LL_SMACKDOWN_SIGNAL = (SIGRTMAX >= 0) ? (SIGRTMAX-1) : SIGUSR1; S32 LL_HEARTBEAT_SIGNAL = (SIGRTMAX >= 0) ? (SIGRTMAX-0) : SIGUSR2; # endif // LL_DARWIN -#endif // LL_WINDOWS +#endif // !LL_WINDOWS // the static application instance LLApp* LLApp::sApplication = NULL; // Allows the generation of core files for post mortem under gdb // and disables crashlogger -BOOL LLApp::sDisableCrashlogger = FALSE; +bool LLApp::sDisableCrashlogger = false; // Local flag for whether or not to do logging in signal handlers. //static -BOOL LLApp::sLogInSignal = FALSE; +bool LLApp::sLogInSignal = false; // static // Keeps track of application status @@ -207,9 +199,9 @@ bool LLApp::parseCommandOptions(int argc, char** argv) #if LL_WINDOWS //Windows changed command line parsing. Deal with it. - S32 slen = value.length() - 1; - S32 start = 0; - S32 end = slen; + size_t slen = value.length() - 1; + size_t start = 0; + size_t end = slen; if (argv[ii][start]=='"')start++; if (argv[ii][end]=='"')end--; if (start!=0 || end!=slen) @@ -272,9 +264,9 @@ bool LLApp::parseCommandOptions(int argc, wchar_t** wargv) #if LL_WINDOWS //Windows changed command line parsing. Deal with it. - S32 slen = value.length() - 1; - S32 start = 0; - S32 end = slen; + size_t slen = value.length() - 1; + size_t start = 0; + size_t end = slen; if (wargv[ii][start]=='"')start++; if (wargv[ii][end]=='"')end--; if (start!=0 || end!=slen) @@ -326,33 +318,6 @@ void LLApp::stepFrame() mRunner.run(); } -#if LL_WINDOWS -//The following code is needed for 32-bit apps on 64-bit windows to keep it from eating -//crashes. It is a lovely undocumented 'feature' in SP1 of Windows 7. An excellent -//in-depth article on the issue may be found here: http://randomascii.wordpress.com/2012/07/05/when-even-crashing-doesn-work/ -void EnableCrashingOnCrashes() -{ - typedef BOOL (WINAPI *tGetPolicy)(LPDWORD lpFlags); - typedef BOOL (WINAPI *tSetPolicy)(DWORD dwFlags); - const DWORD EXCEPTION_SWALLOWING = 0x1; - - HMODULE kernel32 = LoadLibraryA("kernel32.dll"); - tGetPolicy pGetPolicy = (tGetPolicy)GetProcAddress(kernel32, - "GetProcessUserModeExceptionPolicy"); - tSetPolicy pSetPolicy = (tSetPolicy)GetProcAddress(kernel32, - "SetProcessUserModeExceptionPolicy"); - if (pGetPolicy && pSetPolicy) - { - DWORD dwFlags; - if (pGetPolicy(&dwFlags)) - { - // Turn off the filter - pSetPolicy(dwFlags & ~EXCEPTION_SWALLOWING); - } - } -} -#endif - void LLApp::setupErrorHandling(bool second_instance) { // Error handling is done by starting up an error handling thread, which just sleeps and @@ -503,13 +468,13 @@ bool LLApp::isExiting() void LLApp::disableCrashlogger() { - sDisableCrashlogger = TRUE; + sDisableCrashlogger = true; } // static bool LLApp::isCrashloggerDisabled() { - return (sDisableCrashlogger == TRUE); + return sDisableCrashlogger; } // static @@ -522,77 +487,7 @@ int LLApp::getPid() #endif } -#if LL_WINDOWS -LONG WINAPI default_windows_exception_handler(struct _EXCEPTION_POINTERS *exception_infop) -{ - // Translate the signals/exceptions into cross-platform stuff - // Windows implementation - - // Make sure the user sees something to indicate that the app crashed. - LONG retval; - - if (LLApp::isError()) - { - LL_WARNS() << "Got another fatal signal while in the error handler, die now!" << LL_ENDL; - retval = EXCEPTION_EXECUTE_HANDLER; - return retval; - } - - // Flag status to error, so thread_error starts its work - LLApp::setError(); - - // Block in the exception handler until the app has stopped - // This is pretty sketchy, but appears to work just fine - while (!LLApp::isStopped()) - { - ms_sleep(10); - } - - // - // Generate a minidump if we can. - // - // TODO: This needs to be ported over form the viewer-specific - // LLWinDebug class - - // - // At this point, we always want to exit the app. There's no graceful - // recovery for an unhandled exception. - // - // Just kill the process. - retval = EXCEPTION_EXECUTE_HANDLER; - return retval; -} - -// Win32 doesn't support signals. This is used instead. -BOOL ConsoleCtrlHandler(DWORD fdwCtrlType) -{ - switch (fdwCtrlType) - { - case CTRL_BREAK_EVENT: - case CTRL_LOGOFF_EVENT: - case CTRL_SHUTDOWN_EVENT: - case CTRL_CLOSE_EVENT: // From end task or the window close button. - case CTRL_C_EVENT: // from CTRL-C on the keyboard - // Just set our state to quitting, not error - if (LLApp::isQuitting() || LLApp::isError()) - { - // We're already trying to die, just ignore this signal - if (LLApp::sLogInSignal) - { - LL_INFOS() << "Signal handler - Already trying to quit, ignoring signal!" << LL_ENDL; - } - return TRUE; - } - LLApp::setQuitting(); - return TRUE; - - default: - return FALSE; - } -} - -#else //!LL_WINDOWS - +#ifndef LL_WINDOWS void setup_signals() { // @@ -691,9 +586,10 @@ void default_unix_signal_handler(int signum, siginfo_t *info, void *) switch (signum) { case SIGCHLD: + case SIGHUP: if (LLApp::sLogInSignal) { - LL_INFOS() << "Signal handler - Got SIGCHLD from " << info->si_pid << LL_ENDL; + LL_INFOS() << "Signal handler - Got SIGCHLD or SIGHUP from " << info->si_pid << LL_ENDL; } return; @@ -708,11 +604,10 @@ void default_unix_signal_handler(int signum, siginfo_t *info, void *) raise(signum); return; case SIGINT: - case SIGHUP: case SIGTERM: if (LLApp::sLogInSignal) { - LL_WARNS() << "Signal handler - Got SIGINT, HUP, or TERM, exiting gracefully" << LL_ENDL; + LL_WARNS() << "Signal handler - Got SIGINT, or TERM, exiting gracefully" << LL_ENDL; } // Graceful exit // Just set our state to quitting, not error @@ -805,9 +700,6 @@ void default_unix_signal_handler(int signum, siginfo_t *info, void *) } } -#if LL_LINUX -#endif - bool unix_post_minidump_callback(const char *dump_dir, const char *minidump_id, void *context, bool succeeded) diff --git a/indra/llcommon/llapp.h b/indra/llcommon/llapp.h index 93bf4dd929..ad8912ca88 100644 --- a/indra/llcommon/llapp.h +++ b/indra/llcommon/llapp.h @@ -291,7 +291,7 @@ protected: static void setStatus(EAppStatus status); // Use this to change the application status. static LLScalarCond<EAppStatus> sStatus; // Reflects current application status - static BOOL sDisableCrashlogger; // Let the OS handle crashes for us. + static bool sDisableCrashlogger; // Let the OS handle crashes for us. std::wstring mCrashReportPipeStr; //Name of pipe to use for crash reporting. std::string mDumpPath; //output path for google breakpad. Dependency workaround. @@ -336,7 +336,7 @@ private: #endif public: - static BOOL sLogInSignal; + static bool sLogInSignal; }; #endif // LL_LLAPP_H diff --git a/indra/llcommon/llapr.cpp b/indra/llcommon/llapr.cpp index c907a8c073..b085f8f5dc 100644 --- a/indra/llcommon/llapr.cpp +++ b/indra/llcommon/llapr.cpp @@ -56,7 +56,7 @@ void ll_init_apr() if(!LLAPRFile::sAPRFilePoolp) { - LLAPRFile::sAPRFilePoolp = new LLVolatileAPRPool(FALSE) ; + LLAPRFile::sAPRFilePoolp = new LLVolatileAPRPool(false) ; } gAPRInitialized = true; @@ -91,7 +91,7 @@ void ll_cleanup_apr() // //LLAPRPool // -LLAPRPool::LLAPRPool(apr_pool_t *parent, apr_size_t size, BOOL releasePoolFlag) +LLAPRPool::LLAPRPool(apr_pool_t *parent, apr_size_t size, bool releasePoolFlag) : mParent(parent), mReleasePoolFlag(releasePoolFlag), mMaxSize(size), @@ -145,7 +145,7 @@ apr_pool_t* LLAPRPool::getAPRPool() return mPool ; } -LLVolatileAPRPool::LLVolatileAPRPool(BOOL is_local, apr_pool_t *parent, apr_size_t size, BOOL releasePoolFlag) +LLVolatileAPRPool::LLVolatileAPRPool(bool is_local, apr_pool_t *parent, apr_size_t size, bool releasePoolFlag) : LLAPRPool(parent, size, releasePoolFlag), mNumActiveRef(0), mNumTotalRef(0) @@ -219,7 +219,7 @@ void LLVolatileAPRPool::clearVolatileAPRPool() llassert(mNumTotalRef <= (FULL_VOLATILE_APR_POOL << 2)) ; } -BOOL LLVolatileAPRPool::isFull() +bool LLVolatileAPRPool::isFull() { return mNumTotalRef > FULL_VOLATILE_APR_POOL ; } @@ -385,7 +385,7 @@ apr_status_t LLAPRFile::open(const std::string& filename, apr_int32_t flags, LLV } //use gAPRPoolp. -apr_status_t LLAPRFile::open(const std::string& filename, apr_int32_t flags, BOOL use_global_pool) +apr_status_t LLAPRFile::open(const std::string& filename, apr_int32_t flags, bool use_global_pool) { apr_status_t s; @@ -571,7 +571,7 @@ S32 LLAPRFile::readEx(const std::string& filename, void *buf, S32 offset, S32 nb } //static -S32 LLAPRFile::writeEx(const std::string& filename, void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool) +S32 LLAPRFile::writeEx(const std::string& filename, const void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool) { LL_PROFILE_ZONE_SCOPED; apr_int32_t flags = APR_CREATE|APR_WRITE|APR_BINARY; diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index 2f88fdcd59..00ff4d60b7 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -78,7 +78,7 @@ bool LL_COMMON_API ll_apr_is_initialized(); class LL_COMMON_API LLAPRPool { public: - LLAPRPool(apr_pool_t *parent = NULL, apr_size_t size = 0, BOOL releasePoolFlag = TRUE) ; + LLAPRPool(apr_pool_t *parent = NULL, apr_size_t size = 0, bool releasePoolFlag = true) ; virtual ~LLAPRPool() ; virtual apr_pool_t* getAPRPool() ; @@ -93,7 +93,7 @@ protected: apr_pool_t* mParent ; //parent pool apr_size_t mMaxSize ; //max size of mPool, mPool should return memory to system if allocated memory beyond this limit. However it seems not to work. apr_status_t mStatus ; //status when creating the pool - BOOL mReleasePoolFlag ; //if set, mPool is destroyed when LLAPRPool is deleted. default value is true. + bool mReleasePoolFlag ; //if set, mPool is destroyed when LLAPRPool is deleted. default value is true. }; // @@ -104,14 +104,14 @@ protected: class LL_COMMON_API LLVolatileAPRPool : public LLAPRPool { public: - LLVolatileAPRPool(BOOL is_local = TRUE, apr_pool_t *parent = NULL, apr_size_t size = 0, BOOL releasePoolFlag = TRUE); + LLVolatileAPRPool(bool is_local = true, apr_pool_t *parent = NULL, apr_size_t size = 0, bool releasePoolFlag = true); virtual ~LLVolatileAPRPool(); /*virtual*/ apr_pool_t* getAPRPool() ; //define this virtual function to avoid any mistakenly calling LLAPRPool::getAPRPool(). apr_pool_t* getVolatileAPRPool() ; void clearVolatileAPRPool() ; - BOOL isFull() ; + bool isFull() ; private: S32 mNumActiveRef ; //number of active pointers pointing to the apr_pool. @@ -158,7 +158,7 @@ public: ~LLAPRFile() ; apr_status_t open(const std::string& filename, apr_int32_t flags, LLVolatileAPRPool* pool = NULL, S32* sizep = NULL); - apr_status_t open(const std::string& filename, apr_int32_t flags, BOOL use_global_pool); //use gAPRPoolp. + apr_status_t open(const std::string& filename, apr_int32_t flags, bool use_global_pool); //use gAPRPoolp. apr_status_t close() ; // Returns actual offset, -1 if seek fails @@ -193,7 +193,7 @@ public: // Returns bytes read/written, 0 if read/write fails: static S32 readEx(const std::string& filename, void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool = NULL); - static S32 writeEx(const std::string& filename, void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool = NULL); // offset<0 means append + static S32 writeEx(const std::string& filename, const void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool = NULL); // offset<0 means append //******************************************************************************************************************************* }; diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp index 3e46bde954..c09cf7abd2 100644 --- a/indra/llcommon/llassettype.cpp +++ b/indra/llcommon/llassettype.cpp @@ -97,8 +97,10 @@ LLAssetDictionary::LLAssetDictionary() addEntry(LLAssetType::AT_PERSON, new AssetEntry("PERSON", "person", "person", false, false, false)); addEntry(LLAssetType::AT_SETTINGS, new AssetEntry("SETTINGS", "settings", "settings blob", true, true, true)); addEntry(LLAssetType::AT_MATERIAL, new AssetEntry("MATERIAL", "material", "render material", true, true, true)); + addEntry(LLAssetType::AT_GLTF, new AssetEntry("GLTF", "gltf", "GLTF", true, true, true)); + addEntry(LLAssetType::AT_GLTF_BIN, new AssetEntry("GLTF_BIN", "glbin", "GLTF binary", true, true, true)); addEntry(LLAssetType::AT_UNKNOWN, new AssetEntry("UNKNOWN", "invalid", NULL, false, false, false)); - addEntry(LLAssetType::AT_NONE, new AssetEntry("NONE", "-1", NULL, FALSE, FALSE, FALSE)); + addEntry(LLAssetType::AT_NONE, new AssetEntry("NONE", "-1", NULL, false, false, false)); }; diff --git a/indra/llcommon/llassettype.h b/indra/llcommon/llassettype.h index 1989155550..547c3f4329 100644 --- a/indra/llcommon/llassettype.h +++ b/indra/llcommon/llassettype.h @@ -128,8 +128,10 @@ public: AT_SETTINGS = 56, // Collection of settings AT_MATERIAL = 57, // Render Material + AT_GLTF = 58, // gltf json document + AT_GLTF_BIN = 59, // gltf binary data - AT_COUNT = 58, + AT_COUNT = 60, // +*********************************************************+ // | TO ADD AN ELEMENT TO THIS ENUM: | diff --git a/indra/llcommon/llbase64.cpp b/indra/llcommon/llbase64.cpp index dbbbec9813..b8185a0c84 100644 --- a/indra/llcommon/llbase64.cpp +++ b/indra/llcommon/llbase64.cpp @@ -59,3 +59,19 @@ std::string LLBase64::encode(const U8* input, size_t input_size) return output; } +std::string LLBase64::decodeAsString(const std::string &input) +{ + int b64_buffer_length = apr_base64_decode_len(input.c_str()); + 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_decode(b64_buffer, input.c_str()); + std::string res; + res.assign(b64_buffer); + delete[] b64_buffer; + return res; +} + diff --git a/indra/llcommon/llbase64.h b/indra/llcommon/llbase64.h index d4e9d97ea4..4f21e65244 100644 --- a/indra/llcommon/llbase64.h +++ b/indra/llcommon/llbase64.h @@ -32,6 +32,7 @@ class LL_COMMON_API LLBase64 { public: static std::string encode(const U8* input, size_t input_size); + static std::string decodeAsString(const std::string& input); }; #endif diff --git a/indra/llcommon/llcallbacklist.cpp b/indra/llcommon/llcallbacklist.cpp index b5a58e90b3..3d5d30bd90 100644 --- a/indra/llcommon/llcallbacklist.cpp +++ b/indra/llcommon/llcallbacklist.cpp @@ -70,11 +70,11 @@ bool LLCallbackList::containsFunction( callback_t func, void *data) callback_list_t::iterator iter = find(func,data); if (iter != mCallbackList.end()) { - return TRUE; + return true; } else { - return FALSE; + return false; } } @@ -85,11 +85,11 @@ bool LLCallbackList::deleteFunction( callback_t func, void *data) if (iter != mCallbackList.end()) { mCallbackList.erase(iter); - return TRUE; + return true; } else { - return FALSE; + return false; } } @@ -191,10 +191,10 @@ public: } private: - BOOL tick() + bool tick() { mCallable(); - return TRUE; + return true; } nullary_func_t mCallable; @@ -215,7 +215,7 @@ public: { } private: - BOOL tick() + bool tick() { return mCallable(); } diff --git a/indra/llcommon/llcommon.cpp b/indra/llcommon/llcommon.cpp index 14bdeb5c60..f1f3958fe0 100644 --- a/indra/llcommon/llcommon.cpp +++ b/indra/llcommon/llcommon.cpp @@ -115,7 +115,7 @@ void tracy_aligned_free(void *memblock) #endif //static -BOOL LLCommon::sAprInitialized = FALSE; +bool LLCommon::sAprInitialized = false; static LLTrace::ThreadRecorder* sMasterThreadRecorder = NULL; @@ -125,10 +125,9 @@ void LLCommon::initClass() if (!sAprInitialized) { ll_init_apr(); - sAprInitialized = TRUE; + sAprInitialized = true; } LLTimer::initClass(); - LLThreadSafeRefCount::initThreadSafeRefCount(); assert_main_thread(); // Make sure we record the main thread if (!sMasterThreadRecorder) { @@ -143,11 +142,10 @@ void LLCommon::cleanupClass() delete sMasterThreadRecorder; sMasterThreadRecorder = NULL; LLTrace::set_master_thread_recorder(NULL); - LLThreadSafeRefCount::cleanupThreadSafeRefCount(); SUBSYSTEM_CLEANUP_DBG(LLTimer); if (sAprInitialized) { ll_cleanup_apr(); - sAprInitialized = FALSE; + sAprInitialized = false; } } diff --git a/indra/llcommon/llcommon.h b/indra/llcommon/llcommon.h index 129e71f703..41a101eb62 100644 --- a/indra/llcommon/llcommon.h +++ b/indra/llcommon/llcommon.h @@ -36,7 +36,7 @@ public: static void initClass(); static void cleanupClass(); private: - static BOOL sAprInitialized; + static bool sAprInitialized; }; #endif diff --git a/indra/llcommon/llcoros.cpp b/indra/llcommon/llcoros.cpp index 6285ac86ad..3fe7e09e7e 100644 --- a/indra/llcommon/llcoros.cpp +++ b/indra/llcommon/llcoros.cpp @@ -3,25 +3,25 @@ * @author Nat Goodspeed * @date 2009-06-03 * @brief Implementation for llcoros. - * + * * $LicenseInfo:firstyear=2009&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$ */ @@ -62,6 +62,23 @@ #endif // static +bool LLCoros::on_main_coro() +{ + if (!LLCoros::instanceExists() || LLCoros::getName().empty()) + { + return true; + } + + return false; +} + +// static +bool LLCoros::on_main_thread_main_coro() +{ + return on_main_coro() && on_main_thread(); +} + +// static LLCoros::CoroData& LLCoros::get_CoroData(const std::string& caller) { CoroData* current{ nullptr }; diff --git a/indra/llcommon/llcoros.h b/indra/llcommon/llcoros.h index 71c1c1c443..369d65407e 100644 --- a/indra/llcommon/llcoros.h +++ b/indra/llcommon/llcoros.h @@ -94,6 +94,16 @@ class LL_COMMON_API LLCoros: public LLSingleton<LLCoros> void cleanupSingleton() override; public: + // For debugging, return true if on the main coroutine for the current thread + // Code that should not be executed from a coroutine should be protected by + // llassert(LLCoros::on_main_coro()) + static bool on_main_coro(); + + // For debugging, return true if on the main thread and not in a coroutine + // Non-thread-safe code in the main loop should be protected by + // llassert(LLCoros::on_main_thread_main_coro()) + static bool on_main_thread_main_coro(); + /// The viewer's use of the term "coroutine" became deeply embedded before /// the industry term "fiber" emerged to distinguish userland threads from /// simpler, more transient kinds of coroutines. Semantically they've diff --git a/indra/llcommon/llcrc.cpp b/indra/llcommon/llcrc.cpp index 34aa7b46e8..d79d06e2a2 100644 --- a/indra/llcommon/llcrc.cpp +++ b/indra/llcommon/llcrc.cpp @@ -200,7 +200,7 @@ void LLCRC::update(const std::string& filename) #ifdef _DEBUG -BOOL LLCRC::testHarness() +bool LLCRC::testHarness() { const S32 TEST_BUFFER_SIZE = 16; const char TEST_BUFFER[TEST_BUFFER_SIZE] = "hello &#$)$&Nd0"; /* Flawfinder: ignore */ diff --git a/indra/llcommon/llcrc.h b/indra/llcommon/llcrc.h index 3b48b778ff..a3bde47780 100644 --- a/indra/llcommon/llcrc.h +++ b/indra/llcommon/llcrc.h @@ -59,8 +59,8 @@ public: #ifdef _DEBUG // This function runs tests to make sure the crc is - // working. Returns TRUE if it is. - static BOOL testHarness(); + // working. Returns true if it is. + static bool testHarness(); #endif }; diff --git a/indra/llcommon/lldefs.h b/indra/llcommon/lldefs.h index 0ba756d472..2fbb26dc1a 100644 --- a/indra/llcommon/lldefs.h +++ b/indra/llcommon/lldefs.h @@ -31,64 +31,64 @@ #include <type_traits> // Often used array indices -const U32 VX = 0; -const U32 VY = 1; -const U32 VZ = 2; -const U32 VW = 3; -const U32 VS = 3; - -const U32 VRED = 0; -const U32 VGREEN = 1; -const U32 VBLUE = 2; -const U32 VALPHA = 3; - -const U32 INVALID_DIRECTION = 0xFFFFFFFF; -const U32 EAST = 0; -const U32 NORTH = 1; -const U32 WEST = 2; -const U32 SOUTH = 3; - -const U32 NORTHEAST = 4; -const U32 NORTHWEST = 5; -const U32 SOUTHWEST = 6; -const U32 SOUTHEAST = 7; -const U32 MIDDLE = 8; - -const U8 EAST_MASK = 0x1<<EAST; -const U8 NORTH_MASK = 0x1<<NORTH; -const U8 WEST_MASK = 0x1<<WEST; -const U8 SOUTH_MASK = 0x1<<SOUTH; - -const U8 NORTHEAST_MASK = NORTH_MASK | EAST_MASK; -const U8 NORTHWEST_MASK = NORTH_MASK | WEST_MASK; -const U8 SOUTHWEST_MASK = SOUTH_MASK | WEST_MASK; -const U8 SOUTHEAST_MASK = SOUTH_MASK | EAST_MASK; - -const U32 gDirOpposite[8] = {2, 3, 0, 1, 6, 7, 4, 5}; -const U32 gDirAdjacent[8][2] = { - {4, 7}, - {4, 5}, - {5, 6}, - {6, 7}, - {0, 1}, - {1, 2}, - {2, 3}, - {0, 3} - }; +constexpr U32 VX = 0; +constexpr U32 VY = 1; +constexpr U32 VZ = 2; +constexpr U32 VW = 3; +constexpr U32 VS = 3; + +constexpr U32 VRED = 0; +constexpr U32 VGREEN = 1; +constexpr U32 VBLUE = 2; +constexpr U32 VALPHA = 3; + +constexpr U32 INVALID_DIRECTION = 0xFFFFFFFF; +constexpr U32 EAST = 0; +constexpr U32 NORTH = 1; +constexpr U32 WEST = 2; +constexpr U32 SOUTH = 3; + +constexpr U32 NORTHEAST = 4; +constexpr U32 NORTHWEST = 5; +constexpr U32 SOUTHWEST = 6; +constexpr U32 SOUTHEAST = 7; +constexpr U32 MIDDLE = 8; + +constexpr U8 EAST_MASK = 0x1<<EAST; +constexpr U8 NORTH_MASK = 0x1<<NORTH; +constexpr U8 WEST_MASK = 0x1<<WEST; +constexpr U8 SOUTH_MASK = 0x1<<SOUTH; + +constexpr U8 NORTHEAST_MASK = NORTH_MASK | EAST_MASK; +constexpr U8 NORTHWEST_MASK = NORTH_MASK | WEST_MASK; +constexpr U8 SOUTHWEST_MASK = SOUTH_MASK | WEST_MASK; +constexpr U8 SOUTHEAST_MASK = SOUTH_MASK | EAST_MASK; + +constexpr U32 gDirOpposite[8] = {2, 3, 0, 1, 6, 7, 4, 5}; +constexpr U32 gDirAdjacent[8][2] = { + {4, 7}, + {4, 5}, + {5, 6}, + {6, 7}, + {0, 1}, + {1, 2}, + {2, 3}, + {0, 3} + }; // Magnitude along the x and y axis -const S32 gDirAxes[8][2] = { - { 1, 0}, // east - { 0, 1}, // north - {-1, 0}, // west - { 0,-1}, // south - { 1, 1}, // ne - {-1, 1}, // nw - {-1,-1}, // sw - { 1,-1}, // se - }; - -const S32 gDirMasks[8] = { +constexpr S32 gDirAxes[8][2] = { + { 1, 0}, // east + { 0, 1}, // north + {-1, 0}, // west + { 0,-1}, // south + { 1, 1}, // ne + {-1, 1}, // nw + {-1,-1}, // sw + { 1,-1}, // se + }; + +constexpr S32 gDirMasks[8] = { EAST_MASK, NORTH_MASK, WEST_MASK, @@ -117,22 +117,22 @@ const S32 gDirMasks[8] = { // | / -6- | / // |/ / |/ // +------------------+ -const U32 NO_SIDE = 0; -const U32 FRONT_SIDE = 1; -const U32 BACK_SIDE = 2; -const U32 LEFT_SIDE = 3; -const U32 RIGHT_SIDE = 4; -const U32 TOP_SIDE = 5; -const U32 BOTTOM_SIDE = 6; - -const U8 LL_SOUND_FLAG_NONE = 0x0; -const U8 LL_SOUND_FLAG_LOOP = 1<<0; -const U8 LL_SOUND_FLAG_SYNC_MASTER = 1<<1; -const U8 LL_SOUND_FLAG_SYNC_SLAVE = 1<<2; -const U8 LL_SOUND_FLAG_SYNC_PENDING = 1<<3; -const U8 LL_SOUND_FLAG_QUEUE = 1<<4; -const U8 LL_SOUND_FLAG_STOP = 1<<5; -const U8 LL_SOUND_FLAG_SYNC_MASK = LL_SOUND_FLAG_SYNC_MASTER | LL_SOUND_FLAG_SYNC_SLAVE | LL_SOUND_FLAG_SYNC_PENDING; +constexpr U32 NO_SIDE = 0; +constexpr U32 FRONT_SIDE = 1; +constexpr U32 BACK_SIDE = 2; +constexpr U32 LEFT_SIDE = 3; +constexpr U32 RIGHT_SIDE = 4; +constexpr U32 TOP_SIDE = 5; +constexpr U32 BOTTOM_SIDE = 6; + +constexpr U8 LL_SOUND_FLAG_NONE = 0x0; +constexpr U8 LL_SOUND_FLAG_LOOP = 1<<0; +constexpr U8 LL_SOUND_FLAG_SYNC_MASTER = 1<<1; +constexpr U8 LL_SOUND_FLAG_SYNC_SLAVE = 1<<2; +constexpr U8 LL_SOUND_FLAG_SYNC_PENDING = 1<<3; +constexpr U8 LL_SOUND_FLAG_QUEUE = 1<<4; +constexpr U8 LL_SOUND_FLAG_STOP = 1<<5; +constexpr U8 LL_SOUND_FLAG_SYNC_MASK = LL_SOUND_FLAG_SYNC_MASTER | LL_SOUND_FLAG_SYNC_SLAVE | LL_SOUND_FLAG_SYNC_PENDING; // // *NOTE: These values may be used as hard-coded numbers in scanf() variants. @@ -141,17 +141,17 @@ const U8 LL_SOUND_FLAG_SYNC_MASK = LL_SOUND_FLAG_SYNC_MASTER | LL_SOUND_FLAG_SYN // DO NOT CHANGE. // -------------- // -const U32 LL_MAX_PATH = 1024; // buffer size of maximum path + filename string length +constexpr U32 LL_MAX_PATH = 1024; // buffer size of maximum path + filename string length // For strings we send in messages -const U32 STD_STRING_BUF_SIZE = 255; // Buffer size -const U32 STD_STRING_STR_LEN = 254; // Length of the string (not including \0) +constexpr U32 STD_STRING_BUF_SIZE = 255; // Buffer size +constexpr U32 STD_STRING_STR_LEN = 254; // Length of the string (not including \0) // *NOTE: This value is used as hard-coded numbers in scanf() variants. // DO NOT CHANGE. -const U32 MAX_STRING = STD_STRING_BUF_SIZE; // Buffer size +constexpr U32 MAX_STRING = STD_STRING_BUF_SIZE; // Buffer size -const U32 MAXADDRSTR = 17; // 123.567.901.345 = 15 chars + \0 + 1 for good luck +constexpr U32 MAXADDRSTR = 17; // 123.567.901.345 = 15 chars + \0 + 1 for good luck // C++ is our friend. . . use template functions to make life easier! diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index e4843a88eb..fa24987d1c 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -55,6 +55,7 @@ #include "llsingleton.h" #include "llstl.h" #include "lltimer.h" +#include <boost/fiber/recursive_mutex.hpp> // On Mac, got: // #error "Boost.Stacktrace requires `_Unwind_Backtrace` function. Define @@ -506,7 +507,7 @@ namespace LLError::TimeFunction mTimeFunction; Recorders mRecorders; - LLMutex mRecorderMutex; + boost::fibers::recursive_mutex mRecorderMutex; int mShouldLogCallCounter; @@ -700,7 +701,7 @@ namespace bool shouldLogToStderr() { #if LL_DARWIN - // On Mac OS X, stderr from apps launched from the Finder goes to the + // On macOS, stderr from apps launched from the Finder goes to the // console log. It's generally considered bad form to spam too much // there. That scenario can be detected by noticing that stderr is a // character device (S_IFCHR). @@ -1044,7 +1045,7 @@ namespace LLError return; } SettingsConfigPtr s = Globals::getInstance()->getSettingsConfig(); - LLMutexLock lock(&s->mRecorderMutex); + std::unique_lock lock(s->mRecorderMutex); s->mRecorders.push_back(recorder); } @@ -1055,7 +1056,7 @@ namespace LLError return; } SettingsConfigPtr s = Globals::getInstance()->getSettingsConfig(); - LLMutexLock lock(&s->mRecorderMutex); + std::unique_lock lock(s->mRecorderMutex); s->mRecorders.erase(std::remove(s->mRecorders.begin(), s->mRecorders.end(), recorder), s->mRecorders.end()); } @@ -1104,7 +1105,7 @@ namespace LLError std::shared_ptr<RECORDER> findRecorder() { SettingsConfigPtr s = Globals::getInstance()->getSettingsConfig(); - LLMutexLock lock(&s->mRecorderMutex); + std::unique_lock lock(s->mRecorderMutex); return findRecorderPos<RECORDER>(s).first; } @@ -1115,7 +1116,7 @@ namespace LLError bool removeRecorder() { SettingsConfigPtr s = Globals::getInstance()->getSettingsConfig(); - LLMutexLock lock(&s->mRecorderMutex); + std::unique_lock lock(s->mRecorderMutex); auto found = findRecorderPos<RECORDER>(s); if (found.first) { @@ -1221,7 +1222,7 @@ namespace std::string escaped_message; - LLMutexLock lock(&s->mRecorderMutex); + std::unique_lock lock(s->mRecorderMutex); for (LLError::RecorderPtr& r : s->mRecorders) { if (!r->enabled()) diff --git a/indra/llcommon/lleventemitter.h b/indra/llcommon/lleventemitter.h index 14160e1e76..b9de854fda 100644 --- a/indra/llcommon/lleventemitter.h +++ b/indra/llcommon/lleventemitter.h @@ -57,14 +57,14 @@ class eventEmitter /////////////////////////////////////////////////////////////////////////////// // - BOOL addObserver ( T* observerIn ) + bool addObserver ( T* observerIn ) { if ( ! observerIn ) - return FALSE; + return false; // check if observer already exists if ( std::find ( observers.begin (), observers.end (), observerIn ) != observers.end () ) - return FALSE; + return false; // save it observers.push_back ( observerIn ); @@ -74,14 +74,14 @@ class eventEmitter /////////////////////////////////////////////////////////////////////////////// // - BOOL remObserver ( T* observerIn ) + bool remObserver ( T* observerIn ) { if ( ! observerIn ) - return FALSE; + return false; observers.remove ( observerIn ); - return TRUE; + return true; }; /////////////////////////////////////////////////////////////////////////////// diff --git a/indra/llcommon/llevents.cpp b/indra/llcommon/llevents.cpp index 5b4e69659d..3c6743eac9 100644 --- a/indra/llcommon/llevents.cpp +++ b/indra/llcommon/llevents.cpp @@ -382,7 +382,7 @@ std::string LLEventPump::inventName(const std::string& pfx) void LLEventPump::clear() { - LLMutexLock lock(&mConnectionListMutex); + LLCoros::LockType lock(mConnectionListMutex); // Destroy the original LLStandardSignal instance, replacing it with a // whole new one. mSignal = std::make_shared<LLStandardSignal>(); @@ -394,7 +394,7 @@ void LLEventPump::reset() { // Resetting mSignal is supposed to disconnect everything on its own // But due to crash on 'reset' added explicit cleanup to get more data - LLMutexLock lock(&mConnectionListMutex); + LLCoros::LockType lock(mConnectionListMutex); ConnectionMap::const_iterator iter = mConnections.begin(); ConnectionMap::const_iterator end = mConnections.end(); while (iter!=end) @@ -419,7 +419,7 @@ LLBoundListener LLEventPump::listen_impl(const std::string& name, const LLEventL return LLBoundListener(); } - LLMutexLock lock(&mConnectionListMutex); + LLCoros::LockType lock(mConnectionListMutex); float nodePosition = 1.0; @@ -582,7 +582,7 @@ LLBoundListener LLEventPump::listen_impl(const std::string& name, const LLEventL LLBoundListener LLEventPump::getListener(const std::string& name) { - LLMutexLock lock(&mConnectionListMutex); + LLCoros::LockType lock(mConnectionListMutex); ConnectionMap::const_iterator found = mConnections.find(name); if (found != mConnections.end()) { @@ -594,7 +594,7 @@ LLBoundListener LLEventPump::getListener(const std::string& name) void LLEventPump::stopListening(const std::string& name) { - LLMutexLock lock(&mConnectionListMutex); + LLCoros::LockType lock(mConnectionListMutex); ConnectionMap::iterator found = mConnections.find(name); if (found != mConnections.end()) { diff --git a/indra/llcommon/llevents.h b/indra/llcommon/llevents.h index 9a0a6863f0..f97fca0a32 100644 --- a/indra/llcommon/llevents.h +++ b/indra/llcommon/llevents.h @@ -61,6 +61,7 @@ #include "llstl.h" #include "llexception.h" #include "llhandle.h" +#include "llcoros.h" /*==========================================================================*| // override this to allow binding free functions with more parameters @@ -601,7 +602,7 @@ private: LLHandle<LLEventPumps> mRegistry; std::string mName; - LLMutex mConnectionListMutex; + LLCoros::Mutex mConnectionListMutex; protected: virtual LLBoundListener listen_impl(const std::string& name, const LLEventListener&, diff --git a/indra/llcommon/lleventtimer.h b/indra/llcommon/lleventtimer.h index ed6f10d5e1..e0c2381807 100644 --- a/indra/llcommon/lleventtimer.h +++ b/indra/llcommon/lleventtimer.h @@ -43,7 +43,7 @@ public: //function to be called at the supplied frequency // Normally return FALSE; TRUE will delete the timer after the function returns. - virtual BOOL tick() = 0; + virtual bool tick() = 0; static void updateClass(); @@ -86,7 +86,7 @@ public: mOnce(once), mCallable(callable) {} - BOOL tick() override + bool tick() override { mCallable(); // true tells updateClass() to delete this instance diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h index cf5e43d805..a69a03e419 100644 --- a/indra/llcommon/llfasttimer.h +++ b/indra/llcommon/llfasttimer.h @@ -229,7 +229,7 @@ private: private: U64 mStartTime; - BlockTimerStackRecord mParentTimerData; + BlockTimerStackRecord mParentTimerData{}; public: // statics diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp index 1877dd54ed..ddf239f306 100644 --- a/indra/llcommon/llfile.cpp +++ b/indra/llcommon/llfile.cpp @@ -27,6 +27,12 @@ * $/LicenseInfo$ */ +#include "linden_common.h" +#include "llfile.h" +#include "llstring.h" +#include "llerror.h" +#include "stringize.h" + #if LL_WINDOWS #include "llwin32headerslean.h" #include <stdlib.h> // Windows errno @@ -35,12 +41,6 @@ #include <errno.h> #endif -#include "linden_common.h" -#include "llfile.h" -#include "llstring.h" -#include "llerror.h" -#include "stringize.h" - using namespace std; static std::string empty; @@ -345,7 +345,7 @@ const char *LLFile::tmpdir() sep = '\\'; std::vector<wchar_t> utf16path(MAX_PATH + 1); - GetTempPathW(utf16path.size(), &utf16path[0]); + GetTempPathW(static_cast<DWORD>(utf16path.size()), &utf16path[0]); utf8path = ll_convert_wide_to_string(&utf16path[0]); #else sep = '/'; diff --git a/indra/llcommon/llfile.h b/indra/llcommon/llfile.h index 08a008c19a..2564671b13 100644 --- a/indra/llcommon/llfile.h +++ b/indra/llcommon/llfile.h @@ -97,7 +97,7 @@ public: // no copy LLUniqueFile(const LLUniqueFile&) = delete; // move construction - LLUniqueFile(LLUniqueFile&& other) + LLUniqueFile(LLUniqueFile&& other) noexcept { mFileHandle = other.mFileHandle; other.mFileHandle = nullptr; @@ -118,7 +118,7 @@ public: // copy assignment deleted LLUniqueFile& operator=(const LLUniqueFile&) = delete; // move assignment - LLUniqueFile& operator=(LLUniqueFile&& other) + LLUniqueFile& operator=(LLUniqueFile&& other) noexcept { close(); std::swap(mFileHandle, other.mFileHandle); diff --git a/indra/llcommon/llfindlocale.cpp b/indra/llcommon/llfindlocale.cpp index e39812bfc4..ac52f90c9f 100644 --- a/indra/llcommon/llfindlocale.cpp +++ b/indra/llcommon/llfindlocale.cpp @@ -157,14 +157,22 @@ canonise_fl(FL_Locale *l) { if (l->lang && 0 == strcmp(l->lang, "en")) { if (l->country && 0 == strcmp(l->country, "UK")) { free((void*)l->country); +#ifdef LL_WINDOWS + l->country = _strdup("GB"); +#else l->country = strdup("GB"); +#endif } } /* ja_JA -> ja_JP */ if (l->lang && 0 == strcmp(l->lang, "ja")) { if (l->country && 0 == strcmp(l->country, "JA")) { free((void*)l->country); +#ifdef LL_WINDOWS + l->country = _strdup("JP"); +#else l->country = strdup("JP"); +#endif } } } diff --git a/indra/llcommon/llfixedbuffer.h b/indra/llcommon/llfixedbuffer.h index eca0792d35..1234d2014f 100644 --- a/indra/llcommon/llfixedbuffer.h +++ b/indra/llcommon/llfixedbuffer.h @@ -33,6 +33,7 @@ #include "llstring.h" #include "llthread.h" #include "llerrorcontrol.h" +#include "llcoros.h" // fixed buffer implementation class LL_COMMON_API LLFixedBuffer : public LLLineBuffer @@ -58,7 +59,7 @@ protected: void addWLine(const LLWString& line); protected: - LLMutex mMutex ; + LLCoros::Mutex mMutex ; }; #endif //LL_FIXED_BUFFER_H diff --git a/indra/llcommon/llframetimer.cpp b/indra/llcommon/llframetimer.cpp index 2805662d6f..a0080b57bb 100644 --- a/indra/llcommon/llframetimer.cpp +++ b/indra/llcommon/llframetimer.cpp @@ -52,12 +52,12 @@ void LLFrameTimer::updateFrameTime() void LLFrameTimer::start() { reset(); - mStarted = TRUE; + mStarted = true; } void LLFrameTimer::stop() { - mStarted = FALSE; + mStarted = false; } void LLFrameTimer::reset() @@ -84,14 +84,14 @@ void LLFrameTimer::pause() { if (mStarted) mStartTime = sFrameTime - mStartTime; // save dtime - mStarted = FALSE; + mStarted = false; } void LLFrameTimer::unpause() { if (!mStarted) mStartTime = sFrameTime - mStartTime; // restore dtime - mStarted = TRUE; + mStarted = true; } void LLFrameTimer::setTimerExpirySec(F32 expiration) @@ -112,7 +112,7 @@ F64 LLFrameTimer::expiresAt() const return expires_at; } -BOOL LLFrameTimer::checkExpirationAndReset(F32 expiration) +bool LLFrameTimer::checkExpirationAndReset(F32 expiration) { //LL_INFOS() << "LLFrameTimer::checkExpirationAndReset()" << LL_ENDL; //LL_INFOS() << " mStartTime:" << mStartTime << LL_ENDL; @@ -123,9 +123,9 @@ BOOL LLFrameTimer::checkExpirationAndReset(F32 expiration) { reset(); setTimerExpirySec(expiration); - return TRUE; + return true; } - return FALSE; + return false; } // static diff --git a/indra/llcommon/llframetimer.h b/indra/llcommon/llframetimer.h index 876d933fd1..ba4f075b57 100644 --- a/indra/llcommon/llframetimer.h +++ b/indra/llcommon/llframetimer.h @@ -39,7 +39,7 @@ class LL_COMMON_API LLFrameTimer { public: - LLFrameTimer() : mStartTime( sFrameTime ), mExpiry(0), mStarted(TRUE) {} + LLFrameTimer() : mStartTime( sFrameTime ), mExpiry(0), mStarted(true) {} // Return the number of seconds since the start of this // application instance. @@ -84,16 +84,16 @@ public: void unpause(); void setTimerExpirySec(F32 expiration); void setExpiryAt(F64 seconds_since_epoch); - BOOL checkExpirationAndReset(F32 expiration); + bool checkExpirationAndReset(F32 expiration); F32 getElapsedTimeAndResetF32() { F32 t = F32(sFrameTime - mStartTime); reset(); return t; } void setAge(const F64 age) { mStartTime = sFrameTime - age; } // ACCESSORS - BOOL hasExpired() const { return (sFrameTime >= mExpiry); } + bool hasExpired() const { return (sFrameTime >= mExpiry); } F32 getTimeToExpireF32() const { return (F32)(mExpiry - sFrameTime); } F32 getElapsedTimeF32() const { return mStarted ? (F32)(sFrameTime - mStartTime) : (F32)mStartTime; } - BOOL getStarted() const { return mStarted; } + bool getStarted() const { return mStarted; } // return the seconds since epoch when this timer will expire. F64 expiresAt() const; @@ -142,7 +142,7 @@ protected: // Useful bit of state usually associated with timers, but does // not affect actual functionality - BOOL mStarted; + bool mStarted; }; // Glue code for Havok (or anything else that doesn't want the full .h files) diff --git a/indra/llcommon/llindexedvector.h b/indra/llcommon/llindexedvector.h index de3ae0dcc4..0b2e9c76ca 100644 --- a/indra/llcommon/llindexedvector.h +++ b/indra/llcommon/llindexedvector.h @@ -47,7 +47,7 @@ public: typedef typename std::vector<Type>::size_type size_type; protected: std::vector<Type> mVector; - std::map<Key, U32> mIndexMap; + std::map<Key, size_t> mIndexMap; public: LLIndexedVector() { mVector.reserve(BlockSize); } @@ -68,10 +68,10 @@ public: Type& operator[](const Key& k) { - typename std::map<Key, U32>::const_iterator iter = mIndexMap.find(k); + typename std::map<Key, size_t>::const_iterator iter = mIndexMap.find(k); if (iter == mIndexMap.end()) { - U32 n = mVector.size(); + auto n = mVector.size(); mIndexMap[k] = n; mVector.push_back(Type()); llassert(mVector.size() == mIndexMap.size()); @@ -85,7 +85,7 @@ public: const_iterator find(const Key& k) const { - typename std::map<Key, U32>::const_iterator iter = mIndexMap.find(k); + typename std::map<Key, size_t>::const_iterator iter = mIndexMap.find(k); if(iter == mIndexMap.end()) { return mVector.end(); diff --git a/indra/llcommon/llkeythrottle.h b/indra/llcommon/llkeythrottle.h index a5b5eaa946..8ee0e08c69 100644 --- a/indra/llcommon/llkeythrottle.h +++ b/indra/llcommon/llkeythrottle.h @@ -91,9 +91,9 @@ template< class T > class LLKeyThrottle { public: - // @param realtime = FALSE for frame-based throttle, TRUE for usec + // @param realtime = false for frame-based throttle, true for usec // real-time throttle - LLKeyThrottle(U32 limit, F32 interval, BOOL realtime = TRUE) + LLKeyThrottle(U32 limit, F32 interval, bool realtime = true) : m(* new LLKeyThrottleImpl<T>) { setParameters( limit, interval, realtime ); @@ -287,7 +287,7 @@ public: } // Get the throttling parameters - void getParameters( U32 & out_limit, F32 & out_interval, BOOL & out_realtime ) + void getParameters( U32 & out_limit, F32 & out_interval, bool & out_realtime ) { out_limit = m.countLimit; out_interval = m.intervalLength; @@ -295,7 +295,7 @@ public: } // Set the throttling behavior - void setParameters( U32 limit, F32 interval, BOOL realtime = TRUE ) + void setParameters( U32 limit, F32 interval, bool realtime = true ) { // limit is the maximum number of keys // allowed per interval (in seconds or frames) @@ -325,7 +325,7 @@ public: protected: LLKeyThrottleImpl<T>& m; - BOOL mIsRealtime; // TRUE to be time based (default), FALSE for frame based + bool mIsRealtime; // true to be time based (default), false for frame based }; #endif diff --git a/indra/llcommon/llleap.cpp b/indra/llcommon/llleap.cpp index e93ba83434..662a2511cd 100644 --- a/indra/llcommon/llleap.cpp +++ b/indra/llcommon/llleap.cpp @@ -233,7 +233,7 @@ public: LL_DEBUGS("EventHost") << "Sending: " << static_cast<U64>(buffer.tellp()) << ':'; - std::string::size_type truncate(80); + llssize truncate(80); if (buffer.tellp() <= truncate) { LL_CONT << buffer.str(); diff --git a/indra/llcommon/lllivefile.cpp b/indra/llcommon/lllivefile.cpp index 15651a6813..58de61a7e4 100644 --- a/indra/llcommon/lllivefile.cpp +++ b/indra/llcommon/lllivefile.cpp @@ -170,10 +170,10 @@ namespace : LLEventTimer(refresh), mLiveFile(f) { } - BOOL tick() + bool tick() { mLiveFile.checkAndReload(); - return FALSE; + return false; } private: diff --git a/indra/llcommon/llmainthreadtask.h b/indra/llcommon/llmainthreadtask.h index 28ad62830b..cec95b2356 100644 --- a/indra/llcommon/llmainthreadtask.h +++ b/indra/llcommon/llmainthreadtask.h @@ -79,13 +79,13 @@ private: LLEventTimer(0), mTask(std::forward<CALLABLE>(callable)) {} - BOOL tick() override + bool tick() override { // run the task on the main thread, will populate the future // obtained by get_future() mTask(); // tell LLEventTimer we're done (one shot) - return TRUE; + return true; } // Given arbitrary CALLABLE, which might be a lambda, how are we // supposed to obtain its signature for std::packaged_task? It seems diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index cf5ead718d..4b7d60d654 100644 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -190,7 +190,7 @@ void* LLMemory::tryToAlloc(void* address, U32 size) } //static -void LLMemory::logMemoryInfo(BOOL update) +void LLMemory::logMemoryInfo(bool update) { LL_PROFILE_ZONE_SCOPED if(update) @@ -327,8 +327,8 @@ void* ll_aligned_malloc_fallback( size_t size, int align ) __asm int 3; } DWORD old; - BOOL Res = VirtualProtect((void*)((char*)p + for_alloc), sysinfo.dwPageSize, PAGE_NOACCESS, &old); - if(FALSE == Res) { + bool Res = VirtualProtect((void*)((char*)p + for_alloc), sysinfo.dwPageSize, PAGE_NOACCESS, &old); + if(false == Res) { // call debugger __asm int 3; } diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h index b73030d978..671ebc38e2 100644 --- a/indra/llcommon/llmemory.h +++ b/indra/llcommon/llmemory.h @@ -138,7 +138,7 @@ public: \ void ll_aligned_free_fallback( void* ptr ); //------------------------------------------------------------------------------------------------ #else - inline void* ll_aligned_malloc_fallback( size_t size, int align ) + inline void* ll_aligned_malloc_fallback( size_t size, size_t align ) { LL_PROFILE_ZONE_SCOPED_CATEGORY_MEMORY; #if defined(LL_WINDOWS) @@ -394,7 +394,7 @@ public: static void* tryToAlloc(void* address, U32 size); static void initMaxHeapSizeGB(F32Gigabytes max_heap_size); static void updateMemoryInfo() ; - static void logMemoryInfo(BOOL update = FALSE); + static void logMemoryInfo(bool update = false); static U32Kilobytes getAvailableMemKB() ; static U32Kilobytes getMaxMemKB() ; diff --git a/indra/llcommon/llmetricperformancetester.cpp b/indra/llcommon/llmetricperformancetester.cpp index e05c2558f6..cc258e4609 100644 --- a/indra/llcommon/llmetricperformancetester.cpp +++ b/indra/llcommon/llmetricperformancetester.cpp @@ -50,18 +50,18 @@ void LLMetricPerformanceTesterBasic::cleanupClass() } /*static*/ -BOOL LLMetricPerformanceTesterBasic::addTester(LLMetricPerformanceTesterBasic* tester) +bool LLMetricPerformanceTesterBasic::addTester(LLMetricPerformanceTesterBasic* tester) { llassert_always(tester != NULL); std::string name = tester->getTesterName() ; if (getTester(name)) { LL_ERRS() << "Tester name is already used by some other tester : " << name << LL_ENDL ; - return FALSE; + return false; } sTesterMap.insert(std::make_pair(name, tester)); - return TRUE; + return true; } /*static*/ @@ -88,8 +88,8 @@ LLMetricPerformanceTesterBasic* LLMetricPerformanceTesterBasic::getTester(std::s } /*static*/ -// Return TRUE if this metric is requested or if the general default "catch all" metric is requested -BOOL LLMetricPerformanceTesterBasic::isMetricLogRequested(std::string name) +// Return true if this metric is requested or if the general default "catch all" metric is requested +bool LLMetricPerformanceTesterBasic::isMetricLogRequested(std::string name) { return (LLTrace::BlockTimer::sMetricLog && ((LLTrace::BlockTimer::sLogName == name) || (LLTrace::BlockTimer::sLogName == DEFAULT_METRIC_NAME))); } @@ -215,8 +215,8 @@ void LLMetricPerformanceTesterBasic::analyzePerformance(llofstream* os, LLSD* ba resetCurrentCount() ; std::string current_label = getCurrentLabelName(); - BOOL in_base = (*base).has(current_label) ; - BOOL in_current = (*current).has(current_label) ; + bool in_base = (*base).has(current_label) ; + bool in_current = (*current).has(current_label) ; while(in_base || in_current) { diff --git a/indra/llcommon/llmetricperformancetester.h b/indra/llcommon/llmetricperformancetester.h index 15c564f2ca..78abd53602 100644 --- a/indra/llcommon/llmetricperformancetester.h +++ b/indra/llcommon/llmetricperformancetester.h @@ -48,7 +48,7 @@ public: * Need to be tested after creation of a tester instance so to know if the tester is correctly handled. * A tester might not be added to the map if another tester with the same name already exists. */ - BOOL isValid() const { return mValidInstance; } + bool isValid() const { return mValidInstance; } /** * @brief Write a set of test results to the log LLSD. @@ -122,7 +122,7 @@ private: std::string mName ; // Name of this tester instance S32 mCount ; // Current record count - BOOL mValidInstance; // TRUE if the instance is managed by the map + bool mValidInstance; // true if the instance is managed by the map std::vector< std::string > mMetricStrings ; // Metrics strings // Static members managing the collection of testers @@ -144,15 +144,15 @@ public: static void deleteTester(std::string name); /** - * @return Returns TRUE if that metric *or* the default catch all metric has been requested to be logged + * @return Returns true if that metric *or* the default catch all metric has been requested to be logged * @param[in] name - Name of the tester queried. */ - static BOOL isMetricLogRequested(std::string name); + static bool isMetricLogRequested(std::string name); /** - * @return Returns TRUE if there's a tester defined, FALSE otherwise. + * @return Returns true if there's a tester defined, false otherwise. */ - static BOOL hasMetricPerformanceTesters() { return !sTesterMap.empty() ;} + static bool hasMetricPerformanceTesters() { return !sTesterMap.empty() ;} /** * @brief Delete all testers and reset the tester map */ @@ -160,7 +160,7 @@ public: private: // Add a tester to the map. Returns false if adding fails. - static BOOL addTester(LLMetricPerformanceTesterBasic* tester) ; + static bool addTester(LLMetricPerformanceTesterBasic* tester) ; }; /** diff --git a/indra/llcommon/llmortician.cpp b/indra/llcommon/llmortician.cpp index 00d4a32553..578d72388c 100644 --- a/indra/llcommon/llmortician.cpp +++ b/indra/llcommon/llmortician.cpp @@ -30,7 +30,7 @@ std::list<LLMortician*> LLMortician::sGraveyard; -BOOL LLMortician::sDestroyImmediate = FALSE; +bool LLMortician::sDestroyImmediate = false; LLMortician::~LLMortician() { @@ -88,19 +88,19 @@ void LLMortician::die() if (sDestroyImmediate) { // *NOTE: This is a hack to ensure destruction order on shutdown (relative to non-mortician controlled classes). - mIsDead = TRUE; + mIsDead = true; delete this; return; } else if (!mIsDead) { - mIsDead = TRUE; + mIsDead = true; sGraveyard.push_back(this); } } // static -void LLMortician::setZealous(BOOL b) +void LLMortician::setZealous(bool b) { sDestroyImmediate = b; } diff --git a/indra/llcommon/llmortician.h b/indra/llcommon/llmortician.h index 6dca4da0c9..b2d81fa1c5 100644 --- a/indra/llcommon/llmortician.h +++ b/indra/llcommon/llmortician.h @@ -33,21 +33,21 @@ class LL_COMMON_API LLMortician { public: - LLMortician() { mIsDead = FALSE; } + LLMortician() { mIsDead = false; } static auto graveyardCount() { return sGraveyard.size(); }; static size_t logClass(std::stringstream &str); static void updateClass(); virtual ~LLMortician(); void die(); - BOOL isDead() { return mIsDead; } + bool isDead() { return mIsDead; } // sets destroy immediate true - static void setZealous(BOOL b); + static void setZealous(bool b); private: - static BOOL sDestroyImmediate; + static bool sDestroyImmediate; - BOOL mIsDead; + bool mIsDead; static std::list<LLMortician*> sGraveyard; }; diff --git a/indra/llcommon/llmutex.cpp b/indra/llcommon/llmutex.cpp index db14abb1fe..40c651d9c1 100644 --- a/indra/llcommon/llmutex.cpp +++ b/indra/llcommon/llmutex.cpp @@ -28,23 +28,35 @@ #include "llmutex.h" #include "llthread.h" #include "lltimer.h" +#include "llcoros.h" -//============================================================================ +//--------------------------------------------------------------------- +// +// LLMutex +// LLMutex::LLMutex() : mCount(0) { } - LLMutex::~LLMutex() { } - void LLMutex::lock() { - LL_PROFILE_ZONE_SCOPED_CATEGORY_THREAD + LL_PROFILE_ZONE_SCOPED_CATEGORY_THREAD; + + // LLMutex is not coroutine aware and should not be used from a coroutine + // If your code is running in a coroutine, you should use LLCoros::Mutex instead + // NOTE: If the stack trace you're staring at contains non-thread-safe code, + // you should use LLAppViewer::instance().postToMainThread() to shuttle execution + // back to the main loop. + // NOTE: If you got here from seeing this assert in your log and you're not seeing + // a stack trace that points here, put a breakpoint in on_main_coro and try again. + llassert(LLCoros::on_main_coro()); + if(isSelfLocked()) { //redundant lock mCount++; @@ -56,9 +68,9 @@ void LLMutex::lock() #if MUTEX_DEBUG // Have to have the lock before we can access the debug info auto id = LLThread::currentID(); - if (mIsLocked[id] != FALSE) + if (mIsLocked[id]) LL_ERRS() << "Already locked in Thread: " << id << LL_ENDL; - mIsLocked[id] = TRUE; + mIsLocked[id] = true; #endif mLockingThread = LLThread::currentID(); @@ -66,7 +78,8 @@ void LLMutex::lock() void LLMutex::unlock() { - LL_PROFILE_ZONE_SCOPED_CATEGORY_THREAD + LL_PROFILE_ZONE_SCOPED_CATEGORY_THREAD; + if (mCount > 0) { //not the root unlock mCount--; @@ -76,9 +89,9 @@ void LLMutex::unlock() #if MUTEX_DEBUG // Access the debug info while we have the lock auto id = LLThread::currentID(); - if (mIsLocked[id] != TRUE) + if (!mIsLocked[id]) LL_ERRS() << "Not locked in Thread: " << id << LL_ENDL; - mIsLocked[id] = FALSE; + mIsLocked[id] = false; #endif mLockingThread = LLThread::id_t(); @@ -112,7 +125,7 @@ LLThread::id_t LLMutex::lockingThread() const bool LLMutex::trylock() { LL_PROFILE_ZONE_SCOPED_CATEGORY_THREAD - if(isSelfLocked()) + if (isSelfLocked()) { //redundant lock mCount++; return true; @@ -126,28 +139,203 @@ bool LLMutex::trylock() #if MUTEX_DEBUG // Have to have the lock before we can access the debug info auto id = LLThread::currentID(); - if (mIsLocked[id] != FALSE) + if (mIsLocked[id]) LL_ERRS() << "Already locked in Thread: " << id << LL_ENDL; - mIsLocked[id] = TRUE; + mIsLocked[id] = true; #endif mLockingThread = LLThread::currentID(); return true; } -//============================================================================ +//--------------------------------------------------------------------- +// +// LLSharedMutex +// +LLSharedMutex::LLSharedMutex() +: mLockingThreads(2) // Reserve 2 slots in the map hash table +, mIsShared(false) +{ +} + +bool LLSharedMutex::isLocked() const +{ + LL_PROFILE_ZONE_SCOPED_CATEGORY_THREAD + std::lock_guard<std::mutex> lock(mLockMutex); + + return !mLockingThreads.empty(); +} + +bool LLSharedMutex::isThreadLocked() const +{ + LL_PROFILE_ZONE_SCOPED_CATEGORY_THREAD + LLThread::id_t current_thread = LLThread::currentID(); + std::lock_guard<std::mutex> lock(mLockMutex); + + const_iterator it = mLockingThreads.find(current_thread); + return it != mLockingThreads.end(); +} + +void LLSharedMutex::lockShared() +{ + LL_PROFILE_ZONE_SCOPED_CATEGORY_THREAD + LLThread::id_t current_thread = LLThread::currentID(); + + mLockMutex.lock(); + iterator it = mLockingThreads.find(current_thread); + if (it != mLockingThreads.end()) + { + it->second++; + } + else + { + // Acquire the mutex immediately if the mutex is not locked exclusively + // or enter a locking state if the mutex is already locked exclusively + mLockMutex.unlock(); + mSharedMutex.lock_shared(); + mLockMutex.lock(); + // Continue after acquiring the mutex + mLockingThreads.emplace(std::make_pair(current_thread, 1)); + mIsShared = true; + } + mLockMutex.unlock(); +} + +void LLSharedMutex::lockExclusive() +{ + LL_PROFILE_ZONE_SCOPED_CATEGORY_THREAD + LLThread::id_t current_thread = LLThread::currentID(); + + mLockMutex.lock(); + iterator it = mLockingThreads.find(current_thread); + if (it != mLockingThreads.end()) + { + if (mIsShared) + { + // The mutex is already locked in the current thread + // but this lock is SHARED (not EXCLISIVE) + // We can't lock it again, the lock stays shared + // This can lead to a collision (theoretically) + llassert_always(!"The current thread is already locked SHARED and can't be locked EXCLUSIVE"); + } + it->second++; + } + else + { + // Acquire the mutex immediately if mLockingThreads is empty + // or enter a locking state if mLockingThreads is not empty + mLockMutex.unlock(); + mSharedMutex.lock(); + mLockMutex.lock(); + // Continue after acquiring the mutex (and possible quitting the locking state) + mLockingThreads.emplace(std::make_pair(current_thread, 1)); + mIsShared = false; + } + mLockMutex.unlock(); +} + +bool LLSharedMutex::trylockShared() +{ + LL_PROFILE_ZONE_SCOPED_CATEGORY_THREAD + LLThread::id_t current_thread = LLThread::currentID(); + std::lock_guard<std::mutex> lock(mLockMutex); + + iterator it = mLockingThreads.find(current_thread); + if (it != mLockingThreads.end()) + { + it->second++; + } + else + { + if (!mSharedMutex.try_lock_shared()) + return false; + + mLockingThreads.emplace(std::make_pair(current_thread, 1)); + mIsShared = true; + } + + return true; +} + +bool LLSharedMutex::trylockExclusive() +{ + LL_PROFILE_ZONE_SCOPED_CATEGORY_THREAD + LLThread::id_t current_thread = LLThread::currentID(); + std::lock_guard<std::mutex> lock(mLockMutex); + + if (mLockingThreads.size() == 1 && mLockingThreads.begin()->first == current_thread) + { + mLockingThreads.begin()->second++; + } + else + { + if (!mSharedMutex.try_lock()) + return false; + + mLockingThreads.emplace(std::make_pair(current_thread, 1)); + mIsShared = false; + } + + return true; +} + +void LLSharedMutex::unlockShared() +{ + LL_PROFILE_ZONE_SCOPED_CATEGORY_THREAD + LLThread::id_t current_thread = LLThread::currentID(); + std::lock_guard<std::mutex> lock(mLockMutex); + + iterator it = mLockingThreads.find(current_thread); + if (it != mLockingThreads.end()) + { + if (it->second > 1) + { + it->second--; + } + else + { + mLockingThreads.erase(it); + mSharedMutex.unlock_shared(); + } + } +} + +void LLSharedMutex::unlockExclusive() +{ + LL_PROFILE_ZONE_SCOPED_CATEGORY_THREAD + LLThread::id_t current_thread = LLThread::currentID(); + std::lock_guard<std::mutex> lock(mLockMutex); + + iterator it = mLockingThreads.find(current_thread); + if (it != mLockingThreads.end()) + { + if (it->second > 1) + { + it->second--; + } + else + { + mLockingThreads.erase(it); + mSharedMutex.unlock(); + } + } +} + + +//--------------------------------------------------------------------- +// +// LLCondition +// LLCondition::LLCondition() : LLMutex() { } - LLCondition::~LLCondition() { } - void LLCondition::wait() { LL_PROFILE_ZONE_SCOPED_CATEGORY_THREAD @@ -168,7 +356,10 @@ void LLCondition::broadcast() } - +//--------------------------------------------------------------------- +// +// LLMutexTrylock +// LLMutexTrylock::LLMutexTrylock(LLMutex* mutex) : mMutex(mutex), mLocked(false) diff --git a/indra/llcommon/llmutex.h b/indra/llcommon/llmutex.h index 9a888f1220..6e8cf9643b 100644 --- a/indra/llcommon/llmutex.h +++ b/indra/llcommon/llmutex.h @@ -32,6 +32,8 @@ #include <boost/noncopyable.hpp> #include "mutex.h" +#include <shared_mutex> +#include <unordered_map> #include <condition_variable> //============================================================================ @@ -62,10 +64,79 @@ protected: mutable LLThread::id_t mLockingThread; #if MUTEX_DEBUG - std::unordered_map<LLThread::id_t, BOOL> mIsLocked; + std::unordered_map<LLThread::id_t, bool> mIsLocked; #endif }; +//============================================================================ + +class LL_COMMON_API LLSharedMutex +{ +public: + LLSharedMutex(); + + bool isLocked() const; + bool isThreadLocked() const; + bool isShared() const { return mIsShared; } + + void lockShared(); + void lockExclusive(); + template<bool SHARED> void lock(); + + bool trylockShared(); + bool trylockExclusive(); + template<bool SHARED> bool trylock(); + + void unlockShared(); + void unlockExclusive(); + template<bool SHARED> void unlock(); + +private: + std::shared_mutex mSharedMutex; + mutable std::mutex mLockMutex; + std::unordered_map<LLThread::id_t, U32> mLockingThreads; + bool mIsShared; + + using iterator = std::unordered_map<LLThread::id_t, U32>::iterator; + using const_iterator = std::unordered_map<LLThread::id_t, U32>::const_iterator; +}; + +template<> +inline void LLSharedMutex::lock<true>() +{ + lockShared(); +} + +template<> +inline void LLSharedMutex::lock<false>() +{ + lockExclusive(); +} + +template<> +inline bool LLSharedMutex::trylock<true>() +{ + return trylockShared(); +} + +template<> +inline bool LLSharedMutex::trylock<false>() +{ + return trylockExclusive(); +} + +template<> +inline void LLSharedMutex::unlock<true>() +{ + unlockShared(); +} + +template<> +inline void LLSharedMutex::unlock<false>() +{ + unlockExclusive(); +} + // Actually a condition/mutex pair (since each condition needs to be associated with a mutex). class LL_COMMON_API LLCondition : public LLMutex { @@ -81,6 +152,8 @@ protected: std::condition_variable mCond; }; +//============================================================================ + class LLMutexLock { public: @@ -88,20 +161,48 @@ public: { mMutex = mutex; - if(mMutex) + if (mMutex) mMutex->lock(); } + ~LLMutexLock() { - if(mMutex) + if (mMutex) mMutex->unlock(); } + private: LLMutex* mMutex; }; //============================================================================ +template<bool SHARED> +class LLSharedMutexLockTemplate +{ +public: + LLSharedMutexLockTemplate(LLSharedMutex* mutex) + : mSharedMutex(mutex) + { + if (mSharedMutex) + mSharedMutex->lock<SHARED>(); + } + + ~LLSharedMutexLockTemplate() + { + if (mSharedMutex) + mSharedMutex->unlock<SHARED>(); + } + +private: + LLSharedMutex* mSharedMutex; +}; + +using LLSharedMutexLock = LLSharedMutexLockTemplate<true>; +using LLExclusiveMutexLock = LLSharedMutexLockTemplate<false>; + +//============================================================================ + // Scoped locking class similar in function to LLMutexLock but uses // the trylock() method to conditionally acquire lock without // blocking. Caller resolves the resulting condition by calling @@ -127,6 +228,8 @@ private: bool mLocked; }; +//============================================================================ + /** * @class LLScopedLock * @brief Small class to help lock and unlock mutexes. diff --git a/indra/llcommon/llnametable.h b/indra/llcommon/llnametable.h index b3a9df8fc3..0c4cc4c04d 100644 --- a/indra/llcommon/llnametable.h +++ b/indra/llcommon/llnametable.h @@ -55,16 +55,16 @@ public: mNameMap[tablename] = data; } - BOOL checkName(const std::string& name) const + bool checkName(const std::string& name) const { return checkName(name.c_str()); } // "logically const" even though it modifies the global nametable - BOOL checkName(const char *name) const + bool checkName(const char *name) const { char *tablename = gStringTable.addString(name); - return mNameMap.count(tablename) ? TRUE : FALSE; + return mNameMap.find(tablename) != mNameMap.end(); } DATA resolveName(const std::string& name) const diff --git a/indra/llcommon/llpreprocessor.h b/indra/llcommon/llpreprocessor.h index 83cd6941dc..13beb25558 100644 --- a/indra/llcommon/llpreprocessor.h +++ b/indra/llcommon/llpreprocessor.h @@ -122,44 +122,20 @@ #endif // LL_WINDOWS -// Deal with VC6 problems +// Deal with VC++ problems #if LL_MSVC -#pragma warning( 3 : 4701 ) // "local variable used without being initialized" Treat this as level 3, not level 4. -#pragma warning( 3 : 4702 ) // "unreachable code" Treat this as level 3, not level 4. -#pragma warning( 3 : 4189 ) // "local variable initialized but not referenced" Treat this as level 3, not level 4. -//#pragma warning( 3 : 4018 ) // "signed/unsigned mismatch" Treat this as level 3, not level 4. -#pragma warning( 3 : 4263 ) // 'function' : member function does not override any base class virtual member function -#pragma warning( 3 : 4264 ) // "'virtual_function' : no override available for virtual member function from base 'class'; function is hidden" -#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 <map> include file - -#if ADDRESS_SIZE == 64 -// That one is all over the place for x64 builds. -#pragma warning( disable : 4267 ) // 'var' : conversion from 'size_t' to 'type', possible loss of data) +#ifndef _CRT_SECURE_NO_WARNINGS +#define _CRT_SECURE_NO_WARNINGS // disable warnings for methods considered unsafe +#endif +#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS +#define _WINSOCK_DEPRECATED_NO_WARNINGS // disable deprecated WinSock API warnings #endif - -#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 - -// Linker optimization with "extern template" generates these warnings -#pragma warning( disable : 4231 ) // nonstandard extension used : 'extern' before template explicit instantiation -#pragma warning( disable : 4506 ) // no definition for inline function // level 4 warnings that we need to disable: -#pragma warning (disable : 4100) // unreferenced formal parameter -#pragma warning (disable : 4127) // conditional expression is constant (e.g. while(1) ) #pragma warning (disable : 4244) // possible loss of data on conversions #pragma warning (disable : 4396) // the inline specifier cannot be used when a friend declaration refers to a specialization of a function template -#pragma warning (disable : 4512) // assignment operator could not be generated -#pragma warning (disable : 4706) // assignment within conditional (even if((x = y)) ) - #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 - #endif // LL_MSVC #if LL_WINDOWS diff --git a/indra/llcommon/llpriqueuemap.h b/indra/llcommon/llpriqueuemap.h index 79934d094b..2bdd39aac2 100644 --- a/indra/llcommon/llpriqueuemap.h +++ b/indra/llcommon/llpriqueuemap.h @@ -47,17 +47,17 @@ public: { if (mPriority > b.mPriority) { - return TRUE; + return true; } if (mPriority < b.mPriority) { - return FALSE; + return false; } if (mData > b.mData) { - return TRUE; + return true; } - return FALSE; + return false; } F32 mPriority; @@ -90,18 +90,18 @@ public: mMap.insert(pqm_pair(LLPQMKey<DATA_TYPE>(priority, data), data)); } - BOOL pop(DATA_TYPE *datap) + bool pop(DATA_TYPE *datap) { pqm_iter iter; iter = mMap.begin(); if (iter == mMap.end()) { - return FALSE; + return false; } *datap = (*(iter)).second; mMap.erase(iter); - return TRUE; + return true; } void reprioritize(const F32 new_priority, DATA_TYPE data) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index cf19e3aae9..40ef0ddf9b 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -561,9 +561,9 @@ LLProcess::LLProcess(const LLSDOrParams& params): // IQA-490, CHOP-900: On Windows, ask APR to jump through hoops to // constrain the set of handles passed to the child process. Before we // changed to APR, the Windows implementation of LLProcessLauncher called - // CreateProcess(bInheritHandles=FALSE), meaning to pass NO open handles + // CreateProcess(bInheritHandles=false), meaning to pass NO open handles // to the child process. Now that we support pipes, though, we must allow - // apr_proc_create() to pass bInheritHandles=TRUE. But without taking + // apr_proc_create() to pass bInheritHandles=true. But without taking // special pains, that causes trouble in a number of ways, due to the fact // that the viewer is constantly opening and closing files -- most of // which CreateProcess() passes to every child process! diff --git a/indra/llcommon/llprofiler.h b/indra/llcommon/llprofiler.h index af5e5777bf..722d9afca2 100644 --- a/indra/llcommon/llprofiler.h +++ b/indra/llcommon/llprofiler.h @@ -162,7 +162,7 @@ extern thread_local bool gProfilerEnabled; #define LL_LABEL_OBJECT_GL(type, name, length, label) -#if LL_PROFILER_CONFIGURATION > 1 +#if !LL_DARWIN && LL_PROFILER_CONFIGURATION > 1 #define LL_PROFILE_ALLOC(ptr, size) TracyAlloc(ptr, size) #define LL_PROFILE_FREE(ptr) TracyFree(ptr) #else diff --git a/indra/llcommon/llprofilercategories.h b/indra/llcommon/llprofilercategories.h index 0de343d020..1c4f0f5624 100644 --- a/indra/llcommon/llprofilercategories.h +++ b/indra/llcommon/llprofilercategories.h @@ -67,6 +67,7 @@ #define LL_PROFILER_CATEGORY_ENABLE_VERTEX 1 #define LL_PROFILER_CATEGORY_ENABLE_VOLUME 1 #define LL_PROFILER_CATEGORY_ENABLE_WIN32 1 +#define LL_PROFILER_CATEGORY_ENABLE_GLTF 1 #define LL_PROFILER_CATEGORY_ENABLE_VOICE 1 #if LL_PROFILER_CATEGORY_ENABLE_APP @@ -277,12 +278,19 @@ #define LL_PROFILE_ZONE_SCOPED_CATEGORY_WIN32 #endif +#if LL_PROFILER_CATEGORY_ENABLE_GLTF + #define LL_PROFILE_ZONE_NAMED_CATEGORY_GLTF LL_PROFILE_ZONE_NAMED + #define LL_PROFILE_ZONE_SCOPED_CATEGORY_GLTF LL_PROFILE_ZONE_SCOPED +#else + #define LL_PROFILE_ZONE_NAMED_CATEGORY_GLTF(name) + #define LL_PROFILE_ZONE_SCOPED_CATEGORY_GLTF +#endif #if LL_PROFILER_CATEGORY_ENABLE_VOICE -#define LL_PROFILE_ZONE_NAMED_CATEGORY_VOICE LL_PROFILE_ZONE_NAMED -#define LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE LL_PROFILE_ZONE_SCOPED + #define LL_PROFILE_ZONE_NAMED_CATEGORY_VOICE LL_PROFILE_ZONE_NAMED + #define LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE LL_PROFILE_ZONE_SCOPED #else -#define LL_PROFILE_ZONE_NAMED_CATEGORY_VOICE(name) -#define LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE + #define LL_PROFILE_ZONE_NAMED_CATEGORY_VOICE(name) + #define LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE #endif #endif // LL_PROFILER_CATEGORIES_H diff --git a/indra/llcommon/llqueuedthread.cpp b/indra/llcommon/llqueuedthread.cpp index aaf13ac796..7d77f6f6a9 100644 --- a/indra/llcommon/llqueuedthread.cpp +++ b/indra/llcommon/llqueuedthread.cpp @@ -37,9 +37,9 @@ // MAIN THREAD LLQueuedThread::LLQueuedThread(const std::string& name, bool threaded, bool should_pause) : LLThread(name), - mIdleThread(TRUE), + mIdleThread(true), mNextHandle(0), - mStarted(FALSE), + mStarted(false), mThreaded(threaded), mRequestQueue(name, 1024 * 1024) { @@ -131,7 +131,7 @@ size_t LLQueuedThread::update(F32 max_time_ms) if (!mThreaded) { startThread(); - mStarted = TRUE; + mStarted = true; } } return updateQueue(max_time_ms); @@ -149,9 +149,9 @@ size_t LLQueuedThread::updateQueue(F32 max_time_ms) mRequestQueue.post([=]() { LL_PROFILE_ZONE_NAMED_CATEGORY_THREAD("qt - update"); - mIdleThread = FALSE; + mIdleThread = false; threadedUpdate(); - mIdleThread = TRUE; + mIdleThread = true; } ); } @@ -210,7 +210,7 @@ void LLQueuedThread::waitOnPending() // MAIN thread void LLQueuedThread::printQueueStats() { - U32 size = mRequestQueue.size(); + auto size = mRequestQueue.size(); if (size > 0) { LL_INFOS() << llformat("Pending Requests:%d ", mRequestQueue.size()) << LL_ENDL; @@ -392,7 +392,7 @@ void LLQueuedThread::processRequest(LLQueuedThread::QueuedRequest* req) { LL_PROFILE_ZONE_SCOPED_CATEGORY_THREAD; - mIdleThread = FALSE; + mIdleThread = false; //threadedUpdate(); // Get next request from pool @@ -494,7 +494,7 @@ void LLQueuedThread::processRequest(LLQueuedThread::QueuedRequest* req) } } - mIdleThread = TRUE; + mIdleThread = true; } // virtual @@ -513,7 +513,7 @@ void LLQueuedThread::run() // call checPause() immediately so we don't try to do anything before the class is fully constructed checkPause(); startThread(); - mStarted = TRUE; + mStarted = true; /*while (1) @@ -522,7 +522,7 @@ void LLQueuedThread::run() // this will block on the condition until runCondition() returns true, the thread is unpaused, or the thread leaves the RUNNING state. checkPause(); - mIdleThread = FALSE; + mIdleThread = false; threadedUpdate(); @@ -531,7 +531,7 @@ void LLQueuedThread::run() if (pending_work == 0) { //LL_PROFILE_ZONE_NAMED("LLQueuedThread - sleep"); - mIdleThread = TRUE; + mIdleThread = true; //ms_sleep(1); } //LLThread::yield(); // thread should yield after each request diff --git a/indra/llcommon/llqueuedthread.h b/indra/llcommon/llqueuedthread.h index 339299f081..02d3a96fcc 100644 --- a/indra/llcommon/llqueuedthread.h +++ b/indra/llcommon/llqueuedthread.h @@ -144,7 +144,7 @@ public: void printQueueStats(); virtual size_t getPending(); - bool getThreaded() { return mThreaded ? true : false; } + bool getThreaded() { return mThreaded; } // Request accessors status_t getRequestStatus(handle_t handle); @@ -159,8 +159,8 @@ public: bool check(); protected: - BOOL mThreaded; // if false, run on main thread and do updates during update() - BOOL mStarted; // required when mThreaded is false to call startThread() from update() + bool mThreaded; // if false, run on main thread and do updates during update() + bool mStarted; // required when mThreaded is false to call startThread() from update() LLAtomicBool mIdleThread; // request queue is empty (or we are quitting) and the thread is idle //typedef std::set<QueuedRequest*, queued_request_less> request_queue_t; diff --git a/indra/llcommon/llrefcount.h b/indra/llcommon/llrefcount.h index 33c9e956b1..3a253d8fa6 100644 --- a/indra/llcommon/llrefcount.h +++ b/indra/llcommon/llrefcount.h @@ -89,13 +89,6 @@ private: class LL_COMMON_API LLThreadSafeRefCount { -public: - static void initThreadSafeRefCount(); // creates sMutex - static void cleanupThreadSafeRefCount(); // destroys sMutex - -private: - static LLMutex* sMutex; - protected: virtual ~LLThreadSafeRefCount(); // use unref() diff --git a/indra/llcommon/llregistry.h b/indra/llcommon/llregistry.h index 55dabd57a2..35335e1213 100644 --- a/indra/llcommon/llregistry.h +++ b/indra/llcommon/llregistry.h @@ -60,7 +60,7 @@ public: bool add(ref_const_key_t key, ref_const_value_t value) { - if (mMap.insert(std::make_pair(key, value)).second == false) + if (!mMap.insert(std::make_pair(key, value)).second) { LL_WARNS() << "Tried to register " << key << " but it was already registered!" << LL_ENDL; return false; diff --git a/indra/llcommon/llsdjson.cpp b/indra/llcommon/llsdjson.cpp index bb2b8681f7..e95d2e6c1c 100644 --- a/indra/llcommon/llsdjson.cpp +++ b/indra/llcommon/llsdjson.cpp @@ -31,46 +31,56 @@ #include "llsdjson.h" +#include "llsdutil.h" #include "llerror.h" #include "../llmath/llmath.h" +#if LL_WINDOWS +#pragma warning (push) +#pragma warning (disable : 4702) // compiler thinks unreachable code +#endif +#include <boost/json/src.hpp> +#if LL_WINDOWS +#pragma warning (pop) +#endif + + + //========================================================================= -LLSD LlsdFromJson(const Json::Value &val) +LLSD LlsdFromJson(const boost::json::value& val) { LLSD result; - switch (val.type()) + switch (val.kind()) { default: - case Json::nullValue: - break; - case Json::intValue: - result = LLSD(static_cast<LLSD::Integer>(val.asInt())); + case boost::json::kind::null: break; - case Json::uintValue: - result = LLSD(static_cast<LLSD::Integer>(val.asUInt())); + case boost::json::kind::int64: + case boost::json::kind::uint64: + result = LLSD(val.to_number<int64_t>()); break; - case Json::realValue: - result = LLSD(static_cast<LLSD::Real>(val.asDouble())); + case boost::json::kind::double_: + result = LLSD(val.to_number<double>()); break; - case Json::stringValue: - result = LLSD(static_cast<LLSD::String>(val.asString())); + case boost::json::kind::string: + result = LLSD(boost::json::value_to<std::string>(val)); break; - case Json::booleanValue: - result = LLSD(static_cast<LLSD::Boolean>(val.asBool())); + case boost::json::kind::bool_: + result = LLSD(val.as_bool()); break; - case Json::arrayValue: + case boost::json::kind::array: result = LLSD::emptyArray(); - for (Json::ValueConstIterator it = val.begin(); it != val.end(); ++it) + for (const auto &element : val.as_array()) { - result.append(LlsdFromJson((*it))); + result.append(LlsdFromJson(element)); } break; - case Json::objectValue: + case boost::json::kind::object: result = LLSD::emptyMap(); - for (Json::ValueConstIterator it = val.begin(); it != val.end(); ++it) + for (const auto& element : val.as_object()) { - result[it.memberName()] = LlsdFromJson((*it)); + result[element.key()] = LlsdFromJson(element.value()); } break; } @@ -78,44 +88,48 @@ LLSD LlsdFromJson(const Json::Value &val) } //========================================================================= -Json::Value LlsdToJson(const LLSD &val) +boost::json::value LlsdToJson(const LLSD &val) { - Json::Value result; + boost::json::value result; switch (val.type()) { case LLSD::TypeUndefined: - result = Json::Value::null; + result = nullptr; break; case LLSD::TypeBoolean: - result = Json::Value(static_cast<bool>(val.asBoolean())); + result = val.asBoolean(); break; case LLSD::TypeInteger: - result = Json::Value(static_cast<int>(val.asInteger())); + result = val.asInteger(); break; case LLSD::TypeReal: - result = Json::Value(static_cast<double>(val.asReal())); + result = val.asReal(); break; case LLSD::TypeURI: case LLSD::TypeDate: case LLSD::TypeUUID: case LLSD::TypeString: - result = Json::Value(val.asString()); + result = val.asString(); break; case LLSD::TypeMap: - result = Json::Value(Json::objectValue); - for (LLSD::map_const_iterator it = val.beginMap(); it != val.endMap(); ++it) + { + boost::json::object& obj = result.emplace_object(); + for (const auto& llsd_dat : llsd::inMap(val)) { - result[it->first] = LlsdToJson(it->second); + obj[llsd_dat.first] = LlsdToJson(llsd_dat.second); } break; + } case LLSD::TypeArray: - result = Json::Value(Json::arrayValue); - for (LLSD::array_const_iterator it = val.beginArray(); it != val.endArray(); ++it) + { + boost::json::array& json_array = result.emplace_array(); + for (const auto& llsd_dat : llsd::inArray(val)) { - result.append(LlsdToJson(*it)); + json_array.push_back(LlsdToJson(llsd_dat)); } break; + } case LLSD::TypeBinary: default: LL_ERRS("LlsdToJson") << "Unsupported conversion to JSON from LLSD type (" << val.type() << ")." << LL_ENDL; diff --git a/indra/llcommon/llsdjson.h b/indra/llcommon/llsdjson.h index 79bf2c56fa..415bbf4821 100644 --- a/indra/llcommon/llsdjson.h +++ b/indra/llcommon/llsdjson.h @@ -34,7 +34,7 @@ #include "stdtypes.h" #include "llsd.h" -#include "json/value.h" +#include <boost/json.hpp> /// Convert a parsed JSON structure into LLSD maintaining member names and /// array indexes. @@ -53,7 +53,7 @@ /// /// For maps and arrays child entries will be converted and added to the structure. /// Order is preserved for an array but not for objects. -LLSD LlsdFromJson(const Json::Value &val); +LLSD LlsdFromJson(const boost::json::value &val); /// Convert an LLSD object into Parsed JSON object maintaining member names and /// array indexs. @@ -72,6 +72,6 @@ LLSD LlsdFromJson(const Json::Value &val); /// TypeMap | object /// TypeArray | array /// TypeBinary | unsupported -Json::Value LlsdToJson(const LLSD &val); +boost::json::value LlsdToJson(const LLSD &val); #endif // LL_LLSDJSON_H diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp index d5af31a28e..15002580c9 100644 --- a/indra/llcommon/llsdserialize.cpp +++ b/indra/llcommon/llsdserialize.cpp @@ -389,7 +389,7 @@ LLSDParser::~LLSDParser() S32 LLSDParser::parse(std::istream& istr, LLSD& data, llssize max_bytes, S32 max_depth) { - mCheckLimits = (LLSDSerialize::SIZE_UNLIMITED == max_bytes) ? false : true; + mCheckLimits = LLSDSerialize::SIZE_UNLIMITED != max_bytes; mMaxBytesLeft = max_bytes; return doParse(istr, data, max_depth); } @@ -1546,7 +1546,7 @@ S32 LLSDBinaryFormatter::format_impl(const LLSD& data, std::ostream& ostr, case LLSD::TypeMap: { ostr.put('{'); - U32 size_nbo = htonl(data.size()); + U32 size_nbo = htonl(static_cast<u_long>(data.size())); ostr.write((const char*)(&size_nbo), sizeof(U32)); LLSD::map_const_iterator iter = data.beginMap(); LLSD::map_const_iterator end = data.endMap(); @@ -1563,7 +1563,7 @@ S32 LLSDBinaryFormatter::format_impl(const LLSD& data, std::ostream& ostr, case LLSD::TypeArray: { ostr.put('['); - U32 size_nbo = htonl(data.size()); + U32 size_nbo = htonl(static_cast<u_long>(data.size())); ostr.write((const char*)(&size_nbo), sizeof(U32)); LLSD::array_const_iterator iter = data.beginArray(); LLSD::array_const_iterator end = data.endArray(); @@ -1630,7 +1630,7 @@ S32 LLSDBinaryFormatter::format_impl(const LLSD& data, std::ostream& ostr, { ostr.put('b'); const std::vector<U8>& buffer = data.asBinary(); - U32 size_nbo = htonl(buffer.size()); + U32 size_nbo = htonl(static_cast<u_long>(buffer.size())); ostr.write((const char*)(&size_nbo), sizeof(U32)); if(buffer.size()) ostr.write((const char*)&buffer[0], buffer.size()); break; @@ -1648,7 +1648,7 @@ void LLSDBinaryFormatter::formatString( const std::string& string, std::ostream& ostr) const { - U32 size_nbo = htonl(string.size()); + U32 size_nbo = htonl(static_cast<u_long>(string.size())); ostr.write((const char*)(&size_nbo), sizeof(U32)); ostr.write(string.c_str(), string.size()); } diff --git a/indra/llcommon/llsdutil.cpp b/indra/llcommon/llsdutil.cpp index 09bfb51cc3..2d3d7d8b73 100644 --- a/indra/llcommon/llsdutil.cpp +++ b/indra/llcommon/llsdutil.cpp @@ -209,7 +209,7 @@ std::string ll_stream_notation_sd(const LLSD& sd) //are not of the same type, false is returned or if the LLSDs are not //of the same value. Ordering of arrays matters //Otherwise, returns true -BOOL compare_llsd_with_template( +bool compare_llsd_with_template( const LLSD& llsd_to_test, const LLSD& template_llsd, LLSD& resultant_llsd) @@ -221,12 +221,12 @@ BOOL compare_llsd_with_template( template_llsd.isDefined() ) { resultant_llsd = template_llsd; - return TRUE; + return true; } else if ( llsd_to_test.type() != template_llsd.type() ) { resultant_llsd = LLSD(); - return FALSE; + return false; } if ( llsd_to_test.isArray() ) @@ -255,7 +255,7 @@ BOOL compare_llsd_with_template( data) ) { resultant_llsd = LLSD(); - return FALSE; + return false; } else { @@ -298,7 +298,7 @@ BOOL compare_llsd_with_template( value) ) { resultant_llsd = LLSD(); - return FALSE; + return false; } else { @@ -321,7 +321,7 @@ BOOL compare_llsd_with_template( } - return TRUE; + return true; } // filter_llsd_with_template() is a direct clone (copy-n-paste) of diff --git a/indra/llcommon/llsdutil.h b/indra/llcommon/llsdutil.h index aa497c53c7..38bbe19ddd 100644 --- a/indra/llcommon/llsdutil.h +++ b/indra/llcommon/llsdutil.h @@ -72,7 +72,7 @@ LL_COMMON_API std::string ll_stream_notation_sd(const LLSD& sd); //Returns false if the test is of same type but values differ in type //Otherwise, returns true -LL_COMMON_API BOOL compare_llsd_with_template( +LL_COMMON_API bool compare_llsd_with_template( const LLSD& llsd_to_test, const LLSD& template_llsd, LLSD& resultant_llsd); diff --git a/indra/llcommon/llsingleton.h b/indra/llcommon/llsingleton.h index 91c05bd5ed..7c6be25309 100644 --- a/indra/llcommon/llsingleton.h +++ b/indra/llcommon/llsingleton.h @@ -36,6 +36,10 @@ #include "llthread.h" // on_main_thread() #include "llmainthreadtask.h" +#ifdef LL_WINDOWS +#pragma warning( disable : 4506 ) // no definition for inline function +#endif + class LLSingletonBase: private boost::noncopyable { public: @@ -528,6 +532,7 @@ public: classname<DERIVED_TYPE>(), " -- creating new instance"}); // fall through + [[fallthrough]]; case UNINITIALIZED: case QUEUED: // QUEUED means some secondary thread has already requested an @@ -807,17 +812,6 @@ private: \ DERIVED_CLASS(__VA_ARGS__) /** - * A slight variance from the above, but includes the "override" keyword - */ -#define LLSINGLETON_C11(DERIVED_CLASS) \ -private: \ - /* implement LLSingleton pure virtual method whose sole purpose */ \ - /* is to remind people to use this macro */ \ - virtual void you_must_use_LLSINGLETON_macro() override {} \ - friend class LLSingleton<DERIVED_CLASS>; \ - DERIVED_CLASS() - -/** * Use LLSINGLETON_EMPTY_CTOR(Foo); at the start of an LLSingleton<Foo> * subclass body when the constructor is trivial: * @@ -835,10 +829,6 @@ private: \ /* LLSINGLETON() is carefully implemented to permit exactly this */ \ LLSINGLETON(DERIVED_CLASS) {} -#define LLSINGLETON_EMPTY_CTOR_C11(DERIVED_CLASS) \ - /* LLSINGLETON() is carefully implemented to permit exactly this */ \ - LLSINGLETON_C11(DERIVED_CLASS) {} - // Relatively unsafe singleton implementation that is much faster // and simpler than LLSingleton, but has no dependency tracking // or inherent thread safety and requires manual invocation of diff --git a/indra/llcommon/llstacktrace.cpp b/indra/llcommon/llstacktrace.cpp index 1fe7f0f25f..bda3579f60 100644 --- a/indra/llcommon/llstacktrace.cpp +++ b/indra/llcommon/llstacktrace.cpp @@ -53,8 +53,8 @@ bool ll_get_stack_trace(std::vector<std::string>& lines) const S32 MAX_STACK_DEPTH = 32; const S32 STRING_NAME_LENGTH = 200; const S32 FRAME_SKIP = 2; - static BOOL symbolsLoaded = false; - static BOOL firstCall = true; + static bool symbolsLoaded = false; + static bool firstCall = true; HANDLE hProc = GetCurrentProcess(); @@ -92,7 +92,7 @@ bool ll_get_stack_trace(std::vector<std::string>& lines) for(S32 i=0; i < depth; i++) { std::stringstream stack_line; - BOOL ret; + bool ret; DWORD64 addr = (DWORD64)frames[i]; ret = SymGetSymFromAddr64(hProc, addr, 0, pSym); @@ -134,7 +134,7 @@ void ll_get_stack_trace_internal(std::vector<std::string>& lines) const S32 STRING_NAME_LENGTH = 256; HANDLE process = GetCurrentProcess(); - SymInitialize( process, NULL, TRUE ); + SymInitialize( process, NULL, true ); void *stack[MAX_STACK_DEPTH]; diff --git a/indra/llcommon/llstl.h b/indra/llcommon/llstl.h index 3a6efd7d34..1b52d94258 100644 --- a/indra/llcommon/llstl.h +++ b/indra/llcommon/llstl.h @@ -326,7 +326,7 @@ inline bool vector_replace_with_last(std::vector<T>& invec, const T& val) template <typename T> inline T* vector_append(std::vector<T>& invec, S32 N) { - U32 sz = invec.size(); + auto sz = invec.size(); invec.resize(sz+N); return &(invec[sz]); } @@ -532,7 +532,7 @@ bool before(const std::type_info* lhs, const std::type_info* rhs) return strcmp(lhs->name(), rhs->name()) < 0; #else // not Linux, or gcc 4.4+ // Just use before(), as we normally would - return lhs->before(*rhs) ? true : false; + return lhs->before(*rhs); #endif } diff --git a/indra/llcommon/llstreamqueue.h b/indra/llcommon/llstreamqueue.h index a09bf4cb4b..01689457dd 100644 --- a/indra/llcommon/llstreamqueue.h +++ b/indra/llcommon/llstreamqueue.h @@ -216,7 +216,7 @@ std::streamsize LLGenericStreamQueue<Ch>::skip(std::streamsize n) { typename BufferList::iterator bli(mBuffer.begin()), blend(mBuffer.end()); std::streamsize toskip(n), skipped(0); - while (bli != blend && toskip >= bli->length()) + while (bli != blend && (size_t)toskip >= bli->length()) { std::streamsize chunk(bli->length()); typename BufferList::iterator zap(bli++); diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index 6512bbc392..514d73b24b 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -308,10 +308,10 @@ S32 wstring_utf16_length(const LLWString &wstr, const S32 woffset, const S32 wle // Given a wstring and an offset in it, returns the length as wstring (i.e., // number of llwchars) of the longest substring that starts at the offset // and whose equivalent utf-16 string does not exceeds the given utf16_length. -S32 wstring_wstring_length_from_utf16_length(const LLWString & wstr, const S32 woffset, const S32 utf16_length, BOOL *unaligned) +S32 wstring_wstring_length_from_utf16_length(const LLWString & wstr, const S32 woffset, const S32 utf16_length, bool *unaligned) { const auto end = wstr.length(); - BOOL u = FALSE; + bool u{ false }; S32 n = woffset + utf16_length; S32 i = woffset; while (i < end) @@ -758,7 +758,7 @@ std::string utf8str_showBytesUTF8(const std::string& utf8str) } // Search for any emoji symbol, return true if found -bool wstring_has_emoji(const LLWString& wstr) +bool wstring_has_emoji(LLWStringView wstr) { for (const llwchar& wch : wstr) { @@ -809,7 +809,7 @@ std::string ll_convert_wide_to_string(const wchar_t* in, size_t len_in, unsigned code_page, 0, in, - len_in, + static_cast<int>(len_in), NULL, 0, 0, @@ -824,7 +824,7 @@ std::string ll_convert_wide_to_string(const wchar_t* in, size_t len_in, unsigned code_page, 0, in, - len_in, + static_cast<int>(len_in), pout, len_out, 0, @@ -851,8 +851,8 @@ std::wstring ll_convert_string_to_wide(const char* in, size_t len, unsigned int std::vector<wchar_t> w_out(len + 1); memset(&w_out[0], 0, w_out.size()); - int real_output_str_len = MultiByteToWideChar(code_page, 0, in, len, - &w_out[0], w_out.size() - 1); + int real_output_str_len = MultiByteToWideChar(code_page, 0, in, static_cast<int>(len), + &w_out[0], static_cast<int>(w_out.size() - 1)); //looks like MultiByteToWideChar didn't add null terminator to converted string, see EXT-4858. w_out[real_output_str_len] = 0; @@ -938,12 +938,12 @@ std::wstring windows_message<std::wstring>(DWORD error) return out.str(); } -boost::optional<std::wstring> llstring_getoptenv(const std::string& key) +std::optional<std::wstring> llstring_getoptenv(const std::string& key) { auto wkey = ll_convert_string_to_wide(key); // Take a wild guess as to how big the buffer should be. std::vector<wchar_t> buffer(1024); - auto n = GetEnvironmentVariableW(wkey.c_str(), &buffer[0], buffer.size()); + auto n = GetEnvironmentVariableW(wkey.c_str(), &buffer[0], static_cast<DWORD>(buffer.size())); // If our initial guess was too short, n will indicate the size (in // wchar_t's) that buffer should have been, including the terminating nul. if (n > (buffer.size() - 1)) @@ -951,13 +951,13 @@ boost::optional<std::wstring> llstring_getoptenv(const std::string& key) // make it big enough buffer.resize(n); // and try again - n = GetEnvironmentVariableW(wkey.c_str(), &buffer[0], buffer.size()); + n = GetEnvironmentVariableW(wkey.c_str(), &buffer[0], static_cast<DWORD>(buffer.size())); } // did that (ultimately) succeed? if (n) { - // great, return populated boost::optional - return boost::optional<std::wstring>(&buffer[0]); + // great, return populated std::optional + return std::make_optional<std::wstring>(&buffer[0]); } // not successful @@ -968,23 +968,23 @@ boost::optional<std::wstring> llstring_getoptenv(const std::string& key) LL_WARNS() << "GetEnvironmentVariableW('" << key << "') failed: " << windows_message<std::string>(last_error) << LL_ENDL; } - // return empty boost::optional + // return empty std::optional return {}; } #else // ! LL_WINDOWS -boost::optional<std::string> llstring_getoptenv(const std::string& key) +std::optional<std::string> llstring_getoptenv(const std::string& key) { auto found = getenv(key.c_str()); if (found) { - // return populated boost::optional - return boost::optional<std::string>(found); + // return populated std::optional + return std::make_optional<std::string>(found); } else { - // return empty boost::optional + // return empty std::optional return {}; } } @@ -1017,7 +1017,7 @@ bool LLStringOps::isEmoji(llwchar a) // These are indeed "genuine" emojis, we *do want* rendered as such. HB return a >= 0x1f000 && a < 0x20000; #endif -} + } S32 LLStringOps::collate(const llwchar* a, const llwchar* b) { @@ -1552,7 +1552,7 @@ S32 LLStringUtil::format(std::string& s, const format_map_t& substitutions) if (iter != substitutions.end()) { S32 secFromEpoch = 0; - BOOL r = LLStringUtil::convertToS32(iter->second, secFromEpoch); + bool r = LLStringUtil::convertToS32(iter->second, secFromEpoch); if (r) { found_replacement = formatDatetime(replacement, tokens[0], param, secFromEpoch); diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 6503da2e77..123f4184b5 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -28,8 +28,9 @@ #define LL_LLSTRING_H #include <boost/call_traits.hpp> -#include <boost/optional/optional.hpp> +#include <optional> #include <string> +#include <string_view> #include <cstdio> #include <cwchar> // std::wcslen() //#include <locale> @@ -317,7 +318,7 @@ public: static void toLower(string_type& string); // True if this is the head of s. - static BOOL isHead( const string_type& string, const T* s ); + static bool isHead( const string_type& string, const T* s ); /** * @brief Returns true if string starts with substr @@ -348,7 +349,7 @@ public: * (key is always UTF-8) * detect absence by (! return value) */ - static boost::optional<string_type> getoptenv(const std::string& key); + static std::optional<string_type> getoptenv(const std::string& key); static void addCRLF(string_type& string); static void removeCRLF(string_type& string); @@ -361,7 +362,7 @@ public: static string_type capitalize(const string_type& str); static void capitalize(string_type& str); - static BOOL containsNonprintable(const string_type& string); + static bool containsNonprintable(const string_type& string); static void stripNonprintable(string_type& string); /** @@ -387,15 +388,15 @@ public: static void _makeASCII(string_type& string); // Conversion to other data types - static BOOL convertToBOOL(const string_type& string, BOOL& value); - static BOOL convertToU8(const string_type& string, U8& value); - static BOOL convertToS8(const string_type& string, S8& value); - static BOOL convertToS16(const string_type& string, S16& value); - static BOOL convertToU16(const string_type& string, U16& value); - static BOOL convertToU32(const string_type& string, U32& value); - static BOOL convertToS32(const string_type& string, S32& value); - static BOOL convertToF32(const string_type& string, F32& value); - static BOOL convertToF64(const string_type& string, F64& value); + static bool convertToBOOL(const string_type& string, bool& value); + static bool convertToU8(const string_type& string, U8& value); + static bool convertToS8(const string_type& string, S8& value); + static bool convertToS16(const string_type& string, S16& value); + static bool convertToU16(const string_type& string, U16& value); + static bool convertToU32(const string_type& string, U32& value); + static bool convertToS32(const string_type& string, S32& value); + static bool convertToF32(const string_type& string, F32& value); + static bool convertToF64(const string_type& string, F64& value); ///////////////////////////////////////////////////////////////////////////////////////// // Utility functions for working with char*'s and strings @@ -420,7 +421,7 @@ public: static S32 compareDictInsensitive(const string_type& a, const string_type& b); // Puts compareDict() in a form appropriate for LL container classes to use for sorting. - static BOOL precedesDict( const string_type& a, const string_type& b ); + static bool precedesDict( const string_type& a, const string_type& b ); // A replacement for strncpy. // If the dst buffer is dst_size bytes long or more, ensures that dst is null terminated and holds @@ -447,6 +448,7 @@ template<class T> std::string LLStringUtilBase<T>::sLocale; typedef LLStringUtilBase<char> LLStringUtil; typedef LLStringUtilBase<llwchar> LLWStringUtil; typedef std::basic_string<llwchar> LLWString; +typedef std::basic_string_view<llwchar> LLWStringView; //@ Use this where we want to disallow input in the form of "foo" // This is used to catch places where english text is embedded in the code @@ -464,7 +466,7 @@ struct LLDictionaryLess public: bool operator()(const std::string& a, const std::string& b) const { - return (LLStringUtil::precedesDict(a, b) ? true : false); + return (LLStringUtil::precedesDict(a, b)); } }; @@ -694,7 +696,7 @@ LL_COMMON_API S32 utf16str_wstring_length(const llutf16string &utf16str, S32 len LL_COMMON_API S32 wstring_utf16_length(const LLWString & wstr, S32 woffset, S32 wlen); // Length in wstring (i.e., llwchar count) of a part of a wstring specified by utf16 length (i.e., utf16 units.) -LL_COMMON_API S32 wstring_wstring_length_from_utf16_length(const LLWString & wstr, S32 woffset, S32 utf16_length, BOOL *unaligned = NULL); +LL_COMMON_API S32 wstring_wstring_length_from_utf16_length(const LLWString & wstr, S32 woffset, S32 utf16_length, bool *unaligned = nullptr); /** * @brief Properly truncate a utf8 string to a maximum byte count. @@ -748,7 +750,7 @@ LL_COMMON_API llwchar utf8str_to_wchar(const std::string& utf8str, size_t offset LL_COMMON_API std::string utf8str_showBytesUTF8(const std::string& utf8str); -LL_COMMON_API bool wstring_has_emoji(const LLWString& wstr); +LL_COMMON_API bool wstring_has_emoji(LLWStringView wstr); LL_COMMON_API bool wstring_remove_emojis(LLWString& wstr); @@ -835,11 +837,11 @@ STRING windows_message() { return windows_message<STRING>(GetLastError()); } //@} -LL_COMMON_API boost::optional<std::wstring> llstring_getoptenv(const std::string& key); +LL_COMMON_API std::optional<std::wstring> llstring_getoptenv(const std::string& key); #else // ! LL_WINDOWS -LL_COMMON_API boost::optional<std::string> llstring_getoptenv(const std::string& key); +LL_COMMON_API std::optional<std::string> llstring_getoptenv(const std::string& key); #endif // ! LL_WINDOWS @@ -1378,7 +1380,7 @@ S32 LLStringUtilBase<T>::compareDictInsensitive(const string_type& astr, const s // Puts compareDict() in a form appropriate for LL container classes to use for sorting. // static template<class T> -BOOL LLStringUtilBase<T>::precedesDict( const string_type& a, const string_type& b ) +bool LLStringUtilBase<T>::precedesDict( const string_type& a, const string_type& b ) { if( a.size() && b.size() ) { @@ -1634,15 +1636,15 @@ void LLStringUtilBase<T>::capitalize(string_type& str) //static template<class T> -BOOL LLStringUtilBase<T>::containsNonprintable(const string_type& string) +bool LLStringUtilBase<T>::containsNonprintable(const string_type& string) { const char MIN = 32; - BOOL rv = FALSE; + bool rv = false; for (size_type i = 0; i < string.size(); i++) { if(string[i] < MIN) { - rv = TRUE; + rv = true; break; } } @@ -1771,12 +1773,12 @@ void LLStringUtilBase<T>::copyInto(string_type& dst, const string_type& src, siz // True if this is the head of s. //static template<class T> -BOOL LLStringUtilBase<T>::isHead( const string_type& string, const T* s ) +bool LLStringUtilBase<T>::isHead( const string_type& string, const T* s ) { if( string.empty() ) { // Early exit - return FALSE; + return false; } else { @@ -1812,17 +1814,17 @@ bool LLStringUtilBase<T>::endsWith( // static template<class T> -auto LLStringUtilBase<T>::getoptenv(const std::string& key) -> boost::optional<string_type> +auto LLStringUtilBase<T>::getoptenv(const std::string& key) -> std::optional<string_type> { auto found(llstring_getoptenv(key)); if (found) { - // return populated boost::optional + // return populated std::optional return { ll_convert<string_type>(*found) }; } else { - // empty boost::optional + // empty std::optional return {}; } } @@ -1843,11 +1845,11 @@ auto LLStringUtilBase<T>::getenv(const std::string& key, const string_type& dflt } template<class T> -BOOL LLStringUtilBase<T>::convertToBOOL(const string_type& string, BOOL& value) +bool LLStringUtilBase<T>::convertToBOOL(const string_type& string, bool& value) { if( string.empty() ) { - return FALSE; + return false; } string_type temp( string ); @@ -1860,8 +1862,8 @@ BOOL LLStringUtilBase<T>::convertToBOOL(const string_type& string, BOOL& value) (temp == "true") || (temp == "True") ) { - value = TRUE; - return TRUE; + value = true; + return true; } else if( @@ -1872,71 +1874,71 @@ BOOL LLStringUtilBase<T>::convertToBOOL(const string_type& string, BOOL& value) (temp == "false") || (temp == "False") ) { - value = FALSE; - return TRUE; + value = false; + return true; } - return FALSE; + return false; } template<class T> -BOOL LLStringUtilBase<T>::convertToU8(const string_type& string, U8& value) +bool LLStringUtilBase<T>::convertToU8(const string_type& string, U8& value) { S32 value32 = 0; - BOOL success = convertToS32(string, value32); + bool success = convertToS32(string, value32); if( success && (U8_MIN <= value32) && (value32 <= U8_MAX) ) { value = (U8) value32; - return TRUE; + return true; } - return FALSE; + return false; } template<class T> -BOOL LLStringUtilBase<T>::convertToS8(const string_type& string, S8& value) +bool LLStringUtilBase<T>::convertToS8(const string_type& string, S8& value) { S32 value32 = 0; - BOOL success = convertToS32(string, value32); + bool success = convertToS32(string, value32); if( success && (S8_MIN <= value32) && (value32 <= S8_MAX) ) { value = (S8) value32; - return TRUE; + return true; } - return FALSE; + return false; } template<class T> -BOOL LLStringUtilBase<T>::convertToS16(const string_type& string, S16& value) +bool LLStringUtilBase<T>::convertToS16(const string_type& string, S16& value) { S32 value32 = 0; - BOOL success = convertToS32(string, value32); + bool success = convertToS32(string, value32); if( success && (S16_MIN <= value32) && (value32 <= S16_MAX) ) { value = (S16) value32; - return TRUE; + return true; } - return FALSE; + return false; } template<class T> -BOOL LLStringUtilBase<T>::convertToU16(const string_type& string, U16& value) +bool LLStringUtilBase<T>::convertToU16(const string_type& string, U16& value) { S32 value32 = 0; - BOOL success = convertToS32(string, value32); + bool success = convertToS32(string, value32); if( success && (U16_MIN <= value32) && (value32 <= U16_MAX) ) { value = (U16) value32; - return TRUE; + return true; } - return FALSE; + return false; } template<class T> -BOOL LLStringUtilBase<T>::convertToU32(const string_type& string, U32& value) +bool LLStringUtilBase<T>::convertToU32(const string_type& string, U32& value) { if( string.empty() ) { - return FALSE; + return false; } string_type temp( string ); @@ -1946,17 +1948,17 @@ BOOL LLStringUtilBase<T>::convertToU32(const string_type& string, U32& value) if(i_stream >> v) { value = v; - return TRUE; + return true; } - return FALSE; + return false; } template<class T> -BOOL LLStringUtilBase<T>::convertToS32(const string_type& string, S32& value) +bool LLStringUtilBase<T>::convertToS32(const string_type& string, S32& value) { if( string.empty() ) { - return FALSE; + return false; } string_type temp( string ); @@ -1969,34 +1971,34 @@ BOOL LLStringUtilBase<T>::convertToS32(const string_type& string, S32& value) //if((LONG_MAX == v) || (LONG_MIN == v)) //{ // // Underflow or overflow - // return FALSE; + // return false; //} value = v; - return TRUE; + return true; } - return FALSE; + return false; } template<class T> -BOOL LLStringUtilBase<T>::convertToF32(const string_type& string, F32& value) +bool LLStringUtilBase<T>::convertToF32(const string_type& string, F32& value) { F64 value64 = 0.0; - BOOL success = convertToF64(string, value64); + bool success = convertToF64(string, value64); if( success && (-F32_MAX <= value64) && (value64 <= F32_MAX) ) { value = (F32) value64; - return TRUE; + return true; } - return FALSE; + return false; } template<class T> -BOOL LLStringUtilBase<T>::convertToF64(const string_type& string, F64& value) +bool LLStringUtilBase<T>::convertToF64(const string_type& string, F64& value) { if( string.empty() ) { - return FALSE; + return false; } string_type temp( string ); @@ -2009,13 +2011,13 @@ BOOL LLStringUtilBase<T>::convertToF64(const string_type& string, F64& value) //if( ((-HUGE_VAL == v) || (HUGE_VAL == v))) ) //{ // // Underflow or overflow - // return FALSE; + // return false; //} value = v; - return TRUE; + return true; } - return FALSE; + return false; } template<class T> diff --git a/indra/llcommon/llstringtable.h b/indra/llcommon/llstringtable.h index e41701ce9c..97f95369e5 100644 --- a/indra/llcommon/llstringtable.h +++ b/indra/llcommon/llstringtable.h @@ -51,7 +51,7 @@ public: ~LLStringTableEntry(); void incCount() { mCount++; } - BOOL decCount() { return --mCount; } + bool decCount() { return --mCount != 0; } char *mString; S32 mCount; diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index d21afab050..546f35bc81 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -218,7 +218,7 @@ LLOSInfo::LLOSInfo() : DWORD cbData(sizeof(DWORD)); DWORD data(0); HKEY key; - BOOL ret_code = RegOpenKeyExW(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"), 0, KEY_READ, &key); + LSTATUS ret_code = RegOpenKeyExW(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"), 0, KEY_READ, &key); if (ERROR_SUCCESS == ret_code) { ret_code = RegQueryValueExW(key, L"UBR", 0, NULL, reinterpret_cast<LPBYTE>(&data), &cbData); @@ -231,16 +231,8 @@ LLOSInfo::LLOSInfo() : if (mBuild >= 22000) { // At release Windows 11 version was 10.0.22000.194 - // Windows 10 version was 10.0.19043.1266 - // There is no warranty that Win10 build won't increase, - // so until better solution is found or Microsoft updates - // SDK with IsWindows11OrGreater(), indicate "10/11" - // - // Current alternatives: - // Query WMI's Win32_OperatingSystem for OS string. Slow - // and likely to return 'compatibility' string. - // Check presence of dlls/libs or may be their version. - mOSStringSimple = "Microsoft Windows 10/11 "; + // According to microsoft win 10 won't ever get that far. + mOSStringSimple = "Microsoft Windows 11 "; } } @@ -273,9 +265,9 @@ LLOSInfo::LLOSInfo() : #elif LL_DARWIN // Initialize mOSStringSimple to something like: - // "Mac OS X 10.6.7" + // "macOS 10.13.1" { - const char * DARWIN_PRODUCT_NAME = "Mac OS X"; + const char * DARWIN_PRODUCT_NAME = "macOS"; int64_t major_version, minor_version, bugfix_version = 0; @@ -298,7 +290,7 @@ LLOSInfo::LLOSInfo() : } // Initialize mOSString to something like: - // "Mac OS X 10.6.7 Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386 i386" + // "macOS 10.13.1 Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386 i386" struct utsname un; if(uname(&un) != -1) { @@ -575,7 +567,7 @@ bool LLOSInfo::is64Bit() return true; #elif defined(_WIN32) // 32-bit viewer may be run on both 32-bit and 64-bit Windows, need to elaborate - BOOL f64 = FALSE; + bool f64 = false; return IsWow64Process(GetCurrentProcess(), &f64) && f64; #else return false; @@ -1328,11 +1320,11 @@ private: // Need an instance of FrameWatcher before it does any good static FrameWatcher sFrameWatcher; -BOOL gunzip_file(const std::string& srcfile, const std::string& dstfile) +bool gunzip_file(const std::string& srcfile, const std::string& dstfile) { std::string tmpfile; const S32 UNCOMPRESS_BUFFER_SIZE = 32768; - BOOL retval = FALSE; + bool retval = false; gzFile src = NULL; U8 buffer[UNCOMPRESS_BUFFER_SIZE]; LLFILE *dst = NULL; @@ -1364,18 +1356,18 @@ BOOL gunzip_file(const std::string& srcfile, const std::string& dstfile) LLFile::remove(dstfile, ENOENT); #endif if (LLFile::rename(tmpfile, dstfile) == -1) goto err; /* Flawfinder: ignore */ - retval = TRUE; + retval = true; err: if (src != NULL) gzclose(src); if (dst != NULL) fclose(dst); return retval; } -BOOL gzip_file(const std::string& srcfile, const std::string& dstfile) +bool gzip_file(const std::string& srcfile, const std::string& dstfile) { const S32 COMPRESS_BUFFER_SIZE = 32768; std::string tmpfile; - BOOL retval = FALSE; + bool retval = false; U8 buffer[COMPRESS_BUFFER_SIZE]; gzFile dst = NULL; LLFILE *src = NULL; @@ -1415,7 +1407,7 @@ BOOL gzip_file(const std::string& srcfile, const std::string& dstfile) LLFile::remove(dstfile); #endif if (LLFile::rename(tmpfile, dstfile) == -1) goto err; /* Flawfinder: ignore */ - retval = TRUE; + retval = true; err: if (src != NULL) fclose(src); if (dst != NULL) gzclose(dst); diff --git a/indra/llcommon/llsys.h b/indra/llcommon/llsys.h index 7338b0f0cb..3307285934 100644 --- a/indra/llcommon/llsys.h +++ b/indra/llcommon/llsys.h @@ -164,10 +164,10 @@ LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLOSInfo& info); LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLCPUInfo& info); LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLMemoryInfo& info); -// gunzip srcfile into dstfile. Returns FALSE on error. -BOOL LL_COMMON_API gunzip_file(const std::string& srcfile, const std::string& dstfile); -// gzip srcfile into dstfile. Returns FALSE on error. -BOOL LL_COMMON_API gzip_file(const std::string& srcfile, const std::string& dstfile); +// gunzip srcfile into dstfile. Returns false on error. +bool LL_COMMON_API gunzip_file(const std::string& srcfile, const std::string& dstfile); +// gzip srcfile into dstfile. Returns false on error. +bool LL_COMMON_API gzip_file(const std::string& srcfile, const std::string& dstfile); extern LL_COMMON_API LLCPUInfo gSysCPU; diff --git a/indra/llcommon/llsys_objc.mm b/indra/llcommon/llsys_objc.mm index 3fd85fb1c9..1393ccea50 100644 --- a/indra/llcommon/llsys_objc.mm +++ b/indra/llcommon/llsys_objc.mm @@ -27,38 +27,12 @@ #import "llsys_objc.h" #import <AppKit/AppKit.h> -static auto intAtStringIndex(NSArray *array, int index) -{ - return [(NSString *)[array objectAtIndex:index] integerValue]; -} - bool LLGetDarwinOSInfo(int64_t &major, int64_t &minor, int64_t &patch) { - if (NSAppKitVersionNumber > NSAppKitVersionNumber10_8) - { NSOperatingSystemVersion osVersion = [[NSProcessInfo processInfo] operatingSystemVersion]; major = osVersion.majorVersion; minor = osVersion.minorVersion; patch = osVersion.patchVersion; - } - else - { - NSString* versionString = [[NSDictionary dictionaryWithContentsOfFile: - @"/System/Library/CoreServices/SystemVersion.plist"] objectForKey:@"ProductVersion"]; - NSArray* versions = [versionString componentsSeparatedByString:@"."]; - NSUInteger count = [versions count]; - if (count > 0) - { - major = intAtStringIndex(versions, 0); - if (count > 1) - { - minor = intAtStringIndex(versions, 1); - if (count > 2) - { - patch = intAtStringIndex(versions, 2); - } - } - } - } + return true; } diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp index e6b0c03371..faaaefd561 100644 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -189,7 +189,7 @@ void LLThread::threadRun() } LLThread::LLThread(const std::string& name, apr_pool_t *poolp) : - mPaused(FALSE), + mPaused(false), mName(name), mThreadp(NULL), mStatus(STOPPED), @@ -421,30 +421,6 @@ void LLThread::unlockData() //============================================================================ -//---------------------------------------------------------------------------- - -//static -LLMutex* LLThreadSafeRefCount::sMutex = 0; - -//static -void LLThreadSafeRefCount::initThreadSafeRefCount() -{ - if (!sMutex) - { - sMutex = new LLMutex(); - } -} - -//static -void LLThreadSafeRefCount::cleanupThreadSafeRefCount() -{ - delete sMutex; - sMutex = NULL; -} - - -//---------------------------------------------------------------------------- - LLThreadSafeRefCount::LLThreadSafeRefCount() : mRef(0) { diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h index e21e6265ea..4194e0014d 100644 --- a/indra/llcommon/llthread.h +++ b/indra/llcommon/llthread.h @@ -68,7 +68,7 @@ public: // Called from MAIN THREAD. void pause(); void unpause(); - bool isPaused() { return isStopped() || mPaused == TRUE; } + bool isPaused() { return isStopped() || mPaused; } // Cause the thread to wake up and check its condition void wake(); diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp index 00a04d87b6..5d0a70a382 100644 --- a/indra/llcommon/lltimer.cpp +++ b/indra/llcommon/lltimer.cpp @@ -96,7 +96,7 @@ U32 micro_sleep(U64 us, U32 max_yields) LARGE_INTEGER ft; ft.QuadPart = -static_cast<S64>(us * 10); // '-' using relative time - HANDLE timer = CreateWaitableTimer(NULL, TRUE, NULL); + HANDLE timer = CreateWaitableTimer(NULL, true, NULL); SetWaitableTimer(timer, &ft, 0, NULL, NULL, 0); WaitForSingleObject(timer, INFINITE); CloseHandle(timer); @@ -324,7 +324,7 @@ LLTimer::LLTimer() get_timer_info().update(); } - mStarted = TRUE; + mStarted = true; reset(); } @@ -424,7 +424,7 @@ F32SecondsImplicit LLTimer::getElapsedTimeAndResetF32() /////////////////////////////////////////////////////////////////////////////// -void LLTimer::setTimerExpirySec(F32SecondsImplicit expiration) +void LLTimer::setTimerExpirySec(F32SecondsImplicit expiration) { mExpirationTicks = get_clock_count() + (U64)((F32)(expiration * get_timer_info().mClockFrequency.value())); @@ -441,31 +441,30 @@ F32SecondsImplicit LLTimer::getRemainingTimeF32() const } -BOOL LLTimer::checkExpirationAndReset(F32 expiration) +bool LLTimer::checkExpirationAndReset(F32 expiration) { U64 cur_ticks = get_clock_count(); if (cur_ticks < mExpirationTicks) { - return FALSE; + return false; } mExpirationTicks = cur_ticks + (U64)((F32)(expiration * get_timer_info().mClockFrequency)); - return TRUE; + return true; } -BOOL LLTimer::hasExpired() const +bool LLTimer::hasExpired() const { - return (get_clock_count() >= mExpirationTicks) - ? TRUE : FALSE; + return get_clock_count() >= mExpirationTicks; } /////////////////////////////////////////////////////////////////////////////// -BOOL LLTimer::knownBadTimer() +bool LLTimer::knownBadTimer() { - BOOL failed = FALSE; + bool failed = false; #if LL_WINDOWS WCHAR bad_pci_list[][10] = {L"1039:0530", @@ -507,7 +506,7 @@ BOOL LLTimer::knownBadTimer() if (!wcscmp(pci_id, bad_pci_list[check])) { // LL_WARNS() << "unreliable PCI chipset found!! " << pci_id << endl; - failed = TRUE; + failed = true; break; } } @@ -533,7 +532,7 @@ time_t time_corrected() // Is the current computer (in its current time zone) // observing daylight savings time? -BOOL is_daylight_savings() +bool is_daylight_savings() { time_t now = time(NULL); @@ -547,7 +546,7 @@ BOOL is_daylight_savings() } -struct tm* utc_to_pacific_time(time_t utc_time, BOOL pacific_daylight_time) +struct tm* utc_to_pacific_time(time_t utc_time, bool pacific_daylight_time) { S32Hours pacific_offset_hours; if (pacific_daylight_time) diff --git a/indra/llcommon/lltimer.h b/indra/llcommon/lltimer.h index fe4a3afc7a..d79f250585 100644 --- a/indra/llcommon/lltimer.h +++ b/indra/llcommon/lltimer.h @@ -87,19 +87,19 @@ public: // MANIPULATORS - void start() { reset(); mStarted = TRUE; } - void stop() { mStarted = FALSE; } + void start() { reset(); mStarted = true; } + void stop() { mStarted = false; } void reset(); // Resets the timer void setLastClockCount(U64 current_count); // Sets the timer so that the next elapsed call will be relative to this time void setTimerExpirySec(F32SecondsImplicit expiration); - BOOL checkExpirationAndReset(F32 expiration); - BOOL hasExpired() const; + bool checkExpirationAndReset(F32 expiration); + bool hasExpired() const; F32SecondsImplicit getElapsedTimeAndResetF32(); // Returns elapsed time in seconds with reset F64SecondsImplicit getElapsedTimeAndResetF64(); F32SecondsImplicit getRemainingTimeF32() const; - static BOOL knownBadTimer(); + static bool knownBadTimer(); // ACCESSORS F32SecondsImplicit getElapsedTimeF32() const; // Returns elapsed time in seconds @@ -171,14 +171,14 @@ extern LL_COMMON_API S32 gUTCOffset; // Is the current computer (in its current time zone) // observing daylight savings time? -LL_COMMON_API BOOL is_daylight_savings(); +LL_COMMON_API bool is_daylight_savings(); // Converts internal "struct tm" time buffer to Pacific Standard/Daylight Time // Usage: // S32 utc_time; // utc_time = time_corrected(); // struct tm* internal_time = utc_to_pacific_time(utc_time, gDaylight); -LL_COMMON_API struct tm* utc_to_pacific_time(time_t utc_time, BOOL pacific_daylight_time); +LL_COMMON_API struct tm* utc_to_pacific_time(time_t utc_time, bool pacific_daylight_time); LL_COMMON_API void microsecondsToTimecodeString(U64MicrosecondsImplicit current_time, std::string& tcstring); LL_COMMON_API void secondsToTimecodeString(F32SecondsImplicit current_time, std::string& tcstring); diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index 692bbe5acf..ba7acf9547 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -522,9 +522,9 @@ namespace LLTrace struct BlockTimerStackRecord { - class BlockTimer* mActiveTimer; - class BlockTimerStatHandle* mTimeBlock; - U64 mChildTime; + class BlockTimer* mActiveTimer{ nullptr }; + class BlockTimerStatHandle* mTimeBlock{ nullptr }; + U64 mChildTime{ 0 }; }; struct AccumulatorBufferGroup : public LLRefCount diff --git a/indra/llcommon/lluri.cpp b/indra/llcommon/lluri.cpp index e93238f0e9..df82276cd2 100644 --- a/indra/llcommon/lluri.cpp +++ b/indra/llcommon/lluri.cpp @@ -330,7 +330,7 @@ LLURI::LLURI(const std::string& escaped_str) } } -static BOOL isDefault(const std::string& scheme, U16 port) +static bool isDefault(const std::string& scheme, U16 port) { if (scheme == "http") return port == 80; @@ -339,7 +339,7 @@ static BOOL isDefault(const std::string& scheme, U16 port) if (scheme == "ftp") return port == 21; - return FALSE; + return false; } void LLURI::parseAuthorityAndPathUsingOpaque() @@ -627,7 +627,7 @@ std::string LLURI::password() const return unescape(pass); } -BOOL LLURI::defaultPort() const +bool LLURI::defaultPort() const { return isDefault(mScheme, hostPort()); } diff --git a/indra/llcommon/lluri.h b/indra/llcommon/lluri.h index 95c119dee9..37ee0a0ac7 100644 --- a/indra/llcommon/lluri.h +++ b/indra/llcommon/lluri.h @@ -99,7 +99,7 @@ public: std::string userName() const; std::string password() const; U16 hostPort() const; // ex.: 80, will include implicit port - BOOL defaultPort() const; // true if port is default for scheme + bool defaultPort() const; // true if port is default for scheme const std::string& escapedPath() const { return mEscapedPath; } std::string path() const; // ex.: "/abc/def", includes leading slash LLSD pathArray() const; // above decoded into an array of strings diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp index be2e51560e..931a6e340d 100644 --- a/indra/llcommon/lluuid.cpp +++ b/indra/llcommon/lluuid.cpp @@ -211,20 +211,20 @@ std::string LLUUID::asString() const return str; } -BOOL LLUUID::set(const char* in_string, BOOL emit) +bool LLUUID::set(const char* in_string, bool emit) { return set(ll_safe_string(in_string), emit); } -BOOL LLUUID::set(const std::string& in_string, BOOL emit) +bool LLUUID::set(const std::string& in_string, bool emit) { - BOOL broken_format = FALSE; + bool broken_format = false; // empty strings should make NULL uuid if (in_string.empty()) { setNull(); - return TRUE; + return true; } if (in_string.length() != (UUID_STR_LENGTH - 1)) /* Flawfinder: ignore */ @@ -237,7 +237,7 @@ BOOL LLUUID::set(const std::string& in_string, BOOL emit) { LL_WARNS() << "Warning! Using broken UUID string format" << LL_ENDL; } - broken_format = TRUE; + broken_format = true; } else { @@ -248,7 +248,7 @@ BOOL LLUUID::set(const std::string& in_string, BOOL emit) LL_WARNS() << "Bad UUID string: " << in_string << LL_ENDL; } setNull(); - return FALSE; + return false; } } @@ -287,7 +287,7 @@ BOOL LLUUID::set(const std::string& in_string, BOOL emit) LL_WARNS() << "Invalid UUID string character" << LL_ENDL; } setNull(); - return FALSE; + return false; } mData[i] = mData[i] << 4; @@ -312,27 +312,27 @@ BOOL LLUUID::set(const std::string& in_string, BOOL emit) LL_WARNS() << "Invalid UUID string character" << LL_ENDL; } setNull(); - return FALSE; + return false; } cur_pos++; } - return TRUE; + return true; } -BOOL LLUUID::validate(const std::string& in_string) +bool LLUUID::validate(const std::string& in_string) { - BOOL broken_format = FALSE; + bool broken_format = false; if (in_string.length() != (UUID_STR_LENGTH - 1)) /* Flawfinder: ignore */ { // I'm a moron. First implementation didn't have the right UUID format. if (in_string.length() == (UUID_STR_LENGTH - 2)) /* Flawfinder: ignore */ { - broken_format = TRUE; + broken_format = true; } else { - return FALSE; + return false; } } @@ -360,7 +360,7 @@ BOOL LLUUID::validate(const std::string& in_string) } else { - return FALSE; + return false; } cur_pos++; @@ -376,11 +376,11 @@ BOOL LLUUID::validate(const std::string& in_string) } else { - return FALSE; + return false; } cur_pos++; } - return TRUE; + return true; } const LLUUID& LLUUID::operator^=(const LLUUID& rhs) @@ -510,7 +510,7 @@ S32 LLUUID::getNodeID(unsigned char* node_id) } #elif LL_DARWIN -// Mac OS X version of the UUID generation code... +// macOS version of the UUID generation code... /* * Get an ethernet hardware address, if we can find it... */ @@ -736,12 +736,12 @@ void LLUUID::getCurrentTime(uuid_time_t* timestamp) static uuid_time_t time_last; static U32 uuids_this_tick; - static BOOL init = FALSE; + static bool init = false; if (!init) { getSystemTime(&time_last); uuids_this_tick = uuids_per_tick; - init = TRUE; + init = true; mMutex = new LLMutex(); } @@ -889,11 +889,11 @@ U32 LLUUID::getRandomSeed() return U32(seed64) ^ U32(seed64 >> 32); } -BOOL LLUUID::parseUUID(const std::string& buf, LLUUID* value) +bool LLUUID::parseUUID(const std::string& buf, LLUUID* value) { if (buf.empty() || value == NULL) { - return FALSE; + return false; } std::string temp(buf); @@ -901,9 +901,9 @@ BOOL LLUUID::parseUUID(const std::string& buf, LLUUID* value) if (LLUUID::validate(temp)) { value->set(temp); - return TRUE; + return true; } - return FALSE; + return false; } //static @@ -989,7 +989,7 @@ bool LLUUID::operator!=(const LLUUID& rhs) const } */ -BOOL LLUUID::notNull() const +bool LLUUID::notNull() const { U32* word = (U32*)mData; return (word[0] | word[1] | word[2] | word[3]) > 0; @@ -997,10 +997,10 @@ BOOL LLUUID::notNull() const // Faster than == LLUUID::null because doesn't require // as much memory access. -BOOL LLUUID::isNull() const +bool LLUUID::isNull() const { U32* word = (U32*)mData; - // If all bits are zero, return !0 == TRUE + // If all bits are zero, return !0 == true return !(word[0] | word[1] | word[2] | word[3]); } diff --git a/indra/llcommon/lluuid.h b/indra/llcommon/lluuid.h index eea5e39c61..bd4edc7993 100644 --- a/indra/llcommon/lluuid.h +++ b/indra/llcommon/lluuid.h @@ -37,8 +37,8 @@ class LLMutex; const S32 UUID_BYTES = 16; const S32 UUID_WORDS = 4; -const S32 UUID_STR_LENGTH = 37; // actually wrong, should be 36 and use size below -const S32 UUID_STR_SIZE = 37; +const S32 UUID_STR_LENGTH = 37; // number of bytes needed to store a UUID as a string +const S32 UUID_STR_SIZE = 36; // .size() of a UUID in a std::string const S32 UUID_BASE85_LENGTH = 21; // including the trailing NULL. struct uuid_time_t { @@ -65,8 +65,8 @@ public: static LLUUID generateNewID(std::string stream = ""); //static version of above for use in initializer expressions such as constructor params, etc. - BOOL set(const char *in_string, BOOL emit = TRUE); // Convert from string, if emit is FALSE, do not emit warnings - BOOL set(const std::string& in_string, BOOL emit = TRUE); // Convert from string, if emit is FALSE, do not emit warnings + bool set(const char *in_string, bool emit = true); // Convert from string, if emit is false, do not emit warnings + bool set(const std::string& in_string, bool emit = true); // Convert from string, if emit is false, do not emit warnings void setNull(); // Faster than setting to LLUUID::null. S32 cmpTime(uuid_time_t *t1, uuid_time_t *t2); @@ -76,14 +76,12 @@ public: // // ACCESSORS // - BOOL isNull() const; // Faster than comparing to LLUUID::null. - BOOL notNull() const; // Faster than comparing to LLUUID::null. + bool isNull() const; // Faster than comparing to LLUUID::null. + bool notNull() const; // Faster than comparing to LLUUID::null. // JC: This is dangerous. It allows UUIDs to be cast automatically // to integers, among other things. Use isNull() or notNull(). // operator bool() const; - // JC: These must return real bool's (not BOOLs) or else use of the STL - // will generate bool-to-int performance warnings. bool operator==(const LLUUID &rhs) const; bool operator!=(const LLUUID &rhs) const; bool operator<(const LLUUID &rhs) const; @@ -124,7 +122,7 @@ public: return tmp[0] ^ tmp[1]; } - static BOOL validate(const std::string& in_string); // Validate that the UUID string is legal. + static bool validate(const std::string& in_string); // Validate that the UUID string is legal. static const LLUUID null; static LLMutex * mMutex; @@ -132,7 +130,7 @@ public: static U32 getRandomSeed(); static S32 getNodeID(unsigned char * node_id); - static BOOL parseUUID(const std::string& buf, LLUUID* value); + static bool parseUUID(const std::string& buf, LLUUID* value); U8 mData[UUID_BYTES]; }; @@ -153,7 +151,7 @@ struct lluuid_less { bool operator()(const LLUUID& lhs, const LLUUID& rhs) const { - return (lhs < rhs) ? true : false; + return lhs < rhs; } }; diff --git a/indra/llcommon/llworkerthread.cpp b/indra/llcommon/llworkerthread.cpp index 67df2b5840..b751c95679 100644 --- a/indra/llcommon/llworkerthread.cpp +++ b/indra/llcommon/llworkerthread.cpp @@ -284,7 +284,7 @@ bool LLWorkerClass::yield() mWorkerThread->checkPause(); bool res; mMutex.lock(); - res = (getFlags() & WCF_ABORT_REQUESTED) ? true : false; + res = (getFlags() & WCF_ABORT_REQUESTED) != 0; mMutex.unlock(); return res; } diff --git a/indra/llcommon/llworkerthread.h b/indra/llcommon/llworkerthread.h index 01c96852d3..2a68584ab3 100644 --- a/indra/llcommon/llworkerthread.h +++ b/indra/llcommon/llworkerthread.h @@ -137,7 +137,7 @@ public: LLWorkerClass(LLWorkerThread* workerthread, const std::string& name); virtual ~LLWorkerClass(); - // pure virtual, called from WORKER THREAD, returns TRUE if done + // pure virtual, called from WORKER THREAD, returns true if done virtual bool doWork(S32 param)=0; // Called from WorkRequest::processRequest() // virtual, called from finishRequest() after completed or aborted virtual void finishWork(S32 param, bool completed); // called from finishRequest() (WORK THREAD) @@ -178,7 +178,7 @@ private: void clearFlags(U32 flags) { mWorkFlags = mWorkFlags & ~flags; } U32 getFlags() { return mWorkFlags; } public: - bool getFlags(U32 flags) { return mWorkFlags & flags ? true : false; } + bool getFlags(U32 flags) { return (mWorkFlags & flags) != 0; } private: // pure virtuals diff --git a/indra/llcommon/tests/commonmisc_test.cpp b/indra/llcommon/tests/commonmisc_test.cpp index 3deb864c0c..0057a1f639 100644 --- a/indra/llcommon/tests/commonmisc_test.cpp +++ b/indra/llcommon/tests/commonmisc_test.cpp @@ -67,7 +67,7 @@ namespace tut std::ostringstream resp; resp << "{'connect':true, 'position':[r128,r128,r128], 'look_at':[r0,r1,r0], 'agent_access':'M', 'region_x':i8192, 'region_y':i8192}"; std::string str = resp.str(); - LLMemoryStream mstr((U8*)str.c_str(), str.size()); + LLMemoryStream mstr((U8*)str.c_str(), static_cast<S32>(str.size())); LLSD response; S32 count = LLSDSerialize::fromNotation(response, mstr, str.size()); ensure("stream parsed", response.isDefined()); @@ -252,7 +252,7 @@ namespace tut resp << "{'label':'short binary test', 'singlebinary':b(1)\"A\", 'singlerawstring':s(1)\"A\", 'endoftest':'end' }"; std::string str = resp.str(); LLSD sd; - LLMemoryStream mstr((U8*)str.c_str(), str.size()); + LLMemoryStream mstr((U8*)str.c_str(), static_cast<S32>(str.size())); S32 count = LLSDSerialize::fromNotation(sd, mstr, str.size()); ensure_equals("parse count", count, 5); ensure("sd created", sd.isDefined()); @@ -456,7 +456,7 @@ namespace tut void mem_object::test<1>() { const char HELLO_WORLD[] = "hello world"; - LLMemoryStream mem((U8*)&HELLO_WORLD[0], strlen(HELLO_WORLD)); /* Flawfinder: ignore */ + LLMemoryStream mem((U8*)&HELLO_WORLD[0], static_cast<S32>(strlen(HELLO_WORLD))); /* Flawfinder: ignore */ std::string hello; std::string world; mem >> hello >> world; diff --git a/indra/llcommon/tests/lleventdispatcher_test.cpp b/indra/llcommon/tests/lleventdispatcher_test.cpp index a99acba848..44f772e322 100644 --- a/indra/llcommon/tests/lleventdispatcher_test.cpp +++ b/indra/llcommon/tests/lleventdispatcher_test.cpp @@ -491,7 +491,7 @@ namespace tut // Partial defaults arrays. for (LLSD::String a: ab) { - LLSD::Integer partition(std::min(partial_offset, dft_array_full[a].size())); + LLSD::Integer partition(static_cast<LLSD::Integer>(std::min(partial_offset, dft_array_full[a].size()))); dft_array_partial[a] = llsd_copy_array(dft_array_full[a].beginArray() + partition, dft_array_full[a].endArray()); @@ -508,7 +508,7 @@ namespace tut // (params, dft_array_full). Part of the point of using map-style // defaults is to allow any subset of the target function's // parameters to be optional, not just the rightmost. - for (LLSD::Integer ix = 0, ixend = params[a].size(); ix < ixend; ix += 2) + for (LLSD::Integer ix = 0, ixend = static_cast<LLSD::Integer>(params[a].size()); ix < ixend; ix += 2) { dft_map_partial[a][params[a][ix].asString()] = dft_array_full[a][ix]; } @@ -696,7 +696,7 @@ namespace tut LLSD zipmap(const LLSD& keys, const LLSD& values) { LLSD map; - for (LLSD::Integer i = 0, iend = keys.size(); i < iend; ++i) + for (LLSD::Integer i = 0, iend = static_cast<LLSD::Integer>(keys.size()); i < iend; ++i) { // Have to select asString() since you can index an LLSD // object with either String or Integer. @@ -955,7 +955,7 @@ namespace tut allreq[a] = zipmap(params[a], LLSD::emptyArray()); // Same for leftreq, save that we use the subset of the params not // supplied by dft_array_partial[a]. - LLSD::Integer partition(params[a].size() - dft_array_partial[a].size()); + LLSD::Integer partition(static_cast<LLSD::Integer>(params[a].size() - dft_array_partial[a].size())); leftreq[a] = zipmap(llsd_copy_array(params[a].beginArray(), params[a].beginArray() + partition), LLSD::emptyArray()); diff --git a/indra/llcommon/tests/llsdserialize_test.cpp b/indra/llcommon/tests/llsdserialize_test.cpp index 56fdc51e82..fb2af1d2db 100644 --- a/indra/llcommon/tests/llsdserialize_test.cpp +++ b/indra/llcommon/tests/llsdserialize_test.cpp @@ -701,7 +701,7 @@ namespace tut "<key>cam</key><real>1.23</real>" "</map></llsd>", v, - v.size() + 1); + static_cast<S32>(v.size()) + 1); } template<> template<> @@ -721,7 +721,7 @@ namespace tut "<key>cam</key><real>1.23</real>" "</map></llsd>", v, - v.size() + 1); + static_cast<S32>(v.size()) + 1); v.clear(); v["amy"] = 23; @@ -734,7 +734,7 @@ namespace tut "<key>cam</key><real>1.23</real>" "</map></llsd>", v, - v.size() + 1); + static_cast<S32>(v.size()) + 1); v.clear(); v["amy"] = 23; @@ -751,7 +751,7 @@ namespace tut "<key>cam</key><real>1.23</real>" "</map></llsd>", v, - v.size() + 1); + static_cast<S32>(v.size()) + 1); v.clear(); v[0] = 23; @@ -766,7 +766,7 @@ namespace tut "<real>1.23</real>" "</array></llsd>", v, - v.size() + 1); + static_cast<S32>(v.size()) + 1); v.clear(); v[0] = 23; @@ -782,7 +782,7 @@ namespace tut "<real>1.23</real>" "</array></llsd>", v, - v.size() + 1); + static_cast<S32>(v.size()) + 1); } template<> template<> @@ -1405,13 +1405,13 @@ namespace tut uint32_t size = htonl(1); memcpy(&vec[1], &size, sizeof(uint32_t)); vec.push_back('k'); - int key_size_loc = vec.size(); + auto key_size_loc = vec.size(); size = htonl(1); // 1 too short vec.resize(vec.size() + 4); memcpy(&vec[key_size_loc], &size, sizeof(uint32_t)); vec.push_back('a'); vec.push_back('m'); vec.push_back('y'); vec.push_back('i'); - int integer_loc = vec.size(); + auto integer_loc = vec.size(); vec.resize(vec.size() + 4); uint32_t val_int = htonl(23); memcpy(&vec[integer_loc], &val_int, sizeof(uint32_t)); @@ -1473,7 +1473,7 @@ namespace tut memcpy(&vec[1], &size, sizeof(uint32_t)); vec.push_back('"'); vec.push_back('a'); vec.push_back('m'); vec.push_back('y'); vec.push_back('"'); vec.push_back('i'); - int integer_loc = vec.size(); + auto integer_loc = vec.size(); vec.resize(vec.size() + 4); uint32_t val_int = htonl(23); memcpy(&vec[integer_loc], &val_int, sizeof(uint32_t)); diff --git a/indra/llcommon/tests/llstring_test.cpp b/indra/llcommon/tests/llstring_test.cpp index ea5b0ee5fc..b68c63a15f 100644 --- a/indra/llcommon/tests/llstring_test.cpp +++ b/indra/llcommon/tests/llstring_test.cpp @@ -80,12 +80,12 @@ namespace tut void string_index_object_t::test<3>() { std::string str("Len=5"); - ensure("isValidIndex failed", LLStringUtil::isValidIndex(str, 0) == TRUE && - LLStringUtil::isValidIndex(str, 5) == TRUE && - LLStringUtil::isValidIndex(str, 6) == FALSE); + ensure("isValidIndex failed", LLStringUtil::isValidIndex(str, 0) == true && + LLStringUtil::isValidIndex(str, 5) == true && + LLStringUtil::isValidIndex(str, 6) == false); std::string str1; - ensure("isValidIndex failed fo rempty string", LLStringUtil::isValidIndex(str1, 0) == FALSE); + ensure("isValidIndex failed fo rempty string", LLStringUtil::isValidIndex(str1, 0) == false); } template<> template<> @@ -153,10 +153,10 @@ namespace tut void string_index_object_t::test<10>() { std::string str_val("Second"); - ensure("1. isHead failed", LLStringUtil::isHead(str_val, "SecondLife Source") == TRUE); - ensure("2. isHead failed", LLStringUtil::isHead(str_val, " SecondLife Source") == FALSE); + ensure("1. isHead failed", LLStringUtil::isHead(str_val, "SecondLife Source") == true); + ensure("2. isHead failed", LLStringUtil::isHead(str_val, " SecondLife Source") == false); std::string str_val2(""); - ensure("3. isHead failed", LLStringUtil::isHead(str_val2, "") == FALSE); + ensure("3. isHead failed", LLStringUtil::isHead(str_val2, "") == false); } template<> template<> @@ -206,10 +206,10 @@ namespace tut void string_index_object_t::test<15>() { std::string str_val("Hello.\n\r\t"); - ensure("containsNonprintable failed", LLStringUtil::containsNonprintable(str_val) == TRUE); + ensure("containsNonprintable failed", LLStringUtil::containsNonprintable(str_val) == true); str_val = "ABC "; - ensure("containsNonprintable failed", LLStringUtil::containsNonprintable(str_val) == FALSE); + ensure("containsNonprintable failed", LLStringUtil::containsNonprintable(str_val) == false); } template<> template<> @@ -231,7 +231,7 @@ namespace tut template<> template<> void string_index_object_t::test<17>() { - BOOL value; + bool value; std::string str_val("1"); ensure("convertToBOOL 1 failed", LLStringUtil::convertToBOOL(str_val, value) && value); str_val = "T"; @@ -457,17 +457,17 @@ namespace tut std::string lhs_str("PROgraM12files"); std::string rhs_str("PROgram12Files"); ensure("compareDict 1 failed", LLStringUtil::compareDict(lhs_str, rhs_str) < 0); - ensure("precedesDict 1 failed", LLStringUtil::precedesDict(lhs_str, rhs_str) == TRUE); + ensure("precedesDict 1 failed", LLStringUtil::precedesDict(lhs_str, rhs_str) == true); lhs_str = "PROgram12Files"; rhs_str = "PROgram12Files"; ensure("compareDict 2 failed", LLStringUtil::compareDict(lhs_str, rhs_str) == 0); - ensure("precedesDict 2 failed", LLStringUtil::precedesDict(lhs_str, rhs_str) == FALSE); + ensure("precedesDict 2 failed", LLStringUtil::precedesDict(lhs_str, rhs_str) == false); lhs_str = "PROgram12Files"; rhs_str = "PROgRAM12FILES"; ensure("compareDict 3 failed", LLStringUtil::compareDict(lhs_str, rhs_str) > 0); - ensure("precedesDict 3 failed", LLStringUtil::precedesDict(lhs_str, rhs_str) == FALSE); + ensure("precedesDict 3 failed", LLStringUtil::precedesDict(lhs_str, rhs_str) == false); } template<> template<> diff --git a/indra/llcommon/tests/threadsafeschedule_test.cpp b/indra/llcommon/tests/threadsafeschedule_test.cpp index f2f17dd2e6..5e5d6e1259 100644 --- a/indra/llcommon/tests/threadsafeschedule_test.cpp +++ b/indra/llcommon/tests/threadsafeschedule_test.cpp @@ -47,11 +47,11 @@ namespace tut // the timestamp for each one -- but since we're passing explicit // timestamps, make the queue reorder them. auto now{ Queue::Clock::now() }; - queue.push(Queue::TimeTuple(now + 200ms, "ghi")); + queue.push(Queue::TimeTuple(now + 200ms, "ghi"s)); // Given the various push() overloads, you have to match the type // exactly: conversions are ambiguous. - queue.push("abc"s); - queue.push(now + 100ms, "def"); + queue.push(now, "abc"s); + queue.push(now + 100ms, "def"s); queue.close(); auto entry = queue.pop(); ensure_equals("failed to pop first", std::get<0>(entry), "abc"s); diff --git a/indra/llcommon/threadpool.cpp b/indra/llcommon/threadpool.cpp index 302bbe6f8d..451e60c083 100644 --- a/indra/llcommon/threadpool.cpp +++ b/indra/llcommon/threadpool.cpp @@ -110,6 +110,10 @@ void LL::ThreadPoolBase::start() LL::ThreadPoolBase::~ThreadPoolBase() { close(); + if (!LLEventPumps::wasDeleted()) + { + LLEventPumps::instance().obtain("LLApp").stopListening(mName); + } } void LL::ThreadPoolBase::close() diff --git a/indra/llcorehttp/_httplibcurl.cpp b/indra/llcorehttp/_httplibcurl.cpp index e646271c84..6a15f08011 100644 --- a/indra/llcorehttp/_httplibcurl.cpp +++ b/indra/llcorehttp/_httplibcurl.cpp @@ -88,7 +88,7 @@ void HttpLibcurl::shutdown() if (mMultiHandles) { - for (int policy_class(0); policy_class < mPolicyCount; ++policy_class) + for (unsigned int policy_class(0); policy_class < mPolicyCount; ++policy_class) { if (mMultiHandles[policy_class]) { @@ -122,7 +122,7 @@ void HttpLibcurl::start(int policy_count) mActiveHandles = new int [mPolicyCount]; mDirtyPolicy = new bool [mPolicyCount]; - for (int policy_class(0); policy_class < mPolicyCount; ++policy_class) + for (unsigned int policy_class(0); policy_class < mPolicyCount; ++policy_class) { if (NULL == (mMultiHandles[policy_class] = curl_multi_init())) { @@ -148,7 +148,7 @@ HttpService::ELoopSpeed HttpLibcurl::processTransport() HttpService::ELoopSpeed ret(HttpService::REQUEST_SLEEP); // Give libcurl some cycles to do I/O & callbacks - for (int policy_class(0); policy_class < mPolicyCount; ++policy_class) + for (unsigned int policy_class(0); policy_class < mPolicyCount; ++policy_class) { if (! mMultiHandles[policy_class]) { @@ -442,18 +442,18 @@ bool HttpLibcurl::completeRequest(CURLM * multi_handle, CURL * handle, CURLcode int HttpLibcurl::getActiveCount() const { - return mActiveOps.size(); + return static_cast<int>(mActiveOps.size()); } -int HttpLibcurl::getActiveCountInClass(int policy_class) const +int HttpLibcurl::getActiveCountInClass(unsigned int policy_class) const { llassert_always(policy_class < mPolicyCount); return mActiveHandles ? mActiveHandles[policy_class] : 0; } -void HttpLibcurl::policyUpdated(int policy_class) +void HttpLibcurl::policyUpdated(unsigned int policy_class) { LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; if (policy_class < 0 || policy_class >= mPolicyCount || ! mMultiHandles) diff --git a/indra/llcorehttp/_httplibcurl.h b/indra/llcorehttp/_httplibcurl.h index a1b537d354..3631965837 100644 --- a/indra/llcorehttp/_httplibcurl.h +++ b/indra/llcorehttp/_httplibcurl.h @@ -107,7 +107,7 @@ public: /// /// Threading: called by worker thread. int getActiveCount() const; - int getActiveCountInClass(int policy_class) const; + int getActiveCountInClass(unsigned int policy_class) const; /// Attempt to cancel a request identified by handle. /// @@ -124,7 +124,7 @@ public: /// initialization and dynamic option setting. /// /// Threading: called by worker thread. - void policyUpdated(int policy_class); + void policyUpdated(unsigned int policy_class); /// Allocate a curl handle for caller. May be freed using /// either the freeHandle() method or calling curl_easy_cleanup() @@ -211,7 +211,7 @@ protected: HttpService * mService; // Simple reference, not owner HandleCache mHandleCache; // Handle allocator, owner active_set_t mActiveOps; - int mPolicyCount; + unsigned int mPolicyCount; CURLM ** mMultiHandles; // One handle per policy class int * mActiveHandles; // Active count per policy class bool * mDirtyPolicy; // Dirty policy update waiting for stall (per pc) diff --git a/indra/llcorehttp/_httpoprequest.cpp b/indra/llcorehttp/_httpoprequest.cpp index 5165a6eb62..6186e7a308 100644 --- a/indra/llcorehttp/_httpoprequest.cpp +++ b/indra/llcorehttp/_httpoprequest.cpp @@ -267,7 +267,7 @@ void HttpOpRequest::visitNotifier(HttpRequest * request) if (mReplyOffset || mReplyLength) { // Got an explicit offset/length in response - response->setRange(mReplyOffset, mReplyLength, mReplyFullLength); + response->setRange(mReplyOffset, static_cast<unsigned int>(mReplyLength), static_cast<unsigned int>(mReplyFullLength)); } response->setContentType(mReplyConType); response->setRetries(mPolicyRetries, mPolicy503Retries); @@ -328,7 +328,7 @@ HttpStatus HttpOpRequest::setupGetByteRange(HttpRequest::policy_t policy_id, LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; setupCommon(policy_id, url, NULL, options, headers); mReqMethod = HOR_GET; - mReqOffset = offset; + mReqOffset = static_cast<off_t>(offset); mReqLength = len; if (offset || len) { @@ -607,7 +607,7 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service) long data_size(0); if (mReqBody) { - data_size = mReqBody->size(); + data_size = static_cast<long>(mReqBody->size()); } check_curl_easy_setopt(mCurlHandle, CURLOPT_POSTFIELDS, static_cast<void *>(NULL)); check_curl_easy_setopt(mCurlHandle, CURLOPT_POSTFIELDSIZE, data_size); @@ -618,13 +618,14 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service) case HOR_PATCH: check_curl_easy_setopt(mCurlHandle, CURLOPT_CUSTOMREQUEST, "PATCH"); // fall through. The rest is the same as PUT + [[fallthrough]]; case HOR_PUT: { check_curl_easy_setopt(mCurlHandle, CURLOPT_UPLOAD, 1); long data_size(0); if (mReqBody) { - data_size = mReqBody->size(); + data_size = static_cast<long>(mReqBody->size()); } check_curl_easy_setopt(mCurlHandle, CURLOPT_INFILESIZE, data_size); mCurlHeaders = curl_slist_append(mCurlHeaders, "Expect:"); diff --git a/indra/llcorehttp/_httppolicy.cpp b/indra/llcorehttp/_httppolicy.cpp index 704c8abb93..a39d2f21a9 100644 --- a/indra/llcorehttp/_httppolicy.cpp +++ b/indra/llcorehttp/_httppolicy.cpp @@ -98,7 +98,7 @@ HttpPolicy::~HttpPolicy() HttpRequest::policy_t HttpPolicy::createPolicyClass() { - const HttpRequest::policy_t policy_class(mClasses.size()); + const HttpRequest::policy_t policy_class(static_cast<HttpRequest::policy_t>(mClasses.size())); if (policy_class >= HTTP_POLICY_CLASS_LIMIT) { return HttpRequest::INVALID_POLICY_ID; @@ -432,8 +432,8 @@ int HttpPolicy::getReadyCount(HttpRequest::policy_t policy_class) const { if (policy_class < mClasses.size()) { - return (mClasses[policy_class]->mReadyQueue.size() - + mClasses[policy_class]->mRetryQueue.size()); + return static_cast<int>((mClasses[policy_class]->mReadyQueue.size() + + mClasses[policy_class]->mRetryQueue.size())); } return 0; } diff --git a/indra/llcorehttp/_httpservice.cpp b/indra/llcorehttp/_httpservice.cpp index d543512ec4..5880fb7e87 100644 --- a/indra/llcorehttp/_httpservice.cpp +++ b/indra/llcorehttp/_httpservice.cpp @@ -317,7 +317,7 @@ void HttpService::threadRun(LLCoreInt::HttpThread * thread) } catch (std::bad_alloc&) { - LLMemory::logMemoryInfo(TRUE); + LLMemory::logMemoryInfo(true); //output possible call stacks to log file. LLError::LLUserWarningMsg::showOutOfMemory(); diff --git a/indra/llcorehttp/bufferarray.cpp b/indra/llcorehttp/bufferarray.cpp index 50a8d461a7..6b33661d8f 100644 --- a/indra/llcorehttp/bufferarray.cpp +++ b/indra/llcorehttp/bufferarray.cpp @@ -149,7 +149,7 @@ size_t BufferArray::append(const void * src, size_t len) } catch (std::bad_alloc&) { - LLMemory::logMemoryInfo(TRUE); + LLMemory::logMemoryInfo(true); //output possible call stacks to log file. LLError::LLCallStacks::print(); diff --git a/indra/llcorehttp/examples/http_texture_load.cpp b/indra/llcorehttp/examples/http_texture_load.cpp index 4d1e52b766..72e0c29a24 100644 --- a/indra/llcorehttp/examples/http_texture_load.cpp +++ b/indra/llcorehttp/examples/http_texture_load.cpp @@ -24,6 +24,8 @@ * $/LicenseInfo$ */ +#include "linden_common.h" + #include <iostream> #include <cstdio> #include <cstdlib> @@ -33,8 +35,6 @@ #include <pthread.h> #endif -#include "linden_common.h" - #include "httpcommon.h" #include "httprequest.h" #include "httphandler.h" @@ -519,7 +519,7 @@ void WorkingSet::onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * r { // More success LLCore::BufferArray * data(response->getBody()); - mByteCount += data ? data->size() : 0; + mByteCount += data ? static_cast<long>(data->size()) : 0L; ++mSuccesses; } else @@ -602,7 +602,7 @@ void WorkingSet::loadAssetUuids(FILE * in) mAssets.push_back(asset); } } - mRemaining = mLimit = mAssets.size(); + mRemaining = mLimit = static_cast<int>(mAssets.size()); } diff --git a/indra/llcrashlogger/llcrashlogger.cpp b/indra/llcrashlogger/llcrashlogger.cpp index b36f89b750..b1b698375a 100644 --- a/indra/llcrashlogger/llcrashlogger.cpp +++ b/indra/llcrashlogger/llcrashlogger.cpp @@ -50,8 +50,8 @@ #include <curl/curl.h> #include <openssl/crypto.h> -BOOL gBreak = false; -BOOL gSent = false; +bool gBreak = false; +bool gSent = false; int LLCrashLogger::ssl_mutex_count = 0; LLCoreInt::HttpMutex ** LLCrashLogger::ssl_mutex_list = NULL; @@ -131,7 +131,7 @@ std::string getStartupStateFromLog(std::string& sllog) std::string startup_state = "STATE_FIRST"; std::string startup_token = "Startup state changing from "; - int index = sllog.rfind(startup_token); + auto index = sllog.rfind(startup_token); if (index < 0 || index + startup_token.length() > sllog.length()) { return startup_state; } @@ -187,7 +187,7 @@ bool LLCrashLogger::readMinidump(std::string minidump_path) size_t length=0; llifstream minidump_stream(minidump_path.c_str(), std::ios_base::in | std::ios_base::binary); - if(minidump_stream.is_open()) + if (minidump_stream.is_open()) { minidump_stream.seekg(0, std::ios::end); length = (size_t)minidump_stream.tellg(); @@ -207,7 +207,7 @@ bool LLCrashLogger::readMinidump(std::string minidump_path) LL_WARNS("CRASHREPORT") << "failed to open minidump "<<minidump_path<<LL_ENDL; } - return (length>0?true:false); + return length > 0; } void LLCrashLogger::gatherFiles() diff --git a/indra/llcrashlogger/llcrashlogger.h b/indra/llcrashlogger/llcrashlogger.h index a5839b4622..e5bf19434a 100644 --- a/indra/llcrashlogger/llcrashlogger.h +++ b/indra/llcrashlogger/llcrashlogger.h @@ -77,7 +77,7 @@ protected: static void ssl_locking_callback(int mode, int type, const char * file, int line); S32 mCrashBehavior; - BOOL mCrashInPreviousExec; + bool mCrashInPreviousExec; std::map<std::string, std::string> mFileMap; std::string mGridName; LLControlGroup mCrashSettings; diff --git a/indra/llfilesystem/lldir.cpp b/indra/llfilesystem/lldir.cpp index a92b994b58..42e91963c1 100644 --- a/indra/llfilesystem/lldir.cpp +++ b/indra/llfilesystem/lldir.cpp @@ -638,7 +638,7 @@ std::string LLDir::getBaseFileName(const std::string& filepath, bool strip_exten std::string LLDir::getDirName(const std::string& filepath) const { std::size_t offset = filepath.find_last_of(getDirDelimiter()); - S32 len = (offset == std::string::npos) ? 0 : offset; + auto len = (offset == std::string::npos) ? 0 : offset; std::string dirname = filepath.substr(0, len); return dirname; } @@ -876,15 +876,15 @@ std::string LLDir::getTempFilename() const } // static -std::string LLDir::getScrubbedFileName(const std::string uncleanFileName) +std::string LLDir::getScrubbedFileName(std::string_view uncleanFileName) { std::string name(uncleanFileName); const std::string illegalChars(getForbiddenFileChars()); // replace any illegal file chars with and underscore '_' - for( unsigned int i = 0; i < illegalChars.length(); i++ ) + for (const char& ch : illegalChars) { - int j = -1; - while((j = name.find(illegalChars[i])) > -1) + std::string::size_type j{ 0 }; + while ((j = name.find(ch, j)) != std::string::npos) { name[j] = '_'; } diff --git a/indra/llfilesystem/lldir.h b/indra/llfilesystem/lldir.h index be82f55e46..b0d2b6aada 100644 --- a/indra/llfilesystem/lldir.h +++ b/indra/llfilesystem/lldir.h @@ -178,7 +178,7 @@ class LLDir static std::string getDumpLogsDirPath(const std::string &file_name = ""); // For producing safe download file names from potentially unsafe ones - static std::string getScrubbedFileName(const std::string uncleanFileName); + static std::string getScrubbedFileName(std::string_view uncleanFileName); static std::string getForbiddenFileChars(); void setDumpDir( const std::string& path ); diff --git a/indra/llfilesystem/lldir_linux.cpp b/indra/llfilesystem/lldir_linux.cpp index 1992cb83c7..69cfedebc7 100644 --- a/indra/llfilesystem/lldir_linux.cpp +++ b/indra/llfilesystem/lldir_linux.cpp @@ -255,11 +255,11 @@ bool LLDir_Linux::fileExists(const std::string &filename) const int res = stat(filename.c_str(), &stat_data); if (!res) { - return TRUE; + return true; } else { - return FALSE; + return false; } } diff --git a/indra/llfilesystem/lldir_mac.cpp b/indra/llfilesystem/lldir_mac.cpp index 2b51930aab..b25c654e31 100644 --- a/indra/llfilesystem/lldir_mac.cpp +++ b/indra/llfilesystem/lldir_mac.cpp @@ -1,6 +1,6 @@ /** * @file lldir_mac.cpp - * @brief Implementation of directory utilities for Mac OS X + * @brief Implementation of directory utilities for macOS * * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code diff --git a/indra/llfilesystem/lldir_mac.h b/indra/llfilesystem/lldir_mac.h index dbb8d85e81..f812ee810b 100644 --- a/indra/llfilesystem/lldir_mac.h +++ b/indra/llfilesystem/lldir_mac.h @@ -1,6 +1,6 @@ /** * @file lldir_mac.h - * @brief Definition of directory utilities class for Mac OS X + * @brief Definition of directory utilities class for macOS * * $LicenseInfo:firstyear=2000&license=viewerlgpl$ * Second Life Viewer Source Code diff --git a/indra/llfilesystem/lldir_utils_objc.h b/indra/llfilesystem/lldir_utils_objc.h index 142933972a..1d9cb34e19 100644 --- a/indra/llfilesystem/lldir_utils_objc.h +++ b/indra/llfilesystem/lldir_utils_objc.h @@ -1,6 +1,6 @@ /** * @file lldir_utils_objc.h - * @brief Definition of directory utilities class for Mac OS X + * @brief Definition of directory utilities class for macOS * * $LicenseInfo:firstyear=2020&license=viewerlgpl$ * Second Life Viewer Source Code diff --git a/indra/llfilesystem/lldir_utils_objc.mm b/indra/llfilesystem/lldir_utils_objc.mm index 20540fb93c..01fe9e1f2c 100644 --- a/indra/llfilesystem/lldir_utils_objc.mm +++ b/indra/llfilesystem/lldir_utils_objc.mm @@ -1,6 +1,6 @@ /** * @file lldir_utils_objc.mm - * @brief Cocoa implementation of directory utilities for Mac OS X + * @brief Cocoa implementation of directory utilities for macOS * * $LicenseInfo:firstyear=2020&license=viewerlgpl$ * Second Life Viewer Source Code diff --git a/indra/llfilesystem/lldir_win32.cpp b/indra/llfilesystem/lldir_win32.cpp index 5c85f0d3d4..a607c70b44 100644 --- a/indra/llfilesystem/lldir_win32.cpp +++ b/indra/llfilesystem/lldir_win32.cpp @@ -47,14 +47,16 @@ DWORD GetDllVersion(LPCTSTR lpszDllName); namespace { // anonymous - enum class prst { INIT, OPEN, SKIP } state = prst::INIT; + enum class prst { INIT, OPEN, SKIP }; + prst state{ prst::INIT }; + // This is called so early that we can't count on static objects being // properly constructed yet, so declare a pointer instead of an instance. std::ofstream* prelogf = nullptr; void prelog(const std::string& message) { - boost::optional<std::string> prelog_name; + std::optional<std::string> prelog_name; switch (state) { @@ -75,6 +77,7 @@ namespace (*prelogf) << "========================================================================" << std::endl; // fall through, don't break + [[fallthrough]]; case prst::OPEN: (*prelogf) << message << std::endl; @@ -230,7 +233,7 @@ LLDir_Win32::LLDir_Win32() { w_str[size] = '\0'; mExecutablePathAndName = utf16str_to_utf8str(llutf16string(w_str)); - S32 path_end = mExecutablePathAndName.find_last_of('\\'); + auto path_end = mExecutablePathAndName.find_last_of('\\'); if (path_end != std::string::npos) { mExecutableDir = mExecutablePathAndName.substr(0, path_end); @@ -379,11 +382,11 @@ bool LLDir_Win32::fileExists(const std::string &filename) const int res = LLFile::stat(filename, &stat_data); if (!res) { - return TRUE; + return true; } else { - return FALSE; + return false; } } diff --git a/indra/llfilesystem/lldir_win32.h b/indra/llfilesystem/lldir_win32.h index 2830364f15..ab2726f1a0 100644 --- a/indra/llfilesystem/lldir_win32.h +++ b/indra/llfilesystem/lldir_win32.h @@ -50,7 +50,7 @@ public: /*virtual*/ std::string getLLPluginFilename(std::string base_name); private: - void* mDirSearch_h; + void* mDirSearch_h{ nullptr }; llutf16string mCurrentDir; }; diff --git a/indra/llfilesystem/lldiskcache.cpp b/indra/llfilesystem/lldiskcache.cpp index 54e49ebcb8..da2e960ed3 100644 --- a/indra/llfilesystem/lldiskcache.cpp +++ b/indra/llfilesystem/lldiskcache.cpp @@ -222,6 +222,8 @@ const std::string LLDiskCache::assetTypeToString(LLAssetType::EType at) { LLAssetType::AT_MESH, "MESH" }, { LLAssetType::AT_SETTINGS, "SETTINGS" }, { LLAssetType::AT_MATERIAL, "MATERIAL" }, + { LLAssetType::AT_GLTF, "GLTF" }, + { LLAssetType::AT_GLTF_BIN, "GLTF_BIN" }, { LLAssetType::AT_UNKNOWN, "UNKNOWN" } }; diff --git a/indra/llfilesystem/llfilesystem.cpp b/indra/llfilesystem/llfilesystem.cpp index 4c836c8838..235aae0be3 100644 --- a/indra/llfilesystem/llfilesystem.cpp +++ b/indra/llfilesystem/llfilesystem.cpp @@ -124,14 +124,14 @@ bool LLFileSystem::renameFile(const LLUUID& old_file_id, const LLAssetType::ETyp if (LLFile::rename(old_filename, new_filename) != 0) { - // We would like to return FALSE here indicating the operation + // We would like to return false here indicating the operation // failed but the original code does not and doing so seems to // break a lot of things so we go with the flow... - //return FALSE; + //return false; LL_WARNS() << "Failed to rename " << old_file_id << " to " << new_id_str << " reason: " << strerror(errno) << LL_ENDL; } - return TRUE; + return true; } // static @@ -153,9 +153,9 @@ S32 LLFileSystem::getFileSize(const LLUUID& file_id, const LLAssetType::EType fi return file_size; } -BOOL LLFileSystem::read(U8* buffer, S32 bytes) +bool LLFileSystem::read(U8* buffer, S32 bytes) { - BOOL success = FALSE; + bool success = false; std::string id; mFileID.toString(id); @@ -183,7 +183,7 @@ BOOL LLFileSystem::read(U8* buffer, S32 bytes) mPosition += mBytesRead; if (mBytesRead) { - success = TRUE; + success = true; } } @@ -195,19 +195,19 @@ S32 LLFileSystem::getLastBytesRead() return mBytesRead; } -BOOL LLFileSystem::eof() +bool LLFileSystem::eof() { return mPosition >= getSize(); } -BOOL LLFileSystem::write(const U8* buffer, S32 bytes) +bool LLFileSystem::write(const U8* buffer, S32 bytes) { std::string id_str; mFileID.toString(id_str); const std::string extra_info = ""; const std::string filename = LLDiskCache::getInstance()->metaDataToFilepath(id_str, mFileType, extra_info); - BOOL success = FALSE; + bool success = false; if (mMode == APPEND) { @@ -218,7 +218,7 @@ BOOL LLFileSystem::write(const U8* buffer, S32 bytes) mPosition = ofs.tellp(); // <FS:Ansariel> Fix asset caching - success = TRUE; + success = true; } } // <FS:Ansariel> Fix asset caching @@ -231,7 +231,7 @@ BOOL LLFileSystem::write(const U8* buffer, S32 bytes) ofs.seekp(mPosition, std::ios::beg); ofs.write((const char*)buffer, bytes); mPosition += bytes; - success = TRUE; + success = true; } else { @@ -241,7 +241,7 @@ BOOL LLFileSystem::write(const U8* buffer, S32 bytes) { ofs.write((const char*)buffer, bytes); mPosition += bytes; - success = TRUE; + success = true; } } } @@ -255,14 +255,14 @@ BOOL LLFileSystem::write(const U8* buffer, S32 bytes) mPosition += bytes; - success = TRUE; + success = true; } } return success; } -BOOL LLFileSystem::seek(S32 offset, S32 origin) +bool LLFileSystem::seek(S32 offset, S32 origin) { if (-1 == origin) { @@ -278,18 +278,18 @@ BOOL LLFileSystem::seek(S32 offset, S32 origin) LL_WARNS() << "Attempt to seek past end of file" << LL_ENDL; mPosition = size; - return FALSE; + return false; } else if (new_pos < 0) { LL_WARNS() << "Attempt to seek past beginning of file" << LL_ENDL; mPosition = 0; - return FALSE; + return false; } mPosition = new_pos; - return TRUE; + return true; } S32 LLFileSystem::tell() const @@ -308,19 +308,19 @@ S32 LLFileSystem::getMaxSize() return INT_MAX; } -BOOL LLFileSystem::rename(const LLUUID& new_id, const LLAssetType::EType new_type) +bool LLFileSystem::rename(const LLUUID& new_id, const LLAssetType::EType new_type) { LLFileSystem::renameFile(mFileID, mFileType, new_id, new_type); mFileID = new_id; mFileType = new_type; - return TRUE; + return true; } -BOOL LLFileSystem::remove() +bool LLFileSystem::remove() { LLFileSystem::removeFile(mFileID, mFileType); - return TRUE; + return true; } diff --git a/indra/llfilesystem/llfilesystem.h b/indra/llfilesystem/llfilesystem.h index d934a408c2..ea1b9cf3a1 100644 --- a/indra/llfilesystem/llfilesystem.h +++ b/indra/llfilesystem/llfilesystem.h @@ -40,18 +40,18 @@ class LLFileSystem LLFileSystem(const LLUUID& file_id, const LLAssetType::EType file_type, S32 mode = LLFileSystem::READ); ~LLFileSystem(); - BOOL read(U8* buffer, S32 bytes); + bool read(U8* buffer, S32 bytes); S32 getLastBytesRead(); - BOOL eof(); + bool eof(); - BOOL write(const U8* buffer, S32 bytes); - BOOL seek(S32 offset, S32 origin = -1); + bool write(const U8* buffer, S32 bytes); + bool seek(S32 offset, S32 origin = -1); S32 tell() const; S32 getSize(); S32 getMaxSize(); - BOOL rename(const LLUUID& new_id, const LLAssetType::EType new_type); - BOOL remove(); + bool rename(const LLUUID& new_id, const LLAssetType::EType new_type); + bool remove(); static bool getExists(const LLUUID& file_id, const LLAssetType::EType file_type); static bool removeFile(const LLUUID& file_id, const LLAssetType::EType file_type, int suppress_error = 0); diff --git a/indra/llfilesystem/lllfsthread.cpp b/indra/llfilesystem/lllfsthread.cpp index 7d135b4472..6a882f64a8 100644 --- a/indra/llfilesystem/lllfsthread.cpp +++ b/indra/llfilesystem/lllfsthread.cpp @@ -45,7 +45,7 @@ void LLLFSThread::initClass(bool local_is_threaded) //static S32 LLLFSThread::updateClass(U32 ms_elapsed) { - return sLocal->update((F32)ms_elapsed); + return static_cast<S32>(sLocal->update((F32)ms_elapsed)); } //static diff --git a/indra/llfilesystem/lllfsthread.h b/indra/llfilesystem/lllfsthread.h index 3230c0c2ae..c0ed1931bb 100644 --- a/indra/llfilesystem/lllfsthread.h +++ b/indra/llfilesystem/lllfsthread.h @@ -114,7 +114,7 @@ public: //------------------------------------------------------------------------ public: - LLLFSThread(bool threaded = TRUE); + LLLFSThread(bool threaded = true); ~LLLFSThread(); // Return a Request handle @@ -126,7 +126,7 @@ public: Responder* responder); // static initializers - static void initClass(bool local_is_threaded = TRUE); // Setup sLocal + static void initClass(bool local_is_threaded = true); // Setup sLocal static S32 updateClass(U32 ms_elapsed); static void cleanupClass(); // Delete sLocal diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index da5b531857..ca8a4199e8 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -774,7 +774,7 @@ U8* LLImageBase::getData() bool LLImageBase::isBufferInvalid() const { - return mBadBufferAllocation || mData == NULL ; + return mBadBufferAllocation || mData == NULL; } void LLImageBase::setSize(S32 width, S32 height, S32 ncomponents) @@ -850,6 +850,8 @@ LLImageRaw::~LLImageRaw() // virtual U8* LLImageRaw::allocateData(S32 size) { + LLImageDataLock lock(this); + U8* res = LLImageBase::allocateData(size); return res; } @@ -857,12 +859,16 @@ U8* LLImageRaw::allocateData(S32 size) // virtual U8* LLImageRaw::reallocateData(S32 size) { + LLImageDataLock lock(this); + U8* res = LLImageBase::reallocateData(size); return res; } void LLImageRaw::releaseData() { + LLImageDataLock lock(this); + LLImageBase::setSize(0, 0, 0); LLImageBase::setDataAndSize(nullptr, 0); } @@ -870,11 +876,15 @@ void LLImageRaw::releaseData() // virtual void LLImageRaw::deleteData() { + LLImageDataLock lock(this); + LLImageBase::deleteData(); } void LLImageRaw::setDataAndSize(U8 *data, S32 width, S32 height, S8 components) { + LLImageDataLock lock(this); + if(data == getData()) { return ; @@ -888,6 +898,8 @@ void LLImageRaw::setDataAndSize(U8 *data, S32 width, S32 height, S8 components) bool LLImageRaw::resize(U16 width, U16 height, S8 components) { + LLImageDataLock lock(this); + if ((getWidth() == width) && (getHeight() == height) && (getComponents() == components) && !isBufferInvalid()) { return true; @@ -903,6 +915,8 @@ bool LLImageRaw::resize(U16 width, U16 height, S8 components) bool LLImageRaw::setSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height, const U8 *data, U32 stride, bool reverse_y) { + LLImageDataLock lock(this); + if (!getData()) { return false; @@ -930,6 +944,9 @@ bool LLImageRaw::setSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height, void LLImageRaw::clear(U8 r, U8 g, U8 b, U8 a) { llassert( getComponents() <= 4 ); + + LLImageDataLock lock(this); + // This is fairly bogus, but it'll do for now. if (isBufferInvalid()) { @@ -970,6 +987,8 @@ void LLImageRaw::clear(U8 r, U8 g, U8 b, U8 a) // Reverses the order of the rows in the image void LLImageRaw::verticalFlip() { + LLImageDataLock lock(this); + S32 row_bytes = getWidth() * getComponents(); llassert(row_bytes > 0); std::vector<U8> line_buffer(row_bytes); @@ -1009,6 +1028,8 @@ bool LLImageRaw::checkHasTransparentPixels() bool LLImageRaw::optimizeAwayAlpha() { + LLImageDataLock lock(this); + if (getComponents() == 4) { U8* data = getData(); @@ -1074,6 +1095,8 @@ bool LLImageRaw::makeAlpha() void LLImageRaw::expandToPowerOfTwo(S32 max_dim, bool scale_image) { + LLImageDataLock lock(this); + // Find new sizes S32 new_width = expandDimToPowerOfTwo(getWidth(), max_dim); S32 new_height = expandDimToPowerOfTwo(getHeight(), max_dim); @@ -1083,6 +1106,8 @@ void LLImageRaw::expandToPowerOfTwo(S32 max_dim, bool scale_image) void LLImageRaw::contractToPowerOfTwo(S32 max_dim, bool scale_image) { + LLImageDataLock lock(this); + // Find new sizes S32 new_width = contractDimToPowerOfTwo(getWidth(), MIN_IMAGE_SIZE); S32 new_height = contractDimToPowerOfTwo(getHeight(), MIN_IMAGE_SIZE); @@ -1132,6 +1157,8 @@ S32 LLImageRaw::contractDimToPowerOfTwo(S32 curr_dim, S32 min_dim) void LLImageRaw::biasedScaleToPowerOfTwo(S32 max_dim) { + LLImageDataLock lock(this); + // Find new sizes S32 new_width = biasedDimToPowerOfTwo(getWidth(),max_dim); S32 new_height = biasedDimToPowerOfTwo(getHeight(),max_dim); @@ -1139,6 +1166,7 @@ void LLImageRaw::biasedScaleToPowerOfTwo(S32 max_dim) scale( new_width, new_height ); } +// static // Calculates (U8)(255*(a/255.f)*(b/255.f) + 0.5f). Thanks, Jim Blinn! inline U8 LLImageRaw::fastFractionalMult( U8 a, U8 b ) { @@ -1147,10 +1175,13 @@ inline U8 LLImageRaw::fastFractionalMult( U8 a, U8 b ) } -void LLImageRaw::composite( LLImageRaw* src ) +void LLImageRaw::composite( const LLImageRaw* src ) { LLImageRaw* dst = this; // Just for clarity. + LLImageDataSharedLock lockIn(src); + LLImageDataLock lockOut(this); + if (!validateSrcAndDst("LLImageRaw::composite", src, dst)) { return; @@ -1189,12 +1220,14 @@ void LLImageRaw::composite( LLImageRaw* src ) // Src and dst can be any size. Src has 4 components. Dst has 3 components. -void LLImageRaw::compositeScaled4onto3(LLImageRaw* src) +void LLImageRaw::compositeScaled4onto3(const LLImageRaw* src) { LL_INFOS() << "compositeScaled4onto3" << LL_ENDL; LLImageRaw* dst = this; // Just for clarity. + LLImageDataLock lock(this); + llassert( (4 == src->getComponents()) && (3 == dst->getComponents()) ); S32 temp_data_size = src->getWidth() * dst->getHeight() * src->getComponents(); @@ -1216,14 +1249,16 @@ void LLImageRaw::compositeScaled4onto3(LLImageRaw* src) // Src and dst are same size. Src has 4 components. Dst has 3 components. -void LLImageRaw::compositeUnscaled4onto3( LLImageRaw* src ) +void LLImageRaw::compositeUnscaled4onto3( const LLImageRaw* src ) { LLImageRaw* dst = this; // Just for clarity. + LLImageDataLock lock(this); + llassert( (3 == src->getComponents()) || (4 == src->getComponents()) ); llassert( (src->getWidth() == dst->getWidth()) && (src->getHeight() == dst->getHeight()) ); - U8* src_data = src->getData(); + const U8* src_data = src->getData(); U8* dst_data = dst->getData(); S32 pixels = getWidth() * getHeight(); while( pixels-- ) @@ -1253,10 +1288,13 @@ void LLImageRaw::compositeUnscaled4onto3( LLImageRaw* src ) } -void LLImageRaw::copyUnscaledAlphaMask( LLImageRaw* src, const LLColor4U& fill) +void LLImageRaw::copyUnscaledAlphaMask( const LLImageRaw* src, const LLColor4U& fill) { LLImageRaw* dst = this; // Just for clarity. + LLImageDataSharedLock lockIn(src); + LLImageDataLock lockOut(this); + if (!validateSrcAndDst("LLImageRaw::copyUnscaledAlphaMask", src, dst)) { return; @@ -1267,7 +1305,7 @@ void LLImageRaw::copyUnscaledAlphaMask( LLImageRaw* src, const LLColor4U& fill) llassert( (src->getWidth() == dst->getWidth()) && (src->getHeight() == dst->getHeight()) ); S32 pixels = getWidth() * getHeight(); - U8* src_data = src->getData(); + const U8* src_data = src->getData(); U8* dst_data = dst->getData(); for ( S32 i = 0; i < pixels; i++ ) { @@ -1284,6 +1322,8 @@ void LLImageRaw::copyUnscaledAlphaMask( LLImageRaw* src, const LLColor4U& fill) // Fill the buffer with a constant color void LLImageRaw::fill( const LLColor4U& color ) { + LLImageDataLock lock(this); + if (isBufferInvalid()) { LL_WARNS() << "Invalid image buffer" << LL_ENDL; @@ -1345,16 +1385,21 @@ LLPointer<LLImageRaw> LLImageRaw::duplicate() return this; //nobody else refences to this image, no need to duplicate. } + LLImageDataSharedLock lock(this); + //make a duplicate LLPointer<LLImageRaw> dup = new LLImageRaw(getData(), getWidth(), getHeight(), getComponents()); return dup; } // Src and dst can be any size. Src and dst can each have 3 or 4 components. -void LLImageRaw::copy(LLImageRaw* src) +void LLImageRaw::copy(const LLImageRaw* src) { LLImageRaw* dst = this; // Just for clarity. + LLImageDataSharedLock lockIn(src); + LLImageDataLock lockOut(this); + if (!validateSrcAndDst("LLImageRaw::copy", src, dst)) { return; @@ -1400,10 +1445,12 @@ void LLImageRaw::copy(LLImageRaw* src) } // Src and dst are same size. Src and dst have same number of components. -void LLImageRaw::copyUnscaled(LLImageRaw* src) +void LLImageRaw::copyUnscaled(const LLImageRaw* src) { LLImageRaw* dst = this; // Just for clarity. + LLImageDataLock lock(this); + llassert( (1 == src->getComponents()) || (3 == src->getComponents()) || (4 == src->getComponents()) ); llassert( src->getComponents() == dst->getComponents() ); llassert( (src->getWidth() == dst->getWidth()) && (src->getHeight() == dst->getHeight()) ); @@ -1413,7 +1460,7 @@ void LLImageRaw::copyUnscaled(LLImageRaw* src) // Src and dst can be any size. Src has 3 components. Dst has 4 components. -void LLImageRaw::copyScaled3onto4(LLImageRaw* src) +void LLImageRaw::copyScaled3onto4(const LLImageRaw* src) { llassert( (3 == src->getComponents()) && (4 == getComponents()) ); @@ -1425,7 +1472,7 @@ void LLImageRaw::copyScaled3onto4(LLImageRaw* src) // Src and dst can be any size. Src has 4 components. Dst has 3 components. -void LLImageRaw::copyScaled4onto3(LLImageRaw* src) +void LLImageRaw::copyScaled4onto3(const LLImageRaw* src) { llassert( (4 == src->getComponents()) && (3 == getComponents()) ); @@ -1437,15 +1484,17 @@ void LLImageRaw::copyScaled4onto3(LLImageRaw* src) // Src and dst are same size. Src has 4 components. Dst has 3 components. -void LLImageRaw::copyUnscaled4onto3( LLImageRaw* src ) +void LLImageRaw::copyUnscaled4onto3( const LLImageRaw* src ) { LLImageRaw* dst = this; // Just for clarity. + LLImageDataLock lock(this); + llassert( (3 == dst->getComponents()) && (4 == src->getComponents()) ); llassert( (src->getWidth() == dst->getWidth()) && (src->getHeight() == dst->getHeight()) ); S32 pixels = getWidth() * getHeight(); - U8* src_data = src->getData(); + const U8* src_data = src->getData(); U8* dst_data = dst->getData(); for( S32 i=0; i<pixels; i++ ) { @@ -1459,15 +1508,18 @@ void LLImageRaw::copyUnscaled4onto3( LLImageRaw* src ) // Src and dst are same size. Src has 3 components. Dst has 4 components. -void LLImageRaw::copyUnscaled3onto4( LLImageRaw* src ) +void LLImageRaw::copyUnscaled3onto4( const LLImageRaw* src ) { LLImageRaw* dst = this; // Just for clarity. + + LLImageDataLock lock(this); + llassert( 3 == src->getComponents() ); llassert( 4 == dst->getComponents() ); llassert( (src->getWidth() == dst->getWidth()) && (src->getHeight() == dst->getHeight()) ); S32 pixels = getWidth() * getHeight(); - U8* src_data = src->getData(); + const U8* src_data = src->getData(); U8* dst_data = dst->getData(); for( S32 i=0; i<pixels; i++ ) { @@ -1482,10 +1534,13 @@ void LLImageRaw::copyUnscaled3onto4( LLImageRaw* src ) // Src and dst can be any size. Src and dst have same number of components. -void LLImageRaw::copyScaled( LLImageRaw* src ) +void LLImageRaw::copyScaled( const LLImageRaw* src ) { LLImageRaw* dst = this; // Just for clarity. + LLImageDataSharedLock lockIn(src); + LLImageDataLock lockOut(this); + if (!validateSrcAndDst("LLImageRaw::copyScaled", src, dst)) { return; @@ -1527,6 +1582,8 @@ void LLImageRaw::copyScaled( LLImageRaw* src ) bool LLImageRaw::scale( S32 new_width, S32 new_height, bool scale_image_data ) { + LLImageDataLock lock(this); + S32 components = getComponents(); if (components != 1 && components != 3 && components != 4) { @@ -1613,6 +1670,8 @@ LLPointer<LLImageRaw> LLImageRaw::scaled(S32 new_width, S32 new_height) { LLPointer<LLImageRaw> result; + LLImageDataLock lock(this); + S32 components = getComponents(); if (components != 1 && components != 3 && components != 4) { @@ -1658,7 +1717,7 @@ LLPointer<LLImageRaw> LLImageRaw::scaled(S32 new_width, S32 new_height) return result; } -void LLImageRaw::copyLineScaled( U8* in, U8* out, S32 in_pixel_len, S32 out_pixel_len, S32 in_pixel_step, S32 out_pixel_step ) +void LLImageRaw::copyLineScaled( const U8* in, U8* out, S32 in_pixel_len, S32 out_pixel_len, S32 in_pixel_step, S32 out_pixel_step ) { const S32 components = getComponents(); llassert( components >= 1 && components <= 4 ); @@ -1685,7 +1744,7 @@ void LLImageRaw::copyLineScaled( U8* in, U8* out, S32 in_pixel_len, S32 out_pixe S32 t0 = x * out_pixel_step * components; S32 t1 = index0 * in_pixel_step * components; U8* outp = out + t0; - U8* inp = in + t1; + const U8* inp = in + t1; for (S32 i = 0; i < components; ++i) { *outp = *inp; @@ -1773,7 +1832,7 @@ void LLImageRaw::copyLineScaled( U8* in, U8* out, S32 in_pixel_len, S32 out_pixe } } -void LLImageRaw::compositeRowScaled4onto3( U8* in, U8* out, S32 in_pixel_len, S32 out_pixel_len ) +void LLImageRaw::compositeRowScaled4onto3( const U8* in, U8* out, S32 in_pixel_len, S32 out_pixel_len ) { llassert( getComponents() == 3 ); @@ -1869,7 +1928,6 @@ void LLImageRaw::compositeRowScaled4onto3( U8* in, U8* out, S32 in_pixel_len, S3 } } - void LLImageRaw::addEmissive(LLImageRaw* src) { LLImageRaw* dst = this; // Just for clarity. @@ -1935,9 +1993,11 @@ void LLImageRaw::addEmissiveScaled(LLImageRaw* src) dst->addEmissiveUnscaled(&temp); } - -bool LLImageRaw::validateSrcAndDst(std::string func, LLImageRaw* src, LLImageRaw* dst) +bool LLImageRaw::validateSrcAndDst(std::string func, const LLImageRaw* src, const LLImageRaw* dst) { + LLImageDataSharedLock lockIn(src); + LLImageDataLock lockOut(dst); + if (!src || !dst || src->isBufferInvalid() || dst->isBufferInvalid()) { LL_WARNS() << func << ": Source: "; @@ -2171,6 +2231,61 @@ LLImageFormatted* LLImageFormatted::createFromType(S8 codec) } // static +S8 LLImageFormatted::getCodecFromMimeType(std::string_view mimetype) +{ + if (mimetype == "image/bmp") + { + return IMG_CODEC_BMP; + } + else if (mimetype == "image/tga") + { + return IMG_CODEC_TGA; + } + else if (mimetype == "image/jpeg") + { + return IMG_CODEC_JPEG; + } + else if (mimetype == "image/png") + { + return IMG_CODEC_PNG; + } + else if (mimetype == "image/j2c") + { + return IMG_CODEC_J2C; + } + else if (mimetype == "image/dxt") + { + return IMG_CODEC_DXT; + } + return IMG_CODEC_INVALID; +} + +// static +LLImageFormatted* LLImageFormatted::createFromMimeType(std::string_view mimetype) +{ + S8 codec = getCodecFromMimeType(mimetype); + return createFromType(codec); +} + +// static +LLImageFormatted* LLImageFormatted::loadFromMemory(const U8* data_in, U32 size, std::string_view mimetype) +{ + LLImageFormatted* image = createFromMimeType(mimetype); + if (image) + { + U8* data = image->allocateData(size); + memcpy(data, data_in, size); + + if (!image->updateData()) + { + delete image; + image = NULL; + } + } + return image; +} + +// static LLImageFormatted* LLImageFormatted::createFromExtension(const std::string& instring) { std::string exten; @@ -2250,6 +2365,8 @@ bool LLImageFormatted::decodeChannels(LLImageRaw* raw_image,F32 decode_time, S3 // virtual U8* LLImageFormatted::allocateData(S32 size) { + LLImageDataLock lock(this); + U8* res = LLImageBase::allocateData(size); // calls deleteData() sGlobalFormattedMemory += getDataSize(); return res; @@ -2258,6 +2375,8 @@ U8* LLImageFormatted::allocateData(S32 size) // virtual U8* LLImageFormatted::reallocateData(S32 size) { + LLImageDataLock lock(this); + sGlobalFormattedMemory -= getDataSize(); U8* res = LLImageBase::reallocateData(size); sGlobalFormattedMemory += getDataSize(); @@ -2267,6 +2386,12 @@ U8* LLImageFormatted::reallocateData(S32 size) // virtual void LLImageFormatted::deleteData() { + LLImageDataLock lock(this); + + if (mDecoding) + { + LL_ERRS() << "LLImageFormatted::deleteData() is called during decoding" << LL_ENDL; + } sGlobalFormattedMemory -= getDataSize(); LLImageBase::deleteData(); } @@ -2292,6 +2417,8 @@ void LLImageFormatted::sanityCheck() bool LLImageFormatted::copyData(U8 *data, S32 size) { + LLImageDataLock lock(this); + if ( data && ((data != getData()) || (size != getDataSize())) ) { deleteData(); @@ -2304,6 +2431,8 @@ bool LLImageFormatted::copyData(U8 *data, S32 size) // LLImageFormatted becomes the owner of data void LLImageFormatted::setData(U8 *data, S32 size) { + LLImageDataLock lock(this); + if (data && data != getData()) { deleteData(); @@ -2317,6 +2446,8 @@ void LLImageFormatted::appendData(U8 *data, S32 size) { if (data) { + LLImageDataLock lock(this); + if (!getData()) { setData(data, size); @@ -2334,6 +2465,7 @@ void LLImageFormatted::appendData(U8 *data, S32 size) //---------------------------------------------------------------------------- + bool LLImageFormatted::load(const std::string &filename, int load_size) { resetLastError(); @@ -2358,6 +2490,9 @@ bool LLImageFormatted::load(const std::string &filename, int load_size) { load_size = file_size; } + + LLImageDataLock lock(this); + bool res; U8 *data = allocateData(load_size); if (data) @@ -2396,6 +2531,8 @@ bool LLImageFormatted::save(const std::string &filename) return false; } + LLImageDataSharedLock lock(this); + S32 result = outfile.write(getData(), getDataSize()); outfile.close() ; return (result != 0); diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h index 9b16711b85..42eecbb97c 100644 --- a/indra/llimage/llimage.h +++ b/indra/llimage/llimage.h @@ -117,6 +117,10 @@ class LLImageBase protected: virtual ~LLImageBase(); + virtual void deleteData(); + virtual U8* allocateData(S32 size = -1); + virtual U8* reallocateData(S32 size = -1); + public: LLImageBase(); @@ -126,10 +130,6 @@ public: TYPE_AVATAR_BAKE = 1, }; - virtual void deleteData(); - virtual U8* allocateData(S32 size = -1); - virtual U8* reallocateData(S32 size = -1); - virtual void dump(); virtual void sanityCheck(); @@ -171,10 +171,27 @@ private: S8 mComponents; - bool mBadBufferAllocation ; - bool mAllowOverSize ; + bool mBadBufferAllocation; + bool mAllowOverSize; + +private: + mutable LLSharedMutex mDataMutex; + +public: + template<bool SHARED> + class DataLock : LLSharedMutexLockTemplate<SHARED> + { + public: + DataLock(const LLImageBase* image) + : LLSharedMutexLockTemplate<SHARED>(image ? &image->mDataMutex : nullptr) + { + } + }; }; +using LLImageDataLock = LLImageBase::DataLock<false>; +using LLImageDataSharedLock = LLImageBase::DataLock<true>; + // Raw representation of an image (used for textures, and other uncompressed formats class LLImageRaw : public LLImageBase { @@ -238,42 +255,30 @@ public: LLPointer<LLImageRaw> duplicate(); // Src and dst can be any size. Src and dst can each have 3 or 4 components. - void copy( LLImageRaw* src ); + void copy( const LLImageRaw* src ); // Src and dst are same size. Src and dst have same number of components. - void copyUnscaled( LLImageRaw* src ); + void copyUnscaled( const LLImageRaw* src ); // Src and dst are same size. Src has 4 components. Dst has 3 components. - void copyUnscaled4onto3( LLImageRaw* src ); + void copyUnscaled4onto3( const LLImageRaw* src ); // Src and dst are same size. Src has 3 components. Dst has 4 components. - void copyUnscaled3onto4( LLImageRaw* src ); + void copyUnscaled3onto4( const LLImageRaw* src ); // Src and dst are same size. Src has 1 component. Dst has 4 components. // Alpha component is set to source alpha mask component. // RGB components are set to fill color. - void copyUnscaledAlphaMask( LLImageRaw* src, const LLColor4U& fill); + void copyUnscaledAlphaMask( const LLImageRaw* src, const LLColor4U& fill); // Src and dst can be any size. Src and dst have same number of components. - void copyScaled( LLImageRaw* src ); - - // Src and dst can be any size. Src has 3 components. Dst has 4 components. - void copyScaled3onto4( LLImageRaw* src ); - - // Src and dst can be any size. Src has 4 components. Dst has 3 components. - void copyScaled4onto3( LLImageRaw* src ); + void copyScaled( const LLImageRaw* src ); // Composite operations // Src and dst can be any size. Src and dst can each have 3 or 4 components. - void composite( LLImageRaw* src ); - - // Src and dst can be any size. Src has 4 components. Dst has 3 components. - void compositeScaled4onto3( LLImageRaw* src ); - - // Src and dst are same size. Src has 4 components. Dst has 3 components. - void compositeUnscaled4onto3( LLImageRaw* src ); + void composite( const LLImageRaw* src ); // Emissive operations used by minimap // Roughly emulates GLTF emissive texture, but is not GLTF-compliant @@ -282,13 +287,25 @@ public: void addEmissiveScaled(LLImageRaw* src); void addEmissiveUnscaled(LLImageRaw* src); protected: + // Src and dst can be any size. Src has 4 components. Dst has 3 components. + void compositeScaled4onto3( const LLImageRaw* src ); + + // Src and dst are same size. Src has 4 components. Dst has 3 components. + void compositeUnscaled4onto3( const LLImageRaw* src ); + + // Src and dst can be any size. Src has 3 components. Dst has 4 components. + void copyScaled3onto4( const LLImageRaw* src ); + + // Src and dst can be any size. Src has 4 components. Dst has 3 components. + void copyScaled4onto3( const LLImageRaw* src ); + // Create an image from a local file (generally used in tools) //bool createFromFile(const std::string& filename, bool j2c_lowest_mip_only = false); - void copyLineScaled( U8* in, U8* out, S32 in_pixel_len, S32 out_pixel_len, S32 in_pixel_step, S32 out_pixel_step ); - void compositeRowScaled4onto3( U8* in, U8* out, S32 in_pixel_len, S32 out_pixel_len ); + void copyLineScaled( const U8* in, U8* out, S32 in_pixel_len, S32 out_pixel_len, S32 in_pixel_step, S32 out_pixel_step ); + void compositeRowScaled4onto3( const U8* in, U8* out, S32 in_pixel_len, S32 out_pixel_len ); - U8 fastFractionalMult(U8 a,U8 b); + static U8 fastFractionalMult(U8 a, U8 b); void setDataAndSize(U8 *data, S32 width, S32 height, S8 components) ; @@ -296,7 +313,7 @@ public: static S32 sRawImageCount; private: - bool validateSrcAndDst(std::string func, LLImageRaw* src, LLImageRaw* dst); + static bool validateSrcAndDst(std::string func, const LLImageRaw* src, const LLImageRaw* dst); }; // Compressed representation of image. @@ -305,7 +322,10 @@ class LLImageFormatted : public LLImageBase { public: static LLImageFormatted* createFromType(S8 codec); + static LLImageFormatted* loadFromMemory(const U8* data, U32 size, std::string_view mimetype); static LLImageFormatted* createFromExtension(const std::string& instring); + static LLImageFormatted* createFromMimeType(std::string_view mimetype); + static S8 getCodecFromMimeType(std::string_view mimetype); protected: /*virtual*/ ~LLImageFormatted(); diff --git a/indra/llimage/llimagebmp.cpp b/indra/llimage/llimagebmp.cpp index 08fcdf39da..2a328675c2 100644 --- a/indra/llimage/llimagebmp.cpp +++ b/indra/llimage/llimagebmp.cpp @@ -96,6 +96,8 @@ bool LLImageBMP::updateData() { resetLastError(); + LLImageDataLock lock(this); + // Check to make sure that this instance has been initialized with data U8* mdata = getData(); if (!mdata || (0 == getDataSize())) @@ -337,8 +339,11 @@ bool LLImageBMP::decode(LLImageRaw* raw_image, F32 decode_time) resetLastError(); + LLImageDataLock lockIn(this); + LLImageDataLock lockOut(raw_image); + // Check to make sure that this instance has been initialized with data - U8* mdata = getData(); + const U8* mdata = getData(); if (!mdata || (0 == getDataSize())) { setLastError("llimagebmp trying to decode an image with no data!"); @@ -351,7 +356,7 @@ bool LLImageBMP::decode(LLImageRaw* raw_image, F32 decode_time) return false; } - U8* src = mdata + mBitmapOffset; + const U8* src = mdata + mBitmapOffset; U8* dst = raw_image->getData(); bool success = false; @@ -398,7 +403,7 @@ U32 LLImageBMP::countTrailingZeros( U32 m ) } -bool LLImageBMP::decodeColorMask16( U8* dst, U8* src ) +bool LLImageBMP::decodeColorMask16( U8* dst, const U8* src ) { llassert( 16 == mBitsPerPixel ); @@ -434,7 +439,7 @@ bool LLImageBMP::decodeColorMask16( U8* dst, U8* src ) return true; } -bool LLImageBMP::decodeColorMask32( U8* dst, U8* src ) +bool LLImageBMP::decodeColorMask32( U8* dst, const U8* src ) { // Note: alpha is not supported @@ -478,7 +483,7 @@ bool LLImageBMP::decodeColorMask32( U8* dst, U8* src ) } -bool LLImageBMP::decodeColorTable8( U8* dst, U8* src ) +bool LLImageBMP::decodeColorTable8( U8* dst, const U8* src ) { llassert( (8 == mBitsPerPixel) && (mColorPaletteColors >= 256) ); @@ -508,7 +513,7 @@ bool LLImageBMP::decodeColorTable8( U8* dst, U8* src ) } -bool LLImageBMP::decodeTruecolor24( U8* dst, U8* src ) +bool LLImageBMP::decodeTruecolor24( U8* dst, const U8* src ) { llassert( 24 == mBitsPerPixel ); llassert( 3 == getComponents() ); @@ -542,6 +547,9 @@ bool LLImageBMP::encode(const LLImageRaw* raw_image, F32 encode_time) resetLastError(); + LLImageDataSharedLock lockIn(raw_image); + LLImageDataLock lockOut(this); + S32 src_components = raw_image->getComponents(); S32 dst_components = ( src_components < 3 ) ? 1 : 3; diff --git a/indra/llimage/llimagebmp.h b/indra/llimage/llimagebmp.h index d2cbad1a49..237c3e8d53 100644 --- a/indra/llimage/llimagebmp.h +++ b/indra/llimage/llimagebmp.h @@ -45,10 +45,10 @@ public: /*virtual*/ bool encode(const LLImageRaw* raw_image, F32 encode_time); protected: - bool decodeColorTable8( U8* dst, U8* src ); - bool decodeColorMask16( U8* dst, U8* src ); - bool decodeTruecolor24( U8* dst, U8* src ); - bool decodeColorMask32( U8* dst, U8* src ); + bool decodeColorTable8( U8* dst, const U8* src ); + bool decodeColorMask16( U8* dst, const U8* src ); + bool decodeTruecolor24( U8* dst, const U8* src ); + bool decodeColorMask32( U8* dst, const U8* src ); U32 countTrailingZeros( U32 m ); diff --git a/indra/llimage/llimagedimensionsinfo.cpp b/indra/llimage/llimagedimensionsinfo.cpp index 997406bb7b..d4efbcfad2 100644 --- a/indra/llimage/llimagedimensionsinfo.cpp +++ b/indra/llimage/llimagedimensionsinfo.cpp @@ -201,7 +201,7 @@ bool LLImageDimensionsInfo::getImageDimensionsJpeg() jpeg_create_decompress (&cinfo); jpeg_stdio_src (&cinfo, fp); - jpeg_read_header (&cinfo, TRUE); + jpeg_read_header (&cinfo, true); cinfo.out_color_space = JCS_RGB; jpeg_start_decompress (&cinfo); diff --git a/indra/llimage/llimagedxt.cpp b/indra/llimage/llimagedxt.cpp index f75b1a72df..6b960f9077 100644 --- a/indra/llimage/llimagedxt.cpp +++ b/indra/llimage/llimagedxt.cpp @@ -176,6 +176,8 @@ bool LLImageDXT::updateData() { resetLastError(); + LLImageDataLock lock(this); + U8* data = getData(); S32 data_size = getDataSize(); @@ -269,6 +271,9 @@ bool LLImageDXT::decode(LLImageRaw* raw_image, F32 time) return false; } + LLImageDataSharedLock lockIn(this); + LLImageDataLock lockOut(raw_image); + S32 width = getWidth(), height = getHeight(); S32 ncomponents = getComponents(); U8* data = NULL; @@ -309,6 +314,9 @@ bool LLImageDXT::getMipData(LLPointer<LLImageRaw>& raw, S32 discard) { LL_ERRS() << "Request for invalid discard level" << LL_ENDL; } + + LLImageDataSharedLock lock(this); + U8* data = getData() + getMipOffset(discard); S32 width = 0; S32 height = 0; @@ -339,6 +347,8 @@ bool LLImageDXT::encodeDXT(const LLImageRaw* raw_image, F32 time, bool explicit_ return 0; } + LLImageDataLock lock(this); + S32 width = raw_image->getWidth(); S32 height = raw_image->getHeight(); @@ -430,6 +440,9 @@ bool LLImageDXT::convertToDXR() return false; } mFileFormat = newformat; + + LLImageDataLock lock(this); + S32 width = getWidth(), height = getHeight(); S32 nmips = calcNumMips(width,height); S32 total_bytes = getDataSize(); @@ -463,7 +476,7 @@ bool LLImageDXT::convertToDXR() // virtual S32 LLImageDXT::calcHeaderSize() { - return llmax(sizeof(dxtfile_header_old_t), sizeof(dxtfile_header_t)); + return static_cast<S32>(llmax(sizeof(dxtfile_header_old_t), sizeof(dxtfile_header_t))); } // virtual diff --git a/indra/llimage/llimagefilter.cpp b/indra/llimage/llimagefilter.cpp index 1b7835a6ff..0d15906afd 100644 --- a/indra/llimage/llimagefilter.cpp +++ b/indra/llimage/llimagefilter.cpp @@ -88,6 +88,8 @@ void LLImageFilter::executeFilter(LLPointer<LLImageRaw> raw_image) { mImage = raw_image; + LLImageDataLock lock(mImage); + //std::cout << "Filter : size = " << mFilterData.size() << std::endl; for (S32 i = 0; i < mFilterData.size(); ++i) { @@ -779,9 +781,9 @@ void LLImageFilter::filterLinearize(F32 tail, const LLColor3& alpha) // Compute min and max counts minus tail tail = llclampf(tail); - S32 total = cumulated_histo[255]; - S32 min_c = (S32)((F32)(total) * tail); - S32 max_c = (S32)((F32)(total) * (1.0 - tail)); + U32 total = cumulated_histo[255]; + U32 min_c = (U32)((F32)(total) * tail); + U32 max_c = (U32)((F32)(total) * (1.0 - tail)); // Find min and max values S32 min_v = 0; @@ -796,9 +798,9 @@ void LLImageFilter::filterLinearize(F32 tail, const LLColor3& alpha) } // Compute linear lookup table - U8 linear_red_lut[256]; - U8 linear_green_lut[256]; - U8 linear_blue_lut[256]; + U8 linear_red_lut[256]{}; + U8 linear_green_lut[256]{}; + U8 linear_blue_lut[256]{}; if (max_v == min_v) { // Degenerated binary split case @@ -848,16 +850,16 @@ void LLImageFilter::filterEqualize(S32 nb_classes, const LLColor3& alpha) } // Compute deltas - S32 total = cumulated_histo[255]; - S32 delta_count = total / nb_classes; - S32 current_count = delta_count; - S32 delta_value = 256 / (nb_classes - 1); - S32 current_value = 0; + U32 total = cumulated_histo[255]; + U32 delta_count = total / nb_classes; + U32 current_count = delta_count; + U32 delta_value = 256 / (nb_classes - 1); + U32 current_value = 0; // Compute equalized lookup table - U8 equalize_red_lut[256]; - U8 equalize_green_lut[256]; - U8 equalize_blue_lut[256]; + U8 equalize_red_lut[256]{}; + U8 equalize_green_lut[256]{}; + U8 equalize_blue_lut[256]{}; for (S32 i = 0; i < 256; i++) { // Blend in current_value with alpha values diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp index 5175849ad8..0058b91b0f 100644 --- a/indra/llimage/llimagej2c.cpp +++ b/indra/llimage/llimagej2c.cpp @@ -107,6 +107,8 @@ bool LLImageJ2C::updateData() bool res = true; resetLastError(); + LLImageDataLock lock(this); + // Check to make sure that this instance has been initialized with data if (!getData() || (getDataSize() < 16)) { @@ -157,22 +159,25 @@ bool LLImageJ2C::decodeChannels(LLImageRaw *raw_imagep, F32 decode_time, S32 fir LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; LLTimer elapsed; - bool res = true; - resetLastError(); - // Check to make sure that this instance has been initialized with data - if (!getData() || (getDataSize() < 16)) + bool res; { - setLastError("LLImageJ2C uninitialized"); - res = true; // done - } - else - { - // Update the raw discard level - updateRawDiscardLevel(); + LLImageDataLock lock(this); + mDecoding = true; - res = mImpl->decodeImpl(*this, *raw_imagep, decode_time, first_channel, max_channel_count); + // Check to make sure that this instance has been initialized with data + if (!getData() || (getDataSize() < 16)) + { + setLastError("LLImageJ2C uninitialized"); + res = true; // done + } + else + { + // Update the raw discard level + updateRawDiscardLevel(); + res = mImpl->decodeImpl(*this, *raw_imagep, decode_time, first_channel, max_channel_count); + } } if (res) @@ -181,12 +186,21 @@ bool LLImageJ2C::decodeChannels(LLImageRaw *raw_imagep, F32 decode_time, S32 fir { // Failed raw_imagep->deleteData(); + res = false; } else { mDecoding = false; } } + else + { + if (mDecoding) + { + LL_WARNS() << "decodeImpl failed but mDecoding is true" << LL_ENDL; + mDecoding = false; + } + } if (!mLastError.empty()) { @@ -406,9 +420,10 @@ bool LLImageJ2C::loadAndValidate(const std::string &filename) bool LLImageJ2C::validate(U8 *data, U32 file_size) { - resetLastError(); + LLImageDataLock lock(this); + setData(data, file_size); bool res = updateData(); diff --git a/indra/llimage/llimagejpeg.cpp b/indra/llimage/llimagejpeg.cpp index 93f1d0cdc4..0e7ec365d4 100644 --- a/indra/llimage/llimagejpeg.cpp +++ b/indra/llimage/llimagejpeg.cpp @@ -50,6 +50,8 @@ bool LLImageJPEG::updateData() { resetLastError(); + LLImageDataLock lock(this); + // Check to make sure that this instance has been initialized with data if (!getData() || (0 == getDataSize())) { @@ -189,6 +191,9 @@ bool LLImageJPEG::decode(LLImageRaw* raw_image, F32 decode_time) resetLastError(); + LLImageDataLock lockIn(this); + LLImageDataLock lockOut(raw_image); + // Check to make sure that this instance has been initialized with data if (!getData() || (0 == getDataSize())) { @@ -408,6 +413,8 @@ void LLImageJPEG::encodeTermDestination( j_compress_ptr cinfo ) { LLImageJPEG* self = (LLImageJPEG*) cinfo->client_data; + LLImageDataLock lock(self); + S32 file_bytes = (S32)(self->mOutputBufferSize - cinfo->dest->free_in_buffer); self->allocateData(file_bytes); @@ -484,6 +491,9 @@ bool LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time ) resetLastError(); + LLImageDataSharedLock lockIn(raw_image); + LLImageDataLock lockOut(this); + switch( raw_image->getComponents() ) { case 1: diff --git a/indra/llimage/llimagejpeg.h b/indra/llimage/llimagejpeg.h index 12249ad8c3..add6657117 100644 --- a/indra/llimage/llimagejpeg.h +++ b/indra/llimage/llimagejpeg.h @@ -73,8 +73,6 @@ public: static void errorEmitMessage(j_common_ptr cinfo, int msg_level); static void errorOutputMessage(j_common_ptr cinfo); - static bool decompress(LLImageJPEG* imagep); - protected: U8* mOutputBuffer; // temp buffer used during encoding S32 mOutputBufferSize; // bytes in mOuputBuffer diff --git a/indra/llimage/llimagepng.cpp b/indra/llimage/llimagepng.cpp index 4d081ce169..d75084cf08 100644 --- a/indra/llimage/llimagepng.cpp +++ b/indra/llimage/llimagepng.cpp @@ -54,6 +54,8 @@ bool LLImagePNG::updateData() try { + LLImageDataLock lock(this); + // Check to make sure that this instance has been initialized with data if (!getData() || (0 == getDataSize())) { @@ -103,6 +105,9 @@ bool LLImagePNG::decode(LLImageRaw* raw_image, F32 decode_time) resetLastError(); + LLImageDataSharedLock lockIn(this); + LLImageDataLock lockOut(raw_image); + // Check to make sure that this instance has been initialized with data if (!getData() || (0 == getDataSize())) { @@ -135,6 +140,9 @@ bool LLImagePNG::encode(const LLImageRaw* raw_image, F32 encode_time) resetLastError(); + LLImageDataSharedLock lockIn(raw_image); + LLImageDataLock lockOut(this); + // Image logical size setSize(raw_image->getWidth(), raw_image->getHeight(), raw_image->getComponents()); diff --git a/indra/llimage/llimagetga.cpp b/indra/llimage/llimagetga.cpp index adc98cd81d..25232b77aa 100644 --- a/indra/llimage/llimagetga.cpp +++ b/indra/llimage/llimagetga.cpp @@ -108,6 +108,8 @@ bool LLImageTGA::updateData() { resetLastError(); + LLImageDataLock lock(this); + // Check to make sure that this instance has been initialized with data if (!getData() || (0 == getDataSize())) { @@ -328,6 +330,9 @@ bool LLImageTGA::decode(LLImageRaw* raw_image, F32 decode_time) { llassert_always(raw_image); + LLImageDataSharedLock lockIn(this); + LLImageDataLock lockOut(raw_image); + // Check to make sure that this instance has been initialized with data if (!getData() || (0 == getDataSize())) { @@ -462,7 +467,7 @@ bool LLImageTGA::decodeTruecolorNonRle( LLImageRaw* raw_image, bool &alpha_opaqu S32 pixels = getWidth() * getHeight(); - if (pixels * (mIs15Bit ? 2 : getComponents()) > getDataSize() - mDataOffset) + if (pixels * (mIs15Bit ? 2 : getComponents()) > getDataSize() - (S32)mDataOffset) { //here we have situation when data size in src less than actually needed return false; } @@ -644,6 +649,9 @@ bool LLImageTGA::encode(const LLImageRaw* raw_image, F32 encode_time) { llassert_always(raw_image); + LLImageDataSharedLock lockIn(raw_image); + LLImageDataLock lockOut(this); + deleteData(); setSize(raw_image->getWidth(), raw_image->getHeight(), raw_image->getComponents()); @@ -1062,6 +1070,9 @@ bool LLImageTGA::decodeAndProcess( LLImageRaw* raw_image, F32 domain, F32 weight // --+---Input-------------------------------- // | + LLImageDataSharedLock lockIn(this); + LLImageDataLock lockOut(raw_image); + if (!getData() || (0 == getDataSize())) { setLastError("LLImageTGA trying to decode an image with no data!"); @@ -1168,7 +1179,7 @@ bool LLImageTGA::decodeAndProcess( LLImageRaw* raw_image, F32 domain, F32 weight // Reads a .tga file and creates an LLImageTGA with its data. bool LLImageTGA::loadFile( const std::string& path ) { - S32 len = path.size(); + auto len = path.size(); if( len < 5 ) { return false; @@ -1195,7 +1206,7 @@ bool LLImageTGA::loadFile( const std::string& path ) } U8* buffer = allocateData(file_size); - S32 bytes_read = fread(buffer, 1, file_size, file); + S32 bytes_read = static_cast<S32>(fread(buffer, 1, file_size, file)); if( bytes_read != file_size ) { deleteData(); diff --git a/indra/llimage/llimageworker.cpp b/indra/llimage/llimageworker.cpp index 8ce17b5753..bdaef0c653 100644 --- a/indra/llimage/llimageworker.cpp +++ b/indra/llimage/llimageworker.cpp @@ -36,7 +36,7 @@ class ImageRequest public: ImageRequest(const LLPointer<LLImageFormatted>& image, S32 discard, - BOOL needs_aux, + bool needs_aux, const LLPointer<LLImageDecodeThread::Responder>& responder, U32 request_id); virtual ~ImageRequest(); @@ -51,15 +51,14 @@ private: LLPointer<LLImageFormatted> mFormattedImage; S32 mDiscardLevel; U32 mRequestId; - BOOL mNeedsAux; + bool mNeedsAux; // output LLPointer<LLImageRaw> mDecodedImageRaw; LLPointer<LLImageRaw> mDecodedImageAux; - BOOL mDecodedRaw; - BOOL mDecodedAux; + bool mDecodedRaw; + bool mDecodedAux; LLPointer<LLImageDecodeThread::Responder> mResponder; - std::string mErrorString; -}; + std::string mErrorString;}; //---------------------------------------------------------------------------- @@ -92,12 +91,15 @@ size_t LLImageDecodeThread::getPending() LLImageDecodeThread::handle_t LLImageDecodeThread::decodeImage( const LLPointer<LLImageFormatted>& image, S32 discard, - BOOL needs_aux, + bool needs_aux, const LLPointer<LLImageDecodeThread::Responder>& responder) { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; U32 decode_id = ++mDecodeCount; + if (decode_id == 0) + decode_id = ++mDecodeCount; + // Instantiate the ImageRequest right in the lambda, why not? bool posted = mThreadPool->getQueue().post( [req = ImageRequest(image, discard, needs_aux, responder, decode_id)] @@ -128,14 +130,14 @@ LLImageDecodeThread::Responder::~Responder() ImageRequest::ImageRequest(const LLPointer<LLImageFormatted>& image, S32 discard, - BOOL needs_aux, + bool needs_aux, const LLPointer<LLImageDecodeThread::Responder>& responder, U32 request_id) : mFormattedImage(image), mDiscardLevel(discard), mNeedsAux(needs_aux), - mDecodedRaw(FALSE), - mDecodedAux(FALSE), + mDecodedRaw(false), + mDecodedAux(false), mResponder(responder), mRequestId(request_id) { @@ -155,10 +157,18 @@ ImageRequest::~ImageRequest() bool ImageRequest::processRequest() { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; + + if (mFormattedImage.isNull()) + return true; + const F32 decode_time_slice = 0.f; //disable time slicing bool done = true; - mErrorString.clear(); - if (!mDecodedRaw && mFormattedImage.notNull()) + + LLImageDataLock lockFormatted(mFormattedImage); + LLImageDataLock lockDecodedRaw(mDecodedImageRaw); + LLImageDataLock lockDecodedAux(mDecodedImageAux); + + if (!mDecodedRaw) { // Decode primary channels if (mDecodedImageRaw.isNull()) @@ -166,13 +176,10 @@ bool ImageRequest::processRequest() // parse formatted header if (!mFormattedImage->updateData()) { - // Pick up errors from updateData - mErrorString = LLImage::getLastThreadError(); return true; // done (failed) } - if (0 == (mFormattedImage->getWidth() * mFormattedImage->getHeight() * mFormattedImage->getComponents())) + if ((mFormattedImage->getWidth() * mFormattedImage->getHeight() * mFormattedImage->getComponents()) == 0) { - mErrorString = "Invalid image size"; return true; // done (failed) } if (mDiscardLevel >= 0) diff --git a/indra/llimage/llimageworker.h b/indra/llimage/llimageworker.h index 8c43a7c32c..9e01f0bacd 100644 --- a/indra/llimage/llimageworker.h +++ b/indra/llimage/llimageworker.h @@ -49,7 +49,7 @@ public: // meant to resemble LLQueuedThread::handle_t typedef U32 handle_t; handle_t decodeImage(const LLPointer<LLImageFormatted>& image, - S32 discard, BOOL needs_aux, + S32 discard, bool needs_aux, const LLPointer<Responder>& responder); size_t getPending(); size_t update(F32 max_time_ms); diff --git a/indra/llimage/llpngwrapper.cpp b/indra/llimage/llpngwrapper.cpp index 24b6d34fe2..79c201b1f4 100644 --- a/indra/llimage/llpngwrapper.cpp +++ b/indra/llimage/llpngwrapper.cpp @@ -70,7 +70,7 @@ LLPngWrapper::~LLPngWrapper() } // Checks the src for a valid PNG header -BOOL LLPngWrapper::isValidPng(U8* src) +bool LLPngWrapper::isValidPng(U8* src) { const int PNG_BYTES_TO_CHECK = 8; @@ -78,10 +78,10 @@ BOOL LLPngWrapper::isValidPng(U8* src) if (sig != 0) { mErrorMessage = "Invalid or corrupt PNG file"; - return FALSE; + return false; } - return TRUE; + return true; } // Called by the libpng library when a fatal encoding or decoding error @@ -134,7 +134,7 @@ void LLPngWrapper::writeFlush(png_structp png_ptr) // The scanline also begins at the bottom of // the image (per SecondLife conventions) instead of at the top, so we // must assign row-pointers in "reverse" order. -BOOL LLPngWrapper::readPng(U8* src, S32 dataSize, LLImageRaw* rawImage, ImageInfo *infop) +bool LLPngWrapper::readPng(U8* src, S32 dataSize, LLImageRaw* rawImage, ImageInfo *infop) { try { @@ -173,6 +173,8 @@ BOOL LLPngWrapper::readPng(U8* src, S32 dataSize, LLImageRaw* rawImage, ImageInf // data space if (rawImage != NULL) { + LLImageDataLock lock(rawImage); + if (!rawImage->resize(static_cast<U16>(mWidth), static_cast<U16>(mHeight), mChannels)) { @@ -208,25 +210,25 @@ BOOL LLPngWrapper::readPng(U8* src, S32 dataSize, LLImageRaw* rawImage, ImageInf { mErrorMessage = msg.what(); releaseResources(); - return (FALSE); + return (false); } catch (std::bad_alloc&) { mErrorMessage = "LLPngWrapper"; releaseResources(); - return (FALSE); + return (false); } catch (...) { mErrorMessage = "LLPngWrapper"; releaseResources(); LOG_UNHANDLED_EXCEPTION(""); - return (FALSE); + return (false); } // Clean up and return releaseResources(); - return (TRUE); + return (true); } // Do transformations to normalize the input to 8-bpp RGBA @@ -288,7 +290,7 @@ void LLPngWrapper::updateMetaData() // Method to write raw image into PNG at dest. The raw scanline begins // at the bottom of the image per SecondLife conventions. -BOOL LLPngWrapper::writePng(const LLImageRaw* rawImage, U8* dest, size_t destSize) +bool LLPngWrapper::writePng(const LLImageRaw* rawImage, U8* dest, size_t destSize) { try { @@ -326,10 +328,10 @@ BOOL LLPngWrapper::writePng(const LLImageRaw* rawImage, U8* dest, size_t destSiz mWriteInfoPtr = png_create_info_struct(mWritePngPtr); // Setup write function - PngDataInfo dataPtr; + PngDataInfo dataPtr{}; dataPtr.mData = dest; dataPtr.mOffset = 0; - dataPtr.mDataSize = destSize; + dataPtr.mDataSize = static_cast<S32>(destSize); png_set_write_fn(mWritePngPtr, &dataPtr, &writeDataCallback, &writeFlush); // Setup image params @@ -369,11 +371,11 @@ BOOL LLPngWrapper::writePng(const LLImageRaw* rawImage, U8* dest, size_t destSiz { mErrorMessage = msg.what(); releaseResources(); - return (FALSE); + return (false); } releaseResources(); - return TRUE; + return true; } // Cleanup various internal structures diff --git a/indra/llimage/llpngwrapper.h b/indra/llimage/llpngwrapper.h index f3c3d57f70..3ada8ac7c2 100644 --- a/indra/llimage/llpngwrapper.h +++ b/indra/llimage/llpngwrapper.h @@ -43,9 +43,9 @@ public: S8 mComponents; }; - BOOL isValidPng(U8* src); - BOOL readPng(U8* src, S32 dataSize, LLImageRaw* rawImage, ImageInfo *infop = NULL); - BOOL writePng(const LLImageRaw* rawImage, U8* dst, size_t destSize); + bool isValidPng(U8* src); + bool readPng(U8* src, S32 dataSize, LLImageRaw* rawImage, ImageInfo *infop = NULL); + bool writePng(const LLImageRaw* rawImage, U8* dst, size_t destSize); U32 getFinalSize(); const std::string& getErrorMessage(); diff --git a/indra/llimage/tests/llimageworker_test.cpp b/indra/llimage/tests/llimageworker_test.cpp index 2568adf89e..36be885912 100644 --- a/indra/llimage/tests/llimageworker_test.cpp +++ b/indra/llimage/tests/llimageworker_test.cpp @@ -151,7 +151,7 @@ namespace tut ensure("LLImageDecodeThread: threaded constructor failed", mThread != NULL); // Insert something in the queue bool done = false; - LLImageDecodeThread::handle_t decodeHandle = mThread->decodeImage(NULL, 0, FALSE, new responder_test(&done)); + LLImageDecodeThread::handle_t decodeHandle = mThread->decodeImage(NULL, 0, false, new responder_test(&done)); // Verifies we get back a valid handle ensure("LLImageDecodeThread: threaded decodeImage(), returned handle is null", decodeHandle != 0); // Wait till the thread has time to handle the work order (though it doesn't do much per work order...) diff --git a/indra/llimagej2coj/llimagej2coj.cpp b/indra/llimagej2coj/llimagej2coj.cpp index b5f1df5507..969bf68b6d 100644 --- a/indra/llimagej2coj/llimagej2coj.cpp +++ b/indra/llimagej2coj/llimagej2coj.cpp @@ -178,7 +178,7 @@ static OPJ_OFF_T opj_skip(OPJ_OFF_T bytes, void* user_data) JPEG2KBase* jpeg_codec = static_cast<JPEG2KBase*>(user_data); jpeg_codec->offset += bytes; - if (jpeg_codec->offset > jpeg_codec->size) + if (jpeg_codec->offset > (OPJ_OFF_T)jpeg_codec->size) { jpeg_codec->offset = jpeg_codec->size; // Indicate end of stream @@ -495,6 +495,9 @@ public: bool encode(const LLImageRaw& rawImageIn, LLImageJ2C &compressedImageOut) { + LLImageDataSharedLock lockIn(&rawImageIn); + LLImageDataLock lockOut(&compressedImageOut); + setImage(rawImageIn); encoder = opj_create_compress(OPJ_CODEC_J2K); @@ -738,6 +741,9 @@ bool LLImageJ2COJ::initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int block bool LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count) { + LLImageDataLock lockIn(&base); + LLImageDataLock lockOut(&raw_image); + JPEG2KDecode decoder(0); U32 image_channels = 0; @@ -792,7 +798,7 @@ bool LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod S32 offset = dest; for (S32 y = (height - 1); y >= 0; y--) { - for (S32 x = 0; x < width; x++) + for (U32 x = 0; x < width; x++) { rawp[offset] = image->comps[comp].data[y*comp_width + x]; offset += channels; @@ -825,6 +831,8 @@ bool LLImageJ2COJ::encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, con bool LLImageJ2COJ::getMetadata(LLImageJ2C &base) { + LLImageDataLock lock(&base); + JPEG2KDecode decode(0); S32 width = 0; diff --git a/indra/llinventory/llfoldertype.cpp b/indra/llinventory/llfoldertype.cpp index 8f968ae2fd..7e1be17ecc 100644 --- a/indra/llinventory/llfoldertype.cpp +++ b/indra/llinventory/llfoldertype.cpp @@ -84,47 +84,47 @@ protected: LLFolderDictionary::LLFolderDictionary() { // TYPE NAME, PROTECTED, AUTOMATIC, SINGLETON - addEntry(LLFolderType::FT_TEXTURE, new FolderEntry("texture", TRUE, TRUE, TRUE)); - addEntry(LLFolderType::FT_SOUND, new FolderEntry("sound", TRUE, TRUE, TRUE)); - addEntry(LLFolderType::FT_CALLINGCARD, new FolderEntry("callcard", TRUE, TRUE, FALSE)); - addEntry(LLFolderType::FT_LANDMARK, new FolderEntry("landmark", TRUE, FALSE, FALSE)); - addEntry(LLFolderType::FT_CLOTHING, new FolderEntry("clothing", TRUE, TRUE, TRUE)); - addEntry(LLFolderType::FT_OBJECT, new FolderEntry("object", TRUE, TRUE, TRUE)); - addEntry(LLFolderType::FT_NOTECARD, new FolderEntry("notecard", TRUE, TRUE, TRUE)); - addEntry(LLFolderType::FT_ROOT_INVENTORY, new FolderEntry("root_inv", TRUE, TRUE, TRUE)); - addEntry(LLFolderType::FT_LSL_TEXT, new FolderEntry("lsltext", TRUE, TRUE, TRUE)); - addEntry(LLFolderType::FT_BODYPART, new FolderEntry("bodypart", TRUE, TRUE, TRUE)); - addEntry(LLFolderType::FT_TRASH, new FolderEntry("trash", TRUE, FALSE, TRUE)); - addEntry(LLFolderType::FT_SNAPSHOT_CATEGORY, new FolderEntry("snapshot", TRUE, TRUE, TRUE)); - addEntry(LLFolderType::FT_LOST_AND_FOUND, new FolderEntry("lstndfnd", TRUE, TRUE, TRUE)); - addEntry(LLFolderType::FT_ANIMATION, new FolderEntry("animatn", TRUE, TRUE, TRUE)); - addEntry(LLFolderType::FT_GESTURE, new FolderEntry("gesture", TRUE, TRUE, TRUE)); - addEntry(LLFolderType::FT_FAVORITE, new FolderEntry("favorite", TRUE, FALSE, TRUE)); + addEntry(LLFolderType::FT_TEXTURE, new FolderEntry("texture", true, true, true)); + addEntry(LLFolderType::FT_SOUND, new FolderEntry("sound", true, true, true)); + addEntry(LLFolderType::FT_CALLINGCARD, new FolderEntry("callcard", true, true, false)); + addEntry(LLFolderType::FT_LANDMARK, new FolderEntry("landmark", true, false, false)); + addEntry(LLFolderType::FT_CLOTHING, new FolderEntry("clothing", true, true, true)); + addEntry(LLFolderType::FT_OBJECT, new FolderEntry("object", true, true, true)); + addEntry(LLFolderType::FT_NOTECARD, new FolderEntry("notecard", true, true, true)); + addEntry(LLFolderType::FT_ROOT_INVENTORY, new FolderEntry("root_inv", true, true, true)); + addEntry(LLFolderType::FT_LSL_TEXT, new FolderEntry("lsltext", true, true, true)); + addEntry(LLFolderType::FT_BODYPART, new FolderEntry("bodypart", true, true, true)); + addEntry(LLFolderType::FT_TRASH, new FolderEntry("trash", true, false, true)); + addEntry(LLFolderType::FT_SNAPSHOT_CATEGORY, new FolderEntry("snapshot", true, true, true)); + addEntry(LLFolderType::FT_LOST_AND_FOUND, new FolderEntry("lstndfnd", true, true, true)); + addEntry(LLFolderType::FT_ANIMATION, new FolderEntry("animatn", true, true, true)); + addEntry(LLFolderType::FT_GESTURE, new FolderEntry("gesture", true, true, true)); + addEntry(LLFolderType::FT_FAVORITE, new FolderEntry("favorite", true, false, true)); for (S32 ensemble_num = S32(LLFolderType::FT_ENSEMBLE_START); ensemble_num <= S32(LLFolderType::FT_ENSEMBLE_END); ensemble_num++) { - addEntry(LLFolderType::EType(ensemble_num), new FolderEntry("ensemble", FALSE, FALSE, FALSE)); // Not used + addEntry(LLFolderType::EType(ensemble_num), new FolderEntry("ensemble", false, false, false)); // Not used } - addEntry(LLFolderType::FT_CURRENT_OUTFIT, new FolderEntry("current", TRUE, FALSE, TRUE)); - addEntry(LLFolderType::FT_OUTFIT, new FolderEntry("outfit", FALSE, FALSE, FALSE)); - addEntry(LLFolderType::FT_MY_OUTFITS, new FolderEntry("my_otfts", TRUE, FALSE, TRUE)); + addEntry(LLFolderType::FT_CURRENT_OUTFIT, new FolderEntry("current", true, false, true)); + addEntry(LLFolderType::FT_OUTFIT, new FolderEntry("outfit", false, false, false)); + addEntry(LLFolderType::FT_MY_OUTFITS, new FolderEntry("my_otfts", true, false, true)); - addEntry(LLFolderType::FT_MESH, new FolderEntry("mesh", TRUE, FALSE, FALSE)); // Not used? + addEntry(LLFolderType::FT_MESH, new FolderEntry("mesh", true, false, false)); // Not used? - addEntry(LLFolderType::FT_INBOX, new FolderEntry("inbox", TRUE, FALSE, TRUE)); - addEntry(LLFolderType::FT_OUTBOX, new FolderEntry("outbox", TRUE, FALSE, FALSE)); + addEntry(LLFolderType::FT_INBOX, new FolderEntry("inbox", true, false, true)); + addEntry(LLFolderType::FT_OUTBOX, new FolderEntry("outbox", true, false, false)); - addEntry(LLFolderType::FT_BASIC_ROOT, new FolderEntry("basic_rt", TRUE, FALSE, FALSE)); + addEntry(LLFolderType::FT_BASIC_ROOT, new FolderEntry("basic_rt", true, false, false)); - addEntry(LLFolderType::FT_MARKETPLACE_LISTINGS, new FolderEntry("merchant", FALSE, FALSE, FALSE)); - addEntry(LLFolderType::FT_MARKETPLACE_STOCK, new FolderEntry("stock", FALSE, FALSE, FALSE)); - addEntry(LLFolderType::FT_MARKETPLACE_VERSION, new FolderEntry("version", FALSE, FALSE, FALSE)); + addEntry(LLFolderType::FT_MARKETPLACE_LISTINGS, new FolderEntry("merchant", false, false, false)); + addEntry(LLFolderType::FT_MARKETPLACE_STOCK, new FolderEntry("stock", false, false, false)); + addEntry(LLFolderType::FT_MARKETPLACE_VERSION, new FolderEntry("version", false, false, false)); - addEntry(LLFolderType::FT_SETTINGS, new FolderEntry("settings", TRUE, FALSE, TRUE)); - addEntry(LLFolderType::FT_MATERIAL, new FolderEntry("material", TRUE, FALSE, TRUE)); + addEntry(LLFolderType::FT_SETTINGS, new FolderEntry("settings", true, false, true)); + addEntry(LLFolderType::FT_MATERIAL, new FolderEntry("material", true, false, true)); - addEntry(LLFolderType::FT_NONE, new FolderEntry("-1", FALSE, FALSE, FALSE)); + addEntry(LLFolderType::FT_NONE, new FolderEntry("-1", false, false, false)); }; // static diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index d7e655d537..082d8b2f9f 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -133,7 +133,7 @@ LLAssetType::EType LLInventoryObject::getActualType() const return mType; } -BOOL LLInventoryObject::getIsLinkType() const +bool LLInventoryObject::getIsLinkType() const { return LLAssetType::lookupIsLinkType(mType); } @@ -182,7 +182,7 @@ void LLInventoryObject::setType(LLAssetType::EType type) // virtual -BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream) +bool LLInventoryObject::importLegacyStream(std::istream& input_stream) { // *NOTE: Changing the buffer size will require changing the scanf // calls below. @@ -265,10 +265,10 @@ BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream) << "' in LLInventoryObject::importLegacyStream() for object " << mUUID << LL_ENDL; } } - return TRUE; + return true; } -BOOL LLInventoryObject::exportLegacyStream(std::ostream& output_stream, BOOL) const +bool LLInventoryObject::exportLegacyStream(std::ostream& output_stream, bool) const { std::string uuid_str; output_stream << "\tinv_object\t0\n\t{\n"; @@ -279,16 +279,16 @@ BOOL LLInventoryObject::exportLegacyStream(std::ostream& output_stream, BOOL) co output_stream << "\t\ttype\t" << LLAssetType::lookup(mType) << "\n"; output_stream << "\t\tname\t" << mName.c_str() << "|\n"; output_stream << "\t}\n"; - return TRUE; + return true; } -void LLInventoryObject::updateParentOnServer(BOOL) const +void LLInventoryObject::updateParentOnServer(bool) const { // don't do nothin' LL_WARNS() << "LLInventoryObject::updateParentOnServer() called. Doesn't do anything." << LL_ENDL; } -void LLInventoryObject::updateServer(BOOL) const +void LLInventoryObject::updateServer(bool) const { // don't do nothin' LL_WARNS() << "LLInventoryObject::updateServer() called. Doesn't do anything." << LL_ENDL; @@ -575,7 +575,7 @@ void LLInventoryItem::packMessage(LLMessageSystem* msg) const } // virtual -BOOL LLInventoryItem::unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num) +bool LLInventoryItem::unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num) { msg->getUUIDFast(block, _PREHASH_ItemID, mUUID, block_num); msg->getUUIDFast(block, _PREHASH_FolderID, mParentUUID, block_num); @@ -611,13 +611,13 @@ BOOL LLInventoryItem::unpackMessage(LLMessageSystem* msg, const char* block, S32 if(local_crc == remote_crc) { LL_DEBUGS() << "crc matches" << LL_ENDL; - return TRUE; + return true; } else { LL_WARNS() << "inventory crc mismatch: local=" << std::hex << local_crc << " remote=" << remote_crc << std::dec << LL_ENDL; - return FALSE; + return false; } #else return (local_crc == remote_crc); @@ -625,7 +625,7 @@ BOOL LLInventoryItem::unpackMessage(LLMessageSystem* msg, const char* block, S32 } // virtual -BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) +bool LLInventoryItem::importLegacyStream(std::istream& input_stream) { // *NOTE: Changing the buffer size will require changing the scanf // calls below. @@ -633,7 +633,7 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) char keyword[MAX_STRING]; /* Flawfinder: ignore */ char valuestr[MAX_STRING]; /* Flawfinder: ignore */ char junk[MAX_STRING]; /* Flawfinder: ignore */ - BOOL success = TRUE; + bool success = true; keyword[0] = '\0'; valuestr[0] = '\0'; @@ -673,7 +673,7 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) // the permissions. Thus, we read that out, and fix legacy // objects. It's possible this op would fail, but it // should pick up the vast majority of the tasks. - BOOL has_perm_mask = FALSE; + bool has_perm_mask = false; U32 perm_mask = 0; success = mSaleInfo.importLegacyStream(input_stream, has_perm_mask, perm_mask); if(has_perm_mask) @@ -815,7 +815,7 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) return success; } -BOOL LLInventoryItem::exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key) const +bool LLInventoryItem::exportLegacyStream(std::ostream& output_stream, bool include_asset_key) const { std::string uuid_str; output_stream << "\tinv_item\t0\n\t{\n"; @@ -874,7 +874,7 @@ BOOL LLInventoryItem::exportLegacyStream(std::ostream& output_stream, BOOL inclu output_stream << "\t\tdesc\t" << mDescription.c_str() << "|\n"; output_stream << "\t\tcreation_date\t" << mCreationDate << "\n"; output_stream << "\t}\n"; - return TRUE; + return true; } LLSD LLInventoryItem::asLLSD() const @@ -994,7 +994,7 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new) // the permissions. Thus, we read that out, and fix legacy // objects. It's possible this op would fail, but it // should pick up the vast majority of the tasks. - BOOL has_perm_mask = FALSE; + bool has_perm_mask = false; U32 perm_mask = 0; if (!mSaleInfo.fromLLSD(i->second, has_perm_mask, perm_mask)) { @@ -1278,7 +1278,7 @@ void LLInventoryCategory::unpackMessage(LLMessageSystem* msg, } // virtual -BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream) +bool LLInventoryCategory::importLegacyStream(std::istream& input_stream) { // *NOTE: Changing the buffer size will require changing the scanf // calls below. @@ -1369,10 +1369,10 @@ BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream) << "' in inventory import category " << mUUID << LL_ENDL; } } - return TRUE; + return true; } -BOOL LLInventoryCategory::exportLegacyStream(std::ostream& output_stream, BOOL) const +bool LLInventoryCategory::exportLegacyStream(std::ostream& output_stream, bool) const { std::string uuid_str; output_stream << "\tinv_category\t0\n\t{\n"; @@ -1393,7 +1393,7 @@ BOOL LLInventoryCategory::exportLegacyStream(std::ostream& output_stream, BOOL) output_stream << "|\n"; } output_stream << "\t}\n"; - return TRUE; + return true; } LLSD LLInventoryCategory::exportLLSD() const diff --git a/indra/llinventory/llinventory.h b/indra/llinventory/llinventory.h index 1039fe7b72..e63f2deba7 100644 --- a/indra/llinventory/llinventory.h +++ b/indra/llinventory/llinventory.h @@ -74,7 +74,7 @@ public: virtual const std::string& getName() const; virtual LLAssetType::EType getType() const; LLAssetType::EType getActualType() const; // bypasses indirection for linked items - BOOL getIsLinkType() const; + bool getIsLinkType() const; virtual time_t getCreationDate() const; //-------------------------------------------------------------------- @@ -98,11 +98,11 @@ public: // between simulator and viewer. //-------------------------------------------------------------------- - virtual BOOL importLegacyStream(std::istream& input_stream); - virtual BOOL exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key = TRUE) const; + virtual bool importLegacyStream(std::istream& input_stream); + virtual bool exportLegacyStream(std::ostream& output_stream, bool include_asset_key = true) const; - virtual void updateParentOnServer(BOOL) const; - virtual void updateServer(BOOL) const; + virtual void updateParentOnServer(bool) const; + virtual void updateServer(bool) const; //-------------------------------------------------------------------- // Member Variables @@ -190,17 +190,17 @@ public: // Assumes you have already called nextBlock(). virtual void packMessage(LLMessageSystem* msg) const; - // Returns TRUE if the inventory item came through the network correctly. + // Returns true if the inventory item came through the network correctly. // Uses a simple crc check which is defeatable, but we want to detect // network mangling somehow. - virtual BOOL unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0); + virtual bool unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0); //-------------------------------------------------------------------- // File Support //-------------------------------------------------------------------- public: - virtual BOOL importLegacyStream(std::istream& input_stream); - virtual BOOL exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key = TRUE) const; + virtual bool importLegacyStream(std::istream& input_stream); + virtual bool exportLegacyStream(std::ostream& output_stream, bool include_asset_key = true) const; //-------------------------------------------------------------------- // Helper Functions @@ -267,8 +267,8 @@ public: // File Support //-------------------------------------------------------------------- public: - virtual BOOL importLegacyStream(std::istream& input_stream); - virtual BOOL exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key = TRUE) const; + virtual bool importLegacyStream(std::istream& input_stream); + virtual bool exportLegacyStream(std::ostream& output_stream, bool include_asset_key = true) const; LLSD exportLLSD() const; bool importLLSD(const LLSD& cat_data); diff --git a/indra/llinventory/llinventorytype.cpp b/indra/llinventory/llinventorytype.cpp index 303dd8b711..3dd1a5638d 100644 --- a/indra/llinventory/llinventorytype.cpp +++ b/indra/llinventory/llinventorytype.cpp @@ -83,6 +83,8 @@ LLInventoryDictionary::LLInventoryDictionary() addEntry(LLInventoryType::IT_ANIMATION, new InventoryEntry("animation", "animation", 1, LLAssetType::AT_ANIMATION)); addEntry(LLInventoryType::IT_GESTURE, new InventoryEntry("gesture", "gesture", 1, LLAssetType::AT_GESTURE)); addEntry(LLInventoryType::IT_MESH, new InventoryEntry("mesh", "mesh", 1, LLAssetType::AT_MESH)); + addEntry(LLInventoryType::IT_GLTF, new InventoryEntry("gltf", "gltf", 1, LLAssetType::AT_GLTF)); + addEntry(LLInventoryType::IT_GLTF_BIN, new InventoryEntry("glbin", "glbin", 1, LLAssetType::AT_GLTF_BIN)); addEntry(LLInventoryType::IT_WIDGET, new InventoryEntry("widget", "widget", 1, LLAssetType::AT_WIDGET)); addEntry(LLInventoryType::IT_PERSON, new InventoryEntry("person", "person", 1, LLAssetType::AT_PERSON)); addEntry(LLInventoryType::IT_SETTINGS, new InventoryEntry("settings", "settings", 1, LLAssetType::AT_SETTINGS)); @@ -153,9 +155,12 @@ DEFAULT_ASSET_FOR_INV_TYPE[LLAssetType::AT_COUNT] = LLInventoryType::IT_NONE, // 52 AT_RESERVED_3 LLInventoryType::IT_NONE, // 53 AT_RESERVED_4 LLInventoryType::IT_NONE, // 54 AT_RESERVED_5 + LLInventoryType::IT_NONE, // 55 AT_RESERVED_6 - LLInventoryType::IT_SETTINGS, // 55 AT_SETTINGS <- why doesnt this match the value in llassettype.h? -brad + LLInventoryType::IT_SETTINGS, // 56 AT_SETTINGS LLInventoryType::IT_MATERIAL, // 57 AT_MATERIAL + LLInventoryType::IT_GLTF, // 58 AT_GLTF + LLInventoryType::IT_GLTF_BIN, // 59 AT_GLTF_BIN }; // static diff --git a/indra/llinventory/llinventorytype.h b/indra/llinventory/llinventorytype.h index fd80a0be04..c90f8aa107 100644 --- a/indra/llinventory/llinventorytype.h +++ b/indra/llinventory/llinventorytype.h @@ -66,7 +66,9 @@ public: IT_PERSON = 24, IT_SETTINGS = 25, IT_MATERIAL = 26, - IT_COUNT = 27, + IT_GLTF = 27, + IT_GLTF_BIN = 28, + IT_COUNT = 29, IT_UNKNOWN = 255, IT_NONE = -1 diff --git a/indra/llinventory/llnotecard.cpp b/indra/llinventory/llnotecard.cpp index cc40a0c6b8..d73e9c8966 100644 --- a/indra/llinventory/llnotecard.cpp +++ b/indra/llinventory/llnotecard.cpp @@ -162,25 +162,25 @@ bool LLNotecard::importStream(std::istream& str) if(str.fail()) { LL_WARNS() << "Invalid Linden text file header " << LL_ENDL; - return FALSE; + return false; } if( 1 != mVersion && 2 != mVersion) { LL_WARNS() << "Invalid Linden text file version: " << mVersion << LL_ENDL; - return FALSE; + return false; } str >> std::ws >> "{\n"; if(str.fail()) { LL_WARNS() << "Invalid Linden text file format" << LL_ENDL; - return FALSE; + return false; } if(!importEmbeddedItemsStream(str)) { - return FALSE; + return false; } char line_buf[STD_STRING_BUF_SIZE]; /* Flawfinder: ignore */ @@ -188,7 +188,7 @@ bool LLNotecard::importStream(std::istream& str) if(str.fail()) { LL_WARNS() << "Invalid Linden text length field" << LL_ENDL; - return FALSE; + return false; } line_buf[STD_STRING_STR_LEN] = '\0'; @@ -196,23 +196,23 @@ bool LLNotecard::importStream(std::istream& str) if( 1 != sscanf(line_buf, "Text length %d", &text_len) ) { LL_WARNS() << "Invalid Linden text length field" << LL_ENDL; - return FALSE; + return false; } if(text_len > mMaxText || text_len < 0) { LL_WARNS() << "Invalid Linden text length: " << text_len << LL_ENDL; - return FALSE; + return false; } - BOOL success = TRUE; + bool success = true; char* text = new char[text_len + 1]; fullread(str, text, text_len); if(str.fail()) { LL_WARNS() << "Invalid Linden text: text shorter than text length: " << text_len << LL_ENDL; - success = FALSE; + success = false; } text[text_len] = '\0'; @@ -247,7 +247,7 @@ bool LLNotecard::exportEmbeddedItemsStream( std::ostream& out_stream ) out_stream << llformat("ext char index %d\n", idx ); if( !item->exportLegacyStream( out_stream ) ) { - return FALSE; + return false; } out_stream << "}\n"; } @@ -256,7 +256,7 @@ bool LLNotecard::exportEmbeddedItemsStream( std::ostream& out_stream ) out_stream << "}\n"; - return TRUE; + return true; } bool LLNotecard::exportStream( std::ostream& out_stream ) @@ -266,14 +266,14 @@ bool LLNotecard::exportStream( std::ostream& out_stream ) if( !exportEmbeddedItemsStream( out_stream ) ) { - return FALSE; + return false; } out_stream << llformat("Text length %d\n", mText.length() ); out_stream << mText; out_stream << "}\n"; - return TRUE; + return true; } //////////////////////////////////////////////////////////////////////////// diff --git a/indra/llinventory/llparcel.cpp b/indra/llinventory/llparcel.cpp index 0cb9070ff6..ef6ddb3cab 100644 --- a/indra/llinventory/llparcel.cpp +++ b/indra/llinventory/llparcel.cpp @@ -119,15 +119,15 @@ LLParcel::ECategory category_ui_string_to_category(const std::string& s); LLParcel::LLParcel() { - init(LLUUID::null, TRUE, FALSE, FALSE, 0, 0, 0, 0, 0, 1.f, 0); + init(LLUUID::null, true, false, false, 0, 0, 0, 0, 0, 1.f, 0); } LLParcel::LLParcel(const LLUUID &owner_id, - BOOL modify, BOOL terraform, BOOL damage, + bool modify, bool terraform, bool damage, time_t claim_date, S32 claim_price_per_meter, S32 rent_price_per_meter, S32 area, S32 sim_object_limit, F32 parcel_object_bonus, - BOOL is_group_owned) + bool is_group_owned) { init( owner_id, modify, terraform, damage, claim_date, claim_price_per_meter, rent_price_per_meter, area, sim_object_limit, parcel_object_bonus, @@ -142,10 +142,10 @@ LLParcel::~LLParcel() } void LLParcel::init(const LLUUID &owner_id, - BOOL modify, BOOL terraform, BOOL damage, + bool modify, bool terraform, bool damage, time_t claim_date, S32 claim_price_per_meter, S32 rent_price_per_meter, S32 area, S32 sim_object_limit, F32 parcel_object_bonus, - BOOL is_group_owned) + bool is_group_owned) { mID.setNull(); mOwnerID = owner_id; @@ -172,7 +172,7 @@ void LLParcel::init(const LLUUID &owner_id, mSaleTimerExpires.stop(); mGraceExtension = 0; //mExpireAction = STEA_REVERT; - //mRecordTransaction = FALSE; + //mRecordTransaction = false; mAuctionID = 0; mInEscrow = false; @@ -191,13 +191,13 @@ void LLParcel::init(const LLUUID &owner_id, setMediaType(LLStringUtil::null); mMediaID.setNull(); mMediaAutoScale = 0; - mMediaLoop = TRUE; + mMediaLoop = 1; mMediaWidth = 0; mMediaHeight = 0; setMediaCurrentURL(LLStringUtil::null); - mMediaAllowNavigate = TRUE; + mMediaAllowNavigate = 1; mMediaURLTimeout = 0.0f; - mMediaPreventCameraZoom = FALSE; + mMediaPreventCameraZoom = 0; mGroupID.setNull(); @@ -219,26 +219,26 @@ void LLParcel::init(const LLUUID &owner_id, setSelectedPrimCount(0); setTempPrimCount(0); setCleanOtherTime(0); - setRegionPushOverride(FALSE); - setRegionDenyAnonymousOverride(FALSE); - setRegionDenyAgeUnverifiedOverride(FALSE); + setRegionPushOverride(false); + setRegionDenyAnonymousOverride(false); + setRegionDenyAgeUnverifiedOverride(false); setParcelPrimBonus(parcel_object_bonus); setPreviousOwnerID(LLUUID::null); - setPreviouslyGroupOwned(FALSE); + setPreviouslyGroupOwned(false); - setSeeAVs(TRUE); - setAllowGroupAVSounds(TRUE); - setAllowAnyAVSounds(TRUE); - setHaveNewParcelLimitData(FALSE); + setSeeAVs(true); + setAllowGroupAVSounds(true); + setAllowAnyAVSounds(true); + setHaveNewParcelLimitData(false); - setRegionAllowEnvironmentOverride(FALSE); + setRegionAllowEnvironmentOverride(false); setParcelEnvironmentVersion(INVALID_PARCEL_ENVIRONMENT_VERSION); setObscureMOAP(false); } -void LLParcel::overrideOwner(const LLUUID& owner_id, BOOL is_group_owned) +void LLParcel::overrideOwner(const LLUUID& owner_id, bool is_group_owned) { // Override with system permission (LLUUID::null) // Overridden parcels have no group @@ -352,7 +352,7 @@ void LLParcel::setAllParcelFlags(U32 flags) mParcelFlags = flags; } -void LLParcel::setParcelFlag(U32 flag, BOOL b) +void LLParcel::setParcelFlag(U32 flag, bool b) { if (b) { @@ -365,25 +365,25 @@ void LLParcel::setParcelFlag(U32 flag, BOOL b) } -BOOL LLParcel::allowModifyBy(const LLUUID &agent_id, const LLUUID &group_id) const +bool LLParcel::allowModifyBy(const LLUUID &agent_id, const LLUUID &group_id) const { if (agent_id == LLUUID::null) { // system always can enter - return TRUE; + return true; } else if (isPublic()) { - return TRUE; + return true; } else if (agent_id == mOwnerID) { // owner can always perform operations - return TRUE; + return true; } else if (mParcelFlags & PF_CREATE_OBJECTS) { - return TRUE; + return true; } else if ((mParcelFlags & PF_CREATE_GROUP_OBJECTS) && group_id.notNull() ) @@ -391,22 +391,22 @@ BOOL LLParcel::allowModifyBy(const LLUUID &agent_id, const LLUUID &group_id) con return (getGroupID() == group_id); } - return FALSE; + return false; } -BOOL LLParcel::allowTerraformBy(const LLUUID &agent_id) const +bool LLParcel::allowTerraformBy(const LLUUID &agent_id) const { if (agent_id == LLUUID::null) { // system always can enter - return TRUE; + return true; } else if(OS_LEASED == mStatus) { if(agent_id == mOwnerID) { // owner can modify leased land - return TRUE; + return true; } else { @@ -416,7 +416,7 @@ BOOL LLParcel::allowTerraformBy(const LLUUID &agent_id) const } else { - return FALSE; + return false; } } @@ -441,7 +441,7 @@ void LLParcel::setDiscountRate(F32 rate) // File input and output //----------------------------------------------------------- -BOOL LLParcel::importAccessEntry(std::istream& input_stream, LLAccessEntry* entry) +bool LLParcel::importAccessEntry(std::istream& input_stream, LLAccessEntry* entry) { skip_to_end_of_next_keyword("{", input_stream); while (input_stream.good()) @@ -561,9 +561,9 @@ void LLParcel::unpackMessage(LLMessageSystem* msg) msg->getStringFast( _PREHASH_ParcelData,_PREHASH_MediaURL, buffer ); setMediaURL(buffer); - BOOL see_avs = TRUE; // All default to true for legacy server behavior - BOOL any_av_sounds = TRUE; - BOOL group_av_sounds = TRUE; + bool see_avs = true; // All default to true for legacy server behavior + bool any_av_sounds = true; + bool group_av_sounds = true; bool have_new_parcel_limit_data = (msg->getSizeFast(_PREHASH_ParcelData, _PREHASH_SeeAVs) > 0); // New version of server should send all 3 of these values have_new_parcel_limit_data &= (msg->getSizeFast(_PREHASH_ParcelData, _PREHASH_AnyAVSounds) > 0); have_new_parcel_limit_data &= (msg->getSizeFast(_PREHASH_ParcelData, _PREHASH_GroupAVSounds) > 0); @@ -728,21 +728,21 @@ void LLParcel::expirePasses(S32 now) bool LLParcel::operator==(const LLParcel &rhs) const { if (mOwnerID != rhs.mOwnerID) - return FALSE; + return false; if (mParcelFlags != rhs.mParcelFlags) - return FALSE; + return false; if (mClaimDate != rhs.mClaimDate) - return FALSE; + return false; if (mClaimPricePerMeter != rhs.mClaimPricePerMeter) - return FALSE; + return false; if (mRentPricePerMeter != rhs.mRentPricePerMeter) - return FALSE; + return false; - return TRUE; + return true; } // Calculate rent @@ -787,16 +787,16 @@ void LLParcel::extendAABB(const LLVector3& box_min, const LLVector3& box_max) } } -BOOL LLParcel::addToAccessList(const LLUUID& agent_id, S32 time) +bool LLParcel::addToAccessList(const LLUUID& agent_id, S32 time) { if (mAccessList.size() >= (U32) PARCEL_MAX_ACCESS_LIST) { - return FALSE; + return false; } if (agent_id == getOwnerID()) { // Can't add owner to these lists - return FALSE; + return false; } LLAccessEntry::map::iterator itor = mAccessList.begin(); while (itor != mAccessList.end()) @@ -811,7 +811,7 @@ BOOL LLParcel::addToAccessList(const LLUUID& agent_id, S32 time) else { // existing one expires later - return FALSE; + return false; } } else @@ -825,20 +825,20 @@ BOOL LLParcel::addToAccessList(const LLUUID& agent_id, S32 time) new_entry.mTime = time; new_entry.mFlags = 0x0; mAccessList[new_entry.mID] = new_entry; - return TRUE; + return true; } -BOOL LLParcel::addToBanList(const LLUUID& agent_id, S32 time) +bool LLParcel::addToBanList(const LLUUID& agent_id, S32 time) { if (mBanList.size() >= (U32) PARCEL_MAX_ACCESS_LIST) { // Not using ban list, so not a rational thing to do - return FALSE; + return false; } if (agent_id == getOwnerID()) { // Can't add owner to these lists - return FALSE; + return false; } LLAccessEntry::map::iterator itor = mBanList.begin(); @@ -854,7 +854,7 @@ BOOL LLParcel::addToBanList(const LLUUID& agent_id, S32 time) else { // existing one expires later - return FALSE; + return false; } } else @@ -868,13 +868,13 @@ BOOL LLParcel::addToBanList(const LLUUID& agent_id, S32 time) new_entry.mTime = time; new_entry.mFlags = 0x0; mBanList[new_entry.mID] = new_entry; - return TRUE; + return true; } -BOOL remove_from_access_array(std::map<LLUUID,LLAccessEntry>* list, +bool remove_from_access_array(std::map<LLUUID,LLAccessEntry>* list, const LLUUID& agent_id) { - BOOL removed = FALSE; + bool removed = false; LLAccessEntry::map::iterator itor = list->begin(); while (itor != list->end()) { @@ -882,7 +882,7 @@ BOOL remove_from_access_array(std::map<LLUUID,LLAccessEntry>* list, if (entry.mID == agent_id) { list->erase(itor++); - removed = TRUE; + removed = true; } else { @@ -892,12 +892,12 @@ BOOL remove_from_access_array(std::map<LLUUID,LLAccessEntry>* list, return removed; } -BOOL LLParcel::removeFromAccessList(const LLUUID& agent_id) +bool LLParcel::removeFromAccessList(const LLUUID& agent_id) { return remove_from_access_array(&mAccessList, agent_id); } -BOOL LLParcel::removeFromBanList(const LLUUID& agent_id) +bool LLParcel::removeFromBanList(const LLUUID& agent_id) { return remove_from_access_array(&mBanList, agent_id); } @@ -947,13 +947,13 @@ const std::string& LLParcel::getActionString(LLParcel::EAction action) return PARCEL_ACTION_STRING[index]; } -BOOL LLParcel::isSaleTimerExpired(const U64& time) +bool LLParcel::isSaleTimerExpired(const U64& time) { - if (mSaleTimerExpires.getStarted() == FALSE) + if (!mSaleTimerExpires.getStarted()) { - return FALSE; + return false; } - BOOL expired = mSaleTimerExpires.checkExpirationAndReset(0.0); + bool expired = mSaleTimerExpires.checkExpirationAndReset(0.0); if (expired) { mSaleTimerExpires.stop(); @@ -961,13 +961,13 @@ BOOL LLParcel::isSaleTimerExpired(const U64& time) return expired; } -BOOL LLParcel::isMediaResetTimerExpired(const U64& time) +bool LLParcel::isMediaResetTimerExpired(const U64& time) { - if (mMediaResetTimer.getStarted() == FALSE) + if (!mMediaResetTimer.getStarted()) { - return FALSE; + return false; } - BOOL expired = mMediaResetTimer.checkExpirationAndReset(0.0); + bool expired = mMediaResetTimer.checkExpirationAndReset(0.0); if (expired) { mMediaResetTimer.stop(); @@ -976,7 +976,7 @@ BOOL LLParcel::isMediaResetTimerExpired(const U64& time) } -void LLParcel::startSale(const LLUUID& buyer_id, BOOL is_buyer_group) +void LLParcel::startSale(const LLUUID& buyer_id, bool is_buyer_group) { // TODO -- this and all Sale related methods need to move out of the LLParcel // base class and into server-side-only LLSimParcel class @@ -1011,11 +1011,11 @@ void LLParcel::expireSale( mSaleTimerExpires.setTimerExpirySec(0.0); mSaleTimerExpires.stop(); setPreviousOwnerID(LLUUID::null); - setPreviouslyGroupOwned(FALSE); - setSellWithObjects(FALSE); + setPreviouslyGroupOwned(false); + setSellWithObjects(false); type = TRANS_LAND_RELEASE; mStatus = OS_NONE; - flags = pack_transaction_flags(mGroupOwned, FALSE); + flags = pack_transaction_flags(mGroupOwned, false); mAuthBuyerID.setNull(); from_id = mOwnerID; mOwnerID.setNull(); @@ -1037,12 +1037,12 @@ void LLParcel::completeSale( // Purchased parcels are assumed to no longer be for sale. // Otherwise someone can snipe the sale. - setForSale(FALSE); + setForSale(false); setAuctionID(0); // Turn off show directory, since it's a recurring fee that // the buyer may not want. - setParcelFlag(PF_SHOW_DIRECTORY, FALSE); + setParcelFlag(PF_SHOW_DIRECTORY, false); //should be cleared on sale. mAccessList.clear(); @@ -1062,23 +1062,23 @@ void LLParcel::clearSale() mStatus = OS_LEASED; } mAuthBuyerID.setNull(); - setForSale(FALSE); + setForSale(false); setAuctionID(0); setPreviousOwnerID(LLUUID::null); - setPreviouslyGroupOwned(FALSE); - setSellWithObjects(FALSE); + setPreviouslyGroupOwned(false); + setSellWithObjects(false); } -BOOL LLParcel::isPublic() const +bool LLParcel::isPublic() const { return (mOwnerID.isNull()); } -BOOL LLParcel::isBuyerAuthorized(const LLUUID& buyer_id) const +bool LLParcel::isBuyerAuthorized(const LLUUID& buyer_id) const { if(mAuthBuyerID.isNull()) { - return TRUE; + return true; } return (mAuthBuyerID == buyer_id); } @@ -1093,15 +1093,15 @@ void LLParcel::clearParcel() setMediaID(LLUUID::null); setMediaDesc(LLStringUtil::null); setMediaAutoScale(0); - setMediaLoop(TRUE); + setMediaLoop(1); mMediaWidth = 0; mMediaHeight = 0; setMediaCurrentURL(LLStringUtil::null); - setMediaAllowNavigate(TRUE); - setMediaPreventCameraZoom(FALSE); + setMediaAllowNavigate(1); + setMediaPreventCameraZoom(0); setMediaURLTimeout(0.0f); setMusicURL(LLStringUtil::null); - setInEscrow(FALSE); + setInEscrow(false); setAuthorizedBuyerID(LLUUID::null); setCategory(C_NONE); setSnapshotID(LLUUID::null); diff --git a/indra/llinventory/llparcel.h b/indra/llinventory/llparcel.h index 8717f38ecf..67d713db1f 100644 --- a/indra/llinventory/llparcel.h +++ b/indra/llinventory/llparcel.h @@ -209,37 +209,37 @@ public: LLParcel(); LLParcel( const LLUUID &owner_id, - BOOL modify, - BOOL terraform, - BOOL damage, + bool modify, + bool terraform, + bool damage, time_t claim_date, S32 claim_price, S32 rent_price, S32 area, S32 sim_object_limit, F32 parcel_object_bonus, - BOOL is_group_owned = FALSE); + bool is_group_owned = false); virtual ~LLParcel(); void init( const LLUUID &owner_id, - BOOL modify, - BOOL terraform, - BOOL damage, + bool modify, + bool terraform, + bool damage, time_t claim_date, S32 claim_price, S32 rent_price, S32 area, S32 sim_object_limit, F32 parcel_object_bonus, - BOOL is_group_owned = FALSE); + bool is_group_owned = false); // TODO: make an actual copy constructor for this void overrideParcelFlags(U32 flags); // if you specify an agent id here, the group id will be zeroed void overrideOwner( const LLUUID& owner_id, - BOOL is_group_owned = FALSE); + bool is_group_owned = false); void overrideSaleTimerExpires(F32 secs_left) { mSaleTimerExpires.setTimerExpirySec(secs_left); } // MANIPULATORS @@ -277,35 +277,35 @@ public: void setUserLocation(const LLVector3& pos) { mUserLocation = pos; } void setUserLookAt(const LLVector3& rot) { mUserLookAt = rot; } void setLandingType(const ELandingType type) { mLandingType = type; } - void setSeeAVs(BOOL see_avs) { mSeeAVs = see_avs; } + void setSeeAVs(bool see_avs) { mSeeAVs = see_avs; } void setHaveNewParcelLimitData(bool have_new_parcel_data) { mHaveNewParcelLimitData = have_new_parcel_data; } // Remove this once hidden AV feature is fully available grid-wide void setAuctionID(U32 auction_id) { mAuctionID = auction_id;} void setAllParcelFlags(U32 flags); - void setParcelFlag(U32 flag, BOOL b); + void setParcelFlag(U32 flag, bool b); virtual void setArea(S32 area, S32 sim_object_limit); void setDiscountRate(F32 rate); - void setAllowModify(BOOL b) { setParcelFlag(PF_CREATE_OBJECTS, b); } - void setAllowGroupModify(BOOL b) { setParcelFlag(PF_CREATE_GROUP_OBJECTS, b); } - void setAllowAllObjectEntry(BOOL b) { setParcelFlag(PF_ALLOW_ALL_OBJECT_ENTRY, b); } - void setAllowGroupObjectEntry(BOOL b) { setParcelFlag(PF_ALLOW_GROUP_OBJECT_ENTRY, b); } - void setAllowTerraform(BOOL b){setParcelFlag(PF_ALLOW_TERRAFORM, b); } - void setAllowDamage(BOOL b) { setParcelFlag(PF_ALLOW_DAMAGE, b); } - void setAllowFly(BOOL b) { setParcelFlag(PF_ALLOW_FLY, b); } - void setAllowGroupScripts(BOOL b) { setParcelFlag(PF_ALLOW_GROUP_SCRIPTS, b); } - void setAllowOtherScripts(BOOL b) { setParcelFlag(PF_ALLOW_OTHER_SCRIPTS, b); } - void setAllowDeedToGroup(BOOL b) { setParcelFlag(PF_ALLOW_DEED_TO_GROUP, b); } - void setContributeWithDeed(BOOL b) { setParcelFlag(PF_CONTRIBUTE_WITH_DEED, b); } - void setForSale(BOOL b) { setParcelFlag(PF_FOR_SALE, b); } - void setSoundOnly(BOOL b) { setParcelFlag(PF_SOUND_LOCAL, b); } - void setDenyAnonymous(BOOL b) { setParcelFlag(PF_DENY_ANONYMOUS, b); } - void setDenyAgeUnverified(BOOL b) { setParcelFlag(PF_DENY_AGEUNVERIFIED, b); } - void setRestrictPushObject(BOOL b) { setParcelFlag(PF_RESTRICT_PUSHOBJECT, b); } - void setAllowGroupAVSounds(BOOL b) { mAllowGroupAVSounds = b; } - void setAllowAnyAVSounds(BOOL b) { mAllowAnyAVSounds = b; } + void setAllowModify(bool b) { setParcelFlag(PF_CREATE_OBJECTS, b); } + void setAllowGroupModify(bool b) { setParcelFlag(PF_CREATE_GROUP_OBJECTS, b); } + void setAllowAllObjectEntry(bool b) { setParcelFlag(PF_ALLOW_ALL_OBJECT_ENTRY, b); } + void setAllowGroupObjectEntry(bool b) { setParcelFlag(PF_ALLOW_GROUP_OBJECT_ENTRY, b); } + void setAllowTerraform(bool b){setParcelFlag(PF_ALLOW_TERRAFORM, b); } + void setAllowDamage(bool b) { setParcelFlag(PF_ALLOW_DAMAGE, b); } + void setAllowFly(bool b) { setParcelFlag(PF_ALLOW_FLY, b); } + void setAllowGroupScripts(bool b) { setParcelFlag(PF_ALLOW_GROUP_SCRIPTS, b); } + void setAllowOtherScripts(bool b) { setParcelFlag(PF_ALLOW_OTHER_SCRIPTS, b); } + void setAllowDeedToGroup(bool b) { setParcelFlag(PF_ALLOW_DEED_TO_GROUP, b); } + void setContributeWithDeed(bool b) { setParcelFlag(PF_CONTRIBUTE_WITH_DEED, b); } + void setForSale(bool b) { setParcelFlag(PF_FOR_SALE, b); } + void setSoundOnly(bool b) { setParcelFlag(PF_SOUND_LOCAL, b); } + void setDenyAnonymous(bool b) { setParcelFlag(PF_DENY_ANONYMOUS, b); } + void setDenyAgeUnverified(bool b) { setParcelFlag(PF_DENY_AGEUNVERIFIED, b); } + void setRestrictPushObject(bool b) { setParcelFlag(PF_RESTRICT_PUSHOBJECT, b); } + void setAllowGroupAVSounds(bool b) { mAllowGroupAVSounds = b; } + void setAllowAnyAVSounds(bool b) { mAllowAnyAVSounds = b; } void setObscureMOAP(bool b) { mObscureMOAP = b; } void setDrawDistance(F32 dist) { mDrawDistance = dist; } @@ -315,9 +315,9 @@ public: void setPassPrice(S32 price) { mPassPrice = price; } void setPassHours(F32 hours) { mPassHours = hours; } -// BOOL importStream(std::istream& input_stream); - BOOL importAccessEntry(std::istream& input_stream, LLAccessEntry* entry); - // BOOL exportStream(std::ostream& output_stream); +// bool importStream(std::istream& input_stream); + bool importAccessEntry(std::istream& input_stream, LLAccessEntry* entry); + // bool exportStream(std::ostream& output_stream); void packMessage(LLMessageSystem* msg); void packMessage(LLSD& msg); @@ -343,11 +343,11 @@ public: // time earlier than "now". void expirePasses(S32 now); - // Add to list, suppressing duplicates. Returns TRUE if added. - BOOL addToAccessList(const LLUUID& agent_id, S32 time); - BOOL addToBanList(const LLUUID& agent_id, S32 time); - BOOL removeFromAccessList(const LLUUID& agent_id); - BOOL removeFromBanList(const LLUUID& agent_id); + // Add to list, suppressing duplicates. Returns true if added. + bool addToAccessList(const LLUUID& agent_id, S32 time); + bool addToBanList(const LLUUID& agent_id, S32 time); + bool removeFromAccessList(const LLUUID& agent_id); + bool removeFromBanList(const LLUUID& agent_id); // ACCESSORS const LLUUID& getID() const { return mID; } @@ -372,19 +372,19 @@ public: const LLUUID& getGroupID() const { return mGroupID; } S32 getPassPrice() const { return mPassPrice; } F32 getPassHours() const { return mPassHours; } - BOOL getIsGroupOwned() const { return mGroupOwned; } + bool getIsGroupOwned() const { return mGroupOwned; } U32 getAuctionID() const { return mAuctionID; } bool isInEscrow() const { return mInEscrow; } - BOOL isPublic() const; + bool isPublic() const; // Region-local user-specified position const LLVector3& getUserLocation() const { return mUserLocation; } const LLVector3& getUserLookAt() const { return mUserLookAt; } ELandingType getLandingType() const { return mLandingType; } - BOOL getSeeAVs() const { return mSeeAVs; } - BOOL getHaveNewParcelLimitData() const { return mHaveNewParcelLimitData; } + bool getSeeAVs() const { return mSeeAVs; } + bool getHaveNewParcelLimitData() const { return mHaveNewParcelLimitData; } // User-specified snapshot const LLUUID& getSnapshotID() const { return mSnapshotID; } @@ -395,7 +395,7 @@ public: const LLUUID& getAuthorizedBuyerID() const { return mAuthBuyerID; } // helper function - BOOL isBuyerAuthorized(const LLUUID& buyer_id) const; + bool isBuyerAuthorized(const LLUUID& buyer_id) const; // The buyer of a plot is set when someone indicates they want to // buy the plot, and the system is simply waiting for tier-up @@ -419,10 +419,10 @@ public: // dealing with sales and parcel conversion. // - // the isSaleTimerExpired will trivially return FALSE if there is + // the isSaleTimerExpired will trivially return false if there is // no sale going on. Pass in the current time in usec which will // be used for comparison. - BOOL isSaleTimerExpired(const U64& time); + bool isSaleTimerExpired(const U64& time); F32 getSaleTimerExpires() { return mSaleTimerExpires.getRemainingTimeF32(); } @@ -431,7 +431,7 @@ public: // need to record a few things with the parcel when a sale // starts. - void startSale(const LLUUID& buyer_id, BOOL is_buyer_group); + void startSale(const LLUUID& buyer_id, bool is_buyer_group); // do the expiration logic, which needs to return values usable in // a L$ transaction. @@ -440,86 +440,54 @@ public: void clearSale(); - BOOL isMediaResetTimerExpired(const U64& time); + bool isMediaResetTimerExpired(const U64& time); // more accessors - U32 getParcelFlags() const { return mParcelFlags; } + U32 getParcelFlags() const { return mParcelFlags; } - BOOL getParcelFlag(U32 flag) const - { return (mParcelFlags & flag) ? TRUE : FALSE; } + bool getParcelFlag(U32 flag) const { return (mParcelFlags & flag) != 0; } // objects can be added or modified by anyone (only parcel owner if disabled) - BOOL getAllowModify() const - { return (mParcelFlags & PF_CREATE_OBJECTS) ? TRUE : FALSE; } + bool getAllowModify() const { return getParcelFlag(PF_CREATE_OBJECTS); } // objects can be added or modified by group members - BOOL getAllowGroupModify() const - { return (mParcelFlags & PF_CREATE_GROUP_OBJECTS) ? TRUE : FALSE; } + bool getAllowGroupModify() const { return getParcelFlag(PF_CREATE_GROUP_OBJECTS); } // the parcel can be deeded to the group - BOOL getAllowDeedToGroup() const - { return (mParcelFlags & PF_ALLOW_DEED_TO_GROUP) ? TRUE : FALSE; } + bool getAllowDeedToGroup() const { return getParcelFlag(PF_ALLOW_DEED_TO_GROUP); } // Does the owner want to make a contribution along with the deed. - BOOL getContributeWithDeed() const - { return (mParcelFlags & PF_CONTRIBUTE_WITH_DEED) ? TRUE : FALSE; } + bool getContributeWithDeed() const { return getParcelFlag(PF_CONTRIBUTE_WITH_DEED); } // heightfield can be modified - BOOL getAllowTerraform() const - { return (mParcelFlags & PF_ALLOW_TERRAFORM) ? TRUE : FALSE; } + bool getAllowTerraform() const { return getParcelFlag(PF_ALLOW_TERRAFORM); } // avatars can be hurt here - BOOL getAllowDamage() const - { return (mParcelFlags & PF_ALLOW_DAMAGE) ? TRUE : FALSE; } - - BOOL getAllowFly() const - { return (mParcelFlags & PF_ALLOW_FLY) ? TRUE : FALSE; } - - BOOL getAllowGroupScripts() const - { return (mParcelFlags & PF_ALLOW_GROUP_SCRIPTS) ? TRUE : FALSE; } - - BOOL getAllowOtherScripts() const - { return (mParcelFlags & PF_ALLOW_OTHER_SCRIPTS) ? TRUE : FALSE; } - - BOOL getAllowAllObjectEntry() const - { return (mParcelFlags & PF_ALLOW_ALL_OBJECT_ENTRY) ? TRUE : FALSE; } - - BOOL getAllowGroupObjectEntry() const - { return (mParcelFlags & PF_ALLOW_GROUP_OBJECT_ENTRY) ? TRUE : FALSE; } - - BOOL getForSale() const - { return (mParcelFlags & PF_FOR_SALE) ? TRUE : FALSE; } - BOOL getSoundLocal() const - { return (mParcelFlags & PF_SOUND_LOCAL) ? TRUE : FALSE; } - BOOL getParcelFlagAllowVoice() const - { return (mParcelFlags & PF_ALLOW_VOICE_CHAT) ? TRUE : FALSE; } - BOOL getParcelFlagUseEstateVoiceChannel() const - { return (mParcelFlags & PF_USE_ESTATE_VOICE_CHAN) ? TRUE : FALSE; } - BOOL getAllowPublish() const - { return (mParcelFlags & PF_ALLOW_PUBLISH) ? TRUE : FALSE; } - BOOL getMaturePublish() const - { return (mParcelFlags & PF_MATURE_PUBLISH) ? TRUE : FALSE; } - BOOL getRestrictPushObject() const - { return (mParcelFlags & PF_RESTRICT_PUSHOBJECT) ? TRUE : FALSE; } - BOOL getRegionPushOverride() const - { return mRegionPushOverride; } - BOOL getRegionDenyAnonymousOverride() const - { return mRegionDenyAnonymousOverride; } - BOOL getRegionDenyAgeUnverifiedOverride() const - { return mRegionDenyAgeUnverifiedOverride; } - BOOL getRegionAllowAccessOverride() const - { return mRegionAllowAccessoverride; } - BOOL getRegionAllowEnvironmentOverride() const - { return mRegionAllowEnvironmentOverride; } - S32 getParcelEnvironmentVersion() const - { return mCurrentEnvironmentVersion; } - - - BOOL getAllowGroupAVSounds() const { return mAllowGroupAVSounds; } - BOOL getAllowAnyAVSounds() const { return mAllowAnyAVSounds; } - - bool getObscureMOAP() const { return mObscureMOAP; } + bool getAllowDamage() const { return getParcelFlag(PF_ALLOW_DAMAGE); } + + bool getAllowFly() const { return getParcelFlag(PF_ALLOW_FLY); } + bool getAllowGroupScripts() const { return getParcelFlag(PF_ALLOW_GROUP_SCRIPTS); } + bool getAllowOtherScripts() const { return getParcelFlag(PF_ALLOW_OTHER_SCRIPTS); } + bool getAllowAllObjectEntry() const { return getParcelFlag(PF_ALLOW_ALL_OBJECT_ENTRY); } + bool getAllowGroupObjectEntry() const { return getParcelFlag(PF_ALLOW_GROUP_OBJECT_ENTRY); } + bool getForSale() const { return getParcelFlag(PF_FOR_SALE); } + bool getSoundLocal() const { return getParcelFlag(PF_SOUND_LOCAL); } + bool getParcelFlagAllowVoice() const { return getParcelFlag(PF_ALLOW_VOICE_CHAT); } + bool getParcelFlagUseEstateVoiceChannel() const { return getParcelFlag(PF_USE_ESTATE_VOICE_CHAN); } + bool getAllowPublish() const { return getParcelFlag(PF_ALLOW_PUBLISH); } + bool getMaturePublish() const { return getParcelFlag(PF_MATURE_PUBLISH); } + bool getRestrictPushObject() const { return getParcelFlag(PF_RESTRICT_PUSHOBJECT); } + + bool getRegionPushOverride() const { return mRegionPushOverride; } + bool getRegionDenyAnonymousOverride() const { return mRegionDenyAnonymousOverride; } + bool getRegionDenyAgeUnverifiedOverride() const { return mRegionDenyAgeUnverifiedOverride; } + bool getRegionAllowAccessOverride() const { return mRegionAllowAccessoverride; } + bool getRegionAllowEnvironmentOverride() const { return mRegionAllowEnvironmentOverride; } + S32 getParcelEnvironmentVersion() const { return mCurrentEnvironmentVersion; } + bool getAllowGroupAVSounds() const { return mAllowGroupAVSounds; } + bool getAllowAnyAVSounds() const { return mAllowAnyAVSounds; } + bool getObscureMOAP() const { return mObscureMOAP; } F32 getDrawDistance() const { return mDrawDistance; } S32 getSalePrice() const { return mSalePrice; } @@ -537,10 +505,10 @@ public: S32 getClaimPrice() const { return mClaimPricePerMeter * mArea; } // Can this agent create objects here? - BOOL allowModifyBy(const LLUUID &agent_id, const LLUUID &group_id) const; + bool allowModifyBy(const LLUUID &agent_id, const LLUUID &group_id) const; // Can this agent change the shape of the land? - BOOL allowTerraformBy(const LLUUID &agent_id) const; + bool allowTerraformBy(const LLUUID &agent_id) const; bool operator==(const LLParcel &rhs) const; @@ -582,30 +550,30 @@ public: void setParcelPrimBonus(F32 bonus) { mParcelPrimBonus = bonus; } void setCleanOtherTime(S32 time) { mCleanOtherTime = time; } - void setRegionPushOverride(BOOL override) {mRegionPushOverride = override; } - void setRegionDenyAnonymousOverride(BOOL override) { mRegionDenyAnonymousOverride = override; } - void setRegionDenyAgeUnverifiedOverride(BOOL override) { mRegionDenyAgeUnverifiedOverride = override; } - void setRegionAllowAccessOverride(BOOL override) { mRegionAllowAccessoverride = override; } - void setRegionAllowEnvironmentOverride(BOOL override) { mRegionAllowEnvironmentOverride = override; } + void setRegionPushOverride(bool override) {mRegionPushOverride = override; } + void setRegionDenyAnonymousOverride(bool override) { mRegionDenyAnonymousOverride = override; } + void setRegionDenyAgeUnverifiedOverride(bool override) { mRegionDenyAgeUnverifiedOverride = override; } + void setRegionAllowAccessOverride(bool override) { mRegionAllowAccessoverride = override; } + void setRegionAllowEnvironmentOverride(bool override) { mRegionAllowEnvironmentOverride = override; } void setParcelEnvironmentVersion(S32 version) { mCurrentEnvironmentVersion = version; } // Accessors for parcel sellWithObjects void setPreviousOwnerID(LLUUID prev_owner) { mPreviousOwnerID = prev_owner; } - void setPreviouslyGroupOwned(BOOL b) { mPreviouslyGroupOwned = b; } - void setSellWithObjects(BOOL b) { setParcelFlag(PF_SELL_PARCEL_OBJECTS, b); } + void setPreviouslyGroupOwned(bool b) { mPreviouslyGroupOwned = b; } + void setSellWithObjects(bool b) { setParcelFlag(PF_SELL_PARCEL_OBJECTS, b); } LLUUID getPreviousOwnerID() const { return mPreviousOwnerID; } - BOOL getPreviouslyGroupOwned() const { return mPreviouslyGroupOwned; } - BOOL getSellWithObjects() const { return (mParcelFlags & PF_SELL_PARCEL_OBJECTS) ? TRUE : FALSE; } + bool getPreviouslyGroupOwned() const { return mPreviouslyGroupOwned; } + bool getSellWithObjects() const { return getParcelFlag(PF_SELL_PARCEL_OBJECTS); } protected: LLUUID mID; LLUUID mOwnerID; LLUUID mGroupID; - BOOL mGroupOwned; // TRUE if mOwnerID is a group_id + bool mGroupOwned; // true if mOwnerID is a group_id LLUUID mPreviousOwnerID; - BOOL mPreviouslyGroupOwned; + bool mPreviouslyGroupOwned; EOwnershipStatus mStatus; ECategory mCategory; @@ -614,8 +582,8 @@ protected: LLVector3 mUserLocation; LLVector3 mUserLookAt; ELandingType mLandingType; - BOOL mSeeAVs; // Avatars on this parcel are visible from outside it - BOOL mHaveNewParcelLimitData; // Remove once hidden AV feature is grid-wide + bool mSeeAVs; // Avatars on this parcel are visible from outside it + bool mHaveNewParcelLimitData; // Remove once hidden AV feature is grid-wide LLTimer mSaleTimerExpires; LLTimer mMediaResetTimer; @@ -666,13 +634,13 @@ protected: S32 mTempPrimCount; F32 mParcelPrimBonus; S32 mCleanOtherTime; - BOOL mRegionPushOverride; - BOOL mRegionDenyAnonymousOverride; - BOOL mRegionDenyAgeUnverifiedOverride; - BOOL mRegionAllowAccessoverride; - BOOL mRegionAllowEnvironmentOverride; - BOOL mAllowGroupAVSounds; - BOOL mAllowAnyAVSounds; + bool mRegionPushOverride; + bool mRegionDenyAnonymousOverride; + bool mRegionDenyAgeUnverifiedOverride; + bool mRegionAllowAccessoverride; + bool mRegionAllowEnvironmentOverride; + bool mAllowGroupAVSounds; + bool mAllowAnyAVSounds; bool mObscureMOAP; S32 mCurrentEnvironmentVersion; @@ -692,13 +660,11 @@ public: void setExperienceKeyType(const LLUUID& experience_key, U32 type); U32 countExperienceKeyType(U32 type); - U32 getExperienceKeyType(const LLUUID& experience_key)const; LLAccessEntry::map getExperienceKeysByType(U32 type)const; void clearExperienceKeysByType(U32 type); private: xp_type_map_t mExperienceKeys; - }; diff --git a/indra/llinventory/llpermissions.cpp b/indra/llinventory/llpermissions.cpp index 65df5ebb91..c8963881df 100644 --- a/indra/llinventory/llpermissions.cpp +++ b/indra/llinventory/llpermissions.cpp @@ -87,21 +87,21 @@ void LLPermissions::initMasks(LLInventoryType::EType type) } } -BOOL LLPermissions::getOwnership(LLUUID& owner_id, BOOL& is_group_owned) const +bool LLPermissions::getOwnership(LLUUID& owner_id, bool& is_group_owned) const { if(mOwner.notNull()) { owner_id = mOwner; - is_group_owned = FALSE; - return TRUE; + is_group_owned = false; + return true; } else if(mIsGroupOwned) { owner_id = mGroup; - is_group_owned = TRUE; - return TRUE; + is_group_owned = true; + return true; } - return FALSE; + return false; } LLUUID LLPermissions::getSafeOwner() const @@ -232,13 +232,13 @@ void LLPermissions::accumulate(const LLPermissions& perm) // saves last owner, sets current owner, and sets the group. note // that this function has to more cleverly apply the fair use // permissions. -BOOL LLPermissions::setOwnerAndGroup( +bool LLPermissions::setOwnerAndGroup( const LLUUID& agent, const LLUUID& owner, const LLUUID& group, bool is_atomic) { - BOOL allowed = FALSE; + bool allowed = false; if( agent.isNull() || mOwner.isNull() || ((agent == mOwner) && ((owner == mOwner) || (mMaskOwner & PERM_TRANSFER)) ) ) @@ -246,7 +246,7 @@ BOOL LLPermissions::setOwnerAndGroup( // ...system can alway set owner // ...public objects can be claimed by anyone // ...otherwise, agent must own it and have transfer ability - allowed = TRUE; + allowed = true; } if (allowed) @@ -301,7 +301,7 @@ void LLPermissions::yesReallySetOwner(const LLUUID& owner, bool group_owned) mIsGroupOwned = group_owned; } -BOOL LLPermissions::deedToGroup(const LLUUID& agent, const LLUUID& group) +bool LLPermissions::deedToGroup(const LLUUID& agent, const LLUUID& group) { if(group.notNull() && (agent.isNull() || ((group == mGroup) && (mMaskOwner & PERM_TRANSFER) @@ -318,18 +318,18 @@ BOOL LLPermissions::deedToGroup(const LLUUID& agent, const LLUUID& group) mIsGroupOwned = true; fixFairUse(); fix(); - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLPermissions::setBaseBits(const LLUUID& agent, BOOL set, PermissionMask bits) +bool LLPermissions::setBaseBits(const LLUUID& agent, bool set, PermissionMask bits) { - BOOL ownership = FALSE; + bool ownership = false; if(agent.isNull()) { // only the system is always allowed to change base bits - ownership = TRUE; + ownership = true; } if (ownership) @@ -351,19 +351,19 @@ BOOL LLPermissions::setBaseBits(const LLUUID& agent, BOOL set, PermissionMask bi // Note: If you attempt to set bits that the base bits doesn't allow, // the function will succeed, but those bits will not be set. -BOOL LLPermissions::setOwnerBits(const LLUUID& agent, BOOL set, PermissionMask bits) +bool LLPermissions::setOwnerBits(const LLUUID& agent, bool set, PermissionMask bits) { - BOOL ownership = FALSE; + bool ownership = false; if(agent.isNull()) { // ...system always allowed to change things - ownership = TRUE; + ownership = true; } else if (agent == mOwner) { // ...owner bits can only be set by owner - ownership = TRUE; + ownership = true; } // If we have correct ownership and @@ -383,15 +383,15 @@ BOOL LLPermissions::setOwnerBits(const LLUUID& agent, BOOL set, PermissionMask b return (ownership); } -BOOL LLPermissions::setGroupBits(const LLUUID& agent, const LLUUID& group, BOOL set, PermissionMask bits) +bool LLPermissions::setGroupBits(const LLUUID& agent, const LLUUID& group, bool set, PermissionMask bits) { - BOOL ownership = FALSE; + bool ownership = false; if((agent.isNull()) || (agent == mOwner) || ((group == mGroup) && (!mGroup.isNull()))) { // The group bits can be set by the system, the owner, or a // group member. - ownership = TRUE; + ownership = true; } if (ownership) @@ -412,15 +412,15 @@ BOOL LLPermissions::setGroupBits(const LLUUID& agent, const LLUUID& group, BOOL // Note: If you attempt to set bits that the creator or owner doesn't allow, // the function will succeed, but those bits will not be set. -BOOL LLPermissions::setEveryoneBits(const LLUUID& agent, const LLUUID& group, BOOL set, PermissionMask bits) +bool LLPermissions::setEveryoneBits(const LLUUID& agent, const LLUUID& group, bool set, PermissionMask bits) { - BOOL ownership = FALSE; + bool ownership = false; if((agent.isNull()) || (agent == mOwner) || ((group == mGroup) && (!mGroup.isNull()))) { // The everyone bits can be set by the system, the owner, or a // group member. - ownership = TRUE; + ownership = true; } if (ownership) { @@ -441,15 +441,15 @@ BOOL LLPermissions::setEveryoneBits(const LLUUID& agent, const LLUUID& group, BO // Note: If you attempt to set bits that the creator or owner doesn't allow, // the function will succeed, but those bits will not be set. -BOOL LLPermissions::setNextOwnerBits(const LLUUID& agent, const LLUUID& group, BOOL set, PermissionMask bits) +bool LLPermissions::setNextOwnerBits(const LLUUID& agent, const LLUUID& group, bool set, PermissionMask bits) { - BOOL ownership = FALSE; + bool ownership = false; if((agent.isNull()) || (agent == mOwner) || ((group == mGroup) && (!mGroup.isNull()))) { // The next owner bits can be set by the system, the owner, or // a group member. - ownership = TRUE; + ownership = true; } if (ownership) { @@ -478,7 +478,7 @@ bool LLPermissions::allowOperationBy(PermissionBit op, const LLUUID& requester, { // ...system making request // ...not owned - return TRUE; + return true; } else if (mIsGroupOwned && (mGroup == requester)) { @@ -513,7 +513,7 @@ LLSD LLPermissions::packMessage() const result["group-mask"] = (S32)mMaskGroup; result["everyone-mask"] = (S32)mMaskEveryone; result["next-owner-mask"]= (S32)mMaskNextOwner; - result["group-owned"] = (BOOL)mIsGroupOwned; + result["group-owned"] = (bool)mIsGroupOwned; return result; } @@ -531,7 +531,7 @@ void LLPermissions::packMessage(LLMessageSystem* msg) const msg->addU32Fast(_PREHASH_GroupMask, mMaskGroup ); msg->addU32Fast(_PREHASH_EveryoneMask, mMaskEveryone ); msg->addU32Fast(_PREHASH_NextOwnerMask, mMaskNextOwner ); - msg->addBOOLFast(_PREHASH_GroupOwned, (BOOL)mIsGroupOwned); + msg->addBOOLFast(_PREHASH_GroupOwned, mIsGroupOwned); } void LLPermissions::unpackMessage(LLSD perms) @@ -559,13 +559,13 @@ void LLPermissions::unpackMessage(LLMessageSystem* msg, const char* block, S32 b msg->getU32Fast(block, _PREHASH_GroupMask, mMaskGroup, block_num ); msg->getU32Fast(block, _PREHASH_EveryoneMask, mMaskEveryone, block_num ); msg->getU32Fast(block, _PREHASH_NextOwnerMask, mMaskNextOwner, block_num ); - BOOL tmp; + bool tmp; msg->getBOOLFast(block, _PREHASH_GroupOwned, tmp, block_num); - mIsGroupOwned = (bool)tmp; + mIsGroupOwned = tmp; } -BOOL LLPermissions::importLegacyStream(std::istream& input_stream) +bool LLPermissions::importLegacyStream(std::istream& input_stream) { init(LLUUID::null, LLUUID::null, LLUUID::null, LLUUID::null); const S32 BUFSIZE = 16384; @@ -661,11 +661,11 @@ BOOL LLPermissions::importLegacyStream(std::istream& input_stream) } } fix(); - return TRUE; + return true; } -BOOL LLPermissions::exportLegacyStream(std::ostream& output_stream) const +bool LLPermissions::exportLegacyStream(std::ostream& output_stream) const { std::string uuid_str; @@ -701,12 +701,9 @@ BOOL LLPermissions::exportLegacyStream(std::ostream& output_stream) const output_stream << "\t\tgroup_owned\t1\n"; } output_stream << "\t}\n"; - return TRUE; + return true; } -// Deleted LLPermissions::exportFileXML() and LLPermissions::importXML() -// because I can't find any non-test code references to it. 2009-05-04 JC - bool LLPermissions::operator==(const LLPermissions &rhs) const { return @@ -791,21 +788,21 @@ U8 LLAggregatePermissions::getU8() const return byte; } -BOOL LLAggregatePermissions::isEmpty() const +bool LLAggregatePermissions::isEmpty() const { for(S32 i = 0; i < PI_END; ++i) { if(mBits[i] != AP_EMPTY) { - return FALSE; + return false; } } - return TRUE; + return true; } void LLAggregatePermissions::aggregate(PermissionMask mask) { - BOOL is_allowed = mask & PERM_COPY; + bool is_allowed = mask & PERM_COPY; aggregateBit(PI_COPY, is_allowed); is_allowed = mask & PERM_MODIFY; aggregateBit(PI_MODIFY, is_allowed); @@ -821,7 +818,7 @@ void LLAggregatePermissions::aggregate(const LLAggregatePermissions& ag) } } -void LLAggregatePermissions::aggregateBit(EPermIndex idx, BOOL allowed) +void LLAggregatePermissions::aggregateBit(EPermIndex idx, bool allowed) { //if(AP_SOME == mBits[idx]) return; // P4 branch prediction optimization switch(mBits[idx]) diff --git a/indra/llinventory/llpermissions.h b/indra/llinventory/llpermissions.h index b6071118ff..a68abcfa34 100644 --- a/indra/llinventory/llpermissions.h +++ b/indra/llinventory/llpermissions.h @@ -151,18 +151,18 @@ public: U32 getMaskEveryone() const { return mMaskEveryone; } U32 getMaskNextOwner() const { return mMaskNextOwner; } - // return TRUE if the object has any owner + // return true if the object has any owner bool isOwned() const { return (mOwner.notNull() || mIsGroupOwned); } - // return TRUE if group_id is owner. + // return true if group_id is owner. bool isGroupOwned() const { return mIsGroupOwned; } - // This API returns TRUE if the object is owned at all, and FALSE + // This API returns true if the object is owned at all, and false // otherwise. If it is owned at all, owner id is filled with // either the owner id or the group id, and the is_group_owned // parameter is appropriately filled. The values of owner_id and // is_group_owned are not changed if the object is not owned. - BOOL getOwnership(LLUUID& owner_id, BOOL& is_group_owned) const; + bool getOwnership(LLUUID& owner_id, bool& is_group_owned) const; // Gets the 'safe' owner. This should never return LLUUID::null. // If no group owned, return the agent owner id normally. @@ -218,7 +218,7 @@ public: // Currently, the only way to have a collection is when an object // has inventory and is then itself rolled up into an inventory // item. - BOOL setOwnerAndGroup(const LLUUID& agent, const LLUUID& owner, const LLUUID& group, bool is_atomic); + bool setOwnerAndGroup(const LLUUID& agent, const LLUUID& owner, const LLUUID& group, bool is_atomic); // only call this if you know what you're doing // there are usually perm-bit consequences when the @@ -237,18 +237,18 @@ public: // checked manipulators (since that is how it is used.) If the // agent is the system or (group == mGroup and group modify and // owner transfer) then this function will deed the permissions, - // set the next owner mask, and return TRUE. Otherwise, no change - // is effected, and the function returns FALSE. - BOOL deedToGroup(const LLUUID& agent, const LLUUID& group); - // Attempt to set or clear the given bitmask. Returns TRUE if you + // set the next owner mask, and return true. Otherwise, no change + // is effected, and the function returns false. + bool deedToGroup(const LLUUID& agent, const LLUUID& group); + // Attempt to set or clear the given bitmask. Returns true if you // are allowed to modify the permissions. If you attempt to turn // on bits not allowed by the base bits, the function will return - // TRUE, but those bits will not be set. - BOOL setBaseBits( const LLUUID& agent, BOOL set, PermissionMask bits); - BOOL setOwnerBits( const LLUUID& agent, BOOL set, PermissionMask bits); - BOOL setGroupBits( const LLUUID& agent, const LLUUID& group, BOOL set, PermissionMask bits); - BOOL setEveryoneBits(const LLUUID& agent, const LLUUID& group, BOOL set, PermissionMask bits); - BOOL setNextOwnerBits(const LLUUID& agent, const LLUUID& group, BOOL set, PermissionMask bits); + // true, but those bits will not be set. + bool setBaseBits( const LLUUID& agent, bool set, PermissionMask bits); + bool setOwnerBits( const LLUUID& agent, bool set, PermissionMask bits); + bool setGroupBits( const LLUUID& agent, const LLUUID& group, bool set, PermissionMask bits); + bool setEveryoneBits(const LLUUID& agent, const LLUUID& group, bool set, PermissionMask bits); + bool setNextOwnerBits(const LLUUID& agent, const LLUUID& group, bool set, PermissionMask bits); // This is currently only used in the Viewer to handle calling cards // where the creator is actually used to store the target. Use with care. @@ -270,6 +270,7 @@ public: inline bool allowModifyBy(const LLUUID &agent_id) const; inline bool allowCopyBy(const LLUUID& agent_id) const; inline bool allowMoveBy(const LLUUID& agent_id) const; + inline bool allowModifyBy(const LLUUID &agent_id, const LLUUID& group) const; inline bool allowCopyBy(const LLUUID& agent_id, const LLUUID& group) const; inline bool allowMoveBy(const LLUUID &agent_id, const LLUUID &group) const; @@ -278,27 +279,11 @@ public: // current owner is allowed to transfer to the specified agent id. inline bool allowTransferTo(const LLUUID &agent_id) const; - // - // DEPRECATED. - // - // These return true if the given agent can perform the function. - // They also return true if the object isn't owned, or the - // requesting agent is a system agent. See llpermissionsflags.h - // for bits. - //BOOL allowDeleteBy(const LLUUID& agent_id) const { return allowModifyBy(agent_id); } - //BOOL allowEditBy(const LLUUID& agent_id) const { return allowModifyBy(agent_id); } - // saves last owner and sets current owner - //BOOL setOwner(const LLUUID& agent, const LLUUID& owner); - // This method saves the last owner, sets the current owner to the - // one provided, and sets the base mask as indicated. - //BOOL setOwner(const LLUUID& agent, const LLUUID& owner, U32 new_base_mask); - - // Attempt to set or clear the given bitmask. Returns TRUE if you - // are allowed to modify the permissions. If you attempt to turn - // on bits not allowed by the base bits, the function will return - // TRUE, but those bits will not be set. - //BOOL setGroupBits( const LLUUID& agent, BOOL set, PermissionMask bits); - //BOOL setEveryoneBits(const LLUUID& agent, BOOL set, PermissionMask bits); + // Returns true if the object can exported by the given agent + // (e.g. saved as a local .gltf file) + // The current test should return true if the agent is the owner + // AND the creator of the object. + inline bool allowExportBy(const LLUUID& agent_id) const; // // MISC METHODS and OPERATORS @@ -311,8 +296,8 @@ public: void packMessage(LLMessageSystem* msg) const; void unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0); - BOOL importLegacyStream(std::istream& input_stream); - BOOL exportLegacyStream(std::ostream& output_stream) const; + bool importLegacyStream(std::istream& input_stream); + bool exportLegacyStream(std::ostream& output_stream) const; bool operator==(const LLPermissions &rhs) const; bool operator!=(const LLPermissions &rhs) const; @@ -353,6 +338,11 @@ bool LLPermissions::allowMoveBy(const LLUUID& agent) const return allowOperationBy(PERM_MOVE, agent, LLUUID::null); } +bool LLPermissions::allowExportBy(const LLUUID& agent) const +{ + return agent == mOwner && agent == mCreator; +} + bool LLPermissions::allowTransferTo(const LLUUID &agent_id) const { if (mIsGroupOwned) @@ -361,7 +351,7 @@ bool LLPermissions::allowTransferTo(const LLUUID &agent_id) const } else { - return ((mOwner == agent_id) ? TRUE : allowOperationBy(PERM_TRANSFER, mOwner)); + return ((mOwner == agent_id) ? true : allowOperationBy(PERM_TRANSFER, mOwner)); } } @@ -401,8 +391,8 @@ public: // LSB is to the right U8 getU8() const; - // return TRUE is the aggregate permissions are empty, otherwise FALSE. - BOOL isEmpty() const ; + // return true is the aggregate permissions are empty, otherwise false. + bool isEmpty() const ; // pass in a PERM_COPY, PERM_TRANSFER, etc, and an EValue // enumeration to specifically set that value. Not implemented @@ -432,7 +422,7 @@ protected: PI_END = 3, PI_COUNT = 3 }; - void aggregateBit(EPermIndex idx, BOOL allowed); + void aggregateBit(EPermIndex idx, bool allowed); void aggregateIndex(EPermIndex idx, U8 bits); static EPermIndex perm2PermIndex(PermissionBit bit); diff --git a/indra/llinventory/llsaleinfo.cpp b/indra/llinventory/llsaleinfo.cpp index d38ffcc4bf..98836b178e 100644 --- a/indra/llinventory/llsaleinfo.cpp +++ b/indra/llinventory/llsaleinfo.cpp @@ -66,7 +66,7 @@ LLSaleInfo::LLSaleInfo(EForSale sale_type, S32 sale_price) : mSalePrice = llclamp(mSalePrice, 0, S32_MAX); } -BOOL LLSaleInfo::isForSale() const +bool LLSaleInfo::isForSale() const { return (FS_NOT != mSaleType); } @@ -78,13 +78,13 @@ U32 LLSaleInfo::getCRC32() const return rv; } -BOOL LLSaleInfo::exportLegacyStream(std::ostream& output_stream) const +bool LLSaleInfo::exportLegacyStream(std::ostream& output_stream) const { output_stream << "\tsale_info\t0\n\t{\n"; output_stream << "\t\tsale_type\t" << lookup(mSaleType) << "\n"; output_stream << "\t\tsale_price\t" << mSalePrice << "\n"; output_stream <<"\t}\n"; - return TRUE; + return true; } LLSD LLSaleInfo::asLLSD() const @@ -95,7 +95,7 @@ LLSD LLSaleInfo::asLLSD() const return sd; } -bool LLSaleInfo::fromLLSD(const LLSD& sd, BOOL& has_perm_mask, U32& perm_mask) +bool LLSaleInfo::fromLLSD(const LLSD& sd, bool& has_perm_mask, U32& perm_mask) { const char *w; @@ -113,22 +113,22 @@ bool LLSaleInfo::fromLLSD(const LLSD& sd, BOOL& has_perm_mask, U32& perm_mask) w = "perm_mask"; if (sd.has(w)) { - has_perm_mask = TRUE; + has_perm_mask = true; perm_mask = ll_U32_from_sd(sd[w]); } return true; } -BOOL LLSaleInfo::importLegacyStream(std::istream& input_stream, BOOL& has_perm_mask, U32& perm_mask) +bool LLSaleInfo::importLegacyStream(std::istream& input_stream, bool& has_perm_mask, U32& perm_mask) { - has_perm_mask = FALSE; + has_perm_mask = false; // *NOTE: Changing the buffer size will require changing the scanf // calls below. char buffer[MAX_STRING]; /* Flawfinder: ignore */ char keyword[MAX_STRING]; /* Flawfinder: ignore */ char valuestr[MAX_STRING]; /* Flawfinder: ignore */ - BOOL success = TRUE; + bool success = true; keyword[0] = '\0'; valuestr[0] = '\0'; @@ -163,7 +163,7 @@ BOOL LLSaleInfo::importLegacyStream(std::istream& input_stream, BOOL& has_perm_m else if (!strcmp("perm_mask", keyword)) { //LL_INFOS() << "found deprecated keyword perm_mask" << LL_ENDL; - has_perm_mask = TRUE; + has_perm_mask = true; sscanf(valuestr, "%x", &perm_mask); } else diff --git a/indra/llinventory/llsaleinfo.h b/indra/llinventory/llsaleinfo.h index 961b6f4236..44eb841641 100644 --- a/indra/llinventory/llsaleinfo.h +++ b/indra/llinventory/llsaleinfo.h @@ -74,7 +74,7 @@ public: LLSaleInfo(EForSale sale_type, S32 sale_price); // accessors - BOOL isForSale() const; + bool isForSale() const; EForSale getSaleType() const { return mSaleType; } S32 getSalePrice() const { return mSalePrice; } U32 getCRC32() const; @@ -84,11 +84,11 @@ public: void setSalePrice(S32 price); //void setNextOwnerPermMask(U32 mask) { mNextOwnerPermMask = mask; } - BOOL exportLegacyStream(std::ostream& output_stream) const; + bool exportLegacyStream(std::ostream& output_stream) const; LLSD asLLSD() const; operator LLSD() const { return asLLSD(); } - bool fromLLSD(const LLSD& sd, BOOL& has_perm_mask, U32& perm_mask); - BOOL importLegacyStream(std::istream& input_stream, BOOL& has_perm_mask, U32& perm_mask); + bool fromLLSD(const LLSD& sd, bool& has_perm_mask, U32& perm_mask); + bool importLegacyStream(std::istream& input_stream, bool& has_perm_mask, U32& perm_mask); LLSD packMessage() const; void unpackMessage(LLSD sales); diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index ef6a187d06..2ff1cc74c6 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -111,10 +111,10 @@ const LLSettingsDay::Seconds LLSettingsDay::MINIMUM_DAYOFFSET(0); const LLSettingsDay::Seconds LLSettingsDay::DEFAULT_DAYOFFSET(57600); // +16 hours == -8 hours (SLT time offset) const LLSettingsDay::Seconds LLSettingsDay::MAXIMUM_DAYOFFSET(86400); // 24 hours -const S32 LLSettingsDay::TRACK_WATER(0); // water track is 0 -const S32 LLSettingsDay::TRACK_GROUND_LEVEL(1); -const S32 LLSettingsDay::TRACK_MAX(5); // 5 tracks, 4 skys, 1 water -const S32 LLSettingsDay::FRAME_MAX(56); +const U32 LLSettingsDay::TRACK_WATER(0); // water track is 0 +const U32 LLSettingsDay::TRACK_GROUND_LEVEL(1); +const U32 LLSettingsDay::TRACK_MAX(5); // 5 tracks, 4 skys, 1 water +const U32 LLSettingsDay::FRAME_MAX(56); const F32 LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR(0.02501f); @@ -462,7 +462,7 @@ namespace // Trim extra tracks. while (value.size() > LLSettingsDay::TRACK_MAX) { - value.erase(value.size() - 1); + value.erase(static_cast<LLSD::Integer>(value.size()) - 1); } S32 framecount(0); @@ -511,7 +511,7 @@ namespace } - int waterTracks = value[0].size(); + int waterTracks = static_cast<int>(value[0].size()); int skyTracks = framecount - waterTracks; if (waterTracks < 1) diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index 4a46eba6fe..917b0870f2 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -59,10 +59,10 @@ public: static const Seconds DEFAULT_DAYOFFSET; static const Seconds MAXIMUM_DAYOFFSET; - static const S32 TRACK_WATER; - static const S32 TRACK_GROUND_LEVEL; - static const S32 TRACK_MAX; - static const S32 FRAME_MAX; + static const U32 TRACK_WATER; + static const U32 TRACK_GROUND_LEVEL; + static const U32 TRACK_MAX; + static const U32 FRAME_MAX; static const F32 DEFAULT_FRAME_SLOP_FACTOR; diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 222ab040cb..40bb337a48 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -62,7 +62,7 @@ public: static const std::string SETTING_DOME_OFFSET; static const std::string SETTING_DOME_RADIUS; static const std::string SETTING_GAMMA; - static const std::string SETTING_GLOW; + static const std::string SETTING_GLOW; static const std::string SETTING_LIGHT_NORMAL; static const std::string SETTING_MAX_Y; static const std::string SETTING_MOON_ROTATION; @@ -92,7 +92,7 @@ public: static const std::string SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR; static const std::string SETTING_DENSITY_PROFILE_LINEAR_TERM; static const std::string SETTING_DENSITY_PROFILE_CONSTANT_TERM; - + static const std::string SETTING_SKY_MOISTURE_LEVEL; static const std::string SETTING_SKY_DROPLET_RADIUS; static const std::string SETTING_SKY_ICE_LEVEL; @@ -117,7 +117,7 @@ public: virtual std::string getSettingsType() const SETTINGS_OVERRIDE { return std::string("sky"); } virtual LLSettingsType::type_e getSettingsTypeValue() const SETTINGS_OVERRIDE { return LLSettingsType::ST_SKY; } - // Settings status + // Settings status virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf) SETTINGS_OVERRIDE; virtual void replaceSettings(LLSD settings) SETTINGS_OVERRIDE; @@ -129,7 +129,7 @@ public: F32 getSkyBottomRadius() const; F32 getSkyTopRadius() const; F32 getSunArcRadians() const; - F32 getMieAnisotropy() const; + F32 getMieAnisotropy() const; F32 getSkyMoistureLevel() const; F32 getSkyDropletRadius() const; @@ -196,7 +196,7 @@ public: F32 getCloudShadow() const; void setCloudShadow(F32 val); - + F32 getCloudVariance() const; void setCloudVariance(F32 val); @@ -295,7 +295,7 @@ public: // color based on brightness LLColor3 getMoonlightColor() const; - + LLColor4 getMoonAmbient() const; LLColor3 getMoonDiffuse() const; LLColor4 getSunAmbient() const; diff --git a/indra/llinventory/lltransactionflags.cpp b/indra/llinventory/lltransactionflags.cpp index fc3e684a65..3719a295c3 100644 --- a/indra/llinventory/lltransactionflags.cpp +++ b/indra/llinventory/lltransactionflags.cpp @@ -38,7 +38,7 @@ const U8 TRANSACTION_FLAG_OWNER_GROUP = 4; const U8 TRANSACTION_FLAG_SIMULTANEOUS_CONTRIBUTION = 8; const U8 TRANSACTION_FLAG_SIMULTANEOUS_CONTRIBUTION_REMOVAL = 16; -U8 pack_transaction_flags(BOOL is_source_group, BOOL is_dest_group) +U8 pack_transaction_flags(bool is_source_group, bool is_dest_group) { U8 rv = 0; if(is_source_group) rv |= TRANSACTION_FLAG_SOURCE_GROUP; @@ -46,17 +46,17 @@ U8 pack_transaction_flags(BOOL is_source_group, BOOL is_dest_group) return rv; } -BOOL is_tf_source_group(TransactionFlags flags) +bool is_tf_source_group(TransactionFlags flags) { return ((flags & TRANSACTION_FLAG_SOURCE_GROUP) == TRANSACTION_FLAG_SOURCE_GROUP); } -BOOL is_tf_dest_group(TransactionFlags flags) +bool is_tf_dest_group(TransactionFlags flags) { return ((flags & TRANSACTION_FLAG_DEST_GROUP) == TRANSACTION_FLAG_DEST_GROUP); } -BOOL is_tf_owner_group(TransactionFlags flags) +bool is_tf_owner_group(TransactionFlags flags) { return ((flags & TRANSACTION_FLAG_OWNER_GROUP) == TRANSACTION_FLAG_OWNER_GROUP); } @@ -79,6 +79,7 @@ void append_reason( break; case TRANS_GROUP_LAND_DEED: ostr << " for deeding land"; + break; default: break; } diff --git a/indra/llinventory/lltransactionflags.h b/indra/llinventory/lltransactionflags.h index bb267ad2be..3c61b785a3 100644 --- a/indra/llinventory/lltransactionflags.h +++ b/indra/llinventory/lltransactionflags.h @@ -39,10 +39,10 @@ extern const TransactionFlags TRANSACTION_FLAG_SIMULTANEOUS_CONTRIBUTION; extern const TransactionFlags TRANSACTION_FLAG_SIMULTANEOUS_CONTRIBUTION_REMOVAL; // very simple helper functions -TransactionFlags pack_transaction_flags(BOOL is_source_group, BOOL is_dest_group); -BOOL is_tf_source_group(TransactionFlags flags); -BOOL is_tf_dest_group(TransactionFlags flags); -BOOL is_tf_owner_group(TransactionFlags flags); +TransactionFlags pack_transaction_flags(bool is_source_group, bool is_dest_group); +bool is_tf_source_group(TransactionFlags flags); +bool is_tf_dest_group(TransactionFlags flags); +bool is_tf_owner_group(TransactionFlags flags); // stupid helper functions which should be replaced with some kind of // internationalizeable message. diff --git a/indra/llinventory/tests/inventorymisc_test.cpp b/indra/llinventory/tests/inventorymisc_test.cpp index a2a6aa339f..bcf6131bd8 100644 --- a/indra/llinventory/tests/inventorymisc_test.cpp +++ b/indra/llinventory/tests/inventorymisc_test.cpp @@ -374,7 +374,7 @@ namespace tut LLPointer<LLInventoryItem> src1 = create_random_inventory_item(); std::ostringstream ostream; - src1->exportLegacyStream(ostream, TRUE); + src1->exportLegacyStream(ostream, true); std::istringstream istream(ostream.str()); LLPointer<LLInventoryItem> src2 = new LLInventoryItem(); @@ -496,7 +496,7 @@ namespace tut LLPointer<LLInventoryCategory> src1 = create_random_inventory_cat(); std::ostringstream ostream; - src1->exportLegacyStream(ostream, TRUE); + src1->exportLegacyStream(ostream, true); std::istringstream istream(ostream.str()); LLPointer<LLInventoryCategory> src2 = new LLInventoryCategory(); diff --git a/indra/llkdu/llimagej2ckdu.cpp b/indra/llkdu/llimagej2ckdu.cpp index c51650a470..bf7cfbe071 100644 --- a/indra/llkdu/llimagej2ckdu.cpp +++ b/indra/llkdu/llimagej2ckdu.cpp @@ -277,6 +277,8 @@ void transfer_bytes(kdu_byte *dest, kdu_line_buf &src, int gap, int precision); // as well, when that still existed, with keep_codestream true and MODE_FAST. void LLImageJ2CKDU::setupCodeStream(LLImageJ2C &base, bool keep_codestream, ECodeStreamMode mode) { + LLImageDataLock lock(&base); + S32 data_size = base.getDataSize(); S32 max_bytes = (base.getMaxBytes() ? base.getMaxBytes() : data_size); @@ -512,8 +514,13 @@ bool LLImageJ2CKDU::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco bool LLImageJ2CKDU::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count) { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; + + LLImageDataLock lockIn(&base); + LLImageDataLock lockOut(&raw_image); + ECodeStreamMode mode = MODE_FAST; + bool limit_time = decode_time > 0.0f; LLTimer decode_timer; if (!mCodeStreamp->exists()) @@ -528,7 +535,7 @@ bool LLImageJ2CKDU::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco // These can probably be grabbed from what's saved in the class. kdu_dims dims; - mCodeStreamp->get_dims(0,dims); + mCodeStreamp->get_dims(0, dims); // Now we are ready to walk through the tiles processing them one-by-one. kdu_byte *buffer = raw_image.getData(); @@ -578,16 +585,18 @@ bool LLImageJ2CKDU::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco mCodeStreamp.get())); } // Do the actual processing - F32 remaining_time = decode_time - decode_timer.getElapsedTimeF32(); + F32 remaining_time = limit_time ? decode_time - decode_timer.getElapsedTimeF32().value() : 0.0f; // This is where we do the actual decode. If we run out of time, return false. - if (mDecodeState->processTileDecode(remaining_time, (decode_time > 0.0f))) + if (mDecodeState->processTileDecode(remaining_time, limit_time)) { mDecodeState.reset(); } else { // Not finished decoding yet. - // setLastError("Ran out of time while decoding"); + base.setLastError("Ran out of time while decoding"); + base.decodeFailed(); + cleanupCodeStream(); return false; } } diff --git a/indra/llmath/llbbox.cpp b/indra/llmath/llbbox.cpp index c4dffc8cf8..fa1253e421 100644 --- a/indra/llmath/llbbox.cpp +++ b/indra/llmath/llbbox.cpp @@ -38,7 +38,7 @@ void LLBBox::addPointLocal(const LLVector3& p) { mMinLocal = p; mMaxLocal = p; - mEmpty = FALSE; + mEmpty = false; } else { @@ -140,7 +140,7 @@ LLVector3 LLBBox::agentToLocalBasis(const LLVector3& v) const return v * m; } -BOOL LLBBox::containsPointLocal(const LLVector3& p) const +bool LLBBox::containsPointLocal(const LLVector3& p) const { if ( (p.mV[VX] < mMinLocal.mV[VX]) ||(p.mV[VX] > mMaxLocal.mV[VX]) @@ -149,12 +149,12 @@ BOOL LLBBox::containsPointLocal(const LLVector3& p) const ||(p.mV[VZ] < mMinLocal.mV[VZ]) ||(p.mV[VZ] > mMaxLocal.mV[VZ])) { - return FALSE; + return false; } - return TRUE; + return true; } -BOOL LLBBox::containsPointAgent(const LLVector3& p) const +bool LLBBox::containsPointAgent(const LLVector3& p) const { LLVector3 point_local = agentToLocal(p); return containsPointLocal(point_local); diff --git a/indra/llmath/llbbox.h b/indra/llmath/llbbox.h index aac8628762..5617eaebde 100644 --- a/indra/llmath/llbbox.h +++ b/indra/llmath/llbbox.h @@ -37,13 +37,13 @@ class LLBBox { public: - LLBBox() {mEmpty = TRUE;} + LLBBox() {mEmpty = true;} LLBBox( const LLVector3& pos_agent, const LLQuaternion& rot, const LLVector3& min_local, const LLVector3& max_local ) : - mMinLocal( min_local ), mMaxLocal( max_local ), mPosAgent(pos_agent), mRotation( rot), mEmpty( TRUE ) + mMinLocal( min_local ), mMaxLocal( max_local ), mPosAgent(pos_agent), mRotation( rot), mEmpty( true ) {} // Default copy constructor is OK. @@ -64,8 +64,8 @@ public: LLVector3 getExtentLocal() const { return mMaxLocal - mMinLocal; } - BOOL containsPointLocal(const LLVector3& p) const; - BOOL containsPointAgent(const LLVector3& p) const; + bool containsPointLocal(const LLVector3& p) const; + bool containsPointAgent(const LLVector3& p) const; void addPointAgent(LLVector3 p); void addBBoxAgent(const LLBBox& b); @@ -92,7 +92,7 @@ private: LLVector3 mMaxLocal; LLVector3 mPosAgent; // Position relative to Agent's Region LLQuaternion mRotation; - BOOL mEmpty; // Nothing has been added to this bbox yet + bool mEmpty; // Nothing has been added to this bbox yet }; //LLBBox operator*(const LLBBox &a, const LLMatrix4 &b); diff --git a/indra/llmath/llcoordframe.h b/indra/llmath/llcoordframe.h index 802b98425a..aaa701f792 100644 --- a/indra/llmath/llcoordframe.h +++ b/indra/llmath/llcoordframe.h @@ -61,7 +61,7 @@ public: //LLCoordFrame(const F32 *origin, const F32 *rotation); // Assumes "origin" is 1x3 and "rotation" is 1x9 array //LLCoordFrame(const F32 *origin_and_rotation); // Assumes "origin_and_rotation" is 1x12 array - BOOL isFinite() { return mOrigin.isFinite() && mXAxis.isFinite() && mYAxis.isFinite() && mZAxis.isFinite(); } + bool isFinite() { return mOrigin.isFinite() && mXAxis.isFinite() && mYAxis.isFinite() && mZAxis.isFinite(); } void reset(); void resetAxes(); diff --git a/indra/llmath/llinterp.h b/indra/llmath/llinterp.h index 116e949663..f4faa82a82 100644 --- a/indra/llmath/llinterp.h +++ b/indra/llmath/llinterp.h @@ -41,7 +41,6 @@ class LLInterpVal { public: virtual ~LLInterpVal() {} - virtual void interp(LLInterpVal &target, const F32 frac); // Linear interpolation for each type }; template <typename Type> @@ -52,7 +51,7 @@ public: virtual ~LLInterp() {} virtual void start(); - void update(const F32 time); + virtual void update(const F32 time) = 0; const Type &getCurVal() const; void setStartVal(const Type &start_val); @@ -67,15 +66,15 @@ public: void setEndTime(const F32 time); F32 getEndTime() const; - BOOL isActive() const; - BOOL isDone() const; + bool isActive() const; + bool isDone() const; protected: F32 mStartTime; F32 mEndTime; F32 mDuration; - BOOL mActive; - BOOL mDone; + bool mActive; + bool mDone; Type mStartVal; Type mEndVal; @@ -88,8 +87,8 @@ template <typename Type> class LLInterpLinear : public LLInterp<Type> { public: - /*virtual*/ void start(); - void update(const F32 time); + void start() override; + void update(const F32 time) override; F32 getCurFrac() const; protected: F32 mCurFrac; @@ -108,10 +107,10 @@ class LLInterpAttractor : public LLInterp<Type> { public: LLInterpAttractor(); - /*virtual*/ void start(); + void start() override; void setStartVel(const Type &vel); void setForce(const F32 force); - void update(const F32 time); + void update(const F32 time) override; protected: F32 mForce; Type mStartVel; @@ -123,7 +122,7 @@ class LLInterpFunc : public LLInterp<Type> { public: LLInterpFunc(); - void update(const F32 time); + void update(const F32 time) override; void setFunc(Type (*)(const F32, void *data), void *data); protected: @@ -151,8 +150,8 @@ LLInterp<Type>::LLInterp() mEndTime = 1.f; mDuration = 1.f; mCurTime = 0.f; - mDone = FALSE; - mActive = FALSE; + mDone = false; + mActive = false; } template <class Type> @@ -166,8 +165,8 @@ void LLInterp<Type>::start() { mCurVal = mStartVal; mCurTime = mStartTime; - mDone = FALSE; - mActive = FALSE; + mDone = false; + mActive = false; } template <class Type> @@ -225,13 +224,13 @@ F32 LLInterp<Type>::getEndTime() const template <class Type> -BOOL LLInterp<Type>::isDone() const +bool LLInterp<Type>::isDone() const { return mDone; } template <class Type> -BOOL LLInterp<Type>::isActive() const +bool LLInterp<Type>::isActive() const { return mActive; } @@ -254,7 +253,7 @@ void LLInterpLinear<Type>::update(const F32 time) F32 dfrac = target_frac - this->mCurFrac; if (target_frac >= 0.f) { - this->mActive = TRUE; + this->mActive = true; } if (target_frac > 1.f) @@ -262,7 +261,7 @@ void LLInterpLinear<Type>::update(const F32 time) this->mCurVal = this->mEndVal; this->mCurFrac = 1.f; this->mCurTime = time; - this->mDone = TRUE; + this->mDone = true; return; } @@ -332,7 +331,7 @@ void LLInterpAttractor<Type>::update(const F32 time) { if (time > this->mStartTime) { - this->mActive = TRUE; + this->mActive = true; } else { @@ -340,7 +339,7 @@ void LLInterpAttractor<Type>::update(const F32 time) } if (time > this->mEndTime) { - this->mDone = TRUE; + this->mDone = true; return; } @@ -362,8 +361,8 @@ void LLInterpAttractor<Type>::update(const F32 time) template <class Type> LLInterpFunc<Type>::LLInterpFunc() : LLInterp<Type>() { - mFunc = NULL; - mData = NULL; + mFunc = nullptr; + mData = nullptr; } template <class Type> @@ -378,7 +377,7 @@ void LLInterpFunc<Type>::update(const F32 time) { if (time > this->mStartTime) { - this->mActive = TRUE; + this->mActive = true; } else { @@ -386,7 +385,7 @@ void LLInterpFunc<Type>::update(const F32 time) } if (time > this->mEndTime) { - this->mDone = TRUE; + this->mDone = true; return; } @@ -405,7 +404,7 @@ void LLInterpExp<Type>::update(const F32 time) F32 target_frac = (time - this->mStartTime) / this->mDuration; if (target_frac >= 0.f) { - this->mActive = TRUE; + this->mActive = true; } if (target_frac > 1.f) @@ -413,7 +412,7 @@ void LLInterpExp<Type>::update(const F32 time) this->mCurVal = this->mEndVal; this->mCurFrac = 1.f; this->mCurTime = time; - this->mDone = TRUE; + this->mDone = true; return; } diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h index f425b590e4..fa315291a3 100644 --- a/indra/llmath/llmath.h +++ b/indra/llmath/llmath.h @@ -59,34 +59,34 @@ #define tanf(x) ((F32)tan((F64)(x))) #endif*/ -const F32 GRAVITY = -9.8f; +constexpr F32 GRAVITY = -9.8f; // mathematical constants -const F32 F_PI = 3.1415926535897932384626433832795f; -const F32 F_TWO_PI = 6.283185307179586476925286766559f; -const F32 F_PI_BY_TWO = 1.5707963267948966192313216916398f; -const F32 F_SQRT_TWO_PI = 2.506628274631000502415765284811f; -const F32 F_E = 2.71828182845904523536f; -const F32 F_SQRT2 = 1.4142135623730950488016887242097f; -const F32 F_SQRT3 = 1.73205080756888288657986402541f; -const F32 OO_SQRT2 = 0.7071067811865475244008443621049f; -const F32 OO_SQRT3 = 0.577350269189625764509f; -const F32 DEG_TO_RAD = 0.017453292519943295769236907684886f; -const F32 RAD_TO_DEG = 57.295779513082320876798154814105f; -const F32 F_APPROXIMATELY_ZERO = 0.00001f; -const F32 F_LN10 = 2.3025850929940456840179914546844f; -const F32 OO_LN10 = 0.43429448190325182765112891891661; -const F32 F_LN2 = 0.69314718056f; -const F32 OO_LN2 = 1.4426950408889634073599246810019f; - -const F32 F_ALMOST_ZERO = 0.0001f; -const F32 F_ALMOST_ONE = 1.0f - F_ALMOST_ZERO; - -const F32 GIMBAL_THRESHOLD = 0.000436f; // sets the gimballock threshold 0.025 away from +/-90 degrees +constexpr F32 F_PI = 3.1415926535897932384626433832795f; +constexpr F32 F_TWO_PI = 6.283185307179586476925286766559f; +constexpr F32 F_PI_BY_TWO = 1.5707963267948966192313216916398f; +constexpr F32 F_SQRT_TWO_PI = 2.506628274631000502415765284811f; +constexpr F32 F_E = 2.71828182845904523536f; +constexpr F32 F_SQRT2 = 1.4142135623730950488016887242097f; +constexpr F32 F_SQRT3 = 1.73205080756888288657986402541f; +constexpr F32 OO_SQRT2 = 0.7071067811865475244008443621049f; +constexpr F32 OO_SQRT3 = 0.577350269189625764509f; +constexpr F32 DEG_TO_RAD = 0.017453292519943295769236907684886f; +constexpr F32 RAD_TO_DEG = 57.295779513082320876798154814105f; +constexpr F32 F_APPROXIMATELY_ZERO = 0.00001f; +constexpr F32 F_LN10 = 2.3025850929940456840179914546844f; +constexpr F32 OO_LN10 = 0.43429448190325182765112891891661; +constexpr F32 F_LN2 = 0.69314718056f; +constexpr F32 OO_LN2 = 1.4426950408889634073599246810019f; + +constexpr F32 F_ALMOST_ZERO = 0.0001f; +constexpr F32 F_ALMOST_ONE = 1.0f - F_ALMOST_ZERO; + +constexpr F32 GIMBAL_THRESHOLD = 0.000436f; // sets the gimballock threshold 0.025 away from +/-90 degrees // formula: GIMBAL_THRESHOLD = sin(DEG_TO_RAD * gimbal_threshold_angle); // BUG: Eliminate in favor of F_APPROXIMATELY_ZERO above? -const F32 FP_MAG_THRESHOLD = 0.0000001f; +constexpr F32 FP_MAG_THRESHOLD = 0.0000001f; // TODO: Replace with logic like is_approx_equal inline bool is_approx_zero( F32 f ) { return (-F_APPROXIMATELY_ZERO < f) && (f < F_APPROXIMATELY_ZERO); } @@ -123,13 +123,13 @@ inline bool is_zero(F32 x) inline bool is_approx_equal(F32 x, F32 y) { - const S32 COMPARE_MANTISSA_UP_TO_BIT = 0x02; + constexpr S32 COMPARE_MANTISSA_UP_TO_BIT = 0x02; return (std::abs((S32) ((U32&)x - (U32&)y) ) < COMPARE_MANTISSA_UP_TO_BIT); } inline bool is_approx_equal(F64 x, F64 y) { - const S64 COMPARE_MANTISSA_UP_TO_BIT = 0x02; + constexpr S64 COMPARE_MANTISSA_UP_TO_BIT = 0x02; return (std::abs((S32) ((U64&)x - (U64&)y) ) < COMPARE_MANTISSA_UP_TO_BIT); } @@ -272,8 +272,8 @@ inline F64 ll_round( F64 val, F64 nearest ) // peak error = -31.4 dB // RMS error = -28.1 dB -const F32 FAST_MAG_ALPHA = 0.960433870103f; -const F32 FAST_MAG_BETA = 0.397824734759f; +constexpr F32 FAST_MAG_ALPHA = 0.960433870103f; +constexpr F32 FAST_MAG_BETA = 0.397824734759f; // these provide minimum RMS error // @@ -281,8 +281,8 @@ const F32 FAST_MAG_BETA = 0.397824734759f; // peak error = -32.6 dB // RMS error = -25.7 dB // -//const F32 FAST_MAG_ALPHA = 0.948059448969f; -//const F32 FAST_MAG_BETA = 0.392699081699f; +//constexpr F32 FAST_MAG_ALPHA = 0.948059448969f; +//constexpr F32 FAST_MAG_BETA = 0.392699081699f; inline F32 fastMagnitude(F32 a, F32 b) { @@ -299,8 +299,8 @@ inline F32 fastMagnitude(F32 a, F32 b) // // Culled from www.stereopsis.com/FPU.html -const F64 LL_DOUBLE_TO_FIX_MAGIC = 68719476736.0*1.5; //2^36 * 1.5, (52-_shiftamt=36) uses limited precisicion to floor -const S32 LL_SHIFT_AMOUNT = 16; //16.16 fixed point representation, +constexpr F64 LL_DOUBLE_TO_FIX_MAGIC = 68719476736.0*1.5; //2^36 * 1.5, (52-_shiftamt=36) uses limited precisicion to floor +constexpr S32 LL_SHIFT_AMOUNT = 16; //16.16 fixed point representation, // Endian dependent code #ifdef LL_LITTLE_ENDIAN @@ -517,7 +517,7 @@ inline void ll_remove_outliers(std::vector<VEC_TYPE>& data, F32 k) i++; } - S32 j = data.size()-1; + size_t j = data.size()-1; while (j > 0 && data[j] > max) { j--; diff --git a/indra/llmath/llmatrix4a.h b/indra/llmath/llmatrix4a.h index cf4e522467..3b423f783a 100644 --- a/indra/llmath/llmatrix4a.h +++ b/indra/llmath/llmatrix4a.h @@ -46,6 +46,34 @@ public: loadu(val); } + explicit LLMatrix4a(const F32* val) + { + loadu(val); + } + + static const LLMatrix4a& identity() + { + static const F32 v[] = + { 1.f, 0.f, 0.f, 0.f, + 0.f, 1.f, 0.f, 0.f, + 0.f, 0.f, 1.f, 0.f, + 0.f, 0.f, 0.f, 1.f + }; + static LLMatrix4a identity_mat(v); + + return identity_mat; + } + + bool operator==(const LLMatrix4a& rhs) const + { + return mMatrix[0] == rhs.mMatrix[0] && mMatrix[1] == rhs.mMatrix[1] && mMatrix[2] == rhs.mMatrix[2] && mMatrix[3] == rhs.mMatrix[3]; + } + + bool operator!=(const LLMatrix4a& rhs) const + { + return !(*this == rhs); + } + inline F32* getF32ptr() { return (F32*) &mMatrix; diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h index 88ba006269..eaa2763d2d 100644 --- a/indra/llmath/lloctree.h +++ b/indra/llmath/lloctree.h @@ -453,7 +453,7 @@ public: S32 i = data->getBinIndex(); - if (i >= 0 && i < getElementCount()) + if (i >= 0 && i < (S32)getElementCount()) { if (mData[i] == data) { //found it @@ -548,7 +548,7 @@ public: } } - void addChild(oct_node* child, BOOL silent = FALSE) + void addChild(oct_node* child, bool silent = false) { #if LL_OCTREE_PARANOIA_CHECK @@ -591,7 +591,7 @@ public: } } - void removeChild(S32 index, BOOL destroy = FALSE) + void removeChild(S32 index, bool destroy = false) { for (U32 i = 0; i < this->getListenerCount(); i++) { @@ -638,7 +638,7 @@ public: { if (getChild(i) == node) { - removeChild(i, TRUE); + removeChild(i, true); return; } } @@ -707,7 +707,7 @@ public: //(don't notify listeners of addition) for (U32 i = 0; i < child->getChildCount(); i++) { - this->addChild(child->getChild(i), TRUE); + this->addChild(child->getChild(i), true); } //destroy child @@ -723,7 +723,7 @@ public: // LLOctreeRoot::insert bool insert(T* data) override { - if (data == NULL) + if (data == nullptr) { OCT_ERRS << "!!! INVALID ELEMENT ADDED TO OCTREE ROOT !!!" << LL_ENDL; return false; diff --git a/indra/llmath/llquaternion.cpp b/indra/llmath/llquaternion.cpp index ce0a88c26f..aefb82b2f0 100644 --- a/indra/llmath/llquaternion.cpp +++ b/indra/llmath/llquaternion.cpp @@ -653,14 +653,14 @@ LLQuaternion slerp( F32 u, const LLQuaternion &a, const LLQuaternion &b ) F32 cos_t = a.mQ[0]*b.mQ[0] + a.mQ[1]*b.mQ[1] + a.mQ[2]*b.mQ[2] + a.mQ[3]*b.mQ[3]; // if b is on opposite hemisphere from a, use -a instead - int bflip; + bool bflip; if (cos_t < 0.0f) { cos_t = -cos_t; - bflip = TRUE; + bflip = true; } else - bflip = FALSE; + bflip = false; // if B is (within precision limits) the same as A, // just linear interpolate between A and B. @@ -959,11 +959,11 @@ void LLQuaternion::unpackFromVector3( const LLVector3& vec ) } } -BOOL LLQuaternion::parseQuat(const std::string& buf, LLQuaternion* value) +bool LLQuaternion::parseQuat(const std::string& buf, LLQuaternion* value) { if( buf.empty() || value == NULL) { - return FALSE; + return false; } LLQuaternion quat; @@ -971,10 +971,10 @@ BOOL LLQuaternion::parseQuat(const std::string& buf, LLQuaternion* value) if( 4 == count ) { value->set( quat ); - return TRUE; + return true; } - return FALSE; + return false; } diff --git a/indra/llmath/llquaternion.h b/indra/llmath/llquaternion.h index be7f119a2b..6136c59ed1 100644 --- a/indra/llmath/llquaternion.h +++ b/indra/llmath/llquaternion.h @@ -69,9 +69,9 @@ public: LLSD getValue() const; void setValue(const LLSD& sd); - BOOL isIdentity() const; - BOOL isNotIdentity() const; - BOOL isFinite() const; // checks to see if all values of LLQuaternion are finite + bool isIdentity() const; + bool isNotIdentity() const; + bool isFinite() const; // checks to see if all values of LLQuaternion are finite void quantize16(F32 lower, F32 upper); // changes the vector to reflect quatization void quantize8(F32 lower, F32 upper); // changes the vector to reflect quatization void loadIdentity(); // Loads the quaternion that represents the identity rotation @@ -168,7 +168,7 @@ public: friend const char *OrderToString( const Order order ); friend Order StringToOrder( const char *str ); - static BOOL parseQuat(const std::string& buf, LLQuaternion* value); + static bool parseQuat(const std::string& buf, LLQuaternion* value); // For debugging, only //static U32 mMultCount; @@ -193,12 +193,12 @@ inline void LLQuaternion::setValue(const LLSD& sd) } // checker -inline BOOL LLQuaternion::isFinite() const +inline bool LLQuaternion::isFinite() const { return (llfinite(mQ[VX]) && llfinite(mQ[VY]) && llfinite(mQ[VZ]) && llfinite(mQ[VS])); } -inline BOOL LLQuaternion::isIdentity() const +inline bool LLQuaternion::isIdentity() const { return ( mQ[VX] == 0.f ) && @@ -207,7 +207,7 @@ inline BOOL LLQuaternion::isIdentity() const ( mQ[VS] == 1.f ); } -inline BOOL LLQuaternion::isNotIdentity() const +inline bool LLQuaternion::isNotIdentity() const { return ( mQ[VX] != 0.f ) || diff --git a/indra/llmath/llrect.h b/indra/llmath/llrect.h index 6c872611ba..317578da06 100644 --- a/indra/llmath/llrect.h +++ b/indra/llmath/llrect.h @@ -83,14 +83,14 @@ public: } // Note: follows GL_QUAD conventions: the top and right edges are not considered part of the rect - BOOL pointInRect(const Type x, const Type y) const + bool pointInRect(const Type x, const Type y) const { return mLeft <= x && x < mRight && mBottom <= y && y < mTop; } //// Note: follows GL_QUAD conventions: the top and right edges are not considered part of the rect - BOOL localPointInRect(const Type x, const Type y) const + bool localPointInRect(const Type x, const Type y) const { return 0 <= x && x < getWidth() && 0 <= y && y < getHeight(); @@ -137,8 +137,8 @@ public: } // Note: Does NOT follow GL_QUAD conventions: the top and right edges ARE considered part of the rect - // returns TRUE if any part of rect is is inside this LLRect - BOOL overlaps(const LLRectBase& rect) const + // returns true if any part of rect is is inside this LLRect + bool overlaps(const LLRectBase& rect) const { return !(mLeft > rect.mRight || mRight < rect.mLeft @@ -146,7 +146,7 @@ public: || mTop < rect.mBottom); } - BOOL contains(const LLRectBase& rect) const + bool contains(const LLRectBase& rect) const { return mLeft <= rect.mLeft && mRight >= rect.mRight diff --git a/indra/llmath/llsimdtypes.h b/indra/llmath/llsimdtypes.h index 9db152adf8..11462170fb 100644 --- a/indra/llmath/llsimdtypes.h +++ b/indra/llmath/llsimdtypes.h @@ -60,7 +60,7 @@ public: inline operator bool() const { return static_cast<const bool&>(m_bool); } private: - int m_bool; + int m_bool{ 0 }; }; #if LL_WINDOWS @@ -118,7 +118,7 @@ public: } private: - LLQuad mQ; + LLQuad mQ{}; }; #endif //LL_SIMD_TYPES_H diff --git a/indra/llmath/llsphere.cpp b/indra/llmath/llsphere.cpp index 75f9ef1772..5f48764455 100644 --- a/indra/llmath/llsphere.cpp +++ b/indra/llmath/llsphere.cpp @@ -69,18 +69,18 @@ F32 LLSphere::getRadius() const return mRadius; } -// returns 'TRUE' if this sphere completely contains other_sphere -BOOL LLSphere::contains(const LLSphere& other_sphere) const +// returns 'true' if this sphere completely contains other_sphere +bool LLSphere::contains(const LLSphere& other_sphere) const { F32 separation = (mCenter - other_sphere.mCenter).length(); - return (mRadius >= separation + other_sphere.mRadius) ? TRUE : FALSE; + return mRadius >= separation + other_sphere.mRadius; } -// returns 'TRUE' if this sphere completely contains other_sphere -BOOL LLSphere::overlaps(const LLSphere& other_sphere) const +// returns 'true' if this sphere completely contains other_sphere +bool LLSphere::overlaps(const LLSphere& other_sphere) const { F32 separation = (mCenter - other_sphere.mCenter).length(); - return (separation <= mRadius + other_sphere.mRadius) ? TRUE : FALSE; + return mRadius >= separation - other_sphere.mRadius; } // returns overlap @@ -93,9 +93,8 @@ F32 LLSphere::getOverlap(const LLSphere& other_sphere) const bool LLSphere::operator==(const LLSphere& rhs) const { - // TODO? -- use approximate equality for centers? - return (mRadius == rhs.mRadius - && mCenter == rhs.mCenter); + return fabs(mRadius - rhs.mRadius) <= FLT_EPSILON && + (mCenter - rhs.mCenter).length() <= FLT_EPSILON; } std::ostream& operator<<( std::ostream& output_stream, const LLSphere& sphere) @@ -186,7 +185,7 @@ LLSphere LLSphere::getBoundingSphere(const std::vector<LLSphere>& sphere_list) // TODO -- improve the accuracy for small collections of spheres LLSphere bounding_sphere( LLVector3(0.f, 0.f, 0.f), 0.f ); - S32 sphere_count = sphere_list.size(); + auto sphere_count = sphere_list.size(); if (1 == sphere_count) { // trivial case -- single sphere diff --git a/indra/llmath/llsphere.h b/indra/llmath/llsphere.h index 62bcadf16d..cb923dcd3c 100644 --- a/indra/llmath/llsphere.h +++ b/indra/llmath/llsphere.h @@ -47,11 +47,11 @@ public: const LLVector3& getCenter() const; F32 getRadius() const; - // returns TRUE if this sphere completely contains other_sphere - BOOL contains(const LLSphere& other_sphere) const; + // returns true if this sphere completely contains other_sphere + bool contains(const LLSphere& other_sphere) const; - // returns TRUE if this sphere overlaps other_sphere - BOOL overlaps(const LLSphere& other_sphere) const; + // returns true if this sphere overlaps other_sphere + bool overlaps(const LLSphere& other_sphere) const; // returns overlap distance // negative overlap is closest approach diff --git a/indra/llmath/lltreenode.h b/indra/llmath/lltreenode.h index a0b90e3511..e3d30206b7 100644 --- a/indra/llmath/lltreenode.h +++ b/indra/llmath/lltreenode.h @@ -56,10 +56,11 @@ public: virtual bool insert(T* data); virtual bool remove(T* data); virtual void notifyRemoval(T* data); - virtual U32 getListenerCount() { return mListeners.size(); } + virtual U32 hasListeners() const { return !mListeners.empty(); } + virtual U32 getListenerCount() const { return static_cast<U32>(mListeners.size()); } virtual LLTreeListener<T>* getListener(U32 index) const { - if(index < mListeners.size()) + if (index < mListeners.size()) { return mListeners[index]; } diff --git a/indra/llmath/llvector4a.h b/indra/llmath/llvector4a.h index 8f0ee4b739..8ef560dadf 100644 --- a/indra/llmath/llvector4a.h +++ b/indra/llmath/llvector4a.h @@ -117,6 +117,49 @@ public: mQ = q; } + bool operator==(const LLVector4a& rhs) const + { + return equals4(rhs); + } + + bool operator!=(const LLVector4a& rhs) const + { + return !(*this == rhs); + } + + const LLVector4a& operator+=(const LLVector4a& rhs) + { + add(rhs); + return *this; + } + + const LLVector4a& operator-=(const LLVector4a& rhs) + { + sub(rhs); + return *this; + } + + LLVector4a operator+(const LLVector4a& rhs) const + { + LLVector4a result = *this; + result.add(rhs); + return result; + } + + LLVector4a operator-(const LLVector4a& rhs) const + { + LLVector4a result = *this; + result.sub(rhs); + return result; + } + + LLVector4a cross3(const LLVector4a& b) const + { + LLVector4a result; + result.setCross3(*this, b); + return result; + } + //////////////////////////////////// // LOAD/STORE //////////////////////////////////// @@ -322,7 +365,7 @@ public: inline operator LLQuad() const; private: - LLQuad mQ; + LLQuad mQ{}; }; inline void update_min_max(LLVector4a& min, LLVector4a& max, const LLVector4a& p) diff --git a/indra/llmath/llvector4logical.h b/indra/llmath/llvector4logical.h index d08b5513d9..70759eef5c 100644 --- a/indra/llmath/llvector4logical.h +++ b/indra/llmath/llvector4logical.h @@ -120,7 +120,7 @@ public: private: - LLQuad mQ; + LLQuad mQ{}; }; #endif //LL_VECTOR4ALOGICAL_H diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 69138f64f5..8bcfd591b4 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -65,66 +65,66 @@ #define DEBUG_SILHOUETTE_NORMALS 0 // TomY: Use this to display normals using the silhouette #define DEBUG_SILHOUETTE_EDGE_MAP 0 // DaveP: Use this to display edge map using the silhouette -const F32 MIN_CUT_DELTA = 0.02f; +constexpr F32 MIN_CUT_DELTA = 0.02f; -const F32 HOLLOW_MIN = 0.f; -const F32 HOLLOW_MAX = 0.95f; -const F32 HOLLOW_MAX_SQUARE = 0.7f; +constexpr F32 HOLLOW_MIN = 0.f; +constexpr F32 HOLLOW_MAX = 0.95f; +constexpr F32 HOLLOW_MAX_SQUARE = 0.7f; -const F32 TWIST_MIN = -1.f; -const F32 TWIST_MAX = 1.f; +constexpr F32 TWIST_MIN = -1.f; +constexpr F32 TWIST_MAX = 1.f; -const F32 RATIO_MIN = 0.f; -const F32 RATIO_MAX = 2.f; // Tom Y: Inverted sense here: 0 = top taper, 2 = bottom taper +constexpr F32 RATIO_MIN = 0.f; +constexpr F32 RATIO_MAX = 2.f; // Tom Y: Inverted sense here: 0 = top taper, 2 = bottom taper -const F32 HOLE_X_MIN= 0.05f; -const F32 HOLE_X_MAX= 1.0f; +constexpr F32 HOLE_X_MIN= 0.05f; +constexpr F32 HOLE_X_MAX= 1.0f; -const F32 HOLE_Y_MIN= 0.05f; -const F32 HOLE_Y_MAX= 0.5f; +constexpr F32 HOLE_Y_MIN= 0.05f; +constexpr F32 HOLE_Y_MAX= 0.5f; -const F32 SHEAR_MIN = -0.5f; -const F32 SHEAR_MAX = 0.5f; +constexpr F32 SHEAR_MIN = -0.5f; +constexpr F32 SHEAR_MAX = 0.5f; -const F32 REV_MIN = 1.f; -const F32 REV_MAX = 4.f; +constexpr F32 REV_MIN = 1.f; +constexpr F32 REV_MAX = 4.f; -const F32 TAPER_MIN = -1.f; -const F32 TAPER_MAX = 1.f; +constexpr F32 TAPER_MIN = -1.f; +constexpr F32 TAPER_MAX = 1.f; -const F32 SKEW_MIN = -0.95f; -const F32 SKEW_MAX = 0.95f; +constexpr F32 SKEW_MIN = -0.95f; +constexpr F32 SKEW_MAX = 0.95f; -const F32 SCULPT_MIN_AREA = 0.002f; -const S32 SCULPT_MIN_AREA_DETAIL = 1; +constexpr F32 SCULPT_MIN_AREA = 0.002f; +constexpr S32 SCULPT_MIN_AREA_DETAIL = 1; -BOOL gDebugGL = FALSE; // See settings.xml "RenderDebugGL" +bool gDebugGL = false; // See settings.xml "RenderDebugGL" -BOOL check_same_clock_dir( const LLVector3& pt1, const LLVector3& pt2, const LLVector3& pt3, const LLVector3& norm) +bool check_same_clock_dir( const LLVector3& pt1, const LLVector3& pt2, const LLVector3& pt3, const LLVector3& norm) { LLVector3 test = (pt2-pt1)%(pt3-pt2); //answer if(test * norm < 0) { - return FALSE; + return false; } else { - return TRUE; + return true; } } -BOOL LLLineSegmentBoxIntersect(const LLVector3& start, const LLVector3& end, const LLVector3& center, const LLVector3& size) +bool LLLineSegmentBoxIntersect(const LLVector3& start, const LLVector3& end, const LLVector3& center, const LLVector3& size) { return LLLineSegmentBoxIntersect(start.mV, end.mV, center.mV, size.mV); } -BOOL LLLineSegmentBoxIntersect(const F32* start, const F32* end, const F32* center, const F32* size) +bool LLLineSegmentBoxIntersect(const F32* start, const F32* end, const F32* center, const F32* size) { - F32 fAWdU[3]; - F32 dir[3]; - F32 diff[3]; + F32 fAWdU[3]{}; + F32 dir[3]{}; + F32 diff[3]{}; for (U32 i = 0; i < 3; i++) { @@ -222,11 +222,11 @@ void calc_tangent_from_triangle( // intersect test between triangle vert0, vert1, vert2 and a ray from orig in direction dir. -// returns TRUE if intersecting and returns barycentric coordinates in intersection_a, intersection_b, +// returns true if intersecting and returns barycentric coordinates in intersection_a, intersection_b, // and returns the intersection point along dir in intersection_t. // Moller-Trumbore algorithm -BOOL LLTriangleRayIntersect(const LLVector4a& vert0, const LLVector4a& vert1, const LLVector4a& vert2, const LLVector4a& orig, const LLVector4a& dir, +bool LLTriangleRayIntersect(const LLVector4a& vert0, const LLVector4a& vert1, const LLVector4a& vert2, const LLVector4a& orig, const LLVector4a& dir, F32& intersection_a, F32& intersection_b, F32& intersection_t) { @@ -288,15 +288,15 @@ BOOL LLTriangleRayIntersect(const LLVector4a& vert0, const LLVector4a& vert1, co intersection_a = u[0]; intersection_b = v[0]; intersection_t = t[0]; - return TRUE; + return true; } } } - return FALSE; + return false; } -BOOL LLTriangleRayIntersectTwoSided(const LLVector4a& vert0, const LLVector4a& vert1, const LLVector4a& vert2, const LLVector4a& orig, const LLVector4a& dir, +bool LLTriangleRayIntersectTwoSided(const LLVector4a& vert0, const LLVector4a& vert1, const LLVector4a& vert2, const LLVector4a& orig, const LLVector4a& dir, F32& intersection_a, F32& intersection_b, F32& intersection_t) { F32 u, v, t; @@ -319,7 +319,7 @@ BOOL LLTriangleRayIntersectTwoSided(const LLVector4a& vert0, const LLVector4a& v if (det > -F_APPROXIMATELY_ZERO && det < F_APPROXIMATELY_ZERO) { - return FALSE; + return false; } F32 inv_det = 1.f / det; @@ -332,7 +332,7 @@ BOOL LLTriangleRayIntersectTwoSided(const LLVector4a& vert0, const LLVector4a& v u = (tvec.dot3(pvec).getF32()) * inv_det; if (u < 0.f || u > 1.f) { - return FALSE; + return false; } /* prepare to test V parameter */ @@ -343,7 +343,7 @@ BOOL LLTriangleRayIntersectTwoSided(const LLVector4a& vert0, const LLVector4a& v if (v < 0.f || u + v > 1.f) { - return FALSE; + return false; } /* calculate t, ray intersects triangle */ @@ -354,30 +354,7 @@ BOOL LLTriangleRayIntersectTwoSided(const LLVector4a& vert0, const LLVector4a& v intersection_t = t; - return TRUE; -} - -//helper for non-aligned vectors -BOOL LLTriangleRayIntersect(const LLVector3& vert0, const LLVector3& vert1, const LLVector3& vert2, const LLVector3& orig, const LLVector3& dir, - F32& intersection_a, F32& intersection_b, F32& intersection_t, BOOL two_sided) -{ - LLVector4a vert0a, vert1a, vert2a, origa, dira; - vert0a.load3(vert0.mV); - vert1a.load3(vert1.mV); - vert2a.load3(vert2.mV); - origa.load3(orig.mV); - dira.load3(dir.mV); - - if (two_sided) - { - return LLTriangleRayIntersectTwoSided(vert0a, vert1a, vert2a, origa, dira, - intersection_a, intersection_b, intersection_t); - } - else - { - return LLTriangleRayIntersect(vert0a, vert1a, vert2a, origa, dira, - intersection_a, intersection_b, intersection_t); - } + return true; } //------------------------------------------------------------------- @@ -394,12 +371,12 @@ LLProfile::Face* LLProfile::addCap(S16 faceID) face->mIndex = 0; face->mCount = mTotal; face->mScaleU= 1.0f; - face->mCap = TRUE; + face->mCap = true; face->mFaceID = faceID; return face; } -LLProfile::Face* LLProfile::addFace(S32 i, S32 count, F32 scaleU, S16 faceID, BOOL flat) +LLProfile::Face* LLProfile::addFace(S32 i, S32 count, F32 scaleU, S16 faceID, bool flat) { Face *face = vector_append(mFaces, 1); @@ -408,7 +385,7 @@ LLProfile::Face* LLProfile::addFace(S32 i, S32 count, F32 scaleU, S16 faceID, BO face->mScaleU= scaleU; face->mFlat = flat; - face->mCap = FALSE; + face->mCap = false; face->mFaceID = faceID; return face; } @@ -483,7 +460,7 @@ void LLProfile::genNGon(const LLProfileParams& params, S32 sides, F32 offset, F3 { // Generate an n-sided "circular" path. // 0 is (1,0), and we go counter-clockwise along a circular path from there. - static const F32 tableScale[] = { 1, 1, 1, 0.5f, 0.707107f, 0.53f, 0.525f, 0.5f }; + constexpr F32 tableScale[] = { 1, 1, 1, 0.5f, 0.707107f, 0.53f, 0.525f, 0.5f }; F32 scale = 0.5f; F32 t, t_step, t_first, t_fraction, ang, ang_step; LLVector4a pt1,pt2; @@ -583,13 +560,13 @@ void LLProfile::genNGon(const LLProfileParams& params, S32 sides, F32 offset, F3 { if ((end - begin)*ang_scale > 0.5f) { - mConcave = TRUE; + mConcave = true; } else { - mConcave = FALSE; + mConcave = false; } - mOpen = TRUE; + mOpen = true; if (params.getHollow() <= 0) { // put center point if not hollow. @@ -599,8 +576,8 @@ void LLProfile::genNGon(const LLProfileParams& params, S32 sides, F32 offset, F3 else { // The profile isn't open. - mOpen = FALSE; - mConcave = FALSE; + mOpen = false; + mConcave = false; } mTotal = mProfile.size(); @@ -609,7 +586,7 @@ void LLProfile::genNGon(const LLProfileParams& params, S32 sides, F32 offset, F3 // Hollow is percent of the original bounding box, not of this particular // profile's geometry. Thus, a swept triangle needs lower hollow values than // a swept square. -LLProfile::Face* LLProfile::addHole(const LLProfileParams& params, BOOL flat, F32 sides, F32 offset, F32 box_hollow, F32 ang_scale, S32 split) +LLProfile::Face* LLProfile::addHole(const LLProfileParams& params, bool flat, F32 sides, F32 offset, F32 box_hollow, F32 ang_scale, S32 split) { // Note that addHole will NOT work for non-"circular" profiles, if we ever decide to use them. @@ -648,8 +625,8 @@ LLProfile::Face* LLProfile::addHole(const LLProfileParams& params, BOOL flat, F3 } //static -S32 LLProfile::getNumPoints(const LLProfileParams& params, BOOL path_open,F32 detail, S32 split, - BOOL is_sculpted, S32 sculpt_size) +S32 LLProfile::getNumPoints(const LLProfileParams& params, bool path_open,F32 detail, S32 split, + bool is_sculpted, S32 sculpt_size) { // this is basically LLProfile::generate stripped down to only operations that influence the number of points if (detail < MIN_LOD) { @@ -758,16 +735,16 @@ S32 LLProfile::getNumPoints(const LLProfileParams& params, BOOL path_open,F32 de } -BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detail, S32 split, - BOOL is_sculpted, S32 sculpt_size) +bool LLProfile::generate(const LLProfileParams& params, bool path_open,F32 detail, S32 split, + bool is_sculpted, S32 sculpt_size) { LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME if ((!mDirty) && (!is_sculpted)) { - return FALSE; + return false; } - mDirty = FALSE; + mDirty = false; if (detail < MIN_LOD) { @@ -788,7 +765,7 @@ BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detai if (begin > end - 0.01f) { LL_WARNS() << "LLProfile::generate() assertion failed (begin >= end)" << LL_ENDL; - return FALSE; + return false; } S32 face_num = 0; @@ -805,7 +782,7 @@ BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detai for (i = llfloor(begin * 4.f); i < llfloor(end * 4.f + .999f); i++) { - addFace((face_num++) * (split +1), split+2, 1, LL_FACE_OUTER_SIDE_0 << i, TRUE); + addFace((face_num++) * (split +1), split+2, 1, LL_FACE_OUTER_SIDE_0 << i, true); } LLVector4a scale(1,1,4,1); @@ -823,16 +800,16 @@ BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detai { case LL_PCODE_HOLE_TRIANGLE: // This offset is not correct, but we can't change it now... DK 11/17/04 - addHole(params, TRUE, 3, -0.375f, hollow, 1.f, split); + addHole(params, true, 3, -0.375f, hollow, 1.f, split); break; case LL_PCODE_HOLE_CIRCLE: // TODO: Compute actual detail levels for cubes - addHole(params, FALSE, MIN_DETAIL_FACES * detail, -0.375f, hollow, 1.f); + addHole(params, false, MIN_DETAIL_FACES * detail, -0.375f, hollow, 1.f); break; case LL_PCODE_HOLE_SAME: case LL_PCODE_HOLE_SQUARE: default: - addHole(params, TRUE, 4, -0.375f, hollow, 1.f, split); + addHole(params, true, 4, -0.375f, hollow, 1.f, split); break; } } @@ -862,7 +839,7 @@ BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detai for (i = llfloor(begin * 3.f); i < llfloor(end * 3.f + .999f); i++) { - addFace((face_num++) * (split +1), split+2, 1, LL_FACE_OUTER_SIDE_0 << i, TRUE); + addFace((face_num++) * (split +1), split+2, 1, LL_FACE_OUTER_SIDE_0 << i, true); } if (hollow) { @@ -874,15 +851,15 @@ BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detai { case LL_PCODE_HOLE_CIRCLE: // TODO: Actually generate level of detail for triangles - addHole(params, FALSE, MIN_DETAIL_FACES * detail, 0, triangle_hollow, 1.f); + addHole(params, false, MIN_DETAIL_FACES * detail, 0, triangle_hollow, 1.f); break; case LL_PCODE_HOLE_SQUARE: - addHole(params, TRUE, 4, 0, triangle_hollow, 1.f, split); + addHole(params, true, 4, 0, triangle_hollow, 1.f, split); break; case LL_PCODE_HOLE_SAME: case LL_PCODE_HOLE_TRIANGLE: default: - addHole(params, TRUE, 3, 0, triangle_hollow, 1.f, split); + addHole(params, true, 3, 0, triangle_hollow, 1.f, split); break; } } @@ -919,11 +896,11 @@ BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detai if (mOpen && !hollow) { - addFace(0,mTotal-1,0,LL_FACE_OUTER_SIDE_0, FALSE); + addFace(0,mTotal-1,0,LL_FACE_OUTER_SIDE_0, false); } else { - addFace(0,mTotal,0,LL_FACE_OUTER_SIDE_0, FALSE); + addFace(0,mTotal,0,LL_FACE_OUTER_SIDE_0, false); } if (hollow) @@ -931,15 +908,15 @@ BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detai switch (hole_type) { case LL_PCODE_HOLE_SQUARE: - addHole(params, TRUE, 4, 0, hollow, 1.f, split); + addHole(params, true, 4, 0, hollow, 1.f, split); break; case LL_PCODE_HOLE_TRIANGLE: - addHole(params, TRUE, 3, 0, hollow, 1.f, split); + addHole(params, true, 3, 0, hollow, 1.f, split); break; case LL_PCODE_HOLE_CIRCLE: case LL_PCODE_HOLE_SAME: default: - addHole(params, FALSE, circle_detail, 0, hollow, 1.f); + addHole(params, true, circle_detail, 0, hollow, 1.f); break; } } @@ -969,11 +946,11 @@ BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detai } if (mOpen && !params.getHollow()) { - addFace(0,mTotal-1,0,LL_FACE_OUTER_SIDE_0, FALSE); + addFace(0,mTotal-1,0,LL_FACE_OUTER_SIDE_0, false); } else { - addFace(0,mTotal,0,LL_FACE_OUTER_SIDE_0, FALSE); + addFace(0,mTotal,0,LL_FACE_OUTER_SIDE_0, false); } if (hollow) @@ -981,15 +958,15 @@ BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detai switch (hole_type) { case LL_PCODE_HOLE_SQUARE: - addHole(params, TRUE, 2, 0.5f, hollow, 0.5f, split); + addHole(params, true, 2, 0.5f, hollow, 0.5f, split); break; case LL_PCODE_HOLE_TRIANGLE: - addHole(params, TRUE, 3, 0.5f, hollow, 0.5f, split); + addHole(params, true, 3, 0.5f, hollow, 0.5f, split); break; case LL_PCODE_HOLE_CIRCLE: case LL_PCODE_HOLE_SAME: default: - addHole(params, FALSE, circle_detail, 0.5f, hollow, 0.5f); + addHole(params, false, circle_detail, 0.5f, hollow, 0.5f); break; } } @@ -997,11 +974,11 @@ BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detai // Special case for openness of sphere if ((params.getEnd() - params.getBegin()) < 1.f) { - mOpen = TRUE; + mOpen = true; } else if (!hollow) { - mOpen = FALSE; + mOpen = false; mProfile.push_back(mProfile[0]); mTotal++; } @@ -1019,24 +996,24 @@ BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detai if ( mOpen) // interior edge caps { - addFace(mTotal-1, 2,0.5,LL_FACE_PROFILE_BEGIN, TRUE); + addFace(mTotal-1, 2,0.5,LL_FACE_PROFILE_BEGIN, true); if (hollow) { - addFace(mTotalOut-1, 2,0.5,LL_FACE_PROFILE_END, TRUE); + addFace(mTotalOut-1, 2,0.5,LL_FACE_PROFILE_END, true); } else { - addFace(mTotal-2, 2,0.5,LL_FACE_PROFILE_END, TRUE); + addFace(mTotal-2, 2,0.5,LL_FACE_PROFILE_END, true); } } - return TRUE; + return true; } -BOOL LLProfileParams::importFile(LLFILE *fp) +bool LLProfileParams::importFile(LLFILE *fp) { const S32 BUFSIZE = 16384; char buffer[BUFSIZE]; /* Flawfinder: ignore */ @@ -1094,11 +1071,11 @@ BOOL LLProfileParams::importFile(LLFILE *fp) } } - return TRUE; + return true; } -BOOL LLProfileParams::exportFile(LLFILE *fp) const +bool LLProfileParams::exportFile(LLFILE *fp) const { fprintf(fp,"\t\tprofile 0\n"); fprintf(fp,"\t\t{\n"); @@ -1107,11 +1084,11 @@ BOOL LLProfileParams::exportFile(LLFILE *fp) const fprintf(fp,"\t\t\tend\t%g\n", getEnd()); fprintf(fp,"\t\t\thollow\t%g\n", getHollow()); fprintf(fp, "\t\t}\n"); - return TRUE; + return true; } -BOOL LLProfileParams::importLegacyStream(std::istream& input_stream) +bool LLProfileParams::importLegacyStream(std::istream& input_stream) { const S32 BUFSIZE = 16384; char buffer[BUFSIZE]; /* Flawfinder: ignore */ @@ -1166,11 +1143,11 @@ BOOL LLProfileParams::importLegacyStream(std::istream& input_stream) } } - return TRUE; + return true; } -BOOL LLProfileParams::exportLegacyStream(std::ostream& output_stream) const +bool LLProfileParams::exportLegacyStream(std::ostream& output_stream) const { output_stream <<"\t\tprofile 0\n"; output_stream <<"\t\t{\n"; @@ -1179,7 +1156,7 @@ BOOL LLProfileParams::exportLegacyStream(std::ostream& output_stream) const output_stream <<"\t\t\tend\t" << getEnd() << "\n"; output_stream <<"\t\t\thollow\t" << getHollow() << "\n"; output_stream << "\t\t}\n"; - return TRUE; + return true; } LLSD LLProfileParams::asLLSD() const @@ -1246,7 +1223,7 @@ void LLPath::genNGon(const LLPathParams& params, S32 sides, F32 startOff, F32 en LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME // Generates a circular path, starting at (1, 0, 0), counterclockwise along the xz plane. - static const F32 tableScale[] = { 1, 1, 1, 0.5f, 0.707107f, 0.53f, 0.525f, 0.5f }; + constexpr F32 tableScale[] = { 1, 1, 1, 0.5f, 0.707107f, 0.53f, 0.525f, 0.5f }; F32 revolutions = params.getRevolutions(); F32 skew = params.getSkew(); @@ -1476,14 +1453,14 @@ S32 LLPath::getNumPoints(const LLPathParams& params, F32 detail) return np; } -BOOL LLPath::generate(const LLPathParams& params, F32 detail, S32 split, - BOOL is_sculpted, S32 sculpt_size) +bool LLPath::generate(const LLPathParams& params, F32 detail, S32 split, + bool is_sculpted, S32 sculpt_size) { LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME if ((!mDirty) && (!is_sculpted)) { - return FALSE; + return false; } if (detail < MIN_LOD) @@ -1492,11 +1469,11 @@ BOOL LLPath::generate(const LLPathParams& params, F32 detail, S32 split, detail = MIN_LOD; } - mDirty = FALSE; + mDirty = false; S32 np = 2; // hardcode for line mPath.resize(0); - mOpen = TRUE; + mOpen = true; // Is this 0xf0 mask really necessary? DK 03/02/05 switch (params.getCurveType() & 0xf0) @@ -1556,7 +1533,7 @@ BOOL LLPath::generate(const LLPathParams& params, F32 detail, S32 split, if (params.getEnd() - params.getBegin() >= 0.99f && params.getScaleX() >= .99f) { - mOpen = FALSE; + mOpen = false; } //genNGon(params, llfloor(MIN_DETAIL_FACES * detail), 4.f, 0.f); @@ -1600,19 +1577,19 @@ BOOL LLPath::generate(const LLPathParams& params, F32 detail, S32 split, break; }; - if (params.getTwist() != params.getTwistBegin()) mOpen = TRUE; + if (params.getTwist() != params.getTwistBegin()) mOpen = true; //if ((int(fabsf(params.getTwist() - params.getTwistBegin())*100))%100 != 0) { - // mOpen = TRUE; + // mOpen = true; //} - return TRUE; + return true; } -BOOL LLDynamicPath::generate(const LLPathParams& params, F32 detail, S32 split, - BOOL is_sculpted, S32 sculpt_size) +bool LLDynamicPath::generate(const LLPathParams& params, F32 detail, S32 split, + bool is_sculpted, S32 sculpt_size) { - mOpen = TRUE; // Draw end caps + mOpen = true; // Draw end caps if (getPathLength() == 0) { // Path hasn't been generated yet. @@ -1631,11 +1608,11 @@ BOOL LLDynamicPath::generate(const LLPathParams& params, F32 detail, S32 split, } } - return TRUE; + return true; } -BOOL LLPathParams::importFile(LLFILE *fp) +bool LLPathParams::importFile(LLFILE *fp) { const S32 BUFSIZE = 16384; char buffer[BUFSIZE]; /* Flawfinder: ignore */ @@ -1750,11 +1727,11 @@ BOOL LLPathParams::importFile(LLFILE *fp) LL_WARNS() << "unknown keyword " << " in path import" << LL_ENDL; } } - return TRUE; + return true; } -BOOL LLPathParams::exportFile(LLFILE *fp) const +bool LLPathParams::exportFile(LLFILE *fp) const { fprintf(fp, "\t\tpath 0\n"); fprintf(fp, "\t\t{\n"); @@ -1775,11 +1752,11 @@ BOOL LLPathParams::exportFile(LLFILE *fp) const fprintf(fp,"\t\t\tskew\t%g\n", getSkew()); fprintf(fp, "\t\t}\n"); - return TRUE; + return true; } -BOOL LLPathParams::importLegacyStream(std::istream& input_stream) +bool LLPathParams::importLegacyStream(std::istream& input_stream) { const S32 BUFSIZE = 16384; char buffer[BUFSIZE]; /* Flawfinder: ignore */ @@ -1890,11 +1867,11 @@ BOOL LLPathParams::importLegacyStream(std::istream& input_stream) LL_WARNS() << "unknown keyword " << " in path import" << LL_ENDL; } } - return TRUE; + return true; } -BOOL LLPathParams::exportLegacyStream(std::ostream& output_stream) const +bool LLPathParams::exportLegacyStream(std::ostream& output_stream) const { output_stream << "\t\tpath 0\n"; output_stream << "\t\t{\n"; @@ -1915,7 +1892,7 @@ BOOL LLPathParams::exportLegacyStream(std::ostream& output_stream) const output_stream <<"\t\t\tskew\t" << getSkew() << "\n"; output_stream << "\t\t}\n"; - return TRUE; + return true; } LLSD LLPathParams::asLLSD() const @@ -1980,7 +1957,7 @@ LLProfile::~LLProfile() S32 LLVolume::sNumMeshPoints = 0; -LLVolume::LLVolume(const LLVolumeParams ¶ms, const F32 detail, const BOOL generate_single_face, const BOOL is_unique) +LLVolume::LLVolume(const LLVolumeParams ¶ms, const F32 detail, const bool generate_single_face, const bool is_unique) : mParams(params) { mUnique = is_unique; @@ -1991,8 +1968,8 @@ LLVolume::LLVolume(const LLVolumeParams ¶ms, const F32 detail, const BOOL ge mIsMeshAssetLoaded = false; mIsMeshAssetUnavaliable = false; mLODScaleBias.setVec(1,1,1); - mHullPoints = NULL; - mHullIndices = NULL; + mHullPoints = nullptr; + mHullIndices = nullptr; mNumHullPoints = 0; mNumHullIndices = 0; @@ -2054,7 +2031,7 @@ LLVolume::~LLVolume() mHullIndices = NULL; } -BOOL LLVolume::generate() +bool LLVolume::generate() { LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME @@ -2098,8 +2075,8 @@ BOOL LLVolume::generate() } } - BOOL regenPath = mPathp->generate(mParams.getPathParams(), path_detail, split); - BOOL regenProf = mProfilep->generate(mParams.getProfileParams(), mPathp->isOpen(),profile_detail, split); + bool regenPath = mPathp->generate(mParams.getPathParams(), path_detail, split); + bool regenProf = mProfilep->generate(mParams.getProfileParams(), mPathp->isOpen(),profile_detail, split); if (regenPath || regenProf ) { @@ -2162,11 +2139,11 @@ BOOL LLVolume::generate() mFaceMask |= id; } LL_CHECK_MEMORY - return TRUE; + return true; } LL_CHECK_MEMORY - return FALSE; + return false; } void LLVolumeFace::VertexData::init() @@ -2347,7 +2324,7 @@ bool LLVolume::unpackVolumeFaces(U8* in_data, S32 size) bool LLVolume::unpackVolumeFacesInternal(const LLSD& mdl) { { - U32 face_count = mdl.size(); + auto face_count = mdl.size(); if (face_count == 0) { //no faces unpacked, treat as failed decode @@ -2379,7 +2356,7 @@ bool LLVolume::unpackVolumeFacesInternal(const LLSD& mdl) LLSD::Binary idx = mdl[i]["TriangleList"]; //copy out indices - S32 num_indices = idx.size() / 2; + auto num_indices = idx.size() / 2; const S32 indices_to_discard = num_indices % 3; if (indices_to_discard > 0) { @@ -2387,7 +2364,7 @@ bool LLVolume::unpackVolumeFacesInternal(const LLSD& mdl) LL_WARNS() << "Incomplete triangle discarded from face! Indices count " << num_indices << " was not divisible by 3. face index: " << i << " Total: " << face_count << LL_ENDL; num_indices -= indices_to_discard; } - face.resizeIndices(num_indices); + face.resizeIndices(static_cast<S32>(num_indices)); if (num_indices > 2 && !face.mIndices) { @@ -2408,7 +2385,7 @@ bool LLVolume::unpackVolumeFacesInternal(const LLSD& mdl) } //copy out vertices - U32 num_verts = pos.size()/(3*2); + U32 num_verts = static_cast<U32>(pos.size())/(3*2); face.resizeVertices(num_verts); if (num_verts > 0 && !face.mPositions) @@ -2672,7 +2649,7 @@ bool LLVolume::unpackVolumeFacesInternal(const LLSD& mdl) if (do_reverse_triangles) { - for (U32 j = 0; j < face.mNumIndices; j += 3) + for (S32 j = 0; j < face.mNumIndices; j += 3) { // swap the 2nd and 3rd index S32 swap = face.mIndices[j+1]; @@ -2709,7 +2686,7 @@ bool LLVolume::unpackVolumeFacesInternal(const LLSD& mdl) min_tc = face.mTexCoords[0]; max_tc = face.mTexCoords[0]; - for (U32 j = 1; j < face.mNumVertices; ++j) + for (S32 j = 1; j < face.mNumVertices; ++j) { update_min_max(min_tc, max_tc, face.mTexCoords[j]); } @@ -2812,10 +2789,10 @@ void LLVolume::createVolumeFaces() else { S32 num_faces = getNumFaces(); - BOOL partial_build = TRUE; + bool partial_build = true; if (num_faces != mVolumeFaces.size()) { - partial_build = FALSE; + partial_build = false; mVolumeFaces.resize(num_faces); } // Initialize volume faces with parameter data @@ -3050,9 +3027,9 @@ void LLVolume::sculptGenerateSpherePlaceholder() void LLVolume::sculptGenerateMapVertices(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, U8 sculpt_type) { U8 sculpt_stitching = sculpt_type & LL_SCULPT_TYPE_MASK; - BOOL sculpt_invert = sculpt_type & LL_SCULPT_FLAG_INVERT; - BOOL sculpt_mirror = sculpt_type & LL_SCULPT_FLAG_MIRROR; - BOOL reverse_horizontal = (sculpt_invert ? !sculpt_mirror : sculpt_mirror); // XOR + bool sculpt_invert = sculpt_type & LL_SCULPT_FLAG_INVERT; + bool sculpt_mirror = sculpt_type & LL_SCULPT_FLAG_MIRROR; + bool reverse_horizontal = (sculpt_invert ? !sculpt_mirror : sculpt_mirror); // XOR S32 sizeS = mPathp->mPath.size(); S32 sizeT = mProfilep->mProfile.size(); @@ -3137,14 +3114,13 @@ void LLVolume::sculptGenerateMapVertices(U16 sculpt_width, U16 sculpt_height, S8 } -const S32 SCULPT_REZ_1 = 6; // changed from 4 to 6 - 6 looks round whereas 4 looks square -const S32 SCULPT_REZ_2 = 8; -const S32 SCULPT_REZ_3 = 16; -const S32 SCULPT_REZ_4 = 32; +constexpr S32 SCULPT_REZ_1 = 6; // changed from 4 to 6 - 6 looks round whereas 4 looks square +constexpr S32 SCULPT_REZ_2 = 8; +constexpr S32 SCULPT_REZ_3 = 16; +constexpr S32 SCULPT_REZ_4 = 32; S32 sculpt_sides(F32 detail) { - // detail is usually one of: 1, 1.5, 2.5, 4.0. if (detail <= 1.0) @@ -3207,12 +3183,12 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, { U8 sculpt_type = mParams.getSculptType(); - BOOL data_is_empty = FALSE; + bool data_is_empty = false; if (sculpt_width == 0 || sculpt_height == 0 || sculpt_components < 3 || sculpt_data == NULL) { sculpt_level = -1; - data_is_empty = TRUE; + data_is_empty = true; } S32 requested_sizeS = 0; @@ -3220,8 +3196,8 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, sculpt_calc_mesh_resolution(sculpt_width, sculpt_height, sculpt_type, mDetail, requested_sizeS, requested_sizeT); - mPathp->generate(mParams.getPathParams(), mDetail, 0, TRUE, requested_sizeS); - mProfilep->generate(mParams.getProfileParams(), mPathp->isOpen(), mDetail, 0, TRUE, requested_sizeT); + mPathp->generate(mParams.getPathParams(), mDetail, 0, true, requested_sizeS); + mProfilep->generate(mParams.getProfileParams(), mPathp->isOpen(), mDetail, 0, true, requested_sizeT); S32 sizeS = mPathp->mPath.size(); // we requested a specific size, now see what we really got S32 sizeT = mProfilep->mProfile.size(); // we requested a specific size, now see what we really got @@ -3252,7 +3228,7 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, if (area < SCULPT_MIN_AREA || area > SCULPT_MAX_AREA) { - data_is_empty = TRUE; + data_is_empty = true; visible_placeholder = true; } } @@ -3271,8 +3247,6 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, } } - - for (S32 i = 0; i < (S32)mProfilep->mFaces.size(); i++) { mFaceMask |= mProfilep->mFaces[i].mFaceID; @@ -3289,12 +3263,12 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, -BOOL LLVolume::isCap(S32 face) +bool LLVolume::isCap(S32 face) { return mProfilep->mFaces[face].mCap; } -BOOL LLVolume::isFlat(S32 face) +bool LLVolume::isFlat(S32 face) { return mProfilep->mFaces[face].mFlat; } @@ -3357,7 +3331,7 @@ void LLVolumeParams::copyParams(const LLVolumeParams ¶ms) } // Less restricitve approx 0 for volumes -const F32 APPROXIMATELY_ZERO = 0.001f; +constexpr F32 APPROXIMATELY_ZERO = 0.001f; bool approx_zero( F32 f, F32 tolerance = APPROXIMATELY_ZERO) { return (f >= -tolerance) && (f <= tolerance); @@ -3613,7 +3587,7 @@ bool LLVolumeParams::setSkew(const F32 skew_value) return valid; } -bool LLVolumeParams::setSculptID(const LLUUID sculpt_id, U8 sculpt_type) +bool LLVolumeParams::setSculptID(const LLUUID& sculpt_id, U8 sculpt_type) { mSculptID = sculpt_id; mSculptType = sculpt_type; @@ -3808,7 +3782,7 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices, LLVector4a* v = (LLVector4a*)face.mPositions; LLVector4a* n = (LLVector4a*)face.mNormals; - for (U32 j = 0; j < face.mNumIndices / 3; j++) + for (S32 j = 0; j < face.mNumIndices / 3; j++) { for (S32 k = 0; k < 3; k++) { @@ -3843,7 +3817,6 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices, } else { - //============================================== //DEBUG draw edge map instead of silhouette edge //============================================== @@ -3925,8 +3898,8 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices, //DEBUG //============================================== - static const U8 AWAY = 0x01, - TOWARDS = 0x02; + constexpr U8 AWAY = 0x01, + TOWARDS = 0x02; //for each triangle std::vector<U8> fFacing; @@ -3935,7 +3908,7 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices, LLVector4a* v = (LLVector4a*) face.mPositions; LLVector4a* n = (LLVector4a*) face.mNormals; - for (U32 j = 0; j < face.mNumIndices/3; j++) + for (S32 j = 0; j < face.mNumIndices/3; j++) { //approximate normal S32 v1 = face.mIndices[j*3+0]; @@ -3972,7 +3945,7 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices, } //for each triangle - for (U32 j = 0; j < face.mNumIndices/3; j++) + for (S32 j = 0; j < face.mNumIndices/3; j++) { if (fFacing[j] == (AWAY | TOWARDS)) { //this is a degenerate triangle @@ -4196,7 +4169,7 @@ LLVertexIndexPair::LLVertexIndexPair(const LLVector3 &vertex, const S32 index) mIndex = index; } -const F32 VERTEX_SLOP = 0.00001f; +constexpr F32 VERTEX_SLOP = 0.00001f; struct lessVertex { @@ -4206,32 +4179,32 @@ struct lessVertex if (a->mVertex.mV[0] + slop < b->mVertex.mV[0]) { - return TRUE; + return true; } else if (a->mVertex.mV[0] - slop > b->mVertex.mV[0]) { - return FALSE; + return false; } if (a->mVertex.mV[1] + slop < b->mVertex.mV[1]) { - return TRUE; + return true; } else if (a->mVertex.mV[1] - slop > b->mVertex.mV[1]) { - return FALSE; + return false; } if (a->mVertex.mV[2] + slop < b->mVertex.mV[2]) { - return TRUE; + return true; } else if (a->mVertex.mV[2] - slop > b->mVertex.mV[2]) { - return FALSE; + return false; } - return FALSE; + return false; } }; @@ -4241,45 +4214,45 @@ struct lessTriangle { if (*a < *b) { - return TRUE; + return true; } else if (*a > *b) { - return FALSE; + return false; } if (*(a+1) < *(b+1)) { - return TRUE; + return true; } else if (*(a+1) > *(b+1)) { - return FALSE; + return false; } if (*(a+2) < *(b+2)) { - return TRUE; + return true; } else if (*(a+2) > *(b+2)) { - return FALSE; + return false; } - return FALSE; + return false; } }; -BOOL equalTriangle(const S32 *a, const S32 *b) +bool equalTriangle(const S32 *a, const S32 *b) { if ((*a == *b) && (*(a+1) == *(b+1)) && (*(a+2) == *(b+2))) { - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLVolumeParams::importFile(LLFILE *fp) +bool LLVolumeParams::importFile(LLFILE *fp) { //LL_INFOS() << "importing volume" << LL_ENDL; const S32 BUFSIZE = 16384; @@ -4319,21 +4292,21 @@ BOOL LLVolumeParams::importFile(LLFILE *fp) } } - return TRUE; + return true; } -BOOL LLVolumeParams::exportFile(LLFILE *fp) const +bool LLVolumeParams::exportFile(LLFILE *fp) const { fprintf(fp,"\tshape 0\n"); fprintf(fp,"\t{\n"); mPathParams.exportFile(fp); mProfileParams.exportFile(fp); fprintf(fp, "\t}\n"); - return TRUE; + return true; } -BOOL LLVolumeParams::importLegacyStream(std::istream& input_stream) +bool LLVolumeParams::importLegacyStream(std::istream& input_stream) { //LL_INFOS() << "importing volume" << LL_ENDL; const S32 BUFSIZE = 16384; @@ -4369,17 +4342,17 @@ BOOL LLVolumeParams::importLegacyStream(std::istream& input_stream) } } - return TRUE; + return true; } -BOOL LLVolumeParams::exportLegacyStream(std::ostream& output_stream) const +bool LLVolumeParams::exportLegacyStream(std::ostream& output_stream) const { output_stream <<"\tshape 0\n"; output_stream <<"\t{\n"; mPathParams.exportLegacyStream(output_stream); mProfileParams.exportLegacyStream(output_stream); output_stream << "\t}\n"; - return TRUE; + return true; } LLSD LLVolumeParams::sculptAsLLSD() const @@ -4451,14 +4424,14 @@ void LLVolumeParams::reduceT(F32 begin, F32 end) const F32 MIN_CONCAVE_PROFILE_WEDGE = 0.125f; // 1/8 unity const F32 MIN_CONCAVE_PATH_WEDGE = 0.111111f; // 1/9 unity -// returns TRUE if the shape can be approximated with a convex shape +// returns true if the shape can be approximated with a convex shape // for collison purposes -BOOL LLVolumeParams::isConvex() const +bool LLVolumeParams::isConvex() const { if (!getSculptID().isNull()) { // can't determine, be safe and say no: - return FALSE; + return false; } F32 path_length = mPathParams.getEnd() - mPathParams.getBegin(); @@ -4471,11 +4444,11 @@ BOOL LLVolumeParams::isConvex() const && LL_PCODE_PATH_LINE != path_type) ) ) { // twist along a "not too short" path is concave - return FALSE; + return false; } F32 profile_length = mProfileParams.getEnd() - mProfileParams.getBegin(); - BOOL same_hole = hollow == 0.f + bool same_hole = hollow == 0.f || (mProfileParams.getCurveType() & LL_PCODE_HOLE_MASK) == LL_PCODE_HOLE_SAME; F32 min_profile_wedge = MIN_CONCAVE_PROFILE_WEDGE; @@ -4486,7 +4459,7 @@ BOOL LLVolumeParams::isConvex() const min_profile_wedge = 2.f * MIN_CONCAVE_PROFILE_WEDGE; } - BOOL convex_profile = ( ( profile_length == 1.f + bool convex_profile = ( ( profile_length == 1.f || profile_length <= 0.5f ) && hollow == 0.f ) // trivially convex || ( profile_length <= min_profile_wedge @@ -4495,36 +4468,36 @@ BOOL LLVolumeParams::isConvex() const if (!convex_profile) { // profile is concave - return FALSE; + return false; } if ( LL_PCODE_PATH_LINE == path_type ) { // straight paths with convex profile - return TRUE; + return true; } - BOOL concave_path = (path_length < 1.0f) && (path_length > 0.5f); + bool concave_path = (path_length < 1.0f) && (path_length > 0.5f); if (concave_path) { - return FALSE; + return false; } // we're left with spheres, toroids and tubes if ( LL_PCODE_PROFILE_CIRCLE_HALF == profile_type ) { // at this stage all spheres must be convex - return TRUE; + return true; } // it's a toroid or tube if ( path_length <= MIN_CONCAVE_PATH_WEDGE ) { // effectively convex - return TRUE; + return true; } - return FALSE; + return false; } // debug @@ -4602,7 +4575,7 @@ LLFaceID LLVolume::generateFaceMask() return new_mask; } -BOOL LLVolume::isFaceMaskValid(LLFaceID face_mask) +bool LLVolume::isFaceMaskValid(LLFaceID face_mask) { LLFaceID test_mask = 0; for(S32 i = 0; i < getNumFaces(); i++) @@ -4613,9 +4586,9 @@ BOOL LLVolume::isFaceMaskValid(LLFaceID face_mask) return test_mask == face_mask; } -BOOL LLVolume::isConvex() const +bool LLVolume::isConvex() const { - // mParams.isConvex() may return FALSE even though the final + // mParams.isConvex() may return false even though the final // geometry is actually convex due to LOD approximations. // TODO -- provide LLPath and LLProfile with isConvex() methods // that correctly determine convexity. -- Leviathan @@ -4721,10 +4694,10 @@ LLVolumeFace::LLVolumeFace() : mJustWeights(NULL), mJointIndices(NULL), #endif - mWeightsScrubbed(FALSE), + mWeightsScrubbed(false), mOctree(NULL), mOctreeTriangles(NULL), - mOptimized(FALSE) + mOptimized(false) { mExtents = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*3); mExtents[0].splat(-0.5f); @@ -4752,7 +4725,7 @@ LLVolumeFace::LLVolumeFace(const LLVolumeFace& src) mJustWeights(NULL), mJointIndices(NULL), #endif - mWeightsScrubbed(FALSE), + mWeightsScrubbed(false), mOctree(NULL), mOctreeTriangles(NULL) { @@ -4826,7 +4799,7 @@ LLVolumeFace& LLVolumeFace::operator=(const LLVolumeFace& src) { ll_aligned_free_16(mWeights); mWeights = NULL; - mWeightsScrubbed = FALSE; + mWeightsScrubbed = false; } #if USE_SEPARATE_JOINT_INDICES_AND_WEIGHTS @@ -4899,7 +4872,7 @@ void LLVolumeFace::freeData() destroyOctree(); } -BOOL LLVolumeFace::create(LLVolume* volume, BOOL partial_build) +bool LLVolumeFace::create(LLVolume* volume, bool partial_build) { LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME @@ -4907,7 +4880,7 @@ BOOL LLVolumeFace::create(LLVolume* volume, BOOL partial_build) destroyOctree(); LL_CHECK_MEMORY - BOOL ret = FALSE ; + bool ret = false ; if (mTypeMask & CAP_MASK) { ret = createCap(volume, partial_build); @@ -4974,13 +4947,13 @@ void LLVolumeFace::remap() { // Generate a remap buffer std::vector<unsigned int> remap(mNumVertices); - S32 remap_vertices_count = LLMeshOptimizer::generateRemapMultiU16(&remap[0], + S32 remap_vertices_count = static_cast<S32>(LLMeshOptimizer::generateRemapMultiU16(&remap[0], mIndices, mNumIndices, mPositions, mNormals, mTexCoords, - mNumVertices); + mNumVertices)); // Allocate new buffers S32 size = ((mNumIndices * sizeof(U16)) + 0xF) & ~0xF; @@ -5025,7 +4998,7 @@ void LLVolumeFace::optimize(F32 angle_cutoff) range.setSub(mExtents[1],mExtents[0]); //remove redundant vertices - for (U32 i = 0; i < mNumIndices; ++i) + for (S32 i = 0; i < mNumIndices; ++i) { U16 index = mIndices[i]; @@ -5043,7 +5016,7 @@ void LLVolumeFace::optimize(F32 angle_cutoff) LLVolumeFace::VertexData cv; getVertexData(index, cv); - BOOL found = FALSE; + bool found = false; LLVector4a pos; pos.setSub(mPositions[index], mExtents[0]); @@ -5064,7 +5037,7 @@ void LLVolumeFace::optimize(F32 angle_cutoff) LLVolumeFace::VertexData& tv = (point_iter->second)[j]; if (tv.compareNormal(cv, angle_cutoff)) { - found = TRUE; + found = true; new_face.pushIndex((point_iter->second)[j].mIndex); break; } @@ -5171,12 +5144,12 @@ public: } }; -const F64 FindVertexScore_CacheDecayPower = 1.5; -const F64 FindVertexScore_LastTriScore = 0.75; -const F64 FindVertexScore_ValenceBoostScale = 2.0; -const F64 FindVertexScore_ValenceBoostPower = 0.5; -const U32 MaxSizeVertexCache = 32; -const F64 FindVertexScore_Scaler = 1.0/(MaxSizeVertexCache-3); +constexpr F64 FindVertexScore_CacheDecayPower = 1.5; +constexpr F64 FindVertexScore_LastTriScore = 0.75; +constexpr F64 FindVertexScore_ValenceBoostScale = 2.0; +constexpr F64 FindVertexScore_ValenceBoostPower = 0.5; +constexpr U32 MaxSizeVertexCache = 32; +constexpr F64 FindVertexScore_Scaler = 1.0/(MaxSizeVertexCache-3); F64 find_vertex_score(LLVCacheVertexData& data) { @@ -5411,7 +5384,7 @@ struct MikktData LLVector3 inv_scale(1.f / face->mNormalizedScale.mV[0], 1.f / face->mNormalizedScale.mV[1], 1.f / face->mNormalizedScale.mV[2]); - for (int i = 0; i < face->mNumIndices; ++i) + for (S32 i = 0; i < face->mNumIndices; ++i) { U32 idx = face->mIndices[i]; @@ -5422,17 +5395,6 @@ struct MikktData n[i].normalize(); tc[i].set(face->mTexCoords[idx]); - if (idx >= face->mNumVertices) - { - // invalid index - // replace with a valid index to avoid crashes - idx = face->mNumVertices - 1; - face->mIndices[i] = idx; - - // Needs better logging - LL_DEBUGS_ONCE("LLVOLUME") << "Invalid index, substituting" << LL_ENDL; - } - if (face->mWeights) { w[i].set(face->mWeights[idx].getF32ptr()); @@ -5479,7 +5441,7 @@ bool LLVolumeFace::cacheOptimize(bool gen_tangents) { //optimize for vertex cache according to Forsyth method: LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME; llassert(!mOptimized); - mOptimized = TRUE; + mOptimized = true; if (gen_tangents && mNormals && mTexCoords) { // generate mikkt space tangents before cache optimizing since the index buffer may change @@ -5504,7 +5466,7 @@ bool LLVolumeFace::cacheOptimize(bool gen_tangents) U32 stream_count = data.w.empty() ? 4 : 5; - size_t vert_count = meshopt_generateVertexRemapMulti(&remap[0], nullptr, data.p.size(), data.p.size(), mos, stream_count); + S32 vert_count = static_cast<S32>(meshopt_generateVertexRemapMulti(&remap[0], nullptr, data.p.size(), data.p.size(), mos, stream_count)); if (vert_count < 65535 && vert_count != 0) { @@ -5518,11 +5480,11 @@ bool LLVolumeFace::cacheOptimize(bool gen_tangents) allocateTangents(mNumVertices); - for (int i = 0; i < mNumIndices; ++i) + for (S32 i = 0; i < mNumIndices; ++i) { U32 src_idx = i; U32 dst_idx = remap[i]; - if (dst_idx >= mNumVertices) + if (dst_idx >= (U32)mNumVertices) { dst_idx = mNumVertices - 1; // Shouldn't happen, figure out what gets returned in remap and why. @@ -5549,7 +5511,7 @@ bool LLVolumeFace::cacheOptimize(bool gen_tangents) scale.load3(mNormalizedScale.mV); scale.getF32ptr()[3] = 1.f; - for (int i = 0; i < mNumVertices; ++i) + for (S32 i = 0; i < mNumVertices; ++i) { mPositions[i].mul(inv_scale); mNormals[i].mul(scale); @@ -5710,7 +5672,7 @@ void LerpPlanarVertex(LLVolumeFace::VertexData& v0, vout.setNormal(v0.getNormal()); } -BOOL LLVolumeFace::createUnCutCubeCap(LLVolume* volume, BOOL partial_build) +bool LLVolumeFace::createUnCutCubeCap(LLVolume* volume, bool partial_build) { LL_CHECK_MEMORY @@ -5942,11 +5904,11 @@ BOOL LLVolumeFace::createUnCutCubeCap(LLVolume* volume, BOOL partial_build) } LL_CHECK_MEMORY - return TRUE; + return true; } -BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build) +bool LLVolumeFace::createCap(LLVolume* volume, bool partial_build) { if (!(mTypeMask & HOLLOW_MASK) && !(mTypeMask & OPEN_MASK) && @@ -6103,7 +6065,7 @@ BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build) //if (partial_build) //{ - // return TRUE; + // return true; //} if (mTypeMask & HOLLOW_MASK) @@ -6152,36 +6114,36 @@ BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build) (paV[0]*pbV[1] - pbV[0]*paV[1]) + (pbV[0]*p2V[1] - p2V[0]*pbV[1]); - BOOL use_tri1a2 = TRUE; - BOOL tri_1a2 = TRUE; - BOOL tri_21b = TRUE; + bool use_tri1a2 = true; + bool tri_1a2 = true; + bool tri_21b = true; if (area_1a2 < 0) { - tri_1a2 = FALSE; + tri_1a2 = false; } if (area_2ab < 0) { // Can't use, because it contains point b - tri_1a2 = FALSE; + tri_1a2 = false; } if (area_21b < 0) { - tri_21b = FALSE; + tri_21b = false; } if (area_1ba < 0) { // Can't use, because it contains point b - tri_21b = FALSE; + tri_21b = false; } if (!tri_1a2) { - use_tri1a2 = FALSE; + use_tri1a2 = false; } else if (!tri_21b) { - use_tri1a2 = TRUE; + use_tri1a2 = true; } else { @@ -6193,11 +6155,11 @@ BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build) if (d1.dot3(d1) < d2.dot3(d2)) { - use_tri1a2 = TRUE; + use_tri1a2 = true; } else { - use_tri1a2 = FALSE; + use_tri1a2 = false; } } @@ -6258,36 +6220,36 @@ BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build) (paV[0]*pbV[1] - pbV[0]*paV[1]) + (pbV[0]*p2V[1] - p2V[0]*pbV[1]); - BOOL use_tri1a2 = TRUE; - BOOL tri_1a2 = TRUE; - BOOL tri_21b = TRUE; + bool use_tri1a2 = true; + bool tri_1a2 = true; + bool tri_21b = true; if (area_1a2 < 0) { - tri_1a2 = FALSE; + tri_1a2 = false; } if (area_2ab < 0) { // Can't use, because it contains point b - tri_1a2 = FALSE; + tri_1a2 = false; } if (area_21b < 0) { - tri_21b = FALSE; + tri_21b = false; } if (area_1ba < 0) { // Can't use, because it contains point b - tri_21b = FALSE; + tri_21b = false; } if (!tri_1a2) { - use_tri1a2 = FALSE; + use_tri1a2 = false; } else if (!tri_21b) { - use_tri1a2 = TRUE; + use_tri1a2 = true; } else { @@ -6298,11 +6260,11 @@ BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build) if (d1.dot3(d1) < d2.dot3(d2)) { - use_tri1a2 = TRUE; + use_tri1a2 = true; } else { - use_tri1a2 = FALSE; + use_tri1a2 = false; } } @@ -6381,7 +6343,7 @@ BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build) norm[i].load4a(normal.getF32ptr()); } - return TRUE; + return true; } void LLVolumeFace::createTangents() @@ -6404,7 +6366,7 @@ void LLVolumeFace::createTangents() LLCalculateTangentArray(mNumVertices, mPositions, mNormals, mTexCoords, mNumIndices / 3, mIndices, mTangents); //normalize normals - for (U32 i = 0; i < mNumVertices; i++) + for (S32 i = 0; i < mNumVertices; i++) { //bump map/planar projection code requires normals to be normalized mNormals[i].normalize3fast(); @@ -6580,8 +6542,8 @@ void LLVolumeFace::pushIndex(const U16& idx) void LLVolumeFace::fillFromLegacyData(std::vector<LLVolumeFace::VertexData>& v, std::vector<U16>& idx) { - resizeVertices(v.size()); - resizeIndices(idx.size()); + resizeVertices(static_cast<S32>(v.size())); + resizeIndices(static_cast<S32>(idx.size())); for (U32 i = 0; i < v.size(); ++i) { @@ -6596,18 +6558,18 @@ void LLVolumeFace::fillFromLegacyData(std::vector<LLVolumeFace::VertexData>& v, } } -BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build) +bool LLVolumeFace::createSide(LLVolume* volume, bool partial_build) { LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME LL_CHECK_MEMORY - BOOL flat = mTypeMask & FLAT_MASK; + bool flat = mTypeMask & FLAT_MASK; U8 sculpt_type = volume->getParams().getSculptType(); U8 sculpt_stitching = sculpt_type & LL_SCULPT_TYPE_MASK; - BOOL sculpt_invert = sculpt_type & LL_SCULPT_FLAG_INVERT; - BOOL sculpt_mirror = sculpt_type & LL_SCULPT_FLAG_MIRROR; - BOOL sculpt_reverse_horizontal = (sculpt_invert ? !sculpt_mirror : sculpt_mirror); // XOR + bool sculpt_invert = sculpt_type & LL_SCULPT_FLAG_INVERT; + bool sculpt_mirror = sculpt_type & LL_SCULPT_FLAG_MIRROR; + bool sculpt_reverse_horizontal = (sculpt_invert ? !sculpt_mirror : sculpt_mirror); // XOR S32 num_vertices, num_indices; @@ -6623,7 +6585,7 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build) num_vertices = mNumS*mNumT; num_indices = (mNumS-1)*(mNumT-1)*6; - partial_build = (num_vertices > mNumVertices || num_indices > mNumIndices) ? FALSE : partial_build; + partial_build = (num_vertices > mNumVertices || num_indices > mNumIndices) ? false : partial_build; if (!partial_build) { @@ -6676,7 +6638,7 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build) { // Get s value for tex-coord. S32 index = mBeginS + s; - if (index >= profile.size()) + if (index >= (S32)profile.size()) { // edge? ss = flat ? 1.f - begin_stex : 1.f; @@ -6794,7 +6756,7 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build) S32 cur_index = 0; S32 cur_edge = 0; - BOOL flat_face = mTypeMask & FLAT_MASK; + bool flat_face = mTypeMask & FLAT_MASK; if (!partial_build) { @@ -6810,45 +6772,63 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build) mIndices[cur_index++] = s+1 + mNumS*t; //bottom right mIndices[cur_index++] = s+1 + mNumS*(t+1); //top right - mEdge[cur_edge++] = (mNumS-1)*2*t+s*2+1; //bottom left/top right neighbor face - if (t < mNumT-2) { //top right/top left neighbor face + // bottom left/top right neighbor face + mEdge[cur_edge++] = (mNumS-1)*2*t+s*2+1; + + if (t < mNumT-2) + { // top right/top left neighbor face mEdge[cur_edge++] = (mNumS-1)*2*(t+1)+s*2+1; } - else if (mNumT <= 3 || volume->getPath().isOpen() == TRUE) { //no neighbor + else if (mNumT <= 3 || volume->getPath().isOpen()) + { // no neighbor mEdge[cur_edge++] = -1; } - else { //wrap on T + else + { // wrap on T mEdge[cur_edge++] = s*2+1; } - if (s > 0) { //top left/bottom left neighbor face + + if (s > 0) + { // top left/bottom left neighbor face mEdge[cur_edge++] = (mNumS-1)*2*t+s*2-1; } - else if (flat_face || volume->getProfile().isOpen() == TRUE) { //no neighbor + else if (flat_face || volume->getProfile().isOpen()) + { // no neighbor mEdge[cur_edge++] = -1; } - else { //wrap on S + else + { // wrap on S mEdge[cur_edge++] = (mNumS-1)*2*t+(mNumS-2)*2+1; } - if (t > 0) { //bottom left/bottom right neighbor face + if (t > 0) + { // bottom left/bottom right neighbor face mEdge[cur_edge++] = (mNumS-1)*2*(t-1)+s*2; } - else if (mNumT <= 3 || volume->getPath().isOpen() == TRUE) { //no neighbor + else if (mNumT <= 3 || volume->getPath().isOpen()) + { // no neighbor mEdge[cur_edge++] = -1; } - else { //wrap on T + else + { // wrap on T mEdge[cur_edge++] = (mNumS-1)*2*(mNumT-2)+s*2; } - if (s < mNumS-2) { //bottom right/top right neighbor face + + if (s < mNumS-2) + { // bottom right/top right neighbor face mEdge[cur_edge++] = (mNumS-1)*2*t+(s+1)*2; } - else if (flat_face || volume->getProfile().isOpen() == TRUE) { //no neighbor + else if (flat_face || volume->getProfile().isOpen()) + { // no neighbor mEdge[cur_edge++] = -1; } - else { //wrap on S + else + { // wrap on S mEdge[cur_edge++] = (mNumS-1)*2*t; } - mEdge[cur_edge++] = (mNumS-1)*2*t+s*2; //top right/bottom left neighbor face + + // top right/bottom left neighbor face + mEdge[cur_edge++] = (mNumS-1)*2*t+s*2; } } } @@ -6978,14 +6958,14 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build) LLVector4a top; top.setSub(pos[0], pos[mNumS*(mNumT-2)]); - BOOL s_bottom_converges = (top.dot3(top) < 0.000001f); + bool s_bottom_converges = (top.dot3(top) < 0.000001f); top.setSub(pos[mNumS-1], pos[mNumS*(mNumT-2)+mNumS-1]); - BOOL s_top_converges = (top.dot3(top) < 0.000001f); + bool s_top_converges = (top.dot3(top) < 0.000001f); if (sculpt_stitching == LL_SCULPT_TYPE_NONE) // logic for non-sculpt volumes { - if (volume->getPath().isOpen() == FALSE) + if (!volume->getPath().isOpen()) { //wrap normals on T for (S32 i = 0; i < mNumS; i++) { @@ -6996,7 +6976,7 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build) } } - if ((volume->getProfile().isOpen() == FALSE) && !(s_bottom_converges)) + if (!volume->getProfile().isOpen() && !s_bottom_converges) { //wrap normals on S for (S32 i = 0; i < mNumT; i++) { @@ -7029,20 +7009,20 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build) } else // logic for sculpt volumes { - BOOL average_poles = FALSE; - BOOL wrap_s = FALSE; - BOOL wrap_t = FALSE; + bool average_poles = false; + bool wrap_s = false; + bool wrap_t = false; if (sculpt_stitching == LL_SCULPT_TYPE_SPHERE) - average_poles = TRUE; + average_poles = true; if ((sculpt_stitching == LL_SCULPT_TYPE_SPHERE) || (sculpt_stitching == LL_SCULPT_TYPE_TORUS) || (sculpt_stitching == LL_SCULPT_TYPE_CYLINDER)) - wrap_s = TRUE; + wrap_s = true; if (sculpt_stitching == LL_SCULPT_TYPE_TORUS) - wrap_t = TRUE; + wrap_t = true; if (average_poles) @@ -7107,7 +7087,7 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build) LL_CHECK_MEMORY - return TRUE; + return true; } //adapted from Lengyel, Eric. "Computing Tangent Space Basis Vectors for an Arbitrary Mesh". Terathon Software 3D Graphics Library, 2001. http://www.terathon.com/code/tangent.html diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h index d53ca2a4b3..bbb2a16b0b 100644 --- a/indra/llmath/llvolume.h +++ b/indra/llmath/llvolume.h @@ -63,146 +63,148 @@ class LLVolumeOctree; //============================================================================ -const S32 MIN_DETAIL_FACES = 6; -const S32 MIN_LOD = 0; -const S32 MAX_LOD = 3; +constexpr S32 MIN_DETAIL_FACES = 6; +constexpr S32 MIN_LOD = 0; +constexpr S32 MAX_LOD = 3; // These are defined here but are not enforced at this level, // rather they are here for the convenience of code that uses // the LLVolume class. -const F32 MIN_VOLUME_PROFILE_WIDTH = 0.05f; -const F32 MIN_VOLUME_PATH_WIDTH = 0.05f; +constexpr F32 MIN_VOLUME_PROFILE_WIDTH = 0.05f; +constexpr F32 MIN_VOLUME_PATH_WIDTH = 0.05f; -const F32 CUT_QUANTA = 0.00002f; -const F32 SCALE_QUANTA = 0.01f; -const F32 SHEAR_QUANTA = 0.01f; -const F32 TAPER_QUANTA = 0.01f; -const F32 REV_QUANTA = 0.015f; -const F32 HOLLOW_QUANTA = 0.00002f; +constexpr F32 CUT_QUANTA = 0.00002f; +constexpr F32 SCALE_QUANTA = 0.01f; +constexpr F32 SHEAR_QUANTA = 0.01f; +constexpr F32 TAPER_QUANTA = 0.01f; +constexpr F32 REV_QUANTA = 0.015f; +constexpr F32 HOLLOW_QUANTA = 0.00002f; -const S32 MAX_VOLUME_TRIANGLE_INDICES = 10000; +constexpr S32 MAX_VOLUME_TRIANGLE_INDICES = 10000; //============================================================================ // useful masks -const LLPCode LL_PCODE_HOLLOW_MASK = 0x80; // has a thickness -const LLPCode LL_PCODE_SEGMENT_MASK = 0x40; // segments (1 angle) -const LLPCode LL_PCODE_PATCH_MASK = 0x20; // segmented segments (2 angles) -const LLPCode LL_PCODE_HEMI_MASK = 0x10; // half-primitives get their own type per PR's dictum -const LLPCode LL_PCODE_BASE_MASK = 0x0F; +constexpr LLPCode LL_PCODE_HOLLOW_MASK = 0x80; // has a thickness +constexpr LLPCode LL_PCODE_SEGMENT_MASK = 0x40; // segments (1 angle) +constexpr LLPCode LL_PCODE_PATCH_MASK = 0x20; // segmented segments (2 angles) +constexpr LLPCode LL_PCODE_HEMI_MASK = 0x10; // half-primitives get their own type per PR's dictum +constexpr LLPCode LL_PCODE_BASE_MASK = 0x0F; // primitive shapes -const LLPCode LL_PCODE_CUBE = 1; -const LLPCode LL_PCODE_PRISM = 2; -const LLPCode LL_PCODE_TETRAHEDRON = 3; -const LLPCode LL_PCODE_PYRAMID = 4; -const LLPCode LL_PCODE_CYLINDER = 5; -const LLPCode LL_PCODE_CONE = 6; -const LLPCode LL_PCODE_SPHERE = 7; -const LLPCode LL_PCODE_TORUS = 8; -const LLPCode LL_PCODE_VOLUME = 9; +constexpr LLPCode LL_PCODE_CUBE = 1; +constexpr LLPCode LL_PCODE_PRISM = 2; +constexpr LLPCode LL_PCODE_TETRAHEDRON = 3; +constexpr LLPCode LL_PCODE_PYRAMID = 4; +constexpr LLPCode LL_PCODE_CYLINDER = 5; +constexpr LLPCode LL_PCODE_CONE = 6; +constexpr LLPCode LL_PCODE_SPHERE = 7; +constexpr LLPCode LL_PCODE_TORUS = 8; +constexpr LLPCode LL_PCODE_VOLUME = 9; // surfaces -//const LLPCode LL_PCODE_SURFACE_TRIANGLE = 10; -//const LLPCode LL_PCODE_SURFACE_SQUARE = 11; -//const LLPCode LL_PCODE_SURFACE_DISC = 12; +//constexpr LLPCode LL_PCODE_SURFACE_TRIANGLE = 10; +//constexpr LLPCode LL_PCODE_SURFACE_SQUARE = 11; +//constexpr LLPCode LL_PCODE_SURFACE_DISC = 12; -const LLPCode LL_PCODE_APP = 14; // App specific pcode (for viewer/sim side only objects) -const LLPCode LL_PCODE_LEGACY = 15; +constexpr LLPCode LL_PCODE_APP = 14; // App specific pcode (for viewer/sim side only objects) +constexpr LLPCode LL_PCODE_LEGACY = 15; // Pcodes for legacy objects -//const LLPCode LL_PCODE_LEGACY_ATOR = 0x10 | LL_PCODE_LEGACY; // ATOR -const LLPCode LL_PCODE_LEGACY_AVATAR = 0x20 | LL_PCODE_LEGACY; // PLAYER -//const LLPCode LL_PCODE_LEGACY_BIRD = 0x30 | LL_PCODE_LEGACY; // BIRD -//const LLPCode LL_PCODE_LEGACY_DEMON = 0x40 | LL_PCODE_LEGACY; // DEMON -const LLPCode LL_PCODE_LEGACY_GRASS = 0x50 | LL_PCODE_LEGACY; // GRASS -const LLPCode LL_PCODE_TREE_NEW = 0x60 | LL_PCODE_LEGACY; // new trees -//const LLPCode LL_PCODE_LEGACY_ORACLE = 0x70 | LL_PCODE_LEGACY; // ORACLE -const LLPCode LL_PCODE_LEGACY_PART_SYS = 0x80 | LL_PCODE_LEGACY; // PART_SYS -const LLPCode LL_PCODE_LEGACY_ROCK = 0x90 | LL_PCODE_LEGACY; // ROCK -//const LLPCode LL_PCODE_LEGACY_SHOT = 0xA0 | LL_PCODE_LEGACY; // BASIC_SHOT -//const LLPCode LL_PCODE_LEGACY_SHOT_BIG = 0xB0 | LL_PCODE_LEGACY; -//const LLPCode LL_PCODE_LEGACY_SMOKE = 0xC0 | LL_PCODE_LEGACY; // SMOKE -//const LLPCode LL_PCODE_LEGACY_SPARK = 0xD0 | LL_PCODE_LEGACY;// SPARK -const LLPCode LL_PCODE_LEGACY_TEXT_BUBBLE = 0xE0 | LL_PCODE_LEGACY; // TEXTBUBBLE -const LLPCode LL_PCODE_LEGACY_TREE = 0xF0 | LL_PCODE_LEGACY; // TREE +//constexpr LLPCode LL_PCODE_LEGACY_ATOR = 0x10 | LL_PCODE_LEGACY; // ATOR +constexpr LLPCode LL_PCODE_LEGACY_AVATAR = 0x20 | LL_PCODE_LEGACY; // PLAYER +//constexpr LLPCode LL_PCODE_LEGACY_BIRD = 0x30 | LL_PCODE_LEGACY; // BIRD +//constexpr LLPCode LL_PCODE_LEGACY_DEMON = 0x40 | LL_PCODE_LEGACY; // DEMON +constexpr LLPCode LL_PCODE_LEGACY_GRASS = 0x50 | LL_PCODE_LEGACY; // GRASS +constexpr LLPCode LL_PCODE_TREE_NEW = 0x60 | LL_PCODE_LEGACY; // new trees +//constexpr LLPCode LL_PCODE_LEGACY_ORACLE = 0x70 | LL_PCODE_LEGACY; // ORACLE +constexpr LLPCode LL_PCODE_LEGACY_PART_SYS = 0x80 | LL_PCODE_LEGACY; // PART_SYS +constexpr LLPCode LL_PCODE_LEGACY_ROCK = 0x90 | LL_PCODE_LEGACY; // ROCK +//constexpr LLPCode LL_PCODE_LEGACY_SHOT = 0xA0 | LL_PCODE_LEGACY; // BASIC_SHOT +//constexpr LLPCode LL_PCODE_LEGACY_SHOT_BIG = 0xB0 | LL_PCODE_LEGACY; +//constexpr LLPCode LL_PCODE_LEGACY_SMOKE = 0xC0 | LL_PCODE_LEGACY; // SMOKE +//constexpr LLPCode LL_PCODE_LEGACY_SPARK = 0xD0 | LL_PCODE_LEGACY;// SPARK +constexpr LLPCode LL_PCODE_LEGACY_TEXT_BUBBLE = 0xE0 | LL_PCODE_LEGACY; // TEXTBUBBLE +constexpr LLPCode LL_PCODE_LEGACY_TREE = 0xF0 | LL_PCODE_LEGACY; // TREE // hemis -const LLPCode LL_PCODE_CYLINDER_HEMI = LL_PCODE_CYLINDER | LL_PCODE_HEMI_MASK; -const LLPCode LL_PCODE_CONE_HEMI = LL_PCODE_CONE | LL_PCODE_HEMI_MASK; -const LLPCode LL_PCODE_SPHERE_HEMI = LL_PCODE_SPHERE | LL_PCODE_HEMI_MASK; -const LLPCode LL_PCODE_TORUS_HEMI = LL_PCODE_TORUS | LL_PCODE_HEMI_MASK; +constexpr LLPCode LL_PCODE_CYLINDER_HEMI = LL_PCODE_CYLINDER | LL_PCODE_HEMI_MASK; +constexpr LLPCode LL_PCODE_CONE_HEMI = LL_PCODE_CONE | LL_PCODE_HEMI_MASK; +constexpr LLPCode LL_PCODE_SPHERE_HEMI = LL_PCODE_SPHERE | LL_PCODE_HEMI_MASK; +constexpr LLPCode LL_PCODE_TORUS_HEMI = LL_PCODE_TORUS | LL_PCODE_HEMI_MASK; // Volumes consist of a profile at the base that is swept around // a path to make a volume. // The profile code -const U8 LL_PCODE_PROFILE_MASK = 0x0f; -const U8 LL_PCODE_PROFILE_MIN = 0x00; -const U8 LL_PCODE_PROFILE_CIRCLE = 0x00; -const U8 LL_PCODE_PROFILE_SQUARE = 0x01; -const U8 LL_PCODE_PROFILE_ISOTRI = 0x02; -const U8 LL_PCODE_PROFILE_EQUALTRI = 0x03; -const U8 LL_PCODE_PROFILE_RIGHTTRI = 0x04; -const U8 LL_PCODE_PROFILE_CIRCLE_HALF = 0x05; -const U8 LL_PCODE_PROFILE_MAX = 0x05; +constexpr U8 LL_PCODE_PROFILE_MASK = 0x0f; +constexpr U8 LL_PCODE_PROFILE_MIN = 0x00; +constexpr U8 LL_PCODE_PROFILE_CIRCLE = 0x00; +constexpr U8 LL_PCODE_PROFILE_SQUARE = 0x01; +constexpr U8 LL_PCODE_PROFILE_ISOTRI = 0x02; +constexpr U8 LL_PCODE_PROFILE_EQUALTRI = 0x03; +constexpr U8 LL_PCODE_PROFILE_RIGHTTRI = 0x04; +constexpr U8 LL_PCODE_PROFILE_CIRCLE_HALF = 0x05; +constexpr U8 LL_PCODE_PROFILE_MAX = 0x05; // Stored in the profile byte -const U8 LL_PCODE_HOLE_MASK = 0xf0; -const U8 LL_PCODE_HOLE_MIN = 0x00; -const U8 LL_PCODE_HOLE_SAME = 0x00; // same as outside profile -const U8 LL_PCODE_HOLE_CIRCLE = 0x10; -const U8 LL_PCODE_HOLE_SQUARE = 0x20; -const U8 LL_PCODE_HOLE_TRIANGLE = 0x30; -const U8 LL_PCODE_HOLE_MAX = 0x03; // min/max needs to be >> 4 of real min/max - -const U8 LL_PCODE_PATH_IGNORE = 0x00; -const U8 LL_PCODE_PATH_MIN = 0x01; // min/max needs to be >> 4 of real min/max -const U8 LL_PCODE_PATH_LINE = 0x10; -const U8 LL_PCODE_PATH_CIRCLE = 0x20; -const U8 LL_PCODE_PATH_CIRCLE2 = 0x30; -const U8 LL_PCODE_PATH_TEST = 0x40; -const U8 LL_PCODE_PATH_FLEXIBLE = 0x80; -const U8 LL_PCODE_PATH_MAX = 0x08; +constexpr U8 LL_PCODE_HOLE_MASK = 0xf0; +constexpr U8 LL_PCODE_HOLE_MIN = 0x00; +constexpr U8 LL_PCODE_HOLE_SAME = 0x00; // same as outside profile +constexpr U8 LL_PCODE_HOLE_CIRCLE = 0x10; +constexpr U8 LL_PCODE_HOLE_SQUARE = 0x20; +constexpr U8 LL_PCODE_HOLE_TRIANGLE = 0x30; +constexpr U8 LL_PCODE_HOLE_MAX = 0x03; // min/max needs to be >> 4 of real min/max + +constexpr U8 LL_PCODE_PATH_IGNORE = 0x00; +constexpr U8 LL_PCODE_PATH_MIN = 0x01; // min/max needs to be >> 4 of real min/max +constexpr U8 LL_PCODE_PATH_LINE = 0x10; +constexpr U8 LL_PCODE_PATH_CIRCLE = 0x20; +constexpr U8 LL_PCODE_PATH_CIRCLE2 = 0x30; +constexpr U8 LL_PCODE_PATH_TEST = 0x40; +constexpr U8 LL_PCODE_PATH_FLEXIBLE = 0x80; +constexpr U8 LL_PCODE_PATH_MAX = 0x08; //============================================================================ // face identifiers typedef U16 LLFaceID; -const LLFaceID LL_FACE_PATH_BEGIN = 0x1 << 0; -const LLFaceID LL_FACE_PATH_END = 0x1 << 1; -const LLFaceID LL_FACE_INNER_SIDE = 0x1 << 2; -const LLFaceID LL_FACE_PROFILE_BEGIN = 0x1 << 3; -const LLFaceID LL_FACE_PROFILE_END = 0x1 << 4; -const LLFaceID LL_FACE_OUTER_SIDE_0 = 0x1 << 5; -const LLFaceID LL_FACE_OUTER_SIDE_1 = 0x1 << 6; -const LLFaceID LL_FACE_OUTER_SIDE_2 = 0x1 << 7; -const LLFaceID LL_FACE_OUTER_SIDE_3 = 0x1 << 8; +constexpr LLFaceID LL_FACE_PATH_BEGIN = 0x1 << 0; +constexpr LLFaceID LL_FACE_PATH_END = 0x1 << 1; +constexpr LLFaceID LL_FACE_INNER_SIDE = 0x1 << 2; +constexpr LLFaceID LL_FACE_PROFILE_BEGIN = 0x1 << 3; +constexpr LLFaceID LL_FACE_PROFILE_END = 0x1 << 4; +constexpr LLFaceID LL_FACE_OUTER_SIDE_0 = 0x1 << 5; +constexpr LLFaceID LL_FACE_OUTER_SIDE_1 = 0x1 << 6; +constexpr LLFaceID LL_FACE_OUTER_SIDE_2 = 0x1 << 7; +constexpr LLFaceID LL_FACE_OUTER_SIDE_3 = 0x1 << 8; //============================================================================ // sculpt types + flags -const U8 LL_SCULPT_TYPE_NONE = 0; -const U8 LL_SCULPT_TYPE_SPHERE = 1; -const U8 LL_SCULPT_TYPE_TORUS = 2; -const U8 LL_SCULPT_TYPE_PLANE = 3; -const U8 LL_SCULPT_TYPE_CYLINDER = 4; -const U8 LL_SCULPT_TYPE_MESH = 5; -const U8 LL_SCULPT_TYPE_MASK = LL_SCULPT_TYPE_SPHERE | LL_SCULPT_TYPE_TORUS | LL_SCULPT_TYPE_PLANE | - LL_SCULPT_TYPE_CYLINDER | LL_SCULPT_TYPE_MESH; +constexpr U8 LL_SCULPT_TYPE_NONE = 0; +constexpr U8 LL_SCULPT_TYPE_SPHERE = 1; +constexpr U8 LL_SCULPT_TYPE_TORUS = 2; +constexpr U8 LL_SCULPT_TYPE_PLANE = 3; +constexpr U8 LL_SCULPT_TYPE_CYLINDER = 4; +constexpr U8 LL_SCULPT_TYPE_MESH = 5; +constexpr U8 LL_SCULPT_TYPE_GLTF = 6; +constexpr U8 LL_SCULPT_TYPE_MAX = LL_SCULPT_TYPE_GLTF; + +constexpr U8 LL_SCULPT_TYPE_MASK = LL_SCULPT_TYPE_SPHERE | LL_SCULPT_TYPE_TORUS | LL_SCULPT_TYPE_PLANE | + LL_SCULPT_TYPE_CYLINDER | LL_SCULPT_TYPE_MESH | LL_SCULPT_TYPE_GLTF; // for value checks, assign new value after adding new types -const U8 LL_SCULPT_TYPE_MAX = LL_SCULPT_TYPE_MESH; -const U8 LL_SCULPT_FLAG_INVERT = 64; -const U8 LL_SCULPT_FLAG_MIRROR = 128; -const U8 LL_SCULPT_FLAG_MASK = LL_SCULPT_FLAG_INVERT | LL_SCULPT_FLAG_MIRROR; +constexpr U8 LL_SCULPT_FLAG_INVERT = 64; +constexpr U8 LL_SCULPT_FLAG_MIRROR = 128; +constexpr U8 LL_SCULPT_FLAG_MASK = LL_SCULPT_FLAG_INVERT | LL_SCULPT_FLAG_MIRROR; -const S32 LL_SCULPT_MESH_MAX_FACES = 8; +constexpr S32 LL_SCULPT_MESH_MAX_FACES = 8; -extern BOOL gDebugGL; +extern bool gDebugGL; class LLProfileParams { @@ -255,11 +257,11 @@ public: void copyParams(const LLProfileParams ¶ms); - BOOL importFile(LLFILE *fp); - BOOL exportFile(LLFILE *fp) const; + bool importFile(LLFILE *fp); + bool exportFile(LLFILE *fp) const; - BOOL importLegacyStream(std::istream& input_stream); - BOOL exportLegacyStream(std::ostream& output_stream) const; + bool importLegacyStream(std::istream& input_stream); + bool exportLegacyStream(std::ostream& output_stream) const; LLSD asLLSD() const; operator LLSD() const { return asLLSD(); } @@ -391,11 +393,11 @@ public: void copyParams(const LLPathParams ¶ms); - BOOL importFile(LLFILE *fp); - BOOL exportFile(LLFILE *fp) const; + bool importFile(LLFILE *fp); + bool exportFile(LLFILE *fp) const; - BOOL importLegacyStream(std::istream& input_stream); - BOOL exportLegacyStream(std::ostream& output_stream) const; + bool importLegacyStream(std::istream& input_stream); + bool exportLegacyStream(std::ostream& output_stream) const; LLSD asLLSD() const; operator LLSD() const { return asLLSD(); } @@ -583,11 +585,11 @@ public: const LLPathParams &getPathParams() const {return mPathParams;} LLPathParams &getPathParams() {return mPathParams;} - BOOL importFile(LLFILE *fp); - BOOL exportFile(LLFILE *fp) const; + bool importFile(LLFILE *fp); + bool exportFile(LLFILE *fp) const; - BOOL importLegacyStream(std::istream& input_stream); - BOOL exportLegacyStream(std::ostream& output_stream) const; + bool importLegacyStream(std::istream& input_stream); + bool exportLegacyStream(std::ostream& output_stream) const; LLSD sculptAsLLSD() const; bool sculptFromLLSD(LLSD& sd); @@ -621,7 +623,7 @@ public: bool setRevolutions(const F32 revolutions); // 1 to 4 bool setRadiusOffset(const F32 radius_offset); bool setSkew(const F32 skew); - bool setSculptID(const LLUUID sculpt_id, U8 sculpt_type); + bool setSculptID(const LLUUID& sculpt_id, U8 sculpt_type); static bool validate(U8 prof_curve, F32 prof_begin, F32 prof_end, F32 hollow, U8 path_curve, F32 path_begin, F32 path_end, @@ -653,7 +655,7 @@ public: const U8& getSculptType() const { return mSculptType; } bool isSculpt() const; bool isMeshSculpt() const; - BOOL isConvex() const; + bool isConvex() const; // 'begin' and 'end' should be in range [0, 1] (they will be clamped) // (begin, end) = (0, 1) will not change the volume @@ -688,9 +690,9 @@ class LLProfile public: LLProfile() - : mOpen(FALSE), - mConcave(FALSE), - mDirty(TRUE), + : mOpen(false), + mConcave(false), + mDirty(true), mTotalOut(0), mTotal(2) { @@ -698,23 +700,23 @@ public: S32 getTotal() const { return mTotal; } S32 getTotalOut() const { return mTotalOut; } // Total number of outside points - BOOL isFlat(S32 face) const { return (mFaces[face].mCount == 2); } - BOOL isOpen() const { return mOpen; } - void setDirty() { mDirty = TRUE; } - - static S32 getNumPoints(const LLProfileParams& params, BOOL path_open, F32 detail = 1.0f, S32 split = 0, - BOOL is_sculpted = FALSE, S32 sculpt_size = 0); - BOOL generate(const LLProfileParams& params, BOOL path_open, F32 detail = 1.0f, S32 split = 0, - BOOL is_sculpted = FALSE, S32 sculpt_size = 0); - BOOL isConcave() const { return mConcave; } + bool isFlat(S32 face) const { return (mFaces[face].mCount == 2); } + bool isOpen() const { return mOpen; } + void setDirty() { mDirty = true; } + + static S32 getNumPoints(const LLProfileParams& params, bool path_open, F32 detail = 1.0f, S32 split = 0, + bool is_sculpted = false, S32 sculpt_size = 0); + bool generate(const LLProfileParams& params, bool path_open, F32 detail = 1.0f, S32 split = 0, + bool is_sculpted = false, S32 sculpt_size = 0); + bool isConcave() const { return mConcave; } public: struct Face { S32 mIndex; S32 mCount; F32 mScaleU; - BOOL mCap; - BOOL mFlat; + bool mCap; + bool mFlat; LLFaceID mFaceID; }; @@ -733,14 +735,14 @@ protected: static S32 getNumNGonPoints(const LLProfileParams& params, S32 sides, F32 offset=0.0f, F32 bevel = 0.0f, F32 ang_scale = 1.f, S32 split = 0); void genNGon(const LLProfileParams& params, S32 sides, F32 offset=0.0f, F32 bevel = 0.0f, F32 ang_scale = 1.f, S32 split = 0); - Face* addHole(const LLProfileParams& params, BOOL flat, F32 sides, F32 offset, F32 box_hollow, F32 ang_scale, S32 split = 0); + Face* addHole(const LLProfileParams& params, bool flat, F32 sides, F32 offset, F32 box_hollow, F32 ang_scale, S32 split = 0); Face* addCap (S16 faceID); - Face* addFace(S32 index, S32 count, F32 scaleU, S16 faceID, BOOL flat); + Face* addFace(S32 index, S32 count, F32 scaleU, S16 faceID, bool flat); protected: - BOOL mOpen; - BOOL mConcave; - BOOL mDirty; + bool mOpen; + bool mConcave; + bool mDirty; S32 mTotalOut; S32 mTotal; @@ -780,9 +782,9 @@ public: public: LLPath() - : mOpen(FALSE), + : mOpen(false), mTotal(0), - mDirty(TRUE), + mDirty(true), mStep(1) { } @@ -793,12 +795,12 @@ public: static S32 getNumNGonPoints(const LLPathParams& params, S32 sides, F32 offset=0.0f, F32 end_scale = 1.f, F32 twist_scale = 1.f); void genNGon(const LLPathParams& params, S32 sides, F32 offset=0.0f, F32 end_scale = 1.f, F32 twist_scale = 1.f); - virtual BOOL generate(const LLPathParams& params, F32 detail=1.0f, S32 split = 0, - BOOL is_sculpted = FALSE, S32 sculpt_size = 0); + virtual bool generate(const LLPathParams& params, F32 detail=1.0f, S32 split = 0, + bool is_sculpted = false, S32 sculpt_size = 0); - BOOL isOpen() const { return mOpen; } + bool isOpen() const { return mOpen; } F32 getStep() const { return mStep; } - void setDirty() { mDirty = TRUE; } + void setDirty() { mDirty = true; } S32 getPathLength() const { return (S32)mPath.size(); } @@ -810,9 +812,9 @@ public: LLAlignedArray<PathPt, 64> mPath; protected: - BOOL mOpen; + bool mOpen; S32 mTotal; - BOOL mDirty; + bool mDirty; F32 mStep; }; @@ -820,8 +822,8 @@ class LLDynamicPath : public LLPath { public: LLDynamicPath() : LLPath() { } - /*virtual*/ BOOL generate(const LLPathParams& params, F32 detail=1.0f, S32 split = 0, - BOOL is_sculpted = FALSE, S32 sculpt_size = 0); + /*virtual*/ bool generate(const LLPathParams& params, F32 detail=1.0f, S32 split = 0, + bool is_sculpted = false, S32 sculpt_size = 0); }; // Yet another "face" class - caches volume-specific, but not instance-specific data for faces) @@ -871,7 +873,7 @@ private: void freeData(); public: - BOOL create(LLVolume* volume, BOOL partial_build = FALSE); + bool create(LLVolume* volume, bool partial_build = false); void createTangents(); void resizeVertices(S32 num_verts); @@ -973,14 +975,14 @@ public: U8* mJointIndices; #endif - mutable BOOL mWeightsScrubbed; + mutable bool mWeightsScrubbed; // Which joints are rigged to, and the bounding box of any rigged // vertices per joint. LLJointRiggingInfoTab mJointRiggingInfoTab; //whether or not face has been cache optimized - BOOL mOptimized; + bool mOptimized; // if this is a mesh asset, scale and translation that were applied // when encoding the source mesh into a unit cube @@ -991,9 +993,9 @@ private: LLVolumeOctree* mOctree; LLVolumeTriangle* mOctreeTriangles; - BOOL createUnCutCubeCap(LLVolume* volume, BOOL partial_build = FALSE); - BOOL createCap(LLVolume* volume, BOOL partial_build = FALSE); - BOOL createSide(LLVolume* volume, BOOL partial_build = FALSE); + bool createUnCutCubeCap(LLVolume* volume, bool partial_build = false); + bool createCap(LLVolume* volume, bool partial_build = false); + bool createSide(LLVolume* volume, bool partial_build = false); }; class LLVolume : public LLRefCount @@ -1015,12 +1017,12 @@ public: S32 mCountT; }; - LLVolume(const LLVolumeParams ¶ms, const F32 detail, const BOOL generate_single_face = FALSE, const BOOL is_unique = FALSE); + LLVolume(const LLVolumeParams ¶ms, const F32 detail, const bool generate_single_face = false, const bool is_unique = false); U8 getProfileType() const { return mParams.getProfileParams().getCurveType(); } U8 getPathType() const { return mParams.getPathParams().getCurveType(); } S32 getNumFaces() const; - S32 getNumVolumeFaces() const { return mVolumeFaces.size(); } + S32 getNumVolumeFaces() const { return static_cast<S32>(mVolumeFaces.size()); } F32 getDetail() const { return mDetail; } F32 getSurfaceArea() const { return mSurfaceArea; } const LLVolumeParams& getParams() const { return mParams; } @@ -1037,10 +1039,10 @@ public: void regen(); void genTangents(S32 face); - BOOL isConvex() const; - BOOL isCap(S32 face); - BOOL isFlat(S32 face); - BOOL isUnique() const { return mUnique; } + bool isConvex() const; + bool isCap(S32 face); + bool isFlat(S32 face); + bool isUnique() const { return mUnique; } S32 getSculptLevel() const { return mSculptLevel; } void setSculptLevel(S32 level) { mSculptLevel = level; } @@ -1048,7 +1050,7 @@ public: static void getLoDTriangleCounts(const LLVolumeParams& params, S32* counts); - S32 getNumTriangles(S32* vcount = NULL) const; + S32 getNumTriangles(S32* vcount = nullptr) const; void generateSilhouetteVertices(std::vector<LLVector3> &vertices, std::vector<LLVector3> &normals, @@ -1062,15 +1064,15 @@ public: //Line segment must be in volume space. S32 lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, S32 face = -1, // which face to check, -1 = ALL_SIDES - LLVector4a* intersection = NULL, // return the intersection point - LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point - LLVector4a* normal = NULL, // return the surface normal at the intersection point - LLVector4a* tangent = NULL // return the surface tangent at the intersection point + LLVector4a* intersection = nullptr, // return the intersection point + LLVector2* tex_coord = nullptr, // return the texture coordinates of the intersection point + LLVector4a* normal = nullptr, // return the surface normal at the intersection point + LLVector4a* tangent = nullptr // return the surface tangent at the intersection point ); LLFaceID generateFaceMask(); - BOOL isFaceMaskValid(LLFaceID face_mask); + bool isFaceMaskValid(LLFaceID face_mask); static S32 sNumMeshPoints; friend std::ostream& operator<<(std::ostream &s, const LLVolume &volume); @@ -1099,11 +1101,9 @@ private: F32 sculptGetSurfaceArea(); void sculptGenerateEmptyPlaceholder(); void sculptGenerateSpherePlaceholder(); - void sculptCalcMeshResolution(U16 width, U16 height, U8 type, S32& s, S32& t); - protected: - BOOL generate(); + bool generate(); void createVolumeFaces(); public: bool unpackVolumeFaces(std::istream& is, S32 size); @@ -1118,7 +1118,7 @@ public: virtual bool isMeshAssetUnavaliable(); protected: - BOOL mUnique; + bool mUnique; F32 mDetail; S32 mSculptLevel; F32 mSurfaceArea; //unscaled surface area @@ -1131,7 +1131,7 @@ public: LLAlignedArray<LLVector4a,64> mMesh; - BOOL mGenerateSingleFace; + bool mGenerateSingleFace; face_list_t mVolumeFaces; public: @@ -1145,18 +1145,13 @@ std::ostream& operator<<(std::ostream &s, const LLVolumeParams &volume_params); void LLCalculateTangentArray(U32 vertexCount, const LLVector4a *vertex, const LLVector4a *normal, const LLVector2 *texcoord, U32 triangleCount, const U16* index_array, LLVector4a *tangent); -BOOL LLLineSegmentBoxIntersect(const F32* start, const F32* end, const F32* center, const F32* size); -BOOL LLLineSegmentBoxIntersect(const LLVector3& start, const LLVector3& end, const LLVector3& center, const LLVector3& size); -BOOL LLLineSegmentBoxIntersect(const LLVector4a& start, const LLVector4a& end, const LLVector4a& center, const LLVector4a& size); - -//BOOL LLTriangleRayIntersect(const LLVector3& vert0, const LLVector3& vert1, const LLVector3& vert2, const LLVector3& orig, const LLVector3& dir, -// F32& intersection_a, F32& intersection_b, F32& intersection_t, BOOL two_sided); +bool LLLineSegmentBoxIntersect(const F32* start, const F32* end, const F32* center, const F32* size); +bool LLLineSegmentBoxIntersect(const LLVector3& start, const LLVector3& end, const LLVector3& center, const LLVector3& size); +bool LLLineSegmentBoxIntersect(const LLVector4a& start, const LLVector4a& end, const LLVector4a& center, const LLVector4a& size); -BOOL LLTriangleRayIntersect(const LLVector4a& vert0, const LLVector4a& vert1, const LLVector4a& vert2, const LLVector4a& orig, const LLVector4a& dir, +bool LLTriangleRayIntersect(const LLVector4a& vert0, const LLVector4a& vert1, const LLVector4a& vert2, const LLVector4a& orig, const LLVector4a& dir, F32& intersection_a, F32& intersection_b, F32& intersection_t); -BOOL LLTriangleRayIntersectTwoSided(const LLVector4a& vert0, const LLVector4a& vert1, const LLVector4a& vert2, const LLVector4a& orig, const LLVector4a& dir, +bool LLTriangleRayIntersectTwoSided(const LLVector4a& vert0, const LLVector4a& vert1, const LLVector4a& vert2, const LLVector4a& orig, const LLVector4a& dir, F32& intersection_a, F32& intersection_b, F32& intersection_t); - - #endif diff --git a/indra/llmath/llvolumemgr.cpp b/indra/llmath/llvolumemgr.cpp index 6f82335b3f..bb0c94d513 100644 --- a/indra/llmath/llvolumemgr.cpp +++ b/indra/llmath/llvolumemgr.cpp @@ -59,9 +59,9 @@ LLVolumeMgr::~LLVolumeMgr() mDataMutex = NULL; } -BOOL LLVolumeMgr::cleanup() +bool LLVolumeMgr::cleanup() { - BOOL no_refs = TRUE; + bool no_refs = true; if (mDataMutex) { mDataMutex->lock(); @@ -71,9 +71,9 @@ BOOL LLVolumeMgr::cleanup() iter != end; iter++) { LLVolumeLODGroup *volgroupp = iter->second; - if (volgroupp->cleanupRefs() == false) + if (!volgroupp->cleanupRefs()) { - no_refs = FALSE; + no_refs = false; } delete volgroupp; } @@ -301,7 +301,7 @@ LLVolume* LLVolumeLODGroup::refLOD(const S32 lod) return mVolumeLODs[lod]; } -BOOL LLVolumeLODGroup::derefLOD(LLVolume *volumep) +bool LLVolumeLODGroup::derefLOD(LLVolume *volumep) { llassert_always(mRefs > 0); mRefs--; @@ -317,11 +317,11 @@ BOOL LLVolumeLODGroup::derefLOD(LLVolume *volumep) mVolumeLODs[i] = NULL; } #endif - return TRUE; + return true; } } LL_ERRS() << "Deref of non-matching LOD in volume LOD group" << LL_ENDL; - return FALSE; + return false; } S32 LLVolumeLODGroup::getDetailFromTan(const F32 tan_angle) diff --git a/indra/llmath/llvolumemgr.h b/indra/llmath/llvolumemgr.h index b46e9aa725..2e0ce3e88a 100644 --- a/indra/llmath/llvolumemgr.h +++ b/indra/llmath/llvolumemgr.h @@ -56,7 +56,7 @@ public: static S32 getVolumeDetailFromScale(F32 scale); LLVolume* refLOD(const S32 detail); - BOOL derefLOD(LLVolume *volumep); + bool derefLOD(LLVolume *volumep); S32 getNumRefs() const { return mRefs; } const LLVolumeParams* getVolumeParams() const { return &mVolumeParams; }; @@ -80,7 +80,7 @@ class LLVolumeMgr public: LLVolumeMgr(); virtual ~LLVolumeMgr(); - BOOL cleanup(); // Cleanup all volumes being managed, returns TRUE if no dangling references + bool cleanup(); // Cleanup all volumes being managed, returns true if no dangling references virtual LLVolumeLODGroup* getGroup( const LLVolumeParams& volume_params ) const; diff --git a/indra/llmath/llvolumeoctree.cpp b/indra/llmath/llvolumeoctree.cpp index 341b9a6465..71288daa89 100644 --- a/indra/llmath/llvolumeoctree.cpp +++ b/indra/llmath/llvolumeoctree.cpp @@ -27,7 +27,7 @@ #include "llvolumeoctree.h" #include "llvector4a.h" -BOOL LLLineSegmentBoxIntersect(const LLVector4a& start, const LLVector4a& end, const LLVector4a& center, const LLVector4a& size) +bool LLLineSegmentBoxIntersect(const LLVector4a& start, const LLVector4a& end, const LLVector4a& center, const LLVector4a& size) { LLVector4a fAWdU; LLVector4a dir; @@ -71,10 +71,9 @@ BOOL LLLineSegmentBoxIntersect(const LLVector4a& start, const LLVector4a& end, c grt = f.greaterThan(rhs).getGatheredBits(); - return (grt & 0x7) ? false : true; + return (grt & 0x7) == 0; } - LLVolumeOctreeListener::LLVolumeOctreeListener(LLOctreeNode<LLVolumeTriangle, LLVolumeTriangle*>* node) { node->addListener(this); @@ -114,7 +113,7 @@ void LLOctreeTriangleRayIntersect::traverse(const LLOctreeNode<LLVolumeTriangle, if (LLLineSegmentBoxIntersect(mStart, mEnd, vl->mBounds[0], vl->mBounds[1])) { node->accept(this); - for (S32 i = 0; i < node->getChildCount(); ++i) + for (U32 i = 0; i < node->getChildCount(); ++i) { traverse(node->getChild(i)); } @@ -152,7 +151,7 @@ void LLOctreeTriangleRayIntersect::visit(const LLOctreeNode<LLVolumeTriangle, LL U32 idx1 = tri->mIndex[1]; U32 idx2 = tri->mIndex[2]; - if (mTexCoord != NULL) + if (mTexCoord != NULL && mFace->mTexCoords) { LLVector2* tc = (LLVector2*) mFace->mTexCoords; *mTexCoord = ((1.f - a - b) * tc[idx0] + @@ -161,7 +160,7 @@ void LLOctreeTriangleRayIntersect::visit(const LLOctreeNode<LLVolumeTriangle, LL } - if (mNormal != NULL) + if (mNormal != NULL && mFace->mNormals) { LLVector4a* norm = mFace->mNormals; @@ -181,7 +180,7 @@ void LLOctreeTriangleRayIntersect::visit(const LLOctreeNode<LLVolumeTriangle, LL *mNormal = n1; } - if (mTangent != NULL) + if (mTangent != NULL && mFace->mTangents) { LLVector4a* tangents = mFace->mTangents; diff --git a/indra/llmath/llvolumeoctree.h b/indra/llmath/llvolumeoctree.h index cf176b5afe..05d45f7b5f 100644 --- a/indra/llmath/llvolumeoctree.h +++ b/indra/llmath/llvolumeoctree.h @@ -48,12 +48,6 @@ public: *this = rhs; } - const LLVolumeTriangle& operator=(const LLVolumeTriangle& rhs) - { - LL_ERRS() << "Illegal operation!" << LL_ENDL; - return *this; - } - ~LLVolumeTriangle() { @@ -192,7 +186,7 @@ public: llassert(!branch->isLeaf()); // Empty leaf } - for (S32 i = 0; i < branch->getChildCount(); ++i) + for (U32 i = 0; i < branch->getChildCount(); ++i) { //stretch by child extents LLVolumeOctreeListener* child = (LLVolumeOctreeListener*)branch->getChild(i)->getListener(0); min.setMin(min, child->mExtents[0]); diff --git a/indra/llmath/m3math.cpp b/indra/llmath/m3math.cpp index 2cefc44da3..472d340af5 100644 --- a/indra/llmath/m3math.cpp +++ b/indra/llmath/m3math.cpp @@ -528,10 +528,10 @@ bool operator==(const LLMatrix3 &a, const LLMatrix3 &b) for (j = 0; j < NUM_VALUES_IN_MAT3; j++) { if (a.mMatrix[j][i] != b.mMatrix[j][i]) - return FALSE; + return false; } } - return TRUE; + return true; } bool operator!=(const LLMatrix3 &a, const LLMatrix3 &b) @@ -542,10 +542,10 @@ bool operator!=(const LLMatrix3 &a, const LLMatrix3 &b) for (j = 0; j < NUM_VALUES_IN_MAT3; j++) { if (a.mMatrix[j][i] != b.mMatrix[j][i]) - return TRUE; + return true; } } - return FALSE; + return false; } const LLMatrix3& operator*=(LLMatrix3 &a, const LLMatrix3 &b) diff --git a/indra/llmath/m4math.cpp b/indra/llmath/m4math.cpp index 16ce00d963..c46ee587cb 100644 --- a/indra/llmath/m4math.cpp +++ b/indra/llmath/m4math.cpp @@ -744,10 +744,10 @@ bool operator==(const LLMatrix4 &a, const LLMatrix4 &b) for (j = 0; j < NUM_VALUES_IN_MAT4; j++) { if (a.mMatrix[j][i] != b.mMatrix[j][i]) - return FALSE; + return false; } } - return TRUE; + return true; } bool operator!=(const LLMatrix4 &a, const LLMatrix4 &b) @@ -758,10 +758,10 @@ bool operator!=(const LLMatrix4 &a, const LLMatrix4 &b) for (j = 0; j < NUM_VALUES_IN_MAT4; j++) { if (a.mMatrix[j][i] != b.mMatrix[j][i]) - return TRUE; + return true; } } - return FALSE; + return false; } bool operator<(const LLMatrix4& a, const LLMatrix4 &b) diff --git a/indra/llmath/raytrace.cpp b/indra/llmath/raytrace.cpp index de51313fa2..893bf1fc70 100644 --- a/indra/llmath/raytrace.cpp +++ b/indra/llmath/raytrace.cpp @@ -34,7 +34,7 @@ #include "raytrace.h" -BOOL line_plane(const LLVector3 &line_point, const LLVector3 &line_direction, +bool line_plane(const LLVector3 &line_point, const LLVector3 &line_direction, const LLVector3 &plane_point, const LLVector3 plane_normal, LLVector3 &intersection) { @@ -43,18 +43,18 @@ BOOL line_plane(const LLVector3 &line_point, const LLVector3 &line_direction, { // line is perpendicular to plane normal // so it is either entirely on plane, or not on plane at all - return FALSE; + return false; } // Ax + By, + Cz + D = 0 // D = - (plane_point * plane_normal) // N = line_direction * plane_normal // intersection = line_point - ((D + plane_normal * line_point) / N) * line_direction intersection = line_point - ((plane_normal * line_point - plane_point * plane_normal) / N) * line_direction; - return TRUE; + return true; } -BOOL ray_plane(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_plane(const LLVector3 &ray_point, const LLVector3 &ray_direction, const LLVector3 &plane_point, const LLVector3 plane_normal, LLVector3 &intersection) { @@ -63,7 +63,7 @@ BOOL ray_plane(const LLVector3 &ray_point, const LLVector3 &ray_direction, { // ray is perpendicular to plane normal // so it is either entirely on plane, or not on plane at all - return FALSE; + return false; } // Ax + By, + Cz + D = 0 // D = - (plane_point * plane_normal) @@ -73,14 +73,14 @@ BOOL ray_plane(const LLVector3 &ray_point, const LLVector3 &ray_direction, if (alpha < 0.0f) { // ray points away from plane - return FALSE; + return false; } intersection = ray_point + alpha * ray_direction; - return TRUE; + return true; } -BOOL ray_circle(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_circle(const LLVector3 &ray_point, const LLVector3 &ray_direction, const LLVector3 &circle_center, const LLVector3 plane_normal, F32 circle_radius, LLVector3 &intersection) { @@ -88,14 +88,14 @@ BOOL ray_circle(const LLVector3 &ray_point, const LLVector3 &ray_direction, { if (circle_radius >= (intersection - circle_center).magVec()) { - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL ray_triangle(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_triangle(const LLVector3 &ray_point, const LLVector3 &ray_direction, const LLVector3 &point_0, const LLVector3 &point_1, const LLVector3 &point_2, LLVector3 &intersection, LLVector3 &intersection_normal) { @@ -112,15 +112,15 @@ BOOL ray_triangle(const LLVector3 &ray_point, const LLVector3 &ray_direction, intersection_normal * (side_12 % (intersection - point_1)) >= 0.0f && intersection_normal * (side_20 % (intersection - point_2)) >= 0.0f) { - return TRUE; + return true; } } - return FALSE; + return false; } // assumes a parallelogram -BOOL ray_quadrangle(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_quadrangle(const LLVector3 &ray_point, const LLVector3 &ray_direction, const LLVector3 &point_0, const LLVector3 &point_1, const LLVector3 &point_2, LLVector3 &intersection, LLVector3 &intersection_normal) { @@ -140,14 +140,14 @@ BOOL ray_quadrangle(const LLVector3 &ray_point, const LLVector3 &ray_direction, intersection_normal * (side_23 % (intersection - point_2)) >= 0.0f && intersection_normal * (side_30 % (intersection - point_3)) >= 0.0f) { - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL ray_sphere(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_sphere(const LLVector3 &ray_point, const LLVector3 &ray_direction, const LLVector3 &sphere_center, F32 sphere_radius, LLVector3 &intersection, LLVector3 &intersection_normal) { @@ -160,7 +160,7 @@ BOOL ray_sphere(const LLVector3 &ray_point, const LLVector3 &ray_direction, F32 radius_squared = sphere_radius * sphere_radius; if (shortest_distance > radius_squared) { - return FALSE; + return false; } F32 half_chord = (F32) sqrt(radius_squared - shortest_distance); @@ -170,7 +170,7 @@ BOOL ray_sphere(const LLVector3 &ray_point, const LLVector3 &ray_direction, if (dot < 0.0f) { // ray shoots away from sphere and is not inside it - return FALSE; + return false; } shortest_distance = ray_direction * ((closest_approach - half_chord * ray_direction) - ray_point); @@ -195,11 +195,11 @@ BOOL ray_sphere(const LLVector3 &ray_point, const LLVector3 &ray_direction, intersection_normal.setVec(0.0f, 0.0f, 0.0f); } - return TRUE; + return true; } -BOOL ray_cylinder(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_cylinder(const LLVector3 &ray_point, const LLVector3 &ray_direction, const LLVector3 &cyl_center, const LLVector3 &cyl_scale, const LLQuaternion &cyl_rotation, LLVector3 &intersection, LLVector3 &intersection_normal) { @@ -242,7 +242,7 @@ BOOL ray_cylinder(const LLVector3 &ray_point, const LLVector3 &ray_direction, if (dot > 0.0f) { // ray points away from cylinder bottom - return FALSE; + return false; } // ray hit bottom of cylinder from outside intersection = ray_point - shortest_distance * cyl_axis; @@ -270,15 +270,15 @@ BOOL ray_cylinder(const LLVector3 &ray_point, const LLVector3 &ray_direction, if (dot < 0.0f) { // ray points away from cylinder bottom - return FALSE; + return false; } // ray hit top from outside intersection = ray_point - (shortest_distance + cyl_length) * cyl_axis; intersection_normal = -cyl_axis; } - return TRUE; + return true; } - return FALSE; + return false; } // check for intersection with infinite cylinder @@ -298,8 +298,8 @@ BOOL ray_cylinder(const LLVector3 &ray_point, const LLVector3 &ray_direction, out = dist_to_closest_point + half_chord_length; // dist to exiting point if (out < 0.0f) { - // cylinder is behind the ray, so we return FALSE - return FALSE; + // cylinder is behind the ray, so we return false + return false; } in = dist_to_closest_point - half_chord_length; // dist to entering point @@ -341,14 +341,14 @@ BOOL ray_cylinder(const LLVector3 &ray_point, const LLVector3 &ray_direction, if (shortest_distance > out) { // ray missed the finite cylinder - return FALSE; + return false; } if (shortest_distance > in) { // ray intersects cylinder at top plane intersection = temp_vector; intersection_normal = -cyl_axis; - return TRUE; + return true; } } else @@ -357,7 +357,7 @@ BOOL ray_cylinder(const LLVector3 &ray_point, const LLVector3 &ray_direction, if (shortest_distance < in) { // missed the finite cylinder - return FALSE; + return false; } } @@ -370,14 +370,14 @@ BOOL ray_cylinder(const LLVector3 &ray_point, const LLVector3 &ray_direction, if (shortest_distance > out) { // ray missed the finite cylinder - return FALSE; + return false; } if (shortest_distance > in) { // ray intersects cylinder at bottom plane intersection = temp_vector; intersection_normal = cyl_axis; - return TRUE; + return true; } } else @@ -386,7 +386,7 @@ BOOL ray_cylinder(const LLVector3 &ray_point, const LLVector3 &ray_direction, if (shortest_distance < in) { // ray missed the finite cylinder - return FALSE; + return false; } } @@ -399,14 +399,14 @@ BOOL ray_cylinder(const LLVector3 &ray_point, const LLVector3 &ray_direction, if (shortest_distance < 0.0f || shortest_distance > cyl_length) { // ray missed finite cylinder - return FALSE; + return false; } } - return TRUE; + return true; } - return FALSE; + return false; } @@ -710,7 +710,7 @@ U32 ray_box(const LLVector3 &ray_point, const LLVector3 &ray_direction, } -BOOL ray_prism(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_prism(const LLVector3 &ray_point, const LLVector3 &ray_direction, const LLVector3 &prism_center, const LLVector3 &prism_scale, const LLQuaternion &prism_rotation, LLVector3 &intersection, LLVector3 &intersection_normal) { @@ -751,7 +751,7 @@ BOOL ray_prism(const LLVector3 &ray_point, const LLVector3 &ray_direction, point5 = (point5 * prism_rotation) + prism_center; // test ray intersection for each face - BOOL b_hit = FALSE; + bool b_hit = false; LLVector3 face_intersection, face_normal; F32 distance_squared = 0.0f; F32 temp; @@ -761,14 +761,14 @@ BOOL ray_prism(const LLVector3 &ray_point, const LLVector3 &ray_direction, ray_quadrangle(ray_point, ray_direction, point5, point2, point0, intersection, intersection_normal)) { distance_squared = (ray_point - intersection).magVecSquared(); - b_hit = TRUE; + b_hit = true; } // face 1 if (ray_direction * ( (point0 - point3) % (point2 - point3)) < 0.0f && ray_triangle(ray_point, ray_direction, point2, point3, point0, face_intersection, face_normal)) { - if (TRUE == b_hit) + if (b_hit) { temp = (ray_point - face_intersection).magVecSquared(); if (temp < distance_squared) @@ -783,7 +783,7 @@ BOOL ray_prism(const LLVector3 &ray_point, const LLVector3 &ray_direction, distance_squared = (ray_point - face_intersection).magVecSquared(); intersection = face_intersection; intersection_normal = face_normal; - b_hit = TRUE; + b_hit = true; } } @@ -791,7 +791,7 @@ BOOL ray_prism(const LLVector3 &ray_point, const LLVector3 &ray_direction, if (ray_direction * ( (point1 - point4) % (point3 - point4)) < 0.0f && ray_quadrangle(ray_point, ray_direction, point3, point4, point1, face_intersection, face_normal)) { - if (TRUE == b_hit) + if (b_hit) { temp = (ray_point - face_intersection).magVecSquared(); if (temp < distance_squared) @@ -806,7 +806,7 @@ BOOL ray_prism(const LLVector3 &ray_point, const LLVector3 &ray_direction, distance_squared = (ray_point - face_intersection).magVecSquared(); intersection = face_intersection; intersection_normal = face_normal; - b_hit = TRUE; + b_hit = true; } } @@ -814,7 +814,7 @@ BOOL ray_prism(const LLVector3 &ray_point, const LLVector3 &ray_direction, if (ray_direction * ( (point5 - point4) % (point1 - point4)) < 0.0f && ray_triangle(ray_point, ray_direction, point1, point4, point5, face_intersection, face_normal)) { - if (TRUE == b_hit) + if (b_hit) { temp = (ray_point - face_intersection).magVecSquared(); if (temp < distance_squared) @@ -829,7 +829,7 @@ BOOL ray_prism(const LLVector3 &ray_point, const LLVector3 &ray_direction, distance_squared = (ray_point - face_intersection).magVecSquared(); intersection = face_intersection; intersection_normal = face_normal; - b_hit = TRUE; + b_hit = true; } } @@ -837,7 +837,7 @@ BOOL ray_prism(const LLVector3 &ray_point, const LLVector3 &ray_direction, if (ray_direction * ( (point4 - point5) % (point2 - point5)) < 0.0f && ray_quadrangle(ray_point, ray_direction, point2, point5, point4, face_intersection, face_normal)) { - if (TRUE == b_hit) + if (b_hit) { temp = (ray_point - face_intersection).magVecSquared(); if (temp < distance_squared) @@ -852,7 +852,7 @@ BOOL ray_prism(const LLVector3 &ray_point, const LLVector3 &ray_direction, distance_squared = (ray_point - face_intersection).magVecSquared(); intersection = face_intersection; intersection_normal = face_normal; - b_hit = TRUE; + b_hit = true; } } @@ -860,7 +860,7 @@ BOOL ray_prism(const LLVector3 &ray_point, const LLVector3 &ray_direction, } -BOOL ray_tetrahedron(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_tetrahedron(const LLVector3 &ray_point, const LLVector3 &ray_direction, const LLVector3 &t_center, const LLVector3 &t_scale, const LLQuaternion &t_rotation, LLVector3 &intersection, LLVector3 &intersection_normal) { @@ -890,7 +890,7 @@ BOOL ray_tetrahedron(const LLVector3 &ray_point, const LLVector3 &ray_direction, point3 = (point3 * t_rotation) + t_center; // test ray intersection for each face - BOOL b_hit = FALSE; + bool b_hit = false; LLVector3 face_intersection, face_normal; F32 distance_squared = 1.0e12f; F32 temp; @@ -900,14 +900,14 @@ BOOL ray_tetrahedron(const LLVector3 &ray_point, const LLVector3 &ray_direction, ray_triangle(ray_point, ray_direction, point1, point2, point0, intersection, intersection_normal)) { distance_squared = (ray_point - intersection).magVecSquared(); - b_hit = TRUE; + b_hit = true; } // face 1 if (ray_direction * ( (point3 - point2) % (point0 - point2)) < 0.0f && ray_triangle(ray_point, ray_direction, point2, point3, point0, face_intersection, face_normal)) { - if (TRUE == b_hit) + if (b_hit) { temp = (ray_point - face_intersection).magVecSquared(); if (temp < distance_squared) @@ -922,7 +922,7 @@ BOOL ray_tetrahedron(const LLVector3 &ray_point, const LLVector3 &ray_direction, distance_squared = (ray_point - face_intersection).magVecSquared(); intersection = face_intersection; intersection_normal = face_normal; - b_hit = TRUE; + b_hit = true; } } @@ -930,7 +930,7 @@ BOOL ray_tetrahedron(const LLVector3 &ray_point, const LLVector3 &ray_direction, if (ray_direction * ( (point1 - point3) % (point0 - point3)) < 0.0f && ray_triangle(ray_point, ray_direction, point3, point1, point0, face_intersection, face_normal)) { - if (TRUE == b_hit) + if (b_hit) { temp = (ray_point - face_intersection).magVecSquared(); if (temp < distance_squared) @@ -945,7 +945,7 @@ BOOL ray_tetrahedron(const LLVector3 &ray_point, const LLVector3 &ray_direction, distance_squared = (ray_point - face_intersection).magVecSquared(); intersection = face_intersection; intersection_normal = face_normal; - b_hit = TRUE; + b_hit = true; } } @@ -953,7 +953,7 @@ BOOL ray_tetrahedron(const LLVector3 &ray_point, const LLVector3 &ray_direction, if (ray_direction * ( (point2 - point3) % (point1 - point3)) < 0.0f && ray_triangle(ray_point, ray_direction, point3, point2, point1, face_intersection, face_normal)) { - if (TRUE == b_hit) + if (b_hit) { temp = (ray_point - face_intersection).magVecSquared(); if (temp < distance_squared) @@ -966,7 +966,7 @@ BOOL ray_tetrahedron(const LLVector3 &ray_point, const LLVector3 &ray_direction, { intersection = face_intersection; intersection_normal = face_normal; - b_hit = TRUE; + b_hit = true; } } @@ -974,7 +974,7 @@ BOOL ray_tetrahedron(const LLVector3 &ray_point, const LLVector3 &ray_direction, } -BOOL ray_pyramid(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_pyramid(const LLVector3 &ray_point, const LLVector3 &ray_direction, const LLVector3 &p_center, const LLVector3 &p_scale, const LLQuaternion &p_rotation, LLVector3 &intersection, LLVector3 &intersection_normal) { @@ -997,7 +997,7 @@ BOOL ray_pyramid(const LLVector3 &ray_point, const LLVector3 &ray_direction, point4 = (point4 * p_rotation) + p_center; // test ray intersection for each face - BOOL b_hit = FALSE; + bool b_hit = false; LLVector3 face_intersection, face_normal; F32 distance_squared = 1.0e12f; F32 temp; @@ -1007,14 +1007,14 @@ BOOL ray_pyramid(const LLVector3 &ray_point, const LLVector3 &ray_direction, ray_triangle(ray_point, ray_direction, point4, point1, point0, intersection, intersection_normal)) { distance_squared = (ray_point - intersection).magVecSquared(); - b_hit = TRUE; + b_hit = true; } // face 1 if (ray_direction * ( (point2 - point1) % (point0 - point1)) < 0.0f && ray_triangle(ray_point, ray_direction, point1, point2, point0, face_intersection, face_normal)) { - if (TRUE == b_hit) + if (b_hit) { temp = (ray_point - face_intersection).magVecSquared(); if (temp < distance_squared) @@ -1029,7 +1029,7 @@ BOOL ray_pyramid(const LLVector3 &ray_point, const LLVector3 &ray_direction, distance_squared = (ray_point - face_intersection).magVecSquared(); intersection = face_intersection; intersection_normal = face_normal; - b_hit = TRUE; + b_hit = true; } } @@ -1037,7 +1037,7 @@ BOOL ray_pyramid(const LLVector3 &ray_point, const LLVector3 &ray_direction, if (ray_direction * ( (point3 - point2) % (point0 - point2)) < 0.0f && ray_triangle(ray_point, ray_direction, point2, point3, point0, face_intersection, face_normal)) { - if (TRUE == b_hit) + if (b_hit) { temp = (ray_point - face_intersection).magVecSquared(); if (temp < distance_squared) @@ -1052,7 +1052,7 @@ BOOL ray_pyramid(const LLVector3 &ray_point, const LLVector3 &ray_direction, distance_squared = (ray_point - face_intersection).magVecSquared(); intersection = face_intersection; intersection_normal = face_normal; - b_hit = TRUE; + b_hit = true; } } @@ -1060,7 +1060,7 @@ BOOL ray_pyramid(const LLVector3 &ray_point, const LLVector3 &ray_direction, if (ray_direction * ( (point4 - point3) % (point0 - point3)) < 0.0f && ray_triangle(ray_point, ray_direction, point3, point4, point0, face_intersection, face_normal)) { - if (TRUE == b_hit) + if (b_hit) { temp = (ray_point - face_intersection).magVecSquared(); if (temp < distance_squared) @@ -1075,7 +1075,7 @@ BOOL ray_pyramid(const LLVector3 &ray_point, const LLVector3 &ray_direction, distance_squared = (ray_point - face_intersection).magVecSquared(); intersection = face_intersection; intersection_normal = face_normal; - b_hit = TRUE; + b_hit = true; } } @@ -1083,7 +1083,7 @@ BOOL ray_pyramid(const LLVector3 &ray_point, const LLVector3 &ray_direction, if (ray_direction * ( (point3 - point4) % (point2 - point4)) < 0.0f && ray_quadrangle(ray_point, ray_direction, point4, point3, point2, face_intersection, face_normal)) { - if (TRUE == b_hit) + if (b_hit) { temp = (ray_point - face_intersection).magVecSquared(); if (temp < distance_squared) @@ -1096,7 +1096,7 @@ BOOL ray_pyramid(const LLVector3 &ray_point, const LLVector3 &ray_direction, { intersection = face_intersection; intersection_normal = face_normal; - b_hit = TRUE; + b_hit = true; } } @@ -1104,7 +1104,7 @@ BOOL ray_pyramid(const LLVector3 &ray_point, const LLVector3 &ray_direction, } -BOOL linesegment_circle(const LLVector3 &point_a, const LLVector3 &point_b, +bool linesegment_circle(const LLVector3 &point_a, const LLVector3 &point_b, const LLVector3 &circle_center, const LLVector3 plane_normal, F32 circle_radius, LLVector3 &intersection) { @@ -1115,14 +1115,14 @@ BOOL linesegment_circle(const LLVector3 &point_a, const LLVector3 &point_b, { if (segment_length >= (point_a - intersection).magVec()) { - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL linesegment_triangle(const LLVector3 &point_a, const LLVector3 &point_b, +bool linesegment_triangle(const LLVector3 &point_a, const LLVector3 &point_b, const LLVector3 &point_0, const LLVector3 &point_1, const LLVector3 &point_2, LLVector3 &intersection, LLVector3 &intersection_normal) { @@ -1133,14 +1133,14 @@ BOOL linesegment_triangle(const LLVector3 &point_a, const LLVector3 &point_b, { if (segment_length >= (point_a - intersection).magVec()) { - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL linesegment_quadrangle(const LLVector3 &point_a, const LLVector3 &point_b, +bool linesegment_quadrangle(const LLVector3 &point_a, const LLVector3 &point_b, const LLVector3 &point_0, const LLVector3 &point_1, const LLVector3 &point_2, LLVector3 &intersection, LLVector3 &intersection_normal) { @@ -1151,14 +1151,14 @@ BOOL linesegment_quadrangle(const LLVector3 &point_a, const LLVector3 &point_b, { if (segment_length >= (point_a - intersection).magVec()) { - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL linesegment_sphere(const LLVector3 &point_a, const LLVector3 &point_b, +bool linesegment_sphere(const LLVector3 &point_a, const LLVector3 &point_b, const LLVector3 &sphere_center, F32 sphere_radius, LLVector3 &intersection, LLVector3 &intersection_normal) { @@ -1169,14 +1169,14 @@ BOOL linesegment_sphere(const LLVector3 &point_a, const LLVector3 &point_b, { if (segment_length >= (point_a - intersection).magVec()) { - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL linesegment_cylinder(const LLVector3 &point_a, const LLVector3 &point_b, +bool linesegment_cylinder(const LLVector3 &point_a, const LLVector3 &point_b, const LLVector3 &cyl_center, const LLVector3 &cyl_scale, const LLQuaternion &cyl_rotation, LLVector3 &intersection, LLVector3 &intersection_normal) { @@ -1187,10 +1187,10 @@ BOOL linesegment_cylinder(const LLVector3 &point_a, const LLVector3 &point_b, { if (segment_length >= (point_a - intersection).magVec()) { - return TRUE; + return true; } } - return FALSE; + return false; } @@ -1215,7 +1215,7 @@ U32 linesegment_box(const LLVector3 &point_a, const LLVector3 &point_b, } -BOOL linesegment_prism(const LLVector3 &point_a, const LLVector3 &point_b, +bool linesegment_prism(const LLVector3 &point_a, const LLVector3 &point_b, const LLVector3 &prism_center, const LLVector3 &prism_scale, const LLQuaternion &prism_rotation, LLVector3 &intersection, LLVector3 &intersection_normal) { @@ -1226,14 +1226,14 @@ BOOL linesegment_prism(const LLVector3 &point_a, const LLVector3 &point_b, { if (segment_length >= (point_a - intersection).magVec()) { - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL linesegment_tetrahedron(const LLVector3 &point_a, const LLVector3 &point_b, +bool linesegment_tetrahedron(const LLVector3 &point_a, const LLVector3 &point_b, const LLVector3 &t_center, const LLVector3 &t_scale, const LLQuaternion &t_rotation, LLVector3 &intersection, LLVector3 &intersection_normal) { @@ -1244,14 +1244,14 @@ BOOL linesegment_tetrahedron(const LLVector3 &point_a, const LLVector3 &point_b, { if (segment_length >= (point_a - intersection).magVec()) { - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL linesegment_pyramid(const LLVector3 &point_a, const LLVector3 &point_b, +bool linesegment_pyramid(const LLVector3 &point_a, const LLVector3 &point_b, const LLVector3 &p_center, const LLVector3 &p_scale, const LLQuaternion &p_rotation, LLVector3 &intersection, LLVector3 &intersection_normal) { @@ -1262,13 +1262,8 @@ BOOL linesegment_pyramid(const LLVector3 &point_a, const LLVector3 &point_b, { if (segment_length >= (point_a - intersection).magVec()) { - return TRUE; + return true; } } - return FALSE; + return false; } - - - - - diff --git a/indra/llmath/raytrace.h b/indra/llmath/raytrace.h index 01b8ee64f4..b55f29aef6 100644 --- a/indra/llmath/raytrace.h +++ b/indra/llmath/raytrace.h @@ -38,8 +38,8 @@ class LLQuaternion; // Vector arguments of the form "shape_scale" represent the scale of the // object along the three axes. // -// All functions return the expected TRUE or FALSE, unless otherwise noted. -// When FALSE is returned, any resulting values that might have been stored +// All functions return the expected true or false, unless otherwise noted. +// When false is returned, any resulting values that might have been stored // are undefined. // // Rays are defined by a "ray_point" and a "ray_direction" (unit). @@ -61,25 +61,25 @@ class LLQuaternion; // frame. -// returns TRUE iff line is not parallel to plane. -BOOL line_plane(const LLVector3 &line_point, const LLVector3 &line_direction, +// returns true if line is not parallel to plane. +bool line_plane(const LLVector3 &line_point, const LLVector3 &line_direction, const LLVector3 &plane_point, const LLVector3 plane_normal, LLVector3 &intersection); -// returns TRUE iff line is not parallel to plane. -BOOL ray_plane(const LLVector3 &ray_point, const LLVector3 &ray_direction, +// returns true if line is not parallel to plane. +bool ray_plane(const LLVector3 &ray_point, const LLVector3 &ray_direction, const LLVector3 &plane_point, const LLVector3 plane_normal, LLVector3 &intersection); -BOOL ray_circle(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_circle(const LLVector3 &ray_point, const LLVector3 &ray_direction, const LLVector3 &circle_center, const LLVector3 plane_normal, F32 circle_radius, LLVector3 &intersection); // point_0 through point_2 define the plane_normal via the right-hand rule: // circle from point_0 to point_2 with fingers ==> thumb points in direction of normal -BOOL ray_triangle(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_triangle(const LLVector3 &ray_point, const LLVector3 &ray_direction, const LLVector3 &point_0, const LLVector3 &point_1, const LLVector3 &point_2, LLVector3 &intersection, LLVector3 &intersection_normal); @@ -88,24 +88,24 @@ BOOL ray_triangle(const LLVector3 &ray_point, const LLVector3 &ray_direction, // right-hand-rule... curl fingers from lower-left toward lower-right then toward upper-right // ==> thumb points in direction of normal // assumes a parallelogram, so point_3 is determined by the other points -BOOL ray_quadrangle(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_quadrangle(const LLVector3 &ray_point, const LLVector3 &ray_direction, const LLVector3 &point_0, const LLVector3 &point_1, const LLVector3 &point_2, LLVector3 &intersection, LLVector3 &intersection_normal); -BOOL ray_sphere(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_sphere(const LLVector3 &ray_point, const LLVector3 &ray_direction, const LLVector3 &sphere_center, F32 sphere_radius, LLVector3 &intersection, LLVector3 &intersection_normal); // finite right cylinder is defined by end centers: "cyl_top", "cyl_bottom", // and by the cylinder radius "cyl_radius" -BOOL ray_cylinder(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_cylinder(const LLVector3 &ray_point, const LLVector3 &ray_direction, const LLVector3 &cyl_center, const LLVector3 &cyl_scale, const LLQuaternion &cyl_rotation, LLVector3 &intersection, LLVector3 &intersection_normal); -// this function doesn't just return a BOOL because the return is currently +// this function doesn't just return a bool because the return is currently // used to decide how to break up boxes that have been hit by shots... // a hack that will probably be changed later // @@ -117,66 +117,66 @@ U32 ray_box(const LLVector3 &ray_point, const LLVector3 &ray_direction, /* TODO -BOOL ray_ellipsoid(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_ellipsoid(const LLVector3 &ray_point, const LLVector3 &ray_direction, const LLVector3 &e_center, const LLVector3 &e_scale, const LLQuaternion &e_rotation, LLVector3 &intersection, LLVector3 &intersection_normal); -BOOL ray_cone(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_cone(const LLVector3 &ray_point, const LLVector3 &ray_direction, const LLVector3 &cone_tip, const LLVector3 &cone_bottom, const LLVector3 &cone_scale, const LLQuaternion &cone_rotation, LLVector3 &intersection, LLVector3 &intersection_normal); */ -BOOL ray_prism(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_prism(const LLVector3 &ray_point, const LLVector3 &ray_direction, const LLVector3 &prism_center, const LLVector3 &prism_scale, const LLQuaternion &prism_rotation, LLVector3 &intersection, LLVector3 &intersection_normal); -BOOL ray_tetrahedron(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_tetrahedron(const LLVector3 &ray_point, const LLVector3 &ray_direction, const LLVector3 &t_center, const LLVector3 &t_scale, const LLQuaternion &t_rotation, LLVector3 &intersection, LLVector3 &intersection_normal); -BOOL ray_pyramid(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_pyramid(const LLVector3 &ray_point, const LLVector3 &ray_direction, const LLVector3 &p_center, const LLVector3 &p_scale, const LLQuaternion &p_rotation, LLVector3 &intersection, LLVector3 &intersection_normal); /* TODO -BOOL ray_hemiellipsoid(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_hemiellipsoid(const LLVector3 &ray_point, const LLVector3 &ray_direction, const LLVector3 &e_center, const LLVector3 &e_scale, const LLQuaternion &e_rotation, const LLVector3 &e_cut_normal, LLVector3 &intersection, LLVector3 &intersection_normal); -BOOL ray_hemisphere(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_hemisphere(const LLVector3 &ray_point, const LLVector3 &ray_direction, const LLVector3 &sphere_center, F32 sphere_radius, const LLVector3 &sphere_cut_normal, LLVector3 &intersection, LLVector3 &intersection_normal); -BOOL ray_hemicylinder(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_hemicylinder(const LLVector3 &ray_point, const LLVector3 &ray_direction, const LLVector3 &cyl_top, const LLVector3 &cyl_bottom, F32 cyl_radius, const LLVector3 &cyl_cut_normal, LLVector3 &intersection, LLVector3 &intersection_normal); -BOOL ray_hemicone(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_hemicone(const LLVector3 &ray_point, const LLVector3 &ray_direction, const LLVector3 &cone_tip, const LLVector3 &cone_bottom, const LLVector3 &cone_scale, const LLVector3 &cyl_cut_normal, LLVector3 &intersection, LLVector3 &intersection_normal); */ -BOOL linesegment_circle(const LLVector3 &point_a, const LLVector3 &point_b, +bool linesegment_circle(const LLVector3 &point_a, const LLVector3 &point_b, const LLVector3 &circle_center, const LLVector3 plane_normal, F32 circle_radius, LLVector3 &intersection); // point_0 through point_2 define the plane_normal via the right-hand rule: // circle from point_0 to point_2 with fingers ==> thumb points in direction of normal -BOOL linesegment_triangle(const LLVector3 &point_a, const LLVector3 &point_b, +bool linesegment_triangle(const LLVector3 &point_a, const LLVector3 &point_b, const LLVector3 &point_0, const LLVector3 &point_1, const LLVector3 &point_2, LLVector3 &intersection, LLVector3 &intersection_normal); @@ -185,24 +185,24 @@ BOOL linesegment_triangle(const LLVector3 &point_a, const LLVector3 &point_b, // right-hand-rule... curl fingers from lower-left toward lower-right then toward upper-right // ==> thumb points in direction of normal // assumes a parallelogram, so point_3 is determined by the other points -BOOL linesegment_quadrangle(const LLVector3 &point_a, const LLVector3 &point_b, +bool linesegment_quadrangle(const LLVector3 &point_a, const LLVector3 &point_b, const LLVector3 &point_0, const LLVector3 &point_1, const LLVector3 &point_2, LLVector3 &intersection, LLVector3 &intersection_normal); -BOOL linesegment_sphere(const LLVector3 &point_a, const LLVector3 &point_b, +bool linesegment_sphere(const LLVector3 &point_a, const LLVector3 &point_b, const LLVector3 &sphere_center, F32 sphere_radius, LLVector3 &intersection, LLVector3 &intersection_normal); // finite right cylinder is defined by end centers: "cyl_top", "cyl_bottom", // and by the cylinder radius "cyl_radius" -BOOL linesegment_cylinder(const LLVector3 &point_a, const LLVector3 &point_b, +bool linesegment_cylinder(const LLVector3 &point_a, const LLVector3 &point_b, const LLVector3 &cyl_center, const LLVector3 &cyl_scale, const LLQuaternion &cyl_rotation, LLVector3 &intersection, LLVector3 &intersection_normal); -// this function doesn't just return a BOOL because the return is currently +// this function doesn't just return a bool because the return is currently // used to decide how to break up boxes that have been hit by shots... // a hack that will probably be changed later // @@ -213,20 +213,17 @@ U32 linesegment_box(const LLVector3 &point_a, const LLVector3 &point_b, LLVector3 &intersection, LLVector3 &intersection_normal); -BOOL linesegment_prism(const LLVector3 &point_a, const LLVector3 &point_b, +bool linesegment_prism(const LLVector3 &point_a, const LLVector3 &point_b, const LLVector3 &prism_center, const LLVector3 &prism_scale, const LLQuaternion &prism_rotation, LLVector3 &intersection, LLVector3 &intersection_normal); -BOOL linesegment_tetrahedron(const LLVector3 &point_a, const LLVector3 &point_b, +bool linesegment_tetrahedron(const LLVector3 &point_a, const LLVector3 &point_b, const LLVector3 &t_center, const LLVector3 &t_scale, const LLQuaternion &t_rotation, LLVector3 &intersection, LLVector3 &intersection_normal); -BOOL linesegment_pyramid(const LLVector3 &point_a, const LLVector3 &point_b, +bool linesegment_pyramid(const LLVector3 &point_a, const LLVector3 &point_b, const LLVector3 &p_center, const LLVector3 &p_scale, const LLQuaternion &p_rotation, LLVector3 &intersection, LLVector3 &intersection_normal); - - #endif - diff --git a/indra/llmath/tests/llbbox_test.cpp b/indra/llmath/tests/llbbox_test.cpp index 1f2cd96ab2..bd6bd9e4b0 100644 --- a/indra/llmath/tests/llbbox_test.cpp +++ b/indra/llmath/tests/llbbox_test.cpp @@ -340,11 +340,11 @@ namespace tut LLBBox bbox1(LLVector3(1.0f, 1.0f, 1.0f), LLQuaternion(), LLVector3(1.0f, 2.0f, 3.0f), LLVector3(3.0f, 4.0f, 5.0f)); - ensure("containsPointLocal(0,0,0)", bbox1.containsPointLocal(LLVector3(0.0f, 0.0f, 0.0f)) == FALSE); - ensure("containsPointLocal(1,2,3)", bbox1.containsPointLocal(LLVector3(1.0f, 2.0f, 3.0f)) == TRUE); - ensure("containsPointLocal(0.999,2,3)", bbox1.containsPointLocal(LLVector3(0.999f, 2.0f, 3.0f)) == FALSE); - ensure("containsPointLocal(3,4,5)", bbox1.containsPointLocal(LLVector3(3.0f, 4.0f, 5.0f)) == TRUE); - ensure("containsPointLocal(3,4,5.001)", bbox1.containsPointLocal(LLVector3(3.0f, 4.0f, 5.001f)) == FALSE); + ensure("containsPointLocal(0,0,0)", bbox1.containsPointLocal(LLVector3(0.0f, 0.0f, 0.0f)) == false); + ensure("containsPointLocal(1,2,3)", bbox1.containsPointLocal(LLVector3(1.0f, 2.0f, 3.0f)) == true); + ensure("containsPointLocal(0.999,2,3)", bbox1.containsPointLocal(LLVector3(0.999f, 2.0f, 3.0f)) == false); + ensure("containsPointLocal(3,4,5)", bbox1.containsPointLocal(LLVector3(3.0f, 4.0f, 5.0f)) == true); + ensure("containsPointLocal(3,4,5.001)", bbox1.containsPointLocal(LLVector3(3.0f, 4.0f, 5.001f)) == false); } template<> template<> @@ -357,11 +357,11 @@ namespace tut LLBBox bbox1(LLVector3(1.0f, 1.0f, 1.0f), LLQuaternion(), LLVector3(1.0f, 2.0f, 3.0f), LLVector3(3.0f, 4.0f, 5.0f)); - ensure("containsPointAgent(0,0,0)", bbox1.containsPointAgent(LLVector3(0.0f, 0.0f, 0.0f)) == FALSE); - ensure("containsPointAgent(2,3,4)", bbox1.containsPointAgent(LLVector3(2.0f, 3.0f, 4.0f)) == TRUE); - ensure("containsPointAgent(2,2.999,4)", bbox1.containsPointAgent(LLVector3(2.0f, 2.999f, 4.0f)) == FALSE); - ensure("containsPointAgent(4,5,6)", bbox1.containsPointAgent(LLVector3(4.0f, 5.0f, 6.0f)) == TRUE); - ensure("containsPointAgent(4,5.001,6)", bbox1.containsPointAgent(LLVector3(4.0f, 5.001f, 6.0f)) == FALSE); + ensure("containsPointAgent(0,0,0)", bbox1.containsPointAgent(LLVector3(0.0f, 0.0f, 0.0f)) == false); + ensure("containsPointAgent(2,3,4)", bbox1.containsPointAgent(LLVector3(2.0f, 3.0f, 4.0f)) == true); + ensure("containsPointAgent(2,2.999,4)", bbox1.containsPointAgent(LLVector3(2.0f, 2.999f, 4.0f)) == false); + ensure("containsPointAgent(4,5,6)", bbox1.containsPointAgent(LLVector3(4.0f, 5.0f, 6.0f)) == true); + ensure("containsPointAgent(4,5.001,6)", bbox1.containsPointAgent(LLVector3(4.0f, 5.001f, 6.0f)) == false); } } diff --git a/indra/llmath/tests/llrect_test.cpp b/indra/llmath/tests/llrect_test.cpp index ca042a60d7..0fd5602d4a 100644 --- a/indra/llmath/tests/llrect_test.cpp +++ b/indra/llmath/tests/llrect_test.cpp @@ -471,13 +471,13 @@ namespace tut LLRectf rect(1.0f, 3.0f, 3.0f, 1.0f); - ensure("(0,0) not in rect", rect.pointInRect(0.0f, 0.0f) == FALSE); - ensure("(2,2) in rect", rect.pointInRect(2.0f, 2.0f) == TRUE); - ensure("(1,1) in rect", rect.pointInRect(1.0f, 1.0f) == TRUE); - ensure("(3,3) not in rect", rect.pointInRect(3.0f, 3.0f) == FALSE); - ensure("(2.999,2.999) in rect", rect.pointInRect(2.999f, 2.999f) == TRUE); - ensure("(2.999,3.0) not in rect", rect.pointInRect(2.999f, 3.0f) == FALSE); - ensure("(3.0,2.999) not in rect", rect.pointInRect(3.0f, 2.999f) == FALSE); + ensure("(0,0) not in rect", rect.pointInRect(0.0f, 0.0f) == false); + ensure("(2,2) in rect", rect.pointInRect(2.0f, 2.0f) == true); + ensure("(1,1) in rect", rect.pointInRect(1.0f, 1.0f) == true); + ensure("(3,3) not in rect", rect.pointInRect(3.0f, 3.0f) == false); + ensure("(2.999,2.999) in rect", rect.pointInRect(2.999f, 2.999f) == true); + ensure("(2.999,3.0) not in rect", rect.pointInRect(2.999f, 3.0f) == false); + ensure("(3.0,2.999) not in rect", rect.pointInRect(3.0f, 2.999f) == false); } template<> template<> @@ -489,13 +489,13 @@ namespace tut LLRectf rect(1.0f, 3.0f, 3.0f, 1.0f); - ensure("(0,0) in local rect", rect.localPointInRect(0.0f, 0.0f) == TRUE); - ensure("(-0.0001,-0.0001) not in local rect", rect.localPointInRect(-0.0001f, -0.001f) == FALSE); - ensure("(1,1) in local rect", rect.localPointInRect(1.0f, 1.0f) == TRUE); - ensure("(2,2) not in local rect", rect.localPointInRect(2.0f, 2.0f) == FALSE); - ensure("(1.999,1.999) in local rect", rect.localPointInRect(1.999f, 1.999f) == TRUE); - ensure("(1.999,2.0) not in local rect", rect.localPointInRect(1.999f, 2.0f) == FALSE); - ensure("(2.0,1.999) not in local rect", rect.localPointInRect(2.0f, 1.999f) == FALSE); + ensure("(0,0) in local rect", rect.localPointInRect(0.0f, 0.0f) == true); + ensure("(-0.0001,-0.0001) not in local rect", rect.localPointInRect(-0.0001f, -0.001f) == false); + ensure("(1,1) in local rect", rect.localPointInRect(1.0f, 1.0f) == true); + ensure("(2,2) not in local rect", rect.localPointInRect(2.0f, 2.0f) == false); + ensure("(1.999,1.999) in local rect", rect.localPointInRect(1.999f, 1.999f) == true); + ensure("(1.999,2.0) not in local rect", rect.localPointInRect(1.999f, 2.0f) == false); + ensure("(2.0,1.999) not in local rect", rect.localPointInRect(2.0f, 1.999f) == false); } template<> template<> diff --git a/indra/llmath/tests/mathmisc_test.cpp b/indra/llmath/tests/mathmisc_test.cpp index 163cf02350..ff0899e975 100644 --- a/indra/llmath/tests/mathmisc_test.cpp +++ b/indra/llmath/tests/mathmisc_test.cpp @@ -454,7 +454,7 @@ namespace tut template<> template<> void line_object::test<1>() { - // this is a test for LLLine::intersects(point) which returns TRUE + // this is a test for LLLine::intersects(point) which returns true // if the line passes within some tolerance of point // these tests will have some floating point error, diff --git a/indra/llmath/tests/v2math_test.cpp b/indra/llmath/tests/v2math_test.cpp index f66142c6a7..860e3ef672 100644 --- a/indra/llmath/tests/v2math_test.cpp +++ b/indra/llmath/tests/v2math_test.cpp @@ -93,15 +93,15 @@ namespace tut { F32 x =-2.0f, y = -3.0f ; LLVector2 vec2(x,y); - ensure_equals("abs():Fail", vec2.abs(), TRUE); + ensure_equals("abs():Fail", vec2.abs(), true); ensure("abs() x", is_approx_equal(vec2.mV[VX], 2.f)); ensure("abs() y", is_approx_equal(vec2.mV[VY], 3.f)); - ensure("isNull():Fail ", FALSE == vec2.isNull()); //Returns TRUE if vector has a _very_small_ length + ensure("isNull():Fail ", false == vec2.isNull()); //Returns true if vector has a _very_small_ length x =.00000001f, y = .000001001f; vec2.setVec(x, y); - ensure("isNull(): Fail ", TRUE == vec2.isNull()); + ensure("isNull(): Fail ", true == vec2.isNull()); } template<> template<> @@ -111,12 +111,12 @@ namespace tut LLVector2 vec2(x, y), vec3; vec3 = vec3.scaleVec(vec2); ensure("scaleVec: Fail ", vec3.mV[VX] == 0. && vec3.mV[VY] == 0.); - ensure("isExactlyZero(): Fail", TRUE == vec3.isExactlyZero()); + ensure("isExactlyZero(): Fail", true == vec3.isExactlyZero()); vec3.setVec(2.f, 1.f); vec3 = vec3.scaleVec(vec2); ensure("scaleVec: Fail ", (2.f == vec3.mV[VX]) && (2.f == vec3.mV[VY])); - ensure("isExactlyZero():Fail", FALSE == vec3.isExactlyZero()); + ensure("isExactlyZero():Fail", false == vec3.isExactlyZero()); } template<> template<> @@ -254,7 +254,7 @@ namespace tut vec3.clearVec(); vec2.setVec(x1, y1); vec3.setVec(vec2); - ensure("2:operator!= failed", (FALSE == (vec2 != vec3))); + ensure("2:operator!= failed", (false == (vec2 != vec3))); } template<> template<> void v2math_object::test<13>() @@ -373,7 +373,7 @@ namespace tut x1 = 1.0f, y1 = 2.0f, x2 = 1.0f, y2 = 3.2234f; vec2.setVec(x1, y1); vec3.setVec(x2, y2); - ensure("2:operator < failed", (FALSE == (vec3 < vec2))); + ensure("2:operator < failed", (false == (vec3 < vec2))); } template<> template<> diff --git a/indra/llmath/tests/v3color_test.cpp b/indra/llmath/tests/v3color_test.cpp index d1baa53a9b..8897d48365 100644 --- a/indra/llmath/tests/v3color_test.cpp +++ b/indra/llmath/tests/v3color_test.cpp @@ -209,7 +209,7 @@ namespace tut ensure("1:operator!= failed",(llcolor3 != llcolor3a)); llcolor3.setToBlack(); llcolor3a.setVec(llcolor3); - ensure("2:operator!= failed", ( FALSE == (llcolor3a != llcolor3))); + ensure("2:operator!= failed", ( false == (llcolor3a != llcolor3))); } template<> template<> diff --git a/indra/llmath/tests/v3dmath_test.cpp b/indra/llmath/tests/v3dmath_test.cpp index 6b58cbd007..db08419012 100644 --- a/indra/llmath/tests/v3dmath_test.cpp +++ b/indra/llmath/tests/v3dmath_test.cpp @@ -128,15 +128,15 @@ namespace tut LLVector3d vec3D(x,y,z); vec3D.abs(); ensure("1:abs:Fail ", ((-x == vec3D.mdV[VX]) && (y == vec3D.mdV[VY]) && (-z == vec3D.mdV[VZ]))); - ensure("2:isNull():Fail ", (FALSE == vec3D.isNull())); + ensure("2:isNull():Fail ", (false == vec3D.isNull())); vec3D.clearVec(); x =.00000001, y = .000001001, z = .000001001; vec3D.setVec(x,y,z); - ensure("3:isNull():Fail ", (TRUE == vec3D.isNull())); - ensure("4:isExactlyZero():Fail ", (FALSE == vec3D.isExactlyZero())); + ensure("3:isNull():Fail ", (true == vec3D.isNull())); + ensure("4:isExactlyZero():Fail ", (false == vec3D.isExactlyZero())); x =.0000000, y = .00000000, z = .00000000; vec3D.setVec(x,y,z); - ensure("5:isExactlyZero():Fail ", (TRUE == vec3D.isExactlyZero())); + ensure("5:isExactlyZero():Fail ", (true == vec3D.isExactlyZero())); } template<> template<> @@ -353,7 +353,7 @@ namespace tut { F64 x1 = 1., y1 = 2., z1 = -1.1; LLVector3d vec3D(x1,y1,z1), vec3Da; - ensure("1:operator!= failed",(TRUE == (vec3D !=vec3Da))); + ensure("1:operator!= failed",(true == (vec3D !=vec3Da))); vec3Da = vec3D; ensure("2:operator== failed",(vec3D ==vec3Da)); vec3D.clearVec(); @@ -362,7 +362,7 @@ namespace tut vec3D.setVec(x1,y1,z1); vec3Da.setVec(x1,y1,z1); ensure("3:operator== failed",(vec3D ==vec3Da)); - ensure("4:operator!= failed",(FALSE == (vec3D !=vec3Da))); + ensure("4:operator!= failed",(false == (vec3D !=vec3Da))); } template<> template<> @@ -482,10 +482,10 @@ namespace tut F64 x = 2.32, y = 1.212, z = -.12; F64 min = 0.0001, max = 3.0; LLVector3d vec3d(x,y,z); - ensure("1:clamp:Fail ", (TRUE == (vec3d.clamp(min, max)))); + ensure("1:clamp:Fail ", (true == (vec3d.clamp(min, max)))); x = 0.000001f, z = 5.3f; vec3d.setVec(x,y,z); - ensure("2:clamp:Fail ", (TRUE == (vec3d.clamp(min, max)))); + ensure("2:clamp:Fail ", (true == (vec3d.clamp(min, max)))); } template<> template<> @@ -494,11 +494,11 @@ namespace tut F64 x = 10., y = 20., z = -15.; F64 epsilon = .23425; LLVector3d vec3Da(x,y,z), vec3Db(x,y,z); - ensure("1:are_parallel: Fail ", (TRUE == are_parallel(vec3Da,vec3Db,epsilon))); + ensure("1:are_parallel: Fail ", (true == are_parallel(vec3Da,vec3Db,epsilon))); F64 x1 = -12., y1 = -20., z1 = -100.; vec3Db.clearVec(); vec3Db.setVec(x1,y1,z1); - ensure("2:are_parallel: Fail ", (FALSE == are_parallel(vec3Da,vec3Db,epsilon))); + ensure("2:are_parallel: Fail ", (false == are_parallel(vec3Da,vec3Db,epsilon))); } template<> template<> diff --git a/indra/llmath/tests/v3math_test.cpp b/indra/llmath/tests/v3math_test.cpp index 7f93aba354..6d95a9e5b7 100644 --- a/indra/llmath/tests/v3math_test.cpp +++ b/indra/llmath/tests/v3math_test.cpp @@ -99,7 +99,7 @@ namespace tut { F32 x = 2.32f, y = 1.212f, z = -.12f; LLVector3 vec3(x,y,z); - ensure("1:isFinite= Fail to initialize ", (TRUE == vec3.isFinite()));//need more test cases: + ensure("1:isFinite= Fail to initialize ", (true == vec3.isFinite()));//need more test cases: vec3.clearVec(); ensure("2:clearVec:Fail to set values ", ((0.f == vec3.mV[VX]) && (0.f == vec3.mV[VY]) && (0.f == vec3.mV[VZ]))); vec3.setVec(x,y,z); @@ -137,10 +137,10 @@ namespace tut F32 x = 2.32f, y = 3.212f, z = -.12f; F32 min = 0.0001f, max = 3.0f; LLVector3 vec3(x,y,z); - ensure("1:clamp:Fail ", TRUE == vec3.clamp(min, max) && x == vec3.mV[VX] && max == vec3.mV[VY] && min == vec3.mV[VZ]); + ensure("1:clamp:Fail ", true == vec3.clamp(min, max) && x == vec3.mV[VX] && max == vec3.mV[VY] && min == vec3.mV[VZ]); x = 1.f, y = 2.2f, z = 2.8f; vec3.setVec(x,y,z); - ensure("2:clamp:Fail ", FALSE == vec3.clamp(min, max)); + ensure("2:clamp:Fail ", false == vec3.clamp(min, max)); } template<> template<> @@ -157,11 +157,11 @@ namespace tut { F32 x =-2.0f, y = -3.0f, z = 1.23f ; LLVector3 vec3(x,y,z); - ensure("1:abs():Fail ", (TRUE == vec3.abs())); - ensure("2:isNull():Fail", (FALSE == vec3.isNull())); //Returns TRUE if vector has a _very_small_ length + ensure("1:abs():Fail ", (true == vec3.abs())); + ensure("2:isNull():Fail", (false == vec3.isNull())); //Returns true if vector has a _very_small_ length x =.00000001f, y = .000001001f, z = .000001001f; vec3.setVec(x,y,z); - ensure("3:isNull(): Fail ", (TRUE == vec3.isNull())); + ensure("3:isNull(): Fail ", (true == vec3.isNull())); } template<> template<> @@ -169,13 +169,13 @@ namespace tut { F32 x =-2.0f, y = -3.0f, z = 1.f ; LLVector3 vec3(x,y,z),vec3a; - ensure("1:isExactlyZero():Fail ", (TRUE == vec3a.isExactlyZero())); + ensure("1:isExactlyZero():Fail ", (true == vec3a.isExactlyZero())); vec3a = vec3a.scaleVec(vec3); ensure("2:scaleVec: Fail ", vec3a.mV[VX] == 0.f && vec3a.mV[VY] == 0.f && vec3a.mV[VZ] == 0.f); vec3a.setVec(x,y,z); vec3a = vec3a.scaleVec(vec3); ensure("3:scaleVec: Fail ", ((4 == vec3a.mV[VX]) && (9 == vec3a.mV[VY]) &&(1 == vec3a.mV[VZ]))); - ensure("4:isExactlyZero():Fail ", (FALSE == vec3.isExactlyZero())); + ensure("4:isExactlyZero():Fail ", (false == vec3.isExactlyZero())); } template<> template<> @@ -356,7 +356,7 @@ namespace tut vec3.clearVec(); vec3.clearVec(); vec3a.setVec(vec3); - ensure("2:operator!= failed", ( FALSE == (vec3a != vec3))); + ensure("2:operator!= failed", ( false == (vec3a != vec3))); } template<> template<> @@ -454,15 +454,15 @@ namespace tut { F32 x1 =-2.3f, y1 = 2.f,z1 = 1.2f, x2 = 1.3f, y2 = 1.11f, z2 = 1234.234f; LLVector3 vec3(x1,y1,z1), vec3a(x2,y2,z2); - ensure("1:operator< failed", (TRUE == (vec3 < vec3a))); + ensure("1:operator< failed", (true == (vec3 < vec3a))); x1 =-2.3f, y1 = 2.f,z1 = 1.2f, x2 = 1.3f, y2 = 2.f, z2 = 1234.234f; vec3.setVec(x1,y1,z1); vec3a.setVec(x2,y2,z2); - ensure("2:operator< failed ", (TRUE == (vec3 < vec3a))); + ensure("2:operator< failed ", (true == (vec3 < vec3a))); x1 =2.3f, y1 = 2.f,z1 = 1.2f, x2 = 1.3f, vec3.setVec(x1,y1,z1); vec3a.setVec(x2,y2,z2); - ensure("3:operator< failed ", (FALSE == (vec3 < vec3a))); + ensure("3:operator< failed ", (false == (vec3 < vec3a))); } template<> template<> diff --git a/indra/llmath/tests/v4color_test.cpp b/indra/llmath/tests/v4color_test.cpp index 3b3adbda0d..e5d914a065 100644 --- a/indra/llmath/tests/v4color_test.cpp +++ b/indra/llmath/tests/v4color_test.cpp @@ -49,23 +49,23 @@ namespace tut void v4color_object::test<1>() { LLColor4 llcolor4; - ensure("1:LLColor4:Fail to initialize ", ((0 == llcolor4.mV[VX]) && (0 == llcolor4.mV[VY]) && (0 == llcolor4.mV[VZ])&& (1.0f == llcolor4.mV[VW]))); + ensure("1:LLColor4:Fail to initialize ", ((0 == llcolor4.mV[VRED]) && (0 == llcolor4.mV[VGREEN]) && (0 == llcolor4.mV[VBLUE])&& (1.0f == llcolor4.mV[VALPHA]))); F32 r = 0x20, g = 0xFFFF, b = 0xFF, a = 0xAF; LLColor4 llcolor4a(r,g,b); - ensure("2:LLColor4:Fail to initialize ", ((r == llcolor4a.mV[VX]) && (g == llcolor4a.mV[VY]) && (b == llcolor4a.mV[VZ])&& (1.0f == llcolor4a.mV[VW]))); + ensure("2:LLColor4:Fail to initialize ", ((r == llcolor4a.mV[VRED]) && (g == llcolor4a.mV[VGREEN]) && (b == llcolor4a.mV[VBLUE])&& (1.0f == llcolor4a.mV[VALPHA]))); LLColor4 llcolor4b(r,g,b,a); - ensure("3:LLColor4:Fail to initialize ", ((r == llcolor4b.mV[VX]) && (g == llcolor4b.mV[VY]) && (b == llcolor4b.mV[VZ])&& (a == llcolor4b.mV[VW]))); + ensure("3:LLColor4:Fail to initialize ", ((r == llcolor4b.mV[VRED]) && (g == llcolor4b.mV[VGREEN]) && (b == llcolor4b.mV[VBLUE])&& (a == llcolor4b.mV[VALPHA]))); const F32 vec[4] = {.112f ,23.2f, -4.2f, -.0001f}; LLColor4 llcolor4c(vec); - ensure("4:LLColor4:Fail to initialize ", ((vec[0] == llcolor4c.mV[VX]) && (vec[1] == llcolor4c.mV[VY]) && (vec[2] == llcolor4c.mV[VZ])&& (vec[3] == llcolor4c.mV[VW]))); + ensure("4:LLColor4:Fail to initialize ", ((vec[0] == llcolor4c.mV[VRED]) && (vec[1] == llcolor4c.mV[VGREEN]) && (vec[2] == llcolor4c.mV[VBLUE])&& (vec[3] == llcolor4c.mV[VALPHA]))); LLColor3 llcolor3(-2.23f,1.01f,42.3f); F32 val = -.1f; LLColor4 llcolor4d(llcolor3,val); - ensure("5:LLColor4:Fail to initialize ", ((llcolor3.mV[VX] == llcolor4d.mV[VX]) && (llcolor3.mV[VY] == llcolor4d.mV[VY]) && (llcolor3.mV[VZ] == llcolor4d.mV[VZ])&& (val == llcolor4d.mV[VW]))); + ensure("5:LLColor4:Fail to initialize ", ((llcolor3.mV[VRED] == llcolor4d.mV[VRED]) && (llcolor3.mV[VGREEN] == llcolor4d.mV[VGREEN]) && (llcolor3.mV[VBLUE] == llcolor4d.mV[VBLUE])&& (val == llcolor4d.mV[VALPHA]))); LLSD sd = llcolor4d.getValue(); LLColor4 llcolor4e(sd); @@ -76,7 +76,7 @@ namespace tut LLColor4 llcolor4g(color4u); const F32 SCALE = 1.f/255.f; F32 r2 = r1*SCALE, g2 = g1* SCALE, b2 = b1* SCALE; - ensure("7:LLColor4:Fail to initialize ", ((r2 == llcolor4g.mV[VX]) && (g2 == llcolor4g.mV[VY]) && (b2 == llcolor4g.mV[VZ]))); + ensure("7:LLColor4:Fail to initialize ", ((r2 == llcolor4g.mV[VRED]) && (g2 == llcolor4g.mV[VGREEN]) && (b2 == llcolor4g.mV[VBLUE]))); } template<> template<> @@ -98,10 +98,10 @@ namespace tut F32 r = 0x20, g = 0xFFFF, b = 0xFF,a = 0xAF; LLColor4 llcolor4(r,g,b,a); llcolor4.setToBlack(); - ensure("setToBlack:Fail to set the black ", ((0 == llcolor4.mV[VX]) && (0 == llcolor4.mV[VY]) && (0 == llcolor4.mV[VZ])&& (1.0f == llcolor4.mV[VW]))); + ensure("setToBlack:Fail to set the black ", ((0 == llcolor4.mV[VRED]) && (0 == llcolor4.mV[VGREEN]) && (0 == llcolor4.mV[VBLUE])&& (1.0f == llcolor4.mV[VALPHA]))); llcolor4.setToWhite(); - ensure("setToWhite:Fail to set the white ", ((1.f == llcolor4.mV[VX]) && (1.f == llcolor4.mV[VY]) && (1.f == llcolor4.mV[VZ])&& (1.0f == llcolor4.mV[VW]))); + ensure("setToWhite:Fail to set the white ", ((1.f == llcolor4.mV[VRED]) && (1.f == llcolor4.mV[VGREEN]) && (1.f == llcolor4.mV[VBLUE])&& (1.0f == llcolor4.mV[VALPHA]))); } template<> template<> @@ -110,10 +110,10 @@ namespace tut F32 r = 0x20, g = 0xFFFF, b = 0xFF, a = 0xAF; LLColor4 llcolor4; llcolor4.setVec(r,g,b); - ensure("1:setVec:Fail to set the values ", ((r == llcolor4.mV[VX]) && (g == llcolor4.mV[VY]) && (b == llcolor4.mV[VZ])&& (1.f == llcolor4.mV[VW]))); + ensure("1:setVec:Fail to set the values ", ((r == llcolor4.mV[VRED]) && (g == llcolor4.mV[VGREEN]) && (b == llcolor4.mV[VBLUE])&& (1.f == llcolor4.mV[VALPHA]))); llcolor4.setVec(r,g,b,a); - ensure("2:setVec:Fail to set the values ", ((r == llcolor4.mV[VX]) && (g == llcolor4.mV[VY]) && (b == llcolor4.mV[VZ])&& (a == llcolor4.mV[VW]))); + ensure("2:setVec:Fail to set the values ", ((r == llcolor4.mV[VRED]) && (g == llcolor4.mV[VGREEN]) && (b == llcolor4.mV[VBLUE])&& (a == llcolor4.mV[VALPHA]))); LLColor4 llcolor4a; llcolor4a.setVec(llcolor4); @@ -121,23 +121,23 @@ namespace tut LLColor3 llcolor3(-2.23f,1.01f,42.3f); llcolor4a.setVec(llcolor3); - ensure("4:setVec:Fail to set the values ", ((llcolor3.mV[VX] == llcolor4a.mV[VX]) && (llcolor3.mV[VY] == llcolor4a.mV[VY]) && (llcolor3.mV[VZ] == llcolor4a.mV[VZ]))); + ensure("4:setVec:Fail to set the values ", ((llcolor3.mV[VRED] == llcolor4a.mV[VRED]) && (llcolor3.mV[VGREEN] == llcolor4a.mV[VGREEN]) && (llcolor3.mV[VBLUE] == llcolor4a.mV[VBLUE]))); F32 val = -.33f; llcolor4a.setVec(llcolor3,val); - ensure("4:setVec:Fail to set the values ", ((llcolor3.mV[VX] == llcolor4a.mV[VX]) && (llcolor3.mV[VY] == llcolor4a.mV[VY]) && (llcolor3.mV[VZ] == llcolor4a.mV[VZ]) && (val == llcolor4a.mV[VW]))); + ensure("4:setVec:Fail to set the values ", ((llcolor3.mV[VRED] == llcolor4a.mV[VRED]) && (llcolor3.mV[VGREEN] == llcolor4a.mV[VGREEN]) && (llcolor3.mV[VBLUE] == llcolor4a.mV[VBLUE]) && (val == llcolor4a.mV[VALPHA]))); const F32 vec[4] = {.112f ,23.2f, -4.2f, -.0001f}; LLColor4 llcolor4c; llcolor4c.setVec(vec); - ensure("5:setVec:Fail to initialize ", ((vec[0] == llcolor4c.mV[VX]) && (vec[1] == llcolor4c.mV[VY]) && (vec[2] == llcolor4c.mV[VZ])&& (vec[3] == llcolor4c.mV[VW]))); + ensure("5:setVec:Fail to initialize ", ((vec[0] == llcolor4c.mV[VRED]) && (vec[1] == llcolor4c.mV[VGREEN]) && (vec[2] == llcolor4c.mV[VBLUE])&& (vec[3] == llcolor4c.mV[VALPHA]))); U8 r1 = 0xF2, g1 = 0xFA, b1= 0xBF; LLColor4U color4u(r1,g1,b1); llcolor4.setVec(color4u); const F32 SCALE = 1.f/255.f; F32 r2 = r1*SCALE, g2 = g1* SCALE, b2 = b1* SCALE; - ensure("6:setVec:Fail to initialize ", ((r2 == llcolor4.mV[VX]) && (g2 == llcolor4.mV[VY]) && (b2 == llcolor4.mV[VZ]))); + ensure("6:setVec:Fail to initialize ", ((r2 == llcolor4.mV[VRED]) && (g2 == llcolor4.mV[VGREEN]) && (b2 == llcolor4.mV[VBLUE]))); } template<> template<> @@ -146,7 +146,7 @@ namespace tut F32 alpha = 0xAF; LLColor4 llcolor4; llcolor4.setAlpha(alpha); - ensure("setAlpha:Fail to initialize ", (alpha == llcolor4.mV[VW])); + ensure("setAlpha:Fail to initialize ", (alpha == llcolor4.mV[VALPHA])); } template<> template<> @@ -209,7 +209,7 @@ namespace tut LLColor3 llcolor3(r,g,b); LLColor4 llcolor4a,llcolor4b; llcolor4a = llcolor3; - ensure("Operator=:Fail to initialize ", ((llcolor3.mV[0] == llcolor4a.mV[VX]) && (llcolor3.mV[1] == llcolor4a.mV[VY]) && (llcolor3.mV[2] == llcolor4a.mV[VZ]))); + ensure("Operator=:Fail to initialize ", ((llcolor3.mV[0] == llcolor4a.mV[VRED]) && (llcolor3.mV[1] == llcolor4a.mV[VGREEN]) && (llcolor3.mV[2] == llcolor4a.mV[VBLUE]))); LLSD sd = llcolor4a.getValue(); llcolor4b = LLColor4(sd); ensure_equals("Operator= LLSD:Fail ", llcolor4a, llcolor4b); @@ -234,10 +234,10 @@ namespace tut F32 r2 = 0xABF, g2 = 0xFB, b2 = 0xFFF; LLColor4 llcolor4a(r1,g1,b1),llcolor4b(r2,g2,b2),llcolor4c; llcolor4c = llcolor4b + llcolor4a; - ensure("operator+:Fail to Add the values ", (is_approx_equal(r1+r2,llcolor4c.mV[VX]) && is_approx_equal(g1+g2,llcolor4c.mV[VY]) && is_approx_equal(b1+b2,llcolor4c.mV[VZ]))); + ensure("operator+:Fail to Add the values ", (is_approx_equal(r1+r2,llcolor4c.mV[VRED]) && is_approx_equal(g1+g2,llcolor4c.mV[VGREEN]) && is_approx_equal(b1+b2,llcolor4c.mV[VBLUE]))); llcolor4b += llcolor4a; - ensure("operator+=:Fail to Add the values ", (is_approx_equal(r1+r2,llcolor4b.mV[VX]) && is_approx_equal(g1+g2,llcolor4b.mV[VY]) && is_approx_equal(b1+b2,llcolor4b.mV[VZ]))); + ensure("operator+=:Fail to Add the values ", (is_approx_equal(r1+r2,llcolor4b.mV[VRED]) && is_approx_equal(g1+g2,llcolor4b.mV[VGREEN]) && is_approx_equal(b1+b2,llcolor4b.mV[VBLUE]))); } template<> template<> @@ -247,10 +247,10 @@ namespace tut F32 r2 = 0xABF, g2 = 0xFB, b2 = 0xFFF; LLColor4 llcolor4a(r1,g1,b1),llcolor4b(r2,g2,b2),llcolor4c; llcolor4c = llcolor4a - llcolor4b; - ensure("operator-:Fail to subtract the values ", (is_approx_equal(r1-r2,llcolor4c.mV[VX]) && is_approx_equal(g1-g2,llcolor4c.mV[VY]) && is_approx_equal(b1-b2,llcolor4c.mV[VZ]))); + ensure("operator-:Fail to subtract the values ", (is_approx_equal(r1-r2,llcolor4c.mV[VRED]) && is_approx_equal(g1-g2,llcolor4c.mV[VGREEN]) && is_approx_equal(b1-b2,llcolor4c.mV[VBLUE]))); llcolor4a -= llcolor4b; - ensure("operator-=:Fail to subtract the values ", (is_approx_equal(r1-r2,llcolor4a.mV[VX]) && is_approx_equal(g1-g2,llcolor4a.mV[VY]) && is_approx_equal(b1-b2,llcolor4a.mV[VZ]))); + ensure("operator-=:Fail to subtract the values ", (is_approx_equal(r1-r2,llcolor4a.mV[VRED]) && is_approx_equal(g1-g2,llcolor4a.mV[VGREEN]) && is_approx_equal(b1-b2,llcolor4a.mV[VBLUE]))); } template<> template<> @@ -260,20 +260,20 @@ namespace tut F32 r2 = 0xABF, g2 = 0xFB, b2 = 0xFFF; LLColor4 llcolor4a(r1,g1,b1),llcolor4b(r2,g2,b2),llcolor4c; llcolor4c = llcolor4a * llcolor4b; - ensure("1:operator*:Fail to multiply the values", (is_approx_equal(r1*r2,llcolor4c.mV[VX]) && is_approx_equal(g1*g2,llcolor4c.mV[VY]) && is_approx_equal(b1*b2,llcolor4c.mV[VZ]))); + ensure("1:operator*:Fail to multiply the values", (is_approx_equal(r1*r2,llcolor4c.mV[VRED]) && is_approx_equal(g1*g2,llcolor4c.mV[VGREEN]) && is_approx_equal(b1*b2,llcolor4c.mV[VBLUE]))); F32 mulVal = 3.33f; llcolor4c = llcolor4a * mulVal; - ensure("2:operator*:Fail ", (is_approx_equal(r1*mulVal,llcolor4c.mV[VX]) && is_approx_equal(g1*mulVal,llcolor4c.mV[VY]) && is_approx_equal(b1*mulVal,llcolor4c.mV[VZ]))); + ensure("2:operator*:Fail ", (is_approx_equal(r1*mulVal,llcolor4c.mV[VRED]) && is_approx_equal(g1*mulVal,llcolor4c.mV[VGREEN]) && is_approx_equal(b1*mulVal,llcolor4c.mV[VBLUE]))); llcolor4c = mulVal * llcolor4a; - ensure("3:operator*:Fail to multiply the values", (is_approx_equal(r1*mulVal,llcolor4c.mV[VX]) && is_approx_equal(g1*mulVal,llcolor4c.mV[VY]) && is_approx_equal(b1*mulVal,llcolor4c.mV[VZ]))); + ensure("3:operator*:Fail to multiply the values", (is_approx_equal(r1*mulVal,llcolor4c.mV[VRED]) && is_approx_equal(g1*mulVal,llcolor4c.mV[VGREEN]) && is_approx_equal(b1*mulVal,llcolor4c.mV[VBLUE]))); llcolor4a *= mulVal; - ensure("4:operator*=:Fail to multiply the values ", (is_approx_equal(r1*mulVal,llcolor4a.mV[VX]) && is_approx_equal(g1*mulVal,llcolor4a.mV[VY]) && is_approx_equal(b1*mulVal,llcolor4a.mV[VZ]))); + ensure("4:operator*=:Fail to multiply the values ", (is_approx_equal(r1*mulVal,llcolor4a.mV[VRED]) && is_approx_equal(g1*mulVal,llcolor4a.mV[VGREEN]) && is_approx_equal(b1*mulVal,llcolor4a.mV[VBLUE]))); LLColor4 llcolor4d(r1,g1,b1),llcolor4e(r2,g2,b2); llcolor4e *= llcolor4d; - ensure("5:operator*=:Fail to multiply the values ", (is_approx_equal(r1*r2,llcolor4e.mV[VX]) && is_approx_equal(g1*g2,llcolor4e.mV[VY]) && is_approx_equal(b1*b2,llcolor4e.mV[VZ]))); + ensure("5:operator*=:Fail to multiply the values ", (is_approx_equal(r1*r2,llcolor4e.mV[VRED]) && is_approx_equal(g1*g2,llcolor4e.mV[VGREEN]) && is_approx_equal(b1*b2,llcolor4e.mV[VBLUE]))); } template<> template<> @@ -283,13 +283,13 @@ namespace tut F32 div = 12.345f; LLColor4 llcolor4a(r,g,b,a),llcolor4b; llcolor4b = llcolor4a % div;//chnage only alpha value nor r,g,b; - ensure("1operator%:Fail ", (is_approx_equal(r,llcolor4b.mV[VX]) && is_approx_equal(g,llcolor4b.mV[VY]) && is_approx_equal(b,llcolor4b.mV[VZ])&& is_approx_equal(div*a,llcolor4b.mV[VW]))); + ensure("1operator%:Fail ", (is_approx_equal(r,llcolor4b.mV[VRED]) && is_approx_equal(g,llcolor4b.mV[VGREEN]) && is_approx_equal(b,llcolor4b.mV[VBLUE])&& is_approx_equal(div*a,llcolor4b.mV[VALPHA]))); llcolor4b = div % llcolor4a; - ensure("2operator%:Fail ", (is_approx_equal(r,llcolor4b.mV[VX]) && is_approx_equal(g,llcolor4b.mV[VY]) && is_approx_equal(b,llcolor4b.mV[VZ])&& is_approx_equal(div*a,llcolor4b.mV[VW]))); + ensure("2operator%:Fail ", (is_approx_equal(r,llcolor4b.mV[VRED]) && is_approx_equal(g,llcolor4b.mV[VGREEN]) && is_approx_equal(b,llcolor4b.mV[VBLUE])&& is_approx_equal(div*a,llcolor4b.mV[VALPHA]))); llcolor4a %= div; - ensure("operator%=:Fail ", (is_approx_equal(a*div,llcolor4a.mV[VW]))); + ensure("operator%=:Fail ", (is_approx_equal(a*div,llcolor4a.mV[VALPHA]))); } template<> template<> @@ -312,7 +312,7 @@ namespace tut F32 r = 0x20, g = 0xFFFF, b = 0xFF; LLColor4 llcolor4a(r,g,b),llcolor4b; LLColor3 llcolor3 = vec4to3(llcolor4a); - ensure("vec4to3:Fail to convert vec4 to vec3 ", (is_approx_equal(llcolor3.mV[VX],llcolor4a.mV[VX]) && is_approx_equal(llcolor3.mV[VY],llcolor4a.mV[VY]) && is_approx_equal(llcolor3.mV[VZ],llcolor4a.mV[VZ]))); + ensure("vec4to3:Fail to convert vec4 to vec3 ", (is_approx_equal(llcolor3.mV[VRED],llcolor4a.mV[VRED]) && is_approx_equal(llcolor3.mV[VGREEN],llcolor4a.mV[VGREEN]) && is_approx_equal(llcolor3.mV[VBLUE],llcolor4a.mV[VBLUE]))); llcolor4b = vec3to4(llcolor3); ensure_equals("vec3to4:Fail to convert vec3 to vec4 ", llcolor4b, llcolor4a); } @@ -324,7 +324,7 @@ namespace tut F32 r2 = 0xABF, g2 = 0xFB, b2 = 0xFFF; LLColor4 llcolor4a(r1,g1,b1),llcolor4b(r2,g2,b2),llcolor4c; llcolor4c = lerp(llcolor4a,llcolor4b,val); - ensure("lerp:Fail ", (is_approx_equal(r1 + (r2 - r1)* val,llcolor4c.mV[VX]) && is_approx_equal(g1 + (g2 - g1)* val,llcolor4c.mV[VY]) && is_approx_equal(b1 + (b2 - b1)* val,llcolor4c.mV[VZ]))); + ensure("lerp:Fail ", (is_approx_equal(r1 + (r2 - r1)* val,llcolor4c.mV[VRED]) && is_approx_equal(g1 + (g2 - g1)* val,llcolor4c.mV[VGREEN]) && is_approx_equal(b1 + (b2 - b1)* val,llcolor4c.mV[VBLUE]))); } template<> template<> diff --git a/indra/llmath/tests/v4coloru_test.cpp b/indra/llmath/tests/v4coloru_test.cpp index 2b6ee952a3..9d707d18c5 100644 --- a/indra/llmath/tests/v4coloru_test.cpp +++ b/indra/llmath/tests/v4coloru_test.cpp @@ -48,18 +48,18 @@ namespace tut void v4coloru_object::test<1>() { LLColor4U llcolor4u; - ensure("1:LLColor4u:Fail to initialize ", ((0 == llcolor4u.mV[VX]) && (0 == llcolor4u.mV[VY]) && (0 == llcolor4u.mV[VZ])&& (255 == llcolor4u.mV[VW]))); + ensure("1:LLColor4u:Fail to initialize ", ((0 == llcolor4u.mV[VRED]) && (0 == llcolor4u.mV[VGREEN]) && (0 == llcolor4u.mV[VBLUE])&& (255 == llcolor4u.mV[VALPHA]))); U8 r = 0x12, g = 0xFF, b = 0xAF, a = 0x23; LLColor4U llcolor4u1(r,g,b); - ensure("2:LLColor4u:Fail to initialize ", ((r == llcolor4u1.mV[VX]) && (g == llcolor4u1.mV[VY]) && (b == llcolor4u1.mV[VZ])&& (255 == llcolor4u1.mV[VW]))); + ensure("2:LLColor4u:Fail to initialize ", ((r == llcolor4u1.mV[VRED]) && (g == llcolor4u1.mV[VGREEN]) && (b == llcolor4u1.mV[VBLUE])&& (255 == llcolor4u1.mV[VALPHA]))); LLColor4U llcolor4u2(r,g,b,a); - ensure("3:LLColor4u:Fail to initialize ", ((r == llcolor4u2.mV[VX]) && (g == llcolor4u2.mV[VY]) && (b == llcolor4u2.mV[VZ])&& (a == llcolor4u2.mV[VW]))); + ensure("3:LLColor4u:Fail to initialize ", ((r == llcolor4u2.mV[VRED]) && (g == llcolor4u2.mV[VGREEN]) && (b == llcolor4u2.mV[VBLUE])&& (a == llcolor4u2.mV[VALPHA]))); const U8 vec[4] = {0x12,0xFF,0xAF,0x23}; LLColor4U llcolor4u3(vec); - ensure("4:LLColor4u:Fail to initialize ", ((vec[0] == llcolor4u3.mV[VX]) && (vec[1] == llcolor4u3.mV[VY]) && (vec[2] == llcolor4u3.mV[VZ])&& (vec[3] == llcolor4u3.mV[VW]))); + ensure("4:LLColor4u:Fail to initialize ", ((vec[0] == llcolor4u3.mV[VRED]) && (vec[1] == llcolor4u3.mV[VGREEN]) && (vec[2] == llcolor4u3.mV[VBLUE])&& (vec[3] == llcolor4u3.mV[VALPHA]))); LLSD sd = llcolor4u3.getValue(); LLColor4U llcolor4u4(sd); @@ -82,10 +82,10 @@ namespace tut U8 r = 0x12, g = 0xFF, b = 0xAF, a = 0x23; LLColor4U llcolor4u(r,g,b,a); llcolor4u.setToBlack(); - ensure("setToBlack:Fail to set black ", ((0 == llcolor4u.mV[VX]) && (0 == llcolor4u.mV[VY]) && (0 == llcolor4u.mV[VZ])&& (255 == llcolor4u.mV[VW]))); + ensure("setToBlack:Fail to set black ", ((0 == llcolor4u.mV[VRED]) && (0 == llcolor4u.mV[VGREEN]) && (0 == llcolor4u.mV[VBLUE])&& (255 == llcolor4u.mV[VALPHA]))); llcolor4u.setToWhite(); - ensure("setToWhite:Fail to white ", ((255 == llcolor4u.mV[VX]) && (255 == llcolor4u.mV[VY]) && (255 == llcolor4u.mV[VZ])&& (255 == llcolor4u.mV[VW]))); + ensure("setToWhite:Fail to white ", ((255 == llcolor4u.mV[VRED]) && (255 == llcolor4u.mV[VGREEN]) && (255 == llcolor4u.mV[VBLUE])&& (255 == llcolor4u.mV[VALPHA]))); } template<> template<> @@ -104,11 +104,11 @@ namespace tut U8 r = 0x12, g = 0xFF, b = 0xAF, a = 0x23; LLColor4U llcolor4u; llcolor4u.setVec(r,g,b,a); - ensure("1:setVec:Fail to set the values ", ((r == llcolor4u.mV[VX]) && (g == llcolor4u.mV[VY]) && (b == llcolor4u.mV[VZ])&& (a == llcolor4u.mV[VW]))); + ensure("1:setVec:Fail to set the values ", ((r == llcolor4u.mV[VRED]) && (g == llcolor4u.mV[VGREEN]) && (b == llcolor4u.mV[VBLUE])&& (a == llcolor4u.mV[VALPHA]))); llcolor4u.setToBlack(); llcolor4u.setVec(r,g,b); - ensure("2:setVec:Fail to set the values ", ((r == llcolor4u.mV[VX]) && (g == llcolor4u.mV[VY]) && (b == llcolor4u.mV[VZ])&& (255 == llcolor4u.mV[VW]))); + ensure("2:setVec:Fail to set the values ", ((r == llcolor4u.mV[VRED]) && (g == llcolor4u.mV[VGREEN]) && (b == llcolor4u.mV[VBLUE])&& (255 == llcolor4u.mV[VALPHA]))); LLColor4U llcolor4u1; llcolor4u1.setVec(llcolor4u); @@ -117,7 +117,7 @@ namespace tut const U8 vec[4] = {0x12,0xFF,0xAF,0x23}; LLColor4U llcolor4u2; llcolor4u2.setVec(vec); - ensure("4:setVec:Fail to set the values ", ((vec[0] == llcolor4u2.mV[VX]) && (vec[1] == llcolor4u2.mV[VY]) && (vec[2] == llcolor4u2.mV[VZ])&& (vec[3] == llcolor4u2.mV[VW]))); + ensure("4:setVec:Fail to set the values ", ((vec[0] == llcolor4u2.mV[VRED]) && (vec[1] == llcolor4u2.mV[VGREEN]) && (vec[2] == llcolor4u2.mV[VBLUE])&& (vec[3] == llcolor4u2.mV[VALPHA]))); } template<> template<> @@ -126,7 +126,7 @@ namespace tut U8 alpha = 0x12; LLColor4U llcolor4u; llcolor4u.setAlpha(alpha); - ensure("setAlpha:Fail to set alpha value ", (alpha == llcolor4u.mV[VW])); + ensure("setAlpha:Fail to set alpha value ", (alpha == llcolor4u.mV[VALPHA])); } template<> template<> @@ -159,29 +159,29 @@ namespace tut llcolor4u3 = llcolor4u1 + llcolor4u2; ensure_equals( "1a.operator+:Fail to Add the values ", - llcolor4u3.mV[VX], + llcolor4u3.mV[VRED], (U8)(r1+r2)); ensure_equals( "1b.operator+:Fail to Add the values ", - llcolor4u3.mV[VY], + llcolor4u3.mV[VGREEN], (U8)(g1+g2)); ensure_equals( "1c.operator+:Fail to Add the values ", - llcolor4u3.mV[VZ], + llcolor4u3.mV[VBLUE], (U8)(b1+b2)); llcolor4u2 += llcolor4u1; ensure_equals( "2a.operator+=:Fail to Add the values ", - llcolor4u2.mV[VX], + llcolor4u2.mV[VRED], (U8)(r1+r2)); ensure_equals( "2b.operator+=:Fail to Add the values ", - llcolor4u2.mV[VY], + llcolor4u2.mV[VGREEN], (U8)(g1+g2)); ensure_equals( "2c.operator+=:Fail to Add the values ", - llcolor4u2.mV[VZ], + llcolor4u2.mV[VBLUE], (U8)(b1+b2)); } @@ -194,29 +194,29 @@ namespace tut llcolor4u3 = llcolor4u1 - llcolor4u2; ensure_equals( "1a. operator-:Fail to Add the values ", - llcolor4u3.mV[VX], + llcolor4u3.mV[VRED], (U8)(r1-r2)); ensure_equals( "1b. operator-:Fail to Add the values ", - llcolor4u3.mV[VY], + llcolor4u3.mV[VGREEN], (U8)(g1-g2)); ensure_equals( "1c. operator-:Fail to Add the values ", - llcolor4u3.mV[VZ], + llcolor4u3.mV[VBLUE], (U8)(b1-b2)); llcolor4u1 -= llcolor4u2; ensure_equals( "2a. operator-=:Fail to Add the values ", - llcolor4u1.mV[VX], + llcolor4u1.mV[VRED], (U8)(r1-r2)); ensure_equals( "2b. operator-=:Fail to Add the values ", - llcolor4u1.mV[VY], + llcolor4u1.mV[VGREEN], (U8)(g1-g2)); ensure_equals( "2c. operator-=:Fail to Add the values ", - llcolor4u1.mV[VZ], + llcolor4u1.mV[VBLUE], (U8)(b1-b2)); } @@ -229,30 +229,30 @@ namespace tut llcolor4u3 = llcolor4u1 * llcolor4u2; ensure_equals( "1a. operator*:Fail to multiply the values", - llcolor4u3.mV[VX], + llcolor4u3.mV[VRED], (U8)(r1*r2)); ensure_equals( "1b. operator*:Fail to multiply the values", - llcolor4u3.mV[VY], + llcolor4u3.mV[VGREEN], (U8)(g1*g2)); ensure_equals( "1c. operator*:Fail to multiply the values", - llcolor4u3.mV[VZ], + llcolor4u3.mV[VBLUE], (U8)(b1*b2)); U8 mulVal = 123; llcolor4u1 *= mulVal; ensure_equals( "2a. operator*=:Fail to multiply the values", - llcolor4u1.mV[VX], + llcolor4u1.mV[VRED], (U8)(r1*mulVal)); ensure_equals( "2b. operator*=:Fail to multiply the values", - llcolor4u1.mV[VY], + llcolor4u1.mV[VGREEN], (U8)(g1*mulVal)); ensure_equals( "2c. operator*=:Fail to multiply the values", - llcolor4u1.mV[VZ], + llcolor4u1.mV[VBLUE], (U8)(b1*mulVal)); } @@ -274,7 +274,7 @@ namespace tut LLColor4U llcolor4u(r,g,b,a); U8 modVal = 45; llcolor4u %= modVal; - ensure_equals("operator%=:Fail ", llcolor4u.mV[VW], (U8)(a * modVal)); + ensure_equals("operator%=:Fail ", llcolor4u.mV[VALPHA], (U8)(a * modVal)); } template<> template<> @@ -284,13 +284,13 @@ namespace tut LLColor4U llcolor4u1(r,g,b,a); std::string color("12, 23, 132, 50"); LLColor4U::parseColor4U(color, &llcolor4u1); - ensure("parseColor4U() failed to parse the color value ", ((12 == llcolor4u1.mV[VX]) && (23 == llcolor4u1.mV[VY]) && (132 == llcolor4u1.mV[VZ])&& (50 == llcolor4u1.mV[VW]))); + ensure("parseColor4U() failed to parse the color value ", ((12 == llcolor4u1.mV[VRED]) && (23 == llcolor4u1.mV[VGREEN]) && (132 == llcolor4u1.mV[VBLUE])&& (50 == llcolor4u1.mV[VALPHA]))); color = "12, 23, 132"; - ensure("2:parseColor4U() failed to parse the color value ", (FALSE == LLColor4U::parseColor4U(color, &llcolor4u1))); + ensure("2:parseColor4U() failed to parse the color value ", (false == LLColor4U::parseColor4U(color, &llcolor4u1))); color = "12"; - ensure("2:parseColor4U() failed to parse the color value ", (FALSE == LLColor4U::parseColor4U(color, &llcolor4u1))); + ensure("2:parseColor4U() failed to parse the color value ", (false == LLColor4U::parseColor4U(color, &llcolor4u1))); } template<> template<> @@ -300,8 +300,8 @@ namespace tut LLColor4U llcolor4u(r,g,b,a),llcolor4u1; const F32 fVal = 3.f; llcolor4u1 = llcolor4u.multAll(fVal); - ensure("multAll:Fail to multiply ", (((U8)ll_round(r * fVal) == llcolor4u1.mV[VX]) && (U8)ll_round(g * fVal) == llcolor4u1.mV[VY] - && ((U8)ll_round(b * fVal) == llcolor4u1.mV[VZ])&& ((U8)ll_round(a * fVal) == llcolor4u1.mV[VW]))); + ensure("multAll:Fail to multiply ", (((U8)ll_round(r * fVal) == llcolor4u1.mV[VRED]) && (U8)ll_round(g * fVal) == llcolor4u1.mV[VGREEN] + && ((U8)ll_round(b * fVal) == llcolor4u1.mV[VBLUE])&& ((U8)ll_round(a * fVal) == llcolor4u1.mV[VALPHA]))); } template<> template<> @@ -311,13 +311,13 @@ namespace tut U8 r2 = 23, g2 = 230, b2 = 124, a2 = 255; LLColor4U llcolor4u(r1,g1,b1,a1),llcolor4u1(r2,g2,b2,a2); llcolor4u1 = llcolor4u1.addClampMax(llcolor4u); - ensure("1:addClampMax():Fail to add the value ", ((r1+r2 == llcolor4u1.mV[VX]) && (255 == llcolor4u1.mV[VY]) && (b1+b2 == llcolor4u1.mV[VZ])&& (255 == llcolor4u1.mV[VW]))); + ensure("1:addClampMax():Fail to add the value ", ((r1+r2 == llcolor4u1.mV[VRED]) && (255 == llcolor4u1.mV[VGREEN]) && (b1+b2 == llcolor4u1.mV[VBLUE])&& (255 == llcolor4u1.mV[VALPHA]))); r1 = 132, g1 = 3, b1 = 3, a1 = 2; r2 = 123, g2 = 230, b2 = 154, a2 = 25; LLColor4U llcolor4u2(r1,g1,b1,a1),llcolor4u3(r2,g2,b2,a2); llcolor4u3 = llcolor4u3.addClampMax(llcolor4u2); - ensure("2:addClampMax():Fail to add the value ", ((255 == llcolor4u3.mV[VX]) && (g1+g2 == llcolor4u3.mV[VY]) && (b1+b2 == llcolor4u3.mV[VZ])&& (a1+a2 == llcolor4u3.mV[VW]))); + ensure("2:addClampMax():Fail to add the value ", ((255 == llcolor4u3.mV[VRED]) && (g1+g2 == llcolor4u3.mV[VGREEN]) && (b1+b2 == llcolor4u3.mV[VBLUE])&& (a1+a2 == llcolor4u3.mV[VALPHA]))); } template<> template<> @@ -331,6 +331,6 @@ namespace tut F32 color_scale_factor = MAX_COLOR/r; S32 r2 = ll_round(r * color_scale_factor); S32 g2 = ll_round(g * color_scale_factor); - ensure("setVecScaleClamp():Fail to add the value ", ((r2 == llcolor4u.mV[VX]) && (g2 == llcolor4u.mV[VY]) && (0 == llcolor4u.mV[VZ])&& (255 == llcolor4u.mV[VW]))); + ensure("setVecScaleClamp():Fail to add the value ", ((r2 == llcolor4u.mV[VRED]) && (g2 == llcolor4u.mV[VGREEN]) && (0 == llcolor4u.mV[VBLUE])&& (255 == llcolor4u.mV[VALPHA]))); } } diff --git a/indra/llmath/tests/v4math_test.cpp b/indra/llmath/tests/v4math_test.cpp index 07099cd417..236585f13b 100644 --- a/indra/llmath/tests/v4math_test.cpp +++ b/indra/llmath/tests/v4math_test.cpp @@ -123,9 +123,9 @@ namespace tut vec4.abs(); ensure("abs:Fail " ,((x == vec4.mV[VX]) && (-y == vec4.mV[VY]) && (-z == vec4.mV[VZ])&& (-w == vec4.mV[VW]))); vec4.clearVec(); - ensure("isExactlyClear:Fail " ,(TRUE == vec4.isExactlyClear())); + ensure("isExactlyClear:Fail " ,(true == vec4.isExactlyClear())); vec4.zeroVec(); - ensure("isExactlyZero:Fail " ,(TRUE == vec4.isExactlyZero())); + ensure("isExactlyZero:Fail " ,(true == vec4.isExactlyZero())); } template<> template<> @@ -303,11 +303,11 @@ namespace tut { F32 x = 1.f, y = 2.f, z = -1.1f,epsilon = .23425f; LLVector4 vec4(x,y,z), vec4a(x,y,z); - ensure("1:are_parallel: Fail " ,(TRUE == are_parallel(vec4a,vec4,epsilon))); + ensure("1:are_parallel: Fail " ,(true == are_parallel(vec4a,vec4,epsilon))); x = 21.f, y = 12.f, z = -123.1f; vec4a.clearVec(); vec4a.setVec(x,y,z); - ensure("2:are_parallel: Fail " ,(FALSE == are_parallel(vec4a,vec4,epsilon))); + ensure("2:are_parallel: Fail " ,(false == are_parallel(vec4a,vec4,epsilon))); } template<> template<> diff --git a/indra/llmath/tests/xform_test.cpp b/indra/llmath/tests/xform_test.cpp index ad56cdb15c..6d6a64ec4c 100644 --- a/indra/llmath/tests/xform_test.cpp +++ b/indra/llmath/tests/xform_test.cpp @@ -91,7 +91,7 @@ namespace tut xform_obj.setPositionZ(z); ensure("setPositionX/Y/Z failed: ", xform_obj.getPosition() == vec); - xform_obj.setScaleChildOffset(TRUE); + xform_obj.setScaleChildOffset(true); ensure("setScaleChildOffset failed: ", xform_obj.getScaleChildOffset()); vec.setVec(x, y, z); @@ -121,7 +121,7 @@ namespace tut // Is that the expected behavior? } - // test cases for inline BOOL setParent(LLXform *parent) and getParent() fn. + // test cases for inline bool setParent(LLXform *parent) and getParent() fn. template<> template<> void xform_test_object_t::test<3>() { @@ -216,7 +216,7 @@ namespace tut parent.setPosition(llvecpospar); LLVector3 llvecparentscale(1.0, 2.0, 0); - parent.setScaleChildOffset(TRUE); + parent.setScaleChildOffset(true); parent.setScale(llvecparentscale); LLQuaternion quat(1, 2, 3, 4); diff --git a/indra/llmath/v2math.cpp b/indra/llmath/v2math.cpp index ecbfe7378c..4649e13376 100644 --- a/indra/llmath/v2math.cpp +++ b/indra/llmath/v2math.cpp @@ -42,13 +42,13 @@ LLVector2 LLVector2::zero(0,0); // Non-member functions // Sets all values to absolute value of their original values -// Returns TRUE if data changed -BOOL LLVector2::abs() +// Returns true if data changed +bool LLVector2::abs() { - BOOL ret = FALSE; + bool ret{ false }; - if (mV[0] < 0.f) { mV[0] = -mV[0]; ret = TRUE; } - if (mV[1] < 0.f) { mV[1] = -mV[1]; ret = TRUE; } + if (mV[0] < 0.f) { mV[0] = -mV[0]; ret = true; } + if (mV[1] < 0.f) { mV[1] = -mV[1]; ret = true; } return ret; } @@ -67,7 +67,7 @@ F32 angle_between(const LLVector2& a, const LLVector2& b) return angle; } -BOOL are_parallel(const LLVector2 &a, const LLVector2 &b, float epsilon) +bool are_parallel(const LLVector2 &a, const LLVector2 &b, float epsilon) { LLVector2 an = a; LLVector2 bn = b; @@ -76,9 +76,9 @@ BOOL are_parallel(const LLVector2 &a, const LLVector2 &b, float epsilon) F32 dot = an * bn; if ( (1.0f - fabs(dot)) < epsilon) { - return TRUE; + return true; } - return FALSE; + return false; } diff --git a/indra/llmath/v2math.h b/indra/llmath/v2math.h index 5c756a7f84..a61c946304 100644 --- a/indra/llmath/v2math.h +++ b/indra/llmath/v2math.h @@ -78,12 +78,12 @@ class LLVector2 F32 magVecSquared() const; // deprecated F32 normVec(); // deprecated - BOOL abs(); // sets all values to absolute value of original value (first octant), returns TRUE if changed + bool abs(); // sets all values to absolute value of original value (first octant), returns true if changed const LLVector2& scaleVec(const LLVector2& vec); // scales per component by vec - BOOL isNull(); // Returns TRUE if vector has a _very_small_ length - BOOL isExactlyZero() const { return !mV[VX] && !mV[VY]; } + bool isNull(); // Returns true if vector has a _very_small_ length + bool isExactlyZero() const { return !mV[VX] && !mV[VY]; } F32 operator[](int idx) const { return mV[idx]; } F32 &operator[](int idx) { return mV[idx]; } @@ -114,7 +114,7 @@ class LLVector2 // Non-member functions F32 angle_between(const LLVector2 &a, const LLVector2 &b); // Returns angle (radians) between a and b -BOOL are_parallel(const LLVector2 &a, const LLVector2 &b, F32 epsilon=F_APPROXIMATELY_ZERO); // Returns TRUE if a and b are very close to parallel +bool are_parallel(const LLVector2 &a, const LLVector2 &b, F32 epsilon=F_APPROXIMATELY_ZERO); // Returns true if a and b are very close to parallel F32 dist_vec(const LLVector2 &a, const LLVector2 &b); // Returns distance between a and b F32 dist_vec_squared(const LLVector2 &a, const LLVector2 &b);// Returns distance squared between a and b F32 dist_vec_squared2D(const LLVector2 &a, const LLVector2 &b);// Returns distance squared between a and b ignoring Z component @@ -232,7 +232,7 @@ inline F32 LLVector2::lengthSquared(void) const return mV[0]*mV[0] + mV[1]*mV[1]; } -inline F32 LLVector2::normalize(void) +inline F32 LLVector2::normalize(void) { F32 mag = (F32) sqrt(mV[0]*mV[0] + mV[1]*mV[1]); F32 oomag; @@ -299,13 +299,13 @@ inline const LLVector2& LLVector2::scaleVec(const LLVector2& vec) return *this; } -inline BOOL LLVector2::isNull() +inline bool LLVector2::isNull() { if ( F_APPROXIMATELY_ZERO > mV[VX]*mV[VX] + mV[VY]*mV[VY] ) { - return TRUE; + return true; } - return FALSE; + return false; } diff --git a/indra/llmath/v3color.cpp b/indra/llmath/v3color.cpp index 9fe9c8d5e5..4367b993f8 100644 --- a/indra/llmath/v3color.cpp +++ b/indra/llmath/v3color.cpp @@ -63,7 +63,7 @@ const LLColor3& LLColor3::operator=(const LLColor4 &a) std::ostream& operator<<(std::ostream& s, const LLColor3 &a) { - s << "{ " << a.mV[VX] << ", " << a.mV[VY] << ", " << a.mV[VZ] << " }"; + s << "{ " << a.mV[VRED] << ", " << a.mV[VGREEN] << ", " << a.mV[VBLUE] << " }"; return s; } diff --git a/indra/llmath/v3color.h b/indra/llmath/v3color.h index ea26e9eb76..7b92f85a0c 100644 --- a/indra/llmath/v3color.h +++ b/indra/llmath/v3color.h @@ -196,17 +196,17 @@ inline LLColor3::LLColor3(void) inline LLColor3::LLColor3(F32 r, F32 g, F32 b) { - mV[VX] = r; - mV[VY] = g; - mV[VZ] = b; + mV[VRED] = r; + mV[VGREEN] = g; + mV[VBLUE] = b; } inline LLColor3::LLColor3(const F32 *vec) { - mV[VX] = vec[VX]; - mV[VY] = vec[VY]; - mV[VZ] = vec[VZ]; + mV[VRED] = vec[VRED]; + mV[VGREEN] = vec[VGREEN]; + mV[VBLUE] = vec[VBLUE]; } #if LL_WINDOWS @@ -226,11 +226,11 @@ inline LLColor3::LLColor3(const char* color_string) // takes a string of format char tempstr[7]; strncpy(tempstr,color_string,6); /* Flawfinder: ignore */ tempstr[6] = '\0'; - mV[VZ] = (F32)strtol(&tempstr[4],NULL,16)/255.f; + mV[VBLUE] = (F32)strtol(&tempstr[4],NULL,16)/255.f; tempstr[4] = '\0'; - mV[VY] = (F32)strtol(&tempstr[2],NULL,16)/255.f; + mV[VGREEN] = (F32)strtol(&tempstr[2],NULL,16)/255.f; tempstr[2] = '\0'; - mV[VX] = (F32)strtol(&tempstr[0],NULL,16)/255.f; + mV[VRED] = (F32)strtol(&tempstr[0],NULL,16)/255.f; } inline const LLColor3& LLColor3::setToBlack(void) diff --git a/indra/llmath/v3dmath.cpp b/indra/llmath/v3dmath.cpp index 6ecd1a00ac..bb55c812b5 100644 --- a/indra/llmath/v3dmath.cpp +++ b/indra/llmath/v3dmath.cpp @@ -52,31 +52,31 @@ const LLVector3d LLVector3d::z_axis_neg(0, 0, -1); // Clamps each values to range (min,max). -// Returns TRUE if data changed. -BOOL LLVector3d::clamp(F64 min, F64 max) +// Returns true if data changed. +bool LLVector3d::clamp(F64 min, F64 max) { - BOOL ret = FALSE; + bool ret{ false }; - if (mdV[0] < min) { mdV[0] = min; ret = TRUE; } - if (mdV[1] < min) { mdV[1] = min; ret = TRUE; } - if (mdV[2] < min) { mdV[2] = min; ret = TRUE; } + if (mdV[0] < min) { mdV[0] = min; ret = true; } + if (mdV[1] < min) { mdV[1] = min; ret = true; } + if (mdV[2] < min) { mdV[2] = min; ret = true; } - if (mdV[0] > max) { mdV[0] = max; ret = TRUE; } - if (mdV[1] > max) { mdV[1] = max; ret = TRUE; } - if (mdV[2] > max) { mdV[2] = max; ret = TRUE; } + if (mdV[0] > max) { mdV[0] = max; ret = true; } + if (mdV[1] > max) { mdV[1] = max; ret = true; } + if (mdV[2] > max) { mdV[2] = max; ret = true; } return ret; } // Sets all values to absolute value of their original values -// Returns TRUE if data changed -BOOL LLVector3d::abs() +// Returns true if data changed +bool LLVector3d::abs() { - BOOL ret = FALSE; + bool ret{ false }; - if (mdV[0] < 0.0) { mdV[0] = -mdV[0]; ret = TRUE; } - if (mdV[1] < 0.0) { mdV[1] = -mdV[1]; ret = TRUE; } - if (mdV[2] < 0.0) { mdV[2] = -mdV[2]; ret = TRUE; } + if (mdV[0] < 0.0) { mdV[0] = -mdV[0]; ret = true; } + if (mdV[1] < 0.0) { mdV[1] = -mdV[1]; ret = true; } + if (mdV[2] < 0.0) { mdV[2] = -mdV[2]; ret = true; } return ret; } @@ -127,11 +127,11 @@ const LLVector3d& LLVector3d::rotVec(F64 angle, F64 x, F64 y, F64 z) } -BOOL LLVector3d::parseVector3d(const std::string& buf, LLVector3d* value) +bool LLVector3d::parseVector3d(const std::string& buf, LLVector3d* value) { - if( buf.empty() || value == NULL) + if( buf.empty() || value == nullptr) { - return FALSE; + return false; } LLVector3d v; @@ -139,9 +139,9 @@ BOOL LLVector3d::parseVector3d(const std::string& buf, LLVector3d* value) if( 3 == count ) { value->setVec( v ); - return TRUE; + return true; } - return FALSE; + return false; } diff --git a/indra/llmath/v3dmath.h b/indra/llmath/v3dmath.h index 99c6905e70..ece8c54ea4 100644 --- a/indra/llmath/v3dmath.h +++ b/indra/llmath/v3dmath.h @@ -68,9 +68,9 @@ class LLVector3d return ret; } - inline BOOL isFinite() const; // checks to see if all values of LLVector3d are finite - BOOL clamp(const F64 min, const F64 max); // Clamps all values to (min,max), returns TRUE if data changed - BOOL abs(); // sets all values to absolute value of original value (first octant), returns TRUE if changed + inline bool isFinite() const; // checks to see if all values of LLVector3d are finite + bool clamp(const F64 min, const F64 max); // Clamps all values to (min,max), returns true if data changed + bool abs(); // sets all values to absolute value of original value (first octant), returns true if changed inline const LLVector3d& clear(); // Clears LLVector3d to (0, 0, 0, 1) inline const LLVector3d& clearVec(); // deprecated @@ -98,8 +98,8 @@ class LLVector3d const LLVector3d& rotVec(const LLMatrix3 &mat); // Rotates by LLMatrix4 mat const LLVector3d& rotVec(const LLQuaternion &q); // Rotates by LLQuaternion q - BOOL isNull() const; // Returns TRUE if vector has a _very_small_ length - BOOL isExactlyZero() const { return !mdV[VX] && !mdV[VY] && !mdV[VZ]; } + bool isNull() const; // Returns true if vector has a _very_small_ length + bool isExactlyZero() const { return !mdV[VX] && !mdV[VY] && !mdV[VZ]; } const LLVector3d& operator=(const LLVector4 &a); @@ -126,7 +126,7 @@ class LLVector3d friend std::ostream& operator<<(std::ostream& s, const LLVector3d& a); // Stream a - static BOOL parseVector3d(const std::string& buf, LLVector3d* value); + static bool parseVector3d(const std::string& buf, LLVector3d* value); }; @@ -189,7 +189,7 @@ inline LLVector3d::LLVector3d(const LLVector3d ©) // Destructors // checker -inline BOOL LLVector3d::isFinite() const +inline bool LLVector3d::isFinite() const { return (llfinite(mdV[VX]) && llfinite(mdV[VY]) && llfinite(mdV[VZ])); } @@ -472,13 +472,13 @@ inline LLVector3d lerp(const LLVector3d& a, const LLVector3d& b, const F64 u) } -inline BOOL LLVector3d::isNull() const +inline bool LLVector3d::isNull() const { if ( F_APPROXIMATELY_ZERO > mdV[VX]*mdV[VX] + mdV[VY]*mdV[VY] + mdV[VZ]*mdV[VZ] ) { - return TRUE; + return true; } - return FALSE; + return false; } @@ -495,7 +495,7 @@ inline F64 angle_between(const LLVector3d& a, const LLVector3d& b) return angle; } -inline BOOL are_parallel(const LLVector3d& a, const LLVector3d& b, const F64 epsilon) +inline bool are_parallel(const LLVector3d& a, const LLVector3d& b, const F64 epsilon) { LLVector3d an = a; LLVector3d bn = b; @@ -504,10 +504,9 @@ inline BOOL are_parallel(const LLVector3d& a, const LLVector3d& b, const F64 eps F64 dot = an * bn; if ( (1.0f - fabs(dot)) < epsilon) { - return TRUE; + return true; } - return FALSE; - + return false; } inline LLVector3d projected_vec(const LLVector3d& a, const LLVector3d& b) diff --git a/indra/llmath/v3math.cpp b/indra/llmath/v3math.cpp index a867b9f578..73ad2a4ed6 100644 --- a/indra/llmath/v3math.cpp +++ b/indra/llmath/v3math.cpp @@ -53,27 +53,27 @@ const LLVector3 LLVector3::all_one(1.f,1.f,1.f); // Clamps each values to range (min,max). -// Returns TRUE if data changed. -BOOL LLVector3::clamp(F32 min, F32 max) +// Returns true if data changed. +bool LLVector3::clamp(F32 min, F32 max) { - BOOL ret = FALSE; + bool ret{ false }; - if (mV[0] < min) { mV[0] = min; ret = TRUE; } - if (mV[1] < min) { mV[1] = min; ret = TRUE; } - if (mV[2] < min) { mV[2] = min; ret = TRUE; } + if (mV[0] < min) { mV[0] = min; ret = true; } + if (mV[1] < min) { mV[1] = min; ret = true; } + if (mV[2] < min) { mV[2] = min; ret = true; } - if (mV[0] > max) { mV[0] = max; ret = TRUE; } - if (mV[1] > max) { mV[1] = max; ret = TRUE; } - if (mV[2] > max) { mV[2] = max; ret = TRUE; } + if (mV[0] > max) { mV[0] = max; ret = true; } + if (mV[1] > max) { mV[1] = max; ret = true; } + if (mV[2] > max) { mV[2] = max; ret = true; } return ret; } // Clamps length to an upper limit. -// Returns TRUE if the data changed -BOOL LLVector3::clampLength( F32 length_limit ) +// Returns true if the data changed +bool LLVector3::clampLength( F32 length_limit ) { - BOOL changed = FALSE; + bool changed{ false }; F32 len = length(); if (llfinite(len)) @@ -88,7 +88,7 @@ BOOL LLVector3::clampLength( F32 length_limit ) mV[0] *= length_limit; mV[1] *= length_limit; mV[2] *= length_limit; - changed = TRUE; + changed = true; } } else @@ -108,7 +108,7 @@ BOOL LLVector3::clampLength( F32 length_limit ) { // no it can't be salvaged --> clear it clear(); - changed = TRUE; + changed = true; break; } } @@ -134,31 +134,31 @@ BOOL LLVector3::clampLength( F32 length_limit ) return changed; } -BOOL LLVector3::clamp(const LLVector3 &min_vec, const LLVector3 &max_vec) +bool LLVector3::clamp(const LLVector3 &min_vec, const LLVector3 &max_vec) { - BOOL ret = FALSE; + bool ret{ false }; - if (mV[0] < min_vec[0]) { mV[0] = min_vec[0]; ret = TRUE; } - if (mV[1] < min_vec[1]) { mV[1] = min_vec[1]; ret = TRUE; } - if (mV[2] < min_vec[2]) { mV[2] = min_vec[2]; ret = TRUE; } + if (mV[0] < min_vec[0]) { mV[0] = min_vec[0]; ret = true; } + if (mV[1] < min_vec[1]) { mV[1] = min_vec[1]; ret = true; } + if (mV[2] < min_vec[2]) { mV[2] = min_vec[2]; ret = true; } - if (mV[0] > max_vec[0]) { mV[0] = max_vec[0]; ret = TRUE; } - if (mV[1] > max_vec[1]) { mV[1] = max_vec[1]; ret = TRUE; } - if (mV[2] > max_vec[2]) { mV[2] = max_vec[2]; ret = TRUE; } + if (mV[0] > max_vec[0]) { mV[0] = max_vec[0]; ret = true; } + if (mV[1] > max_vec[1]) { mV[1] = max_vec[1]; ret = true; } + if (mV[2] > max_vec[2]) { mV[2] = max_vec[2]; ret = true; } return ret; } // Sets all values to absolute value of their original values -// Returns TRUE if data changed -BOOL LLVector3::abs() +// Returns true if data changed +bool LLVector3::abs() { - BOOL ret = FALSE; + bool ret{ false }; - if (mV[0] < 0.f) { mV[0] = -mV[0]; ret = TRUE; } - if (mV[1] < 0.f) { mV[1] = -mV[1]; ret = TRUE; } - if (mV[2] < 0.f) { mV[2] = -mV[2]; ret = TRUE; } + if (mV[0] < 0.f) { mV[0] = -mV[0]; ret = true; } + if (mV[1] < 0.f) { mV[1] = -mV[1]; ret = true; } + if (mV[2] < 0.f) { mV[2] = -mV[2]; ret = true; } return ret; } @@ -358,11 +358,11 @@ const LLVector3& operator*=(LLVector3 &a, const LLQuaternion &rot) } // static -BOOL LLVector3::parseVector3(const std::string& buf, LLVector3* value) +bool LLVector3::parseVector3(const std::string& buf, LLVector3* value) { - if( buf.empty() || value == NULL) + if( buf.empty() || value == nullptr) { - return FALSE; + return false; } LLVector3 v; @@ -370,10 +370,10 @@ BOOL LLVector3::parseVector3(const std::string& buf, LLVector3* value) if( 3 == count ) { value->setVec( v ); - return TRUE; + return true; } - return FALSE; + return false; } // Displacement from query point to nearest neighbor point on bounding box. diff --git a/indra/llmath/v3math.h b/indra/llmath/v3math.h index 0f4a4a07ae..d063b15c74 100644 --- a/indra/llmath/v3math.h +++ b/indra/llmath/v3math.h @@ -71,16 +71,16 @@ class LLVector3 void setValue(const LLSD& sd); - inline BOOL isFinite() const; // checks to see if all values of LLVector3 are finite - BOOL clamp(F32 min, F32 max); // Clamps all values to (min,max), returns TRUE if data changed - BOOL clamp(const LLVector3 &min_vec, const LLVector3 &max_vec); // Scales vector by another vector - BOOL clampLength( F32 length_limit ); // Scales vector to limit length to a value + inline bool isFinite() const; // checks to see if all values of LLVector3 are finite + bool clamp(F32 min, F32 max); // Clamps all values to (min,max), returns true if data changed + bool clamp(const LLVector3 &min_vec, const LLVector3 &max_vec); // Scales vector by another vector + bool clampLength( F32 length_limit ); // Scales vector to limit length to a value void quantize16(F32 lowerxy, F32 upperxy, F32 lowerz, F32 upperz); // changes the vector to reflect quatization void quantize8(F32 lowerxy, F32 upperxy, F32 lowerz, F32 upperz); // changes the vector to reflect quatization void snap(S32 sig_digits); // snaps x,y,z to sig_digits decimal places - BOOL abs(); // sets all values to absolute value of original value (first octant), returns TRUE if changed + bool abs(); // sets all values to absolute value of original value (first octant), returns true if changed inline void clear(); // Clears LLVector3 to (0, 0, 0) inline void setZero(); // Clears LLVector3 to (0, 0, 0) @@ -108,7 +108,7 @@ class LLVector3 inline F32 normalize(); // Normalizes and returns the magnitude of LLVector3 inline F32 normVec(); // deprecated - inline BOOL inRange( F32 min, F32 max ) const; // Returns true if all values of the vector are between min and max + inline bool inRange( F32 min, F32 max ) const; // Returns true if all values of the vector are between min and max const LLVector3& rotVec(F32 angle, const LLVector3 &vec); // Rotates about vec by angle radians const LLVector3& rotVec(F32 angle, F32 x, F32 y, F32 z); // Rotates about x,y,z by angle radians @@ -119,8 +119,8 @@ class LLVector3 const LLVector3& scaleVec(const LLVector3& vec); // scales per component by vec LLVector3 scaledVec(const LLVector3& vec) const; // get a copy of this vector scaled by vec - BOOL isNull() const; // Returns TRUE if vector has a _very_small_ length - BOOL isExactlyZero() const { return !mV[VX] && !mV[VY] && !mV[VZ]; } + bool isNull() const; // Returns true if vector has a _very_small_ length + bool isExactlyZero() const { return !mV[VX] && !mV[VY] && !mV[VZ]; } F32 operator[](int idx) const { return mV[idx]; } F32 &operator[](int idx) { return mV[idx]; } @@ -149,7 +149,7 @@ class LLVector3 friend std::ostream& operator<<(std::ostream& s, const LLVector3 &a); // Stream a - static BOOL parseVector3(const std::string& buf, LLVector3* value); + static bool parseVector3(const std::string& buf, LLVector3* value); }; typedef LLVector3 LLSimLocalVec; @@ -157,7 +157,7 @@ typedef LLVector3 LLSimLocalVec; // Non-member functions F32 angle_between(const LLVector3 &a, const LLVector3 &b); // Returns angle (radians) between a and b -BOOL are_parallel(const LLVector3 &a, const LLVector3 &b, F32 epsilon=F_APPROXIMATELY_ZERO); // Returns TRUE if a and b are very close to parallel +bool are_parallel(const LLVector3 &a, const LLVector3 &b, F32 epsilon=F_APPROXIMATELY_ZERO); // Returns true if a and b are very close to parallel F32 dist_vec(const LLVector3 &a, const LLVector3 &b); // Returns distance between a and b F32 dist_vec_squared(const LLVector3 &a, const LLVector3 &b);// Returns distance squared between a and b F32 dist_vec_squared2D(const LLVector3 &a, const LLVector3 &b);// Returns distance squared between a and b ignoring Z component @@ -202,7 +202,7 @@ inline LLVector3::LLVector3(const LLVector3 ©) // Destructors // checker -inline BOOL LLVector3::isFinite() const +inline bool LLVector3::isFinite() const { return (llfinite(mV[VX]) && llfinite(mV[VY]) && llfinite(mV[VZ])); } @@ -350,7 +350,7 @@ inline F32 LLVector3::magVecSquared(void) const return mV[0]*mV[0] + mV[1]*mV[1] + mV[2]*mV[2]; } -inline BOOL LLVector3::inRange( F32 min, F32 max ) const +inline bool LLVector3::inRange( F32 min, F32 max ) const { return mV[0] >= min && mV[0] <= max && mV[1] >= min && mV[1] <= max && @@ -539,13 +539,13 @@ inline LLVector3 lerp(const LLVector3 &a, const LLVector3 &b, F32 u) } -inline BOOL LLVector3::isNull() const +inline bool LLVector3::isNull() const { if ( F_APPROXIMATELY_ZERO > mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ] ) { - return TRUE; + return true; } - return FALSE; + return false; } inline void update_min_max(LLVector3& min, LLVector3& max, const LLVector3& pos) @@ -589,7 +589,7 @@ inline F32 angle_between(const LLVector3& a, const LLVector3& b) return atan2f(sqrtf(c * c), ab); // return the angle } -inline BOOL are_parallel(const LLVector3 &a, const LLVector3 &b, F32 epsilon) +inline bool are_parallel(const LLVector3 &a, const LLVector3 &b, F32 epsilon) { LLVector3 an = a; LLVector3 bn = b; @@ -598,9 +598,9 @@ inline BOOL are_parallel(const LLVector3 &a, const LLVector3 &b, F32 epsilon) F32 dot = an * bn; if ( (1.0f - fabs(dot)) < epsilon) { - return TRUE; + return true; } - return FALSE; + return false; } inline std::ostream& operator<<(std::ostream& s, const LLVector3 &a) diff --git a/indra/llmath/v4color.cpp b/indra/llmath/v4color.cpp index 497281c27e..ad13656bbd 100644 --- a/indra/llmath/v4color.cpp +++ b/indra/llmath/v4color.cpp @@ -133,57 +133,57 @@ LLColor4::operator LLColor4U() const LLColor4::LLColor4(const LLColor3 &vec, F32 a) { - mV[VX] = vec.mV[VX]; - mV[VY] = vec.mV[VY]; - mV[VZ] = vec.mV[VZ]; - mV[VW] = a; + mV[VRED] = vec.mV[VRED]; + mV[VGREEN] = vec.mV[VGREEN]; + mV[VBLUE] = vec.mV[VBLUE]; + mV[VALPHA] = a; } LLColor4::LLColor4(const LLColor4U& color4u) { const F32 SCALE = 1.f/255.f; - mV[VX] = color4u.mV[VX] * SCALE; - mV[VY] = color4u.mV[VY] * SCALE; - mV[VZ] = color4u.mV[VZ] * SCALE; - mV[VW] = color4u.mV[VW] * SCALE; + mV[VRED] = color4u.mV[VRED] * SCALE; + mV[VGREEN] = color4u.mV[VGREEN] * SCALE; + mV[VBLUE] = color4u.mV[VBLUE] * SCALE; + mV[VALPHA] = color4u.mV[VALPHA] * SCALE; } LLColor4::LLColor4(const LLVector4& vector4) { - mV[VX] = vector4.mV[VX]; - mV[VY] = vector4.mV[VY]; - mV[VZ] = vector4.mV[VZ]; - mV[VW] = vector4.mV[VW]; + mV[VRED] = vector4.mV[VRED]; + mV[VGREEN] = vector4.mV[VGREEN]; + mV[VBLUE] = vector4.mV[VBLUE]; + mV[VALPHA] = vector4.mV[VALPHA]; } const LLColor4& LLColor4::set(const LLColor4U& color4u) { const F32 SCALE = 1.f/255.f; - mV[VX] = color4u.mV[VX] * SCALE; - mV[VY] = color4u.mV[VY] * SCALE; - mV[VZ] = color4u.mV[VZ] * SCALE; - mV[VW] = color4u.mV[VW] * SCALE; + mV[VRED] = color4u.mV[VRED] * SCALE; + mV[VGREEN] = color4u.mV[VGREEN] * SCALE; + mV[VBLUE] = color4u.mV[VBLUE] * SCALE; + mV[VALPHA] = color4u.mV[VALPHA] * SCALE; return (*this); } const LLColor4& LLColor4::set(const LLColor3 &vec) { - mV[VX] = vec.mV[VX]; - mV[VY] = vec.mV[VY]; - mV[VZ] = vec.mV[VZ]; + mV[VRED] = vec.mV[VRED]; + mV[VGREEN] = vec.mV[VGREEN]; + mV[VBLUE] = vec.mV[VBLUE]; // no change to alpha! -// mV[VW] = 1.f; +// mV[VALPHA] = 1.f; return (*this); } const LLColor4& LLColor4::set(const LLColor3 &vec, F32 a) { - mV[VX] = vec.mV[VX]; - mV[VY] = vec.mV[VY]; - mV[VZ] = vec.mV[VZ]; - mV[VW] = a; + mV[VRED] = vec.mV[VRED]; + mV[VGREEN] = vec.mV[VGREEN]; + mV[VBLUE] = vec.mV[VBLUE]; + mV[VALPHA] = a; return (*this); } @@ -191,22 +191,22 @@ const LLColor4& LLColor4::set(const LLColor3 &vec, F32 a) const LLColor4& LLColor4::setVec(const LLColor4U& color4u) { const F32 SCALE = 1.f/255.f; - mV[VX] = color4u.mV[VX] * SCALE; - mV[VY] = color4u.mV[VY] * SCALE; - mV[VZ] = color4u.mV[VZ] * SCALE; - mV[VW] = color4u.mV[VW] * SCALE; + mV[VRED] = color4u.mV[VRED] * SCALE; + mV[VGREEN] = color4u.mV[VGREEN] * SCALE; + mV[VBLUE] = color4u.mV[VBLUE] * SCALE; + mV[VALPHA] = color4u.mV[VALPHA] * SCALE; return (*this); } // deprecated -- use set() const LLColor4& LLColor4::setVec(const LLColor3 &vec) { - mV[VX] = vec.mV[VX]; - mV[VY] = vec.mV[VY]; - mV[VZ] = vec.mV[VZ]; + mV[VRED] = vec.mV[VRED]; + mV[VGREEN] = vec.mV[VGREEN]; + mV[VBLUE] = vec.mV[VBLUE]; // no change to alpha! -// mV[VW] = 1.f; +// mV[VALPHA] = 1.f; return (*this); } @@ -214,10 +214,10 @@ const LLColor4& LLColor4::setVec(const LLColor3 &vec) // deprecated -- use set() const LLColor4& LLColor4::setVec(const LLColor3 &vec, F32 a) { - mV[VX] = vec.mV[VX]; - mV[VY] = vec.mV[VY]; - mV[VZ] = vec.mV[VZ]; - mV[VW] = a; + mV[VRED] = vec.mV[VRED]; + mV[VGREEN] = vec.mV[VGREEN]; + mV[VBLUE] = vec.mV[VBLUE]; + mV[VALPHA] = a; return (*this); } @@ -257,45 +257,45 @@ void LLColor4::setValue(const LLSD& sd) const LLColor4& LLColor4::operator=(const LLColor3 &a) { - mV[VX] = a.mV[VX]; - mV[VY] = a.mV[VY]; - mV[VZ] = a.mV[VZ]; + mV[VRED] = a.mV[VRED]; + mV[VGREEN] = a.mV[VGREEN]; + mV[VBLUE] = a.mV[VBLUE]; // converting from an rgb sets a=1 (opaque) - mV[VW] = 1.f; + mV[VALPHA] = 1.f; return (*this); } std::ostream& operator<<(std::ostream& s, const LLColor4 &a) { - s << "{ " << a.mV[VX] << ", " << a.mV[VY] << ", " << a.mV[VZ] << ", " << a.mV[VW] << " }"; + s << "{ " << a.mV[VRED] << ", " << a.mV[VGREEN] << ", " << a.mV[VBLUE] << ", " << a.mV[VALPHA] << " }"; return s; } bool operator==(const LLColor4 &a, const LLColor3 &b) { - return ( (a.mV[VX] == b.mV[VX]) - &&(a.mV[VY] == b.mV[VY]) - &&(a.mV[VZ] == b.mV[VZ])); + return ( (a.mV[VRED] == b.mV[VRED]) + &&(a.mV[VGREEN] == b.mV[VGREEN]) + &&(a.mV[VBLUE] == b.mV[VBLUE])); } bool operator!=(const LLColor4 &a, const LLColor3 &b) { - return ( (a.mV[VX] != b.mV[VX]) - ||(a.mV[VY] != b.mV[VY]) - ||(a.mV[VZ] != b.mV[VZ])); + return ( (a.mV[VRED] != b.mV[VRED]) + ||(a.mV[VGREEN] != b.mV[VGREEN]) + ||(a.mV[VBLUE] != b.mV[VBLUE])); } LLColor3 vec4to3(const LLColor4 &vec) { - LLColor3 temp(vec.mV[VX], vec.mV[VY], vec.mV[VZ]); + LLColor3 temp(vec.mV[VRED], vec.mV[VGREEN], vec.mV[VBLUE]); return temp; } LLColor4 vec3to4(const LLColor3 &vec) { - LLColor3 temp(vec.mV[VX], vec.mV[VY], vec.mV[VZ]); + LLColor3 temp(vec.mV[VRED], vec.mV[VGREEN], vec.mV[VBLUE]); return temp; } @@ -385,18 +385,18 @@ void LLColor4::calcHSL(F32* hue, F32* saturation, F32* luminance) const } // static -BOOL LLColor4::parseColor(const std::string& buf, LLColor4* color) +bool LLColor4::parseColor(const std::string& buf, LLColor4* color) { - if( buf.empty() || color == NULL) + if( buf.empty() || color == nullptr) { - return FALSE; + return false; } boost_tokenizer tokens(buf, boost::char_separator<char>(", ")); boost_tokenizer::iterator token_iter = tokens.begin(); if (token_iter == tokens.end()) { - return FALSE; + return false; } // Grab the first token into a string, since we don't know @@ -408,10 +408,10 @@ BOOL LLColor4::parseColor(const std::string& buf, LLColor4* color) { // There are more tokens to read. This must be a vector. LLColor4 v; - LLStringUtil::convertToF32( color_name, v.mV[VX] ); - LLStringUtil::convertToF32( *token_iter, v.mV[VY] ); - v.mV[VZ] = 0.0f; - v.mV[VW] = 1.0f; + LLStringUtil::convertToF32( color_name, v.mV[VRED] ); + LLStringUtil::convertToF32( *token_iter, v.mV[VGREEN] ); + v.mV[VBLUE] = 0.0f; + v.mV[VALPHA] = 1.0f; ++token_iter; if (token_iter == tokens.end()) @@ -422,18 +422,18 @@ BOOL LLColor4::parseColor(const std::string& buf, LLColor4* color) else { // There is a z-component. - LLStringUtil::convertToF32( *token_iter, v.mV[VZ] ); + LLStringUtil::convertToF32( *token_iter, v.mV[VBLUE] ); ++token_iter; if (token_iter != tokens.end()) { // There is an alpha component. - LLStringUtil::convertToF32( *token_iter, v.mV[VW] ); + LLStringUtil::convertToF32( *token_iter, v.mV[VALPHA] ); } } // Make sure all values are between 0 and 1. - if (v.mV[VX] > 1.f || v.mV[VY] > 1.f || v.mV[VZ] > 1.f || v.mV[VW] > 1.f) + if (v.mV[VRED] > 1.f || v.mV[VGREEN] > 1.f || v.mV[VBLUE] > 1.f || v.mV[VALPHA] > 1.f) { v = v * (1.f / 255.f); } @@ -708,15 +708,15 @@ BOOL LLColor4::parseColor(const std::string& buf, LLColor4* color) } } - return TRUE; + return true; } // static -BOOL LLColor4::parseColor4(const std::string& buf, LLColor4* value) +bool LLColor4::parseColor4(const std::string& buf, LLColor4* value) { - if( buf.empty() || value == NULL) + if( buf.empty() || value == nullptr) { - return FALSE; + return false; } LLColor4 v; @@ -729,10 +729,10 @@ BOOL LLColor4::parseColor4(const std::string& buf, LLColor4* value) if( 4 == count ) { value->setVec( v ); - return TRUE; + return true; } - return FALSE; + return false; } // EOF diff --git a/indra/llmath/v4color.h b/indra/llmath/v4color.h index 3168c8b43a..e9bb6a07ba 100644 --- a/indra/llmath/v4color.h +++ b/indra/llmath/v4color.h @@ -111,7 +111,7 @@ class LLColor4 F32 lengthSquared() const; // Returns magnitude squared of LLColor4 F32 normalize(); // deprecated -- use normalize() - BOOL isOpaque() { return mV[VALPHA] == 1.f; } + bool isOpaque() { return mV[VALPHA] == 1.f; } F32 operator[](int idx) const { return mV[idx]; } F32 &operator[](int idx) { return mV[idx]; } @@ -226,8 +226,8 @@ class LLColor4 static LLColor4 cyan5; static LLColor4 cyan6; - static BOOL parseColor(const std::string& buf, LLColor4* color); - static BOOL parseColor4(const std::string& buf, LLColor4* color); + static bool parseColor(const std::string& buf, LLColor4* color); + static bool parseColor4(const std::string& buf, LLColor4* color); inline void clamp(); }; @@ -242,10 +242,10 @@ LLColor4 lerp(const LLColor4 &a, const LLColor4 &b, F32 u); inline LLColor4::LLColor4(void) { - mV[VX] = 0.f; - mV[VY] = 0.f; - mV[VZ] = 0.f; - mV[VW] = 1.f; + mV[VRED] = 0.f; + mV[VGREEN] = 0.f; + mV[VBLUE] = 0.f; + mV[VALPHA] = 1.f; } inline LLColor4::LLColor4(const LLSD& sd) @@ -255,113 +255,113 @@ inline LLColor4::LLColor4(const LLSD& sd) inline LLColor4::LLColor4(F32 r, F32 g, F32 b) { - mV[VX] = r; - mV[VY] = g; - mV[VZ] = b; - mV[VW] = 1.f; + mV[VRED] = r; + mV[VGREEN] = g; + mV[VBLUE] = b; + mV[VALPHA] = 1.f; } inline LLColor4::LLColor4(F32 r, F32 g, F32 b, F32 a) { - mV[VX] = r; - mV[VY] = g; - mV[VZ] = b; - mV[VW] = a; + mV[VRED] = r; + mV[VGREEN] = g; + mV[VBLUE] = b; + mV[VALPHA] = a; } inline LLColor4::LLColor4(U32 clr) { - mV[VX] = (clr&0xff) * (1.0f/255.0f); - mV[VY] = ((clr>>8)&0xff) * (1.0f/255.0f); - mV[VZ] = ((clr>>16)&0xff) * (1.0f/255.0f); - mV[VW] = (clr>>24) * (1.0f/255.0f); + mV[VRED] = (clr&0xff) * (1.0f/255.0f); + mV[VGREEN] = ((clr>>8)&0xff) * (1.0f/255.0f); + mV[VBLUE] = ((clr>>16)&0xff) * (1.0f/255.0f); + mV[VALPHA] = (clr>>24) * (1.0f/255.0f); } inline LLColor4::LLColor4(const F32 *vec) { - mV[VX] = vec[VX]; - mV[VY] = vec[VY]; - mV[VZ] = vec[VZ]; - mV[VW] = vec[VW]; + mV[VRED] = vec[VRED]; + mV[VGREEN] = vec[VGREEN]; + mV[VBLUE] = vec[VBLUE]; + mV[VALPHA] = vec[VALPHA]; } inline const LLColor4& LLColor4::setToBlack(void) { - mV[VX] = 0.f; - mV[VY] = 0.f; - mV[VZ] = 0.f; - mV[VW] = 1.f; + mV[VRED] = 0.f; + mV[VGREEN] = 0.f; + mV[VBLUE] = 0.f; + mV[VALPHA] = 1.f; return (*this); } inline const LLColor4& LLColor4::setToWhite(void) { - mV[VX] = 1.f; - mV[VY] = 1.f; - mV[VZ] = 1.f; - mV[VW] = 1.f; + mV[VRED] = 1.f; + mV[VGREEN] = 1.f; + mV[VBLUE] = 1.f; + mV[VALPHA] = 1.f; return (*this); } inline const LLColor4& LLColor4::set(F32 x, F32 y, F32 z) { - mV[VX] = x; - mV[VY] = y; - mV[VZ] = z; + mV[VRED] = x; + mV[VGREEN] = y; + mV[VBLUE] = z; // no change to alpha! -// mV[VW] = 1.f; +// mV[VALPHA] = 1.f; return (*this); } inline const LLColor4& LLColor4::set(F32 x, F32 y, F32 z, F32 a) { - mV[VX] = x; - mV[VY] = y; - mV[VZ] = z; - mV[VW] = a; + mV[VRED] = x; + mV[VGREEN] = y; + mV[VBLUE] = z; + mV[VALPHA] = a; return (*this); } inline const LLColor4& LLColor4::set(const LLColor4 &vec) { - mV[VX] = vec.mV[VX]; - mV[VY] = vec.mV[VY]; - mV[VZ] = vec.mV[VZ]; - mV[VW] = vec.mV[VW]; + mV[VRED] = vec.mV[VRED]; + mV[VGREEN] = vec.mV[VGREEN]; + mV[VBLUE] = vec.mV[VBLUE]; + mV[VALPHA] = vec.mV[VALPHA]; return (*this); } inline const LLColor4& LLColor4::set(const F32 *vec) { - mV[VX] = vec[VX]; - mV[VY] = vec[VY]; - mV[VZ] = vec[VZ]; - mV[VW] = vec[VW]; + mV[VRED] = vec[VRED]; + mV[VGREEN] = vec[VGREEN]; + mV[VBLUE] = vec[VBLUE]; + mV[VALPHA] = vec[VALPHA]; return (*this); } inline const LLColor4& LLColor4::set(const F64 *vec) { - mV[VX] = static_cast<F32>(vec[VX]); - mV[VY] = static_cast<F32>(vec[VY]); - mV[VZ] = static_cast<F32>(vec[VZ]); - mV[VW] = static_cast<F32>(vec[VW]); + mV[VRED] = static_cast<F32>(vec[VRED]); + mV[VGREEN] = static_cast<F32>(vec[VGREEN]); + mV[VBLUE] = static_cast<F32>(vec[VBLUE]); + mV[VALPHA] = static_cast<F32>(vec[VALPHA]); return (*this); } // deprecated inline const LLColor4& LLColor4::setVec(F32 x, F32 y, F32 z) { - mV[VX] = x; - mV[VY] = y; - mV[VZ] = z; + mV[VRED] = x; + mV[VGREEN] = y; + mV[VBLUE] = z; // no change to alpha! -// mV[VW] = 1.f; +// mV[VALPHA] = 1.f; return (*this); } @@ -369,20 +369,20 @@ inline const LLColor4& LLColor4::setVec(F32 x, F32 y, F32 z) // deprecated inline const LLColor4& LLColor4::setVec(F32 x, F32 y, F32 z, F32 a) { - mV[VX] = x; - mV[VY] = y; - mV[VZ] = z; - mV[VW] = a; + mV[VRED] = x; + mV[VGREEN] = y; + mV[VBLUE] = z; + mV[VALPHA] = a; return (*this); } // deprecated inline const LLColor4& LLColor4::setVec(const LLColor4 &vec) { - mV[VX] = vec.mV[VX]; - mV[VY] = vec.mV[VY]; - mV[VZ] = vec.mV[VZ]; - mV[VW] = vec.mV[VW]; + mV[VRED] = vec.mV[VRED]; + mV[VGREEN] = vec.mV[VGREEN]; + mV[VBLUE] = vec.mV[VBLUE]; + mV[VALPHA] = vec.mV[VALPHA]; return (*this); } @@ -390,16 +390,16 @@ inline const LLColor4& LLColor4::setVec(const LLColor4 &vec) // deprecated inline const LLColor4& LLColor4::setVec(const F32 *vec) { - mV[VX] = vec[VX]; - mV[VY] = vec[VY]; - mV[VZ] = vec[VZ]; - mV[VW] = vec[VW]; + mV[VRED] = vec[VRED]; + mV[VGREEN] = vec[VGREEN]; + mV[VBLUE] = vec[VBLUE]; + mV[VALPHA] = vec[VALPHA]; return (*this); } inline const LLColor4& LLColor4::setAlpha(F32 a) { - mV[VW] = a; + mV[VALPHA] = a; return (*this); } @@ -407,25 +407,25 @@ inline const LLColor4& LLColor4::setAlpha(F32 a) inline F32 LLColor4::length(void) const { - return (F32) sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]); + return (F32) sqrt(mV[VRED]*mV[VRED] + mV[VGREEN]*mV[VGREEN] + mV[VBLUE]*mV[VBLUE]); } inline F32 LLColor4::lengthSquared(void) const { - return mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]; + return mV[VRED]*mV[VRED] + mV[VGREEN]*mV[VGREEN] + mV[VBLUE]*mV[VBLUE]; } inline F32 LLColor4::normalize(void) { - F32 mag = (F32) sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]); + F32 mag = (F32) sqrt(mV[VRED]*mV[VRED] + mV[VGREEN]*mV[VGREEN] + mV[VBLUE]*mV[VBLUE]); F32 oomag; if (mag) { oomag = 1.f/mag; - mV[VX] *= oomag; - mV[VY] *= oomag; - mV[VZ] *= oomag; + mV[VRED] *= oomag; + mV[VGREEN] *= oomag; + mV[VBLUE] *= oomag; } return (mag); } @@ -433,27 +433,27 @@ inline F32 LLColor4::normalize(void) // deprecated inline F32 LLColor4::magVec(void) const { - return (F32) sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]); + return (F32) sqrt(mV[VRED]*mV[VRED] + mV[VGREEN]*mV[VGREEN] + mV[VBLUE]*mV[VBLUE]); } // deprecated inline F32 LLColor4::magVecSquared(void) const { - return mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]; + return mV[VRED]*mV[VRED] + mV[VGREEN]*mV[VGREEN] + mV[VBLUE]*mV[VBLUE]; } // deprecated inline F32 LLColor4::normVec(void) { - F32 mag = (F32) sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]); + F32 mag = (F32) sqrt(mV[VRED]*mV[VRED] + mV[VGREEN]*mV[VGREEN] + mV[VBLUE]*mV[VBLUE]); F32 oomag; if (mag) { oomag = 1.f/mag; - mV[VX] *= oomag; - mV[VY] *= oomag; - mV[VZ] *= oomag; + mV[VRED] *= oomag; + mV[VGREEN] *= oomag; + mV[VBLUE] *= oomag; } return (mag); } @@ -464,135 +464,135 @@ inline F32 LLColor4::normVec(void) inline LLColor4 operator+(const LLColor4 &a, const LLColor4 &b) { return LLColor4( - a.mV[VX] + b.mV[VX], - a.mV[VY] + b.mV[VY], - a.mV[VZ] + b.mV[VZ], - a.mV[VW] + b.mV[VW]); + a.mV[VRED] + b.mV[VRED], + a.mV[VGREEN] + b.mV[VGREEN], + a.mV[VBLUE] + b.mV[VBLUE], + a.mV[VALPHA] + b.mV[VALPHA]); } inline LLColor4 operator-(const LLColor4 &a, const LLColor4 &b) { return LLColor4( - a.mV[VX] - b.mV[VX], - a.mV[VY] - b.mV[VY], - a.mV[VZ] - b.mV[VZ], - a.mV[VW] - b.mV[VW]); + a.mV[VRED] - b.mV[VRED], + a.mV[VGREEN] - b.mV[VGREEN], + a.mV[VBLUE] - b.mV[VBLUE], + a.mV[VALPHA] - b.mV[VALPHA]); } inline LLColor4 operator*(const LLColor4 &a, const LLColor4 &b) { return LLColor4( - a.mV[VX] * b.mV[VX], - a.mV[VY] * b.mV[VY], - a.mV[VZ] * b.mV[VZ], - a.mV[VW] * b.mV[VW]); + a.mV[VRED] * b.mV[VRED], + a.mV[VGREEN] * b.mV[VGREEN], + a.mV[VBLUE] * b.mV[VBLUE], + a.mV[VALPHA] * b.mV[VALPHA]); } inline LLColor4 operator*(const LLColor4 &a, F32 k) { // only affects rgb (not a!) return LLColor4( - a.mV[VX] * k, - a.mV[VY] * k, - a.mV[VZ] * k, - a.mV[VW]); + a.mV[VRED] * k, + a.mV[VGREEN] * k, + a.mV[VBLUE] * k, + a.mV[VALPHA]); } inline LLColor4 operator/(const LLColor4 &a, F32 k) { return LLColor4( - a.mV[VX] / k, - a.mV[VY] / k, - a.mV[VZ] / k, - a.mV[VW]); + a.mV[VRED] / k, + a.mV[VGREEN] / k, + a.mV[VBLUE] / k, + a.mV[VALPHA]); } inline LLColor4 operator*(F32 k, const LLColor4 &a) { // only affects rgb (not a!) return LLColor4( - a.mV[VX] * k, - a.mV[VY] * k, - a.mV[VZ] * k, - a.mV[VW]); + a.mV[VRED] * k, + a.mV[VGREEN] * k, + a.mV[VBLUE] * k, + a.mV[VALPHA]); } inline LLColor4 operator%(F32 k, const LLColor4 &a) { // only affects alpha (not rgb!) return LLColor4( - a.mV[VX], - a.mV[VY], - a.mV[VZ], - a.mV[VW] * k); + a.mV[VRED], + a.mV[VGREEN], + a.mV[VBLUE], + a.mV[VALPHA] * k); } inline LLColor4 operator%(const LLColor4 &a, F32 k) { // only affects alpha (not rgb!) return LLColor4( - a.mV[VX], - a.mV[VY], - a.mV[VZ], - a.mV[VW] * k); + a.mV[VRED], + a.mV[VGREEN], + a.mV[VBLUE], + a.mV[VALPHA] * k); } inline bool operator==(const LLColor4 &a, const LLColor4 &b) { - return ( (a.mV[VX] == b.mV[VX]) - &&(a.mV[VY] == b.mV[VY]) - &&(a.mV[VZ] == b.mV[VZ]) - &&(a.mV[VW] == b.mV[VW])); + return ( (a.mV[VRED] == b.mV[VRED]) + &&(a.mV[VGREEN] == b.mV[VGREEN]) + &&(a.mV[VBLUE] == b.mV[VBLUE]) + &&(a.mV[VALPHA] == b.mV[VALPHA])); } inline bool operator!=(const LLColor4 &a, const LLColor4 &b) { - return ( (a.mV[VX] != b.mV[VX]) - ||(a.mV[VY] != b.mV[VY]) - ||(a.mV[VZ] != b.mV[VZ]) - ||(a.mV[VW] != b.mV[VW])); + return ( (a.mV[VRED] != b.mV[VRED]) + ||(a.mV[VGREEN] != b.mV[VGREEN]) + ||(a.mV[VBLUE] != b.mV[VBLUE]) + ||(a.mV[VALPHA] != b.mV[VALPHA])); } inline const LLColor4& operator+=(LLColor4 &a, const LLColor4 &b) { - a.mV[VX] += b.mV[VX]; - a.mV[VY] += b.mV[VY]; - a.mV[VZ] += b.mV[VZ]; - a.mV[VW] += b.mV[VW]; + a.mV[VRED] += b.mV[VRED]; + a.mV[VGREEN] += b.mV[VGREEN]; + a.mV[VBLUE] += b.mV[VBLUE]; + a.mV[VALPHA] += b.mV[VALPHA]; return a; } inline const LLColor4& operator-=(LLColor4 &a, const LLColor4 &b) { - a.mV[VX] -= b.mV[VX]; - a.mV[VY] -= b.mV[VY]; - a.mV[VZ] -= b.mV[VZ]; - a.mV[VW] -= b.mV[VW]; + a.mV[VRED] -= b.mV[VRED]; + a.mV[VGREEN] -= b.mV[VGREEN]; + a.mV[VBLUE] -= b.mV[VBLUE]; + a.mV[VALPHA] -= b.mV[VALPHA]; return a; } inline const LLColor4& operator*=(LLColor4 &a, F32 k) { // only affects rgb (not a!) - a.mV[VX] *= k; - a.mV[VY] *= k; - a.mV[VZ] *= k; + a.mV[VRED] *= k; + a.mV[VGREEN] *= k; + a.mV[VBLUE] *= k; return a; } inline const LLColor4& operator *=(LLColor4 &a, const LLColor4 &b) { - a.mV[VX] *= b.mV[VX]; - a.mV[VY] *= b.mV[VY]; - a.mV[VZ] *= b.mV[VZ]; -// a.mV[VW] *= b.mV[VW]; + a.mV[VRED] *= b.mV[VRED]; + a.mV[VGREEN] *= b.mV[VGREEN]; + a.mV[VBLUE] *= b.mV[VBLUE]; +// a.mV[VALPHA] *= b.mV[VALPHA]; return a; } inline const LLColor4& operator%=(LLColor4 &a, F32 k) { // only affects alpha (not rgb!) - a.mV[VW] *= k; + a.mV[VALPHA] *= k; return a; } @@ -614,10 +614,10 @@ inline F32 distVec_squared(const LLColor4 &a, const LLColor4 &b) inline LLColor4 lerp(const LLColor4 &a, const LLColor4 &b, F32 u) { return LLColor4( - a.mV[VX] + (b.mV[VX] - a.mV[VX]) * u, - a.mV[VY] + (b.mV[VY] - a.mV[VY]) * u, - a.mV[VZ] + (b.mV[VZ] - a.mV[VZ]) * u, - a.mV[VW] + (b.mV[VW] - a.mV[VW]) * u); + a.mV[VRED] + (b.mV[VRED] - a.mV[VRED]) * u, + a.mV[VGREEN] + (b.mV[VGREEN] - a.mV[VGREEN]) * u, + a.mV[VBLUE] + (b.mV[VBLUE] - a.mV[VBLUE]) * u, + a.mV[VALPHA] + (b.mV[VALPHA] - a.mV[VALPHA]) * u); } inline bool LLColor4::operator<(const LLColor4& rhs) const diff --git a/indra/llmath/v4coloru.cpp b/indra/llmath/v4coloru.cpp index 92127933b2..acf349245a 100644 --- a/indra/llmath/v4coloru.cpp +++ b/indra/llmath/v4coloru.cpp @@ -53,10 +53,10 @@ LLColor4U::operator LLColor4() /* LLColor4U::LLColor4U(const LLColor3 &vec) { - mV[VX] = vec.mV[VX]; - mV[VY] = vec.mV[VY]; - mV[VZ] = vec.mV[VZ]; - mV[VW] = 255; + mV[VRED] = vec.mV[VRED]; + mV[VGREEN] = vec.mV[VGREEN]; + mV[VBLUE] = vec.mV[VBLUE]; + mV[VALPHA] = 255; } */ @@ -70,12 +70,12 @@ LLColor4U::LLColor4U(const LLColor3 &vec) /* LLColor4U LLColor4U::operator=(const LLColor3 &a) { - mV[VX] = a.mV[VX]; - mV[VY] = a.mV[VY]; - mV[VZ] = a.mV[VZ]; + mV[VRED] = a.mV[VRED]; + mV[VGREEN] = a.mV[VGREEN]; + mV[VBLUE] = a.mV[VBLUE]; // converting from an rgb sets a=1 (opaque) - mV[VW] = 255; + mV[VALPHA] = 255; return (*this); } */ @@ -83,16 +83,16 @@ LLColor4U LLColor4U::operator=(const LLColor3 &a) std::ostream& operator<<(std::ostream& s, const LLColor4U &a) { - s << "{ " << (S32)a.mV[VX] << ", " << (S32)a.mV[VY] << ", " << (S32)a.mV[VZ] << ", " << (S32)a.mV[VW] << " }"; + s << "{ " << (S32)a.mV[VRED] << ", " << (S32)a.mV[VGREEN] << ", " << (S32)a.mV[VBLUE] << ", " << (S32)a.mV[VALPHA] << " }"; return s; } // static -BOOL LLColor4U::parseColor4U(const std::string& buf, LLColor4U* value) +bool LLColor4U::parseColor4U(const std::string& buf, LLColor4U* value) { - if( buf.empty() || value == NULL) + if( buf.empty() || value == nullptr) { - return FALSE; + return false; } U32 v[4]; @@ -104,17 +104,17 @@ BOOL LLColor4U::parseColor4U(const std::string& buf, LLColor4U* value) } if( 4 != count ) { - return FALSE; + return false; } for( S32 i = 0; i < 4; i++ ) { if( v[i] > U8_MAX ) { - return FALSE; + return false; } } value->set( U8(v[0]), U8(v[1]), U8(v[2]), U8(v[3]) ); - return TRUE; + return true; } diff --git a/indra/llmath/v4coloru.h b/indra/llmath/v4coloru.h index ecfecc167f..29128a08a7 100644 --- a/indra/llmath/v4coloru.h +++ b/indra/llmath/v4coloru.h @@ -112,12 +112,11 @@ public: LLColor4U addClampMax(const LLColor4U &color); // Add and clamp the max LLColor4U multAll(const F32 k); // Multiply ALL channels by scalar k - const LLColor4U& combine(); inline void setVecScaleClamp(const LLColor3 &color); inline void setVecScaleClamp(const LLColor4 &color); - static BOOL parseColor4U(const std::string& buf, LLColor4U* value); + static bool parseColor4U(const std::string& buf, LLColor4U* value); // conversion operator LLColor4() const @@ -143,34 +142,34 @@ F32 distVec_squared(const LLColor4U &a, const LLColor4U &b); // Returns d inline LLColor4U::LLColor4U() { - mV[VX] = 0; - mV[VY] = 0; - mV[VZ] = 0; - mV[VW] = 255; + mV[VRED] = 0; + mV[VGREEN] = 0; + mV[VBLUE] = 0; + mV[VALPHA] = 255; } inline LLColor4U::LLColor4U(U8 r, U8 g, U8 b) { - mV[VX] = r; - mV[VY] = g; - mV[VZ] = b; - mV[VW] = 255; + mV[VRED] = r; + mV[VGREEN] = g; + mV[VBLUE] = b; + mV[VALPHA] = 255; } inline LLColor4U::LLColor4U(U8 r, U8 g, U8 b, U8 a) { - mV[VX] = r; - mV[VY] = g; - mV[VZ] = b; - mV[VW] = a; + mV[VRED] = r; + mV[VGREEN] = g; + mV[VBLUE] = b; + mV[VALPHA] = a; } inline LLColor4U::LLColor4U(const U8 *vec) { - mV[VX] = vec[VX]; - mV[VY] = vec[VY]; - mV[VZ] = vec[VZ]; - mV[VW] = vec[VW]; + mV[VRED] = vec[VRED]; + mV[VGREEN] = vec[VGREEN]; + mV[VBLUE] = vec[VBLUE]; + mV[VALPHA] = vec[VALPHA]; } /* @@ -182,30 +181,30 @@ inline LLColor4U::operator LLColor4() inline const LLColor4U& LLColor4U::setToBlack(void) { - mV[VX] = 0; - mV[VY] = 0; - mV[VZ] = 0; - mV[VW] = 255; + mV[VRED] = 0; + mV[VGREEN] = 0; + mV[VBLUE] = 0; + mV[VALPHA] = 255; return (*this); } inline const LLColor4U& LLColor4U::setToWhite(void) { - mV[VX] = 255; - mV[VY] = 255; - mV[VZ] = 255; - mV[VW] = 255; + mV[VRED] = 255; + mV[VGREEN] = 255; + mV[VBLUE] = 255; + mV[VALPHA] = 255; return (*this); } inline const LLColor4U& LLColor4U::set(const U8 x, const U8 y, const U8 z) { - mV[VX] = x; - mV[VY] = y; - mV[VZ] = z; + mV[VRED] = x; + mV[VGREEN] = y; + mV[VBLUE] = z; // no change to alpha! -// mV[VW] = 255; +// mV[VALPHA] = 255; return (*this); } @@ -221,31 +220,31 @@ inline const LLColor4U& LLColor4U::set(const U8 r, const U8 g, const U8 b, U8 a) inline const LLColor4U& LLColor4U::set(const LLColor4U &vec) { - mV[VX] = vec.mV[VX]; - mV[VY] = vec.mV[VY]; - mV[VZ] = vec.mV[VZ]; - mV[VW] = vec.mV[VW]; + mV[VRED] = vec.mV[VRED]; + mV[VGREEN] = vec.mV[VGREEN]; + mV[VBLUE] = vec.mV[VBLUE]; + mV[VALPHA] = vec.mV[VALPHA]; return (*this); } inline const LLColor4U& LLColor4U::set(const U8 *vec) { - mV[VX] = vec[VX]; - mV[VY] = vec[VY]; - mV[VZ] = vec[VZ]; - mV[VW] = vec[VW]; + mV[VRED] = vec[VRED]; + mV[VGREEN] = vec[VGREEN]; + mV[VBLUE] = vec[VBLUE]; + mV[VALPHA] = vec[VALPHA]; return (*this); } // deprecated inline const LLColor4U& LLColor4U::setVec(const U8 x, const U8 y, const U8 z) { - mV[VX] = x; - mV[VY] = y; - mV[VZ] = z; + mV[VRED] = x; + mV[VGREEN] = y; + mV[VBLUE] = z; // no change to alpha! -// mV[VW] = 255; +// mV[VALPHA] = 255; return (*this); } @@ -263,26 +262,26 @@ inline const LLColor4U& LLColor4U::setVec(const U8 r, const U8 g, const U8 b, U8 // deprecated inline const LLColor4U& LLColor4U::setVec(const LLColor4U &vec) { - mV[VX] = vec.mV[VX]; - mV[VY] = vec.mV[VY]; - mV[VZ] = vec.mV[VZ]; - mV[VW] = vec.mV[VW]; + mV[VRED] = vec.mV[VRED]; + mV[VGREEN] = vec.mV[VGREEN]; + mV[VBLUE] = vec.mV[VBLUE]; + mV[VALPHA] = vec.mV[VALPHA]; return (*this); } // deprecated inline const LLColor4U& LLColor4U::setVec(const U8 *vec) { - mV[VX] = vec[VX]; - mV[VY] = vec[VY]; - mV[VZ] = vec[VZ]; - mV[VW] = vec[VW]; + mV[VRED] = vec[VRED]; + mV[VGREEN] = vec[VGREEN]; + mV[VBLUE] = vec[VBLUE]; + mV[VALPHA] = vec[VALPHA]; return (*this); } inline const LLColor4U& LLColor4U::setAlpha(U8 a) { - mV[VW] = a; + mV[VALPHA] = a; return (*this); } @@ -290,159 +289,159 @@ inline const LLColor4U& LLColor4U::setAlpha(U8 a) inline F32 LLColor4U::length(void) const { - return (F32) sqrt( ((F32)mV[VX]) * mV[VX] + ((F32)mV[VY]) * mV[VY] + ((F32)mV[VZ]) * mV[VZ] ); + return (F32) sqrt( ((F32)mV[VRED]) * mV[VRED] + ((F32)mV[VGREEN]) * mV[VGREEN] + ((F32)mV[VBLUE]) * mV[VBLUE] ); } inline F32 LLColor4U::lengthSquared(void) const { - return ((F32)mV[VX]) * mV[VX] + ((F32)mV[VY]) * mV[VY] + ((F32)mV[VZ]) * mV[VZ]; + return ((F32)mV[VRED]) * mV[VRED] + ((F32)mV[VGREEN]) * mV[VGREEN] + ((F32)mV[VBLUE]) * mV[VBLUE]; } // deprecated inline F32 LLColor4U::magVec(void) const { - return (F32) sqrt( ((F32)mV[VX]) * mV[VX] + ((F32)mV[VY]) * mV[VY] + ((F32)mV[VZ]) * mV[VZ] ); + return (F32) sqrt( ((F32)mV[VRED]) * mV[VRED] + ((F32)mV[VGREEN]) * mV[VGREEN] + ((F32)mV[VBLUE]) * mV[VBLUE] ); } // deprecated inline F32 LLColor4U::magVecSquared(void) const { - return ((F32)mV[VX]) * mV[VX] + ((F32)mV[VY]) * mV[VY] + ((F32)mV[VZ]) * mV[VZ]; + return ((F32)mV[VRED]) * mV[VRED] + ((F32)mV[VGREEN]) * mV[VGREEN] + ((F32)mV[VBLUE]) * mV[VBLUE]; } inline LLColor4U operator+(const LLColor4U &a, const LLColor4U &b) { return LLColor4U( - a.mV[VX] + b.mV[VX], - a.mV[VY] + b.mV[VY], - a.mV[VZ] + b.mV[VZ], - a.mV[VW] + b.mV[VW]); + a.mV[VRED] + b.mV[VRED], + a.mV[VGREEN] + b.mV[VGREEN], + a.mV[VBLUE] + b.mV[VBLUE], + a.mV[VALPHA] + b.mV[VALPHA]); } inline LLColor4U operator-(const LLColor4U &a, const LLColor4U &b) { return LLColor4U( - a.mV[VX] - b.mV[VX], - a.mV[VY] - b.mV[VY], - a.mV[VZ] - b.mV[VZ], - a.mV[VW] - b.mV[VW]); + a.mV[VRED] - b.mV[VRED], + a.mV[VGREEN] - b.mV[VGREEN], + a.mV[VBLUE] - b.mV[VBLUE], + a.mV[VALPHA] - b.mV[VALPHA]); } inline LLColor4U operator*(const LLColor4U &a, const LLColor4U &b) { return LLColor4U( - a.mV[VX] * b.mV[VX], - a.mV[VY] * b.mV[VY], - a.mV[VZ] * b.mV[VZ], - a.mV[VW] * b.mV[VW]); + a.mV[VRED] * b.mV[VRED], + a.mV[VGREEN] * b.mV[VGREEN], + a.mV[VBLUE] * b.mV[VBLUE], + a.mV[VALPHA] * b.mV[VALPHA]); } inline LLColor4U LLColor4U::addClampMax(const LLColor4U &color) { - return LLColor4U(llmin((S32)mV[VX] + color.mV[VX], 255), - llmin((S32)mV[VY] + color.mV[VY], 255), - llmin((S32)mV[VZ] + color.mV[VZ], 255), - llmin((S32)mV[VW] + color.mV[VW], 255)); + return LLColor4U(llmin((S32)mV[VRED] + color.mV[VRED], 255), + llmin((S32)mV[VGREEN] + color.mV[VGREEN], 255), + llmin((S32)mV[VBLUE] + color.mV[VBLUE], 255), + llmin((S32)mV[VALPHA] + color.mV[VALPHA], 255)); } inline LLColor4U LLColor4U::multAll(const F32 k) { // Round to nearest return LLColor4U( - (U8)ll_round(mV[VX] * k), - (U8)ll_round(mV[VY] * k), - (U8)ll_round(mV[VZ] * k), - (U8)ll_round(mV[VW] * k)); + (U8)ll_round(mV[VRED] * k), + (U8)ll_round(mV[VGREEN] * k), + (U8)ll_round(mV[VBLUE] * k), + (U8)ll_round(mV[VALPHA] * k)); } /* inline LLColor4U operator*(const LLColor4U &a, U8 k) { // only affects rgb (not a!) return LLColor4U( - a.mV[VX] * k, - a.mV[VY] * k, - a.mV[VZ] * k, - a.mV[VW]); + a.mV[VRED] * k, + a.mV[VGREEN] * k, + a.mV[VBLUE] * k, + a.mV[VALPHA]); } inline LLColor4U operator*(U8 k, const LLColor4U &a) { // only affects rgb (not a!) return LLColor4U( - a.mV[VX] * k, - a.mV[VY] * k, - a.mV[VZ] * k, - a.mV[VW]); + a.mV[VRED] * k, + a.mV[VGREEN] * k, + a.mV[VBLUE] * k, + a.mV[VALPHA]); } inline LLColor4U operator%(U8 k, const LLColor4U &a) { // only affects alpha (not rgb!) return LLColor4U( - a.mV[VX], - a.mV[VY], - a.mV[VZ], - a.mV[VW] * k ); + a.mV[VRED], + a.mV[VGREEN], + a.mV[VBLUE], + a.mV[VALPHA] * k ); } inline LLColor4U operator%(const LLColor4U &a, U8 k) { // only affects alpha (not rgb!) return LLColor4U( - a.mV[VX], - a.mV[VY], - a.mV[VZ], - a.mV[VW] * k ); + a.mV[VRED], + a.mV[VGREEN], + a.mV[VBLUE], + a.mV[VALPHA] * k ); } */ inline bool operator==(const LLColor4U &a, const LLColor4U &b) { - return ( (a.mV[VX] == b.mV[VX]) - &&(a.mV[VY] == b.mV[VY]) - &&(a.mV[VZ] == b.mV[VZ]) - &&(a.mV[VW] == b.mV[VW])); + return ( (a.mV[VRED] == b.mV[VRED]) + &&(a.mV[VGREEN] == b.mV[VGREEN]) + &&(a.mV[VBLUE] == b.mV[VBLUE]) + &&(a.mV[VALPHA] == b.mV[VALPHA])); } inline bool operator!=(const LLColor4U &a, const LLColor4U &b) { - return ( (a.mV[VX] != b.mV[VX]) - ||(a.mV[VY] != b.mV[VY]) - ||(a.mV[VZ] != b.mV[VZ]) - ||(a.mV[VW] != b.mV[VW])); + return ( (a.mV[VRED] != b.mV[VRED]) + ||(a.mV[VGREEN] != b.mV[VGREEN]) + ||(a.mV[VBLUE] != b.mV[VBLUE]) + ||(a.mV[VALPHA] != b.mV[VALPHA])); } inline const LLColor4U& operator+=(LLColor4U &a, const LLColor4U &b) { - a.mV[VX] += b.mV[VX]; - a.mV[VY] += b.mV[VY]; - a.mV[VZ] += b.mV[VZ]; - a.mV[VW] += b.mV[VW]; + a.mV[VRED] += b.mV[VRED]; + a.mV[VGREEN] += b.mV[VGREEN]; + a.mV[VBLUE] += b.mV[VBLUE]; + a.mV[VALPHA] += b.mV[VALPHA]; return a; } inline const LLColor4U& operator-=(LLColor4U &a, const LLColor4U &b) { - a.mV[VX] -= b.mV[VX]; - a.mV[VY] -= b.mV[VY]; - a.mV[VZ] -= b.mV[VZ]; - a.mV[VW] -= b.mV[VW]; + a.mV[VRED] -= b.mV[VRED]; + a.mV[VGREEN] -= b.mV[VGREEN]; + a.mV[VBLUE] -= b.mV[VBLUE]; + a.mV[VALPHA] -= b.mV[VALPHA]; return a; } inline const LLColor4U& operator*=(LLColor4U &a, U8 k) { // only affects rgb (not a!) - a.mV[VX] *= k; - a.mV[VY] *= k; - a.mV[VZ] *= k; + a.mV[VRED] *= k; + a.mV[VGREEN] *= k; + a.mV[VBLUE] *= k; return a; } inline const LLColor4U& operator%=(LLColor4U &a, U8 k) { // only affects alpha (not rgb!) - a.mV[VW] *= k; + a.mV[VALPHA] *= k; return a; } diff --git a/indra/llmath/v4math.cpp b/indra/llmath/v4math.cpp index 8955145527..0aa6eb09c3 100644 --- a/indra/llmath/v4math.cpp +++ b/indra/llmath/v4math.cpp @@ -36,28 +36,6 @@ // LLVector4 // Axis-Angle rotations - -/* -const LLVector4& LLVector4::rotVec(F32 angle, const LLVector4 &vec) -{ - if ( !vec.isExactlyZero() && angle ) - { - *this = *this * LLMatrix4(angle, vec); - } - return *this; -} - -const LLVector4& LLVector4::rotVec(F32 angle, F32 x, F32 y, F32 z) -{ - LLVector3 vec(x, y, z); - if ( !vec.isExactlyZero() && angle ) - { - *this = *this * LLMatrix4(angle, vec); - } - return *this; -} -*/ - const LLVector4& LLVector4::rotVec(const LLMatrix4 &mat) { *this = *this * mat; @@ -81,15 +59,15 @@ const LLVector4& LLVector4::scaleVec(const LLVector4& vec) } // Sets all values to absolute value of their original values -// Returns TRUE if data changed -BOOL LLVector4::abs() +// Returns true if data changed +bool LLVector4::abs() { - BOOL ret = FALSE; + bool ret{ false }; - if (mV[0] < 0.f) { mV[0] = -mV[0]; ret = TRUE; } - if (mV[1] < 0.f) { mV[1] = -mV[1]; ret = TRUE; } - if (mV[2] < 0.f) { mV[2] = -mV[2]; ret = TRUE; } - if (mV[3] < 0.f) { mV[3] = -mV[3]; ret = TRUE; } + if (mV[0] < 0.f) { mV[0] = -mV[0]; ret = true; } + if (mV[1] < 0.f) { mV[1] = -mV[1]; ret = true; } + if (mV[2] < 0.f) { mV[2] = -mV[2]; ret = true; } + if (mV[3] < 0.f) { mV[3] = -mV[3]; ret = true; } return ret; } @@ -117,7 +95,7 @@ F32 angle_between( const LLVector4& a, const LLVector4& b ) return angle; } -BOOL are_parallel(const LLVector4 &a, const LLVector4 &b, F32 epsilon) +bool are_parallel(const LLVector4 &a, const LLVector4 &b, F32 epsilon) { LLVector4 an = a; LLVector4 bn = b; @@ -125,8 +103,8 @@ BOOL are_parallel(const LLVector4 &a, const LLVector4 &b, F32 epsilon) bn.normalize(); F32 dot = an * bn; if ( (1.0f - fabs(dot)) < epsilon) - return TRUE; - return FALSE; + return true; + return false; } diff --git a/indra/llmath/v4math.h b/indra/llmath/v4math.h index 7f0020af6b..7ed22212d3 100644 --- a/indra/llmath/v4math.h +++ b/indra/llmath/v4math.h @@ -74,7 +74,7 @@ class LLVector4 } - inline BOOL isFinite() const; // checks to see if all values of LLVector3 are finite + inline bool isFinite() const; // checks to see if all values of LLVector3 are finite inline void clear(); // Clears LLVector4 to (0, 0, 0, 1) inline void clearVec(); // deprecated @@ -101,14 +101,12 @@ class LLVector4 F32 normVec(); // deprecated // Sets all values to absolute value of their original values - // Returns TRUE if data changed - BOOL abs(); + // Returns true if data changed + bool abs(); - BOOL isExactlyClear() const { return (mV[VW] == 1.0f) && !mV[VX] && !mV[VY] && !mV[VZ]; } - BOOL isExactlyZero() const { return !mV[VW] && !mV[VX] && !mV[VY] && !mV[VZ]; } + bool isExactlyClear() const { return (mV[VW] == 1.0f) && !mV[VX] && !mV[VY] && !mV[VZ]; } + bool isExactlyZero() const { return !mV[VW] && !mV[VX] && !mV[VY] && !mV[VZ]; } - const LLVector4& rotVec(F32 angle, const LLVector4 &vec); // Rotates about vec by angle radians - const LLVector4& rotVec(F32 angle, F32 x, F32 y, F32 z); // Rotates about x,y,z by angle radians const LLVector4& rotVec(const LLMatrix4 &mat); // Rotates by MAT4 mat const LLVector4& rotVec(const LLQuaternion &q); // Rotates by QUAT q @@ -139,7 +137,7 @@ class LLVector4 // Non-member functions F32 angle_between(const LLVector4 &a, const LLVector4 &b); // Returns angle (radians) between a and b -BOOL are_parallel(const LLVector4 &a, const LLVector4 &b, F32 epsilon=F_APPROXIMATELY_ZERO); // Returns TRUE if a and b are very close to parallel +bool are_parallel(const LLVector4 &a, const LLVector4 &b, F32 epsilon = F_APPROXIMATELY_ZERO); // Returns true if a and b are very close to parallel F32 dist_vec(const LLVector4 &a, const LLVector4 &b); // Returns distance between a and b F32 dist_vec_squared(const LLVector4 &a, const LLVector4 &b); // Returns distance squared between a and b LLVector3 vec4to3(const LLVector4 &vec); @@ -226,7 +224,7 @@ inline LLVector4::LLVector4(const LLSD &sd) } -inline BOOL LLVector4::isFinite() const +inline bool LLVector4::isFinite() const { return (llfinite(mV[VX]) && llfinite(mV[VY]) && llfinite(mV[VZ]) && llfinite(mV[VW])); } diff --git a/indra/llmath/xform.cpp b/indra/llmath/xform.cpp index 6edad9664f..39bbb94c9f 100644 --- a/indra/llmath/xform.cpp +++ b/indra/llmath/xform.cpp @@ -52,12 +52,12 @@ LLXform* LLXform::getRoot() const return (LLXform*)root; } -BOOL LLXform::isRoot() const +bool LLXform::isRoot() const { return (!mParent); } -BOOL LLXform::isRootEdit() const +bool LLXform::isRootEdit() const { return (!mParent); } @@ -86,7 +86,7 @@ void LLXformMatrix::update() } } -void LLXformMatrix::updateMatrix(BOOL update_bounds) +void LLXformMatrix::updateMatrix(bool update_bounds) { update(); diff --git a/indra/llmath/xform.h b/indra/llmath/xform.h index 06ca526f4f..7434301670 100644 --- a/indra/llmath/xform.h +++ b/indra/llmath/xform.h @@ -30,12 +30,12 @@ #include "m4math.h" #include "llquaternion.h" -const F32 MAX_OBJECT_Z = 4096.f; // should match REGION_HEIGHT_METERS, Pre-havok4: 768.f -const F32 MIN_OBJECT_Z = -256.f; -const F32 DEFAULT_MAX_PRIM_SCALE = 64.f; -const F32 DEFAULT_MAX_PRIM_SCALE_NO_MESH = 10.f; -const F32 MIN_PRIM_SCALE = 0.01f; -const F32 MAX_PRIM_SCALE = 65536.f; // something very high but not near FLT_MAX +constexpr F32 MAX_OBJECT_Z = 4096.f; // should match REGION_HEIGHT_METERS, Pre-havok4: 768.f +constexpr F32 MIN_OBJECT_Z = -256.f; +constexpr F32 DEFAULT_MAX_PRIM_SCALE = 64.f; +constexpr F32 DEFAULT_MAX_PRIM_SCALE_NO_MESH = 10.f; +constexpr F32 MIN_PRIM_SCALE = 0.01f; +constexpr F32 MAX_PRIM_SCALE = 65536.f; // something very high but not near FLT_MAX class LLXform { @@ -52,7 +52,7 @@ protected: LLXform* mParent; U32 mChanged; - BOOL mScaleChildOffset; + bool mScaleChildOffset; public: typedef enum e_changed_flags @@ -78,7 +78,7 @@ public: mScale. setVec(1,1,1); mWorldPosition.clearVec(); mWorldRotation.loadIdentity(); - mScaleChildOffset = FALSE; + mScaleChildOffset = false; } LLXform(); @@ -86,7 +86,7 @@ public: void getLocalMat4(LLMatrix4 &mat) const { mat.initAll(mScale, mRotation, mPosition); } - inline BOOL setParent(LLXform *parent); + inline bool setParent(LLXform *parent); inline void setPosition(const LLVector3& pos); inline void setPosition(const F32 x, const F32 y, const F32 z); @@ -109,18 +109,18 @@ public: void warn(const char* const msg); void setChanged(const U32 bits) { mChanged |= bits; } - BOOL isChanged() const { return mChanged; } - BOOL isChanged(const U32 bits) const { return mChanged & bits; } + bool isChanged() const { return mChanged; } + bool isChanged(const U32 bits) const { return mChanged & bits; } void clearChanged() { mChanged = 0; } void clearChanged(U32 bits) { mChanged &= ~bits; } - void setScaleChildOffset(BOOL scale) { mScaleChildOffset = scale; } - BOOL getScaleChildOffset() { return mScaleChildOffset; } + void setScaleChildOffset(bool scale) { mScaleChildOffset = scale; } + bool getScaleChildOffset() { return mScaleChildOffset; } LLXform* getParent() const { return mParent; } LLXform* getRoot() const; - virtual BOOL isRoot() const; - virtual BOOL isRootEdit() const; + virtual bool isRoot() const; + virtual bool isRootEdit() const; const LLVector3& getPosition() const { return mPosition; } const LLVector3& getScale() const { return mScale; } @@ -149,7 +149,7 @@ public: } void update(); - void updateMatrix(BOOL update_bounds = TRUE); + void updateMatrix(bool update_bounds = true); void getMinMax(LLVector3& min,LLVector3& max) const; protected: @@ -159,12 +159,12 @@ protected: }; -BOOL LLXform::setParent(LLXform* parent) +bool LLXform::setParent(LLXform* parent) { // Validate and make sure we're not creating a loop if (parent == mParent) { - return TRUE; + return true; } if (parent) { @@ -174,13 +174,13 @@ BOOL LLXform::setParent(LLXform* parent) if (cur_par == this) { //warn("LLXform::setParent Creating loop when setting parent!"); - return FALSE; + return false; } cur_par = cur_par->mParent; } } mParent = parent; - return TRUE; + return true; } void LLXform::setPosition(const LLVector3& pos) diff --git a/indra/llmessage/CMakeLists.txt b/indra/llmessage/CMakeLists.txt index c1e4967b24..56c93ca5af 100644 --- a/indra/llmessage/CMakeLists.txt +++ b/indra/llmessage/CMakeLists.txt @@ -12,7 +12,6 @@ if (LL_TESTS) include(LLAddBuildTest) endif () include(Python) -include(JsonCpp) set(llmessage_SOURCE_FILES llassetstorage.cpp diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp index 734b7a8a63..70a7a34a70 100644 --- a/indra/llmessage/llassetstorage.cpp +++ b/indra/llmessage/llassetstorage.cpp @@ -198,14 +198,14 @@ LLBaseDownloadRequest::LLBaseDownloadRequest(const LLUUID &uuid, const LLAssetTy mDownCallback(), mUserData(NULL), mHost(), - mIsTemp(FALSE), - mIsPriority(FALSE), - mDataSentInFirstPacket(FALSE), - mDataIsInCache(FALSE) + mIsTemp(false), + mIsPriority(false), + mDataSentInFirstPacket(false), + mDataIsInCache(false) { // Need to guarantee that this time is up to date, we may be creating a circuit even though we haven't been // running a message system loop. - mTime = LLMessageSystem::getMessageTimeSeconds(TRUE); + mTime = LLMessageSystem::getMessageTimeSeconds(true); } // virtual @@ -228,8 +228,8 @@ LLAssetRequest::LLAssetRequest(const LLUUID &uuid, const LLAssetType::EType type : LLBaseDownloadRequest(uuid, type), mUpCallback(), mInfoCallback( NULL ), - mIsLocal(FALSE), - mIsUserWaiting(FALSE), + mIsLocal(false), + mIsUserWaiting(false), mTimeout(LL_ASSET_STORAGE_TIMEOUT), mBytesFetched(0) { @@ -344,7 +344,7 @@ void LLAssetStorage::_init(LLMessageSystem *msg, LLXferManager *xfer, const LLHost &upstream_host) { - mShutDown = FALSE; + mShutDown = false; mMessageSys = msg; mXferManager = xfer; @@ -354,9 +354,9 @@ void LLAssetStorage::_init(LLMessageSystem *msg, LLAssetStorage::~LLAssetStorage() { - mShutDown = TRUE; + mShutDown = true; - _cleanupRequests(TRUE, LL_ERR_CIRCUIT_GONE); + _cleanupRequests(true, LL_ERR_CIRCUIT_GONE); if (gMessageSystem) { @@ -378,10 +378,10 @@ void LLAssetStorage::setUpstream(const LLHost &upstream_host) void LLAssetStorage::checkForTimeouts() { - _cleanupRequests(FALSE, LL_ERR_TCP_TIMEOUT); + _cleanupRequests(false, LL_ERR_TCP_TIMEOUT); } -void LLAssetStorage::_cleanupRequests(BOOL all, S32 error) +void LLAssetStorage::_cleanupRequests(bool all, S32 error) { F64Seconds mt_secs = LLMessageSystem::getMessageTimeSeconds(); @@ -436,7 +436,7 @@ void LLAssetStorage::_cleanupRequests(BOOL all, S32 error) } -BOOL LLAssetStorage::hasLocalAsset(const LLUUID &uuid, const LLAssetType::EType type) +bool LLAssetStorage::hasLocalAsset(const LLUUID &uuid, const LLAssetType::EType type) { return LLFileSystem::getExists(uuid, type); } @@ -450,7 +450,7 @@ bool LLAssetStorage::findInCacheAndInvokeCallback(const LLUUID& uuid, LLAssetTyp llassert(callback != NULL); } - BOOL exists = LLFileSystem::getExists(uuid, type); + bool exists = LLFileSystem::getExists(uuid, type); if (exists) { LLFileSystem file(uuid, type); @@ -482,7 +482,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LLAssetStorage::LLGetAssetCallback callback, void *user_data, - BOOL is_priority) + bool is_priority) { LL_DEBUGS("AssetStorage") << "LLAssetStorage::getAssetData() - " << uuid << "," << LLAssetType::lookup(type) << LL_ENDL; @@ -523,7 +523,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, return; } - BOOL exists = LLFileSystem::getExists(uuid, type); + bool exists = LLFileSystem::getExists(uuid, type); LLFileSystem file(uuid, type); U32 size = exists ? file.getSize() : 0; @@ -547,7 +547,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, file.remove(); } - BOOL duplicate = FALSE; + bool duplicate = false; // check to see if there's a pending download of this uuid already for (request_list_t::iterator iter = mPendingDownloads.begin(); @@ -566,7 +566,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, // this is a duplicate request // queue the request, but don't actually ask for it again - duplicate = TRUE; + duplicate = true; } } if (duplicate) @@ -700,7 +700,7 @@ void LLAssetStorage::getEstateAsset( EstateAssetType etype, LLGetAssetCallback callback, void *user_data, - BOOL is_priority) + bool is_priority) { LL_DEBUGS() << "LLAssetStorage::getEstateAsset() - " << asset_id << "," << LLAssetType::lookup(atype) << ", estatetype " << etype << LL_ENDL; @@ -724,7 +724,7 @@ void LLAssetStorage::getEstateAsset( return; } - BOOL exists = LLFileSystem::getExists(asset_id, atype); + bool exists = LLFileSystem::getExists(asset_id, atype); LLFileSystem file(asset_id, atype); U32 size = exists ? file.getSize() : 0; @@ -846,7 +846,7 @@ void LLAssetStorage::getInvItemAsset( LLAssetType::EType atype, LLGetAssetCallback callback, void *user_data, - BOOL is_priority) + bool is_priority) { LL_DEBUGS() << "LLAssetStorage::getInvItemAsset() - " << asset_id << "," << LLAssetType::lookup(atype) << LL_ENDL; @@ -995,12 +995,12 @@ void LLAssetStorage::uploadCompleteCallback( return; } LLAssetRequest *req = (LLAssetRequest *)user_data; - BOOL success = TRUE; + bool success = true; if (result) { LL_WARNS("AssetStorage") << "LLAssetStorage::uploadCompleteCallback " << result << ":" << getErrorString(result) << " trying to upload file to upstream provider" << LL_ENDL; - success = FALSE; + success = false; } // we're done grabbing the file, tell the client @@ -1020,7 +1020,7 @@ void LLAssetStorage::processUploadComplete(LLMessageSystem *msg, void **user_dat LLUUID uuid; S8 asset_type_s8; LLAssetType::EType asset_type; - BOOL success = FALSE; + bool success = false; msg->getUUIDFast(_PREHASH_AssetBlock, _PREHASH_UUID, uuid); msg->getS8Fast(_PREHASH_AssetBlock, _PREHASH_Type, asset_type_s8); @@ -1030,7 +1030,7 @@ void LLAssetStorage::processUploadComplete(LLMessageSystem *msg, void **user_dat this_ptr->_callUploadCallbacks(uuid, asset_type, success, LLExtStat::NONE); } -void LLAssetStorage::_callUploadCallbacks(const LLUUID &uuid, LLAssetType::EType asset_type, BOOL success, LLExtStat ext_status ) +void LLAssetStorage::_callUploadCallbacks(const LLUUID &uuid, LLAssetType::EType asset_type, bool success, LLExtStat ext_status ) { // SJB: We process the callbacks in reverse order, I do not know if this is important, // but I didn't want to mess with it. @@ -1125,7 +1125,7 @@ S32 LLAssetStorage::getNumPending(LLAssetStorage::ERequestType rt) const S32 num_pending = -1; if (requests) { - num_pending = requests->size(); + num_pending = static_cast<S32>(requests->size()); } return num_pending; } @@ -1348,7 +1348,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, S32, LLExtStat), void *user_data, - BOOL is_priority) + bool is_priority) { // check for duplicates here, since we're about to fool the normal duplicate checker for (request_list_t::iterator iter = mPendingDownloads.begin(); @@ -1391,7 +1391,7 @@ void LLAssetStorage::legacyGetDataCallback(const LLUUID &uuid, std::string filename; // Check if the asset is marked toxic, and don't load bad stuff - BOOL toxic = gAssetStorage->isAssetToxic( uuid ); + bool toxic = gAssetStorage->isAssetToxic( uuid ); if ( !status && !toxic ) @@ -1489,9 +1489,9 @@ void LLAssetStorage::reportMetric( const LLUUID& asset_id, const LLAssetType::ET // Check if an asset is in the toxic map. If it is, the entry is updated -BOOL LLAssetStorage::isAssetToxic( const LLUUID& uuid ) +bool LLAssetStorage::isAssetToxic( const LLUUID& uuid ) { - BOOL is_toxic = FALSE; + bool is_toxic = false; if ( !uuid.isNull() ) { @@ -1499,7 +1499,7 @@ BOOL LLAssetStorage::isAssetToxic( const LLUUID& uuid ) if ( iter != mToxicAssetMap.end() ) { // Found toxic asset (*iter).second = LLFrameTimer::getTotalTime() + TOXIC_ASSET_LIFETIME; - is_toxic = TRUE; + is_toxic = true; } } return is_toxic; @@ -1509,7 +1509,7 @@ BOOL LLAssetStorage::isAssetToxic( const LLUUID& uuid ) // Clean the toxic asset list, remove old entries -void LLAssetStorage::flushOldToxicAssets( BOOL force_it ) +void LLAssetStorage::flushOldToxicAssets( bool force_it ) { // Scan and look for old entries U64 now = LLFrameTimer::getTotalTime(); diff --git a/indra/llmessage/llassetstorage.h b/indra/llmessage/llassetstorage.h index 8a22f3f031..88fa572092 100644 --- a/indra/llmessage/llassetstorage.h +++ b/indra/llmessage/llassetstorage.h @@ -122,11 +122,11 @@ public: void *mUserData; LLHost mHost; - BOOL mIsTemp; + bool mIsTemp; F64Seconds mTime; // Message system time - BOOL mIsPriority; - BOOL mDataSentInFirstPacket; - BOOL mDataIsInCache; + bool mIsPriority; + bool mDataSentInFirstPacket; + bool mDataIsInCache; }; class LLAssetRequest : public LLBaseDownloadRequest @@ -143,8 +143,8 @@ public: // void (*mUpCallback)(const LLUUID&, void *, S32, LLExtStat); void (*mInfoCallback)(LLAssetInfo *, void *, S32); - BOOL mIsLocal; - BOOL mIsUserWaiting; // We don't want to try forever if a user is waiting for a result. + bool mIsLocal; + bool mIsUserWaiting; // We don't want to try forever if a user is waiting for a result. F64Seconds mTimeout; // Amount of time before timing out. LLUUID mRequestingAgentID; // Only valid for uploads from an agent F64 mBytesFetched; @@ -209,7 +209,7 @@ public: }; protected: - BOOL mShutDown; + bool mShutDown; LLHost mUpstreamHost; LLMessageSystem *mMessageSys; @@ -232,11 +232,11 @@ public: void setUpstream(const LLHost &upstream_host); - BOOL hasLocalAsset(const LLUUID &uuid, LLAssetType::EType type); + bool hasLocalAsset(const LLUUID &uuid, LLAssetType::EType type); // public interface methods // note that your callback may get called BEFORE the function returns - void getAssetData(const LLUUID uuid, LLAssetType::EType atype, LLGetAssetCallback cb, void *user_data, BOOL is_priority = FALSE); + void getAssetData(const LLUUID uuid, LLAssetType::EType atype, LLGetAssetCallback cb, void *user_data, bool is_priority = false); /* * TransactionID version @@ -259,19 +259,19 @@ public: void getEstateAsset(const LLHost &object_sim, const LLUUID &agent_id, const LLUUID &session_id, const LLUUID &asset_id, LLAssetType::EType atype, EstateAssetType etype, - LLGetAssetCallback callback, void *user_data, BOOL is_priority); + LLGetAssetCallback callback, void *user_data, bool is_priority); void getInvItemAsset(const LLHost &object_sim, const LLUUID &agent_id, const LLUUID &session_id, const LLUUID &owner_id, const LLUUID &task_id, const LLUUID &item_id, const LLUUID &asset_id, LLAssetType::EType atype, - LLGetAssetCallback cb, void *user_data, BOOL is_priority = FALSE); // Get a particular inventory item. + LLGetAssetCallback cb, void *user_data, bool is_priority = false); // Get a particular inventory item. // Check if an asset is in the toxic map. If it is, the entry is updated - BOOL isAssetToxic( const LLUUID& uuid ); + bool isAssetToxic( const LLUUID& uuid ); // Clean the toxic asset list, remove old entries - void flushOldToxicAssets( BOOL force_it ); + void flushOldToxicAssets( bool force_it ); // Add an item to the toxic asset map void markAssetToxic( const LLUUID& uuid ); @@ -352,7 +352,7 @@ public: // deprecated file-based methods // Not overriden - void getAssetData(const LLUUID uuid, LLAssetType::EType type, void (*callback)(const char*, const LLUUID&, void *, S32, LLExtStat), void *user_data, BOOL is_priority = FALSE); + void getAssetData(const LLUUID uuid, LLAssetType::EType type, void (*callback)(const char*, const LLUUID&, void *, S32, LLExtStat), void *user_data, bool is_priority = false); /* * TransactionID version @@ -374,12 +374,12 @@ public: // add extra methods to handle metadata protected: - void _cleanupRequests(BOOL all, S32 error); - void _callUploadCallbacks(const LLUUID &uuid, const LLAssetType::EType asset_type, BOOL success, LLExtStat ext_status); + void _cleanupRequests(bool all, S32 error); + void _callUploadCallbacks(const LLUUID &uuid, const LLAssetType::EType asset_type, bool success, LLExtStat ext_status); virtual void _queueDataRequest(const LLUUID& uuid, LLAssetType::EType type, LLGetAssetCallback callback, - void *user_data, BOOL duplicate, - BOOL is_priority) = 0; + void *user_data, bool duplicate, + bool is_priority) = 0; private: void _init(LLMessageSystem *msg, diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp index a0cd6f93c1..9b4454a847 100644 --- a/indra/llmessage/llavatarnamecache.cpp +++ b/indra/llmessage/llavatarnamecache.cpp @@ -45,6 +45,7 @@ #include "llcorehttputil.h" #include "llexception.h" #include "stringize.h" +#include "workqueue.h" #include <map> #include <set> @@ -179,19 +180,26 @@ void LLAvatarNameCache::requestAvatarNameCache_(std::string url, std::vector<LLU if (LLAvatarNameCache::instanceExists()) { - if (!success) - { // on any sort of failure add dummy records for any agent IDs - // in this request that we do not have cached already - std::vector<LLUUID>::const_iterator it = agentIds.begin(); - for (; it != agentIds.end(); ++it) - { - const LLUUID& agent_id = *it; - LLAvatarNameCache::getInstance()->handleAgentError(agent_id); - } - return; - } + // dispatch handler execution back to mainloop + auto workqueue = LL::WorkQueue::getInstance("mainloop"); - LLAvatarNameCache::getInstance()->handleAvNameCacheSuccess(results, httpResults); + if (workqueue) + { + workqueue->post([=]() + { + if (!success) + { // on any sort of failure add dummy records for any agent IDs + // in this request that we do not have cached already + for (const auto& agent_id : agentIds) + { + LLAvatarNameCache::getInstance()->handleAgentError(agent_id); + } + return; + } + + LLAvatarNameCache::getInstance()->handleAvNameCacheSuccess(results, httpResults); + }); + } } } catch (const LLCoros::Stop&) @@ -240,7 +248,7 @@ void LLAvatarNameCache::handleAvNameCacheSuccess(const LLSD &data, const LLSD &h // Same logic as error response case const LLSD& unresolved_agents = data["bad_ids"]; - S32 num_unresolved = unresolved_agents.size(); + auto num_unresolved = unresolved_agents.size(); if (num_unresolved > 0) { LL_WARNS("AvNameCache") << "LLAvatarNameResponder::result " << num_unresolved << " unresolved ids; " diff --git a/indra/llmessage/llblowfishcipher.h b/indra/llmessage/llblowfishcipher.h index 2343882cee..53dc94cce9 100644 --- a/indra/llmessage/llblowfishcipher.h +++ b/indra/llmessage/llblowfishcipher.h @@ -46,7 +46,7 @@ public: /*virtual*/ U32 requiredEncryptionSpace(U32 src_len) const; #ifdef _DEBUG - static BOOL testHarness(); + static bool testHarness(); #endif private: diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index d5b967a8e9..63ac46722a 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -99,7 +99,7 @@ public: } void done() { mID.setNull(); } - bool isDone() const { return mID.isNull() != FALSE; } + bool isDone() const { return mID.isNull(); } }; class ReplySender @@ -215,7 +215,7 @@ public: Impl(LLMessageSystem* msg); ~Impl(); - BOOL getName(const LLUUID& id, std::string& first, std::string& last); + bool getName(const LLUUID& id, std::string& first, std::string& last); boost::signals2::connection addPending(const LLUUID& id, const LLCacheNameCallback& callback); void addPending(const LLUUID& id, const LLHost& host); @@ -402,13 +402,13 @@ void LLCacheName::exportFile(std::ostream& ostr) } -BOOL LLCacheName::Impl::getName(const LLUUID& id, std::string& first, std::string& last) +bool LLCacheName::Impl::getName(const LLUUID& id, std::string& first, std::string& last) { if(id.isNull()) { first = sCacheName["nobody"]; last.clear(); - return TRUE; + return true; } LLCacheNameEntry* entry = get_ptr_in_map(mCache, id ); @@ -416,7 +416,7 @@ BOOL LLCacheName::Impl::getName(const LLUUID& id, std::string& first, std::strin { first = entry->mFirstName; last = entry->mLastName; - return TRUE; + return true; } else { @@ -426,7 +426,7 @@ BOOL LLCacheName::Impl::getName(const LLUUID& id, std::string& first, std::strin { mAskNameQueue.insert(id); } - return FALSE; + return false; } } @@ -440,22 +440,22 @@ void LLCacheName::localizeCacheName(std::string key, std::string value) LL_WARNS()<< " Error localizing cache key " << key << " To "<< value<<LL_ENDL; } -BOOL LLCacheName::getFullName(const LLUUID& id, std::string& fullname) +bool LLCacheName::getFullName(const LLUUID& id, std::string& fullname) { std::string first_name, last_name; - BOOL res = impl.getName(id, first_name, last_name); + bool res = impl.getName(id, first_name, last_name); fullname = buildFullName(first_name, last_name); return res; } -BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group) +bool LLCacheName::getGroupName(const LLUUID& id, std::string& group) { if(id.isNull()) { group = sCacheName["none"]; - return TRUE; + return true; } LLCacheNameEntry* entry = get_ptr_in_map(impl.mCache,id); @@ -471,7 +471,7 @@ BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group) if (entry) { group = entry->mGroupName; - return TRUE; + return true; } else { @@ -480,27 +480,27 @@ BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group) { impl.mAskGroupQueue.insert(id); } - return FALSE; + return false; } } -BOOL LLCacheName::getUUID(const std::string& first, const std::string& last, LLUUID& id) +bool LLCacheName::getUUID(const std::string& first, const std::string& last, LLUUID& id) { std::string full_name = buildFullName(first, last); return getUUID(full_name, id); } -BOOL LLCacheName::getUUID(const std::string& full_name, LLUUID& id) +bool LLCacheName::getUUID(const std::string& full_name, LLUUID& id) { ReverseCache::iterator iter = impl.mReverseCache.find(full_name); if (iter != impl.mReverseCache.end()) { id = iter->second; - return TRUE; + return true; } else { - return FALSE; + return false; } } @@ -562,13 +562,13 @@ std::string LLCacheName::buildLegacyName(const std::string& complete_name) { //boost::regexp was showing up in the crashreporter, so doing //painfully manual parsing using substr. LF - S32 open_paren = complete_name.rfind(" ("); - S32 close_paren = complete_name.rfind(')'); + auto open_paren = complete_name.rfind(" ("); + auto close_paren = complete_name.rfind(')'); if (open_paren != std::string::npos && close_paren == complete_name.length()-1) { - S32 length = close_paren - open_paren - 2; + auto length = close_paren - open_paren - 2; std::string legacy_name = complete_name.substr(open_paren+2, length); if (legacy_name.length() > 0) @@ -577,7 +577,7 @@ std::string LLCacheName::buildLegacyName(const std::string& complete_name) LLStringUtil::toUpper(cap_letter); legacy_name = cap_letter + legacy_name.substr(1); - S32 separator = legacy_name.find('.'); + auto separator = legacy_name.find('.'); if (separator != std::string::npos) { diff --git a/indra/llmessage/llcachename.h b/indra/llmessage/llcachename.h index 401f52a579..1df713c7c7 100644 --- a/indra/llmessage/llcachename.h +++ b/indra/llmessage/llcachename.h @@ -70,12 +70,12 @@ public: // If available, copies name ("bobsmith123" or "James Linden") into string // If not available, copies the string "waiting". - // Returns TRUE iff available. - BOOL getFullName(const LLUUID& id, std::string& full_name); + // Returns true if available. + bool getFullName(const LLUUID& id, std::string& full_name); // Reverse lookup of UUID from name - BOOL getUUID(const std::string& first, const std::string& last, LLUUID& id); - BOOL getUUID(const std::string& fullname, LLUUID& id); + bool getUUID(const std::string& first, const std::string& last, LLUUID& id); + bool getUUID(const std::string& fullname, LLUUID& id); // IDEVO Temporary code // Clean up new-style "bobsmith123 Resident" names to "bobsmith123" for display @@ -99,8 +99,8 @@ public: // If available, this method copies the group name into the string // provided. The caller must allocate at least // DB_GROUP_NAME_BUF_SIZE characters. If not available, this - // method copies the string "waiting". Returns TRUE iff available. - BOOL getGroupName(const LLUUID& id, std::string& group); + // method copies the string "waiting". Returns true if available. + bool getGroupName(const LLUUID& id, std::string& group); // Call the callback with the group or avatar name. // If the data is currently available, may call the callback immediatly diff --git a/indra/llmessage/llcipher.h b/indra/llmessage/llcipher.h index 4bbc6466a9..bbd7eae1d5 100644 --- a/indra/llmessage/llcipher.h +++ b/indra/llmessage/llcipher.h @@ -38,7 +38,7 @@ class LLCipher public: virtual ~LLCipher() {} - // encrypt src and place result into dst. returns TRUE if + // encrypt src and place result into dst. returns true if // Returns number of bytes written into dst, or 0 on error. virtual U32 encrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len) = 0; diff --git a/indra/llmessage/llcircuit.cpp b/indra/llmessage/llcircuit.cpp index d6125fd321..bf22f3d3f0 100644 --- a/indra/llmessage/llcircuit.cpp +++ b/indra/llmessage/llcircuit.cpp @@ -73,10 +73,10 @@ LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id, mHighestPacketID(in_id), mTimeoutCallback(NULL), mTimeoutUserData(NULL), - mTrusted(FALSE), - mbAllowTimeout(TRUE), - mbAlive(TRUE), - mBlocked(FALSE), + mTrusted(false), + mbAllowTimeout(true), + mbAlive(true), + mBlocked(false), mPingTime(0.0), mLastPingSendTime(0.0), mLastPingReceivedTime(0.0), @@ -111,7 +111,7 @@ LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id, { // Need to guarantee that this time is up to date, we may be creating a circuit even though we haven't been // running a message system loop. - F64Seconds mt_sec = LLMessageSystem::getMessageTimeSeconds(TRUE); + F64Seconds mt_sec = LLMessageSystem::getMessageTimeSeconds(true); F32 distribution_offset = ll_frand(); mPingTime = mt_sec; @@ -282,7 +282,7 @@ S32 LLCircuitData::resendUnackedPackets(const F64Seconds now) // reliable_iter iter; - BOOL have_resend_overflow = FALSE; + bool have_resend_overflow = false; for (iter = mUnackedPackets.begin(); iter != mUnackedPackets.end();) { packetp = iter->second; @@ -488,7 +488,7 @@ void LLCircuit::removeCircuitData(const LLHost &host) mLastCircuit = NULL; } -void LLCircuitData::setAlive(BOOL b_alive) +void LLCircuitData::setAlive(bool b_alive) { if (mbAlive != b_alive) { @@ -500,12 +500,12 @@ void LLCircuitData::setAlive(BOOL b_alive) { mLastPingReceivedTime = LLMessageSystem::getMessageTimeSeconds(); mPingsInTransit = 0; - mBlocked = FALSE; + mBlocked = false; } } -void LLCircuitData::setAllowTimeout(BOOL allow) +void LLCircuitData::setAllowTimeout(bool allow) { mbAllowTimeout = allow; @@ -513,7 +513,7 @@ void LLCircuitData::setAllowTimeout(BOOL allow) { // resuming circuit // make sure it's alive - setAlive(TRUE); + setAlive(true); } } @@ -599,7 +599,7 @@ void LLCircuit::resendUnackedPackets(S32& unacked_list_length, S32& unacked_list } -BOOL LLCircuitData::isDuplicateResend(TPACKETID packetnum) +bool LLCircuitData::isDuplicateResend(TPACKETID packetnum) { return (mRecentlyReceivedReliablePackets.find(packetnum) != mRecentlyReceivedReliablePackets.end()); } @@ -632,7 +632,7 @@ LLCircuitData* LLCircuit::findCircuit(const LLHost& host) const } -BOOL LLCircuit::isCircuitAlive(const LLHost& host) const +bool LLCircuit::isCircuitAlive(const LLHost& host) const { LLCircuitData *cdp = findCircuit(host); if(cdp) @@ -640,7 +640,7 @@ BOOL LLCircuit::isCircuitAlive(const LLHost& host) const return cdp->mbAlive; } - return FALSE; + return false; } void LLCircuitData::setTimeoutCallback(void (*callback_func)(const LLHost &host, void *user_data), void *user_data) @@ -649,7 +649,7 @@ void LLCircuitData::setTimeoutCallback(void (*callback_func)(const LLHost &host, mTimeoutUserData = user_data; } -void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent) +void LLCircuitData::checkPacketInID(TPACKETID id, bool receive_resent) { // Done as floats so we don't have to worry about running out of room // with U32 getting poked into an S32. @@ -781,8 +781,8 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent) void LLCircuit::updateWatchDogTimers(LLMessageSystem *msgsys) { F64Seconds cur_time = LLMessageSystem::getMessageTimeSeconds(); - S32 count = mPingSet.size(); - S32 cur = 0; + size_t count = mPingSet.size(); + size_t cur = 0; // Only process each circuit once at most, stop processing if no circuits while((cur < count) && !mPingSet.empty()) @@ -844,7 +844,7 @@ void LLCircuit::updateWatchDogTimers(LLMessageSystem *msgsys) } -BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys) +bool LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys) { F64Seconds cur_time = LLMessageSystem::getMessageTimeSeconds(); mLastPingSendTime = cur_time; @@ -852,7 +852,7 @@ BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys) if (!checkCircuitTimeout()) { // Pass this back to the calling LLCircuit, this circuit needs to be cleaned up. - return FALSE; + return false; } // WARNING! @@ -866,7 +866,7 @@ BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys) // This is to handle the case if we actually manage to wrap our // packet IDs - the oldest will actually have a higher packet ID // than the current. - BOOL wrapped = FALSE; + bool wrapped = false; reliable_iter iter; iter = mUnackedPackets.upper_bound(getPacketOutID()); if (iter == mUnackedPackets.end()) @@ -874,19 +874,19 @@ BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys) // Nothing AFTER this one, so we want the lowest packet ID // then. iter = mUnackedPackets.begin(); - wrapped = TRUE; + wrapped = true; } TPACKETID packet_id = 0; // Check against the "final" packets - BOOL wrapped_final = FALSE; + bool wrapped_final = false; reliable_iter iter_final; iter_final = mFinalRetryPackets.upper_bound(getPacketOutID()); if (iter_final == mFinalRetryPackets.end()) { iter_final = mFinalRetryPackets.begin(); - wrapped_final = TRUE; + wrapped_final = true; } //LL_INFOS() << mHost << " - unacked count " << mUnackedPackets.size() << LL_ENDL; @@ -922,12 +922,12 @@ BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys) } else { - BOOL had_unacked = FALSE; + bool had_unacked = false; if (iter != mUnackedPackets.end()) { // Unacked list has the lowest so far packet_id = iter->first; - had_unacked = TRUE; + had_unacked = true; //LL_INFOS() << mHost << ": Unacked" << LL_ENDL; } @@ -989,7 +989,7 @@ BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys) } } - return TRUE; + return true; } @@ -1041,7 +1041,7 @@ void LLCircuitData::clearDuplicateList(TPACKETID oldest_id) //LL_INFOS() << "Recent list after: " << mRecentlyReceivedReliablePackets.size() << LL_ENDL; } -BOOL LLCircuitData::checkCircuitTimeout() +bool LLCircuitData::checkCircuitTimeout() { F64Seconds time_since_last_ping = LLMessageSystem::getMessageTimeSeconds() - mLastPingReceivedTime; @@ -1049,7 +1049,7 @@ BOOL LLCircuitData::checkCircuitTimeout() if (time_since_last_ping > mHeartbeatTimeout) { LL_WARNS() << "LLCircuitData::checkCircuitTimeout for " << mHost << " last ping " << time_since_last_ping << " seconds ago." <<LL_ENDL; - setAlive(FALSE); + setAlive(false); if (mTimeoutCallback) { LL_WARNS() << "LLCircuitData::checkCircuitTimeout for " << mHost << " calling callback." << LL_ENDL; @@ -1059,16 +1059,16 @@ BOOL LLCircuitData::checkCircuitTimeout() { // The callback didn't try and resurrect the circuit. We should kill it. LL_WARNS() << "LLCircuitData::checkCircuitTimeout for " << mHost << " still dead, dropping." << LL_ENDL; - return FALSE; + return false; } } - return TRUE; + return true; } // Call this method when a reliable message comes in - this will // correctly place the packet in the correct list to be acked later. -BOOL LLCircuitData::collectRAck(TPACKETID packet_num) +bool LLCircuitData::collectRAck(TPACKETID packet_num) { if (mAcks.empty()) { @@ -1081,7 +1081,7 @@ BOOL LLCircuitData::collectRAck(TPACKETID packet_num) { mAckCreationTime = getAgeInSeconds(); } - return TRUE; + return true; } // this method is called during the message system processAcks() to @@ -1273,7 +1273,7 @@ void LLCircuitData::pingTimerStop(const U8 ping_id) { // Ack, we got our ping response on the same frame! Sigh, let's get a real time otherwise // all of our ping calculations will be skewed. - mt_secs = LLMessageSystem::getMessageTimeSeconds(TRUE); + mt_secs = LLMessageSystem::getMessageTimeSeconds(true); } mLastPingReceivedTime = mt_secs; @@ -1291,7 +1291,7 @@ void LLCircuitData::pingTimerStop(const U8 ping_id) mPingsInTransit = delta_ping; if (mBlocked && (mPingsInTransit <= PING_RELEASE_BLOCK)) { - mBlocked = FALSE; + mBlocked = false; } } @@ -1303,7 +1303,7 @@ void LLCircuitData::pingTimerStart() if (!mBlocked && (mPingsInTransit > PING_START_BLOCK)) { - mBlocked = TRUE; + mBlocked = true; } } @@ -1344,19 +1344,19 @@ U32 LLCircuitData::getPacketsLost() const } -BOOL LLCircuitData::isAlive() const +bool LLCircuitData::isAlive() const { return mbAlive; } -BOOL LLCircuitData::isBlocked() const +bool LLCircuitData::isBlocked() const { return mBlocked; } -BOOL LLCircuitData::getAllowTimeout() const +bool LLCircuitData::getAllowTimeout() const { return mbAllowTimeout; } @@ -1402,13 +1402,13 @@ F32Milliseconds LLCircuitData::getPingDelayAveraged() } -BOOL LLCircuitData::getTrusted() const +bool LLCircuitData::getTrusted() const { return mTrusted; } -void LLCircuitData::setTrusted(BOOL t) +void LLCircuitData::setTrusted(bool t) { mTrusted = t; } diff --git a/indra/llmessage/llcircuit.h b/indra/llmessage/llcircuit.h index 7a5a5c65f5..521982d7b1 100644 --- a/indra/llmessage/llcircuit.h +++ b/indra/llmessage/llcircuit.h @@ -100,7 +100,7 @@ public: void setRemoteID(const LLUUID& id) { mRemoteID = id; } void setRemoteSessionID(const LLUUID& id) { mRemoteSessionID = id; } - void setTrusted(BOOL t); + void setTrusted(bool t); // The local end point ID is used when establishing a trusted circuit. // no matching set function for getLocalEndPointID() @@ -111,9 +111,9 @@ public: S32 getPingsInTransit() const { return mPingsInTransit; } // ACCESSORS - BOOL isAlive() const; - BOOL isBlocked() const; - BOOL getAllowTimeout() const; + bool isAlive() const; + bool isBlocked() const; + bool getAllowTimeout() const; F32Milliseconds getPingDelayAveraged(); F32Milliseconds getPingInTransitTime(); U32 getPacketsIn() const; @@ -122,7 +122,7 @@ public: U32 getPacketsOut() const; U32 getPacketsLost() const; TPACKETID getPacketOutID() const; - BOOL getTrusted() const; + bool getTrusted() const; F32 getAgeInSeconds() const; S32 getUnackedPacketCount() const { return mUnackedPacketCount; } S32 getUnackedPacketBytes() const { return mUnackedPacketBytes; } @@ -164,31 +164,31 @@ public: protected: TPACKETID nextPacketOutID(); void setPacketInID(TPACKETID id); - void checkPacketInID(TPACKETID id, BOOL receive_resent); + void checkPacketInID(TPACKETID id, bool receive_resent); void setPingDelay(U32Milliseconds ping); - BOOL checkCircuitTimeout(); // Return FALSE if the circuit is dead and should be cleaned up + bool checkCircuitTimeout(); // Return false if the circuit is dead and should be cleaned up void addBytesIn(S32Bytes bytes); void addBytesOut(S32Bytes bytes); U8 nextPingID() { mLastPingID++; return mLastPingID; } - BOOL updateWatchDogTimers(LLMessageSystem *msgsys); // Return FALSE if the circuit is dead and should be cleaned up + bool updateWatchDogTimers(LLMessageSystem *msgsys); // Return false if the circuit is dead and should be cleaned up void addReliablePacket(S32 mSocket, U8 *buf_ptr, S32 buf_len, LLReliablePacketParams *params); - BOOL isDuplicateResend(TPACKETID packetnum); + bool isDuplicateResend(TPACKETID packetnum); // Call this method when a reliable message comes in - this will // correctly place the packet in the correct list to be acked // later. RAack = requested ack - BOOL collectRAck(TPACKETID packet_num); + bool collectRAck(TPACKETID packet_num); void setTimeoutCallback(void (*callback_func)(const LLHost &host, void *user_data), void *user_data); - void setAlive(BOOL b_alive); - void setAllowTimeout(BOOL allow); + void setAlive(bool b_alive); + void setAllowTimeout(bool allow); protected: // Identification for this circuit. @@ -212,12 +212,12 @@ protected: void (*mTimeoutCallback)(const LLHost &host, void *user_data); void *mTimeoutUserData; - BOOL mTrusted; // Is this circuit trusted? - BOOL mbAllowTimeout; // Machines can "pause" circuits, forcing them not to be dropped + bool mTrusted; // Is this circuit trusted? + bool mbAllowTimeout; // Machines can "pause" circuits, forcing them not to be dropped - BOOL mbAlive; // Indicates whether a circuit is "alive", i.e. responded to pings + bool mbAlive; // Indicates whether a circuit is "alive", i.e. responded to pings - BOOL mBlocked; // Blocked is true if the circuit is hosed, i.e. far behind on pings + bool mBlocked; // Blocked is true if the circuit is hosed, i.e. far behind on pings // Not sure what the difference between this and mLastPingSendTime is F64Seconds mPingTime; // Time at which a ping was sent. @@ -293,7 +293,7 @@ public: // ACCESSORS LLCircuitData* findCircuit(const LLHost& host) const; - BOOL isCircuitAlive(const LLHost& host) const; + bool isCircuitAlive(const LLHost& host) const; // MANIPULATORS LLCircuitData *addCircuitData(const LLHost &host, TPACKETID in_id); diff --git a/indra/llmessage/llclassifiedflags.cpp b/indra/llmessage/llclassifiedflags.cpp index 748b6f2355..0df249d035 100644 --- a/indra/llmessage/llclassifiedflags.cpp +++ b/indra/llmessage/llclassifiedflags.cpp @@ -36,7 +36,7 @@ #include "llclassifiedflags.h" -ClassifiedFlags pack_classified_flags_request(BOOL auto_renew, BOOL inc_pg, BOOL inc_mature, BOOL inc_adult) +ClassifiedFlags pack_classified_flags_request(bool auto_renew, bool inc_pg, bool inc_mature, bool inc_adult) { U8 rv = 0; if(inc_pg) rv |= CLASSIFIED_QUERY_INC_PG; @@ -47,7 +47,7 @@ ClassifiedFlags pack_classified_flags_request(BOOL auto_renew, BOOL inc_pg, BOOL return rv; } -ClassifiedFlags pack_classified_flags(BOOL auto_renew, BOOL inc_pg, BOOL inc_mature, BOOL inc_adult) +ClassifiedFlags pack_classified_flags(bool auto_renew, bool inc_pg, bool inc_mature, bool inc_adult) { U8 rv = 0; if(inc_pg) rv |= CLASSIFIED_QUERY_INC_PG; diff --git a/indra/llmessage/llclassifiedflags.h b/indra/llmessage/llclassifiedflags.h index 9c6c268b39..ee29e4ed13 100644 --- a/indra/llmessage/llclassifiedflags.h +++ b/indra/llmessage/llclassifiedflags.h @@ -51,9 +51,9 @@ const S32 MAX_CLASSIFIEDS = 100; // This function is used in AO viewers to pack old query flags into the request // so that they can talk to old dataservers properly. When the AO servers are deployed on agni // we can revert back to ClassifiedFlags pack_classified_flags and get rider of this one. -ClassifiedFlags pack_classified_flags_request(BOOL auto_renew, BOOL is_pg, BOOL is_mature, BOOL is_adult); +ClassifiedFlags pack_classified_flags_request(bool auto_renew, bool is_pg, bool is_mature, bool is_adult); -ClassifiedFlags pack_classified_flags(BOOL auto_renew, BOOL is_pg, BOOL is_mature, BOOL is_adult); +ClassifiedFlags pack_classified_flags(bool auto_renew, bool is_pg, bool is_mature, bool is_adult); bool is_cf_mature(ClassifiedFlags flags); //bool is_cf_enabled(ClassifiedFlags flags); bool is_cf_update_time(ClassifiedFlags flags); diff --git a/indra/llmessage/llcoproceduremanager.cpp b/indra/llmessage/llcoproceduremanager.cpp index 959cfb2762..263670bdac 100644 --- a/indra/llmessage/llcoproceduremanager.cpp +++ b/indra/llmessage/llcoproceduremanager.cpp @@ -87,7 +87,7 @@ public: /// inline S32 count() const { - return countPending() + countActive(); + return static_cast<S32>(countPending() + countActive()); } void close(); diff --git a/indra/llmessage/llcorehttputil.cpp b/indra/llmessage/llcorehttputil.cpp index dcc0b59d07..684e96883f 100644 --- a/indra/llmessage/llcorehttputil.cpp +++ b/indra/llmessage/llcorehttputil.cpp @@ -35,8 +35,7 @@ #include "llsd.h" #include "llsdjson.h" #include "llsdserialize.h" -#include "json/reader.h" // JSON -#include "json/writer.h" // JSON +#include "boost/json.hpp" // Boost.Json #include "llfilesystem.h" #include "message.h" // for getting the port @@ -585,15 +584,12 @@ LLSD HttpCoroJSONHandler::handleSuccess(LLCore::HttpResponse * response, LLCore: } LLCore::BufferArrayStream bas(body); - Json::Value jsonRoot; - try - { - bas >> jsonRoot; - } - catch (std::runtime_error& e) + boost::json::error_code ec; + boost::json::value jsonRoot = boost::json::parse(bas, ec); + if(ec.failed()) { // deserialization failed. Record the reason and pass back an empty map for markup. - status = LLCore::HttpStatus(499, std::string(e.what())); + status = LLCore::HttpStatus(499, std::string(ec.what())); return result; } @@ -613,13 +609,10 @@ LLSD HttpCoroJSONHandler::parseBody(LLCore::HttpResponse *response, bool &succes } LLCore::BufferArrayStream bas(body); - Json::Value jsonRoot; - try - { - bas >> jsonRoot; - } - catch (std::runtime_error&) + boost::json::error_code ec; + boost::json::value jsonRoot = boost::json::parse(bas, ec); + if (ec.failed()) { success = false; return LLSD(); @@ -802,12 +795,12 @@ LLSD HttpCoroutineAdapter::postJsonAndSuspend(LLCore::HttpRequest::ptr_t request { LLCore::BufferArrayStream outs(rawbody.get()); - Json::Value root = LlsdToJson(body); - Json::FastWriter writer; + auto root = LlsdToJson(body); + std::string value = boost::json::serialize(root); - LL_WARNS("Http::post") << "JSON Generates: \"" << writer.write(root) << "\"" << LL_ENDL; + LL_WARNS("Http::post") << "JSON Generates: \"" << value << "\"" << LL_ENDL; - outs << writer.write(root); + outs << value; } return postAndSuspend_(request, url, rawbody, options, headers, httpHandler); @@ -861,11 +854,11 @@ LLSD HttpCoroutineAdapter::putJsonAndSuspend(LLCore::HttpRequest::ptr_t request, { LLCore::BufferArrayStream outs(rawbody.get()); - Json::Value root = LlsdToJson(body); - Json::FastWriter writer; + auto root = LlsdToJson(body); + std::string value = boost::json::serialize(root); - LL_WARNS("Http::put") << "JSON Generates: \"" << writer.write(root) << "\"" << LL_ENDL; - outs << writer.write(root); + LL_WARNS("Http::put") << "JSON Generates: \"" << value << "\"" << LL_ENDL; + outs << value; } return putAndSuspend_(request, url, rawbody, options, headers, httpHandler); diff --git a/indra/llmessage/lldatapacker.cpp b/indra/llmessage/lldatapacker.cpp index 71862b9aa4..e911150787 100644 --- a/indra/llmessage/lldatapacker.cpp +++ b/indra/llmessage/lldatapacker.cpp @@ -45,7 +45,7 @@ const S32 DP_BUFSIZE = 512; static char DUMMY_BUFFER[128]; /*Flawfinder: ignore*/ -LLDataPacker::LLDataPacker() : mPassFlags(0), mWriteEnabled(FALSE) +LLDataPacker::LLDataPacker() : mPassFlags(0), mWriteEnabled(false) { } @@ -61,10 +61,10 @@ void LLDataPacker::dumpBufferToLog() LL_ERRS() << "dumpBufferToLog not implemented for this type!" << LL_ENDL; } -BOOL LLDataPacker::packFixed(const F32 value, const char *name, - const BOOL is_signed, const U32 int_bits, const U32 frac_bits) +bool LLDataPacker::packFixed(const F32 value, const char *name, + const bool is_signed, const U32 int_bits, const U32 frac_bits) { - BOOL success = TRUE; + bool success = true; S32 unsigned_bits = int_bits + frac_bits; S32 total_bits = unsigned_bits; @@ -113,10 +113,10 @@ BOOL LLDataPacker::packFixed(const F32 value, const char *name, return success; } -BOOL LLDataPacker::unpackFixed(F32 &value, const char *name, - const BOOL is_signed, const U32 int_bits, const U32 frac_bits) +bool LLDataPacker::unpackFixed(F32 &value, const char *name, + const bool is_signed, const U32 int_bits, const U32 frac_bits) { - BOOL success = TRUE; + bool success = true; //LL_INFOS() << "unpackFixed:" << name << " int:" << int_bits << " frac:" << frac_bits << LL_ENDL; S32 unsigned_bits = int_bits + frac_bits; S32 total_bits = unsigned_bits; @@ -166,82 +166,82 @@ BOOL LLDataPacker::unpackFixed(F32 &value, const char *name, return success; } -BOOL LLDataPacker::unpackU16s(U16 *values, S32 count, const char *name) +bool LLDataPacker::unpackU16s(U16 *values, S32 count, const char *name) { for (S32 idx = 0; idx < count; ++idx) { if (!unpackU16(values[idx], name)) { LL_WARNS("DATAPACKER") << "Buffer overflow reading Unsigned 16s \"" << name << "\" at index " << idx << "!" << LL_ENDL; - return FALSE; + return false; } } - return TRUE; + return true; } -BOOL LLDataPacker::unpackS16s(S16 *values, S32 count, const char *name) +bool LLDataPacker::unpackS16s(S16 *values, S32 count, const char *name) { for (S32 idx = 0; idx < count; ++idx) { if (!unpackS16(values[idx], name)) { LL_WARNS("DATAPACKER") << "Buffer overflow reading Signed 16s \"" << name << "\" at index " << idx << "!" << LL_ENDL; - return FALSE; + return false; } } - return TRUE; + return true; } -BOOL LLDataPacker::unpackF32s(F32 *values, S32 count, const char *name) +bool LLDataPacker::unpackF32s(F32 *values, S32 count, const char *name) { for (S32 idx = 0; idx < count; ++idx) { if (!unpackF32(values[idx], name)) { LL_WARNS("DATAPACKER") << "Buffer overflow reading Float 32s \"" << name << "\" at index " << idx << "!" << LL_ENDL; - return FALSE; + return false; } } - return TRUE; + return true; } -BOOL LLDataPacker::unpackColor4Us(LLColor4U *values, S32 count, const char *name) +bool LLDataPacker::unpackColor4Us(LLColor4U *values, S32 count, const char *name) { for (S32 idx = 0; idx < count; ++idx) { if (!unpackColor4U(values[idx], name)) { LL_WARNS("DATAPACKER") << "Buffer overflow reading Float 32s \"" << name << "\" at index " << idx << "!" << LL_ENDL; - return FALSE; + return false; } } - return TRUE; + return true; } -BOOL LLDataPacker::unpackUUIDs(LLUUID *values, S32 count, const char *name) +bool LLDataPacker::unpackUUIDs(LLUUID *values, S32 count, const char *name) { for (S32 idx = 0; idx < count; ++idx) { if (!unpackUUID(values[idx], name)) { LL_WARNS("DATAPACKER") << "Buffer overflow reading UUIDs \"" << name << "\" at index " << idx << "!" << LL_ENDL; - return FALSE; + return false; } } - return TRUE; + return true; } //--------------------------------------------------------------------------- // LLDataPackerBinaryBuffer implementation //--------------------------------------------------------------------------- -BOOL LLDataPackerBinaryBuffer::packString(const std::string& value, const char *name) +bool LLDataPackerBinaryBuffer::packString(const std::string& value, const char *name) { - S32 length = value.length()+1; + S32 length = static_cast<S32>(value.length()) + 1; if (!verifyLength(length, name)) { - return FALSE; + return false; } if (mWriteEnabled) @@ -249,30 +249,30 @@ BOOL LLDataPackerBinaryBuffer::packString(const std::string& value, const char * htolememcpy(mCurBufferp, value.c_str(), MVT_VARIABLE, length); } mCurBufferp += length; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::unpackString(std::string& value, const char *name) +bool LLDataPackerBinaryBuffer::unpackString(std::string& value, const char *name) { S32 length = (S32)strlen((char *)mCurBufferp) + 1; /*Flawfinder: ignore*/ if (!verifyLength(length, name)) { - return FALSE; + return false; } value = std::string((char*)mCurBufferp); // We already assume NULL termination calling strlen() mCurBufferp += length; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::packBinaryData(const U8 *value, S32 size, const char *name) +bool LLDataPackerBinaryBuffer::packBinaryData(const U8 *value, S32 size, const char *name) { if (!verifyLength(size + 4, name)) { - return FALSE; + return false; } if (mWriteEnabled) @@ -285,16 +285,16 @@ BOOL LLDataPackerBinaryBuffer::packBinaryData(const U8 *value, S32 size, const c htolememcpy(mCurBufferp, value, MVT_VARIABLE, size); } mCurBufferp += size; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::unpackBinaryData(U8 *value, S32 &size, const char *name) +bool LLDataPackerBinaryBuffer::unpackBinaryData(U8 *value, S32 &size, const char *name) { if (!verifyLength(4, name)) { LL_WARNS() << "LLDataPackerBinaryBuffer::unpackBinaryData would unpack invalid data, aborting!" << LL_ENDL; - return FALSE; + return false; } htolememcpy(&size, mCurBufferp, MVT_S32, 4); @@ -302,7 +302,7 @@ BOOL LLDataPackerBinaryBuffer::unpackBinaryData(U8 *value, S32 &size, const char if (size < 0) { LL_WARNS() << "LLDataPackerBinaryBuffer::unpackBinaryData unpacked invalid size, aborting!" << LL_ENDL; - return FALSE; + return false; } mCurBufferp += 4; @@ -310,21 +310,21 @@ BOOL LLDataPackerBinaryBuffer::unpackBinaryData(U8 *value, S32 &size, const char if (!verifyLength(size, name)) { LL_WARNS() << "LLDataPackerBinaryBuffer::unpackBinaryData would unpack invalid data, aborting!" << LL_ENDL; - return FALSE; + return false; } htolememcpy(value, mCurBufferp, MVT_VARIABLE, size); mCurBufferp += size; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::packBinaryDataFixed(const U8 *value, S32 size, const char *name) +bool LLDataPackerBinaryBuffer::packBinaryDataFixed(const U8 *value, S32 size, const char *name) { if (!verifyLength(size, name)) { - return FALSE; + return false; } if (mWriteEnabled) @@ -332,27 +332,27 @@ BOOL LLDataPackerBinaryBuffer::packBinaryDataFixed(const U8 *value, S32 size, co htolememcpy(mCurBufferp, value, MVT_VARIABLE, size); } mCurBufferp += size; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::unpackBinaryDataFixed(U8 *value, S32 size, const char *name) +bool LLDataPackerBinaryBuffer::unpackBinaryDataFixed(U8 *value, S32 size, const char *name) { if (!verifyLength(size, name)) { - return FALSE; + return false; } htolememcpy(value, mCurBufferp, MVT_VARIABLE, size); mCurBufferp += size; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::packU8(const U8 value, const char *name) +bool LLDataPackerBinaryBuffer::packU8(const U8 value, const char *name) { if (!verifyLength(sizeof(U8), name)) { - return FALSE; + return false; } if (mWriteEnabled) @@ -360,28 +360,28 @@ BOOL LLDataPackerBinaryBuffer::packU8(const U8 value, const char *name) *mCurBufferp = value; } mCurBufferp++; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::unpackU8(U8 &value, const char *name) +bool LLDataPackerBinaryBuffer::unpackU8(U8 &value, const char *name) { if (!verifyLength(sizeof(U8), name)) { - return FALSE; + return false; } value = *mCurBufferp; mCurBufferp++; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::packU16(const U16 value, const char *name) +bool LLDataPackerBinaryBuffer::packU16(const U16 value, const char *name) { if (!verifyLength(sizeof(U16), name)) { - return FALSE; + return false; } if (mWriteEnabled) @@ -389,25 +389,25 @@ BOOL LLDataPackerBinaryBuffer::packU16(const U16 value, const char *name) htolememcpy(mCurBufferp, &value, MVT_U16, 2); } mCurBufferp += 2; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::unpackU16(U16 &value, const char *name) +bool LLDataPackerBinaryBuffer::unpackU16(U16 &value, const char *name) { if (!verifyLength(sizeof(U16), name)) { - return FALSE; + return false; } htolememcpy(&value, mCurBufferp, MVT_U16, 2); mCurBufferp += 2; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::packS16(const S16 value, const char *name) +bool LLDataPackerBinaryBuffer::packS16(const S16 value, const char *name) { - BOOL success = verifyLength(sizeof(S16), name); + bool success = verifyLength(sizeof(S16), name); if (mWriteEnabled && success) { @@ -417,9 +417,9 @@ BOOL LLDataPackerBinaryBuffer::packS16(const S16 value, const char *name) return success; } -BOOL LLDataPackerBinaryBuffer::unpackS16(S16 &value, const char *name) +bool LLDataPackerBinaryBuffer::unpackS16(S16 &value, const char *name) { - BOOL success = verifyLength(sizeof(S16), name); + bool success = verifyLength(sizeof(S16), name); if (success) { @@ -429,11 +429,11 @@ BOOL LLDataPackerBinaryBuffer::unpackS16(S16 &value, const char *name) return success; } -BOOL LLDataPackerBinaryBuffer::packU32(const U32 value, const char *name) +bool LLDataPackerBinaryBuffer::packU32(const U32 value, const char *name) { if (!verifyLength(sizeof(U32), name)) { - return FALSE; + return false; } if (mWriteEnabled) @@ -441,28 +441,28 @@ BOOL LLDataPackerBinaryBuffer::packU32(const U32 value, const char *name) htolememcpy(mCurBufferp, &value, MVT_U32, 4); } mCurBufferp += 4; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::unpackU32(U32 &value, const char *name) +bool LLDataPackerBinaryBuffer::unpackU32(U32 &value, const char *name) { if (!verifyLength(sizeof(U32), name)) { - return FALSE; + return false; } htolememcpy(&value, mCurBufferp, MVT_U32, 4); mCurBufferp += 4; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::packS32(const S32 value, const char *name) +bool LLDataPackerBinaryBuffer::packS32(const S32 value, const char *name) { if (!verifyLength(sizeof(S32), name)) { - return FALSE; + return false; } if (mWriteEnabled) @@ -470,28 +470,28 @@ BOOL LLDataPackerBinaryBuffer::packS32(const S32 value, const char *name) htolememcpy(mCurBufferp, &value, MVT_S32, 4); } mCurBufferp += 4; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::unpackS32(S32 &value, const char *name) +bool LLDataPackerBinaryBuffer::unpackS32(S32 &value, const char *name) { if(!verifyLength(sizeof(S32), name)) { - return FALSE; + return false; } htolememcpy(&value, mCurBufferp, MVT_S32, 4); mCurBufferp += 4; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::packF32(const F32 value, const char *name) +bool LLDataPackerBinaryBuffer::packF32(const F32 value, const char *name) { if (!verifyLength(sizeof(F32), name)) { - return FALSE; + return false; } if (mWriteEnabled) @@ -499,28 +499,28 @@ BOOL LLDataPackerBinaryBuffer::packF32(const F32 value, const char *name) htolememcpy(mCurBufferp, &value, MVT_F32, 4); } mCurBufferp += 4; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::unpackF32(F32 &value, const char *name) +bool LLDataPackerBinaryBuffer::unpackF32(F32 &value, const char *name) { if (!verifyLength(sizeof(F32), name)) { - return FALSE; + return false; } htolememcpy(&value, mCurBufferp, MVT_F32, 4); mCurBufferp += 4; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::packColor4(const LLColor4 &value, const char *name) +bool LLDataPackerBinaryBuffer::packColor4(const LLColor4 &value, const char *name) { if (!verifyLength(16, name)) { - return FALSE; + return false; } if (mWriteEnabled) @@ -528,28 +528,28 @@ BOOL LLDataPackerBinaryBuffer::packColor4(const LLColor4 &value, const char *nam htolememcpy(mCurBufferp, value.mV, MVT_LLVector4, 16); } mCurBufferp += 16; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::unpackColor4(LLColor4 &value, const char *name) +bool LLDataPackerBinaryBuffer::unpackColor4(LLColor4 &value, const char *name) { if (!verifyLength(16, name)) { - return FALSE; + return false; } htolememcpy(value.mV, mCurBufferp, MVT_LLVector4, 16); mCurBufferp += 16; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::packColor4U(const LLColor4U &value, const char *name) +bool LLDataPackerBinaryBuffer::packColor4U(const LLColor4U &value, const char *name) { if (!verifyLength(4, name)) { - return FALSE; + return false; } if (mWriteEnabled) @@ -557,29 +557,29 @@ BOOL LLDataPackerBinaryBuffer::packColor4U(const LLColor4U &value, const char *n htolememcpy(mCurBufferp, value.mV, MVT_VARIABLE, 4); } mCurBufferp += 4; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::unpackColor4U(LLColor4U &value, const char *name) +bool LLDataPackerBinaryBuffer::unpackColor4U(LLColor4U &value, const char *name) { if (!verifyLength(4, name)) { - return FALSE; + return false; } htolememcpy(value.mV, mCurBufferp, MVT_VARIABLE, 4); mCurBufferp += 4; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::packVector2(const LLVector2 &value, const char *name) +bool LLDataPackerBinaryBuffer::packVector2(const LLVector2 &value, const char *name) { if (!verifyLength(8, name)) { - return FALSE; + return false; } if (mWriteEnabled) @@ -588,29 +588,29 @@ BOOL LLDataPackerBinaryBuffer::packVector2(const LLVector2 &value, const char *n htolememcpy(mCurBufferp+4, &value.mV[1], MVT_F32, 4); } mCurBufferp += 8; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::unpackVector2(LLVector2 &value, const char *name) +bool LLDataPackerBinaryBuffer::unpackVector2(LLVector2 &value, const char *name) { if (!verifyLength(8, name)) { - return FALSE; + return false; } htolememcpy(&value.mV[0], mCurBufferp, MVT_F32, 4); htolememcpy(&value.mV[1], mCurBufferp+4, MVT_F32, 4); mCurBufferp += 8; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::packVector3(const LLVector3 &value, const char *name) +bool LLDataPackerBinaryBuffer::packVector3(const LLVector3 &value, const char *name) { if (!verifyLength(12, name)) { - return FALSE; + return false; } if (mWriteEnabled) @@ -618,27 +618,27 @@ BOOL LLDataPackerBinaryBuffer::packVector3(const LLVector3 &value, const char *n htolememcpy(mCurBufferp, value.mV, MVT_LLVector3, 12); } mCurBufferp += 12; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::unpackVector3(LLVector3 &value, const char *name) +bool LLDataPackerBinaryBuffer::unpackVector3(LLVector3 &value, const char *name) { if (!verifyLength(12, name)) { - return FALSE; + return false; } htolememcpy(value.mV, mCurBufferp, MVT_LLVector3, 12); mCurBufferp += 12; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::packVector4(const LLVector4 &value, const char *name) +bool LLDataPackerBinaryBuffer::packVector4(const LLVector4 &value, const char *name) { if (!verifyLength(16, name)) { - return FALSE; + return false; } if (mWriteEnabled) @@ -646,27 +646,27 @@ BOOL LLDataPackerBinaryBuffer::packVector4(const LLVector4 &value, const char *n htolememcpy(mCurBufferp, value.mV, MVT_LLVector4, 16); } mCurBufferp += 16; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::unpackVector4(LLVector4 &value, const char *name) +bool LLDataPackerBinaryBuffer::unpackVector4(LLVector4 &value, const char *name) { if (!verifyLength(16, name)) { - return FALSE; + return false; } htolememcpy(value.mV, mCurBufferp, MVT_LLVector4, 16); mCurBufferp += 16; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::packUUID(const LLUUID &value, const char *name) +bool LLDataPackerBinaryBuffer::packUUID(const LLUUID &value, const char *name) { if (!verifyLength(16, name)) { - return FALSE; + return false; } if (mWriteEnabled) @@ -674,20 +674,20 @@ BOOL LLDataPackerBinaryBuffer::packUUID(const LLUUID &value, const char *name) htolememcpy(mCurBufferp, value.mData, MVT_LLUUID, 16); } mCurBufferp += 16; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::unpackUUID(LLUUID &value, const char *name) +bool LLDataPackerBinaryBuffer::unpackUUID(LLUUID &value, const char *name) { if (!verifyLength(16, name)) { - return FALSE; + return false; } htolememcpy(value.mData, mCurBufferp, MVT_LLUUID, 16); mCurBufferp += 16; - return TRUE; + return true; } const LLDataPackerBinaryBuffer& LLDataPackerBinaryBuffer::operator=(const LLDataPackerBinaryBuffer &a) @@ -729,9 +729,9 @@ void LLDataPackerBinaryBuffer::dumpBufferToLog() //--------------------------------------------------------------------------- // LLDataPackerAsciiBuffer implementation //--------------------------------------------------------------------------- -BOOL LLDataPackerAsciiBuffer::packString(const std::string& value, const char *name) +bool LLDataPackerAsciiBuffer::packString(const std::string& value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); int numCopied = 0; if (mWriteEnabled) @@ -740,7 +740,7 @@ BOOL LLDataPackerAsciiBuffer::packString(const std::string& value, const char *n } else { - numCopied = value.length() + 1; /*Flawfinder: ignore*/ + numCopied = static_cast<S32>(value.length()) + 1; /*Flawfinder: ignore*/ } // snprintf returns number of bytes that would have been written @@ -759,21 +759,21 @@ BOOL LLDataPackerAsciiBuffer::packString(const std::string& value, const char *n return success; } -BOOL LLDataPackerAsciiBuffer::unpackString(std::string& value, const char *name) +bool LLDataPackerAsciiBuffer::unpackString(std::string& value, const char *name) { char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore*/ if (!getValueStr(name, valuestr, DP_BUFSIZE)) // NULL terminated { - return FALSE; + return false; } value = valuestr; - return TRUE; + return true; } -BOOL LLDataPackerAsciiBuffer::packBinaryData(const U8 *value, S32 size, const char *name) +bool LLDataPackerAsciiBuffer::packBinaryData(const U8 *value, S32 size, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); int numCopied = 0; @@ -796,7 +796,7 @@ BOOL LLDataPackerAsciiBuffer::packBinaryData(const U8 *value, S32 size, const ch S32 i; - BOOL bBufferFull = FALSE; + bool bBufferFull = false; for (i = 0; i < size && !bBufferFull; i++) { numCopied = snprintf(mCurBufferp, getBufferSize()-getCurrentSize(), "%02x ", value[i]); /* Flawfinder: ignore */ @@ -804,7 +804,7 @@ BOOL LLDataPackerAsciiBuffer::packBinaryData(const U8 *value, S32 size, const ch { numCopied = getBufferSize()-getCurrentSize(); LL_WARNS() << "LLDataPackerAsciiBuffer::packBinaryData: data truncated: " << LL_ENDL; - bBufferFull = TRUE; + bBufferFull = true; } mCurBufferp += numCopied; } @@ -836,13 +836,13 @@ BOOL LLDataPackerAsciiBuffer::packBinaryData(const U8 *value, S32 size, const ch } -BOOL LLDataPackerAsciiBuffer::unpackBinaryData(U8 *value, S32 &size, const char *name) +bool LLDataPackerAsciiBuffer::unpackBinaryData(U8 *value, S32 &size, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /* Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } char *cur_pos = &valuestr[0]; @@ -861,16 +861,16 @@ BOOL LLDataPackerAsciiBuffer::unpackBinaryData(U8 *value, S32 &size, const char } -BOOL LLDataPackerAsciiBuffer::packBinaryDataFixed(const U8 *value, S32 size, const char *name) +bool LLDataPackerAsciiBuffer::packBinaryDataFixed(const U8 *value, S32 size, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); if (mWriteEnabled) { S32 i; int numCopied = 0; - BOOL bBufferFull = FALSE; + bool bBufferFull = false; for (i = 0; i < size && !bBufferFull; i++) { numCopied = snprintf(mCurBufferp, getBufferSize()-getCurrentSize(), "%02x ", value[i]); /* Flawfinder: ignore */ @@ -878,7 +878,7 @@ BOOL LLDataPackerAsciiBuffer::packBinaryDataFixed(const U8 *value, S32 size, con { numCopied = getBufferSize()-getCurrentSize(); LL_WARNS() << "LLDataPackerAsciiBuffer::packBinaryDataFixed: data truncated: " << LL_ENDL; - bBufferFull = TRUE; + bBufferFull = true; } mCurBufferp += numCopied; @@ -908,13 +908,13 @@ BOOL LLDataPackerAsciiBuffer::packBinaryDataFixed(const U8 *value, S32 size, con } -BOOL LLDataPackerAsciiBuffer::unpackBinaryDataFixed(U8 *value, S32 size, const char *name) +bool LLDataPackerAsciiBuffer::unpackBinaryDataFixed(U8 *value, S32 size, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /* Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } char *cur_pos = &valuestr[0]; @@ -932,9 +932,9 @@ BOOL LLDataPackerAsciiBuffer::unpackBinaryDataFixed(U8 *value, S32 size, const c -BOOL LLDataPackerAsciiBuffer::packU8(const U8 value, const char *name) +bool LLDataPackerAsciiBuffer::packU8(const U8 value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); int numCopied = 0; if (mWriteEnabled) @@ -965,13 +965,13 @@ BOOL LLDataPackerAsciiBuffer::packU8(const U8 value, const char *name) } -BOOL LLDataPackerAsciiBuffer::unpackU8(U8 &value, const char *name) +bool LLDataPackerAsciiBuffer::unpackU8(U8 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /* Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } S32 in_val; @@ -980,9 +980,9 @@ BOOL LLDataPackerAsciiBuffer::unpackU8(U8 &value, const char *name) return success; } -BOOL LLDataPackerAsciiBuffer::packU16(const U16 value, const char *name) +bool LLDataPackerAsciiBuffer::packU16(const U16 value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); int numCopied = 0; if (mWriteEnabled) @@ -1012,13 +1012,13 @@ BOOL LLDataPackerAsciiBuffer::packU16(const U16 value, const char *name) } -BOOL LLDataPackerAsciiBuffer::unpackU16(U16 &value, const char *name) +bool LLDataPackerAsciiBuffer::unpackU16(U16 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /* Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } S32 in_val; @@ -1027,9 +1027,9 @@ BOOL LLDataPackerAsciiBuffer::unpackU16(U16 &value, const char *name) return success; } -BOOL LLDataPackerAsciiBuffer::packS16(const S16 value, const char *name) +bool LLDataPackerAsciiBuffer::packS16(const S16 value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); int numCopied = 0; if (mWriteEnabled) @@ -1059,13 +1059,13 @@ BOOL LLDataPackerAsciiBuffer::packS16(const S16 value, const char *name) } -BOOL LLDataPackerAsciiBuffer::unpackS16(S16 &value, const char *name) +bool LLDataPackerAsciiBuffer::unpackS16(S16 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /* Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } S32 in_val; @@ -1074,9 +1074,9 @@ BOOL LLDataPackerAsciiBuffer::unpackS16(S16 &value, const char *name) return success; } -BOOL LLDataPackerAsciiBuffer::packU32(const U32 value, const char *name) +bool LLDataPackerAsciiBuffer::packU32(const U32 value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); int numCopied = 0; if (mWriteEnabled) @@ -1104,13 +1104,13 @@ BOOL LLDataPackerAsciiBuffer::packU32(const U32 value, const char *name) } -BOOL LLDataPackerAsciiBuffer::unpackU32(U32 &value, const char *name) +bool LLDataPackerAsciiBuffer::unpackU32(U32 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /* Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } sscanf(valuestr,"%u", &value); @@ -1118,9 +1118,9 @@ BOOL LLDataPackerAsciiBuffer::unpackU32(U32 &value, const char *name) } -BOOL LLDataPackerAsciiBuffer::packS32(const S32 value, const char *name) +bool LLDataPackerAsciiBuffer::packS32(const S32 value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); int numCopied = 0; if (mWriteEnabled) @@ -1148,13 +1148,13 @@ BOOL LLDataPackerAsciiBuffer::packS32(const S32 value, const char *name) } -BOOL LLDataPackerAsciiBuffer::unpackS32(S32 &value, const char *name) +bool LLDataPackerAsciiBuffer::unpackS32(S32 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /* Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } sscanf(valuestr,"%d", &value); @@ -1162,9 +1162,9 @@ BOOL LLDataPackerAsciiBuffer::unpackS32(S32 &value, const char *name) } -BOOL LLDataPackerAsciiBuffer::packF32(const F32 value, const char *name) +bool LLDataPackerAsciiBuffer::packF32(const F32 value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); int numCopied = 0; if (mWriteEnabled) @@ -1192,13 +1192,13 @@ BOOL LLDataPackerAsciiBuffer::packF32(const F32 value, const char *name) } -BOOL LLDataPackerAsciiBuffer::unpackF32(F32 &value, const char *name) +bool LLDataPackerAsciiBuffer::unpackF32(F32 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /* Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } sscanf(valuestr,"%f", &value); @@ -1206,9 +1206,9 @@ BOOL LLDataPackerAsciiBuffer::unpackF32(F32 &value, const char *name) } -BOOL LLDataPackerAsciiBuffer::packColor4(const LLColor4 &value, const char *name) +bool LLDataPackerAsciiBuffer::packColor4(const LLColor4 &value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); int numCopied = 0; if (mWriteEnabled) @@ -1236,22 +1236,22 @@ BOOL LLDataPackerAsciiBuffer::packColor4(const LLColor4 &value, const char *name } -BOOL LLDataPackerAsciiBuffer::unpackColor4(LLColor4 &value, const char *name) +bool LLDataPackerAsciiBuffer::unpackColor4(LLColor4 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /* Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } sscanf(valuestr,"%f %f %f %f", &value.mV[0], &value.mV[1], &value.mV[2], &value.mV[3]); return success; } -BOOL LLDataPackerAsciiBuffer::packColor4U(const LLColor4U &value, const char *name) +bool LLDataPackerAsciiBuffer::packColor4U(const LLColor4U &value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); int numCopied = 0; if (mWriteEnabled) @@ -1279,13 +1279,13 @@ BOOL LLDataPackerAsciiBuffer::packColor4U(const LLColor4U &value, const char *na } -BOOL LLDataPackerAsciiBuffer::unpackColor4U(LLColor4U &value, const char *name) +bool LLDataPackerAsciiBuffer::unpackColor4U(LLColor4U &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /* Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } S32 r, g, b, a; @@ -1299,9 +1299,9 @@ BOOL LLDataPackerAsciiBuffer::unpackColor4U(LLColor4U &value, const char *name) } -BOOL LLDataPackerAsciiBuffer::packVector2(const LLVector2 &value, const char *name) +bool LLDataPackerAsciiBuffer::packVector2(const LLVector2 &value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); int numCopied = 0; if (mWriteEnabled) @@ -1329,13 +1329,13 @@ BOOL LLDataPackerAsciiBuffer::packVector2(const LLVector2 &value, const char *na } -BOOL LLDataPackerAsciiBuffer::unpackVector2(LLVector2 &value, const char *name) +bool LLDataPackerAsciiBuffer::unpackVector2(LLVector2 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /* Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } sscanf(valuestr,"%f %f", &value.mV[0], &value.mV[1]); @@ -1343,9 +1343,9 @@ BOOL LLDataPackerAsciiBuffer::unpackVector2(LLVector2 &value, const char *name) } -BOOL LLDataPackerAsciiBuffer::packVector3(const LLVector3 &value, const char *name) +bool LLDataPackerAsciiBuffer::packVector3(const LLVector3 &value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); int numCopied = 0; if (mWriteEnabled) @@ -1373,22 +1373,22 @@ BOOL LLDataPackerAsciiBuffer::packVector3(const LLVector3 &value, const char *na } -BOOL LLDataPackerAsciiBuffer::unpackVector3(LLVector3 &value, const char *name) +bool LLDataPackerAsciiBuffer::unpackVector3(LLVector3 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /* Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } sscanf(valuestr,"%f %f %f", &value.mV[0], &value.mV[1], &value.mV[2]); return success; } -BOOL LLDataPackerAsciiBuffer::packVector4(const LLVector4 &value, const char *name) +bool LLDataPackerAsciiBuffer::packVector4(const LLVector4 &value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); int numCopied = 0; if (mWriteEnabled) @@ -1416,13 +1416,13 @@ BOOL LLDataPackerAsciiBuffer::packVector4(const LLVector4 &value, const char *na } -BOOL LLDataPackerAsciiBuffer::unpackVector4(LLVector4 &value, const char *name) +bool LLDataPackerAsciiBuffer::unpackVector4(LLVector4 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /* Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } sscanf(valuestr,"%f %f %f %f", &value.mV[0], &value.mV[1], &value.mV[2], &value.mV[3]); @@ -1430,9 +1430,9 @@ BOOL LLDataPackerAsciiBuffer::unpackVector4(LLVector4 &value, const char *name) } -BOOL LLDataPackerAsciiBuffer::packUUID(const LLUUID &value, const char *name) +bool LLDataPackerAsciiBuffer::packUUID(const LLUUID &value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); int numCopied = 0; @@ -1456,20 +1456,20 @@ BOOL LLDataPackerAsciiBuffer::packUUID(const LLUUID &value, const char *name) { numCopied = getBufferSize()-getCurrentSize(); LL_WARNS() << "LLDataPackerAsciiBuffer::packUUID: truncated: " << LL_ENDL; - success = FALSE; + success = false; } mCurBufferp += numCopied; return success; } -BOOL LLDataPackerAsciiBuffer::unpackUUID(LLUUID &value, const char *name) +bool LLDataPackerAsciiBuffer::unpackUUID(LLUUID &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /* Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } char tmp_str[64]; /* Flawfinder: ignore */ @@ -1514,9 +1514,9 @@ void LLDataPackerAsciiBuffer::writeIndentedName(const char *name) } } -BOOL LLDataPackerAsciiBuffer::getValueStr(const char *name, char *out_value, S32 value_len) +bool LLDataPackerAsciiBuffer::getValueStr(const char *name, char *out_value, S32 value_len) { - BOOL success = TRUE; + bool success = true; char buffer[DP_BUFSIZE]; /* Flawfinder: ignore */ char keyword[DP_BUFSIZE]; /* Flawfinder: ignore */ char value[DP_BUFSIZE]; /* Flawfinder: ignore */ @@ -1537,7 +1537,7 @@ BOOL LLDataPackerAsciiBuffer::getValueStr(const char *name, char *out_value, S32 if (strcmp(keyword, name)) { LL_WARNS() << "Data packer expecting keyword of type " << name << ", got " << keyword << " instead!" << LL_ENDL; - return FALSE; + return false; } } else @@ -1572,9 +1572,9 @@ std::string convertF32ToString(F32 val) //--------------------------------------------------------------------------- // LLDataPackerAsciiFile implementation //--------------------------------------------------------------------------- -BOOL LLDataPackerAsciiFile::packString(const std::string& value, const char *name) +bool LLDataPackerAsciiFile::packString(const std::string& value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); if (mFP) { @@ -1587,22 +1587,22 @@ BOOL LLDataPackerAsciiFile::packString(const std::string& value, const char *nam return success; } -BOOL LLDataPackerAsciiFile::unpackString(std::string& value, const char *name) +bool LLDataPackerAsciiFile::unpackString(std::string& value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /* Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } value = valuestr; return success; } -BOOL LLDataPackerAsciiFile::packBinaryData(const U8 *value, S32 size, const char *name) +bool LLDataPackerAsciiFile::packBinaryData(const U8 *value, S32 size, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); if (mFP) @@ -1634,13 +1634,13 @@ BOOL LLDataPackerAsciiFile::packBinaryData(const U8 *value, S32 size, const char } -BOOL LLDataPackerAsciiFile::unpackBinaryData(U8 *value, S32 &size, const char *name) +bool LLDataPackerAsciiFile::unpackBinaryData(U8 *value, S32 &size, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore*/ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } char *cur_pos = &valuestr[0]; @@ -1659,9 +1659,9 @@ BOOL LLDataPackerAsciiFile::unpackBinaryData(U8 *value, S32 &size, const char *n } -BOOL LLDataPackerAsciiFile::packBinaryDataFixed(const U8 *value, S32 size, const char *name) +bool LLDataPackerAsciiFile::packBinaryDataFixed(const U8 *value, S32 size, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); if (mFP) @@ -1688,13 +1688,13 @@ BOOL LLDataPackerAsciiFile::packBinaryDataFixed(const U8 *value, S32 size, const } -BOOL LLDataPackerAsciiFile::unpackBinaryDataFixed(U8 *value, S32 size, const char *name) +bool LLDataPackerAsciiFile::unpackBinaryDataFixed(U8 *value, S32 size, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore*/ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } char *cur_pos = &valuestr[0]; @@ -1712,9 +1712,9 @@ BOOL LLDataPackerAsciiFile::unpackBinaryDataFixed(U8 *value, S32 size, const cha -BOOL LLDataPackerAsciiFile::packU8(const U8 value, const char *name) +bool LLDataPackerAsciiFile::packU8(const U8 value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); if (mFP) { @@ -1730,13 +1730,13 @@ BOOL LLDataPackerAsciiFile::packU8(const U8 value, const char *name) } -BOOL LLDataPackerAsciiFile::unpackU8(U8 &value, const char *name) +bool LLDataPackerAsciiFile::unpackU8(U8 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } S32 in_val; @@ -1745,9 +1745,9 @@ BOOL LLDataPackerAsciiFile::unpackU8(U8 &value, const char *name) return success; } -BOOL LLDataPackerAsciiFile::packU16(const U16 value, const char *name) +bool LLDataPackerAsciiFile::packU16(const U16 value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); if (mFP) { @@ -1761,13 +1761,13 @@ BOOL LLDataPackerAsciiFile::packU16(const U16 value, const char *name) } -BOOL LLDataPackerAsciiFile::unpackU16(U16 &value, const char *name) +bool LLDataPackerAsciiFile::unpackU16(U16 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } S32 in_val; @@ -1776,9 +1776,9 @@ BOOL LLDataPackerAsciiFile::unpackU16(U16 &value, const char *name) return success; } -BOOL LLDataPackerAsciiFile::packS16(const S16 value, const char *name) +bool LLDataPackerAsciiFile::packS16(const S16 value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); if (mFP) { @@ -1792,13 +1792,13 @@ BOOL LLDataPackerAsciiFile::packS16(const S16 value, const char *name) } -BOOL LLDataPackerAsciiFile::unpackS16(S16 &value, const char *name) +bool LLDataPackerAsciiFile::unpackS16(S16 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } S32 in_val; @@ -1807,9 +1807,9 @@ BOOL LLDataPackerAsciiFile::unpackS16(S16 &value, const char *name) return success; } -BOOL LLDataPackerAsciiFile::packU32(const U32 value, const char *name) +bool LLDataPackerAsciiFile::packU32(const U32 value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); if (mFP) { @@ -1823,13 +1823,13 @@ BOOL LLDataPackerAsciiFile::packU32(const U32 value, const char *name) } -BOOL LLDataPackerAsciiFile::unpackU32(U32 &value, const char *name) +bool LLDataPackerAsciiFile::unpackU32(U32 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } sscanf(valuestr,"%u", &value); @@ -1837,9 +1837,9 @@ BOOL LLDataPackerAsciiFile::unpackU32(U32 &value, const char *name) } -BOOL LLDataPackerAsciiFile::packS32(const S32 value, const char *name) +bool LLDataPackerAsciiFile::packS32(const S32 value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); if (mFP) { @@ -1853,13 +1853,13 @@ BOOL LLDataPackerAsciiFile::packS32(const S32 value, const char *name) } -BOOL LLDataPackerAsciiFile::unpackS32(S32 &value, const char *name) +bool LLDataPackerAsciiFile::unpackS32(S32 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } sscanf(valuestr,"%d", &value); @@ -1867,9 +1867,9 @@ BOOL LLDataPackerAsciiFile::unpackS32(S32 &value, const char *name) } -BOOL LLDataPackerAsciiFile::packF32(const F32 value, const char *name) +bool LLDataPackerAsciiFile::packF32(const F32 value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); if (mFP) { @@ -1883,13 +1883,13 @@ BOOL LLDataPackerAsciiFile::packF32(const F32 value, const char *name) } -BOOL LLDataPackerAsciiFile::unpackF32(F32 &value, const char *name) +bool LLDataPackerAsciiFile::unpackF32(F32 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } sscanf(valuestr,"%f", &value); @@ -1897,9 +1897,9 @@ BOOL LLDataPackerAsciiFile::unpackF32(F32 &value, const char *name) } -BOOL LLDataPackerAsciiFile::packColor4(const LLColor4 &value, const char *name) +bool LLDataPackerAsciiFile::packColor4(const LLColor4 &value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); if (mFP) { @@ -1913,22 +1913,22 @@ BOOL LLDataPackerAsciiFile::packColor4(const LLColor4 &value, const char *name) } -BOOL LLDataPackerAsciiFile::unpackColor4(LLColor4 &value, const char *name) +bool LLDataPackerAsciiFile::unpackColor4(LLColor4 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } sscanf(valuestr,"%f %f %f %f", &value.mV[0], &value.mV[1], &value.mV[2], &value.mV[3]); return success; } -BOOL LLDataPackerAsciiFile::packColor4U(const LLColor4U &value, const char *name) +bool LLDataPackerAsciiFile::packColor4U(const LLColor4U &value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); if (mFP) { @@ -1942,13 +1942,13 @@ BOOL LLDataPackerAsciiFile::packColor4U(const LLColor4U &value, const char *name } -BOOL LLDataPackerAsciiFile::unpackColor4U(LLColor4U &value, const char *name) +bool LLDataPackerAsciiFile::unpackColor4U(LLColor4U &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } S32 r, g, b, a; @@ -1962,9 +1962,9 @@ BOOL LLDataPackerAsciiFile::unpackColor4U(LLColor4U &value, const char *name) } -BOOL LLDataPackerAsciiFile::packVector2(const LLVector2 &value, const char *name) +bool LLDataPackerAsciiFile::packVector2(const LLVector2 &value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); if (mFP) { @@ -1978,13 +1978,13 @@ BOOL LLDataPackerAsciiFile::packVector2(const LLVector2 &value, const char *name } -BOOL LLDataPackerAsciiFile::unpackVector2(LLVector2 &value, const char *name) +bool LLDataPackerAsciiFile::unpackVector2(LLVector2 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } sscanf(valuestr,"%f %f", &value.mV[0], &value.mV[1]); @@ -1992,9 +1992,9 @@ BOOL LLDataPackerAsciiFile::unpackVector2(LLVector2 &value, const char *name) } -BOOL LLDataPackerAsciiFile::packVector3(const LLVector3 &value, const char *name) +bool LLDataPackerAsciiFile::packVector3(const LLVector3 &value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); if (mFP) { @@ -2008,22 +2008,22 @@ BOOL LLDataPackerAsciiFile::packVector3(const LLVector3 &value, const char *name } -BOOL LLDataPackerAsciiFile::unpackVector3(LLVector3 &value, const char *name) +bool LLDataPackerAsciiFile::unpackVector3(LLVector3 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } sscanf(valuestr,"%f %f %f", &value.mV[0], &value.mV[1], &value.mV[2]); return success; } -BOOL LLDataPackerAsciiFile::packVector4(const LLVector4 &value, const char *name) +bool LLDataPackerAsciiFile::packVector4(const LLVector4 &value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); if (mFP) { @@ -2037,13 +2037,13 @@ BOOL LLDataPackerAsciiFile::packVector4(const LLVector4 &value, const char *name } -BOOL LLDataPackerAsciiFile::unpackVector4(LLVector4 &value, const char *name) +bool LLDataPackerAsciiFile::unpackVector4(LLVector4 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } sscanf(valuestr,"%f %f %f %f", &value.mV[0], &value.mV[1], &value.mV[2], &value.mV[3]); @@ -2051,9 +2051,9 @@ BOOL LLDataPackerAsciiFile::unpackVector4(LLVector4 &value, const char *name) } -BOOL LLDataPackerAsciiFile::packUUID(const LLUUID &value, const char *name) +bool LLDataPackerAsciiFile::packUUID(const LLUUID &value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); std::string tmp_str; value.toString(tmp_str); @@ -2069,13 +2069,13 @@ BOOL LLDataPackerAsciiFile::packUUID(const LLUUID &value, const char *name) } -BOOL LLDataPackerAsciiFile::unpackUUID(LLUUID &value, const char *name) +bool LLDataPackerAsciiFile::unpackUUID(LLUUID &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } char tmp_str[64]; /*Flawfinder: ignore */ @@ -2107,9 +2107,9 @@ void LLDataPackerAsciiFile::writeIndentedName(const char *name) } } -BOOL LLDataPackerAsciiFile::getValueStr(const char *name, char *out_value, S32 value_len) +bool LLDataPackerAsciiFile::getValueStr(const char *name, char *out_value, S32 value_len) { - BOOL success = FALSE; + bool success = false; char buffer[DP_BUFSIZE]; /*Flawfinder: ignore*/ char keyword[DP_BUFSIZE]; /*Flawfinder: ignore*/ char value[DP_BUFSIZE]; /*Flawfinder: ignore*/ @@ -2124,7 +2124,7 @@ BOOL LLDataPackerAsciiFile::getValueStr(const char *name, char *out_value, S32 v if (0 != fgetpos(mFP, &last_pos)) // 0==success for fgetpos { LL_WARNS() << "Data packer failed to fgetpos" << LL_ENDL; - return FALSE; + return false; } if (fgets(buffer, DP_BUFSIZE, mFP) == NULL) @@ -2138,20 +2138,20 @@ BOOL LLDataPackerAsciiFile::getValueStr(const char *name, char *out_value, S32 v { LL_WARNS() << "Data packer could not get the keyword!" << LL_ENDL; fsetpos(mFP, &last_pos); - return FALSE; + return false; } if (strcmp(keyword, name)) { LL_WARNS() << "Data packer expecting keyword of type " << name << ", got " << keyword << " instead!" << LL_ENDL; fsetpos(mFP, &last_pos); - return FALSE; + return false; } S32 in_value_len = (S32)strlen(value)+1; /*Flawfinder: ignore*/ S32 min_len = llmin(in_value_len, value_len); memcpy(out_value, value, min_len); /*Flawfinder: ignore*/ out_value[min_len-1] = 0; - success = TRUE; + success = true; } else if (mInputStream) { @@ -2161,19 +2161,19 @@ BOOL LLDataPackerAsciiFile::getValueStr(const char *name, char *out_value, S32 v if (!keyword[0]) { LL_WARNS() << "Data packer could not get the keyword!" << LL_ENDL; - return FALSE; + return false; } if (strcmp(keyword, name)) { LL_WARNS() << "Data packer expecting keyword of type " << name << ", got " << keyword << " instead!" << LL_ENDL; - return FALSE; + return false; } S32 in_value_len = (S32)strlen(value)+1; /*Flawfinder: ignore*/ S32 min_len = llmin(in_value_len, value_len); memcpy(out_value, value, min_len); /*Flawfinder: ignore*/ out_value[min_len-1] = 0; - success = TRUE; + success = true; } return success; diff --git a/indra/llmessage/lldatapacker.h b/indra/llmessage/lldatapacker.h index 9869326c12..167c102b43 100644 --- a/indra/llmessage/lldatapacker.h +++ b/indra/llmessage/lldatapacker.h @@ -43,72 +43,72 @@ public: virtual void reset(); virtual void dumpBufferToLog(); - virtual BOOL hasNext() const = 0; + virtual bool hasNext() const = 0; - virtual BOOL packString(const std::string& value, const char *name) = 0; - virtual BOOL unpackString(std::string& value, const char *name) = 0; + virtual bool packString(const std::string& value, const char *name) = 0; + virtual bool unpackString(std::string& value, const char *name) = 0; - virtual BOOL packBinaryData(const U8 *value, S32 size, const char *name) = 0; - virtual BOOL unpackBinaryData(U8 *value, S32 &size, const char *name) = 0; + virtual bool packBinaryData(const U8 *value, S32 size, const char *name) = 0; + virtual bool unpackBinaryData(U8 *value, S32 &size, const char *name) = 0; // Constant size binary data packing - virtual BOOL packBinaryDataFixed(const U8 *value, S32 size, const char *name) = 0; - virtual BOOL unpackBinaryDataFixed(U8 *value, S32 size, const char *name) = 0; + virtual bool packBinaryDataFixed(const U8 *value, S32 size, const char *name) = 0; + virtual bool unpackBinaryDataFixed(U8 *value, S32 size, const char *name) = 0; - virtual BOOL packU8(const U8 value, const char *name) = 0; - virtual BOOL unpackU8(U8 &value, const char *name) = 0; + virtual bool packU8(const U8 value, const char *name) = 0; + virtual bool unpackU8(U8 &value, const char *name) = 0; - virtual BOOL packU16(const U16 value, const char *name) = 0; - virtual BOOL unpackU16(U16 &value, const char *name) = 0; - BOOL unpackU16s(U16 *value, S32 count, const char *name); + virtual bool packU16(const U16 value, const char *name) = 0; + virtual bool unpackU16(U16 &value, const char *name) = 0; + bool unpackU16s(U16 *value, S32 count, const char *name); - virtual BOOL packS16(const S16 value, const char *name) = 0; - virtual BOOL unpackS16(S16 &value, const char *name) = 0; - BOOL unpackS16s(S16 *value, S32 count, const char *name); + virtual bool packS16(const S16 value, const char *name) = 0; + virtual bool unpackS16(S16 &value, const char *name) = 0; + bool unpackS16s(S16 *value, S32 count, const char *name); - virtual BOOL packU32(const U32 value, const char *name) = 0; - virtual BOOL unpackU32(U32 &value, const char *name) = 0; + virtual bool packU32(const U32 value, const char *name) = 0; + virtual bool unpackU32(U32 &value, const char *name) = 0; - virtual BOOL packS32(const S32 value, const char *name) = 0; - virtual BOOL unpackS32(S32 &value, const char *name) = 0; + virtual bool packS32(const S32 value, const char *name) = 0; + virtual bool unpackS32(S32 &value, const char *name) = 0; - virtual BOOL packF32(const F32 value, const char *name) = 0; - virtual BOOL unpackF32(F32 &value, const char *name) = 0; - BOOL unpackF32s(F32 *values, S32 count, const char *name); + virtual bool packF32(const F32 value, const char *name) = 0; + virtual bool unpackF32(F32 &value, const char *name) = 0; + bool unpackF32s(F32 *values, S32 count, const char *name); // Packs a float into an integer, using the given size // and picks the right U* data type to pack into. - BOOL packFixed(const F32 value, const char *name, - const BOOL is_signed, const U32 int_bits, const U32 frac_bits); - BOOL unpackFixed(F32 &value, const char *name, - const BOOL is_signed, const U32 int_bits, const U32 frac_bits); + bool packFixed(const F32 value, const char *name, + const bool is_signed, const U32 int_bits, const U32 frac_bits); + bool unpackFixed(F32 &value, const char *name, + const bool is_signed, const U32 int_bits, const U32 frac_bits); - virtual BOOL packColor4(const LLColor4 &value, const char *name) = 0; - virtual BOOL unpackColor4(LLColor4 &value, const char *name) = 0; + virtual bool packColor4(const LLColor4 &value, const char *name) = 0; + virtual bool unpackColor4(LLColor4 &value, const char *name) = 0; - virtual BOOL packColor4U(const LLColor4U &value, const char *name) = 0; - virtual BOOL unpackColor4U(LLColor4U &value, const char *name) = 0; - BOOL unpackColor4Us(LLColor4U *values, S32 count, const char *name); + virtual bool packColor4U(const LLColor4U &value, const char *name) = 0; + virtual bool unpackColor4U(LLColor4U &value, const char *name) = 0; + bool unpackColor4Us(LLColor4U *values, S32 count, const char *name); - virtual BOOL packVector2(const LLVector2 &value, const char *name) = 0; - virtual BOOL unpackVector2(LLVector2 &value, const char *name) = 0; + virtual bool packVector2(const LLVector2 &value, const char *name) = 0; + virtual bool unpackVector2(LLVector2 &value, const char *name) = 0; - virtual BOOL packVector3(const LLVector3 &value, const char *name) = 0; - virtual BOOL unpackVector3(LLVector3 &value, const char *name) = 0; + virtual bool packVector3(const LLVector3 &value, const char *name) = 0; + virtual bool unpackVector3(LLVector3 &value, const char *name) = 0; - virtual BOOL packVector4(const LLVector4 &value, const char *name) = 0; - virtual BOOL unpackVector4(LLVector4 &value, const char *name) = 0; + virtual bool packVector4(const LLVector4 &value, const char *name) = 0; + virtual bool unpackVector4(LLVector4 &value, const char *name) = 0; - virtual BOOL packUUID(const LLUUID &value, const char *name) = 0; - virtual BOOL unpackUUID(LLUUID &value, const char *name) = 0; - BOOL unpackUUIDs(LLUUID *values, S32 count, const char *name); + virtual bool packUUID(const LLUUID &value, const char *name) = 0; + virtual bool unpackUUID(LLUUID &value, const char *name) = 0; + bool unpackUUIDs(LLUUID *values, S32 count, const char *name); U32 getPassFlags() const { return mPassFlags; } void setPassFlags(U32 flags) { mPassFlags = flags; } protected: LLDataPacker(); protected: U32 mPassFlags; - BOOL mWriteEnabled; // disable this to do things like determine filesize without actually copying data + bool mWriteEnabled; // disable this to do things like determine filesize without actually copying data }; class LLDataPackerBinaryBuffer : public LLDataPacker @@ -120,7 +120,7 @@ public: mCurBufferp(bufferp), mBufferSize(size) { - mWriteEnabled = TRUE; + mWriteEnabled = true; } LLDataPackerBinaryBuffer() @@ -131,58 +131,58 @@ public: { } - /*virtual*/ BOOL packString(const std::string& value, const char *name); - /*virtual*/ BOOL unpackString(std::string& value, const char *name); + /*virtual*/ bool packString(const std::string& value, const char *name); + /*virtual*/ bool unpackString(std::string& value, const char *name); - /*virtual*/ BOOL packBinaryData(const U8 *value, S32 size, const char *name); - /*virtual*/ BOOL unpackBinaryData(U8 *value, S32 &size, const char *name); + /*virtual*/ bool packBinaryData(const U8 *value, S32 size, const char *name); + /*virtual*/ bool unpackBinaryData(U8 *value, S32 &size, const char *name); // Constant size binary data packing - /*virtual*/ BOOL packBinaryDataFixed(const U8 *value, S32 size, const char *name); - /*virtual*/ BOOL unpackBinaryDataFixed(U8 *value, S32 size, const char *name); + /*virtual*/ bool packBinaryDataFixed(const U8 *value, S32 size, const char *name); + /*virtual*/ bool unpackBinaryDataFixed(U8 *value, S32 size, const char *name); - /*virtual*/ BOOL packU8(const U8 value, const char *name); - /*virtual*/ BOOL unpackU8(U8 &value, const char *name); + /*virtual*/ bool packU8(const U8 value, const char *name); + /*virtual*/ bool unpackU8(U8 &value, const char *name); - /*virtual*/ BOOL packU16(const U16 value, const char *name); - /*virtual*/ BOOL unpackU16(U16 &value, const char *name); + /*virtual*/ bool packU16(const U16 value, const char *name); + /*virtual*/ bool unpackU16(U16 &value, const char *name); - /*virtual*/ BOOL packS16(const S16 value, const char *name); - /*virtual*/ BOOL unpackS16(S16 &value, const char *name); + /*virtual*/ bool packS16(const S16 value, const char *name); + /*virtual*/ bool unpackS16(S16 &value, const char *name); - /*virtual*/ BOOL packU32(const U32 value, const char *name); - /*virtual*/ BOOL unpackU32(U32 &value, const char *name); + /*virtual*/ bool packU32(const U32 value, const char *name); + /*virtual*/ bool unpackU32(U32 &value, const char *name); - /*virtual*/ BOOL packS32(const S32 value, const char *name); - /*virtual*/ BOOL unpackS32(S32 &value, const char *name); + /*virtual*/ bool packS32(const S32 value, const char *name); + /*virtual*/ bool unpackS32(S32 &value, const char *name); - /*virtual*/ BOOL packF32(const F32 value, const char *name); - /*virtual*/ BOOL unpackF32(F32 &value, const char *name); + /*virtual*/ bool packF32(const F32 value, const char *name); + /*virtual*/ bool unpackF32(F32 &value, const char *name); - /*virtual*/ BOOL packColor4(const LLColor4 &value, const char *name); - /*virtual*/ BOOL unpackColor4(LLColor4 &value, const char *name); + /*virtual*/ bool packColor4(const LLColor4 &value, const char *name); + /*virtual*/ bool unpackColor4(LLColor4 &value, const char *name); - /*virtual*/ BOOL packColor4U(const LLColor4U &value, const char *name); - /*virtual*/ BOOL unpackColor4U(LLColor4U &value, const char *name); + /*virtual*/ bool packColor4U(const LLColor4U &value, const char *name); + /*virtual*/ bool unpackColor4U(LLColor4U &value, const char *name); - /*virtual*/ BOOL packVector2(const LLVector2 &value, const char *name); - /*virtual*/ BOOL unpackVector2(LLVector2 &value, const char *name); + /*virtual*/ bool packVector2(const LLVector2 &value, const char *name); + /*virtual*/ bool unpackVector2(LLVector2 &value, const char *name); - /*virtual*/ BOOL packVector3(const LLVector3 &value, const char *name); - /*virtual*/ BOOL unpackVector3(LLVector3 &value, const char *name); + /*virtual*/ bool packVector3(const LLVector3 &value, const char *name); + /*virtual*/ bool unpackVector3(LLVector3 &value, const char *name); - /*virtual*/ BOOL packVector4(const LLVector4 &value, const char *name); - /*virtual*/ BOOL unpackVector4(LLVector4 &value, const char *name); + /*virtual*/ bool packVector4(const LLVector4 &value, const char *name); + /*virtual*/ bool unpackVector4(LLVector4 &value, const char *name); - /*virtual*/ BOOL packUUID(const LLUUID &value, const char *name); - /*virtual*/ BOOL unpackUUID(LLUUID &value, const char *name); + /*virtual*/ bool packUUID(const LLUUID &value, const char *name); + /*virtual*/ bool unpackUUID(LLUUID &value, const char *name); S32 getCurrentSize() const { return (S32)(mCurBufferp - mBufferp); } S32 getBufferSize() const { return mBufferSize; } const U8* getBuffer() const { return mBufferp; } void reset() { mCurBufferp = mBufferp; mWriteEnabled = (mCurBufferp != NULL); } void shift(S32 offset) { reset(); mCurBufferp += offset;} - void freeBuffer() { delete [] mBufferp; mBufferp = mCurBufferp = NULL; mBufferSize = 0; mWriteEnabled = FALSE; } + void freeBuffer() { delete [] mBufferp; mBufferp = mCurBufferp = NULL; mBufferSize = 0; mWriteEnabled = false; } void assignBuffer(U8 *bufferp, S32 size) { if(mBufferp && mBufferp != bufferp) @@ -192,31 +192,31 @@ public: mBufferp = bufferp; mCurBufferp = bufferp; mBufferSize = size; - mWriteEnabled = TRUE; + mWriteEnabled = true; } const LLDataPackerBinaryBuffer& operator=(const LLDataPackerBinaryBuffer &a); - /*virtual*/ BOOL hasNext() const { return getCurrentSize() < getBufferSize(); } + /*virtual*/ bool hasNext() const { return getCurrentSize() < getBufferSize(); } /*virtual*/ void dumpBufferToLog(); protected: - inline BOOL verifyLength(const S32 data_size, const char *name); + inline bool verifyLength(const S32 data_size, const char *name); U8 *mBufferp; U8 *mCurBufferp; S32 mBufferSize; }; -inline BOOL LLDataPackerBinaryBuffer::verifyLength(const S32 data_size, const char *name) +inline bool LLDataPackerBinaryBuffer::verifyLength(const S32 data_size, const char *name) { if (mWriteEnabled && (mCurBufferp - mBufferp) > mBufferSize - data_size) { LL_WARNS() << "Buffer overflow in BinaryBuffer length verify, field name " << name << "!" << LL_ENDL; LL_WARNS() << "Current pos: " << (int)(mCurBufferp - mBufferp) << " Buffer size: " << mBufferSize << " Data size: " << data_size << LL_ENDL; - return FALSE; + return false; } - return TRUE; + return true; } class LLDataPackerAsciiBuffer : public LLDataPacker @@ -228,8 +228,8 @@ public: mCurBufferp = bufferp; mBufferSize = size; mPassFlags = 0; - mIncludeNames = FALSE; - mWriteEnabled = TRUE; + mIncludeNames = false; + mWriteEnabled = true; } LLDataPackerAsciiBuffer() @@ -238,57 +238,57 @@ public: mCurBufferp = NULL; mBufferSize = 0; mPassFlags = 0; - mIncludeNames = FALSE; - mWriteEnabled = FALSE; + mIncludeNames = false; + mWriteEnabled = false; } - /*virtual*/ BOOL packString(const std::string& value, const char *name); - /*virtual*/ BOOL unpackString(std::string& value, const char *name); + /*virtual*/ bool packString(const std::string& value, const char *name); + /*virtual*/ bool unpackString(std::string& value, const char *name); - /*virtual*/ BOOL packBinaryData(const U8 *value, S32 size, const char *name); - /*virtual*/ BOOL unpackBinaryData(U8 *value, S32 &size, const char *name); + /*virtual*/ bool packBinaryData(const U8 *value, S32 size, const char *name); + /*virtual*/ bool unpackBinaryData(U8 *value, S32 &size, const char *name); // Constant size binary data packing - /*virtual*/ BOOL packBinaryDataFixed(const U8 *value, S32 size, const char *name); - /*virtual*/ BOOL unpackBinaryDataFixed(U8 *value, S32 size, const char *name); + /*virtual*/ bool packBinaryDataFixed(const U8 *value, S32 size, const char *name); + /*virtual*/ bool unpackBinaryDataFixed(U8 *value, S32 size, const char *name); - /*virtual*/ BOOL packU8(const U8 value, const char *name); - /*virtual*/ BOOL unpackU8(U8 &value, const char *name); + /*virtual*/ bool packU8(const U8 value, const char *name); + /*virtual*/ bool unpackU8(U8 &value, const char *name); - /*virtual*/ BOOL packU16(const U16 value, const char *name); - /*virtual*/ BOOL unpackU16(U16 &value, const char *name); + /*virtual*/ bool packU16(const U16 value, const char *name); + /*virtual*/ bool unpackU16(U16 &value, const char *name); - /*virtual*/ BOOL packS16(const S16 value, const char *name); - /*virtual*/ BOOL unpackS16(S16 &value, const char *name); + /*virtual*/ bool packS16(const S16 value, const char *name); + /*virtual*/ bool unpackS16(S16 &value, const char *name); - /*virtual*/ BOOL packU32(const U32 value, const char *name); - /*virtual*/ BOOL unpackU32(U32 &value, const char *name); + /*virtual*/ bool packU32(const U32 value, const char *name); + /*virtual*/ bool unpackU32(U32 &value, const char *name); - /*virtual*/ BOOL packS32(const S32 value, const char *name); - /*virtual*/ BOOL unpackS32(S32 &value, const char *name); + /*virtual*/ bool packS32(const S32 value, const char *name); + /*virtual*/ bool unpackS32(S32 &value, const char *name); - /*virtual*/ BOOL packF32(const F32 value, const char *name); - /*virtual*/ BOOL unpackF32(F32 &value, const char *name); + /*virtual*/ bool packF32(const F32 value, const char *name); + /*virtual*/ bool unpackF32(F32 &value, const char *name); - /*virtual*/ BOOL packColor4(const LLColor4 &value, const char *name); - /*virtual*/ BOOL unpackColor4(LLColor4 &value, const char *name); + /*virtual*/ bool packColor4(const LLColor4 &value, const char *name); + /*virtual*/ bool unpackColor4(LLColor4 &value, const char *name); - /*virtual*/ BOOL packColor4U(const LLColor4U &value, const char *name); - /*virtual*/ BOOL unpackColor4U(LLColor4U &value, const char *name); + /*virtual*/ bool packColor4U(const LLColor4U &value, const char *name); + /*virtual*/ bool unpackColor4U(LLColor4U &value, const char *name); - /*virtual*/ BOOL packVector2(const LLVector2 &value, const char *name); - /*virtual*/ BOOL unpackVector2(LLVector2 &value, const char *name); + /*virtual*/ bool packVector2(const LLVector2 &value, const char *name); + /*virtual*/ bool unpackVector2(LLVector2 &value, const char *name); - /*virtual*/ BOOL packVector3(const LLVector3 &value, const char *name); - /*virtual*/ BOOL unpackVector3(LLVector3 &value, const char *name); + /*virtual*/ bool packVector3(const LLVector3 &value, const char *name); + /*virtual*/ bool unpackVector3(LLVector3 &value, const char *name); - /*virtual*/ BOOL packVector4(const LLVector4 &value, const char *name); - /*virtual*/ BOOL unpackVector4(LLVector4 &value, const char *name); + /*virtual*/ bool packVector4(const LLVector4 &value, const char *name); + /*virtual*/ bool unpackVector4(LLVector4 &value, const char *name); - /*virtual*/ BOOL packUUID(const LLUUID &value, const char *name); - /*virtual*/ BOOL unpackUUID(LLUUID &value, const char *name); + /*virtual*/ bool packUUID(const LLUUID &value, const char *name); + /*virtual*/ bool unpackUUID(LLUUID &value, const char *name); - void setIncludeNames(BOOL b) { mIncludeNames = b; } + void setIncludeNames(bool b) { mIncludeNames = b; } // Include the trailing NULL so it's always a valid string S32 getCurrentSize() const { return (S32)(mCurBufferp - mBufferp) + 1; } @@ -296,7 +296,7 @@ public: S32 getBufferSize() const { return mBufferSize; } /*virtual*/ void reset() { mCurBufferp = mBufferp; mWriteEnabled = (mCurBufferp != NULL); } - /*virtual*/ BOOL hasNext() const { return getCurrentSize() < getBufferSize(); } + /*virtual*/ bool hasNext() const { return getCurrentSize() < getBufferSize(); } inline void freeBuffer(); inline void assignBuffer(char* bufferp, S32 size); @@ -304,15 +304,15 @@ public: protected: void writeIndentedName(const char *name); - BOOL getValueStr(const char *name, char *out_value, const S32 value_len); + bool getValueStr(const char *name, char *out_value, const S32 value_len); protected: - inline BOOL verifyLength(const S32 data_size, const char *name); + inline bool verifyLength(const S32 data_size, const char *name); char *mBufferp; char *mCurBufferp; S32 mBufferSize; - BOOL mIncludeNames; // useful for debugging, print the name of each field + bool mIncludeNames; // useful for debugging, print the name of each field }; inline void LLDataPackerAsciiBuffer::freeBuffer() @@ -320,7 +320,7 @@ inline void LLDataPackerAsciiBuffer::freeBuffer() delete [] mBufferp; mBufferp = mCurBufferp = NULL; mBufferSize = 0; - mWriteEnabled = FALSE; + mWriteEnabled = false; } inline void LLDataPackerAsciiBuffer::assignBuffer(char* bufferp, S32 size) @@ -328,19 +328,19 @@ inline void LLDataPackerAsciiBuffer::assignBuffer(char* bufferp, S32 size) mBufferp = bufferp; mCurBufferp = bufferp; mBufferSize = size; - mWriteEnabled = TRUE; + mWriteEnabled = true; } -inline BOOL LLDataPackerAsciiBuffer::verifyLength(const S32 data_size, const char *name) +inline bool LLDataPackerAsciiBuffer::verifyLength(const S32 data_size, const char *name) { if (mWriteEnabled && (mCurBufferp - mBufferp) > mBufferSize - data_size) { LL_WARNS() << "Buffer overflow in AsciiBuffer length verify, field name " << name << "!" << LL_ENDL; LL_WARNS() << "Current pos: " << (int)(mCurBufferp - mBufferp) << " Buffer size: " << mBufferSize << " Data size: " << data_size << LL_ENDL; - return FALSE; + return false; } - return TRUE; + return true; } class LLDataPackerAsciiFile : public LLDataPacker @@ -362,7 +362,7 @@ public: mOutputStream(&output_stream), mInputStream(NULL) { - mWriteEnabled = TRUE; + mWriteEnabled = true; } LLDataPackerAsciiFile(std::istream& input_stream, const S32 indent = 2) @@ -374,55 +374,55 @@ public: { } - /*virtual*/ BOOL packString(const std::string& value, const char *name); - /*virtual*/ BOOL unpackString(std::string& value, const char *name); + /*virtual*/ bool packString(const std::string& value, const char *name); + /*virtual*/ bool unpackString(std::string& value, const char *name); - /*virtual*/ BOOL packBinaryData(const U8 *value, S32 size, const char *name); - /*virtual*/ BOOL unpackBinaryData(U8 *value, S32 &size, const char *name); + /*virtual*/ bool packBinaryData(const U8 *value, S32 size, const char *name); + /*virtual*/ bool unpackBinaryData(U8 *value, S32 &size, const char *name); - /*virtual*/ BOOL packBinaryDataFixed(const U8 *value, S32 size, const char *name); - /*virtual*/ BOOL unpackBinaryDataFixed(U8 *value, S32 size, const char *name); + /*virtual*/ bool packBinaryDataFixed(const U8 *value, S32 size, const char *name); + /*virtual*/ bool unpackBinaryDataFixed(U8 *value, S32 size, const char *name); - /*virtual*/ BOOL packU8(const U8 value, const char *name); - /*virtual*/ BOOL unpackU8(U8 &value, const char *name); + /*virtual*/ bool packU8(const U8 value, const char *name); + /*virtual*/ bool unpackU8(U8 &value, const char *name); - /*virtual*/ BOOL packU16(const U16 value, const char *name); - /*virtual*/ BOOL unpackU16(U16 &value, const char *name); + /*virtual*/ bool packU16(const U16 value, const char *name); + /*virtual*/ bool unpackU16(U16 &value, const char *name); - /*virtual*/ BOOL packS16(const S16 value, const char *name); - /*virtual*/ BOOL unpackS16(S16 &value, const char *name); + /*virtual*/ bool packS16(const S16 value, const char *name); + /*virtual*/ bool unpackS16(S16 &value, const char *name); - /*virtual*/ BOOL packU32(const U32 value, const char *name); - /*virtual*/ BOOL unpackU32(U32 &value, const char *name); + /*virtual*/ bool packU32(const U32 value, const char *name); + /*virtual*/ bool unpackU32(U32 &value, const char *name); - /*virtual*/ BOOL packS32(const S32 value, const char *name); - /*virtual*/ BOOL unpackS32(S32 &value, const char *name); + /*virtual*/ bool packS32(const S32 value, const char *name); + /*virtual*/ bool unpackS32(S32 &value, const char *name); - /*virtual*/ BOOL packF32(const F32 value, const char *name); - /*virtual*/ BOOL unpackF32(F32 &value, const char *name); + /*virtual*/ bool packF32(const F32 value, const char *name); + /*virtual*/ bool unpackF32(F32 &value, const char *name); - /*virtual*/ BOOL packColor4(const LLColor4 &value, const char *name); - /*virtual*/ BOOL unpackColor4(LLColor4 &value, const char *name); + /*virtual*/ bool packColor4(const LLColor4 &value, const char *name); + /*virtual*/ bool unpackColor4(LLColor4 &value, const char *name); - /*virtual*/ BOOL packColor4U(const LLColor4U &value, const char *name); - /*virtual*/ BOOL unpackColor4U(LLColor4U &value, const char *name); + /*virtual*/ bool packColor4U(const LLColor4U &value, const char *name); + /*virtual*/ bool unpackColor4U(LLColor4U &value, const char *name); - /*virtual*/ BOOL packVector2(const LLVector2 &value, const char *name); - /*virtual*/ BOOL unpackVector2(LLVector2 &value, const char *name); + /*virtual*/ bool packVector2(const LLVector2 &value, const char *name); + /*virtual*/ bool unpackVector2(LLVector2 &value, const char *name); - /*virtual*/ BOOL packVector3(const LLVector3 &value, const char *name); - /*virtual*/ BOOL unpackVector3(LLVector3 &value, const char *name); + /*virtual*/ bool packVector3(const LLVector3 &value, const char *name); + /*virtual*/ bool unpackVector3(LLVector3 &value, const char *name); - /*virtual*/ BOOL packVector4(const LLVector4 &value, const char *name); - /*virtual*/ BOOL unpackVector4(LLVector4 &value, const char *name); + /*virtual*/ bool packVector4(const LLVector4 &value, const char *name); + /*virtual*/ bool unpackVector4(LLVector4 &value, const char *name); - /*virtual*/ BOOL packUUID(const LLUUID &value, const char *name); - /*virtual*/ BOOL unpackUUID(LLUUID &value, const char *name); + /*virtual*/ bool packUUID(const LLUUID &value, const char *name); + /*virtual*/ bool unpackUUID(LLUUID &value, const char *name); protected: void writeIndentedName(const char *name); - BOOL getValueStr(const char *name, char *out_value, const S32 value_len); + bool getValueStr(const char *name, char *out_value, const S32 value_len); - /*virtual*/ BOOL hasNext() const { return true; } + /*virtual*/ bool hasNext() const { return true; } protected: S32 mIndent; diff --git a/indra/llmessage/llfiltersd2xmlrpc.cpp b/indra/llmessage/llfiltersd2xmlrpc.cpp index df78652361..84b56d54bf 100644 --- a/indra/llmessage/llfiltersd2xmlrpc.cpp +++ b/indra/llmessage/llfiltersd2xmlrpc.cpp @@ -274,12 +274,12 @@ void LLFilterSD2XMLRPC::streamOut(std::ostream& ostr, const LLSD& sd) if(!buffer.empty()) { // *TODO: convert to LLBase64 - int b64_buffer_length = apr_base64_encode_len(buffer.size()); + int b64_buffer_length = apr_base64_encode_len(static_cast<int>(buffer.size())); char* b64_buffer = new char[b64_buffer_length]; b64_buffer_length = apr_base64_encode_binary( b64_buffer, &buffer[0], - buffer.size()); + static_cast<int>(buffer.size())); ostr.write(b64_buffer, b64_buffer_length - 1); delete[] b64_buffer; } diff --git a/indra/llmessage/llhost.cpp b/indra/llmessage/llhost.cpp index fe0b594d39..ace316512f 100644 --- a/indra/llmessage/llhost.cpp +++ b/indra/llmessage/llhost.cpp @@ -103,7 +103,7 @@ std::string LLHost::getHostName() const } } -BOOL LLHost::setHostByName(const std::string& hostname) +bool LLHost::setHostByName(const std::string& hostname) { hostent *he; std::string local_name(hostname); @@ -123,7 +123,7 @@ BOOL LLHost::setHostByName(const std::string& hostname) if (he) { mIP = *(U32 *)he->h_addr_list[0]; - return TRUE; + return true; } else { @@ -147,7 +147,7 @@ BOOL LLHost::setHostByName(const std::string& hostname) LL_WARNS() << "LLHost::setAddress(): unknown error - " << error_number << LL_ENDL; break; } - return FALSE; + return false; } } diff --git a/indra/llmessage/llhost.h b/indra/llmessage/llhost.h index 613c81168f..6824fa3d78 100644 --- a/indra/llmessage/llhost.h +++ b/indra/llmessage/llhost.h @@ -80,7 +80,7 @@ public: void setAddress( const std::string& ipstr ) { mIP = ip_string_to_u32(ipstr.c_str()); } void setAddress( U32 ip ) { mIP = ip; } void setPort( U32 port ) { mPort = port; } - BOOL setHostByName(const std::string& hname); + bool setHostByName(const std::string& hname); LLHost& operator=(const LLHost &rhs); void invalidate() { mIP = INVALID_HOST_IP_ADDRESS; mPort = INVALID_PORT;}; diff --git a/indra/llmessage/llinstantmessage.cpp b/indra/llmessage/llinstantmessage.cpp index 8708552122..4c62c07fcb 100644 --- a/indra/llmessage/llinstantmessage.cpp +++ b/indra/llmessage/llinstantmessage.cpp @@ -54,7 +54,7 @@ const S32 IM_TTL = 1; void pack_instant_message( LLMessageSystem* msg, const LLUUID& from_id, - BOOL from_group, + bool from_group, const LLUUID& session_id, const LLUUID& to_id, const std::string& name, @@ -93,7 +93,7 @@ void pack_instant_message( void pack_instant_message_block( LLMessageSystem* msg, const LLUUID& from_id, - BOOL from_group, + bool from_group, const LLUUID& session_id, const LLUUID& to_id, const std::string& name, diff --git a/indra/llmessage/llinstantmessage.h b/indra/llmessage/llinstantmessage.h index feb07c6b0f..d413e81c90 100644 --- a/indra/llmessage/llinstantmessage.h +++ b/indra/llmessage/llinstantmessage.h @@ -180,7 +180,7 @@ extern const S32 IM_TTL; void pack_instant_message( LLMessageSystem* msgsystem, const LLUUID& from_id, - BOOL from_group, + bool from_group, const LLUUID& session_id, const LLUUID& to_id, const std::string& name, @@ -198,7 +198,7 @@ void pack_instant_message( void pack_instant_message_block( LLMessageSystem* msgsystem, const LLUUID& from_id, - BOOL from_group, + bool from_group, const LLUUID& session_id, const LLUUID& to_id, const std::string& name, diff --git a/indra/llmessage/lliohttpserver.cpp b/indra/llmessage/lliohttpserver.cpp index 9791a20743..e562f09844 100644 --- a/indra/llmessage/lliohttpserver.cpp +++ b/indra/llmessage/lliohttpserver.cpp @@ -494,7 +494,7 @@ LLIOPipe::EStatus LLHTTPResponseHeader::process_impl( LLChangeChannel change(channels.in(), channels.out()); std::for_each(buffer->beginSegment(), buffer->endSegment(), change); std::string header = ostr.str(); - buffer->prepend(channels.out(), (U8*)header.c_str(), header.size()); + buffer->prepend(channels.out(), (U8*)header.c_str(), static_cast<S32>(header.size())); PUMP_DEBUG; return STATUS_DONE; } diff --git a/indra/llmessage/lliosocket.cpp b/indra/llmessage/lliosocket.cpp index a14d10fe5f..f2192acee0 100644 --- a/indra/llmessage/lliosocket.cpp +++ b/indra/llmessage/lliosocket.cpp @@ -346,7 +346,7 @@ LLIOPipe::EStatus LLIOSocketReader::process_impl( PUMP_DEBUG; len = READ_BUFFER_SIZE; status = apr_socket_recv(mSource->getSocket(), read_buf, &len); - buffer->append(channels.out(), (U8*)read_buf, len); + buffer->append(channels.out(), (U8*)read_buf, static_cast<S32>(len)); } while((APR_SUCCESS == status) && (READ_BUFFER_SIZE == len)); LL_DEBUGS() << "socket read status: " << status << LL_ENDL; LLIOPipe::EStatus rv = STATUS_OK; diff --git a/indra/llmessage/llmail.cpp b/indra/llmessage/llmail.cpp index 4e5cf8ed48..9e10a356db 100644 --- a/indra/llmessage/llmail.cpp +++ b/indra/llmessage/llmail.cpp @@ -99,10 +99,10 @@ void disconnect_smtp() } } -// Returns TRUE on success. +// Returns true on success. // message should NOT be SMTP escaped. // static -BOOL LLMail::send( +bool LLMail::send( const char* from_name, const char* from_address, const char* to_name, @@ -120,7 +120,7 @@ BOOL LLMail::send( headers); if(header.empty()) { - return FALSE; + return false; } std::string message_str; @@ -129,8 +129,8 @@ BOOL LLMail::send( message_str = message; } bool rv = send(header, message_str, to_address, from_address); - if(rv) return TRUE; - return FALSE; + if(rv) return true; + return false; } // static @@ -273,7 +273,7 @@ bool LLMail::send( std::string good_string = "\n..\n"; while (1) { - int index = message.find(bad_string); + auto index = message.find(bad_string); if (index == std::string::npos) break; message.replace(index, bad_string.size(), good_string); } diff --git a/indra/llmessage/llmail.h b/indra/llmessage/llmail.h index f437eb4db8..d67b89d1ea 100644 --- a/indra/llmessage/llmail.h +++ b/indra/llmessage/llmail.h @@ -48,7 +48,7 @@ public: * @param to_address The email recipient address * @param subject The subject of the email * @param headers optional X-Foo headers in an llsd map. - * @return Returns TRUE if the call succeeds, FALSE otherwise. + * @return Returns true if the call succeeds, false otherwise. * * Results in: * From: "from_name" <from_address> @@ -57,7 +57,7 @@ public: * * message */ - static BOOL send( + static bool send( const char* from_name, const char* from_address, const char* to_name, diff --git a/indra/llmessage/llmessagebuilder.h b/indra/llmessage/llmessagebuilder.h index b35e973192..3f04857945 100644 --- a/indra/llmessage/llmessagebuilder.h +++ b/indra/llmessage/llmessagebuilder.h @@ -49,14 +49,14 @@ public: virtual void newMessage(const char* name) = 0; virtual void nextBlock(const char* blockname) = 0; - virtual BOOL removeLastBlock() = 0; // TODO: babbage: remove this horror + virtual bool removeLastBlock() = 0; // TODO: babbage: remove this horror /** All add* methods expect pointers to canonical strings. */ virtual void addBinaryData( const char* varname, const void* data, S32 size) = 0; - virtual void addBOOL(const char* varname, BOOL b) = 0; + virtual void addBOOL(const char* varname, bool b) = 0; virtual void addS8(const char* varname, S8 s) = 0; virtual void addU8(const char* varname, U8 u) = 0; virtual void addS16(const char* varname, S16 i) = 0; @@ -76,12 +76,12 @@ public: virtual void addString(const char* varname, const char* s) = 0; virtual void addString(const char* varname, const std::string& s) = 0; - virtual BOOL isMessageFull(const char* blockname) const = 0; + virtual bool isMessageFull(const char* blockname) const = 0; virtual void compressMessage(U8*& buf_ptr, U32& buffer_length) = 0; virtual S32 getMessageSize() = 0; - virtual BOOL isBuilt() const = 0; - virtual BOOL isClear() const = 0; + virtual bool isBuilt() const = 0; + virtual bool isClear() const = 0; virtual U32 buildMessage( U8* buffer, U32 buffer_size, @@ -90,7 +90,7 @@ public: virtual void clearMessage() = 0; // TODO: babbage: remove this horror - virtual void setBuilt(BOOL b) = 0; + virtual void setBuilt(bool b) = 0; virtual const char* getMessageName() const = 0; diff --git a/indra/llmessage/llmessagereader.cpp b/indra/llmessage/llmessagereader.cpp index bed8655cf7..4d4bf679ed 100644 --- a/indra/llmessage/llmessagereader.cpp +++ b/indra/llmessage/llmessagereader.cpp @@ -27,7 +27,7 @@ #include "linden_common.h" #include "llmessagereader.h" -static BOOL sTimeDecodes = FALSE; +static bool sTimeDecodes = false; static F32 sTimeDecodesSpamThreshold = 0.05f; @@ -38,7 +38,7 @@ LLMessageReader::~LLMessageReader() } //static -void LLMessageReader::setTimeDecodes(BOOL b) +void LLMessageReader::setTimeDecodes(bool b) { sTimeDecodes = b; } @@ -50,7 +50,7 @@ void LLMessageReader::setTimeDecodesSpamThreshold(F32 seconds) } //static -BOOL LLMessageReader::getTimeDecodes() +bool LLMessageReader::getTimeDecodes() { return sTimeDecodes; } diff --git a/indra/llmessage/llmessagereader.h b/indra/llmessage/llmessagereader.h index f4d5a4ce83..5bc9aea5e4 100644 --- a/indra/llmessage/llmessagereader.h +++ b/indra/llmessage/llmessagereader.h @@ -52,7 +52,7 @@ class LLMessageReader /** All get* methods expect pointers to canonical strings. */ virtual void getBinaryData(const char *blockname, const char *varname, void *datap, S32 size, S32 blocknum = 0, S32 max_size = S32_MAX) = 0; - virtual void getBOOL(const char *block, const char *var, BOOL &data, S32 blocknum = 0) = 0; + virtual void getBOOL(const char *block, const char *var, bool &data, S32 blocknum = 0) = 0; virtual void getS8(const char *block, const char *var, S8 &data, S32 blocknum = 0) = 0; virtual void getU8(const char *block, const char *var, U8 &data, S32 blocknum = 0) = 0; virtual void getS16(const char *block, const char *var, S16 &data, S32 blocknum = 0) = 0; @@ -84,8 +84,9 @@ class LLMessageReader virtual void copyToBuilder(LLMessageBuilder&) const = 0; - static void setTimeDecodes(BOOL b); - static BOOL getTimeDecodes(); + + static void setTimeDecodes(bool b); + static bool getTimeDecodes(); static void setTimeDecodesSpamThreshold(F32 seconds); static F32 getTimeDecodesSpamThreshold(); }; diff --git a/indra/llmessage/llmessagetemplate.h b/indra/llmessage/llmessagetemplate.h index 91d143b11e..e91d4346b6 100644 --- a/indra/llmessage/llmessagetemplate.h +++ b/indra/llmessage/llmessagetemplate.h @@ -361,14 +361,14 @@ public: mUserData = user_data; } - BOOL callHandlerFunc(LLMessageSystem *msgsystem) const + bool callHandlerFunc(LLMessageSystem *msgsystem) const { if (mHandlerFunc) { mHandlerFunc(msgsystem, mUserData); - return TRUE; + return true; } - return FALSE; + return false; } bool isUdpBanned() const diff --git a/indra/llmessage/llmessagetemplateparser.cpp b/indra/llmessage/llmessagetemplateparser.cpp index 4fb9257e90..cf1f49116e 100644 --- a/indra/llmessage/llmessagetemplateparser.cpp +++ b/indra/llmessage/llmessagetemplateparser.cpp @@ -42,7 +42,7 @@ // * - repeat last check // checks 'a' -BOOL b_return_alphanumeric_ok(char c) +bool b_return_alphanumeric_ok(char c) { if ( ( (c < 'A') ||(c > 'Z')) @@ -51,26 +51,26 @@ BOOL b_return_alphanumeric_ok(char c) &&( (c < '0') ||(c > '9'))) { - return FALSE; + return false; } - return TRUE; + return true; } // checks 'c' -BOOL b_return_character_ok(char c) +bool b_return_character_ok(char c) { if ( ( (c < 'A') ||(c > 'Z')) &&( (c < 'a') ||(c > 'z'))) { - return FALSE; + return false; } - return TRUE; + return true; } // checks 'f' -BOOL b_return_first_variable_ok(char c) +bool b_return_first_variable_ok(char c) { if ( ( (c < 'A') ||(c > 'Z')) @@ -78,13 +78,13 @@ BOOL b_return_first_variable_ok(char c) ||(c > 'z')) &&(c != '_')) { - return FALSE; + return false; } - return TRUE; + return true; } // checks 'v' -BOOL b_return_variable_ok(char c) +bool b_return_variable_ok(char c) { if ( ( (c < 'A') ||(c > 'Z')) @@ -94,35 +94,35 @@ BOOL b_return_variable_ok(char c) ||(c > '9')) &&(c != '_')) { - return FALSE; + return false; } - return TRUE; + return true; } // checks 's' -BOOL b_return_signed_integer_ok(char c) +bool b_return_signed_integer_ok(char c) { if ( ( (c < '0') ||(c > '9')) &&(c != '-')) { - return FALSE; + return false; } - return TRUE; + return true; } // checks 'd' -BOOL b_return_integer_ok(char c) +bool b_return_integer_ok(char c) { if ( (c < '0') ||(c > '9')) { - return FALSE; + return false; } - return TRUE; + return true; } -BOOL (*gParseCheckCharacters[])(char c) = +bool (*gParseCheckCharacters[])(char c) = { b_return_alphanumeric_ok, b_return_character_ok, @@ -156,7 +156,7 @@ S32 get_checker_number(char checker) } // check token based on passed simplified regular expression -BOOL b_check_token(const char *token, const char *regexp) +bool b_check_token(const char *token, const char *regexp) { S32 tptr, rptr = 0; S32 current_checker, next_checker = 0; @@ -166,13 +166,13 @@ BOOL b_check_token(const char *token, const char *regexp) if (current_checker == -1) { LL_ERRS() << "Invalid regular expression value!" << LL_ENDL; - return FALSE; + return false; } if (current_checker == 9999) { LL_ERRS() << "Regular expression can't start with *!" << LL_ENDL; - return FALSE; + return false; } for (tptr = 0; token[tptr]; tptr++) @@ -180,12 +180,12 @@ BOOL b_check_token(const char *token, const char *regexp) if (current_checker == -1) { LL_ERRS() << "Input exceeds regular expression!\nDid you forget a *?" << LL_ENDL; - return FALSE; + return false; } if (!gParseCheckCharacters[current_checker](token[tptr])) { - return FALSE; + return false; } if (next_checker != 9999) { @@ -196,40 +196,40 @@ BOOL b_check_token(const char *token, const char *regexp) } } } - return TRUE; + return true; } // C variable can be made up of upper or lower case letters, underscores, or numbers, but can't start with a number -BOOL b_variable_ok(const char *token) +bool b_variable_ok(const char *token) { if (!b_check_token(token, "fv*")) { LL_WARNS() << "Token '" << token << "' isn't a variable!" << LL_ENDL; - return FALSE; + return false; } - return TRUE; + return true; } // An integer is made up of the digits 0-9 and may be preceded by a '-' -BOOL b_integer_ok(const char *token) +bool b_integer_ok(const char *token) { if (!b_check_token(token, "sd*")) { LL_WARNS() << "Token isn't an integer!" << LL_ENDL; - return FALSE; + return false; } - return TRUE; + return true; } // An integer is made up of the digits 0-9 -BOOL b_positive_integer_ok(const char *token) +bool b_positive_integer_ok(const char *token) { if (!b_check_token(token, "d*")) { LL_WARNS() << "Token isn't an integer!" << LL_ENDL; - return FALSE; + return false; } - return TRUE; + return true; } diff --git a/indra/llmessage/llmessagethrottle.cpp b/indra/llmessage/llmessagethrottle.cpp index ef4f3702fc..abcb1085ba 100644 --- a/indra/llmessage/llmessagethrottle.cpp +++ b/indra/llmessage/llmessagethrottle.cpp @@ -66,13 +66,13 @@ void LLMessageThrottle::pruneEntries() // Look for the first entry younger than the maximum age. F32 max_age = (F32)MAX_MESSAGE_AGE[cat]; - BOOL found = FALSE; + bool found = false; while (r_iterator != r_last && !found) { if ( LLFrameTimer::getTotalTime() - (*r_iterator).getEntryTime() < max_age ) { // We found a young enough entry. - found = TRUE; + found = true; // Did we find at least one entry to remove? if (r_iterator != message_list->rbegin()) @@ -95,7 +95,7 @@ void LLMessageThrottle::pruneEntries() } } -BOOL LLMessageThrottle::addViewerAlert(const LLUUID& to, const std::string& mesg) +bool LLMessageThrottle::addViewerAlert(const LLUUID& to, const std::string& mesg) { message_list_t* message_list = &(mMessageList[MTC_VIEWER_ALERT]); @@ -114,16 +114,16 @@ BOOL LLMessageThrottle::addViewerAlert(const LLUUID& to, const std::string& mesg { // This message was not found. Add it to the list. message_list->push_front(entry); - return TRUE; + return true; } else { // This message was already in the list. - return FALSE; + return false; } } -BOOL LLMessageThrottle::addAgentAlert(const LLUUID& agent, const LLUUID& task, const std::string& mesg) +bool LLMessageThrottle::addAgentAlert(const LLUUID& agent, const LLUUID& task, const std::string& mesg) { message_list_t* message_list = &(mMessageList[MTC_AGENT_ALERT]); @@ -142,12 +142,12 @@ BOOL LLMessageThrottle::addAgentAlert(const LLUUID& agent, const LLUUID& task, c { // This message was not found. Add it to the list. message_list->push_front(entry); - return TRUE; + return true; } else { // This message was already in the list. - return FALSE; + return false; } } diff --git a/indra/llmessage/llmessagethrottle.h b/indra/llmessage/llmessagethrottle.h index 8a96a6b589..295bddbd8c 100644 --- a/indra/llmessage/llmessagethrottle.h +++ b/indra/llmessage/llmessagethrottle.h @@ -59,8 +59,8 @@ public: LLMessageThrottle(); ~LLMessageThrottle(); - BOOL addViewerAlert (const LLUUID& to, const std::string& mesg); - BOOL addAgentAlert (const LLUUID& agent, const LLUUID& task, const std::string& mesg); + bool addViewerAlert (const LLUUID& to, const std::string& mesg); + bool addAgentAlert (const LLUUID& agent, const LLUUID& task, const std::string& mesg); void pruneEntries(); diff --git a/indra/llmessage/llnamevalue.cpp b/indra/llmessage/llnamevalue.cpp index 0e31a6d6e6..05ea3f26a1 100644 --- a/indra/llmessage/llnamevalue.cpp +++ b/indra/llmessage/llnamevalue.cpp @@ -676,13 +676,13 @@ LLVector3 *LLNameValue::getVec3() } -BOOL LLNameValue::sendToData() const +bool LLNameValue::sendToData() const { return (mSendto == NVS_DATA_SIM || mSendto == NVS_DATA_SIM_VIEWER); } -BOOL LLNameValue::sendToViewer() const +bool LLNameValue::sendToViewer() const { return (mSendto == NVS_SIM_VIEWER || mSendto == NVS_DATA_SIM_VIEWER); } diff --git a/indra/llmessage/llnamevalue.h b/indra/llmessage/llnamevalue.h index 4016c268d2..3c442df009 100644 --- a/indra/llmessage/llnamevalue.h +++ b/indra/llmessage/llnamevalue.h @@ -139,8 +139,8 @@ public: const char *getClass() const { return mStringClass; } const char *getSendto() const { return mStringSendto; } - BOOL sendToData() const; - BOOL sendToViewer() const; + bool sendToData() const; + bool sendToViewer() const; void callCallback(); std::string printNameValue() const; diff --git a/indra/llmessage/llpacketack.cpp b/indra/llmessage/llpacketack.cpp index 98302111ca..e66e8b0285 100644 --- a/indra/llmessage/llpacketack.cpp +++ b/indra/llmessage/llpacketack.cpp @@ -58,7 +58,7 @@ LLReliablePacket::LLReliablePacket( else { mRetries = 0; - mPingBasedRetry = TRUE; + mPingBasedRetry = true; mTimeout = F32Seconds(0.f); mCallback = NULL; mCallbackData = NULL; diff --git a/indra/llmessage/llpacketack.h b/indra/llmessage/llpacketack.h index b60861eac7..0903c01e14 100644 --- a/indra/llmessage/llpacketack.h +++ b/indra/llmessage/llpacketack.h @@ -35,7 +35,7 @@ class LLReliablePacketParams public: LLHost mHost; S32 mRetries; - BOOL mPingBasedRetry; + bool mPingBasedRetry; F32Seconds mTimeout; void (*mCallback)(void **,S32); void** mCallbackData; @@ -53,7 +53,7 @@ public: { mHost.invalidate(); mRetries = 0; - mPingBasedRetry = TRUE; + mPingBasedRetry = true; mTimeout = F32Seconds(0.f); mCallback = NULL; mCallbackData = NULL; @@ -63,7 +63,7 @@ public: void set( const LLHost& host, S32 retries, - BOOL ping_based_retry, + bool ping_based_retry, F32Seconds timeout, void (*callback)(void**,S32), void** callback_data, char* name) @@ -98,7 +98,7 @@ protected: S32 mSocket; LLHost mHost; S32 mRetries; - BOOL mPingBasedRetry; + bool mPingBasedRetry; F32Seconds mTimeout; void (*mCallback)(void**,S32); void** mCallbackData; diff --git a/indra/llmessage/llpacketring.cpp b/indra/llmessage/llpacketring.cpp index 122f7a8b5b..be838770a8 100644 --- a/indra/llmessage/llpacketring.cpp +++ b/indra/llmessage/llpacketring.cpp @@ -45,8 +45,8 @@ /////////////////////////////////////////////////////////// LLPacketRing::LLPacketRing () : - mUseInThrottle(FALSE), - mUseOutThrottle(FALSE), + mUseInThrottle(false), + mUseOutThrottle(false), mInThrottle(256000.f), mOutThrottle(64000.f), mActualBitsIn(0), @@ -97,12 +97,12 @@ void LLPacketRing::setDropPercentage (F32 percent_to_drop) mDropPercentage = percent_to_drop; } -void LLPacketRing::setUseInThrottle(const BOOL use_throttle) +void LLPacketRing::setUseInThrottle(const bool use_throttle) { mUseInThrottle = use_throttle; } -void LLPacketRing::setUseOutThrottle(const BOOL use_throttle) +void LLPacketRing::setUseOutThrottle(const bool use_throttle) { mUseOutThrottle = use_throttle; } @@ -161,7 +161,7 @@ S32 LLPacketRing::receivePacket (S32 socket, char *datap) // If using the throttle, simulate a limited size input buffer. if (mUseInThrottle) { - BOOL done = FALSE; + bool done = false; // push any current net packet (if any) onto delay ring while (!done) @@ -270,9 +270,9 @@ S32 LLPacketRing::receivePacket (S32 socket, char *datap) return packet_size; } -BOOL LLPacketRing::sendPacket(int h_socket, char * send_buffer, S32 buf_size, LLHost host) +bool LLPacketRing::sendPacket(int h_socket, char * send_buffer, S32 buf_size, LLHost host) { - BOOL status = TRUE; + bool status = true; if (!mUseOutThrottle) { return sendPacketImpl(h_socket, send_buffer, buf_size, host ); @@ -344,7 +344,7 @@ BOOL LLPacketRing::sendPacket(int h_socket, char * send_buffer, S32 buf_size, LL return status; } -BOOL LLPacketRing::sendPacketImpl(int h_socket, const char * send_buffer, S32 buf_size, LLHost host) +bool LLPacketRing::sendPacketImpl(int h_socket, const char * send_buffer, S32 buf_size, LLHost host) { if (!LLProxy::isSOCKSProxyEnabled()) diff --git a/indra/llmessage/llpacketring.h b/indra/llmessage/llpacketring.h index 4f90112412..f0e95f8524 100644 --- a/indra/llmessage/llpacketring.h +++ b/indra/llmessage/llpacketring.h @@ -46,14 +46,14 @@ public: void dropPackets(U32); void setDropPercentage (F32 percent_to_drop); - void setUseInThrottle(const BOOL use_throttle); - void setUseOutThrottle(const BOOL use_throttle); + void setUseInThrottle(const bool use_throttle); + void setUseOutThrottle(const bool use_throttle); void setInBandwidth(const F32 bps); void setOutBandwidth(const F32 bps); S32 receivePacket (S32 socket, char *datap); S32 receiveFromRing (S32 socket, char *datap); - BOOL sendPacket(int h_socket, char * send_buffer, S32 buf_size, LLHost host); + bool sendPacket(int h_socket, char * send_buffer, S32 buf_size, LLHost host); inline LLHost getLastSender(); inline LLHost getLastReceivingInterface(); @@ -61,8 +61,8 @@ public: S32 getAndResetActualInBits() { S32 bits = mActualBitsIn; mActualBitsIn = 0; return bits;} S32 getAndResetActualOutBits() { S32 bits = mActualBitsOut; mActualBitsOut = 0; return bits;} protected: - BOOL mUseInThrottle; - BOOL mUseOutThrottle; + bool mUseInThrottle; + bool mUseOutThrottle; // For simulating a lower-bandwidth connection - BPS LLThrottle mInThrottle; @@ -84,7 +84,7 @@ protected: LLHost mLastReceivingIF; private: - BOOL sendPacketImpl(int h_socket, const char * send_buffer, S32 buf_size, LLHost host); + bool sendPacketImpl(int h_socket, const char * send_buffer, S32 buf_size, LLHost host); }; diff --git a/indra/llmessage/llpartdata.cpp b/indra/llmessage/llpartdata.cpp index 320b61b905..d4cf95c1e3 100644 --- a/indra/llmessage/llpartdata.cpp +++ b/indra/llmessage/llpartdata.cpp @@ -71,31 +71,31 @@ S32 LLPartData::getSize() const } -BOOL LLPartData::unpackLegacy(LLDataPacker &dp) +bool LLPartData::unpackLegacy(LLDataPacker &dp) { LLColor4U coloru; dp.unpackU32(mFlags, "pdflags"); - dp.unpackFixed(mMaxAge, "pdmaxage", FALSE, 8, 8); + dp.unpackFixed(mMaxAge, "pdmaxage", false, 8, 8); dp.unpackColor4U(coloru, "pdstartcolor"); mStartColor.setVec(coloru); dp.unpackColor4U(coloru, "pdendcolor"); mEndColor.setVec(coloru); - dp.unpackFixed(mStartScale.mV[0], "pdstartscalex", FALSE, 3, 5); - dp.unpackFixed(mStartScale.mV[1], "pdstartscaley", FALSE, 3, 5); - dp.unpackFixed(mEndScale.mV[0], "pdendscalex", FALSE, 3, 5); - dp.unpackFixed(mEndScale.mV[1], "pdendscaley", FALSE, 3, 5); + dp.unpackFixed(mStartScale.mV[0], "pdstartscalex", false, 3, 5); + dp.unpackFixed(mStartScale.mV[1], "pdstartscaley", false, 3, 5); + dp.unpackFixed(mEndScale.mV[0], "pdendscalex", false, 3, 5); + dp.unpackFixed(mEndScale.mV[1], "pdendscaley", false, 3, 5); mStartGlow = 0.f; mEndGlow = 0.f; mBlendFuncSource = LLPartData::LL_PART_BF_SOURCE_ALPHA; mBlendFuncDest = LLPartData::LL_PART_BF_ONE_MINUS_SOURCE_ALPHA; - return TRUE; + return true; } -BOOL LLPartData::unpack(LLDataPacker &dp) +bool LLPartData::unpack(LLDataPacker &dp) { S32 size = 0; dp.unpackS32(size, "partsize"); @@ -105,7 +105,7 @@ BOOL LLPartData::unpack(LLDataPacker &dp) if (mFlags & LL_PART_DATA_GLOW) { - if (size < PS_PART_DATA_GLOW_SIZE) return FALSE; + if (size < PS_PART_DATA_GLOW_SIZE) return false; U8 tmp_glow = 0; dp.unpackU8(tmp_glow,"pdstartglow"); @@ -123,7 +123,7 @@ BOOL LLPartData::unpack(LLDataPacker &dp) if (mFlags & LL_PART_DATA_BLEND) { - if (size < PS_PART_DATA_BLEND_SIZE) return FALSE; + if (size < PS_PART_DATA_BLEND_SIZE) return false; dp.unpackU8(mBlendFuncSource,"pdblendsource"); dp.unpackU8(mBlendFuncDest,"pdblenddest"); size -= PS_PART_DATA_BLEND_SIZE; @@ -144,11 +144,11 @@ BOOL LLPartData::unpack(LLDataPacker &dp) } //this particle system won't display properly, better to not show anything - return FALSE; + return false; } - return TRUE; + return true; } void LLPartData::setFlags(const U32 flags) @@ -240,44 +240,44 @@ LLPartSysData::LLPartSysData() mNumParticles = 0; } -BOOL LLPartSysData::unpackSystem(LLDataPacker &dp) +bool LLPartSysData::unpackSystem(LLDataPacker &dp) { dp.unpackU32(mCRC, "pscrc"); dp.unpackU32(mFlags, "psflags"); dp.unpackU8(mPattern, "pspattern"); - dp.unpackFixed(mMaxAge, "psmaxage", FALSE, 8, 8); - dp.unpackFixed(mStartAge, "psstartage", FALSE, 8, 8); - dp.unpackFixed(mInnerAngle, "psinnerangle", FALSE, 3, 5); - dp.unpackFixed(mOuterAngle, "psouterangle", FALSE, 3, 5); - dp.unpackFixed(mBurstRate, "psburstrate", FALSE, 8, 8); + dp.unpackFixed(mMaxAge, "psmaxage", false, 8, 8); + dp.unpackFixed(mStartAge, "psstartage", false, 8, 8); + dp.unpackFixed(mInnerAngle, "psinnerangle", false, 3, 5); + dp.unpackFixed(mOuterAngle, "psouterangle", false, 3, 5); + dp.unpackFixed(mBurstRate, "psburstrate", false, 8, 8); mBurstRate = llmax(0.01f, mBurstRate); - dp.unpackFixed(mBurstRadius, "psburstradius", FALSE, 8, 8); - dp.unpackFixed(mBurstSpeedMin, "psburstspeedmin", FALSE, 8, 8); - dp.unpackFixed(mBurstSpeedMax, "psburstspeedmax", FALSE, 8, 8); + dp.unpackFixed(mBurstRadius, "psburstradius", false, 8, 8); + dp.unpackFixed(mBurstSpeedMin, "psburstspeedmin", false, 8, 8); + dp.unpackFixed(mBurstSpeedMax, "psburstspeedmax", false, 8, 8); dp.unpackU8(mBurstPartCount, "psburstpartcount"); - dp.unpackFixed(mAngularVelocity.mV[0], "psangvelx", TRUE, 8, 7); - dp.unpackFixed(mAngularVelocity.mV[1], "psangvely", TRUE, 8, 7); - dp.unpackFixed(mAngularVelocity.mV[2], "psangvelz", TRUE, 8, 7); + dp.unpackFixed(mAngularVelocity.mV[0], "psangvelx", true, 8, 7); + dp.unpackFixed(mAngularVelocity.mV[1], "psangvely", true, 8, 7); + dp.unpackFixed(mAngularVelocity.mV[2], "psangvelz", true, 8, 7); - dp.unpackFixed(mPartAccel.mV[0], "psaccelx", TRUE, 8, 7); - dp.unpackFixed(mPartAccel.mV[1], "psaccely", TRUE, 8, 7); - dp.unpackFixed(mPartAccel.mV[2], "psaccelz", TRUE, 8, 7); + dp.unpackFixed(mPartAccel.mV[0], "psaccelx", true, 8, 7); + dp.unpackFixed(mPartAccel.mV[1], "psaccely", true, 8, 7); + dp.unpackFixed(mPartAccel.mV[2], "psaccelz", true, 8, 7); dp.unpackUUID(mPartImageID, "psuuid"); dp.unpackUUID(mTargetUUID, "pstargetuuid"); - return TRUE; + return true; } -BOOL LLPartSysData::unpackLegacy(LLDataPacker &dp) +bool LLPartSysData::unpackLegacy(LLDataPacker &dp) { unpackSystem(dp); mPartData.unpackLegacy(dp); - return TRUE; + return true; } -BOOL LLPartSysData::unpack(LLDataPacker &dp) +bool LLPartSysData::unpack(LLDataPacker &dp) { // syssize is currently unused. Adding now when modifying the 'version to make extensible in the future S32 size = 0; @@ -289,18 +289,18 @@ BOOL LLPartSysData::unpack(LLDataPacker &dp) //skip to LLPartData block U8 feh = 0; - for (U32 i = 0; i < size; ++i) + for (S32 i = 0; i < size; ++i) { dp.unpackU8(feh, "whippang"); } dp.unpackS32(size, "partsize"); //skip LLPartData block - for (U32 i = 0; i < size; ++i) + for (S32 i = 0; i < size; ++i) { dp.unpackU8(feh, "whippang"); } - return FALSE; + return false; } unpackSystem(dp); @@ -324,7 +324,7 @@ std::ostream& operator<<(std::ostream& s, const LLPartSysData &data) return s; } -BOOL LLPartSysData::isNullPS(const S32 block_num) +bool LLPartSysData::isNullPS(const S32 block_num) { U8 ps_data_block[PS_MAX_DATA_BLOCK_SIZE]; U32 crc; @@ -335,13 +335,13 @@ BOOL LLPartSysData::isNullPS(const S32 block_num) if (!size) { - return TRUE; + return true; } if (size > PS_MAX_DATA_BLOCK_SIZE) { //size is too big, newer particle version unsupported - return TRUE; + return true; } gMessageSystem->getBinaryData("ObjectData", "PSBlock", ps_data_block, size, block_num, PS_MAX_DATA_BLOCK_SIZE); @@ -355,7 +355,7 @@ BOOL LLPartSysData::isNullPS(const S32 block_num) if (tmp > PS_SYS_DATA_BLOCK_SIZE) { //unknown system data block size, don't know how to parse it, treat as NULL - return TRUE; + return true; } } @@ -363,12 +363,12 @@ BOOL LLPartSysData::isNullPS(const S32 block_num) if (crc == 0) { - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLPartSysData::unpackBlock(const S32 block_num) +bool LLPartSysData::unpackBlock(const S32 block_num) { U8 ps_data_block[PS_MAX_DATA_BLOCK_SIZE]; @@ -378,7 +378,7 @@ BOOL LLPartSysData::unpackBlock(const S32 block_num) if (size > PS_MAX_DATA_BLOCK_SIZE) { // Larger packets are newer and unsupported - return FALSE; + return false; } // Get from message diff --git a/indra/llmessage/llpartdata.h b/indra/llmessage/llpartdata.h index 35602dc949..49b9e51a3d 100644 --- a/indra/llmessage/llpartdata.h +++ b/indra/llmessage/llpartdata.h @@ -88,10 +88,10 @@ public: mParameter(0.f) { } - BOOL unpackLegacy(LLDataPacker &dp); - BOOL unpack(LLDataPacker &dp); + bool unpackLegacy(LLDataPacker &dp); + bool unpack(LLDataPacker &dp); - BOOL pack(LLDataPacker &dp); + bool pack(LLDataPacker &dp); bool hasGlow() const; bool hasBlendFunc() const; @@ -183,11 +183,11 @@ class LLPartSysData public: LLPartSysData(); - BOOL unpack(LLDataPacker &dp); - BOOL unpackLegacy(LLDataPacker &dp); - BOOL unpackBlock(const S32 block_num); + bool unpack(LLDataPacker &dp); + bool unpackLegacy(LLDataPacker &dp); + bool unpackBlock(const S32 block_num); - static BOOL isNullPS(const S32 block_num); // Returns FALSE if this is a "NULL" particle system (i.e. no system) + static bool isNullPS(const S32 block_num); // Returns false if this is a "NULL" particle system (i.e. no system) bool isLegacyCompatible() const; @@ -227,7 +227,7 @@ public: S32 getdataBlockSize() const; private: - BOOL unpackSystem(LLDataPacker &dp); + bool unpackSystem(LLDataPacker &dp); public: // Public because I'm lazy.... diff --git a/indra/llmessage/llproxy.cpp b/indra/llmessage/llproxy.cpp index 8a395c26a8..d713cb20d9 100644 --- a/indra/llmessage/llproxy.cpp +++ b/indra/llmessage/llproxy.cpp @@ -123,7 +123,7 @@ S32 LLProxy::proxyHandshake(LLHost proxy) // The server has requested a username/password combination std::string socks_username(getSocksUser()); std::string socks_password(getSocksPwd()); - U32 request_size = socks_username.size() + socks_password.size() + 3; + U32 request_size = static_cast<S32>(socks_username.size() + socks_password.size() + 3); char * password_auth = new char[request_size]; password_auth[0] = 0x01; password_auth[1] = (char)(socks_username.size()); diff --git a/indra/llmessage/llpumpio.cpp b/indra/llmessage/llpumpio.cpp index ec0d7fe4e4..e1cd70b216 100644 --- a/indra/llmessage/llpumpio.cpp +++ b/indra/llmessage/llpumpio.cpp @@ -181,12 +181,13 @@ bool LLPumpIO::prime(apr_pool_t* pool) { cleanup(); initialize(pool); - return ((pool == NULL) ? false : true); + return pool != nullptr; } bool LLPumpIO::addChain(const chain_t& chain, F32 timeout, bool has_curl_request) { - if(chain.empty()) return false; + if (chain.empty()) + return false; LLChainInfo info; info.mHasCurlRequest = has_curl_request; @@ -218,12 +219,13 @@ bool LLPumpIO::addChain( LLSD context, F32 timeout) { - // remember that if the caller is providing a full link // description, we need to have that description matched to a // particular buffer. - if(!data) return false; - if(links.empty()) return false; + if (!data) + return false; + if (links.empty()) + return false; #if LL_DEBUG_PIPE_TYPE_IN_PUMP LL_DEBUGS() << "LLPumpIO::addChain() " << links[0].mPipe << " '" @@ -243,10 +245,11 @@ bool LLPumpIO::addChain( bool LLPumpIO::setTimeoutSeconds(F32 timeout) { // If no chain is running, return failure. - if(mRunningChains.end() == mCurrentChain) + if (mRunningChains.end() == mCurrentChain) { return false; } + (*mCurrentChain).setTimeoutSeconds(timeout); return true; } @@ -254,7 +257,7 @@ bool LLPumpIO::setTimeoutSeconds(F32 timeout) void LLPumpIO::adjustTimeoutSeconds(F32 delta) { // Ensure a chain is running - if(mRunningChains.end() != mCurrentChain) + if (mRunningChains.end() != mCurrentChain) { (*mCurrentChain).adjustTimeoutSeconds(delta); } @@ -263,27 +266,27 @@ void LLPumpIO::adjustTimeoutSeconds(F32 delta) static std::string events_2_string(apr_int16_t events) { std::ostringstream ostr; - if(events & APR_POLLIN) + if (events & APR_POLLIN) { ostr << "read,"; } - if(events & APR_POLLPRI) + if (events & APR_POLLPRI) { ostr << "priority,"; } - if(events & APR_POLLOUT) + if (events & APR_POLLOUT) { ostr << "write,"; } - if(events & APR_POLLERR) + if (events & APR_POLLERR) { ostr << "error,"; } - if(events & APR_POLLHUP) + if (events & APR_POLLHUP) { ostr << "hangup,"; } - if(events & APR_POLLNVAL) + if (events & APR_POLLNVAL) { ostr << "invalid,"; } @@ -292,7 +295,8 @@ static std::string events_2_string(apr_int16_t events) bool LLPumpIO::setConditional(LLIOPipe* pipe, const apr_pollfd_t* poll) { - if(!pipe) return false; + if (!pipe) + return false; ll_debug_poll_fd("Set conditional", poll); LL_DEBUGS() << "Setting conditionals (" << (poll ? events_2_string(poll->reqevents) :"null") @@ -814,7 +818,7 @@ void LLPumpIO::rebuildPollset() running_chains_t::iterator run_end = mRunningChains.end(); for(; run_it != run_end; ++run_it) { - size += (*run_it).mDescriptors.size(); + size += static_cast<U32>((*run_it).mDescriptors.size()); } //LL_DEBUGS() << "found " << size << " descriptors." << LL_ENDL; if(size) diff --git a/indra/llmessage/llregionflags.h b/indra/llmessage/llregionflags.h index 71a7672337..2b7ba80a78 100644 --- a/indra/llmessage/llregionflags.h +++ b/indra/llmessage/llregionflags.h @@ -28,89 +28,94 @@ #define LL_LLREGIONFLAGS_H // Can you be hurt here? Should health be on? -const U64 REGION_FLAGS_ALLOW_DAMAGE = (1 << 0); +constexpr U64 REGION_FLAGS_ALLOW_DAMAGE = (1ULL << 0); // Can you make landmarks here? -const U64 REGION_FLAGS_ALLOW_LANDMARK = (1 << 1); +constexpr U64 REGION_FLAGS_ALLOW_LANDMARK = (1ULL << 1); // Do we reset the home position when someone teleports away from here? -const U64 REGION_FLAGS_ALLOW_SET_HOME = (1 << 2); +constexpr U64 REGION_FLAGS_ALLOW_SET_HOME = (1ULL << 2); // Do we reset the home position when someone teleports away from here? -const U64 REGION_FLAGS_RESET_HOME_ON_TELEPORT = (1 << 3); +constexpr U64 REGION_FLAGS_RESET_HOME_ON_TELEPORT = (1ULL << 3); // Does the sun move? -const U64 REGION_FLAGS_SUN_FIXED = (1 << 4); +constexpr U64 REGION_FLAGS_SUN_FIXED = (1ULL << 4); // Does the estate owner allow private parcels? -const U64 REGION_FLAGS_ALLOW_ACCESS_OVERRIDE = (1 << 5); +constexpr U64 REGION_FLAGS_ALLOW_ACCESS_OVERRIDE = (1ULL << 5); // Can't change the terrain heightfield, even on owned parcels, // but can plant trees and grass. -const U64 REGION_FLAGS_BLOCK_TERRAFORM = (1 << 6); +constexpr U64 REGION_FLAGS_BLOCK_TERRAFORM = (1ULL << 6); // Can't release, sell, or buy land. -const U64 REGION_FLAGS_BLOCK_LAND_RESELL = (1 << 7); +constexpr U64 REGION_FLAGS_BLOCK_LAND_RESELL = (1ULL << 7); // All content wiped once per night -const U64 REGION_FLAGS_SANDBOX = (1 << 8); +constexpr U64 REGION_FLAGS_SANDBOX = (1ULL << 8); -const U64 REGION_FLAGS_ALLOW_ENVIRONMENT_OVERRIDE = (1 << 9); +constexpr U64 REGION_FLAGS_ALLOW_ENVIRONMENT_OVERRIDE = (1ULL << 9); -const U64 REGION_FLAGS_SKIP_COLLISIONS = (1 << 12); // Pin all non agent rigid bodies -const U64 REGION_FLAGS_SKIP_SCRIPTS = (1 << 13); -const U64 REGION_FLAGS_SKIP_PHYSICS = (1 << 14); // Skip all physics -const U64 REGION_FLAGS_EXTERNALLY_VISIBLE = (1 << 15); -const U64 REGION_FLAGS_ALLOW_RETURN_ENCROACHING_OBJECT = (1 << 16); -const U64 REGION_FLAGS_ALLOW_RETURN_ENCROACHING_ESTATE_OBJECT = (1 << 17); -const U64 REGION_FLAGS_BLOCK_DWELL = (1 << 18); +constexpr U64 REGION_FLAGS_SKIP_COLLISIONS = (1ULL << 12); // Pin all non agent rigid bodies +constexpr U64 REGION_FLAGS_SKIP_SCRIPTS = (1ULL << 13); +constexpr U64 REGION_FLAGS_SKIP_PHYSICS = (1ULL << 14); // Skip all physics +constexpr U64 REGION_FLAGS_EXTERNALLY_VISIBLE = (1ULL << 15); +constexpr U64 REGION_FLAGS_ALLOW_RETURN_ENCROACHING_OBJECT = (1ULL << 16); +constexpr U64 REGION_FLAGS_ALLOW_RETURN_ENCROACHING_ESTATE_OBJECT = (1ULL << 17); +constexpr U64 REGION_FLAGS_BLOCK_DWELL = (1ULL << 18); // Is flight allowed? -const U64 REGION_FLAGS_BLOCK_FLY = (1 << 19); +constexpr U64 REGION_FLAGS_BLOCK_FLY = (1ULL << 19); // Is direct teleport (p2p) allowed? -const U64 REGION_FLAGS_ALLOW_DIRECT_TELEPORT = (1 << 20); +constexpr U64 REGION_FLAGS_ALLOW_DIRECT_TELEPORT = (1ULL << 20); // Is there an administrative override on scripts in the region at the // moment. This is the similar skip scripts, except this flag is // presisted in the database on an estate level. -const U64 REGION_FLAGS_ESTATE_SKIP_SCRIPTS = (1 << 21); +constexpr U64 REGION_FLAGS_ESTATE_SKIP_SCRIPTS = (1ULL << 21); -const U64 REGION_FLAGS_RESTRICT_PUSHOBJECT = (1 << 22); +constexpr U64 REGION_FLAGS_RESTRICT_PUSHOBJECT = (1ULL << 22); -const U64 REGION_FLAGS_DENY_ANONYMOUS = (1 << 23); +constexpr U64 REGION_FLAGS_DENY_ANONYMOUS = (1ULL << 23); -const U64 REGION_FLAGS_ALLOW_PARCEL_CHANGES = (1 << 26); +constexpr U64 REGION_FLAGS_ALLOW_PARCEL_CHANGES = (1ULL << 26); -const U64 REGION_FLAGS_BLOCK_FLYOVER = (1 << 27); +constexpr U64 REGION_FLAGS_BLOCK_FLYOVER = (1ULL << 27); -const U64 REGION_FLAGS_ALLOW_VOICE = (1 << 28); +constexpr U64 REGION_FLAGS_ALLOW_VOICE = (1ULL << 28); -const U64 REGION_FLAGS_BLOCK_PARCEL_SEARCH = (1 << 29); -const U64 REGION_FLAGS_DENY_AGEUNVERIFIED = (1 << 30); +constexpr U64 REGION_FLAGS_BLOCK_PARCEL_SEARCH = (1ULL << 29); +constexpr U64 REGION_FLAGS_DENY_AGEUNVERIFIED = (1ULL << 30); -const U64 REGION_FLAGS_DENY_BOTS = (1 << 31); +constexpr U64 REGION_FLAGS_DENY_BOTS = (1ULL << 31); -const U64 REGION_FLAGS_DEFAULT = REGION_FLAGS_ALLOW_LANDMARK | - REGION_FLAGS_ALLOW_SET_HOME | - REGION_FLAGS_ALLOW_PARCEL_CHANGES | - REGION_FLAGS_ALLOW_VOICE; +constexpr U64 REGION_FLAGS_DEFAULT = REGION_FLAGS_ALLOW_LANDMARK | + REGION_FLAGS_ALLOW_SET_HOME | + REGION_FLAGS_ALLOW_PARCEL_CHANGES | + REGION_FLAGS_ALLOW_VOICE; -const U64 REGION_FLAGS_PRELUDE_SET = REGION_FLAGS_RESET_HOME_ON_TELEPORT; -const U64 REGION_FLAGS_PRELUDE_UNSET = REGION_FLAGS_ALLOW_LANDMARK - | REGION_FLAGS_ALLOW_SET_HOME; +constexpr U64 REGION_FLAGS_PRELUDE_SET = REGION_FLAGS_RESET_HOME_ON_TELEPORT; +constexpr U64 REGION_FLAGS_PRELUDE_UNSET = REGION_FLAGS_ALLOW_LANDMARK | + REGION_FLAGS_ALLOW_SET_HOME; -const U64 REGION_FLAGS_ESTATE_MASK = REGION_FLAGS_EXTERNALLY_VISIBLE - | REGION_FLAGS_SUN_FIXED - | REGION_FLAGS_DENY_ANONYMOUS - | REGION_FLAGS_DENY_AGEUNVERIFIED; +constexpr U64 REGION_FLAGS_ESTATE_MASK = REGION_FLAGS_EXTERNALLY_VISIBLE | + REGION_FLAGS_SUN_FIXED | + REGION_FLAGS_DENY_ANONYMOUS | + REGION_FLAGS_DENY_AGEUNVERIFIED; -inline BOOL is_prelude( U64 flags ) +inline bool is_flag_set(U64 flags, U64 flag) +{ + return (flags & flag) != 0; +} + +inline bool is_prelude( U64 flags ) { // definition of prelude does not depend on fixed-sun - return 0 == (flags & REGION_FLAGS_PRELUDE_UNSET) - && 0 != (flags & REGION_FLAGS_PRELUDE_SET); + return !is_flag_set(flags, REGION_FLAGS_PRELUDE_UNSET) && + is_flag_set(flags, REGION_FLAGS_PRELUDE_SET); } inline U64 set_prelude_flags(U64 flags) @@ -128,79 +133,75 @@ inline U64 unset_prelude_flags(U64 flags) } // Region protocols -const U64 REGION_PROTOCOLS_AGENT_APPEARANCE_SERVICE = (1 << 0); +constexpr U64 REGION_PROTOCOLS_AGENT_APPEARANCE_SERVICE = (1ULL << 0); // estate constants. Need to match first few etries in indra.estate table. -const U32 ESTATE_ALL = 0; // will not match in db, reserved key for logic -const U32 ESTATE_MAINLAND = 1; -const U32 ESTATE_ORIENTATION = 2; -const U32 ESTATE_INTERNAL = 3; -const U32 ESTATE_SHOWCASE = 4; -const U32 ESTATE_TEEN = 5; -const U32 ESTATE_LAST_LINDEN = 5; // last linden owned/managed estate +constexpr U32 ESTATE_ALL = 0; // will not match in db, reserved key for logic +constexpr U32 ESTATE_MAINLAND = 1; +constexpr U32 ESTATE_ORIENTATION = 2; +constexpr U32 ESTATE_INTERNAL = 3; +constexpr U32 ESTATE_SHOWCASE = 4; +constexpr U32 ESTATE_TEEN = 5; +constexpr U32 ESTATE_LAST_LINDEN = 5; // last linden owned/managed estate // for EstateOwnerRequest, setaccess message -const U32 ESTATE_ACCESS_ALLOWED_AGENTS = 1 << 0; -const U32 ESTATE_ACCESS_ALLOWED_GROUPS = 1 << 1; -const U32 ESTATE_ACCESS_BANNED_AGENTS = 1 << 2; -const U32 ESTATE_ACCESS_MANAGERS = 1 << 3; +constexpr U32 ESTATE_ACCESS_ALLOWED_AGENTS = 1 << 0; +constexpr U32 ESTATE_ACCESS_ALLOWED_GROUPS = 1 << 1; +constexpr U32 ESTATE_ACCESS_BANNED_AGENTS = 1 << 2; +constexpr U32 ESTATE_ACCESS_MANAGERS = 1 << 3; //maximum number of access list entries we can fit in one packet -const S32 ESTATE_ACCESS_MAX_ENTRIES_PER_PACKET = 63; +constexpr S32 ESTATE_ACCESS_MAX_ENTRIES_PER_PACKET = 63; // for reply to "getinfo", don't need to forward to all sims in estate -const U32 ESTATE_ACCESS_SEND_TO_AGENT_ONLY = 1 << 4; +constexpr U32 ESTATE_ACCESS_SEND_TO_AGENT_ONLY = 1 << 4; -const U32 ESTATE_ACCESS_ALL = ESTATE_ACCESS_ALLOWED_AGENTS - | ESTATE_ACCESS_ALLOWED_GROUPS - | ESTATE_ACCESS_BANNED_AGENTS - | ESTATE_ACCESS_MANAGERS; +constexpr U32 ESTATE_ACCESS_ALL = ESTATE_ACCESS_ALLOWED_AGENTS + | ESTATE_ACCESS_ALLOWED_GROUPS + | ESTATE_ACCESS_BANNED_AGENTS + | ESTATE_ACCESS_MANAGERS; // for EstateOwnerRequest, estateaccessdelta, estateexperiencedelta messages -const U32 ESTATE_ACCESS_APPLY_TO_ALL_ESTATES = 1U << 0; -const U32 ESTATE_ACCESS_APPLY_TO_MANAGED_ESTATES = 1U << 1; - -const U32 ESTATE_ACCESS_ALLOWED_AGENT_ADD = 1U << 2; -const U32 ESTATE_ACCESS_ALLOWED_AGENT_REMOVE = 1U << 3; -const U32 ESTATE_ACCESS_ALLOWED_GROUP_ADD = 1U << 4; -const U32 ESTATE_ACCESS_ALLOWED_GROUP_REMOVE = 1U << 5; -const U32 ESTATE_ACCESS_BANNED_AGENT_ADD = 1U << 6; -const U32 ESTATE_ACCESS_BANNED_AGENT_REMOVE = 1U << 7; -const U32 ESTATE_ACCESS_MANAGER_ADD = 1U << 8; -const U32 ESTATE_ACCESS_MANAGER_REMOVE = 1U << 9; -const U32 ESTATE_ACCESS_NO_REPLY = 1U << 10; -const U32 ESTATE_ACCESS_FAILED_BAN_ESTATE_MANAGER = 1U << 11; - -const S32 ESTATE_MAX_MANAGERS = 20; -const S32 ESTATE_MAX_ACCESS_IDS = 500; // max for access -const S32 ESTATE_MAX_BANNED_IDS = 750; // max for banned -const S32 ESTATE_MAX_GROUP_IDS = (S32) ESTATE_ACCESS_MAX_ENTRIES_PER_PACKET; +constexpr U32 ESTATE_ACCESS_APPLY_TO_ALL_ESTATES = 1U << 0; +constexpr U32 ESTATE_ACCESS_APPLY_TO_MANAGED_ESTATES = 1U << 1; + +constexpr U32 ESTATE_ACCESS_ALLOWED_AGENT_ADD = 1U << 2; +constexpr U32 ESTATE_ACCESS_ALLOWED_AGENT_REMOVE = 1U << 3; +constexpr U32 ESTATE_ACCESS_ALLOWED_GROUP_ADD = 1U << 4; +constexpr U32 ESTATE_ACCESS_ALLOWED_GROUP_REMOVE = 1U << 5; +constexpr U32 ESTATE_ACCESS_BANNED_AGENT_ADD = 1U << 6; +constexpr U32 ESTATE_ACCESS_BANNED_AGENT_REMOVE = 1U << 7; +constexpr U32 ESTATE_ACCESS_MANAGER_ADD = 1U << 8; +constexpr U32 ESTATE_ACCESS_MANAGER_REMOVE = 1U << 9; +constexpr U32 ESTATE_ACCESS_NO_REPLY = 1U << 10; +constexpr U32 ESTATE_ACCESS_FAILED_BAN_ESTATE_MANAGER = 1U << 11; + +constexpr S32 ESTATE_MAX_MANAGERS = 20; +constexpr S32 ESTATE_MAX_ACCESS_IDS = 500; // max for access +constexpr S32 ESTATE_MAX_BANNED_IDS = 750; // max for banned +constexpr S32 ESTATE_MAX_GROUP_IDS = (S32) ESTATE_ACCESS_MAX_ENTRIES_PER_PACKET; // 'Sim Wide Delete' flags -const U32 SWD_OTHERS_LAND_ONLY = (1 << 0); -const U32 SWD_ALWAYS_RETURN_OBJECTS = (1 << 1); -const U32 SWD_SCRIPTED_ONLY = (1 << 2); +constexpr U32 SWD_OTHERS_LAND_ONLY = (1 << 0); +constexpr U32 SWD_ALWAYS_RETURN_OBJECTS = (1 << 1); +constexpr U32 SWD_SCRIPTED_ONLY = (1 << 2); // Controls experience key validity in the estate -const U32 EXPERIENCE_KEY_TYPE_NONE = 0; -const U32 EXPERIENCE_KEY_TYPE_BLOCKED = 1; -const U32 EXPERIENCE_KEY_TYPE_ALLOWED = 2; -const U32 EXPERIENCE_KEY_TYPE_TRUSTED = 3; +constexpr U32 EXPERIENCE_KEY_TYPE_NONE = 0; +constexpr U32 EXPERIENCE_KEY_TYPE_BLOCKED = 1; +constexpr U32 EXPERIENCE_KEY_TYPE_ALLOWED = 2; +constexpr U32 EXPERIENCE_KEY_TYPE_TRUSTED = 3; -const U32 EXPERIENCE_KEY_TYPE_FIRST = EXPERIENCE_KEY_TYPE_BLOCKED; -const U32 EXPERIENCE_KEY_TYPE_LAST = EXPERIENCE_KEY_TYPE_TRUSTED; +constexpr U32 EXPERIENCE_KEY_TYPE_FIRST = EXPERIENCE_KEY_TYPE_BLOCKED; +constexpr U32 EXPERIENCE_KEY_TYPE_LAST = EXPERIENCE_KEY_TYPE_TRUSTED; // -const U32 ESTATE_EXPERIENCE_TRUSTED_ADD = 1U << 2; -const U32 ESTATE_EXPERIENCE_TRUSTED_REMOVE = 1U << 3; -const U32 ESTATE_EXPERIENCE_ALLOWED_ADD = 1U << 4; -const U32 ESTATE_EXPERIENCE_ALLOWED_REMOVE = 1U << 5; -const U32 ESTATE_EXPERIENCE_BLOCKED_ADD = 1U << 6; -const U32 ESTATE_EXPERIENCE_BLOCKED_REMOVE = 1U << 7; - -const S32 ESTATE_MAX_EXPERIENCE_IDS = 8; - - +constexpr U32 ESTATE_EXPERIENCE_TRUSTED_ADD = 1U << 2; +constexpr U32 ESTATE_EXPERIENCE_TRUSTED_REMOVE = 1U << 3; +constexpr U32 ESTATE_EXPERIENCE_ALLOWED_ADD = 1U << 4; +constexpr U32 ESTATE_EXPERIENCE_ALLOWED_REMOVE = 1U << 5; +constexpr U32 ESTATE_EXPERIENCE_BLOCKED_ADD = 1U << 6; +constexpr U32 ESTATE_EXPERIENCE_BLOCKED_REMOVE = 1U << 7; + +constexpr S32 ESTATE_MAX_EXPERIENCE_IDS = 8; #endif - - diff --git a/indra/llmessage/llregionhandle.h b/indra/llmessage/llregionhandle.h index 9982a8260e..d68cd4d202 100644 --- a/indra/llmessage/llregionhandle.h +++ b/indra/llmessage/llregionhandle.h @@ -63,13 +63,13 @@ inline U64 to_region_handle_global(const F32 x_global, const F32 y_global) return region_handle; } -inline BOOL to_region_handle(const F32 x_pos, const F32 y_pos, U64 *region_handle) +inline bool to_region_handle(const F32 x_pos, const F32 y_pos, U64 *region_handle) { U32 x_int, y_int; if (x_pos < 0.f) { // LL_WARNS() << "to_region_handle:Clamping negative x position " << x_pos << " to zero!" << LL_ENDL; - return FALSE; + return false; } else { @@ -78,14 +78,14 @@ inline BOOL to_region_handle(const F32 x_pos, const F32 y_pos, U64 *region_handl if (y_pos < 0.f) { // LL_WARNS() << "to_region_handle:Clamping negative y position " << y_pos << " to zero!" << LL_ENDL; - return FALSE; + return false; } else { y_int = (U32)ll_round(y_pos); } *region_handle = to_region_handle(x_int, y_int); - return TRUE; + return true; } // stuff the word-frame XY location of sim's SouthWest corner in x_pos, y_pos diff --git a/indra/llmessage/llsdmessagebuilder.cpp b/indra/llmessage/llsdmessagebuilder.cpp index 4c678b235b..8d7d51e13f 100644 --- a/indra/llmessage/llsdmessagebuilder.cpp +++ b/indra/llmessage/llsdmessagebuilder.cpp @@ -44,8 +44,8 @@ LLSDMessageBuilder::LLSDMessageBuilder() : mCurrentBlock(NULL), mCurrentMessageName(""), mCurrentBlockName(""), - mbSBuilt(FALSE), - mbSClear(TRUE) + mbSBuilt(false), + mbSClear(true) { } @@ -58,8 +58,8 @@ LLSDMessageBuilder::~LLSDMessageBuilder() // virtual void LLSDMessageBuilder::newMessage(const char* name) { - mbSBuilt = FALSE; - mbSClear = FALSE; + mbSBuilt = false; + mbSClear = false; mCurrentMessage = LLSD::emptyMap(); mCurrentMessageName = (char*)name; @@ -68,8 +68,8 @@ void LLSDMessageBuilder::newMessage(const char* name) // virtual void LLSDMessageBuilder::clearMessage() { - mbSBuilt = FALSE; - mbSClear = TRUE; + mbSBuilt = false; + mbSClear = true; mCurrentMessage = LLSD::emptyMap(); mCurrentMessageName = ""; @@ -96,10 +96,10 @@ void LLSDMessageBuilder::nextBlock(const char* blockname) } // TODO: Remove this horror... -BOOL LLSDMessageBuilder::removeLastBlock() +bool LLSDMessageBuilder::removeLastBlock() { /* TODO: finish implementing this */ - return FALSE; + return false; } void LLSDMessageBuilder::addBinaryData( @@ -168,9 +168,9 @@ void LLSDMessageBuilder::addIPPort(const char* varname, U16 v) (*mCurrentBlock)[varname] = v; } -void LLSDMessageBuilder::addBOOL(const char* varname, BOOL v) +void LLSDMessageBuilder::addBOOL(const char* varname, bool v) { - (*mCurrentBlock)[varname] = (v == TRUE); + (*mCurrentBlock)[varname] = v; } void LLSDMessageBuilder::addString(const char* varname, const char* v) @@ -218,9 +218,9 @@ void LLSDMessageBuilder::compressMessage(U8*& buf_ptr, U32& buffer_length) { } -BOOL LLSDMessageBuilder::isMessageFull(const char* blockname) const +bool LLSDMessageBuilder::isMessageFull(const char* blockname) const { - return FALSE; + return false; } U32 LLSDMessageBuilder::buildMessage(U8*, U32, U8) @@ -354,7 +354,7 @@ void LLSDMessageBuilder::copyFromMessageData(const LLMsgData& data) break; case MVT_BOOL: - addBOOL(varname, *(BOOL*)mvci.getData()); + addBOOL(varname, *(bool*)mvci.getData()); break; case MVT_IP_ADDR: @@ -400,13 +400,13 @@ const LLSD& LLSDMessageBuilder::getMessage() const } //virtual -void LLSDMessageBuilder::setBuilt(BOOL b) { mbSBuilt = b; } +void LLSDMessageBuilder::setBuilt(bool b) { mbSBuilt = b; } //virtual -BOOL LLSDMessageBuilder::isBuilt() const {return mbSBuilt;} +bool LLSDMessageBuilder::isBuilt() const {return mbSBuilt;} //virtual -BOOL LLSDMessageBuilder::isClear() const {return mbSClear;} +bool LLSDMessageBuilder::isClear() const {return mbSClear;} //virtual S32 LLSDMessageBuilder::getMessageSize() diff --git a/indra/llmessage/llsdmessagebuilder.h b/indra/llmessage/llsdmessagebuilder.h index 82c70202ee..72ea6d0dd6 100644 --- a/indra/llmessage/llsdmessagebuilder.h +++ b/indra/llmessage/llsdmessagebuilder.h @@ -48,14 +48,14 @@ public: virtual void newMessage(const char* name); virtual void nextBlock(const char* blockname); - virtual BOOL removeLastBlock(); // TODO: babbage: remove this horror... + virtual bool removeLastBlock(); // TODO: babbage: remove this horror... /** All add* methods expect pointers to canonical varname strings. */ virtual void addBinaryData( const char* varname, const void* data, S32 size); - virtual void addBOOL(const char* varname, BOOL b); + virtual void addBOOL(const char* varname, bool b); virtual void addS8(const char* varname, S8 s); virtual void addU8(const char* varname, U8 u); virtual void addS16(const char* varname, S16 i); @@ -75,18 +75,18 @@ public: virtual void addString(const char* varname, const char* s); virtual void addString(const char* varname, const std::string& s); - virtual BOOL isMessageFull(const char* blockname) const; + virtual bool isMessageFull(const char* blockname) const; virtual void compressMessage(U8*& buf_ptr, U32& buffer_length); - virtual BOOL isBuilt() const; - virtual BOOL isClear() const; + virtual bool isBuilt() const; + virtual bool isClear() const; virtual U32 buildMessage(U8* buffer, U32 buffer_size, U8 offset_to_data); /**< Null implementation which returns 0. */ virtual void clearMessage(); // TODO: babbage: remove this horror. - virtual void setBuilt(BOOL b); + virtual void setBuilt(bool b); virtual S32 getMessageSize(); virtual const char* getMessageName() const; @@ -119,8 +119,8 @@ private: LLSD* mCurrentBlock; std::string mCurrentMessageName; std::string mCurrentBlockName; - BOOL mbSBuilt; - BOOL mbSClear; + bool mbSBuilt; + bool mbSClear; }; #endif // LL_LLSDMESSAGEBUILDER_H diff --git a/indra/llmessage/llsdmessagereader.cpp b/indra/llmessage/llsdmessagereader.cpp index 00d962357b..6ade7c0dad 100644 --- a/indra/llmessage/llsdmessagereader.cpp +++ b/indra/llmessage/llsdmessagereader.cpp @@ -114,7 +114,7 @@ void LLSDMessageReader::getBinaryData(const char *block, const char *var, //virtual void LLSDMessageReader::getBOOL(const char *block, const char *var, - BOOL &data, + bool &data, S32 blocknum) { data = getLLSD(mMessage, block, var, blocknum); @@ -242,7 +242,7 @@ void LLSDMessageReader::getString(const char *block, const char *var, return; } std::string data = getLLSD(mMessage, block, var, blocknum); - S32 data_size = data.size(); + auto data_size = data.size(); if (data_size >= buffer_size) { data_size = buffer_size - 1; @@ -261,7 +261,7 @@ void LLSDMessageReader::getString(const char *block, const char *var, //virtual S32 LLSDMessageReader::getNumberOfBlocks(const char *blockname) { - return mMessage[blockname].size(); + return static_cast<S32>(mMessage[blockname].size()); } S32 getElementSize(const LLSD& llsd) @@ -276,7 +276,7 @@ S32 getElementSize(const LLSD& llsd) case LLSD::TypeReal: return sizeof(F64); case LLSD::TypeString: - return llsd.size(); + return static_cast<S32>(llsd.size()); case LLSD::TypeUUID: return sizeof(LLUUID); case LLSD::TypeDate: @@ -286,7 +286,7 @@ S32 getElementSize(const LLSD& llsd) case LLSD::TypeBinary: { std::vector<U8> data = llsd; - return data.size() * sizeof(U8); + return static_cast<S32>(data.size() * sizeof(U8)); } case LLSD::TypeMap: case LLSD::TypeArray: diff --git a/indra/llmessage/llsdmessagereader.h b/indra/llmessage/llsdmessagereader.h index 8f84c679ba..6f4256380b 100644 --- a/indra/llmessage/llsdmessagereader.h +++ b/indra/llmessage/llsdmessagereader.h @@ -46,7 +46,7 @@ public: virtual void getBinaryData(const char *block, const char *var, void *datap, S32 size, S32 blocknum = 0, S32 max_size = S32_MAX); - virtual void getBOOL(const char *block, const char *var, BOOL &data, + virtual void getBOOL(const char *block, const char *var, bool &data, S32 blocknum = 0); virtual void getS8(const char *block, const char *var, S8 &data, S32 blocknum = 0); diff --git a/indra/llmessage/lltemplatemessagebuilder.cpp b/indra/llmessage/lltemplatemessagebuilder.cpp index be5dcadb28..758d6d343f 100644 --- a/indra/llmessage/lltemplatemessagebuilder.cpp +++ b/indra/llmessage/lltemplatemessagebuilder.cpp @@ -42,8 +42,8 @@ LLTemplateMessageBuilder::LLTemplateMessageBuilder(const message_template_name_m mCurrentSDataBlock(NULL), mCurrentSMessageName(NULL), mCurrentSBlockName(NULL), - mbSBuilt(FALSE), - mbSClear(TRUE), + mbSBuilt(false), + mbSClear(true), mCurrentSendTotal(0), mMessageTemplates(name_template_map) { @@ -59,8 +59,8 @@ LLTemplateMessageBuilder::~LLTemplateMessageBuilder() // virtual void LLTemplateMessageBuilder::newMessage(const char *name) { - mbSBuilt = FALSE; - mbSClear = FALSE; + mbSBuilt = false; + mbSClear = false; mCurrentSendTotal = 0; @@ -103,8 +103,8 @@ void LLTemplateMessageBuilder::newMessage(const char *name) // virtual void LLTemplateMessageBuilder::clearMessage() { - mbSBuilt = FALSE; - mbSClear = TRUE; + mbSBuilt = false; + mbSClear = true; mCurrentSendTotal = 0; @@ -220,7 +220,7 @@ void LLTemplateMessageBuilder::nextBlock(const char* blockname) } // TODO: Remove this horror... -BOOL LLTemplateMessageBuilder::removeLastBlock() +bool LLTemplateMessageBuilder::removeLastBlock() { if (mCurrentSBlockName) { @@ -262,24 +262,24 @@ BOOL LLTemplateMessageBuilder::removeLastBlock() if (num_blocks <= 1) { - // we just blew away the last one, so return FALSE + // we just blew away the last one, so return false LL_WARNS() << "not blowing away the only block of message " << mCurrentSMessageName << ". Block: " << block_name << ". Number: " << num_blocks << LL_ENDL; - return FALSE; + return false; } else { // Decrement the counter. block_data->mBlockNumber--; - return TRUE; + return true; } } } } - return FALSE; + return false; } // add data to variable in current block @@ -445,10 +445,8 @@ void LLTemplateMessageBuilder::addIPPort(const char *varname, U16 u) addData(varname, &u, MVT_IP_PORT, sizeof(u)); } -void LLTemplateMessageBuilder::addBOOL(const char* varname, BOOL b) +void LLTemplateMessageBuilder::addBOOL(const char* varname, bool b) { - // Can't just cast a BOOL (actually a U32) to a U8. - // In some cases the low order bits will be zero. U8 temp = (b != 0); addData(varname, &temp, MVT_BOOL, sizeof(temp)); } @@ -584,15 +582,15 @@ void LLTemplateMessageBuilder::compressMessage(U8*& buf_ptr, U32& buffer_length) } } -BOOL LLTemplateMessageBuilder::isMessageFull(const char* blockname) const +bool LLTemplateMessageBuilder::isMessageFull(const char* blockname) const { if(mCurrentSendTotal > MTUBYTES) { - return TRUE; + return true; } if(!blockname) { - return FALSE; + return false; } char* bnamep = (char*)blockname; S32 max; @@ -614,9 +612,9 @@ BOOL LLTemplateMessageBuilder::isMessageFull(const char* blockname) const } if(mCurrentSMessageData->mMemberBlocks[bnamep]->mBlockNumber >= max) { - return TRUE; + return true; } - return FALSE; + return false; } static S32 buildBlock(U8* buffer, S32 buffer_size, const LLMessageBlock* template_data, LLMsgData* message_data) @@ -823,7 +821,7 @@ U32 LLTemplateMessageBuilder::buildMessage( { result += buildBlock(buffer + result, buffer_size - result, *iter, mCurrentSMessageData); } - mbSBuilt = TRUE; + mbSBuilt = true; return result; } @@ -877,13 +875,13 @@ void LLTemplateMessageBuilder::copyFromLLSD(const LLSD&) } //virtual -void LLTemplateMessageBuilder::setBuilt(BOOL b) { mbSBuilt = b; } +void LLTemplateMessageBuilder::setBuilt(bool b) { mbSBuilt = b; } //virtual -BOOL LLTemplateMessageBuilder::isBuilt() const {return mbSBuilt;} +bool LLTemplateMessageBuilder::isBuilt() const {return mbSBuilt;} //virtual -BOOL LLTemplateMessageBuilder::isClear() const {return mbSClear;} +bool LLTemplateMessageBuilder::isClear() const {return mbSClear;} //virtual S32 LLTemplateMessageBuilder::getMessageSize() {return mCurrentSendTotal;} diff --git a/indra/llmessage/lltemplatemessagebuilder.h b/indra/llmessage/lltemplatemessagebuilder.h index f399dc8acc..b86ec4d87d 100644 --- a/indra/llmessage/lltemplatemessagebuilder.h +++ b/indra/llmessage/lltemplatemessagebuilder.h @@ -49,12 +49,12 @@ public: virtual void newMessage(const char* name); virtual void nextBlock(const char* blockname); - virtual BOOL removeLastBlock(); // TODO: babbage: remove this horror... + virtual bool removeLastBlock(); // TODO: babbage: remove this horror... /** All add* methods expect pointers to canonical varname strings. */ virtual void addBinaryData(const char *varname, const void *data, S32 size); - virtual void addBOOL(const char* varname, BOOL b); + virtual void addBOOL(const char* varname, bool b); virtual void addS8(const char* varname, S8 s); virtual void addU8(const char* varname, U8 u); virtual void addS16(const char* varname, S16 i); @@ -74,18 +74,18 @@ public: virtual void addString(const char* varname, const char* s); virtual void addString(const char* varname, const std::string& s); - virtual BOOL isMessageFull(const char* blockname) const; + virtual bool isMessageFull(const char* blockname) const; virtual void compressMessage(U8*& buf_ptr, U32& buffer_length); - virtual BOOL isBuilt() const; - virtual BOOL isClear() const; + virtual bool isBuilt() const; + virtual bool isClear() const; virtual U32 buildMessage(U8* buffer, U32 buffer_size, U8 offset_to_data); /**< Return built message size */ virtual void clearMessage(); // TODO: babbage: remove this horror. - virtual void setBuilt(BOOL b); + virtual void setBuilt(bool b); virtual S32 getMessageSize(); virtual const char* getMessageName() const; @@ -106,8 +106,8 @@ private: LLMsgBlkData* mCurrentSDataBlock; char* mCurrentSMessageName; char* mCurrentSBlockName; - BOOL mbSBuilt; - BOOL mbSClear; + bool mbSBuilt; + bool mbSClear; S32 mCurrentSendTotal; const message_template_name_map_t& mMessageTemplates; }; diff --git a/indra/llmessage/lltemplatemessagedispatcher.cpp b/indra/llmessage/lltemplatemessagedispatcher.cpp index 267c201705..0e709d6c75 100644 --- a/indra/llmessage/lltemplatemessagedispatcher.cpp +++ b/indra/llmessage/lltemplatemessagedispatcher.cpp @@ -44,7 +44,7 @@ void LLTemplateMessageDispatcher::dispatch(const std::string& msg_name, LLHTTPNode::ResponsePtr responsep) { std::vector<U8> data = message["body"]["binary-template-data"].asBinary(); - U32 size = data.size(); + auto size = data.size(); if(size == 0) { return; @@ -53,7 +53,7 @@ void LLTemplateMessageDispatcher::dispatch(const std::string& msg_name, LLHost host; host = gMessageSystem->getSender(); - bool validate_message = mTemplateMessageReader.validateMessage(&(data[0]), data.size(), host, true); + bool validate_message = mTemplateMessageReader.validateMessage(&(data[0]), static_cast<S32>(size), host, true); if (validate_message) { diff --git a/indra/llmessage/lltemplatemessagereader.cpp b/indra/llmessage/lltemplatemessagereader.cpp index c24c850a86..1432fd1efd 100644 --- a/indra/llmessage/lltemplatemessagereader.cpp +++ b/indra/llmessage/lltemplatemessagereader.cpp @@ -287,11 +287,11 @@ void LLTemplateMessageReader::getU8(const char *block, const char *var, } void LLTemplateMessageReader::getBOOL(const char *block, const char *var, - BOOL &b, S32 blocknum ) + bool &b, S32 blocknum ) { U8 value(0); getData(block, var, &value, sizeof(U8), blocknum); - b = (BOOL) value; + b = (bool)value; } void LLTemplateMessageReader::getS16(const char *block, const char *var, @@ -446,7 +446,7 @@ S32 LLTemplateMessageReader::getMessageSize() const } // Returns template for the message contained in buffer -BOOL LLTemplateMessageReader::decodeTemplate( +bool LLTemplateMessageReader::decodeTemplate( const U8* buffer, S32 buffer_size, // inputs LLMessageTemplate** msg_template, bool custom ) // outputs { @@ -456,7 +456,7 @@ BOOL LLTemplateMessageReader::decodeTemplate( if (buffer_size <= 0) { LL_WARNS() << "No message waiting for decode!" << LL_ENDL; - return(FALSE); + return(false); } U32 num = 0; @@ -493,7 +493,7 @@ BOOL LLTemplateMessageReader::decodeTemplate( if (!custom) LL_WARNS() << "Packet with unusable length received (too short): " << buffer_size << LL_ENDL; - return(FALSE); + return(false); } LLMessageTemplate* temp = get_ptr_in_map(mMessageNumbers,num); @@ -508,10 +508,11 @@ BOOL LLTemplateMessageReader::decodeTemplate( LL_WARNS_ONCE() << "Message #" << std::hex << num << std::dec << " received but not registered!" << LL_ENDL; } - return(FALSE); + //gMessageSystem->callExceptionFunc(MX_UNREGISTERED_MESSAGE); + return(false); } - return(TRUE); + return(true); } void LLTemplateMessageReader::logRanOffEndOfPacket( const LLHost& host, const S32 where, const S32 wanted ) @@ -536,7 +537,7 @@ void LLTemplateMessageReader::logRanOffEndOfPacket( const LLHost& host, const S3 static LLTrace::BlockTimerStatHandle FTM_PROCESS_MESSAGES("Process Messages"); // decode a given message -BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender, bool custom ) +bool LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender, bool custom ) { LL_RECORD_BLOCK_TIME(FTM_PROCESS_MESSAGES); @@ -598,7 +599,7 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender, { if (!custom) LL_ERRS() << "Unknown block type" << LL_ENDL; - return FALSE; + return false; } LLMsgBlkData* cur_data_block = NULL; @@ -706,7 +707,7 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender, && !mCurrentRMessageTemplate->mMemberBlocks.empty()) { LL_WARNS() << "Empty message '" << mCurrentRMessageTemplate->mName << "' (no blocks)" << LL_ENDL; - return FALSE; + return false; } if (!custom) @@ -756,10 +757,10 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender, } } } - return TRUE; + return true; } -BOOL LLTemplateMessageReader::validateMessage(const U8* buffer, +bool LLTemplateMessageReader::validateMessage(const U8* buffer, S32 buffer_size, const LLHost& sender, bool trusted, @@ -783,7 +784,7 @@ BOOL LLTemplateMessageReader::validateMessage(const U8* buffer, << " from " << ((trusted) ? "trusted " : "untrusted ") << sender << LL_ENDL; - valid = FALSE; + valid = false; } if(valid && isUdpBanned()) @@ -791,12 +792,12 @@ BOOL LLTemplateMessageReader::validateMessage(const U8* buffer, LL_WARNS() << "Received UDP black listed message " << getMessageName() << " from " << sender << LL_ENDL; - valid = FALSE; + valid = false; } return valid; } -BOOL LLTemplateMessageReader::readMessage(const U8* buffer, +bool LLTemplateMessageReader::readMessage(const U8* buffer, const LLHost& sender) { return decodeData(buffer, sender); diff --git a/indra/llmessage/lltemplatemessagereader.h b/indra/llmessage/lltemplatemessagereader.h index 772b8fd607..0f7160d328 100644 --- a/indra/llmessage/lltemplatemessagereader.h +++ b/indra/llmessage/lltemplatemessagereader.h @@ -47,7 +47,7 @@ public: virtual void getBinaryData(const char *blockname, const char *varname, void *datap, S32 size, S32 blocknum = 0, S32 max_size = S32_MAX); - virtual void getBOOL(const char *block, const char *var, BOOL &data, + virtual void getBOOL(const char *block, const char *var, bool &data, S32 blocknum = 0); virtual void getS8(const char *block, const char *var, S8 &data, S32 blocknum = 0); @@ -98,15 +98,15 @@ public: virtual void copyToBuilder(LLMessageBuilder&) const; - BOOL validateMessage(const U8* buffer, S32 buffer_size, + bool validateMessage(const U8* buffer, S32 buffer_size, const LLHost& sender, bool trusted = false, bool custom = false); - BOOL readMessage(const U8* buffer, const LLHost& sender); + bool readMessage(const U8* buffer, const LLHost& sender); bool isTrusted() const; bool isBanned(bool trusted_source) const; bool isUdpBanned() const; - BOOL decodeData(const U8* buffer, const LLHost& sender, bool custom = false); + bool decodeData(const U8* buffer, const LLHost& sender, bool custom = false ); LLMessageTemplate* getTemplate(); private: @@ -114,13 +114,11 @@ private: void getData(const char *blockname, const char *varname, void *datap, S32 size = 0, S32 blocknum = 0, S32 max_size = S32_MAX); - BOOL decodeTemplate(const U8* buffer, S32 buffer_size, // inputs + bool decodeTemplate(const U8* buffer, S32 buffer_size, // inputs LLMessageTemplate** msg_template, bool custom = false ); // outputs void logRanOffEndOfPacket( const LLHost& host, const S32 where, const S32 wanted ); - //BOOL decodeData(const U8* buffer, const LLHost& sender ); - S32 mReceiveSize; LLMessageTemplate* mCurrentRMessageTemplate; LLMsgData* mCurrentRMessageData; diff --git a/indra/llmessage/llthrottle.cpp b/indra/llmessage/llthrottle.cpp index 0113414d1b..5ce96fc551 100644 --- a/indra/llmessage/llthrottle.cpp +++ b/indra/llmessage/llthrottle.cpp @@ -37,7 +37,7 @@ LLThrottle::LLThrottle(const F32 rate) mRate = rate; mAvailable = 0.f; mLookaheadSecs = 0.25f; - mLastSendTime = LLMessageSystem::getMessageTimeSeconds(TRUE); + mLastSendTime = LLMessageSystem::getMessageTimeSeconds(true); } @@ -57,9 +57,9 @@ F32 LLThrottle::getAvailable() return mAvailable + (mRate * elapsed_time.value()); } -BOOL LLThrottle::checkOverflow(const F32 amount) +bool LLThrottle::checkOverflow(const F32 amount) { - BOOL retval = TRUE; + bool retval = true; F32 lookahead_amount = mRate * mLookaheadSecs; @@ -72,17 +72,17 @@ BOOL LLThrottle::checkOverflow(const F32 amount) { // ...enough space to send this message // Also do if > lookahead so we can use if amount > capped amount. - retval = FALSE; + retval = false; } return retval; } -BOOL LLThrottle::throttleOverflow(const F32 amount) +bool LLThrottle::throttleOverflow(const F32 amount) { F32Seconds elapsed_time; F32 lookahead_amount; - BOOL retval = TRUE; + bool retval = true; lookahead_amount = mRate * mLookaheadSecs; @@ -97,12 +97,12 @@ BOOL LLThrottle::throttleOverflow(const F32 amount) // ...channel completely open, so allow send regardless // of size. This allows sends on very low BPS channels. mAvailable = lookahead_amount; - retval = FALSE; + retval = false; } else if (mAvailable > amount) { // ...enough space to send this message - retval = FALSE; + retval = false; } // We actually already sent the bits. @@ -236,15 +236,15 @@ void LLThrottleGroup::resetDynamicAdjust() } -BOOL LLThrottleGroup::setNominalBPS(F32* throttle_vec) +bool LLThrottleGroup::setNominalBPS(F32* throttle_vec) { - BOOL changed = FALSE; + bool changed = false; S32 i; for (i = 0; i < TC_EOF; i++) { if (mNominalBPS[i] != throttle_vec[i]) { - changed = TRUE; + changed = true; mNominalBPS[i] = throttle_vec[i]; } } @@ -285,9 +285,9 @@ S32 LLThrottleGroup::getAvailable(S32 throttle_cat) } -BOOL LLThrottleGroup::checkOverflow(S32 throttle_cat, F32 bits) +bool LLThrottleGroup::checkOverflow(S32 throttle_cat, F32 bits) { - BOOL retval = TRUE; + bool retval = true; F32 category_bps = mCurrentBPS[throttle_cat]; F32 lookahead_bits = category_bps * THROTTLE_LOOKAHEAD_TIME; @@ -302,23 +302,23 @@ BOOL LLThrottleGroup::checkOverflow(S32 throttle_cat, F32 bits) // ...channel completely open, so allow send regardless // of size. This allows sends on very low BPS channels. mBitsAvailable[throttle_cat] = lookahead_bits; - retval = FALSE; + retval = false; } else if ( bits_available > bits ) { // ...enough space to send this message - retval = FALSE; + retval = false; } return retval; } -BOOL LLThrottleGroup::throttleOverflow(S32 throttle_cat, F32 bits) +bool LLThrottleGroup::throttleOverflow(S32 throttle_cat, F32 bits) { F32Seconds elapsed_time; F32 category_bps; F32 lookahead_bits; - BOOL retval = TRUE; + bool retval = true; category_bps = mCurrentBPS[throttle_cat]; lookahead_bits = category_bps * THROTTLE_LOOKAHEAD_TIME; @@ -333,12 +333,12 @@ BOOL LLThrottleGroup::throttleOverflow(S32 throttle_cat, F32 bits) // ...channel completely open, so allow send regardless // of size. This allows sends on very low BPS channels. mBitsAvailable[throttle_cat] = lookahead_bits; - retval = FALSE; + retval = false; } else if ( mBitsAvailable[throttle_cat] > bits ) { // ...enough space to send this message - retval = FALSE; + retval = false; } // We actually already sent the bits. @@ -354,7 +354,7 @@ BOOL LLThrottleGroup::throttleOverflow(S32 throttle_cat, F32 bits) } -BOOL LLThrottleGroup::dynamicAdjust() +bool LLThrottleGroup::dynamicAdjust() { const F32Seconds DYNAMIC_ADJUST_TIME(1.0f); const F32 CURRENT_PERIOD_WEIGHT = .25f; // how much weight to give to last period while determining BPS utilization @@ -370,7 +370,7 @@ BOOL LLThrottleGroup::dynamicAdjust() // Only dynamically adjust every few seconds if ((mt_sec - mDynamicAdjustTime) < DYNAMIC_ADJUST_TIME) { - return FALSE; + return false; } mDynamicAdjustTime = mt_sec; @@ -394,11 +394,11 @@ BOOL LLThrottleGroup::dynamicAdjust() // Look for busy channels // TODO: Fold into loop above. - BOOL channels_busy = FALSE; + bool channels_busy = false; F32 busy_nominal_sum = 0; - BOOL channel_busy[TC_EOF]; - BOOL channel_idle[TC_EOF]; - BOOL channel_over_nominal[TC_EOF]; + bool channel_busy[TC_EOF]; + bool channel_idle[TC_EOF]; + bool channel_over_nominal[TC_EOF]; for (i = 0; i < TC_EOF; i++) { @@ -406,34 +406,34 @@ BOOL LLThrottleGroup::dynamicAdjust() if (mBitsSentHistory[i] >= BUSY_PERCENT * DYNAMIC_ADJUST_TIME.value() * mCurrentBPS[i]) { // this channel is busy - channels_busy = TRUE; + channels_busy = true; busy_nominal_sum += mNominalBPS[i]; // use for allocation of pooled idle bandwidth - channel_busy[i] = TRUE; + channel_busy[i] = true; } else { - channel_busy[i] = FALSE; + channel_busy[i] = false; } // Is this an idle channel? if ((mBitsSentHistory[i] < IDLE_PERCENT * DYNAMIC_ADJUST_TIME.value() * mCurrentBPS[i]) && (mBitsAvailable[i] > 0)) { - channel_idle[i] = TRUE; + channel_idle[i] = true; } else { - channel_idle[i] = FALSE; + channel_idle[i] = false; } // Is this an overpumped channel? if (mCurrentBPS[i] > mNominalBPS[i]) { - channel_over_nominal[i] = TRUE; + channel_over_nominal[i] = true; } else { - channel_over_nominal[i] = FALSE; + channel_over_nominal[i] = false; } } @@ -573,5 +573,5 @@ BOOL LLThrottleGroup::dynamicAdjust() } } } - return TRUE; + return true; } diff --git a/indra/llmessage/llthrottle.h b/indra/llmessage/llthrottle.h index 9450f4de88..b8a8c9f1f7 100644 --- a/indra/llmessage/llthrottle.h +++ b/indra/llmessage/llthrottle.h @@ -41,8 +41,8 @@ public: ~LLThrottle() { } void setRate(const F32 rate); - BOOL checkOverflow(const F32 amount); // I'm about to add an amount, TRUE if would overflow throttle - BOOL throttleOverflow(const F32 amount); // I just sent amount, TRUE if that overflowed the throttle + bool checkOverflow(const F32 amount); // I'm about to add an amount, true if would overflow throttle + bool throttleOverflow(const F32 amount); // I just sent amount, true if that overflowed the throttle F32 getAvailable(); // Return the available bits F32 getRate() const { return mRate; } @@ -73,10 +73,10 @@ public: ~LLThrottleGroup() { } void resetDynamicAdjust(); - BOOL checkOverflow(S32 throttle_cat, F32 bits); // I'm about to send bits, TRUE if would overflow channel - BOOL throttleOverflow(S32 throttle_cat, F32 bits); // I just sent bits, TRUE if that overflowed the channel - BOOL dynamicAdjust(); // Shift bandwidth from idle channels to busy channels, TRUE if adjustment occurred - BOOL setNominalBPS(F32* throttle_vec); // TRUE if any value was different, resets adjustment system if was different + bool checkOverflow(S32 throttle_cat, F32 bits); // I'm about to send bits, true if would overflow channel + bool throttleOverflow(S32 throttle_cat, F32 bits); // I just sent bits, true if that overflowed the channel + bool dynamicAdjust(); // Shift bandwidth from idle channels to busy channels, true if adjustment occurred + bool setNominalBPS(F32* throttle_vec); // true if any value was different, resets adjustment system if was different S32 getAvailable(S32 throttle_cat); // Return bits available in the channel diff --git a/indra/llmessage/lltransfermanager.cpp b/indra/llmessage/lltransfermanager.cpp index 7f6ff3b025..72d623ea42 100644 --- a/indra/llmessage/lltransfermanager.cpp +++ b/indra/llmessage/lltransfermanager.cpp @@ -49,7 +49,7 @@ LLTransferSource::stype_scfunc_map LLTransferSource::sSourceCreateMap; // LLTransferManager::LLTransferManager() : - mValid(FALSE) + mValid(false) { S32 i; for (i = 0; i < LLTTT_NUM_TYPES; i++) @@ -78,7 +78,7 @@ void LLTransferManager::init() { LL_ERRS() << "Double initializing LLTransferManager!" << LL_ENDL; } - mValid = TRUE; + mValid = true; // Register message system handlers gMessageSystem->setHandlerFunc("TransferRequest", processTransferRequest, NULL); @@ -90,7 +90,7 @@ void LLTransferManager::init() void LLTransferManager::cleanup() { - mValid = FALSE; + mValid = false; host_tc_map::iterator iter; for (iter = mTransferConnections.begin(); iter != mTransferConnections.end(); iter++) @@ -254,7 +254,7 @@ void LLTransferManager::processTransferRequest(LLMessageSystem *msgp, void **) msgp->getBinaryData("TransferInfo", "Params", tmp, size); LLDataPackerBinaryBuffer dpb(tmp, MAX_PARAMS_SIZE); - BOOL unpack_ok = tsp->unpackParams(dpb); + bool unpack_ok = tsp->unpackParams(dpb); if (!unpack_ok) { // This should only happen if the data is corrupt or @@ -342,7 +342,7 @@ void LLTransferManager::processTransferInfo(LLMessageSystem *msgp, void **) //LL_INFOS() << "Receiving " << transfer_id << ", size " << size << " bytes" << LL_ENDL; ttp->setSize(size); - ttp->setGotInfo(TRUE); + ttp->setGotInfo(true); // OK, at this point we to handle any delayed transfer packets (which could happen // if this packet was lost) @@ -505,7 +505,7 @@ void LLTransferManager::processTransferPacket(LLMessageSystem *msgp, void **) // NOTE: THERE IS A CUT AND PASTE OF THIS CODE IN THE TRANSFERINFO HANDLER // SO WE CAN PLAY BACK DELAYED PACKETS THERE!!!!!!!!!!!!!!!!!!!!!!!!! // - BOOL done = FALSE; + bool done = false; while (!done) { LLTSCode ret_code = ttp->dataCallback(packet_id, tmp_data, size); @@ -557,7 +557,7 @@ void LLTransferManager::processTransferPacket(LLMessageSystem *msgp, void **) else { // No matching delayed packet, abort it. - done = TRUE; + done = true; } } } @@ -780,7 +780,7 @@ void LLTransferSourceChannel::updateTransfers() LLPriQueueMap<LLTransferSource *>::pqm_iter iter, next; - BOOL done = FALSE; + bool done = false; for (iter = mTransferSources.mMap.begin(); (iter != mTransferSources.mMap.end()) && !done;) { //LL_INFOS() << "LLTransferSourceChannel::updateTransfers()" << LL_ENDL; @@ -791,7 +791,7 @@ void LLTransferSourceChannel::updateTransfers() LLTransferSource *tsp = iter->second; U8 *datap = NULL; S32 data_size = 0; - BOOL delete_data = FALSE; + bool delete_data = false; S32 packet_id = 0; S32 sent_bytes = 0; LLTSCode status = LLTS_OK; @@ -822,7 +822,7 @@ void LLTransferSourceChannel::updateTransfers() gMessageSystem->addS32("Status", status); gMessageSystem->addBinaryData("Data", datap, data_size); sent_bytes = gMessageSystem->getCurrentSendTotal(); - gMessageSystem->sendReliable(getHost(), LL_DEFAULT_RELIABLE_RETRIES, TRUE, F32Seconds(0.f), + gMessageSystem->sendReliable(getHost(), LL_DEFAULT_RELIABLE_RETRIES, true, F32Seconds(0.f), LLTransferManager::reliablePacketCallback, (void**)cb_uuid); // Do bookkeeping for the throttle @@ -1207,7 +1207,7 @@ LLTransferTarget::LLTransferTarget( mSourceType(source_type), mID(transfer_id), mChannelp(NULL), - mGotInfo(FALSE), + mGotInfo(false), mSize(0), mLastPacketID(-1) { @@ -1335,7 +1335,7 @@ void LLTransferSourceParamsInvItem::packParams(LLDataPacker &dp) const } -BOOL LLTransferSourceParamsInvItem::unpackParams(LLDataPacker &dp) +bool LLTransferSourceParamsInvItem::unpackParams(LLDataPacker &dp) { S32 tmp_at; @@ -1349,7 +1349,7 @@ BOOL LLTransferSourceParamsInvItem::unpackParams(LLDataPacker &dp) mAssetType = (LLAssetType::EType)tmp_at; - return TRUE; + return true; } LLTransferSourceParamsEstate::LLTransferSourceParamsEstate() : @@ -1387,7 +1387,7 @@ void LLTransferSourceParamsEstate::packParams(LLDataPacker &dp) const } -BOOL LLTransferSourceParamsEstate::unpackParams(LLDataPacker &dp) +bool LLTransferSourceParamsEstate::unpackParams(LLDataPacker &dp) { S32 tmp_et; @@ -1397,5 +1397,5 @@ BOOL LLTransferSourceParamsEstate::unpackParams(LLDataPacker &dp) mEstateAssetType = (EstateAssetType)tmp_et; - return TRUE; + return true; } diff --git a/indra/llmessage/lltransfermanager.h b/indra/llmessage/lltransfermanager.h index 9e42797c31..ada5528b49 100644 --- a/indra/llmessage/lltransfermanager.h +++ b/indra/llmessage/lltransfermanager.h @@ -121,7 +121,7 @@ public: LLTransferSource *findTransferSource(const LLUUID &transfer_id); - BOOL isValid() const { return mValid; } + bool isValid() const { return mValid; } static void processTransferRequest(LLMessageSystem *mesgsys, void **); static void processTransferInfo(LLMessageSystem *mesgsys, void **); @@ -138,13 +138,13 @@ public: void addTransferBitsOut(const LLTransferChannelType tctype, const S32 bits) { mTransferBitsOut[tctype] += bits; } protected: LLTransferConnection *getTransferConnection(const LLHost &host); - BOOL removeTransferConnection(const LLHost &host); + bool removeTransferConnection(const LLHost &host); protected: // Convenient typedefs typedef std::map<LLHost, LLTransferConnection *> host_tc_map; - BOOL mValid; + bool mValid; LLHost mHost; S32 mTransferBitsIn[LLTTT_NUM_TYPES]; @@ -263,7 +263,7 @@ public: virtual ~LLTransferSourceParams(); virtual void packParams(LLDataPacker &dp) const = 0; - virtual BOOL unpackParams(LLDataPacker &dp) = 0; + virtual bool unpackParams(LLDataPacker &dp) = 0; LLTransferSourceType getType() const { return mType; } @@ -300,13 +300,13 @@ protected: const S32 max_bytes, U8 **datap, S32 &returned_bytes, - BOOL &delete_returned) = 0; + bool &delete_returned) = 0; // The completionCallback is GUARANTEED to be called before the destructor. virtual void completionCallback(const LLTSCode status) = 0; virtual void packParams(LLDataPacker& dp) const = 0; - virtual BOOL unpackParams(LLDataPacker& dp) = 0; + virtual bool unpackParams(LLDataPacker& dp) = 0; virtual S32 getNextPacketID() { return mLastPacketID + 1; } virtual void setLastPacketID(const S32 packet_id) { mLastPacketID = packet_id; } @@ -408,8 +408,8 @@ protected: virtual S32 getNextPacketID() { return mLastPacketID + 1; } virtual void setLastPacketID(const S32 packet_id) { mLastPacketID = packet_id; } void setSize(const S32 size) { mSize = size; } - void setGotInfo(const BOOL got_info) { mGotInfo = got_info; } - BOOL gotInfo() const { return mGotInfo; } + void setGotInfo(const bool got_info) { mGotInfo = got_info; } + bool gotInfo() const { return mGotInfo; } bool addDelayedPacket( const S32 packet_id, @@ -425,7 +425,7 @@ protected: LLTransferSourceType mSourceType; LLUUID mID; LLTransferTargetChannel *mChannelp; - BOOL mGotInfo; + bool mGotInfo; S32 mSize; S32 mLastPacketID; @@ -440,7 +440,7 @@ public: LLTransferSourceParamsInvItem(); virtual ~LLTransferSourceParamsInvItem() {} /*virtual*/ void packParams(LLDataPacker &dp) const; - /*virtual*/ BOOL unpackParams(LLDataPacker &dp); + /*virtual*/ bool unpackParams(LLDataPacker &dp); void setAgentSession(const LLUUID &agent_id, const LLUUID &session_id); void setInvItem(const LLUUID &owner_id, const LLUUID &task_id, const LLUUID &item_id); @@ -472,7 +472,7 @@ public: LLTransferSourceParamsEstate(); virtual ~LLTransferSourceParamsEstate() {} /*virtual*/ void packParams(LLDataPacker &dp) const; - /*virtual*/ BOOL unpackParams(LLDataPacker &dp); + /*virtual*/ bool unpackParams(LLDataPacker &dp); void setAgentSession(const LLUUID &agent_id, const LLUUID &session_id); void setEstateAssetType(const EstateAssetType etype); diff --git a/indra/llmessage/lltransfersourceasset.cpp b/indra/llmessage/lltransfersourceasset.cpp index 3ffade9bdc..082f12b8bf 100644 --- a/indra/llmessage/lltransfersourceasset.cpp +++ b/indra/llmessage/lltransfersourceasset.cpp @@ -36,7 +36,7 @@ LLTransferSourceAsset::LLTransferSourceAsset(const LLUUID &request_id, const F32 priority) : LLTransferSource(LLTST_ASSET, request_id, priority), - mGotResponse(FALSE), + mGotResponse(false), mCurPos(0) { } @@ -62,7 +62,7 @@ void LLTransferSourceAsset::initTransfer() mParams.getAssetType(), LLTransferSourceAsset::responderCallback, tidp, - FALSE); + false); } else { @@ -91,7 +91,7 @@ LLTSCode LLTransferSourceAsset::dataCallback(const S32 packet_id, const S32 max_bytes, U8 **data_handle, S32 &returned_bytes, - BOOL &delete_returned) + bool &delete_returned) { //LL_INFOS() << "LLTransferSourceAsset::dataCallback" << LL_ENDL; if (!mGotResponse) @@ -120,7 +120,7 @@ LLTSCode LLTransferSourceAsset::dataCallback(const S32 packet_id, return LLTS_ERROR; } - delete_returned = TRUE; + delete_returned = true; U8 *tmpp = new U8[max_bytes]; *data_handle = tmpp; if (!vf.read(tmpp, max_bytes)) /* Flawfinder: Ignore */ @@ -129,7 +129,7 @@ LLTSCode LLTransferSourceAsset::dataCallback(const S32 packet_id, delete[] tmpp; *data_handle = NULL; returned_bytes = 0; - delete_returned = FALSE; + delete_returned = false; return LLTS_ERROR; } @@ -144,7 +144,7 @@ LLTSCode LLTransferSourceAsset::dataCallback(const S32 packet_id, delete[] tmpp; *data_handle = NULL; returned_bytes = 0; - delete_returned = FALSE; + delete_returned = false; } return LLTS_DONE; } @@ -164,7 +164,7 @@ void LLTransferSourceAsset::packParams(LLDataPacker& dp) const mParams.packParams(dp); } -BOOL LLTransferSourceAsset::unpackParams(LLDataPacker &dp) +bool LLTransferSourceAsset::unpackParams(LLDataPacker &dp) { //LL_INFOS() << "LLTransferSourceAsset::unpackParams" << LL_ENDL; return mParams.unpackParams(dp); @@ -194,7 +194,7 @@ void LLTransferSourceAsset::responderCallback(const LLUUID& uuid, LLAssetType::E LLTSCode status; - tsap->mGotResponse = TRUE; + tsap->mGotResponse = true; if (LL_ERR_NOERR == result) { // Everything's OK. @@ -240,7 +240,7 @@ void LLTransferSourceParamsAsset::packParams(LLDataPacker &dp) const } -BOOL LLTransferSourceParamsAsset::unpackParams(LLDataPacker &dp) +bool LLTransferSourceParamsAsset::unpackParams(LLDataPacker &dp) { S32 tmp_at; @@ -249,6 +249,6 @@ BOOL LLTransferSourceParamsAsset::unpackParams(LLDataPacker &dp) mAssetType = (LLAssetType::EType)tmp_at; - return TRUE; + return true; } diff --git a/indra/llmessage/lltransfersourceasset.h b/indra/llmessage/lltransfersourceasset.h index f241a1e4a1..6c4c39011a 100644 --- a/indra/llmessage/lltransfersourceasset.h +++ b/indra/llmessage/lltransfersourceasset.h @@ -38,7 +38,7 @@ public: LLTransferSourceParamsAsset(); virtual ~LLTransferSourceParamsAsset() {} /*virtual*/ void packParams(LLDataPacker &dp) const; - /*virtual*/ BOOL unpackParams(LLDataPacker &dp); + /*virtual*/ bool unpackParams(LLDataPacker &dp); void setAsset(const LLUUID &asset_id, const LLAssetType::EType asset_type); @@ -65,15 +65,15 @@ protected: const S32 max_bytes, U8 **datap, S32 &returned_bytes, - BOOL &delete_returned); + bool &delete_returned); /*virtual*/ void completionCallback(const LLTSCode status); virtual void packParams(LLDataPacker& dp) const; - /*virtual*/ BOOL unpackParams(LLDataPacker &dp); + /*virtual*/ bool unpackParams(LLDataPacker &dp); protected: LLTransferSourceParamsAsset mParams; - BOOL mGotResponse; + bool mGotResponse; S32 mCurPos; }; diff --git a/indra/llmessage/lltransfersourcefile.cpp b/indra/llmessage/lltransfersourcefile.cpp index ee0f176b9d..77a6c466c7 100644 --- a/indra/llmessage/lltransfersourcefile.cpp +++ b/indra/llmessage/lltransfersourcefile.cpp @@ -86,7 +86,7 @@ LLTSCode LLTransferSourceFile::dataCallback(const S32 packet_id, const S32 max_bytes, U8 **data_handle, S32 &returned_bytes, - BOOL &delete_returned) + bool &delete_returned) { //LL_INFOS() << "LLTransferSourceFile::dataCallback" << LL_ENDL; @@ -102,7 +102,7 @@ LLTSCode LLTransferSourceFile::dataCallback(const S32 packet_id, } // Grab up until the max number of bytes from the file. - delete_returned = TRUE; + delete_returned = true; U8 *tmpp = new U8[max_bytes]; *data_handle = tmpp; returned_bytes = (S32)fread(tmpp, 1, max_bytes, mFP); @@ -111,7 +111,7 @@ LLTSCode LLTransferSourceFile::dataCallback(const S32 packet_id, delete[] tmpp; *data_handle = NULL; returned_bytes = 0; - delete_returned = FALSE; + delete_returned = false; return LLTS_DONE; } @@ -141,7 +141,7 @@ void LLTransferSourceFile::packParams(LLDataPacker& dp) const mParams.packParams(dp); } -BOOL LLTransferSourceFile::unpackParams(LLDataPacker &dp) +bool LLTransferSourceFile::unpackParams(LLDataPacker &dp) { //LL_INFOS() << "LLTransferSourceFile::unpackParams" << LL_ENDL; return mParams.unpackParams(dp); @@ -150,7 +150,7 @@ BOOL LLTransferSourceFile::unpackParams(LLDataPacker &dp) LLTransferSourceParamsFile::LLTransferSourceParamsFile() : LLTransferSourceParams(LLTST_FILE), - mDeleteOnCompletion(FALSE) + mDeleteOnCompletion(false) { } @@ -162,7 +162,7 @@ void LLTransferSourceParamsFile::packParams(LLDataPacker &dp) const } -BOOL LLTransferSourceParamsFile::unpackParams(LLDataPacker &dp) +bool LLTransferSourceParamsFile::unpackParams(LLDataPacker &dp) { dp.unpackString(mFilename, "Filename"); U8 delete_flag; @@ -170,5 +170,5 @@ BOOL LLTransferSourceParamsFile::unpackParams(LLDataPacker &dp) mDeleteOnCompletion = delete_flag; LL_INFOS() << "Unpacked filename: " << mFilename << LL_ENDL; - return TRUE; + return true; } diff --git a/indra/llmessage/lltransfersourcefile.h b/indra/llmessage/lltransfersourcefile.h index a84e5066e3..a447ab091b 100644 --- a/indra/llmessage/lltransfersourcefile.h +++ b/indra/llmessage/lltransfersourcefile.h @@ -35,17 +35,17 @@ public: LLTransferSourceParamsFile(); virtual ~LLTransferSourceParamsFile() {} /*virtual*/ void packParams(LLDataPacker &dp) const; - /*virtual*/ BOOL unpackParams(LLDataPacker &dp); + /*virtual*/ bool unpackParams(LLDataPacker &dp); void setFilename(const std::string &filename) { mFilename = filename; } std::string getFilename() const { return mFilename; } - void setDeleteOnCompletion(BOOL enabled) { mDeleteOnCompletion = enabled; } - BOOL getDeleteOnCompletion() { return mDeleteOnCompletion; } + void setDeleteOnCompletion(bool enabled) { mDeleteOnCompletion = enabled; } + bool getDeleteOnCompletion() { return mDeleteOnCompletion; } protected: std::string mFilename; // ONLY DELETE THINGS OFF THE SIM IF THE FILENAME BEGINS IN 'TEMP' - BOOL mDeleteOnCompletion; + bool mDeleteOnCompletion; }; class LLTransferSourceFile : public LLTransferSource @@ -61,11 +61,11 @@ protected: const S32 max_bytes, U8 **datap, S32 &returned_bytes, - BOOL &delete_returned); + bool &delete_returned); /*virtual*/ void completionCallback(const LLTSCode status); virtual void packParams(LLDataPacker& dp) const; - /*virtual*/ BOOL unpackParams(LLDataPacker &dp); + /*virtual*/ bool unpackParams(LLDataPacker &dp); protected: LLTransferSourceParamsFile mParams; diff --git a/indra/llmessage/lltransfertargetvfile.cpp b/indra/llmessage/lltransfertargetvfile.cpp index 53962b6633..fcf853845b 100644 --- a/indra/llmessage/lltransfertargetvfile.cpp +++ b/indra/llmessage/lltransfertargetvfile.cpp @@ -94,7 +94,7 @@ LLTransferTargetVFile::LLTransferTargetVFile( const LLUUID& uuid, LLTransferSourceType src_type) : LLTransferTarget(LLTTT_VFILE, uuid, src_type), - mNeedsCreate(TRUE) + mNeedsCreate(true) { mTempID.generate(); } @@ -141,7 +141,7 @@ LLTSCode LLTransferTargetVFile::dataCallback(const S32 packet_id, U8 *in_datap, LLFileSystem vf(mTempID, mParams.getAssetType(), LLFileSystem::APPEND); if (mNeedsCreate) { - mNeedsCreate = FALSE; + mNeedsCreate = false; } if (!in_size) diff --git a/indra/llmessage/lltransfertargetvfile.h b/indra/llmessage/lltransfertargetvfile.h index 83cfd5fc5d..4a78c3c522 100644 --- a/indra/llmessage/lltransfertargetvfile.h +++ b/indra/llmessage/lltransfertargetvfile.h @@ -86,7 +86,7 @@ protected: LLTransferTargetParamsVFile mParams; - BOOL mNeedsCreate; + bool mNeedsCreate; LLUUID mTempID; }; diff --git a/indra/llmessage/lluseroperation.cpp b/indra/llmessage/lluseroperation.cpp index c7c9ccd3bd..36ab87086d 100644 --- a/indra/llmessage/lluseroperation.cpp +++ b/indra/llmessage/lluseroperation.cpp @@ -41,7 +41,7 @@ LLUserOperationMgr* gUserOperationMgr = NULL; LLUserOperation::LLUserOperation(const LLUUID& agent_id) : mAgentID(agent_id), mTimer(), - mNoExpire(FALSE) + mNoExpire(false) { mTransactionID.generate(); } @@ -51,7 +51,7 @@ LLUserOperation::LLUserOperation(const LLUUID& agent_id, mAgentID(agent_id), mTransactionID(transaction_id), mTimer(), - mNoExpire(FALSE) + mNoExpire(false) { } @@ -59,7 +59,7 @@ LLUserOperation::LLUserOperation(const LLUUID& agent_id, // transaction, agent, et. after construction. LLUserOperation::LLUserOperation() : mTimer(), - mNoExpire(FALSE) + mNoExpire(false) { } @@ -67,19 +67,19 @@ LLUserOperation::~LLUserOperation() { } -void LLUserOperation::SetNoExpireFlag(const BOOL flag) +void LLUserOperation::SetNoExpireFlag(const bool flag) { mNoExpire = flag; } -BOOL LLUserOperation::isExpired() +bool LLUserOperation::isExpired() { if (!mNoExpire) { const F32 EXPIRE_TIME_SECS = 10.f; return mTimer.getElapsedTimeF32() > EXPIRE_TIME_SECS; } - return FALSE; + return false; } void LLUserOperation::expire() @@ -128,7 +128,7 @@ LLUserOperation* LLUserOperationMgr::findOperation(const LLUUID& tid) } -BOOL LLUserOperationMgr::deleteOperation(LLUserOperation* op) +bool LLUserOperationMgr::deleteOperation(LLUserOperation* op) { size_t rv = 0; if(op) @@ -138,7 +138,7 @@ BOOL LLUserOperationMgr::deleteOperation(LLUserOperation* op) delete op; op = NULL; } - return rv ? TRUE : FALSE; + return rv != 0; } void LLUserOperationMgr::deleteExpiredOperations() diff --git a/indra/llmessage/lluseroperation.h b/indra/llmessage/lluseroperation.h index 953e36d7c0..c3ac2e350c 100644 --- a/indra/llmessage/lluseroperation.h +++ b/indra/llmessage/lluseroperation.h @@ -44,17 +44,17 @@ public: const LLUUID& getAgentID() const { return mAgentID; } // Operation never got necessary data, so expired - virtual BOOL isExpired(); + virtual bool isExpired(); // ability to mark this operation as never expiring. - void SetNoExpireFlag(const BOOL flag); + void SetNoExpireFlag(const bool flag); // Send request to the dataserver virtual void sendRequest() = 0; // Run the operation. This will only be called in the case of an // actual success or failure of the operation. - virtual BOOL execute(BOOL transaction_success) = 0; + virtual bool execute(bool transaction_success) = 0; // This method is called when the user op has expired, and is // about to be deleted by the manager. This gives the user op the @@ -68,7 +68,7 @@ protected: LLUUID mAgentID; LLUUID mTransactionID; LLFrameTimer mTimer; - BOOL mNoExpire; // this is used for operations that expect an answer and will wait till it gets one. + bool mNoExpire; // this is used for operations that expect an answer and will wait till it gets one. }; @@ -80,7 +80,7 @@ public: void addOperation(LLUserOperation* op); LLUserOperation* findOperation(const LLUUID& transaction_id); - BOOL deleteOperation(LLUserOperation* op); + bool deleteOperation(LLUserOperation* op); // Call this method every once in a while to clean up old // transactions. diff --git a/indra/llmessage/llxfer.cpp b/indra/llmessage/llxfer.cpp index ea2309fbba..358c8be671 100644 --- a/indra/llmessage/llxfer.cpp +++ b/indra/llmessage/llxfer.cpp @@ -63,13 +63,13 @@ void LLXfer::init (S32 chunk_size) mXferSize = 0; mStatus = e_LL_XFER_UNINITIALIZED; - mWaitingForACK = FALSE; + mWaitingForACK = false; mCallback = NULL; mCallbackDataHandle = NULL; mCallbackResult = 0; - mBufferContainsEOF = FALSE; + mBufferContainsEOF = false; mBuffer = NULL; mBufferLength = 0; mBufferStartOffset = 0; @@ -187,7 +187,7 @@ void LLXfer::sendPacket(S32 packet_num) { char fdata_buf[LL_XFER_LARGE_PAYLOAD+4]; /* Flawfinder: ignore */ S32 fdata_size = mChunkSize; - BOOL last_packet = FALSE; + bool last_packet = false; S32 num_copy = 0; // if the desired packet is not in our current buffered excerpt from the file. . . @@ -217,7 +217,7 @@ void LLXfer::sendPacket(S32 packet_num) if (((U32)(desired_read_position + fdata_size) >= (U32)mBufferLength) && (mBufferContainsEOF)) { - last_packet = TRUE; + last_packet = true; } if (packet_num) @@ -270,7 +270,7 @@ void LLXfer::sendPacket(S32 packet_num) } ACKTimer.reset(); - mWaitingForACK = TRUE; + mWaitingForACK = true; } if (last_packet) { @@ -327,7 +327,7 @@ S32 LLXfer::processEOF() /////////////////////////////////////////////////////////// -S32 LLXfer::encodePacketNum(S32 packet_num, BOOL is_EOF) +S32 LLXfer::encodePacketNum(S32 packet_num, bool is_EOF) { if (is_EOF) { diff --git a/indra/llmessage/llxfer.h b/indra/llmessage/llxfer.h index 2f880381d5..9a0901a84a 100644 --- a/indra/llmessage/llxfer.h +++ b/indra/llmessage/llxfer.h @@ -63,11 +63,11 @@ class LLXfer char *mBuffer; U32 mBufferLength; // Size of valid data, not actual allocated buffer size U32 mBufferStartOffset; - BOOL mBufferContainsEOF; + bool mBufferContainsEOF; ELLXferStatus mStatus; - BOOL mWaitingForACK; + bool mWaitingForACK; void (*mCallback)(void **,S32,LLExtStat); void **mCallbackDataHandle; @@ -103,7 +103,7 @@ class LLXfer virtual S32 suck(S32 start_position); virtual S32 flush(); - virtual S32 encodePacketNum(S32 packet_num, BOOL is_eof); + virtual S32 encodePacketNum(S32 packet_num, bool is_eof); virtual void setXferSize (S32 data_size); virtual S32 getMaxBufferSize(); diff --git a/indra/llmessage/llxfer_file.cpp b/indra/llmessage/llxfer_file.cpp index bdd7e35fd5..71b910297b 100644 --- a/indra/llmessage/llxfer_file.cpp +++ b/indra/llmessage/llxfer_file.cpp @@ -49,10 +49,10 @@ S32 copy_file(const std::string& from, const std::string& to); LLXfer_File::LLXfer_File (S32 chunk_size) : LLXfer(chunk_size) { - init(LLStringUtil::null, FALSE, chunk_size); + init(LLStringUtil::null, false, chunk_size); } -LLXfer_File::LLXfer_File (const std::string& local_filename, BOOL delete_local_on_completion, S32 chunk_size) +LLXfer_File::LLXfer_File (const std::string& local_filename, bool delete_local_on_completion, S32 chunk_size) : LLXfer(chunk_size) { init(local_filename, delete_local_on_completion, chunk_size); @@ -67,7 +67,7 @@ LLXfer_File::~LLXfer_File () /////////////////////////////////////////////////////////// -void LLXfer_File::init (const std::string& local_filename, BOOL delete_local_on_completion, S32 chunk_size) +void LLXfer_File::init (const std::string& local_filename, bool delete_local_on_completion, S32 chunk_size) { mFp = NULL; @@ -75,8 +75,8 @@ void LLXfer_File::init (const std::string& local_filename, BOOL delete_local_on_ mRemoteFilename.clear(); mRemotePath = LL_PATH_NONE; mTempFilename.clear(); - mDeleteLocalOnCompletion = FALSE; - mDeleteRemoteOnCompletion = FALSE; + mDeleteLocalOnCompletion = false; + mDeleteRemoteOnCompletion = false; if (!local_filename.empty()) { @@ -120,7 +120,7 @@ S32 LLXfer_File::initializeRequest(U64 xfer_id, const std::string& remote_filename, ELLPath remote_path, const LLHost& remote_host, - BOOL delete_remote_on_completion, + bool delete_remote_on_completion, void (*callback)(void**,S32,LLExtStat), void** user_data) { @@ -174,7 +174,7 @@ S32 LLXfer_File::startDownload() gMessageSystem->addStringFast(_PREHASH_Filename, mRemoteFilename); gMessageSystem->addU8("FilePath", (U8) mRemotePath); gMessageSystem->addBOOL("DeleteOnCompletion", mDeleteRemoteOnCompletion); - gMessageSystem->addBOOL("UseBigPackets", BOOL(mChunkSize == LL_XFER_LARGE_PAYLOAD)); + gMessageSystem->addBOOL("UseBigPackets", mChunkSize == LL_XFER_LARGE_PAYLOAD); gMessageSystem->addUUIDFast(_PREHASH_VFileID, LLUUID::null); gMessageSystem->addS16Fast(_PREHASH_VFileType, -1); @@ -287,11 +287,11 @@ S32 LLXfer_File::suck(S32 start_position) if (feof(mFp)) { - mBufferContainsEOF = TRUE; + mBufferContainsEOF = true; } else { - mBufferContainsEOF = FALSE; + mBufferContainsEOF = false; } } else @@ -317,7 +317,7 @@ S32 LLXfer_File::flush() if (mFp) { - S32 write_size = fwrite(mBuffer,1,mBufferLength,mFp); + S32 write_size = static_cast<S32>(fwrite(mBuffer,1,mBufferLength,mFp)); if (write_size != mBufferLength) { LL_WARNS("Xfer") << "Non-matching write size, requested " << mBufferLength @@ -412,14 +412,14 @@ S32 LLXfer_File::processEOF() /////////////////////////////////////////////////////////// -BOOL LLXfer_File::matchesLocalFilename(const std::string& filename) +bool LLXfer_File::matchesLocalFilename(const std::string& filename) { return (filename == mLocalFilename); } /////////////////////////////////////////////////////////// -BOOL LLXfer_File::matchesRemoteFilename(const std::string& filename, ELLPath remote_path) +bool LLXfer_File::matchesRemoteFilename(const std::string& filename, ELLPath remote_path) { return ((filename == mRemoteFilename) && (remote_path == mRemotePath)); } diff --git a/indra/llmessage/llxfer_file.h b/indra/llmessage/llxfer_file.h index cb2da47e44..f30ef3eed6 100644 --- a/indra/llmessage/llxfer_file.h +++ b/indra/llmessage/llxfer_file.h @@ -39,15 +39,15 @@ class LLXfer_File : public LLXfer ELLPath mRemotePath; std::string mTempFilename; - BOOL mDeleteLocalOnCompletion; - BOOL mDeleteRemoteOnCompletion; + bool mDeleteLocalOnCompletion; + bool mDeleteRemoteOnCompletion; public: LLXfer_File (S32 chunk_size); - LLXfer_File (const std::string& local_filename, BOOL delete_local_on_completion, S32 chunk_size); + LLXfer_File (const std::string& local_filename, bool delete_local_on_completion, S32 chunk_size); virtual ~LLXfer_File(); - virtual void init(const std::string& local_filename, BOOL delete_local_on_completion, S32 chunk_size); + virtual void init(const std::string& local_filename, bool delete_local_on_completion, S32 chunk_size); virtual void cleanup(); virtual S32 initializeRequest(U64 xfer_id, @@ -55,7 +55,7 @@ class LLXfer_File : public LLXfer const std::string& remote_filename, ELLPath remote_path, const LLHost& remote_host, - BOOL delete_remote_on_completion, + bool delete_remote_on_completion, void (*callback)(void**,S32,LLExtStat), void** user_data); virtual S32 startDownload(); @@ -69,8 +69,8 @@ class LLXfer_File : public LLXfer virtual S32 suck(S32 start_position); virtual S32 flush(); - virtual BOOL matchesLocalFilename(const std::string& filename); - virtual BOOL matchesRemoteFilename(const std::string& filename, ELLPath remote_path); + virtual bool matchesLocalFilename(const std::string& filename); + virtual bool matchesRemoteFilename(const std::string& filename, ELLPath remote_path); virtual S32 getMaxBufferSize(); diff --git a/indra/llmessage/llxfer_mem.cpp b/indra/llmessage/llxfer_mem.cpp index 100a67e422..b619974270 100644 --- a/indra/llmessage/llxfer_mem.cpp +++ b/indra/llmessage/llxfer_mem.cpp @@ -52,7 +52,7 @@ void LLXfer_Mem::init () { mRemoteFilename.clear(); mRemotePath = LL_PATH_NONE; - mDeleteRemoteOnCompletion = FALSE; + mDeleteRemoteOnCompletion = false; } /////////////////////////////////////////////////////////// @@ -73,7 +73,7 @@ void LLXfer_Mem::setXferSize (S32 xfer_size) mBufferLength = 0; mBufferStartOffset = 0; - mBufferContainsEOF = TRUE; + mBufferContainsEOF = true; // cout << "starting transfer of size: " << xfer_size << endl; } @@ -124,7 +124,7 @@ S32 LLXfer_Mem::initializeRequest(U64 xfer_id, const std::string& remote_filename, ELLPath remote_path, const LLHost& remote_host, - BOOL delete_remote_on_completion, + bool delete_remote_on_completion, void (*callback)(void*,S32,void**,S32,LLExtStat), void** user_data) { @@ -164,7 +164,7 @@ S32 LLXfer_Mem::startDownload() gMessageSystem->addStringFast(_PREHASH_Filename, mRemoteFilename); gMessageSystem->addU8("FilePath", (U8) mRemotePath); gMessageSystem->addBOOL("DeleteOnCompletion", mDeleteRemoteOnCompletion); - gMessageSystem->addBOOL("UseBigPackets", BOOL(mChunkSize == LL_XFER_LARGE_PAYLOAD)); + gMessageSystem->addBOOL("UseBigPackets", mChunkSize == LL_XFER_LARGE_PAYLOAD); gMessageSystem->addUUIDFast(_PREHASH_VFileID, LLUUID::null); gMessageSystem->addS16Fast(_PREHASH_VFileType, -1); diff --git a/indra/llmessage/llxfer_mem.h b/indra/llmessage/llxfer_mem.h index ef8e9e2483..4e87b0ca5a 100644 --- a/indra/llmessage/llxfer_mem.h +++ b/indra/llmessage/llxfer_mem.h @@ -39,7 +39,7 @@ class LLXfer_Mem : public LLXfer void (*mCallback)(void *, S32, void **, S32, LLExtStat); std::string mRemoteFilename; ELLPath mRemotePath; - BOOL mDeleteRemoteOnCompletion; + bool mDeleteRemoteOnCompletion; public: @@ -59,7 +59,7 @@ class LLXfer_Mem : public LLXfer const std::string& remote_filename, ELLPath remote_path, const LLHost& remote_host, - BOOL delete_remote_on_completion, + bool delete_remote_on_completion, void (*callback)(void*,S32,void**,S32,LLExtStat), void** user_data); virtual S32 startDownload(); diff --git a/indra/llmessage/llxfer_vfile.cpp b/indra/llmessage/llxfer_vfile.cpp index fbe880d05d..4f31973f3d 100644 --- a/indra/llmessage/llxfer_vfile.cpp +++ b/indra/llmessage/llxfer_vfile.cpp @@ -138,7 +138,7 @@ S32 LLXfer_VFile::initializeRequest(U64 xfer_id, mBufferLength = 0; mPacketNum = 0; mTempID.generate(); - mDeleteTempFile = TRUE; + mDeleteTempFile = true; mStatus = e_LL_XFER_PENDING; return retval; } @@ -156,8 +156,8 @@ S32 LLXfer_VFile::startDownload() gMessageSystem->addU64Fast(_PREHASH_ID, mID); gMessageSystem->addStringFast(_PREHASH_Filename, ""); gMessageSystem->addU8("FilePath", (U8) LL_PATH_NONE); - gMessageSystem->addBOOL("DeleteOnCompletion", FALSE); - gMessageSystem->addBOOL("UseBigPackets", BOOL(mChunkSize == LL_XFER_LARGE_PAYLOAD)); + gMessageSystem->addBOOL("DeleteOnCompletion", false); + gMessageSystem->addBOOL("UseBigPackets", mChunkSize == LL_XFER_LARGE_PAYLOAD); gMessageSystem->addUUIDFast(_PREHASH_VFileID, mRemoteID); gMessageSystem->addS16Fast(_PREHASH_VFileType, (S16)mType); @@ -345,7 +345,7 @@ S32 LLXfer_VFile::processEOF() { // Rename worked: the original file is gone. Clear mDeleteTempFile // so we don't attempt to delete the file in cleanup() - mDeleteTempFile = FALSE; + mDeleteTempFile = false; } } else @@ -367,14 +367,14 @@ S32 LLXfer_VFile::processEOF() //////////////////////////////////////////////////////////// -BOOL LLXfer_VFile::matchesLocalFile(const LLUUID &id, LLAssetType::EType type) +bool LLXfer_VFile::matchesLocalFile(const LLUUID &id, LLAssetType::EType type) { return (id == mLocalID && type == mType); } ////////////////////////////////////////////////////////// -BOOL LLXfer_VFile::matchesRemoteFile(const LLUUID &id, LLAssetType::EType type) +bool LLXfer_VFile::matchesRemoteFile(const LLUUID &id, LLAssetType::EType type) { return (id == mRemoteID && type == mType); } diff --git a/indra/llmessage/llxfer_vfile.h b/indra/llmessage/llxfer_vfile.h index 5ab767b052..f62da815f8 100644 --- a/indra/llmessage/llxfer_vfile.h +++ b/indra/llmessage/llxfer_vfile.h @@ -44,7 +44,7 @@ class LLXfer_VFile : public LLXfer std::string mName; - BOOL mDeleteTempFile; + bool mDeleteTempFile; public: LLXfer_VFile (); @@ -72,8 +72,8 @@ class LLXfer_VFile : public LLXfer virtual S32 suck(S32 start_position); virtual S32 flush(); - virtual BOOL matchesLocalFile(const LLUUID &id, LLAssetType::EType type); - virtual BOOL matchesRemoteFile(const LLUUID &id, LLAssetType::EType type); + virtual bool matchesLocalFile(const LLUUID &id, LLAssetType::EType type); + virtual bool matchesRemoteFile(const LLUUID &id, LLAssetType::EType type); virtual void setXferSize(S32 xfer_size); virtual S32 getMaxBufferSize(); diff --git a/indra/llmessage/llxfermanager.cpp b/indra/llmessage/llxfermanager.cpp index ea1fe0a963..f6ed43a4e4 100644 --- a/indra/llmessage/llxfermanager.cpp +++ b/indra/llmessage/llxfermanager.cpp @@ -79,7 +79,7 @@ void LLXferManager::init() setMaxIncomingXfers(LL_DEFAULT_MAX_REQUEST_FIFO_XFERS); // Turn on or off ack throttling - mUseAckThrottling = FALSE; + mUseAckThrottling = false; setAckThrottleBPS(100000); } @@ -116,7 +116,7 @@ void LLXferManager::setHardLimitOutgoingXfersPerCircuit(S32 max_num) mHardLimitOutgoingXfersPerCircuit = max_num; } -void LLXferManager::setUseAckThrottling(const BOOL use) +void LLXferManager::setUseAckThrottling(const bool use) { mUseAckThrottling = use; } @@ -367,7 +367,7 @@ U64 LLXferManager::getNextID () /////////////////////////////////////////////////////////// -S32 LLXferManager::encodePacketNum(S32 packet_num, BOOL is_EOF) +S32 LLXferManager::encodePacketNum(S32 packet_num, bool is_EOF) { if (is_EOF) { @@ -385,7 +385,7 @@ S32 LLXferManager::decodePacketNum(S32 packet_num) /////////////////////////////////////////////////////////// -BOOL LLXferManager::isLastPacket(S32 packet_num) +bool LLXferManager::isLastPacket(S32 packet_num) { return(packet_num & 0x80000000); } @@ -396,11 +396,11 @@ U64 LLXferManager::requestFile(const std::string& local_filename, const std::string& remote_filename, ELLPath remote_path, const LLHost& remote_host, - BOOL delete_remote_on_completion, + bool delete_remote_on_completion, void (*callback)(void**,S32,LLExtStat), void** user_data, - BOOL is_priority, - BOOL use_big_packets) + bool is_priority, + bool use_big_packets) { LLXfer_File* file_xfer_p = NULL; @@ -464,7 +464,7 @@ void LLXferManager::requestVFile(const LLUUID& local_id, const LLHost& remote_host, void (*callback)(void**,S32,LLExtStat), void** user_data, - BOOL is_priority) + bool is_priority) { LLXfer_VFile * xfer_p = NULL; @@ -757,7 +757,7 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user LLUUID uuid; LLAssetType::EType type; S16 type_s16; - BOOL b_use_big_packets; + bool b_use_big_packets; mesgsys->getBOOL("XferID", "UseBigPackets", b_use_big_packets); @@ -853,7 +853,7 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user } LL_INFOS("Xfer") << "starting file transfer: " << expanded_filename << " to " << mesgsys->getSender() << LL_ENDL; - BOOL delete_local_on_completion = FALSE; + bool delete_local_on_completion = false; mesgsys->getBOOL("XferID", "DeleteOnCompletion", delete_local_on_completion); // -1 chunk_size causes it to use the default @@ -1005,7 +1005,7 @@ void LLXferManager::processConfirmation (LLMessageSystem *mesgsys, void ** /*use if (xferp) { // cout << "confirmed packet #" << packetNum << " ping: "<< xferp->ACKTimer.getElapsedTimeF32() << endl; - xferp->mWaitingForACK = FALSE; + xferp->mWaitingForACK = false; if (xferp->mStatus == e_LL_XFER_IN_PROGRESS) { xferp->sendNextPacket(); @@ -1235,7 +1235,7 @@ void LLXferManager::startPendingDownloads() /////////////////////////////////////////////////////////// -void LLXferManager::addToList(LLXfer* xferp, xfer_list_t & xfer_list, BOOL is_priority) +void LLXferManager::addToList(LLXfer* xferp, xfer_list_t & xfer_list, bool is_priority) { if(is_priority) { diff --git a/indra/llmessage/llxfermanager.h b/indra/llmessage/llxfermanager.h index 3999b41862..3be5f5a228 100644 --- a/indra/llmessage/llxfermanager.h +++ b/indra/llmessage/llxfermanager.h @@ -76,7 +76,7 @@ class LLXferManager S32 mHardLimitOutgoingXfersPerCircuit; // At this limit, kill off the connection S32 mMaxIncomingXfers; - BOOL mUseAckThrottling; // Use ack throttling to cap file xfer bandwidth + bool mUseAckThrottling; // Use ack throttling to cap file xfer bandwidth std::deque<LLXferAckInfo> mXferAckQueue; LLThrottle mAckThrottle; public: @@ -85,8 +85,8 @@ class LLXferManager // an xfer must happen asap. enum { - LOW_PRIORITY = FALSE, - HIGH_PRIORITY = TRUE, + LOW_PRIORITY = false, + HIGH_PRIORITY = true, }; // Linked FIFO list, add to the front and pull from back @@ -100,7 +100,7 @@ class LLXferManager protected: // implementation methods virtual void startPendingDownloads(); - virtual void addToList(LLXfer* xferp, xfer_list_t & xfer_list, BOOL is_priority); + virtual void addToList(LLXfer* xferp, xfer_list_t & xfer_list, bool is_priority); std::multiset<std::string> mExpectedTransfers; // files that are authorized to transfer out std::multiset<std::string> mExpectedRequests; // files that are authorized to be downloaded on top of std::multiset<std::string> mExpectedVFileTransfers; // files that are authorized to transfer out @@ -113,7 +113,7 @@ class LLXferManager virtual void init(); virtual void cleanup(); - void setUseAckThrottling(const BOOL use); + void setUseAckThrottling(const bool use); void setAckThrottleBPS(const F32 bps); // list management routines @@ -135,9 +135,9 @@ class LLXferManager // general utility routines virtual void registerCallbacks(LLMessageSystem *mesgsys); virtual U64 getNextID (); - virtual S32 encodePacketNum(S32 packet_num, BOOL is_eof); + virtual S32 encodePacketNum(S32 packet_num, bool is_eof); virtual S32 decodePacketNum(S32 packet_num); - virtual BOOL isLastPacket(S32 packet_num); + virtual bool isLastPacket(S32 packet_num); // file requesting routines // .. to file @@ -145,19 +145,19 @@ class LLXferManager const std::string& remote_filename, ELLPath remote_path, const LLHost& remote_host, - BOOL delete_remote_on_completion, + bool delete_remote_on_completion, void (*callback)(void**,S32,LLExtStat), void** user_data, - BOOL is_priority = FALSE, - BOOL use_big_packets = FALSE); + bool is_priority = false, + bool use_big_packets = false); /* // .. to memory virtual void requestFile(const std::string& remote_filename, ELLPath remote_path, const LLHost &remote_host, - BOOL delete_remote_on_completion, + bool delete_remote_on_completion, void (*callback)(void*, S32, void**, S32, LLExtStat), void** user_data, - BOOL is_priority = FALSE); + bool is_priority = false); */ // vfile requesting // .. to vfile @@ -165,7 +165,7 @@ class LLXferManager LLAssetType::EType type, const LLHost& remote_host, void (*callback)(void**,S32,LLExtStat), void** user_data, - BOOL is_priority = FALSE); + bool is_priority = false); /** When arbitrary files are requested to be transfered (by giving a dir of LL_PATH_NONE) they must be "expected", but having something pre-authorize them. This pair of functions diff --git a/indra/llmessage/llxorcipher.cpp b/indra/llmessage/llxorcipher.cpp index dc92fb7f85..8db4fca629 100644 --- a/indra/llmessage/llxorcipher.cpp +++ b/indra/llmessage/llxorcipher.cpp @@ -109,7 +109,7 @@ void LLXORCipher::init(const U8* pad, U32 pad_len) #ifdef _DEBUG // static -BOOL LLXORCipher::testHarness() +bool LLXORCipher::testHarness() { const U32 PAD_LEN = 3; const U8 PAD[] = "abc"; @@ -122,7 +122,7 @@ BOOL LLXORCipher::testHarness() cipher.encrypt((U8*)MESSAGE, MSG_LENGTH, encrypted, MSG_LENGTH); cipher.decrypt(encrypted, MSG_LENGTH, decrypted, MSG_LENGTH); - if(0 != memcmp((void*)MESSAGE, decrypted, MSG_LENGTH)) return FALSE; - return TRUE; + if(0 != memcmp((void*)MESSAGE, decrypted, MSG_LENGTH)) return false; + return true; } #endif diff --git a/indra/llmessage/llxorcipher.h b/indra/llmessage/llxorcipher.h index fa1fb11b78..50ea997b4d 100644 --- a/indra/llmessage/llxorcipher.h +++ b/indra/llmessage/llxorcipher.h @@ -43,18 +43,18 @@ public: LLXORCipher& operator=(const LLXORCipher& cipher); // Cipher functions - /*virtual*/ U32 encrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len); - /*virtual*/ U32 decrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len); - /*virtual*/ U32 requiredEncryptionSpace(U32 src_len) const; + U32 encrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len) override; + U32 decrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len) override; + U32 requiredEncryptionSpace(U32 src_len) const override; // special syntactic-sugar since xor can be performed in place. - BOOL encrypt(U8* buf, U32 len) { return encrypt((const U8*)buf, len, buf, len); } - BOOL decrypt(U8* buf, U32 len) { return decrypt((const U8*)buf, len, buf, len); } + bool encrypt(U8* buf, U32 len) { return encrypt((const U8*)buf, len, buf, len) > 0; } + bool decrypt(U8* buf, U32 len) { return decrypt((const U8*)buf, len, buf, len) > 0; } #ifdef _DEBUG // This function runs tests to make sure the crc is - // working. Returns TRUE if it is. - static BOOL testHarness(); + // working. Returns true if it is. + static bool testHarness(); #endif protected: diff --git a/indra/llmessage/machine.h b/indra/llmessage/machine.h index 17cfd9771f..05d366cbc3 100644 --- a/indra/llmessage/machine.h +++ b/indra/llmessage/machine.h @@ -65,7 +65,7 @@ public: // The control port is the listen port of the parent process that // launched this machine. 0 means none or not known. const S32 &getControlPort() const { return mControlPort; } - BOOL isValid() const { return (mHost.getPort() != 0); } // TRUE if corresponds to functioning machine + bool isValid() const { return (mHost.getPort() != 0); } // true if corresponds to functioning machine // set functions void setMachineType(EMachineType machine_type) { mMachineType = machine_type; } diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp index 398b3ac757..cfa5178fc6 100644 --- a/indra/llmessage/message.cpp +++ b/indra/llmessage/message.cpp @@ -148,11 +148,11 @@ static const char* nullToEmpty(const char* s) void LLMessageSystem::init() { // initialize member variables - mVerboseLog = FALSE; + mVerboseLog = false; - mbError = FALSE; + mbError = false; mErrorCode = 0; - mSendReliable = FALSE; + mSendReliable = false; mUnackedListDepth = 0; mUnackedListSize = 0; @@ -214,7 +214,7 @@ LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port, mVersionFlags = 0x0; // default to not accepting packets from not alive circuits - mbProtected = TRUE; + mbProtected = true; // default to blocking trusted connections on a public interface if one is specified mBlockUntrustedInterface = true; @@ -239,7 +239,7 @@ LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port, S32 error = start_net(mSocket, mPort); if (error != 0) { - mbError = TRUE; + mbError = true; mErrorCode = error; } // LL_DEBUGS("Messaging") << << "*** port: " << mPort << LL_ENDL; @@ -288,7 +288,7 @@ void LLMessageSystem::loadTemplateFile(const std::string& filename, bool failure if(filename.empty()) { LL_ERRS("Messaging") << "No template filename specified" << LL_ENDL; - mbError = TRUE; + mbError = true; return; } @@ -300,19 +300,22 @@ void LLMessageSystem::loadTemplateFile(const std::string& filename, bool failure } else { LL_WARNS("Messaging") << "Failed to open template: " << filename << LL_ENDL; } - mbError = TRUE; + mbError = true; return; } LLTemplateTokenizer tokens(template_body); LLTemplateParser parsed(tokens); mMessageFileVersionNumber = parsed.getVersion(); + S32 count = 0; for(LLTemplateParser::message_iterator iter = parsed.getMessagesBegin(); iter != parsed.getMessagesEnd(); iter++) { addTemplate(*iter); + count++; } + LL_INFOS("Messaging") << "Read " << count << " messages from " << filename << LL_ENDL; } @@ -359,7 +362,7 @@ void LLMessageSystem::clearReceiveState() } -BOOL LLMessageSystem::poll(F32 seconds) +bool LLMessageSystem::poll(F32 seconds) { S32 num_socks; apr_status_t status; @@ -370,11 +373,11 @@ BOOL LLMessageSystem::poll(F32 seconds) } if (num_socks) { - return TRUE; + return true; } else { - return FALSE; + return false; } } @@ -465,7 +468,7 @@ LLCircuitData* LLMessageSystem::findCircuit(const LLHost& host, else { // wake up the circuit - cdp->setAlive(TRUE); + cdp->setAlive(true); if(resetPacketId) { @@ -478,13 +481,13 @@ LLCircuitData* LLMessageSystem::findCircuit(const LLHost& host, return cdp; } -// Returns TRUE if a valid, on-circuit message has been received. +// Returns true if a valid, on-circuit message has been received. // Requiring a non-const LockMessageChecker reference ensures that // mMessageReader has been set to mTemplateMessageReader. -BOOL LLMessageSystem::checkMessages(LockMessageChecker&, S64 frame_count ) +bool LLMessageSystem::checkMessages(LockMessageChecker&, S64 frame_count ) { // Pump - BOOL valid_packet = FALSE; + bool valid_packet = false; LLTransferTargetVFile::updateQueue(); @@ -503,8 +506,8 @@ BOOL LLMessageSystem::checkMessages(LockMessageChecker&, S64 frame_count ) { clearReceiveState(); - BOOL recv_reliable = FALSE; - BOOL recv_resent = FALSE; + bool recv_reliable = false; + bool recv_resent = false; S32 acks = 0; S32 true_rcv_size = 0; @@ -528,7 +531,7 @@ BOOL LLMessageSystem::checkMessages(LockMessageChecker&, S64 frame_count ) callExceptionFunc(MX_PACKET_TOO_SHORT); } // no data in packet receive buffer - valid_packet = FALSE; + valid_packet = false; } else { @@ -551,7 +554,7 @@ BOOL LLMessageSystem::checkMessages(LockMessageChecker&, S64 frame_count ) LL_WARNS("Messaging") << "Malformed packet received. Packet size " << receive_size << " with invalid no. of acks " << acks << LL_ENDL; - valid_packet = FALSE; + valid_packet = false; continue; } } @@ -590,11 +593,11 @@ BOOL LLMessageSystem::checkMessages(LockMessageChecker&, S64 frame_count ) if (buffer[0] & LL_RELIABLE_FLAG) { - recv_reliable = TRUE; + recv_reliable = true; } if (buffer[0] & LL_RESENT_FLAG) { - recv_resent = TRUE; + recv_resent = true; if (cdp && cdp->isDuplicateResend(mCurrentRecvPacketID)) { // We need to ACK here to suppress @@ -632,7 +635,7 @@ BOOL LLMessageSystem::checkMessages(LockMessageChecker&, S64 frame_count ) LL_INFOS("Messaging") << str.str() << LL_ENDL; } mPacketsIn++; - valid_packet = FALSE; + valid_packet = false; continue; } } @@ -661,7 +664,7 @@ BOOL LLMessageSystem::checkMessages(LockMessageChecker&, S64 frame_count ) { logMsgFromInvalidCircuit( host, recv_reliable ); clearReceiveState(); - valid_packet = FALSE; + valid_packet = false; } if( @@ -674,12 +677,12 @@ BOOL LLMessageSystem::checkMessages(LockMessageChecker&, S64 frame_count ) clearReceiveState(); sendDenyTrustedCircuit(host); - valid_packet = FALSE; + valid_packet = false; } if( valid_packet ) { - logValidMsg(cdp, host, recv_reliable, recv_resent, (BOOL)(acks>0) ); + logValidMsg(cdp, host, recv_reliable, recv_resent, acks>0 ); valid_packet = mTemplateMessageReader->readMessage(buffer, host); } @@ -765,7 +768,7 @@ void LLMessageSystem::processAcks(LockMessageChecker&, F32 collect_time) } } - BOOL dump = FALSE; + bool dump = false; { // Check the status of circuits mCircuitInfo.updateWatchDogTimers(this); @@ -790,17 +793,17 @@ void LLMessageSystem::processAcks(LockMessageChecker&, F32 collect_time) { if (mNumMessageCounts >= mMaxMessageCounts) { - dump = TRUE; + dump = true; } } if (mMaxMessageTime >= F32Seconds(0.f)) { // This is one of the only places where we're required to get REAL message system time. - mReceiveTime = getMessageTimeSeconds(TRUE) - mMessageCountTime; + mReceiveTime = getMessageTimeSeconds(true) - mMessageCountTime; if (mReceiveTime > mMaxMessageTime) { - dump = TRUE; + dump = true; } } } @@ -830,7 +833,7 @@ void LLMessageSystem::copyMessageReceivedToSend() { mMessageBuilder = mLLSDMessageBuilder; } - mSendReliable = FALSE; + mSendReliable = false; mMessageBuilder->newMessage(mMessageReader->getMessageName()); mMessageReader->copyToBuilder(*mMessageBuilder); } @@ -925,7 +928,7 @@ S32 LLMessageSystem::sendMessage(const LLHost &host, LLStoredMessagePtr message) void LLMessageSystem::clearMessage() { - mSendReliable = FALSE; + mSendReliable = false; mMessageBuilder->clearMessage(); } @@ -940,7 +943,7 @@ void LLMessageSystem::nextBlock(const char *blockname) nextBlockFast(LLMessageStringTable::getInstance()->getString(blockname)); } -BOOL LLMessageSystem::isSendFull(const char* blockname) +bool LLMessageSystem::isSendFull(const char* blockname) { char* stringTableName = NULL; if(NULL != blockname) @@ -950,22 +953,22 @@ BOOL LLMessageSystem::isSendFull(const char* blockname) return isSendFullFast(stringTableName); } -BOOL LLMessageSystem::isSendFullFast(const char* blockname) +bool LLMessageSystem::isSendFullFast(const char* blockname) { return mMessageBuilder->isMessageFull(blockname); } -// blow away the last block of a message, return FALSE if that leaves no blocks or there wasn't a block to remove +// blow away the last block of a message, return false if that leaves no blocks or there wasn't a block to remove // TODO: Babbage: Remove this horror. -BOOL LLMessageSystem::removeLastBlock() +bool LLMessageSystem::removeLastBlock() { return mMessageBuilder->removeLastBlock(); } S32 LLMessageSystem::sendReliable(const LLHost &host) { - return sendReliable(host, LL_DEFAULT_RELIABLE_RETRIES, TRUE, LL_PING_BASED_TIMEOUT_DUMMY, NULL, NULL); + return sendReliable(host, LL_DEFAULT_RELIABLE_RETRIES, true, LL_PING_BASED_TIMEOUT_DUMMY, NULL, NULL); } @@ -984,15 +987,15 @@ S32 LLMessageSystem::sendSemiReliable(const LLHost &host, void (*callback)(void timeout = LL_SEMIRELIABLE_TIMEOUT_FACTOR * LL_AVERAGED_PING_MAX; } - const S32 retries = 0; - const BOOL ping_based_timeout = FALSE; + constexpr S32 retries = 0; + constexpr bool ping_based_timeout = false; return sendReliable(host, retries, ping_based_timeout, timeout, callback, callback_data); } // send the message via a UDP packet S32 LLMessageSystem::sendReliable( const LLHost &host, S32 retries, - BOOL ping_based_timeout, + bool ping_based_timeout, F32Seconds timeout, void (*callback)(void **,S32), void ** callback_data) @@ -1010,7 +1013,7 @@ S32 LLMessageSystem::sendReliable( const LLHost &host, } } - mSendReliable = TRUE; + mSendReliable = true; mReliablePacketParams.set(host, retries, ping_based_timeout, timeout, callback, callback_data, const_cast<char*>(mMessageBuilder->getMessageName())); @@ -1037,7 +1040,7 @@ void LLMessageSystem::forwardReliable(const U32 circuit_code) S32 LLMessageSystem::forwardReliable( const LLHost &host, S32 retries, - BOOL ping_based_timeout, + bool ping_based_timeout, F32Seconds timeout, void (*callback)(void **,S32), void ** callback_data) @@ -1064,9 +1067,9 @@ S32 LLMessageSystem::flushSemiReliable(const LLHost &host, void (*callback)(void S32 send_bytes = 0; if (mMessageBuilder->getMessageSize()) { - mSendReliable = TRUE; + mSendReliable = true; // No need for ping-based retry as not going to retry - mReliablePacketParams.set(host, 0, FALSE, timeout, callback, + mReliablePacketParams.set(host, 0, false, timeout, callback, callback_data, const_cast<char*>(mMessageBuilder->getMessageName())); send_bytes = sendMessage(host); @@ -1166,7 +1169,7 @@ S32 LLMessageSystem::sendMessage(const LLHost &host) host.getUntrustedSimulatorCap(), mLLSDMessageBuilder->getMessageName(), message, cb)); - mSendReliable = FALSE; + mSendReliable = false; mReliablePacketParams.clear(); return 1; } @@ -1215,7 +1218,7 @@ S32 LLMessageSystem::sendMessage(const LLHost &host) // tack packet acks onto the end of this message S32 space_left = (MTUBYTES - buffer_length) / sizeof(TPACKETID); // space left for packet ids S32 ack_count = (S32)cdp->mAcks.size(); - BOOL is_ack_appended = FALSE; + bool is_ack_appended = false; std::vector<TPACKETID> acks; if((space_left > 0) && (ack_count > 0) && (mMessageBuilder->getMessageName() != _PREHASH_PacketAck)) @@ -1266,10 +1269,10 @@ S32 LLMessageSystem::sendMessage(const LLHost &host) // tack the count in the final byte U8 count = (U8)append_ack_count; buf_ptr[buffer_length++] = count; - is_ack_appended = TRUE; + is_ack_appended = true; } - BOOL success; + bool success; success = mPacketRing.sendPacket(mSocket, (char *)buf_ptr, buffer_length, host); if (!success) @@ -1304,12 +1307,12 @@ S32 LLMessageSystem::sendMessage(const LLHost &host) mPacketsOut++; mTotalBytesOut += buffer_length; - mSendReliable = FALSE; + mSendReliable = false; mReliablePacketParams.clear(); return buffer_length; } -void LLMessageSystem::logMsgFromInvalidCircuit( const LLHost& host, BOOL recv_reliable ) +void LLMessageSystem::logMsgFromInvalidCircuit( const LLHost& host, bool recv_reliable ) { if(mVerboseLog) { @@ -1336,7 +1339,7 @@ void LLMessageSystem::logMsgFromInvalidCircuit( const LLHost& host, BOOL recv_re // TODO: babbage: work out if we need these // mMessageCountList[mNumMessageCounts].mMessageNum = mCurrentRMessageTemplate->mMessageNumber; mMessageCountList[mNumMessageCounts].mMessageBytes = mMessageReader->getMessageSize(); - mMessageCountList[mNumMessageCounts].mInvalid = TRUE; + mMessageCountList[mNumMessageCounts].mInvalid = true; mNumMessageCounts++; } } @@ -1389,12 +1392,12 @@ void LLMessageSystem::logTrustedMsgFromUntrustedCircuit( const LLHost& host ) // = mCurrentRMessageTemplate->mMessageNumber; mMessageCountList[mNumMessageCounts].mMessageBytes = mMessageReader->getMessageSize(); - mMessageCountList[mNumMessageCounts].mInvalid = TRUE; + mMessageCountList[mNumMessageCounts].mInvalid = true; mNumMessageCounts++; } } -void LLMessageSystem::logValidMsg(LLCircuitData *cdp, const LLHost& host, BOOL recv_reliable, BOOL recv_resent, BOOL recv_acks ) +void LLMessageSystem::logValidMsg(LLCircuitData *cdp, const LLHost& host, bool recv_reliable, bool recv_resent, bool recv_acks ) { if (mNumMessageCounts >= MAX_MESSAGE_COUNT_NUM) { @@ -1405,7 +1408,7 @@ void LLMessageSystem::logValidMsg(LLCircuitData *cdp, const LLHost& host, BOOL r // TODO: babbage: work out if we need these //mMessageCountList[mNumMessageCounts].mMessageNum = mCurrentRMessageTemplate->mMessageNumber; mMessageCountList[mNumMessageCounts].mMessageBytes = mMessageReader->getMessageSize(); - mMessageCountList[mNumMessageCounts].mInvalid = FALSE; + mMessageCountList[mNumMessageCounts].mInvalid = false; mNumMessageCounts++; } @@ -1499,7 +1502,7 @@ void LLMessageSystem::getCircuitInfo(LLSD& info) const } // returns whether the given host is on a trusted circuit -BOOL LLMessageSystem::getCircuitTrust(const LLHost &host) +bool LLMessageSystem::getCircuitTrust(const LLHost &host) { LLCircuitData *cdp = mCircuitInfo.findCircuit(host); if (cdp) @@ -1507,12 +1510,12 @@ BOOL LLMessageSystem::getCircuitTrust(const LLHost &host) return cdp->getTrusted(); } - return FALSE; + return false; } -// Activate a circuit, and set its trust level (TRUE if trusted, -// FALSE if not). -void LLMessageSystem::enableCircuit(const LLHost &host, BOOL trusted) +// Activate a circuit, and set its trust level (true if trusted, +// false if not). +void LLMessageSystem::enableCircuit(const LLHost &host, bool trusted) { LLCircuitData *cdp = mCircuitInfo.findCircuit(host); if (!cdp) @@ -1521,7 +1524,7 @@ void LLMessageSystem::enableCircuit(const LLHost &host, BOOL trusted) } else { - cdp->setAlive(TRUE); + cdp->setAlive(true); } cdp->setTrusted(trusted); } @@ -1573,7 +1576,7 @@ void LLMessageSystem::disableCircuit(const LLHost &host) } -void LLMessageSystem::setCircuitAllowTimeout(const LLHost &host, BOOL allow) +void LLMessageSystem::setCircuitAllowTimeout(const LLHost &host, bool allow) { LLCircuitData *cdp = mCircuitInfo.findCircuit(host); if (cdp) @@ -1592,14 +1595,14 @@ void LLMessageSystem::setCircuitTimeoutCallback(const LLHost &host, void (*callb } -BOOL LLMessageSystem::checkCircuitBlocked(const U32 circuit) +bool LLMessageSystem::checkCircuitBlocked(const U32 circuit) { LLHost host = findHost(circuit); if (!host.isOk()) { LL_DEBUGS("Messaging") << "checkCircuitBlocked: Unknown circuit " << circuit << LL_ENDL; - return TRUE; + return true; } LLCircuitData *cdp = mCircuitInfo.findCircuit(host); @@ -1610,18 +1613,18 @@ BOOL LLMessageSystem::checkCircuitBlocked(const U32 circuit) else { LL_INFOS("Messaging") << "checkCircuitBlocked(circuit): Unknown host - " << host << LL_ENDL; - return FALSE; + return false; } } -BOOL LLMessageSystem::checkCircuitAlive(const U32 circuit) +bool LLMessageSystem::checkCircuitAlive(const U32 circuit) { LLHost host = findHost(circuit); if (!host.isOk()) { LL_DEBUGS("Messaging") << "checkCircuitAlive: Unknown circuit " << circuit << LL_ENDL; - return FALSE; + return false; } LLCircuitData *cdp = mCircuitInfo.findCircuit(host); @@ -1632,11 +1635,11 @@ BOOL LLMessageSystem::checkCircuitAlive(const U32 circuit) else { LL_INFOS("Messaging") << "checkCircuitAlive(circuit): Unknown host - " << host << LL_ENDL; - return FALSE; + return false; } } -BOOL LLMessageSystem::checkCircuitAlive(const LLHost &host) +bool LLMessageSystem::checkCircuitAlive(const LLHost &host) { LLCircuitData *cdp = mCircuitInfo.findCircuit(host); if (cdp) @@ -1646,12 +1649,12 @@ BOOL LLMessageSystem::checkCircuitAlive(const LLHost &host) else { LL_DEBUGS("Messaging") << "checkCircuitAlive(host): Unknown host - " << host << LL_ENDL; - return FALSE; + return false; } } -void LLMessageSystem::setCircuitProtection(BOOL b_protect) +void LLMessageSystem::setCircuitProtection(bool b_protect) { mbProtected = b_protect; } @@ -1779,7 +1782,7 @@ void open_circuit(LLMessageSystem *msgsystem, void** /*user_data*/) msgsystem->getIPPortFast(_PREHASH_CircuitInfo, _PREHASH_Port, port); // By default, OpenCircuit's are untrusted - msgsystem->enableCircuit(LLHost(ip, port), FALSE); + msgsystem->enableCircuit(LLHost(ip, port), false); } void close_circuit(LLMessageSystem *msgsystem, void** /*user_data*/) @@ -1944,9 +1947,9 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg, // passed the circuit code and session id check, so we will go // ahead and persist the ID associated. LLCircuitData *cdp = msg->mCircuitInfo.findCircuit(msg->getSender()); - BOOL had_circuit_already = cdp ? TRUE : FALSE; + bool had_circuit_already = cdp != nullptr; - msg->enableCircuit(msg->getSender(), FALSE); + msg->enableCircuit(msg->getSender(), false); cdp = msg->mCircuitInfo.findCircuit(msg->getSender()); if(cdp) { @@ -1970,7 +1973,7 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg, // doesn't get properly duplicate suppressed. Not a BIG deal, but it's somewhat confusing // (and bad from a state point of view). DJS 9/23/04 // - cdp->checkPacketInID(gMessageSystem->mCurrentRecvPacketID, FALSE ); // Since this is the first message on the circuit, by definition it's not resent. + cdp->checkPacketInID(gMessageSystem->mCurrentRecvPacketID, false ); // Since this is the first message on the circuit, by definition it's not resent. } msg->mIPPortToCircuitCode[ip_port_in] = circuit_code_in; @@ -2169,7 +2172,7 @@ S32 LLMessageSystem::sendError( if (LLMessageConfig::getMessageFlavor(ERROR_MESSAGE_NAME) == LLMessageConfig::TEMPLATE_FLAVOR) { - S32 msg_size = temp.size() + mMessageBuilder->getMessageSize(); + S32 msg_size = static_cast<S32>(temp.size()) + mMessageBuilder->getMessageSize(); if(msg_size >= ETHERNET_MTU_BYTES) { pack_data = false; @@ -2177,7 +2180,7 @@ S32 LLMessageSystem::sendError( } if(pack_data) { - addBinaryData("Data", (void*)temp.c_str(), temp.size()); + addBinaryData("Data", (void*)temp.c_str(), static_cast<S32>(temp.size())); } else { @@ -2288,7 +2291,7 @@ void process_create_trusted_circuit(LLMessageSystem *msg, void **) their_digest[MD5HEX_STR_SIZE - 1] = '\0'; if(msg->isMatchingDigestForWindowAndUUIDs(their_digest, TRUST_TIME_WINDOW, local_id, remote_id)) { - cdp->setTrusted(TRUE); + cdp->setTrusted(true); LL_INFOS("Messaging") << "Trusted digest from " << msg->getSender() << LL_ENDL; return; } @@ -2457,13 +2460,13 @@ bool start_messaging_system( if (!gMessageSystem) { LL_ERRS("AppInit") << "Messaging system initialization failed." << LL_ENDL; - return FALSE; + return false; } // bail if system encountered an error. if(!gMessageSystem->isOK()) { - return FALSE; + return false; } if (b_dump_prehash_file) @@ -2514,12 +2517,12 @@ bool start_messaging_system( // Initialize the transfer manager gTransferManager.init(); - return TRUE; + return true; } void LLMessageSystem::startLogging() { - mVerboseLog = TRUE; + mVerboseLog = true; std::ostringstream str; str << "START MESSAGE LOG" << std::endl; str << "Legend:" << std::endl; @@ -2533,7 +2536,7 @@ void LLMessageSystem::stopLogging() { if(mVerboseLog) { - mVerboseLog = FALSE; + mVerboseLog = false; LL_INFOS("Messaging") << "END MESSAGE LOG" << LL_ENDL; } } @@ -2712,7 +2715,7 @@ void LLMessageSystem::dumpReceiveCounts() -BOOL LLMessageSystem::isClear() const +bool LLMessageSystem::isClear() const { return mMessageBuilder->isClear(); } @@ -2754,7 +2757,7 @@ S32 LLMessageSystem::zeroCodeAdjustCurrentSendTotal() 0); } // TODO: babbage: remove this horror - mMessageBuilder->setBuilt(FALSE); + mMessageBuilder->setBuilt(false); S32 count = mSendSize; @@ -2978,12 +2981,12 @@ void LLMessageSystem::setExceptionFunc(EMessageException e, } } -BOOL LLMessageSystem::callExceptionFunc(EMessageException exception) +bool LLMessageSystem::callExceptionFunc(EMessageException exception) { callbacks_t::iterator it = mExceptionCallbacks.find(exception); if(it == mExceptionCallbacks.end()) { - return FALSE; + return false; } exception_t& ex = it->second; @@ -2992,12 +2995,12 @@ BOOL LLMessageSystem::callExceptionFunc(EMessageException exception) if (!ex_cb) { LL_WARNS("Messaging") << "LLMessageSystem::callExceptionFunc: bad message exception callback." << LL_ENDL; - return FALSE; + return false; } (ex_cb)(this, ex.second, exception); - return TRUE; + return true; } void LLMessageSystem::setTimingFunc(msg_timing_callback func, void* data) @@ -3006,14 +3009,14 @@ void LLMessageSystem::setTimingFunc(msg_timing_callback func, void* data) mTimingCallbackData = data; } -BOOL LLMessageSystem::isCircuitCodeKnown(U32 code) const +bool LLMessageSystem::isCircuitCodeKnown(U32 code) const { if(mCircuitCodes.find(code) == mCircuitCodes.end()) - return FALSE; - return TRUE; + return false; + return true; } -BOOL LLMessageSystem::isMessageFast(const char *msg) +bool LLMessageSystem::isMessageFast(const char *msg) { return msg == mMessageReader->getMessageName(); } @@ -3354,7 +3357,7 @@ void LLMessageSystem::dumpPacketToLog() //static -U64Microseconds LLMessageSystem::getMessageTimeUsecs(const BOOL update) +U64Microseconds LLMessageSystem::getMessageTimeUsecs(const bool update) { if (gMessageSystem) { @@ -3371,7 +3374,7 @@ U64Microseconds LLMessageSystem::getMessageTimeUsecs(const BOOL update) } //static -F64Seconds LLMessageSystem::getMessageTimeSeconds(const BOOL update) +F64Seconds LLMessageSystem::getMessageTimeSeconds(const bool update) { if (gMessageSystem) { @@ -3429,7 +3432,7 @@ void LLMessageSystem::newMessageFast(const char *name) mMessageBuilder = mTemplateMessageBuilder; } } - mSendReliable = FALSE; + mSendReliable = false; mMessageBuilder->newMessage(name); } @@ -3558,12 +3561,12 @@ void LLMessageSystem::addIPPort(const char *varname, U16 v) mMessageBuilder->addIPPort(LLMessageStringTable::getInstance()->getString(varname), v); } -void LLMessageSystem::addBOOLFast(const char* varname, BOOL v) +void LLMessageSystem::addBOOLFast(const char* varname, bool v) { mMessageBuilder->addBOOL(varname, v); } -void LLMessageSystem::addBOOL(const char* varname, BOOL v) +void LLMessageSystem::addBOOL(const char* varname, bool v) { mMessageBuilder->addBOOL(LLMessageStringTable::getInstance()->getString(varname), v); } @@ -3670,13 +3673,13 @@ void LLMessageSystem::getU8(const char *block, const char *var, U8 &u, LLMessageStringTable::getInstance()->getString(var), u, blocknum); } -void LLMessageSystem::getBOOLFast(const char *block, const char *var, BOOL &b, +void LLMessageSystem::getBOOLFast(const char *block, const char *var, bool &b, S32 blocknum) { mMessageReader->getBOOL(block, var, b, blocknum); } -void LLMessageSystem::getBOOL(const char *block, const char *var, BOOL &b, +void LLMessageSystem::getBOOL(const char *block, const char *var, bool &b, S32 blocknum) { getBOOLFast(LLMessageStringTable::getInstance()->getString(block), @@ -3920,7 +3923,7 @@ void LLMessageSystem::getString(const char *block, const char *var, blocknum); } -BOOL LLMessageSystem::has(const char *blockname) const +bool LLMessageSystem::has(const char *blockname) const { return getNumberOfBlocks(blockname) > 0; } @@ -3966,7 +3969,7 @@ S32 LLMessageSystem::getReceiveSize() const } //static -void LLMessageSystem::setTimeDecodes( BOOL b ) +void LLMessageSystem::setTimeDecodes( bool b ) { LLMessageReader::setTimeDecodes(b); } diff --git a/indra/llmessage/message.h b/indra/llmessage/message.h index 2d212c6b3c..b4b0d94021 100644 --- a/indra/llmessage/message.h +++ b/indra/llmessage/message.h @@ -74,7 +74,7 @@ public: char *getString(const char *str); U32 mUsed; - BOOL mEmpty[MESSAGE_NUMBER_OF_HASH_BUCKETS]; + bool mEmpty[MESSAGE_NUMBER_OF_HASH_BUCKETS]; char mString[MESSAGE_NUMBER_OF_HASH_BUCKETS][MESSAGE_MAX_STRINGS_LENGTH]; /* Flawfinder: ignore */ }; @@ -295,8 +295,8 @@ class LLMessageSystem : public LLMessageSenderInterface LLPacketRing mPacketRing; LLReliablePacketParams mReliablePacketParams; - // Set this flag to TRUE when you want *very* verbose logs. - BOOL mVerboseLog; + // Set this flag to true when you want *very* verbose logs. + bool mVerboseLog; F32 mMessageFileVersionNumber; @@ -314,7 +314,7 @@ public: S32 mSystemVersionServer; U32 mVersionFlags; - BOOL mbProtected; + bool mbProtected; U32 mNumberHighFreqMessages; U32 mNumberMediumFreqMessages; @@ -347,7 +347,7 @@ public: S64 mTotalBytesIn; // total size of all uncompressed packets in S64 mTotalBytesOut; // total size of all uncompressed packets out - BOOL mSendReliable; // does the outgoing message require a pos ack? + bool mSendReliable; // does the outgoing message require a pos ack? LLCircuit mCircuitInfo; F64Seconds mCircuitPrintTime; // used to print circuit debug info every couple minutes @@ -370,7 +370,7 @@ public: ~LLMessageSystem(); - BOOL isOK() const { return !mbError; } + bool isOK() const { return !mbError; } S32 getErrorCode() const { return mErrorCode; } // Read file and build message templates filename must point to a @@ -388,9 +388,9 @@ public: // Set a callback function for a message system exception. void setExceptionFunc(EMessageException exception, msg_exception_callback func, void* data = NULL); - // Call the specified exception func, and return TRUE if a - // function was found and called. Otherwise return FALSE. - BOOL callExceptionFunc(EMessageException exception); + // Call the specified exception func, and return true if a + // function was found and called. Otherwise return false. + bool callExceptionFunc(EMessageException exception); // Set a function that will be called once per packet processed with the // hashed message name and the time spent in the processing handler function @@ -407,18 +407,18 @@ public: } // This method returns true if the code is in the circuit codes map. - BOOL isCircuitCodeKnown(U32 code) const; + bool isCircuitCodeKnown(U32 code) const; // usually called in response to an AddCircuitCode message, but // may also be called by the login process. bool addCircuitCode(U32 code, const LLUUID& session_id); - BOOL poll(F32 seconds); // Number of seconds that we want to block waiting for data, returns if data was received - BOOL checkMessages(LockMessageChecker&, S64 frame_count = 0 ); + bool poll(F32 seconds); // Number of seconds that we want to block waiting for data, returns if data was received + bool checkMessages(LockMessageChecker&, S64 frame_count = 0 ); void processAcks(LockMessageChecker&, F32 collect_time = 0.f); - BOOL isMessageFast(const char *msg); - BOOL isMessage(const char *msg) + bool isMessageFast(const char *msg); + bool isMessage(const char *msg) { return isMessageFast(LLMessageStringTable::getInstance()->getString(msg)); } @@ -482,8 +482,8 @@ public: void addBinaryDataFast(const char *varname, const void *data, S32 size); void addBinaryData(const char *varname, const void *data, S32 size); - void addBOOLFast( const char* varname, BOOL b); // typed, checks storage space - void addBOOL( const char* varname, BOOL b); // typed, checks storage space + void addBOOLFast( const char* varname, bool b); // typed, checks storage space + void addBOOL( const char* varname, bool b); // typed, checks storage space void addS8Fast( const char *varname, S8 s); // typed, checks storage space void addS8( const char *varname, S8 s); // typed, checks storage space void addU8Fast( const char *varname, U8 u); // typed, checks storage space @@ -528,10 +528,10 @@ public: // you need to go to the next block type or need to start a new // message. Specify the current blockname to check block counts, // otherwise the method only checks against MTU. - BOOL isSendFull(const char* blockname = NULL); - BOOL isSendFullFast(const char* blockname = NULL); + bool isSendFull(const char* blockname = NULL); + bool isSendFullFast(const char* blockname = NULL); - BOOL removeLastBlock(); + bool removeLastBlock(); //void buildMessage(); @@ -548,7 +548,7 @@ public: // Use this one if you DON'T want automatic ping-based retry. S32 sendReliable( const LLHost &host, S32 retries, - BOOL ping_based_retries, + bool ping_based_retries, F32Seconds timeout, void (*callback)(void **,S32), void ** callback_data); @@ -568,7 +568,7 @@ public: S32 forwardReliable( const LLHost &host, S32 retries, - BOOL ping_based_timeout, + bool ping_based_timeout, F32Seconds timeout, void (*callback)(void **,S32), void ** callback_data); @@ -579,7 +579,7 @@ private: S32 sendMessage(const LLHost &host, const char* name, const LLSD& message); public: - // BOOL decodeData(const U8 *buffer, const LLHost &host); + // bool decodeData(const U8 *buffer, const LLHost &host); /** gets binary data from the current message. @@ -599,8 +599,8 @@ public: */ void getBinaryDataFast(const char *blockname, const char *varname, void *datap, S32 size, S32 blocknum = 0, S32 max_size = S32_MAX); void getBinaryData(const char *blockname, const char *varname, void *datap, S32 size, S32 blocknum = 0, S32 max_size = S32_MAX); - void getBOOLFast( const char *block, const char *var, BOOL &data, S32 blocknum = 0); - void getBOOL( const char *block, const char *var, BOOL &data, S32 blocknum = 0); + void getBOOLFast( const char *block, const char *var, bool &data, S32 blocknum = 0); + void getBOOL( const char *block, const char *var, bool &data, S32 blocknum = 0); void getS8Fast( const char *block, const char *var, S8 &data, S32 blocknum = 0); void getS8( const char *block, const char *var, S8 &data, S32 blocknum = 0); void getU8Fast( const char *block, const char *var, U8 &data, S32 blocknum = 0); @@ -659,7 +659,7 @@ public: U32 getOurCircuitCode(); - void enableCircuit(const LLHost &host, BOOL trusted); + void enableCircuit(const LLHost &host, bool trusted); void disableCircuit(const LLHost &host); // Use this to establish trust on startup and in response to @@ -712,20 +712,20 @@ public: // returns whether the given host is on a trusted circuit // Note:DaveH/Babbage some trusted messages can be received without a circuit - BOOL getCircuitTrust(const LLHost &host); + bool getCircuitTrust(const LLHost &host); - void setCircuitAllowTimeout(const LLHost &host, BOOL allow); + void setCircuitAllowTimeout(const LLHost &host, bool allow); void setCircuitTimeoutCallback(const LLHost &host, void (*callback_func)(const LLHost &host, void *user_data), void *user_data); - BOOL checkCircuitBlocked(const U32 circuit); - BOOL checkCircuitAlive(const U32 circuit); - BOOL checkCircuitAlive(const LLHost &host); - void setCircuitProtection(BOOL b_protect); + bool checkCircuitBlocked(const U32 circuit); + bool checkCircuitAlive(const U32 circuit); + bool checkCircuitAlive(const LLHost &host); + void setCircuitProtection(bool b_protect); U32 findCircuitCode(const LLHost &host); LLHost findHost(const U32 circuit_code); void sanityCheck(); - BOOL has(const char *blockname) const; + bool has(const char *blockname) const; S32 getNumberOfBlocksFast(const char *blockname) const; S32 getNumberOfBlocks(const char *blockname) const; S32 getSizeFast(const char *blockname, const char *varname) const; @@ -738,7 +738,7 @@ public: void dumpReceiveCounts(); // dumps receive count for each message type to LL_INFOS() void dumpCircuitInfo(); // Circuit information to LL_INFOS() - BOOL isClear() const; // returns mbSClear; + bool isClear() const; // returns mbSClear; S32 flush(const LLHost &host); U32 getListenPort( void ) const; @@ -762,10 +762,10 @@ public: void setMaxMessageTime(const F32 seconds); // Max time to process messages before warning and dumping (neg to disable) void setMaxMessageCounts(const S32 num); // Max number of messages before dumping (neg to disable) - static U64Microseconds getMessageTimeUsecs(const BOOL update = FALSE); // Get the current message system time in microseconds - static F64Seconds getMessageTimeSeconds(const BOOL update = FALSE); // Get the current message system time in seconds + static U64Microseconds getMessageTimeUsecs(const bool update = false); // Get the current message system time in microseconds + static F64Seconds getMessageTimeSeconds(const bool update = false); // Get the current message system time in seconds - static void setTimeDecodes(BOOL b); + static void setTimeDecodes(bool b); static void setTimeDecodesSpamThreshold(F32 seconds); // message handlers internal to the message systesm @@ -839,11 +839,11 @@ private: LLUUID mSessionID; void addTemplate(LLMessageTemplate *templatep); - BOOL decodeTemplate( const U8* buffer, S32 buffer_size, LLMessageTemplate** msg_template ); + bool decodeTemplate( const U8* buffer, S32 buffer_size, LLMessageTemplate** msg_template ); - void logMsgFromInvalidCircuit( const LLHost& sender, BOOL recv_reliable ); + void logMsgFromInvalidCircuit( const LLHost& sender, bool recv_reliable ); void logTrustedMsgFromUntrustedCircuit( const LLHost& sender ); - void logValidMsg(LLCircuitData *cdp, const LLHost& sender, BOOL recv_reliable, BOOL recv_resent, BOOL recv_acks ); + void logValidMsg(LLCircuitData *cdp, const LLHost& sender, bool recv_reliable, bool recv_resent, bool recv_acks ); void logRanOffEndOfPacket( const LLHost& sender ); class LLMessageCountInfo @@ -851,7 +851,7 @@ private: public: U32 mMessageNum; U32 mMessageBytes; - BOOL mInvalid; + bool mInvalid; }; LLMessagePollInfo *mPollInfop; @@ -862,7 +862,7 @@ private: // Must be valid during decode - BOOL mbError; + bool mbError; S32 mErrorCode; F64Seconds mResendDumpTime; // The last time we dumped resends @@ -885,7 +885,7 @@ private: LLTimer mMessageSystemTimer; static F32 mTimeDecodesSpamThreshold; // If mTimeDecodes is on, all this many seconds for each msg decode before spamming - static BOOL mTimeDecodes; // Measure time for all message decodes if TRUE; + static bool mTimeDecodes; // Measure time for all message decodes if true; msg_timing_callback mTimingCallback; void* mTimingCallbackData; diff --git a/indra/llmessage/message_string_table.cpp b/indra/llmessage/message_string_table.cpp index df4bfa29ad..6d2157eec9 100644 --- a/indra/llmessage/message_string_table.cpp +++ b/indra/llmessage/message_string_table.cpp @@ -47,7 +47,7 @@ LLMessageStringTable::LLMessageStringTable() { for (U32 i = 0; i < MESSAGE_NUMBER_OF_HASH_BUCKETS; i++) { - mEmpty[i] = TRUE; + mEmpty[i] = true; mString[i][0] = 0; } } @@ -75,7 +75,7 @@ char* LLMessageStringTable::getString(const char *str) // not found, so add! strncpy(mString[hash_value], str, MESSAGE_MAX_STRINGS_LENGTH); /* Flawfinder: ignore */ mString[hash_value][MESSAGE_MAX_STRINGS_LENGTH - 1] = 0; - mEmpty[hash_value] = FALSE; + mEmpty[hash_value] = false; mUsed++; if (mUsed >= MESSAGE_NUMBER_OF_HASH_BUCKETS - 1) { diff --git a/indra/llmessage/net.cpp b/indra/llmessage/net.cpp index c8552b3fb4..1c49f9be36 100644 --- a/indra/llmessage/net.cpp +++ b/indra/llmessage/net.cpp @@ -77,7 +77,7 @@ const char* LOOPBACK_ADDRESS_STRING = "127.0.0.1"; const char* BROADCAST_ADDRESS_STRING = "255.255.255.255"; #if LL_DARWIN - // Mac OS X returns an error when trying to set these to 400000. Smaller values succeed. + // macOS returns an error when trying to set these to 400000. Smaller values succeed. const int SEND_BUFFER_SIZE = 200000; const int RECEIVE_BUFFER_SIZE = 200000; #else // LL_DARWIN @@ -338,8 +338,8 @@ S32 receive_packet(int hSocket, char * receiveBuffer) return nRet; } -// Returns TRUE on success. -BOOL send_packet(int hSocket, const char *sendBuffer, int size, U32 recipient, int nPort) +// Returns true on success. +bool send_packet(int hSocket, const char *sendBuffer, int size, U32 recipient, int nPort) { // Sends a packet to the address set in initNet // @@ -364,7 +364,7 @@ BOOL send_packet(int hSocket, const char *sendBuffer, int size, U32 recipient, i // assume it is. JNC 2002.01.18 if (WSAECONNRESET == WSAGetLastError()) { - return TRUE; + return true; } LL_INFOS() << "sendto() failed to " << u32_to_ip_string(recipient) << ":" << nPort << ", Error " << last_error << LL_ENDL; @@ -598,11 +598,11 @@ int receive_packet(int hSocket, char * receiveBuffer) return nRet; } -BOOL send_packet(int hSocket, const char * sendBuffer, int size, U32 recipient, int nPort) +bool send_packet(int hSocket, const char * sendBuffer, int size, U32 recipient, int nPort) { int ret; - BOOL success; - BOOL resend; + bool success; + bool resend; S32 send_attempts = 0; stDstAddr.sin_addr.s_addr = recipient; @@ -616,34 +616,34 @@ BOOL send_packet(int hSocket, const char * sendBuffer, int size, U32 recipient, if (ret >= 0) { // successful send - success = TRUE; - resend = FALSE; + success = true; + resend = false; } else { // send failed, check to see if we should resend - success = FALSE; + success = false; if (errno == EAGAIN) { // say nothing, just repeat send LL_INFOS() << "sendto() reported buffer full, resending (attempt " << send_attempts << ")" << LL_ENDL; LL_INFOS() << inet_ntoa(stDstAddr.sin_addr) << ":" << nPort << LL_ENDL; - resend = TRUE; + resend = true; } else if (errno == ECONNREFUSED) { // response to ICMP connection refused message on earlier send LL_INFOS() << "sendto() reported connection refused, resending (attempt " << send_attempts << ")" << LL_ENDL; LL_INFOS() << inet_ntoa(stDstAddr.sin_addr) << ":" << nPort << LL_ENDL; - resend = TRUE; + resend = true; } else { // some other error LL_INFOS() << "sendto() failed: " << errno << ", " << strerror(errno) << LL_ENDL; LL_INFOS() << inet_ntoa(stDstAddr.sin_addr) << ":" << nPort << LL_ENDL; - resend = FALSE; + resend = false; } } } @@ -652,7 +652,7 @@ BOOL send_packet(int hSocket, const char * sendBuffer, int size, U32 recipient, if (send_attempts >= 3) { LL_INFOS() << "sendPacket() bailed out of send!" << LL_ENDL; - return FALSE; + return false; } return success; diff --git a/indra/llmessage/net.h b/indra/llmessage/net.h index d647da2570..c41f3bb89f 100644 --- a/indra/llmessage/net.h +++ b/indra/llmessage/net.h @@ -43,7 +43,7 @@ void end_net(S32& socket_out); // returns size of packet or -1 in case of error S32 receive_packet(int hSocket, char * receiveBuffer); -BOOL send_packet(int hSocket, const char *sendBuffer, int size, U32 recipient, int nPort); // Returns TRUE on success. +bool send_packet(int hSocket, const char *sendBuffer, int size, U32 recipient, int nPort); // Returns true on success. //void get_sender(char * tmp); LLHost get_sender(); diff --git a/indra/llmessage/partsyspacket.cpp b/indra/llmessage/partsyspacket.cpp index 84f3e2cc12..6113adbfcf 100644 --- a/indra/llmessage/partsyspacket.cpp +++ b/indra/llmessage/partsyspacket.cpp @@ -89,7 +89,7 @@ void gSetInitDataDefaults(LLPartInitData *setMe) setMe->mFlags[i] = 0x00; } - setMe->createMe = TRUE; + setMe->createMe = true; setMe->maxParticles = 25; setMe->initialParticles = 25; @@ -1052,7 +1052,7 @@ U32 LLPartSysCompressedPacket::readWindDiffusionFactor(LLPartInitData *in, U32 s return startByte; } -BOOL LLPartSysCompressedPacket::fromLLPartInitData(LLPartInitData *in, U32 &bytesUsed) +bool LLPartSysCompressedPacket::fromLLPartInitData(LLPartInitData *in, U32 &bytesUsed) { writeFlagByte(in); @@ -1168,10 +1168,10 @@ BOOL LLPartSysCompressedPacket::fromLLPartInitData(LLPartInitData *in, U32 &byte // llprintline("returning from \"fromLLPartInitData\" with %d bytes\n", bytesUsed); - return TRUE; + return true; } -BOOL LLPartSysCompressedPacket::toLLPartInitData(LLPartInitData *out, U32 *bytesUsed) +bool LLPartSysCompressedPacket::toLLPartInitData(LLPartInitData *out, U32 *bytesUsed) { U32 currByte = 4; @@ -1259,21 +1259,21 @@ BOOL LLPartSysCompressedPacket::toLLPartInitData(LLPartInitData *out, U32 *bytes } *bytesUsed = currByte; - return TRUE; + return true; } -BOOL LLPartSysCompressedPacket::fromUnsignedBytes(U8 *in, U32 bytesUsed) +bool LLPartSysCompressedPacket::fromUnsignedBytes(U8 *in, U32 bytesUsed) { if ((in != NULL) && (bytesUsed <= sizeof(mData))) { memcpy(mData, in, bytesUsed); /* Flawfinder: ignore */ mNumBytes = bytesUsed; - return TRUE; + return true; } else { LL_ERRS() << "NULL input data or number of bytes exceed mData size" << LL_ENDL; - return FALSE; + return false; } } @@ -1283,10 +1283,10 @@ U32 LLPartSysCompressedPacket::bufferSize() return mNumBytes; } -BOOL LLPartSysCompressedPacket::toUnsignedBytes(U8 *out) +bool LLPartSysCompressedPacket::toUnsignedBytes(U8 *out) { memcpy(out, mData, mNumBytes); /* Flawfinder: ignore */ - return TRUE; + return true; } U8 * LLPartSysCompressedPacket::getBytePtr() diff --git a/indra/llmessage/partsyspacket.h b/indra/llmessage/partsyspacket.h index 302d3b7cb8..23307f3409 100644 --- a/indra/llmessage/partsyspacket.h +++ b/indra/llmessage/partsyspacket.h @@ -102,7 +102,7 @@ struct LLPartInitData { //How much of an effect does gravity have F32 globalLifetime; //If particles re-spawn, a system can exist forever. - //If (ActionFlags & PART_SYS_GLOBAL_DIE) is TRUE this variable is used to determine how long the system lasts. + //If (ActionFlags & PART_SYS_GLOBAL_DIE) is true this variable is used to determine how long the system lasts. F32 individualLifetime; //How long does each particle last if nothing else happens to it F32 individualLifetimeRange; @@ -132,7 +132,7 @@ const int PART_SYS_SLOW_ANIM_BYTE = 0; // slow animation down by a factor of 10 const int PART_SYS_SLOW_ANIM_BIT = 1; // useful for tweaking anims during debugging const int PART_SYS_FOLLOW_VEL_BYTE = 0; // indicates whether to orient sprites towards -const int PART_SYS_FOLLOW_VEL_BIT = 4; // their velocity vector -- default is FALSE +const int PART_SYS_FOLLOW_VEL_BIT = 4; // their velocity vector -- default is false const int PART_SYS_IS_LIGHT_BYTE = 0; // indicates whether a particular particle system const int PART_SYS_IS_LIGHT_BIT = 8; // is also a light object -- for andrew @@ -202,10 +202,10 @@ class LLPartSysCompressedPacket public: LLPartSysCompressedPacket(); ~LLPartSysCompressedPacket(); - BOOL fromLLPartInitData(LLPartInitData *in, U32 &bytesUsed); - BOOL toLLPartInitData(LLPartInitData *out, U32 *bytesUsed); - BOOL fromUnsignedBytes(U8 *in, U32 bytesUsed); - BOOL toUnsignedBytes(U8 *out); + bool fromLLPartInitData(LLPartInitData *in, U32 &bytesUsed); + bool toLLPartInitData(LLPartInitData *out, U32 *bytesUsed); + bool fromUnsignedBytes(U8 *in, U32 bytesUsed); + bool toUnsignedBytes(U8 *out); U32 bufferSize(); U8 *getBytePtr(); diff --git a/indra/llmessage/patch_code.cpp b/indra/llmessage/patch_code.cpp index ad5602e391..489b6ce6a6 100644 --- a/indra/llmessage/patch_code.cpp +++ b/indra/llmessage/patch_code.cpp @@ -130,7 +130,7 @@ void code_patch(LLBitPack &bitpack, S32 *patch, S32 postquant) { S32 i, j, patch_size = gPatchSize, wbits = gWordBits; S32 temp; - BOOL b_eob; + bool b_eob; if ( (postquant > patch_size*patch_size) ||(postquant < 0)) @@ -143,16 +143,16 @@ void code_patch(LLBitPack &bitpack, S32 *patch, S32 postquant) for (i = 0; i < patch_size*patch_size; i++) { - b_eob = FALSE; + b_eob = false; temp = patch[i]; if (!temp) { - b_eob = TRUE; + b_eob = true; for (j = i; j < patch_size*patch_size - postquant; j++) { if (patch[j]) { - b_eob = FALSE; + b_eob = false; break; } } diff --git a/indra/llmessage/patch_dct.cpp b/indra/llmessage/patch_dct.cpp index 66cb256529..728fe84537 100644 --- a/indra/llmessage/patch_dct.cpp +++ b/indra/llmessage/patch_dct.cpp @@ -85,8 +85,8 @@ S32 gCopyMatrix[LARGE_PATCH_SIZE*LARGE_PATCH_SIZE]; void build_copy_matrix(S32 size) { S32 i, j, count; - BOOL b_diag = FALSE; - BOOL b_right = TRUE; + bool b_diag = false; + bool b_right = true; i = 0; j = 0; @@ -107,8 +107,8 @@ void build_copy_matrix(S32 size) i++; else j++; - b_right = FALSE; - b_diag = TRUE; + b_right = false; + b_diag = true; } else { @@ -116,8 +116,8 @@ void build_copy_matrix(S32 size) j++; else i++; - b_right = TRUE; - b_diag = TRUE; + b_right = true; + b_diag = true; } } else @@ -129,7 +129,7 @@ void build_copy_matrix(S32 size) if ( (i == size - 1) ||(j == 0)) { - b_diag = FALSE; + b_diag = false; } } else @@ -139,7 +139,7 @@ void build_copy_matrix(S32 size) if ( (i == 0) ||(j == size - 1)) { - b_diag = FALSE; + b_diag = false; } } } diff --git a/indra/llmessage/patch_idct.cpp b/indra/llmessage/patch_idct.cpp index 230b73726c..5483cf98c0 100644 --- a/indra/llmessage/patch_idct.cpp +++ b/indra/llmessage/patch_idct.cpp @@ -74,8 +74,8 @@ S32 gDeCopyMatrix[LARGE_PATCH_SIZE*LARGE_PATCH_SIZE]; void build_decopy_matrix(S32 size) { S32 i, j, count; - BOOL b_diag = FALSE; - BOOL b_right = TRUE; + bool b_diag = false; + bool b_right = true; i = 0; j = 0; @@ -96,8 +96,8 @@ void build_decopy_matrix(S32 size) i++; else j++; - b_right = FALSE; - b_diag = TRUE; + b_right = false; + b_diag = true; } else { @@ -105,8 +105,8 @@ void build_decopy_matrix(S32 size) j++; else i++; - b_right = TRUE; - b_diag = TRUE; + b_right = true; + b_diag = true; } } else @@ -118,7 +118,7 @@ void build_decopy_matrix(S32 size) if ( (i == size - 1) ||(j == 0)) { - b_diag = FALSE; + b_diag = false; } } else @@ -128,7 +128,7 @@ void build_decopy_matrix(S32 size) if ( (i == 0) ||(j == size - 1)) { - b_diag = FALSE; + b_diag = false; } } } @@ -658,8 +658,8 @@ void decompress_patchv(LLVector3 *v, S32 *cpatch, LLPatchHeader *ph) F32 mult = ooq*range; F32 addval = mult*(F32)(1<<(prequant - 1))+hmin; -// BOOL b_diag = FALSE; -// BOOL b_right = TRUE; +// bool b_diag = false; +// bool b_right = true; for (i = 0; i < size*size; i++) { diff --git a/indra/llmessage/tests/lltemplatemessagedispatcher_test.cpp b/indra/llmessage/tests/lltemplatemessagedispatcher_test.cpp index 911aef827d..c5b852453f 100644 --- a/indra/llmessage/tests/lltemplatemessagedispatcher_test.cpp +++ b/indra/llmessage/tests/lltemplatemessagedispatcher_test.cpp @@ -47,15 +47,15 @@ void LLMessageSystem::clearReceiveState(void) char gUdpDispatchedData[MAX_BUFFER_SIZE]; bool gUdpDispatchWasCalled = false; -BOOL LLTemplateMessageReader::readMessage(const U8* data,class LLHost const &) +bool LLTemplateMessageReader::readMessage(const U8* data,class LLHost const &) { gUdpDispatchWasCalled = true; strcpy(gUdpDispatchedData, reinterpret_cast<const char*>(data)); return true; } -BOOL gValidateMessage = FALSE; -BOOL LLTemplateMessageReader::validateMessage(const U8*, S32 buffer_size, LLHost const &sender, bool trusted) +bool gValidateMessage = false; +bool LLTemplateMessageReader::validateMessage(const U8*, S32 buffer_size, LLHost const &sender, bool trusted) { return gValidateMessage; } @@ -84,7 +84,7 @@ namespace tut mMessageName = "MessageName"; gUdpDispatchWasCalled = false; gClearRecvWasCalled = false; - gValidateMessage = FALSE; + gValidateMessage = false; mMessage["body"]["binary-template-data"] = std::vector<U8>(); } @@ -121,7 +121,7 @@ namespace tut { LLTemplateMessageReader* pReader = NULL; LLTemplateMessageDispatcher t(*pReader); - gValidateMessage = TRUE; + gValidateMessage = true; std::vector<U8> vector_data; fillVector(vector_data, gBinaryTemplateData); mMessage["body"]["binary-template-data"] = vector_data; @@ -138,7 +138,7 @@ namespace tut std::vector<U8> vector_data; fillVector(vector_data, gBinaryTemplateData); mMessage["body"]["binary-template-data"] = vector_data; - gValidateMessage = FALSE; + gValidateMessage = false; t.dispatch(mMessageName, mMessage, mResponsePtr); ensure("clear received message was called", gClearRecvWasCalled); } @@ -149,7 +149,7 @@ namespace tut { LLTemplateMessageReader* pReader = NULL; LLTemplateMessageDispatcher t(*pReader); - gValidateMessage = TRUE; + gValidateMessage = true; std::vector<U8> vector_data; fillVector(vector_data, gBinaryTemplateData); mMessage["body"]["binary-template-data"] = vector_data; diff --git a/indra/llmessage/tests/llxfer_file_test.cpp b/indra/llmessage/tests/llxfer_file_test.cpp index af0cc5b5ab..358659a5b9 100644 --- a/indra/llmessage/tests/llxfer_file_test.cpp +++ b/indra/llmessage/tests/llxfer_file_test.cpp @@ -51,7 +51,7 @@ namespace tut oversized_filename += 'X'; } - LLXfer_File xff(oversized_filename, FALSE, 1); + LLXfer_File xff(oversized_filename, false, 1); ensure("oversized local_filename nul-terminated", xff.getFileName().length() < LL_MAX_PATH); } diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp index 453223b43e..cffbe3d8bd 100644 --- a/indra/llplugin/llpluginclassmedia.cpp +++ b/indra/llplugin/llpluginclassmedia.cpp @@ -37,7 +37,7 @@ extern LLControlGroup gSavedSettings; #endif #if LL_DARWIN -extern BOOL gHiDPISupport; +extern bool gHiDPISupport; #endif static int LOW_PRIORITY_TEXTURE_SIZE_DEFAULT = 256; @@ -264,10 +264,10 @@ void LLPluginClassMedia::idle(void) message.setValueS32("height", mRequestedMediaHeight); message.setValueS32("texture_width", mRequestedTextureWidth); message.setValueS32("texture_height", mRequestedTextureHeight); - message.setValueReal("background_r", mBackgroundColor.mV[VX]); - message.setValueReal("background_g", mBackgroundColor.mV[VY]); - message.setValueReal("background_b", mBackgroundColor.mV[VZ]); - message.setValueReal("background_a", mBackgroundColor.mV[VW]); + message.setValueReal("background_r", mBackgroundColor.mV[VRED]); + message.setValueReal("background_g", mBackgroundColor.mV[VGREEN]); + message.setValueReal("background_b", mBackgroundColor.mV[VBLUE]); + message.setValueReal("background_a", mBackgroundColor.mV[VALPHA]); mPlugin->sendMessage(message); // DO NOT just use sendMessage() here -- we want this to jump ahead of the queue. LL_DEBUGS("Plugin") << "Sending size_change" << LL_ENDL; diff --git a/indra/llplugin/llpluginmessagepipe.cpp b/indra/llplugin/llpluginmessagepipe.cpp index 2cbc16ceec..085afc0944 100644 --- a/indra/llplugin/llpluginmessagepipe.cpp +++ b/indra/llplugin/llpluginmessagepipe.cpp @@ -371,7 +371,7 @@ bool LLPluginMessagePipe::pumpInput(F64 timeout) void LLPluginMessagePipe::processInput(void) { // Look for input delimiter(s) in the input buffer. - int delim; + size_t delim; mInputMutex.lock(); while((delim = mInput.find(MESSAGE_DELIMITER)) != std::string::npos) { diff --git a/indra/llplugin/llpluginprocessparent.cpp b/indra/llplugin/llpluginprocessparent.cpp index 6537733ddf..00abcf740f 100644 --- a/indra/llplugin/llpluginprocessparent.cpp +++ b/indra/llplugin/llpluginprocessparent.cpp @@ -34,7 +34,6 @@ #include "llpluginmessageclasses.h" #include "llsdserialize.h" #include "stringize.h" - #include "llapr.h" //virtual @@ -46,7 +45,7 @@ LLPluginProcessParentOwner::~LLPluginProcessParentOwner() bool LLPluginProcessParent::sUseReadThread = false; apr_pollset_t *LLPluginProcessParent::sPollSet = NULL; bool LLPluginProcessParent::sPollsetNeedsRebuild = false; -LLMutex *LLPluginProcessParent::sInstancesMutex; +LLCoros::Mutex *LLPluginProcessParent::sInstancesMutex; LLPluginProcessParent::mapInstances_t LLPluginProcessParent::sInstances; LLThread *LLPluginProcessParent::sReadThread = NULL; @@ -106,7 +105,7 @@ LLPluginProcessParent::LLPluginProcessParent(LLPluginProcessParentOwner *owner): { if(!sInstancesMutex) { - sInstancesMutex = new LLMutex(); + sInstancesMutex = new LLCoros::Mutex(); } mOwner = owner; @@ -176,7 +175,7 @@ LLPluginProcessParent::ptr_t LLPluginProcessParent::create(LLPluginProcessParent // Don't add to the global list until fully constructed. { - LLMutexLock lock(sInstancesMutex); + LLCoros::LockType lock(*sInstancesMutex); sInstances.insert(mapInstances_t::value_type(that.get(), that)); } @@ -186,7 +185,7 @@ LLPluginProcessParent::ptr_t LLPluginProcessParent::create(LLPluginProcessParent /*static*/ void LLPluginProcessParent::shutdown() { - LLMutexLock lock(sInstancesMutex); + LLCoros::LockType lock(*sInstancesMutex); mapInstances_t::iterator it; for (it = sInstances.begin(); it != sInstances.end(); ++it) @@ -244,7 +243,7 @@ bool LLPluginProcessParent::pollTick() { // this grabs a copy of the smart pointer to ourselves to ensure that we do not // get destroyed until after this method returns. - LLMutexLock lock(sInstancesMutex); + LLCoros::LockType lock(*sInstancesMutex); mapInstances_t::iterator it = sInstances.find(this); if (it != sInstances.end()) that = (*it).second; @@ -263,7 +262,7 @@ void LLPluginProcessParent::removeFromProcessing() // Remove from the global list before beginning destruction. { // Make sure to get the global mutex _first_ here, to avoid a possible deadlock against LLPluginProcessParent::poll() - LLMutexLock lock(sInstancesMutex); + LLCoros::LockType lock(*sInstancesMutex); { LLMutexLock lock2(&mIncomingQueueMutex); sInstances.erase(this); @@ -845,7 +844,7 @@ void LLPluginProcessParent::updatePollset() return; } - LLMutexLock lock(sInstancesMutex); + LLCoros::LockType lock(*sInstancesMutex); if(sPollSet) { @@ -968,7 +967,7 @@ void LLPluginProcessParent::poll(F64 timeout) mapInstances_t::iterator it; { - LLMutexLock lock(sInstancesMutex); + LLCoros::LockType lock(*sInstancesMutex); it = sInstances.find(thatId); if (it != sInstances.end()) that = (*it).second; diff --git a/indra/llplugin/llpluginprocessparent.h b/indra/llplugin/llpluginprocessparent.h index 1966e6b13c..d1c4933d81 100644 --- a/indra/llplugin/llpluginprocessparent.h +++ b/indra/llplugin/llpluginprocessparent.h @@ -207,7 +207,7 @@ private: apr_pollfd_t mPollFD; static apr_pollset_t *sPollSet; static bool sPollsetNeedsRebuild; - static LLMutex *sInstancesMutex; + static LLCoros::Mutex *sInstancesMutex; static mapInstances_t sInstances; static void dirtyPollSet(); static void updatePollset(); diff --git a/indra/llplugin/llpluginsharedmemory.cpp b/indra/llplugin/llpluginsharedmemory.cpp index 1d5f52c394..955c9f90d7 100644 --- a/indra/llplugin/llpluginsharedmemory.cpp +++ b/indra/llplugin/llpluginsharedmemory.cpp @@ -454,7 +454,7 @@ bool LLPluginSharedMemory::create(size_t size) NULL, // default security PAGE_READWRITE, // read/write access 0, // max. object size - mSize, // buffer size + static_cast<DWORD>(mSize), // buffer size mName.c_str()); // name of mapping object if(mImpl->mMapFile == NULL) @@ -482,7 +482,7 @@ bool LLPluginSharedMemory::attach(const std::string &name, size_t size) mImpl->mMapFile = OpenFileMappingA( FILE_MAP_ALL_ACCESS, // read/write access - FALSE, // do not inherit the name + false, // do not inherit the name mName.c_str()); // name of mapping object if(mImpl->mMapFile == NULL) diff --git a/indra/llplugin/slplugin/slplugin.cpp b/indra/llplugin/slplugin/slplugin.cpp index d20e01c231..ae26b9d452 100644 --- a/indra/llplugin/slplugin/slplugin.cpp +++ b/indra/llplugin/slplugin/slplugin.cpp @@ -88,22 +88,6 @@ LONG WINAPI myWin32ExceptionHandler( struct _EXCEPTION_POINTERS* exception_infop return EXCEPTION_EXECUTE_HANDLER; } -// Taken from : http://blog.kalmbachnet.de/?postid=75 -// The MSVC 2005 CRT forces the call of the default-debugger (normally Dr.Watson) -// even with the other exception handling code. This (terrifying) piece of code -// patches things so that doesn't happen. -LPTOP_LEVEL_EXCEPTION_FILTER WINAPI MyDummySetUnhandledExceptionFilter( - LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter ) -{ - return NULL; -} - -BOOL PreventSetUnhandledExceptionFilter() -{ - // remove the scary stuff that also isn't supported on 64 bit Windows - return TRUE; -} - //////////////////////////////////////////////////////////////////////////////// // Hook our exception handler and replace the system one void initExceptionHandler() @@ -112,7 +96,6 @@ void initExceptionHandler() // save old exception handler in case we need to restore it at the end prev_filter = SetUnhandledExceptionFilter( myWin32ExceptionHandler ); - PreventSetUnhandledExceptionFilter(); } bool checkExceptionHandler() @@ -121,18 +104,16 @@ bool checkExceptionHandler() LPTOP_LEVEL_EXCEPTION_FILTER prev_filter; prev_filter = SetUnhandledExceptionFilter(myWin32ExceptionHandler); - PreventSetUnhandledExceptionFilter(); - if (prev_filter != myWin32ExceptionHandler) { LL_WARNS("AppInit") << "Our exception handler (" << (void *)myWin32ExceptionHandler << ") replaced with " << prev_filter << "!" << LL_ENDL; ok = false; } - if (prev_filter == NULL) + if (prev_filter == nullptr) { - ok = FALSE; - if (NULL == myWin32ExceptionHandler) + ok = false; + if (nullptr == myWin32ExceptionHandler) { LL_WARNS("AppInit") << "Exception handler uninitialized." << LL_ENDL; } @@ -245,7 +226,7 @@ int main(int argc, char **argv) F64 elapsed = timer.getElapsedTimeF64(); F64 remaining = plugin->getSleepTime() - elapsed; - if(remaining <= 0.0f) + if(remaining <= 0.0) { // We've already used our full allotment. // LL_INFOS("slplugin") << "elapsed = " << elapsed * 1000.0f << " ms, remaining = " << remaining * 1000.0f << " ms, not sleeping" << LL_ENDL; diff --git a/indra/llprimitive/CMakeLists.txt b/indra/llprimitive/CMakeLists.txt index f24d8ed3b3..9d02a1fa4c 100644 --- a/indra/llprimitive/CMakeLists.txt +++ b/indra/llprimitive/CMakeLists.txt @@ -8,6 +8,7 @@ include(LLCoreHttp) include(LLPhysicsExtensions) include(LLPrimitive) include(GLH) +include(GLM) include(TinyGLTF) set(llprimitive_SOURCE_FILES diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp index 86385fc1df..a099a07cbd 100644 --- a/indra/llprimitive/lldaeloader.cpp +++ b/indra/llprimitive/lldaeloader.cpp @@ -241,7 +241,7 @@ LLModel::EModelStatus load_face_from_dom_triangles( n[idx[i+norm_offset]*3+2])); } - BOOL found = FALSE; + bool found = false; LLVolumeFace::VertexMapData::PointMap::iterator point_iter; point_iter = point_map.find(LLVector3(cv.getPosition().getF32ptr())); @@ -258,7 +258,7 @@ LLModel::EModelStatus load_face_from_dom_triangles( // Don't share verts within the same tri, degenerate // - U32 indx_size = indices.size(); + U32 indx_size = static_cast<U32>(indices.size()); U32 verts_new_tri = indx_size % 3; if ((verts_new_tri < 1 || indices[indx_size - 1] != shared_index) && (verts_new_tri < 2 || indices[indx_size - 2] != shared_index)) @@ -496,7 +496,7 @@ LLModel::EModelStatus load_face_from_dom_polylist( cur_idx += idx_stride; - BOOL found = FALSE; + bool found = false; LLVolumeFace::VertexMapData::PointMap::iterator point_iter; LLVector3 pos3(cv.getPosition().getF32ptr()); @@ -508,7 +508,7 @@ LLModel::EModelStatus load_face_from_dom_polylist( { if ((point_iter->second)[k] == cv) { - found = TRUE; + found = true; U32 index = (point_iter->second)[k].mIndex; if (j == 0) { @@ -732,7 +732,7 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector<LLVolumeFace>& fac { //for each vertex if (j > 2) { - U32 size = verts.size(); + auto size = verts.size(); LLVolumeFace::VertexData v0 = verts[size-3]; LLVolumeFace::VertexData v1 = verts[size-1]; @@ -1008,9 +1008,9 @@ bool LLDAELoader::OpenFile(const std::string& filename) //Verify some basic properties of the dae //1. Basic validity check on controller - U32 controllerCount = (int) db->getElementCount( NULL, "controller" ); + U32 controllerCount = db->getElementCount(NULL, "controller"); bool result = false; - for ( int i=0; i<controllerCount; ++i ) + for (U32 i = 0; i < controllerCount; ++i) { domController* pController = NULL; db->getElement( (daeElement**) &pController, i , NULL, "controller" ); @@ -1106,7 +1106,7 @@ bool LLDAELoader::OpenFile(const std::string& filename) while (model_iter != mModelList.end()) { LLModel* mdl = *model_iter; - U32 material_count = mdl->mMaterialList.size(); + U32 material_count = static_cast<U32>(mdl->mMaterialList.size()); LL_INFOS() << "Importing " << mdl->mLabel << " model with " << material_count << " material references" << LL_ENDL; std::vector<std::string>::iterator mat_iter = mdl->mMaterialList.begin(); std::vector<std::string>::iterator end_iter = material_count > LIMIT_MATERIALS_OUTPUT @@ -1261,7 +1261,7 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do //Some collada setup for accessing the skeleton U32 skeleton_count = dae->getDatabase()->getElementCount( NULL, "skeleton" ); std::vector<domInstance_controller::domSkeleton*> skeletons; - for (S32 i=0; i<skeleton_count; i++) + for (U32 i = 0; i < skeleton_count; i++) { daeElement* pElement = 0; dae->getDatabase()->getElement( &pElement, i, 0, "skeleton" ); @@ -1293,11 +1293,11 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do { //Get the children at this level daeTArray< daeSmartRef<daeElement> > children = pScene->getChildren(); - S32 childCount = children.getCount(); + auto childCount = children.getCount(); //Process any children that are joints //Not all children are joints, some could be ambient lights, cameras, geometry etc.. - for (S32 i = 0; i < childCount; ++i) + for (size_t i = 0; i < childCount; ++i) { domNode* pNode = daeSafeCast<domNode>(children[i]); if (pNode) @@ -1319,7 +1319,7 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do if ( pSkeletonRootNode ) { //Once we have the root node - start acccessing it's joint components - const int jointCnt = mJointMap.size(); + const int jointCnt = static_cast<int>(mJointMap.size()); JointMap :: const_iterator jointIt = mJointMap.begin(); //Loop over all the possible joints within the .dae - using the allowed joint list in the ctor. @@ -1461,9 +1461,9 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do if (t) { domListOfFloats& transform = t->getValue(); - S32 count = transform.getCount()/16; + auto count = transform.getCount()/16; - for (S32 k = 0; k < count; ++k) + for (size_t k = 0; k < count; ++k) { LLMatrix4 mat; @@ -1539,7 +1539,7 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do //with the skeleton are not stored in the same order as they are in the exported joint buffer. //This remaps the skeletal joints to be in the same order as the joints stored in the model. std::vector<std::string> :: const_iterator jointIt = model->mSkinInfo.mJointNames.begin(); - const int jointCnt = model->mSkinInfo.mJointNames.size(); + const int jointCnt = static_cast<int>(model->mSkinInfo.mJointNames.size()); for ( int i=0; i<jointCnt; ++i, ++jointIt ) { std::string lookingForJoint = (*jointIt).c_str(); @@ -1558,7 +1558,7 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do } } - U32 bind_count = model->mSkinInfo.mAlternateBindMatrix.size(); + auto bind_count = model->mSkinInfo.mAlternateBindMatrix.size(); if (bind_count > 0 && bind_count != jointCnt) { LL_WARNS("Mesh") << "Model " << model->mLabel << " has invalid joint bind matrix list." << LL_ENDL; @@ -1707,8 +1707,8 @@ void LLDAELoader::buildJointToNodeMappingFromScene( daeElement* pRoot ) if ( pScene ) { daeTArray< daeSmartRef<daeElement> > children = pScene->getChildren(); - S32 childCount = children.getCount(); - for (S32 i = 0; i < childCount; ++i) + auto childCount = children.getCount(); + for (size_t i = 0; i < childCount; ++i) { domNode* pNode = daeSafeCast<domNode>(children[i]); processJointToNodeMapping( pNode ); @@ -1753,8 +1753,8 @@ void LLDAELoader::processJointToNodeMapping( domNode* pNode ) void LLDAELoader::processChildJoints( domNode* pParentNode ) { daeTArray< daeSmartRef<daeElement> > childOfChild = pParentNode->getChildren(); - S32 childOfChildCount = childOfChild.getCount(); - for (S32 i = 0; i < childOfChildCount; ++i) + auto childOfChildCount = childOfChild.getCount(); + for (size_t i = 0; i < childOfChildCount; ++i) { domNode* pChildNode = daeSafeCast<domNode>( childOfChild[i] ); if ( pChildNode ) @@ -1855,7 +1855,7 @@ bool LLDAELoader::verifyController( domController* pController ) { sum += pVertexWeights->getVcount()->getValue()[i]; } - result = verifyCount( sum * inputs.getCount(), (domInt) pVertexWeights->getV()->getValue().getCount() ); + result = verifyCount( sum * static_cast<U32>(inputs.getCount()), (domInt) static_cast<int>(pVertexWeights->getV()->getValue().getCount()) ); } } @@ -1988,9 +1988,9 @@ void LLDAELoader::processJointNode( domNode* pNode, JointTransformMap& jointTran //Gather and handle the incoming nodes children daeTArray< daeSmartRef<daeElement> > childOfChild = pNode->getChildren(); - S32 childOfChildCount = childOfChild.getCount(); + auto childOfChildCount = childOfChild.getCount(); - for (S32 i = 0; i < childOfChildCount; ++i) + for (size_t i = 0; i < childOfChildCount; ++i) { domNode* pChildNode = daeSafeCast<domNode>( childOfChild[i] ); if ( pChildNode ) @@ -2192,8 +2192,8 @@ void LLDAELoader::processElement( daeElement* element, bool& badElement, DAE* da //process children daeTArray< daeSmartRef<daeElement> > children = element->getChildren(); - int childCount = children.getCount(); - for (S32 i = 0; i < childCount; i++) + auto childCount = children.getCount(); + for (size_t i = 0; i < childCount; i++) { processElement(children[i],badElement, dae); } @@ -2264,7 +2264,7 @@ std::map<std::string, LLImportMaterial> LLDAELoader::getMaterials(LLModel* model LLImportMaterial LLDAELoader::profileToMaterial(domProfile_COMMON* material, DAE* dae) { LLImportMaterial mat; - mat.mFullbright = FALSE; + mat.mFullbright = false; daeElement* diffuse = material->getDescendant("diffuse"); if (diffuse) @@ -2349,7 +2349,7 @@ LLImportMaterial LLDAELoader::profileToMaterial(domProfile_COMMON* material, DAE LLColor4 emission_color = getDaeColor(emission); if (((emission_color[0] + emission_color[1] + emission_color[2]) / 3.0) > 0.25) { - mat.mFullbright = TRUE; + mat.mFullbright = true; } } @@ -2568,7 +2568,7 @@ bool LLDAELoader::loadModelsFromDomMesh(domMesh* mesh, std::vector<LLModel*>& mo ret->remapVolumeFaces(); } - volume_faces = remainder.size(); + volume_faces = static_cast<U32>(remainder.size()); models_out.push_back(ret); diff --git a/indra/llprimitive/llgltfloader.cpp b/indra/llprimitive/llgltfloader.cpp index 810b648f17..776f81cc01 100644 --- a/indra/llprimitive/llgltfloader.cpp +++ b/indra/llprimitive/llgltfloader.cpp @@ -231,7 +231,7 @@ bool LLGLTFLoader::parseMaterials() image.numChannels = in_image.component; image.bytesPerChannel = in_image.bits >> 3; // Convert bits to bytes image.pixelType = in_image.pixel_type; // Maps exactly, i.e. TINYGLTF_COMPONENT_TYPE_UNSIGNED_BYTE == GL_UNSIGNED_BYTE, etc - image.size = in_image.image.size(); + image.size = static_cast<U32>(in_image.image.size()); image.height = in_image.height; image.width = in_image.width; image.data = in_image.image.data(); diff --git a/indra/llprimitive/llgltfmaterial.cpp b/indra/llprimitive/llgltfmaterial.cpp index 034017e3f3..e8c9af5ea3 100644 --- a/indra/llprimitive/llgltfmaterial.cpp +++ b/indra/llprimitive/llgltfmaterial.cpp @@ -47,16 +47,58 @@ const char* const LLGLTFMaterial::GLTF_FILE_EXTENSION_TRANSFORM_ROTATION = "rota // special UUID that indicates a null UUID in override data const LLUUID LLGLTFMaterial::GLTF_OVERRIDE_NULL_UUID = LLUUID("ffffffff-ffff-ffff-ffff-ffffffffffff"); -void LLGLTFMaterial::TextureTransform::getPacked(F32 (&packed)[8]) const +LLGLTFMaterial::LLGLTFMaterial() +{ + // IMPORTANT: since we use the hash of the member variables memory block of + // this class to detect changes, we must ensure that all its padding bytes + // have been zeroed out. But of course, we must leave the LLRefCount member + // variable untouched (and skip it when hashing), and we cannot either + // touch the local texture overrides map (else we destroy pointers, and + // sundry private data, which would lead to a crash when using that map). + // The variable members have therefore been arranged so that anything, + // starting at mLocalTexDataDigest and up to the end of the members, can be + // safely zeroed. HB + const size_t offset = intptr_t(&mLocalTexDataDigest) - intptr_t(this); + memset((void*)((const char*)this + offset), 0, sizeof(*this) - offset); + + // Now that we zeroed out our member variables, we can set the ones that + // should not be zero to their default value. HB + mBaseColor.set(1.f, 1.f, 1.f, 1.f); + mMetallicFactor = mRoughnessFactor = 1.f; + mAlphaCutoff = 0.5f; + for (U32 i = 0; i < GLTF_TEXTURE_INFO_COUNT; ++i) + { + mTextureTransform[i].mScale.set(1.f, 1.f); +#if 0 + mTextureTransform[i].mOffset.clear(); + mTextureTransform[i].mRotation = 0.f; +#endif + } +#if 0 + mLocalTexDataDigest = 0; + mAlphaMode = ALPHA_MODE_OPAQUE; // This is 0 + mOverrideDoubleSided = mOverrideAlphaMode = false; +#endif +} + +void LLGLTFMaterial::TextureTransform::getPacked(Pack& packed) const { packed[0] = mScale.mV[VX]; packed[1] = mScale.mV[VY]; packed[2] = mRotation; - // packed[3] = unused packed[4] = mOffset.mV[VX]; packed[5] = mOffset.mV[VY]; - // packed[6] = unused - // packed[7] = unused + // Not used but nonetheless zeroed for proper hashing. HB + packed[3] = packed[6] = packed[7] = 0.f; +} + +void LLGLTFMaterial::TextureTransform::getPackedTight(PackTight& packed) const +{ + packed[0] = mScale.mV[VX]; + packed[1] = mScale.mV[VY]; + packed[2] = mRotation; + packed[3] = mOffset.mV[VX]; + packed[4] = mOffset.mV[VY]; } bool LLGLTFMaterial::TextureTransform::operator==(const TextureTransform& other) const @@ -89,13 +131,37 @@ LLGLTFMaterial& LLGLTFMaterial::operator=(const LLGLTFMaterial& rhs) mOverrideDoubleSided = rhs.mOverrideDoubleSided; mOverrideAlphaMode = rhs.mOverrideAlphaMode; - mTrackingIdToLocalTexture = rhs.mTrackingIdToLocalTexture; - - updateTextureTracking(); + if (rhs.mTrackingIdToLocalTexture.empty()) + { + mTrackingIdToLocalTexture.clear(); + mLocalTexDataDigest = 0; + } + else + { + mTrackingIdToLocalTexture = rhs.mTrackingIdToLocalTexture; + updateLocalTexDataDigest(); + updateTextureTracking(); + } return *this; } +void LLGLTFMaterial::updateLocalTexDataDigest() +{ + mLocalTexDataDigest = 0; + if (!mTrackingIdToLocalTexture.empty()) + { + for (local_tex_map_t::const_iterator + it = mTrackingIdToLocalTexture.begin(), + end = mTrackingIdToLocalTexture.end(); + it != end; ++it) + { + mLocalTexDataDigest ^= it->first.getDigest64() ^ + it->second.getDigest64(); + } + } +} + bool LLGLTFMaterial::operator==(const LLGLTFMaterial& rhs) const { return mTextureId == rhs.mTextureId && @@ -123,7 +189,7 @@ bool LLGLTFMaterial::fromJSON(const std::string& json, std::string& warn_msg, st tinygltf::Model model_in; - if (gltf.LoadASCIIFromString(&model_in, &error_msg, &warn_msg, json.c_str(), json.length(), "")) + if (gltf.LoadASCIIFromString(&model_in, &error_msg, &warn_msg, json.c_str(), static_cast<unsigned int>(json.length()), "")) { setFromModel(model_in, 0); @@ -547,7 +613,7 @@ void LLGLTFMaterial::applyOverride(const LLGLTFMaterial& override_mat) { LL_PROFILE_ZONE_SCOPED; - for (int i = 0; i < GLTF_TEXTURE_INFO_COUNT; ++i) + for (U32 i = 0; i < GLTF_TEXTURE_INFO_COUNT; ++i) { LLUUID& texture_id = mTextureId[i]; const LLUUID& override_texture_id = override_mat.mTextureId[i]; @@ -588,7 +654,7 @@ void LLGLTFMaterial::applyOverride(const LLGLTFMaterial& override_mat) mDoubleSided = override_mat.mDoubleSided; } - for (int i = 0; i < GLTF_TEXTURE_INFO_COUNT; ++i) + for (U32 i = 0; i < GLTF_TEXTURE_INFO_COUNT; ++i) { if (override_mat.mTextureTransform[i].mOffset != getDefaultTextureOffset()) { @@ -606,21 +672,25 @@ void LLGLTFMaterial::applyOverride(const LLGLTFMaterial& override_mat) } } - mTrackingIdToLocalTexture.insert(override_mat.mTrackingIdToLocalTexture.begin(), override_mat.mTrackingIdToLocalTexture.begin()); - - updateTextureTracking(); + if (!override_mat.mTrackingIdToLocalTexture.empty()) + { + auto it = override_mat.mTrackingIdToLocalTexture.begin(); + mTrackingIdToLocalTexture.insert(it, it); + updateLocalTexDataDigest(); + updateTextureTracking(); + } } -void LLGLTFMaterial::getOverrideLLSD(const LLGLTFMaterial& override_mat, LLSD& data) +void LLGLTFMaterial::getOverrideLLSD(const LLGLTFMaterial& override_mat, LLSD& data) const { LL_PROFILE_ZONE_SCOPED; llassert(data.isUndefined()); // make every effort to shave bytes here - for (int i = 0; i < GLTF_TEXTURE_INFO_COUNT; ++i) + for (U32 i = 0; i < GLTF_TEXTURE_INFO_COUNT; ++i) { - LLUUID& texture_id = mTextureId[i]; + const LLUUID& texture_id = mTextureId[i]; const LLUUID& override_texture_id = override_mat.mTextureId[i]; if (override_texture_id.notNull() && override_texture_id != texture_id) { @@ -663,7 +733,7 @@ void LLGLTFMaterial::getOverrideLLSD(const LLGLTFMaterial& override_mat, LLSD& d data["ds"] = override_mat.mDoubleSided; } - for (int i = 0; i < GLTF_TEXTURE_INFO_COUNT; ++i) + for (U32 i = 0; i < GLTF_TEXTURE_INFO_COUNT; ++i) { if (override_mat.mTextureTransform[i].mOffset != getDefaultTextureOffset()) { @@ -767,7 +837,7 @@ void LLGLTFMaterial::applyOverrideLLSD(const LLSD& data) const LLSD& ti = data["ti"]; if (ti.isArray()) { - for (int i = 0; i < GLTF_TEXTURE_INFO_COUNT; ++i) + for (U32 i = 0; i < GLTF_TEXTURE_INFO_COUNT; ++i) { const LLSD& o = ti[i]["o"]; if (o.isDefined()) @@ -793,27 +863,36 @@ void LLGLTFMaterial::applyOverrideLLSD(const LLSD& data) LLUUID LLGLTFMaterial::getHash() const { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; - // HACK - hash the bytes of this object but don't include the ref count - LLUUID hash; - HBXXH128::digest(hash, (unsigned char*)this + sizeof(LLRefCount), sizeof(*this) - sizeof(LLRefCount)); - return hash; + // *HACK: hash the bytes of this object but do not include the ref count + // neither the local texture overrides (which is a map, with pointers to + // key/value pairs that would change from one LLGLTFMaterial instance to + // the other, even though the key/value pairs could be the same, and stored + // elsewhere in the memory heap or on the stack). + // Note: this does work properly to compare two LLGLTFMaterial instances + // only because the padding bytes between their member variables have been + // dutifully zeroed in the constructor. HB + const size_t offset = intptr_t(&mLocalTexDataDigest) - intptr_t(this); + return HBXXH128::digest((const void*)((const char*)this + offset), + sizeof(*this) - offset); } void LLGLTFMaterial::addLocalTextureTracking(const LLUUID& tracking_id, const LLUUID& tex_id) { mTrackingIdToLocalTexture[tracking_id] = tex_id; + updateLocalTexDataDigest(); } void LLGLTFMaterial::removeLocalTextureTracking(const LLUUID& tracking_id) { mTrackingIdToLocalTexture.erase(tracking_id); + updateLocalTexDataDigest(); } bool LLGLTFMaterial::replaceLocalTexture(const LLUUID& tracking_id, const LLUUID& old_id, const LLUUID& new_id) { bool res = false; - for (int i = 0; i < GLTF_TEXTURE_INFO_COUNT; ++i) + for (U32 i = 0; i < GLTF_TEXTURE_INFO_COUNT; ++i) { if (mTextureId[i] == old_id) { @@ -834,6 +913,7 @@ bool LLGLTFMaterial::replaceLocalTexture(const LLUUID& tracking_id, const LLUUID { mTrackingIdToLocalTexture.erase(tracking_id); } + updateLocalTexDataDigest(); return res; } diff --git a/indra/llprimitive/llgltfmaterial.h b/indra/llprimitive/llgltfmaterial.h index 3726bf2a28..b89853c9fd 100644 --- a/indra/llprimitive/llgltfmaterial.h +++ b/indra/llprimitive/llgltfmaterial.h @@ -5,21 +5,21 @@ * $LicenseInfo:firstyear=2022&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2022, 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$ */ @@ -69,7 +69,12 @@ public: LLVector2 mScale = { 1.f, 1.f }; F32 mRotation = 0.f; - void getPacked(F32 (&packed)[8]) const; + static const size_t PACK_SIZE = 8; + static const size_t PACK_TIGHT_SIZE = 5; + using Pack = F32[PACK_SIZE]; + using PackTight = F32[PACK_TIGHT_SIZE]; + void getPacked(Pack& packed) const; + void getPackedTight(PackTight& packed) const; bool operator==(const TextureTransform& other) const; bool operator!=(const TextureTransform& other) const { return !(*this == other); } @@ -82,7 +87,7 @@ public: ALPHA_MODE_MASK }; - LLGLTFMaterial() {} + LLGLTFMaterial(); LLGLTFMaterial(const LLGLTFMaterial& rhs); LLGLTFMaterial& operator=(const LLGLTFMaterial& rhs); @@ -111,42 +116,6 @@ public: static const char* const GLTF_FILE_EXTENSION_TRANSFORM_ROTATION; static const LLUUID GLTF_OVERRIDE_NULL_UUID; - std::array<LLUUID, GLTF_TEXTURE_INFO_COUNT> mTextureId; - std::array<TextureTransform, GLTF_TEXTURE_INFO_COUNT> mTextureTransform; - - // NOTE: initialize values to defaults according to the GLTF spec - // NOTE: these values should be in linear color space - LLColor4 mBaseColor = LLColor4(1, 1, 1, 1); - LLColor3 mEmissiveColor = LLColor3(0, 0, 0); - - F32 mMetallicFactor = 1.f; - F32 mRoughnessFactor = 1.f; - F32 mAlphaCutoff = 0.5f; - - AlphaMode mAlphaMode = ALPHA_MODE_OPAQUE; - - bool mDoubleSided = false; - - // override specific flags for state that can't use off-by-epsilon or UUID hack - bool mOverrideDoubleSided = false; - bool mOverrideAlphaMode = false; - - // *TODO: If/when we implement additional GLTF extensions, they may not be - // compatible with our GLTF terrain implementation. We may want to disallow - // materials with some features from being set on terrain, if their - // implementation on terrain is not compliant with the spec: - // - KHR_materials_transmission: Probably OK? - // - KHR_materials_ior: Probably OK? - // - KHR_materials_volume: Likely incompatible, as our terrain - // heightmaps cannot currently be described as finite enclosed - // volumes. - // See also LLPanelRegionTerrainInfo::validateMaterials - // These fields are local to viewer and are a part of local bitmap support - typedef std::map<LLUUID, LLUUID> local_tex_map_t; - local_tex_map_t mTrackingIdToLocalTexture; - -public: - // get a UUID based on a hash of this LLGLTFMaterial LLUUID getHash() const; @@ -215,14 +184,14 @@ public: void writeToModel(tinygltf::Model& model, S32 mat_index) const; virtual void applyOverride(const LLGLTFMaterial& override_mat); - + // apply the given LLSD override data void applyOverrideLLSD(const LLSD& data); // Get the given override on this LLGLTFMaterial as LLSD // override_mat -- the override source data // data -- output LLSD object (should be passed in empty) - void getOverrideLLSD(const LLGLTFMaterial& override_mat, LLSD& data); + void getOverrideLLSD(const LLGLTFMaterial& override_mat, LLSD& data) const; // For base materials only (i.e. assets). Clears transforms to // default since they're not supported in assets yet. @@ -246,7 +215,6 @@ public: bool hasLocalTextures() { return !mTrackingIdToLocalTexture.empty(); } virtual bool replaceLocalTexture(const LLUUID& tracking_id, const LLUUID &old_id, const LLUUID& new_id); virtual void updateTextureTracking(); - protected: static LLVector2 vec2FromJson(const std::map<std::string, tinygltf::Value>& object, const char* key, const LLVector2& default_value); static F32 floatFromJson(const std::map<std::string, tinygltf::Value>& object, const char* key, const F32 default_value); @@ -263,4 +231,49 @@ protected: void writeToTexture(tinygltf::Model& model, T& texture_info, TextureInfo texture_info_id, bool force_write = false) const; template<typename T> static void writeToTexture(tinygltf::Model& model, T& texture_info, const LLUUID& texture_id, const TextureTransform& transform, bool force_write = false); + + // Used to update the digest of the mTrackingIdToLocalTexture map each time + // it is changed; this way, that digest can be used by the fast getHash() + // method intsead of having to hash all individual keys and values. HB + void updateLocalTexDataDigest(); + +public: + // *TODO: If/when we implement additional GLTF extensions, they may not be + // compatible with our GLTF terrain implementation. We may want to disallow + // materials with some features from being set on terrain, if their + // implementation on terrain is not compliant with the spec: + // - KHR_materials_transmission: Probably OK? + // - KHR_materials_ior: Probably OK? + // - KHR_materials_volume: Likely incompatible, as our terrain + // heightmaps cannot currently be described as finite enclosed + // volumes. + // See also LLPanelRegionTerrainInfo::validateMaterials + // These fields are local to viewer and are a part of local bitmap support + typedef std::map<LLUUID, LLUUID> local_tex_map_t; + local_tex_map_t mTrackingIdToLocalTexture; + + // Used to store a digest of mTrackingIdToLocalTexture when the latter is + // not empty, or zero otherwise. HB + U64 mLocalTexDataDigest; + + std::array<LLUUID, GLTF_TEXTURE_INFO_COUNT> mTextureId; + std::array<TextureTransform, GLTF_TEXTURE_INFO_COUNT> mTextureTransform; + + // NOTE: initialize values to defaults according to the GLTF spec + // NOTE: these values should be in linear color space + LLColor4 mBaseColor; + LLColor3 mEmissiveColor; + + F32 mMetallicFactor; + F32 mRoughnessFactor; + F32 mAlphaCutoff; + + AlphaMode mAlphaMode; + + bool mDoubleSided = false; + + // Override specific flags for state that can't use off-by-epsilon or UUID + // hack + bool mOverrideDoubleSided = false; + bool mOverrideAlphaMode = false; }; diff --git a/indra/llprimitive/llgltfmaterial_templates.h b/indra/llprimitive/llgltfmaterial_templates.h index 276cc71b19..4ec7f312af 100644 --- a/indra/llprimitive/llgltfmaterial_templates.h +++ b/indra/llprimitive/llgltfmaterial_templates.h @@ -87,12 +87,12 @@ void LLGLTFMaterial::setFromTexture(const tinygltf::Model& model, const T& textu template<typename T> void LLGLTFMaterial::allocateTextureImage(tinygltf::Model& model, T& texture_info, const std::string& uri) { - const S32 image_idx = model.images.size(); + const S32 image_idx = static_cast<S32>(model.images.size()); model.images.emplace_back(); model.images[image_idx].uri = uri; // The texture, not to be confused with the texture info - const S32 texture_idx = model.textures.size(); + const S32 texture_idx = static_cast<S32>(model.textures.size()); model.textures.emplace_back(); tinygltf::Texture& texture = model.textures[texture_idx]; texture.source = image_idx; diff --git a/indra/llprimitive/llmaterial.cpp b/indra/llprimitive/llmaterial.cpp index 0453a8f469..fe1587d197 100644 --- a/indra/llprimitive/llmaterial.cpp +++ b/indra/llprimitive/llmaterial.cpp @@ -427,7 +427,7 @@ bool LLMaterial::operator != (const LLMaterial& rhs) const } -U32 LLMaterial::getShaderMask(U32 alpha_mode, BOOL is_alpha) +U32 LLMaterial::getShaderMask(U32 alpha_mode, bool is_alpha) { //NEVER incorporate this value into the message system -- this function will vary depending on viewer implementation //two least significant bits are "diffuse alpha mode" diff --git a/indra/llprimitive/llmaterial.h b/indra/llprimitive/llmaterial.h index c6bd5a94ce..a7719c1475 100644 --- a/indra/llprimitive/llmaterial.h +++ b/indra/llprimitive/llmaterial.h @@ -122,7 +122,7 @@ public: bool operator == (const LLMaterial& rhs) const; bool operator != (const LLMaterial& rhs) const; - U32 getShaderMask(U32 alpha_mode, BOOL is_alpha); + U32 getShaderMask(U32 alpha_mode, bool is_alpha); LLUUID getHash() const; protected: diff --git a/indra/llprimitive/llmaterialtable.cpp b/indra/llprimitive/llmaterialtable.cpp index 344bd49e6d..44c97d63e7 100644 --- a/indra/llprimitive/llmaterialtable.cpp +++ b/indra/llprimitive/llmaterialtable.cpp @@ -341,21 +341,21 @@ void LLMaterialTable::initBasicTable() } } -BOOL LLMaterialTable::add(U8 mcode, const std::string& name, const LLUUID &uuid) +bool LLMaterialTable::add(U8 mcode, const std::string& name, const LLUUID &uuid) { LLMaterialInfo *infop; infop = new LLMaterialInfo(mcode,name,uuid); - if (!infop) return FALSE; + if (!infop) return false; // Add at the end so the order in menus matches the order in this // file. JNC 11.30.01 mMaterialInfoList.push_back(infop); - return TRUE; + return true; } -BOOL LLMaterialTable::addCollisionSound(U8 mcode, U8 mcode2, const LLUUID &uuid) +bool LLMaterialTable::addCollisionSound(U8 mcode, U8 mcode2, const LLUUID &uuid) { if (mCollisionSoundMatrix && (mcode < LL_MCODE_END) && (mcode2 < LL_MCODE_END)) { @@ -365,10 +365,10 @@ BOOL LLMaterialTable::addCollisionSound(U8 mcode, U8 mcode2, const LLUUID &uuid) mCollisionSoundMatrix[mcode2 * LL_MCODE_END + mcode] = uuid; } } - return TRUE; + return true; } -BOOL LLMaterialTable::addSlidingSound(U8 mcode, U8 mcode2, const LLUUID &uuid) +bool LLMaterialTable::addSlidingSound(U8 mcode, U8 mcode2, const LLUUID &uuid) { if (mSlidingSoundMatrix && (mcode < LL_MCODE_END) && (mcode2 < LL_MCODE_END)) { @@ -378,10 +378,10 @@ BOOL LLMaterialTable::addSlidingSound(U8 mcode, U8 mcode2, const LLUUID &uuid) mSlidingSoundMatrix[mcode2 * LL_MCODE_END + mcode] = uuid; } } - return TRUE; + return true; } -BOOL LLMaterialTable::addRollingSound(U8 mcode, U8 mcode2, const LLUUID &uuid) +bool LLMaterialTable::addRollingSound(U8 mcode, U8 mcode2, const LLUUID &uuid) { if (mRollingSoundMatrix && (mcode < LL_MCODE_END) && (mcode2 < LL_MCODE_END)) { @@ -391,10 +391,10 @@ BOOL LLMaterialTable::addRollingSound(U8 mcode, U8 mcode2, const LLUUID &uuid) mRollingSoundMatrix[mcode2 * LL_MCODE_END + mcode] = uuid; } } - return TRUE; + return true; } -BOOL LLMaterialTable::addShatterSound(U8 mcode, const LLUUID &uuid) +bool LLMaterialTable::addShatterSound(U8 mcode, const LLUUID &uuid) { for (info_list_t::iterator iter = mMaterialInfoList.begin(); iter != mMaterialInfoList.end(); ++iter) @@ -403,14 +403,14 @@ BOOL LLMaterialTable::addShatterSound(U8 mcode, const LLUUID &uuid) if (mcode == infop->mMCode) { infop->mShatterSoundID = uuid; - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL LLMaterialTable::addDensity(U8 mcode, const F32 &density) +bool LLMaterialTable::addDensity(U8 mcode, const F32 &density) { for (info_list_t::iterator iter = mMaterialInfoList.begin(); iter != mMaterialInfoList.end(); ++iter) @@ -419,14 +419,14 @@ BOOL LLMaterialTable::addDensity(U8 mcode, const F32 &density) if (mcode == infop->mMCode) { infop->mDensity = density; - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL LLMaterialTable::addRestitution(U8 mcode, const F32 &restitution) +bool LLMaterialTable::addRestitution(U8 mcode, const F32 &restitution) { for (info_list_t::iterator iter = mMaterialInfoList.begin(); iter != mMaterialInfoList.end(); ++iter) @@ -435,14 +435,14 @@ BOOL LLMaterialTable::addRestitution(U8 mcode, const F32 &restitution) if (mcode == infop->mMCode) { infop->mRestitution = restitution; - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL LLMaterialTable::addFriction(U8 mcode, const F32 &friction) +bool LLMaterialTable::addFriction(U8 mcode, const F32 &friction) { for (info_list_t::iterator iter = mMaterialInfoList.begin(); iter != mMaterialInfoList.end(); ++iter) @@ -451,14 +451,14 @@ BOOL LLMaterialTable::addFriction(U8 mcode, const F32 &friction) if (mcode == infop->mMCode) { infop->mFriction = friction; - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL LLMaterialTable::addDamageAndEnergy(U8 mcode, const F32 &hp_mod, const F32 &damage_mod, const F32 &ep_mod) +bool LLMaterialTable::addDamageAndEnergy(U8 mcode, const F32 &hp_mod, const F32 &damage_mod, const F32 &ep_mod) { for (info_list_t::iterator iter = mMaterialInfoList.begin(); iter != mMaterialInfoList.end(); ++iter) @@ -469,11 +469,11 @@ BOOL LLMaterialTable::addDamageAndEnergy(U8 mcode, const F32 &hp_mod, const F32 infop->mHPModifier = hp_mod; infop->mDamageModifier = damage_mod; infop->mEPModifier = ep_mod; - return TRUE; + return true; } } - return FALSE; + return false; } LLUUID LLMaterialTable::getDefaultTextureID(const std::string& name) diff --git a/indra/llprimitive/llmaterialtable.h b/indra/llprimitive/llmaterialtable.h index d612361041..7d1d5c7d34 100644 --- a/indra/llprimitive/llmaterialtable.h +++ b/indra/llprimitive/llmaterialtable.h @@ -106,15 +106,15 @@ public: void initTableTransNames(std::map<std::string, std::string> namemap); - BOOL add(U8 mcode, const std::string& name, const LLUUID &uuid); - BOOL addCollisionSound(U8 mcode, U8 mcode2, const LLUUID &uuid); - BOOL addSlidingSound(U8 mcode, U8 mcode2, const LLUUID &uuid); - BOOL addRollingSound(U8 mcode, U8 mcode2, const LLUUID &uuid); - BOOL addShatterSound(U8 mcode, const LLUUID &uuid); - BOOL addDensity(U8 mcode, const F32 &density); - BOOL addFriction(U8 mcode, const F32 &friction); - BOOL addRestitution(U8 mcode, const F32 &restitution); - BOOL addDamageAndEnergy(U8 mcode, const F32 &hp_mod, const F32 &damage_mod, const F32 &ep_mod); + bool add(U8 mcode, const std::string& name, const LLUUID &uuid); + bool addCollisionSound(U8 mcode, U8 mcode2, const LLUUID &uuid); + bool addSlidingSound(U8 mcode, U8 mcode2, const LLUUID &uuid); + bool addRollingSound(U8 mcode, U8 mcode2, const LLUUID &uuid); + bool addShatterSound(U8 mcode, const LLUUID &uuid); + bool addDensity(U8 mcode, const F32 &density); + bool addFriction(U8 mcode, const F32 &friction); + bool addRestitution(U8 mcode, const F32 &restitution); + bool addDamageAndEnergy(U8 mcode, const F32 &hp_mod, const F32 &damage_mod, const F32 &ep_mod); LLUUID getDefaultTextureID(const std::string& name); // LLUUID::null if not found LLUUID getDefaultTextureID(U8 mcode); // LLUUID::null if not found diff --git a/indra/llprimitive/llmediaentry.cpp b/indra/llprimitive/llmediaentry.cpp index e626a989f6..b5b17c53aa 100644 --- a/indra/llprimitive/llmediaentry.cpp +++ b/indra/llprimitive/llmediaentry.cpp @@ -353,7 +353,7 @@ U32 LLMediaEntry::setWhiteList( const std::vector<std::string> &whitelist ) { // *NOTE: This code is VERY similar to the setWhitelist below. // IF YOU CHANGE THIS IMPLEMENTATION, BE SURE TO CHANGE THE OTHER! - U32 size = 0; + size_t size = 0; U32 count = 0; // First count to make sure the size constraint is not violated std::vector<std::string>::const_iterator iter = whitelist.begin(); @@ -394,7 +394,7 @@ U32 LLMediaEntry::setWhiteList( const LLSD &whitelist ) { // *NOTE: This code is VERY similar to the setWhitelist above. // IF YOU CHANGE THIS IMPLEMENTATION, BE SURE TO CHANGE THE OTHER! - U32 size = 0; + size_t size = 0; U32 count = 0; // First check to make sure the size and count constraints are not violated LLSD::array_const_iterator iter = whitelist.beginArray(); diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index d21c6e974a..4a185f8ba9 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -50,7 +50,7 @@ std::string model_names[] = const int MODEL_NAMES_LENGTH = sizeof(model_names) / sizeof(std::string); -LLModel::LLModel(LLVolumeParams& params, F32 detail) +LLModel::LLModel(const LLVolumeParams& params, F32 detail) : LLVolume(params, detail), mNormalizedScale(1,1,1), mNormalizedTranslation(0, 0, 0), @@ -106,7 +106,7 @@ void LLModel::offsetMesh(const LLVector3& pivotPoint) void LLModel::remapVolumeFaces() { - for (U32 i = 0; i < getNumVolumeFaces(); ++i) + for (S32 i = 0; i < getNumVolumeFaces(); ++i) { mVolumeFaces[i].remap(); } @@ -114,7 +114,7 @@ void LLModel::remapVolumeFaces() void LLModel::optimizeVolumeFaces() { - for (U32 i = 0; i < getNumVolumeFaces(); ++i) + for (S32 i = 0; i < getNumVolumeFaces(); ++i) { mVolumeFaces[i].optimize(); } @@ -169,7 +169,7 @@ void LLModel::trimVolumeFacesToSize(U32 new_count, LLVolume::face_list_t* remain { llassert(new_count <= LL_SCULPT_MESH_MAX_FACES); - if (new_count && (getNumVolumeFaces() > new_count)) + if (new_count > 0 && ((U32)getNumVolumeFaces() > new_count)) { // Copy out remaining volume faces for alternative handling, if provided // @@ -220,7 +220,7 @@ void LLModel::normalizeVolumeFaces() min_tc = face.mTexCoords[0]; max_tc = face.mTexCoords[0]; - for (U32 j = 1; j < face.mNumVertices; ++j) + for (S32 j = 1; j < face.mNumVertices; ++j) { update_min_max(min_tc, max_tc, face.mTexCoords[j]); } @@ -295,7 +295,7 @@ void LLModel::normalizeVolumeFaces() LLVector4a* norm = (LLVector4a*) face.mNormals; LLVector4a* t = (LLVector4a*)face.mTangents; - for (U32 j = 0; j < face.mNumVertices; ++j) + for (S32 j = 0; j < face.mNumVertices; ++j) { pos[j].add(trans); pos[j].mul(scale); @@ -359,7 +359,7 @@ LLVector3 LLModel::getTransformedCenter(const LLMatrix4& mat) { LLVolumeFace& face = mVolumeFaces[i]; - for (U32 j = 0; j < face.mNumVertices; ++j) + for (S32 j = 0; j < face.mNumVertices; ++j) { m.affineTransform(face.mPositions[j],t); update_min_max(minv, maxv, t); @@ -471,7 +471,7 @@ void LLModel::generateNormals(F32 angle_cutoff) faceted.resizeVertices(vol_face.mNumIndices); faceted.resizeIndices(vol_face.mNumIndices); //bake out triangles into temporary face, clearing texture coordinates - for (U32 i = 0; i < vol_face.mNumIndices; ++i) + for (S32 i = 0; i < vol_face.mNumIndices; ++i) { U32 idx = vol_face.mIndices[i]; @@ -481,7 +481,7 @@ void LLModel::generateNormals(F32 angle_cutoff) } //generate normals for temporary face - for (U32 i = 0; i < faceted.mNumIndices; i += 3) + for (S32 i = 0; i < faceted.mNumIndices; i += 3) { //for each triangle U16 i0 = faceted.mIndices[i+0]; U16 i1 = faceted.mIndices[i+1]; @@ -510,12 +510,12 @@ void LLModel::generateNormals(F32 angle_cutoff) //generate normals for welded face based on new topology (step 3) - for (U32 i = 0; i < faceted.mNumVertices; i++) + for (S32 i = 0; i < faceted.mNumVertices; i++) { faceted.mNormals[i].clear(); } - for (U32 i = 0; i < faceted.mNumIndices; i += 3) + for (S32 i = 0; i < faceted.mNumIndices; i += 3) { //for each triangle U16 i0 = faceted.mIndices[i+0]; U16 i1 = faceted.mIndices[i+1]; @@ -544,7 +544,7 @@ void LLModel::generateNormals(F32 angle_cutoff) //normalize normals and build point map LLVolumeFace::VertexMapData::PointMap point_map; - for (U32 i = 0; i < faceted.mNumVertices; ++i) + for (S32 i = 0; i < faceted.mNumVertices; ++i) { faceted.mNormals[i].normalize3(); @@ -562,7 +562,7 @@ void LLModel::generateNormals(F32 angle_cutoff) new_face.resizeIndices(vol_face.mNumIndices); new_face.resizeVertices(vol_face.mNumIndices); - for (U32 i = 0; i < vol_face.mNumIndices; ++i) + for (S32 i = 0; i < vol_face.mNumIndices; ++i) { U32 idx = vol_face.mIndices[i]; LLVolumeFace::VertexData v; @@ -573,7 +573,7 @@ void LLModel::generateNormals(F32 angle_cutoff) if (vol_face.mTexCoords) { - for (U32 i = 0; i < vol_face.mNumIndices; i++) + for (S32 i = 0; i < vol_face.mNumIndices; i++) { U32 idx = vol_face.mIndices[i]; new_face.mTexCoords[i] = vol_face.mTexCoords[idx]; @@ -586,7 +586,7 @@ void LLModel::generateNormals(F32 angle_cutoff) } //generate normals for new face - for (U32 i = 0; i < new_face.mNumIndices; i += 3) + for (S32 i = 0; i < new_face.mNumIndices; i += 3) { //for each triangle U16 i0 = new_face.mIndices[i+0]; U16 i1 = new_face.mIndices[i+1]; @@ -611,7 +611,7 @@ void LLModel::generateNormals(F32 angle_cutoff) } //swap out normals in new_face with best match from point map (step 5) - for (U32 i = 0; i < new_face.mNumVertices; ++i) + for (S32 i = 0; i < new_face.mNumVertices; ++i) { //LLVolumeFace::VertexData v = new_face.mVertices[i]; @@ -659,11 +659,11 @@ LLSD LLModel::writeModel( LLModel* low, LLModel* impostor, const LLModel::Decomposition& decomp, - BOOL upload_skin, - BOOL upload_joints, - BOOL lock_scale_if_joint_position, - BOOL nowrite, - BOOL as_slm, + bool upload_skin, + bool upload_joints, + bool lock_scale_if_joint_position, + bool nowrite, + bool as_slm, int submodel_id) { LLSD mdl; @@ -721,7 +721,7 @@ LLSD LLModel::writeModel( for (S32 i = 0; i < model[idx]->getNumVolumeFaces(); ++i) { //for each face const LLVolumeFace& face = model[idx]->getVolumeFace(i); - for (U32 j = 0; j < face.mNumVertices; ++j) + for (S32 j = 0; j < face.mNumVertices; ++j) { update_min_max(min_pos, max_pos, face.mPositions[j].getF32ptr()); } @@ -758,7 +758,7 @@ LLSD LLModel::writeModel( max_tc = min_tc; //get texture coordinate domain - for (U32 j = 0; j < face.mNumVertices; ++j) + for (S32 j = 0; j < face.mNumVertices; ++j) { update_min_max(min_tc, max_tc, ftc[j]); } @@ -766,7 +766,7 @@ LLSD LLModel::writeModel( LLVector2 tc_range = max_tc - min_tc; - for (U32 j = 0; j < face.mNumVertices; ++j) + for (S32 j = 0; j < face.mNumVertices; ++j) { //for each vert F32* pos = face.mPositions[j].getF32ptr(); @@ -836,7 +836,7 @@ LLSD LLModel::writeModel( } U32 idx_idx = 0; - for (U32 j = 0; j < face.mNumIndices; ++j) + for (S32 j = 0; j < face.mNumIndices; ++j) { U8* buff = (U8*) &(face.mIndices[j]); indices[idx_idx++] = buff[0]; @@ -883,7 +883,7 @@ LLSD LLModel::writeModel( // a bone index of 0xFF signifies no more influences for this vertex std::stringstream ostr; - for (U32 j = 0; j < face.mNumVertices; ++j) + for (S32 j = 0; j < face.mNumVertices; ++j) { LLVector3 pos(face.mPositions[j].getF32ptr()); @@ -914,7 +914,7 @@ LLSD LLModel::writeModel( //copy ostr to binary buffer std::string data = ostr.str(); const U8* buff = (U8*)data.data(); - U32 bytes = data.size(); + U32 bytes = static_cast<U32>(data.size()); LLSD::Binary w(bytes); for (U32 j = 0; j < bytes; ++j) @@ -944,7 +944,7 @@ LLSD LLModel::writeModel( return writeModelToStream(ostr, mdl, nowrite, as_slm); } -LLSD LLModel::writeModelToStream(std::ostream& ostr, LLSD& mdl, BOOL nowrite, BOOL as_slm) +LLSD LLModel::writeModelToStream(std::ostream& ostr, LLSD& mdl, bool nowrite, bool as_slm) { std::string::size_type cur_offset = 0; @@ -961,7 +961,7 @@ LLSD LLModel::writeModelToStream(std::ostream& ostr, LLSD& mdl, BOOL nowrite, BO { //write out skin block skin = zip_llsd(mdl["skin"]); - U32 size = skin.size(); + U32 size = static_cast<U32>(skin.size()); if (size > 0) { header["skin"]["offset"] = (LLSD::Integer) cur_offset; @@ -976,7 +976,7 @@ LLSD LLModel::writeModelToStream(std::ostream& ostr, LLSD& mdl, BOOL nowrite, BO { //write out convex decomposition decomposition = zip_llsd(mdl["physics_convex"]); - U32 size = decomposition.size(); + U32 size = static_cast<U32>(decomposition.size()); if (size > 0) { header["physics_convex"]["offset"] = (LLSD::Integer) cur_offset; @@ -998,7 +998,7 @@ LLSD LLModel::writeModelToStream(std::ostream& ostr, LLSD& mdl, BOOL nowrite, BO { out[i] = zip_llsd(mdl[model_names[i]]); - U32 size = out[i].size(); + U32 size = static_cast<U32>(out[i].size()); header[model_names[i]]["offset"] = (LLSD::Integer) cur_offset; header[model_names[i]]["size"] = (LLSD::Integer) size; @@ -1155,7 +1155,7 @@ void LLModel::updateHullCenters() mCenterOfHullCenters += cur_center; cur_center *= 1.f/mPhysics.mHull[i].size(); mHullCenter[i] = cur_center; - mHullPoints += mPhysics.mHull[i].size(); + mHullPoints += static_cast<U32>(mPhysics.mHull[i].size()); } if (mHullPoints > 0) @@ -1276,14 +1276,14 @@ bool LLModel::loadModel(std::istream& is) bool LLModel::isMaterialListSubset( LLModel* ref ) { - int refCnt = ref->mMaterialList.size(); - int modelCnt = mMaterialList.size(); + auto refCnt = ref->mMaterialList.size(); + auto modelCnt = mMaterialList.size(); - for (U32 src = 0; src < modelCnt; ++src) + for (size_t src = 0; src < modelCnt; ++src) { bool foundRef = false; - for (U32 dst = 0; dst < refCnt; ++dst) + for (size_t dst = 0; dst < refCnt; ++dst) { //LL_INFOS()<<mMaterialList[src]<<" "<<ref->mMaterialList[dst]<<LL_ENDL; foundRef = mMaterialList[src] == ref->mMaterialList[dst]; @@ -1626,15 +1626,15 @@ U32 LLMeshSkinInfo::sizeBytes() const { U32 res = sizeof(LLUUID); // mMeshID - res += sizeof(std::vector<std::string>) + sizeof(std::string) * mJointNames.size(); + res += sizeof(std::vector<std::string>) + sizeof(std::string) * static_cast<U32>(mJointNames.size()); for (U32 i = 0; i < mJointNames.size(); ++i) { - res += mJointNames[i].size(); // actual size, not capacity + res += static_cast<U32>(mJointNames[i].size()); // actual size, not capacity } - res += sizeof(std::vector<S32>) + sizeof(S32) * mJointNums.size(); - res += sizeof(std::vector<LLMatrix4>) + 16 * sizeof(float) * mInvBindMatrix.size(); - res += sizeof(std::vector<LLMatrix4>) + 16 * sizeof(float) * mAlternateBindMatrix.size(); + res += sizeof(std::vector<S32>) + sizeof(S32) * static_cast<U32>(mJointNums.size()); + res += sizeof(std::vector<LLMatrix4>) + 16 * sizeof(float) * static_cast<U32>(mInvBindMatrix.size()); + res += sizeof(std::vector<LLMatrix4>) + 16 * sizeof(float) * static_cast<U32>(mAlternateBindMatrix.size()); res += 16 * sizeof(float); //mBindShapeMatrix res += sizeof(float) + 3 * sizeof(bool); @@ -1751,15 +1751,15 @@ U32 LLModel::Decomposition::sizeBytes() const { U32 res = sizeof(LLUUID); // mMeshID - res += sizeof(LLModel::convex_hull_decomposition) + sizeof(std::vector<LLVector3>) * mHull.size(); + res += sizeof(LLModel::convex_hull_decomposition) + sizeof(std::vector<LLVector3>) * static_cast<U32>(mHull.size()); for (U32 i = 0; i < mHull.size(); ++i) { - res += mHull[i].size() * sizeof(LLVector3); + res += static_cast<U32>(mHull[i].size()) * sizeof(LLVector3); } - res += sizeof(LLModel::hull) + sizeof(LLVector3) * mBaseHull.size(); + res += sizeof(LLModel::hull) + sizeof(LLVector3) * static_cast<U32>(mBaseHull.size()); - res += sizeof(std::vector<LLModel::PhysicsMesh>) + sizeof(std::vector<LLModel::PhysicsMesh>) * mMesh.size(); + res += sizeof(std::vector<LLModel::PhysicsMesh>) + sizeof(std::vector<LLModel::PhysicsMesh>) * static_cast<U32>(mMesh.size()); for (U32 i = 0; i < mMesh.size(); ++i) { res += mMesh[i].sizeBytes(); @@ -1810,7 +1810,7 @@ LLSD LLModel::Decomposition::asLLSD() const for (U32 i = 0; i < mHull.size(); ++i) { - U32 size = mHull[i].size(); + U32 size = static_cast<U32>(mHull[i].size()); total += size; hulls[i] = (U8) (size); @@ -2011,7 +2011,7 @@ bool ll_is_degenerate(const LLVector4a& a, const LLVector4a& b, const LLVector4a bool validate_face(const LLVolumeFace& face) { - for (U32 i = 0; i < face.mNumIndices; ++i) + for (S32 i = 0; i < face.mNumIndices; ++i) { if (face.mIndices[i] >= face.mNumVertices) { diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index e874586e94..b9c6c9aa24 100644 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -124,8 +124,8 @@ public: U32 sizeBytes() const { U32 res = sizeof(std::vector<LLVector3>) * 2; - res += sizeof(LLVector3) * mPositions.size(); - res += sizeof(LLVector3) * mNormals.size(); + res += sizeof(LLVector3) * static_cast<U32>(mPositions.size()); + res += sizeof(LLVector3) * static_cast<U32>(mNormals.size()); return res; } }; @@ -152,7 +152,7 @@ public: LLModel::PhysicsMesh mPhysicsShapeMesh; }; - LLModel(LLVolumeParams& params, F32 detail); + LLModel(const LLVolumeParams& params, F32 detail); ~LLModel(); bool loadModel(std::istream& is); @@ -167,17 +167,17 @@ public: LLModel* low, LLModel* imposotr, const LLModel::Decomposition& decomp, - BOOL upload_skin, - BOOL upload_joints, - BOOL lock_scale_if_joint_position, - BOOL nowrite = FALSE, - BOOL as_slm = FALSE, + bool upload_skin, + bool upload_joints, + bool lock_scale_if_joint_position, + bool nowrite = false, + bool as_slm = false, int submodel_id = 0); static LLSD writeModelToStream( std::ostream& ostr, LLSD& mdl, - BOOL nowrite = FALSE, BOOL as_slm = FALSE); + bool nowrite = false, bool as_slm = false); void ClearFacesAndMaterials() { mVolumeFaces.clear(); mMaterialList.clear(); } @@ -258,17 +258,18 @@ public: } }; - //Are the doubles the same w/in epsilon specified tolerance bool areEqual( double a, double b ) { const float epsilon = 1e-5f; - return (fabs((a - b)) < epsilon) ? true : false ; + return fabs(a - b) < epsilon; } + //Make sure that we return false for any values that are within the tolerance for equivalence bool jointPositionalLookup( const LLVector3& a, const LLVector3& b ) { - return ( areEqual( a[0],b[0]) && areEqual( a[1],b[1] ) && areEqual( a[2],b[2]) ) ? true : false; + const float epsilon = 1e-5f; + return (a - b).length() < epsilon; } //copy of position array for this model -- mPosition[idx].mV[X,Y,Z] @@ -358,7 +359,7 @@ public: protected: LLUUID mDiffuseMapID; - void* mOpaqueData; // allow refs to viewer/platform-specific structs for each material + void* mOpaqueData{ nullptr }; // allow refs to viewer/platform-specific structs for each material // currently only stores an LLPointer< LLViewerFetchedTexture > > to // maintain refs to textures associated with each material for free // ref counting. @@ -376,7 +377,7 @@ public: LLMatrix4 mTransform; material_map mMaterial; - LLModelInstanceBase(LLModel* model, LLMatrix4& transform, material_map& materials) + LLModelInstanceBase(LLModel* model, const LLMatrix4& transform, const material_map& materials) : mModel(model), mTransform(transform), mMaterial(materials) { } @@ -405,7 +406,7 @@ public: LLUUID mMeshID; S32 mLocalMeshID; - LLModelInstance(LLModel* model, const std::string& label, LLMatrix4& transform, material_map& materials) + LLModelInstance(LLModel* model, const std::string& label, const LLMatrix4& transform, const material_map& materials) : LLModelInstanceBase(model, transform, materials), mLabel(label) { mLocalMeshID = -1; diff --git a/indra/llprimitive/llmodelloader.cpp b/indra/llprimitive/llmodelloader.cpp index 6093a41bc1..1a64e6227f 100644 --- a/indra/llprimitive/llmodelloader.cpp +++ b/indra/llprimitive/llmodelloader.cpp @@ -471,7 +471,7 @@ bool LLModelLoader::isRigSuitableForJointPositionUpload( const std::vector<std:: //called in the main thread void LLModelLoader::loadTextures() { - BOOL is_paused = isPaused() ; + bool is_paused = isPaused() ; pause() ; //pause the loader for(scene::iterator iter = mScene.begin(); iter != mScene.end(); ++iter) diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp index 87ee33a701..f6246e283f 100644 --- a/indra/llprimitive/llprimitive.cpp +++ b/indra/llprimitive/llprimitive.cpp @@ -115,8 +115,8 @@ const F32 FLEXIBLE_OBJECT_MAX_WIND_SENSITIVITY = 10.0f; const F32 FLEXIBLE_OBJECT_MAX_INTERNAL_TENSION_FORCE = 0.99f; const F32 FLEXIBLE_OBJECT_DEFAULT_LENGTH = 1.0f; -const BOOL FLEXIBLE_OBJECT_DEFAULT_USING_COLLISION_SPHERE = FALSE; -const BOOL FLEXIBLE_OBJECT_DEFAULT_RENDERING_COLLISION_SPHERE = FALSE; +const bool FLEXIBLE_OBJECT_DEFAULT_USING_COLLISION_SPHERE = false; +const bool FLEXIBLE_OBJECT_DEFAULT_RENDERING_COLLISION_SPHERE = false; const LLUUID SCULPT_DEFAULT_TEXTURE("be293869-d0d9-0a69-5989-ad27f1946fd4"); // old inverted texture: "7595d345-a24c-e7ef-f0bd-78793792133e"; @@ -172,7 +172,7 @@ void LLPrimitive::setVolumeManager( LLVolumeMgr* volume_manager ) // static bool LLPrimitive::cleanupVolumeManager() { - BOOL res = FALSE; + bool res = false; if (sVolumeManager) { res = sVolumeManager->cleanup(); @@ -770,16 +770,16 @@ S32 face_index_from_id(LLFaceID face_ID, const std::vector<LLProfile::Face>& fac return -1; } -BOOL LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume) +bool LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume) { if (NO_LOD == detail) { // build the new object setChanged(GEOMETRY); sVolumeManager->unrefVolume(mVolumep); - mVolumep = new LLVolume(volume_params, 1, TRUE, TRUE); + mVolumep = new LLVolume(volume_params, 1, true, true); setNumTEs(mVolumep->getNumFaces()); - return FALSE; + return false; } LLVolume *volumep; @@ -788,9 +788,9 @@ BOOL LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detai F32 volume_detail = LLVolumeLODGroup::getVolumeScaleFromDetail(detail); if (mVolumep.notNull() && volume_params == mVolumep->getParams() && (volume_detail == mVolumep->getDetail())) { - return FALSE; + return false; } - volumep = new LLVolume(volume_params, volume_detail, FALSE, TRUE); + volumep = new LLVolume(volume_params, volume_detail, false, true); } else { @@ -799,7 +799,7 @@ BOOL LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detai F32 volume_detail = LLVolumeLODGroup::getVolumeScaleFromDetail(detail); if (volume_params == mVolumep->getParams() && (volume_detail == mVolumep->getDetail())) { - return FALSE; + return false; } } @@ -807,7 +807,7 @@ BOOL LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detai if (volumep == mVolumep) { sVolumeManager->unrefVolume( volumep ); // LLVolumeMgr::refVolume() creates a reference, but we don't need a second one. - return TRUE; + return true; } } @@ -819,7 +819,7 @@ BOOL LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detai mVolumep = volumep; //mFaceMask = mVolumep->generateFaceMask(); setNumTEs(mVolumep->getNumFaces()); - return TRUE; + return true; } #if 0 @@ -871,14 +871,14 @@ BOOL LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detai if (old_face_mask == new_face_mask) { // nothing to do - return TRUE; + return true; } if (mVolumep->getNumFaces() == 0 && new_face_mask != 0) { LL_WARNS() << "Object with 0 faces found...INCORRECT!" << LL_ENDL; setNumTEs(mVolumep->getNumFaces()); - return TRUE; + return true; } // initialize face_mapping @@ -1030,19 +1030,19 @@ BOOL LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detai setNumTEs(mVolumep->getNumFaces()); #endif - return TRUE; + return true; } -BOOL LLPrimitive::setMaterial(U8 material) +bool LLPrimitive::setMaterial(U8 material) { if (material != mMaterial) { mMaterial = material; - return TRUE; + return true; } else { - return FALSE; + return false; } } @@ -1058,12 +1058,12 @@ S32 LLPrimitive::packTEField(U8 *cur_ptr, U8 *data_ptr, U8 data_size, U8 last_fa for (face_index = last_face_index-1; face_index >= 0; face_index--) { - BOOL already_sent = FALSE; + bool already_sent = false; for (i = face_index+1; i <= last_face_index; i++) { if (!memcmp(data_ptr+(data_size *face_index), data_ptr+(data_size *i), data_size)) { - already_sent = TRUE; + already_sent = true; break; } } @@ -1201,7 +1201,7 @@ namespace // Pack information about all texture entries into container: // { TextureEntry Variable 2 } // Includes information about image ID, color, scale S,T, offset S,T and rotation -BOOL LLPrimitive::packTEMessage(LLMessageSystem *mesgsys) const +bool LLPrimitive::packTEMessage(LLMessageSystem *mesgsys) const { const U32 MAX_TES = 45; @@ -1282,11 +1282,11 @@ BOOL LLPrimitive::packTEMessage(LLMessageSystem *mesgsys) const } mesgsys->addBinaryDataFast(_PREHASH_TextureEntry, packed_buffer, (S32)(cur_ptr - packed_buffer)); - return FALSE; + return true; } -BOOL LLPrimitive::packTEMessage(LLDataPacker &dp) const +bool LLPrimitive::packTEMessage(LLDataPacker &dp) const { const U32 MAX_TES = 45; @@ -1367,7 +1367,7 @@ BOOL LLPrimitive::packTEMessage(LLDataPacker &dp) const } dp.packBinaryData(packed_buffer, (S32)(cur_ptr - packed_buffer), "TextureEntry"); - return FALSE; + return true; } S32 LLPrimitive::parseTEMessage(LLMessageSystem* mesgsys, char const* block_name, const S32 block_num, LLTEContents& tec) @@ -1484,12 +1484,12 @@ S32 LLPrimitive::unpackTEMessage(LLDataPacker &dp) { // use a negative block_num to indicate a single-block read (a non-variable block) S32 retval = 0; - const U32 MAX_TES = 45; + constexpr U32 MAX_TES = 45; // Avoid construction of 32 UUIDs per call static LLMaterialID material_ids[MAX_TES]; - const U32 MAX_TE_BUFFER = 4096; + constexpr U32 MAX_TE_BUFFER = 4096; U8 packed_buffer[MAX_TE_BUFFER]; memset((void*)packed_buffer, 0, MAX_TE_BUFFER); @@ -1685,7 +1685,7 @@ bool LLPrimitive::getTESTAxes(const U8 face, U32* s_axis, U32* t_axis) //============================================================================ //static -BOOL LLNetworkData::isValid(U16 param_type, U32 size) +bool LLNetworkData::isValid(U16 param_type, U32 size) { // ew - better mechanism needed @@ -1707,7 +1707,7 @@ BOOL LLNetworkData::isValid(U16 param_type, U32 size) return (size == 9); } - return FALSE; + return false; } //============================================================================ @@ -1722,17 +1722,17 @@ LLLightParams::LLLightParams() mType = PARAMS_LIGHT; } -BOOL LLLightParams::pack(LLDataPacker &dp) const +bool LLLightParams::pack(LLDataPacker &dp) const { LLColor4U color4u(mColor); dp.packColor4U(color4u, "color"); dp.packF32(mRadius, "radius"); dp.packF32(mCutoff, "cutoff"); dp.packF32(mFalloff, "falloff"); - return TRUE; + return true; } -BOOL LLLightParams::unpack(LLDataPacker &dp) +bool LLLightParams::unpack(LLDataPacker &dp) { LLColor4U color; dp.unpackColor4U(color, "color"); @@ -1750,7 +1750,7 @@ BOOL LLLightParams::unpack(LLDataPacker &dp) dp.unpackF32(falloff, "falloff"); setFalloff(falloff); - return TRUE; + return true; } bool LLLightParams::operator==(const LLNetworkData& data) const @@ -1830,15 +1830,15 @@ LLReflectionProbeParams::LLReflectionProbeParams() mType = PARAMS_REFLECTION_PROBE; } -BOOL LLReflectionProbeParams::pack(LLDataPacker &dp) const +bool LLReflectionProbeParams::pack(LLDataPacker &dp) const { dp.packF32(mAmbiance, "ambiance"); dp.packF32(mClipDistance, "clip_distance"); dp.packU8(mFlags, "flags"); - return TRUE; + return true; } -BOOL LLReflectionProbeParams::unpack(LLDataPacker &dp) +bool LLReflectionProbeParams::unpack(LLDataPacker &dp) { F32 ambiance; F32 clip_distance; @@ -1851,7 +1851,7 @@ BOOL LLReflectionProbeParams::unpack(LLDataPacker &dp) dp.unpackU8(mFlags, "flags"); - return TRUE; + return true; } bool LLReflectionProbeParams::operator==(const LLNetworkData& data) const @@ -1962,7 +1962,7 @@ LLFlexibleObjectData::LLFlexibleObjectData() mType = PARAMS_FLEXIBLE; } -BOOL LLFlexibleObjectData::pack(LLDataPacker &dp) const +bool LLFlexibleObjectData::pack(LLDataPacker &dp) const { // Custom, uber-svelte pack "softness" in upper bits of tension & drag U8 bit1 = (mSimulateLOD & 2) << 6; @@ -1972,10 +1972,10 @@ BOOL LLFlexibleObjectData::pack(LLDataPacker &dp) const dp.packU8((U8)((mGravity+10.f)*10.01f), "gravity"); dp.packU8((U8)(mWindSensitivity*10.01f), "wind"); dp.packVector3(mUserForce, "userforce"); - return TRUE; + return true; } -BOOL LLFlexibleObjectData::unpack(LLDataPacker &dp) +bool LLFlexibleObjectData::unpack(LLDataPacker &dp) { U8 tension, friction, gravity, wind; U8 bit1, bit2; @@ -1994,7 +1994,7 @@ BOOL LLFlexibleObjectData::unpack(LLDataPacker &dp) { mUserForce.setVec(0.f, 0.f, 0.f); } - return TRUE; + return true; } bool LLFlexibleObjectData::operator==(const LLNetworkData& data) const @@ -2090,15 +2090,15 @@ LLSculptParams::LLSculptParams() mSculptType = LL_SCULPT_TYPE_SPHERE; } -BOOL LLSculptParams::pack(LLDataPacker &dp) const +bool LLSculptParams::pack(LLDataPacker &dp) const { dp.packUUID(mSculptTexture, "texture"); dp.packU8(mSculptType, "type"); - return TRUE; + return true; } -BOOL LLSculptParams::unpack(LLDataPacker &dp) +bool LLSculptParams::unpack(LLDataPacker &dp) { U8 type; LLUUID id; @@ -2106,7 +2106,7 @@ BOOL LLSculptParams::unpack(LLDataPacker &dp) dp.unpackU8(type, "type"); setSculptTexture(id, type); - return TRUE; + return true; } bool LLSculptParams::operator==(const LLNetworkData& data) const @@ -2190,20 +2190,20 @@ LLLightImageParams::LLLightImageParams() mParams.setVec(F_PI*0.5f, 0.f, 0.f); } -BOOL LLLightImageParams::pack(LLDataPacker &dp) const +bool LLLightImageParams::pack(LLDataPacker &dp) const { dp.packUUID(mLightTexture, "texture"); dp.packVector3(mParams, "params"); - return TRUE; + return true; } -BOOL LLLightImageParams::unpack(LLDataPacker &dp) +bool LLLightImageParams::unpack(LLDataPacker &dp) { dp.unpackUUID(mLightTexture, "texture"); dp.unpackVector3(mParams, "params"); - return TRUE; + return true; } bool LLLightImageParams::operator==(const LLNetworkData& data) const @@ -2266,18 +2266,18 @@ LLExtendedMeshParams::LLExtendedMeshParams() mFlags = 0; } -BOOL LLExtendedMeshParams::pack(LLDataPacker &dp) const +bool LLExtendedMeshParams::pack(LLDataPacker &dp) const { dp.packU32(mFlags, "flags"); - return TRUE; + return true; } -BOOL LLExtendedMeshParams::unpack(LLDataPacker &dp) +bool LLExtendedMeshParams::unpack(LLDataPacker &dp) { dp.unpackU32(mFlags, "flags"); - return TRUE; + return true; } bool LLExtendedMeshParams::operator==(const LLNetworkData& data) const @@ -2329,7 +2329,7 @@ LLRenderMaterialParams::LLRenderMaterialParams() mType = PARAMS_RENDER_MATERIAL; } -BOOL LLRenderMaterialParams::pack(LLDataPacker& dp) const +bool LLRenderMaterialParams::pack(LLDataPacker& dp) const { U8 count = (U8)llmin((S32)mEntries.size(), 14); //limited to 255 bytes, no more than 14 material ids @@ -2340,10 +2340,10 @@ BOOL LLRenderMaterialParams::pack(LLDataPacker& dp) const dp.packUUID(entry.id, "id"); } - return TRUE; + return true; } -BOOL LLRenderMaterialParams::unpack(LLDataPacker& dp) +bool LLRenderMaterialParams::unpack(LLDataPacker& dp) { U8 count; dp.unpackU8(count, "count"); @@ -2354,7 +2354,7 @@ BOOL LLRenderMaterialParams::unpack(LLDataPacker& dp) dp.unpackUUID(entry.id, "te_id"); } - return TRUE; + return true; } bool LLRenderMaterialParams::operator==(const LLNetworkData& data) const diff --git a/indra/llprimitive/llprimitive.h b/indra/llprimitive/llprimitive.h index 82881dce4e..31bc76344c 100644 --- a/indra/llprimitive/llprimitive.h +++ b/indra/llprimitive/llprimitive.h @@ -114,11 +114,11 @@ public: public: U16 mType; virtual ~LLNetworkData() {}; - virtual BOOL pack(LLDataPacker &dp) const = 0; - virtual BOOL unpack(LLDataPacker &dp) = 0; + virtual bool pack(LLDataPacker &dp) const = 0; + virtual bool unpack(LLDataPacker &dp) = 0; virtual bool operator==(const LLNetworkData& data) const = 0; virtual void copy(const LLNetworkData& data) = 0; - static BOOL isValid(U16 param_type, U32 size); + static bool isValid(U16 param_type, U32 size); }; extern const F32 LIGHT_MIN_RADIUS; @@ -141,8 +141,8 @@ private: public: LLLightParams(); - /*virtual*/ BOOL pack(LLDataPacker &dp) const; - /*virtual*/ BOOL unpack(LLDataPacker &dp); + /*virtual*/ bool pack(LLDataPacker &dp) const; + /*virtual*/ bool unpack(LLDataPacker &dp); /*virtual*/ bool operator==(const LLNetworkData& data) const; /*virtual*/ void copy(const LLNetworkData& data); // LLSD implementations here are provided by Eddy Stryker. @@ -196,8 +196,8 @@ protected: public: LLReflectionProbeParams(); - /*virtual*/ BOOL pack(LLDataPacker& dp) const; - /*virtual*/ BOOL unpack(LLDataPacker& dp); + /*virtual*/ bool pack(LLDataPacker& dp) const; + /*virtual*/ bool unpack(LLDataPacker& dp); /*virtual*/ bool operator==(const LLNetworkData& data) const; /*virtual*/ void copy(const LLNetworkData& data); // LLSD implementations here are provided by Eddy Stryker. @@ -258,8 +258,8 @@ extern const F32 FLEXIBLE_OBJECT_MAX_WIND_SENSITIVITY; extern const F32 FLEXIBLE_OBJECT_MAX_INTERNAL_TENSION_FORCE; extern const F32 FLEXIBLE_OBJECT_DEFAULT_LENGTH; -extern const BOOL FLEXIBLE_OBJECT_DEFAULT_USING_COLLISION_SPHERE; -extern const BOOL FLEXIBLE_OBJECT_DEFAULT_RENDERING_COLLISION_SPHERE; +extern const bool FLEXIBLE_OBJECT_DEFAULT_USING_COLLISION_SPHERE; +extern const bool FLEXIBLE_OBJECT_DEFAULT_RENDERING_COLLISION_SPHERE; class LLFlexibleObjectData : public LLNetworkData @@ -271,8 +271,8 @@ protected: F32 mWindSensitivity; // interacts with tension, air friction, and gravity F32 mTension; //interacts in complex ways with other parameters LLVector3 mUserForce; // custom user-defined force vector - //BOOL mUsingCollisionSphere; - //BOOL mRenderingCollisionSphere; + //bool mUsingCollisionSphere; + //bool mRenderingCollisionSphere; public: void setSimulateLOD(S32 lod) { mSimulateLOD = llclamp(lod, (S32)FLEXIBLE_OBJECT_MIN_SECTIONS, (S32)FLEXIBLE_OBJECT_MAX_SECTIONS); } @@ -291,8 +291,8 @@ public: //------ the constructor for the structure ------------ LLFlexibleObjectData(); - BOOL pack(LLDataPacker &dp) const; - BOOL unpack(LLDataPacker &dp); + bool pack(LLDataPacker &dp) const; + bool unpack(LLDataPacker &dp); bool operator==(const LLNetworkData& data) const; void copy(const LLNetworkData& data); LLSD asLLSD() const; @@ -310,8 +310,8 @@ protected: public: LLSculptParams(); - /*virtual*/ BOOL pack(LLDataPacker &dp) const; - /*virtual*/ BOOL unpack(LLDataPacker &dp); + /*virtual*/ bool pack(LLDataPacker &dp) const; + /*virtual*/ bool unpack(LLDataPacker &dp); /*virtual*/ bool operator==(const LLNetworkData& data) const; /*virtual*/ void copy(const LLNetworkData& data); LLSD asLLSD() const; @@ -331,8 +331,8 @@ protected: public: LLLightImageParams(); - /*virtual*/ BOOL pack(LLDataPacker &dp) const; - /*virtual*/ BOOL unpack(LLDataPacker &dp); + /*virtual*/ bool pack(LLDataPacker &dp) const; + /*virtual*/ bool unpack(LLDataPacker &dp); /*virtual*/ bool operator==(const LLNetworkData& data) const; /*virtual*/ void copy(const LLNetworkData& data); LLSD asLLSD() const; @@ -356,8 +356,8 @@ public: static const U32 ANIMATED_MESH_ENABLED_FLAG = 0x1 << 0; LLExtendedMeshParams(); - /*virtual*/ BOOL pack(LLDataPacker &dp) const; - /*virtual*/ BOOL unpack(LLDataPacker &dp); + /*virtual*/ bool pack(LLDataPacker &dp) const; + /*virtual*/ bool unpack(LLDataPacker &dp); /*virtual*/ bool operator==(const LLNetworkData& data) const; /*virtual*/ void copy(const LLNetworkData& data); LLSD asLLSD() const; @@ -381,8 +381,8 @@ private: public: LLRenderMaterialParams(); - BOOL pack(LLDataPacker& dp) const override; - BOOL unpack(LLDataPacker& dp) override; + bool pack(LLDataPacker& dp) const override; + bool unpack(LLDataPacker& dp) override; bool operator==(const LLNetworkData& data) const override; void copy(const LLNetworkData& data) override; @@ -395,7 +395,7 @@ public: // This code is not naming-standards compliant. Leaving it like this for // now to make the connection to code in -// BOOL packTEMessage(LLDataPacker &dp) const; +// bool packTEMessage(LLDataPacker &dp) const; // more obvious. This should be refactored to remove the duplication, at which // point we can fix the names as well. // - Vir @@ -457,10 +457,10 @@ public: void setPCode(const LLPCode pcode); const LLVolume *getVolumeConst() const { return mVolumep; } // HACK for Windoze confusion about ostream operator in LLVolume LLVolume *getVolume() const { return mVolumep; } - virtual BOOL setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume = false); + virtual bool setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume = false); // Modify texture entry properties - inline BOOL validTE(const U8 te_num) const; + inline bool validTE(const U8 te_num) const; LLTextureEntry* getTE(const U8 te_num) const; virtual void setNumTEs(const U8 num_tes); @@ -489,17 +489,17 @@ public: virtual S32 setTEGlow(const U8 te, const F32 glow); virtual S32 setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID); virtual S32 setTEMaterialParams(const U8 index, const LLMaterialPtr pMaterialParams); - virtual BOOL setMaterial(const U8 material); // returns TRUE if material changed + virtual bool setMaterial(const U8 material); // returns true if material changed virtual void setTESelected(const U8 te, bool sel); LLMaterialPtr getTEMaterialParams(const U8 index); void copyTEs(const LLPrimitive *primitive); S32 packTEField(U8 *cur_ptr, U8 *data_ptr, U8 data_size, U8 last_face_index, EMsgVariableType type) const; - BOOL packTEMessage(LLMessageSystem *mesgsys) const; - BOOL packTEMessage(LLDataPacker &dp) const; + bool packTEMessage(LLMessageSystem *mesgsys) const; + bool packTEMessage(LLDataPacker &dp) const; S32 unpackTEMessage(LLMessageSystem* mesgsys, char const* block_name, const S32 block_num); // Variable num of blocks - BOOL unpackTEMessage(LLDataPacker &dp); + S32 unpackTEMessage(LLDataPacker &dp); S32 parseTEMessage(LLMessageSystem* mesgsys, char const* block_name, const S32 block_num, LLTEContents& tec); S32 applyParsedTEMessage(LLTEContents& tec); @@ -557,25 +557,26 @@ public: // takes the contents of other_list and clears other_list void takeTextureList(LLPrimTextureList& other_list); - inline BOOL isAvatar() const; - inline BOOL isSittingAvatar() const; - inline BOOL isSittingAvatarOnGround() const; + inline bool isAvatar() const; + inline bool isSittingAvatar() const; + inline bool isSittingAvatarOnGround() const; inline bool hasBumpmap() const { return mNumBumpmapTEs > 0;} void setFlags(U32 flags) { mMiscFlags = flags; } void addFlags(U32 flags) { mMiscFlags |= flags; } void removeFlags(U32 flags) { mMiscFlags &= ~flags; } U32 getFlags() const { return mMiscFlags; } + bool checkFlags(U32 flags) const { return (mMiscFlags & flags) != 0; } static std::string pCodeToString(const LLPCode pcode); static LLPCode legacyToPCode(const U8 legacy); static U8 pCodeToLegacy(const LLPCode pcode); static bool getTESTAxes(const U8 face, U32* s_axis, U32* t_axis); - BOOL hasRenderMaterialParams() const; + bool hasRenderMaterialParams() const; - inline static BOOL isPrimitive(const LLPCode pcode); - inline static BOOL isApp(const LLPCode pcode); + inline static bool isPrimitive(const LLPCode pcode); + inline static bool isApp(const LLPCode pcode); private: void updateNumBumpmap(const U8 index, const U8 bump); @@ -601,39 +602,37 @@ public: }; }; -inline BOOL LLPrimitive::isAvatar() const +inline bool LLPrimitive::isAvatar() const { - return ( LL_PCODE_LEGACY_AVATAR == mPrimitiveCode ) ? TRUE : FALSE; + return LL_PCODE_LEGACY_AVATAR == mPrimitiveCode; } -inline BOOL LLPrimitive::isSittingAvatar() const +inline bool LLPrimitive::isSittingAvatar() const { // this is only used server-side - return ( LL_PCODE_LEGACY_AVATAR == mPrimitiveCode - && ((getFlags() & (PRIM_FLAG_SITTING | PRIM_FLAG_SITTING_ON_GROUND)) != 0) ) ? TRUE : FALSE; + return isAvatar() && checkFlags(PRIM_FLAG_SITTING | PRIM_FLAG_SITTING_ON_GROUND); } -inline BOOL LLPrimitive::isSittingAvatarOnGround() const +inline bool LLPrimitive::isSittingAvatarOnGround() const { // this is only used server-side - return ( LL_PCODE_LEGACY_AVATAR == mPrimitiveCode - && ((getFlags() & PRIM_FLAG_SITTING_ON_GROUND) != 0) ) ? TRUE : FALSE; + return isAvatar() && checkFlags(PRIM_FLAG_SITTING_ON_GROUND); } // static -inline BOOL LLPrimitive::isPrimitive(const LLPCode pcode) +inline bool LLPrimitive::isPrimitive(const LLPCode pcode) { LLPCode base_type = pcode & LL_PCODE_BASE_MASK; if (base_type && (base_type < LL_PCODE_APP)) { - return TRUE; + return true; } - return FALSE; + return false; } // static -inline BOOL LLPrimitive::isApp(const LLPCode pcode) +inline bool LLPrimitive::isApp(const LLPCode pcode) { LLPCode base_type = pcode & LL_PCODE_BASE_MASK; @@ -789,7 +788,7 @@ void LLPrimitive::setAcceleration(const F32 x, const F32 y, const F32 z) } #endif // CHECK_FOR_FINITE -inline BOOL LLPrimitive::validTE(const U8 te_num) const +inline bool LLPrimitive::validTE(const U8 te_num) const { return (mNumTEs && te_num < mNumTEs); } diff --git a/indra/llprimitive/llprimtexturelist.cpp b/indra/llprimitive/llprimtexturelist.cpp index 6b7e2ecf5b..7f60d8025a 100644 --- a/indra/llprimitive/llprimtexturelist.cpp +++ b/indra/llprimitive/llprimtexturelist.cpp @@ -83,13 +83,13 @@ void LLPrimTextureList::clear() void LLPrimTextureList::copy(const LLPrimTextureList& other_list) { // compare the sizes - S32 this_size = mEntryList.size(); - S32 other_size = other_list.mEntryList.size(); + auto this_size = mEntryList.size(); + auto other_size = other_list.mEntryList.size(); if (this_size > other_size) { // remove the extra entries - for (S32 index = this_size; index > other_size; --index) + for (size_t index = this_size; index > other_size; --index) { delete mEntryList[index-1]; } @@ -97,18 +97,18 @@ void LLPrimTextureList::copy(const LLPrimTextureList& other_list) this_size = other_size; } - S32 index = 0; + size_t index = 0; // copy for the entries that already exist for ( ; index < this_size; ++index) { delete mEntryList[index]; - mEntryList[index] = other_list.getTexture(index)->newCopy(); + mEntryList[index] = other_list.getTexture(static_cast<U8>(index))->newCopy(); } // add new entires if needed for ( ; index < other_size; ++index) { - mEntryList.push_back( other_list.getTexture(index)->newCopy() ); + mEntryList.push_back( other_list.getTexture(static_cast<U8>(index))->newCopy()); } } @@ -127,9 +127,9 @@ void LLPrimTextureList::take(LLPrimTextureList& other_list) // returns TEM_CHANGE_TEXTURE if successful, otherwise TEM_CHANGE_NONE S32 LLPrimTextureList::copyTexture(const U8 index, const LLTextureEntry* te) { - if (S32(index) >= mEntryList.size()) + if (size_t(index) >= mEntryList.size()) { - S32 current_size = mEntryList.size(); + auto current_size = mEntryList.size(); LL_WARNS() << "ignore copy of index = " << S32(index) << " into texture entry list of size = " << current_size << LL_ENDL; return TEM_CHANGE_NONE; } @@ -382,7 +382,7 @@ LLMaterialPtr LLPrimTextureList::getMaterialParams(const U8 index) S32 LLPrimTextureList::size() const { - return mEntryList.size(); + return static_cast<S32>(mEntryList.size()); } // sets the size of the mEntryList container @@ -393,12 +393,12 @@ void LLPrimTextureList::setSize(S32 new_size) new_size = 0; } - S32 current_size = mEntryList.size(); + auto current_size = mEntryList.size(); if (new_size > current_size) { mEntryList.resize(new_size); - for (S32 index = current_size; index < new_size; ++index) + for (size_t index = current_size; index < new_size; ++index) { if (current_size > 0 && mEntryList[current_size - 1]) @@ -416,7 +416,7 @@ void LLPrimTextureList::setSize(S32 new_size) } else if (new_size < current_size) { - for (S32 index = current_size-1; index >= new_size; --index) + for (size_t index = current_size-1; index >= new_size; --index) { delete mEntryList[index]; } diff --git a/indra/llprimitive/lltextureanim.cpp b/indra/llprimitive/lltextureanim.cpp index cc156722f4..579538075a 100644 --- a/indra/llprimitive/lltextureanim.cpp +++ b/indra/llprimitive/lltextureanim.cpp @@ -54,38 +54,38 @@ void LLTextureAnim::reset() mRate = 1.f; } -BOOL LLTextureAnim::equals(const LLTextureAnim &other) const +bool LLTextureAnim::equals(const LLTextureAnim &other) const { if (mMode != other.mMode) { - return FALSE; + return false; } if (mFace != other.mFace) { - return FALSE; + return false; } if (mSizeX != other.mSizeX) { - return FALSE; + return false; } if (mSizeY != other.mSizeY) { - return FALSE; + return false; } if (mStart != other.mStart) { - return FALSE; + return false; } if (mLength != other.mLength) { - return FALSE; + return false; } if (mRate != other.mRate) { - return FALSE; + return false; } - return TRUE; + return true; } void LLTextureAnim::packTAMessage(LLMessageSystem *mesgsys) const { diff --git a/indra/llprimitive/lltextureanim.h b/indra/llprimitive/lltextureanim.h index ef76549903..2d10153043 100644 --- a/indra/llprimitive/lltextureanim.h +++ b/indra/llprimitive/lltextureanim.h @@ -44,7 +44,7 @@ public: void packTAMessage(LLDataPacker &dp) const; void unpackTAMessage(LLMessageSystem *mesgsys, const S32 block_num); void unpackTAMessage(LLDataPacker &dp); - BOOL equals(const LLTextureAnim &other) const; + bool equals(const LLTextureAnim &other) const; LLSD asLLSD() const; operator LLSD() const { return asLLSD(); } bool fromLLSD(LLSD& sd); diff --git a/indra/llprimitive/lltextureentry.cpp b/indra/llprimitive/lltextureentry.cpp index 2ed8f8c044..ac482ffbf9 100644 --- a/indra/llprimitive/lltextureentry.cpp +++ b/indra/llprimitive/lltextureentry.cpp @@ -407,9 +407,9 @@ S32 LLTextureEntry::setColor(const LLColor3 &color) S32 LLTextureEntry::setAlpha(const F32 alpha) { - if (mColor.mV[VW] != alpha) + if (mColor.mV[VALPHA] != alpha) { - mColor.mV[VW] = alpha; + mColor.mV[VALPHA] = alpha; return TEM_CHANGE_COLOR; } return TEM_CHANGE_NONE; diff --git a/indra/llprimitive/llvolumemessage.cpp b/indra/llprimitive/llvolumemessage.cpp index 804b208e3a..aa4bd711ab 100644 --- a/indra/llprimitive/llvolumemessage.cpp +++ b/indra/llprimitive/llvolumemessage.cpp @@ -478,13 +478,15 @@ bool LLVolumeMessage::constrainVolumeParams(LLVolumeParams& params) bad |= params.setRevolutions(params.getPathParams().getRevolutions()) ? 0 : 0x200; bad |= params.setRadiusOffset(params.getPathParams().getRadiusOffset()) ? 0 : 0x400; bad |= params.setSkew(params.getPathParams().getSkew()) ? 0 : 0x800; - if(bad) + + if (bad) { LL_WARNS() << "LLVolumeMessage::constrainVolumeParams() - " << "forced to constrain incoming volume params: " - << llformat("0x%04x",bad) << LL_ENDL; + << llformat("0x%04x", bad) << LL_ENDL; } - return bad ? false : true; + + return bad == 0; } bool LLVolumeMessage::packVolumeParams(const LLVolumeParams* params, LLMessageSystem *mesgsys) diff --git a/indra/llprimitive/tests/llgltfmaterial_test.cpp b/indra/llprimitive/tests/llgltfmaterial_test.cpp index b56c9ab4f5..4f2de82386 100644 --- a/indra/llprimitive/tests/llgltfmaterial_test.cpp +++ b/indra/llprimitive/tests/llgltfmaterial_test.cpp @@ -1,31 +1,33 @@ -/** +/** * @file llgltfmaterial_test.cpp * - * $LicenseInfo:firstyear=2023&license=viewerlgpl$ + * $LicenseInfo:firstyear=2023&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2023, 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$ + * $/LicenseInfo$ */ #include "linden_common.h" #include "lltut.h" +#include <set> + #include "../llgltfmaterial.h" #include "lluuid.cpp" @@ -108,9 +110,9 @@ namespace tut material.setAlphaCutoff(test_fraction); // Because this is the default value, it should append to the extras field to mark it as an override - material.setAlphaMode(LLGLTFMaterial::ALPHA_MODE_OPAQUE); + material.setAlphaMode(LLGLTFMaterial::ALPHA_MODE_OPAQUE, true); // Because this is the default value, it should append to the extras field to mark it as an override - material.setDoubleSided(false); + material.setDoubleSided(false, true); return material; } @@ -143,7 +145,7 @@ namespace tut #if LL_WINDOWS // If any fields are added/changed, these tests should be updated (consider also updating ASSET_VERSION in LLGLTFMaterial) // This test result will vary between compilers, so only test a single platform - ensure_equals("fields supported for GLTF (sizeof check)", sizeof(LLGLTFMaterial), 224); + ensure_equals("fields supported for GLTF (sizeof check)", sizeof(LLGLTFMaterial), 232); #endif #endif ensure_equals("LLGLTFMaterial texture info count", (U32)LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT, 4); @@ -366,4 +368,74 @@ namespace tut ensure_equals("LLGLTFMaterial: double sided override flag unset", material.mOverrideDoubleSided, false); } } + + template<typename T> + void ensure_material_hash_pre(LLGLTFMaterial& material, T& material_field, const T new_value, const std::string& field_name) + { + ensure("LLGLTFMaterial: Hash: Test field " + field_name + " is part of the test material object", ( + size_t(&material_field) >= size_t(&material) && + (size_t(&material_field) + sizeof(material_field)) <= (size_t(&material) + sizeof(material)) + )); + ensure("LLGLTFMaterial: Hash: " + field_name + " differs and will cause a perturbation worth hashing", material_field != new_value); + } + + template<typename T> + void ensure_material_hash_not_changed(LLGLTFMaterial& material, T& material_field, const T new_value, const std::string& field_name) + { + ensure_material_hash_pre(material, material_field, new_value, field_name); + + const LLGLTFMaterial old_material = material; + material_field = new_value; + // If this test fails, consult LLGLTFMaterial::getHash, and optionally consult http://www.catb.org/esr/structure-packing/ for guidance on optimal memory packing (effectiveness is platform-dependent) + ensure_equals(("LLGLTFMaterial: Hash: Perturbing " + field_name + " to new value does NOT change the hash").c_str(), material.getHash(), old_material.getHash()); + } + + template<typename T> + void ensure_material_hash_changed(LLGLTFMaterial& material, T& material_field, const T new_value, const std::string& field_name) + { + ensure_material_hash_pre(material, material_field, new_value, field_name); + + const LLGLTFMaterial old_material = material; + material_field = new_value; + // If this test fails, consult LLGLTFMaterial::getHash, and optionally consult http://www.catb.org/esr/structure-packing/ for guidance on optimal memory packing (effectiveness is platform-dependent) + ensure_not_equals(("LLGLTFMaterial: Hash: Perturbing " + field_name + " to new value changes the hash").c_str(), material.getHash(), old_material.getHash()); + } + +#define ENSURE_HASH_NOT_CHANGED(HASH_MAT, SOURCE_MAT, FIELD) ensure_material_hash_not_changed(HASH_MAT, HASH_MAT.FIELD, SOURCE_MAT.FIELD, #FIELD) +#define ENSURE_HASH_CHANGED(HASH_MAT, SOURCE_MAT, FIELD) ensure_material_hash_changed(HASH_MAT, HASH_MAT.FIELD, SOURCE_MAT.FIELD, #FIELD) + + // Test LLGLTFMaterial::getHash, which is very sensitive to the ordering of fields + template<> template<> + void llgltfmaterial_object_t::test<12>() + { + // *NOTE: Due to direct manipulation of the fields of materials + // throughout this test, the resulting modified materials may not be + // compliant or properly serializable. + + // Ensure all fields of source_mat are set to values that differ from + // LLGLTFMaterial::sDefault, even if that would result in an invalid + // material object. + LLGLTFMaterial source_mat = create_test_material(); + source_mat.mTrackingIdToLocalTexture[LLUUID::generateNewID()] = LLUUID::generateNewID(); + source_mat.mLocalTexDataDigest = 1; + source_mat.mAlphaMode = LLGLTFMaterial::ALPHA_MODE_MASK; + source_mat.mDoubleSided = true; + + LLGLTFMaterial hash_mat; + + ENSURE_HASH_NOT_CHANGED(hash_mat, source_mat, mTrackingIdToLocalTexture); + ENSURE_HASH_CHANGED(hash_mat, source_mat, mLocalTexDataDigest); + + ENSURE_HASH_CHANGED(hash_mat, source_mat, mTextureId); + ENSURE_HASH_CHANGED(hash_mat, source_mat, mTextureTransform); + ENSURE_HASH_CHANGED(hash_mat, source_mat, mBaseColor); + ENSURE_HASH_CHANGED(hash_mat, source_mat, mEmissiveColor); + ENSURE_HASH_CHANGED(hash_mat, source_mat, mMetallicFactor); + ENSURE_HASH_CHANGED(hash_mat, source_mat, mRoughnessFactor); + ENSURE_HASH_CHANGED(hash_mat, source_mat, mAlphaCutoff); + ENSURE_HASH_CHANGED(hash_mat, source_mat, mAlphaMode); + ENSURE_HASH_CHANGED(hash_mat, source_mat, mDoubleSided); + ENSURE_HASH_CHANGED(hash_mat, source_mat, mOverrideDoubleSided); + ENSURE_HASH_CHANGED(hash_mat, source_mat, mOverrideAlphaMode); + } } diff --git a/indra/llprimitive/tests/llprimitive_test.cpp b/indra/llprimitive/tests/llprimitive_test.cpp index 1b47182c28..0213a3e8b6 100644 --- a/indra/llprimitive/tests/llprimitive_test.cpp +++ b/indra/llprimitive/tests/llprimitive_test.cpp @@ -46,7 +46,7 @@ public: if (mVolumeTest.isNull() || volume_params != mCurrParamsTest || detail != mCurrDetailTest) { F32 volume_detail = LLVolumeLODGroup::getVolumeScaleFromDetail(detail); - mVolumeTest = new LLVolume(volume_params, volume_detail, FALSE, FALSE); + mVolumeTest = new LLVolume(volume_params, volume_detail, false, false); mCurrParamsTest = volume_params; mCurrDetailTest = detail; return mVolumeTest; @@ -109,7 +109,7 @@ void LLPrimTextureList::take(LLPrimTextureList &other_list) { } void LLPrimTextureList::setSize(S32 new_size) { mEntryList.resize(new_size); } void LLPrimTextureList::setAllIDs(const LLUUID &id) { } LLTextureEntry * LLPrimTextureList::getTexture(const U8 index) const { return nullptr; } -S32 LLPrimTextureList::size() const { return mEntryList.size(); } +S32 LLPrimTextureList::size() const { return static_cast<S32>(mEntryList.size()); } class PRIMITIVE_TEST_SETUP { @@ -193,7 +193,7 @@ namespace tut ensure(!primitive.isChanged(LLXform::GEOMETRY)); // Make sure setVolume returns true - ensure(primitive.setVolume(params, 0, true) == TRUE); + ensure(primitive.setVolume(params, 0, true) == true); LLVolume* new_volume = primitive.getVolume(); // make sure new volume was actually created @@ -210,12 +210,12 @@ namespace tut ensure(primitive.isChanged(LLXform::GEOMETRY)); // Run it twice to make sure it doesn't create a different one if params are the same - ensure(primitive.setVolume(params, 0, true) == FALSE); + ensure(primitive.setVolume(params, 0, true) == false); ensure(new_volume == primitive.getVolume()); // Change the param definition and try setting it again. params.setRevolutions(4); - ensure(primitive.setVolume(params, 0, true) == TRUE); + ensure(primitive.setVolume(params, 0, true) == true); // Ensure that we now have a different volume ensure(new_volume != primitive.getVolume()); @@ -238,7 +238,7 @@ namespace tut ensure(!primitive.isChanged(LLXform::GEOMETRY)); // Make sure setVolume returns true - ensure(primitive.setVolume(params, 0, false) == TRUE); + ensure(primitive.setVolume(params, 0, false) == true); LLVolume* new_volume = primitive.getVolume(); @@ -256,12 +256,12 @@ namespace tut ensure(primitive.isChanged(LLXform::GEOMETRY)); // Run it twice to make sure it doesn't create a different one if params are the same - ensure(primitive.setVolume(params, 0, false) == FALSE); + ensure(primitive.setVolume(params, 0, false) == false); ensure(new_volume == primitive.getVolume()); // Change the param definition and try setting it again. params.setRevolutions(4); - ensure(primitive.setVolume(params, 0, false) == TRUE); + ensure(primitive.setVolume(params, 0, false) == true); // Ensure that we now have a different volume ensure(new_volume != primitive.getVolume()); diff --git a/indra/llrender/llcubemap.cpp b/indra/llrender/llcubemap.cpp index f0158ec54f..53691bafe2 100644 --- a/indra/llrender/llcubemap.cpp +++ b/indra/llrender/llcubemap.cpp @@ -78,7 +78,7 @@ void LLCubeMap::initGL() for (int i = 0; i < 6; i++) { - mImages[i] = new LLImageGL(RESOLUTION, RESOLUTION, 4, FALSE); + mImages[i] = new LLImageGL(RESOLUTION, RESOLUTION, 4, false); #if USE_SRGB_DECODE if (mIssRGB) { mImages[i]->setExplicitFormat(GL_SRGB8_ALPHA8, GL_RGBA); @@ -111,6 +111,9 @@ void LLCubeMap::initRawData(const std::vector<LLPointer<LLImageRaw> >& rawimages // Yes, I know that this is inefficient! - djs 08/08/02 for (int i = 0; i < 6; i++) { + LLImageDataSharedLock lockIn(rawimages[i]); + LLImageDataLock lockOut(mRawImages[i]); + const U8 *sd = rawimages[i]->getData(); U8 *td = mRawImages[i]->getData(); @@ -173,7 +176,7 @@ void LLCubeMap::initReflectionMap(U32 resolution, U32 components) LLImageGL::generateTextures(1, &texname); - mImages[0] = new LLImageGL(resolution, resolution, components, TRUE); + mImages[0] = new LLImageGL(resolution, resolution, components, true); mImages[0]->setTexName(texname); mImages[0]->setTarget(mTargets[0], LLTexUnit::TT_CUBE_MAP); gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_CUBE_MAP, texname); @@ -197,7 +200,7 @@ void LLCubeMap::initEnvironmentMap(const std::vector<LLPointer<LLImageRaw> >& ra llassert(rawimages[i]->getHeight() == resolution); llassert(rawimages[i]->getComponents() == components); - mImages[i] = new LLImageGL(resolution, resolution, components, TRUE); + mImages[i] = new LLImageGL(resolution, resolution, components, true); mImages[i]->setTarget(mTargets[i], LLTexUnit::TT_CUBE_MAP); mRawImages[i] = rawimages[i]; mImages[i]->createGLTexture(0, mRawImages[i], texname); @@ -223,8 +226,8 @@ void LLCubeMap::generateMipMaps() { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; - mImages[0]->setUseMipMaps(TRUE); - mImages[0]->setHasMipMaps(TRUE); + mImages[0]->setUseMipMaps(true); + mImages[0]->setHasMipMaps(true); enableTexture(0); bind(); mImages[0]->setFilteringOption(LLTexUnit::TFO_BILINEAR); diff --git a/indra/llrender/llcubemaparray.cpp b/indra/llrender/llcubemaparray.cpp index a758d7e22b..0242fe60ce 100644 --- a/indra/llrender/llcubemaparray.cpp +++ b/indra/llrender/llcubemaparray.cpp @@ -42,6 +42,8 @@ //#pragma optimize("", off) +using namespace LLImageGLMemory; + // MUST match order of OpenGL face-layers GLenum LLCubeMapArray::sTargets[6] = { @@ -107,7 +109,7 @@ LLCubeMapArray::~LLCubeMapArray() { } -void LLCubeMapArray::allocate(U32 resolution, U32 components, U32 count, BOOL use_mips) +void LLCubeMapArray::allocate(U32 resolution, U32 components, U32 count, bool use_mips) { U32 texname = 0; mWidth = resolution; @@ -128,6 +130,8 @@ void LLCubeMapArray::allocate(U32 resolution, U32 components, U32 count, BOOL us U32 mip = 0; + free_cur_tex_image(); + while (resolution >= 1) { #if GL_VERSION_4_0 @@ -143,6 +147,8 @@ void LLCubeMapArray::allocate(U32 resolution, U32 components, U32 count, BOOL us ++mip; } + alloc_tex_image(resolution * 6, resolution, format); + mImage->setAddressMode(LLTexUnit::TAM_CLAMP); if (use_mips) diff --git a/indra/llrender/llcubemaparray.h b/indra/llrender/llcubemaparray.h index 9d78c5b0d4..675aaaf07c 100644 --- a/indra/llrender/llcubemaparray.h +++ b/indra/llrender/llcubemaparray.h @@ -51,8 +51,8 @@ public: // res - resolution of each cube face // components - number of components per pixel // count - number of cube maps in the array - // use_mips - if TRUE, mipmaps will be allocated for this cube map array and anisotropic filtering will be used - void allocate(U32 res, U32 components, U32 count, BOOL use_mips = TRUE); + // use_mips - if true, mipmaps will be allocated for this cube map array and anisotropic filtering will be used + void allocate(U32 res, U32 components, U32 count, bool use_mips = true); void bind(S32 stage); void unbind(); diff --git a/indra/llrender/llfontbitmapcache.cpp b/indra/llrender/llfontbitmapcache.cpp index 243041945a..46c2e89797 100644 --- a/indra/llrender/llfontbitmapcache.cpp +++ b/indra/llrender/llfontbitmapcache.cpp @@ -78,11 +78,11 @@ LLImageGL *LLFontBitmapCache::getImageGL(EFontGlyphType bitmap_type, U32 bitmap_ } -BOOL LLFontBitmapCache::nextOpenPos(S32 width, S32& pos_x, S32& pos_y, EFontGlyphType bitmap_type, U32& bitmap_num) +bool LLFontBitmapCache::nextOpenPos(S32 width, S32& pos_x, S32& pos_y, EFontGlyphType bitmap_type, U32& bitmap_num) { if (bitmap_type >= EFontGlyphType::Count) { - return FALSE; + return false; } const U32 bitmap_idx = static_cast<U32>(bitmap_type); @@ -108,7 +108,7 @@ BOOL LLFontBitmapCache::nextOpenPos(S32 width, S32& pos_x, S32& pos_y, EFontGlyp S32 num_components = getNumComponents(bitmap_type); mImageRawVec[bitmap_idx].push_back(new LLImageRaw(mBitmapWidth, mBitmapHeight, num_components)); - bitmap_num = mImageRawVec[bitmap_idx].size() - 1; + bitmap_num = static_cast<U32>(mImageRawVec[bitmap_idx].size()) - 1; LLImageRaw* image_raw = getImageRaw(bitmap_type, bitmap_num); if (EFontGlyphType::Grayscale == bitmap_type) @@ -126,7 +126,7 @@ BOOL LLFontBitmapCache::nextOpenPos(S32 width, S32& pos_x, S32& pos_y, EFontGlyp // Attach corresponding GL texture. (*TODO: is this needed?) gGL.getTexUnit(0)->bind(image_gl); - image_gl->setFilteringOption(LLTexUnit::TFO_POINT); // was setMipFilterNearest(TRUE, TRUE); + image_gl->setFilteringOption(LLTexUnit::TFO_POINT); // was setMipFilterNearest(true, true); } else { @@ -142,7 +142,7 @@ BOOL LLFontBitmapCache::nextOpenPos(S32 width, S32& pos_x, S32& pos_y, EFontGlyp mCurrentOffsetX[bitmap_idx] += width + 1; - return TRUE; + return true; } void LLFontBitmapCache::destroyGL() diff --git a/indra/llrender/llfontbitmapcache.h b/indra/llrender/llfontbitmapcache.h index 8f704df44f..f2dfd87877 100644 --- a/indra/llrender/llfontbitmapcache.h +++ b/indra/llrender/llfontbitmapcache.h @@ -52,7 +52,7 @@ public: void reset(); - BOOL nextOpenPos(S32 width, S32& posX, S32& posY, EFontGlyphType bitmapType, U32& bitmapNum); + bool nextOpenPos(S32 width, S32& posX, S32& posY, EFontGlyphType bitmapType, U32& bitmapNum); void destroyGL(); @@ -60,7 +60,7 @@ public: LLImageGL* getImageGL(EFontGlyphType bitmapType, U32 bitmapNum) const; S32 getMaxCharWidth() const { return mMaxCharWidth; } - U32 getNumBitmaps(EFontGlyphType bitmapType) const { return (bitmapType < EFontGlyphType::Count) ? mImageRawVec[static_cast<U32>(bitmapType)].size() : 0; } + U32 getNumBitmaps(EFontGlyphType bitmapType) const { return (bitmapType < EFontGlyphType::Count) ? static_cast<U32>(mImageRawVec[static_cast<U32>(bitmapType)].size()) : 0U; } S32 getBitmapWidth() const { return mBitmapWidth; } S32 getBitmapHeight() const { return mBitmapHeight; } diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp index 554e70d6a7..9766de1dfa 100644 --- a/indra/llrender/llfontfreetype.cpp +++ b/indra/llrender/llfontfreetype.cpp @@ -145,7 +145,7 @@ LLFontFreetype::LLFontFreetype() pFileStream(NULL), pFtStream(NULL), #endif - mIsFallback(FALSE), + mIsFallback(false), mFTFace(NULL), mRenderGlyphCount(0), mAddGlyphCount(0), @@ -189,7 +189,7 @@ void ft_close_cb(FT_Stream stream) { } #endif -BOOL LLFontFreetype::loadFace(const std::string& filename, F32 point_size, F32 vert_dpi, F32 horz_dpi, bool is_fallback, S32 face_n) +bool LLFontFreetype::loadFace(const std::string& filename, F32 point_size, F32 vert_dpi, F32 horz_dpi, bool is_fallback, S32 face_n) { // Don't leak face objects. This is also needed to deal with // changed font file names. @@ -214,7 +214,7 @@ BOOL LLFontFreetype::loadFace(const std::string& filename, F32 point_size, F32 v #ifdef LL_WINDOWS clearFontStreams(); #endif - return FALSE; + return false; } mIsFallback = is_fallback; @@ -234,7 +234,7 @@ BOOL LLFontFreetype::loadFace(const std::string& filename, F32 point_size, F32 v clearFontStreams(); #endif mFTFace = NULL; - return FALSE; + return false; } F32 y_max, y_min, x_max, x_min; @@ -281,7 +281,7 @@ BOOL LLFontFreetype::loadFace(const std::string& filename, F32 point_size, F32 v mStyle |= LLFontGL::ITALIC; } - return TRUE; + return true; } S32 LLFontFreetype::getNumFaces(const std::string& filename) @@ -330,7 +330,7 @@ S32 LLFontFreetype::ftOpenFace(const std::string& filename, S32 face_n) pFtStream = new LLFT_Stream(); pFtStream->base = 0; pFtStream->pos = 0; - pFtStream->size = file_size; + pFtStream->size = static_cast<unsigned long>(file_size); pFtStream->descriptor.pointer = pFileStream; pFtStream->read = ft_read_cb; pFtStream->close = ft_close_cb; @@ -443,7 +443,7 @@ F32 LLFontFreetype::getXKerning(const LLFontGlyphInfo* left_glyph_info, const LL return delta.x*(1.f/64.f); } -BOOL LLFontFreetype::hasGlyph(llwchar wch) const +bool LLFontFreetype::hasGlyph(llwchar wch) const { llassert(!mIsFallback); return(mCharGlyphInfoMap.find(wch) != mCharGlyphInfoMap.end()); @@ -853,6 +853,7 @@ bool LLFontFreetype::setSubImageBGRA(U32 x, U32 y, U32 bitmap_num, U16 width, U1 void LLFontFreetype::setSubImageLuminanceAlpha(U32 x, U32 y, U32 bitmap_num, U32 width, U32 height, U8 *data, S32 stride) const { LLImageRaw *image_raw = mFontBitmapCachep->getImageRaw(EFontGlyphType::Grayscale, bitmap_num); + LLImageDataLock lock(image_raw); llassert(!mIsFallback); llassert(image_raw && (image_raw->getComponents() == 2)); diff --git a/indra/llrender/llfontfreetype.h b/indra/llrender/llfontfreetype.h index 19112830a4..eba89f5def 100644 --- a/indra/llrender/llfontfreetype.h +++ b/indra/llrender/llfontfreetype.h @@ -86,7 +86,7 @@ public: // is_fallback should be true for fallback fonts that aren't used // to render directly (Unicode backup, primarily) - BOOL loadFace(const std::string& filename, F32 point_size, F32 vert_dpi, F32 horz_dpi, bool is_fallback, S32 face_n); + bool loadFace(const std::string& filename, F32 point_size, F32 vert_dpi, F32 horz_dpi, bool is_fallback, S32 face_n); S32 getNumFaces(const std::string& filename); @@ -153,7 +153,7 @@ private: void resetBitmapCache(); void setSubImageLuminanceAlpha(U32 x, U32 y, U32 bitmap_num, U32 width, U32 height, U8 *data, S32 stride = 0) const; bool setSubImageBGRA(U32 x, U32 y, U32 bitmap_num, U16 width, U16 height, const U8* data, U32 stride) const; - BOOL hasGlyph(llwchar wch) const; // Has a glyph for this character + bool hasGlyph(llwchar wch) const; // Has a glyph for this character LLFontGlyphInfo* addGlyph(llwchar wch, EFontGlyphType glyph_type) const; // Add a new character to the font if necessary LLFontGlyphInfo* addGlyphFromFont(const LLFontFreetype *fontp, llwchar wch, U32 glyph_index, EFontGlyphType bitmap_type) const; // Add a glyph from this font to the other (returns the glyph_index, 0 if not found) void renderGlyph(EFontGlyphType bitmap_type, U32 glyph_index) const; @@ -175,7 +175,7 @@ private: LLFT_Stream *pFtStream; #endif - BOOL mIsFallback; + bool mIsFallback; typedef std::pair<LLPointer<LLFontFreetype>, char_functor_t> fallback_font_t; typedef std::vector<fallback_font_t> fallback_font_vector_t; fallback_font_vector_t mFallbackFonts; // A list of fallback fonts to look for glyphs in (for Unicode chars) diff --git a/indra/llrender/llfontfreetypesvg.h b/indra/llrender/llfontfreetypesvg.h index 62aefd10b5..94b83d5fff 100644 --- a/indra/llrender/llfontfreetypesvg.h +++ b/indra/llrender/llfontfreetypesvg.h @@ -50,7 +50,7 @@ public: // - right before the svg module calls the render callback hook. (with cache == true) static FT_Error OnPresetGlypthSlot(FT_GlyphSlot glyph_slot, FT_Bool cache, FT_Pointer* state); - // Called to render an OT-SVG glyph (right after the preset hook OnPresetGlypthSlot was called with cache set to TRUE) + // Called to render an OT-SVG glyph (right after the preset hook OnPresetGlypthSlot was called with cache set to true) static FT_Error OnRender(FT_GlyphSlot glyph_slot, FT_Pointer* state); // Called to deallocate our per glyph slot data diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp index 2ac2615c0a..9482987970 100644 --- a/indra/llrender/llfontgl.cpp +++ b/indra/llrender/llfontgl.cpp @@ -58,7 +58,7 @@ F32 LLFontGL::sVertDPI = 96.f; F32 LLFontGL::sHorizDPI = 96.f; F32 LLFontGL::sScaleX = 1.f; F32 LLFontGL::sScaleY = 1.f; -BOOL LLFontGL::sDisplayFont = TRUE ; +bool LLFontGL::sDisplayFont = true ; std::string LLFontGL::sAppDir; LLColor4 LLFontGL::sShadowColor(0.f, 0.f, 0.f, 1.f); @@ -89,7 +89,7 @@ void LLFontGL::destroyGL() mFontFreetype->destroyGL(); } -BOOL LLFontGL::loadFace(const std::string& filename, F32 point_size, const F32 vert_dpi, const F32 horz_dpi, bool is_fallback, S32 face_n) +bool LLFontGL::loadFace(const std::string& filename, F32 point_size, const F32 vert_dpi, const F32 horz_dpi, bool is_fallback, S32 face_n) { if(mFontFreetype == reinterpret_cast<LLFontFreetype*>(NULL)) { @@ -110,14 +110,14 @@ S32 LLFontGL::getNumFaces(const std::string& filename) } S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, const LLRect& rect, const LLColor4 &color, HAlign halign, VAlign valign, U8 style, - ShadowType shadow, S32 max_chars, F32* right_x, BOOL use_ellipses, BOOL use_color) const + ShadowType shadow, S32 max_chars, F32* right_x, bool use_ellipses, bool use_color) const { LLRectf rect_float(rect.mLeft, rect.mTop, rect.mRight, rect.mBottom); return render(wstr, begin_offset, rect_float, color, halign, valign, style, shadow, max_chars, right_x, use_ellipses, use_color); } S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, const LLRectf& rect, const LLColor4 &color, HAlign halign, VAlign valign, U8 style, - ShadowType shadow, S32 max_chars, F32* right_x, BOOL use_ellipses, BOOL use_color) const + ShadowType shadow, S32 max_chars, F32* right_x, bool use_ellipses, bool use_color) const { F32 x = rect.mLeft; F32 y = 0.f; @@ -143,13 +143,13 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, const LLRectf& rec S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, const LLColor4 &color, HAlign halign, VAlign valign, U8 style, - ShadowType shadow, S32 max_chars, S32 max_pixels, F32* right_x, BOOL use_ellipses, BOOL use_color) const + ShadowType shadow, S32 max_chars, S32 max_pixels, F32* right_x, bool use_ellipses, bool use_color) const { LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; if(!sDisplayFont) //do not display texts { - return wstr.length() ; + return static_cast<S32>(wstr.length()); } if (wstr.empty()) @@ -254,7 +254,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons const S32 LAST_CHARACTER = LLFontFreetype::LAST_CHAR_FULL; - BOOL draw_ellipses = FALSE; + bool draw_ellipses = false; if (use_ellipses) { // check for too long of a string @@ -264,7 +264,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons // 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 - ll_round(getWidthF32(dots.c_str()))); - draw_ellipses = TRUE; + draw_ellipses = true; } } @@ -278,7 +278,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons LLColor4U text_color(color); // Preserve the transparency to render fading emojis in fading text (e.g. // for the chat console)... HB - LLColor4U emoji_color(255, 255, 255, text_color.mV[VW]); + LLColor4U emoji_color(255, 255, 255, text_color.mV[VALPHA]); std::pair<EFontGlyphType, S32> bitmap_entry = std::make_pair(EFontGlyphType::Grayscale, -1); S32 glyph_count = 0; @@ -414,7 +414,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons shadow, S32_MAX, max_pixels, right_x, - FALSE, + false, use_color); gGL.popUIMatrix(); } @@ -429,7 +429,7 @@ S32 LLFontGL::render(const LLWString &text, S32 begin_offset, F32 x, F32 y, cons return render(text, begin_offset, x, y, color, LEFT, BASELINE, NORMAL, NO_SHADOW); } -S32 LLFontGL::renderUTF8(const std::string &text, S32 begin_offset, F32 x, F32 y, const LLColor4 &color, HAlign halign, VAlign valign, U8 style, ShadowType shadow, S32 max_chars, S32 max_pixels, F32* right_x, BOOL use_ellipses, BOOL use_color) const +S32 LLFontGL::renderUTF8(const std::string &text, S32 begin_offset, F32 x, F32 y, const LLColor4 &color, HAlign halign, VAlign valign, U8 style, ShadowType shadow, S32 max_chars, S32 max_pixels, F32* right_x, bool use_ellipses, bool use_color) const { return render(utf8str_to_wstring(text), begin_offset, x, y, color, halign, valign, style, shadow, max_chars, max_pixels, right_x, use_ellipses, use_color); } @@ -578,11 +578,11 @@ S32 LLFontGL::maxDrawableChars(const llwchar* wchars, F32 max_pixels, S32 max_ch llassert(max_pixels >= 0.f); llassert(max_chars >= 0); - BOOL clip = FALSE; + bool clip = false; F32 cur_x = 0; S32 start_of_last_word = 0; - BOOL in_word = FALSE; + bool in_word = false; // avoid S32 overflow when max_pixels == S32_MAX by staying in floating point F32 scaled_max_pixels = max_pixels * sScaleX; @@ -607,18 +607,18 @@ S32 LLFontGL::maxDrawableChars(const llwchar* wchars, F32 max_pixels, S32 max_ch { if(wch !=(0x00A0)) { - in_word = FALSE; + in_word = false; } } if (iswindividual(wch)) { if (iswpunct(wchars[i+1])) { - in_word=TRUE; + in_word=true; } else { - in_word=FALSE; + in_word=false; start_of_last_word = i; } } @@ -628,7 +628,7 @@ S32 LLFontGL::maxDrawableChars(const llwchar* wchars, F32 max_pixels, S32 max_ch start_of_last_word = i; if (!iswspace(wch)||!iswindividual(wch)) { - in_word = TRUE; + in_word = true; } } @@ -654,7 +654,7 @@ S32 LLFontGL::maxDrawableChars(const llwchar* wchars, F32 max_pixels, S32 max_ch // clip if current character runs past scaled_max_pixels (using width_padding) if (scaled_max_pixels < cur_x + width_padding) { - clip = TRUE; + clip = true; break; } @@ -752,7 +752,7 @@ S32 LLFontGL::firstDrawableChar(const llwchar* wchars, F32 max_pixels, S32 text_ } -S32 LLFontGL::charFromPixelOffset(const llwchar* wchars, S32 begin_offset, F32 target_x, F32 max_pixels, S32 max_chars, BOOL round) const +S32 LLFontGL::charFromPixelOffset(const llwchar* wchars, S32 begin_offset, F32 target_x, F32 max_pixels, S32 max_chars, bool round) const { if (!wchars || !wchars[0] || max_chars == 0) { @@ -1164,7 +1164,7 @@ LLFontGL* LLFontGL::getFontDefault() std::string LLFontGL::getFontPathSystem() { #if LL_DARWIN - // HACK for Mac OS X + // HACK for macOS return "/System/Library/Fonts/"; #elif LL_WINDOWS diff --git a/indra/llrender/llfontgl.h b/indra/llrender/llfontgl.h index 81674f4a64..4bb6c55c65 100644 --- a/indra/llrender/llfontgl.h +++ b/indra/llrender/llfontgl.h @@ -87,7 +87,7 @@ public: void destroyGL(); - BOOL loadFace(const std::string& filename, F32 point_size, const F32 vert_dpi, const F32 horz_dpi, bool is_fallback, S32 face_n); + bool loadFace(const std::string& filename, F32 point_size, const F32 vert_dpi, const F32 horz_dpi, bool is_fallback, S32 face_n); S32 getNumFaces(const std::string& filename); @@ -98,8 +98,8 @@ public: U8 style = NORMAL, ShadowType shadow = NO_SHADOW, S32 max_chars = S32_MAX, F32* right_x=NULL, - BOOL use_ellipses = FALSE, - BOOL use_color = TRUE) const; + bool use_ellipses = false, + bool use_color = true) const; S32 render(const LLWString &text, S32 begin_offset, const LLRectf& rect, @@ -108,8 +108,8 @@ public: U8 style = NORMAL, ShadowType shadow = NO_SHADOW, S32 max_chars = S32_MAX, F32* right_x=NULL, - BOOL use_ellipses = FALSE, - BOOL use_color = TRUE) const; + bool use_ellipses = false, + bool use_color = true) const; S32 render(const LLWString &text, S32 begin_offset, F32 x, F32 y, @@ -118,13 +118,13 @@ public: U8 style = NORMAL, ShadowType shadow = NO_SHADOW, S32 max_chars = S32_MAX, S32 max_pixels = S32_MAX, F32* right_x=NULL, - BOOL use_ellipses = FALSE, - BOOL use_color = TRUE) const; + bool use_ellipses = false, + bool use_color = true) const; S32 render(const LLWString &text, S32 begin_offset, F32 x, F32 y, const LLColor4 &color) const; // renderUTF8 does a conversion, so is slower! - S32 renderUTF8(const std::string &text, S32 begin_offset, F32 x, F32 y, const LLColor4 &color, HAlign halign, VAlign valign, U8 style, ShadowType shadow, S32 max_chars = S32_MAX, S32 max_pixels = S32_MAX, F32* right_x = NULL, BOOL use_ellipses = FALSE, BOOL use_color = TRUE) const; + S32 renderUTF8(const std::string &text, S32 begin_offset, F32 x, F32 y, const LLColor4 &color, HAlign halign, VAlign valign, U8 style, ShadowType shadow, S32 max_chars = S32_MAX, S32 max_pixels = S32_MAX, F32* right_x = NULL, bool use_ellipses = false, bool use_color = true) const; S32 renderUTF8(const std::string &text, S32 begin_offset, S32 x, S32 y, const LLColor4 &color) const; S32 renderUTF8(const std::string &text, S32 begin_offset, S32 x, S32 y, const LLColor4 &color, HAlign halign, VAlign valign, U8 style = NORMAL, ShadowType shadow = NO_SHADOW) const; @@ -159,7 +159,7 @@ public: S32 firstDrawableChar(const llwchar* wchars, F32 max_pixels, S32 text_len, S32 start_pos=S32_MAX, S32 max_chars = S32_MAX) const; // Returns the index of the character closest to pixel position x (ignoring text to the right of max_pixels and max_chars) - S32 charFromPixelOffset(const llwchar* wchars, S32 char_offset, F32 x, F32 max_pixels=F32_MAX, S32 max_chars = S32_MAX, BOOL round = TRUE) const; + S32 charFromPixelOffset(const llwchar* wchars, S32 char_offset, F32 x, F32 max_pixels=F32_MAX, S32 max_chars = S32_MAX, bool round = true) const; const LLFontDescriptor& getFontDesc() const; @@ -192,7 +192,7 @@ public: static std::string nameFromVAlign(LLFontGL::VAlign align); static LLFontGL::VAlign vAlignFromName(const std::string& name); - static void setFontDisplay(BOOL flag) { sDisplayFont = flag; } + static void setFontDisplay(bool flag) { sDisplayFont = flag; } static LLFontGL* getFontEmojiSmall(); static LLFontGL* getFontEmojiMedium(); @@ -224,7 +224,7 @@ public: static F32 sHorizDPI; static F32 sScaleX; static F32 sScaleY; - static BOOL sDisplayFont ; + static bool sDisplayFont ; static std::string sAppDir; // For loading fonts private: diff --git a/indra/llrender/llfontregistry.cpp b/indra/llrender/llfontregistry.cpp index 546211aac8..62f4f35e3d 100644 --- a/indra/llrender/llfontregistry.cpp +++ b/indra/llrender/llfontregistry.cpp @@ -297,7 +297,7 @@ bool font_desc_init_from_xml(LLXMLNodePtr node, LLFontDescriptor& desc) if (child->hasAttribute("load_collection")) { - BOOL col = FALSE; + bool col = false; child->getAttributeBOOL("load_collection", col); if (col) { @@ -475,7 +475,7 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc) // The first font will get pulled will be the "head" font, set to non-fallback. // Rest will consitute the fallback list. - BOOL is_first_found = TRUE; + bool is_first_found = true; string_vec_t font_search_paths; font_search_paths.push_back(LLFontGL::getFontPathLocal()); @@ -499,7 +499,7 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc) // *HACK: Fallback fonts don't render, so we can use that to suppress // creation of OpenGL textures for test apps. JC - BOOL is_fallback = !is_first_found || !mCreateGLTextures; + bool is_fallback = !is_first_found || !mCreateGLTextures; F32 extra_scale = (is_fallback)?fallback_scale:1.0; F32 point_size_scale = extra_scale * point_size; bool is_font_loaded = false; diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index c592d7d3e2..2a7cc3d141 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -64,12 +64,12 @@ extern LLControlGroup gSavedSettings; #endif -BOOL gDebugSession = FALSE; -BOOL gDebugGLSession = FALSE; -BOOL gClothRipple = FALSE; -BOOL gHeadlessClient = FALSE; -BOOL gNonInteractive = FALSE; -BOOL gGLActive = FALSE; +bool gDebugSession = false; +bool gDebugGLSession = false; +bool gClothRipple = false; +bool gHeadlessClient = false; +bool gNonInteractive = false; +bool gGLActive = false; static const std::string HEADLESS_VENDOR_STRING("Linden Lab"); static const std::string HEADLESS_RENDERER_STRING("Headless"); @@ -991,22 +991,22 @@ PFNGLPOLYGONOFFSETCLAMPPROC glPolygonOffsetClamp = nullptr; LLGLManager gGLManager; LLGLManager::LLGLManager() : - mInited(FALSE), - mIsDisabled(FALSE), + mInited(false), + mIsDisabled(false), mMaxSamples(0), mNumTextureImageUnits(1), mMaxSampleMaskWords(0), mMaxColorTextureSamples(0), mMaxDepthTextureSamples(0), mMaxIntegerSamples(0), - mIsAMD(FALSE), - mIsNVIDIA(FALSE), - mIsIntel(FALSE), - mIsApple(FALSE), + mIsAMD(false), + mIsNVIDIA(false), + mIsIntel(false), + mIsApple(false), #if LL_DARWIN - mIsMobileGF(FALSE), + mIsMobileGF(false), #endif - mHasRequirements(TRUE), + mHasRequirements(true), mDriverVersionMajor(1), mDriverVersionMinor(0), mDriverVersionRelease(0), @@ -1158,12 +1158,12 @@ bool LLGLManager::initGL() { mGLVendorShort = "AMD"; // *TODO: Fix this? - mIsAMD = TRUE; + mIsAMD = true; } else if (mGLVendor.find("NVIDIA ") != std::string::npos) { mGLVendorShort = "NVIDIA"; - mIsNVIDIA = TRUE; + mIsNVIDIA = true; } else if (mGLVendor.find("INTEL") != std::string::npos #if LL_LINUX || __FreeBSD__ @@ -1174,7 +1174,7 @@ bool LLGLManager::initGL() ) { mGLVendorShort = "INTEL"; - mIsIntel = TRUE; + mIsIntel = true; } else if(mGLVendor.find("APPLE") != std::string::npos) { @@ -1189,7 +1189,7 @@ bool LLGLManager::initGL() // This is called here because it depends on the setting of mIsGF2or4MX, and sets up mHasMultitexture. initExtensions(); - S32 old_vram = mVRAM; + U32 old_vram = mVRAM; mVRAM = 0; #if LL_WINDOWS @@ -1231,7 +1231,7 @@ bool LLGLManager::initGL() // Function will check all GPUs WMI knows of and will pick up the one with most // memory. We need to check all GPUs because system can switch active GPU to // weaker one, to preserve power when not under load. - S32 mem = LLDXHardware::getMBVideoMemoryViaWMI(); + U32 mem = LLDXHardware::getMBVideoMemoryViaWMI(); if (mem != 0) { mVRAM = mem; @@ -1256,6 +1256,11 @@ bool LLGLManager::initGL() glGetIntegerv(GL_MAX_SAMPLE_MASK_WORDS, &mMaxSampleMaskWords); #endif glGetIntegerv(GL_MAX_SAMPLES, &mMaxSamples); + glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, &mMaxUniformBlockSize); + + // sanity clamp max uniform block size to 64k just in case + // there's some implementation that reports a crazy value + mMaxUniformBlockSize = llmin(mMaxUniformBlockSize, 65536); if (mGLVersion >= 4.59f) { @@ -1375,7 +1380,7 @@ void LLGLManager::asLLSD(LLSD& info) info["gpu_version"] = mDriverVersionVendorString; info["opengl_version"] = mGLVersionString; - info["vram"] = mVRAM; + info["vram"] = LLSD::Integer(mVRAM); // OpenGL limits info["max_samples"] = mMaxSamples; @@ -1403,12 +1408,12 @@ void LLGLManager::shutdownGL() { glFinish(); stop_glerror(); - mInited = FALSE; + mInited = false; } } // these are used to turn software blending on. They appear in the Debug/Avatar menu -// presence of vertex skinning/blending or vertex programs will set these to FALSE by default. +// presence of vertex skinning/blending or vertex programs will set these to false by default. void LLGLManager::initExtensions() { @@ -1443,7 +1448,7 @@ void LLGLManager::initExtensions() glGetIntegerv(GL_MAX_ELEMENTS_INDICES, (GLint*) &mGLMaxIndexRange); glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint*) &mGLMaxTextureSize); - mInited = TRUE; + mInited = true; /* #if LL_WINDOWS @@ -2332,10 +2337,10 @@ void do_assert_glerror() // Create or update texture to be used with this data GLenum error; error = glGetError(); - BOOL quit = FALSE; + bool quit = false; if (LL_UNLIKELY(error)) { - quit = TRUE; + quit = true; #if GLU_VERSION_1_1 GLubyte const * gl_error_msg = gluErrorString(error); if (NULL != gl_error_msg) @@ -2461,7 +2466,7 @@ void LLGLState::dumpStates() for (boost::unordered_map<LLGLenum, LLGLboolean>::iterator iter = sStateMap.begin(); iter != sStateMap.end(); ++iter) { - LL_INFOS("RenderState") << llformat(" 0x%04x : %s",(S32)iter->first,iter->second?"TRUE":"FALSE") << LL_ENDL; + LL_INFOS("RenderState") << llformat(" 0x%04x : %s",(S32)iter->first,iter->second?"true":"false") << LL_ENDL; } } @@ -2504,7 +2509,7 @@ void LLGLState::checkStates(GLboolean writeAlpha) /////////////////////////////////////////////////////////////////////// LLGLState::LLGLState(LLGLenum state, S32 enabled) : - mState(state), mWasEnabled(FALSE), mIsEnabled(FALSE) + mState(state), mWasEnabled(false), mIsEnabled(false) { LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; @@ -2523,15 +2528,15 @@ void LLGLState::setEnabled(S32 enabled) } if (enabled == CURRENT_STATE) { - enabled = sStateMap[mState] == GL_TRUE ? TRUE : FALSE; + enabled = sStateMap[mState] == GL_TRUE ? ENABLED_STATE : DISABLED_STATE; } - else if (enabled == TRUE && sStateMap[mState] != GL_TRUE) + else if (enabled == ENABLED_STATE && sStateMap[mState] != GL_TRUE) { gGL.flush(); glEnable(mState); sStateMap[mState] = GL_TRUE; } - else if (enabled == FALSE && sStateMap[mState] != GL_FALSE) + else if (enabled == DISABLED_STATE && sStateMap[mState] != GL_FALSE) { gGL.flush(); glDisable(mState); @@ -2786,7 +2791,7 @@ LLGLDepthTest::LLGLDepthTest(GLboolean depth_enabled, GLboolean write_enabled, G { // always disable depth writes if depth testing is disabled // GL spec defines this as a requirement, but some implementations allow depth writes with testing disabled // The proper way to write to depth buffer with testing disabled is to enable testing and use a depth_func of GL_ALWAYS - write_enabled = FALSE; + write_enabled = GL_FALSE; } if (depth_enabled != sDepthEnabled) @@ -2839,7 +2844,7 @@ void LLGLDepthTest::checkState() if (gDebugGL) { GLint func = 0; - GLboolean mask = FALSE; + GLboolean mask = GL_FALSE; glGetIntegerv(GL_DEPTH_FUNC, &func); glGetBooleanv(GL_DEPTH_WRITEMASK, &mask); diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h index e4b106c999..a3d87e001c 100644 --- a/indra/llrender/llgl.h +++ b/indra/llrender/llgl.h @@ -45,9 +45,9 @@ #include "llglheaders.h" #include "glh/glh_linear.h" -extern BOOL gDebugGL; -extern BOOL gDebugSession; -extern BOOL gDebugGLSession; +extern bool gDebugGL; +extern bool gDebugSession; +extern bool gDebugGLSession; extern llofstream gFailLog; #define LL_GL_ERRS LL_ERRS("RenderState") @@ -73,8 +73,8 @@ public: std::string getRawGLString(); // For sending to simulator - BOOL mInited; - BOOL mIsDisabled; + bool mInited; + bool mIsDisabled; // OpenGL limits S32 mMaxSamples; @@ -87,6 +87,7 @@ public: S32 mGLMaxIndexRange; S32 mGLMaxTextureSize; F32 mMaxAnisotropy = 0.f; + S32 mMaxUniformBlockSize = 0; // GL 4.x capabilities bool mHasCubeMapArray = false; @@ -97,18 +98,18 @@ public: // Vendor-specific extensions bool mHasAMDAssociations = false; - BOOL mIsAMD; - BOOL mIsNVIDIA; - BOOL mIsIntel; - BOOL mIsApple; + bool mIsAMD; + bool mIsNVIDIA; + bool mIsIntel; + bool mIsApple; #if LL_DARWIN // Needed to distinguish problem cards on older Macs that break with Materials - BOOL mIsMobileGF; + bool mIsMobileGF; #endif // Whether this version of GL is good enough for SL to use - BOOL mHasRequirements; + bool mHasRequirements; S32 mDriverVersionMajor; S32 mDriverVersionMinor; @@ -119,9 +120,7 @@ public: std::string mDriverVersionVendorString; std::string mGLVersionString; - S32 mVRAM; // VRAM in MB - - void getPixelFormat(); // Get the best pixel format + U32 mVRAM; // VRAM in MB std::string getGLInfoString(); void printGLInfoString(); @@ -139,7 +138,6 @@ public: private: void initExtensions(); void initGLStates(); - void initGLImages(); }; extern LLGLManager gGLManager; @@ -156,13 +154,18 @@ void assert_glerror(); void clear_glerror(); -//#if LL_DEBUG + # define stop_glerror() assert_glerror() # define llglassertok() assert_glerror() -//#else -//# define stop_glerror() -//# define llglassertok() -//#endif + +// stop_glerror is still needed on OS X but has performance implications +// use macro below to conditionally add stop_glerror to non-release builds +// on OS X +#if LL_DARWIN && !LL_RELEASE_FOR_DOWNLOAD +#define STOP_GLERROR stop_glerror() +#else +#define STOP_GLERROR +#endif #define llglassertok_always() assert_glerror() @@ -242,16 +245,16 @@ protected: static boost::unordered_map<LLGLenum, LLGLboolean> sStateMap; public: - enum { CURRENT_STATE = -2 }; + enum { CURRENT_STATE = -2, DISABLED_STATE = 0, ENABLED_STATE = 1 }; LLGLState(LLGLenum state, S32 enabled = CURRENT_STATE); ~LLGLState(); void setEnabled(S32 enabled); - void enable() { setEnabled(TRUE); } - void disable() { setEnabled(FALSE); } + void enable() { setEnabled(ENABLED_STATE); } + void disable() { setEnabled(DISABLED_STATE); } protected: LLGLenum mState; - BOOL mWasEnabled; - BOOL mIsEnabled; + bool mWasEnabled; + bool mIsEnabled; }; // New LLGLState class wrappers that don't depend on actual GL flags. @@ -285,14 +288,14 @@ public: class LLGLEnable : public LLGLState { public: - LLGLEnable(LLGLenum state) : LLGLState(state, TRUE) {} + LLGLEnable(LLGLenum state) : LLGLState(state, ENABLED_STATE) {} }; /// TODO: Being deprecated. class LLGLDisable : public LLGLState { public: - LLGLDisable(LLGLenum state) : LLGLState(state, FALSE) {} + LLGLDisable(LLGLenum state) : LLGLState(state, DISABLED_STATE) {} }; /* @@ -352,9 +355,9 @@ public: static std::list<LLGLUpdate*> sGLQ; - BOOL mInQ; + bool mInQ; LLGLUpdate() - : mInQ(FALSE) + : mInQ(false) { } virtual ~LLGLUpdate() @@ -406,10 +409,10 @@ void init_glstates(); void parse_gl_version( S32* major, S32* minor, S32* release, std::string* vendor_specific, std::string* version_string ); -extern BOOL gClothRipple; -extern BOOL gHeadlessClient; -extern BOOL gNonInteractive; -extern BOOL gGLActive; +extern bool gClothRipple; +extern bool gHeadlessClient; +extern bool gNonInteractive; +extern bool gGLActive; // Deal with changing glext.h definitions for newer SDK versions, specifically // with MAC OSX 10.5 -> 10.6 diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 0c1519824c..880b491253 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -54,6 +54,8 @@ using std::string; GLuint LLGLSLShader::sCurBoundShader = 0; LLGLSLShader* LLGLSLShader::sCurBoundShaderPtr = NULL; S32 LLGLSLShader::sIndexedTextureChannels = 0; +U32 LLGLSLShader::sMaxGLTFMaterials = 0; +U32 LLGLSLShader::sMaxGLTFNodes = 0; bool LLGLSLShader::sProfileEnabled = false; std::set<LLGLSLShader*> LLGLSLShader::sInstances; LLGLSLShader::defines_map_t LLGLSLShader::sGlobalDefines; @@ -81,7 +83,7 @@ const std::string gShaderConstsVal[LLGLSLShader::NUM_SHADER_CONSTS] = }; -BOOL shouldChange(const LLVector4& v1, const LLVector4& v2) +bool shouldChange(const LLVector4& v1, const LLVector4& v2) { return v1 != v2; } @@ -339,7 +341,7 @@ LLGLSLShader::LLGLSLShader() mShaderLevel(0), mShaderGroup(SG_DEFAULT), mFeatures(), - mUniformsDirty(FALSE), + mUniformsDirty(false), mTimerQuery(0), mSamplesQuery(0), mPrimitivesQuery(0) @@ -411,10 +413,7 @@ void LLGLSLShader::unloadInternal() stop_glerror(); } -BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString>* attributes, - std::vector<LLStaticHashedString>* uniforms, - U32 varying_count, - const char** varyings) +bool LLGLSLShader::createShader() { LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; @@ -445,10 +444,10 @@ BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString>* attributes, // Shouldn't happen if shader related extensions, like ARB_vertex_shader, exist. LL_SHADER_LOADING_WARNS() << "Failed to create handle for shader: " << mName << LL_ENDL; unloadInternal(); - return FALSE; + return false; } - BOOL success = TRUE; + bool success = true; mUsingBinaryProgram = LLShaderMgr::instance()->loadCachedProgramBinary(this); @@ -470,7 +469,7 @@ BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString>* attributes, } else { - success = FALSE; + success = false; } } } @@ -479,16 +478,16 @@ BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString>* attributes, if (!LLShaderMgr::instance()->attachShaderFeatures(this)) { unloadInternal(); - return FALSE; + return false; } // Map attributes and uniforms if (success) { - success = mapAttributes(attributes); + success = mapAttributes(); } if (success) { - success = mapUniforms(uniforms); + success = mapUniforms(); } if (!success) { @@ -499,7 +498,7 @@ BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString>* attributes, { LL_SHADER_LOADING_WARNS() << "Failed to link using shader level " << mShaderLevel << " trying again using shader level " << (mShaderLevel - 1) << LL_ENDL; mShaderLevel--; - return createShader(attributes, uniforms); + return createShader(); } else { @@ -509,6 +508,7 @@ BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString>* attributes, } else if (mFeatures.mIndexedTextureChannels > 0) { //override texture channels for indexed texture rendering + llassert(mFeatures.mIndexedTextureChannels == LLGLSLShader::sIndexedTextureChannels); // these numbers must always match bind(); S32 channel_count = mFeatures.mIndexedTextureChannels; @@ -518,19 +518,41 @@ BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString>* attributes, uniform1i(uniName, i); } - S32 cur_tex = channel_count; //adjust any texture channels that might have been overwritten + //adjust any texture channels that might have been overwritten for (U32 i = 0; i < mTexture.size(); i++) { - if (mTexture[i] > -1 && mTexture[i] < channel_count) + if (mTexture[i] > -1) { - llassert(cur_tex < gGLManager.mNumTextureImageUnits); - uniform1i(i, cur_tex); - mTexture[i] = cur_tex++; + S32 new_tex = mTexture[i] + channel_count; + uniform1i(i, new_tex); + mTexture[i] = new_tex; } } + + // get the true number of active texture channels + mActiveTextureChannels = channel_count; + for (auto& tex : mTexture) + { + mActiveTextureChannels = llmax(mActiveTextureChannels, tex + 1); + } + + // when indexed texture channels are used, enforce an upper limit of 16 + // this should act as a canary in the coal mine for adding textures + // and breaking machines that are limited to 16 texture channels + llassert(mActiveTextureChannels <= 16); unbind(); } + LL_DEBUGS("GLSLTextureChannels") << mName << " has " << mActiveTextureChannels << " active texture channels" << LL_ENDL; + + for (U32 i = 0; i < mTexture.size(); i++) + { + if (mTexture[i] > -1) + { + LL_DEBUGS("GLSLTextureChannels") << "Texture " << LLShaderMgr::instance()->mReservedUniforms[i] << " assigned to channel " << mTexture[i] << LL_ENDL; + } + } + #ifdef LL_PROFILER_ENABLE_RENDER_DOC setLabel(mName.c_str()); #endif @@ -559,7 +581,7 @@ void dumpAttachObject(const char* func_name, GLuint program_object, const std::s } #endif // DEBUG_SHADER_INCLUDES -BOOL LLGLSLShader::attachVertexObject(std::string object_path) +bool LLGLSLShader::attachVertexObject(std::string object_path) { if (LLShaderMgr::instance()->mVertexShaderObjects.count(object_path) > 0) { @@ -569,19 +591,19 @@ BOOL LLGLSLShader::attachVertexObject(std::string object_path) dumpAttachObject("attachVertexObject", mProgramObject, object_path); #endif // DEBUG_SHADER_INCLUDES stop_glerror(); - return TRUE; + return true; } else { LL_SHADER_LOADING_WARNS() << "Attempting to attach shader object: '" << object_path << "' that hasn't been compiled." << LL_ENDL; - return FALSE; + return false; } } -BOOL LLGLSLShader::attachFragmentObject(std::string object_path) +bool LLGLSLShader::attachFragmentObject(std::string object_path) { if(mUsingBinaryProgram) - return TRUE; + return true; if (LLShaderMgr::instance()->mFragmentShaderObjects.count(object_path) > 0) { @@ -591,12 +613,12 @@ BOOL LLGLSLShader::attachFragmentObject(std::string object_path) dumpAttachObject("attachFragmentObject", mProgramObject, object_path); #endif // DEBUG_SHADER_INCLUDES stop_glerror(); - return TRUE; + return true; } else { LL_SHADER_LOADING_WARNS() << "Attempting to attach shader object: '" << object_path << "' that hasn't been compiled." << LL_ENDL; - return FALSE; + return false; } } @@ -632,11 +654,11 @@ void LLGLSLShader::attachObjects(GLuint* objects, S32 count) } } -BOOL LLGLSLShader::mapAttributes(const std::vector<LLStaticHashedString>* attributes) +bool LLGLSLShader::mapAttributes() { LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; - BOOL res = TRUE; + bool res = true; if (!mUsingBinaryProgram) { //before linking, make sure reserved attributes always have consistent locations @@ -651,11 +673,10 @@ BOOL LLGLSLShader::mapAttributes(const std::vector<LLStaticHashedString>* attrib } mAttribute.clear(); - U32 numAttributes = (attributes == NULL) ? 0 : attributes->size(); #if LL_RELEASE_WITH_DEBUG_INFO - mAttribute.resize(LLShaderMgr::instance()->mReservedAttribs.size() + numAttributes, { -1, NULL }); + mAttribute.resize(LLShaderMgr::instance()->mReservedAttribs.size(), { -1, NULL }); #else - mAttribute.resize(LLShaderMgr::instance()->mReservedAttribs.size() + numAttributes, -1); + mAttribute.resize(LLShaderMgr::instance()->mReservedAttribs.size(), -1); #endif if (res) @@ -679,27 +700,14 @@ BOOL LLGLSLShader::mapAttributes(const std::vector<LLStaticHashedString>* attrib LL_DEBUGS("ShaderUniform") << "Attribute " << name << " assigned to channel " << index << LL_ENDL; } } - if (attributes != NULL) - { - for (U32 i = 0; i < numAttributes; i++) - { - const char* name = (*attributes)[i].String().c_str(); - S32 index = glGetAttribLocation(mProgramObject, name); - if (index != -1) - { - mAttribute[LLShaderMgr::instance()->mReservedAttribs.size() + i] = index; - LL_DEBUGS("ShaderUniform") << "Attribute " << name << " assigned to channel " << index << LL_ENDL; - } - } - } - return TRUE; + return true; } - return FALSE; + return false; } -void LLGLSLShader::mapUniform(GLint index, const vector<LLStaticHashedString>* uniforms) +void LLGLSLShader::mapUniform(GLint index) { LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; @@ -789,22 +797,11 @@ void LLGLSLShader::mapUniform(GLint index, const vector<LLStaticHashedString>* u //found it mUniform[i] = location; mTexture[i] = mapUniformTextureChannel(location, type, size); - return; - } - } - - if (uniforms != NULL) - { - for (U32 i = 0; i < uniforms->size(); i++) - { - if ((mUniform[i + LLShaderMgr::instance()->mReservedUniforms.size()] == -1) - && ((*uniforms)[i].String() == name)) + if (mTexture[i] != -1) { - //found it - mUniform[i + LLShaderMgr::instance()->mReservedUniforms.size()] = location; - mTexture[i + LLShaderMgr::instance()->mReservedUniforms.size()] = mapUniformTextureChannel(location, type, size); - return; + LL_DEBUGS("GLSLTextureChannels") << name << " assigned to texture channel " << mTexture[i] << LL_ENDL; } + return; } } } @@ -845,35 +842,31 @@ GLint LLGLSLShader::mapUniformTextureChannel(GLint location, GLenum type, GLint if (size == 1) { glUniform1i(location, mActiveTextureChannels); - LL_DEBUGS("ShaderUniform") << "Assigned to texture channel " << mActiveTextureChannels << LL_ENDL; mActiveTextureChannels++; } else { //is array of textures, make sequential after this texture - GLint channel[32]; // <=== only support up to 32 texture channels - llassert(size <= 32); - size = llmin(size, 32); + GLint channel[16]; // <=== only support up to 16 texture channels + llassert(size <= 16); + size = llmin(size, 16); for (int i = 0; i < size; ++i) { channel[i] = mActiveTextureChannels++; } glUniform1iv(location, size, channel); - LL_DEBUGS("ShaderUniform") << "Assigned to texture channel " << - (mActiveTextureChannels - size) << " through " << (mActiveTextureChannels - 1) << LL_ENDL; } - llassert(mActiveTextureChannels <= 32); // too many textures (probably) return ret; } return -1; } -BOOL LLGLSLShader::mapUniforms(const vector<LLStaticHashedString>* uniforms) +bool LLGLSLShader::mapUniforms() { LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; - BOOL res = TRUE; + bool res = true; mTotalUniformSize = 0; mActiveTextureChannels = 0; @@ -882,9 +875,8 @@ BOOL LLGLSLShader::mapUniforms(const vector<LLStaticHashedString>* uniforms) mTexture.clear(); mValue.clear(); //initialize arrays - U32 numUniforms = (uniforms == NULL) ? 0 : uniforms->size(); - mUniform.resize(numUniforms + LLShaderMgr::instance()->mReservedUniforms.size(), -1); - mTexture.resize(numUniforms + LLShaderMgr::instance()->mReservedUniforms.size(), -1); + mUniform.resize(LLShaderMgr::instance()->mReservedUniforms.size(), -1); + mTexture.resize(LLShaderMgr::instance()->mReservedUniforms.size(), -1); bind(); @@ -985,26 +977,26 @@ BOOL LLGLSLShader::mapUniforms(const vector<LLStaticHashedString>* uniforms) if (specularDiff || bumpLessDiff || envLessDiff || refLessDiff) { - mapUniform(diffuseMap, uniforms); + mapUniform(diffuseMap); skip_index.insert(diffuseMap); if (-1 != specularMap) { - mapUniform(specularMap, uniforms); + mapUniform(specularMap); skip_index.insert(specularMap); } if (-1 != bumpMap) { - mapUniform(bumpMap, uniforms); + mapUniform(bumpMap); skip_index.insert(bumpMap); } if (-1 != environmentMap) { - mapUniform(environmentMap, uniforms); + mapUniform(environmentMap); skip_index.insert(environmentMap); } if (-1 != reflectionMap) { - mapUniform(reflectionMap, uniforms); + mapUniform(reflectionMap); skip_index.insert(reflectionMap); } } @@ -1018,21 +1010,31 @@ BOOL LLGLSLShader::mapUniforms(const vector<LLStaticHashedString>* uniforms) if (skip_index.end() != skip_index.find(i)) continue; //........................................................................................ - mapUniform(i, uniforms); + mapUniform(i); } //........................................................................................................................................ - if (mFeatures.hasReflectionProbes) // Set up block binding, in a way supported by Apple (rather than binding = 1 in .glsl). - { // See slide 35 and more of https://docs.huihoo.com/apple/wwdc/2011/session_420__advances_in_opengl_for_mac_os_x_lion.pdf - static const GLuint BLOCKBINDING = 1; //picked by us - //Get the index, similar to a uniform location - GLuint UBOBlockIndex = glGetUniformBlockIndex(mProgramObject, "ReflectionProbes"); + // Set up block binding, in a way supported by Apple (rather than binding = 1 in .glsl). + // See slide 35 and more of https://docs.huihoo.com/apple/wwdc/2011/session_420__advances_in_opengl_for_mac_os_x_lion.pdf + const char* ubo_names[] = + { + "ReflectionProbes", // UB_REFLECTION_PROBES + "GLTFJoints", // UB_GLTF_JOINTS + "GLTFNodes", // UB_GLTF_NODES + "GLTFMaterials", // UB_GLTF_MATERIALS + }; + + llassert(LL_ARRAY_SIZE(ubo_names) == NUM_UNIFORM_BLOCKS); + + for (U32 i = 0; i < NUM_UNIFORM_BLOCKS; ++i) + { + GLuint UBOBlockIndex = glGetUniformBlockIndex(mProgramObject, ubo_names[i]); if (UBOBlockIndex != GL_INVALID_INDEX) { - //Set this index to a binding index - glUniformBlockBinding(mProgramObject, UBOBlockIndex, BLOCKBINDING); + glUniformBlockBinding(mProgramObject, UBOBlockIndex, i); } } + unbind(); LL_DEBUGS("ShaderUniform") << "Total Uniform Size: " << mTotalUniformSize << LL_ENDL; @@ -1040,11 +1042,11 @@ BOOL LLGLSLShader::mapUniforms(const vector<LLStaticHashedString>* uniforms) } -BOOL LLGLSLShader::link(BOOL suppress_errors) +bool LLGLSLShader::link(bool suppress_errors) { LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; - BOOL success = LLShaderMgr::instance()->linkProgramObject(mProgramObject, suppress_errors); + bool success = LLShaderMgr::instance()->linkProgramObject(mProgramObject, suppress_errors); if (!success && !suppress_errors) { @@ -1084,10 +1086,17 @@ void LLGLSLShader::bind() if (mUniformsDirty) { LLShaderMgr::instance()->updateShaderUniforms(this); - mUniformsDirty = FALSE; + mUniformsDirty = false; } } +void LLGLSLShader::bind(U8 variant) +{ + llassert(mGLTFVariants.size() == LLGLSLShader::NUM_GLTF_VARIANTS); + llassert(variant < LLGLSLShader::NUM_GLTF_VARIANTS); + mGLTFVariants[variant].bind(); +} + void LLGLSLShader::bind(bool rigged) { if (rigged) @@ -1133,7 +1142,8 @@ S32 LLGLSLShader::bindTexture(S32 uniform, LLTexture* texture, LLTexUnit::eTextu if (uniform < 0 || uniform >= (S32)mTexture.size()) { - LL_SHADER_UNIFORM_ERRS() << "Uniform out of range: " << uniform << LL_ENDL; + LL_WARNS_ONCE("Shader") << "Uniform index out of bounds. Size: " << (S32)mUniform.size() << " index: " << uniform << LL_ENDL; + llassert(false); return -1; } @@ -1154,6 +1164,8 @@ S32 LLGLSLShader::bindTexture(S32 uniform, LLRenderTarget* texture, bool depth, if (uniform < 0 || uniform >= (S32)mTexture.size()) { + LL_WARNS_ONCE("Shader") << "Uniform index out of bounds. Size: " << (S32)mUniform.size() << " index: " << uniform << LL_ENDL; + llassert(false); return -1; } @@ -1201,7 +1213,8 @@ S32 LLGLSLShader::unbindTexture(S32 uniform, LLTexUnit::eTextureType mode) if (uniform < 0 || uniform >= (S32)mTexture.size()) { - LL_SHADER_UNIFORM_ERRS() << "Uniform out of range: " << uniform << LL_ENDL; + LL_WARNS_ONCE("Shader") << "Uniform index out of bounds. Size: " << (S32)mUniform.size() << " index: " << uniform << LL_ENDL; + llassert(false); return -1; } @@ -1226,7 +1239,8 @@ S32 LLGLSLShader::enableTexture(S32 uniform, LLTexUnit::eTextureType mode, LLTex if (uniform < 0 || uniform >= (S32)mTexture.size()) { - LL_SHADER_UNIFORM_ERRS() << "Uniform out of range: " << uniform << LL_ENDL; + LL_WARNS_ONCE("Shader") << "Uniform index out of bounds. Size: " << (S32)mUniform.size() << " index: " << uniform << LL_ENDL; + llassert(false); return -1; } @@ -1247,7 +1261,8 @@ S32 LLGLSLShader::disableTexture(S32 uniform, LLTexUnit::eTextureType mode, LLTe if (uniform < 0 || uniform >= (S32)mTexture.size()) { - LL_SHADER_UNIFORM_ERRS() << "Uniform out of range: " << uniform << LL_ENDL; + LL_WARNS_ONCE("Shader") << "Uniform index out of bounds. Size: " << (S32)mUniform.size() << " index: " << uniform << LL_ENDL; + llassert(false); return -1; } S32 index = mTexture[uniform]; @@ -1278,7 +1293,8 @@ void LLGLSLShader::uniform1i(U32 index, GLint x) { if (mUniform.size() <= index) { - LL_SHADER_UNIFORM_ERRS() << "Uniform index out of bounds." << LL_ENDL; + LL_WARNS_ONCE("Shader") << "Uniform index out of bounds. Size: " << (S32)mUniform.size() << " index: " << index << LL_ENDL; + llassert(false); return; } @@ -1303,7 +1319,8 @@ void LLGLSLShader::uniform1f(U32 index, GLfloat x) { if (mUniform.size() <= index) { - LL_SHADER_UNIFORM_ERRS() << "Uniform index out of bounds." << LL_ENDL; + LL_WARNS_ONCE("Shader") << "Uniform index out of bounds. Size: " << (S32)mUniform.size() << " index: " << index << LL_ENDL; + llassert(false); return; } @@ -1338,7 +1355,8 @@ void LLGLSLShader::uniform2f(U32 index, GLfloat x, GLfloat y) { if (mUniform.size() <= index) { - LL_SHADER_UNIFORM_ERRS() << "Uniform index out of bounds." << LL_ENDL; + LL_WARNS_ONCE("Shader") << "Uniform index out of bounds. Size: " << (S32)mUniform.size() << " index: " << index << LL_ENDL; + llassert(false); return; } @@ -1364,7 +1382,8 @@ void LLGLSLShader::uniform3f(U32 index, GLfloat x, GLfloat y, GLfloat z) { if (mUniform.size() <= index) { - LL_SHADER_UNIFORM_ERRS() << "Uniform index out of bounds." << LL_ENDL; + LL_WARNS_ONCE("Shader") << "Uniform index out of bounds. Size: " << (S32)mUniform.size() << " index: " << index << LL_ENDL; + llassert(false); return; } @@ -1390,7 +1409,8 @@ void LLGLSLShader::uniform4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GLfloat { if (mUniform.size() <= index) { - LL_SHADER_UNIFORM_ERRS() << "Uniform index out of bounds." << LL_ENDL; + LL_WARNS_ONCE("Shader") << "Uniform index out of bounds. Size: " << (S32)mUniform.size() << " index: " << index << LL_ENDL; + llassert(false); return; } @@ -1416,7 +1436,8 @@ void LLGLSLShader::uniform1iv(U32 index, U32 count, const GLint* v) { if (mUniform.size() <= index) { - LL_SHADER_UNIFORM_ERRS() << "Uniform index out of bounds." << LL_ENDL; + LL_WARNS_ONCE("Shader") << "Uniform index out of bounds. Size: " << (S32)mUniform.size() << " index: " << index << LL_ENDL; + llassert(false); return; } @@ -1442,7 +1463,8 @@ void LLGLSLShader::uniform4iv(U32 index, U32 count, const GLint* v) { if (mUniform.size() <= index) { - LL_SHADER_UNIFORM_ERRS() << "Uniform index out of bounds." << LL_ENDL; + LL_WARNS_ONCE("Shader") << "Uniform index out of bounds. Size: " << (S32)mUniform.size() << " index: " << index << LL_ENDL; + llassert(false); return; } @@ -1469,7 +1491,8 @@ void LLGLSLShader::uniform1fv(U32 index, U32 count, const GLfloat* v) { if (mUniform.size() <= index) { - LL_SHADER_UNIFORM_ERRS() << "Uniform index out of bounds." << LL_ENDL; + LL_WARNS_ONCE("Shader") << "Uniform index out of bounds. Size: " << (S32)mUniform.size() << " index: " << index << LL_ENDL; + llassert(false); return; } @@ -1495,7 +1518,8 @@ void LLGLSLShader::uniform2fv(U32 index, U32 count, const GLfloat* v) { if (mUniform.size() <= index) { - LL_SHADER_UNIFORM_ERRS() << "Uniform index out of bounds." << LL_ENDL; + LL_WARNS_ONCE("Shader") << "Uniform index out of bounds. Size: " << (S32)mUniform.size() << " index: " << index << LL_ENDL; + llassert(false); return; } @@ -1521,7 +1545,8 @@ void LLGLSLShader::uniform3fv(U32 index, U32 count, const GLfloat* v) { if (mUniform.size() <= index) { - LL_SHADER_UNIFORM_ERRS() << "Uniform index out of bounds." << LL_ENDL; + LL_WARNS_ONCE("Shader") << "Uniform index out of bounds. Size: " << (S32)mUniform.size() << " index: " << index << LL_ENDL; + llassert(false); return; } @@ -1547,7 +1572,8 @@ void LLGLSLShader::uniform4fv(U32 index, U32 count, const GLfloat* v) { if (mUniform.size() <= index) { - LL_SHADER_UNIFORM_ERRS() << "Uniform index out of bounds." << LL_ENDL; + LL_WARNS_ONCE("Shader") << "Uniform index out of bounds. Size: " << (S32)mUniform.size() << " index: " << index << LL_ENDL; + llassert(false); return; } @@ -1574,7 +1600,8 @@ void LLGLSLShader::uniformMatrix2fv(U32 index, U32 count, GLboolean transpose, c { if (mUniform.size() <= index) { - LL_SHADER_UNIFORM_ERRS() << "Uniform index out of bounds." << LL_ENDL; + LL_WARNS_ONCE("Shader") << "Uniform index out of bounds. Size: " << (S32)mUniform.size() << " index: " << index << LL_ENDL; + llassert(false); return; } @@ -1594,7 +1621,8 @@ void LLGLSLShader::uniformMatrix3fv(U32 index, U32 count, GLboolean transpose, c { if (mUniform.size() <= index) { - LL_SHADER_UNIFORM_ERRS() << "Uniform index out of bounds." << LL_ENDL; + LL_WARNS_ONCE("Shader") << "Uniform index out of bounds. Size: " << (S32)mUniform.size() << " index: " << index << LL_ENDL; + llassert(false); return; } @@ -1614,7 +1642,8 @@ void LLGLSLShader::uniformMatrix3x4fv(U32 index, U32 count, GLboolean transpose, { if (mUniform.size() <= index) { - LL_SHADER_UNIFORM_ERRS() << "Uniform index out of bounds." << LL_ENDL; + LL_WARNS_ONCE("Shader") << "Uniform index out of bounds. Size: " << (S32)mUniform.size() << " index: " << index << LL_ENDL; + llassert(false); return; } @@ -1634,7 +1663,8 @@ void LLGLSLShader::uniformMatrix4fv(U32 index, U32 count, GLboolean transpose, c { if (mUniform.size() <= index) { - LL_SHADER_UNIFORM_ERRS() << "Uniform index out of bounds." << LL_ENDL; + LL_WARNS_ONCE("Shader") << "Uniform index out of bounds. Size: " << (S32)mUniform.size() << " index: " << index << LL_ENDL; + llassert(false); return; } diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index d7741c51bb..86e5625dca 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -44,6 +44,7 @@ public: bool hasTransport = false; // implies no lighting (it's possible to have neither though) bool hasSkinning = false; bool hasObjectSkinning = false; + bool mGLTF = false; bool hasAtmospherics = false; bool hasGamma = false; bool hasShadows = false; @@ -51,7 +52,6 @@ public: bool hasSrgb = false; bool isDeferred = false; bool hasScreenSpaceReflections = false; - bool disableTextureIndex = false; bool hasAlphaMask = false; bool hasReflectionProbes = false; bool attachNothing = false; @@ -69,8 +69,8 @@ public: template<typename T> struct UniformSetting { - S32 mUniform; - T mValue; + S32 mUniform{ 0 }; + T mValue{}; }; typedef UniformSetting<S32> IntSetting; @@ -145,6 +145,16 @@ public: SG_COUNT } eGroup; + enum UniformBlock : GLuint + { + UB_REFLECTION_PROBES, // "ReflectionProbes" + UB_GLTF_JOINTS, // "GLTFJoints" + UB_GLTF_NODES, // "GLTFNodes" + UB_GLTF_MATERIALS, // "GLTFMaterials" + NUM_UNIFORM_BLOCKS + }; + + static std::set<LLGLSLShader*> sInstances; static bool sProfileEnabled; @@ -155,6 +165,9 @@ public: static LLGLSLShader* sCurBoundShaderPtr; static S32 sIndexedTextureChannels; + static U32 sMaxGLTFMaterials; + static U32 sMaxGLTFNodes; + static void initProfile(); static void finishProfile(bool emit_report = true); @@ -175,17 +188,14 @@ public: // If force_read is true, will force an immediate readback (severe performance penalty) bool readProfileQuery(bool for_runtime = false, bool force_read = false); - BOOL createShader(std::vector<LLStaticHashedString>* attributes, - std::vector<LLStaticHashedString>* uniforms, - U32 varying_count = 0, - const char** varyings = NULL); - BOOL attachFragmentObject(std::string object); - BOOL attachVertexObject(std::string object); + bool createShader(); + bool attachFragmentObject(std::string object); + bool attachVertexObject(std::string object); void attachObject(GLuint object); void attachObjects(GLuint* objects = NULL, S32 count = 0); - BOOL mapAttributes(const std::vector<LLStaticHashedString>* attributes); - BOOL mapUniforms(const std::vector<LLStaticHashedString>*); - void mapUniform(GLint index, const std::vector<LLStaticHashedString>*); + bool mapAttributes(); + bool mapUniforms(); + void mapUniform(GLint index); void uniform1i(U32 index, GLint i); void uniform1f(U32 index, GLfloat v); void fastUniform1f(U32 index, GLfloat v); @@ -252,7 +262,7 @@ public: S32 unbindTexture(const std::string& uniform, LLTexUnit::eTextureType mode = LLTexUnit::TT_TEXTURE); S32 unbindTexture(S32 uniform, LLTexUnit::eTextureType mode = LLTexUnit::TT_TEXTURE); - BOOL link(BOOL suppress_errors = FALSE); + bool link(bool suppress_errors = false); void bind(); //helper to conditionally bind mRiggedVariant instead of this void bind(bool rigged); @@ -290,7 +300,7 @@ public: S32 mActiveTextureChannels; S32 mShaderLevel; S32 mShaderGroup; // see LLGLSLShader::eGroup - BOOL mUniformsDirty; + bool mUniformsDirty; LLShaderFeatures mFeatures; std::vector< std::pair< std::string, GLenum > > mShaderFiles; std::string mName; @@ -318,6 +328,26 @@ public: // this pointer should be set to whichever shader represents this shader's rigged variant LLGLSLShader* mRiggedVariant = nullptr; + // variants for use by GLTF renderer + // bit 0 = alpha mode blend (1) or opaque (0) + // bit 1 = rigged (1) or static (0) + // bit 2 = unlit (1) or lit (0) + // bit 3 = single (0) or multi (1) uv coordinates + struct GLTFVariant + { + constexpr static U8 ALPHA_BLEND = 1; + constexpr static U8 RIGGED = 2; + constexpr static U8 UNLIT = 4; + constexpr static U8 MULTI_UV = 8; + }; + + constexpr static U8 NUM_GLTF_VARIANTS = 16; + + std::vector<LLGLSLShader> mGLTFVariants; + + //helper to bind GLTF variant + void bind(U8 variant); + // hacky flag used for optimization in LLDrawPoolAlpha bool mCanBindFast = false; diff --git a/indra/llrender/llgltexture.cpp b/indra/llrender/llgltexture.cpp index 104976fcc6..e614f45986 100644 --- a/indra/llrender/llgltexture.cpp +++ b/indra/llrender/llgltexture.cpp @@ -27,13 +27,13 @@ #include "llgltexture.h" -LLGLTexture::LLGLTexture(BOOL usemipmaps) +LLGLTexture::LLGLTexture(bool usemipmaps) { init(); mUseMipMaps = usemipmaps; } -LLGLTexture::LLGLTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps) +LLGLTexture::LLGLTexture(const U32 width, const U32 height, const U8 components, bool usemipmaps) { init(); mFullWidth = width ; @@ -43,14 +43,14 @@ LLGLTexture::LLGLTexture(const U32 width, const U32 height, const U8 components, setTexelsPerImage(); } -LLGLTexture::LLGLTexture(const LLImageRaw* raw, BOOL usemipmaps) +LLGLTexture::LLGLTexture(const LLImageRaw* raw, bool usemipmaps) { init(); mUseMipMaps = usemipmaps ; // Create an empty image of the specified size and width mGLTexturep = new LLImageGL(raw, usemipmaps) ; - mFullWidth = mGLTexturep->getCurrentWidth(); - mFullHeight = mGLTexturep->getCurrentHeight(); + mFullWidth = mGLTexturep->getWidth(); + mFullHeight = mGLTexturep->getHeight(); mComponents = mGLTexturep->getComponents(); setTexelsPerImage(); } @@ -67,12 +67,12 @@ void LLGLTexture::init() mFullWidth = 0; mFullHeight = 0; mTexelsPerImage = 0 ; - mUseMipMaps = FALSE ; + mUseMipMaps = false ; mComponents = 0 ; mTextureState = NO_DELETE ; - mDontDiscard = FALSE; - mNeedsGLTexture = FALSE ; + mDontDiscard = false; + mNeedsGLTexture = false ; } void LLGLTexture::cleanup() @@ -141,7 +141,7 @@ LLImageGL* LLGLTexture::getGLTexture() const return mGLTexturep ; } -BOOL LLGLTexture::createGLTexture() +bool LLGLTexture::createGLTexture() { if(mGLTexturep.isNull()) { @@ -151,11 +151,11 @@ BOOL LLGLTexture::createGLTexture() return mGLTexturep->createGLTexture() ; } -BOOL LLGLTexture::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename, BOOL to_create, S32 category, bool defer_copy, LLGLuint* tex_name) +bool LLGLTexture::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename, bool to_create, S32 category, bool defer_copy, LLGLuint* tex_name) { llassert(mGLTexturep.notNull()); - BOOL ret = mGLTexturep->createGLTexture(discard_level, imageraw, usename, to_create, category, defer_copy, tex_name) ; + bool ret = mGLTexturep->createGLTexture(discard_level, imageraw, usename, to_create, category, defer_copy, tex_name) ; if(ret) { @@ -168,7 +168,7 @@ BOOL LLGLTexture::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, return ret ; } -void LLGLTexture::setExplicitFormat(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, BOOL swap_bytes) +void LLGLTexture::setExplicitFormat(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, bool swap_bytes) { llassert(mGLTexturep.notNull()) ; @@ -223,22 +223,22 @@ LLGLuint LLGLTexture::getTexName() const return mGLTexturep->getTexName() ; } -BOOL LLGLTexture::hasGLTexture() const +bool LLGLTexture::hasGLTexture() const { if(mGLTexturep.notNull()) { return mGLTexturep->getHasGLTexture() ; } - return FALSE ; + return false ; } -BOOL LLGLTexture::getBoundRecently() const +bool LLGLTexture::getBoundRecently() const { if(mGLTexturep.notNull()) { return mGLTexturep->getBoundRecently() ; } - return FALSE ; + return false ; } LLTexUnit::eTextureType LLGLTexture::getTarget(void) const @@ -247,7 +247,7 @@ LLTexUnit::eTextureType LLGLTexture::getTarget(void) const return mGLTexturep->getTarget() ; } -BOOL LLGLTexture::setSubImage(const LLImageRaw* imageraw, S32 x_pos, S32 y_pos, S32 width, S32 height, LLGLuint use_name) +bool LLGLTexture::setSubImage(const LLImageRaw* imageraw, S32 x_pos, S32 y_pos, S32 width, S32 height, LLGLuint use_name) { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; llassert(mGLTexturep.notNull()) ; @@ -255,7 +255,7 @@ BOOL LLGLTexture::setSubImage(const LLImageRaw* imageraw, S32 x_pos, S32 y_pos, return mGLTexturep->setSubImage(imageraw, x_pos, y_pos, width, height, 0, use_name) ; } -BOOL LLGLTexture::setSubImage(const U8* datap, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height, LLGLuint use_name) +bool LLGLTexture::setSubImage(const U8* datap, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height, LLGLuint use_name) { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; llassert(mGLTexturep.notNull()) ; @@ -310,14 +310,14 @@ LLGLenum LLGLTexture::getPrimaryFormat() const return mGLTexturep->getPrimaryFormat() ; } -BOOL LLGLTexture::getIsAlphaMask() const +bool LLGLTexture::getIsAlphaMask() const { llassert(mGLTexturep.notNull()) ; return mGLTexturep->getIsAlphaMask() ; } -BOOL LLGLTexture::getMask(const LLVector2 &tc) +bool LLGLTexture::getMask(const LLVector2 &tc) { llassert(mGLTexturep.notNull()) ; @@ -330,14 +330,14 @@ F32 LLGLTexture::getTimePassedSinceLastBound() return mGLTexturep->getTimePassedSinceLastBound() ; } -BOOL LLGLTexture::getMissed() const +bool LLGLTexture::getMissed() const { llassert(mGLTexturep.notNull()) ; return mGLTexturep->getMissed() ; } -BOOL LLGLTexture::isJustBound() const +bool LLGLTexture::isJustBound() const { llassert(mGLTexturep.notNull()) ; @@ -365,7 +365,7 @@ U32 LLGLTexture::getTexelsInGLTexture() const return mGLTexturep->getTexelsInGLTexture() ; } -BOOL LLGLTexture::isGLTextureCreated() const +bool LLGLTexture::isGLTextureCreated() const { llassert(mGLTexturep.notNull()) ; diff --git a/indra/llrender/llgltexture.h b/indra/llrender/llgltexture.h index f5bef0e291..0901243f8f 100644 --- a/indra/llrender/llgltexture.h +++ b/indra/llrender/llgltexture.h @@ -94,9 +94,9 @@ protected: LOG_CLASS(LLGLTexture); public: - LLGLTexture(BOOL usemipmaps = TRUE); - LLGLTexture(const LLImageRaw* raw, BOOL usemipmaps) ; - LLGLTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps) ; + LLGLTexture(bool usemipmaps = true); + LLGLTexture(const LLImageRaw* raw, bool usemipmaps) ; + LLGLTexture(const U32 width, const U32 height, const U8 components, bool usemipmaps) ; virtual void dump(); // debug info to LL_INFOS() @@ -117,25 +117,25 @@ public: /*virtual*/S32 getWidth(S32 discard_level = -1) const; /*virtual*/S32 getHeight(S32 discard_level = -1) const; - BOOL hasGLTexture() const ; + bool hasGLTexture() const ; LLGLuint getTexName() const ; - BOOL createGLTexture() ; + bool createGLTexture() ; // Create a GL Texture from an image raw // discard_level - mip level, 0 for highest resultion mip // imageraw - the image to copy from // usename - explicit GL name override - // to_create - set to FALSE to force gl texture to not be created + // to_create - set to false to force gl texture to not be created // category - LLGLTexture category for this LLGLTexture // defer_copy - set to true to allocate GL texture but NOT initialize with imageraw data // tex_name - if not null, will be set to the GL name of the texture created - BOOL createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename = 0, BOOL to_create = TRUE, S32 category = LLGLTexture::OTHER, bool defer_copy = false, LLGLuint* tex_name = nullptr); + bool createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename = 0, bool to_create = true, S32 category = LLGLTexture::OTHER, bool defer_copy = false, LLGLuint* tex_name = nullptr); void setFilteringOption(LLTexUnit::eTextureFilterOptions option); - void setExplicitFormat(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format = 0, BOOL swap_bytes = FALSE); + void setExplicitFormat(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format = 0, bool swap_bytes = false); void setAddressMode(LLTexUnit::eTextureAddressMode mode); - BOOL setSubImage(const LLImageRaw* imageraw, S32 x_pos, S32 y_pos, S32 width, S32 height, LLGLuint use_name = 0); - BOOL setSubImage(const U8* datap, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height, LLGLuint use_name = 0); + bool setSubImage(const LLImageRaw* imageraw, S32 x_pos, S32 y_pos, S32 width, S32 height, LLGLuint use_name = 0); + bool setSubImage(const U8* datap, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height, LLGLuint use_name = 0); void setGLTextureCreated (bool initialized); void setCategory(S32 category) ; void setTexName(LLGLuint); // for forcing w/ externally created textures only @@ -145,20 +145,20 @@ public: S32 getMaxDiscardLevel() const; S32 getDiscardLevel() const; S8 getComponents() const; - BOOL getBoundRecently() const; + bool getBoundRecently() const; S32Bytes getTextureMemory() const ; LLGLenum getPrimaryFormat() const; - BOOL getIsAlphaMask() const ; + bool getIsAlphaMask() const ; LLTexUnit::eTextureType getTarget(void) const ; - BOOL getMask(const LLVector2 &tc); + bool getMask(const LLVector2 &tc); F32 getTimePassedSinceLastBound(); - BOOL getMissed() const ; - BOOL isJustBound()const ; + bool getMissed() const ; + bool isJustBound()const ; void forceUpdateBindStats(void) const; U32 getTexelsInAtlas() const ; U32 getTexelsInGLTexture() const ; - BOOL isGLTextureCreated() const ; + bool isGLTextureCreated() const ; S32 getDiscardLevelInAtlas() const ; LLGLTextureState getTextureState() const { return mTextureState; } @@ -171,7 +171,7 @@ public: void forceActive() ; void setNoDelete() ; void dontDiscard() { mDontDiscard = 1; mTextureState = NO_DELETE; } - BOOL getDontDiscard() const { return mDontDiscard; } + bool getDontDiscard() const { return mDontDiscard; } //----------------- private: @@ -188,7 +188,7 @@ protected: S32 mBoostLevel; // enum describing priority level U32 mFullWidth; U32 mFullHeight; - BOOL mUseMipMaps; + bool mUseMipMaps; S8 mComponents; U32 mTexelsPerImage; // Texels per image. mutable S8 mNeedsGLTexture; diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index c713a2b3a9..fb02c72338 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -56,14 +56,14 @@ const F32 MIN_TEXTURE_LIFETIME = 10.f; U32 wpo2(U32 i); -// texture memory accounting (for OS X) +// texture memory accounting (for macOS) static LLMutex sTexMemMutex; static std::unordered_map<U32, U64> sTextureAllocs; static U64 sTextureBytes = 0; // track a texture alloc on the currently bound texture. // asserts that no currently tracked alloc exists -static void alloc_tex_image(U32 width, U32 height, U32 pixformat) +void LLImageGLMemory::alloc_tex_image(U32 width, U32 height, U32 pixformat) { U32 texUnit = gGL.getCurrentTexUnitIndex(); U32 texName = gGL.getTexUnit(texUnit)->getCurrTexture(); @@ -81,7 +81,7 @@ static void alloc_tex_image(U32 width, U32 height, U32 pixformat) } // track texture free on given texName -static void free_tex_image(U32 texName) +void LLImageGLMemory::free_tex_image(U32 texName) { sTexMemMutex.lock(); auto iter = sTextureAllocs.find(texName); @@ -98,22 +98,24 @@ static void free_tex_image(U32 texName) } // track texture free on given texNames -static void free_tex_images(U32 count, const U32* texNames) +void LLImageGLMemory::free_tex_images(U32 count, const U32* texNames) { - for (int i = 0; i < count; ++i) + for (U32 i = 0; i < count; ++i) { free_tex_image(texNames[i]); } } // track texture free on currently bound texture -static void free_cur_tex_image() +void LLImageGLMemory::free_cur_tex_image() { U32 texUnit = gGL.getCurrentTexUnitIndex(); U32 texName = gGL.getTexUnit(texUnit)->getCurrTexture(); free_tex_image(texName); } +using namespace LLImageGLMemory; + // static U64 LLImageGL::getTextureBytesAllocated() { @@ -126,9 +128,9 @@ U32 LLImageGL::sUniqueCount = 0; U32 LLImageGL::sBindCount = 0; S32 LLImageGL::sCount = 0; -BOOL LLImageGL::sGlobalUseAnisotropic = FALSE; +bool LLImageGL::sGlobalUseAnisotropic = false; F32 LLImageGL::sLastFrameTime = 0.f; -BOOL LLImageGL::sAllowReadBackRaw = FALSE ; +bool LLImageGL::sAllowReadBackRaw = false ; LLImageGL* LLImageGL::sDefaultGLTexture = NULL ; bool LLImageGL::sCompressTextures = false; std::set<LLImageGL*> LLImageGL::sImageList; @@ -147,7 +149,7 @@ S32 LLImageGL::sCurTexPickSize = -1 ; S32 LLImageGL::sMaxCategories = 1 ; //optimization for when we don't need to calculate mIsMask -BOOL LLImageGL::sSkipAnalyzeAlpha; +bool LLImageGL::sSkipAnalyzeAlpha; //------------------------ //**************************************************************************************************** @@ -185,12 +187,12 @@ void LLImageGL::checkTexSize(bool forced) const GLint texname; glGetIntegerv(GL_TEXTURE_BINDING_2D, &texname); - BOOL error = FALSE; + bool error = false; if (texname != mTexName) { LL_INFOS() << "Bound: " << texname << " Should bind: " << mTexName << " Default: " << LLImageGL::sDefaultGLTexture->getTexName() << LL_ENDL; - error = TRUE; + error = true; if (gDebugSession) { gFailLog << "Invalid texture bound!" << std::endl; @@ -213,7 +215,7 @@ void LLImageGL::checkTexSize(bool forced) const } if(x != (mWidth >> mCurrentDiscardLevel) || y != (mHeight >> mCurrentDiscardLevel)) { - error = TRUE; + error = true; if (gDebugSession) { gFailLog << "wrong texture size and discard level!" << @@ -236,7 +238,7 @@ void LLImageGL::checkTexSize(bool forced) const //************************************************************************************** //---------------------------------------------------------------------------- -BOOL is_little_endian() +bool is_little_endian() { S32 a = 0x12345678; U8 *c = (U8*)(&a); @@ -245,7 +247,7 @@ BOOL is_little_endian() } //static -void LLImageGL::initClass(LLWindow* window, S32 num_catagories, BOOL skip_analyze_alpha /* = false */, bool thread_texture_loads /* = false */, bool thread_media_updates /* = false */) +void LLImageGL::initClass(LLWindow* window, S32 num_catagories, bool skip_analyze_alpha /* = false */, bool thread_texture_loads /* = false */, bool thread_media_updates /* = false */) { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; sSkipAnalyzeAlpha = skip_analyze_alpha; @@ -297,6 +299,8 @@ S32 LLImageGL::dataFormatBits(S32 dataformat) case GL_BGRA: return 32; // Used for QuickTime media textures on the Mac #endif case GL_DEPTH_COMPONENT: return 24; + case GL_RGB16F: return 48; + case GL_RGBA16F: return 64; default: LL_ERRS() << "LLImageGL::Unknown format: " << dataformat << LL_ENDL; return 0; @@ -375,7 +379,7 @@ void LLImageGL::updateStats(F32 current_time) //---------------------------------------------------------------------------- //static -void LLImageGL::destroyGL(BOOL save_state) +void LLImageGL::destroyGL(bool save_state) { for (S32 stage = 0; stage < gGLManager.mNumTextureImageUnits; stage++) { @@ -420,7 +424,7 @@ void LLImageGL::restoreGL() { if (glimage->getComponents() && glimage->mSaveData->getComponents()) { - glimage->createGLTexture(glimage->mCurrentDiscardLevel, glimage->mSaveData, 0, TRUE, glimage->getCategory()); + glimage->createGLTexture(glimage->mCurrentDiscardLevel, glimage->mSaveData, 0, true, glimage->getCategory()); stop_glerror(); } glimage->mSaveData = NULL; // deletes data @@ -444,30 +448,30 @@ void LLImageGL::dirtyTexOptions() //for server side use only. //static -BOOL LLImageGL::create(LLPointer<LLImageGL>& dest, BOOL usemipmaps) +bool LLImageGL::create(LLPointer<LLImageGL>& dest, bool usemipmaps) { dest = new LLImageGL(usemipmaps); - return TRUE; + return true; } //for server side use only. -BOOL LLImageGL::create(LLPointer<LLImageGL>& dest, U32 width, U32 height, U8 components, BOOL usemipmaps) +bool LLImageGL::create(LLPointer<LLImageGL>& dest, U32 width, U32 height, U8 components, bool usemipmaps) { dest = new LLImageGL(width, height, components, usemipmaps); - return TRUE; + return true; } //for server side use only. -BOOL LLImageGL::create(LLPointer<LLImageGL>& dest, const LLImageRaw* imageraw, BOOL usemipmaps) +bool LLImageGL::create(LLPointer<LLImageGL>& dest, const LLImageRaw* imageraw, bool usemipmaps) { dest = new LLImageGL(imageraw, usemipmaps); - return TRUE; + return true; } //---------------------------------------------------------------------------- -LLImageGL::LLImageGL(BOOL usemipmaps) -: mSaveData(0), mExternalTexture(FALSE) +LLImageGL::LLImageGL(bool usemipmaps) +: mSaveData(0), mExternalTexture(false) { init(usemipmaps); setSize(0, 0, 0); @@ -475,8 +479,8 @@ LLImageGL::LLImageGL(BOOL usemipmaps) sCount++; } -LLImageGL::LLImageGL(U32 width, U32 height, U8 components, BOOL usemipmaps) -: mSaveData(0), mExternalTexture(FALSE) +LLImageGL::LLImageGL(U32 width, U32 height, U8 components, bool usemipmaps) +: mSaveData(0), mExternalTexture(false) { llassert( components <= 4 ); init(usemipmaps); @@ -485,8 +489,8 @@ LLImageGL::LLImageGL(U32 width, U32 height, U8 components, BOOL usemipmaps) sCount++; } -LLImageGL::LLImageGL(const LLImageRaw* imageraw, BOOL usemipmaps) -: mSaveData(0), mExternalTexture(FALSE) +LLImageGL::LLImageGL(const LLImageRaw* imageraw, bool usemipmaps) +: mSaveData(0), mExternalTexture(false) { init(usemipmaps); setSize(0, 0, 0); @@ -527,7 +531,7 @@ LLImageGL::~LLImageGL() } } -void LLImageGL::init(BOOL usemipmaps) +void LLImageGL::init(bool usemipmaps) { #if LL_IMAGEGL_THREAD_CHECK mActiveThread = LLThread::currentID(); @@ -544,14 +548,14 @@ void LLImageGL::init(BOOL usemipmaps) mPickMaskWidth = 0; mPickMaskHeight = 0; mUseMipMaps = usemipmaps; - mHasExplicitFormat = FALSE; + mHasExplicitFormat = false; - mIsMask = FALSE; - mNeedsAlphaAndPickMask = TRUE ; + mIsMask = false; + mNeedsAlphaAndPickMask = true ; mAlphaStride = 0 ; mAlphaOffset = 0 ; - mGLTextureCreated = FALSE ; + mGLTextureCreated = false ; mTexName = 0; mWidth = 0; mHeight = 0; @@ -580,10 +584,10 @@ void LLImageGL::init(BOOL usemipmaps) mFormatInternal = -1; mFormatPrimary = (LLGLenum) 0; mFormatType = GL_UNSIGNED_BYTE; - mFormatSwapBytes = FALSE; + mFormatSwapBytes = false; #ifdef DEBUG_MISS - mMissed = FALSE; + mMissed = false; #endif mCategory = -1; @@ -701,12 +705,12 @@ void LLImageGL::forceUpdateBindStats(void) const mLastBindTime = sLastFrameTime; } -BOOL LLImageGL::updateBindStats() const +bool LLImageGL::updateBindStats() const { if (mTexName != 0) { #ifdef DEBUG_MISS - mMissed = ! getIsResident(TRUE); + mMissed = ! getIsResident(true); #endif sBindCount++; if (mLastBindTime != sLastFrameTime) @@ -715,10 +719,10 @@ BOOL LLImageGL::updateBindStats() const sUniqueCount++; mLastBindTime = sLastFrameTime; - return TRUE ; + return true ; } } - return FALSE ; + return false ; } F32 LLImageGL::getTimePassedSinceLastBound() @@ -726,11 +730,11 @@ F32 LLImageGL::getTimePassedSinceLastBound() return sLastFrameTime - mLastBindTime ; } -void LLImageGL::setExplicitFormat( LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, BOOL swap_bytes ) +void LLImageGL::setExplicitFormat( LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, bool swap_bytes ) { // Note: must be called before createTexture() // Note: it's up to the caller to ensure that the format matches the number of components. - mHasExplicitFormat = TRUE; + mHasExplicitFormat = true; mFormatInternal = internal_format; mFormatPrimary = primary_format; if(type_format == 0) @@ -751,10 +755,10 @@ void LLImageGL::setImage(const LLImageRaw* imageraw) (imageraw->getHeight() == getHeight(mCurrentDiscardLevel)) && (imageraw->getComponents() == getComponents())); const U8* rawdata = imageraw->getData(); - setImage(rawdata, FALSE); + setImage(rawdata, false); } -BOOL LLImageGL::setImage(const U8* data_in, BOOL data_hasmips /* = FALSE */, S32 usename /* = 0 */) +bool LLImageGL::setImage(const U8* data_in, bool data_hasmips /* = false */, S32 usename /* = 0 */) { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; @@ -946,7 +950,7 @@ BOOL LLImageGL::setImage(const U8* data_in, BOOL data_hasmips /* = FALSE */, S32 } mGLTextureCreated = false; - return FALSE; + return false; } else { @@ -1055,10 +1059,10 @@ BOOL LLImageGL::setImage(const U8* data_in, BOOL data_hasmips /* = FALSE */, S32 } stop_glerror(); mGLTextureCreated = true; - return TRUE; + return true; } -BOOL LLImageGL::preAddToAtlas(S32 discard_level, const LLImageRaw* raw_image) +bool LLImageGL::preAddToAtlas(S32 discard_level, const LLImageRaw* raw_image) { //not compatible with core GL profile llassert(!LLRender::sGLCoreProfile); @@ -1066,7 +1070,7 @@ BOOL LLImageGL::preAddToAtlas(S32 discard_level, const LLImageRaw* raw_image) if (gGLManager.mIsDisabled) { LL_WARNS() << "Trying to create a texture while GL is disabled!" << LL_ENDL; - return FALSE; + return false; } llassert(gGLManager.mInited); stop_glerror(); @@ -1085,7 +1089,7 @@ BOOL LLImageGL::preAddToAtlas(S32 discard_level, const LLImageRaw* raw_image) if (!setSize(w, h, raw_image->getComponents(), discard_level)) { LL_WARNS() << "Trying to create a texture with incorrect dimensions!" << LL_ENDL; - return FALSE; + return false; } if (!mHasExplicitFormat) @@ -1140,7 +1144,7 @@ BOOL LLImageGL::preAddToAtlas(S32 discard_level, const LLImageRaw* raw_image) } #endif - return TRUE ; + return true ; } void LLImageGL::postAddToAtlas() @@ -1214,31 +1218,31 @@ void sub_image_lines(U32 target, S32 miplevel, S32 x_offset, S32 y_offset, S32 w } } -BOOL LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height, BOOL force_fast_update /* = FALSE */, LLGLuint use_name) +bool LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height, bool force_fast_update /* = false */, LLGLuint use_name) { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; if (!width || !height) { - return TRUE; + return true; } LLGLuint tex_name = use_name != 0 ? use_name : mTexName; if (0 == tex_name) { // *TODO: Re-enable warning? Ran into thread locking issues? DK 2011-02-18 //LL_WARNS() << "Setting subimage on image without GL texture" << LL_ENDL; - return FALSE; + return false; } if (datap == NULL) { // *TODO: Re-enable warning? Ran into thread locking issues? DK 2011-02-18 //LL_WARNS() << "Setting subimage on image with NULL datap" << LL_ENDL; - return FALSE; + return false; } // HACK: allow the caller to explicitly force the fast path (i.e. using glTexSubImage2D here instead of calling setImage) even when updating the full texture. if (!force_fast_update && x_pos == 0 && y_pos == 0 && width == getWidth() && height == getHeight() && data_width == width && data_height == height) { - setImage(datap, FALSE, tex_name); + setImage(datap, false, tex_name); } else { @@ -1292,7 +1296,7 @@ BOOL LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S3 const U8* sub_datap = datap + (y_pos * data_width + x_pos) * getComponents(); // Update the GL texture - BOOL res = gGL.getTexUnit(0)->bindManual(mBindTarget, tex_name); + bool res = gGL.getTexUnit(0)->bindManual(mBindTarget, tex_name); if (!res) LL_ERRS() << "LLImageGL::setSubImage(): bindTexture failed" << LL_ENDL; stop_glerror(); @@ -1324,28 +1328,28 @@ BOOL LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S3 stop_glerror(); mGLTextureCreated = true; } - return TRUE; + return true; } -BOOL LLImageGL::setSubImage(const LLImageRaw* imageraw, S32 x_pos, S32 y_pos, S32 width, S32 height, BOOL force_fast_update /* = FALSE */, LLGLuint use_name) +bool LLImageGL::setSubImage(const LLImageRaw* imageraw, S32 x_pos, S32 y_pos, S32 width, S32 height, bool force_fast_update /* = false */, LLGLuint use_name) { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; return setSubImage(imageraw->getData(), imageraw->getWidth(), imageraw->getHeight(), x_pos, y_pos, width, height, force_fast_update, use_name); } // Copy sub image from frame buffer -BOOL LLImageGL::setSubImageFromFrameBuffer(S32 fb_x, S32 fb_y, S32 x_pos, S32 y_pos, S32 width, S32 height) +bool LLImageGL::setSubImageFromFrameBuffer(S32 fb_x, S32 fb_y, S32 x_pos, S32 y_pos, S32 width, S32 height) { if (gGL.getTexUnit(0)->bind(this, false, true)) { glCopyTexSubImage2D(GL_TEXTURE_2D, 0, fb_x, fb_y, x_pos, y_pos, width, height); mGLTextureCreated = true; stop_glerror(); - return TRUE; + return true; } else { - return FALSE; + return false; } } @@ -1365,7 +1369,7 @@ void LLImageGL::generateTextures(S32 numTextures, U32 *textures) name_count = pool_size; } - if (numTextures <= name_count) + if ((U32)numTextures <= name_count) { //copy teture names off the end of the pool memcpy(textures, name_pool + name_count - numTextures, sizeof(U32) * numTextures); @@ -1584,7 +1588,7 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt //create an empty GL texture: just create a texture name //the texture is assiciate with some image by calling glTexImage outside LLImageGL -BOOL LLImageGL::createGLTexture() +bool LLImageGL::createGLTexture() { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; checkActiveThread(); @@ -1592,7 +1596,7 @@ BOOL LLImageGL::createGLTexture() if (gGLManager.mIsDisabled) { LL_WARNS() << "Trying to create a texture while GL is disabled!" << LL_ENDL; - return FALSE; + return false; } mGLTextureCreated = false ; //do not save this texture when gl is destroyed. @@ -1612,13 +1616,13 @@ BOOL LLImageGL::createGLTexture() if (!mTexName) { LL_WARNS() << "LLImageGL::createGLTexture failed to make an empty texture" << LL_ENDL; - return FALSE; + return false; } - return TRUE ; + return true ; } -BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename/*=0*/, BOOL to_create, S32 category, bool defer_copy, LLGLuint* tex_name) +bool LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename/*=0*/, bool to_create, S32 category, bool defer_copy, LLGLuint* tex_name) { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; checkActiveThread(); @@ -1626,7 +1630,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S if (gGLManager.mIsDisabled) { LL_WARNS() << "Trying to create a texture while GL is disabled!" << LL_ENDL; - return FALSE; + return false; } llassert(gGLManager.mInited); @@ -1636,7 +1640,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S { LL_WARNS() << "Trying to create a texture from invalid image data" << LL_ENDL; mGLTextureCreated = false; - return FALSE; + return false; } if (discard_level < 0) @@ -1657,7 +1661,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S { LL_WARNS() << "Trying to create a texture with incorrect dimensions!" << LL_ENDL; mGLTextureCreated = false; - return FALSE; + return false; } if (mHasExplicitFormat && @@ -1666,7 +1670,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S { LL_WARNS() << "Incorrect format: " << std::hex << mFormatPrimary << " components: " << (U32)mComponents << LL_ENDL; - mHasExplicitFormat = FALSE; + mHasExplicitFormat = false; } if( !mHasExplicitFormat ) @@ -1716,15 +1720,15 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S mCurrentDiscardLevel = discard_level; mLastBindTime = sLastFrameTime; mGLTextureCreated = false; - return TRUE ; + return true ; } setCategory(category); const U8* rawdata = imageraw->getData(); - return createGLTexture(discard_level, rawdata, FALSE, usename, defer_copy, tex_name); + return createGLTexture(discard_level, rawdata, false, usename, defer_copy, tex_name); } -BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_hasmips, S32 usename, bool defer_copy, LLGLuint* tex_name) +bool LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, bool data_hasmips, S32 usename, bool defer_copy, LLGLuint* tex_name) // Call with void data, vmem is allocated but unitialized { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; @@ -1797,7 +1801,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_ LL_PROFILE_ZONE_NAMED("cglt - late setImage"); if (!setImage(data_in, data_hasmips, new_texname)) { - return FALSE; + return false; } } @@ -1835,7 +1839,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_ mLastBindTime = sLastFrameTime; checkActiveThread(); - return TRUE; + return true; } void LLImageGL::syncToMainThread(LLGLuint new_tex_name) @@ -1905,7 +1909,7 @@ void LLImageGL::syncTexName(LLGLuint texname) } } -BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compressed_ok) const +bool LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compressed_ok) const { llassert_always(sAllowReadBackRaw) ; //LL_ERRS() << "should not call this function!" << LL_ENDL ; @@ -1917,7 +1921,7 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre if (mTexName == 0 || discard_level < mCurrentDiscardLevel || discard_level > mMaxDiscardLevel ) { - return FALSE; + return false; } S32 gl_discard = discard_level - mCurrentDiscardLevel; @@ -1934,7 +1938,7 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre if (glwidth == 0) { // No mip data smaller than current discard level - return FALSE; + return false; } S32 width = getWidth(discard_level); @@ -1942,14 +1946,14 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre S32 ncomponents = getComponents(); if (ncomponents == 0) { - return FALSE; + return false; } if(width < glwidth) { LL_WARNS() << "texture size is smaller than it should be." << LL_ENDL ; LL_WARNS() << "width: " << width << " glwidth: " << glwidth << " mWidth: " << mWidth << " mCurrentDiscardLevel: " << (S32)mCurrentDiscardLevel << " discard_level: " << (S32)discard_level << LL_ENDL ; - return FALSE ; + return false ; } if (width <= 0 || width > 2048 || height <= 0 || height > 2048 || ncomponents < 1 || ncomponents > 4) @@ -1971,6 +1975,8 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre } //----------------------------------------------------------------------------------------------- + LLImageDataLock lock(imageraw); + #if GL_VERSION_1_3 if (is_compressed) { @@ -1980,7 +1986,7 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre { LL_WARNS() << "Memory allocation failed for reading back texture. Size is: " << glbytes << LL_ENDL ; LL_WARNS() << "width: " << width << "height: " << height << "components: " << ncomponents << LL_ENDL ; - return FALSE ; + return false ; } glGetCompressedTexImage(mTarget, gl_discard, (GLvoid*)(imageraw->getData())); @@ -1992,7 +1998,7 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre { LL_WARNS() << "Memory allocation failed for reading back texture." << LL_ENDL ; LL_WARNS() << "width: " << width << "height: " << height << "components: " << ncomponents << LL_ENDL ; - return FALSE ; + return false ; } glGetTexImage(GL_TEXTURE_2D, gl_discard, mFormatPrimary, mFormatType, (GLvoid*)(imageraw->getData())); @@ -2011,11 +2017,11 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre LL_WARNS() << "GL Error happens after reading back texture. Error code: " << error << LL_ENDL ; } - return FALSE ; + return false ; } //----------------------------------------------------------------------------------------------- - return TRUE ; + return true ; } void LLImageGL::destroyGLTexture() @@ -2032,7 +2038,7 @@ void LLImageGL::destroyGLTexture() LLImageGL::deleteTextures(1, &mTexName); mCurrentDiscardLevel = -1 ; //invalidate mCurrentDiscardLevel. mTexName = 0; - mGLTextureCreated = FALSE ; + mGLTextureCreated = false ; } } @@ -2083,7 +2089,7 @@ void LLImageGL::setFilteringOption(LLTexUnit::eTextureFilterOptions option) } } -BOOL LLImageGL::getIsResident(BOOL test_now) +bool LLImageGL::getIsResident(bool test_now) { if (test_now) { @@ -2095,7 +2101,7 @@ BOOL LLImageGL::getIsResident(BOOL test_now) else #endif { - mIsResident = FALSE; + mIsResident = false; } } @@ -2158,17 +2164,17 @@ S64 LLImageGL::getMipBytes(S32 discard_level) const return res; } -BOOL LLImageGL::isJustBound() const +bool LLImageGL::isJustBound() const { - return (BOOL)(sLastFrameTime - mLastBindTime < 0.5f); + return sLastFrameTime - mLastBindTime < 0.5f; } -BOOL LLImageGL::getBoundRecently() const +bool LLImageGL::getBoundRecently() const { - return (BOOL)(sLastFrameTime - mLastBindTime < MIN_TEXTURE_LIFETIME); + return (bool)(sLastFrameTime - mLastBindTime < MIN_TEXTURE_LIFETIME); } -BOOL LLImageGL::getIsAlphaMask() const +bool LLImageGL::getIsAlphaMask() const { llassert_always(!sSkipAnalyzeAlpha); return mIsMask; @@ -2181,7 +2187,7 @@ void LLImageGL::setTarget(const LLGLenum target, const LLTexUnit::eTextureType b } const S8 INVALID_OFFSET = -99 ; -void LLImageGL::setNeedsAlphaAndPickMask(BOOL need_mask) +void LLImageGL::setNeedsAlphaAndPickMask(bool need_mask) { if(mNeedsAlphaAndPickMask != need_mask) { @@ -2194,7 +2200,7 @@ void LLImageGL::setNeedsAlphaAndPickMask(BOOL need_mask) else //do not need alpha mask { mAlphaOffset = INVALID_OFFSET ; - mIsMask = FALSE; + mIsMask = false; } } } @@ -2219,8 +2225,8 @@ void LLImageGL::calcAlphaChannelOffsetAndStride() case GL_RED: case GL_RGB: case GL_SRGB: - mNeedsAlphaAndPickMask = FALSE; - mIsMask = FALSE; + mNeedsAlphaAndPickMask = false; + mIsMask = false; return; //no alpha channel. case GL_RGBA: #if GL_VERSION_2_1 @@ -2277,8 +2283,8 @@ void LLImageGL::calcAlphaChannelOffsetAndStride() { LL_WARNS() << "Cannot analyze alpha for image with format type " << std::hex << mFormatType << std::dec << LL_ENDL; - mNeedsAlphaAndPickMask = FALSE ; - mIsMask = FALSE; + mNeedsAlphaAndPickMask = false ; + mIsMask = false; } } @@ -2375,11 +2381,11 @@ void LLImageGL::analyzeAlpha(const void* data_in, U32 w, U32 h) (lowerhalftotal == length && alphatotal != 0) || // all close to transparent but not all totally transparent, or (upperhalftotal == length && alphatotal != 255*length)) // all close to opaque but not all totally opaque { - mIsMask = FALSE; // not suitable for masking + mIsMask = false; // not suitable for masking } else { - mIsMask = TRUE; + mIsMask = true; } } @@ -2485,9 +2491,9 @@ void LLImageGL::updatePickMask(S32 width, S32 height, const U8* data_in) } } -BOOL LLImageGL::getMask(const LLVector2 &tc) +bool LLImageGL::getMask(const LLVector2 &tc) { - BOOL res = TRUE; + bool res = true; if (mPickMask) { @@ -2531,13 +2537,13 @@ BOOL LLImageGL::getMask(const LLVector2 &tc) S32 idx = y*mPickMaskWidth+x; S32 offset = idx%8; - res = mPickMask[idx/8] & (1 << offset) ? TRUE : FALSE; + res = (mPickMask[idx/8] & (1 << offset)) != 0; } return res; } -void LLImageGL::setCurTexSizebar(S32 index, BOOL set_pick_size) +void LLImageGL::setCurTexSizebar(S32 index, bool set_pick_size) { sCurTexSizeBar = index ; diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h index 89e35d2226..5c7a5ce821 100644 --- a/indra/llrender/llimagegl.h +++ b/indra/llrender/llimagegl.h @@ -47,6 +47,14 @@ class LLWindow; #define BYTES_TO_MEGA_BYTES(x) ((x) >> 20) #define MEGA_BYTES_TO_BYTES(x) ((x) << 20) +namespace LLImageGLMemory +{ + void alloc_tex_image(U32 width, U32 height, U32 pixformat); + void free_tex_image(U32 texName); + void free_tex_images(U32 count, const U32* texNames); + void free_cur_tex_image(); +} + //============================================================================ class LLImageGL : public LLRefCount { @@ -68,7 +76,7 @@ public: static S64 dataFormatBytes(S32 dataformat, S32 width, S32 height); static S32 dataFormatComponents(S32 dataformat); - BOOL updateBindStats() const ; + bool updateBindStats() const ; F32 getTimePassedSinceLastBound(); void forceUpdateBindStats(void) const; @@ -76,7 +84,7 @@ public: static void updateStats(F32 current_time); // Save off / restore GL textures - static void destroyGL(BOOL save_state = TRUE); + static void destroyGL(bool save_state = true); static void restoreGL(); static void dirtyTexOptions(); @@ -85,14 +93,14 @@ public: //for server side use only. // Not currently necessary for LLImageGL, but required in some derived classes, // so include for compatability - static BOOL create(LLPointer<LLImageGL>& dest, BOOL usemipmaps = TRUE); - static BOOL create(LLPointer<LLImageGL>& dest, U32 width, U32 height, U8 components, BOOL usemipmaps = TRUE); - static BOOL create(LLPointer<LLImageGL>& dest, const LLImageRaw* imageraw, BOOL usemipmaps = TRUE); + static bool create(LLPointer<LLImageGL>& dest, bool usemipmaps = true); + static bool create(LLPointer<LLImageGL>& dest, U32 width, U32 height, U8 components, bool usemipmaps = true); + static bool create(LLPointer<LLImageGL>& dest, const LLImageRaw* imageraw, bool usemipmaps = true); public: - LLImageGL(BOOL usemipmaps = TRUE); - LLImageGL(U32 width, U32 height, U8 components, BOOL usemipmaps = TRUE); - LLImageGL(const LLImageRaw* imageraw, BOOL usemipmaps = TRUE); + LLImageGL(bool usemipmaps = true); + LLImageGL(U32 width, U32 height, U8 components, bool usemipmaps = true); + LLImageGL(const LLImageRaw* imageraw, bool usemipmaps = true); // For wrapping textures created via GL elsewhere with our API only. Use with caution. LLImageGL(LLGLuint mTexName, U32 components, LLGLenum target, LLGLint formatInternal, LLGLenum formatPrimary, LLGLenum formatType, LLTexUnit::eTextureAddressMode addressMode); @@ -112,29 +120,29 @@ public: static void setManualImage(U32 target, S32 miplevel, S32 intformat, S32 width, S32 height, U32 pixformat, U32 pixtype, const void *pixels, bool allow_compression = true); - BOOL createGLTexture() ; - BOOL createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename = 0, BOOL to_create = TRUE, + bool createGLTexture() ; + bool createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename = 0, bool to_create = true, S32 category = sMaxCategories-1, bool defer_copy = false, LLGLuint* tex_name = nullptr); - BOOL createGLTexture(S32 discard_level, const U8* data, BOOL data_hasmips = FALSE, S32 usename = 0, bool defer_copy = false, LLGLuint* tex_name = nullptr); + bool createGLTexture(S32 discard_level, const U8* data, bool data_hasmips = false, S32 usename = 0, bool defer_copy = false, LLGLuint* tex_name = nullptr); void setImage(const LLImageRaw* imageraw); - BOOL setImage(const U8* data_in, BOOL data_hasmips = FALSE, S32 usename = 0); + bool setImage(const U8* data_in, bool data_hasmips = false, S32 usename = 0); // *TODO: This function may not work if the textures is compressed (i.e. // RenderCompressTextures is 0). Partial image updates do not work on // compressed textures. - BOOL setSubImage(const LLImageRaw* imageraw, S32 x_pos, S32 y_pos, S32 width, S32 height, BOOL force_fast_update = FALSE, LLGLuint use_name = 0); - BOOL setSubImage(const U8* datap, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height, BOOL force_fast_update = FALSE, LLGLuint use_name = 0); - BOOL setSubImageFromFrameBuffer(S32 fb_x, S32 fb_y, S32 x_pos, S32 y_pos, S32 width, S32 height); + bool setSubImage(const LLImageRaw* imageraw, S32 x_pos, S32 y_pos, S32 width, S32 height, bool force_fast_update = false, LLGLuint use_name = 0); + bool setSubImage(const U8* datap, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height, bool force_fast_update = false, LLGLuint use_name = 0); + bool setSubImageFromFrameBuffer(S32 fb_x, S32 fb_y, S32 x_pos, S32 y_pos, S32 width, S32 height); // wait for gl commands to finish on current thread and push // a lambda to main thread to swap mNewTexName and mTexName void syncToMainThread(LLGLuint new_tex_name); // Read back a raw image for this discard level, if it exists - BOOL readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compressed_ok) const; + bool readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compressed_ok) const; void destroyGLTexture(); void forceToInvalidateGLTexture(); - void setExplicitFormat(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format = 0, BOOL swap_bytes = FALSE); + void setExplicitFormat(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format = 0, bool swap_bytes = false); void setComponents(S8 ncomponents) { mComponents = ncomponents; } S32 getDiscardLevel() const { return mCurrentDiscardLevel; } @@ -147,18 +155,18 @@ public: U8 getComponents() const { return mComponents; } S64 getBytes(S32 discard_level = -1) const; S64 getMipBytes(S32 discard_level = -1) const; - BOOL getBoundRecently() const; - BOOL isJustBound() const; - BOOL getHasExplicitFormat() const { return mHasExplicitFormat; } + bool getBoundRecently() const; + bool isJustBound() const; + bool getHasExplicitFormat() const { return mHasExplicitFormat; } LLGLenum getPrimaryFormat() const { return mFormatPrimary; } LLGLenum getFormatType() const { return mFormatType; } - BOOL getHasGLTexture() const { return mTexName != 0; } + bool getHasGLTexture() const { return mTexName != 0; } LLGLuint getTexName() const { return mTexName; } - BOOL getIsAlphaMask() const; + bool getIsAlphaMask() const; - BOOL getIsResident(BOOL test_now = FALSE); // not const + bool getIsResident(bool test_now = false); // not const void setTarget(const LLGLenum target, const LLTexUnit::eTextureType bind_target); @@ -166,11 +174,11 @@ public: bool isGLTextureCreated(void) const { return mGLTextureCreated ; } void setGLTextureCreated (bool initialized) { mGLTextureCreated = initialized; } - BOOL getUseMipMaps() const { return mUseMipMaps; } - void setUseMipMaps(BOOL usemips) { mUseMipMaps = usemips; } - void setHasMipMaps(BOOL hasmips) { mHasMipMaps = hasmips; } + bool getUseMipMaps() const { return mUseMipMaps; } + void setUseMipMaps(bool usemips) { mUseMipMaps = usemips; } + void setHasMipMaps(bool hasmips) { mHasMipMaps = hasmips; } void updatePickMask(S32 width, S32 height, const U8* data_in); - BOOL getMask(const LLVector2 &tc); + bool getMask(const LLVector2 &tc); void checkTexSize(bool forced = false) const ; @@ -192,12 +200,12 @@ public: U32 getTexelsInGLTexture()const {return mTexelsInGLTexture;} - void init(BOOL usemipmaps); + void init(bool usemipmaps); virtual void cleanup(); // Clean up the LLImageGL so it can be reinitialized. Be careful when using this in derived class destructors - void setNeedsAlphaAndPickMask(BOOL need_mask); + void setNeedsAlphaAndPickMask(bool need_mask); - BOOL preAddToAtlas(S32 discard_level, const LLImageRaw* raw_image); + bool preAddToAtlas(S32 discard_level, const LLImageRaw* raw_image); void postAddToAtlas() ; #if LL_IMAGEGL_THREAD_CHECK @@ -222,11 +230,11 @@ private: U16 mPickMaskWidth; U16 mPickMaskHeight; S8 mUseMipMaps; - BOOL mHasExplicitFormat; // If false (default), GL format is f(mComponents) + bool mHasExplicitFormat; // If false (default), GL format is f(mComponents) bool mAutoGenMips = false; - BOOL mIsMask; - BOOL mNeedsAlphaAndPickMask; + bool mIsMask; + bool mNeedsAlphaAndPickMask; S8 mAlphaStride ; S8 mAlphaOffset ; @@ -261,9 +269,9 @@ protected: LLGLint mFormatInternal; // = GL internalformat LLGLenum mFormatPrimary; // = GL format (pixel data format) LLGLenum mFormatType; - BOOL mFormatSwapBytes;// if true, use glPixelStorei(GL_UNPACK_SWAP_BYTES, 1) + bool mFormatSwapBytes;// if true, use glPixelStorei(GL_UNPACK_SWAP_BYTES, 1) - BOOL mExternalTexture; + bool mExternalTexture; // STATICS public: @@ -275,28 +283,28 @@ public: // Global memory statistics static U32 sBindCount; // Tracks number of texture binds for current frame static U32 sUniqueCount; // Tracks number of unique texture binds for current frame - static BOOL sGlobalUseAnisotropic; + static bool sGlobalUseAnisotropic; static LLImageGL* sDefaultGLTexture ; - static BOOL sAutomatedTest; + static bool sAutomatedTest; static bool sCompressTextures; //use GL texture compression #if DEBUG_MISS - BOOL mMissed; // Missed on last bind? - BOOL getMissed() const { return mMissed; }; + bool mMissed; // Missed on last bind? + bool getMissed() const { return mMissed; }; #else - BOOL getMissed() const { return FALSE; }; + bool getMissed() const { return false; }; #endif public: - static void initClass(LLWindow* window, S32 num_catagories, BOOL skip_analyze_alpha = false, bool thread_texture_loads = false, bool thread_media_updates = false); + static void initClass(LLWindow* window, S32 num_catagories, bool skip_analyze_alpha = false, bool thread_texture_loads = false, bool thread_media_updates = false); static void cleanupClass() ; private: static S32 sMaxCategories; - static BOOL sSkipAnalyzeAlpha; + static bool sSkipAnalyzeAlpha; //the flag to allow to call readBackRaw(...). //can be removed if we do not use that function at all. - static BOOL sAllowReadBackRaw ; + static bool sAllowReadBackRaw ; // //**************************************************************************************************** //The below for texture auditing use only @@ -317,7 +325,7 @@ public: static S32 sCurTexSizeBar ; static S32 sCurTexPickSize ; - static void setCurTexSizebar(S32 index, BOOL set_pick_size = TRUE) ; + static void setCurTexSizebar(S32 index, bool set_pick_size = true) ; static void resetCurTexSizebar(); //**************************************************************************************************** diff --git a/indra/llrender/llpostprocess.cpp b/indra/llrender/llpostprocess.cpp index aa092e5215..29ec1408d5 100644 --- a/indra/llrender/llpostprocess.cpp +++ b/indra/llrender/llpostprocess.cpp @@ -165,7 +165,7 @@ void LLPostProcess::invalidate() mSceneRenderTexture = NULL ; mNoiseTexture = NULL ; mTempBloomTexture = NULL ; - initialized = FALSE ; + initialized = false ; } void LLPostProcess::apply(unsigned int width, unsigned int height) @@ -373,7 +373,7 @@ void LLPostProcess::createTexture(LLPointer<LLImageGL>& texture, unsigned int wi { std::vector<GLubyte> data(width * height * 4, 0) ; - texture = new LLImageGL(FALSE) ; + texture = new LLImageGL(false) ; if(texture->createGLTexture()) { gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, texture->getTexName()); @@ -395,7 +395,7 @@ void LLPostProcess::createNoiseTexture(LLPointer<LLImageGL>& texture) } } - texture = new LLImageGL(FALSE) ; + texture = new LLImageGL(false) ; if(texture->createGLTexture()) { gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, texture->getTexName()); diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 0a522c88d7..1037fbbfe3 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -1008,6 +1008,9 @@ void LLRender::syncLightState() void LLRender::syncMatrices() { + STOP_GLERROR; + LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY; + static const U32 name[] = { LLShaderMgr::MODELVIEW_MATRIX, @@ -1030,8 +1033,6 @@ void LLRender::syncMatrices() if (shader) { - //llassert(shader); - bool mvp_done = false; U32 i = MM_MODELVIEW; @@ -1105,7 +1106,7 @@ void LLRender::syncMatrices() if (shader->getUniformLocation(LLShaderMgr::INVERSE_PROJECTION_MATRIX)) { glh::matrix4f inv_proj = mat.inverse(); - shader->uniformMatrix4fv(LLShaderMgr::INVERSE_PROJECTION_MATRIX, 1, FALSE, inv_proj.m); + shader->uniformMatrix4fv(LLShaderMgr::INVERSE_PROJECTION_MATRIX, 1, false, inv_proj.m); } // Used by some full screen effects - such as full screen lights, glow, etc. @@ -1152,6 +1153,7 @@ void LLRender::syncMatrices() syncLightState(); } } + STOP_GLERROR; } void LLRender::translatef(const GLfloat& x, const GLfloat& y, const GLfloat& z) @@ -1602,6 +1604,7 @@ void LLRender::end() } void LLRender::flush() { + STOP_GLERROR; if (mCount > 0) { LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index 1eace546a2..5852201c94 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -555,6 +555,5 @@ glh::matrix4f gl_perspective(GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloa glh::matrix4f gl_lookat(LLVector3 eye, LLVector3 center, LLVector3 up); #define LL_SHADER_LOADING_WARNS(...) LL_WARNS() -#define LL_SHADER_UNIFORM_ERRS(...) LL_ERRS("Shader") #endif diff --git a/indra/llrender/llrender2dutils.cpp b/indra/llrender/llrender2dutils.cpp index c04b571798..97e9875afb 100644 --- a/indra/llrender/llrender2dutils.cpp +++ b/indra/llrender/llrender2dutils.cpp @@ -51,11 +51,11 @@ const LLColor4 UI_VERTEX_COLOR(1.f, 1.f, 1.f, 1.f); // Functions // -BOOL ui_point_in_rect(S32 x, S32 y, S32 left, S32 top, S32 right, S32 bottom) +bool ui_point_in_rect(S32 x, S32 y, S32 left, S32 top, S32 right, S32 bottom) { - if (x < left || right < x) return FALSE; - if (y < bottom || top < y) return FALSE; - return TRUE; + if (x < left || right < x) return false; + if (y < bottom || top < y) return false; + return true; } @@ -91,13 +91,13 @@ void gl_draw_x(const LLRect& rect, const LLColor4& color) } -void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, S32 pixel_offset, BOOL filled) +void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, S32 pixel_offset, bool filled) { gGL.color4fv(color.mV); gl_rect_2d_offset_local(left, top, right, bottom, pixel_offset, filled); } -void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixel_offset, BOOL filled) +void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixel_offset, bool filled) { gGL.pushUIMatrix(); left += LLFontGL::sCurOrigin.mX; @@ -115,7 +115,7 @@ void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixe } -void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, BOOL filled ) +void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, bool filled ) { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); @@ -147,14 +147,14 @@ void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, BOOL filled ) } } -void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, BOOL filled ) +void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, bool filled ) { gGL.color4fv( color.mV ); gl_rect_2d( left, top, right, bottom, filled ); } -void gl_rect_2d( const LLRect& rect, const LLColor4& color, BOOL filled ) +void gl_rect_2d( const LLRect& rect, const LLColor4& color, bool filled ) { gGL.color4fv( color.mV ); gl_rect_2d( rect.mLeft, rect.mTop, rect.mRight, rect.mBottom, filled ); @@ -269,7 +269,7 @@ void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2, const LLColor4 &color ) gGL.end(); } -void gl_triangle_2d(S32 x1, S32 y1, S32 x2, S32 y2, S32 x3, S32 y3, const LLColor4& color, BOOL filled) +void gl_triangle_2d(S32 x1, S32 y1, S32 x2, S32 y2, S32 x3, S32 y3, const LLColor4& color, bool filled) { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); @@ -348,7 +348,7 @@ void gl_draw_scaled_image(S32 x, S32 y, S32 width, S32 height, LLTexture* image, gl_draw_scaled_rotated_image( x, y, width, height, 0.f, image, color, uv_rect ); } -void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLTexture* image, const LLColor4& color, BOOL solid_color, const LLRectf& uv_rect, bool scale_inner) +void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLTexture* image, const LLColor4& color, bool solid_color, const LLRectf& uv_rect, bool scale_inner) { if (NULL == image) { @@ -364,7 +364,7 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border gl_draw_scaled_image_with_border(x, y, width, height, image, color, solid_color, uv_rect, scale_rect, scale_inner); } -void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color, BOOL solid_color, const LLRectf& uv_outer_rect, const LLRectf& center_rect, bool scale_inner) +void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color, bool solid_color, const LLRectf& uv_outer_rect, const LLRectf& center_rect, bool scale_inner) { stop_glerror(); @@ -841,7 +841,7 @@ void gl_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& c LLRender2D::getInstance()->setLineWidth(1.f); } -void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F32 start_angle, F32 end_angle) +void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, bool filled, F32 start_angle, F32 end_angle) { if (end_angle < start_angle) { @@ -884,7 +884,7 @@ void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F gGL.popUIMatrix(); } -void gl_circle_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled) +void gl_circle_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, bool filled) { gGL.pushUIMatrix(); { @@ -945,7 +945,7 @@ void gl_deep_circle( F32 radius, F32 depth, S32 steps ) gGL.end(); } -void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor4& side_color, S32 steps, BOOL render_center ) +void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor4& side_color, S32 steps, bool render_center ) { gGL.pushUIMatrix(); { diff --git a/indra/llrender/llrender2dutils.h b/indra/llrender/llrender2dutils.h index c3c6d66b8e..0d3efc38d6 100644 --- a/indra/llrender/llrender2dutils.h +++ b/indra/llrender/llrender2dutils.h @@ -43,30 +43,30 @@ class LLUUID; extern const LLColor4 UI_VERTEX_COLOR; -BOOL ui_point_in_rect(S32 x, S32 y, S32 left, S32 top, S32 right, S32 bottom); +bool ui_point_in_rect(S32 x, S32 y, S32 left, S32 top, S32 right, S32 bottom); void gl_state_for_2d(S32 width, S32 height); void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2); void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2, const LLColor4 &color ); -void gl_triangle_2d(S32 x1, S32 y1, S32 x2, S32 y2, S32 x3, S32 y3, const LLColor4& color, BOOL filled); +void gl_triangle_2d(S32 x1, S32 y1, S32 x2, S32 y2, S32 x3, S32 y3, const LLColor4& color, bool filled); void gl_rect_2d_simple( S32 width, S32 height ); void gl_draw_x(const LLRect& rect, const LLColor4& color); -void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, BOOL filled = TRUE ); -void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, BOOL filled = TRUE ); -void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, S32 pixel_offset = 0, BOOL filled = TRUE ); -void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixel_offset = 0, BOOL filled = TRUE ); -void gl_rect_2d(const LLRect& rect, BOOL filled = TRUE ); -void gl_rect_2d(const LLRect& rect, const LLColor4& color, BOOL filled = TRUE ); +void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, bool filled = true ); +void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, bool filled = true ); +void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, S32 pixel_offset = 0, bool filled = true ); +void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixel_offset = 0, bool filled = true ); +void gl_rect_2d(const LLRect& rect, bool filled = true ); +void gl_rect_2d(const LLRect& rect, const LLColor4& color, bool filled = true ); void gl_rect_2d_checkerboard(const LLRect& rect, GLfloat alpha = 1.0f); void gl_drop_shadow(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &start_color, S32 lines); -void gl_circle_2d(F32 x, F32 y, F32 radius, S32 steps, BOOL filled); -void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F32 start_angle, F32 end_angle); +void gl_circle_2d(F32 x, F32 y, F32 radius, S32 steps, bool filled); +void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, bool filled, F32 start_angle, F32 end_angle); void gl_deep_circle( F32 radius, F32 depth ); -void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor4& side_color, S32 steps, BOOL render_center ); +void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor4& side_color, S32 steps, bool render_center ); void gl_corners_2d(S32 left, S32 top, S32 right, S32 bottom, S32 length, F32 max_frac); void gl_washer_2d(F32 outer_radius, F32 inner_radius, S32 steps, const LLColor4& inner_color, const LLColor4& outer_color); void gl_washer_segment_2d(F32 outer_radius, F32 inner_radius, F32 start_radians, F32 end_radians, S32 steps, const LLColor4& inner_color, const LLColor4& outer_color); @@ -76,8 +76,8 @@ void gl_draw_scaled_target(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* void gl_draw_scaled_image(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); void gl_draw_rotated_image(S32 x, S32 y, F32 degrees, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degrees, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), LLRenderTarget* target = NULL); -void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), bool scale_inner = true); -void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), const LLRectf& scale_rect = LLRectf(0.f, 1.f, 1.f, 0.f), bool scale_inner = true); +void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLTexture* image, const LLColor4 &color, bool solid_color = false, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), bool scale_inner = true); +void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4 &color, bool solid_color = false, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), const LLRectf& scale_rect = LLRectf(0.f, 1.f, 1.f, 0.f), bool scale_inner = true); void gl_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& color); @@ -110,12 +110,12 @@ void gl_segmented_rect_2d_tex(const S32 left, const S32 top, const S32 right, co void gl_segmented_rect_2d_fragment_tex(const LLRect& rect, const S32 texture_width, const S32 texture_height, const S32 border_size, const F32 start_fragment, const F32 end_fragment, const U32 edges = ROUNDED_RECT_ALL); void gl_segmented_rect_3d_tex(const LLRectf& clip_rect, const LLRectf& center_uv_rect, const LLRectf& center_draw_rect, const LLVector3& width_vec, const LLVector3& height_vec); -inline void gl_rect_2d( const LLRect& rect, BOOL filled ) +inline void gl_rect_2d( const LLRect& rect, bool filled ) { gl_rect_2d( rect.mLeft, rect.mTop, rect.mRight, rect.mBottom, filled ); } -inline void gl_rect_2d_offset_local( const LLRect& rect, S32 pixel_offset, BOOL filled) +inline void gl_rect_2d_offset_local( const LLRect& rect, S32 pixel_offset, bool filled) { gl_rect_2d_offset_local( rect.mLeft, rect.mTop, rect.mRight, rect.mBottom, pixel_offset, filled ); } diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index aa5bcd0864..dcc81a8874 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -1,25 +1,25 @@ -/** +/** * @file llrendertarget.cpp * @brief LLRenderTarget implementation * * $LicenseInfo:firstyear=2001&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$ */ @@ -44,7 +44,7 @@ void check_framebuffer_status() break; default: LL_WARNS() << "check_framebuffer_status failed -- " << std::hex << status << LL_ENDL; - ll_fail("check_framebuffer_status failed"); + ll_fail("check_framebuffer_status failed"); break; } } @@ -75,10 +75,10 @@ LLRenderTarget::~LLRenderTarget() } void LLRenderTarget::resize(U32 resx, U32 resy) -{ +{ //for accounting, get the number of pixels added/subtracted S32 pix_diff = (resx*resy)-(mResX*mResY); - + mResX = resx; mResY = resy; @@ -92,7 +92,7 @@ void LLRenderTarget::resize(U32 resx, U32 resy) } if (mDepth) - { + { gGL.getTexUnit(0)->bindManual(mUsage, mDepth); U32 internal_type = LLTexUnit::getInternalType(mUsage); LLImageGL::setManualImage(internal_type, 0, GL_DEPTH_COMPONENT24, mResX, mResY, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL, false); @@ -100,7 +100,7 @@ void LLRenderTarget::resize(U32 resx, U32 resy) sBytesAllocated += pix_diff*4; } } - + bool LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, LLTexUnit::eTextureType usage, LLTexUnit::eTextureMipGeneration generateMipMaps) { @@ -112,7 +112,7 @@ bool LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, LLT resy = llmin(resy, (U32) gGLManager.mGLMaxTextureSize); release(); - + mResX = resx; mResY = resy; @@ -125,7 +125,7 @@ bool LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, LLT // Calculate the number of mip levels based upon resolution that we should have. mMipLevels = 1 + floor(log10((float)llmax(mResX, mResY))/log10(2.0)); } - + if (depth) { if (!allocateDepth()) @@ -140,12 +140,12 @@ bool LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, LLT if (mDepth) { glBindFramebuffer(GL_FRAMEBUFFER, mFBO); - + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, LLTexUnit::getInternalType(mUsage), mDepth, 0); glBindFramebuffer(GL_FRAMEBUFFER, sCurFBO); } - + return addColorAttachment(color_fmt); } @@ -190,7 +190,7 @@ void LLRenderTarget::releaseColorAttachment() llassert(!isBoundInStack()); llassert(mTex.size() == 1); //cannot use releaseColorAttachment with LLRenderTarget managed color targets llassert(mFBO != 0); // mFBO must be valid - + glBindFramebuffer(GL_FRAMEBUFFER, mFBO); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, LLTexUnit::getInternalType(mUsage), 0, 0); glBindFramebuffer(GL_FRAMEBUFFER, sCurFBO); @@ -208,7 +208,7 @@ bool LLRenderTarget::addColorAttachment(U32 color_fmt) return true; } - U32 offset = mTex.size(); + U32 offset = static_cast<U32>(mTex.size()); if( offset >= 4 ) { @@ -238,12 +238,12 @@ bool LLRenderTarget::addColorAttachment(U32 color_fmt) return false; } } - + sBytesAllocated += mResX*mResY*4; stop_glerror(); - + if (offset == 0) { //use bilinear filtering on single texture render targets that aren't multisampled gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); @@ -266,15 +266,15 @@ bool LLRenderTarget::addColorAttachment(U32 color_fmt) gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); stop_glerror(); } - + if (mFBO) { glBindFramebuffer(GL_FRAMEBUFFER, mFBO); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+offset, LLTexUnit::getInternalType(mUsage), tex, 0); - + check_framebuffer_status(); - + glBindFramebuffer(GL_FRAMEBUFFER, sCurFBO); } @@ -286,8 +286,8 @@ bool LLRenderTarget::addColorAttachment(U32 color_fmt) bindTarget(); flush(); } - - + + return true; } @@ -296,7 +296,7 @@ bool LLRenderTarget::allocateDepth() LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY; LLImageGL::generateTextures(1, &mDepth); gGL.getTexUnit(0)->bindManual(mUsage, mDepth); - + U32 internal_type = LLTexUnit::getInternalType(mUsage); stop_glerror(); clear_glerror(); @@ -336,7 +336,7 @@ void LLRenderTarget::shareDepthBuffer(LLRenderTarget& target) if (mDepth) { glBindFramebuffer(GL_FRAMEBUFFER, target.mFBO); - + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, LLTexUnit::getInternalType(mUsage), mDepth, 0); check_framebuffer_status(); @@ -355,7 +355,7 @@ void LLRenderTarget::release() if (mDepth) { LLImageGL::deleteTextures(1, &mDepth); - + mDepth = 0; sBytesAllocated -= mResX*mResY*4; @@ -378,11 +378,11 @@ void LLRenderTarget::release() if (mFBO && (mTex.size() > 1)) { glBindFramebuffer(GL_FRAMEBUFFER, mFBO); - S32 z; + size_t z; for (z = mTex.size() - 1; z >= 1; z--) { sBytesAllocated -= mResX*mResY*4; - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+z, LLTexUnit::getInternalType(mUsage), 0, 0); + glFramebufferTexture2D(GL_FRAMEBUFFER, static_cast<GLenum>(GL_COLOR_ATTACHMENT0+z), LLTexUnit::getInternalType(mUsage), 0, 0); LLImageGL::deleteTextures(1, &mTex[z]); } glBindFramebuffer(GL_FRAMEBUFFER, sCurFBO); @@ -408,7 +408,7 @@ void LLRenderTarget::release() mTex.clear(); mInternalFormat.clear(); - + mResX = mResY = 0; } @@ -417,7 +417,7 @@ void LLRenderTarget::bindTarget() LL_PROFILE_GPU_ZONE("bindTarget"); llassert(mFBO); llassert(!isBoundInStack()); - + glBindFramebuffer(GL_FRAMEBUFFER, mFBO); sCurFBO = mFBO; @@ -426,8 +426,8 @@ void LLRenderTarget::bindTarget() GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3}; - glDrawBuffers(mTex.size(), drawbuffers); - + glDrawBuffers(static_cast<GLsizei>(mTex.size()), drawbuffers); + if (mTex.empty()) { //no color buffer to draw to GLenum drawbuffers[] = {GL_NONE}; @@ -453,7 +453,7 @@ void LLRenderTarget::clear(U32 mask_in) if (mUseDepth) { mask |= GL_DEPTH_BUFFER_BIT; - + } if (mFBO) { @@ -486,7 +486,7 @@ U32 LLRenderTarget::getTexture(U32 attachment) const U32 LLRenderTarget::getNumTextures() const { - return mTex.size(); + return static_cast<U32>(mTex.size()); } void LLRenderTarget::bindTexture(U32 index, S32 channel, LLTexUnit::eTextureFilterOptions filter_options) @@ -548,7 +548,7 @@ void LLRenderTarget::flush() bool LLRenderTarget::isComplete() const { - return (!mTex.empty() || mDepth) ? true : false; + return !mTex.empty() || mDepth; } void LLRenderTarget::getViewport(S32* viewport) @@ -563,7 +563,7 @@ bool LLRenderTarget::isBoundInStack() const { LLRenderTarget* cur = sBoundTarget; while (cur && cur != this) - { + { cur = cur->mPreviousRT; } diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 0f3716bc18..a8e9f20b40 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -66,14 +66,14 @@ LLShaderMgr * LLShaderMgr::instance() return sInstance; } -BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) +bool LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) { llassert_always(shader != NULL); LLShaderFeatures *features = & shader->mFeatures; if (features->attachNothing) { - return TRUE; + return true; } ////////////////////////////////////// // Attach Vertex Shader Features First @@ -84,7 +84,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) { if (!shader->attachVertexObject("windlight/atmosphericsVarsV.glsl")) { - return FALSE; + return false; } } @@ -92,7 +92,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) { if (!shader->attachVertexObject("windlight/atmosphericsHelpersV.glsl")) { - return FALSE; + return false; } } @@ -102,40 +102,40 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) { if (!shader->attachVertexObject("lighting/lightFuncSpecularV.glsl")) { - return FALSE; + return false; } if (!features->isAlphaLighting) { if (!shader->attachVertexObject("lighting/sumLightsSpecularV.glsl")) { - return FALSE; + return false; } } if (!shader->attachVertexObject("lighting/lightSpecularV.glsl")) { - return FALSE; + return false; } } else { if (!shader->attachVertexObject("lighting/lightFuncV.glsl")) { - return FALSE; + return false; } if (!features->isAlphaLighting) { if (!shader->attachVertexObject("lighting/sumLightsV.glsl")) { - return FALSE; + return false; } } if (!shader->attachVertexObject("lighting/lightV.glsl")) { - return FALSE; + return false; } } } @@ -145,16 +145,16 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) { if (!shader->attachVertexObject("environment/srgbF.glsl")) // NOTE -- "F" suffix is superfluous here, there is nothing fragment specific in srgbF { - return FALSE; + return false; } if (!shader->attachVertexObject("windlight/atmosphericsFuncs.glsl")) { - return FALSE; + return false; } if (!shader->attachVertexObject("windlight/atmosphericsV.glsl")) { - return FALSE; + return false; } } @@ -162,7 +162,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) { if (!shader->attachVertexObject("avatar/avatarSkinV.glsl")) { - return FALSE; + return false; } } @@ -171,13 +171,13 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) shader->mRiggedVariant = shader; if (!shader->attachVertexObject("avatar/objectSkinV.glsl")) { - return FALSE; + return false; } } if (!shader->attachVertexObject("deferred/textureUtilV.glsl")) { - return FALSE; + return false; } /////////////////////////////////////// @@ -188,14 +188,14 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) if (!shader->attachFragmentObject("deferred/globalF.glsl")) { - return FALSE; + return false; } if (features->hasSrgb || features->hasAtmospherics || features->calculatesAtmospherics || features->isDeferred) { if (!shader->attachFragmentObject("environment/srgbF.glsl")) { - return FALSE; + return false; } } @@ -203,7 +203,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) { if (!shader->attachFragmentObject("windlight/atmosphericsVarsF.glsl")) { - return FALSE; + return false; } } @@ -211,7 +211,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) { if (!shader->attachFragmentObject("windlight/atmosphericsHelpersF.glsl")) { - return FALSE; + return false; } } @@ -220,7 +220,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) { if (!shader->attachFragmentObject("deferred/deferredUtil.glsl")) { - return FALSE; + return false; } } @@ -228,7 +228,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) { if (!shader->attachFragmentObject("deferred/screenSpaceReflUtil.glsl")) { - return FALSE; + return false; } } @@ -236,7 +236,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) { if (!shader->attachFragmentObject("deferred/shadowUtil.glsl")) { - return FALSE; + return false; } } @@ -244,7 +244,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) { if (!shader->attachFragmentObject("deferred/reflectionProbeF.glsl")) { - return FALSE; + return false; } } @@ -252,7 +252,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) { if (!shader->attachFragmentObject("deferred/aoUtil.glsl")) { - return FALSE; + return false; } } @@ -260,19 +260,19 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) { if (!shader->attachFragmentObject("windlight/gammaF.glsl")) { - return FALSE; + return false; } } if (features->hasAtmospherics || features->isDeferred) { if (!shader->attachFragmentObject("windlight/atmosphericsFuncs.glsl")) { - return FALSE; + return false; } if (!shader->attachFragmentObject("windlight/atmosphericsF.glsl")) { - return FALSE; + return false; } } @@ -280,7 +280,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) { if (!shader->attachFragmentObject("deferred/pbrterrainUtilF.glsl")) { - return FALSE; + return false; } } @@ -289,26 +289,26 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) { if (!shader->attachFragmentObject("environment/waterFogF.glsl")) { - return FALSE; + return false; } } if (features->hasLighting) { - if (features->disableTextureIndex) + if (features->mIndexedTextureChannels <= 1) { if (features->hasAlphaMask) { if (!shader->attachFragmentObject("lighting/lightAlphaMaskNonIndexedF.glsl")) { - return FALSE; + return false; } } else { if (!shader->attachFragmentObject("lighting/lightNonIndexedF.glsl")) { - return FALSE; + return false; } } } @@ -318,14 +318,14 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) { if (!shader->attachFragmentObject("lighting/lightAlphaMaskF.glsl")) { - return FALSE; + return false; } } else { if (!shader->attachFragmentObject("lighting/lightF.glsl")) { - return FALSE; + return false; } } shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels, 1); @@ -336,18 +336,18 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) { if (!shader->attachVertexObject("objects/nonindexedTextureV.glsl")) { - return FALSE; + return false; } } else { if (!shader->attachVertexObject("objects/indexedTextureV.glsl")) { - return FALSE; + return false; } } - return TRUE; + return true; } //============================================================================ @@ -421,7 +421,7 @@ void LLShaderMgr::dumpShaderSource(U32 shader_code_count, GLchar** shader_code_t LL_CONT << LL_ENDL; } -void LLShaderMgr::dumpObjectLog(GLuint ret, BOOL warns, const std::string& filename) +void LLShaderMgr::dumpObjectLog(GLuint ret, bool warns, const std::string& filename) { std::string log; log = get_object_log(ret); @@ -689,7 +689,7 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev { //switches are supported in GLSL 1.30 and later if (gGLManager.mIsNVIDIA) { //switches are unreliable on some NVIDIA drivers - for (U32 i = 0; i < texture_index_channels; ++i) + for (S32 i = 0; i < texture_index_channels; ++i) { std::string if_string = llformat("\t%sif (vary_texture_index == %d) { return texture(tex%d, texcoord); }\n", i > 0 ? "else " : "", i, i); extra_code_text[extra_code_count++] = strdup(if_string.c_str()); @@ -877,7 +877,7 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev { //an error occured, print log LL_WARNS("ShaderLoading") << "GLSL Compilation Error:" << LL_ENDL; - dumpObjectLog(ret, TRUE, open_file_name); + dumpObjectLog(ret, true, open_file_name); dumpShaderSource(shader_code_count, shader_code_text); glDeleteShader(ret); //no longer need handle ret = 0; @@ -919,7 +919,7 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev return ret; } -BOOL LLShaderMgr::linkProgramObject(GLuint obj, BOOL suppress_errors) +bool LLShaderMgr::linkProgramObject(GLuint obj, bool suppress_errors) { //check for errors { @@ -936,7 +936,7 @@ BOOL LLShaderMgr::linkProgramObject(GLuint obj, BOOL suppress_errors) { //an error occured, print log LL_SHADER_LOADING_WARNS() << "GLSL Linker Error:" << LL_ENDL; - dumpObjectLog(obj, TRUE, "linker"); + dumpObjectLog(obj, true, "linker"); return success; } } @@ -947,12 +947,12 @@ BOOL LLShaderMgr::linkProgramObject(GLuint obj, BOOL suppress_errors) { LL_SHADER_LOADING_WARNS() << "GLSL Linker: Running in Software:" << LL_ENDL; success = GL_FALSE; - suppress_errors = FALSE; + suppress_errors = false; } return success; } -BOOL LLShaderMgr::validateProgramObject(GLuint obj) +bool LLShaderMgr::validateProgramObject(GLuint obj) { //check program validity against current GL glValidateProgram(obj); @@ -965,7 +965,7 @@ BOOL LLShaderMgr::validateProgramObject(GLuint obj) } else { - dumpObjectLog(obj, FALSE); + dumpObjectLog(obj, false); } return success; @@ -1120,7 +1120,7 @@ bool LLShaderMgr::saveCachedProgramBinary(LLGLSLShader* shader) program_binary.resize(binary_info.mBinaryLength); GLenum error = glGetError(); // Clear current error - glGetProgramBinary(shader->mProgramObject, program_binary.size() * sizeof(U8), nullptr, &binary_info.mBinaryFormat, program_binary.data()); + glGetProgramBinary(shader->mProgramObject, static_cast<GLsizei>(program_binary.size() * sizeof(U8)), nullptr, &binary_info.mBinaryFormat, program_binary.data()); error = glGetError(); if (error == GL_NO_ERROR) { @@ -1157,6 +1157,7 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedAttribs.push_back("weight"); mReservedAttribs.push_back("weight4"); mReservedAttribs.push_back("clothing"); + mReservedAttribs.push_back("joint"); mReservedAttribs.push_back("texture_index"); //matrix state @@ -1177,9 +1178,19 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("texture_base_color_transform"); // (GLTF) mReservedUniforms.push_back("texture_normal_transform"); // (GLTF) mReservedUniforms.push_back("texture_metallic_roughness_transform"); // (GLTF) + mReservedUniforms.push_back("texture_occlusion_transform"); // (GLTF) mReservedUniforms.push_back("texture_emissive_transform"); // (GLTF) + mReservedUniforms.push_back("base_color_texcoord"); // (GLTF) + mReservedUniforms.push_back("emissive_texcoord"); // (GLTF) + mReservedUniforms.push_back("normal_texcoord"); // (GLTF) + mReservedUniforms.push_back("metallic_roughness_texcoord"); // (GLTF) + mReservedUniforms.push_back("occlusion_texcoord"); // (GLTF) + mReservedUniforms.push_back("gltf_node_id"); // (GLTF) + mReservedUniforms.push_back("gltf_material_id"); // (GLTF) + + mReservedUniforms.push_back("terrain_texture_transforms"); // (GLTF) - llassert(mReservedUniforms.size() == LLShaderMgr::TEXTURE_EMISSIVE_TRANSFORM+1); + llassert(mReservedUniforms.size() == LLShaderMgr::TERRAIN_TEXTURE_TRANSFORMS +1); mReservedUniforms.push_back("viewport"); @@ -1223,6 +1234,9 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("diffuseMap"); mReservedUniforms.push_back("altDiffuseMap"); mReservedUniforms.push_back("specularMap"); + mReservedUniforms.push_back("metallicRoughnessMap"); + mReservedUniforms.push_back("normalMap"); + mReservedUniforms.push_back("occlusionMap"); mReservedUniforms.push_back("emissiveMap"); mReservedUniforms.push_back("bumpMap"); mReservedUniforms.push_back("bumpMap2"); @@ -1234,7 +1248,6 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("heroProbes"); mReservedUniforms.push_back("cloud_noise_texture"); mReservedUniforms.push_back("cloud_noise_texture_next"); - mReservedUniforms.push_back("fullbright"); mReservedUniforms.push_back("lightnorm"); mReservedUniforms.push_back("sunlight_color"); mReservedUniforms.push_back("ambient_color"); @@ -1346,7 +1359,6 @@ void LLShaderMgr::initAttribsAndUniforms() llassert(mReservedUniforms.size() == LLShaderMgr::DEFERRED_SHADOW5+1); - mReservedUniforms.push_back("normalMap"); mReservedUniforms.push_back("positionMap"); mReservedUniforms.push_back("diffuseRect"); mReservedUniforms.push_back("specularRect"); @@ -1359,7 +1371,6 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("bloomMap"); mReservedUniforms.push_back("projectionMap"); mReservedUniforms.push_back("norm_mat"); - mReservedUniforms.push_back("texture_gamma"); mReservedUniforms.push_back("specular_color"); mReservedUniforms.push_back("env_intensity"); diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index 8b13e822d5..fe6137c448 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -56,7 +56,17 @@ public: TEXTURE_BASE_COLOR_TRANSFORM, // "texture_base_color_transform" (GLTF) TEXTURE_NORMAL_TRANSFORM, // "texture_normal_transform" (GLTF) TEXTURE_METALLIC_ROUGHNESS_TRANSFORM, // "texture_metallic_roughness_transform" (GLTF) + TEXTURE_OCCLUSION_TRANSFORM, // "texture_occlusion_transform" (GLTF) TEXTURE_EMISSIVE_TRANSFORM, // "texture_emissive_transform" (GLTF) + BASE_COLOR_TEXCOORD, // "base_color_texcoord" (GLTF) + EMISSIVE_TEXCOORD, // "emissive_texcoord" (GLTF) + NORMAL_TEXCOORD, // "normal_texcoord" (GLTF) + METALLIC_ROUGHNESS_TEXCOORD, // "metallic_roughness_texcoord" (GLTF) + OCCLUSION_TEXCOORD, // "occlusion_texcoord" (GLTF) + GLTF_NODE_ID, // "gltf_node_id" (GLTF) + GLTF_MATERIAL_ID, // "gltf_material_id" (GLTF) + + TERRAIN_TEXTURE_TRANSFORMS, // "terrain_texture_transforms" (GLTF) VIEWPORT, // "viewport" LIGHT_POSITION, // "light_position" @@ -91,6 +101,9 @@ public: DIFFUSE_MAP, // "diffuseMap" ALTERNATE_DIFFUSE_MAP, // "altDiffuseMap" SPECULAR_MAP, // "specularMap" + METALLIC_ROUGHNESS_MAP, // "metallicRoughnessMap" + NORMAL_MAP, // "normalMap" + OCCLUSION_MAP, // "occlusionMap" EMISSIVE_MAP, // "emissiveMap" BUMP_MAP, // "bumpMap" BUMP_MAP2, // "bumpMap2" @@ -102,7 +115,6 @@ public: HERO_PROBE, // "heroProbes" CLOUD_NOISE_MAP, // "cloud_noise_texture" CLOUD_NOISE_MAP_NEXT, // "cloud_noise_texture_next" - FULLBRIGHT, // "fullbright" LIGHTNORM, // "lightnorm" SUNLIGHT_COLOR, // "sunlight_color" AMBIENT, // "ambient_color" @@ -200,7 +212,6 @@ public: DEFERRED_SHADOW3, // "shadowMap3" DEFERRED_SHADOW4, // "shadowMap4" DEFERRED_SHADOW5, // "shadowMap5" - DEFERRED_NORMAL, // "normalMap" DEFERRED_POSITION, // "positionMap" DEFERRED_DIFFUSE, // "diffuseRect" DEFERRED_SPECULAR, // "specularRect" @@ -213,7 +224,6 @@ public: DEFERRED_BLOOM, // "bloomMap" DEFERRED_PROJECTION, // "projectionMap" DEFERRED_NORM_MATRIX, // "norm_mat" - TEXTURE_GAMMA, // "texture_gamma" SPECULAR_COLOR, // "specular_color" ENVIRONMENT_INTENSITY, // "env_intensity" @@ -328,11 +338,11 @@ public: virtual void initAttribsAndUniforms(void); - BOOL attachShaderFeatures(LLGLSLShader * shader); - void dumpObjectLog(GLuint ret, BOOL warns = TRUE, const std::string& filename = ""); + bool attachShaderFeatures(LLGLSLShader * shader); + void dumpObjectLog(GLuint ret, bool warns = true, const std::string& filename = ""); void dumpShaderSource(U32 shader_code_count, GLchar** shader_code_text); - BOOL linkProgramObject(GLuint obj, BOOL suppress_errors = FALSE); - BOOL validateProgramObject(GLuint obj); + bool linkProgramObject(GLuint obj, bool suppress_errors = false); + bool validateProgramObject(GLuint obj); GLuint loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, std::map<std::string, std::string>* defines = NULL, S32 texture_index_channels = -1); // Implemented in the application to actually point to the shader directory. diff --git a/indra/llrender/lltexturemanagerbridge.h b/indra/llrender/lltexturemanagerbridge.h index 0b76ee4de8..e742324e4a 100644 --- a/indra/llrender/lltexturemanagerbridge.h +++ b/indra/llrender/lltexturemanagerbridge.h @@ -36,8 +36,8 @@ class LLTextureManagerBridge public: virtual ~LLTextureManagerBridge() {} - virtual LLPointer<LLGLTexture> getLocalTexture(BOOL usemipmaps = TRUE, BOOL generate_gl_tex = TRUE) = 0; - virtual LLPointer<LLGLTexture> getLocalTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps, BOOL generate_gl_tex = TRUE) = 0; + virtual LLPointer<LLGLTexture> getLocalTexture(bool usemipmaps = true, bool generate_gl_tex = true) = 0; + virtual LLPointer<LLGLTexture> getLocalTexture(const U32 width, const U32 height, const U8 components, bool usemipmaps, bool generate_gl_tex = true) = 0; virtual LLGLTexture* getFetchedTexture(const LLUUID &image_id) = 0; }; diff --git a/indra/llrender/lluiimage.inl b/indra/llrender/lluiimage.inl index a69616c0c1..dff1fcdfcc 100644 --- a/indra/llrender/lluiimage.inl +++ b/indra/llrender/lluiimage.inl @@ -36,7 +36,7 @@ void LLUIImage::draw(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) width, height, mImage, color, - FALSE, + false, mClipRegion, mScaleRegion, mScaleStyle == SCALE_INNER); @@ -49,7 +49,7 @@ void LLUIImage::drawSolid(S32 x, S32 y, S32 width, S32 height, const LLColor4& c width, height, mImage, color, - TRUE, + true, mClipRegion, mScaleRegion, mScaleStyle == SCALE_INNER); diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index db881efd2b..b522eb5218 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -294,6 +294,62 @@ static GLuint gen_buffer() #define ANALYZE_VBO_POOL 0 +#if 0 // LL_DARWIN + +// experimental -- disable VBO pooling on OS X and use glMapBuffer +class LLVBOPool +{ +public: + U64 mAllocated = 0; + + U64 getVramBytesUsed() + { + return mAllocated; + } + + void allocate(GLenum type, U32 size, GLuint& name, U8*& data) + { + LL_PROFILE_ZONE_SCOPED_CATEGORY_VERTEX; + STOP_GLERROR; + llassert(type == GL_ARRAY_BUFFER || type == GL_ELEMENT_ARRAY_BUFFER); + llassert(name == 0); // non zero name indicates a gl name that wasn't freed + llassert(data == nullptr); // non null data indicates a buffer that wasn't freed + llassert(size >= 2); // any buffer size smaller than a single index is nonsensical + + mAllocated += size; + + { //allocate a new buffer + LL_PROFILE_GPU_ZONE("vbo alloc"); + // ON OS X, we don't allocate a VBO until the last possible moment + // in unmapBuffer + data = (U8*) ll_aligned_malloc_16(size); + STOP_GLERROR; + } + } + + void free(GLenum type, U32 size, GLuint name, U8* data) + { + LL_PROFILE_ZONE_SCOPED_CATEGORY_VERTEX; + llassert(type == GL_ARRAY_BUFFER || type == GL_ELEMENT_ARRAY_BUFFER); + llassert(size >= 2); + + if (data) + { + ll_aligned_free_16(data); + } + + mAllocated -= size; + STOP_GLERROR; + if (name) + { + glDeleteBuffers(1, &name); + } + STOP_GLERROR; + } +}; + +#else + class LLVBOPool { public: @@ -557,9 +613,8 @@ public: mIBOPool.clear(); mVBOPool.clear(); } - - }; +#endif static LLVBOPool* sVBOPool = nullptr; @@ -594,6 +649,7 @@ const U32 LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_MAX] = sizeof(F32), // TYPE_WEIGHT, sizeof(LLVector4), // TYPE_WEIGHT4, sizeof(LLVector4), // TYPE_CLOTHWEIGHT, + sizeof(U64), // TYPE_JOINT, sizeof(LLVector4), // TYPE_TEXTURE_INDEX (actually exists as position.w), no extra data, but stride is 16 bytes }; @@ -611,6 +667,7 @@ static const std::string vb_type_name[] = "TYPE_WEIGHT", "TYPE_WEIGHT4", "TYPE_CLOTHWEIGHT", + "TYPE_JOINT" "TYPE_TEXTURE_INDEX", "TYPE_MAX", "TYPE_INDEX", @@ -678,6 +735,8 @@ void LLVertexBuffer::drawElements(U32 mode, const LLVector4a* pos, const LLVecto LL_PROFILE_ZONE_SCOPED_CATEGORY_VERTEX; llassert(LLGLSLShader::sCurBoundShaderPtr != NULL); + STOP_GLERROR; + gGL.syncMatrices(); U32 mask = LLVertexBuffer::MAP_VERTEX; @@ -734,6 +793,45 @@ bool LLVertexBuffer::validateRange(U32 start, U32 end, U32 count, U32 indices_of } { +#if 0 // not a reliable test for VBOs that are not backed by a CPU buffer + U16* idx = (U16*) mMappedIndexData+indices_offset; + for (U32 i = 0; i < count; ++i) + { + llassert(idx[i] >= start); + llassert(idx[i] <= end); + + if (idx[i] < start || idx[i] > end) + { + LL_ERRS() << "Index out of range: " << idx[i] << " not in [" << start << ", " << end << "]" << LL_ENDL; + } + } + + LLVector4a* v = (LLVector4a*)mMappedData; + + for (U32 i = start; i <= end; ++i) + { + if (!v[i].isFinite3()) + { + LL_ERRS() << "Non-finite vertex position data detected." << LL_ENDL; + } + } + + LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; + + if (shader && shader->mFeatures.mIndexedTextureChannels > 1) + { + LLVector4a* v = (LLVector4a*) mMappedData; + + for (U32 i = start; i < end; i++) + { + U32 idx = (U32) (v[i][3]+0.25f); + if (idx >= (U32)shader->mFeatures.mIndexedTextureChannels) + { + LL_ERRS() << "Bad texture index found in vertex data stream." << LL_ENDL; + } + } + } +#endif } return true; @@ -751,8 +849,10 @@ void LLVertexBuffer::drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indi llassert(mGLBuffer == sGLRenderBuffer); llassert(mGLIndices == sGLRenderIndices); gGL.syncMatrices(); + STOP_GLERROR; glDrawRangeElements(sGLMode[mode], start, end, count, mIndicesType, (GLvoid*) (indices_offset * (size_t) mIndicesStride)); + STOP_GLERROR; } void LLVertexBuffer::drawRangeFast(U32 mode, U32 start, U32 end, U32 count, U32 indices_offset) const @@ -775,7 +875,9 @@ void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const llassert(mGLIndices == sGLRenderIndices); gGL.syncMatrices(); + STOP_GLERROR; glDrawArrays(sGLMode[mode], first, count); + STOP_GLERROR; } //static @@ -801,9 +903,10 @@ void LLVertexBuffer::initClass(LLWindow* window) //static void LLVertexBuffer::unbind() { + STOP_GLERROR; glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); - + STOP_GLERROR; sGLRenderBuffer = 0; sGLRenderIndices = 0; } @@ -1200,6 +1303,7 @@ void LLVertexBuffer::flush_vbo(GLenum target, U32 start, U32 end, void* data, U8 void LLVertexBuffer::unmapBuffer() { + STOP_GLERROR; struct SortMappedRegion { bool operator()(const MappedRegion& lhs, const MappedRegion& rhs) @@ -1479,12 +1583,15 @@ void LLVertexBuffer::setBuffer() glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mGLIndices); sGLRenderIndices = mGLIndices; } + + STOP_GLERROR; } // virtual (default) void LLVertexBuffer::setupVertexBuffer() { + STOP_GLERROR; U8* base = nullptr; U32 data_mask = LLGLSLShader::sCurBoundShaderPtr->mAttributeMask; @@ -1556,6 +1663,12 @@ void LLVertexBuffer::setupVertexBuffer() void* ptr = (void*)(base + mOffsets[TYPE_WEIGHT4]); glVertexAttribPointer(loc, 4, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], ptr); } + if (data_mask & MAP_JOINT) + { + AttributeType loc = TYPE_JOINT; + void* ptr = (void*)(base + mOffsets[TYPE_JOINT]); + glVertexAttribIPointer(loc, 4, GL_UNSIGNED_SHORT, LLVertexBuffer::sTypeSize[TYPE_JOINT], ptr); + } if (data_mask & MAP_CLOTHWEIGHT) { AttributeType loc = TYPE_CLOTHWEIGHT; @@ -1574,6 +1687,7 @@ void LLVertexBuffer::setupVertexBuffer() void* ptr = (void*)(base + mOffsets[TYPE_VERTEX]); glVertexAttribPointer(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr); } + STOP_GLERROR; } void LLVertexBuffer::setPositionData(const LLVector4a* data) @@ -1611,12 +1725,10 @@ void LLVertexBuffer::setWeight4Data(const LLVector4a* data) flush_vbo(GL_ARRAY_BUFFER, mOffsets[TYPE_WEIGHT4], mOffsets[TYPE_WEIGHT4] + sTypeSize[TYPE_WEIGHT4] * getNumVerts() - 1, (U8*) data, mMappedData); } -/* void LLVertexBuffer::setJointData(const U64* data) { flush_vbo(GL_ARRAY_BUFFER, mOffsets[TYPE_JOINT], mOffsets[TYPE_JOINT] + sTypeSize[TYPE_JOINT] * getNumVerts() - 1, (U8*) data, mMappedData); } -*/ void LLVertexBuffer::setIndexData(const U16* data) { @@ -1669,12 +1781,10 @@ void LLVertexBuffer::setWeight4Data(const LLVector4a* data, U32 offset, U32 coun flush_vbo(GL_ARRAY_BUFFER, mOffsets[TYPE_WEIGHT4] + offset * sTypeSize[TYPE_WEIGHT4], mOffsets[TYPE_WEIGHT4] + (offset + count) * sTypeSize[TYPE_WEIGHT4] - 1, (U8*)data, mMappedData); } -/* void LLVertexBuffer::setJointData(const U64* data, U32 offset, U32 count) { flush_vbo(GL_ARRAY_BUFFER, mOffsets[TYPE_JOINT] + offset * sTypeSize[TYPE_JOINT], mOffsets[TYPE_JOINT] + (offset + count) * sTypeSize[TYPE_JOINT] - 1, (U8*)data, mMappedData); } -*/ void LLVertexBuffer::setIndexData(const U16* data, U32 offset, U32 count) { diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index 9d7a0bae2c..4dd375a4af 100644 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -110,6 +110,7 @@ public: TYPE_WEIGHT, // "weight" TYPE_WEIGHT4, // "weight4" TYPE_CLOTHWEIGHT, // "clothing" + TYPE_JOINT, // "joint" TYPE_TEXTURE_INDEX, // "texture_index" TYPE_MAX, // TYPE_MAX is the size/boundary marker for attributes that go in the vertex buffer TYPE_INDEX, // TYPE_INDEX is beyond _MAX because it lives in a separate (index) buffer @@ -129,6 +130,7 @@ public: MAP_WEIGHT = (1<<TYPE_WEIGHT), MAP_WEIGHT4 = (1<<TYPE_WEIGHT4), MAP_CLOTHWEIGHT = (1<<TYPE_CLOTHWEIGHT), + MAP_JOINT = (1<<TYPE_JOINT), MAP_TEXTURE_INDEX = (1<<TYPE_TEXTURE_INDEX), }; @@ -193,7 +195,7 @@ public: void setNormalData(const LLVector4a* data); void setTangentData(const LLVector4a* data); void setWeight4Data(const LLVector4a* data); - void setTexCoordData(const LLVector2* data); + void setJointData(const U64* data); void setTexCoord0Data(const LLVector2* data); void setTexCoord1Data(const LLVector2* data); void setColorData(const LLColor4U* data); @@ -204,7 +206,7 @@ public: void setNormalData(const LLVector4a* data, U32 offset, U32 count); void setTangentData(const LLVector4a* data, U32 offset, U32 count); void setWeight4Data(const LLVector4a* data, U32 offset, U32 count); - //void setJointData(const U64* data, U32 offset, U32 count); + void setJointData(const U64* data, U32 offset, U32 count); void setTexCoord0Data(const LLVector2* data, U32 offset, U32 count); void setTexCoord1Data(const LLVector2* data, U32 offset, U32 count); void setColorData(const LLColor4U* data, U32 offset, U32 count); @@ -276,7 +278,7 @@ private: : LLVertexBuffer(typemask) {} - bool allocateBuffer(S32 nverts, S32 nindices, BOOL create) { return allocateBuffer(nverts, nindices); } + bool allocateBuffer(S32 nverts, S32 nindices, bool create) { return allocateBuffer(nverts, nindices); } public: diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp index 3feb989ed5..4682044d6e 100644 --- a/indra/llui/llaccordionctrl.cpp +++ b/indra/llui/llaccordionctrl.cpp @@ -103,7 +103,7 @@ void LLAccordionCtrl::draw() } //--------------------------------------------------------------------------------- -BOOL LLAccordionCtrl::postBuild() +bool LLAccordionCtrl::postBuild() { static LLUICachedControl<S32> scrollbar_size("UIScrollbarSize", 0); @@ -127,7 +127,7 @@ BOOL LLAccordionCtrl::postBuild() mScrollbar = LLUICtrlFactory::create<LLScrollbar>(sbparams); LLView::addChild(mScrollbar); - mScrollbar->setVisible(FALSE); + mScrollbar->setVisible(false); mScrollbar->setFollowsRight(); mScrollbar->setFollowsTop(); mScrollbar->setFollowsBottom(); @@ -167,7 +167,7 @@ BOOL LLAccordionCtrl::postBuild() updateNoTabsHelpTextVisibility(); - return TRUE; + return true; } @@ -179,7 +179,7 @@ LLAccordionCtrl::~LLAccordionCtrl() //--------------------------------------------------------------------------------- -void LLAccordionCtrl::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLAccordionCtrl::reshape(S32 width, S32 height, bool called_from_parent) { // adjust our rectangle LLRect rcLocal = getRect(); @@ -199,7 +199,7 @@ void LLAccordionCtrl::reshape(S32 width, S32 height, BOOL called_from_parent) } //--------------------------------------------------------------------------------- -BOOL LLAccordionCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLAccordionCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) { return LLPanel::handleRightMouseDown(x, y, mask); } @@ -243,7 +243,7 @@ void LLAccordionCtrl::showScrollbar(S32 width, S32 height) { bool was_visible = mScrollbar->getVisible(); - mScrollbar->setVisible(TRUE); + mScrollbar->setVisible(true); static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0); @@ -265,9 +265,9 @@ void LLAccordionCtrl::showScrollbar(S32 width, S32 height) void LLAccordionCtrl::hideScrollbar(S32 width, S32 height) { - if (mScrollbar->getVisible() == FALSE) + if (!mScrollbar->getVisible()) return; - mScrollbar->setVisible(FALSE); + mScrollbar->setVisible(false); static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0); @@ -391,7 +391,7 @@ void LLAccordionCtrl::updateNoTabsHelpTextVisibility() } } - mNoVisibleTabsHelpText->setVisible(visible_exists ? FALSE : TRUE); + mNoVisibleTabsHelpText->setVisible(!visible_exists); } void LLAccordionCtrl::arrangeSingle() @@ -407,7 +407,7 @@ void LLAccordionCtrl::arrangeSingle() { LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); - if (accordion_tab->getVisible() == FALSE) // Skip hidden accordion tabs + if (!accordion_tab->getVisible()) // Skip hidden accordion tabs continue; if (!accordion_tab->isExpanded() ) { @@ -421,7 +421,7 @@ void LLAccordionCtrl::arrangeSingle() { LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); - if (accordion_tab->getVisible() == FALSE) // Skip hidden accordion tabs + if (!accordion_tab->getVisible()) // Skip hidden accordion tabs continue; if (!accordion_tab->isExpanded() ) { @@ -469,7 +469,7 @@ void LLAccordionCtrl::arrangeMultiple() { LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); - if (accordion_tab->getVisible() == FALSE) // Skip hidden accordion tabs + if (!accordion_tab->getVisible()) // Skip hidden accordion tabs continue; if (!accordion_tab->isExpanded() ) @@ -484,7 +484,7 @@ void LLAccordionCtrl::arrangeMultiple() if (mFitParent) { // All expanded tabs will have equal height - panel_height = calcExpandedTabHeight(i, panel_top); + panel_height = calcExpandedTabHeight(static_cast<S32>(i), panel_top); ctrlSetLeftTopAndSize(accordion_tab, panel_left, panel_top, panel_width, panel_height); // Try to make accordion tab fit accordion view height. @@ -552,24 +552,24 @@ void LLAccordionCtrl::arrange() //--------------------------------------------------------------------------------- -BOOL LLAccordionCtrl::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLAccordionCtrl::handleScrollWheel(S32 x, S32 y, S32 clicks) { if (LLPanel::handleScrollWheel(x, y, clicks)) - return TRUE; + return true; if (mScrollbar->getVisible() && mScrollbar->handleScrollWheel(0, 0, clicks)) - return TRUE; - return FALSE; + return true; + return false; } -BOOL LLAccordionCtrl::handleKeyHere(KEY key, MASK mask) +bool LLAccordionCtrl::handleKeyHere(KEY key, MASK mask) { if (mScrollbar->getVisible() && mScrollbar->handleKeyHere(key, mask)) - return TRUE; + return true; return LLPanel::handleKeyHere(key, mask); } -BOOL LLAccordionCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, - BOOL drop, +bool LLAccordionCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, + bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -577,17 +577,17 @@ BOOL LLAccordionCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, { // Scroll folder view if needed. Never accepts a drag or drop. *accept = ACCEPT_NO; - BOOL handled = autoScroll(x, y); + bool handled = autoScroll(x, y); if (!handled) { handled = childrenHandleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg) != NULL; } - return TRUE; + return true; } -BOOL LLAccordionCtrl::autoScroll(S32 x, S32 y) +bool LLAccordionCtrl::autoScroll(S32 x, S32 y) { static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0); @@ -624,7 +624,7 @@ BOOL LLAccordionCtrl::autoScroll(S32 x, S32 y) } } - return scrolling ? TRUE : FALSE; + return scrolling; } void LLAccordionCtrl::updateLayout(S32 width, S32 height) @@ -819,11 +819,11 @@ S32 LLAccordionCtrl::notifyParent(const LLSD& info) } else if (info.has("child_visibility_change")) { - BOOL new_visibility = info["child_visibility_change"]; + bool new_visibility = info["child_visibility_change"]; if (new_visibility) { // there is at least one visible tab - mNoVisibleTabsHelpText->setVisible(FALSE); + mNoVisibleTabsHelpText->setVisible(false); } else { diff --git a/indra/llui/llaccordionctrl.h b/indra/llui/llaccordionctrl.h index 2741db24e8..1dfa9100f6 100644 --- a/indra/llui/llaccordionctrl.h +++ b/indra/llui/llaccordionctrl.h @@ -88,12 +88,12 @@ public: LLAccordionCtrl(); virtual ~LLAccordionCtrl(); - virtual BOOL postBuild(); + virtual bool postBuild(); - virtual BOOL handleRightMouseDown ( S32 x, S32 y, MASK mask); - virtual BOOL handleScrollWheel ( S32 x, S32 y, S32 clicks ); - virtual BOOL handleKeyHere (KEY key, MASK mask); - virtual BOOL handleDragAndDrop (S32 x, S32 y, MASK mask, BOOL drop, + virtual bool handleRightMouseDown ( S32 x, S32 y, MASK mask); + virtual bool handleScrollWheel ( S32 x, S32 y, S32 clicks ); + virtual bool handleKeyHere (KEY key, MASK mask); + virtual bool handleDragAndDrop (S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -101,7 +101,7 @@ public: // // Call reshape after changing splitter's size - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + virtual void reshape(S32 width, S32 height, bool called_from_parent = true); void addCollapsibleCtrl(LLView* view); void removeCollapsibleCtrl(LLView* view); @@ -161,7 +161,7 @@ private: void showScrollbar (S32 width, S32 height); void hideScrollbar (S32 width, S32 height); - BOOL autoScroll (S32 x, S32 y); + bool autoScroll (S32 x, S32 y); /** * An adaptor for LLTabComparator diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp index 52893e530f..6d58a2545c 100644 --- a/indra/llui/llaccordionctrltab.cpp +++ b/indra/llui/llaccordionctrltab.cpp @@ -64,9 +64,9 @@ public: virtual void draw(); - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + virtual void reshape(S32 width, S32 height, bool called_from_parent = true); - virtual BOOL postBuild(); + virtual bool postBuild(); std::string getTitle(); void setTitle(const std::string& title, const std::string& hl); @@ -79,8 +79,8 @@ public: virtual void onMouseEnter(S32 x, S32 y, MASK mask); virtual void onMouseLeave(S32 x, S32 y, MASK mask); - virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); - virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + virtual bool handleKey(KEY key, MASK mask, bool called_from_parent); + virtual bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -150,9 +150,9 @@ LLAccordionCtrlTab::LLAccordionCtrlTabHeader::~LLAccordionCtrlTabHeader() { } -BOOL LLAccordionCtrlTab::LLAccordionCtrlTabHeader::postBuild() +bool LLAccordionCtrlTab::LLAccordionCtrlTabHeader::postBuild() { - return TRUE; + return true; } std::string LLAccordionCtrlTab::LLAccordionCtrlTabHeader::getTitle() @@ -202,7 +202,7 @@ void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::draw() S32 height = getRect().getHeight(); F32 alpha = getCurrentTransparency(); - gl_rect_2d(0, 0, width - 1, height - 1, mHeaderBGColor.get() % alpha, TRUE); + gl_rect_2d(0, 0, width - 1, height - 1, mHeaderBGColor.get() % alpha, true); LLAccordionCtrlTab* parent = dynamic_cast<LLAccordionCtrlTab*>(getParent()); bool collapsible = parent && parent->getCollapsible(); @@ -245,7 +245,7 @@ void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::draw() LLUICtrl::draw(); } -void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::reshape(S32 width, S32 height, BOOL called_from_parent /* = TRUE */) +void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::reshape(S32 width, S32 height, bool called_from_parent /* = true */) { S32 header_height = mHeaderTextbox->getTextPixelHeight(); @@ -276,7 +276,7 @@ void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::onMouseLeave(S32 x, S32 y, MA mAutoOpenTimer.stop(); } -BOOL LLAccordionCtrlTab::LLAccordionCtrlTabHeader::handleKey(KEY key, MASK mask, BOOL called_from_parent) +bool LLAccordionCtrlTab::LLAccordionCtrlTabHeader::handleKey(KEY key, MASK mask, bool called_from_parent) { if ((key == KEY_LEFT || key == KEY_RIGHT) && mask == MASK_NONE) { @@ -286,8 +286,8 @@ BOOL LLAccordionCtrlTab::LLAccordionCtrlTabHeader::handleKey(KEY key, MASK mask, return LLUICtrl::handleKey(key, mask, called_from_parent); } -BOOL LLAccordionCtrlTab::LLAccordionCtrlTabHeader::handleDragAndDrop(S32 x, S32 y, MASK mask, - BOOL drop, +bool LLAccordionCtrlTab::LLAccordionCtrlTabHeader::handleDragAndDrop(S32 x, S32 y, MASK mask, + bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -303,7 +303,7 @@ BOOL LLAccordionCtrlTab::LLAccordionCtrlTabHeader::handleDragAndDrop(S32 x, S32 { parent->changeOpenClose(false); mAutoOpenTimer.stop(); - return TRUE; + return true; } } else @@ -380,7 +380,7 @@ LLAccordionCtrlTab::LLAccordionCtrlTab(const LLAccordionCtrlTab::Params&p) LLFocusableElement::setFocusLostCallback(boost::bind(&LLAccordionCtrlTab::deselectOnFocusLost, this)); } - reshape(100, 200,FALSE); + reshape(100, 200,false); } LLAccordionCtrlTab::~LLAccordionCtrlTab() @@ -407,11 +407,11 @@ void LLAccordionCtrlTab::setDisplayChildren(bool display) else { if (mScrollbar) - mScrollbar->setVisible(FALSE); + mScrollbar->setVisible(false); } } -void LLAccordionCtrlTab::reshape(S32 width, S32 height, BOOL called_from_parent /* = TRUE */) +void LLAccordionCtrlTab::reshape(S32 width, S32 height, bool called_from_parent /* = true */) { LLRect headerRect; @@ -439,14 +439,14 @@ void LLAccordionCtrlTab::changeOpenClose(bool is_open) mExpandedHeight = getRect().getHeight(); setDisplayChildren(!is_open); - reshape(getRect().getWidth(), getRect().getHeight(), FALSE); + reshape(getRect().getWidth(), getRect().getHeight(), false); if (mCommitSignal) { (*mCommitSignal)(this, getDisplayChildren()); } } -void LLAccordionCtrlTab::onVisibilityChange(BOOL new_visibility) +void LLAccordionCtrlTab::onVisibilityChange(bool new_visibility) { LLUICtrl::onVisibilityChange(new_visibility); @@ -482,7 +482,7 @@ void LLAccordionCtrlTab::onUpdateScrollToChild(const LLUICtrl *cntrl) LLUICtrl::onUpdateScrollToChild(cntrl); } -BOOL LLAccordionCtrlTab::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLAccordionCtrlTab::handleMouseDown(S32 x, S32 y, MASK mask) { if (mCollapsible && mHeaderVisible && mCanOpenClose) { @@ -493,13 +493,13 @@ BOOL LLAccordionCtrlTab::handleMouseDown(S32 x, S32 y, MASK mask) // Reset stored state mWasStateStored = false; - return TRUE; + return true; } } return LLUICtrl::handleMouseDown(x,y,mask); } -BOOL LLAccordionCtrlTab::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLAccordionCtrlTab::handleMouseUp(S32 x, S32 y, MASK mask) { return LLUICtrl::handleMouseUp(x,y,mask); } @@ -643,14 +643,14 @@ void LLAccordionCtrlTab::setHeaderVisible(bool value) if (mHeader) { - mHeader->setVisible(value ? TRUE : FALSE); + mHeader->setVisible(value); } - reshape(getRect().getWidth(), getRect().getHeight(), FALSE); + reshape(getRect().getWidth(), getRect().getHeight(), false); }; //virtual -BOOL LLAccordionCtrlTab::postBuild() +bool LLAccordionCtrlTab::postBuild() { if (mHeader) { @@ -812,7 +812,7 @@ S32 LLAccordionCtrlTab::notify(const LLSD& info) return 0; } -BOOL LLAccordionCtrlTab::handleKey(KEY key, MASK mask, BOOL called_from_parent) +bool LLAccordionCtrlTab::handleKey(KEY key, MASK mask, bool called_from_parent) { if (!mHeader->hasFocus()) return LLUICtrl::handleKey(key, mask, called_from_parent); @@ -820,7 +820,7 @@ BOOL LLAccordionCtrlTab::handleKey(KEY key, MASK mask, BOOL called_from_parent) if ((key == KEY_RETURN) && mask == MASK_NONE) { changeOpenClose(getDisplayChildren()); - return TRUE; + return true; } if ((key == KEY_ADD || key == KEY_RIGHT) && mask == MASK_NONE) @@ -828,7 +828,7 @@ BOOL LLAccordionCtrlTab::handleKey(KEY key, MASK mask, BOOL called_from_parent) if (!getDisplayChildren()) { changeOpenClose(getDisplayChildren()); - return TRUE; + return true; } } @@ -837,7 +837,7 @@ BOOL LLAccordionCtrlTab::handleKey(KEY key, MASK mask, BOOL called_from_parent) if (getDisplayChildren()) { changeOpenClose(getDisplayChildren()); - return TRUE; + return true; } } @@ -853,7 +853,7 @@ BOOL LLAccordionCtrlTab::handleKey(KEY key, MASK mask, BOOL called_from_parent) { getAccordionView()->notify(LLSD().with("action", "select_first")); } - return TRUE; + return true; } if (key == KEY_UP && mask == MASK_NONE) @@ -862,7 +862,7 @@ BOOL LLAccordionCtrlTab::handleKey(KEY key, MASK mask, BOOL called_from_parent) // we're processing notifyParent so let call parent directly getParent()->notifyParent(LLSD().with("action", "select_prev")); - return TRUE; + return true; } return LLUICtrl::handleKey(key, mask, called_from_parent); @@ -992,10 +992,10 @@ void LLAccordionCtrlTab::hideScrollbar(const LLRect& child_rect) if (!mContainerPanel || !mScrollbar) return; - if (mScrollbar->getVisible() == FALSE) + if (!mScrollbar->getVisible()) return; - mScrollbar->setVisible(FALSE); + mScrollbar->setVisible(false); mScrollbar->setDocPos(0); //shrink child panel @@ -1097,7 +1097,7 @@ void LLAccordionCtrlTab::ctrlSetLeftTopAndSize(LLView* panel, S32 left, S32 top, panel->setRect(panel_rect); } -BOOL LLAccordionCtrlTab::handleToolTip(S32 x, S32 y, MASK mask) +bool LLAccordionCtrlTab::handleToolTip(S32 x, S32 y, MASK mask) { //header may be not the first child but we need to process it first if (y >= (getRect().getHeight() - HEADER_HEIGHT - HEADER_HEIGHT / 2)) @@ -1105,22 +1105,22 @@ BOOL LLAccordionCtrlTab::handleToolTip(S32 x, S32 y, MASK mask) //inside tab header //fix for EXT-6619 mHeader->handleToolTip(x, y, mask); - return TRUE; + return true; } return LLUICtrl::handleToolTip(x, y, mask); } -BOOL LLAccordionCtrlTab::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLAccordionCtrlTab::handleScrollWheel(S32 x, S32 y, S32 clicks) { if (LLUICtrl::handleScrollWheel(x, y, clicks)) { - return TRUE; + return true; } if (mScrollbar && mScrollbar->getVisible() && mScrollbar->handleScrollWheel(0, 0, clicks)) { - return TRUE; + return true; } - return FALSE; + return false; } diff --git a/indra/llui/llaccordionctrltab.h b/indra/llui/llaccordionctrltab.h index f01fff2519..cf3569683e 100644 --- a/indra/llui/llaccordionctrltab.h +++ b/indra/llui/llaccordionctrltab.h @@ -134,7 +134,7 @@ public: void canOpenClose(bool can_open_close) { mCanOpenClose = can_open_close; }; bool canOpenClose() const { return mCanOpenClose; }; - virtual BOOL postBuild(); + virtual bool postBuild(); S32 notifyParent(const LLSD& info); S32 notify(const LLSD& info); @@ -153,22 +153,22 @@ protected: public: // Call reshape after changing size - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + virtual void reshape(S32 width, S32 height, bool called_from_parent = true); /** * Raises notifyParent event with "child_visibility_change" = new_visibility */ - void onVisibilityChange(BOOL new_visibility); + void onVisibilityChange(bool new_visibility); virtual void onUpdateScrollToChild(const LLUICtrl * cntrl); // Changes expand/collapse state and triggers expand/collapse callbacks - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleKey(KEY key, MASK mask, bool called_from_parent); - virtual BOOL handleToolTip(S32 x, S32 y, MASK mask); - virtual BOOL handleScrollWheel( S32 x, S32 y, S32 clicks ); + virtual bool handleToolTip(S32 x, S32 y, MASK mask); + virtual bool handleScrollWheel( S32 x, S32 y, S32 clicks ); virtual bool addChild(LLView* child, S32 tab_group = 0 ); diff --git a/indra/llui/llbadge.cpp b/indra/llui/llbadge.cpp index 847aefafb3..55fbd72165 100644 --- a/indra/llui/llbadge.cpp +++ b/indra/llui/llbadge.cpp @@ -36,7 +36,7 @@ static LLDefaultChildRegistry::Register<LLBadge> r("badge"); static const S32 BADGE_OFFSET_NOT_SPECIFIED = 0x7FFFFFFF; // Compiler optimization, generate extern template -template class LLBadge* LLView::getChild<class LLBadge>(const std::string& name, BOOL recurse) const; +template class LLBadge* LLView::getChild<class LLBadge>(const std::string& name, bool recurse) const; LLBadge::Params::Params() @@ -239,7 +239,7 @@ void LLBadge::draw() S32 badge_char_length = S32_MAX; S32 badge_pixel_length = S32_MAX; F32 *right_position_out = NULL; - BOOL do_not_use_ellipses = false; + bool do_not_use_ellipses = false; F32 badge_width = (2.0f * mPaddingHoriz) + mGLFont->getWidthF32(badge_label_wstring.c_str(), badge_label_begin_offset, badge_char_length); diff --git a/indra/llui/llbadge.h b/indra/llui/llbadge.h index 59296ffe86..a6d584c6d7 100644 --- a/indra/llui/llbadge.h +++ b/indra/llui/llbadge.h @@ -171,7 +171,7 @@ private: // Build time optimization, generate once in .cpp file #ifndef LLBADGE_CPP -extern template class LLBadge* LLView::getChild<class LLBadge>(const std::string& name, BOOL recurse) const; +extern template class LLBadge* LLView::getChild<class LLBadge>(const std::string& name, bool recurse) const; #endif #endif // LL_LLBADGE_H diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 16b58dcc5b..e6c045250e 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -56,7 +56,7 @@ static LLDefaultChildRegistry::Register<LLButton> r("button"); // Compiler optimization, generate extern template template class LLButton* LLView::getChild<class LLButton>( - const std::string& name, BOOL recurse) const; + const std::string& name, bool recurse) const; // globals S32 LLBUTTON_H_PAD = 4; @@ -124,10 +124,10 @@ LLButton::LLButton(const LLButton::Params& p) LLBadgeOwner(getHandle()), mMouseDownFrame(0), mMouseHeldDownCount(0), - mBorderEnabled( FALSE ), - mFlashing( FALSE ), + mBorderEnabled( false ), + mFlashing( false ), mCurGlowStrength(0.f), - mNeedsHighlight(FALSE), + mNeedsHighlight(false), mUnselectedLabel(p.label()), mSelectedLabel(p.label_selected()), mGLFont(p.font), @@ -170,7 +170,7 @@ LLButton::LLButton(const LLButton::Params& p) mHoverGlowStrength(p.hover_glow_amount), mCommitOnReturn(p.commit_on_return), mCommitOnCaptureLost(p.commit_on_capture_lost), - mFadeWhenDisabled(FALSE), + mFadeWhenDisabled(false), mForcePressedState(false), mDisplayPressedState(p.display_pressed_state), mLastDrawCharsCount(0), @@ -223,7 +223,7 @@ LLButton::LLButton(const LLButton::Params& p) if (p.image_disabled() == default_params.image_disabled() ) { mImageDisabled = p.image_unselected; - mFadeWhenDisabled = TRUE; + mFadeWhenDisabled = true; } if (p.image_pressed_selected == default_params.image_pressed_selected) @@ -239,7 +239,7 @@ LLButton::LLButton(const LLButton::Params& p) if (p.image_disabled_selected() == default_params.image_disabled_selected()) { mImageDisabledSelected = p.image_selected; - mFadeWhenDisabled = TRUE; + mFadeWhenDisabled = true; } if (p.image_pressed == default_params.image_pressed) @@ -387,7 +387,7 @@ boost::signals2::connection LLButton::setHeldDownCallback( button_callback_t cb, return setHeldDownCallback(boost::bind(cb, data)); } -BOOL LLButton::postBuild() +bool LLButton::postBuild() { autoResize(); @@ -396,9 +396,9 @@ BOOL LLButton::postBuild() return LLUICtrl::postBuild(); } -BOOL LLButton::handleUnicodeCharHere(llwchar uni_char) +bool LLButton::handleUnicodeCharHere(llwchar uni_char) { - BOOL handled = FALSE; + bool handled = false; if(' ' == uni_char && !gKeyboard->getKeyRepeated(' ')) { @@ -409,14 +409,14 @@ BOOL LLButton::handleUnicodeCharHere(llwchar uni_char) LLUICtrl::onCommit(); - handled = TRUE; + handled = true; } return handled; } -BOOL LLButton::handleKeyHere(KEY key, MASK mask ) +bool LLButton::handleKeyHere(KEY key, MASK mask ) { - BOOL handled = FALSE; + bool handled = false; if( mCommitOnReturn && KEY_RETURN == key && mask == MASK_NONE && !gKeyboard->getKeyRepeated(key)) { if (mIsToggle) @@ -424,7 +424,7 @@ BOOL LLButton::handleKeyHere(KEY key, MASK mask ) toggleState(); } - handled = TRUE; + handled = true; LLUICtrl::onCommit(); } @@ -432,7 +432,7 @@ BOOL LLButton::handleKeyHere(KEY key, MASK mask ) } -BOOL LLButton::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLButton::handleMouseDown(S32 x, S32 y, MASK mask) { if (!childrenHandleMouseDown(x, y, mask)) { @@ -441,7 +441,7 @@ BOOL LLButton::handleMouseDown(S32 x, S32 y, MASK mask) if (hasTabStop() && !getIsChrome()) { - setFocus(TRUE); + setFocus(true); } if (!mFunctionName.empty()) @@ -472,11 +472,11 @@ BOOL LLButton::handleMouseDown(S32 x, S32 y, MASK mask) make_ui_sound("UISndClick"); } } - return TRUE; + return true; } -BOOL LLButton::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLButton::handleMouseUp(S32 x, S32 y, MASK mask) { // We only handle the click if the click both started and ended within us if( hasMouseCapture() ) @@ -521,10 +521,10 @@ BOOL LLButton::handleMouseUp(S32 x, S32 y, MASK mask) childrenHandleMouseUp(x, y, mask); } - return TRUE; + return true; } -BOOL LLButton::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLButton::handleRightMouseDown(S32 x, S32 y, MASK mask) { if (mHandleRightMouse && !childrenHandleRightMouseDown(x, y, mask)) { @@ -533,7 +533,7 @@ BOOL LLButton::handleRightMouseDown(S32 x, S32 y, MASK mask) if (hasTabStop() && !getIsChrome()) { - setFocus(TRUE); + setFocus(true); } // if (pointInView(x, y)) @@ -546,10 +546,10 @@ BOOL LLButton::handleRightMouseDown(S32 x, S32 y, MASK mask) // if they are not mouse opaque. } - return TRUE; + return true; } -BOOL LLButton::handleRightMouseUp(S32 x, S32 y, MASK mask) +bool LLButton::handleRightMouseUp(S32 x, S32 y, MASK mask) { if (mHandleRightMouse) { @@ -575,14 +575,14 @@ BOOL LLButton::handleRightMouseUp(S32 x, S32 y, MASK mask) // but this might change the mouse handling of existing buttons in a bad way. // if they are not mouse opaque. } - return TRUE; + return true; } void LLButton::onMouseLeave(S32 x, S32 y, MASK mask) { LLUICtrl::onMouseLeave(x, y, mask); - mNeedsHighlight = FALSE; + mNeedsHighlight = false; } void LLButton::setHighlight(bool b) @@ -590,11 +590,11 @@ void LLButton::setHighlight(bool b) mNeedsHighlight = b; } -BOOL LLButton::handleHover(S32 x, S32 y, MASK mask) +bool LLButton::handleHover(S32 x, S32 y, MASK mask) { if (isInEnabledChain() && (!gFocusMgr.getMouseCapture() || gFocusMgr.getMouseCapture() == this)) - mNeedsHighlight = TRUE; + mNeedsHighlight = true; if (!childrenHandleHover(x, y, mask)) { @@ -613,7 +613,7 @@ BOOL LLButton::handleHover(S32 x, S32 y, MASK mask) getWindow()->setCursor(UI_CURSOR_ARROW); LL_DEBUGS("UserInput") << "hover handled by " << getName() << LL_ENDL; } - return TRUE; + return true; } void LLButton::getOverlayImageSize(S32& overlay_width, S32& overlay_height) @@ -633,7 +633,7 @@ void LLButton::draw() static LLCachedControl<bool> sEnableButtonFlashing(*LLUI::getInstance()->mSettingGroups["config"], "EnableButtonFlashing", true); F32 alpha = mUseDrawContextAlpha ? getDrawContext().mAlpha : getCurrentTransparency(); - bool pressed_by_keyboard = FALSE; + bool pressed_by_keyboard = false; if (hasFocus()) { pressed_by_keyboard = gKeyboard->getKeyDown(' ') || (mCommitOnReturn && gKeyboard->getKeyDown(KEY_RETURN)); @@ -655,7 +655,7 @@ void LLButton::draw() || mForcePressedState; bool selected = getToggleState(); - bool use_glow_effect = FALSE; + bool use_glow_effect = false; LLColor4 highlighting_color = LLColor4::white; LLColor4 glow_color = LLColor4::white; LLRender::eBlendType glow_type = LLRender::BT_ADD_WITH_ALPHA; @@ -687,7 +687,7 @@ void LLButton::draw() else { imagep = mImageSelected; - use_glow_effect = TRUE; + use_glow_effect = true; } } else @@ -699,7 +699,7 @@ void LLButton::draw() else { imagep = mImageUnselected; - use_glow_effect = TRUE; + use_glow_effect = true; } } } @@ -741,7 +741,7 @@ void LLButton::draw() if (mFlashingTimer) { LLColor4 flash_color = mFlashBgColor.get(); - use_glow_effect = TRUE; + use_glow_effect = true; glow_type = LLRender::BT_ALPHA; // blend the glow if (mFlashingTimer->isCurrentlyHighlighted() || !mFlashingTimer->isFlashingInProgress()) @@ -762,7 +762,7 @@ void LLButton::draw() if (mNeedsHighlight && !imagep) { - use_glow_effect = TRUE; + use_glow_effect = true; } // Figure out appropriate color for the text @@ -850,7 +850,7 @@ void LLButton::draw() // no image LL_DEBUGS() << "No image for button " << getName() << LL_ENDL; // draw it in pink so we can find it - gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4::pink1 % alpha, FALSE); + gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4::pink1 % alpha, false); } // let overlay image and text play well together @@ -984,12 +984,12 @@ void LLButton::drawBorder(LLUIImage* imagep, const LLColor4& color, S32 size) } } -BOOL LLButton::getToggleState() const +bool LLButton::getToggleState() const { return getValue().asBoolean(); } -void LLButton::setToggleState(BOOL b) +void LLButton::setToggleState(bool b) { if( b != getToggleState() ) { @@ -1016,7 +1016,7 @@ void LLButton::setFlashing(bool b, bool force_flashing/* = false */) } } -BOOL LLButton::toggleState() +bool LLButton::toggleState() { bool flipped = ! getToggleState(); setToggleState(flipped); @@ -1041,11 +1041,11 @@ void LLButton::setLabel( const LLStringExplicit& label ) } //virtual -BOOL LLButton::setLabelArg( const std::string& key, const LLStringExplicit& text ) +bool LLButton::setLabelArg( const std::string& key, const LLStringExplicit& text ) { mUnselectedLabel.setArg(key, text); mSelectedLabel.setArg(key, text); - return TRUE; + return true; } void LLButton::setLabelUnselected( const LLStringExplicit& label ) @@ -1143,14 +1143,14 @@ void LLButton::setImageDisabled(LLPointer<LLUIImage> image) { mImageDisabled = image; mDisabledImageColor = mImageColor; - mFadeWhenDisabled = TRUE; + mFadeWhenDisabled = true; } void LLButton::setImageDisabledSelected(LLPointer<LLUIImage> image) { mImageDisabledSelected = image; mDisabledImageColor = mImageColor; - mFadeWhenDisabled = TRUE; + mFadeWhenDisabled = true; } void LLButton::setImagePressed(LLPointer<LLUIImage> image) @@ -1243,11 +1243,11 @@ void LLButton::addImageAttributeToXML(LLXMLNodePtr node, { if( !image_name.empty() ) { - node->createChild(xml_tag_name.c_str(), TRUE)->setStringValue(image_name); + node->createChild(xml_tag_name.c_str(), true)->setStringValue(image_name); } else if( image_id != LLUUID::null ) { - node->createChild((xml_tag_name + "_id").c_str(), TRUE)->setUUIDValue(image_id); + node->createChild((xml_tag_name + "_id").c_str(), true)->setUUIDValue(image_id); } } @@ -1314,7 +1314,7 @@ void LLButton::resetMouseDownTimer() mMouseDownTimer.reset(); } -BOOL LLButton::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLButton::handleDoubleClick(S32 x, S32 y, MASK mask) { // just treat a double click as a second click return handleMouseDown(x, y, mask); diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 8ac42596e4..fed5cdcc50 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -156,16 +156,16 @@ public: void addImageAttributeToXML(LLXMLNodePtr node, const std::string& imageName, const LLUUID& imageID,const std::string& xmlTagName) const; - virtual BOOL handleUnicodeCharHere(llwchar uni_char); - virtual BOOL handleKeyHere(KEY key, MASK mask); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + virtual bool handleUnicodeCharHere(llwchar uni_char); + virtual bool handleKeyHere(KEY key, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleHover(S32 x, S32 y, MASK mask); + virtual bool handleRightMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleRightMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleDoubleClick(S32 x, S32 y, MASK mask); virtual void draw(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); virtual void onMouseLeave(S32 x, S32 y, MASK mask); virtual void onMouseCaptureLost(); @@ -174,8 +174,8 @@ public: void setUnselectedLabelColor( const LLColor4& c ) { mUnselectedLabelColor = c; } void setSelectedLabelColor( const LLColor4& c ) { mSelectedLabelColor = c; } - void setUseEllipses( BOOL use_ellipses ) { mUseEllipses = use_ellipses; } - void setUseFontColor( BOOL use_font_color) { mUseFontColor = use_font_color; } + void setUseEllipses( bool use_ellipses ) { mUseEllipses = use_ellipses; } + void setUseFontColor( bool use_font_color) { mUseFontColor = use_font_color; } boost::signals2::connection setClickedCallback(const CommitCallbackParam& cb); @@ -200,13 +200,13 @@ public: F32 getHeldDownTime() const { return mMouseDownTimer.getElapsedTimeF32(); } - BOOL toggleState(); - BOOL getToggleState() const; - void setToggleState(BOOL b); + bool toggleState(); + bool getToggleState() const; + void setToggleState(bool b); void setHighlight(bool b); void setFlashing( bool b, bool force_flashing = false ); - BOOL getFlashing() const { return mFlashing; } + bool getFlashing() const { return mFlashing; } LLFlashTimer* getFlashTimer() {return mFlashingTimer;} void setFlashColor(const LLUIColor &color) { mFlashBgColor = color; }; @@ -243,7 +243,7 @@ public: void setLabel(const std::string& label); void setLabel(const LLUIString& label); void setLabel( const LLStringExplicit& label); - virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); + virtual bool setLabelArg( const std::string& key, const LLStringExplicit& text ); void setLabelUnselected(const LLStringExplicit& label); void setLabelSelected(const LLStringExplicit& label); void setDisabledLabelColor( const LLColor4& c ) { mDisabledLabelColor = c; } @@ -257,12 +257,12 @@ public: bool labelIsTruncated() const; const LLUIString& getCurrentLabel() const; - void setScaleImage(BOOL scale) { mScaleImage = scale; } - BOOL getScaleImage() const { return mScaleImage; } + void setScaleImage(bool scale) { mScaleImage = scale; } + bool getScaleImage() const { return mScaleImage; } - void setDropShadowedText(BOOL b) { mDropShadowedText = b; } + void setDropShadowedText(bool b) { mDropShadowedText = b; } - void setBorderEnabled(BOOL b) { mBorderEnabled = b; } + void setBorderEnabled(bool b) { mBorderEnabled = b; } void setHoverGlowStrength(F32 strength) { mHoverGlowStrength = strength; } @@ -275,8 +275,8 @@ public: void setImageFlash(LLPointer<LLUIImage> image); void setImagePressed(LLPointer<LLUIImage> image); - void setCommitOnReturn(BOOL commit) { mCommitOnReturn = commit; } - BOOL getCommitOnReturn() const { return mCommitOnReturn; } + void setCommitOnReturn(bool commit) { mCommitOnReturn = commit; } + bool getCommitOnReturn() const { return mCommitOnReturn; } static void onHeldDown(void *userdata); // to be called by gIdleCallbacks static void toggleFloaterAndSetToggleState(LLUICtrl* ctrl, const LLSD& sdname); @@ -400,7 +400,7 @@ protected: // Build time optimization, generate once in .cpp file #ifndef LLBUTTON_CPP extern template class LLButton* LLView::getChild<class LLButton>( - const std::string& name, BOOL recurse) const; + const std::string& name, bool recurse) const; #endif #endif // LL_LLBUTTON_H diff --git a/indra/llui/llchat.h b/indra/llui/llchat.h index 56105add7e..5f75ed2f8d 100644 --- a/indra/llui/llchat.h +++ b/indra/llui/llchat.h @@ -83,7 +83,7 @@ public: mSourceType(CHAT_SOURCE_AGENT), mChatType(CHAT_TYPE_NORMAL), mAudible(CHAT_AUDIBLE_FULLY), - mMuted(FALSE), + mMuted(false), mTime(0.0), mTimeStr(), mPosAgent(), @@ -100,7 +100,7 @@ public: EChatSourceType mSourceType; EChatType mChatType; EChatAudible mAudible; - BOOL mMuted; // pass muted chat to maintain list of chatters + bool mMuted; // pass muted chat to maintain list of chatters F64 mTime; // viewer only, seconds from viewer start std::string mTimeStr; LLVector3 mPosAgent; diff --git a/indra/llui/llchatentry.cpp b/indra/llui/llchatentry.cpp index 8a8b9e7461..da5afd0386 100644 --- a/indra/llui/llchatentry.cpp +++ b/indra/llui/llchatentry.cpp @@ -176,9 +176,9 @@ void LLChatEntry::onFocusLost() LLUICtrl::onFocusLost(); } -BOOL LLChatEntry::handleSpecialKey(const KEY key, const MASK mask) +bool LLChatEntry::handleSpecialKey(const KEY key, const MASK mask) { - BOOL handled = FALSE; + bool handled = false; LLTextEditor::handleSpecialKey(key, mask); @@ -203,7 +203,7 @@ BOOL LLChatEntry::handleSpecialKey(const KEY key, const MASK mask) { LLUI::getInstance()->reportBadKeystroke(); } - handled = TRUE; + handled = true; } break; @@ -227,7 +227,7 @@ BOOL LLChatEntry::handleSpecialKey(const KEY key, const MASK mask) { LLUI::getInstance()->reportBadKeystroke(); } - handled = TRUE; + handled = true; } break; diff --git a/indra/llui/llchatentry.h b/indra/llui/llchatentry.h index f7473b320d..5621ede1e7 100644 --- a/indra/llui/llchatentry.h +++ b/indra/llui/llchatentry.h @@ -84,7 +84,7 @@ private: */ void updateHistory(); - BOOL handleSpecialKey(const KEY key, const MASK mask); + bool handleSpecialKey(const KEY key, const MASK mask); // Fired when text height expanded to mExpandLinesCount diff --git a/indra/llui/llcheckboxctrl.cpp b/indra/llui/llcheckboxctrl.cpp index 8ba37a8075..3bcf0a6517 100644 --- a/indra/llui/llcheckboxctrl.cpp +++ b/indra/llui/llcheckboxctrl.cpp @@ -45,7 +45,7 @@ static LLDefaultChildRegistry::Register<LLCheckBoxCtrl> r("check_box"); // Compiler optimization, generate extern template template class LLCheckBoxCtrl* LLView::getChild<class LLCheckBoxCtrl>( - const std::string& name, BOOL recurse) const; + const std::string& name, bool recurse) const; void LLCheckBoxCtrl::WordWrap::declareValues() { @@ -77,7 +77,7 @@ LLCheckBoxCtrl::LLCheckBoxCtrl(const LLCheckBoxCtrl::Params& p) static LLUICachedControl<S32> llcheckboxctrl_vpad ("UICheckboxctrlVPad", 0); // must be big enough to hold all children - setUseBoundingRect(TRUE); + setUseBoundingRect(true); // *HACK Get rid of this with SL-55508... // this allows blank check boxes and radio boxes for now @@ -160,13 +160,13 @@ void LLCheckBoxCtrl::onCommit() { if( getEnabled() ) { - setTentative(FALSE); + setTentative(false); setControlValue(getValue()); LLUICtrl::onCommit(); } } -void LLCheckBoxCtrl::setEnabled(BOOL b) +void LLCheckBoxCtrl::setEnabled(bool b) { LLView::setEnabled(b); @@ -182,10 +182,10 @@ void LLCheckBoxCtrl::setEnabled(BOOL b) void LLCheckBoxCtrl::clear() { - setValue( FALSE ); + setValue( false ); } -void LLCheckBoxCtrl::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLCheckBoxCtrl::reshape(S32 width, S32 height, bool called_from_parent) { LLRect rect = getRect(); S32 delta_width = width - rect.getWidth(); @@ -205,10 +205,10 @@ void LLCheckBoxCtrl::reshape(S32 width, S32 height, BOOL called_from_parent) LLRect label_rect = mLabel->getRect(); S32 new_width = rect.getWidth() - label_rect.mLeft; - mLabel->reshape(new_width, label_rect.getHeight(), TRUE); + mLabel->reshape(new_width, label_rect.getHeight(), true); S32 label_top = label_rect.mTop; - mLabel->reshapeToFitText(TRUE); + mLabel->reshapeToFitText(true); label_rect = mLabel->getRect(); if (label_top != label_rect.mTop && mWordWrap == WRAP_DOWN) @@ -247,13 +247,13 @@ LLSD LLCheckBoxCtrl::getValue() const } //virtual -void LLCheckBoxCtrl::setTentative(BOOL b) +void LLCheckBoxCtrl::setTentative(bool b) { mButton->setTentative(b); } //virtual -BOOL LLCheckBoxCtrl::getTentative() const +bool LLCheckBoxCtrl::getTentative() const { return mButton->getTentative(); } @@ -261,7 +261,7 @@ BOOL LLCheckBoxCtrl::getTentative() const void LLCheckBoxCtrl::setLabel( const LLStringExplicit& label ) { mLabel->setText( label ); - reshape(getRect().getWidth(), getRect().getHeight(), FALSE); + reshape(getRect().getWidth(), getRect().getHeight(), false); } std::string LLCheckBoxCtrl::getLabel() const @@ -269,10 +269,10 @@ std::string LLCheckBoxCtrl::getLabel() const return mLabel->getText(); } -BOOL LLCheckBoxCtrl::setLabelArg( const std::string& key, const LLStringExplicit& text ) +bool LLCheckBoxCtrl::setLabelArg( const std::string& key, const LLStringExplicit& text ) { - BOOL res = mLabel->setTextArg(key, text); - reshape(getRect().getWidth(), getRect().getHeight(), FALSE); + bool res = mLabel->setTextArg(key, text); + reshape(getRect().getWidth(), getRect().getHeight(), false); return res; } @@ -283,14 +283,14 @@ void LLCheckBoxCtrl::setControlName(const std::string& control_name, LLView* con } -// virtual Returns TRUE if the user has modified this control. -BOOL LLCheckBoxCtrl::isDirty() const +// virtual Returns true if the user has modified this control. +bool LLCheckBoxCtrl::isDirty() const { if ( mButton ) { return mButton->isDirty(); } - return FALSE; // Shouldn't get here + return false; // Shouldn't get here } diff --git a/indra/llui/llcheckboxctrl.h b/indra/llui/llcheckboxctrl.h index f2b61db308..3058e946c3 100644 --- a/indra/llui/llcheckboxctrl.h +++ b/indra/llui/llcheckboxctrl.h @@ -36,8 +36,8 @@ // Constants // -const BOOL RADIO_STYLE = TRUE; -const BOOL CHECK_STYLE = FALSE; +const bool RADIO_STYLE = true; +const bool CHECK_STYLE = false; // // Classes @@ -87,28 +87,28 @@ protected: public: // LLView interface - virtual void setEnabled( BOOL b ); + virtual void setEnabled( bool b ); - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + virtual void reshape(S32 width, S32 height, bool called_from_parent = true); // LLUICtrl interface virtual void setValue(const LLSD& value ); virtual LLSD getValue() const; - BOOL get() { return (BOOL)getValue().asBoolean(); } - void set(BOOL value) { setValue(value); } + bool get() { return (bool)getValue().asBoolean(); } + void set(bool value) { setValue(value); } - virtual void setTentative(BOOL b); - virtual BOOL getTentative() const; + virtual void setTentative(bool b); + virtual bool getTentative() const; - virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); + virtual bool setLabelArg( const std::string& key, const LLStringExplicit& text ); virtual void clear(); virtual void onCommit(); // LLCheckBoxCtrl interface - virtual BOOL toggle() { return mButton->toggleState(); } // returns new state + virtual bool toggle() { return mButton->toggleState(); } // returns new state - void setBtnFocus() { mButton->setFocus(TRUE); } + void setBtnFocus() { mButton->setFocus(true); } void setEnabledColor( const LLColor4 &color ) { mTextEnabledColor = color; } void setDisabledColor( const LLColor4 &color ) { mTextDisabledColor = color; } @@ -121,7 +121,7 @@ public: virtual void setControlName(const std::string& control_name, LLView* context); - virtual BOOL isDirty() const; // Returns TRUE if the user has modified this control. + virtual bool isDirty() const; // Returns true if the user has modified this control. virtual void resetDirty(); // Clear dirty state protected: @@ -151,7 +151,7 @@ protected: // Build time optimization, generate once in .cpp file #ifndef LLCHECKBOXCTRL_CPP extern template class LLCheckBoxCtrl* LLView::getChild<class LLCheckBoxCtrl>( - const std::string& name, BOOL recurse) const; + const std::string& name, bool recurse) const; #endif #endif // LL_LLCHECKBOXCTRL_H diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp index 5132d33bbf..64896ccfcb 100644 --- a/indra/llui/llclipboard.cpp +++ b/indra/llui/llclipboard.cpp @@ -73,7 +73,7 @@ bool LLClipboard::addToClipboard(const LLUUID& src, const LLAssetType::EType typ if (LLAssetType::lookupIsAssetIDKnowable(type)) { LLWString source = utf8str_to_wstring(src.asString()); - res = addToClipboard(source, 0, source.size()); + res = addToClipboard(source, 0, static_cast<S32>(source.size())); } if (res) { @@ -87,13 +87,13 @@ bool LLClipboard::addToClipboard(const LLUUID& src, const LLAssetType::EType typ bool LLClipboard::pasteFromClipboard(std::vector<LLUUID>& inv_objects) const { bool res = false; - S32 count = mObjects.size(); + auto count = mObjects.size(); inv_objects.reserve(inv_objects.size() + count); if (count > 0) { res = true; inv_objects.clear(); - for (S32 i = 0; i < count; i++) + for (size_t i = 0; i < count; i++) { inv_objects.push_back(mObjects[i]); } diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 71dd93d07d..79dce1c714 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -171,13 +171,13 @@ void LLComboBox::initFromParams(const LLComboBox::Params& p) } // virtual -BOOL LLComboBox::postBuild() +bool LLComboBox::postBuild() { if (mControlVariable) { setValue(mControlVariable->getValue()); // selects the appropriate item } - return TRUE; + return true; } @@ -212,16 +212,16 @@ void LLComboBox::onCommit() // we have selected an existing item, blitz the manual text entry with // the properly capitalized item mTextEntry->setValue(getSimple()); - mTextEntry->setTentative(FALSE); + mTextEntry->setTentative(false); } setControlValue(getValue()); LLUICtrl::onCommit(); } // virtual -BOOL LLComboBox::isDirty() const +bool LLComboBox::isDirty() const { - BOOL grubby = FALSE; + bool grubby = false; if ( mList ) { grubby = mList->isDirty(); @@ -244,7 +244,7 @@ bool LLComboBox::itemExists(const std::string& name) } // add item "name" to menu -LLScrollListItem* LLComboBox::add(const std::string& name, EAddPosition pos, BOOL enabled) +LLScrollListItem* LLComboBox::add(const std::string& name, EAddPosition pos, bool enabled) { LLScrollListItem* item = mList->addSimpleElement(name, pos); item->setEnabled(enabled); @@ -263,7 +263,7 @@ LLScrollListItem* LLComboBox::add(const std::string& name, EAddPosition pos, BOO } // add item "name" with a unique id to menu -LLScrollListItem* LLComboBox::add(const std::string& name, const LLUUID& id, EAddPosition pos, BOOL enabled ) +LLScrollListItem* LLComboBox::add(const std::string& name, const LLUUID& id, EAddPosition pos, bool enabled ) { LLScrollListItem* item = mList->addSimpleElement(name, pos, id); item->setEnabled(enabled); @@ -282,7 +282,7 @@ LLScrollListItem* LLComboBox::add(const std::string& name, const LLUUID& id, EAd } // add item "name" with attached userdata -LLScrollListItem* LLComboBox::add(const std::string& name, void* userdata, EAddPosition pos, BOOL enabled ) +LLScrollListItem* LLComboBox::add(const std::string& name, void* userdata, EAddPosition pos, bool enabled ) { LLScrollListItem* item = mList->addSimpleElement(name, pos); item->setEnabled(enabled); @@ -302,7 +302,7 @@ LLScrollListItem* LLComboBox::add(const std::string& name, void* userdata, EAddP } // add item "name" with attached generic data -LLScrollListItem* LLComboBox::add(const std::string& name, LLSD value, EAddPosition pos, BOOL enabled ) +LLScrollListItem* LLComboBox::add(const std::string& name, LLSD value, EAddPosition pos, bool enabled ) { LLScrollListItem* item = mList->addSimpleElement(name, pos, value); item->setEnabled(enabled); @@ -325,17 +325,17 @@ LLScrollListItem* LLComboBox::addSeparator(EAddPosition pos) return mList->addSeparator(pos); } -void LLComboBox::sortByName(BOOL ascending) +void LLComboBox::sortByName(bool ascending) { mList->sortOnce(0, ascending); } // Choose an item with a given name in the menu. -// Returns TRUE if the item was found. -BOOL LLComboBox::setSimple(const LLStringExplicit& name) +// Returns true if the item was found. +bool LLComboBox::setSimple(const LLStringExplicit& name) { - BOOL found = mList->selectItemByLabel(name, FALSE); + bool found = mList->selectItemByLabel(name, false); if (found) { @@ -349,7 +349,7 @@ BOOL LLComboBox::setSimple(const LLStringExplicit& name) // virtual void LLComboBox::setValue(const LLSD& value) { - BOOL found = mList->selectByValue(value); + bool found = mList->selectByValue(value); if (found) { LLScrollListItem* item = mList->getFirstSelected(); @@ -406,9 +406,9 @@ void LLComboBox::setLabel(const LLStringExplicit& name) if ( mTextEntry ) { mTextEntry->setText(name); - if (mList->selectItemByLabel(name, FALSE)) + if (mList->selectItemByLabel(name, false)) { - mTextEntry->setTentative(FALSE); + mTextEntry->setTentative(false); mLastSelectedIndex = mList->getFirstSelectedIndex(); } else @@ -430,7 +430,7 @@ void LLComboBox::updateLabel() if (mTextEntry) { mTextEntry->setText(getSelectedItemLabel()); - mTextEntry->setTentative(FALSE); + mTextEntry->setTentative(false); } // If combo box doesn't allow text entry update @@ -441,9 +441,9 @@ void LLComboBox::updateLabel() } } -BOOL LLComboBox::remove(const std::string& name) +bool LLComboBox::remove(const std::string& name) { - BOOL found = mList->selectItemByLabel(name); + bool found = mList->selectItemByLabel(name); if (found) { @@ -458,15 +458,15 @@ BOOL LLComboBox::remove(const std::string& name) return found; } -BOOL LLComboBox::remove(S32 index) +bool LLComboBox::remove(S32 index) { if (index < mList->getItemCount()) { mList->deleteSingleItem(index); setLabel(getSelectedItemLabel()); - return TRUE; + return true; } - return FALSE; + return false; } // Keyboard focus lost. @@ -482,7 +482,7 @@ void LLComboBox::onFocusLost() LLUICtrl::onFocusLost(); } -void LLComboBox::setButtonVisible(BOOL visible) +void LLComboBox::setButtonVisible(bool visible) { mButton->setVisible(visible); if (mTextEntry) @@ -494,13 +494,13 @@ void LLComboBox::setButtonVisible(BOOL visible) text_entry_rect.mRight -= llmax(8,arrow_width) + 2 * BTN_DROP_SHADOW; } //mTextEntry->setRect(text_entry_rect); - mTextEntry->reshape(text_entry_rect.getWidth(), text_entry_rect.getHeight(), TRUE); + mTextEntry->reshape(text_entry_rect.getWidth(), text_entry_rect.getHeight(), true); } } -BOOL LLComboBox::setCurrentByIndex( S32 index ) +bool LLComboBox::setCurrentByIndex( S32 index ) { - BOOL found = mList->selectNthItem( index ); + bool found = mList->selectNthItem( index ); if (found) { setLabel(getSelectedItemLabel()); @@ -519,7 +519,7 @@ S32 LLComboBox::getCurrentIndex() const return -1; } -void LLComboBox::setEnabledByValue(const LLSD& value, BOOL enabled) +void LLComboBox::setEnabledByValue(const LLSD& value, bool enabled) { LLScrollListItem *found = mList->getItem(value); if (found) @@ -537,7 +537,7 @@ void LLComboBox::createLineEditor(const LLComboBox::Params& p) S32 shadow_size = BTN_DROP_SHADOW; mButton->setRect(LLRect( getRect().getWidth() - llmax(8,arrow_width) - 2 * shadow_size, rect.mTop, rect.mRight, rect.mBottom)); - mButton->setTabStop(FALSE); + mButton->setTabStop(false); mButton->setHAlign(LLFontGL::HCENTER); LLRect text_entry_rect(0, getRect().getHeight(), getRect().getWidth(), 0); @@ -555,7 +555,7 @@ void LLComboBox::createLineEditor(const LLComboBox::Params& p) params.label(mLabel); mTextEntry = LLUICtrlFactory::create<LLLineEditor> (params); mTextEntry->setText(cur_label); - mTextEntry->setIgnoreTab(TRUE); + mTextEntry->setIgnoreTab(true); addChild(mTextEntry); // clear label on button @@ -570,7 +570,7 @@ void LLComboBox::createLineEditor(const LLComboBox::Params& p) if (mTextEntry) { - mTextEntry->setVisible(FALSE); + mTextEntry->setVisible(false); } } } @@ -674,15 +674,15 @@ void LLComboBox::showList() // NB: this call will trigger the focuslost callback which will hide the list, so do it first // before finally showing the list - mList->setFocus(TRUE); + mList->setFocus(true); // Show the list and push the button down - mButton->setToggleState(TRUE); - mList->setVisible(TRUE); + mButton->setToggleState(true); + mList->setVisible(true); LLUI::getInstance()->addPopup(this); - setUseBoundingRect(TRUE); + setUseBoundingRect(true); // updateBoundingRect(); } @@ -701,11 +701,11 @@ void LLComboBox::hideList() else if(mLastSelectedIndex >= 0) mList->selectNthItem(mLastSelectedIndex); - mButton->setToggleState(FALSE); - mList->setVisible(FALSE); + mButton->setToggleState(false); + mList->setVisible(false); mList->mouseOverHighlightNthItem(-1); - setUseBoundingRect(FALSE); + setUseBoundingRect(false); LLUI::getInstance()->removePopup(this); // updateBoundingRect(); } @@ -731,7 +731,7 @@ void LLComboBox::onButtonMouseDown() showList(); } - setFocus( TRUE ); + setFocus( true ); // pass mouse capture on to list if button is depressed if (mButton->hasMouseCapture()) @@ -781,13 +781,13 @@ void LLComboBox::onItemSelected(const LLSD& data) onCommit(); } -BOOL LLComboBox::handleToolTip(S32 x, S32 y, MASK mask) +bool LLComboBox::handleToolTip(S32 x, S32 y, MASK mask) { std::string tool_tip; if(LLUICtrl::handleToolTip(x, y, mask)) { - return TRUE; + return true; } tool_tip = getToolTip(); @@ -802,19 +802,19 @@ BOOL LLComboBox::handleToolTip(S32 x, S32 y, MASK mask) .message(tool_tip) .sticky_rect(calcScreenRect())); } - return TRUE; + return true; } -BOOL LLComboBox::handleKeyHere(KEY key, MASK mask) +bool LLComboBox::handleKeyHere(KEY key, MASK mask) { - BOOL result = FALSE; + bool result = false; if (hasFocus()) { if (mList->getVisible() && key == KEY_ESCAPE && mask == MASK_NONE) { hideList(); - return TRUE; + return true; } //give list a chance to pop up and handle key LLScrollListItem* last_selected_item = mList->getLastSelectedItem(); @@ -837,7 +837,7 @@ BOOL LLComboBox::handleKeyHere(KEY key, MASK mask) // don't show list and don't eat key input when committing // free-form text entry with RETURN since user already knows // what they are trying to select - return FALSE; + return false; } // if selection has changed, pop open list else if (mList->getLastSelectedItem() != last_selected_item @@ -851,9 +851,9 @@ BOOL LLComboBox::handleKeyHere(KEY key, MASK mask) return result; } -BOOL LLComboBox::handleUnicodeCharHere(llwchar uni_char) +bool LLComboBox::handleUnicodeCharHere(llwchar uni_char) { - BOOL result = FALSE; + bool result = false; if (gFocusMgr.childHasKeyboardFocus(this)) { // space bar just shows the list @@ -880,12 +880,12 @@ void LLComboBox::setTextEntry(const LLStringExplicit& text) if (mTextEntry) { mTextEntry->setText(text); - mHasAutocompletedText = FALSE; + mHasAutocompletedText = false; updateSelection(); } } -void LLComboBox::setKeystrokeOnEsc(BOOL enable) +void LLComboBox::setKeystrokeOnEsc(bool enable) { if (mTextEntry) { @@ -904,9 +904,9 @@ void LLComboBox::onTextEntry(LLLineEditor* line_editor) if (key == KEY_BACKSPACE || key == KEY_DELETE) { - if (mList->selectItemByLabel(line_editor->getText(), FALSE)) + if (mList->selectItemByLabel(line_editor->getText(), false)) { - line_editor->setTentative(FALSE); + line_editor->setTentative(false); mLastSelectedIndex = mList->getFirstSelectedIndex(); } else @@ -941,7 +941,7 @@ void LLComboBox::onTextEntry(LLLineEditor* line_editor) } } line_editor->selectAll(); - line_editor->setTentative(FALSE); + line_editor->setTentative(false); } else if (key == KEY_UP) { @@ -956,7 +956,7 @@ void LLComboBox::onTextEntry(LLLineEditor* line_editor) } } line_editor->selectAll(); - line_editor->setTentative(FALSE); + line_editor->setTentative(false); } else { @@ -985,20 +985,20 @@ void LLComboBox::updateSelection() prearrangeList(mTextEntry->getText()); } - if (mList->selectItemByLabel(full_string, FALSE)) + if (mList->selectItemByLabel(full_string, false)) { - mTextEntry->setTentative(FALSE); + mTextEntry->setTentative(false); mLastSelectedIndex = mList->getFirstSelectedIndex(); } - else if (mList->selectItemByPrefix(left_wstring, FALSE)) + else if (mList->selectItemByPrefix(left_wstring, false)) { LLWString selected_item = utf8str_to_wstring(getSelectedItemLabel()); LLWString wtext = left_wstring + selected_item.substr(left_wstring.size(), selected_item.size()); mTextEntry->setText(wstring_to_utf8str(wtext)); - mTextEntry->setSelection(left_wstring.size(), mTextEntry->getWText().size()); + mTextEntry->setSelection(static_cast<S32>(left_wstring.size()), static_cast<S32>(mTextEntry->getWText().size())); mTextEntry->endSelection(); - mTextEntry->setTentative(FALSE); - mHasAutocompletedText = TRUE; + mTextEntry->setTentative(false); + mHasAutocompletedText = true; mLastSelectedIndex = mList->getFirstSelectedIndex(); } else // no matching items found @@ -1006,7 +1006,7 @@ void LLComboBox::updateSelection() mList->deselectAllItems(); mTextEntry->setText(wstring_to_utf8str(user_wstring)); // removes text added by autocompletion mTextEntry->setTentative(mTextEntryTentative); - mHasAutocompletedText = FALSE; + mHasAutocompletedText = false; mLastSelectedIndex = -1; } } @@ -1019,7 +1019,7 @@ void LLComboBox::onTextCommit(const LLSD& data) mTextEntry->selectAll(); } -void LLComboBox::setFocus(BOOL b) +void LLComboBox::setFocus(bool b) { LLUICtrl::setFocus(b); @@ -1028,7 +1028,7 @@ void LLComboBox::setFocus(BOOL b) mList->clearSearchString(); if (mList->getVisible()) { - mList->setFocus(TRUE); + mList->setFocus(true); } } } @@ -1094,7 +1094,7 @@ void LLComboBox::imageLoaded() { LLRect text_entry_rect(0, getRect().getHeight(), getRect().getWidth(), 0); text_entry_rect.mRight -= llmax(8, arrow_width) + 2 * BTN_DROP_SHADOW; - mTextEntry->reshape(text_entry_rect.getWidth(), text_entry_rect.getHeight(), TRUE); + mTextEntry->reshape(text_entry_rect.getWidth(), text_entry_rect.getHeight(), true); } } } @@ -1139,7 +1139,7 @@ void LLComboBox::clearRows() mList->clearRows(); } -void LLComboBox::sortByColumn(const std::string& name, BOOL ascending) +void LLComboBox::sortByColumn(const std::string& name, bool ascending) { mList->sortByColumn(name, ascending); } @@ -1147,9 +1147,9 @@ void LLComboBox::sortByColumn(const std::string& name, BOOL ascending) //============================================================================ //LLCtrlSelectionInterface functions -BOOL LLComboBox::setCurrentByID(const LLUUID& id) +bool LLComboBox::setCurrentByID(const LLUUID& id) { - BOOL found = mList->selectByID( id ); + bool found = mList->selectByID( id ); if (found) { @@ -1164,9 +1164,9 @@ LLUUID LLComboBox::getCurrentID() const { return mList->getStringUUIDSelectedItem(); } -BOOL LLComboBox::setSelectedByValue(const LLSD& value, BOOL selected) +bool LLComboBox::setSelectedByValue(const LLSD& value, bool selected) { - BOOL found = mList->setSelectedByValue(value, selected); + bool found = mList->setSelectedByValue(value, selected); if (found) { setLabel(getSelectedItemLabel()); @@ -1179,32 +1179,32 @@ LLSD LLComboBox::getSelectedValue() return mList->getSelectedValue(); } -BOOL LLComboBox::isSelected(const LLSD& value) const +bool LLComboBox::isSelected(const LLSD& value) const { return mList->isSelected(value); } -BOOL LLComboBox::operateOnSelection(EOperation op) +bool LLComboBox::operateOnSelection(EOperation op) { if (op == OP_DELETE) { mList->deleteSelectedItems(); - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLComboBox::operateOnAll(EOperation op) +bool LLComboBox::operateOnAll(EOperation op) { if (op == OP_DELETE) { clearRows(); - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLComboBox::selectItemRange( S32 first, S32 last ) +bool LLComboBox::selectItemRange( S32 first, S32 last ) { return mList->selectItemRange(first, last); } diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h index 93382a1022..cc1c2885fc 100644 --- a/indra/llui/llcombobox.h +++ b/indra/llui/llcombobox.h @@ -94,7 +94,7 @@ public: virtual ~LLComboBox(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); protected: friend class LLUICtrlFactory; @@ -111,18 +111,18 @@ public: // LLView interface virtual void onFocusLost(); - virtual BOOL handleToolTip(S32 x, S32 y, MASK mask); - virtual BOOL handleKeyHere(KEY key, MASK mask); - virtual BOOL handleUnicodeCharHere(llwchar uni_char); + virtual bool handleToolTip(S32 x, S32 y, MASK mask); + virtual bool handleKeyHere(KEY key, MASK mask); + virtual bool handleUnicodeCharHere(llwchar uni_char); // LLUICtrl interface virtual void clear(); // select nothing virtual void onCommit(); - virtual BOOL acceptsTextInput() const { return mAllowTextEntry; } - virtual BOOL isDirty() const; // Returns TRUE if the user has modified this control. + virtual bool acceptsTextInput() const { return mAllowTextEntry; } + virtual bool isDirty() const; // Returns true if the user has modified this control. virtual void resetDirty(); // Clear dirty state - virtual void setFocus(BOOL b); + virtual void setFocus(bool b); // Selects item by underlying LLSD value, using LLSD::asString() matching. // For simple items, this is just the name of the label. @@ -133,21 +133,21 @@ public: virtual LLSD getValue() const; void setTextEntry(const LLStringExplicit& text); - void setKeystrokeOnEsc(BOOL enable); + void setKeystrokeOnEsc(bool enable); - LLScrollListItem* add(const std::string& name, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE); // add item "name" to menu - LLScrollListItem* add(const std::string& name, const LLUUID& id, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE); - LLScrollListItem* add(const std::string& name, void* userdata, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE); - LLScrollListItem* add(const std::string& name, LLSD value, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE); + LLScrollListItem* add(const std::string& name, EAddPosition pos = ADD_BOTTOM, bool enabled = true); // add item "name" to menu + LLScrollListItem* add(const std::string& name, const LLUUID& id, EAddPosition pos = ADD_BOTTOM, bool enabled = true); + LLScrollListItem* add(const std::string& name, void* userdata, EAddPosition pos = ADD_BOTTOM, bool enabled = true); + LLScrollListItem* add(const std::string& name, LLSD value, EAddPosition pos = ADD_BOTTOM, bool enabled = true); LLScrollListItem* addSeparator(EAddPosition pos = ADD_BOTTOM); - BOOL remove( S32 index ); // remove item by index, return TRUE if found and removed + bool remove( S32 index ); // remove item by index, return true if found and removed void removeall() { clearRows(); } bool itemExists(const std::string& name); - void sortByName(BOOL ascending = TRUE); // Sort the entries in the combobox by name + void sortByName(bool ascending = true); // Sort the entries in the combobox by name - // Select current item by name using selectItemByLabel. Returns FALSE if not found. - BOOL setSimple(const LLStringExplicit& name); + // Select current item by name using selectItemByLabel. Returns false if not found. + bool setSimple(const LLStringExplicit& name); // Get name of current item. Returns an empty string if not found. const std::string getSimple() const; // Get contents of column x of selected row @@ -160,12 +160,12 @@ public: // Updates the combobox label to match the selected list item. void updateLabel(); - BOOL remove(const std::string& name); // remove item "name", return TRUE if found and removed + bool remove(const std::string& name); // remove item "name", return true if found and removed - BOOL setCurrentByIndex( S32 index ); + bool setCurrentByIndex( S32 index ); S32 getCurrentIndex() const; - void setEnabledByValue(const LLSD& value, BOOL enabled); + void setEnabledByValue(const LLSD& value, bool enabled); void createLineEditor(const Params&); @@ -183,21 +183,21 @@ public: virtual LLScrollListItem* addElement(const LLSD& value, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL); virtual LLScrollListItem* addSimpleElement(const std::string& value, EAddPosition pos = ADD_BOTTOM, const LLSD& id = LLSD()); virtual void clearRows(); - virtual void sortByColumn(const std::string& name, BOOL ascending); + virtual void sortByColumn(const std::string& name, bool ascending); // LLCtrlSelectionInterface functions - virtual BOOL getCanSelect() const { return TRUE; } - virtual BOOL selectFirstItem() { return setCurrentByIndex(0); } - virtual BOOL selectNthItem( S32 index ) { return setCurrentByIndex(index); } - virtual BOOL selectItemRange( S32 first, S32 last ); + virtual bool getCanSelect() const { return true; } + virtual bool selectFirstItem() { return setCurrentByIndex(0); } + virtual bool selectNthItem( S32 index ) { return setCurrentByIndex(index); } + virtual bool selectItemRange( S32 first, S32 last ); virtual S32 getFirstSelectedIndex() const { return getCurrentIndex(); } - virtual BOOL setCurrentByID( const LLUUID& id ); + virtual bool setCurrentByID( const LLUUID& id ); virtual LLUUID getCurrentID() const; // LLUUID::null if no items in menu - virtual BOOL setSelectedByValue(const LLSD& value, BOOL selected); + virtual bool setSelectedByValue(const LLSD& value, bool selected); virtual LLSD getSelectedValue(); - virtual BOOL isSelected(const LLSD& value) const; - virtual BOOL operateOnSelection(EOperation op); - virtual BOOL operateOnAll(EOperation op); + virtual bool isSelected(const LLSD& value) const; + virtual bool operateOnSelection(EOperation op); + virtual bool operateOnAll(EOperation op); //======================================================================== @@ -214,7 +214,7 @@ public: */ boost::signals2::connection setReturnCallback( const commit_signal_t::slot_type& cb ) { return mOnReturnSignal.connect(cb); } - void setButtonVisible(BOOL visible); + void setButtonVisible(bool visible); void onButtonMouseDown(); void onListMouseUp(); @@ -234,13 +234,13 @@ protected: EPreferredPosition mListPosition; LLPointer<LLUIImage> mArrowImage; LLUIString mLabel; - BOOL mHasAutocompletedText; + bool mHasAutocompletedText; private: - BOOL mAllowTextEntry; - BOOL mAllowNewValues; + bool mAllowTextEntry; + bool mAllowNewValues; S32 mMaxChars; - BOOL mTextEntryTentative; + bool mTextEntryTentative; commit_callback_t mPrearrangeCallback; commit_callback_t mTextEntryCallback; commit_callback_t mTextChangedCallback; diff --git a/indra/llui/llcommandmanager.cpp b/indra/llui/llcommandmanager.cpp index 270ec86e01..03717da80b 100644 --- a/indra/llui/llcommandmanager.cpp +++ b/indra/llui/llcommandmanager.cpp @@ -107,7 +107,7 @@ LLCommandManager::~LLCommandManager() U32 LLCommandManager::commandCount() const { - return mCommands.size(); + return static_cast<U32>(mCommands.size()); } LLCommand * LLCommandManager::getCommand(U32 commandIndex) diff --git a/indra/llui/llcommandmanager.h b/indra/llui/llcommandmanager.h index 3b2586a5a1..e6df0d3a4b 100644 --- a/indra/llui/llcommandmanager.h +++ b/indra/llui/llcommandmanager.h @@ -198,7 +198,7 @@ protected: void addCommand(LLCommand * command); private: - typedef std::map<LLUUID, U32> CommandIndexMap; + typedef std::map<LLUUID, size_t> CommandIndexMap; typedef std::vector<LLCommand *> CommandVector; CommandVector mCommands; diff --git a/indra/llui/llconsole.cpp b/indra/llui/llconsole.cpp index 795bf1070a..9fbfb3e5fa 100644 --- a/indra/llui/llconsole.cpp +++ b/indra/llui/llconsole.cpp @@ -77,7 +77,7 @@ void LLConsole::setLinePersistTime(F32 seconds) mFadeTime = mLinePersistTime - FADE_DURATION; } -void LLConsole::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLConsole::reshape(S32 width, S32 height, bool called_from_parent) { S32 new_width = llmax(50, llmin(getRect().getWidth(), width)); S32 new_height = llmax(llfloor(mFont->getLineHeight()) + 15, llmin(getRect().getHeight(), height)); @@ -147,11 +147,11 @@ void LLConsole::draw() return; } - U32 num_lines=0; + size_t num_lines{ 0 }; paragraph_t::reverse_iterator paragraph_it; paragraph_it = mParagraphs.rbegin(); - U32 paragraph_num=mParagraphs.size(); + auto paragraph_num=mParagraphs.size(); while (!mParagraphs.empty() && paragraph_it != mParagraphs.rend()) { @@ -159,7 +159,7 @@ void LLConsole::draw() if(num_lines > mMaxLines || ( (mLinePersistTime > (F32)0.f) && ((*paragraph_it).mAddTime - skip_time)/(mLinePersistTime - mFadeTime) <= (F32)0.f)) { //All lines above here are done. Lose them. - for (U32 i=0;i<paragraph_num;i++) + for (size_t i = 0; i < paragraph_num; i++) { if (!mParagraphs.empty()) mParagraphs.pop_front(); @@ -258,7 +258,7 @@ void LLConsole::Paragraph::makeParagraphColorSegments (const LLColor4 &color) ParagraphColorSegment color_segment; color_segment.mColor.setValue(color_llsd); - color_segment.mNumChars = color_str.length(); + color_segment.mNumChars = static_cast<S32>(color_str.length()); mParagraphColorSegments.push_back(color_segment); } @@ -310,7 +310,7 @@ void LLConsole::Paragraph::updateLines(F32 screen_width, const LLFontGL* font, b skip_chars = 0; } - U32 drawable = font->maxDrawableChars(mParagraphText.c_str()+paragraph_offset, screen_width, line_end - paragraph_offset, LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); + U32 drawable = font->maxDrawableChars(mParagraphText.c_str()+paragraph_offset, screen_width, static_cast<S32>(line_end) - paragraph_offset, LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); if (drawable != 0) { @@ -380,7 +380,7 @@ void LLConsole::updateClass() void LLConsole::update() { { - LLMutexLock lock(&mMutex); + LLCoros::LockType lock(mMutex); while (!mLines.empty()) { diff --git a/indra/llui/llconsole.h b/indra/llui/llconsole.h index d3dc1bbfde..cc9fd71d84 100644 --- a/indra/llui/llconsole.h +++ b/indra/llui/llconsole.h @@ -132,7 +132,7 @@ public: // each line lasts this long after being added void setLinePersistTime(F32 seconds); - void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + void reshape(S32 width, S32 height, bool called_from_parent = true); // -1 = monospace, 0 means small, font size = 1 means big void setFontSize(S32 size_index); diff --git a/indra/llui/llcontainerview.cpp b/indra/llui/llcontainerview.cpp index f01d66382c..4c2912cde6 100644 --- a/indra/llui/llcontainerview.cpp +++ b/indra/llui/llcontainerview.cpp @@ -57,11 +57,11 @@ LLContainerView::~LLContainerView() // Children all cleaned up by default view destructor. } -BOOL LLContainerView::postBuild() +bool LLContainerView::postBuild() { setDisplayChildren(mDisplayChildren); - reshape(getRect().getWidth(), getRect().getHeight(), FALSE); - return TRUE; + reshape(getRect().getWidth(), getRect().getHeight(), false); + return true; } bool LLContainerView::addChild(LLView* child, S32 tab_group) @@ -74,14 +74,14 @@ bool LLContainerView::addChild(LLView* child, S32 tab_group) return res; } -BOOL LLContainerView::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLContainerView::handleDoubleClick(S32 x, S32 y, MASK mask) { return handleMouseDown(x, y, mask); } -BOOL LLContainerView::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLContainerView::handleMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; if (mDisplayChildren) { handled = (LLView::childrenHandleMouseDown(x, y, mask) != NULL); @@ -91,16 +91,16 @@ BOOL LLContainerView::handleMouseDown(S32 x, S32 y, MASK mask) if( mShowLabel && (y >= getRect().getHeight() - 10) ) { setDisplayChildren(!mDisplayChildren); - reshape(getRect().getWidth(), getRect().getHeight(), FALSE); - handled = TRUE; + reshape(getRect().getWidth(), getRect().getHeight(), false); + handled = true; } } return handled; } -BOOL LLContainerView::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLContainerView::handleMouseUp(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; if (mDisplayChildren) { handled = (LLView::childrenHandleMouseUp(x, y, mask) != NULL); @@ -128,7 +128,7 @@ void LLContainerView::draw() } -void LLContainerView::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLContainerView::reshape(S32 width, S32 height, bool called_from_parent) { LLRect scroller_rect; scroller_rect.setOriginAndSize(0, 0, width, height); @@ -159,7 +159,7 @@ void LLContainerView::reshape(S32 width, S32 height, BOOL called_from_parent) } } -void LLContainerView::arrange(S32 width, S32 height, BOOL called_from_parent) +void LLContainerView::arrange(S32 width, S32 height, bool called_from_parent) { // Determine the sizes and locations of all contained views S32 total_height = 0; @@ -242,7 +242,7 @@ void LLContainerView::arrange(S32 width, S32 height, BOOL called_from_parent) { if (getParent()) { - getParent()->reshape(getParent()->getRect().getWidth(), getParent()->getRect().getHeight(), FALSE); + getParent()->reshape(getParent()->getRect().getWidth(), getParent()->getRect().getHeight(), false); } } @@ -288,7 +288,7 @@ void LLContainerView::setLabel(const std::string& label) mLabel = label; } -void LLContainerView::setDisplayChildren(BOOL displayChildren) +void LLContainerView::setDisplayChildren(bool displayChildren) { mDisplayChildren = displayChildren; for (child_list_const_iter_t child_iter = getChildList()->begin(); diff --git a/indra/llui/llcontainerview.h b/indra/llui/llcontainerview.h index 118d3a967c..319fb7d5e9 100644 --- a/indra/llui/llcontainerview.h +++ b/indra/llui/llcontainerview.h @@ -49,8 +49,8 @@ public: Optional<bool> display_children; Params() : label("label"), - show_label("show_label", FALSE), - display_children("display_children", TRUE) + show_label("show_label", false), + display_children("display_children", true) { changeDefault(mouse_opaque, false); } @@ -65,30 +65,30 @@ protected: public: ~LLContainerView(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ bool addChild(LLView* view, S32 tab_group = 0); - /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleDoubleClick(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask); /*virtual*/ void draw(); - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true); /*virtual*/ LLRect getRequiredRect(); // Return the height of this object, given the set options. void setLabel(const std::string& label); - void showLabel(BOOL show) { mShowLabel = show; } - void setDisplayChildren(BOOL displayChildren); - BOOL getDisplayChildren() { return mDisplayChildren; } + void showLabel(bool show) { mShowLabel = show; } + void setDisplayChildren(bool displayChildren); + bool getDisplayChildren() { return mDisplayChildren; } void setScrollContainer(LLScrollContainer* scroll) {mScrollContainer = scroll;} private: LLScrollContainer* mScrollContainer; - void arrange(S32 width, S32 height, BOOL called_from_parent = TRUE); - BOOL mShowLabel; + void arrange(S32 width, S32 height, bool called_from_parent = true); + bool mShowLabel; protected: - BOOL mDisplayChildren; + bool mDisplayChildren; std::string mLabel; }; #endif // LL_CONTAINERVIEW_ diff --git a/indra/llui/llctrlselectioninterface.cpp b/indra/llui/llctrlselectioninterface.cpp index 10e5a75bff..0a5512afa1 100644 --- a/indra/llui/llctrlselectioninterface.cpp +++ b/indra/llui/llctrlselectioninterface.cpp @@ -33,14 +33,14 @@ LLCtrlSelectionInterface::~LLCtrlSelectionInterface() { } -BOOL LLCtrlSelectionInterface::selectByValue(LLSD value) +bool LLCtrlSelectionInterface::selectByValue(LLSD value) { - return setSelectedByValue(value, TRUE); + return setSelectedByValue(value, true); } -BOOL LLCtrlSelectionInterface::deselectByValue(LLSD value) +bool LLCtrlSelectionInterface::deselectByValue(LLSD value) { - return setSelectedByValue(value, FALSE); + return setSelectedByValue(value, false); } diff --git a/indra/llui/llctrlselectioninterface.h b/indra/llui/llctrlselectioninterface.h index 56dd7a7415..c845f7027d 100644 --- a/indra/llui/llctrlselectioninterface.h +++ b/indra/llui/llctrlselectioninterface.h @@ -47,29 +47,29 @@ public: OP_DESELECT, }; - virtual BOOL getCanSelect() const = 0; + virtual bool getCanSelect() const = 0; virtual S32 getItemCount() const = 0; - virtual BOOL selectFirstItem() = 0; - virtual BOOL selectNthItem( S32 index ) = 0; - virtual BOOL selectItemRange( S32 first, S32 last ) = 0; + virtual bool selectFirstItem() = 0; + virtual bool selectNthItem( S32 index ) = 0; + virtual bool selectItemRange( S32 first, S32 last ) = 0; virtual S32 getFirstSelectedIndex() const = 0; // TomY TODO: Simply cast the UUIDs to LLSDs, using the selectByValue function - virtual BOOL setCurrentByID( const LLUUID& id ) = 0; + virtual bool setCurrentByID( const LLUUID& id ) = 0; virtual LLUUID getCurrentID() const = 0; - BOOL selectByValue(const LLSD value); - BOOL deselectByValue(const LLSD value); - virtual BOOL setSelectedByValue(const LLSD& value, BOOL selected) = 0; + bool selectByValue(const LLSD value); + bool deselectByValue(const LLSD value); + virtual bool setSelectedByValue(const LLSD& value, bool selected) = 0; virtual LLSD getSelectedValue() = 0; - virtual BOOL isSelected(const LLSD& value) const = 0; + virtual bool isSelected(const LLSD& value) const = 0; - virtual BOOL operateOnSelection(EOperation op) = 0; - virtual BOOL operateOnAll(EOperation op) = 0; + virtual bool operateOnSelection(EOperation op) = 0; + virtual bool operateOnAll(EOperation op) = 0; }; class LLCtrlListInterface : public LLCtrlSelectionInterface @@ -88,7 +88,7 @@ public: virtual LLScrollListItem* addSimpleElement(const std::string& value, EAddPosition pos, const LLSD& id) = 0; virtual void clearRows() = 0; - virtual void sortByColumn(const std::string& name, BOOL ascending) = 0; + virtual void sortByColumn(const std::string& name, bool ascending) = 0; }; class LLCtrlScrollInterface diff --git a/indra/llui/lldockablefloater.cpp b/indra/llui/lldockablefloater.cpp index 22e1ac4334..19ae03cdf9 100644 --- a/indra/llui/lldockablefloater.cpp +++ b/indra/llui/lldockablefloater.cpp @@ -40,9 +40,9 @@ void LLDockableFloater::init(LLDockableFloater* thiz) thiz->resetInstance(); // all dockable floaters should have close, dock and minimize buttons - thiz->setCanClose(TRUE); + thiz->setCanClose(true); thiz->setCanDock(true); - thiz->setCanMinimize(TRUE); + thiz->setCanMinimize(true); thiz->setOverlapsScreenChannel(false); thiz->mForceDocking = false; } @@ -74,7 +74,7 @@ LLDockableFloater::~LLDockableFloater() { } -BOOL LLDockableFloater::postBuild() +bool LLDockableFloater::postBuild() { // Remember we should force docking when the floater is opened for the first time if (mIsDockedStateForcedCallback != NULL && mIsDockedStateForcedCallback()) @@ -108,14 +108,14 @@ void LLDockableFloater::toggleInstance(const LLSD& sdname) // if floater undocked else if (instance != NULL) { - instance->setMinimized(FALSE); + instance->setMinimized(false); if (instance->getVisible()) { - instance->setVisible(FALSE); + instance->setVisible(false); } else { - instance->setVisible(TRUE); + instance->setVisible(true); gFloaterView->bringToFront(instance); } } @@ -127,13 +127,13 @@ void LLDockableFloater::resetInstance() { if (sInstanceHandle.get() != NULL && sInstanceHandle.get()->isDocked()) { - sInstanceHandle.get()->setVisible(FALSE); + sInstanceHandle.get()->setVisible(false); } sInstanceHandle = getHandle(); } } -void LLDockableFloater::setVisible(BOOL visible) +void LLDockableFloater::setVisible(bool visible) { // Force docking if requested if (visible && mForceDocking) @@ -160,12 +160,12 @@ void LLDockableFloater::setVisible(BOOL visible) LLFloater::setVisible(visible); } -void LLDockableFloater::setMinimized(BOOL minimize) +void LLDockableFloater::setMinimized(bool minimize) { if(minimize && isDocked()) { // minimizing a docked floater just hides it - setVisible(FALSE); + setVisible(false); } else { @@ -185,14 +185,14 @@ LLView * LLDockableFloater::getDockWidget() void LLDockableFloater::onDockHidden() { - setCanDock(FALSE); + setCanDock(false); } void LLDockableFloater::onDockShown() { if (!isMinimized()) { - setCanDock(TRUE); + setCanDock(true); } } diff --git a/indra/llui/lldockablefloater.h b/indra/llui/lldockablefloater.h index e7ceb235a7..3effc977db 100644 --- a/indra/llui/lldockablefloater.h +++ b/indra/llui/lldockablefloater.h @@ -81,7 +81,7 @@ public: * If descendant class overrides postBuild() in order to perform specific * construction then it must still invoke its superclass' implementation. */ - /* virtula */BOOL postBuild(); + /* virtula */bool postBuild(); /* virtual */void setDocked(bool docked, bool pop_on_undock = true); /* virtual */void draw(); @@ -89,13 +89,13 @@ public: * If descendant class overrides setVisible() then it must still invoke its * superclass' implementation. */ - /*virtual*/ void setVisible(BOOL visible); + /*virtual*/ void setVisible(bool visible); /** * If descendant class overrides setMinimized() then it must still invoke its * superclass' implementation. */ - /*virtual*/ void setMinimized(BOOL minimize); + /*virtual*/ void setMinimized(bool minimize); LLView * getDockWidget(); @@ -129,7 +129,7 @@ protected: // Checks if docking should be forced. // It may be useful e.g. if floater created in mouselook mode (see EXT-5609) - boost::function<BOOL ()> mIsDockedStateForcedCallback; + boost::function<bool ()> mIsDockedStateForcedCallback; private: std::unique_ptr<LLDockControl> mDockControl; diff --git a/indra/llui/lldraghandle.cpp b/indra/llui/lldraghandle.cpp index dbec1d5d80..15536178ab 100644 --- a/indra/llui/lldraghandle.cpp +++ b/indra/llui/lldraghandle.cpp @@ -57,7 +57,7 @@ LLDragHandle::LLDragHandle(const LLDragHandle::Params& p) mLastMouseScreenY( 0 ), mTitleBox( NULL ), mMaxTitleWidth( 0 ), - mForeground( TRUE ), + mForeground( true ), mDragHighlightColor(p.drag_highlight_color()), mDragShadowColor(p.drag_shadow_color()) @@ -79,7 +79,7 @@ void LLDragHandle::initFromParams(const LLDragHandle::Params& p) setTitle( p.label ); } -void LLDragHandle::setTitleVisible(BOOL visible) +void LLDragHandle::setTitleVisible(bool visible) { if(mTitleBox) { @@ -160,7 +160,7 @@ void LLDragHandleTop::draw() LLRect title_rect = mTitleBox->getRect(); S32 title_right = title_rect.mLeft + mTitleWidth; - BOOL show_right_side = title_right < getRect().getWidth(); + bool show_right_side = title_right < getRect().getWidth(); for( S32 i=0; i<4; i++ ) { @@ -211,7 +211,7 @@ void LLDragHandleLeft::draw() // no titles yet //LLRect title_rect = mTitleBox->getRect(); //S32 title_right = title_rect.mLeft + mTitleWidth; - //BOOL show_right_side = title_right < getRect().getWidth(); + //bool show_right_side = title_right < getRect().getWidth(); S32 line = left; for( S32 i=0; i<4; i++ ) @@ -256,13 +256,13 @@ void LLDragHandleTop::reshapeTitleBox() mTitleBox->setShape( title_rect ); } -void LLDragHandleTop::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLDragHandleTop::reshape(S32 width, S32 height, bool called_from_parent) { LLView::reshape(width, height, called_from_parent); reshapeTitleBox(); } -void LLDragHandleLeft::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLDragHandleLeft::reshape(S32 width, S32 height, bool called_from_parent) { LLView::reshape(width, height, called_from_parent); } @@ -271,7 +271,7 @@ void LLDragHandleLeft::reshape(S32 width, S32 height, BOOL called_from_parent) // UI event handling //------------------------------------------------------------- -BOOL LLDragHandle::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLDragHandle::handleMouseDown(S32 x, S32 y, MASK mask) { // Route future Mouse messages here preemptively. (Release on mouse up.) // No handler needed for focus lost since this clas has no state that depends on it. @@ -282,11 +282,11 @@ BOOL LLDragHandle::handleMouseDown(S32 x, S32 y, MASK mask) mLastMouseScreenY = mDragLastScreenY; // Note: don't pass on to children - return TRUE; + return true; } -BOOL LLDragHandle::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLDragHandle::handleMouseUp(S32 x, S32 y, MASK mask) { if( hasMouseCapture() ) { @@ -295,13 +295,13 @@ BOOL LLDragHandle::handleMouseUp(S32 x, S32 y, MASK mask) } // Note: don't pass on to children - return TRUE; + return true; } -BOOL LLDragHandle::handleHover(S32 x, S32 y, MASK mask) +bool LLDragHandle::handleHover(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; // We only handle the click if the click both started and ended within us if( hasMouseCapture() ) @@ -324,11 +324,11 @@ BOOL LLDragHandle::handleHover(S32 x, S32 y, MASK mask) delta_y >= SLOP) { parent->setDocked(false, false); - return TRUE; + return true; } else { - return FALSE; + return false; } } @@ -367,13 +367,13 @@ BOOL LLDragHandle::handleHover(S32 x, S32 y, MASK mask) getWindow()->setCursor(UI_CURSOR_ARROW); LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (active)" <<LL_ENDL; - handled = TRUE; + handled = true; } else { getWindow()->setCursor(UI_CURSOR_ARROW); LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (inactive)" << LL_ENDL; - handled = TRUE; + handled = true; } // Note: don't pass on to children diff --git a/indra/llui/lldraghandle.h b/indra/llui/lldraghandle.h index f61dae8dc3..a522e63243 100644 --- a/indra/llui/lldraghandle.h +++ b/indra/llui/lldraghandle.h @@ -61,20 +61,20 @@ public: virtual void setValue(const LLSD& value); - void setForeground(BOOL b) { mForeground = b; } - BOOL getForeground() const { return mForeground; } + void setForeground(bool b) { mForeground = b; } + bool getForeground() const { return mForeground; } void setMaxTitleWidth(S32 max_width) {mMaxTitleWidth = llmin(max_width, mMaxTitleWidth); } S32 getMaxTitleWidth() const { return mMaxTitleWidth; } void setButtonsRect(const LLRect& rect){ mButtonsRect = rect; } LLRect getButtonsRect() { return mButtonsRect; } - void setTitleVisible(BOOL visible); + void setTitleVisible(bool visible); virtual void setTitle( const std::string& title ) = 0; virtual std::string getTitle() const = 0; - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleHover(S32 x, S32 y, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); protected: LLDragHandle(const Params&); @@ -93,7 +93,7 @@ private: LLUIColor mDragHighlightColor; LLUIColor mDragShadowColor; S32 mMaxTitleWidth; - BOOL mForeground; + bool mForeground; // Pixels near the edge to snap floaters. static S32 sSnapMargin; @@ -111,7 +111,7 @@ public: virtual void setTitle( const std::string& title ); virtual std::string getTitle() const; virtual void draw(); - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + virtual void reshape(S32 width, S32 height, bool called_from_parent = true); private: void reshapeTitleBox(); @@ -129,7 +129,7 @@ public: virtual void setTitle( const std::string& title ); virtual std::string getTitle() const; virtual void draw(); - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + virtual void reshape(S32 width, S32 height, bool called_from_parent = true); }; diff --git a/indra/llui/lleditmenuhandler.h b/indra/llui/lleditmenuhandler.h index f516b0f2e2..ff111c16a7 100644 --- a/indra/llui/lleditmenuhandler.h +++ b/indra/llui/lleditmenuhandler.h @@ -35,29 +35,29 @@ public: virtual ~LLEditMenuHandler(); virtual void undo() {}; - virtual BOOL canUndo() const { return FALSE; } + virtual bool canUndo() const { return false; } virtual void redo() {}; - virtual BOOL canRedo() const { return FALSE; } + virtual bool canRedo() const { return false; } virtual void cut() {}; - virtual BOOL canCut() const { return FALSE; } + virtual bool canCut() const { return false; } virtual void copy() {}; - virtual BOOL canCopy() const { return FALSE; } + virtual bool canCopy() const { return false; } virtual void paste() {}; - virtual BOOL canPaste() const { return FALSE; } + virtual bool canPaste() const { return false; } // "delete" is a keyword virtual void doDelete() {}; - virtual BOOL canDoDelete() const { return FALSE; } + virtual bool canDoDelete() const { return false; } virtual void selectAll() {}; - virtual BOOL canSelectAll() const { return FALSE; } + virtual bool canSelectAll() const { return false; } virtual void deselect() {}; - virtual BOOL canDeselect() const { return FALSE; } + virtual bool canDeselect() const { return false; } // TODO: Instead of being a public data member, it would be better to hide it altogether // and have a "set" method and then a bunch of static versions of the cut, copy, paste diff --git a/indra/llui/llemojidictionary.cpp b/indra/llui/llemojidictionary.cpp index f16c38a11a..925608e47e 100644 --- a/indra/llui/llemojidictionary.cpp +++ b/indra/llui/llemojidictionary.cpp @@ -210,7 +210,7 @@ void LLEmojiDictionary::findByShortCode( std::size_t begin, end; if (searchInShortCode(begin, end, shortCode, needle)) { - results[begin].emplace_back(d.Character, shortCode, begin, end); + results[static_cast<llwchar>(begin)].emplace_back(d.Character, shortCode, begin, end); } } } diff --git a/indra/llui/llfiltereditor.cpp b/indra/llui/llfiltereditor.cpp index 7a5f342cd5..f7b3a1e9a6 100644 --- a/indra/llui/llfiltereditor.cpp +++ b/indra/llui/llfiltereditor.cpp @@ -33,7 +33,7 @@ LLFilterEditor::LLFilterEditor(const LLFilterEditor::Params& p) : LLSearchEditor(p) { - setCommitOnFocusLost(FALSE); // we'll commit on every keystroke, don't re-commit when we take focus away (i.e. we go to interact with the actual results!) + setCommitOnFocusLost(false); // we'll commit on every keystroke, don't re-commit when we take focus away (i.e. we go to interact with the actual results!) } diff --git a/indra/llui/llflashtimer.cpp b/indra/llui/llflashtimer.cpp index 2de05f04c5..c3db24c987 100644 --- a/indra/llui/llflashtimer.cpp +++ b/indra/llui/llflashtimer.cpp @@ -53,7 +53,7 @@ void LLFlashTimer::unset() mCallback = NULL; } -BOOL LLFlashTimer::tick() +bool LLFlashTimer::tick() { mIsCurrentlyHighlighted = !mIsCurrentlyHighlighted; diff --git a/indra/llui/llflashtimer.h b/indra/llui/llflashtimer.h index 037e32ac50..b55ce53fc0 100644 --- a/indra/llui/llflashtimer.h +++ b/indra/llui/llflashtimer.h @@ -46,7 +46,7 @@ public: LLFlashTimer(callback_t cb = NULL, S32 count = 0, F32 period = 0.0); ~LLFlashTimer() {}; - /*virtual*/ BOOL tick(); + /*virtual*/ bool tick(); void startFlashing(); void stopFlashing(); diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp index cd866f1625..1799968afb 100644 --- a/indra/llui/llflatlistview.cpp +++ b/indra/llui/llflatlistview.cpp @@ -48,7 +48,7 @@ LLFlatListView::Params::Params() no_items_text("no_items_text") {}; -void LLFlatListView::reshape(S32 width, S32 height, BOOL called_from_parent /* = TRUE */) +void LLFlatListView::reshape(S32 width, S32 height, bool called_from_parent /* = true */) { S32 delta = height - getRect().getHeight(); LLScrollContainer::reshape(width, height, called_from_parent); @@ -390,7 +390,7 @@ U32 LLFlatListView::size(const bool only_visible_items) const } else { - return mItemPairs.size(); + return static_cast<U32>(mItemPairs.size()); } } @@ -528,7 +528,7 @@ void LLFlatListView::draw() } // virtual -BOOL LLFlatListView::postBuild() +bool LLFlatListView::postBuild() { setTabStop(true); return LLScrollContainer::postBuild(); @@ -563,7 +563,7 @@ void LLFlatListView::rearrangeItems() } // add paddings between items, excluding invisible ones - height += mItemPad * (mItemPairs.size() - invisible_children_count - 1); + height += mItemPad * (static_cast<S32>(mItemPairs.size()) - invisible_children_count - 1); LLRect rc = mItemsPanel->getRect(); S32 width = mItemsNoScrollWidth; @@ -610,7 +610,7 @@ void LLFlatListView::onItemMouseClick(item_pair_t* item_pair, MASK mask) return; } - setFocus(TRUE); + setFocus(true); bool select_item = !isSelected(item_pair); @@ -714,10 +714,10 @@ void LLFlatListView::onItemRightMouseClick(item_pair_t* item_pair, MASK mask) onItemMouseClick(item_pair, mask); } -BOOL LLFlatListView::handleKeyHere(KEY key, MASK mask) +bool LLFlatListView::handleKeyHere(KEY key, MASK mask) { - BOOL reset_selection = (mask != MASK_SHIFT); - BOOL handled = FALSE; + bool reset_selection = (mask != MASK_SHIFT); + bool handled = false; switch (key) { case KEY_RETURN: @@ -725,7 +725,7 @@ BOOL LLFlatListView::handleKeyHere(KEY key, MASK mask) if (mSelectedItemPairs.size() && mask == MASK_NONE) { mOnReturnSignal(this, getValue()); - handled = TRUE; + handled = true; } break; } @@ -753,7 +753,7 @@ BOOL LLFlatListView::handleKeyHere(KEY key, MASK mask) { if (mask == MASK_NONE) { - setFocus(FALSE); // pass focus to the game area (EXT-8357) + setFocus(false); // pass focus to the game area (EXT-8357) } break; } @@ -779,7 +779,7 @@ BOOL LLFlatListView::handleKeyHere(KEY key, MASK mask) localRectToScreen(selected_rc, &screen_rc); notifyParent(LLSD().with("scrollToShowRect",screen_rc.getValue()));*/ - handled = TRUE; + handled = true; } return handled ? handled : LLScrollContainer::handleKeyHere(key, mask); @@ -1040,7 +1040,7 @@ bool LLFlatListView::selectNextItemPair(bool is_up_direction, bool reset_selecti return false; } -BOOL LLFlatListView::canSelectAll() const +bool LLFlatListView::canSelectAll() const { return 0 != size() && mAllowSelection && mMultipleSelection; } @@ -1198,14 +1198,14 @@ void LLFlatListView::onFocusReceived() { if (size()) { - mSelectedItemsBorder->setVisible(TRUE); + mSelectedItemsBorder->setVisible(true); } gEditMenuHandler = this; } // virtual void LLFlatListView::onFocusLost() { - mSelectedItemsBorder->setVisible(FALSE); + mSelectedItemsBorder->setVisible(false); // Route menu back to the default if (gEditMenuHandler == this) { @@ -1376,7 +1376,7 @@ bool LLFlatListViewEx::updateItemVisibility(LLPanel* item, const LLSD &action) if (!item) return false; - BOOL visible = TRUE; + bool visible = true; // 0 signifies that filter is matched, // i.e. we don't hide items that don't support 'match_filter' action, separators etc. @@ -1390,7 +1390,7 @@ bool LLFlatListViewEx::updateItemVisibility(LLPanel* item, const LLSD &action) if (!mForceShowingUnmatchedItems) { selectItem(item, false); - visible = FALSE; + visible = false; } } diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h index ba269a7d78..6d75e9f282 100644 --- a/indra/llui/llflatlistview.h +++ b/indra/llui/llflatlistview.h @@ -113,7 +113,7 @@ public: }; // disable traversal when finding widget to hand focus off to - /*virtual*/ BOOL canFocusChildren() const { return FALSE; } + /*virtual*/ bool canFocusChildren() const { return false; } /** * Connects callback to signal called when Return key is pressed. @@ -121,7 +121,7 @@ public: boost::signals2::connection setReturnCallback( const commit_signal_t::slot_type& cb ) { return mOnReturnSignal.connect(cb); } /** Overridden LLPanel's reshape, height is ignored, the list sets its height to accommodate all items */ - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + virtual void reshape(S32 width, S32 height, bool called_from_parent = true); /** Returns full rect of child panel */ const LLRect& getItemsRect() const; @@ -264,7 +264,7 @@ public: void setCommitOnSelectionChange(bool b) { mCommitOnSelectionChange = b; } /** Get number of selected items in the list */ - U32 numSelected() const {return mSelectedItemPairs.size(); } + U32 numSelected() const {return static_cast<U32>(mSelectedItemPairs.size()); } /** Get number of (visible) items in the list */ U32 size(const bool only_visible_items = true) const; @@ -346,7 +346,7 @@ protected: virtual bool selectNextItemPair(bool is_up_direction, bool reset_selection); - virtual BOOL canSelectAll() const; + virtual bool canSelectAll() const; virtual void selectAll(); virtual bool isSelected(item_pair_t* item_pair) const; @@ -364,9 +364,9 @@ protected: */ void notifyParentItemsRectChanged(); - virtual BOOL handleKeyHere(KEY key, MASK mask); + virtual bool handleKeyHere(KEY key, MASK mask); - virtual BOOL postBuild(); + virtual bool postBuild(); virtual void onFocusReceived(); diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 75254f80d8..e6ecf3c283 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -116,7 +116,7 @@ LLFloater::click_callback LLFloater::sButtonCallbacks[BUTTON_COUNT] = }; LLMultiFloater* LLFloater::sHostp = NULL; -BOOL LLFloater::sQuitting = FALSE; // Flag to prevent storing visibility controls while quitting +bool LLFloater::sQuitting = false; // Flag to prevent storing visibility controls while quitting LLFloaterView* gFloaterView = NULL; @@ -261,15 +261,15 @@ LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p) mHeaderHeight(p.header_height), mLegacyHeaderHeight(p.legacy_header_height), mDefaultRectForGroup(true), - mMinimized(FALSE), - mForeground(FALSE), - mFirstLook(TRUE), + mMinimized(false), + mForeground(false), + mFirstLook(true), mButtonScale(1.0f), - mAutoFocus(TRUE), // automatically take focus when opened + mAutoFocus(true), // automatically take focus when opened mCanDock(false), mDocked(false), mTornOff(false), - mHasBeenDraggedWhileMinimized(FALSE), + mHasBeenDraggedWhileMinimized(false), mPreviousMinimizedBottom(0), mPreviousMinimizedLeft(0), mDefaultRelativeX(p.rel_x), @@ -281,10 +281,10 @@ LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p) // mNotificationContext = new LLFloaterNotificationContext(getHandle()); // Clicks stop here. - setMouseOpaque(TRUE); + setMouseOpaque(true); // Floaters always draw their background, unlike every other panel. - setBackgroundVisible(TRUE); + setBackgroundVisible(true); // Floaters start not minimized. When minimized, they save their // prior rectangle to be used on restore. @@ -307,28 +307,28 @@ void LLFloater::initFloater(const Params& p) // Close button. if (mCanClose) { - mButtonsEnabled[BUTTON_CLOSE] = TRUE; + mButtonsEnabled[BUTTON_CLOSE] = true; } // Help button: '?' //SL-14050 Disable all Help question marks - mButtonsEnabled[BUTTON_HELP] = FALSE; + mButtonsEnabled[BUTTON_HELP] = false; // Minimize button only for top draggers if ( !mDragOnLeft && mCanMinimize ) { - mButtonsEnabled[BUTTON_MINIMIZE] = TRUE; + mButtonsEnabled[BUTTON_MINIMIZE] = true; } if(mCanDock) { - mButtonsEnabled[BUTTON_DOCK] = TRUE; + mButtonsEnabled[BUTTON_DOCK] = true; } buildButtons(p); // Floaters are created in the invisible state - setVisible(FALSE); + setVisible(false); if (!getParent()) { @@ -530,7 +530,7 @@ LLFloater::~LLFloater() // This is important so that floaters with persistent rects (i.e., those // created with rect control rather than an LLRect) are restored in their // correct, non-minimized positions. - setMinimized( FALSE ); + setMinimized( false ); delete mDragHandle; for (S32 i = 0; i < 4; i++) @@ -598,12 +598,12 @@ LLControlGroup* LLFloater::getControlGroup() return LLUI::getInstance()->mSettingGroups["account"]; } -void LLFloater::setVisible( BOOL visible ) +void LLFloater::setVisible( bool visible ) { LLPanel::setVisible(visible); // calls onVisibilityChange() if( visible && mFirstLook ) { - mFirstLook = FALSE; + mFirstLook = false; } if( !visible ) @@ -632,7 +632,7 @@ void LLFloater::setVisible( BOOL visible ) } -void LLFloater::setIsSingleInstance(BOOL is_single_instance) +void LLFloater::setIsSingleInstance(bool is_single_instance) { mSingleInstance = is_single_instance; if (!mIsReuseInitialized) @@ -643,12 +643,12 @@ void LLFloater::setIsSingleInstance(BOOL is_single_instance) // virtual -void LLFloater::onVisibilityChange ( BOOL new_visibility ) +void LLFloater::onVisibilityChange ( bool new_visibility ) { if (new_visibility) { if (getHost()) - getHost()->setFloaterFlashing(this, FALSE); + getHost()->setFloaterFlashing(this, false); } LLPanel::onVisibilityChange ( new_visibility ); } @@ -681,7 +681,7 @@ void LLFloater::openFloater(const LLSD& key) if (getHost() != NULL) { - getHost()->setMinimized(FALSE); + getHost()->setMinimized(false); getHost()->setVisibleAndFrontmost(mAutoFocus && !getIsChrome()); getHost()->showFloater(this); } @@ -693,7 +693,7 @@ void LLFloater::openFloater(const LLSD& key) floater_to_stack = LLFloaterReg::getLastFloaterCascading(); } applyControlsAndPosition(floater_to_stack); - setMinimized(FALSE); + setMinimized(false); setVisibleAndFrontmost(mAutoFocus && !getIsChrome()); } @@ -714,7 +714,7 @@ void LLFloater::closeFloater(bool app_quitting) // Always unminimize before trying to close. // Most of the time the user will never see this state. - setMinimized(FALSE); + setMinimized(false); if (canClose()) { @@ -746,7 +746,7 @@ void LLFloater::closeFloater(bool app_quitting) LLFloater* dependee = mDependeeHandle.get(); if (dependee && !dependee->isDead()) { - dependee->setFocus(TRUE); + dependee->setFocus(true); } } } @@ -788,11 +788,11 @@ void LLFloater::closeFloater(bool app_quitting) // Hide the instance if (getHost()) { - getHost()->setVisible(FALSE); + getHost()->setVisible(false); } else { - setVisible(FALSE); + setVisible(false); if (!mReuseInstance) { destroy(); @@ -801,7 +801,7 @@ void LLFloater::closeFloater(bool app_quitting) } else { - setVisible(FALSE); // hide before destroying (so onVisibilityChange() gets called) + setVisible(false); // hide before destroying (so onVisibilityChange() gets called) if (!mReuseInstance) { destroy(); @@ -825,7 +825,7 @@ void LLFloater::closeHostedFloater() } /*virtual*/ -void LLFloater::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLFloater::reshape(S32 width, S32 height, bool called_from_parent) { LLPanel::reshape(width, height, called_from_parent); } @@ -852,7 +852,7 @@ void LLFloater::releaseFocus() { LLUI::getInstance()->removePopup(this); - setFocus(FALSE); + setFocus(false); if( gFocusMgr.childHasMouseCapture( this ) ) { @@ -1126,12 +1126,12 @@ std::string LLFloater::getShortTitle() const } } -BOOL LLFloater::canSnapTo(const LLView* other_view) +bool LLFloater::canSnapTo(const LLView* other_view) { if (NULL == other_view) { LL_WARNS() << "other_view is NULL" << LL_ENDL; - return FALSE; + return false; } if (other_view != getParent()) @@ -1142,7 +1142,7 @@ BOOL LLFloater::canSnapTo(const LLView* other_view) && mDependents.find(other_floaterp->getHandle()) != mDependents.end()) { // this is a dependent that is already snapped to us, so don't snap back to it - return FALSE; + return false; } } @@ -1232,16 +1232,16 @@ void LLFloater::handleReshape(const LLRect& new_rect, bool by_user) else { // If minimized, and origin has changed, set - // mHasBeenDraggedWhileMinimized to TRUE + // mHasBeenDraggedWhileMinimized to true if ((new_rect.mLeft != old_rect.mLeft) || (new_rect.mBottom != old_rect.mBottom)) { - mHasBeenDraggedWhileMinimized = TRUE; + mHasBeenDraggedWhileMinimized = true; } } } -void LLFloater::setMinimized(BOOL minimize) +void LLFloater::setMinimized(bool minimize) { const LLFloater::Params& default_params = LLFloater::getDefaultParams(); S32 floater_header_size = default_params.header_height; @@ -1257,7 +1257,7 @@ void LLFloater::setMinimized(BOOL minimize) if (minimize) { // minimized flag should be turned on before release focus - mMinimized = TRUE; + mMinimized = true; mExpandedRect = getRect(); // If the floater has been dragged while minimized in the @@ -1276,11 +1276,11 @@ void LLFloater::setMinimized(BOOL minimize) if (mButtonsEnabled[BUTTON_MINIMIZE]) { - mButtonsEnabled[BUTTON_MINIMIZE] = FALSE; - mButtonsEnabled[BUTTON_RESTORE] = TRUE; + mButtonsEnabled[BUTTON_MINIMIZE] = false; + mButtonsEnabled[BUTTON_RESTORE] = true; } - setBorderVisible(TRUE); + setBorderVisible(true); for(handle_set_iter_t dependent_it = mDependents.begin(); dependent_it != mDependents.end(); @@ -1291,11 +1291,11 @@ void LLFloater::setMinimized(BOOL minimize) { if (floaterp->isMinimizeable()) { - floaterp->setMinimized(TRUE); + floaterp->setMinimized(true); } else if (!floaterp->isMinimized()) { - floaterp->setVisible(FALSE); + floaterp->setVisible(false); } } } @@ -1307,16 +1307,16 @@ void LLFloater::setMinimized(BOOL minimize) { if (mResizeBar[i] != NULL) { - mResizeBar[i]->setEnabled(FALSE); + mResizeBar[i]->setEnabled(false); } if (mResizeHandle[i] != NULL) { - mResizeHandle[i]->setEnabled(FALSE); + mResizeHandle[i]->setEnabled(false); } } // Reshape *after* setting mMinimized - reshape( minimized_width, floater_header_size, TRUE); + reshape( minimized_width, floater_header_size, true); } else { @@ -1332,8 +1332,8 @@ void LLFloater::setMinimized(BOOL minimize) setOrigin( mExpandedRect.mLeft, mExpandedRect.mBottom ); if (mButtonsEnabled[BUTTON_RESTORE]) { - mButtonsEnabled[BUTTON_MINIMIZE] = TRUE; - mButtonsEnabled[BUTTON_RESTORE] = FALSE; + mButtonsEnabled[BUTTON_MINIMIZE] = true; + mButtonsEnabled[BUTTON_RESTORE] = false; } // show dependent floater @@ -1344,8 +1344,8 @@ void LLFloater::setMinimized(BOOL minimize) LLFloater* floaterp = dependent_it->get(); if (floaterp) { - floaterp->setMinimized(FALSE); - floaterp->setVisible(TRUE); + floaterp->setMinimized(false); + floaterp->setVisible(true); } } @@ -1361,10 +1361,10 @@ void LLFloater::setMinimized(BOOL minimize) } } - mMinimized = FALSE; + mMinimized = false; setFrontmost(); // Reshape *after* setting mMinimized - reshape( mExpandedRect.getWidth(), mExpandedRect.getHeight(), TRUE ); + reshape( mExpandedRect.getWidth(), mExpandedRect.getHeight(), true ); } make_ui_sound("UISndWindowClose"); @@ -1372,7 +1372,7 @@ void LLFloater::setMinimized(BOOL minimize) applyTitle (); } -void LLFloater::setFocus( BOOL b ) +void LLFloater::setFocus( bool b ) { if (b && getIsChrome()) { @@ -1380,7 +1380,7 @@ void LLFloater::setFocus( BOOL b ) } LLView* last_focus = gFocusMgr.getLastFocusForGroup(this); // a descendent already has focus - BOOL child_had_focus = hasFocus(); + bool child_had_focus = hasFocus(); // give focus to first valid descendent LLPanel::setFocus(b); @@ -1403,7 +1403,7 @@ void LLFloater::setFocus( BOOL b ) last_focus->isInVisibleChain()) { // *FIX: should handle case where focus doesn't stick - last_focus->setFocus(TRUE); + last_focus->setFocus(true); } } updateTransparency(b ? TT_ACTIVE : TT_INACTIVE); @@ -1418,15 +1418,15 @@ void LLFloater::setRect(const LLRect &rect) } // virtual -void LLFloater::setIsChrome(BOOL is_chrome) +void LLFloater::setIsChrome(bool is_chrome) { // chrome floaters don't take focus at all if (is_chrome) { // remove focus if we're changing to chrome - setFocus(FALSE); + setFocus(false); // can't Ctrl-Tab to "chrome" floaters - setFocusRoot(FALSE); + setFocusRoot(false); mButtons[BUTTON_CLOSE]->setToolTip(LLStringExplicit(getButtonTooltip(Params(), BUTTON_CLOSE, is_chrome))); } @@ -1434,7 +1434,7 @@ void LLFloater::setIsChrome(BOOL is_chrome) } // Change the draw style to account for the foreground state. -void LLFloater::setForeground(BOOL front) +void LLFloater::setForeground(bool front) { if (front != mForeground) { @@ -1479,13 +1479,13 @@ void LLFloater::setHost(LLMultiFloater* host) // add tear off button if (mCanTearOff) { - mButtonsEnabled[BUTTON_TEAR_OFF] = TRUE; + mButtonsEnabled[BUTTON_TEAR_OFF] = true; } } else if (!mHostHandle.isDead() && !host) { mButtonScale = 1.f; - //mButtonsEnabled[BUTTON_TEAR_OFF] = FALSE; + //mButtonsEnabled[BUTTON_TEAR_OFF] = false; } if (host) { @@ -1520,7 +1520,7 @@ void LLFloater::moveResizeHandlesToFront() } /*virtual*/ -BOOL LLFloater::isFrontmost() +bool LLFloater::isFrontmost() { LLFloaterView* floater_view = getParentByType<LLFloaterView>(); return getVisible() @@ -1528,7 +1528,7 @@ BOOL LLFloater::isFrontmost() && floater_view->getFrontmost() == this); } -void LLFloater::addDependentFloater(LLFloater* floaterp, BOOL reposition, BOOL resize) +void LLFloater::addDependentFloater(LLFloater* floaterp, bool reposition, bool resize) { mDependents.insert(floaterp->getHandle()); floaterp->mDependeeHandle = getHandle(); @@ -1543,12 +1543,12 @@ void LLFloater::addDependentFloater(LLFloater* floaterp, BOOL reposition, BOOL r rect.mBottom = base.mBottom; else if (rect.mLeft == base.mLeft) rect.mRight = base.mRight; - floaterp->reshape(rect.getWidth(), rect.getHeight(), FALSE); + floaterp->reshape(rect.getWidth(), rect.getHeight(), false); } floaterp->setRect(rect); floaterp->setSnapTarget(getHandle()); } - gFloaterView->adjustToFitScreen(floaterp, FALSE, TRUE); + gFloaterView->adjustToFitScreen(floaterp, false, true); if (floaterp->isFrontmost()) { // make sure to bring self and sibling floaters to front @@ -1556,7 +1556,7 @@ void LLFloater::addDependentFloater(LLFloater* floaterp, BOOL reposition, BOOL r } } -void LLFloater::addDependentFloater(LLHandle<LLFloater> dependent, BOOL reposition, BOOL resize) +void LLFloater::addDependentFloater(LLHandle<LLFloater> dependent, bool reposition, bool resize) { LLFloater* dependent_floaterp = dependent.get(); if(dependent_floaterp) @@ -1609,7 +1609,7 @@ void LLFloater::fitWithDependentsOnScreen(const LLRect& left, const LLRect& bott mTranslateWithDependents = false; } -BOOL LLFloater::offerClickToButton(S32 x, S32 y, MASK mask, EFloaterButton index) +bool LLFloater::offerClickToButton(S32 x, S32 y, MASK mask, EFloaterButton index) { if( mButtonsEnabled[index] ) { @@ -1622,23 +1622,23 @@ BOOL LLFloater::offerClickToButton(S32 x, S32 y, MASK mask, EFloaterButton index my_butt->handleMouseDown(local_x, local_y, mask)) { // the button handled it - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL LLFloater::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLFloater::handleScrollWheel(S32 x, S32 y, S32 clicks) { LLPanel::handleScrollWheel(x,y,clicks); - return TRUE;//always + return true;//always } // virtual -BOOL LLFloater::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLFloater::handleMouseUp(S32 x, S32 y, MASK mask) { LL_DEBUGS() << "LLFloater::handleMouseUp calling LLPanel (really LLView)'s handleMouseUp (first initialized xui to: " << getPathname() << " )" << LL_ENDL; - BOOL handled = LLPanel::handleMouseUp(x,y,mask); // Not implemented in LLPanel so this actually calls LLView + bool handled = LLPanel::handleMouseUp(x,y,mask); // Not implemented in LLPanel so this actually calls LLView if (handled) { LLViewerEventRecorder::instance().updateMouseEventInfo(x,y,-55,-55,getPathname()); } @@ -1646,7 +1646,7 @@ BOOL LLFloater::handleMouseUp(S32 x, S32 y, MASK mask) } // virtual -BOOL LLFloater::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLFloater::handleMouseDown(S32 x, S32 y, MASK mask) { if( mMinimized ) { @@ -1654,19 +1654,19 @@ BOOL LLFloater::handleMouseDown(S32 x, S32 y, MASK mask) // Note: this block and the offerClickToButton helper method can be removed // because the parent container will handle it for us but we'll keep it here // for safety until after reworking the panel code to manage hidden children. - if(offerClickToButton(x, y, mask, BUTTON_CLOSE)) return TRUE; - if(offerClickToButton(x, y, mask, BUTTON_RESTORE)) return TRUE; - if(offerClickToButton(x, y, mask, BUTTON_TEAR_OFF)) return TRUE; - if(offerClickToButton(x, y, mask, BUTTON_DOCK)) return TRUE; + if(offerClickToButton(x, y, mask, BUTTON_CLOSE)) return true; + if(offerClickToButton(x, y, mask, BUTTON_RESTORE)) return true; + if(offerClickToButton(x, y, mask, BUTTON_TEAR_OFF)) return true; + if(offerClickToButton(x, y, mask, BUTTON_DOCK)) return true; - setFrontmost(TRUE, FALSE); + setFrontmost(true, false); // Otherwise pass to drag handle for movement return mDragHandle->handleMouseDown(x, y, mask); } else { bringToFront( x, y ); - BOOL handled = LLPanel::handleMouseDown( x, y, mask ); + bool handled = LLPanel::handleMouseDown( x, y, mask ); if (handled) { LLViewerEventRecorder::instance().updateMouseEventInfo(x,y,-55,-55,getPathname()); } @@ -1675,14 +1675,14 @@ BOOL LLFloater::handleMouseDown(S32 x, S32 y, MASK mask) } // virtual -BOOL LLFloater::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLFloater::handleRightMouseDown(S32 x, S32 y, MASK mask) { - BOOL was_minimized = mMinimized; + bool was_minimized = mMinimized; bringToFront( x, y ); return was_minimized || LLPanel::handleRightMouseDown( x, y, mask ); } -BOOL LLFloater::handleMiddleMouseDown(S32 x, S32 y, MASK mask) +bool LLFloater::handleMiddleMouseDown(S32 x, S32 y, MASK mask) { bringToFront( x, y ); return LLPanel::handleMiddleMouseDown( x, y, mask ); @@ -1690,10 +1690,10 @@ BOOL LLFloater::handleMiddleMouseDown(S32 x, S32 y, MASK mask) // virtual -BOOL LLFloater::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLFloater::handleDoubleClick(S32 x, S32 y, MASK mask) { - BOOL was_minimized = mMinimized; - setMinimized(FALSE); + bool was_minimized = mMinimized; + setMinimized(false); return was_minimized || LLPanel::handleDoubleClick(x, y, mask); } @@ -1728,23 +1728,23 @@ void LLFloater::goneFromFront() } // virtual -void LLFloater::setVisibleAndFrontmost(BOOL take_focus,const LLSD& key) +void LLFloater::setVisibleAndFrontmost(bool take_focus,const LLSD& key) { LLUIUsage::instance().logFloater(getInstanceName()); LLMultiFloater* hostp = getHost(); if (hostp) { - hostp->setVisible(TRUE); + hostp->setVisible(true); hostp->setFrontmost(take_focus); } else { - setVisible(TRUE); + setVisible(true); setFrontmost(take_focus); } } -void LLFloater::setFrontmost(BOOL take_focus, BOOL restore) +void LLFloater::setFrontmost(bool take_focus, bool restore) { LLMultiFloater* hostp = getHost(); if (hostp) @@ -1779,7 +1779,7 @@ void LLFloater::setCanDock(bool b) } else { - mButtonsEnabled[BUTTON_DOCK] = FALSE; + mButtonsEnabled[BUTTON_DOCK] = false; } } updateTitleButtons(); @@ -1794,7 +1794,7 @@ void LLFloater::setDocked(bool docked, bool pop_on_undock) if (mDocked) { - setMinimized(FALSE); + setMinimized(false); mPositioning = LLFloaterEnums::POSITIONING_RELATIVE; } @@ -1836,9 +1836,9 @@ void LLFloater::onClickTearOff(LLFloater* self) new_rect.setLeftTopAndSize(host_floater->getRect().mLeft + 5, host_floater->getRect().mTop - floater_header_size - 5, self->getRect().getWidth(), self->getRect().getHeight()); self->setRect(new_rect); } - gFloaterView->adjustToFitScreen(self, FALSE); + gFloaterView->adjustToFitScreen(self, false); // give focus to new window to keep continuity for the user - self->setFocus(TRUE); + self->setFocus(true); self->setTornOff(true); } else //Attach to parent. @@ -1852,7 +1852,7 @@ void LLFloater::onClickTearOff(LLFloater* self) self->mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert(); self->storeRectControl(); } - self->setMinimized(FALSE); // to reenable minimize button if it was minimized + self->setMinimized(false); // to reenable minimize button if it was minimized new_host->showFloater(self); // make sure host is visible new_host->openFloater(new_host->getKey()); @@ -1984,7 +1984,7 @@ void LLFloater::draw() const LLFontGL* font = LLFontGL::getFontSansSerif(); LLRect r = getRect(); gl_rect_2d_offset_local(0, r.getHeight(), r.getWidth(), r.getHeight() - font->getLineHeight() - 1, - titlebar_focus_color % alpha, 0, TRUE); + titlebar_focus_color % alpha, 0, true); } } } @@ -1997,13 +1997,13 @@ void LLFloater::draw() { LLFocusableElement* focus_ctrl = gFocusMgr.getKeyboardFocus(); // is this button a direct descendent and not a nested widget (e.g. checkbox)? - BOOL focus_is_child_button = dynamic_cast<LLButton*>(focus_ctrl) != NULL && dynamic_cast<LLButton*>(focus_ctrl)->getParent() == this; + bool focus_is_child_button = dynamic_cast<LLButton*>(focus_ctrl) != NULL && dynamic_cast<LLButton*>(focus_ctrl)->getParent() == this; // only enable default button when current focus is not a button getDefaultButton()->setBorderEnabled(!focus_is_child_button); } else { - getDefaultButton()->setBorderEnabled(FALSE); + getDefaultButton()->setBorderEnabled(false); } } if (isMinimized()) @@ -2012,7 +2012,7 @@ void LLFloater::draw() { drawChild(mButtons[i]); } - drawChild(mDragHandle, 0, 0, TRUE); + drawChild(mDragHandle, 0, 0, true); } else { @@ -2027,7 +2027,7 @@ void LLFloater::draw() LLFloater* old_host = mLastHostHandle.get(); if (!old_host) { - setCanTearOff(FALSE); + setCanTearOff(false); } } } @@ -2076,14 +2076,14 @@ void LLFloater::updateTransparency(ETypeTransparency transparency_type) updateTransparency(this, transparency_type); } -void LLFloater::setCanMinimize(BOOL can_minimize) +void LLFloater::setCanMinimize(bool can_minimize) { // if removing minimize/restore button programmatically, // go ahead and unminimize floater mCanMinimize = can_minimize; if (!can_minimize) { - setMinimized(FALSE); + setMinimized(false); } mButtonsEnabled[BUTTON_MINIMIZE] = can_minimize && !isMinimized(); @@ -2092,7 +2092,7 @@ void LLFloater::setCanMinimize(BOOL can_minimize) updateTitleButtons(); } -void LLFloater::setCanClose(BOOL can_close) +void LLFloater::setCanClose(bool can_close) { mCanClose = can_close; mButtonsEnabled[BUTTON_CLOSE] = can_close; @@ -2100,7 +2100,7 @@ void LLFloater::setCanClose(BOOL can_close) updateTitleButtons(); } -void LLFloater::setCanTearOff(BOOL can_tear_off) +void LLFloater::setCanTearOff(bool can_tear_off) { mCanTearOff = can_tear_off; mButtonsEnabled[BUTTON_TEAR_OFF] = mCanTearOff && !mHostHandle.isDead(); @@ -2109,23 +2109,23 @@ void LLFloater::setCanTearOff(BOOL can_tear_off) } -void LLFloater::setCanResize(BOOL can_resize) +void LLFloater::setCanResize(bool can_resize) { mResizable = can_resize; enableResizeCtrls(can_resize); } -void LLFloater::setCanDrag(BOOL can_drag) +void LLFloater::setCanDrag(bool can_drag) { // if we delete drag handle, we no longer have access to the floater's title // so just enable/disable it if (!can_drag && mDragHandle->getEnabled()) { - mDragHandle->setEnabled(FALSE); + mDragHandle->setEnabled(false); } else if (can_drag && !mDragHandle->getEnabled()) { - mDragHandle->setEnabled(TRUE); + mDragHandle->setEnabled(true); } } @@ -2203,13 +2203,13 @@ void LLFloater::updateTitleButtons() buttons_rect.mLeft = btn_rect.mLeft; } mButtons[i]->setRect(btn_rect); - mButtons[i]->setVisible(TRUE); + mButtons[i]->setVisible(true); // the restore button should have a tab stop so that it takes action when you Ctrl-Tab to a minimized floater mButtons[i]->setTabStop(i == BUTTON_RESTORE); } else { - mButtons[i]->setVisible(FALSE); + mButtons[i]->setVisible(false); } } if (mDragHandle) @@ -2403,7 +2403,7 @@ static LLDefaultChildRegistry::Register<LLFloaterView> r("floater_view"); LLFloaterView::LLFloaterView (const Params& p) : LLUICtrl (p), - mFocusCycleMode(FALSE), + mFocusCycleMode(false), mMinimizePositionVOffset(0), mSnapOffsetBottom(0), mSnapOffsetRight(0) @@ -2412,7 +2412,7 @@ LLFloaterView::LLFloaterView (const Params& p) } // By default, adjust vertical. -void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLFloaterView::reshape(S32 width, S32 height, bool called_from_parent) { LLView::reshape(width, height, called_from_parent); @@ -2482,7 +2482,7 @@ void LLFloaterView::restoreAll() LLFloater* floaterp = dynamic_cast<LLFloater*>(child); if (floaterp) { - floaterp->setMinimized(FALSE); + floaterp->setMinimized(false); } } @@ -2557,7 +2557,7 @@ LLRect LLFloaterView::findNeighboringPosition( LLFloater* reference_floater, LLF } -void LLFloaterView::bringToFront(LLFloater* child, BOOL give_focus, BOOL restore) +void LLFloaterView::bringToFront(LLFloater* child, bool give_focus, bool restore) { if (!child) return; @@ -2567,7 +2567,7 @@ void LLFloaterView::bringToFront(LLFloater* child, BOOL give_focus, BOOL restore { if (give_focus && child->canFocusStealFrontmost() && !gFocusMgr.childHasKeyboardFocus(child)) { - child->setFocus(TRUE); + child->setFocus(true); } return; } @@ -2625,7 +2625,7 @@ void LLFloaterView::bringToFront(LLFloater* child, BOOL give_focus, BOOL restore // always unminimize dependee, but allow dependents to stay minimized if (!floaterp->isDependent()) { - floaterp->setMinimized(FALSE); + floaterp->setMinimized(false); } } floaters_to_move.clear(); @@ -2650,12 +2650,12 @@ void LLFloaterView::bringToFront(LLFloater* child, BOOL give_focus, BOOL restore if(restore) { - child->setMinimized(FALSE); + child->setMinimized(false); } if (give_focus && !gFocusMgr.childHasKeyboardFocus(child)) { - child->setFocus(TRUE); + child->setFocus(true); // floater did not take focus, so relinquish focus to world if (!child->hasFocus()) { @@ -2676,7 +2676,7 @@ void LLFloaterView::highlightFocusedFloater() continue; } - BOOL floater_or_dependent_has_focus = gFocusMgr.childHasKeyboardFocus(floater); + bool floater_or_dependent_has_focus = gFocusMgr.childHasKeyboardFocus(floater); for(LLFloater::handle_set_iter_t dependent_it = floater->mDependents.begin(); dependent_it != floater->mDependents.end(); ++dependent_it) @@ -2684,7 +2684,7 @@ void LLFloaterView::highlightFocusedFloater() LLFloater* dependent_floaterp = dependent_it->get(); if (dependent_floaterp && gFocusMgr.childHasKeyboardFocus(dependent_floaterp)) { - floater_or_dependent_has_focus = TRUE; + floater_or_dependent_has_focus = true; } } @@ -2730,7 +2730,7 @@ void LLFloaterView::unhighlightFocusedFloater() { LLFloater *floater = (LLFloater *)(*child_it); - floater->setForeground(FALSE); + floater->setForeground(false); } } @@ -2739,7 +2739,7 @@ void LLFloaterView::focusFrontFloater() LLFloater* floaterp = getFrontmost(); if (floaterp) { - floaterp->setFocus(TRUE); + floaterp->setFocus(true); } } @@ -2759,7 +2759,7 @@ void LLFloaterView::getMinimizePosition(S32 *left, S32 *bottom) row -= floater_header_size ) //loop rows { - bool foundGap = TRUE; + bool foundGap = true; for(child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) //loop floaters @@ -2776,7 +2776,7 @@ void LLFloaterView::getMinimizePosition(S32 *left, S32 *bottom) { // needs the check for off grid. can't drag, // but window resize makes them off - foundGap = FALSE; + foundGap = false; break; } } @@ -2878,7 +2878,7 @@ void LLFloaterView::showHiddenFloaters() mHiddenFloaters.clear(); } -BOOL LLFloaterView::allChildrenClosed() +bool LLFloaterView::allChildrenClosed() { // see if there are any visible floaters (some floaters "close" // by setting themselves invisible) @@ -2912,7 +2912,7 @@ void LLFloaterView::refresh() LLRect snap_rect = getSnapRect(); if (snap_rect != mLastSnapRect) { - reshape(getRect().getWidth(), getRect().getHeight(), TRUE); + reshape(getRect().getWidth(), getRect().getHeight(), true); } // Constrain children to be entirely on the screen @@ -2927,7 +2927,7 @@ void LLFloaterView::refresh() } } -void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_outside, BOOL snap_in_toolbars/* = false*/) +void LLFloaterView::adjustToFitScreen(LLFloater* floater, bool allow_partial_outside, bool snap_in_toolbars/* = false*/) { if (floater->getParent() != this) { @@ -3099,7 +3099,7 @@ void LLFloaterView::syncFloaterTabOrder() if( !gFocusMgr.childHasKeyboardFocus( modal_dialog ) ) { - modal_dialog->setFocus(TRUE); + modal_dialog->setFocus(true); } if( !gFocusMgr.childHasMouseCapture( modal_dialog ) ) @@ -3131,7 +3131,7 @@ void LLFloaterView::syncFloaterTabOrder() } } - bringToFront(floaterp, FALSE); + bringToFront(floaterp, false); // Restore top floaters if (!listTop.empty()) @@ -3183,7 +3183,7 @@ S32 LLFloaterView::getZOrder(LLFloater* child) return rv; } -void LLFloaterView::pushVisibleAll(BOOL visible, const skip_list_t& skip_list) +void LLFloaterView::pushVisibleAll(bool visible, const skip_list_t& skip_list) { for (child_list_const_iter_t child_iter = getChildList()->begin(); child_iter != getChildList()->end(); ++child_iter) @@ -3397,7 +3397,7 @@ bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::str setupParamsForExport(output_params, parent); output_node->setName(node->getName()->mString); parser.writeXUI(output_node, output_params, LLInitParam::default_parse_rules(), &default_params); - return TRUE; + return true; } LLUICtrlFactory::instance().pushFileName(xml_filename); @@ -3406,7 +3406,7 @@ bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::str { LL_WARNS() << "Couldn't parse panel from: " << xml_filename << LL_ENDL; - return FALSE; + return false; } Params referenced_params; @@ -3476,7 +3476,7 @@ bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::str setRect(rect); } - BOOL result; + bool result; result = postBuild(); if (!result) @@ -3485,7 +3485,7 @@ bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::str } applyRectControl(); // If we have a saved rect control, apply it - gFloaterView->adjustToFitScreen(this, FALSE); // Floaters loaded from XML should all fit on screen + gFloaterView->adjustToFitScreen(this, false); // Floaters loaded from XML should all fit on screen moveResizeHandlesToFront(); diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index dcc9af4c6e..3d75c42f60 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -46,20 +46,20 @@ class LLMultiFloater; class LLFloater; -const BOOL RESIZE_YES = TRUE; -const BOOL RESIZE_NO = FALSE; +const bool RESIZE_YES = true; +const bool RESIZE_NO = false; -const BOOL DRAG_ON_TOP = FALSE; -const BOOL DRAG_ON_LEFT = TRUE; +const bool DRAG_ON_TOP = false; +const bool DRAG_ON_LEFT = true; -const BOOL MINIMIZE_YES = TRUE; -const BOOL MINIMIZE_NO = FALSE; +const bool MINIMIZE_YES = true; +const bool MINIMIZE_NO = false; -const BOOL CLOSE_YES = TRUE; -const BOOL CLOSE_NO = FALSE; +const bool CLOSE_YES = true; +const bool CLOSE_NO = false; -const BOOL ADJUST_VERTICAL_YES = TRUE; -const BOOL ADJUST_VERTICAL_NO = FALSE; +const bool ADJUST_VERTICAL_YES = true; +const bool ADJUST_VERTICAL_NO = false; const F32 CONTEXT_CONE_IN_ALPHA = 0.f; const F32 CONTEXT_CONE_OUT_ALPHA = 1.f; @@ -222,13 +222,13 @@ public: bool initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::string& filename, LLXMLNodePtr output_node = NULL); /*virtual*/ void handleReshape(const LLRect& new_rect, bool by_user = false); - /*virtual*/ BOOL canSnapTo(const LLView* other_view); + /*virtual*/ bool canSnapTo(const LLView* other_view); /*virtual*/ void setSnappedTo(const LLView* snap_view); - /*virtual*/ void setFocus( BOOL b ); - /*virtual*/ void setIsChrome(BOOL is_chrome); + /*virtual*/ void setFocus( bool b ); + /*virtual*/ void setIsChrome(bool is_chrome); /*virtual*/ void setRect(const LLRect &rect); - void setIsSingleInstance(BOOL is_single_instance); - BOOL getIsSingleInstance() { return mSingleInstance; } + void setIsSingleInstance(bool is_single_instance); + bool getIsSingleInstance() { return mSingleInstance; } void initFloater(const Params& p); @@ -240,7 +240,7 @@ public: // Close the floater or its host. Use when hidding or toggling a floater instance. virtual void closeHostedFloater(); - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true); /*virtual*/ void translate(S32 x, S32 y); // Release keyboard and mouse focus @@ -258,14 +258,14 @@ public: std::string getTitle() const; void setShortTitle( const std::string& short_title ); std::string getShortTitle() const; - virtual void setMinimized(BOOL b); + virtual void setMinimized(bool b); void moveResizeHandlesToFront(); - void addDependentFloater(LLFloater* dependent, BOOL reposition = TRUE, BOOL resize = FALSE); - void addDependentFloater(LLHandle<LLFloater> dependent_handle, BOOL reposition = TRUE, BOOL resize = FALSE); + void addDependentFloater(LLFloater* dependent, bool reposition = true, bool resize = false); + void addDependentFloater(LLHandle<LLFloater> dependent_handle, bool reposition = true, bool resize = false); LLFloater* getDependee() { return (LLFloater*)mDependeeHandle.get(); } void removeDependentFloater(LLFloater* dependent); void fitWithDependentsOnScreen(const LLRect& left, const LLRect& bottom, const LLRect& right, const LLRect& constraint, S32 min_overlap_pixels); - BOOL isMinimized() const { return mMinimized; } + bool isMinimized() const { return mMinimized; } /// isShown() differs from getVisible() in that isShown() also considers /// isMinimized(). isShown() is true only if visible and not minimized. bool isShown() const; @@ -274,17 +274,17 @@ public: static bool isShown(const LLFloater* floater); static bool isVisible(const LLFloater* floater); static bool isMinimized(const LLFloater* floater); - BOOL isFirstLook() { return mFirstLook; } // EXT-2653: This function is necessary to prevent overlapping for secondary showed toasts - virtual BOOL isFrontmost(); - BOOL isDependent() { return !mDependeeHandle.isDead(); } - void setCanMinimize(BOOL can_minimize); - void setCanClose(BOOL can_close); - void setCanTearOff(BOOL can_tear_off); - virtual void setCanResize(BOOL can_resize); - void setCanDrag(BOOL can_drag); + bool isFirstLook() { return mFirstLook; } // EXT-2653: This function is necessary to prevent overlapping for secondary showed toasts + virtual bool isFrontmost(); + bool isDependent() { return !mDependeeHandle.isDead(); } + void setCanMinimize(bool can_minimize); + void setCanClose(bool can_close); + void setCanTearOff(bool can_tear_off); + virtual void setCanResize(bool can_resize); + void setCanDrag(bool can_drag); bool getCanDrag(); void setHost(LLMultiFloater* host); - BOOL isResizable() const { return mResizable; } + bool isResizable() const { return mResizable; } void setResizeLimits( S32 min_width, S32 min_height ); void getResizeLimits( S32* min_width, S32* min_height ) { *min_width = mMinWidth; *min_height = mMinHeight; } @@ -298,13 +298,13 @@ public: S32 getMinHeight() const{ return mMinHeight; } S32 getHeaderHeight() const { return mHeaderHeight; } - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); - virtual BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleRightMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleDoubleClick(S32 x, S32 y, MASK mask); + virtual bool handleMiddleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleScrollWheel(S32 x, S32 y, S32 mask); + virtual bool handleScrollWheel(S32 x, S32 y, S32 mask); virtual void draw(); virtual void drawShadow(LLPanel* panel); @@ -314,19 +314,19 @@ public: // This cannot be "const" until all derived floater canClose() // methods are const as well. JC - virtual BOOL canClose() { return TRUE; } + virtual bool canClose() { return true; } - /*virtual*/ void setVisible(BOOL visible); // do not override - /*virtual*/ void onVisibilityChange ( BOOL new_visibility ); // do not override + /*virtual*/ void setVisible(bool visible); // do not override + /*virtual*/ void onVisibilityChange ( bool new_visibility ); // do not override bool canFocusStealFrontmost() const { return mFocusStealsFrontmost; } void setFocusStealsFrontmost(bool wants_frontmost) { mFocusStealsFrontmost = wants_frontmost; } - void setFrontmost(BOOL take_focus = TRUE, BOOL restore = TRUE); - virtual void setVisibleAndFrontmost(BOOL take_focus=TRUE, const LLSD& key = LLSD()); + void setFrontmost(bool take_focus = true, bool restore = true); + virtual void setVisibleAndFrontmost(bool take_focus = true, const LLSD& key = LLSD()); // Defaults to false. - virtual BOOL canSaveAs() const { return FALSE; } + virtual bool canSaveAs() const { return false; } virtual void saveAs() {} @@ -400,8 +400,8 @@ protected: void setExpandedRect(const LLRect& rect) { mExpandedRect = rect; } // size when not minimized const LLRect& getExpandedRect() const { return mExpandedRect; } - void setAutoFocus(BOOL focus) { mAutoFocus = focus; } // whether to automatically take focus when opened - BOOL getAutoFocus() const { return mAutoFocus; } + void setAutoFocus(bool focus) { mAutoFocus = focus; } // whether to automatically take focus when opened + bool getAutoFocus() const { return mAutoFocus; } LLDragHandle* getDragHandle() const { return mDragHandle; } void destroy(); // Don't call this directly. You probably want to call closeFloater() @@ -420,7 +420,7 @@ protected: F32 contex_cone_out_alpha = CONTEXT_CONE_OUT_ALPHA); private: - void setForeground(BOOL b); // called only by floaterview + void setForeground(bool b); // called only by floaterview void cleanupHandles(); // remove handles to dead floaters void createMinimizeButton(); void buildButtons(const Params& p); @@ -437,7 +437,7 @@ private: */ static std::string getButtonTooltip(const Params& p, EFloaterButton e, bool is_chrome); - BOOL offerClickToButton(S32 x, S32 y, MASK mask, EFloaterButton index); + bool offerClickToButton(S32 x, S32 y, MASK mask, EFloaterButton index); void addResizeCtrls(); void layoutResizeCtrls(); void addDragHandle(); @@ -483,18 +483,18 @@ private: LLUIString mTitle; LLUIString mShortTitle; - BOOL mSingleInstance; // TRUE if there is only ever one instance of the floater + bool mSingleInstance; // true if there is only ever one instance of the floater bool mReuseInstance; // true if we want to hide the floater when we close it instead of destroying it bool mIsReuseInitialized; // true if mReuseInstance already set from parameters std::string mInstanceName; // Store the instance name so we can remove ourselves from the list - BOOL mCanTearOff; - BOOL mCanMinimize; - BOOL mCanClose; - bool mFocusStealsFrontmost = true; // FALSE if we don't want the currently focused floater to cover this floater without user interaction - BOOL mDragOnLeft; - BOOL mResizable; - BOOL mAutoClose; + bool mCanTearOff; + bool mCanMinimize; + bool mCanClose; + bool mFocusStealsFrontmost = true; // false if we don't want the currently focused floater to cover this floater without user interaction + bool mDragOnLeft; + bool mResizable; + bool mAutoClose; LLFloaterEnums::EOpenPositioning mPositioning; LLCoordFloater mPosition; @@ -504,12 +504,12 @@ private: S32 mHeaderHeight; // height in pixels of header for title, drag bar S32 mLegacyHeaderHeight;// HACK see initFloaterXML() - BOOL mMinimized; - BOOL mForeground; + bool mMinimized; + bool mForeground; LLHandle<LLFloater> mDependeeHandle; - BOOL mFirstLook; // TRUE if the _next_ time this floater is visible will be the first time in the session that it is visible. + bool mFirstLook; // true if the _next_ time this floater is visible will be the first time in the session that it is visible. typedef std::set<LLHandle<LLFloater> > handle_set_t; typedef std::set<LLHandle<LLFloater> >::iterator handle_set_iter_t; @@ -518,7 +518,7 @@ private: bool mButtonsEnabled[BUTTON_COUNT]; F32 mButtonScale; - BOOL mAutoFocus; + bool mAutoFocus; LLHandle<LLFloater> mSnappedTo; LLHandle<LLFloater> mHostHandle; @@ -529,7 +529,7 @@ private: bool mTornOff; static LLMultiFloater* sHostp; - static BOOL sQuitting; + static bool sQuitting; static std::string sButtonNames[BUTTON_COUNT]; static std::string sButtonToolTips[BUTTON_COUNT]; static std::string sButtonToolTipsIndex[BUTTON_COUNT]; @@ -537,7 +537,7 @@ private: typedef void(*click_callback)(LLFloater*); static click_callback sButtonCallbacks[BUTTON_COUNT]; - BOOL mHasBeenDraggedWhileMinimized; + bool mHasBeenDraggedWhileMinimized; S32 mPreviousMinimizedBottom; S32 mPreviousMinimizedLeft; @@ -563,7 +563,7 @@ protected: public: - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true); /*virtual*/ void draw(); /*virtual*/ LLRect getSnapRect() const; /*virtual*/ void refresh(); @@ -571,25 +571,25 @@ public: LLRect findNeighboringPosition( LLFloater* reference_floater, LLFloater* neighbor ); // Given a child of gFloaterView, make sure this view can fit entirely onscreen. - void adjustToFitScreen(LLFloater* floater, BOOL allow_partial_outside, BOOL snap_in_toolbars = false); + void adjustToFitScreen(LLFloater* floater, bool allow_partial_outside, bool snap_in_toolbars = false); void setMinimizePositionVerticalOffset(S32 offset) { mMinimizePositionVOffset = offset; } void getMinimizePosition( S32 *left, S32 *bottom); void restoreAll(); // un-minimize all floaters typedef std::set<LLView*> skip_list_t; - void pushVisibleAll(BOOL visible, const skip_list_t& skip_list = skip_list_t()); + void pushVisibleAll(bool visible, const skip_list_t& skip_list = skip_list_t()); void popVisibleAll(const skip_list_t& skip_list = skip_list_t()); - void setCycleMode(BOOL mode) { mFocusCycleMode = mode; } - BOOL getCycleMode() const { return mFocusCycleMode; } - void bringToFront( LLFloater* child, BOOL give_focus = TRUE, BOOL restore = TRUE ); + void setCycleMode(bool mode) { mFocusCycleMode = mode; } + bool getCycleMode() const { return mFocusCycleMode; } + void bringToFront( LLFloater* child, bool give_focus = true, bool restore = true ); void highlightFocusedFloater(); void unhighlightFocusedFloater(); void focusFrontFloater(); void destroyAllChildren(); // attempt to close all floaters void closeAllChildren(bool app_quitting); - BOOL allChildrenClosed(); + bool allChildrenClosed(); void shiftFloaters(S32 x_offset, S32 y_offset); void hideAllFloaters(); @@ -620,7 +620,7 @@ private: LLRect mToolbarBottomRect; LLRect mToolbarRightRect; LLHandle<LLView> mSnapView; - BOOL mFocusCycleMode; + bool mFocusCycleMode; S32 mSnapOffsetBottom; S32 mSnapOffsetRight; S32 mMinimizePositionVOffset; diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index 989ce12d09..fd5a370bc3 100644 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp @@ -248,7 +248,7 @@ LLFloaterReg::const_instance_list_t& LLFloaterReg::getFloaterList(const std::str // Visibility Management //static -LLFloater* LLFloaterReg::showInstance(const std::string& name, const LLSD& key, BOOL focus) +LLFloater* LLFloaterReg::showInstance(const std::string& name, const LLSD& key, bool focus) { if( sBlockShowFloaters // see EXT-7090 @@ -259,7 +259,7 @@ LLFloater* LLFloaterReg::showInstance(const std::string& name, const LLSD& key, { instance->openFloater(key); if (focus) - instance->setFocus(TRUE); + instance->setFocus(true); } return instance; } @@ -281,15 +281,15 @@ bool LLFloaterReg::hideInstance(const std::string& name, const LLSD& key) bool LLFloaterReg::toggleInstance(const std::string& name, const LLSD& key) { LLFloater* instance = findInstance(name, key); - if (LLFloater::isShown(instance)) + if (instance && instance->isShown()) { instance->closeHostedFloater(); return false; } - else - { - return showInstance(name, key, TRUE) ? true : false; - } + + instance = showInstance(name, key, true); + + return instance != nullptr; } //static @@ -310,7 +310,7 @@ void LLFloaterReg::showInitialVisibleInstances() std::string controlname = getVisibilityControlName(name); if (LLFloater::getControlGroup()->controlExists(controlname)) { - BOOL isvis = LLFloater::getControlGroup()->getBOOL(controlname); + bool isvis = LLFloater::getControlGroup()->getBOOL(controlname); if (isvis) { showInstance(name, LLSD()); // keyed floaters shouldn't set save_vis to true @@ -332,7 +332,7 @@ void LLFloaterReg::hideVisibleInstances(const std::set<std::string>& exceptions) for (instance_list_t::iterator iter = list.begin(); iter != list.end(); ++iter) { LLFloater* floater = *iter; - floater->pushVisible(FALSE); + floater->pushVisible(false); } } } @@ -409,7 +409,7 @@ std::string LLFloaterReg::getBaseControlName(const std::string& name) std::string LLFloaterReg::declareVisibilityControl(const std::string& name) { std::string controlname = getVisibilityControlName(name); - LLFloater::getControlGroup()->declareBOOL(controlname, FALSE, + LLFloater::getControlGroup()->declareBOOL(controlname, false, llformat("Window Visibility for %s", name.c_str()), LLControlVariable::PERSIST_NONDFT); return controlname; @@ -419,7 +419,7 @@ std::string LLFloaterReg::declareVisibilityControl(const std::string& name) std::string LLFloaterReg::declareDockStateControl(const std::string& name) { std::string controlname = getDockStateControlName(name); - LLFloater::getControlGroup()->declareBOOL(controlname, TRUE, + LLFloater::getControlGroup()->declareBOOL(controlname, true, llformat("Window Docking state for %s", name.c_str()), LLControlVariable::PERSIST_NONDFT); return controlname; @@ -492,7 +492,7 @@ void LLFloaterReg::toggleInstanceOrBringToFront(const LLSD& sdname, const LLSD& { if (host->isMinimized() || !host->isShown() || !host->isFrontmost()) { - host->setMinimized(FALSE); + host->setMinimized(false); instance->openFloater(key); instance->setVisibleAndFrontmost(true, key); } @@ -500,7 +500,7 @@ void LLFloaterReg::toggleInstanceOrBringToFront(const LLSD& sdname, const LLSD& { instance->openFloater(key); instance->setVisibleAndFrontmost(true, key); - instance->setFocus(TRUE); + instance->setFocus(true); } else { @@ -511,7 +511,7 @@ void LLFloaterReg::toggleInstanceOrBringToFront(const LLSD& sdname, const LLSD& { if (instance->isMinimized()) { - instance->setMinimized(FALSE); + instance->setMinimized(false); instance->setVisibleAndFrontmost(true, key); } else if (!instance->isShown()) @@ -552,7 +552,7 @@ void LLFloaterReg::showInstanceOrBringToFront(const LLSD& sdname, const LLSD& ke { if (host->isMinimized() || !host->isShown() || !host->isFrontmost()) { - host->setMinimized(FALSE); + host->setMinimized(false); instance->openFloater(key); instance->setVisibleAndFrontmost(true, key); } @@ -560,14 +560,14 @@ void LLFloaterReg::showInstanceOrBringToFront(const LLSD& sdname, const LLSD& ke { instance->openFloater(key); instance->setVisibleAndFrontmost(true, key); - instance->setFocus(TRUE); + instance->setFocus(true); } } else { if (instance->isMinimized()) { - instance->setMinimized(FALSE); + instance->setMinimized(false); instance->setVisibleAndFrontmost(true, key); } else if (!instance->isShown()) diff --git a/indra/llui/llfloaterreg.h b/indra/llui/llfloaterreg.h index 43f3f7b170..6a642cbb27 100644 --- a/indra/llui/llfloaterreg.h +++ b/indra/llui/llfloaterreg.h @@ -102,7 +102,7 @@ public: // Visibility Management // return NULL if instance not found or can't create instance (no builder) - static LLFloater* showInstance(const std::string& name, const LLSD& key = LLSD(), BOOL focus = FALSE); + static LLFloater* showInstance(const std::string& name, const LLSD& key = LLSD(), bool focus = false); // Close a floater (may destroy or set invisible) // return false if can't find instance static bool hideInstance(const std::string& name, const LLSD& key = LLSD()); @@ -145,7 +145,7 @@ public: } template <class T> - static T* showTypedInstance(const std::string& name, const LLSD& key = LLSD(), BOOL focus = FALSE) + static T* showTypedInstance(const std::string& name, const LLSD& key = LLSD(), bool focus = false) { return dynamic_cast<T*>(showInstance(name, key, focus)); } diff --git a/indra/llui/llflyoutbutton.cpp b/indra/llui/llflyoutbutton.cpp index 1d529d09d3..2e198e8dbc 100644 --- a/indra/llui/llflyoutbutton.cpp +++ b/indra/llui/llflyoutbutton.cpp @@ -35,7 +35,7 @@ const S32 FLYOUT_BUTTON_ARROW_WIDTH = 24; LLFlyoutButton::LLFlyoutButton(const Params& p) : LLComboBox(p), - mToggleState(FALSE), + mToggleState(false), mActionButton(NULL) { // Always use text box @@ -69,7 +69,7 @@ void LLFlyoutButton::draw() LLComboBox::draw(); } -void LLFlyoutButton::setToggleState(BOOL state) +void LLFlyoutButton::setToggleState(bool state) { mToggleState = state; } diff --git a/indra/llui/llflyoutbutton.h b/indra/llui/llflyoutbutton.h index c217d14ff1..7a49501318 100644 --- a/indra/llui/llflyoutbutton.h +++ b/indra/llui/llflyoutbutton.h @@ -56,13 +56,13 @@ protected: public: virtual void draw(); - void setToggleState(BOOL state); + void setToggleState(bool state); void onActionButtonClick(const LLSD& data); protected: LLButton* mActionButton; - BOOL mToggleState; + bool mToggleState; }; #endif // LL_LLFLYOUTBUTTON_H diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp index 5b7525daac..e0e789f730 100644 --- a/indra/llui/llfocusmgr.cpp +++ b/indra/llui/llfocusmgr.cpp @@ -41,25 +41,25 @@ LLFocusableElement::LLFocusableElement() } // virtual -BOOL LLFocusableElement::handleKey(KEY key, MASK mask, BOOL called_from_parent) +bool LLFocusableElement::handleKey(KEY key, MASK mask, bool called_from_parent) { - return FALSE; + return false; } // virtual -BOOL LLFocusableElement::handleKeyUp(KEY key, MASK mask, BOOL called_from_parent) +bool LLFocusableElement::handleKeyUp(KEY key, MASK mask, bool called_from_parent) { - return FALSE; + return false; } // virtual -BOOL LLFocusableElement::handleUnicodeChar(llwchar uni_char, BOOL called_from_parent) +bool LLFocusableElement::handleUnicodeChar(llwchar uni_char, bool called_from_parent) { - return FALSE; + return false; } // virtual -BOOL LLFocusableElement::handleUnicodeString(char *uni_str, bool editing, BOOL called_from_parent) +bool LLFocusableElement::handleUnicodeString(char *uni_str, bool editing, bool called_from_parent) { return FALSE; } @@ -102,12 +102,12 @@ void LLFocusableElement::onTopLost() if (mTopLostCallback) (*mTopLostCallback)(this); } -BOOL LLFocusableElement::hasFocus() const +bool LLFocusableElement::hasFocus() const { return gFocusMgr.getKeyboardFocus() == this; } -void LLFocusableElement::setFocus(BOOL b) +void LLFocusableElement::setFocus(bool b) { } @@ -155,9 +155,9 @@ LLFocusMgr::LLFocusMgr() mKeyboardFocus( NULL ), mLastKeyboardFocus( NULL ), mDefaultKeyboardFocus( NULL ), - mKeystrokesOnly(FALSE), + mKeystrokesOnly(false), mTopCtrl( NULL ), - mAppHasFocus(TRUE), // Macs don't seem to notify us that we've gotten focus, so default to true + mAppHasFocus(true), // Macs don't seem to notify us that we've gotten focus, so default to true mImpl(new LLFocusMgr::Impl) { } @@ -192,7 +192,7 @@ void LLFocusMgr::releaseFocusIfNeeded( LLView* view ) LLUI::getInstance()->removePopup(view); } -void LLFocusMgr::setKeyboardFocus(LLFocusableElement* new_focus, BOOL lock, BOOL keystrokes_only) +void LLFocusMgr::setKeyboardFocus(LLFocusableElement* new_focus, bool lock, bool keystrokes_only) { // notes if keyboard focus is changed again (by onFocusLost/onFocusReceived) // making the rest of our processing unnecessary since it will already be @@ -275,7 +275,7 @@ void LLFocusMgr::setKeyboardFocus(LLFocusableElement* new_focus, BOOL lock, BOOL // releasing keyboard focus, move to the default. if (mDefaultKeyboardFocus != NULL && mKeyboardFocus == NULL) { - mDefaultKeyboardFocus->setFocus(TRUE); + mDefaultKeyboardFocus->setFocus(true); } LLView* focus_subtree = dynamic_cast<LLView*>(mKeyboardFocus); @@ -307,23 +307,23 @@ void LLFocusMgr::setKeyboardFocus(LLFocusableElement* new_focus, BOOL lock, BOOL } -// Returns TRUE is parent or any descedent of parent has keyboard focus. -BOOL LLFocusMgr::childHasKeyboardFocus(const LLView* parent ) const +// Returns true is parent or any descedent of parent has keyboard focus. +bool LLFocusMgr::childHasKeyboardFocus(const LLView* parent ) const { LLView* focus_view = dynamic_cast<LLView*>(mKeyboardFocus); while( focus_view ) { if( focus_view == parent ) { - return TRUE; + return true; } focus_view = focus_view->getParent(); } - return FALSE; + return false; } -// Returns TRUE is parent or any descedent of parent is the mouse captor. -BOOL LLFocusMgr::childHasMouseCapture( const LLView* parent ) const +// Returns true is parent or any descedent of parent is the mouse captor. +bool LLFocusMgr::childHasMouseCapture( const LLView* parent ) const { if( mMouseCaptor && dynamic_cast<LLView*>(mMouseCaptor) != NULL ) { @@ -332,12 +332,12 @@ BOOL LLFocusMgr::childHasMouseCapture( const LLView* parent ) const { if( captor_view == parent ) { - return TRUE; + return true; } captor_view = captor_view->getParent(); } } - return FALSE; + return false; } void LLFocusMgr::removeKeyboardFocusWithoutCallback( const LLFocusableElement* focus ) @@ -406,18 +406,18 @@ void LLFocusMgr::removeMouseCaptureWithoutCallback( const LLMouseHandler* captor } -BOOL LLFocusMgr::childIsTopCtrl( const LLView* parent ) const +bool LLFocusMgr::childIsTopCtrl( const LLView* parent ) const { LLView* top_view = (LLView*)mTopCtrl; while( top_view ) { if( top_view == parent ) { - return TRUE; + return true; } top_view = top_view->getParent(); } - return FALSE; + return false; } @@ -477,7 +477,7 @@ void LLFocusMgr::triggerFocusFlash() mFocusFlashTimer.reset(); } -void LLFocusMgr::setAppHasFocus(BOOL focus) +void LLFocusMgr::setAppHasFocus(bool focus) { if (!mAppHasFocus && focus) { diff --git a/indra/llui/llfocusmgr.h b/indra/llui/llfocusmgr.h index c12d52d121..1ca6f50354 100644 --- a/indra/llui/llfocusmgr.h +++ b/indra/llui/llfocusmgr.h @@ -45,8 +45,8 @@ public: LLFocusableElement(); virtual ~LLFocusableElement(); - virtual void setFocus( BOOL b ); - virtual BOOL hasFocus() const; + virtual void setFocus( bool b ); + virtual bool hasFocus() const; typedef boost::signals2::signal<void(LLFocusableElement*)> focus_signal_t; @@ -56,10 +56,10 @@ public: boost::signals2::connection setTopLostCallback(const focus_signal_t::slot_type& cb); // These were brought up the hierarchy from LLView so that we don't have to use dynamic_cast when dealing with keyboard focus. - virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); - virtual BOOL handleKeyUp(KEY key, MASK mask, BOOL called_from_parent); - virtual BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent); - virtual BOOL handleUnicodeString(char *uni_str, bool editing, BOOL called_from_parent); + virtual bool handleKey(KEY key, MASK mask, bool called_from_parent); + virtual bool handleKeyUp(KEY key, MASK mask, bool called_from_parent); + virtual bool handleUnicodeChar(llwchar uni_char, bool called_from_parent); + virtual bool handleUnicodeString(char *uni_str, bool editing, bool called_from_parent); /** * If true this LLFocusableElement wants to receive KEYUP and KEYDOWN messages @@ -90,23 +90,23 @@ public: void setMouseCapture(LLMouseHandler* new_captor); // new_captor = NULL to release the mouse. LLMouseHandler* getMouseCapture() const { return mMouseCaptor; } void removeMouseCaptureWithoutCallback( const LLMouseHandler* captor ); - BOOL childHasMouseCapture( const LLView* parent ) const; + bool childHasMouseCapture( const LLView* parent ) const; // Keyboard Focus - void setKeyboardFocus(LLFocusableElement* new_focus, BOOL lock = FALSE, BOOL keystrokes_only = FALSE); // new_focus = NULL to release the focus. + void setKeyboardFocus(LLFocusableElement* new_focus, bool lock = false, bool keystrokes_only = false); // new_focus = NULL to release the focus. LLFocusableElement* getKeyboardFocus() const { return mKeyboardFocus; } LLFocusableElement* getLastKeyboardFocus() const { return mLastKeyboardFocus; } - BOOL childHasKeyboardFocus( const LLView* parent ) const; + bool childHasKeyboardFocus( const LLView* parent ) const; void removeKeyboardFocusWithoutCallback( const LLFocusableElement* focus ); - BOOL getKeystrokesOnly() { return mKeystrokesOnly; } - void setKeystrokesOnly(BOOL keystrokes_only) { mKeystrokesOnly = keystrokes_only; } + bool getKeystrokesOnly() { return mKeystrokesOnly; } + void setKeystrokesOnly(bool keystrokes_only) { mKeystrokesOnly = keystrokes_only; } F32 getFocusFlashAmt() const; S32 getFocusFlashWidth() const { return ll_round(lerp(1.f, 3.f, getFocusFlashAmt())); } LLColor4 getFocusColor() const; void triggerFocusFlash(); - BOOL getAppHasFocus() const { return mAppHasFocus; } - void setAppHasFocus(BOOL focus); + bool getAppHasFocus() const { return mAppHasFocus; } + void setAppHasFocus(bool focus); LLView* getLastFocusForGroup(LLView* subtree_root) const; void clearLastFocusForGroup(LLView* subtree_root); @@ -120,13 +120,13 @@ public: void setTopCtrl(LLUICtrl* new_top); LLUICtrl* getTopCtrl() const { return mTopCtrl; } void removeTopCtrlWithoutCallback( const LLUICtrl* top_view ); - BOOL childIsTopCtrl( const LLView* parent ) const; + bool childIsTopCtrl( const LLView* parent ) const; // All Three void releaseFocusIfNeeded( LLView* top_view ); void lockFocus(); void unlockFocus(); - BOOL focusLocked() const { return mLockedView != NULL; } + bool focusLocked() const { return mLockedView != NULL; } bool keyboardFocusHasAccelerators() const; @@ -142,14 +142,14 @@ private: LLFocusableElement* mKeyboardFocus; // Keyboard events are preemptively routed to this object LLFocusableElement* mLastKeyboardFocus; // who last had focus LLFocusableElement* mDefaultKeyboardFocus; - BOOL mKeystrokesOnly; + bool mKeystrokesOnly; // Top View LLUICtrl* mTopCtrl; LLFrameTimer mFocusFlashTimer; - BOOL mAppHasFocus; + bool mAppHasFocus; Impl * mImpl; }; diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 33921cf4f0..1d4ecbe9c9 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -84,12 +84,12 @@ F32 LLFolderView::sAutoOpenTime = 1.f; class LLCloseAllFoldersFunctor : public LLFolderViewFunctor { public: - LLCloseAllFoldersFunctor(BOOL close) { mOpen = !close; } + LLCloseAllFoldersFunctor(bool close) { mOpen = !close; } virtual ~LLCloseAllFoldersFunctor() {} virtual void doFolder(LLFolderViewFolder* folder); virtual void doItem(LLFolderViewItem* item); - BOOL mOpen; + bool mOpen; }; @@ -167,21 +167,21 @@ LLFolderView::LLFolderView(const Params& p) mAllowMultiSelect(p.allow_multiselect), mAllowDrag(p.allow_drag), mShowEmptyMessage(p.show_empty_message), - mShowFolderHierarchy(FALSE), + mShowFolderHierarchy(false), mRenameItem( NULL ), - mNeedsScroll( FALSE ), + mNeedsScroll( false ), mUseLabelSuffix(p.use_label_suffix), mSuppressFolderMenu(p.suppress_folder_menu), - mPinningSelectedItem(FALSE), - mNeedsAutoSelect( FALSE ), - mAutoSelectOverride(FALSE), - mNeedsAutoRename(FALSE), - mShowSelectionContext(FALSE), - mShowSingleSelection(FALSE), + mPinningSelectedItem(false), + mNeedsAutoSelect( false ), + mAutoSelectOverride(false), + mNeedsAutoRename(false), + mShowSelectionContext(false), + mShowSingleSelection(false), mArrangeGeneration(0), mSignalSelectCallback(0), mMinWidth(0), - mDragAndDropThisFrame(FALSE), + mDragAndDropThisFrame(false), mCallbackRegistrar(NULL), mEnableRegistrar(NULL), mUseEllipses(p.use_ellipses), @@ -205,7 +205,7 @@ LLFolderView::LLFolderView(const Params& p) mAutoOpenItems.setDepth(AUTO_OPEN_STACK_DEPTH); mAutoOpenCandidate = NULL; mAutoOpenTimer.stop(); - mKeyboardSelection = FALSE; + mKeyboardSelection = false; mIndentation = getParentFolder() ? getParentFolder()->getIndentation() + mLocalIndentation : 0; //clear label @@ -286,9 +286,9 @@ LLFolderView::~LLFolderView( void ) mViewModel = NULL; } -BOOL LLFolderView::canFocusChildren() const +bool LLFolderView::canFocusChildren() const { - return FALSE; + return false; } void LLFolderView::addFolder( LLFolderViewFolder* folder) @@ -299,7 +299,7 @@ void LLFolderView::addFolder( LLFolderViewFolder* folder) void LLFolderView::closeAllFolders() { // Close all the folders - setOpenArrangeRecursively(FALSE, LLFolderViewFolder::RECURSE_DOWN); + setOpenArrangeRecursively(false, LLFolderViewFolder::RECURSE_DOWN); arrangeAll(); } @@ -309,7 +309,7 @@ void LLFolderView::openTopLevelFolders() iter != mFolders.end();) { folders_t::iterator fit = iter++; - (*fit)->setOpen(TRUE); + (*fit)->setOpen(true); } } @@ -349,7 +349,7 @@ void LLFolderView::filter( LLFolderViewFilter& filter ) getViewModelItem()->filter(filter); } -void LLFolderView::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLFolderView::reshape(S32 width, S32 height, bool called_from_parent) { LLRect scroll_rect; if (mScrollContainer) @@ -366,7 +366,7 @@ void LLFolderView::reshape(S32 width, S32 height, BOOL called_from_parent) width = scroll_rect.getWidth(); } LLView::reshape(width, height, called_from_parent); - mReshapeSignal(mSelectedItems, FALSE); + mReshapeSignal(mSelectedItems, false); } void LLFolderView::addToSelectionList(LLFolderViewItem* item) @@ -377,9 +377,9 @@ void LLFolderView::addToSelectionList(LLFolderViewItem* item) } if (mSelectedItems.size()) { - mSelectedItems.back()->setIsCurSelection(FALSE); + mSelectedItems.back()->setIsCurSelection(false); } - item->setIsCurSelection(TRUE); + item->setIsCurSelection(true); mSelectedItems.push_back(item); } @@ -387,7 +387,7 @@ void LLFolderView::removeFromSelectionList(LLFolderViewItem* item) { if (mSelectedItems.size()) { - mSelectedItems.back()->setIsCurSelection(FALSE); + mSelectedItems.back()->setIsCurSelection(false); } selected_items_t::iterator item_iter; @@ -404,7 +404,7 @@ void LLFolderView::removeFromSelectionList(LLFolderViewItem* item) } if (mSelectedItems.size()) { - mSelectedItems.back()->setIsCurSelection(TRUE); + mSelectedItems.back()->setIsCurSelection(true); } } @@ -425,19 +425,19 @@ LLFolderView::selected_items_t& LLFolderView::getSelectedItems( void ) } // Record the selected item and pass it down the hierachy. -BOOL LLFolderView::setSelection(LLFolderViewItem* selection, BOOL openitem, - BOOL take_keyboard_focus) +bool LLFolderView::setSelection(LLFolderViewItem* selection, bool openitem, + bool take_keyboard_focus) { mSignalSelectCallback = take_keyboard_focus ? SIGNAL_KEYBOARD_FOCUS : SIGNAL_NO_KEYBOARD_FOCUS; if( selection == this ) { - return FALSE; + return false; } if( selection && take_keyboard_focus) { - mParentPanel.get()->setFocus(TRUE); + mParentPanel.get()->setFocus(true); } // clear selection down here because change of keyboard focus can potentially @@ -449,7 +449,7 @@ BOOL LLFolderView::setSelection(LLFolderViewItem* selection, BOOL openitem, addToSelectionList(selection); } - BOOL rv = LLFolderViewFolder::setSelection(selection, openitem, take_keyboard_focus); + bool rv = LLFolderViewFolder::setSelection(selection, openitem, take_keyboard_focus); if(openitem && selection) { selection->getParentFolder()->requestArrange(); @@ -460,14 +460,14 @@ BOOL LLFolderView::setSelection(LLFolderViewItem* selection, BOOL openitem, return rv; } -BOOL LLFolderView::changeSelection(LLFolderViewItem* selection, BOOL selected) +bool LLFolderView::changeSelection(LLFolderViewItem* selection, bool selected) { - BOOL rv = FALSE; + bool rv = false; // can't select root folder if(!selection || selection == this) { - return FALSE; + return false; } if (!mAllowMultiSelect) @@ -484,7 +484,7 @@ BOOL LLFolderView::changeSelection(LLFolderViewItem* selection, BOOL selected) } } - BOOL on_list = (item_iter != mSelectedItems.end()); + bool on_list = (item_iter != mSelectedItems.end()); if(selected && !on_list) { @@ -516,7 +516,7 @@ void LLFolderView::sanitizeSelection() LLFolderViewItem* item = *item_iter; // ensure that each ancestor is open and potentially passes filtering - BOOL visible = false; + bool visible = false; if(item->getViewModelItem() != NULL) { visible = item->getViewModelItem()->potentiallyVisible(); // initialize from filter state for this item @@ -564,7 +564,7 @@ void LLFolderView::sanitizeSelection() std::vector<LLFolderViewItem*>::iterator item_it; for (item_it = items_to_remove.begin(); item_it != items_to_remove.end(); ++item_it ) { - changeSelection(*item_it, FALSE); // toggle selection (also removes from list) + changeSelection(*item_it, false); // toggle selection (also removes from list) } // if nothing selected after prior constraints... @@ -602,7 +602,7 @@ void LLFolderView::sanitizeSelection() if (new_selection) { - setSelection(new_selection, FALSE, FALSE); + setSelection(new_selection, false, false); } } } @@ -670,12 +670,12 @@ void LLFolderView::draw() if (hasVisibleChildren()) { - mStatusTextBox->setVisible( FALSE ); + mStatusTextBox->setVisible( false ); } else if (mShowEmptyMessage) { mStatusTextBox->setValue(getFolderViewModel()->getStatusText(mItems.empty() && mFolders.empty())); - mStatusTextBox->setVisible( TRUE ); + mStatusTextBox->setVisible( true ); // firstly reshape message textbox with current size. This is necessary to // LLTextBox::getTextPixelHeight works properly @@ -717,7 +717,7 @@ void LLFolderView::draw() // and arrow for the root folder LLView::draw(); - mDragAndDropThisFrame = FALSE; + mDragAndDropThisFrame = false; } void LLFolderView::finishRenamingItem( void ) @@ -758,7 +758,7 @@ void LLFolderView::removeSelectedItems() // items, since the removal will futz with internal data // structures. std::vector<LLFolderViewItem*> items; - S32 count = mSelectedItems.size(); + auto count = mSelectedItems.size(); if(count <= 0) return; LLFolderViewItem* item = NULL; selected_items_t::iterator item_it; @@ -803,7 +803,7 @@ void LLFolderView::removeSelectedItems() setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel.get()->hasFocus()); listeners.reserve(count); - for(S32 i = 0; i < count; ++i) + for(size_t i = 0; i < count; ++i) { listener = items[i]->getViewModelItem(); if(listener && (std::find(listeners.begin(), listeners.end(), listener) == listeners.end())) @@ -836,7 +836,7 @@ void LLFolderView::autoOpenItem( LLFolderViewFolder* item ) while (close_item && close_item != item->getParentFolder()) { mAutoOpenItems.pop(); - close_item->setOpenArrangeRecursively(FALSE); + close_item->setOpenArrangeRecursively(false); close_item = mAutoOpenItems.check(); } @@ -844,7 +844,7 @@ void LLFolderView::autoOpenItem( LLFolderViewFolder* item ) mAutoOpenItems.push(item); - item->setOpen(TRUE); + item->setOpen(true); if(!item->isSingleFolderMode()) { LLRect content_rect = (mScrollContainer ? mScrollContainer->getContentWindowRect() : LLRect()); @@ -858,7 +858,7 @@ void LLFolderView::closeAutoOpenedFolders() while (mAutoOpenItems.check()) { LLFolderViewFolder* close_item = mAutoOpenItems.pop(); - close_item->setOpen(FALSE); + close_item->setOpen(false); } if (mAutoOpenCandidate) @@ -869,7 +869,7 @@ void LLFolderView::closeAutoOpenedFolders() mAutoOpenTimer.stop(); } -BOOL LLFolderView::autoOpenTest(LLFolderViewFolder* folder) +bool LLFolderView::autoOpenTest(LLFolderViewFolder* folder) { if (folder && mAutoOpenCandidate == folder) { @@ -883,10 +883,10 @@ BOOL LLFolderView::autoOpenTest(LLFolderViewFolder* folder) { autoOpenItem(folder); mAutoOpenTimer.stop(); - return TRUE; + return true; } } - return FALSE; + return false; } // otherwise new candidate, restart timer @@ -896,14 +896,14 @@ BOOL LLFolderView::autoOpenTest(LLFolderViewFolder* folder) } mAutoOpenCandidate = folder; mAutoOpenTimer.start(); - return FALSE; + return false; } -BOOL LLFolderView::canCopy() const +bool LLFolderView::canCopy() const { if (!(getVisible() && getEnabled() && (mSelectedItems.size() > 0))) { - return FALSE; + return false; } for (selected_items_t::const_iterator selected_it = mSelectedItems.begin(); selected_it != mSelectedItems.end(); ++selected_it) @@ -911,10 +911,10 @@ BOOL LLFolderView::canCopy() const const LLFolderViewItem* item = *selected_it; if (!item->getViewModelItem()->isItemCopyable()) { - return FALSE; + return false; } } - return TRUE; + return true; } // copy selected item @@ -922,7 +922,7 @@ void LLFolderView::copy() { // *NOTE: total hack to clear the inventory clipboard LLClipboard::instance().reset(); - S32 count = mSelectedItems.size(); + auto count = mSelectedItems.size(); if(getVisible() && getEnabled() && (count > 0)) { LLFolderViewModelItem* listener = NULL; @@ -939,11 +939,11 @@ void LLFolderView::copy() mSearchString.clear(); } -BOOL LLFolderView::canCut() const +bool LLFolderView::canCut() const { if (!(getVisible() && getEnabled() && (mSelectedItems.size() > 0))) { - return FALSE; + return false; } for (selected_items_t::const_iterator selected_it = mSelectedItems.begin(); selected_it != mSelectedItems.end(); ++selected_it) @@ -953,10 +953,10 @@ BOOL LLFolderView::canCut() const if (!listener || !listener->isItemRemovable()) { - return FALSE; + return false; } } - return TRUE; + return true; } void LLFolderView::cut() @@ -988,11 +988,11 @@ void LLFolderView::cut() mSearchString.clear(); } -BOOL LLFolderView::canPaste() const +bool LLFolderView::canPaste() const { if (mSelectedItems.empty()) { - return FALSE; + return false; } if(getVisible() && getEnabled()) @@ -1009,13 +1009,13 @@ BOOL LLFolderView::canPaste() const listener = folderp->getViewModelItem(); if (!listener || !listener->isClipboardPasteable()) { - return FALSE; + return false; } } } - return TRUE; + return true; } - return FALSE; + return false; } // paste selected item @@ -1059,7 +1059,7 @@ void LLFolderView::startRenamingSelectedItem( void ) // make sure selection is visible scrollToShowSelection(); - S32 count = mSelectedItems.size(); + auto count = mSelectedItems.size(); LLFolderViewItem* item = NULL; if(count > 0) { @@ -1075,9 +1075,9 @@ void LLFolderView::startRenamingSelectedItem( void ) mRenamer->setText(item->getName()); mRenamer->selectAll(); - mRenamer->setVisible( TRUE ); + mRenamer->setVisible( true ); // set focus will fail unless item is visible - mRenamer->setFocus( TRUE ); + mRenamer->setFocus( true ); if (!mRenamerTopLostSignalConnection.connected()) { mRenamerTopLostSignalConnection = mRenamer->setTopLostCallback(boost::bind(&LLFolderView::onRenamerLost, this)); @@ -1086,9 +1086,9 @@ void LLFolderView::startRenamingSelectedItem( void ) } } -BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) +bool LLFolderView::handleKeyHere( KEY key, MASK mask ) { - BOOL handled = FALSE; + bool handled = false; // SL-51858: Key presses are not being passed to the Popup menu. // A proper fix is non-trivial so instead just close the menu. @@ -1103,7 +1103,7 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) case KEY_F2: mSearchString.clear(); startRenamingSelectedItem(); - handled = TRUE; + handled = true; break; case KEY_RETURN: @@ -1113,7 +1113,7 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) { finishRenamingItem(); mSearchString.clear(); - handled = TRUE; + handled = true; } } break; @@ -1122,7 +1122,7 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) if( mRenameItem && mRenamer->getVisible() ) { closeRenamer(); - handled = TRUE; + handled = true; } mSearchString.clear(); break; @@ -1133,7 +1133,7 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) { mScrollContainer->pageUp(30); } - handled = TRUE; + handled = true; break; case KEY_PAGE_DOWN: @@ -1142,7 +1142,7 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) { mScrollContainer->pageDown(30); } - handled = TRUE; + handled = true; break; case KEY_HOME: @@ -1151,7 +1151,7 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) { mScrollContainer->goToTop(); } - handled = TRUE; + handled = true; break; case KEY_END: @@ -1166,14 +1166,14 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) if((mSelectedItems.size() > 0) && mScrollContainer) { LLFolderViewItem* last_selected = getCurSelectedItem(); - BOOL shift_select = mask & MASK_SHIFT; + bool shift_select = mask & MASK_SHIFT; // don't shift select down to children of folders (they are implicitly selected through parent) LLFolderViewItem* next = last_selected->getNextOpenNode(!shift_select); if (!mKeyboardSelection || (!shift_select && (!next || next == last_selected))) { - setSelection(last_selected, FALSE, TRUE); - mKeyboardSelection = TRUE; + setSelection(last_selected, false, true); + mKeyboardSelection = true; } if (shift_select) @@ -1183,12 +1183,12 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) if (next->isSelected()) { // shrink selection - changeSelection(last_selected, FALSE); + changeSelection(last_selected, false); } else if (last_selected->getParentFolder() == next->getParentFolder()) { // grow selection - changeSelection(next, TRUE); + changeSelection(next, true); } } } @@ -1202,11 +1202,11 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) if(notifyParent(LLSD().with("action","select_next")) > 0 )//message was processed { clearSelection(); - return TRUE; + return true; } - return FALSE; + return false; } - setSelection( next, FALSE, TRUE ); + setSelection( next, false, true ); } else { @@ -1214,14 +1214,14 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) if(notifyParent(LLSD().with("action","select_next")) > 0 )//message was processed { clearSelection(); - return TRUE; + return true; } - return FALSE; + return false; } } scrollToShowSelection(); mSearchString.clear(); - handled = TRUE; + handled = true; } break; @@ -1229,14 +1229,14 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) if((mSelectedItems.size() > 0) && mScrollContainer) { LLFolderViewItem* last_selected = mSelectedItems.back(); - BOOL shift_select = mask & MASK_SHIFT; + bool shift_select = mask & MASK_SHIFT; // don't shift select down to children of folders (they are implicitly selected through parent) LLFolderViewItem* prev = last_selected->getPreviousOpenNode(!shift_select); if (!mKeyboardSelection || (!shift_select && prev == this)) { - setSelection(last_selected, FALSE, TRUE); - mKeyboardSelection = TRUE; + setSelection(last_selected, false, true); + mKeyboardSelection = true; } if (shift_select) @@ -1246,12 +1246,12 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) if (prev->isSelected()) { // shrink selection - changeSelection(last_selected, FALSE); + changeSelection(last_selected, false); } else if (last_selected->getParentFolder() == prev->getParentFolder()) { // grow selection - changeSelection(prev, TRUE); + changeSelection(prev, true); } } } @@ -1265,18 +1265,18 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) if(notifyParent(LLSD().with("action","select_prev")) > 0 )//message was processed { clearSelection(); - return TRUE; + return true; } - return FALSE; + return false; } - setSelection( prev, FALSE, TRUE ); + setSelection( prev, false, true ); } } scrollToShowSelection(); mSearchString.clear(); - handled = TRUE; + handled = true; } break; @@ -1284,9 +1284,9 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) if(mSelectedItems.size()) { LLFolderViewItem* last_selected = getCurSelectedItem(); - last_selected->setOpen( TRUE ); + last_selected->setOpen( true ); mSearchString.clear(); - handled = TRUE; + handled = true; } break; @@ -1296,21 +1296,21 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) LLFolderViewItem* last_selected = getCurSelectedItem(); if(last_selected && last_selected->isSingleFolderMode()) { - handled = FALSE; + handled = false; break; } LLFolderViewItem* parent_folder = last_selected->getParentFolder(); if (!last_selected->isOpen() && parent_folder && parent_folder->getParentFolder()) { - setSelection(parent_folder, FALSE, TRUE); + setSelection(parent_folder, false, true); } else { - last_selected->setOpen( FALSE ); + last_selected->setOpen( false ); } mSearchString.clear(); scrollToShowSelection(); - handled = TRUE; + handled = true; } break; } @@ -1319,20 +1319,20 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) } -BOOL LLFolderView::handleUnicodeCharHere(llwchar uni_char) +bool LLFolderView::handleUnicodeCharHere(llwchar uni_char) { if ((uni_char < 0x20) || (uni_char == 0x7F)) // Control character or DEL { - return FALSE; + return false; } if (uni_char > 0x7f) { LL_WARNS() << "LLFolderView::handleUnicodeCharHere - Don't handle non-ascii yet, aborting" << LL_ENDL; - return FALSE; + return false; } - BOOL handled = FALSE; + bool handled = false; if (mParentPanel.get()->hasFocus()) { // SL-51858: Key presses are not being passed to the Popup menu. @@ -1353,28 +1353,28 @@ BOOL LLFolderView::handleUnicodeCharHere(llwchar uni_char) { mSearchString += uni_char; } - search(getCurSelectedItem(), mSearchString, FALSE); + search(getCurSelectedItem(), mSearchString, false); - handled = TRUE; + handled = true; } return handled; } -BOOL LLFolderView::handleMouseDown( S32 x, S32 y, MASK mask ) +bool LLFolderView::handleMouseDown( S32 x, S32 y, MASK mask ) { - mKeyboardSelection = FALSE; + mKeyboardSelection = false; mSearchString.clear(); - mParentPanel.get()->setFocus(TRUE); + mParentPanel.get()->setFocus(true); LLEditMenuHandler::gEditMenuHandler = this; return LLView::handleMouseDown( x, y, mask ); } -BOOL LLFolderView::search(LLFolderViewItem* first_item, const std::string &search_string, BOOL backward) +bool LLFolderView::search(LLFolderViewItem* first_item, const std::string &search_string, bool backward) { // get first selected item LLFolderViewItem* search_item = first_item; @@ -1391,7 +1391,7 @@ BOOL LLFolderView::search(LLFolderViewItem* first_item, const std::string &searc } // search over all open nodes for first substring match (with wrapping) - BOOL found = FALSE; + bool found = false; LLFolderViewItem* original_search_item = search_item; do { @@ -1414,10 +1414,10 @@ BOOL LLFolderView::search(LLFolderViewItem* first_item, const std::string &searc std::string current_item_label(search_item->getViewModelItem()->getSearchableName()); LLStringUtil::toUpper(current_item_label); - S32 search_string_length = llmin(upper_case_string.size(), current_item_label.size()); + auto search_string_length = llmin(upper_case_string.size(), current_item_label.size()); if (!current_item_label.compare(0, search_string_length, upper_case_string)) { - found = TRUE; + found = true; break; } if (backward) @@ -1434,27 +1434,27 @@ BOOL LLFolderView::search(LLFolderViewItem* first_item, const std::string &searc if (found) { - setSelection(search_item, FALSE, TRUE); + setSelection(search_item, false, true); scrollToShowSelection(); } return found; } -BOOL LLFolderView::handleDoubleClick( S32 x, S32 y, MASK mask ) +bool LLFolderView::handleDoubleClick( S32 x, S32 y, MASK mask ) { // skip LLFolderViewFolder::handleDoubleClick() return LLView::handleDoubleClick( x, y, mask ); } -BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask ) +bool LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask ) { // all user operations move keyboard focus to inventory // this way, we know when to stop auto-updating a search - mParentPanel.get()->setFocus(TRUE); + mParentPanel.get()->setFocus(true); - BOOL handled = childrenHandleRightMouseDown(x, y, mask) != NULL; - S32 count = mSelectedItems.size(); + bool handled = childrenHandleRightMouseDown(x, y, mask) != NULL; + auto count = mSelectedItems.size(); LLMenuGL* menu = static_cast<LLMenuGL*>(mPopupMenuHandle.get()); if (!menu) @@ -1485,10 +1485,10 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask ) } } - BOOL item_clicked = FALSE; - for (selected_items_t::iterator item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) + bool item_clicked{ false }; + for (const auto item : mSelectedItems) { - item_clicked |= (*item_it)->getRect().pointInRect(x, y); + item_clicked |= item->getRect().pointInRect(x, y); } if(!item_clicked && mSingleFolderMode) { @@ -1525,15 +1525,15 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask ) { if (menu && menu->getVisible()) { - menu->setVisible(FALSE); + menu->setVisible(false); } - setSelection(NULL, FALSE, TRUE); + setSelection(NULL, false, true); } return handled; } // Add "--no options--" if the menu is completely blank. -BOOL LLFolderView::addNoOptions(LLMenuGL* menu) const +bool LLFolderView::addNoOptions(LLMenuGL* menu) const { const std::string nooptions_str = "--no options--"; LLView *nooptions_item = NULL; @@ -1546,7 +1546,7 @@ BOOL LLFolderView::addNoOptions(LLMenuGL* menu) const LLView *menu_item = (*itor); if (menu_item->getVisible()) { - return FALSE; + return false; } std::string name = menu_item->getName(); if (menu_item->getName() == nooptions_str) @@ -1556,14 +1556,14 @@ BOOL LLFolderView::addNoOptions(LLMenuGL* menu) const } if (nooptions_item) { - nooptions_item->setVisible(TRUE); - nooptions_item->setEnabled(FALSE); - return TRUE; + nooptions_item->setVisible(true); + nooptions_item->setEnabled(false); + return true; } - return FALSE; + return false; } -BOOL LLFolderView::handleHover( S32 x, S32 y, MASK mask ) +bool LLFolderView::handleHover( S32 x, S32 y, MASK mask ) { return LLView::handleHover( x, y, mask ); } @@ -1584,15 +1584,15 @@ void LLFolderView::setHoveredItem(LLFolderViewItem* itemp) } } -BOOL LLFolderView::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +bool LLFolderView::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) { - mDragAndDropThisFrame = TRUE; + mDragAndDropThisFrame = true; // have children handle it first - BOOL handled = LLView::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, + bool handled = LLView::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); // when drop is not handled by child, it should be handled @@ -1627,7 +1627,7 @@ void LLFolderView::scrollToShowSelection() { if ( mSelectedItems.size() ) { - mNeedsScroll = TRUE; + mNeedsScroll = true; } } @@ -1640,7 +1640,7 @@ void LLFolderView::scrollToShowItem(LLFolderViewItem* item, const LLRect& constr // don't scroll to items when mouse is being used to scroll/drag and drop if (gFocusMgr.childHasMouseCapture(mScrollContainer)) { - mNeedsScroll = FALSE; + mNeedsScroll = false; return; } @@ -1678,18 +1678,18 @@ LLRect LLFolderView::getVisibleRect() return visible_rect; } -BOOL LLFolderView::getShowSelectionContext() +bool LLFolderView::getShowSelectionContext() { if (mShowSelectionContext) { - return TRUE; + return true; } LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get(); if (menu && menu->getVisible()) { - return TRUE; + return true; } - return FALSE; + return false; } void LLFolderView::setShowSingleSelection(bool show) @@ -1720,7 +1720,7 @@ void LLFolderView::update() if (filter_object.isModified() && filter_object.isNotDefault() && mParentPanel.get()->getVisible()) { - mNeedsAutoSelect = TRUE; + mNeedsAutoSelect = true; } // Filter to determine visibility before arranging @@ -1747,7 +1747,7 @@ void LLFolderView::update() applyFunctorRecursively(functor); } - // Open filtered folders for folder views with mAutoSelectOverride=TRUE. + // Open filtered folders for folder views with mAutoSelectOverride=true. // Used by LLPlacesFolderView. if (filter_object.showAllResults()) { @@ -1760,7 +1760,7 @@ void LLFolderView::update() scrollToShowSelection(); } - BOOL filter_finished = mViewModel->contentsReady() + bool filter_finished = mViewModel->contentsReady() && (getViewModelItem()->passedFilter() || ( getViewModelItem()->getLastFilterGeneration() >= filter_object.getFirstSuccessGeneration() && !filter_modified)); @@ -1769,10 +1769,10 @@ void LLFolderView::update() || gFocusMgr.childHasMouseCapture(mParentPanel.get())) { // finishing the filter process, giving focus to the folder view, or dragging the scrollbar all stop the auto select process - mNeedsAutoSelect = FALSE; + mNeedsAutoSelect = false; } - BOOL is_visible = isInVisibleChain() || mForceArrange; + bool is_visible = isInVisibleChain() || mForceArrange; //Puts folders/items in proper positions // arrange() takes the model filter flag into account and call sort() if necessary (CHUI-849) @@ -1797,7 +1797,7 @@ void LLFolderView::update() if (!mPinningSelectedItem && !mSelectedItems.empty()) { // lets pin it! - mPinningSelectedItem = TRUE; + mPinningSelectedItem = true; //Computes visible area const LLRect visible_content_rect = (mScrollContainer ? mScrollContainer->getVisibleContentRect() : LLRect()); @@ -1832,7 +1832,7 @@ void LLFolderView::update() // stop pinning selected item after folders stop rearranging if (!needsArrange()) { - mPinningSelectedItem = FALSE; + mPinningSelectedItem = false; } } @@ -1868,7 +1868,7 @@ void LLFolderView::update() } if (!needs_arrange || !is_visible) { - mNeedsScroll = FALSE; + mNeedsScroll = false; } } } @@ -1885,15 +1885,15 @@ void LLFolderView::update() if (mSignalSelectCallback) { //RN: we use keyboard focus as a proxy for user-explicit actions - BOOL take_keyboard_focus = (mSignalSelectCallback == SIGNAL_KEYBOARD_FOCUS); + bool take_keyboard_focus = (mSignalSelectCallback == SIGNAL_KEYBOARD_FOCUS); mSelectSignal(mSelectedItems, take_keyboard_focus); } - mSignalSelectCallback = FALSE; + mSignalSelectCallback = false; } } else { - mSignalSelectCallback = FALSE; + mSignalSelectCallback = false; } } @@ -1928,7 +1928,7 @@ void LLFolderView::updateRenamerPosition() S32 width = llmax(llmin(mRenameItem->getRect().getWidth() - x, scroller_rect.getWidth() - x - getRect().mLeft), MINIMUM_RENAMER_WIDTH); S32 height = mRenameItem->getItemHeight() - RENAME_HEIGHT_PAD; - mRenamer->reshape( width, height, TRUE ); + mRenamer->reshape( width, height, true ); } } @@ -1940,9 +1940,9 @@ void LLFolderView::updateMenuOptions(LLMenuGL* menu) LLView::child_list_t::const_iterator menu_itor; for (menu_itor = list->begin(); menu_itor != list->end(); ++menu_itor) { - (*menu_itor)->setVisible(FALSE); - (*menu_itor)->pushVisible(TRUE); - (*menu_itor)->setEnabled(TRUE); + (*menu_itor)->setVisible(false); + (*menu_itor)->pushVisible(true); + (*menu_itor)->setEnabled(true); } // Successively filter out invalid options @@ -2008,7 +2008,7 @@ bool LLFolderView::selectFirstItem() { LLFolderViewItem* itemp = folder->getNextFromChild(0,true); if(itemp) - setSelection(itemp,FALSE,TRUE); + setSelection(itemp,false,true); return true; } @@ -2019,7 +2019,7 @@ bool LLFolderView::selectFirstItem() LLFolderViewItem* itemp = (*iit); if (itemp->getVisible()) { - setSelection(itemp,FALSE,TRUE); + setSelection(itemp,false,true); return true; } } @@ -2033,7 +2033,7 @@ bool LLFolderView::selectLastItem() LLFolderViewItem* itemp = (*iit); if (itemp->getVisible()) { - setSelection(itemp,FALSE,TRUE); + setSelection(itemp,false,true); return true; } } @@ -2045,7 +2045,7 @@ bool LLFolderView::selectLastItem() { LLFolderViewItem* itemp = folder->getPreviousFromChild(0,true); if(itemp) - setSelection(itemp,FALSE,TRUE); + setSelection(itemp,false,true); return true; } } @@ -2086,15 +2086,15 @@ void LLFolderView::onRenamerLost() { if (mRenamer && mRenamer->getVisible()) { - mRenamer->setVisible(FALSE); + mRenamer->setVisible(false); // will commit current name (which could be same as original name) - mRenamer->setFocus(FALSE); + mRenamer->setFocus(false); } if( mRenameItem ) { - setSelection( mRenameItem, TRUE ); + setSelection( mRenameItem, true ); mRenameItem = NULL; } } @@ -2102,17 +2102,17 @@ void LLFolderView::onRenamerLost() LLFolderViewItem* LLFolderView::getNextUnselectedItem() { LLFolderViewItem* last_item = *mSelectedItems.rbegin(); - LLFolderViewItem* new_selection = last_item->getNextOpenNode(FALSE); + LLFolderViewItem* new_selection = last_item->getNextOpenNode(false); while(new_selection && new_selection->isSelected()) { - new_selection = new_selection->getNextOpenNode(FALSE); + new_selection = new_selection->getNextOpenNode(false); } if (!new_selection) { - new_selection = last_item->getPreviousOpenNode(FALSE); + new_selection = last_item->getPreviousOpenNode(false); while (new_selection && (new_selection->isInSelection())) { - new_selection = new_selection->getPreviousOpenNode(FALSE); + new_selection = new_selection->getPreviousOpenNode(false); } } return new_selection; diff --git a/indra/llui/llfolderview.h b/indra/llui/llfolderview.h index ca78bd3072..62ef2a0626 100644 --- a/indra/llui/llfolderview.h +++ b/indra/llui/llfolderview.h @@ -109,7 +109,7 @@ public: LLFolderView(const Params&); virtual ~LLFolderView( void ); - virtual BOOL canFocusChildren() const; + virtual bool canFocusChildren() const; virtual const LLFolderView* getRoot() const { return this; } virtual LLFolderView* getRoot() { return this; } @@ -120,7 +120,7 @@ public: LLFolderViewGroupedItemModel* getFolderViewGroupedItemModel() { return mGroupedItemModel; } const LLFolderViewGroupedItemModel* getFolderViewGroupedItemModel() const { return mGroupedItemModel; } - typedef boost::signals2::signal<void (const std::deque<LLFolderViewItem*>& items, BOOL user_action)> signal_t; + typedef boost::signals2::signal<void (const std::deque<LLFolderViewItem*>& items, bool user_action)> signal_t; void setSelectCallback(const signal_t::slot_type& cb) { mSelectSignal.connect(cb); } void setReshapeCallback(const signal_t::slot_type& cb) { mReshapeSignal.connect(cb); } @@ -156,12 +156,12 @@ public: selected_items_t& getSelectedItems( void ); // Record the selected item and pass it down the hierarchy. - virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem, - BOOL take_keyboard_focus = TRUE); + virtual bool setSelection(LLFolderViewItem* selection, bool openitem, + bool take_keyboard_focus = true); // This method is used to toggle the selection of an item. Walks // children, and keeps track of selected objects. - virtual BOOL changeSelection(LLFolderViewItem* selection, BOOL selected); + virtual bool changeSelection(LLFolderViewItem* selection, bool selected); virtual std::set<LLFolderViewItem*> getSelectionList() const; @@ -172,7 +172,7 @@ public: void removeFromSelectionList(LLFolderViewItem* item); bool startDrag(); - void setDragAndDropThisFrame() { mDragAndDropThisFrame = TRUE; } + void setDragAndDropThisFrame() { mDragAndDropThisFrame = true; } void setDraggingOverItem(LLFolderViewItem* item) { mDraggingOverItem = item; } LLFolderViewItem* getDraggingOverItem() { return mDraggingOverItem; } @@ -181,17 +181,17 @@ public: void autoOpenItem(LLFolderViewFolder* item); void closeAutoOpenedFolders(); - BOOL autoOpenTest(LLFolderViewFolder* item); - BOOL isOpen() const { return TRUE; } // root folder always open + bool autoOpenTest(LLFolderViewFolder* item); + bool isOpen() const { return true; } // root folder always open // Copy & paste - virtual BOOL canCopy() const; + virtual bool canCopy() const; virtual void copy(); - virtual BOOL canCut() const; + virtual bool canCut() const; virtual void cut(); - virtual BOOL canPaste() const; + virtual bool canPaste() const; virtual void paste(); LLFolderViewItem* getNextUnselectedItem(); @@ -200,20 +200,20 @@ public: void startRenamingSelectedItem( void ); // LLView functionality - ///*virtual*/ BOOL handleKey( KEY key, MASK mask, BOOL called_from_parent ); - /*virtual*/ BOOL handleKeyHere( KEY key, MASK mask ); - /*virtual*/ BOOL handleUnicodeCharHere(llwchar uni_char); - /*virtual*/ BOOL handleMouseDown( S32 x, S32 y, MASK mask ); - /*virtual*/ BOOL handleDoubleClick( S32 x, S32 y, MASK mask ); - /*virtual*/ BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); - /*virtual*/ BOOL handleHover( S32 x, S32 y, MASK mask ); - /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + ///*virtual*/ bool handleKey( KEY key, MASK mask, bool called_from_parent ); + /*virtual*/ bool handleKeyHere( KEY key, MASK mask ); + /*virtual*/ bool handleUnicodeCharHere(llwchar uni_char); + /*virtual*/ bool handleMouseDown( S32 x, S32 y, MASK mask ); + /*virtual*/ bool handleDoubleClick( S32 x, S32 y, MASK mask ); + /*virtual*/ bool handleRightMouseDown( S32 x, S32 y, MASK mask ); + /*virtual*/ bool handleHover( S32 x, S32 y, MASK mask ); + /*virtual*/ bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg); - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); - /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask) { setShowSelectionContext(FALSE); } + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true); + /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask) { setShowSelectionContext(false); } virtual void draw(); virtual void deleteAllChildren(); @@ -223,22 +223,22 @@ public: void setScrollContainer( LLScrollContainer* parent ) { mScrollContainer = parent; } LLRect getVisibleRect(); - BOOL search(LLFolderViewItem* first_item, const std::string &search_string, BOOL backward); + bool search(LLFolderViewItem* first_item, const std::string &search_string, bool backward); void setShowSelectionContext(bool show) { mShowSelectionContext = show; } - BOOL getShowSelectionContext(); + bool getShowSelectionContext(); void setShowSingleSelection(bool show); - BOOL getShowSingleSelection() { return mShowSingleSelection; } + bool getShowSingleSelection() { return mShowSingleSelection; } F32 getSelectionFadeElapsedTime() { return mMultiSelectionFadeTimer.getElapsedTimeF32(); } bool getUseEllipses() { return mUseEllipses; } S32 getSelectedCount() { return (S32)mSelectedItems.size(); } void update(); // needs to be called periodically (e.g. once per frame) - BOOL needsAutoSelect() { return mNeedsAutoSelect && !mAutoSelectOverride; } - BOOL needsAutoRename() { return mNeedsAutoRename; } - void setNeedsAutoRename(BOOL val) { mNeedsAutoRename = val; } - void setPinningSelectedItem(BOOL val) { mPinningSelectedItem = val; } - void setAutoSelectOverride(BOOL val) { mAutoSelectOverride = val; } + bool needsAutoSelect() { return mNeedsAutoSelect && !mAutoSelectOverride; } + bool needsAutoRename() { return mNeedsAutoRename; } + void setNeedsAutoRename(bool val) { mNeedsAutoRename = val; } + void setPinningSelectedItem(bool val) { mPinningSelectedItem = val; } + void setAutoSelectOverride(bool val) { mAutoSelectOverride = val; } bool showItemLinkOverlays() { return mShowItemLinkOverlays; } @@ -280,7 +280,7 @@ protected: bool selectFirstItem(); bool selectLastItem(); - BOOL addNoOptions(LLMenuGL* menu) const; + bool addNoOptions(LLMenuGL* menu) const; protected: @@ -386,14 +386,14 @@ public: class LLSelectFirstFilteredItem : public LLFolderViewFunctor { public: - LLSelectFirstFilteredItem() : mItemSelected(FALSE), mFolderSelected(FALSE) {} + LLSelectFirstFilteredItem() : mItemSelected(false), mFolderSelected(false) {} virtual ~LLSelectFirstFilteredItem() {} virtual void doFolder(LLFolderViewFolder* folder); virtual void doItem(LLFolderViewItem* item); - BOOL wasItemSelected() { return mItemSelected || mFolderSelected; } + bool wasItemSelected() { return mItemSelected || mFolderSelected; } protected: - BOOL mItemSelected; - BOOL mFolderSelected; + bool mItemSelected; + bool mFolderSelected; }; class LLOpenFilteredFolders : public LLFolderViewFunctor @@ -408,15 +408,15 @@ public: class LLSaveFolderState : public LLFolderViewFunctor { public: - LLSaveFolderState() : mApply(FALSE) {} + LLSaveFolderState() : mApply(false) {} virtual ~LLSaveFolderState() {} virtual void doFolder(LLFolderViewFolder* folder); virtual void doItem(LLFolderViewItem* item) {} - void setApply(BOOL apply); + void setApply(bool apply); void clearOpenFolders() { mOpenFolders.clear(); } protected: std::set<LLUUID> mOpenFolders; - BOOL mApply; + bool mApply; }; class LLOpenFoldersWithSelection : public LLFolderViewFunctor diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index a9e1171444..82cd2483e8 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -128,18 +128,18 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p) mSuffixNeedsRefresh(false), mLabelPaddingRight(DEFAULT_LABEL_PADDING_RIGHT), mParentFolder( NULL ), - mIsSelected( FALSE ), - mIsCurSelection( FALSE ), - mSelectPending(FALSE), + mIsSelected( false ), + mIsCurSelection( false ), + mSelectPending(false), mIsItemCut(false), mCutGeneration(0), mLabelStyle( LLFontGL::NORMAL ), - mHasVisibleChildren(FALSE), + mHasVisibleChildren(false), mLocalIndentation(p.folder_indentation), mIndentation(0), mItemHeight(p.item_height), mControlLabelRotation(0.f), - mDragAndDropTarget(FALSE), + mDragAndDropTarget(false), mLabel(p.name), mRoot(p.root), mViewModelItem(p.listener), @@ -185,7 +185,7 @@ LLFolderViewItem::~LLFolderViewItem() gFocusMgr.removeKeyboardFocusWithoutCallback(this); } -BOOL LLFolderViewItem::postBuild() +bool LLFolderViewItem::postBuild() { LLFolderViewModelItem* vmi = getViewModelItem(); llassert(vmi); // not supposed to happen, if happens, find out why and fix @@ -207,7 +207,7 @@ BOOL LLFolderViewItem::postBuild() // while LLFolderViewItem::arrange() updates visual part mSuffixNeedsRefresh = true; mLabelWidthDirty = true; - return TRUE; + return true; } LLFolderView* LLFolderViewItem::getRoot() @@ -220,21 +220,21 @@ const LLFolderView* LLFolderViewItem::getRoot() const return mRoot; } // Returns true if this object is a child (or grandchild, etc.) of potential_ancestor. -BOOL LLFolderViewItem::isDescendantOf( const LLFolderViewFolder* potential_ancestor ) +bool LLFolderViewItem::isDescendantOf( const LLFolderViewFolder* potential_ancestor ) { LLFolderViewItem* root = this; while( root->mParentFolder ) { if( root->mParentFolder == potential_ancestor ) { - return TRUE; + return true; } root = root->mParentFolder; } - return FALSE; + return false; } -LLFolderViewItem* LLFolderViewItem::getNextOpenNode(BOOL include_children) +LLFolderViewItem* LLFolderViewItem::getNextOpenNode(bool include_children) { if (!mParentFolder) { @@ -256,7 +256,7 @@ LLFolderViewItem* LLFolderViewItem::getNextOpenNode(BOOL include_children) return itemp; } -LLFolderViewItem* LLFolderViewItem::getPreviousOpenNode(BOOL include_children) +LLFolderViewItem* LLFolderViewItem::getPreviousOpenNode(bool include_children) { if (!mParentFolder) { @@ -280,19 +280,19 @@ LLFolderViewItem* LLFolderViewItem::getPreviousOpenNode(BOOL include_children) return itemp; } -BOOL LLFolderViewItem::passedFilter(S32 filter_generation) +bool LLFolderViewItem::passedFilter(S32 filter_generation) { return getViewModelItem()->passedFilter(filter_generation); } -BOOL LLFolderViewItem::isPotentiallyVisible(S32 filter_generation) +bool LLFolderViewItem::isPotentiallyVisible(S32 filter_generation) { if (filter_generation < 0) { filter_generation = getFolderViewModel()->getFilter().getFirstSuccessGeneration(); } LLFolderViewModelItem* model = getViewModelItem(); - BOOL visible = model->passedFilter(filter_generation); + bool visible = model->passedFilter(filter_generation); if (model->getMarkedDirtyGeneration() >= filter_generation) { // unsure visibility state @@ -352,8 +352,8 @@ void LLFolderViewItem::refreshSuffix() } // Utility function for LLFolderView -void LLFolderViewItem::arrangeAndSet(BOOL set_selection, - BOOL take_keyboard_focus) +void LLFolderViewItem::arrangeAndSet(bool set_selection, + bool take_keyboard_focus) { LLFolderView* root = getRoot(); if (getParentFolder()) @@ -362,7 +362,7 @@ void LLFolderViewItem::arrangeAndSet(BOOL set_selection, } if(set_selection) { - getRoot()->setSelection(this, TRUE, take_keyboard_focus); + getRoot()->setSelection(this, true, take_keyboard_focus); if(root) { root->scrollToShowSelection(); @@ -377,7 +377,7 @@ std::set<LLFolderViewItem*> LLFolderViewItem::getSelectionList() const return selection; } -// addToFolder() returns TRUE if it succeeds. FALSE otherwise +// addToFolder() returns true if it succeeds. false otherwise void LLFolderViewItem::addToFolder(LLFolderViewFolder* folder) { folder->addItem(this); @@ -447,7 +447,7 @@ S32 LLFolderViewItem::getTextPad() // means 'deselect' for a leaf item. Do this optimization after // multiple selection is implemented to make sure it all plays nice // together. -BOOL LLFolderViewItem::setSelection(LLFolderViewItem* selection, BOOL openitem, BOOL take_keyboard_focus) +bool LLFolderViewItem::setSelection(LLFolderViewItem* selection, bool openitem, bool take_keyboard_focus) { if (selection == this && !mIsSelected) { @@ -460,7 +460,7 @@ BOOL LLFolderViewItem::setSelection(LLFolderViewItem* selection, BOOL openitem, return mIsSelected; } -BOOL LLFolderViewItem::changeSelection(LLFolderViewItem* selection, BOOL selected) +bool LLFolderViewItem::changeSelection(LLFolderViewItem* selection, bool selected) { if (selection == this) { @@ -472,31 +472,31 @@ BOOL LLFolderViewItem::changeSelection(LLFolderViewItem* selection, BOOL selecte { selectItem(); } - return TRUE; + return true; } - return FALSE; + return false; } void LLFolderViewItem::deselectItem(void) { - mIsSelected = FALSE; + mIsSelected = false; } void LLFolderViewItem::selectItem(void) { - if (mIsSelected == FALSE) + if (!mIsSelected) { - mIsSelected = TRUE; + mIsSelected = true; getViewModelItem()->selectItem(); } } -BOOL LLFolderViewItem::isMovable() +bool LLFolderViewItem::isMovable() { return getViewModelItem()->isItemMovable(); } -BOOL LLFolderViewItem::isRemovable() +bool LLFolderViewItem::isRemovable() { return getViewModelItem()->isItemRemovable(); } @@ -515,12 +515,12 @@ void LLFolderViewItem::destroyView() // Call through to the viewed object and return true if it can be // removed. -//BOOL LLFolderViewItem::removeRecursively(BOOL single_item) -BOOL LLFolderViewItem::remove() +//bool LLFolderViewItem::removeRecursively(bool single_item) +bool LLFolderViewItem::remove() { if(!isRemovable()) { - return FALSE; + return false; } return getViewModelItem()->removeItem(); } @@ -554,21 +554,21 @@ const std::string& LLFolderViewItem::getName( void ) const } // LLView functionality -BOOL LLFolderViewItem::handleRightMouseDown( S32 x, S32 y, MASK mask ) +bool LLFolderViewItem::handleRightMouseDown( S32 x, S32 y, MASK mask ) { if(!mIsSelected) { - getRoot()->setSelection(this, FALSE); + getRoot()->setSelection(this, false); } make_ui_sound("UISndClick"); - return TRUE; + return true; } -BOOL LLFolderViewItem::handleMouseDown( S32 x, S32 y, MASK mask ) +bool LLFolderViewItem::handleMouseDown( S32 x, S32 y, MASK mask ) { if (LLView::childrenHandleMouseDown(x, y, mask)) { - return TRUE; + return true; } // No handler needed for focus lost since this class has no @@ -587,7 +587,7 @@ BOOL LLFolderViewItem::handleMouseDown( S32 x, S32 y, MASK mask ) } else { - getRoot()->setSelection(this, FALSE); + getRoot()->setSelection(this, false); } make_ui_sound("UISndClick"); } @@ -595,15 +595,15 @@ BOOL LLFolderViewItem::handleMouseDown( S32 x, S32 y, MASK mask ) { // If selected, we reserve the decision of deselecting/reselecting to the mouse up moment. // This is necessary so we maintain selection consistent when starting a drag. - mSelectPending = TRUE; + mSelectPending = true; } mDragStartX = x; mDragStartY = y; - return TRUE; + return true; } -BOOL LLFolderViewItem::handleHover( S32 x, S32 y, MASK mask ) +bool LLFolderViewItem::handleHover( S32 x, S32 y, MASK mask ) { mIsMouseOverTitle = (y > (getRect().getHeight() - mItemHeight)); @@ -618,7 +618,7 @@ BOOL LLFolderViewItem::handleHover( S32 x, S32 y, MASK mask ) { // RN: when starting drag and drop, clear out last auto-open root->autoOpenTest(NULL); - root->setShowSelectionContext(TRUE); + root->setShowSelectionContext(true); // Release keyboard focus, so that if stuff is dropped into the // world, pressing the delete key won't blow away the inventory @@ -633,31 +633,31 @@ BOOL LLFolderViewItem::handleHover( S32 x, S32 y, MASK mask ) } root->clearHoveredItem(); - return TRUE; + return true; } else { LLFolderView* pRoot = getRoot(); pRoot->setHoveredItem(this); - pRoot->setShowSelectionContext(FALSE); + pRoot->setShowSelectionContext(false); getWindow()->setCursor(UI_CURSOR_ARROW); // let parent handle this then... - return FALSE; + return false; } } -BOOL LLFolderViewItem::handleDoubleClick( S32 x, S32 y, MASK mask ) +bool LLFolderViewItem::handleDoubleClick( S32 x, S32 y, MASK mask ) { openItem(); - return TRUE; + return true; } -BOOL LLFolderViewItem::handleMouseUp( S32 x, S32 y, MASK mask ) +bool LLFolderViewItem::handleMouseUp( S32 x, S32 y, MASK mask ) { if (LLView::childrenHandleMouseUp(x, y, mask)) { - return TRUE; + return true; } // if mouse hasn't moved since mouse down... @@ -674,21 +674,21 @@ BOOL LLFolderViewItem::handleMouseUp( S32 x, S32 y, MASK mask ) } else { - getRoot()->setSelection(this, FALSE); + getRoot()->setSelection(this, false); } } - mSelectPending = FALSE; + mSelectPending = false; if( hasMouseCapture() ) { if (getRoot()) { - getRoot()->setShowSelectionContext(FALSE); + getRoot()->setShowSelectionContext(false); } gFocusMgr.setMouseCapture( NULL ); } - return TRUE; + return true; } void LLFolderViewItem::onMouseLeave(S32 x, S32 y, MASK mask) @@ -703,18 +703,18 @@ void LLFolderViewItem::onMouseLeave(S32 x, S32 y, MASK mask) } } -BOOL LLFolderViewItem::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +bool LLFolderViewItem::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) { - BOOL handled = FALSE; - BOOL accepted = getViewModelItem()->dragOrDrop(mask,drop,cargo_type,cargo_data, tooltip_msg); + bool handled = false; + bool accepted = getViewModelItem()->dragOrDrop(mask,drop,cargo_type,cargo_data, tooltip_msg); handled = accepted; if (accepted) { - mDragAndDropTarget = TRUE; + mDragAndDropTarget = true; *accept = ACCEPT_YES_MULTI; } else @@ -775,7 +775,7 @@ void LLFolderViewItem::drawOpenFolderArrow(const Params& default_params, const L return mIsItemCut; } -void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeyboardFocus, const LLUIColor &selectColor, const LLUIColor &flashColor, +void LLFolderViewItem::drawHighlight(const bool showContent, const bool hasKeyboardFocus, const LLUIColor &selectColor, const LLUIColor &flashColor, const LLUIColor &focusOutlineColor, const LLUIColor &mouseOverColor) { const S32 focus_top = getRect().getHeight(); @@ -789,7 +789,7 @@ void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeybo //--------------------------------------------------------------------------------// // Draw highlight for selected items // Note: Always render "current" item or flashing item, only render other selected - // items if mShowSingleSelection is FALSE. + // items if mShowSingleSelection is false. // if (isHighlightAllowed()) @@ -833,7 +833,7 @@ void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeybo focus_top, getRect().getWidth() - 2, focus_bottom, - focusOutlineColor, FALSE); + focusOutlineColor, false); } if (folder_open) @@ -842,14 +842,14 @@ void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeybo focus_bottom + 1, // overlap with bottom edge of above rect getRect().getWidth() - 2, 0, - focusOutlineColor, FALSE); + focusOutlineColor, false); if (showContent && !isFlashing()) { gl_rect_2d(FOCUS_LEFT, focus_bottom + 1, getRect().getWidth() - 2, 0, - bgColor, TRUE); + bgColor, true); } } } @@ -859,7 +859,7 @@ void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeybo focus_top, getRect().getWidth() - 2, focus_bottom, - mouseOverColor, FALSE); + mouseOverColor, false); } //--------------------------------------------------------------------------------// @@ -872,16 +872,16 @@ void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeybo focus_top, getRect().getWidth() - 2, focus_bottom, - bgColor, FALSE); + bgColor, false); if (folder_open) { gl_rect_2d(FOCUS_LEFT, focus_bottom + 1, // overlap with bottom edge of above rect getRect().getWidth() - 2, 0, - bgColor, FALSE); + bgColor, false); } - mDragAndDropTarget = FALSE; + mDragAndDropTarget = false; } } @@ -892,13 +892,13 @@ void LLFolderViewItem::drawLabel(const LLFontGL * font, const F32 x, const F32 y // font->renderUTF8(mLabel, 0, x, y, color, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, - S32_MAX, getRect().getWidth() - (S32) x - mLabelPaddingRight, &right_x, /*use_ellipses*/TRUE); + S32_MAX, getRect().getWidth() - (S32) x - mLabelPaddingRight, &right_x, /*use_ellipses*/true); } void LLFolderViewItem::draw() { - const BOOL show_context = (getRoot() ? getRoot()->getShowSelectionContext() : FALSE); - const BOOL filled = show_context || (getRoot() ? getRoot()->getParentPanel()->hasFocus() : FALSE); // If we have keyboard focus, draw selection filled + const bool show_context = (getRoot() ? getRoot()->getShowSelectionContext() : false); + const bool filled = show_context || (getRoot() ? getRoot()->getParentPanel()->hasFocus() : false); // If we have keyboard focus, draw selection filled const Params& default_params = LLUICtrlFactory::getDefaultParams<LLFolderViewItem>(); const S32 TOP_PAD = default_params.item_top_pad; @@ -940,22 +940,22 @@ void LLFolderViewItem::draw() return; } - std::string::size_type filter_string_length = mViewModelItem->hasFilterStringMatch() ? mViewModelItem->getFilterStringSize() : 0; + auto filter_string_length = mViewModelItem->hasFilterStringMatch() ? static_cast<S32>(mViewModelItem->getFilterStringSize()) : 0; F32 right_x = 0; F32 y = (F32)getRect().getHeight() - font->getLineHeight() - (F32)mTextPad - (F32)TOP_PAD; F32 text_left = (F32)getLabelXPos(); std::string combined_string = mLabel + mLabelSuffix; const LLFontGL* suffix_font = getLabelFontForStyle(LLFontGL::NORMAL); - S32 filter_offset = mViewModelItem->getFilterStringOffset(); + S32 filter_offset = static_cast<S32>(mViewModelItem->getFilterStringOffset()); if (filter_string_length > 0) { S32 bottom = llfloor(getRect().getHeight() - font->getLineHeight() - 3 - TOP_PAD); S32 top = getRect().getHeight() - TOP_PAD; if(mLabelSuffix.empty() || (font == suffix_font)) { - S32 left = ll_round(text_left) + font->getWidth(combined_string, 0, mViewModelItem->getFilterStringOffset()) - 2; - S32 right = left + font->getWidth(combined_string, mViewModelItem->getFilterStringOffset(), filter_string_length) + 2; + S32 left = ll_round(text_left) + font->getWidth(combined_string, 0, static_cast<S32>(mViewModelItem->getFilterStringOffset())) - 2; + S32 right = left + font->getWidth(combined_string, static_cast<S32>(mViewModelItem->getFilterStringOffset()), filter_string_length) + 2; LLUIImage* box_image = default_params.selection_image; LLRect box_rect(left, top, right, bottom); @@ -976,7 +976,7 @@ void LLFolderViewItem::draw() if(suffix_filter_length > 0) { S32 suffix_offset = llmax(0, filter_offset - (S32)mLabel.size()); - S32 left = ll_round(text_left) + font->getWidthF32(mLabel, 0, mLabel.size()) + suffix_font->getWidthF32(mLabelSuffix, 0, suffix_offset) - 2; + S32 left = ll_round(text_left) + font->getWidthF32(mLabel, 0, static_cast<S32>(mLabel.size())) + suffix_font->getWidthF32(mLabelSuffix, 0, suffix_offset) - 2; S32 right = left + suffix_font->getWidthF32(mLabelSuffix, suffix_offset, suffix_filter_length) + 2; LLUIImage* box_image = default_params.selection_image; LLRect box_rect(left, top, right, bottom); @@ -1033,7 +1033,7 @@ void LLFolderViewItem::draw() if(suffix_filter_length > 0) { S32 suffix_offset = llmax(0, filter_offset - (S32)mLabel.size()); - F32 match_string_left = text_left + font->getWidthF32(mLabel, 0, mLabel.size()) + suffix_font->getWidthF32(mLabelSuffix, 0, suffix_offset + suffix_filter_length) - suffix_font->getWidthF32(mLabelSuffix, suffix_offset, suffix_filter_length); + F32 match_string_left = text_left + font->getWidthF32(mLabel, 0, static_cast<S32>(mLabel.size())) + suffix_font->getWidthF32(mLabelSuffix, 0, suffix_offset + suffix_filter_length) - suffix_font->getWidthF32(mLabelSuffix, suffix_offset, suffix_filter_length); F32 yy = (F32)getRect().getHeight() - suffix_font->getLineHeight() - (F32)mTextPad - (F32)TOP_PAD; suffix_font->renderUTF8(mLabelSuffix, suffix_offset, match_string_left, yy, sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, @@ -1071,8 +1071,8 @@ bool LLFolderViewItem::isInSelection() const LLFolderViewFolder::LLFolderViewFolder( const LLFolderViewItem::Params& p ): LLFolderViewItem( p ), - mIsOpen(FALSE), - mExpanderHighlighted(FALSE), + mIsOpen(false), + mExpanderHighlighted(false), mCurHeight(0.f), mTargetHeight(0.f), mAutoOpenCountdown(0.f), @@ -1107,7 +1107,7 @@ LLFolderViewFolder::~LLFolderViewFolder( void ) gFocusMgr.releaseFocusIfNeeded( this ); // calls onCommit() } -// addToFolder() returns TRUE if it succeeds. FALSE otherwise +// addToFolder() returns true if it succeeds. false otherwise void LLFolderViewFolder::addToFolder(LLFolderViewFolder* folder) { folder->addFolder(this); @@ -1267,7 +1267,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height ) > ll_round(mCurHeight) + mMaxFolderItemOverlap) { // hide if beyond current folder height - (*fit)->setVisible(FALSE); + (*fit)->setVisible(false); } } @@ -1279,7 +1279,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height ) if (getRect().getHeight() - (*iit)->getRect().mBottom > ll_round(mCurHeight) + mMaxFolderItemOverlap) { - (*iit)->setVisible(FALSE); + (*iit)->setVisible(false); } } } @@ -1297,7 +1297,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height ) return ll_round(mTargetHeight); } -BOOL LLFolderViewFolder::needsArrange() +bool LLFolderViewFolder::needsArrange() { return mLastArrangeGeneration < getRoot()->getArrangeGeneration(); } @@ -1309,17 +1309,17 @@ bool LLFolderViewFolder::descendantsPassedFilter(S32 filter_generation) // Passes selection information on to children and record selection // information if necessary. -BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem, - BOOL take_keyboard_focus) +bool LLFolderViewFolder::setSelection(LLFolderViewItem* selection, bool openitem, + bool take_keyboard_focus) { - BOOL rv = FALSE; + bool rv = false; if (selection == this) { if (!isSelected()) { selectItem(); } - rv = TRUE; + rv = true; } else { @@ -1327,9 +1327,9 @@ BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem { deselectItem(); } - rv = FALSE; + rv = false; } - BOOL child_selected = FALSE; + bool child_selected = false; for (folders_t::iterator iter = mFolders.begin(); iter != mFolders.end();) @@ -1337,8 +1337,8 @@ BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem folders_t::iterator fit = iter++; if((*fit)->setSelection(selection, openitem, take_keyboard_focus)) { - rv = TRUE; - child_selected = TRUE; + rv = true; + child_selected = true; } } for (items_t::iterator iter = mItems.begin(); @@ -1347,13 +1347,13 @@ BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem items_t::iterator iit = iter++; if((*iit)->setSelection(selection, openitem, take_keyboard_focus)) { - rv = TRUE; - child_selected = TRUE; + rv = true; + child_selected = true; } } if(openitem && child_selected && !mSingleFolderMode) { - setOpenArrangeRecursively(TRUE); + setOpenArrangeRecursively(true); } return rv; } @@ -1361,15 +1361,15 @@ BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem // This method is used to change the selection of an item. // Recursively traverse all children; if 'selection' is 'this' then change // the select status if necessary. -// Returns TRUE if the selection state of this folder, or of a child, was changed. -BOOL LLFolderViewFolder::changeSelection(LLFolderViewItem* selection, BOOL selected) +// Returns true if the selection state of this folder, or of a child, was changed. +bool LLFolderViewFolder::changeSelection(LLFolderViewItem* selection, bool selected) { - BOOL rv = FALSE; + bool rv = false; if(selection == this) { if (isSelected() != selected) { - rv = TRUE; + rv = true; if (selected) { selectItem(); @@ -1387,7 +1387,7 @@ BOOL LLFolderViewFolder::changeSelection(LLFolderViewItem* selection, BOOL selec folders_t::iterator fit = iter++; if((*fit)->changeSelection(selection, selected)) { - rv = TRUE; + rv = true; } } for (items_t::iterator iter = mItems.begin(); @@ -1396,7 +1396,7 @@ BOOL LLFolderViewFolder::changeSelection(LLFolderViewItem* selection, BOOL selec items_t::iterator iit = iter++; if((*iit)->changeSelection(selection, selected)) { - rv = TRUE; + rv = true; } } return rv; @@ -1580,7 +1580,8 @@ void LLFolderViewFolder::gatherChildRangeExclusive(LLFolderViewItem* start, LLFo void LLFolderViewFolder::extendSelectionTo(LLFolderViewItem* new_selection) { - if (getRoot()->getAllowMultiSelect() == FALSE) return; + if (!getRoot()->getAllowMultiSelect()) + return; LLFolderViewItem* cur_selected_item = getRoot()->getCurSelectedItem(); if (cur_selected_item == NULL) @@ -1591,14 +1592,15 @@ void LLFolderViewFolder::extendSelectionTo(LLFolderViewItem* new_selection) bool reverse = false; LLFolderViewFolder* common_ancestor = getCommonAncestor(cur_selected_item, new_selection, reverse); - if (!common_ancestor) return; + if (!common_ancestor) + return; LLFolderViewItem* last_selected_item_from_cur = cur_selected_item; LLFolderViewFolder* cur_folder = cur_selected_item->getParentFolder(); std::vector<LLFolderViewItem*> items_to_select_forward; - while(cur_folder != common_ancestor) + while (cur_folder != common_ancestor) { cur_folder->gatherChildRangeExclusive(last_selected_item_from_cur, NULL, reverse, items_to_select_forward); @@ -1610,7 +1612,7 @@ void LLFolderViewFolder::extendSelectionTo(LLFolderViewItem* new_selection) LLFolderViewItem* last_selected_item_from_new = new_selection; cur_folder = new_selection->getParentFolder(); - while(cur_folder != common_ancestor) + while (cur_folder != common_ancestor) { cur_folder->gatherChildRangeExclusive(last_selected_item_from_new, NULL, !reverse, items_to_select_reverse); @@ -1629,7 +1631,7 @@ void LLFolderViewFolder::extendSelectionTo(LLFolderViewItem* new_selection) LLFolderView* root = getRoot(); - BOOL selection_reverse = new_selection->isSelected(); //indication that some elements are being deselected + bool selection_reverse = new_selection->isSelected(); //indication that some elements are being deselected // array always go from 'will be selected' to ' will be unselected', iterate // in opposite direction to simplify identification of 'point of origin' in @@ -1639,12 +1641,12 @@ void LLFolderViewFolder::extendSelectionTo(LLFolderViewItem* new_selection) ++it) { LLFolderViewItem* item = *it; - BOOL selected = item->isSelected(); + bool selected = item->isSelected(); if (!selection_reverse && selected) { // it is our 'point of origin' where we shift/expand from // don't deselect it - selection_reverse = TRUE; + selection_reverse = true; } else { @@ -1655,11 +1657,11 @@ void LLFolderViewFolder::extendSelectionTo(LLFolderViewItem* new_selection) if (selection_reverse) { // at some point we reversed selection, first element should be deselected - root->changeSelection(last_selected_item_from_cur, FALSE); + root->changeSelection(last_selected_item_from_cur, false); } // element we expand to should always be selected - root->changeSelection(new_selection, TRUE); + root->changeSelection(new_selection, true); } @@ -1717,11 +1719,11 @@ void LLFolderViewFolder::extractItem( LLFolderViewItem* item, bool deparent_mode removeChild(item); } -BOOL LLFolderViewFolder::isMovable() +bool LLFolderViewFolder::isMovable() { if( !(getViewModelItem()->isItemMovable()) ) { - return FALSE; + return false; } for (items_t::iterator iter = mItems.begin(); @@ -1730,7 +1732,7 @@ BOOL LLFolderViewFolder::isMovable() items_t::iterator iit = iter++; if(!(*iit)->isMovable()) { - return FALSE; + return false; } } @@ -1740,18 +1742,18 @@ BOOL LLFolderViewFolder::isMovable() folders_t::iterator fit = iter++; if(!(*fit)->isMovable()) { - return FALSE; + return false; } } - return TRUE; + return true; } -BOOL LLFolderViewFolder::isRemovable() +bool LLFolderViewFolder::isRemovable() { if( !(getViewModelItem()->isItemRemovable()) ) { - return FALSE; + return false; } for (items_t::iterator iter = mItems.begin(); @@ -1760,7 +1762,7 @@ BOOL LLFolderViewFolder::isRemovable() items_t::iterator iit = iter++; if(!(*iit)->isRemovable()) { - return FALSE; + return false; } } @@ -1770,10 +1772,10 @@ BOOL LLFolderViewFolder::isRemovable() folders_t::iterator fit = iter++; if(!(*fit)->isRemovable()) { - return FALSE; + return false; } } - return TRUE; + return true; } void LLFolderViewFolder::destroyRoot() @@ -1793,7 +1795,7 @@ void LLFolderViewFolder::addItem(LLFolderViewItem* item) mItems.push_back(item); item->setRect(LLRect(0, 0, getRect().getWidth(), 0)); - item->setVisible(FALSE); + item->setVisible(false); addChild(item); @@ -1816,7 +1818,7 @@ void LLFolderViewFolder::addFolder(LLFolderViewFolder* folder) mFolders.push_back(folder); folder->setOrigin(0, 0); folder->reshape(getRect().getWidth(), 0); - folder->setVisible(FALSE); + folder->setVisible(false); // rearrange all descendants too, as our indentation level might have changed //folder->requestArrange(); //requestSort(); @@ -1847,7 +1849,7 @@ void LLFolderViewFolder::toggleOpen() } // Force a folder open or closed -void LLFolderViewFolder::setOpen(BOOL openitem) +void LLFolderViewFolder::setOpen(bool openitem) { if(mSingleFolderMode) { @@ -1864,9 +1866,9 @@ void LLFolderViewFolder::setOpen(BOOL openitem) } } -void LLFolderViewFolder::setOpenArrangeRecursively(BOOL openitem, ERecurseType recurse) +void LLFolderViewFolder::setOpenArrangeRecursively(bool openitem, ERecurseType recurse) { - BOOL was_open = isOpen(); + bool was_open = isOpen(); mIsOpen = openitem; if(!was_open && openitem) { @@ -1901,17 +1903,17 @@ void LLFolderViewFolder::setOpenArrangeRecursively(BOOL openitem, ERecurseType r } } -BOOL LLFolderViewFolder::handleDragAndDropFromChild(MASK mask, - BOOL drop, +bool LLFolderViewFolder::handleDragAndDropFromChild(MASK mask, + bool drop, EDragAndDropType c_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) { - BOOL accepted = mViewModelItem->dragOrDrop(mask,drop,c_type,cargo_data, tooltip_msg); + bool accepted = mViewModelItem->dragOrDrop(mask,drop,c_type,cargo_data, tooltip_msg); if (accepted) { - mDragAndDropTarget = TRUE; + mDragAndDropTarget = true; *accept = ACCEPT_YES_MULTI; } else @@ -1922,7 +1924,7 @@ BOOL LLFolderViewFolder::handleDragAndDropFromChild(MASK mask, // drag and drop to child item, so clear pending auto-opens getRoot()->autoOpenTest(NULL); - return TRUE; + return true; } void LLFolderViewFolder::openItem( void ) @@ -1965,14 +1967,14 @@ void LLFolderViewFolder::applyFunctorRecursively(LLFolderViewFunctor& functor) } // LLView functionality -BOOL LLFolderViewFolder::handleDragAndDrop(S32 x, S32 y, MASK mask, - BOOL drop, +bool LLFolderViewFolder::handleDragAndDrop(S32 x, S32 y, MASK mask, + bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) { - BOOL handled = FALSE; + bool handled = false; if (isOpen()) { @@ -1986,11 +1988,11 @@ BOOL LLFolderViewFolder::handleDragAndDrop(S32 x, S32 y, MASK mask, LL_DEBUGS("UserInput") << "dragAndDrop handled by LLFolderViewFolder" << LL_ENDL; } - return TRUE; + return true; } -BOOL LLFolderViewFolder::handleDragAndDropToThisFolder(MASK mask, - BOOL drop, +bool LLFolderViewFolder::handleDragAndDropToThisFolder(MASK mask, + bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -2000,14 +2002,14 @@ BOOL LLFolderViewFolder::handleDragAndDropToThisFolder(MASK mask, { *accept = ACCEPT_NO; tooltip_msg = LLTrans::getString("TooltipOutboxCannotDropOnRoot"); - return TRUE; + return true; } - BOOL accepted = getViewModelItem()->dragOrDrop(mask,drop,cargo_type,cargo_data, tooltip_msg); + bool accepted = getViewModelItem()->dragOrDrop(mask,drop,cargo_type,cargo_data, tooltip_msg); if (accepted) { - mDragAndDropTarget = TRUE; + mDragAndDropTarget = true; *accept = ACCEPT_YES_MULTI; } else @@ -2020,13 +2022,13 @@ BOOL LLFolderViewFolder::handleDragAndDropToThisFolder(MASK mask, getRoot()->autoOpenTest(this); } - return TRUE; + return true; } -BOOL LLFolderViewFolder::handleRightMouseDown( S32 x, S32 y, MASK mask ) +bool LLFolderViewFolder::handleRightMouseDown( S32 x, S32 y, MASK mask ) { - BOOL handled = FALSE; + bool handled = false; if( isOpen() ) { @@ -2040,11 +2042,11 @@ BOOL LLFolderViewFolder::handleRightMouseDown( S32 x, S32 y, MASK mask ) } -BOOL LLFolderViewFolder::handleHover(S32 x, S32 y, MASK mask) +bool LLFolderViewFolder::handleHover(S32 x, S32 y, MASK mask) { mIsMouseOverTitle = (y > (getRect().getHeight() - mItemHeight)); - BOOL handled = LLView::handleHover(x, y, mask); + bool handled = LLView::handleHover(x, y, mask); if (!handled) { @@ -2055,9 +2057,9 @@ BOOL LLFolderViewFolder::handleHover(S32 x, S32 y, MASK mask) return handled; } -BOOL LLFolderViewFolder::handleMouseDown( S32 x, S32 y, MASK mask ) +bool LLFolderViewFolder::handleMouseDown( S32 x, S32 y, MASK mask ) { - BOOL handled = FALSE; + bool handled = false; if( isOpen() ) { handled = childrenHandleMouseDown(x,y,mask) != NULL; @@ -2068,7 +2070,7 @@ BOOL LLFolderViewFolder::handleMouseDown( S32 x, S32 y, MASK mask ) && !mSingleFolderMode) { toggleOpen(); - handled = TRUE; + handled = true; } else { @@ -2080,9 +2082,9 @@ BOOL LLFolderViewFolder::handleMouseDown( S32 x, S32 y, MASK mask ) return handled; } -BOOL LLFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask ) +bool LLFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask ) { - BOOL handled = FALSE; + bool handled = false; if(mSingleFolderMode) { static LLUICachedControl<bool> double_click_new_window("SingleModeDoubleClickOpenWindow", false); @@ -2099,7 +2101,7 @@ BOOL LLFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask ) getViewModelItem()->navigateToFolder(false); }); } - return TRUE; + return true; } if( isOpen() ) @@ -2114,12 +2116,12 @@ BOOL LLFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask ) if (double_click_action == 1) { getViewModelItem()->navigateToFolder(true); - return TRUE; + return true; } if (double_click_action == 2) { getViewModelItem()->navigateToFolder(false, true); - return TRUE; + return true; } } if(mIndentation < x && x < mIndentation + (isCollapsed() ? 0 : mArrowSize) + mTextPad) @@ -2130,10 +2132,10 @@ BOOL LLFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask ) } else { - getRoot()->setSelection(this, FALSE); + getRoot()->setSelection(this, false); toggleOpen(); } - handled = TRUE; + handled = true; } return handled; } @@ -2150,19 +2152,19 @@ void LLFolderViewFolder::draw() LLView::draw(); } - mExpanderHighlighted = FALSE; + mExpanderHighlighted = false; } // this does prefix traversal, as folders are listed above their contents -LLFolderViewItem* LLFolderViewFolder::getNextFromChild( LLFolderViewItem* item, BOOL include_children ) +LLFolderViewItem* LLFolderViewFolder::getNextFromChild( LLFolderViewItem* item, bool include_children ) { - BOOL found_item = FALSE; + bool found_item = false; LLFolderViewItem* result = NULL; // when not starting from a given item, start at beginning if(item == NULL) { - found_item = TRUE; + found_item = true; } // find current item among children @@ -2180,16 +2182,16 @@ LLFolderViewItem* LLFolderViewFolder::getNextFromChild( LLFolderViewItem* item, { if(item == (*fit)) { - found_item = TRUE; + found_item = true; // if we are on downwards traversal if (include_children && (*fit)->isOpen()) { // look for first descendant - return (*fit)->getNextFromChild(NULL, TRUE); + return (*fit)->getNextFromChild(NULL, true); } // otherwise advance to next folder ++fit; - include_children = TRUE; + include_children = true; break; } } @@ -2201,7 +2203,7 @@ LLFolderViewItem* LLFolderViewFolder::getNextFromChild( LLFolderViewItem* item, { if(item == (*iit)) { - found_item = TRUE; + found_item = true; // point to next item ++iit; break; @@ -2214,7 +2216,7 @@ LLFolderViewItem* LLFolderViewFolder::getNextFromChild( LLFolderViewItem* item, { // you should never call this method with an item that isn't a child // so we should always find something - llassert(FALSE); + llassert(false); return NULL; } @@ -2252,22 +2254,22 @@ LLFolderViewItem* LLFolderViewFolder::getNextFromChild( LLFolderViewItem* item, { // If there are no siblings or children to go to, recurse up one level in the tree // and skip children for this folder, as we've already discounted them - result = mParentFolder->getNextFromChild(this, FALSE); + result = mParentFolder->getNextFromChild(this, false); } return result; } // this does postfix traversal, as folders are listed above their contents -LLFolderViewItem* LLFolderViewFolder::getPreviousFromChild( LLFolderViewItem* item, BOOL include_children ) +LLFolderViewItem* LLFolderViewFolder::getPreviousFromChild( LLFolderViewItem* item, bool include_children ) { - BOOL found_item = FALSE; + bool found_item = false; LLFolderViewItem* result = NULL; // when not starting from a given item, start at end if(item == NULL) { - found_item = TRUE; + found_item = true; } // find current item among children @@ -2285,7 +2287,7 @@ LLFolderViewItem* LLFolderViewFolder::getPreviousFromChild( LLFolderViewItem* it { if(item == (*iit)) { - found_item = TRUE; + found_item = true; // point to next item ++iit; break; @@ -2299,7 +2301,7 @@ LLFolderViewItem* LLFolderViewFolder::getPreviousFromChild( LLFolderViewItem* it { if(item == (*fit)) { - found_item = TRUE; + found_item = true; // point to next folder ++fit; break; @@ -2312,7 +2314,7 @@ LLFolderViewItem* LLFolderViewFolder::getPreviousFromChild( LLFolderViewItem* it { // you should never call this method with an item that isn't a child // so we should always find something - llassert(FALSE); + llassert(false); return NULL; } diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h index 351613e387..f7ced81274 100644 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -158,21 +158,21 @@ protected: static LLFontGL* getLabelFontForStyle(U8 style); - BOOL mIsSelected; + bool mIsSelected; public: static void initClass(); static void cleanupClass(); - BOOL postBuild(); + bool postBuild(); virtual void openItem( void ); - void arrangeAndSet(BOOL set_selection, BOOL take_keyboard_focus); + void arrangeAndSet(bool set_selection, bool take_keyboard_focus); virtual ~LLFolderViewItem( void ); - // addToFolder() returns TRUE if it succeeds. FALSE otherwise + // addToFolder() returns true if it succeeds. false otherwise virtual void addToFolder(LLFolderViewFolder* folder); // Finds width and height of this object and it's children. Also @@ -184,13 +184,13 @@ public: S32 getTextPad(); // If 'selection' is 'this' then note that otherwise ignore. - // Returns TRUE if this item ends up being selected. - virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem, BOOL take_keyboard_focus); + // Returns true if this item ends up being selected. + virtual bool setSelection(LLFolderViewItem* selection, bool openitem, bool take_keyboard_focus); // This method is used to set the selection state of an item. // If 'selection' is 'this' then note selection. - // Returns TRUE if the selection state of this item was changed. - virtual BOOL changeSelection(LLFolderViewItem* selection, BOOL selected); + // Returns true if the selection state of this item was changed. + virtual bool changeSelection(LLFolderViewItem* selection, bool selected); // this method is used to deselect this element void deselectItem(); @@ -202,24 +202,24 @@ public: virtual std::set<LLFolderViewItem*> getSelectionList() const; // Returns true is this object and all of its children can be removed (deleted by user) - virtual BOOL isRemovable(); + virtual bool isRemovable(); // Returns true is this object and all of its children can be moved - virtual BOOL isMovable(); + virtual bool isMovable(); // destroys this item recursively virtual void destroyView(); - BOOL isSelected() const { return mIsSelected; } + bool isSelected() const { return mIsSelected; } bool isInSelection() const; - void setUnselected() { mIsSelected = FALSE; } + void setUnselected() { mIsSelected = false; } - void setIsCurSelection(BOOL select) { mIsCurSelection = select; } + void setIsCurSelection(bool select) { mIsCurSelection = select; } - BOOL getIsCurSelection() const { return mIsCurSelection; } + bool getIsCurSelection() const { return mIsCurSelection; } - BOOL hasVisibleChildren() const { return mHasVisibleChildren; } + bool hasVisibleChildren() const { return mHasVisibleChildren; } // true if object can't have children virtual bool isFolderComplete() { return true; } @@ -229,8 +229,8 @@ public: // Call through to the viewed object and return true if it can be // removed. Returns true if it's removed. - //virtual BOOL removeRecursively(BOOL single_item); - BOOL remove(); + //virtual bool removeRecursively(bool single_item); + bool remove(); // Build an appropriate context menu for the item. Flags unused. void buildContextMenu(class LLMenuGL& menu, U32 flags); @@ -249,8 +249,8 @@ public: void setParentFolder(LLFolderViewFolder* parent) { mParentFolder = parent; } - LLFolderViewItem* getNextOpenNode( BOOL include_children = TRUE ); - LLFolderViewItem* getPreviousOpenNode( BOOL include_children = TRUE ); + LLFolderViewItem* getNextOpenNode( bool include_children = true ); + LLFolderViewItem* getPreviousOpenNode( bool include_children = true ); const LLFolderViewModelItem* getViewModelItem( void ) const { return mViewModelItem; } LLFolderViewModelItem* getViewModelItem( void ) { return mViewModelItem; } @@ -262,16 +262,16 @@ public: void rename(const std::string& new_name); // Show children - virtual void setOpen(BOOL open = TRUE) {}; - virtual BOOL isOpen() const { return FALSE; } + virtual void setOpen(bool open = true) {}; + virtual bool isOpen() const { return false; } virtual LLFolderView* getRoot(); virtual const LLFolderView* getRoot() const; - BOOL isDescendantOf( const LLFolderViewFolder* potential_ancestor ); + bool isDescendantOf( const LLFolderViewFolder* potential_ancestor ); S32 getIndentation() const { return mIndentation; } - virtual BOOL passedFilter(S32 filter_generation = -1); - virtual BOOL isPotentiallyVisible(S32 filter_generation = -1); + virtual bool passedFilter(S32 filter_generation = -1); + virtual bool isPotentiallyVisible(S32 filter_generation = -1); // refresh information from the object being viewed. // refreshes label, suffixes and sets icons. Expensive! @@ -284,22 +284,22 @@ public: bool isSingleFolderMode() { return mSingleFolderMode; } // LLView functionality - virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); - virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ); - virtual BOOL handleHover( S32 x, S32 y, MASK mask ); - virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask ); - virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask ); + virtual bool handleRightMouseDown( S32 x, S32 y, MASK mask ); + virtual bool handleMouseDown( S32 x, S32 y, MASK mask ); + virtual bool handleHover( S32 x, S32 y, MASK mask ); + virtual bool handleMouseUp( S32 x, S32 y, MASK mask ); + virtual bool handleDoubleClick( S32 x, S32 y, MASK mask ); virtual void onMouseLeave(S32 x, S32 y, MASK mask); - //virtual LLView* findChildView(const std::string& name, BOOL recurse) const { return LLView::findChildView(name, recurse); } + //virtual LLView* findChildView(const std::string& name, bool recurse) const { return LLView::findChildView(name, recurse); } // virtual void handleDropped(); virtual void draw(); void drawOpenFolderArrow(const Params& default_params, const LLUIColor& fg_color); - void drawHighlight(const BOOL showContent, const BOOL hasKeyboardFocus, const LLUIColor &selectColor, const LLUIColor &flashColor, const LLUIColor &outlineColor, const LLUIColor &mouseOverColor); + void drawHighlight(const bool showContent, const bool hasKeyboardFocus, const LLUIColor &selectColor, const LLUIColor &flashColor, const LLUIColor &outlineColor, const LLUIColor &mouseOverColor); void drawLabel(const LLFontGL * font, const F32 x, const F32 y, const LLColor4& color, F32 &right_x); - virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + virtual bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -324,7 +324,7 @@ protected: friend class LLUICtrlFactory; void updateLabelRotation(); - virtual bool isCollapsed() { return FALSE; } + virtual bool isCollapsed() { return false; } public: typedef std::list<LLFolderViewItem*> items_t; @@ -334,8 +334,8 @@ protected: items_t mItems; folders_t mFolders; - BOOL mIsOpen; - BOOL mExpanderHighlighted; + bool mIsOpen; + bool mExpanderHighlighted; F32 mCurHeight; F32 mTargetHeight; F32 mAutoOpenCountdown; @@ -356,40 +356,40 @@ public: virtual ~LLFolderViewFolder( void ); - LLFolderViewItem* getNextFromChild( LLFolderViewItem*, BOOL include_children = TRUE ); - LLFolderViewItem* getPreviousFromChild( LLFolderViewItem*, BOOL include_children = TRUE ); + LLFolderViewItem* getNextFromChild( LLFolderViewItem*, bool include_children = true ); + LLFolderViewItem* getPreviousFromChild( LLFolderViewItem*, bool include_children = true ); - // addToFolder() returns TRUE if it succeeds. FALSE otherwise + // addToFolder() returns true if it succeeds. false otherwise virtual void addToFolder(LLFolderViewFolder* folder); // Finds width and height of this object and it's children. Also // makes sure that this view and it's children are the right size. virtual S32 arrange( S32* width, S32* height ); - BOOL needsArrange(); + bool needsArrange(); bool descendantsPassedFilter(S32 filter_generation = -1); // Passes selection information on to children and record // selection information if necessary. - // Returns TRUE if this object (or a child) ends up being selected. - // If 'openitem' is TRUE then folders are opened up along the way to the selection. - virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem, BOOL take_keyboard_focus = TRUE); + // Returns true if this object (or a child) ends up being selected. + // If 'openitem' is true then folders are opened up along the way to the selection. + virtual bool setSelection(LLFolderViewItem* selection, bool openitem, bool take_keyboard_focus = true); // This method is used to change the selection of an item. // Recursively traverse all children; if 'selection' is 'this' then change // the select status if necessary. - // Returns TRUE if the selection state of this folder, or of a child, was changed. - virtual BOOL changeSelection(LLFolderViewItem* selection, BOOL selected); + // Returns true if the selection state of this folder, or of a child, was changed. + virtual bool changeSelection(LLFolderViewItem* selection, bool selected); // this method is used to group select items void extendSelectionTo(LLFolderViewItem* selection); // Returns true is this object and all of its children can be removed. - virtual BOOL isRemovable(); + virtual bool isRemovable(); // Returns true is this object and all of its children can be moved - virtual BOOL isMovable(); + virtual bool isMovable(); // destroys this folder, and all children virtual void destroyView(); @@ -416,7 +416,7 @@ public: virtual void toggleOpen(); // Force a folder open or closed - virtual void setOpen(BOOL openitem = TRUE); + virtual void setOpen(bool openitem = true); // Called when a child is refreshed. virtual void requestArrange(); @@ -425,14 +425,14 @@ public: // method was written because the list iterators destroy the state // of other iterations, thus, we can't arrange while iterating // through the children (such as when setting which is selected. - virtual void setOpenArrangeRecursively(BOOL openitem, ERecurseType recurse = RECURSE_NO); + virtual void setOpenArrangeRecursively(bool openitem, ERecurseType recurse = RECURSE_NO); // Get the current state of the folder. - virtual BOOL isOpen() const { return mIsOpen; } + virtual bool isOpen() const { return mIsOpen; } // special case if an object is dropped on the child. - BOOL handleDragAndDropFromChild(MASK mask, - BOOL drop, + bool handleDragAndDropFromChild(MASK mask, + bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -447,18 +447,18 @@ public: virtual void openItem( void ); // LLView functionality - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); - virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ); - virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask ); - virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, - BOOL drop, + virtual bool handleHover(S32 x, S32 y, MASK mask); + virtual bool handleRightMouseDown( S32 x, S32 y, MASK mask ); + virtual bool handleMouseDown( S32 x, S32 y, MASK mask ); + virtual bool handleDoubleClick( S32 x, S32 y, MASK mask ); + virtual bool handleDragAndDrop(S32 x, S32 y, MASK mask, + bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg); - BOOL handleDragAndDropToThisFolder(MASK mask, - BOOL drop, + bool handleDragAndDropToThisFolder(MASK mask, + bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index f02c1e3883..b8d6d89971 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -162,24 +162,24 @@ public: virtual void navigateToFolder(bool new_window = false, bool change_mode = false) = 0; - virtual BOOL isItemWearable() const { return FALSE; } + virtual bool isItemWearable() const { return false; } - virtual BOOL isItemRenameable() const = 0; - virtual BOOL renameItem(const std::string& new_name) = 0; + virtual bool isItemRenameable() const = 0; + virtual bool renameItem(const std::string& new_name) = 0; - virtual BOOL isItemMovable( void ) const = 0; // Can be moved to another folder + virtual bool isItemMovable( void ) const = 0; // Can be moved to another folder virtual void move( LLFolderViewModelItem* parent_listener ) = 0; - virtual BOOL isItemRemovable( bool check_worn = true ) const = 0; // Can be destroyed - virtual BOOL removeItem() = 0; + virtual bool isItemRemovable( bool check_worn = true ) const = 0; // Can be destroyed + virtual bool removeItem() = 0; virtual void removeBatch(std::vector<LLFolderViewModelItem*>& batch) = 0; virtual bool isItemCopyable(bool can_copy_as_link = true) const = 0; - virtual BOOL copyToClipboard() const = 0; - virtual BOOL cutToClipboard() = 0; + virtual bool copyToClipboard() const = 0; + virtual bool cutToClipboard() = 0; virtual bool isCutToClipboard() { return false; }; - virtual BOOL isClipboardPasteable() const = 0; + virtual bool isClipboardPasteable() const = 0; virtual void pasteFromClipboard() = 0; virtual void pasteLinkFromClipboard() = 0; @@ -207,10 +207,10 @@ public: virtual void clearChildren() = 0; // This method will be called to determine if a drop can be - // performed, and will set drop to TRUE if a drop is - // requested. Returns TRUE if a drop is possible/happened, - // otherwise FALSE. - virtual BOOL dragOrDrop(MASK mask, BOOL drop, + // performed, and will set drop to true if a drop is + // requested. Returns true if a drop is possible/happened, + // otherwise false. + virtual bool dragOrDrop(MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, std::string& tooltip_msg) = 0; diff --git a/indra/llui/lliconctrl.cpp b/indra/llui/lliconctrl.cpp index 38c869cd59..83379dd0a9 100644 --- a/indra/llui/lliconctrl.cpp +++ b/indra/llui/lliconctrl.cpp @@ -86,17 +86,17 @@ void LLIconCtrl::draw() LLUICtrl::draw(); } -BOOL LLIconCtrl::handleHover(S32 x, S32 y, MASK mask) +bool LLIconCtrl::handleHover(S32 x, S32 y, MASK mask) { if (mInteractable && getEnabled()) { getWindow()->setCursor(UI_CURSOR_HAND); - return TRUE; + return true; } return LLUICtrl::handleHover(x, y, mask); } -void LLIconCtrl::onVisibilityChange(BOOL new_visibility) +void LLIconCtrl::onVisibilityChange(bool new_visibility) { LLUICtrl::onVisibilityChange(new_visibility); if (mPriority == LLGLTexture::BOOST_ICON) diff --git a/indra/llui/lliconctrl.h b/indra/llui/lliconctrl.h index 240fe3a74c..aae1d1d572 100644 --- a/indra/llui/lliconctrl.h +++ b/indra/llui/lliconctrl.h @@ -71,10 +71,10 @@ public: virtual void draw(); // llview overrides - virtual BOOL handleHover(S32 x, S32 y, MASK mask); + virtual bool handleHover(S32 x, S32 y, MASK mask); // lluictrl overrides - void onVisibilityChange(BOOL new_visibility); + void onVisibilityChange(bool new_visibility); virtual void setValue(const LLSD& value ); std::string getImageName() const; diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 1ac1e41727..5e184b5ddb 100644 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -39,7 +39,7 @@ inline bool LLKeywordToken::isHead(const llwchar* s) const // strncmp is much faster than string compare bool res = true; const llwchar* t = mToken.c_str(); - S32 len = mToken.size(); + auto len = mToken.size(); for (S32 i=0; i<len; i++) { if (s[i] != t[i]) @@ -55,7 +55,7 @@ inline bool LLKeywordToken::isTail(const llwchar* s) const { bool res = true; const llwchar* t = mDelimiter.c_str(); - S32 len = mDelimiter.size(); + auto len = mDelimiter.size(); for (S32 i=0; i<len; i++) { if (s[i] != t[i]) @@ -134,7 +134,7 @@ std::string LLKeywords::getArguments(LLSD& arguments) if (arguments.isArray()) { - U32 argsCount = arguments.size(); + auto argsCount = arguments.size(); LLSD::array_iterator arrayIt = arguments.beginArray(); for ( ; arrayIt != arguments.endArray(); ++arrayIt) { @@ -489,7 +489,7 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW return; } - S32 text_len = wtext.size() + 1; + S32 text_len = static_cast<S32>(wtext.size()) + 1; seg_list->push_back( new LLNormalTextSegment( style, 0, text_len, editor ) ); @@ -525,7 +525,7 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW // Line start tokens { - BOOL line_done = FALSE; + bool line_done = false; for (token_list_t::iterator iter = mLineTokenList.begin(); iter != mLineTokenList.end(); ++iter) { @@ -542,7 +542,7 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW //create segments from seg_start to seg_end insertSegments(wtext, *seg_list,cur_token, text_len, seg_start, seg_end, style, editor); - line_done = TRUE; // to break out of second loop. + line_done = true; // to break out of second loop. break; } } @@ -707,16 +707,16 @@ void LLKeywords::insertSegments(const LLWString& wtext, std::vector<LLTextSegmen { if (pos!=seg_start) { - LLTextSegmentPtr text_segment = new LLNormalTextSegment(cur_token_style, seg_start, pos, editor); + LLTextSegmentPtr text_segment = new LLNormalTextSegment(cur_token_style, seg_start, static_cast<S32>(pos), editor); text_segment->setToken( cur_token ); insertSegment( seg_list, text_segment, text_len, style, editor); } - LLTextSegmentPtr text_segment = new LLLineBreakTextSegment(style, pos); + LLTextSegmentPtr text_segment = new LLLineBreakTextSegment(style, static_cast<S32>(pos)); text_segment->setToken( cur_token ); insertSegment( seg_list, text_segment, text_len, style, editor); - seg_start = pos+1; + seg_start = static_cast<S32>(pos) + 1; pos = wtext.find('\n',seg_start); } @@ -803,9 +803,9 @@ void LLKeywords::dump() void LLKeywordToken::dump() { LL_INFOS() << "[" << - mColor.mV[VX] << ", " << - mColor.mV[VY] << ", " << - mColor.mV[VZ] << "] [" << + mColor.mV[VRED] << ", " << + mColor.mV[VGREEN] << ", " << + mColor.mV[VBLUE] << "] [" << wstring_to_utf8str(mToken) << "]" << LL_ENDL; } diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index 9dcdea121b..f498b3ddee 100644 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -82,8 +82,8 @@ public: { } - S32 getLengthHead() const { return mToken.size(); } - S32 getLengthTail() const { return mDelimiter.size(); } + S32 getLengthHead() const { return static_cast<S32>(mToken.size()); } + S32 getLengthTail() const { return static_cast<S32>(mDelimiter.size()); } bool isHead(const llwchar* s) const; bool isTail(const llwchar* s) const; const LLWString& getToken() const { return mToken; } diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 13d6faa673..6db9f64a97 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -61,7 +61,7 @@ LLLayoutPanel::LLLayoutPanel(const Params& p) mMinDim(p.min_dim), mAutoResize(p.auto_resize), mUserResize(p.user_resize), - mCollapsed(FALSE), + mCollapsed(false), mCollapseAmt(0.f), mVisibleAmt(1.f), // default to fully visible mResizeBar(NULL), @@ -144,16 +144,14 @@ void LLLayoutPanel::setOrientation( LLView::EOrientation orientation ) ? getRect().getWidth() : getRect().getHeight())); - if (mAutoResize == FALSE - && mUserResize == TRUE - && mMinDim == -1 ) + if (!mAutoResize && mUserResize && mMinDim == -1) { setMinDim(layout_dim); } mTargetDim = llmax(layout_dim, getMinDim()); } -void LLLayoutPanel::setVisible( BOOL visible ) +void LLLayoutPanel::setVisible( bool visible ) { if (visible != getVisible()) { @@ -166,11 +164,11 @@ void LLLayoutPanel::setVisible( BOOL visible ) LLPanel::setVisible(visible); } -void LLLayoutPanel::reshape( S32 width, S32 height, BOOL called_from_parent /*= TRUE*/ ) +void LLLayoutPanel::reshape( S32 width, S32 height, bool called_from_parent /*= true*/ ) { if (width == getRect().getWidth() && height == getRect().getHeight() && !LLView::sForceReshape) return; - if (!mIgnoreReshape && mAutoResize == false) + if (!mIgnoreReshape && !mAutoResize) { mTargetDim = (mOrientation == LLLayoutStack::HORIZONTAL) ? width : height; LLLayoutStack* stackp = dynamic_cast<LLLayoutStack*>(getParent()); @@ -314,10 +312,10 @@ void LLLayoutStack::removeChild(LLView* view) } } -BOOL LLLayoutStack::postBuild() +bool LLLayoutStack::postBuild() { updateLayout(); - return TRUE; + return true; } bool LLLayoutStack::addChild(LLView* child, S32 tab_group) @@ -330,7 +328,7 @@ bool LLLayoutStack::addChild(LLView* child, S32 tab_group) createResizeBar(panelp); mNeedsLayout = true; } - BOOL result = LLView::addChild(child, tab_group); + bool result = LLView::addChild(child, tab_group); updateFractionalSizes(); return result; @@ -344,11 +342,11 @@ void LLLayoutStack::addPanel(LLLayoutPanel* panel, EAnimate animate) if (animate == ANIMATE) { panel->mVisibleAmt = 0.f; - panel->setVisible(TRUE); + panel->setVisible(true); } } -void LLLayoutStack::collapsePanel(LLPanel* panel, BOOL collapsed) +void LLLayoutStack::collapsePanel(LLPanel* panel, bool collapsed) { LLLayoutPanel* panel_container = findEmbeddedPanel(panel); if (!panel_container) return; @@ -615,7 +613,7 @@ void LLLayoutStack::createResizeBar(LLLayoutPanel* panelp) border_params.shadow_dark_color = LLUIColorTable::instance().getColor("ResizebarBorderDark"); addBorder(border_params); - setBorderVisible(TRUE); + setBorderVisible(true); LLImagePanel::Params image_panel; mDragHandleImage = LLUI::getUIImage(LLResizeBar::RIGHT == mSide ? "Vertical Drag Handle" : "Horizontal Drag Handle"); @@ -628,7 +626,7 @@ void LLLayoutStack::createResizeBar(LLLayoutPanel* panelp) //if (mShowDragHandle) //{ - // setBackgroundVisible(TRUE); + // setBackgroundVisible(true); // setTransparentColor(LLUIColorTable::instance().getColor("ResizebarBody")); //} @@ -985,7 +983,7 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& //normalizeFractionalSizes(); } -void LLLayoutStack::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLLayoutStack::reshape(S32 width, S32 height, bool called_from_parent) { mNeedsLayout = true; LLView::reshape(width, height, called_from_parent); @@ -998,7 +996,7 @@ void LLLayoutStack::updateResizeBarLimits() { if (!visible_panelp->getVisible() || visible_panelp->mCollapsed) { - visible_panelp->mResizeBar->setVisible(FALSE); + visible_panelp->mResizeBar->setVisible(false); continue; } @@ -1008,14 +1006,14 @@ void LLLayoutStack::updateResizeBarLimits() && (visible_panelp->mAutoResize || visible_panelp->mUserResize) // current panel is resizable && (previous_visible_panelp->mAutoResize || previous_visible_panelp->mUserResize)) // previous panel is resizable { - visible_panelp->mResizeBar->setVisible(TRUE); + visible_panelp->mResizeBar->setVisible(true); S32 previous_panel_headroom = previous_visible_panelp->getVisibleDim() - previous_visible_panelp->getRelevantMinDim(); visible_panelp->mResizeBar->setResizeLimits(visible_panelp->getRelevantMinDim(), visible_panelp->getVisibleDim() + previous_panel_headroom); } else { - visible_panelp->mResizeBar->setVisible(FALSE); + visible_panelp->mResizeBar->setVisible(false); } previous_visible_panelp = visible_panelp; diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index 884850285a..9e5f8048ba 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -71,9 +71,9 @@ public: /*virtual*/ void draw(); /*virtual*/ void deleteAllChildren(); /*virtual*/ void removeChild(LLView*); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ bool addChild(LLView* child, S32 tab_group = 0); - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true); static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node = NULL); @@ -85,8 +85,8 @@ public: } EAnimate; void addPanel(LLLayoutPanel* panel, EAnimate animate = NO_ANIMATE); - void collapsePanel(LLPanel* panel, BOOL collapsed = TRUE); - S32 getNumPanels() { return mPanels.size(); } + void collapsePanel(LLPanel* panel, bool collapsed = true); + S32 getNumPanels() { return static_cast<S32>(mPanels.size()); } void updateLayout(); @@ -156,10 +156,10 @@ public: void handleReshape(const LLRect& new_rect, bool by_user); - void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + void reshape(S32 width, S32 height, bool called_from_parent = true); - void setVisible(BOOL visible); + void setVisible(bool visible); S32 getLayoutDim() const; S32 getTargetDim() const; diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 05de46b852..fa71c7704d 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -74,7 +74,7 @@ static LLDefaultChildRegistry::Register<LLLineEditor> r1("line_editor"); // Compiler optimization, generate extern template template class LLLineEditor* LLView::getChild<class LLLineEditor>( - const std::string& name, BOOL recurse) const; + const std::string& name, bool recurse) const; // // Member functions @@ -131,10 +131,10 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p) mTextLeftEdge(0), // computed in updateTextPadding() below mTextRightEdge(0), // computed in updateTextPadding() below mCommitOnFocusLost( p.commit_on_focus_lost ), - mKeystrokeOnEsc(FALSE), + mKeystrokeOnEsc(false), mRevertOnEsc( p.revert_on_esc ), mKeystrokeCallback( p.keystroke_callback() ), - mIsSelecting( FALSE ), + mIsSelecting( false ), mSelectionStart( 0 ), mSelectionEnd( 0 ), mLastSelectionX(-1), @@ -142,7 +142,7 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p) mLastSelectionStart(-1), mLastSelectionEnd(-1), mBorderThickness( 0 ), - mIgnoreArrowKeys( FALSE ), + mIgnoreArrowKeys( false ), mIgnoreTab( p.ignore_tab ), mDrawAsterixes( p.is_password ), mAllowEmoji( p.allow_emoji ), @@ -150,17 +150,17 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p) mSpellCheckStart(-1), mSpellCheckEnd(-1), mSelectAllonFocusReceived( p.select_on_focus ), - mSelectAllonCommit( TRUE ), - mPassDelete(FALSE), - mReadOnly(FALSE), + mSelectAllonCommit( true ), + mPassDelete(false), + mReadOnly(false), mBgImage( p.background_image ), mBgImageDisabled( p.background_image_disabled ), mBgImageFocused( p.background_image_focused ), mShowImageFocused( p.bg_image_always_focused ), mShowLabelFocused( p.show_label_focused ), mUseBgColor(p.use_bg_color), - mHaveHistory(FALSE), - mReplaceNewlinesWithSpaces( TRUE ), + mHaveHistory(false), + mReplaceNewlinesWithSpaces( true ), mPrevalidator(p.prevalidator()), mInputPrevalidator(p.input_prevalidator()), mLabel(p.label), @@ -177,7 +177,7 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p) { llassert( mMaxLengthBytes > 0 ); - LLUICtrl::setEnabled(TRUE); + LLUICtrl::setEnabled(true); setEnabled(p.enabled); mScrollTimer.reset(); @@ -221,7 +221,7 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p) LLLineEditor::~LLLineEditor() { - mCommitOnFocusLost = FALSE; + mCommitOnFocusLost = false; // Make sure no context menu linger around once the widget is deleted LLContextMenu* menu = static_cast<LLContextMenu*>(mContextMenuHandle.get()); @@ -238,7 +238,7 @@ LLLineEditor::~LLLineEditor() void LLLineEditor::initFromParams(const LLLineEditor::Params& params) { LLUICtrl::initFromParams(params); - LLUICtrl::setEnabled(TRUE); + LLUICtrl::setEnabled(true); setEnabled(params.enabled); } @@ -287,9 +287,9 @@ void LLLineEditor::onCommit() if (mSelectAllonCommit) selectAll(); } -// Returns TRUE if user changed value at all +// Returns true if user changed value at all // virtual -BOOL LLLineEditor::isDirty() const +bool LLLineEditor::isDirty() const { return mText.getString() != mPrevText; } @@ -350,14 +350,14 @@ void LLLineEditor::updateHistory() } } -void LLLineEditor::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLLineEditor::reshape(S32 width, S32 height, bool called_from_parent) { LLUICtrl::reshape(width, height, called_from_parent); updateTextPadding(); // For clamping side-effect. setCursor(mCursorPos); // For clamping side-effect. } -void LLLineEditor::setEnabled(BOOL enabled) +void LLLineEditor::setEnabled(bool enabled) { mReadOnly = !enabled; setTabStop(!mReadOnly); @@ -412,7 +412,7 @@ void LLLineEditor::setText(const LLStringExplicit &new_text, bool use_size_limit // Check to see if entire field is selected. S32 len = mText.length(); - BOOL all_selected = (len > 0) + bool all_selected = (len > 0) && (( mSelectionStart == 0 && mSelectionEnd == len ) || ( mSelectionStart == len && mSelectionEnd == 0 )); @@ -529,7 +529,7 @@ void LLLineEditor::resetScrollPosition() setCursor(getCursor()); } -BOOL LLLineEditor::canDeselect() const +bool LLLineEditor::canDeselect() const { return hasSelection(); } @@ -538,13 +538,13 @@ void LLLineEditor::deselect() { mSelectionStart = 0; mSelectionEnd = 0; - mIsSelecting = FALSE; + mIsSelecting = false; } void LLLineEditor::startSelection() { - mIsSelecting = TRUE; + mIsSelecting = true; mSelectionStart = getCursor(); mSelectionEnd = getCursor(); } @@ -553,14 +553,14 @@ void LLLineEditor::endSelection() { if( mIsSelecting ) { - mIsSelecting = FALSE; + mIsSelecting = false; mSelectionEnd = getCursor(); } } -BOOL LLLineEditor::canSelectAll() const +bool LLLineEditor::canSelectAll() const { - return TRUE; + return true; } void LLLineEditor::selectAll() @@ -574,7 +574,7 @@ void LLLineEditor::selectAll() mSelectionEnd = 0; setCursor(mSelectionEnd); //mScrollHPos = 0; - mIsSelecting = TRUE; + mIsSelecting = true; updatePrimary(); } @@ -590,7 +590,7 @@ const std::string& LLLineEditor::getSuggestion(U32 index) const U32 LLLineEditor::getSuggestionCount() const { - return mSuggestionList.size(); + return static_cast<U32>(mSuggestionList.size()); } void LLLineEditor::replaceWithSuggestion(U32 index) @@ -680,9 +680,9 @@ void LLLineEditor::onSpellCheckSettingsChange() mSpellCheckStart = mSpellCheckEnd = -1; } -BOOL LLLineEditor::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLLineEditor::handleDoubleClick(S32 x, S32 y, MASK mask) { - setFocus( TRUE ); + setFocus( true ); mTripleClickTimer.setTimerExpirySec(TRIPLE_CLICK_INTERVAL); if (mSelectionEnd == 0 && mSelectionStart == mText.length()) @@ -694,7 +694,7 @@ BOOL LLLineEditor::handleDoubleClick(S32 x, S32 y, MASK mask) { const LLWString& wtext = mText.getWString(); - BOOL doSelectAll = TRUE; + bool doSelectAll = true; // Select the word we're on if( LLWStringUtil::isPartOfWord( wtext[mCursorPos] ) ) @@ -729,7 +729,7 @@ BOOL LLLineEditor::handleDoubleClick(S32 x, S32 y, MASK mask) // We don't want handleMouseUp() to "finish" the selection (and thereby // set mSelectionEnd to where the mouse is), so we finish the selection // here. - mIsSelecting = FALSE; + mIsSelecting = false; // delay cursor flashing mKeystrokeTimer.reset(); @@ -737,15 +737,15 @@ BOOL LLLineEditor::handleDoubleClick(S32 x, S32 y, MASK mask) // take selection to 'primary' clipboard updatePrimary(); - return TRUE; + return true; } -BOOL LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask) { // Check first whether the "clear search" button wants to deal with this. if(childrenHandleMouseDown(x, y, mask) != NULL) { - return TRUE; + return true; } if (!mSelectAllonFocusReceived @@ -757,7 +757,7 @@ BOOL LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask) if (mask & MASK_SHIFT) { // assume we're starting a drag select - mIsSelecting = TRUE; + mIsSelecting = true; // Handle selection extension S32 old_cursor_pos = getCursor(); @@ -813,14 +813,14 @@ BOOL LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask) // We don't want handleMouseUp() to "finish" the selection (and thereby // set mSelectionEnd to where the mouse is), so we finish the selection // here. - mIsSelecting = FALSE; + mIsSelecting = false; } } gFocusMgr.setMouseCapture( this ); } - setFocus(TRUE); + setFocus(true); // delay cursor flashing mKeystrokeTimer.reset(); @@ -828,40 +828,40 @@ BOOL LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask) if (mMouseDownSignal) (*mMouseDownSignal)(this,x,y,mask); - return TRUE; + return true; } -BOOL LLLineEditor::handleMiddleMouseDown(S32 x, S32 y, MASK mask) +bool LLLineEditor::handleMiddleMouseDown(S32 x, S32 y, MASK mask) { // LL_INFOS() << "MiddleMouseDown" << LL_ENDL; - setFocus( TRUE ); + setFocus( true ); if( canPastePrimary() ) { setCursorAtLocalPos(x); pastePrimary(); } - return TRUE; + return true; } -BOOL LLLineEditor::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLLineEditor::handleRightMouseDown(S32 x, S32 y, MASK mask) { - setFocus(TRUE); + setFocus(true); if (!LLUICtrl::handleRightMouseDown(x, y, mask) && getShowContextMenu()) { showContextMenu(x, y); } - return TRUE; + return true; } -BOOL LLLineEditor::handleHover(S32 x, S32 y, MASK mask) +bool LLLineEditor::handleHover(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; // Check first whether the "clear search" button wants to deal with this. if(!hasMouseCapture()) { if(childrenHandleHover(x, y, mask) != NULL) { - return TRUE; + return true; } } @@ -904,34 +904,34 @@ BOOL LLLineEditor::handleHover(S32 x, S32 y, MASK mask) getWindow()->setCursor(UI_CURSOR_IBEAM); LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (active)" << LL_ENDL; - handled = TRUE; + handled = true; } if( !handled ) { getWindow()->setCursor(UI_CURSOR_IBEAM); LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (inactive)" << LL_ENDL; - handled = TRUE; + handled = true; } return handled; } -BOOL LLLineEditor::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLLineEditor::handleMouseUp(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; if( hasMouseCapture() ) { gFocusMgr.setMouseCapture( NULL ); - handled = TRUE; + handled = true; } // Check first whether the "clear search" button wants to deal with this. if(!handled && childrenHandleMouseUp(x, y, mask) != NULL) { - return TRUE; + return true; } if( mIsSelecting ) @@ -939,7 +939,7 @@ BOOL LLLineEditor::handleMouseUp(S32 x, S32 y, MASK mask) setCursorAtLocalPos( x ); mSelectionEnd = getCursor(); - handled = TRUE; + handled = true; } if( handled ) @@ -994,23 +994,23 @@ void LLLineEditor::addChar(const llwchar uni_char) mText.erase(getCursor(), 1); } - S32 cur_bytes = mText.getString().size(); + S32 cur_bytes = static_cast<S32>(mText.getString().size()); S32 new_bytes = wchar_utf8_length(new_c); - BOOL allow_char = TRUE; + bool allow_char = true; // Check byte length limit if ((new_bytes + cur_bytes) > mMaxLengthBytes) { - allow_char = FALSE; + allow_char = false; } else if (mMaxLengthChars) { - S32 wide_chars = mText.getWString().size(); + auto wide_chars = mText.getWString().size(); if ((wide_chars + 1) > mMaxLengthChars) { - allow_char = FALSE; + allow_char = false; } } @@ -1074,7 +1074,7 @@ void LLLineEditor::setSelection(S32 start, S32 end) { S32 len = mText.length(); - mIsSelecting = TRUE; + mIsSelecting = true; // JC, yes, this seems odd, but I think you have to presume a // selection dragged from the end towards the start. @@ -1083,7 +1083,7 @@ void LLLineEditor::setSelection(S32 start, S32 end) setCursor(start); } -void LLLineEditor::setDrawAsterixes(BOOL b) +void LLLineEditor::setDrawAsterixes(bool b) { mDrawAsterixes = b; updateAllowingLanguageInput(); @@ -1118,13 +1118,13 @@ S32 LLLineEditor::nextWordPos(S32 cursorPos) const } -BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask) +bool LLLineEditor::handleSelectionKey(KEY key, MASK mask) { - BOOL handled = FALSE; + bool handled = false; if( mask & MASK_SHIFT ) { - handled = TRUE; + handled = true; switch( key ) { @@ -1177,7 +1177,7 @@ BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask) } default: - handled = FALSE; + handled = false; break; } } @@ -1208,7 +1208,7 @@ void LLLineEditor::deleteSelection() } } -BOOL LLLineEditor::canCut() const +bool LLLineEditor::canCut() const { return !mReadOnly && !mDrawAsterixes && hasSelection(); } @@ -1232,7 +1232,7 @@ void LLLineEditor::cut() deleteSelection(); // Validate new string and rollback the if needed. - BOOL need_to_rollback = mPrevalidator && !mPrevalidator.validate(mText.getWString()); + bool need_to_rollback = mPrevalidator && !mPrevalidator.validate(mText.getWString()); if (need_to_rollback) { rollback.doRollback( this ); @@ -1246,7 +1246,7 @@ void LLLineEditor::cut() } } -BOOL LLLineEditor::canCopy() const +bool LLLineEditor::canCopy() const { return !mDrawAsterixes && hasSelection(); } @@ -1263,7 +1263,7 @@ void LLLineEditor::copy() } } -BOOL LLLineEditor::canPaste() const +bool LLLineEditor::canPaste() const { return !mReadOnly && LLClipboard::instance().isTextAvailable(); } @@ -1351,7 +1351,7 @@ void LLLineEditor::pasteHelper(bool is_primary) if (mMaxLengthChars) { - U32 available_chars = mMaxLengthChars - mText.getWString().size(); + auto available_chars = mMaxLengthChars - mText.getWString().size(); if (available_chars < clean_string.size()) { @@ -1366,7 +1366,7 @@ void LLLineEditor::pasteHelper(bool is_primary) deselect(); // Validate new string and rollback the if needed. - BOOL need_to_rollback = mPrevalidator && !mPrevalidator.validate(mText.getWString()); + bool need_to_rollback = mPrevalidator && !mPrevalidator.validate(mText.getWString()); if (need_to_rollback) { rollback.doRollback( this ); @@ -1392,7 +1392,7 @@ void LLLineEditor::copyPrimary() } } -BOOL LLLineEditor::canPastePrimary() const +bool LLLineEditor::canPastePrimary() const { return !mReadOnly && LLClipboard::instance().isTextAvailable(true); } @@ -1405,9 +1405,9 @@ void LLLineEditor::updatePrimary() } } -BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) +bool LLLineEditor::handleSpecialKey(KEY key, MASK mask) { - BOOL handled = FALSE; + bool handled = false; switch( key ) { @@ -1417,7 +1417,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) gKeyboard->toggleInsertMode(); } - handled = TRUE; + handled = true; break; case KEY_BACKSPACE: @@ -1438,7 +1438,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) LLUI::getInstance()->reportBadKeystroke(); } } - handled = TRUE; + handled = true; break; case KEY_PAGE_UP: @@ -1446,7 +1446,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) if (!mIgnoreArrowKeys) { setCursor(0); - handled = TRUE; + handled = true; } break; @@ -1459,7 +1459,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) { setCursor(len); } - handled = TRUE; + handled = true; } break; @@ -1486,7 +1486,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) { LLUI::getInstance()->reportBadKeystroke(); } - handled = TRUE; + handled = true; } break; @@ -1513,32 +1513,32 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) { LLUI::getInstance()->reportBadKeystroke(); } - handled = TRUE; + handled = true; } break; // handle ctrl-uparrow if we have a history enabled line editor. case KEY_UP: - if( mHaveHistory && ((mIgnoreArrowKeys == false) || ( MASK_CONTROL == mask )) ) + if (mHaveHistory && (!mIgnoreArrowKeys || (MASK_CONTROL == mask))) { - if( mCurrentHistoryLine > mLineHistory.begin() ) + if (mCurrentHistoryLine > mLineHistory.begin()) { - mText.assign( *(--mCurrentHistoryLine) ); + mText.assign(*(--mCurrentHistoryLine)); setCursorToEnd(); } else { LLUI::getInstance()->reportBadKeystroke(); } - handled = TRUE; + handled = true; } break; // handle [ctrl]-downarrow if we have a history enabled line editor case KEY_DOWN: - if( mHaveHistory && ((mIgnoreArrowKeys == false) || ( MASK_CONTROL == mask )) ) + if (mHaveHistory && (!mIgnoreArrowKeys || (MASK_CONTROL == mask))) { - if( !mLineHistory.empty() && mCurrentHistoryLine < mLineHistory.end() - 1 ) + if (!mLineHistory.empty() && mCurrentHistoryLine < mLineHistory.end() - 1) { mText.assign( *(++mCurrentHistoryLine) ); setCursorToEnd(); @@ -1547,7 +1547,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) { LLUI::getInstance()->reportBadKeystroke(); } - handled = TRUE; + handled = true; } break; @@ -1576,10 +1576,10 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) } -BOOL LLLineEditor::handleKeyHere(KEY key, MASK mask ) +bool LLLineEditor::handleKeyHere(KEY key, MASK mask ) { - BOOL handled = FALSE; - BOOL selection_modified = FALSE; + bool handled = false; + bool selection_modified = false; if ( gFocusMgr.getKeyboardFocus() == this ) { @@ -1653,18 +1653,18 @@ BOOL LLLineEditor::handleKeyHere(KEY key, MASK mask ) } -BOOL LLLineEditor::handleUnicodeCharHere(llwchar uni_char) +bool LLLineEditor::handleUnicodeCharHere(llwchar uni_char) { if ((uni_char < 0x20) || (uni_char == 0x7F)) // Control character or DEL { - return FALSE; + return false; } - BOOL handled = FALSE; + bool handled = false; if ( (gFocusMgr.getKeyboardFocus() == this) && getVisible() && !mReadOnly) { - handled = TRUE; + handled = true; LLLineEditorRollback rollback( this ); @@ -1704,7 +1704,7 @@ BOOL LLLineEditor::handleUnicodeCharHere(llwchar uni_char) return handled; } -BOOL LLLineEditor::handleUnicodeStringHere(char *uni_str, bool editing) +bool LLLineEditor::handleUnicodeStringHere(char *uni_str, bool editing) { auto handled = FALSE; @@ -1735,7 +1735,7 @@ BOOL LLLineEditor::handleUnicodeStringHere(char *uni_str, bool editing) return handled; } -BOOL LLLineEditor::canDoDelete() const +bool LLLineEditor::canDoDelete() const { return ( !mReadOnly && (!mPassDelete || (hasSelection() || (getCursor() < mText.length()))) ); } @@ -1787,7 +1787,7 @@ void LLLineEditor::drawBackground() F32 alpha = getCurrentTransparency(); if (mUseBgColor) { - gl_rect_2d(getLocalRect(), mBgColor % alpha, TRUE); + gl_rect_2d(getLocalRect(), mBgColor % alpha, true); } else { @@ -2009,7 +2009,7 @@ void LLLineEditor::draw() &rendered_pixels_right); } #if 1 // for when we're ready for image art. - mBorder->setVisible(FALSE); // no more programmatic art. + mBorder->setVisible(false); // no more programmatic art. #endif if ( (getSpellCheck()) && (mText.length() > 2) ) @@ -2110,7 +2110,7 @@ void LLLineEditor::draw() // If we're editing... if( hasFocus()) { - //mBorder->setVisible(TRUE); // ok, programmer art just this once. + //mBorder->setVisible(true); // ok, programmer art just this once. // (Flash the cursor every half second) if (!mReadOnly && gFocusMgr.getAppHasFocus()) { @@ -2166,16 +2166,16 @@ void LLLineEditor::draw() LLFontGL::NO_SHADOW, S32_MAX, mTextRightEdge - ll_round(rendered_pixels_right), - &rendered_pixels_right, FALSE); + &rendered_pixels_right, false); } // Draw children (border) - //mBorder->setVisible(TRUE); - mBorder->setKeyboardFocusHighlight( TRUE ); + //mBorder->setVisible(true); + mBorder->setKeyboardFocusHighlight( true ); LLView::draw(); - mBorder->setKeyboardFocusHighlight( FALSE ); - //mBorder->setVisible(FALSE); + mBorder->setKeyboardFocusHighlight( false ); + //mBorder->setVisible(false); } else // does not have keyboard input { @@ -2248,19 +2248,19 @@ void LLLineEditor::onTabInto() } //virtual -BOOL LLLineEditor::acceptsTextInput() const +bool LLLineEditor::acceptsTextInput() const { - return TRUE; + return true; } // Start or stop the editor from accepting text-editing keystrokes -void LLLineEditor::setFocus( BOOL new_state ) +void LLLineEditor::setFocus( bool new_state ) { - BOOL old_state = hasFocus(); + bool old_state = hasFocus(); if (!new_state) { - getWindow()->allowLanguageTextInput(this, FALSE); + getWindow()->allowLanguageTextInput(this, false); } @@ -2271,7 +2271,7 @@ void LLLineEditor::setFocus( BOOL new_state ) // We don't want handleMouseUp() to "finish" the selection (and thereby // set mSelectionEnd to where the mouse is), so we finish the selection // here. - mIsSelecting = FALSE; + mIsSelecting = false; } if( new_state ) @@ -2339,20 +2339,20 @@ bool LLLineEditor::prevalidateInput(const LLWString& wstr) } // static -BOOL LLLineEditor::postvalidateFloat(const std::string &str) +bool LLLineEditor::postvalidateFloat(const std::string &str) { LLLocale locale(LLLocale::USER_LOCALE); - BOOL success = TRUE; - BOOL has_decimal = FALSE; - BOOL has_digit = FALSE; + bool success = true; + bool has_decimal = false; + bool has_digit = false; LLWString trimmed = utf8str_to_wstring(str); LLWStringUtil::trim(trimmed); - S32 len = trimmed.length(); + auto len = trimmed.length(); if( 0 < len ) { - S32 i = 0; + size_t i = 0; // First character can be a negative sign if( '-' == trimmed[0] ) @@ -2370,22 +2370,22 @@ BOOL LLLineEditor::postvalidateFloat(const std::string &str) if( has_decimal ) { // can't have two - success = FALSE; + success = false; break; } else { - has_decimal = TRUE; + has_decimal = true; } } else if( LLStringOps::isDigit( trimmed[i] ) ) { - has_digit = TRUE; + has_digit = true; } else { - success = FALSE; + success = false; break; } } @@ -2397,7 +2397,7 @@ BOOL LLLineEditor::postvalidateFloat(const std::string &str) return success; } -BOOL LLLineEditor::evaluateFloat() +bool LLLineEditor::evaluateFloat() { bool success; F32 result = 0.f; @@ -2409,7 +2409,7 @@ BOOL LLLineEditor::evaluateFloat() if (!success) { // Move the cursor to near the error on failure - setCursor(LLCalc::getInstance()->getLastErrorPos()); + setCursor(static_cast<S32>(LLCalc::getInstance()->getLastErrorPos())); // *TODO: Translated error message indicating the type of error? Select error text? } else @@ -2429,7 +2429,7 @@ void LLLineEditor::onMouseCaptureLost() } -void LLLineEditor::setSelectAllonFocusReceived(BOOL b) +void LLLineEditor::setSelectAllonFocusReceived(bool b) { mSelectAllonFocusReceived = b; } @@ -2450,16 +2450,16 @@ void LLLineEditor::setKeystrokeCallback(callback_t callback, void* user_data) } -BOOL LLLineEditor::setTextArg( const std::string& key, const LLStringExplicit& text ) +bool LLLineEditor::setTextArg( const std::string& key, const LLStringExplicit& text ) { mText.setArg(key, text); - return TRUE; + return true; } -BOOL LLLineEditor::setLabelArg( const std::string& key, const LLStringExplicit& text ) +bool LLLineEditor::setLabelArg( const std::string& key, const LLStringExplicit& text ) { mLabel.setArg(key, text); - return TRUE; + return true; } @@ -2479,15 +2479,15 @@ void LLLineEditor::updateAllowingLanguageInput() } if (hasFocus() && !mReadOnly && !mDrawAsterixes && !mPrevalidator) { - window->allowLanguageTextInput(this, TRUE); + window->allowLanguageTextInput(this, true); } else { - window->allowLanguageTextInput(this, FALSE); + window->allowLanguageTextInput(this, false); } } -BOOL LLLineEditor::hasPreeditString() const +bool LLLineEditor::hasPreeditString() const { return (mPreeditPositions.size() > 1); } @@ -2550,7 +2550,7 @@ void LLLineEditor::updatePreedit(const LLWString &preedit_string, if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode()) { mPreeditOverwrittenWString.assign( LLWString( mText, insert_preedit_at, mPreeditWString.length() ) ); - mText.erase(insert_preedit_at, mPreeditWString.length()); + mText.erase(insert_preedit_at, static_cast<S32>(mPreeditWString.length())); } else { @@ -2570,7 +2570,7 @@ void LLLineEditor::updatePreedit(const LLWString &preedit_string, mSpellCheckTimer.setTimerExpirySec(SPELLCHECK_DELAY); } -BOOL LLLineEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect *bounds, LLRect *control) const +bool LLLineEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect *bounds, LLRect *control) const { if (control) { @@ -2592,13 +2592,13 @@ BOOL LLLineEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect if (preedit_right_column < mScrollHPos) { // This should not occure... - return FALSE; + return false; } const S32 query = (query_offset >= 0 ? preedit_left_column + query_offset : getCursor()); if (query < mScrollHPos || query < preedit_left_column || query > preedit_right_column) { - return FALSE; + return false; } if (coord) @@ -2625,7 +2625,7 @@ BOOL LLLineEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect LLUI::getInstance()->screenRectToGL(preedit_rect_screen, bounds); } - return TRUE; + return true; } void LLLineEditor::getPreeditRange(S32 *position, S32 *length) const @@ -2671,7 +2671,7 @@ void LLLineEditor::markAsPreedit(S32 position, S32 length) mPreeditPositions[0] = position; mPreeditPositions[1] = position + length; mPreeditStandouts.resize(1); - mPreeditStandouts[0] = FALSE; + mPreeditStandouts[0] = false; } else { @@ -2693,7 +2693,7 @@ S32 LLLineEditor::getPreeditFontSize() const return ll_round(mGLFont->getLineHeight() * LLUI::getScaleFactor().mV[VY]); } -void LLLineEditor::setReplaceNewlinesWithSpaces(BOOL replace) +void LLLineEditor::setReplaceNewlinesWithSpaces(bool replace) { mReplaceNewlinesWithSpaces = replace; } @@ -2749,7 +2749,7 @@ void LLLineEditor::showContextMenu(S32 x, S32 y) // If the cursor is on a misspelled word, retrieve suggestions for it std::string misspelled_word = getMisspelledWord(mCursorPos); - if ((is_misspelled = !misspelled_word.empty()) == true) + if ((is_misspelled = !misspelled_word.empty())) { LLSpellChecker::instance().getSuggestions(misspelled_word, mSuggestionList); } diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 10f486643a..2d9c3ac58a 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -125,38 +125,38 @@ public: virtual ~LLLineEditor(); // mousehandler overrides - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleDoubleClick(S32 x,S32 y,MASK mask) override; - /*virtual*/ BOOL handleMiddleMouseDown(S32 x,S32 y,MASK mask) override; - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask) override; - /*virtual*/ BOOL handleUnicodeCharHere(llwchar uni_char) override; - /*virtual*/ BOOL handleUnicodeStringHere(char *uni_str, bool editing) override; + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleDoubleClick(S32 x,S32 y,MASK mask) override; + /*virtual*/ bool handleMiddleMouseDown(S32 x,S32 y,MASK mask) override; + /*virtual*/ bool handleRightMouseDown(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleKeyHere(KEY key, MASK mask) override; + /*virtual*/ bool handleUnicodeCharHere(llwchar uni_char) override; + /*virtual*/ bool handleUnicodeStringHere(char *uni_str, bool editing) override; /*virtual*/ void onMouseCaptureLost() override; // LLEditMenuHandler overrides /*virtual*/ void cut() override; - /*virtual*/ BOOL canCut() const override; + /*virtual*/ bool canCut() const override; /*virtual*/ void copy() override; - /*virtual*/ BOOL canCopy() const override; + /*virtual*/ bool canCopy() const override; /*virtual*/ void paste() override; - /*virtual*/ BOOL canPaste() const override; + /*virtual*/ bool canPaste() const override; virtual void updatePrimary(); virtual void copyPrimary(); virtual void pastePrimary(); - virtual BOOL canPastePrimary() const; + virtual bool canPastePrimary() const; /*virtual*/ void doDelete() override; - /*virtual*/ BOOL canDoDelete() const override; + /*virtual*/ bool canDoDelete() const override; /*virtual*/ void selectAll() override; - /*virtual*/ BOOL canSelectAll() const override; + /*virtual*/ bool canSelectAll() const override; /*virtual*/ void deselect() override; - /*virtual*/ BOOL canDeselect() const override; + /*virtual*/ bool canDeselect() const override; // LLSpellCheckMenuHandler overrides /*virtual*/ bool getSpellCheck() const override; @@ -178,26 +178,26 @@ public: // view overrides /*virtual*/ void draw() override; - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE) override; + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true) override; /*virtual*/ void onFocusReceived() override; /*virtual*/ void onFocusLost() override; - /*virtual*/ void setEnabled(BOOL enabled) override; + /*virtual*/ void setEnabled(bool enabled) override; // UI control overrides /*virtual*/ void clear() override; /*virtual*/ void onTabInto() override; - /*virtual*/ void setFocus(BOOL b) override; + /*virtual*/ void setFocus(bool b) override; /*virtual*/ void setRect(const LLRect& rect) override; - /*virtual*/ BOOL acceptsTextInput() const override; + /*virtual*/ bool acceptsTextInput() const override; /*virtual*/ void onCommit() override; - /*virtual*/ BOOL isDirty() const override; // Returns TRUE if user changed value at all + /*virtual*/ bool isDirty() const override; // Returns true if user changed value at all /*virtual*/ void resetDirty() override; // Clear dirty state // assumes UTF8 text /*virtual*/ void setValue(const LLSD& value) override; /*virtual*/ LLSD getValue() const override; - /*virtual*/ BOOL setTextArg(const std::string& key, const LLStringExplicit& text) override; - /*virtual*/ BOOL setLabelArg(const std::string& key, const LLStringExplicit& text) override; + /*virtual*/ bool setTextArg(const std::string& key, const LLStringExplicit& text) override; + /*virtual*/ bool setLabelArg(const std::string& key, const LLStringExplicit& text) override; void setLabel(const LLStringExplicit &new_label) { mLabel = new_label; } const std::string& getLabel() { return mLabel.getString(); } @@ -221,9 +221,9 @@ public: void setSelection(S32 start, S32 end); /*virtual*/ void getSelectionRange(S32 *position, S32 *length) const override; - void setCommitOnFocusLost( BOOL b ) { mCommitOnFocusLost = b; } - void setRevertOnEsc( BOOL b ) { mRevertOnEsc = b; } - void setKeystrokeOnEsc(BOOL b) { mKeystrokeOnEsc = b; } + void setCommitOnFocusLost( bool b ) { mCommitOnFocusLost = b; } + void setRevertOnEsc( bool b ) { mRevertOnEsc = b; } + void setKeystrokeOnEsc(bool b) { mKeystrokeOnEsc = b; } void setCursorColor(const LLColor4& c) { mCursorColor = c; } const LLColor4& getCursorColor() const { return mCursorColor.get(); } @@ -239,24 +239,24 @@ public: const LLFontGL* getFont() const override { return mGLFont; } void setFont(const LLFontGL* font); - void setIgnoreArrowKeys(BOOL b) { mIgnoreArrowKeys = b; } - void setIgnoreTab(BOOL b) { mIgnoreTab = b; } - void setPassDelete(BOOL b) { mPassDelete = b; } - void setAllowEmoji(BOOL b) { mAllowEmoji = b; } - void setDrawAsterixes(BOOL b); + void setIgnoreArrowKeys(bool b) { mIgnoreArrowKeys = b; } + void setIgnoreTab(bool b) { mIgnoreTab = b; } + void setPassDelete(bool b) { mPassDelete = b; } + void setAllowEmoji(bool b) { mAllowEmoji = b; } + void setDrawAsterixes(bool b); // get the cursor position of the beginning/end of the prev/next word in the text S32 prevWordPos(S32 cursorPos) const; S32 nextWordPos(S32 cursorPos) const; - BOOL hasSelection() const { return (mSelectionStart != mSelectionEnd); } + bool hasSelection() const { return (mSelectionStart != mSelectionEnd); } void startSelection(); void endSelection(); void extendSelection(S32 new_cursor_pos); void deleteSelection(); - void setSelectAllonFocusReceived(BOOL b); - void setSelectAllonCommit(BOOL b) { mSelectAllonCommit = b; } + void setSelectAllonFocusReceived(bool b); + void setSelectAllonCommit(bool b) { mSelectAllonCommit = b; } void onKeystroke(); typedef boost::function<void (LLLineEditor* caller, void* user_data)> callback_t; @@ -275,16 +275,16 @@ public: // Also callback that this method sets differs from setPrevalidate in a way that it validates just inputed // symbols, before existing text is modified, but setPrevalidate validates line after it was modified. void setPrevalidateInput(LLTextValidate::Validator validator); - static BOOL postvalidateFloat(const std::string &str); + static bool postvalidateFloat(const std::string &str); bool prevalidateInput(const LLWString& wstr); - BOOL evaluateFloat(); + bool evaluateFloat(); // line history support: - void setEnableLineHistory( BOOL enabled ) { mHaveHistory = enabled; } // switches line history on or off + void setEnableLineHistory( bool enabled ) { mHaveHistory = enabled; } // switches line history on or off void updateHistory(); // stores current line in history - void setReplaceNewlinesWithSpaces(BOOL replace); + void setReplaceNewlinesWithSpaces(bool replace); void resetContextMenu() { setContextMenu(NULL); }; @@ -305,9 +305,9 @@ public: void setCursorAtLocalPos(S32 local_mouse_x); S32 findPixelNearestPos(S32 cursor_offset = 0) const; S32 calcCursorPos(S32 mouse_x); - BOOL handleSpecialKey(KEY key, MASK mask); - BOOL handleSelectionKey(KEY key, MASK mask); - BOOL handleControlKey(KEY key, MASK mask); + bool handleSpecialKey(KEY key, MASK mask); + bool handleSelectionKey(KEY key, MASK mask); + bool handleControlKey(KEY key, MASK mask); S32 handleCommitKey(KEY key, MASK mask); void updateTextPadding(); @@ -318,14 +318,14 @@ public: // private data members // void updateAllowingLanguageInput(); - BOOL hasPreeditString() const; + bool hasPreeditString() const; // Implementation (overrides) of LLPreeditor /*virtual*/ void resetPreedit() override; /*virtual*/ void updatePreedit(const LLWString &preedit_string, const segment_lengths_t &preedit_segment_lengths, const standouts_t &preedit_standouts, S32 caret_position) override; /*virtual*/ void markAsPreedit(S32 position, S32 length) override; /*virtual*/ void getPreeditRange(S32 *position, S32 *length) const override; - /*virtual*/ BOOL getPreeditLocation(S32 query_position, LLCoordGL *coord, LLRect *bounds, LLRect *control) const override; + /*virtual*/ bool getPreeditLocation(S32 query_position, LLCoordGL *coord, LLRect *bounds, LLRect *control) const override; /*virtual*/ S32 getPreeditFontSize() const override; /*virtual*/ LLWString getPreeditString() const override { return getWText(); } @@ -339,7 +339,7 @@ protected: LLUIString mLabel; // text label that is visible when no user text provided // line history support: - BOOL mHaveHistory; // flag for enabled line history + bool mHaveHistory; // flag for enabled line history typedef std::vector<std::string> line_history_t; line_history_t mLineHistory; // line history storage line_history_t::iterator mCurrentHistoryLine; // currently browsed history line @@ -356,13 +356,13 @@ protected: S32 mTextLeftEdge; // Pixels, cached left edge of text based on left padding and width S32 mTextRightEdge; // Pixels, cached right edge of text based on right padding and width - BOOL mCommitOnFocusLost; - BOOL mRevertOnEsc; - BOOL mKeystrokeOnEsc; + bool mCommitOnFocusLost; + bool mRevertOnEsc; + bool mKeystrokeOnEsc; keystroke_callback_t mKeystrokeCallback; - BOOL mIsSelecting; // Selection for clipboard operations + bool mIsSelecting; // Selection for clipboard operations S32 mSelectionStart; S32 mSelectionEnd; S32 mLastSelectionX; @@ -393,18 +393,18 @@ protected: S32 mBorderThickness; - BOOL mIgnoreArrowKeys; - BOOL mIgnoreTab; - BOOL mDrawAsterixes; + bool mIgnoreArrowKeys; + bool mIgnoreTab; + bool mDrawAsterixes; - BOOL mSelectAllonFocusReceived; - BOOL mSelectAllonCommit; - BOOL mPassDelete; + bool mSelectAllonFocusReceived; + bool mSelectAllonCommit; + bool mPassDelete; - BOOL mReadOnly; + bool mReadOnly; - BOOL mShowImageFocused; - BOOL mShowLabelFocused; + bool mShowImageFocused; + bool mShowLabelFocused; bool mAllowEmoji; bool mUseBgColor; @@ -424,7 +424,7 @@ private: LLPointer<LLUIImage> mBgImageDisabled; LLPointer<LLUIImage> mBgImageFocused; - BOOL mReplaceNewlinesWithSpaces; // if false, will replace pasted newlines with paragraph symbol. + bool mReplaceNewlinesWithSpaces; // if false, will replace pasted newlines with paragraph symbol. // private helper class class LLLineEditorRollback @@ -458,7 +458,7 @@ private: std::string mText; S32 mCursorPos; S32 mScrollHPos; - BOOL mIsSelecting; + bool mIsSelecting; S32 mSelectionStart; S32 mSelectionEnd; }; // end class LLLineEditorRollback @@ -468,7 +468,7 @@ private: // Build time optimization, generate once in .cpp file #ifndef LLLINEEDITOR_CPP extern template class LLLineEditor* LLView::getChild<class LLLineEditor>( - const std::string& name, BOOL recurse) const; + const std::string& name, bool recurse) const; #endif #endif // LL_LINEEDITOR_ diff --git a/indra/llui/lllocalcliprect.cpp b/indra/llui/lllocalcliprect.cpp index f8ccb807e6..0204946125 100644 --- a/indra/llui/lllocalcliprect.cpp +++ b/indra/llui/lllocalcliprect.cpp @@ -32,7 +32,7 @@ /*static*/ std::stack<LLRect> LLScreenClipRect::sClipRectStack; -LLScreenClipRect::LLScreenClipRect(const LLRect& rect, BOOL enabled) +LLScreenClipRect::LLScreenClipRect(const LLRect& rect, bool enabled) : mScissorState(GL_SCISSOR_TEST), mEnabled(enabled) { @@ -99,7 +99,7 @@ void LLScreenClipRect::updateScissorRegion() //--------------------------------------------------------------------------- // LLLocalClipRect //--------------------------------------------------------------------------- -LLLocalClipRect::LLLocalClipRect(const LLRect& rect, BOOL enabled /* = TRUE */) +LLLocalClipRect::LLLocalClipRect(const LLRect& rect, bool enabled /* = true */) : LLScreenClipRect(LLRect(rect.mLeft + LLFontGL::sCurOrigin.mX, rect.mTop + LLFontGL::sCurOrigin.mY, rect.mRight + LLFontGL::sCurOrigin.mX, diff --git a/indra/llui/lllocalcliprect.h b/indra/llui/lllocalcliprect.h index cb74de7c22..2a858e6163 100644 --- a/indra/llui/lllocalcliprect.h +++ b/indra/llui/lllocalcliprect.h @@ -38,7 +38,7 @@ class LLScreenClipRect { public: - LLScreenClipRect(const LLRect& rect, BOOL enabled = TRUE); + LLScreenClipRect(const LLRect& rect, bool enabled = true); virtual ~LLScreenClipRect(); private: @@ -48,7 +48,7 @@ private: private: LLGLState mScissorState; - BOOL mEnabled; + bool mEnabled; static std::stack<LLRect> sClipRectStack; }; @@ -56,7 +56,7 @@ private: class LLLocalClipRect : public LLScreenClipRect { public: - LLLocalClipRect(const LLRect& rect, BOOL enabled = TRUE); + LLLocalClipRect(const LLRect& rect, bool enabled = true); ~LLLocalClipRect(); }; diff --git a/indra/llui/llmenubutton.cpp b/indra/llui/llmenubutton.cpp index bfc4c089f3..2f91dcb046 100644 --- a/indra/llui/llmenubutton.cpp +++ b/indra/llui/llmenubutton.cpp @@ -78,7 +78,7 @@ void LLMenuButton::hideMenu() LLToggleableMenu* menu = getMenu(); if (menu) { - menu->setVisible(FALSE); + menu->setVisible(false); } } @@ -118,9 +118,9 @@ void LLMenuButton::setMenu(LLToggleableMenu* menu, EMenuPosition position /*MP_T menu->setVisibilityChangeCallback(boost::bind(&LLMenuButton::onMenuVisibilityChange, this, _2)); } -BOOL LLMenuButton::handleKeyHere(KEY key, MASK mask ) +bool LLMenuButton::handleKeyHere(KEY key, MASK mask ) { - if (!getMenu()) return FALSE; + if (!getMenu()) return false; if( KEY_RETURN == key && mask == MASK_NONE && !gKeyboard->getKeyRepeated(key)) { @@ -129,26 +129,26 @@ BOOL LLMenuButton::handleKeyHere(KEY key, MASK mask ) LLUICtrl::handleMouseDown(-1, -1, MASK_NONE); toggleMenu(); - return TRUE; + return true; } LLToggleableMenu* menu = getMenu(); if (menu && menu->getVisible() && key == KEY_ESCAPE && mask == MASK_NONE) { - menu->setVisible(FALSE); - return TRUE; + menu->setVisible(false); + return true; } - return FALSE; + return false; } -BOOL LLMenuButton::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLMenuButton::handleMouseDown(S32 x, S32 y, MASK mask) { LLButton::handleMouseDown(x, y, mask); toggleMenu(); - return TRUE; + return true; } void LLMenuButton::toggleMenu() diff --git a/indra/llui/llmenubutton.h b/indra/llui/llmenubutton.h index 1039560827..a77ae7dae7 100644 --- a/indra/llui/llmenubutton.h +++ b/indra/llui/llmenubutton.h @@ -65,8 +65,8 @@ public: boost::signals2::connection setMouseDownCallback( const mouse_signal_t::slot_type& cb ); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask ); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleKeyHere(KEY key, MASK mask ); void hideMenu(); diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 8fcb558aae..dffaf69a9f 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -100,7 +100,7 @@ const std::string LLMenuGL::ARROW_DOWN("vvvvvvv"); const F32 MAX_MOUSE_SLOPE_SUB_MENU = 0.9f; -BOOL LLMenuGL::sKeyboardMode = FALSE; +bool LLMenuGL::sKeyboardMode = false; LLHandle<LLView> LLMenuHolderGL::sItemLastSelectedHandle; LLFrameTimer LLMenuHolderGL::sItemActivationTimer; @@ -150,10 +150,10 @@ LLMenuItemGL::LLMenuItemGL(const LLMenuItemGL::Params& p) : LLUICtrl(p), mJumpKey(p.jump_key), mAllowKeyRepeat(p.allow_key_repeat), - mHighlight( FALSE ), - mGotHover( FALSE ), - mBriefItem( FALSE ), - mDrawTextDisabled( FALSE ), + mHighlight( false ), + mGotHover( false ), + mBriefItem( false ), + mDrawTextDisabled( false ), mFont(p.font), mAcceleratorKey(KEY_NONE), mAcceleratorMask(MASK_NONE), @@ -165,7 +165,7 @@ LLMenuItemGL::LLMenuItemGL(const LLMenuItemGL::Params& p) { #ifdef LL_DARWIN // See if this Mac accelerator should really use the ctrl key and not get mapped to cmd - BOOL useMacCtrl = p.use_mac_ctrl; + bool useMacCtrl = p.use_mac_ctrl; #endif // LL_DARWIN std::string shortcut = p.shortcut; @@ -187,7 +187,7 @@ LLMenuItemGL::LLMenuItemGL(const LLMenuItemGL::Params& p) { mAcceleratorMask |= MASK_SHIFT; } - S32 pipe_pos = shortcut.rfind("|"); + auto pipe_pos = shortcut.rfind("|"); std::string key_str = shortcut.substr(pipe_pos+1); LLKeyboard::keyFromString(key_str, &mAcceleratorKey); @@ -218,49 +218,49 @@ bool LLMenuItemGL::hasAccelerator(const KEY &key, const MASK &mask) const } //virtual -BOOL LLMenuItemGL::handleAcceleratorKey(KEY key, MASK mask) +bool LLMenuItemGL::handleAcceleratorKey(KEY key, MASK mask) { if( getEnabled() && (!gKeyboard->getKeyRepeated(key) || mAllowKeyRepeat) && (key == mAcceleratorKey) && (mask == (mAcceleratorMask & MASK_NORMALKEYS)) ) { onCommit(); - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLMenuItemGL::handleHover(S32 x, S32 y, MASK mask) +bool LLMenuItemGL::handleHover(S32 x, S32 y, MASK mask) { getWindow()->setCursor(UI_CURSOR_ARROW); - return TRUE; + return true; } //virtual -BOOL LLMenuItemGL::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLMenuItemGL::handleRightMouseDown(S32 x, S32 y, MASK mask) { return LLUICtrl::handleRightMouseDown(x,y,mask); } void LLMenuItemGL::onMouseEnter(S32 x, S32 y, MASK mask) { - setHover(TRUE); + setHover(true); LLUICtrl::onMouseEnter(x,y,mask); } void LLMenuItemGL::onMouseLeave(S32 x, S32 y, MASK mask) { - setHover(FALSE); + setHover(false); LLUICtrl::onMouseLeave(x,y,mask); } //virtual -BOOL LLMenuItemGL::handleRightMouseUp(S32 x, S32 y, MASK mask) +bool LLMenuItemGL::handleRightMouseUp(S32 x, S32 y, MASK mask) { // If this event came from a right-click context menu spawn, // process as a left-click to allow menu items to be hit if (LLMenuHolderGL::sContextMenuSpawnPos.mX != S32_MAX || LLMenuHolderGL::sContextMenuSpawnPos.mY != S32_MAX) { - BOOL handled = handleMouseUp(x, y, mask); + bool handled = handleMouseUp(x, y, mask); return handled; } return LLUICtrl::handleRightMouseUp(x,y,mask); @@ -268,7 +268,7 @@ BOOL LLMenuItemGL::handleRightMouseUp(S32 x, S32 y, MASK mask) // This function checks to see if the accelerator key is already in use; // if not, it will be added to the list -BOOL LLMenuItemGL::addToAcceleratorList(std::list <LLMenuKeyboardBinding*> *listp) +bool LLMenuItemGL::addToAcceleratorList(std::list <LLMenuKeyboardBinding*> *listp) { LLMenuKeyboardBinding *accelerator = NULL; @@ -293,7 +293,7 @@ BOOL LLMenuItemGL::addToAcceleratorList(std::list <LLMenuKeyboardBinding*> *list // LL_WARNS() << warning << LL_ENDL; // LLAlertDialog::modalAlert(warning); - return FALSE; + return false; } } if (!accelerator) @@ -308,7 +308,7 @@ BOOL LLMenuItemGL::addToAcceleratorList(std::list <LLMenuKeyboardBinding*> *list listp->push_back(accelerator);//addData(accelerator); } } - return TRUE; + return true; } // This function appends the character string representation of @@ -332,13 +332,13 @@ U32 LLMenuItemGL::getNominalHeight( void ) const } //virtual -void LLMenuItemGL::setBriefItem(BOOL brief) +void LLMenuItemGL::setBriefItem(bool brief) { mBriefItem = brief; } //virtual -BOOL LLMenuItemGL::isBriefItem() const +bool LLMenuItemGL::isBriefItem() const { return mBriefItem; } @@ -402,7 +402,7 @@ void LLMenuItemGL::onCommit( void ) } // set the hover status (called by it's menu) - void LLMenuItemGL::setHighlight( BOOL highlight ) + void LLMenuItemGL::setHighlight( bool highlight ) { if (highlight) { @@ -418,7 +418,7 @@ void LLMenuItemGL::onCommit( void ) } -BOOL LLMenuItemGL::handleKeyHere( KEY key, MASK mask ) +bool LLMenuItemGL::handleKeyHere( KEY key, MASK mask ) { if (getHighlight() && getMenu()->isOpen()) @@ -426,52 +426,52 @@ BOOL LLMenuItemGL::handleKeyHere( KEY key, MASK mask ) if (key == KEY_UP) { // switch to keyboard navigation mode - LLMenuGL::setKeyboardMode(TRUE); + LLMenuGL::setKeyboardMode(true); getMenu()->highlightPrevItem(this); - return TRUE; + return true; } else if (key == KEY_DOWN) { // switch to keyboard navigation mode - LLMenuGL::setKeyboardMode(TRUE); + LLMenuGL::setKeyboardMode(true); getMenu()->highlightNextItem(this); - return TRUE; + return true; } else if (key == KEY_RETURN && mask == MASK_NONE) { // switch to keyboard navigation mode - LLMenuGL::setKeyboardMode(TRUE); + LLMenuGL::setKeyboardMode(true); onCommit(); - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL LLMenuItemGL::handleMouseUp( S32 x, S32 y, MASK mask) +bool LLMenuItemGL::handleMouseUp( S32 x, S32 y, MASK mask) { // switch to mouse navigation mode - LLMenuGL::setKeyboardMode(FALSE); + LLMenuGL::setKeyboardMode(false); onCommit(); make_ui_sound("UISndClickRelease"); return LLView::handleMouseUp(x, y, mask); } -BOOL LLMenuItemGL::handleMouseDown( S32 x, S32 y, MASK mask) +bool LLMenuItemGL::handleMouseDown( S32 x, S32 y, MASK mask) { // switch to mouse navigation mode - LLMenuGL::setKeyboardMode(FALSE); + LLMenuGL::setKeyboardMode(false); - setHighlight(TRUE); + setHighlight(true); return LLView::handleMouseDown(x, y, mask); } -BOOL LLMenuItemGL::handleScrollWheel( S32 x, S32 y, S32 clicks ) +bool LLMenuItemGL::handleScrollWheel( S32 x, S32 y, S32 clicks ) { // If the menu is scrollable let it handle the wheel event. return !getMenu()->isScrollable(); @@ -521,19 +521,19 @@ void LLMenuItemGL::draw( void ) if( !mDrawBoolLabel.empty() ) { mFont->render( mDrawBoolLabel.getWString(), 0, (F32)LEFT_PAD_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f), color, - LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE ); + LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, false ); } mFont->render( mLabel.getWString(), 0, (F32)LEFT_PLAIN_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f), color, - LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE ); + LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, false ); if( !mDrawAccelLabel.empty() ) { mFont->render( mDrawAccelLabel.getWString(), 0, (F32)getRect().mRight - (F32)RIGHT_PLAIN_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f), color, - LLFontGL::RIGHT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE ); + LLFontGL::RIGHT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, false ); } if( !mDrawBranchLabel.empty() ) { mFont->render( mDrawBranchLabel.getWString(), 0, (F32)getRect().mRight - (F32)RIGHT_PAD_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f), color, - LLFontGL::RIGHT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE ); + LLFontGL::RIGHT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, false ); } } @@ -545,20 +545,20 @@ void LLMenuItemGL::draw( void ) std::string::size_type offset = upper_case_label.find(mJumpKey); if (offset != std::string::npos) { - S32 x_begin = LEFT_PLAIN_PIXELS + mFont->getWidth(mLabel, 0, offset); - S32 x_end = LEFT_PLAIN_PIXELS + mFont->getWidth(mLabel, 0, offset + 1); + S32 x_begin = LEFT_PLAIN_PIXELS + mFont->getWidth(mLabel, 0, static_cast<S32>(offset)); + S32 x_end = LEFT_PLAIN_PIXELS + mFont->getWidth(mLabel, 0, static_cast<S32>(offset) + 1); gl_line_2d(x_begin, (MENU_ITEM_PADDING / 2) + 1, x_end, (MENU_ITEM_PADDING / 2) + 1); } } } -BOOL LLMenuItemGL::setLabelArg( const std::string& key, const LLStringExplicit& text ) +bool LLMenuItemGL::setLabelArg( const std::string& key, const LLStringExplicit& text ) { mLabel.setArg(key, text); - return TRUE; + return true; } -void LLMenuItemGL::onVisibilityChange(BOOL new_visibility) +void LLMenuItemGL::onVisibilityChange(bool new_visibility) { if (getMenu()) { @@ -609,49 +609,49 @@ void LLMenuItemSeparatorGL::buildDrawLabel( void ) } } -BOOL LLMenuItemSeparatorGL::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLMenuItemSeparatorGL::handleMouseDown(S32 x, S32 y, MASK mask) { LLMenuGL* parent_menu = getMenu(); if (y > getRect().getHeight() / 2) { // the menu items are in the child list in bottom up order LLView* prev_menu_item = parent_menu->findNextSibling(this); - return (prev_menu_item && prev_menu_item->getVisible() && prev_menu_item->getEnabled()) ? prev_menu_item->handleMouseDown(x, prev_menu_item->getRect().getHeight(), mask) : FALSE; + return (prev_menu_item && prev_menu_item->getVisible() && prev_menu_item->getEnabled()) ? prev_menu_item->handleMouseDown(x, prev_menu_item->getRect().getHeight(), mask) : false; } else { LLView* next_menu_item = parent_menu->findPrevSibling(this); - return (next_menu_item && next_menu_item->getVisible() && next_menu_item->getEnabled()) ? next_menu_item->handleMouseDown(x, 0, mask) : FALSE; + return (next_menu_item && next_menu_item->getVisible() && next_menu_item->getEnabled()) ? next_menu_item->handleMouseDown(x, 0, mask) : false; } } -BOOL LLMenuItemSeparatorGL::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLMenuItemSeparatorGL::handleMouseUp(S32 x, S32 y, MASK mask) { LLMenuGL* parent_menu = getMenu(); if (y > getRect().getHeight() / 2) { LLView* prev_menu_item = parent_menu->findNextSibling(this); - return (prev_menu_item && prev_menu_item->getVisible() && prev_menu_item->getEnabled()) ? prev_menu_item->handleMouseUp(x, prev_menu_item->getRect().getHeight(), mask) : FALSE; + return (prev_menu_item && prev_menu_item->getVisible() && prev_menu_item->getEnabled()) ? prev_menu_item->handleMouseUp(x, prev_menu_item->getRect().getHeight(), mask) : false; } else { LLView* next_menu_item = parent_menu->findPrevSibling(this); - return (next_menu_item && next_menu_item->getVisible() && next_menu_item->getEnabled()) ? next_menu_item->handleMouseUp(x, 0, mask) : FALSE; + return (next_menu_item && next_menu_item->getVisible() && next_menu_item->getEnabled()) ? next_menu_item->handleMouseUp(x, 0, mask) : false; } } -BOOL LLMenuItemSeparatorGL::handleHover(S32 x, S32 y, MASK mask) +bool LLMenuItemSeparatorGL::handleHover(S32 x, S32 y, MASK mask) { LLMenuGL* parent_menu = getMenu(); if (y > getRect().getHeight() / 2) { - parent_menu->highlightPrevItem(this, FALSE); - return FALSE; + parent_menu->highlightPrevItem(this, false); + return false; } else { - parent_menu->highlightNextItem(this, FALSE); - return FALSE; + parent_menu->highlightNextItem(this, false); + return false; } } @@ -667,7 +667,7 @@ class LLMenuItemVerticalSeparatorGL public: LLMenuItemVerticalSeparatorGL( void ); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) { return FALSE; } + virtual bool handleMouseDown(S32 x, S32 y, MASK mask) { return false; } }; LLMenuItemVerticalSeparatorGL::LLMenuItemVerticalSeparatorGL( void ) @@ -739,12 +739,12 @@ void LLMenuItemTearOffGL::onCommit() { if (parent_floater) { - parent_floater->addDependentFloater(tear_off_menu, FALSE); + parent_floater->addDependentFloater(tear_off_menu, false); } // give focus to torn off menu because it will have // been taken away when parent menu closes - tear_off_menu->setFocus(TRUE); + tear_off_menu->setFocus(true); } } LLMenuItemGL::onCommit(); @@ -864,12 +864,12 @@ void LLMenuItemCallGL::buildDrawLabel( void ) LLMenuItemGL::buildDrawLabel(); } -BOOL LLMenuItemCallGL::handleKeyHere( KEY key, MASK mask ) +bool LLMenuItemCallGL::handleKeyHere( KEY key, MASK mask ) { return LLMenuItemGL::handleKeyHere(key, mask); } -BOOL LLMenuItemCallGL::handleAcceleratorKey( KEY key, MASK mask ) +bool LLMenuItemCallGL::handleAcceleratorKey( KEY key, MASK mask ) { if( (!gKeyboard->getKeyRepeated(key) || getAllowKeyRepeat()) && (key == mAcceleratorKey) && (mask == (mAcceleratorMask & MASK_NORMALKEYS)) ) { @@ -877,10 +877,10 @@ BOOL LLMenuItemCallGL::handleAcceleratorKey( KEY key, MASK mask ) if (getEnabled()) { onCommit(); - return TRUE; + return true; } } - return FALSE; + return false; } // handleRightMouseUp moved into base class LLMenuItemGL so clicks are @@ -972,7 +972,7 @@ LLMenuItemBranchGL::LLMenuItemBranchGL(const LLMenuItemBranchGL::Params& p) if (branch) { mBranchHandle = branch->getHandle(); - branch->setVisible(FALSE); + branch->setVisible(false); branch->setParentMenuItem(this); } } @@ -988,7 +988,7 @@ LLMenuItemBranchGL::~LLMenuItemBranchGL() // virtual -LLView* LLMenuItemBranchGL::getChildView(const std::string& name, BOOL recurse) const +LLView* LLMenuItemBranchGL::getChildView(const std::string& name, bool recurse) const { LLMenuGL* branch = getBranch(); if (branch) @@ -1005,7 +1005,7 @@ LLView* LLMenuItemBranchGL::getChildView(const std::string& name, BOOL recurse) return LLView::getChildView(name, recurse); } -LLView* LLMenuItemBranchGL::findChildView(const std::string& name, BOOL recurse) const +LLView* LLMenuItemBranchGL::findChildView(const std::string& name, bool recurse) const { LLMenuGL* branch = getBranch(); if (branch) @@ -1023,14 +1023,14 @@ LLView* LLMenuItemBranchGL::findChildView(const std::string& name, BOOL recurse) } // virtual -BOOL LLMenuItemBranchGL::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLMenuItemBranchGL::handleMouseUp(S32 x, S32 y, MASK mask) { // switch to mouse navigation mode - LLMenuGL::setKeyboardMode(FALSE); + LLMenuGL::setKeyboardMode(false); onCommit(); make_ui_sound("UISndClickRelease"); - return TRUE; + return true; } bool LLMenuItemBranchGL::hasAccelerator(const KEY &key, const MASK &mask) const @@ -1038,18 +1038,18 @@ bool LLMenuItemBranchGL::hasAccelerator(const KEY &key, const MASK &mask) const return getBranch() && getBranch()->hasAccelerator(key, mask); } -BOOL LLMenuItemBranchGL::handleAcceleratorKey(KEY key, MASK mask) +bool LLMenuItemBranchGL::handleAcceleratorKey(KEY key, MASK mask) { return getBranch() && getBranch()->handleAcceleratorKey(key, mask); } // This function checks to see if the accelerator key is already in use; // if not, it will be added to the list -BOOL LLMenuItemBranchGL::addToAcceleratorList(std::list<LLMenuKeyboardBinding*> *listp) +bool LLMenuItemBranchGL::addToAcceleratorList(std::list<LLMenuKeyboardBinding*> *listp) { LLMenuGL* branch = getBranch(); if (!branch) - return FALSE; + return false; U32 item_count = branch->getItemCount(); LLMenuItemGL *item; @@ -1062,7 +1062,7 @@ BOOL LLMenuItemBranchGL::addToAcceleratorList(std::list<LLMenuKeyboardBinding*> } } - return FALSE; + return false; } @@ -1090,9 +1090,9 @@ void LLMenuItemBranchGL::onCommit( void ) LLUICtrl::onCommit(); } -BOOL LLMenuItemBranchGL::handleKey(KEY key, MASK mask, BOOL called_from_parent) +bool LLMenuItemBranchGL::handleKey(KEY key, MASK mask, bool called_from_parent) { - BOOL handled = FALSE; + bool handled = false; if (getBranch() && called_from_parent) { handled = getBranch()->handleKey(key, mask, called_from_parent); @@ -1106,12 +1106,12 @@ BOOL LLMenuItemBranchGL::handleKey(KEY key, MASK mask, BOOL called_from_parent) return handled; } -BOOL LLMenuItemBranchGL::handleUnicodeChar(llwchar uni_char, BOOL called_from_parent) +bool LLMenuItemBranchGL::handleUnicodeChar(llwchar uni_char, bool called_from_parent) { - BOOL handled = FALSE; + bool handled = false; if (getBranch() && called_from_parent) { - handled = getBranch()->handleUnicodeChar(uni_char, TRUE); + handled = getBranch()->handleUnicodeChar(uni_char, true); } if (!handled) @@ -1123,7 +1123,7 @@ BOOL LLMenuItemBranchGL::handleUnicodeChar(llwchar uni_char, BOOL called_from_pa } -void LLMenuItemBranchGL::setHighlight( BOOL highlight ) +void LLMenuItemBranchGL::setHighlight( bool highlight ) { if (highlight == getHighlight()) return; @@ -1132,17 +1132,17 @@ void LLMenuItemBranchGL::setHighlight( BOOL highlight ) if (!branch) return; - BOOL auto_open = getEnabled() && (!branch->getVisible() || branch->getTornOff()); + bool auto_open = getEnabled() && (!branch->getVisible() || branch->getTornOff()); // torn off menus don't open sub menus on hover unless they have focus LLFloater * menu_parent = dynamic_cast<LLFloater *>(getMenu()->getParent()); if (getMenu()->getTornOff() && menu_parent && !menu_parent->hasFocus()) { - auto_open = FALSE; + auto_open = false; } // don't auto open torn off sub-menus (need to explicitly active menu item to give them focus) if (branch->getTornOff()) { - auto_open = FALSE; + auto_open = false; } LLMenuItemGL::setHighlight(highlight); if( highlight ) @@ -1159,13 +1159,13 @@ void LLMenuItemBranchGL::setHighlight( BOOL highlight ) LLFloater * branch_parent = dynamic_cast<LLFloater *>(branch->getParent()); if (branch_parent) { - branch_parent->setFocus(FALSE); + branch_parent->setFocus(false); } branch->clearHoverItem(); } else { - branch->setVisible( FALSE ); + branch->setVisible( false ); } } } @@ -1175,7 +1175,7 @@ void LLMenuItemBranchGL::draw() LLMenuItemGL::draw(); if (getBranch() && getBranch()->getVisible() && !getBranch()->getTornOff()) { - setHighlight(TRUE); + setHighlight(true); } } @@ -1188,16 +1188,16 @@ void LLMenuItemBranchGL::updateBranchParent(LLView* parentp) } } -void LLMenuItemBranchGL::onVisibilityChange( BOOL new_visibility ) +void LLMenuItemBranchGL::onVisibilityChange(bool new_visibility) { - if (new_visibility == FALSE && getBranch() && !getBranch()->getTornOff()) + if (!new_visibility && getBranch() && !getBranch()->getTornOff()) { - getBranch()->setVisible(FALSE); + getBranch()->setVisible(false); } LLMenuItemGL::onVisibilityChange(new_visibility); } -BOOL LLMenuItemBranchGL::handleKeyHere( KEY key, MASK mask ) +bool LLMenuItemBranchGL::handleKeyHere(KEY key, MASK mask) { LLMenuGL* branch = getBranch(); if (!branch) @@ -1212,15 +1212,15 @@ BOOL LLMenuItemBranchGL::handleKeyHere( KEY key, MASK mask ) if (branch->getVisible() && key == KEY_LEFT) { // switch to keyboard navigation mode - LLMenuGL::setKeyboardMode(TRUE); + LLMenuGL::setKeyboardMode(true); - BOOL handled = branch->clearHoverItem(); + bool handled = branch->clearHoverItem(); if (branch->getTornOff()) { LLFloater * branch_parent = dynamic_cast<LLFloater *>(branch->getParent()); if (branch_parent) { - branch_parent->setFocus(FALSE); + branch_parent->setFocus(false); } } if (handled && getMenu()->getTornOff()) @@ -1228,7 +1228,7 @@ BOOL LLMenuItemBranchGL::handleKeyHere( KEY key, MASK mask ) LLFloater * menu_parent = dynamic_cast<LLFloater *>(getMenu()->getParent()); if (menu_parent) { - menu_parent->setFocus(TRUE); + menu_parent->setFocus(true); } } return handled; @@ -1237,12 +1237,12 @@ BOOL LLMenuItemBranchGL::handleKeyHere( KEY key, MASK mask ) if (key == KEY_RIGHT && !branch->getHighlightedItem()) { // switch to keyboard navigation mode - LLMenuGL::setKeyboardMode(TRUE); + LLMenuGL::setKeyboardMode(true); LLMenuItemGL* itemp = branch->highlightNextItem(NULL); if (itemp) { - return TRUE; + return true; } } } @@ -1250,13 +1250,13 @@ BOOL LLMenuItemBranchGL::handleKeyHere( KEY key, MASK mask ) } //virtual -BOOL LLMenuItemBranchGL::isActive() const +bool LLMenuItemBranchGL::isActive() const { return isOpen() && getBranch() && getBranch()->getHighlightedItem(); } //virtual -BOOL LLMenuItemBranchGL::isOpen() const +bool LLMenuItemBranchGL::isOpen() const { return getBranch() && getBranch()->isOpen(); } @@ -1327,7 +1327,7 @@ void LLMenuItemBranchGL::openMenu() } branch->translate( delta_x, delta_y ); - branch->setVisible( TRUE ); + branch->setVisible( true ); branch->getParent()->sendChildToFront(branch); dirtyRect(); @@ -1362,20 +1362,20 @@ public: // set the hover status (called by it's menu) and if the object is // active. This is used for behavior transfer. - virtual void setHighlight( BOOL highlight ); + virtual void setHighlight( bool highlight ); - virtual BOOL isActive( void ) const; + virtual bool isActive( void ) const; // LLView functionality - virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ); - virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask ); + virtual bool handleMouseDown( S32 x, S32 y, MASK mask ); + virtual bool handleMouseUp( S32 x, S32 y, MASK mask ); virtual void draw( void ); - virtual BOOL handleKeyHere(KEY key, MASK mask); + virtual bool handleKeyHere(KEY key, MASK mask); - virtual BOOL handleAcceleratorKey(KEY key, MASK mask); + virtual bool handleAcceleratorKey(KEY key, MASK mask); virtual void onFocusLost(); - virtual void setFocus(BOOL b); + virtual void setFocus(bool b); }; LLMenuItemBranchDownGL::LLMenuItemBranchDownGL( const Params& p) : @@ -1407,7 +1407,7 @@ void LLMenuItemBranchDownGL::openMenu( void ) LLMenuGL* branch = getBranch(); if( branch->getVisible() && !branch->getTornOff() ) { - branch->setVisible( FALSE ); + branch->setVisible( false ); } else { @@ -1448,15 +1448,15 @@ void LLMenuItemBranchDownGL::openMenu( void ) } branch->translate( delta_x, 0 ); - setHighlight(TRUE); - branch->setVisible( TRUE ); + setHighlight(true); + branch->setVisible( true ); branch->getParent()->sendChildToFront(branch); } } } // set the hover status (called by it's menu) -void LLMenuItemBranchDownGL::setHighlight( BOOL highlight ) +void LLMenuItemBranchDownGL::setHighlight( bool highlight ) { if (highlight == getHighlight()) return; @@ -1475,18 +1475,18 @@ void LLMenuItemBranchDownGL::setHighlight( BOOL highlight ) LLFloater * branch_parent = dynamic_cast<LLFloater *>(branch->getParent()); if (branch_parent) { - branch_parent->setFocus(FALSE); + branch_parent->setFocus(false); } branch->clearHoverItem(); } else { - branch->setVisible( FALSE ); + branch->setVisible( false ); } } } -BOOL LLMenuItemBranchDownGL::isActive() const +bool LLMenuItemBranchDownGL::isActive() const { // for top level menus, being open is sufficient to be considered // active, because clicking on them with the mouse will open @@ -1494,10 +1494,10 @@ BOOL LLMenuItemBranchDownGL::isActive() const return isOpen(); } -BOOL LLMenuItemBranchDownGL::handleMouseDown( S32 x, S32 y, MASK mask ) +bool LLMenuItemBranchDownGL::handleMouseDown( S32 x, S32 y, MASK mask ) { // switch to mouse control mode - LLMenuGL::setKeyboardMode(FALSE); + LLMenuGL::setKeyboardMode(false); if (getVisible() && isOpen()) { @@ -1509,19 +1509,19 @@ BOOL LLMenuItemBranchDownGL::handleMouseDown( S32 x, S32 y, MASK mask ) } make_ui_sound("UISndClick"); - return TRUE; + return true; } -BOOL LLMenuItemBranchDownGL::handleMouseUp( S32 x, S32 y, MASK mask ) +bool LLMenuItemBranchDownGL::handleMouseUp( S32 x, S32 y, MASK mask ) { - return TRUE; + return true; } -BOOL LLMenuItemBranchDownGL::handleAcceleratorKey(KEY key, MASK mask) +bool LLMenuItemBranchDownGL::handleAcceleratorKey(KEY key, MASK mask) { - BOOL branch_visible = getBranch()->getVisible(); - BOOL handled = getBranch()->handleAcceleratorKey(key, mask); + bool branch_visible = getBranch()->getVisible(); + bool handled = getBranch()->handleAcceleratorKey(key, mask); if (handled && !branch_visible && isInVisibleChain()) { // flash this menu entry because we triggered an invisible menu item @@ -1534,11 +1534,11 @@ void LLMenuItemBranchDownGL::onFocusLost() { // needed for tab-based selection LLMenuItemBranchGL::onFocusLost(); - LLMenuGL::setKeyboardMode(FALSE); - setHighlight(FALSE); + LLMenuGL::setKeyboardMode(false); + setHighlight(false); } -void LLMenuItemBranchDownGL::setFocus(BOOL b) +void LLMenuItemBranchDownGL::setFocus(bool b) { // needed for tab-based selection LLMenuItemBranchGL::setFocus(b); @@ -1546,16 +1546,16 @@ void LLMenuItemBranchDownGL::setFocus(BOOL b) setHighlight(b); } -BOOL LLMenuItemBranchDownGL::handleKeyHere(KEY key, MASK mask) +bool LLMenuItemBranchDownGL::handleKeyHere(KEY key, MASK mask) { - BOOL menu_open = getBranch()->getVisible(); + bool menu_open = getBranch()->getVisible(); // don't do keyboard navigation of top-level menus unless in keyboard mode, or menu expanded if (getHighlight() && getMenu()->isOpen() && (isActive() || LLMenuGL::getKeyboardMode())) { if (key == KEY_LEFT) { // switch to keyboard navigation mode - LLMenuGL::setKeyboardMode(TRUE); + LLMenuGL::setKeyboardMode(true); LLMenuItemGL* itemp = getMenu()->highlightPrevItem(this); // open new menu only if previous menu was open @@ -1564,12 +1564,12 @@ BOOL LLMenuItemBranchDownGL::handleKeyHere(KEY key, MASK mask) itemp->onCommit(); } - return TRUE; + return true; } else if (key == KEY_RIGHT) { // switch to keyboard navigation mode - LLMenuGL::setKeyboardMode(TRUE); + LLMenuGL::setKeyboardMode(true); LLMenuItemGL* itemp = getMenu()->highlightNextItem(this); // open new menu only if previous menu was open @@ -1578,35 +1578,35 @@ BOOL LLMenuItemBranchDownGL::handleKeyHere(KEY key, MASK mask) itemp->onCommit(); } - return TRUE; + return true; } else if (key == KEY_DOWN) { // switch to keyboard navigation mode - LLMenuGL::setKeyboardMode(TRUE); + LLMenuGL::setKeyboardMode(true); if (!isActive()) { onCommit(); } getBranch()->highlightNextItem(NULL); - return TRUE; + return true; } else if (key == KEY_UP) { // switch to keyboard navigation mode - LLMenuGL::setKeyboardMode(TRUE); + LLMenuGL::setKeyboardMode(true); if (!isActive()) { onCommit(); } getBranch()->highlightPrevItem(NULL); - return TRUE; + return true; } } - return FALSE; + return false; } void LLMenuItemBranchDownGL::draw( void ) @@ -1614,7 +1614,7 @@ void LLMenuItemBranchDownGL::draw( void ) //FIXME: try removing this if (getBranch()->getVisible() && !getBranch()->getTornOff()) { - setHighlight(TRUE); + setHighlight(true); } if( getHighlight() ) @@ -1649,8 +1649,8 @@ void LLMenuItemBranchDownGL::draw( void ) if (offset != std::string::npos) { S32 x_offset = ll_round((F32)getRect().getWidth() / 2.f - getFont()->getWidthF32(mLabel.getString(), 0, S32_MAX) / 2.f); - S32 x_begin = x_offset + getFont()->getWidth(mLabel, 0, offset); - S32 x_end = x_offset + getFont()->getWidth(mLabel, 0, offset + 1); + S32 x_begin = x_offset + getFont()->getWidth(mLabel, 0, static_cast<S32>(offset)); + S32 x_end = x_offset + getFont()->getWidth(mLabel, 0, static_cast<S32>(offset) + 1); gl_line_2d(x_begin, LABEL_BOTTOM_PAD_PIXELS, x_end, LABEL_BOTTOM_PAD_PIXELS); } } @@ -1686,8 +1686,8 @@ protected: public: /*virtual*/ void draw(); - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent); - /*virtual*/ void setEnabled(BOOL enabled); + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent); + /*virtual*/ void setEnabled(bool enabled); virtual void onCommit( void ); private: @@ -1737,14 +1737,14 @@ void LLMenuScrollItem::draw() } /*virtual*/ -void LLMenuScrollItem::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLMenuScrollItem::reshape(S32 width, S32 height, bool called_from_parent) { mArrowBtn->reshape(width, height, called_from_parent); LLView::reshape(width, height, called_from_parent); } /*virtual*/ -void LLMenuScrollItem::setEnabled(BOOL enabled) +void LLMenuScrollItem::setEnabled(bool enabled) { mArrowBtn->setEnabled(enabled); LLView::setEnabled(enabled); @@ -1766,7 +1766,7 @@ LLMenuGL::LLMenuGL(const LLMenuGL::Params& p) mDropShadowed( p.drop_shadow ), mHasSelection(false), mHorizontalLayout( p.horizontal_layout ), - mScrollable(mHorizontalLayout ? FALSE : p.scrollable), // Scrolling is supported only for vertical layout + mScrollable(mHorizontalLayout ? false : p.scrollable), // Scrolling is supported only for vertical layout mMaxScrollableItems(p.max_scrollable_items), mPreferredWidth(p.preferred_width), mKeepFixedSize( p.keep_fixed_size ), @@ -1775,7 +1775,7 @@ LLMenuGL::LLMenuGL(const LLMenuGL::Params& p) mLastMouseY(0), mMouseVelX(0), mMouseVelY(0), - mTornOff(FALSE), + mTornOff(false), mTearOffItem(NULL), mSpilloverBranch(NULL), mFirstVisibleItem(NULL), @@ -1784,8 +1784,8 @@ LLMenuGL::LLMenuGL(const LLMenuGL::Params& p) mSpilloverMenu(NULL), mJumpKey(p.jump_key), mCreateJumpKeys(p.create_jump_keys), - mNeedsArrange(FALSE), - mAlwaysShowMenu(FALSE), + mNeedsArrange(false), + mAlwaysShowMenu(false), mResetScrollPositionOnShow(true), mShortcutPad(p.shortcut_pad), mFont(p.font) @@ -1826,7 +1826,7 @@ LLMenuGL::~LLMenuGL( void ) mJumpKeys.clear(); } -void LLMenuGL::setCanTearOff(BOOL tear_off) +void LLMenuGL::setCanTearOff(bool tear_off) { if (tear_off && mTearOffItem == NULL) { @@ -1916,7 +1916,7 @@ void LLMenuGL::removeChild( LLView* ctrl) return LLUICtrl::removeChild(ctrl); } -BOOL LLMenuGL::postBuild() +bool LLMenuGL::postBuild() { createJumpKeys(); return LLUICtrl::postBuild(); @@ -1924,10 +1924,10 @@ BOOL LLMenuGL::postBuild() // are we the childmost active menu and hence our jump keys should be enabled? // or are we a free-standing torn-off menu (which uses jump keys too) -BOOL LLMenuGL::jumpKeysActive() +bool LLMenuGL::jumpKeysActive() { LLMenuItemGL* highlighted_item = getHighlightedItem(); - BOOL active = getVisible() && getEnabled(); + bool active = getVisible() && getEnabled(); if (active) { @@ -1953,7 +1953,7 @@ BOOL LLMenuGL::jumpKeysActive() return active; } -BOOL LLMenuGL::isOpen() +bool LLMenuGL::isOpen() { if (getTornOff()) { @@ -1962,7 +1962,7 @@ BOOL LLMenuGL::isOpen() // the open menu chain even if we don't have focus if (itemp && itemp->isOpen()) { - return TRUE; + return true; } // otherwise we are only active if we have keyboard focus LLFloater * parent = dynamic_cast<LLFloater *>(getParent()); @@ -1970,7 +1970,7 @@ BOOL LLMenuGL::isOpen() { return parent->hasFocus(); } - return FALSE; + return false; } else { @@ -2068,7 +2068,7 @@ bool LLMenuGL::scrollItems(EScrollingDirection direction) // Otherwise viewer will hang for a time needed to scroll U32_MAX // times in std::advance(). STORM-659. size_t nitems = mItems.size(); - U32 scrollable_items = nitems < mMaxScrollableItems ? nitems : mMaxScrollableItems; + U32 scrollable_items = nitems < mMaxScrollableItems ? static_cast<U32>(nitems) : mMaxScrollableItems; // Advance by mMaxScrollableItems back from the end of the list // to make the last item visible. @@ -2080,7 +2080,7 @@ bool LLMenuGL::scrollItems(EScrollingDirection direction) LL_WARNS() << "Unknown scrolling direction: " << direction << LL_ENDL; } - mNeedsArrange = TRUE; + mNeedsArrange = true; arrangeAndClear(); return true; @@ -2337,11 +2337,11 @@ void LLMenuGL::arrange( void ) LLRect rect; mArrowUpItem->setRect(rect.setLeftTopAndSize( 0, cur_height, width, mArrowUpItem->getNominalHeight())); - mArrowUpItem->setVisible(TRUE); + mArrowUpItem->setVisible(true); mArrowUpItem->setEnabled(height_before_first_visible_item > MENU_ITEM_PADDING); mArrowUpItem->reshape(width, mArrowUpItem->getNominalHeight()); mArrowDownItem->setRect(rect.setLeftTopAndSize( 0, mArrowDownItem->getNominalHeight(), width, mArrowDownItem->getNominalHeight())); - mArrowDownItem->setVisible(TRUE); + mArrowDownItem->setVisible(true); mArrowDownItem->setEnabled(height_before_first_visible_item + visible_items_height < (S32)height); mArrowDownItem->reshape(width, mArrowDownItem->getNominalHeight()); @@ -2353,11 +2353,11 @@ void LLMenuGL::arrange( void ) { if (NULL != mArrowUpItem) { - mArrowUpItem->setVisible(FALSE); + mArrowUpItem->setVisible(false); } if (NULL != mArrowDownItem) { - mArrowDownItem->setVisible(FALSE); + mArrowDownItem->setVisible(false); } } @@ -2420,7 +2420,7 @@ void LLMenuGL::arrangeAndClear( void ) if (mNeedsArrange) { arrange(); - mNeedsArrange = FALSE; + mNeedsArrange = false; } } @@ -2482,7 +2482,7 @@ void LLMenuGL::cleanupSpilloverBranch() void LLMenuGL::createJumpKeys() { if (!mCreateJumpKeys) return; - mCreateJumpKeys = FALSE; + mCreateJumpKeys = false; mJumpKeys.clear(); @@ -2547,7 +2547,7 @@ void LLMenuGL::createJumpKeys() tokenizer tokens(uppercase_label, sep); tokenizer::iterator token_iter; - BOOL found_key = FALSE; + bool found_key = false; for( token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter) { std::string uppercase_word = *token_iter; @@ -2565,7 +2565,7 @@ void LLMenuGL::createJumpKeys() { mJumpKeys.insert(std::pair<KEY, LLMenuItemGL*>(jump_key, (*item_it))); (*item_it)->setJumpKey(jump_key); - found_key = TRUE; + found_key = true; break; } } @@ -2594,7 +2594,7 @@ void LLMenuGL::empty( void ) // erase group of items from menu void LLMenuGL::erase( S32 begin, S32 end, bool arrange/* = true*/) { - S32 items = mItems.size(); + auto items = mItems.size(); if ( items == 0 || begin >= end || begin < 0 || end > items ) { @@ -2648,7 +2648,7 @@ void LLMenuGL::setLeftAndBottom(S32 left, S32 bottom) needsArrange(); } -BOOL LLMenuGL::handleJumpKey(KEY key) +bool LLMenuGL::handleJumpKey(KEY key) { // must perform case-insensitive comparison, so just switch to uppercase input key key = toupper(key); @@ -2656,31 +2656,31 @@ BOOL LLMenuGL::handleJumpKey(KEY key) if(found_it != mJumpKeys.end() && found_it->second->getEnabled()) { // switch to keyboard navigation mode - LLMenuGL::setKeyboardMode(TRUE); + LLMenuGL::setKeyboardMode(true); // force highlight to close old menus and open and sub-menus - found_it->second->setHighlight(TRUE); + found_it->second->setHighlight(true); found_it->second->onCommit(); } // if we are navigating the menus, we need to eat the keystroke // so rest of UI doesn't handle it - return TRUE; + return true; } // Add the menu item to this menu. -BOOL LLMenuGL::append( LLMenuItemGL* item ) +bool LLMenuGL::append( LLMenuItemGL* item ) { - if (!item) return FALSE; + if (!item) return false; mItems.push_back( item ); LLUICtrl::addChild(item); needsArrange(); - return TRUE; + return true; } // add a separator to this menu -BOOL LLMenuGL::addSeparator() +bool LLMenuGL::addSeparator() { LLMenuItemSeparatorGL::Params p; LLMenuItemGL* separator = LLUICtrlFactory::create<LLMenuItemSeparatorGL>(p); @@ -2688,14 +2688,14 @@ BOOL LLMenuGL::addSeparator() } // add a menu - this will create a cascading menu -BOOL LLMenuGL::appendMenu( LLMenuGL* menu ) +bool LLMenuGL::appendMenu( LLMenuGL* menu ) { if( menu == this ) { LL_ERRS() << "** Attempt to attach menu to itself. This is certainly " << "a logic error." << LL_ENDL; } - BOOL success = TRUE; + bool success = true; LLMenuItemBranchGL::Params p; p.name = menu->getName(); @@ -2717,7 +2717,7 @@ BOOL LLMenuGL::appendMenu( LLMenuGL* menu ) } // add a context menu branch -BOOL LLMenuGL::appendContextSubMenu(LLMenuGL *menu) +bool LLMenuGL::appendContextSubMenu(LLMenuGL *menu) { if (menu == this) { @@ -2740,7 +2740,7 @@ BOOL LLMenuGL::appendContextSubMenu(LLMenuGL *menu) return append( item ); } -void LLMenuGL::setEnabledSubMenus(BOOL enable) +void LLMenuGL::setEnabledSubMenus(bool enable) { setEnabled(enable); item_list_t::iterator item_iter; @@ -2751,8 +2751,8 @@ void LLMenuGL::setEnabledSubMenus(BOOL enable) } // setItemEnabled() - pass the label and the enable flag for a menu -// item. TRUE will make sure it's enabled, FALSE will disable it. -void LLMenuGL::setItemEnabled( const std::string& name, BOOL enable ) +// item. true will make sure it's enabled, false will disable it. +void LLMenuGL::setItemEnabled( const std::string& name, bool enable ) { item_list_t::iterator item_iter; for (item_iter = mItems.begin(); item_iter != mItems.end(); ++item_iter) @@ -2766,7 +2766,7 @@ void LLMenuGL::setItemEnabled( const std::string& name, BOOL enable ) } } -void LLMenuGL::setItemVisible( const std::string& name, BOOL visible ) +void LLMenuGL::setItemVisible( const std::string& name, bool visible ) { item_list_t::iterator item_iter; for (item_iter = mItems.begin(); item_iter != mItems.end(); ++item_iter) @@ -2801,19 +2801,19 @@ void LLMenuGL::setItemLastSelected(LLMenuItemGL* item) } // Set whether drop shadowed -void LLMenuGL::setDropShadowed( const BOOL shadowed ) +void LLMenuGL::setDropShadowed( const bool shadowed ) { mDropShadowed = shadowed; } -void LLMenuGL::setTornOff(BOOL torn_off) +void LLMenuGL::setTornOff(bool torn_off) { mTornOff = torn_off; } U32 LLMenuGL::getItemCount() { - return mItems.size(); + return static_cast<U32>(mItems.size()); } LLMenuItemGL* LLMenuGL::getItem(S32 number) @@ -2859,7 +2859,7 @@ LLMenuItemGL* LLMenuGL::getHighlightedItem() return NULL; } -LLMenuItemGL* LLMenuGL::highlightNextItem(LLMenuItemGL* cur_item, BOOL skip_disabled) +LLMenuItemGL* LLMenuGL::highlightNextItem(LLMenuItemGL* cur_item, bool skip_disabled) { if (mItems.empty()) return NULL; // highlighting first item on a torn off menu is the @@ -2869,7 +2869,7 @@ LLMenuItemGL* LLMenuGL::highlightNextItem(LLMenuItemGL* cur_item, BOOL skip_disa LLFloater * parent = dynamic_cast<LLFloater *>(getParent()); if (parent) { - parent->setFocus(TRUE); + parent->setFocus(true); } } @@ -2938,9 +2938,9 @@ LLMenuItemGL* LLMenuGL::highlightNextItem(LLMenuItemGL* cur_item, BOOL skip_disa { if (cur_item) { - cur_item->setHighlight(FALSE); + cur_item->setHighlight(false); } - (*next_item_iter)->setHighlight(TRUE); + (*next_item_iter)->setHighlight(true); return (*next_item_iter); } @@ -2964,7 +2964,7 @@ LLMenuItemGL* LLMenuGL::highlightNextItem(LLMenuItemGL* cur_item, BOOL skip_disa return NULL; } -LLMenuItemGL* LLMenuGL::highlightPrevItem(LLMenuItemGL* cur_item, BOOL skip_disabled) +LLMenuItemGL* LLMenuGL::highlightPrevItem(LLMenuItemGL* cur_item, bool skip_disabled) { if (mItems.empty()) return NULL; @@ -2975,7 +2975,7 @@ LLMenuItemGL* LLMenuGL::highlightPrevItem(LLMenuItemGL* cur_item, BOOL skip_disa LLFloater * parent = dynamic_cast<LLFloater *>(getParent()); if (parent) { - parent->setFocus(TRUE); + parent->setFocus(true); } } @@ -3030,7 +3030,7 @@ LLMenuItemGL* LLMenuGL::highlightPrevItem(LLMenuItemGL* cur_item, BOOL skip_disa // skip separators and disabled/invisible items if ((*prev_item_iter)->getEnabled() && (*prev_item_iter)->getVisible() && (*prev_item_iter)->getName() != SEPARATOR_NAME) { - (*prev_item_iter)->setHighlight(TRUE); + (*prev_item_iter)->setHighlight(true); return (*prev_item_iter); } @@ -3101,12 +3101,12 @@ bool LLMenuGL::hasAccelerator(const KEY &key, const MASK &mask) const return false; } -BOOL LLMenuGL::handleAcceleratorKey(KEY key, MASK mask) +bool LLMenuGL::handleAcceleratorKey(KEY key, MASK mask) { // don't handle if not enabled if(!getEnabled()) { - return FALSE; + return false; } // Pass down even if not visible @@ -3116,26 +3116,26 @@ BOOL LLMenuGL::handleAcceleratorKey(KEY key, MASK mask) LLMenuItemGL* itemp = *item_iter; if (itemp->handleAcceleratorKey(key, mask)) { - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL LLMenuGL::handleUnicodeCharHere( llwchar uni_char ) +bool LLMenuGL::handleUnicodeCharHere( llwchar uni_char ) { if (jumpKeysActive()) { return handleJumpKey((KEY)uni_char); } - return FALSE; + return false; } -BOOL LLMenuGL::handleHover( S32 x, S32 y, MASK mask ) +bool LLMenuGL::handleHover( S32 x, S32 y, MASK mask ) { // leave submenu in place if slope of mouse < MAX_MOUSE_SLOPE_SUB_MENU - BOOL no_mouse_data = mLastMouseX == 0 && mLastMouseY == 0; + bool no_mouse_data = mLastMouseX == 0 && mLastMouseY == 0; S32 mouse_delta_x = no_mouse_data ? 0 : x - mLastMouseX; S32 mouse_delta_y = no_mouse_data ? 0 : y - mLastMouseY; LLVector2 mouse_dir((F32)mouse_delta_x, (F32)mouse_delta_y); @@ -3166,7 +3166,7 @@ BOOL LLMenuGL::handleHover( S32 x, S32 y, MASK mask ) // moving mouse always highlights new item if (mouse_delta_x != 0 || mouse_delta_y != 0) { - ((LLMenuItemGL*)viewp)->setHighlight(FALSE); + ((LLMenuItemGL*)viewp)->setHighlight(false); } } } @@ -3188,8 +3188,8 @@ BOOL LLMenuGL::handleHover( S32 x, S32 y, MASK mask ) // moving mouse always highlights new item if (mouse_delta_x != 0 || mouse_delta_y != 0) { - ((LLMenuItemGL*)viewp)->setHighlight(TRUE); - LLMenuGL::setKeyboardMode(FALSE); + ((LLMenuItemGL*)viewp)->setHighlight(true); + LLMenuGL::setKeyboardMode(false); } mHasSelection = true; } @@ -3202,10 +3202,10 @@ BOOL LLMenuGL::handleHover( S32 x, S32 y, MASK mask ) // drop-down menu is shown. Otherwise any other view won't be able to handle mouse events // until the user chooses one of the drop-down menu items. - return TRUE; + return true; } -BOOL LLMenuGL::handleScrollWheel( S32 x, S32 y, S32 clicks ) +bool LLMenuGL::handleScrollWheel( S32 x, S32 y, S32 clicks ) { if (!mScrollable) return blockMouseEvent(x, y); @@ -3221,7 +3221,7 @@ BOOL LLMenuGL::handleScrollWheel( S32 x, S32 y, S32 clicks ) scrollItems(SD_UP); } - return TRUE; + return true; } @@ -3230,7 +3230,7 @@ void LLMenuGL::draw( void ) if (mNeedsArrange) { arrange(); - mNeedsArrange = FALSE; + mNeedsArrange = false; } if (mDropShadowed && !mTornOff) { @@ -3254,7 +3254,7 @@ void LLMenuGL::drawBackground(LLMenuItemGL* itemp, F32 alpha) gl_rect_2d( 0, item_rect.getHeight(), item_rect.getWidth(), 0); } -void LLMenuGL::setVisible(BOOL visible) +void LLMenuGL::setVisible(bool visible) { if (visible != getVisible()) { @@ -3277,7 +3277,7 @@ void LLMenuGL::setVisible(BOOL visible) } } -LLMenuGL* LLMenuGL::findChildMenuByName(const std::string& name, BOOL recurse) const +LLMenuGL* LLMenuGL::findChildMenuByName(const std::string& name, bool recurse) const { LLView* view = findChildView(name, recurse); if (view) @@ -3298,23 +3298,23 @@ LLMenuGL* LLMenuGL::findChildMenuByName(const std::string& name, BOOL recurse) c return NULL; } -BOOL LLMenuGL::clearHoverItem() +bool LLMenuGL::clearHoverItem() { for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) { LLMenuItemGL* itemp = (LLMenuItemGL*)*child_it; if (itemp->getHighlight()) { - itemp->setHighlight(FALSE); - return TRUE; + itemp->setHighlight(false); + return true; } } - return FALSE; + return false; } void hide_top_view( LLView* view ) { - if( view ) view->setVisible( FALSE ); + if( view ) view->setVisible( false ); } @@ -3331,12 +3331,12 @@ void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y, S3 return; } - menu->setVisible( TRUE ); + menu->setVisible( true ); if(!menu->getAlwaysShowMenu()) { //Do not show menu if all menu items are disabled - BOOL item_enabled = false; + bool item_enabled = false; for (LLView::child_list_t::const_iterator itor = menu->getChildList()->begin(); itor != menu->getChildList()->end(); ++itor) @@ -3347,7 +3347,7 @@ void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y, S3 if(!item_enabled) { - menu->setVisible( FALSE ); + menu->setVisible( false ); return; } } @@ -3412,7 +3412,7 @@ static LLDefaultChildRegistry::Register<LLMenuBarGL> r2("menu_bar"); LLMenuBarGL::LLMenuBarGL( const Params& p ) : LLMenuGL(p), - mAltKeyTrigger(FALSE) + mAltKeyTrigger(false) {} // Default destructor @@ -3422,19 +3422,19 @@ LLMenuBarGL::~LLMenuBarGL() mAccelerators.clear(); } -BOOL LLMenuBarGL::handleAcceleratorKey(KEY key, MASK mask) +bool LLMenuBarGL::handleAcceleratorKey(KEY key, MASK mask) { if (getHighlightedItem() && mask == MASK_NONE) { // unmodified key accelerators are ignored when navigating menu // (but are used as jump keys so will still work when appropriate menu is up) - return FALSE; + return false; } - BOOL result = LLMenuGL::handleAcceleratorKey(key, mask); + bool result = LLMenuGL::handleAcceleratorKey(key, mask); if (result && mask & MASK_ALT) { // ALT key used to trigger hotkey, don't use as shortcut to open menu - mAltKeyTrigger = FALSE; + mAltKeyTrigger = false; } if(!result @@ -3445,16 +3445,16 @@ BOOL LLMenuBarGL::handleAcceleratorKey(KEY key, MASK mask) if (getHighlightedItem()) { clearHoverItem(); - LLMenuGL::setKeyboardMode(FALSE); + LLMenuGL::setKeyboardMode(false); } else { // close menus originating from other menu bars when first opening menu via keyboard LLMenuGL::sMenuContainer->hideMenus(); highlightNextItem(NULL); - LLMenuGL::setKeyboardMode(TRUE); + LLMenuGL::setKeyboardMode(true); } - return TRUE; + return true; } if (result && !getHighlightedItem() && LLMenuGL::sMenuContainer->hasVisibleMenu()) @@ -3466,22 +3466,22 @@ BOOL LLMenuBarGL::handleAcceleratorKey(KEY key, MASK mask) return result; } -BOOL LLMenuBarGL::handleKeyHere(KEY key, MASK mask) +bool LLMenuBarGL::handleKeyHere(KEY key, MASK mask) { static LLUICachedControl<bool> use_altkey_for_menus ("UseAltKeyForMenus", 0); if(key == KEY_ALT && !gKeyboard->getKeyRepeated(key) && use_altkey_for_menus) { - mAltKeyTrigger = TRUE; + mAltKeyTrigger = true; } else // if any key other than ALT hit, clear out waiting for Alt key mode { - mAltKeyTrigger = FALSE; + mAltKeyTrigger = false; } if (key == KEY_ESCAPE && mask == MASK_NONE) { - LLMenuGL::setKeyboardMode(FALSE); - // if any menus are visible, this will return TRUE, stopping further processing of ESCAPE key + LLMenuGL::setKeyboardMode(false); + // if any menus are visible, this will return true, stopping further processing of ESCAPE key return LLMenuGL::sMenuContainer->hideMenus(); } @@ -3491,7 +3491,7 @@ BOOL LLMenuBarGL::handleKeyHere(KEY key, MASK mask) return LLMenuGL::handleKeyHere(key, mask); } -BOOL LLMenuBarGL::handleJumpKey(KEY key) +bool LLMenuBarGL::handleJumpKey(KEY key) { // perform case-insensitive comparison key = toupper(key); @@ -3499,15 +3499,15 @@ BOOL LLMenuBarGL::handleJumpKey(KEY key) if(found_it != mJumpKeys.end() && found_it->second->getEnabled()) { // switch to keyboard navigation mode - LLMenuGL::setKeyboardMode(TRUE); + LLMenuGL::setKeyboardMode(true); - found_it->second->setHighlight(TRUE); + found_it->second->setHighlight(true); found_it->second->onCommit(); } - return TRUE; + return true; } -BOOL LLMenuBarGL::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLMenuBarGL::handleMouseDown(S32 x, S32 y, MASK mask) { // clicks on menu bar closes existing menus from other contexts but leave // own menu open so that we get toggle behavior @@ -3519,7 +3519,7 @@ BOOL LLMenuBarGL::handleMouseDown(S32 x, S32 y, MASK mask) return LLMenuGL::handleMouseDown(x, y, mask); } -BOOL LLMenuBarGL::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLMenuBarGL::handleDoubleClick(S32 x, S32 y, MASK mask) { return LLMenuGL::handleMouseDown(x, y, mask); } @@ -3563,14 +3563,14 @@ void LLMenuBarGL::checkMenuTrigger() LLMenuGL::sMenuContainer->hideMenus(); highlightNextItem(NULL); - LLMenuGL::setKeyboardMode(TRUE); + LLMenuGL::setKeyboardMode(true); } } - mAltKeyTrigger = FALSE; + mAltKeyTrigger = false; } } -BOOL LLMenuBarGL::jumpKeysActive() +bool LLMenuBarGL::jumpKeysActive() { // require user to be in keyboard navigation mode to activate key triggers // as menu bars are always visible and it is easy to leave the mouse cursor over them @@ -3619,14 +3619,14 @@ S32 LLMenuBarGL::getRightmostMenuEdge() } // add a vertical separator to this menu -BOOL LLMenuBarGL::addSeparator() +bool LLMenuBarGL::addSeparator() { LLMenuItemGL* separator = new LLMenuItemVerticalSeparatorGL(); return append( separator ); } // add a menu - this will create a drop down menu. -BOOL LLMenuBarGL::appendMenu( LLMenuGL* menu ) +bool LLMenuBarGL::appendMenu( LLMenuGL* menu ) { if( menu == this ) { @@ -3634,7 +3634,7 @@ BOOL LLMenuBarGL::appendMenu( LLMenuGL* menu ) << "a logic error." << LL_ENDL; } - BOOL success = TRUE; + bool success = true; // *TODO: Hack! Fix this LLMenuItemBranchDownGL::Params p; @@ -3657,12 +3657,12 @@ BOOL LLMenuBarGL::appendMenu( LLMenuGL* menu ) return success; } -BOOL LLMenuBarGL::handleHover( S32 x, S32 y, MASK mask ) +bool LLMenuBarGL::handleHover( S32 x, S32 y, MASK mask ) { - BOOL handled = FALSE; + bool handled = false; LLView* active_menu = NULL; - BOOL no_mouse_data = mLastMouseX == 0 && mLastMouseY == 0; + bool no_mouse_data = mLastMouseX == 0 && mLastMouseY == 0; S32 mouse_delta_x = no_mouse_data ? 0 : x - mLastMouseX; S32 mouse_delta_y = no_mouse_data ? 0 : y - mLastMouseY; mMouseVelX = (mMouseVelX / 2) + (mouse_delta_x / 2); @@ -3695,14 +3695,14 @@ BOOL LLMenuBarGL::handleHover( S32 x, S32 y, MASK mask ) viewp->pointInView(local_x, local_y) && viewp->handleHover(local_x, local_y, mask)) { - ((LLMenuItemGL*)viewp)->setHighlight(TRUE); - handled = TRUE; + ((LLMenuItemGL*)viewp)->setHighlight(true); + handled = true; if (active_menu && active_menu != viewp) { ((LLMenuItemGL*)viewp)->onCommit(); - LLMenuGL::setKeyboardMode(FALSE); + LLMenuGL::setKeyboardMode(false); } - LLMenuGL::setKeyboardMode(FALSE); + LLMenuGL::setKeyboardMode(false); } } @@ -3716,7 +3716,7 @@ BOOL LLMenuBarGL::handleHover( S32 x, S32 y, MASK mask ) S32 local_y = y - viewp->getRect().mBottom; if (!viewp->pointInView(local_x, local_y) && ((LLMenuItemGL*)viewp)->getHighlight()) { - ((LLMenuItemGL*)viewp)->setHighlight(FALSE); + ((LLMenuItemGL*)viewp)->setHighlight(false); } } } @@ -3724,7 +3724,7 @@ BOOL LLMenuBarGL::handleHover( S32 x, S32 y, MASK mask ) getWindow()->setCursor(UI_CURSOR_ARROW); - return TRUE; + return true; } ///============================================================================ @@ -3736,7 +3736,7 @@ LLMenuHolderGL::LLMenuHolderGL(const LLMenuHolderGL::Params& p) : LLPanel(p) { sItemActivationTimer.stop(); - mCanHide = TRUE; + mCanHide = true; } void LLMenuHolderGL::draw() @@ -3764,9 +3764,9 @@ void LLMenuHolderGL::draw() } } -BOOL LLMenuHolderGL::handleMouseDown( S32 x, S32 y, MASK mask ) +bool LLMenuHolderGL::handleMouseDown( S32 x, S32 y, MASK mask ) { - BOOL handled = LLView::childrenHandleMouseDown(x, y, mask) != NULL; + bool handled = LLView::childrenHandleMouseDown(x, y, mask) != NULL; if (!handled) { LLMenuGL* visible_menu = (LLMenuGL*)getVisibleMenu(); @@ -3791,9 +3791,9 @@ BOOL LLMenuHolderGL::handleMouseDown( S32 x, S32 y, MASK mask ) return handled; } -BOOL LLMenuHolderGL::handleRightMouseDown( S32 x, S32 y, MASK mask ) +bool LLMenuHolderGL::handleRightMouseDown( S32 x, S32 y, MASK mask ) { - BOOL handled = LLView::childrenHandleRightMouseDown(x, y, mask) != NULL; + bool handled = LLView::childrenHandleRightMouseDown(x, y, mask) != NULL; if (!handled) { // clicked off of menu, hide them all @@ -3804,7 +3804,7 @@ BOOL LLMenuHolderGL::handleRightMouseDown( S32 x, S32 y, MASK mask ) // This occurs when you mouse-down to spawn a context menu, hold the button // down, move off the menu, then mouse-up. We want this to close the menu. -BOOL LLMenuHolderGL::handleRightMouseUp( S32 x, S32 y, MASK mask ) +bool LLMenuHolderGL::handleRightMouseUp( S32 x, S32 y, MASK mask ) { const S32 SLOP = 2; S32 spawn_dx = (x - sContextMenuSpawnPos.mX); @@ -3816,10 +3816,10 @@ BOOL LLMenuHolderGL::handleRightMouseUp( S32 x, S32 y, MASK mask ) // so interpret the mouse-up as a single-click to show and leave on // screen sContextMenuSpawnPos.set(S32_MAX, S32_MAX); - return TRUE; + return true; } - BOOL handled = LLView::childrenHandleRightMouseUp(x, y, mask) != NULL; + bool handled = LLView::childrenHandleRightMouseUp(x, y, mask) != NULL; if (!handled) { // clicked off of menu, hide them all @@ -3828,9 +3828,9 @@ BOOL LLMenuHolderGL::handleRightMouseUp( S32 x, S32 y, MASK mask ) return handled; } -BOOL LLMenuHolderGL::handleKey(KEY key, MASK mask, BOOL called_from_parent) +bool LLMenuHolderGL::handleKey(KEY key, MASK mask, bool called_from_parent) { - BOOL handled = false; + bool handled = false; LLMenuGL* const pMenu = dynamic_cast<LLMenuGL*>(getVisibleMenu()); if (pMenu) @@ -3838,7 +3838,7 @@ BOOL LLMenuHolderGL::handleKey(KEY key, MASK mask, BOOL called_from_parent) //eat TAB key - EXT-7000 if (key == KEY_TAB && mask == MASK_NONE) { - return TRUE; + return true; } //handle ESCAPE and RETURN key @@ -3847,7 +3847,7 @@ BOOL LLMenuHolderGL::handleKey(KEY key, MASK mask, BOOL called_from_parent) { if (pMenu->getHighlightedItem()) { - handled = pMenu->handleKey(key, mask, TRUE); + handled = pMenu->handleKey(key, mask, true); } else if (mask == MASK_NONE || (key >= KEY_LEFT && key <= KEY_DOWN)) { @@ -3864,7 +3864,7 @@ BOOL LLMenuHolderGL::handleKey(KEY key, MASK mask, BOOL called_from_parent) } -void LLMenuHolderGL::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLMenuHolderGL::reshape(S32 width, S32 height, bool called_from_parent) { if (width != getRect().getWidth() || height != getRect().getHeight()) { @@ -3887,14 +3887,14 @@ LLView* const LLMenuHolderGL::getVisibleMenu() const } -BOOL LLMenuHolderGL::hideMenus() +bool LLMenuHolderGL::hideMenus() { if (!mCanHide) { - return FALSE; + return false; } - LLMenuGL::setKeyboardMode(FALSE); - BOOL menu_visible = hasVisibleMenu(); + LLMenuGL::setKeyboardMode(false); + bool menu_visible = hasVisibleMenu(); if (menu_visible) { // clicked off of menu, hide them all @@ -3903,7 +3903,7 @@ BOOL LLMenuHolderGL::hideMenus() LLView* viewp = *child_it; if (dynamic_cast<LLMenuGL*>(viewp) != NULL && viewp->getVisible()) { - viewp->setVisible(FALSE); + viewp->setVisible(false); } } } @@ -3932,9 +3932,9 @@ LLTearOffMenu::LLTearOffMenu(LLMenuGL* menup) : setName(menup->getName()); setTitle(menup->getLabel()); - setCanMinimize(FALSE); + setCanMinimize(false); // flag menu as being torn off - menup->setTornOff(TRUE); + menup->setTornOff(true); // update menu layout as torn off menu (no spillover menus) menup->needsArrange(); @@ -3949,12 +3949,12 @@ LLTearOffMenu::LLTearOffMenu(LLMenuGL* menup) : menup->setFollows( FOLLOWS_LEFT | FOLLOWS_BOTTOM ); mOldParent = menup->getParent(); addChild(menup); - menup->setVisible(TRUE); + menup->setVisible(true); LLRect menu_rect = menup->getRect(); menu_rect.setOriginAndSize( 1, 1, menu_rect.getWidth(), menu_rect.getHeight()); menup->setRect(menu_rect); - menup->setDropShadowed(FALSE); + menup->setDropShadowed(false); mMenu = menup; @@ -4002,7 +4002,7 @@ void LLTearOffMenu::onFocusReceived() { if (parent_menu_item->getMenu()->getVisible()) { - parent_menu_item->setHighlight(TRUE); + parent_menu_item->setHighlight(true); parent_menu_item = parent_menu_item->getMenu()->getParentMenuItem(); } else @@ -4020,29 +4020,29 @@ void LLTearOffMenu::onFocusLost() LLFloater::onFocusLost(); } -BOOL LLTearOffMenu::handleUnicodeChar(llwchar uni_char, BOOL called_from_parent) +bool LLTearOffMenu::handleUnicodeChar(llwchar uni_char, bool called_from_parent) { // pass keystrokes down to menu - return mMenu->handleUnicodeChar(uni_char, TRUE); + return mMenu->handleUnicodeChar(uni_char, true); } -BOOL LLTearOffMenu::handleKeyHere(KEY key, MASK mask) +bool LLTearOffMenu::handleKeyHere(KEY key, MASK mask) { if (!mMenu->getHighlightedItem()) { if (key == KEY_UP) { mMenu->highlightPrevItem(NULL); - return TRUE; + return true; } else if (key == KEY_DOWN) { mMenu->highlightNextItem(NULL); - return TRUE; + return true; } } // pass keystrokes down to menu - return mMenu->handleKey(key, mask, TRUE); + return mMenu->handleKey(key, mask, true); } void LLTearOffMenu::translate(S32 x, S32 y) @@ -4060,7 +4060,7 @@ LLTearOffMenu* LLTearOffMenu::create(LLMenuGL* menup) { LLTearOffMenu* tearoffp = new LLTearOffMenu(menup); // keep onscreen - gFloaterView->adjustToFitScreen(tearoffp, FALSE); + gFloaterView->adjustToFitScreen(tearoffp, false); tearoffp->openFloater(LLSD()); return tearoffp; @@ -4097,10 +4097,10 @@ void LLTearOffMenu::closeTearOff() mOldParent->addChild(mMenu); mMenu->clearHoverItem(); mMenu->setFollowsNone(); - mMenu->setBackgroundVisible(TRUE); - mMenu->setVisible(FALSE); - mMenu->setTornOff(FALSE); - mMenu->setDropShadowed(TRUE); + mMenu->setBackgroundVisible(true); + mMenu->setVisible(false); + mMenu->setTornOff(false); + mMenu->setDropShadowed(true); mQuitRequested = true; } @@ -4134,19 +4134,19 @@ void LLContextMenuBranch::buildDrawLabel( void ) // enabled, this item is enabled. JC U32 sub_count = menu->getItemCount(); U32 i; - BOOL any_enabled = FALSE; + bool any_enabled = false; for (i = 0; i < sub_count; i++) { LLMenuItemGL* item = menu->getItem(i); item->buildDrawLabel(); if (item->getEnabled() && !item->getDrawTextDisabled() ) { - any_enabled = TRUE; + any_enabled = true; break; } } setDrawTextDisabled(!any_enabled); - setEnabled(TRUE); + setEnabled(true); } mDrawAccelLabel.clear(); @@ -4179,7 +4179,7 @@ void LLContextMenuBranch::onCommit( void ) showSubMenu(); } -void LLContextMenuBranch::setHighlight( BOOL highlight ) +void LLContextMenuBranch::setHighlight( bool highlight ) { if (highlight == getHighlight()) return; LLMenuItemGL::setHighlight(highlight); @@ -4209,13 +4209,13 @@ static MenuRegistry::Register<LLContextMenu> context_menu_register2("context_men LLContextMenu::LLContextMenu(const Params& p) : LLMenuGL(p), - mHoveredAnyItem(FALSE), + mHoveredAnyItem(false), mHoverItem(NULL) { - //setBackgroundVisible(TRUE); + //setBackgroundVisible(true); } -void LLContextMenu::setVisible(BOOL visible) +void LLContextMenu::setVisible(bool visible) { if (!visible) hide(); @@ -4284,53 +4284,53 @@ void LLContextMenu::show(S32 x, S32 y, LLView* spawning_view) { mSpawningViewHandle.markDead(); } - LLView::setVisible(TRUE); + LLView::setVisible(true); } void LLContextMenu::hide() { if (!getVisible()) return; - LLView::setVisible(FALSE); + LLView::setVisible(false); if (mHoverItem) { - mHoverItem->setHighlight( FALSE ); + mHoverItem->setHighlight( false ); } mHoverItem = NULL; } -BOOL LLContextMenu::handleHover( S32 x, S32 y, MASK mask ) +bool LLContextMenu::handleHover( S32 x, S32 y, MASK mask ) { LLMenuGL::handleHover(x,y,mask); - BOOL handled = FALSE; + bool handled = false; LLMenuItemGL *item = getHighlightedItem(); if (item && item->getEnabled()) { getWindow()->setCursor(UI_CURSOR_ARROW); - handled = TRUE; + handled = true; if (item != mHoverItem) { if (mHoverItem) { - mHoverItem->setHighlight( FALSE ); + mHoverItem->setHighlight( false ); } mHoverItem = item; - mHoverItem->setHighlight( TRUE ); + mHoverItem->setHighlight( true ); } - mHoveredAnyItem = TRUE; + mHoveredAnyItem = true; } else { // clear out our selection if (mHoverItem) { - mHoverItem->setHighlight(FALSE); + mHoverItem->setHighlight(false); mHoverItem = NULL; } } @@ -4338,7 +4338,7 @@ BOOL LLContextMenu::handleHover( S32 x, S32 y, MASK mask ) if( !handled && pointInView( x, y ) ) { getWindow()->setCursor(UI_CURSOR_ARROW); - handled = TRUE; + handled = true; } return handled; @@ -4347,9 +4347,9 @@ BOOL LLContextMenu::handleHover( S32 x, S32 y, MASK mask ) // handleMouseDown and handleMouseUp are handled by LLMenuGL -BOOL LLContextMenu::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLContextMenu::handleRightMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; // The click was somewhere within our rectangle LLMenuItemGL *item = getHighlightedItem(); @@ -4357,13 +4357,13 @@ BOOL LLContextMenu::handleRightMouseDown(S32 x, S32 y, MASK mask) S32 local_x = x - getRect().mLeft; S32 local_y = y - getRect().mBottom; - BOOL clicked_in_menu = pointInView(local_x, local_y) ; + bool clicked_in_menu = pointInView(local_x, local_y) ; // grab mouse if right clicking anywhere within pie (even deadzone in middle), to detect drag outside of pie if (clicked_in_menu) { // capture mouse cursor as if on initial menu show - handled = TRUE; + handled = true; } if (item) @@ -4372,14 +4372,14 @@ BOOL LLContextMenu::handleRightMouseDown(S32 x, S32 y, MASK mask) // to make sure it's within the item's rectangle if (item->handleMouseDown( 0, 0, mask )) { - handled = TRUE; + handled = true; } } return handled; } -BOOL LLContextMenu::handleRightMouseUp( S32 x, S32 y, MASK mask ) +bool LLContextMenu::handleRightMouseUp( S32 x, S32 y, MASK mask ) { S32 local_x = x - getRect().mLeft; S32 local_y = y - getRect().mBottom; @@ -4387,12 +4387,12 @@ BOOL LLContextMenu::handleRightMouseUp( S32 x, S32 y, MASK mask ) if (!mHoveredAnyItem && !pointInView(local_x, local_y)) { sMenuContainer->hideMenus(); - return TRUE; + return true; } - BOOL result = handleMouseUp( x, y, mask ); - mHoveredAnyItem = FALSE; + bool result = handleMouseUp( x, y, mask ); + mHoveredAnyItem = false; return result; } diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index 72e041672a..51766afe85 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -89,17 +89,17 @@ protected: friend class LLUICtrlFactory; public: // LLView overrides - /*virtual*/ void onVisibilityChange(BOOL new_visibility); - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ void onVisibilityChange(bool new_visibility); + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleRightMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleRightMouseUp(S32 x, S32 y, MASK mask); // LLUICtrl overrides /*virtual*/ void setValue(const LLSD& value); /*virtual*/ LLSD getValue() const; virtual bool hasAccelerator(const KEY &key, const MASK &mask) const; - virtual BOOL handleAcceleratorKey(KEY key, MASK mask); + virtual bool handleAcceleratorKey(KEY key, MASK mask); LLColor4 getHighlightBgColor() { return mHighlightBackground.get(); } @@ -114,17 +114,17 @@ public: virtual U32 getNominalHeight( void ) const; // Marks item as not needing space for check marks or accelerator keys - virtual void setBriefItem(BOOL brief); - virtual BOOL isBriefItem() const; + virtual void setBriefItem(bool brief); + virtual bool isBriefItem() const; - virtual BOOL addToAcceleratorList(std::list<LLMenuKeyboardBinding*> *listp); - void setAllowKeyRepeat(BOOL allow) { mAllowKeyRepeat = allow; } - BOOL getAllowKeyRepeat() const { return mAllowKeyRepeat; } + virtual bool addToAcceleratorList(std::list<LLMenuKeyboardBinding*> *listp); + void setAllowKeyRepeat(bool allow) { mAllowKeyRepeat = allow; } + bool getAllowKeyRepeat() const { return mAllowKeyRepeat; } // change the label void setLabel( const LLStringExplicit& label ) { mLabel = label; } std::string getLabel( void ) const { return mLabel.getString(); } - virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); + virtual bool setLabelArg( const std::string& key, const LLStringExplicit& text ); // Get the parent menu for this item virtual class LLMenuGL* getMenu() const; @@ -150,35 +150,35 @@ public: virtual void onCommit( void ); - virtual void setHighlight( BOOL highlight ); - virtual BOOL getHighlight() const { return mHighlight; } + virtual void setHighlight( bool highlight ); + virtual bool getHighlight() const { return mHighlight; } // determine if this represents an active sub-menu - virtual BOOL isActive( void ) const { return FALSE; } + virtual bool isActive( void ) const { return false; } // determine if this represents an open sub-menu - virtual BOOL isOpen( void ) const { return FALSE; } + virtual bool isOpen( void ) const { return false; } - virtual void setEnabledSubMenus(BOOL enable){}; + virtual void setEnabledSubMenus(bool enable){}; // LLView Functionality - virtual BOOL handleKeyHere( KEY key, MASK mask ); - virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ); - virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask ); - virtual BOOL handleScrollWheel( S32 x, S32 y, S32 clicks ); + virtual bool handleKeyHere( KEY key, MASK mask ); + virtual bool handleMouseDown( S32 x, S32 y, MASK mask ); + virtual bool handleMouseUp( S32 x, S32 y, MASK mask ); + virtual bool handleScrollWheel( S32 x, S32 y, S32 clicks ); virtual void onMouseEnter(S32 x, S32 y, MASK mask); virtual void onMouseLeave(S32 x, S32 y, MASK mask); virtual void draw( void ); - BOOL getHover() const { return mGotHover; } + bool getHover() const { return mGotHover; } - void setDrawTextDisabled(BOOL disabled) { mDrawTextDisabled = disabled; } - BOOL getDrawTextDisabled() const { return mDrawTextDisabled; } + void setDrawTextDisabled(bool disabled) { mDrawTextDisabled = disabled; } + bool getDrawTextDisabled() const { return mDrawTextDisabled; } protected: - void setHover(BOOL hover) { mGotHover = hover; } + void setHover(bool hover) { mGotHover = hover; } // This function appends the character string representation of // the current accelerator key and mask to the provided string. @@ -207,19 +207,19 @@ protected: LLUIColor mHighlightBackground; LLUIColor mHighlightForeground; - BOOL mHighlight; + bool mHighlight; private: // Keyboard and mouse variables - BOOL mAllowKeyRepeat; - BOOL mGotHover; + bool mAllowKeyRepeat; + bool mGotHover; // If true, suppress normal space for check marks on the left and accelerator // keys on the right. - BOOL mBriefItem; + bool mBriefItem; // Font for this item const LLFontGL* mFont; - BOOL mDrawTextDisabled; + bool mDrawTextDisabled; KEY mJumpKey; }; @@ -241,9 +241,9 @@ public: LLMenuItemSeparatorGL(const LLMenuItemSeparatorGL::Params& p = LLMenuItemSeparatorGL::Params()); /*virtual*/ void draw( void ); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); virtual void buildDrawLabel(); @@ -288,8 +288,8 @@ public: virtual void onCommit( void ); - virtual BOOL handleAcceleratorKey(KEY key, MASK mask); - virtual BOOL handleKeyHere(KEY key, MASK mask); + virtual bool handleAcceleratorKey(KEY key, MASK mask); + virtual bool handleKeyHere(KEY key, MASK mask); //virtual void draw(); @@ -442,23 +442,23 @@ public: void parseChildXML(LLXMLNodePtr child, LLView* parent); // LLView Functionality - /*virtual*/ BOOL handleUnicodeCharHere( llwchar uni_char ); - /*virtual*/ BOOL handleHover( S32 x, S32 y, MASK mask ); - /*virtual*/ BOOL handleScrollWheel( S32 x, S32 y, S32 clicks ); + /*virtual*/ bool handleUnicodeCharHere( llwchar uni_char ); + /*virtual*/ bool handleHover( S32 x, S32 y, MASK mask ); + /*virtual*/ bool handleScrollWheel( S32 x, S32 y, S32 clicks ); /*virtual*/ void draw( void ); /*virtual*/ void drawBackground(LLMenuItemGL* itemp, F32 alpha); - /*virtual*/ void setVisible(BOOL visible); + /*virtual*/ void setVisible(bool visible); /*virtual*/ bool addChild(LLView* view, S32 tab_group = 0); /*virtual*/ void deleteAllChildren(); /*virtual*/ void removeChild( LLView* ctrl); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); virtual bool hasAccelerator(const KEY &key, const MASK &mask) const; - virtual BOOL handleAcceleratorKey(KEY key, MASK mask); + virtual bool handleAcceleratorKey(KEY key, MASK mask); - LLMenuGL* findChildMenuByName(const std::string& name, BOOL recurse) const; + LLMenuGL* findChildMenuByName(const std::string& name, bool recurse) const; - BOOL clearHoverItem(); + bool clearHoverItem(); // return the name label const std::string& getLabel( void ) const { return mLabel.getString(); } @@ -467,37 +467,37 @@ public: // background colors void setBackgroundColor( const LLUIColor& color ) { mBackgroundColor = color; } const LLUIColor& getBackgroundColor() const { return mBackgroundColor; } - void setBackgroundVisible( BOOL b ) { mBgVisible = b; } - void setCanTearOff(BOOL tear_off); + void setBackgroundVisible( bool b ) { mBgVisible = b; } + void setCanTearOff(bool tear_off); // add a separator to this menu - virtual BOOL addSeparator(); + virtual bool addSeparator(); // for branching menu items, bring sub menus up to root level of menu hierarchy virtual void updateParent( LLView* parentp ); // setItemEnabled() - pass the name and the enable flag for a - // menu item. TRUE will make sure it's enabled, FALSE will disable + // menu item. true will make sure it's enabled, false will disable // it. - void setItemEnabled( const std::string& name, BOOL enable ); + void setItemEnabled( const std::string& name, bool enable ); // propagate message to submenus - void setEnabledSubMenus(BOOL enable); + void setEnabledSubMenus(bool enable); - void setItemVisible( const std::string& name, BOOL visible); + void setItemVisible( const std::string& name, bool visible); void setItemLabel(const std::string &name, const std::string &label); // sets the left,bottom corner of menu, useful for popups void setLeftAndBottom(S32 left, S32 bottom); - virtual BOOL handleJumpKey(KEY key); + virtual bool handleJumpKey(KEY key); - virtual BOOL jumpKeysActive(); + virtual bool jumpKeysActive(); - virtual BOOL isOpen(); + virtual bool isOpen(); - void needsArrange() { mNeedsArrange = TRUE; } + void needsArrange() { mNeedsArrange = true; } // Shape this menu to fit the current state of the children, and // adjust the child rects to fit. This is called automatically // when you add items. *FIX: We may need to deal with visibility @@ -520,8 +520,8 @@ public: LLMenuItemGL* getItem(std::string name); LLMenuItemGL* getHighlightedItem(); - LLMenuItemGL* highlightNextItem(LLMenuItemGL* cur_item, BOOL skip_disabled = TRUE); - LLMenuItemGL* highlightPrevItem(LLMenuItemGL* cur_item, BOOL skip_disabled = TRUE); + LLMenuItemGL* highlightNextItem(LLMenuItemGL* cur_item, bool skip_disabled = true); + LLMenuItemGL* highlightPrevItem(LLMenuItemGL* cur_item, bool skip_disabled = true); void buildDrawLabels(); void createJumpKeys(); @@ -530,37 +530,37 @@ public: static void showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y, S32 mouse_x = 0, S32 mouse_y = 0); // Whether to drop shadow menu bar - void setDropShadowed( const BOOL shadowed ); + void setDropShadowed( const bool shadowed ); void setParentMenuItem( LLMenuItemGL* parent_menu_item ) { mParentMenuItem = parent_menu_item->getHandle(); } LLMenuItemGL* getParentMenuItem() const { return dynamic_cast<LLMenuItemGL*>(mParentMenuItem.get()); } - void setTornOff(BOOL torn_off); - BOOL getTornOff() { return mTornOff; } + void setTornOff(bool torn_off); + bool getTornOff() { return mTornOff; } - BOOL getCanTearOff() { return mTearOffItem != NULL; } + bool getCanTearOff() { return mTearOffItem != NULL; } KEY getJumpKey() const { return mJumpKey; } void setJumpKey(KEY key) { mJumpKey = key; } - static void setKeyboardMode(BOOL mode) { sKeyboardMode = mode; } - static BOOL getKeyboardMode() { return sKeyboardMode; } + static void setKeyboardMode(bool mode) { sKeyboardMode = mode; } + static bool getKeyboardMode() { return sKeyboardMode; } S32 getShortcutPad() { return mShortcutPad; } bool scrollItems(EScrollingDirection direction); - BOOL isScrollable() const { return mScrollable; } + bool isScrollable() const { return mScrollable; } static class LLMenuHolderGL* sMenuContainer; void resetScrollPositionOnShow(bool reset_scroll_pos) { mResetScrollPositionOnShow = reset_scroll_pos; } bool isScrollPositionOnShowReset() { return mResetScrollPositionOnShow; } - void setAlwaysShowMenu(BOOL show) { mAlwaysShowMenu = show; } - BOOL getAlwaysShowMenu() { return mAlwaysShowMenu; } + void setAlwaysShowMenu(bool show) { mAlwaysShowMenu = show; } + bool getAlwaysShowMenu() { return mAlwaysShowMenu; } // add a context menu branch - BOOL appendContextSubMenu(LLMenuGL *menu); + bool appendContextSubMenu(LLMenuGL *menu); const LLFontGL *getFont() const { return mFont; } @@ -568,10 +568,10 @@ public: void createSpilloverBranch(); void cleanupSpilloverBranch(); // Add the menu item to this menu. - virtual BOOL append( LLMenuItemGL* item ); + virtual bool append( LLMenuItemGL* item ); // add a menu - this will create a cascading menu - virtual BOOL appendMenu( LLMenuGL* menu ); + virtual bool appendMenu( LLMenuGL* menu ); // Used in LLContextMenu and in LLTogleableMenu // to add an item of context menu branch @@ -591,10 +591,10 @@ public: S32 mMouseVelY; U32 mMaxScrollableItems; U32 mPreferredWidth; - BOOL mHorizontalLayout; - BOOL mScrollable; - BOOL mKeepFixedSize; - BOOL mNeedsArrange; + bool mHorizontalLayout; + bool mScrollable; + bool mKeepFixedSize; + bool mNeedsArrange; // Font for top menu items only const LLFontGL* mFont; @@ -603,24 +603,24 @@ private: static LLColor4 sDefaultBackgroundColor; - static BOOL sKeyboardMode; + static bool sKeyboardMode; - BOOL mAlwaysShowMenu; + bool mAlwaysShowMenu; LLUIColor mBackgroundColor; - BOOL mBgVisible; + bool mBgVisible; LLHandle<LLView> mParentMenuItem; LLUIString mLabel; - BOOL mDropShadowed; // Whether to drop shadow + bool mDropShadowed; // Whether to drop shadow bool mHasSelection; LLFrameTimer mFadeTimer; LLTimer mScrollItemsTimer; - BOOL mTornOff; + bool mTornOff; class LLMenuItemTearOffGL* mTearOffItem; class LLMenuItemBranchGL* mSpilloverBranch; LLMenuGL* mSpilloverMenu; KEY mJumpKey; - BOOL mCreateJumpKeys; + bool mCreateJumpKeys; S32 mShortcutPad; bool mResetScrollPositionOnShow; }; // end class LLMenuGL @@ -648,47 +648,47 @@ protected: public: virtual ~LLMenuItemBranchGL(); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); virtual bool hasAccelerator(const KEY &key, const MASK &mask) const; - virtual BOOL handleAcceleratorKey(KEY key, MASK mask); + virtual bool handleAcceleratorKey(KEY key, MASK mask); // check if we've used these accelerators already - virtual BOOL addToAcceleratorList(std::list <LLMenuKeyboardBinding*> *listp); + virtual bool addToAcceleratorList(std::list <LLMenuKeyboardBinding*> *listp); // called to rebuild the draw label virtual void buildDrawLabel( void ); virtual void onCommit( void ); - virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); - virtual BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent); + virtual bool handleKey(KEY key, MASK mask, bool called_from_parent); + virtual bool handleUnicodeChar(llwchar uni_char, bool called_from_parent); // set the hover status (called by it's menu) and if the object is // active. This is used for behavior transfer. - virtual void setHighlight( BOOL highlight ); + virtual void setHighlight( bool highlight ); - virtual BOOL handleKeyHere(KEY key, MASK mask); + virtual bool handleKeyHere(KEY key, MASK mask); - virtual BOOL isActive() const; + virtual bool isActive() const; - virtual BOOL isOpen() const; + virtual bool isOpen() const; LLMenuGL* getBranch() const { return (LLMenuGL*)mBranchHandle.get(); } virtual void updateBranchParent( LLView* parentp ); // LLView Functionality - virtual void onVisibilityChange( BOOL curVisibilityIn ); + virtual void onVisibilityChange( bool curVisibilityIn ); virtual void draw(); - virtual void setEnabledSubMenus(BOOL enabled) { if (getBranch()) getBranch()->setEnabledSubMenus(enabled); } + virtual void setEnabledSubMenus(bool enabled) { if (getBranch()) getBranch()->setEnabledSubMenus(enabled); } virtual void openMenu(); - virtual LLView* getChildView(const std::string& name, BOOL recurse = TRUE) const; - virtual LLView* findChildView(const std::string& name, BOOL recurse = TRUE) const; + virtual LLView* getChildView(const std::string& name, bool recurse = true) const; + virtual LLView* findChildView(const std::string& name, bool recurse = true) const; private: LLHandle<LLView> mBranchHandle; @@ -721,14 +721,14 @@ public: // LLView Functionality // can't set visibility directly, must call show or hide - virtual void setVisible (BOOL visible); + virtual void setVisible (bool visible); virtual void show (S32 x, S32 y, LLView* spawning_view = NULL); virtual void hide (); - virtual BOOL handleHover ( S32 x, S32 y, MASK mask ); - virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); - virtual BOOL handleRightMouseUp ( S32 x, S32 y, MASK mask ); + virtual bool handleHover ( S32 x, S32 y, MASK mask ); + virtual bool handleRightMouseDown( S32 x, S32 y, MASK mask ); + virtual bool handleRightMouseUp ( S32 x, S32 y, MASK mask ); virtual bool addChild (LLView* view, S32 tab_group = 0); @@ -738,7 +738,7 @@ public: void setSpawningView(LLHandle<LLView> spawning_view) { mSpawningViewHandle = spawning_view; } protected: - BOOL mHoveredAnyItem; + bool mHoveredAnyItem; LLMenuItemGL* mHoverItem; LLRootHandle<LLContextMenu> mHandle; LLHandle<LLView> mSpawningViewHandle; @@ -767,7 +767,7 @@ public: virtual void onCommit( void ); LLContextMenu* getBranch() { return mBranch.get(); } - void setHighlight( BOOL highlight ); + void setHighlight( bool highlight ); protected: void showSubMenu(); @@ -790,29 +790,29 @@ public: LLMenuBarGL( const Params& p ); virtual ~LLMenuBarGL(); - /*virtual*/ BOOL handleAcceleratorKey(KEY key, MASK mask); - /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); - /*virtual*/ BOOL handleJumpKey(KEY key); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleAcceleratorKey(KEY key, MASK mask); + /*virtual*/ bool handleKeyHere(KEY key, MASK mask); + /*virtual*/ bool handleJumpKey(KEY key); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleDoubleClick(S32 x, S32 y, MASK mask); /*virtual*/ void draw(); - /*virtual*/ BOOL jumpKeysActive(); + /*virtual*/ bool jumpKeysActive(); // add a vertical separator to this menu - virtual BOOL addSeparator(); + virtual bool addSeparator(); // LLView Functionality - virtual BOOL handleHover( S32 x, S32 y, MASK mask ); + virtual bool handleHover( S32 x, S32 y, MASK mask ); // Returns x position of rightmost child, usually Help menu S32 getRightmostMenuEdge(); - void resetMenuTrigger() { mAltKeyTrigger = FALSE; } + void resetMenuTrigger() { mAltKeyTrigger = false; } private: // add a menu - this will create a drop down menu. - virtual BOOL appendMenu( LLMenuGL* menu ); + virtual bool appendMenu( LLMenuGL* menu ); // rearrange the child rects so they fit the shape of the menu // bar. virtual void arrange( void ); @@ -820,7 +820,7 @@ private: void checkMenuTrigger(); std::list <LLMenuKeyboardBinding*> mAccelerators; - BOOL mAltKeyTrigger; + bool mAltKeyTrigger; }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -836,22 +836,22 @@ public: LLMenuHolderGL(const Params& p); virtual ~LLMenuHolderGL() {} - virtual BOOL hideMenus(); - void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); - void setCanHide(BOOL can_hide) { mCanHide = can_hide; } + virtual bool hideMenus(); + void reshape(S32 width, S32 height, bool called_from_parent = true); + void setCanHide(bool can_hide) { mCanHide = can_hide; } // LLView functionality virtual void draw(); - virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ); - virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); + virtual bool handleMouseDown( S32 x, S32 y, MASK mask ); + virtual bool handleRightMouseDown( S32 x, S32 y, MASK mask ); // Close context menus on right mouse up not handled by menus. - /*virtual*/ BOOL handleRightMouseUp( S32 x, S32 y, MASK mask ); + /*virtual*/ bool handleRightMouseUp( S32 x, S32 y, MASK mask ); - virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); + virtual bool handleKey(KEY key, MASK mask, bool called_from_parent); virtual const LLRect getMenuRect() const { return getLocalRect(); } LLView*const getVisibleMenu() const; - virtual BOOL hasVisibleMenu() const {return getVisibleMenu() != NULL;} + virtual bool hasVisibleMenu() const {return getVisibleMenu() != NULL;} static void setActivatedItem(LLMenuItemGL* item); @@ -863,7 +863,7 @@ private: static LLHandle<LLView> sItemLastSelectedHandle; static LLFrameTimer sItemActivationTimer; - BOOL mCanHide; + bool mCanHide; }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -881,8 +881,8 @@ public: virtual void draw(void); virtual void onFocusReceived(); virtual void onFocusLost(); - virtual BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent); - virtual BOOL handleKeyHere(KEY key, MASK mask); + virtual bool handleUnicodeChar(llwchar uni_char, bool called_from_parent); + virtual bool handleKeyHere(KEY key, MASK mask); virtual void translate(S32 x, S32 y); void updateSize(); diff --git a/indra/llui/llmodaldialog.cpp b/indra/llui/llmodaldialog.cpp index eac43900f6..c5c31f7252 100644 --- a/indra/llui/llmodaldialog.cpp +++ b/indra/llui/llmodaldialog.cpp @@ -38,18 +38,18 @@ // static std::list<LLModalDialog*> LLModalDialog::sModalStack; -LLModalDialog::LLModalDialog( const LLSD& key, BOOL modal ) +LLModalDialog::LLModalDialog( const LLSD& key, bool modal ) : LLFloater(key), mModal( modal ) { if (modal) { - setCanMinimize(FALSE); - setCanClose(FALSE); + setCanMinimize(false); + setCanClose(false); } - setVisible( FALSE ); - setBackgroundVisible(TRUE); - setBackgroundOpaque(TRUE); + setVisible( false ); + setBackgroundVisible(true); + setBackgroundOpaque(true); centerOnScreen(); // default position mCloseSignal.connect(boost::bind(&LLModalDialog::stopModal, this)); } @@ -72,7 +72,7 @@ LLModalDialog::~LLModalDialog() } // virtual -BOOL LLModalDialog::postBuild() +bool LLModalDialog::postBuild() { return LLFloater::postBuild(); } @@ -87,7 +87,7 @@ void LLModalDialog::openFloater(const LLSD& key) LLFloater::setFloaterHost(thost); } -void LLModalDialog::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLModalDialog::reshape(S32 width, S32 height, bool called_from_parent) { LLFloater::reshape(width, height, called_from_parent); centerOnScreen(); @@ -104,14 +104,14 @@ void LLModalDialog::onOpen(const LLSD& key) LLModalDialog* front = sModalStack.front(); if (front != this) { - front->setVisible(FALSE); + front->setVisible(false); } } // This is a modal dialog. It sucks up all mouse and keyboard operations. gFocusMgr.setMouseCapture( this ); LLUI::getInstance()->addPopup(this); - setFocus(TRUE); + setFocus(true); std::list<LLModalDialog*>::iterator iter = std::find(sModalStack.begin(), sModalStack.end(), this); if (iter != sModalStack.end()) @@ -144,12 +144,12 @@ void LLModalDialog::stopModal() if (!sModalStack.empty()) { LLModalDialog* front = sModalStack.front(); - front->setVisible(TRUE); + front->setVisible(true); } } -void LLModalDialog::setVisible( BOOL visible ) +void LLModalDialog::setVisible( bool visible ) { if (mModal) { @@ -160,7 +160,7 @@ void LLModalDialog::setVisible( BOOL visible ) // The dialog view is a root view LLUI::getInstance()->addPopup(this); - setFocus( TRUE ); + setFocus( true ); } else { @@ -171,7 +171,7 @@ void LLModalDialog::setVisible( BOOL visible ) LLFloater::setVisible( visible ); } -BOOL LLModalDialog::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLModalDialog::handleMouseDown(S32 x, S32 y, MASK mask) { LLView* popup_menu = LLMenuGL::sMenuContainer->getVisibleMenu(); if (popup_menu != NULL) @@ -199,10 +199,10 @@ BOOL LLModalDialog::handleMouseDown(S32 x, S32 y, MASK mask) } - return TRUE; + return true; } -BOOL LLModalDialog::handleHover(S32 x, S32 y, MASK mask) +bool LLModalDialog::handleHover(S32 x, S32 y, MASK mask) { if( childrenHandleHover(x, y, mask) == NULL ) { @@ -225,60 +225,60 @@ BOOL LLModalDialog::handleHover(S32 x, S32 y, MASK mask) } } - return TRUE; + return true; } -BOOL LLModalDialog::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLModalDialog::handleMouseUp(S32 x, S32 y, MASK mask) { childrenHandleMouseUp(x, y, mask); - return TRUE; + return true; } -BOOL LLModalDialog::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLModalDialog::handleScrollWheel(S32 x, S32 y, S32 clicks) { childrenHandleScrollWheel(x, y, clicks); - return TRUE; + return true; } -BOOL LLModalDialog::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLModalDialog::handleDoubleClick(S32 x, S32 y, MASK mask) { if (!LLFloater::handleDoubleClick(x, y, mask)) { // Click outside the panel make_ui_sound("UISndInvalidOp"); } - return TRUE; + return true; } -BOOL LLModalDialog::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLModalDialog::handleRightMouseDown(S32 x, S32 y, MASK mask) { LLMenuGL::sMenuContainer->hideMenus(); childrenHandleRightMouseDown(x, y, mask); - return TRUE; + return true; } -BOOL LLModalDialog::handleKeyHere(KEY key, MASK mask ) +bool LLModalDialog::handleKeyHere(KEY key, MASK mask ) { LLFloater::handleKeyHere(key, mask ); if (mModal) { // Suck up all keystokes except CTRL-Q. - BOOL is_quit = ('Q' == key) && (MASK_CONTROL == mask); + bool is_quit = ('Q' == key) && (MASK_CONTROL == mask); return !is_quit; } else { // don't process escape key until message box has been on screen a minimal amount of time // to avoid accidentally destroying the message box when user is hitting escape at the time it appears - BOOL enough_time_elapsed = mVisibleTime.getElapsedTimeF32() > 1.0f; + bool enough_time_elapsed = mVisibleTime.getElapsedTimeF32() > 1.0f; if (enough_time_elapsed && key == KEY_ESCAPE) { closeFloater(); - return TRUE; + return true; } - return FALSE; + return false; } } @@ -313,7 +313,7 @@ void LLModalDialog::onAppFocusLost() gFocusMgr.setMouseCapture( NULL ); } - instance->setFocus(FALSE); + instance->setFocus(false); } } @@ -326,7 +326,7 @@ void LLModalDialog::onAppFocusGained() // This is a modal dialog. It sucks up all mouse and keyboard operations. gFocusMgr.setMouseCapture( instance ); - instance->setFocus(TRUE); + instance->setFocus(true); LLUI::getInstance()->addPopup(instance); instance->centerOnScreen(); diff --git a/indra/llui/llmodaldialog.h b/indra/llui/llmodaldialog.h index bf729c61bf..177664dde4 100644 --- a/indra/llui/llmodaldialog.h +++ b/indra/llui/llmodaldialog.h @@ -39,34 +39,34 @@ class LLModalDialog; class LLModalDialog : public LLFloater { public: - LLModalDialog( const LLSD& key, BOOL modal = true ); + LLModalDialog( const LLSD& key, bool modal = true ); virtual ~LLModalDialog(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void openFloater(const LLSD& key = LLSD()); /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); - /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask ); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleScrollWheel(S32 x, S32 y, S32 clicks); + /*virtual*/ bool handleDoubleClick(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleRightMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleKeyHere(KEY key, MASK mask ); - /*virtual*/ void setVisible(BOOL visible); + /*virtual*/ void setVisible(bool visible); /*virtual*/ void draw(); - BOOL isModal() const { return mModal; } + bool isModal() const { return mModal; } void stopModal(); static void onAppFocusLost(); static void onAppFocusGained(); - static S32 activeCount() { return sModalStack.size(); } + static S32 activeCount() { return static_cast<S32>(sModalStack.size()); } static void shutdownModals(); protected: @@ -75,7 +75,7 @@ protected: private: LLFrameTimer mVisibleTime; - const BOOL mModal; + const bool mModal; static std::list<LLModalDialog*> sModalStack; // Top of stack is currently being displayed }; diff --git a/indra/llui/llmultifloater.cpp b/indra/llui/llmultifloater.cpp index 17f24a0f87..a7f9b8b2d9 100644 --- a/indra/llui/llmultifloater.cpp +++ b/indra/llui/llmultifloater.cpp @@ -40,7 +40,7 @@ LLMultiFloater::LLMultiFloater(const LLSD& key, const LLFloater::Params& params) : LLFloater(key), mTabContainer(NULL), mTabPos(LLTabContainer::TOP), - mAutoResize(TRUE), + mAutoResize(true), mOrigMinWidth(params.min_width), mOrigMinHeight(params.min_height) { @@ -71,7 +71,7 @@ void LLMultiFloater::onClose(bool app_quitting) { if(isMinimized()) { - setMinimized(FALSE); + setMinimized(false); } LLFloater::onClose(app_quitting); } @@ -89,7 +89,7 @@ void LLMultiFloater::draw() } } -BOOL LLMultiFloater::closeAllFloaters() +bool LLMultiFloater::closeAllFloaters() { S32 tabToClose = 0; S32 lastTabCount = mTabContainer->getTabCount(); @@ -110,8 +110,8 @@ BOOL LLMultiFloater::closeAllFloaters() } } if( mTabContainer->getTabCount() != 0 ) - return FALSE; // Couldn't close all the tabs (pending save dialog?) so return FALSE. - return TRUE; //else all tabs were successfully closed... + return false; // Couldn't close all the tabs (pending save dialog?) so return false. + return true; //else all tabs were successfully closed... } void LLMultiFloater::growToFit(S32 content_width, S32 content_height) @@ -139,7 +139,7 @@ void LLMultiFloater::growToFit(S32 content_width, S32 content_height) } /** - void addFloater(LLFloater* floaterp, BOOL select_added_floater) + void addFloater(LLFloater* floaterp, bool select_added_floater) Adds the LLFloater pointed to by floaterp to this. If floaterp is already hosted by this, then it is re-added to get @@ -149,7 +149,7 @@ void LLMultiFloater::growToFit(S32 content_width, S32 content_height) Affects: mTabContainer, floaterp **/ -void LLMultiFloater::addFloater(LLFloater* floaterp, BOOL select_added_floater, LLTabContainer::eInsertionPoint insertion_point) +void LLMultiFloater::addFloater(LLFloater* floaterp, bool select_added_floater, LLTabContainer::eInsertionPoint insertion_point) { if (!floaterp) { @@ -190,13 +190,13 @@ void LLMultiFloater::addFloater(LLFloater* floaterp, BOOL select_added_floater, floater_data.mSaveRect = floaterp->mSaveRect; // remove minimize and close buttons - floaterp->setCanMinimize(FALSE); - floaterp->setCanResize(FALSE); - floaterp->setCanDrag(FALSE); - floaterp->mSaveRect = FALSE; + floaterp->setCanMinimize(false); + floaterp->setCanResize(false); + floaterp->setCanDrag(false); + floaterp->mSaveRect = false; floaterp->storeRectControl(); // avoid double rendering of floater background (makes it more opaque) - floaterp->setBackgroundVisible(FALSE); + floaterp->setBackgroundVisible(false); if (mAutoResize) { @@ -226,7 +226,7 @@ void LLMultiFloater::addFloater(LLFloater* floaterp, BOOL select_added_floater, floaterp->setHost(this); if (isMinimized()) { - floaterp->setVisible(FALSE); + floaterp->setVisible(false); } // Tabs sometimes overlap resize handle @@ -244,14 +244,14 @@ void LLMultiFloater::updateFloaterTitle(LLFloater* floaterp) /** - BOOL selectFloater(LLFloater* floaterp) + bool selectFloater(LLFloater* floaterp) If the LLFloater pointed to by floaterp is hosted by this, then its tab is selected and returns true. Otherwise returns false. Affects: mTabContainer **/ -BOOL LLMultiFloater::selectFloater(LLFloater* floaterp) +bool LLMultiFloater::selectFloater(LLFloater* floaterp) { return mTabContainer->selectTabPanel(floaterp); } @@ -278,7 +278,7 @@ void LLMultiFloater::showFloater(LLFloater* floaterp, LLTabContainer::eInsertion if (floaterp != mTabContainer->getCurrentPanel() && !mTabContainer->selectTabPanel(floaterp)) { - addFloater(floaterp, TRUE, insertion_point); + addFloater(floaterp, true, insertion_point); } } @@ -302,8 +302,8 @@ void LLMultiFloater::removeFloater(LLFloater* floaterp) mFloaterDataMap.erase(found_data_it); } mTabContainer->removeTabPanel(floaterp); - floaterp->setBackgroundVisible(TRUE); - floaterp->setCanDrag(TRUE); + floaterp->setBackgroundVisible(true); + floaterp->setCanDrag(true); floaterp->setHost(NULL); floaterp->applyRectControl(); @@ -326,7 +326,7 @@ void LLMultiFloater::tabClose() } } -void LLMultiFloater::setVisible(BOOL visible) +void LLMultiFloater::setVisible(bool visible) { // *FIX: shouldn't have to do this, fix adding to minimized multifloater LLFloater::setVisible(visible); @@ -349,7 +349,7 @@ void LLMultiFloater::setVisible(BOOL visible) } } -BOOL LLMultiFloater::handleKeyHere(KEY key, MASK mask) +bool LLMultiFloater::handleKeyHere(KEY key, MASK mask) { if (key == 'W' && mask == MASK_CONTROL) { @@ -363,10 +363,10 @@ BOOL LLMultiFloater::handleKeyHere(KEY key, MASK mask) // bring back focus on tab container if there are any tab left if(mTabContainer->getTabCount() > 0) { - mTabContainer->setFocus(TRUE); + mTabContainer->setFocus(true); } } - return TRUE; + return true; } return LLFloater::handleKeyHere(key, mask); @@ -396,7 +396,7 @@ S32 LLMultiFloater::getFloaterCount() } /** - BOOL isFloaterFlashing(LLFloater* floaterp) + bool isFloaterFlashing(LLFloater* floaterp) Returns true if the LLFloater pointed to by floaterp is currently in a flashing state and is hosted by this. @@ -404,24 +404,24 @@ S32 LLMultiFloater::getFloaterCount() Requires: floaterp != NULL **/ -BOOL LLMultiFloater::isFloaterFlashing(LLFloater* floaterp) +bool LLMultiFloater::isFloaterFlashing(LLFloater* floaterp) { if ( floaterp && floaterp->getHost() == this ) return mTabContainer->getTabPanelFlashing(floaterp); - return FALSE; + return false; } /** - BOOL setFloaterFlashing(LLFloater* floaterp, BOOL flashing) + bool setFloaterFlashing(LLFloater* floaterp, bool flashing) Sets the current flashing state of the LLFloater pointed - to by floaterp to be the BOOL flashing if the LLFloater pointed + to by floaterp to be the bool flashing if the LLFloater pointed to by floaterp is hosted by this. Requires: floaterp != NULL **/ -void LLMultiFloater::setFloaterFlashing(LLFloater* floaterp, BOOL flashing) +void LLMultiFloater::setFloaterFlashing(LLFloater* floaterp, bool flashing) { if ( floaterp && floaterp->getHost() == this ) mTabContainer->setTabPanelFlashing(floaterp, flashing); @@ -436,7 +436,7 @@ void LLMultiFloater::onTabSelected() } } -void LLMultiFloater::setCanResize(BOOL can_resize) +void LLMultiFloater::setCanResize(bool can_resize) { LLFloater::setCanResize(can_resize); if (!mTabContainer) return; @@ -450,7 +450,7 @@ void LLMultiFloater::setCanResize(BOOL can_resize) } } -BOOL LLMultiFloater::postBuild() +bool LLMultiFloater::postBuild() { mCloseSignal.connect(boost::bind(&LLMultiFloater::closeAllFloaters, this)); @@ -459,13 +459,13 @@ BOOL LLMultiFloater::postBuild() if (mTabContainer) { - return TRUE; + return true; } mTabContainer = getChild<LLTabContainer>("Preview Tabs"); setCanResize(mResizable); - return TRUE; + return true; } void LLMultiFloater::updateResizeLimits() @@ -498,7 +498,7 @@ void LLMultiFloater::updateResizeLimits() // make sure this window is visible on screen when it has been modified // (tab added, etc) - gFloaterView->adjustToFitScreen(this, TRUE); + gFloaterView->adjustToFitScreen(this, true); } } diff --git a/indra/llui/llmultifloater.h b/indra/llui/llmultifloater.h index f2d83f4449..eb0f917695 100644 --- a/indra/llui/llmultifloater.h +++ b/indra/llui/llmultifloater.h @@ -43,16 +43,16 @@ public: void buildTabContainer(); - virtual BOOL postBuild(); + virtual bool postBuild(); /*virtual*/ void onClose(bool app_quitting); virtual void draw(); - virtual void setVisible(BOOL visible); - /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); + virtual void setVisible(bool visible); + /*virtual*/ bool handleKeyHere(KEY key, MASK mask); /*virtual*/ bool addChild(LLView* view, S32 tab_group = 0); - virtual void setCanResize(BOOL can_resize); + virtual void setCanResize(bool can_resize); virtual void growToFit(S32 content_width, S32 content_height); - virtual void addFloater(LLFloater* floaterp, BOOL select_added_floater, LLTabContainer::eInsertionPoint insertion_point = LLTabContainer::END); + virtual void addFloater(LLFloater* floaterp, bool select_added_floater, LLTabContainer::eInsertionPoint insertion_point = LLTabContainer::END); virtual void showFloater(LLFloater* floaterp, LLTabContainer::eInsertionPoint insertion_point = LLTabContainer::END); virtual void removeFloater(LLFloater* floaterp); @@ -60,16 +60,16 @@ public: virtual void tabOpen(LLFloater* opened_floater, bool from_click); virtual void tabClose(); - virtual BOOL selectFloater(LLFloater* floaterp); + virtual bool selectFloater(LLFloater* floaterp); virtual void selectNextFloater(); virtual void selectPrevFloater(); virtual LLFloater* getActiveFloater(); - virtual BOOL isFloaterFlashing(LLFloater* floaterp); + virtual bool isFloaterFlashing(LLFloater* floaterp); virtual S32 getFloaterCount(); - virtual void setFloaterFlashing(LLFloater* floaterp, BOOL flashing); - virtual BOOL closeAllFloaters(); //Returns FALSE if the floater could not be closed due to pending confirmation dialogs + virtual void setFloaterFlashing(LLFloater* floaterp, bool flashing); + virtual bool closeAllFloaters(); //Returns false if the floater could not be closed due to pending confirmation dialogs void setTabContainer(LLTabContainer* tab_container) { if (!mTabContainer) mTabContainer = tab_container; } void onTabSelected(); @@ -81,9 +81,9 @@ protected: { S32 mWidth; S32 mHeight; - BOOL mCanMinimize; - BOOL mCanResize; - BOOL mSaveRect; + bool mCanMinimize; + bool mCanResize; + bool mSaveRect; }; LLTabContainer* mTabContainer; @@ -92,7 +92,7 @@ protected: floater_data_map_t mFloaterDataMap; LLTabContainer::TabPosition mTabPos; - BOOL mAutoResize; + bool mAutoResize; S32 mOrigMinWidth, mOrigMinHeight; // logically const but initialized late private: diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index 26882ba8ec..cfbf491610 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -161,7 +161,7 @@ F32 LLMultiSlider::getNearestIncrement(F32 value) const return mMinValue + value; } -void LLMultiSlider::setSliderValue(const std::string& name, F32 value, BOOL from_event) +void LLMultiSlider::setSliderValue(const std::string& name, F32 value, bool from_event) { // exit if not there if(!mValue.has(name)) { @@ -263,7 +263,7 @@ void LLMultiSlider::setValue(const LLSD& value) mCurSlider = mIt->first; for(; mIt != value.endMap(); mIt++) { - setSliderValue(mIt->first, (F32)mIt->second.asReal(), TRUE); + setSliderValue(mIt->first, (F32)mIt->second.asReal(), true); } } } @@ -378,7 +378,7 @@ const std::string& LLMultiSlider::addSlider(F32 val) mCurSlider = newName.str(); // move the slider - setSliderValue(mCurSlider, initVal, TRUE); + setSliderValue(mCurSlider, initVal, true); return mCurSlider; } @@ -411,7 +411,7 @@ bool LLMultiSlider::addSlider(F32 val, const std::string& name) mCurSlider = name; // move the slider - setSliderValue(mCurSlider, initVal, TRUE); + setSliderValue(mCurSlider, initVal, true); return true; } @@ -498,7 +498,7 @@ void LLMultiSlider::clear() LLF32UICtrl::clear(); } -BOOL LLMultiSlider::handleHover(S32 x, S32 y, MASK mask) +bool LLMultiSlider::handleHover(S32 x, S32 y, MASK mask) { if( gFocusMgr.getMouseCapture() == this ) { @@ -531,12 +531,12 @@ BOOL LLMultiSlider::handleHover(S32 x, S32 y, MASK mask) getWindow()->setCursor(UI_CURSOR_ARROW); LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (inactive)" << LL_ENDL; } - return TRUE; + return true; } -BOOL LLMultiSlider::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLMultiSlider::handleMouseUp(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; if( gFocusMgr.getMouseCapture() == this ) { @@ -545,23 +545,23 @@ BOOL LLMultiSlider::handleMouseUp(S32 x, S32 y, MASK mask) if (mMouseUpSignal) (*mMouseUpSignal)( this, LLSD() ); - handled = TRUE; + handled = true; make_ui_sound("UISndClickRelease"); } else { - handled = TRUE; + handled = true; } return handled; } -BOOL LLMultiSlider::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLMultiSlider::handleMouseDown(S32 x, S32 y, MASK mask) { // only do sticky-focus on non-chrome widgets if (!getIsChrome()) { - setFocus(TRUE); + setFocus(true); } if (mMouseDownSignal) (*mMouseDownSignal)( this, LLSD() ); @@ -611,28 +611,28 @@ BOOL LLMultiSlider::handleMouseDown(S32 x, S32 y, MASK mask) } make_ui_sound("UISndClick"); - return TRUE; + return true; } -BOOL LLMultiSlider::handleKeyHere(KEY key, MASK mask) +bool LLMultiSlider::handleKeyHere(KEY key, MASK mask) { - BOOL handled = FALSE; + bool handled = false; switch(key) { case KEY_UP: case KEY_DOWN: // eat up and down keys to be consistent - handled = TRUE; + handled = true; break; case KEY_LEFT: setCurSliderValue(getCurSliderValue() - getIncrement()); onCommit(); - handled = TRUE; + handled = true; break; case KEY_RIGHT: setCurSliderValue(getCurSliderValue() + getIncrement()); onCommit(); - handled = TRUE; + handled = true; break; default: break; @@ -700,7 +700,7 @@ void LLMultiSlider::draw() mIt->second.mTop + extra_triangle_height, mIt->second.mLeft + mIt->second.getWidth() / 2, mIt->second.mBottom - extra_triangle_height, - mTriangleColor.get() % opacity, TRUE); + mTriangleColor.get() % opacity, true); } } else if (!mRoundedSquareImgp && !mThumbImagep) @@ -725,23 +725,23 @@ void LLMultiSlider::draw() } // the draw command - gl_rect_2d(mIt->second, curThumbColor, TRUE); + gl_rect_2d(mIt->second, curThumbColor, true); } // now draw the current and hover sliders if(curSldrIt != mThumbRects.end()) { - gl_rect_2d(curSldrIt->second, mThumbCenterSelectedColor.get(), TRUE); + gl_rect_2d(curSldrIt->second, mThumbCenterSelectedColor.get(), true); } // and draw the drag start if (gFocusMgr.getMouseCapture() == this) { - gl_rect_2d(mDragStartThumbRect, mThumbCenterColor.get() % opacity, FALSE); + gl_rect_2d(mDragStartThumbRect, mThumbCenterColor.get() % opacity, false); } else if (hoverSldrIt != mThumbRects.end()) { - gl_rect_2d(hoverSldrIt->second, mThumbCenterSelectedColor.get(), TRUE); + gl_rect_2d(hoverSldrIt->second, mThumbCenterSelectedColor.get(), true); } } else diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h index 963c6e5fab..b2bfc8bc84 100644 --- a/indra/llui/llmultislider.h +++ b/indra/llui/llmultislider.h @@ -81,7 +81,7 @@ public: // Multi-slider rounds values to nearest increments (bias towards rounding down) F32 getNearestIncrement(F32 value) const; - void setSliderValue(const std::string& name, F32 value, BOOL from_event = FALSE); + void setSliderValue(const std::string& name, F32 value, bool from_event = false); F32 getSliderValue(const std::string& name) const; F32 getSliderValueFromPos(S32 xpos, S32 ypos) const; LLRect getSliderThumbRect(const std::string& name) const; @@ -94,7 +94,7 @@ public: F32 getCurSliderValue() const { return getSliderValue(mCurSlider); } void setCurSlider(const std::string& name); void resetCurSlider(); - void setCurSliderValue(F32 val, BOOL from_event = false) { setSliderValue(mCurSlider, val, from_event); } + void setCurSliderValue(F32 val, bool from_event = false) { setSliderValue(mCurSlider, val, from_event); } /*virtual*/ void setValue(const LLSD& value) override; /*virtual*/ LLSD getValue() const override { return mValue; } @@ -110,15 +110,15 @@ public: void deleteCurSlider() { deleteSlider(mCurSlider); } /*virtual*/ void clear() override; - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask) override; + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleKeyHere(KEY key, MASK mask) override; /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask) override; /*virtual*/ void draw() override; S32 getMaxNumSliders() { return mMaxNumSliders; } - S32 getCurNumSliders() { return mValue.size(); } + S32 getCurNumSliders() { return static_cast<S32>(mValue.size()); } F32 getOverlapThreshold() { return mOverlapThreshold; } bool canAddSliders() { return mValue.size() < mMaxNumSliders; } @@ -130,11 +130,11 @@ protected: static S32 mNameCounter; S32 mMaxNumSliders; - BOOL mAllowOverlap; - BOOL mLoopOverlap; + bool mAllowOverlap; + bool mLoopOverlap; F32 mOverlapThreshold; - BOOL mDrawTrack; - BOOL mUseTriangle; /// hacked in toggle to use a triangle + bool mDrawTrack; + bool mUseTriangle; /// hacked in toggle to use a triangle S32 mMouseOffset; LLRect mDragStartThumbRect; diff --git a/indra/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp index b0598b4388..01e2fc6ac9 100644 --- a/indra/llui/llmultisliderctrl.cpp +++ b/indra/llui/llmultisliderctrl.cpp @@ -144,7 +144,7 @@ LLMultiSliderCtrl::LLMultiSliderCtrl(const LLMultiSliderCtrl::Params& p) mEditor->setFocusReceivedCallback( boost::bind(LLMultiSliderCtrl::onEditorGainFocus, _1, this) ); // don't do this, as selecting the entire text is single clicking in some cases // and double clicking in others - //mEditor->setSelectAllonFocusReceived(TRUE); + //mEditor->setSelectAllonFocusReceived(true); addChild(mEditor); } else @@ -219,7 +219,7 @@ void LLMultiSliderCtrl::setValue(const LLSD& value) updateText(); } -void LLMultiSliderCtrl::setSliderValue(const std::string& name, F32 v, BOOL from_event) +void LLMultiSliderCtrl::setSliderValue(const std::string& name, F32 v, bool from_event) { mMultiSlider->setSliderValue(name, v, from_event ); mCurValue = mMultiSlider->getCurSliderValue(); @@ -237,9 +237,9 @@ void LLMultiSliderCtrl::resetCurSlider() mMultiSlider->resetCurSlider(); } -BOOL LLMultiSliderCtrl::setLabelArg( const std::string& key, const LLStringExplicit& text ) +bool LLMultiSliderCtrl::setLabelArg( const std::string& key, const LLStringExplicit& text ) { - BOOL res = FALSE; + bool res = false; if (mLabelBox) { res = mLabelBox->setTextArg(key, text); @@ -329,7 +329,7 @@ void LLMultiSliderCtrl::clear() } -BOOL LLMultiSliderCtrl::isMouseHeldDown() +bool LLMultiSliderCtrl::isMouseHeldDown() { return gFocusMgr.getMouseCapture() == mMultiSlider; } @@ -368,7 +368,7 @@ void LLMultiSliderCtrl::onEditorCommit( LLUICtrl* ctrl, const LLSD& userdata) if (!self) // cast failed - wrong type! :O return; - BOOL success = FALSE; + bool success = false; F32 val = self->mCurValue; F32 saved_val = self->mCurValue; @@ -382,7 +382,7 @@ void LLMultiSliderCtrl::onEditorCommit( LLUICtrl* ctrl, const LLSD& userdata) self->setCurSliderValue( val ); // set the value temporarily so that the callback can retrieve it. if( !self->mValidateSignal || (*(self->mValidateSignal))( self, val ) ) { - success = TRUE; + success = true; } } } @@ -409,14 +409,14 @@ void LLMultiSliderCtrl::onSliderCommit(LLUICtrl* ctrl, const LLSD& userdata) if (!self) return; - BOOL success = FALSE; + bool success = false; F32 saved_val = self->mCurValue; F32 new_val = self->mMultiSlider->getCurSliderValue(); self->mCurValue = new_val; // set the value temporarily so that the callback can retrieve it. if( !self->mValidateSignal || (*(self->mValidateSignal))( self, new_val ) ) { - success = TRUE; + success = true; } if( success ) @@ -434,7 +434,7 @@ void LLMultiSliderCtrl::onSliderCommit(LLUICtrl* ctrl, const LLSD& userdata) self->updateText(); } -void LLMultiSliderCtrl::setEnabled(BOOL b) +void LLMultiSliderCtrl::setEnabled(bool b) { LLF32UICtrl::setEnabled( b ); @@ -457,7 +457,7 @@ void LLMultiSliderCtrl::setEnabled(BOOL b) } -void LLMultiSliderCtrl::setTentative(BOOL b) +void LLMultiSliderCtrl::setTentative(bool b) { if( mEditor ) { @@ -469,11 +469,11 @@ void LLMultiSliderCtrl::setTentative(BOOL b) void LLMultiSliderCtrl::onCommit() { - setTentative(FALSE); + setTentative(false); if( mEditor ) { - mEditor->setTentative(FALSE); + mEditor->setTentative(false); } setControlValue(getValueF32()); diff --git a/indra/llui/llmultisliderctrl.h b/indra/llui/llmultisliderctrl.h index e3b190a938..fee05c92fd 100644 --- a/indra/llui/llmultisliderctrl.h +++ b/indra/llui/llmultisliderctrl.h @@ -83,24 +83,24 @@ public: virtual ~LLMultiSliderCtrl(); F32 getSliderValue(const std::string& name) const { return mMultiSlider->getSliderValue(name); } - void setSliderValue(const std::string& name, F32 v, BOOL from_event = FALSE); + void setSliderValue(const std::string& name, F32 v, bool from_event = false); virtual void setValue(const LLSD& value ); virtual LLSD getValue() const { return mMultiSlider->getValue(); } - virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); + virtual bool setLabelArg( const std::string& key, const LLStringExplicit& text ); const std::string& getCurSlider() const { return mMultiSlider->getCurSlider(); } F32 getCurSliderValue() const { return mCurValue; } void setCurSlider(const std::string& name); void resetCurSlider(); - void setCurSliderValue(F32 val, BOOL from_event = false) { setSliderValue(mMultiSlider->getCurSlider(), val, from_event); } + void setCurSliderValue(F32 val, bool from_event = false) { setSliderValue(mMultiSlider->getCurSlider(), val, from_event); } virtual void setMinValue(const LLSD& min_value) { setMinValue((F32)min_value.asReal()); } virtual void setMaxValue(const LLSD& max_value) { setMaxValue((F32)max_value.asReal()); } - BOOL isMouseHeldDown(); + bool isMouseHeldDown(); - virtual void setEnabled( BOOL b ); + virtual void setEnabled( bool b ); virtual void clear(); virtual void setPrecision(S32 precision); void setMinValue(F32 min_value) {mMultiSlider->setMinValue(min_value);} @@ -138,7 +138,7 @@ public: virtual void onTabInto(); - virtual void setTentative(BOOL b); // marks value as tentative + virtual void setTentative(bool b); // marks value as tentative virtual void onCommit(); // mark not tentative, then commit virtual void setControlName(const std::string& control_name, LLView* context); @@ -155,8 +155,8 @@ private: private: const LLFontGL* mFont; - BOOL mShowText; - BOOL mCanEditText; + bool mShowText; + bool mCanEditText; S32 mPrecision; LLTextBox* mLabelBox; diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 2fbae73b65..bee7d5bb3f 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -216,10 +216,10 @@ LLNotificationForm::LLNotificationForm(const std::string& name, const LLNotifica ui_inst->mSettingGroups["ignores"]->declareLLSD(std::string("Default") + name, "", std::string("Default response for notification " + name)); } - BOOL show_notification = TRUE; + bool show_notification = true; if (p.ignore.control.isProvided()) { - mIgnoreSetting = ui_inst->mSettingGroups["config"]->getControl(p.ignore.control); + mIgnoreSetting = ui_inst->mSettingGroups["config"]->getControl(p.ignore.control()); mInvertSetting = p.ignore.invert_control; } else if (mIgnore > IGNORE_NO) @@ -1187,7 +1187,7 @@ bool LLNotificationChannel::isEmpty() const S32 LLNotificationChannel::size() const { - return mItems.size(); + return static_cast<S32>(mItems.size()); } size_t LLNotificationChannel::size() @@ -1560,7 +1560,7 @@ bool LLNotifications::loadTemplates() std::string base_filename = search_paths.front(); LLXMLNodePtr root; - BOOL success = LLXMLNode::getLayeredXMLNode(root, search_paths); + bool success = LLXMLNode::getLayeredXMLNode(root, search_paths); if (!success || root.isNull() || !root->hasName( "notifications" )) { diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index ab4f009a80..d3615b6601 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -249,7 +249,7 @@ public: void fromLLSD(const LLSD& sd); LLSD asLLSD() const; - S32 getNumElements() { return mFormData.size(); } + S32 getNumElements() { return static_cast<S32>(mFormData.size()); } LLSD getElement(S32 index) { return mFormData.get(index); } LLSD getElement(const std::string& element_name); void getElements(LLSD& elements, S32 offset = 0); @@ -444,11 +444,11 @@ public: // return response LLSD filled in with default form contents and (optionally) the default button selected LLSD getResponseTemplate(EResponseTemplateType type = WITHOUT_DEFAULT_BUTTON); - // returns index of first button with value==TRUE + // returns index of first button with value==true // usually this the button the user clicked on // returns -1 if no button clicked (e.g. form has not been displayed) static S32 getSelectedOption(const LLSD& notification, const LLSD& response); - // returns name of first button with value==TRUE + // returns name of first button with value==true static std::string getSelectedOptionName(const LLSD& notification); // after someone responds to a notification (usually by clicking a button, diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index d580566b13..468cdb10fb 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -55,7 +55,7 @@ LLPanel::factory_stack_t LLPanel::sFactoryStack; // Compiler optimization, generate extern template template class LLPanel* LLView::getChild<class LLPanel>( - const std::string& name, BOOL recurse) const; + const std::string& name, bool recurse) const; LLPanel::LocalizedString::LocalizedString() : name("name"), @@ -127,9 +127,9 @@ LLPanel::~LLPanel() } // virtual -BOOL LLPanel::isPanel() const +bool LLPanel::isPanel() const { - return TRUE; + return true; } void LLPanel::addBorder(LLViewBorder::Params p) @@ -167,13 +167,13 @@ void LLPanel::clearCtrls() for (LLPanel::ctrl_list_t::iterator ctrl_it = ctrls.begin(); ctrl_it != ctrls.end(); ++ctrl_it) { LLUICtrl* ctrl = *ctrl_it; - ctrl->setFocus( FALSE ); - ctrl->setEnabled( FALSE ); + ctrl->setFocus( false ); + ctrl->setEnabled( false ); ctrl->clear(); } } -void LLPanel::setCtrlsEnabled( BOOL b ) +void LLPanel::setCtrlsEnabled( bool b ) { LLPanel::ctrl_list_t ctrls = getCtrlList(); for (LLPanel::ctrl_list_t::iterator ctrl_it = ctrls.begin(); ctrl_it != ctrls.end(); ++ctrl_it) @@ -247,13 +247,13 @@ void LLPanel::updateDefaultBtn() if (gFocusMgr.childHasKeyboardFocus( this ) && mDefaultBtn->getEnabled()) { LLButton* buttonp = dynamic_cast<LLButton*>(gFocusMgr.getKeyboardFocus()); - BOOL focus_is_child_button = buttonp && buttonp->getCommitOnReturn(); + bool focus_is_child_button = buttonp && buttonp->getCommitOnReturn(); // only enable default button when current focus is not a return-capturing button mDefaultBtn->setBorderEnabled(!focus_is_child_button); } else { - mDefaultBtn->setBorderEnabled(FALSE); + mDefaultBtn->setBorderEnabled(false); } } } @@ -261,19 +261,19 @@ void LLPanel::updateDefaultBtn() void LLPanel::refresh() { // do nothing by default - // but is automatically called in setFocus(TRUE) + // but is automatically called in setFocus(true) } void LLPanel::setDefaultBtn(LLButton* btn) { if (mDefaultBtn && mDefaultBtn->getEnabled()) { - mDefaultBtn->setBorderEnabled(FALSE); + mDefaultBtn->setBorderEnabled(false); } mDefaultBtn = btn; if (mDefaultBtn) { - mDefaultBtn->setBorderEnabled(TRUE); + mDefaultBtn->setBorderEnabled(true); } } @@ -290,17 +290,17 @@ void LLPanel::setDefaultBtn(const std::string& id) } } -BOOL LLPanel::handleKeyHere( KEY key, MASK mask ) +bool LLPanel::handleKeyHere( KEY key, MASK mask ) { - BOOL handled = FALSE; + bool handled = false; LLUICtrl* cur_focus = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus()); // handle user hitting ESC to defocus if (key == KEY_ESCAPE) { - setFocus(FALSE); - return TRUE; + setFocus(false); + return true; } else if( (mask == MASK_SHIFT) && (KEY_TAB == key)) { @@ -310,7 +310,7 @@ BOOL LLPanel::handleKeyHere( KEY key, MASK mask ) LLUICtrl* focus_root = cur_focus->findRootMostFocusRoot(); if (focus_root) { - handled = focus_root->focusPrevItem(FALSE); + handled = focus_root->focusPrevItem(false); } } } @@ -322,7 +322,7 @@ BOOL LLPanel::handleKeyHere( KEY key, MASK mask ) LLUICtrl* focus_root = cur_focus->findRootMostFocusRoot(); if (focus_root) { - handled = focus_root->focusNextItem(FALSE); + handled = focus_root->focusNextItem(false); } } } @@ -335,38 +335,38 @@ BOOL LLPanel::handleKeyHere( KEY key, MASK mask ) { // current focus is a return-capturing button, // let *that* button handle the return key - handled = FALSE; + handled = false; } else if (mDefaultBtn && mDefaultBtn->getVisible() && mDefaultBtn->getEnabled()) { // If we have a default button, click it when return is pressed mDefaultBtn->onCommit(); - handled = TRUE; + handled = true; } else if (cur_focus->acceptsTextInput()) { // call onCommit for text input handling control cur_focus->onCommit(); - handled = TRUE; + handled = true; } } return handled; } -void LLPanel::onVisibilityChange ( BOOL new_visibility ) +void LLPanel::onVisibilityChange ( bool new_visibility ) { LLUICtrl::onVisibilityChange ( new_visibility ); if (mVisibleSignal) - (*mVisibleSignal)(this, LLSD(new_visibility) ); // Pass BOOL as LLSD + (*mVisibleSignal)(this, LLSD(new_visibility) ); // Pass bool as LLSD } -void LLPanel::setFocus(BOOL b) +void LLPanel::setFocus(bool b) { if( b && !hasFocus()) { // give ourselves focus preemptively, to avoid infinite loop - LLUICtrl::setFocus(TRUE); + LLUICtrl::setFocus(true); // then try to pass to first valid child focusFirstItem(); } @@ -376,7 +376,7 @@ void LLPanel::setFocus(BOOL b) } } -void LLPanel::setBorderVisible(BOOL b) +void LLPanel::setBorderVisible(bool b) { if (mBorder) { @@ -504,7 +504,7 @@ static LLTrace::BlockTimerStatHandle FTM_PANEL_SETUP("Panel Setup"); static LLTrace::BlockTimerStatHandle FTM_EXTERNAL_PANEL_LOAD("Load Extern Panel Reference"); static LLTrace::BlockTimerStatHandle FTM_PANEL_POSTBUILD("Panel PostBuild"); -BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node, const LLPanel::Params& default_params) +bool LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node, const LLPanel::Params& default_params) { Params params(default_params); { @@ -533,7 +533,7 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu setupParamsForExport(output_params, parent); output_node->setName(node->getName()->mString); parser.writeXUI(output_node, output_params, LLInitParam::default_parse_rules(), &default_params); - return TRUE; + return true; } LLUICtrlFactory::instance().pushFileName(xml_filename); @@ -543,7 +543,7 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu { LL_WARNS() << "Couldn't parse panel from: " << xml_filename << LL_ENDL; - return FALSE; + return false; } parser.readXUI(referenced_xml, params, LLUICtrlFactory::getInstance()->getCurFileName()); @@ -590,7 +590,7 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu postBuild(); } } - return TRUE; + return true; } bool LLPanel::hasString(const std::string& name) @@ -658,7 +658,7 @@ void LLPanel::childSetEnabled(const std::string& id, bool enabled) } } -void LLPanel::childSetFocus(const std::string& id, BOOL focus) +void LLPanel::childSetFocus(const std::string& id, bool focus) { LLUICtrl* child = findChild<LLUICtrl>(id); if (child) @@ -667,7 +667,7 @@ void LLPanel::childSetFocus(const std::string& id, BOOL focus) } } -BOOL LLPanel::childHasFocus(const std::string& id) +bool LLPanel::childHasFocus(const std::string& id) { LLUICtrl* child = findChild<LLUICtrl>(id); if (child) @@ -676,7 +676,7 @@ BOOL LLPanel::childHasFocus(const std::string& id) } else { - return FALSE; + return false; } } @@ -752,24 +752,24 @@ LLSD LLPanel::childGetValue(const std::string& id) const return LLSD(); } -BOOL LLPanel::childSetTextArg(const std::string& id, const std::string& key, const LLStringExplicit& text) +bool LLPanel::childSetTextArg(const std::string& id, const std::string& key, const LLStringExplicit& text) { LLUICtrl* child = findChild<LLUICtrl>(id); if (child) { return child->setTextArg(key, text); } - return FALSE; + return false; } -BOOL LLPanel::childSetLabelArg(const std::string& id, const std::string& key, const LLStringExplicit& text) +bool LLPanel::childSetLabelArg(const std::string& id, const std::string& key, const LLStringExplicit& text) { LLView* child = findChild<LLView>(id); if (child) { return child->setLabelArg(key, text); } - return FALSE; + return false; } void LLPanel::childSetAction(const std::string& id, const commit_signal_t::slot_type& function) @@ -803,10 +803,10 @@ boost::signals2::connection LLPanel::setVisibleCallback( const commit_signal_t:: //----------------------------------------------------------------------------- // buildPanel() //----------------------------------------------------------------------------- -BOOL LLPanel::buildFromFile(const std::string& filename, const LLPanel::Params& default_params) +bool LLPanel::buildFromFile(const std::string& filename, const LLPanel::Params& default_params) { LL_PROFILE_ZONE_SCOPED; - BOOL didPost = FALSE; + bool didPost = false; LLXMLNodePtr root; if (!LLUICtrlFactory::getLayeredXMLNode(filename, root)) diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index 365cac9fe6..2be5573faf 100644 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -40,8 +40,8 @@ #include <queue> const S32 LLPANEL_BORDER_WIDTH = 1; -const BOOL BORDER_YES = TRUE; -const BOOL BORDER_NO = FALSE; +const bool BORDER_YES = true; +const bool BORDER_NO = false; class LLButton; class LLUIImage; @@ -107,20 +107,20 @@ protected: public: typedef std::vector<class LLUICtrl *> ctrl_list_t; - BOOL buildFromFile(const std::string &filename, const LLPanel::Params& default_params = getDefaultParams()); + bool buildFromFile(const std::string &filename, const LLPanel::Params& default_params = getDefaultParams()); static LLPanel* createFactoryPanel(const std::string& name); /*virtual*/ ~LLPanel(); // LLView interface - /*virtual*/ BOOL isPanel() const; + /*virtual*/ bool isPanel() const; /*virtual*/ void draw(); - /*virtual*/ BOOL handleKeyHere( KEY key, MASK mask ); - /*virtual*/ void onVisibilityChange ( BOOL new_visibility ); + /*virtual*/ bool handleKeyHere( KEY key, MASK mask ); + /*virtual*/ void onVisibilityChange ( bool new_visibility ); // From LLFocusableElement - /*virtual*/ void setFocus( BOOL b ); + /*virtual*/ void setFocus( bool b ); // New virtuals virtual void refresh(); // called in setFocus() @@ -131,8 +131,8 @@ public: void addBorder( LLViewBorder::Params p); void addBorder(); void removeBorder(); - BOOL hasBorder() const { return mBorder != NULL; } - void setBorderVisible( BOOL b ); + bool hasBorder() const { return mBorder != NULL; } + void setBorderVisible( bool b ); void setBackgroundColor( const LLColor4& color ) { mBgOpaqueColor = color; } const LLColor4& getBackgroundColor() const { return mBgOpaqueColor; } @@ -144,10 +144,10 @@ public: LLPointer<LLUIImage> getTransparentImage() const { return mBgAlphaImage; } LLColor4 getBackgroundImageOverlay() { return mBgOpaqueImageOverlay; } LLColor4 getTransparentImageOverlay() { return mBgAlphaImageOverlay; } - void setBackgroundVisible( BOOL b ) { mBgVisible = b; } - BOOL isBackgroundVisible() const { return mBgVisible; } - void setBackgroundOpaque(BOOL b) { mBgOpaque = b; } - BOOL isBackgroundOpaque() const { return mBgOpaque; } + void setBackgroundVisible( bool b ) { mBgVisible = b; } + bool isBackgroundVisible() const { return mBgVisible; } + void setBackgroundOpaque(bool b) { mBgOpaque = b; } + bool isBackgroundOpaque() const { return mBgOpaque; } void setDefaultBtn(LLButton* btn = NULL); void setDefaultBtn(const std::string& id); void updateDefaultBtn(); @@ -156,7 +156,7 @@ public: void setHelpTopic(const std::string& help_topic) { mHelpTopic = help_topic; } std::string getHelpTopic() const { return mHelpTopic; } - void setCtrlsEnabled(BOOL b); + void setCtrlsEnabled(bool b); ctrl_list_t getCtrlList() const; LLHandle<LLPanel> getHandle() const { return getDerivedHandle<LLPanel>(); } @@ -167,7 +167,7 @@ public: EnableCallbackRegistry::ScopedRegistrar& getEnableCallbackRegistrar() { return mEnableCallbackRegistrar; } void initFromParams(const Params& p); - BOOL initPanelXML( LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node, const LLPanel::Params& default_params); + bool initPanelXML( LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node, const LLPanel::Params& default_params); bool hasString(const std::string& name); std::string getString(const std::string& name, const LLStringUtil::format_map_t& args) const; @@ -184,8 +184,8 @@ public: void childDisable(const std::string& name) { childSetEnabled(name, false); }; // LLUICtrl - void childSetFocus(const std::string& id, BOOL focus = TRUE); - BOOL childHasFocus(const std::string& id); + void childSetFocus(const std::string& id, bool focus = true); + bool childHasFocus(const std::string& id); // *TODO: Deprecate; for backwards compatability only: // Prefer getChild<LLUICtrl>("foo")->setCommitCallback(boost:bind(...)), @@ -203,9 +203,9 @@ public: LLSD childGetValue(const std::string& id) const; // For setting text / label replacement params, e.g. "Hello [NAME]" - // Not implemented for all types, defaults to noop, returns FALSE if not applicaple - BOOL childSetTextArg(const std::string& id, const std::string& key, const LLStringExplicit& text); - BOOL childSetLabelArg(const std::string& id, const std::string& key, const LLStringExplicit& text); + // Not implemented for all types, defaults to noop, returns false if not applicaple + bool childSetTextArg(const std::string& id, const std::string& key, const LLStringExplicit& text); + bool childSetLabelArg(const std::string& id, const std::string& key, const LLStringExplicit& text); // LLButton void childSetAction(const std::string& id, boost::function<void(void*)> function, void* value); @@ -238,8 +238,8 @@ protected: std::string mXMLFilename; private: - BOOL mBgVisible; // any background at all? - BOOL mBgOpaque; // use opaque color or image + bool mBgVisible; // any background at all? + bool mBgOpaque; // use opaque color or image LLUIColor mBgOpaqueColor; LLUIColor mBgAlphaColor; LLUIColor mBgOpaqueImageOverlay; @@ -259,7 +259,7 @@ private: // Build time optimization, generate once in .cpp file #ifndef LLPANEL_CPP extern template class LLPanel* LLView::getChild<class LLPanel>( - const std::string& name, BOOL recurse) const; + const std::string& name, bool recurse) const; #endif typedef boost::function<LLPanel* (void)> LLPanelClassCreatorFunc; diff --git a/indra/llui/llradiogroup.cpp b/indra/llui/llradiogroup.cpp index ff53563a4c..2aff434612 100644 --- a/indra/llui/llradiogroup.cpp +++ b/indra/llui/llradiogroup.cpp @@ -53,8 +53,8 @@ public: /*virtual*/ ~LLRadioCtrl(); /*virtual*/ void setValue(const LLSD& value); - /*virtual*/ BOOL postBuild(); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool postBuild(); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); LLSD getPayload() { return mPayload; } @@ -119,16 +119,16 @@ LLRadioGroup::~LLRadioGroup() } // virtual -BOOL LLRadioGroup::postBuild() +bool LLRadioGroup::postBuild() { if (!mRadioButtons.empty()) { mRadioButtons[0]->setTabStop(true); } - return TRUE; + return true; } -void LLRadioGroup::setIndexEnabled(S32 index, BOOL enabled) +void LLRadioGroup::setIndexEnabled(S32 index, bool enabled) { S32 count = 0; for (button_list_t::iterator iter = mRadioButtons.begin(); @@ -138,7 +138,7 @@ void LLRadioGroup::setIndexEnabled(S32 index, BOOL enabled) if (count == index) { child->setEnabled(enabled); - if (index == mSelectedIndex && enabled == FALSE) + if (index == mSelectedIndex && !enabled) { setSelectedIndex(-1); } @@ -173,30 +173,30 @@ void LLRadioGroup::setIndexEnabled(S32 index, BOOL enabled) } } -BOOL LLRadioGroup::setSelectedIndex(S32 index, BOOL from_event) +bool LLRadioGroup::setSelectedIndex(S32 index, bool from_event) { if ((S32)mRadioButtons.size() <= index ) { - return FALSE; + return false; } if (index < -1) { // less then minimum value - return FALSE; + return false; } if (index < 0 && mSelectedIndex >= 0 && !mAllowDeselect) { // -1 is "nothing selected" - return FALSE; + return false; } if (mSelectedIndex >= 0) { LLRadioCtrl* old_radio_item = mRadioButtons[mSelectedIndex]; old_radio_item->setTabStop(false); - old_radio_item->setValue( FALSE ); + old_radio_item->setValue( false ); } else { @@ -209,11 +209,11 @@ BOOL LLRadioGroup::setSelectedIndex(S32 index, BOOL from_event) { LLRadioCtrl* radio_item = mRadioButtons[mSelectedIndex]; radio_item->setTabStop(true); - radio_item->setValue( TRUE ); + radio_item->setValue( true ); if (hasFocus()) { - radio_item->focusFirstItem(FALSE, FALSE); + radio_item->focusFirstItem(false, false); } } @@ -222,7 +222,7 @@ BOOL LLRadioGroup::setSelectedIndex(S32 index, BOOL from_event) setControlValue(getValue()); } - return TRUE; + return true; } void LLRadioGroup::focusSelectedRadioBtn() @@ -232,18 +232,18 @@ void LLRadioGroup::focusSelectedRadioBtn() LLRadioCtrl* radio_item = mRadioButtons[mSelectedIndex]; if (radio_item->hasTabStop() && radio_item->getEnabled()) { - radio_item->focusFirstItem(FALSE, FALSE); + radio_item->focusFirstItem(false, false); } } else if (mRadioButtons[0]->hasTabStop() || hasTabStop()) { - focusFirstItem(FALSE, FALSE); + focusFirstItem(false, false); } } -BOOL LLRadioGroup::handleKeyHere(KEY key, MASK mask) +bool LLRadioGroup::handleKeyHere(KEY key, MASK mask) { - BOOL handled = FALSE; + bool handled = false; // do any of the tab buttons have keyboard focus? if (mask == MASK_NONE) { @@ -258,7 +258,7 @@ BOOL LLRadioGroup::handleKeyHere(KEY key, MASK mask) { onCommit(); } - handled = TRUE; + handled = true; break; case KEY_UP: if (!setSelectedIndex((getSelectedIndex() - 1))) @@ -269,7 +269,7 @@ BOOL LLRadioGroup::handleKeyHere(KEY key, MASK mask) { onCommit(); } - handled = TRUE; + handled = true; break; case KEY_LEFT: if (!setSelectedIndex((getSelectedIndex() - 1))) @@ -280,7 +280,7 @@ BOOL LLRadioGroup::handleKeyHere(KEY key, MASK mask) { onCommit(); } - handled = TRUE; + handled = true; break; case KEY_RIGHT: if (!setSelectedIndex((getSelectedIndex() + 1))) @@ -291,7 +291,7 @@ BOOL LLRadioGroup::handleKeyHere(KEY key, MASK mask) { onCommit(); } - handled = TRUE; + handled = true; break; default: break; @@ -358,11 +358,11 @@ void LLRadioGroup::setValue( const LLSD& value ) // string not found, try integer if (value.isInteger()) { - setSelectedIndex((S32) value.asInteger(), TRUE); + setSelectedIndex((S32) value.asInteger(), true); } else { - setSelectedIndex(-1, TRUE); + setSelectedIndex(-1, true); } } } @@ -381,9 +381,9 @@ LLSD LLRadioGroup::getValue() const } // LLCtrlSelectionInterface functions -BOOL LLRadioGroup::setCurrentByID( const LLUUID& id ) +bool LLRadioGroup::setCurrentByID( const LLUUID& id ) { - return FALSE; + return false; } LLUUID LLRadioGroup::getCurrentID() const @@ -391,7 +391,7 @@ LLUUID LLRadioGroup::getCurrentID() const return LLUUID::null; } -BOOL LLRadioGroup::setSelectedByValue(const LLSD& value, BOOL selected) +bool LLRadioGroup::setSelectedByValue(const LLSD& value, bool selected) { S32 idx = 0; for (button_list_t::const_iterator iter = mRadioButtons.begin(); @@ -400,12 +400,12 @@ BOOL LLRadioGroup::setSelectedByValue(const LLSD& value, BOOL selected) if((*iter)->getPayload().asString() == value.asString()) { setSelectedIndex(idx); - return TRUE; + return true; } idx++; } - return FALSE; + return false; } LLSD LLRadioGroup::getSelectedValue() @@ -413,7 +413,7 @@ LLSD LLRadioGroup::getSelectedValue() return getValue(); } -BOOL LLRadioGroup::isSelected(const LLSD& value) const +bool LLRadioGroup::isSelected(const LLSD& value) const { S32 idx = 0; for (button_list_t::const_iterator iter = mRadioButtons.begin(); @@ -423,22 +423,22 @@ BOOL LLRadioGroup::isSelected(const LLSD& value) const { if (idx == mSelectedIndex) { - return TRUE; + return true; } } idx++; } - return FALSE; + return false; } -BOOL LLRadioGroup::operateOnSelection(EOperation op) +bool LLRadioGroup::operateOnSelection(EOperation op) { - return FALSE; + return false; } -BOOL LLRadioGroup::operateOnAll(EOperation op) +bool LLRadioGroup::operateOnAll(EOperation op) { - return FALSE; + return false; } LLRadioGroup::ItemParams::ItemParams() @@ -458,7 +458,7 @@ LLRadioCtrl::LLRadioCtrl(const LLRadioGroup::ItemParams& p) } } -BOOL LLRadioCtrl::postBuild() +bool LLRadioCtrl::postBuild() { // Old-style radio_item used the text contents to indicate the label, // but new-style radio_item uses label attribute. @@ -467,15 +467,15 @@ BOOL LLRadioCtrl::postBuild() { setLabel(value); } - return TRUE; + return true; } -BOOL LLRadioCtrl::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLRadioCtrl::handleMouseDown(S32 x, S32 y, MASK mask) { // Grab focus preemptively, before button takes mousecapture if (hasTabStop() && getEnabled()) { - focusFirstItem(FALSE, FALSE); + focusFirstItem(false, false); } else { diff --git a/indra/llui/llradiogroup.h b/indra/llui/llradiogroup.h index ca8883dce4..a24a7c86b2 100644 --- a/indra/llui/llradiogroup.h +++ b/indra/llui/llradiogroup.h @@ -64,15 +64,15 @@ public: virtual ~LLRadioGroup(); - virtual BOOL postBuild(); + virtual bool postBuild(); - virtual BOOL handleKeyHere(KEY key, MASK mask); + virtual bool handleKeyHere(KEY key, MASK mask); - void setIndexEnabled(S32 index, BOOL enabled); + void setIndexEnabled(S32 index, bool enabled); // return the index value of the selected item S32 getSelectedIndex() const { return mSelectedIndex; } // set the index value programatically - BOOL setSelectedIndex(S32 index, BOOL from_event = FALSE); + bool setSelectedIndex(S32 index, bool from_event = false); // foxus child by index if it can get focus void focusSelectedRadioBtn(); @@ -87,19 +87,19 @@ public: LLCtrlSelectionInterface* getSelectionInterface() { return (LLCtrlSelectionInterface*)this; }; // LLCtrlSelectionInterface functions - /*virtual*/ S32 getItemCount() const { return mRadioButtons.size(); } - /*virtual*/ BOOL getCanSelect() const { return TRUE; } - /*virtual*/ BOOL selectFirstItem() { return setSelectedIndex(0); } - /*virtual*/ BOOL selectNthItem( S32 index ) { return setSelectedIndex(index); } - /*virtual*/ BOOL selectItemRange( S32 first, S32 last ) { return setSelectedIndex(first); } + /*virtual*/ S32 getItemCount() const { return static_cast<S32>(mRadioButtons.size()); } + /*virtual*/ bool getCanSelect() const { return true; } + /*virtual*/ bool selectFirstItem() { return setSelectedIndex(0); } + /*virtual*/ bool selectNthItem( S32 index ) { return setSelectedIndex(index); } + /*virtual*/ bool selectItemRange( S32 first, S32 last ) { return setSelectedIndex(first); } /*virtual*/ S32 getFirstSelectedIndex() const { return getSelectedIndex(); } - /*virtual*/ BOOL setCurrentByID( const LLUUID& id ); + /*virtual*/ bool setCurrentByID( const LLUUID& id ); /*virtual*/ LLUUID getCurrentID() const; // LLUUID::null if no items in menu - /*virtual*/ BOOL setSelectedByValue(const LLSD& value, BOOL selected); + /*virtual*/ bool setSelectedByValue(const LLSD& value, bool selected); /*virtual*/ LLSD getSelectedValue(); - /*virtual*/ BOOL isSelected(const LLSD& value) const; - /*virtual*/ BOOL operateOnSelection(EOperation op); - /*virtual*/ BOOL operateOnAll(EOperation op); + /*virtual*/ bool isSelected(const LLSD& value) const; + /*virtual*/ bool operateOnSelection(EOperation op); + /*virtual*/ bool operateOnAll(EOperation op); private: const LLFontGL* mFont; diff --git a/indra/llui/llresizebar.cpp b/indra/llui/llresizebar.cpp index cec0734735..a022fd2853 100644 --- a/indra/llui/llresizebar.cpp +++ b/indra/llui/llresizebar.cpp @@ -89,9 +89,9 @@ LLResizeBar::LLResizeBar(const LLResizeBar::Params& p) } } -BOOL LLResizeBar::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLResizeBar::handleMouseDown(S32 x, S32 y, MASK mask) { - if (!canResize()) return FALSE; + if (!canResize()) return false; // Route future Mouse messages here preemptively. (Release on mouse up.) // No handler needed for focus lost since this clas has no state that depends on it. @@ -101,31 +101,31 @@ BOOL LLResizeBar::handleMouseDown(S32 x, S32 y, MASK mask) mLastMouseScreenX = mDragLastScreenX; mLastMouseScreenY = mDragLastScreenY; - return TRUE; + return true; } -BOOL LLResizeBar::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLResizeBar::handleMouseUp(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; if( hasMouseCapture() ) { // Release the mouse gFocusMgr.setMouseCapture( NULL ); - handled = TRUE; + handled = true; } else { - handled = TRUE; + handled = true; } return handled; } -BOOL LLResizeBar::handleHover(S32 x, S32 y, MASK mask) +bool LLResizeBar::handleHover(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; // We only handle the click if the click both started and ended within us if( hasMouseCapture() ) @@ -289,11 +289,11 @@ BOOL LLResizeBar::handleHover(S32 x, S32 y, MASK mask) } } - handled = TRUE; + handled = true; } else { - handled = TRUE; + handled = true; } if( handled && canResize() ) @@ -320,7 +320,7 @@ BOOL LLResizeBar::handleHover(S32 x, S32 y, MASK mask) return handled; } // end LLResizeBar::handleHover -BOOL LLResizeBar::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLResizeBar::handleDoubleClick(S32 x, S32 y, MASK mask) { LLRect orig_rect = mResizingView->getRect(); LLRect scaled_rect = orig_rect; @@ -350,7 +350,7 @@ BOOL LLResizeBar::handleDoubleClick(S32 x, S32 y, MASK mask) mResizingView->setShape(scaled_rect, true); } - return TRUE; + return true; } void LLResizeBar::setImagePanel(LLPanel * panelp) diff --git a/indra/llui/llresizebar.h b/indra/llui/llresizebar.h index 0fcecd1dbe..4b0f435834 100644 --- a/indra/llui/llresizebar.h +++ b/indra/llui/llresizebar.h @@ -53,14 +53,14 @@ protected: public: - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + virtual bool handleHover(S32 x, S32 y, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleDoubleClick(S32 x, S32 y, MASK mask); void setResizeLimits( S32 min_size, S32 max_size ) { mMinSize = min_size; mMaxSize = max_size; } - void setEnableSnapping(BOOL enable) { mSnappingEnabled = enable; } - void setAllowDoubleClickSnapping(BOOL allow) { mAllowDoubleClickSnapping = allow; } + void setEnableSnapping(bool enable) { mSnappingEnabled = enable; } + void setAllowDoubleClickSnapping(bool allow) { mAllowDoubleClickSnapping = allow; } bool canResize() { return getEnabled() && mMaxSize > mMinSize; } void setResizeListener(boost::function<void(void*)> listener) {mResizeListener = listener;} void setImagePanel(LLPanel * panelp); diff --git a/indra/llui/llresizehandle.cpp b/indra/llui/llresizehandle.cpp index 29ae13b7ff..0b7bb55360 100644 --- a/indra/llui/llresizehandle.cpp +++ b/indra/llui/llresizehandle.cpp @@ -76,12 +76,12 @@ LLResizeHandle::~LLResizeHandle() } -BOOL LLResizeHandle::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLResizeHandle::handleMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; if( pointInHandle(x, y) ) { - handled = TRUE; + handled = true; // Route future Mouse messages here preemptively. (Release on mouse up.) // No handler needed for focus lost since this clas has no state that depends on it. gFocusMgr.setMouseCapture( this ); @@ -95,28 +95,28 @@ BOOL LLResizeHandle::handleMouseDown(S32 x, S32 y, MASK mask) } -BOOL LLResizeHandle::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLResizeHandle::handleMouseUp(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; if( hasMouseCapture() ) { // Release the mouse gFocusMgr.setMouseCapture( NULL ); - handled = TRUE; + handled = true; } else if( pointInHandle(x, y) ) { - handled = TRUE; + handled = true; } return handled; } -BOOL LLResizeHandle::handleHover(S32 x, S32 y, MASK mask) +bool LLResizeHandle::handleHover(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; // We only handle the click if the click both started and ended within us if( hasMouseCapture() ) @@ -327,13 +327,13 @@ BOOL LLResizeHandle::handleHover(S32 x, S32 y, MASK mask) } } - handled = TRUE; + handled = true; } else // don't have mouse capture { if( pointInHandle( x, y ) ) { - handled = TRUE; + handled = true; } } @@ -366,7 +366,7 @@ void LLResizeHandle::draw() } -BOOL LLResizeHandle::pointInHandle( S32 x, S32 y ) +bool LLResizeHandle::pointInHandle( S32 x, S32 y ) { if( pointInView(x, y) ) { @@ -378,8 +378,8 @@ BOOL LLResizeHandle::pointInHandle( S32 x, S32 y ) case LEFT_TOP: return (x <= RESIZE_BORDER_WIDTH) || (y >= TOP_BORDER); case LEFT_BOTTOM: return (x <= RESIZE_BORDER_WIDTH) || (y <= RESIZE_BORDER_WIDTH); case RIGHT_TOP: return (x >= RIGHT_BORDER) || (y >= TOP_BORDER); - case RIGHT_BOTTOM: return TRUE; + case RIGHT_BOTTOM: return true; } } - return FALSE; + return false; } diff --git a/indra/llui/llresizehandle.h b/indra/llui/llresizehandle.h index d29894f607..9cc4123544 100644 --- a/indra/llui/llresizehandle.h +++ b/indra/llui/llresizehandle.h @@ -51,14 +51,14 @@ protected: friend class LLUICtrlFactory; public: virtual void draw(); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleHover(S32 x, S32 y, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); void setResizeLimits( S32 min_width, S32 min_height ) { mMinWidth = min_width; mMinHeight = min_height; } private: - BOOL pointInHandle( S32 x, S32 y ); + bool pointInHandle( S32 x, S32 y ); S32 mDragLastScreenX; S32 mDragLastScreenY; diff --git a/indra/llui/llresmgr.cpp b/indra/llui/llresmgr.cpp index a6a4a541f2..111c732548 100644 --- a/indra/llui/llresmgr.cpp +++ b/indra/llui/llresmgr.cpp @@ -51,14 +51,6 @@ char LLResMgr::getDecimalPoint() const { char decimal = localeconv()->decimal_point[0]; -#if LL_DARWIN - // On the Mac, locale support is broken before 10.4, which causes things to go all pear-shaped. - if(decimal == 0) - { - decimal = '.'; - } -#endif - return decimal; } @@ -66,14 +58,6 @@ char LLResMgr::getThousandsSeparator() const { char separator = localeconv()->thousands_sep[0]; -#if LL_DARWIN - // On the Mac, locale support is broken before 10.4, which causes things to go all pear-shaped. - if(separator == 0) - { - separator = ','; - } -#endif - return separator; } @@ -81,14 +65,6 @@ char LLResMgr::getMonetaryDecimalPoint() const { char decimal = localeconv()->mon_decimal_point[0]; -#if LL_DARWIN - // On the Mac, locale support is broken before 10.4, which causes things to go all pear-shaped. - if(decimal == 0) - { - decimal = '.'; - } -#endif - return decimal; } @@ -96,14 +72,6 @@ char LLResMgr::getMonetaryThousandsSeparator() const { char separator = localeconv()->mon_thousands_sep[0]; -#if LL_DARWIN - // On the Mac, locale support is broken before 10.4, which causes things to go all pear-shaped. - if(separator == 0) - { - separator = ','; - } -#endif - return separator; } @@ -116,29 +84,6 @@ std::string LLResMgr::getMonetaryString( S32 input ) const LLLocale locale(LLLocale::USER_LOCALE); struct lconv *conv = localeconv(); -#if LL_DARWIN - // On the Mac, locale support is broken before 10.4, which causes things to go all pear-shaped. - // Fake up a conv structure with some reasonable values for the fields this function uses. - struct lconv fakeconv; - char fake_neg[2] = "-"; - char fake_mon_group[4] = "\x03\x03\x00"; // commas every 3 digits - if(conv->negative_sign[0] == 0) // Real locales all seem to have something here... - { - fakeconv = *conv; // start with what's there. - switch(mLocale) - { - default: // Unknown -- use the US defaults. - case LLLOCALE_USA: - case LLLOCALE_UK: // UK ends up being the same as US for the items used here. - fakeconv.negative_sign = fake_neg; - fakeconv.mon_grouping = fake_mon_group; - fakeconv.n_sign_posn = 1; // negative sign before the string - break; - } - conv = &fakeconv; - } -#endif - char* negative_sign = conv->negative_sign; char separator = getMonetaryThousandsSeparator(); char* grouping = conv->mon_grouping; @@ -154,9 +99,9 @@ std::string LLResMgr::getMonetaryString( S32 input ) const // Note: we assume here that the currency symbol goes on the left. (Hey, it's Lindens! We can just decide.) - BOOL negative = (input < 0 ); - BOOL negative_before = negative && (conv->n_sign_posn != 2); - BOOL negative_after = negative && (conv->n_sign_posn == 2); + bool negative = (input < 0 ); + bool negative_before = negative && (conv->n_sign_posn != 2); + bool negative_after = negative && (conv->n_sign_posn == 2); std::string digits = llformat("%u", abs(input)); if( !grouping || !grouping[0] ) @@ -195,7 +140,7 @@ std::string LLResMgr::getMonetaryString( S32 input ) const S32 output_pos = 0; cur_group = 0; - S32 pos = digits.size()-1; + S32 pos = static_cast<S32>(digits.size()) - 1; S32 count_within_group = 0; while( (pos >= 0) && (groupings[cur_group] >= 0) ) { diff --git a/indra/llui/llscrollbar.cpp b/indra/llui/llscrollbar.cpp index fda4a750cd..9c73b1ba3f 100644 --- a/indra/llui/llscrollbar.cpp +++ b/indra/llui/llscrollbar.cpp @@ -73,7 +73,7 @@ LLScrollbar::LLScrollbar(const Params & p) mDocPos( p.doc_pos ), mPageSize( p.page_size ), mStepSize( p.step_size ), - mDocChanged(FALSE), + mDocChanged(false), mDragStartX( 0 ), mDragStartY( 0 ), mHoverGlowStrength(0.15f), @@ -136,19 +136,19 @@ void LLScrollbar::setDocParams( S32 size, S32 pos ) { mDocSize = size; setDocPos(pos); - mDocChanged = TRUE; + mDocChanged = true; updateThumbRect(); } // returns true if document position really changed -bool LLScrollbar::setDocPos(S32 pos, BOOL update_thumb) +bool LLScrollbar::setDocPos(S32 pos, bool update_thumb) { pos = llclamp(pos, 0, getDocPosMax()); if (pos != mDocPos) { mDocPos = pos; - mDocChanged = TRUE; + mDocChanged = true; if( mChangeCallback ) { @@ -170,7 +170,7 @@ void LLScrollbar::setDocSize(S32 size) { mDocSize = size; setDocPos(mDocPos); - mDocChanged = TRUE; + mDocChanged = true; updateThumbRect(); } @@ -182,7 +182,7 @@ void LLScrollbar::setPageSize( S32 page_size ) { mPageSize = page_size; setDocPos(mDocPos); - mDocChanged = TRUE; + mDocChanged = true; updateThumbRect(); } @@ -238,10 +238,10 @@ void LLScrollbar::updateThumbRect() } } -BOOL LLScrollbar::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLScrollbar::handleMouseDown(S32 x, S32 y, MASK mask) { // Check children first - BOOL handled_by_child = LLView::childrenHandleMouseDown(x, y, mask) != NULL; + bool handled_by_child = LLView::childrenHandleMouseDown(x, y, mask) != NULL; if( !handled_by_child ) { if( mThumbRect.pointInRect(x,y) ) @@ -279,16 +279,16 @@ BOOL LLScrollbar::handleMouseDown(S32 x, S32 y, MASK mask) } } - return TRUE; + return true; } -BOOL LLScrollbar::handleHover(S32 x, S32 y, MASK mask) +bool LLScrollbar::handleHover(S32 x, S32 y, MASK mask) { // Note: we don't bother sending the event to the children (the arrow buttons) // because they'll capture the mouse whenever they need hover events. - BOOL handled = FALSE; + bool handled = false; if( hasMouseCapture() ) { S32 height = getRect().getHeight(); @@ -329,7 +329,7 @@ BOOL LLScrollbar::handleHover(S32 x, S32 y, MASK mask) S32 new_pos = llclamp( S32(variable_lines - ratio * variable_lines + 0.5f), 0, variable_lines ); // Note: we do not call updateThumbRect() here. Instead we let the thumb and the document go slightly // out of sync (less than a line's worth) to make the thumb feel responsive. - changeLine( new_pos - mDocPos, FALSE ); + changeLine( new_pos - mDocPos, false ); } } @@ -373,7 +373,7 @@ BOOL LLScrollbar::handleHover(S32 x, S32 y, MASK mask) // Note: we do not call updateThumbRect() here. Instead we let the thumb and the document go slightly // out of sync (less than a line's worth) to make the thumb feel responsive. - changeLine( new_pos - mDocPos, FALSE ); + changeLine( new_pos - mDocPos, false ); } } @@ -382,7 +382,7 @@ BOOL LLScrollbar::handleHover(S32 x, S32 y, MASK mask) getWindow()->setCursor(UI_CURSOR_ARROW); LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (active)" << LL_ENDL; - handled = TRUE; + handled = true; } else { @@ -394,31 +394,31 @@ BOOL LLScrollbar::handleHover(S32 x, S32 y, MASK mask) { getWindow()->setCursor(UI_CURSOR_ARROW); LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (inactive)" << LL_ENDL; - handled = TRUE; + handled = true; } - mDocChanged = FALSE; + mDocChanged = false; return handled; } // end handleHover -BOOL LLScrollbar::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLScrollbar::handleScrollWheel(S32 x, S32 y, S32 clicks) { - BOOL handled = changeLine( clicks * mStepSize, TRUE ); + bool handled = changeLine( clicks * mStepSize, true ); return handled; } -BOOL LLScrollbar::handleScrollHWheel(S32 x, S32 y, S32 clicks) +bool LLScrollbar::handleScrollHWheel(S32 x, S32 y, S32 clicks) { - BOOL handled = FALSE; + bool handled = false; if (LLScrollbar::HORIZONTAL == mOrientation) { - handled = changeLine(clicks * mStepSize, TRUE); + handled = changeLine(clicks * mStepSize, true); } return handled; } -BOOL LLScrollbar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +bool LLScrollbar::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string &tooltip_msg) { // enable this to get drag and drop to control scrollbars @@ -434,19 +434,19 @@ BOOL LLScrollbar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, // : F32(pos - SCROLLBAR_SIZE) / usable_track_length; // S32 new_pos = (VERTICAL == mOrientation) ? llclamp( S32(variable_lines - ratio * variable_lines + 0.5f), 0, variable_lines ) // : llclamp( S32(ratio * variable_lines + 0.5f), 0, variable_lines ); - // changeLine( new_pos - mDocPos, TRUE ); + // changeLine( new_pos - mDocPos, true ); //} - //return TRUE; - return FALSE; + //return true; + return false; } -BOOL LLScrollbar::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLScrollbar::handleMouseUp(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; if( hasMouseCapture() ) { gFocusMgr.setMouseCapture( NULL ); - handled = TRUE; + handled = true; } else { @@ -457,14 +457,14 @@ BOOL LLScrollbar::handleMouseUp(S32 x, S32 y, MASK mask) return handled; } -BOOL LLScrollbar::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLScrollbar::handleDoubleClick(S32 x, S32 y, MASK mask) { // just treat a double click as a second click return handleMouseDown(x, y, mask); } -void LLScrollbar::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLScrollbar::reshape(S32 width, S32 height, bool called_from_parent) { if (width == getRect().getWidth() && height == getRect().getHeight()) return; LLView::reshape( width, height, called_from_parent ); @@ -495,14 +495,14 @@ void LLScrollbar::draw() if(mBGVisible) { - gl_rect_2d(getLocalRect(), mBGColor.get(), TRUE); + gl_rect_2d(getLocalRect(), mBGColor.get(), true); } S32 local_mouse_x; S32 local_mouse_y; LLUI::getInstance()->getMousePositionLocal(this, &local_mouse_x, &local_mouse_y); - BOOL other_captor = gFocusMgr.getMouseCapture() && gFocusMgr.getMouseCapture() != this; - BOOL hovered = getEnabled() && !other_captor && (hasMouseCapture() || mThumbRect.pointInRect(local_mouse_x, local_mouse_y)); + bool other_captor = gFocusMgr.getMouseCapture() && gFocusMgr.getMouseCapture() != this; + bool hovered = getEnabled() && !other_captor && (hasMouseCapture() || mThumbRect.pointInRect(local_mouse_x, local_mouse_y)); if (hovered) { mCurGlowStrength = lerp(mCurGlowStrength, mHoverGlowStrength, LLSmoothInterpolation::getInterpolant(0.05f)); @@ -519,9 +519,9 @@ void LLScrollbar::draw() gl_rect_2d(mOrientation == HORIZONTAL ? mThickness : 0, mOrientation == VERTICAL ? getRect().getHeight() - 2 * mThickness : getRect().getHeight(), mOrientation == HORIZONTAL ? getRect().getWidth() - 2 * mThickness : getRect().getWidth(), - mOrientation == VERTICAL ? mThickness : 0, mTrackColor.get(), TRUE); + mOrientation == VERTICAL ? mThickness : 0, mTrackColor.get(), true); - gl_rect_2d(mThumbRect, mThumbColor.get(), TRUE); + gl_rect_2d(mThumbRect, mThumbColor.get(), true); } else @@ -580,7 +580,7 @@ void LLScrollbar::draw() } // end draw -bool LLScrollbar::changeLine( S32 delta, BOOL update_thumb ) +bool LLScrollbar::changeLine( S32 delta, bool update_thumb ) { return setDocPos(mDocPos + delta, update_thumb); } @@ -591,35 +591,35 @@ void LLScrollbar::setValue(const LLSD& value) } -BOOL LLScrollbar::handleKeyHere(KEY key, MASK mask) +bool LLScrollbar::handleKeyHere(KEY key, MASK mask) { if (getDocPosMax() == 0 && !getVisible()) { - return FALSE; + return false; } - BOOL handled = FALSE; + bool handled = false; switch( key ) { case KEY_HOME: setDocPos( 0 ); - handled = TRUE; + handled = true; break; case KEY_END: setDocPos( getDocPosMax() ); - handled = TRUE; + handled = true; break; case KEY_DOWN: setDocPos( getDocPos() + mStepSize ); - handled = TRUE; + handled = true; break; case KEY_UP: setDocPos( getDocPos() - mStepSize ); - handled = TRUE; + handled = true; break; case KEY_PAGE_DOWN: @@ -638,7 +638,7 @@ void LLScrollbar::pageUp(S32 overlap) { if (mDocSize > mPageSize) { - changeLine( -(mPageSize - overlap), TRUE ); + changeLine( -(mPageSize - overlap), true ); } } @@ -646,18 +646,18 @@ void LLScrollbar::pageDown(S32 overlap) { if (mDocSize > mPageSize) { - changeLine( mPageSize - overlap, TRUE ); + changeLine( mPageSize - overlap, true ); } } void LLScrollbar::onLineUpBtnPressed( const LLSD& data ) { - changeLine( -mStepSize, TRUE ); + changeLine( -mStepSize, true ); } void LLScrollbar::onLineDownBtnPressed( const LLSD& data ) { - changeLine( mStepSize, TRUE ); + changeLine( mStepSize, true ); } void LLScrollbar::setThickness(S32 thickness) diff --git a/indra/llui/llscrollbar.h b/indra/llui/llscrollbar.h index bbfc3a0340..7b935aa51b 100644 --- a/indra/llui/llscrollbar.h +++ b/indra/llui/llscrollbar.h @@ -82,17 +82,17 @@ public: virtual void setValue(const LLSD& value); // Overrides from LLView - virtual BOOL handleKeyHere(KEY key, MASK mask); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); - virtual BOOL handleScrollHWheel(S32 x, S32 y, S32 clicks); - virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + virtual bool handleKeyHere(KEY key, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleDoubleClick(S32 x, S32 y, MASK mask); + virtual bool handleHover(S32 x, S32 y, MASK mask); + virtual bool handleScrollWheel(S32 x, S32 y, S32 clicks); + virtual bool handleScrollHWheel(S32 x, S32 y, S32 clicks); + virtual bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string &tooltip_msg); - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + virtual void reshape(S32 width, S32 height, bool called_from_parent = true); virtual void draw(); @@ -102,7 +102,7 @@ public: // How many "lines" the "document" has scrolled. // 0 <= DocPos <= DocSize - DocVisibile - bool setDocPos( S32 pos, BOOL update_thumb = TRUE ); + bool setDocPos( S32 pos, bool update_thumb = true ); S32 getDocPos() const { return mDocPos; } bool isAtBeginning() const; @@ -129,7 +129,7 @@ public: private: void updateThumbRect(); - bool changeLine(S32 delta, BOOL update_thumb ); + bool changeLine(S32 delta, bool update_thumb ); callback_t mChangeCallback; @@ -138,7 +138,7 @@ private: S32 mDocPos; // Position within the doc that the scrollbar is modeling, in "lines" (user size) S32 mPageSize; // Maximum number of lines that can be seen at one time. S32 mStepSize; - BOOL mDocChanged; + bool mDocChanged; LLRect mThumbRect; S32 mDragStartX; diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp index d0b28e8f22..df99c4f636 100644 --- a/indra/llui/llscrollcontainer.cpp +++ b/indra/llui/llscrollcontainer.cpp @@ -82,7 +82,7 @@ LLScrollContainer::Params::Params() // Default constructor LLScrollContainer::LLScrollContainer(const LLScrollContainer::Params& p) : LLUICtrl(p), - mAutoScrolling( FALSE ), + mAutoScrolling( false ), mAutoScrollRate( 0.f ), mBackgroundColor(p.bg_color()), mIsOpaque(p.is_opaque), @@ -180,7 +180,7 @@ void LLScrollContainer::scrollVertical( S32 new_pos ) // LLView functionality void LLScrollContainer::reshape(S32 width, S32 height, - BOOL called_from_parent) + bool called_from_parent) { LLUICtrl::reshape( width, height, called_from_parent ); @@ -193,8 +193,8 @@ void LLScrollContainer::reshape(S32 width, S32 height, S32 visible_width = 0; S32 visible_height = 0; - BOOL show_v_scrollbar = FALSE; - BOOL show_h_scrollbar = FALSE; + bool show_v_scrollbar = false; + bool show_h_scrollbar = false; calcVisibleSize( &visible_width, &visible_height, &show_h_scrollbar, &show_v_scrollbar ); mScrollbar[VERTICAL]->setDocSize( scrolled_rect.getHeight() ); @@ -207,7 +207,7 @@ void LLScrollContainer::reshape(S32 width, S32 height, } // virtual -BOOL LLScrollContainer::handleKeyHere(KEY key, MASK mask) +bool LLScrollContainer::handleKeyHere(KEY key, MASK mask) { if (mIgnoreArrowKeys) { @@ -221,7 +221,7 @@ BOOL LLScrollContainer::handleKeyHere(KEY key, MASK mask) case KEY_PAGE_DOWN: case KEY_HOME: case KEY_END: - return FALSE; + return false; default: break; } @@ -234,35 +234,35 @@ BOOL LLScrollContainer::handleKeyHere(KEY key, MASK mask) // call LLScrollContainer::handleKeyHere in turn if (mScrolledView && mScrolledView->handleKeyHere(key, mask)) { - return TRUE; + return true; } for( S32 i = 0; i < ORIENTATION_COUNT; i++ ) { if( mScrollbar[i]->handleKeyHere(key, mask) ) { updateScroll(); - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL LLScrollContainer::handleUnicodeCharHere(llwchar uni_char) +bool LLScrollContainer::handleUnicodeCharHere(llwchar uni_char) { if (mScrolledView && mScrolledView->handleUnicodeCharHere(uni_char)) { - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLScrollContainer::handleScrollWheel( S32 x, S32 y, S32 clicks ) +bool LLScrollContainer::handleScrollWheel( S32 x, S32 y, S32 clicks ) { // Give event to my child views - they may have scroll bars // (Bad UI design, but technically possible.) if (LLUICtrl::handleScrollWheel(x,y,clicks)) - return TRUE; + return true; // When the vertical scrollbar is visible, scroll wheel // only affects vertical scrolling. It's confusing to have @@ -278,7 +278,7 @@ BOOL LLScrollContainer::handleScrollWheel( S32 x, S32 y, S32 clicks ) updateScroll(); } // Always eat the event - return TRUE; + return true; } LLScrollbar* horizontal = mScrollbar[HORIZONTAL]; @@ -289,16 +289,16 @@ BOOL LLScrollContainer::handleScrollWheel( S32 x, S32 y, S32 clicks ) && horizontal->handleScrollWheel( 0, 0, clicks ) ) { updateScroll(); - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLScrollContainer::handleScrollHWheel(S32 x, S32 y, S32 clicks) +bool LLScrollContainer::handleScrollHWheel(S32 x, S32 y, S32 clicks) { if (LLUICtrl::handleScrollHWheel(x,y,clicks)) { - return TRUE; + return true; } LLScrollbar* horizontal = mScrollbar[HORIZONTAL]; @@ -307,14 +307,14 @@ BOOL LLScrollContainer::handleScrollHWheel(S32 x, S32 y, S32 clicks) && horizontal->handleScrollHWheel( 0, 0, clicks ) ) { updateScroll(); - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLScrollContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, - BOOL drop, +bool LLScrollContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, + bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -322,7 +322,7 @@ BOOL LLScrollContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, { // Scroll folder view if needed. Never accepts a drag or drop. *accept = ACCEPT_NO; - BOOL handled = autoScroll(x, y); + bool handled = autoScroll(x, y); if( !handled ) { @@ -330,7 +330,7 @@ BOOL LLScrollContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, cargo_data, accept, tooltip_msg) != NULL; } - return TRUE; + return true; } bool LLScrollContainer::canAutoScroll(S32 x, S32 y) @@ -387,7 +387,7 @@ bool LLScrollContainer::autoScroll(S32 x, S32 y, bool do_scroll) if (do_scroll) { mScrollbar[HORIZONTAL]->setDocPos(mScrollbar[HORIZONTAL]->getDocPos() - auto_scroll_speed); - mAutoScrolling = TRUE; + mAutoScrolling = true; } scrolling = true; } @@ -399,7 +399,7 @@ bool LLScrollContainer::autoScroll(S32 x, S32 y, bool do_scroll) if (do_scroll) { mScrollbar[HORIZONTAL]->setDocPos(mScrollbar[HORIZONTAL]->getDocPos() + auto_scroll_speed); - mAutoScrolling = TRUE; + mAutoScrolling = true; } scrolling = true; } @@ -413,7 +413,7 @@ bool LLScrollContainer::autoScroll(S32 x, S32 y, bool do_scroll) if (do_scroll) { mScrollbar[VERTICAL]->setDocPos(mScrollbar[VERTICAL]->getDocPos() + auto_scroll_speed); - mAutoScrolling = TRUE; + mAutoScrolling = true; } scrolling = true; } @@ -425,7 +425,7 @@ bool LLScrollContainer::autoScroll(S32 x, S32 y, bool do_scroll) if (do_scroll) { mScrollbar[VERTICAL]->setDocPos(mScrollbar[VERTICAL]->getDocPos() - auto_scroll_speed); - mAutoScrolling = TRUE; + mAutoScrolling = true; } scrolling = true; } @@ -434,7 +434,7 @@ bool LLScrollContainer::autoScroll(S32 x, S32 y, bool do_scroll) return scrolling; } -void LLScrollContainer::calcVisibleSize( S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar ) const +void LLScrollContainer::calcVisibleSize( S32 *visible_width, S32 *visible_height, bool* show_h_scrollbar, bool* show_v_scrollbar ) const { const LLRect& doc_rect = getScrolledViewRect(); static LLUICachedControl<S32> scrollbar_size_control ("UIScrollbarSize", 0); @@ -447,8 +447,8 @@ void LLScrollContainer::calcVisibleSize( S32 *visible_width, S32 *visible_height *visible_width = getRect().getWidth() - 2 * border_width; *visible_height = getRect().getHeight() - 2 * border_width; - *show_v_scrollbar = FALSE; - *show_h_scrollbar = FALSE; + *show_v_scrollbar = false; + *show_h_scrollbar = false; if (!mHideScrollbar) { @@ -456,12 +456,12 @@ void LLScrollContainer::calcVisibleSize( S32 *visible_width, S32 *visible_height // the display of sliders. if ((doc_height - *visible_height) > 1) { - *show_v_scrollbar = TRUE; + *show_v_scrollbar = true; *visible_width -= scrollbar_size; } if ((doc_width - *visible_width) > 1) { - *show_h_scrollbar = TRUE; + *show_h_scrollbar = true; *visible_height -= scrollbar_size; // Note: Do *not* recompute *show_v_scrollbar here because with // The view inside the scroll container should not be extended @@ -470,7 +470,7 @@ void LLScrollContainer::calcVisibleSize( S32 *visible_width, S32 *visible_height if( !*show_v_scrollbar && ((doc_height - *visible_height) > 1) ) { - *show_v_scrollbar = TRUE; + *show_v_scrollbar = true; *visible_width -= scrollbar_size; } } @@ -494,7 +494,7 @@ void LLScrollContainer::draw() mAutoScrollRate = mMinAutoScrollRate; } // clear this flag to be set on next call to autoScroll - mAutoScrolling = FALSE; + mAutoScrolling = false; // auto-focus when scrollbar active // this allows us to capture user intent (i.e. stop automatically scrolling the view/etc) @@ -527,8 +527,8 @@ void LLScrollContainer::draw() { S32 visible_width = 0; S32 visible_height = 0; - BOOL show_v_scrollbar = FALSE; - BOOL show_h_scrollbar = FALSE; + bool show_v_scrollbar = false; + bool show_h_scrollbar = false; calcVisibleSize( &visible_width, &visible_height, &show_h_scrollbar, &show_v_scrollbar ); LLLocalClipRect clip(LLRect(mInnerRect.mLeft, @@ -599,8 +599,8 @@ void LLScrollContainer::updateScroll() S32 doc_height = doc_rect.getHeight(); S32 visible_width = 0; S32 visible_height = 0; - BOOL show_v_scrollbar = FALSE; - BOOL show_h_scrollbar = FALSE; + bool show_v_scrollbar = false; + bool show_h_scrollbar = false; calcVisibleSize( &visible_width, &visible_height, &show_h_scrollbar, &show_v_scrollbar ); S32 border_width = getBorderWidth(); @@ -612,14 +612,14 @@ void LLScrollContainer::updateScroll() } scrollVertical( mScrollbar[VERTICAL]->getDocPos() ); - mScrollbar[VERTICAL]->setVisible( TRUE ); + mScrollbar[VERTICAL]->setVisible( true ); S32 v_scrollbar_height = visible_height; if( !show_h_scrollbar && mReserveScrollCorner ) { v_scrollbar_height -= scrollbar_size; } - mScrollbar[VERTICAL]->reshape( scrollbar_size, v_scrollbar_height, TRUE ); + mScrollbar[VERTICAL]->reshape( scrollbar_size, v_scrollbar_height, true ); // Make room for the horizontal scrollbar (or not) S32 v_scrollbar_offset = 0; @@ -635,7 +635,7 @@ void LLScrollContainer::updateScroll() { mScrolledView->translate( 0, getRect().getHeight() - border_width - doc_rect.mTop ); - mScrollbar[VERTICAL]->setVisible( FALSE ); + mScrollbar[VERTICAL]->setVisible( false ); mScrollbar[VERTICAL]->setDocPos( 0 ); } @@ -651,19 +651,19 @@ void LLScrollContainer::updateScroll() scrollHorizontal( mScrollbar[HORIZONTAL]->getDocPos() ); } - mScrollbar[HORIZONTAL]->setVisible( TRUE ); + mScrollbar[HORIZONTAL]->setVisible( true ); S32 h_scrollbar_width = visible_width; if( !show_v_scrollbar && mReserveScrollCorner ) { h_scrollbar_width -= scrollbar_size; } - mScrollbar[HORIZONTAL]->reshape( h_scrollbar_width, scrollbar_size, TRUE ); + mScrollbar[HORIZONTAL]->reshape( h_scrollbar_width, scrollbar_size, true ); } else { mScrolledView->translate( border_width - doc_rect.mLeft, 0 ); - mScrollbar[HORIZONTAL]->setVisible( FALSE ); + mScrollbar[HORIZONTAL]->setVisible( false ); mScrollbar[HORIZONTAL]->setDocPos( 0 ); } @@ -674,7 +674,7 @@ void LLScrollContainer::updateScroll() mScrollbar[VERTICAL]->setPageSize( visible_height ); } // end updateScroll -void LLScrollContainer::setBorderVisible(BOOL b) +void LLScrollContainer::setBorderVisible(bool b) { mBorder->setVisible( b ); // Recompute inner rect, as border visibility changes it @@ -697,8 +697,8 @@ LLRect LLScrollContainer::getContentWindowRect() LLRect scroller_view_rect; S32 visible_width = 0; S32 visible_height = 0; - BOOL show_h_scrollbar = FALSE; - BOOL show_v_scrollbar = FALSE; + bool show_h_scrollbar = false; + bool show_v_scrollbar = false; calcVisibleSize( &visible_width, &visible_height, &show_h_scrollbar, &show_v_scrollbar ); S32 border_width = getBorderWidth(); scroller_view_rect.setOriginAndSize(border_width, diff --git a/indra/llui/llscrollcontainer.h b/indra/llui/llscrollcontainer.h index 1295406a3d..859750d71c 100644 --- a/indra/llui/llscrollcontainer.h +++ b/indra/llui/llscrollcontainer.h @@ -86,12 +86,12 @@ public: virtual void setValue(const LLSD& value) { mInnerRect.setValue(value); } - void setBorderVisible( BOOL b ); + void setBorderVisible( bool b ); void scrollToShowRect( const LLRect& rect, const LLRect& constraint); void scrollToShowRect( const LLRect& rect) { scrollToShowRect(rect, LLRect(0, mInnerRect.getHeight(), mInnerRect.getWidth(), 0)); } - void setReserveScrollCorner( BOOL b ) { mReserveScrollCorner = b; } + void setReserveScrollCorner( bool b ) { mReserveScrollCorner = b; } LLRect getVisibleContentRect(); LLRect getContentWindowRect(); virtual const LLRect getScrolledViewRect() const { return mScrolledView ? mScrolledView->getRect() : LLRect::null; } @@ -106,12 +106,12 @@ public: S32 getBorderWidth() const; // LLView functionality - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); - virtual BOOL handleKeyHere(KEY key, MASK mask); - virtual BOOL handleUnicodeCharHere(llwchar uni_char); - virtual BOOL handleScrollWheel( S32 x, S32 y, S32 clicks ); - virtual BOOL handleScrollHWheel( S32 x, S32 y, S32 clicks ); - virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + virtual void reshape(S32 width, S32 height, bool called_from_parent = true); + virtual bool handleKeyHere(KEY key, MASK mask); + virtual bool handleUnicodeCharHere(llwchar uni_char); + virtual bool handleScrollWheel( S32 x, S32 y, S32 clicks ); + virtual bool handleScrollHWheel( S32 x, S32 y, S32 clicks ); + virtual bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -135,16 +135,16 @@ private: virtual void scrollVertical( S32 new_pos ); void updateScroll(); bool autoScroll(S32 x, S32 y, bool do_scroll); - void calcVisibleSize( S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar ) const; + void calcVisibleSize( S32 *visible_width, S32 *visible_height, bool* show_h_scrollbar, bool* show_v_scrollbar ) const; LLScrollbar* mScrollbar[ORIENTATION_COUNT]; S32 mSize; - BOOL mIsOpaque; + bool mIsOpaque; LLUIColor mBackgroundColor; LLRect mInnerRect; LLViewBorder* mBorder; - BOOL mReserveScrollCorner; - BOOL mAutoScrolling; + bool mReserveScrollCorner; + bool mAutoScrolling; F32 mAutoScrollRate; F32 mMinAutoScrollRate; F32 mMaxAutoScrollRate; diff --git a/indra/llui/llscrollingpanellist.cpp b/indra/llui/llscrollingpanellist.cpp index b07f22d7ef..b158d7b1b7 100644 --- a/indra/llui/llscrollingpanellist.cpp +++ b/indra/llui/llscrollingpanellist.cpp @@ -114,7 +114,7 @@ void LLScrollingPanelList::removePanel( U32 panel_index ) rearrange(); } -void LLScrollingPanelList::updatePanels(BOOL allow_modify) +void LLScrollingPanelList::updatePanels(bool allow_modify) { for (std::deque<LLScrollingPanel*>::iterator iter = mPanelList.begin(); iter != mPanelList.end(); ++iter) @@ -224,7 +224,7 @@ void LLScrollingPanelList::updatePanelVisiblilty() local_rect.getWidth(), local_rect.getHeight(), &screen_rect.mRight, &screen_rect.mTop ); - BOOL intersects = + bool intersects = ( (screen_rect.mRight > parent_screen_rect.mLeft) && (screen_rect.mLeft < parent_screen_rect.mRight) ) && ( (screen_rect.mTop > parent_screen_rect.mBottom) && (screen_rect.mBottom < parent_screen_rect.mTop) ); diff --git a/indra/llui/llscrollingpanellist.h b/indra/llui/llscrollingpanellist.h index ad717a455b..309ce4592d 100644 --- a/indra/llui/llscrollingpanellist.h +++ b/indra/llui/llscrollingpanellist.h @@ -40,7 +40,7 @@ class LLScrollingPanel : public LLPanel { public: LLScrollingPanel(const LLPanel::Params& params) : LLPanel(params) {} - virtual void updatePanel(BOOL allow_modify) = 0; + virtual void updatePanel(bool allow_modify) = 0; }; @@ -74,7 +74,7 @@ public: S32 addPanel(LLScrollingPanel* panel, bool back = false); void removePanel(LLScrollingPanel* panel); void removePanel(U32 panel_index); - void updatePanels(BOOL allow_modify); + void updatePanels(bool allow_modify); void rearrange(); const panel_list_t& getPanelList() const { return mPanelList; } diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp index 7fcb91bba3..403879646d 100644 --- a/indra/llui/llscrolllistcell.cpp +++ b/indra/llui/llscrolllistcell.cpp @@ -281,9 +281,9 @@ void LLScrollListText::highlightText(S32 offset, S32 num_chars) } //virtual -BOOL LLScrollListText::isText() const +bool LLScrollListText::isText() const { - return TRUE; + return true; } // virtual @@ -298,7 +298,7 @@ const std::string &LLScrollListText::getToolTip() const } // virtual -BOOL LLScrollListText::needsToolTip() const +bool LLScrollListText::needsToolTip() const { // If base class has a tooltip, return that if (LLScrollListCell::needsToolTip()) @@ -309,7 +309,7 @@ BOOL LLScrollListText::needsToolTip() const } //virtual -BOOL LLScrollListText::getVisible() const +bool LLScrollListText::getVisible() const { return mVisible; } @@ -335,7 +335,7 @@ S32 LLScrollListText::getContentWidth() const void LLScrollListText::setColor(const LLColor4& color) { mColor = color; - mUseColor = TRUE; + mUseColor = true; } void LLScrollListText::setText(const LLStringExplicit& text) @@ -436,7 +436,7 @@ void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_col string_chars, getTextWidth(), &right_x, - TRUE); + true); } // @@ -480,14 +480,14 @@ void LLScrollListCheck::draw(const LLColor4& color, const LLColor4& highlight_co mCheckBox->draw(); } -BOOL LLScrollListCheck::handleClick() +bool LLScrollListCheck::handleClick() { if (mCheckBox->getEnabled()) { mCheckBox->toggle(); } // don't change selection when clicking on embedded checkbox - return TRUE; + return true; } /*virtual*/ @@ -509,7 +509,7 @@ void LLScrollListCheck::onCommit() } /*virtual*/ -void LLScrollListCheck::setEnabled(BOOL enable) +void LLScrollListCheck::setEnabled(bool enable) { mCheckBox->setEnabled(enable); } @@ -660,7 +660,7 @@ void LLScrollListIconText::draw(const LLColor4& color, const LLColor4& highlight string_chars, getTextWidth(), &right_x, - TRUE); + true); if (mIcon) { diff --git a/indra/llui/llscrolllistcell.h b/indra/llui/llscrolllistcell.h index ea2327961a..c5d785ae52 100644 --- a/indra/llui/llscrolllistcell.h +++ b/indra/llui/llscrolllistcell.h @@ -106,16 +106,16 @@ public: virtual void setAltValue(const LLSD& value) { } virtual const std::string &getToolTip() const { return mToolTip; } virtual void setToolTip(const std::string &str) { mToolTip = str; } - virtual BOOL getVisible() const { return TRUE; } + virtual bool getVisible() const { return true; } virtual void setWidth(S32 width) { mWidth = width; } virtual void highlightText(S32 offset, S32 num_chars) {} - virtual BOOL isText() const { return FALSE; } - virtual BOOL needsToolTip() const { return ! mToolTip.empty(); } + virtual bool isText() const { return false; } + virtual bool needsToolTip() const { return ! mToolTip.empty(); } virtual void setColor(const LLColor4&) {} virtual void onCommit() {}; - virtual BOOL handleClick() { return FALSE; } - virtual void setEnabled(BOOL enable) { } + virtual bool handleClick() { return false; } + virtual void setEnabled(bool enable) { } private: S32 mWidth; @@ -146,13 +146,13 @@ public: /*virtual*/ void setAltValue(const LLSD& value); /*virtual*/ const LLSD getValue() const; /*virtual*/ const LLSD getAltValue() const; - /*virtual*/ BOOL getVisible() const; + /*virtual*/ bool getVisible() const; /*virtual*/ void highlightText(S32 offset, S32 num_chars); /*virtual*/ void setColor(const LLColor4&); - /*virtual*/ BOOL isText() const; + /*virtual*/ bool isText() const; /*virtual*/ const std::string & getToolTip() const; - /*virtual*/ BOOL needsToolTip() const; + /*virtual*/ bool needsToolTip() const; S32 getTextWidth() const { return mTextWidth;} void setTextWidth(S32 value) { mTextWidth = value;} @@ -171,7 +171,7 @@ protected: LLColor4 mHighlightColor; U8 mUseColor; LLFontGL::HAlign mFontAlignment; - BOOL mVisible; + bool mVisible; S32 mHighlightCount; S32 mHighlightOffset; @@ -235,8 +235,8 @@ public: /*virtual*/ void setValue(const LLSD& value); /*virtual*/ void onCommit(); - /*virtual*/ BOOL handleClick(); - /*virtual*/ void setEnabled(BOOL enable); + /*virtual*/ bool handleClick(); + /*virtual*/ void setEnabled(bool enable); LLCheckBoxCtrl* getCheckBox() { return mCheckBox; } diff --git a/indra/llui/llscrolllistcolumn.cpp b/indra/llui/llscrolllistcolumn.cpp index 2ef19d1b5a..a4510d1fc2 100644 --- a/indra/llui/llscrolllistcolumn.cpp +++ b/indra/llui/llscrolllistcolumn.cpp @@ -52,7 +52,7 @@ LLScrollColumnHeader::Params::Params() LLScrollColumnHeader::LLScrollColumnHeader(const LLScrollColumnHeader::Params& p) : LLButton(p), // use combobox params to steal images mColumn(p.column), - mHasResizableElement(FALSE) + mHasResizableElement(false) { setClickedCallback(boost::bind(&LLScrollColumnHeader::onClick, this, _2)); @@ -74,12 +74,12 @@ LLScrollColumnHeader::~LLScrollColumnHeader() void LLScrollColumnHeader::draw() { std::string sort_column = mColumn->mParentCtrl->getSortColumnName(); - BOOL draw_arrow = !mColumn->mLabel.empty() + bool draw_arrow = !mColumn->mLabel.empty() && mColumn->mParentCtrl->isSorted() // check for indirect sorting column as well as column's sorting name && (sort_column == mColumn->mSortingColumn || sort_column == mColumn->mName); - BOOL is_ascending = mColumn->mParentCtrl->getSortAscending(); + bool is_ascending = mColumn->mParentCtrl->getSortAscending(); if (draw_arrow) { setImageOverlay(is_ascending ? "up_arrow.tga" : "down_arrow.tga", LLFontGL::RIGHT, LLColor4::white); @@ -93,7 +93,7 @@ void LLScrollColumnHeader::draw() LLButton::draw(); } -BOOL LLScrollColumnHeader::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLScrollColumnHeader::handleDoubleClick(S32 x, S32 y, MASK mask) { if (canResize() && mResizeBar->getRect().pointInRect(x, y)) { @@ -107,7 +107,7 @@ BOOL LLScrollColumnHeader::handleDoubleClick(S32 x, S32 y, MASK mask) { onClick(LLSD()); } - return TRUE; + return true; } void LLScrollColumnHeader::onClick(const LLSD& data) @@ -241,7 +241,7 @@ void LLScrollColumnHeader::handleReshape(const LLRect& new_rect, bool by_user) } } -void LLScrollColumnHeader::setHasResizableElement(BOOL resizable) +void LLScrollColumnHeader::setHasResizableElement(bool resizable) { if (mHasResizableElement != resizable) { @@ -270,7 +270,7 @@ void LLScrollColumnHeader::updateResizeBars() { LLScrollListColumn* columnp = mColumn->mParentCtrl->getColumn(col); if (!columnp || !columnp->mHeader) continue; - BOOL enable = num_resizable_columns >= 2 && num_resizers_enabled < (num_resizable_columns - 1) && columnp->mHeader->canResize(); + bool enable = num_resizable_columns >= 2 && num_resizers_enabled < (num_resizable_columns - 1) && columnp->mHeader->canResize(); columnp->mHeader->enableResizeBar(enable); if (enable) { @@ -279,12 +279,12 @@ void LLScrollColumnHeader::updateResizeBars() } } -void LLScrollColumnHeader::enableResizeBar(BOOL enable) +void LLScrollColumnHeader::enableResizeBar(bool enable) { mResizeBar->setEnabled(enable); } -BOOL LLScrollColumnHeader::canResize() +bool LLScrollColumnHeader::canResize() { return getVisible() && (mHasResizableElement || mColumn->mDynamicWidth); } diff --git a/indra/llui/llscrolllistcolumn.h b/indra/llui/llscrolllistcolumn.h index d535d96c76..72dfcdafe0 100644 --- a/indra/llui/llscrolllistcolumn.h +++ b/indra/llui/llscrolllistcolumn.h @@ -50,23 +50,23 @@ public: ~LLScrollColumnHeader(); /*virtual*/ void draw(); - /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleDoubleClick(S32 x, S32 y, MASK mask); /*virtual*/ LLView* findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding); /*virtual*/ void handleReshape(const LLRect& new_rect, bool by_user = false); LLScrollListColumn* getColumn() { return mColumn; } - void setHasResizableElement(BOOL resizable); + void setHasResizableElement(bool resizable); void updateResizeBars(); - BOOL canResize(); - void enableResizeBar(BOOL enable); + bool canResize(); + void enableResizeBar(bool enable); void onClick(const LLSD& data); private: LLScrollListColumn* mColumn; LLResizeBar* mResizeBar; - BOOL mHasResizableElement; + bool mHasResizableElement; }; /* @@ -158,7 +158,7 @@ public: ESortDirection mSortDirection; LLUIString mLabel; F32 mRelWidth; - BOOL mDynamicWidth; + bool mDynamicWidth; S32 mMaxContentWidth; S32 mIndex; LLScrollListCtrl* mParentCtrl; diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 7fb732eca3..74a9641836 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -66,7 +66,7 @@ static LLDefaultChildRegistry::Register<LLScrollListCtrl> r("scroll_list"); // local structures & classes. struct SortScrollListItem { - SortScrollListItem(const std::vector<std::pair<S32, BOOL> >& sort_orders,const LLScrollListCtrl::sort_signal_t* sort_signal, bool alternate_sort) + SortScrollListItem(const std::vector<std::pair<S32, bool> >& sort_orders,const LLScrollListCtrl::sort_signal_t* sort_signal, bool alternate_sort) : mSortOrders(sort_orders) , mSortSignal(sort_signal) , mAltSort(alternate_sort) @@ -80,7 +80,7 @@ struct SortScrollListItem it != mSortOrders.rend(); ++it) { S32 col_idx = it->first; - BOOL sort_ascending = it->second; + bool sort_ascending = it->second; S32 order = sort_ascending ? 1 : -1; // ascending or descending sort for this column? @@ -114,7 +114,7 @@ struct SortScrollListItem } - typedef std::vector<std::pair<S32, BOOL> > sort_order_t; + typedef std::vector<std::pair<S32, bool> > sort_order_t; const LLScrollListCtrl::sort_signal_t* mSortSignal; const sort_order_t& mSortOrders; const bool mAltSort; @@ -357,7 +357,7 @@ LLScrollListCtrl::~LLScrollListCtrl() } -BOOL LLScrollListCtrl::setMaxItemCount(S32 max_count) +bool LLScrollListCtrl::setMaxItemCount(S32 max_count) { if (max_count >= getItemCount()) { @@ -373,10 +373,10 @@ S32 LLScrollListCtrl::isEmpty() const S32 LLScrollListCtrl::getItemCount() const { - return mItemList.size(); + return static_cast<S32>(mItemList.size()); } -BOOL LLScrollListCtrl::hasSelectedItem() const +bool LLScrollListCtrl::hasSelectedItem() const { item_list::iterator iter; for (iter = mItemList.begin(); iter < mItemList.end(); ) @@ -384,11 +384,11 @@ BOOL LLScrollListCtrl::hasSelectedItem() const LLScrollListItem* itemp = *iter; if (itemp && itemp->getSelected()) { - return TRUE; + return true; } iter++; } - return FALSE; + return false; } // virtual LLScrolListInterface function (was deleteAllItems) @@ -523,7 +523,7 @@ LLScrollListItem* LLScrollListCtrl::getItem(const LLSD& sd) const } -void LLScrollListCtrl::reshape( S32 width, S32 height, BOOL called_from_parent ) +void LLScrollListCtrl::reshape( S32 width, S32 height, bool called_from_parent ) { LLUICtrl::reshape( width, height, called_from_parent ); @@ -551,7 +551,7 @@ void LLScrollListCtrl::updateLayout() // how many lines of content in a single "page" S32 page_lines = getLinesPerPage(); - BOOL scrollbar_visible = mLineHeight * getItemCount() > mItemListRect.getHeight(); + bool scrollbar_visible = mLineHeight * getItemCount() > mItemListRect.getHeight(); if (scrollbar_visible) { // provide space on the right for scrollbar @@ -593,9 +593,9 @@ LLRect LLScrollListCtrl::getRequiredRect() } -BOOL LLScrollListCtrl::addItem( LLScrollListItem* item, EAddPosition pos, BOOL requires_column ) +bool LLScrollListCtrl::addItem( LLScrollListItem* item, EAddPosition pos, bool requires_column ) { - BOOL not_too_big = getItemCount() < mMaxItemCount; + bool not_too_big = getItemCount() < mMaxItemCount; if (not_too_big) { switch( pos ) @@ -851,12 +851,12 @@ void LLScrollListCtrl::setPageLines(S32 new_page_lines) updateLayout(); } -BOOL LLScrollListCtrl::selectFirstItem() +bool LLScrollListCtrl::selectFirstItem() { - BOOL success = FALSE; + bool success = false; // our $%&@#$()^%#$()*^ iterators don't let us check against the first item inside out iteration - BOOL first_item = TRUE; + bool first_item = true; item_list::iterator iter; for (iter = mItemList.begin(); iter != mItemList.end(); iter++) @@ -876,7 +876,7 @@ BOOL LLScrollListCtrl::selectFirstItem() selectItem(itemp, -1); } } - success = TRUE; + success = true; mOriginalSelection = 0; } else @@ -894,17 +894,17 @@ BOOL LLScrollListCtrl::selectFirstItem() // Deselects all other items // virtual -BOOL LLScrollListCtrl::selectNthItem( S32 target_index ) +bool LLScrollListCtrl::selectNthItem( S32 target_index ) { return selectItemRange(target_index, target_index); } // virtual -BOOL LLScrollListCtrl::selectItemRange( S32 first_index, S32 last_index ) +bool LLScrollListCtrl::selectItemRange( S32 first_index, S32 last_index ) { if (mItemList.empty()) { - return FALSE; + return false; } // make sure sort is up to date @@ -918,7 +918,7 @@ BOOL LLScrollListCtrl::selectItemRange( S32 first_index, S32 last_index ) else last_index = llclamp(last_index, first_index, listlen-1); - BOOL success = FALSE; + bool success = false; S32 index = 0; for (item_list::iterator iter = mItemList.begin(); iter != mItemList.end(); ) { @@ -934,8 +934,8 @@ BOOL LLScrollListCtrl::selectItemRange( S32 first_index, S32 last_index ) if( itemp->getEnabled() ) { // TODO: support range selection for cells - selectItem(itemp, -1, FALSE); - success = TRUE; + selectItem(itemp, -1, false); + success = true; } } else @@ -1083,7 +1083,7 @@ S32 LLScrollListCtrl::selectMultiple( uuid_vec_t ids ) if (item->getEnabled() && (item->getUUID() == (*iditr))) { // TODO: support multiple selection for cells - selectItem(item, -1, FALSE); + selectItem(item, -1, false); ++count; break; } @@ -1134,7 +1134,7 @@ S32 LLScrollListCtrl::getItemIndex( const LLUUID& target_id ) const return -1; } -void LLScrollListCtrl::selectPrevItem( BOOL extend_selection) +void LLScrollListCtrl::selectPrevItem( bool extend_selection) { LLScrollListItem* prev_item = NULL; @@ -1179,7 +1179,7 @@ void LLScrollListCtrl::selectPrevItem( BOOL extend_selection) } -void LLScrollListCtrl::selectNextItem( BOOL extend_selection) +void LLScrollListCtrl::selectNextItem( bool extend_selection) { LLScrollListItem* next_item = NULL; @@ -1224,7 +1224,7 @@ void LLScrollListCtrl::selectNextItem( BOOL extend_selection) -void LLScrollListCtrl::deselectAllItems(BOOL no_commit_on_change) +void LLScrollListCtrl::deselectAllItems(bool no_commit_on_change) { item_list::iterator iter; for (iter = mItemList.begin(); iter != mItemList.end(); iter++) @@ -1263,9 +1263,9 @@ LLScrollListItem* LLScrollListCtrl::addSeparator(EAddPosition pos) // Selects first enabled item of the given name. // Returns false if item not found. // Calls getItemByLabel in order to combine functionality -BOOL LLScrollListCtrl::selectItemByLabel(const std::string& label, BOOL case_sensitive, S32 column/* = 0*/) +bool LLScrollListCtrl::selectItemByLabel(const std::string& label, bool case_sensitive, S32 column/* = 0*/) { - deselectAllItems(TRUE); // ensure that no stale items are selected, even if we don't find a match + deselectAllItems(true); // ensure that no stale items are selected, even if we don't find a match LLScrollListItem* item = getItemByLabel(label, case_sensitive, column); bool found = NULL != item; @@ -1282,7 +1282,7 @@ BOOL LLScrollListCtrl::selectItemByLabel(const std::string& label, BOOL case_sen return found; } -LLScrollListItem* LLScrollListCtrl::getItemByLabel(const std::string& label, BOOL case_sensitive, S32 column) +LLScrollListItem* LLScrollListCtrl::getItemByLabel(const std::string& label, bool case_sensitive, S32 column) { if (label.empty()) //RN: assume no empty items { @@ -1313,19 +1313,19 @@ LLScrollListItem* LLScrollListCtrl::getItemByLabel(const std::string& label, BOO } -BOOL LLScrollListCtrl::selectItemByPrefix(const std::string& target, BOOL case_sensitive, S32 column) +bool LLScrollListCtrl::selectItemByPrefix(const std::string& target, bool case_sensitive, S32 column) { return selectItemByPrefix(utf8str_to_wstring(target), case_sensitive, column); } // Selects first enabled item that has a name where the name's first part matched the target string. // Returns false if item not found. -BOOL LLScrollListCtrl::selectItemByPrefix(const LLWString& target, BOOL case_sensitive, S32 column) +bool LLScrollListCtrl::selectItemByPrefix(const LLWString& target, bool case_sensitive, S32 column) { - BOOL found = FALSE; + bool found = false; LLWString target_trimmed( target ); - S32 target_len = target_trimmed.size(); + auto target_len = target_trimmed.size(); if( 0 == target_len ) { @@ -1336,11 +1336,11 @@ BOOL LLScrollListCtrl::selectItemByPrefix(const LLWString& target, BOOL case_sen LLScrollListItem* item = *iter; // Only select enabled items with matching names LLScrollListCell* cellp = item->getColumn(column == -1 ? getSearchColumn() : column); - BOOL select = cellp ? item->getEnabled() && ('\0' == cellp->getValue().asString()[0]) : FALSE; + bool select = cellp ? item->getEnabled() && ('\0' == cellp->getValue().asString()[0]) : false; if (select) { selectItem(item, -1); - found = TRUE; + found = true; break; } } @@ -1372,15 +1372,15 @@ BOOL LLScrollListCtrl::selectItemByPrefix(const LLWString& target, BOOL case_sen LLWString trimmed_label = item_label; LLWStringUtil::trim(trimmed_label); - BOOL select = item->getEnabled() && trimmed_label.compare(0, target_trimmed.size(), target_trimmed) == 0; + bool select = item->getEnabled() && trimmed_label.compare(0, target_trimmed.size(), target_trimmed) == 0; if (select) { // find offset of matching text (might have leading whitespace) - S32 offset = item_label.find(target_trimmed); - cellp->highlightText(offset, target_trimmed.size()); + auto offset = item_label.find(target_trimmed); + cellp->highlightText(static_cast<S32>(offset), static_cast<S32>(target_trimmed.size())); selectItem(item, -1); - found = TRUE; + found = true; break; } } @@ -1404,7 +1404,7 @@ U32 LLScrollListCtrl::searchItems(const LLWString& substring, bool case_sensitiv U32 found = 0; LLWString substring_trimmed(substring); - S32 len = substring_trimmed.size(); + auto len = substring_trimmed.size(); if (0 == len) { @@ -1413,7 +1413,7 @@ U32 LLScrollListCtrl::searchItems(const LLWString& substring, bool case_sensitiv } else { - deselectAllItems(TRUE); + deselectAllItems(true); if (!case_sensitive) { // do comparisons in lower case @@ -1446,8 +1446,8 @@ U32 LLScrollListCtrl::searchItems(const LLWString& substring, bool case_sensitiv if (found_iter != std::string::npos) { // find offset of matching text - cellp->highlightText(found_iter, substring_trimmed.size()); - selectItem(item, -1, FALSE); + cellp->highlightText(static_cast<S32>(found_iter), static_cast<S32>(substring_trimmed.size())); + selectItem(item, -1, false); found++; @@ -1489,7 +1489,7 @@ const std::string LLScrollListCtrl::getSelectedItemLabel(S32 column) const // "StringUUID" interface: use this when you're creating a list that contains non-unique strings each of which // has an associated, unique UUID, and only one of which can be selected at a time. -LLScrollListItem* LLScrollListCtrl::addStringUUIDItem(const std::string& item_text, const LLUUID& id, EAddPosition pos, BOOL enabled) +LLScrollListItem* LLScrollListCtrl::addStringUUIDItem(const std::string& item_text, const LLUUID& id, EAddPosition pos, bool enabled) { if (getItemCount() < mMaxItemCount) { @@ -1504,16 +1504,16 @@ LLScrollListItem* LLScrollListCtrl::addStringUUIDItem(const std::string& item_te } // Select the line or lines that match this UUID -BOOL LLScrollListCtrl::selectByID( const LLUUID& id ) +bool LLScrollListCtrl::selectByID( const LLUUID& id ) { return selectByValue( LLSD(id) ); } -BOOL LLScrollListCtrl::setSelectedByValue(const LLSD& value, BOOL selected) +bool LLScrollListCtrl::setSelectedByValue(const LLSD& value, bool selected) { - BOOL found = FALSE; + bool found = false; - if (selected && !mAllowMultipleSelection) deselectAllItems(TRUE); + if (selected && !mAllowMultipleSelection) deselectAllItems(true); item_list::iterator iter; for (iter = mItemList.begin(); iter != mItemList.end(); iter++) @@ -1527,12 +1527,12 @@ BOOL LLScrollListCtrl::setSelectedByValue(const LLSD& value, BOOL selected) { LLSD::Binary data1 = value.asBinary(); LLSD::Binary data2 = item->getValue().asBinary(); - found = std::equal(data1.begin(), data1.end(), data2.begin()) ? TRUE : FALSE; + found = std::equal(data1.begin(), data1.end(), data2.begin()); } } else { - found = item->getValue().asString() == value.asString() ? TRUE : FALSE; + found = item->getValue().asString() == value.asString(); } if (found) @@ -1558,7 +1558,7 @@ BOOL LLScrollListCtrl::setSelectedByValue(const LLSD& value, BOOL selected) return found; } -BOOL LLScrollListCtrl::isSelected(const LLSD& value) const +bool LLScrollListCtrl::isSelected(const LLSD& value) const { item_list::const_iterator iter; for (iter = mItemList.begin(); iter != mItemList.end(); iter++) @@ -1569,7 +1569,7 @@ BOOL LLScrollListCtrl::isSelected(const LLSD& value) const return item->getSelected(); } } - return FALSE; + return false; } LLUUID LLScrollListCtrl::getStringUUIDSelectedItem() const @@ -1736,36 +1736,36 @@ void LLScrollListCtrl::draw() LLUICtrl::draw(); } -void LLScrollListCtrl::setEnabled(BOOL enabled) +void LLScrollListCtrl::setEnabled(bool enabled) { mCanSelect = enabled; setTabStop(enabled); mScrollbar->setTabStop(!enabled && mScrollbar->getPageSize() < mScrollbar->getDocSize()); } -BOOL LLScrollListCtrl::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLScrollListCtrl::handleScrollWheel(S32 x, S32 y, S32 clicks) { - BOOL handled = FALSE; + bool handled = false; // Pretend the mouse is over the scrollbar handled = mScrollbar->handleScrollWheel( 0, 0, clicks ); if (mMouseWheelOpaque) { - return TRUE; + return true; } return handled; } -BOOL LLScrollListCtrl::handleScrollHWheel(S32 x, S32 y, S32 clicks) +bool LLScrollListCtrl::handleScrollHWheel(S32 x, S32 y, S32 clicks) { - BOOL handled = FALSE; + bool handled = false; // Pretend the mouse is over the scrollbar handled = mScrollbar->handleScrollHWheel( 0, 0, clicks ); if (mMouseWheelOpaque) { - return TRUE; + return true; } return handled; @@ -1783,20 +1783,20 @@ LLRect LLScrollListCtrl::getCellRect(S32 row_index, S32 column_index) return cell_rect; } -BOOL LLScrollListCtrl::handleToolTip(S32 x, S32 y, MASK mask) +bool LLScrollListCtrl::handleToolTip(S32 x, S32 y, MASK mask) { S32 column_index = getColumnIndexFromOffset(x); LLScrollListColumn* columnp = getColumn(column_index); - if (columnp == NULL) return FALSE; + if (columnp == NULL) return false; - BOOL handled = FALSE; + bool handled = false; // show tooltip for full name of hovered item if it has been truncated LLScrollListItem* hit_item = hitItem(x, y); if (hit_item) { LLScrollListCell* hit_cell = hit_item->getColumn(column_index); - if (!hit_cell) return FALSE; + if (!hit_cell) return false; if (hit_cell && hit_cell->isText() && hit_cell->needsToolTip()) @@ -1815,7 +1815,7 @@ BOOL LLScrollListCtrl::handleToolTip(S32 x, S32 y, MASK mask) .delay_time(0.2f) .sticky_rect(sticky_rect)); } - handled = TRUE; + handled = true; } // otherwise, look for a tooltip associated with this column @@ -1828,11 +1828,11 @@ BOOL LLScrollListCtrl::handleToolTip(S32 x, S32 y, MASK mask) return handled; } -BOOL LLScrollListCtrl::selectItemAt(S32 x, S32 y, MASK mask) +bool LLScrollListCtrl::selectItemAt(S32 x, S32 y, MASK mask) { - if (!mCanSelect) return FALSE; + if (!mCanSelect) return false; - BOOL selection_changed = FALSE; + bool selection_changed = false; LLScrollListItem* hit_item = hitItem(x, y); @@ -1868,17 +1868,17 @@ BOOL LLScrollListCtrl::selectItemAt(S32 x, S32 y, MASK mask) LLScrollListItem *item = *itor; if (item == hit_item || item == lastSelected) { - selectItem(item, getColumnIndexFromOffset(x), FALSE); + selectItem(item, getColumnIndexFromOffset(x), false); selecting = !selecting; if (hit_item == lastSelected) { // stop selecting now, since we just clicked on our last selected item - selecting = FALSE; + selecting = false; } } if (selecting) { - selectItem(item, getColumnIndexFromOffset(x), FALSE); + selectItem(item, getColumnIndexFromOffset(x), false); } } } @@ -1893,7 +1893,7 @@ BOOL LLScrollListCtrl::selectItemAt(S32 x, S32 y, MASK mask) { if(!(mMaxSelectable > 0 && getAllSelected().size() >= mMaxSelectable)) { - selectItem(hit_item, getColumnIndexFromOffset(x), FALSE); + selectItem(hit_item, getColumnIndexFromOffset(x), false); } else { @@ -1906,7 +1906,7 @@ BOOL LLScrollListCtrl::selectItemAt(S32 x, S32 y, MASK mask) } else { - deselectAllItems(TRUE); + deselectAllItems(true); selectItem(hit_item, getColumnIndexFromOffset(x)); } } @@ -1927,21 +1927,21 @@ BOOL LLScrollListCtrl::selectItemAt(S32 x, S32 y, MASK mask) else { //mLastSelected = NULL; - //deselectAllItems(TRUE); + //deselectAllItems(true); } return selection_changed; } -BOOL LLScrollListCtrl::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLScrollListCtrl::handleMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = childrenHandleMouseDown(x, y, mask) != NULL; + bool handled = childrenHandleMouseDown(x, y, mask) != NULL; if( !handled ) { // set keyboard focus first, in case click action wants to move focus elsewhere - setFocus(TRUE); + setFocus(true); // clear selection changed flag because user is starting a selection operation mSelectionChanged = false; @@ -1949,10 +1949,10 @@ BOOL LLScrollListCtrl::handleMouseDown(S32 x, S32 y, MASK mask) handleClick(x, y, mask); } - return TRUE; + return true; } -BOOL LLScrollListCtrl::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLScrollListCtrl::handleMouseUp(S32 x, S32 y, MASK mask) { if (hasMouseCapture()) { @@ -1978,7 +1978,7 @@ BOOL LLScrollListCtrl::handleMouseUp(S32 x, S32 y, MASK mask) } // virtual -BOOL LLScrollListCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLScrollListCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) { LLScrollListItem *item = hitItem(x, y); if (item) @@ -2030,12 +2030,12 @@ BOOL LLScrollListCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) menu->show(x, y); LLMenuGL::showPopup(this, menu, x, y); - return TRUE; + return true; } } return LLUICtrl::handleRightMouseDown(x, y, mask); } - return FALSE; + return false; } void LLScrollListCtrl::showProfile(std::string id, bool is_group) @@ -2108,10 +2108,10 @@ void LLScrollListCtrl::copySLURLToClipboard(std::string id, bool is_group) LLUrlAction::copyURLToClipboard(slurl); } -BOOL LLScrollListCtrl::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLScrollListCtrl::handleDoubleClick(S32 x, S32 y, MASK mask) { - //BOOL handled = FALSE; - BOOL handled = handleClick(x, y, mask); + //bool handled = false; + bool handled = handleClick(x, y, mask); if (!handled) { @@ -2127,19 +2127,19 @@ BOOL LLScrollListCtrl::handleDoubleClick(S32 x, S32 y, MASK mask) } } - return TRUE; + return true; } -BOOL LLScrollListCtrl::handleClick(S32 x, S32 y, MASK mask) +bool LLScrollListCtrl::handleClick(S32 x, S32 y, MASK mask) { // which row was clicked on? LLScrollListItem* hit_item = hitItem(x, y); - if (!hit_item) return FALSE; + if (!hit_item) return false; // get appropriate cell from that row S32 column_index = getColumnIndexFromOffset(x); LLScrollListCell* hit_cell = hit_item->getColumn(column_index); - if (!hit_cell) return FALSE; + if (!hit_cell) return false; // if cell handled click directly (i.e. clicked on an embedded checkbox) if (hit_cell->handleClick()) @@ -2175,7 +2175,7 @@ BOOL LLScrollListCtrl::handleClick(S32 x, S32 y, MASK mask) onCommit(); } // eat click (e.g. do not trigger double click callback) - return TRUE; + return true; } else { @@ -2184,7 +2184,7 @@ BOOL LLScrollListCtrl::handleClick(S32 x, S32 y, MASK mask) gFocusMgr.setMouseCapture(this); mNeedsScroll = true; // do not eat click (allow double click callback) - return FALSE; + return false; } } @@ -2279,9 +2279,9 @@ S32 LLScrollListCtrl::getRowOffsetFromIndex(S32 index) } -BOOL LLScrollListCtrl::handleHover(S32 x,S32 y,MASK mask) +bool LLScrollListCtrl::handleHover(S32 x,S32 y,MASK mask) { - BOOL handled = FALSE; + bool handled = false; if (hasMouseCapture()) { @@ -2337,9 +2337,9 @@ void LLScrollListCtrl::onMouseLeave(S32 x, S32 y, MASK mask) mouseOverHighlightNthItem(-1); } -BOOL LLScrollListCtrl::handleKeyHere(KEY key,MASK mask ) +bool LLScrollListCtrl::handleKeyHere(KEY key,MASK mask ) { - BOOL handled = FALSE; + bool handled = false; // not called from parent means we have keyboard focus or a child does if (mCanSelect) @@ -2352,18 +2352,18 @@ BOOL LLScrollListCtrl::handleKeyHere(KEY key,MASK mask ) if (mAllowKeyboardMovement || hasFocus()) { // commit implicit in call - selectPrevItem(FALSE); + selectPrevItem(false); mNeedsScroll = true; - handled = TRUE; + handled = true; } break; case KEY_DOWN: if (mAllowKeyboardMovement || hasFocus()) { // commit implicit in call - selectNextItem(FALSE); + selectNextItem(false); mNeedsScroll = true; - handled = TRUE; + handled = true; } break; case KEY_LEFT: @@ -2388,7 +2388,7 @@ BOOL LLScrollListCtrl::handleKeyHere(KEY key,MASK mask ) break; } item->setSelectedCell(cell); - handled = TRUE; + handled = true; } } break; @@ -2414,7 +2414,7 @@ BOOL LLScrollListCtrl::handleKeyHere(KEY key,MASK mask ) break; } item->setSelectedCell(cell); - handled = TRUE; + handled = true; } } break; @@ -2428,7 +2428,7 @@ BOOL LLScrollListCtrl::handleKeyHere(KEY key,MASK mask ) { onCommit(); } - handled = TRUE; + handled = true; } break; case KEY_PAGE_DOWN: @@ -2441,7 +2441,7 @@ BOOL LLScrollListCtrl::handleKeyHere(KEY key,MASK mask ) { onCommit(); } - handled = TRUE; + handled = true; } break; case KEY_HOME: @@ -2454,7 +2454,7 @@ BOOL LLScrollListCtrl::handleKeyHere(KEY key,MASK mask ) { onCommit(); } - handled = TRUE; + handled = true; } break; case KEY_END: @@ -2467,7 +2467,7 @@ BOOL LLScrollListCtrl::handleKeyHere(KEY key,MASK mask ) { onCommit(); } - handled = TRUE; + handled = true; } break; case KEY_RETURN: @@ -2478,7 +2478,7 @@ BOOL LLScrollListCtrl::handleKeyHere(KEY key,MASK mask ) { onCommit(); mSearchString.clear(); - handled = TRUE; + handled = true; } break; case KEY_BACKSPACE: @@ -2498,7 +2498,7 @@ BOOL LLScrollListCtrl::handleKeyHere(KEY key,MASK mask ) } } } - else if (selectItemByPrefix(wstring_to_utf8str(mSearchString), FALSE)) + else if (selectItemByPrefix(wstring_to_utf8str(mSearchString), false)) { mNeedsScroll = true; // update search string only on successful match @@ -2521,11 +2521,11 @@ BOOL LLScrollListCtrl::handleKeyHere(KEY key,MASK mask ) return handled; } -BOOL LLScrollListCtrl::handleUnicodeCharHere(llwchar uni_char) +bool LLScrollListCtrl::handleUnicodeCharHere(llwchar uni_char) { if ((uni_char < 0x20) || (uni_char == 0x7F)) // Control character or DEL { - return FALSE; + return false; } // perform incremental search based on keyboard input @@ -2538,7 +2538,7 @@ BOOL LLScrollListCtrl::handleUnicodeCharHere(llwchar uni_char) // type ahead search is case insensitive uni_char = LLStringOps::toLower((llwchar)uni_char); - if (selectItemByPrefix(wstring_to_utf8str(mSearchString + (llwchar)uni_char), FALSE)) + if (selectItemByPrefix(wstring_to_utf8str(mSearchString + (llwchar)uni_char), false)) { // update search string only on successful match mNeedsScroll = true; @@ -2609,7 +2609,7 @@ BOOL LLScrollListCtrl::handleUnicodeCharHere(llwchar uni_char) } } - return TRUE; + return true; } @@ -2618,11 +2618,11 @@ void LLScrollListCtrl::reportInvalidInput() make_ui_sound("UISndBadKeystroke"); } -BOOL LLScrollListCtrl::isRepeatedChars(const LLWString& string) const +bool LLScrollListCtrl::isRepeatedChars(const LLWString& string) const { if (string.empty()) { - return FALSE; + return false; } llwchar first_char = string[0]; @@ -2631,14 +2631,14 @@ BOOL LLScrollListCtrl::isRepeatedChars(const LLWString& string) const { if (string[i] != first_char) { - return FALSE; + return false; } } - return TRUE; + return true; } -void LLScrollListCtrl::selectItem(LLScrollListItem* itemp, S32 cell, BOOL select_single_item) +void LLScrollListCtrl::selectItem(LLScrollListItem* itemp, S32 cell, bool select_single_item) { if (!itemp) return; @@ -2654,9 +2654,9 @@ void LLScrollListCtrl::selectItem(LLScrollListItem* itemp, S32 cell, BOOL select } if (select_single_item) { - deselectAllItems(TRUE); + deselectAllItems(true); } - itemp->setSelected(TRUE); + itemp->setSelected(true); switch (mSelectionType) { case CELL: @@ -2685,7 +2685,7 @@ void LLScrollListCtrl::deselectItem(LLScrollListItem* itemp) mLastSelected = NULL; } - itemp->setSelected(FALSE); + itemp->setSelected(false); LLScrollListCell* cellp = itemp->getColumn(getSearchColumn()); if (cellp) { @@ -2700,7 +2700,7 @@ void LLScrollListCtrl::commitIfChanged() if (mSelectionChanged) { mDirty = true; - mSelectionChanged = FALSE; + mSelectionChanged = false; onCommit(); } } @@ -2710,13 +2710,13 @@ struct SameSortColumn SameSortColumn(S32 column) : mColumn(column) {} S32 mColumn; - bool operator()(std::pair<S32, BOOL> sort_column) { return sort_column.first == mColumn; } + bool operator()(std::pair<S32, bool> sort_column) { return sort_column.first == mColumn; } }; -BOOL LLScrollListCtrl::setSort(S32 column_idx, BOOL ascending) +bool LLScrollListCtrl::setSort(S32 column_idx, bool ascending) { LLScrollListColumn* sort_column = getColumn(column_idx); - if (!sort_column) return FALSE; + if (!sort_column) return false; sort_column->mSortDirection = ascending ? LLScrollListColumn::ASCENDING : LLScrollListColumn::DESCENDING; @@ -2727,7 +2727,7 @@ BOOL LLScrollListCtrl::setSort(S32 column_idx, BOOL ascending) if (mSortColumns.empty()) { mSortColumns.push_back(new_sort_column); - return TRUE; + return true; } else { @@ -2765,7 +2765,7 @@ void LLScrollListCtrl::onScrollChange( S32 new_pos, LLScrollbar* scrollbar ) } -void LLScrollListCtrl::sortByColumn(const std::string& name, BOOL ascending) +void LLScrollListCtrl::sortByColumn(const std::string& name, bool ascending) { column_map_t::iterator itor = mColumns.find(name); if (itor != mColumns.end()) @@ -2775,7 +2775,7 @@ void LLScrollListCtrl::sortByColumn(const std::string& name, BOOL ascending) } // First column is column 0 -void LLScrollListCtrl::sortByColumnIndex(U32 column, BOOL ascending) +void LLScrollListCtrl::sortByColumnIndex(U32 column, bool ascending) { setSort(column, ascending); updateSort(); @@ -2796,9 +2796,9 @@ void LLScrollListCtrl::updateSort() const } // for one-shot sorts, does not save sort column/order -void LLScrollListCtrl::sortOnce(S32 column, BOOL ascending) +void LLScrollListCtrl::sortOnce(S32 column, bool ascending) { - std::vector<std::pair<S32, BOOL> > sort_column; + std::vector<std::pair<S32, bool> > sort_column; sort_column.push_back(std::make_pair(column, ascending)); // do stable sort to preserve any previous sorts @@ -2897,11 +2897,11 @@ void LLScrollListCtrl::copy() { buffer += (*itor)->getContentsCSV() + "\n"; } - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(buffer), 0, buffer.length()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(buffer), 0, static_cast<S32>(buffer.length())); } // virtual -BOOL LLScrollListCtrl::canCopy() const +bool LLScrollListCtrl::canCopy() const { return (getFirstSelected() != NULL); } @@ -2914,7 +2914,7 @@ void LLScrollListCtrl::cut() } // virtual -BOOL LLScrollListCtrl::canCut() const +bool LLScrollListCtrl::canCut() const { return canCopy() && canDoDelete(); } @@ -2929,7 +2929,7 @@ void LLScrollListCtrl::selectAll() LLScrollListItem *itemp = *iter; if( itemp->getEnabled() ) { - selectItem(itemp, -1, FALSE); + selectItem(itemp, -1, false); } } @@ -2940,7 +2940,7 @@ void LLScrollListCtrl::selectAll() } // virtual -BOOL LLScrollListCtrl::canSelectAll() const +bool LLScrollListCtrl::canSelectAll() const { return getCanSelect() && mAllowMultipleSelection && !(mMaxSelectable > 0 && mItemList.size() > mMaxSelectable); } @@ -2952,7 +2952,7 @@ void LLScrollListCtrl::deselect() } // virtual -BOOL LLScrollListCtrl::canDeselect() const +bool LLScrollListCtrl::canDeselect() const { return getCanSelect(); } @@ -2981,7 +2981,7 @@ void LLScrollListCtrl::addColumn(const LLScrollListColumn::Params& column_params // Add column mColumns[name] = new LLScrollListColumn(column_params, this); LLScrollListColumn* new_column = mColumns[name]; - new_column->mIndex = mColumns.size()-1; + new_column->mIndex = static_cast<S32>(mColumns.size()) - 1; // Add button if (new_column->getWidth() > 0 || new_column->mRelWidth > 0 || new_column->mDynamicWidth) @@ -3093,7 +3093,7 @@ std::string LLScrollListCtrl::getSortColumnName() else return ""; } -BOOL LLScrollListCtrl::hasSortOrder() const +bool LLScrollListCtrl::hasSortOrder() const { return !mSortColumns.empty(); } @@ -3177,7 +3177,7 @@ LLScrollListItem* LLScrollListCtrl::addRow(LLScrollListItem *new_item, const LLS { LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; if (!item_p.validateBlock() || !new_item) return NULL; - new_item->setNumColumns(mColumns.size()); + new_item->setNumColumns(static_cast<S32>(mColumns.size())); // Add any columns we don't already have S32 col_index = 0; @@ -3212,7 +3212,7 @@ LLScrollListItem* LLScrollListCtrl::addRow(LLScrollListItem *new_item, const LLS } addColumn(new_column); columnp = mColumns[column]; - new_item->setNumColumns(mColumns.size()); + new_item->setNumColumns(static_cast<S32>(mColumns.size())); } S32 index = columnp->mIndex; @@ -3230,7 +3230,7 @@ LLScrollListItem* LLScrollListCtrl::addRow(LLScrollListItem *new_item, const LLS && cell->isText() && !cell->getValue().asString().empty()) { - columnp->mHeader->setHasResizableElement(TRUE); + columnp->mHeader->setHasResizableElement(true); } } @@ -3245,7 +3245,7 @@ LLScrollListItem* LLScrollListCtrl::addRow(LLScrollListItem *new_item, const LLS new_column.name = "0"; addColumn(new_column); - new_item->setNumColumns(mColumns.size()); + new_item->setNumColumns(static_cast<S32>(mColumns.size())); } LLScrollListCell* cell = LLScrollListCell::create(LLScrollListCell::Params().value(item_p.value)); @@ -3258,7 +3258,7 @@ LLScrollListItem* LLScrollListCtrl::addRow(LLScrollListItem *new_item, const LLS && cell->isText() && !cell->getValue().asString().empty()) { - columnp->mHeader->setHasResizableElement(TRUE); + columnp->mHeader->setHasResizableElement(true); } } } @@ -3315,26 +3315,26 @@ LLSD LLScrollListCtrl::getValue() const return item->getValue(); } -BOOL LLScrollListCtrl::operateOnSelection(EOperation op) +bool LLScrollListCtrl::operateOnSelection(EOperation op) { if (op == OP_DELETE) { deleteSelectedItems(); - return TRUE; + return true; } else if (op == OP_DESELECT) { deselectAllItems(); } - return FALSE; + return false; } -BOOL LLScrollListCtrl::operateOnAll(EOperation op) +bool LLScrollListCtrl::operateOnAll(EOperation op) { if (op == OP_DELETE) { clearRows(); - return TRUE; + return true; } else if (op == OP_DESELECT) { @@ -3344,10 +3344,10 @@ BOOL LLScrollListCtrl::operateOnAll(EOperation op) { selectAll(); } - return FALSE; + return false; } //virtual -void LLScrollListCtrl::setFocus(BOOL b) +void LLScrollListCtrl::setFocus(bool b) { // for tabbing into pristine scroll lists (Finder) if (!getFirstSelected()) @@ -3360,9 +3360,9 @@ void LLScrollListCtrl::setFocus(BOOL b) // virtual -BOOL LLScrollListCtrl::isDirty() const +bool LLScrollListCtrl::isDirty() const { - BOOL grubby = mDirty; + bool grubby = mDirty; if ( !mAllowMultipleSelection ) { grubby = (mOriginalSelection != getFirstSelectedIndex()); @@ -3373,7 +3373,7 @@ BOOL LLScrollListCtrl::isDirty() const // Clear dirty state void LLScrollListCtrl::resetDirty() { - mDirty = FALSE; + mDirty = false; mOriginalSelection = getFirstSelectedIndex(); } diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index c525fd72a8..f25ba61fd4 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -166,7 +166,7 @@ public: // Sets an array of column descriptors void setColumnHeadings(const LLSD& headings); - void sortByColumnIndex(U32 column, BOOL ascending); + void sortByColumnIndex(U32 column, bool ascending); // LLCtrlListInterface functions virtual S32 getItemCount() const; @@ -178,7 +178,7 @@ public: virtual bool preProcessChildNode(LLXMLNodePtr child); virtual LLScrollListColumn* getColumn(S32 index); virtual LLScrollListColumn* getColumn(const std::string& name); - virtual S32 getNumColumns() const { return mColumnsIndexed.size(); } + virtual S32 getNumColumns() const { return static_cast<S32>(mColumnsIndexed.size()); } // Adds a single element, from an array of: // "columns" => [ "column" => column name, "value" => value, "type" => type, "font" => font, "font-style" => style ], "id" => uuid @@ -189,7 +189,7 @@ public: // Simple add element. Takes a single array of: // [ "value" => value, "font" => font, "font-style" => style ] virtual void clearRows(); // clears all elements - virtual void sortByColumn(const std::string& name, BOOL ascending); + virtual void sortByColumn(const std::string& name, bool ascending); // These functions take and return an array of arrays of elements, as above virtual void setValue(const LLSD& value ); @@ -200,37 +200,37 @@ public: LLCtrlScrollInterface* getScrollInterface() { return (LLCtrlScrollInterface*)this; } // DEPRECATED: Use setSelectedByValue() below. - BOOL setCurrentByID( const LLUUID& id ) { return selectByID(id); } + bool setCurrentByID( const LLUUID& id ) { return selectByID(id); } virtual LLUUID getCurrentID() const { return getStringUUIDSelectedItem(); } - BOOL operateOnSelection(EOperation op); - BOOL operateOnAll(EOperation op); + bool operateOnSelection(EOperation op); + bool operateOnAll(EOperation op); - // returns FALSE if unable to set the max count so low - BOOL setMaxItemCount(S32 max_count); + // returns false if unable to set the max count so low + bool setMaxItemCount(S32 max_count); - BOOL selectByID( const LLUUID& id ); // FALSE if item not found + bool selectByID( const LLUUID& id ); // false if item not found // Match item by value.asString(), which should work for string, integer, uuid. - // Returns FALSE if not found. - BOOL setSelectedByValue(const LLSD& value, BOOL selected); + // Returns false if not found. + bool setSelectedByValue(const LLSD& value, bool selected); - BOOL isSorted() const { return mSorted; } + bool isSorted() const { return mSorted; } - virtual BOOL isSelected(const LLSD& value) const; + virtual bool isSelected(const LLSD& value) const; - BOOL hasSelectedItem() const; + bool hasSelectedItem() const; - BOOL handleClick(S32 x, S32 y, MASK mask); - BOOL selectFirstItem(); - BOOL selectNthItem( S32 index ); - BOOL selectItemRange( S32 first, S32 last ); - BOOL selectItemAt(S32 x, S32 y, MASK mask); + bool handleClick(S32 x, S32 y, MASK mask); + bool selectFirstItem(); + bool selectNthItem( S32 index ); + bool selectItemRange( S32 first, S32 last ); + bool selectItemAt(S32 x, S32 y, MASK mask); void deleteSingleItem( S32 index ); void deleteItems(const LLSD& sd); void deleteSelectedItems(); - void deselectAllItems(BOOL no_commit_on_change = FALSE); // by default, go ahead and commit on selection change + void deselectAllItems(bool no_commit_on_change = false); // by default, go ahead and commit on selection change void clearHighlightedItems(); @@ -247,8 +247,8 @@ public: void swapWithNext(S32 index); void swapWithPrevious(S32 index); - void setCanSelect(BOOL can_select) { mCanSelect = can_select; } - virtual BOOL getCanSelect() const { return mCanSelect; } + void setCanSelect(bool can_select) { mCanSelect = can_select; } + virtual bool getCanSelect() const { return mCanSelect; } S32 getItemIndex( LLScrollListItem* item ) const; S32 getItemIndex( const LLUUID& item_id ) const; @@ -260,10 +260,10 @@ public: // one of which can be selected at a time. virtual LLScrollListItem* addSimpleElement(const std::string& value, EAddPosition pos = ADD_BOTTOM, const LLSD& id = LLSD()); - BOOL selectItemByLabel( const std::string& item, BOOL case_sensitive = TRUE, S32 column = 0 ); // FALSE if item not found - BOOL selectItemByPrefix(const std::string& target, BOOL case_sensitive = TRUE, S32 column = -1); - BOOL selectItemByPrefix(const LLWString& target, BOOL case_sensitive = TRUE, S32 column = -1); - LLScrollListItem* getItemByLabel(const std::string& item, BOOL case_sensitive = TRUE, S32 column = 0); + bool selectItemByLabel( const std::string& item, bool case_sensitive = true, S32 column = 0 ); // false if item not found + bool selectItemByPrefix(const std::string& target, bool case_sensitive = true, S32 column = -1); + bool selectItemByPrefix(const LLWString& target, bool case_sensitive = true, S32 column = -1); + LLScrollListItem* getItemByLabel( const std::string& item, bool case_sensitive = true, S32 column = 0 ); const std::string getSelectedItemLabel(S32 column = 0) const; LLSD getSelectedValue(); @@ -278,7 +278,7 @@ public: // DEPRECATED: Use LLSD versions of setCommentText() and getSelectedValue(). // "StringUUID" interface: use this when you're creating a list that contains non-unique strings each of which // has an associated, unique UUID, and only one of which can be selected at a time. - LLScrollListItem* addStringUUIDItem(const std::string& item_text, const LLUUID& id, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE); + LLScrollListItem* addStringUUIDItem(const std::string& item_text, const LLUUID& id, EAddPosition pos = ADD_BOTTOM, bool enabled = true); LLUUID getStringUUIDSelectedItem() const; LLScrollListItem* getFirstSelected() const; @@ -294,7 +294,7 @@ public: LLScrollListItem* getItem(const LLSD& sd) const; - void setAllowMultipleSelection(BOOL mult ) { mAllowMultipleSelection = mult; } + void setAllowMultipleSelection(bool mult ) { mAllowMultipleSelection = mult; } void setBgWriteableColor(const LLColor4 &c) { mBgWriteableColor = c; } void setReadOnlyBgColor(const LLColor4 &c) { mBgReadOnlyColor = c; } @@ -306,15 +306,15 @@ public: void setHighlightedColor(const LLColor4 &c) { mHighlightedColor = c; } void setFgDisableColor(const LLColor4 &c) { mFgDisabledColor = c; } - void setBackgroundVisible(BOOL b) { mBackgroundVisible = b; } - void setDrawStripes(BOOL b) { mDrawStripes = b; } + void setBackgroundVisible(bool b) { mBackgroundVisible = b; } + void setDrawStripes(bool b) { mDrawStripes = b; } void setColumnPadding(const S32 c) { mColumnPadding = c; } S32 getColumnPadding() const { return mColumnPadding; } void setRowPadding(const S32 c) { mColumnPadding = c; } S32 getRowPadding() const { return mColumnPadding; } - void setCommitOnKeyboardMovement(BOOL b) { mCommitOnKeyboardMovement = b; } - void setCommitOnSelectionChange(BOOL b) { mCommitOnSelectionChange = b; } - void setAllowKeyboardMovement(BOOL b) { mAllowKeyboardMovement = b; } + void setCommitOnKeyboardMovement(bool b) { mCommitOnKeyboardMovement = b; } + void setCommitOnSelectionChange(bool b) { mCommitOnSelectionChange = b; } + void setAllowKeyboardMovement(bool b) { mAllowKeyboardMovement = b; } void setMaxSelectable(U32 max_selected) { mMaxSelectable = max_selected; } S32 getMaxSelectable() { return mMaxSelectable; } @@ -337,31 +337,31 @@ public: // Overridden from LLView /*virtual*/ void draw(); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); - /*virtual*/ BOOL handleUnicodeCharHere(llwchar uni_char); - /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); - /*virtual*/ BOOL handleScrollHWheel(S32 x, S32 y, S32 clicks); - /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask); - /*virtual*/ void setEnabled(BOOL enabled); - /*virtual*/ void setFocus( BOOL b ); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleRightMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleDoubleClick(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleKeyHere(KEY key, MASK mask); + /*virtual*/ bool handleUnicodeCharHere(llwchar uni_char); + /*virtual*/ bool handleScrollWheel(S32 x, S32 y, S32 clicks); + /*virtual*/ bool handleScrollHWheel(S32 x, S32 y, S32 clicks); + /*virtual*/ bool handleToolTip(S32 x, S32 y, MASK mask); + /*virtual*/ void setEnabled(bool enabled); + /*virtual*/ void setFocus( bool b ); /*virtual*/ void onFocusReceived(); /*virtual*/ void onFocusLost(); /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask); - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true); - virtual BOOL isDirty() const; + virtual bool isDirty() const; virtual void resetDirty(); // Clear dirty state virtual void updateLayout(); virtual void fitContents(S32 max_width, S32 max_height); virtual LLRect getRequiredRect(); - static BOOL rowPreceeds(LLScrollListItem *new_row, LLScrollListItem *test_row); + static bool rowPreceeds(LLScrollListItem *new_row, LLScrollListItem *test_row); LLRect getItemListRect() { return mItemListRect; } @@ -383,39 +383,39 @@ public: * then display all items. */ void setPageLines(S32 page_lines ); - void setCollapseEmptyColumns(BOOL collapse); + void setCollapseEmptyColumns(bool collapse); LLScrollListItem* hitItem(S32 x,S32 y); virtual void scrollToShowSelected(); // LLEditMenuHandler functions virtual void copy(); - virtual BOOL canCopy() const; + virtual bool canCopy() const; virtual void cut(); - virtual BOOL canCut() const; + virtual bool canCut() const; virtual void selectAll(); - virtual BOOL canSelectAll() const; + virtual bool canSelectAll() const; virtual void deselect(); - virtual BOOL canDeselect() const; + virtual bool canDeselect() const; void setNumDynamicColumns(S32 num) { mNumDynamicWidthColumns = num; } void updateStaticColumnWidth(LLScrollListColumn* col, S32 new_width); S32 getTotalStaticColumnWidth() { return mTotalStaticColumnWidth; } std::string getSortColumnName(); - BOOL getSortAscending() { return mSortColumns.empty() ? TRUE : mSortColumns.back().second; } - BOOL hasSortOrder() const; + bool getSortAscending() { return mSortColumns.empty() ? true : mSortColumns.back().second; } + bool hasSortOrder() const; void clearSortOrder(); - void setAlternateSort() { mAlternateSort = TRUE; } + void setAlternateSort() { mAlternateSort = true; } - void selectPrevItem(BOOL extend_selection = FALSE); - void selectNextItem(BOOL extend_selection = FALSE); + void selectPrevItem(bool extend_selection = false); + void selectNextItem(bool extend_selection = false); S32 selectMultiple(uuid_vec_t ids); // conceptually const, but mutates mItemList void updateSort() const; // sorts a list without affecting the permanent sort order (so further list insertions can be unsorted, for example) - void sortOnce(S32 column, BOOL ascending); + void sortOnce(S32 column, bool ascending); // manually call this whenever editing list items in place to flag need for resorting void setNeedsSort(bool val = true) { mSorted = !val; } @@ -447,8 +447,8 @@ protected: // (except in the case that the addItem() call fails, in which case it is up // to the caller to delete the item) // - // returns FALSE if item faile to be added to list, does NOT delete 'item' - BOOL addItem( LLScrollListItem* item, EAddPosition pos = ADD_BOTTOM, BOOL requires_column = TRUE ); + // returns false if item faile to be added to list, does NOT delete 'item' + bool addItem( LLScrollListItem* item, EAddPosition pos = ADD_BOTTOM, bool requires_column = true ); typedef std::deque<LLScrollListItem *> item_list; item_list& getItemList() { return mItemList; } @@ -460,11 +460,11 @@ private: void updateLineHeightInsert(LLScrollListItem* item); void reportInvalidInput(); - BOOL isRepeatedChars(const LLWString& string) const; - void selectItem(LLScrollListItem* itemp, S32 cell, BOOL single_select = TRUE); + bool isRepeatedChars(const LLWString& string) const; + void selectItem(LLScrollListItem* itemp, S32 cell, bool single_select = true); void deselectItem(LLScrollListItem* itemp); void commitIfChanged(); - BOOL setSort(S32 column, BOOL ascending); + bool setSort(S32 column, bool ascending); S32 getLinesPerPage(); static void showProfile(std::string id, bool is_group); @@ -508,8 +508,8 @@ private: S32 mColumnPadding; S32 mRowPadding; - BOOL mBackgroundVisible; - BOOL mDrawStripes; + bool mBackgroundVisible; + bool mDrawStripes; LLUIColor mBgWriteableColor; LLUIColor mBgReadOnlyColor; @@ -553,7 +553,7 @@ private: typedef std::vector<LLScrollListColumn*> ordered_columns_t; ordered_columns_t mColumnsIndexed; - typedef std::pair<S32, BOOL> sort_column_t; + typedef std::pair<S32, bool> sort_column_t; std::vector<sort_column_t> mSortColumns; sort_signal_t* mSortCallback; diff --git a/indra/llui/llscrolllistitem.cpp b/indra/llui/llscrolllistitem.cpp index a928a57465..0d79d19a37 100644 --- a/indra/llui/llscrolllistitem.cpp +++ b/indra/llui/llscrolllistitem.cpp @@ -38,8 +38,8 @@ //--------------------------------------------------------------------------- LLScrollListItem::LLScrollListItem( const Params& p ) -: mSelected(FALSE), - mHighlighted(FALSE), +: mSelected(false), + mHighlighted(false), mHoverIndex(-1), mSelectedIndex(-1), mEnabled(p.enabled), @@ -56,13 +56,13 @@ LLScrollListItem::~LLScrollListItem() mColumns.clear(); } -void LLScrollListItem::setSelected(BOOL b) +void LLScrollListItem::setSelected(bool b) { mSelected = b; mSelectedIndex = -1; } -void LLScrollListItem::setHighlighted(BOOL b) +void LLScrollListItem::setHighlighted(bool b) { mHighlighted = b; mHoverIndex = -1; @@ -85,7 +85,7 @@ void LLScrollListItem::addColumn(const LLScrollListCell::Params& p) void LLScrollListItem::setNumColumns(S32 columns) { - S32 prev_columns = mColumns.size(); + auto prev_columns = mColumns.size(); if (columns < prev_columns) { std::for_each(mColumns.begin()+columns, mColumns.end(), DeletePointer()); @@ -93,7 +93,7 @@ void LLScrollListItem::setNumColumns(S32 columns) mColumns.resize(columns); - for (S32 col = prev_columns; col < columns; ++col) + for (auto col = prev_columns; col < columns; ++col) { mColumns[col] = NULL; } @@ -115,7 +115,7 @@ void LLScrollListItem::setColumn( S32 column, LLScrollListCell *cell ) S32 LLScrollListItem::getNumColumns() const { - return mColumns.size(); + return static_cast<S32>(mColumns.size()); } LLScrollListCell* LLScrollListItem::getColumn(const S32 i) const diff --git a/indra/llui/llscrolllistitem.h b/indra/llui/llscrolllistitem.h index 8a78efbd7c..ee8a8bb556 100644 --- a/indra/llui/llscrolllistitem.h +++ b/indra/llui/llscrolllistitem.h @@ -79,14 +79,14 @@ public: virtual ~LLScrollListItem(); - void setSelected( BOOL b ); - BOOL getSelected() const { return mSelected; } + void setSelected( bool b ); + bool getSelected() const { return mSelected; } - void setEnabled( BOOL b ) { mEnabled = b; } - BOOL getEnabled() const { return mEnabled; } + void setEnabled( bool b ) { mEnabled = b; } + bool getEnabled() const { return mEnabled; } - void setHighlighted( BOOL b ); - BOOL getHighlighted() const { return mHighlighted; } + void setHighlighted( bool b ); + bool getHighlighted() const { return mHighlighted; } void setSelectedCell( S32 cell ); S32 getSelectedCell() const { return mSelectedIndex; } @@ -127,11 +127,11 @@ protected: LLScrollListItem( const Params& ); private: - BOOL mSelected; - BOOL mHighlighted; + bool mSelected; + bool mHighlighted; S32 mHoverIndex; S32 mSelectedIndex; - BOOL mEnabled; + bool mEnabled; void* mUserdata; LLSD mItemValue; LLSD mItemAltValue; diff --git a/indra/llui/llsearcheditor.cpp b/indra/llui/llsearcheditor.cpp index 9a35c628af..a0c1e9d0c0 100644 --- a/indra/llui/llsearcheditor.cpp +++ b/indra/llui/llsearcheditor.cpp @@ -72,7 +72,7 @@ LLSearchEditor::LLSearchEditor(const LLSearchEditor::Params& p) line_editor_params.keystroke_callback(boost::bind(&LLSearchEditor::handleKeystroke, this)); mSearchEditor = LLUICtrlFactory::create<LLLineEditor>(line_editor_params); - mSearchEditor->setPassDelete(TRUE); + mSearchEditor->setPassDelete(true); addChild(mSearchEditor); if (p.search_button_visible) @@ -106,6 +106,10 @@ LLSearchEditor::LLSearchEditor(const LLSearchEditor::Params& p) LLSearchEditor::~LLSearchEditor() { + mKeystrokeCallback = NULL; + mTextChangedCallback = NULL; + setCommitOnFocusLost(false); + mSearchButton = NULL; mClearButton = NULL; mSearchEditor->deleteAllChildren(); @@ -148,13 +152,13 @@ LLSD LLSearchEditor::getValue() const } //virtual -BOOL LLSearchEditor::setTextArg( const std::string& key, const LLStringExplicit& text ) +bool LLSearchEditor::setTextArg( const std::string& key, const LLStringExplicit& text ) { return mSearchEditor->setTextArg(key, text); } //virtual -BOOL LLSearchEditor::setLabelArg( const std::string& key, const LLStringExplicit& text ) +bool LLSearchEditor::setLabelArg( const std::string& key, const LLStringExplicit& text ) { return mSearchEditor->setLabelArg(key, text); } @@ -175,7 +179,7 @@ void LLSearchEditor::clear() } //virtual -void LLSearchEditor::setFocus( BOOL b ) +void LLSearchEditor::setFocus( bool b ) { if (mSearchEditor) { diff --git a/indra/llui/llsearcheditor.h b/indra/llui/llsearcheditor.h index 26f6b72aa3..d99dc6f200 100644 --- a/indra/llui/llsearcheditor.h +++ b/indra/llui/llsearcheditor.h @@ -67,7 +67,7 @@ public: {} }; - void setCommitOnFocusLost(BOOL b) { if (mSearchEditor) mSearchEditor->setCommitOnFocusLost(b); } + void setCommitOnFocusLost(bool b) { if (mSearchEditor) mSearchEditor->setCommitOnFocusLost(b); } protected: LLSearchEditor(const Params&); @@ -84,11 +84,11 @@ public: // LLUICtrl interface virtual void setValue(const LLSD& value ); virtual LLSD getValue() const; - virtual BOOL setTextArg( const std::string& key, const LLStringExplicit& text ); - virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); + virtual bool setTextArg( const std::string& key, const LLStringExplicit& text ); + virtual bool setLabelArg( const std::string& key, const LLStringExplicit& text ); virtual void setLabel( const LLStringExplicit &new_label ); virtual void clear(); - virtual void setFocus( BOOL b ); + virtual void setFocus( bool b ); void setKeystrokeCallback( commit_callback_t cb ) { mKeystrokeCallback = cb; } void setTextChangedCallback( commit_callback_t cb ) { mTextChangedCallback = cb; } diff --git a/indra/llui/llslider.cpp b/indra/llui/llslider.cpp index ed8d508ba3..0507733fd8 100644 --- a/indra/llui/llslider.cpp +++ b/indra/llui/llslider.cpp @@ -93,7 +93,7 @@ LLSlider::~LLSlider() delete mMouseUpSignal; } -void LLSlider::setValue(F32 value, BOOL from_event) +void LLSlider::setValue(F32 value, bool from_event) { value = llclamp( value, mMinValue, mMaxValue ); @@ -157,7 +157,7 @@ void LLSlider::setValueAndCommit(F32 value) } -BOOL LLSlider::handleHover(S32 x, S32 y, MASK mask) +bool LLSlider::handleHover(S32 x, S32 y, MASK mask) { if( hasMouseCapture() ) { @@ -193,12 +193,12 @@ BOOL LLSlider::handleHover(S32 x, S32 y, MASK mask) getWindow()->setCursor(UI_CURSOR_ARROW); LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (inactive)" << LL_ENDL; } - return TRUE; + return true; } -BOOL LLSlider::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLSlider::handleMouseUp(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; if( hasMouseCapture() ) { @@ -207,23 +207,23 @@ BOOL LLSlider::handleMouseUp(S32 x, S32 y, MASK mask) if (mMouseUpSignal) (*mMouseUpSignal)( this, getValueF32() ); - handled = TRUE; + handled = true; make_ui_sound("UISndClickRelease"); } else { - handled = TRUE; + handled = true; } return handled; } -BOOL LLSlider::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLSlider::handleMouseDown(S32 x, S32 y, MASK mask) { // only do sticky-focus on non-chrome widgets if (!getIsChrome()) { - setFocus(TRUE); + setFocus(true); } if (mMouseDownSignal) (*mMouseDownSignal)( this, getValueF32() ); @@ -253,23 +253,23 @@ BOOL LLSlider::handleMouseDown(S32 x, S32 y, MASK mask) } make_ui_sound("UISndClick"); - return TRUE; + return true; } -BOOL LLSlider::handleKeyHere(KEY key, MASK mask) +bool LLSlider::handleKeyHere(KEY key, MASK mask) { - BOOL handled = FALSE; + bool handled = false; switch(key) { case KEY_DOWN: case KEY_LEFT: setValueAndCommit(getValueF32() - getIncrement()); - handled = TRUE; + handled = true; break; case KEY_UP: case KEY_RIGHT: setValueAndCommit(getValueF32() + getIncrement()); - handled = TRUE; + handled = true; break; default: break; @@ -277,13 +277,13 @@ BOOL LLSlider::handleKeyHere(KEY key, MASK mask) return handled; } -BOOL LLSlider::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLSlider::handleScrollWheel(S32 x, S32 y, S32 clicks) { if ( mOrientation == VERTICAL ) { F32 new_val = getValueF32() - clicks * getIncrement(); setValueAndCommit(new_val); - return TRUE; + return true; } return LLF32UICtrl::handleScrollWheel(x,y,clicks); } diff --git a/indra/llui/llslider.h b/indra/llui/llslider.h index 4f4acdc50c..03fad5a05d 100644 --- a/indra/llui/llslider.h +++ b/indra/llui/llslider.h @@ -60,9 +60,9 @@ protected: friend class LLUICtrlFactory; public: virtual ~LLSlider(); - void setValue( F32 value, BOOL from_event = FALSE ); + void setValue( F32 value, bool from_event = false ); // overrides for LLF32UICtrl methods - virtual void setValue(const LLSD& value ) { setValue((F32)value.asReal(), TRUE); } + virtual void setValue(const LLSD& value ) { setValue((F32)value.asReal(), true); } virtual void setMinValue(const LLSD& min_value) { setMinValue((F32)min_value.asReal()); } virtual void setMaxValue(const LLSD& max_value) { setMaxValue((F32)max_value.asReal()); } @@ -72,18 +72,18 @@ public: boost::signals2::connection setMouseDownCallback( const commit_signal_t::slot_type& cb ); boost::signals2::connection setMouseUpCallback( const commit_signal_t::slot_type& cb ); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleKeyHere(KEY key, MASK mask); - virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); + virtual bool handleHover(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleKeyHere(KEY key, MASK mask); + virtual bool handleScrollWheel(S32 x, S32 y, S32 clicks); virtual void draw(); private: void setValueAndCommit(F32 value); void updateThumbRect(); - BOOL mVolumeSlider; + bool mVolumeSlider; S32 mMouseOffset; LLRect mDragStartThumbRect; diff --git a/indra/llui/llsliderctrl.cpp b/indra/llui/llsliderctrl.cpp index e16ba9408e..22579205d8 100644 --- a/indra/llui/llsliderctrl.cpp +++ b/indra/llui/llsliderctrl.cpp @@ -173,7 +173,7 @@ LLSliderCtrl::LLSliderCtrl(const LLSliderCtrl::Params& p) mEditor->setFocusReceivedCallback( boost::bind(&LLSliderCtrl::onEditorGainFocus, _1, this )); // don't do this, as selecting the entire text is single clicking in some cases // and double clicking in others - //mEditor->setSelectAllonFocusReceived(TRUE); + //mEditor->setSelectAllonFocusReceived(true); addChild(mEditor); } else @@ -210,16 +210,16 @@ void LLSliderCtrl::onEditorGainFocus( LLFocusableElement* caller, void *userdata } -void LLSliderCtrl::setValue(F32 v, BOOL from_event) +void LLSliderCtrl::setValue(F32 v, bool from_event) { mSlider->setValue( v, from_event ); mValue = mSlider->getValueF32(); updateText(); } -BOOL LLSliderCtrl::setLabelArg( const std::string& key, const LLStringExplicit& text ) +bool LLSliderCtrl::setLabelArg( const std::string& key, const LLStringExplicit& text ) { - BOOL res = FALSE; + bool res = false; if (mLabelBox) { res = mLabelBox->setTextArg(key, text); @@ -319,7 +319,7 @@ void LLSliderCtrl::onEditorCommit( LLUICtrl* ctrl, const LLSD& userdata ) if (!self) return; - BOOL success = FALSE; + bool success = false; F32 val = self->mValue; F32 saved_val = self->mValue; @@ -333,7 +333,7 @@ void LLSliderCtrl::onEditorCommit( LLUICtrl* ctrl, const LLSD& userdata ) self->setValue( val ); // set the value temporarily so that the callback can retrieve it. if( !self->mValidateSignal || (*(self->mValidateSignal))( self, val ) ) { - success = TRUE; + success = true; } } } @@ -362,14 +362,14 @@ void LLSliderCtrl::onSliderCommit( LLUICtrl* ctrl, const LLSD& userdata ) if (!self) return; - BOOL success = FALSE; + bool success = false; F32 saved_val = self->mValue; F32 new_val = self->mSlider->getValueF32(); self->mValue = new_val; // set the value temporarily so that the callback can retrieve it. if( !self->mValidateSignal || (*(self->mValidateSignal))( self, new_val ) ) { - success = TRUE; + success = true; } if( success ) @@ -387,7 +387,7 @@ void LLSliderCtrl::onSliderCommit( LLUICtrl* ctrl, const LLSD& userdata ) self->updateText(); } -void LLSliderCtrl::setEnabled(BOOL b) +void LLSliderCtrl::setEnabled(bool b) { LLView::setEnabled( b ); @@ -410,7 +410,7 @@ void LLSliderCtrl::setEnabled(BOOL b) } -void LLSliderCtrl::setTentative(BOOL b) +void LLSliderCtrl::setTentative(bool b) { if( mEditor ) { @@ -422,11 +422,11 @@ void LLSliderCtrl::setTentative(BOOL b) void LLSliderCtrl::onCommit() { - setTentative(FALSE); + setTentative(false); if( mEditor ) { - mEditor->setTentative(FALSE); + mEditor->setTentative(false); } setControlValue(getValueF32()); @@ -440,7 +440,7 @@ void LLSliderCtrl::setRect(const LLRect& rect) } //virtual -void LLSliderCtrl::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLSliderCtrl::reshape(S32 width, S32 height, bool called_from_parent) { LLF32UICtrl::reshape(width, height, called_from_parent); updateSliderRect(); diff --git a/indra/llui/llsliderctrl.h b/indra/llui/llsliderctrl.h index 48e59045a7..a55e3bf6e9 100644 --- a/indra/llui/llsliderctrl.h +++ b/indra/llui/llsliderctrl.h @@ -84,17 +84,17 @@ public: virtual ~LLSliderCtrl(); /*virtual*/ F32 getValueF32() const { return mSlider->getValueF32(); } - void setValue(F32 v, BOOL from_event = FALSE); + void setValue(F32 v, bool from_event = false); - /*virtual*/ void setValue(const LLSD& value) { setValue((F32)value.asReal(), TRUE); } + /*virtual*/ void setValue(const LLSD& value) { setValue((F32)value.asReal(), true); } /*virtual*/ LLSD getValue() const { return LLSD(getValueF32()); } - /*virtual*/ BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); + /*virtual*/ bool setLabelArg( const std::string& key, const LLStringExplicit& text ); - BOOL isMouseHeldDown() const { return mSlider->hasMouseCapture(); } + bool isMouseHeldDown() const { return mSlider->hasMouseCapture(); } virtual void setPrecision(S32 precision); - /*virtual*/ void setEnabled( BOOL b ); + /*virtual*/ void setEnabled( bool b ); /*virtual*/ void clear(); /*virtual*/ void setMinValue(const LLSD& min_value) { setMinValue((F32)min_value.asReal()); } @@ -116,7 +116,7 @@ public: /*virtual*/ void onTabInto(); - /*virtual*/ void setTentative(BOOL b); // marks value as tentative + /*virtual*/ void setTentative(bool b); // marks value as tentative /*virtual*/ void onCommit(); // mark not tentative, then commit /*virtual*/ void setControlName(const std::string& control_name, LLView* context) @@ -126,7 +126,7 @@ public: } /*virtual*/ void setRect(const LLRect& rect); - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true); static void onSliderCommit(LLUICtrl* caller, const LLSD& userdata); @@ -154,8 +154,8 @@ private: const LLFontGL* mFont; const LLFontGL* mLabelFont; - BOOL mShowText; - BOOL mCanEditText; + bool mShowText; + bool mCanEditText; S32 mPrecision; LLTextBox* mLabelBox; diff --git a/indra/llui/llspellcheck.cpp b/indra/llui/llspellcheck.cpp index b8aeb3b91f..1615db5b52 100644 --- a/indra/llui/llspellcheck.cpp +++ b/indra/llui/llspellcheck.cpp @@ -94,7 +94,7 @@ S32 LLSpellChecker::getSuggestions(const std::string& word, std::vector<std::str } mHunspell->free_list(&suggestion_list, suggestion_cnt); } - return suggestions.size(); + return static_cast<S32>(suggestions.size()); } const LLSD LLSpellChecker::getDictionaryData(const std::string& dict_language) diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp index 888edd093e..7d41d80334 100644 --- a/indra/llui/llspinctrl.cpp +++ b/indra/llui/llspinctrl.cpp @@ -63,7 +63,7 @@ LLSpinCtrl::Params::Params() LLSpinCtrl::LLSpinCtrl(const LLSpinCtrl::Params& p) : LLF32UICtrl(p), mLabelBox(NULL), - mbHasBeenSet( FALSE ), + mbHasBeenSet( false ), mPrecision(p.decimal_digits), mTextEnabledColor(p.text_enabled_color()), mTextDisabledColor(p.text_disabled_color()) @@ -143,12 +143,12 @@ LLSpinCtrl::LLSpinCtrl(const LLSpinCtrl::Params& p) //RN: this seems to be a BAD IDEA, as it makes the editor behavior different when it has focus // than when it doesn't. Instead, if you always have to double click to select all the text, // it's easier to understand - //mEditor->setSelectAllonFocusReceived(TRUE); - mEditor->setSelectAllonCommit(FALSE); + //mEditor->setSelectAllonFocusReceived(true); + mEditor->setSelectAllonCommit(false); addChild(mEditor); updateEditor(); - setUseBoundingRect( TRUE ); + setUseBoundingRect( true ); } F32 clamp_precision(F32 value, S32 decimal_precision) @@ -275,7 +275,7 @@ void LLSpinCtrl::setValue(const LLSD& value ) F32 v = (F32)value.asReal(); if (getValueF32() != v || !mbHasBeenSet) { - mbHasBeenSet = TRUE; + mbHasBeenSet = true; LLF32UICtrl::setValue(value); if (!mEditor->hasFocus()) @@ -291,7 +291,7 @@ void LLSpinCtrl::forceSetValue(const LLSD& value ) F32 v = (F32)value.asReal(); if (getValueF32() != v || !mbHasBeenSet) { - mbHasBeenSet = TRUE; + mbHasBeenSet = true; LLF32UICtrl::setValue(value); updateEditor(); @@ -303,7 +303,7 @@ void LLSpinCtrl::clear() { setValue(mMinValue); mEditor->clear(); - mbHasBeenSet = FALSE; + mbHasBeenSet = false; } void LLSpinCtrl::updateLabelColor() @@ -333,7 +333,7 @@ void LLSpinCtrl::updateEditor() void LLSpinCtrl::onEditorCommit( const LLSD& data ) { - BOOL success = FALSE; + bool success = false; if( mEditor->evaluateFloat() ) { @@ -349,7 +349,7 @@ void LLSpinCtrl::onEditorCommit( const LLSD& data ) setValue(val); if( !mValidateSignal || (*mValidateSignal)( this, val ) ) { - success = TRUE; + success = true; onCommit(); } else @@ -378,13 +378,13 @@ void LLSpinCtrl::forceEditorCommit() } -void LLSpinCtrl::setFocus(BOOL b) +void LLSpinCtrl::setFocus(bool b) { LLUICtrl::setFocus( b ); mEditor->setFocus( b ); } -void LLSpinCtrl::setEnabled(BOOL b) +void LLSpinCtrl::setEnabled(bool b) { LLView::setEnabled( b ); mEditor->setEnabled( b ); @@ -392,14 +392,14 @@ void LLSpinCtrl::setEnabled(BOOL b) } -void LLSpinCtrl::setTentative(BOOL b) +void LLSpinCtrl::setTentative(bool b) { mEditor->setTentative(b); LLUICtrl::setTentative(b); } -BOOL LLSpinCtrl::isMouseHeldDown() const +bool LLSpinCtrl::isMouseHeldDown() const { return mDownBtn->hasMouseCapture() @@ -408,7 +408,7 @@ BOOL LLSpinCtrl::isMouseHeldDown() const void LLSpinCtrl::onCommit() { - setTentative(FALSE); + setTentative(false); setControlValue(getValueF32()); LLF32UICtrl::onCommit(); } @@ -439,7 +439,7 @@ void LLSpinCtrl::setLabel(const LLStringExplicit& label) updateLabelColor(); } -void LLSpinCtrl::setAllowEdit(BOOL allow_edit) +void LLSpinCtrl::setAllowEdit(bool allow_edit) { mEditor->setEnabled(allow_edit); mAllowEdit = allow_edit; @@ -457,7 +457,7 @@ void LLSpinCtrl::reportInvalidData() make_ui_sound("UISndBadKeystroke"); } -BOOL LLSpinCtrl::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLSpinCtrl::handleScrollWheel(S32 x, S32 y, S32 clicks) { if( clicks > 0 ) { @@ -472,10 +472,10 @@ BOOL LLSpinCtrl::handleScrollWheel(S32 x, S32 y, S32 clicks) onUpBtn(getValue()); } - return TRUE; + return true; } -BOOL LLSpinCtrl::handleKeyHere(KEY key, MASK mask) +bool LLSpinCtrl::handleKeyHere(KEY key, MASK mask) { if (mEditor->hasFocus()) { @@ -485,20 +485,20 @@ BOOL LLSpinCtrl::handleKeyHere(KEY key, MASK mask) // but not allowing revert on a spinner seems dangerous updateEditor(); mEditor->resetScrollPosition(); - mEditor->setFocus(FALSE); - return TRUE; + mEditor->setFocus(false); + return true; } if(key == KEY_UP) { onUpBtn(getValue()); - return TRUE; + return true; } if(key == KEY_DOWN) { onDownBtn(getValue()); - return TRUE; + return true; } } - return FALSE; + return false; } diff --git a/indra/llui/llspinctrl.h b/indra/llui/llspinctrl.h index 7eddc2ce4e..75f1830d80 100644 --- a/indra/llui/llspinctrl.h +++ b/indra/llui/llspinctrl.h @@ -66,12 +66,12 @@ public: F32 get() const { return getValueF32(); } void set(F32 value) { setValue(value); mInitialValue = value; } - BOOL isMouseHeldDown() const; + bool isMouseHeldDown() const; - virtual void setEnabled( BOOL b ); - virtual void setFocus( BOOL b ); + virtual void setEnabled( bool b ); + virtual void setFocus( bool b ); virtual void clear(); - virtual BOOL isDirty() const { return( getValueF32() != mInitialValue ); } + virtual bool isDirty() const { return( getValueF32() != mInitialValue ); } virtual void resetDirty() { mInitialValue = getValueF32(); } virtual void setPrecision(S32 precision); @@ -79,17 +79,17 @@ public: void setLabel(const LLStringExplicit& label); void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; updateLabelColor(); } void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; updateLabelColor();} - void setAllowEdit(BOOL allow_edit); + void setAllowEdit(bool allow_edit); virtual void onTabInto(); - virtual void setTentative(BOOL b); // marks value as tentative + virtual void setTentative(bool b); // marks value as tentative virtual void onCommit(); // mark not tentative, then commit void forceEditorCommit(); // for commit on external button - virtual BOOL handleScrollWheel(S32 x,S32 y,S32 clicks); - virtual BOOL handleKeyHere(KEY key, MASK mask); + virtual bool handleScrollWheel(S32 x,S32 y,S32 clicks); + virtual bool handleKeyHere(KEY key, MASK mask); void onEditorCommit(const LLSD& data); static void onEditorGainFocus(LLFocusableElement* caller, void *userdata); @@ -117,8 +117,8 @@ private: class LLButton* mUpBtn; class LLButton* mDownBtn; - BOOL mbHasBeenSet; - BOOL mAllowEdit; + bool mbHasBeenSet; + bool mAllowEdit; }; #endif // LL_LLSPINCTRL_H diff --git a/indra/llui/llstatbar.cpp b/indra/llui/llstatbar.cpp index 5ea2eaabcd..adb1d51813 100644 --- a/indra/llui/llstatbar.cpp +++ b/indra/llui/llstatbar.cpp @@ -209,7 +209,7 @@ LLStatBar::LLStatBar(const Params& p) setStat(p.stat); } -BOOL LLStatBar::handleHover(S32 x, S32 y, MASK mask) +bool LLStatBar::handleHover(S32 x, S32 y, MASK mask) { switch(mStatType) { @@ -225,38 +225,38 @@ BOOL LLStatBar::handleHover(S32 x, S32 y, MASK mask) default: break; } - return TRUE; + return true; } -BOOL LLStatBar::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLStatBar::handleMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = LLView::handleMouseDown(x, y, mask); + bool handled = LLView::handleMouseDown(x, y, mask); if (!handled) { if (mDisplayBar) { if (mDisplayHistory || mOrientation == HORIZONTAL) { - mDisplayBar = FALSE; - mDisplayHistory = FALSE; + mDisplayBar = false; + mDisplayHistory = false; } else { - mDisplayHistory = TRUE; + mDisplayHistory = true; } } else { - mDisplayBar = TRUE; + mDisplayBar = true; if (mOrientation == HORIZONTAL) { - mDisplayHistory = TRUE; + mDisplayHistory = true; } } LLView* parent = getParent(); - parent->reshape(parent->getRect().getWidth(), parent->getRect().getHeight(), FALSE); + parent->reshape(parent->getRect().getWidth(), parent->getRect().getHeight(), false); } - return TRUE; + return true; } template<typename T> @@ -455,7 +455,7 @@ void LLStatBar::draw() if (mDisplayHistory && mStat.valid) { - const S32 num_values = frame_recording.getNumRecordedPeriods() - 1; + const S32 num_values = static_cast<S32>(frame_recording.getNumRecordedPeriods()) - 1; F32 min_value = 0.f, max_value = 0.f; diff --git a/indra/llui/llstatbar.h b/indra/llui/llstatbar.h index e398c41601..c36a138566 100644 --- a/indra/llui/llstatbar.h +++ b/indra/llui/llstatbar.h @@ -61,8 +61,8 @@ public: LLStatBar(const Params&); virtual void draw(); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleHover(S32 x, S32 y, MASK mask); void setStat(const std::string& stat_name); diff --git a/indra/llui/llstatgraph.cpp b/indra/llui/llstatgraph.cpp index bf08055554..d37f927073 100644 --- a/indra/llui/llstatgraph.cpp +++ b/indra/llui/llstatgraph.cpp @@ -104,14 +104,14 @@ void LLStatGraph::draw() color = LLUIColorTable::instance().getColor( "MenuDefaultBgColor" ); gGL.color4fv(color.mV); - gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, TRUE); + gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, true); gGL.color4fv(LLColor4::black.mV); - gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, FALSE); + gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, false); color = it->mColor; gGL.color4fv(color.mV); - gl_rect_2d(1, ll_round(frac*getRect().getHeight()), getRect().getWidth() - 1, 0, TRUE); + gl_rect_2d(1, ll_round(frac*getRect().getHeight()), getRect().getWidth() - 1, 0, true); } void LLStatGraph::setMin(const F32 min) diff --git a/indra/llui/llstatgraph.h b/indra/llui/llstatgraph.h index 679cd72cd4..c254821870 100644 --- a/indra/llui/llstatgraph.h +++ b/indra/llui/llstatgraph.h @@ -106,7 +106,7 @@ public: private: LLTrace::StatType<LLTrace::CountAccumulator>* mNewStatFloatp; - BOOL mPerSec; + bool mPerSec; F32 mValue; diff --git a/indra/llui/llstatview.cpp b/indra/llui/llstatview.cpp index 377474084d..1c7656ecd2 100644 --- a/indra/llui/llstatview.cpp +++ b/indra/llui/llstatview.cpp @@ -40,7 +40,7 @@ LLStatView::LLStatView(const LLStatView::Params& p) : LLContainerView(p), mSetting(p.setting) { - BOOL isopen = getDisplayChildren(); + bool isopen = getDisplayChildren(); if (mSetting.length() > 0) { isopen = LLUI::getInstance()->mSettingGroups["config"]->getBOOL(mSetting); @@ -53,7 +53,7 @@ LLStatView::~LLStatView() // Children all cleaned up by default view destructor. if (mSetting.length() > 0) { - BOOL isopen = getDisplayChildren(); + bool isopen = getDisplayChildren(); LLUI::getInstance()->mSettingGroups["config"]->setBOOL(mSetting, isopen); } } diff --git a/indra/llui/llstyle.cpp b/indra/llui/llstyle.cpp index a8c0aa8ad6..abf6e1284b 100644 --- a/indra/llui/llstyle.cpp +++ b/indra/llui/llstyle.cpp @@ -73,17 +73,17 @@ void LLStyle::setLinkHREF(const std::string& href) mLink = href; } -BOOL LLStyle::isLink() const +bool LLStyle::isLink() const { return mIsLink; } -BOOL LLStyle::isVisible() const +bool LLStyle::isVisible() const { return mVisible; } -void LLStyle::setVisible(BOOL is_visible) +void LLStyle::setVisible(bool is_visible) { mVisible = is_visible; } diff --git a/indra/llui/llstyle.h b/indra/llui/llstyle.h index 2a60bd265e..7dbccfff87 100644 --- a/indra/llui/llstyle.h +++ b/indra/llui/llstyle.h @@ -61,8 +61,8 @@ public: const LLUIColor& getSelectedColor() const { return mSelectedColor; } void setSelectedColor(const LLUIColor& color) { mSelectedColor = color; } - BOOL isVisible() const; - void setVisible(BOOL is_visible); + bool isVisible() const; + void setVisible(bool is_visible); LLFontGL::ShadowType getShadowType() const { return mDropShadow; } @@ -71,13 +71,13 @@ public: const std::string& getLinkHREF() const { return mLink; } void setLinkHREF(const std::string& href); - BOOL isLink() const; + bool isLink() const; LLPointer<LLUIImage> getImage() const; void setImage(const LLUUID& src); void setImage(const std::string& name); - BOOL isImage() const { return mImagep.notNull(); } + bool isImage() const { return mImagep.notNull(); } bool operator==(const LLStyle &rhs) const { @@ -101,7 +101,7 @@ protected: ~LLStyle() { } private: - BOOL mVisible; + bool mVisible; LLUIColor mColor; LLUIColor mReadOnlyColor; LLUIColor mSelectedColor; diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 78c4f3c03c..06f584d372 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -75,7 +75,7 @@ public: mTabContainer(c), mTabPanel(p), mButton(b), - mOldState(FALSE), + mOldState(false), mPlaceholderText(placeholder), mPadding(0), mVisible(true) @@ -84,7 +84,7 @@ public: LLTabContainer* mTabContainer; LLPanel* mTabPanel; LLButton* mButton; - BOOL mOldState; + bool mOldState; LLTextBox* mPlaceholderText; S32 mPadding; @@ -233,7 +233,7 @@ LLTabContainer::LLTabContainer(const LLTabContainer::Params& p) : LLPanel(p), mCurrentTabIdx(-1), mTabsHidden(p.hide_tabs), - mScrolled(FALSE), + mScrolled(false), mScrollPos(0), mScrollPosPixels(0), mMaxScrollPos(0), @@ -308,14 +308,14 @@ void LLTabContainer::setValue(const LLSD& value) } //virtual -void LLTabContainer::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLTabContainer::reshape(S32 width, S32 height, bool called_from_parent) { LLPanel::reshape( width, height, called_from_parent ); updateMaxScrollPos(); } //virtual -LLView* LLTabContainer::getChildView(const std::string& name, BOOL recurse) const +LLView* LLTabContainer::getChildView(const std::string& name, bool recurse) const { tuple_list_t::const_iterator itor; for (itor = mTabList.begin(); itor != mTabList.end(); ++itor) @@ -343,7 +343,7 @@ LLView* LLTabContainer::getChildView(const std::string& name, BOOL recurse) cons } //virtual -LLView* LLTabContainer::findChildView(const std::string& name, BOOL recurse) const +LLView* LLTabContainer::findChildView(const std::string& name, bool recurse) const { tuple_list_t::const_iterator itor; for (itor = mTabList.begin(); itor != mTabList.end(); ++itor) @@ -385,11 +385,11 @@ bool LLTabContainer::addChild(LLView* view, S32 tab_group) } } -BOOL LLTabContainer::postBuild() +bool LLTabContainer::postBuild() { selectFirstTab(); - return TRUE; + return true; } // virtual @@ -433,7 +433,7 @@ void LLTabContainer::draw() setScrollPosPixels((S32)lerp((F32)getScrollPosPixels(), (F32)target_pixel_scroll, LLSmoothInterpolation::getInterpolant(0.08f))); - BOOL has_scroll_arrows = !mHideScrollArrows && !getTabsHidden() && ((mMaxScrollPos > 0) || (mScrollPosPixels > 0)); + bool has_scroll_arrows = !mHideScrollArrows && !getTabsHidden() && ((mMaxScrollPos > 0) || (mScrollPosPixels > 0)); if (!mIsVertical) { mJumpPrevArrowBtn->setVisible( has_scroll_arrows ); @@ -461,7 +461,7 @@ void LLTabContainer::draw() for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) { LLTabTuple* tuple = *iter; - tuple->mButton->setVisible( FALSE ); + tuple->mButton->setVisible( false ); } } @@ -480,7 +480,7 @@ void LLTabContainer::draw() for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) { LLTabTuple* tuple = *iter; - tuple->mButton->setVisible( TRUE ); + tuple->mButton->setVisible( true ); } S32 max_scroll_visible = getTabCount() - getMaxScrollPos() + getScrollPos(); @@ -506,14 +506,14 @@ void LLTabContainer::draw() { if( tuple->mButton->getFlashing() ) { - mPrevArrowBtn->setFlashing( TRUE ); + mPrevArrowBtn->setFlashing( true ); } } else if( max_scroll_visible < idx ) { if( tuple->mButton->getFlashing() ) { - mNextArrowBtn->setFlashing( TRUE ); + mNextArrowBtn->setFlashing( true ); } } } @@ -543,11 +543,11 @@ void LLTabContainer::draw() // virtual -BOOL LLTabContainer::handleMouseDown( S32 x, S32 y, MASK mask ) +bool LLTabContainer::handleMouseDown( S32 x, S32 y, MASK mask ) { static LLUICachedControl<S32> tabcntrv_pad ("UITabCntrvPad", 0); - BOOL handled = FALSE; - BOOL has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0) && !getTabsHidden(); + bool handled = false; + bool has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0) && !getTabsHidden(); if (has_scroll_arrows) { @@ -606,7 +606,7 @@ BOOL LLTabContainer::handleMouseDown( S32 x, S32 y, MASK mask ) index = llclamp(index, 0, tab_count-1); LLButton* tab_button = getTab(index)->mButton; gFocusMgr.setMouseCapture(this); - tab_button->setFocus(TRUE); + tab_button->setFocus(true); mMouseDownTimer.start(); } } @@ -619,10 +619,10 @@ BOOL LLTabContainer::handleMouseDown( S32 x, S32 y, MASK mask ) } // virtual -BOOL LLTabContainer::handleHover( S32 x, S32 y, MASK mask ) +bool LLTabContainer::handleHover( S32 x, S32 y, MASK mask ) { - BOOL handled = FALSE; - BOOL has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0) && !getTabsHidden(); + bool handled = false; + bool has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0) && !getTabsHidden(); if (has_scroll_arrows) { @@ -665,10 +665,10 @@ BOOL LLTabContainer::handleHover( S32 x, S32 y, MASK mask ) } // virtual -BOOL LLTabContainer::handleMouseUp( S32 x, S32 y, MASK mask ) +bool LLTabContainer::handleMouseUp( S32 x, S32 y, MASK mask ) { - BOOL handled = FALSE; - BOOL has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0) && !getTabsHidden(); + bool handled = false; + bool has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0) && !getTabsHidden(); S32 local_x = x - getRect().mLeft; S32 local_y = y - getRect().mBottom; @@ -712,11 +712,11 @@ BOOL LLTabContainer::handleMouseUp( S32 x, S32 y, MASK mask ) { if (cur_panel) { - if (!cur_panel->focusFirstItem(FALSE)) + if (!cur_panel->focusFirstItem(false)) { // if nothing in the panel gets focus, make sure the new tab does // otherwise the last tab might keep focus - getTab(getCurrentPanelIndex())->mButton->setFocus(TRUE); + getTab(getCurrentPanelIndex())->mButton->setFocus(true); } } gFocusMgr.setMouseCapture(NULL); @@ -729,15 +729,15 @@ BOOL LLTabContainer::handleMouseUp( S32 x, S32 y, MASK mask ) } // virtual -BOOL LLTabContainer::handleToolTip( S32 x, S32 y, MASK mask) +bool LLTabContainer::handleToolTip( S32 x, S32 y, MASK mask) { static LLUICachedControl<S32> tabcntrv_pad ("UITabCntrvPad", 0); - BOOL handled = LLPanel::handleToolTip( x, y, mask); + bool handled = LLPanel::handleToolTip( x, y, mask); if (!handled && getTabCount() > 0 && !getTabsHidden()) { LLTabTuple* firsttuple = getTab(0); - BOOL has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0); + bool has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0); LLRect clip; if (mIsVertical) { @@ -774,25 +774,25 @@ BOOL LLTabContainer::handleToolTip( S32 x, S32 y, MASK mask) } // virtual -BOOL LLTabContainer::handleKeyHere(KEY key, MASK mask) +bool LLTabContainer::handleKeyHere(KEY key, MASK mask) { - BOOL handled = FALSE; + bool handled = false; if (key == KEY_LEFT && mask == MASK_ALT) { selectPrevTab(); - handled = TRUE; + handled = true; } else if (key == KEY_RIGHT && mask == MASK_ALT) { selectNextTab(); - handled = TRUE; + handled = true; } if (handled) { if (getCurrentPanel()) { - getCurrentPanel()->setFocus(TRUE); + getCurrentPanel()->setFocus(true); } } @@ -805,21 +805,21 @@ BOOL LLTabContainer::handleKeyHere(KEY key, MASK mask) { case KEY_UP: selectPrevTab(); - handled = TRUE; + handled = true; break; case KEY_DOWN: selectNextTab(); - handled = TRUE; + handled = true; break; case KEY_LEFT: - handled = TRUE; + handled = true; break; case KEY_RIGHT: if (getTabPosition() == LEFT && getCurrentPanel()) { - getCurrentPanel()->setFocus(TRUE); + getCurrentPanel()->setFocus(true); } - handled = TRUE; + handled = true; break; default: break; @@ -832,24 +832,24 @@ BOOL LLTabContainer::handleKeyHere(KEY key, MASK mask) case KEY_UP: if (getTabPosition() == BOTTOM && getCurrentPanel()) { - getCurrentPanel()->setFocus(TRUE); + getCurrentPanel()->setFocus(true); } - handled = TRUE; + handled = true; break; case KEY_DOWN: if (getTabPosition() == TOP && getCurrentPanel()) { - getCurrentPanel()->setFocus(TRUE); + getCurrentPanel()->setFocus(true); } - handled = TRUE; + handled = true; break; case KEY_LEFT: selectPrevTab(); - handled = TRUE; + handled = true; break; case KEY_RIGHT: selectNextTab(); - handled = TRUE; + handled = true; break; default: break; @@ -860,9 +860,9 @@ BOOL LLTabContainer::handleKeyHere(KEY key, MASK mask) } // virtual -BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType type, void* cargo_data, EAcceptance *accept, std::string &tooltip) +bool LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType type, void* cargo_data, EAcceptance *accept, std::string &tooltip) { - BOOL has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0); + bool has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0); if(mOpenTabsOnDragAndDrop && !getTabsHidden()) { @@ -903,7 +903,7 @@ BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDra for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) { LLTabTuple* tuple = *iter; - tuple->mButton->setVisible( TRUE ); + tuple->mButton->setVisible( true ); S32 local_x = x - tuple->mButton->getRect().mLeft; S32 local_y = y - tuple->mButton->getRect().mBottom; if (tuple->mButton->pointInView(local_x, local_y) && tuple->mButton->getEnabled() && !tuple->mTabPanel->getVisible()) @@ -966,9 +966,9 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel) const std::string& label = panel.label.isProvided() ? panel.label() : panel.panel()->getLabel(); - BOOL select = panel.select_tab(); + bool select = panel.select_tab(); S32 indent = panel.indent(); - BOOL placeholder = panel.is_placeholder; + bool placeholder = panel.is_placeholder; eInsertionPoint insertion_point = panel.insert_at(); static LLUICachedControl<S32> tabcntrv_pad ("UITabCntrvPad", 0); @@ -1031,10 +1031,10 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel) } child->setFollowsAll(); child->translate( tab_panel_rect.mLeft - child->getRect().mLeft, tab_panel_rect.mBottom - child->getRect().mBottom); - child->reshape( tab_panel_rect.getWidth(), tab_panel_rect.getHeight(), TRUE ); + child->reshape( tab_panel_rect.getWidth(), tab_panel_rect.getHeight(), true ); // add this child later - child->setVisible( FALSE ); // Will be made visible when selected + child->setVisible( false ); // Will be made visible when selected mTotalTabWidth += button_width; @@ -1256,7 +1256,7 @@ void LLTabContainer::removeTabPanel(LLPanel* child) } } - BOOL has_focus = gFocusMgr.childHasKeyboardFocus(this); + bool has_focus = gFocusMgr.childHasKeyboardFocus(this); // If the tab being deleted is the selected one, select a different tab. for(std::vector<LLTabTuple*>::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) @@ -1298,7 +1298,7 @@ void LLTabContainer::removeTabPanel(LLPanel* child) if (mCurrentTabIdx >= (S32)mTabList.size()) { - mCurrentTabIdx = mTabList.size()-1; + mCurrentTabIdx = static_cast<S32>(mTabList.size()) - 1; } selectTab(mCurrentTabIdx); if (has_focus) @@ -1306,7 +1306,7 @@ void LLTabContainer::removeTabPanel(LLPanel* child) LLPanel* panelp = getPanelByIndex(mCurrentTabIdx); if (panelp) { - panelp->setFocus(TRUE); + panelp->setFocus(true); } } @@ -1325,7 +1325,7 @@ void LLTabContainer::unlockTabs() mLockedTabCount = 0; } -void LLTabContainer::enableTabButton(S32 which, BOOL enable) +void LLTabContainer::enableTabButton(S32 which, bool enable) { if (which >= 0 && which < (S32)mTabList.size()) { @@ -1377,7 +1377,7 @@ S32 LLTabContainer::getCurrentPanelIndex() S32 LLTabContainer::getTabCount() { - return mTabList.size(); + return static_cast<S32>(mTabList.size()); } LLPanel* LLTabContainer::getPanelByIndex(S32 index) @@ -1444,7 +1444,7 @@ void LLTabContainer::selectFirstTab() void LLTabContainer::selectLastTab() { - selectTab( mTabList.size()-1 ); + selectTab(static_cast<S32>(mTabList.size()) - 1); } void LLTabContainer::selectNextTab() @@ -1454,10 +1454,10 @@ void LLTabContainer::selectNextTab() return; } - BOOL tab_has_focus = FALSE; + bool tab_has_focus = false; if (mCurrentTabIdx >= 0 && mTabList[mCurrentTabIdx]->mButton->hasFocus()) { - tab_has_focus = TRUE; + tab_has_focus = true; } S32 idx = mCurrentTabIdx+1; if (idx >= (S32)mTabList.size()) @@ -1469,33 +1469,33 @@ void LLTabContainer::selectNextTab() if (tab_has_focus) { - mTabList[idx]->mButton->setFocus(TRUE); + mTabList[idx]->mButton->setFocus(true); } } void LLTabContainer::selectPrevTab() { - BOOL tab_has_focus = FALSE; + bool tab_has_focus = false; if (mCurrentTabIdx >= 0 && mTabList[mCurrentTabIdx]->mButton->hasFocus()) { - tab_has_focus = TRUE; + tab_has_focus = true; } S32 idx = mCurrentTabIdx-1; if (idx < 0) - idx = mTabList.size()-1; + idx = static_cast<S32>(mTabList.size()) - 1; while (!selectTab(idx) && idx != mCurrentTabIdx) { idx = idx - 1; if (idx < 0) - idx = mTabList.size()-1; + idx = static_cast<S32>(mTabList.size()) - 1; } if (tab_has_focus) { - mTabList[idx]->mButton->setFocus(TRUE); + mTabList[idx]->mButton->setFocus(true); } } -BOOL LLTabContainer::selectTabPanel(LLPanel* child) +bool LLTabContainer::selectTabPanel(LLPanel* child) { S32 idx = 0; for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) @@ -1507,23 +1507,23 @@ BOOL LLTabContainer::selectTabPanel(LLPanel* child) } idx++; } - return FALSE; + return false; } -BOOL LLTabContainer::selectTab(S32 which) +bool LLTabContainer::selectTab(S32 which) { if (which >= getTabCount() || which < 0) - return FALSE; + return false; LLTabTuple* selected_tuple = getTab(which); if (!selected_tuple) - return FALSE; + return false; LLSD cbdata; if (selected_tuple->mTabPanel) cbdata = selected_tuple->mTabPanel->getName(); - BOOL result = FALSE; + bool result = false; if (!mValidateSignal || (*mValidateSignal)(this, cbdata)) { result = setTab(which); @@ -1537,16 +1537,16 @@ BOOL LLTabContainer::selectTab(S32 which) } // private -BOOL LLTabContainer::setTab(S32 which) +bool LLTabContainer::setTab(S32 which) { static LLUICachedControl<S32> tabcntr_arrow_btn_size ("UITabCntrArrowBtnSize", 0); LLTabTuple* selected_tuple = getTab(which); if (!selected_tuple) { - return FALSE; + return false; } - BOOL is_visible = FALSE; + bool is_visible = false; if( selected_tuple->mButton->getEnabled() && selected_tuple->mVisible ) { setCurrentPanelIndex(which); @@ -1555,7 +1555,7 @@ BOOL LLTabContainer::setTab(S32 which) for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) { LLTabTuple* tuple = *iter; - BOOL is_selected = ( tuple == selected_tuple ); + bool is_selected = ( tuple == selected_tuple ); // Although the selected tab must be complete, we may have hollow LLTabTuple tucked in the list if (tuple && tuple->mButton) { @@ -1582,11 +1582,11 @@ BOOL LLTabContainer::setTab(S32 which) if( i >= getScrollPos() && i <= getScrollPos() + num_visible) { setCurrentPanelIndex(which); - is_visible = TRUE; + is_visible = true; } else { - is_visible = FALSE; + is_visible = false; } } else if (!mHideScrollArrows && getMaxScrollPos() > 0) @@ -1618,11 +1618,11 @@ BOOL LLTabContainer::setTab(S32 which) setScrollPos(llclamp(getScrollPos(), min_scroll_pos, i)); setScrollPos(llmin(getScrollPos(), getMaxScrollPos())); } - is_visible = TRUE; + is_visible = true; } else { - is_visible = TRUE; + is_visible = true; } } i++; @@ -1631,36 +1631,36 @@ BOOL LLTabContainer::setTab(S32 which) if (mIsVertical && getCurrentPanelIndex() >= 0) { LLTabTuple* tuple = getTab(getCurrentPanelIndex()); - tuple->mTabPanel->setVisible( TRUE ); - tuple->mButton->setToggleState( TRUE ); + tuple->mTabPanel->setVisible( true ); + tuple->mButton->setToggleState( true ); } return is_visible; } -BOOL LLTabContainer::selectTabByName(const std::string& name) +bool LLTabContainer::selectTabByName(const std::string& name) { LLPanel* panel = getPanelByName(name); if (!panel) { LL_WARNS() << "LLTabContainer::selectTabByName(" << name << ") failed" << LL_ENDL; - return FALSE; + return false; } - BOOL result = selectTabPanel(panel); + bool result = selectTabPanel(panel); return result; } -BOOL LLTabContainer::getTabPanelFlashing(LLPanel *child) +bool LLTabContainer::getTabPanelFlashing(LLPanel *child) { LLTabTuple* tuple = getTabByPanel(child); if( tuple ) { return tuple->mButton->getFlashing(); } - return FALSE; + return false; } -void LLTabContainer::setTabPanelFlashing(LLPanel* child, BOOL state ) +void LLTabContainer::setTabPanelFlashing(LLPanel* child, bool state ) { LLTabTuple* tuple = getTabByPanel(child); if( tuple ) @@ -1810,7 +1810,7 @@ void LLTabContainer::onTabBtn( const LLSD& data, LLPanel* panel ) if (tuple) { - tuple->mTabPanel->setFocus(TRUE); + tuple->mTabPanel->setFocus(true); } } @@ -1820,7 +1820,7 @@ void LLTabContainer::onNextBtn( const LLSD& data ) { scrollNext(); } - mScrolled = FALSE; + mScrolled = false; if(mCurrentTabIdx < mTabList.size()-1) { @@ -1839,7 +1839,7 @@ void LLTabContainer::onNextBtnHeld( const LLSD& data ) { selectNextTab(); } - mScrolled = TRUE; + mScrolled = true; } } @@ -1849,7 +1849,7 @@ void LLTabContainer::onPrevBtn( const LLSD& data ) { scrollPrev(); } - mScrolled = FALSE; + mScrolled = false; if(mCurrentTabIdx > 0) { @@ -1878,7 +1878,7 @@ void LLTabContainer::onPrevBtnHeld( const LLSD& data ) { selectPrevTab(); } - mScrolled = TRUE; + mScrolled = true; } } @@ -2008,21 +2008,21 @@ void LLTabContainer::initButtons() } } - mPrevArrowBtn->setTabStop(FALSE); + mPrevArrowBtn->setTabStop(false); addChild(mPrevArrowBtn); - mNextArrowBtn->setTabStop(FALSE); + mNextArrowBtn->setTabStop(false); addChild(mNextArrowBtn); if (mJumpPrevArrowBtn) { - mJumpPrevArrowBtn->setTabStop(FALSE); + mJumpPrevArrowBtn->setTabStop(false); addChild(mJumpPrevArrowBtn); } if (mJumpNextArrowBtn) { - mJumpNextArrowBtn->setTabStop(FALSE); + mJumpNextArrowBtn->setTabStop(false); addChild(mJumpNextArrowBtn); } @@ -2087,7 +2087,7 @@ void LLTabContainer::insertTuple(LLTabTuple * tuple, eInsertionPoint insertion_p void LLTabContainer::updateMaxScrollPos() { static LLUICachedControl<S32> tabcntrv_pad ("UITabCntrvPad", 0); - BOOL no_scroll = TRUE; + bool no_scroll = true; if (mIsVertical) { S32 tab_total_height = (BTN_HEIGHT + tabcntrv_pad) * getTabCount(); @@ -2098,7 +2098,7 @@ void LLTabContainer::updateMaxScrollPos() S32 available_height_with_arrows = getRect().getHeight() - 2*(tabcntrv_arrow_btn_size + 3*tabcntrv_pad) - mNextArrowBtn->getRect().mBottom; S32 additional_needed = tab_total_height - available_height_with_arrows; setMaxScrollPos((S32) ceil(additional_needed / float(BTN_HEIGHT + tabcntrv_pad) ) ); - no_scroll = FALSE; + no_scroll = false; } } else @@ -2130,7 +2130,7 @@ void LLTabContainer::updateMaxScrollPos() } // in case last tab doesn't actually fit on screen, make it the last scrolling position setMaxScrollPos(llmin(getMaxScrollPos(), getTabCount() - 1)); - no_scroll = FALSE; + no_scroll = false; } } if (no_scroll) @@ -2196,9 +2196,9 @@ void LLTabContainer::setTabVisibility( LLPanel const *aPanel, bool aVisible ) } if( foundTab ) - this->setVisible( TRUE ); + this->setVisible( true ); else - this->setVisible( FALSE ); + this->setVisible( false ); updateMaxScrollPos(); } diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h index 626255be8c..b22eec2fe5 100644 --- a/indra/llui/lltabcontainer.h +++ b/indra/llui/lltabcontainer.h @@ -132,28 +132,28 @@ protected: public: //LLTabContainer( const std::string& name, const LLRect& rect, TabPosition pos, - // BOOL bordered, BOOL is_vertical); + // bool bordered, bool is_vertical); /*virtual*/ ~LLTabContainer(); // from LLView /*virtual*/ void setValue(const LLSD& value); - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true); /*virtual*/ void draw(); - /*virtual*/ BOOL handleMouseDown( S32 x, S32 y, MASK mask ); - /*virtual*/ BOOL handleHover( S32 x, S32 y, MASK mask ); - /*virtual*/ BOOL handleMouseUp( S32 x, S32 y, MASK mask ); - /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); - /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + /*virtual*/ bool handleMouseDown( S32 x, S32 y, MASK mask ); + /*virtual*/ bool handleHover( S32 x, S32 y, MASK mask ); + /*virtual*/ bool handleMouseUp( S32 x, S32 y, MASK mask ); + /*virtual*/ bool handleToolTip(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleKeyHere(KEY key, MASK mask); + /*virtual*/ bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType type, void* cargo_data, EAcceptance* accept, std::string& tooltip); - /*virtual*/ LLView* getChildView(const std::string& name, BOOL recurse = TRUE) const; - /*virtual*/ LLView* findChildView(const std::string& name, BOOL recurse = TRUE) const; + /*virtual*/ LLView* getChildView(const std::string& name, bool recurse = true) const; + /*virtual*/ LLView* findChildView(const std::string& name, bool recurse = true) const; /*virtual*/ void initFromParams(const LLPanel::Params& p); /*virtual*/ bool addChild(LLView* view, S32 tab_group = 0); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); struct TabPanelParams : public LLInitParam::Block<TabPanelParams> { @@ -183,7 +183,7 @@ public: void lockTabs(S32 num_tabs = 0); void unlockTabs(); S32 getNumLockedTabs() { return mLockedTabCount; } - void enableTabButton(S32 which, BOOL enable); + void enableTabButton(S32 which, bool enable); void deleteAllTabs(); LLPanel* getCurrentPanel(); S32 getCurrentPanelIndex(); @@ -199,13 +199,13 @@ public: void selectLastTab(); void selectNextTab(); void selectPrevTab(); - BOOL selectTabPanel( LLPanel* child ); - BOOL selectTab(S32 which); - BOOL selectTabByName(const std::string& title); + bool selectTabPanel( LLPanel* child ); + bool selectTab(S32 which); + bool selectTabByName(const std::string& title); void setCurrentPanelIndex(S32 index) { mCurrentTabIdx = index; } - BOOL getTabPanelFlashing(LLPanel* child); - void setTabPanelFlashing(LLPanel* child, BOOL state); + bool getTabPanelFlashing(LLPanel* child); + void setTabPanelFlashing(LLPanel* child, bool state); void setTabImage(LLPanel* child, std::string img_name, const LLColor4& color = LLColor4::white); void setTabImage(LLPanel* child, const LLUUID& img_id, const LLColor4& color = LLColor4::white); void setTabImage(LLPanel* child, LLIconCtrl* icon); @@ -240,7 +240,7 @@ private: void initButtons(); - BOOL setTab(S32 which); + bool setTab(S32 which); LLTabTuple* getTab(S32 index) { return mTabList[index]; } LLTabTuple* getTabByPanel(LLPanel* child); @@ -253,8 +253,8 @@ private: S32 getScrollPosPixels() const { return mScrollPosPixels; } void setScrollPosPixels(S32 pixels) { mScrollPosPixels = pixels; } - void setTabsHidden(BOOL hidden) { mTabsHidden = hidden; } - BOOL getTabsHidden() const { return mTabsHidden; } + void setTabsHidden(bool hidden) { mTabsHidden = hidden; } + bool getTabsHidden() const { return mTabsHidden; } void scrollPrev() { mScrollPos = llmax(0, mScrollPos-1); } // No wrap void scrollNext() { mScrollPos = llmin(mScrollPos+1, mMaxScrollPos); } // No wrap @@ -272,10 +272,10 @@ private: tuple_list_t mTabList; S32 mCurrentTabIdx; - BOOL mTabsHidden; - BOOL mHideScrollArrows; + bool mTabsHidden; + bool mHideScrollArrows; - BOOL mScrolled; + bool mScrolled; LLFrameTimer mScrollTimer; S32 mScrollPos; S32 mScrollPosPixels; @@ -290,7 +290,7 @@ private: LLButton* mPrevArrowBtn; LLButton* mNextArrowBtn; - BOOL mIsVertical; + bool mIsVertical; // Horizontal specific LLButton* mJumpPrevArrowBtn; diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index c1eedf93a7..1d358a0e9d 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -207,7 +207,7 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p) mSelectedBGColor(p.bg_selected_color), mReflowIndex(S32_MAX), mCursorPos( 0 ), - mScrollNeeded(FALSE), + mScrollNeeded(false), mDesiredXPixel(-1), mHPad(p.h_pad), mVPad(p.v_pad), @@ -224,7 +224,7 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p) mScrollIndex(-1), mSelectionStart( 0 ), mSelectionEnd( 0 ), - mIsSelecting( FALSE ), + mIsSelecting( false ), mPlainText ( p.plain_text ), mWordWrap(p.wrap), mUseEllipses( p.use_ellipses ), @@ -309,7 +309,7 @@ void LLTextBase::initFromParams(const LLTextBase::Params& p) bool LLTextBase::truncate() { - BOOL did_truncate = FALSE; + bool did_truncate = false; // First rough check - if we're less than 1/4th the size, we're OK if (getLength() >= S32(mMaxTextByteLength / 4)) @@ -320,12 +320,12 @@ bool LLTextBase::truncate() if (value.type() == LLSD::TypeString) { // save a copy for strings. - utf8_byte_size = value.size(); + utf8_byte_size = static_cast<S32>(value.size()); } else { // non string LLSDs need explicit conversion to string - utf8_byte_size = value.asString().size(); + utf8_byte_size = static_cast<S32>(value.asString().size()); } if ( utf8_byte_size > mMaxTextByteLength ) @@ -335,8 +335,8 @@ bool LLTextBase::truncate() temp_utf8_text = utf8str_truncate( temp_utf8_text, mMaxTextByteLength ); LLWString text = utf8str_to_wstring( temp_utf8_text ); // remove extra bit of current string, to preserve formatting, etc. - removeStringNoUndo(text.size(), getWText().size() - text.size()); - did_truncate = TRUE; + removeStringNoUndo(static_cast<S32>(text.size()), static_cast<S32>(getWText().size() - text.size())); + did_truncate = true; } } @@ -617,7 +617,7 @@ void LLTextBase::drawText() } else if (useLabel()) { - text_len = mLabel.getWString().length(); + text_len = static_cast<S32>(mLabel.getWString().length()); } S32 selection_left = -1; @@ -686,7 +686,7 @@ void LLTextBase::drawText() // Find the start of the first word U32 word_start = seg_start, word_end = -1; - U32 text_length = wstrText.length(); + U32 text_length = static_cast<U32>(wstrText.length()); while ( (word_start < text_length) && (!LLStringOps::isAlpha(wstrText[word_start])) ) { word_start++; @@ -789,7 +789,7 @@ void LLTextBase::drawText() } // Draw squiggly lines under any visible misspelled words - while ( (mMisspellRanges.end() != misspell_it) && (misspell_it->first < seg_end) && (misspell_it->second > seg_start) ) + while ( (mMisspellRanges.end() != misspell_it) && (misspell_it->first < (U32)seg_end) && (misspell_it->second > (U32)seg_start) ) { // Skip the current word if the user is still busy editing it if ( (!mSpellCheckTimer.hasExpired()) && (misspell_it->first <= (U32)mCursorPos) && (misspell_it->second >= (U32)mCursorPos) ) @@ -798,7 +798,7 @@ void LLTextBase::drawText() continue; } - U32 misspell_start = llmax<U32>(misspell_it->first, seg_start), misspell_end = llmin<U32>(misspell_it->second, seg_end); + U32 misspell_start = llmax<U32>(misspell_it->first, (U32)seg_start), misspell_end = llmin<U32>(misspell_it->second, (U32)seg_end); S32 squiggle_start = 0, squiggle_end = 0, pony = 0; cur_segment->getDimensions(seg_start - cur_segment->getStart(), misspell_start - seg_start, squiggle_start, pony); cur_segment->getDimensions(misspell_start - cur_segment->getStart(), misspell_end - misspell_start, squiggle_end, pony); @@ -821,7 +821,7 @@ void LLTextBase::drawText() squiggle_start += 4; } - if (misspell_it->second > seg_end) + if (misspell_it->second > (U32)seg_end) { break; } @@ -845,9 +845,16 @@ S32 LLTextBase::insertStringNoUndo(S32 pos, const LLWString &wstr, LLTextBase::s beforeValueChange(); S32 old_len = getLength(); // length() returns character length - S32 insert_len = wstr.length(); + S32 insert_len = static_cast<S32>(wstr.length()); pos = getEditableIndex(pos, true); + if (pos > old_len) + { + pos = old_len; + // Should not happen, + // if you encounter this, check where wrong position comes from + llassert(false); + } segment_set_t::iterator seg_iter = getEditableSegIterContaining(pos); @@ -909,7 +916,7 @@ S32 LLTextBase::insertStringNoUndo(S32 pos, const LLWString &wstr, LLTextBase::s { LLStyleSP emoji_style; LLEmojiDictionary* ed = LLEmojiDictionary::instanceExists() ? LLEmojiDictionary::getInstance() : NULL; - for (S32 text_kitty = 0, text_len = wstr.size(); text_kitty < text_len; text_kitty++) + for (S32 text_kitty = 0, text_len = static_cast<S32>(wstr.size()); text_kitty < text_len; text_kitty++) { llwchar code = wstr[text_kitty]; bool isEmoji = ed ? ed->isEmoji(code) : LLStringOps::isEmoji(code); @@ -1111,14 +1118,14 @@ void LLTextBase::insertSegment(LLTextSegmentPtr segment_to_insert) } //virtual -BOOL LLTextBase::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLTextBase::handleMouseDown(S32 x, S32 y, MASK mask) { // handle triple click if (!mTripleClickTimer.hasExpired()) { if (mSkipTripleClick) { - return TRUE; + return true; } S32 real_line = getLineNumFromDocIndex(mCursorPos, false); @@ -1146,27 +1153,27 @@ BOOL LLTextBase::handleMouseDown(S32 x, S32 y, MASK mask) if (line_start == -1) { - return TRUE; + return true; } mSelectionEnd = line_start; mSelectionStart = line_end; setCursorPos(line_start); - return TRUE; + return true; } LLTextSegmentPtr cur_segment = getSegmentAtLocalPos(x, y); if (cur_segment && cur_segment->handleMouseDown(x, y, mask)) { - return TRUE; + return true; } return LLUICtrl::handleMouseDown(x, y, mask); } //virtual -BOOL LLTextBase::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLTextBase::handleMouseUp(S32 x, S32 y, MASK mask) { LLTextSegmentPtr cur_segment = getSegmentAtLocalPos(x, y); if (hasMouseCapture() && cur_segment && cur_segment->handleMouseUp(x, y, mask)) @@ -1179,62 +1186,62 @@ BOOL LLTextBase::handleMouseUp(S32 x, S32 y, MASK mask) // *TODO: send URL here? (*mURLClickSignal)(this, LLSD() ); } - return TRUE; + return true; } return LLUICtrl::handleMouseUp(x, y, mask); } //virtual -BOOL LLTextBase::handleMiddleMouseDown(S32 x, S32 y, MASK mask) +bool LLTextBase::handleMiddleMouseDown(S32 x, S32 y, MASK mask) { LLTextSegmentPtr cur_segment = getSegmentAtLocalPos(x, y); if (cur_segment && cur_segment->handleMiddleMouseDown(x, y, mask)) { - return TRUE; + return true; } return LLUICtrl::handleMiddleMouseDown(x, y, mask); } //virtual -BOOL LLTextBase::handleMiddleMouseUp(S32 x, S32 y, MASK mask) +bool LLTextBase::handleMiddleMouseUp(S32 x, S32 y, MASK mask) { LLTextSegmentPtr cur_segment = getSegmentAtLocalPos(x, y); if (cur_segment && cur_segment->handleMiddleMouseUp(x, y, mask)) { - return TRUE; + return true; } return LLUICtrl::handleMiddleMouseUp(x, y, mask); } //virtual -BOOL LLTextBase::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLTextBase::handleRightMouseDown(S32 x, S32 y, MASK mask) { LLTextSegmentPtr cur_segment = getSegmentAtLocalPos(x, y); if (cur_segment && cur_segment->handleRightMouseDown(x, y, mask)) { - return TRUE; + return true; } return LLUICtrl::handleRightMouseDown(x, y, mask); } //virtual -BOOL LLTextBase::handleRightMouseUp(S32 x, S32 y, MASK mask) +bool LLTextBase::handleRightMouseUp(S32 x, S32 y, MASK mask) { LLTextSegmentPtr cur_segment = getSegmentAtLocalPos(x, y); if (cur_segment && cur_segment->handleRightMouseUp(x, y, mask)) { - return TRUE; + return true; } return LLUICtrl::handleRightMouseUp(x, y, mask); } //virtual -BOOL LLTextBase::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLTextBase::handleDoubleClick(S32 x, S32 y, MASK mask) { //Don't start triple click timer if user have clicked on scrollbar mVisibleTextRect = mScroller ? mScroller->getContentWindowRect() : getLocalRect(); @@ -1247,50 +1254,50 @@ BOOL LLTextBase::handleDoubleClick(S32 x, S32 y, MASK mask) LLTextSegmentPtr cur_segment = getSegmentAtLocalPos(x, y); if (cur_segment && cur_segment->handleDoubleClick(x, y, mask)) { - return TRUE; + return true; } return LLUICtrl::handleDoubleClick(x, y, mask); } //virtual -BOOL LLTextBase::handleHover(S32 x, S32 y, MASK mask) +bool LLTextBase::handleHover(S32 x, S32 y, MASK mask) { LLTextSegmentPtr cur_segment = getSegmentAtLocalPos(x, y); if (cur_segment && cur_segment->handleHover(x, y, mask)) { - return TRUE; + return true; } return LLUICtrl::handleHover(x, y, mask); } //virtual -BOOL LLTextBase::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLTextBase::handleScrollWheel(S32 x, S32 y, S32 clicks) { LLTextSegmentPtr cur_segment = getSegmentAtLocalPos(x, y); if (cur_segment && cur_segment->handleScrollWheel(x, y, clicks)) { - return TRUE; + return true; } return LLUICtrl::handleScrollWheel(x, y, clicks); } //virtual -BOOL LLTextBase::handleToolTip(S32 x, S32 y, MASK mask) +bool LLTextBase::handleToolTip(S32 x, S32 y, MASK mask) { LLTextSegmentPtr cur_segment = getSegmentAtLocalPos(x, y); if (cur_segment && cur_segment->handleToolTip(x, y, mask)) { - return TRUE; + return true; } return LLUICtrl::handleToolTip(x, y, mask); } //virtual -void LLTextBase::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLTextBase::reshape(S32 width, S32 height, bool called_from_parent) { if (width != getRect().getWidth() || height != getRect().getHeight() || LLView::sForceReshape) { @@ -1366,7 +1373,7 @@ void LLTextBase::draw() : hasFocus() ? mFocusBgColor.get() : mWriteableBgColor.get(); - gl_rect_2d(text_rect, bg_color % alpha, TRUE); + gl_rect_2d(text_rect, bg_color % alpha, true); } // Draw highlighted if needed @@ -1377,7 +1384,7 @@ void LLTextBase::draw() if( mScroller ) bg_rect.intersectWith( text_rect ); - gl_rect_2d( text_rect, bg_color, TRUE ); + gl_rect_2d( text_rect, bg_color, true ); } bool should_clip = mClip || mScroller != NULL; @@ -1398,9 +1405,9 @@ void LLTextBase::draw() drawCursor(); } - mDocumentView->setVisibleDirect(FALSE); + mDocumentView->setVisibleDirect(false); LLUICtrl::draw(); - mDocumentView->setVisibleDirect(TRUE); + mDocumentView->setVisibleDirect(true); } @@ -1419,7 +1426,7 @@ void LLTextBase::setReadOnlyColor(const LLColor4 &c) } //virtual -void LLTextBase::onVisibilityChange( BOOL new_visibility ) +void LLTextBase::onVisibilityChange( bool new_visibility ) { LLContextMenu* menu = static_cast<LLContextMenu*>(mPopupMenuHandle.get()); if(!new_visibility && menu) @@ -1436,7 +1443,7 @@ void LLTextBase::setValue(const LLSD& value ) } //virtual -BOOL LLTextBase::canDeselect() const +bool LLTextBase::canDeselect() const { return hasSelection(); } @@ -1447,7 +1454,7 @@ void LLTextBase::deselect() { mSelectionStart = 0; mSelectionEnd = 0; - mIsSelecting = FALSE; + mIsSelecting = false; } bool LLTextBase::getSpellCheck() const @@ -1462,7 +1469,7 @@ const std::string& LLTextBase::getSuggestion(U32 index) const U32 LLTextBase::getSuggestionCount() const { - return mSuggestionList.size(); + return static_cast<U32>(mSuggestionList.size()); } void LLTextBase::replaceWithSuggestion(U32 index) @@ -1575,7 +1582,7 @@ void LLTextBase::updateScrollFromCursor() { return; } - mScrollNeeded = FALSE; + mScrollNeeded = false; // scroll so that the cursor is at the top of the page LLRect scroller_doc_window = getVisibleDocumentRect(); @@ -2055,7 +2062,7 @@ LLTextBase::segment_set_t::const_iterator LLTextBase::getSegIterContaining(S32 i LLTextSegmentPtr LLTextBase::getSegmentAtLocalPos( S32 x, S32 y, bool hit_past_end_of_line) { // Find the cursor position at the requested local screen position - S32 offset = getDocIndexFromLocalCoord( x, y, FALSE, hit_past_end_of_line); + S32 offset = getDocIndexFromLocalCoord( x, y, false, hit_past_end_of_line); segment_set_t::iterator seg_iter = getSegIterContaining(offset); if (seg_iter != mSegments.end()) { @@ -2312,10 +2319,10 @@ void LLTextBase::setLabel(const LLStringExplicit& label) resetLabel(); } -BOOL LLTextBase::setLabelArg(const std::string& key, const LLStringExplicit& text ) +bool LLTextBase::setLabelArg(const std::string& key, const LLStringExplicit& text ) { mLabel.setArg(key, text); - return TRUE; + return true; } void LLTextBase::resetLabel() @@ -2328,7 +2335,7 @@ void LLTextBase::resetLabel() style->setColor(mTentativeFgColor); LLStyleConstSP sp(style); - LLTextSegmentPtr label = new LLLabelTextSegment(sp, 0, mLabel.getWString().length() + 1, *this); + LLTextSegmentPtr label = new LLLabelTextSegment(sp, 0, static_cast<S32>(mLabel.getWString().length()) + 1, *this); insertSegment(label); } } @@ -2388,7 +2395,7 @@ void LLTextBase::appendWidget(const LLInlineViewSegment::Params& params, const s { segment_vec_t segments; LLWString widget_wide_text = utf8str_to_wstring(text); - segments.push_back(new LLInlineViewSegment(params, getLength(), getLength() + widget_wide_text.size())); + segments.push_back(new LLInlineViewSegment(params, getLength(), getLength() + static_cast<S32>(widget_wide_text.size()))); insertStringNoUndo(getLength(), widget_wide_text, &segments); } @@ -2398,10 +2405,10 @@ void LLTextBase::appendAndHighlightTextImpl(const std::string &new_text, S32 hig // Save old state S32 selection_start = mSelectionStart; S32 selection_end = mSelectionEnd; - BOOL was_selecting = mIsSelecting; + bool was_selecting = mIsSelecting; S32 cursor_pos = mCursorPos; S32 old_length = getLength(); - BOOL cursor_was_at_end = (mCursorPos == old_length); + bool cursor_was_at_end = (mCursorPos == old_length); deselect(); @@ -2429,11 +2436,11 @@ void LLTextBase::appendAndHighlightTextImpl(const std::string &new_text, S32 hig { highlight_params.font.style("NORMAL"); LLStyleConstSP normal_sp(new LLStyle(highlight_params)); - segmentp = new LLOnHoverChangeableTextSegment(sp, normal_sp, cur_length, cur_length + wide_text.size(), *this); + segmentp = new LLOnHoverChangeableTextSegment(sp, normal_sp, cur_length, cur_length + static_cast<S32>(wide_text.size()), *this); } else { - segmentp = new LLNormalTextSegment(sp, cur_length, cur_length + wide_text.size(), *this); + segmentp = new LLNormalTextSegment(sp, cur_length, cur_length + static_cast<S32>(wide_text.size()), *this); } segment_vec_t segments; segments.push_back(segmentp); @@ -2447,7 +2454,7 @@ void LLTextBase::appendAndHighlightTextImpl(const std::string &new_text, S32 hig segment_vec_t segments; S32 segment_start = old_length; - S32 segment_end = old_length + wide_text.size(); + S32 segment_end = old_length + static_cast<S32>(wide_text.size()); LLStyleConstSP sp(new LLStyle(style_params)); if (underline_on_hover_only || mSkipLinkUnderline) { @@ -2538,7 +2545,7 @@ void LLTextBase::replaceUrl(const std::string &url, S32 start = seg->getStart(); S32 end = seg->getEnd(); text = text.substr(0, start) + wlabel + text.substr(end, text.size() - end + 1); - seg->setEnd(start + wlabel.size()); + seg->setEnd(start + static_cast<S32>(wlabel.size())); modified = true; } @@ -2586,7 +2593,7 @@ const LLWString& LLTextBase::getWText() const // will be put to its right. If round is false, the cursor will always be put to the // character's left. -S32 LLTextBase::getDocIndexFromLocalCoord( S32 local_x, S32 local_y, BOOL round, bool hit_past_end_of_line) const +S32 LLTextBase::getDocIndexFromLocalCoord( S32 local_x, S32 local_y, bool round, bool hit_past_end_of_line) const { // Figure out which line we're nearest to. LLRect doc_rect = mDocumentView->getRect(); @@ -2866,7 +2873,7 @@ void LLTextBase::changeLine( S32 delta ) { LLRect visible_region = getVisibleDocumentRect(); S32 new_cursor_pos = getDocIndexFromLocalCoord(mDesiredXPixel, - mLineInfoList[new_line].mRect.mBottom + mVisibleTextRect.mBottom - visible_region.mBottom, TRUE); + mLineInfoList[new_line].mRect.mBottom + mVisibleTextRect.mBottom - visible_region.mBottom, true); S32 actual_line = getLineNumFromDocIndex(new_cursor_pos); if (actual_line != new_line) { @@ -2891,7 +2898,7 @@ bool LLTextBase::setCursor(S32 row, S32 column) { if (row < 0 || column < 0) return false; - S32 n_lines = mLineInfoList.size(); + S32 n_lines = static_cast<S32>(mLineInfoList.size()); for (S32 line = row; line < n_lines; ++line) { const line_info& li = mLineInfoList[line]; @@ -3129,7 +3136,7 @@ void LLTextBase::startSelection() { if( !mIsSelecting ) { - mIsSelecting = TRUE; + mIsSelecting = true; mSelectionStart = mCursorPos; mSelectionEnd = mCursorPos; } @@ -3139,7 +3146,7 @@ void LLTextBase::endSelection() { if( mIsSelecting ) { - mIsSelecting = FALSE; + mIsSelecting = false; mSelectionEnd = mCursorPos; } } @@ -3248,17 +3255,17 @@ void LLTextSegment::setToken( LLKeywordToken* token ) {} LLKeywordToken* LLTextSegment::getToken() const { return NULL; } void LLTextSegment::setToolTip( const std::string &msg ) {} void LLTextSegment::dump() const {} -BOOL LLTextSegment::handleMouseDown(S32 x, S32 y, MASK mask) { return FALSE; } -BOOL LLTextSegment::handleMouseUp(S32 x, S32 y, MASK mask) { return FALSE; } -BOOL LLTextSegment::handleMiddleMouseDown(S32 x, S32 y, MASK mask) { return FALSE; } -BOOL LLTextSegment::handleMiddleMouseUp(S32 x, S32 y, MASK mask) { return FALSE; } -BOOL LLTextSegment::handleRightMouseDown(S32 x, S32 y, MASK mask) { return FALSE; } -BOOL LLTextSegment::handleRightMouseUp(S32 x, S32 y, MASK mask) { return FALSE; } -BOOL LLTextSegment::handleDoubleClick(S32 x, S32 y, MASK mask) { return FALSE; } -BOOL LLTextSegment::handleHover(S32 x, S32 y, MASK mask) { return FALSE; } -BOOL LLTextSegment::handleScrollWheel(S32 x, S32 y, S32 clicks) { return FALSE; } -BOOL LLTextSegment::handleScrollHWheel(S32 x, S32 y, S32 clicks) { return FALSE; } -BOOL LLTextSegment::handleToolTip(S32 x, S32 y, MASK mask) { return FALSE; } +bool LLTextSegment::handleMouseDown(S32 x, S32 y, MASK mask) { return false; } +bool LLTextSegment::handleMouseUp(S32 x, S32 y, MASK mask) { return false; } +bool LLTextSegment::handleMiddleMouseDown(S32 x, S32 y, MASK mask) { return false; } +bool LLTextSegment::handleMiddleMouseUp(S32 x, S32 y, MASK mask) { return false; } +bool LLTextSegment::handleRightMouseDown(S32 x, S32 y, MASK mask) { return false; } +bool LLTextSegment::handleRightMouseUp(S32 x, S32 y, MASK mask) { return false; } +bool LLTextSegment::handleDoubleClick(S32 x, S32 y, MASK mask) { return false; } +bool LLTextSegment::handleHover(S32 x, S32 y, MASK mask) { return false; } +bool LLTextSegment::handleScrollWheel(S32 x, S32 y, S32 clicks) { return false; } +bool LLTextSegment::handleScrollHWheel(S32 x, S32 y, S32 clicks) { return false; } +bool LLTextSegment::handleToolTip(S32 x, S32 y, MASK mask) { return false; } const std::string& LLTextSegment::getName() const { return LLStringUtil::null; @@ -3266,7 +3273,7 @@ const std::string& LLTextSegment::getName() const void LLTextSegment::onMouseCaptureLost() {} void LLTextSegment::screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const {} void LLTextSegment::localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const {} -BOOL LLTextSegment::hasMouseCapture() { return FALSE; } +bool LLTextSegment::hasMouseCapture() { return false; } // // LLNormalTextSegment @@ -3287,7 +3294,7 @@ LLNormalTextSegment::LLNormalTextSegment( LLStyleConstSP style, S32 start, S32 e } } -LLNormalTextSegment::LLNormalTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, BOOL is_visible) +LLNormalTextSegment::LLNormalTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, bool is_visible) : LLTextSegment(start, end), mToken(NULL), mEditor(editor) @@ -3387,7 +3394,7 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele return right_x; } -BOOL LLNormalTextSegment::handleHover(S32 x, S32 y, MASK mask) +bool LLNormalTextSegment::handleHover(S32 x, S32 y, MASK mask) { if (getStyle() && getStyle()->isLink()) { @@ -3395,13 +3402,13 @@ BOOL LLNormalTextSegment::handleHover(S32 x, S32 y, MASK mask) if(mEditor.getSegmentAtLocalPos(x, y, false) == this) { LLUI::getInstance()->getWindow()->setCursor(UI_CURSOR_HAND); - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL LLNormalTextSegment::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLNormalTextSegment::handleRightMouseDown(S32 x, S32 y, MASK mask) { if (getStyle() && getStyle()->isLink()) { @@ -3409,13 +3416,13 @@ BOOL LLNormalTextSegment::handleRightMouseDown(S32 x, S32 y, MASK mask) if(mEditor.getSegmentAtLocalPos(x, y, false) == this) { mEditor.createUrlContextMenu(x, y, getStyle()->getLinkHREF()); - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL LLNormalTextSegment::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLNormalTextSegment::handleMouseDown(S32 x, S32 y, MASK mask) { if (getStyle() && getStyle()->isLink()) { @@ -3423,14 +3430,14 @@ BOOL LLNormalTextSegment::handleMouseDown(S32 x, S32 y, MASK mask) if(mEditor.getSegmentAtLocalPos(x, y, false) == this) { // eat mouse down event on hyperlinks, so we get the mouse up - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL LLNormalTextSegment::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLNormalTextSegment::handleMouseUp(S32 x, S32 y, MASK mask) { if (getStyle() && getStyle()->isLink()) { @@ -3446,14 +3453,14 @@ BOOL LLNormalTextSegment::handleMouseUp(S32 x, S32 y, MASK mask) { LLUrlAction::openURLExternal(url); } - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL LLNormalTextSegment::handleToolTip(S32 x, S32 y, MASK mask) +bool LLNormalTextSegment::handleToolTip(S32 x, S32 y, MASK mask) { std::string msg; // do we have a tooltip for a loaded keyword (for script editor)? @@ -3461,16 +3468,16 @@ BOOL LLNormalTextSegment::handleToolTip(S32 x, S32 y, MASK mask) { const LLWString& wmsg = mToken->getToolTip(); LLToolTipMgr::instance().show(wstring_to_utf8str(wmsg), (mToken->getType() == LLKeywordToken::TT_FUNCTION)); - return TRUE; + return true; } // or do we have an explicitly set tooltip (e.g., for Urls) if (!mTooltip.empty()) { LLToolTipMgr::instance().show(mTooltip); - return TRUE; + return true; } - return FALSE; + return false; } void LLNormalTextSegment::setToolTip(const std::string& tooltip) @@ -3530,7 +3537,7 @@ S32 LLNormalTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 lin : LLFontGL::ONLY_WORD_BOUNDARIES; - S32 offsetLength = text.length() - (segment_offset + mStart); + S32 offsetLength = static_cast<S32>(text.length()) - (segment_offset + mStart); if(getLength() < segment_offset + mStart) { @@ -3572,9 +3579,9 @@ S32 LLNormalTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 lin void LLNormalTextSegment::dump() const { LL_INFOS() << "Segment [" << -// mColor.mV[VX] << ", " << -// mColor.mV[VY] << ", " << -// mColor.mV[VZ] << "]\t[" << +// mColor.mV[VRED] << ", " << +// mColor.mV[VGREEN] << ", " << +// mColor.mV[VBLUE] << "]\t[" << mStart << ", " << getEnd() << "]" << LL_ENDL; @@ -3597,7 +3604,7 @@ LLLabelTextSegment::LLLabelTextSegment( LLStyleConstSP style, S32 start, S32 end { } -LLLabelTextSegment::LLLabelTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, BOOL is_visible) +LLLabelTextSegment::LLLabelTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, bool is_visible) : LLNormalTextSegment(color, start, end, editor, is_visible) { } @@ -3610,7 +3617,7 @@ const LLWString& LLLabelTextSegment::getWText() const /*virtual*/ const S32 LLLabelTextSegment::getLength() const { - return mEditor.getWlabel().length(); + return static_cast<S32>(mEditor.getWlabel().length()); } // @@ -3621,12 +3628,12 @@ LLEmojiTextSegment::LLEmojiTextSegment(LLStyleConstSP style, S32 start, S32 end, { } -LLEmojiTextSegment::LLEmojiTextSegment(const LLColor4& color, S32 start, S32 end, LLTextBase& editor, BOOL is_visible) +LLEmojiTextSegment::LLEmojiTextSegment(const LLColor4& color, S32 start, S32 end, LLTextBase& editor, bool is_visible) : LLNormalTextSegment(color, start, end, editor, is_visible) { } -BOOL LLEmojiTextSegment::handleToolTip(S32 x, S32 y, MASK mask) +bool LLEmojiTextSegment::handleToolTip(S32 x, S32 y, MASK mask) { if (mTooltip.empty()) { @@ -3661,7 +3668,7 @@ F32 LLOnHoverChangeableTextSegment::draw(S32 start, S32 end, S32 selection_start } /*virtual*/ -BOOL LLOnHoverChangeableTextSegment::handleHover(S32 x, S32 y, MASK mask) +bool LLOnHoverChangeableTextSegment::handleHover(S32 x, S32 y, MASK mask) { mStyle = mEditor.getSkipLinkUnderline() ? mNormalStyle : mHoveredStyle; return LLNormalTextSegment::handleHover(x, y, mask); @@ -3836,15 +3843,15 @@ S32 LLImageTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 lin return 0; } -BOOL LLImageTextSegment::handleToolTip(S32 x, S32 y, MASK mask) +bool LLImageTextSegment::handleToolTip(S32 x, S32 y, MASK mask) { if (!mTooltip.empty()) { LLToolTipMgr::instance().show(mTooltip); - return TRUE; + return true; } - return FALSE; + return false; } void LLImageTextSegment::setToolTip(const std::string& tooltip) diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 97507fe800..4120d9ea32 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -94,22 +94,22 @@ public: virtual void dump() const; // LLMouseHandler interface - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); - /*virtual*/ BOOL handleScrollHWheel(S32 x, S32 y, S32 clicks); - /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMiddleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMiddleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleRightMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleRightMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleDoubleClick(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleScrollWheel(S32 x, S32 y, S32 clicks); + /*virtual*/ bool handleScrollHWheel(S32 x, S32 y, S32 clicks); + /*virtual*/ bool handleToolTip(S32 x, S32 y, MASK mask); /*virtual*/ const std::string& getName() const; /*virtual*/ void onMouseCaptureLost(); /*virtual*/ void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const; /*virtual*/ void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const; - /*virtual*/ BOOL hasMouseCapture(); + /*virtual*/ bool hasMouseCapture(); S32 getStart() const { return mStart; } void setStart(S32 start) { mStart = start; } @@ -125,7 +125,7 @@ class LLNormalTextSegment : public LLTextSegment { public: LLNormalTextSegment( LLStyleConstSP style, S32 start, S32 end, LLTextBase& editor ); - LLNormalTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, BOOL is_visible = TRUE); + LLNormalTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, bool is_visible = true); virtual ~LLNormalTextSegment(); /*virtual*/ bool getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const; @@ -138,15 +138,15 @@ public: /*virtual*/ void setStyle(LLStyleConstSP style) { mStyle = style; } /*virtual*/ void setToken( LLKeywordToken* token ) { mToken = token; } /*virtual*/ LLKeywordToken* getToken() const { return mToken; } - /*virtual*/ BOOL getToolTip( std::string& msg ) const; + /*virtual*/ bool getToolTip( std::string& msg ) const; /*virtual*/ void setToolTip(const std::string& tooltip); /*virtual*/ void dump() const; - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleRightMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleToolTip(S32 x, S32 y, MASK mask); protected: F32 drawClippedSegment(S32 seg_start, S32 seg_end, S32 selection_start, S32 selection_end, LLRectf rect); @@ -170,7 +170,7 @@ class LLLabelTextSegment : public LLNormalTextSegment { public: LLLabelTextSegment( LLStyleConstSP style, S32 start, S32 end, LLTextBase& editor ); - LLLabelTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, BOOL is_visible = TRUE); + LLLabelTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, bool is_visible = true); protected: @@ -184,10 +184,10 @@ class LLEmojiTextSegment : public LLNormalTextSegment { public: LLEmojiTextSegment(LLStyleConstSP style, S32 start, S32 end, LLTextBase& editor); - LLEmojiTextSegment(const LLColor4& color, S32 start, S32 end, LLTextBase& editor, BOOL is_visible = TRUE); + LLEmojiTextSegment(const LLColor4& color, S32 start, S32 end, LLTextBase& editor, bool is_visible = true); bool canEdit() const override { return false; } - BOOL handleToolTip(S32 x, S32 y, MASK mask) override; + bool handleToolTip(S32 x, S32 y, MASK mask) override; }; // Text segment that changes it's style depending of mouse pointer position ( is it inside or outside segment) @@ -196,7 +196,7 @@ class LLOnHoverChangeableTextSegment : public LLNormalTextSegment public: LLOnHoverChangeableTextSegment( LLStyleConstSP style, LLStyleConstSP normal_style, S32 start, S32 end, LLTextBase& editor ); /*virtual*/ F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect); - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); protected: // Style used for text when mouse pointer is over segment LLStyleConstSP mHoveredStyle; @@ -267,7 +267,7 @@ public: S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 char_offset, S32 max_chars, S32 line_ind) const; F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect); - /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleToolTip(S32 x, S32 y, MASK mask); /*virtual*/ void setToolTip(const std::string& tooltip); private: @@ -355,32 +355,32 @@ public: }; // LLMouseHandler interface - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) override; - /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleMiddleMouseDown(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleMiddleMouseUp(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleRightMouseDown(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleRightMouseUp(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleDoubleClick(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleScrollWheel(S32 x, S32 y, S32 clicks) override; + /*virtual*/ bool handleToolTip(S32 x, S32 y, MASK mask) override; // LLView interface - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE) override; + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true) override; /*virtual*/ void draw() override; // LLUICtrl interface - /*virtual*/ BOOL acceptsTextInput() const override { return !mReadOnly; } + /*virtual*/ bool acceptsTextInput() const override { return !mReadOnly; } /*virtual*/ void setColor(const LLColor4& c) override; virtual void setReadOnlyColor(const LLColor4 &c); - /*virtual*/ void onVisibilityChange(BOOL new_visibility) override; + /*virtual*/ void onVisibilityChange(bool new_visibility) override; /*virtual*/ void setValue(const LLSD& value) override; /*virtual*/ LLTextViewModel* getViewModel() const override; // LLEditMenuHandler interface - /*virtual*/ BOOL canDeselect() const override; + /*virtual*/ bool canDeselect() const override; /*virtual*/ void deselect() override; virtual void onFocusReceived() override; @@ -436,7 +436,7 @@ public: void appendText(const std::string &new_text, bool prepend_newline, const LLStyle::Params& input_params = LLStyle::Params()); void setLabel(const LLStringExplicit& label); - /*virtual*/ BOOL setLabelArg(const std::string& key, const LLStringExplicit& text) override; + /*virtual*/ bool setLabelArg(const std::string& key, const LLStringExplicit& text) override; const std::string& getLabel() { return mLabel.getString(); } const LLWString& getWlabel() { return mLabel.getWString();} @@ -454,8 +454,8 @@ public: // force reflow of text void needsReflow(S32 index = 0); - S32 getLength() const { return getWText().length(); } - S32 getLineCount() const { return mLineInfoList.size(); } + S32 getLength() const { return static_cast<S32>(getWText().length()); } + S32 getLineCount() const { return static_cast<S32>(mLineInfoList.size()); } S32 removeFirstLine(); // returns removed length void addDocumentChild(LLView* view); @@ -470,7 +470,7 @@ public: F32 getLineSpacingMult() { return mLineSpacingMult; } S32 getLineSpacingPixels() { return mLineSpacingPixels; } // only for multiline - S32 getDocIndexFromLocalCoord( S32 local_x, S32 local_y, BOOL round, bool hit_past_end_of_line = true) const; + S32 getDocIndexFromLocalCoord( S32 local_x, S32 local_y, bool round, bool hit_past_end_of_line = true) const; LLRect getLocalRectFromDocIndex(S32 pos) const; LLRect getDocRectFromDocIndex(S32 pos) const; @@ -545,7 +545,7 @@ protected: class TextCmd { public: - TextCmd( S32 pos, BOOL group_with_next, LLTextSegmentPtr segment = LLTextSegmentPtr() ) + TextCmd( S32 pos, bool group_with_next, LLTextSegmentPtr segment = LLTextSegmentPtr() ) : mPos(pos), mGroupWithNext(group_with_next) { @@ -555,13 +555,13 @@ protected: } } virtual ~TextCmd() {} - virtual BOOL execute(LLTextBase* editor, S32* delta) = 0; + virtual bool execute(LLTextBase* editor, S32* delta) = 0; virtual S32 undo(LLTextBase* editor) = 0; virtual S32 redo(LLTextBase* editor) = 0; - virtual BOOL canExtend(S32 pos) const { return FALSE; } + virtual bool canExtend(S32 pos) const { return false; } virtual void blockExtensions() {} - virtual BOOL extendAndExecute( LLTextBase* editor, S32 pos, llwchar c, S32* delta ) { llassert(0); return 0; } - virtual BOOL hasExtCharValue( llwchar value ) const { return FALSE; } + virtual bool extendAndExecute( LLTextBase* editor, S32 pos, llwchar c, S32* delta ) { llassert(0); return 0; } + virtual bool hasExtCharValue( llwchar value ) const { return false; } // Defined here so they can access protected LLTextEditor editing methods S32 insert(LLTextBase* editor, S32 pos, const LLWString &wstr) { return editor->insertStringNoUndo( pos, wstr, &mSegments ); } @@ -569,11 +569,11 @@ protected: S32 overwrite(LLTextBase* editor, S32 pos, llwchar wc) { return editor->overwriteCharNoUndo(pos, wc); } S32 getPosition() const { return mPos; } - BOOL groupWithNext() const { return mGroupWithNext; } + bool groupWithNext() const { return mGroupWithNext; } protected: const S32 mPos; - BOOL mGroupWithNext; + bool mGroupWithNext; segment_vec_t mSegments; }; @@ -641,7 +641,7 @@ protected: // misc void updateRects(); - void needsScroll() { mScrollNeeded = TRUE; } + void needsScroll() { mScrollNeeded = true; } struct URLLabelCallback; // Replace a URL with a new icon and label, for example, when @@ -695,7 +695,7 @@ protected: S32 mSelectionEnd; LLTimer mTripleClickTimer; - BOOL mIsSelecting; // Are we in the middle of a drag-select? + bool mIsSelecting; // Are we in the middle of a drag-select? // spell checking bool mSpellCheck; diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp index ba756a2906..92551b682c 100644 --- a/indra/llui/lltextbox.cpp +++ b/indra/llui/lltextbox.cpp @@ -39,7 +39,7 @@ static LLDefaultChildRegistry::Register<LLTextBox> r("text"); // Compiler optimization, generate extern template template class LLTextBox* LLView::getChild<class LLTextBox>( - const std::string& name, BOOL recurse) const; + const std::string& name, bool recurse) const; LLTextBox::LLTextBox(const LLTextBox::Params& p) : LLTextBase(p), @@ -52,9 +52,9 @@ LLTextBox::LLTextBox(const LLTextBox::Params& p) LLTextBox::~LLTextBox() {} -BOOL LLTextBox::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLTextBox::handleMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = LLTextBase::handleMouseDown(x, y, mask); + bool handled = LLTextBase::handleMouseDown(x, y, mask); if (getSoundFlags() & MOUSE_DOWN) { @@ -63,7 +63,7 @@ BOOL LLTextBox::handleMouseDown(S32 x, S32 y, MASK mask) if (!handled && mClickedCallback) { - handled = TRUE; + handled = true; } if (handled) @@ -75,9 +75,9 @@ BOOL LLTextBox::handleMouseDown(S32 x, S32 y, MASK mask) return handled; } -BOOL LLTextBox::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLTextBox::handleMouseUp(S32 x, S32 y, MASK mask) { - BOOL handled = LLTextBase::handleMouseUp(x, y, mask); + bool handled = LLTextBase::handleMouseUp(x, y, mask); if (getSoundFlags() & MOUSE_UP) { @@ -96,26 +96,26 @@ BOOL LLTextBox::handleMouseUp(S32 x, S32 y, MASK mask) if (mClickedCallback && !handled) { mClickedCallback(); - handled = TRUE; + handled = true; } } return handled; } -BOOL LLTextBox::handleHover(S32 x, S32 y, MASK mask) +bool LLTextBox::handleHover(S32 x, S32 y, MASK mask) { - BOOL handled = LLTextBase::handleHover(x, y, mask); + bool handled = LLTextBase::handleHover(x, y, mask); if (!handled && mClickedCallback && mShowCursorHand) { // Clickable text boxes change the cursor to a hand LLUI::getInstance()->getWindow()->setCursor(UI_CURSOR_HAND); - return TRUE; + return true; } return handled; } -void LLTextBox::setEnabled(BOOL enabled) +void LLTextBox::setEnabled(bool enabled) { // just treat enabled as read-only flag bool read_only = !enabled; @@ -156,16 +156,16 @@ LLSD LLTextBox::getValue() const return getViewModel()->getValue(); } -BOOL LLTextBox::setTextArg( const std::string& key, const LLStringExplicit& text ) +bool LLTextBox::setTextArg( const std::string& key, const LLStringExplicit& text ) { mText.setArg(key, text); LLTextBase::setText(mText.getString()); - return TRUE; + return true; } -void LLTextBox::reshapeToFitText(BOOL called_from_parent) +void LLTextBox::reshapeToFitText(bool called_from_parent) { reflow(); diff --git a/indra/llui/lltextbox.h b/indra/llui/lltextbox.h index cdff041646..c1f829c2b9 100644 --- a/indra/llui/lltextbox.h +++ b/indra/llui/lltextbox.h @@ -48,11 +48,11 @@ protected: public: virtual ~LLTextBox(); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); - /*virtual*/ void setEnabled(BOOL enabled); + /*virtual*/ void setEnabled(bool enabled); /*virtual*/ void setText( const LLStringExplicit& text, const LLStyle::Params& input_params = LLStyle::Params() ); @@ -60,13 +60,13 @@ public: void setHAlign( LLFontGL::HAlign align ) { mHAlign = align; } void setClickedCallback( boost::function<void (void*)> cb, void* userdata = NULL ); - void reshapeToFitText(BOOL called_from_parent = FALSE); + void reshapeToFitText(bool called_from_parent = false); S32 getTextPixelWidth(); S32 getTextPixelHeight(); /*virtual*/ LLSD getValue() const; - /*virtual*/ BOOL setTextArg( const std::string& key, const LLStringExplicit& text ); + /*virtual*/ bool setTextArg( const std::string& key, const LLStringExplicit& text ); void setShowCursorHand(bool show_cursor) { mShowCursorHand = show_cursor; } @@ -81,7 +81,7 @@ protected: // Build time optimization, generate once in .cpp file #ifndef LLTEXTBOX_CPP extern template class LLTextBox* LLView::getChild<class LLTextBox>( - const std::string& name, BOOL recurse) const; + const std::string& name, bool recurse) const; #endif #endif diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index a76b11621a..5d30c1299a 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -71,7 +71,7 @@ static LLDefaultChildRegistry::Register<LLTextEditor> r("simple_text_editor"); // Compiler optimization, generate extern template template class LLTextEditor* LLView::getChild<class LLTextEditor>( - const std::string& name, BOOL recurse) const; + const std::string& name, bool recurse) const; // // Constants @@ -84,12 +84,12 @@ const F32 SPELLCHECK_DELAY = 0.5f; // delay between the last keypress and s class LLTextEditor::TextCmdInsert : public LLTextBase::TextCmd { public: - TextCmdInsert(S32 pos, BOOL group_with_next, const LLWString &ws, LLTextSegmentPtr segment) + TextCmdInsert(S32 pos, bool group_with_next, const LLWString &ws, LLTextSegmentPtr segment) : TextCmd(pos, group_with_next, segment), mWString(ws) { } virtual ~TextCmdInsert() {} - virtual BOOL execute( LLTextBase* editor, S32* delta ) + virtual bool execute( LLTextBase* editor, S32* delta ) { *delta = insert(editor, getPosition(), mWString ); LLWStringUtil::truncate(mWString, *delta); @@ -98,13 +98,13 @@ public: } virtual S32 undo( LLTextBase* editor ) { - remove(editor, getPosition(), mWString.length() ); + remove(editor, getPosition(), static_cast<S32>(mWString.length())); return getPosition(); } virtual S32 redo( LLTextBase* editor ) { - insert(editor, getPosition(), mWString ); - return getPosition() + mWString.length(); + insert(editor, getPosition(), mWString); + return getPosition() + static_cast<S32>(mWString.length()); } private: @@ -115,29 +115,29 @@ private: class LLTextEditor::TextCmdAddChar : public LLTextBase::TextCmd { public: - TextCmdAddChar( S32 pos, BOOL group_with_next, llwchar wc, LLTextSegmentPtr segment) - : TextCmd(pos, group_with_next, segment), mWString(1, wc), mBlockExtensions(FALSE) + TextCmdAddChar( S32 pos, bool group_with_next, llwchar wc, LLTextSegmentPtr segment) + : TextCmd(pos, group_with_next, segment), mWString(1, wc), mBlockExtensions(false) { } virtual void blockExtensions() { - mBlockExtensions = TRUE; + mBlockExtensions = true; } - virtual BOOL canExtend(S32 pos) const + virtual bool canExtend(S32 pos) const { // cannot extend text with custom segments - if (!mSegments.empty()) return FALSE; + if (!mSegments.empty()) return false; return !mBlockExtensions && (pos == getPosition() + (S32)mWString.length()); } - virtual BOOL execute( LLTextBase* editor, S32* delta ) + virtual bool execute( LLTextBase* editor, S32* delta ) { *delta = insert(editor, getPosition(), mWString); LLWStringUtil::truncate(mWString, *delta); //mWString = wstring_truncate(mWString, *delta); return (*delta != 0); } - virtual BOOL extendAndExecute( LLTextBase* editor, S32 pos, llwchar wc, S32* delta ) + virtual bool extendAndExecute( LLTextBase* editor, S32 pos, llwchar wc, S32* delta ) { LLWString ws; ws += wc; @@ -151,18 +151,18 @@ public: } virtual S32 undo( LLTextBase* editor ) { - remove(editor, getPosition(), mWString.length() ); + remove(editor, getPosition(), static_cast<S32>(mWString.length())); return getPosition(); } virtual S32 redo( LLTextBase* editor ) { - insert(editor, getPosition(), mWString ); - return getPosition() + mWString.length(); + insert(editor, getPosition(), mWString); + return getPosition() + static_cast<S32>(mWString.length()); } private: LLWString mWString; - BOOL mBlockExtensions; + bool mBlockExtensions; }; @@ -170,7 +170,7 @@ private: class LLTextEditor::TextCmdAddString : public LLTextBase::TextCmd { public: - TextCmdAddString(S32 pos, BOOL group_with_next, char *str, + TextCmdAddString(S32 pos, bool group_with_next, char *str, LLTextSegmentPtr segment) : TextCmd(pos, group_with_next, segment), mWString(utf8str_to_wstring(str)), @@ -181,14 +181,14 @@ public: { mBlockExtensions = TRUE; } - virtual BOOL canExtend(S32 pos) const + virtual bool canExtend(S32 pos) const { if (!mSegments.empty()) return FALSE; return !mBlockExtensions && (pos == getPosition() + (S32)mWString.length()); } - virtual BOOL execute(LLTextBase* editor, S32* delta) + virtual bool execute(LLTextBase* editor, S32* delta) { *delta = insert(editor, getPosition(), mWString); LLWStringUtil::truncate(mWString, *delta); @@ -207,7 +207,7 @@ public: private: LLWString mWString; - BOOL mBlockExtensions; + bool mBlockExtensions; }; /////////////////////////////////////////////////////////////////// @@ -215,15 +215,15 @@ private: class LLTextEditor::TextCmdOverwriteChar : public LLTextBase::TextCmd { public: - TextCmdOverwriteChar( S32 pos, BOOL group_with_next, llwchar wc) + TextCmdOverwriteChar( S32 pos, bool group_with_next, llwchar wc) : TextCmd(pos, group_with_next), mChar(wc), mOldChar(0) {} - virtual BOOL execute( LLTextBase* editor, S32* delta ) + virtual bool execute( LLTextBase* editor, S32* delta ) { mOldChar = editor->getWText()[getPosition()]; overwrite(editor, getPosition(), mChar); *delta = 0; - return TRUE; + return true; } virtual S32 undo( LLTextBase* editor ) { @@ -246,12 +246,12 @@ private: class LLTextEditor::TextCmdRemove : public LLTextBase::TextCmd { public: - TextCmdRemove( S32 pos, BOOL group_with_next, S32 len, segment_vec_t& segments ) : + TextCmdRemove( S32 pos, bool group_with_next, S32 len, segment_vec_t& segments ) : TextCmd(pos, group_with_next), mLen(len) { std::swap(mSegments, segments); } - virtual BOOL execute( LLTextBase* editor, S32* delta ) + virtual bool execute( LLTextBase* editor, S32* delta ) { mWString = editor->getWText().substr(getPosition(), mLen); *delta = remove(editor, getPosition(), mLen ); @@ -260,7 +260,7 @@ public: virtual S32 undo( LLTextBase* editor ) { insert(editor, getPosition(), mWString); - return getPosition() + mWString.length(); + return getPosition() + static_cast<S32>(mWString.length()); } virtual S32 redo( LLTextBase* editor ) { @@ -293,7 +293,7 @@ LLTextEditor::Params::Params() LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) : LLTextBase(p), mAutoreplaceCallback(), - mBaseDocIsPristine(TRUE), + mBaseDocIsPristine(true), mPristineCmd( NULL ), mLastCmd( NULL ), mDefaultColor( p.default_color() ), @@ -387,7 +387,7 @@ void LLTextEditor::setText(const LLStringExplicit &utf8str, const LLStyle::Param resetDirty(); } -void LLTextEditor::selectNext(const std::string& search_text_in, BOOL case_insensitive, BOOL wrap) +void LLTextEditor::selectNext(const std::string& search_text_in, bool case_insensitive, bool wrap) { if (search_text_in.empty()) { @@ -409,22 +409,22 @@ void LLTextEditor::selectNext(const std::string& search_text_in, BOOL case_insen if (selected_text == search_text) { // We already have this word selected, we are searching for the next. - setCursorPos(mCursorPos + search_text.size()); + setCursorPos(mCursorPos + static_cast<S32>(search_text.size())); } } - S32 loc = text.find(search_text,mCursorPos); + S32 loc = static_cast<S32>(text.find(search_text,mCursorPos)); // If Maybe we wrapped, search again if (wrap && (-1 == loc)) { - loc = text.find(search_text); + loc = static_cast<S32>(text.find(search_text)); } // If still -1, then search_text just isn't found. if (-1 == loc) { - mIsSelecting = FALSE; + mIsSelecting = false; mSelectionEnd = 0; mSelectionStart = 0; return; @@ -432,15 +432,15 @@ void LLTextEditor::selectNext(const std::string& search_text_in, BOOL case_insen setCursorPos(loc); - mIsSelecting = TRUE; + mIsSelecting = true; mSelectionEnd = mCursorPos; mSelectionStart = llmin((S32)getLength(), (S32)(mCursorPos + search_text.size())); } -BOOL LLTextEditor::replaceText(const std::string& search_text_in, const std::string& replace_text, - BOOL case_insensitive, BOOL wrap) +bool LLTextEditor::replaceText(const std::string& search_text_in, const std::string& replace_text, + bool case_insensitive, bool wrap) { - BOOL replaced = FALSE; + bool replaced = false; if (search_text_in.empty()) { @@ -462,7 +462,7 @@ BOOL LLTextEditor::replaceText(const std::string& search_text_in, const std::str if (selected_text == search_text) { insertText(replace_text); - replaced = TRUE; + replaced = true; } } @@ -470,15 +470,15 @@ BOOL LLTextEditor::replaceText(const std::string& search_text_in, const std::str return replaced; } -void LLTextEditor::replaceTextAll(const std::string& search_text, const std::string& replace_text, BOOL case_insensitive) +void LLTextEditor::replaceTextAll(const std::string& search_text, const std::string& replace_text, bool case_insensitive) { startOfDoc(); - selectNext(search_text, case_insensitive, FALSE); + selectNext(search_text, case_insensitive, false); - BOOL replaced = TRUE; + bool replaced = true; while ( replaced ) { - replaced = replaceText(search_text,replace_text, case_insensitive, FALSE); + replaced = replaceText(search_text,replace_text, case_insensitive, false); } } @@ -566,7 +566,7 @@ void LLTextEditor::setShowEmojiHelper(bool show) mShowEmojiHelper = show; } -BOOL LLTextEditor::selectionContainsLineBreaks() +bool LLTextEditor::selectionContainsLineBreaks() { if (hasSelection()) { @@ -578,11 +578,11 @@ BOOL LLTextEditor::selectionContainsLineBreaks() { if (wtext[i] == '\n') { - return TRUE; + return true; } } } - return FALSE; + return false; } @@ -613,7 +613,7 @@ S32 LLTextEditor::indentLine( S32 pos, S32 spaces ) LLWString wtext = getWText(); if (wtext[pos] == ' ') { - delta_spaces += remove( pos, 1, FALSE ); + delta_spaces += remove( pos, 1, false ); } } } @@ -628,7 +628,7 @@ void LLTextEditor::indentSelectedLines( S32 spaces ) LLWString text = getWText(); S32 left = llmin( mSelectionStart, mSelectionEnd ); S32 right = left + llabs( mSelectionStart - mSelectionEnd ); - BOOL cursor_on_right = (mSelectionEnd > mSelectionStart); + bool cursor_on_right = (mSelectionEnd > mSelectionStart); S32 cur = left; // Expand left to start of line @@ -707,9 +707,9 @@ void LLTextEditor::indentSelectedLines( S32 spaces ) } //virtual -BOOL LLTextEditor::canSelectAll() const +bool LLTextEditor::canSelectAll() const { - return TRUE; + return true; } // virtual @@ -751,15 +751,15 @@ void LLTextEditor::handleEmojiCommit(llwchar emoji) } } -BOOL LLTextEditor::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLTextEditor::handleMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; // set focus first, in case click callbacks want to change it // RN: do we really need to have a tab stop? if (hasTabStop()) { - setFocus( TRUE ); + setFocus( true ); } // Let scrollbar have first dibs @@ -772,7 +772,7 @@ BOOL LLTextEditor::handleMouseDown(S32 x, S32 y, MASK mask) deselect(); } - BOOL start_select = TRUE; + bool start_select = true; if( start_select ) { // If we're not scrolling (handled by child), then we're selecting @@ -791,7 +791,7 @@ BOOL LLTextEditor::handleMouseDown(S32 x, S32 y, MASK mask) mSelectionEnd = mCursorPos; } // assume we're starting a drag select - mIsSelecting = TRUE; + mIsSelecting = true; } else { @@ -800,7 +800,7 @@ BOOL LLTextEditor::handleMouseDown(S32 x, S32 y, MASK mask) } } - handled = TRUE; + handled = true; } // Delay cursor flashing @@ -813,11 +813,11 @@ BOOL LLTextEditor::handleMouseDown(S32 x, S32 y, MASK mask) return handled; } -BOOL LLTextEditor::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLTextEditor::handleRightMouseDown(S32 x, S32 y, MASK mask) { if (hasTabStop()) { - setFocus(TRUE); + setFocus(true); } bool show_menu = false; @@ -825,7 +825,7 @@ BOOL LLTextEditor::handleRightMouseDown(S32 x, S32 y, MASK mask) // Prefer editor menu if it has selection. See EXT-6806. if (hasSelection()) { - S32 click_pos = getDocIndexFromLocalCoord(x, y, FALSE); + S32 click_pos = getDocIndexFromLocalCoord(x, y, false); if (click_pos > mSelectionStart && click_pos < mSelectionEnd) { show_menu = true; @@ -843,16 +843,16 @@ BOOL LLTextEditor::handleRightMouseDown(S32 x, S32 y, MASK mask) showContextMenu(x, y); } - return TRUE; + return true; } -BOOL LLTextEditor::handleMiddleMouseDown(S32 x, S32 y, MASK mask) +bool LLTextEditor::handleMiddleMouseDown(S32 x, S32 y, MASK mask) { if (hasTabStop()) { - setFocus(TRUE); + setFocus(true); } if (!LLTextBase::handleMouseDown(x, y, mask)) @@ -864,13 +864,13 @@ BOOL LLTextEditor::handleMiddleMouseDown(S32 x, S32 y, MASK mask) pastePrimary(); } } - return TRUE; + return true; } -BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask) +bool LLTextEditor::handleHover(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; if(hasMouseCapture() ) { @@ -887,7 +887,7 @@ BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask) } LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (active)" << LL_ENDL; getWindow()->setCursor(UI_CURSOR_IBEAM); - handled = TRUE; + handled = true; } if( !handled ) @@ -905,16 +905,16 @@ BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask) if( !handled ) { getWindow()->setCursor(UI_CURSOR_IBEAM); - handled = TRUE; + handled = true; } return handled; } -BOOL LLTextEditor::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLTextEditor::handleMouseUp(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; // if I'm not currently selecting text if (!(mIsSelecting && hasMouseCapture())) @@ -940,7 +940,7 @@ BOOL LLTextEditor::handleMouseUp(S32 x, S32 y, MASK mask) // take selection to 'primary' clipboard updatePrimary(); - handled = TRUE; + handled = true; } // Delay cursor flashing @@ -950,16 +950,16 @@ BOOL LLTextEditor::handleMouseUp(S32 x, S32 y, MASK mask) { gFocusMgr.setMouseCapture( NULL ); - handled = TRUE; + handled = true; } return handled; } -BOOL LLTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; // let scrollbar and text segments have first dibs handled = LLTextBase::handleDoubleClick(x, y, mask); @@ -997,7 +997,7 @@ BOOL LLTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask) // We don't want handleMouseUp() to "finish" the selection (and thereby // set mSelectionEnd to where the mouse is), so we finish the selection here. - mIsSelecting = FALSE; + mIsSelecting = false; // delay cursor flashing resetCursorBlink(); @@ -1005,7 +1005,7 @@ BOOL LLTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask) // take selection to 'primary' clipboard updatePrimary(); - handled = TRUE; + handled = true; } return handled; @@ -1068,7 +1068,7 @@ S32 LLTextEditor::insert(S32 pos, const LLWString &wstr, bool group_with_next_op S32 LLTextEditor::remove(S32 pos, S32 length, bool group_with_next_op) { S32 end_pos = getEditableIndex(pos + length, true); - BOOL removedChar = FALSE; + bool removedChar = false; segment_vec_t segments_to_remove; // store text segments @@ -1090,7 +1090,7 @@ S32 LLTextEditor::overwriteChar(S32 pos, llwchar wc) } else { - return execute(new TextCmdOverwriteChar(pos, FALSE, wc)); + return execute(new TextCmdOverwriteChar(pos, false, wc)); } } @@ -1205,7 +1205,7 @@ S32 LLTextEditor::addChar(S32 pos, llwchar wc) return delta; } - return execute(new TextCmdAddChar(pos, FALSE, wc, LLTextSegmentPtr())); + return execute(new TextCmdAddChar(pos, false, wc, LLTextSegmentPtr())); } S32 LLTextEditor::addString(S32 pos, char *str) @@ -1229,7 +1229,7 @@ void LLTextEditor::addChar(llwchar wc) if (hasSelection()) { - deleteSelection(TRUE); + deleteSelection(true); } else if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode()) { @@ -1320,7 +1320,7 @@ void LLTextEditor::tryToShowEmojiHelper() } } -void LLTextEditor::addLineBreakChar(BOOL group_together) +void LLTextEditor::addLineBreakChar(bool group_together) { if( !getEnabled() ) { @@ -1328,7 +1328,7 @@ void LLTextEditor::addLineBreakChar(BOOL group_together) } if( hasSelection() ) { - deleteSelection(TRUE); + deleteSelection(true); } else if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode()) { @@ -1344,13 +1344,13 @@ void LLTextEditor::addLineBreakChar(BOOL group_together) } -BOOL LLTextEditor::handleSelectionKey(const KEY key, const MASK mask) +bool LLTextEditor::handleSelectionKey(const KEY key, const MASK mask) { - BOOL handled = FALSE; + bool handled = false; if( mask & MASK_SHIFT ) { - handled = TRUE; + handled = true; switch( key ) { @@ -1431,7 +1431,7 @@ BOOL LLTextEditor::handleSelectionKey(const KEY key, const MASK mask) break; default: - handled = FALSE; + handled = false; break; } } @@ -1445,14 +1445,14 @@ BOOL LLTextEditor::handleSelectionKey(const KEY key, const MASK mask) return handled; } -BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask) +bool LLTextEditor::handleNavigationKey(const KEY key, const MASK mask) { - BOOL handled = FALSE; + bool handled = false; // Ignore capslock key if( MASK_NONE == mask ) { - handled = TRUE; + handled = true; switch( key ) { case KEY_UP: @@ -1517,7 +1517,7 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask) break; default: - handled = FALSE; + handled = false; break; } } @@ -1530,7 +1530,7 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask) return handled; } -void LLTextEditor::deleteSelection(BOOL group_with_next_op ) +void LLTextEditor::deleteSelection(bool group_with_next_op ) { if( getEnabled() && hasSelection() ) { @@ -1545,7 +1545,7 @@ void LLTextEditor::deleteSelection(BOOL group_with_next_op ) } // virtual -BOOL LLTextEditor::canCut() const +bool LLTextEditor::canCut() const { return !mReadOnly && hasSelection(); } @@ -1560,12 +1560,12 @@ void LLTextEditor::cut() S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); S32 length = llabs( mSelectionStart - mSelectionEnd ); LLClipboard::instance().copyToClipboard( getWText(), left_pos, length); - deleteSelection( FALSE ); + deleteSelection( false ); onKeyStroke(); } -BOOL LLTextEditor::canCopy() const +bool LLTextEditor::canCopy() const { return hasSelection(); } @@ -1582,7 +1582,7 @@ void LLTextEditor::copy() LLClipboard::instance().copyToClipboard(getWText(), left_pos, length); } -BOOL LLTextEditor::canPaste() const +bool LLTextEditor::canPaste() const { return !mReadOnly && LLClipboard::instance().isTextAvailable(); } @@ -1637,7 +1637,7 @@ void LLTextEditor::pasteHelper(bool is_primary) // Delete any selected characters (the paste replaces them) if( (!is_primary) && hasSelection() ) { - deleteSelection(TRUE); + deleteSelection(true); } // Clean up string (replace tabs and remove characters that our fonts don't support). @@ -1666,8 +1666,8 @@ void LLTextEditor::cleanStringForPaste(LLWString & clean_string) if( mAllowEmbeddedItems ) { const llwchar LF = 10; - S32 len = clean_string.length(); - for( S32 i = 0; i < len; i++ ) + auto len = clean_string.length(); + for( size_t i = 0; i < len; i++ ) { llwchar wc = clean_string[i]; if( (wc < LLFontFreetype::FIRST_CHAR) && (wc != LF) ) @@ -1693,9 +1693,9 @@ void LLTextEditor::pasteTextWithLinebreaks(LLWString & clean_string) if(pos!=start) { std::basic_string<llwchar> str = std::basic_string<llwchar>(clean_string,start,pos-start); - setCursorPos(mCursorPos + insert(mCursorPos, str, TRUE, LLTextSegmentPtr())); + setCursorPos(mCursorPos + insert(mCursorPos, str, true, LLTextSegmentPtr())); } - addLineBreakChar(TRUE); // Add a line break and group with the next addition. + addLineBreakChar(true); // Add a line break and group with the next addition. start = pos+1; pos = clean_string.find('\n',start); @@ -1704,11 +1704,11 @@ void LLTextEditor::pasteTextWithLinebreaks(LLWString & clean_string) if (pos != start) { std::basic_string<llwchar> str = std::basic_string<llwchar>(clean_string,start,clean_string.length()-start); - setCursorPos(mCursorPos + insert(mCursorPos, str, FALSE, LLTextSegmentPtr())); + setCursorPos(mCursorPos + insert(mCursorPos, str, false, LLTextSegmentPtr())); } else { - addLineBreakChar(FALSE); // Add a line break and end the grouping. + addLineBreakChar(false); // Add a line break and end the grouping. } } @@ -1724,7 +1724,7 @@ void LLTextEditor::copyPrimary() LLClipboard::instance().copyToClipboard(getWText(), left_pos, length, true); } -BOOL LLTextEditor::canPastePrimary() const +bool LLTextEditor::canPastePrimary() const { return !mReadOnly && LLClipboard::instance().isTextAvailable(true); } @@ -1737,13 +1737,13 @@ void LLTextEditor::updatePrimary() } } -BOOL LLTextEditor::handleControlKey(const KEY key, const MASK mask) +bool LLTextEditor::handleControlKey(const KEY key, const MASK mask) { - BOOL handled = FALSE; + bool handled = false; if( mask & MASK_CONTROL ) { - handled = TRUE; + handled = true; switch( key ) { @@ -1807,7 +1807,7 @@ BOOL LLTextEditor::handleControlKey(const KEY key, const MASK mask) break; default: - handled = FALSE; + handled = false; break; } } @@ -1821,11 +1821,11 @@ BOOL LLTextEditor::handleControlKey(const KEY key, const MASK mask) } -BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask) +bool LLTextEditor::handleSpecialKey(const KEY key, const MASK mask) { - BOOL handled = TRUE; + bool handled = true; - if (mReadOnly) return FALSE; + if (mReadOnly) return false; switch( key ) { @@ -1839,7 +1839,7 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask) case KEY_BACKSPACE: if( hasSelection() ) { - deleteSelection(FALSE); + deleteSelection(false); } else if( 0 < mCursorPos ) @@ -1858,7 +1858,7 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask) { if( hasSelection() && !mKeepSelectionOnReturn ) { - deleteSelection(FALSE); + deleteSelection(false); } if (mAutoIndent) { @@ -1867,7 +1867,7 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask) } else { - handled = FALSE; + handled = false; break; } break; @@ -1875,7 +1875,7 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask) case KEY_TAB: if (mask & MASK_CONTROL) { - handled = FALSE; + handled = false; break; } if( hasSelection() && selectionContainsLineBreaks() ) @@ -1886,7 +1886,7 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask) { if( hasSelection() ) { - deleteSelection(FALSE); + deleteSelection(false); } S32 offset = getLineOffsetFromDocIndex(mCursorPos); @@ -1900,7 +1900,7 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask) break; default: - handled = FALSE; + handled = false; break; } @@ -1938,15 +1938,15 @@ void LLTextEditor::unindentLineBeforeCloseBrace() } -BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask ) +bool LLTextEditor::handleKeyHere(KEY key, MASK mask ) { - BOOL handled = FALSE; + bool handled = false; // Special case for TAB. If want to move to next field, report // not handled and let the parent take care of field movement. if (KEY_TAB == key && mTabsToNextField) { - return FALSE; + return false; } if (mReadOnly && mScroller) @@ -1959,7 +1959,7 @@ BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask ) { if (!mReadOnly && mShowEmojiHelper && LLEmojiHelper::instance().handleKey(this, key, mask)) { - return TRUE; + return true; } if (mEnableTooltipPaste && @@ -1976,7 +1976,7 @@ BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask ) // Delete any selected characters (the tooltip text replaces them) if(hasSelection()) { - deleteSelection(TRUE); + deleteSelection(true); } std::basic_string<llwchar>::size_type pos = tool_tip_text.find('\n',0); @@ -1988,7 +1988,7 @@ BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask ) // Add the text cleanStringForPaste(tool_tip_text); pasteTextWithLinebreaks(tool_tip_text); - handled = TRUE; + handled = true; } } else @@ -2016,21 +2016,21 @@ BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask ) } -BOOL LLTextEditor::handleUnicodeCharHere(llwchar uni_char) +bool LLTextEditor::handleUnicodeCharHere(llwchar uni_char) { if ((uni_char < 0x20) || (uni_char == 0x7F)) // Control character or DEL { - return FALSE; + return false; } - BOOL handled = FALSE; + bool handled = false; // Handle most keys only if the text editor is writeable. if( !mReadOnly ) { if (mShowEmojiHelper && uni_char < 0x80 && LLEmojiHelper::instance().handleKey(this, (KEY)uni_char, MASK_NONE)) { - return TRUE; + return true; } if( mAutoIndent && '}' == uni_char ) @@ -2044,7 +2044,7 @@ BOOL LLTextEditor::handleUnicodeCharHere(llwchar uni_char) // Keys that add characters temporarily hide the cursor getWindow()->hideCursorUntilMouseMove(); - handled = TRUE; + handled = true; } if( handled ) @@ -2060,7 +2060,7 @@ BOOL LLTextEditor::handleUnicodeCharHere(llwchar uni_char) return handled; } -BOOL LLTextEditor::handleUnicodeStringHere(char *uni_str, bool editing) +bool LLTextEditor::handleUnicodeStringHere(char *uni_str, bool editing) { auto handled = FALSE; @@ -2080,7 +2080,7 @@ BOOL LLTextEditor::handleUnicodeStringHere(char *uni_str, bool editing) } // virtual -BOOL LLTextEditor::canDoDelete() const +bool LLTextEditor::canDoDelete() const { return !mReadOnly && ( !mPassDelete || ( hasSelection() || (mCursorPos < getLength())) ); } @@ -2093,7 +2093,7 @@ void LLTextEditor::doDelete() } if( hasSelection() ) { - deleteSelection(FALSE); + deleteSelection(false); } else if( mCursorPos < getLength() ) @@ -2137,14 +2137,14 @@ void LLTextEditor::doDelete() void LLTextEditor::blockUndo() { - mBaseDocIsPristine = FALSE; + mBaseDocIsPristine = false; mLastCmd = NULL; std::for_each(mUndoStack.begin(), mUndoStack.end(), DeletePointer()); mUndoStack.clear(); } // virtual -BOOL LLTextEditor::canUndo() const +bool LLTextEditor::canUndo() const { return !mReadOnly && mLastCmd != NULL; } @@ -2175,7 +2175,7 @@ void LLTextEditor::undo() onKeyStroke(); } -BOOL LLTextEditor::canRedo() const +bool LLTextEditor::canRedo() const { return !mReadOnly && (mUndoStack.size() > 0) && (mLastCmd != mUndoStack.front()); } @@ -2254,7 +2254,7 @@ void LLTextEditor::onCommit() LLTextBase::onCommit(); } -void LLTextEditor::setEnabled(BOOL enabled) +void LLTextEditor::setEnabled(bool enabled) { // just treat enabled as read-only flag bool read_only = !enabled; @@ -2287,7 +2287,7 @@ void LLTextEditor::showContextMenu(S32 x, S32 y) // Route menu to this class // previously this was done in ::handleRightMoseDown: //if(hasTabStop()) - // setFocus(TRUE) - why? weird... + // setFocus(true) - why? weird... // and then inside setFocus // .... // gEditMenuHandler = this; @@ -2321,7 +2321,7 @@ void LLTextEditor::showContextMenu(S32 x, S32 y) // If the cursor is on a misspelled word, retrieve suggestions for it std::string misspelled_word = getMisspelledWord(mCursorPos); - if ((is_misspelled = !misspelled_word.empty()) == true) + if ((is_misspelled = !misspelled_word.empty())) { LLSpellChecker::instance().getSuggestions(misspelled_word, mSuggestionList); } @@ -2465,9 +2465,9 @@ void LLTextEditor::draw() // Start or stop the editor from accepting text-editing keystrokes // see also LLLineEditor -void LLTextEditor::setFocus( BOOL new_state ) +void LLTextEditor::setFocus( bool new_state ) { - BOOL old_state = hasFocus(); + bool old_state = hasFocus(); // Don't change anything if the focus state didn't change if (new_state == old_state) return; @@ -2475,7 +2475,7 @@ void LLTextEditor::setFocus( BOOL new_state ) // Notify early if we are losing focus. if (!new_state) { - getWindow()->allowLanguageTextInput(this, FALSE); + getWindow()->allowLanguageTextInput(this, false); } LLTextBase::setFocus( new_state ); @@ -2507,7 +2507,7 @@ void LLTextEditor::setCursorAndScrollToEnd() endOfDoc(); } -void LLTextEditor::getCurrentLineAndColumn( S32* line, S32* col, BOOL include_wordwrap ) +void LLTextEditor::getCurrentLineAndColumn( S32* line, S32* col, bool include_wordwrap ) { *line = getLineNumFromDocIndex(mCursorPos, include_wordwrap); *col = getLineOffsetFromDocIndex(mCursorPos, include_wordwrap); @@ -2549,32 +2549,32 @@ void LLTextEditor::autoIndent() // Inserts new text at the cursor position void LLTextEditor::insertText(const std::string &new_text) { - BOOL enabled = getEnabled(); - setEnabled( TRUE ); + bool enabled = getEnabled(); + setEnabled( true ); // Delete any selected characters (the insertion replaces them) if( hasSelection() ) { - deleteSelection(TRUE); + deleteSelection(true); } - setCursorPos(mCursorPos + insert( mCursorPos, utf8str_to_wstring(new_text), FALSE, LLTextSegmentPtr() )); + setCursorPos(mCursorPos + insert( mCursorPos, utf8str_to_wstring(new_text), false, LLTextSegmentPtr() )); setEnabled( enabled ); } void LLTextEditor::insertText(LLWString &new_text) { - BOOL enabled = getEnabled(); - setEnabled( TRUE ); + bool enabled = getEnabled(); + setEnabled( true ); // Delete any selected characters (the insertion replaces them) if( hasSelection() ) { - deleteSelection(TRUE); + deleteSelection(true); } - setCursorPos(mCursorPos + insert( mCursorPos, new_text, FALSE, LLTextSegmentPtr() )); + setCursorPos(mCursorPos + insert( mCursorPos, new_text, false, LLTextSegmentPtr() )); setEnabled( enabled ); } @@ -2584,10 +2584,10 @@ void LLTextEditor::appendWidget(const LLInlineViewSegment::Params& params, const // Save old state S32 selection_start = mSelectionStart; S32 selection_end = mSelectionEnd; - BOOL was_selecting = mIsSelecting; + bool was_selecting = mIsSelecting; S32 cursor_pos = mCursorPos; S32 old_length = getLength(); - BOOL cursor_was_at_end = (mCursorPos == old_length); + bool cursor_was_at_end = (mCursorPos == old_length); deselect(); @@ -2595,8 +2595,8 @@ void LLTextEditor::appendWidget(const LLInlineViewSegment::Params& params, const LLWString widget_wide_text = utf8str_to_wstring(text); - LLTextSegmentPtr segment = new LLInlineViewSegment(params, old_length, old_length + widget_wide_text.size()); - insert(getLength(), widget_wide_text, FALSE, segment); + LLTextSegmentPtr segment = new LLInlineViewSegment(params, old_length, old_length + static_cast<S32>(widget_wide_text.size())); + insert(getLength(), widget_wide_text, false, segment); // Set the cursor and scroll position if( selection_start != selection_end ) @@ -2626,7 +2626,7 @@ void LLTextEditor::removeTextFromEnd(S32 num_chars) { if (num_chars <= 0) return; - remove(getLength() - num_chars, num_chars, FALSE); + remove(getLength() - num_chars, num_chars, false); S32 len = getLength(); setCursorPos (llclamp(mCursorPos, 0, len)); @@ -2642,7 +2642,7 @@ void LLTextEditor::onSpellCheckPerformed() { if (isPristine()) { - mBaseDocIsPristine = FALSE; + mBaseDocIsPristine = false; } } @@ -2659,7 +2659,7 @@ void LLTextEditor::makePristine() } } -BOOL LLTextEditor::isPristine() const +bool LLTextEditor::isPristine() const { if( mPristineCmd ) { @@ -2672,7 +2672,7 @@ BOOL LLTextEditor::isPristine() const } } -BOOL LLTextEditor::tryToRevertToPristineState() +bool LLTextEditor::tryToRevertToPristineState() { if( !isPristine() ) { @@ -2701,7 +2701,7 @@ BOOL LLTextEditor::tryToRevertToPristineState() } } - return isPristine(); // TRUE => success + return isPristine(); // true => success } void LLTextEditor::updateLinkSegments() @@ -2760,7 +2760,7 @@ void LLTextEditor::onMouseCaptureLost() /////////////////////////////////////////////////////////////////// // Hack for Notecards -BOOL LLTextEditor::importBuffer(const char* buffer, S32 length ) +bool LLTextEditor::importBuffer(const char* buffer, S32 length ) { std::istringstream instream(buffer); @@ -2779,20 +2779,20 @@ BOOL LLTextEditor::importBuffer(const char* buffer, S32 length ) if( 1 != sscanf(tbuf, "Linden text version %d", &version) ) { LL_WARNS() << "Invalid Linden text file header " << LL_ENDL; - return FALSE; + return false; } if( 1 != version ) { LL_WARNS() << "Invalid Linden text file version: " << version << LL_ENDL; - return FALSE; + return false; } instream.getline(tbuf, MAX_STRING); if( 0 != sscanf(tbuf, "{") ) { LL_WARNS() << "Invalid Linden text file format" << LL_ENDL; - return FALSE; + return false; } S32 text_len = 0; @@ -2800,37 +2800,37 @@ BOOL LLTextEditor::importBuffer(const char* buffer, S32 length ) if( 1 != sscanf(tbuf, "Text length %d", &text_len) ) { LL_WARNS() << "Invalid Linden text length field" << LL_ENDL; - return FALSE; + return false; } if( text_len > mMaxTextByteLength ) { LL_WARNS() << "Invalid Linden text length: " << text_len << LL_ENDL; - return FALSE; + return false; } - BOOL success = TRUE; + bool success = true; char* text = new char[ text_len + 1]; if (text == NULL) { LLError::LLUserWarningMsg::showOutOfMemory(); LL_ERRS() << "Memory allocation failure." << LL_ENDL; - return FALSE; + return false; } instream.get(text, text_len + 1, '\0'); text[text_len] = '\0'; if( text_len != (S32)strlen(text) )/* Flawfinder: ignore */ { LL_WARNS() << llformat("Invalid text length: %d != %d ",strlen(text),text_len) << LL_ENDL;/* Flawfinder: ignore */ - success = FALSE; + success = false; } instream.getline(tbuf, MAX_STRING); if( success && (0 != sscanf(tbuf, "}")) ) { LL_WARNS() << "Invalid Linden text file format: missing terminal }" << LL_ENDL; - success = FALSE; + success = false; } if( success ) @@ -2847,7 +2847,7 @@ BOOL LLTextEditor::importBuffer(const char* buffer, S32 length ) return success; } -BOOL LLTextEditor::exportBuffer(std::string &buffer ) +bool LLTextEditor::exportBuffer(std::string &buffer ) { std::ostringstream outstream(buffer); @@ -2858,7 +2858,7 @@ BOOL LLTextEditor::exportBuffer(std::string &buffer ) outstream << getText(); outstream << "}\n"; - return TRUE; + return true; } void LLTextEditor::updateAllowingLanguageInput() @@ -2871,17 +2871,17 @@ void LLTextEditor::updateAllowingLanguageInput() } if (hasFocus() && !mReadOnly) { - window->allowLanguageTextInput(this, TRUE); + window->allowLanguageTextInput(this, true); } else { - window->allowLanguageTextInput(this, FALSE); + window->allowLanguageTextInput(this, false); } } // Preedit is managed off the undo/redo command stack. -BOOL LLTextEditor::hasPreeditString() const +bool LLTextEditor::hasPreeditString() const { return (mPreeditPositions.size() > 1); } @@ -2897,7 +2897,7 @@ void LLTextEditor::resetPreedit() } else { - deleteSelection(TRUE); + deleteSelection(true); } } if (hasPreeditString()) @@ -2949,7 +2949,7 @@ void LLTextEditor::updatePreedit(const LLWString &preedit_string, if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode()) { mPreeditOverwrittenWString = getWText().substr(insert_preedit_at, mPreeditWString.length()); - removeStringNoUndo(insert_preedit_at, mPreeditWString.length()); + removeStringNoUndo(insert_preedit_at, static_cast<S32>(mPreeditWString.length())); } else { @@ -2970,7 +2970,7 @@ void LLTextEditor::updatePreedit(const LLWString &preedit_string, onKeyStroke(); } -BOOL LLTextEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect *bounds, LLRect *control) const +bool LLTextEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect *bounds, LLRect *control) const { if (control) { @@ -2993,13 +2993,13 @@ BOOL LLTextEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect const S32 query = (query_offset >= 0 ? preedit_left_position + query_offset : mCursorPos); if (query < preedit_left_position || query > preedit_right_position) { - return FALSE; + return false; } const S32 first_visible_line = getFirstVisibleLine(); if (query < getLineStart(first_visible_line)) { - return FALSE; + return false; } S32 current_line = first_visible_line; @@ -3060,7 +3060,7 @@ BOOL LLTextEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect LLUI::getInstance()->screenRectToGL(preedit_rect_screen, bounds); } - return TRUE; + return true; } void LLTextEditor::getSelectionRange(S32 *position, S32 *length) const @@ -3106,7 +3106,7 @@ void LLTextEditor::markAsPreedit(S32 position, S32 length) mPreeditPositions[0] = position; mPreeditPositions[1] = position + length; mPreeditStandouts.resize(1); - mPreeditStandouts[0] = FALSE; + mPreeditStandouts[0] = false; } else { @@ -3128,11 +3128,11 @@ S32 LLTextEditor::getPreeditFontSize() const return ll_round((F32)mFont->getLineHeight() * LLUI::getScaleFactor().mV[VY]); } -BOOL LLTextEditor::isDirty() const +bool LLTextEditor::isDirty() const { if(mReadOnly) { - return FALSE; + return false; } if( mPristineCmd ) diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index a654425230..6ce08f48b5 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -88,7 +88,7 @@ public: void setKeystrokeCallback(const keystroke_signal_t::slot_type& callback); - void setParseHighlights(BOOL parsing) {mParseHighlights=parsing;} + void setParseHighlights(bool parsing) {mParseHighlights=parsing;} static S32 spacesPerTab(); @@ -96,16 +96,16 @@ public: void handleEmojiCommit(llwchar emoji); // mousehandler overrides - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask ); - virtual BOOL handleMiddleMouseDown(S32 x,S32 y,MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleRightMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleHover(S32 x, S32 y, MASK mask); + virtual bool handleDoubleClick(S32 x, S32 y, MASK mask ); + virtual bool handleMiddleMouseDown(S32 x,S32 y,MASK mask); - virtual BOOL handleKeyHere(KEY key, MASK mask ); - virtual BOOL handleUnicodeCharHere(llwchar uni_char); - virtual BOOL handleUnicodeStringHere(char *uni_str, bool editing); + virtual bool handleKeyHere(KEY key, MASK mask ); + virtual bool handleUnicodeCharHere(llwchar uni_char); + virtual bool handleUnicodeStringHere(char *uni_str, bool editing); virtual void onMouseCaptureLost(); @@ -114,51 +114,51 @@ public: virtual void onFocusReceived(); virtual void onFocusLost(); virtual void onCommit(); - virtual void setEnabled(BOOL enabled); + virtual void setEnabled(bool enabled); // uictrl overrides virtual void clear(); - virtual void setFocus( BOOL b ); - virtual BOOL isDirty() const; + virtual void setFocus( bool b ); + virtual bool isDirty() const; // LLEditMenuHandler interface virtual void undo(); - virtual BOOL canUndo() const; + virtual bool canUndo() const; virtual void redo(); - virtual BOOL canRedo() const; + virtual bool canRedo() const; virtual void cut(); - virtual BOOL canCut() const; + virtual bool canCut() const; virtual void copy(); - virtual BOOL canCopy() const; + virtual bool canCopy() const; virtual void paste(); - virtual BOOL canPaste() const; + virtual bool canPaste() const; virtual void updatePrimary(); virtual void copyPrimary(); virtual void pastePrimary(); - virtual BOOL canPastePrimary() const; + virtual bool canPastePrimary() const; virtual void doDelete(); - virtual BOOL canDoDelete() const; + virtual bool canDoDelete() const; virtual void selectAll(); - virtual BOOL canSelectAll() const; + virtual bool canSelectAll() const; void selectByCursorPosition(S32 prev_cursor_pos, S32 next_cursor_pos); virtual bool canLoadOrSaveToFile(); - void selectNext(const std::string& search_text_in, BOOL case_insensitive, BOOL wrap = TRUE); - BOOL replaceText(const std::string& search_text, const std::string& replace_text, BOOL case_insensitive, BOOL wrap = TRUE); - void replaceTextAll(const std::string& search_text, const std::string& replace_text, BOOL case_insensitive); + void selectNext(const std::string& search_text_in, bool case_insensitive, bool wrap = true); + bool replaceText(const std::string& search_text, const std::string& replace_text, bool case_insensitive, bool wrap = true); + void replaceTextAll(const std::string& search_text, const std::string& replace_text, bool case_insensitive); // Undo/redo stack void blockUndo(); // Text editing virtual void makePristine(); - BOOL isPristine() const; - BOOL allowsEmbeddedItems() const { return mAllowEmbeddedItems; } + bool isPristine() const; + bool allowsEmbeddedItems() const { return mAllowEmbeddedItems; } // Autoreplace (formerly part of LLLineEditor) typedef boost::function<void(S32&, S32&, LLWString&, S32&, const LLWString&)> autoreplace_callback_t; @@ -184,19 +184,19 @@ public: // Does not change highlight or cursor position. void removeTextFromEnd(S32 num_chars); - BOOL tryToRevertToPristineState(); + bool tryToRevertToPristineState(); void setCursorAndScrollToEnd(); - void getCurrentLineAndColumn( S32* line, S32* col, BOOL include_wordwrap ); + void getCurrentLineAndColumn( S32* line, S32* col, bool include_wordwrap ); // Hacky methods to make it into a word-wrapping, potentially scrolling, // read-only text box. - void setCommitOnFocusLost(BOOL b) { mCommitOnFocusLost = b; } + void setCommitOnFocusLost(bool b) { mCommitOnFocusLost = b; } // Hack to handle Notecards - virtual BOOL importBuffer(const char* buffer, S32 length ); - virtual BOOL exportBuffer(std::string& buffer ); + virtual bool importBuffer(const char* buffer, S32 length ); + virtual bool exportBuffer(std::string& buffer ); const LLUUID& getSourceID() const { return mSourceID; } @@ -211,7 +211,7 @@ public: void setShowEmojiHelper(bool show); bool getShowEmojiHelper() const { return mShowEmojiHelper; } - void setPassDelete(BOOL b) { mPassDelete = b; } + void setPassDelete(bool b) { mPassDelete = b; } protected: void showContextMenu(S32 x, S32 y); @@ -225,13 +225,13 @@ protected: S32 indentLine( S32 pos, S32 spaces ); void unindentLineBeforeCloseBrace(); - virtual BOOL handleSpecialKey(const KEY key, const MASK mask); - BOOL handleNavigationKey(const KEY key, const MASK mask); - BOOL handleSelectionKey(const KEY key, const MASK mask); - BOOL handleControlKey(const KEY key, const MASK mask); + virtual bool handleSpecialKey(const KEY key, const MASK mask); + bool handleNavigationKey(const KEY key, const MASK mask); + bool handleSelectionKey(const KEY key, const MASK mask); + bool handleControlKey(const KEY key, const MASK mask); - BOOL selectionContainsLineBreaks(); - void deleteSelection(BOOL transient_operation); + bool selectionContainsLineBreaks(); + void deleteSelection(bool transient_operation); S32 prevWordPos(S32 cursorPos) const; S32 nextWordPos(S32 cursorPos) const; @@ -252,7 +252,7 @@ protected: S32 addChar(S32 pos, llwchar wc); void addString(char *s, bool editing); S32 addString(S32 pos, char *str); - void addLineBreakChar(BOOL group_together = FALSE); + void addLineBreakChar(bool group_together = false); S32 overwriteChar(S32 pos, llwchar wc); void removeChar(); S32 removeChar(S32 pos); @@ -262,7 +262,7 @@ protected: void tryToShowEmojiHelper(); void focusLostHelper(); void updateAllowingLanguageInput(); - BOOL hasPreeditString() const; + bool hasPreeditString() const; // Overrides LLPreeditor virtual void resetPreedit(); @@ -271,7 +271,7 @@ protected: virtual void markAsPreedit(S32 position, S32 length); virtual void getPreeditRange(S32 *position, S32 *length) const; virtual void getSelectionRange(S32 *position, S32 *length) const; - virtual BOOL getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect *bounds, LLRect *control) const; + virtual bool getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect *bounds, LLRect *control) const; virtual S32 getPreeditFontSize() const; virtual LLWString getPreeditString() const { return getWText(); } // @@ -288,7 +288,7 @@ protected: LLWString mPreeditWString; LLWString mPreeditOverwrittenWString; std::vector<S32> mPreeditPositions; - std::vector<BOOL> mPreeditStandouts; + LLPreeditor::standouts_t mPreeditStandouts; protected: LLUIColor mDefaultColor; @@ -317,7 +317,7 @@ private: class TextCmdOverwriteChar; class TextCmdRemove; - BOOL mBaseDocIsPristine; + bool mBaseDocIsPristine; TextCmd* mPristineCmd; TextCmd* mLastCmd; @@ -325,11 +325,11 @@ private: typedef std::deque<TextCmd*> undo_stack_t; undo_stack_t mUndoStack; - BOOL mTabsToNextField; // if true, tab moves focus to next field, else inserts spaces - BOOL mCommitOnFocusLost; - BOOL mTakesFocus; + bool mTabsToNextField; // if true, tab moves focus to next field, else inserts spaces + bool mCommitOnFocusLost; + bool mTakesFocus; - BOOL mAllowEmbeddedItems; + bool mAllowEmbeddedItems; bool mShowContextMenu; bool mShowEmojiHelper; bool mEnableTooltipPaste; @@ -349,7 +349,7 @@ private: // Build time optimization, generate once in .cpp file #ifndef LLTEXTEDITOR_CPP extern template class LLTextEditor* LLView::getChild<class LLTextEditor>( - const std::string& name, BOOL recurse) const; + const std::string& name, bool recurse) const; #endif #endif // LL_TEXTEDITOR_H diff --git a/indra/llui/lltextparser.cpp b/indra/llui/lltextparser.cpp index 7bb7c7f7bb..097b168106 100644 --- a/indra/llui/lltextparser.cpp +++ b/indra/llui/lltextparser.cpp @@ -73,11 +73,11 @@ S32 LLTextParser::findPattern(const std::string &text, LLSD highlight) found = (! ltext.find(pattern) ? 0 : std::string::npos); break; case ENDS_WITH: - S32 pos = ltext.rfind(pattern); - if (pos >= 0 && (ltext.length()-pattern.length()==pos)) found = pos; + auto pos = ltext.rfind(pattern); + if (pos != std::string::npos && pos >= 0 && (ltext.length() - pattern.length() == pos)) found = pos; break; } - return found; + return static_cast<S32>(found); } LLSD LLTextParser::parsePartialLineHighlights(const std::string &text, const LLColor4 &color, EHighlightPosition part, S32 index) @@ -99,8 +99,8 @@ LLSD LLTextParser::parsePartialLineHighlights(const std::string &text, const LLC S32 start = findPattern(text,mHighlights[i]); if (start >= 0 ) { - S32 end = std::string(mHighlights[i]["pattern"]).length(); - S32 len = text.length(); + auto end = std::string(mHighlights[i]["pattern"]).length(); + auto len = text.length(); EHighlightPosition newpart; if (start==0) { @@ -184,11 +184,11 @@ bool LLTextParser::parseFullLineHighlights(const std::string &text, LLColor4 *co { LLSD color_llsd = mHighlights[i]["color"]; color->setValue(color_llsd); - return TRUE; + return true; } } } - return FALSE; //No matches found. + return false; //No matches found. } std::string LLTextParser::getFileName() @@ -229,11 +229,11 @@ bool LLTextParser::saveToDisk(LLSD highlights) if (filename.empty()) { LL_WARNS() << "LLTextParser::saveToDisk() no valid user directory." << LL_ENDL; - return FALSE; + return false; } llofstream file; file.open(filename.c_str()); LLSDSerialize::toPrettyXML(mHighlights, file); file.close(); - return TRUE; + return true; } diff --git a/indra/llui/lltextvalidate.cpp b/indra/llui/lltextvalidate.cpp index 9e27ed6232..9a087d8230 100644 --- a/indra/llui/lltextvalidate.cpp +++ b/indra/llui/lltextvalidate.cpp @@ -1,25 +1,25 @@ -/** +/** * @file lltextvalidate.cpp * @brief Text validation helper functions * * $LicenseInfo:firstyear=2001&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$ */ @@ -73,7 +73,7 @@ class ValidatorFloat : public ValidatorImpl std::basic_string<CHAR> trimmed = str; LLStringUtilBase<CHAR>::trim(trimmed); - S32 len = trimmed.length(); + auto len = trimmed.length(); if (0 < len) { // May be a comma or period, depending on the locale @@ -118,7 +118,7 @@ class ValidatorInt : public ValidatorImpl std::basic_string<CHAR> trimmed = str; LLStringUtilBase<CHAR>::trim(trimmed); - S32 len = trimmed.length(); + auto len = trimmed.length(); if (0 < len) { S32 i = 0; @@ -157,7 +157,7 @@ class ValidatorPositiveS32 : public ValidatorImpl std::basic_string<CHAR> trimmed = str; LLStringUtilBase<CHAR>::trim(trimmed); - S32 len = trimmed.length(); + auto len = trimmed.length(); if (0 < len) { CHAR ch = trimmed.front(); @@ -167,7 +167,7 @@ class ValidatorPositiveS32 : public ValidatorImpl return setError("Validator_ShouldNotBeMinusOrZero", LLSD().with("CH", llsd(ch))); } - for (S32 i = 0; i < len; ++i) + for (size_t i = 0; i < len; ++i) { ch = trimmed[i]; if (!LLStringOps::isDigit(ch)) @@ -177,7 +177,7 @@ class ValidatorPositiveS32 : public ValidatorImpl } } - S32 val = strtol(trimmed); + auto val = strtol(trimmed); if (val <= 0) { return setError("Validator_InvalidNumericString", LLSD().with("STR", llsd(trimmed))); @@ -201,7 +201,7 @@ class ValidatorNonNegativeS32 : public ValidatorImpl std::basic_string<CHAR> trimmed = str; LLStringUtilBase<CHAR>::trim(trimmed); - S32 len = trimmed.length(); + auto len = trimmed.length(); if (0 < len) { CHAR ch = trimmed.front(); @@ -211,7 +211,7 @@ class ValidatorNonNegativeS32 : public ValidatorImpl return setError("Validator_ShouldNotBeMinus", LLSD().with("CH", llsd(ch))); } - for (S32 i = 0; i < len; ++i) + for (size_t i = 0; i < len; ++i) { ch = trimmed[i]; if (!LLStringOps::isDigit(ch)) @@ -221,7 +221,7 @@ class ValidatorNonNegativeS32 : public ValidatorImpl } } - S32 val = strtol(trimmed); + auto val = strtol(trimmed); if (val < 0) { return setError("Validator_InvalidNumericString", LLSD().with("STR", llsd(trimmed))); @@ -244,7 +244,7 @@ class ValidatorNonNegativeS32NoSpace : public ValidatorImpl LLLocale locale(LLLocale::USER_LOCALE); std::basic_string<CHAR> test_str = str; - S32 len = test_str.length(); + auto len = test_str.length(); if (0 < len) { CHAR ch = test_str.front(); @@ -254,7 +254,7 @@ class ValidatorNonNegativeS32NoSpace : public ValidatorImpl return setError("Validator_ShouldNotBeMinus", LLSD().with("CH", llsd(ch))); } - for (S32 i = 0; i < len; ++i) + for (size_t i = 0; i < len; ++i) { ch = test_str[i]; if (!LLStringOps::isDigit(ch) || LLStringOps::isSpace(ch)) @@ -264,7 +264,7 @@ class ValidatorNonNegativeS32NoSpace : public ValidatorImpl } } - S32 val = strtol(test_str); + auto val = strtol(test_str); if (val < 0) { return setError("Validator_InvalidNumericString", LLSD().with("STR", llsd(test_str))); @@ -286,7 +286,7 @@ class ValidatorAlphaNum : public ValidatorImpl { LLLocale locale(LLLocale::USER_LOCALE); - S32 len = str.length(); + auto len = str.length(); while (len--) { CHAR ch = str[len]; @@ -313,7 +313,7 @@ class ValidatorAlphaNumSpace : public ValidatorImpl { LLLocale locale(LLLocale::USER_LOCALE); - S32 len = str.length(); + auto len = str.length(); while (len--) { CHAR ch = str[len]; @@ -341,7 +341,7 @@ class ValidatorASCIIPrintableNoPipe : public ValidatorImpl template <class CHAR> bool validate(const std::basic_string<CHAR>& str) { - S32 len = str.length(); + auto len = str.length(); while (len--) { CHAR ch = str[len]; @@ -368,7 +368,7 @@ class ValidatorASCIIPrintableNoSpace : public ValidatorImpl template <class CHAR> bool validate(const std::basic_string<CHAR>& str) { - S32 len = str.length(); + auto len = str.length(); while (len--) { CHAR ch = str[len]; @@ -395,7 +395,7 @@ protected: template <class CHAR> bool validate(const std::basic_string<CHAR>& str) { - S32 len = str.length(); + auto len = str.length(); while (len--) { CHAR ch = str[len]; @@ -441,7 +441,7 @@ class ValidatorASCIIWithNewLine : public ValidatorImpl template <class CHAR> bool validate(const std::basic_string<CHAR>& str) { - S32 len = str.length(); + auto len = str.length(); while (len--) { CHAR ch = str[len]; diff --git a/indra/llui/lltextvalidate.h b/indra/llui/lltextvalidate.h index 2c2941de7f..a4ff144d82 100644 --- a/indra/llui/lltextvalidate.h +++ b/indra/llui/lltextvalidate.h @@ -1,4 +1,4 @@ -/** +/** * @file lltextbase.h * @author Martin Reddy * @brief The base class of text box/editor, providing Url handling support @@ -6,21 +6,21 @@ * $LicenseInfo:firstyear=2009&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$ */ diff --git a/indra/llui/lltimectrl.cpp b/indra/llui/lltimectrl.cpp index 3d404293c6..e2e735b131 100644 --- a/indra/llui/lltimectrl.cpp +++ b/indra/llui/lltimectrl.cpp @@ -161,7 +161,7 @@ LLTimeCtrl::LLTimeCtrl(const LLTimeCtrl::Params& p) mDownBtn = LLUICtrlFactory::create<LLButton>(down_button_params); addChild(mDownBtn); - setUseBoundingRect( TRUE ); + setUseBoundingRect( true ); } F32 LLTimeCtrl::getTime24() const @@ -188,27 +188,27 @@ void LLTimeCtrl::setTime24(F32 time) updateText(); } -BOOL LLTimeCtrl::handleKeyHere(KEY key, MASK mask) +bool LLTimeCtrl::handleKeyHere(KEY key, MASK mask) { if (mEditor->hasFocus()) { if(key == KEY_UP) { onUpBtn(); - return TRUE; + return true; } if(key == KEY_DOWN) { onDownBtn(); - return TRUE; + return true; } if (key == KEY_RETURN) { onCommit(); - return TRUE; + return true; } } - return FALSE; + return false; } void LLTimeCtrl::onUpBtn() @@ -343,7 +343,7 @@ LLTimeCtrl::EEditingPart LLTimeCtrl::getEditingPart() S32 cur_pos = mEditor->getCursor(); std::string time_str = mEditor->getText(); - S32 colon_index = time_str.find_first_of(':'); + auto colon_index = time_str.find_first_of(':'); if (cur_pos <= colon_index) { @@ -376,7 +376,7 @@ std::string LLTimeCtrl::getMinutesString(const std::string& str) size_t colon_index = str.find_first_of(':'); ++colon_index; - int minutes_len = str.length() - colon_index - AMPM_LEN; + auto minutes_len = str.length() - colon_index - AMPM_LEN; std::string minutes_str = str.substr(colon_index, minutes_len); return minutes_str; @@ -411,7 +411,7 @@ bool LLTimeCtrl::isMinutesStringValid(const std::string& str) // static bool LLTimeCtrl::isPMAMStringValid(const std::string& str) { - S32 len = str.length(); + auto len = str.length(); bool valid = (str[--len] == 'M') && (str[--len] == 'P' || str[len] == 'A'); diff --git a/indra/llui/lltimectrl.h b/indra/llui/lltimectrl.h index a2c016ab6f..6973c9a02b 100644 --- a/indra/llui/lltimectrl.h +++ b/indra/llui/lltimectrl.h @@ -93,7 +93,7 @@ private: }; virtual void onFocusLost(); - virtual BOOL handleKeyHere(KEY key, MASK mask); + virtual bool handleKeyHere(KEY key, MASK mask); void onUpBtn(); void onDownBtn(); @@ -124,6 +124,6 @@ private: U32 mTime; // minutes since midnight: 0 - 1439 U32 mSnapToMin; // interval in minutes to snap to - BOOL mAllowEdit; + bool mAllowEdit; }; #endif /* LLTIMECTRL_H_ */ diff --git a/indra/llui/lltoggleablemenu.cpp b/indra/llui/lltoggleablemenu.cpp index 636df7a87e..cfa520f693 100644 --- a/indra/llui/lltoggleablemenu.cpp +++ b/indra/llui/lltoggleablemenu.cpp @@ -52,7 +52,7 @@ boost::signals2::connection LLToggleableMenu::setVisibilityChangeCallback(const } // virtual -void LLToggleableMenu::onVisibilityChange (BOOL curVisibilityIn) +void LLToggleableMenu::onVisibilityChange (bool curVisibilityIn) { S32 x,y; LLUI::getInstance()->getMousePositionLocal(LLUI::getInstance()->getRootView(), &x, &y); @@ -94,7 +94,7 @@ bool LLToggleableMenu::toggleVisibility() if (getVisible()) { - setVisible(FALSE); + setVisible(false); mClosedByButtonClick = false; return false; } diff --git a/indra/llui/lltoggleablemenu.h b/indra/llui/lltoggleablemenu.h index 1cf37ad647..7cbbd417a4 100644 --- a/indra/llui/lltoggleablemenu.h +++ b/indra/llui/lltoggleablemenu.h @@ -45,7 +45,7 @@ public: boost::signals2::connection setVisibilityChangeCallback( const commit_signal_t::slot_type& cb ); - virtual void onVisibilityChange (BOOL curVisibilityIn); + virtual void onVisibilityChange (bool curVisibilityIn); virtual bool addChild (LLView* view, S32 tab_group = 0); diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 8a6cb683d2..aa48ae048f 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -398,18 +398,18 @@ bool LLToolBar::flashCommand(const LLCommandId& commandId, bool flash, bool forc if (it != mButtonMap.end()) { command_button = it->second; - command_button->setFlashing((BOOL)(flash),(BOOL)(force_flashing)); + command_button->setFlashing((bool)(flash),(bool)(force_flashing)); } } return (command_button != NULL); } -BOOL LLToolBar::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLToolBar::handleRightMouseDown(S32 x, S32 y, MASK mask) { LLRect button_panel_rect; mButtonPanel->localRectToOtherView(mButtonPanel->getLocalRect(), &button_panel_rect, this); - BOOL handle_it_here = !mReadOnly && button_panel_rect.pointInRect(x, y); + bool handle_it_here = !mReadOnly && button_panel_rect.pointInRect(x, y); if (handle_it_here) { @@ -443,9 +443,9 @@ BOOL LLToolBar::handleRightMouseDown(S32 x, S32 y, MASK mask) return handle_it_here; } -BOOL LLToolBar::isSettingChecked(const LLSD& userdata) +bool LLToolBar::isSettingChecked(const LLSD& userdata) { - BOOL retval = FALSE; + bool retval = false; const std::string setting_name = userdata.asString(); @@ -784,8 +784,8 @@ void LLToolBar::updateLayoutAsNeeded() if (!mButtons.empty()) { - mButtonPanel->setVisible(TRUE); - mButtonPanel->setMouseOpaque(TRUE); + mButtonPanel->setVisible(true); + mButtonPanel->setMouseOpaque(true); } // don't clear flag until after we've resized ourselves, to avoid laying out every frame @@ -797,13 +797,13 @@ void LLToolBar::draw() { if (mButtons.empty()) { - mButtonPanel->setVisible(FALSE); - mButtonPanel->setMouseOpaque(FALSE); + mButtonPanel->setVisible(false); + mButtonPanel->setMouseOpaque(false); } else { - mButtonPanel->setVisible(TRUE); - mButtonPanel->setMouseOpaque(TRUE); + mButtonPanel->setVisible(true); + mButtonPanel->setMouseOpaque(true); } // Update enable/disable state and highlight state for editable toolbars @@ -841,7 +841,7 @@ void LLToolBar::draw() } LLIconCtrl* caret = mCaretIcon; - caret->setVisible(FALSE); + caret->setVisible(false); if (mDragAndDropTarget && !mButtonCommands.empty()) { LLRect caret_rect = caret->getRect(); @@ -859,15 +859,15 @@ void LLToolBar::draw() mDragx+mDragGirth, mDragy-caret_rect.getHeight()/2)); } - caret->setVisible(TRUE); + caret->setVisible(true); } LLUICtrl::draw(); - caret->setVisible(FALSE); + caret->setVisible(false); mDragAndDropTarget = false; } -void LLToolBar::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLToolBar::reshape(S32 width, S32 height, bool called_from_parent) { LLUICtrl::reshape(width, height, called_from_parent); mNeedsLayout = true; @@ -1042,23 +1042,23 @@ boost::signals2::connection LLToolBar::setButtonRemoveCallback(const button_sign return connectSignal(mButtonRemoveSignal, cb); } -BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +bool LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) { // If we have a drop callback, that means that we can handle the drop - BOOL handled = (mHandleDropCallback ? TRUE : FALSE); + bool handled = mHandleDropCallback != nullptr; // if drop is set, it's time to call the callback to get the operation done if (handled && drop) { - handled = mHandleDropCallback(cargo_data, x, y ,this); + handled = mHandleDropCallback(cargo_data, x, y, this); } // We accept only single tool drop on toolbars - *accept = (handled ? ACCEPT_YES_SINGLE : ACCEPT_NO); + *accept = handled ? ACCEPT_YES_SINGLE : ACCEPT_NO; // We'll use that flag to change the visual aspect of the toolbar target on draw() mDragAndDropTarget = false; @@ -1073,7 +1073,7 @@ BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, int orig_rank = getRankFromPosition(dragged_command); mDragRank = getRankFromPosition(x, y); // Don't DaD if we're dragging a command on itself - mDragAndDropTarget = ((orig_rank != RANK_NONE) && ((mDragRank == orig_rank) || ((mDragRank-1) == orig_rank)) ? false : true); + mDragAndDropTarget = ((orig_rank != RANK_NONE) && ((mDragRank == orig_rank) || ((mDragRank - 1) == orig_rank))); //LL_INFOS() << "Merov debug : DaD, rank = " << mDragRank << ", dragged uui = " << inv_item->getUUID() << LL_ENDL; /* Do the following if you want to animate the button itself LLCommandId dragged_command(inv_item->getUUID()); @@ -1083,7 +1083,7 @@ BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, } else { - handled = FALSE; + handled = false; } } @@ -1121,16 +1121,16 @@ LLToolBarButton::~LLToolBarButton() delete mIsStartingSignal; } -BOOL LLToolBarButton::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLToolBarButton::handleMouseDown(S32 x, S32 y, MASK mask) { mMouseDownX = x; mMouseDownY = y; return LLButton::handleMouseDown(x, y, mask); } -BOOL LLToolBarButton::handleHover(S32 x, S32 y, MASK mask) +bool LLToolBarButton::handleHover(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; S32 mouse_distance_squared = (x - mMouseDownX) * (x - mMouseDownX) + (y - mMouseDownY) * (y - mMouseDownY); if (mouse_distance_squared > DRAG_N_DROP_DISTANCE_THRESHOLD * DRAG_N_DROP_DISTANCE_THRESHOLD @@ -1141,7 +1141,7 @@ BOOL LLToolBarButton::handleHover(S32 x, S32 y, MASK mask) { mStartDragItemCallback(x, y, this); mIsDragged = true; - handled = TRUE; + handled = true; } else { @@ -1163,7 +1163,7 @@ void LLToolBarButton::onMouseEnter(S32 x, S32 y, MASK mask) // Always highlight toolbar buttons, even if they are disabled if (!gFocusMgr.getMouseCapture() || gFocusMgr.getMouseCapture() == this) { - mNeedsHighlight = TRUE; + mNeedsHighlight = true; } LLToolBar* parent_toolbar = getParentByType<LLToolBar>(); @@ -1199,12 +1199,12 @@ void LLToolBarButton::onCommit() } } -void LLToolBarButton::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLToolBarButton::reshape(S32 width, S32 height, bool called_from_parent) { LLButton::reshape(mWidthRange.clamp(width), height, called_from_parent); } -void LLToolBarButton::setEnabled(BOOL enabled) +void LLToolBarButton::setEnabled(bool enabled) { if (enabled) { diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index 1a9c1cdf9f..c57c979525 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -40,8 +40,8 @@ class LLToolBarButton; class LLIconCtrl; typedef boost::function<void (S32 x, S32 y, LLToolBarButton* button)> tool_startdrag_callback_t; -typedef boost::function<BOOL (S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type)> tool_handledrag_callback_t; -typedef boost::function<BOOL (void* data, S32 x, S32 y, LLToolBar* toolbar)> tool_handledrop_callback_t; +typedef boost::function<bool (S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type)> tool_handledrag_callback_t; +typedef boost::function<bool (void* data, S32 x, S32 y, LLToolBar* toolbar)> tool_handledrop_callback_t; class LLToolBarButton : public LLButton { @@ -62,11 +62,11 @@ public: LLToolBarButton(const Params& p); ~LLToolBarButton(); - BOOL handleMouseDown(S32 x, S32 y, MASK mask); - BOOL handleHover(S32 x, S32 y, MASK mask); + bool handleMouseDown(S32 x, S32 y, MASK mask); + bool handleHover(S32 x, S32 y, MASK mask); - void reshape(S32 width, S32 height, BOOL called_from_parent = true); - void setEnabled(BOOL enabled); + void reshape(S32 width, S32 height, bool called_from_parent = true); + void setEnabled(bool enabled); void setCommandId(const LLCommandId& id) { mId = id; } LLCommandId getCommandId() { return mId; } @@ -178,12 +178,12 @@ public: protected: friend class LLUICtrlFactory; - LLCenterLayoutPanel(const Params& params) : LLLayoutPanel(params), mButtonPanel(NULL) {} + LLCenterLayoutPanel(const Params& params) : LLLayoutPanel(params) {}; private: reshape_callback_t mReshapeCallback; - LLToolBarEnums::EToolBarLocation mLocationId; - LLPanel * mButtonPanel; + LLToolBarEnums::EToolBarLocation mLocationId{ LLToolBarEnums::EToolBarLocation::TOOLBAR_NONE }; + LLPanel * mButtonPanel{ nullptr }; }; struct Params : public LLInitParam::Block<Params, LLUICtrl::Params> @@ -214,9 +214,9 @@ public: // virtuals void draw(); - void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); - BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + void reshape(S32 width, S32 height, bool called_from_parent = true); + bool handleRightMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -270,7 +270,7 @@ private: void updateLayoutAsNeeded(); void createButtons(); void resizeButtonsInRow(std::vector<LLToolBarButton*>& buttons_in_row, S32 max_row_girth); - BOOL isSettingChecked(const LLSD& userdata); + bool isSettingChecked(const LLSD& userdata); void onSettingEnable(const LLSD& userdata); void onRemoveSelectedCommand(); diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp index c10b8b4830..86525c2f7e 100644 --- a/indra/llui/lltooltip.cpp +++ b/indra/llui/lltooltip.cpp @@ -71,7 +71,7 @@ void LLToolTipView::draw() LLView::draw(); } -BOOL LLToolTipView::handleHover(S32 x, S32 y, MASK mask) +bool LLToolTipView::handleHover(S32 x, S32 y, MASK mask) { static S32 last_x = x; static S32 last_y = y; @@ -89,7 +89,7 @@ BOOL LLToolTipView::handleHover(S32 x, S32 y, MASK mask) return LLView::handleHover(x, y, mask); } -BOOL LLToolTipView::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLToolTipView::handleMouseDown(S32 x, S32 y, MASK mask) { LLToolTipMgr::instance().blockToolTips(); @@ -98,29 +98,29 @@ BOOL LLToolTipView::handleMouseDown(S32 x, S32 y, MASK mask) // If we are handling the mouse event menu holder // won't get a chance to close menus so do this here LLMenuGL::sMenuContainer->hideMenus(); - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLToolTipView::handleMiddleMouseDown(S32 x, S32 y, MASK mask) +bool LLToolTipView::handleMiddleMouseDown(S32 x, S32 y, MASK mask) { LLToolTipMgr::instance().blockToolTips(); return LLView::handleMiddleMouseDown(x, y, mask); } -BOOL LLToolTipView::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLToolTipView::handleRightMouseDown(S32 x, S32 y, MASK mask) { LLToolTipMgr::instance().blockToolTips(); return LLView::handleRightMouseDown(x, y, mask); } -BOOL LLToolTipView::handleScrollWheel( S32 x, S32 y, S32 clicks ) +bool LLToolTipView::handleScrollWheel( S32 x, S32 y, S32 clicks ) { LLToolTipMgr::instance().blockToolTips(); - return FALSE; + return false; } void LLToolTipView::drawStickyRect() @@ -325,14 +325,14 @@ void LLToolTip::snapToChildren() setShape(tooltip_rect); } -void LLToolTip::setVisible(BOOL visible) +void LLToolTip::setVisible(bool visible) { // fade out tooltip over time if (visible) { mVisibleTimer.start(); mFadeTimer.stop(); - LLPanel::setVisible(TRUE); + LLPanel::setVisible(true); } else { @@ -345,7 +345,7 @@ void LLToolTip::setVisible(BOOL visible) } } -BOOL LLToolTip::handleHover(S32 x, S32 y, MASK mask) +bool LLToolTip::handleHover(S32 x, S32 y, MASK mask) { //mInfoButton->setFlashing(true); if(mInfoButton) @@ -356,7 +356,7 @@ BOOL LLToolTip::handleHover(S32 x, S32 y, MASK mask) { getWindow()->setCursor(UI_CURSOR_HAND); } - return TRUE; + return true; } void LLToolTip::onMouseLeave(S32 x, S32 y, MASK mask) @@ -549,7 +549,7 @@ void LLToolTipMgr::hideToolTips() { if (mToolTip) { - mToolTip->setVisible(FALSE); + mToolTip->setVisible(false); } } diff --git a/indra/llui/lltooltip.h b/indra/llui/lltooltip.h index 9ae537e0c1..8515504e3b 100644 --- a/indra/llui/lltooltip.h +++ b/indra/llui/lltooltip.h @@ -44,11 +44,11 @@ public: Params(); }; LLToolTipView(const LLToolTipView::Params&); - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleScrollWheel( S32 x, S32 y, S32 clicks ); + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMiddleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleRightMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleScrollWheel( S32 x, S32 y, S32 clicks ); void drawStickyRect(); @@ -99,9 +99,9 @@ public: Params(); }; /*virtual*/ void draw(); - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask); - /*virtual*/ void setVisible(BOOL visible); + /*virtual*/ void setVisible(bool visible); bool isFading(); F32 getVisibleTime(); diff --git a/indra/llui/lltransutil.cpp b/indra/llui/lltransutil.cpp index 3d3a7ddf4e..4af5376a8b 100644 --- a/indra/llui/lltransutil.cpp +++ b/indra/llui/lltransutil.cpp @@ -61,7 +61,7 @@ bool LLTransUtil::parseStrings(const std::string& xml_filename, const std::set<s bool LLTransUtil::parseLanguageStrings(const std::string& xml_filename) { LLXMLNodePtr root; - BOOL success = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root); + bool success = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root); if (!success) { diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index c3dd2eb17a..ba8fe84377 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -172,7 +172,7 @@ mHelpImpl(NULL) // Callbacks for associating controls with floater visibility: reg.add("Floater.Toggle", boost::bind(&LLFloaterReg::toggleInstance, _2, LLSD())); reg.add("Floater.ToggleOrBringToFront", boost::bind(&LLFloaterReg::toggleInstanceOrBringToFront, _2, LLSD())); - reg.add("Floater.Show", boost::bind(&LLFloaterReg::showInstance, _2, LLSD(), FALSE)); + reg.add("Floater.Show", boost::bind(&LLFloaterReg::showInstance, _2, LLSD(), false)); reg.add("Floater.ShowOrBringToFront", boost::bind(&LLFloaterReg::showInstanceOrBringToFront, _2, LLSD())); reg.add("Floater.Hide", boost::bind(&LLFloaterReg::hideInstance, _2, LLSD())); diff --git a/indra/llui/llui.h b/indra/llui/llui.h index 471602515d..373a358544 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -77,7 +77,10 @@ enum EDragAndDropType DAD_PERSON = 17, DAD_SETTINGS = 18, DAD_MATERIAL = 19, - DAD_COUNT = 20, // number of types in this enum + DAD_GLTF = 20, + DAD_GLTF_BIN = 21, + + DAD_COUNT = 22, // number of types in this enum }; // Reasons for drags to be denied. @@ -234,7 +237,7 @@ public: private: - S32 mValue; + S32 mValue{ 0 }; }; // diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index 69093393d9..52c5f72a45 100644 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -44,7 +44,7 @@ F32 LLUICtrl::sInactiveControlTransparency = 1.0f; // Compiler optimization, generate extern template template class LLUICtrl* LLView::getChild<class LLUICtrl>( - const std::string& name, BOOL recurse) const; + const std::string& name, bool recurse) const; LLUICtrl::CallbackParam::CallbackParam() : name("name"), @@ -100,10 +100,10 @@ const LLUICtrl::Params& LLUICtrl::getDefaultParams() LLUICtrl::LLUICtrl(const LLUICtrl::Params& p, const LLViewModelPtr& viewmodel) : LLView(p), - mIsChrome(FALSE), + mIsChrome(false), mRequestsFront(p.requests_front), - mTabStop(FALSE), - mTentative(FALSE), + mTabStop(false), + mTentative(false), mViewModel(viewmodel), mControlVariable(NULL), mEnabledControlVariable(NULL), @@ -342,12 +342,12 @@ void LLUICtrl::onMouseLeave(S32 x, S32 y, MASK mask) } //virtual -BOOL LLUICtrl::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLUICtrl::handleMouseDown(S32 x, S32 y, MASK mask) { LL_DEBUGS() << "LLUICtrl::handleMouseDown calling LLView)'s handleMouseUp (first initialized xui to: " << getPathname() << " )" << LL_ENDL; - BOOL handled = LLView::handleMouseDown(x,y,mask); + bool handled = LLView::handleMouseDown(x,y,mask); if (mMouseDownSignal) { @@ -362,12 +362,12 @@ BOOL LLUICtrl::handleMouseDown(S32 x, S32 y, MASK mask) } //virtual -BOOL LLUICtrl::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLUICtrl::handleMouseUp(S32 x, S32 y, MASK mask) { LL_DEBUGS() << "LLUICtrl::handleMouseUp calling LLView)'s handleMouseUp (first initialized xui to: " << getPathname() << " )" << LL_ENDL; - BOOL handled = LLView::handleMouseUp(x,y,mask); + bool handled = LLView::handleMouseUp(x,y,mask); if (handled) { LLViewerEventRecorder::instance().updateMouseEventInfo(x,y,-56,-56,getPathname()); } @@ -382,9 +382,9 @@ BOOL LLUICtrl::handleMouseUp(S32 x, S32 y, MASK mask) } //virtual -BOOL LLUICtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLUICtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = LLView::handleRightMouseDown(x,y,mask); + bool handled = LLView::handleRightMouseDown(x,y,mask); if (mRightMouseDownSignal) { (*mRightMouseDownSignal)(this,x,y,mask); @@ -393,9 +393,9 @@ BOOL LLUICtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) } //virtual -BOOL LLUICtrl::handleRightMouseUp(S32 x, S32 y, MASK mask) +bool LLUICtrl::handleRightMouseUp(S32 x, S32 y, MASK mask) { - BOOL handled = LLView::handleRightMouseUp(x,y,mask); + bool handled = LLView::handleRightMouseUp(x,y,mask); if(mRightMouseUpSignal) { (*mRightMouseUpSignal)(this,x,y,mask); @@ -403,9 +403,9 @@ BOOL LLUICtrl::handleRightMouseUp(S32 x, S32 y, MASK mask) return handled; } -BOOL LLUICtrl::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLUICtrl::handleDoubleClick(S32 x, S32 y, MASK mask) { - BOOL handled = LLView::handleDoubleClick(x, y, mask); + bool handled = LLView::handleDoubleClick(x, y, mask); if (mDoubleClickSignal) { (*mDoubleClickSignal)(this, x, y, mask); @@ -414,7 +414,7 @@ BOOL LLUICtrl::handleDoubleClick(S32 x, S32 y, MASK mask) } // can't tab to children of a non-tab-stop widget -BOOL LLUICtrl::canFocusChildren() const +bool LLUICtrl::canFocusChildren() const { return hasTabStop(); } @@ -439,9 +439,9 @@ void LLUICtrl::onCommit() } //virtual -BOOL LLUICtrl::isCtrl() const +bool LLUICtrl::isCtrl() const { - return TRUE; + return true; } //virtual @@ -473,7 +473,7 @@ LLViewModel* LLUICtrl::getViewModel() const } //virtual -BOOL LLUICtrl::postBuild() +bool LLUICtrl::postBuild() { LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; // @@ -662,15 +662,15 @@ bool LLUICtrl::controlListener(const LLSD& newvalue, LLHandle<LLUICtrl> handle, } // virtual -BOOL LLUICtrl::setTextArg( const std::string& key, const LLStringExplicit& text ) +bool LLUICtrl::setTextArg( const std::string& key, const LLStringExplicit& text ) { - return FALSE; + return false; } // virtual -BOOL LLUICtrl::setLabelArg( const std::string& key, const LLStringExplicit& text ) +bool LLUICtrl::setLabelArg( const std::string& key, const LLStringExplicit& text ) { - return FALSE; + return false; } // virtual @@ -691,12 +691,12 @@ LLCtrlScrollInterface* LLUICtrl::getScrollInterface() return NULL; } -BOOL LLUICtrl::hasFocus() const +bool LLUICtrl::hasFocus() const { return (gFocusMgr.childHasKeyboardFocus(this)); } -void LLUICtrl::setFocus(BOOL b) +void LLUICtrl::setFocus(bool b) { // focus NEVER goes to ui ctrls that are disabled! if (!getEnabled()) @@ -720,25 +720,25 @@ void LLUICtrl::setFocus(BOOL b) } // virtual -void LLUICtrl::setTabStop( BOOL b ) +void LLUICtrl::setTabStop( bool b ) { mTabStop = b; } // virtual -BOOL LLUICtrl::hasTabStop() const +bool LLUICtrl::hasTabStop() const { return mTabStop; } // virtual -BOOL LLUICtrl::acceptsTextInput() const +bool LLUICtrl::acceptsTextInput() const { - return FALSE; + return false; } //virtual -BOOL LLUICtrl::isDirty() const +bool LLUICtrl::isDirty() const { return mViewModel->isDirty(); }; @@ -761,16 +761,16 @@ void LLUICtrl::clear() } // virtual -void LLUICtrl::setIsChrome(BOOL is_chrome) +void LLUICtrl::setIsChrome(bool is_chrome) { mIsChrome = is_chrome; } // virtual -BOOL LLUICtrl::getIsChrome() const +bool LLUICtrl::getIsChrome() const { if (mIsChrome) - return TRUE; + return true; LLView* parent_ctrl = getParent(); while (parent_ctrl) @@ -781,11 +781,11 @@ BOOL LLUICtrl::getIsChrome() const parent_ctrl = parent_ctrl->getParent(); } - return FALSE; + return false; } -BOOL LLUICtrl::focusFirstItem(BOOL prefer_text_fields, BOOL focus_flash) +bool LLUICtrl::focusFirstItem(bool prefer_text_fields, bool focus_flash) { LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; // try to select default tab group child @@ -796,14 +796,14 @@ BOOL LLUICtrl::focusFirstItem(BOOL prefer_text_fields, BOOL focus_flash) LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.back()); if(!ctrl->hasFocus()) { - ctrl->setFocus(TRUE); + ctrl->setFocus(true); ctrl->onTabInto(); if(focus_flash) { gFocusMgr.triggerFocusFlash(); } } - return TRUE; + return true; } // search for text field first if(prefer_text_fields) @@ -816,14 +816,14 @@ BOOL LLUICtrl::focusFirstItem(BOOL prefer_text_fields, BOOL focus_flash) LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.back()); if(!ctrl->hasFocus()) { - ctrl->setFocus(TRUE); + ctrl->setFocus(true); ctrl->onTabInto(); if(focus_flash) { gFocusMgr.triggerFocusFlash(); } } - return TRUE; + return true; } } // no text field found, or we don't care about text fields @@ -833,20 +833,20 @@ BOOL LLUICtrl::focusFirstItem(BOOL prefer_text_fields, BOOL focus_flash) LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.back()); if(!ctrl->hasFocus()) { - ctrl->setFocus(TRUE); + ctrl->setFocus(true); ctrl->onTabInto(); if(focus_flash) { gFocusMgr.triggerFocusFlash(); } } - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLUICtrl::focusNextItem(BOOL text_fields_only) +bool LLUICtrl::focusNextItem(bool text_fields_only) { // this assumes that this method is called on the focus root. LLViewQuery query = getTabOrderQuery(); @@ -859,7 +859,7 @@ BOOL LLUICtrl::focusNextItem(BOOL text_fields_only) return focusNext(result); } -BOOL LLUICtrl::focusPrevItem(BOOL text_fields_only) +bool LLUICtrl::focusPrevItem(bool text_fields_only) { // this assumes that this method is called on the focus root. LLViewQuery query = getTabOrderQuery(); @@ -1011,13 +1011,13 @@ boost::signals2::connection LLUICtrl::setValidateBeforeCommit( boost::function<b } // virtual -void LLUICtrl::setTentative(BOOL b) +void LLUICtrl::setTentative(bool b) { mTentative = b; } // virtual -BOOL LLUICtrl::getTentative() const +bool LLUICtrl::getTentative() const { return mTentative; } diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index d21e8dc1c6..c56c3c43a4 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -39,8 +39,8 @@ #include "llviewmodel.h" // *TODO move dependency to .cpp file #include "llsearchablecontrol.h" -const BOOL TAKE_FOCUS_YES = TRUE; -const BOOL TAKE_FOCUS_NO = FALSE; +const bool TAKE_FOCUS_YES = true; +const bool TAKE_FOCUS_NO = false; const S32 DROP_SHADOW_FLOATER = 5; class LLUICtrl @@ -147,27 +147,28 @@ protected: // We shouldn't ever need to set this directly //virtual void setViewModel(const LLViewModelPtr&); - virtual BOOL postBuild(); + /*virtual*/ bool postBuild() override; public: // LLView interface - /*virtual*/ BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); - /*virtual*/ BOOL isCtrl() const; - /*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask); - /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL canFocusChildren() const; - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + /*virtual*/ bool setLabelArg( const std::string& key, const LLStringExplicit& text ) override; + /*virtual*/ bool isCtrl() const override; + /*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask) override; + /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool canFocusChildren() const override; + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleRightMouseDown(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleRightMouseUp(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleDoubleClick(S32 x, S32 y, MASK mask) override; // From LLFocusableElement - /*virtual*/ void setFocus( BOOL b ); - /*virtual*/ BOOL hasFocus() const; + /*virtual*/ void setFocus( bool b ) override; + /*virtual*/ bool hasFocus() const override; // New virtuals + // Return NULL by default (overrride if the class has the appropriate interface) virtual class LLCtrlSelectionInterface* getSelectionInterface(); virtual class LLCtrlListInterface* getListInterface(); @@ -187,22 +188,22 @@ public: void setFunctionName(const std::string& function_name); - virtual void setTentative(BOOL b); - virtual BOOL getTentative() const; + virtual void setTentative(bool b); + virtual bool getTentative() const; virtual void setValue(const LLSD& value); virtual LLSD getValue() const; /// When two widgets are displaying the same data (e.g. during a skin /// change), share their ViewModel. virtual void shareViewModelFrom(const LLUICtrl& other); - virtual BOOL setTextArg( const std::string& key, const LLStringExplicit& text ); - virtual void setIsChrome(BOOL is_chrome); + virtual bool setTextArg( const std::string& key, const LLStringExplicit& text ); + virtual void setIsChrome(bool is_chrome); - virtual BOOL acceptsTextInput() const; // Defaults to false + virtual bool acceptsTextInput() const; // Defaults to false // A control is dirty if the user has modified its value. // Editable controls should override this. - virtual BOOL isDirty() const; // Defauls to false + virtual bool isDirty() const; // Defauls to false virtual void resetDirty(); //Defaults to no-op // Call appropriate callback @@ -223,16 +224,16 @@ public: void setTransparencyType(ETypeTransparency type); ETypeTransparency getTransparencyType() const {return mTransparencyType;} - BOOL focusNextItem(BOOL text_entry_only); - BOOL focusPrevItem(BOOL text_entry_only); - BOOL focusFirstItem(BOOL prefer_text_fields = FALSE, BOOL focus_flash = TRUE ); + bool focusNextItem(bool text_entry_only); + bool focusPrevItem(bool text_entry_only); + bool focusFirstItem(bool prefer_text_fields = false, bool focus_flash = true ); // Non Virtuals LLHandle<LLUICtrl> getHandle() const { return getDerivedHandle<LLUICtrl>(); } - BOOL getIsChrome() const; + bool getIsChrome() const; - void setTabStop( BOOL b ); - BOOL hasTabStop() const; + void setTabStop( bool b ); + bool hasTabStop() const; LLUICtrl* getParentUICtrl() const; @@ -267,7 +268,7 @@ public: LLSINGLETON_EMPTY_CTOR(LLTextInputFilter); /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const override { - return filterResult_t(view->isCtrl() && static_cast<const LLUICtrl *>(view)->acceptsTextInput(), TRUE); + return filterResult_t(view->isCtrl() && static_cast<const LLUICtrl *>(view)->acceptsTextInput(), true); } }; @@ -319,14 +320,14 @@ protected: static F32 sActiveControlTransparency; static F32 sInactiveControlTransparency; - virtual void addInfo(LLSD & info); + /*virtual*/ void addInfo(LLSD & info) override; private: - BOOL mIsChrome; - BOOL mRequestsFront; - BOOL mTabStop; - BOOL mTentative; + bool mIsChrome; + bool mRequestsFront; + bool mTabStop; + bool mTentative; ETypeTransparency mTransparencyType; }; @@ -334,7 +335,7 @@ private: // Build time optimization, generate once in .cpp file #ifndef LLUICTRL_CPP extern template class LLUICtrl* LLView::getChild<class LLUICtrl>( - const std::string& name, BOOL recurse) const; + const std::string& name, bool recurse) const; #endif #endif // LL_LLUICTRL_H diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp index f3649d68a7..a2a6d661ff 100644 --- a/indra/llui/lluictrlfactory.cpp +++ b/indra/llui/lluictrlfactory.cpp @@ -124,7 +124,7 @@ void LLUICtrlFactory::createChildren(LLView* viewp, LLXMLNodePtr node, const wid LLXMLNodePtr outputChild; if (output_node) { - outputChild = output_node->createChild("", FALSE); + outputChild = output_node->createChild("", false); } if (!instance().createFromXML(child_node, viewp, LLStringUtil::null, registry, outputChild)) diff --git a/indra/llui/lluistring.h b/indra/llui/lluistring.h index 0cc699f59c..b9d4ff0ebb 100644 --- a/indra/llui/lluistring.h +++ b/indra/llui/lluistring.h @@ -79,7 +79,7 @@ public: operator LLWString() const { return getUpdatedWResult(); } bool empty() const { return getUpdatedResult().empty(); } - S32 length() const { return getUpdatedWResult().size(); } + S32 length() const { return static_cast<S32>(getUpdatedWResult().size()); } void clear(); void clearArgs() { if (mArgs) mArgs->clear(); } diff --git a/indra/llui/llundo.cpp b/indra/llui/llundo.cpp index d5ff70d31a..0928cb4417 100644 --- a/indra/llui/llundo.cpp +++ b/indra/llui/llundo.cpp @@ -72,7 +72,7 @@ LLUndoBuffer::~LLUndoBuffer() //----------------------------------------------------------------------------- // getNextAction() //----------------------------------------------------------------------------- -LLUndoBuffer::LLUndoAction* LLUndoBuffer::getNextAction(BOOL setClusterBegin) +LLUndoBuffer::LLUndoAction* LLUndoBuffer::getNextAction(bool setClusterBegin) { LLUndoAction *nextAction = mActions[mNextAction]; @@ -97,11 +97,11 @@ LLUndoBuffer::LLUndoAction* LLUndoBuffer::getNextAction(BOOL setClusterBegin) //----------------------------------------------------------------------------- // undoAction() //----------------------------------------------------------------------------- -BOOL LLUndoBuffer::undoAction() +bool LLUndoBuffer::undoAction() { if (!canUndo()) { - return FALSE; + return false; } S32 prevAction = (mNextAction + mNumActions - 1) % mNumActions; @@ -118,7 +118,7 @@ BOOL LLUndoBuffer::undoAction() if (mNextAction == mFirstAction) { mOperationID--; - return FALSE; + return false; } // do wrap-around of index, but avoid negative numbers for modulo operator @@ -127,17 +127,17 @@ BOOL LLUndoBuffer::undoAction() mOperationID--; - return TRUE; + return true; } //----------------------------------------------------------------------------- // redoAction() //----------------------------------------------------------------------------- -BOOL LLUndoBuffer::redoAction() +bool LLUndoBuffer::redoAction() { if (!canRedo()) { - return FALSE; + return false; } mOperationID++; @@ -146,7 +146,7 @@ BOOL LLUndoBuffer::redoAction() { if (mNextAction == mLastAction) { - return FALSE; + return false; } mActions[mNextAction]->redo(); @@ -155,7 +155,7 @@ BOOL LLUndoBuffer::redoAction() mNextAction = (mNextAction + 1) % mNumActions; } - return TRUE; + return true; } //----------------------------------------------------------------------------- diff --git a/indra/llui/llundo.h b/indra/llui/llundo.h index 19cb09e6bb..dc40702be0 100644 --- a/indra/llui/llundo.h +++ b/indra/llui/llundo.h @@ -48,11 +48,11 @@ public: LLUndoBuffer( LLUndoAction (*create_func()), S32 initial_count ); virtual ~LLUndoBuffer(); - LLUndoAction *getNextAction(BOOL setClusterBegin = TRUE); - BOOL undoAction(); - BOOL redoAction(); - BOOL canUndo() { return (mNextAction != mFirstAction); } - BOOL canRedo() { return (mNextAction != mLastAction); } + LLUndoAction *getNextAction(bool setClusterBegin = true); + bool undoAction(); + bool redoAction(); + bool canUndo() { return (mNextAction != mFirstAction); } + bool canRedo() { return (mNextAction != mLastAction); } void flushActions(); diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 45afc9efee..198441804b 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -229,7 +229,7 @@ bool LLUrlEntryBase::isWikiLinkCorrect(const std::string &labeled_url) const label = "http://" + label; } - return (LLUrlRegistry::instance().hasUrl(label)) ? false : true; + return !LLUrlRegistry::instance().hasUrl(label); } std::string LLUrlEntryBase::urlToLabelWithGreyQuery(const std::string &url) const @@ -389,7 +389,7 @@ bool LLUrlEntryInvalidSLURL::isSLURLvalid(const std::string &url) const LLURI uri(url); LLSD path_array = uri.pathArray(); - S32 path_parts = path_array.size(); + auto path_parts = path_array.size(); S32 x,y,z; if (path_parts == actual_parts) @@ -401,7 +401,7 @@ bool LLUrlEntryInvalidSLURL::isSLURLvalid(const std::string &url) const if((x>= 0 && x<= 256) && (y>= 0 && y<= 256) && (z>= 0)) { - return TRUE; + return true; } } else if (path_parts == (actual_parts-1)) @@ -413,7 +413,7 @@ bool LLUrlEntryInvalidSLURL::isSLURLvalid(const std::string &url) const ; if((x>= 0 && x<= 256) && (y>= 0 && y<= 256)) { - return TRUE; + return true; } } else if (path_parts == (actual_parts-2)) @@ -422,11 +422,11 @@ bool LLUrlEntryInvalidSLURL::isSLURLvalid(const std::string &url) const LLStringUtil::convertToS32(path_array[path_parts-1],x); if(x>= 0 && x<= 256) { - return TRUE; + return true; } } - return FALSE; + return false; } // @@ -454,7 +454,7 @@ std::string LLUrlEntrySLURL::getLabel(const std::string &url, const LLUrlLabelCa LLURI uri(url); LLSD path_array = uri.pathArray(); - S32 path_parts = path_array.size(); + auto path_parts = path_array.size(); if (path_parts == 5) { // handle slurl with (X,Y,Z) coordinates @@ -1074,7 +1074,7 @@ LLUrlEntryParcel::~LLUrlEntryParcel() std::string LLUrlEntryParcel::getLabel(const std::string &url, const LLUrlLabelCallback &cb) { LLSD path_array = LLURI(url).pathArray(); - S32 path_parts = path_array.size(); + auto path_parts = path_array.size(); if (path_parts < 3) // no parcel id { @@ -1165,7 +1165,7 @@ std::string LLUrlEntryPlace::getLabel(const std::string &url, const LLUrlLabelCa LLURI uri(url); std::string location = unescapeUrl(uri.hostName()); LLSD path_array = uri.pathArray(); - S32 path_parts = path_array.size(); + auto path_parts = path_array.size(); if (path_parts == 3) { // handle slurl with (X,Y,Z) coordinates @@ -1214,7 +1214,7 @@ std::string LLUrlEntryRegion::getLabel(const std::string &url, const LLUrlLabelC // LLSD path_array = LLURI(url).pathArray(); - S32 path_parts = path_array.size(); + auto path_parts = path_array.size(); if (path_parts < 3) // no region name { @@ -1278,7 +1278,7 @@ std::string LLUrlEntryTeleport::getLabel(const std::string &url, const LLUrlLabe // LLURI uri(url); LLSD path_array = uri.pathArray(); - S32 path_parts = path_array.size(); + auto path_parts = path_array.size(); std::string host = uri.hostName(); std::string label = LLTrans::getString("SLurlLabelTeleport"); if (!host.empty()) @@ -1413,7 +1413,7 @@ std::string LLUrlEntryWorldMap::getLabel(const std::string &url, const LLUrlLabe // LLURI uri(url); LLSD path_array = uri.pathArray(); - S32 path_parts = path_array.size(); + auto path_parts = path_array.size(); if (path_parts < 3) { return url; @@ -1505,7 +1505,7 @@ LLUrlEntryEmail::LLUrlEntryEmail() std::string LLUrlEntryEmail::getLabel(const std::string &url, const LLUrlLabelCallback &cb) { - int pos = url.find("mailto:"); + auto pos = url.find("mailto:"); if (pos == std::string::npos) { diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h index c878a74c5f..84ff278942 100644 --- a/indra/llui/llurlentry.h +++ b/indra/llui/llurlentry.h @@ -107,7 +107,7 @@ public: bool isWikiLinkCorrect(const std::string &url) const; - virtual bool isSLURLvalid(const std::string &url) const { return TRUE; }; + virtual bool isSLURLvalid(const std::string &url) const { return true; }; protected: std::string getIDStringFromUrl(const std::string &url) const; diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp index 9c3994480c..3a4ce6a72f 100644 --- a/indra/llui/llurlregistry.cpp +++ b/indra/llui/llurlregistry.cpp @@ -263,9 +263,9 @@ bool LLUrlRegistry::findUrl(const LLWString &text, LLUrlMatch &match, const LLUr { return false; } - S32 end = start + wurl.size() - 1; + auto end = start + wurl.size() - 1; - match.setValues(start, end, match.getUrl(), + match.setValues(static_cast<U32>(start), static_cast<U32>(end), match.getUrl(), match.getLabel(), match.getQuery(), match.getTooltip(), diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index d44f39682a..1e72228fee 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -67,11 +67,11 @@ bool LLView::sDebugRectsShowNames = true; bool LLView::sDebugKeys = false; bool LLView::sDebugMouseHandling = false; std::string LLView::sMouseHandlerMessage; -BOOL LLView::sForceReshape = FALSE; +bool LLView::sForceReshape = false; std::set<LLView*> LLView::sPreviewHighlightedElements; -BOOL LLView::sHighlightingDiffs = FALSE; +bool LLView::sHighlightingDiffs = false; LLView* LLView::sPreviewClickedElement = NULL; -BOOL LLView::sDrawPreviewHighlights = FALSE; +bool LLView::sDrawPreviewHighlights = false; S32 LLView::sLastLeftXML = S32_MIN; S32 LLView::sLastBottomXML = S32_MIN; std::vector<LLViewDrawContext*> LLViewDrawContext::sDrawContextStack; @@ -80,12 +80,12 @@ LLView::DrilldownFunc LLView::sDrilldown = boost::bind(&LLView::pointInView, _1, _2, _3, HIT_TEST_USE_BOUNDING_RECT); //#if LL_DEBUG -BOOL LLView::sIsDrawing = FALSE; +bool LLView::sIsDrawing = false; //#endif // Compiler optimization, generate extern template template class LLView* LLView::getChild<class LLView>( - const std::string& name, BOOL recurse) const; + const std::string& name, bool recurse) const; static LLDefaultChildRegistry::Register<LLView> r("view"); @@ -148,7 +148,7 @@ LLView::LLView(const LLView::Params& p) mReshapeFlags(FOLLOWS_NONE), mFromXUI(p.from_xui), mIsFocusRoot(p.focus_root), - mLastVisible(FALSE), + mLastVisible(false), mHoverCursor(getCursorFromString(p.hover_cursor)), mEnabled(p.enabled), mMouseOpaque(p.mouse_opaque), @@ -172,7 +172,7 @@ LLView::~LLView() { LL_DEBUGS() << "Deleting view " << mName << " during UI draw() phase" << LL_ENDL; } -// llassert(LLView::sIsDrawing == FALSE); +// llassert(LLView::sIsDrawing == false); // llassert_always(sDepth == 0); // avoid deleting views while drawing! It can subtly break list iterators @@ -197,15 +197,15 @@ LLView::~LLView() } // virtual -BOOL LLView::isCtrl() const +bool LLView::isCtrl() const { - return FALSE; + return false; } // virtual -BOOL LLView::isPanel() const +bool LLView::isPanel() const { - return FALSE; + return false; } void LLView::setToolTip(const LLStringExplicit& msg) @@ -213,10 +213,10 @@ void LLView::setToolTip(const LLStringExplicit& msg) mToolTipMsg = msg; } -BOOL LLView::setToolTipArg(const LLStringExplicit& key, const LLStringExplicit& text) +bool LLView::setToolTipArg(const LLStringExplicit& key, const LLStringExplicit& text) { mToolTipMsg.setArg(key, text); - return TRUE; + return true; } void LLView::setToolTipArgs( const LLStringUtil::format_map_t& args ) @@ -231,7 +231,7 @@ void LLView::setRect(const LLRect& rect) updateBoundingRect(); } -void LLView::setUseBoundingRect( BOOL use_bounding_rect ) +void LLView::setUseBoundingRect( bool use_bounding_rect ) { if (mUseBoundingRect != use_bounding_rect) { @@ -240,7 +240,7 @@ void LLView::setUseBoundingRect( BOOL use_bounding_rect ) } } -BOOL LLView::getUseBoundingRect() const +bool LLView::getUseBoundingRect() const { return mUseBoundingRect; } @@ -342,11 +342,11 @@ void LLView::removeChild(LLView* child) if (child->mParentView == this) { // if we are removing an item we are currently iterating over, that would be bad - llassert(child->mInDraw == false); + llassert(!child->mInDraw); mChildList.remove( child ); child->mParentView = NULL; child_tab_order_t::iterator found = mTabOrder.find(child); - if(found != mTabOrder.end()) + if (found != mTabOrder.end()) { mTabOrder.erase(found); } @@ -358,16 +358,16 @@ void LLView::removeChild(LLView* child) updateBoundingRect(); } -BOOL LLView::isInVisibleChain() const +bool LLView::isInVisibleChain() const { - BOOL visible = TRUE; + bool visible = true; const LLView* viewp = this; while(viewp) { if (!viewp->getVisible()) { - visible = FALSE; + visible = false; break; } viewp = viewp->getParent(); @@ -376,16 +376,16 @@ BOOL LLView::isInVisibleChain() const return visible; } -BOOL LLView::isInEnabledChain() const +bool LLView::isInEnabledChain() const { - BOOL enabled = TRUE; + bool enabled = true; const LLView* viewp = this; while(viewp) { if (!viewp->getEnabled()) { - enabled = FALSE; + enabled = false; break; } viewp = viewp->getParent(); @@ -445,13 +445,13 @@ std::string LLView::getPathname(const LLView* view) } // virtual -BOOL LLView::canFocusChildren() const +bool LLView::canFocusChildren() const { - return TRUE; + return true; } //virtual -void LLView::setEnabled(BOOL enabled) +void LLView::setEnabled(bool enabled) { mEnabled = enabled; } @@ -469,9 +469,9 @@ bool LLView::isAvailable(const LLView* view) } //virtual -BOOL LLView::setLabelArg( const std::string& key, const LLStringExplicit& text ) +bool LLView::setLabelArg( const std::string& key, const LLStringExplicit& text ) { - return FALSE; + return false; } //virtual @@ -486,20 +486,20 @@ LLRect LLView::getRequiredRect() return mRect; } -BOOL LLView::focusNextRoot() +bool LLView::focusNextRoot() { LLView::child_list_t result = LLView::getFocusRootsQuery().run(this); return LLView::focusNext(result); } -BOOL LLView::focusPrevRoot() +bool LLView::focusPrevRoot() { LLView::child_list_t result = LLView::getFocusRootsQuery().run(this); return LLView::focusPrev(result); } // static -BOOL LLView::focusNext(LLView::child_list_t & result) +bool LLView::focusNext(LLView::child_list_t & result) { LLView::child_list_reverse_iter_t focused = result.rend(); for(LLView::child_list_reverse_iter_t iter = result.rbegin(); @@ -524,18 +524,18 @@ BOOL LLView::focusNext(LLView::child_list_t & result) if ((*next)->isCtrl() && ((LLUICtrl*)*next)->hasTabStop()) { LLUICtrl * ctrl = static_cast<LLUICtrl*>(*next); - ctrl->setFocus(TRUE); + ctrl->setFocus(true); ctrl->onTabInto(); gFocusMgr.triggerFocusFlash(); - return TRUE; + return true; } ++next; } - return FALSE; + return false; } // static -BOOL LLView::focusPrev(LLView::child_list_t & result) +bool LLView::focusPrev(LLView::child_list_t & result) { LLView::child_list_iter_t focused = result.end(); for(LLView::child_list_iter_t iter = result.begin(); @@ -562,15 +562,15 @@ BOOL LLView::focusPrev(LLView::child_list_t & result) LLUICtrl * ctrl = static_cast<LLUICtrl*>(*next); if (!ctrl->hasFocus()) { - ctrl->setFocus(TRUE); + ctrl->setFocus(true); ctrl->onTabInto(); gFocusMgr.triggerFocusFlash(); } - return TRUE; + return true; } ++next; } - return FALSE; + return false; } // delete all children. Override this function if you need to @@ -591,16 +591,24 @@ void LLView::deleteAllChildren() updateBoundingRect(); } -void LLView::setAllChildrenEnabled(BOOL b) +void LLView::setAllChildrenEnabled(bool b, bool recursive /*= false*/) { for (LLView* viewp : mChildList) { viewp->setEnabled(b); } + + if (recursive) + { + for (LLView* viewp : mChildList) + { + viewp->setAllChildrenEnabled(b, recursive); + } + } } // virtual -void LLView::setVisible(BOOL visible) +void LLView::setVisible(bool visible) { if ( mVisible != visible ) { @@ -618,10 +626,10 @@ void LLView::setVisible(BOOL visible) } // virtual -void LLView::onVisibilityChange ( BOOL new_visibility ) +void LLView::onVisibilityChange ( bool new_visibility ) { - BOOL old_visibility; - BOOL log_visibility_change = LLViewerEventRecorder::instance().getLoggingStatus(); + bool old_visibility; + bool log_visibility_change = LLViewerEventRecorder::instance().getLoggingStatus(); for (LLView* viewp : mChildList) { if (!viewp) @@ -674,7 +682,7 @@ void LLView::translate(S32 x, S32 y) } // virtual -BOOL LLView::canSnapTo(const LLView* other_view) +bool LLView::canSnapTo(const LLView* other_view) { return other_view != this && other_view->getVisible(); } @@ -684,7 +692,7 @@ void LLView::setSnappedTo(const LLView* snap_view) { } -BOOL LLView::handleHover(S32 x, S32 y, MASK mask) +bool LLView::handleHover(S32 x, S32 y, MASK mask) { return childrenHandleHover( x, y, mask ) != NULL; } @@ -728,7 +736,7 @@ LLView* LLView::childrenHandleCharEvent(const std::string& desc, const METHOD& m { for (LLView* viewp : mChildList) { - if ((viewp->*method)(c, mask, TRUE)) + if ((viewp->*method)(c, mask, true)) { if (LLView::sDebugKeys) { @@ -797,7 +805,7 @@ LLView* LLView::childrenHandleToolTip(S32 x, S32 y, MASK mask) } LLView* LLView::childrenHandleDragAndDrop(S32 x, S32 y, MASK mask, - BOOL drop, + bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -926,9 +934,9 @@ const std::string LLView::getToolTip() const return mToolTipMsg.getString(); } -BOOL LLView::handleToolTip(S32 x, S32 y, MASK mask) +bool LLView::handleToolTip(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; // parents provide tooltips first, which are optionally // overridden by children, in case child is mouse_opaque @@ -945,22 +953,22 @@ BOOL LLView::handleToolTip(S32 x, S32 y, MASK mask) .sticky_rect(calcScreenRect()) .delay_time(getTooltipTimeout())); } - handled = TRUE; + handled = true; } // child tooltips will override our own LLView* child_handler = childrenHandleToolTip(x, y, mask); if (child_handler) { - handled = TRUE; + handled = true; } return handled; } -BOOL LLView::handleKey(KEY key, MASK mask, BOOL called_from_parent) +bool LLView::handleKey(KEY key, MASK mask, bool called_from_parent) { - BOOL handled = FALSE; + bool handled = false; if (getVisible() && getEnabled()) { @@ -985,14 +993,14 @@ BOOL LLView::handleKey(KEY key, MASK mask, BOOL called_from_parent) if( !handled && !called_from_parent && mParentView) { // Upward traversal - handled = mParentView->handleKey( key, mask, FALSE ); + handled = mParentView->handleKey( key, mask, false ); } return handled; } -BOOL LLView::handleKeyUp(KEY key, MASK mask, BOOL called_from_parent) +bool LLView::handleKeyUp(KEY key, MASK mask, bool called_from_parent) { - BOOL handled = FALSE; + bool handled = false; if (getVisible() && getEnabled()) { @@ -1017,28 +1025,28 @@ BOOL LLView::handleKeyUp(KEY key, MASK mask, BOOL called_from_parent) if (!handled && !called_from_parent && mParentView) { // Upward traversal - handled = mParentView->handleKeyUp(key, mask, FALSE); + handled = mParentView->handleKeyUp(key, mask, false); } return handled; } // Called from handleKey() // Handles key in this object. Checking parents and children happens in handleKey() -BOOL LLView::handleKeyHere(KEY key, MASK mask) +bool LLView::handleKeyHere(KEY key, MASK mask) { - return FALSE; + return false; } // Called from handleKey() // Handles key in this object. Checking parents and children happens in handleKey() -BOOL LLView::handleKeyUpHere(KEY key, MASK mask) +bool LLView::handleKeyUpHere(KEY key, MASK mask) { - return FALSE; + return false; } -BOOL LLView::handleUnicodeChar(llwchar uni_char, BOOL called_from_parent) +bool LLView::handleUnicodeChar(llwchar uni_char, bool called_from_parent) { - BOOL handled = FALSE; + bool handled = false; if (getVisible() && getEnabled()) { @@ -1061,7 +1069,7 @@ BOOL LLView::handleUnicodeChar(llwchar uni_char, BOOL called_from_parent) if (!handled && !called_from_parent && mParentView) { // Upward traversal - handled = mParentView->handleUnicodeChar(uni_char, FALSE); + handled = mParentView->handleUnicodeChar(uni_char, false); } if (handled) @@ -1072,7 +1080,7 @@ BOOL LLView::handleUnicodeChar(llwchar uni_char, BOOL called_from_parent) return handled; } -BOOL LLView::handleUnicodeString(char *uni_str, bool editing, BOOL called_from_parent) +bool LLView::handleUnicodeString(char *uni_str, bool editing, bool called_from_parent) { auto handled = FALSE; @@ -1088,17 +1096,17 @@ BOOL LLView::handleUnicodeString(char *uni_str, bool editing, BOOL called_from_p return handled; } -BOOL LLView::handleUnicodeCharHere(llwchar uni_char ) +bool LLView::handleUnicodeCharHere(llwchar uni_char ) { - return FALSE; + return false; } -BOOL LLView::handleUnicodeStringHere(char *uni_str, bool editing) +bool LLView::handleUnicodeStringHere(char *uni_str, bool editing) { return FALSE; } -BOOL LLView::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +bool LLView::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) @@ -1110,56 +1118,56 @@ void LLView::onMouseCaptureLost() { } -BOOL LLView::hasMouseCapture() +bool LLView::hasMouseCapture() { return gFocusMgr.getMouseCapture() == this; } -BOOL LLView::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLView::handleMouseUp(S32 x, S32 y, MASK mask) { LLView* r = childrenHandleMouseUp( x, y, mask ); return (r!=NULL); } -BOOL LLView::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLView::handleMouseDown(S32 x, S32 y, MASK mask) { LLView* r= childrenHandleMouseDown(x, y, mask ); return (r!=NULL); } -BOOL LLView::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLView::handleDoubleClick(S32 x, S32 y, MASK mask) { return childrenHandleDoubleClick( x, y, mask ) != NULL; } -BOOL LLView::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLView::handleScrollWheel(S32 x, S32 y, S32 clicks) { return childrenHandleScrollWheel( x, y, clicks ) != NULL; } -BOOL LLView::handleScrollHWheel(S32 x, S32 y, S32 clicks) +bool LLView::handleScrollHWheel(S32 x, S32 y, S32 clicks) { return childrenHandleScrollHWheel( x, y, clicks ) != NULL; } -BOOL LLView::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLView::handleRightMouseDown(S32 x, S32 y, MASK mask) { return childrenHandleRightMouseDown( x, y, mask ) != NULL; } -BOOL LLView::handleRightMouseUp(S32 x, S32 y, MASK mask) +bool LLView::handleRightMouseUp(S32 x, S32 y, MASK mask) { return childrenHandleRightMouseUp( x, y, mask ) != NULL; } -BOOL LLView::handleMiddleMouseDown(S32 x, S32 y, MASK mask) +bool LLView::handleMiddleMouseDown(S32 x, S32 y, MASK mask) { return childrenHandleMiddleMouseDown( x, y, mask ) != NULL; } -BOOL LLView::handleMiddleMouseUp(S32 x, S32 y, MASK mask) +bool LLView::handleMiddleMouseUp(S32 x, S32 y, MASK mask) { return childrenHandleMiddleMouseUp( x, y, mask ) != NULL; } @@ -1390,7 +1398,7 @@ void LLView::drawDebugRect() LLUI::popMatrix(); } -void LLView::drawChild(LLView* childp, S32 x_offset, S32 y_offset, BOOL force_draw) +void LLView::drawChild(LLView* childp, S32 x_offset, S32 y_offset, bool force_draw) { if (childp && childp->getParent() == this) { @@ -1413,7 +1421,7 @@ void LLView::drawChild(LLView* childp, S32 x_offset, S32 y_offset, BOOL force_dr } -void LLView::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLView::reshape(S32 width, S32 height, bool called_from_parent) { // compute how much things changed and apply reshape logic to children S32 delta_width = width - getRect().getWidth(); @@ -1487,7 +1495,7 @@ void LLView::reshape(S32 width, S32 height, BOOL called_from_parent) { if (mParentView) { - mParentView->reshape(mParentView->getRect().getWidth(), mParentView->getRect().getHeight(), FALSE); + mParentView->reshape(mParentView->getRect().getWidth(), mParentView->getRect().getHeight(), false); } } @@ -1602,11 +1610,11 @@ LLRect LLView::getLocalSnapRect() const return local_snap_rect; } -BOOL LLView::hasAncestor(const LLView* parentp) const +bool LLView::hasAncestor(const LLView* parentp) const { if (!parentp) { - return FALSE; + return false; } LLView* viewp = getParent(); @@ -1614,17 +1622,17 @@ BOOL LLView::hasAncestor(const LLView* parentp) const { if (viewp == parentp) { - return TRUE; + return true; } viewp = viewp->getParent(); } - return FALSE; + return false; } //----------------------------------------------------------------------------- -BOOL LLView::childHasKeyboardFocus( const std::string& childname ) const +bool LLView::childHasKeyboardFocus( const std::string& childname ) const { LLView *focus = dynamic_cast<LLView *>(gFocusMgr.getKeyboardFocus()); @@ -1632,18 +1640,18 @@ BOOL LLView::childHasKeyboardFocus( const std::string& childname ) const { if (focus->getName() == childname) { - return TRUE; + return true; } focus = focus->getParent(); } - return FALSE; + return false; } //----------------------------------------------------------------------------- -BOOL LLView::hasChild(const std::string& childname, BOOL recurse) const +bool LLView::hasChild(const std::string& childname, bool recurse) const { return findChildView(childname, recurse) != NULL; } @@ -1651,12 +1659,12 @@ BOOL LLView::hasChild(const std::string& childname, BOOL recurse) const //----------------------------------------------------------------------------- // getChildView() //----------------------------------------------------------------------------- -LLView* LLView::getChildView(const std::string& name, BOOL recurse) const +LLView* LLView::getChildView(const std::string& name, bool recurse) const { return getChild<LLView>(name, recurse); } -LLView* LLView::findChildView(const std::string& name, BOOL recurse) const +LLView* LLView::findChildView(const std::string& name, bool recurse) const { LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; @@ -1685,21 +1693,21 @@ LLView* LLView::findChildView(const std::string& name, BOOL recurse) const return NULL; } -BOOL LLView::parentPointInView(S32 x, S32 y, EHitTestType type) const +bool LLView::parentPointInView(S32 x, S32 y, EHitTestType type) const { return (getUseBoundingRect() && type == HIT_TEST_USE_BOUNDING_RECT) ? mBoundingRect.pointInRect( x, y ) : mRect.pointInRect( x, y ); } -BOOL LLView::pointInView(S32 x, S32 y, EHitTestType type) const +bool LLView::pointInView(S32 x, S32 y, EHitTestType type) const { return (getUseBoundingRect() && type == HIT_TEST_USE_BOUNDING_RECT) ? mBoundingRect.pointInRect( x + mRect.mLeft, y + mRect.mBottom ) : mRect.localPointInRect( x, y ); } -BOOL LLView::blockMouseEvent(S32 x, S32 y) const +bool LLView::blockMouseEvent(S32 x, S32 y) const { return mMouseOpaque && pointInView(x, y, HIT_TEST_IGNORE_BOUNDING_RECT); } @@ -1828,27 +1836,27 @@ LLCoordGL getNeededTranslation(const LLRect& input, const LLRect& constraint, S3 // Moves the view so that it is entirely inside of constraint. // If the view will not fit because it's too big, aligns with the top and left. // (Why top and left? That's where the drag bars are for floaters.) -BOOL LLView::translateIntoRect(const LLRect& constraint, S32 min_overlap_pixels) +bool LLView::translateIntoRect(const LLRect& constraint, S32 min_overlap_pixels) { return translateRectIntoRect(getRect(), constraint, min_overlap_pixels); } -BOOL LLView::translateRectIntoRect(const LLRect& rect, const LLRect& constraint, S32 min_overlap_pixels) +bool LLView::translateRectIntoRect(const LLRect& rect, const LLRect& constraint, S32 min_overlap_pixels) { LLCoordGL translation = getNeededTranslation(rect, constraint, min_overlap_pixels); if (translation.mX != 0 || translation.mY != 0) { translate(translation.mX, translation.mY); - return TRUE; + return true; } - return FALSE; + return false; } // move this view into "inside" but not onto "exclude" // NOTE: if this view is already contained in "inside", we ignore the "exclude" rect -BOOL LLView::translateIntoRectWithExclusion( const LLRect& inside, const LLRect& exclude, S32 min_overlap_pixels) +bool LLView::translateIntoRectWithExclusion( const LLRect& inside, const LLRect& exclude, S32 min_overlap_pixels) { LLCoordGL translation = getNeededTranslation(getRect(), inside, min_overlap_pixels); @@ -1884,9 +1892,9 @@ BOOL LLView::translateIntoRectWithExclusion( const LLRect& inside, const LLRect& } } - return TRUE; + return true; } - return FALSE; + return false; } @@ -1898,7 +1906,7 @@ void LLView::centerWithin(const LLRect& bounds) translate( left - getRect().mLeft, bottom - getRect().mBottom ); } -BOOL LLView::localPointToOtherView( S32 x, S32 y, S32 *other_x, S32 *other_y, const LLView* other_view) const +bool LLView::localPointToOtherView( S32 x, S32 y, S32 *other_x, S32 *other_y, const LLView* other_view) const { const LLView* cur_view = this; const LLView* root_view = NULL; @@ -1909,7 +1917,7 @@ BOOL LLView::localPointToOtherView( S32 x, S32 y, S32 *other_x, S32 *other_y, co { *other_x = x; *other_y = y; - return TRUE; + return true; } x += cur_view->getRect().mLeft; @@ -1932,16 +1940,16 @@ BOOL LLView::localPointToOtherView( S32 x, S32 y, S32 *other_x, S32 *other_y, co { *other_x = x; *other_y = y; - return TRUE; + return true; } } *other_x = x; *other_y = y; - return FALSE; + return false; } -BOOL LLView::localRectToOtherView( const LLRect& local, LLRect* other, const LLView* other_view ) const +bool LLView::localRectToOtherView( const LLRect& local, LLRect* other, const LLView* other_view ) const { LLRect cur_rect = local; const LLView* cur_view = this; @@ -1952,7 +1960,7 @@ BOOL LLView::localRectToOtherView( const LLRect& local, LLRect* other, const LLV if (cur_view == other_view) { *other = cur_rect; - return TRUE; + return true; } cur_rect.translate(cur_view->getRect().mLeft, cur_view->getRect().mBottom); @@ -1972,12 +1980,12 @@ BOOL LLView::localRectToOtherView( const LLRect& local, LLRect* other, const LLV if (cur_view == root_view) { *other = cur_rect; - return TRUE; + return true; } } *other = cur_rect; - return FALSE; + return false; } diff --git a/indra/llui/llview.h b/indra/llui/llview.h index a840498628..ad3b71505d 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -61,8 +61,8 @@ const U32 FOLLOWS_TOP = 0x10; const U32 FOLLOWS_BOTTOM = 0x20; const U32 FOLLOWS_ALL = 0x33; -const BOOL MOUSE_OPAQUE = TRUE; -const BOOL NOT_MOUSE_OPAQUE = FALSE; +const bool MOUSE_OPAQUE = true; +const bool NOT_MOUSE_OPAQUE = false; const U32 GL_NAME_UI_RESERVED = 2; @@ -169,7 +169,7 @@ private: LLView(const LLView& other); public: //#if LL_DEBUG - static BOOL sIsDrawing; + static bool sIsDrawing; //#endif enum ESoundFlags { @@ -210,19 +210,19 @@ public: virtual ~LLView(); // Some UI widgets need to be added as controls. Others need to - // be added as regular view children. isCtrl should return TRUE + // be added as regular view children. isCtrl should return true // if a widget needs to be added as a ctrl - virtual BOOL isCtrl() const; + virtual bool isCtrl() const; - virtual BOOL isPanel() const; + virtual bool isPanel() const; // // MANIPULATORS // - void setMouseOpaque( BOOL b ) { mMouseOpaque = b; } - BOOL getMouseOpaque() const { return mMouseOpaque; } + void setMouseOpaque( bool b ) { mMouseOpaque = b; } + bool getMouseOpaque() const { return mMouseOpaque; } void setToolTip( const LLStringExplicit& msg ); - BOOL setToolTipArg( const LLStringExplicit& key, const LLStringExplicit& text ); + bool setToolTipArg( const LLStringExplicit& key, const LLStringExplicit& text ); void setToolTipArgs( const LLStringUtil::format_map_t& args ); virtual void setRect(const LLRect &rect); @@ -238,8 +238,8 @@ public: void setSoundFlags(U8 flags) { mSoundFlags = flags; } void setName(std::string name) { mName = name; } - void setUseBoundingRect( BOOL use_bounding_rect ); - BOOL getUseBoundingRect() const; + void setUseBoundingRect( bool use_bounding_rect ); + bool getUseBoundingRect() const; ECursorType getHoverCursor() { return mHoverCursor; } @@ -259,7 +259,7 @@ public: // remove the specified child from the view, and set it's parent to NULL. virtual void removeChild(LLView* view); - virtual BOOL postBuild() { return TRUE; } + virtual bool postBuild() { return true; } const child_tab_order_t& getTabOrder() const { return mTabOrder; } @@ -267,15 +267,15 @@ public: S32 getDefaultTabGroup() const { return mDefaultTabGroup; } S32 getLastTabGroup() { return mLastTabGroup; } - BOOL isInVisibleChain() const; - BOOL isInEnabledChain() const; + bool isInVisibleChain() const; + bool isInEnabledChain() const; - void setFocusRoot(BOOL b) { mIsFocusRoot = b; } - BOOL isFocusRoot() const { return mIsFocusRoot; } - virtual BOOL canFocusChildren() const; + void setFocusRoot(bool b) { mIsFocusRoot = b; } + bool isFocusRoot() const { return mIsFocusRoot; } + virtual bool canFocusChildren() const; - BOOL focusNextRoot(); - BOOL focusPrevRoot(); + bool focusNextRoot(); + bool focusPrevRoot(); // Normally we want the app menus to get priority on accelerated keys // However, sometimes we want to give specific views a first chance @@ -287,13 +287,13 @@ public: // children, etc. virtual void deleteAllChildren(); - void setAllChildrenEnabled(BOOL b); + void setAllChildrenEnabled(bool b, bool recursive = false); - virtual void setVisible(BOOL visible); - void setVisibleDirect(BOOL visible) { mVisible = visible; } - const BOOL& getVisible() const { return mVisible; } - virtual void setEnabled(BOOL enabled); - BOOL getEnabled() const { return mEnabled; } + virtual void setVisible(bool visible); + void setVisibleDirect(bool visible) { mVisible = visible; } + const bool& getVisible() const { return mVisible; } + virtual void setEnabled(bool enabled); + bool getEnabled() const { return mEnabled; } /// 'available' in this context means 'visible and enabled': in other /// words, can a user actually interact with this? virtual bool isAvailable() const; @@ -301,21 +301,21 @@ public: static bool isAvailable(const LLView* view); U8 getSoundFlags() const { return mSoundFlags; } - virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); + virtual bool setLabelArg( const std::string& key, const LLStringExplicit& text ); - virtual void onVisibilityChange ( BOOL new_visibility ); + virtual void onVisibilityChange ( bool new_visibility ); virtual void onUpdateScrollToChild(const LLUICtrl * cntrl); - void pushVisible(BOOL visible) { mLastVisible = mVisible; setVisible(visible); } + void pushVisible(bool visible) { mLastVisible = mVisible; setVisible(visible); } void popVisible() { setVisible(mLastVisible); } - BOOL getLastVisible() const { return mLastVisible; } + bool getLastVisible() const { return mLastVisible; } U32 getFollows() const { return mReshapeFlags; } - BOOL followsLeft() const { return mReshapeFlags & FOLLOWS_LEFT; } - BOOL followsRight() const { return mReshapeFlags & FOLLOWS_RIGHT; } - BOOL followsTop() const { return mReshapeFlags & FOLLOWS_TOP; } - BOOL followsBottom() const { return mReshapeFlags & FOLLOWS_BOTTOM; } - BOOL followsAll() const { return mReshapeFlags & FOLLOWS_ALL; } + bool followsLeft() const { return mReshapeFlags & FOLLOWS_LEFT; } + bool followsRight() const { return mReshapeFlags & FOLLOWS_RIGHT; } + bool followsTop() const { return mReshapeFlags & FOLLOWS_TOP; } + bool followsBottom() const { return mReshapeFlags & FOLLOWS_BOTTOM; } + bool followsAll() const { return mReshapeFlags & FOLLOWS_ALL; } const LLRect& getRect() const { return mRect; } const LLRect& getBoundingRect() const { return mBoundingRect; } @@ -340,9 +340,9 @@ public: LLView* findNextSibling(LLView* child); S32 getChildCount() const { return (S32)mChildList.size(); } template<class _Pr3> void sortChildren(_Pr3 _Pred) { mChildList.sort(_Pred); } - BOOL hasAncestor(const LLView* parentp) const; - BOOL hasChild(const std::string& childname, BOOL recurse = FALSE) const; - BOOL childHasKeyboardFocus( const std::string& childname ) const; + bool hasAncestor(const LLView* parentp) const; + bool hasChild(const std::string& childname, bool recurse = false) const; + bool childHasKeyboardFocus( const std::string& childname ) const; // these iterators are used for collapsing various tree traversals into for loops typedef LLTreeDFSIter<LLView, child_list_const_iter_t> tree_iterator_t; @@ -367,27 +367,27 @@ public: // // Default behavior is to use reshape flags to resize child views - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + virtual void reshape(S32 width, S32 height, bool called_from_parent = true); virtual void translate( S32 x, S32 y ); void setOrigin( S32 x, S32 y ) { mRect.translate( x - mRect.mLeft, y - mRect.mBottom ); } - BOOL translateIntoRect( const LLRect& constraint, S32 min_overlap_pixels = S32_MAX); - BOOL translateRectIntoRect( const LLRect& rect, const LLRect& constraint, S32 min_overlap_pixels = S32_MAX); - BOOL translateIntoRectWithExclusion( const LLRect& inside, const LLRect& exclude, S32 min_overlap_pixels = S32_MAX); + bool translateIntoRect( const LLRect& constraint, S32 min_overlap_pixels = S32_MAX); + bool translateRectIntoRect( const LLRect& rect, const LLRect& constraint, S32 min_overlap_pixels = S32_MAX); + bool translateIntoRectWithExclusion( const LLRect& inside, const LLRect& exclude, S32 min_overlap_pixels = S32_MAX); void centerWithin(const LLRect& bounds); void setShape(const LLRect& new_rect, bool by_user = false); virtual LLView* findSnapRect(LLRect& new_rect, const LLCoordGL& mouse_dir, LLView::ESnapType snap_type, S32 threshold, S32 padding = 0); virtual LLView* findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding = 0); - virtual BOOL canSnapTo(const LLView* other_view); + virtual bool canSnapTo(const LLView* other_view); virtual void setSnappedTo(const LLView* snap_view); // inherited from LLFocusableElement - /* virtual */ BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); - /* virtual */ BOOL handleKeyUp(KEY key, MASK mask, BOOL called_from_parent); - /* virtual */ BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent); - /* virtual */ BOOL handleUnicodeString(char *uni_str, bool editing, BOOL called_from_parent); + /* virtual */ bool handleKey(KEY key, MASK mask, bool called_from_parent); + /* virtual */ bool handleKeyUp(KEY key, MASK mask, bool called_from_parent); + /* virtual */ bool handleUnicodeChar(llwchar uni_char, bool called_from_parent); + /* virtual */ bool handleUnicodeString(char *uni_str, bool editing, bool called_from_parent); - virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + virtual bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -398,8 +398,8 @@ public: void parseFollowsFlags(const LLView::Params& params); // Some widgets, like close box buttons, don't need to be saved - BOOL getFromXUI() const { return mFromXUI; } - void setFromXUI(BOOL b) { mFromXUI = b; } + bool getFromXUI() const { return mFromXUI; } + void setFromXUI(bool b) { mFromXUI = b; } typedef enum e_hit_test_type { @@ -407,13 +407,13 @@ public: HIT_TEST_IGNORE_BOUNDING_RECT }EHitTestType; - BOOL parentPointInView(S32 x, S32 y, EHitTestType type = HIT_TEST_USE_BOUNDING_RECT) const; - BOOL pointInView(S32 x, S32 y, EHitTestType type = HIT_TEST_USE_BOUNDING_RECT) const; - BOOL blockMouseEvent(S32 x, S32 y) const; + bool parentPointInView(S32 x, S32 y, EHitTestType type = HIT_TEST_USE_BOUNDING_RECT) const; + bool pointInView(S32 x, S32 y, EHitTestType type = HIT_TEST_USE_BOUNDING_RECT) const; + bool blockMouseEvent(S32 x, S32 y) const; // See LLMouseHandler virtuals for screenPointToLocal and localPointToScreen - BOOL localPointToOtherView( S32 x, S32 y, S32 *other_x, S32 *other_y, const LLView* other_view) const; - BOOL localRectToOtherView( const LLRect& local, LLRect* other, const LLView* other_view ) const; + bool localPointToOtherView( S32 x, S32 y, S32 *other_x, S32 *other_y, const LLView* other_view) const; + bool localRectToOtherView( const LLRect& local, LLRect* other, const LLView* other_view ) const; void screenRectToLocal( const LLRect& screen, LLRect* local ) const; void localRectToScreen( const LLRect& local, LLRect* screen ) const; @@ -425,21 +425,21 @@ public: // LLMouseHandler functions // Default behavior is to pass events to children - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); - /*virtual*/ BOOL handleScrollHWheel(S32 x, S32 y, S32 clicks); - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMiddleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMiddleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleDoubleClick(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleScrollWheel(S32 x, S32 y, S32 clicks); + /*virtual*/ bool handleScrollHWheel(S32 x, S32 y, S32 clicks); + /*virtual*/ bool handleRightMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleRightMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleToolTip(S32 x, S32 y, MASK mask); /*virtual*/ const std::string& getName() const; /*virtual*/ void onMouseCaptureLost(); - /*virtual*/ BOOL hasMouseCapture(); + /*virtual*/ bool hasMouseCapture(); /*virtual*/ void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const; /*virtual*/ void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const; @@ -453,22 +453,22 @@ public: // static method handles NULL pointer too static std::string getPathname(const LLView*); - template <class T> T* findChild(const std::string& name, BOOL recurse = TRUE) const + template <class T> T* findChild(const std::string& name, bool recurse = true) const { LLView* child = findChildView(name, recurse); T* result = dynamic_cast<T*>(child); return result; } - template <class T> T* getChild(const std::string& name, BOOL recurse = TRUE) const; + template <class T> T* getChild(const std::string& name, bool recurse = true) const; - template <class T> T& getChildRef(const std::string& name, BOOL recurse = TRUE) const + template <class T> T& getChildRef(const std::string& name, bool recurse = true) const { return *getChild<T>(name, recurse); } - virtual LLView* getChildView(const std::string& name, BOOL recurse = TRUE) const; - virtual LLView* findChildView(const std::string& name, BOOL recurse = TRUE) const; + virtual LLView* getChildView(const std::string& name, bool recurse = true) const; + virtual LLView* findChildView(const std::string& name, bool recurse = true) const; template <class T> T* getDefaultWidget(const std::string& name) const { @@ -496,9 +496,9 @@ public: //static LLFontGL::HAlign selectFontHAlign(LLXMLNodePtr node); // focuses the item in the list after the currently-focused item, wrapping if necessary - static BOOL focusNext(LLView::child_list_t & result); + static bool focusNext(LLView::child_list_t & result); // focuses the item in the list before the currently-focused item, wrapping if necessary - static BOOL focusPrev(LLView::child_list_t & result); + static bool focusPrev(LLView::child_list_t & result); // returns query for iterating over controls in tab order static const LLViewQuery & getTabOrderQuery(); @@ -515,11 +515,11 @@ public: // to be top-left based. static void setupParamsForExport(Params& p, LLView* parent); - //virtual BOOL addChildFromParam(const LLInitParam::BaseBlock& params) { return TRUE; } - virtual BOOL handleKeyHere(KEY key, MASK mask); - virtual BOOL handleKeyUpHere(KEY key, MASK mask); - virtual BOOL handleUnicodeCharHere(llwchar uni_char); - virtual BOOL handleUnicodeStringHere(char *uni_str, bool editing); + //virtual bool addChildFromParam(const LLInitParam::BaseBlock& params) { return true; } + virtual bool handleKeyHere(KEY key, MASK mask); + virtual bool handleKeyUpHere(KEY key, MASK mask); + virtual bool handleUnicodeCharHere(llwchar uni_char); + virtual bool handleUnicodeStringHere(char *uni_str, bool editing); virtual void handleReshape(const LLRect& rect, bool by_user); virtual void dirtyRect(); @@ -541,7 +541,7 @@ public: protected: void drawDebugRect(); - void drawChild(LLView* childp, S32 x_offset = 0, S32 y_offset = 0, BOOL force_draw = FALSE); + void drawChild(LLView* childp, S32 x_offset = 0, S32 y_offset = 0, bool force_draw = false); void drawChildren(); bool visibleAndContains(S32 local_x, S32 local_Y); bool visibleEnabledAndContains(S32 local_x, S32 local_y); @@ -551,7 +551,7 @@ protected: LLView* childrenHandleKeyUp(KEY key, MASK mask); LLView* childrenHandleUnicodeChar(llwchar uni_char); LLView* childrenHandleDragAndDrop(S32 x, S32 y, MASK mask, - BOOL drop, + bool drop, EDragAndDropType type, void* data, EAcceptance* accept, @@ -583,7 +583,7 @@ private: // adapter to blur distinction between handleKey() and handleUnicodeChar() // for childrenHandleCharEvent() - BOOL handleUnicodeCharWithDummyMask(llwchar uni_char, MASK /* dummy */, BOOL from_parent) + bool handleUnicodeCharWithDummyMask(llwchar uni_char, MASK /* dummy */, bool from_parent) { return handleUnicodeChar(uni_char, from_parent); } @@ -592,7 +592,7 @@ private: child_list_t mChildList; // location in pixels, relative to surrounding structure, bottom,left=0,0 - BOOL mVisible; + bool mVisible; LLRect mRect; LLRect mBoundingRect; @@ -605,18 +605,18 @@ private: S32 mDefaultTabGroup; S32 mLastTabGroup; - BOOL mEnabled; // Enabled means "accepts input that has an effect on the state of the application." + bool mEnabled; // Enabled means "accepts input that has an effect on the state of the application." // A disabled view, for example, may still have a scrollbar that responds to mouse events. - BOOL mMouseOpaque; // Opaque views handle all mouse events that are over their rect. + bool mMouseOpaque; // Opaque views handle all mouse events that are over their rect. LLUIString mToolTipMsg; // isNull() is true if none. U8 mSoundFlags; - BOOL mFromXUI; + bool mFromXUI; - BOOL mIsFocusRoot; - BOOL mUseBoundingRect; // hit test against bounding rectangle that includes all child elements + bool mIsFocusRoot; + bool mUseBoundingRect; // hit test against bounding rectangle that includes all child elements - BOOL mLastVisible; + bool mLastVisible; bool mInDraw; @@ -681,12 +681,12 @@ public: static std::string sMouseHandlerMessage; static S32 sSelectID; static std::set<LLView*> sPreviewHighlightedElements; // DEV-16869 - static BOOL sHighlightingDiffs; // DEV-16869 + static bool sHighlightingDiffs; // DEV-16869 static LLView* sPreviewClickedElement; // DEV-16869 - static BOOL sDrawPreviewHighlights; + static bool sDrawPreviewHighlights; static S32 sLastLeftXML; static S32 sLastBottomXML; - static BOOL sForceReshape; + static bool sForceReshape; }; namespace LLInitParam @@ -698,7 +698,7 @@ struct TypeValues<LLView::EOrientation> : public LLInitParam::TypeValuesHelper<L }; } -template <class T> T* LLView::getChild(const std::string& name, BOOL recurse) const +template <class T> T* LLView::getChild(const std::string& name, bool recurse) const { LLView* child = findChildView(name, recurse); T* result = dynamic_cast<T*>(child); @@ -733,7 +733,7 @@ template <class T> T* LLView::getChild(const std::string& name, BOOL recurse) co // require explicit specialization. See llbutton.cpp for an example. #ifndef LLVIEW_CPP extern template class LLView* LLView::getChild<class LLView>( - const std::string& name, BOOL recurse) const; + const std::string& name, bool recurse) const; #endif #endif //LL_LLVIEW_H diff --git a/indra/llui/llviewborder.cpp b/indra/llui/llviewborder.cpp index 47cc57e42f..c1777c972c 100644 --- a/indra/llui/llviewborder.cpp +++ b/indra/llui/llviewborder.cpp @@ -63,7 +63,7 @@ LLViewBorder::Params::Params() LLViewBorder::LLViewBorder(const LLViewBorder::Params& p) : LLView(p), mTexture( NULL ), - mHasKeyboardFocus( FALSE ), + mHasKeyboardFocus( false ), mBorderWidth(p.border_thickness), mHighlightLight(p.highlight_light_color()), mHighlightDark(p.highlight_dark_color()), @@ -114,7 +114,7 @@ void LLViewBorder::draw() } else { - llassert( FALSE ); // not implemented + llassert( false ); // not implemented } } @@ -239,7 +239,7 @@ void LLViewBorder::drawTwoPixelLines() gl_line_2d(left+1, bottom+1, right-1, bottom+1); } -BOOL LLViewBorder::getBevelFromAttribute(LLXMLNodePtr node, LLViewBorder::EBevel& bevel_style) +bool LLViewBorder::getBevelFromAttribute(LLXMLNodePtr node, LLViewBorder::EBevel& bevel_style) { if (node->hasAttribute("bevel_style")) { @@ -263,8 +263,8 @@ BOOL LLViewBorder::getBevelFromAttribute(LLXMLNodePtr node, LLViewBorder::EBevel { bevel_style = LLViewBorder::BEVEL_BRIGHT; } - return TRUE; + return true; } - return FALSE; + return false; } diff --git a/indra/llui/llviewborder.h b/indra/llui/llviewborder.h index 2ee25fff1a..be499bb534 100644 --- a/indra/llui/llviewborder.h +++ b/indra/llui/llviewborder.h @@ -66,12 +66,12 @@ protected: public: virtual void setValue(const LLSD& val) { setRect(LLRect(val)); } - virtual BOOL isCtrl() const { return FALSE; } + virtual bool isCtrl() const { return false; } // llview functionality virtual void draw(); - static BOOL getBevelFromAttribute(LLXMLNodePtr node, LLViewBorder::EBevel& bevel_style); + static bool getBevelFromAttribute(LLXMLNodePtr node, LLViewBorder::EBevel& bevel_style); void setBorderWidth(S32 width) { mBorderWidth = width; } S32 getBorderWidth() const { return mBorderWidth; } @@ -87,7 +87,7 @@ public: EStyle getStyle() const { return mStyle; } - void setKeyboardFocusHighlight( BOOL b ) { mHasKeyboardFocus = b; } + void setKeyboardFocusHighlight( bool b ) { mHasKeyboardFocus = b; } private: void drawOnePixelLines(); @@ -103,7 +103,7 @@ private: LLUIColor mBackgroundColor; S32 mBorderWidth; LLPointer<LLUIImage> mTexture; - BOOL mHasKeyboardFocus; + bool mHasKeyboardFocus; }; #endif // LL_LLVIEWBORDER_H diff --git a/indra/llui/llviewereventrecorder.cpp b/indra/llui/llviewereventrecorder.cpp index 8154a98b85..1bf3e3c43b 100644 --- a/indra/llui/llviewereventrecorder.cpp +++ b/indra/llui/llviewereventrecorder.cpp @@ -124,7 +124,7 @@ void LLViewerEventRecorder::updateMouseEventInfo(S32 local_x, S32 local_y, S32 g LL_DEBUGS() << "LLViewerEventRecorder::updateMouseEventInfo after updatemouseeventinfo - local_x|global x "<< this->local_x << " " << this->global_x << "local/global y " << this->local_y << " " << this->global_y << " mname: " << mName << " xui: " << xui << LL_ENDL; } -void LLViewerEventRecorder::logVisibilityChange(std::string xui, std::string name, BOOL visibility, std::string event_subtype) { +void LLViewerEventRecorder::logVisibilityChange(std::string xui, std::string name, bool visibility, std::string event_subtype) { LLSD event=LLSD::emptyMap(); diff --git a/indra/llui/llviewereventrecorder.h b/indra/llui/llviewereventrecorder.h index 8c41d306ca..9e752e8090 100644 --- a/indra/llui/llviewereventrecorder.h +++ b/indra/llui/llviewereventrecorder.h @@ -55,7 +55,7 @@ public: void logKeyEvent(KEY key, MASK mask); void logKeyUnicodeEvent(llwchar uni_char); - void logVisibilityChange(std::string xui, std::string name, BOOL visibility, std::string event_subtype); + void logVisibilityChange(std::string xui, std::string name, bool visibility, std::string event_subtype); void clear_xui(); std::string get_xui(); diff --git a/indra/llui/llviewquery.cpp b/indra/llui/llviewquery.cpp index 8f9d05d57e..4835a60e77 100644 --- a/indra/llui/llviewquery.cpp +++ b/indra/llui/llviewquery.cpp @@ -34,12 +34,12 @@ void LLQuerySorter::sort(LLView * parent, viewList_t &children) const {} filterResult_t LLLeavesFilter::operator() (const LLView* const view, const viewList_t & children) const { - return filterResult_t(children.empty(), TRUE); + return filterResult_t(children.empty(), true); } filterResult_t LLRootsFilter::operator() (const LLView* const view, const viewList_t & children) const { - return filterResult_t(TRUE, FALSE); + return filterResult_t(true, false); } filterResult_t LLVisibleFilter::operator() (const LLView* const view, const viewList_t & children) const @@ -58,7 +58,7 @@ filterResult_t LLTabStopFilter::operator() (const LLView* const view, const view filterResult_t LLCtrlFilter::operator() (const LLView* const view, const viewList_t & children) const { - return filterResult_t(view->isCtrl(),TRUE); + return filterResult_t(view->isCtrl(),true); } // @@ -79,7 +79,7 @@ viewList_t LLViewQuery::run(LLView* view) const } viewList_t filtered_children; - filterResult_t post(TRUE, TRUE); + filterResult_t post(true, true); if(pre.second) { // run filters on children @@ -123,7 +123,7 @@ void LLViewQuery::filterChildren(LLView* parent_view, viewList_t & filtered_chil filterResult_t LLViewQuery::runFilters(LLView * view, const viewList_t children, const filterList_t filters) const { - filterResult_t result = filterResult_t(TRUE, TRUE); + filterResult_t result = filterResult_t(true, true); for(filterList_const_iter_t iter = filters.begin(); iter != filters.end(); iter++) diff --git a/indra/llui/llviewquery.h b/indra/llui/llviewquery.h index 2fc7fc476a..c03a15e8f9 100644 --- a/indra/llui/llviewquery.h +++ b/indra/llui/llviewquery.h @@ -35,7 +35,7 @@ class LLView; typedef std::list<LLView *> viewList_t; -typedef std::pair<BOOL, BOOL> filterResult_t; +typedef std::pair<bool, bool> filterResult_t; // Abstract base class for all query filters. class LLQueryFilter @@ -93,7 +93,7 @@ class LLWidgetTypeFilter : public LLQueryFilter { /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const { - return filterResult_t(dynamic_cast<const T*>(view) != NULL, TRUE); + return filterResult_t(dynamic_cast<const T*>(view) != NULL, true); } }; diff --git a/indra/llui/llvirtualtrackball.cpp b/indra/llui/llvirtualtrackball.cpp index deb357cd9f..8166afc89b 100644 --- a/indra/llui/llvirtualtrackball.cpp +++ b/indra/llui/llvirtualtrackball.cpp @@ -165,9 +165,9 @@ LLVirtualTrackball::~LLVirtualTrackball() { } -BOOL LLVirtualTrackball::postBuild() +bool LLVirtualTrackball::postBuild() { - return TRUE; + return true; } @@ -233,7 +233,7 @@ void LLVirtualTrackball::draw() } // hide the direction labels when disabled - BOOL enabled = isInEnabledChain(); + bool enabled = isInEnabledChain(); mLabelN->setVisible(enabled); mLabelE->setVisible(enabled); mLabelS->setVisible(enabled); @@ -384,7 +384,7 @@ void LLVirtualTrackball::getAzimuthAndElevationDeg(const LLQuaternion &quat, F32 elevation *= RAD_TO_DEG; } -BOOL LLVirtualTrackball::handleHover(S32 x, S32 y, MASK mask) +bool LLVirtualTrackball::handleHover(S32 x, S32 y, MASK mask) { if (hasMouseCapture()) { @@ -413,7 +413,7 @@ BOOL LLVirtualTrackball::handleHover(S32 x, S32 y, MASK mask) { // set on click mode if (!pointInTouchCircle(x, y)) { - return TRUE; // don't drag outside the circle + return true; // don't drag outside the circle } F32 radius = mTouchArea->getRect().getWidth() / 2; @@ -453,10 +453,10 @@ BOOL LLVirtualTrackball::handleHover(S32 x, S32 y, MASK mask) mPrevY = y; onCommit(); } - return TRUE; + return true; } -BOOL LLVirtualTrackball::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLVirtualTrackball::handleMouseUp(S32 x, S32 y, MASK mask) { if (hasMouseCapture()) { @@ -468,7 +468,7 @@ BOOL LLVirtualTrackball::handleMouseUp(S32 x, S32 y, MASK mask) return LLView::handleMouseUp(x, y, mask); } -BOOL LLVirtualTrackball::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLVirtualTrackball::handleMouseDown(S32 x, S32 y, MASK mask) { if (pointInTouchCircle(x, y)) { @@ -481,7 +481,7 @@ BOOL LLVirtualTrackball::handleMouseDown(S32 x, S32 y, MASK mask) return LLView::handleMouseDown(x, y, mask); } -BOOL LLVirtualTrackball::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLVirtualTrackball::handleRightMouseDown(S32 x, S32 y, MASK mask) { if (pointInTouchCircle(x, y)) { @@ -491,26 +491,26 @@ BOOL LLVirtualTrackball::handleRightMouseDown(S32 x, S32 y, MASK mask) return LLView::handleRightMouseDown(x, y, mask); } -BOOL LLVirtualTrackball::handleKeyHere(KEY key, MASK mask) +bool LLVirtualTrackball::handleKeyHere(KEY key, MASK mask) { - BOOL handled = FALSE; + bool handled = false; switch (key) { case KEY_DOWN: onRotateTopClick(); - handled = TRUE; + handled = true; break; case KEY_LEFT: onRotateRightClick(); - handled = TRUE; + handled = true; break; case KEY_UP: onRotateBottomClick(); - handled = TRUE; + handled = true; break; case KEY_RIGHT: onRotateLeftClick(); - handled = TRUE; + handled = true; break; default: break; diff --git a/indra/llui/llvirtualtrackball.h b/indra/llui/llvirtualtrackball.h index 5eb9b548e5..61a78b2398 100644 --- a/indra/llui/llvirtualtrackball.h +++ b/indra/llui/llvirtualtrackball.h @@ -79,13 +79,13 @@ public: virtual ~LLVirtualTrackball(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleKeyHere(KEY key, MASK mask); + virtual bool handleHover(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleRightMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleKeyHere(KEY key, MASK mask); virtual void draw(); diff --git a/indra/llui/llxuiparser.cpp b/indra/llui/llxuiparser.cpp index 0d3819ff5c..8fd85a89a1 100644 --- a/indra/llui/llxuiparser.cpp +++ b/indra/llui/llxuiparser.cpp @@ -365,7 +365,7 @@ void LLXSDWriter::writeXSD(const std::string& type_name, LLXMLNodePtr node, cons // duplicate element choices LLXMLNodeList children; - mElementNode->getChildren("xs:element", children, FALSE); + mElementNode->getChildren("xs:element", children, false); for (LLXMLNodeList::iterator child_it = children.begin(); child_it != children.end(); ++child_it) { LLXMLNodePtr child_copy = child_it->second->deepCopy(); @@ -930,10 +930,10 @@ bool LLXUIParser::writeFlag(Parser& parser, const void* val_ptr, name_stack_t& s bool LLXUIParser::readBoolValue(Parser& parser, void* val_ptr) { - S32 value; + bool value; LLXUIParser& self = static_cast<LLXUIParser&>(parser); bool success = self.mCurReadNode->getBoolValue(1, &value); - *((bool*)val_ptr) = (value != FALSE); + *((bool*)val_ptr) = value; return success; } @@ -1426,7 +1426,7 @@ bool LLSimpleXUIParser::readXUI(const std::string& filename, LLInitParam::BaseBl mEmptyLeafNode.push_back(false); - if( !XML_ParseBuffer(mParser, bytes_read, TRUE ) ) + if( !XML_ParseBuffer(mParser, bytes_read, true ) ) { LL_WARNS("ReadXUI") << "Error while parsing file " << filename << LL_ENDL; XML_ParserFree( mParser ); diff --git a/indra/llui/llxyvector.cpp b/indra/llui/llxyvector.cpp index 9fc31488a5..19bd8465b9 100644 --- a/indra/llui/llxyvector.cpp +++ b/indra/llui/llxyvector.cpp @@ -66,7 +66,7 @@ LLXYVector::Params::Params() ghost_color("ghost_color"), area_color("area_color", LLColor4::grey4), grid_color("grid_color", LLColor4::grey % 0.25f), - logarithmic("logarithmic", FALSE) + logarithmic("logarithmic", false) { } @@ -142,12 +142,12 @@ LLXYVector::~LLXYVector() { } -BOOL LLXYVector::postBuild() +bool LLXYVector::postBuild() { mLogScaleX = (2 * log(mMaxValueX)) / mTouchArea->getRect().getWidth(); mLogScaleY = (2 * log(mMaxValueY)) / mTouchArea->getRect().getHeight(); - return TRUE; + return true; } void drawArrow(S32 tailX, S32 tailY, S32 tipX, S32 tipY, LLColor4 color) @@ -275,7 +275,7 @@ void LLXYVector::update() mYEntry->setValue(mValueY); } -BOOL LLXYVector::handleHover(S32 x, S32 y, MASK mask) +bool LLXYVector::handleHover(S32 x, S32 y, MASK mask) { if (hasMouseCapture()) { @@ -298,10 +298,10 @@ BOOL LLXYVector::handleHover(S32 x, S32 y, MASK mask) } } - return TRUE; + return true; } -BOOL LLXYVector::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLXYVector::handleMouseUp(S32 x, S32 y, MASK mask) { if (hasMouseCapture()) { @@ -311,7 +311,7 @@ BOOL LLXYVector::handleMouseUp(S32 x, S32 y, MASK mask) if (mTouchArea->getRect().pointInRect(x, y)) { - return TRUE; + return true; } else { @@ -319,7 +319,7 @@ BOOL LLXYVector::handleMouseUp(S32 x, S32 y, MASK mask) } } -BOOL LLXYVector::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLXYVector::handleMouseDown(S32 x, S32 y, MASK mask) { if (mTouchArea->getRect().pointInRect(x, y)) @@ -327,7 +327,7 @@ BOOL LLXYVector::handleMouseDown(S32 x, S32 y, MASK mask) gFocusMgr.setMouseCapture(this); make_ui_sound("UISndClick"); - return TRUE; + return true; } else { diff --git a/indra/llui/llxyvector.h b/indra/llui/llxyvector.h index 6bebf347e8..bc41213c13 100644 --- a/indra/llui/llxyvector.h +++ b/indra/llui/llxyvector.h @@ -59,18 +59,18 @@ public: Optional<LLUIColor> ghost_color; Optional<LLUIColor> area_color; Optional<LLUIColor> grid_color; - Optional<BOOL> logarithmic; + Optional<bool> logarithmic; Params(); }; virtual ~LLXYVector(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleHover(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); virtual void draw(); @@ -113,7 +113,7 @@ private: LLUIColor mAreaColor; LLUIColor mGridColor; - BOOL mLogarithmic; + bool mLogarithmic; F32 mLogScaleX; F32 mLogScaleY; }; diff --git a/indra/llui/tests/llurlentry_test.cpp b/indra/llui/tests/llurlentry_test.cpp index 729b983e79..088cdd675b 100644 --- a/indra/llui/tests/llurlentry_test.cpp +++ b/indra/llui/tests/llurlentry_test.cpp @@ -58,7 +58,7 @@ typedef std::map<std::string, LLControlGroup*> settings_map_t; settings_map_t LLUI::sSettingGroups; -BOOL LLControlGroup::getBOOL(const std::string& name) +bool LLControlGroup::getBOOL(const std::string& name) { return false; } diff --git a/indra/llwindow/lldragdropwin32.cpp b/indra/llwindow/lldragdropwin32.cpp index b164eb9579..15490ef953 100644 --- a/indra/llwindow/lldragdropwin32.cpp +++ b/indra/llwindow/lldragdropwin32.cpp @@ -124,7 +124,7 @@ class LLDragDropWin32Target: ScreenToClient( mAppWindowHandle, &pt2 ); LLCoordWindow cursor_coord_window( pt2.x, pt2.y ); - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); LLWindowCallbacks::DragNDropResult result = window_imp->completeDragNDropRequest( cursor_coord_window.convert(), mask, LLWindowCallbacks::DNDA_START_TRACKING, mDropUrl ); @@ -179,7 +179,7 @@ class LLDragDropWin32Target: ScreenToClient( mAppWindowHandle, &pt2 ); LLCoordWindow cursor_coord_window( pt2.x, pt2.y ); - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); LLWindowCallbacks::DragNDropResult result = window_imp->completeDragNDropRequest( cursor_coord_window.convert(), mask, LLWindowCallbacks::DNDA_TRACK, mDropUrl ); @@ -219,7 +219,7 @@ class LLDragDropWin32Target: if (NULL != window_imp) { LLCoordGL gl_coord( 0, 0 ); - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); window_imp->completeDragNDropRequest( gl_coord, mask, LLWindowCallbacks::DNDA_STOP_TRACKING, mDropUrl ); }; return S_OK; @@ -249,7 +249,7 @@ class LLDragDropWin32Target: LL_INFOS() << LL_ENDL; // no keyboard modifier option yet but we could one day - MASK mask = gKeyboard->currentMask( TRUE ); + MASK mask = gKeyboard->currentMask( true ); // actually do the drop LLWindowCallbacks::DragNDropResult result = window_imp->completeDragNDropRequest( gl_coord, mask, @@ -312,7 +312,7 @@ LLDragDropWin32::~LLDragDropWin32() bool LLDragDropWin32::init( HWND hWnd ) { if ( NOERROR != OleInitialize( NULL ) ) - return FALSE; + return false; mDropTarget = new LLDragDropWin32Target( hWnd ); if ( mDropTarget ) diff --git a/indra/llwindow/lldxhardware.cpp b/indra/llwindow/lldxhardware.cpp index f972e8f628..d916d95713 100644 --- a/indra/llwindow/lldxhardware.cpp +++ b/indra/llwindow/lldxhardware.cpp @@ -216,7 +216,7 @@ HRESULT GetVideoMemoryViaWMI(WCHAR* strInputDeviceID, DWORD* pdwAdapterRam) } //static -S32 LLDXHardware::getMBVideoMemoryViaWMI() +U32 LLDXHardware::getMBVideoMemoryViaWMI() { DWORD vram = 0; if (SUCCEEDED(GetVideoMemoryViaWMI(NULL, &vram))) @@ -454,10 +454,10 @@ void get_wstring(IDxDiagContainer* containerp, WCHAR* wszPropName, WCHAR* wszPro switch( var.vt ) { case VT_UI4: - swprintf( wszPropValue, L"%d", var.ulVal ); /* Flawfinder: ignore */ + swprintf( wszPropValue, outputSize, L"%d", var.ulVal ); /* Flawfinder: ignore */ break; case VT_I4: - swprintf( wszPropValue, L"%d", var.lVal ); /* Flawfinder: ignore */ + swprintf( wszPropValue, outputSize, L"%d", var.lVal ); /* Flawfinder: ignore */ break; case VT_BOOL: wcscpy( wszPropValue, (var.boolVal) ? L"true" : L"false" ); /* Flawfinder: ignore */ @@ -483,7 +483,7 @@ std::string get_string(IDxDiagContainer *containerp, WCHAR *wszPropName) LLVersion::LLVersion() { - mValid = FALSE; + mValid = false; S32 i; for (i = 0; i < 4; i++) { @@ -491,7 +491,7 @@ LLVersion::LLVersion() } } -BOOL LLVersion::set(const std::string &version_string) +bool LLVersion::set(const std::string &version_string) { S32 i; for (i = 0; i < 4; i++) @@ -518,11 +518,11 @@ BOOL LLVersion::set(const std::string &version_string) { mFields[i] = 0; } - mValid = FALSE; + mValid = false; } else { - mValid = TRUE; + mValid = true; } return mValid; } @@ -678,10 +678,10 @@ LLDXDevice *LLDXHardware::findDevice(const std::string &vendor, const std::strin } */ -BOOL LLDXHardware::getInfo(BOOL vram_only) +bool LLDXHardware::getInfo(bool vram_only) { LLTimer hw_timer; - BOOL ok = FALSE; + bool ok = false; HRESULT hr; // CLSID_DxDiagProvider does not work with Multithreaded? @@ -809,7 +809,7 @@ BOOL LLDXHardware::getInfo(BOOL vram_only) if (vram_only) { - ok = TRUE; + ok = true; goto LCleanup; } @@ -869,7 +869,7 @@ BOOL LLDXHardware::getInfo(BOOL vram_only) tokenizer::iterator iter = tokens.begin(); S32 count = 0; - BOOL valid = TRUE; + bool valid = true; for (;(iter != tokens.end()) && (count < 3);++iter) { switch (count) @@ -877,7 +877,7 @@ BOOL LLDXHardware::getInfo(BOOL vram_only) case 0: if (strcmp(iter->c_str(), "PCI")) { - valid = FALSE; + valid = false; } break; case 1: @@ -948,7 +948,7 @@ BOOL LLDXHardware::getInfo(BOOL vram_only) } // dumpDevices(); - ok = TRUE; + ok = true; LCleanup: if (!ok) diff --git a/indra/llwindow/lldxhardware.h b/indra/llwindow/lldxhardware.h index 12273e97bc..2b879e021c 100644 --- a/indra/llwindow/lldxhardware.h +++ b/indra/llwindow/lldxhardware.h @@ -37,12 +37,12 @@ class LLVersion { public: LLVersion(); - BOOL set(const std::string &version_string); + bool set(const std::string &version_string); S32 getField(const S32 field_num); protected: std::string mVersionString; S32 mFields[4]; - BOOL mValid; + bool mValid; }; class LLDXDriverFile @@ -84,9 +84,9 @@ public: void setWriteDebugFunc(void (*func)(const char*)); void cleanup(); - // Returns TRUE on success. - // vram_only TRUE does a "light" probe. - BOOL getInfo(BOOL vram_only); + // Returns true on success. + // vram_only true does a "light" probe. + bool getInfo(bool vram_only); // WMI can return multiple GPU drivers // specify which one to output @@ -104,7 +104,7 @@ public: // Will get memory of best GPU in MB, return memory on sucsess, 0 on failure // Note: WMI is not accurate in some cases - static S32 getMBVideoMemoryViaWMI(); + static U32 getMBVideoMemoryViaWMI(); // Find a particular device that matches the following specs. // Empty strings indicate that you don't care. diff --git a/indra/llwindow/llkeyboard.cpp b/indra/llwindow/llkeyboard.cpp index d4b0743f32..d76a90e98a 100644 --- a/indra/llwindow/llkeyboard.cpp +++ b/indra/llwindow/llkeyboard.cpp @@ -54,10 +54,10 @@ LLKeyboard::LLKeyboard() : mCallbacks(NULL) for (i = 0; i < KEY_COUNT; i++) { mKeyLevelFrameCount[i] = 0; - mKeyLevel[i] = FALSE; - mKeyUp[i] = FALSE; - mKeyDown[i] = FALSE; - mKeyRepeated[i] = FALSE; + mKeyLevel[i] = false; + mKeyUp[i] = false; + mKeyDown[i] = false; + mKeyRepeated[i] = false; } mInsertMode = LL_KIM_INSERT; @@ -149,14 +149,14 @@ void LLKeyboard::addKeyName(KEY key, const std::string& name) void LLKeyboard::resetKeyDownAndHandle() { - MASK mask = currentMask(FALSE); + MASK mask = currentMask(false); for (S32 i = 0; i < KEY_COUNT; i++) { if (mKeyLevel[i]) { - mKeyDown[i] = FALSE; - mKeyLevel[i] = FALSE; - mKeyUp[i] = TRUE; + mKeyDown[i] = false; + mKeyLevel[i] = false; + mKeyUp[i] = true; mCurTranslatedKey = (KEY)i; mCallbacks->handleTranslatedKeyUp(i, mask); } @@ -173,28 +173,28 @@ void LLKeyboard::resetKeys() { if( mKeyLevel[i] ) { - mKeyLevel[i] = FALSE; + mKeyLevel[i] = false; } } for (i = 0; i < KEY_COUNT; i++) { - mKeyUp[i] = FALSE; + mKeyUp[i] = false; } for (i = 0; i < KEY_COUNT; i++) { - mKeyDown[i] = FALSE; + mKeyDown[i] = false; } for (i = 0; i < KEY_COUNT; i++) { - mKeyRepeated[i] = FALSE; + mKeyRepeated[i] = false; } } -BOOL LLKeyboard::translateKey(const NATIVE_KEY_TYPE os_key, KEY *out_key) +bool LLKeyboard::translateKey(const NATIVE_KEY_TYPE os_key, KEY *out_key) { // Only translate keys in the map, ignore all other keys for now @@ -203,12 +203,12 @@ BOOL LLKeyboard::translateKey(const NATIVE_KEY_TYPE os_key, KEY *out_key) { //LL_WARNS() << "Unknown virtual key " << os_key << LL_ENDL; *out_key = 0; - return FALSE; + return false; } else { *out_key = iter->second; - return TRUE; + return true; } } @@ -226,47 +226,47 @@ LLKeyboard::NATIVE_KEY_TYPE LLKeyboard::inverseTranslateKey(const KEY translated } -BOOL LLKeyboard::handleTranslatedKeyDown(KEY translated_key, U32 translated_mask) +bool LLKeyboard::handleTranslatedKeyDown(KEY translated_key, U32 translated_mask) { - BOOL handled = FALSE; - BOOL repeated = FALSE; + bool handled = false; + bool repeated = false; // is this the first time the key went down? // if so, generate "character" message if( !mKeyLevel[translated_key] ) { - mKeyLevel[translated_key] = TRUE; + mKeyLevel[translated_key] = true; mKeyLevelTimer[translated_key].reset(); mKeyLevelFrameCount[translated_key] = 0; - mKeyRepeated[translated_key] = FALSE; + mKeyRepeated[translated_key] = false; } else { // Level is already down, assume it's repeated. - repeated = TRUE; - mKeyRepeated[translated_key] = TRUE; + repeated = true; + mKeyRepeated[translated_key] = true; } - mKeyDown[translated_key] = TRUE; + mKeyDown[translated_key] = true; mCurTranslatedKey = (KEY)translated_key; handled = mCallbacks->handleTranslatedKeyDown(translated_key, translated_mask, repeated); return handled; } -BOOL LLKeyboard::handleTranslatedKeyUp(KEY translated_key, U32 translated_mask) +bool LLKeyboard::handleTranslatedKeyUp(KEY translated_key, U32 translated_mask) { - BOOL handled = FALSE; + bool handled = false; if( mKeyLevel[translated_key] ) { - mKeyLevel[translated_key] = FALSE; + mKeyLevel[translated_key] = false; // Only generate key up events if the key is thought to // be down. This allows you to call resetKeys() in the // middle of a frame and ignore subsequent KEY_UP // messages in the same frame. This was causing the // sequence W<return> in chat to move agents forward. JC - mKeyUp[translated_key] = TRUE; + mKeyUp[translated_key] = true; handled = mCallbacks->handleTranslatedKeyUp(translated_key, translated_mask); } @@ -302,14 +302,14 @@ S32 LLKeyboard::getKeyElapsedFrameCount(KEY key) } // static -BOOL LLKeyboard::keyFromString(const std::string& str, KEY *key) +bool LLKeyboard::keyFromString(const std::string& str, KEY *key) { std::string instring(str); size_t length = instring.size(); if (length < 1) { - return FALSE; + return false; } if (length == 1) { @@ -322,7 +322,7 @@ BOOL LLKeyboard::keyFromString(const std::string& str, KEY *key) ('{' <= ch && ch <= '~')) // {|}~ { *key = ch; - return TRUE; + return true; } } @@ -331,10 +331,10 @@ BOOL LLKeyboard::keyFromString(const std::string& str, KEY *key) if (res != 0) { *key = res; - return TRUE; + return true; } LL_WARNS() << "keyFromString failed: " << str << LL_ENDL; - return FALSE; + return false; } @@ -482,52 +482,52 @@ std::string LLKeyboard::stringFromAccelerator(MASK accel_mask, EMouseClickType c } //static -BOOL LLKeyboard::maskFromString(const std::string& str, MASK *mask) +bool LLKeyboard::maskFromString(const std::string& str, MASK *mask) { std::string instring(str); if (instring == "NONE") { *mask = MASK_NONE; - return TRUE; + return true; } else if (instring == "SHIFT") { *mask = MASK_SHIFT; - return TRUE; + return true; } else if (instring == "CTL") { *mask = MASK_CONTROL; - return TRUE; + return true; } else if (instring == "ALT") { *mask = MASK_ALT; - return TRUE; + return true; } else if (instring == "CTL_SHIFT") { *mask = MASK_CONTROL | MASK_SHIFT; - return TRUE; + return true; } else if (instring == "ALT_SHIFT") { *mask = MASK_ALT | MASK_SHIFT; - return TRUE; + return true; } else if (instring == "CTL_ALT") { *mask = MASK_CONTROL | MASK_ALT; - return TRUE; + return true; } else if (instring == "CTL_ALT_SHIFT") { *mask = MASK_CONTROL | MASK_ALT | MASK_SHIFT; - return TRUE; + return true; } else { - return FALSE; + return false; } } diff --git a/indra/llwindow/llkeyboard.h b/indra/llwindow/llkeyboard.h index 2800b9fb60..83ce6e5b04 100644 --- a/indra/llwindow/llkeyboard.h +++ b/indra/llwindow/llkeyboard.h @@ -69,19 +69,19 @@ public: F32 getCurKeyElapsedTime() { return getKeyDown(mCurScanKey) ? getKeyElapsedTime( mCurScanKey ) : 0.f; } F32 getCurKeyElapsedFrameCount() { return getKeyDown(mCurScanKey) ? (F32)getKeyElapsedFrameCount( mCurScanKey ) : 0.f; } - BOOL getKeyDown(const KEY key) { return mKeyLevel[key]; } - BOOL getKeyRepeated(const KEY key) { return mKeyRepeated[key]; } + bool getKeyDown(const KEY key) { return mKeyLevel[key]; } + bool getKeyRepeated(const KEY key) { return mKeyRepeated[key]; } - BOOL translateKey(const NATIVE_KEY_TYPE os_key, KEY *translated_key); + bool translateKey(const NATIVE_KEY_TYPE os_key, KEY *translated_key); NATIVE_KEY_TYPE inverseTranslateKey(const KEY translated_key); - BOOL handleTranslatedKeyUp(KEY translated_key, U32 translated_mask); // Translated into "Linden" keycodes - BOOL handleTranslatedKeyDown(KEY translated_key, U32 translated_mask); // Translated into "Linden" keycodes + bool handleTranslatedKeyUp(KEY translated_key, U32 translated_mask); // Translated into "Linden" keycodes + bool handleTranslatedKeyDown(KEY translated_key, U32 translated_mask); // Translated into "Linden" keycodes - virtual BOOL handleKeyUp(const NATIVE_KEY_TYPE key, MASK mask) = 0; - virtual BOOL handleKeyDown(const NATIVE_KEY_TYPE key, MASK mask) = 0; + virtual bool handleKeyUp(const NATIVE_KEY_TYPE key, MASK mask) = 0; + virtual bool handleKeyDown(const NATIVE_KEY_TYPE key, MASK mask) = 0; #if defined(LL_DARWIN) && !defined(LL_SDL) - // We only actually use this for OS X. + // We only actually use this for macOS. virtual void handleModifier(MASK mask) = 0; #endif // LL_DARWIN @@ -91,14 +91,14 @@ public: virtual void scanKeyboard() = 0; // scans keyboard, calls functions as necessary // Mac must differentiate between Command = Control for keyboard events // and Command != Control for mouse events. - virtual MASK currentMask(BOOL for_mouse_event) = 0; + virtual MASK currentMask(bool for_mouse_event) = 0; virtual KEY currentKey() { return mCurTranslatedKey; } EKeyboardInsertMode getInsertMode() { return mInsertMode; } void toggleInsertMode(); - static BOOL maskFromString(const std::string& str, MASK *mask); // False on failure - static BOOL keyFromString(const std::string& str, KEY *key); // False on failure + static bool maskFromString(const std::string& str, MASK *mask); // False on failure + static bool keyFromString(const std::string& str, KEY *key); // False on failure static std::string stringFromKey(KEY key, bool translate = true); static std::string stringFromMouse(EMouseClickType click, bool translate = true); static std::string stringFromAccelerator( MASK accel_mask ); // separated for convinience, returns with "+": "Shift+" or "Shift+Alt+"... @@ -121,10 +121,10 @@ protected: LLTimer mKeyLevelTimer[KEY_COUNT]; // Time since level was set S32 mKeyLevelFrameCount[KEY_COUNT]; // Frames since level was set - BOOL mKeyLevel[KEY_COUNT]; // Levels - BOOL mKeyRepeated[KEY_COUNT]; // Key was repeated - BOOL mKeyUp[KEY_COUNT]; // Up edge - BOOL mKeyDown[KEY_COUNT]; // Down edge + bool mKeyLevel[KEY_COUNT]; // Levels + bool mKeyRepeated[KEY_COUNT]; // Key was repeated + bool mKeyUp[KEY_COUNT]; // Up edge + bool mKeyDown[KEY_COUNT]; // Down edge KEY mCurTranslatedKey; KEY mCurScanKey; // Used during the scanKeyboard() diff --git a/indra/llwindow/llkeyboardheadless.cpp b/indra/llwindow/llkeyboardheadless.cpp index 265d7e6c76..6f8c829dd5 100644 --- a/indra/llwindow/llkeyboardheadless.cpp +++ b/indra/llwindow/llkeyboardheadless.cpp @@ -38,7 +38,7 @@ void LLKeyboardHeadless::resetMaskKeys() -MASK LLKeyboardHeadless::currentMask(BOOL for_mouse_event) +MASK LLKeyboardHeadless::currentMask(bool for_mouse_event) { return MASK_NONE; } #ifdef LL_DARWIN @@ -65,8 +65,8 @@ void LLKeyboardHeadless::scanKeyboard() // Reset edges for next frame for (S32 key = 0; key < KEY_COUNT; key++) { - mKeyUp[key] = FALSE; - mKeyDown[key] = FALSE; + mKeyUp[key] = false; + mKeyDown[key] = false; if (mKeyLevel[key]) { mKeyLevelFrameCount[key]++; diff --git a/indra/llwindow/llkeyboardheadless.h b/indra/llwindow/llkeyboardheadless.h index 595f824872..439abaf25b 100644 --- a/indra/llwindow/llkeyboardheadless.h +++ b/indra/llwindow/llkeyboardheadless.h @@ -36,14 +36,14 @@ public: /*virtual*/ ~LLKeyboardHeadless() {}; #ifndef LL_SDL - /*virtual*/ BOOL handleKeyUp(const U16 key, MASK mask) { return FALSE; } - /*virtual*/ BOOL handleKeyDown(const U16 key, MASK mask) { return FALSE; } + /*virtual*/ bool handleKeyUp(const U16 key, MASK mask) { return false; } + /*virtual*/ bool handleKeyDown(const U16 key, MASK mask) { return false; } #else - /*virtual*/ BOOL handleKeyUp(const U32 key, MASK mask) { return FALSE; } - /*virtual*/ BOOL handleKeyDown(const U32 key, MASK mask) { return FALSE; } + /*virtual*/ bool handleKeyUp(const U32 key, MASK mask) { return false; } + /*virtual*/ bool handleKeyDown(const U32 key, MASK mask) { return false; } #endif /*virtual*/ void resetMaskKeys(); - /*virtual*/ MASK currentMask(BOOL for_mouse_event); + /*virtual*/ MASK currentMask(bool for_mouse_event); /*virtual*/ void scanKeyboard(); #ifdef LL_DARWIN /*virtual*/ void handleModifier(MASK mask); diff --git a/indra/llwindow/llkeyboardmacosx.cpp b/indra/llwindow/llkeyboardmacosx.cpp index a1aeb2e5e4..89ff7c6d3f 100644 --- a/indra/llwindow/llkeyboardmacosx.cpp +++ b/indra/llwindow/llkeyboardmacosx.cpp @@ -172,22 +172,22 @@ void LLKeyboardMacOSX::resetMaskKeys() if(mask & MAC_SHIFT_KEY) { - mKeyLevel[KEY_SHIFT] = TRUE; + mKeyLevel[KEY_SHIFT] = true; } if(mask & MAC_CTRL_KEY) { - mKeyLevel[KEY_CONTROL] = TRUE; + mKeyLevel[KEY_CONTROL] = true; } if(mask & MAC_ALT_KEY) { - mKeyLevel[KEY_ALT] = TRUE; + mKeyLevel[KEY_ALT] = true; } } /* -static BOOL translateKeyMac(const U16 key, const U32 mask, KEY &outKey, U32 &outMask) +static bool translateKeyMac(const U16 key, const U32 mask, KEY &outKey, U32 &outMask) { // Translate the virtual keycode into the keycodes the keyboard system expects. U16 virtualKey = (mask >> 24) & 0x0000007F; @@ -226,11 +226,11 @@ MASK LLKeyboardMacOSX::updateModifiers(const U32 mask) return out_mask; } -BOOL LLKeyboardMacOSX::handleKeyDown(const U16 key, const U32 mask) +bool LLKeyboardMacOSX::handleKeyDown(const U16 key, const U32 mask) { KEY translated_key = 0; U32 translated_mask = 0; - BOOL handled = FALSE; + bool handled = false; translated_mask = updateModifiers(mask); @@ -243,11 +243,11 @@ BOOL LLKeyboardMacOSX::handleKeyDown(const U16 key, const U32 mask) } -BOOL LLKeyboardMacOSX::handleKeyUp(const U16 key, const U32 mask) +bool LLKeyboardMacOSX::handleKeyUp(const U16 key, const U32 mask) { KEY translated_key = 0; U32 translated_mask = 0; - BOOL handled = FALSE; + bool handled = false; translated_mask = updateModifiers(mask); @@ -259,7 +259,7 @@ BOOL LLKeyboardMacOSX::handleKeyUp(const U16 key, const U32 mask) return handled; } -MASK LLKeyboardMacOSX::currentMask(BOOL for_mouse_event) +MASK LLKeyboardMacOSX::currentMask(bool for_mouse_event) { MASK result = MASK_NONE; U32 mask = getModifiers(); @@ -295,8 +295,8 @@ void LLKeyboardMacOSX::scanKeyboard() // Reset edges for next frame for (key = 0; key < KEY_COUNT; key++) { - mKeyUp[key] = FALSE; - mKeyDown[key] = FALSE; + mKeyUp[key] = false; + mKeyDown[key] = false; if (mKeyLevel[key]) { mKeyLevelFrameCount[key]++; @@ -304,7 +304,7 @@ void LLKeyboardMacOSX::scanKeyboard() } } -BOOL LLKeyboardMacOSX::translateNumpadKey( const U16 os_key, KEY *translated_key ) +bool LLKeyboardMacOSX::translateNumpadKey( const U16 os_key, KEY *translated_key ) { return translateKey(os_key, translated_key); } diff --git a/indra/llwindow/llkeyboardmacosx.h b/indra/llwindow/llkeyboardmacosx.h index d6895f684d..92ab5c9a85 100644 --- a/indra/llwindow/llkeyboardmacosx.h +++ b/indra/llwindow/llkeyboardmacosx.h @@ -44,17 +44,17 @@ public: LLKeyboardMacOSX(); /*virtual*/ ~LLKeyboardMacOSX() {}; - /*virtual*/ BOOL handleKeyUp(const U16 key, MASK mask); - /*virtual*/ BOOL handleKeyDown(const U16 key, MASK mask); + /*virtual*/ bool handleKeyUp(const U16 key, MASK mask); + /*virtual*/ bool handleKeyDown(const U16 key, MASK mask); /*virtual*/ void resetMaskKeys(); - /*virtual*/ MASK currentMask(BOOL for_mouse_event); + /*virtual*/ MASK currentMask(bool for_mouse_event); /*virtual*/ void scanKeyboard(); /*virtual*/ void handleModifier(MASK mask); protected: MASK updateModifiers(const U32 mask); - void setModifierKeyLevel( KEY key, BOOL new_state ); - BOOL translateNumpadKey( const U16 os_key, KEY *translated_key ); + void setModifierKeyLevel( KEY key, bool new_state ); + bool translateNumpadKey( const U16 os_key, KEY *translated_key ); U16 inverseTranslateNumpadKey(const KEY translated_key); private: std::map<U16, KEY> mTranslateNumpadMap; // special map for translating OS keys to numpad keys diff --git a/indra/llwindow/llkeyboardsdl.cpp b/indra/llwindow/llkeyboardsdl.cpp index cb6df9401d..72b4577276 100644 --- a/indra/llwindow/llkeyboardsdl.cpp +++ b/indra/llwindow/llkeyboardsdl.cpp @@ -162,7 +162,7 @@ void LLKeyboardSDL::resetMaskKeys() if(mask & KMOD_SHIFT) { - mKeyLevel[KEY_SHIFT] = TRUE; + mKeyLevel[KEY_SHIFT] = true; } if(mask & (KMOD_CTRL @@ -171,12 +171,12 @@ void LLKeyboardSDL::resetMaskKeys() #endif )) { - mKeyLevel[KEY_CONTROL] = TRUE; + mKeyLevel[KEY_CONTROL] = true; } if(mask & KMOD_ALT) { - mKeyLevel[KEY_ALT] = TRUE; + mKeyLevel[KEY_ALT] = true; } } @@ -234,12 +234,12 @@ static U32 adjustNativekeyFromUnhandledMask(const U32 key, const U32 mask) } -BOOL LLKeyboardSDL::handleKeyDown(const U32 key, const U32 mask) +bool LLKeyboardSDL::handleKeyDown(const U32 key, const U32 mask) { U32 adjusted_nativekey; KEY translated_key = 0; U32 translated_mask = MASK_NONE; - BOOL handled = FALSE; + bool handled = false; adjusted_nativekey = adjustNativekeyFromUnhandledMask(key, mask); @@ -254,12 +254,12 @@ BOOL LLKeyboardSDL::handleKeyDown(const U32 key, const U32 mask) } -BOOL LLKeyboardSDL::handleKeyUp(const U32 key, const U32 mask) +bool LLKeyboardSDL::handleKeyUp(const U32 key, const U32 mask) { U32 adjusted_nativekey; KEY translated_key = 0; U32 translated_mask = MASK_NONE; - BOOL handled = FALSE; + bool handled = false; adjusted_nativekey = adjustNativekeyFromUnhandledMask(key, mask); @@ -273,7 +273,7 @@ BOOL LLKeyboardSDL::handleKeyUp(const U32 key, const U32 mask) return handled; } -MASK LLKeyboardSDL::currentMask(BOOL for_mouse_event) +MASK LLKeyboardSDL::currentMask(bool for_mouse_event) { MASK result = MASK_NONE; SDL_Keymod mask = SDL_GetModState(); @@ -312,8 +312,8 @@ void LLKeyboardSDL::scanKeyboard() // Reset edges for next frame for (S32 key = 0; key < KEY_COUNT; key++) { - mKeyUp[key] = FALSE; - mKeyDown[key] = FALSE; + mKeyUp[key] = false; + mKeyDown[key] = false; if (mKeyLevel[key]) { mKeyLevelFrameCount[key]++; @@ -322,7 +322,7 @@ void LLKeyboardSDL::scanKeyboard() } -BOOL LLKeyboardSDL::translateNumpadKey( const U32 os_key, KEY *translated_key) +bool LLKeyboardSDL::translateNumpadKey( const U32 os_key, KEY *translated_key) { return translateKey(os_key, translated_key); } diff --git a/indra/llwindow/llkeyboardsdl.h b/indra/llwindow/llkeyboardsdl.h index 962ff5884b..3af098c4d1 100644 --- a/indra/llwindow/llkeyboardsdl.h +++ b/indra/llwindow/llkeyboardsdl.h @@ -38,16 +38,16 @@ public: LLKeyboardSDL(); /*virtual*/ ~LLKeyboardSDL() {}; - /*virtual*/ BOOL handleKeyUp(const U32 key, MASK mask); - /*virtual*/ BOOL handleKeyDown(const U32 key, MASK mask); + /*virtual*/ bool handleKeyUp(const U32 key, MASK mask); + /*virtual*/ bool handleKeyDown(const U32 key, MASK mask); /*virtual*/ void resetMaskKeys(); - /*virtual*/ MASK currentMask(BOOL for_mouse_event); + /*virtual*/ MASK currentMask(bool for_mouse_event); /*virtual*/ void scanKeyboard(); protected: MASK updateModifiers(const U32 mask); - void setModifierKeyLevel( KEY key, BOOL new_state ); - BOOL translateNumpadKey( const U32 os_key, KEY *translated_key ); + void setModifierKeyLevel( KEY key, bool new_state ); + bool translateNumpadKey( const U32 os_key, KEY *translated_key ); U16 inverseTranslateNumpadKey(const KEY translated_key); private: std::map<U32, KEY> mTranslateNumpadMap; // special map for translating OS keys to numpad keys diff --git a/indra/llwindow/llkeyboardwin32.cpp b/indra/llwindow/llkeyboardwin32.cpp index 4934e21d55..ec0055fe60 100644 --- a/indra/llwindow/llkeyboardwin32.cpp +++ b/indra/llwindow/llkeyboardwin32.cpp @@ -152,22 +152,22 @@ void LLKeyboardWin32::resetMaskKeys() // bit to indicate that the key is down. if (GetAsyncKeyState(VK_SHIFT) & 0x8000) { - mKeyLevel[KEY_SHIFT] = TRUE; + mKeyLevel[KEY_SHIFT] = true; } if (GetAsyncKeyState(VK_CONTROL) & 0x8000) { - mKeyLevel[KEY_CONTROL] = TRUE; + mKeyLevel[KEY_CONTROL] = true; } if (GetAsyncKeyState(VK_MENU) & 0x8000) { - mKeyLevel[KEY_ALT] = TRUE; + mKeyLevel[KEY_ALT] = true; } } -//void LLKeyboardWin32::setModifierKeyLevel( KEY key, BOOL new_state ) +//void LLKeyboardWin32::setModifierKeyLevel( KEY key, bool new_state ) //{ // if( mKeyLevel[key] != new_state ) // { @@ -191,17 +191,17 @@ MASK LLKeyboardWin32::updateModifiers() // (keydown encoded in high order bit of short) mKeyLevel[KEY_CAPSLOCK] = (GetKeyState(VK_CAPITAL) & 0x0001) != 0; // Low order bit carries the toggle state. // Get mask for keyboard events - MASK mask = currentMask(FALSE); + MASK mask = currentMask(false); return mask; } // mask is ignored, except for extended flag -- we poll the modifier keys for the other flags -BOOL LLKeyboardWin32::handleKeyDown(const U16 key, MASK mask) +bool LLKeyboardWin32::handleKeyDown(const U16 key, MASK mask) { KEY translated_key; U32 translated_mask; - BOOL handled = FALSE; + bool handled = false; translated_mask = updateModifiers(); @@ -214,11 +214,11 @@ BOOL LLKeyboardWin32::handleKeyDown(const U16 key, MASK mask) } // mask is ignored, except for extended flag -- we poll the modifier keys for the other flags -BOOL LLKeyboardWin32::handleKeyUp(const U16 key, MASK mask) +bool LLKeyboardWin32::handleKeyUp(const U16 key, MASK mask) { KEY translated_key; U32 translated_mask; - BOOL handled = FALSE; + bool handled = false; translated_mask = updateModifiers(); @@ -231,7 +231,7 @@ BOOL LLKeyboardWin32::handleKeyUp(const U16 key, MASK mask) } -MASK LLKeyboardWin32::currentMask(BOOL) +MASK LLKeyboardWin32::currentMask(bool) { MASK mask = MASK_NONE; @@ -263,8 +263,8 @@ void LLKeyboardWin32::scanKeyboard() // Reset edges for next frame for (key = 0; key < KEY_COUNT; key++) { - mKeyUp[key] = FALSE; - mKeyDown[key] = FALSE; + mKeyUp[key] = false; + mKeyDown[key] = false; if (mKeyLevel[key]) { mKeyLevelFrameCount[key]++; @@ -272,7 +272,7 @@ void LLKeyboardWin32::scanKeyboard() } } -BOOL LLKeyboardWin32::translateExtendedKey(const U16 os_key, const MASK mask, KEY *translated_key) +bool LLKeyboardWin32::translateExtendedKey(const U16 os_key, const MASK mask, KEY *translated_key) { return translateKey(os_key, translated_key); } diff --git a/indra/llwindow/llkeyboardwin32.h b/indra/llwindow/llkeyboardwin32.h index 838566d69c..d0dfc5cfdd 100644 --- a/indra/llwindow/llkeyboardwin32.h +++ b/indra/llwindow/llkeyboardwin32.h @@ -39,17 +39,17 @@ public: LLKeyboardWin32(); /*virtual*/ ~LLKeyboardWin32() {}; - /*virtual*/ BOOL handleKeyUp(const U16 key, MASK mask); - /*virtual*/ BOOL handleKeyDown(const U16 key, MASK mask); + /*virtual*/ bool handleKeyUp(const U16 key, MASK mask); + /*virtual*/ bool handleKeyDown(const U16 key, MASK mask); /*virtual*/ void resetMaskKeys(); - /*virtual*/ MASK currentMask(BOOL for_mouse_event); + /*virtual*/ MASK currentMask(bool for_mouse_event); /*virtual*/ void scanKeyboard(); - BOOL translateExtendedKey(const U16 os_key, const MASK mask, KEY *translated_key); + bool translateExtendedKey(const U16 os_key, const MASK mask, KEY *translated_key); U16 inverseTranslateExtendedKey(const KEY translated_key); protected: MASK updateModifiers(); - //void setModifierKeyLevel( KEY key, BOOL new_state ); + //void setModifierKeyLevel( KEY key, bool new_state ); private: std::map<U16, KEY> mTranslateNumpadMap; std::map<KEY, U16> mInvTranslateNumpadMap; diff --git a/indra/llwindow/llmousehandler.cpp b/indra/llwindow/llmousehandler.cpp index 62ad406967..eeceab502a 100644 --- a/indra/llwindow/llmousehandler.cpp +++ b/indra/llwindow/llmousehandler.cpp @@ -27,9 +27,9 @@ #include "llmousehandler.h" //virtual -BOOL LLMouseHandler::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down) +bool LLMouseHandler::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, bool down) { - BOOL handled = FALSE; + bool handled = false; if (down) { switch (clicktype) diff --git a/indra/llwindow/llmousehandler.h b/indra/llwindow/llmousehandler.h index dea28a0fc3..565d7bed70 100644 --- a/indra/llwindow/llmousehandler.h +++ b/indra/llwindow/llmousehandler.h @@ -47,19 +47,19 @@ public: SHOW_ALWAYS, } EShowToolTip; - virtual BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) = 0; - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) = 0; - virtual BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask) = 0; - virtual BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask) = 0; - virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) = 0; - virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask) = 0; - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) = 0; + virtual bool handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, bool down); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask) = 0; + virtual bool handleMouseUp(S32 x, S32 y, MASK mask) = 0; + virtual bool handleMiddleMouseDown(S32 x, S32 y, MASK mask) = 0; + virtual bool handleMiddleMouseUp(S32 x, S32 y, MASK mask) = 0; + virtual bool handleRightMouseDown(S32 x, S32 y, MASK mask) = 0; + virtual bool handleRightMouseUp(S32 x, S32 y, MASK mask) = 0; + virtual bool handleDoubleClick(S32 x, S32 y, MASK mask) = 0; - virtual BOOL handleHover(S32 x, S32 y, MASK mask) = 0; - virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) = 0; - virtual BOOL handleScrollHWheel(S32 x, S32 y, S32 clicks) = 0; - virtual BOOL handleToolTip(S32 x, S32 y, MASK mask) = 0; + virtual bool handleHover(S32 x, S32 y, MASK mask) = 0; + virtual bool handleScrollWheel(S32 x, S32 y, S32 clicks) = 0; + virtual bool handleScrollHWheel(S32 x, S32 y, S32 clicks) = 0; + virtual bool handleToolTip(S32 x, S32 y, MASK mask) = 0; virtual const std::string& getName() const = 0; virtual void onMouseCaptureLost() = 0; @@ -67,7 +67,7 @@ public: virtual void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const = 0; virtual void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const = 0; - virtual BOOL hasMouseCapture() = 0; + virtual bool hasMouseCapture() = 0; }; #endif diff --git a/indra/llwindow/llpreeditor.h b/indra/llwindow/llpreeditor.h index 943d70c3dd..492a3e9e88 100644 --- a/indra/llwindow/llpreeditor.h +++ b/indra/llwindow/llpreeditor.h @@ -34,7 +34,7 @@ class LLPreeditor public: typedef std::vector<S32> segment_lengths_t; - typedef std::vector<BOOL> standouts_t; + typedef std::deque<bool> standouts_t; // We don't delete against LLPreeditor, but compilers complain without this... @@ -79,7 +79,7 @@ public: // Locations are relative to the app window and measured in GL coordinate space (before scaling.) // query_position is IN argument, and other three are OUT. - virtual BOOL getPreeditLocation(S32 query_position, LLCoordGL *coord, LLRect *bounds, LLRect *control) const = 0; + virtual bool getPreeditLocation(S32 query_position, LLCoordGL *coord, LLRect *bounds, LLRect *control) const = 0; // Get the size (height) of the current font used in this preeditor. @@ -93,9 +93,9 @@ public: // Handle a UTF-32 char on this preeditor, i.e., add the character // to the contents. // This is a back door of the method of same name of LLWindowCallback. - // called_from_parent should be set to FALSE if calling through LLPreeditor. + // called_from_parent should be set to false if calling through LLPreeditor. - virtual BOOL handleUnicodeCharHere(llwchar uni_char) = 0; + virtual bool handleUnicodeCharHere(llwchar uni_char) = 0; }; #endif diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp index 6556bc09c6..325f1280b9 100644 --- a/indra/llwindow/llwindow.cpp +++ b/indra/llwindow/llwindow.cpp @@ -46,8 +46,8 @@ // Globals // LLSplashScreen *gSplashScreenp = NULL; -BOOL gDebugClicks = FALSE; -BOOL gDebugWindowProc = FALSE; +bool gDebugClicks = false; +bool gDebugWindowProc = false; const S32 gURLProtocolWhitelistCount = 5; const std::string gURLProtocolWhitelist[] = { "secondlife:", "http:", "https:", "data:", "mailto:" }; @@ -63,10 +63,10 @@ const std::string gURLProtocolWhitelist[] = { "secondlife:", "http:", "https:", S32 OSMessageBox(const std::string& text, const std::string& caption, U32 type) { // Properly hide the splash screen when displaying the message box - BOOL was_visible = FALSE; + bool was_visible = false; if (LLSplashScreen::isVisible()) { - was_visible = TRUE; + was_visible = true; LLSplashScreen::hide(); } @@ -97,9 +97,9 @@ S32 OSMessageBox(const std::string& text, const std::string& caption, U32 type) // LLWindow // -LLWindow::LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags) +LLWindow::LLWindow(LLWindowCallbacks* callbacks, bool fullscreen, U32 flags) : mCallbacks(callbacks), - mPostQuit(TRUE), + mPostQuit(true), mFullscreen(fullscreen), mFullscreenWidth(0), mFullscreenHeight(0), @@ -109,13 +109,13 @@ LLWindow::LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags) mNumSupportedResolutions(0), mCurrentCursor(UI_CURSOR_ARROW), mNextCursor(UI_CURSOR_ARROW), - mCursorHidden(FALSE), + mCursorHidden(false), mBusyCount(0), - mIsMouseClipping(FALSE), + mIsMouseClipping(false), mMinWindowWidth(0), mMinWindowHeight(0), mSwapMethod(SWAP_METHOD_UNDEFINED), - mHideCursorPermanent(FALSE), + mHideCursorPermanent(false), mFlags(flags), mHighSurrogate(0), mRefreshRate(0) @@ -127,15 +127,15 @@ LLWindow::~LLWindow() } //virtual -BOOL LLWindow::isValid() +bool LLWindow::isValid() { - return TRUE; + return true; } //virtual -BOOL LLWindow::canDelete() +bool LLWindow::canDelete() { - return TRUE; + return true; } //virtual @@ -178,9 +178,9 @@ ECursorType LLWindow::getCursor() const } //virtual -BOOL LLWindow::dialogColorPicker(F32 *r, F32 *g, F32 *b) +bool LLWindow::dialogColorPicker(F32 *r, F32 *g, F32 *b) { - return FALSE; + return false; } void *LLWindow::getMediaWindow() @@ -189,7 +189,7 @@ void *LLWindow::getMediaWindow() return getPlatformWindow(); } -BOOL LLWindow::setSize(LLCoordScreen size) +bool LLWindow::setSize(LLCoordScreen size) { if (!getMaximized()) { @@ -199,7 +199,7 @@ BOOL LLWindow::setSize(LLCoordScreen size) return setSizeImpl(size); } -BOOL LLWindow::setSize(LLCoordWindow size) +bool LLWindow::setSize(LLCoordWindow size) { //HACK: we are inconsistently using minimum window dimensions // in this case, we are constraining the inner "client" rect and other times @@ -241,19 +241,19 @@ void LLWindow::processMiscNativeEvents() } //virtual -BOOL LLWindow::isPrimaryTextAvailable() +bool LLWindow::isPrimaryTextAvailable() { - return FALSE; // no + return false; // no } //virtual -BOOL LLWindow::pasteTextFromPrimary(LLWString &dst) +bool LLWindow::pasteTextFromPrimary(LLWString &dst) { - return FALSE; // fail + return false; // fail } // virtual -BOOL LLWindow::copyTextToPrimary(const LLWString &src) +bool LLWindow::copyTextToPrimary(const LLWString &src) { - return FALSE; // fail + return false; // fail } // static @@ -336,7 +336,7 @@ void LLWindow::handleUnicodeUTF16(U16 utf16, MASK mask) // static bool LLSplashScreen::isVisible() { - return gSplashScreenp ? true: false; + return gSplashScreenp; } // static @@ -402,14 +402,13 @@ static std::set<LLWindow*> sWindowList; LLWindow* LLWindowManager::createWindow( LLWindowCallbacks* callbacks, const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, U32 flags, - BOOL fullscreen, - BOOL clearBg, - BOOL enable_vsync, - BOOL use_gl, - BOOL ignore_pixel_depth, + bool fullscreen, + bool clearBg, + bool enable_vsync, + bool use_gl, + bool ignore_pixel_depth, U32 fsaa_samples, U32 max_cores, - U32 max_vram, F32 max_gl_version) { LLWindow* new_window = nullptr; @@ -427,7 +426,7 @@ LLWindow* LLWindowManager::createWindow( #elif LL_WINDOWS new_window = new LLWindowWin32(callbacks, title, name, x, y, width, height, flags, - fullscreen, clearBg, enable_vsync, use_gl, ignore_pixel_depth, fsaa_samples, max_cores, max_vram, max_gl_version); + fullscreen, clearBg, enable_vsync, use_gl, ignore_pixel_depth, fsaa_samples, max_cores, max_gl_version); #elif LL_DARWIN new_window = new LLWindowMacOSX(callbacks, title, name, x, y, width, height, flags, @@ -441,7 +440,7 @@ LLWindow* LLWindowManager::createWindow( fullscreen, clearBg, enable_vsync, use_gl, ignore_pixel_depth); } - if (FALSE == new_window->isValid()) + if (false == new_window->isValid()) { delete new_window; LL_WARNS() << "LLWindowManager::create() : Error creating window." << LL_ENDL; @@ -451,13 +450,13 @@ LLWindow* LLWindowManager::createWindow( return new_window; } -BOOL LLWindowManager::destroyWindow(LLWindow* window) +bool LLWindowManager::destroyWindow(LLWindow* window) { if (sWindowList.find(window) == sWindowList.end()) { LL_ERRS() << "LLWindowManager::destroyWindow() : Window pointer not valid, this window doesn't exist!" << LL_ENDL; - return FALSE; + return false; } window->close(); @@ -466,10 +465,10 @@ BOOL LLWindowManager::destroyWindow(LLWindow* window) delete window; - return TRUE; + return true; } -BOOL LLWindowManager::isWindowValid(LLWindow *window) +bool LLWindowManager::isWindowValid(LLWindow *window) { return sWindowList.find(window) != sWindowList.end(); } diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index aff9334cb6..5e06e665f3 100644 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -63,21 +63,21 @@ public: virtual void show() = 0; virtual void hide() = 0; virtual void close() = 0; - virtual BOOL getVisible() = 0; - virtual BOOL getMinimized() = 0; - virtual BOOL getMaximized() = 0; - virtual BOOL maximize() = 0; + virtual bool getVisible() = 0; + virtual bool getMinimized() = 0; + virtual bool getMaximized() = 0; + virtual bool maximize() = 0; virtual void minimize() = 0; virtual void restore() = 0; - BOOL getFullscreen() { return mFullscreen; }; - virtual BOOL getPosition(LLCoordScreen *position) = 0; - virtual BOOL getSize(LLCoordScreen *size) = 0; - virtual BOOL getSize(LLCoordWindow *size) = 0; - virtual BOOL setPosition(LLCoordScreen position) = 0; - BOOL setSize(LLCoordScreen size); - BOOL setSize(LLCoordWindow size); + bool getFullscreen() { return mFullscreen; }; + virtual bool getPosition(LLCoordScreen *position) = 0; + virtual bool getSize(LLCoordScreen *size) = 0; + virtual bool getSize(LLCoordWindow *size) = 0; + virtual bool setPosition(LLCoordScreen position) = 0; + bool setSize(LLCoordScreen size); + bool setSize(LLCoordWindow size); virtual void setMinSize(U32 min_width, U32 min_height, bool enforce_immediately = true); - virtual BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL enable_vsync, const LLCoordScreen * const posp = NULL) = 0; + virtual bool switchContext(bool fullscreen, const LLCoordScreen &size, bool enable_vsync, const LLCoordScreen * const posp = NULL) = 0; //create a new GL context that shares a namespace with this Window's main GL context and make it current on the current thread // returns a pointer to be handed back to destroySharedConext/makeContextCurrent @@ -90,14 +90,14 @@ public: virtual void toggleVSync(bool enable_vsync) = 0; - virtual BOOL setCursorPosition(LLCoordWindow position) = 0; - virtual BOOL getCursorPosition(LLCoordWindow *position) = 0; + virtual bool setCursorPosition(LLCoordWindow position) = 0; + virtual bool getCursorPosition(LLCoordWindow *position) = 0; #if LL_WINDOWS - virtual BOOL getCursorDelta(LLCoordCommon* delta) = 0; + virtual bool getCursorDelta(LLCoordCommon* delta) = 0; #endif virtual void showCursor() = 0; virtual void hideCursor() = 0; - virtual BOOL isCursorHidden() = 0; + virtual bool isCursorHidden() = 0; virtual void showCursorFromMouseMove() = 0; virtual void hideCursorUntilMouseMove() = 0; @@ -124,22 +124,22 @@ public: virtual void captureMouse() = 0; virtual void releaseMouse() = 0; - virtual void setMouseClipping( BOOL b ) = 0; + virtual void setMouseClipping( bool b ) = 0; - virtual BOOL isClipboardTextAvailable() = 0; - virtual BOOL pasteTextFromClipboard(LLWString &dst) = 0; - virtual BOOL copyTextToClipboard(const LLWString &src) = 0; + virtual bool isClipboardTextAvailable() = 0; + virtual bool pasteTextFromClipboard(LLWString &dst) = 0; + virtual bool copyTextToClipboard(const LLWString &src) = 0; - virtual BOOL isPrimaryTextAvailable(); - virtual BOOL pasteTextFromPrimary(LLWString &dst); - virtual BOOL copyTextToPrimary(const LLWString &src); + virtual bool isPrimaryTextAvailable(); + virtual bool pasteTextFromPrimary(LLWString &dst); + virtual bool copyTextToPrimary(const LLWString &src); virtual void flashIcon(F32 seconds) = 0; virtual F32 getGamma() = 0; - virtual BOOL setGamma(const F32 gamma) = 0; // Set the gamma + virtual bool setGamma(const F32 gamma) = 0; // Set the gamma virtual void setFSAASamples(const U32 fsaa_samples) = 0; //set number of FSAA samples virtual U32 getFSAASamples() = 0; - virtual BOOL restoreGamma() = 0; // Restore original gamma table (before updating gamma) + virtual bool restoreGamma() = 0; // Restore original gamma table (before updating gamma) virtual ESwapMethod getSwapMethod() { return mSwapMethod; } virtual void processMiscNativeEvents(); virtual void gatherInput() = 0; @@ -151,12 +151,12 @@ public: // handy coordinate space conversion routines // NB: screen to window and vice verse won't work on width/height coordinate pairs, // as the conversion must take into account left AND right border widths, etc. - virtual BOOL convertCoords( LLCoordScreen from, LLCoordWindow *to) = 0; - virtual BOOL convertCoords( LLCoordWindow from, LLCoordScreen *to) = 0; - virtual BOOL convertCoords( LLCoordWindow from, LLCoordGL *to) = 0; - virtual BOOL convertCoords( LLCoordGL from, LLCoordWindow *to) = 0; - virtual BOOL convertCoords( LLCoordScreen from, LLCoordGL *to) = 0; - virtual BOOL convertCoords( LLCoordGL from, LLCoordScreen *to) = 0; + virtual bool convertCoords( LLCoordScreen from, LLCoordWindow *to) = 0; + virtual bool convertCoords( LLCoordWindow from, LLCoordScreen *to) = 0; + virtual bool convertCoords( LLCoordWindow from, LLCoordGL *to) = 0; + virtual bool convertCoords( LLCoordGL from, LLCoordWindow *to) = 0; + virtual bool convertCoords( LLCoordScreen from, LLCoordGL *to) = 0; + virtual bool convertCoords( LLCoordGL from, LLCoordScreen *to) = 0; // query supported resolutions virtual LLWindowResolution* getSupportedResolutions(S32 &num_resolutions) = 0; @@ -164,15 +164,12 @@ public: virtual F32 getPixelAspectRatio() = 0; virtual void setNativeAspectRatio(F32 aspect) = 0; - // query VRAM usage - virtual U32 getAvailableVRAMMegabytes() = 0; - virtual void beforeDialog() {}; // prepare to put up an OS dialog (if special measures are required, such as in fullscreen mode) virtual void afterDialog() {}; // undo whatever was done in beforeDialog() // opens system default color picker, modally - // Returns TRUE if valid color selected - virtual BOOL dialogColorPicker(F32 *r, F32 *g, F32 *b); + // Returns true if valid color selected + virtual bool dialogColorPicker(F32 *r, F32 *g, F32 *b); // return a platform-specific window reference (HWND on Windows, WindowRef on the Mac, Gtk window on Linux) virtual void *getPlatformWindow() = 0; @@ -181,7 +178,7 @@ public: virtual void *getMediaWindow(); // control platform's Language Text Input mechanisms. - virtual void allowLanguageTextInput(LLPreeditor *preeditor, BOOL b) {} + virtual void allowLanguageTextInput(LLPreeditor *preeditor, bool b) {} virtual void setLanguageTextInput( const LLCoordGL & pos ) {}; virtual void updateLanguageTextInputArea() {} virtual void interruptLanguageTextInput() {} @@ -209,21 +206,21 @@ public: virtual S32 getRefreshRate() { return mRefreshRate; } protected: - LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags); + LLWindow(LLWindowCallbacks* callbacks, bool fullscreen, U32 flags); virtual ~LLWindow(); // Defaults to true - virtual BOOL isValid(); + virtual bool isValid(); // Defaults to true - virtual BOOL canDelete(); + virtual bool canDelete(); - virtual BOOL setSizeImpl(LLCoordScreen size) = 0; - virtual BOOL setSizeImpl(LLCoordWindow size) = 0; + virtual bool setSizeImpl(LLCoordScreen size) = 0; + virtual bool setSizeImpl(LLCoordWindow size) = 0; protected: LLWindowCallbacks* mCallbacks; - BOOL mPostQuit; // should this window post a quit message when destroyed? - BOOL mFullscreen; + bool mPostQuit; // should this window post a quit message when destroyed? + bool mFullscreen; S32 mFullscreenWidth; S32 mFullscreenHeight; S32 mFullscreenBits; @@ -232,11 +229,11 @@ protected: S32 mNumSupportedResolutions; ECursorType mCurrentCursor; ECursorType mNextCursor; - BOOL mCursorHidden; + bool mCursorHidden; S32 mBusyCount; // how deep is the "cursor busy" stack? - BOOL mIsMouseClipping; // Is this window currently clipping the mouse + bool mIsMouseClipping; // Is this window currently clipping the mouse ESwapMethod mSwapMethod; - BOOL mHideCursorPermanent; + bool mHideCursorPermanent; U32 mFlags; U16 mHighSurrogate; S32 mMinWindowWidth; @@ -281,20 +278,20 @@ protected: virtual void updateImpl(const std::string& string) = 0; virtual void hideImpl() = 0; - static BOOL sVisible; + static bool sVisible; }; // Platform-neutral for accessing the platform specific message box S32 OSMessageBox(const std::string& text, const std::string& caption, U32 type); -const U32 OSMB_OK = 0; -const U32 OSMB_OKCANCEL = 1; -const U32 OSMB_YESNO = 2; +constexpr U32 OSMB_OK = 0; +constexpr U32 OSMB_OKCANCEL = 1; +constexpr U32 OSMB_YESNO = 2; -const S32 OSBTN_YES = 0; -const S32 OSBTN_NO = 1; -const S32 OSBTN_OK = 2; -const S32 OSBTN_CANCEL = 3; +constexpr S32 OSBTN_YES = 0; +constexpr S32 OSBTN_NO = 1; +constexpr S32 OSBTN_OK = 2; +constexpr S32 OSBTN_CANCEL = 3; // // LLWindowManager @@ -307,29 +304,26 @@ public: LLWindowCallbacks* callbacks, const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, U32 flags = 0, - BOOL fullscreen = FALSE, - BOOL clearBg = FALSE, - BOOL enable_vsync = FALSE, - BOOL use_gl = TRUE, - BOOL ignore_pixel_depth = FALSE, + bool fullscreen = false, + bool clearBg = false, + bool enable_vsync = false, + bool use_gl = true, + bool ignore_pixel_depth = false, U32 fsaa_samples = 0, U32 max_cores = 0, - U32 max_vram = 0, F32 max_gl_version = 4.6f); - static BOOL destroyWindow(LLWindow* window); - static BOOL isWindowValid(LLWindow *window); + static bool destroyWindow(LLWindow* window); + static bool isWindowValid(LLWindow *window); }; // // helper funcs // -extern BOOL gDebugWindowProc; +extern bool gDebugWindowProc; // Protocols, like "http" and "https" we support in URLs extern const S32 gURLProtocolWhitelistCount; extern const std::string gURLProtocolWhitelist[]; //extern const std::string gURLProtocolWhitelistHandler[]; -void simpleEscapeString ( std::string& stringIn ); - #endif // _LL_window_h_ diff --git a/indra/llwindow/llwindowcallbacks.cpp b/indra/llwindow/llwindowcallbacks.cpp index ddf913045f..624ecd5030 100644 --- a/indra/llwindow/llwindowcallbacks.cpp +++ b/indra/llwindow/llwindowcallbacks.cpp @@ -32,39 +32,39 @@ // LLWindowCallbacks // -BOOL LLWindowCallbacks::handleTranslatedKeyDown(const KEY key, const MASK mask, BOOL repeated) +bool LLWindowCallbacks::handleTranslatedKeyDown(const KEY key, const MASK mask, bool repeated) { - return FALSE; + return false; } -BOOL LLWindowCallbacks::handleTranslatedKeyUp(const KEY key, const MASK mask) +bool LLWindowCallbacks::handleTranslatedKeyUp(const KEY key, const MASK mask) { - return FALSE; + return false; } -void LLWindowCallbacks::handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level) +void LLWindowCallbacks::handleScanKey(KEY key, bool key_down, bool key_up, bool key_level) { } -BOOL LLWindowCallbacks::handleUnicodeChar(llwchar uni_char, MASK mask) +bool LLWindowCallbacks::handleUnicodeChar(llwchar uni_char, MASK mask) { - return FALSE; + return false; } -BOOL LLWindowCallbacks::handleUnicodeString(char *uni_str, bool editing) +bool LLWindowCallbacks::handleUnicodeString(char *uni_str, bool editing) { return FALSE; } -BOOL LLWindowCallbacks::handleMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask) +bool LLWindowCallbacks::handleMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask) { - return FALSE; + return false; } -BOOL LLWindowCallbacks::handleMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask) +bool LLWindowCallbacks::handleMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask) { - return FALSE; + return false; } void LLWindowCallbacks::handleMouseLeave(LLWindow *window) @@ -72,54 +72,54 @@ void LLWindowCallbacks::handleMouseLeave(LLWindow *window) return; } -BOOL LLWindowCallbacks::handleCloseRequest(LLWindow *window) +bool LLWindowCallbacks::handleCloseRequest(LLWindow *window) { //allow the window to close - return TRUE; + return true; } void LLWindowCallbacks::handleQuit(LLWindow *window) { } -BOOL LLWindowCallbacks::handleRightMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask) +bool LLWindowCallbacks::handleRightMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask) { - return FALSE; + return false; } -BOOL LLWindowCallbacks::handleRightMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask) +bool LLWindowCallbacks::handleRightMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask) { - return FALSE; + return false; } -BOOL LLWindowCallbacks::handleMiddleMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask) +bool LLWindowCallbacks::handleMiddleMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask) { - return FALSE; + return false; } -BOOL LLWindowCallbacks::handleMiddleMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask) +bool LLWindowCallbacks::handleMiddleMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask) { - return FALSE; + return false; } -BOOL LLWindowCallbacks::handleOtherMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask, S32 button) +bool LLWindowCallbacks::handleOtherMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask, S32 button) { - return FALSE; + return false; } -BOOL LLWindowCallbacks::handleOtherMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask, S32 button) +bool LLWindowCallbacks::handleOtherMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask, S32 button) { - return FALSE; + return false; } -BOOL LLWindowCallbacks::handleActivate(LLWindow *window, BOOL activated) +bool LLWindowCallbacks::handleActivate(LLWindow *window, bool activated) { - return FALSE; + return false; } -BOOL LLWindowCallbacks::handleActivateApp(LLWindow *window, BOOL activating) +bool LLWindowCallbacks::handleActivateApp(LLWindow *window, bool activating) { - return FALSE; + return false; } void LLWindowCallbacks::handleMouseMove(LLWindow *window, const LLCoordGL pos, MASK mask) @@ -155,15 +155,15 @@ void LLWindowCallbacks::handleMenuSelect(LLWindow *window, const S32 menu_item) { } -BOOL LLWindowCallbacks::handlePaint(LLWindow *window, const S32 x, const S32 y, +bool LLWindowCallbacks::handlePaint(LLWindow *window, const S32 x, const S32 y, const S32 width, const S32 height) { - return FALSE; + return false; } -BOOL LLWindowCallbacks::handleDoubleClick(LLWindow *window, const LLCoordGL pos, MASK mask) +bool LLWindowCallbacks::handleDoubleClick(LLWindow *window, const LLCoordGL pos, MASK mask) { - return FALSE; + return false; } void LLWindowCallbacks::handleWindowBlock(LLWindow *window) @@ -183,24 +183,24 @@ LLWindowCallbacks::DragNDropResult LLWindowCallbacks::handleDragNDrop(LLWindow * return LLWindowCallbacks::DND_NONE; } -BOOL LLWindowCallbacks::handleTimerEvent(LLWindow *window) +bool LLWindowCallbacks::handleTimerEvent(LLWindow *window) { - return FALSE; + return false; } -BOOL LLWindowCallbacks::handleDeviceChange(LLWindow *window) +bool LLWindowCallbacks::handleDeviceChange(LLWindow *window) { - return FALSE; + return false; } -BOOL LLWindowCallbacks::handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32 window_width, S32 window_height) +bool LLWindowCallbacks::handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32 window_width, S32 window_height) { - return FALSE; + return false; } -BOOL LLWindowCallbacks::handleWindowDidChangeScreen(LLWindow *window) +bool LLWindowCallbacks::handleWindowDidChangeScreen(LLWindow *window) { - return FALSE; + return false; } void LLWindowCallbacks::handlePingWatchdog(LLWindow *window, const char * msg) diff --git a/indra/llwindow/llwindowcallbacks.h b/indra/llwindow/llwindowcallbacks.h index b7a843e748..74660e1705 100644 --- a/indra/llwindow/llwindowcallbacks.h +++ b/indra/llwindow/llwindowcallbacks.h @@ -33,27 +33,27 @@ class LLWindowCallbacks { public: virtual ~LLWindowCallbacks() {} - virtual BOOL handleTranslatedKeyDown(KEY key, MASK mask, BOOL repeated); - virtual BOOL handleTranslatedKeyUp(KEY key, MASK mask); - virtual void handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level); - virtual BOOL handleUnicodeChar(llwchar uni_char, MASK mask); - virtual BOOL handleUnicodeString(char *uni_str, bool editing); + virtual bool handleTranslatedKeyDown(KEY key, MASK mask, bool repeated); + virtual bool handleTranslatedKeyUp(KEY key, MASK mask); + virtual void handleScanKey(KEY key, bool key_down, bool key_up, bool key_level); + virtual bool handleUnicodeChar(llwchar uni_char, MASK mask); + virtual bool handleUnicodeString(char *uni_str, bool editing); - virtual BOOL handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask); - virtual BOOL handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask); + virtual bool handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask); + virtual bool handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask); virtual void handleMouseLeave(LLWindow *window); - // return TRUE to allow window to close, which will then cause handleQuit to be called - virtual BOOL handleCloseRequest(LLWindow *window); + // return true to allow window to close, which will then cause handleQuit to be called + virtual bool handleCloseRequest(LLWindow *window); // window is about to be destroyed, clean up your business virtual void handleQuit(LLWindow *window); - virtual BOOL handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK mask); - virtual BOOL handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask); - virtual BOOL handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask); - virtual BOOL handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask); - virtual BOOL handleOtherMouseDown(LLWindow *window, LLCoordGL pos, MASK mask, S32 button); - virtual BOOL handleOtherMouseUp(LLWindow *window, LLCoordGL pos, MASK mask, S32 button); - virtual BOOL handleActivate(LLWindow *window, BOOL activated); - virtual BOOL handleActivateApp(LLWindow *window, BOOL activating); + virtual bool handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK mask); + virtual bool handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask); + virtual bool handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask); + virtual bool handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask); + virtual bool handleOtherMouseDown(LLWindow *window, LLCoordGL pos, MASK mask, S32 button); + virtual bool handleOtherMouseUp(LLWindow *window, LLCoordGL pos, MASK mask, S32 button); + virtual bool handleActivate(LLWindow *window, bool activated); + virtual bool handleActivateApp(LLWindow *window, bool activating); virtual void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask); virtual void handleMouseDragged(LLWindow *window, LLCoordGL pos, MASK mask); virtual void handleScrollWheel(LLWindow *window, S32 clicks); @@ -62,15 +62,15 @@ public: virtual void handleFocus(LLWindow *window); virtual void handleFocusLost(LLWindow *window); virtual void handleMenuSelect(LLWindow *window, S32 menu_item); - virtual BOOL handlePaint(LLWindow *window, S32 x, S32 y, S32 width, S32 height); - virtual BOOL handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK mask); // double-click of left mouse button + virtual bool handlePaint(LLWindow *window, S32 x, S32 y, S32 width, S32 height); + virtual bool handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK mask); // double-click of left mouse button virtual void handleWindowBlock(LLWindow *window); // window is taking over CPU for a while virtual void handleWindowUnblock(LLWindow *window); // window coming back after taking over CPU for a while virtual void handleDataCopy(LLWindow *window, S32 data_type, void *data); - virtual BOOL handleTimerEvent(LLWindow *window); - virtual BOOL handleDeviceChange(LLWindow *window); - virtual BOOL handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32 window_width, S32 window_height); - virtual BOOL handleWindowDidChangeScreen(LLWindow *window); + virtual bool handleTimerEvent(LLWindow *window); + virtual bool handleDeviceChange(LLWindow *window); + virtual bool handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32 window_width, S32 window_height); + virtual bool handleWindowDidChangeScreen(LLWindow *window); enum DragNDropAction { DNDA_START_TRACKING = 0,// Start tracking an incoming drag diff --git a/indra/llwindow/llwindowheadless.cpp b/indra/llwindow/llwindowheadless.cpp index bbeb710445..55e5cfd51e 100644 --- a/indra/llwindow/llwindowheadless.cpp +++ b/indra/llwindow/llwindowheadless.cpp @@ -34,8 +34,8 @@ // LLWindowHeadless // LLWindowHeadless::LLWindowHeadless(LLWindowCallbacks* callbacks, const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, - U32 flags, BOOL fullscreen, BOOL clear_background, - BOOL enable_vsync, BOOL use_gl, BOOL ignore_pixel_depth) + U32 flags, bool fullscreen, bool clear_background, + bool enable_vsync, bool use_gl, bool ignore_pixel_depth) : LLWindow(callbacks, fullscreen, flags) { // Initialize a headless keyboard. diff --git a/indra/llwindow/llwindowheadless.h b/indra/llwindow/llwindowheadless.h index af2cdb63fa..5696b69a59 100644 --- a/indra/llwindow/llwindowheadless.h +++ b/indra/llwindow/llwindowheadless.h @@ -35,10 +35,10 @@ public: /*virtual*/ void show() override {} /*virtual*/ void hide() override {} /*virtual*/ void close() override {} - /*virtual*/ BOOL getVisible() override {return FALSE;} - /*virtual*/ BOOL getMinimized() override {return FALSE;} - /*virtual*/ BOOL getMaximized() override {return FALSE;} - /*virtual*/ BOOL maximize() override {return FALSE;} + /*virtual*/ bool getVisible() override {return false;} + /*virtual*/ bool getMinimized() override {return false;} + /*virtual*/ bool getMaximized() override {return false;} + /*virtual*/ bool maximize() override {return false;} /*virtual*/ void minimize() override {} /*virtual*/ void restore() override {} // TODO: LLWindow::getFullscreen() is (intentionally?) NOT virtual. @@ -46,42 +46,42 @@ public: // mistake to shadow the base-class method with an LLWindowHeadless // override when called on the subclass, yet call the base-class method // when indirecting through a polymorphic pointer or reference? - BOOL getFullscreen() {return FALSE;} - /*virtual*/ BOOL getPosition(LLCoordScreen *position) override {return FALSE;} - /*virtual*/ BOOL getSize(LLCoordScreen *size) override {return FALSE;} - /*virtual*/ BOOL getSize(LLCoordWindow *size) override {return FALSE;} - /*virtual*/ BOOL setPosition(LLCoordScreen position) override {return FALSE;} - /*virtual*/ BOOL setSizeImpl(LLCoordScreen size) override {return FALSE;} - /*virtual*/ BOOL setSizeImpl(LLCoordWindow size) override {return FALSE;} - /*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL enable_vsync, const LLCoordScreen * const posp = NULL) override {return FALSE;} + bool getFullscreen() {return false;} + /*virtual*/ bool getPosition(LLCoordScreen *position) override {return false;} + /*virtual*/ bool getSize(LLCoordScreen *size) override {return false;} + /*virtual*/ bool getSize(LLCoordWindow *size) override {return false;} + /*virtual*/ bool setPosition(LLCoordScreen position) override {return false;} + /*virtual*/ bool setSizeImpl(LLCoordScreen size) override {return false;} + /*virtual*/ bool setSizeImpl(LLCoordWindow size) override {return false;} + /*virtual*/ bool switchContext(bool fullscreen, const LLCoordScreen &size, bool enable_vsync, const LLCoordScreen * const posp = NULL) override {return false;} void* createSharedContext() override { return nullptr; } void makeContextCurrent(void*) override {} void destroySharedContext(void*) override {} /*virtual*/ void toggleVSync(bool enable_vsync) override { } - /*virtual*/ BOOL setCursorPosition(LLCoordWindow position) override {return FALSE;} - /*virtual*/ BOOL getCursorPosition(LLCoordWindow *position) override {return FALSE;} + /*virtual*/ bool setCursorPosition(LLCoordWindow position) override {return false;} + /*virtual*/ bool getCursorPosition(LLCoordWindow *position) override {return false;} #if LL_WINDOWS - /*virtual*/ BOOL getCursorDelta(LLCoordCommon* delta) override { return FALSE; } + /*virtual*/ bool getCursorDelta(LLCoordCommon* delta) override { return false; } #endif /*virtual*/ void showCursor() override {} /*virtual*/ void hideCursor() override {} /*virtual*/ void showCursorFromMouseMove() override {} /*virtual*/ void hideCursorUntilMouseMove() override {} - /*virtual*/ BOOL isCursorHidden() override {return FALSE;} + /*virtual*/ bool isCursorHidden() override {return false;} /*virtual*/ void updateCursor() override {} //virtual ECursorType getCursor() override { return mCurrentCursor; } /*virtual*/ void captureMouse() override {} /*virtual*/ void releaseMouse() override {} - /*virtual*/ void setMouseClipping( BOOL b ) override {} - /*virtual*/ BOOL isClipboardTextAvailable() override {return FALSE; } - /*virtual*/ BOOL pasteTextFromClipboard(LLWString &dst) override {return FALSE; } - /*virtual*/ BOOL copyTextToClipboard(const LLWString &src) override {return FALSE; } + /*virtual*/ void setMouseClipping( bool b ) override {} + /*virtual*/ bool isClipboardTextAvailable() override {return false; } + /*virtual*/ bool pasteTextFromClipboard(LLWString &dst) override {return false; } + /*virtual*/ bool copyTextToClipboard(const LLWString &src) override {return false; } /*virtual*/ void flashIcon(F32 seconds) override {} /*virtual*/ F32 getGamma() override {return 1.0f; } - /*virtual*/ BOOL setGamma(const F32 gamma) override {return FALSE; } // Set the gamma + /*virtual*/ bool setGamma(const F32 gamma) override {return false; } // Set the gamma /*virtual*/ void setFSAASamples(const U32 fsaa_samples) override { } /*virtual*/ U32 getFSAASamples() override { return 0; } - /*virtual*/ BOOL restoreGamma() override {return FALSE; } // Restore original gamma table (before updating gamma) + /*virtual*/ bool restoreGamma() override {return false; } // Restore original gamma table (before updating gamma) //virtual ESwapMethod getSwapMethod() override { return mSwapMethod; } /*virtual*/ void gatherInput() override {} /*virtual*/ void delayInputProcessing() override {} @@ -89,20 +89,18 @@ public: // handy coordinate space conversion routines - /*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordWindow *to) override { return FALSE; } - /*virtual*/ BOOL convertCoords(LLCoordWindow from, LLCoordScreen *to) override { return FALSE; } - /*virtual*/ BOOL convertCoords(LLCoordWindow from, LLCoordGL *to) override { return FALSE; } - /*virtual*/ BOOL convertCoords(LLCoordGL from, LLCoordWindow *to) override { return FALSE; } - /*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordGL *to) override { return FALSE; } - /*virtual*/ BOOL convertCoords(LLCoordGL from, LLCoordScreen *to) override { return FALSE; } + /*virtual*/ bool convertCoords(LLCoordScreen from, LLCoordWindow *to) override { return false; } + /*virtual*/ bool convertCoords(LLCoordWindow from, LLCoordScreen *to) override { return false; } + /*virtual*/ bool convertCoords(LLCoordWindow from, LLCoordGL *to) override { return false; } + /*virtual*/ bool convertCoords(LLCoordGL from, LLCoordWindow *to) override { return false; } + /*virtual*/ bool convertCoords(LLCoordScreen from, LLCoordGL *to) override { return false; } + /*virtual*/ bool convertCoords(LLCoordGL from, LLCoordScreen *to) override { return false; } /*virtual*/ LLWindowResolution* getSupportedResolutions(S32 &num_resolutions) override { return NULL; } /*virtual*/ F32 getNativeAspectRatio() override { return 1.0f; } /*virtual*/ F32 getPixelAspectRatio() override { return 1.0f; } /*virtual*/ void setNativeAspectRatio(F32 ratio) override {} - U32 getAvailableVRAMMegabytes() override { return 4096; } - /*virtual*/ void *getPlatformWindow() override { return 0; } /*virtual*/ void bringToFront() override {} @@ -110,8 +108,8 @@ public: const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, - U32 flags, BOOL fullscreen, BOOL clear_background, - BOOL enable_vsync, BOOL use_gl, BOOL ignore_pixel_depth); + U32 flags, bool fullscreen, bool clear_background, + bool enable_vsync, bool use_gl, bool ignore_pixel_depth); virtual ~LLWindowHeadless(); private: diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h index 31dc83493e..d9d8bfce1f 100644 --- a/indra/llwindow/llwindowmacosx-objc.h +++ b/indra/llwindow/llwindowmacosx-objc.h @@ -30,6 +30,7 @@ #include <map> #include <vector> +#include <deque> //fir CGSize #include <CoreGraphics/CGGeometry.h> @@ -37,7 +38,7 @@ typedef std::vector<std::pair<int, bool> > segment_t; typedef std::vector<int> segment_lengths; -typedef std::vector<int> segment_standouts; +typedef std::deque<bool> segment_standouts; struct attributedStringInfo { segment_lengths seg_lengths; diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 842a41427e..3cfc9d7c84 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -51,10 +51,8 @@ #include <IOKit/hid/IOHIDLib.h> #include <IOKit/usb/IOUSBLib.h> - - -extern BOOL gDebugWindowProc; -BOOL gHiDPISupport = TRUE; +extern bool gDebugWindowProc; +bool gHiDPISupport = true; const S32 BITS_PER_PIXEL = 32; const S32 MAX_NUM_RESOLUTIONS = 32; @@ -69,11 +67,11 @@ namespace // LLWindowMacOSX // -BOOL LLWindowMacOSX::sUseMultGL = FALSE; +bool LLWindowMacOSX::sUseMultGL = false; // Cross-platform bits: -BOOL check_for_card(const char* RENDERER, const char* bad_card) +bool check_for_card(const char* RENDERER, const char* bad_card) { if (!strnicmp(RENDERER, bad_card, strlen(bad_card))) { @@ -94,15 +92,15 @@ BOOL check_for_card(const char* RENDERER, const char* bad_card) S32 button = OSMessageBox(buffer.c_str(), "Unsupported video card", OSMB_YESNO); if (OSBTN_YES == button) { - return FALSE; + return false; } else { - return TRUE; + return true; } } - return FALSE; + return false; } // Switch to determine whether we capture all displays, or just the main one. @@ -122,9 +120,9 @@ static LLWindowMacOSX *gWindowImplementation = NULL; LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks, const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, U32 flags, - BOOL fullscreen, BOOL clearBg, - BOOL enable_vsync, BOOL use_gl, - BOOL ignore_pixel_depth, + bool fullscreen, bool clearBg, + bool enable_vsync, bool use_gl, + bool ignore_pixel_depth, U32 fsaa_samples) : LLWindow(NULL, fullscreen, flags) { @@ -146,21 +144,21 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks, mContext = NULL; mPixelFormat = NULL; mDisplay = CGMainDisplayID(); - mSimulatedRightClick = FALSE; + mSimulatedRightClick = false; mLastModifiers = 0; - mHandsOffEvents = FALSE; - mCursorDecoupled = FALSE; + mHandsOffEvents = false; + mCursorDecoupled = false; mCursorLastEventDeltaX = 0; mCursorLastEventDeltaY = 0; - mCursorIgnoreNextDelta = FALSE; - mNeedsResize = FALSE; + mCursorIgnoreNextDelta = false; + mNeedsResize = false; mOverrideAspectRatio = 0.f; - mMaximized = FALSE; - mMinimized = FALSE; - mLanguageTextInputAllowed = FALSE; + mMaximized = false; + mMinimized = false; + mLanguageTextInputAllowed = false; mPreeditor = NULL; mFSAASamples = fsaa_samples; - mForceRebuild = FALSE; + mForceRebuild = false; // Get the original aspect ratio of the main device. mOriginalAspectRatio = (double)CGDisplayPixelsWide(mDisplay) / (double)CGDisplayPixelsHigh(mDisplay); @@ -200,7 +198,7 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks, initCursors(); setCursor( UI_CURSOR_ARROW ); - allowLanguageTextInput(NULL, FALSE); + allowLanguageTextInput(NULL, false); } mCallbacks = callbacks; @@ -292,7 +290,7 @@ void callRightMouseDown(float *pos, MASK mask) LLCoordGL outCoords; outCoords.mX = ll_round(pos[0]); outCoords.mY = ll_round(pos[1]); - gWindowImplementation->getCallbacks()->handleRightMouseDown(gWindowImplementation, outCoords, gKeyboard->currentMask(TRUE)); + gWindowImplementation->getCallbacks()->handleRightMouseDown(gWindowImplementation, outCoords, gKeyboard->currentMask(true)); } void callRightMouseUp(float *pos, MASK mask) @@ -305,7 +303,7 @@ void callRightMouseUp(float *pos, MASK mask) LLCoordGL outCoords; outCoords.mX = ll_round(pos[0]); outCoords.mY = ll_round(pos[1]); - gWindowImplementation->getCallbacks()->handleRightMouseUp(gWindowImplementation, outCoords, gKeyboard->currentMask(TRUE)); + gWindowImplementation->getCallbacks()->handleRightMouseUp(gWindowImplementation, outCoords, gKeyboard->currentMask(true)); } void callLeftMouseDown(float *pos, MASK mask) @@ -318,7 +316,7 @@ void callLeftMouseDown(float *pos, MASK mask) LLCoordGL outCoords; outCoords.mX = ll_round(pos[0]); outCoords.mY = ll_round(pos[1]); - gWindowImplementation->getCallbacks()->handleMouseDown(gWindowImplementation, outCoords, gKeyboard->currentMask(TRUE)); + gWindowImplementation->getCallbacks()->handleMouseDown(gWindowImplementation, outCoords, gKeyboard->currentMask(true)); } void callLeftMouseUp(float *pos, MASK mask) @@ -331,7 +329,7 @@ void callLeftMouseUp(float *pos, MASK mask) LLCoordGL outCoords; outCoords.mX = ll_round(pos[0]); outCoords.mY = ll_round(pos[1]); - gWindowImplementation->getCallbacks()->handleMouseUp(gWindowImplementation, outCoords, gKeyboard->currentMask(TRUE)); + gWindowImplementation->getCallbacks()->handleMouseUp(gWindowImplementation, outCoords, gKeyboard->currentMask(true)); } @@ -345,7 +343,7 @@ void callDoubleClick(float *pos, MASK mask) LLCoordGL outCoords; outCoords.mX = ll_round(pos[0]); outCoords.mY = ll_round(pos[1]); - gWindowImplementation->getCallbacks()->handleDoubleClick(gWindowImplementation, outCoords, gKeyboard->currentMask(TRUE)); + gWindowImplementation->getCallbacks()->handleDoubleClick(gWindowImplementation, outCoords, gKeyboard->currentMask(true)); } void callResize(unsigned int width, unsigned int height) @@ -365,7 +363,7 @@ void callMouseMoved(float *pos, MASK mask) gWindowImplementation->getMouseDeltas(deltas); outCoords.mX += deltas[0]; outCoords.mY += deltas[1]; - gWindowImplementation->getCallbacks()->handleMouseMove(gWindowImplementation, outCoords, gKeyboard->currentMask(TRUE)); + gWindowImplementation->getCallbacks()->handleMouseMove(gWindowImplementation, outCoords, gKeyboard->currentMask(true)); //gWindowImplementation->getCallbacks()->handleScrollWheel(gWindowImplementation, 0); } @@ -378,7 +376,7 @@ void callMouseDragged(float *pos, MASK mask) gWindowImplementation->getMouseDeltas(deltas); outCoords.mX += deltas[0]; outCoords.mY += deltas[1]; - gWindowImplementation->getCallbacks()->handleMouseDragged(gWindowImplementation, outCoords, gKeyboard->currentMask(TRUE)); + gWindowImplementation->getCallbacks()->handleMouseDragged(gWindowImplementation, outCoords, gKeyboard->currentMask(true)); } void callScrollMoved(float deltaX, float deltaY) @@ -620,7 +618,7 @@ void LLWindowMacOSX::updateMouseDeltas(float* deltas) { mCursorLastEventDeltaX = 0; mCursorLastEventDeltaY = 0; - mCursorIgnoreNextDelta = FALSE; + mCursorIgnoreNextDelta = false; } } else { mCursorLastEventDeltaX = 0; @@ -634,7 +632,7 @@ void LLWindowMacOSX::getMouseDeltas(float* delta) delta[1] = mCursorLastEventDeltaY; } -BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, BOOL enable_vsync) +bool LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits, bool fullscreen, bool enable_vsync) { mFullscreen = fullscreen; @@ -693,7 +691,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits if (err != kCGLNoError) { setupFailure("Can't activate GL rendering context", "Error", OSMB_OK); - return FALSE; + return false; } } @@ -726,15 +724,15 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits } makeFirstResponder(mWindow, mGLView); - return TRUE; + return true; } // We only support OS X 10.7's fullscreen app mode which is literally a full screen window that fills a virtual desktop. // This makes this method obsolete. -BOOL LLWindowMacOSX::switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL enable_vsync, const LLCoordScreen * const posp) +bool LLWindowMacOSX::switchContext(bool fullscreen, const LLCoordScreen &size, bool enable_vsync, const LLCoordScreen * const posp) { - return FALSE; + return false; } void LLWindowMacOSX::destroyContext() @@ -804,13 +802,13 @@ void LLWindowMacOSX::show() void LLWindowMacOSX::hide() { - setMouseClipping(FALSE); + setMouseClipping(false); } //virtual void LLWindowMacOSX::minimize() { - setMouseClipping(FALSE); + setMouseClipping(false); showCursor(); } @@ -832,48 +830,48 @@ void LLWindowMacOSX::close() // } // Make sure cursor is visible and we haven't mangled the clipping state. - setMouseClipping(FALSE); + setMouseClipping(false); showCursor(); destroyContext(); } -BOOL LLWindowMacOSX::isValid() +bool LLWindowMacOSX::isValid() { if(mFullscreen) { - return(TRUE); + return(true); } return (mWindow != NULL); } -BOOL LLWindowMacOSX::getVisible() +bool LLWindowMacOSX::getVisible() { - BOOL result = FALSE; + bool result = false; if(mFullscreen) { - result = TRUE; + result = true; }if (mWindow) { - result = TRUE; + result = true; } return(result); } -BOOL LLWindowMacOSX::getMinimized() +bool LLWindowMacOSX::getMinimized() { return mMinimized; } -BOOL LLWindowMacOSX::getMaximized() +bool LLWindowMacOSX::getMaximized() { return mMaximized; } -BOOL LLWindowMacOSX::maximize() +bool LLWindowMacOSX::maximize() { if (mWindow && !mMaximized) { @@ -882,7 +880,7 @@ BOOL LLWindowMacOSX::maximize() return mMaximized; } -BOOL LLWindowMacOSX::getFullscreen() +bool LLWindowMacOSX::getFullscreen() { return mFullscreen; } @@ -892,7 +890,7 @@ void LLWindowMacOSX::gatherInput() updateCursor(); } -BOOL LLWindowMacOSX::getPosition(LLCoordScreen *position) +bool LLWindowMacOSX::getPosition(LLCoordScreen *position) { S32 err = -1; @@ -919,7 +917,7 @@ BOOL LLWindowMacOSX::getPosition(LLCoordScreen *position) return (err == noErr); } -BOOL LLWindowMacOSX::getSize(LLCoordScreen *size) +bool LLWindowMacOSX::getSize(LLCoordScreen *size) { S32 err = -1; @@ -945,7 +943,7 @@ BOOL LLWindowMacOSX::getSize(LLCoordScreen *size) return (err == noErr); } -BOOL LLWindowMacOSX::getSize(LLCoordWindow *size) +bool LLWindowMacOSX::getSize(LLCoordWindow *size) { S32 err = -1; @@ -973,7 +971,7 @@ BOOL LLWindowMacOSX::getSize(LLCoordWindow *size) return (err == noErr); } -BOOL LLWindowMacOSX::setPosition(const LLCoordScreen position) +bool LLWindowMacOSX::setPosition(const LLCoordScreen position) { if(mWindow) { @@ -981,32 +979,32 @@ BOOL LLWindowMacOSX::setPosition(const LLCoordScreen position) setWindowPos(mWindow, pos); } - return TRUE; + return true; } -BOOL LLWindowMacOSX::setSizeImpl(const LLCoordScreen size) +bool LLWindowMacOSX::setSizeImpl(const LLCoordScreen size) { if(mWindow) { LLCoordWindow to; convertCoords(size, &to); setWindowSize(mWindow, to.mX, to.mY); - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLWindowMacOSX::setSizeImpl(const LLCoordWindow size) +bool LLWindowMacOSX::setSizeImpl(const LLCoordWindow size) { if (mWindow) { const int titlePadding = 22; setWindowSize(mWindow, size.mX, size.mY + titlePadding); - return TRUE; + return true; } - return FALSE; + return false; } void LLWindowMacOSX::swapBuffers() @@ -1061,16 +1059,16 @@ U32 LLWindowMacOSX::getFSAASamples() void LLWindowMacOSX::setFSAASamples(const U32 samples) { mFSAASamples = samples; - mForceRebuild = TRUE; + mForceRebuild = true; } -BOOL LLWindowMacOSX::restoreGamma() +bool LLWindowMacOSX::restoreGamma() { CGDisplayRestoreColorSyncSettings(); return true; } -BOOL LLWindowMacOSX::setGamma(const F32 gamma) +bool LLWindowMacOSX::setGamma(const F32 gamma) { CGGammaValue redMin; CGGammaValue redMax; @@ -1118,7 +1116,7 @@ BOOL LLWindowMacOSX::setGamma(const F32 gamma) return true; } -BOOL LLWindowMacOSX::isCursorHidden() +bool LLWindowMacOSX::isCursorHidden() { return mCursorHidden; } @@ -1126,31 +1124,31 @@ BOOL LLWindowMacOSX::isCursorHidden() // Constrains the mouse to the window. -void LLWindowMacOSX::setMouseClipping( BOOL b ) +void LLWindowMacOSX::setMouseClipping( bool b ) { // Just stash the requested state. We'll simulate this when the cursor is hidden by decoupling. mIsMouseClipping = b; if(b) { - // LL_INFOS() << "setMouseClipping(TRUE)" << LL_ENDL; + // LL_INFOS() << "setMouseClipping(true)" << LL_ENDL; } else { - // LL_INFOS() << "setMouseClipping(FALSE)" << LL_ENDL; + // LL_INFOS() << "setMouseClipping(false)" << LL_ENDL; } adjustCursorDecouple(); } -BOOL LLWindowMacOSX::setCursorPosition(const LLCoordWindow position) +bool LLWindowMacOSX::setCursorPosition(const LLCoordWindow position) { - BOOL result = FALSE; + bool result = false; LLCoordScreen screen_pos; if (!convertCoords(position, &screen_pos)) { - return FALSE; + return false; } CGPoint newPosition; @@ -1163,7 +1161,7 @@ BOOL LLWindowMacOSX::setCursorPosition(const LLCoordWindow position) CGSetLocalEventsSuppressionInterval(0.0); if(CGWarpMouseCursorPosition(newPosition) == noErr) { - result = TRUE; + result = true; } // Under certain circumstances, this will trigger us to decouple the cursor. @@ -1180,13 +1178,13 @@ BOOL LLWindowMacOSX::setCursorPosition(const LLCoordWindow position) return result; } -BOOL LLWindowMacOSX::getCursorPosition(LLCoordWindow *position) +bool LLWindowMacOSX::getCursorPosition(LLCoordWindow *position) { float cursor_point[2]; LLCoordScreen screen_pos; if(mWindow == NULL) - return FALSE; + return false; getCursorPos(mWindow, cursor_point); @@ -1209,7 +1207,7 @@ BOOL LLWindowMacOSX::getCursorPosition(LLCoordWindow *position) position->mX = cursor_point[0] * scale; position->mY = cursor_point[1] * scale; - return TRUE; + return true; } void LLWindowMacOSX::adjustCursorDecouple(bool warpingMouse) @@ -1224,7 +1222,7 @@ void LLWindowMacOSX::adjustCursorDecouple(bool warpingMouse) // LL_INFOS() << "adjustCursorDecouple: decoupling cursor" << LL_ENDL; CGAssociateMouseAndMouseCursorPosition(false); mCursorDecoupled = true; - mCursorIgnoreNextDelta = TRUE; + mCursorIgnoreNextDelta = true; } } } @@ -1262,20 +1260,10 @@ F32 LLWindowMacOSX::getNativeAspectRatio() F32 LLWindowMacOSX::getPixelAspectRatio() { - //OS X always enforces a 1:1 pixel aspect ratio, regardless of video mode + //macOS always enforces a 1:1 pixel aspect ratio, regardless of video mode return 1.f; } -U32 LLWindowMacOSX::getAvailableVRAMMegabytes() { - // MTL (and MoltenVK) has some additional gpu data, such as recommendedMaxWorkingSetSize and currentAllocatedSize. - // But these are not available for OpenGL and/or our current mimimum OS version. - // So we will estimate. - static const U32 mb = 1024*1024; - // We're asked for total available gpu memory, but we only have allocation info on texture usage. So estimate by doubling that. - static const U32 total_factor = 2; // estimated total/textures - return gGLManager.mVRAM - (LLImageGL::getTextureBytesAllocated() * total_factor/mb); -} - //static SInt32 oldWindowLevel; // MBW -- XXX -- There's got to be a better way than this. Find it, please... @@ -1294,17 +1282,17 @@ void LLWindowMacOSX::afterDialog() void LLWindowMacOSX::flashIcon(F32 seconds) { - // For consistency with OS X conventions, the number of seconds given is ignored and + // For consistency with macOS conventions, the number of seconds given is ignored and // left up to the OS (which will actually bounce it for one second). requestUserAttention(); } -BOOL LLWindowMacOSX::isClipboardTextAvailable() +bool LLWindowMacOSX::isClipboardTextAvailable() { return pasteBoardAvailable(); } -BOOL LLWindowMacOSX::pasteTextFromClipboard(LLWString &dst) +bool LLWindowMacOSX::pasteTextFromClipboard(LLWString &dst) { unsigned short* pboard_data = copyFromPBoard(); // must free returned data llutf16string str(pboard_data); @@ -1319,9 +1307,9 @@ BOOL LLWindowMacOSX::pasteTextFromClipboard(LLWString &dst) } } -BOOL LLWindowMacOSX::copyTextToClipboard(const LLWString &s) +bool LLWindowMacOSX::copyTextToClipboard(const LLWString &s) { - BOOL result = false; + bool result = false; llutf16string utf16str = wstring_to_utf16str(s); result = copyToPBoard(utf16str.data(), utf16str.length()); @@ -1331,7 +1319,7 @@ BOOL LLWindowMacOSX::copyTextToClipboard(const LLWString &s) // protected -BOOL LLWindowMacOSX::resetDisplayResolution() +bool LLWindowMacOSX::resetDisplayResolution() { // This is only called from elsewhere in this class, and it's not used by the Mac implementation. return true; @@ -1364,13 +1352,13 @@ LLWindow::LLWindowResolution* LLWindowMacOSX::getSupportedResolutions(S32 &num_r if(bits == BITS_PER_PIXEL && width >= 800 && height >= 600) { - BOOL resolution_exists = FALSE; + bool resolution_exists = false; for(S32 i = 0; i < mNumSupportedResolutions; i++) { if (mSupportedResolutions[i].mWidth == width && mSupportedResolutions[i].mHeight == height) { - resolution_exists = TRUE; + resolution_exists = true; } } if (!resolution_exists) @@ -1389,21 +1377,21 @@ LLWindow::LLWindowResolution* LLWindowMacOSX::getSupportedResolutions(S32 &num_r return mSupportedResolutions; } -BOOL LLWindowMacOSX::convertCoords(LLCoordGL from, LLCoordWindow *to) +bool LLWindowMacOSX::convertCoords(LLCoordGL from, LLCoordWindow *to) { to->mX = from.mX; to->mY = from.mY; - return TRUE; + return true; } -BOOL LLWindowMacOSX::convertCoords(LLCoordWindow from, LLCoordGL* to) +bool LLWindowMacOSX::convertCoords(LLCoordWindow from, LLCoordGL* to) { to->mX = from.mX; to->mY = from.mY; - return TRUE; + return true; } -BOOL LLWindowMacOSX::convertCoords(LLCoordScreen from, LLCoordWindow* to) +bool LLWindowMacOSX::convertCoords(LLCoordScreen from, LLCoordWindow* to) { if(mWindow) { @@ -1417,12 +1405,12 @@ BOOL LLWindowMacOSX::convertCoords(LLCoordScreen from, LLCoordWindow* to) to->mX = mouse_point[0]; to->mY = mouse_point[1]; - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLWindowMacOSX::convertCoords(LLCoordWindow from, LLCoordScreen *to) +bool LLWindowMacOSX::convertCoords(LLCoordWindow from, LLCoordScreen *to) { if(mWindow) { @@ -1436,19 +1424,19 @@ BOOL LLWindowMacOSX::convertCoords(LLCoordWindow from, LLCoordScreen *to) to->mX = mouse_point[0]; to->mY = mouse_point[1]; - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLWindowMacOSX::convertCoords(LLCoordScreen from, LLCoordGL *to) +bool LLWindowMacOSX::convertCoords(LLCoordScreen from, LLCoordGL *to) { LLCoordWindow window_coord; return(convertCoords(from, &window_coord) && convertCoords(window_coord, to)); } -BOOL LLWindowMacOSX::convertCoords(LLCoordGL from, LLCoordScreen *to) +bool LLWindowMacOSX::convertCoords(LLCoordGL from, LLCoordScreen *to) { LLCoordWindow window_coord; @@ -1710,8 +1698,8 @@ void LLWindowMacOSX::hideCursor() if(!mCursorHidden) { // LL_INFOS() << "hideCursor: hiding" << LL_ENDL; - mCursorHidden = TRUE; - mHideCursorPermanent = TRUE; + mCursorHidden = true; + mHideCursorPermanent = true; hideNSCursor(); } else @@ -1727,8 +1715,8 @@ void LLWindowMacOSX::showCursor() if(mCursorHidden || !isCGCursorVisible()) { // LL_INFOS() << "showCursor: showing" << LL_ENDL; - mCursorHidden = FALSE; - mHideCursorPermanent = FALSE; + mCursorHidden = false; + mHideCursorPermanent = false; showNSCursor(); } else @@ -1752,7 +1740,7 @@ void LLWindowMacOSX::hideCursorUntilMouseMove() if (!mHideCursorPermanent) { hideCursor(); - mHideCursorPermanent = FALSE; + mHideCursorPermanent = false; } } @@ -2353,9 +2341,9 @@ LLSD LLWindowMacOSX::getNativeKeyData() return result; } -BOOL LLWindowMacOSX::dialogColorPicker( F32 *r, F32 *g, F32 *b) +bool LLWindowMacOSX::dialogColorPicker( F32 *r, F32 *g, F32 *b) { - BOOL retval = FALSE; + bool retval = false; OSErr error = noErr; NColorPickerInfo info; @@ -2412,12 +2400,12 @@ static long getDictLong (CFDictionaryRef refDict, CFStringRef key) return int_value; // otherwise return the long value } -void LLWindowMacOSX::allowLanguageTextInput(LLPreeditor *preeditor, BOOL b) +void LLWindowMacOSX::allowLanguageTextInput(LLPreeditor *preeditor, bool b) { if (preeditor != mPreeditor && !b) { // This condition may occur by a call to - // setEnabled(BOOL) against LLTextEditor or LLLineEditor + // setEnabled(bool) against LLTextEditor or LLLineEditor // when the control is not focused. // We need to silently ignore the case so that // the language input status of the focused control diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h index 5e09e58a99..f5b6441746 100644 --- a/indra/llwindow/llwindowmacosx.h +++ b/indra/llwindow/llwindowmacosx.h @@ -47,71 +47,68 @@ public: void show() override; void hide() override; void close() override; - BOOL getVisible() override; - BOOL getMinimized() override; - BOOL getMaximized() override; - BOOL maximize() override; + bool getVisible() override; + bool getMinimized() override; + bool getMaximized() override; + bool maximize() override; void minimize() override; void restore() override; - BOOL getFullscreen(); - BOOL getPosition(LLCoordScreen *position) override; - BOOL getSize(LLCoordScreen *size) override; - BOOL getSize(LLCoordWindow *size) override; - BOOL setPosition(LLCoordScreen position) override; - BOOL setSizeImpl(LLCoordScreen size) override; - BOOL setSizeImpl(LLCoordWindow size) override; - BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL enable_vsync, const LLCoordScreen * const posp = NULL) override; - BOOL setCursorPosition(LLCoordWindow position) override; - BOOL getCursorPosition(LLCoordWindow *position) override; + bool getFullscreen(); + bool getPosition(LLCoordScreen *position) override; + bool getSize(LLCoordScreen *size) override; + bool getSize(LLCoordWindow *size) override; + bool setPosition(LLCoordScreen position) override; + bool setSizeImpl(LLCoordScreen size) override; + bool setSizeImpl(LLCoordWindow size) override; + bool switchContext(bool fullscreen, const LLCoordScreen &size, bool enable_vsync, const LLCoordScreen * const posp = NULL) override; + bool setCursorPosition(LLCoordWindow position) override; + bool getCursorPosition(LLCoordWindow *position) override; void showCursor() override; void hideCursor() override; void showCursorFromMouseMove() override; void hideCursorUntilMouseMove() override; - BOOL isCursorHidden() override; + bool isCursorHidden() override; void updateCursor() override; ECursorType getCursor() const override; void captureMouse() override; void releaseMouse() override; - void setMouseClipping( BOOL b ) override; - BOOL isClipboardTextAvailable() override; - BOOL pasteTextFromClipboard(LLWString &dst) override; - BOOL copyTextToClipboard(const LLWString & src) override; + void setMouseClipping( bool b ) override; + bool isClipboardTextAvailable() override; + bool pasteTextFromClipboard(LLWString &dst) override; + bool copyTextToClipboard(const LLWString & src) override; void flashIcon(F32 seconds) override; F32 getGamma() override; - BOOL setGamma(const F32 gamma) override; // Set the gamma + bool setGamma(const F32 gamma) override; // Set the gamma U32 getFSAASamples() override; void setFSAASamples(const U32 fsaa_samples) override; - BOOL restoreGamma() override; // Restore original gamma table (before updating gamma) + bool restoreGamma() override; // Restore original gamma table (before updating gamma) ESwapMethod getSwapMethod() override { return mSwapMethod; } void gatherInput() override; void delayInputProcessing() override {}; void swapBuffers() override; // handy coordinate space conversion routines - BOOL convertCoords(LLCoordScreen from, LLCoordWindow *to) override; - BOOL convertCoords(LLCoordWindow from, LLCoordScreen *to) override; - BOOL convertCoords(LLCoordWindow from, LLCoordGL *to) override; - BOOL convertCoords(LLCoordGL from, LLCoordWindow *to) override; - BOOL convertCoords(LLCoordScreen from, LLCoordGL *to) override; - BOOL convertCoords(LLCoordGL from, LLCoordScreen *to) override; + bool convertCoords(LLCoordScreen from, LLCoordWindow *to) override; + bool convertCoords(LLCoordWindow from, LLCoordScreen *to) override; + bool convertCoords(LLCoordWindow from, LLCoordGL *to) override; + bool convertCoords(LLCoordGL from, LLCoordWindow *to) override; + bool convertCoords(LLCoordScreen from, LLCoordGL *to) override; + bool convertCoords(LLCoordGL from, LLCoordScreen *to) override; LLWindowResolution* getSupportedResolutions(S32 &num_resolutions) override; F32 getNativeAspectRatio() override; F32 getPixelAspectRatio() override; void setNativeAspectRatio(F32 ratio) override { mOverrideAspectRatio = ratio; } - // query VRAM usage - /*virtual*/ U32 getAvailableVRAMMegabytes() override; - void beforeDialog() override; void afterDialog() override; - BOOL dialogColorPicker(F32 *r, F32 *g, F32 *b) override; + bool dialogColorPicker(F32 *r, F32 *g, F32 *b) override; void *getPlatformWindow() override; void bringToFront() override {}; - void allowLanguageTextInput(LLPreeditor *preeditor, BOOL b) override; + void allowLanguageTextInput(LLPreeditor *preeditor, bool b) override; void interruptLanguageTextInput() override; void spawnWebBrowser(const std::string& escaped_url, bool async) override; F32 getSystemUISize() override; @@ -153,26 +150,26 @@ public: protected: LLWindowMacOSX(LLWindowCallbacks* callbacks, const std::string& title, const std::string& name, int x, int y, int width, int height, U32 flags, - BOOL fullscreen, BOOL clearBg, BOOL enable_vsync, BOOL use_gl, - BOOL ignore_pixel_depth, + bool fullscreen, bool clearBg, bool enable_vsync, bool use_gl, + bool ignore_pixel_depth, U32 fsaa_samples); ~LLWindowMacOSX(); void initCursors(); - BOOL isValid() override; + bool isValid() override; void moveWindow(const LLCoordScreen& position,const LLCoordScreen& size); // Changes display resolution. Returns true if successful - BOOL setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh); + bool setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh); // Go back to last fullscreen display resolution. - BOOL setFullscreenResolution(); + bool setFullscreenResolution(); // Restore the display resolution to its value before we ran the app. - BOOL resetDisplayResolution(); + bool resetDisplayResolution(); - BOOL shouldPostQuit() { return mPostQuit; } + bool shouldPostQuit() { return mPostQuit; } //Satisfy MAINT-3135 and MAINT-3288 with a flag. /*virtual */ void setOldResize(bool oldresize) override {setResizeMode(oldresize, mGLView); } @@ -186,7 +183,7 @@ protected: // // create or re-create the GL context/window. Called from the constructor and switchContext(). - BOOL createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, BOOL enable_vsync); + bool createContext(int x, int y, int width, int height, int bits, bool fullscreen, bool enable_vsync); void destroyContext(); void setupFailure(const std::string& text, const std::string& caption, U32 type); void adjustCursorDecouple(bool warpingMouse = false); @@ -214,30 +211,30 @@ protected: LLRect mOldMouseClip; // Screen rect to which the mouse cursor was globally constrained before we changed it in clipMouse() std::string mWindowTitle; double mOriginalAspectRatio; - BOOL mSimulatedRightClick; + bool mSimulatedRightClick; U32 mLastModifiers; - BOOL mHandsOffEvents; // When true, temporarially disable CarbonEvent processing. + bool mHandsOffEvents; // When true, temporarially disable CarbonEvent processing. // Used to allow event processing when putting up dialogs in fullscreen mode. - BOOL mCursorDecoupled; + bool mCursorDecoupled; S32 mCursorLastEventDeltaX; S32 mCursorLastEventDeltaY; - BOOL mCursorIgnoreNextDelta; - BOOL mNeedsResize; // Constructor figured out the window is too big, it needs a resize. + bool mCursorIgnoreNextDelta; + bool mNeedsResize; // Constructor figured out the window is too big, it needs a resize. LLCoordScreen mNeedsResizeSize; F32 mOverrideAspectRatio; - BOOL mMaximized; - BOOL mMinimized; + bool mMaximized; + bool mMinimized; U32 mFSAASamples; - BOOL mForceRebuild; + bool mForceRebuild; S32 mDragOverrideCursor; // Input method management through Text Service Manager. - BOOL mLanguageTextInputAllowed; + bool mLanguageTextInputAllowed; LLPreeditor* mPreeditor; public: - static BOOL sUseMultGL; + static bool sUseMultGL; friend class LLWindowManager; diff --git a/indra/llwindow/llwindowmesaheadless.cpp b/indra/llwindow/llwindowmesaheadless.cpp index 58f8f80d2d..6cbd737ed2 100644 --- a/indra/llwindow/llwindowmesaheadless.cpp +++ b/indra/llwindow/llwindowmesaheadless.cpp @@ -40,8 +40,8 @@ U16 *gMesaBuffer = NULL; // LLWindowMesaHeadless::LLWindowMesaHeadless(LLWindowCallbacks* callbacks, const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, - U32 flags, BOOL fullscreen, BOOL clearBg, - BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth) + U32 flags, bool fullscreen, bool clearBg, + bool disable_vsync, bool use_gl, bool ignore_pixel_depth) : LLWindow(callbacks, fullscreen, flags) { if (use_gl) diff --git a/indra/llwindow/llwindowmesaheadless.h b/indra/llwindow/llwindowmesaheadless.h index 9aa376a6db..0bf8c46a30 100644 --- a/indra/llwindow/llwindowmesaheadless.h +++ b/indra/llwindow/llwindowmesaheadless.h @@ -39,38 +39,38 @@ public: /*virtual*/ void show() {}; /*virtual*/ void hide() {}; /*virtual*/ void close() {}; - /*virtual*/ BOOL getVisible() {return FALSE;}; - /*virtual*/ BOOL getMinimized() {return FALSE;}; - /*virtual*/ BOOL getMaximized() {return FALSE;}; - /*virtual*/ BOOL maximize() {return FALSE;}; + /*virtual*/ bool getVisible() {return false;}; + /*virtual*/ bool getMinimized() {return false;}; + /*virtual*/ bool getMaximized() {return false;}; + /*virtual*/ bool maximize() {return false;}; /*virtual*/ void minimize() {}; /*virtual*/ void restore() {}; - /*virtual*/ BOOL getFullscreen() {return FALSE;}; - /*virtual*/ BOOL getPosition(LLCoordScreen *position) {return FALSE;}; - /*virtual*/ BOOL getSize(LLCoordScreen *size) {return FALSE;}; - /*virtual*/ BOOL getSize(LLCoordWindow *size) {return FALSE;}; - /*virtual*/ BOOL setPosition(LLCoordScreen position) {return FALSE;}; - /*virtual*/ BOOL setSizeImpl(LLCoordScreen size) {return FALSE;}; - /*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL) {return FALSE;}; - /*virtual*/ BOOL setCursorPosition(LLCoordWindow position) {return FALSE;}; - /*virtual*/ BOOL getCursorPosition(LLCoordWindow *position) {return FALSE;}; + /*virtual*/ bool getFullscreen() {return false;}; + /*virtual*/ bool getPosition(LLCoordScreen *position) {return false;}; + /*virtual*/ bool getSize(LLCoordScreen *size) {return false;}; + /*virtual*/ bool getSize(LLCoordWindow *size) {return false;}; + /*virtual*/ bool setPosition(LLCoordScreen position) {return false;}; + /*virtual*/ bool setSizeImpl(LLCoordScreen size) {return false;}; + /*virtual*/ bool switchContext(bool fullscreen, const LLCoordScreen &size, bool disable_vsync, const LLCoordScreen * const posp = NULL) {return false;}; + /*virtual*/ bool setCursorPosition(LLCoordWindow position) {return false;}; + /*virtual*/ bool getCursorPosition(LLCoordWindow *position) {return false;}; /*virtual*/ void showCursor() {}; /*virtual*/ void hideCursor() {}; /*virtual*/ void showCursorFromMouseMove() {}; /*virtual*/ void hideCursorUntilMouseMove() {}; - /*virtual*/ BOOL isCursorHidden() {return FALSE;}; + /*virtual*/ bool isCursorHidden() {return false;}; /*virtual*/ void updateCursor() {}; //virtual ECursorType getCursor() { return mCurrentCursor; }; /*virtual*/ void captureMouse() {}; /*virtual*/ void releaseMouse() {}; - /*virtual*/ void setMouseClipping( BOOL b ) {}; - /*virtual*/ BOOL isClipboardTextAvailable() {return FALSE; }; - /*virtual*/ BOOL pasteTextFromClipboard(LLWString &dst) {return FALSE; }; - /*virtual*/ BOOL copyTextToClipboard(const LLWString &src) {return FALSE; }; + /*virtual*/ void setMouseClipping( bool b ) {}; + /*virtual*/ bool isClipboardTextAvailable() {return false; }; + /*virtual*/ bool pasteTextFromClipboard(LLWString &dst) {return false; }; + /*virtual*/ bool copyTextToClipboard(const LLWString &src) {return false; }; /*virtual*/ void flashIcon(F32 seconds) {}; /*virtual*/ F32 getGamma() {return 1.0f; }; - /*virtual*/ BOOL setGamma(const F32 gamma) {return FALSE; }; // Set the gamma - /*virtual*/ BOOL restoreGamma() {return FALSE; }; // Restore original gamma table (before updating gamma) + /*virtual*/ bool setGamma(const F32 gamma) {return false; }; // Set the gamma + /*virtual*/ bool restoreGamma() {return false; }; // Restore original gamma table (before updating gamma) /*virtual*/ void setFSAASamples(const U32 fsaa_samples) { /* FSAA not supported yet on Mesa headless.*/ } /*virtual*/ U32 getFSAASamples() { return 0; } //virtual ESwapMethod getSwapMethod() { return mSwapMethod; } @@ -80,12 +80,12 @@ public: /*virtual*/ void restoreGLContext() {}; // handy coordinate space conversion routines - /*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordWindow *to) { return FALSE; }; - /*virtual*/ BOOL convertCoords(LLCoordWindow from, LLCoordScreen *to) { return FALSE; }; - /*virtual*/ BOOL convertCoords(LLCoordWindow from, LLCoordGL *to) { return FALSE; }; - /*virtual*/ BOOL convertCoords(LLCoordGL from, LLCoordWindow *to) { return FALSE; }; - /*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordGL *to) { return FALSE; }; - /*virtual*/ BOOL convertCoords(LLCoordGL from, LLCoordScreen *to) { return FALSE; }; + /*virtual*/ bool convertCoords(LLCoordScreen from, LLCoordWindow *to) { return false; }; + /*virtual*/ bool convertCoords(LLCoordWindow from, LLCoordScreen *to) { return false; }; + /*virtual*/ bool convertCoords(LLCoordWindow from, LLCoordGL *to) { return false; }; + /*virtual*/ bool convertCoords(LLCoordGL from, LLCoordWindow *to) { return false; }; + /*virtual*/ bool convertCoords(LLCoordScreen from, LLCoordGL *to) { return false; }; + /*virtual*/ bool convertCoords(LLCoordGL from, LLCoordScreen *to) { return false; }; /*virtual*/ LLWindowResolution* getSupportedResolutions(S32 &num_resolutions) { return NULL; }; /*virtual*/ F32 getNativeAspectRatio() { return 1.0f; }; @@ -97,8 +97,8 @@ public: LLWindowMesaHeadless(LLWindowCallbacks* callbacks, const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, - U32 flags, BOOL fullscreen, BOOL clearBg, - BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth); + U32 flags, bool fullscreen, bool clearBg, + bool disable_vsync, bool use_gl, bool ignore_pixel_depth); ~LLWindowMesaHeadless(); private: diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index eb689dc48c..cec2fa3e4d 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -57,7 +57,7 @@ extern "C" { # include <stdio.h> #endif // LL_LINUX -extern BOOL gDebugWindowProc; +extern bool gDebugWindowProc; const S32 MAX_NUM_RESOLUTIONS = 200; @@ -70,7 +70,7 @@ static bool ATIbug = false; #include <CoreGraphics/CGDirectDisplay.h> #include <CoreServices/CoreServices.h> -BOOL gHiDPISupport = TRUE; +bool gHiDPISupport = true; namespace { @@ -95,11 +95,11 @@ namespace // LLWindowMacOSX // -BOOL LLWindowSDL::sUseMultGL = FALSE; +bool LLWindowSDL::sUseMultGL = false; #endif -BOOL hasHIDPI = 0; +bool hasHIDPI = 0; // // LLWindowSDL @@ -397,9 +397,9 @@ Display* LLWindowSDL::getSDLDisplay() LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks, const std::string& title, S32 x, S32 y, S32 width, S32 height, U32 flags, - BOOL fullscreen, BOOL clearBg, - BOOL disable_vsync, BOOL use_gl, - BOOL ignore_pixel_depth, U32 fsaa_samples) + bool fullscreen, bool clearBg, + bool disable_vsync, bool use_gl, + bool ignore_pixel_depth, U32 fsaa_samples) : LLWindow(callbacks, fullscreen, flags), Lock_Display(NULL), //Unlock_Display(NULL), mGamma(1.0f) @@ -417,7 +417,7 @@ LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks, // Ignore use_gl for now, only used for drones on PC mWindow = NULL; mContext = {}; - mNeedsResize = FALSE; + mNeedsResize = false; mOverrideAspectRatio = 0.f; mGrabbyKeyFlags = 0; mReallyCapturedCount = 0; @@ -454,7 +454,7 @@ LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks, gWindowImplementation = this; #if LL_X11 - mFlashing = FALSE; + mFlashing = false; initialiseX11Clipboard(); #endif // LL_X11 @@ -675,7 +675,7 @@ void LLWindowSDL::tryFindFullscreenSize( int &width, int &height ) } } -BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, BOOL disable_vsync) +bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, bool fullscreen, bool disable_vsync) { //bool glneedsinit = false; @@ -794,7 +794,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B { LL_WARNS() << "Cannot create GL context " << SDL_GetError() << LL_ENDL; setupFailure("GL Context creation error creation error", "Error", OSMB_OK); - return FALSE; + return false; } // SDL_GL_SetSwapInterval(1); } @@ -804,7 +804,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B { if (mWindow) { - mFullscreen = TRUE; + mFullscreen = true; /* mFullscreenWidth = mSurface->w; mFullscreenHeight = mSurface->h; @@ -823,7 +823,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B { LL_WARNS() << "createContext: fullscreen creation failure. SDL: " << SDL_GetError() << LL_ENDL; // No fullscreen support - mFullscreen = FALSE; + mFullscreen = false; mFullscreenWidth = -1; mFullscreenHeight = -1; mFullscreenBits = -1; @@ -831,7 +831,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B std::string error = llformat("Unable to run fullscreen at %d x %d.\nRunning in window.", width, height); OSMessageBox(error, "Error", OSMB_OK); - return FALSE; + return false; } } else @@ -840,7 +840,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B { LL_WARNS() << "createContext: window creation failure. SDL: " << SDL_GetError() << LL_ENDL; setupFailure("Window creation error", "Error", OSMB_OK); - return FALSE; + return false; } } @@ -939,7 +939,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B "will automatically adjust the screen each time it runs.", "Error", OSMB_OK); - return FALSE; + return false; #endif } @@ -976,15 +976,15 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B #endif // Don't need to get the current gamma, since there's a call that restores it to the system defaults. - return TRUE; + return true; } // changing fullscreen resolution, or switching between windowed and fullscreen mode. -BOOL LLWindowSDL::switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp) +bool LLWindowSDL::switchContext(bool fullscreen, const LLCoordScreen &size, bool disable_vsync, const LLCoordScreen * const posp) { - const BOOL needsRebuild = TRUE; // Just nuke the context and start over. - BOOL result = true; + const bool needsRebuild = true; // Just nuke the context and start over. + bool result = true; LL_INFOS() << "switchContext, fullscreen=" << fullscreen << LL_ENDL; stop_glerror(); @@ -1092,86 +1092,86 @@ void LLWindowSDL::close() // } // Make sure cursor is visible and we haven't mangled the clipping state. - setMouseClipping(FALSE); + setMouseClipping(false); showCursor(); destroyContext(); } -BOOL LLWindowSDL::isValid() +bool LLWindowSDL::isValid() { return (mWindow != NULL); } -BOOL LLWindowSDL::getVisible() +bool LLWindowSDL::getVisible() { - BOOL result = FALSE; + bool result = false; // *FIX: This isn't really right... // Then what is? if (mWindow) { - if( SDL_GetWindowFlags(mWindow) & SDL_WINDOW_SHOWN ) result = TRUE; + if( SDL_GetWindowFlags(mWindow) & SDL_WINDOW_SHOWN ) result = true; } return(result); } -BOOL LLWindowSDL::getMinimized() +bool LLWindowSDL::getMinimized() { - BOOL result = FALSE; + bool result = false; if (mWindow/*&& (1 == mIsMinimized)*/) { - if( SDL_GetWindowFlags(mWindow) & SDL_WINDOW_MINIMIZED ) result = TRUE; + if( SDL_GetWindowFlags(mWindow) & SDL_WINDOW_MINIMIZED ) result = true; } mIsMinimized = result; return(result); } -BOOL LLWindowSDL::getMaximized() +bool LLWindowSDL::getMaximized() { - BOOL result = FALSE; + bool result = false; if (mWindow) { // TODO - if( SDL_GetWindowFlags(mWindow) & SDL_WINDOW_MAXIMIZED ) result = TRUE; - else result = FALSE; + if( SDL_GetWindowFlags(mWindow) & SDL_WINDOW_MAXIMIZED ) result = true; + else result = false; } return(result); } -BOOL LLWindowSDL::maximize() +bool LLWindowSDL::maximize() { // TODO - BOOL result = FALSE; + bool result = false; if (mWindow) { SDL_MaximizeWindow(mWindow); - result = TRUE; + result = true; } return result; } -BOOL LLWindowSDL::getFullscreen() +bool LLWindowSDL::getFullscreen() { return mFullscreen; } -BOOL LLWindowSDL::getPosition(LLCoordScreen *position) +bool LLWindowSDL::getPosition(LLCoordScreen *position) { // *FIX: can anything be done with this? position->mX = 0; position->mY = 0; - return TRUE; + return true; } -BOOL LLWindowSDL::getSize(LLCoordScreen *size) +bool LLWindowSDL::getSize(LLCoordScreen *size) { if (mWindow) { @@ -1181,13 +1181,13 @@ BOOL LLWindowSDL::getSize(LLCoordScreen *size) else */ SDL_GetWindowSize(mWindow, &size->mX, &size->mY); - return (TRUE); + return (true); } - return (FALSE); + return (false); } -BOOL LLWindowSDL::getSize(LLCoordWindow *size) +bool LLWindowSDL::getSize(LLCoordWindow *size) { if (mWindow) { @@ -1195,22 +1195,22 @@ BOOL LLWindowSDL::getSize(LLCoordWindow *size) SDL_GL_GetDrawableSize(mWindow, &size->mX, &size->mY); else SDL_GetWindowSize(mWindow, &size->mX, &size->mY); - return (TRUE); + return (true); } - return (FALSE); + return (false); } -BOOL LLWindowSDL::setPosition(const LLCoordScreen position) +bool LLWindowSDL::setPosition(const LLCoordScreen position) { - BOOL result = FALSE; + bool result = false; if(mWindow) { // *FIX: (?) //MacMoveWindow(mWindow, position.mX, position.mY, false); SDL_SetWindowPosition(mWindow, position.mX, position.mY); - result = TRUE; + result = true; } return result; @@ -1239,12 +1239,12 @@ template< typename T > bool setSizeImpl( const T& newSize, SDL_Window *pWin ) return true; } -BOOL LLWindowSDL::setSizeImpl(const LLCoordScreen size) +bool LLWindowSDL::setSizeImpl(const LLCoordScreen size) { return ::setSizeImpl( size, mWindow ); } -BOOL LLWindowSDL::setSizeImpl(const LLCoordWindow size) +bool LLWindowSDL::setSizeImpl(const LLCoordWindow size) { return ::setSizeImpl( size, mWindow ); } @@ -1273,7 +1273,7 @@ F32 LLWindowSDL::getGamma() return 1/mGamma; } -BOOL LLWindowSDL::restoreGamma() +bool LLWindowSDL::restoreGamma() { //CGDisplayRestoreColorSyncSettings(); // SDL_SetGamma(1.0f, 1.0f, 1.0f); @@ -1283,7 +1283,7 @@ BOOL LLWindowSDL::restoreGamma() return true; } -BOOL LLWindowSDL::setGamma(const F32 gamma) +bool LLWindowSDL::setGamma(const F32 gamma) { mGamma = gamma; if (mGamma == 0) mGamma = 0.1f; @@ -1295,7 +1295,7 @@ BOOL LLWindowSDL::setGamma(const F32 gamma) return true; } -BOOL LLWindowSDL::isCursorHidden() +bool LLWindowSDL::isCursorHidden() { return mCursorHidden; } @@ -1303,7 +1303,7 @@ BOOL LLWindowSDL::isCursorHidden() // Constrains the mouse to the window. -void LLWindowSDL::setMouseClipping( BOOL b ) +void LLWindowSDL::setMouseClipping( bool b ) { //SDL_WM_GrabInput(b ? SDL_GRAB_ON : SDL_GRAB_OFF); } @@ -1327,14 +1327,14 @@ void LLWindowSDL::setMinSize(U32 min_width, U32 min_height, bool enforce_immedia #endif } -BOOL LLWindowSDL::setCursorPosition(const LLCoordWindow position) +bool LLWindowSDL::setCursorPosition(const LLCoordWindow position) { - BOOL result = TRUE; + bool result = true; LLCoordScreen screen_pos; if (!convertCoords(position, &screen_pos)) { - return FALSE; + return false; } //LL_INFOS() << "setCursorPosition(" << screen_pos.mX << ", " << screen_pos.mY << ")" << LL_ENDL; @@ -1354,7 +1354,7 @@ BOOL LLWindowSDL::setCursorPosition(const LLCoordWindow position) return result; } -BOOL LLWindowSDL::getCursorPosition(LLCoordWindow *position) +bool LLWindowSDL::getCursorPosition(LLCoordWindow *position) { //Point cursor_point; LLCoordScreen screen_pos; @@ -1429,7 +1429,7 @@ void LLWindowSDL::beforeDialog() LL_INFOS() << "LLWindowSDL::beforeDialog()" << LL_ENDL; - if (SDLReallyCaptureInput(FALSE)) // must ungrab input so popup works! + if (SDLReallyCaptureInput(false)) // must ungrab input so popup works! { if (mFullscreen) { @@ -1482,7 +1482,7 @@ void LLWindowSDL::afterDialog() #if LL_X11 // set/reset the XWMHints flag for 'urgency' that usually makes the icon flash -void LLWindowSDL::x11_set_urgent(BOOL urgent) +void LLWindowSDL::x11_set_urgent(bool urgent) { if (mSDL_Display && !mFullscreen) { @@ -1523,13 +1523,13 @@ void LLWindowSDL::flashIcon(F32 seconds) mFlashTimer.reset(); mFlashTimer.setTimerExpirySec(remaining_time); - x11_set_urgent(TRUE); - mFlashing = TRUE; + x11_set_urgent(true); + mFlashing = true; #endif // LL_X11 } } -BOOL LLWindowSDL::isClipboardTextAvailable() +bool LLWindowSDL::isClipboardTextAvailable() { #if LL_X11 return mSDL_Display && XGetSelectionOwner(mSDL_Display, XA_CLIPBOARD) != None; @@ -1538,7 +1538,7 @@ BOOL LLWindowSDL::isClipboardTextAvailable() #endif } -BOOL LLWindowSDL::pasteTextFromClipboard(LLWString &dst) +bool LLWindowSDL::pasteTextFromClipboard(LLWString &dst) { #if LL_X11 return getSelectionText(XA_CLIPBOARD, dst); @@ -1548,13 +1548,13 @@ BOOL LLWindowSDL::pasteTextFromClipboard(LLWString &dst) { dst = LLWString(utf8str_to_wstring(data)); SDL_free(data); - return TRUE; + return true; } - return FALSE; + return false; #endif } -BOOL LLWindowSDL::copyTextToClipboard(const LLWString &s) +bool LLWindowSDL::copyTextToClipboard(const LLWString &s) { #if LL_X11 return setSelectionText(XA_CLIPBOARD, s); @@ -1563,31 +1563,31 @@ BOOL LLWindowSDL::copyTextToClipboard(const LLWString &s) #endif } -BOOL LLWindowSDL::isPrimaryTextAvailable() +bool LLWindowSDL::isPrimaryTextAvailable() { #if LL_X11 LLWString text; return getSelectionText(XA_PRIMARY, text) && !text.empty(); #else - return FALSE; // unsupported + return false; // unsupported #endif } -BOOL LLWindowSDL::pasteTextFromPrimary(LLWString &dst) +bool LLWindowSDL::pasteTextFromPrimary(LLWString &dst) { #if LL_X11 return getSelectionText(XA_PRIMARY, dst); #else - return FALSE; // unsupported + return false; // unsupported #endif } -BOOL LLWindowSDL::copyTextToPrimary(const LLWString &s) +bool LLWindowSDL::copyTextToPrimary(const LLWString &s) { #if LL_X11 return setSelectionText(XA_PRIMARY, s); #else - return FALSE; // unsupported + return false; // unsupported #endif } @@ -1631,62 +1631,62 @@ LLWindow::LLWindowResolution* LLWindowSDL::getSupportedResolutions(S32 &num_reso return mSupportedResolutions; } -BOOL LLWindowSDL::convertCoords(LLCoordGL from, LLCoordWindow *to) +bool LLWindowSDL::convertCoords(LLCoordGL from, LLCoordWindow *to) { if (!to) - return FALSE; + return false; to->mX = from.mX; int h; SDL_GetWindowSize(mWindow, nullptr, &h); to->mY = h - from.mY - 1; - return TRUE; + return true; } -BOOL LLWindowSDL::convertCoords(LLCoordWindow from, LLCoordGL* to) +bool LLWindowSDL::convertCoords(LLCoordWindow from, LLCoordGL* to) { if (!to) - return FALSE; + return false; to->mX = from.mX; int h; SDL_GetWindowSize(mWindow, nullptr, &h); to->mY = h - from.mY - 1; - return TRUE; + return true; } -BOOL LLWindowSDL::convertCoords(LLCoordScreen from, LLCoordWindow* to) +bool LLWindowSDL::convertCoords(LLCoordScreen from, LLCoordWindow* to) { if (!to) - return FALSE; + return false; // In the fullscreen case, window and screen coordinates are the same. to->mX = from.mX; to->mY = from.mY; - return (TRUE); + return (true); } -BOOL LLWindowSDL::convertCoords(LLCoordWindow from, LLCoordScreen *to) +bool LLWindowSDL::convertCoords(LLCoordWindow from, LLCoordScreen *to) { if (!to) - return FALSE; + return false; // In the fullscreen case, window and screen coordinates are the same. to->mX = from.mX; to->mY = from.mY; - return (TRUE); + return (true); } -BOOL LLWindowSDL::convertCoords(LLCoordScreen from, LLCoordGL *to) +bool LLWindowSDL::convertCoords(LLCoordScreen from, LLCoordGL *to) { LLCoordWindow window_coord; return(convertCoords(from, &window_coord) && convertCoords(window_coord, to)); } -BOOL LLWindowSDL::convertCoords(LLCoordGL from, LLCoordScreen *to) +bool LLWindowSDL::convertCoords(LLCoordGL from, LLCoordScreen *to) { LLCoordWindow window_coord; @@ -1703,7 +1703,7 @@ void LLWindowSDL::setupFailure(const std::string& text, const std::string& capti OSMessageBox(text, caption, type); } -BOOL LLWindowSDL::SDLReallyCaptureInput(BOOL capture) +bool LLWindowSDL::SDLReallyCaptureInput(bool capture) { // note: this used to be safe to call nestedly, but in the // end that's not really a wise usage pattern, so don't. @@ -1775,7 +1775,7 @@ BOOL LLWindowSDL::SDLReallyCaptureInput(BOOL capture) return capture == newGrab; } -U32 LLWindowSDL::SDLCheckGrabbyKeys(U32 keysym, BOOL gain) +U32 LLWindowSDL::SDLCheckGrabbyKeys(U32 keysym, bool gain) { /* part of the fix for SL-13243: Some popular window managers like to totally eat alt-drag for the purposes of moving windows. We @@ -1923,7 +1923,7 @@ void LLWindowSDL::processMiscNativeEvents() pump_timer.setTimerExpirySec(1.0f / 15.0f); do { - g_main_context_iteration(g_main_context_default(), FALSE); + g_main_context_iteration(g_main_context_default(), false); } while( g_main_context_pending(g_main_context_default()) && !pump_timer.hasExpired()); #endif @@ -1964,7 +1964,7 @@ void LLWindowSDL::gatherInput() //LL_INFOS() << "SDL_MOUSEMOTION " << event.button.x << " " << event.button.y << " gl " << openGlCoord.mX << " " << openGlCoord.mY << LL_ENDL; - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); mCallbacks->handleMouseMove(this, openGlCoord, mask); break; } @@ -1972,7 +1972,7 @@ void LLWindowSDL::gatherInput() case SDL_TEXTINPUT: { auto string = utf8str_to_utf16str( event.text.text ); - mKeyModifiers = gKeyboard->currentMask( FALSE ); + mKeyModifiers = gKeyboard->currentMask( false ); mInputType = "textinput"; for( auto key: string ) { @@ -2010,8 +2010,8 @@ void LLWindowSDL::gatherInput() } // part of the fix for SL-13243 - if (SDLCheckGrabbyKeys(event.key.keysym.sym, TRUE) != 0) - SDLReallyCaptureInput(TRUE); + if (SDLCheckGrabbyKeys(event.key.keysym.sym, true) != 0) + SDLReallyCaptureInput(true); break; @@ -2026,8 +2026,8 @@ void LLWindowSDL::gatherInput() mKeyVirtualKey = SDLK_RETURN; } - if (SDLCheckGrabbyKeys(mKeyVirtualKey, FALSE) == 0) - SDLReallyCaptureInput(FALSE); // part of the fix for SL-13243 + if (SDLCheckGrabbyKeys(mKeyVirtualKey, false) == 0) + SDLReallyCaptureInput(false); // part of the fix for SL-13243 gKeyboard->handleKeyUp(mKeyVirtualKey,mKeyModifiers); break; @@ -2042,7 +2042,7 @@ void LLWindowSDL::gatherInput() openGlCoord.mX *= getSystemUISize(); openGlCoord.mY *= getSystemUISize(); - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); if (event.button.button == SDL_BUTTON_LEFT) // SDL doesn't manage double clicking... { @@ -2109,7 +2109,7 @@ void LLWindowSDL::gatherInput() openGlCoord.mX *= getSystemUISize(); openGlCoord.mY *= getSystemUISize(); - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); if (event.button.button == SDL_BUTTON_LEFT) // left mCallbacks->handleMouseUp(this, openGlCoord, mask); @@ -2143,13 +2143,13 @@ void LLWindowSDL::gatherInput() { LL_INFOS() << "SDL_WINDOWEVENT_ENTER" << LL_ENDL; if(!mHaveInputFocus) mCallbacks->handleFocus(this); - mHaveInputFocus = TRUE; + mHaveInputFocus = true; } else if(event.window.event == SDL_WINDOWEVENT_LEAVE) { LL_INFOS() << "SDL_WINDOWEVENT_LEAVE" << LL_ENDL; if(mHaveInputFocus) mCallbacks->handleFocusLost(this); - mHaveInputFocus = FALSE; + mHaveInputFocus = false; } else if( event.window.event == SDL_WINDOWEVENT_FOCUS_GAINED ) // <FS:ND> What about SDL_WINDOWEVENT_ENTER (mouse focus) { @@ -2176,14 +2176,14 @@ void LLWindowSDL::gatherInput() else if(event.window.event == SDL_WINDOWEVENT_MINIMIZED) { LL_INFOS() << "SDL_WINDOWEVENT_MINIMIZED" << LL_ENDL; - if(!mIsMinimized) mCallbacks->handleActivate(this,FALSE); - mIsMinimized = TRUE; + if(!mIsMinimized) mCallbacks->handleActivate(this,false); + mIsMinimized = true; } else if(event.window.event == SDL_WINDOWEVENT_MAXIMIZED) { LL_INFOS() << "SDL_WINDOWEVENT_MAXIMIZED" << LL_ENDL; - if(mIsMinimized) mCallbacks->handleActivate(this,TRUE); - mIsMinimized = FALSE; + if(mIsMinimized) mCallbacks->handleActivate(this,true); + mIsMinimized = false; } */ else if (event.window.event == SDL_WINDOWEVENT_EXPOSED) @@ -2228,8 +2228,8 @@ void LLWindowSDL::gatherInput() // expired. if (mFlashing && mFlashTimer.hasExpired()) { - x11_set_urgent(FALSE); - mFlashing = FALSE; + x11_set_urgent(false); + mFlashing = false; } #endif // LL_X11 } @@ -2280,10 +2280,10 @@ static SDL_Cursor *makeSDLCursorFromBMP(const char *filename, int hotx, int hoty U8 srcred = pixelp[0]; U8 srcgreen = pixelp[1]; U8 srcblue = pixelp[2]; - BOOL mask_bit = (srcred != 200) + bool mask_bit = (srcred != 200) || (srcgreen != 200) || (srcblue != 200); - BOOL data_bit = mask_bit && (srcgreen <= 80);//not 0x80 + bool data_bit = mask_bit && (srcgreen <= 80);//not 0x80 unsigned char bit_offset = (cursurface->w/8) * i + j/8; cursor_data[bit_offset] |= (data_bit) << (7 - (j&7)); @@ -2442,8 +2442,8 @@ void LLWindowSDL::hideCursor() if(!mCursorHidden) { // LL_INFOS() << "hideCursor: hiding" << LL_ENDL; - mCursorHidden = TRUE; - mHideCursorPermanent = TRUE; + mCursorHidden = true; + mHideCursorPermanent = true; SDL_ShowCursor(0); } else @@ -2457,8 +2457,8 @@ void LLWindowSDL::showCursor() if(mCursorHidden) { // LL_INFOS() << "showCursor: showing" << LL_ENDL; - mCursorHidden = FALSE; - mHideCursorPermanent = FALSE; + mCursorHidden = false; + mHideCursorPermanent = false; SDL_ShowCursor(1); } else @@ -2480,7 +2480,7 @@ void LLWindowSDL::hideCursorUntilMouseMove() if (!mHideCursorPermanent) { hideCursor(); - mHideCursorPermanent = FALSE; + mHideCursorPermanent = false; } } @@ -2541,9 +2541,9 @@ S32 OSMessageBoxSDL(const std::string& text, const std::string& caption, U32 typ return OSBTN_CANCEL; } -BOOL LLWindowSDL::dialogColorPicker( F32 *r, F32 *g, F32 *b) +bool LLWindowSDL::dialogColorPicker( F32 *r, F32 *g, F32 *b) { - return (FALSE); + return (false); } #if LL_DARWIN @@ -2743,7 +2743,7 @@ void LLWindowSDL::spawnWebBrowser(const std::string& escaped_url, bool async) void LLWindowSDL::openFile(const std::string& file_name) { - spawnWebBrowser("file://"+file_name,TRUE); + spawnWebBrowser("file://"+file_name,true); } void *LLWindowSDL::getPlatformWindow() diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h index 87a3e15731..8d4aeb5efb 100644 --- a/indra/llwindow/llwindowsdl.h +++ b/indra/llwindow/llwindowsdl.h @@ -58,38 +58,38 @@ public: void close() override; - BOOL getVisible() override; + bool getVisible() override; - BOOL getMinimized() override; + bool getMinimized() override; - BOOL getMaximized() override; + bool getMaximized() override; - BOOL maximize() override; + bool maximize() override; void minimize() override; void restore() override; - BOOL getFullscreen(); + bool getFullscreen(); - BOOL getPosition(LLCoordScreen *position) override; + bool getPosition(LLCoordScreen *position) override; - BOOL getSize(LLCoordScreen *size) override; + bool getSize(LLCoordScreen *size) override; - BOOL getSize(LLCoordWindow *size) override; + bool getSize(LLCoordWindow *size) override; - BOOL setPosition(LLCoordScreen position) override; + bool setPosition(LLCoordScreen position) override; - BOOL setSizeImpl(LLCoordScreen size) override; + bool setSizeImpl(LLCoordScreen size) override; - BOOL setSizeImpl(LLCoordWindow size) override; + bool setSizeImpl(LLCoordWindow size) override; - BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, + bool switchContext(bool fullscreen, const LLCoordScreen &size, bool disable_vsync, const LLCoordScreen *const posp = NULL) override; - BOOL setCursorPosition(LLCoordWindow position) override; + bool setCursorPosition(LLCoordWindow position) override; - BOOL getCursorPosition(LLCoordWindow *position) override; + bool getCursorPosition(LLCoordWindow *position) override; void showCursor() override; @@ -99,7 +99,7 @@ public: void hideCursorUntilMouseMove() override; - BOOL isCursorHidden() override; + bool isCursorHidden() override; void updateCursor() override; @@ -107,32 +107,32 @@ public: void releaseMouse() override; - void setMouseClipping(BOOL b) override; + void setMouseClipping(bool b) override; void setMinSize(U32 min_width, U32 min_height, bool enforce_immediately = true) override; - BOOL isClipboardTextAvailable() override; + bool isClipboardTextAvailable() override; - BOOL pasteTextFromClipboard(LLWString &dst) override; + bool pasteTextFromClipboard(LLWString &dst) override; - BOOL copyTextToClipboard(const LLWString &src) override; + bool copyTextToClipboard(const LLWString &src) override; - BOOL isPrimaryTextAvailable() override; + bool isPrimaryTextAvailable() override; - BOOL pasteTextFromPrimary(LLWString &dst) override; + bool pasteTextFromPrimary(LLWString &dst) override; - BOOL copyTextToPrimary(const LLWString &src) override; + bool copyTextToPrimary(const LLWString &src) override; void flashIcon(F32 seconds) override; F32 getGamma() override; - BOOL setGamma(const F32 gamma) override; // Set the gamma + bool setGamma(const F32 gamma) override; // Set the gamma U32 getFSAASamples() override; void setFSAASamples(const U32 samples) override; - BOOL restoreGamma() override; // Restore original gamma table (before updating gamma) + bool restoreGamma() override; // Restore original gamma table (before updating gamma) ESwapMethod getSwapMethod() override { return mSwapMethod; } void processMiscNativeEvents() override; @@ -146,17 +146,17 @@ public: void delayInputProcessing() override {}; // handy coordinate space conversion routines - BOOL convertCoords(LLCoordScreen from, LLCoordWindow *to) override; + bool convertCoords(LLCoordScreen from, LLCoordWindow *to) override; - BOOL convertCoords(LLCoordWindow from, LLCoordScreen *to) override; + bool convertCoords(LLCoordWindow from, LLCoordScreen *to) override; - BOOL convertCoords(LLCoordWindow from, LLCoordGL *to) override; + bool convertCoords(LLCoordWindow from, LLCoordGL *to) override; - BOOL convertCoords(LLCoordGL from, LLCoordWindow *to) override; + bool convertCoords(LLCoordGL from, LLCoordWindow *to) override; - BOOL convertCoords(LLCoordScreen from, LLCoordGL *to) override; + bool convertCoords(LLCoordScreen from, LLCoordGL *to) override; - BOOL convertCoords(LLCoordGL from, LLCoordScreen *to) override; + bool convertCoords(LLCoordGL from, LLCoordScreen *to) override; LLWindowResolution *getSupportedResolutions(S32 &num_resolutions) override; @@ -172,7 +172,7 @@ public: void afterDialog() override; - BOOL dialogColorPicker(F32 *r, F32 *g, F32 *b) override; + bool dialogColorPicker(F32 *r, F32 *g, F32 *b) override; void *getPlatformWindow() override; @@ -208,7 +208,7 @@ public: #endif // LL_X11 #if LL_DARWIN - static BOOL sUseMultGL; + static bool sUseMultGL; #endif void *createSharedContext() override; @@ -224,12 +224,12 @@ public: protected: LLWindowSDL(LLWindowCallbacks *callbacks, const std::string &title, int x, int y, int width, int height, U32 flags, - BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl, - BOOL ignore_pixel_depth, U32 fsaa_samples); + bool fullscreen, bool clearBg, bool disable_vsync, bool use_gl, + bool ignore_pixel_depth, U32 fsaa_samples); ~LLWindowSDL(); - BOOL isValid() override; + bool isValid() override; LLSD getNativeKeyData() override; @@ -240,12 +240,12 @@ protected: void moveWindow(const LLCoordScreen &position, const LLCoordScreen &size); // Changes display resolution. Returns true if successful - BOOL setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh); + bool setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh); // Go back to last fullscreen display resolution. - BOOL setFullscreenResolution(); + bool setFullscreenResolution(); - BOOL shouldPostQuit() { return mPostQuit; } + bool shouldPostQuit() { return mPostQuit; } protected: // @@ -253,7 +253,7 @@ protected: // // create or re-create the GL context/window. Called from the constructor and switchContext(). - BOOL createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, BOOL disable_vsync); + bool createContext(int x, int y, int width, int height, int bits, bool fullscreen, bool disable_vsync); void destroyContext(); @@ -261,9 +261,9 @@ protected: void fixWindowSize(void); - U32 SDLCheckGrabbyKeys(U32 keysym, BOOL gain); + U32 SDLCheckGrabbyKeys(U32 keysym, bool gain); - BOOL SDLReallyCaptureInput(BOOL capture); + bool SDLReallyCaptureInput(bool capture); // // Platform specific variables @@ -277,7 +277,7 @@ protected: std::string mWindowTitle; double mOriginalAspectRatio; - BOOL mNeedsResize; // Constructor figured out the window is too big, it needs a resize. + bool mNeedsResize; // Constructor figured out the window is too big, it needs a resize. LLCoordScreen mNeedsResizeSize; F32 mOverrideAspectRatio; F32 mGamma; @@ -294,9 +294,9 @@ protected: private: #if LL_X11 - void x11_set_urgent(BOOL urgent); + void x11_set_urgent(bool urgent); - BOOL mFlashing; + bool mFlashing; LLTimer mFlashTimer; #endif //LL_X11 diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 12cd5320b8..fee0de7739 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -92,7 +92,7 @@ const F32 ICON_FLASH_TIME = 0.5f; const UINT WM_DUMMY_(WM_USER + 0x0017); const UINT WM_POST_FUNCTION_(WM_USER + 0x0018); -extern BOOL gDebugWindowProc; +extern bool gDebugWindowProc; static std::thread::id sWindowThreadId; static std::thread::id sMainThreadId; @@ -167,10 +167,10 @@ GLuint SafeChoosePixelFormat(HDC &hdc, const PIXELFORMATDESCRIPTOR *ppfd) } //static -BOOL LLWindowWin32::sIsClassRegistered = FALSE; +bool LLWindowWin32::sIsClassRegistered = false; -BOOL LLWindowWin32::sLanguageTextInputAllowed = TRUE; -BOOL LLWindowWin32::sWinIMEOpened = FALSE; +bool LLWindowWin32::sLanguageTextInputAllowed = true; +bool LLWindowWin32::sWinIMEOpened = false; HKL LLWindowWin32::sWinInputLocale = 0; DWORD LLWindowWin32::sWinIMEConversionMode = IME_CMODE_NATIVE; DWORD LLWindowWin32::sWinIMESentenceMode = IME_SMODE_AUTOMATIC; @@ -189,24 +189,24 @@ public: public: // Wrappers for IMM API. - static BOOL isIME(HKL hkl); + static bool isIME(HKL hkl); static HIMC getContext(HWND hwnd); - static BOOL releaseContext(HWND hwnd, HIMC himc); - static BOOL getOpenStatus(HIMC himc); - static BOOL setOpenStatus(HIMC himc, BOOL status); - static BOOL getConversionStatus(HIMC himc, LPDWORD conversion, LPDWORD sentence); - static BOOL setConversionStatus(HIMC himc, DWORD conversion, DWORD sentence); - static BOOL getCompositionWindow(HIMC himc, LPCOMPOSITIONFORM form); - static BOOL setCompositionWindow(HIMC himc, LPCOMPOSITIONFORM form); + static bool releaseContext(HWND hwnd, HIMC himc); + static bool getOpenStatus(HIMC himc); + static bool setOpenStatus(HIMC himc, bool status); + static bool getConversionStatus(HIMC himc, LPDWORD conversion, LPDWORD sentence); + static bool setConversionStatus(HIMC himc, DWORD conversion, DWORD sentence); + static bool getCompositionWindow(HIMC himc, LPCOMPOSITIONFORM form); + static bool setCompositionWindow(HIMC himc, LPCOMPOSITIONFORM form); static LONG getCompositionString(HIMC himc, DWORD index, LPVOID data, DWORD length); - static BOOL setCompositionString(HIMC himc, DWORD index, LPVOID pComp, DWORD compLength, LPVOID pRead, DWORD readLength); - static BOOL setCompositionFont(HIMC himc, LPLOGFONTW logfont); - static BOOL setCandidateWindow(HIMC himc, LPCANDIDATEFORM candidate_form); - static BOOL notifyIME(HIMC himc, DWORD action, DWORD index, DWORD value); + static bool setCompositionString(HIMC himc, DWORD index, LPVOID pComp, DWORD compLength, LPVOID pRead, DWORD readLength); + static bool setCompositionFont(HIMC himc, LPLOGFONTW logfont); + static bool setCandidateWindow(HIMC himc, LPCANDIDATEFORM candidate_form); + static bool notifyIME(HIMC himc, DWORD action, DWORD index, DWORD value); }; // static -BOOL LLWinImm::isIME(HKL hkl) +bool LLWinImm::isIME(HKL hkl) { return ImmIsIME(hkl); } @@ -218,43 +218,43 @@ HIMC LLWinImm::getContext(HWND hwnd) } //static -BOOL LLWinImm::releaseContext(HWND hwnd, HIMC himc) +bool LLWinImm::releaseContext(HWND hwnd, HIMC himc) { return ImmReleaseContext(hwnd, himc); } // static -BOOL LLWinImm::getOpenStatus(HIMC himc) +bool LLWinImm::getOpenStatus(HIMC himc) { return ImmGetOpenStatus(himc); } // static -BOOL LLWinImm::setOpenStatus(HIMC himc, BOOL status) +bool LLWinImm::setOpenStatus(HIMC himc, bool status) { return ImmSetOpenStatus(himc, status); } // static -BOOL LLWinImm::getConversionStatus(HIMC himc, LPDWORD conversion, LPDWORD sentence) +bool LLWinImm::getConversionStatus(HIMC himc, LPDWORD conversion, LPDWORD sentence) { return ImmGetConversionStatus(himc, conversion, sentence); } // static -BOOL LLWinImm::setConversionStatus(HIMC himc, DWORD conversion, DWORD sentence) +bool LLWinImm::setConversionStatus(HIMC himc, DWORD conversion, DWORD sentence) { return ImmSetConversionStatus(himc, conversion, sentence); } // static -BOOL LLWinImm::getCompositionWindow(HIMC himc, LPCOMPOSITIONFORM form) +bool LLWinImm::getCompositionWindow(HIMC himc, LPCOMPOSITIONFORM form) { return ImmGetCompositionWindow(himc, form); } // static -BOOL LLWinImm::setCompositionWindow(HIMC himc, LPCOMPOSITIONFORM form) +bool LLWinImm::setCompositionWindow(HIMC himc, LPCOMPOSITIONFORM form) { return ImmSetCompositionWindow(himc, form); } @@ -268,25 +268,25 @@ LONG LLWinImm::getCompositionString(HIMC himc, DWORD index, LPVOID data, // static -BOOL LLWinImm::setCompositionString(HIMC himc, DWORD index, LPVOID pComp, DWORD compLength, LPVOID pRead, DWORD readLength) +bool LLWinImm::setCompositionString(HIMC himc, DWORD index, LPVOID pComp, DWORD compLength, LPVOID pRead, DWORD readLength) { return ImmSetCompositionString(himc, index, pComp, compLength, pRead, readLength); } // static -BOOL LLWinImm::setCompositionFont(HIMC himc, LPLOGFONTW pFont) +bool LLWinImm::setCompositionFont(HIMC himc, LPLOGFONTW pFont) { return ImmSetCompositionFont(himc, pFont); } // static -BOOL LLWinImm::setCandidateWindow(HIMC himc, LPCANDIDATEFORM form) +bool LLWinImm::setCandidateWindow(HIMC himc, LPCANDIDATEFORM form) { return ImmSetCandidateWindow(himc, form); } // static -BOOL LLWinImm::notifyIME(HIMC himc, DWORD action, DWORD index, DWORD value) +bool LLWinImm::notifyIME(HIMC himc, DWORD action, DWORD index, DWORD value) { return ImmNotifyIME(himc, action, index, value); } @@ -350,22 +350,8 @@ struct LLWindowWin32::LLWindowWin32Thread : public LL::ThreadPool mGLReady = true; } - // initialzie DXGI adapter (for querying available VRAM) - void initDX(); - - // initialize D3D (if DXGI cannot be used) - void initD3D(); - - //clean up DXGI/D3D resources - void cleanupDX(); - - // call periodically to update available VRAM - void updateVRAMUsage(); - - U32 getAvailableVRAMMegabytes() - { - return mAvailableVRAM; - } + // Use DXGI to check memory (because WMI doesn't report more than 4Gb) + void checkDXMem(); /// called by main thread to post work to this window thread template <typename CALLABLE> @@ -407,33 +393,24 @@ struct LLWindowWin32::LLWindowWin32Thread : public LL::ThreadPool using FuncType = std::function<void()>; // call GetMessage() and pull enqueue messages for later processing - void gatherInput(); HWND mWindowHandleThrd = NULL; HDC mhDCThrd = 0; // *HACK: Attempt to prevent startup crashes by deferring memory accounting // until after some graphics setup. See SL-20177. -Cosmic,2023-09-18 bool mGLReady = false; - // best guess at available video memory in MB - std::atomic<U32> mAvailableVRAM; - - U32 mMaxVRAM = 0; // maximum amount of vram to allow in the "budget", or 0 for no maximum (see updateVRAMUsage) - - IDXGIAdapter3* mDXGIAdapter = nullptr; - LPDIRECT3D9 mD3D = nullptr; - LPDIRECT3DDEVICE9 mD3DDevice = nullptr; + bool mGotGLBuffer = false; }; LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, U32 flags, - BOOL fullscreen, BOOL clearBg, - BOOL enable_vsync, BOOL use_gl, - BOOL ignore_pixel_depth, + bool fullscreen, bool clearBg, + bool enable_vsync, bool use_gl, + bool ignore_pixel_depth, U32 fsaa_samples, U32 max_cores, - U32 max_vram, F32 max_gl_version) : LLWindow(callbacks, fullscreen, flags), @@ -442,7 +419,6 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, { sMainThreadId = LLThread::currentID(); mWindowThread = new LLWindowWin32Thread(); - mWindowThread->mMaxVRAM = max_vram; //MAINT-516 -- force a load of opengl32.dll just in case windows went sideways LoadLibrary(L"opengl32.dll"); @@ -454,7 +430,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, mMaxCores = llmin(mMaxCores, (U32) 64); DWORD_PTR mask = 0; - for (int i = 0; i < mMaxCores; ++i) + for (U32 i = 0; i < mMaxCores; ++i) { mask |= ((DWORD_PTR) 1) << i; } @@ -523,7 +499,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, mIconResource = gIconResource; mOverrideAspectRatio = 0.f; mNativeAspectRatio = 0.f; - mInputProcessingPaused = FALSE; + mInputProcessingPaused = false; mPreeditor = NULL; mKeyCharCode = 0; mKeyScanCode = 0; @@ -532,7 +508,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, mhRC = NULL; memset(mCurrentGammaRamp, 0, sizeof(mCurrentGammaRamp)); memset(mPrevGammaRamp, 0, sizeof(mPrevGammaRamp)); - mCustomGammaSet = FALSE; + mCustomGammaSet = false; mWindowHandle = NULL; mRect = {0, 0, 0, 0}; @@ -540,7 +516,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, if (!SystemParametersInfo(SPI_GETMOUSEVANISH, 0, &mMouseVanish, 0)) { - mMouseVanish = TRUE; + mMouseVanish = true; } // Initialize the keyboard @@ -552,7 +528,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, // Initialize (boot strap) the Language text input management, // based on the system's (user's) default settings. - allowLanguageTextInput(mPreeditor, FALSE); + allowLanguageTextInput(mPreeditor, false); WNDCLASS wc; RECT window_rect; @@ -670,7 +646,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, mCallbacks->translateString("MBError"), OSMB_OK); return; } - sIsClassRegistered = TRUE; + sIsClassRegistered = true; } //----------------------------------------------------------------------- @@ -698,7 +674,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, //----------------------------------------------------------------------- if (mFullscreen) { - BOOL success = FALSE; + bool success = false; DWORD closest_refresh = 0; for (S32 mode_num = 0;; mode_num++) @@ -712,7 +688,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, dev_mode.dmPelsHeight == height && dev_mode.dmBitsPerPel == BITS_PER_PIXEL) { - success = TRUE; + success = true; if ((dev_mode.dmDisplayFrequency - current_refresh) < (closest_refresh - current_refresh)) { @@ -724,11 +700,11 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, if (closest_refresh == 0) { LL_WARNS("Window") << "Couldn't find display mode " << width << " by " << height << " at " << BITS_PER_PIXEL << " bits per pixel" << LL_ENDL; - //success = FALSE; + //success = false; if (!EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dev_mode)) { - success = FALSE; + success = false; } else { @@ -737,12 +713,12 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, LL_WARNS("Window") << "Current BBP is OK falling back to that" << LL_ENDL; window_rect.right=width=dev_mode.dmPelsWidth; window_rect.bottom=height=dev_mode.dmPelsHeight; - success = TRUE; + success = true; } else { LL_WARNS("Window") << "Current BBP is BAD" << LL_ENDL; - success = FALSE; + success = false; } } } @@ -760,7 +736,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, // If it failed, we don't want to run fullscreen if (success) { - mFullscreen = TRUE; + mFullscreen = true; mFullscreenWidth = dev_mode.dmPelsWidth; mFullscreenHeight = dev_mode.dmPelsHeight; mFullscreenBits = dev_mode.dmBitsPerPel; @@ -774,7 +750,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, } else { - mFullscreen = FALSE; + mFullscreen = false; mFullscreenWidth = -1; mFullscreenHeight = -1; mFullscreenBits = -1; @@ -855,7 +831,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, // Initialize (boot strap) the Language text input management, // based on the system's (or user's) default settings. - allowLanguageTextInput(NULL, FALSE); + allowLanguageTextInput(NULL, false); } @@ -885,14 +861,14 @@ void LLWindowWin32::show() void LLWindowWin32::hide() { - setMouseClipping(FALSE); + setMouseClipping(false); ShowWindow(mWindowHandle, SW_HIDE); } //virtual void LLWindowWin32::minimize() { - setMouseClipping(FALSE); + setMouseClipping(false); showCursor(); ShowWindow(mWindowHandle, SW_MINIMIZE); } @@ -949,7 +925,7 @@ void LLWindowWin32::close() // Make sure cursor is visible and we haven't mangled the clipping state. showCursor(); - setMouseClipping(FALSE); + setMouseClipping(false); if (gKeyboard) { gKeyboard->resetKeys(); @@ -989,29 +965,29 @@ void LLWindowWin32::close() mWindowThread->wakeAndDestroy(); } -BOOL LLWindowWin32::isValid() +bool LLWindowWin32::isValid() { return (mWindowHandle != NULL); } -BOOL LLWindowWin32::getVisible() +bool LLWindowWin32::getVisible() { return (mWindowHandle && IsWindowVisible(mWindowHandle)); } -BOOL LLWindowWin32::getMinimized() +bool LLWindowWin32::getMinimized() { return (mWindowHandle && IsIconic(mWindowHandle)); } -BOOL LLWindowWin32::getMaximized() +bool LLWindowWin32::getMaximized() { return (mWindowHandle && IsZoomed(mWindowHandle)); } -BOOL LLWindowWin32::maximize() +bool LLWindowWin32::maximize() { - BOOL success = FALSE; + bool success = false; if (!mWindowHandle) return success; mWindowThread->post([=] @@ -1026,56 +1002,56 @@ BOOL LLWindowWin32::maximize() } }); - return TRUE; + return true; } -BOOL LLWindowWin32::getFullscreen() +bool LLWindowWin32::getFullscreen() { return mFullscreen; } -BOOL LLWindowWin32::getPosition(LLCoordScreen *position) +bool LLWindowWin32::getPosition(LLCoordScreen *position) { position->mX = mRect.left; position->mY = mRect.top; - return TRUE; + return true; } -BOOL LLWindowWin32::getSize(LLCoordScreen *size) +bool LLWindowWin32::getSize(LLCoordScreen *size) { size->mX = mRect.right - mRect.left; size->mY = mRect.bottom - mRect.top; - return TRUE; + return true; } -BOOL LLWindowWin32::getSize(LLCoordWindow *size) +bool LLWindowWin32::getSize(LLCoordWindow *size) { size->mX = mClientRect.right - mClientRect.left; size->mY = mClientRect.bottom - mClientRect.top; - return TRUE; + return true; } -BOOL LLWindowWin32::setPosition(const LLCoordScreen position) +bool LLWindowWin32::setPosition(const LLCoordScreen position) { LLCoordScreen size; if (!mWindowHandle) { - return FALSE; + return false; } getSize(&size); moveWindow(position, size); - return TRUE; + return true; } -BOOL LLWindowWin32::setSizeImpl(const LLCoordScreen size) +bool LLWindowWin32::setSizeImpl(const LLCoordScreen size) { LLCoordScreen position; getPosition(&position); if (!mWindowHandle) { - return FALSE; + return false; } mWindowThread->post([=]() @@ -1091,10 +1067,10 @@ BOOL LLWindowWin32::setSizeImpl(const LLCoordScreen size) }); moveWindow(position, size); - return TRUE; + return true; } -BOOL LLWindowWin32::setSizeImpl(const LLCoordWindow size) +bool LLWindowWin32::setSizeImpl(const LLCoordWindow size) { RECT window_rect = {0, 0, size.mX, size.mY }; DWORD dw_ex_style = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; @@ -1106,7 +1082,7 @@ BOOL LLWindowWin32::setSizeImpl(const LLCoordWindow size) } // changing fullscreen resolution -BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BOOL enable_vsync, const LLCoordScreen* const posp) +bool LLWindowWin32::switchContext(bool fullscreen, const LLCoordScreen& size, bool enable_vsync, const LLCoordScreen* const posp) { //called from main thread GLuint pixel_format; @@ -1119,11 +1095,11 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO RECT window_rect = { 0, 0, 0, 0 }; S32 width = size.mX; S32 height = size.mY; - BOOL auto_show = FALSE; + bool auto_show = false; if (mhRC) { - auto_show = TRUE; + auto_show = true; resetDisplayResolution(); } @@ -1156,8 +1132,8 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO if (fullscreen) { - mFullscreen = TRUE; - BOOL success = FALSE; + mFullscreen = true; + bool success = false; DWORD closest_refresh = 0; for (S32 mode_num = 0;; mode_num++) @@ -1171,7 +1147,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO dev_mode.dmPelsHeight == height && dev_mode.dmBitsPerPel == BITS_PER_PIXEL) { - success = TRUE; + success = true; if ((dev_mode.dmDisplayFrequency - current_refresh) < (closest_refresh - current_refresh)) { @@ -1183,7 +1159,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO if (closest_refresh == 0) { LL_WARNS("Window") << "Couldn't find display mode " << width << " by " << height << " at " << BITS_PER_PIXEL << " bits per pixel" << LL_ENDL; - return FALSE; + return false; } // If we found a good resolution, use it. @@ -1198,7 +1174,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO if (success) { - mFullscreen = TRUE; + mFullscreen = true; mFullscreenWidth = dev_mode.dmPelsWidth; mFullscreenHeight = dev_mode.dmPelsHeight; mFullscreenBits = dev_mode.dmBitsPerPel; @@ -1224,19 +1200,19 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO // If it failed, we don't want to run fullscreen else { - mFullscreen = FALSE; + mFullscreen = false; mFullscreenWidth = -1; mFullscreenHeight = -1; mFullscreenBits = -1; mFullscreenRefresh = -1; LL_INFOS("Window") << "Unable to run fullscreen at " << width << "x" << height << LL_ENDL; - return FALSE; + return false; } } else { - mFullscreen = FALSE; + mFullscreen = false; window_rect.left = (long)(posp ? posp->mX : 0); window_rect.right = (long)width + window_rect.left; // Windows GDI rects don't include rightmost pixel window_rect.top = (long)(posp ? posp->mY : 0); @@ -1248,7 +1224,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO // don't post quit messages when destroying old windows - mPostQuit = FALSE; + mPostQuit = false; // create window @@ -1298,7 +1274,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO close(); OSMessageBox(mCallbacks->translateString("MBDevContextErr"), mCallbacks->translateString("MBError"), OSMB_OK); - return FALSE; + return false; } LL_INFOS("Window") << "Device context retrieved." << LL_ENDL ; @@ -1312,7 +1288,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO OSMessageBox(mCallbacks->translateString("MBPixelFmtErr"), mCallbacks->translateString("MBError"), OSMB_OK); close(); - return FALSE; + return false; } } catch (...) @@ -1321,7 +1297,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO OSMessageBox(mCallbacks->translateString("MBPixelFmtErr"), mCallbacks->translateString("MBError"), OSMB_OK); close(); - return FALSE; + return false; } LL_INFOS("Window") << "Pixel format chosen." << LL_ENDL ; @@ -1333,7 +1309,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO OSMessageBox(mCallbacks->translateString("MBPixelFmtDescErr"), mCallbacks->translateString("MBError"), OSMB_OK); close(); - return FALSE; + return false; } // (EXP-1765) dump pixel data to see if there is a pattern that leads to unreproducible crash @@ -1372,7 +1348,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO OSMessageBox(mCallbacks->translateString("MBPixelFmtSetErr"), mCallbacks->translateString("MBError"), OSMB_OK); close(); - return FALSE; + return false; } @@ -1381,7 +1357,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO OSMessageBox(mCallbacks->translateString("MBGLContextErr"), mCallbacks->translateString("MBError"), OSMB_OK); close(); - return FALSE; + return false; } if (!wglMakeCurrent(mhDC, mhRC)) @@ -1389,7 +1365,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO OSMessageBox(mCallbacks->translateString("MBGLContextActErr"), mCallbacks->translateString("MBError"), OSMB_OK); close(); - return FALSE; + return false; } LL_INFOS("Window") << "Drawing context is created." << LL_ENDL ; @@ -1481,7 +1457,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO close(); show_window_creation_error("Error after wglChoosePixelFormatARB 32-bit"); - return FALSE; + return false; } if (!num_formats) @@ -1496,7 +1472,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO { close(); show_window_creation_error("Error after wglChoosePixelFormatARB 32-bit no AA"); - return FALSE; + return false; } } @@ -1510,7 +1486,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO { close(); show_window_creation_error("Error after wglChoosePixelFormatARB 24-bit"); - return FALSE; + return false; } if (!num_formats) @@ -1522,7 +1498,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO { close(); show_window_creation_error("Error after wglChoosePixelFormatARB 16-bit"); - return FALSE; + return false; } } } @@ -1595,7 +1571,7 @@ const S32 max_format = (S32)num_formats - 1; { OSMessageBox(mCallbacks->translateString("MBDevContextErr"), mCallbacks->translateString("MBError"), OSMB_OK); close(); - return FALSE; + return false; } if (!SetPixelFormat(mhDC, pixel_format, &pfd)) @@ -1603,7 +1579,7 @@ const S32 max_format = (S32)num_formats - 1; OSMessageBox(mCallbacks->translateString("MBPixelFmtSetErr"), mCallbacks->translateString("MBError"), OSMB_OK); close(); - return FALSE; + return false; } if (wglGetPixelFormatAttribivARB(mhDC, pixel_format, 0, 1, &swap_query, &swap_method)) @@ -1642,7 +1618,7 @@ const S32 max_format = (S32)num_formats - 1; { OSMessageBox(mCallbacks->translateString("MBPixelFmtDescErr"), mCallbacks->translateString("MBError"), OSMB_OK); close(); - return FALSE; + return false; } LL_INFOS("Window") << "GL buffer: Color Bits " << S32(pfd.cColorBits) @@ -1656,7 +1632,7 @@ const S32 max_format = (S32)num_formats - 1; mhRC = (HGLRC) createSharedContext(); if (!mhRC) { - return FALSE; + return false; } } @@ -1664,14 +1640,14 @@ const S32 max_format = (S32)num_formats - 1; { OSMessageBox(mCallbacks->translateString("MBGLContextActErr"), mCallbacks->translateString("MBError"), OSMB_OK); close(); - return FALSE; + return false; } if (!gGLManager.initGL()) { OSMessageBox(mCallbacks->translateString("MBVideoDrvErr"), mCallbacks->translateString("MBError"), OSMB_OK); close(); - return FALSE; + return false; } // Disable vertical sync for swap @@ -1688,7 +1664,7 @@ const S32 max_format = (S32)num_formats - 1; SetTimer( mWindowHandle, 0, 1000 / 30, NULL ); // 30 fps timer // ok to post quit messages now - mPostQuit = TRUE; + mPostQuit = true; // *HACK: Attempt to prevent startup crashes by deferring memory accounting // until after some graphics setup. See SL-20177. -Cosmic,2023-09-18 @@ -1707,7 +1683,7 @@ const S32 max_format = (S32)num_formats - 1; LL_PROFILER_GPU_CONTEXT; - return TRUE; + return true; } void LLWindowWin32::recreateWindow(RECT window_rect, DWORD dw_ex_style, DWORD dw_style) @@ -1936,13 +1912,13 @@ void LLWindowWin32::setTitle(const std::string title) }); } -BOOL LLWindowWin32::setCursorPosition(const LLCoordWindow position) +bool LLWindowWin32::setCursorPosition(const LLCoordWindow position) { ASSERT_MAIN_THREAD(); if (!mWindowHandle) { - return FALSE; + return false; } LLCoordScreen screen_pos(position.convert()); @@ -1962,31 +1938,31 @@ BOOL LLWindowWin32::setCursorPosition(const LLCoordWindow position) SetCursorPos(screen_pos.mX, screen_pos.mY); }); - return TRUE; + return true; } -BOOL LLWindowWin32::getCursorPosition(LLCoordWindow *position) +bool LLWindowWin32::getCursorPosition(LLCoordWindow *position) { ASSERT_MAIN_THREAD(); if (!position) { - return FALSE; + return false; } *position = mCursorPosition; - return TRUE; + return true; } -BOOL LLWindowWin32::getCursorDelta(LLCoordCommon* delta) +bool LLWindowWin32::getCursorDelta(LLCoordCommon* delta) { if (delta == nullptr) { - return FALSE; + return false; } *delta = mMouseFrameDelta; - return TRUE; + return true; } void LLWindowWin32::hideCursor() @@ -2001,8 +1977,8 @@ void LLWindowWin32::hideCursor() } }); - mCursorHidden = TRUE; - mHideCursorPermanent = TRUE; + mCursorHidden = true; + mHideCursorPermanent = true; } void LLWindowWin32::showCursor() @@ -2020,8 +1996,8 @@ void LLWindowWin32::showCursor() } }); - mCursorHidden = FALSE; - mHideCursorPermanent = FALSE; + mCursorHidden = false; + mHideCursorPermanent = false; } void LLWindowWin32::showCursorFromMouseMove() @@ -2037,11 +2013,11 @@ void LLWindowWin32::hideCursorUntilMouseMove() if (!mHideCursorPermanent && mMouseVanish) { hideCursor(); - mHideCursorPermanent = FALSE; + mHideCursorPermanent = false; } } -BOOL LLWindowWin32::isCursorHidden() +bool LLWindowWin32::isCursorHidden() { return mCursorHidden; } @@ -2161,7 +2137,7 @@ void LLWindowWin32::releaseMouse() void LLWindowWin32::delayInputProcessing() { - mInputProcessingPaused = TRUE; + mInputProcessingPaused = true; } @@ -2242,7 +2218,7 @@ void LLWindowWin32::gatherInput() } } - mInputProcessingPaused = FALSE; + mInputProcessingPaused = false; updateCursor(); } @@ -2287,7 +2263,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ // pass along extended flag in mask MASK mask = (l_param >> 16 & KF_EXTENDED) ? MASK_EXTENDED : 0x0; - BOOL eat_keystroke = TRUE; + bool eat_keystroke = true; switch (u_msg) { @@ -2309,7 +2285,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ { WINDOW_IMP_POST(window_imp->mCallbacks->handleDeviceChange(window_imp)); - return TRUE; + return 1; } break; } @@ -2466,8 +2442,9 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ { LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_SYSKEYDOWN"); // allow system keys, such as ALT-F4 to be processed by Windows - eat_keystroke = FALSE; + eat_keystroke = false; // intentional fall-through here + [[fallthrough]]; } case WM_KEYDOWN: { @@ -2487,8 +2464,9 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ break; } case WM_SYSKEYUP: - eat_keystroke = FALSE; + eat_keystroke = false; // intentional fall-through here + [[fallthrough]]; case WM_KEYUP: { LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_KEYUP"); @@ -2579,9 +2557,9 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ // characters. We just need to take care of surrogate pairs sent as two WM_CHAR's // by ourselves. It is not that tough. -- Alissa Sabre @ SL - // Even if LLWindowCallbacks::handleUnicodeChar(llwchar, BOOL) returned FALSE, + // Even if LLWindowCallbacks::handleUnicodeChar(llwchar, bool) returned false, // we *did* processed the event, so I believe we should not pass it to DefWindowProc... - window_imp->handleUnicodeUTF16((U16)w_param, gKeyboard->currentMask(FALSE)); + window_imp->handleUnicodeUTF16((U16)w_param, gKeyboard->currentMask(false)); }); return 0; } @@ -2612,7 +2590,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ window_imp->interruptLanguageTextInput(); } - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); auto gl_coord = window_imp->mCursorPosition.convert(); window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask); window_imp->mCallbacks->handleMouseDown(window_imp, gl_coord, mask); @@ -2635,7 +2613,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ sHandleDoubleClick = true; return; } - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); // generate move event to update mouse coordinates window_imp->mCursorPosition = window_coord; @@ -2659,7 +2637,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ sHandleDoubleClick = true; - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); // generate move event to update mouse coordinates window_imp->mCursorPosition = window_coord; window_imp->mCallbacks->handleMouseUp(window_imp, window_imp->mCursorPosition.convert(), mask); @@ -2680,7 +2658,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ WINDOW_IMP_POST(window_imp->interruptLanguageTextInput()); } - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); // generate move event to update mouse coordinates auto gl_coord = window_imp->mCursorPosition.convert(); window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask); @@ -2698,7 +2676,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER); window_imp->postMouseButtonEvent([=]() { - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); window_imp->mCallbacks->handleRightMouseUp(window_imp, window_imp->mCursorPosition.convert(), mask); }); } @@ -2718,7 +2696,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ window_imp->interruptLanguageTextInput(); } - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); window_imp->mCallbacks->handleMiddleMouseDown(window_imp, window_imp->mCursorPosition.convert(), mask); }); } @@ -2732,7 +2710,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER); window_imp->postMouseButtonEvent([=]() { - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); window_imp->mCallbacks->handleMiddleMouseUp(window_imp, window_imp->mCursorPosition.convert(), mask); }); } @@ -2750,7 +2728,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ window_imp->interruptLanguageTextInput(); } - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); // Windows uses numbers 1 and 2 for buttons, remap to 4, 5 window_imp->mCallbacks->handleOtherMouseDown(window_imp, window_imp->mCursorPosition.convert(), mask, button + 3); }); @@ -2767,7 +2745,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER); S32 button = GET_XBUTTON_WPARAM(w_param); - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); // Windows uses numbers 1 and 2 for buttons, remap to 4, 5 window_imp->mCallbacks->handleOtherMouseUp(window_imp, window_imp->mCursorPosition.convert(), mask, button + 3); }); @@ -2877,7 +2855,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ { LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_MOUSEMOVE lambda"); - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); window_imp->mMouseMask = mask; window_imp->mCursorPosition = window_coord; }); @@ -2914,19 +2892,19 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ // means that the window was un-minimized. if (w_param == SIZE_RESTORED && window_imp->mLastSizeWParam != SIZE_RESTORED) { - WINDOW_IMP_POST(window_imp->mCallbacks->handleActivate(window_imp, TRUE)); + WINDOW_IMP_POST(window_imp->mCallbacks->handleActivate(window_imp, true)); } // handle case of window being maximized from fully minimized state if (w_param == SIZE_MAXIMIZED && window_imp->mLastSizeWParam != SIZE_MAXIMIZED) { - WINDOW_IMP_POST(window_imp->mCallbacks->handleActivate(window_imp, TRUE)); + WINDOW_IMP_POST(window_imp->mCallbacks->handleActivate(window_imp, true)); } // Also handle the minimization case if (w_param == SIZE_MINIMIZED && window_imp->mLastSizeWParam != SIZE_MINIMIZED) { - WINDOW_IMP_POST(window_imp->mCallbacks->handleActivate(window_imp, FALSE)); + WINDOW_IMP_POST(window_imp->mCallbacks->handleActivate(window_imp, false)); } // Actually resize all of our views @@ -2995,8 +2973,6 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ }); }; return 0; - - break; } case WM_SETTINGCHANGE: { @@ -3005,7 +2981,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ { if (!SystemParametersInfo(SPI_GETMOUSEVANISH, 0, &window_imp->mMouseVanish, 0)) { - WINDOW_IMP_POST(window_imp->mMouseVanish = TRUE); + WINDOW_IMP_POST(window_imp->mMouseVanish = true); } } } @@ -3081,6 +3057,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ } } } + break; //list of messages we get often that we don't care to log about case WM_NCHITTEST: @@ -3114,7 +3091,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ return ret; } -BOOL LLWindowWin32::convertCoords(LLCoordGL from, LLCoordWindow *to) +bool LLWindowWin32::convertCoords(LLCoordGL from, LLCoordWindow *to) { S32 client_height; RECT client_rect; @@ -3124,17 +3101,17 @@ BOOL LLWindowWin32::convertCoords(LLCoordGL from, LLCoordWindow *to) !GetClientRect(mWindowHandle, &client_rect) || NULL == to) { - return FALSE; + return false; } to->mX = from.mX; client_height = client_rect.bottom - client_rect.top; to->mY = client_height - from.mY - 1; - return TRUE; + return true; } -BOOL LLWindowWin32::convertCoords(LLCoordWindow from, LLCoordGL* to) +bool LLWindowWin32::convertCoords(LLCoordWindow from, LLCoordGL* to) { S32 client_height; RECT client_rect; @@ -3143,23 +3120,23 @@ BOOL LLWindowWin32::convertCoords(LLCoordWindow from, LLCoordGL* to) !GetClientRect(mWindowHandle, &client_rect) || NULL == to) { - return FALSE; + return false; } to->mX = from.mX; client_height = client_rect.bottom - client_rect.top; to->mY = client_height - from.mY - 1; - return TRUE; + return true; } -BOOL LLWindowWin32::convertCoords(LLCoordScreen from, LLCoordWindow* to) +bool LLWindowWin32::convertCoords(LLCoordScreen from, LLCoordWindow* to) { POINT mouse_point; mouse_point.x = from.mX; mouse_point.y = from.mY; - BOOL result = ScreenToClient(mWindowHandle, &mouse_point); + bool result = ScreenToClient(mWindowHandle, &mouse_point); if (result) { @@ -3170,13 +3147,13 @@ BOOL LLWindowWin32::convertCoords(LLCoordScreen from, LLCoordWindow* to) return result; } -BOOL LLWindowWin32::convertCoords(LLCoordWindow from, LLCoordScreen *to) +bool LLWindowWin32::convertCoords(LLCoordWindow from, LLCoordScreen *to) { POINT mouse_point; mouse_point.x = from.mX; mouse_point.y = from.mY; - BOOL result = ClientToScreen(mWindowHandle, &mouse_point); + bool result = ClientToScreen(mWindowHandle, &mouse_point); if (result) { @@ -3187,44 +3164,44 @@ BOOL LLWindowWin32::convertCoords(LLCoordWindow from, LLCoordScreen *to) return result; } -BOOL LLWindowWin32::convertCoords(LLCoordScreen from, LLCoordGL *to) +bool LLWindowWin32::convertCoords(LLCoordScreen from, LLCoordGL *to) { LLCoordWindow window_coord; if (!mWindowHandle || (NULL == to)) { - return FALSE; + return false; } convertCoords(from, &window_coord); convertCoords(window_coord, to); - return TRUE; + return true; } -BOOL LLWindowWin32::convertCoords(LLCoordGL from, LLCoordScreen *to) +bool LLWindowWin32::convertCoords(LLCoordGL from, LLCoordScreen *to) { LLCoordWindow window_coord; if (!mWindowHandle || (NULL == to)) { - return FALSE; + return false; } convertCoords(from, &window_coord); convertCoords(window_coord, to); - return TRUE; + return true; } -BOOL LLWindowWin32::isClipboardTextAvailable() +bool LLWindowWin32::isClipboardTextAvailable() { return IsClipboardFormatAvailable(CF_UNICODETEXT); } -BOOL LLWindowWin32::pasteTextFromClipboard(LLWString &dst) +bool LLWindowWin32::pasteTextFromClipboard(LLWString &dst) { - BOOL success = FALSE; + bool success = false; if (IsClipboardFormatAvailable(CF_UNICODETEXT)) { @@ -3239,7 +3216,7 @@ BOOL LLWindowWin32::pasteTextFromClipboard(LLWString &dst) dst = utf16str_to_wstring(utf16str); LLWStringUtil::removeWindowsCR(dst); GlobalUnlock(h_data); - success = TRUE; + success = true; } } CloseClipboard(); @@ -3250,9 +3227,9 @@ BOOL LLWindowWin32::pasteTextFromClipboard(LLWString &dst) } -BOOL LLWindowWin32::copyTextToClipboard(const LLWString& wstr) +bool LLWindowWin32::copyTextToClipboard(const LLWString& wstr) { - BOOL success = FALSE; + bool success = false; if (OpenClipboard(mWindowHandle)) { @@ -3276,7 +3253,7 @@ BOOL LLWindowWin32::copyTextToClipboard(const LLWString& wstr) if (SetClipboardData(CF_UNICODETEXT, hglobal_copy_utf16)) { - success = TRUE; + success = true; } } } @@ -3288,13 +3265,13 @@ BOOL LLWindowWin32::copyTextToClipboard(const LLWString& wstr) } // Constrains the mouse to the window. -void LLWindowWin32::setMouseClipping( BOOL b ) +void LLWindowWin32::setMouseClipping( bool b ) { LL_PROFILE_ZONE_SCOPED_CATEGORY_WIN32; ASSERT_MAIN_THREAD(); if( b != mIsMouseClipping ) { - BOOL success = FALSE; + bool success = false; if( b ) { @@ -3320,9 +3297,9 @@ void LLWindowWin32::setMouseClipping( BOOL b ) } } -BOOL LLWindowWin32::getClientRectInScreenSpace( RECT* rectp ) +bool LLWindowWin32::getClientRectInScreenSpace( RECT* rectp ) { - BOOL success = FALSE; + bool success = false; RECT client_rect; if (mWindowHandle && GetClientRect(mWindowHandle, &client_rect)) @@ -3343,7 +3320,7 @@ BOOL LLWindowWin32::getClientRectInScreenSpace( RECT* rectp ) bottom_right.x, bottom_right.y); - success = TRUE; + success = true; } return success; @@ -3369,36 +3346,36 @@ F32 LLWindowWin32::getGamma() return mCurrentGamma; } -BOOL LLWindowWin32::restoreGamma() +bool LLWindowWin32::restoreGamma() { ASSERT_MAIN_THREAD(); - if (mCustomGammaSet != FALSE) + if (mCustomGammaSet) { LL_DEBUGS("Window") << "Restoring gamma" << LL_ENDL; - mCustomGammaSet = FALSE; + mCustomGammaSet = false; return SetDeviceGammaRamp(mhDC, mPrevGammaRamp); } - return TRUE; + return true; } -BOOL LLWindowWin32::setGamma(const F32 gamma) +bool LLWindowWin32::setGamma(const F32 gamma) { ASSERT_MAIN_THREAD(); mCurrentGamma = gamma; //Get the previous gamma ramp to restore later. - if (mCustomGammaSet == FALSE) + if (!mCustomGammaSet) { if (!gGLManager.mIsIntel) // skip for Intel GPUs (see SL-11341) { LL_DEBUGS("Window") << "Getting the previous gamma ramp to restore later" << LL_ENDL; - if(GetDeviceGammaRamp(mhDC, mPrevGammaRamp) == FALSE) + if (!GetDeviceGammaRamp(mhDC, mPrevGammaRamp)) { LL_WARNS("Window") << "Failed to get the previous gamma ramp" << LL_ENDL; - return FALSE; + return false; } } - mCustomGammaSet = TRUE; + mCustomGammaSet = true; } LL_DEBUGS("Window") << "Setting gamma to " << gamma << LL_ENDL; @@ -3453,13 +3430,13 @@ LLWindow::LLWindowResolution* LLWindowWin32::getSupportedResolutions(S32 &num_re dev_mode.dmPelsWidth >= 800 && dev_mode.dmPelsHeight >= 600) { - BOOL resolution_exists = FALSE; + bool resolution_exists = false; for(S32 i = 0; i < mNumSupportedResolutions; i++) { if (mSupportedResolutions[i].mWidth == dev_mode.dmPelsWidth && mSupportedResolutions[i].mHeight == dev_mode.dmPelsHeight) { - resolution_exists = TRUE; + resolution_exists = true; } } if (!resolution_exists) @@ -3512,12 +3489,12 @@ F32 LLWindowWin32::getPixelAspectRatio() // Change display resolution. Returns true if successful. // protected -BOOL LLWindowWin32::setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh) +bool LLWindowWin32::setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh) { DEVMODE dev_mode; ::ZeroMemory(&dev_mode, sizeof(DEVMODE)); dev_mode.dmSize = sizeof(DEVMODE); - BOOL success = FALSE; + bool success = false; // Don't change anything if we don't have to if (EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dev_mode)) @@ -3528,7 +3505,7 @@ BOOL LLWindowWin32::setDisplayResolution(S32 width, S32 height, S32 bits, S32 re dev_mode.dmDisplayFrequency == refresh ) { // ...display mode identical, do nothing - return TRUE; + return true; } } @@ -3555,7 +3532,7 @@ BOOL LLWindowWin32::setDisplayResolution(S32 width, S32 height, S32 bits, S32 re } // protected -BOOL LLWindowWin32::setFullscreenResolution() +bool LLWindowWin32::setFullscreenResolution() { if (mFullscreen) { @@ -3563,18 +3540,18 @@ BOOL LLWindowWin32::setFullscreenResolution() } else { - return FALSE; + return false; } } // protected -BOOL LLWindowWin32::resetDisplayResolution() +bool LLWindowWin32::resetDisplayResolution() { LL_DEBUGS("Window") << "resetDisplayResolution START" << LL_ENDL; LONG cds_result = ChangeDisplaySettings(NULL, 0); - BOOL success = (DISP_CHANGE_SUCCESSFUL == cds_result); + bool success = (DISP_CHANGE_SUCCESSFUL == cds_result); if (!success) { @@ -3632,13 +3609,13 @@ void LLSplashScreenWin32::updateImpl(const std::string& mesg) { if (!mWindow) return; - int output_str_len = MultiByteToWideChar(CP_UTF8, 0, mesg.c_str(), mesg.length(), NULL, 0); + int output_str_len = MultiByteToWideChar(CP_UTF8, 0, mesg.c_str(), static_cast<int>(mesg.length()), NULL, 0); if( output_str_len>1024 ) return; WCHAR w_mesg[1025];//big enought to keep null terminatos - MultiByteToWideChar (CP_UTF8, 0, mesg.c_str(), mesg.length(), w_mesg, output_str_len); + MultiByteToWideChar (CP_UTF8, 0, mesg.c_str(), static_cast<int>(mesg.length()), w_mesg, output_str_len); //looks like MultiByteToWideChar didn't add null terminator to converted string, see EXT-4858 w_mesg[output_str_len] = 0; @@ -3784,9 +3761,9 @@ LLSD LLWindowWin32::getNativeKeyData() return result; } -BOOL LLWindowWin32::dialogColorPicker( F32 *r, F32 *g, F32 *b ) +bool LLWindowWin32::dialogColorPicker( F32 *r, F32 *g, F32 *b ) { - BOOL retval = FALSE; + bool retval = false; static CHOOSECOLOR cc; static COLORREF crCustColors[16]; @@ -3839,7 +3816,7 @@ void LLWindowWin32::focusClient() }); } -void LLWindowWin32::allowLanguageTextInput(LLPreeditor *preeditor, BOOL b) +void LLWindowWin32::allowLanguageTextInput(LLPreeditor *preeditor, bool b) { if (b == sLanguageTextInputAllowed || !LLWinImm::isAvailable()) { @@ -3849,7 +3826,7 @@ void LLWindowWin32::allowLanguageTextInput(LLPreeditor *preeditor, BOOL b) if (preeditor != mPreeditor && !b) { // This condition may occur with a call to - // setEnabled(BOOL) from LLTextEditor or LLLineEditor + // setEnabled(bool) from LLTextEditor or LLLineEditor // when the control is not focused. // We need to silently ignore the case so that // the language input status of the focused control @@ -3879,7 +3856,7 @@ void LLWindowWin32::allowLanguageTextInput(LLPreeditor *preeditor, BOOL b) if (sWinIMEOpened && GetKeyboardLayout(0) == sWinInputLocale) { HIMC himc = LLWinImm::getContext(mWindowHandle); - LLWinImm::setOpenStatus(himc, TRUE); + LLWinImm::setOpenStatus(himc, true); LLWinImm::setConversionStatus(himc, sWinIMEConversionMode, sWinIMESentenceMode); LLWinImm::releaseContext(mWindowHandle, himc); } @@ -3905,7 +3882,7 @@ void LLWindowWin32::allowLanguageTextInput(LLPreeditor *preeditor, BOOL b) // We need both ImmSetConversionStatus and ImmSetOpenStatus here to surely disable IME's // keyboard hooking, because Some IME reacts only on the former and some other on the latter... LLWinImm::setConversionStatus(himc, IME_CMODE_NOCONVERSION, sWinIMESentenceMode); - LLWinImm::setOpenStatus(himc, FALSE); + LLWinImm::setOpenStatus(himc, false); } LLWinImm::releaseContext(mWindowHandle, himc); } @@ -4032,14 +4009,14 @@ U32 LLWindowWin32::fillReconvertString(const LLWString &text, S32 focus, S32 focus_length, RECONVERTSTRING *reconvert_string) { const llutf16string text_utf16 = wstring_to_utf16str(text); - const DWORD required_size = sizeof(RECONVERTSTRING) + (text_utf16.length() + 1) * sizeof(WCHAR); + const DWORD required_size = sizeof(RECONVERTSTRING) + (static_cast<DWORD>(text_utf16.length()) + 1) * sizeof(WCHAR); if (reconvert_string && reconvert_string->dwSize >= required_size) { const DWORD focus_utf16_at = wstring_utf16_length(text, 0, focus); const DWORD focus_utf16_length = wstring_utf16_length(text, focus, focus_length); reconvert_string->dwVersion = 0; - reconvert_string->dwStrLen = text_utf16.length(); + reconvert_string->dwStrLen = static_cast<DWORD>(text_utf16.length()); reconvert_string->dwStrOffset = sizeof(RECONVERTSTRING); reconvert_string->dwCompStrLen = focus_utf16_length; reconvert_string->dwCompStrOffset = focus_utf16_at * sizeof(WCHAR); @@ -4111,7 +4088,7 @@ void LLWindowWin32::handleCompositionMessage(const U32 indexes) { return; } - BOOL needs_update = FALSE; + bool needs_update = false; LLWString result_string; LLWString preedit_string; S32 preedit_string_utf16_length = 0; @@ -4134,7 +4111,7 @@ void LLWindowWin32::handleCompositionMessage(const U32 indexes) result_string = utf16str_to_wstring(llutf16string(data, size / sizeof(WCHAR))); } delete[] data; - needs_update = TRUE; + needs_update = true; } } @@ -4151,7 +4128,7 @@ void LLWindowWin32::handleCompositionMessage(const U32 indexes) preedit_string = utf16str_to_wstring(llutf16string(data, size / sizeof(WCHAR))); } delete[] data; - needs_update = TRUE; + needs_update = true; } } @@ -4187,13 +4164,13 @@ void LLWindowWin32::handleCompositionMessage(const U32 indexes) size = LLWinImm::getCompositionString(himc, GCS_COMPATTR, data, size); if (size == preedit_string_utf16_length) { - preedit_standouts.assign(preedit_segment_lengths.size(), FALSE); + preedit_standouts.assign(preedit_segment_lengths.size(), false); S32 offset = 0; for (U32 i = 0; i < preedit_segment_lengths.size(); i++) { if (ATTR_TARGET_CONVERTED == data[offset] || ATTR_TARGET_NOTCONVERTED == data[offset]) { - preedit_standouts[i] = TRUE; + preedit_standouts[i] = true; } offset += wstring_utf16_length(preedit_string, offset, preedit_segment_lengths[i]); } @@ -4202,7 +4179,7 @@ void LLWindowWin32::handleCompositionMessage(const U32 indexes) } } - S32 caret_position = preedit_string.length(); + S32 caret_position = static_cast<S32>(preedit_string.length()); if (indexes & GCS_CURSORPOS) { const S32 caret_position_utf16 = LLWinImm::getCompositionString(himc, GCS_CURSORPOS, NULL, 0); @@ -4217,7 +4194,7 @@ void LLWindowWin32::handleCompositionMessage(const U32 indexes) // I'm not sure this condition really happens, but // Windows SDK document says it is an indication // of "reset everything." - needs_update = TRUE; + needs_update = true; } LLWinImm::releaseContext(mWindowHandle, himc); @@ -4248,11 +4225,11 @@ void LLWindowWin32::handleCompositionMessage(const U32 indexes) { if (preedit_segment_lengths.size() == 0) { - preedit_segment_lengths.assign(1, preedit_string.length()); + preedit_segment_lengths.assign(1, static_cast<S32>(preedit_string.length())); } if (preedit_standouts.size() == 0) { - preedit_standouts.assign(preedit_segment_lengths.size(), FALSE); + preedit_standouts.assign(preedit_segment_lengths.size(), false); } } mPreeditor->updatePreedit(preedit_string, preedit_segment_lengths, preedit_standouts, caret_position); @@ -4299,11 +4276,11 @@ LLWindowCallbacks::DragNDropResult LLWindowWin32::completeDragNDropRequest( cons } // Handle WM_IME_REQUEST message. -// If it handled the message, returns TRUE. Otherwise, FALSE. +// If it handled the message, returns true. Otherwise, false. // When it handled the message, the value to be returned from // the Window Procedure is set to *result. -BOOL LLWindowWin32::handleImeRequests(WPARAM request, LPARAM param, LRESULT *result) +bool LLWindowWin32::handleImeRequests(WPARAM request, LPARAM param, LRESULT *result) { if ( mPreeditor ) { @@ -4321,7 +4298,7 @@ BOOL LLWindowWin32::handleImeRequests(WPARAM request, LPARAM param, LRESULT *res form->dwIndex = dwIndex; *result = 1; - return TRUE; + return true; } case IMR_QUERYCHARPOSITION: { @@ -4341,20 +4318,20 @@ BOOL LLWindowWin32::handleImeRequests(WPARAM request, LPARAM param, LRESULT *res if (!mPreeditor->getPreeditLocation(position, &caret_coord, &preedit_bounds, &text_control)) { LL_WARNS("Window") << "*** IMR_QUERYCHARPOSITON called but getPreeditLocation failed." << LL_ENDL; - return FALSE; + return false; } fillCharPosition(caret_coord, preedit_bounds, text_control, char_position); *result = 1; - return TRUE; + return true; } case IMR_COMPOSITIONFONT: { fillCompositionLogfont((LOGFONT *)param); *result = 1; - return TRUE; + return true; } case IMR_RECONVERTSTRING: { @@ -4375,7 +4352,7 @@ BOOL LLWindowWin32::handleImeRequests(WPARAM request, LPARAM param, LRESULT *res // Let the IME to decide the reconversion range, and // adjust the reconvert_string structure accordingly. HIMC himc = LLWinImm::getContext(mWindowHandle); - const BOOL adjusted = LLWinImm::setCompositionString(himc, + const bool adjusted = LLWinImm::setCompositionString(himc, SCS_QUERYRECONVERTSTRING, reconvert_string, size, NULL, 0); LLWinImm::releaseContext(mWindowHandle, himc); if (adjusted) @@ -4392,12 +4369,12 @@ BOOL LLWindowWin32::handleImeRequests(WPARAM request, LPARAM param, LRESULT *res } *result = size; - return TRUE; + return true; } case IMR_CONFIRMRECONVERTSTRING: { - *result = FALSE; - return TRUE; + *result = 0; + return true; } case IMR_DOCUMENTFEED: { @@ -4419,14 +4396,14 @@ BOOL LLWindowWin32::handleImeRequests(WPARAM request, LPARAM param, LRESULT *res RECONVERTSTRING *reconvert_string = (RECONVERTSTRING *)param; *result = fillReconvertString(context, preedit, 0, reconvert_string); - return TRUE; + return true; } default: - return FALSE; + return false; } } - return FALSE; + return false; } //static @@ -4552,12 +4529,6 @@ std::vector<std::string> LLWindowWin32::getDynamicFallbackFontList() // Fonts previously in getFontListSans() have moved to fonts.xml. return std::vector<std::string>(); } - -U32 LLWindowWin32::getAvailableVRAMMegabytes() -{ - return mWindowThread ? mWindowThread->getAvailableVRAMMegabytes() : 0; -} - #endif // LL_WINDOWS inline LLWindowWin32::LLWindowWin32Thread::LLWindowWin32Thread() @@ -4626,39 +4597,55 @@ private: std::string mPrev; }; -// Print hardware debug info about available graphics adapters in ordinal order -void debugEnumerateGraphicsAdapters() +void LLWindowWin32::LLWindowWin32Thread::checkDXMem() { - LL_INFOS("Window") << "Enumerating graphics adapters..." << LL_ENDL; + if (!mGLReady || mGotGLBuffer) { return; } + + IDXGIFactory4* p_factory = nullptr; + + HRESULT res = CreateDXGIFactory1(__uuidof(IDXGIFactory4), (void**)&p_factory); - IDXGIFactory1* factory; - HRESULT res = CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)&factory); - if (FAILED(res) || !factory) + if (FAILED(res)) { LL_WARNS() << "CreateDXGIFactory1 failed: 0x" << std::hex << res << LL_ENDL; } else { + IDXGIAdapter3* p_dxgi_adapter = nullptr; UINT graphics_adapter_index = 0; - IDXGIAdapter3* dxgi_adapter; while (true) { - res = factory->EnumAdapters(graphics_adapter_index, reinterpret_cast<IDXGIAdapter**>(&dxgi_adapter)); + res = p_factory->EnumAdapters(graphics_adapter_index, reinterpret_cast<IDXGIAdapter**>(&p_dxgi_adapter)); if (FAILED(res)) { if (graphics_adapter_index == 0) { LL_WARNS() << "EnumAdapters failed: 0x" << std::hex << res << LL_ENDL; } - else - { - LL_INFOS("Window") << "Done enumerating graphics adapters" << LL_ENDL; - } } else { + if (graphics_adapter_index == 0) // Should it check largest one isntead of first? + { + DXGI_QUERY_VIDEO_MEMORY_INFO info; + p_dxgi_adapter->QueryVideoMemoryInfo(0, DXGI_MEMORY_SEGMENT_GROUP_LOCAL, &info); + + // Alternatively use GetDesc from below to get adapter's memory + UINT64 budget_mb = info.Budget / (1024 * 1024); + if (gGLManager.mVRAM < (S32)budget_mb) + { + gGLManager.mVRAM = (S32)budget_mb; + LL_INFOS("RenderInit") << "New VRAM Budget (DX9): " << gGLManager.mVRAM << " MB" << LL_ENDL; + } + else + { + LL_INFOS("RenderInit") << "VRAM Budget (DX9): " << budget_mb + << " MB, current (WMI): " << gGLManager.mVRAM << " MB" << LL_ENDL; + } + } + DXGI_ADAPTER_DESC desc; - dxgi_adapter->GetDesc(&desc); + p_dxgi_adapter->GetDesc(&desc); std::wstring description_w((wchar_t*)desc.Description); std::string description(description_w.begin(), description_w.end()); LL_INFOS("Window") << "Graphics adapter index: " << graphics_adapter_index << ", " @@ -4671,10 +4658,10 @@ void debugEnumerateGraphicsAdapters() << "SharedSystemMemory: " << desc.SharedSystemMemory / 1024 / 1024 << LL_ENDL; } - if (dxgi_adapter) + if (p_dxgi_adapter) { - dxgi_adapter->Release(); - dxgi_adapter = NULL; + p_dxgi_adapter->Release(); + p_dxgi_adapter = NULL; } else { @@ -4685,168 +4672,12 @@ void debugEnumerateGraphicsAdapters() } } - if (factory) - { - factory->Release(); - } -} - -void LLWindowWin32::LLWindowWin32Thread::initDX() -{ - if (!mGLReady) { return; } - - if (mDXGIAdapter == NULL) - { - debugEnumerateGraphicsAdapters(); - - IDXGIFactory4* pFactory = nullptr; - - HRESULT res = CreateDXGIFactory1(__uuidof(IDXGIFactory4), (void**)&pFactory); - - if (FAILED(res)) - { - LL_WARNS() << "CreateDXGIFactory1 failed: 0x" << std::hex << res << LL_ENDL; - } - else - { - res = pFactory->EnumAdapters(0, reinterpret_cast<IDXGIAdapter**>(&mDXGIAdapter)); - if (FAILED(res)) - { - LL_WARNS() << "EnumAdapters failed: 0x" << std::hex << res << LL_ENDL; - } - else - { - LL_INFOS() << "EnumAdapters success" << LL_ENDL; - } - } - - if (pFactory) - { - pFactory->Release(); - } - } -} - -void LLWindowWin32::LLWindowWin32Thread::initD3D() -{ - if (!mGLReady) { return; } - - if (mDXGIAdapter == NULL && mD3DDevice == NULL && mWindowHandleThrd != 0) - { - mD3D = Direct3DCreate9(D3D_SDK_VERSION); - - D3DPRESENT_PARAMETERS d3dpp; - - ZeroMemory(&d3dpp, sizeof(d3dpp)); - d3dpp.Windowed = TRUE; - d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; - - HRESULT res = mD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, mWindowHandleThrd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &mD3DDevice); - - if (FAILED(res)) - { - LL_WARNS() << "(fallback) CreateDevice failed: 0x" << std::hex << res << LL_ENDL; - } - else - { - LL_INFOS() << "(fallback) CreateDevice success" << LL_ENDL; - } - } -} - -void LLWindowWin32::LLWindowWin32Thread::cleanupDX() -{ - //clean up DXGI/D3D resources - if (mDXGIAdapter) - { - mDXGIAdapter->Release(); - mDXGIAdapter = nullptr; - } - - if (mD3DDevice) - { - mD3DDevice->Release(); - mD3DDevice = nullptr; - } - - if (mD3D) + if (p_factory) { - mD3D->Release(); - mD3D = nullptr; + p_factory->Release(); } -} - -void LLWindowWin32::LLWindowWin32Thread::updateVRAMUsage() -{ - LL_PROFILE_ZONE_SCOPED; - if (!mGLReady) { return; } - - if (mDXGIAdapter != nullptr) - { - // NOTE: what lies below is hand wavy math based on compatibility testing and observation against a variety of hardware - // It doesn't make sense, but please don't refactor it to make sense. -- davep - DXGI_QUERY_VIDEO_MEMORY_INFO info; - mDXGIAdapter->QueryVideoMemoryInfo(0, DXGI_MEMORY_SEGMENT_GROUP_LOCAL, &info); -#if 0 // debug 0 budget and 0 CU - info.Budget = 0; - info.CurrentUsage = 0; -#endif - - U32 budget_mb = info.Budget / 1024 / 1024; - gGLManager.mVRAM = llmax(gGLManager.mVRAM, (S32) budget_mb); - - U32 afr_mb = info.AvailableForReservation / 1024 / 1024; - // correct for systems that misreport budget - if (budget_mb == 0) - { - // fall back to available for reservation clamped between 512MB and 2GB - budget_mb = llclamp(afr_mb, (U32) 512, (U32) 2048); - } - - if ( mMaxVRAM != 0) - { - budget_mb = llmin(budget_mb, mMaxVRAM); - } - - U32 cu_mb = info.CurrentUsage / 1024 / 1024; - - // get an estimated usage based on texture bytes allocated - U32 eu_mb = LLImageGL::getTextureBytesAllocated() * 2 / 1024 / 1024; - - if (cu_mb == 0) - { // current usage is sometimes unreliable on Intel GPUs, fall back to estimated usage - cu_mb = llmax((U32)1, eu_mb); - } - U32 target_mb = budget_mb; - - if (target_mb > 4096) // if 4GB are installed, try to leave 2GB free - { - target_mb -= 2048; - } - else // if less than 4GB are installed, try not to use more than half of it - { - target_mb /= 2; - } - - mAvailableVRAM = cu_mb < target_mb ? target_mb - cu_mb : 0; - -#if 0 - - F32 eu_error = (F32)((S32)eu_mb - (S32)cu_mb) / (F32)cu_mb; - LL_INFOS("Window") << "\nLocal\nAFR: " << info.AvailableForReservation / 1024 / 1024 - << "\nBudget: " << info.Budget / 1024 / 1024 - << "\nCR: " << info.CurrentReservation / 1024 / 1024 - << "\nCU: " << info.CurrentUsage / 1024 / 1024 - << "\nEU: " << eu_mb << llformat(" (%.2f)", eu_error) - << "\nTU: " << target_mb - << "\nAM: " << mAvailableVRAM << LL_ENDL; -#endif - } - else if (mD3DDevice != NULL) - { // fallback to D3D9 - mAvailableVRAM = mD3DDevice->GetAvailableTextureMem() / 1024 / 1024; - } + mGotGLBuffer = true; } void LLWindowWin32::LLWindowWin32Thread::run() @@ -4866,15 +4697,11 @@ void LLWindowWin32::LLWindowWin32Thread::run() { LL_PROFILE_ZONE_SCOPED_CATEGORY_WIN32; - // lazily call initD3D inside this loop to catch when mGLReady has been set to true - initDX(); + // Check memory budget using DirectX + checkDXMem(); if (mWindowHandleThrd != 0) { - // lazily call initD3D inside this loop to catch when mWindowHandle has been set, and mGLReady has been set to true - // *TODO: Shutdown if this fails when mWindowHandle exists - initD3D(); - MSG msg; BOOL status; if (mhDCThrd == 0) @@ -4907,13 +4734,6 @@ void LLWindowWin32::LLWindowWin32Thread::run() getQueue().runPending(); } - // update available vram once every 3 seconds - static LLFrameTimer vramTimer; - if (vramTimer.getElapsedTimeF32() > 3.f) - { - updateVRAMUsage(); - vramTimer.reset(); - } #if 0 { LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("w32t - Sleep"); @@ -4922,8 +4742,6 @@ void LLWindowWin32::LLWindowWin32Thread::run() } #endif } - - cleanupDX(); } void LLWindowWin32::LLWindowWin32Thread::wakeAndDestroy() @@ -5023,7 +4841,6 @@ void LLWindowWin32::LLWindowWin32Thread::wakeAndDestroy() // very unsafe TerminateThread(pair.second.native_handle(), 0); pair.second.detach(); - cleanupDX(); } } LL_DEBUGS("Window") << "thread pool shutdown complete" << LL_ENDL; diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index 33fa67ba50..287402faa0 100644 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -48,47 +48,47 @@ public: /*virtual*/ void show(); /*virtual*/ void hide(); /*virtual*/ void close(); - /*virtual*/ BOOL getVisible(); - /*virtual*/ BOOL getMinimized(); - /*virtual*/ BOOL getMaximized(); - /*virtual*/ BOOL maximize(); + /*virtual*/ bool getVisible(); + /*virtual*/ bool getMinimized(); + /*virtual*/ bool getMaximized(); + /*virtual*/ bool maximize(); /*virtual*/ void minimize(); /*virtual*/ void restore(); - /*virtual*/ BOOL getFullscreen(); - /*virtual*/ BOOL getPosition(LLCoordScreen *position); - /*virtual*/ BOOL getSize(LLCoordScreen *size); - /*virtual*/ BOOL getSize(LLCoordWindow *size); - /*virtual*/ BOOL setPosition(LLCoordScreen position); - /*virtual*/ BOOL setSizeImpl(LLCoordScreen size); - /*virtual*/ BOOL setSizeImpl(LLCoordWindow size); - /*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL enable_vsync, const LLCoordScreen * const posp = NULL); + /*virtual*/ bool getFullscreen(); + /*virtual*/ bool getPosition(LLCoordScreen *position); + /*virtual*/ bool getSize(LLCoordScreen *size); + /*virtual*/ bool getSize(LLCoordWindow *size); + /*virtual*/ bool setPosition(LLCoordScreen position); + /*virtual*/ bool setSizeImpl(LLCoordScreen size); + /*virtual*/ bool setSizeImpl(LLCoordWindow size); + /*virtual*/ bool switchContext(bool fullscreen, const LLCoordScreen &size, bool enable_vsync, const LLCoordScreen * const posp = NULL); /*virtual*/ void setTitle(const std::string title); void* createSharedContext() override; void makeContextCurrent(void* context) override; void destroySharedContext(void* context) override; /*virtual*/ void toggleVSync(bool enable_vsync); - /*virtual*/ BOOL setCursorPosition(LLCoordWindow position); - /*virtual*/ BOOL getCursorPosition(LLCoordWindow *position); - /*virtual*/ BOOL getCursorDelta(LLCoordCommon* delta); + /*virtual*/ bool setCursorPosition(LLCoordWindow position); + /*virtual*/ bool getCursorPosition(LLCoordWindow *position); + /*virtual*/ bool getCursorDelta(LLCoordCommon* delta); /*virtual*/ void showCursor(); /*virtual*/ void hideCursor(); /*virtual*/ void showCursorFromMouseMove(); /*virtual*/ void hideCursorUntilMouseMove(); - /*virtual*/ BOOL isCursorHidden(); + /*virtual*/ bool isCursorHidden(); /*virtual*/ void updateCursor(); /*virtual*/ ECursorType getCursor() const; /*virtual*/ void captureMouse(); /*virtual*/ void releaseMouse(); - /*virtual*/ void setMouseClipping( BOOL b ); - /*virtual*/ BOOL isClipboardTextAvailable(); - /*virtual*/ BOOL pasteTextFromClipboard(LLWString &dst); - /*virtual*/ BOOL copyTextToClipboard(const LLWString &src); + /*virtual*/ void setMouseClipping( bool b ); + /*virtual*/ bool isClipboardTextAvailable(); + /*virtual*/ bool pasteTextFromClipboard(LLWString &dst); + /*virtual*/ bool copyTextToClipboard(const LLWString &src); /*virtual*/ void flashIcon(F32 seconds); /*virtual*/ F32 getGamma(); - /*virtual*/ BOOL setGamma(const F32 gamma); // Set the gamma + /*virtual*/ bool setGamma(const F32 gamma); // Set the gamma /*virtual*/ void setFSAASamples(const U32 fsaa_samples); /*virtual*/ U32 getFSAASamples(); - /*virtual*/ BOOL restoreGamma(); // Restore original gamma table (before updating gamma) + /*virtual*/ bool restoreGamma(); // Restore original gamma table (before updating gamma) /*virtual*/ ESwapMethod getSwapMethod() { return mSwapMethod; } /*virtual*/ void gatherInput(); /*virtual*/ void delayInputProcessing(); @@ -96,27 +96,25 @@ public: /*virtual*/ void restoreGLContext() {}; // handy coordinate space conversion routines - /*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordWindow *to); - /*virtual*/ BOOL convertCoords(LLCoordWindow from, LLCoordScreen *to); - /*virtual*/ BOOL convertCoords(LLCoordWindow from, LLCoordGL *to); - /*virtual*/ BOOL convertCoords(LLCoordGL from, LLCoordWindow *to); - /*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordGL *to); - /*virtual*/ BOOL convertCoords(LLCoordGL from, LLCoordScreen *to); + /*virtual*/ bool convertCoords(LLCoordScreen from, LLCoordWindow *to); + /*virtual*/ bool convertCoords(LLCoordWindow from, LLCoordScreen *to); + /*virtual*/ bool convertCoords(LLCoordWindow from, LLCoordGL *to); + /*virtual*/ bool convertCoords(LLCoordGL from, LLCoordWindow *to); + /*virtual*/ bool convertCoords(LLCoordScreen from, LLCoordGL *to); + /*virtual*/ bool convertCoords(LLCoordGL from, LLCoordScreen *to); /*virtual*/ LLWindowResolution* getSupportedResolutions(S32 &num_resolutions); /*virtual*/ F32 getNativeAspectRatio(); /*virtual*/ F32 getPixelAspectRatio(); /*virtual*/ void setNativeAspectRatio(F32 ratio) { mOverrideAspectRatio = ratio; } - U32 getAvailableVRAMMegabytes() override; - - /*virtual*/ BOOL dialogColorPicker(F32 *r, F32 *g, F32 *b ); + /*virtual*/ bool dialogColorPicker(F32 *r, F32 *g, F32 *b ); /*virtual*/ void *getPlatformWindow(); /*virtual*/ void bringToFront(); /*virtual*/ void focusClient(); - /*virtual*/ void allowLanguageTextInput(LLPreeditor *preeditor, BOOL b); + /*virtual*/ void allowLanguageTextInput(LLPreeditor *preeditor, bool b); /*virtual*/ void setLanguageTextInput( const LLCoordGL & pos ); /*virtual*/ void updateLanguageTextInputArea(); /*virtual*/ void interruptLanguageTextInput(); @@ -141,47 +139,43 @@ public: protected: LLWindowWin32(LLWindowCallbacks* callbacks, const std::string& title, const std::string& name, int x, int y, int width, int height, U32 flags, - BOOL fullscreen, BOOL clearBg, BOOL enable_vsync, BOOL use_gl, - BOOL ignore_pixel_depth, U32 fsaa_samples, U32 max_cores, U32 max_vram, F32 max_gl_version); + bool fullscreen, bool clearBg, bool enable_vsync, bool use_gl, + bool ignore_pixel_depth, U32 fsaa_samples, U32 max_cores, F32 max_gl_version); ~LLWindowWin32(); void initCursors(); - void initInputDevices(); HCURSOR loadColorCursor(LPCTSTR name); - BOOL isValid(); + bool isValid(); void moveWindow(const LLCoordScreen& position,const LLCoordScreen& size); virtual LLSD getNativeKeyData(); // Changes display resolution. Returns true if successful - BOOL setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh); + bool setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh); // Go back to last fullscreen display resolution. - BOOL setFullscreenResolution(); + bool setFullscreenResolution(); // Restore the display resolution to its value before we ran the app. - BOOL resetDisplayResolution(); + bool resetDisplayResolution(); - BOOL shouldPostQuit() { return mPostQuit; } + bool shouldPostQuit() { return mPostQuit; } - void fillCompositionForm(const LLRect& bounds, COMPOSITIONFORM *form); void fillCandidateForm(const LLCoordGL& caret, const LLRect& bounds, CANDIDATEFORM *form); void fillCharPosition(const LLCoordGL& caret, const LLRect& bounds, const LLRect& control, IMECHARPOSITION *char_position); void fillCompositionLogfont(LOGFONT *logfont); U32 fillReconvertString(const LLWString &text, S32 focus, S32 focus_length, RECONVERTSTRING *reconvert_string); void handleStartCompositionMessage(); void handleCompositionMessage(U32 indexes); - BOOL handleImeRequests(WPARAM request, LPARAM param, LRESULT *result); + bool handleImeRequests(WPARAM request, LPARAM param, LRESULT *result); protected: // // Platform specific methods // - BOOL getClientRectInScreenSpace(RECT* rectp); - void updateJoystick( ); + bool getClientRectInScreenSpace(RECT* rectp); static LRESULT CALLBACK mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_param, LPARAM l_param); - static BOOL CALLBACK enumChildWindows(HWND h_wnd, LPARAM l_param); // @@ -209,7 +203,7 @@ protected: MASK mMouseMask; - static BOOL sIsClassRegistered; // has the window class been registered? + static bool sIsClassRegistered; // has the window class been registered? F32 mCurrentGamma; U32 mFSAASamples; @@ -217,16 +211,16 @@ protected: F32 mMaxGLVersion; // maximum OpenGL version to attempt to use (clamps to 3.2 - 4.6) WORD mPrevGammaRamp[3][256]; WORD mCurrentGammaRamp[3][256]; - BOOL mCustomGammaSet; + bool mCustomGammaSet; LPWSTR mIconResource; - BOOL mInputProcessingPaused; + bool mInputProcessingPaused; // The following variables are for Language Text Input control. // They are all static, since one context is shared by all LLWindowWin32 // instances. - static BOOL sLanguageTextInputAllowed; - static BOOL sWinIMEOpened; + static bool sLanguageTextInputAllowed; + static bool sWinIMEOpened; static HKL sWinInputLocale; static DWORD sWinIMEConversionMode; static DWORD sWinIMESentenceMode; @@ -245,7 +239,7 @@ protected: U32 mRawWParam; U32 mRawLParam; - BOOL mMouseVanish; + bool mMouseVanish; // Cached values of GetWindowRect and GetClientRect to be used by app thread void updateWindowRect(); @@ -288,8 +282,6 @@ private: extern LLW32MsgCallback gAsyncMsgCallback; extern LPWSTR gIconResource; -static void handleMessage( const MSG& msg ); - S32 OSMessageBoxWin32(const std::string& text, const std::string& caption, U32 type); #endif //LL_LLWINDOWWIN32_H diff --git a/indra/llxml/llcontrol.cpp b/indra/llxml/llcontrol.cpp index 5b6d197e52..82e07e03c9 100644 --- a/indra/llxml/llcontrol.cpp +++ b/indra/llxml/llcontrol.cpp @@ -59,8 +59,6 @@ template <> eControlType get_control_type<U32>(); template <> eControlType get_control_type<S32>(); template <> eControlType get_control_type<F32>(); template <> eControlType get_control_type<bool>(); -// Yay BOOL, its really an S32. -//template <> eControlType get_control_type<BOOL> () ; template <> eControlType get_control_type<std::string>(); template <> eControlType get_control_type<LLVector3>(); @@ -79,19 +77,19 @@ template <> LLSD convert_to_llsd<LLColor4>(const LLColor4& in); template <> LLSD convert_to_llsd<LLColor3>(const LLColor3& in); template <> LLSD convert_to_llsd<LLColor4U>(const LLColor4U& in); -template <> bool convert_from_llsd<bool>(const LLSD& sd, eControlType type, const std::string& control_name); -template <> S32 convert_from_llsd<S32>(const LLSD& sd, eControlType type, const std::string& control_name); -template <> U32 convert_from_llsd<U32>(const LLSD& sd, eControlType type, const std::string& control_name); -template <> F32 convert_from_llsd<F32>(const LLSD& sd, eControlType type, const std::string& control_name); -template <> std::string convert_from_llsd<std::string>(const LLSD& sd, eControlType type, const std::string& control_name); -template <> LLWString convert_from_llsd<LLWString>(const LLSD& sd, eControlType type, const std::string& control_name); -template <> LLVector3 convert_from_llsd<LLVector3>(const LLSD& sd, eControlType type, const std::string& control_name); -template <> LLVector3d convert_from_llsd<LLVector3d>(const LLSD& sd, eControlType type, const std::string& control_name); -template <> LLRect convert_from_llsd<LLRect>(const LLSD& sd, eControlType type, const std::string& control_name); -template <> LLColor4 convert_from_llsd<LLColor4>(const LLSD& sd, eControlType type, const std::string& control_name); -template <> LLColor4U convert_from_llsd<LLColor4U>(const LLSD& sd, eControlType type, const std::string& control_name); -template <> LLColor3 convert_from_llsd<LLColor3>(const LLSD& sd, eControlType type, const std::string& control_name); -template <> LLSD convert_from_llsd<LLSD>(const LLSD& sd, eControlType type, const std::string& control_name); +template <> bool convert_from_llsd<bool>(const LLSD& sd, eControlType type, std::string_view control_name); +template <> S32 convert_from_llsd<S32>(const LLSD& sd, eControlType type, std::string_view control_name); +template <> U32 convert_from_llsd<U32>(const LLSD& sd, eControlType type, std::string_view control_name); +template <> F32 convert_from_llsd<F32>(const LLSD& sd, eControlType type, std::string_view control_name); +template <> std::string convert_from_llsd<std::string>(const LLSD& sd, eControlType type, std::string_view control_name); +template <> LLWString convert_from_llsd<LLWString>(const LLSD& sd, eControlType type, std::string_view control_name); +template <> LLVector3 convert_from_llsd<LLVector3>(const LLSD& sd, eControlType type, std::string_view control_name); +template <> LLVector3d convert_from_llsd<LLVector3d>(const LLSD& sd, eControlType type, std::string_view control_name); +template <> LLRect convert_from_llsd<LLRect>(const LLSD& sd, eControlType type, std::string_view control_name); +template <> LLColor4 convert_from_llsd<LLColor4>(const LLSD& sd, eControlType type, std::string_view control_name); +template <> LLColor4U convert_from_llsd<LLColor4U>(const LLSD& sd, eControlType type, std::string_view control_name); +template <> LLColor3 convert_from_llsd<LLColor3>(const LLSD& sd, eControlType type, std::string_view control_name); +template <> LLSD convert_from_llsd<LLSD>(const LLSD& sd, eControlType type, std::string_view control_name); //this defines the current version of the settings file const S32 CURRENT_VERSION = 101; @@ -178,10 +176,10 @@ LLSD LLControlVariable::getComparableValue(const LLSD& value) LLSD storable_value; if(TYPE_BOOLEAN == type() && value.isString()) { - BOOL temp; + bool temp; if(LLStringUtil::convertToBOOL(value.asString(), temp)) { - storable_value = (bool)temp; + storable_value = temp; } else { @@ -212,7 +210,7 @@ LLSD LLControlVariable::getComparableValue(const LLSD& value) void LLControlVariable::setValue(const LLSD& new_value, bool saved_value) { - if (mValidateSignal(this, new_value) == false) + if (!mValidateSignal(this, new_value)) { // can not set new value, exit return; @@ -220,12 +218,12 @@ void LLControlVariable::setValue(const LLSD& new_value, bool saved_value) LLSD storable_value = getComparableValue(new_value); LLSD original_value = getValue(); - bool value_changed = llsd_compare(original_value, storable_value) == FALSE; + bool value_changed = !llsd_compare(original_value, storable_value); if(saved_value) { // If we're going to save this value, return to default but don't fire resetToDefault(false); - if (llsd_compare(mValues.back(), storable_value) == FALSE) + if (!llsd_compare(mValues.back(), storable_value)) { mValues.push_back(storable_value); } @@ -235,7 +233,7 @@ void LLControlVariable::setValue(const LLSD& new_value, bool saved_value) // This is an unsaved value. Its needs to reside at // mValues[2] (or greater). It must not affect // the result of getSaveValue() - if (llsd_compare(mValues.back(), storable_value) == FALSE) + if (!llsd_compare(mValues.back(), storable_value)) { while(mValues.size() > 2) { @@ -269,10 +267,10 @@ void LLControlVariable::setDefaultValue(const LLSD& value) LLSD comparable_value = getComparableValue(value); LLSD original_value = getValue(); - bool value_changed = (llsd_compare(original_value, comparable_value) == FALSE); + bool value_changed = !llsd_compare(original_value, comparable_value); resetToDefault(false); mValues[0] = comparable_value; - if(value_changed) + if (value_changed) { firePropertyChanged(original_value); } @@ -343,14 +341,14 @@ LLSD LLControlVariable::getSaveValue() const return mValues[0]; } -LLPointer<LLControlVariable> LLControlGroup::getControl(const std::string& name) +LLPointer<LLControlVariable> LLControlGroup::getControl(std::string_view name) { if (mSettingsProfile) { incrCount(name); } - ctrl_name_table_t::iterator iter = mNameTable.find(name); + ctrl_name_table_t::iterator iter = mNameTable.find(name.data()); return iter == mNameTable.end() ? LLPointer<LLControlVariable>() : iter->second; } @@ -465,7 +463,7 @@ std::string LLControlGroup::typeEnumToString(eControlType typeenum) return mTypeString[typeenum]; } -LLControlVariable* LLControlGroup::declareControl(const std::string& name, eControlType type, const LLSD initial_val, const std::string& comment, LLControlVariable::ePersist persist, BOOL hidefromsettingseditor) +LLControlVariable* LLControlGroup::declareControl(const std::string& name, eControlType type, const LLSD initial_val, const std::string& comment, LLControlVariable::ePersist persist, bool hidefromsettingseditor) { LLControlVariable* existing_control = getControl(name); if (existing_control) @@ -508,7 +506,7 @@ LLControlVariable* LLControlGroup::declareF32(const std::string& name, const F32 return declareControl(name, TYPE_F32, initial_val, comment, persist); } -LLControlVariable* LLControlGroup::declareBOOL(const std::string& name, const BOOL initial_val, const std::string& comment, LLControlVariable::ePersist persist) +LLControlVariable* LLControlGroup::declareBOOL(const std::string& name, const bool initial_val, const std::string& comment, LLControlVariable::ePersist persist) { return declareControl(name, TYPE_BOOLEAN, initial_val, comment, persist); } @@ -553,46 +551,46 @@ LLControlVariable* LLControlGroup::declareLLSD(const std::string& name, const LL return declareControl(name, TYPE_LLSD, initial_val, comment, persist); } -void LLControlGroup::incrCount(const std::string& name) +void LLControlGroup::incrCount(std::string_view name) { if (0.0 == start_time) { start_time = LLTimer::getTotalSeconds(); } - getCount[name] = getCount[name].asInteger() + 1; + getCount[name.data()] = getCount[name.data()].asInteger() + 1; } -BOOL LLControlGroup::getBOOL(const std::string& name) +bool LLControlGroup::getBOOL(std::string_view name) { - return (BOOL)get<bool>(name); + return get<bool>(name); } -S32 LLControlGroup::getS32(const std::string& name) +S32 LLControlGroup::getS32(std::string_view name) { return get<S32>(name); } -U32 LLControlGroup::getU32(const std::string& name) +U32 LLControlGroup::getU32(std::string_view name) { return get<U32>(name); } -F32 LLControlGroup::getF32(const std::string& name) +F32 LLControlGroup::getF32(std::string_view name) { return get<F32>(name); } -std::string LLControlGroup::getString(const std::string& name) +std::string LLControlGroup::getString(std::string_view name) { return get<std::string>(name); } -LLWString LLControlGroup::getWString(const std::string& name) +LLWString LLControlGroup::getWString(std::string_view name) { return get<LLWString>(name); } -std::string LLControlGroup::getText(const std::string& name) +std::string LLControlGroup::getText(std::string_view name) { std::string utf8_string = getString(name); LLStringUtil::replaceChar(utf8_string, '^', '\n'); @@ -600,43 +598,43 @@ std::string LLControlGroup::getText(const std::string& name) return (utf8_string); } -LLVector3 LLControlGroup::getVector3(const std::string& name) +LLVector3 LLControlGroup::getVector3(std::string_view name) { return get<LLVector3>(name); } -LLVector3d LLControlGroup::getVector3d(const std::string& name) +LLVector3d LLControlGroup::getVector3d(std::string_view name) { return get<LLVector3d>(name); } -LLQuaternion LLControlGroup::getQuaternion(const std::string& name) +LLQuaternion LLControlGroup::getQuaternion(std::string_view name) { return get<LLQuaternion>(name); } -LLRect LLControlGroup::getRect(const std::string& name) +LLRect LLControlGroup::getRect(std::string_view name) { return get<LLRect>(name); } -LLColor4 LLControlGroup::getColor(const std::string& name) +LLColor4 LLControlGroup::getColor(std::string_view name) { return get<LLColor4>(name); } -LLColor4 LLControlGroup::getColor4(const std::string& name) +LLColor4 LLControlGroup::getColor4(std::string_view name) { return get<LLColor4>(name); } -LLColor3 LLControlGroup::getColor3(const std::string& name) +LLColor3 LLControlGroup::getColor3(std::string_view name) { return get<LLColor3>(name); } -LLSD LLControlGroup::getLLSD(const std::string& name) +LLSD LLControlGroup::getLLSD(std::string_view name) { return get<LLSD>(name); } @@ -659,7 +657,7 @@ LLSD LLControlGroup::asLLSD(bool diffs_only) return result; } -BOOL LLControlGroup::controlExists(const std::string& name) +bool LLControlGroup::controlExists(const std::string& name) { ctrl_name_table_t::iterator iter = mNameTable.find(name); return iter != mNameTable.end(); @@ -670,67 +668,67 @@ BOOL LLControlGroup::controlExists(const std::string& name) // Set functions //------------------------------------------------------------------- -void LLControlGroup::setBOOL(const std::string& name, BOOL val) +void LLControlGroup::setBOOL(std::string_view name, bool val) { set<bool>(name, val); } -void LLControlGroup::setS32(const std::string& name, S32 val) +void LLControlGroup::setS32(std::string_view name, S32 val) { set(name, val); } -void LLControlGroup::setF32(const std::string& name, F32 val) +void LLControlGroup::setF32(std::string_view name, F32 val) { set(name, val); } -void LLControlGroup::setU32(const std::string& name, U32 val) +void LLControlGroup::setU32(std::string_view name, U32 val) { set(name, val); } -void LLControlGroup::setString(const std::string& name, const std::string &val) +void LLControlGroup::setString(std::string_view name, const std::string &val) { set(name, val); } -void LLControlGroup::setVector3(const std::string& name, const LLVector3 &val) +void LLControlGroup::setVector3(std::string_view name, const LLVector3 &val) { set(name, val); } -void LLControlGroup::setVector3d(const std::string& name, const LLVector3d &val) +void LLControlGroup::setVector3d(std::string_view name, const LLVector3d &val) { set(name, val); } -void LLControlGroup::setQuaternion(const std::string& name, const LLQuaternion &val) +void LLControlGroup::setQuaternion(std::string_view name, const LLQuaternion &val) { set(name, val); } -void LLControlGroup::setRect(const std::string& name, const LLRect &val) +void LLControlGroup::setRect(std::string_view name, const LLRect &val) { set(name, val); } -void LLControlGroup::setColor4(const std::string& name, const LLColor4 &val) +void LLControlGroup::setColor4(std::string_view name, const LLColor4 &val) { set(name, val); } -void LLControlGroup::setLLSD(const std::string& name, const LLSD& val) +void LLControlGroup::setLLSD(std::string_view name, const LLSD& val) { set(name, val); } -void LLControlGroup::setUntypedValue(const std::string& name, const LLSD& val) +void LLControlGroup::setUntypedValue(std::string_view name, const LLSD& val) { if (name.empty()) { @@ -755,7 +753,7 @@ void LLControlGroup::setUntypedValue(const std::string& name, const LLSD& val) //--------------------------------------------------------------- // Returns number of controls loaded, so 0 if failure -U32 LLControlGroup::loadFromFileLegacy(const std::string& filename, BOOL require_declaration, eControlType declare_as) +U32 LLControlGroup::loadFromFileLegacy(const std::string& filename, bool require_declaration, eControlType declare_as) { std::string name; @@ -791,7 +789,7 @@ U32 LLControlGroup::loadFromFileLegacy(const std::string& filename, BOOL require { name = child_nodep->getName(); - BOOL declared = controlExists(name); + bool declared = controlExists(name); if (require_declaration && !declared) { @@ -859,7 +857,7 @@ U32 LLControlGroup::loadFromFileLegacy(const std::string& filename, BOOL require break; case TYPE_BOOLEAN: { - BOOL initial = FALSE; + bool initial = false; child_nodep->getAttributeBOOL("value", initial); control->set(initial); @@ -952,7 +950,7 @@ U32 LLControlGroup::loadFromFileLegacy(const std::string& filename, BOOL require return validitems; } -U32 LLControlGroup::saveToFile(const std::string& filename, BOOL nondefault_only) +U32 LLControlGroup::saveToFile(const std::string& filename, bool nondefault_only) { LLSD settings; int num_saved = 0; @@ -1004,7 +1002,7 @@ U32 LLControlGroup::loadFromFile(const std::string& filename, bool set_default_v { infile.close(); LL_WARNS("Settings") << "Unable to parse LLSD control file " << filename << ". Trying Legacy Method." << LL_ENDL; - return loadFromFileLegacy(filename, TRUE, TYPE_STRING); + return loadFromFileLegacy(filename, true, TYPE_STRING); } U32 validitems = 0; @@ -1162,7 +1160,7 @@ void main() bar = new LLControlVariable<S32>("gBar", 10, 2, 22); gGlobals.addEntry("gBar", bar); - baz = new LLControlVariable<BOOL>("gBaz", FALSE); + baz = new LLControlVariable<bool>("gBaz", false); gGlobals.addEntry("gBaz", baz); // test retrieval @@ -1190,7 +1188,7 @@ void main() // ...invalid data type getfoo = (F32_CONTROL) gGlobals.resolveName("gFoo"); - getfoo->set(TRUE); + getfoo->set(true); getfoo->dump(); // ...out of range data @@ -1224,13 +1222,7 @@ template <> eControlType get_control_type<bool> () { return TYPE_BOOLEAN; } -/* -// Yay BOOL, its really an S32. -template <> eControlType get_control_type<BOOL> () -{ - return TYPE_BOOLEAN; -} -*/ + template <> eControlType get_control_type<std::string>() { return TYPE_STRING; @@ -1313,19 +1305,19 @@ template <> LLSD convert_to_llsd<LLColor4U>(const LLColor4U& in) template<> -bool convert_from_llsd<bool>(const LLSD& sd, eControlType type, const std::string& control_name) +bool convert_from_llsd<bool>(const LLSD& sd, eControlType type, std::string_view control_name) { if (type == TYPE_BOOLEAN) return sd.asBoolean(); else { - CONTROL_ERRS << "Invalid BOOL value for " << control_name << ": " << LLControlGroup::typeEnumToString(type) << " " << sd << LL_ENDL; - return FALSE; + CONTROL_ERRS << "Invalid bool value for " << control_name << ": " << LLControlGroup::typeEnumToString(type) << " " << sd << LL_ENDL; + return false; } } template<> -S32 convert_from_llsd<S32>(const LLSD& sd, eControlType type, const std::string& control_name) +S32 convert_from_llsd<S32>(const LLSD& sd, eControlType type, std::string_view control_name) { if (type == TYPE_S32) return sd.asInteger(); @@ -1337,7 +1329,7 @@ S32 convert_from_llsd<S32>(const LLSD& sd, eControlType type, const std::string& } template<> -U32 convert_from_llsd<U32>(const LLSD& sd, eControlType type, const std::string& control_name) +U32 convert_from_llsd<U32>(const LLSD& sd, eControlType type, std::string_view control_name) { if (type == TYPE_U32) return sd.asInteger(); @@ -1349,7 +1341,7 @@ U32 convert_from_llsd<U32>(const LLSD& sd, eControlType type, const std::string& } template<> -F32 convert_from_llsd<F32>(const LLSD& sd, eControlType type, const std::string& control_name) +F32 convert_from_llsd<F32>(const LLSD& sd, eControlType type, std::string_view control_name) { if (type == TYPE_F32) return (F32) sd.asReal(); @@ -1361,7 +1353,7 @@ F32 convert_from_llsd<F32>(const LLSD& sd, eControlType type, const std::string& } template<> -std::string convert_from_llsd<std::string>(const LLSD& sd, eControlType type, const std::string& control_name) +std::string convert_from_llsd<std::string>(const LLSD& sd, eControlType type, std::string_view control_name) { if (type == TYPE_STRING) return sd.asString(); @@ -1373,13 +1365,13 @@ std::string convert_from_llsd<std::string>(const LLSD& sd, eControlType type, co } template<> -LLWString convert_from_llsd<LLWString>(const LLSD& sd, eControlType type, const std::string& control_name) +LLWString convert_from_llsd<LLWString>(const LLSD& sd, eControlType type, std::string_view control_name) { return utf8str_to_wstring(convert_from_llsd<std::string>(sd, type, control_name)); } template<> -LLVector3 convert_from_llsd<LLVector3>(const LLSD& sd, eControlType type, const std::string& control_name) +LLVector3 convert_from_llsd<LLVector3>(const LLSD& sd, eControlType type, std::string_view control_name) { if (type == TYPE_VEC3) return (LLVector3)sd; @@ -1391,7 +1383,7 @@ LLVector3 convert_from_llsd<LLVector3>(const LLSD& sd, eControlType type, const } template<> -LLVector3d convert_from_llsd<LLVector3d>(const LLSD& sd, eControlType type, const std::string& control_name) +LLVector3d convert_from_llsd<LLVector3d>(const LLSD& sd, eControlType type, std::string_view control_name) { if (type == TYPE_VEC3D) return (LLVector3d)sd; @@ -1403,7 +1395,7 @@ LLVector3d convert_from_llsd<LLVector3d>(const LLSD& sd, eControlType type, cons } template<> -LLQuaternion convert_from_llsd<LLQuaternion>(const LLSD& sd, eControlType type, const std::string& control_name) +LLQuaternion convert_from_llsd<LLQuaternion>(const LLSD& sd, eControlType type, std::string_view control_name) { if (type == TYPE_QUAT) return (LLQuaternion)sd; @@ -1415,7 +1407,7 @@ LLQuaternion convert_from_llsd<LLQuaternion>(const LLSD& sd, eControlType type, } template<> -LLRect convert_from_llsd<LLRect>(const LLSD& sd, eControlType type, const std::string& control_name) +LLRect convert_from_llsd<LLRect>(const LLSD& sd, eControlType type, std::string_view control_name) { if (type == TYPE_RECT) return LLRect(sd); @@ -1428,7 +1420,7 @@ LLRect convert_from_llsd<LLRect>(const LLSD& sd, eControlType type, const std::s template<> -LLColor4 convert_from_llsd<LLColor4>(const LLSD& sd, eControlType type, const std::string& control_name) +LLColor4 convert_from_llsd<LLColor4>(const LLSD& sd, eControlType type, std::string_view control_name) { if (type == TYPE_COL4) { @@ -1460,7 +1452,7 @@ LLColor4 convert_from_llsd<LLColor4>(const LLSD& sd, eControlType type, const st } template<> -LLColor3 convert_from_llsd<LLColor3>(const LLSD& sd, eControlType type, const std::string& control_name) +LLColor3 convert_from_llsd<LLColor3>(const LLSD& sd, eControlType type, std::string_view control_name) { if (type == TYPE_COL3) return sd; @@ -1472,7 +1464,7 @@ LLColor3 convert_from_llsd<LLColor3>(const LLSD& sd, eControlType type, const st } template<> -LLSD convert_from_llsd<LLSD>(const LLSD& sd, eControlType type, const std::string& control_name) +LLSD convert_from_llsd<LLSD>(const LLSD& sd, eControlType type, std::string_view control_name) { return sd; } @@ -1485,7 +1477,6 @@ DECL_LLCC(U32, (U32)666); DECL_LLCC(S32, (S32)-666); DECL_LLCC(F32, (F32)-666.666); DECL_LLCC(bool, true); -DECL_LLCC(BOOL, FALSE); static LLCachedControl<std::string> mySetting_string("TestCachedControlstring", "Default String Value"); DECL_LLCC(LLVector3, LLVector3(1.0f, 2.0f, 3.0f)); DECL_LLCC(LLVector3d, LLVector3d(6.0f, 5.0f, 4.0f)); @@ -1504,7 +1495,6 @@ void test_cached_control() TEST_LLCC(S32, (S32)-666); TEST_LLCC(F32, (F32)-666.666); TEST_LLCC(bool, true); - TEST_LLCC(BOOL, FALSE); if((std::string)mySetting_string != "Default String Value") LL_ERRS() << "Fail string" << LL_ENDL; TEST_LLCC(LLVector3, LLVector3(1.0f, 2.0f, 3.0f)); TEST_LLCC(LLVector3d, LLVector3d(6.0f, 5.0f, 4.0f)); diff --git a/indra/llxml/llcontrol.h b/indra/llxml/llcontrol.h index 37663a6fb2..1b04729a82 100644 --- a/indra/llxml/llcontrol.h +++ b/indra/llxml/llcontrol.h @@ -144,7 +144,7 @@ public: LLSD getSaveValue() const; void set(const LLSD& val) { setValue(val); } - void setValue(const LLSD& value, bool saved_value = TRUE); + void setValue(const LLSD& value, bool saved_value = true); void setDefaultValue(const LLSD& value); void setPersist(ePersist); void setHiddenFromSettingsEditor(bool hide); @@ -177,7 +177,7 @@ LLSD convert_to_llsd(const T& in) } template <class T> -T convert_from_llsd(const LLSD& sd, eControlType type, const std::string& control_name) +T convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name) { // needs specialization return T(sd); @@ -201,7 +201,7 @@ public: ~LLControlGroup(); void cleanup(); - LLControlVariablePtr getControl(const std::string& name); + LLControlVariablePtr getControl(std::string_view name); struct ApplyFunctor { @@ -210,11 +210,11 @@ public: }; void applyToAll(ApplyFunctor* func); - LLControlVariable* declareControl(const std::string& name, eControlType type, const LLSD initial_val, const std::string& comment, LLControlVariable::ePersist persist, BOOL hidefromsettingseditor = FALSE); + LLControlVariable* declareControl(const std::string& name, eControlType type, const LLSD initial_val, const std::string& comment, LLControlVariable::ePersist persist, bool hidefromsettingseditor = false); LLControlVariable* declareU32(const std::string& name, U32 initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); LLControlVariable* declareS32(const std::string& name, S32 initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); LLControlVariable* declareF32(const std::string& name, F32 initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); - LLControlVariable* declareBOOL(const std::string& name, BOOL initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); + LLControlVariable* declareBOOL(const std::string& name, bool initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); LLControlVariable* declareString(const std::string& name, const std::string &initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); LLControlVariable* declareVec3(const std::string& name, const LLVector3 &initial_val,const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); LLControlVariable* declareVec3d(const std::string& name, const LLVector3d &initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); @@ -224,28 +224,28 @@ public: LLControlVariable* declareColor3(const std::string& name, const LLColor3 &initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); LLControlVariable* declareLLSD(const std::string& name, const LLSD &initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); - std::string getString(const std::string& name); - std::string getText(const std::string& name); - BOOL getBOOL(const std::string& name); - S32 getS32(const std::string& name); - F32 getF32(const std::string& name); - U32 getU32(const std::string& name); + std::string getString(std::string_view name); + std::string getText(std::string_view name); + bool getBOOL(std::string_view name); + S32 getS32(std::string_view name); + F32 getF32(std::string_view name); + U32 getU32(std::string_view name); - LLWString getWString(const std::string& name); - LLVector3 getVector3(const std::string& name); - LLVector3d getVector3d(const std::string& name); - LLRect getRect(const std::string& name); - LLSD getLLSD(const std::string& name); - LLQuaternion getQuaternion(const std::string& name); + LLWString getWString(std::string_view name); + LLVector3 getVector3(std::string_view name); + LLVector3d getVector3d(std::string_view name); + LLRect getRect(std::string_view name); + LLSD getLLSD(std::string_view name); + LLQuaternion getQuaternion(std::string_view name); - LLColor4 getColor(const std::string& name); - LLColor4 getColor4(const std::string& name); - LLColor3 getColor3(const std::string& name); + LLColor4 getColor(std::string_view name); + LLColor4 getColor4(std::string_view name); + LLColor3 getColor3(std::string_view name); LLSD asLLSD(bool diffs_only); // generic getter - template<typename T> T get(const std::string& name) + template<typename T> T get(std::string_view name) { LL_PROFILE_ZONE_SCOPED_CATEGORY_LLSD; LLControlVariable* control = getControl(name); @@ -265,23 +265,23 @@ public: return convert_from_llsd<T>(value, type, name); } - void setBOOL(const std::string& name, BOOL val); - void setS32(const std::string& name, S32 val); - void setF32(const std::string& name, F32 val); - void setU32(const std::string& name, U32 val); - void setString(const std::string& name, const std::string& val); - void setVector3(const std::string& name, const LLVector3 &val); - void setVector3d(const std::string& name, const LLVector3d &val); - void setQuaternion(const std::string& name, const LLQuaternion &val); - void setRect(const std::string& name, const LLRect &val); - void setColor4(const std::string& name, const LLColor4 &val); - void setLLSD(const std::string& name, const LLSD& val); + void setBOOL(std::string_view name, bool val); + void setS32(std::string_view name, S32 val); + void setF32(std::string_view name, F32 val); + void setU32(std::string_view name, U32 val); + void setString(std::string_view name, const std::string& val); + void setVector3(std::string_view name, const LLVector3 &val); + void setVector3d(std::string_view name, const LLVector3d &val); + void setQuaternion(std::string_view name, const LLQuaternion &val); + void setRect(std::string_view name, const LLRect &val); + void setColor4(std::string_view name, const LLColor4 &val); + void setLLSD(std::string_view name, const LLSD& val); // type agnostic setter that takes LLSD - void setUntypedValue(const std::string& name, const LLSD& val); + void setUntypedValue(std::string_view name, const LLSD& val); // generic setter - template<typename T> void set(const std::string& name, const T& val) + template<typename T> void set(std::string_view name, const T& val) { LLControlVariable* control = getControl(name); @@ -295,16 +295,16 @@ public: } } - BOOL controlExists(const std::string& name); + bool controlExists(const std::string& name); // Returns number of controls loaded, 0 if failed // If require_declaration is false, will auto-declare controls it finds // as the given type. - U32 loadFromFileLegacy(const std::string& filename, BOOL require_declaration = TRUE, eControlType declare_as = TYPE_STRING); - U32 saveToFile(const std::string& filename, BOOL nondefault_only); + U32 loadFromFileLegacy(const std::string& filename, bool require_declaration = true, eControlType declare_as = TYPE_STRING); + U32 saveToFile(const std::string& filename, bool nondefault_only); U32 loadFromFile(const std::string& filename, bool default_values = false, bool save_values = true); void resetToDefaults(); - void incrCount(const std::string& name); + void incrCount(std::string_view name); bool mSettingsProfile; }; @@ -435,8 +435,6 @@ template <> eControlType get_control_type<U32>(); template <> eControlType get_control_type<S32>(); template <> eControlType get_control_type<F32>(); template <> eControlType get_control_type<bool>(); -// Yay BOOL, its really an S32. -//template <> eControlType get_control_type<BOOL> () template <> eControlType get_control_type<std::string>(); template <> eControlType get_control_type<LLVector3>(); template <> eControlType get_control_type<LLVector3d>(); @@ -454,19 +452,19 @@ template <> LLSD convert_to_llsd<LLRect>(const LLRect& in); template <> LLSD convert_to_llsd<LLColor4>(const LLColor4& in); template <> LLSD convert_to_llsd<LLColor3>(const LLColor3& in); -template<> std::string convert_from_llsd<std::string>(const LLSD& sd, eControlType type, const std::string& control_name); -template<> LLWString convert_from_llsd<LLWString>(const LLSD& sd, eControlType type, const std::string& control_name); -template<> LLVector3 convert_from_llsd<LLVector3>(const LLSD& sd, eControlType type, const std::string& control_name); -template<> LLVector3d convert_from_llsd<LLVector3d>(const LLSD& sd, eControlType type, const std::string& control_name); -template<> LLQuaternion convert_from_llsd<LLQuaternion>(const LLSD& sd, eControlType type, const std::string& control_name); -template<> LLRect convert_from_llsd<LLRect>(const LLSD& sd, eControlType type, const std::string& control_name); -template<> bool convert_from_llsd<bool>(const LLSD& sd, eControlType type, const std::string& control_name); -template<> S32 convert_from_llsd<S32>(const LLSD& sd, eControlType type, const std::string& control_name); -template<> F32 convert_from_llsd<F32>(const LLSD& sd, eControlType type, const std::string& control_name); -template<> U32 convert_from_llsd<U32>(const LLSD& sd, eControlType type, const std::string& control_name); -template<> LLColor3 convert_from_llsd<LLColor3>(const LLSD& sd, eControlType type, const std::string& control_name); -template<> LLColor4 convert_from_llsd<LLColor4>(const LLSD& sd, eControlType type, const std::string& control_name); -template<> LLSD convert_from_llsd<LLSD>(const LLSD& sd, eControlType type, const std::string& control_name); +template<> std::string convert_from_llsd<std::string>(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLWString convert_from_llsd<LLWString>(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLVector3 convert_from_llsd<LLVector3>(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLVector3d convert_from_llsd<LLVector3d>(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLQuaternion convert_from_llsd<LLQuaternion>(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLRect convert_from_llsd<LLRect>(const LLSD& sd, eControlType type, std::string_view control_name); +template<> bool convert_from_llsd<bool>(const LLSD& sd, eControlType type, std::string_view control_name); +template<> S32 convert_from_llsd<S32>(const LLSD& sd, eControlType type, std::string_view control_name); +template<> F32 convert_from_llsd<F32>(const LLSD& sd, eControlType type, std::string_view control_name); +template<> U32 convert_from_llsd<U32>(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLColor3 convert_from_llsd<LLColor3>(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLColor4 convert_from_llsd<LLColor4>(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLSD convert_from_llsd<LLSD>(const LLSD& sd, eControlType type, std::string_view control_name); //#define TEST_CACHED_CONTROL 1 #ifdef TEST_CACHED_CONTROL diff --git a/indra/llxml/llxmlnode.cpp b/indra/llxml/llxmlnode.cpp index d1c800dc7d..acfd3fb213 100644 --- a/indra/llxml/llxmlnode.cpp +++ b/indra/llxml/llxmlnode.cpp @@ -47,13 +47,13 @@ #include "lldir.h" // static -BOOL LLXMLNode::sStripEscapedStrings = TRUE; -BOOL LLXMLNode::sStripWhitespaceValues = FALSE; +bool LLXMLNode::sStripEscapedStrings = true; +bool LLXMLNode::sStripWhitespaceValues = false; LLXMLNode::LLXMLNode() : mID(""), mParser(NULL), - mIsAttribute(FALSE), + mIsAttribute(false), mVersionMajor(0), mVersionMinor(0), mLength(0), @@ -72,7 +72,7 @@ LLXMLNode::LLXMLNode() : { } -LLXMLNode::LLXMLNode(const char* name, BOOL is_attribute) : +LLXMLNode::LLXMLNode(const char* name, bool is_attribute) : mID(""), mParser(NULL), mIsAttribute(is_attribute), @@ -94,7 +94,7 @@ LLXMLNode::LLXMLNode(const char* name, BOOL is_attribute) : mName = gStringTable.addStringEntry(name); } -LLXMLNode::LLXMLNode(LLStringTableEntry* name, BOOL is_attribute) : +LLXMLNode::LLXMLNode(LLStringTableEntry* name, bool is_attribute) : mID(""), mParser(NULL), mIsAttribute(is_attribute), @@ -196,17 +196,17 @@ LLXMLNode::~LLXMLNode() mDefault = NULL; } -BOOL LLXMLNode::isNull() +bool LLXMLNode::isNull() { return (mName == NULL); } // protected -BOOL LLXMLNode::removeChild(LLXMLNode *target_child) +bool LLXMLNode::removeChild(LLXMLNode *target_child) { if (!target_child) { - return FALSE; + return false; } if (target_child->mIsAttribute) { @@ -215,7 +215,7 @@ BOOL LLXMLNode::removeChild(LLXMLNode *target_child) { target_child->mParent = NULL; mAttributes.erase(children_itr); - return TRUE; + return true; } } else if (mChildren.notNull()) @@ -247,7 +247,7 @@ BOOL LLXMLNode::removeChild(LLXMLNode *target_child) { mChildren = NULL; } - return TRUE; + return true; } else if (children_itr->first != target_child->mName) { @@ -259,7 +259,7 @@ BOOL LLXMLNode::removeChild(LLXMLNode *target_child) } } } - return FALSE; + return false; } void LLXMLNode::addChild(LLXMLNodePtr& new_child) @@ -305,13 +305,13 @@ void LLXMLNode::addChild(LLXMLNodePtr& new_child) } // virtual -LLXMLNodePtr LLXMLNode::createChild(const char* name, BOOL is_attribute) +LLXMLNodePtr LLXMLNode::createChild(const char* name, bool is_attribute) { return createChild(gStringTable.addStringEntry(name), is_attribute); } // virtual -LLXMLNodePtr LLXMLNode::createChild(LLStringTableEntry* name, BOOL is_attribute) +LLXMLNodePtr LLXMLNode::createChild(LLStringTableEntry* name, bool is_attribute) { LLXMLNodePtr ret(new LLXMLNode(name, is_attribute)); ret->mID.clear(); @@ -320,13 +320,13 @@ LLXMLNodePtr LLXMLNode::createChild(LLStringTableEntry* name, BOOL is_attribute) return ret; } -BOOL LLXMLNode::deleteChild(LLXMLNode *child) +bool LLXMLNode::deleteChild(LLXMLNode *child) { if (removeChild(child)) { - return TRUE; + return true; } - return FALSE; + return false; } void LLXMLNode::setParent(LLXMLNodePtr& new_parent) @@ -378,7 +378,7 @@ void XMLCALL StartXMLNode(void *userData, const XML_Char **atts) { // Create a new node - LLXMLNode *new_node_ptr = new LLXMLNode(name, FALSE); + LLXMLNode *new_node_ptr = new LLXMLNode(name, false); LLXMLNodePtr new_node = new_node_ptr; new_node->mID.clear(); @@ -483,9 +483,9 @@ void XMLCALL StartXMLNode(void *userData, // only one attribute child per description LLXMLNodePtr attr_node; - if (!new_node->getAttribute(attr_name.c_str(), attr_node, FALSE)) + if (!new_node->getAttribute(attr_name.c_str(), attr_node, false)) { - attr_node = new LLXMLNode(attr_name.c_str(), TRUE); + attr_node = new LLXMLNode(attr_name.c_str(), true); attr_node->setLineNumber(XML_GetCurrentLineNumber(*new_node_ptr->mParser)); } attr_node->setValue(attr_value); @@ -511,13 +511,13 @@ void XMLCALL EndXMLNode(void *userData, if (LLXMLNode::sStripWhitespaceValues) { std::string value = node->getValue(); - BOOL is_empty = TRUE; + bool is_empty = true; for (std::string::size_type s = 0; s < value.length(); s++) { char c = value[s]; if (c != ' ' && c != '\t' && c != '\n') { - is_empty = FALSE; + is_empty = false; break; } } @@ -578,7 +578,7 @@ bool LLXMLNode::updateNode( if (!node || !update_node) { LL_WARNS() << "Node invalid" << LL_ENDL; - return FALSE; + return false; } //update the node value @@ -650,7 +650,7 @@ bool LLXMLNode::updateNode( } } - return TRUE; + return true; } // static @@ -673,7 +673,7 @@ bool LLXMLNode::parseFile(const std::string& filename, LLXMLNodePtr& node, LLXML buffer[nread] = 0; fclose(fp); - bool rv = parseBuffer(buffer, nread, node, defaults_tree); + bool rv = parseBuffer(buffer, static_cast<U32>(nread), node, defaults_tree); delete [] buffer; return rv; } @@ -691,7 +691,7 @@ bool LLXMLNode::parseBuffer( XML_SetCharacterDataHandler(my_parser, XMLData); // Create a root node - LLXMLNode *file_node_ptr = new LLXMLNode("XML", FALSE); + LLXMLNode *file_node_ptr = new LLXMLNode("XML", false); LLXMLNodePtr file_node = file_node_ptr; file_node->mParser = &my_parser; @@ -699,7 +699,7 @@ bool LLXMLNode::parseBuffer( XML_SetUserData(my_parser, (void *)file_node_ptr); // Do the parsing - if (XML_Parse(my_parser, (const char *)buffer, length, TRUE) != XML_STATUS_OK) + if (XML_Parse(my_parser, (const char *)buffer, length, true) != XML_STATUS_OK) { LL_WARNS() << "Error parsing xml error code: " << XML_ErrorString(XML_GetErrorCode(my_parser)) @@ -739,7 +739,7 @@ bool LLXMLNode::parseStream( XML_SetCharacterDataHandler(my_parser, XMLData); // Create a root node - LLXMLNode *file_node_ptr = new LLXMLNode("XML", FALSE); + LLXMLNode *file_node_ptr = new LLXMLNode("XML", false); LLXMLNodePtr file_node = file_node_ptr; file_node->mParser = &my_parser; @@ -787,18 +787,18 @@ bool LLXMLNode::parseStream( } -BOOL LLXMLNode::isFullyDefault() +bool LLXMLNode::isFullyDefault() { if (mDefault.isNull()) { - return FALSE; + return false; } - BOOL has_default_value = (mValue == mDefault->mValue); - BOOL has_default_attribute = (mIsAttribute == mDefault->mIsAttribute); - BOOL has_default_type = mIsAttribute || (mType == mDefault->mType); - BOOL has_default_encoding = mIsAttribute || (mEncoding == mDefault->mEncoding); - BOOL has_default_precision = mIsAttribute || (mPrecision == mDefault->mPrecision); - BOOL has_default_length = mIsAttribute || (mLength == mDefault->mLength); + bool has_default_value = (mValue == mDefault->mValue); + bool has_default_attribute = (mIsAttribute == mDefault->mIsAttribute); + bool has_default_type = mIsAttribute || (mType == mDefault->mType); + bool has_default_encoding = mIsAttribute || (mEncoding == mDefault->mEncoding); + bool has_default_precision = mIsAttribute || (mPrecision == mDefault->mPrecision); + bool has_default_length = mIsAttribute || (mLength == mDefault->mLength); if (has_default_value && has_default_type @@ -816,14 +816,14 @@ BOOL LLXMLNode::isFullyDefault() LLXMLNodePtr child = (*children_itr).second; if (!child->isFullyDefault()) { - return FALSE; + return false; } } } - return TRUE; + return true; } - return FALSE; + return false; } // static @@ -911,10 +911,10 @@ void LLXMLNode::writeToOstream(std::ostream& output_stream, const std::string& i return; } - BOOL has_default_type = mDefault.isNull()?FALSE:(mType == mDefault->mType); - BOOL has_default_encoding = mDefault.isNull()?FALSE:(mEncoding == mDefault->mEncoding); - BOOL has_default_precision = mDefault.isNull()?FALSE:(mPrecision == mDefault->mPrecision); - BOOL has_default_length = mDefault.isNull()?FALSE:(mLength == mDefault->mLength); + bool has_default_type = mDefault.isNull()?false:(mType == mDefault->mType); + bool has_default_encoding = mDefault.isNull()?false:(mEncoding == mDefault->mEncoding); + bool has_default_precision = mDefault.isNull()?false:(mPrecision == mDefault->mPrecision); + bool has_default_length = mDefault.isNull()?false:(mLength == mDefault->mLength); // stream the name output_stream << indent << "<" << mName->mString << "\n"; @@ -1156,12 +1156,12 @@ void LLXMLNode::scrubToTree(LLXMLNode *tree) } } -bool LLXMLNode::getChild(const char* name, LLXMLNodePtr& node, BOOL use_default_if_missing) +bool LLXMLNode::getChild(const char* name, LLXMLNodePtr& node, bool use_default_if_missing) { return getChild(gStringTable.checkStringEntry(name), node, use_default_if_missing); } -bool LLXMLNode::getChild(const LLStringTableEntry* name, LLXMLNodePtr& node, BOOL use_default_if_missing) +bool LLXMLNode::getChild(const LLStringTableEntry* name, LLXMLNodePtr& node, bool use_default_if_missing) { if (mChildren.notNull()) { @@ -1174,18 +1174,18 @@ bool LLXMLNode::getChild(const LLStringTableEntry* name, LLXMLNodePtr& node, BOO } if (use_default_if_missing && !mDefault.isNull()) { - return mDefault->getChild(name, node, FALSE); + return mDefault->getChild(name, node, false); } node = NULL; return false; } -void LLXMLNode::getChildren(const char* name, LLXMLNodeList &children, BOOL use_default_if_missing) const +void LLXMLNode::getChildren(const char* name, LLXMLNodeList &children, bool use_default_if_missing) const { getChildren(gStringTable.checkStringEntry(name), children, use_default_if_missing); } -void LLXMLNode::getChildren(const LLStringTableEntry* name, LLXMLNodeList &children, BOOL use_default_if_missing) const +void LLXMLNode::getChildren(const LLStringTableEntry* name, LLXMLNodeList &children, bool use_default_if_missing) const { if (mChildren.notNull()) { @@ -1207,7 +1207,7 @@ void LLXMLNode::getChildren(const LLStringTableEntry* name, LLXMLNodeList &child } if (children.size() == 0 && use_default_if_missing && !mDefault.isNull()) { - mDefault->getChildren(name, children, FALSE); + mDefault->getChildren(name, children, false); } } @@ -1230,12 +1230,12 @@ void LLXMLNode::getDescendants(const LLStringTableEntry* name, LLXMLNodeList &ch } } -bool LLXMLNode::getAttribute(const char* name, LLXMLNodePtr& node, BOOL use_default_if_missing) +bool LLXMLNode::getAttribute(const char* name, LLXMLNodePtr& node, bool use_default_if_missing) { return getAttribute(gStringTable.checkStringEntry(name), node, use_default_if_missing); } -bool LLXMLNode::getAttribute(const LLStringTableEntry* name, LLXMLNodePtr& node, BOOL use_default_if_missing) +bool LLXMLNode::getAttribute(const LLStringTableEntry* name, LLXMLNodePtr& node, bool use_default_if_missing) { LLXMLAttribList::const_iterator child_itr = mAttributes.find(name); if (child_itr != mAttributes.end()) @@ -1245,7 +1245,7 @@ bool LLXMLNode::getAttribute(const LLStringTableEntry* name, LLXMLNodePtr& node, } if (use_default_if_missing && !mDefault.isNull()) { - return mDefault->getAttribute(name, node, FALSE); + return mDefault->getAttribute(name, node, false); } return false; @@ -1264,42 +1264,25 @@ bool LLXMLNode::setAttributeString(const char* attr, const std::string& value) return false; } -BOOL LLXMLNode::hasAttribute(const char* name ) +bool LLXMLNode::hasAttribute(const char* name ) { LLXMLNodePtr node; return getAttribute(name, node); } -// the structure of these getAttribute_ functions is ugly, but it's because the -// underlying system is based on BOOL and LLString; if we change -// so that they're based on more generic mechanisms, these will be -// simplified. -bool LLXMLNode::getAttribute_bool(const char* name, bool& value ) -{ - LLXMLNodePtr node; - if (!getAttribute(name, node)) - { - return false; - } - BOOL temp; - bool retval = node->getBoolValue(1, &temp); - value = temp; - return retval; -} - -BOOL LLXMLNode::getAttributeBOOL(const char* name, BOOL& value ) +bool LLXMLNode::getAttributeBOOL(const char* name, bool& value ) { LLXMLNodePtr node; return (getAttribute(name, node) && node->getBoolValue(1, &value)); } -BOOL LLXMLNode::getAttributeU8(const char* name, U8& value ) +bool LLXMLNode::getAttributeU8(const char* name, U8& value ) { LLXMLNodePtr node; return (getAttribute(name, node) && node->getByteValue(1, &value)); } -BOOL LLXMLNode::getAttributeS8(const char* name, S8& value ) +bool LLXMLNode::getAttributeS8(const char* name, S8& value ) { LLXMLNodePtr node; S32 val; @@ -1311,7 +1294,7 @@ BOOL LLXMLNode::getAttributeS8(const char* name, S8& value ) return true; } -BOOL LLXMLNode::getAttributeU16(const char* name, U16& value ) +bool LLXMLNode::getAttributeU16(const char* name, U16& value ) { LLXMLNodePtr node; U32 val; @@ -1323,7 +1306,7 @@ BOOL LLXMLNode::getAttributeU16(const char* name, U16& value ) return true; } -BOOL LLXMLNode::getAttributeS16(const char* name, S16& value ) +bool LLXMLNode::getAttributeS16(const char* name, S16& value ) { LLXMLNodePtr node; S32 val; @@ -1335,73 +1318,73 @@ BOOL LLXMLNode::getAttributeS16(const char* name, S16& value ) return true; } -BOOL LLXMLNode::getAttributeU32(const char* name, U32& value ) +bool LLXMLNode::getAttributeU32(const char* name, U32& value ) { LLXMLNodePtr node; return (getAttribute(name, node) && node->getUnsignedValue(1, &value)); } -BOOL LLXMLNode::getAttributeS32(const char* name, S32& value ) +bool LLXMLNode::getAttributeS32(const char* name, S32& value ) { LLXMLNodePtr node; return (getAttribute(name, node) && node->getIntValue(1, &value)); } -BOOL LLXMLNode::getAttributeF32(const char* name, F32& value ) +bool LLXMLNode::getAttributeF32(const char* name, F32& value ) { LLXMLNodePtr node; return (getAttribute(name, node) && node->getFloatValue(1, &value)); } -BOOL LLXMLNode::getAttributeF64(const char* name, F64& value ) +bool LLXMLNode::getAttributeF64(const char* name, F64& value ) { LLXMLNodePtr node; return (getAttribute(name, node) && node->getDoubleValue(1, &value)); } -BOOL LLXMLNode::getAttributeColor(const char* name, LLColor4& value ) +bool LLXMLNode::getAttributeColor(const char* name, LLColor4& value ) { LLXMLNodePtr node; return (getAttribute(name, node) && node->getFloatValue(4, value.mV)); } -BOOL LLXMLNode::getAttributeColor4(const char* name, LLColor4& value ) +bool LLXMLNode::getAttributeColor4(const char* name, LLColor4& value ) { LLXMLNodePtr node; return (getAttribute(name, node) && node->getFloatValue(4, value.mV)); } -BOOL LLXMLNode::getAttributeColor4U(const char* name, LLColor4U& value ) +bool LLXMLNode::getAttributeColor4U(const char* name, LLColor4U& value ) { LLXMLNodePtr node; return (getAttribute(name, node) && node->getByteValue(4, value.mV)); } -BOOL LLXMLNode::getAttributeVector3(const char* name, LLVector3& value ) +bool LLXMLNode::getAttributeVector3(const char* name, LLVector3& value ) { LLXMLNodePtr node; return (getAttribute(name, node) && node->getFloatValue(3, value.mV)); } -BOOL LLXMLNode::getAttributeVector3d(const char* name, LLVector3d& value ) +bool LLXMLNode::getAttributeVector3d(const char* name, LLVector3d& value ) { LLXMLNodePtr node; return (getAttribute(name, node) && node->getDoubleValue(3, value.mdV)); } -BOOL LLXMLNode::getAttributeQuat(const char* name, LLQuaternion& value ) +bool LLXMLNode::getAttributeQuat(const char* name, LLQuaternion& value ) { LLXMLNodePtr node; return (getAttribute(name, node) && node->getFloatValue(4, value.mQ)); } -BOOL LLXMLNode::getAttributeUUID(const char* name, LLUUID& value ) +bool LLXMLNode::getAttributeUUID(const char* name, LLUUID& value ) { LLXMLNodePtr node; return (getAttribute(name, node) && node->getUUIDValue(1, &value)); } -BOOL LLXMLNode::getAttributeString(const char* name, std::string& value ) +bool LLXMLNode::getAttributeString(const char* name, std::string& value ) { LLXMLNodePtr node; if (!getAttribute(name, node)) @@ -1438,10 +1421,10 @@ const char *LLXMLNode::skipNonWhitespace(const char *str) } /*static */ -const char *LLXMLNode::parseInteger(const char *str, U64 *dest, BOOL *is_negative, U32 precision, Encoding encoding) +const char *LLXMLNode::parseInteger(const char *str, U64 *dest, bool *is_negative, U32 precision, Encoding encoding) { *dest = 0; - *is_negative = FALSE; + *is_negative = false; str = skipWhitespace(str); @@ -1455,7 +1438,7 @@ const char *LLXMLNode::parseInteger(const char *str, U64 *dest, BOOL *is_negativ } if (str[0] == '-') { - *is_negative = TRUE; + *is_negative = true; ++str; } @@ -1656,7 +1639,7 @@ const char *LLXMLNode::parseFloat(const char *str, F64 *dest, U32 precision, Enc // Scientific notation! ++str; U64 exp; - BOOL is_negative; + bool is_negative; str = parseInteger(str, &exp, &is_negative, 64, ENCODING_DECIMAL); if (str == NULL) { @@ -1680,7 +1663,7 @@ const char *LLXMLNode::parseFloat(const char *str, F64 *dest, U32 precision, Enc if (encoding == ENCODING_HEX) { U64 bytes_dest; - BOOL is_negative; + bool is_negative; str = parseInteger(str, (U64 *)&bytes_dest, &is_negative, precision, ENCODING_HEX); // Upcast to F64 switch (precision) @@ -1703,7 +1686,7 @@ const char *LLXMLNode::parseFloat(const char *str, F64 *dest, U32 precision, Enc return NULL; } -U32 LLXMLNode::getBoolValue(U32 expected_length, BOOL *array) +U32 LLXMLNode::getBoolValue(U32 expected_length, bool *array) { llassert(array); @@ -1723,11 +1706,11 @@ U32 LLXMLNode::getBoolValue(U32 expected_length, BOOL *array) LLStringUtil::toLower(str_array[i]); if (str_array[i] == "false") { - array[ret_length++] = FALSE; + array[ret_length++] = false; } else if (str_array[i] == "true") { - array[ret_length++] = TRUE; + array[ret_length++] = true; } } @@ -1773,7 +1756,7 @@ U32 LLXMLNode::getByteValue(U32 expected_length, U8 *array, Encoding encoding) for (i=0; i<expected_length; ++i) { U64 value; - BOOL is_negative; + bool is_negative; value_string = parseInteger(value_string, &value, &is_negative, 8, encoding); if (value_string == NULL) { @@ -1825,7 +1808,7 @@ U32 LLXMLNode::getIntValue(U32 expected_length, S32 *array, Encoding encoding) for (i=0; i<expected_length; ++i) { U64 value; - BOOL is_negative; + bool is_negative; value_string = parseInteger(value_string, &value, &is_negative, 32, encoding); if (value_string == NULL) { @@ -1879,7 +1862,7 @@ U32 LLXMLNode::getUnsignedValue(U32 expected_length, U32 *array, Encoding encodi for (i=0; i<expected_length; ++i) { U64 value; - BOOL is_negative; + bool is_negative; value_string = parseInteger(value_string, &value, &is_negative, 32, encoding); if (value_string == NULL) { @@ -1933,7 +1916,7 @@ U32 LLXMLNode::getLongValue(U32 expected_length, U64 *array, Encoding encoding) for (i=0; i<expected_length; ++i) { U64 value; - BOOL is_negative; + bool is_negative; value_string = parseInteger(value_string, &value, &is_negative, 64, encoding); if (value_string == NULL) { @@ -2188,7 +2171,7 @@ U32 LLXMLNode::getNodeRefValue(U32 expected_length, LLXMLNode **array) return num_returned_refs; } -void LLXMLNode::setBoolValue(U32 length, const BOOL *array) +void LLXMLNode::setBoolValue(U32 length, const bool *array) { if (length == 0) return; @@ -2617,7 +2600,7 @@ void LLXMLNode::findDefault(LLXMLNode *defaults_list) mDefault = NULL; } -BOOL LLXMLNode::deleteChildren(const std::string& name) +bool LLXMLNode::deleteChildren(const std::string& name) { U32 removed_count = 0; LLXMLNodeList node_list; @@ -2636,10 +2619,10 @@ BOOL LLXMLNode::deleteChildren(const std::string& name) } } } - return removed_count > 0 ? TRUE : FALSE; + return removed_count > 0; } -BOOL LLXMLNode::deleteChildren(LLStringTableEntry* name) +bool LLXMLNode::deleteChildren(LLStringTableEntry* name) { U32 removed_count = 0; LLXMLNodeList node_list; @@ -2658,7 +2641,7 @@ BOOL LLXMLNode::deleteChildren(LLStringTableEntry* name) } } } - return removed_count > 0 ? TRUE : FALSE; + return removed_count > 0; } void LLXMLNode::setAttributes(LLXMLNode::ValueType type, U32 precision, LLXMLNode::Encoding encoding, U32 length) @@ -2701,7 +2684,7 @@ U32 LLXMLNode::getChildCount() const { if (mChildren.notNull()) { - return mChildren->map.size(); + return static_cast<U32>(mChildren->map.size()); } return 0; } @@ -2720,7 +2703,7 @@ LLXMLNode *get_rand_node(LLXMLNode *node) { if (node->mChildren.notNull()) { - U32 num_children = node->mChildren->map.size(); + U32 num_children = static_cast<U32>(node->mChildren->map.size()); if (get_rand(2) == 0) { while (true) @@ -2781,7 +2764,7 @@ void LLXMLNode::createUnitTest(S32 max_num_children) child_name.append(1, c); } - LLXMLNode *new_child = createChild(child_name.c_str(), FALSE); + LLXMLNode *new_child = createChild(child_name.c_str(), false); // Random ID std::string child_id; @@ -2808,7 +2791,7 @@ void LLXMLNode::createUnitTest(S32 max_num_children) break; case 1: // TYPE_BOOLEAN { - BOOL random_bool_values[30]; + bool random_bool_values[30]; for (U32 value=0; value<array_size; ++value) { random_bool_values[value] = get_rand(2); @@ -2916,20 +2899,20 @@ void LLXMLNode::createUnitTest(S32 max_num_children) } } - createChild("integer_checksum", TRUE)->setUnsignedValue(1, &integer_checksum, LLXMLNode::ENCODING_HEX); - createChild("long_checksum", TRUE)->setLongValue(1, &long_checksum, LLXMLNode::ENCODING_HEX); - createChild("bool_true_count", TRUE)->setUnsignedValue(1, &bool_true_count, LLXMLNode::ENCODING_HEX); - createChild("uuid_checksum", TRUE)->setUUIDValue(1, &uuid_checksum); - createChild("noderef_checksum", TRUE)->setUnsignedValue(1, &noderef_checksum, LLXMLNode::ENCODING_HEX); - createChild("float_checksum", TRUE)->setUnsignedValue(1, &float_checksum, LLXMLNode::ENCODING_HEX); + createChild("integer_checksum", true)->setUnsignedValue(1, &integer_checksum, LLXMLNode::ENCODING_HEX); + createChild("long_checksum", true)->setLongValue(1, &long_checksum, LLXMLNode::ENCODING_HEX); + createChild("bool_true_count", true)->setUnsignedValue(1, &bool_true_count, LLXMLNode::ENCODING_HEX); + createChild("uuid_checksum", true)->setUUIDValue(1, &uuid_checksum); + createChild("noderef_checksum", true)->setUnsignedValue(1, &noderef_checksum, LLXMLNode::ENCODING_HEX); + createChild("float_checksum", true)->setUnsignedValue(1, &float_checksum, LLXMLNode::ENCODING_HEX); } -BOOL LLXMLNode::performUnitTest(std::string &error_buffer) +bool LLXMLNode::performUnitTest(std::string &error_buffer) { if (mChildren.isNull()) { error_buffer.append(llformat("ERROR Node %s: No children found.\n", mName->mString)); - return FALSE; + return false; } // Checksums @@ -2953,14 +2936,14 @@ BOOL LLXMLNode::performUnitTest(std::string &error_buffer) if (!node->performUnitTest(error_buffer)) { error_buffer.append(llformat("Child test failed for %s.\n", mName->mString)); - //return FALSE; + //return false; } continue; } if (node->mLength < 1 || node->mLength > 30) { error_buffer.append(llformat("ERROR Node %s: Invalid array length %d, child %s.\n", mName->mString, node->mLength, node->mName->mString)); - return FALSE; + return false; } switch (node->mType) { @@ -2969,11 +2952,11 @@ BOOL LLXMLNode::performUnitTest(std::string &error_buffer) break; case TYPE_BOOLEAN: { - BOOL bool_array[30]; + bool bool_array[30]; if (node->getBoolValue(node->mLength, bool_array) < node->mLength) { error_buffer.append(llformat("ERROR Node %s: Could not read boolean array, child %s.\n", mName->mString, node->mName->mString)); - return FALSE; + return false; } for (U32 pos=0; pos<(U32)node->mLength; ++pos) { @@ -2992,7 +2975,7 @@ BOOL LLXMLNode::performUnitTest(std::string &error_buffer) if (node->getUnsignedValue(node->mLength, integer_array, node->mEncoding) < node->mLength) { error_buffer.append(llformat("ERROR Node %s: Could not read integer array, child %s.\n", mName->mString, node->mName->mString)); - return FALSE; + return false; } for (U32 pos=0; pos<(U32)node->mLength; ++pos) { @@ -3005,7 +2988,7 @@ BOOL LLXMLNode::performUnitTest(std::string &error_buffer) if (node->getLongValue(node->mLength, integer_array, node->mEncoding) < node->mLength) { error_buffer.append(llformat("ERROR Node %s: Could not read long integer array, child %s.\n", mName->mString, node->mName->mString)); - return FALSE; + return false; } for (U32 pos=0; pos<(U32)node->mLength; ++pos) { @@ -3022,7 +3005,7 @@ BOOL LLXMLNode::performUnitTest(std::string &error_buffer) if (node->getFloatValue(node->mLength, float_array, node->mEncoding) < node->mLength) { error_buffer.append(llformat("ERROR Node %s: Could not read float array, child %s.\n", mName->mString, node->mName->mString)); - return FALSE; + return false; } for (U32 pos=0; pos<(U32)node->mLength; ++pos) { @@ -3036,7 +3019,7 @@ BOOL LLXMLNode::performUnitTest(std::string &error_buffer) if (node->getDoubleValue(node->mLength, float_array, node->mEncoding) < node->mLength) { error_buffer.append(llformat("ERROR Node %s: Could not read float array, child %s.\n", mName->mString, node->mName->mString)); - return FALSE; + return false; } for (U32 pos=0; pos<(U32)node->mLength; ++pos) { @@ -3054,7 +3037,7 @@ BOOL LLXMLNode::performUnitTest(std::string &error_buffer) if (node->getUUIDValue(node->mLength, uuid_array) < node->mLength) { error_buffer.append(llformat("ERROR Node %s: Could not read uuid array, child %s.\n", mName->mString, node->mName->mString)); - return FALSE; + return false; } for (U32 pos=0; pos<(U32)node->mLength; ++pos) { @@ -3071,7 +3054,7 @@ BOOL LLXMLNode::performUnitTest(std::string &error_buffer) if (node->getNodeRefValue(node->mLength, node_array) < node->mLength) { error_buffer.append(llformat("ERROR Node %s: Could not read node ref array, child %s.\n", mName->mString, node->mName->mString)); - return FALSE; + return false; } for (U32 pos=0; pos<node->mLength; ++pos) { @@ -3092,97 +3075,97 @@ BOOL LLXMLNode::performUnitTest(std::string &error_buffer) // Compare checksums { U32 node_integer_checksum = 0; - if (!getAttribute("integer_checksum", checksum_node, FALSE) || + if (!getAttribute("integer_checksum", checksum_node, false) || checksum_node->getUnsignedValue(1, &node_integer_checksum, ENCODING_HEX) != 1) { error_buffer.append(llformat("ERROR Node %s: Integer checksum missing.\n", mName->mString)); - return FALSE; + return false; } if (node_integer_checksum != integer_checksum) { error_buffer.append(llformat("ERROR Node %s: Integer checksum mismatch: read %X / calc %X.\n", mName->mString, node_integer_checksum, integer_checksum)); - return FALSE; + return false; } } { U64 node_long_checksum = 0; - if (!getAttribute("long_checksum", checksum_node, FALSE) || + if (!getAttribute("long_checksum", checksum_node, false) || checksum_node->getLongValue(1, &node_long_checksum, ENCODING_HEX) != 1) { error_buffer.append(llformat("ERROR Node %s: Long Integer checksum missing.\n", mName->mString)); - return FALSE; + return false; } if (node_long_checksum != long_checksum) { U32 *pp1 = (U32 *)&node_long_checksum; U32 *pp2 = (U32 *)&long_checksum; error_buffer.append(llformat("ERROR Node %s: Long Integer checksum mismatch: read %08X%08X / calc %08X%08X.\n", mName->mString, pp1[1], pp1[0], pp2[1], pp2[0])); - return FALSE; + return false; } } { U32 node_bool_true_count = 0; - if (!getAttribute("bool_true_count", checksum_node, FALSE) || + if (!getAttribute("bool_true_count", checksum_node, false) || checksum_node->getUnsignedValue(1, &node_bool_true_count, ENCODING_HEX) != 1) { error_buffer.append(llformat("ERROR Node %s: Boolean checksum missing.\n", mName->mString)); - return FALSE; + return false; } if (node_bool_true_count != bool_true_count) { error_buffer.append(llformat("ERROR Node %s: Boolean checksum mismatch: read %X / calc %X.\n", mName->mString, node_bool_true_count, bool_true_count)); - return FALSE; + return false; } } { LLUUID node_uuid_checksum; - if (!getAttribute("uuid_checksum", checksum_node, FALSE) || + if (!getAttribute("uuid_checksum", checksum_node, false) || checksum_node->getUUIDValue(1, &node_uuid_checksum) != 1) { error_buffer.append(llformat("ERROR Node %s: UUID checksum missing.\n", mName->mString)); - return FALSE; + return false; } if (node_uuid_checksum != uuid_checksum) { error_buffer.append(llformat("ERROR Node %s: UUID checksum mismatch: read %s / calc %s.\n", mName->mString, node_uuid_checksum.asString().c_str(), uuid_checksum.asString().c_str())); - return FALSE; + return false; } } { U32 node_noderef_checksum = 0; - if (!getAttribute("noderef_checksum", checksum_node, FALSE) || + if (!getAttribute("noderef_checksum", checksum_node, false) || checksum_node->getUnsignedValue(1, &node_noderef_checksum, ENCODING_HEX) != 1) { error_buffer.append(llformat("ERROR Node %s: Node Ref checksum missing.\n", mName->mString)); - return FALSE; + return false; } if (node_noderef_checksum != noderef_checksum) { error_buffer.append(llformat("ERROR Node %s: Node Ref checksum mismatch: read %X / calc %X.\n", mName->mString, node_noderef_checksum, noderef_checksum)); - return FALSE; + return false; } } { U32 node_float_checksum = 0; - if (!getAttribute("float_checksum", checksum_node, FALSE) || + if (!getAttribute("float_checksum", checksum_node, false) || checksum_node->getUnsignedValue(1, &node_float_checksum, ENCODING_HEX) != 1) { error_buffer.append(llformat("ERROR Node %s: Float checksum missing.\n", mName->mString)); - return FALSE; + return false; } if (node_float_checksum != float_checksum) { error_buffer.append(llformat("ERROR Node %s: Float checksum mismatch: read %X / calc %X.\n", mName->mString, node_float_checksum, float_checksum)); - return FALSE; + return false; } } - return TRUE; + return true; } LLXMLNodePtr LLXMLNode::getFirstChild() const diff --git a/indra/llxml/llxmlnode.h b/indra/llxml/llxmlnode.h index 62ab51fa8c..b8e29bbfef 100644 --- a/indra/llxml/llxmlnode.h +++ b/indra/llxml/llxmlnode.h @@ -57,9 +57,9 @@ struct CompareAttributes bool operator()(const LLStringTableEntry* const lhs, const LLStringTableEntry* const rhs) const { if (lhs == NULL) - return TRUE; + return true; if (rhs == NULL) - return FALSE; + return true; return strcmp(lhs->mString, rhs->mString) < 0; } @@ -118,14 +118,14 @@ protected: public: LLXMLNode(); - LLXMLNode(const char* name, BOOL is_attribute); - LLXMLNode(LLStringTableEntry* name, BOOL is_attribute); + LLXMLNode(const char* name, bool is_attribute); + LLXMLNode(LLStringTableEntry* name, bool is_attribute); LLXMLNode(const LLXMLNode& rhs); LLXMLNodePtr deepCopy(); - BOOL isNull(); + bool isNull(); - BOOL deleteChild(LLXMLNode* child); + bool deleteChild(LLXMLNode* child); void addChild(LLXMLNodePtr& new_child); void setParent(LLXMLNodePtr& new_parent); // reparent if necessary @@ -165,12 +165,12 @@ public: void findID(const std::string& id, LLXMLNodeList &results); - virtual LLXMLNodePtr createChild(const char* name, BOOL is_attribute); - virtual LLXMLNodePtr createChild(LLStringTableEntry* name, BOOL is_attribute); + virtual LLXMLNodePtr createChild(const char* name, bool is_attribute); + virtual LLXMLNodePtr createChild(LLStringTableEntry* name, bool is_attribute); // Getters - U32 getBoolValue(U32 expected_length, BOOL *array); + U32 getBoolValue(U32 expected_length, bool *array); U32 getByteValue(U32 expected_length, U8 *array, Encoding encoding = ENCODING_DEFAULT); U32 getIntValue(U32 expected_length, S32 *array, Encoding encoding = ENCODING_DEFAULT); U32 getUnsignedValue(U32 expected_length, U32 *array, Encoding encoding = ENCODING_DEFAULT); @@ -181,29 +181,25 @@ public: U32 getUUIDValue(U32 expected_length, LLUUID *array); U32 getNodeRefValue(U32 expected_length, LLXMLNode **array); - BOOL hasAttribute(const char* name ); - - // these are designed to be more generic versions of the functions - // rather than relying on LL-types - bool getAttribute_bool(const char* name, bool& value ); - - BOOL getAttributeBOOL(const char* name, BOOL& value ); - BOOL getAttributeU8(const char* name, U8& value ); - BOOL getAttributeS8(const char* name, S8& value ); - BOOL getAttributeU16(const char* name, U16& value ); - BOOL getAttributeS16(const char* name, S16& value ); - BOOL getAttributeU32(const char* name, U32& value ); - BOOL getAttributeS32(const char* name, S32& value ); - BOOL getAttributeF32(const char* name, F32& value ); - BOOL getAttributeF64(const char* name, F64& value ); - BOOL getAttributeColor(const char* name, LLColor4& value ); - BOOL getAttributeColor4(const char* name, LLColor4& value ); - BOOL getAttributeColor4U(const char* name, LLColor4U& value ); - BOOL getAttributeVector3(const char* name, LLVector3& value ); - BOOL getAttributeVector3d(const char* name, LLVector3d& value ); - BOOL getAttributeQuat(const char* name, LLQuaternion& value ); - BOOL getAttributeUUID(const char* name, LLUUID& value ); - BOOL getAttributeString(const char* name, std::string& value ); + bool hasAttribute(const char* name ); + + bool getAttributeBOOL(const char* name, bool& value ); + bool getAttributeU8(const char* name, U8& value ); + bool getAttributeS8(const char* name, S8& value ); + bool getAttributeU16(const char* name, U16& value ); + bool getAttributeS16(const char* name, S16& value ); + bool getAttributeU32(const char* name, U32& value ); + bool getAttributeS32(const char* name, S32& value ); + bool getAttributeF32(const char* name, F32& value ); + bool getAttributeF64(const char* name, F64& value ); + bool getAttributeColor(const char* name, LLColor4& value ); + bool getAttributeColor4(const char* name, LLColor4& value ); + bool getAttributeColor4U(const char* name, LLColor4U& value ); + bool getAttributeVector3(const char* name, LLVector3& value ); + bool getAttributeVector3d(const char* name, LLVector3d& value ); + bool getAttributeQuat(const char* name, LLQuaternion& value ); + bool getAttributeUUID(const char* name, LLUUID& value ); + bool getAttributeString(const char* name, std::string& value ); const ValueType& getType() const { return mType; } U32 getLength() const { return mLength; } @@ -212,23 +208,23 @@ public: std::string getSanitizedValue() const; std::string getTextContents() const; const LLStringTableEntry* getName() const { return mName; } - BOOL hasName(const char* name) const { return mName == gStringTable.checkStringEntry(name); } - BOOL hasName(const std::string& name) const { return mName == gStringTable.checkStringEntry(name.c_str()); } + bool hasName(const char* name) const { return mName == gStringTable.checkStringEntry(name); } + bool hasName(const std::string& name) const { return mName == gStringTable.checkStringEntry(name.c_str()); } const std::string& getID() const { return mID; } U32 getChildCount() const; // getChild returns a Null LLXMLNode (not a NULL pointer) if there is no such child. // This child has no value so any getTYPEValue() calls on it will return 0. - bool getChild(const char* name, LLXMLNodePtr& node, BOOL use_default_if_missing = TRUE); - bool getChild(const LLStringTableEntry* name, LLXMLNodePtr& node, BOOL use_default_if_missing = TRUE); - void getChildren(const char* name, LLXMLNodeList &children, BOOL use_default_if_missing = TRUE) const; - void getChildren(const LLStringTableEntry* name, LLXMLNodeList &children, BOOL use_default_if_missing = TRUE) const; + bool getChild(const char* name, LLXMLNodePtr& node, bool use_default_if_missing = true); + bool getChild(const LLStringTableEntry* name, LLXMLNodePtr& node, bool use_default_if_missing = true); + void getChildren(const char* name, LLXMLNodeList &children, bool use_default_if_missing = true) const; + void getChildren(const LLStringTableEntry* name, LLXMLNodeList &children, bool use_default_if_missing = true) const; // recursively finds all children at any level matching name void getDescendants(const LLStringTableEntry* name, LLXMLNodeList &children) const; - bool getAttribute(const char* name, LLXMLNodePtr& node, BOOL use_default_if_missing = TRUE); - bool getAttribute(const LLStringTableEntry* name, LLXMLNodePtr& node, BOOL use_default_if_missing = TRUE); + bool getAttribute(const char* name, LLXMLNodePtr& node, bool use_default_if_missing = true); + bool getAttribute(const LLStringTableEntry* name, LLXMLNodePtr& node, bool use_default_if_missing = true); S32 getLineNumber(); @@ -242,7 +238,7 @@ public: bool setAttributeString(const char* attr, const std::string& value); - void setBoolValue(const BOOL value) { setBoolValue(1, &value); } + void setBoolValue(const bool value) { setBoolValue(1, &value); } void setByteValue(const U8 value, Encoding encoding = ENCODING_DEFAULT) { setByteValue(1, &value, encoding); } void setIntValue(const S32 value, Encoding encoding = ENCODING_DEFAULT) { setIntValue(1, &value, encoding); } void setUnsignedValue(const U32 value, Encoding encoding = ENCODING_DEFAULT) { setUnsignedValue(1, &value, encoding); } @@ -253,7 +249,7 @@ public: void setUUIDValue(const LLUUID value) { setUUIDValue(1, &value); } void setNodeRefValue(const LLXMLNode *value) { setNodeRefValue(1, &value); } - void setBoolValue(U32 length, const BOOL *array); + void setBoolValue(U32 length, const bool *array); void setByteValue(U32 length, const U8 *array, Encoding encoding = ENCODING_DEFAULT); void setIntValue(U32 length, const S32 *array, Encoding encoding = ENCODING_DEFAULT); void setUnsignedValue(U32 length, const U32* array, Encoding encoding = ENCODING_DEFAULT); @@ -283,24 +279,24 @@ public: // Delete any child nodes that aren't among the tree's children, recursive void scrubToTree(LLXMLNode *tree); - BOOL deleteChildren(const std::string& name); - BOOL deleteChildren(LLStringTableEntry* name); + bool deleteChildren(const std::string& name); + bool deleteChildren(LLStringTableEntry* name); void setAttributes(ValueType type, U32 precision, Encoding encoding, U32 length); // void appendValue(const std::string& value); // Unused // Unit Testing void createUnitTest(S32 max_num_children); - BOOL performUnitTest(std::string &error_buffer); + bool performUnitTest(std::string &error_buffer); protected: - BOOL removeChild(LLXMLNode* child); + bool removeChild(LLXMLNode* child); public: std::string mID; // The ID attribute of this node XML_Parser *mParser; // Temporary pointer while loading - BOOL mIsAttribute; // Flag is only used for output formatting + bool mIsAttribute; // Flag is only used for output formatting U32 mVersionMajor; // Version of this tag to use U32 mVersionMinor; U32 mLength; // If the length is nonzero, then only return arrays of this length @@ -315,8 +311,8 @@ public: LLXMLNodePtr mPrev; // Double-linked list previous node LLXMLNodePtr mNext; // Double-linked list next node - static BOOL sStripEscapedStrings; - static BOOL sStripWhitespaceValues; + static bool sStripEscapedStrings; + static bool sStripWhitespaceValues; protected: LLStringTableEntry *mName; // The name of this node @@ -330,10 +326,10 @@ protected: static const char *skipWhitespace(const char *str); static const char *skipNonWhitespace(const char *str); - static const char *parseInteger(const char *str, U64 *dest, BOOL *is_negative, U32 precision, Encoding encoding); + static const char *parseInteger(const char *str, U64 *dest, bool *is_negative, U32 precision, Encoding encoding); static const char *parseFloat(const char *str, F64 *dest, U32 precision, Encoding encoding); - BOOL isFullyDefault(); + bool isFullyDefault(); }; #endif // LL_LLXMLNODE diff --git a/indra/llxml/llxmlparser.cpp b/indra/llxml/llxmlparser.cpp index ecd75bd410..e2c7d17e2a 100644 --- a/indra/llxml/llxmlparser.cpp +++ b/indra/llxml/llxmlparser.cpp @@ -66,17 +66,17 @@ LLXmlParser::~LLXmlParser() } -BOOL LLXmlParser::parseFile(const std::string &path) +bool LLXmlParser::parseFile(const std::string &path) { llassert( !mDepth ); - BOOL success = TRUE; + bool success = true; LLFILE* file = LLFile::fopen(path, "rb"); /* Flawfinder: ignore */ if( !file ) { mAuxErrorString = llformat( "Couldn't open file %s", path.c_str()); - success = FALSE; + success = false; } else { @@ -90,7 +90,7 @@ BOOL LLXmlParser::parseFile(const std::string &path) if( !buffer ) { mAuxErrorString = llformat( "Unable to allocate XML buffer while reading file %s", path.c_str() ); - success = FALSE; + success = false; goto exit_label; } @@ -98,14 +98,14 @@ BOOL LLXmlParser::parseFile(const std::string &path) if( bytes_read <= 0 ) { mAuxErrorString = llformat( "Error while reading file %s", path.c_str() ); - success = FALSE; + success = false; goto exit_label; } - if( !XML_ParseBuffer(mParser, bytes_read, TRUE ) ) + if( !XML_ParseBuffer(mParser, bytes_read, true ) ) { mAuxErrorString = llformat( "Error while parsing file %s", path.c_str() ); - success = FALSE; + success = false; } exit_label: diff --git a/indra/llxml/llxmlparser.h b/indra/llxml/llxmlparser.h index 3a8a927350..0f64def6df 100644 --- a/indra/llxml/llxmlparser.h +++ b/indra/llxml/llxmlparser.h @@ -43,7 +43,7 @@ public: virtual ~LLXmlParser(); // Parses entire file - BOOL parseFile(const std::string &path); + bool parseFile(const std::string &path); // Parses some input. Returns 0 if a fatal error is detected. // The last call must have isFinal true; diff --git a/indra/llxml/llxmltree.cpp b/indra/llxml/llxmltree.cpp index cd41aa6f2d..d66544d0f8 100644 --- a/indra/llxml/llxmltree.cpp +++ b/indra/llxml/llxmltree.cpp @@ -61,13 +61,13 @@ void LLXmlTree::cleanup() } -BOOL LLXmlTree::parseFile(const std::string &path, BOOL keep_contents) +bool LLXmlTree::parseFile(const std::string &path, bool keep_contents) { delete mRoot; mRoot = NULL; LLXmlTreeParser parser(this); - BOOL success = parser.parseFile( path, &mRoot, keep_contents ); + bool success = parser.parseFile( path, &mRoot, keep_contents ); if( !success ) { S32 line_number = parser.getCurrentLineNumber(); @@ -138,16 +138,16 @@ void LLXmlTreeNode::dump( const std::string& prefix ) LL_CONT << LL_ENDL; } -BOOL LLXmlTreeNode::hasAttribute(const std::string& name) +bool LLXmlTreeNode::hasAttribute(const std::string& name) { - LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); + LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString(name); attribute_map_t::iterator iter = mAttributes.find(canonical_name); - return (iter == mAttributes.end()) ? false : true; + return iter != mAttributes.end(); } void LLXmlTreeNode::addAttribute(const std::string& name, const std::string& value) { - LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); + LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString(name); const std::string *newstr = new std::string(value); mAttributes[canonical_name] = newstr; // insert + copy } @@ -202,214 +202,214 @@ void LLXmlTreeNode::addChild(LLXmlTreeNode* child) // These functions assume that name is already in mAttritrubteKeys -BOOL LLXmlTreeNode::getFastAttributeBOOL(LLStdStringHandle canonical_name, BOOL& value) +bool LLXmlTreeNode::getFastAttributeBOOL(LLStdStringHandle canonical_name, bool& value) { const std::string *s = getAttribute( canonical_name ); return s && LLStringUtil::convertToBOOL( *s, value ); } -BOOL LLXmlTreeNode::getFastAttributeU8(LLStdStringHandle canonical_name, U8& value) +bool LLXmlTreeNode::getFastAttributeU8(LLStdStringHandle canonical_name, U8& value) { const std::string *s = getAttribute( canonical_name ); return s && LLStringUtil::convertToU8( *s, value ); } -BOOL LLXmlTreeNode::getFastAttributeS8(LLStdStringHandle canonical_name, S8& value) +bool LLXmlTreeNode::getFastAttributeS8(LLStdStringHandle canonical_name, S8& value) { const std::string *s = getAttribute( canonical_name ); return s && LLStringUtil::convertToS8( *s, value ); } -BOOL LLXmlTreeNode::getFastAttributeS16(LLStdStringHandle canonical_name, S16& value) +bool LLXmlTreeNode::getFastAttributeS16(LLStdStringHandle canonical_name, S16& value) { const std::string *s = getAttribute( canonical_name ); return s && LLStringUtil::convertToS16( *s, value ); } -BOOL LLXmlTreeNode::getFastAttributeU16(LLStdStringHandle canonical_name, U16& value) +bool LLXmlTreeNode::getFastAttributeU16(LLStdStringHandle canonical_name, U16& value) { const std::string *s = getAttribute( canonical_name ); return s && LLStringUtil::convertToU16( *s, value ); } -BOOL LLXmlTreeNode::getFastAttributeU32(LLStdStringHandle canonical_name, U32& value) +bool LLXmlTreeNode::getFastAttributeU32(LLStdStringHandle canonical_name, U32& value) { const std::string *s = getAttribute( canonical_name ); return s && LLStringUtil::convertToU32( *s, value ); } -BOOL LLXmlTreeNode::getFastAttributeS32(LLStdStringHandle canonical_name, S32& value) +bool LLXmlTreeNode::getFastAttributeS32(LLStdStringHandle canonical_name, S32& value) { const std::string *s = getAttribute( canonical_name ); return s && LLStringUtil::convertToS32( *s, value ); } -BOOL LLXmlTreeNode::getFastAttributeF32(LLStdStringHandle canonical_name, F32& value) +bool LLXmlTreeNode::getFastAttributeF32(LLStdStringHandle canonical_name, F32& value) { const std::string *s = getAttribute( canonical_name ); return s && LLStringUtil::convertToF32( *s, value ); } -BOOL LLXmlTreeNode::getFastAttributeF64(LLStdStringHandle canonical_name, F64& value) +bool LLXmlTreeNode::getFastAttributeF64(LLStdStringHandle canonical_name, F64& value) { const std::string *s = getAttribute( canonical_name ); return s && LLStringUtil::convertToF64( *s, value ); } -BOOL LLXmlTreeNode::getFastAttributeColor(LLStdStringHandle canonical_name, LLColor4& value) +bool LLXmlTreeNode::getFastAttributeColor(LLStdStringHandle canonical_name, LLColor4& value) { const std::string *s = getAttribute( canonical_name ); - return s ? LLColor4::parseColor(*s, &value) : FALSE; + return s ? LLColor4::parseColor(*s, &value) : false; } -BOOL LLXmlTreeNode::getFastAttributeColor4(LLStdStringHandle canonical_name, LLColor4& value) +bool LLXmlTreeNode::getFastAttributeColor4(LLStdStringHandle canonical_name, LLColor4& value) { const std::string *s = getAttribute( canonical_name ); - return s ? LLColor4::parseColor4(*s, &value) : FALSE; + return s ? LLColor4::parseColor4(*s, &value) : false; } -BOOL LLXmlTreeNode::getFastAttributeColor4U(LLStdStringHandle canonical_name, LLColor4U& value) +bool LLXmlTreeNode::getFastAttributeColor4U(LLStdStringHandle canonical_name, LLColor4U& value) { const std::string *s = getAttribute( canonical_name ); - return s ? LLColor4U::parseColor4U(*s, &value ) : FALSE; + return s ? LLColor4U::parseColor4U(*s, &value ) : false; } -BOOL LLXmlTreeNode::getFastAttributeVector3(LLStdStringHandle canonical_name, LLVector3& value) +bool LLXmlTreeNode::getFastAttributeVector3(LLStdStringHandle canonical_name, LLVector3& value) { const std::string *s = getAttribute( canonical_name ); - return s ? LLVector3::parseVector3(*s, &value ) : FALSE; + return s ? LLVector3::parseVector3(*s, &value ) : false; } -BOOL LLXmlTreeNode::getFastAttributeVector3d(LLStdStringHandle canonical_name, LLVector3d& value) +bool LLXmlTreeNode::getFastAttributeVector3d(LLStdStringHandle canonical_name, LLVector3d& value) { const std::string *s = getAttribute( canonical_name ); - return s ? LLVector3d::parseVector3d(*s, &value ) : FALSE; + return s ? LLVector3d::parseVector3d(*s, &value ) : false; } -BOOL LLXmlTreeNode::getFastAttributeQuat(LLStdStringHandle canonical_name, LLQuaternion& value) +bool LLXmlTreeNode::getFastAttributeQuat(LLStdStringHandle canonical_name, LLQuaternion& value) { const std::string *s = getAttribute( canonical_name ); - return s ? LLQuaternion::parseQuat(*s, &value ) : FALSE; + return s ? LLQuaternion::parseQuat(*s, &value ) : false; } -BOOL LLXmlTreeNode::getFastAttributeUUID(LLStdStringHandle canonical_name, LLUUID& value) +bool LLXmlTreeNode::getFastAttributeUUID(LLStdStringHandle canonical_name, LLUUID& value) { const std::string *s = getAttribute( canonical_name ); - return s ? LLUUID::parseUUID(*s, &value ) : FALSE; + return s ? LLUUID::parseUUID(*s, &value ) : false; } -BOOL LLXmlTreeNode::getFastAttributeString(LLStdStringHandle canonical_name, std::string& value) +bool LLXmlTreeNode::getFastAttributeString(LLStdStringHandle canonical_name, std::string& value) { const std::string *s = getAttribute( canonical_name ); if( !s ) { - return FALSE; + return false; } value = *s; - return TRUE; + return true; } ////////////////////////////////////////////////////////////// -BOOL LLXmlTreeNode::getAttributeBOOL(const std::string& name, BOOL& value) +bool LLXmlTreeNode::getAttributeBOOL(const std::string& name, bool& value) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); return getFastAttributeBOOL(canonical_name, value); } -BOOL LLXmlTreeNode::getAttributeU8(const std::string& name, U8& value) +bool LLXmlTreeNode::getAttributeU8(const std::string& name, U8& value) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); return getFastAttributeU8(canonical_name, value); } -BOOL LLXmlTreeNode::getAttributeS8(const std::string& name, S8& value) +bool LLXmlTreeNode::getAttributeS8(const std::string& name, S8& value) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); return getFastAttributeS8(canonical_name, value); } -BOOL LLXmlTreeNode::getAttributeS16(const std::string& name, S16& value) +bool LLXmlTreeNode::getAttributeS16(const std::string& name, S16& value) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); return getFastAttributeS16(canonical_name, value); } -BOOL LLXmlTreeNode::getAttributeU16(const std::string& name, U16& value) +bool LLXmlTreeNode::getAttributeU16(const std::string& name, U16& value) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); return getFastAttributeU16(canonical_name, value); } -BOOL LLXmlTreeNode::getAttributeU32(const std::string& name, U32& value) +bool LLXmlTreeNode::getAttributeU32(const std::string& name, U32& value) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); return getFastAttributeU32(canonical_name, value); } -BOOL LLXmlTreeNode::getAttributeS32(const std::string& name, S32& value) +bool LLXmlTreeNode::getAttributeS32(const std::string& name, S32& value) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); return getFastAttributeS32(canonical_name, value); } -BOOL LLXmlTreeNode::getAttributeF32(const std::string& name, F32& value) +bool LLXmlTreeNode::getAttributeF32(const std::string& name, F32& value) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); return getFastAttributeF32(canonical_name, value); } -BOOL LLXmlTreeNode::getAttributeF64(const std::string& name, F64& value) +bool LLXmlTreeNode::getAttributeF64(const std::string& name, F64& value) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); return getFastAttributeF64(canonical_name, value); } -BOOL LLXmlTreeNode::getAttributeColor(const std::string& name, LLColor4& value) +bool LLXmlTreeNode::getAttributeColor(const std::string& name, LLColor4& value) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); return getFastAttributeColor(canonical_name, value); } -BOOL LLXmlTreeNode::getAttributeColor4(const std::string& name, LLColor4& value) +bool LLXmlTreeNode::getAttributeColor4(const std::string& name, LLColor4& value) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); return getFastAttributeColor4(canonical_name, value); } -BOOL LLXmlTreeNode::getAttributeColor4U(const std::string& name, LLColor4U& value) +bool LLXmlTreeNode::getAttributeColor4U(const std::string& name, LLColor4U& value) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); return getFastAttributeColor4U(canonical_name, value); } -BOOL LLXmlTreeNode::getAttributeVector3(const std::string& name, LLVector3& value) +bool LLXmlTreeNode::getAttributeVector3(const std::string& name, LLVector3& value) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); return getFastAttributeVector3(canonical_name, value); } -BOOL LLXmlTreeNode::getAttributeVector3d(const std::string& name, LLVector3d& value) +bool LLXmlTreeNode::getAttributeVector3d(const std::string& name, LLVector3d& value) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); return getFastAttributeVector3d(canonical_name, value); } -BOOL LLXmlTreeNode::getAttributeQuat(const std::string& name, LLQuaternion& value) +bool LLXmlTreeNode::getAttributeQuat(const std::string& name, LLQuaternion& value) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); return getFastAttributeQuat(canonical_name, value); } -BOOL LLXmlTreeNode::getAttributeUUID(const std::string& name, LLUUID& value) +bool LLXmlTreeNode::getAttributeUUID(const std::string& name, LLUUID& value) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); return getFastAttributeUUID(canonical_name, value); } -BOOL LLXmlTreeNode::getAttributeString(const std::string& name, std::string& value) +bool LLXmlTreeNode::getAttributeString(const std::string& name, std::string& value) { LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); return getFastAttributeString(canonical_name, value); @@ -509,8 +509,8 @@ LLXmlTreeParser::LLXmlTreeParser(LLXmlTree* tree) : mTree(tree), mRoot( NULL ), mCurrent( NULL ), - mDump( FALSE ), - mKeepContents(FALSE) + mDump( false ), + mKeepContents(false) { } @@ -518,14 +518,14 @@ LLXmlTreeParser::~LLXmlTreeParser() { } -BOOL LLXmlTreeParser::parseFile(const std::string &path, LLXmlTreeNode** root, BOOL keep_contents) +bool LLXmlTreeParser::parseFile(const std::string &path, LLXmlTreeNode** root, bool keep_contents) { llassert( !mRoot ); llassert( !mCurrent ); mKeepContents = keep_contents; - BOOL success = LLXmlParser::parseFile(path); + bool success = LLXmlParser::parseFile(path); *root = mRoot; mRoot = NULL; @@ -688,7 +688,7 @@ void LLXmlTreeParser::unparsedEntityDecl( void test_llxmltree() { LLXmlTree tree; - BOOL success = tree.parseFile( "test.xml" ); + bool success = tree.parseFile( "test.xml" ); if( success ) { tree.dump(); diff --git a/indra/llxml/llxmltree.h b/indra/llxml/llxmltree.h index 0f7361c554..120d7d3e56 100644 --- a/indra/llxml/llxmltree.h +++ b/indra/llxml/llxmltree.h @@ -55,7 +55,7 @@ public: virtual ~LLXmlTree(); void cleanup(); - virtual BOOL parseFile(const std::string &path, BOOL keep_contents = TRUE); + virtual bool parseFile(const std::string &path, bool keep_contents = true); LLXmlTreeNode* getRoot() { return mRoot; } @@ -97,50 +97,50 @@ public: { return mName; } - BOOL hasName( const std::string& name ) + bool hasName( const std::string& name ) { return mName == name; } - BOOL hasAttribute( const std::string& name ); + bool hasAttribute( const std::string& name ); // Fast versions use cannonical_name handlee to entru in LLXmlTree::sAttributeKeys string table - BOOL getFastAttributeBOOL( LLStdStringHandle cannonical_name, BOOL& value ); - BOOL getFastAttributeU8( LLStdStringHandle cannonical_name, U8& value ); - BOOL getFastAttributeS8( LLStdStringHandle cannonical_name, S8& value ); - BOOL getFastAttributeU16( LLStdStringHandle cannonical_name, U16& value ); - BOOL getFastAttributeS16( LLStdStringHandle cannonical_name, S16& value ); - BOOL getFastAttributeU32( LLStdStringHandle cannonical_name, U32& value ); - BOOL getFastAttributeS32( LLStdStringHandle cannonical_name, S32& value ); - BOOL getFastAttributeF32( LLStdStringHandle cannonical_name, F32& value ); - BOOL getFastAttributeF64( LLStdStringHandle cannonical_name, F64& value ); - BOOL getFastAttributeColor( LLStdStringHandle cannonical_name, LLColor4& value ); - BOOL getFastAttributeColor4( LLStdStringHandle cannonical_name, LLColor4& value ); - BOOL getFastAttributeColor4U( LLStdStringHandle cannonical_name, LLColor4U& value ); - BOOL getFastAttributeVector3( LLStdStringHandle cannonical_name, LLVector3& value ); - BOOL getFastAttributeVector3d( LLStdStringHandle cannonical_name, LLVector3d& value ); - BOOL getFastAttributeQuat( LLStdStringHandle cannonical_name, LLQuaternion& value ); - BOOL getFastAttributeUUID( LLStdStringHandle cannonical_name, LLUUID& value ); - BOOL getFastAttributeString( LLStdStringHandle cannonical_name, std::string& value ); + bool getFastAttributeBOOL( LLStdStringHandle cannonical_name, bool& value ); + bool getFastAttributeU8( LLStdStringHandle cannonical_name, U8& value ); + bool getFastAttributeS8( LLStdStringHandle cannonical_name, S8& value ); + bool getFastAttributeU16( LLStdStringHandle cannonical_name, U16& value ); + bool getFastAttributeS16( LLStdStringHandle cannonical_name, S16& value ); + bool getFastAttributeU32( LLStdStringHandle cannonical_name, U32& value ); + bool getFastAttributeS32( LLStdStringHandle cannonical_name, S32& value ); + bool getFastAttributeF32( LLStdStringHandle cannonical_name, F32& value ); + bool getFastAttributeF64( LLStdStringHandle cannonical_name, F64& value ); + bool getFastAttributeColor( LLStdStringHandle cannonical_name, LLColor4& value ); + bool getFastAttributeColor4( LLStdStringHandle cannonical_name, LLColor4& value ); + bool getFastAttributeColor4U( LLStdStringHandle cannonical_name, LLColor4U& value ); + bool getFastAttributeVector3( LLStdStringHandle cannonical_name, LLVector3& value ); + bool getFastAttributeVector3d( LLStdStringHandle cannonical_name, LLVector3d& value ); + bool getFastAttributeQuat( LLStdStringHandle cannonical_name, LLQuaternion& value ); + bool getFastAttributeUUID( LLStdStringHandle cannonical_name, LLUUID& value ); + bool getFastAttributeString( LLStdStringHandle cannonical_name, std::string& value ); // Normal versions find 'name' in LLXmlTree::sAttributeKeys then call fast versions - virtual BOOL getAttributeBOOL( const std::string& name, BOOL& value ); - virtual BOOL getAttributeU8( const std::string& name, U8& value ); - virtual BOOL getAttributeS8( const std::string& name, S8& value ); - virtual BOOL getAttributeU16( const std::string& name, U16& value ); - virtual BOOL getAttributeS16( const std::string& name, S16& value ); - virtual BOOL getAttributeU32( const std::string& name, U32& value ); - virtual BOOL getAttributeS32( const std::string& name, S32& value ); - virtual BOOL getAttributeF32( const std::string& name, F32& value ); - virtual BOOL getAttributeF64( const std::string& name, F64& value ); - virtual BOOL getAttributeColor( const std::string& name, LLColor4& value ); - virtual BOOL getAttributeColor4( const std::string& name, LLColor4& value ); - virtual BOOL getAttributeColor4U( const std::string& name, LLColor4U& value ); - virtual BOOL getAttributeVector3( const std::string& name, LLVector3& value ); - virtual BOOL getAttributeVector3d( const std::string& name, LLVector3d& value ); - virtual BOOL getAttributeQuat( const std::string& name, LLQuaternion& value ); - virtual BOOL getAttributeUUID( const std::string& name, LLUUID& value ); - virtual BOOL getAttributeString( const std::string& name, std::string& value ); + virtual bool getAttributeBOOL( const std::string& name, bool& value ); + virtual bool getAttributeU8( const std::string& name, U8& value ); + virtual bool getAttributeS8( const std::string& name, S8& value ); + virtual bool getAttributeU16( const std::string& name, U16& value ); + virtual bool getAttributeS16( const std::string& name, S16& value ); + virtual bool getAttributeU32( const std::string& name, U32& value ); + virtual bool getAttributeS32( const std::string& name, S32& value ); + virtual bool getAttributeF32( const std::string& name, F32& value ); + virtual bool getAttributeF64( const std::string& name, F64& value ); + virtual bool getAttributeColor( const std::string& name, LLColor4& value ); + virtual bool getAttributeColor4( const std::string& name, LLColor4& value ); + virtual bool getAttributeColor4U( const std::string& name, LLColor4U& value ); + virtual bool getAttributeVector3( const std::string& name, LLVector3& value ); + virtual bool getAttributeVector3d( const std::string& name, LLVector3d& value ); + virtual bool getAttributeQuat( const std::string& name, LLQuaternion& value ); + virtual bool getAttributeUUID( const std::string& name, LLUUID& value ); + virtual bool getAttributeString( const std::string& name, std::string& value ); const std::string& getContents() { @@ -199,7 +199,7 @@ public: LLXmlTreeParser(LLXmlTree* tree); virtual ~LLXmlTreeParser(); - BOOL parseFile(const std::string &path, LLXmlTreeNode** root, BOOL keep_contents ); + bool parseFile(const std::string &path, LLXmlTreeNode** root, bool keep_contents ); protected: const std::string& tabs(); @@ -227,8 +227,8 @@ protected: LLXmlTree* mTree; LLXmlTreeNode* mRoot; LLXmlTreeNode* mCurrent; - BOOL mDump; // Dump parse tree to LL_INFOS() as it is read. - BOOL mKeepContents; + bool mDump; // Dump parse tree to LL_INFOS() as it is read. + bool mKeepContents; }; #endif // LL_LLXMLTREE_H diff --git a/indra/llxml/tests/llcontrol_test.cpp b/indra/llxml/tests/llcontrol_test.cpp index f5f8b285f7..4192e029c5 100644 --- a/indra/llxml/tests/llcontrol_test.cpp +++ b/indra/llxml/tests/llcontrol_test.cpp @@ -112,7 +112,7 @@ namespace tut LLControlGroup test_cg("foo2"); std::string temp_test_file = (mTestConfigDir + "setting_llsd_temp.xml"); mCleanups.push_back(temp_test_file); - mCG->saveToFile(temp_test_file.c_str(), TRUE); + mCG->saveToFile(temp_test_file.c_str(), true); results = test_cg.loadFromFile(temp_test_file.c_str()); ensure("number of changed settings loaded", (results == 1)); ensure("value of changed settings loaded", (test_cg.getU32("TestSetting") == 13)); @@ -129,12 +129,12 @@ namespace tut int results = mCG->loadFromFile(mTestConfigFile.c_str(), true); LLControlVariable* control = mCG->getControl("TestSetting"); LLSD new_value = 13; - control->setValue(new_value, FALSE); + control->setValue(new_value, false); ensure_equals("value of changed setting", mCG->getU32("TestSetting"), 13); LLControlGroup test_cg("foo3"); std::string temp_test_file = (mTestConfigDir + "setting_llsd_persist_temp.xml"); mCleanups.push_back(temp_test_file); - mCG->saveToFile(temp_test_file.c_str(), TRUE); + mCG->saveToFile(temp_test_file.c_str(), true); results = test_cg.loadFromFile(temp_test_file.c_str()); //If we haven't changed any settings, then we shouldn't have any settings to load ensure("number of non-persisted changed settings loaded", (results == 0)); diff --git a/indra/media_plugins/cef/mac_volume_catcher.cpp b/indra/media_plugins/cef/mac_volume_catcher.cpp index 32251c0999..54ebbfe1c7 100644 --- a/indra/media_plugins/cef/mac_volume_catcher.cpp +++ b/indra/media_plugins/cef/mac_volume_catcher.cpp @@ -1,6 +1,6 @@ /** * @file mac_volume_catcher.cpp - * @brief A Mac OS X specific hack to control the volume level of all audio channels opened by a process. + * @brief A macOS specific hack to control the volume level of all audio channels opened by a process. * * @cond * $LicenseInfo:firstyear=2010&license=viewerlgpl$ diff --git a/indra/media_plugins/cef/media_plugin_cef.cpp b/indra/media_plugins/cef/media_plugin_cef.cpp index 1346dd2a52..9c205b558c 100644 --- a/indra/media_plugins/cef/media_plugin_cef.cpp +++ b/indra/media_plugins/cef/media_plugin_cef.cpp @@ -816,7 +816,7 @@ void MediaPluginCEF::receiveMessage(const char* message_string) S32 y = message_in.getValueS32("y"); // only even send left mouse button events to the CEF library - // (partially prompted by crash in OS X CEF when sending right button events) + // (partially prompted by crash in macOS CEF when sending right button events) // we catch the right click in viewer and display our own context menu anyway S32 button = message_in.getValueS32("button"); dullahan::EMouseButton btn = dullahan::MB_MOUSE_BUTTON_LEFT; diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index b1c1c73786..d639840f70 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -20,12 +20,10 @@ include(DBusGlib) endif () include(DragDrop) include(EXPAT) -include(FMODSTUDIO) include(Hunspell) if (USE_AUTOBUILD_3P OR USE_CONAN) include(JPEGEncoderBasic) endif () -include(JsonCpp) include(LLAppearance) include(LLAudio) if (USE_AUTOBUILD_3P OR USE_CONAN) @@ -129,7 +127,6 @@ set(viewer_SOURCE_FILES llblockedlistitem.cpp llblocklist.cpp llbox.cpp - llbreadcrumbview.cpp llbrowsernotification.cpp llbuycurrencyhtml.cpp llcallingcard.cpp @@ -387,7 +384,6 @@ set(viewer_SOURCE_FILES lllandmarkactions.cpp lllandmarklist.cpp lllegacyatmospherics.cpp - lllistbrowser.cpp lllistcontextmenu.cpp lllistview.cpp lllocalbitmaps.cpp @@ -527,6 +523,7 @@ set(viewer_SOURCE_FILES llpathfindingobject.cpp llpathfindingobjectlist.cpp llpathfindingpathtool.cpp + llpbrterrainfeatures.cpp llpersistentnotificationstorage.cpp llphysicsmotion.cpp llphysicsshapebuilderutil.cpp @@ -553,7 +550,6 @@ set(viewer_SOURCE_FILES llregioninfomodel.cpp llregionposition.cpp llremoteparcelrequest.cpp - llsavedsettingsglue.cpp llsaveoutfitcombobtn.cpp llscenemonitor.cpp llsceneview.cpp @@ -650,7 +646,6 @@ set(viewer_SOURCE_FILES llurlhistory.cpp llurllineeditorctrl.cpp llurlwhitelist.cpp - llvectorperfoptions.cpp llversioninfo.cpp llviewchildren.cpp llviewerassetstats.cpp @@ -794,7 +789,6 @@ set(viewer_HEADER_FILES llblockedlistitem.h llblocklist.h llbox.h - llbreadcrumbview.h llbuycurrencyhtml.h llcallingcard.h llcapabilityprovider.h @@ -1053,7 +1047,6 @@ set(viewer_HEADER_FILES lllandmarkactions.h lllandmarklist.h lllightconstants.h - lllistbrowser.h lllistcontextmenu.h lllistview.h lllocalbitmaps.h @@ -1180,6 +1173,7 @@ set(viewer_HEADER_FILES llpathfindingobject.h llpathfindingobjectlist.h llpathfindingpathtool.h + llpbrterrainfeatures.h llpersistentnotificationstorage.h llphysicsmotion.h llphysicsshapebuilderutil.h @@ -1208,7 +1202,6 @@ set(viewer_HEADER_FILES llremoteparcelrequest.h llresourcedata.h llrootview.h - llsavedsettingsglue.h llsaveoutfitcombobtn.h llscenemonitor.h llsceneview.h @@ -1309,7 +1302,6 @@ set(viewer_HEADER_FILES llurlhistory.h llurllineeditorctrl.h llurlwhitelist.h - llvectorperfoptions.h llversioninfo.h llviewchildren.h llviewerassetstats.h @@ -1402,7 +1394,6 @@ set(viewer_HEADER_FILES llworldmapview.h llxmlrpclistener.h llxmlrpctransaction.h - macmain.h noise.h pipeline.h roles_constants.h @@ -1455,7 +1446,6 @@ if (DARWIN) # Add resource files to the project. set(viewer_RESOURCE_FILES secondlife.icns - macview.r Info-SecondLife.plist SecondLife.xib/ # CMake doesn't seem to support Xcode language variants well just yet @@ -1794,13 +1784,6 @@ if (WINDOWS) ) endif (ADDRESS_SIZE EQUAL 64) - if (TARGET ll::fmodstudio) - list(APPEND COPY_INPUT_DEPENDENCIES - ${SHARED_LIB_STAGING_DIR}/fmod.dll - ${SHARED_LIB_STAGING_DIR}/fmodL.dll - ) - endif () - if (TARGET ll::openal) list(APPEND COPY_INPUT_DEPENDENCIES ${SHARED_LIB_STAGING_DIR}/OpenAL32.dll @@ -1817,7 +1800,6 @@ if (WINDOWS) --arch=${ARCH} --artwork=${ARTWORK_DIR} "--bugsplat=${BUGSPLAT_DB}" - "--fmodstudio=${USE_FMODSTUDIO}" "--openal=${USE_OPENAL}" --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=$<CONFIG> @@ -1878,7 +1860,6 @@ if (WINDOWS) --arch=${ARCH} --artwork=${ARTWORK_DIR} "--bugsplat=${BUGSPLAT_DB}" - "--fmodstudio=${USE_FMODSTUDIO}" "--openal=${USE_OPENAL}" --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=$<CONFIG> @@ -2077,7 +2058,6 @@ if (LINUX) --arch=${ARCH} --artwork=${ARTWORK_DIR} "--bugsplat=${BUGSPLAT_DB}" - "--fmodstudio=${USE_FMODSTUDIO}" "--openal=${USE_OPENAL}" --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=${CMAKE_BUILD_TYPE} @@ -2105,7 +2085,6 @@ if (LINUX) --arch=${ARCH} --artwork=${ARTWORK_DIR} "--bugsplat=${BUGSPLAT_DB}" - "--fmodstudio=${USE_FMODSTUDIO}" "--openal=${USE_OPENAL}" --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=${CMAKE_BUILD_TYPE} @@ -2188,7 +2167,6 @@ if (DARWIN) --arch=${ARCH} --artwork=${ARTWORK_DIR} "--bugsplat=${BUGSPLAT_DB}" - "--fmodstudio=${USE_FMODSTUDIO}" "--openal=${USE_OPENAL}" --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=$<CONFIG> @@ -2248,7 +2226,6 @@ if (DARWIN) --arch=${ARCH} --artwork=${ARTWORK_DIR} "--bugsplat=${BUGSPLAT_DB}" - "--fmodstudio=${USE_FMODSTUDIO}" "--openal=${USE_OPENAL}" --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=$<CONFIG> @@ -2286,7 +2263,7 @@ if (PACKAGE AND (RELEASE_CRASH_REPORTING OR NON_RELEASE_CRASH_REPORTING) AND VIE OUTPUT_VARIABLE PARENT_DIRECTORY_CYGWIN OUTPUT_STRIP_TRAILING_WHITESPACE) add_custom_command(OUTPUT "${VIEWER_SYMBOL_FILE}" - # Use of 'tar ...j' here assumes VIEWER_SYMBOL_FILE endswith .tar.xz; + # Use of 'tar ...J' here assumes VIEWER_SYMBOL_FILE endswith .tar.xz; # testing a string suffix is painful enough in CMake language that # we'll continue assuming it until forced to generalize. COMMAND "tar" diff --git a/indra/newview/app_settings/cmd_line.xml b/indra/newview/app_settings/cmd_line.xml index 340334aee8..e16a5c7e76 100644 --- a/indra/newview/app_settings/cmd_line.xml +++ b/indra/newview/app_settings/cmd_line.xml @@ -209,12 +209,6 @@ <string>NoAudio</string> </map> - <key>nofmod</key> - <map> - <key>map-to</key> - <string>UseMediaPluginsForStreamingAudio</string> - </map> - <key>noninteractive</key> <map> <key>desc</key> diff --git a/indra/newview/app_settings/keywords_lsl_default.xml b/indra/newview/app_settings/keywords_lsl_default.xml index 893b017367..f99b86bd39 100644 --- a/indra/newview/app_settings/keywords_lsl_default.xml +++ b/indra/newview/app_settings/keywords_lsl_default.xml @@ -1945,6 +1945,15 @@ <key>tooltip</key> <string/> </map> + <key>INVENTORY_SETTING</key> + <map> + <key>type</key> + <string>integer</string> + <key>value</key> + <integer>56</integer> + <key>tooltip</key> + <string/> + </map> <key>INVENTORY_SOUND</key> <map> <key>type</key> diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml index 482012cdd6..51b5c66384 100644 --- a/indra/newview/app_settings/logcontrol.xml +++ b/indra/newview/app_settings/logcontrol.xml @@ -71,7 +71,7 @@ <string>Inventory</string> <string>SceneLoadTiming</string> <string>Avatar</string> - <string>Voice</string> + <string>Voice</string> --> </array> </map> diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 9fa7a5c3d1..cc4ac25a06 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -5453,17 +5453,6 @@ <key>Value</key> <integer>0</integer> </map> - <key>UseMediaPluginsForStreamingAudio</key> - <map> - <key>Comment</key> - <string>Use media plugins (VLC) for streaming audio.</string> - <key>Persist</key> - <integer>1</integer> - <key>Type</key> - <string>Boolean</string> - <key>Value</key> - <integer>0</integer> - </map> <key>NoHardwareProbe</key> <map> <key>Comment</key> @@ -7138,17 +7127,6 @@ <key>Value</key> <integer>1</integer> </map> - <key>AlwaysRenderFriends</key> - <map> - <key>Comment</key> - <string>Always render friends regardless of max complexity</string> - <key>Persist</key> - <integer>1</integer> - <key>Type</key> - <string>Boolean</string> - <key>Value</key> - <integer>0</integer> - </map> <key>RenderAvatarCloth</key> <map> <key>Comment</key> @@ -7310,7 +7288,7 @@ <key>RenderHiDPI</key> <map> <key>Comment</key> - <string>Enable support for HiDPI displays, like Retina (MacOS X ONLY, requires restart)</string> + <string>Enable support for HiDPI displays, like Retina (macOS ONLY, requires restart)</string> <key>Persist</key> <integer>1</integer> <key>Type</key> @@ -7741,7 +7719,7 @@ <key>RenderMaxVRAMBudget</key> <map> <key>Comment</key> - <string>Maximum amount of texture memory to budget for (in MB), or 0 for autodetect. Requires restart.</string> + <string>Maximum amount of texture memory to budget for (in MB), or 0 for autodetect.</string> <key>Persist</key> <integer>1</integer> <key>Type</key> @@ -8744,6 +8722,17 @@ <key>Value</key> <integer>1</integer> </map> + <key>NameTagDebugAVRezState</key> + <map> + <key>Comment</key> + <string>Show Avatar Rez state in name tag</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> <key>RenderInitError</key> <map> <key>Comment</key> @@ -9275,17 +9264,6 @@ <key>Value</key> <integer>0</integer> </map> - <key>RenderTerrainPBRForce</key> - <map> - <key>Comment</key> - <string>Force-load PBR terrain if enabled</string> - <key>Persist</key> - <integer>0</integer> - <key>Type</key> - <string>Boolean</string> - <key>Value</key> - <integer>0</integer> - </map> <key>RenderTerrainPBRDetail</key> <map> <key>Comment</key> @@ -9330,6 +9308,17 @@ <key>Value</key> <real>8.0</real> </map> + <key>RenderTerrainPBRTransformsEnabled</key> + <map> + <key>Comment</key> + <string>EXPERIMENTAL: Enable PBR Terrain texture transforms.</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> <key>RenderTerrainPBRNormalsEnabled</key> <map> <key>Comment</key> @@ -9440,16 +9429,27 @@ <key>Value</key> <integer>1</integer> </map> - <key>RenderUseImpostors</key> + <key>RenderAvatarFriendsOnly</key> <map> - <key>Comment</key> - <string>OBSOLETE and UNUSED. See RenderAvatarMaxNonImpostors and RenderAvatarMaxComplexity.</string> - <key>Persist</key> - <integer>0</integer> - <key>Type</key> - <string>Boolean</string> - <key>Value</key> - <integer>0</integer> + <key>Comment</key> + <string>When enabled hides all avatars that aren't friends. Does not affect inworld control avatars (animeshes), nor self.</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <real>0</real> + </map> + <key>RenderAvatarComplexityMode</key> + <map> + <key>Comment</key> + <string>0 - complexity limit applies to everyone, 1 - always show friends, 2 - only show friends</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>S32</string> + <key>Value</key> + <real>0</real> </map> <key>RenderAvatarMaxNonImpostors</key> <map> @@ -11399,6 +11399,28 @@ <key>Value</key> <string /> </map> + <key>TextureScaleMinAreaFactor</key> + <map> + <key>Comment</key> + <string>Limits how texture scale affects area calculation.</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>0.04</real> + </map> + <key>TextureScaleMaxAreaFactor</key> + <map> + <key>Comment</key> + <string>Limits how texture scale affects area calculation.</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>25.0</real> + </map> <key>ThreadPoolSizes</key> <map> <key>Comment</key> @@ -12665,7 +12687,7 @@ <key>Persist</key> <integer>1</integer> <key>Type</key> - <string>S32</string> + <string>U32</string> <key>Value</key> <integer>8</integer> </map> @@ -14995,6 +15017,226 @@ <key>Value</key> <string>00000000-0000-0000-0000-000000000000</string> </map> + <key>LocalTerrainTransform1ScaleU</key> + <map> + <key>Comment</key> + <string>KHR texture transform component if LocalTerrainAsset1 is set</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>1.0</real> + </map> + <key>LocalTerrainTransform1ScaleV</key> + <map> + <key>Comment</key> + <string>KHR texture transform component if LocalTerrainAsset1 is set</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>1.0</real> + </map> + <key>LocalTerrainTransform1Rotation</key> + <map> + <key>Comment</key> + <string>KHR texture transform component if LocalTerrainAsset1 is set</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>0.0</real> + </map> + <key>LocalTerrainTransform1OffsetU</key> + <map> + <key>Comment</key> + <string>KHR texture transform component if LocalTerrainAsset1 is set</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>0.0</real> + </map> + <key>LocalTerrainTransform1OffsetV</key> + <map> + <key>Comment</key> + <string>KHR texture transform component if LocalTerrainAsset1 is set</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>0.0</real> + </map> + <key>LocalTerrainTransform2ScaleU</key> + <map> + <key>Comment</key> + <string>KHR texture transform component if LocalTerrainAsset2 is set</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>1.0</real> + </map> + <key>LocalTerrainTransform2ScaleV</key> + <map> + <key>Comment</key> + <string>KHR texture transform component if LocalTerrainAsset2 is set</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>1.0</real> + </map> + <key>LocalTerrainTransform2Rotation</key> + <map> + <key>Comment</key> + <string>KHR texture transform component if LocalTerrainAsset2 is set</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>0.0</real> + </map> + <key>LocalTerrainTransform2OffsetU</key> + <map> + <key>Comment</key> + <string>KHR texture transform component if LocalTerrainAsset2 is set</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>0.0</real> + </map> + <key>LocalTerrainTransform2OffsetV</key> + <map> + <key>Comment</key> + <string>KHR texture transform component if LocalTerrainAsset2 is set</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>0.0</real> + </map> + <key>LocalTerrainTransform3ScaleU</key> + <map> + <key>Comment</key> + <string>KHR texture transform component if LocalTerrainAsset3 is set</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>1.0</real> + </map> + <key>LocalTerrainTransform3ScaleV</key> + <map> + <key>Comment</key> + <string>KHR texture transform component if LocalTerrainAsset3 is set</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>1.0</real> + </map> + <key>LocalTerrainTransform3Rotation</key> + <map> + <key>Comment</key> + <string>KHR texture transform component if LocalTerrainAsset3 is set</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>0.0</real> + </map> + <key>LocalTerrainTransform3OffsetU</key> + <map> + <key>Comment</key> + <string>KHR texture transform component if LocalTerrainAsset3 is set</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>0.0</real> + </map> + <key>LocalTerrainTransform3OffsetV</key> + <map> + <key>Comment</key> + <string>KHR texture transform component if LocalTerrainAsset3 is set</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>0.0</real> + </map> + <key>LocalTerrainTransform4ScaleU</key> + <map> + <key>Comment</key> + <string>KHR texture transform component if LocalTerrainAsset4 is set</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>1.0</real> + </map> + <key>LocalTerrainTransform4ScaleV</key> + <map> + <key>Comment</key> + <string>KHR texture transform component if LocalTerrainAsset4 is set</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>1.0</real> + </map> + <key>LocalTerrainTransform4Rotation</key> + <map> + <key>Comment</key> + <string>KHR texture transform component if LocalTerrainAsset4 is set</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>0.0</real> + </map> + <key>LocalTerrainTransform4OffsetU</key> + <map> + <key>Comment</key> + <string>KHR texture transform component if LocalTerrainAsset4 is set</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>0.0</real> + </map> + <key>LocalTerrainTransform4OffsetV</key> + <map> + <key>Comment</key> + <string>KHR texture transform component if LocalTerrainAsset4 is set</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>0.0</real> + </map> <key>PathfindingRetrieveNeighboringRegion</key> <map> <key>Comment</key> @@ -15879,5 +16121,16 @@ <key>Value</key> <integer>0</integer> </map> + <key>GLTFEnabled</key> + <map> + <key>Comment</key> + <string>Enable GLTF support. Set to true by simulator if the simulator you are connected to supports GLTF Asset upload. WARNING: Manually setting this to true will enable buttons that can drain your L$ balance by implicitly uploading textures without asking.</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/shaders/class1/deferred/aoUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/aoUtil.glsl index 1c394e1de4..1a065daf89 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/aoUtil.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/aoUtil.glsl @@ -23,8 +23,7 @@ * $/LicenseInfo$ */ -uniform sampler2D noiseMap; -uniform sampler2D normalMap; +uniform sampler2D noiseMap; uniform sampler2D depthMap; uniform float ssao_radius; diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl index 438e1d1b33..37dcbbd328 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl @@ -27,8 +27,6 @@ out vec4 frag_color; -uniform sampler2D diffuseMap; - void main() { frag_color = vec4(1,1,1,1); diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl index 8627ab1852..23a3ca4911 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl @@ -1,24 +1,24 @@ -/** +/** * @file blurLightF.glsl * * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2007, 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$ */ @@ -27,7 +27,6 @@ out vec4 frag_color; -uniform sampler2D normalMap; uniform sampler2D lightMap; uniform float dist_factor; @@ -42,16 +41,16 @@ in vec2 vary_fragcoord; vec4 getPosition(vec2 pos_screen); vec4 getNorm(vec2 pos_screen); -void main() +void main() { vec2 tc = vary_fragcoord.xy; vec4 norm = getNorm(tc); vec3 pos = getPosition(tc).xyz; vec4 ccol = texture(lightMap, tc).rgba; - + vec2 dlt = kern_scale * delta / (1.0+norm.xy*norm.xy); dlt /= max(-pos.z*dist_factor, 1.0); - + vec2 defined_weight = kern[0].xy; // special case the first (centre) sample's weight in the blur; we have to sample it anyway so we get it for 'free' vec4 col = defined_weight.xyxx * ccol; @@ -75,15 +74,15 @@ void main() k[1] = (k[0]+k[2])*0.5f; k[3] = (k[2]+k[4])*0.5f; k[5] = (k[4]+k[6])*0.5f; - + for (int i = 1; i < 7; i++) { vec2 samptc = tc + k[i].z*dlt*2.0; samptc /= screen_res; - vec3 samppos = getPosition(samptc).xyz; + vec3 samppos = getPosition(samptc).xyz; float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane - + if (d*d <= pointplanedist_tolerance_pow2) { col += texture(lightMap, samptc)*k[i].xyxx; @@ -95,10 +94,10 @@ void main() { vec2 samptc = tc - k[i].z*dlt*2.0; samptc /= screen_res; - vec3 samppos = getPosition(samptc).xyz; + vec3 samppos = getPosition(samptc).xyz; float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane - + if (d*d <= pointplanedist_tolerance_pow2) { col += texture(lightMap, samptc)*k[i].xyxx; @@ -108,7 +107,7 @@ void main() col /= defined_weight.xyxx; //col.y *= col.y; - + frag_color = max(col, vec4(0)); #ifdef IS_AMD_CARD diff --git a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl index 38fbda316b..5193a46ac2 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl @@ -50,7 +50,6 @@ SOFTWARE. uniform sampler2D normalMap; uniform sampler2D depthMap; -uniform sampler2D emissiveRect; uniform sampler2D projectionMap; // rgba uniform sampler2D brdfLut; @@ -487,6 +486,43 @@ vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor, return clamp(color, vec3(0), vec3(10)); } +vec3 pbrCalcPointLightOrSpotLight(vec3 diffuseColor, vec3 specularColor, + float perceptualRoughness, + float metallic, + vec3 n, // normal + vec3 p, // pixel position + vec3 v, // view vector (negative normalized pixel position) + vec3 lp, // light position + vec3 ld, // light direction (for spotlights) + vec3 lightColor, + float lightSize, float falloff, float is_pointlight, float ambiance) +{ + vec3 color = vec3(0,0,0); + + vec3 lv = lp.xyz - p; + + float lightDist = length(lv); + + float dist = lightDist / lightSize; + if (dist <= 1.0) + { + lv /= lightDist; + + float dist_atten = calcLegacyDistanceAttenuation(dist, falloff); + + // spotlight coefficient. + float spot = max(dot(-ld, lv), is_pointlight); + // spot*spot => GL_SPOT_EXPONENT=2 + float spot_atten = spot*spot; + + vec3 intensity = spot_atten * dist_atten * lightColor * 3.0; //magic number to balance with legacy materials + + color = intensity*pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, lv); + } + + return color; +} + void calcDiffuseSpecular(vec3 baseColor, float metallic, inout vec3 diffuseColor, inout vec3 specularColor) { vec3 f0 = vec3(0.04); diff --git a/indra/newview/app_settings/shaders/class1/deferred/exposureF.glsl b/indra/newview/app_settings/shaders/class1/deferred/exposureF.glsl index eff7221ae7..67890032df 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/exposureF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/exposureF.glsl @@ -1,28 +1,28 @@ -/** +/** * @file exposureF.glsl * * $LicenseInfo:firstyear=2023&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2023, 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$ */ - + /*[EXTRA_CODE_HERE]*/ out vec4 frag_color; @@ -43,7 +43,7 @@ float lum(vec3 col) return dot(l, col); } -void main() +void main() { vec2 tc = vec2(0.5,0.5); @@ -53,13 +53,13 @@ void main() L /= max_L; L = pow(L, 2.0); float s = mix(dynamic_exposure_params.z, dynamic_exposure_params.y, L); - + #ifdef USE_LAST_EXPOSURE float prev = texture(exposureMap, vec2(0.5,0.5)).r; s = mix(prev, s, min(dt*2.0*abs(prev-s), 0.04)); #endif - + frag_color = max(vec4(s, s, s, dt), vec4(0.0)); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl index 52dfed06ae..2b9cc6ae5a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl @@ -1,28 +1,28 @@ -/** +/** * @file deferred/fullbrightF.glsl * * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2007, 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$ */ - + /*[EXTRA_CODE_HERE]*/ out vec4 frag_color; @@ -52,7 +52,7 @@ vec4 applySkyAndWaterFog(vec3 pos, vec3 additive, vec3 atten, vec4 color); void mirrorClip(vec3 pos); -void main() +void main() { mirrorClip(vary_position); #ifdef IS_ALPHA @@ -90,7 +90,7 @@ void main() calcAtmosphericVars(pos.xyz, vec3(0), 1.0, sunlit, amblit, additive, atten); color.rgb = applySkyAndWaterFog(pos, additive, atten, color).rgb; - + #endif #endif diff --git a/indra/newview/app_settings/shaders/class1/deferred/globalF.glsl b/indra/newview/app_settings/shaders/class1/deferred/globalF.glsl index e407dad21c..d493976eba 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/globalF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/globalF.glsl @@ -1,24 +1,24 @@ -/** +/** * @file class1/deferred/globalF.glsl * * $LicenseInfo:firstyear=2024&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2024, 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$ */ diff --git a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl b/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl index 95b2f80e06..3432bf07ef 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl @@ -1,32 +1,32 @@ -/** +/** * @file luminanceF.glsl * * $LicenseInfo:firstyear=2023&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2023, 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$ */ - + /*[EXTRA_CODE_HERE]*/ -// take a luminance sample of diffuseRect and emissiveRect +// take a luminance sample of diffuseRect and emissiveRect out vec4 frag_color; @@ -43,12 +43,12 @@ float lum(vec3 col) return dot(l, col); } -void main() +void main() { vec2 tc = vary_fragcoord*0.6+0.2; tc.y -= 0.1; // HACK - nudge exposure sample down a little bit to favor ground over sky vec3 c = texture(diffuseRect, tc).rgb; - + vec4 norm = texture(normalMap, tc); if (!GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_HDRI) && diff --git a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl index 6ef556d7e8..585de99e1d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl @@ -1,28 +1,28 @@ -/** +/** * @file class1\deferred\moonF.glsl * * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2005, 2020 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$ */ - + /*[EXTRA_CODE_HERE]*/ out vec4 frag_data[4]; @@ -34,7 +34,7 @@ uniform sampler2D diffuseMap; in vec2 vary_texcoord0; -void main() +void main() { // Restore Pre-EEP alpha fade moon near horizon float fade = 1.0; diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaMaskF.glsl index 35b7602569..07a2218db2 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaMaskF.glsl @@ -1,24 +1,24 @@ -/** +/** * @file pbrShadowAlphaMaskF.glsl * * $LicenseInfo:firstyear=2023&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2023, 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$ */ @@ -33,7 +33,7 @@ in vec4 vertex_color; in vec2 vary_texcoord0; uniform float minimum_alpha; -void main() +void main() { float alpha = texture(diffuseMap,vary_texcoord0.xy).a * vertex_color.a; diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbralphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbralphaV.glsl index d0fc362db9..ae179d3f37 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbralphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbralphaV.glsl @@ -51,8 +51,6 @@ uniform vec4[2] texture_emissive_transform; out vec3 vary_fragcoord; -uniform float near_clip; - in vec3 position; in vec4 diffuse_color; in vec3 normal; @@ -88,7 +86,7 @@ void main() #endif gl_Position = vert; - vary_fragcoord.xyz = vert.xyz + vec3(0,0,near_clip); + vary_fragcoord.xyz = vert.xyz; base_color_texcoord = texture_transform(texcoord0, texture_base_color_transform, texture_matrix0); normal_texcoord = texture_transform(texcoord0, texture_normal_transform, texture_matrix0); diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl index 380d493636..b521081af9 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl @@ -1,24 +1,24 @@ -/** +/** * @file pbropaqueF.glsl * * $LicenseInfo:firstyear=2022&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2022, 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$ */ @@ -28,7 +28,7 @@ #ifndef IS_HUD -// deferred opaque implementation +// deferred opaque implementation uniform sampler2D diffuseMap; //always in sRGB space @@ -85,7 +85,7 @@ void main() float sign = vary_sign; vec3 vN = vary_normal; vec3 vT = vary_tangent.xyz; - + vec3 vB = sign * cross(vN, vT); vec3 tnorm = normalize( vNt.x * vT + vNt.y * vB + vNt.z * vN ); @@ -95,7 +95,7 @@ void main() // roughness 0.0 // metal 0.0 vec3 spec = texture(specularMap, metallic_roughness_texcoord.xy).rgb; - + spec.g *= roughnessFactor; spec.b *= metallicFactor; diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl index 0de2d348c3..2cb7ff196b 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl @@ -1,24 +1,24 @@ -/** +/** * @file class1\deferred\terrainF.glsl * * $LicenseInfo:firstyear=2023&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2023, 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$ */ @@ -31,7 +31,7 @@ #define TERRAIN_PBR_DETAIL_METALLIC_ROUGHNESS -3 #if TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 3 -#define TerrainCoord vec4[2] +#define TerrainCoord vec4[3] #elif TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 1 #define TerrainCoord vec2 #endif @@ -131,12 +131,16 @@ uniform vec3[4] emissiveColors; uniform vec4 minimum_alphas; // PBR alphaMode: MASK, See: mAlphaCutoff, setAlphaCutoff() #if TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 3 +in vec4[10] vary_coords; +#elif TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 1 in vec4[2] vary_coords; #endif in vec3 vary_position; in vec3 vary_normal; -in vec3 vary_tangent; +#if (TERRAIN_PBR_DETAIL >= TERRAIN_PBR_DETAIL_NORMAL) +in vec3 vary_tangents[4]; flat in float vary_sign; +#endif in vec4 vary_texcoord0; in vec4 vary_texcoord1; @@ -144,17 +148,26 @@ void mirrorClip(vec3 position); float terrain_mix(TerrainMix tm, vec4 tms4); +#if (TERRAIN_PBR_DETAIL >= TERRAIN_PBR_DETAIL_NORMAL) +// from mikktspace.com +vec3 mikktspace(vec3 vNt, vec3 vT) +{ + vec3 vN = vary_normal; + + vec3 vB = vary_sign * cross(vN, vT); + vec3 tnorm = normalize( vNt.x * vT + vNt.y * vB + vNt.z * vN ); + + tnorm *= gl_FrontFacing ? 1.0 : -1.0; + + return tnorm; +} +#endif + void main() { // Make sure we clip the terrain if we're in a mirror. mirrorClip(vary_position); -#if TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 3 - TerrainCoord terrain_texcoord = vary_coords; -#elif TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 1 - TerrainCoord terrain_texcoord = vary_texcoord0.xy; -#endif - float alpha1 = texture(alpha_ramp, vary_texcoord0.zw).a; float alpha2 = texture(alpha_ramp,vary_texcoord1.xy).a; float alphaFinal = texture(alpha_ramp, vary_texcoord1.zw).a; @@ -182,9 +195,19 @@ void main() PBRMix pbr_mix = init_pbr_mix(); PBRMix mix2; + TerrainCoord terrain_texcoord; switch (tm.type & MIX_X) { case MIX_X: +#if TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 3 + terrain_texcoord[0].xy = vary_coords[0].xy; + terrain_texcoord[0].zw = vary_coords[0].zw; + terrain_texcoord[1].xy = vary_coords[1].xy; + terrain_texcoord[1].zw = vary_coords[1].zw; + terrain_texcoord[2].xy = vary_coords[2].xy; +#elif TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 1 + terrain_texcoord = vary_coords[0].xy; +#endif mix2 = terrain_sample_and_multiply_pbr( terrain_texcoord , detail_0_base_color @@ -207,6 +230,9 @@ void main() , emissiveColors[0] #endif ); +#if (TERRAIN_PBR_DETAIL >= TERRAIN_PBR_DETAIL_NORMAL) + mix2.vNt = mikktspace(mix2.vNt, vary_tangents[0]); +#endif pbr_mix = mix_pbr(pbr_mix, mix2, tm.weight.x); break; default: @@ -215,6 +241,15 @@ void main() switch (tm.type & MIX_Y) { case MIX_Y: +#if TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 3 + terrain_texcoord[0].xy = vary_coords[2].zw; + terrain_texcoord[0].zw = vary_coords[3].xy; + terrain_texcoord[1].xy = vary_coords[3].zw; + terrain_texcoord[1].zw = vary_coords[4].xy; + terrain_texcoord[2].xy = vary_coords[4].zw; +#elif TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 1 + terrain_texcoord = vary_coords[0].zw; +#endif mix2 = terrain_sample_and_multiply_pbr( terrain_texcoord , detail_1_base_color @@ -237,6 +272,9 @@ void main() , emissiveColors[1] #endif ); +#if (TERRAIN_PBR_DETAIL >= TERRAIN_PBR_DETAIL_NORMAL) + mix2.vNt = mikktspace(mix2.vNt, vary_tangents[1]); +#endif pbr_mix = mix_pbr(pbr_mix, mix2, tm.weight.y); break; default: @@ -245,6 +283,15 @@ void main() switch (tm.type & MIX_Z) { case MIX_Z: +#if TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 3 + terrain_texcoord[0].xy = vary_coords[5].xy; + terrain_texcoord[0].zw = vary_coords[5].zw; + terrain_texcoord[1].xy = vary_coords[6].xy; + terrain_texcoord[1].zw = vary_coords[6].zw; + terrain_texcoord[2].xy = vary_coords[7].xy; +#elif TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 1 + terrain_texcoord = vary_coords[1].xy; +#endif mix2 = terrain_sample_and_multiply_pbr( terrain_texcoord , detail_2_base_color @@ -267,6 +314,9 @@ void main() , emissiveColors[2] #endif ); +#if (TERRAIN_PBR_DETAIL >= TERRAIN_PBR_DETAIL_NORMAL) + mix2.vNt = mikktspace(mix2.vNt, vary_tangents[2]); +#endif pbr_mix = mix_pbr(pbr_mix, mix2, tm.weight.z); break; default: @@ -275,6 +325,15 @@ void main() switch (tm.type & MIX_W) { case MIX_W: +#if TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 3 + terrain_texcoord[0].xy = vary_coords[7].zw; + terrain_texcoord[0].zw = vary_coords[8].xy; + terrain_texcoord[1].xy = vary_coords[8].zw; + terrain_texcoord[1].zw = vary_coords[9].xy; + terrain_texcoord[2].xy = vary_coords[9].zw; +#elif TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 1 + terrain_texcoord = vary_coords[1].zw; +#endif mix2 = terrain_sample_and_multiply_pbr( terrain_texcoord , detail_3_base_color @@ -297,6 +356,9 @@ void main() , emissiveColors[3] #endif ); +#if (TERRAIN_PBR_DETAIL >= TERRAIN_PBR_DETAIL_NORMAL) + mix2.vNt = mikktspace(mix2.vNt, vary_tangents[3]); +#endif pbr_mix = mix_pbr(pbr_mix, mix2, tm.weight.w); break; default: @@ -311,20 +373,12 @@ void main() float base_color_factor_alpha = terrain_mix(tm, vec4(baseColorFactors[0].z, baseColorFactors[1].z, baseColorFactors[2].z, baseColorFactors[3].z)); #if (TERRAIN_PBR_DETAIL >= TERRAIN_PBR_DETAIL_NORMAL) - // from mikktspace.com - vec3 vNt = pbr_mix.vNt; - vec3 vN = vary_normal; - vec3 vT = vary_tangent.xyz; - - vec3 vB = vary_sign * cross(vN, vT); - vec3 tnorm = normalize( vNt.x * vT + vNt.y * vB + vNt.z * vN ); - - tnorm *= gl_FrontFacing ? 1.0 : -1.0; + vec3 tnorm = normalize(pbr_mix.vNt); #else vec3 tnorm = vary_normal; - tnorm *= gl_FrontFacing ? 1.0 : -1.0; #endif - + tnorm *= gl_FrontFacing ? 1.0 : -1.0; + #if (TERRAIN_PBR_DETAIL >= TERRAIN_PBR_DETAIL_EMISSIVE) #define mix_emissive pbr_mix.emissive diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbrterrainUtilF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbrterrainUtilF.glsl index 04eb135c90..d1a380bf94 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbrterrainUtilF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbrterrainUtilF.glsl @@ -1,24 +1,24 @@ -/** +/** * @file class1\deferred\pbrterrainUtilF.glsl * * $LicenseInfo:firstyear=2023&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2023, 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$ */ @@ -233,17 +233,12 @@ float terrain_mix(TerrainMix tm, vec4 tms4) // Triplanar mapping // Pre-transformed texture coordinates for each axial uv slice (Packing: xy, yz, (-x)z, unused) -#define TerrainCoord vec4[2] +#define TerrainCoord vec4[3] -vec2 _t_uv(vec2 uv_unflipped, float sign_or_zero) +// If sign_or_zero is positive, use uv_unflippped, otherwise use uv_flipped +vec2 _t_uv(vec2 uv_unflipped, vec2 uv_flipped, float sign_or_zero) { - // Handle case where sign is 0 - float sign = (2.0*sign_or_zero) + 1.0; - sign /= abs(sign); - // If the vertex normal is negative, flip the texture back - // right-side up. - vec2 uv = uv_unflipped * vec2(sign, 1); - return uv; + return mix(uv_flipped, uv_unflipped, max(0.0, sign_or_zero)); } vec3 _t_normal_post_1(vec3 vNt0, float sign_or_zero) @@ -298,9 +293,9 @@ PBRMix terrain_sample_pbr( { PBRMix mix = init_pbr_mix(); -#define get_uv_x() _t_uv(terrain_coord[0].zw, sign(vary_vertex_normal.x)) -#define get_uv_y() _t_uv(terrain_coord[1].xy, sign(vary_vertex_normal.y)) -#define get_uv_z() _t_uv(terrain_coord[0].xy, sign(vary_vertex_normal.z)) +#define get_uv_x() _t_uv(terrain_coord[0].zw, terrain_coord[1].zw, sign(vary_vertex_normal.x)) +#define get_uv_y() _t_uv(terrain_coord[1].xy, terrain_coord[2].xy, sign(vary_vertex_normal.y)) +#define get_uv_z() _t_uv(terrain_coord[0].xy, vec2(0), sign(vary_vertex_normal.z)) switch (tw.type & SAMPLE_X) { case SAMPLE_X: @@ -379,7 +374,7 @@ PBRMix terrain_sample_pbr( default: break; } - + return mix; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbrterrainV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbrterrainV.glsl index ed52297314..f8e826bbdb 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbrterrainV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbrterrainV.glsl @@ -23,6 +23,11 @@ * $/LicenseInfo$ */ +#define TERRAIN_PBR_DETAIL_EMISSIVE 0 +#define TERRAIN_PBR_DETAIL_OCCLUSION -1 +#define TERRAIN_PBR_DETAIL_NORMAL -2 +#define TERRAIN_PBR_DETAIL_METALLIC_ROUGHNESS -3 + uniform mat3 normal_matrix; uniform mat4 texture_matrix0; uniform mat4 modelview_matrix; @@ -34,21 +39,25 @@ in vec4 tangent; in vec4 diffuse_color; in vec2 texcoord1; -#if TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 3 -out vec4[2] vary_coords; -#endif out vec3 vary_vertex_normal; // Used by pbrterrainUtilF.glsl out vec3 vary_normal; -out vec3 vary_tangent; +#if (TERRAIN_PBR_DETAIL >= TERRAIN_PBR_DETAIL_NORMAL) +out vec3 vary_tangents[4]; flat out float vary_sign; +#endif out vec4 vary_texcoord0; out vec4 vary_texcoord1; +#if TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 3 +out vec4[10] vary_coords; +#elif TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 1 +out vec4[2] vary_coords; +#endif out vec3 vary_position; -// *HACK: tangent_space_transform should use texture_normal_transform, or maybe -// we shouldn't use tangent_space_transform at all. See the call to -// tangent_space_transform below. -uniform vec4[2] texture_base_color_transform; +// *HACK: Each material uses only one texture transform, but the KHR texture +// transform spec allows handling texture transforms separately for each +// individual texture info. +uniform vec4[5] terrain_texture_transforms; vec2 terrain_texture_transform(vec2 vertex_texcoord, vec4[2] khr_gltf_transform); vec3 terrain_tangent_space_transform(vec4 vertex_tangent, vec3 vertex_normal, vec4[2] khr_gltf_transform); @@ -63,31 +72,101 @@ void main() vary_vertex_normal = normal; vec3 t = normal_matrix * tangent.xyz; - vary_tangent = normalize(t); - // *TODO: Decide if we want this. It may be better to just calculate the - // tangents on-the-fly in the fragment shader, due to the subtleties of the - // effect of triplanar mapping on UVs. - // *HACK: Should be using texture_normal_transform here. The KHR texture - // transform spec requires handling texture transforms separately for each - // individual texture. - vary_tangent = normalize(terrain_tangent_space_transform(vec4(t, tangent.w), n, texture_base_color_transform)); +#if (TERRAIN_PBR_DETAIL >= TERRAIN_PBR_DETAIL_NORMAL) + { + vec4[2] ttt; + // material 1 + ttt[0].xyz = terrain_texture_transforms[0].xyz; + ttt[1].x = terrain_texture_transforms[0].w; + ttt[1].y = terrain_texture_transforms[1].x; + vary_tangents[0] = normalize(terrain_tangent_space_transform(vec4(t, tangent.w), n, ttt)); + // material 2 + ttt[0].xyz = terrain_texture_transforms[1].yzw; + ttt[1].xy = terrain_texture_transforms[2].xy; + vary_tangents[1] = normalize(terrain_tangent_space_transform(vec4(t, tangent.w), n, ttt)); + // material 3 + ttt[0].xy = terrain_texture_transforms[2].zw; + ttt[0].z = terrain_texture_transforms[3].x; + ttt[1].xy = terrain_texture_transforms[3].yz; + vary_tangents[2] = normalize(terrain_tangent_space_transform(vec4(t, tangent.w), n, ttt)); + // material 4 + ttt[0].x = terrain_texture_transforms[3].w; + ttt[0].yz = terrain_texture_transforms[4].xy; + ttt[1].xy = terrain_texture_transforms[4].zw; + vary_tangents[3] = normalize(terrain_tangent_space_transform(vec4(t, tangent.w), n, ttt)); + } + vary_sign = tangent.w; +#endif vary_normal = normalize(n); // Transform and pass tex coords - // *HACK: texture_base_color_transform is used for all of these here, but - // the KHR texture transform spec requires handling texture transforms - // separately for each individual texture. + { + vec4[2] ttt; #if TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 3 - // xy - vary_coords[0].xy = terrain_texture_transform(position.xy, texture_base_color_transform); - // yz - vary_coords[0].zw = terrain_texture_transform(position.yz, texture_base_color_transform); - // (-x)z - vary_coords[1].xy = terrain_texture_transform(position.xz * vec2(-1, 1), texture_base_color_transform); +// Don't care about upside-down (transform_xy_flipped()) +#define transform_xy() terrain_texture_transform(position.xy, ttt) +#define transform_yz() terrain_texture_transform(position.yz, ttt) +#define transform_negx_z() terrain_texture_transform(position.xz * vec2(-1, 1), ttt) +#define transform_yz_flipped() terrain_texture_transform(position.yz * vec2(-1, 1), ttt) +#define transform_negx_z_flipped() terrain_texture_transform(position.xz, ttt) + // material 1 + ttt[0].xyz = terrain_texture_transforms[0].xyz; + ttt[1].x = terrain_texture_transforms[0].w; + ttt[1].y = terrain_texture_transforms[1].x; + vary_coords[0].xy = transform_xy(); + vary_coords[0].zw = transform_yz(); + vary_coords[1].xy = transform_negx_z(); + vary_coords[1].zw = transform_yz_flipped(); + vary_coords[2].xy = transform_negx_z_flipped(); + // material 2 + ttt[0].xyz = terrain_texture_transforms[1].yzw; + ttt[1].xy = terrain_texture_transforms[2].xy; + vary_coords[2].zw = transform_xy(); + vary_coords[3].xy = transform_yz(); + vary_coords[3].zw = transform_negx_z(); + vary_coords[4].xy = transform_yz_flipped(); + vary_coords[4].zw = transform_negx_z_flipped(); + // material 3 + ttt[0].xy = terrain_texture_transforms[2].zw; + ttt[0].z = terrain_texture_transforms[3].x; + ttt[1].xy = terrain_texture_transforms[3].yz; + vary_coords[5].xy = transform_xy(); + vary_coords[5].zw = transform_yz(); + vary_coords[6].xy = transform_negx_z(); + vary_coords[6].zw = transform_yz_flipped(); + vary_coords[7].xy = transform_negx_z_flipped(); + // material 4 + ttt[0].x = terrain_texture_transforms[3].w; + ttt[0].yz = terrain_texture_transforms[4].xy; + ttt[1].xy = terrain_texture_transforms[4].zw; + vary_coords[7].zw = transform_xy(); + vary_coords[8].xy = transform_yz(); + vary_coords[8].zw = transform_negx_z(); + vary_coords[9].xy = transform_yz_flipped(); + vary_coords[9].zw = transform_negx_z_flipped(); #elif TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 1 - vary_texcoord0.xy = terrain_texture_transform(position.xy, texture_base_color_transform); + // material 1 + ttt[0].xyz = terrain_texture_transforms[0].xyz; + ttt[1].x = terrain_texture_transforms[0].w; + ttt[1].y = terrain_texture_transforms[1].x; + vary_coords[0].xy = terrain_texture_transform(position.xy, ttt); + // material 2 + ttt[0].xyz = terrain_texture_transforms[1].yzw; + ttt[1].xy = terrain_texture_transforms[2].xy; + vary_coords[0].zw = terrain_texture_transform(position.xy, ttt); + // material 3 + ttt[0].xy = terrain_texture_transforms[2].zw; + ttt[0].z = terrain_texture_transforms[3].x; + ttt[1].xy = terrain_texture_transforms[3].yz; + vary_coords[1].xy = terrain_texture_transform(position.xy, ttt); + // material 4 + ttt[0].x = terrain_texture_transforms[3].w; + ttt[0].yz = terrain_texture_transforms[4].xy; + ttt[1].xy = terrain_texture_transforms[4].zw; + vary_coords[1].zw = terrain_texture_transform(position.xy, ttt); #endif + } vec4 tc = vec4(texcoord1,0,1); vary_texcoord0.zw = tc.xy; diff --git a/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl index a33c4cc58b..6791fe44d9 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl @@ -27,11 +27,11 @@ float random (vec2 uv) { - return 0.; + return 0.f; } float tapScreenSpaceReflection(int totalSamples, vec2 tc, vec3 viewPos, vec3 n, inout vec4 collectedColor, sampler2D source, float glossiness) { collectedColor = vec4(0); - return 0.; + return 0.f; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl index 9db8f461dd..f208ac746b 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl @@ -27,8 +27,6 @@ out vec4 frag_color; -uniform sampler2D diffuseMap; - in vec4 post_pos; in float target_pos_x; in vec4 vertex_color; diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl index 16cc7cfbbc..6f7bd2bf3c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl @@ -24,7 +24,6 @@ */ uniform sampler2D normalMap; -uniform sampler2D depthMap; #if defined(SUN_SHADOW) uniform sampler2DShadow shadowMap0; diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl index 785c748234..41e42b5173 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl @@ -1,24 +1,24 @@ -/** +/** * @file class1/deferred/skyF.glsl * * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2005, 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$ */ @@ -99,9 +99,9 @@ void main() else #endif { - // Potential Fill-rate optimization. Add cloud calculation - // back in and output alpha of 0 (so that alpha culling kills - // the fragment) if the sky wouldn't show up because the clouds + // Potential Fill-rate optimization. Add cloud calculation + // back in and output alpha of 0 (so that alpha culling kills + // the fragment) if the sky wouldn't show up because the clouds // are fully opaque. color = vary_HazeColor; diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl index 24d2db2183..ea00d240df 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl @@ -102,7 +102,7 @@ void main() // Initialize temp variables vec3 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color * 0.7; //magic 0.7 to match legacy color - + // Sunlight attenuation effect (hue and brightness) due to atmosphere // this is used later for sunlight modulation at various altitudes vec3 light_atten = (blue_density + vec3(haze_density * 0.25)) * (density_multiplier * max_y); @@ -152,7 +152,7 @@ void main() sunlight *= max(0.0, (1. - cloud_shadow)); // Haze color below cloud - vec3 add_below_cloud = (blue_horizon * blue_weight * (sunlight + ambient) + vec3 add_below_cloud = (blue_horizon * blue_weight * (sunlight + ambient) + (haze_horizon * haze_weight) * (sunlight * haze_glow + ambient)); // Attenuate cloud color by atmosphere diff --git a/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl b/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl index 5f598f84a7..1fd31e0546 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl @@ -1,28 +1,28 @@ -/** +/** * @file class1\deferred\terrainF.glsl * * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2007, 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$ */ - + /*[EXTRA_CODE_HERE]*/ out vec4 frag_data[4]; @@ -44,7 +44,7 @@ void main() { mirrorClip(pos); /// Note: This should duplicate the blending functionality currently used for the terrain rendering. - + vec4 color0 = texture(detail_0, vary_texcoord0.xy); vec4 color1 = texture(detail_1, vary_texcoord0.xy); vec4 color2 = texture(detail_2, vary_texcoord0.xy); @@ -54,10 +54,10 @@ void main() float alpha2 = texture(alpha_ramp,vary_texcoord1.xy).a; float alphaFinal = texture(alpha_ramp, vary_texcoord1.zw).a; vec4 outColor = mix( mix(color3, color2, alpha2), mix(color1, color0, alpha1), alphaFinal ); - - outColor.a = 0.0; // yes, downstream atmospherics - - frag_data[0] = outColor; + + outColor.a = 0.0; // yes, downstream atmospherics + + frag_data[0] = max(outColor, vec4(0)); frag_data[1] = vec4(0.0,0.0,0.0,-1.0); vec3 nvn = normalize(vary_normal); frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS); diff --git a/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl b/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl index b4ab7cd169..7fc0e98513 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl @@ -1,24 +1,24 @@ -/** +/** * @file class1\environment\terrainV.glsl * * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2007, 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$ */ @@ -44,15 +44,15 @@ uniform vec4 object_plane_t; vec2 texgen_object(vec4 vpos, mat4 mat, vec4 tp0, vec4 tp1) { vec4 tcoord; - + tcoord.x = dot(vpos, tp0); tcoord.y = dot(vpos, tp1); tcoord.z = 0; tcoord.w = 1; - tcoord = mat * tcoord; - - return tcoord.xy; + tcoord = mat * tcoord; + + return tcoord.xy; } void main() @@ -65,12 +65,12 @@ void main() pos = (modelview_matrix*pre_pos).xyz; vary_normal = normalize(normal_matrix * normal); - + // Transform and pass tex coords vary_texcoord0.xy = texgen_object(vec4(position, 1.0), texture_matrix0, object_plane_s, object_plane_t); - + vec4 t = vec4(texcoord1,0,1); - + vary_texcoord0.zw = t.xy; vary_texcoord1.xy = t.xy-vec2(2.0, 0.0); vary_texcoord1.zw = t.xy-vec2(1.0, 0.0); diff --git a/indra/newview/app_settings/shaders/class1/deferred/textureUtilV.glsl b/indra/newview/app_settings/shaders/class1/deferred/textureUtilV.glsl index 7c02cb9d4a..767416d564 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/textureUtilV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/textureUtilV.glsl @@ -1,24 +1,24 @@ -/** +/** * @file class1/deferred/textureUtilV.glsl * * $LicenseInfo:firstyear=2023&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2023, 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$ */ @@ -48,6 +48,7 @@ vec2 khr_texture_transform(vec2 texcoord, vec2 scale, float rotation, vec2 offse return (transform * vec3(texcoord, 1)).xy; } +// A texture transform function for PBR materials applied to shape prims/Collada model prims // vertex_texcoord - The UV texture coordinates sampled from the vertex at // runtime. Per SL convention, this is in a right-handed UV coordinate // system. Collada models also have right-handed UVs. @@ -134,7 +135,7 @@ vec3 tangent_space_transform(vec4 vertex_tangent, vec3 vertex_normal, vec4[2] kh return (weights.x * vertex_binormal.xyz) + (weights.y * vertex_tangent.xyz); } -// Similar to tangent_space_transform but no no texture animation support. +// Similar to tangent_space_transform but no texture animation support. vec3 terrain_tangent_space_transform(vec4 vertex_tangent, vec3 vertex_normal, vec4[2] khr_gltf_transform) { // Immediately convert to left-handed coordinate system ((0,1) -> (0, -1)) diff --git a/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl b/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl index 7e1d906878..d7f6d20547 100644 --- a/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl @@ -23,8 +23,6 @@ * $/LicenseInfo$ */ - uniform sampler2D exposureMap; - vec3 srgb_to_linear(vec3 cs) { vec3 low_range = cs / vec3(12.92); diff --git a/indra/newview/app_settings/shaders/class1/gltf/pbrmetallicroughnessF.glsl b/indra/newview/app_settings/shaders/class1/gltf/pbrmetallicroughnessF.glsl new file mode 100644 index 0000000000..ac4ff50552 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/gltf/pbrmetallicroughnessF.glsl @@ -0,0 +1,325 @@ +/** + * @file pbrmetallicroughnessF.glsl + * + * $LicenseInfo:firstyear=2024&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2022, 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$ + */ + +/*[EXTRA_CODE_HERE]*/ + + +// GLTF pbrMetallicRoughness implementation + +uniform int gltf_material_id; + +vec3 emissiveColor = vec3(0,0,0); +float metallicFactor = 1.0; +float roughnessFactor = 1.0; +float minimum_alpha = -1.0; + +layout (std140) uniform GLTFMaterials +{ + // see pbrmetallicroughnessV.glsl for packing + vec4 gltf_material_data[MAX_UBO_VEC4S]; +}; + +void unpackMaterial() +{ + if (gltf_material_id > -1) + { + int idx = gltf_material_id*12; + emissiveColor = gltf_material_data[idx+10].rgb; + roughnessFactor = gltf_material_data[idx+11].g; + metallicFactor = gltf_material_data[idx+11].b; + minimum_alpha -= gltf_material_data[idx+11].a; + } +} + +// ================================== +// needed by all variants +// ================================== +uniform sampler2D diffuseMap; //always in sRGB space +uniform sampler2D emissiveMap; +in vec3 vary_position; +in vec4 vertex_color; +in vec2 base_color_uv; +in vec2 emissive_uv; + +void mirrorClip(vec3 pos); +vec3 linear_to_srgb(vec3 c); +vec3 srgb_to_linear(vec3 c); +// ================================== + + +// ================================== +// needed by all lit variants +// ================================== +#ifndef UNLIT +uniform sampler2D normalMap; +uniform sampler2D metallicRoughnessMap; +uniform sampler2D occlusionMap; +in vec3 vary_normal; +in vec3 vary_tangent; +flat in float vary_sign; +in vec2 normal_uv; +in vec2 metallic_roughness_uv; +in vec2 occlusion_uv; +#endif +// ================================== + + +// ================================== +// needed by all alpha variants +// ================================== +#ifdef ALPHA_BLEND +in vec3 vary_fragcoord; +uniform vec4 clipPlane; +uniform float clipSign; +void waterClip(vec3 pos); +void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, out vec3 sunlit, out vec3 amblit, out vec3 atten, out vec3 additive); +vec4 applySkyAndWaterFog(vec3 pos, vec3 additive, vec3 atten, vec4 color); +#endif +// ================================== + + +// ================================== +// needed by lit alpha +// ================================== +#if defined(ALPHA_BLEND) && !defined(UNLIT) + +#ifdef HAS_SUN_SHADOW +uniform sampler2D lightMap; +uniform vec2 screen_res; +#endif + +// Lights +// See: LLRender::syncLightState() +uniform vec4 light_position[8]; +uniform vec3 light_direction[8]; // spot direction +uniform vec4 light_attenuation[8]; // linear, quadratic, is omni, unused, See: LLPipeline::setupHWLights() and syncLightState() +uniform vec3 light_diffuse[8]; +uniform vec2 light_deferred_attenuation[8]; // light size and falloff + +uniform int sun_up_factor; +uniform vec3 sun_dir; +uniform vec3 moon_dir; + +void calcHalfVectors(vec3 lv, vec3 n, vec3 v, out vec3 h, out vec3 l, out float nh, out float nl, out float nv, out float vh, out float lightDist); +float calcLegacyDistanceAttenuation(float distance, float falloff); +float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen); +void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv, + vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent, vec3 amblit_linear); + +void calcDiffuseSpecular(vec3 baseColor, float metallic, inout vec3 diffuseColor, inout vec3 specularColor); + +vec3 pbrBaseLight(vec3 diffuseColor, + vec3 specularColor, + float metallic, + vec3 pos, + vec3 norm, + float perceptualRoughness, + vec3 light_dir, + vec3 sunlit, + float scol, + vec3 radiance, + vec3 irradiance, + vec3 colorEmissive, + float ao, + vec3 additive, + vec3 atten); + +vec3 pbrCalcPointLightOrSpotLight(vec3 diffuseColor, vec3 specularColor, + float perceptualRoughness, + float metallic, + vec3 n, // normal + vec3 p, // pixel position + vec3 v, // view vector (negative normalized pixel position) + vec3 lp, // light position + vec3 ld, // light direction (for spotlights) + vec3 lightColor, + float lightSize, float falloff, float is_pointlight, float ambiance); + +#endif +// ================================== + + +// ================================== +// output definition +// ================================== +#if defined(ALPHA_BLEND) || defined(UNLIT) +out vec4 frag_color; +#else +out vec4 frag_data[4]; +#endif +// ================================== + + +void main() +{ + unpackMaterial(); +// ================================== +// all variants +// mirror clip +// base color +// masking +// emissive +// ================================== + vec3 pos = vary_position; + mirrorClip(pos); + +#ifdef ALPHA_BLEND + //waterClip(pos); +#endif + + vec4 basecolor = texture(diffuseMap, base_color_uv.xy).rgba; + basecolor.rgb = srgb_to_linear(basecolor.rgb); + basecolor *= vertex_color; + + if (basecolor.a < minimum_alpha) + { + discard; + } + + vec3 emissive = emissiveColor; + emissive *= srgb_to_linear(texture(emissiveMap, emissive_uv.xy).rgb); +// ================================== + +// ================================== +// all lit variants +// prepare norm +// prepare orm +// ================================== +#ifndef UNLIT + // from mikktspace.com + vec3 vNt = texture(normalMap, normal_uv.xy).xyz*2.0-1.0; + float sign = vary_sign; + vec3 vN = vary_normal; + vec3 vT = vary_tangent.xyz; + + vec3 vB = sign * cross(vN, vT); + vec3 norm = normalize( vNt.x * vT + vNt.y * vB + vNt.z * vN ); + norm *= gl_FrontFacing ? 1.0 : -1.0; + + // RGB = Occlusion, Roughness, Metal + // default values, see LLViewerTexture::sDefaultPBRORMImagep + // occlusion 1.0 + // roughness 0.0 + // metal 0.0 + vec3 orm = texture(metallicRoughnessMap, metallic_roughness_uv.xy).rgb; + orm.r = texture(occlusionMap, occlusion_uv.xy).r; + orm.g *= roughnessFactor; + orm.b *= metallicFactor; +#endif +// ================================== + +// ================================== +// non alpha output +// ================================== +#ifndef ALPHA_BLEND +#ifdef UNLIT + vec4 color = basecolor; + color.rgb += emissive.rgb; + frag_color = color; +#else + frag_data[0] = max(vec4(basecolor.rgb, 0.0), vec4(0)); + frag_data[1] = max(vec4(orm.rgb,0.0), vec4(0)); + frag_data[2] = vec4(norm, GBUFFER_FLAG_HAS_PBR); + frag_data[3] = max(vec4(emissive,0), vec4(0)); +#endif +#endif + + +// ================================== +// alpha implementation +// ================================== +#ifdef ALPHA_BLEND + + float scol = 1.0; + vec3 sunlit; + vec3 amblit; + vec3 additive; + vec3 atten; + + vec3 light_dir; + +#ifdef UNLIT + light_dir = vec3(0,0,1); + vec3 norm = vec3(0,0,1); +#else + light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir; +#endif + + calcAtmosphericVarsLinear(pos.xyz, norm, light_dir, sunlit, amblit, additive, atten); + +#ifndef UNLIT + vec3 sunlit_linear = srgb_to_linear(sunlit); + + vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5; + +#ifdef HAS_SUN_SHADOW + scol = sampleDirectionalShadow(pos.xyz, norm.xyz, frag); +#endif + + float perceptualRoughness = orm.g * roughnessFactor; + float metallic = orm.b * metallicFactor; + + // PBR IBL + float gloss = 1.0 - perceptualRoughness; + vec3 irradiance = vec3(0); + vec3 radiance = vec3(0); + sampleReflectionProbes(irradiance, radiance, vary_position.xy*0.5+0.5, pos.xyz, norm.xyz, gloss, true, amblit); + + vec3 diffuseColor; + vec3 specularColor; + calcDiffuseSpecular(basecolor.rgb, metallic, diffuseColor, specularColor); + + vec3 v = -normalize(pos.xyz); + + vec3 color = pbrBaseLight(diffuseColor, specularColor, metallic, v, norm.xyz, perceptualRoughness, light_dir, sunlit_linear, scol, radiance, irradiance, emissive, orm.r, additive, atten); + + vec3 light = vec3(0); + + // Punctual lights +#define LIGHT_LOOP(i) light += pbrCalcPointLightOrSpotLight(diffuseColor, specularColor, perceptualRoughness, metallic, norm.xyz, pos.xyz, v, light_position[i].xyz, light_direction[i].xyz, light_diffuse[i].rgb, light_deferred_attenuation[i].x, light_deferred_attenuation[i].y, light_attenuation[i].z, light_attenuation[i].w); + + LIGHT_LOOP(1) + LIGHT_LOOP(2) + LIGHT_LOOP(3) + LIGHT_LOOP(4) + LIGHT_LOOP(5) + LIGHT_LOOP(6) + LIGHT_LOOP(7) + + color.rgb += light.rgb; + + color.rgb = applySkyAndWaterFog(pos.xyz, additive, atten, vec4(color, 1.0)).rgb; + + float a = basecolor.a*vertex_color.a; + + frag_color = max(vec4(color.rgb,a), vec4(0)); +#else // UNLIT + vec4 color = basecolor; + color.rgb += emissive.rgb; + frag_color = color; +#endif +#endif // ALPHA_BLEND +} + diff --git a/indra/newview/app_settings/shaders/class1/gltf/pbrmetallicroughnessV.glsl b/indra/newview/app_settings/shaders/class1/gltf/pbrmetallicroughnessV.glsl new file mode 100644 index 0000000000..6a628bc852 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/gltf/pbrmetallicroughnessV.glsl @@ -0,0 +1,330 @@ +/** + * @file pbrmetallicroughnessV.glsl + * + * $LicenseInfo:firstyear=2024&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2022, 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$ + */ + +// GLTF pbrMetallicRoughness implementation + +uniform mat4 modelview_matrix; +uniform mat4 projection_matrix; + +#ifdef MULTI_UV +in vec2 texcoord1; +int base_color_texcoord = 0; +int emissive_texcoord = 0; +#ifndef UNLIT +int normal_texcoord = 0; +int metallic_roughness_texcoord = 0; +int occlusion_texcoord = 0; +#endif +#endif + +uniform int gltf_material_id; + +layout (std140) uniform GLTFMaterials +{ + // index by gltf_material_id*12 + + // [gltf_material_id + [0-1]] - base color transform + // [gltf_material_id + [2-3]] - normal transform + // [gltf_material_id + [4-5]] - metallic roughness transform + // [gltf_material_id + [6-7]] - emissive transform + // [gltf_material_id + [8-9]] - occlusion transform + // [gltf_material_id + 10] - emissive factor + // [gltf_material_id + 11] - .r unused, .g roughness, .b metalness, .a minimum alpha + + // Transforms are packed as follows + // packed[0] = vec4(scale.x, scale.y, rotation, offset.x) + // packed[1] = vec4(mScale.y, texcoord, 0, 0) + vec4 gltf_material_data[MAX_UBO_VEC4S]; +}; + +vec4[2] texture_base_color_transform; +vec4[2] texture_normal_transform; +vec4[2] texture_metallic_roughness_transform; +vec4[2] texture_emissive_transform; +vec4[2] texture_occlusion_transform; + +void unpackTextureTransforms() +{ + if (gltf_material_id != -1) + { + int idx = gltf_material_id*12; + + texture_base_color_transform[0] = gltf_material_data[idx+0]; + texture_base_color_transform[1] = gltf_material_data[idx+1]; + + texture_normal_transform[0] = gltf_material_data[idx+2]; + texture_normal_transform[1] = gltf_material_data[idx+3]; + + texture_metallic_roughness_transform[0] = gltf_material_data[idx+4]; + texture_metallic_roughness_transform[1] = gltf_material_data[idx+5]; + + texture_emissive_transform[0] = gltf_material_data[idx+6]; + texture_emissive_transform[1] = gltf_material_data[idx+7]; + + texture_occlusion_transform[0] = gltf_material_data[idx+8]; + texture_occlusion_transform[1] = gltf_material_data[idx+9]; + +#ifdef MULTI_UV + base_color_texcoord = int(gltf_material_data[idx+1].g); + emissive_texcoord = int(gltf_material_data[idx+7].g); +#ifndef UNLIT + normal_texcoord = int(gltf_material_data[idx+3].g); + metallic_roughness_texcoord = int(gltf_material_data[idx+5].g); + occlusion_texcoord = int(gltf_material_data[idx+9].g); +#endif +#endif + } + else + { + texture_base_color_transform[0] = vec4(1.0, 1.0, 0.0, 0.0); + texture_base_color_transform[1] = vec4(0.0, 0.0, 0.0, 0.0); + + texture_normal_transform[0] = vec4(1.0, 1.0, 0.0, 0.0); + texture_normal_transform[1] = vec4(0.0, 0.0, 0.0, 0.0); + + texture_metallic_roughness_transform[0] = vec4(1.0, 1.0, 0.0, 0.0); + texture_metallic_roughness_transform[1] = vec4(0.0, 0.0, 0.0, 0.0); + + texture_emissive_transform[0] = vec4(1.0, 1.0, 0.0, 0.0); + texture_emissive_transform[1] = vec4(0.0, 0.0, 0.0, 0.0); + + texture_occlusion_transform[0] = vec4(1.0, 1.0, 0.0, 0.0); + texture_occlusion_transform[1] = vec4(0.0, 0.0, 0.0, 0.0); + } +} + + +in vec3 position; +in vec4 diffuse_color; +in vec2 texcoord0; +out vec2 base_color_uv; +out vec2 emissive_uv; +out vec4 vertex_color; +out vec3 vary_position; + +#ifndef UNLIT +in vec3 normal; +in vec4 tangent; +out vec2 normal_uv; +out vec2 metallic_roughness_uv; +out vec2 occlusion_uv; +out vec3 vary_tangent; +flat out float vary_sign; +out vec3 vary_normal; +#endif + +vec2 gltf_texture_transform(vec2 texcoord, vec4[2] p) +{ + texcoord.y = 1.0 - texcoord.y; + + vec2 Scale = p[0].xy; + float Rotation = -p[0].z; + vec2 Offset = vec2(p[0].w, p[1].x); + + mat3 translation = mat3(1,0,0, 0,1,0, Offset.x, Offset.y, 1); + mat3 rotation = mat3( + cos(Rotation), sin(Rotation), 0, + -sin(Rotation), cos(Rotation), 0, + 0, 0, 1); + + mat3 scale = mat3(Scale.x,0,0, 0,Scale.y,0, 0,0,1); + + mat3 matrix = translation * rotation * scale; + + vec2 uvTransformed = ( matrix * vec3(texcoord.xy, 1) ).xy; + + uvTransformed.y = 1.0 - uvTransformed.y; + + return uvTransformed; +} + +#ifndef UNLIT +vec3 gltf_tangent_space_transform(vec4 vertex_tangent, vec3 vertex_normal, vec4[2] khr_gltf_transform) +{ //derived from tangent_space_transform in textureUtilV.glsl + vec2 weights = vec2(0, 1); + + // Convert to left-handed coordinate system + weights.y = -weights.y; + + // Apply KHR_texture_transform (rotation only) + float khr_rotation = khr_gltf_transform[0].z; + mat2 khr_rotation_mat = mat2( + cos(khr_rotation),-sin(khr_rotation), + sin(khr_rotation), cos(khr_rotation) + ); + weights = khr_rotation_mat * weights; + + // Convert back to right-handed coordinate system + weights.y = -weights.y; + + // Similar to the MikkTSpace-compatible method of extracting the binormal + // from the normal and tangent, as seen in the fragment shader + vec3 vertex_binormal = vertex_tangent.w * cross(vertex_normal, vertex_tangent.xyz); + + return (weights.x * vertex_binormal.xyz) + (weights.y * vertex_tangent.xyz); + + return vertex_tangent.xyz; +} +#endif + +#ifdef ALPHA_BLEND +out vec3 vary_fragcoord; +#endif + +#ifdef HAS_SKIN + +layout (std140) uniform GLTFJoints +{ + mat3x4 gltf_joints[MAX_NODES_PER_GLTF_OBJECT]; +}; + + +in uvec4 joint; +in vec4 weight4; + +mat4 getGLTFTransform() +{ + int i; + + vec4 w = weight4; + + uint i1 = joint.x; + uint i2 = joint.y; + uint i3 = joint.z; + uint i4 = joint.w; + + mat3 mat = mat3(gltf_joints[i1])*w.x; + mat += mat3(gltf_joints[i2])*w.y; + mat += mat3(gltf_joints[i3])*w.z; + mat += mat3(gltf_joints[i4])*w.w; + + vec3 trans = vec3(gltf_joints[i1][0].w,gltf_joints[i1][1].w,gltf_joints[i1][2].w)*w.x; + trans += vec3(gltf_joints[i2][0].w,gltf_joints[i2][1].w,gltf_joints[i2][2].w)*w.y; + trans += vec3(gltf_joints[i3][0].w,gltf_joints[i3][1].w,gltf_joints[i3][2].w)*w.z; + trans += vec3(gltf_joints[i4][0].w,gltf_joints[i4][1].w,gltf_joints[i4][2].w)*w.w; + + mat4 ret; + + ret[0] = vec4(mat[0], 0); + ret[1] = vec4(mat[1], 0); + ret[2] = vec4(mat[2], 0); + ret[3] = vec4(trans, 1.0); + + return ret; +} + +#else + +layout (std140) uniform GLTFNodes +{ + mat3x4 gltf_nodes[MAX_NODES_PER_GLTF_OBJECT]; +}; + +uniform int gltf_node_id = 0; + +mat4 getGLTFTransform() +{ + mat4 ret; + mat3x4 src = gltf_nodes[gltf_node_id]; + + ret[0] = vec4(src[0].xyz, 0); + ret[1] = vec4(src[1].xyz, 0); + ret[2] = vec4(src[2].xyz, 0); + + ret[3] = vec4(src[0].w, src[1].w, src[2].w, 1); + + return ret; +} + +#endif + +void main() +{ + unpackTextureTransforms(); + mat4 mat = getGLTFTransform(); + + mat = modelview_matrix * mat; + + vec3 pos = (mat*vec4(position.xyz,1.0)).xyz; + vary_position = pos; + + vec4 vert = projection_matrix * vec4(pos, 1.0); + gl_Position = vert; + + vec2 bcuv; + vec2 emuv; + +#ifdef MULTI_UV + vec2 uv[2]; + uv[0] = texcoord0; + uv[1] = texcoord1; + + bcuv = uv[base_color_texcoord]; + emuv = uv[emissive_texcoord]; +#else + bcuv = texcoord0; + emuv = texcoord0; +#endif + + base_color_uv = gltf_texture_transform(bcuv, texture_base_color_transform); + emissive_uv = gltf_texture_transform(emuv, texture_emissive_transform); + +#ifndef UNLIT + vec2 normuv; + vec2 rmuv; + vec2 ouv; +#ifdef MULTI_UV + normuv = uv[normal_texcoord]; + rmuv = uv[metallic_roughness_texcoord]; + ouv = uv[occlusion_texcoord]; +#else + normuv = texcoord0; + rmuv = texcoord0; + ouv = texcoord0; +#endif + normal_uv = gltf_texture_transform(normuv, texture_normal_transform); + metallic_roughness_uv = gltf_texture_transform(rmuv, texture_metallic_roughness_transform); + occlusion_uv = gltf_texture_transform(ouv, texture_occlusion_transform); +#endif + +#ifndef UNLIT + vec3 n = (mat*vec4(normal.xyz+position.xyz,1.0)).xyz-pos.xyz; + vec3 t = (mat*vec4(tangent.xyz+position.xyz,1.0)).xyz-pos.xyz; + + n = normalize(n); + vary_tangent = normalize(gltf_tangent_space_transform(vec4(t, tangent.w), n, texture_normal_transform)); + vary_sign = tangent.w; + vary_normal = n; +#endif + + vertex_color = diffuse_color; +#ifdef ALPHA_BLEND + vary_fragcoord = vert.xyz; +#endif +} + + + + diff --git a/indra/newview/app_settings/shaders/class1/interface/copyF.glsl b/indra/newview/app_settings/shaders/class1/interface/copyF.glsl index edaa2488f0..094d147e86 100644 --- a/indra/newview/app_settings/shaders/class1/interface/copyF.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/copyF.glsl @@ -25,7 +25,10 @@ in vec2 tc; +#if defined(COPY_DEPTH) uniform sampler2D depthMap; +#endif + uniform sampler2D diffuseMap; out vec4 frag_color; diff --git a/indra/newview/app_settings/shaders/class1/interface/normaldebugG.glsl b/indra/newview/app_settings/shaders/class1/interface/normaldebugG.glsl index 51d05cd507..50737d4742 100644 --- a/indra/newview/app_settings/shaders/class1/interface/normaldebugG.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/normaldebugG.glsl @@ -1,24 +1,24 @@ -/** +/** * @file normaldebugG.glsl * * $LicenseInfo:firstyear=2023&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2023, 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$ */ diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl index a2125b2aec..38fdd379ea 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl @@ -57,9 +57,9 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou vec3 rel_pos_norm = normalize(rel_pos); float rel_pos_len = length(rel_pos); - + vec3 sunlight = (sun_up_factor == 1) ? sunlight_color: moonlight_color; - + // sunlight attenuation effect (hue and brightness) due to atmosphere // this is used later for sunlight modulation at various altitudes vec3 light_atten = (blue_density + vec3(haze_density * 0.25)) * (density_multiplier * max_y); @@ -119,7 +119,7 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou additive = (blue_horizon.rgb * blue_weight.rgb) * (cs + tmpAmbient.rgb) + (haze_horizon * haze_weight.rgb) * (cs * haze_glow + tmpAmbient.rgb); // brightness of surface both sunlight and ambient - + sunlit = sunlight.rgb; amblit = tmpAmbient; @@ -128,7 +128,7 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou vec3 srgb_to_linear(vec3 col); -// provide a touch of lighting in the opposite direction of the sun light +// provide a touch of lighting in the opposite direction of the sun light // so areas in shadow don't lose all detail float ambientLighting(vec3 norm, vec3 light_dir) { @@ -150,7 +150,7 @@ void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, ou // (allows for mixing of light sources other than sunlight e.g. reflection probes) sunlit *= sky_sunlight_scale; amblit *= sky_ambient_scale; - + amblit = srgb_to_linear(amblit); amblit *= ambientLighting(norm, light_dir); } diff --git a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl index 059c2a64ce..f4a8051427 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl @@ -1,24 +1,24 @@ -/** +/** * @file class1\deferred\pbralphaF.glsl * * $LicenseInfo:firstyear=2022&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2022, 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$ */ @@ -87,7 +87,7 @@ vec4 applySkyAndWaterFog(vec3 pos, vec3 additive, vec3 atten, vec4 color); void calcHalfVectors(vec3 lv, vec3 n, vec3 v, out vec3 h, out vec3 l, out float nh, out float nl, out float nv, out float vh, out float lightDist); float calcLegacyDistanceAttenuation(float distance, float falloff); float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen); -void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv, +void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv, vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent, vec3 amblit_linear); void mirrorClip(vec3 pos); @@ -111,15 +111,15 @@ vec3 pbrBaseLight(vec3 diffuseColor, vec3 additive, vec3 atten); -vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor, - float perceptualRoughness, +vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor, + float perceptualRoughness, float metallic, vec3 n, // normal vec3 v, // surface point to camera vec3 l); //surface point to light -vec3 calcPointLightOrSpotLight(vec3 diffuseColor, vec3 specularColor, - float perceptualRoughness, +vec3 pbrCalcPointLightOrSpotLight(vec3 diffuseColor, vec3 specularColor, + float perceptualRoughness, float metallic, vec3 n, // normal vec3 p, // pixel position @@ -127,33 +127,7 @@ vec3 calcPointLightOrSpotLight(vec3 diffuseColor, vec3 specularColor, vec3 lp, // light position vec3 ld, // light direction (for spotlights) vec3 lightColor, - float lightSize, float falloff, float is_pointlight, float ambiance) -{ - vec3 color = vec3(0,0,0); - - vec3 lv = lp.xyz - p; - - float lightDist = length(lv); - - float dist = lightDist / lightSize; - if (dist <= 1.0) - { - lv /= lightDist; - - float dist_atten = calcLegacyDistanceAttenuation(dist, falloff); - - // spotlight coefficient. - float spot = max(dot(-ld, lv), is_pointlight); - // spot*spot => GL_SPOT_EXPONENT=2 - float spot_atten = spot*spot; - - vec3 intensity = spot_atten * dist_atten * lightColor * 3.0; //magic number to balance with legacy materials - - color = intensity*pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, lv); - } - - return color; -} + float lightSize, float falloff, float is_pointlight, float ambiance); void main() { @@ -181,7 +155,7 @@ void main() float sign = vary_sign; vec3 vN = vary_normal; vec3 vT = vary_tangent.xyz; - + vec3 vB = sign * cross(vN, vT); vec3 norm = normalize( vNt.x * vT + vNt.y * vB + vNt.z * vN ); @@ -218,7 +192,7 @@ void main() vec3 irradiance = vec3(0); vec3 radiance = vec3(0); sampleReflectionProbes(irradiance, radiance, vary_position.xy*0.5+0.5, pos.xyz, norm.xyz, gloss, true, amblit); - + vec3 diffuseColor; vec3 specularColor; calcDiffuseSpecular(col.rgb, metallic, diffuseColor, specularColor); @@ -230,7 +204,7 @@ void main() vec3 light = vec3(0); // Punctual lights -#define LIGHT_LOOP(i) light += calcPointLightOrSpotLight(diffuseColor, specularColor, perceptualRoughness, metallic, norm.xyz, pos.xyz, v, light_position[i].xyz, light_direction[i].xyz, light_diffuse[i].rgb, light_deferred_attenuation[i].x, light_deferred_attenuation[i].y, light_attenuation[i].z, light_attenuation[i].w); +#define LIGHT_LOOP(i) light += pbrCalcPointLightOrSpotLight(diffuseColor, specularColor, perceptualRoughness, metallic, norm.xyz, pos.xyz, v, light_position[i].xyz, light_direction[i].xyz, light_diffuse[i].rgb, light_deferred_attenuation[i].x, light_deferred_attenuation[i].y, light_attenuation[i].z, light_attenuation[i].w); LIGHT_LOOP(1) LIGHT_LOOP(2) @@ -245,7 +219,7 @@ void main() color.rgb = applySkyAndWaterFog(pos.xyz, additive, atten, vec4(color, 1.0)).rgb; float a = basecolor.a*vertex_color.a; - + frag_color = max(vec4(color.rgb,a), vec4(0)); } @@ -295,7 +269,7 @@ void main() // emissiveMap here is a vanilla RGB texture encoded as sRGB, manually convert to linear colorEmissive *= srgb_to_linear(texture(emissiveMap, emissive_texcoord.xy).rgb); - + float a = basecolor.a*vertex_color.a; color += colorEmissive; diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl index 1bd5f5a718..f6c75e6a9c 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl @@ -1,24 +1,24 @@ -/** +/** * @file sunLightF.glsl * * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2007, 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$ */ @@ -41,7 +41,7 @@ vec4 getPosition(vec2 pos_screen); float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen); float sampleSpotShadow(vec3 pos, vec3 norm, int index, vec2 pos_screen); -void main() +void main() { vec2 pos_screen = vary_fragcoord.xy; vec4 pos = getPosition(pos_screen); @@ -50,7 +50,7 @@ void main() vec4 col; col.r = sampleDirectionalShadow(pos.xyz, norm.xyz, pos_screen); col.g = 1.0f; - col.b = sampleSpotShadow(pos.xyz, norm.xyz, 0, pos_screen); + col.b = sampleSpotShadow(pos.xyz, norm.xyz, 0, pos_screen); col.a = sampleSpotShadow(pos.xyz, norm.xyz, 1, pos_screen); frag_color = clamp(col, vec4(0), vec4(1)); diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl index e0333b6044..3437ed4b4c 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl @@ -1,27 +1,27 @@ -/** +/** * @file class2/deferred/sunLightSSAOF.glsl * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2007, 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$ */ - + /*[EXTRA_CODE_HERE]*/ out vec4 frag_color; @@ -38,7 +38,7 @@ float sampleDirectionalShadow(vec3 shadow_pos, vec3 norm, vec2 pos_screen); float sampleSpotShadow(vec3 shadow_pos, vec3 norm, int index, vec2 pos_screen); float calcAmbientOcclusion(vec4 pos, vec3 norm, vec2 pos_screen); -void main() +void main() { vec2 pos_screen = vary_fragcoord.xy; vec4 pos = getPosition(pos_screen); diff --git a/indra/newview/app_settings/shaders/class3/deferred/hazeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/hazeF.glsl index 4af57e3b80..7b82aa1a0d 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/hazeF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/hazeF.glsl @@ -25,8 +25,6 @@ out vec4 frag_color; -uniform sampler2D normalMap; - // Inputs uniform vec3 sun_dir; uniform vec3 moon_dir; @@ -67,16 +65,16 @@ void main() calcAtmosphericVarsLinear(pos.xyz, norm.xyz, light_dir, sunlit, amblit, additive, atten); vec3 sunlit_linear = srgb_to_linear(sunlit); - + // mask off atmospherics below water (when camera is under water) bool do_atmospherics = false; - + if (dot(vec3(0), waterPlane.xyz) + waterPlane.w > 0.0 || dot(pos.xyz, waterPlane.xyz) + waterPlane.w > 0.0) { do_atmospherics = true; } - + vec3 irradiance = vec3(0); vec3 radiance = vec3(0); @@ -101,5 +99,5 @@ void main() } frag_color = max(vec4(color.rgb, alpha), vec4(0)); //output linear since local lights will be added to this shader's results - + } diff --git a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl index 28b1b5f5e6..5ee9aea09d 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl @@ -77,7 +77,6 @@ uniform float is_mirror; uniform vec3 sun_dir; uniform vec3 moon_dir; -in vec2 vary_fragcoord; uniform mat4 proj_mat; uniform mat4 inv_proj; diff --git a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl index edfd6cbced..4ed778371f 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl @@ -27,7 +27,6 @@ out vec4 frag_color; -uniform sampler2D depthMap; uniform sampler2D diffuseRect; uniform sampler2D specularRect; uniform sampler2D emissiveRect; // PBR linear packed Occlusion, Roughness, Metal. See: pbropaqueF.glsl @@ -56,8 +55,8 @@ vec3 srgb_to_linear(vec3 c); // Util vec3 hue_to_rgb(float hue); -vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor, - float perceptualRoughness, +vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor, + float perceptualRoughness, float metallic, vec3 n, // normal vec3 v, // surface point to camera @@ -91,7 +90,7 @@ void main() float metallic = orm.b; vec3 f0 = vec3(0.04); vec3 baseColor = diffuse.rgb; - + vec3 diffuseColor = baseColor.rgb*(vec3(1.0)-f0); diffuseColor *= 1.0 - metallic; diff --git a/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl index 60be9f4407..6c13757149 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl @@ -1,38 +1,36 @@ -/** +/** * @file class3\deferred\pointLightF.glsl * * $LicenseInfo:firstyear=2022&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2022, 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$ */ - + /*[EXTRA_CODE_HERE]*/ out vec4 frag_color; uniform sampler2D diffuseRect; uniform sampler2D specularRect; -uniform sampler2D normalMap; uniform sampler2D emissiveRect; // PBR linear packed Occlusion, Roughness, Metal. See: pbropaqueF.glsl uniform sampler2D lightFunc; -uniform sampler2D depthMap; uniform vec3 env_mat[3]; uniform float sun_wash; @@ -59,8 +57,8 @@ vec2 getScreenCoord(vec4 clip); vec3 srgb_to_linear(vec3 c); float getDepth(vec2 tc); -vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor, - float perceptualRoughness, +vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor, + float perceptualRoughness, float metallic, vec3 n, // normal vec3 v, // surface point to camera @@ -93,13 +91,13 @@ void main() if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR)) { - vec3 colorEmissive = texture(emissiveRect, tc).rgb; + vec3 colorEmissive = texture(emissiveRect, tc).rgb; vec3 orm = spec.rgb; float perceptualRoughness = orm.g; float metallic = orm.b; vec3 f0 = vec3(0.04); vec3 baseColor = diffuse.rgb; - + vec3 diffuseColor = baseColor.rgb*(vec3(1.0)-f0); diffuseColor *= 1.0 - metallic; @@ -136,7 +134,7 @@ void main() final_color += lit*scol*color.rgb*spec.rgb; } } - + if (dot(final_color, final_color) <= 0.0) { discard; diff --git a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl index 47ec8fba55..4bae7b6deb 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl @@ -51,7 +51,7 @@ layout (std140) uniform ReflectionProbes mat4 heroBox; // list of bounding spheres for reflection probes sorted by distance to camera (closest first) vec4 refSphere[MAX_REFMAP_COUNT]; - // extra parameters + // extra parameters // x - irradiance scale // y - radiance scale // z - fade in @@ -102,7 +102,7 @@ bool shouldSampleProbe(int i, vec3 pos) if (refIndex[i].w < 0) { vec4 v = refBox[i] * vec4(pos, 1.0); - if (abs(v.x) > 1 || + if (abs(v.x) > 1 || abs(v.y) > 1 || abs(v.z) > 1) { @@ -229,7 +229,7 @@ void preProbeSample(vec3 pos) } } count++; - + ++neighborIdx; } @@ -251,56 +251,56 @@ void preProbeSample(vec3 pos) // original reference implementation: /* -bool intersect(const Ray &ray) const -{ - float t0, t1; // solutions for t if the ray intersects -#if 0 +bool intersect(const Ray &ray) const +{ + float t0, t1; // solutions for t if the ray intersects +#if 0 // geometric solution - Vec3f L = center - orig; - float tca = L.dotProduct(dir); + Vec3f L = center - orig; + float tca = L.dotProduct(dir); // if (tca < 0) return false; - float d2 = L.dotProduct(L) - tca * tca; - if (d2 > radius2) return false; - float thc = sqrt(radius2 - d2); - t0 = tca - thc; - t1 = tca + thc; -#else + float d2 = L.dotProduct(L) - tca * tca; + if (d2 > radius2) return false; + float thc = sqrt(radius2 - d2); + t0 = tca - thc; + t1 = tca + thc; +#else // analytic solution - Vec3f L = orig - center; - float a = dir.dotProduct(dir); - float b = 2 * dir.dotProduct(L); - float c = L.dotProduct(L) - radius2; - if (!solveQuadratic(a, b, c, t0, t1)) return false; -#endif - if (t0 > t1) std::swap(t0, t1); - - if (t0 < 0) { - t0 = t1; // if t0 is negative, let's use t1 instead - if (t0 < 0) return false; // both t0 and t1 are negative - } - - t = t0; - - return true; + Vec3f L = orig - center; + float a = dir.dotProduct(dir); + float b = 2 * dir.dotProduct(L); + float c = L.dotProduct(L) - radius2; + if (!solveQuadratic(a, b, c, t0, t1)) return false; +#endif + if (t0 > t1) std::swap(t0, t1); + + if (t0 < 0) { + t0 = t1; // if t0 is negative, let's use t1 instead + if (t0 < 0) return false; // both t0 and t1 are negative + } + + t = t0; + + return true; } */ // adapted -- assume that origin is inside sphere, return intersection of ray with edge of sphere vec3 sphereIntersect(vec3 origin, vec3 dir, vec3 center, float radius2) -{ - float t0, t1; // solutions for t if the ray intersects +{ + float t0, t1; // solutions for t if the ray intersects - vec3 L = center - origin; + vec3 L = center - origin; float tca = dot(L,dir); - float d2 = dot(L,L) - tca * tca; + float d2 = dot(L,L) - tca * tca; + + float thc = sqrt(radius2 - d2); + t0 = tca - thc; + t1 = tca + thc; - float thc = sqrt(radius2 - d2); - t0 = tca - thc; - t1 = tca + thc; - vec3 v = origin + dir * t1; - return v; -} + return v; +} void swap(inout float a, inout float b) { @@ -312,17 +312,17 @@ void swap(inout float a, inout float b) // debug implementation, make no assumptions about origin void sphereIntersectDebug(vec3 origin, vec3 dir, vec3 center, float radius2, float depth, inout vec4 col) { - float t[2]; // solutions for t if the ray intersects + float t[2]; // solutions for t if the ray intersects // geometric solution - vec3 L = center - origin; + vec3 L = center - origin; float tca = dot(L, dir); // if (tca < 0) return false; - float d2 = dot(L, L) - tca * tca; - if (d2 > radius2) return; - float thc = sqrt(radius2 - d2); - t[0] = tca - thc; - t[1] = tca + thc; + float d2 = dot(L, L) - tca * tca; + if (d2 > radius2) return; + float thc = sqrt(radius2 - d2); + t[0] = tca - thc; + t[1] = tca + thc; for (int i = 0; i < 2; ++i) { @@ -411,8 +411,8 @@ void debugBoxCol(vec3 ro, vec3 rd, float t, vec3 p, inout vec4 col) bool behind = dot(v,v) > dot(pos,pos); float w = 0.25; - - if (behind) + + if (behind) { w *= 0.5; w /= (length(v)-length(pos))*0.5+1.0; @@ -426,7 +426,7 @@ void debugBoxCol(vec3 ro, vec3 rd, float t, vec3 p, inout vec4 col) // cribbed from https://iquilezles.org/articles/intersectors/ // axis aligned box centered at the origin, with size boxSize -void boxIntersectionDebug( in vec3 ro, in vec3 p, vec3 boxSize, inout vec4 col) +void boxIntersectionDebug( in vec3 ro, in vec3 p, vec3 boxSize, inout vec4 col) { vec3 rd = normalize(p-ro); @@ -471,7 +471,7 @@ void boxIntersectDebug(vec3 origin, vec3 pos, mat4 i, inout vec4 col) // dw - distance weight float sphereWeight(vec3 pos, vec3 dir, vec3 origin, float r, vec4 i, out float dw) { - float r1 = r * 0.5; // 50% of radius (outer sphere to start interpolating down) + float r1 = r * 0.5; // 50% of radius (outer sphere to start interpolating down) vec3 delta = pos.xyz - origin; float d2 = max(length(delta), 0.001); @@ -495,7 +495,7 @@ float sphereWeight(vec3 pos, vec3 dir, vec3 origin, float r, vec4 i, out float d // lod - which mip to sample (lower is higher res, sharper reflections) // c - center of probe // r2 - radius of probe squared -// i - index of probe +// i - index of probe vec3 tapRefMap(vec3 pos, vec3 dir, out float w, out float dw, float lod, vec3 c, int i) { // parallax adjustment @@ -514,7 +514,7 @@ vec3 tapRefMap(vec3 pos, vec3 dir, out float w, out float dw, float lod, vec3 c, float rr = r * r; - v = sphereIntersect(pos, dir, c, + v = sphereIntersect(pos, dir, c, refIndex[i].w < 1 ? 4096.0*4096.0 : // <== effectively disable parallax correction for automatically placed probes to keep from bombing the world with obvious spheres rr); @@ -525,7 +525,7 @@ vec3 tapRefMap(vec3 pos, vec3 dir, out float w, out float dw, float lod, vec3 c, vec3 d = normalize(v); v = env_mat * v; - + vec4 ret = textureLod(reflectionProbes, vec4(v.xyz, refIndex[i].x), lod) * refParams[i].y; return ret.rgb; @@ -536,7 +536,7 @@ vec3 tapRefMap(vec3 pos, vec3 dir, out float w, out float dw, float lod, vec3 c, // dir - pixel normal // w - weight of sample (distance and angular attenuation) // dw - weight of sample (distance only) -// i - index of probe +// i - index of probe vec3 tapIrradianceMap(vec3 pos, vec3 dir, out float w, out float dw, vec3 c, int i, vec3 amblit) { // parallax adjustment @@ -554,7 +554,7 @@ vec3 tapIrradianceMap(vec3 pos, vec3 dir, out float w, out float dw, vec3 c, int // pad sphere for manual probe extending into automatic probe space float rr = r * r; - v = sphereIntersect(pos, dir, c, + v = sphereIntersect(pos, dir, c, refIndex[i].w < 1 ? 4096.0*4096.0 : // <== effectively disable parallax correction for automatically placed probes to keep from bombing the world with obvious spheres rr); @@ -563,7 +563,7 @@ vec3 tapIrradianceMap(vec3 pos, vec3 dir, out float w, out float dw, vec3 c, int v -= c; v = env_mat * v; - + vec3 col = textureLod(irradianceProbes, vec4(v.xyz, refIndex[i].x), 0).rgb * refParams[i].x; col = mix(amblit, col, min(refParams[i].x, 1.0)); @@ -625,7 +625,7 @@ vec3 sampleProbes(vec3 pos, vec3 dir, float lod) col[1] *= 1.0/wsum[1]; col[0] = vec3(0); } - + return col[1]+col[0]; } @@ -654,7 +654,7 @@ vec3 sampleProbeAmbient(vec3 pos, vec3 dir, vec3 amblit) { continue; } - + { float w = 0; float dw = 0; @@ -684,7 +684,7 @@ vec3 sampleProbeAmbient(vec3 pos, vec3 dir, vec3 amblit) col[1] *= 1.0/wsum[1]; col[0] = vec3(0); } - + return col[1]+col[0]; } @@ -704,13 +704,13 @@ void tapHeroProbe(inout vec3 glossenv, vec3 pos, vec3 norm, float glossiness) { float d = 0; boxIntersect(pos, norm, heroBox, d, 1.0); - + w = max(d, 0); } else { float r = heroSphere.w; - + w = sphereWeight(pos, refnormpersp, heroSphere.xyz, r, vec4(1), dw); } @@ -851,9 +851,9 @@ void sampleReflectionProbesLegacy(out vec3 ambenv, out vec3 glossenv, out vec3 l { float lod = (1.0-glossiness)*reflection_lods; glossenv = sampleProbes(pos, normalize(refnormpersp), lod); - + } - + if (envIntensity > 0.0) { legacyenv = sampleProbes(pos, normalize(refnormpersp), 0.0); diff --git a/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostF.glsl b/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostF.glsl index deb276ef9d..9ac389f926 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostF.glsl @@ -52,7 +52,7 @@ float random (vec2 uv); float tapScreenSpaceReflection(int totalSamples, vec2 tc, vec3 viewPos, vec3 n, inout vec4 collectedColor, sampler2D source, float glossiness); -void main() +void main() { vec2 tc = vary_fragcoord.xy; float depth = linearDepth01(getDepth(tc), zNear, zFar); @@ -60,13 +60,13 @@ void main() vec3 pos = getPositionWithDepth(tc, getDepth(tc)).xyz; vec4 spec = texture(specularRect, tc); vec2 hitpixel; - + vec4 diffuse = texture(diffuseRect, tc); vec3 specCol = spec.rgb; vec4 fcol = texture(diffuseMap, tc); - if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR)) + if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR)) { vec3 orm = specCol.rgb; float perceptualRoughness = orm.g; diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl index 494a69efd0..4231d8580e 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl @@ -29,7 +29,6 @@ out vec4 frag_color; uniform sampler2D diffuseRect; uniform sampler2D specularRect; -uniform sampler2D normalMap; uniform sampler2D emissiveRect; // PBR linear packed Occlusion, Roughness, Metal. See: pbropaqueF.glsl const float M_PI = 3.14159265; @@ -38,7 +37,6 @@ const float M_PI = 3.14159265; uniform sampler2D lightMap; #endif -uniform sampler2D depthMap; uniform sampler2D lightFunc; uniform float blur_size; @@ -105,8 +103,8 @@ vec3 pbrBaseLight(vec3 diffuseColor, vec3 additive, vec3 atten); -vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor, - float perceptualRoughness, +vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor, + float perceptualRoughness, float metallic, vec3 n, // normal vec3 v, // surface point to camera @@ -174,10 +172,10 @@ void main() float metallic = orm.b; float ao = orm.r; - + // PBR IBL float gloss = 1.0 - perceptualRoughness; - + sampleReflectionProbes(irradiance, radiance, tc, pos.xyz, norm.xyz, gloss, false, amblit_linear); adjustIrradiance(irradiance, ambocc); @@ -205,7 +203,7 @@ void main() { // legacy shaders are still writng sRGB to gbuffer baseColor.rgb = srgb_to_linear(baseColor.rgb); - + spec.rgb = srgb_to_linear(spec.rgb); float da = clamp(dot(norm.xyz, light_dir.xyz), 0.0, 1.0); @@ -224,7 +222,7 @@ void main() vec3 sun_contrib = min(da, scol) * sunlit_linear; color.rgb += sun_contrib; color.rgb *= baseColor.rgb; - + vec3 refnormpersp = reflect(pos.xyz, norm.xyz); if (spec.a > 0.0) @@ -254,7 +252,7 @@ void main() } color.rgb = mix(color.rgb, baseColor.rgb, baseColor.a); - + if (envIntensity > 0.0) { // add environment map applyLegacyEnv(color, legacyenv, spec, pos.xyz, norm.xyz, envIntensity); diff --git a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl index 319fa86148..bc4d36d10d 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl @@ -1,40 +1,37 @@ -/** +/** * @file class3\deferred\spotLightF.glsl * * $LicenseInfo:firstyear=2022&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2022, 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$ */ - + /*[EXTRA_CODE_HERE]*/ out vec4 frag_color; uniform sampler2D diffuseRect; uniform sampler2D specularRect; -uniform sampler2D depthMap; -uniform sampler2D normalMap; uniform sampler2D emissiveRect; // PBR linear packed Occlusion, Roughness, Metal. See: pbropaqueF.glsl uniform samplerCube environmentMap; uniform sampler2D lightMap; -uniform sampler2D projectionMap; // rgba uniform sampler2D lightFunc; uniform mat4 proj_mat; //screen space to light space @@ -83,8 +80,8 @@ vec4 getPosition(vec2 pos_screen); const float M_PI = 3.14159265; -vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor, - float perceptualRoughness, +vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor, + float perceptualRoughness, float metallic, vec3 n, // normal vec3 v, // surface point to camera @@ -112,13 +109,13 @@ void main() } float shadow = 1.0; - + if (proj_shadow_idx >= 0) { vec4 shd = texture(lightMap, tc); shadow = (proj_shadow_idx==0)?shd.b:shd.a; shadow += shadow_fade; - shadow = clamp(shadow, 0.0, 1.0); + shadow = clamp(shadow, 0.0, 1.0); } vec4 norm = getNorm(tc); @@ -149,7 +146,7 @@ void main() float metallic = orm.b; vec3 f0 = vec3(0.04); vec3 baseColor = diffuse.rgb; - + vec3 diffuseColor = baseColor.rgb*(vec3(1.0)-f0); diffuseColor *= 1.0 - metallic; @@ -167,7 +164,7 @@ void main() if (nl > 0.0) { amb_da += (nl*0.5 + 0.5) * proj_ambiance; - + dlit = getProjectedLightDiffuseColor( l_dist, proj_tc.xy ); vec3 intensity = dist_atten * dlit * 3.25 * shadow; // Legacy attenuation, magic number to balance with legacy materials @@ -205,11 +202,11 @@ void main() // unshadowed for consistency between forward and deferred? amb_da += (nl*0.5+0.5) /* * (1.0-shadow) */ * proj_ambiance; } - + amb_rgb = getProjectedLightAmbiance( amb_da, dist_atten, lit, nl, 1.0, proj_tc.xy ); final_color += diffuse.rgb * amb_rgb * max(dot(-normalize(lv), n), 0.0); } - + if (spec.a > 0.0) { dlit *= min(nl*6.0, 1.0) * dist_atten; @@ -218,7 +215,7 @@ void main() float gtdenom = 2 * nh; float gt = max(0, min(gtdenom * nv / vh, gtdenom * nl / vh)); - + if (nh > 0.0) { float scol = fres*texture(lightFunc, vec2(nh, spec.a)).r*gt/(nh*nl); @@ -226,26 +223,26 @@ void main() speccol = clamp(speccol, vec3(0), vec3(1)); final_color += speccol; } - } + } if (envIntensity > 0.0) { vec3 ref = reflect(normalize(pos), n); - + //project from point pos in direction ref to plane proj_p, proj_n vec3 pdelta = proj_p-pos; float ds = dot(ref, proj_n); - + if (ds < 0.0) { vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds; - + vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0)); if (stc.z > 0.0) { stc /= stc.w; - + if (stc.x < 1.0 && stc.y < 1.0 && stc.x > 0.0 && diff --git a/indra/newview/app_settings/shaders/class3/deferred/waterHazeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/waterHazeF.glsl index f6bef1e498..2bf785e773 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/waterHazeF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/waterHazeF.glsl @@ -28,8 +28,6 @@ out vec4 frag_color; // Inputs in vec4 vary_fragcoord; -uniform sampler2D normalMap; - vec4 getPositionWithDepth(vec2 pos_screen, float depth); float getDepth(vec2 pos_screen); @@ -43,7 +41,7 @@ void main() float depth = getDepth(tc.xy); if (above_water > 0) - { + { // we want to depth test when the camera is above water, but some GPUs have a hard time // with depth testing against render targets that are bound for sampling in the same shader // so we do it manually here @@ -60,5 +58,5 @@ void main() vec4 fogged = getWaterFogView(pos.xyz); frag_color = max(fogged, vec4(0)); //output linear since local lights will be added to this shader's results - + } diff --git a/indra/newview/app_settings/shaders/class3/environment/underWaterF.glsl b/indra/newview/app_settings/shaders/class3/environment/underWaterF.glsl index 728d70ebb2..1c02dc764d 100644 --- a/indra/newview/app_settings/shaders/class3/environment/underWaterF.glsl +++ b/indra/newview/app_settings/shaders/class3/environment/underWaterF.glsl @@ -25,7 +25,6 @@ out vec4 frag_color; -uniform sampler2D diffuseMap; uniform sampler2D bumpMap; #ifdef TRANSPARENT_WATER diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt index 8950770172..03849a0326 100644 --- a/indra/newview/featuretable.txt +++ b/indra/newview/featuretable.txt @@ -111,7 +111,7 @@ RenderReflectionProbeLevel 1 0 RenderMirrors 1 0 RenderHeroProbeResolution 1 256 RenderHeroProbeDistance 1 4 -RenderHeroProbeUpdateRate 1 4 +RenderHeroProbeUpdateRate 1 6 RenderHeroProbeConservativeUpdateMultiplier 1 16 // diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt index 0a3415e7f0..7eb977d2fd 100644 --- a/indra/newview/featuretable_mac.txt +++ b/indra/newview/featuretable_mac.txt @@ -109,8 +109,8 @@ RenderScreenSpaceReflections 1 0 RenderReflectionProbeLevel 1 0 RenderMirrors 1 0 RenderHeroProbeResolution 1 256 -RenderHeroProbeDistance 1 3 -RenderHeroProbeUpdateRate 1 6 +RenderHeroProbeDistance 1 4 +RenderHeroProbeUpdateRate 1 6 RenderHeroProbeConservativeUpdateMultiplier 1 16 diff --git a/indra/newview/fsfloatersearch.cpp b/indra/newview/fsfloatersearch.cpp index f05e996699..3f79ee7f4b 100644 --- a/indra/newview/fsfloatersearch.cpp +++ b/indra/newview/fsfloatersearch.cpp @@ -322,7 +322,7 @@ void FSFloaterSearch::onClose(bool app_quitting) } } -BOOL FSFloaterSearch::postBuild() +bool FSFloaterSearch::postBuild() { childSetAction("people_profile_btn", boost::bind(&FSFloaterSearch::onBtnPeopleProfile, this)); childSetAction("people_message_btn", boost::bind(&FSFloaterSearch::onBtnPeopleIM, this)); @@ -813,7 +813,7 @@ FSPanelSearchPeople::~FSPanelSearchPeople() } } -BOOL FSPanelSearchPeople::postBuild() +bool FSPanelSearchPeople::postBuild() { mSearchComboBox = findChild<LLSearchComboBox>("people_edit"); mSearchResults = findChild<LLScrollListCtrl>("search_results_people"); @@ -1161,7 +1161,7 @@ FSPanelSearchGroups::~FSPanelSearchGroups() { } -BOOL FSPanelSearchGroups::postBuild() +bool FSPanelSearchGroups::postBuild() { mSearchComboBox = findChild<LLSearchComboBox>("groups_edit"); mSearchResults = findChild<LLScrollListCtrl>("search_results_groups"); @@ -1478,7 +1478,7 @@ FSPanelSearchPlaces::~FSPanelSearchPlaces() { } -BOOL FSPanelSearchPlaces::postBuild() +bool FSPanelSearchPlaces::postBuild() { mSearchComboBox = findChild<LLSearchComboBox>("places_edit"); mSearchResults = findChild<LLScrollListCtrl>("search_results_places"); @@ -1670,8 +1670,8 @@ void FSPanelSearchPlaces::processSearchReply(LLMessageSystem* msg, void**) LLUUID query_id; LLUUID parcel_id; std::string name; - BOOL for_sale; - BOOL auction; + bool for_sale; + bool auction; F32 dwell; msg->getUUID("AgentData", "AgentID", agent_id); @@ -1837,7 +1837,7 @@ FSPanelSearchLand::~FSPanelSearchLand() { } -BOOL FSPanelSearchLand::postBuild() +bool FSPanelSearchLand::postBuild() { mSearchResults = getChild<LLScrollListCtrl>("search_results_land"); mPriceEditor = findChild<LLLineEditor>("price_edit"); @@ -2057,8 +2057,8 @@ void FSPanelSearchLand::processSearchReply(LLMessageSystem* msg, void**) std::string name; std::string land_sku; std::string land_type; - BOOL auction; - BOOL for_sale; + bool auction; + bool for_sale; S32 price; S32 area; @@ -2242,7 +2242,7 @@ FSPanelSearchClassifieds::~FSPanelSearchClassifieds() { } -BOOL FSPanelSearchClassifieds::postBuild() +bool FSPanelSearchClassifieds::postBuild() { mSearchComboBox = findChild<LLSearchComboBox>("classifieds_edit"); mSearchResults = getChild<LLScrollListCtrl>("search_results_classifieds"); @@ -2303,7 +2303,7 @@ void FSPanelSearchClassifieds::find() return; } U32 category = mClassifiedsCategory->getValue().asInteger(); - BOOL auto_renew = FALSE; + bool auto_renew = FALSE; U32 flags = pack_classified_flags_request(auto_renew, inc_pg, inc_mature, inc_adult); mResultsReceived = 0; @@ -2564,7 +2564,7 @@ FSPanelSearchEvents::~FSPanelSearchEvents() { } -BOOL FSPanelSearchEvents::postBuild() +bool FSPanelSearchEvents::postBuild() { mSearchComboBox = findChild<LLSearchComboBox>("events_edit"); mSearchResults = getChild<LLScrollListCtrl>("search_results_events"); @@ -3035,7 +3035,7 @@ FSPanelSearchWeb::FSPanelSearchWeb() : FSSearchPanelBase() } } -BOOL FSPanelSearchWeb::postBuild() +bool FSPanelSearchWeb::postBuild() { mWebBrowser = getChild<LLMediaCtrl>("search_browser"); return TRUE; diff --git a/indra/newview/fsfloatersearch.h b/indra/newview/fsfloatersearch.h index 61cef8bab9..90e2a8cb89 100644 --- a/indra/newview/fsfloatersearch.h +++ b/indra/newview/fsfloatersearch.h @@ -86,7 +86,7 @@ protected: const S32& getNumResultsReceived() const { return mResultsReceived; }; private: - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); virtual ~FSPanelSearchPeople(); void onBtnFind(); @@ -125,7 +125,7 @@ public: /*virtual*/ void focusDefaultElement(); private: - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); virtual ~FSPanelSearchGroups(); void onBtnFind(); @@ -159,7 +159,7 @@ public: /*virtual*/ void focusDefaultElement(); private: - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); virtual ~FSPanelSearchPlaces(); void onBtnFind(); @@ -192,7 +192,7 @@ public: static void processSearchReply(LLMessageSystem* msg, void**); private: - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); virtual ~FSPanelSearchLand(); void onBtnFind(); @@ -227,7 +227,7 @@ public: /*virtual*/ void focusDefaultElement(); private: - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); virtual ~FSPanelSearchClassifieds(); void onBtnFind(); @@ -262,7 +262,7 @@ public: /*virtual*/ void focusDefaultElement(); private: - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); virtual ~FSPanelSearchEvents(); void onBtnFind(); @@ -298,7 +298,7 @@ class FSPanelSearchWeb : public FSSearchPanelBase LOG_CLASS(FSFloaterSearch); public: FSPanelSearchWeb(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); void loadURL(const SearchQuery &query); /*virtual*/ void focusDefaultElement(); /*virtual*/ void draw(); @@ -335,7 +335,7 @@ public: FSFloaterSearch(const Params& key); ~FSFloaterSearch(); void onOpen(const LLSD& key); - BOOL postBuild(); + bool postBuild(); void avatarNameUpdatedCallback(const LLUUID& id, const LLAvatarName& av_name); void groupNameUpdatedCallback(const LLUUID& id, const std::string& name, bool is_group); diff --git a/indra/newview/gltf/README.md b/indra/newview/gltf/README.md new file mode 100644 index 0000000000..a2d43be1d6 --- /dev/null +++ b/indra/newview/gltf/README.md @@ -0,0 +1,156 @@ +# Linden Lab GLTF Implementation + +Currently in prototype stage. Much functionality is missing (blend shapes, +multiple texture coordinates, etc). + +GLTF Specification can be found here: https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html. +If this implementation disagrees with the GLTF Specification, the specification is correct. + +Class structure and naming should match the GLTF Specification as closely as possible while +conforming to the LL coding standards. All code in headers should be contained in the +LL::GLTF namespace. + +The implementation serves both the client and the server. + +## Design Principles + +- The implementation MUST be capable of round-trip serialization with no data loss beyond F64 to F32 conversions. +- The implementation MUST use the same indexing scheme as the GLTF specification. Do not store pointers where the +- GLTF specification stores indices, store indices. +- Limit dependencies on llcommon as much as possible. Prefer std::, boost::, and (soon) glm:: over LL facsimiles. +- Usage of LLSD is forbidden in the LL::GLTF namespace. +- Use "using namespace" liberally in .cpp files, but never in .h files. +- "using Foo = Bar" is permissible in .h files within the LL::GLTF namespace. + +## Loading, Copying, and Serialization +Each class should provide two functions (Primitive shown for example): + +``` +// Serialize to the provided json object. +// "obj" should be "this" in json form on return +// Do not serialize default values +void serialize(boost::json::object& obj) const; + +// Initialize from a provided json value +const Primitive& operator=(const Value& src); +``` + +"serialize" implementations should use "write": + +``` +void Primitive::serialize(boost::json::object& dst) const +{ + write(mMaterial, "material", dst, -1); + write(mMode, "mode", dst, TINYGLTF_MODE_TRIANGLES); + write(mIndices, "indices", dst, INVALID_INDEX); + write(mAttributes, "attributes", dst); +} +``` + +And operator= implementations should use "copy": + +``` +const Primitive& Primitive::operator=(const Value& src) +{ + if (src.is_object()) + { + copy(src, "material", mMaterial); + copy(src, "mode", mMode); + copy(src, "indices", mIndices); + copy(src, "attributes", mAttributes); + + mGLMode = gltf_mode_to_gl_mode(mMode); + } + return *this; +} +``` + +Parameters to "write" and "copy" MUST be ordered "src" before "dst" +so the code reads as "write src to dst" and "copy src to dst". + +When reading string constants from GLTF json (i.e. "OPAQUE", "TRIANGLES"), these +strings should be converted to enums inside operator=. It is permissible to +store the original strings during prototyping to aid in development, but eventually +we'll purge these strings from the implementation. However, implementations MUST +preserve any and all "name" members. + +"write" and "copy" implementations MUST be stored in buffer_util.h. +As implementers encounter new data types, you'll see compiler errors +pointing at templates in buffer_util.h. See vec3 as a known good +example of how to add support for a new type (there are bad examples, so beware): + +``` +// vec3 +template<> +inline bool copy(const Value& src, vec3& dst) +{ + if (src.is_array()) + { + const boost::json::array& arr = src.as_array(); + if (arr.size() == 3) + { + if (arr[0].is_double() && + arr[1].is_double() && + arr[2].is_double()) + { + dst = vec3(arr[0].get_double(), arr[1].get_double(), arr[2].get_double()); + } + return true; + } + } + return false; +} + +template<> +inline bool write(const vec3& src, Value& dst) +{ + dst = boost::json::array(); + boost::json::array& arr = dst.as_array(); + arr.resize(3); + arr[0] = src.x; + arr[1] = src.y; + arr[2] = src.z; + return true; +} + +``` + +"write" MUST return true if ANY data was written +"copy" MUST return true if ANY data was copied + +Speed is important, but so is safety. In writers, try to avoid redundant copies +(prefer resize over push_back, convert dst to an empty array and fill it, don't +make an array on the stack and copy it into dst). + +boost::json WILL throw exceptions if you call as_foo() on a mismatched type but +WILL NOT throw exceptions on get_foo with a mismatched type. ALWAYS check is_foo +before calling as_foo or get_foo. DO NOT add exception handlers. If boost throws +an exception in serialization, the fix is to add type checks. If we see a large +number of crash reports from boost::json exceptions, each of those reports +indicates a place where we're missing "is_foo" checks. They are gold. Do not +bury them with an exception handler. + +DO NOT rely on existing type conversion tools in the LL codebase -- LL data models +conflict with the GLTF specification so we MUST provide conversions independent of +our existing implementations. + +### JSON Serialization ### + + + +NEVER include buffer_util.h from a header. + +Loading from and saving to disk (import/export) is currently done using tinygltf, but this is not a long term +solution. Eventually the implementation should rely solely on boost::json for reading and writing .gltf +files and should handle .bin files natively. + +When serializing Images and Buffers to the server, clients MUST store a single UUID "uri" field and nothing else. +The server MUST reject any data that violates this requirement. + +Clients MUST remove any Images from Buffers prior to upload to the server. +Servers MAY reject Assets that contain Buffers with unreferenced data. + +... to be continued. + + + diff --git a/indra/newview/gltf/accessor.cpp b/indra/newview/gltf/accessor.cpp index 55d36b7a32..2ef9237f2d 100644 --- a/indra/newview/gltf/accessor.cpp +++ b/indra/newview/gltf/accessor.cpp @@ -27,40 +27,272 @@ #include "../llviewerprecompiledheaders.h" #include "asset.h" +#include "buffer_util.h" +#include "llfilesystem.h" using namespace LL::GLTF; +using namespace boost::json; -const Buffer& Buffer::operator=(const tinygltf::Buffer& src) +namespace LL { - mData = src.data; - mName = src.name; - mUri = src.uri; + namespace GLTF + { + Accessor::Type gltf_type_to_enum(const std::string& type) + { + if (type == "SCALAR") + { + return Accessor::Type::SCALAR; + } + else if (type == "VEC2") + { + return Accessor::Type::VEC2; + } + else if (type == "VEC3") + { + return Accessor::Type::VEC3; + } + else if (type == "VEC4") + { + return Accessor::Type::VEC4; + } + else if (type == "MAT2") + { + return Accessor::Type::MAT2; + } + else if (type == "MAT3") + { + return Accessor::Type::MAT3; + } + else if (type == "MAT4") + { + return Accessor::Type::MAT4; + } + + LL_WARNS("GLTF") << "Unknown accessor type: " << type << LL_ENDL; + llassert(false); + + return Accessor::Type::SCALAR; + } + + std::string enum_to_gltf_type(Accessor::Type type) + { + switch (type) + { + case Accessor::Type::SCALAR: + return "SCALAR"; + case Accessor::Type::VEC2: + return "VEC2"; + case Accessor::Type::VEC3: + return "VEC3"; + case Accessor::Type::VEC4: + return "VEC4"; + case Accessor::Type::MAT2: + return "MAT2"; + case Accessor::Type::MAT3: + return "MAT3"; + case Accessor::Type::MAT4: + return "MAT4"; + } + + LL_WARNS("GLTF") << "Unknown accessor type: " << (S32)type << LL_ENDL; + llassert(false); + + return "SCALAR"; + } + } +} + +void Buffer::erase(Asset& asset, S32 offset, S32 length) +{ + S32 idx = this - &asset.mBuffers[0]; + + mData.erase(mData.begin() + offset, mData.begin() + offset + length); + + llassert(mData.size() <= size_t(INT_MAX)); + mByteLength = S32(mData.size()); + + for (BufferView& view : asset.mBufferViews) + { + if (view.mBuffer == idx) + { + if (view.mByteOffset >= offset) + { + view.mByteOffset -= length; + } + } + } +} + +bool Buffer::prep(Asset& asset) +{ + if (mByteLength == 0) + { + return false; + } + + LLUUID id; + if (mUri.size() == UUID_STR_SIZE && LLUUID::parseUUID(mUri, &id) && id.notNull()) + { // loaded from an asset, fetch the buffer data from the asset store + LLFileSystem file(id, LLAssetType::AT_GLTF_BIN, LLFileSystem::READ); + + if (mByteLength > file.getSize()) + { + LL_WARNS("GLTF") << "Unexpected glbin size: " << id << " is " << file.getSize() << " bytes, expected " << mByteLength << LL_ENDL; + return false; + } + + mData.resize(mByteLength); + if (!file.read((U8*)mData.data(), mByteLength)) + { + LL_WARNS("GLTF") << "Failed to load buffer data from asset: " << id << LL_ENDL; + return false; + } + } + else if (mUri.find("data:") == 0) + { // loaded from a data URI, load the texture from the data + LL_WARNS() << "Data URIs not yet supported" << LL_ENDL; + return false; + } + else if (!asset.mFilename.empty() && + !mUri.empty()) // <-- uri could be empty if we're loading from .glb + { + std::string dir = gDirUtilp->getDirName(asset.mFilename); + std::string bin_file = dir + gDirUtilp->getDirDelimiter() + mUri; + + std::ifstream file(bin_file, std::ios::binary); + if (!file.is_open()) + { + LL_WARNS("GLTF") << "Failed to open file: " << bin_file << LL_ENDL; + return false; + } + + file.seekg(0, std::ios::end); + if (mByteLength > file.tellg()) + { + LL_WARNS("GLTF") << "Unexpected file size: " << bin_file << " is " << file.tellg() << " bytes, expected " << mByteLength << LL_ENDL; + return false; + } + file.seekg(0, std::ios::beg); + + mData.resize(mByteLength); + file.read((char*)mData.data(), mData.size()); + } + + // POSTCONDITION: on success, mData.size == mByteLength + llassert(mData.size() == mByteLength); + return true; +} + +bool Buffer::save(Asset& asset, const std::string& folder) +{ + if (mUri.substr(0, 5) == "data:") + { + LL_WARNS("GLTF") << "Data URIs not yet supported" << LL_ENDL; + return false; + } + + std::string bin_file = folder + gDirUtilp->getDirDelimiter(); + + if (mUri.empty()) + { + if (mName.empty()) + { + S32 idx = this - &asset.mBuffers[0]; + mUri = llformat("buffer_%d.bin", idx); + } + else + { + mUri = mName + ".bin"; + } + } + + bin_file += mUri; + + std::ofstream file(bin_file, std::ios::binary); + if (!file.is_open()) + { + LL_WARNS("GLTF") << "Failed to open file: " << bin_file << LL_ENDL; + return false; + } + + file.write((char*)mData.data(), mData.size()); + + return true; +} + +void Buffer::serialize(object& dst) const +{ + write(mName, "name", dst); + write(mUri, "uri", dst); + write_always(mByteLength, "byteLength", dst); +}; + +const Buffer& Buffer::operator=(const Value& src) +{ + if (src.is_object()) + { + copy(src, "name", mName); + copy(src, "uri", mUri); + copy(src, "byteLength", mByteLength); + + // NOTE: DO NOT attempt to handle the uri here. + // The uri is a reference to a file that is not loaded until + // after the json document is parsed + } return *this; } -const BufferView& BufferView::operator=(const tinygltf::BufferView& src) +void BufferView::serialize(object& dst) const { - mBuffer = src.buffer; - mByteLength = src.byteLength; - mByteOffset = src.byteOffset; - mByteStride = src.byteStride; - mTarget = src.target; - mName = src.name; + write_always(mBuffer, "buffer", dst); + write_always(mByteLength, "byteLength", dst); + write(mByteOffset, "byteOffset", dst, 0); + write(mByteStride, "byteStride", dst, 0); + write(mTarget, "target", dst, -1); + write(mName, "name", dst); +} + +const BufferView& BufferView::operator=(const Value& src) +{ + if (src.is_object()) + { + copy(src, "buffer", mBuffer); + copy(src, "byteLength", mByteLength); + copy(src, "byteOffset", mByteOffset); + copy(src, "byteStride", mByteStride); + copy(src, "target", mTarget); + copy(src, "name", mName); + } return *this; } -const Accessor& Accessor::operator=(const tinygltf::Accessor& src) +void Accessor::serialize(object& dst) const { - mBufferView = src.bufferView; - mByteOffset = src.byteOffset; - mComponentType = src.componentType; - mCount = src.count; - mType = src.type; - mNormalized = src.normalized; - mName = src.name; - mMax = src.maxValues; - mMin = src.minValues; + write(mName, "name", dst); + write(mBufferView, "bufferView", dst, INVALID_INDEX); + write(mByteOffset, "byteOffset", dst, 0); + write_always(mComponentType, "componentType", dst); + write_always(mCount, "count", dst); + write_always(enum_to_gltf_type(mType), "type", dst); + write(mNormalized, "normalized", dst, false); + write(mMax, "max", dst); + write(mMin, "min", dst); +} +const Accessor& Accessor::operator=(const Value& src) +{ + if (src.is_object()) + { + copy(src, "name", mName); + copy(src, "bufferView", mBufferView); + copy(src, "byteOffset", mByteOffset); + copy(src, "componentType", mComponentType); + copy(src, "count", mCount); + copy(src, "type", mType); + copy(src, "normalized", mNormalized); + copy(src, "max", mMax); + copy(src, "min", mMin); + } return *this; } diff --git a/indra/newview/gltf/accessor.h b/indra/newview/gltf/accessor.h index 9b8265d8da..ec68c5f624 100644 --- a/indra/newview/gltf/accessor.h +++ b/indra/newview/gltf/accessor.h @@ -26,16 +26,16 @@ * $/LicenseInfo$ */ -#include "../lltinygltfhelper.h" #include "llstrider.h" +#include "boost/json.hpp" + +#include "common.h" // LL GLTF Implementation namespace LL { namespace GLTF { - class Asset; - constexpr S32 INVALID_INDEX = -1; class Buffer @@ -44,52 +44,77 @@ namespace LL std::vector<U8> mData; std::string mName; std::string mUri; + S32 mByteLength = 0; + + // erase the given range from this buffer. + // also updates all buffer views in given asset that reference this buffer + void erase(Asset& asset, S32 offset, S32 length); + + bool prep(Asset& asset); - const Buffer& operator=(const tinygltf::Buffer& src); + void serialize(boost::json::object& obj) const; + const Buffer& operator=(const Value& value); + + bool save(Asset& asset, const std::string& folder); }; class BufferView { public: S32 mBuffer = INVALID_INDEX; - S32 mByteLength; - S32 mByteOffset; - S32 mByteStride; - S32 mTarget; - S32 mComponentType; + S32 mByteLength = 0; + S32 mByteOffset = 0; + S32 mByteStride = 0; + S32 mTarget = -1; std::string mName; - const BufferView& operator=(const tinygltf::BufferView& src); - + void serialize(boost::json::object& obj) const; + const BufferView& operator=(const Value& value); }; - + class Accessor { public: - S32 mBufferView = INVALID_INDEX; - S32 mByteOffset; - S32 mComponentType; - S32 mCount; - std::vector<double> mMax; - std::vector<double> mMin; + enum class Type : U8 + { + SCALAR, + VEC2, + VEC3, + VEC4, + MAT2, + MAT3, + MAT4 + }; - enum class Type : S32 + enum class ComponentType : U32 { - SCALAR = TINYGLTF_TYPE_SCALAR, - VEC2 = TINYGLTF_TYPE_VEC2, - VEC3 = TINYGLTF_TYPE_VEC3, - VEC4 = TINYGLTF_TYPE_VEC4, - MAT2 = TINYGLTF_TYPE_MAT2, - MAT3 = TINYGLTF_TYPE_MAT3, - MAT4 = TINYGLTF_TYPE_MAT4 + BYTE = 5120, + UNSIGNED_BYTE = 5121, + SHORT = 5122, + UNSIGNED_SHORT = 5123, + UNSIGNED_INT = 5125, + FLOAT = 5126 }; - S32 mType; - bool mNormalized; + std::vector<double> mMax; + std::vector<double> mMin; std::string mName; + S32 mBufferView = INVALID_INDEX; + S32 mByteOffset = 0; + ComponentType mComponentType = ComponentType::BYTE; + S32 mCount = 0; + Type mType = Type::SCALAR; + bool mNormalized = false; - const Accessor& operator=(const tinygltf::Accessor& src); + void serialize(boost::json::object& obj) const; + const Accessor& operator=(const Value& value); }; + + // convert from "SCALAR", "VEC2", etc to Accessor::Type + Accessor::Type gltf_type_to_enum(const std::string& type); + + // convert from Accessor::Type to "SCALAR", "VEC2", etc + std::string enum_to_gltf_type(Accessor::Type type); } } diff --git a/indra/newview/gltf/animation.cpp b/indra/newview/gltf/animation.cpp index da6d02b356..3dff67d746 100644 --- a/indra/newview/gltf/animation.cpp +++ b/indra/newview/gltf/animation.cpp @@ -28,10 +28,12 @@ #include "asset.h" #include "buffer_util.h" +#include "../llskinningutil.h" using namespace LL::GLTF; +using namespace boost::json; -void Animation::allocateGLResources(Asset& asset) +bool Animation::prep(Asset& asset) { if (!mSamplers.empty()) { @@ -39,7 +41,10 @@ void Animation::allocateGLResources(Asset& asset) mMaxTime = -FLT_MAX; for (auto& sampler : mSamplers) { - sampler.allocateGLResources(asset); + if (!sampler.prep(asset)) + { + return false; + } mMinTime = llmin(sampler.mMinTime, mMinTime); mMaxTime = llmax(sampler.mMaxTime, mMaxTime); } @@ -51,13 +56,29 @@ void Animation::allocateGLResources(Asset& asset) for (auto& channel : mRotationChannels) { - channel.allocateGLResources(asset, mSamplers[channel.mSampler]); + if (!channel.prep(asset, mSamplers[channel.mSampler])) + { + return false; + } } for (auto& channel : mTranslationChannels) { - channel.allocateGLResources(asset, mSamplers[channel.mSampler]); + if (!channel.prep(asset, mSamplers[channel.mSampler])) + { + return false; + } + } + + for (auto& channel : mScaleChannels) + { + if (!channel.prep(asset, mSamplers[channel.mSampler])) + { + return false; + } } + + return true; } void Animation::update(Asset& asset, F32 dt) @@ -69,23 +90,41 @@ void Animation::update(Asset& asset, F32 dt) void Animation::apply(Asset& asset, float time) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_GLTF; + // convert time to animation loop time time = fmod(time, mMaxTime - mMinTime) + mMinTime; // apply each channel - for (auto& channel : mRotationChannels) { - channel.apply(asset, mSamplers[channel.mSampler], time); + LL_PROFILE_ZONE_NAMED_CATEGORY_GLTF("gltfanim - rotation"); + + for (auto& channel : mRotationChannels) + { + channel.apply(asset, mSamplers[channel.mSampler], time); + } } - for (auto& channel : mTranslationChannels) { - channel.apply(asset, mSamplers[channel.mSampler], time); + LL_PROFILE_ZONE_NAMED_CATEGORY_GLTF("gltfanim - translation"); + + for (auto& channel : mTranslationChannels) + { + channel.apply(asset, mSamplers[channel.mSampler], time); + } } -}; + { + LL_PROFILE_ZONE_NAMED_CATEGORY_GLTF("gltfanim - scale"); + + for (auto& channel : mScaleChannels) + { + channel.apply(asset, mSamplers[channel.mSampler], time); + } + } +}; -void Animation::Sampler::allocateGLResources(Asset& asset) +bool Animation::Sampler::prep(Asset& asset) { Accessor& accessor = asset.mAccessors[mInput]; mMinTime = accessor.mMin[0]; @@ -95,10 +134,80 @@ void Animation::Sampler::allocateGLResources(Asset& asset) LLStrider<F32> frame_times = mFrameTimes.data(); copy(asset, accessor, frame_times); + + return true; +} + + +void Animation::Sampler::serialize(object& obj) const +{ + write(mInput, "input", obj, INVALID_INDEX); + write(mOutput, "output", obj, INVALID_INDEX); + write(mInterpolation, "interpolation", obj, std::string("LINEAR")); + write(mMinTime, "min_time", obj); + write(mMaxTime, "max_time", obj); +} + +const Animation::Sampler& Animation::Sampler::operator=(const Value& src) +{ + if (src.is_object()) + { + copy(src, "input", mInput); + copy(src, "output", mOutput); + copy(src, "interpolation", mInterpolation); + copy(src, "min_time", mMinTime); + copy(src, "max_time", mMaxTime); + } + return *this; +} + +bool Animation::Channel::Target::operator==(const Channel::Target& rhs) const +{ + return mNode == rhs.mNode && mPath == rhs.mPath; +} + +bool Animation::Channel::Target::operator!=(const Channel::Target& rhs) const +{ + return !(*this == rhs); +} + +void Animation::Channel::Target::serialize(object& obj) const +{ + write(mNode, "node", obj, INVALID_INDEX); + write(mPath, "path", obj); +} + +const Animation::Channel::Target& Animation::Channel::Target::operator=(const Value& src) +{ + if (src.is_object()) + { + copy(src, "node", mNode); + copy(src, "path", mPath); + } + return *this; +} + +void Animation::Channel::serialize(object& obj) const +{ + write(mSampler, "sampler", obj, INVALID_INDEX); + write(mTarget, "target", obj); +} + +const Animation::Channel& Animation::Channel::operator=(const Value& src) +{ + if (src.is_object()) + { + copy(src, "sampler", mSampler); + copy(src, "target", mTarget); + } + return *this; } void Animation::Sampler::getFrameInfo(Asset& asset, F32 time, U32& frameIndex, F32& t) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_GLTF; + llassert(mFrameTimes.size() > 1); // if there is only one frame, there is no need to interpolate + if (time < mMinTime) { frameIndex = 0; @@ -106,40 +215,42 @@ void Animation::Sampler::getFrameInfo(Asset& asset, F32 time, U32& frameIndex, F return; } - if (mFrameTimes.size() > 1) + frameIndex = U32(mFrameTimes.size()) - 2; + t = 1.f; + + if (time > mMaxTime) { - if (time > mMaxTime) - { - frameIndex = mFrameTimes.size() - 2; - t = 1.0f; - return; - } + return; + } + + if (time < mLastFrameTime) + { + mLastFrameIndex = 0; + } + + mLastFrameTime = time; - frameIndex = mFrameTimes.size() - 2; - t = 1.f; + U32 idx = mLastFrameIndex; - for (U32 i = 0; i < mFrameTimes.size() - 1; i++) + for (U32 i = idx; i < (U32)mFrameTimes.size() - 1; i++) + { + if (time >= mFrameTimes[i] && time < mFrameTimes[i + 1]) { - if (time >= mFrameTimes[i] && time < mFrameTimes[i + 1]) - { - frameIndex = i; - t = (time - mFrameTimes[i]) / (mFrameTimes[i + 1] - mFrameTimes[i]); - return; - } + frameIndex = i; + t = (time - mFrameTimes[i]) / (mFrameTimes[i + 1] - mFrameTimes[i]); + mLastFrameIndex = frameIndex; + return; } } - else - { - frameIndex = 0; - t = 0.0f; - } } -void Animation::RotationChannel::allocateGLResources(Asset& asset, Animation::Sampler& sampler) +bool Animation::RotationChannel::prep(Asset& asset, Animation::Sampler& sampler) { Accessor& accessor = asset.mAccessors[sampler.mOutput]; copy(asset, accessor, mRotations); + + return true; } void Animation::RotationChannel::apply(Asset& asset, Sampler& sampler, F32 time) @@ -149,30 +260,30 @@ void Animation::RotationChannel::apply(Asset& asset, Sampler& sampler, F32 time) Node& node = asset.mNodes[mTarget.mNode]; - sampler.getFrameInfo(asset, time, frameIndex, t); - - if (sampler.mFrameTimes.size() == 1) + if (sampler.mFrameTimes.size() < 2) { node.setRotation(mRotations[0]); } else { + sampler.getFrameInfo(asset, time, frameIndex, t); + // interpolate - LLQuaternion q0(mRotations[frameIndex].get_value()); - LLQuaternion q1(mRotations[frameIndex + 1].get_value()); + quat qf = glm::slerp(mRotations[frameIndex], mRotations[frameIndex + 1], t); - LLQuaternion qf = slerp(t, q0, q1); + qf = glm::normalize(qf); - qf.normalize(); - node.setRotation(glh::quaternionf(qf.mQ)); + node.setRotation(qf); } } -void Animation::TranslationChannel::allocateGLResources(Asset& asset, Animation::Sampler& sampler) +bool Animation::TranslationChannel::prep(Asset& asset, Animation::Sampler& sampler) { Accessor& accessor = asset.mAccessors[sampler.mOutput]; copy(asset, accessor, mTranslations); + + return true; } void Animation::TranslationChannel::apply(Asset& asset, Sampler& sampler, F32 time) @@ -182,29 +293,31 @@ void Animation::TranslationChannel::apply(Asset& asset, Sampler& sampler, F32 ti Node& node = asset.mNodes[mTarget.mNode]; - sampler.getFrameInfo(asset, time, frameIndex, t); - - if (sampler.mFrameTimes.size() == 1) + if (sampler.mFrameTimes.size() < 2) { node.setTranslation(mTranslations[0]); } else { + sampler.getFrameInfo(asset, time, frameIndex, t); + // interpolate - const glh::vec3f& v0 = mTranslations[frameIndex]; - const glh::vec3f& v1 = mTranslations[frameIndex + 1]; + const vec3& v0 = mTranslations[frameIndex]; + const vec3& v1 = mTranslations[frameIndex + 1]; - glh::vec3f vf = v0 + t * (v1 - v0); + vec3 vf = v0 + t * (v1 - v0); node.setTranslation(vf); } } -void Animation::ScaleChannel::allocateGLResources(Asset& asset, Animation::Sampler& sampler) +bool Animation::ScaleChannel::prep(Asset& asset, Animation::Sampler& sampler) { Accessor& accessor = asset.mAccessors[sampler.mOutput]; copy(asset, accessor, mScales); + + return true; } void Animation::ScaleChannel::apply(Asset& asset, Sampler& sampler, F32 time) @@ -214,74 +327,163 @@ void Animation::ScaleChannel::apply(Asset& asset, Sampler& sampler, F32 time) Node& node = asset.mNodes[mTarget.mNode]; - sampler.getFrameInfo(asset, time, frameIndex, t); - - if (sampler.mFrameTimes.size() == 1) + if (sampler.mFrameTimes.size() < 2) { node.setScale(mScales[0]); } else { + sampler.getFrameInfo(asset, time, frameIndex, t); + // interpolate - const glh::vec3f& v0 = mScales[frameIndex]; - const glh::vec3f& v1 = mScales[frameIndex + 1]; + const vec3& v0 = mScales[frameIndex]; + const vec3& v1 = mScales[frameIndex + 1]; - glh::vec3f vf = v0 + t * (v1 - v0); + vec3 vf = v0 + t * (v1 - v0); node.setScale(vf); } } -const Animation& Animation::operator=(const tinygltf::Animation& src) +void Animation::serialize(object& obj) const { - mName = src.name; + write(mName, "name", obj); + write(mSamplers, "samplers", obj); - mSamplers.resize(src.samplers.size()); - for (U32 i = 0; i < src.samplers.size(); ++i) - { - mSamplers[i] = src.samplers[i]; - } + std::vector<Channel> channels; + channels.insert(channels.end(), mRotationChannels.begin(), mRotationChannels.end()); + channels.insert(channels.end(), mTranslationChannels.begin(), mTranslationChannels.end()); + channels.insert(channels.end(), mScaleChannels.begin(), mScaleChannels.end()); - for (U32 i = 0; i < src.channels.size(); ++i) + write(channels, "channels", obj); +} + +const Animation& Animation::operator=(const Value& src) +{ + if (src.is_object()) { - if (src.channels[i].target_path == "rotation") - { - mRotationChannels.push_back(RotationChannel()); - mRotationChannels.back() = src.channels[i]; - } + const object& obj = src.as_object(); - if (src.channels[i].target_path == "translation") - { - mTranslationChannels.push_back(TranslationChannel()); - mTranslationChannels.back() = src.channels[i]; - } + copy(obj, "name", mName); + copy(obj, "samplers", mSamplers); + + // make a temporory copy of generic channels + std::vector<Channel> channels; + copy(obj, "channels", channels); - if (src.channels[i].target_path == "scale") + // break up into channel specific implementations + for (auto& channel: channels) { - mScaleChannels.push_back(ScaleChannel()); - mScaleChannels.back() = src.channels[i]; + if (channel.mTarget.mPath == "rotation") + { + mRotationChannels.push_back(channel); + } + else if (channel.mTarget.mPath == "translation") + { + mTranslationChannels.push_back(channel); + } + else if (channel.mTarget.mPath == "scale") + { + mScaleChannels.push_back(channel); + } } } - return *this; } -void Skin::allocateGLResources(Asset& asset) +Skin::~Skin() +{ + if (mUBO) + { + glDeleteBuffers(1, &mUBO); + } +} + +void Skin::uploadMatrixPalette(Asset& asset) +{ + // prepare matrix palette + LL_PROFILE_ZONE_SCOPED_CATEGORY_GLTF; + + U32 max_joints = LLSkinningUtil::getMaxGLTFJointCount(); + + if (mUBO == 0) + { + glGenBuffers(1, &mUBO); + } + + size_t joint_count = llmin<size_t>(max_joints, mJoints.size()); + + std::vector<mat4> t_mp; + + t_mp.resize(joint_count); + + for (U32 i = 0; i < joint_count; ++i) + { + Node& joint = asset.mNodes[mJoints[i]]; + // build matrix palette in asset space + t_mp[i] = joint.mAssetMatrix * mInverseBindMatricesData[i]; + } + + std::vector<F32> glmp; + + glmp.resize(joint_count * 12); + + F32* mp = glmp.data(); + + for (U32 i = 0; i < joint_count; ++i) + { + F32* m = glm::value_ptr(t_mp[i]); + + U32 idx = i * 12; + + mp[idx + 0] = m[0]; + mp[idx + 1] = m[1]; + mp[idx + 2] = m[2]; + mp[idx + 3] = m[12]; + + mp[idx + 4] = m[4]; + mp[idx + 5] = m[5]; + mp[idx + 6] = m[6]; + mp[idx + 7] = m[13]; + + mp[idx + 8] = m[8]; + mp[idx + 9] = m[9]; + mp[idx + 10] = m[10]; + mp[idx + 11] = m[14]; + } + + glBindBuffer(GL_UNIFORM_BUFFER, mUBO); + glBufferData(GL_UNIFORM_BUFFER, glmp.size() * sizeof(F32), glmp.data(), GL_STREAM_DRAW); + glBindBuffer(GL_UNIFORM_BUFFER, 0); +} + +bool Skin::prep(Asset& asset) { if (mInverseBindMatrices != INVALID_INDEX) { Accessor& accessor = asset.mAccessors[mInverseBindMatrices]; copy(asset, accessor, mInverseBindMatricesData); } + + return true; } -const Skin& Skin::operator=(const tinygltf::Skin& src) +const Skin& Skin::operator=(const Value& src) { - mName = src.name; - mSkeleton = src.skeleton; - mInverseBindMatrices = src.inverseBindMatrices; - mJoints = src.joints; - + if (src.is_object()) + { + copy(src, "name", mName); + copy(src, "skeleton", mSkeleton); + copy(src, "inverseBindMatrices", mInverseBindMatrices); + copy(src, "joints", mJoints); + } return *this; } +void Skin::serialize(object& obj) const +{ + write(mInverseBindMatrices, "inverseBindMatrices", obj, INVALID_INDEX); + write(mJoints, "joints", obj); + write(mName, "name", obj); + write(mSkeleton, "skeleton", obj, INVALID_INDEX); +} diff --git a/indra/newview/gltf/animation.h b/indra/newview/gltf/animation.h index 869eae963a..ab8839470a 100644 --- a/indra/newview/gltf/animation.h +++ b/indra/newview/gltf/animation.h @@ -27,7 +27,6 @@ */ #include "accessor.h" - // LL GLTF Implementation namespace LL { @@ -50,16 +49,13 @@ namespace LL S32 mOutput = INVALID_INDEX; std::string mInterpolation; - void allocateGLResources(Asset& asset); + F32 mLastFrameTime = 0.f; + U32 mLastFrameIndex = 0; - const Sampler& operator=(const tinygltf::AnimationSampler& src) - { - mInput = src.input; - mOutput = src.output; - mInterpolation = src.interpolation; + bool prep(Asset& asset); - return *this; - } + void serialize(boost::json::object& dst) const; + const Sampler& operator=(const Value& value); // get the frame index and time for the specified time // asset -- the asset to reference for Accessors @@ -77,40 +73,33 @@ namespace LL public: S32 mNode = INVALID_INDEX; std::string mPath; + + bool operator==(const Target& other) const; + bool operator!=(const Target& other) const; + + void serialize(boost::json::object& dst) const; + const Target& operator=(const Value& value); }; S32 mSampler = INVALID_INDEX; Target mTarget; - std::string mTargetPath; - std::string mName; - - const Channel& operator=(const tinygltf::AnimationChannel& src) - { - mSampler = src.sampler; - - mTarget.mNode = src.target_node; - mTarget.mPath = src.target_path; - - return *this; - } + void serialize(boost::json::object& dst) const; + const Channel& operator=(const Value& value); }; class RotationChannel : public Channel { public: - std::vector<glh::quaternionf> mRotations; + RotationChannel() = default; + RotationChannel(const Channel& channel) : Channel(channel) {} - const RotationChannel& operator=(const tinygltf::AnimationChannel& src) - { - Channel::operator=(src); - return *this; - } + std::vector<quat> mRotations; // prepare data needed for rendering // asset -- asset to reference for Accessors // sampler -- Sampler associated with this channel - void allocateGLResources(Asset& asset, Sampler& sampler); + bool prep(Asset& asset, Sampler& sampler); void apply(Asset& asset, Sampler& sampler, F32 time); }; @@ -118,18 +107,15 @@ namespace LL class TranslationChannel : public Channel { public: - std::vector<glh::vec3f> mTranslations; + TranslationChannel() = default; + TranslationChannel(const Channel& channel) : Channel(channel) {} - const TranslationChannel& operator=(const tinygltf::AnimationChannel& src) - { - Channel::operator=(src); - return *this; - } + std::vector<vec3> mTranslations; // prepare data needed for rendering // asset -- asset to reference for Accessors // sampler -- Sampler associated with this channel - void allocateGLResources(Asset& asset, Sampler& sampler); + bool prep(Asset& asset, Sampler& sampler); void apply(Asset& asset, Sampler& sampler, F32 time); }; @@ -137,18 +123,15 @@ namespace LL class ScaleChannel : public Channel { public: - std::vector<glh::vec3f> mScales; + ScaleChannel() = default; + ScaleChannel(const Channel& channel) : Channel(channel) {} - const ScaleChannel& operator=(const tinygltf::AnimationChannel& src) - { - Channel::operator=(src); - return *this; - } + std::vector<vec3> mScales; // prepare data needed for rendering // asset -- asset to reference for Accessors // sampler -- Sampler associated with this channel - void allocateGLResources(Asset& asset, Sampler& sampler); + bool prep(Asset& asset, Sampler& sampler); void apply(Asset& asset, Sampler& sampler, F32 time); }; @@ -159,7 +142,7 @@ namespace LL // min/max time values for all samplers combined F32 mMinTime = 0.f; F32 mMaxTime = 0.f; - + // current time of the animation F32 mTime = 0.f; @@ -167,9 +150,10 @@ namespace LL std::vector<TranslationChannel> mTranslationChannels; std::vector<ScaleChannel> mScaleChannels; - const Animation& operator=(const tinygltf::Animation& src); - - void allocateGLResources(Asset& asset); + void serialize(boost::json::object& dst) const; + const Animation& operator=(const Value& value); + + bool prep(Asset& asset); void update(Asset& asset, float dt); diff --git a/indra/newview/gltf/asset.cpp b/indra/newview/gltf/asset.cpp index 313e82bf01..a454e68a92 100644 --- a/indra/newview/gltf/asset.cpp +++ b/indra/newview/gltf/asset.cpp @@ -30,48 +30,81 @@ #include "llvolumeoctree.h" #include "../llviewershadermgr.h" #include "../llviewercontrol.h" +#include "../llviewertexturelist.h" +#include "../pipeline.h" +#include "buffer_util.h" +#include <boost/url.hpp> +#include "llimagejpeg.h" +#include "../llskinningutil.h" using namespace LL::GLTF; +using namespace boost::json; -void Scene::updateTransforms(Asset& asset) + +namespace LL { - LLMatrix4a identity; - identity.setIdentity(); - for (auto& nodeIndex : mNodes) + namespace GLTF { - Node& node = asset.mNodes[nodeIndex]; - node.updateTransforms(asset, identity); + static std::unordered_set<std::string> ExtensionsSupported = { + "KHR_materials_unlit", + "KHR_texture_transform" + }; + + Material::AlphaMode gltf_alpha_mode_to_enum(const std::string& alpha_mode) + { + if (alpha_mode == "OPAQUE") + { + return Material::AlphaMode::OPAQUE; + } + else if (alpha_mode == "MASK") + { + return Material::AlphaMode::MASK; + } + else if (alpha_mode == "BLEND") + { + return Material::AlphaMode::BLEND; + } + else + { + return Material::AlphaMode::OPAQUE; + } + } + + std::string enum_to_gltf_alpha_mode(Material::AlphaMode alpha_mode) + { + switch (alpha_mode) + { + case Material::AlphaMode::OPAQUE: + return "OPAQUE"; + case Material::AlphaMode::MASK: + return "MASK"; + case Material::AlphaMode::BLEND: + return "BLEND"; + default: + return "OPAQUE"; + } + } } } -void Scene::updateRenderTransforms(Asset& asset, const LLMatrix4a& modelview) +void Scene::updateTransforms(Asset& asset) { + mat4 identity = glm::identity<mat4>(); + for (auto& nodeIndex : mNodes) { Node& node = asset.mNodes[nodeIndex]; - node.updateRenderTransforms(asset, modelview); + node.updateTransforms(asset, identity); } } -void Node::updateRenderTransforms(Asset& asset, const LLMatrix4a& modelview) +void Node::updateTransforms(Asset& asset, const mat4& parentMatrix) { - matMul(mMatrix, modelview, mRenderMatrix); - - for (auto& childIndex : mChildren) - { - Node& child = asset.mNodes[childIndex]; - child.updateRenderTransforms(asset, mRenderMatrix); - } -} + makeMatrixValid(); + mAssetMatrix = parentMatrix * mMatrix; -LLMatrix4a inverse(const LLMatrix4a& mat); + mAssetMatrixInv = glm::inverse(mAssetMatrix); -void Node::updateTransforms(Asset& asset, const LLMatrix4a& parentMatrix) -{ - makeMatrixValid(); - matMul(mMatrix, parentMatrix, mAssetMatrix); - mAssetMatrixInv = inverse(mAssetMatrix); - S32 my_index = this - &asset.mNodes[0]; for (auto& childIndex : mChildren) @@ -84,32 +117,119 @@ void Node::updateTransforms(Asset& asset, const LLMatrix4a& parentMatrix) void Asset::updateTransforms() { + LL_PROFILE_ZONE_SCOPED_CATEGORY_GLTF; for (auto& scene : mScenes) { scene.updateTransforms(*this); } + + uploadTransforms(); } -void Asset::updateRenderTransforms(const LLMatrix4a& modelview) +void Asset::uploadTransforms() { -#if 0 - // traverse hierarchy and update render transforms from scratch - for (auto& scene : mScenes) + LL_PROFILE_ZONE_SCOPED_CATEGORY_GLTF; + // prepare matrix palette + U32 max_nodes = LLSkinningUtil::getMaxGLTFJointCount(); + + size_t node_count = llmin<size_t>(max_nodes, mNodes.size()); + + std::vector<mat4> t_mp; + + t_mp.resize(node_count); + + for (U32 i = 0; i < node_count; ++i) { - scene.updateRenderTransforms(*this, modelview); + Node& node = mNodes[i]; + // build matrix palette in asset space + t_mp[i] = node.mAssetMatrix; } -#else - // use mAssetMatrix to update render transforms from node list - for (auto& node : mNodes) + + std::vector<F32> glmp; + + glmp.resize(node_count * 12); + + F32* mp = glmp.data(); + + for (U32 i = 0; i < node_count; ++i) { - //if (node.mMesh != INVALID_INDEX) - { - matMul(node.mAssetMatrix, modelview, node.mRenderMatrix); - } + F32* m = glm::value_ptr(t_mp[i]); + + U32 idx = i * 12; + + mp[idx + 0] = m[0]; + mp[idx + 1] = m[1]; + mp[idx + 2] = m[2]; + mp[idx + 3] = m[12]; + + mp[idx + 4] = m[4]; + mp[idx + 5] = m[5]; + mp[idx + 6] = m[6]; + mp[idx + 7] = m[13]; + + mp[idx + 8] = m[8]; + mp[idx + 9] = m[9]; + mp[idx + 10] = m[10]; + mp[idx + 11] = m[14]; } -#endif + if (mNodesUBO == 0) + { + glGenBuffers(1, &mNodesUBO); + } + glBindBuffer(GL_UNIFORM_BUFFER, mNodesUBO); + glBufferData(GL_UNIFORM_BUFFER, glmp.size() * sizeof(F32), glmp.data(), GL_STREAM_DRAW); + glBindBuffer(GL_UNIFORM_BUFFER, 0); +} + +void Asset::uploadMaterials() +{ + LL_PROFILE_ZONE_SCOPED_CATEGORY_GLTF; + // see pbrmetallicroughnessV.glsl for the layout of the material UBO + std::vector<vec4> md; + + U32 material_size = sizeof(vec4) * 12; + U32 max_materials = gGLManager.mMaxUniformBlockSize / material_size; + + U32 mat_count = (U32)mMaterials.size(); + mat_count = llmin(mat_count, max_materials); + + md.resize(mat_count * 12); + + for (U32 i = 0; i < mat_count*12; i += 12) + { + Material& material = mMaterials[i/12]; + + // add texture transforms and UV indices + material.mPbrMetallicRoughness.mBaseColorTexture.mTextureTransform.getPacked(&md[i+0]); + md[i + 1].g = (F32)material.mPbrMetallicRoughness.mBaseColorTexture.getTexCoord(); + material.mNormalTexture.mTextureTransform.getPacked(&md[i + 2]); + md[i + 3].g = (F32)material.mNormalTexture.getTexCoord(); + material.mPbrMetallicRoughness.mMetallicRoughnessTexture.mTextureTransform.getPacked(&md[i+4]); + md[i + 5].g = (F32)material.mPbrMetallicRoughness.mMetallicRoughnessTexture.getTexCoord(); + material.mEmissiveTexture.mTextureTransform.getPacked(&md[i + 6]); + md[i + 7].g = (F32)material.mEmissiveTexture.getTexCoord(); + material.mOcclusionTexture.mTextureTransform.getPacked(&md[i + 8]); + md[i + 9].g = (F32)material.mOcclusionTexture.getTexCoord(); + + // add material properties + F32 min_alpha = material.mAlphaMode == Material::AlphaMode::MASK ? material.mAlphaCutoff : -1.0f; + md[i + 10] = vec4(material.mEmissiveFactor, 1.f); + md[i + 11] = vec4(0.f, + material.mPbrMetallicRoughness.mRoughnessFactor, + material.mPbrMetallicRoughness.mMetallicFactor, + min_alpha); + } + + if (mMaterialsUBO == 0) + { + glGenBuffers(1, &mMaterialsUBO); + } + + glBindBuffer(GL_UNIFORM_BUFFER, mMaterialsUBO); + glBufferData(GL_UNIFORM_BUFFER, md.size() * sizeof(vec4), md.data(), GL_STREAM_DRAW); + glBindBuffer(GL_UNIFORM_BUFFER, 0); } S32 Asset::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, @@ -133,12 +253,13 @@ S32 Asset::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, { if (node.mMesh != INVALID_INDEX) { - bool newHit = false; + LLMatrix4a ami; + ami.loadu(glm::value_ptr(node.mAssetMatrixInv)); // transform start and end to this node's local space - node.mAssetMatrixInv.affineTransform(start, local_start); - node.mAssetMatrixInv.affineTransform(asset_end, local_end); + ami.affineTransform(start, local_start); + ami.affineTransform(asset_end, local_end); Mesh& mesh = mMeshes[node.mMesh]; for (auto& primitive : mesh.mPrimitives) @@ -161,8 +282,10 @@ S32 Asset::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, if (newHit) { + LLMatrix4a am; + am.loadu(glm::value_ptr(node.mAssetMatrix)); // shorten line segment on hit - node.mAssetMatrix.affineTransform(p, asset_end); + am.affineTransform(p, asset_end); // transform results back to asset space if (intersection) @@ -172,12 +295,10 @@ S32 Asset::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, if (normal || tangent) { - LLMatrix4 normalMatrix(node.mAssetMatrixInv.getF32ptr()); - - normalMatrix.transpose(); + mat4 normalMatrix = glm::transpose(node.mAssetMatrixInv); LLMatrix4a norm_mat; - norm_mat.loadu((F32*)normalMatrix.mMatrix); + norm_mat.loadu(glm::value_ptr(normalMatrix)); if (normal) { @@ -219,446 +340,1066 @@ void Node::makeMatrixValid() { if (!mMatrixValid && mTRSValid) { - glh::matrix4f rot; - mRotation.get_value(rot); - - glh::matrix4f trans; - trans.set_translate(mTranslation); - - glh::matrix4f sc; - sc.set_scale(mScale); - - glh::matrix4f t; - //t = sc * rot * trans; - //t = trans * rot * sc; // best so far, still wrong on negative scale - //t = sc * trans * rot; - t = trans * sc * rot; - - mMatrix.loadu(t.m); + mMatrix = glm::recompose(mScale, mRotation, mTranslation, vec3(0,0,0), vec4(0,0,0,1)); mMatrixValid = true; } + + llassert(mMatrixValid); } void Node::makeTRSValid() { if (!mTRSValid && mMatrixValid) { - glh::matrix4f t(mMatrix.getF32ptr()); - - glh::vec4f p = t.get_column(3); - mTranslation.set_value(p.v[0], p.v[1], p.v[2]); + vec3 skew; + vec4 perspective; + glm::decompose(mMatrix, mScale, mRotation, mTranslation, skew, perspective); - mScale.set_value(t.get_column(0).length(), t.get_column(1).length(), t.get_column(2).length()); - mRotation.set_value(t); mTRSValid = true; } + + llassert(mTRSValid); } -void Node::setRotation(const glh::quaternionf& q) +void Node::setRotation(const quat& q) { makeTRSValid(); mRotation = q; mMatrixValid = false; } -void Node::setTranslation(const glh::vec3f& t) +void Node::setTranslation(const vec3& t) { makeTRSValid(); mTranslation = t; mMatrixValid = false; } -void Node::setScale(const glh::vec3f& s) +void Node::setScale(const vec3& s) { makeTRSValid(); mScale = s; mMatrixValid = false; } -const Node& Node::operator=(const tinygltf::Node& src) +void Node::serialize(object& dst) const { - F32* dstMatrix = mMatrix.getF32ptr(); + write(mName, "name", dst); + write(mMatrix, "matrix", dst, glm::identity<mat4>()); + write(mRotation, "rotation", dst, glm::identity<quat>()); + write(mTranslation, "translation", dst, glm::vec3(0.f, 0.f, 0.f)); + write(mScale, "scale", dst, vec3(1.f,1.f,1.f)); + write(mChildren, "children", dst); + write(mMesh, "mesh", dst, INVALID_INDEX); + write(mSkin, "skin", dst, INVALID_INDEX); +} - if (src.matrix.size() == 16) +const Node& Node::operator=(const Value& src) +{ + copy(src, "name", mName); + mMatrixValid = copy(src, "matrix", mMatrix); + copy(src, "rotation", mRotation); + copy(src, "translation", mTranslation); + copy(src, "scale", mScale); + copy(src, "children", mChildren); + copy(src, "mesh", mMesh); + copy(src, "skin", mSkin); + + if (!mMatrixValid) { - // Node has a transformation matrix, just copy it - for (U32 i = 0; i < 16; ++i) + mTRSValid = true; + } + + return *this; +} + +void Image::serialize(object& dst) const +{ + write(mUri, "uri", dst); + write(mMimeType, "mimeType", dst); + write(mBufferView, "bufferView", dst, INVALID_INDEX); + write(mName, "name", dst); + write(mWidth, "width", dst, -1); + write(mHeight, "height", dst, -1); + write(mComponent, "component", dst, -1); + write(mBits, "bits", dst, -1); + write(mPixelType, "pixelType", dst, -1); +} + +const Image& Image::operator=(const Value& src) +{ + copy(src, "uri", mUri); + copy(src, "mimeType", mMimeType); + copy(src, "bufferView", mBufferView); + copy(src, "name", mName); + copy(src, "width", mWidth); + copy(src, "height", mHeight); + copy(src, "component", mComponent); + copy(src, "bits", mBits); + copy(src, "pixelType", mPixelType); + + return *this; +} + +void Asset::update() +{ + LL_PROFILE_ZONE_SCOPED_CATEGORY_GLTF; + F32 dt = gFrameTimeSeconds - mLastUpdateTime; + + if (dt > 0.f) + { + mLastUpdateTime = gFrameTimeSeconds; + if (mAnimations.size() > 0) { - dstMatrix[i] = (F32)src.matrix[i]; + static LLCachedControl<U32> anim_idx(gSavedSettings, "GLTFAnimationIndex", 0); + static LLCachedControl<F32> anim_speed(gSavedSettings, "GLTFAnimationSpeed", 1.f); + + U32 idx = llclamp(anim_idx(), 0U, mAnimations.size() - 1); + mAnimations[idx].update(*this, dt*anim_speed); } - mMatrixValid = true; + updateTransforms(); + + for (auto& skin : mSkins) + { + skin.uploadMatrixPalette(*this); + } + + uploadMaterials(); + + { + LL_PROFILE_ZONE_NAMED_CATEGORY_GLTF("gltf - addTextureStats"); + + for (auto& image : mImages) + { + if (image.mTexture.notNull()) + { // HACK - force texture to be loaded full rez + // TODO: calculate actual vsize + image.mTexture->addTextureStats(2048.f * 2048.f); + } + } + } } - else if (!src.rotation.empty() || !src.translation.empty() || !src.scale.empty()) +} + +bool Asset::prep() +{ + LL_PROFILE_ZONE_SCOPED_CATEGORY_GLTF; + // check required extensions and fail if not supported + bool unsupported = false; + for (auto& extension : mExtensionsRequired) { - // node has rotation/translation/scale, convert to matrix - if (src.rotation.size() == 4) + if (ExtensionsSupported.find(extension) == ExtensionsSupported.end()) { - mRotation = glh::quaternionf((F32)src.rotation[0], (F32)src.rotation[1], (F32)src.rotation[2], (F32)src.rotation[3]); + LL_WARNS() << "Unsupported extension: " << extension << LL_ENDL; + unsupported = true; } + } + + if (unsupported) + { + return false; + } - if (src.translation.size() == 3) + // do buffers first as other resources depend on them + for (auto& buffer : mBuffers) + { + if (!buffer.prep(*this)) { - mTranslation = glh::vec3f((F32)src.translation[0], (F32)src.translation[1], (F32)src.translation[2]); + return false; } + } - glh::vec3f scale; - if (src.scale.size() == 3) + for (auto& image : mImages) + { + if (!image.prep(*this)) { - mScale = glh::vec3f((F32)src.scale[0], (F32)src.scale[1], (F32)src.scale[2]); + return false; } - else + } + + for (auto& mesh : mMeshes) + { + if (!mesh.prep(*this)) { - mScale.set_value(1.f, 1.f, 1.f); + return false; } + } - mTRSValid = true; + for (auto& animation : mAnimations) + { + if (!animation.prep(*this)) + { + return false; + } } - else + + for (auto& skin : mSkins) { - // node specifies no transformation, set to identity - mMatrix.setIdentity(); + if (!skin.prep(*this)) + { + return false; + } } - mChildren = src.children; - mMesh = src.mesh; - mSkin = src.skin; - mName = src.name; + // prepare vertex buffers - return *this; -} + // material count is number of materials + 1 for default material + U32 mat_count = (U32) mMaterials.size() + 1; -void Asset::render(bool opaque, bool rigged) -{ - if (rigged) - { - gGL.loadIdentity(); + if (LLGLSLShader::sCurBoundShaderPtr == nullptr) + { // make sure a shader is bound to satisfy mVertexBuffer->setBuffer + gDebugProgram.bind(); } - for (auto& node : mNodes) + for (S32 double_sided = 0; double_sided < 2; ++double_sided) { - if (node.mSkin != INVALID_INDEX) + RenderData& rd = mRenderData[double_sided]; + for (U32 i = 0; i < LLGLSLShader::NUM_GLTF_VARIANTS; ++i) { - if (rigged) - { - Skin& skin = mSkins[node.mSkin]; - skin.uploadMatrixPalette(*this, node); - } - else - { - //skip static nodes if we're rendering rigged - continue; - } + rd.mBatches[i].resize(mat_count); } - else if (rigged) + + // for each material + for (S32 mat_id = -1; mat_id < (S32)mMaterials.size(); ++mat_id) { - // skip rigged nodes if we're not rendering rigged - continue; - } + // for each shader variant + U32 vertex_count[LLGLSLShader::NUM_GLTF_VARIANTS] = { 0 }; + U32 index_count[LLGLSLShader::NUM_GLTF_VARIANTS] = { 0 }; + S32 ds_mat = mat_id == -1 ? 0 : mMaterials[mat_id].mDoubleSided; + if (ds_mat != double_sided) + { + continue; + } - if (node.mMesh != INVALID_INDEX) - { - Mesh& mesh = mMeshes[node.mMesh]; - for (auto& primitive : mesh.mPrimitives) + for (U32 variant = 0; variant < LLGLSLShader::NUM_GLTF_VARIANTS; ++variant) { - if (!rigged) - { - gGL.loadMatrix((F32*)node.mRenderMatrix.mMatrix); - } - bool cull = true; - if (primitive.mMaterial != INVALID_INDEX) + U32 attribute_mask = 0; + // for each mesh + for (auto& mesh : mMeshes) { - Material& material = mMaterials[primitive.mMaterial]; - - if ((material.mMaterial->mAlphaMode == LLGLTFMaterial::ALPHA_MODE_BLEND) == opaque) + // for each primitive + for (auto& primitive : mesh.mPrimitives) { - continue; + if (primitive.mMaterial == mat_id && primitive.mShaderVariant == variant) + { + // accumulate vertex and index counts + primitive.mVertexOffset = vertex_count[variant]; + primitive.mIndexOffset = index_count[variant]; + + vertex_count[variant] += primitive.getVertexCount(); + index_count[variant] += primitive.getIndexCount(); + + // all primitives of a given variant and material should all have the same attribute mask + llassert(attribute_mask == 0 || primitive.mAttributeMask == attribute_mask); + attribute_mask |= primitive.mAttributeMask; + } } - material.mMaterial->bind(); - cull = !material.mMaterial->mDoubleSided; } - else + + // allocate vertex buffer and pack it + if (vertex_count[variant] > 0) { - if (!opaque) + U32 mat_idx = mat_id + 1; + LLVertexBuffer* vb = new LLVertexBuffer(attribute_mask); + + rd.mBatches[variant][mat_idx].mVertexBuffer = vb; + vb->allocateBuffer(vertex_count[variant], + index_count[variant] * 2); // hack double index count... TODO: find a better way to indicate 32-bit indices will be used + vb->setBuffer(); + + for (auto& mesh : mMeshes) { - continue; + for (auto& primitive : mesh.mPrimitives) + { + if (primitive.mMaterial == mat_id && primitive.mShaderVariant == variant) + { + primitive.upload(vb); + } + } } - LLFetchedGLTFMaterial::sDefault.bind(); - } - LLGLDisable cull_face(!cull ? GL_CULL_FACE : 0); + vb->unmapBuffer(); - primitive.mVertexBuffer->setBuffer(); - if (primitive.mVertexBuffer->getNumIndices() > 0) - { - primitive.mVertexBuffer->draw(primitive.mGLMode, primitive.mVertexBuffer->getNumIndices(), 0); - } - else - { - primitive.mVertexBuffer->drawArrays(primitive.mGLMode, 0, primitive.mVertexBuffer->getNumVerts()); + vb->unbind(); } + } + } + } + + // sanity check that all primitives have a vertex buffer + for (auto& mesh : mMeshes) + { + for (auto& primitive : mesh.mPrimitives) + { + llassert(primitive.mVertexBuffer.notNull()); + } + } + // build render batches + for (S32 node_id = 0; node_id < mNodes.size(); ++node_id) + { + Node& node = mNodes[node_id]; + + if (node.mMesh != INVALID_INDEX) + { + auto& mesh = mMeshes[node.mMesh]; + + S32 mat_idx = mesh.mPrimitives[0].mMaterial + 1; + + S32 double_sided = mat_idx == 0 ? 0 : mMaterials[mat_idx - 1].mDoubleSided; + + for (S32 j = 0; j < mesh.mPrimitives.size(); ++j) + { + auto& primitive = mesh.mPrimitives[j]; + + S32 variant = primitive.mShaderVariant; + + RenderData& rd = mRenderData[double_sided]; + RenderBatch& rb = rd.mBatches[variant][mat_idx]; + + rb.mPrimitives.push_back({ j, node_id }); } } } + return true; } -void Asset::renderOpaque() +Asset::Asset(const Value& src) { - render(true); + *this = src; } -void Asset::renderTransparent() +bool Asset::load(std::string_view filename) { - render(false); + LL_PROFILE_ZONE_SCOPED_CATEGORY_GLTF; + mFilename = filename; + std::string ext = gDirUtilp->getExtension(mFilename); + + std::ifstream file(filename.data(), std::ios::binary); + if (file.is_open()) + { + std::string str((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>()); + file.close(); + + if (ext == "gltf") + { + Value val = parse(str); + *this = val; + return prep(); + } + else if (ext == "glb") + { + return loadBinary(str); + } + else + { + LL_WARNS() << "Unsupported file type: " << ext << LL_ENDL; + return false; + } + } + else + { + LL_WARNS() << "Failed to open file: " << filename << LL_ENDL; + return false; + } + + return false; } -void Asset::update() +bool Asset::loadBinary(const std::string& data) { - F32 dt = gFrameTimeSeconds - mLastUpdateTime; + // load from binary gltf + const U8* ptr = (const U8*)data.data(); + const U8* end = ptr + data.size(); - if (dt > 0.f) + if (end - ptr < 12) { - mLastUpdateTime = gFrameTimeSeconds; - if (mAnimations.size() > 0) - { - static LLCachedControl<U32> anim_idx(gSavedSettings, "GLTFAnimationIndex", 0); - static LLCachedControl<F32> anim_speed(gSavedSettings, "GLTFAnimationSpeed", 1.f); + LL_WARNS("GLTF") << "GLB file too short" << LL_ENDL; + return false; + } - U32 idx = llclamp(anim_idx(), 0U, mAnimations.size() - 1); - mAnimations[idx].update(*this, dt*anim_speed); - } + U32 magic = *(U32*)ptr; + ptr += 4; - updateTransforms(); + if (magic != 0x46546C67) + { + LL_WARNS("GLTF") << "Invalid GLB magic" << LL_ENDL; + return false; } -} -void Asset::allocateGLResources(const std::string& filename, const tinygltf::Model& model) -{ - // do images first as materials may depend on images - for (auto& image : mImages) + U32 version = *(U32*)ptr; + ptr += 4; + + if (version != 2) { - image.allocateGLResources(); + LL_WARNS("GLTF") << "Unsupported GLB version" << LL_ENDL; + return false; } - // do materials before meshes as meshes may depend on materials - for (U32 i = 0; i < mMaterials.size(); ++i) + U32 length = *(U32*)ptr; + ptr += 4; + + if (length != data.size()) { - mMaterials[i].allocateGLResources(*this); - LLTinyGLTFHelper::getMaterialFromModel(filename, model, i, mMaterials[i].mMaterial, mMaterials[i].mName, true); + LL_WARNS("GLTF") << "GLB length mismatch" << LL_ENDL; + return false; } - for (auto& mesh : mMeshes) + U32 chunkLength = *(U32*)ptr; + ptr += 4; + + if (end - ptr < chunkLength + 8) { - mesh.allocateGLResources(*this); + LL_WARNS("GLTF") << "GLB chunk too short" << LL_ENDL; + return false; } - for (auto& animation : mAnimations) + U32 chunkType = *(U32*)ptr; + ptr += 4; + + if (chunkType != 0x4E4F534A) { - animation.allocateGLResources(*this); + LL_WARNS("GLTF") << "Invalid GLB chunk type" << LL_ENDL; + return false; } - for (auto& skin : mSkins) + Value val = parse(std::string_view((const char*)ptr, chunkLength)); + *this = val; + + if (mBuffers.size() > 0 && mBuffers[0].mUri.empty()) { - skin.allocateGLResources(*this); + // load binary chunk + ptr += chunkLength; + + if (end - ptr < 8) + { + LL_WARNS("GLTF") << "GLB chunk too short" << LL_ENDL; + return false; + } + + chunkLength = *(U32*)ptr; + ptr += 4; + + chunkType = *(U32*)ptr; + ptr += 4; + + if (chunkType != 0x004E4942) + { + LL_WARNS("GLTF") << "Invalid GLB chunk type" << LL_ENDL; + return false; + } + + auto& buffer = mBuffers[0]; + + if (ptr + buffer.mByteLength <= end) + { + buffer.mData.resize(buffer.mByteLength); + memcpy(buffer.mData.data(), ptr, buffer.mByteLength); + ptr += buffer.mByteLength; + } + else + { + LL_WARNS("GLTF") << "Buffer too short" << LL_ENDL; + return false; + } } + + return prep(); } -const Asset& Asset::operator=(const tinygltf::Model& src) +const Asset& Asset::operator=(const Value& src) { - mScenes.resize(src.scenes.size()); - for (U32 i = 0; i < src.scenes.size(); ++i) + if (src.is_object()) { - mScenes[i] = src.scenes[i]; + const object& obj = src.as_object(); + + const auto it = obj.find("asset"); + + if (it != obj.end()) + { + const Value& asset = it->value(); + + copy(asset, "version", mVersion); + copy(asset, "minVersion", mMinVersion); + copy(asset, "generator", mGenerator); + copy(asset, "copyright", mCopyright); + copy(asset, "extras", mExtras); + } + + copy(obj, "scene", mScene); + copy(obj, "scenes", mScenes); + copy(obj, "nodes", mNodes); + copy(obj, "meshes", mMeshes); + copy(obj, "materials", mMaterials); + copy(obj, "buffers", mBuffers); + copy(obj, "bufferViews", mBufferViews); + copy(obj, "textures", mTextures); + copy(obj, "samplers", mSamplers); + copy(obj, "images", mImages); + copy(obj, "accessors", mAccessors); + copy(obj, "animations", mAnimations); + copy(obj, "skins", mSkins); + copy(obj, "extensionsUsed", mExtensionsUsed); + copy(obj, "extensionsRequired", mExtensionsRequired); } - mNodes.resize(src.nodes.size()); - for (U32 i = 0; i < src.nodes.size(); ++i) + return *this; +} + +void Asset::serialize(object& dst) const +{ + static const std::string sGenerator = "Linden Lab GLTF Prototype v0.1"; + + dst["asset"] = object{}; + object& asset = dst["asset"].get_object(); + + write(mVersion, "version", asset); + write(mMinVersion, "minVersion", asset, std::string()); + write(sGenerator, "generator", asset); + write(mScene, "scene", dst, INVALID_INDEX); + write(mScenes, "scenes", dst); + write(mNodes, "nodes", dst); + write(mMeshes, "meshes", dst); + write(mMaterials, "materials", dst); + write(mBuffers, "buffers", dst); + write(mBufferViews, "bufferViews", dst); + write(mTextures, "textures", dst); + write(mSamplers, "samplers", dst); + write(mImages, "images", dst); + write(mAccessors, "accessors", dst); + write(mAnimations, "animations", dst); + write(mSkins, "skins", dst); + write(mExtensionsUsed, "extensionsUsed", dst); + write(mExtensionsRequired, "extensionsRequired", dst); +} + +bool Asset::save(const std::string& filename) +{ + // get folder path + std::string folder = gDirUtilp->getDirName(filename); + + // save images + for (auto& image : mImages) { - mNodes[i] = src.nodes[i]; + if (!image.save(*this, folder)) + { + return false; + } } - mMeshes.resize(src.meshes.size()); - for (U32 i = 0; i < src.meshes.size(); ++i) + // save buffers + // NOTE: save buffers after saving images as saving images + // may remove image data from buffers + for (auto& buffer : mBuffers) { - mMeshes[i] = src.meshes[i]; + if (!buffer.save(*this, folder)) + { + return false; + } } - mMaterials.resize(src.materials.size()); - for (U32 i = 0; i < src.materials.size(); ++i) + // save .gltf + object obj; + serialize(obj); + std::string buffer = boost::json::serialize(obj, {}); + std::ofstream file(filename, std::ios::binary); + file.write(buffer.c_str(), buffer.size()); + + return true; +} + +void Asset::eraseBufferView(S32 bufferView) +{ + mBufferViews.erase(mBufferViews.begin() + bufferView); + + for (auto& accessor : mAccessors) { - mMaterials[i] = src.materials[i]; + if (accessor.mBufferView > bufferView) + { + accessor.mBufferView--; + } } - mBuffers.resize(src.buffers.size()); - for (U32 i = 0; i < src.buffers.size(); ++i) + for (auto& image : mImages) { - mBuffers[i] = src.buffers[i]; + if (image.mBufferView > bufferView) + { + image.mBufferView--; + } } - mBufferViews.resize(src.bufferViews.size()); - for (U32 i = 0; i < src.bufferViews.size(); ++i) +} + +LLViewerFetchedTexture* fetch_texture(const LLUUID& id); + +bool Image::prep(Asset& asset) +{ + LLUUID id; + if (mUri.size() == UUID_STR_SIZE && LLUUID::parseUUID(mUri, &id) && id.notNull()) + { // loaded from an asset, fetch the texture from the asset system + mTexture = fetch_texture(id); + } + else if (mUri.find("data:") == 0) + { // embedded in a data URI, load the texture from the URI + LL_WARNS() << "Data URIs not yet supported" << LL_ENDL; + return false; + } + else if (mBufferView != INVALID_INDEX) + { // embedded in a buffer, load the texture from the buffer + BufferView& bufferView = asset.mBufferViews[mBufferView]; + Buffer& buffer = asset.mBuffers[bufferView.mBuffer]; + + U8* data = buffer.mData.data() + bufferView.mByteOffset; + + mTexture = LLViewerTextureManager::getFetchedTextureFromMemory(data, bufferView.mByteLength, mMimeType); + + if (mTexture.isNull()) + { + LL_WARNS("GLTF") << "Failed to load image from buffer:" << LL_ENDL; + LL_WARNS("GLTF") << " image: " << mName << LL_ENDL; + LL_WARNS("GLTF") << " mimeType: " << mMimeType << LL_ENDL; + + return false; + } + } + else if (!asset.mFilename.empty() && !mUri.empty()) + { // loaded locally and not embedded, load the texture as a local preview + std::string dir = gDirUtilp->getDirName(asset.mFilename); + std::string img_file = dir + gDirUtilp->getDirDelimiter() + mUri; + + LLUUID tracking_id = LLLocalBitmapMgr::getInstance()->addUnit(img_file); + if (tracking_id.notNull()) + { + LLUUID world_id = LLLocalBitmapMgr::getInstance()->getWorldID(tracking_id); + mTexture = LLViewerTextureManager::getFetchedTexture(world_id); + } + else + { + LL_WARNS("GLTF") << "Failed to load image from file:" << LL_ENDL; + LL_WARNS("GLTF") << " image: " << mName << LL_ENDL; + LL_WARNS("GLTF") << " file: " << img_file << LL_ENDL; + + return false; + } + } + else { - mBufferViews[i] = src.bufferViews[i]; + LL_WARNS("GLTF") << "Failed to load image: " << mName << LL_ENDL; + return false; } - mTextures.resize(src.textures.size()); - for (U32 i = 0; i < src.textures.size(); ++i) + return true; +} + + +void Image::clearData(Asset& asset) +{ + if (mBufferView != INVALID_INDEX) { - mTextures[i] = src.textures[i]; + // remove data from buffer + BufferView& bufferView = asset.mBufferViews[mBufferView]; + Buffer& buffer = asset.mBuffers[bufferView.mBuffer]; + + buffer.erase(asset, bufferView.mByteOffset, bufferView.mByteLength); + + asset.eraseBufferView(mBufferView); } - mSamplers.resize(src.samplers.size()); - for (U32 i = 0; i < src.samplers.size(); ++i) + mBufferView = INVALID_INDEX; + mWidth = -1; + mHeight = -1; + mComponent = -1; + mBits = -1; + mPixelType = -1; + mMimeType = ""; +} + +bool Image::save(Asset& asset, const std::string& folder) +{ + // NOTE: this *MUST* be a lossless save + // Artists use this to save their work repeatedly, so + // adding any compression artifacts here will degrade + // images over time. + std::string name = mName; + std::string error; + const std::string& delim = gDirUtilp->getDirDelimiter(); + if (name.empty()) { - mSamplers[i] = src.samplers[i]; + S32 idx = this - asset.mImages.data(); + name = llformat("image_%d", idx); } - mImages.resize(src.images.size()); - for (U32 i = 0; i < src.images.size(); ++i) + if (mBufferView != INVALID_INDEX) { - mImages[i] = src.images[i]; + // we have the bytes of the original image, save that out in its + // original format + BufferView& bufferView = asset.mBufferViews[mBufferView]; + Buffer& buffer = asset.mBuffers[bufferView.mBuffer]; + + std::string extension; + + if (mMimeType == "image/jpeg") + { + extension = ".jpg"; + } + else if (mMimeType == "image/png") + { + extension = ".png"; + } + else + { + error = "Unknown mime type, saved as .bin"; + extension = ".bin"; + } + + std::string filename = folder + delim + name + extension; + + // set URI to non-j2c file for now, but later we'll want to reference the j2c hash + mUri = name + extension; + + std::ofstream file(filename, std::ios::binary); + file.write((const char*)buffer.mData.data() + bufferView.mByteOffset, bufferView.mByteLength); } + else if (mTexture.notNull()) + { + auto bitmapmgr = LLLocalBitmapMgr::getInstance(); + if (bitmapmgr->isLocal(mTexture->getID())) + { + LLUUID tracking_id = bitmapmgr->getTrackingID(mTexture->getID()); + if (tracking_id.notNull()) + { // copy original file to destination folder + std::string source = bitmapmgr->getFilename(tracking_id); + if (gDirUtilp->fileExists(source)) + { + std::string filename = gDirUtilp->getBaseFileName(source); + std::string dest = folder + delim + filename; - mAccessors.resize(src.accessors.size()); - for (U32 i = 0; i < src.accessors.size(); ++i) + LLFile::copy(source, dest); + mUri = filename; + } + else + { + error = "File not found: " + source; + } + } + else + { + error = "Local image missing."; + } + } + else if (!mUri.empty()) + { + std::string from_dir = gDirUtilp->getDirName(asset.mFilename); + std::string base_filename = gDirUtilp->getBaseFileName(mUri); + std::string filename = from_dir + delim + base_filename; + if (gDirUtilp->fileExists(filename)) + { + std::string dest = folder + delim + base_filename; + LLFile::copy(filename, dest); + mUri = base_filename; + } + else + { + error = "Original image file not found: " + filename; + } + } + else + { + error = "Image is not a local image and has no uri, cannot save."; + } + } + + if (!error.empty()) { - mAccessors[i] = src.accessors[i]; + LL_WARNS("GLTF") << "Failed to save " << name << ": " << error << LL_ENDL; + return false; } - mAnimations.resize(src.animations.size()); - for (U32 i = 0; i < src.animations.size(); ++i) + clearData(asset); + + return true; +} + +void TextureInfo::serialize(object& dst) const +{ + write(mIndex, "index", dst, INVALID_INDEX); + write(mTexCoord, "texCoord", dst, 0); + write_extensions(dst, &mTextureTransform, "KHR_texture_transform"); +} + +S32 TextureInfo::getTexCoord() const +{ + if (mTextureTransform.mPresent && mTextureTransform.mTexCoord != INVALID_INDEX) { - mAnimations[i] = src.animations[i]; + return mTextureTransform.mTexCoord; } + return mTexCoord; +} - mSkins.resize(src.skins.size()); - for (U32 i = 0; i < src.skins.size(); ++i) +bool Material::isMultiUV() const +{ + return mPbrMetallicRoughness.mBaseColorTexture.getTexCoord() != 0 || + mPbrMetallicRoughness.mMetallicRoughnessTexture.getTexCoord() != 0 || + mNormalTexture.getTexCoord() != 0 || + mOcclusionTexture.getTexCoord() != 0 || + mEmissiveTexture.getTexCoord() != 0; +} + +const TextureInfo& TextureInfo::operator=(const Value& src) +{ + if (src.is_object()) { - mSkins[i] = src.skins[i]; + copy(src, "index", mIndex); + copy(src, "texCoord", mTexCoord); + copy_extensions(src, "KHR_texture_transform", &mTextureTransform); } - + return *this; } -const Material& Material::operator=(const tinygltf::Material& src) +bool TextureInfo::operator==(const TextureInfo& rhs) const { - mName = src.name; - return *this; + return mIndex == rhs.mIndex && mTexCoord == rhs.mTexCoord; +} + +bool TextureInfo::operator!=(const TextureInfo& rhs) const +{ + return !(*this == rhs); } -void Material::allocateGLResources(Asset& asset) +void OcclusionTextureInfo::serialize(object& dst) const { - // allocate material - mMaterial = new LLFetchedGLTFMaterial(); + TextureInfo::serialize(dst); + write(mStrength, "strength", dst, 1.f); } -const Mesh& Mesh::operator=(const tinygltf::Mesh& src) +const OcclusionTextureInfo& OcclusionTextureInfo::operator=(const Value& src) { - mPrimitives.resize(src.primitives.size()); - for (U32 i = 0; i < src.primitives.size(); ++i) + TextureInfo::operator=(src); + + if (src.is_object()) { - mPrimitives[i] = src.primitives[i]; + copy(src, "strength", mStrength); } - mWeights = src.weights; - mName = src.name; - return *this; } -void Mesh::allocateGLResources(Asset& asset) +void NormalTextureInfo::serialize(object& dst) const { - for (auto& primitive : mPrimitives) + TextureInfo::serialize(dst); + write(mScale, "scale", dst, 1.f); +} + +const NormalTextureInfo& NormalTextureInfo::operator=(const Value& src) +{ + TextureInfo::operator=(src); + if (src.is_object()) { - primitive.allocateGLResources(asset); + copy(src, "index", mIndex); + copy(src, "texCoord", mTexCoord); + copy(src, "scale", mScale); } + + return *this; } -const Scene& Scene::operator=(const tinygltf::Scene& src) +const Material::PbrMetallicRoughness& Material::PbrMetallicRoughness::operator=(const Value& src) { - mNodes = src.nodes; - mName = src.name; + if (src.is_object()) + { + copy(src, "baseColorFactor", mBaseColorFactor); + copy(src, "baseColorTexture", mBaseColorTexture); + copy(src, "metallicFactor", mMetallicFactor); + copy(src, "roughnessFactor", mRoughnessFactor); + copy(src, "metallicRoughnessTexture", mMetallicRoughnessTexture); + } return *this; } -const Texture& Texture::operator=(const tinygltf::Texture& src) +void Material::PbrMetallicRoughness::serialize(object& dst) const { - mSampler = src.sampler; - mSource = src.source; - mName = src.name; + write(mBaseColorFactor, "baseColorFactor", dst, vec4(1.f, 1.f, 1.f, 1.f)); + write(mBaseColorTexture, "baseColorTexture", dst); + write(mMetallicFactor, "metallicFactor", dst, 1.f); + write(mRoughnessFactor, "roughnessFactor", dst, 1.f); + write(mMetallicRoughnessTexture, "metallicRoughnessTexture", dst); +} +bool Material::PbrMetallicRoughness::operator==(const Material::PbrMetallicRoughness& rhs) const +{ + return mBaseColorFactor == rhs.mBaseColorFactor && + mBaseColorTexture == rhs.mBaseColorTexture && + mMetallicFactor == rhs.mMetallicFactor && + mRoughnessFactor == rhs.mRoughnessFactor && + mMetallicRoughnessTexture == rhs.mMetallicRoughnessTexture; +} + +bool Material::PbrMetallicRoughness::operator!=(const Material::PbrMetallicRoughness& rhs) const +{ + return !(*this == rhs); +} + +const Material::Unlit& Material::Unlit::operator=(const Value& src) +{ + mPresent = true; return *this; } -const Sampler& Sampler::operator=(const tinygltf::Sampler& src) +void Material::Unlit::serialize(object& dst) const { - mMagFilter = src.magFilter; - mMinFilter = src.minFilter; - mWrapS = src.wrapS; - mWrapT = src.wrapT; - mName = src.name; + // no members and object has already been created, nothing to do +} + +void TextureTransform::getPacked(vec4* packed) const +{ + packed[0] = vec4(mScale.x, mScale.y, mRotation, mOffset.x); + packed[1] = vec4(mOffset.y, 0.f, 0.f, 0.f); +} + +const TextureTransform& TextureTransform::operator=(const Value& src) +{ + mPresent = true; + if (src.is_object()) + { + copy(src, "offset", mOffset); + copy(src, "rotation", mRotation); + copy(src, "scale", mScale); + copy(src, "texCoord", mTexCoord); + } return *this; } -void Skin::uploadMatrixPalette(Asset& asset, Node& node) +void TextureTransform::serialize(object& dst) const { - // prepare matrix palette + write(mOffset, "offset", dst, vec2(0.f, 0.f)); + write(mRotation, "rotation", dst, 0.f); + write(mScale, "scale", dst, vec2(1.f, 1.f)); + write(mTexCoord, "texCoord", dst, -1); +} - // modelview will be applied by the shader, so assume matrix palette is in asset space - std::vector<glh::matrix4f> t_mp; - t_mp.resize(mJoints.size()); +void Material::serialize(object& dst) const +{ + write(mName, "name", dst); + write(mEmissiveFactor, "emissiveFactor", dst, vec3(0.f, 0.f, 0.f)); + write(mPbrMetallicRoughness, "pbrMetallicRoughness", dst); + write(mNormalTexture, "normalTexture", dst); + write(mOcclusionTexture, "occlusionTexture", dst); + write(mEmissiveTexture, "emissiveTexture", dst); + write(mAlphaMode, "alphaMode", dst, Material::AlphaMode::OPAQUE); + write(mAlphaCutoff, "alphaCutoff", dst, 0.5f); + write(mDoubleSided, "doubleSided", dst, false); + write_extensions(dst, &mUnlit, "KHR_materials_unlit"); +} - for (U32 i = 0; i < mJoints.size(); ++i) +const Material& Material::operator=(const Value& src) +{ + if (src.is_object()) { - Node& joint = asset.mNodes[mJoints[i]]; - - //t_mp[i].set_value(joint.mRenderMatrix.getF32ptr()); - //t_mp[i] = t_mp[i] * mInverseBindMatricesData[i]; + copy(src, "name", mName); + copy(src, "emissiveFactor", mEmissiveFactor); + copy(src, "pbrMetallicRoughness", mPbrMetallicRoughness); + copy(src, "normalTexture", mNormalTexture); + copy(src, "occlusionTexture", mOcclusionTexture); + copy(src, "emissiveTexture", mEmissiveTexture); + copy(src, "alphaMode", mAlphaMode); + copy(src, "alphaCutoff", mAlphaCutoff); + copy(src, "doubleSided", mDoubleSided); + copy_extensions(src, + "KHR_materials_unlit", &mUnlit ); + } + return *this; +} - //t_mp[i].set_value(joint.mRenderMatrix.getF32ptr()); - //t_mp[i] = mInverseBindMatricesData[i] * t_mp[i]; - t_mp[i].set_value(joint.mRenderMatrix.getF32ptr()); - t_mp[i] = t_mp[i] * mInverseBindMatricesData[i]; +void Mesh::serialize(object& dst) const +{ + write(mPrimitives, "primitives", dst); + write(mWeights, "weights", dst); + write(mName, "name", dst); +} +const Mesh& Mesh::operator=(const Value& src) +{ + if (src.is_object()) + { + copy(src, "primitives", mPrimitives); + copy(src, "weights", mWeights); + copy(src, "name", mName); } - std::vector<F32> glmp; + return *this; +} - glmp.resize(mJoints.size() * 12); +bool Mesh::prep(Asset& asset) +{ + for (auto& primitive : mPrimitives) + { + if (!primitive.prep(asset)) + { + return false; + } + } - F32* mp = glmp.data(); + return true; +} - for (U32 i = 0; i < mJoints.size(); ++i) - { - F32* m = (F32*)t_mp[i].m; +void Scene::serialize(object& dst) const +{ + write(mNodes, "nodes", dst); + write(mName, "name", dst); +} - U32 idx = i * 12; +const Scene& Scene::operator=(const Value& src) +{ + copy(src, "nodes", mNodes); + copy(src, "name", mName); - mp[idx + 0] = m[0]; - mp[idx + 1] = m[1]; - mp[idx + 2] = m[2]; - mp[idx + 3] = m[12]; + return *this; +} - mp[idx + 4] = m[4]; - mp[idx + 5] = m[5]; - mp[idx + 6] = m[6]; - mp[idx + 7] = m[13]; +void Texture::serialize(object& dst) const +{ + write(mSampler, "sampler", dst, INVALID_INDEX); + write(mSource, "source", dst, INVALID_INDEX); + write(mName, "name", dst); +} - mp[idx + 8] = m[8]; - mp[idx + 9] = m[9]; - mp[idx + 10] = m[10]; - mp[idx + 11] = m[14]; +const Texture& Texture::operator=(const Value& src) +{ + if (src.is_object()) + { + copy(src, "sampler", mSampler); + copy(src, "source", mSource); + copy(src, "name", mName); } - LLGLSLShader::sCurBoundShaderPtr->uniformMatrix3x4fv(LLViewerShaderMgr::AVATAR_MATRIX, - mJoints.size(), - FALSE, - (GLfloat*)glmp.data()); + return *this; +} + +void Sampler::serialize(object& dst) const +{ + write(mMagFilter, "magFilter", dst, LINEAR); + write(mMinFilter, "minFilter", dst, LINEAR_MIPMAP_LINEAR); + write(mWrapS, "wrapS", dst, REPEAT); + write(mWrapT, "wrapT", dst, REPEAT); + write(mName, "name", dst); } +const Sampler& Sampler::operator=(const Value& src) +{ + copy(src, "magFilter", mMagFilter); + copy(src, "minFilter", mMinFilter); + copy(src, "wrapS", mWrapS); + copy(src, "wrapT", mWrapT); + copy(src, "name", mName); + + return *this; +} + + diff --git a/indra/newview/gltf/asset.h b/indra/newview/gltf/asset.h index 5ceac74a8a..27821659db 100644 --- a/indra/newview/gltf/asset.h +++ b/indra/newview/gltf/asset.h @@ -28,13 +28,21 @@ #include "llvertexbuffer.h" #include "llvolumeoctree.h" -#include "../lltinygltfhelper.h" #include "accessor.h" #include "primitive.h" #include "animation.h" +#include "boost/json.hpp" +#include "common.h" +#include "../llviewertexture.h" +#include "llglslshader.h" extern F32SecondsImplicit gFrameTimeSeconds; +// wingdi defines OPAQUE, which conflicts with our enum +#if defined(OPAQUE) +#undef OPAQUE +#endif + // LL GLTF Implementation namespace LL { @@ -42,18 +50,118 @@ namespace LL { class Asset; + class Extension + { + public: + // true if this extension is present in the gltf file + // otherwise false + bool mPresent = false; + }; + + class TextureTransform : public Extension // KHR_texture_transform implementation + { + public: + vec2 mOffset = vec2(0.f, 0.f); + F32 mRotation = 0.f; + vec2 mScale = vec2(1.f, 1.f); + S32 mTexCoord = INVALID_INDEX; + + // get the texture transform as a packed array of vec4's + // dst MUST point to at least 2 vec4's + void getPacked(vec4* dst) const; + + const TextureTransform& operator=(const Value& src); + void serialize(boost::json::object& dst) const; + }; + + class TextureInfo + { + public: + S32 mIndex = INVALID_INDEX; + S32 mTexCoord = 0; + + TextureTransform mTextureTransform; + + bool operator==(const TextureInfo& rhs) const; + bool operator!=(const TextureInfo& rhs) const; + + // get the UV channel that should be used for sampling this texture + // returns mTextureTransform.mTexCoord if present and valid, otherwise mTexCoord + S32 getTexCoord() const; + + const TextureInfo& operator=(const Value& src); + void serialize(boost::json::object& dst) const; + }; + + class NormalTextureInfo : public TextureInfo + { + public: + F32 mScale = 1.0f; + + const NormalTextureInfo& operator=(const Value& src); + void serialize(boost::json::object& dst) const; + }; + + class OcclusionTextureInfo : public TextureInfo + { + public: + F32 mStrength = 1.0f; + + const OcclusionTextureInfo& operator=(const Value& src); + void serialize(boost::json::object& dst) const; + }; + class Material { public: - // use LLFetchedGLTFMaterial for now, but eventually we'll want to use - // a more flexible GLTF material implementation instead of the fixed packing - // version we use for sharable GLTF material assets - LLPointer<LLFetchedGLTFMaterial> mMaterial; + + class Unlit : public Extension // KHR_materials_unlit implementation + { + public: + const Unlit& operator=(const Value& src); + void serialize(boost::json::object& dst) const; + }; + + enum class AlphaMode + { + OPAQUE, + MASK, + BLEND + }; + + + class PbrMetallicRoughness + { + public: + vec4 mBaseColorFactor = vec4(1.f,1.f,1.f,1.f); + TextureInfo mBaseColorTexture; + F32 mMetallicFactor = 1.0f; + F32 mRoughnessFactor = 1.0f; + TextureInfo mMetallicRoughnessTexture; + + bool operator==(const PbrMetallicRoughness& rhs) const; + bool operator!=(const PbrMetallicRoughness& rhs) const; + const PbrMetallicRoughness& operator=(const Value& src); + void serialize(boost::json::object& dst) const; + }; + + + PbrMetallicRoughness mPbrMetallicRoughness; + NormalTextureInfo mNormalTexture; + OcclusionTextureInfo mOcclusionTexture; + TextureInfo mEmissiveTexture; + std::string mName; + vec3 mEmissiveFactor = vec3(0.f, 0.f, 0.f); + AlphaMode mAlphaMode = AlphaMode::OPAQUE; + F32 mAlphaCutoff = 0.5f; + bool mDoubleSided = false; + Unlit mUnlit; - const Material& operator=(const tinygltf::Material& src); + bool isMultiUV() const; - void allocateGLResources(Asset& asset); + const Material& operator=(const Value& src); + void serialize(boost::json::object& dst) const; }; class Mesh @@ -63,22 +171,22 @@ namespace LL std::vector<double> mWeights; std::string mName; - const Mesh& operator=(const tinygltf::Mesh& src); + const Mesh& operator=(const Value& src); + void serialize(boost::json::object& dst) const; - void allocateGLResources(Asset& asset); + bool prep(Asset& asset); }; class Node { public: - LLMatrix4a mMatrix; //local transform - LLMatrix4a mRenderMatrix; //transform for rendering - LLMatrix4a mAssetMatrix; //transform from local to asset space - LLMatrix4a mAssetMatrixInv; //transform from asset to local space + mat4 mMatrix = glm::identity<mat4>(); //local transform + mat4 mAssetMatrix; //transform from local to asset space + mat4 mAssetMatrixInv; //transform from asset to local space - glh::vec3f mTranslation; - glh::quaternionf mRotation; - glh::vec3f mScale; + vec3 mTranslation = vec3(0,0,0); + quat mRotation = glm::identity<quat>(); + vec3 mScale = vec3(1.f,1.f,1.f); // if true, mMatrix is valid and up to date bool mMatrixValid = false; @@ -96,14 +204,11 @@ namespace LL std::string mName; - const Node& operator=(const tinygltf::Node& src); - - // Set mRenderMatrix to a transform that can be used for the current render pass - // modelview -- parent's render matrix - void updateRenderTransforms(Asset& asset, const LLMatrix4a& modelview); + const Node& operator=(const Value& src); + void serialize(boost::json::object& dst) const; // update mAssetMatrix and mAssetMatrixInv - void updateTransforms(Asset& asset, const LLMatrix4a& parentMatrix); + void updateTransforms(Asset& asset, const mat4& parentMatrix); // ensure mMatrix is valid -- if mMatrixValid is false and mTRSValid is true, will update mMatrix to match Translation/Rotation/Scale void makeMatrixValid(); @@ -113,30 +218,35 @@ namespace LL // Set rotation of this node // SIDE EFFECT: invalidates mMatrix - void setRotation(const glh::quaternionf& rotation); + void setRotation(const quat& rotation); // Set translation of this node // SIDE EFFECT: invalidates mMatrix - void setTranslation(const glh::vec3f& translation); + void setTranslation(const vec3& translation); // Set scale of this node // SIDE EFFECT: invalidates mMatrix - void setScale(const glh::vec3f& scale); + void setScale(const vec3& scale); }; class Skin { public: + ~Skin(); + S32 mInverseBindMatrices = INVALID_INDEX; S32 mSkeleton = INVALID_INDEX; + + U32 mUBO = 0; std::vector<S32> mJoints; std::string mName; - std::vector<glh::matrix4f> mInverseBindMatricesData; + std::vector<mat4> mInverseBindMatricesData; - void allocateGLResources(Asset& asset); - void uploadMatrixPalette(Asset& asset, Node& node); + bool prep(Asset& asset); + void uploadMatrixPalette(Asset& asset); - const Skin& operator=(const tinygltf::Skin& src); + const Skin& operator=(const Value& src); + void serialize(boost::json::object& dst) const; }; class Scene @@ -145,10 +255,11 @@ namespace LL std::vector<S32> mNodes; std::string mName; - const Scene& operator=(const tinygltf::Scene& src); + const Scene& operator=(const Value& src); + void serialize(boost::json::object& dst) const; void updateTransforms(Asset& asset); - void updateRenderTransforms(Asset& asset, const LLMatrix4a& modelview); + void updateRenderTransforms(Asset& asset, const mat4& modelview); }; class Texture @@ -158,19 +269,21 @@ namespace LL S32 mSource = INVALID_INDEX; std::string mName; - const Texture& operator=(const tinygltf::Texture& src); + const Texture& operator=(const Value& src); + void serialize(boost::json::object& dst) const; }; class Sampler { public: - S32 mMagFilter; - S32 mMinFilter; - S32 mWrapS; - S32 mWrapT; + S32 mMagFilter = LINEAR; + S32 mMinFilter = LINEAR_MIPMAP_LINEAR; + S32 mWrapS = REPEAT; + S32 mWrapT = REPEAT; std::string mName; - const Sampler& operator=(const tinygltf::Sampler& src); + const Sampler& operator=(const Value& src); + void serialize(boost::json::object& dst) const; }; class Image @@ -179,38 +292,64 @@ namespace LL std::string mName; std::string mUri; std::string mMimeType; - std::vector<U8> mData; - S32 mWidth; - S32 mHeight; - S32 mComponent; - S32 mBits; + + S32 mBufferView = INVALID_INDEX; + + S32 mWidth = -1; + S32 mHeight = -1; + S32 mComponent = -1; + S32 mBits = -1; + S32 mPixelType = -1; + LLPointer<LLViewerFetchedTexture> mTexture; - const Image& operator=(const tinygltf::Image& src) - { - mName = src.name; - mUri = src.uri; - mMimeType = src.mimeType; - mData = src.image; - mWidth = src.width; - mHeight = src.height; - mComponent = src.component; - mBits = src.bits; - - return *this; - } - - void allocateGLResources() + const Image& operator=(const Value& src); + void serialize(boost::json::object& dst) const; + + // save image to disk + // may remove image data from bufferviews and convert to + // file uri if necessary + bool save(Asset& asset, const std::string& filename); + + // erase the buffer view associated with this image + // free any associated GLTF resources + // preserve only uri and name + void clearData(Asset& asset); + + bool prep(Asset& asset); + }; + + // Render Batch -- vertex buffer and list of primitives to render using + // said vertex buffer + class RenderBatch + { + public: + struct PrimitiveData { - // allocate texture + S32 mPrimitiveIndex = INVALID_INDEX; + S32 mNodeIndex = INVALID_INDEX; + }; + + LLPointer<LLVertexBuffer> mVertexBuffer; + std::vector<PrimitiveData> mPrimitives; + }; - } + class RenderData + { + public: + // list of render batches + // indexed by [material index + 1](0 is reserved for default material) + // there should be exactly one render batch per material per variant + std::vector<RenderBatch> mBatches[LLGLSLShader::NUM_GLTF_VARIANTS]; }; + // C++ representation of a GLTF Asset - class Asset : public LLRefCount + class Asset { public: + + static const std::string minVersion_default; std::vector<Scene> mScenes; std::vector<Node> mNodes; std::vector<Mesh> mMeshes; @@ -223,12 +362,38 @@ namespace LL std::vector<Accessor> mAccessors; std::vector<Animation> mAnimations; std::vector<Skin> mSkins; + std::vector<std::string> mExtensionsUsed; + std::vector<std::string> mExtensionsRequired; + + std::string mVersion; + std::string mGenerator; + std::string mMinVersion; + std::string mCopyright; + + S32 mScene = INVALID_INDEX; + Value mExtras; + + U32 mPendingBuffers = 0; + + // local file this asset was loaded from (if any) + std::string mFilename; // the last time update() was called according to gFrameTimeSeconds F32 mLastUpdateTime = gFrameTimeSeconds; - // prepare the asset for rendering - void allocateGLResources(const std::string& filename, const tinygltf::Model& model); + // data used for rendering + // 0 - single sided + // 1 - double sided + RenderData mRenderData[2]; + + // UBO for storing node transforms + U32 mNodesUBO = 0; + + // UBO for storing material data + U32 mMaterialsUBO = 0; + + // prepare for first time use + bool prep(); // Called periodically (typically once per frame) // Any ongoing work (such as animations) should be handled here @@ -240,12 +405,11 @@ namespace LL // update asset-to-node and node-to-asset transforms void updateTransforms(); - // update node render transforms - void updateRenderTransforms(const LLMatrix4a& modelview); + // upload matrices to UBO + void uploadTransforms(); - void render(bool opaque, bool rigged = false); - void renderOpaque(); - void renderTransparent(); + // upload materils to UBO + void uploadMaterials(); // return the index of the node that the line segment intersects with, or -1 if no hit // input and output values must be in this asset's local coordinate frame @@ -257,8 +421,37 @@ namespace LL S32* primitive_hitp = nullptr // return the index of the primitive that was hit ); - const Asset& operator=(const tinygltf::Model& src); + Asset() = default; + Asset(const Value& src); + + // load from given file + // accepts .gltf and .glb files + // Any existing data will be lost + // returns result of prep() on success + bool load(std::string_view filename); + + // load .glb contents from memory + // data - binary contents of .glb file + // returns result of prep() on success + bool loadBinary(const std::string& data); + const Asset& operator=(const Value& src); + void serialize(boost::json::object& dst) const; + + // save the asset to the given .gltf file + // saves images and bins alongside the gltf file + bool save(const std::string& filename); + + // remove the bufferview at the given index + // updates all bufferview indices in this Asset as needed + void eraseBufferView(S32 bufferView); + + // return true if this Asset has been loaded as a local preview + // Local previews may be uploaded or exported to disk + bool isLocalPreview() { return !mFilename.empty(); } }; + + Material::AlphaMode gltf_alpha_mode_to_enum(const std::string& alpha_mode); + std::string enum_to_gltf_alpha_mode(Material::AlphaMode alpha_mode); } } diff --git a/indra/newview/gltf/buffer_util.h b/indra/newview/gltf/buffer_util.h index 4e6f5901e7..40f9448aaf 100644 --- a/indra/newview/gltf/buffer_util.h +++ b/indra/newview/gltf/buffer_util.h @@ -31,60 +31,65 @@ // whenever we add support for more types #ifdef _MSC_VER -#define LL_FUNCSIG __FUNCSIG__ +#define LL_FUNCSIG __FUNCSIG__ #else #define LL_FUNCSIG __PRETTY_FUNCTION__ #endif +#include "accessor.h" + namespace LL { namespace GLTF { + + using string_view = boost::json::string_view; + // copy one Scalar from src to dst template<class S, class T> - static void copyScalar(S* src, T& dst) + inline void copyScalar(S* src, T& dst) { LL_ERRS() << "TODO: implement " << LL_FUNCSIG << LL_ENDL; } // copy one vec2 from src to dst template<class S, class T> - static void copyVec2(S* src, T& dst) + inline void copyVec2(S* src, T& dst) { LL_ERRS() << "TODO: implement " << LL_FUNCSIG << LL_ENDL; } // copy one vec3 from src to dst template<class S, class T> - static void copyVec3(S* src, T& dst) + inline void copyVec3(S* src, T& dst) { LL_ERRS() << "TODO: implement " << LL_FUNCSIG << LL_ENDL; } // copy one vec4 from src to dst template<class S, class T> - static void copyVec4(S* src, T& dst) + inline void copyVec4(S* src, T& dst) { LL_ERRS() << "TODO: implement " << LL_FUNCSIG << LL_ENDL; } - // copy one vec2 from src to dst + // copy one mat2 from src to dst template<class S, class T> - static void copyMat2(S* src, T& dst) + inline void copyMat2(S* src, T& dst) { LL_ERRS() << "TODO: implement " << LL_FUNCSIG << LL_ENDL; } - // copy one vec3 from src to dst + // copy one mat3 from src to dst template<class S, class T> - static void copyMat3(S* src, T& dst) + inline void copyMat3(S* src, T& dst) { LL_ERRS() << "TODO: implement " << LL_FUNCSIG << LL_ENDL; } - // copy one vec4 from src to dst + // copy one mat4 from src to dst template<class S, class T> - static void copyMat4(S* src, T& dst) + inline void copyMat4(S* src, T& dst) { LL_ERRS() << "TODO: implement " << LL_FUNCSIG << LL_ENDL; } @@ -93,135 +98,138 @@ namespace LL // concrete implementations for different types of source and destination //========================================================================================================= -// suppress unused function warning -- clang complains here but these specializations are definitely used -#if defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunused-function" -#endif - template<> - void copyScalar<F32, F32>(F32* src, F32& dst) + inline void copyScalar<F32, F32>(F32* src, F32& dst) { dst = *src; } template<> - void copyScalar<U32, U32>(U32* src, U32& dst) + inline void copyScalar<U32, U32>(U32* src, U32& dst) { dst = *src; } template<> - void copyScalar<U32, U16>(U32* src, U16& dst) + inline void copyScalar<U32, U16>(U32* src, U16& dst) { dst = *src; } template<> - void copyScalar<U16, U16>(U16* src, U16& dst) + inline void copyScalar<U16, U16>(U16* src, U16& dst) { dst = *src; } template<> - void copyScalar<U16, U32>(U16* src, U32& dst) + inline void copyScalar<U16, U32>(U16* src, U32& dst) { dst = *src; } template<> - void copyScalar<U8, U16>(U8* src, U16& dst) + inline void copyScalar<U8, U16>(U8* src, U16& dst) { dst = *src; } template<> - void copyScalar<U8, U32>(U8* src, U32& dst) + inline void copyScalar<U8, U32>(U8* src, U32& dst) { dst = *src; } template<> - void copyVec2<F32, LLVector2>(F32* src, LLVector2& dst) + inline void copyVec2<F32, LLVector2>(F32* src, LLVector2& dst) { dst.set(src[0], src[1]); } template<> - void copyVec3<F32, glh::vec3f>(F32* src, glh::vec3f& dst) + inline void copyVec3<F32, vec3>(F32* src, vec3& dst) { - dst.set_value(src[0], src[1], src[2]); + dst = vec3(src[0], src[1], src[2]); } template<> - void copyVec3<F32, LLVector4a>(F32* src, LLVector4a& dst) + inline void copyVec3<F32, LLVector4a>(F32* src, LLVector4a& dst) { dst.load3(src); } template<> - void copyVec3<U16, LLColor4U>(U16* src, LLColor4U& dst) + inline void copyVec3<U16, LLColor4U>(U16* src, LLColor4U& dst) { dst.set(src[0], src[1], src[2], 255); } template<> - void copyVec4<U8, LLColor4U>(U8* src, LLColor4U& dst) + inline void copyVec4<U8, LLColor4U>(U8* src, LLColor4U& dst) { dst.set(src[0], src[1], src[2], src[3]); } template<> - void copyVec4<U16, LLColor4U>(U16* src, LLColor4U& dst) + inline void copyVec4<U16, U64>(U16* src, U64& dst) + { + U16* data = (U16*)&dst; + data[0] = src[0]; + data[1] = src[1]; + data[2] = src[2]; + data[3] = src[3]; + } + + template<> + inline void copyVec4<U16, LLColor4U>(U16* src, LLColor4U& dst) { dst.set(src[0], src[1], src[2], src[3]); } template<> - void copyVec4<F32, LLColor4U>(F32* src, LLColor4U& dst) + inline void copyVec4<F32, LLColor4U>(F32* src, LLColor4U& dst) { dst.set(src[0]*255, src[1]*255, src[2]*255, src[3]*255); } template<> - void copyVec4<F32, LLVector4a>(F32* src, LLVector4a& dst) + inline void copyVec4<F32, LLVector4a>(F32* src, LLVector4a& dst) { dst.loadua(src); } template<> - void copyVec4<U16, LLVector4a>(U16* src, LLVector4a& dst) + inline void copyVec4<U16, LLVector4a>(U16* src, LLVector4a& dst) { dst.set(src[0], src[1], src[2], src[3]); } template<> - void copyVec4<U8, LLVector4a>(U8* src, LLVector4a& dst) + inline void copyVec4<U8, LLVector4a>(U8* src, LLVector4a& dst) { dst.set(src[0], src[1], src[2], src[3]); } template<> - void copyVec4<F32, glh::quaternionf>(F32* src, glh::quaternionf& dst) + inline void copyVec4<F32, quat>(F32* src, quat& dst) { - dst.set_value(src); + dst.x = src[0]; + dst.y = src[1]; + dst.z = src[2]; + dst.w = src[3]; } template<> - void copyMat4<F32, glh::matrix4f>(F32* src, glh::matrix4f& dst) + inline void copyMat4<F32, mat4>(F32* src, mat4& dst) { - dst.set_value(src); + dst = glm::make_mat4(src); } -#if defined(__clang__) -#pragma clang diagnostic pop -#endif - //========================================================================================================= // copy from src to dst, stride is the number of bytes between each element in src, count is number of elements to copy template<class S, class T> - static void copyScalar(S* src, LLStrider<T> dst, S32 stride, S32 count) + inline void copyScalar(S* src, LLStrider<T> dst, S32 stride, S32 count) { for (S32 i = 0; i < count; ++i) { @@ -233,7 +241,7 @@ namespace LL // copy from src to dst, stride is the number of bytes between each element in src, count is number of elements to copy template<class S, class T> - static void copyVec2(S* src, LLStrider<T> dst, S32 stride, S32 count) + inline void copyVec2(S* src, LLStrider<T> dst, S32 stride, S32 count) { for (S32 i = 0; i < count; ++i) { @@ -245,7 +253,7 @@ namespace LL // copy from src to dst, stride is the number of bytes between each element in src, count is number of elements to copy template<class S, class T> - static void copyVec3(S* src, LLStrider<T> dst, S32 stride, S32 count) + inline void copyVec3(S* src, LLStrider<T> dst, S32 stride, S32 count) { for (S32 i = 0; i < count; ++i) { @@ -257,7 +265,7 @@ namespace LL // copy from src to dst, stride is the number of bytes between each element in src, count is number of elements to copy template<class S, class T> - static void copyVec4(S* src, LLStrider<T> dst, S32 stride, S32 count) + inline void copyVec4(S* src, LLStrider<T> dst, S32 stride, S32 count) { for (S32 i = 0; i < count; ++i) { @@ -269,7 +277,7 @@ namespace LL // copy from src to dst, stride is the number of bytes between each element in src, count is number of elements to copy template<class S, class T> - static void copyMat2(S* src, LLStrider<T> dst, S32 stride, S32 count) + inline void copyMat2(S* src, LLStrider<T> dst, S32 stride, S32 count) { for (S32 i = 0; i < count; ++i) { @@ -281,7 +289,7 @@ namespace LL // copy from src to dst, stride is the number of bytes between each element in src, count is number of elements to copy template<class S, class T> - static void copyMat3(S* src, LLStrider<T> dst, S32 stride, S32 count) + inline void copyMat3(S* src, LLStrider<T> dst, S32 stride, S32 count) { for (S32 i = 0; i < count; ++i) { @@ -293,7 +301,7 @@ namespace LL // copy from src to dst, stride is the number of bytes between each element in src, count is number of elements to copy template<class S, class T> - static void copyMat4(S* src, LLStrider<T> dst, S32 stride, S32 count) + inline void copyMat4(S* src, LLStrider<T> dst, S32 stride, S32 count) { for (S32 i = 0; i < count; ++i) { @@ -304,39 +312,39 @@ namespace LL } template<class S, class T> - static void copy(Asset& asset, Accessor& accessor, const S* src, LLStrider<T>& dst, S32 byteStride) + inline void copy(Asset& asset, Accessor& accessor, const S* src, LLStrider<T>& dst, S32 byteStride) { - if (accessor.mType == (S32)Accessor::Type::SCALAR) + if (accessor.mType == Accessor::Type::SCALAR) { S32 stride = byteStride == 0 ? sizeof(S) * 1 : byteStride; copyScalar((S*)src, dst, stride, accessor.mCount); } - else if (accessor.mType == (S32)Accessor::Type::VEC2) + else if (accessor.mType == Accessor::Type::VEC2) { S32 stride = byteStride == 0 ? sizeof(S) * 2 : byteStride; copyVec2((S*)src, dst, stride, accessor.mCount); } - else if (accessor.mType == (S32)Accessor::Type::VEC3) + else if (accessor.mType == Accessor::Type::VEC3) { S32 stride = byteStride == 0 ? sizeof(S) * 3 : byteStride; copyVec3((S*)src, dst, stride, accessor.mCount); } - else if (accessor.mType == (S32)Accessor::Type::VEC4) + else if (accessor.mType == Accessor::Type::VEC4) { S32 stride = byteStride == 0 ? sizeof(S) * 4 : byteStride; copyVec4((S*)src, dst, stride, accessor.mCount); } - else if (accessor.mType == (S32)Accessor::Type::MAT2) + else if (accessor.mType == Accessor::Type::MAT2) { S32 stride = byteStride == 0 ? sizeof(S) * 4 : byteStride; copyMat2((S*)src, dst, stride, accessor.mCount); } - else if (accessor.mType == (S32)Accessor::Type::MAT3) + else if (accessor.mType == Accessor::Type::MAT3) { S32 stride = byteStride == 0 ? sizeof(S) * 9 : byteStride; copyMat3((S*)src, dst, stride, accessor.mCount); } - else if (accessor.mType == (S32)Accessor::Type::MAT4) + else if (accessor.mType == Accessor::Type::MAT4) { S32 stride = byteStride == 0 ? sizeof(S) * 16 : byteStride; copyMat4((S*)src, dst, stride, accessor.mCount); @@ -349,54 +357,701 @@ namespace LL // copy data from accessor to strider template<class T> - static void copy(Asset& asset, Accessor& accessor, LLStrider<T>& dst) + inline void copy(Asset& asset, Accessor& accessor, LLStrider<T>& dst) { const BufferView& bufferView = asset.mBufferViews[accessor.mBufferView]; const Buffer& buffer = asset.mBuffers[bufferView.mBuffer]; const U8* src = buffer.mData.data() + bufferView.mByteOffset + accessor.mByteOffset; - if (accessor.mComponentType == TINYGLTF_COMPONENT_TYPE_FLOAT) + switch (accessor.mComponentType) { - LL::GLTF::copy(asset, accessor, (const F32*)src, dst, bufferView.mByteStride); + case Accessor::ComponentType::FLOAT: + copy(asset, accessor, (const F32*)src, dst, bufferView.mByteStride); + break; + case Accessor::ComponentType::UNSIGNED_INT: + copy(asset, accessor, (const U32*)src, dst, bufferView.mByteStride); + break; + case Accessor::ComponentType::SHORT: + copy(asset, accessor, (const S16*)src, dst, bufferView.mByteStride); + break; + case Accessor::ComponentType::UNSIGNED_SHORT: + copy(asset, accessor, (const U16*)src, dst, bufferView.mByteStride); + break; + case Accessor::ComponentType::BYTE: + copy(asset, accessor, (const S8*)src, dst, bufferView.mByteStride); + break; + case Accessor::ComponentType::UNSIGNED_BYTE: + copy(asset, accessor, (const U8*)src, dst, bufferView.mByteStride); + break; + default: + LL_ERRS("GLTF") << "Invalid component type" << LL_ENDL; + break; } - else if (accessor.mComponentType == TINYGLTF_COMPONENT_TYPE_UNSIGNED_SHORT) + } + + // copy data from accessor to vector + template<class T> + inline void copy(Asset& asset, Accessor& accessor, std::vector<T>& dst) + { + dst.resize(accessor.mCount); + LLStrider<T> strider = dst.data(); + copy(asset, accessor, strider); + } + + + //========================================================================================================= + // boost::json copying utilities + // ======================================================================================================== + + //====================== unspecialized base template, single value =========================== + + // to/from Value + template<typename T> + inline bool copy(const Value& src, T& dst) + { + dst = src; + return true; + } + + template<typename T> + inline bool write(const T& src, Value& dst) + { + dst = boost::json::object(); + src.serialize(dst.as_object()); + return true; + } + + template<typename T> + inline bool copy(const Value& src, std::unordered_map<std::string, T>& dst) + { + if (src.is_object()) { - LL::GLTF::copy(asset, accessor, (const U16*)src, dst, bufferView.mByteStride); + const boost::json::object& obj = src.as_object(); + for (const auto& [key, value] : obj) + { + copy<T>(value, dst[key]); + } + return true; } - else if (accessor.mComponentType == TINYGLTF_COMPONENT_TYPE_UNSIGNED_INT) + return false; + } + + template<typename T> + inline bool write(const std::unordered_map<std::string, T>& src, Value& dst) + { + boost::json::object obj; + for (const auto& [key, value] : src) { - LL::GLTF::copy(asset, accessor, (const U32*)src, dst, bufferView.mByteStride); + Value v; + if (write<T>(value, v)) + { + obj[key] = v; + } + else + { + return false; + } } - else if (accessor.mComponentType == TINYGLTF_COMPONENT_TYPE_UNSIGNED_BYTE) + dst = obj; + return true; + } + + // to/from array + template<typename T> + inline bool copy(const Value& src, std::vector<T>& dst) + { + if (src.is_array()) { - LL::GLTF::copy(asset, accessor, (const U8*)src, dst, bufferView.mByteStride); + const boost::json::array& arr = src.get_array(); + dst.resize(arr.size()); + for (size_t i = 0; i < arr.size(); ++i) + { + copy(arr[i], dst[i]); + } + return true; } - else if (accessor.mComponentType == TINYGLTF_COMPONENT_TYPE_SHORT) + + return false; + } + + template<typename T> + inline bool write(const std::vector<T>& src, Value& dst) + { + boost::json::array arr; + for (const T& t : src) { - LL::GLTF::copy(asset, accessor, (const S16*)src, dst, bufferView.mByteStride); + Value v; + if (write(t, v)) + { + arr.push_back(v); + } + else + { + return false; + } } - else if (accessor.mComponentType == TINYGLTF_COMPONENT_TYPE_BYTE) + dst = arr; + return true; + } + + // to/from object member + template<typename T> + inline bool copy(const boost::json::object& src, string_view member, T& dst) + { + auto it = src.find(member); + if (it != src.end()) { - LL::GLTF::copy(asset, accessor, (const S8*)src, dst, bufferView.mByteStride); + return copy(it->value(), dst); } - else if (accessor.mComponentType == TINYGLTF_COMPONENT_TYPE_DOUBLE) + return false; + } + + // always write a member to an object without checking default + template<typename T> + inline bool write_always(const T& src, string_view member, boost::json::object& dst) + { + Value& v = dst[member]; + if (!write(src, v)) { - LL::GLTF::copy(asset, accessor, (const F64*)src, dst, bufferView.mByteStride); + dst.erase(member); + return false; } - else + return true; + } + + + // to/from extension + + // for internal use only, use copy_extensions instead + template<typename T> + inline bool _copy_extension(const boost::json::object& extensions, std::string_view member, T* dst) + { + if (extensions.contains(member)) { - LL_ERRS("GLTF") << "Unsupported component type" << LL_ENDL; + return copy(extensions.at(member), *dst); } + + return false; } - // copy data from accessor to vector - template<class T> - static void copy(Asset& asset, Accessor& accessor, std::vector<T>& dst) + // Copy all extensions from src.extensions to provided destinations + // Usage: + // copy_extensions(src, + // "KHR_materials_unlit", &mUnlit, + // "KHR_materials_pbrSpecularGlossiness", &mPbrSpecularGlossiness); + // returns true if any of the extensions are copied + template<class... Types> + inline bool copy_extensions(const boost::json::value& src, Types... args) { - dst.resize(accessor.mCount); - LLStrider<T> strider = dst.data(); - copy(asset, accessor, strider); + // extract the extensions object (don't assume it exists and verify that it is an object) + if (src.is_object()) + { + boost::json::object obj = src.get_object(); + if (obj.contains("extensions")) + { + const boost::json::value& extensions = obj.at("extensions"); + if (extensions.is_object()) + { + const boost::json::object& ext_obj = extensions.as_object(); + bool success = false; + // copy each extension, return true if any of them succeed, do not short circuit on success + U32 count = sizeof...(args); + for (U32 i = 0; i < count; i += 2) + { + if (_copy_extension(ext_obj, args...)) + { + success = true; + } + } + return success; + } + } + } + + return false; } + + // internal use aonly, use write_extensions instead + template<typename T> + inline bool _write_extension(boost::json::object& extensions, const T* src, string_view member) + { + if (src->mPresent) + { + Value v; + if (write(*src, v)) + { + extensions[member] = v; + return true; + } + } + return false; + } + + // Write all extensions to dst.extensions + // Usage: + // write_extensions(dst, + // mUnlit, "KHR_materials_unlit", + // mPbrSpecularGlossiness, "KHR_materials_pbrSpecularGlossiness"); + // returns true if any of the extensions are written + template<class... Types> + inline bool write_extensions(boost::json::object& dst, Types... args) + { + bool success = false; + + boost::json::object extensions; + U32 count = sizeof...(args) - 1; + + for (U32 i = 0; i < count; i += 2) + { + if (_write_extension(extensions, args...)) + { + success = true; + } + } + + if (success) + { + dst["extensions"] = extensions; + } + + return success; + } + + // conditionally write a member to an object if the member + // is not the default value + template<typename T> + inline bool write(const T& src, string_view member, boost::json::object& dst, const T& default_value = T()) + { + if (src != default_value) + { + return write_always(src, member, dst); + } + return false; + } + + template<typename T> + inline bool write(const std::unordered_map<std::string, T>& src, string_view member, boost::json::object& dst, const std::unordered_map<std::string, T>& default_value = std::unordered_map<std::string, T>()) + { + if (!src.empty()) + { + Value v; + if (write<T>(src, v)) + { + dst[member] = v; + return true; + } + } + return false; + } + + template<typename T> + inline bool write(const std::vector<T>& src, string_view member, boost::json::object& dst, const std::vector<T>& deafault_value = std::vector<T>()) + { + if (!src.empty()) + { + Value v; + if (write(src, v)) + { + dst[member] = v; + return true; + } + } + return false; + } + + template<typename T> + inline bool copy(const Value& src, string_view member, T& dst) + { + if (src.is_object()) + { + const boost::json::object& obj = src.as_object(); + return copy(obj, member, dst); + } + + return false; + } + + // Accessor::ComponentType + template<> + inline bool copy(const Value& src, Accessor::ComponentType& dst) + { + if (src.is_int64()) + { + dst = (Accessor::ComponentType)src.get_int64(); + return true; + } + return false; + } + + template<> + inline bool write(const Accessor::ComponentType& src, Value& dst) + { + dst = (S32)src; + return true; + } + + //Primitive::Mode + template<> + inline bool copy(const Value& src, Primitive::Mode& dst) + { + if (src.is_int64()) + { + dst = (Primitive::Mode)src.get_int64(); + return true; + } + return false; + } + + template<> + inline bool write(const Primitive::Mode& src, Value& dst) + { + dst = (S32)src; + return true; + } + + // vec4 + template<> + inline bool copy(const Value& src, vec4& dst) + { + if (src.is_array()) + { + const boost::json::array& arr = src.as_array(); + if (arr.size() == 4) + { + vec4 v; + std::error_code ec; + + v.x = arr[0].to_number<F32>(ec); if (ec) return false; + v.y = arr[1].to_number<F32>(ec); if (ec) return false; + v.z = arr[2].to_number<F32>(ec); if (ec) return false; + v.w = arr[3].to_number<F32>(ec); if (ec) return false; + + dst = v; + + return true; + } + } + return false; + } + + template<> + inline bool write(const vec4& src, Value& dst) + { + dst = boost::json::array(); + boost::json::array& arr = dst.get_array(); + arr.resize(4); + arr[0] = src.x; + arr[1] = src.y; + arr[2] = src.z; + arr[3] = src.w; + return true; + } + + // quat + template<> + inline bool copy(const Value& src, quat& dst) + { + if (src.is_array()) + { + const boost::json::array& arr = src.as_array(); + if (arr.size() == 4) + { + std::error_code ec; + dst.x = arr[0].to_number<F32>(ec); if (ec) return false; + dst.y = arr[1].to_number<F32>(ec); if (ec) return false; + dst.z = arr[2].to_number<F32>(ec); if (ec) return false; + dst.w = arr[3].to_number<F32>(ec); if (ec) return false; + + return true; + } + } + return false; + } + + template<> + inline bool write(const quat& src, Value& dst) + { + dst = boost::json::array(); + boost::json::array& arr = dst.get_array(); + arr.resize(4); + arr[0] = src.x; + arr[1] = src.y; + arr[2] = src.z; + arr[3] = src.w; + return true; + } + + + // vec3 + template<> + inline bool copy(const Value& src, vec3& dst) + { + if (src.is_array()) + { + const boost::json::array& arr = src.as_array(); + if (arr.size() == 3) + { + std::error_code ec; + vec3 t; + t.x = arr[0].to_number<F32>(ec); if (ec) return false; + t.y = arr[1].to_number<F32>(ec); if (ec) return false; + t.z = arr[2].to_number<F32>(ec); if (ec) return false; + + dst = t; + return true; + } + } + return false; + } + + template<> + inline bool write(const vec3& src, Value& dst) + { + dst = boost::json::array(); + boost::json::array& arr = dst.as_array(); + arr.resize(3); + arr[0] = src.x; + arr[1] = src.y; + arr[2] = src.z; + return true; + } + + // vec2 + template<> + inline bool copy(const Value& src, vec2& dst) + { + if (src.is_array()) + { + const boost::json::array& arr = src.as_array(); + if (arr.size() == 2) + { + std::error_code ec; + vec2 t; + t.x = arr[0].to_number<F32>(ec); if (ec) return false; + t.y = arr[1].to_number<F32>(ec); if (ec) return false; + + dst = t; + return true; + } + } + return false; + } + + template<> + inline bool write(const vec2& src, Value& dst) + { + dst = boost::json::array(); + boost::json::array& arr = dst.as_array(); + arr.resize(2); + arr[0] = src.x; + arr[1] = src.y; + + return true; + } + + // bool + template<> + inline bool copy(const Value& src, bool& dst) + { + if (src.is_bool()) + { + dst = src.get_bool(); + return true; + } + return false; + } + + template<> + inline bool write(const bool& src, Value& dst) + { + dst = src; + return true; + } + + // F32 + template<> + inline bool copy(const Value& src, F32& dst) + { + std::error_code ec; + F32 t = src.to_number<F32>(ec); if (ec) return false; + dst = t; + return true; + } + + template<> + inline bool write(const F32& src, Value& dst) + { + dst = src; + return true; + } + + + // U32 + template<> + inline bool copy(const Value& src, U32& dst) + { + if (src.is_int64()) + { + dst = src.get_int64(); + return true; + } + return false; + } + + template<> + inline bool write(const U32& src, Value& dst) + { + dst = src; + return true; + } + + // F64 + template<> + inline bool copy(const Value& src, F64& dst) + { + std::error_code ec; + F64 t = src.to_number<F64>(ec); if (ec) return false; + dst = t; + return true; + } + + template<> + inline bool write(const F64& src, Value& dst) + { + dst = src; + return true; + } + + // Accessor::Type + template<> + inline bool copy(const Value& src, Accessor::Type& dst) + { + if (src.is_string()) + { + dst = gltf_type_to_enum(src.get_string().c_str()); + return true; + } + return false; + } + + template<> + inline bool write(const Accessor::Type& src, Value& dst) + { + dst = enum_to_gltf_type(src); + return true; + } + + // S32 + template<> + inline bool copy(const Value& src, S32& dst) + { + if (src.is_int64()) + { + dst = src.get_int64(); + return true; + } + return false; + } + + template<> + inline bool write(const S32& src, Value& dst) + { + dst = src; + return true; + } + + + // std::string + template<> + inline bool copy(const Value& src, std::string& dst) + { + if (src.is_string()) + { + dst = src.get_string().c_str(); + return true; + } + return false; + } + + template<> + inline bool write(const std::string& src, Value& dst) + { + dst = src; + return true; + } + + // mat4 + template<> + inline bool copy(const Value& src, mat4& dst) + { + if (src.is_array()) + { + const boost::json::array& arr = src.get_array(); + if (arr.size() == 16) + { + // populate a temporary local in case + // we hit an error in the middle of the array + // (don't partially write a matrix) + mat4 t; + F32* p = glm::value_ptr(t); + + for (U32 i = 0; i < arr.size(); ++i) + { + std::error_code ec; + p[i] = arr[i].to_number<F32>(ec); + if (ec) + { + return false; + } + } + + dst = t; + return true; + } + } + + return false; + } + + template<> + inline bool write(const mat4& src, Value& dst) + { + dst = boost::json::array(); + boost::json::array& arr = dst.get_array(); + arr.resize(16); + const F32* p = glm::value_ptr(src); + for (U32 i = 0; i < 16; ++i) + { + arr[i] = p[i]; + } + return true; + } + + // Material::AlphaMode + template<> + inline bool copy(const Value& src, Material::AlphaMode& dst) + { + if (src.is_string()) + { + dst = gltf_alpha_mode_to_enum(src.get_string().c_str()); + return true; + } + return true; + } + + template<> + inline bool write(const Material::AlphaMode& src, Value& dst) + { + dst = enum_to_gltf_alpha_mode(src); + return true; + } + + // + // ======================================================================================================== + } } + + + diff --git a/indra/newview/gltf/common.h b/indra/newview/gltf/common.h new file mode 100644 index 0000000000..b9698d4017 --- /dev/null +++ b/indra/newview/gltf/common.h @@ -0,0 +1,97 @@ +#pragma once + +/** + * @file common.h + * @brief LL GLTF Implementation + * + * $LicenseInfo:firstyear=2024&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2024, 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$ + */ + +#define GLM_ENABLE_EXPERIMENTAL 1 + +#include "glm/vec2.hpp" +#include "glm/vec3.hpp" +#include "glm/vec4.hpp" +#include "glm/mat4x4.hpp" +#include "glm/gtc/type_ptr.hpp" +#include "glm/ext/quaternion_float.hpp" +#include "glm/gtx/quaternion.hpp" +#include "glm/gtx/matrix_decompose.hpp" +#include <boost/json.hpp> + +// Common types and constants used in the GLTF implementation +namespace LL +{ + namespace GLTF + { + using Value = boost::json::value; + + using mat4 = glm::mat4; + using vec4 = glm::vec4; + using vec3 = glm::vec3; + using vec2 = glm::vec2; + using quat = glm::quat; + + constexpr S32 LINEAR = 9729; + constexpr S32 NEAREST = 9728; + constexpr S32 NEAREST_MIPMAP_NEAREST = 9984; + constexpr S32 LINEAR_MIPMAP_NEAREST = 9985; + constexpr S32 NEAREST_MIPMAP_LINEAR = 9986; + constexpr S32 LINEAR_MIPMAP_LINEAR = 9987; + constexpr S32 CLAMP_TO_EDGE = 33071; + constexpr S32 MIRRORED_REPEAT = 33648; + constexpr S32 REPEAT = 10497; + + + class Asset; + class Material; + class TextureInfo; + class NormalTextureInfo; + class OcclusionTextureInfo; + class Mesh; + class Node; + class Scene; + class Texture; + class Sampler; + class Image; + class Animation; + class Skin; + class Camera; + class Light; + class Primitive; + class Accessor; + class BufferView; + class Buffer; + + enum class TextureType : U8 + { + BASE_COLOR = 0, + NORMAL, + METALLIC_ROUGHNESS, + OCCLUSION, + EMISSIVE + }; + + constexpr U32 TEXTURE_TYPE_COUNT = 5; + } +} + diff --git a/indra/newview/gltf/primitive.cpp b/indra/newview/gltf/primitive.cpp index 46af87ebbb..7613d81af4 100644 --- a/indra/newview/gltf/primitive.cpp +++ b/indra/newview/gltf/primitive.cpp @@ -28,12 +28,299 @@ #include "asset.h" #include "buffer_util.h" +#include "../llviewershadermgr.h" + +#include "mikktspace/mikktspace.hh" + +#if LL_USESYSTEMLIBS +#include <meshoptimizer.h> +#else +#include "meshoptimizer/meshoptimizer.h" +#endif -#include "../lltinygltfhelper.h" using namespace LL::GLTF; +using namespace boost::json; + -void Primitive::allocateGLResources(Asset& asset) +// Mesh data useful for Mikktspace tangent generation (and flat normal generation) +struct MikktMesh +{ + std::vector<LLVector3> p; //positions + std::vector<LLVector3> n; //normals + std::vector<LLVector4> t; //tangents + std::vector<LLVector2> tc0; //texcoords 0 + std::vector<LLVector2> tc1; //texcoords 1 + std::vector<LLColor4U> c; //colors + std::vector<LLVector4> w; //weights + std::vector<U64> j; //joints + + // initialize from src primitive and make an unrolled triangle list + // returns false if the Primitive cannot be converted to a triangle list + bool copy(const Primitive* prim) + { + bool indexed = !prim->mIndexArray.empty(); + size_t vert_count = indexed ? prim->mIndexArray.size() : prim->mPositions.size(); + + size_t triangle_count = 0; + + if (prim->mMode == Primitive::Mode::TRIANGLE_STRIP || + prim->mMode == Primitive::Mode::TRIANGLE_FAN) + { + triangle_count = vert_count - 2; + } + else if (prim->mMode == Primitive::Mode::TRIANGLES) + { + triangle_count = vert_count / 3; + } + else + { + LL_WARNS("GLTF") << "Unsupported primitive mode for conversion to triangles: " << (S32)prim->mMode << LL_ENDL; + return false; + } + + vert_count = triangle_count * 3; + llassert(vert_count <= size_t(U32_MAX)); // triangle_count will also naturally be under the limit + + p.resize(vert_count); + n.resize(vert_count); + tc0.resize(vert_count); + c.resize(vert_count); + + bool has_normals = !prim->mNormals.empty(); + if (has_normals) + { + n.resize(vert_count); + } + bool has_tangents = !prim->mTangents.empty(); + if (has_tangents) + { + t.resize(vert_count); + } + + bool rigged = !prim->mWeights.empty(); + if (rigged) + { + w.resize(vert_count); + j.resize(vert_count); + } + + bool multi_uv = !prim->mTexCoords1.empty(); + if (multi_uv) + { + tc1.resize(vert_count); + } + + for (U32 tri_idx = 0; tri_idx < U32(triangle_count); ++tri_idx) + { + U32 idx[3]; + + if (prim->mMode == Primitive::Mode::TRIANGLES) + { + idx[0] = tri_idx * 3; + idx[1] = tri_idx * 3 + 1; + idx[2] = tri_idx * 3 + 2; + } + else if (prim->mMode == Primitive::Mode::TRIANGLE_STRIP) + { + idx[0] = tri_idx; + idx[1] = tri_idx + 1; + idx[2] = tri_idx + 2; + + if (tri_idx % 2 != 0) + { + std::swap(idx[1], idx[2]); + } + } + else if (prim->mMode == Primitive::Mode::TRIANGLE_FAN) + { + idx[0] = 0; + idx[1] = tri_idx + 1; + idx[2] = tri_idx + 2; + } + + if (indexed) + { + idx[0] = prim->mIndexArray[idx[0]]; + idx[1] = prim->mIndexArray[idx[1]]; + idx[2] = prim->mIndexArray[idx[2]]; + } + + for (U32 v = 0; v < 3; ++v) + { + U32 i = tri_idx * 3 + v; + p[i].set(prim->mPositions[idx[v]].getF32ptr()); + tc0[i].set(prim->mTexCoords0[idx[v]]); + c[i] = prim->mColors[idx[v]]; + + if (multi_uv) + { + tc1[i].set(prim->mTexCoords1[idx[v]]); + } + + if (has_normals) + { + n[i].set(prim->mNormals[idx[v]].getF32ptr()); + } + + if (rigged) + { + w[i].set(prim->mWeights[idx[v]].getF32ptr()); + j[i] = prim->mJoints[idx[v]]; + } + } + } + + return true; + } + + void genNormals() + { + size_t tri_count = p.size() / 3; + for (size_t i = 0; i < tri_count; ++i) + { + LLVector3 v0 = p[i * 3]; + LLVector3 v1 = p[i * 3 + 1]; + LLVector3 v2 = p[i * 3 + 2]; + + LLVector3 normal = (v1 - v0) % (v2 - v0); + normal.normalize(); + + n[i * 3] = normal; + n[i * 3 + 1] = normal; + n[i * 3 + 2] = normal; + } + } + + void genTangents() + { + t.resize(p.size()); + mikk::Mikktspace ctx(*this); + ctx.genTangSpace(); + } + + // write to target primitive as an indexed triangle list + // Only modifies runtime data, does not modify the original GLTF data + void write(Primitive* prim) const + { + //re-weld + std::vector<meshopt_Stream> mos = + { + { &p[0], sizeof(LLVector3), sizeof(LLVector3) }, + { &n[0], sizeof(LLVector3), sizeof(LLVector3) }, + { &t[0], sizeof(LLVector4), sizeof(LLVector4) }, + { &tc0[0], sizeof(LLVector2), sizeof(LLVector2) }, + { &c[0], sizeof(LLColor4U), sizeof(LLColor4U) } + }; + + if (!w.empty()) + { + mos.push_back({ &w[0], sizeof(LLVector4), sizeof(LLVector4) }); + mos.push_back({ &j[0], sizeof(U64), sizeof(U64) }); + } + + if (!tc1.empty()) + { + mos.push_back({ &tc1[0], sizeof(LLVector2), sizeof(LLVector2) }); + } + + std::vector<U32> remap; + remap.resize(p.size()); + + size_t stream_count = mos.size(); + + size_t vert_count = meshopt_generateVertexRemapMulti(&remap[0], nullptr, p.size(), p.size(), mos.data(), stream_count); + + prim->mTexCoords0.resize(vert_count); + prim->mNormals.resize(vert_count); + prim->mTangents.resize(vert_count); + prim->mPositions.resize(vert_count); + prim->mColors.resize(vert_count); + if (!w.empty()) + { + prim->mWeights.resize(vert_count); + prim->mJoints.resize(vert_count); + } + if (!tc1.empty()) + { + prim->mTexCoords1.resize(vert_count); + } + + prim->mIndexArray.resize(remap.size()); + + for (int i = 0; i < remap.size(); ++i) + { + U32 src_idx = i; + U32 dst_idx = remap[i]; + + prim->mIndexArray[i] = dst_idx; + + prim->mPositions[dst_idx].load3(p[src_idx].mV); + prim->mNormals[dst_idx].load3(n[src_idx].mV); + prim->mTexCoords0[dst_idx] = tc0[src_idx]; + prim->mTangents[dst_idx].loadua(t[src_idx].mV); + prim->mColors[dst_idx] = c[src_idx]; + + if (!w.empty()) + { + prim->mWeights[dst_idx].loadua(w[src_idx].mV); + prim->mJoints[dst_idx] = j[src_idx]; + } + + if (!tc1.empty()) + { + prim->mTexCoords1[dst_idx] = tc1[src_idx]; + } + } + + prim->mGLMode = LLRender::TRIANGLES; + } + + uint32_t GetNumFaces() + { + return uint32_t(p.size()/3); + } + + uint32_t GetNumVerticesOfFace(const uint32_t face_num) + { + return 3; + } + + mikk::float3 GetPosition(const uint32_t face_num, const uint32_t vert_num) + { + F32* v = p[face_num * 3 + vert_num].mV; + return mikk::float3(v); + } + + mikk::float3 GetTexCoord(const uint32_t face_num, const uint32_t vert_num) + { + F32* uv = tc0[face_num * 3 + vert_num].mV; + return mikk::float3(uv[0], 1.f-uv[1], 1.0f); + } + + mikk::float3 GetNormal(const uint32_t face_num, const uint32_t vert_num) + { + F32* normal = n[face_num * 3 + vert_num].mV; + return mikk::float3(normal); + } + + void SetTangentSpace(const uint32_t face_num, const uint32_t vert_num, mikk::float3 T, bool orientation) + { + S32 i = face_num * 3 + vert_num; + t[i].set(T.x, T.y, T.z, orientation ? 1.0f : -1.0f); + } +}; + + +static void vertical_flip(std::vector<LLVector2>& texcoords) +{ + for (auto& tc : texcoords) + { + tc[1] = 1.f - tc[1]; + } +} + +bool Primitive::prep(Asset& asset) { // allocate vertex buffer // We diverge from the intent of the GLTF format here to work with our existing render pipeline @@ -66,7 +353,11 @@ void Primitive::allocateGLResources(Asset& asset) } else if (attribName == "TEXCOORD_0") { - copy(asset, accessor, mTexCoords); + copy(asset, accessor, mTexCoords0); + } + else if (attribName == "TEXCOORD_1") + { + copy(asset, accessor, mTexCoords1); } else if (attribName == "JOINTS_0") { @@ -83,41 +374,46 @@ void Primitive::allocateGLResources(Asset& asset) { Accessor& accessor = asset.mAccessors[mIndices]; copy(asset, accessor, mIndexArray); + + for (auto& idx : mIndexArray) + { + if (idx >= mPositions.size()) + { + LL_WARNS("GLTF") << "Invalid index array" << LL_ENDL; + return false; + } + } + } + else + { //everything must be indexed at runtime + mIndexArray.resize(mPositions.size()); + for (U32 i = 0; i < mPositions.size(); ++i) + { + mIndexArray[i] = i; + } } - U32 mask = ATTRIBUTE_MASK; + U32 mask = LLVertexBuffer::MAP_VERTEX; + + mShaderVariant = 0; if (!mWeights.empty()) { + mShaderVariant |= LLGLSLShader::GLTFVariant::RIGGED; mask |= LLVertexBuffer::MAP_WEIGHT4; + mask |= LLVertexBuffer::MAP_JOINT; } - mVertexBuffer = new LLVertexBuffer(mask); - mVertexBuffer->allocateBuffer(mPositions.size(), mIndexArray.size()*2); // double the size of the index buffer for 32-bit indices - - mVertexBuffer->setBuffer(); - mVertexBuffer->setPositionData(mPositions.data()); - - if (!mIndexArray.empty()) + if (mTexCoords0.empty()) { - mVertexBuffer->setIndexData(mIndexArray.data()); + mTexCoords0.resize(mPositions.size()); } - if (mTexCoords.empty()) - { - mTexCoords.resize(mPositions.size()); - } + mask |= LLVertexBuffer::MAP_TEXCOORD0; - // flip texcoord y, upload, then flip back (keep the off-spec data in vram only) - for (auto& tc : mTexCoords) + if (!mTexCoords1.empty()) { - tc[1] = 1.f - tc[1]; - } - mVertexBuffer->setTexCoord0Data(mTexCoords.data()); - - for (auto& tc : mTexCoords) - { - tc[1] = 1.f - tc[1]; + mask |= LLVertexBuffer::MAP_TEXCOORD1; } if (mColors.empty()) @@ -125,54 +421,176 @@ void Primitive::allocateGLResources(Asset& asset) mColors.resize(mPositions.size(), LLColor4U::white); } + mask |= LLVertexBuffer::MAP_COLOR; + + bool unlit = false; + // bake material basecolor into color array if (mMaterial != INVALID_INDEX) { const Material& material = asset.mMaterials[mMaterial]; - LLColor4 baseColor = material.mMaterial->mBaseColor; + LLColor4 baseColor(glm::value_ptr(material.mPbrMetallicRoughness.mBaseColorFactor)); for (auto& dst : mColors) { dst = LLColor4U(baseColor * LLColor4(dst)); } + + if (material.mUnlit.mPresent) + { // material uses KHR_materials_unlit + mShaderVariant |= LLGLSLShader::GLTFVariant::UNLIT; + unlit = true; + } + + if (material.isMultiUV()) + { + mShaderVariant |= LLGLSLShader::GLTFVariant::MULTI_UV; + } + } + + if (mNormals.empty() && !unlit) + { + mTangents.clear(); + + if (mMode == Mode::POINTS || mMode == Mode::LINES || mMode == Mode::LINE_LOOP || mMode == Mode::LINE_STRIP) + { //no normals and no surfaces, this primitive is unlit + mTangents.clear(); + mShaderVariant |= LLGLSLShader::GLTFVariant::UNLIT; + unlit = true; + } + else + { + // unroll into non-indexed array of flat shaded triangles + MikktMesh data; + if (!data.copy(this)) + { + return false; + } + + data.genNormals(); + data.genTangents(); + data.write(this); + } + } + + if (mTangents.empty() && !unlit) + { // NOTE: must be done last because tangent generation rewrites the other arrays + // adapted from usage of Mikktspace in llvolume.cpp + if (mMode == Mode::POINTS || mMode == Mode::LINES || mMode == Mode::LINE_LOOP || mMode == Mode::LINE_STRIP) + { + // for points and lines, just make sure tangent is perpendicular to normal + mTangents.resize(mNormals.size()); + LLVector4a up(0.f, 0.f, 1.f, 0.f); + LLVector4a left(1.f, 0.f, 0.f, 0.f); + for (U32 i = 0; i < mNormals.size(); ++i) + { + if (fabsf(mNormals[i].getF32ptr()[2]) < 0.999f) + { + mTangents[i] = up.cross3(mNormals[i]); + } + else + { + mTangents[i] = left.cross3(mNormals[i]); + } + + mTangents[i].getF32ptr()[3] = 1.f; + } + } + else + { + MikktMesh data; + if (!data.copy(this)) + { + return false; + } + + data.genTangents(); + data.write(this); + } } - mVertexBuffer->setColorData(mColors.data()); + if (!mNormals.empty()) + { + mask |= LLVertexBuffer::MAP_NORMAL; + } - if (mNormals.empty()) + if (!mTangents.empty()) { - mNormals.resize(mPositions.size(), LLVector4a(0, 0, 1, 0)); + mask |= LLVertexBuffer::MAP_TANGENT; } - mVertexBuffer->setNormalData(mNormals.data()); + mAttributeMask = mask; - if (mTangents.empty()) + if (mMaterial != INVALID_INDEX) { - // TODO: generate tangents if needed - mTangents.resize(mPositions.size(), LLVector4a(1, 0, 0, 1)); + Material& material = asset.mMaterials[mMaterial]; + if (material.mAlphaMode == Material::AlphaMode::BLEND) + { + mShaderVariant |= LLGLSLShader::GLTFVariant::ALPHA_BLEND; + } } - mVertexBuffer->setTangentData(mTangents.data()); + createOctree(); + + return true; +} + +void Primitive::upload(LLVertexBuffer* buffer) +{ + mVertexBuffer = buffer; + // we store these buffer sizes as S32 elsewhere + llassert(mPositions.size() <= size_t(S32_MAX)); + llassert(mIndexArray.size() <= size_t(S32_MAX / 2)); + + llassert(mVertexBuffer != nullptr); + + // assert that buffer can hold this primitive + llassert(mVertexBuffer->getNumVerts() >= mPositions.size() + mVertexOffset); + llassert(mVertexBuffer->getNumIndices() >= mIndexArray.size() + mIndexOffset); + llassert(mVertexBuffer->getTypeMask() == mAttributeMask); + + U32 offset = mVertexOffset; + U32 count = getVertexCount(); + + mVertexBuffer->setPositionData(mPositions.data(), offset, count); + mVertexBuffer->setColorData(mColors.data(), offset, count); + + if (!mNormals.empty()) + { + mVertexBuffer->setNormalData(mNormals.data(), offset, count); + } + if (!mTangents.empty()) + { + mVertexBuffer->setTangentData(mTangents.data(), offset, count); + } if (!mWeights.empty()) { - std::vector<LLVector4a> weight_data; - weight_data.resize(mWeights.size()); + mVertexBuffer->setWeight4Data(mWeights.data(), offset, count); + mVertexBuffer->setJointData(mJoints.data(), offset, count); + } - F32 max_weight = 1.f - FLT_EPSILON*100.f; - LLVector4a maxw(max_weight, max_weight, max_weight, max_weight); - for (U32 i = 0; i < mWeights.size(); ++i) - { - LLVector4a& w = weight_data[i]; - w.setMin(mWeights[i], maxw); - w.add(mJoints[i]); - }; + // flip texcoord y, upload, then flip back (keep the off-spec data in vram only) + vertical_flip(mTexCoords0); + mVertexBuffer->setTexCoord0Data(mTexCoords0.data(), offset, count); + vertical_flip(mTexCoords0); - mVertexBuffer->setWeight4Data(weight_data.data()); + if (!mTexCoords1.empty()) + { + vertical_flip(mTexCoords1); + mVertexBuffer->setTexCoord1Data(mTexCoords1.data(), offset, count); + vertical_flip(mTexCoords1); } - createOctree(); - - mVertexBuffer->unbind(); + if (!mIndexArray.empty()) + { + std::vector<U32> index_array; + index_array.resize(mIndexArray.size()); + for (U32 i = 0; i < mIndexArray.size(); ++i) + { + index_array[i] = mIndexArray[i] + mVertexOffset; + } + mVertexBuffer->setIndexData(index_array.data(), mIndexOffset, getIndexCount()); + } } void initOctreeTriangle(LLVolumeTriangle* tri, F32 scaler, S32 i0, S32 i1, S32 i2, const LLVector4a& v0, const LLVector4a& v1, const LLVector4a& v2) @@ -218,9 +636,9 @@ void Primitive::createOctree() F32 scaler = 0.25f; - if (mMode == TINYGLTF_MODE_TRIANGLES) + if (mMode == Mode::TRIANGLES) { - const U32 num_triangles = mVertexBuffer->getNumIndices() / 3; + const U32 num_triangles = getIndexCount() / 3; // Initialize all the triangles we need mOctreeTriangles.resize(num_triangles); @@ -242,9 +660,9 @@ void Primitive::createOctree() mOctree->insert(tri); } } - else if (mMode == TINYGLTF_MODE_TRIANGLE_STRIP) + else if (mMode == Mode::TRIANGLE_STRIP) { - const U32 num_triangles = mVertexBuffer->getNumIndices() - 2; + const U32 num_triangles = getIndexCount() - 2; // Initialize all the triangles we need mOctreeTriangles.resize(num_triangles); @@ -266,9 +684,9 @@ void Primitive::createOctree() mOctree->insert(tri); } } - else if (mMode == TINYGLTF_MODE_TRIANGLE_FAN) + else if (mMode == Mode::TRIANGLE_FAN) { - const U32 num_triangles = mVertexBuffer->getNumIndices() - 2; + const U32 num_triangles = getIndexCount() - 2; // Initialize all the triangles we need mOctreeTriangles.resize(num_triangles); @@ -290,10 +708,10 @@ void Primitive::createOctree() mOctree->insert(tri); } } - else if (mMode == TINYGLTF_MODE_POINTS || - mMode == TINYGLTF_MODE_LINE || - mMode == TINYGLTF_MODE_LINE_LOOP || - mMode == TINYGLTF_MODE_LINE_STRIP) + else if (mMode == Mode::POINTS || + mMode == Mode::LINES || + mMode == Mode::LINE_LOOP || + mMode == Mode::LINE_STRIP) { // nothing to do, no volume... maybe add some collision geometry around these primitive types? } @@ -327,13 +745,13 @@ const LLVolumeTriangle* Primitive::lineSegmentIntersect(const LLVector4a& start, //create a proxy LLVolumeFace for the raycast LLVolumeFace face; face.mPositions = mPositions.data(); - face.mTexCoords = mTexCoords.data(); + face.mTexCoords = mTexCoords0.data(); face.mNormals = mNormals.data(); face.mTangents = mTangents.data(); face.mIndices = nullptr; // unreferenced - face.mNumIndices = mIndexArray.size(); - face.mNumVertices = mPositions.size(); + face.mNumIndices = S32(mIndexArray.size()); + face.mNumVertices = S32(mPositions.size()); LLOctreeTriangleRayIntersect intersect(start, dir, &face, &closest_t, intersection, tex_coord, normal, tangent_out); intersect.traverse(mOctree); @@ -351,50 +769,48 @@ Primitive::~Primitive() mOctree = nullptr; } - -const Primitive& Primitive::operator=(const tinygltf::Primitive& src) +LLRender::eGeomModes gltf_mode_to_gl_mode(Primitive::Mode mode) { - // load material - mMaterial = src.material; - - // load mode - mMode = src.mode; - - // load indices - mIndices = src.indices; - - // load attributes - for (auto& it : src.attributes) - { - mAttributes[it.first] = it.second; - } - - switch (mMode) - { - case TINYGLTF_MODE_POINTS: - mGLMode = LLRender::POINTS; - break; - case TINYGLTF_MODE_LINE: - mGLMode = LLRender::LINES; - break; - case TINYGLTF_MODE_LINE_LOOP: - mGLMode = LLRender::LINE_LOOP; - break; - case TINYGLTF_MODE_LINE_STRIP: - mGLMode = LLRender::LINE_STRIP; - break; - case TINYGLTF_MODE_TRIANGLES: - mGLMode = LLRender::TRIANGLES; - break; - case TINYGLTF_MODE_TRIANGLE_STRIP: - mGLMode = LLRender::TRIANGLE_STRIP; - break; - case TINYGLTF_MODE_TRIANGLE_FAN: - mGLMode = LLRender::TRIANGLE_FAN; - break; + switch (mode) + { + case Primitive::Mode::POINTS: + return LLRender::POINTS; + case Primitive::Mode::LINES: + return LLRender::LINES; + case Primitive::Mode::LINE_LOOP: + return LLRender::LINE_LOOP; + case Primitive::Mode::LINE_STRIP: + return LLRender::LINE_STRIP; + case Primitive::Mode::TRIANGLES: + return LLRender::TRIANGLES; + case Primitive::Mode::TRIANGLE_STRIP: + return LLRender::TRIANGLE_STRIP; + case Primitive::Mode::TRIANGLE_FAN: + return LLRender::TRIANGLE_FAN; default: - mGLMode = GL_TRIANGLES; + return LLRender::TRIANGLES; } +} + +void Primitive::serialize(boost::json::object& dst) const +{ + write(mMaterial, "material", dst, -1); + write(mMode, "mode", dst, Primitive::Mode::TRIANGLES); + write(mIndices, "indices", dst, INVALID_INDEX); + write(mAttributes, "attributes", dst); +} +const Primitive& Primitive::operator=(const Value& src) +{ + if (src.is_object()) + { + copy(src, "material", mMaterial); + copy(src, "mode", mMode); + copy(src, "indices", mIndices); + copy(src, "attributes", mAttributes); + + mGLMode = gltf_mode_to_gl_mode(mMode); + } return *this; } + diff --git a/indra/newview/gltf/primitive.h b/indra/newview/gltf/primitive.h index 07e8e7deb2..304eb26432 100644 --- a/indra/newview/gltf/primitive.h +++ b/indra/newview/gltf/primitive.h @@ -28,35 +28,39 @@ #include "llvertexbuffer.h" #include "llvolumeoctree.h" +#include "boost/json.hpp" // LL GLTF Implementation namespace LL { namespace GLTF { + using Value = boost::json::value; class Asset; - constexpr U32 ATTRIBUTE_MASK = - LLVertexBuffer::MAP_VERTEX | - LLVertexBuffer::MAP_NORMAL | - LLVertexBuffer::MAP_TEXCOORD0 | - LLVertexBuffer::MAP_TANGENT | - LLVertexBuffer::MAP_COLOR; - class Primitive { public: - ~Primitive(); + enum class Mode : U8 + { + POINTS, + LINES, + LINE_LOOP, + LINE_STRIP, + TRIANGLES, + TRIANGLE_STRIP, + TRIANGLE_FAN + }; - // GPU copy of mesh data - LLPointer<LLVertexBuffer> mVertexBuffer; + ~Primitive(); // CPU copy of mesh data - std::vector<LLVector2> mTexCoords; + std::vector<LLVector2> mTexCoords0; + std::vector<LLVector2> mTexCoords1; std::vector<LLVector4a> mNormals; std::vector<LLVector4a> mTangents; std::vector<LLVector4a> mPositions; - std::vector<LLVector4a> mJoints; + std::vector<U64> mJoints; std::vector<LLVector4a> mWeights; std::vector<LLColor4U> mColors; std::vector<U32> mIndexArray; @@ -64,18 +68,33 @@ namespace LL // raycast acceleration structure LLPointer<LLVolumeOctree> mOctree; std::vector<LLVolumeTriangle> mOctreeTriangles; - + S32 mMaterial = -1; - U32 mMode = TINYGLTF_MODE_TRIANGLES; // default to triangles - U32 mGLMode = LLRender::TRIANGLES; + Mode mMode = Mode::TRIANGLES; // default to triangles + LLRender::eGeomModes mGLMode = LLRender::TRIANGLES; // for use with LLRender S32 mIndices = -1; - std::unordered_map<std::string, int> mAttributes; + + // shader variant according to LLGLSLShader::GLTFVariant flags + U8 mShaderVariant = 0; + + // vertex attribute mask + U32 mAttributeMask = 0; + + // backpointer to vertex buffer (owned by Asset) + LLPointer<LLVertexBuffer> mVertexBuffer; + U32 mVertexOffset = 0; + U32 mIndexOffset = 0; + + U32 getVertexCount() const { return (U32) mPositions.size(); } + U32 getIndexCount() const { return (U32) mIndexArray.size(); } + + std::unordered_map<std::string, S32> mAttributes; // create octree based on vertex buffer // must be called before buffer is unmapped and after buffer is populated with good data void createOctree(); - //get the LLVolumeTriangle that intersects with the given line segment at the point + //get the LLVolumeTriangle that intersects with the given line segment at the point //closest to start. Moves end to the point of intersection. Returns nullptr if no intersection. //Line segment must be in the same coordinate frame as this Primitive const LLVolumeTriangle* lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, @@ -84,10 +103,16 @@ namespace LL LLVector4a* normal = NULL, // return the surface normal at the intersection point LLVector4a* tangent = NULL // return the surface tangent at the intersection point ); - - const Primitive& operator=(const tinygltf::Primitive& src); - void allocateGLResources(Asset& asset); + void serialize(boost::json::object& obj) const; + const Primitive& operator=(const Value& src); + + bool prep(Asset& asset); + + // upload geometry to given vertex buffer + // asserts that buffer is bound + // asserts that buffer is valid for this primitive + void upload(LLVertexBuffer* buffer); }; } } diff --git a/indra/newview/gltfscenemanager.cpp b/indra/newview/gltfscenemanager.cpp index 7003eab6d0..7b2de4d6de 100644 --- a/indra/newview/gltfscenemanager.cpp +++ b/indra/newview/gltfscenemanager.cpp @@ -39,7 +39,14 @@ #include "gltf/asset.h" #include "pipeline.h" #include "llviewershadermgr.h" +#include "llviewertexturelist.h" +#include "llimagej2c.h" +#include "llfloaterperms.h" +#include "llagentbenefits.h" +#include "llfilesystem.h" +#include "boost/json.hpp" +#define GLTF_SIM_SUPPORT 1 using namespace LL; @@ -66,38 +73,253 @@ void GLTFSceneManager::load() } }, LLFilePicker::FFLOAD_GLTF, - true); + false); } else { - LLNotificationsUtil::add("GLTFPreviewSelection"); + LLNotificationsUtil::add("GLTFOpenSelection"); } } -void GLTFSceneManager::load(const std::string& filename) +void GLTFSceneManager::saveAs() { - tinygltf::Model model; - LLTinyGLTFHelper::loadModel(filename, model); - - LLPointer<Asset> asset = new Asset(); - *asset = model; + LLViewerObject* obj = LLSelectMgr::instance().getSelection()->getFirstRootObject(); + if (obj && obj->mGLTFAsset) + { + LLFilePickerReplyThread::startPicker( + [](const std::vector<std::string>& filenames, LLFilePicker::ELoadFilter load_filter, LLFilePicker::ESaveFilter save_filter) + { + if (LLAppViewer::instance()->quitRequested()) + { + return; + } + if (filenames.size() > 0) + { + GLTFSceneManager::instance().save(filenames[0]); + } + }, + LLFilePicker::FFSAVE_GLTF, + "scene.gltf"); + } + else + { + LLNotificationsUtil::add("GLTFSaveSelection"); + } +} - gDebugProgram.bind(); // bind a shader to satisfy LLVertexBuffer assertions - asset->allocateGLResources(filename, model); - asset->updateTransforms(); +void GLTFSceneManager::uploadSelection() +{ + if (mUploadingAsset) + { // upload already in progress + LLNotificationsUtil::add("GLTFUploadInProgress"); + return; + } - // hang the asset off the currently selected object, or off of the avatar if no object is selected LLViewerObject* obj = LLSelectMgr::instance().getSelection()->getFirstRootObject(); + if (obj && obj->mGLTFAsset) + { + // make a copy of the asset prior to uploading + mUploadingAsset = std::make_shared<Asset>(); + mUploadingObject = obj; + *mUploadingAsset = *obj->mGLTFAsset; - if (obj) - { // assign to self avatar - obj->mGLTFAsset = asset; + GLTF::Asset& asset = *mUploadingAsset; + + for (auto& image : asset.mImages) + { + if (image.mTexture.notNull()) + { + mPendingImageUploads++; + + LLPointer<LLImageRaw> raw; + + if (image.mBufferView != INVALID_INDEX) + { + BufferView& view = asset.mBufferViews[image.mBufferView]; + Buffer& buffer = asset.mBuffers[view.mBuffer]; + + raw = LLViewerTextureManager::getRawImageFromMemory(buffer.mData.data() + view.mByteOffset, view.mByteLength, image.mMimeType); + + image.clearData(asset); + } + else + { + raw = image.mTexture->getCachedRawImage(); + } + + if (raw.notNull()) + { + LLPointer<LLImageJ2C> j2c = LLViewerTextureList::convertToUploadFile(raw); + + std::string buffer; + buffer.assign((const char*)j2c->getData(), j2c->getDataSize()); + + LLUUID asset_id = LLUUID::generateNewID(); + + std::string name; + S32 idx = (S32)(&image - &asset.mImages[0]); + + if (image.mName.empty()) + { + + name = llformat("Image_%d", idx); + } + else + { + name = image.mName; + } - if (std::find(mObjects.begin(), mObjects.end(), obj) == mObjects.end()) + LLNewBufferedResourceUploadInfo::uploadFailure_f failure = [this](LLUUID assetId, LLSD response, std::string reason) + { + // TODO: handle failure + mPendingImageUploads--; + return false; + }; + + + LLNewBufferedResourceUploadInfo::uploadFinish_f finish = [this, idx, raw, j2c](LLUUID assetId, LLSD response) + { + if (mUploadingAsset && mUploadingAsset->mImages.size() > idx) + { + mUploadingAsset->mImages[idx].mUri = assetId.asString(); + mPendingImageUploads--; + } + }; + + S32 expected_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(j2c); + + LLResourceUploadInfo::ptr_t uploadInfo(std::make_shared<LLNewBufferedResourceUploadInfo>( + buffer, + asset_id, + name, + name, + 0, + LLFolderType::FT_TEXTURE, + LLInventoryType::IT_TEXTURE, + LLAssetType::AT_TEXTURE, + LLFloaterPerms::getNextOwnerPerms("Uploads"), + LLFloaterPerms::getGroupPerms("Uploads"), + LLFloaterPerms::getEveryonePerms("Uploads"), + expected_upload_cost, + false, + finish, + failure)); + + upload_new_resource(uploadInfo); + } + } + } + + // upload .bin + for (auto& bin : asset.mBuffers) { - mObjects.push_back(obj); + mPendingBinaryUploads++; + + S32 idx = (S32)(&bin - &asset.mBuffers[0]); + + std::string buffer; + buffer.assign((const char*)bin.mData.data(), bin.mData.size()); + + LLUUID asset_id = LLUUID::generateNewID(); + + LLNewBufferedResourceUploadInfo::uploadFailure_f failure = [this](LLUUID assetId, LLSD response, std::string reason) + { + // TODO: handle failure + mPendingBinaryUploads--; + mUploadingAsset = nullptr; + mUploadingObject = nullptr; + LL_WARNS("GLTF") << "Failed to upload GLTF binary: " << reason << LL_ENDL; + LL_WARNS("GLTF") << response << LL_ENDL; + return false; + }; + + LLNewBufferedResourceUploadInfo::uploadFinish_f finish = [this, idx](LLUUID assetId, LLSD response) + { + if (mUploadingAsset && mUploadingAsset->mBuffers.size() > idx) + { + mUploadingAsset->mBuffers[idx].mUri = assetId.asString(); + mPendingBinaryUploads--; + + // HACK: save buffer to cache to emulate a successful download + LLFileSystem cache(assetId, LLAssetType::AT_GLTF_BIN, LLFileSystem::WRITE); + auto& data = mUploadingAsset->mBuffers[idx].mData; + + llassert(data.size() <= size_t(S32_MAX)); + cache.write((const U8 *) data.data(), S32(data.size())); + } + }; +#if GLTF_SIM_SUPPORT + S32 expected_upload_cost = 1; + + LLResourceUploadInfo::ptr_t uploadInfo(std::make_shared<LLNewBufferedResourceUploadInfo>( + buffer, + asset_id, + "", + "", + 0, + LLFolderType::FT_NONE, + LLInventoryType::IT_GLTF_BIN, + LLAssetType::AT_GLTF_BIN, + LLFloaterPerms::getNextOwnerPerms("Uploads"), + LLFloaterPerms::getGroupPerms("Uploads"), + LLFloaterPerms::getEveryonePerms("Uploads"), + expected_upload_cost, + false, + finish, + failure)); + + upload_new_resource(uploadInfo); +#else + // dummy finish + finish(LLUUID::generateNewID(), LLSD()); +#endif + } + } + else + { + LLNotificationsUtil::add("GLTFUploadSelection"); + } +} + +void GLTFSceneManager::save(const std::string& filename) +{ + LLViewerObject* obj = LLSelectMgr::instance().getSelection()->getFirstRootObject(); + if (obj && obj->mGLTFAsset) + { + Asset* asset = obj->mGLTFAsset.get(); + if (!asset->save(filename)) + { + LLNotificationsUtil::add("GLTFSaveFailed"); + } + } +} + +void GLTFSceneManager::load(const std::string& filename) +{ + std::shared_ptr<Asset> asset = std::make_shared<Asset>(); + + if (asset->load(filename)) + { + gDebugProgram.bind(); // bind a shader to satisfy LLVertexBuffer assertions + asset->updateTransforms(); + + // hang the asset off the currently selected object, or off of the avatar if no object is selected + LLViewerObject* obj = LLSelectMgr::instance().getSelection()->getFirstRootObject(); + + if (obj) + { // assign to self avatar + obj->mGLTFAsset = asset; + obj->markForUpdate(); + if (std::find(mObjects.begin(), mObjects.end(), obj) == mObjects.end()) + { + mObjects.push_back(obj); + } } } + else + { + LLNotificationsUtil::add("GLTFLoadFailed"); + } } GLTFSceneManager::~GLTFSceneManager() @@ -115,8 +337,108 @@ void GLTFSceneManager::renderAlpha() render(false); } +void GLTFSceneManager::addGLTFObject(LLViewerObject* obj, LLUUID gltf_id) +{ + llassert(obj->getVolume()->getParams().getSculptID() == gltf_id); + llassert(obj->getVolume()->getParams().getSculptType() == LL_SCULPT_TYPE_GLTF); + + obj->ref(); + gAssetStorage->getAssetData(gltf_id, LLAssetType::AT_GLTF, onGLTFLoadComplete, obj); +} + +//static +void GLTFSceneManager::onGLTFBinLoadComplete(const LLUUID& id, LLAssetType::EType asset_type, void* user_data, S32 status, LLExtStat ext_status) +{ + LLViewerObject* obj = (LLViewerObject*)user_data; + llassert(asset_type == LLAssetType::AT_GLTF_BIN); + + if (status == LL_ERR_NOERR) + { + if (obj) + { + // find the Buffer with the given id in the asset + if (obj->mGLTFAsset) + { + obj->mGLTFAsset->mPendingBuffers--; + + + if (obj->mGLTFAsset->mPendingBuffers == 0) + { + if (obj->mGLTFAsset->prep()) + { + GLTFSceneManager& mgr = GLTFSceneManager::instance(); + if (std::find(mgr.mObjects.begin(), mgr.mObjects.end(), obj) == mgr.mObjects.end()) + { + GLTFSceneManager::instance().mObjects.push_back(obj); + } + } + else + { + LL_WARNS("GLTF") << "Failed to prepare GLTF asset: " << id << LL_ENDL; + obj->mGLTFAsset = nullptr; + } + } + } + } + } + else + { + LL_WARNS("GLTF") << "Failed to load GLTF asset: " << id << LL_ENDL; + obj->unref(); + } +} + +//static +void GLTFSceneManager::onGLTFLoadComplete(const LLUUID& id, LLAssetType::EType asset_type, void* user_data, S32 status, LLExtStat ext_status) +{ + LLViewerObject* obj = (LLViewerObject*)user_data; + llassert(asset_type == LLAssetType::AT_GLTF); + + if (status == LL_ERR_NOERR) + { + if (obj) + { + LLFileSystem file(id, asset_type, LLFileSystem::READ); + std::string data; + S32 file_size = file.getSize(); + data.resize(file_size); + file.read((U8*)data.data(), file_size); + + boost::json::value json = boost::json::parse(data); + + std::shared_ptr<Asset> asset = std::make_shared<Asset>(json); + obj->mGLTFAsset = asset; + + for (auto& buffer : asset->mBuffers) + { + // for now just assume the buffer is already in the asset cache + LLUUID buffer_id; + if (LLUUID::parseUUID(buffer.mUri, &buffer_id)) + { + asset->mPendingBuffers++; + + gAssetStorage->getAssetData(buffer_id, LLAssetType::AT_GLTF_BIN, onGLTFBinLoadComplete, obj); + } + else + { + LL_WARNS("GLTF") << "Buffer URI is not a valid UUID: " << buffer.mUri << LL_ENDL; + obj->unref(); + return; + } + } + } + } + else + { + LL_WARNS("GLTF") << "Failed to load GLTF asset: " << id << LL_ENDL; + obj->unref(); + } +} + void GLTFSceneManager::update() { + LL_PROFILE_ZONE_SCOPED_CATEGORY_GLTF; + for (U32 i = 0; i < mObjects.size(); ++i) { if (mObjects[i]->isDead() || mObjects[i]->mGLTFAsset == nullptr) @@ -126,21 +448,125 @@ void GLTFSceneManager::update() continue; } - Asset* asset = mObjects[i]->mGLTFAsset; + mObjects[i]->mGLTFAsset->update(); + } + + // process pending uploads + if (mUploadingAsset && !mGLTFUploadPending) + { + if (mPendingImageUploads == 0 && mPendingBinaryUploads == 0) + { + boost::json::object obj; + mUploadingAsset->serialize(obj); + std::string buffer = boost::json::serialize(obj, {}); + + LLNewBufferedResourceUploadInfo::uploadFailure_f failure = [this](LLUUID assetId, LLSD response, std::string reason) + { + // TODO: handle failure + LL_WARNS("GLTF") << "Failed to upload GLTF json: " << reason << LL_ENDL; + LL_WARNS("GLTF") << response << LL_ENDL; - asset->update(); + mUploadingAsset = nullptr; + mUploadingObject = nullptr; + mGLTFUploadPending = false; + return false; + }; + + LLNewBufferedResourceUploadInfo::uploadFinish_f finish = [this, buffer](LLUUID assetId, LLSD response) + { + LLAppViewer::instance()->postToMainCoro( + [=]() + { + if (mUploadingAsset) + { + // HACK: save buffer to cache to emulate a successful upload + LLFileSystem cache(assetId, LLAssetType::AT_GLTF, LLFileSystem::WRITE); + + LL_INFOS("GLTF") << "Uploaded GLTF json: " << assetId << LL_ENDL; + llassert(buffer.size() <= size_t(S32_MAX)); + cache.write((const U8 *) buffer.c_str(), S32(buffer.size())); + + mUploadingAsset = nullptr; + } + + if (mUploadingObject) + { + mUploadingObject->mGLTFAsset = nullptr; + mUploadingObject->setGLTFAsset(assetId); + mUploadingObject->markForUpdate(); + mUploadingObject = nullptr; + } + + mGLTFUploadPending = false; + }); + }; + +#if GLTF_SIM_SUPPORT + S32 expected_upload_cost = 1; + LLUUID asset_id = LLUUID::generateNewID(); + + mGLTFUploadPending = true; + + LLResourceUploadInfo::ptr_t uploadInfo(std::make_shared<LLNewBufferedResourceUploadInfo>( + buffer, + asset_id, + "", + "", + 0, + LLFolderType::FT_NONE, + LLInventoryType::IT_GLTF, + LLAssetType::AT_GLTF, + LLFloaterPerms::getNextOwnerPerms("Uploads"), + LLFloaterPerms::getGroupPerms("Uploads"), + LLFloaterPerms::getEveryonePerms("Uploads"), + expected_upload_cost, + false, + finish, + failure)); + + upload_new_resource(uploadInfo); +#else + // dummy finish + finish(LLUUID::generateNewID(), LLSD()); +#endif + } + } +} +void GLTFSceneManager::render(bool opaque, bool rigged, bool unlit) +{ + U8 variant = 0; + if (rigged) + { + variant |= LLGLSLShader::GLTFVariant::RIGGED; + } + if (!opaque) + { + variant |= LLGLSLShader::GLTFVariant::ALPHA_BLEND; } + if (unlit) + { + variant |= LLGLSLShader::GLTFVariant::UNLIT; + } + + render(variant); } -void GLTFSceneManager::render(bool opaque, bool rigged) +void GLTFSceneManager::render(U8 variant) { - // for debugging, just render the whole scene as opaque - // by traversing the whole scenegraph - // Assumes camera transform is already set and - // appropriate shader is already bound + LL_PROFILE_ZONE_SCOPED_CATEGORY_GLTF; + // just render the whole scene by traversing the whole scenegraph + // Assumes camera transform is already set and appropriate shader is already bound. + // Eventually we'll want a smarter render pipe that has pre-sorted the scene graph + // into buckets by material and shader. + + // HACK -- implicitly render multi-uv variant + if (!(variant & LLGLSLShader::GLTFVariant::MULTI_UV)) + { + render((U8) (variant | LLGLSLShader::GLTFVariant::MULTI_UV)); + } - gGL.matrixMode(LLRender::MM_MODELVIEW); + bool rigged = variant & LLGLSLShader::GLTFVariant::RIGGED; for (U32 i = 0; i < mObjects.size(); ++i) { @@ -151,24 +577,205 @@ void GLTFSceneManager::render(bool opaque, bool rigged) continue; } - Asset* asset = mObjects[i]->mGLTFAsset; - + Asset* asset = mObjects[i]->mGLTFAsset.get(); gGL.pushMatrix(); LLMatrix4a mat = mObjects[i]->getGLTFAssetToAgentTransform(); - LLMatrix4a modelview; - modelview.loadu(gGLModelView); - - matMul(mat, modelview, modelview); + // provide a modelview matrix that goes from asset to camera space + // (matrix palettes are in asset space) + gGL.loadMatrix(gGLModelView); + gGL.multMatrix(mat.getF32ptr()); - asset->updateRenderTransforms(modelview); - asset->render(opaque, rigged); + render(*asset, variant); gGL.popMatrix(); } } +void GLTFSceneManager::render(Asset& asset, U8 variant) +{ + LL_PROFILE_ZONE_SCOPED_CATEGORY_GLTF; + + for (U32 ds = 0; ds < 2; ++ds) + { + RenderData& rd = asset.mRenderData[ds]; + auto& batches = rd.mBatches[variant]; + + if (batches.empty()) + { + return; + } + + LLGLDisable cull_face(ds == 1 ? GL_CULL_FACE : 0); + + bool opaque = !(variant & LLGLSLShader::GLTFVariant::ALPHA_BLEND); + bool rigged = variant & LLGLSLShader::GLTFVariant::RIGGED; + + bool shader_bound = false; + + for (U32 i = 0; i < batches.size(); ++i) + { + if (batches[i].mPrimitives.empty() || batches[i].mVertexBuffer.isNull()) + { + continue; + } + + if (!shader_bound) + { // don't bind the shader until we know we have somthing to render + if (opaque) + { + gGLTFPBRMetallicRoughnessProgram.bind(variant); + } + else + { // alpha shaders need all the shadow map setup etc + gPipeline.bindDeferredShader(gGLTFPBRMetallicRoughnessProgram.mGLTFVariants[variant]); + } + + if (!rigged) + { + glBindBufferBase(GL_UNIFORM_BUFFER, LLGLSLShader::UB_GLTF_NODES, asset.mNodesUBO); + } + + glBindBufferBase(GL_UNIFORM_BUFFER, LLGLSLShader::UB_GLTF_MATERIALS, asset.mMaterialsUBO); + + for (U32 i = 0; i < TEXTURE_TYPE_COUNT; ++i) + { + mLastTexture[i] = -2; + } + + gGL.syncMatrices(); + shader_bound = true; + } + + { + LL_PROFILE_ZONE_NAMED_CATEGORY_GLTF("gltfdc - set vb"); + batches[i].mVertexBuffer->setBuffer(); + } + + S32 mat_idx = i - 1; + if (mat_idx != INVALID_INDEX) + { + Material& material = asset.mMaterials[mat_idx]; + bind(asset, material); + } + else + { + LLFetchedGLTFMaterial::sDefault.bind(); + LLGLSLShader::sCurBoundShaderPtr->uniform1i(LLShaderMgr::GLTF_MATERIAL_ID, -1); + } + + for (auto& pdata : batches[i].mPrimitives) + { + LL_PROFILE_ZONE_NAMED_CATEGORY_GLTF("GLTF draw call"); + Node& node = asset.mNodes[pdata.mNodeIndex]; + Mesh& mesh = asset.mMeshes[node.mMesh]; + Primitive& primitive = mesh.mPrimitives[pdata.mPrimitiveIndex]; + + if (rigged) + { + LL_PROFILE_ZONE_NAMED_CATEGORY_GLTF("gltfdc - bind skin"); + llassert(node.mSkin != INVALID_INDEX); + Skin& skin = asset.mSkins[node.mSkin]; + glBindBufferBase(GL_UNIFORM_BUFFER, LLGLSLShader::UB_GLTF_JOINTS, skin.mUBO); + } + else + { + LLGLSLShader::sCurBoundShaderPtr->uniform1i(LLShaderMgr::GLTF_NODE_ID, pdata.mNodeIndex); + } + + { + LL_PROFILE_ZONE_NAMED_CATEGORY_GLTF("gltfdc - push vb"); + + primitive.mVertexBuffer->drawRangeFast(primitive.mGLMode, primitive.mVertexOffset, primitive.mVertexOffset + primitive.getVertexCount() - 1, primitive.getIndexCount(), primitive.mIndexOffset); + } + } + } + } +} + +void GLTFSceneManager::bindTexture(Asset& asset, TextureType texture_type, TextureInfo& info, LLViewerTexture* fallback) +{ + U8 type_idx = (U8)texture_type; + + if (info.mIndex == mLastTexture[type_idx]) + { //already bound + return; + } + + S32 uniform[] = + { + LLShaderMgr::DIFFUSE_MAP, + LLShaderMgr::NORMAL_MAP, + LLShaderMgr::METALLIC_ROUGHNESS_MAP, + LLShaderMgr::OCCLUSION_MAP, + LLShaderMgr::EMISSIVE_MAP + }; + + S32 channel = LLGLSLShader::sCurBoundShaderPtr->getTextureChannel(uniform[(U8)type_idx]); + + if (channel > -1) + { + glActiveTexture(GL_TEXTURE0 + channel); + + if (info.mIndex != INVALID_INDEX) + { + Texture& texture = asset.mTextures[info.mIndex]; + + LLViewerTexture* tex = asset.mImages[texture.mSource].mTexture; + if (tex) + { + LL_PROFILE_ZONE_NAMED_CATEGORY_GLTF("gl bind texture"); + glBindTexture(GL_TEXTURE_2D, tex->getTexName()); + + if (channel != -1 && texture.mSampler != -1) + { // set sampler state + Sampler& sampler = asset.mSamplers[texture.mSampler]; + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, sampler.mWrapS); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, sampler.mWrapT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, sampler.mMagFilter); + + // NOTE: do not set min filter. Always respect client preference for min filter + } + else + { + // set default sampler state + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + } + } + else + { + glBindTexture(GL_TEXTURE_2D, fallback->getTexName()); + } + } + else + { + glBindTexture(GL_TEXTURE_2D, fallback->getTexName()); + } + } +} + + +void GLTFSceneManager::bind(Asset& asset, Material& material) +{ + LL_PROFILE_ZONE_SCOPED_CATEGORY_GLTF; + LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; + + bindTexture(asset, TextureType::BASE_COLOR, material.mPbrMetallicRoughness.mBaseColorTexture, LLViewerFetchedTexture::sWhiteImagep); + + if (!LLPipeline::sShadowRender) + { + bindTexture(asset, TextureType::NORMAL, material.mNormalTexture, LLViewerFetchedTexture::sFlatNormalImagep); + bindTexture(asset, TextureType::METALLIC_ROUGHNESS, material.mPbrMetallicRoughness.mMetallicRoughnessTexture, LLViewerFetchedTexture::sWhiteImagep); + bindTexture(asset, TextureType::OCCLUSION, material.mOcclusionTexture, LLViewerFetchedTexture::sWhiteImagep); + bindTexture(asset, TextureType::EMISSIVE, material.mEmissiveTexture, LLViewerFetchedTexture::sWhiteImagep); + } + + shader->uniform1i(LLShaderMgr::GLTF_MATERIAL_ID, &material - &asset.mMaterials[0]); +} + LLMatrix4a inverse(const LLMatrix4a& mat) { glh::matrix4f m((F32*)mat.mMatrix); @@ -178,7 +785,7 @@ LLMatrix4a inverse(const LLMatrix4a& mat) return ret; } -bool GLTFSceneManager::lineSegmentIntersect(LLVOVolume* obj, Asset* asset, const LLVector4a& start, const LLVector4a& end, S32 face, BOOL pick_transparent, BOOL pick_rigged, BOOL pick_unselectable, S32* node_hit, S32* primitive_hit, +bool GLTFSceneManager::lineSegmentIntersect(LLVOVolume* obj, Asset* asset, const LLVector4a& start, const LLVector4a& end, S32 face, bool pick_transparent, bool pick_rigged, bool pick_unselectable, S32* node_hit, S32* primitive_hit, LLVector4a* intersection, LLVector2* tex_coord, LLVector4a* normal, LLVector4a* tangent) { @@ -272,10 +879,10 @@ bool GLTFSceneManager::lineSegmentIntersect(LLVOVolume* obj, Asset* asset, const } LLDrawable* GLTFSceneManager::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, - BOOL pick_transparent, - BOOL pick_rigged, - BOOL pick_unselectable, - BOOL pick_reflection_probe, + bool pick_transparent, + bool pick_rigged, + bool pick_unselectable, + bool pick_reflection_probe, S32* node_hit, // return the index of the node that was hit S32* primitive_hit, // return the index of the primitive that was hit LLVector4a* intersection, // return the intersection point @@ -298,7 +905,7 @@ LLDrawable* GLTFSceneManager::lineSegmentIntersect(const LLVector4a& start, cons } // temporary debug -- always double check objects that have GLTF scenes hanging off of them even if the ray doesn't intersect the object bounds - if (lineSegmentIntersect((LLVOVolume*) mObjects[i].get(), mObjects[i]->mGLTFAsset, start, local_end, -1, pick_transparent, pick_rigged, pick_unselectable, node_hit, primitive_hit, &position, tex_coord, normal, tangent)) + if (lineSegmentIntersect((LLVOVolume*) mObjects[i].get(), mObjects[i]->mGLTFAsset.get(), start, local_end, -1, pick_transparent, pick_rigged, pick_unselectable, node_hit, primitive_hit, &position, tex_coord, normal, tangent)) { local_end = position; if (intersection) @@ -326,16 +933,21 @@ void renderAssetDebug(LLViewerObject* obj, Asset* asset) // assumes modelview matrix is already set gGL.pushMatrix(); - // get raycast in asset space LLMatrix4a agent_to_asset = obj->getAgentToGLTFAssetTransform(); - LLVector4a start; - LLVector4a end; + gGL.multMatrix(agent_to_asset.getF32ptr()); + + vec4 start; + vec4 end; - agent_to_asset.affineTransform(gDebugRaycastStart, start); - agent_to_asset.affineTransform(gDebugRaycastEnd, end); + LLVector4a t; + agent_to_asset.affineTransform(gDebugRaycastStart, t); + start = glm::make_vec4(t.getF32ptr()); + agent_to_asset.affineTransform(gDebugRaycastEnd, t); + end = glm::make_vec4(t.getF32ptr()); + start.w = end.w = 1.0; for (auto& node : asset->mNodes) { @@ -343,7 +955,8 @@ void renderAssetDebug(LLViewerObject* obj, Asset* asset) if (node.mMesh != INVALID_INDEX) { - gGL.loadMatrix((F32*)node.mRenderMatrix.mMatrix); + gGL.pushMatrix(); + gGL.multMatrix((F32*)glm::value_ptr(node.mAssetMatrix)); // draw bounding box of mesh primitives if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_BBOXES)) @@ -361,24 +974,24 @@ void renderAssetDebug(LLViewerObject* obj, Asset* asset) } } -#if 0 +#if 1 if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_RAYCAST)) { gGL.flush(); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); // convert raycast to node local space - LLVector4a local_start; - LLVector4a local_end; - - node.mAssetMatrixInv.affineTransform(start, local_start); - node.mAssetMatrixInv.affineTransform(end, local_end); + vec4 local_start = node.mAssetMatrixInv * start; + vec4 local_end = node.mAssetMatrixInv * end; for (auto& primitive : mesh.mPrimitives) { if (primitive.mOctree.notNull()) { - renderOctreeRaycast(local_start, local_end, primitive.mOctree); + LLVector4a s, e; + s.load3(glm::value_ptr(local_start)); + e.load3(glm::value_ptr(local_end)); + renderOctreeRaycast(s, e, primitive.mOctree); } } @@ -386,6 +999,7 @@ void renderAssetDebug(LLViewerObject* obj, Asset* asset) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); } #endif + gGL.popMatrix(); } } @@ -404,35 +1018,15 @@ void GLTFSceneManager::renderDebug() gDebugProgram.bind(); + gGL.pushMatrix(); + gGL.loadMatrix(gGLModelView); + LLGLDisable cullface(GL_CULL_FACE); LLGLEnable blend(GL_BLEND); gGL.setSceneBlendType(LLRender::BT_ALPHA); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gPipeline.disableLights(); - // force update all mRenderMatrix, not just nodes with meshes - for (auto& obj : mObjects) - { - if (obj->isDead() || obj->mGLTFAsset == nullptr) - { - continue; - } - - LLMatrix4a mat = obj->getGLTFAssetToAgentTransform(); - - LLMatrix4a modelview; - modelview.loadu(gGLModelView); - - matMul(mat, modelview, modelview); - - Asset* asset = obj->mGLTFAsset; - - for (auto& node : asset->mNodes) - { - matMul(node.mAssetMatrix, modelview, node.mRenderMatrix); - } - } - for (auto& obj : mObjects) { if (obj->isDead() || obj->mGLTFAsset == nullptr) @@ -440,14 +1034,7 @@ void GLTFSceneManager::renderDebug() continue; } - Asset* asset = obj->mGLTFAsset; - - LLMatrix4a mat = obj->getGLTFAssetToAgentTransform(); - - LLMatrix4a modelview; - modelview.loadu(gGLModelView); - - matMul(mat, modelview, modelview); + Asset* asset = obj->mGLTFAsset.get(); renderAssetDebug(obj, asset); } @@ -458,10 +1045,7 @@ void GLTFSceneManager::renderDebug() for (U32 i = 0; i < 2; ++i) { LLGLDepthTest depth(GL_TRUE, i == 0 ? GL_FALSE : GL_TRUE, i == 0 ? GL_GREATER : GL_LEQUAL); - LLGLState blend(GL_BLEND, i == 0 ? TRUE : FALSE); - - - gGL.pushMatrix(); + LLGLState blend(GL_BLEND, i == 0 ? GL_TRUE : GL_FALSE); for (auto& obj : mObjects) { @@ -470,21 +1054,16 @@ void GLTFSceneManager::renderDebug() continue; } - LLMatrix4a mat = obj->getGLTFAssetToAgentTransform(); + gGL.pushMatrix(); - LLMatrix4a modelview; - modelview.loadu(gGLModelView); + gGL.multMatrix(obj->getGLTFAssetToAgentTransform().getF32ptr()); - matMul(mat, modelview, modelview); - - Asset* asset = obj->mGLTFAsset; + Asset* asset = obj->mGLTFAsset.get(); for (auto& node : asset->mNodes) { - // force update all mRenderMatrix, not just nodes with meshes - matMul(node.mAssetMatrix, modelview, node.mRenderMatrix); - - gGL.loadMatrix(node.mRenderMatrix.getF32ptr()); + gGL.pushMatrix(); + gGL.multMatrix(glm::value_ptr(node.mAssetMatrix)); // render x-axis red, y-axis green, z-axis blue gGL.color4f(1.f, 0.f, 0.f, 0.5f); gGL.begin(LLRender::LINES); @@ -514,16 +1093,18 @@ void GLTFSceneManager::renderDebug() { Node& child = asset->mNodes[child_idx]; gGL.vertex3f(0.f, 0.f, 0.f); - gGL.vertex3fv(child.mMatrix.getTranslation().getF32ptr()); + + + gGL.vertex3fv(glm::value_ptr(child.mMatrix[3])); } gGL.end(); gGL.flush(); + gGL.popMatrix(); } - } - gGL.popMatrix(); + gGL.popMatrix(); + } } - } @@ -533,32 +1114,41 @@ void GLTFSceneManager::renderDebug() S32 primitive_hit = -1; LLVector4a intersection; - LLDrawable* drawable = lineSegmentIntersect(gDebugRaycastStart, gDebugRaycastEnd, TRUE, TRUE, TRUE, TRUE, &node_hit, &primitive_hit, &intersection, nullptr, nullptr, nullptr); + LLDrawable* drawable = lineSegmentIntersect(gDebugRaycastStart, gDebugRaycastEnd, true, true, true, true, &node_hit, &primitive_hit, &intersection, nullptr, nullptr, nullptr); if (drawable) { - gGL.pushMatrix(); - Asset* asset = drawable->getVObj()->mGLTFAsset; - Node* node = &asset->mNodes[node_hit]; - Primitive* primitive = &asset->mMeshes[node->mMesh].mPrimitives[primitive_hit]; - gGL.flush(); - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - gGL.color3f(1, 0, 1); - drawBoxOutline(intersection, LLVector4a(0.1f, 0.1f, 0.1f, 0.f)); - - gGL.loadMatrix((F32*) node->mRenderMatrix.mMatrix); + LLViewerObject* obj = drawable->getVObj(); + if (obj) + { + gGL.pushMatrix(); + gGL.multMatrix(obj->getGLTFAssetToAgentTransform().getF32ptr()); + Asset* asset = obj->mGLTFAsset.get(); + Node* node = &asset->mNodes[node_hit]; + Primitive* primitive = &asset->mMeshes[node->mMesh].mPrimitives[primitive_hit]; + gGL.flush(); + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + gGL.color3f(1, 0, 1); + drawBoxOutline(intersection, LLVector4a(0.1f, 0.1f, 0.1f, 0.f)); + gGL.multMatrix(glm::value_ptr(node->mAssetMatrix)); - auto* listener = (LLVolumeOctreeListener*) primitive->mOctree->getListener(0); - drawBoxOutline(listener->mBounds[0], listener->mBounds[1]); + auto* listener = (LLVolumeOctreeListener*)primitive->mOctree->getListener(0); + drawBoxOutline(listener->mBounds[0], listener->mBounds[1]); - gGL.flush(); - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - gGL.popMatrix(); + gGL.flush(); + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + gGL.popMatrix(); + } } } + + gGL.popMatrix(); gDebugProgram.unbind(); + } + + diff --git a/indra/newview/gltfscenemanager.h b/indra/newview/gltfscenemanager.h index 7966606dfa..853bca59d0 100644 --- a/indra/newview/gltfscenemanager.h +++ b/indra/newview/gltfscenemanager.h @@ -28,6 +28,10 @@ #include "llsingleton.h" #include "llviewerobject.h" +#include "gltf/common.h" + +class LLVOVolume; +class LLDrawable; namespace LL { @@ -40,16 +44,30 @@ namespace LL void load(); // open filepicker to choose asset void load(const std::string& filename); // load asset from filename + void saveAs(); // open filepicker and choose file to save selected asset to + void save(const std::string& filename); // save selected asset to filename (suitable for use in external programs) + void uploadSelection(); // decompose selected asset and upload to simulator + void update(); - void render(bool opaque, bool rigged = false); + void render(bool opaque, bool rigged = false, bool unlit = false); + + // render the given variant of all assets + // variant - bitmask according to LLGLSLShader::GLTFVariant flags + void render(U8 variant); + + void render(LL::GLTF::Asset& asset, U8 variant); + + // bind the given material for rendering + void bind(LL::GLTF::Asset& asset, LL::GLTF::Material& material); + void bindTexture(LL::GLTF::Asset& asset, LL::GLTF::TextureType texture_type, LL::GLTF::TextureInfo& info, LLViewerTexture* fallback); void renderOpaque(); void renderAlpha(); LLDrawable* lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, - BOOL pick_transparent, - BOOL pick_rigged, - BOOL pick_unselectable, - BOOL pick_reflection_probe, + bool pick_transparent, + bool pick_rigged, + bool pick_unselectable, + bool pick_reflection_probe, S32* node_hit, // return the index of the node that was hit S32* primitive_hit, // return the index of the primitive that was hit LLVector4a* intersection, // return the intersection point @@ -57,12 +75,30 @@ namespace LL LLVector4a* normal, // return the surface normal at the intersection point LLVector4a* tangent); // return the surface tangent at the intersection point - bool lineSegmentIntersect(LLVOVolume* obj, GLTF::Asset* asset, const LLVector4a& start, const LLVector4a& end, S32 face, BOOL pick_transparent, BOOL pick_rigged, BOOL pick_unselectable, S32* face_hitp, S32* primitive_hitp, + bool lineSegmentIntersect(LLVOVolume* obj, LL::GLTF::Asset* asset, const LLVector4a& start, const LLVector4a& end, S32 face, bool pick_transparent, bool pick_rigged, bool pick_unselectable, S32* face_hitp, S32* primitive_hitp, LLVector4a* intersection, LLVector2* tex_coord, LLVector4a* normal, LLVector4a* tangent); void renderDebug(); + void addGLTFObject(LLViewerObject* object, LLUUID gltf_id); + static void onGLTFLoadComplete(const LLUUID& id, LLAssetType::EType asset_type, void* user_data, S32 status, LLExtStat ext_status); + static void onGLTFBinLoadComplete(const LLUUID& id, LLAssetType::EType asset_type, void* user_data, S32 status, LLExtStat ext_status); + std::vector<LLPointer<LLViewerObject>> mObjects; + + std::shared_ptr<GLTF::Asset> mUploadingAsset; + bool mGLTFUploadPending = false; + LLPointer<LLViewerObject> mUploadingObject; + U32 mPendingImageUploads = 0; + U32 mPendingBinaryUploads = 0; + U32 mPendingGLTFUploads = 0; + + U32 mJointUBO = 0; + + + // render loop state + S32 mLastTexture[GLTF::TEXTURE_TYPE_COUNT] = { -2, -2, -2, -2, -2 }; + }; } diff --git a/indra/newview/installers/darwin/apple-notarize.sh b/indra/newview/installers/darwin/apple-notarize.sh index d90772ec0e..cc4435e614 100755 --- a/indra/newview/installers/darwin/apple-notarize.sh +++ b/indra/newview/installers/darwin/apple-notarize.sh @@ -17,7 +17,7 @@ if [[ -f "$CONFIG_FILE" ]]; then --asc-provider $ASC_PROVIDER \ --file "$zip_file" 2>&1) echo $res - + requestUUID=$(echo $res | awk '/RequestUUID/ { print $NF; }') if [[ -n $requestUUID ]]; then in_progress=1 @@ -26,7 +26,7 @@ if [[ -f "$CONFIG_FILE" ]]; then res=$(xcrun altool --notarization-info "$requestUUID" \ --username $USERNAME \ --password $PASSWORD 2>&1) - if [[ $res != *"in progress"* ]]; then + if [[ $res != *"in progress"* ]]; then in_progress=0 fi echo "." diff --git a/indra/newview/installers/darwin/fix_application_icon_position.sh b/indra/newview/installers/darwin/fix_application_icon_position.sh index 62abcdd07e..841defe96c 100755 --- a/indra/newview/installers/darwin/fix_application_icon_position.sh +++ b/indra/newview/installers/darwin/fix_application_icon_position.sh @@ -1,5 +1,5 @@ #!/bin/bash -# just run this script each time after you change the installer's name to fix the icon misalignment +# just run this script each time after you change the installer's name to fix the icon misalignment mydir="$(dirname "$0")" # If there's more than one DMG in more than one build directory, pick the most # recent one. diff --git a/indra/newview/installers/windows/FILES_ARE_UNICODE_UTF-16LE.txt b/indra/newview/installers/windows/FILES_ARE_UNICODE_UTF-16LE.txt index 185c0180fb..30f9349111 100644 --- a/indra/newview/installers/windows/FILES_ARE_UNICODE_UTF-16LE.txt +++ b/indra/newview/installers/windows/FILES_ARE_UNICODE_UTF-16LE.txt @@ -1,6 +1,6 @@ -The language files in this directory are Unicode (Little-Endian) format, also known as UTF-16 LE.
-
-This is the format required for NSIS Unicode. See http://www.scratchpaper.com/ for details.
-
-James Cook
-September 2008
+The language files in this directory are Unicode (Little-Endian) format, also known as UTF-16 LE. + +This is the format required for NSIS Unicode. See http://www.scratchpaper.com/ for details. + +James Cook +September 2008 diff --git a/indra/newview/linux_tools/register_secondlifeprotocol.sh b/indra/newview/linux_tools/register_secondlifeprotocol.sh index 16e73cb854..33c34d7a76 100755 --- a/indra/newview/linux_tools/register_secondlifeprotocol.sh +++ b/indra/newview/linux_tools/register_secondlifeprotocol.sh @@ -27,7 +27,7 @@ for LLKDECONFIG in kde-config kde4-config; do LLKDEPROTODIR=`$LLKDECONFIG --path services | cut -d ':' -f 1` if [ -d "$LLKDEPROTODIR" ]; then LLKDEPROTOFILE=${LLKDEPROTODIR}/secondlife.protocol - cat > ${LLKDEPROTOFILE} <<EOF || echo Warning: Did not register secondlife:// handler with KDE: Could not write ${LLKDEPROTOFILE} + cat > ${LLKDEPROTOFILE} <<EOF || echo Warning: Did not register secondlife:// handler with KDE: Could not write ${LLKDEPROTOFILE} [Protocol] exec=${HANDLER} '%u' protocol=secondlife diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 68136c8396..2f5b0f04e3 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -102,7 +102,7 @@ using namespace LLAvatarAppearanceDefines; extern LLMenuBarGL* gMenuBarView; -const BOOL ANIMATE = TRUE; +const bool ANIMATE = true; const U8 AGENT_STATE_TYPING = 0x04; const U8 AGENT_STATE_EDITING = 0x10; @@ -186,7 +186,7 @@ private: class LLTeleportRequestViaLure : public LLTeleportRequestViaLandmark { public: - LLTeleportRequestViaLure(const LLUUID &pLureId, BOOL pIsLureGodLike); + LLTeleportRequestViaLure(const LLUUID &pLureId, bool pIsLureGodLike); virtual ~LLTeleportRequestViaLure(); virtual void toOstream(std::ostream& os) const; @@ -196,10 +196,10 @@ public: virtual void startTeleport(); protected: - inline BOOL isLureGodLike() const {return mIsLureGodLike;}; + inline bool isLureGodLike() const {return mIsLureGodLike;}; private: - BOOL mIsLureGodLike; + bool mIsLureGodLike; }; class LLTeleportRequestViaLocation : public LLTeleportRequest @@ -372,7 +372,7 @@ bool LLAgent::isMicrophoneOn(const LLSD& sdname) //----------------------------------------------------------------------------- LLAgent::LLAgent() : mGroupPowers(0), - mHideGroupTitle(FALSE), + mHideGroupTitle(false), mGroupID(), mInitialized(false), @@ -404,7 +404,7 @@ LLAgent::LLAgent() : mHttpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID), mTeleportState(TELEPORT_NONE), mRegionp(NULL), - mInterestListMode(LLViewerRegion::IL_MODE_DEFAULT), + mInterestListMode(IL_MODE_DEFAULT), mAgentOriginGlobal(), mPositionGlobal(), @@ -416,24 +416,24 @@ LLAgent::LLAgent() : mRenderState(0), mTypingTimer(), - mViewsPushed(FALSE), + mViewsPushed(false), - mCustomAnim(FALSE), - mShowAvatar(TRUE), + mCustomAnim(false), + mShowAvatar(true), mFrameAgent(), mIsDoNotDisturb(false), mControlFlags(0x00000000), - mbFlagsDirty(FALSE), - mbFlagsNeedReset(FALSE), + mbFlagsDirty(false), + mbFlagsNeedReset(false), - mAutoPilot(FALSE), - mAutoPilotFlyOnStop(FALSE), - mAutoPilotAllowFlying(TRUE), + mAutoPilot(false), + mAutoPilotFlyOnStop(false), + mAutoPilotAllowFlying(true), mAutoPilotTargetGlobal(), mAutoPilotStopDistance(1.f), - mAutoPilotUseRotation(FALSE), + mAutoPilotUseRotation(false), mAutoPilotTargetFacing(LLVector3::zero), mAutoPilotTargetDist(0.f), mAutoPilotNoProgressFrameCount(0), @@ -441,18 +441,18 @@ LLAgent::LLAgent() : mAutoPilotFinishedCallback(NULL), mAutoPilotCallbackData(NULL), - mMovementKeysLocked(FALSE), + mMovementKeysLocked(false), mEffectColor(new LLUIColor(LLColor4(0.f, 1.f, 1.f, 1.f))), - mHaveHomePosition(FALSE), + mHaveHomePosition(false), mHomeRegionHandle( 0 ), mNearChatRadius(CHAT_NORMAL_RADIUS / 2.f), mNextFidgetTime(0.f), mCurrentFidget(0), mFirstLogin(false), - mOutfitChosen(FALSE), + mOutfitChosen(false), mVoiceConnected(false), @@ -480,7 +480,7 @@ void LLAgent::init() { mMoveTimer.start(); - gSavedSettings.declareBOOL("SlowMotionAnimation", FALSE, "Declared in code", LLControlVariable::PERSIST_NO); + gSavedSettings.declareBOOL("SlowMotionAnimation", false, "Declared in code", LLControlVariable::PERSIST_NO); gSavedSettings.getControl("SlowMotionAnimation")->getSignal()->connect(boost::bind(&handleSlowMotionAnimation, _2)); // *Note: this is where LLViewerCamera::getInstance() used to be constructed. @@ -846,26 +846,26 @@ void LLAgent::movePitch(F32 mag) // Does this parcel allow you to fly? -BOOL LLAgent::canFly() +bool LLAgent::canFly() { - if (isGodlike()) return TRUE; + if (isGodlike()) return true; LLViewerRegion* regionp = getRegion(); - if (regionp && regionp->getBlockFly()) return FALSE; + if (regionp && regionp->getBlockFly()) return false; LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); - if (!parcel) return FALSE; + if (!parcel) return false; // Allow owners to fly on their own land. if (LLViewerParcelMgr::isParcelOwnedByAgent(parcel, GP_LAND_ALLOW_FLY)) { - return TRUE; + return true; } return parcel->getAllowFly(); } -BOOL LLAgent::getFlying() const +bool LLAgent::getFlying() const { return mControlFlags & AGENT_CONTROL_FLY; } @@ -873,7 +873,7 @@ BOOL LLAgent::getFlying() const //----------------------------------------------------------------------------- // setFlying() //----------------------------------------------------------------------------- -void LLAgent::setFlying(BOOL fly, BOOL fail_sound) +void LLAgent::setFlying(bool fly, bool fail_sound) { if (isAgentAvatarValid()) { @@ -896,7 +896,7 @@ void LLAgent::setFlying(BOOL fly, BOOL fail_sound) if (fly) { - BOOL was_flying = getFlying(); + bool was_flying = getFlying(); if (!canFly() && !was_flying) { // parcel doesn't let you start fly @@ -923,7 +923,7 @@ void LLAgent::setFlying(BOOL fly, BOOL fail_sound) // Update Movement Controls according to Fly mode LLFloaterMove::setFlyingMode(fly); - mbFlagsDirty = TRUE; + mbFlagsDirty = true; } @@ -939,7 +939,7 @@ void LLAgent::toggleFlying() LLToolPie::instance().stopClickToWalk(); } - BOOL fly = !gAgent.getFlying(); + bool fly = !gAgent.getFlying(); gAgent.mMoveTimer.reset(); LLFirstUse::notMoving(false); @@ -951,7 +951,7 @@ void LLAgent::toggleFlying() // static bool LLAgent::enableFlying() { - BOOL sitting = FALSE; + bool sitting = false; if (isAgentAvatarValid()) { sitting = gAgentAvatarp->isSitting(); @@ -962,7 +962,7 @@ bool LLAgent::enableFlying() // static bool LLAgent::isSitting() { - BOOL sitting = FALSE; + bool sitting = false; if (isAgentAvatarValid()) { sitting = gAgentAvatarp->isSitting(); @@ -998,9 +998,9 @@ void LLAgent::capabilityReceivedCallback(const LLUUID ®ion_id, LLViewerRegion LLAppViewer::instance()->updateNameLookupUrl(regionp); } - if (gAgent.getInterestListMode() == LLViewerRegion::IL_MODE_360) + if (gAgent.getInterestListMode() == IL_MODE_360) { - gAgent.changeInterestListMode(LLViewerRegion::IL_MODE_360); + gAgent.changeInterestListMode(IL_MODE_360); } } } @@ -1147,7 +1147,7 @@ void LLAgent::removeRegionChangedCallback(boost::signals2::connection callback) //----------------------------------------------------------------------------- // inPrelude() //----------------------------------------------------------------------------- -BOOL LLAgent::inPrelude() +bool LLAgent::inPrelude() { return mRegionp && mRegionp->isPrelude(); } @@ -1166,7 +1166,7 @@ std::string LLAgent::getRegionCapability(const std::string &name) // canManageEstate() //----------------------------------------------------------------------------- -BOOL LLAgent::canManageEstate() const +bool LLAgent::canManageEstate() const { return mRegionp && mRegionp->canManageEstate(); } @@ -1312,7 +1312,7 @@ boost::signals2::connection LLAgent::whenPositionChanged(position_signal_t::slot //----------------------------------------------------------------------------- S32 LLAgent::getRegionsVisited() const { - return mRegionsVisited.size(); + return static_cast<S32>(mRegionsVisited.size()); } //----------------------------------------------------------------------------- @@ -1542,7 +1542,7 @@ U32 LLAgent::getControlFlags() void LLAgent::setControlFlags(U32 mask) { mControlFlags |= mask; - mbFlagsDirty = TRUE; + mbFlagsDirty = true; } @@ -1555,14 +1555,14 @@ void LLAgent::clearControlFlags(U32 mask) mControlFlags &= ~mask; if (old_flags != mControlFlags) { - mbFlagsDirty = TRUE; + mbFlagsDirty = true; } } //----------------------------------------------------------------------------- // controlFlagsDirty() //----------------------------------------------------------------------------- -BOOL LLAgent::controlFlagsDirty() const +bool LLAgent::controlFlagsDirty() const { return mbFlagsDirty; } @@ -1572,7 +1572,7 @@ BOOL LLAgent::controlFlagsDirty() const //----------------------------------------------------------------------------- void LLAgent::enableControlFlagReset() { - mbFlagsNeedReset = TRUE; + mbFlagsNeedReset = true; } //----------------------------------------------------------------------------- @@ -1582,8 +1582,8 @@ void LLAgent::resetControlFlags() { if (mbFlagsNeedReset) { - mbFlagsNeedReset = FALSE; - mbFlagsDirty = FALSE; + mbFlagsNeedReset = false; + mbFlagsDirty = false; // reset all of the ephemeral flags // some flags are managed elsewhere mControlFlags &= AGENT_CONTROL_AWAY | AGENT_CONTROL_FLY | AGENT_CONTROL_MOUSELOOK; @@ -1630,7 +1630,7 @@ void LLAgent::clearAFK() //----------------------------------------------------------------------------- // getAFK() //----------------------------------------------------------------------------- -BOOL LLAgent::getAFK() const +bool LLAgent::getAFK() const { return (mControlFlags & AGENT_CONTROL_AWAY) != 0; } @@ -1667,11 +1667,11 @@ void LLAgent::startAutoPilotGlobal( const LLVector3d &target_global, const std::string& behavior_name, const LLQuaternion *target_rotation, - void (*finish_callback)(BOOL, void *), + void (*finish_callback)(bool, void *), void *callback_data, F32 stop_distance, F32 rot_threshold, - BOOL allow_flying) + bool allow_flying) { if (!isAgentAvatarValid()) { @@ -1728,38 +1728,38 @@ void LLAgent::startAutoPilotGlobal( } else { - mAutoPilotFlyOnStop = FALSE; + mAutoPilotFlyOnStop = false; } if (distance > 30.0 && mAutoPilotAllowFlying) { - setFlying(TRUE); + setFlying(true); } if ( distance > 1.f && mAutoPilotAllowFlying && heightDelta > (sqrtf(mAutoPilotStopDistance) + 1.f)) { - setFlying(TRUE); + setFlying(true); // Do not force flying for "Sit" behavior to prevent flying after pressing "Stand" // from an object. See EXT-1655. if ("Sit" != mAutoPilotBehaviorName) - mAutoPilotFlyOnStop = TRUE; + mAutoPilotFlyOnStop = true; } - mAutoPilot = TRUE; + mAutoPilot = true; setAutoPilotTargetGlobal(target_global); if (target_rotation) { - mAutoPilotUseRotation = TRUE; + mAutoPilotUseRotation = true; mAutoPilotTargetFacing = LLVector3::x_axis * *target_rotation; mAutoPilotTargetFacing.mV[VZ] = 0.f; mAutoPilotTargetFacing.normalize(); } else { - mAutoPilotUseRotation = FALSE; + mAutoPilotUseRotation = false; } mAutoPilotNoProgressFrameCount = 0; @@ -1797,7 +1797,7 @@ void LLAgent::setAutoPilotTargetGlobal(const LLVector3d &target_global) //----------------------------------------------------------------------------- // startFollowPilot() //----------------------------------------------------------------------------- -void LLAgent::startFollowPilot(const LLUUID &leader_id, BOOL allow_flying, F32 stop_distance) +void LLAgent::startFollowPilot(const LLUUID &leader_id, bool allow_flying, F32 stop_distance) { mLeaderID = leader_id; if ( mLeaderID.isNull() ) return; @@ -1823,11 +1823,11 @@ void LLAgent::startFollowPilot(const LLUUID &leader_id, BOOL allow_flying, F32 s //----------------------------------------------------------------------------- // stopAutoPilot() //----------------------------------------------------------------------------- -void LLAgent::stopAutoPilot(BOOL user_cancel) +void LLAgent::stopAutoPilot(bool user_cancel) { if (mAutoPilot) { - mAutoPilot = FALSE; + mAutoPilot = false; if (mAutoPilotUseRotation && !user_cancel) { resetAxes(mAutoPilotTargetFacing); @@ -1885,7 +1885,7 @@ void LLAgent::autoPilot(F32 *delta_yaw) if (gAgentAvatarp->mInAir && mAutoPilotAllowFlying) { - setFlying(TRUE); + setFlying(true); } LLVector3 at; @@ -2080,7 +2080,7 @@ void LLAgent::propagate(const F32 dt) // handle auto-land behavior if (isAgentAvatarValid()) { - BOOL in_air = gAgentAvatarp->mInAir; + bool in_air = gAgentAvatarp->mInAir; LLVector3 land_vel = getVelocity(); land_vel.mV[VZ] = 0.f; @@ -2090,7 +2090,7 @@ void LLAgent::propagate(const F32 dt) && gSavedSettings.getBOOL("AutomaticFly")) { // land automatically - setFlying(FALSE); + setFlying(false); } } @@ -2154,23 +2154,23 @@ std::ostream& operator<<(std::ostream &s, const LLAgent &agent) return s; } -// TRUE if your own avatar needs to be rendered. Usually only +// true if your own avatar needs to be rendered. Usually only // in third person and build. //----------------------------------------------------------------------------- // needsRenderAvatar() //----------------------------------------------------------------------------- -BOOL LLAgent::needsRenderAvatar() +bool LLAgent::needsRenderAvatar() { if (gAgentCamera.cameraMouselook() && !LLVOAvatar::sVisibleInFirstPerson) { - return FALSE; + return false; } return mShowAvatar && mOutfitChosen; } -// TRUE if we need to render your own avatar's head. -BOOL LLAgent::needsRenderHead() +// true if we need to render your own avatar's head. +bool LLAgent::needsRenderHead() { return (LLVOAvatar::sVisibleInFirstPerson && LLPipeline::sReflectionRender) || (mShowAvatar && !gAgentCamera.cameraMouselook()); } @@ -2203,7 +2203,7 @@ void LLAgent::startTyping() sendAnimationRequest(ANIM_AGENT_TYPE, ANIM_REQUEST_START); } (LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat"))-> - sendChatFromViewer("", CHAT_TYPE_START, FALSE); + sendChatFromViewer("", CHAT_TYPE_START, false); } //----------------------------------------------------------------------------- @@ -2216,7 +2216,7 @@ void LLAgent::stopTyping() clearRenderState(AGENT_STATE_TYPING); sendAnimationRequest(ANIM_AGENT_TYPE, ANIM_REQUEST_STOP); (LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat"))-> - sendChatFromViewer("", CHAT_TYPE_STOP, FALSE); + sendChatFromViewer("", CHAT_TYPE_STOP, false); } } @@ -2291,19 +2291,19 @@ void LLAgent::endAnimationUpdateUI() // show mouse cursor gViewerWindow->showCursor(); // show menus - gMenuBarView->setVisible(TRUE); - LLNavigationBar::getInstance()->setVisible(TRUE && gSavedSettings.getBOOL("ShowNavbarNavigationPanel")); + gMenuBarView->setVisible(true); + LLNavigationBar::getInstance()->setVisible(true && gSavedSettings.getBOOL("ShowNavbarNavigationPanel")); gStatusBar->setVisibleForMouselook(true); static LLCachedControl<bool> show_mini_location_panel(gSavedSettings, "ShowMiniLocationPanel"); if (show_mini_location_panel) { - LLPanelTopInfoBar::getInstance()->setVisible(TRUE); + LLPanelTopInfoBar::getInstance()->setVisible(true); } - LLChicletBar::getInstance()->setVisible(TRUE); + LLChicletBar::getInstance()->setVisible(true); - LLPanelStandStopFlying::getInstance()->setVisible(TRUE); + LLPanelStandStopFlying::getInstance()->setVisible(true); LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); @@ -2315,7 +2315,7 @@ void LLAgent::endAnimationUpdateUI() } // Only pop if we have pushed... - if (TRUE == mViewsPushed) + if (true == mViewsPushed) { #if 0 // Use this once all floaters are registered LLFloaterReg::restoreVisibleInstances(); @@ -2340,14 +2340,14 @@ void LLAgent::endAnimationUpdateUI() gFloaterView->popVisibleAll(skip_list); #endif - mViewsPushed = FALSE; + mViewsPushed = false; } gAgentCamera.setLookAt(LOOKAT_TARGET_CLEAR); if( gMorphView ) { - gMorphView->setVisible( FALSE ); + gMorphView->setVisible( false ); } // Disable mouselook-specific animations @@ -2386,7 +2386,7 @@ void LLAgent::endAnimationUpdateUI() if( gMorphView ) { - gMorphView->setVisible( FALSE ); + gMorphView->setVisible( false ); } if (isAgentAvatarValid()) @@ -2396,7 +2396,7 @@ void LLAgent::endAnimationUpdateUI() sendAnimationRequest(ANIM_AGENT_CUSTOMIZE, ANIM_REQUEST_STOP); sendAnimationRequest(ANIM_AGENT_CUSTOMIZE_DONE, ANIM_REQUEST_START); - mCustomAnim = FALSE ; + mCustomAnim = false ; } } @@ -2412,19 +2412,19 @@ void LLAgent::endAnimationUpdateUI() { // clean up UI // first show anything hidden by UI toggle - gViewerWindow->setUIVisibility(TRUE); + gViewerWindow->setUIVisibility(true); // then hide stuff we want hidden for mouselook gToolBarView->setToolBarsVisible(false); - gMenuBarView->setVisible(FALSE); - LLNavigationBar::getInstance()->setVisible(FALSE); + gMenuBarView->setVisible(false); + LLNavigationBar::getInstance()->setVisible(false); gStatusBar->setVisibleForMouselook(false); - LLPanelTopInfoBar::getInstance()->setVisible(FALSE); + LLPanelTopInfoBar::getInstance()->setVisible(false); - LLChicletBar::getInstance()->setVisible(FALSE); + LLChicletBar::getInstance()->setVisible(false); - LLPanelStandStopFlying::getInstance()->setVisible(FALSE); + LLPanelStandStopFlying::getInstance()->setVisible(false); // clear out camera lag effect gAgentCamera.clearCameraLag(); @@ -2434,7 +2434,7 @@ void LLAgent::endAnimationUpdateUI() LLToolMgr::getInstance()->setCurrentToolset(gMouselookToolset); - mViewsPushed = TRUE; + mViewsPushed = true; if (mMouselookModeInSignal) { @@ -2451,15 +2451,15 @@ void LLAgent::endAnimationUpdateUI() LLFloaterView::skip_list_t skip_list; skip_list.insert(LLFloaterReg::findInstance("mini_map")); skip_list.insert(LLFloaterReg::findInstance("beacons")); - gFloaterView->pushVisibleAll(FALSE, skip_list); + gFloaterView->pushVisibleAll(false, skip_list); #endif if( gMorphView ) { - gMorphView->setVisible(FALSE); + gMorphView->setVisible(false); } - gConsole->setVisible( TRUE ); + gConsole->setVisible( true ); if (isAgentAvatarValid()) { @@ -2508,7 +2508,7 @@ void LLAgent::endAnimationUpdateUI() if( gMorphView ) { - gMorphView->setVisible( TRUE ); + gMorphView->setVisible( true ); } // freeze avatar @@ -3061,7 +3061,7 @@ bool LLAgent::requestGetCapability(const std::string &capName, httpCallback_t cb return false; } -BOOL LLAgent::getAdminOverride() const +bool LLAgent::getAdminOverride() const { return mAgentAccess->getAdminOverride(); } @@ -3071,7 +3071,7 @@ void LLAgent::setMaturity(char text) mAgentAccess->setMaturity(text); } -void LLAgent::setAdminOverride(BOOL b) +void LLAgent::setAdminOverride(bool b) { mAgentAccess->setAdminOverride(b); } @@ -3123,43 +3123,43 @@ void LLAgent::buildFullnameAndTitle(std::string& name) const } } -BOOL LLAgent::isInGroup(const LLUUID& group_id, BOOL ignore_god_mode /* FALSE */) const +bool LLAgent::isInGroup(const LLUUID& group_id, bool ignore_god_mode /* false */) const { if (!ignore_god_mode && isGodlike()) return true; - U32 count = mGroups.size(); - for(U32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { - return TRUE; + return true; } } - return FALSE; + return false; } // This implementation should mirror LLAgentInfo::hasPowerInGroup -BOOL LLAgent::hasPowerInGroup(const LLUUID& group_id, U64 power) const +bool LLAgent::hasPowerInGroup(const LLUUID& group_id, U64 power) const { if (isGodlikeWithoutAdminMenuFakery()) return true; // GP_NO_POWERS can also mean no power is enough to grant an ability. - if (GP_NO_POWERS == power) return FALSE; + if (GP_NO_POWERS == power) return false; - U32 count = mGroups.size(); - for(U32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { - return (BOOL)((mGroups[i].mPowers & power) > 0); + return (bool)((mGroups[i].mPowers & power) > 0); } } - return FALSE; + return false; } -BOOL LLAgent::hasPowerInActiveGroup(U64 power) const +bool LLAgent::hasPowerInActiveGroup(U64 power) const { return (mGroupID.notNull() && (hasPowerInGroup(mGroupID, power))); } @@ -3169,8 +3169,8 @@ U64 LLAgent::getPowerInGroup(const LLUUID& group_id) const if (isGodlike()) return GP_ALL_POWERS; - U32 count = mGroups.size(); - for(U32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { @@ -3181,24 +3181,24 @@ U64 LLAgent::getPowerInGroup(const LLUUID& group_id) const return GP_NO_POWERS; } -BOOL LLAgent::getGroupData(const LLUUID& group_id, LLGroupData& data) const +bool LLAgent::getGroupData(const LLUUID& group_id, LLGroupData& data) const { - S32 count = mGroups.size(); - for(S32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { data = mGroups[i]; - return TRUE; + return true; } } - return FALSE; + return false; } S32 LLAgent::getGroupContribution(const LLUUID& group_id) const { - S32 count = mGroups.size(); - for(S32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { @@ -3209,10 +3209,10 @@ S32 LLAgent::getGroupContribution(const LLUUID& group_id) const return 0; } -BOOL LLAgent::setGroupContribution(const LLUUID& group_id, S32 contribution) +bool LLAgent::setGroupContribution(const LLUUID& group_id, S32 contribution) { - S32 count = mGroups.size(); - for(S32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { @@ -3226,16 +3226,16 @@ BOOL LLAgent::setGroupContribution(const LLUUID& group_id, S32 contribution) msg->addUUID("GroupID", group_id); msg->addS32("Contribution", contribution); sendReliableMessage(); - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOOL list_in_profile) +bool LLAgent::setUserGroupFlags(const LLUUID& group_id, bool accept_notices, bool list_in_profile) { - S32 count = mGroups.size(); - for(S32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { @@ -3252,13 +3252,13 @@ BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOO msg->nextBlock("NewData"); msg->addBOOL("ListInProfile", list_in_profile); sendReliableMessage(); - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL LLAgent::canJoinGroups() const +bool LLAgent::canJoinGroups() const { return (S32)mGroups.size() < LLAgentBenefitsMgr::current().getGroupMembershipLimit(); } @@ -3304,16 +3304,15 @@ void LLAgent::sendAnimationRequests(const std::vector<LLUUID> &anim_ids, EAnimRe msg->addUUIDFast(_PREHASH_AgentID, getID()); msg->addUUIDFast(_PREHASH_SessionID, getSessionID()); - for (S32 i = 0; i < anim_ids.size(); i++) + for (const LLUUID& uuid : anim_ids) { - if (anim_ids[i].isNull()) + if (uuid.notNull()) { - continue; + msg->nextBlockFast(_PREHASH_AnimationList); + msg->addUUIDFast(_PREHASH_AnimID, uuid); + msg->addBOOLFast(_PREHASH_StartAnim, request == ANIM_REQUEST_START); + num_valid_anims++; } - msg->nextBlockFast(_PREHASH_AnimationList); - msg->addUUIDFast(_PREHASH_AnimID, (anim_ids[i]) ); - msg->addBOOLFast(_PREHASH_StartAnim, (request == ANIM_REQUEST_START) ? TRUE : FALSE); - num_valid_anims++; } msg->nextBlockFast(_PREHASH_PhysicalAvatarEventList); @@ -3338,8 +3337,8 @@ void LLAgent::sendAnimationRequest(const LLUUID &anim_id, EAnimRequest request) msg->addUUIDFast(_PREHASH_SessionID, getSessionID()); msg->nextBlockFast(_PREHASH_AnimationList); - msg->addUUIDFast(_PREHASH_AnimID, (anim_id) ); - msg->addBOOLFast(_PREHASH_StartAnim, (request == ANIM_REQUEST_START) ? TRUE : FALSE); + msg->addUUIDFast(_PREHASH_AnimID, anim_id); + msg->addBOOLFast(_PREHASH_StartAnim, request == ANIM_REQUEST_START); msg->nextBlockFast(_PREHASH_PhysicalAvatarEventList); msg->addBinaryDataFast(_PREHASH_TypeData, NULL, 0); @@ -3363,7 +3362,7 @@ void LLAgent::sendAnimationStateReset() msg->nextBlockFast(_PREHASH_AnimationList); msg->addUUIDFast(_PREHASH_AnimID, LLUUID::null ); - msg->addBOOLFast(_PREHASH_StartAnim, FALSE); + msg->addBOOLFast(_PREHASH_StartAnim, false); msg->nextBlockFast(_PREHASH_PhysicalAvatarEventList); msg->addBinaryDataFast(_PREHASH_TypeData, NULL, 0); @@ -3404,7 +3403,7 @@ void LLAgent::sendWalkRun(bool running) msgsys->nextBlockFast(_PREHASH_AgentData); msgsys->addUUIDFast(_PREHASH_AgentID, getID()); msgsys->addUUIDFast(_PREHASH_SessionID, getSessionID()); - msgsys->addBOOLFast(_PREHASH_AlwaysRun, BOOL(running) ); + msgsys->addBOOLFast(_PREHASH_AlwaysRun, bool(running) ); sendReliableMessage(); } } @@ -3416,23 +3415,23 @@ void LLAgent::friendsChanged() mProxyForAgents = collector.mProxy; } -BOOL LLAgent::isGrantedProxy(const LLPermissions& perm) +bool LLAgent::isGrantedProxy(const LLPermissions& perm) { return (mProxyForAgents.count(perm.getOwner()) > 0); } -BOOL LLAgent::allowOperation(PermissionBit op, +bool LLAgent::allowOperation(PermissionBit op, const LLPermissions& perm, U64 group_proxy_power, U8 god_minimum) { // Check god level. - if (getGodLevel() >= god_minimum) return TRUE; + if (getGodLevel() >= god_minimum) return true; - if (!perm.isOwned()) return FALSE; + if (!perm.isOwned()) return false; // A group member with group_proxy_power can act as owner. - BOOL is_group_owned; + bool is_group_owned; LLUUID owner_id; perm.getOwnership(owner_id, is_group_owned); LLUUID group_id(perm.getGroup()); @@ -3488,37 +3487,37 @@ void LLAgent::initOriginGlobal(const LLVector3d &origin_global) mAgentOriginGlobal = origin_global; } -BOOL LLAgent::leftButtonGrabbed() const +bool LLAgent::leftButtonGrabbed() const { - const BOOL camera_mouse_look = gAgentCamera.cameraMouselook(); + const bool camera_mouse_look = gAgentCamera.cameraMouselook(); return (!camera_mouse_look && mControlsTakenCount[CONTROL_LBUTTON_DOWN_INDEX] > 0) || (camera_mouse_look && mControlsTakenCount[CONTROL_ML_LBUTTON_DOWN_INDEX] > 0) || (!camera_mouse_look && mControlsTakenPassedOnCount[CONTROL_LBUTTON_DOWN_INDEX] > 0) || (camera_mouse_look && mControlsTakenPassedOnCount[CONTROL_ML_LBUTTON_DOWN_INDEX] > 0); } -BOOL LLAgent::rotateGrabbed() const +bool LLAgent::rotateGrabbed() const { return (mControlsTakenCount[CONTROL_YAW_POS_INDEX] > 0) || (mControlsTakenCount[CONTROL_YAW_NEG_INDEX] > 0); } -BOOL LLAgent::forwardGrabbed() const +bool LLAgent::forwardGrabbed() const { return (mControlsTakenCount[CONTROL_AT_POS_INDEX] > 0); } -BOOL LLAgent::backwardGrabbed() const +bool LLAgent::backwardGrabbed() const { return (mControlsTakenCount[CONTROL_AT_NEG_INDEX] > 0); } -BOOL LLAgent::upGrabbed() const +bool LLAgent::upGrabbed() const { return (mControlsTakenCount[CONTROL_UP_POS_INDEX] > 0); } -BOOL LLAgent::downGrabbed() const +bool LLAgent::downGrabbed() const { return (mControlsTakenCount[CONTROL_UP_NEG_INDEX] > 0); } @@ -3814,9 +3813,9 @@ void LLAgent::processScriptControlChange(LLMessageSystem *msg, void **) S32 block_count = msg->getNumberOfBlocks("Data"); for (S32 block_index = 0; block_index < block_count; block_index++) { - BOOL take_controls; + bool take_controls; U32 controls; - BOOL passon; + bool passon; U32 i; msg->getBOOL("Data", "TakeControls", take_controls, block_index); if (take_controls) @@ -3938,19 +3937,19 @@ void LLAgent::processControlRelease(LLMessageSystem *msg, void **) } */ -BOOL LLAgent::anyControlGrabbed() const +bool LLAgent::anyControlGrabbed() const { for (U32 i = 0; i < TOTAL_CONTROLS; i++) { if (gAgent.mControlsTakenCount[i] > 0) - return TRUE; + return true; if (gAgent.mControlsTakenPassedOnCount[i] > 0) - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLAgent::isControlGrabbed(S32 control_index) const +bool LLAgent::isControlGrabbed(S32 control_index) const { return mControlsTakenCount[control_index] > 0; } @@ -3966,22 +3965,22 @@ void LLAgent::forceReleaseControls() void LLAgent::setHomePosRegion( const U64& region_handle, const LLVector3& pos_region) { - mHaveHomePosition = TRUE; + mHaveHomePosition = true; mHomeRegionHandle = region_handle; mHomePosRegion = pos_region; } -BOOL LLAgent::getHomePosGlobal( LLVector3d* pos_global ) +bool LLAgent::getHomePosGlobal( LLVector3d* pos_global ) { if(!mHaveHomePosition) { - return FALSE; + return false; } F32 x = 0; F32 y = 0; from_region_handle( mHomeRegionHandle, &x, &y); pos_global->setVec( x + mHomePosRegion.mV[VX], y + mHomePosRegion.mV[VY], mHomePosRegion.mV[VZ] ); - return TRUE; + return true; } bool LLAgent::isInHomeRegion() @@ -4064,7 +4063,7 @@ bool LLAgent::teleportCore(bool is_local) // Close all pie menus, deselect land, etc. // Don't change the camera until we know teleport succeeded. JC - gAgentCamera.resetView(FALSE); + gAgentCamera.resetView(false); // local logic add(LLStatViewer::TELEPORT, 1); @@ -4075,7 +4074,7 @@ bool LLAgent::teleportCore(bool is_local) } else { - gTeleportDisplay = TRUE; + gTeleportDisplay = true; LL_INFOS("Teleport") << "Non-local, setting teleport state to TELEPORT_START" << LL_ENDL; gAgent.setTeleportState( LLAgent::TELEPORT_START ); } @@ -4104,7 +4103,7 @@ void LLAgent::clearTeleportRequest() { if(LLVoiceClient::instanceExists()) { - LLVoiceClient::getInstance()->setHidden(FALSE); + LLVoiceClient::getInstance()->setHidden(false); } mTeleportRequest.reset(); mTPNeedsNeabyChatSeparator = false; @@ -4134,7 +4133,7 @@ void LLAgent::startTeleportRequest() LL_INFOS("Telport") << "Agent handling start teleport request." << LL_ENDL; if(LLVoiceClient::instanceExists()) { - LLVoiceClient::getInstance()->setHidden(TRUE); + LLVoiceClient::getInstance()->setHidden(true); } if (hasPendingTeleportRequest()) { @@ -4142,7 +4141,7 @@ void LLAgent::startTeleportRequest() mTeleportCanceled.reset(); if (!isMaturityPreferenceSyncedWithServer()) { - gTeleportDisplay = TRUE; + gTeleportDisplay = true; LL_INFOS("Teleport") << "Maturity preference not synced yet, setting teleport state to TELEPORT_PENDING" << LL_ENDL; setTeleportState(TELEPORT_PENDING); } @@ -4217,13 +4216,13 @@ void LLAgent::handleTeleportFailed() LL_WARNS("Teleport") << "Agent handling teleport failure!" << LL_ENDL; if(LLVoiceClient::instanceExists()) { - LLVoiceClient::getInstance()->setHidden(FALSE); + LLVoiceClient::getInstance()->setHidden(false); } setTeleportState(LLAgent::TELEPORT_NONE); // Unlock the UI if the progress bar has been shown. -// gViewerWindow->setShowProgress(FALSE); -// gTeleportDisplay = FALSE; +// gViewerWindow->setShowProgress(false); +// gTeleportDisplay = false; if (mTeleportRequest) { @@ -4269,14 +4268,14 @@ void LLAgent::addTPNearbyChatSeparator() LLChat chat; chat.mFromName = location_name; - chat.mMuted = FALSE; + chat.mMuted = false; chat.mFromID = LLUUID::null; chat.mSourceType = CHAT_SOURCE_TELEPORT; chat.mChatStyle = CHAT_STYLE_TELEPORT_SEP; chat.mText = ""; LLSD args; - args["do_not_log"] = TRUE; + args["do_not_log"] = true; nearby_chat->addMessage(chat, true, args); } } @@ -4360,13 +4359,13 @@ void LLAgent::doTeleportViaLandmark(const LLUUID& landmark_asset_id) } } -void LLAgent::teleportViaLure(const LLUUID& lure_id, BOOL godlike) +void LLAgent::teleportViaLure(const LLUUID& lure_id, bool godlike) { mTeleportRequest = LLTeleportRequestPtr(new LLTeleportRequestViaLure(lure_id, godlike)); startTeleportRequest(); } -void LLAgent::doTeleportViaLure(const LLUUID& lure_id, BOOL godlike) +void LLAgent::doTeleportViaLure(const LLUUID& lure_id, bool godlike) { LLViewerRegion* regionp = getRegion(); if(regionp && teleportCore()) @@ -4433,7 +4432,7 @@ void LLAgent::restoreCanceledTeleportRequest() gAgent.setTeleportState( LLAgent::TELEPORT_REQUESTED ); mTeleportRequest = mTeleportCanceled; mTeleportCanceled.reset(); - gTeleportDisplay = TRUE; + gTeleportDisplay = true; gTeleportDisplayTimer.reset(); } } @@ -4511,7 +4510,7 @@ void LLAgent::doTeleportViaLocationLookAt(const LLVector3d& pos_global) if(!gAgentCamera.isfollowCamLocked()) { - gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); // detach camera form avatar, so it keeps direction + gAgentCamera.setFocusOnAvatar(false, ANIMATE); // detach camera form avatar, so it keeps direction } U64 region_handle = to_region_handle(pos_global); @@ -4597,7 +4596,7 @@ void LLAgent::stopCurrentAnimations() else { // stop this animation locally - gAgentAvatarp->stopMotion(anim_it->first, TRUE); + gAgentAvatarp->stopMotion(anim_it->first, true); // ...and tell the server to tell everyone. anim_ids.push_back(anim_it->first); } @@ -4694,7 +4693,7 @@ void LLAgent::requestEnterGodMode() msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_RequestBlock); - msg->addBOOLFast(_PREHASH_Godlike, TRUE); + msg->addBOOLFast(_PREHASH_Godlike, true); msg->addUUIDFast(_PREHASH_Token, LLUUID::null); // simulators need to know about your request @@ -4709,7 +4708,7 @@ void LLAgent::requestLeaveGodMode() msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_RequestBlock); - msg->addBOOLFast(_PREHASH_Godlike, FALSE); + msg->addBOOLFast(_PREHASH_Godlike, false); msg->addUUIDFast(_PREHASH_Token, LLUUID::null); // simulator needs to know about your request @@ -4902,7 +4901,7 @@ const std::string& LLAgent::getTeleportStateName() const void LLAgent::parseTeleportMessages(const std::string& xml_filename) { LLXMLNodePtr root; - BOOL success = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root); + bool success = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root); if (!success || !root || !root->hasName( "teleport_messages" )) { @@ -5090,7 +5089,7 @@ void LLTeleportRequestViaLandmark::restartTeleport() // LLTeleportRequestViaLure //----------------------------------------------------------------------------- -LLTeleportRequestViaLure::LLTeleportRequestViaLure(const LLUUID &pLureId, BOOL pIsLureGodLike) +LLTeleportRequestViaLure::LLTeleportRequestViaLure(const LLUUID &pLureId, bool pIsLureGodLike) : LLTeleportRequestViaLandmark(pLureId), mIsLureGodLike(pIsLureGodLike) { diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 71fa4e20b1..9cd3e80f69 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -43,7 +43,7 @@ #include <boost/shared_ptr.hpp> #include <boost/signals2.hpp> -extern const BOOL ANIMATE; +extern const bool ANIMATE; extern const U8 AGENT_STATE_TYPING; // Typing indication extern const U8 AGENT_STATE_EDITING; // Set when agent has objects selected @@ -78,8 +78,8 @@ struct LLGroupData LLUUID mID; LLUUID mInsigniaID; U64 mPowers; - BOOL mAcceptNotices; - BOOL mListInProfile; + bool mAcceptNotices; + bool mListInProfile; S32 mContribution; std::string mName; }; @@ -118,7 +118,7 @@ private: public: void onAppFocusGained(); void setFirstLogin(bool b); - // Return TRUE if the database reported this login as the first for this particular user. + // Return true if the database reported this login as the first for this particular user. bool isFirstLogin() const { return mFirstLogin; } bool isInitialized() const { return mInitialized; } @@ -169,10 +169,10 @@ public: // On the very first login, outfit needs to be chosen by some // mechanism, usually by loading the requested initial outfit. We // don't render the avatar until the choice is made. - BOOL isOutfitChosen() const { return mOutfitChosen; } - void setOutfitChosen(BOOL b) { mOutfitChosen = b; } + bool isOutfitChosen() const { return mOutfitChosen; } + void setOutfitChosen(bool b) { mOutfitChosen = b; } private: - BOOL mOutfitChosen; + bool mOutfitChosen; /** Identity ** ** @@ -238,13 +238,13 @@ private: public: void setStartPosition(U32 location_id); // Marks current location as start, sends information to servers void setHomePosRegion(const U64& region_handle, const LLVector3& pos_region); - BOOL getHomePosGlobal(LLVector3d* pos_global); + bool getHomePosGlobal(LLVector3d* pos_global); bool isInHomeRegion(); private: void setStartPositionSuccess(const LLSD &result); - BOOL mHaveHomePosition; + bool mHaveHomePosition; U64 mHomeRegionHandle; LLVector3 mHomePosRegion; @@ -271,7 +271,7 @@ public: void setRegion(LLViewerRegion *regionp); LLViewerRegion *getRegion() const; LLHost getRegionHost() const; - BOOL inPrelude(); + bool inPrelude(); // Capability std::string getRegionCapability(const std::string &name); // short hand for if (getRegion()) { getRegion()->getCapability(name) } @@ -352,11 +352,11 @@ private: // Fly //-------------------------------------------------------------------- public: - BOOL getFlying() const; - void setFlying(BOOL fly, BOOL fail_sound = FALSE); + bool getFlying() const; + void setFlying(bool fly, bool fail_sound = false); static void toggleFlying(); static bool enableFlying(); - BOOL canFly(); // Does this parcel allow you to fly? + bool canFly(); // Does this parcel allow you to fly? static bool isSitting(); //-------------------------------------------------------------------- @@ -409,7 +409,7 @@ private: public: void setAFK(); void clearAFK(); - BOOL getAFK() const; + bool getAFK() const; static const F32 MIN_AFK_TIME; //-------------------------------------------------------------------- @@ -461,12 +461,12 @@ private: // Grab //-------------------------------------------------------------------- public: - BOOL leftButtonGrabbed() const; - BOOL rotateGrabbed() const; - BOOL forwardGrabbed() const; - BOOL backwardGrabbed() const; - BOOL upGrabbed() const; - BOOL downGrabbed() const; + bool leftButtonGrabbed() const; + bool rotateGrabbed() const; + bool forwardGrabbed() const; + bool backwardGrabbed() const; + bool upGrabbed() const; + bool downGrabbed() const; //-------------------------------------------------------------------- // Controls @@ -475,22 +475,22 @@ public: U32 getControlFlags(); void setControlFlags(U32 mask); // Performs bitwise mControlFlags |= mask void clearControlFlags(U32 mask); // Performs bitwise mControlFlags &= ~mask - BOOL controlFlagsDirty() const; + bool controlFlagsDirty() const; void enableControlFlagReset(); void resetControlFlags(); - BOOL anyControlGrabbed() const; // True iff a script has taken over a control - BOOL isControlGrabbed(S32 control_index) const; + bool anyControlGrabbed() const; // True iff a script has taken over a control + bool isControlGrabbed(S32 control_index) const; // Send message to simulator to force grabbed controls to be // released, in case of a poorly written script. void forceReleaseControls(); - void setFlagsDirty() { mbFlagsDirty = TRUE; } + void setFlagsDirty() { mbFlagsDirty = true; } private: S32 mControlsTakenCount[TOTAL_CONTROLS]; S32 mControlsTakenPassedOnCount[TOTAL_CONTROLS]; U32 mControlFlags; // Replacement for the mFooKey's - BOOL mbFlagsDirty; - BOOL mbFlagsNeedReset; // ! HACK ! For preventing incorrect flags sent when crossing region boundaries + bool mbFlagsDirty; + bool mbFlagsNeedReset; // ! HACK ! For preventing incorrect flags sent when crossing region boundaries //-------------------------------------------------------------------- // Animations @@ -506,8 +506,8 @@ public: void endAnimationUpdateUI(); void unpauseAnimation() { mPauseRequest = NULL; } - BOOL getCustomAnim() const { return mCustomAnim; } - void setCustomAnim(BOOL anim) { mCustomAnim = anim; } + bool getCustomAnim() const { return mCustomAnim; } + void setCustomAnim(bool anim) { mCustomAnim = anim; } typedef boost::signals2::signal<void ()> camera_signal_t; boost::signals2::connection setMouselookModeInCallback( const camera_signal_t::slot_type& cb ); @@ -516,9 +516,9 @@ public: private: camera_signal_t* mMouselookModeInSignal; camera_signal_t* mMouselookModeOutSignal; - BOOL mCustomAnim; // Current animation is ANIM_AGENT_CUSTOMIZE ? + bool mCustomAnim; // Current animation is ANIM_AGENT_CUSTOMIZE ? LLPointer<LLPauseRequestHandle> mPauseRequest; - BOOL mViewsPushed; // Keep track of whether or not we have pushed views + bool mViewsPushed; // Keep track of whether or not we have pushed views /** Animation ** ** @@ -544,8 +544,8 @@ public: void moveYaw(F32 mag, bool reset_view = true); void movePitch(F32 mag); - BOOL isMovementLocked() const { return mMovementKeysLocked; } - void setMovementLocked(BOOL set_locked) { mMovementKeysLocked = set_locked; } + bool isMovementLocked() const { return mMovementKeysLocked; } + void setMovementLocked(bool set_locked) { mMovementKeysLocked = set_locked; } //-------------------------------------------------------------------- // Move the avatar's frame @@ -564,12 +564,12 @@ public: // Autopilot //-------------------------------------------------------------------- public: - BOOL getAutoPilot() const { return mAutoPilot; } + bool getAutoPilot() const { return mAutoPilot; } LLVector3d getAutoPilotTargetGlobal() const { return mAutoPilotTargetGlobal; } LLUUID getAutoPilotLeaderID() const { return mLeaderID; } F32 getAutoPilotStopDistance() const { return mAutoPilotStopDistance; } F32 getAutoPilotTargetDist() const { return mAutoPilotTargetDist; } - BOOL getAutoPilotUseRotation() const { return mAutoPilotUseRotation; } + bool getAutoPilotUseRotation() const { return mAutoPilotUseRotation; } LLVector3 getAutoPilotTargetFacing() const { return mAutoPilotTargetFacing; } F32 getAutoPilotRotationThreshold() const { return mAutoPilotRotationThreshold; } std::string getAutoPilotBehaviorName() const { return mAutoPilotBehaviorName; } @@ -577,30 +577,30 @@ public: void startAutoPilotGlobal(const LLVector3d &pos_global, const std::string& behavior_name = std::string(), const LLQuaternion *target_rotation = NULL, - void (*finish_callback)(BOOL, void *) = NULL, void *callback_data = NULL, + void (*finish_callback)(bool, void *) = NULL, void *callback_data = NULL, F32 stop_distance = 0.f, F32 rotation_threshold = 0.03f, - BOOL allow_flying = TRUE); - void startFollowPilot(const LLUUID &leader_id, BOOL allow_flying = TRUE, F32 stop_distance = 0.5f); - void stopAutoPilot(BOOL user_cancel = FALSE); + bool allow_flying = true); + void startFollowPilot(const LLUUID &leader_id, bool allow_flying = true, F32 stop_distance = 0.5f); + void stopAutoPilot(bool user_cancel = false); void setAutoPilotTargetGlobal(const LLVector3d &target_global); void autoPilot(F32 *delta_yaw); // Autopilot walking action, angles in radians void renderAutoPilotTarget(); private: - BOOL mAutoPilot; - BOOL mAutoPilotFlyOnStop; - BOOL mAutoPilotAllowFlying; + bool mAutoPilot; + bool mAutoPilotFlyOnStop; + bool mAutoPilotAllowFlying; LLVector3d mAutoPilotTargetGlobal; F32 mAutoPilotStopDistance; - BOOL mAutoPilotUseRotation; + bool mAutoPilotUseRotation; LLVector3 mAutoPilotTargetFacing; F32 mAutoPilotTargetDist; S32 mAutoPilotNoProgressFrameCount; F32 mAutoPilotRotationThreshold; std::string mAutoPilotBehaviorName; - void (*mAutoPilotFinishedCallback)(BOOL, void *); + void (*mAutoPilotFinishedCallback)(bool, void *); void* mAutoPilotCallbackData; LLUUID mLeaderID; - BOOL mMovementKeysLocked; + bool mMovementKeysLocked; /** Movement ** ** @@ -644,7 +644,7 @@ private: public: void teleportViaLandmark(const LLUUID& landmark_id); // Teleport to a landmark void teleportHome() { teleportViaLandmark(LLUUID::null); } // Go home - void teleportViaLure(const LLUUID& lure_id, BOOL godlike); // To an invited location + void teleportViaLure(const LLUUID& lure_id, bool godlike); // To an invited location void teleportViaLocation(const LLVector3d& pos_global); // To a global location - this will probably need to be deprecated void teleportViaLocationLookAt(const LLVector3d& pos_global);// To a global location, preserving camera rotation void teleportCancel(); // May or may not be allowed by server @@ -690,7 +690,7 @@ private: const LLVector3& pos_local, // Go to a named location home bool look_at_from_camera = false); void doTeleportViaLandmark(const LLUUID& landmark_id); // Teleport to a landmark - void doTeleportViaLure(const LLUUID& lure_id, BOOL godlike); // To an invited location + void doTeleportViaLure(const LLUUID& lure_id, bool godlike); // To an invited location void doTeleportViaLocation(const LLVector3d& pos_global); // To a global location - this will probably need to be deprecated void doTeleportViaLocationLookAt(const LLVector3d& pos_global);// To a global location, preserving camera rotation @@ -738,14 +738,14 @@ private: public: // Checks if agent can modify an object based on the permissions and the agent's proxy status. - BOOL isGrantedProxy(const LLPermissions& perm); - BOOL allowOperation(PermissionBit op, + bool isGrantedProxy(const LLPermissions& perm); + bool allowOperation(PermissionBit op, const LLPermissions& perm, U64 group_proxy_power = 0, U8 god_minimum = GOD_MAINTENANCE); const LLAgentAccess& getAgentAccess(); - BOOL canManageEstate() const; - BOOL getAdminOverride() const; + bool canManageEstate() const; + bool getAdminOverride() const; private: LLAgentAccess * mAgentAccess; @@ -756,7 +756,7 @@ public: bool isGodlike() const; bool isGodlikeWithoutAdminMenuFakery() const; U8 getGodLevel() const; - void setAdminOverride(BOOL b); + void setAdminOverride(bool b); void setGodLevel(U8 god_level); void requestEnterGodMode(); void requestLeaveGodMode(); @@ -827,13 +827,13 @@ private: public: LLQuaternion getHeadRotation(); - BOOL needsRenderAvatar(); // TRUE when camera mode is such that your own avatar should draw - BOOL needsRenderHead(); - void setShowAvatar(BOOL show) { mShowAvatar = show; } - BOOL getShowAvatar() const { return mShowAvatar; } + bool needsRenderAvatar(); // true when camera mode is such that your own avatar should draw + bool needsRenderHead(); + void setShowAvatar(bool show) { mShowAvatar = show; } + bool getShowAvatar() const { return mShowAvatar; } private: - BOOL mShowAvatar; // Should we render the avatar? + bool mShowAvatar; // Should we render the avatar? //-------------------------------------------------------------------- // Rendering state bitmap helpers @@ -865,15 +865,15 @@ private: public: const LLUUID &getGroupID() const { return mGroupID; } - // Get group information by group_id, or FALSE if not in group. - BOOL getGroupData(const LLUUID& group_id, LLGroupData& data) const; + // Get group information by group_id, or false if not in group. + bool getGroupData(const LLUUID& group_id, LLGroupData& data) const; // Get just the agent's contribution to the given group. S32 getGroupContribution(const LLUUID& group_id) const; // Update internal datastructures and update the server. - BOOL setGroupContribution(const LLUUID& group_id, S32 contribution); - BOOL setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOOL list_in_profile); + bool setGroupContribution(const LLUUID& group_id, S32 contribution); + bool setUserGroupFlags(const LLUUID& group_id, bool accept_notices, bool list_in_profile); const std::string &getGroupName() const { return mGroupName; } - BOOL canJoinGroups() const; + bool canJoinGroups() const; private: std::string mGroupName; LLUUID mGroupID; @@ -883,10 +883,10 @@ private: //-------------------------------------------------------------------- public: // Checks against all groups in the entire agent group list. - BOOL isInGroup(const LLUUID& group_id, BOOL ingnore_God_mod = FALSE) const; + bool isInGroup(const LLUUID& group_id, bool ingnore_God_mod = false) const; protected: // Only used for building titles. - BOOL isGroupMember() const { return !mGroupID.isNull(); } + bool isGroupMember() const { return !mGroupID.isNull(); } public: std::vector<LLGroupData> mGroups; @@ -894,18 +894,18 @@ public: // Group Title //-------------------------------------------------------------------- public: - void setHideGroupTitle(BOOL hide) { mHideGroupTitle = hide; } - BOOL isGroupTitleHidden() const { return mHideGroupTitle; } + void setHideGroupTitle(bool hide) { mHideGroupTitle = hide; } + bool isGroupTitleHidden() const { return mHideGroupTitle; } private: std::string mGroupTitle; // Honorific, like "Sir" - BOOL mHideGroupTitle; + bool mHideGroupTitle; //-------------------------------------------------------------------- // Group Powers //-------------------------------------------------------------------- public: - BOOL hasPowerInGroup(const LLUUID& group_id, U64 power) const; - BOOL hasPowerInActiveGroup(const U64 power) const; + bool hasPowerInGroup(const LLUUID& group_id, U64 power) const; + bool hasPowerInActiveGroup(const U64 power) const; U64 getPowerInGroup(const LLUUID& group_id) const; U64 mGroupPowers; diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 8e8d7e6c50..15d3b93818 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -123,14 +123,14 @@ LLAgentCamera::LLAgentCamera() : mHUDTargetZoom(1.f), mHUDCurZoom(1.f), - mForceMouselook(FALSE), + mForceMouselook(false), mCameraMode( CAMERA_MODE_THIRD_PERSON ), mLastCameraMode( CAMERA_MODE_THIRD_PERSON ), mCameraPreset(CAMERA_PRESET_REAR_VIEW), - mCameraAnimating( FALSE ), + mCameraAnimating( false ), mAnimationCameraStartGlobal(), mAnimationFocusStartGlobal(), mAnimationTimer(), @@ -146,21 +146,21 @@ LLAgentCamera::LLAgentCamera() : mTargetCameraDistance(2.f), mCameraZoomFraction(1.f), // deprecated mThirdPersonHeadOffset(0.f, 0.f, 1.f), - mSitCameraEnabled(FALSE), + mSitCameraEnabled(false), mCameraSmoothingLastPositionGlobal(), mCameraSmoothingLastPositionAgent(), mCameraSmoothingStop(false), mCameraUpVector(LLVector3::z_axis), // default is straight up - mFocusOnAvatar(TRUE), - mAllowChangeToFollow(FALSE), + mFocusOnAvatar(true), + mAllowChangeToFollow(false), mFocusGlobal(), mFocusTargetGlobal(), mFocusObject(NULL), mFocusObjectDist(0.f), mFocusObjectOffset(), - mTrackFocusObject(TRUE), + mTrackFocusObject(true), mAtKey(0), // Either 1, 0, or -1... indicates that movement-key is pressed mWalkKey(0), // like AtKey, but causes less forward thrust @@ -279,7 +279,7 @@ LLAgentCamera::~LLAgentCamera() //----------------------------------------------------------------------------- // resetView() //----------------------------------------------------------------------------- -void LLAgentCamera::resetView(BOOL reset_camera, BOOL change_camera) +void LLAgentCamera::resetView(bool reset_camera, bool change_camera) { if (gDisconnected) { @@ -288,7 +288,7 @@ void LLAgentCamera::resetView(BOOL reset_camera, BOOL change_camera) if (gAgent.getAutoPilot()) { - gAgent.stopAutoPilot(TRUE); + gAgent.stopAutoPilot(true); } LLSelectMgr::getInstance()->unhighlightAll(); @@ -348,7 +348,7 @@ void LLAgentCamera::resetView(BOOL reset_camera, BOOL change_camera) gAgent.resetAxes(lerp(gAgent.getAtAxis(), agent_at_axis, LLSmoothInterpolation::getInterpolant(0.3f))); } - setFocusOnAvatar(TRUE, ANIMATE); + setFocusOnAvatar(true, ANIMATE); mCameraFOVZoomFactor = 0.f; } @@ -381,7 +381,7 @@ void LLAgentCamera::unlockView() { setFocusGlobal(LLVector3d::zero, gAgentAvatarp->mID); } - setFocusOnAvatar(FALSE, FALSE); // no animation + setFocusOnAvatar(false, false); // no animation } } @@ -572,16 +572,16 @@ LLVector3 LLAgentCamera::calcFocusOffset(LLViewerObject *object, LLVector3 origi //----------------------------------------------------------------------------- // calcCameraMinDistance() //----------------------------------------------------------------------------- -BOOL LLAgentCamera::calcCameraMinDistance(F32 &obj_min_distance) +bool LLAgentCamera::calcCameraMinDistance(F32 &obj_min_distance) { - BOOL soft_limit = FALSE; // is the bounding box to be treated literally (volumes) or as an approximation (avatars) + bool soft_limit = false; // is the bounding box to be treated literally (volumes) or as an approximation (avatars) if (!mFocusObject || mFocusObject->isDead() || mFocusObject->isMesh() || isDisableCameraConstraints()) { obj_min_distance = 0.f; - return TRUE; + return true; } if (mFocusObject->mDrawable.isNull()) @@ -593,7 +593,7 @@ BOOL LLAgentCamera::calcCameraMinDistance(F32 &obj_min_distance) LL_ERRS() << "Focus object with no drawable!" << LL_ENDL; #endif obj_min_distance = 0.f; - return TRUE; + return true; } LLQuaternion inv_object_rot = ~mFocusObject->getRenderRotation(); @@ -612,20 +612,20 @@ BOOL LLAgentCamera::calcCameraMinDistance(F32 &obj_min_distance) object_extents.mV[VX] *= AVATAR_ZOOM_MIN_X_FACTOR; object_extents.mV[VY] *= AVATAR_ZOOM_MIN_Y_FACTOR; object_extents.mV[VZ] *= AVATAR_ZOOM_MIN_Z_FACTOR; - soft_limit = TRUE; + soft_limit = true; } LLVector3 abs_target_offset = target_offset_origin; abs_target_offset.abs(); LLVector3 target_offset_dir = target_offset_origin; - BOOL target_outside_object_extents = FALSE; + bool target_outside_object_extents = false; for (U32 i = VX; i <= VZ; i++) { if (abs_target_offset.mV[i] * 2.f > object_extents.mV[i] + OBJECT_EXTENTS_PADDING) { - target_outside_object_extents = TRUE; + target_outside_object_extents = true; } if (camera_offset_target.mV[i] > 0.f) { @@ -722,11 +722,11 @@ BOOL LLAgentCamera::calcCameraMinDistance(F32 &obj_min_distance) { if (camera_offset_clip > 0.f && target_offset_clip > 0.f) { - return FALSE; + return false; } else if (camera_offset_clip < 0.f && target_offset_clip < 0.f) { - return FALSE; + return false; } } @@ -735,7 +735,7 @@ BOOL LLAgentCamera::calcCameraMinDistance(F32 &obj_min_distance) obj_min_distance += LLViewerCamera::getInstance()->getNear() + (soft_limit ? 0.1f : 0.2f); - return TRUE; + return true; } F32 LLAgentCamera::getCameraZoomFraction(bool get_third_person) @@ -749,11 +749,6 @@ F32 LLAgentCamera::getCameraZoomFraction(bool get_third_person) return mHUDTargetZoom; } - if (isDisableCameraConstraints()) - { - return mCameraZoomFraction; - } - if (get_third_person || (mFocusOnAvatar && cameraThirdPerson())) { return clamp_rescale(mCameraZoomFraction, MIN_ZOOM_FRACTION, MAX_ZOOM_FRACTION, 1.f, 0.f); @@ -767,6 +762,10 @@ F32 LLAgentCamera::getCameraZoomFraction(bool get_third_person) F32 min_zoom; F32 max_zoom = getCameraMaxZoomDistance(); + if (isDisableCameraConstraints()) + { + max_zoom = MAX_CAMERA_DISTANCE_FROM_OBJECT; + } F32 distance = (F32)mCameraFocusOffsetTarget.magVec(); if (mFocusObject.notNull()) @@ -798,10 +797,6 @@ void LLAgentCamera::setCameraZoomFraction(F32 fraction) { mHUDTargetZoom = fraction; } - else if (isDisableCameraConstraints()) - { - mCameraZoomFraction = fraction; - } else if (mFocusOnAvatar && cameraThirdPerson()) { mCameraZoomFraction = rescale(fraction, 0.f, 1.f, MAX_ZOOM_FRACTION, MIN_ZOOM_FRACTION); @@ -816,6 +811,10 @@ void LLAgentCamera::setCameraZoomFraction(F32 fraction) { F32 min_zoom = LAND_MIN_ZOOM; F32 max_zoom = getCameraMaxZoomDistance(); + if (isDisableCameraConstraints()) + { + max_zoom = MAX_CAMERA_DISTANCE_FROM_OBJECT; + } if (mFocusObject.notNull()) { @@ -994,7 +993,7 @@ void LLAgentCamera::cameraOrbitIn(const F32 meters) if (!gSavedSettings.getBOOL("FreezeTime") && mCameraZoomFraction < MIN_ZOOM_FRACTION && meters > 0.f) { // No need to animate, camera is already there. - changeCameraToMouselook(FALSE); + changeCameraToMouselook(false); } if (!isDisableCameraConstraints()) @@ -1195,7 +1194,7 @@ void LLAgentCamera::updateLookAt(const S32 mouse_x, const S32 mouse_y) static LLTrace::BlockTimerStatHandle FTM_UPDATE_CAMERA("Camera"); -extern BOOL gCubeSnapshot; +extern bool gCubeSnapshot; //----------------------------------------------------------------------------- // updateCamera() @@ -1226,8 +1225,8 @@ void LLAgentCamera::updateCamera() if (cameraThirdPerson() && (mFocusOnAvatar || mAllowChangeToFollow) && LLFollowCamMgr::getInstance()->getActiveFollowCamParams()) { - mAllowChangeToFollow = FALSE; - mFocusOnAvatar = TRUE; + mAllowChangeToFollow = false; + mFocusOnAvatar = true; changeCameraToFollow(); } @@ -1334,12 +1333,12 @@ void LLAgentCamera::updateCamera() } else { - changeCameraToThirdPerson(TRUE); + changeCameraToThirdPerson(true); } } } - BOOL hit_limit; + bool hit_limit; LLVector3d camera_pos_global; LLVector3d camera_target_global = calcCameraPositionTargetGlobal(&hit_limit); mCameraVirtualPositionAgent = gAgent.getPosAgentFromGlobal(camera_target_global); @@ -1349,7 +1348,7 @@ void LLAgentCamera::updateCamera() mCameraFOVZoomFactor = calcCameraFOVZoomFactor(); camera_target_global = focus_target_global + (camera_target_global - focus_target_global) * (1.f + mCameraFOVZoomFactor); - gAgent.setShowAvatar(TRUE); // can see avatar by default + gAgent.setShowAvatar(true); // can see avatar by default // Adjust position for animation if (mCameraAnimating) @@ -1362,8 +1361,8 @@ void LLAgentCamera::updateCamera() // linear interpolation F32 fraction_of_animation = time / mAnimationDuration; - BOOL isfirstPerson = mCameraMode == CAMERA_MODE_MOUSELOOK; - BOOL wasfirstPerson = mLastCameraMode == CAMERA_MODE_MOUSELOOK; + bool isfirstPerson = mCameraMode == CAMERA_MODE_MOUSELOOK; + bool wasfirstPerson = mLastCameraMode == CAMERA_MODE_MOUSELOOK; F32 fraction_animation_to_skip; if (mAnimationCameraStartGlobal == camera_target_global) @@ -1382,7 +1381,7 @@ void LLAgentCamera::updateCamera() { if (fraction_of_animation < animation_start_fraction || fraction_of_animation > animation_finish_fraction ) { - gAgent.setShowAvatar(FALSE); + gAgent.setShowAvatar(false); } // ...adjust position for animation @@ -1393,13 +1392,13 @@ void LLAgentCamera::updateCamera() else { // ...animation complete - mCameraAnimating = FALSE; + mCameraAnimating = false; camera_pos_global = camera_target_global; mFocusGlobal = focus_target_global; gAgent.endAnimationUpdateUI(); - gAgent.setShowAvatar(TRUE); + gAgent.setShowAvatar(true); } if (isAgentAvatarValid() && (mCameraMode != CAMERA_MODE_MOUSELOOK)) @@ -1411,11 +1410,11 @@ void LLAgentCamera::updateCamera() { camera_pos_global = camera_target_global; mFocusGlobal = focus_target_global; - gAgent.setShowAvatar(TRUE); + gAgent.setShowAvatar(true); } // smoothing - if (TRUE) + if (true) { LLVector3d agent_pos = gAgent.getPositionGlobal(); LLVector3d camera_pos_agent = camera_pos_global - agent_pos; @@ -1428,7 +1427,7 @@ void LLAgentCamera::updateCamera() { const F32 SMOOTHING_HALF_LIFE = 0.02f; - F32 smoothing = LLSmoothInterpolation::getInterpolant(gSavedSettings.getF32("CameraPositionSmoothing") * SMOOTHING_HALF_LIFE, FALSE); + F32 smoothing = LLSmoothInterpolation::getInterpolant(gSavedSettings.getF32("CameraPositionSmoothing") * SMOOTHING_HALF_LIFE, false); if (mFocusOnAvatar && !mFocusObject) // we differentiate on avatar mode { @@ -1751,7 +1750,7 @@ F32 LLAgentCamera::calcCameraFOVZoomFactor() //----------------------------------------------------------------------------- // calcCameraPositionTargetGlobal() //----------------------------------------------------------------------------- -LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) +LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(bool *hit_limit) { // Compute base camera position and look-at points. F32 camera_land_height; @@ -1759,7 +1758,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) gAgent.getPositionGlobal() : gAgent.getPosGlobalFromAgent(getAvatarRootPosition()); - BOOL isConstrained = FALSE; + bool isConstrained = false; LLVector3d head_offset; head_offset.setVec(mThirdPersonHeadOffset); @@ -1986,7 +1985,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) if(camera_distance > max_dist) { camera_position_global = gAgent.getPositionGlobal() + (max_dist/camera_distance)*camera_offset; - isConstrained = TRUE; + isConstrained = true; } } @@ -1997,7 +1996,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) // { // camera_position_global = last_position_global; // -// isConstrained = TRUE; +// isConstrained = true; // } } @@ -2008,7 +2007,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) if (camera_position_global.mdV[VZ] < minZ) { camera_position_global.mdV[VZ] = minZ; - isConstrained = TRUE; + isConstrained = true; } if (hit_limit) @@ -2090,7 +2089,7 @@ void LLAgentCamera::handleScrollWheel(S32 clicks) mFollowCam.zoom(clicks); if (mFollowCam.isZoomedToMinimumDistance()) { - changeCameraToMouselook(FALSE); + changeCameraToMouselook(false); } } } @@ -2166,7 +2165,7 @@ void LLAgentCamera::resetCamera() //----------------------------------------------------------------------------- // changeCameraToMouselook() //----------------------------------------------------------------------------- -void LLAgentCamera::changeCameraToMouselook(BOOL animate) +void LLAgentCamera::changeCameraToMouselook(bool animate) { if (!gSavedSettings.getBOOL("EnableMouselook") || LLViewerJoystick::getInstance()->getOverrideCamera()) @@ -2216,7 +2215,7 @@ void LLAgentCamera::changeCameraToMouselook(BOOL animate) } else { - mCameraAnimating = FALSE; + mCameraAnimating = false; gAgent.endAnimationUpdateUI(); } } @@ -2252,7 +2251,7 @@ void LLAgentCamera::changeCameraToDefault() //----------------------------------------------------------------------------- // changeCameraToFollow() //----------------------------------------------------------------------------- -void LLAgentCamera::changeCameraToFollow(BOOL animate) +void LLAgentCamera::changeCameraToFollow(bool animate) { if (LLViewerJoystick::getInstance()->getOverrideCamera()) { @@ -2263,7 +2262,7 @@ void LLAgentCamera::changeCameraToFollow(BOOL animate) { if (mCameraMode == CAMERA_MODE_MOUSELOOK) { - animate = FALSE; + animate = false; } startCameraAnimation(); @@ -2297,7 +2296,7 @@ void LLAgentCamera::changeCameraToFollow(BOOL animate) } else { - mCameraAnimating = FALSE; + mCameraAnimating = false; gAgent.endAnimationUpdateUI(); } } @@ -2306,7 +2305,7 @@ void LLAgentCamera::changeCameraToFollow(BOOL animate) //----------------------------------------------------------------------------- // changeCameraToThirdPerson() //----------------------------------------------------------------------------- -void LLAgentCamera::changeCameraToThirdPerson(BOOL animate) +void LLAgentCamera::changeCameraToThirdPerson(bool animate) { if (LLViewerJoystick::getInstance()->getOverrideCamera()) { @@ -2345,7 +2344,7 @@ void LLAgentCamera::changeCameraToThirdPerson(BOOL animate) { mCurrentCameraDistance = MIN_CAMERA_DISTANCE; mTargetCameraDistance = MIN_CAMERA_DISTANCE; - animate = FALSE; + animate = false; } updateLastCamera(); mCameraMode = CAMERA_MODE_THIRD_PERSON; @@ -2368,7 +2367,7 @@ void LLAgentCamera::changeCameraToThirdPerson(BOOL animate) } else { - mCameraAnimating = FALSE; + mCameraAnimating = false; gAgent.endAnimationUpdateUI(); } } @@ -2408,7 +2407,7 @@ void LLAgentCamera::changeCameraToCustomizeAvatar() gFocusMgr.setMouseCapture( NULL ); if( gMorphView ) { - gMorphView->setVisible( TRUE ); + gMorphView->setVisible( true ); } // Remove any pitch or rotation from the avatar LLVector3 at = gAgent.getAtAxis(); @@ -2417,7 +2416,7 @@ void LLAgentCamera::changeCameraToCustomizeAvatar() gAgent.resetAxes(at); gAgent.sendAnimationRequest(ANIM_AGENT_CUSTOMIZE, ANIM_REQUEST_START); - gAgent.setCustomAnim(TRUE); + gAgent.setCustomAnim(true); gAgentAvatarp->startMotion(ANIM_AGENT_CUSTOMIZE); LLMotion* turn_motion = gAgentAvatarp->findMotion(ANIM_AGENT_CUSTOMIZE); @@ -2453,7 +2452,7 @@ void LLAgentCamera::switchCameraPreset(ECameraPreset preset) mCameraZoomFraction = 1.f; //focusing on avatar in that case means following him on movements - mFocusOnAvatar = TRUE; + mFocusOnAvatar = true; mCameraPreset = preset; @@ -2491,7 +2490,7 @@ void LLAgentCamera::startCameraAnimation() mAnimationFocusStartGlobal = mFocusGlobal; setAnimationDuration(gSavedSettings.getF32("ZoomTime")); mAnimationTimer.reset(); - mCameraAnimating = TRUE; + mCameraAnimating = true; } //----------------------------------------------------------------------------- @@ -2499,7 +2498,7 @@ void LLAgentCamera::startCameraAnimation() //----------------------------------------------------------------------------- void LLAgentCamera::stopCameraAnimation() { - mCameraAnimating = FALSE; + mCameraAnimating = false; } void LLAgentCamera::clearFocusObject() @@ -2679,7 +2678,7 @@ void LLAgentCamera::setCameraPosAndFocusGlobal(const LLVector3d& camera_pos, con //----------------------------------------------------------------------------- void LLAgentCamera::setSitCamera(const LLUUID &object_id, const LLVector3 &camera_pos, const LLVector3 &camera_focus) { - BOOL camera_enabled = !object_id.isNull(); + bool camera_enabled = !object_id.isNull(); if (camera_enabled) { @@ -2690,7 +2689,7 @@ void LLAgentCamera::setSitCamera(const LLUUID &object_id, const LLVector3 &camer mSitCameraPos = camera_pos; mSitCameraFocus = camera_focus; mSitCameraReferenceObject = reference_object; - mSitCameraEnabled = TRUE; + mSitCameraEnabled = true; } } else @@ -2698,14 +2697,14 @@ void LLAgentCamera::setSitCamera(const LLUUID &object_id, const LLVector3 &camer mSitCameraPos.clearVec(); mSitCameraFocus.clearVec(); mSitCameraReferenceObject = NULL; - mSitCameraEnabled = FALSE; + mSitCameraEnabled = false; } } //----------------------------------------------------------------------------- // setFocusOnAvatar() //----------------------------------------------------------------------------- -void LLAgentCamera::setFocusOnAvatar(BOOL focus_on_avatar, BOOL animate, BOOL reset_axes) +void LLAgentCamera::setFocusOnAvatar(bool focus_on_avatar, bool animate, bool reset_axes) { if (focus_on_avatar != mFocusOnAvatar) { @@ -2752,14 +2751,14 @@ void LLAgentCamera::setFocusOnAvatar(BOOL focus_on_avatar, BOOL animate, BOOL re { // keep camera focus point consistent, even though it is now unlocked setFocusGlobal(gAgent.getPositionGlobal() + calcThirdPersonFocusOffset(), gAgent.getID()); - mAllowChangeToFollow = FALSE; + mAllowChangeToFollow = false; } mFocusOnAvatar = focus_on_avatar; } -BOOL LLAgentCamera::setLookAt(ELookAtType target_type, LLViewerObject *object, LLVector3 position) +bool LLAgentCamera::setLookAt(ELookAtType target_type, LLViewerObject *object, LLVector3 position) { if(object && object->isAttachment()) { @@ -2828,7 +2827,7 @@ void LLAgentCamera::lookAtLastChat() new_camera_pos += left * 0.3f; new_camera_pos += up * 0.2f; - setFocusOnAvatar(FALSE, FALSE); + setFocusOnAvatar(false, false); if (chatter_av->mHeadp) { @@ -2859,7 +2858,7 @@ void LLAgentCamera::lookAtLastChat() new_camera_pos += left * 0.3f; new_camera_pos += up * 0.2f; - setFocusOnAvatar(FALSE, FALSE); + setFocusOnAvatar(false, false); setFocusGlobal(chatter->getPositionGlobal(), gAgent.getLastChatter()); mCameraFocusOffsetTarget = gAgent.getPosGlobalFromAgent(new_camera_pos) - chatter->getPositionGlobal(); @@ -2871,12 +2870,12 @@ bool LLAgentCamera::isfollowCamLocked() return mFollowCam.getPositionLocked(); } -BOOL LLAgentCamera::setPointAt(EPointAtType target_type, LLViewerObject *object, LLVector3 position) +bool LLAgentCamera::setPointAt(EPointAtType target_type, LLViewerObject *object, LLVector3 position) { // disallow pointing at attachments and avatars if (object && (object->isAttachment() || object->isAvatar())) { - return FALSE; + return false; } if (!mPointAt || mPointAt->isDead()) { diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h index 4a9e5efadf..52571f3c55 100644 --- a/indra/newview/llagentcamera.h +++ b/indra/newview/llagentcamera.h @@ -89,14 +89,14 @@ private: //-------------------------------------------------------------------- public: void changeCameraToDefault(); - void changeCameraToMouselook(BOOL animate = TRUE); - void changeCameraToThirdPerson(BOOL animate = TRUE); + void changeCameraToMouselook(bool animate = true); + void changeCameraToThirdPerson(bool animate = true); void changeCameraToCustomizeAvatar(); // Trigger transition animation - void changeCameraToFollow(BOOL animate = TRUE); // Ventrella - BOOL cameraThirdPerson() const { return (mCameraMode == CAMERA_MODE_THIRD_PERSON && mLastCameraMode == CAMERA_MODE_THIRD_PERSON); } - BOOL cameraMouselook() const { return (mCameraMode == CAMERA_MODE_MOUSELOOK && mLastCameraMode == CAMERA_MODE_MOUSELOOK); } - BOOL cameraCustomizeAvatar() const { return (mCameraMode == CAMERA_MODE_CUSTOMIZE_AVATAR /*&& !mCameraAnimating*/); } - BOOL cameraFollow() const { return (mCameraMode == CAMERA_MODE_FOLLOW && mLastCameraMode == CAMERA_MODE_FOLLOW); } + void changeCameraToFollow(bool animate = true); // Ventrella + bool cameraThirdPerson() const { return (mCameraMode == CAMERA_MODE_THIRD_PERSON && mLastCameraMode == CAMERA_MODE_THIRD_PERSON); } + bool cameraMouselook() const { return (mCameraMode == CAMERA_MODE_MOUSELOOK && mLastCameraMode == CAMERA_MODE_MOUSELOOK); } + bool cameraCustomizeAvatar() const { return (mCameraMode == CAMERA_MODE_CUSTOMIZE_AVATAR /*&& !mCameraAnimating*/); } + bool cameraFollow() const { return (mCameraMode == CAMERA_MODE_FOLLOW && mLastCameraMode == CAMERA_MODE_FOLLOW); } ECameraMode getCameraMode() const { return mCameraMode; } ECameraMode getLastCameraMode() const { return mLastCameraMode; } void updateCamera(); // Call once per frame to update camera location/orientation @@ -139,10 +139,10 @@ private: public: LLVector3d getCameraPositionGlobal() const; const LLVector3 &getCameraPositionAgent() const; - LLVector3d calcCameraPositionTargetGlobal(BOOL *hit_limit = NULL); // Calculate the camera position target + LLVector3d calcCameraPositionTargetGlobal(bool *hit_limit = NULL); // Calculate the camera position target F32 getCameraMinOffGround(); // Minimum height off ground for this mode, meters void setCameraCollidePlane(const LLVector4 &plane) { mCameraCollidePlane = plane; } - BOOL calcCameraMinDistance(F32 &obj_min_distance); + bool calcCameraMinDistance(F32 &obj_min_distance); F32 getCurrentCameraBuildOffset() { return (F32)mCameraFocusOffset.length(); } void clearCameraLag() { mCameraLag.clearVec(); } private: @@ -175,12 +175,12 @@ private: //-------------------------------------------------------------------- public: void setupSitCamera(); - BOOL sitCameraEnabled() { return mSitCameraEnabled; } + bool sitCameraEnabled() { return mSitCameraEnabled; } void setSitCamera(const LLUUID &object_id, const LLVector3 &camera_pos = LLVector3::zero, const LLVector3 &camera_focus = LLVector3::zero); private: LLPointer<LLViewerObject> mSitCameraReferenceObject; // Object to which camera is related when sitting - BOOL mSitCameraEnabled; // Use provided camera information when sitting? + bool mSitCameraEnabled; // Use provided camera information when sitting? LLVector3 mSitCameraPos; // Root relative camera pos when sitting LLVector3 mSitCameraFocus; // Root relative camera target when sitting @@ -188,15 +188,15 @@ private: // Animation //-------------------------------------------------------------------- public: - void setCameraAnimating(BOOL b) { mCameraAnimating = b; } - BOOL getCameraAnimating() { return mCameraAnimating; } + void setCameraAnimating(bool b) { mCameraAnimating = b; } + bool getCameraAnimating() { return mCameraAnimating; } void setAnimationDuration(F32 seconds); void startCameraAnimation(); void stopCameraAnimation(); private: LLFrameTimer mAnimationTimer; // Seconds that transition animation has been active F32 mAnimationDuration; // In seconds - BOOL mCameraAnimating; // Camera is transitioning from one mode to another + bool mCameraAnimating; // Camera is transitioning from one mode to another LLVector3d mAnimationCameraStartGlobal; // Camera start position, global coords LLVector3d mAnimationFocusStartGlobal; // Camera focus point, global coords @@ -206,43 +206,43 @@ private: public: LLVector3d calcFocusPositionTargetGlobal(); LLVector3 calcFocusOffset(LLViewerObject *object, LLVector3 pos_agent, S32 x, S32 y); - BOOL getFocusOnAvatar() const { return mFocusOnAvatar; } + bool getFocusOnAvatar() const { return mFocusOnAvatar; } LLPointer<LLViewerObject>& getFocusObject() { return mFocusObject; } F32 getFocusObjectDist() const { return mFocusObjectDist; } void updateFocusOffset(); void validateFocusObject(); void setFocusGlobal(const LLPickInfo& pick); void setFocusGlobal(const LLVector3d &focus, const LLUUID &object_id = LLUUID::null); - void setFocusOnAvatar(BOOL focus, BOOL animate, BOOL reset_axes = TRUE); + void setFocusOnAvatar(bool focus, bool animate, bool reset_axes = true); void setCameraPosAndFocusGlobal(const LLVector3d& pos, const LLVector3d& focus, const LLUUID &object_id); void clearFocusObject(); void setFocusObject(LLViewerObject* object); - void setAllowChangeToFollow(BOOL focus) { mAllowChangeToFollow = focus; } - void setObjectTracking(BOOL track) { mTrackFocusObject = track; } + void setAllowChangeToFollow(bool focus) { mAllowChangeToFollow = focus; } + void setObjectTracking(bool track) { mTrackFocusObject = track; } const LLVector3d &getFocusGlobal() const { return mFocusGlobal; } const LLVector3d &getFocusTargetGlobal() const { return mFocusTargetGlobal; } private: LLVector3d mCameraFocusOffset; // Offset from focus point in build mode LLVector3d mCameraFocusOffsetTarget; // Target towards which we are lerping the camera's focus offset - BOOL mFocusOnAvatar; - BOOL mAllowChangeToFollow; + bool mFocusOnAvatar; + bool mAllowChangeToFollow; LLVector3d mFocusGlobal; LLVector3d mFocusTargetGlobal; LLPointer<LLViewerObject> mFocusObject; F32 mFocusObjectDist; LLVector3 mFocusObjectOffset; - BOOL mTrackFocusObject; + bool mTrackFocusObject; //-------------------------------------------------------------------- // Lookat / Pointat //-------------------------------------------------------------------- public: void updateLookAt(const S32 mouse_x, const S32 mouse_y); - BOOL setLookAt(ELookAtType target_type, LLViewerObject *object = NULL, LLVector3 position = LLVector3::zero); + bool setLookAt(ELookAtType target_type, LLViewerObject *object = NULL, LLVector3 position = LLVector3::zero); ELookAtType getLookAtType(); void lookAtLastChat(); void slamLookAt(const LLVector3 &look_at); // Set the physics data - BOOL setPointAt(EPointAtType target_type, LLViewerObject *object = NULL, LLVector3 position = LLVector3::zero); + bool setPointAt(EPointAtType target_type, LLViewerObject *object = NULL, LLVector3 position = LLVector3::zero); EPointAtType getPointAtType(); public: LLPointer<LLHUDEffectLookAt> mLookAt; @@ -294,7 +294,7 @@ public: //-------------------------------------------------------------------- public: // Called whenever the agent moves. Puts camera back in default position, deselects items, etc. - void resetView(BOOL reset_camera = TRUE, BOOL change_camera = FALSE); + void resetView(bool reset_camera = true, bool change_camera = false); // Called on camera movement. Unlocks camera from the default position behind the avatar. void unlockView(); public: @@ -304,10 +304,10 @@ public: // Mouselook //-------------------------------------------------------------------- public: - BOOL getForceMouselook() const { return mForceMouselook; } - void setForceMouselook(BOOL mouselook) { mForceMouselook = mouselook; } + bool getForceMouselook() const { return mForceMouselook; } + void setForceMouselook(bool mouselook) { mForceMouselook = mouselook; } private: - BOOL mForceMouselook; + bool mForceMouselook; //-------------------------------------------------------------------- // HUD diff --git a/indra/newview/llagentlanguage.cpp b/indra/newview/llagentlanguage.cpp index caf5950e53..3a29b85783 100644 --- a/indra/newview/llagentlanguage.cpp +++ b/indra/newview/llagentlanguage.cpp @@ -48,7 +48,7 @@ void LLAgentLanguage::onChange() { // Clear inventory cache so that default names of inventory items // appear retranslated (EXT-8308). - gSavedSettings.setBOOL("PurgeCacheOnNextStartup", TRUE); + gSavedSettings.setBOOL("PurgeCacheOnNextStartup", true); } // send language settings to the sim diff --git a/indra/newview/llagentlistener.cpp b/indra/newview/llagentlistener.cpp index 54998f3945..005a518910 100644 --- a/indra/newview/llagentlistener.cpp +++ b/indra/newview/llagentlistener.cpp @@ -347,10 +347,10 @@ void LLAgentListener::startAutoPilot(LLSD const & event_data) rotation_threshold = event_data["rotation_threshold"].asReal(); } - BOOL allow_flying = TRUE; + bool allow_flying = true; if (event_data.has("allow_flying")) { - allow_flying = (BOOL) event_data["allow_flying"].asBoolean(); + allow_flying = (bool) event_data["allow_flying"].asBoolean(); mAgent.setFlying(allow_flying); } @@ -411,10 +411,10 @@ void LLAgentListener::startFollowPilot(LLSD const & event_data) { LLUUID target_id; - BOOL allow_flying = TRUE; + bool allow_flying = true; if (event_data.has("allow_flying")) { - allow_flying = (BOOL) event_data["allow_flying"].asBoolean(); + allow_flying = (bool) event_data["allow_flying"].asBoolean(); } if (event_data.has("leader_id")) @@ -469,7 +469,7 @@ void LLAgentListener::setAutoPilotTarget(LLSD const & event_data) const void LLAgentListener::stopAutoPilot(LLSD const & event_data) const { - BOOL user_cancel = FALSE; + bool user_cancel = false; if (event_data.has("user_cancel")) { user_cancel = event_data["user_cancel"].asBoolean(); diff --git a/indra/newview/llagentpicksinfo.cpp b/indra/newview/llagentpicksinfo.cpp index 17464dcef9..e2a2d2d8a9 100644 --- a/indra/newview/llagentpicksinfo.cpp +++ b/indra/newview/llagentpicksinfo.cpp @@ -123,5 +123,5 @@ void LLAgentPicksInfo::onServerRespond(LLAvatarData* picks) return; } - setNumberOfPicks(picks->picks_list.size()); + setNumberOfPicks(static_cast<S32>(picks->picks_list.size())); } diff --git a/indra/newview/llagentpicksinfo.h b/indra/newview/llagentpicksinfo.h index edd41d8746..9bc105a655 100644 --- a/indra/newview/llagentpicksinfo.h +++ b/indra/newview/llagentpicksinfo.h @@ -60,7 +60,7 @@ public: S32 getMaxNumberOfPicks() { return mMaxNumberOfPicks; } /** - * Returns TRUE if Agent has maximum allowed number of Picks. + * Returns true if Agent has maximum allowed number of Picks. */ bool isPickLimitReached(); diff --git a/indra/newview/llagentpilot.cpp b/indra/newview/llagentpilot.cpp index ecb705ec2d..40f1679663 100644 --- a/indra/newview/llagentpilot.cpp +++ b/indra/newview/llagentpilot.cpp @@ -42,15 +42,15 @@ LLAgentPilot gAgentPilot; LLAgentPilot::LLAgentPilot() : mNumRuns(-1), - mQuitAfterRuns(FALSE), - mRecording(FALSE), + mQuitAfterRuns(false), + mRecording(false), mLastRecordTime(0.f), - mStarted(FALSE), - mPlaying(FALSE), + mStarted(false), + mPlaying(false), mCurrentAction(0), - mOverrideCamera(FALSE), - mLoop(TRUE), - mReplaySession(FALSE) + mOverrideCamera(false), + mLoop(true), + mReplaySession(false) { } @@ -221,14 +221,14 @@ void LLAgentPilot::startRecord() mActions.clear(); mTimer.reset(); addAction(STRAIGHT); - mRecording = TRUE; + mRecording = true; } void LLAgentPilot::stopRecord() { gAgentPilot.addAction(STRAIGHT); gAgentPilot.save(); - mRecording = FALSE; + mRecording = false; } void LLAgentPilot::addAction(enum EActionType action_type) @@ -252,7 +252,7 @@ void LLAgentPilot::startPlayback() { if (!mPlaying) { - mPlaying = TRUE; + mPlaying = true; mCurrentAction = 0; mTimer.reset(); @@ -261,12 +261,12 @@ void LLAgentPilot::startPlayback() LL_INFOS() << "Starting playback, moving to waypoint 0" << LL_ENDL; gAgent.startAutoPilotGlobal(mActions[0].mTarget); moveCamera(); - mStarted = FALSE; + mStarted = false; } else { LL_INFOS() << "No autopilot data, cancelling!" << LL_ENDL; - mPlaying = FALSE; + mPlaying = false; } } } @@ -275,7 +275,7 @@ void LLAgentPilot::stopPlayback() { if (mPlaying) { - mPlaying = FALSE; + mPlaying = false; mCurrentAction = 0; mTimer.reset(); gAgent.stopAutoPilot(); @@ -347,7 +347,7 @@ void LLAgentPilot::updateTarget() { LL_INFOS() << "At start, beginning playback" << LL_ENDL; mTimer.reset(); - mStarted = TRUE; + mStarted = true; } } } diff --git a/indra/newview/llagentpilot.h b/indra/newview/llagentpilot.h index 42ca716511..eff38d2468 100644 --- a/indra/newview/llagentpilot.h +++ b/indra/newview/llagentpilot.h @@ -68,35 +68,35 @@ public: void addWaypoint(); void moveCamera(); - void setReplaySession(BOOL new_val) { mReplaySession = new_val; } - BOOL getReplaySession() { return mReplaySession; } + void setReplaySession(bool new_val) { mReplaySession = new_val; } + bool getReplaySession() { return mReplaySession; } - void setLoop(BOOL new_val) { mLoop = new_val; } - BOOL getLoop() { return mLoop; } + void setLoop(bool new_val) { mLoop = new_val; } + bool getLoop() { return mLoop; } - void setQuitAfterRuns(BOOL quit_val) { mQuitAfterRuns = quit_val; } + void setQuitAfterRuns(bool quit_val) { mQuitAfterRuns = quit_val; } void setNumRuns(S32 num_runs) { mNumRuns = num_runs; } private: - BOOL mLoop; - BOOL mReplaySession; + bool mLoop; + bool mReplaySession; S32 mNumRuns; - BOOL mQuitAfterRuns; + bool mQuitAfterRuns; void setAutopilotTarget(const S32 id); - BOOL mRecording; + bool mRecording; F32 mLastRecordTime; - BOOL mStarted; - BOOL mPlaying; + bool mStarted; + bool mPlaying; S32 mCurrentAction; - BOOL mOverrideCamera; + bool mOverrideCamera; class Action { diff --git a/indra/newview/llagentui.cpp b/indra/newview/llagentui.cpp index 6657ed9857..81a3942d8a 100644 --- a/indra/newview/llagentui.cpp +++ b/indra/newview/llagentui.cpp @@ -68,19 +68,19 @@ void LLAgentUI::buildSLURL(LLSLURL& slurl, const bool escaped /*= true*/) } //static -BOOL LLAgentUI::checkAgentDistance(const LLVector3& pole, F32 radius) +bool LLAgentUI::checkAgentDistance(const LLVector3& pole, F32 radius) { F32 delta_x = gAgent.getPositionAgent().mV[VX] - pole.mV[VX]; F32 delta_y = gAgent.getPositionAgent().mV[VY] - pole.mV[VY]; return sqrt( delta_x* delta_x + delta_y* delta_y ) < radius; } -BOOL LLAgentUI::buildLocationString(std::string& str, ELocationFormat fmt,const LLVector3& agent_pos_region) +bool LLAgentUI::buildLocationString(std::string& str, ELocationFormat fmt,const LLVector3& agent_pos_region) { LLViewerRegion* region = gAgent.getRegion(); LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); - if (!region || !parcel) return FALSE; + if (!region || !parcel) return false; S32 pos_x = S32(agent_pos_region.mV[VX] + 0.5f); S32 pos_y = S32(agent_pos_region.mV[VY] + 0.5f); @@ -186,9 +186,9 @@ BOOL LLAgentUI::buildLocationString(std::string& str, ELocationFormat fmt,const } } str = buffer; - return TRUE; + return true; } -BOOL LLAgentUI::buildLocationString(std::string& str, ELocationFormat fmt) +bool LLAgentUI::buildLocationString(std::string& str, ELocationFormat fmt) { return buildLocationString(str,fmt, gAgent.getPositionAgent()); } diff --git a/indra/newview/llagentui.h b/indra/newview/llagentui.h index cbf5a095db..aae55d6444 100644 --- a/indra/newview/llagentui.h +++ b/indra/newview/llagentui.h @@ -46,14 +46,14 @@ public: static void buildSLURL(LLSLURL& slurl, const bool escaped = true); //build location string using the current position of gAgent. - static BOOL buildLocationString(std::string& str, ELocationFormat fmt = LOCATION_FORMAT_LANDMARK); + static bool buildLocationString(std::string& str, ELocationFormat fmt = LOCATION_FORMAT_LANDMARK); //build location string using a region position of the avatar. - static BOOL buildLocationString(std::string& str, ELocationFormat fmt,const LLVector3& agent_pos_region); + static bool buildLocationString(std::string& str, ELocationFormat fmt,const LLVector3& agent_pos_region); /** * @brief Check whether the agent is in neighborhood of the pole Within same region * @return true if the agent is in neighborhood. */ - static BOOL checkAgentDistance(const LLVector3& local_pole, F32 radius); + static bool checkAgentDistance(const LLVector3& local_pole, F32 radius); }; #endif //LLAGENTUI_H diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index d2046c0f83..faa5d801dd 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -56,7 +56,7 @@ LLAgentWearables gAgentWearables; -BOOL LLAgentWearables::mInitialWearablesUpdateReceived = FALSE; +bool LLAgentWearables::mInitialWearablesUpdateReceived = false; using namespace LLAvatarAppearanceDefines; @@ -76,7 +76,7 @@ void set_default_permissions(LLViewerInventoryItem* item) item->setPermissions(perm); - item->updateServer(FALSE); + item->updateServer(false); } } @@ -194,7 +194,7 @@ struct LLAgentDumper LLAgentWearables::LLAgentWearables() : LLWearableData(), - mWearablesLoaded(FALSE) + mWearablesLoaded(false) , mCOFChangeInProgress(false) { } @@ -304,7 +304,7 @@ void LLAgentWearables::addWearabletoAgentInventoryDone(const LLWearableType::ETy item->setAssetUUID(wearable->getAssetID()); item->setTransactionID(wearable->getTransactionID()); gInventory.addChangedMask(LLInventoryObserver::INTERNAL, item_id); - item->updateServer(FALSE); + item->updateServer(false); } gInventory.notifyObservers(); } @@ -375,7 +375,7 @@ void LLAgentWearables::saveWearableAs(const LLWearableType::EType type, const U32 index, const std::string& new_name, const std::string& description, - BOOL save_in_lost_and_found) + bool save_in_lost_and_found) { if (!isWearableCopyable(type, index)) { @@ -493,13 +493,13 @@ void LLAgentWearables::setWearableName(const LLUUID& item_id, const std::string& } -BOOL LLAgentWearables::isWearableModifiable(LLWearableType::EType type, U32 index) const +bool LLAgentWearables::isWearableModifiable(LLWearableType::EType type, U32 index) const { LLUUID item_id = getWearableItemID(type, index); - return item_id.notNull() ? isWearableModifiable(item_id) : FALSE; + return item_id.notNull() ? isWearableModifiable(item_id) : false; } -BOOL LLAgentWearables::isWearableModifiable(const LLUUID& item_id) const +bool LLAgentWearables::isWearableModifiable(const LLUUID& item_id) const { const LLUUID& linked_id = gInventory.getLinkedItemID(item_id); if (linked_id.notNull()) @@ -508,13 +508,13 @@ BOOL LLAgentWearables::isWearableModifiable(const LLUUID& item_id) const if (item && item->getPermissions().allowModifyBy(gAgent.getID(), gAgent.getGroupID())) { - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL LLAgentWearables::isWearableCopyable(LLWearableType::EType type, U32 index) const +bool LLAgentWearables::isWearableCopyable(LLWearableType::EType type, U32 index) const { LLUUID item_id = getWearableItemID(type, index); if (!item_id.isNull()) @@ -523,27 +523,11 @@ BOOL LLAgentWearables::isWearableCopyable(LLWearableType::EType type, U32 index) if (item && item->getPermissions().allowCopyBy(gAgent.getID(), gAgent.getGroupID())) { - return TRUE; + return true; } } - return FALSE; -} - -/* - U32 LLAgentWearables::getWearablePermMask(LLWearableType::EType type) - { - LLUUID item_id = getWearableItemID(type); - if (!item_id.isNull()) - { - LLInventoryItem* item = gInventory.getItem(item_id); - if (item) - { - return item->getPermissions().getMaskOwner(); - } - } - return PERM_NONE; - } -*/ + return false; +} LLInventoryItem* LLAgentWearables::getWearableInventoryItem(LLWearableType::EType type, U32 index) { @@ -617,13 +601,13 @@ const LLViewerWearable* LLAgentWearables::getViewerWearable(const LLWearableType } // static -BOOL LLAgentWearables::selfHasWearable(LLWearableType::EType type) +bool LLAgentWearables::selfHasWearable(LLWearableType::EType type) { return (gAgentWearables.getWearableCount(type) > 0); } // virtual -void LLAgentWearables::wearableUpdated(LLWearable *wearable, BOOL removed) +void LLAgentWearables::wearableUpdated(LLWearable *wearable, bool removed) { if (isAgentAvatarValid()) { @@ -675,9 +659,9 @@ const LLUUID LLAgentWearables::getWearableAssetID(LLWearableType::EType type, U3 return LLUUID(); } -BOOL LLAgentWearables::isWearingItem(const LLUUID& item_id) const +bool LLAgentWearables::isWearingItem(const LLUUID& item_id) const { - return getWearableFromItemID(item_id) != NULL; + return getWearableFromItemID(item_id) != nullptr; } void LLAgentWearables::addLocalTextureObject(const LLWearableType::EType wearable_type, const LLAvatarAppearanceDefines::ETextureIndex texture_type, U32 wearable_index) @@ -772,21 +756,21 @@ void LLAgentWearables::createStandardWearables() if (!isAgentAvatarValid()) return; - const BOOL create[LLWearableType::WT_COUNT] = + constexpr bool create[LLWearableType::WT_COUNT] = { - TRUE, //LLWearableType::WT_SHAPE - TRUE, //LLWearableType::WT_SKIN - TRUE, //LLWearableType::WT_HAIR - TRUE, //LLWearableType::WT_EYES - TRUE, //LLWearableType::WT_SHIRT - TRUE, //LLWearableType::WT_PANTS - TRUE, //LLWearableType::WT_SHOES - TRUE, //LLWearableType::WT_SOCKS - FALSE, //LLWearableType::WT_JACKET - FALSE, //LLWearableType::WT_GLOVES - TRUE, //LLWearableType::WT_UNDERSHIRT - TRUE, //LLWearableType::WT_UNDERPANTS - FALSE //LLWearableType::WT_SKIRT + true, //LLWearableType::WT_SHAPE + true, //LLWearableType::WT_SKIN + true, //LLWearableType::WT_HAIR + true, //LLWearableType::WT_EYES + true, //LLWearableType::WT_SHIRT + true, //LLWearableType::WT_PANTS + true, //LLWearableType::WT_SHOES + true, //LLWearableType::WT_SOCKS + false, //LLWearableType::WT_JACKET + false, //LLWearableType::WT_GLOVES + true, //LLWearableType::WT_UNDERSHIRT + true, //LLWearableType::WT_UNDERPANTS + false //LLWearableType::WT_SKIRT }; LLPointer<LLInventoryCallback> cb = new OnWearableItemCreatedCB; @@ -865,7 +849,7 @@ void LLAgentWearables::makeNewOutfitDone(S32 type, U32 index) void LLAgentWearables::addWearableToAgentInventory(LLPointer<LLInventoryCallback> cb, LLViewerWearable* wearable, const LLUUID& category_id, - BOOL notify) + bool notify) { create_inventory_wearable(gAgent.getID(), gAgent.getSessionID(), @@ -980,16 +964,16 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it { LL_INFOS() << "setWearableOutfit() start" << LL_ENDL; - S32 count = wearables.size(); + auto count = wearables.size(); llassert(items.size() == count); // Check for whether outfit already matches the one requested S32 matched = 0, mismatched = 0; const S32 arr_size = LLWearableType::WT_COUNT; S32 type_counts[arr_size]; - BOOL update_inventory = FALSE; + bool update_inventory{ false }; std::fill(type_counts,type_counts+arr_size,0); - for (S32 i = 0; i < count; i++) + for (size_t i = 0; i < count; i++) { LLViewerWearable* new_wearable = wearables[i]; LLPointer<LLInventoryItem> new_item = items[i]; @@ -1025,7 +1009,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it << curr_wearable->getName() << " vs " << new_item->getName() << " item ids " << curr_wearable->getItemID() << " vs " << new_item->getUUID() << LL_ENDL; - update_inventory = TRUE; + update_inventory = true; continue; } // If we got here, everything matches. @@ -1092,7 +1076,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it pushWearable(type,new_wearable); } - const BOOL removed = FALSE; + constexpr bool removed = false; wearableUpdated(new_wearable, removed); } } @@ -1110,7 +1094,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it if (isAgentAvatarValid()) { - gAgentAvatarp->setCompositeUpdatesEnabled(TRUE); + gAgentAvatarp->setCompositeUpdatesEnabled(true); // If we have not yet declouded, we may want to use // baked texture UUIDs sent from the first objectUpdate message @@ -1124,7 +1108,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it } // Start rendering & update the server - mWearablesLoaded = TRUE; + mWearablesLoaded = true; notifyLoadingFinished(); @@ -1423,7 +1407,7 @@ void LLAgentWearables::userRemoveMultipleAttachments(llvo_vec_t& objects_to_remo void LLAgentWearables::userAttachMultipleAttachments(LLInventoryModel::item_array_t& obj_item_array) { // Build a compound message to send all the objects that need to be rezzed. - S32 obj_count = obj_item_array.size(); + auto obj_count = obj_item_array.size(); if (obj_count > 0) { LL_DEBUGS("Avatar") << "ATT attaching multiple, total obj_count " << obj_count << LL_ENDL; @@ -1434,7 +1418,7 @@ void LLAgentWearables::userAttachMultipleAttachments(LLInventoryModel::item_arra ++it) { const LLInventoryItem* item = *it; - LLAttachmentsMgr::instance().addAttachmentRequest(item->getLinkedUUID(), 0, TRUE); + LLAttachmentsMgr::instance().addAttachmentRequest(item->getLinkedUUID(), 0, true); } } @@ -1452,7 +1436,7 @@ bool LLAgentWearables::canMoveWearable(const LLUUID& item_id, bool closer_to_bod return wearable != marginal_wearable; } -BOOL LLAgentWearables::areWearablesLoaded() const +bool LLAgentWearables::areWearablesLoaded() const { return mWearablesLoaded; } @@ -1620,7 +1604,7 @@ void LLAgentWearables::editWearable(const LLUUID& item_id) return; } - const BOOL disable_camera_switch = LLWearableType::getInstance()->getDisableCameraSwitch(wearable->getType()); + const bool disable_camera_switch = LLWearableType::getInstance()->getDisableCameraSwitch(wearable->getType()); LLPanel* panel = LLFloaterSidePanelContainer::getPanel("appearance"); LLSidepanelAppearance::editWearable(wearable, panel, disable_camera_switch); } diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h index de3d91b87c..3b8ff93c76 100644 --- a/indra/newview/llagentwearables.h +++ b/indra/newview/llagentwearables.h @@ -66,16 +66,14 @@ public: // Queries //-------------------------------------------------------------------- public: - BOOL isWearingItem(const LLUUID& item_id) const; - BOOL isWearableModifiable(LLWearableType::EType type, U32 index /*= 0*/) const; - BOOL isWearableModifiable(const LLUUID& item_id) const; + bool isWearingItem(const LLUUID& item_id) const; + bool isWearableModifiable(LLWearableType::EType type, U32 index /*= 0*/) const; + bool isWearableModifiable(const LLUUID& item_id) const; - BOOL isWearableCopyable(LLWearableType::EType type, U32 index /*= 0*/) const; - BOOL areWearablesLoaded() const; + bool isWearableCopyable(LLWearableType::EType type, U32 index /*= 0*/) const; + bool areWearablesLoaded() const; bool isCOFChangeInProgress() const { return mCOFChangeInProgress; } F32 getCOFChangeTime() const { return mCOFChangeTimer.getElapsedTimeF32(); } - void updateWearablesLoaded(); - void checkWearablesLoaded() const; bool canMoveWearable(const LLUUID& item_id, bool closer_to_body) const; // Note: False for shape, skin, eyes, and hair, unless you have MORE than 1. @@ -95,13 +93,13 @@ public: LLViewerWearable* getViewerWearable(const LLWearableType::EType type, U32 index /*= 0*/); const LLViewerWearable* getViewerWearable(const LLWearableType::EType type, U32 index /*= 0*/) const; LLInventoryItem* getWearableInventoryItem(LLWearableType::EType type, U32 index /*= 0*/); - static BOOL selfHasWearable(LLWearableType::EType type); + static bool selfHasWearable(LLWearableType::EType type); //-------------------------------------------------------------------- // Setters //-------------------------------------------------------------------- private: - /*virtual*/void wearableUpdated(LLWearable *wearable, BOOL removed); + /*virtual*/void wearableUpdated(LLWearable *wearable, bool removed); public: void setWearableItem(LLInventoryItem* new_item, LLViewerWearable* wearable, bool do_append = false); void setWearableOutfit(const LLInventoryItem::item_array_t& items, const std::vector< LLViewerWearable* >& wearables); @@ -116,20 +114,18 @@ protected: void addWearableToAgentInventory(LLPointer<LLInventoryCallback> cb, LLViewerWearable* wearable, const LLUUID& category_id = LLUUID::null, - BOOL notify = TRUE); + bool notify = true); void addWearabletoAgentInventoryDone(const LLWearableType::EType type, const U32 index, const LLUUID& item_id, LLViewerWearable* wearable); - void recoverMissingWearable(const LLWearableType::EType type, U32 index /*= 0*/); - void recoverMissingWearableDone(); //-------------------------------------------------------------------- // Editing/moving wearables //-------------------------------------------------------------------- public: - static void createWearable(LLWearableType::EType type, bool wear = false, const LLUUID& parent_id = LLUUID::null, std::function<void(const LLUUID&)> created_cb = NULL); + static void createWearable(LLWearableType::EType type, bool wear = false, const LLUUID& parent_id = LLUUID::null, std::function<void(const LLUUID&)> created_cb = nullptr); static void editWearable(const LLUUID& item_id); bool moveWearable(const LLViewerInventoryItem* item, bool closer_to_body); @@ -159,7 +155,7 @@ private: // Save Wearables //-------------------------------------------------------------------- public: - void saveWearableAs(const LLWearableType::EType type, const U32 index, const std::string& new_name, const std::string& description, BOOL save_in_lost_and_found); + void saveWearableAs(const LLWearableType::EType type, const U32 index, const std::string& new_name, const std::string& description, bool save_in_lost_and_found); void saveWearable(const LLWearableType::EType type, const U32 index, const std::string new_name = ""); void saveAllWearables(); @@ -212,13 +208,13 @@ private: // Member variables //-------------------------------------------------------------------- private: - static BOOL mInitialWearablesUpdateReceived; - BOOL mWearablesLoaded; + static bool mInitialWearablesUpdateReceived; + bool mWearablesLoaded; /** * True if agent's outfit is being changed now. */ - BOOL mCOFChangeInProgress; + bool mCOFChangeInProgress; LLTimer mCOFChangeTimer; //-------------------------------------------------------------------------------- diff --git a/indra/newview/llaisapi.cpp b/indra/newview/llaisapi.cpp index b2ce4d56dd..11c5ffecb6 100644 --- a/indra/newview/llaisapi.cpp +++ b/indra/newview/llaisapi.cpp @@ -786,7 +786,7 @@ void AISAPI::FetchOrphans(completion_t callback) void AISAPI::EnqueueAISCommand(const std::string &procName, LLCoprocedureManager::CoProcedure_t proc) { LLCoprocedureManager &inst = LLCoprocedureManager::instance(); - S32 pending_in_pool = inst.countPending("AIS"); + auto pending_in_pool = inst.countPending("AIS"); std::string procFullName = "AIS(" + procName + ")"; if (pending_in_pool < MAX_SIMULTANEOUS_COROUTINES) { @@ -815,7 +815,7 @@ void AISAPI::onIdle(void *userdata) if (!sPostponedQuery.empty()) { LLCoprocedureManager &inst = LLCoprocedureManager::instance(); - S32 pending_in_pool = inst.countPending("AIS"); + auto pending_in_pool = inst.countPending("AIS"); while (pending_in_pool < MAX_SIMULTANEOUS_COROUTINES && !sPostponedQuery.empty()) { ais_query_item_t &item = sPostponedQuery.front(); @@ -1198,7 +1198,7 @@ void AISUpdate::parseItem(const LLSD& item_map) // Default to current values where not provided. new_item->copyViewerItem(curr_item); } - BOOL rv = new_item->unpackMessage(item_map); + bool rv = new_item->unpackMessage(item_map); if (rv) { if (mFetch) @@ -1243,7 +1243,7 @@ void AISUpdate::parseLink(const LLSD& link_map, S32 depth) // Default to current values where not provided. new_link->copyViewerItem(curr_link); } - BOOL rv = new_link->unpackMessage(link_map); + bool rv = new_link->unpackMessage(link_map); if (rv) { const LLUUID& parent_id = new_link->getParentUUID(); @@ -1340,7 +1340,7 @@ void AISUpdate::parseCategory(const LLSD& category_map, S32 depth) new_cat = new LLViewerInventoryCategory(LLUUID::null); } } - BOOL rv = new_cat->unpackMessage(category_map); + bool rv = new_cat->unpackMessage(category_map); // *NOTE: unpackMessage does not unpack version or descendent count. if (rv) { @@ -1356,7 +1356,7 @@ void AISUpdate::parseCategory(const LLSD& category_map, S32 depth) uuid_int_map_t::const_iterator lookup_it = mCatDescendentsKnown.find(category_id); if (mCatDescendentsKnown.end() != lookup_it) { - S32 descendent_count = lookup_it->second; + S32 descendent_count = static_cast<S32>(lookup_it->second); LL_DEBUGS("Inventory") << "Setting descendents count to " << descendent_count << " for category " << category_id << LL_ENDL; new_cat->setDescendentCount(descendent_count); @@ -1407,7 +1407,7 @@ void AISUpdate::parseCategory(const LLSD& category_map, S32 depth) uuid_int_map_t::const_iterator lookup_it = mCatDescendentsKnown.find(category_id); if (mCatDescendentsKnown.end() != lookup_it) { - S32 descendent_count = lookup_it->second; + S32 descendent_count = static_cast<S32>(lookup_it->second); LL_DEBUGS("Inventory") << "Setting descendents count to " << descendent_count << " for new category " << category_id << LL_ENDL; new_cat->setDescendentCount(descendent_count); @@ -1583,7 +1583,7 @@ void AISUpdate::doUpdate() checkTimeout(); // Do version/descendant accounting. - for (std::map<LLUUID,S32>::const_iterator catit = mCatDescendentDeltas.begin(); + for (std::map<LLUUID,size_t>::const_iterator catit = mCatDescendentDeltas.begin(); catit != mCatDescendentDeltas.end(); ++catit) { LL_DEBUGS("Inventory") << "descendant accounting for " << catit->first << LL_ENDL; @@ -1607,7 +1607,7 @@ void AISUpdate::doUpdate() LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id); if (cat) { - S32 descendent_delta = catit->second; + S32 descendent_delta = static_cast<S32>(catit->second); S32 old_count = cat->getDescendentCount(); LL_DEBUGS("Inventory") << "Updating descendant count for " << cat->getName() << " " << cat_id @@ -1676,7 +1676,7 @@ void AISUpdate::doUpdate() LLPointer<LLViewerInventoryItem> new_item = lost_it->second; new_item->setParent(lost_uuid); - new_item->updateParentOnServer(FALSE); + new_item->updateParentOnServer(false); } } } @@ -1731,7 +1731,7 @@ void AISUpdate::doUpdate() ucv_it != mCatVersionsUpdated.end(); ++ucv_it) { const LLUUID id = ucv_it->first; - S32 version = ucv_it->second; + S32 version = static_cast<S32>(ucv_it->second); LLViewerInventoryCategory *cat = gInventory.getCategory(id); LL_DEBUGS("Inventory") << "cat version update " << cat->getName() << " to version " << cat->getVersion() << LL_ENDL; if (cat->getVersion() != version) diff --git a/indra/newview/llaisapi.h b/indra/newview/llaisapi.h index 0dabd9f678..dd490c8268 100644 --- a/indra/newview/llaisapi.h +++ b/indra/newview/llaisapi.h @@ -134,7 +134,7 @@ private: // Todo: make throttle work over all fetch requests isntead of per-request const F32 AIS_EXPIRY_SECONDS = 0.008f; - typedef std::map<LLUUID,S32> uuid_int_map_t; + typedef std::map<LLUUID,size_t> uuid_int_map_t; uuid_int_map_t mCatDescendentDeltas; uuid_int_map_t mCatDescendentsKnown; uuid_int_map_t mCatVersionsUpdated; diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 97e1c1e6ee..9dd23a5319 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -124,18 +124,18 @@ public: } /*virtual*/ - BOOL tick() + bool tick() { if(mEventTimer.hasExpired()) { LLAppearanceMgr::instance().setOutfitLocked(false); } - return FALSE; + return false; } void stop() { mEventTimer.stop(); } void start() { mEventTimer.start(); } void reset() { mEventTimer.reset(); } - BOOL getStarted() { return mEventTimer.getStarted(); } + bool getStarted() { return mEventTimer.getStarted(); } LLTimer& getEventTimer() { return mEventTimer;} }; @@ -332,7 +332,7 @@ public: // virtual // Will be deleted after returning true - only safe to do this if all callbacks have fired. - BOOL tick() + bool tick() { // mPendingRequests will be zero if all requests have been // responded to. mWaitTimes.empty() will be true if we have @@ -719,7 +719,7 @@ public: bool isMostRecent(); void handleLateArrivals(); void resetTime(F32 timeout); - static S32 countActive() { return sActiveHoldingPatterns.size(); } + static S32 countActive() { return static_cast<S32>(sActiveHoldingPatterns.size()); } S32 index() { return mIndex; } private: @@ -1335,7 +1335,7 @@ void LLWearableHoldingPattern::onWearableAssetFetch(LLViewerWearable *wearable) wearable_item->setAssetUUID(new_wearable->getAssetID()); wearable_item->setTransactionID(new_wearable->getTransactionID()); gInventory.updateItem(wearable_item, LLInventoryObserver::INTERNAL); - wearable_item->updateServer(FALSE); + wearable_item->updateServer(false); use_count++; } @@ -1374,7 +1374,7 @@ static void removeDuplicateItems(LLInventoryModel::item_array_t& items) // encountered, so we actually keep the *last* of each duplicate // item. This is needed to give the right priority when adding // duplicate items to an existing outfit. - for (S32 i=items.size()-1; i>=0; i--) + for (S32 i = static_cast<S32>(items.size()) - 1; i >= 0; i--) { LLViewerInventoryItem *item = items.at(i); LLUUID item_id = item->getLinkedUUID(); @@ -1735,7 +1735,7 @@ void LLAppearanceMgr::takeOffOutfit(const LLUUID& cat_id) LLInventoryModel::item_array_t items; LLFindWearablesEx collector(/*is_worn=*/ true, /*include_body_parts=*/ false); - gInventory.collectDescendentsIf(cat_id, cats, items, FALSE, collector); + gInventory.collectDescendentsIf(cat_id, cats, items, false, collector); LLInventoryModel::item_array_t::const_iterator it = items.begin(); const LLInventoryModel::item_array_t::const_iterator it_end = items.end(); @@ -1918,7 +1918,7 @@ void LLAppearanceMgr::shallowCopyCategoryContents(const LLUUID& src_id, const LL } } -BOOL LLAppearanceMgr::getCanMakeFolderIntoOutfit(const LLUUID& folder_id) +bool LLAppearanceMgr::getCanMakeFolderIntoOutfit(const LLUUID& folder_id) { // These are the wearable items that are required for considering this // folder as containing a complete outfit. @@ -1945,7 +1945,7 @@ BOOL LLAppearanceMgr::getCanMakeFolderIntoOutfit(const LLUUID& folder_id) } } - // If the folder contains the required wearables, return TRUE. + // If the folder contains the required wearables, return true. return ((required_wearables & folder_wearables) == required_wearables); } @@ -2133,11 +2133,11 @@ void LLAppearanceMgr::filterWearableItems( items.clear(); for (S32 i=0; i<LLWearableType::WT_COUNT; i++) { - S32 size = items_by_type[i].size(); + auto size = items_by_type[i].size(); if (size <= 0) continue; - S32 start_index = llmax(0,size-max_per_type); - for (S32 j = start_index; j<size; j++) + auto start_index = llmax(0,size-max_per_type); + for (size_t j = start_index; j<size; j++) { items.push_back(items_by_type[i][j]); } @@ -2908,7 +2908,7 @@ void LLAppearanceMgr::wearInventoryCategoryOnAvatar( LLInventoryCategory* catego LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_outfit")); } - LLAppearanceMgr::changeOutfit(TRUE, category->getUUID(), append); + LLAppearanceMgr::changeOutfit(true, category->getUUID(), append); } // FIXME do we really want to search entire inventory for matching name? @@ -3588,7 +3588,7 @@ struct WearablesOrderComparator LOG_CLASS(WearablesOrderComparator); WearablesOrderComparator(const LLWearableType::EType type) { - mControlSize = build_order_string(type, 0).size(); + mControlSize = static_cast<U32>(build_order_string(type, 0).size()); }; bool operator()(const LLInventoryItem* item1, const LLInventoryItem* item2) @@ -3623,7 +3623,7 @@ void LLAppearanceMgr::getWearableOrderingDescUpdates(LLInventoryModel::item_arra for (U32 type = LLWearableType::WT_SHIRT; type < LLWearableType::WT_COUNT; type++) { - U32 size = items_by_type[type].size(); + U32 size = static_cast<U32>(items_by_type[type].size()); if (!size) continue; //sinking down invalid items which need reordering @@ -4243,12 +4243,12 @@ bool LLAppearanceMgr::moveWearable(LLViewerInventoryItem* item, bool closer_to_b // FIXME switch to use AISv3 where supported. //items need to be updated on a dataserver - item->setComplete(TRUE); - item->updateServer(FALSE); + item->setComplete(true); + item->updateServer(false); gInventory.updateItem(item); - swap_item->setComplete(TRUE); - swap_item->updateServer(FALSE); + swap_item->setComplete(true); + swap_item->updateServer(false); gInventory.updateItem(swap_item); //to cause appearance of the agent to be updated @@ -4402,15 +4402,15 @@ void LLAppearanceMgr::unregisterAttachment(const LLUUID& item_id) mAttachmentsChangeSignal(); } -BOOL LLAppearanceMgr::getIsInCOF(const LLUUID& obj_id) const +bool LLAppearanceMgr::getIsInCOF(const LLUUID& obj_id) const { const LLUUID& cof = getCOF(); if (obj_id == cof) - return TRUE; + return true; const LLInventoryObject* obj = gInventory.getObject(obj_id); if (obj && obj->getParentUUID() == cof) - return TRUE; - return FALSE; + return true; + return false; } bool LLAppearanceMgr::getIsInCOF(const LLInventoryObject* obj) const @@ -4577,7 +4577,7 @@ public: LLInventoryModel::item_array_t* items; gInventory.getDirectDescendentsOf(mComplete.front(), cats, items); - S32 count = items->size(); + auto count = items->size(); if(!count) { LL_WARNS() << "Nothing fetched in category " << mComplete.front() @@ -4593,7 +4593,7 @@ public: S32 version = cat ? cat->getVersion() : -2; LL_INFOS() << "stage1, category " << mComplete.front() << " got " << count << " items, version " << version << " passing to stage2 " << LL_ENDL; uuid_vec_t ids; - for(S32 i = 0; i < count; ++i) + for(size_t i = 0; i < count; ++i) { ids.push_back(items->at(i)->getUUID()); } @@ -4762,7 +4762,7 @@ public: LLAppearanceMgr::getInstance()->wearInventoryCategory(category, true, false); // *TODOw: This may not be necessary if initial outfit is chosen already -- josh - gAgent.setOutfitChosen(TRUE); + gAgent.setOutfitChosen(true); } } diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index e5de92b653..6c45a32856 100644 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -87,7 +87,7 @@ public: LLPointer<LLInventoryCallback> cb); // Return whether this folder contains minimal contents suitable for making a full outfit. - BOOL getCanMakeFolderIntoOutfit(const LLUUID& folder_id); + bool getCanMakeFolderIntoOutfit(const LLUUID& folder_id); // Determine whether a given outfit can be removed. bool getCanRemoveOutfit(const LLUUID& outfit_cat_id); @@ -292,7 +292,7 @@ private: // Item-specific convenience functions public: // Is this in the COF? - BOOL getIsInCOF(const LLUUID& obj_id) const; + bool getIsInCOF(const LLUUID& obj_id) const; bool getIsInCOF(const LLInventoryObject* obj) const; // Is this in the COF and can the user delete it from the COF? bool getIsProtectedCOFItem(const LLUUID& obj_id) const; diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index f46580c6c0..c93a3f6d0d 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -197,7 +197,6 @@ #include "llworld.h" #include "llhudeffecttrail.h" -#include "llvectorperfoptions.h" #include "llslurl.h" #include "llurlregistry.h" #include "llwatchdog.h" @@ -288,12 +287,12 @@ static LLAppViewerListener sAppViewerListener(LLAppViewer::instance); extern void init_apple_menu(const char* product); #endif // LL_DARWIN -extern BOOL gRandomizeFramerate; -extern BOOL gPeriodicSlowFrame; -extern BOOL gDebugGL; +extern bool gRandomizeFramerate; +extern bool gPeriodicSlowFrame; +extern bool gDebugGL; #if LL_DARWIN -extern BOOL gHiDPISupport; +extern bool gHiDPISupport; #endif //////////////////////////////////////////////////////////// @@ -302,8 +301,8 @@ extern BOOL gHiDPISupport; F32 gSimLastTime; // Used in LLAppViewer::init and send_viewer_stats() F32 gSimFrames; -BOOL gShowObjectUpdates = FALSE; -BOOL gUseQuickTime = TRUE; +bool gShowObjectUpdates = false; +bool gUseQuickTime = true; eLastExecEvent gLastExecEvent = LAST_EXEC_NORMAL; S32 gLastExecDuration = -1; // (<0 indicates unknown) @@ -345,12 +344,12 @@ F32 gLogoutMaxTime = LOGOUT_REQUEST_TIME; S32 gPendingMetricsUploads = 0; -BOOL gDisconnected = FALSE; +bool gDisconnected = false; // used to restore texture state after a mode switch LLFrameTimer gRestoreGLTimer; -BOOL gRestoreGL = FALSE; -bool gUseWireframe = FALSE; +bool gRestoreGL = false; +bool gUseWireframe = false; LLMemoryInfo gSysMemory; U64Bytes gMemoryAllocated(0); // updated in display_stats() in llviewerdisplay.cpp @@ -362,15 +361,16 @@ LLVector3 gRelativeWindVec(0.0, 0.0, 0.0); U32 gPacketsIn = 0; -BOOL gPrintMessagesThisFrame = FALSE; +bool gPrintMessagesThisFrame = false; -BOOL gRandomizeFramerate = FALSE; -BOOL gPeriodicSlowFrame = FALSE; +bool gRandomizeFramerate = false; +bool gPeriodicSlowFrame = false; -BOOL gCrashOnStartup = FALSE; -BOOL gLogoutInProgress = FALSE; +bool gCrashOnStartup = false; +bool gLLErrorActivated = false; +bool gLogoutInProgress = false; -BOOL gSimulateMemLeak = FALSE; +bool gSimulateMemLeak = false; // We don't want anyone, especially threads working on the graphics pipeline, // to have to block due to this WorkQueue being full. @@ -385,7 +385,7 @@ const std::string START_MARKER_FILE_NAME("SecondLife.start_marker"); const std::string ERROR_MARKER_FILE_NAME("SecondLife.error_marker"); const std::string LLERROR_MARKER_FILE_NAME("SecondLife.llerror_marker"); const std::string LOGOUT_MARKER_FILE_NAME("SecondLife.logout_marker"); -static BOOL gDoDisconnect = FALSE; +static bool gDoDisconnect = false; static std::string gLaunchFileOnQuit; // Used on Win32 for other apps to identify our window (eg, win_setup) @@ -499,7 +499,7 @@ bool create_text_segment_icon_from_url_match(LLUrlMatch* match,LLTextBase* ba LLIconCtrl* icon; if( match->getMenuName() == "menu_url_group.xml" // See LLUrlEntryGroup constructor - || gAgent.isInGroup(match_id, TRUE)) //This check seems unfiting, urls are either /agent or /group + || gAgent.isInGroup(match_id, true)) //This check seems unfiting, urls are either /agent or /group { LLGroupIconCtrl::Params icon_params; icon_params.group_id = match_id; @@ -580,7 +580,7 @@ static void settings_to_globals() static void settings_modify() { LLPipeline::sRenderTransparentWater = gSavedSettings.getBOOL("RenderTransparentWater"); - LLPipeline::sRenderDeferred = TRUE; // FALSE is deprecated + LLPipeline::sRenderDeferred = true; // false is deprecated LLRenderTarget::sUseFBO = LLPipeline::sRenderDeferred; LLVOSurfacePatch::sLODFactor = gSavedSettings.getF32("RenderTerrainLODFactor"); LLVOSurfacePatch::sLODFactor *= LLVOSurfacePatch::sLODFactor; //square lod factor to get exponential range of [1,4] @@ -663,8 +663,8 @@ LLAppViewer::LLAppViewer() mLastAgentForceUpdate(0), mMainloopTimeout(NULL), mAgentRegionLastAlive(false), - mRandomizeFramerate(LLCachedControl<bool>(gSavedSettings,"Randomize Framerate", FALSE)), - mPeriodicSlowFrame(LLCachedControl<bool>(gSavedSettings,"Periodic Slow Frame", FALSE)), + mRandomizeFramerate(LLCachedControl<bool>(gSavedSettings,"Randomize Framerate", false)), + mPeriodicSlowFrame(LLCachedControl<bool>(gSavedSettings,"Periodic Slow Frame", false)), mFastTimerLogThread(NULL), mSettingsLocationList(NULL), mIsFirstRun(false) @@ -948,7 +948,7 @@ bool LLAppViewer::init() // // Initialize the window // - gGLActive = TRUE; + gGLActive = true; initWindow(); LL_INFOS("InitInfo") << "Window is initialized." << LL_ENDL ; @@ -1136,7 +1136,7 @@ bool LLAppViewer::init() LLNotificationsUtil::add("CorruptedProtectedDataStore"); } - gGLActive = FALSE; + gGLActive = false; #if 0 // LL_RELEASE_FOR_DOWNLOAD && !LL_LINUX // Skip updater if this is a non-interactive instance @@ -1344,7 +1344,7 @@ bool LLAppViewer::frame() } catch (std::bad_alloc&) { - LLMemory::logMemoryInfo(TRUE); + LLMemory::logMemoryInfo(true); LLFloaterMemLeak* mem_leak_instance = LLFloaterReg::findTypedInstance<LLFloaterMemLeak>("mem_leaking"); if (mem_leak_instance) { @@ -1526,7 +1526,7 @@ bool LLAppViewer::doFrame() { LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df Display"); pingMainloopTimeout("Main:Display"); - gGLActive = TRUE; + gGLActive = true; display(); @@ -1537,7 +1537,7 @@ bool LLAppViewer::doFrame() gPipeline.mReflectionMapManager.update(); LLFloaterSnapshot::update(); // take snapshots LLFloaterSimpleSnapshot::update(); - gGLActive = FALSE; + gGLActive = false; } if (LLViewerStatsRecorder::instanceExists()) @@ -1701,7 +1701,7 @@ bool LLAppViewer::doFrame() S32 LLAppViewer::updateTextureThreads(F32 max_time) { - S32 work_pending = 0; + size_t work_pending = 0; { LL_PROFILE_ZONE_NAMED_CATEGORY_APP("Texture Cache"); work_pending += LLAppViewer::getTextureCache()->update(max_time); // unpauses the texture cache thread @@ -1714,7 +1714,7 @@ S32 LLAppViewer::updateTextureThreads(F32 max_time) LL_PROFILE_ZONE_NAMED_CATEGORY_APP("Image Fetch"); work_pending += LLAppViewer::getTextureFetch()->update(max_time); // unpauses the texture fetch thread } - return work_pending; + return static_cast<S32>(work_pending); } void LLAppViewer::flushLFSIO() @@ -1780,7 +1780,7 @@ bool LLAppViewer::cleanup() //flag all elements as needing to be destroyed immediately // to ensure shutdown order - LLMortician::setZealous(TRUE); + LLMortician::setZealous(true); // Give any remaining SLPlugin instances a chance to exit cleanly. LLPluginProcessParent::shutdown(); @@ -1989,7 +1989,7 @@ bool LLAppViewer::cleanup() // Must do this after all panels have been deleted because panels that have persistent rects // save their rects on delete. - gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE); + gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), true); LLUIColorTable::instance().saveUserSettings(); @@ -2008,7 +2008,7 @@ bool LLAppViewer::cleanup() } else { - gSavedPerAccountSettings.saveToFile(gSavedSettings.getString("PerAccountSettingsFile"), TRUE); + gSavedPerAccountSettings.saveToFile(gSavedSettings.getString("PerAccountSettingsFile"), true); LL_INFOS() << "Saved settings" << LL_ENDL; if (LLViewerParcelAskPlay::instanceExists()) @@ -2018,7 +2018,7 @@ bool LLAppViewer::cleanup() } std::string warnings_settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, getSettingsFilename("Default", "Warnings")); - gWarningSettings.saveToFile(warnings_settings_filename, TRUE); + gWarningSettings.saveToFile(warnings_settings_filename, true); // Save URL history file LLURLHistory::saveFile("url_history.xml"); @@ -2061,9 +2061,9 @@ bool LLAppViewer::cleanup() while(1) { S32 pending = 0; - pending += LLAppViewer::getTextureCache()->update(1); // unpauses the worker thread - pending += LLAppViewer::getImageDecodeThread()->update(1); // unpauses the image thread - pending += LLAppViewer::getTextureFetch()->update(1); // unpauses the texture fetch thread + pending += static_cast<S32>(LLAppViewer::getTextureCache()->update(1)); // unpauses the worker thread + pending += static_cast<S32>(LLAppViewer::getImageDecodeThread()->update(1)); // unpauses the image thread + pending += static_cast<S32>(LLAppViewer::getTextureFetch()->update(1)); // unpauses the texture fetch thread pending += LLLFSThread::updateClass(0); F64 idle_time = idleTimer.getElapsedTimeF64(); if(!pending) @@ -2387,6 +2387,7 @@ void LLAppViewer::initLoggingAndGetLastDuration() // Set the log file to SecondLife.log LLError::logToFile(log_file); + LL_INFOS() << "Started logging to " << log_file << LL_ENDL; if (!duration_log_msg.empty()) { LL_WARNS("MarkerFile") << duration_log_msg << LL_ENDL; @@ -2440,7 +2441,7 @@ bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key, && gSavedSettings.controlExists(file.file_name_setting)) { // try to find filename stored in file_name_setting control - full_settings_path = gSavedSettings.getString(file.file_name_setting); + full_settings_path = gSavedSettings.getString(file.file_name_setting()); if (full_settings_path.empty()) { continue; @@ -2560,7 +2561,7 @@ bool LLAppViewer::initConfiguration() //Load settings files list std::string settings_file_list = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "settings_files.xml"); LLXMLNodePtr root; - BOOL success = LLXMLNode::parseFile(settings_file_list, root, NULL); + bool success = LLXMLNode::parseFile(settings_file_list, root, NULL); if (!success) { LL_WARNS() << "Cannot load default configuration file " << settings_file_list << LL_ENDL; @@ -2627,7 +2628,7 @@ bool LLAppViewer::initConfiguration() c->setValue(true, false); } - gSavedSettings.setBOOL("QAMode", TRUE ); + gSavedSettings.setBOOL("QAMode", true ); gSavedSettings.setS32("WatchdogEnabled", 0); #endif @@ -2689,7 +2690,7 @@ bool LLAppViewer::initConfiguration() // like determining screen DPI value and so on mIsFirstRun = true; - gSavedSettings.setBOOL("FirstRunThisInstall", FALSE); + gSavedSettings.setBOOL("FirstRunThisInstall", false); } if (clp.hasOption("sessionsettings")) @@ -2793,7 +2794,7 @@ bool LLAppViewer::initConfiguration() std::string test_name(gSavedSettings.getString("LogMetrics")); if (! test_name.empty()) { - LLTrace::BlockTimer::sMetricLog = TRUE; + LLTrace::BlockTimer::sMetricLog = true; // '--logmetrics' is specified with a named test metric argument so the data gathering is done only on that test // In the absence of argument, every metric would be gathered (makes for a rather slow run and hard to decipher report...) LL_INFOS() << "'--logmetrics' argument : " << test_name << LL_ENDL; @@ -2817,19 +2818,19 @@ bool LLAppViewer::initConfiguration() if (gSavedSettings.getBOOL("DebugSession")) { - gDebugSession = TRUE; - gDebugGL = TRUE; + gDebugSession = true; + gDebugGL = true; ll_init_fail_log(gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "test_failures.log")); } if (gSavedSettings.getBOOL("RenderDebugGLSession")) { - gDebugGLSession = TRUE; - gDebugGL = TRUE; + gDebugGLSession = true; + gDebugGL = true; // gDebugGL can cause excessive logging // so it's limited to a single session - gSavedSettings.setBOOL("RenderDebugGLSession", FALSE); + gSavedSettings.setBOOL("RenderDebugGLSession", false); } const LLControlVariable* skinfolder = gSavedSettings.getControl("SkinCurrent"); @@ -2857,10 +2858,10 @@ bool LLAppViewer::initConfiguration() if (gNonInteractive) { - tempSetControl("AllowMultipleViewers", "TRUE"); - tempSetControl("SLURLPassToOtherInstance", "FALSE"); - tempSetControl("RenderWater", "FALSE"); - tempSetControl("FlyingAtExit", "FALSE"); + tempSetControl("AllowMultipleViewers", "true"); + tempSetControl("SLURLPassToOtherInstance", "false"); + tempSetControl("RenderWater", "false"); + tempSetControl("FlyingAtExit", "false"); tempSetControl("WindowWidth", "1024"); tempSetControl("WindowHeight", "200"); LLError::setEnabledLogTypesMask(0); @@ -3006,8 +3007,8 @@ bool LLAppViewer::initConfiguration() LLControlVariable* enable_voice = gSavedSettings.getControl("EnableVoiceChat"); if(enable_voice) { - const BOOL DO_NOT_PERSIST = FALSE; - enable_voice->setValue(LLSD(FALSE), DO_NOT_PERSIST); + const bool DO_NOT_PERSIST = false; + enable_voice->setValue(LLSD(false), DO_NOT_PERSIST); } } @@ -3123,7 +3124,7 @@ bool LLAppViewer::initWindow() gHeadlessClient = gSavedSettings.getBOOL("HeadlessClient"); // always start windowed - BOOL ignorePixelDepth = gSavedSettings.getBOOL("IgnorePixelDepth"); + bool ignorePixelDepth = gSavedSettings.getBOOL("IgnorePixelDepth"); LLViewerWindow::Params window_params; window_params @@ -3196,8 +3197,8 @@ bool LLAppViewer::initWindow() } // Set this flag in case we crash while initializing GL - gSavedSettings.setBOOL("RenderInitError", TRUE); - gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE ); + gSavedSettings.setBOOL("RenderInitError", true); + gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), true ); gPipeline.init(); LL_INFOS("AppInit") << "gPipeline Initialized" << LL_ENDL; @@ -3205,8 +3206,8 @@ bool LLAppViewer::initWindow() stop_glerror(); gViewerWindow->initGLDefaults(); - gSavedSettings.setBOOL("RenderInitError", FALSE); - gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE ); + gSavedSettings.setBOOL("RenderInitError", false); + gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), true ); //If we have a startup crash, it's usually near GL initialization, so simulate that. if(gCrashOnStartup) @@ -3221,7 +3222,7 @@ bool LLAppViewer::initWindow() if (gSavedSettings.getBOOL("FirstLoginThisInstall") && meetsRequirementsForMaximizedStart()) { LL_INFOS("AppInit") << "This client met the requirements for a maximized initial screen." << LL_ENDL; - gSavedSettings.setBOOL("WindowMaximized", TRUE); + gSavedSettings.setBOOL("WindowMaximized", true); } if (gSavedSettings.getBOOL("WindowMaximized")) @@ -3388,7 +3389,7 @@ LLSD LLAppViewer::getViewerInfo() const info["NET_BANDWITH"] = gSavedSettings.getF32("ThrottleBandwidthKBPS"); info["LOD_FACTOR"] = gSavedSettings.getF32("RenderVolumeLODFactor"); info["RENDER_QUALITY"] = (F32)gSavedSettings.getU32("RenderQualityPerformance"); - info["TEXTURE_MEMORY"] = gGLManager.mVRAM; + info["TEXTURE_MEMORY"] = LLSD::Integer(gGLManager.mVRAM); #if LL_DARWIN info["HIDPI"] = gHiDPISupport; @@ -3529,7 +3530,7 @@ std::string LLAppViewer::getViewerInfoString(bool default_string) const else { // array value: build KEY_0, KEY_1 etc. entries - for (LLSD::Integer n(0), size(ii->second.size()); n < size; ++n) + for (LLSD::Integer n(0), size(static_cast<LLSD::Integer>(ii->second.size())); n < size; ++n) { args[STRINGIZE(ii->first << '_' << n)] = ii->second[n].asString(); } @@ -3577,9 +3578,9 @@ std::string LLAppViewer::getViewerInfoString(bool default_string) const void LLAppViewer::cleanupSavedSettings() { - gSavedSettings.setBOOL("MouseSun", FALSE); + gSavedSettings.setBOOL("MouseSun", false); - gSavedSettings.setBOOL("UseEnergy", TRUE); // force toggle to turn off, since sends message to simulator + gSavedSettings.setBOOL("UseEnergy", true); // force toggle to turn off, since sends message to simulator gSavedSettings.setBOOL("DebugWindowProc", gDebugWindowProc); @@ -3594,7 +3595,7 @@ void LLAppViewer::cleanupSavedSettings() // as we don't track it in callbacks if(NULL != gViewerWindow) { - BOOL maximized = gViewerWindow->getWindow()->getMaximized(); + bool maximized = gViewerWindow->getWindow()->getMaximized(); if (!maximized) { LLCoordScreen window_pos; @@ -3772,7 +3773,7 @@ void LLAppViewer::recordMarkerVersion(LLAPRFile& marker_file) } // record the viewer version in the marker file - marker_file.write(marker_version.data(), marker_version.length()); + marker_file.write(marker_version.data(), static_cast<S32>(marker_version.length())); } bool LLAppViewer::markerIsSameVersion(const std::string& marker_name) const @@ -3871,7 +3872,7 @@ void LLAppViewer::processMarkerFiles() initLoggingAndGetLastDuration(); // Create the marker file for this execution & lock it; it will be deleted on a clean exit apr_status_t s; - s = mMarkerFile.open(mMarkerFileName, LL_APR_WB, TRUE); + s = mMarkerFile.open(mMarkerFileName, LL_APR_WB, true); if (s == APR_SUCCESS && mMarkerFile.getFileHandle()) { @@ -4059,7 +4060,7 @@ void LLAppViewer::requestQuit() gAgentAvatarp->updateAvatarRezMetrics(true); // force a last packet to be sent. } - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral*)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral*)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, true); effectp->setPositionGlobal(gAgent.getPositionGlobal()); effectp->setColor(LLColor4U(gAgent.getEffectColor())); LLHUDManager::getInstance()->sendEffects(); @@ -4118,7 +4119,7 @@ static bool finish_early_exit(const LLSD& notification, const LLSD& response) void LLAppViewer::earlyExit(const std::string& name, const LLSD& substitutions) { LL_WARNS() << "app_early_exit: " << name << LL_ENDL; - gDoDisconnect = TRUE; + gDoDisconnect = true; LLNotificationsUtil::add(name, substitutions, LLSD(), finish_early_exit); } @@ -4126,7 +4127,7 @@ void LLAppViewer::earlyExit(const std::string& name, const LLSD& substitutions) void LLAppViewer::earlyExitNoNotify() { LL_WARNS() << "app_early_exit with no notification: " << LL_ENDL; - gDoDisconnect = TRUE; + gDoDisconnect = true; finish_early_exit( LLSD(), LLSD() ); } @@ -4157,7 +4158,7 @@ void LLAppViewer::migrateCacheDirectory() // Only do this once per fresh install of this version. if (gSavedSettings.getBOOL("MigrateCacheDirectory")) { - gSavedSettings.setBOOL("MigrateCacheDirectory", FALSE); + gSavedSettings.setBOOL("MigrateCacheDirectory", false); std::string old_cache_dir = gDirUtilp->add(gDirUtilp->getOSUserAppDir(), "cache"); std::string new_cache_dir = gDirUtilp->getCacheDir(true); @@ -4240,7 +4241,7 @@ U32 LLAppViewer::getObjectCacheVersion() bool LLAppViewer::initCache() { mPurgeCache = false; - BOOL read_only = mSecondInstance ? TRUE : FALSE; + bool read_only = mSecondInstance; LLAppViewer::getTextureCache()->setReadOnly(read_only) ; LLVOCache::initParamSingleton(read_only); @@ -4265,7 +4266,7 @@ bool LLAppViewer::initCache() if (gSavedSettings.getS32("LocalCacheVersion") != LLAppViewer::getTextureCacheVersion()) { texture_cache_mismatch = true; - if(!read_only) + if (!read_only) { gSavedSettings.setS32("LocalCacheVersion", LLAppViewer::getTextureCacheVersion()); @@ -4274,7 +4275,7 @@ bool LLAppViewer::initCache() } } - if(!read_only) + if (!read_only) { // Purge cache if user requested it if (gSavedSettings.getBOOL("PurgeCacheOnStartup") || @@ -4449,7 +4450,7 @@ void LLAppViewer::forceDisconnect(const std::string& mesg) } LLSD args; - gDoDisconnect = TRUE; + gDoDisconnect = true; if (LLStartUp::getStartupState() < STATE_STARTED) { @@ -4472,7 +4473,7 @@ void LLAppViewer::badNetworkHandler() // Flush all of our caches on exit in the case of disconnect due to // invalid packets. - mPurgeCacheOnExit = TRUE; + mPurgeCacheOnExit = true; std::ostringstream message; message << @@ -4500,8 +4501,8 @@ void LLAppViewer::saveFinalSnapshot() gSavedSettings.setVector3d("FocusPosOnLogout", gAgentCamera.calcFocusPositionTargetGlobal()); gSavedSettings.setVector3d("CameraPosOnLogout", gAgentCamera.calcCameraPositionTargetGlobal()); gViewerWindow->setCursor(UI_CURSOR_WAIT); - gAgentCamera.changeCameraToThirdPerson( FALSE ); // don't animate, need immediate switch - gSavedSettings.setBOOL("ShowParcelOwners", FALSE); + gAgentCamera.changeCameraToThirdPerson( false ); // don't animate, need immediate switch + gSavedSettings.setBOOL("ShowParcelOwners", false); idle(); std::string snap_filename = gDirUtilp->getLindenUserDir(); @@ -4511,12 +4512,12 @@ void LLAppViewer::saveFinalSnapshot() gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw(), - FALSE, + false, gSavedSettings.getBOOL("RenderHUDInSnapshot"), - TRUE, + true, LLSnapshotModel::SNAPSHOT_TYPE_COLOR, LLSnapshotModel::SNAPSHOT_FORMAT_PNG); - mSavedFinalSnapshot = TRUE; + mSavedFinalSnapshot = true; if (gAgent.isInHomeRegion()) { @@ -4704,13 +4705,13 @@ void LLAppViewer::idle() if (LLStartUp::getStartupState() < STATE_STARTED) { // Skip rest if idle startup returns false (essentially, no world yet) - gGLActive = TRUE; + gGLActive = true; if (!idle_startup()) { - gGLActive = FALSE; + gGLActive = false; return; } - gGLActive = FALSE; + gGLActive = false; } @@ -4746,7 +4747,7 @@ void LLAppViewer::idle() F32 agent_update_time = agent_update_timer.getElapsedTimeF32(); F32 agent_force_update_time = mLastAgentForceUpdate + agent_update_time; bool timed_out = agent_update_time > (1.0f / (F32)AGENT_UPDATES_PER_SECOND); - BOOL force_send = + bool force_send = // if there is something to send (gAgent.controlFlagsDirty() && timed_out) // if something changed @@ -5059,7 +5060,7 @@ void LLAppViewer::idle() // forcibly quit if it has taken too long if (mQuitRequested) { - gGLActive = TRUE; + gGLActive = true; idleShutdown(); } } @@ -5117,7 +5118,7 @@ void LLAppViewer::idleShutdown() static S32 total_uploads = 0; // Sometimes total upload count can change during logout. total_uploads = llmax(total_uploads, pending_uploads); - gViewerWindow->setShowProgress(TRUE); + gViewerWindow->setShowProgress(true); S32 finished_uploads = total_uploads - pending_uploads; F32 percent = 100.f * finished_uploads / total_uploads; gViewerWindow->setProgressPercent(percent); @@ -5129,7 +5130,7 @@ void LLAppViewer::idleShutdown() && gLogoutTimer.getElapsedTimeF32() < SHUTDOWN_UPLOAD_SAVE_TIME && !logoutRequestSent()) { - gViewerWindow->setShowProgress(TRUE); + gViewerWindow->setShowProgress(true); gViewerWindow->setProgressPercent(100.f); gViewerWindow->setProgressString(LLTrans::getString("LoggingOut")); return; @@ -5141,7 +5142,7 @@ void LLAppViewer::idleShutdown() sendLogoutRequest(); // Wait for a LogoutReply message - gViewerWindow->setShowProgress(TRUE); + gViewerWindow->setShowProgress(true); gViewerWindow->setProgressPercent(100.f); gViewerWindow->setProgressString(LLTrans::getString("LoggingOut")); return; @@ -5161,7 +5162,7 @@ void LLAppViewer::sendLogoutRequest() if(!mLogoutRequestSent && gMessageSystem) { //Set internal status variables and marker files before actually starting the logout process - gLogoutInProgress = TRUE; + gLogoutInProgress = true; if (!mSecondInstance) { mLogoutMarkerFileName = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,LOGOUT_MARKER_FILE_NAME); @@ -5191,7 +5192,7 @@ void LLAppViewer::sendLogoutRequest() gLogoutTimer.reset(); gLogoutMaxTime = LOGOUT_REQUEST_TIME; - mLogoutRequestSent = TRUE; + mLogoutRequestSent = true; if(LLVoiceClient::instanceExists()) { @@ -5216,7 +5217,7 @@ void LLAppViewer::updateNameLookupUrl(const LLViewerRegion * regionp) if (have_capability) { // we have support for display names, use it - U32 url_size = name_lookup_url.size(); + auto url_size = name_lookup_url.size(); // capabilities require URLs with slashes before query params: // https://<host>:<port>/cap/<uuid>/?ids=<blah> // but the caps are granted like: @@ -5241,6 +5242,11 @@ void LLAppViewer::updateNameLookupUrl(const LLViewerRegion * regionp) } } +void LLAppViewer::postToMainCoro(const LL::WorkQueue::Work& work) +{ + gMainloopWork.post(work); +} + void LLAppViewer::idleNameCache() { // Neither old nor new name cache can function before agent has a region @@ -5363,7 +5369,7 @@ void LLAppViewer::idleNetwork() if (gPrintMessagesThisFrame) { LL_INFOS() << "Decoded " << total_decoded << " msgs this frame!" << LL_ENDL; - gPrintMessagesThisFrame = FALSE; + gPrintMessagesThisFrame = false; } } add(LLStatViewer::NUM_NEW_OBJECTS, gObjectList.mNumNewObjects); @@ -5462,7 +5468,7 @@ void LLAppViewer::disconnectViewer() LLDestroyClassList::instance().fireCallbacks(); cleanup_xfer_manager(); - gDisconnected = TRUE; + gDisconnected = true; // Pass the connection state to LLUrlEntryParcel not to attempt // parcel info requests while disconnected. diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 4f18e722f2..08fbbaa390 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -227,6 +227,9 @@ public: void updateNameLookupUrl(const LLViewerRegion* regionp); + // post given work to the "mainloop" work queue for handling on the main thread + void postToMainCoro(const LL::WorkQueue::Work& work); + protected: virtual bool initWindow(); // Initialize the viewer's window. virtual void initLoggingAndGetLastDuration(); // Initialize log files, logging system @@ -344,7 +347,7 @@ const S32 AGENT_FORCE_UPDATES_PER_SECOND = 1; // "// llstartup" indicates that llstartup is the only client for this global. extern LLSD gDebugInfo; -extern BOOL gShowObjectUpdates; +extern bool gShowObjectUpdates; typedef enum { @@ -385,10 +388,10 @@ extern S32 gPendingMetricsUploads; extern F32 gSimLastTime; extern F32 gSimFrames; -extern BOOL gDisconnected; +extern bool gDisconnected; extern LLFrameTimer gRestoreGLTimer; -extern BOOL gRestoreGL; +extern bool gRestoreGL; extern bool gUseWireframe; extern LLMemoryInfo gSysMemory; @@ -399,13 +402,13 @@ extern std::string gLastVersionChannel; extern LLVector3 gWindVec; extern LLVector3 gRelativeWindVec; extern U32 gPacketsIn; -extern BOOL gPrintMessagesThisFrame; +extern bool gPrintMessagesThisFrame; extern LLUUID gBlackSquareID; -extern BOOL gRandomizeFramerate; -extern BOOL gPeriodicSlowFrame; +extern bool gRandomizeFramerate; +extern bool gPeriodicSlowFrame; -extern BOOL gSimulateMemLeak; +extern bool gSimulateMemLeak; #endif // LL_LLAPPVIEWER_H diff --git a/indra/newview/llappviewermacosx-objc.mm b/indra/newview/llappviewermacosx-objc.mm index 5d9ca24db2..9b6bfe621b 100644 --- a/indra/newview/llappviewermacosx-objc.mm +++ b/indra/newview/llappviewermacosx-objc.mm @@ -25,7 +25,7 @@ */ #if !defined LL_DARWIN - #error "Use only with Mac OS X" + #error "Use only with macOS" #endif #import <Cocoa/Cocoa.h> diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp index fcdcd3ab9b..4162c0479a 100644 --- a/indra/newview/llappviewermacosx.cpp +++ b/indra/newview/llappviewermacosx.cpp @@ -27,7 +27,7 @@ #include "llviewerprecompiledheaders.h" #if !defined LL_DARWIN - #error "Use only with Mac OS X" + #error "Use only with macOS" #endif #define LL_CARBON_CRASH_HANDLER 1 diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index a13e4de308..51a8942192 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -75,8 +75,9 @@ // Bugsplat (http://bugsplat.com) crash reporting tool #ifdef LL_BUGSPLAT #include "BugSplat.h" -#include "json/reader.h" // JsonCpp +#include "boost/json.hpp" // Boost.Json #include "llagent.h" // for agent location +#include "llstartup.h" #include "llviewerregion.h" #include "llvoavatarself.h" // for agent name @@ -138,8 +139,7 @@ namespace // We don't have an email address for any user. Hijack this // metadata field for the platform identifier. sBugSplatSender->setDefaultUserEmail( - WCSTR(STRINGIZE(LLOSInfo::instance().getOSStringSimple() << " (" - << ADDRESS_SIZE << "-bit)"))); + WCSTR(LLOSInfo::instance().getOSStringSimple())); if (gAgentAvatarp) { @@ -152,6 +152,8 @@ namespace // LL_ERRS message, when there is one sBugSplatSender->setDefaultUserDescription(WCSTR(LLError::getFatalMessage())); + // App state + sBugSplatSender->setAttribute(WCSTR(L"AppState"), WCSTR(LLStartUp::getStartupStateString())); if (gAgent.getRegion()) { @@ -522,7 +524,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance, } #endif - gGLActive = TRUE; + gGLActive = true; viewer_app_ptr->cleanup(); @@ -694,24 +696,25 @@ bool LLAppViewerWin32::init() } else { - Json::Reader reader; - Json::Value build_data; - if (!reader.parse(inf, build_data, false)) // don't collect comments + boost::json::error_code ec; + boost::json::value build_data = boost::json::parse(inf, ec); + if(ec.failed()) { // gah, the typo is baked into Json::Reader API LL_WARNS("BUGSPLAT") << "Can't initialize BugSplat, can't parse '" << build_data_fname - << "': " << reader.getFormatedErrorMessages() << LL_ENDL; + << "': " << ec.what() << LL_ENDL; } else { - Json::Value BugSplat_DB = build_data["BugSplat DB"]; - if (!BugSplat_DB) + if (!build_data.is_object() || !build_data.as_object().contains("BugSplat DB")) { LL_WARNS("BUGSPLAT") << "Can't initialize BugSplat, no 'BugSplat DB' entry in '" << build_data_fname << "'" << LL_ENDL; } else { + boost::json::value BugSplat_DB = build_data.at("BugSplat DB"); + // Got BugSplat_DB, onward! std::wstring version_string(WSTRINGIZE(LL_VIEWER_VERSION_MAJOR << '.' << LL_VIEWER_VERSION_MINOR << '.' << @@ -733,7 +736,7 @@ bool LLAppViewerWin32::init() // have to convert normal wide strings to strings of __wchar_t sBugSplatSender = new MiniDmpSender( - WCSTR(BugSplat_DB.asString()), + WCSTR(boost::json::value_to<std::string>(BugSplat_DB)), WCSTR(LL_TO_WSTRING(LL_VIEWER_CHANNEL)), WCSTR(version_string), nullptr, // szAppIdentifier -- set later @@ -819,17 +822,17 @@ bool LLAppViewerWin32::initHardwareTest() // Do driver verification and initialization based on DirectX // hardware polling and driver versions // - if (TRUE == gSavedSettings.getBOOL("ProbeHardwareOnStartup") && FALSE == gSavedSettings.getBOOL("NoHardwareProbe")) + if (true == gSavedSettings.getBOOL("ProbeHardwareOnStartup") && false == gSavedSettings.getBOOL("NoHardwareProbe")) { // per DEV-11631 - disable hardware probing for everything // but vram. - BOOL vram_only = TRUE; + bool vram_only = true; LLSplashScreen::update(LLTrans::getString("StartupDetectingHardware")); LL_DEBUGS("AppInit") << "Attempting to poll DirectX for hardware info" << LL_ENDL; gDXHardware.setWriteDebugFunc(write_debug_dx); - BOOL probe_ok = gDXHardware.getInfo(vram_only); + bool probe_ok = gDXHardware.getInfo(vram_only); if (!probe_ok && gWarningSettings.getBOOL("AboutDirectX9")) @@ -850,12 +853,12 @@ bool LLAppViewerWin32::initHardwareTest() LLWeb::loadURLExternal("http://secondlife.com/support/", false); return false; } - gWarningSettings.setBOOL("AboutDirectX9", FALSE); + gWarningSettings.setBOOL("AboutDirectX9", false); } LL_DEBUGS("AppInit") << "Done polling DirectX for hardware info" << LL_ENDL; // Only probe once after installation - gSavedSettings.setBOOL("ProbeHardwareOnStartup", FALSE); + gSavedSettings.setBOOL("ProbeHardwareOnStartup", false); // Disable so debugger can work std::string splash_msg; @@ -935,7 +938,7 @@ bool LLAppViewerWin32::sendURLToOtherInstance(const std::string& url) COPYDATASTRUCT cds; const S32 SLURL_MESSAGE_TYPE = 0; cds.dwData = SLURL_MESSAGE_TYPE; - cds.cbData = url.length() + 1; + cds.cbData = static_cast<DWORD>(url.length()) + 1; cds.lpData = (void*)url.c_str(); LRESULT msg_result = SendMessage(other_window, WM_COPYDATA, NULL, (LPARAM)&cds); diff --git a/indra/newview/llattachmentsmgr.cpp b/indra/newview/llattachmentsmgr.cpp index 7baf5f6119..deabcd9f42 100644 --- a/indra/newview/llattachmentsmgr.cpp +++ b/indra/newview/llattachmentsmgr.cpp @@ -55,7 +55,7 @@ LLAttachmentsMgr::~LLAttachmentsMgr() void LLAttachmentsMgr::addAttachmentRequest(const LLUUID& item_id, const U8 attachment_pt, - const BOOL add) + const bool add) { LLViewerInventoryItem *item = gInventory.getItem(item_id); @@ -296,7 +296,7 @@ void LLAttachmentsMgr::LLItemRequestTimes::addTime(const LLUUID& inv_item_id) void LLAttachmentsMgr::LLItemRequestTimes::removeTime(const LLUUID& inv_item_id) { LLInventoryItem *item = gInventory.getItem(inv_item_id); - S32 remove_count = (*this).erase(inv_item_id); + auto remove_count = (*this).erase(inv_item_id); if (remove_count) { LL_DEBUGS("Avatar") << "ATT " << mOpName << " removing request time " @@ -304,18 +304,18 @@ void LLAttachmentsMgr::LLItemRequestTimes::removeTime(const LLUUID& inv_item_id) } } -BOOL LLAttachmentsMgr::LLItemRequestTimes::getTime(const LLUUID& inv_item_id, LLTimer& timer) const +bool LLAttachmentsMgr::LLItemRequestTimes::getTime(const LLUUID& inv_item_id, LLTimer& timer) const { std::map<LLUUID,LLTimer>::const_iterator it = (*this).find(inv_item_id); if (it != (*this).end()) { timer = it->second; - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLAttachmentsMgr::LLItemRequestTimes::wasRequestedRecently(const LLUUID& inv_item_id) const +bool LLAttachmentsMgr::LLItemRequestTimes::wasRequestedRecently(const LLUUID& inv_item_id) const { LLTimer request_time; if (getTime(inv_item_id, request_time)) @@ -325,7 +325,7 @@ BOOL LLAttachmentsMgr::LLItemRequestTimes::wasRequestedRecently(const LLUUID& in } else { - return FALSE; + return false; } } diff --git a/indra/newview/llattachmentsmgr.h b/indra/newview/llattachmentsmgr.h index 513daafabe..2428acfb38 100644 --- a/indra/newview/llattachmentsmgr.h +++ b/indra/newview/llattachmentsmgr.h @@ -69,13 +69,13 @@ public: { LLUUID mItemID; U8 mAttachmentPt; - BOOL mAdd; + bool mAdd; }; typedef std::deque<AttachmentsInfo> attachments_vec_t; void addAttachmentRequest(const LLUUID& item_id, const U8 attachment_pt, - const BOOL add); + const bool add); void onAttachmentRequested(const LLUUID& item_id); void requestAttachments(attachments_vec_t& attachment_requests); static void onIdle(void *); @@ -95,8 +95,8 @@ private: LLItemRequestTimes(const std::string& op_name, F32 timeout); void addTime(const LLUUID& inv_item_id); void removeTime(const LLUUID& inv_item_id); - BOOL wasRequestedRecently(const LLUUID& item_id) const; - BOOL getTime(const LLUUID& inv_item_id, LLTimer& timer) const; + bool wasRequestedRecently(const LLUUID& item_id) const; + bool getTime(const LLUUID& inv_item_id, LLTimer& timer) const; private: F32 mTimeout; diff --git a/indra/newview/llautoreplace.cpp b/indra/newview/llautoreplace.cpp index e1d494f7c7..f200ca8e31 100644 --- a/indra/newview/llautoreplace.cpp +++ b/indra/newview/llautoreplace.cpp @@ -81,7 +81,7 @@ void LLAutoReplace::autoreplaceCallback(S32& replacement_start, S32& replacement replacement_start = word_start; replacement_length = word_end - word_start + 1; replacement_string = utf8str_to_wstring(replacement_word); - S32 size_change = replacement_string.size() - old_string.size(); + S32 size_change = static_cast<S32>(replacement_string.size() - old_string.size()); cursor_pos += size_change; } } diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 2857235dd2..038030a1f6 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -527,7 +527,7 @@ void LLAvatarActions::teleport_request_callback(const LLSD& notification, const msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_MessageBlock); - msg->addBOOLFast(_PREHASH_FromGroup, FALSE); + msg->addBOOLFast(_PREHASH_FromGroup, false); msg->addUUIDFast(_PREHASH_ToAgentID, notification["substitutions"]["uuid"] ); msg->addU8Fast(_PREHASH_Offline, IM_ONLINE); msg->addU8Fast(_PREHASH_Dialog, IM_TELEPORT_REQUEST); @@ -652,8 +652,8 @@ void LLAvatarActions::csr(const LLUUID& id, std::string name) std::string url = "http://csr.lindenlab.com/agent/"; // slow and stupid, but it's late - S32 len = name.length(); - for (S32 i = 0; i < len; i++) + auto len = name.length(); + for (size_t i = 0; i < len; i++) { if (name[i] == ' ') { @@ -716,7 +716,7 @@ namespace action_give_inventory */ static LLInventoryPanel* get_active_inventory_panel() { - LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE); + LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(false); LLFloater* floater_appearance = LLFloaterReg::findInstance("appearance"); if (!active_panel || (floater_appearance && floater_appearance->hasFocus())) { @@ -828,11 +828,11 @@ namespace action_give_inventory return; } - S32 count = LLShareInfo::instance().mAvatarNames.size(); + auto count = LLShareInfo::instance().mAvatarNames.size(); bool shared = count && !inventory_selected_uuids.empty(); // iterate through avatars - for(S32 i = 0; i < count; ++i) + for(size_t i = 0; i < count; ++i) { const LLUUID& avatar_uuid = LLShareInfo::instance().mAvatarUuids[i]; @@ -1055,7 +1055,7 @@ void LLAvatarActions::shareWithAvatars(LLView * panel) LLFloater* root_floater = gFloaterView->getParentFloater(panel); LLInventoryPanel* inv_panel = dynamic_cast<LLInventoryPanel*>(panel); LLFloaterAvatarPicker* picker = - LLFloaterAvatarPicker::show(boost::bind(give_inventory, _1, _2, inv_panel), TRUE, FALSE, FALSE, root_floater->getName()); + LLFloaterAvatarPicker::show(boost::bind(give_inventory, _1, _2, inv_panel), true, false, false, root_floater->getName()); if (!picker) { return; @@ -1077,7 +1077,7 @@ void LLAvatarActions::shareWithAvatars(const uuid_set_t inventory_selected_uuids using namespace action_give_inventory; LLFloaterAvatarPicker* picker = - LLFloaterAvatarPicker::show(boost::bind(give_inventory_ids, _1, _2, inventory_selected_uuids), TRUE, FALSE, FALSE, root_floater->getName()); + LLFloaterAvatarPicker::show(boost::bind(give_inventory_ids, _1, _2, inventory_selected_uuids), true, false, false, root_floater->getName()); if (!picker) { return; @@ -1288,7 +1288,7 @@ bool LLAvatarActions::handleRemove(const LLSD& notification, const LLSD& respons case 0: // YES if( ip->isRightGrantedTo(LLRelationship::GRANT_MODIFY_OBJECTS)) { - LLAvatarTracker::instance().empower(id, FALSE); + LLAvatarTracker::instance().empower(id, false); LLAvatarTracker::instance().notifyObservers(); } LLAvatarTracker::instance().terminateBuddy(id); diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp index e467f74f9c..8f858fe4e1 100644 --- a/indra/newview/llavatarlist.cpp +++ b/indra/newview/llavatarlist.cpp @@ -246,7 +246,7 @@ void LLAvatarList::setDirty(bool val /*= true*/, bool force_refresh /*= false*/) ////////////////////////////////////////////////////////////////////////// void LLAvatarList::refresh() { - bool have_names = TRUE; + bool have_names = true; bool add_limit_exceeded = false; bool modified = false; bool have_filter = !mNameFilter.empty(); @@ -415,7 +415,7 @@ S32 LLAvatarList::notifyParent(const LLSD& info) return LLFlatListViewEx::notifyParent(info); } -void LLAvatarList::addNewItem(const LLUUID& id, const std::string& name, BOOL is_online, EAddPosition pos) +void LLAvatarList::addNewItem(const LLUUID& id, const std::string& name, bool is_online, EAddPosition pos) { LLAvatarListItem* item = new LLAvatarListItem(); item->setShowCompleteName(mShowCompleteName); @@ -437,9 +437,9 @@ void LLAvatarList::addNewItem(const LLUUID& id, const std::string& name, BOOL is } // virtual -BOOL LLAvatarList::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLAvatarList::handleRightMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = LLUICtrl::handleRightMouseDown(x, y, mask); + bool handled = LLUICtrl::handleRightMouseDown(x, y, mask); if ( mContextMenu) { uuid_vec_t selected_uuids; @@ -449,7 +449,7 @@ BOOL LLAvatarList::handleRightMouseDown(S32 x, S32 y, MASK mask) return handled; } -BOOL LLAvatarList::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLAvatarList::handleMouseDown(S32 x, S32 y, MASK mask) { gFocusMgr.setMouseCapture(this); @@ -461,7 +461,7 @@ BOOL LLAvatarList::handleMouseDown(S32 x, S32 y, MASK mask) return LLFlatListViewEx::handleMouseDown(x, y, mask); } -BOOL LLAvatarList::handleMouseUp( S32 x, S32 y, MASK mask ) +bool LLAvatarList::handleMouseUp( S32 x, S32 y, MASK mask ) { if(hasMouseCapture()) { @@ -471,7 +471,7 @@ BOOL LLAvatarList::handleMouseUp( S32 x, S32 y, MASK mask ) return LLFlatListViewEx::handleMouseUp(x, y, mask); } -BOOL LLAvatarList::handleHover(S32 x, S32 y, MASK mask) +bool LLAvatarList::handleHover(S32 x, S32 y, MASK mask) { bool handled = hasMouseCapture(); if(handled) @@ -500,9 +500,9 @@ BOOL LLAvatarList::handleHover(S32 x, S32 y, MASK mask) return handled; } -void LLAvatarList::setVisible(BOOL visible) +void LLAvatarList::setVisible(bool visible) { - if ( visible == FALSE && mContextMenu ) + if (!visible && mContextMenu ) { mContextMenu->hide(); } diff --git a/indra/newview/llavatarlist.h b/indra/newview/llavatarlist.h index 2352c7cd55..af5bfefcde 100644 --- a/indra/newview/llavatarlist.h +++ b/indra/newview/llavatarlist.h @@ -65,7 +65,7 @@ public: virtual void clear(); - virtual void setVisible(BOOL visible); + virtual void setVisible(bool visible); void setNameFilter(const std::string& filter); void setDirty(bool val = true, bool force_refresh = false); @@ -84,10 +84,10 @@ public: bool getIconsVisible() const { return mShowIcons; } const std::string getIconParamName() const{return mIconParamName;} std::string getAvatarName(LLAvatarName av_name); - virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseDown( S32 x, S32 y, MASK mask ); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); + virtual bool handleRightMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseDown( S32 x, S32 y, MASK mask ); + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); // Return true if filter has at least one match. bool filterHasMatches(); @@ -105,7 +105,7 @@ public: protected: void refresh(); - void addNewItem(const LLUUID& id, const std::string& name, BOOL is_online, EAddPosition pos = ADD_BOTTOM); + void addNewItem(const LLUUID& id, const std::string& name, bool is_online, EAddPosition pos = ADD_BOTTOM); void computeDifference( const uuid_vec_t& vnew, uuid_vec_t& vadded, diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index 5f243d18c0..880910d18e 100644 --- a/indra/newview/llavatarlistitem.cpp +++ b/indra/newview/llavatarlistitem.cpp @@ -103,7 +103,7 @@ LLAvatarListItem::~LLAvatarListItem() } } -BOOL LLAvatarListItem::postBuild() +bool LLAvatarListItem::postBuild() { mAvatarIcon = getChild<LLAvatarIconCtrl>("avatar_icon"); mAvatarName = getChild<LLTextBox>("avatar_name"); @@ -141,10 +141,10 @@ BOOL LLAvatarListItem::postBuild() sStaticInitialized = true; } - return TRUE; + return true; } -void LLAvatarListItem::handleVisibilityChange ( BOOL new_visibility ) +void LLAvatarListItem::handleVisibilityChange ( bool new_visibility ) { //Adjust positions of icons (info button etc) when //speaking indicator visibility was changed/toggled while panel was closed (not visible) @@ -325,7 +325,7 @@ void LLAvatarListItem::setShowProfileBtn(bool show) void LLAvatarListItem::showSpeakingIndicator(bool visible) { // Already done? Then do nothing. - if (mSpeakingIndicator->getVisible() == (BOOL)visible) + if (mSpeakingIndicator->getVisible() == (bool)visible) return; // Disabled to not contradict with SpeakingIndicatorManager functionality. EXT-3976 // probably this method should be totally removed. @@ -336,7 +336,7 @@ void LLAvatarListItem::showSpeakingIndicator(bool visible) void LLAvatarListItem::setAvatarIconVisible(bool visible) { // Already done? Then do nothing. - if (mAvatarIcon->getVisible() == (BOOL)visible) + if (mAvatarIcon->getVisible() == (bool)visible) { return; } @@ -356,17 +356,17 @@ void LLAvatarListItem::onProfileBtnClick() LLAvatarActions::showProfile(mAvatarId); } -BOOL LLAvatarListItem::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLAvatarListItem::handleDoubleClick(S32 x, S32 y, MASK mask) { if(mInfoBtn->getRect().pointInRect(x, y)) { onInfoBtnClick(); - return TRUE; + return true; } if(mProfileBtn->getRect().pointInRect(x, y)) { onProfileBtnClick(); - return TRUE; + return true; } return LLPanel::handleDoubleClick(x, y, mask); } diff --git a/indra/newview/llavatarlistitem.h b/indra/newview/llavatarlistitem.h index 3f6dcb0783..2e4c597d30 100644 --- a/indra/newview/llavatarlistitem.h +++ b/indra/newview/llavatarlistitem.h @@ -79,12 +79,12 @@ public: LLAvatarListItem(bool not_from_ui_factory = true); virtual ~LLAvatarListItem(); - virtual BOOL postBuild(); + virtual bool postBuild(); /** * Processes notification from speaker indicator to update children when indicator's visibility is changed. */ - virtual void handleVisibilityChange ( BOOL new_visibility ); + virtual void handleVisibilityChange ( bool new_visibility ); virtual S32 notifyParent(const LLSD& info); virtual void onMouseLeave(S32 x, S32 y, MASK mask); virtual void onMouseEnter(S32 x, S32 y, MASK mask); @@ -115,7 +115,7 @@ public: void onInfoBtnClick(); void onProfileBtnClick(); - /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleDoubleClick(S32 x, S32 y, MASK mask); protected: /** diff --git a/indra/newview/llavatarpropertiesprocessor.cpp b/indra/newview/llavatarpropertiesprocessor.cpp index 715649e844..edbf81526d 100644 --- a/indra/newview/llavatarpropertiesprocessor.cpp +++ b/indra/newview/llavatarpropertiesprocessor.cpp @@ -228,7 +228,7 @@ std::string LLAvatarPropertiesProcessor::paymentInfo(const LLAvatarData* avatar_ bool transacted = (avatar_data->flags & AVATAR_TRANSACTED); bool identified = (avatar_data->flags & AVATAR_IDENTIFIED); // Not currently getting set in dataserver/lldataavatar.cpp for privacy considerations - //BOOL age_verified = (avatar_data->flags & AVATAR_AGEVERIFIED); + //bool age_verified = (avatar_data->flags & AVATAR_AGEVERIFIED); const char* payment_text; if (transacted) @@ -616,7 +616,7 @@ void LLAvatarPropertiesProcessor::sendPickInfoUpdate(const LLPickData* new_pick) msg->addUUID(_PREHASH_CreatorID, new_pick->creator_id); //legacy var need to be deleted - msg->addBOOL(_PREHASH_TopPick, FALSE); + msg->addBOOL(_PREHASH_TopPick, false); // fills in on simulator if null msg->addUUID(_PREHASH_ParcelID, new_pick->parcel_id); diff --git a/indra/newview/llavatarpropertiesprocessor.h b/indra/newview/llavatarpropertiesprocessor.h index c73cc69e62..a490f3da10 100644 --- a/indra/newview/llavatarpropertiesprocessor.h +++ b/indra/newview/llavatarpropertiesprocessor.h @@ -131,7 +131,7 @@ struct LLAvatarData struct LLAvatarData::LLGroupData { U64 group_powers; - BOOL accept_notices; + bool accept_notices; std::string group_title; LLUUID group_id; std::string group_name; @@ -143,14 +143,14 @@ struct LLPickData LLUUID agent_id; LLUUID pick_id; LLUUID creator_id; - BOOL top_pick; + bool top_pick; LLUUID parcel_id; std::string name; std::string desc; LLUUID snapshot_id; LLVector3d pos_global; S32 sort_order; - BOOL enabled; + bool enabled; //used only in read requests std::string user_name; diff --git a/indra/newview/llavatarrenderinfoaccountant.cpp b/indra/newview/llavatarrenderinfoaccountant.cpp index ec9cf2c8b7..b0befa62e6 100644 --- a/indra/newview/llavatarrenderinfoaccountant.cpp +++ b/indra/newview/llavatarrenderinfoaccountant.cpp @@ -236,8 +236,6 @@ void LLAvatarRenderInfoAccountant::avatarRenderInfoReportCoro(std::string url, U !avatar->isControlAvatar() && // Not part of an animated object avatar->getObjectHost() == regionp->getHost()) // Ensure it's on the same region { - avatar->calculateUpdateRenderComplexity(); // Make sure the numbers are up-to-date - LLSD info = LLSD::emptyMap(); U32 avatar_complexity = avatar->getVisualComplexity(); if (avatar_complexity > 0) diff --git a/indra/newview/llavatarrendernotifier.cpp b/indra/newview/llavatarrendernotifier.cpp index 61fc9d00f3..07a5c871ae 100644 --- a/indra/newview/llavatarrendernotifier.cpp +++ b/indra/newview/llavatarrendernotifier.cpp @@ -306,7 +306,7 @@ void LLHUDRenderNotifier::updateNotificationHUD(hud_complexity_list_t complexity } mHUDComplexityList = complexity; - mHUDsCount = mHUDComplexityList.size(); + mHUDsCount = static_cast<S32>(mHUDComplexityList.size()); static LLCachedControl<U32> show_my_complexity_changes(gSavedSettings, "ShowMyComplexityChanges", 20); if (!show_my_complexity_changes) diff --git a/indra/newview/llblockedlistitem.cpp b/indra/newview/llblockedlistitem.cpp index 875e8e0bf1..2a0255fb10 100644 --- a/indra/newview/llblockedlistitem.cpp +++ b/indra/newview/llblockedlistitem.cpp @@ -51,7 +51,7 @@ LLBlockedListItem::LLBlockedListItem(const LLMute* item) buildFromFile("panel_blocked_list_item.xml"); } -BOOL LLBlockedListItem::postBuild() +bool LLBlockedListItem::postBuild() { mTitleCtrl = getChild<LLTextBox>("item_name"); mTitleCtrl->setValue(mItemName); @@ -62,27 +62,27 @@ BOOL LLBlockedListItem::postBuild() case LLMute::EXTERNAL: { LLAvatarIconCtrl* avatar_icon = getChild<LLAvatarIconCtrl>("avatar_icon"); - avatar_icon->setVisible(TRUE); + avatar_icon->setVisible(true); avatar_icon->setValue(mItemID); } break; case LLMute::GROUP: { LLGroupIconCtrl* group_icon = getChild<LLGroupIconCtrl>("group_icon"); - group_icon->setVisible(TRUE); + group_icon->setVisible(true); group_icon->setValue(mItemID); } break; case LLMute::OBJECT: case LLMute::BY_NAME: - getChild<LLUICtrl>("object_icon")->setVisible(TRUE); + getChild<LLUICtrl>("object_icon")->setVisible(true); break; default: break; } - return TRUE; + return true; } void LLBlockedListItem::onMouseEnter(S32 x, S32 y, MASK mask) diff --git a/indra/newview/llblockedlistitem.h b/indra/newview/llblockedlistitem.h index 3eeefd622b..01894ad11a 100644 --- a/indra/newview/llblockedlistitem.h +++ b/indra/newview/llblockedlistitem.h @@ -49,7 +49,7 @@ class LLBlockedListItem : public LLPanel public: LLBlockedListItem(const LLMute* item); - virtual BOOL postBuild(); + virtual bool postBuild(); void onMouseEnter(S32 x, S32 y, MASK mask); void onMouseLeave(S32 x, S32 y, MASK mask); diff --git a/indra/newview/llblocklist.cpp b/indra/newview/llblocklist.cpp index 31b83cfb57..89516a8a84 100644 --- a/indra/newview/llblocklist.cpp +++ b/indra/newview/llblocklist.cpp @@ -47,7 +47,7 @@ LLBlockList::LLBlockList(const Params& p) { LLMuteList::getInstance()->addObserver(this); - mMuteListSize = LLMuteList::getInstance()->getMutes().size(); + mMuteListSize = static_cast<U32>(LLMuteList::getInstance()->getMutes().size()); // Set up context menu. LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; @@ -92,7 +92,7 @@ void LLBlockList::createList() BlockListActionType LLBlockList::getCurrentMuteListActionType() { BlockListActionType type = NONE; - U32 curSize = LLMuteList::getInstance()->getMutes().size(); + U32 curSize = static_cast<U32>(LLMuteList::getInstance()->getMutes().size()); if( curSize > mMuteListSize) type = ADD; else if(curSize < mMuteListSize) @@ -113,9 +113,9 @@ void LLBlockList::onChangeDetailed(const LLMute &mute) refresh(); } -BOOL LLBlockList::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLBlockList::handleRightMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = LLUICtrl::handleRightMouseDown(x, y, mask); + bool handled = LLUICtrl::handleRightMouseDown(x, y, mask); LLToggleableMenu* context_menu = mContextMenu.get(); if (context_menu && size()) @@ -266,7 +266,7 @@ void LLBlockList::refresh() selectItemPair(getItemPair(next_selected), true); } } - mMuteListSize = LLMuteList::getInstance()->getMutes().size(); + mMuteListSize = static_cast<U32>(LLMuteList::getInstance()->getMutes().size()); // Sort the list. sort(); diff --git a/indra/newview/llblocklist.h b/indra/newview/llblocklist.h index 86598f2da1..64e8246f43 100644 --- a/indra/newview/llblocklist.h +++ b/indra/newview/llblocklist.h @@ -54,7 +54,7 @@ public: LLBlockList(const Params& p); virtual ~LLBlockList(); - virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleRightMouseDown(S32 x, S32 y, MASK mask); LLToggleableMenu* getContextMenu() const { return mContextMenu.get(); } LLBlockedListItem* getBlockedItem() const; diff --git a/indra/newview/llbreadcrumbview.cpp b/indra/newview/llbreadcrumbview.cpp deleted file mode 100644 index 59158f50ba..0000000000 --- a/indra/newview/llbreadcrumbview.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/** - * @file llbreadcrumbview.cpp - * @brief UI widget for displaying position in a folder hierarchy and allowing - * the user to click on a location in the hierarchy. - * - * $LicenseInfo:firstyear=2009&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 "llviewerprecompiledheaders.h" - -#include "llbreadcrumbview.h" - -// TODO diff --git a/indra/newview/llbreadcrumbview.h b/indra/newview/llbreadcrumbview.h deleted file mode 100644 index 328d39b47e..0000000000 --- a/indra/newview/llbreadcrumbview.h +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @file llbreadcrumbview.h - * @brief UI widget for displaying position in a folder hierarchy and allowing - * the user to click on a location in the hierarchy. - * - * $LicenseInfo:firstyear=2009&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 LLBREADCRUMBVIEW_H -#define LLBREADCRUMBVIEW_H - -#endif // LLBREADCRUMBVIEW_H diff --git a/indra/newview/llbreastmotion.cpp b/indra/newview/llbreastmotion.cpp deleted file mode 100644 index 5e445bb360..0000000000 --- a/indra/newview/llbreastmotion.cpp +++ /dev/null @@ -1,395 +0,0 @@ -/** - * @file llbreastmotion.cpp - * @brief Implementation of LLBreastMotion class. - * - * $LicenseInfo:firstyear=2011&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, 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$ - */ - -//----------------------------------------------------------------------------- -// Header Files -//----------------------------------------------------------------------------- -#include "llviewerprecompiledheaders.h" -#include "linden_common.h" - -#include "m3math.h" -#include "v3dmath.h" - -#include "llbreastmotion.h" -#include "llcharacter.h" -#include "llviewercontrol.h" -#include "llviewervisualparam.h" -#include "llvoavatarself.h" - -#define MIN_REQUIRED_PIXEL_AREA_BREAST_MOTION 0.f; - -#define N_PARAMS 2 - -// User-set params -static const std::string breast_param_names_user[N_PARAMS] = -{ - "Breast_Female_Cleavage_Driver", - "Breast_Gravity_Driver" -}; - -// Params driven by this algorithm -static const std::string breast_param_names_driven[N_PARAMS] = -{ - "Breast_Female_Cleavage", - "Breast_Gravity" -}; - - - -LLBreastMotion::LLBreastMotion(const LLUUID &id) : - LLMotion(id), - mCharacter(NULL) -{ - mName = "breast_motion"; - mChestState = new LLJointState; - - mBreastMassParam = (F32)1.0; - mBreastDragParam = LLVector3((F32)0.1, (F32)0.1, (F32)0.1); - mBreastSmoothingParam = (U32)2; - mBreastGravityParam = (F32)0.0; - - mBreastSpringParam = LLVector3((F32)3.0, (F32)0.0, (F32)3.0); - mBreastGainParam = LLVector3((F32)50.0, (F32)0.0, (F32)50.0); - mBreastDampingParam = LLVector3((F32)0.3, (F32)0.0, (F32)0.3); - mBreastMaxVelocityParam = LLVector3((F32)10.0, (F32)0.0, (F32)10.0); - - mBreastParamsUser[0] = mBreastParamsUser[1] = mBreastParamsUser[2] = NULL; - mBreastParamsDriven[0] = mBreastParamsDriven[1] = mBreastParamsDriven[2] = NULL; - - mCharLastPosition_world_pt = LLVector3(0,0,0); - mCharLastVelocity_local_vec = LLVector3(0,0,0); - mCharLastAcceleration_local_vec = LLVector3(0,0,0); - mBreastLastPosition_local_pt = LLVector3(0,0,0); - mBreastLastUpdatePosition_local_pt = LLVector3(0,0,0); - mBreastVelocity_local_vec = LLVector3(0,0,0); -} - -LLBreastMotion::~LLBreastMotion() -{ -} - -BOOL LLBreastMotion::onActivate() -{ - return TRUE; -} - -void LLBreastMotion::onDeactivate() -{ -} - -LLMotion::LLMotionInitStatus LLBreastMotion::onInitialize(LLCharacter *character) -{ - mCharacter = character; - - if (!mChestState->setJoint(character->getJoint("mChest"))) - { - return STATUS_FAILURE; - } - - mChestState->setUsage(LLJointState::ROT); - addJointState( mChestState ); - - for (U32 i=0; i < N_PARAMS; i++) - { - mBreastParamsUser[i] = NULL; - mBreastParamsDriven[i] = NULL; - mBreastParamsMin[i] = 0; - mBreastParamsMax[i] = 0; - if (breast_param_names_user[i] != "" && breast_param_names_driven[i] != "") - { - mBreastParamsUser[i] = (LLViewerVisualParam*)mCharacter->getVisualParam(breast_param_names_user[i].c_str()); - mBreastParamsDriven[i] = (LLViewerVisualParam*)mCharacter->getVisualParam(breast_param_names_driven[i].c_str()); - if (mBreastParamsDriven[i]) - { - mBreastParamsMin[i] = mBreastParamsDriven[i]->getMinWeight(); - mBreastParamsMax[i] = mBreastParamsDriven[i]->getMaxWeight(); - } - } - } - - mTimer.reset(); - return STATUS_SUCCESS; -} - -F32 LLBreastMotion::getMinPixelArea() -{ - return MIN_REQUIRED_PIXEL_AREA_BREAST_MOTION; -} - - -F32 LLBreastMotion::calculateTimeDelta() -{ - const F32 time = mTimer.getElapsedTimeF32(); - const F32 time_delta = time - mLastTime; - mLastTime = time; - return time_delta; -} - -// Local space means "parameter space". -LLVector3 LLBreastMotion::toLocal(const LLVector3 &world_vector) -{ - LLVector3 local_vec(0,0,0); - - LLJoint *chest_joint = mChestState->getJoint(); - const LLQuaternion world_rot = chest_joint->getWorldRotation(); - - // Cleavage - LLVector3 breast_dir_world_vec = LLVector3(-1,0,0) * world_rot; // -1 b/c cleavage param changes opposite to direction - breast_dir_world_vec.normalize(); - local_vec[0] = world_vector * breast_dir_world_vec; - - // Up-Down Bounce - LLVector3 breast_up_dir_world_vec = LLVector3(0,0,1) * world_rot; - breast_up_dir_world_vec.normalize(); - local_vec[1] = world_vector * breast_up_dir_world_vec; - - return local_vec; -} - -LLVector3 LLBreastMotion::calculateVelocity_local(const F32 time_delta) -{ - LLJoint *chest_joint = mChestState->getJoint(); - const LLVector3 world_pos_pt = chest_joint->getWorldPosition(); - const LLQuaternion world_rot = chest_joint->getWorldRotation(); - const LLVector3 last_world_pos_pt = mCharLastPosition_world_pt; - const LLVector3 char_velocity_world_vec = (world_pos_pt-last_world_pos_pt) / time_delta; - const LLVector3 char_velocity_local_vec = toLocal(char_velocity_world_vec); - - return char_velocity_local_vec; -} - -LLVector3 LLBreastMotion::calculateAcceleration_local(const LLVector3 &new_char_velocity_local_vec, - const F32 time_delta) -{ - LLVector3 char_acceleration_local_vec = new_char_velocity_local_vec - mCharLastVelocity_local_vec; - - char_acceleration_local_vec = - char_acceleration_local_vec * 1.0/mBreastSmoothingParam + - mCharLastAcceleration_local_vec * (mBreastSmoothingParam-1.0)/mBreastSmoothingParam; - - mCharLastAcceleration_local_vec = char_acceleration_local_vec; - - return char_acceleration_local_vec; -} - -BOOL LLBreastMotion::onUpdate(F32 time, U8* joint_mask) -{ - // Skip if disabled globally. - if (!gSavedSettings.getBOOL("AvatarPhysics")) - { - return TRUE; - } - - // Higher LOD is better. This controls the granularity - // and frequency of updates for the motions. - const F32 lod_factor = LLVOAvatar::sPhysicsLODFactor; - if (lod_factor == 0) - { - return TRUE; - } - - if (mCharacter->getSex() != SEX_FEMALE) return TRUE; - const F32 time_delta = calculateTimeDelta(); - if (time_delta < .01 || time_delta > 10.0) return TRUE; - - - //////////////////////////////////////////////////////////////////////////////// - // Get all parameters and settings - // - - mBreastMassParam = mCharacter->getVisualParamWeight("Breast_Physics_Mass"); - mBreastSmoothingParam = (U32)(mCharacter->getVisualParamWeight("Breast_Physics_Smoothing")); - mBreastGravityParam = mCharacter->getVisualParamWeight("Breast_Physics_Gravity"); - - mBreastSpringParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Spring"); - mBreastGainParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Gain"); - mBreastDampingParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Damping"); - mBreastMaxVelocityParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Max_Velocity"); - mBreastDragParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Drag"); - - mBreastSpringParam[1] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Spring"); - mBreastGainParam[1] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Gain"); - mBreastDampingParam[1] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Damping"); - mBreastMaxVelocityParam[1] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Max_Velocity"); - mBreastDragParam[1] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Drag"); - - - // Get the current morph parameters. - LLVector3 breast_user_local_pt(0,0,0); - for (U32 i=0; i < N_PARAMS; i++) - { - if (mBreastParamsUser[i] != NULL) - { - breast_user_local_pt[i] = mBreastParamsUser[i]->getWeight(); - } - } - - LLVector3 breast_current_local_pt = mBreastLastPosition_local_pt; - - // - // End parameters and settings - //////////////////////////////////////////////////////////////////////////////// - - - //////////////////////////////////////////////////////////////////////////////// - // Calculate velocity and acceleration in parameter space. - // - - const LLVector3 char_velocity_local_vec = calculateVelocity_local(time_delta); - const LLVector3 char_acceleration_local_vec = calculateAcceleration_local(char_velocity_local_vec, time_delta); - mCharLastVelocity_local_vec = char_velocity_local_vec; - - LLJoint *chest_joint = mChestState->getJoint(); - mCharLastPosition_world_pt = chest_joint->getWorldPosition(); - - // - // End velocity and acceleration - //////////////////////////////////////////////////////////////////////////////// - - - //////////////////////////////////////////////////////////////////////////////// - // Calculate the total force - // - - // Spring force is a restoring force towards the original user-set breast position. - // F = kx - const LLVector3 spring_length_local = breast_current_local_pt-breast_user_local_pt; - LLVector3 force_spring_local_vec = -spring_length_local; force_spring_local_vec *= mBreastSpringParam; - - // Acceleration is the force that comes from the change in velocity of the torso. - // F = ma + mg - LLVector3 force_accel_local_vec = char_acceleration_local_vec * mBreastMassParam; - const LLVector3 force_gravity_local_vec = toLocal(LLVector3(0,0,1))* mBreastGravityParam * mBreastMassParam; - force_accel_local_vec += force_gravity_local_vec; - force_accel_local_vec *= mBreastGainParam; - - // Damping is a restoring force that opposes the current velocity. - // F = -kv - LLVector3 force_damping_local_vec = -mBreastDampingParam; - force_damping_local_vec *= mBreastVelocity_local_vec; - - // Drag is a force imparted by velocity, intuitively it is similar to wind resistance. - // F = .5v*v - LLVector3 force_drag_local_vec = .5*char_velocity_local_vec; - force_drag_local_vec *= char_velocity_local_vec; - force_drag_local_vec *= mBreastDragParam[0]; - - LLVector3 force_net_local_vec = - force_accel_local_vec + - force_gravity_local_vec + - force_spring_local_vec + - force_damping_local_vec + - force_drag_local_vec; - - // - // End total force - //////////////////////////////////////////////////////////////////////////////// - - - //////////////////////////////////////////////////////////////////////////////// - // Calculate new params - // - - // Calculate the new acceleration based on the net force. - // a = F/m - LLVector3 acceleration_local_vec = force_net_local_vec / mBreastMassParam; - mBreastVelocity_local_vec += acceleration_local_vec; - mBreastVelocity_local_vec.clamp(-mBreastMaxVelocityParam*100.0, mBreastMaxVelocityParam*100.0); - - // Temporary debugging setting to cause all avatars to move, for profiling purposes. - if (gSavedSettings.getBOOL("AvatarPhysicsTest")) - { - mBreastVelocity_local_vec[0] = sin(mTimer.getElapsedTimeF32()*4.0)*5.0; - mBreastVelocity_local_vec[1] = sin(mTimer.getElapsedTimeF32()*3.0)*5.0; - } - // Calculate the new parameters and clamp them to the min/max ranges. - LLVector3 new_local_pt = breast_current_local_pt + mBreastVelocity_local_vec*time_delta; - new_local_pt.clamp(mBreastParamsMin,mBreastParamsMax); - - // Set the new parameters. - for (U32 i=0; i < 3; i++) - { - // If the param is disabled, just set the param to the user value. - if (mBreastMaxVelocityParam[i] == 0) - { - new_local_pt[i] = breast_user_local_pt[i]; - } - if (mBreastParamsDriven[i]) - { - mCharacter->setVisualParamWeight(mBreastParamsDriven[i], - new_local_pt[i]); - } - } - - mBreastLastPosition_local_pt = new_local_pt; - - // - // End calculate new params - //////////////////////////////////////////////////////////////////////////////// - - - //////////////////////////////////////////////////////////////////////////////// - // Conditionally update the visual params - // - - // Updating the visual params (i.e. what the user sees) is fairly expensive. - // So only update if the params have changed enough, and also take into account - // the graphics LOD settings. - - // For non-self, if the avatar is small enough visually, then don't update. - const BOOL is_self = (dynamic_cast<LLVOAvatarSelf *>(this) != NULL); - if (!is_self) - { - const F32 area_for_max_settings = 0.0; - const F32 area_for_min_settings = 1400.0; - - const F32 area_for_this_setting = area_for_max_settings + (area_for_min_settings-area_for_max_settings)*(1.0-lod_factor); - const F32 pixel_area = fsqrtf(mCharacter->getPixelArea()); - if (pixel_area < area_for_this_setting) - { - return TRUE; - } - } - - // If the parameter hasn't changed enough, then don't update. - LLVector3 position_diff = mBreastLastUpdatePosition_local_pt-new_local_pt; - for (U32 i=0; i < 3; i++) - { - const F32 min_delta = (1.0-lod_factor)*(mBreastParamsMax[i]-mBreastParamsMin[i])/2.0; - if (llabs(position_diff[i]) > min_delta) - { - mCharacter->updateVisualParams(); - mBreastLastUpdatePosition_local_pt = new_local_pt; - return TRUE; - } - } - - // - // End update visual params - //////////////////////////////////////////////////////////////////////////////// - - return TRUE; -} diff --git a/indra/newview/llbreastmotion.h b/indra/newview/llbreastmotion.h deleted file mode 100644 index f1c508d4b7..0000000000 --- a/indra/newview/llbreastmotion.h +++ /dev/null @@ -1,154 +0,0 @@ -/** - * @file llbreastmotion.h - * @brief Implementation of LLBreastMotion class. - * - * $LicenseInfo:firstyear=2011&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, 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_LLBREASTMOTION_H -#define LL_LLBREASTMOTION_H - -//----------------------------------------------------------------------------- -// Header files -//----------------------------------------------------------------------------- -#include "llmotion.h" -#include "llframetimer.h" - -#define BREAST_MOTION_FADEIN_TIME 1.0f -#define BREAST_MOTION_FADEOUT_TIME 1.0f - -class LLViewerVisualParam; - -//----------------------------------------------------------------------------- -// class LLBreastMotion -//----------------------------------------------------------------------------- -class LLBreastMotion : - public LLMotion -{ -public: - // Constructor - LLBreastMotion(const LLUUID &id); - - // Destructor - virtual ~LLBreastMotion(); - -public: - //------------------------------------------------------------------------- - // functions to support MotionController and MotionRegistry - //------------------------------------------------------------------------- - - // static constructor - // all subclasses must implement such a function and register it - static LLMotion *create(const LLUUID &id) { return new LLBreastMotion(id); } - -public: - //------------------------------------------------------------------------- - // animation callbacks to be implemented by subclasses - //------------------------------------------------------------------------- - - // motions must specify whether or not they loop - virtual BOOL getLoop() { return TRUE; } - - // motions must report their total duration - virtual F32 getDuration() { return 0.0; } - - // motions must report their "ease in" duration - virtual F32 getEaseInDuration() { return BREAST_MOTION_FADEIN_TIME; } - - // motions must report their "ease out" duration. - virtual F32 getEaseOutDuration() { return BREAST_MOTION_FADEOUT_TIME; } - - // called to determine when a motion should be activated/deactivated based on avatar pixel coverage - virtual F32 getMinPixelArea(); - - // motions must report their priority - virtual LLJoint::JointPriority getPriority() { return LLJoint::MEDIUM_PRIORITY; } - - virtual LLMotionBlendType getBlendType() { return ADDITIVE_BLEND; } - - // run-time (post constructor) initialization, - // called after parameters have been set - // must return true to indicate success and be available for activation - virtual LLMotionInitStatus onInitialize(LLCharacter *character); - - // called when a motion is activated - // must return TRUE to indicate success, or else - // it will be deactivated - virtual BOOL onActivate(); - - // called per time step - // must return TRUE while it is active, and - // must return FALSE when the motion is completed. - virtual BOOL onUpdate(F32 time, U8* joint_mask); - - // called when a motion is deactivated - virtual void onDeactivate(); - -protected: - LLVector3 toLocal(const LLVector3 &world_vector); - LLVector3 calculateVelocity_local(const F32 time_delta); - LLVector3 calculateAcceleration_local(const LLVector3 &new_char_velocity_local_vec, - const F32 time_delta); - F32 calculateTimeDelta(); -private: - //------------------------------------------------------------------------- - // joint states to be animated - //------------------------------------------------------------------------- - LLPointer<LLJointState> mChestState; - LLCharacter* mCharacter; - - - //------------------------------------------------------------------------- - // miscellaneous parameters - //------------------------------------------------------------------------- - LLViewerVisualParam *mBreastParamsUser[3]; - LLViewerVisualParam *mBreastParamsDriven[3]; - LLVector3 mBreastParamsMin; - LLVector3 mBreastParamsMax; - - LLVector3 mCharLastPosition_world_pt; // Last position of the avatar - LLVector3 mCharLastVelocity_local_vec; // How fast the character is moving - LLVector3 mCharLastAcceleration_local_vec; // Change in character velocity - - LLVector3 mBreastLastPosition_local_pt; // Last parameters for breast - LLVector3 mBreastVelocity_local_vec; // How fast the breast params are moving - LLVector3 mBreastLastUpdatePosition_local_pt; // Last parameters when visual update was sent - - - F32 mBreastMassParam; - F32 mBreastGravityParam; - U32 mBreastSmoothingParam; - - LLVector3 mBreastSpringParam; - LLVector3 mBreastDampingParam; - LLVector3 mBreastGainParam; - LLVector3 mBreastMaxVelocityParam; - LLVector3 mBreastDragParam; - - LLFrameTimer mTimer; - F32 mLastTime; - - U32 mFileTicks; -}; - -#endif // LL_LLBREASTMOTION_H - diff --git a/indra/newview/llbuycurrencyhtml.cpp b/indra/newview/llbuycurrencyhtml.cpp index 115e68b396..e6c4d44573 100644 --- a/indra/newview/llbuycurrencyhtml.cpp +++ b/indra/newview/llbuycurrencyhtml.cpp @@ -138,9 +138,9 @@ void LLBuyCurrencyHTML::showDialog( bool specific_sum_requested, const std::stri buy_currency_floater->navigateToFinalURL(); // make it visible and raise to front - BOOL visible = TRUE; + bool visible = true; buy_currency_floater->setVisible( visible ); - BOOL take_focus = TRUE; + bool take_focus = true; buy_currency_floater->setFrontmost( take_focus ); // spec calls for floater to be centered on client window diff --git a/indra/newview/llcallbacklist.cpp b/indra/newview/llcallbacklist.cpp index 1674750351..c474f2885b 100644 --- a/indra/newview/llcallbacklist.cpp +++ b/indra/newview/llcallbacklist.cpp @@ -191,10 +191,10 @@ public: } private: - BOOL tick() + bool tick() { mCallable(); - return TRUE; + return true; } nullary_func_t mCallable; @@ -215,7 +215,7 @@ public: { } private: - BOOL tick() + bool tick() { return mCallable(); } diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp index f5bc2343fb..039164cd6e 100644 --- a/indra/newview/llcallingcard.cpp +++ b/indra/newview/llcallingcard.cpp @@ -26,16 +26,11 @@ #include "llviewerprecompiledheaders.h" -#if LL_WINDOWS -#pragma warning( disable : 4800 ) // performance warning in <functional> -#endif - #include "llcallingcard.h" #include <algorithm> #include "indra_constants.h" -//#include "llcachename.h" #include "llstl.h" #include "lltimer.h" #include "lluuid.h" @@ -99,7 +94,7 @@ LLAvatarTracker::LLAvatarTracker() : mTrackingData(NULL), mTrackedAgentValid(false), mModifyMask(0x0), - mIsNotifyObservers(FALSE) + mIsNotifyObservers(false) { } @@ -497,7 +492,7 @@ void LLAvatarTracker::notifyObservers() return; } LL_PROFILE_ZONE_SCOPED - mIsNotifyObservers = TRUE; + mIsNotifyObservers = true; observer_list_t observers(mObservers); observer_list_t::iterator it = observers.begin(); @@ -514,7 +509,7 @@ void LLAvatarTracker::notifyObservers() mModifyMask = LLFriendObserver::NONE; mChangedBuddyIDs.clear(); - mIsNotifyObservers = FALSE; + mIsNotifyObservers = false; } void LLAvatarTracker::addParticularFriendObserver(const LLUUID& buddy_id, LLFriendObserver* observer) @@ -685,7 +680,7 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online) { LL_PROFILE_ZONE_SCOPED S32 count = msg->getNumberOfBlocksFast(_PREHASH_AgentBlock); - BOOL chat_notify = gSavedSettings.getBOOL("ChatOnlineNotification"); + bool chat_notify = gSavedSettings.getBOOL("ChatOnlineNotification"); LL_DEBUGS() << "Received " << count << " online notifications **** " << LL_ENDL; if(count > 0) @@ -749,7 +744,7 @@ static void on_avatar_name_cache_notify(const LLUUID& agent_id, notification = LLNotifications::instance().add("FriendOnlineOffline", args, - payload.with("respond_on_mousedown", TRUE), + payload.with("respond_on_mousedown", true), boost::bind(&LLAvatarActions::startIM, agent_id)); } else diff --git a/indra/newview/llcallingcard.h b/indra/newview/llcallingcard.h index 07de0ff3ce..48b93fdf9d 100644 --- a/indra/newview/llcallingcard.h +++ b/indra/newview/llcallingcard.h @@ -210,7 +210,7 @@ private: LLAvatarTracker(const LLAvatarTracker&); bool operator==(const LLAvatarTracker&); - BOOL mIsNotifyObservers; + bool mIsNotifyObservers; public: // don't you dare create or delete this object diff --git a/indra/newview/llchannelmanager.cpp b/indra/newview/llchannelmanager.cpp index f66a9865fc..060430862b 100644 --- a/indra/newview/llchannelmanager.cpp +++ b/indra/newview/llchannelmanager.cpp @@ -161,7 +161,7 @@ void LLChannelManager::onStartUpToastClose() { if(mStartUpChannel) { - mStartUpChannel->setVisible(FALSE); + mStartUpChannel->setVisible(false); mStartUpChannel->closeStartUpToast(); removeChannelByID(STARTUP_CHANNEL_UUID); mStartUpChannel = NULL; @@ -261,8 +261,8 @@ LLNotificationsUI::LLScreenChannel* LLChannelManager::getNotificationScreenChann if (channel == NULL) { - LL_WARNS() << "Can't find screen channel by Notification Channel UUID" << LL_ENDL; - llassert(!"Can't find screen channel by Notification Channel UUID"); + LL_WARNS() << "Can't find screen channel by NotificationChannelUUID" << LL_ENDL; + llassert(!"Can't find screen channel by NotificationChannelUUID"); } return channel; diff --git a/indra/newview/llchatbar.cpp b/indra/newview/llchatbar.cpp index 705552a5c1..4f90db17c0 100644 --- a/indra/newview/llchatbar.cpp +++ b/indra/newview/llchatbar.cpp @@ -63,7 +63,7 @@ // // Globals // -const F32 AGENT_TYPING_TIMEOUT = 5.f; // seconds +constexpr F32 AGENT_TYPING_TIMEOUT = 5.f; // seconds LLChatBar *gChatBar = NULL; @@ -89,11 +89,11 @@ LLChatBar::LLChatBar() mInputEditor(NULL), mGestureLabelTimer(), mLastSpecialChatChannel(0), - mIsBuilt(FALSE), + mIsBuilt(false), mGestureCombo(NULL), mObserver(NULL) { - //setIsChrome(TRUE); + //setIsChrome(true); } @@ -105,7 +105,7 @@ LLChatBar::~LLChatBar() // LLView destructor cleans up children } -BOOL LLChatBar::postBuild() +bool LLChatBar::postBuild() { getChild<LLUICtrl>("Say")->setCommitCallback(boost::bind(&LLChatBar::onClickSay, this, _1)); @@ -118,18 +118,18 @@ BOOL LLChatBar::postBuild() mInputEditor->setKeystrokeCallback(&onInputEditorKeystroke, this); mInputEditor->setFocusLostCallback(boost::bind(&LLChatBar::onInputEditorFocusLost)); mInputEditor->setFocusReceivedCallback(boost::bind(&LLChatBar::onInputEditorGainFocus)); - mInputEditor->setCommitOnFocusLost( FALSE ); - mInputEditor->setRevertOnEsc( FALSE ); - mInputEditor->setIgnoreTab(TRUE); - mInputEditor->setPassDelete(TRUE); - mInputEditor->setReplaceNewlinesWithSpaces(FALSE); + mInputEditor->setCommitOnFocusLost( false ); + mInputEditor->setRevertOnEsc( false ); + mInputEditor->setIgnoreTab(true); + mInputEditor->setPassDelete(true); + mInputEditor->setReplaceNewlinesWithSpaces(false); mInputEditor->setMaxTextLength(DB_CHAT_MSG_STR_LEN); - mInputEditor->setEnableLineHistory(TRUE); + mInputEditor->setEnableLineHistory(true); - mIsBuilt = TRUE; + mIsBuilt = true; - return TRUE; + return true; } //----------------------------------------------------------------------- @@ -137,9 +137,9 @@ BOOL LLChatBar::postBuild() //----------------------------------------------------------------------- // virtual -BOOL LLChatBar::handleKeyHere( KEY key, MASK mask ) +bool LLChatBar::handleKeyHere( KEY key, MASK mask ) { - BOOL handled = FALSE; + bool handled = false; if( KEY_RETURN == key ) { @@ -147,13 +147,13 @@ BOOL LLChatBar::handleKeyHere( KEY key, MASK mask ) { // shout sendChat(CHAT_TYPE_SHOUT); - handled = TRUE; + handled = true; } else if (mask == MASK_NONE) { // say sendChat( CHAT_TYPE_NORMAL ); - handled = TRUE; + handled = true; } } // only do this in main chatbar @@ -161,7 +161,7 @@ BOOL LLChatBar::handleKeyHere( KEY key, MASK mask ) { stopChat(); - handled = TRUE; + handled = true; } return handled; @@ -199,7 +199,7 @@ void LLChatBar::refreshGestures() mGestureCombo->clearRows(); // collect list of unique gestures - std::map <std::string, BOOL> unique; + std::map <std::string, bool> unique; LLGestureMgr::item_map_t::const_iterator it; const LLGestureMgr::item_map_t& active_gestures = LLGestureMgr::instance().getActiveGestures(); for (it = active_gestures.begin(); it != active_gestures.end(); ++it) @@ -209,13 +209,13 @@ void LLChatBar::refreshGestures() { if (!gesture->mTrigger.empty()) { - unique[gesture->mTrigger] = TRUE; + unique[gesture->mTrigger] = true; } } } // add unique gestures - std::map <std::string, BOOL>::iterator it2; + std::map <std::string, bool>::iterator it2; for (it2 = unique.begin(); it2 != unique.end(); ++it2) { mGestureCombo->addSimpleElement((*it2).first); @@ -238,13 +238,13 @@ void LLChatBar::refreshGestures() } // Move the cursor to the correct input field. -void LLChatBar::setKeyboardFocus(BOOL focus) +void LLChatBar::setKeyboardFocus(bool focus) { if (focus) { if (mInputEditor) { - mInputEditor->setFocus(TRUE); + mInputEditor->setFocus(true); mInputEditor->selectAll(); } } @@ -254,13 +254,13 @@ void LLChatBar::setKeyboardFocus(BOOL focus) { mInputEditor->deselect(); } - setFocus(FALSE); + setFocus(false); } } // Ignore arrow keys in chat bar -void LLChatBar::setIgnoreArrowKeys(BOOL b) +void LLChatBar::setIgnoreArrowKeys(bool b) { if (mInputEditor) { @@ -268,7 +268,7 @@ void LLChatBar::setIgnoreArrowKeys(BOOL b) } } -BOOL LLChatBar::inputEditorHasFocus() +bool LLChatBar::inputEditorHasFocus() { return mInputEditor && mInputEditor->hasFocus(); } @@ -409,15 +409,15 @@ void LLChatBar::startChat(const char* line) //TODO* remove DUMMY chat //if(gBottomTray && gBottomTray->getChatBox()) //{ - // gBottomTray->setVisible(TRUE); - // gBottomTray->getChatBox()->setFocus(TRUE); + // gBottomTray->setVisible(true); + // gBottomTray->getChatBox()->setFocus(true); //} // *TODO Vadim: Why was this code commented out? -// gChatBar->setVisible(TRUE); -// gChatBar->setKeyboardFocus(TRUE); -// gSavedSettings.setBOOL("ChatVisible", TRUE); +// gChatBar->setVisible(true); +// gChatBar->setKeyboardFocus(true); +// gSavedSettings.setBOOL("ChatVisible", true); // // if (line && gChatBar->mInputEditor) // { @@ -436,13 +436,13 @@ void LLChatBar::stopChat() //TODO* remove DUMMY chat //if(gBottomTray && gBottomTray->getChatBox()) ///{ - // gBottomTray->getChatBox()->setFocus(FALSE); + // gBottomTray->getChatBox()->setFocus(false); //} // *TODO Vadim: Why was this code commented out? // // In simple UI mode, we never release focus from the chat bar -// gChatBar->setKeyboardFocus(FALSE); +// gChatBar->setKeyboardFocus(false); // // // If we typed a movement key and pressed return during the // // same frame, the keyboard handlers will see the key as having @@ -454,8 +454,8 @@ void LLChatBar::stopChat() // gAgent.stopTyping(); // // // hide chat bar so it doesn't grab focus back -// gChatBar->setVisible(FALSE); -// gSavedSettings.setBOOL("ChatVisible", FALSE); +// gChatBar->setVisible(false); +// gSavedSettings.setBOOL("ChatVisible", false); } // static @@ -470,7 +470,7 @@ void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata ) // to eat trailing spaces that might be part of a gesture. LLWStringUtil::trimHead(raw_text); - S32 length = raw_text.length(); + auto length = raw_text.length(); if( (length > 0) && (raw_text[0] != '/') ) // forward slash is used for escape (eg. emote) sequences { @@ -518,7 +518,7 @@ void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata ) // Select to end of line, starting from the character // after the last one the user typed. - self->mInputEditor->setSelection(length, outlength); + self->mInputEditor->setSelection(static_cast<S32>(length), outlength); } } @@ -557,16 +557,16 @@ void LLChatBar::onClickSay( LLUICtrl* ctrl ) sendChat(chat_type); } -void LLChatBar::sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate) +void LLChatBar::sendChatFromViewer(const std::string &utf8text, EChatType type, bool animate) { sendChatFromViewer(utf8str_to_wstring(utf8text), type, animate); } -void LLChatBar::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate) +void LLChatBar::sendChatFromViewer(const LLWString &wtext, EChatType type, bool animate) { // as soon as we say something, we no longer care about teaching the user // how to chat - gWarningSettings.setBOOL("FirstOtherChatBeforeUser", FALSE); + gWarningSettings.setBOOL("FirstOtherChatBeforeUser", false); // Look for "/20 foo" channel chats. S32 channel = 0; @@ -641,13 +641,13 @@ void LLChatBar::onCommitGesture(LLUICtrl* ctrl) if (!revised_text.empty()) { // Don't play nodding animation - sendChatFromViewer(revised_text, CHAT_TYPE_NORMAL, FALSE); + sendChatFromViewer(revised_text, CHAT_TYPE_NORMAL, false); } } mGestureLabelTimer.start(); if (mGestureCombo != NULL) { // free focus back to chat bar - mGestureCombo->setFocus(FALSE); + mGestureCombo->setFocus(false); } } diff --git a/indra/newview/llchatbar.h b/indra/newview/llchatbar.h index 1217976e2e..5eede61708 100644 --- a/indra/newview/llchatbar.h +++ b/indra/newview/llchatbar.h @@ -47,20 +47,20 @@ public: // constructor for inline chat-bars (e.g. hosted in chat history window) LLChatBar(); ~LLChatBar(); - virtual BOOL postBuild(); + virtual bool postBuild(); - virtual BOOL handleKeyHere(KEY key, MASK mask); + virtual bool handleKeyHere(KEY key, MASK mask); void refresh(); void refreshGestures(); // Move cursor into chat input field. - void setKeyboardFocus(BOOL b); + void setKeyboardFocus(bool b); // Ignore arrow keys for chat bar - void setIgnoreArrowKeys(BOOL b); + void setIgnoreArrowKeys(bool b); - BOOL inputEditorHasFocus(); + bool inputEditorHasFocus(); std::string getCurrentChat(); // since chat bar logic is reused for chat history @@ -69,8 +69,8 @@ public: // Send a chat (after stripping /20foo channel chats). // "Animate" means the nodding animation for regular text. - void sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate); - void sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate); + void sendChatFromViewer(const LLWString &wtext, EChatType type, bool animate); + void sendChatFromViewer(const std::string &utf8text, EChatType type, bool animate); // If input of the form "/20foo" or "/20 foo", returns "foo" and channel 20. // Otherwise returns input and channel 0. @@ -101,7 +101,7 @@ protected: // Which non-zero channel did we last chat on? S32 mLastSpecialChatChannel; - BOOL mIsBuilt; + bool mIsBuilt; LLComboBox* mGestureCombo; LLChatBarGestureObserver* mObserver; diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 4a08eace62..fc50691ece 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -90,7 +90,7 @@ public: } LLUUID object_id; - if (!object_id.set(params[0], FALSE)) + if (!object_id.set(params[0], false)) { return false; } @@ -155,7 +155,7 @@ public: } } - BOOL handleMouseUp(S32 x, S32 y, MASK mask) + bool handleMouseUp(S32 x, S32 y, MASK mask) { return LLPanel::handleMouseUp(x,y,mask); } @@ -577,7 +577,7 @@ public: return false; } - BOOL postBuild() + bool postBuild() { setDoubleClickCallback(boost::bind(&LLChatHistoryHeader::showInspector, this)); @@ -591,7 +591,7 @@ public: if (mInfoCtrl) { mInfoCtrl->setCommitCallback(boost::bind(&LLChatHistoryHeader::onClickInfoCtrl, mInfoCtrl)); - mInfoCtrl->setVisible(FALSE); + mInfoCtrl->setVisible(false); } else { @@ -619,12 +619,12 @@ public: return child->pointInView(local_x, local_y); } - BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) + bool handleRightMouseDown(S32 x, S32 y, MASK mask) { if(pointInChild("avatar_icon",x,y) || pointInChild("user_name",x,y)) { showContextMenu(x,y); - return TRUE; + return true; } return LLPanel::handleRightMouseDown(x,y,mask); @@ -695,7 +695,7 @@ public: updateMinUserNameWidth(); LLColor4 sep_color = LLUIColorTable::instance().getColor("ChatTeleportSeparatorColor"); setTransparentColor(sep_color); - mTimeBoxTextBox->setVisible(FALSE); + mTimeBoxTextBox->setVisible(false); } else if (chat.mFromName.empty() || mSourceType == CHAT_SOURCE_SYSTEM) @@ -725,8 +725,8 @@ public: mSourceType == CHAT_SOURCE_AGENT) { //if it's an avatar name with a username add formatting - S32 username_start = chat.mFromName.rfind(" ("); - S32 username_end = chat.mFromName.rfind(')'); + auto username_start = chat.mFromName.rfind(" ("); + auto username_end = chat.mFromName.rfind(')'); if (username_start != std::string::npos && username_end == (chat.mFromName.length() - 1)) @@ -744,7 +744,7 @@ public: style_params_name.font.name("SansSerifSmall"); style_params_name.font.style("NORMAL"); style_params_name.readonly_color(userNameColor); - user_name->appendText(" - " + username, FALSE, style_params_name); + user_name->appendText(" - " + username, false, style_params_name); } } else @@ -830,7 +830,7 @@ public: user_name->reshape(user_name_rect.getWidth(), user_name_rect.getHeight()); user_name->setRect(user_name_rect); - time_box->setVisible(TRUE); + time_box->setVisible(true); } LLPanel::draw(); @@ -982,7 +982,7 @@ protected: void hideInfoCtrl() { - mInfoCtrl->setVisible(FALSE); + mInfoCtrl->setVisible(false); } private: @@ -1042,7 +1042,7 @@ private: style_params_name.font.name("SansSerifSmall"); style_params_name.font.style("NORMAL"); style_params_name.readonly_color(userNameColor); - user_name->appendText(" - " + av_name.getUserName(), FALSE, style_params_name); + user_name->appendText(" - " + av_name.getUserName(), false, style_params_name); } setToolTip( av_name.getUserName() ); // name might have changed, update width @@ -1223,7 +1223,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL if (mNotifyAboutUnreadMsg && !mEditor->scrolledToEnd() && !from_me && !chat.mFromName.empty()) { mUnreadChatSources.insert(chat.mFromName); - mMoreChatPanel->setVisible(TRUE); + mMoreChatPanel->setVisible(true); std::string chatters; for (const std::string& source : mUnreadChatSources) { @@ -1541,7 +1541,7 @@ void LLChatHistory::draw() if (mEditor->scrolledToEnd()) { mUnreadChatSources.clear(); - mMoreChatPanel->setVisible(FALSE); + mMoreChatPanel->setVisible(false); } LLUICtrl::draw(); diff --git a/indra/newview/llchatitemscontainerctrl.cpp b/indra/newview/llchatitemscontainerctrl.cpp index 2b875c708d..d517f5a19d 100644 --- a/indra/newview/llchatitemscontainerctrl.cpp +++ b/indra/newview/llchatitemscontainerctrl.cpp @@ -43,9 +43,9 @@ #include "llslurl.h" -static const S32 msg_left_offset = 10; -static const S32 msg_right_offset = 10; -static const S32 msg_height_pad = 5; +static constexpr S32 msg_left_offset = 10; +static constexpr S32 msg_right_offset = 10; +static constexpr S32 msg_height_pad = 5; //******************************************************************************************************************* // LLObjectHandler @@ -62,7 +62,7 @@ public: if (params.size() < 2) return false; LLUUID object_id; - if (!object_id.set(params[0], FALSE)) + if (!object_id.set(params[0], false)) { return false; } @@ -93,7 +93,7 @@ LLFloaterIMNearbyChatToastPanel* LLFloaterIMNearbyChatToastPanel::createInstance return item; } -void LLFloaterIMNearbyChatToastPanel::reshape (S32 width, S32 height, BOOL called_from_parent ) +void LLFloaterIMNearbyChatToastPanel::reshape (S32 width, S32 height, bool called_from_parent ) { LLPanel::reshape(width, height,called_from_parent); @@ -122,7 +122,7 @@ void LLFloaterIMNearbyChatToastPanel::reshape (S32 width, S32 height, msg_text->setRect(msg_text_rect); } -BOOL LLFloaterIMNearbyChatToastPanel::postBuild() +bool LLFloaterIMNearbyChatToastPanel::postBuild() { return LLPanel::postBuild(); } @@ -171,7 +171,7 @@ void LLFloaterIMNearbyChatToastPanel::addMessage(LLSD& notification) { style_params.font.style = "ITALIC"; } - mMsgText->appendText(messageText, TRUE, style_params); + mMsgText->appendText(messageText, true, style_params); } snapToMessageHeight(); @@ -234,7 +234,7 @@ void LLFloaterIMNearbyChatToastPanel::init(LLSD& notification) style_params_name.link_href = notification["sender_slurl"].asString(); style_params_name.is_link = true; - mMsgText->appendText(str_sender, FALSE, style_params_name); + mMsgText->appendText(str_sender, false, style_params_name); } else @@ -293,7 +293,7 @@ void LLFloaterIMNearbyChatToastPanel::init(LLSD& notification) { style_params.font.style = "ITALIC"; } - mMsgText->appendText(messageText, FALSE, style_params); + mMsgText->appendText(messageText, false, style_params); } @@ -326,12 +326,12 @@ void LLFloaterIMNearbyChatToastPanel::onMouseEnter (S32 x, S32 y, M return; } -BOOL LLFloaterIMNearbyChatToastPanel::handleMouseDown (S32 x, S32 y, MASK mask) +bool LLFloaterIMNearbyChatToastPanel::handleMouseDown (S32 x, S32 y, MASK mask) { return LLPanel::handleMouseDown(x,y,mask); } -BOOL LLFloaterIMNearbyChatToastPanel::handleMouseUp (S32 x, S32 y, MASK mask) +bool LLFloaterIMNearbyChatToastPanel::handleMouseUp (S32 x, S32 y, MASK mask) { /* fix for request EXT-4780 @@ -344,18 +344,17 @@ BOOL LLFloaterIMNearbyChatToastPanel::handleMouseUp (S32 x, S32 y, MASK mask S32 local_y = y - mMsgText->getRect().mBottom; //if text_box process mouse up (ussually this is click on url) - we didn't show nearby_chat. - if (mMsgText->pointInView(local_x, local_y) ) + if (mMsgText->pointInView(local_x, local_y)) { - if (mMsgText->handleMouseUp(local_x,local_y,mask) == TRUE) - return TRUE; - else - { - LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat")->showHistory(); - return FALSE; - } + if (mMsgText->handleMouseUp(local_x, local_y, mask)) + return true; + + LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat")->showHistory(); + return false; } + LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat")->showHistory(); - return LLPanel::handleMouseUp(x,y,mask); + return LLPanel::handleMouseUp(x, y, mask); } void LLFloaterIMNearbyChatToastPanel::setHeaderVisibility(EShowItemHeader e) @@ -374,7 +373,7 @@ bool LLFloaterIMNearbyChatToastPanel::canAddText () return msg_text->getLineCount()<10; } -BOOL LLFloaterIMNearbyChatToastPanel::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLFloaterIMNearbyChatToastPanel::handleRightMouseDown(S32 x, S32 y, MASK mask) { LLUICtrl* avatar_icon = getChild<LLUICtrl>("avatar_icon", false); @@ -383,7 +382,7 @@ BOOL LLFloaterIMNearbyChatToastPanel::handleRightMouseDown(S32 x, S32 y, MASK //eat message for avatar icon if msg was from object if(avatar_icon->pointInView(local_x, local_y) && mSourceType != CHAT_SOURCE_AGENT) - return TRUE; + return true; return LLPanel::handleRightMouseDown(x,y,mask); } void LLFloaterIMNearbyChatToastPanel::draw() diff --git a/indra/newview/llchatitemscontainerctrl.h b/indra/newview/llchatitemscontainerctrl.h index d041615060..4ae73a0c43 100644 --- a/indra/newview/llchatitemscontainerctrl.h +++ b/indra/newview/llchatitemscontainerctrl.h @@ -66,15 +66,15 @@ public: void onMouseLeave (S32 x, S32 y, MASK mask); void onMouseEnter (S32 x, S32 y, MASK mask); - BOOL handleMouseDown (S32 x, S32 y, MASK mask); - BOOL handleMouseUp (S32 x, S32 y, MASK mask); + bool handleMouseDown (S32 x, S32 y, MASK mask); + bool handleMouseUp (S32 x, S32 y, MASK mask); - virtual BOOL postBuild(); + virtual bool postBuild(); - void reshape (S32 width, S32 height, BOOL called_from_parent = TRUE); + void reshape (S32 width, S32 height, bool called_from_parent = true); void setHeaderVisibility(EShowItemHeader e); - BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); + bool handleRightMouseDown(S32 x, S32 y, MASK mask); virtual void init(LLSD& data); virtual void addMessage(LLSD& data); diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index 3d328e66c8..4c0f160f6f 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -56,7 +56,7 @@ LLSysWellChiclet::Params::Params() , max_displayed_count("max_displayed_count", 99) { button.name = "button"; - button.tab_stop = FALSE; + button.tab_stop = false; button.label = LLStringUtil::null; } @@ -114,7 +114,7 @@ boost::signals2::connection LLSysWellChiclet::setClickCallback( return mButton->setClickedCallback(cb); } -void LLSysWellChiclet::setToggleState(BOOL toggled) { +void LLSysWellChiclet::setToggleState(bool toggled) { mButton->setToggleState(toggled); } @@ -148,7 +148,7 @@ void LLSysWellChiclet::updateWidget(bool is_window_empty) } } // virtual -BOOL LLSysWellChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLSysWellChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask) { LLContextMenu* menu_avatar = mContextMenuHandle.get(); if(!menu_avatar) @@ -161,7 +161,7 @@ BOOL LLSysWellChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask) menu_avatar->show(x, y); LLMenuGL::showPopup(this, menu_avatar, x, y); } - return TRUE; + return true; } /************************************************************************/ @@ -284,11 +284,11 @@ boost::signals2::connection LLChiclet::setLeftButtonClickCallback( return setCommitCallback(cb); } -BOOL LLChiclet::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLChiclet::handleMouseDown(S32 x, S32 y, MASK mask) { onCommit(); childrenHandleMouseDown(x,y,mask); - return TRUE; + return true; } boost::signals2::connection LLChiclet::setChicletSizeChangedCallback( @@ -339,12 +339,12 @@ LLIMChiclet::~LLIMChiclet() } /* virtual*/ -BOOL LLIMChiclet::postBuild() +bool LLIMChiclet::postBuild() { mChicletButton = getChild<LLButton>("chiclet_button"); mChicletButton->setCommitCallback(boost::bind(&LLIMChiclet::onMouseDown, this)); mChicletButton->setDoubleClickCallback(boost::bind(&LLIMChiclet::onMouseDown, this)); - return TRUE; + return true; } void LLIMChiclet::enableCounterControl(bool enable) @@ -387,7 +387,7 @@ void LLIMChiclet::setToggleState(bool toggle) mChicletButton->setToggleState(toggle); } -BOOL LLIMChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLIMChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask) { auto menu = static_cast<LLMenuGL*>(mPopupMenuHandle.get()); if(!menu) @@ -403,7 +403,7 @@ BOOL LLIMChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask) LLMenuGL::showPopup(this, menu, x, y); } - return TRUE; + return true; } void LLIMChiclet::hidePopupMenu() @@ -411,7 +411,7 @@ void LLIMChiclet::hidePopupMenu() auto menu = mPopupMenuHandle.get(); if (menu) { - menu->setVisible(FALSE); + menu->setVisible(false); } } @@ -503,7 +503,7 @@ void LLChicletPanel::objectChicletCallback(const LLSD& data) } } -BOOL LLChicletPanel::postBuild() +bool LLChicletPanel::postBuild() { LLPanel::postBuild(); LLIMModel::instance().addNewMsgCallback(boost::bind(&LLChicletPanel::onMessageCountChanged, this, _1)); @@ -525,7 +525,7 @@ BOOL LLChicletPanel::postBuild() mRightScrollButton->setHeldDownCallback(boost::bind(&LLChicletPanel::onRightScrollHeldDown,this)); mRightScrollButton->setEnabled(false); - return TRUE; + return true; } void LLChicletPanel::onCurrentVoiceChannelChanged(const LLUUID& session_id) @@ -711,7 +711,7 @@ void LLChicletPanel::scrollToChiclet(const LLChiclet* chiclet) } } -void LLChicletPanel::reshape(S32 width, S32 height, BOOL called_from_parent ) +void LLChicletPanel::reshape(S32 width, S32 height, bool called_from_parent ) { LLPanel::reshape(width,height,called_from_parent); @@ -999,7 +999,7 @@ boost::signals2::connection LLChicletPanel::setChicletClickedCallback( return setCommitCallback(cb); } -BOOL LLChicletPanel::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLChicletPanel::handleScrollWheel(S32 x, S32 y, S32 clicks) { if(clicks > 0) { @@ -1009,7 +1009,7 @@ BOOL LLChicletPanel::handleScrollWheel(S32 x, S32 y, S32 clicks) { scrollLeft(); } - return TRUE; + return true; } bool LLChicletPanel::isAnyIMFloaterDoked() diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h index 39b5e01d80..ce8968253b 100644 --- a/indra/newview/llchiclet.h +++ b/indra/newview/llchiclet.h @@ -104,8 +104,8 @@ public: { Params() { - changeDefault(draw_tooltip, FALSE); - changeDefault(mouse_opaque, FALSE); + changeDefault(draw_tooltip, false); + changeDefault(mouse_opaque, false); changeDefault(default_icon_name, "Generic_Person"); }; }; @@ -214,7 +214,7 @@ protected: /** * Notifies subscribers about click on chiclet. */ - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); /** * Notifies subscribers about chiclet size changed event. @@ -257,7 +257,7 @@ public: /** * It is used for default setting up of chicklet:click handler, etc. */ - BOOL postBuild(); + bool postBuild(); /** * Sets IM session name. This name will be displayed in chiclet tooltip. @@ -303,7 +303,7 @@ public: /** * Displays popup menu. */ - virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleRightMouseDown(S32 x, S32 y, MASK mask); void hidePopupMenu(); @@ -485,7 +485,7 @@ public: /*virtual*/ ~LLSysWellChiclet(); - void setToggleState(BOOL toggled); + void setToggleState(bool toggled); void setNewMessagesState(bool new_messages); //this method should change a widget according to state of the SysWellWindow @@ -507,7 +507,7 @@ protected: /** * Displays menu. */ - virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleRightMouseDown(S32 x, S32 y, MASK mask); virtual void createMenu() = 0; @@ -628,7 +628,7 @@ public: /** * Returns number of hosted chiclets. */ - S32 getChicletCount() {return mChicletList.size();}; + S32 getChicletCount() { return static_cast<S32>(mChicletList.size()); } /** * Returns index of chiclet in list. @@ -663,7 +663,7 @@ public: boost::signals2::connection setChicletClickedCallback( const commit_callback_t& cb); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /** * Handler for the Voice Client's signal. Finds a corresponding chiclet and toggles its SpeakerControl @@ -673,7 +673,7 @@ public: /** * Reshapes controls and rearranges chiclets if needed. */ - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE ); + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true ); /*virtual*/ void draw(); @@ -778,7 +778,7 @@ protected: /** * Callback for mouse wheel scrolled, calls scrollRight() or scrollLeft() */ - BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); + bool handleScrollWheel(S32 x, S32 y, S32 clicks); /** * Notifies subscribers about click on chiclet. @@ -854,7 +854,7 @@ T* LLChicletPanel::createChiclet(const LLUUID& session_id, S32 index) template<class T> T* LLChicletPanel::createChiclet(const LLUUID& session_id) { - return createChiclet<T>(session_id, mChicletList.size()); + return createChiclet<T>(session_id, static_cast<S32>(mChicletList.size())); } template<class T> diff --git a/indra/newview/llchicletbar.cpp b/indra/newview/llchicletbar.cpp index 442176fdf5..bef96d0f11 100644 --- a/indra/newview/llchicletbar.cpp +++ b/indra/newview/llchicletbar.cpp @@ -45,7 +45,7 @@ LLChicletBar::LLChicletBar() buildFromFile("panel_chiclet_bar.xml"); } -BOOL LLChicletBar::postBuild() +bool LLChicletBar::postBuild() { mToolbarStack = getChild<LLLayoutStack>("toolbar_stack"); mChicletPanel = getChild<LLChicletPanel>("chiclet_list"); @@ -55,7 +55,7 @@ BOOL LLChicletBar::postBuild() LLPanelTopInfoBar::instance().setResizeCallback(boost::bind(&LLChicletBar::fitWithTopInfoBar, this)); LLPanelTopInfoBar::instance().setVisibleCallback(boost::bind(&LLChicletBar::fitWithTopInfoBar, this)); - return TRUE; + return true; } void LLChicletBar::showWellButton(const std::string& well_name, bool visible) @@ -78,7 +78,7 @@ void LLChicletBar::log(LLView* panel, const std::string& descr) << LL_ENDL; } -void LLChicletBar::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLChicletBar::reshape(S32 width, S32 height, bool called_from_parent) { static S32 debug_calling_number = 0; LL_DEBUGS() << "**************************************** " << ++debug_calling_number << LL_ENDL; diff --git a/indra/newview/llchicletbar.h b/indra/newview/llchicletbar.h index 748245cad6..53abebc7ab 100644 --- a/indra/newview/llchicletbar.h +++ b/indra/newview/llchicletbar.h @@ -43,11 +43,11 @@ class LLChicletBar public: - BOOL postBuild() override; + bool postBuild() override; LLChicletPanel* getChicletPanel() { return mChicletPanel; } - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent) override; + void reshape(S32 width, S32 height, bool called_from_parent) override; /** diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp index c43864d85f..47803edc73 100644 --- a/indra/newview/llcofwearables.cpp +++ b/indra/newview/llcofwearables.cpp @@ -69,7 +69,7 @@ protected: // Hide the "Create new <WEARABLE_TYPE>" if it's irrelevant. if (w_type == LLWearableType::WT_NONE) { - menu_item->setVisible(FALSE); + menu_item->setVisible(false); return; } @@ -307,7 +307,7 @@ LLCOFWearables::~LLCOFWearables() } // virtual -BOOL LLCOFWearables::postBuild() +bool LLCOFWearables::postBuild() { mAttachments = getChild<LLFlatListView>("list_attachments"); mClothing = getChild<LLFlatListView>("list_clothing"); @@ -618,13 +618,13 @@ void LLCOFWearables::populateClothingList(LLAppearanceMgr::wearables_by_type_t& for (U32 type = LLWearableType::WT_SHIRT; type < LLWearableType::WT_COUNT; ++type) { - U32 size = clothing_by_type[type].size(); + auto size = clothing_by_type[type].size(); if (!size) continue; LLAppearanceMgr::sortItemsByActualDescription(clothing_by_type[type]); //clothing items are displayed in reverse order, from furthest ones to closest ones (relatively to the body) - for (U32 i = size; i != 0; --i) + for (size_t i = size; i != 0; --i) { LLViewerInventoryItem* item = clothing_by_type[type][i-1]; @@ -647,8 +647,8 @@ void LLCOFWearables::addClothingTypesDummies(const LLAppearanceMgr::wearables_by for (U32 type = LLWearableType::WT_SHIRT; type < LLWearableType::WT_COUNT; type++) { - U32 size = clothing_by_type[type].size(); - if (size) continue; + if (clothing_by_type[type].empty()) + continue; LLWearableType::EType w_type = static_cast<LLWearableType::EType>(type); LLPanelInventoryListItemBase* item_panel = LLPanelDummyClothingListItem::create(w_type); diff --git a/indra/newview/llcofwearables.h b/indra/newview/llcofwearables.h index 7a5ddbb16d..6f0e97a98b 100644 --- a/indra/newview/llcofwearables.h +++ b/indra/newview/llcofwearables.h @@ -68,7 +68,7 @@ public: LLCOFWearables(); virtual ~LLCOFWearables(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); LLUUID getSelectedUUID(); bool getSelectedUUIDs(uuid_vec_t& selected_ids); diff --git a/indra/newview/llcolorswatch.cpp b/indra/newview/llcolorswatch.cpp index 43e3d0c642..97d2345778 100644 --- a/indra/newview/llcolorswatch.cpp +++ b/indra/newview/llcolorswatch.cpp @@ -59,7 +59,7 @@ LLColorSwatchCtrl::Params::Params() LLColorSwatchCtrl::LLColorSwatchCtrl(const Params& p) : LLUICtrl(p), - mValid( TRUE ), + mValid( true ), mColor(p.color()), mCanApplyImmediately(p.can_apply_immediately), mAlphaGradientImage(p.alpha_background_image), @@ -108,22 +108,22 @@ LLColorSwatchCtrl::~LLColorSwatchCtrl () } } -BOOL LLColorSwatchCtrl::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLColorSwatchCtrl::handleDoubleClick(S32 x, S32 y, MASK mask) { return handleMouseDown(x, y, mask); } -BOOL LLColorSwatchCtrl::handleHover(S32 x, S32 y, MASK mask) +bool LLColorSwatchCtrl::handleHover(S32 x, S32 y, MASK mask) { getWindow()->setCursor(UI_CURSOR_HAND); - return TRUE; + return true; } -BOOL LLColorSwatchCtrl::handleUnicodeCharHere(llwchar uni_char) +bool LLColorSwatchCtrl::handleUnicodeCharHere(llwchar uni_char) { if( ' ' == uni_char ) { - showPicker(TRUE); + showPicker(true); } return LLUICtrl::handleUnicodeCharHere(uni_char); } @@ -139,7 +139,7 @@ void LLColorSwatchCtrl::setOriginal(const LLColor4& color) } } -void LLColorSwatchCtrl::set(const LLColor4& color, BOOL update_picker, BOOL from_event) +void LLColorSwatchCtrl::set(const LLColor4& color, bool update_picker, bool from_event) { mColor = color; LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)mPickerHandle.get(); @@ -158,17 +158,17 @@ void LLColorSwatchCtrl::setLabel(const std::string& label) mCaption->setText(label); } -BOOL LLColorSwatchCtrl::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLColorSwatchCtrl::handleMouseDown(S32 x, S32 y, MASK mask) { // Route future Mouse messages here preemptively. (Release on mouse up.) // No handler is needed for capture lost since this object has no state that depends on it. gFocusMgr.setMouseCapture( this ); - return TRUE; + return true; } -BOOL LLColorSwatchCtrl::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLColorSwatchCtrl::handleMouseUp(S32 x, S32 y, MASK mask) { // We only handle the click if the click both started and ended within us if( hasMouseCapture() ) @@ -184,13 +184,13 @@ BOOL LLColorSwatchCtrl::handleMouseUp(S32 x, S32 y, MASK mask) // Focus the widget now in order to return the focus // after the color picker is closed. - setFocus(TRUE); + setFocus(true); - showPicker(FALSE); + showPicker(false); } } - return TRUE; + return true; } // assumes GL state is set for 2D @@ -202,7 +202,7 @@ void LLColorSwatchCtrl::draw() mBorder->setKeyboardFocusHighlight(hasFocus()); // Draw border LLRect border( 0, getRect().getHeight(), getRect().getWidth(), mLabelHeight ); - gl_rect_2d( border, mBorderColor.get(), FALSE ); + gl_rect_2d( border, mBorderColor.get(), false ); LLRect interior = border; interior.stretch( -1 ); @@ -217,7 +217,7 @@ void LLColorSwatchCtrl::draw() } // Draw the color swatch - gl_rect_2d(interior, mColor % alpha, TRUE); + gl_rect_2d(interior, mColor % alpha, true); if (!mColor.isOpaque()) { @@ -244,7 +244,7 @@ void LLColorSwatchCtrl::draw() else { // Draw grey and an X - gl_rect_2d(interior, LLColor4::grey % alpha, TRUE); + gl_rect_2d(interior, LLColor4::grey % alpha, true); gl_draw_x(interior, LLColor4::black % alpha); } @@ -253,7 +253,7 @@ void LLColorSwatchCtrl::draw() LLUICtrl::draw(); } -void LLColorSwatchCtrl::setEnabled( BOOL enabled ) +void LLColorSwatchCtrl::setEnabled( bool enabled ) { mCaption->setEnabled( enabled ); LLView::setEnabled( enabled ); @@ -272,7 +272,7 @@ void LLColorSwatchCtrl::setEnabled( BOOL enabled ) void LLColorSwatchCtrl::setValue(const LLSD& value) { - set(LLColor4(value), TRUE, TRUE); + set(LLColor4(value), true, true); } ////////////////////////////////////////////////////////////////////////////// @@ -316,7 +316,7 @@ void LLColorSwatchCtrl::onColorChanged ( void* data, EColorPickOp pick_op ) { // both select and cancel close LLFloaterColorPicker // but COLOR_CHANGE does not - subject->setFocus(TRUE); + subject->setFocus(true); } } } @@ -337,7 +337,7 @@ void LLColorSwatchCtrl::closeFloaterColorPicker() mPickerHandle.markDead(); } -void LLColorSwatchCtrl::setValid(BOOL valid ) +void LLColorSwatchCtrl::setValid(bool valid ) { mValid = valid; @@ -348,7 +348,7 @@ void LLColorSwatchCtrl::setValid(BOOL valid ) } } -void LLColorSwatchCtrl::showPicker(BOOL take_focus) +void LLColorSwatchCtrl::showPicker(bool take_focus) { LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)mPickerHandle.get(); if (!pickerp) @@ -370,7 +370,7 @@ void LLColorSwatchCtrl::showPicker(BOOL take_focus) if (take_focus) { - pickerp->setFocus(TRUE); + pickerp->setFocus(true); } } diff --git a/indra/newview/llcolorswatch.h b/indra/newview/llcolorswatch.h index 81cf04e7b9..2ef715d648 100644 --- a/indra/newview/llcolorswatch.h +++ b/indra/newview/llcolorswatch.h @@ -76,26 +76,26 @@ public: /*virtual*/ LLSD getValue() const { return mColor.getValue(); } const LLColor4& get() { return mColor; } - void set(const LLColor4& color, BOOL update_picker = FALSE, BOOL from_event = FALSE); + void set(const LLColor4& color, bool update_picker = false, bool from_event = false); void setOriginal(const LLColor4& color); - void setValid(BOOL valid); + void setValid(bool valid); void setLabel(const std::string& label); void setLabelWidth(S32 label_width) {mLabelWidth =label_width;} - void setCanApplyImmediately(BOOL apply) { mCanApplyImmediately = apply; } + void setCanApplyImmediately(bool apply) { mCanApplyImmediately = apply; } void setOnCancelCallback(commit_callback_t cb) { mOnCancelCallback = cb; } void setOnSelectCallback(commit_callback_t cb) { mOnSelectCallback = cb; } void setPreviewCallback(commit_callback_t cb) { mPreviewCallback = cb; } void setFallbackImage(LLPointer<LLUIImage> image) { mFallbackImage = image; } - void showPicker(BOOL take_focus); + void showPicker(bool take_focus); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleDoubleClick(S32 x,S32 y,MASK mask); - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleUnicodeCharHere(llwchar uni_char); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleDoubleClick(S32 x,S32 y,MASK mask); + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleUnicodeCharHere(llwchar uni_char); /*virtual*/ void draw(); - /*virtual*/ void setEnabled( BOOL enabled ); + /*virtual*/ void setEnabled( bool enabled ); static void onColorChanged ( void* data, EColorPickOp pick_op = COLOR_CHANGE ); void closeFloaterColorPicker(); diff --git a/indra/newview/llcommandlineparser.cpp b/indra/newview/llcommandlineparser.cpp index 2ada35aa60..f301af9511 100644 --- a/indra/newview/llcommandlineparser.cpp +++ b/indra/newview/llcommandlineparser.cpp @@ -378,8 +378,8 @@ bool LLCommandLineParser::parseCommandLineString(const std::string& str) if (!str.empty()) { bool add_last_c = true; - S32 last_c_pos = str.size() - 1; //don't get out of bounds on pos+1, last char will be processed separately - for (S32 pos = 0; pos < last_c_pos; ++pos) + auto last_c_pos = str.size() - 1; //don't get out of bounds on pos+1, last char will be processed separately + for (size_t pos = 0; pos < last_c_pos; ++pos) { cmd_line_string.append(&str[pos], 1); if (str[pos] == '\\') @@ -571,8 +571,8 @@ void setControlValueCB(const LLCommandLineParser::token_vector_t& value, std::string token(onevalue(option, value)); // There's a token. check the string for true/false/1/0 etc. - BOOL result = false; - BOOL gotSet = LLStringUtil::convertToBOOL(token, result); + bool result = false; + bool gotSet = LLStringUtil::convertToBOOL(token, result); if (gotSet) { ctrl->setValue(LLSD(result), false); diff --git a/indra/newview/llcommunicationchannel.cpp b/indra/newview/llcommunicationchannel.cpp index 074d60d879..810b282722 100644 --- a/indra/newview/llcommunicationchannel.cpp +++ b/indra/newview/llcommunicationchannel.cpp @@ -54,7 +54,7 @@ bool LLCommunicationChannel::filterByDoNotDisturbStatus(LLNotificationPtr) S32 LLCommunicationChannel::getHistorySize() const { - return mHistory.size(); + return static_cast<S32>(mHistory.size()); } LLCommunicationChannel::history_list_t::const_iterator LLCommunicationChannel::beginHistory() const diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp index 0006a48de5..552ea75559 100644 --- a/indra/newview/llcompilequeue.cpp +++ b/indra/newview/llcompilequeue.cpp @@ -195,12 +195,12 @@ LLFloaterScriptQueue::~LLFloaterScriptQueue() { } -BOOL LLFloaterScriptQueue::postBuild() +bool LLFloaterScriptQueue::postBuild() { childSetAction("close",onCloseBtn,this); - getChildView("close")->setEnabled(FALSE); + getChildView("close")->setEnabled(false); setVisible(true); - return TRUE; + return true; } // static @@ -216,7 +216,7 @@ void LLFloaterScriptQueue::addObject(const LLUUID& id, std::string name) mObjectList.push_back(obj); } -BOOL LLFloaterScriptQueue::start() +bool LLFloaterScriptQueue::start() { std::string buffer; @@ -243,7 +243,7 @@ void LLFloaterScriptQueue::addStringMessage(const std::string &message) } -BOOL LLFloaterScriptQueue::isDone() const +bool LLFloaterScriptQueue::isDone() const { return (mCurrentObjectID.isNull() && (mObjectList.size() == 0)); } @@ -271,7 +271,7 @@ void LLFloaterCompileQueue::experienceIdsReceived( const LLSD& content ) } } -BOOL LLFloaterCompileQueue::hasExperience( const LLUUID& id ) const +bool LLFloaterCompileQueue::hasExperience( const LLUUID& id ) const { return mExperienceIds.find(id) != mExperienceIds.end(); } @@ -536,7 +536,7 @@ bool LLFloaterCompileQueue::startQueue() LLCoreHttpUtil::HttpCoroutineAdapter::callbackHttpGet(lookup_url, success, failure); - return TRUE; + return true; } } @@ -637,7 +637,7 @@ bool LLFloaterRunQueue::runObjectScripts(LLHandle<LLFloaterScriptQueue> hfloater msg->nextBlockFast(_PREHASH_Script); msg->addUUIDFast(_PREHASH_ObjectID, object->getID()); msg->addUUIDFast(_PREHASH_ItemID, inventory->getUUID()); - msg->addBOOLFast(_PREHASH_Running, TRUE); + msg->addBOOLFast(_PREHASH_Running, true); msg->sendReliable(object->getRegion()->getHost()); return true; @@ -694,7 +694,7 @@ bool LLFloaterNotRunQueue::stopObjectScripts(LLHandle<LLFloaterScriptQueue> hflo msg->nextBlockFast(_PREHASH_Script); msg->addUUIDFast(_PREHASH_ObjectID, object->getID()); msg->addUUIDFast(_PREHASH_ItemID, inventory->getUUID()); - msg->addBOOLFast(_PREHASH_Running, FALSE); + msg->addBOOLFast(_PREHASH_Running, false); msg->sendReliable(object->getRegion()->getHost()); return true; @@ -815,7 +815,7 @@ void LLFloaterScriptQueue::objectScriptProcessingQueueCoro(std::string action, L } floater->addStringMessage("Done"); - floater->getChildView("close")->setEnabled(TRUE); + floater->getChildView("close")->setEnabled(true); } catch (LLCheckedHandleBase::Stale &) { diff --git a/indra/newview/llcompilequeue.h b/indra/newview/llcompilequeue.h index ba5e27d75a..951d4800e8 100644 --- a/indra/newview/llcompilequeue.h +++ b/indra/newview/llcompilequeue.h @@ -53,15 +53,15 @@ public: LLFloaterScriptQueue(const LLSD& key); virtual ~LLFloaterScriptQueue(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); void setMono(bool mono) { mMono = mono; } // addObject() accepts an object id. void addObject(const LLUUID& id, std::string name); - // start() returns TRUE if the queue has started, otherwise FALSE. - BOOL start(); + // start() returns true if the queue has started, otherwise false. + bool start(); void addProcessingMessage(const std::string &message, const LLSD &args); void addStringMessage(const std::string &message); @@ -72,7 +72,7 @@ protected: static void onCloseBtn(void* user_data); // returns true if this is done - BOOL isDone() const; + bool isDone() const; virtual bool startQueue() = 0; @@ -123,7 +123,7 @@ class LLFloaterCompileQueue : public LLFloaterScriptQueue public: void experienceIdsReceived( const LLSD& content ); - BOOL hasExperience(const LLUUID& id)const; + bool hasExperience(const LLUUID& id)const; protected: LLFloaterCompileQueue(const LLSD& key); diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index b7317272a1..716333b217 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -51,7 +51,7 @@ LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewer mScaleConstraintFixup(1.0), mRegionChanged(false) { - mIsDummy = TRUE; + mIsDummy = true; mIsControlAvatar = true; mEnableDefaultMotions = false; } @@ -292,7 +292,7 @@ void LLControlAvatar::updateVolumeGeom() return; if (mRootVolp->mDrawable->isActive()) { - mRootVolp->mDrawable->makeStatic(FALSE); + mRootVolp->mDrawable->makeStatic(false); } mRootVolp->mDrawable->makeActive(); gPipeline.markMoved(mRootVolp->mDrawable); @@ -424,11 +424,11 @@ void LLControlAvatar::updateDebugText() S32 total_linkset_count = 0; if (mRootVolp) { - total_linkset_count = 1 + mRootVolp->getChildren().size(); + total_linkset_count = 1 + static_cast<S32>(mRootVolp->getChildren().size()); } std::vector<LLVOVolume*> volumes; getAnimatedVolumes(volumes); - S32 animated_volume_count = volumes.size(); + S32 animated_volume_count = static_cast<S32>(volumes.size()); std::string active_string; std::string type_string; std::string lod_string; @@ -616,9 +616,9 @@ void LLControlAvatar::updateAnimations() // virtual LLViewerObject* LLControlAvatar::lineSegmentIntersectRiggedAttachments(const LLVector4a& start, const LLVector4a& end, S32 face, - BOOL pick_transparent, - BOOL pick_rigged, - BOOL pick_unselectable, + bool pick_transparent, + bool pick_rigged, + bool pick_unselectable, S32* face_hit, LLVector4a* intersection, LLVector2* tex_coord, @@ -695,7 +695,7 @@ bool LLControlAvatar::shouldRenderRigged() const } // virtual -BOOL LLControlAvatar::isImpostor() +bool LLControlAvatar::isImpostor() { // Attached animated objects should match state of their attached av. LLVOAvatar *attached_av = getAttachedAvatar(); diff --git a/indra/newview/llcontrolavatar.h b/indra/newview/llcontrolavatar.h index ca98659ecd..0d94fe08ee 100644 --- a/indra/newview/llcontrolavatar.h +++ b/indra/newview/llcontrolavatar.h @@ -69,9 +69,9 @@ public: virtual LLViewerObject* lineSegmentIntersectRiggedAttachments( const LLVector4a& start, const LLVector4a& end, S32 face = -1, // which face to check, -1 = ALL_SIDES - BOOL pick_transparent = FALSE, - BOOL pick_rigged = FALSE, - BOOL pick_unselectable = TRUE, + bool pick_transparent = false, + bool pick_rigged = false, + bool pick_unselectable = true, S32* face_hit = NULL, // which face was hit LLVector4a* intersection = NULL, // return the intersection point LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point @@ -84,7 +84,8 @@ public: virtual bool shouldRenderRigged() const; - virtual BOOL isImpostor(); + virtual bool isImpostor(); + virtual bool isBuddy() const { return false; } bool mPlaying; diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp index dd4ca845a0..ed563cbec9 100644 --- a/indra/newview/llconversationlog.cpp +++ b/indra/newview/llconversationlog.cpp @@ -215,7 +215,7 @@ void LLConversationLog::enableLogging(S32 log_mode) notifyObservers(); } -void LLConversationLog::logConversation(const LLUUID& session_id, BOOL has_offline_msg) +void LLConversationLog::logConversation(const LLUUID& session_id, bool has_offline_msg) { const LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(session_id); LLConversation* conversation = findConversation(session); @@ -272,7 +272,7 @@ void LLConversationLog::updateConversationName(const LLIMModel::LLIMSession* ses } } -void LLConversationLog::updateOfflineIMs(const LLIMModel::LLIMSession* session, BOOL new_messages) +void LLConversationLog::updateOfflineIMs(const LLIMModel::LLIMSession* session, bool new_messages) { if (!session) { @@ -354,7 +354,7 @@ void LLConversationLog::removeObserver(LLConversationLogObserver* observer) mObservers.erase(observer); } -void LLConversationLog::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, BOOL has_offline_msg) +void LLConversationLog::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, bool has_offline_msg) { logConversation(session_id, has_offline_msg); } diff --git a/indra/newview/llconversationlog.h b/indra/newview/llconversationlog.h index 5d6b57233f..b3a5be321e 100644 --- a/indra/newview/llconversationlog.h +++ b/indra/newview/llconversationlog.h @@ -125,7 +125,7 @@ public: void removeObserver(LLConversationLogObserver* observer); // LLIMSessionObserver triggers - virtual void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, BOOL has_offline_msg) override; + virtual void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, bool has_offline_msg) override; virtual void sessionActivated(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) override {}; // Stub virtual void sessionRemoved(const LLUUID& session_id) override{} // Stub virtual void sessionVoiceOrIMStarted(const LLUUID& session_id) override{}; // Stub @@ -179,7 +179,7 @@ private: /** * adds conversation to the conversation list and notifies observers */ - void logConversation(const LLUUID& session_id, BOOL has_offline_msg); + void logConversation(const LLUUID& session_id, bool has_offline_msg); void notifyParticularConversationObservers(const LLUUID& session_id, U32 mask); @@ -191,7 +191,7 @@ private: void createConversation(const LLIMModel::LLIMSession* session); void updateConversationTimestamp(LLConversation* conversation); void updateConversationName(const LLIMModel::LLIMSession* session, const std::string& name); - void updateOfflineIMs(const LLIMModel::LLIMSession* session, BOOL new_messages); + void updateOfflineIMs(const LLIMModel::LLIMSession* session, bool new_messages); diff --git a/indra/newview/llconversationloglist.cpp b/indra/newview/llconversationloglist.cpp index 838062795b..65863f0a5e 100644 --- a/indra/newview/llconversationloglist.cpp +++ b/indra/newview/llconversationloglist.cpp @@ -86,16 +86,15 @@ void LLConversationLogList::draw() LLFlatListViewEx::draw(); } -BOOL LLConversationLogList::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLConversationLogList::handleRightMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = LLUICtrl::handleRightMouseDown(x, y, mask); + bool handled = LLUICtrl::handleRightMouseDown(x, y, mask); LLToggleableMenu* context_menu = mContextMenu.get(); + if (context_menu && size()) { context_menu->buildDrawLabels(); - if (context_menu && size()) - context_menu->updateParent(LLMenuGL::sMenuContainer); - + context_menu->updateParent(LLMenuGL::sMenuContainer); LLMenuGL::showPopup(this, context_menu, x, y); } @@ -370,7 +369,7 @@ bool LLConversationLogList::isActionEnabled(const LLSD& userdata) bool is_p2p = LLIMModel::LLIMSession::P2P_SESSION == stype; bool is_group = LLIMModel::LLIMSession::GROUP_SESSION == stype; - bool is_group_member = is_group && gAgent.isInGroup(selected_id, TRUE); + bool is_group_member = is_group && gAgent.isInGroup(selected_id, true); if ("can_im" == command_name) { diff --git a/indra/newview/llconversationloglist.h b/indra/newview/llconversationloglist.h index 6435527b0d..6372f6c9a3 100644 --- a/indra/newview/llconversationloglist.h +++ b/indra/newview/llconversationloglist.h @@ -59,7 +59,7 @@ public: virtual void draw(); - virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleRightMouseDown(S32 x, S32 y, MASK mask); LLToggleableMenu* getContextMenu() const { return mContextMenu.get(); } diff --git a/indra/newview/llconversationloglistitem.cpp b/indra/newview/llconversationloglistitem.cpp index 2c411ef0ef..20d5b0175b 100644 --- a/indra/newview/llconversationloglistitem.cpp +++ b/indra/newview/llconversationloglistitem.cpp @@ -62,7 +62,7 @@ LLConversationLogListItem::~LLConversationLogListItem() mIMFloaterShowedConnection.disconnect(); } -BOOL LLConversationLogListItem::postBuild() +bool LLConversationLogListItem::postBuild() { initIcons(); @@ -77,7 +77,7 @@ BOOL LLConversationLogListItem::postBuild() getChild<LLButton>("delete_btn")->setClickedCallback(boost::bind(&LLConversationLogListItem::onRemoveBtnClicked, this)); setDoubleClickCallback(boost::bind(&LLConversationLogListItem::onDoubleClick, this)); - return TRUE; + return true; } void LLConversationLogListItem::initIcons() @@ -88,14 +88,14 @@ void LLConversationLogListItem::initIcons() case LLIMModel::LLIMSession::ADHOC_SESSION: { LLAvatarIconCtrl* avatar_icon = getChild<LLAvatarIconCtrl>("avatar_icon"); - avatar_icon->setVisible(TRUE); + avatar_icon->setVisible(true); avatar_icon->setValue(mConversation->getParticipantID()); break; } case LLIMModel::LLIMSession::GROUP_SESSION: { LLGroupIconCtrl* group_icon = getChild<LLGroupIconCtrl>("group_icon"); - group_icon->setVisible(TRUE); + group_icon->setVisible(true); group_icon->setValue(mConversation->getSessionID()); break; } @@ -105,7 +105,7 @@ void LLConversationLogListItem::initIcons() if (mConversation->hasOfflineMessages()) { - getChild<LLIconCtrl>("unread_ims_icon")->setVisible(TRUE); + getChild<LLIconCtrl>("unread_ims_icon")->setVisible(true); } } @@ -150,7 +150,7 @@ void LLConversationLogListItem::onIMFloaterShown(const LLUUID& session_id) { if (mConversation->getSessionID() == session_id) { - getChild<LLIconCtrl>("unread_ims_icon")->setVisible(FALSE); + getChild<LLIconCtrl>("unread_ims_icon")->setVisible(false); } } diff --git a/indra/newview/llconversationloglistitem.h b/indra/newview/llconversationloglistitem.h index 9c13efc6cb..31436c5c24 100644 --- a/indra/newview/llconversationloglistitem.h +++ b/indra/newview/llconversationloglistitem.h @@ -53,7 +53,7 @@ public: virtual void setValue(const LLSD& value); - virtual BOOL postBuild(); + virtual bool postBuild(); void onIMFloaterShown(const LLUUID& session_id); void onRemoveBtnClicked(); diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index 3a3c26f955..c1e48c63a9 100644 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -79,23 +79,23 @@ public: virtual LLPointer<LLUIImage> getOpenIcon() const { return getIcon(); } virtual LLFontGL::StyleFlags getLabelStyle() const { return LLFontGL::NORMAL; } virtual std::string getLabelSuffix() const { return LLStringUtil::null; } - virtual BOOL isItemRenameable() const { return TRUE; } - virtual BOOL renameItem(const std::string& new_name) { mName = new_name; mNeedsRefresh = true; return TRUE; } - virtual BOOL isItemMovable( void ) const { return FALSE; } - virtual BOOL isItemRemovable(bool check_worn = true) const { return FALSE; } - virtual BOOL isItemInTrash( void) const { return FALSE; } - virtual BOOL removeItem() { return FALSE; } + virtual bool isItemRenameable() const { return true; } + virtual bool renameItem(const std::string& new_name) { mName = new_name; mNeedsRefresh = true; return true; } + virtual bool isItemMovable( void ) const { return false; } + virtual bool isItemRemovable(bool check_worn = true) const { return false; } + virtual bool isItemInTrash( void) const { return false; } + virtual bool removeItem() { return false; } virtual void removeBatch(std::vector<LLFolderViewModelItem*>& batch) { } virtual void move( LLFolderViewModelItem* parent_listener ) { } virtual bool isItemCopyable(bool can_copy_as_link = true) const { return false; } - virtual BOOL copyToClipboard() const { return FALSE; } - virtual BOOL cutToClipboard() { return FALSE; } - virtual BOOL isClipboardPasteable() const { return FALSE; } + virtual bool copyToClipboard() const { return false; } + virtual bool cutToClipboard() { return false; } + virtual bool isClipboardPasteable() const { return false; } virtual void pasteFromClipboard() { } virtual void pasteLinkFromClipboard() { } virtual void buildContextMenu(LLMenuGL& menu, U32 flags) { } - virtual BOOL isUpToDate() const { return TRUE; } - virtual bool hasChildren() const { return FALSE; } + virtual bool isUpToDate() const { return true; } + virtual bool hasChildren() const { return false; } virtual void addChild(LLFolderViewModelItem* child); virtual bool potentiallyVisible() { return true; } @@ -119,13 +119,13 @@ public: virtual const bool getDistanceToAgent(F64& distance) const { return false; } // This method will be called to determine if a drop can be - // performed, and will set drop to TRUE if a drop is + // performed, and will set drop to true if a drop is // requested. - // Returns TRUE if a drop is possible/happened, FALSE otherwise. - virtual BOOL dragOrDrop(MASK mask, BOOL drop, + // Returns true if a drop is possible/happened, false otherwise. + virtual bool dragOrDrop(MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, - std::string& tooltip_msg) { return FALSE; } + std::string& tooltip_msg) { return false; } // bool hasSameValues(std::string name, const LLUUID& uuid) { return ((name == mName) && (uuid == mUUID)); } bool hasSameValue(const LLUUID& uuid) { return (uuid == mUUID); } @@ -160,7 +160,7 @@ public: ~LLConversationItemSession(); /*virtual*/ bool hasChildren() const; - LLPointer<LLUIImage> getIcon() const { return NULL; } + LLPointer<LLUIImage> getIcon() const { return nullptr; } void setSessionID(const LLUUID& session_id) { mUUID = session_id; mNeedsRefresh = true; } void addParticipant(LLConversationItemParticipant* participant); void updateName(LLConversationItemParticipant* participant); diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index 117dab8d58..eac1ee2a3c 100644 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -206,7 +206,7 @@ bool LLConversationViewSession::isHighlightActive() return (mFlashStateOn ? (mFlashTimer->isFlashingInProgress() ? mFlashTimer->isCurrentlyHighlighted() : true) : mIsCurSelection); } -BOOL LLConversationViewSession::postBuild() +bool LLConversationViewSession::postBuild() { LLFolderViewItem::postBuild(); @@ -278,7 +278,7 @@ BOOL LLConversationViewSession::postBuild() refresh(); // requires vmi } - return TRUE; + return true; } void LLConversationViewSession::draw() @@ -286,7 +286,7 @@ void LLConversationViewSession::draw() getViewModelItem()->update(); const LLFolderViewItem::Params& default_params = LLUICtrlFactory::getDefaultParams<LLFolderViewItem>(); - const BOOL show_context = (getRoot() ? getRoot()->getShowSelectionContext() : FALSE); + const bool show_context = (getRoot() ? getRoot()->getShowSelectionContext() : false); // Indicate that flash can start (moot operation if already started, done or not flashing) startFlashing(); @@ -322,10 +322,10 @@ void LLConversationViewSession::draw() LLView::draw(); } -BOOL LLConversationViewSession::handleMouseDown( S32 x, S32 y, MASK mask ) +bool LLConversationViewSession::handleMouseDown( S32 x, S32 y, MASK mask ) { //Will try to select a child node and then itself (if a child was not selected) - BOOL result = LLFolderViewFolder::handleMouseDown(x, y, mask); + bool result = LLFolderViewFolder::handleMouseDown(x, y, mask); //This node (conversation) was selected and a child (participant) was not if(result && getRoot()) @@ -351,9 +351,9 @@ BOOL LLConversationViewSession::handleMouseDown( S32 x, S32 y, MASK mask ) return result; } -BOOL LLConversationViewSession::handleMouseUp( S32 x, S32 y, MASK mask ) +bool LLConversationViewSession::handleMouseUp( S32 x, S32 y, MASK mask ) { - BOOL result = LLFolderViewFolder::handleMouseUp(x, y, mask); + bool result = LLFolderViewFolder::handleMouseUp(x, y, mask); LLFloater* volume_floater = LLFloaterReg::findInstance("floater_voice_volume"); LLFloater* chat_volume_floater = LLFloaterReg::findInstance("chat_voice"); @@ -374,9 +374,9 @@ BOOL LLConversationViewSession::handleMouseUp( S32 x, S32 y, MASK mask ) return result; } -BOOL LLConversationViewSession::handleRightMouseDown( S32 x, S32 y, MASK mask ) +bool LLConversationViewSession::handleRightMouseDown( S32 x, S32 y, MASK mask ) { - BOOL result = LLFolderViewFolder::handleRightMouseDown(x, y, mask); + bool result = LLFolderViewFolder::handleRightMouseDown(x, y, mask); if(result) { @@ -446,7 +446,7 @@ void LLConversationViewSession::toggleCollapsedMode(bool is_collapsed) mItemPanel->translate(mCollapsedMode ? -h_pad : h_pad, 0); } -void LLConversationViewSession::setVisibleIfDetached(BOOL visible) +void LLConversationViewSession::setVisibleIfDetached(bool visible) { // Do this only if the conversation floater has been torn off (i.e. no multi floater host) and is not minimized // Note: minimized dockable floaters are brought to front hence unminimized when made visible and we don't want that here @@ -616,7 +616,7 @@ void LLConversationViewParticipant::initFromParams(const LLConversationViewParti addChild(outputMonitor); } -BOOL LLConversationViewParticipant::postBuild() +bool LLConversationViewParticipant::postBuild() { mAvatarIcon = getChild<LLAvatarIconCtrl>("avatar_icon"); @@ -640,7 +640,7 @@ BOOL LLConversationViewParticipant::postBuild() LLFolderViewItem::postBuild(); refresh(); } - return TRUE; + return true; } void LLConversationViewParticipant::draw() @@ -653,7 +653,7 @@ void LLConversationViewParticipant::draw() static LLUIColor sFocusOutlineColor = LLUIColorTable::instance().getColor("InventoryFocusOutlineColor", DEFAULT_WHITE); static LLUIColor sMouseOverColor = LLUIColorTable::instance().getColor("InventoryMouseOverColor", DEFAULT_WHITE); - const BOOL show_context = (getRoot() ? getRoot()->getShowSelectionContext() : FALSE); + const bool show_context = (getRoot() ? getRoot()->getShowSelectionContext() : false); const LLFontGL* font = getLabelFontForStyle(mLabelStyle); F32 right_x = 0; @@ -765,9 +765,9 @@ void LLConversationViewParticipant::onInfoBtnClick() LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", mUUID)); } -BOOL LLConversationViewParticipant::handleMouseDown( S32 x, S32 y, MASK mask ) +bool LLConversationViewParticipant::handleMouseDown( S32 x, S32 y, MASK mask ) { - BOOL result = LLFolderViewItem::handleMouseDown(x, y, mask); + bool result = LLFolderViewItem::handleMouseDown(x, y, mask); if(result && getRoot()) { diff --git a/indra/newview/llconversationview.h b/indra/newview/llconversationview.h index 5f3e4bfe64..8eb6392121 100644 --- a/indra/newview/llconversationview.h +++ b/indra/newview/llconversationview.h @@ -69,11 +69,11 @@ public: /*virtual*/ void destroyView(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void draw(); - /*virtual*/ BOOL handleMouseDown( S32 x, S32 y, MASK mask ); - /*virtual*/ BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); - /*virtual*/ BOOL handleMouseUp( S32 x, S32 y, MASK mask ); + /*virtual*/ bool handleMouseDown( S32 x, S32 y, MASK mask ); + /*virtual*/ bool handleRightMouseDown( S32 x, S32 y, MASK mask ); + /*virtual*/ bool handleMouseUp( S32 x, S32 y, MASK mask ); /*virtual*/ S32 arrange(S32* width, S32* height); @@ -83,7 +83,7 @@ public: void toggleCollapsedMode(bool is_collapsed); - void setVisibleIfDetached(BOOL visible); + void setVisibleIfDetached(bool visible); LLConversationViewParticipant* findParticipant(const LLUUID& participant_id); void showVoiceIndicator(bool visible); @@ -151,14 +151,14 @@ public: void onMouseLeave(S32 x, S32 y, MASK mask); /*virtual*/ S32 getLabelXPos(); - /*virtual*/ BOOL handleMouseDown( S32 x, S32 y, MASK mask ); + /*virtual*/ bool handleMouseDown( S32 x, S32 y, MASK mask ); void allowSpeakingIndicator(bool val); protected: friend class LLUICtrlFactory; LLConversationViewParticipant( const Params& p ); void initFromParams(const Params& params); - BOOL postBuild(); + bool postBuild(); /*virtual*/ void draw(); /*virtual*/ S32 arrange(S32* width, S32* height); diff --git a/indra/newview/llcurrencyuimanager.cpp b/indra/newview/llcurrencyuimanager.cpp index 6726b6a111..06c87343e2 100644 --- a/indra/newview/llcurrencyuimanager.cpp +++ b/indra/newview/llcurrencyuimanager.cpp @@ -413,8 +413,8 @@ void LLCurrencyUIManager::Impl::currencyKey(S32 value) //cannot just simply refresh the whole UI, as the edit field will // get reset and the cursor will change... - mPanel.getChildView("currency_est")->setVisible(FALSE); - mPanel.getChildView("getting_data")->setVisible(TRUE); + mPanel.getChildView("currency_est")->setVisible(false); + mPanel.getChildView("getting_data")->setVisible(true); } mCurrencyChanged = true; @@ -443,13 +443,13 @@ void LLCurrencyUIManager::Impl::updateUI() { if (mHidden) { - mPanel.getChildView("currency_action")->setVisible(FALSE); - mPanel.getChildView("currency_amt")->setVisible(FALSE); - mPanel.getChildView("currency_est")->setVisible(FALSE); + mPanel.getChildView("currency_action")->setVisible(false); + mPanel.getChildView("currency_amt")->setVisible(false); + mPanel.getChildView("currency_est")->setVisible(false); return; } - mPanel.getChildView("currency_action")->setVisible(TRUE); + mPanel.getChildView("currency_action")->setVisible(true); LLLineEditor* lindenAmount = mPanel.getChild<LLLineEditor>("currency_amt"); if (lindenAmount) @@ -483,7 +483,7 @@ void LLCurrencyUIManager::Impl::updateUI() ||mPanel.getChildView("currency_est")->getVisible() || mPanel.getChildView("error_web")->getVisible()) { - mPanel.getChildView("getting_data")->setVisible(FALSE); + mPanel.getChildView("getting_data")->setVisible(false); } } diff --git a/indra/newview/llcylinder.cpp b/indra/newview/llcylinder.cpp index 6e1fd41b87..c347d3e1be 100644 --- a/indra/newview/llcylinder.cpp +++ b/indra/newview/llcylinder.cpp @@ -48,7 +48,7 @@ void LLCone::render(S32 sides) gGL.begin(LLRender::TRIANGLE_FAN); gGL.vertex3f(0,0,0); - for (U32 i = 0; i < sides; i++) + for (S32 i = 0; i < sides; i++) { F32 a = (F32) i/sides * F_PI*2.f; F32 x = cosf(a)*0.5f; @@ -61,7 +61,7 @@ void LLCone::render(S32 sides) gGL.begin(LLRender::TRIANGLE_FAN); gGL.vertex3f(0.f, 0.f, 0.5f); - for (U32 i = 0; i < sides; i++) + for (S32 i = 0; i < sides; i++) { F32 a = (F32) i/sides * F_PI*2.f; F32 x = cosf(a)*0.5f; diff --git a/indra/newview/lldebugmessagebox.cpp b/indra/newview/lldebugmessagebox.cpp index 7d305fe261..91ea36706e 100644 --- a/indra/newview/lldebugmessagebox.cpp +++ b/indra/newview/lldebugmessagebox.cpp @@ -45,7 +45,7 @@ std::map<std::string, LLDebugVarMessageBox*> LLDebugVarMessageBox::sInstances; LLDebugVarMessageBox::LLDebugVarMessageBox(const std::string& title, EDebugVarType var_type, void *var) : LLFloater(LLSD()), - mVarType(var_type), mVarData(var), mAnimate(FALSE) + mVarType(var_type), mVarData(var), mAnimate(false) { setRect(LLRect(10,160,400,10)); diff --git a/indra/newview/lldebugmessagebox.h b/indra/newview/lldebugmessagebox.h index e95fe5a192..3160ee24b5 100644 --- a/indra/newview/lldebugmessagebox.h +++ b/indra/newview/lldebugmessagebox.h @@ -80,7 +80,7 @@ protected: LLButton* mAnimateButton; LLTextBox* mText; std::string mTitle; - BOOL mAnimate; + bool mAnimate; static std::map<std::string, LLDebugVarMessageBox*> sInstances; }; diff --git a/indra/newview/lldebugview.cpp b/indra/newview/lldebugview.cpp index 12b38458a2..b88d11886a 100644 --- a/indra/newview/lldebugview.cpp +++ b/indra/newview/lldebugview.cpp @@ -94,14 +94,14 @@ void LLDebugView::init() gSceneView = new LLSceneView(r); gSceneView->setFollowsTop(); gSceneView->setFollowsLeft(); - gSceneView->setVisible(FALSE); + gSceneView->setVisible(false); addChild(gSceneView); gSceneView->setRect(rect); gSceneMonitorView = new LLSceneMonitorView(r); gSceneMonitorView->setFollowsTop(); gSceneMonitorView->setFollowsLeft(); - gSceneMonitorView->setVisible(FALSE); + gSceneMonitorView->setVisible(false); addChild(gSceneMonitorView); gSceneMonitorView->setRect(rect); @@ -116,7 +116,7 @@ void LLDebugView::init() tvp.visible(false); gTextureView = LLUICtrlFactory::create<LLTextureView>(tvp); addChild(gTextureView); - //gTextureView->reshape(r.getWidth(), r.getHeight(), TRUE); + //gTextureView->reshape(r.getWidth(), r.getHeight(), true); } void LLDebugView::draw() diff --git a/indra/newview/lldebugview.h b/indra/newview/lldebugview.h index 0f6da06a6f..8fa2acc3c9 100644 --- a/indra/newview/lldebugview.h +++ b/indra/newview/lldebugview.h @@ -57,7 +57,7 @@ public: void init(); void draw(); - void setStatsVisible(BOOL visible); + void setStatsVisible(bool visible); LLFastTimerView* mFastTimerView; LLConsole* mDebugConsolep; diff --git a/indra/newview/lldensityctrl.cpp b/indra/newview/lldensityctrl.cpp deleted file mode 100644 index 3997227ef0..0000000000 --- a/indra/newview/lldensityctrl.cpp +++ /dev/null @@ -1,225 +0,0 @@ -/** -* @file lldensityctrl.cpp -* @brief Control for specifying density over a height range for sky settings. -* -* $LicenseInfo:firstyear=2011&license=viewerlgpl$ -* Second Life Viewer Source Code -* Copyright (C) 2011, 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 "llviewerprecompiledheaders.h" - -#include "lldensityctrl.h" - -#include "llslider.h" -#include "llsliderctrl.h" -#include "llsettingssky.h" - -static LLDefaultChildRegistry::Register<LLDensityCtrl> register_density_control("densityctrl"); - -const std::string LLDensityCtrl::DENSITY_RAYLEIGH("density_rayleigh"); -const std::string LLDensityCtrl::DENSITY_MIE("density_mie"); -const std::string LLDensityCtrl::DENSITY_ABSORPTION("density_absorption"); - -namespace -{ - const std::string FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL("level_exponential"); - const std::string FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL_SCALE("exponential_scale"); - const std::string FIELD_SKY_DENSITY_PROFILE_LINEAR("level_linear"); - const std::string FIELD_SKY_DENSITY_PROFILE_CONSTANT("level_constant"); - const std::string FIELD_SKY_DENSITY_MAX_ALTITUDE("max_altitude"); - const std::string FIELD_SKY_DENSITY_ANISO_FACTOR("aniso_factor"); - const std::string FIELD_SKY_DENSITY_ANISO_FACTOR_LABEL("aniso_factor_label"); -} - -const std::string& LLDensityCtrl::NameForDensityProfileType(DensityProfileType t) -{ - switch (t) - { - case Rayleigh: return DENSITY_RAYLEIGH; - case Mie: return DENSITY_MIE; - case Absorption: return DENSITY_ABSORPTION; - default: - break; - } - - llassert(false); - return DENSITY_RAYLEIGH; -} - -LLDensityCtrl::Params::Params() -: image_density_feedback("image_density_feedback") -, lbl_exponential("label_exponential") -, lbl_exponential_scale("label_exponential_scale") -, lbl_linear("label_linear") -, lbl_constant("label_constant") -, lbl_max_altitude("label_max_altitude") -, lbl_aniso_factor("label_aniso_factor") -, profile_type(LLDensityCtrl::Rayleigh) -{ -} - -LLDensityCtrl::LLDensityCtrl(const Params& params) -: mProfileType(params.profile_type) -, mImgDensityFeedback(params.image_density_feedback) -{ - -} - -LLSD LLDensityCtrl::getProfileConfig() -{ - LLSD config; - switch (mProfileType) - { - case Rayleigh: return mSkySettings->getRayleighConfigs(); - case Mie: return mSkySettings->getMieConfigs(); - case Absorption: return mSkySettings->getAbsorptionConfigs(); - default: - break; - } - llassert(false); - return config; -} - -BOOL LLDensityCtrl::postBuild() -{ - getChild<LLUICtrl>(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onExponentialChanged(); }); - getChild<LLUICtrl>(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL_SCALE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onExponentialScaleFactorChanged(); }); - getChild<LLUICtrl>(FIELD_SKY_DENSITY_PROFILE_LINEAR)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onLinearChanged(); }); - getChild<LLUICtrl>(FIELD_SKY_DENSITY_PROFILE_CONSTANT)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onConstantChanged(); }); - getChild<LLUICtrl>(FIELD_SKY_DENSITY_MAX_ALTITUDE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMaxAltitudeChanged(); }); - getChild<LLUICtrl>(FIELD_SKY_DENSITY_ANISO_FACTOR)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onAnisoFactorChanged(); }); - - if (mProfileType != Mie) - { - getChild<LLUICtrl>(FIELD_SKY_DENSITY_ANISO_FACTOR_LABEL)->setValue(false); - getChild<LLUICtrl>(FIELD_SKY_DENSITY_ANISO_FACTOR)->setVisible(false); - } - - return TRUE; -} - -void LLDensityCtrl::setEnabled(BOOL enabled) -{ - getChild<LLUICtrl>(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL)->setEnabled(enabled); - getChild<LLUICtrl>(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL_SCALE)->setEnabled(enabled); - getChild<LLUICtrl>(FIELD_SKY_DENSITY_PROFILE_LINEAR)->setEnabled(enabled); - getChild<LLUICtrl>(FIELD_SKY_DENSITY_PROFILE_CONSTANT)->setEnabled(enabled); - getChild<LLUICtrl>(FIELD_SKY_DENSITY_MAX_ALTITUDE)->setEnabled(enabled); - - if (mProfileType == Mie) - { - getChild<LLUICtrl>(FIELD_SKY_DENSITY_ANISO_FACTOR)->setEnabled(enabled); - } -} - -void LLDensityCtrl::refresh() -{ - if (!mSkySettings) - { - setAllChildrenEnabled(FALSE); - setEnabled(FALSE); - return; - } - - setEnabled(TRUE); - setAllChildrenEnabled(TRUE); - - LLSD config = getProfileConfig(); - - getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL)->setValue(config[LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM]); - getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL_SCALE)->setValue(config[LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR]); - getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_PROFILE_LINEAR)->setValue(config[LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM]); - getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_PROFILE_CONSTANT)->setValue(config[LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM]); - getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_MAX_ALTITUDE)->setValue(config[LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH]); - - if (mProfileType == Mie) - { - getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_ANISO_FACTOR)->setValue(config[LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR]); - } -} - -void LLDensityCtrl::updateProfile() -{ - F32 exponential_term = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL)->getValueF32(); - F32 exponential_scale = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL_SCALE)->getValueF32(); - F32 linear_term = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_PROFILE_LINEAR)->getValueF32(); - F32 constant_term = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_PROFILE_CONSTANT)->getValueF32(); - F32 max_alt = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_MAX_ALTITUDE)->getValueF32(); - F32 aniso_factor = 0.0f; - - if (mProfileType == Mie) - { - aniso_factor = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_ANISO_FACTOR)->getValueF32(); - } - - LLSD profile = LLSettingsSky::createSingleLayerDensityProfile(max_alt, exponential_term, exponential_scale, linear_term, constant_term, aniso_factor); - - switch (mProfileType) - { - case Rayleigh: mSkySettings->setRayleighConfigs(profile); break; - case Mie: mSkySettings->setMieConfigs(profile); break; - case Absorption: mSkySettings->setAbsorptionConfigs(profile); break; - default: - break; - } -} - -void LLDensityCtrl::onExponentialChanged() -{ - updateProfile(); - updatePreview(); -} - -void LLDensityCtrl::onExponentialScaleFactorChanged() -{ - updateProfile(); - updatePreview(); -} - -void LLDensityCtrl::onLinearChanged() -{ - updateProfile(); - updatePreview(); -} - -void LLDensityCtrl::onConstantChanged() -{ - updateProfile(); - updatePreview(); -} - -void LLDensityCtrl::onMaxAltitudeChanged() -{ - updateProfile(); - updatePreview(); -} - -void LLDensityCtrl::onAnisoFactorChanged() -{ - updateProfile(); -} - -void LLDensityCtrl::updatePreview() -{ - // AdvancedAtmospherics TODO - // Generate image according to current density profile -} - diff --git a/indra/newview/lldensityctrl.h b/indra/newview/lldensityctrl.h deleted file mode 100644 index 1bc0f0ef1a..0000000000 --- a/indra/newview/lldensityctrl.h +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @file lldensityctrl.h -* @brief Control for specifying density over a height range for sky settings. -* -* $LicenseInfo:firstyear=2011&license=viewerlgpl$ -* Second Life Viewer Source Code -* Copyright (C) 2011, 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 LLDENSITY_CTRL_H -#define LLDENSITY_CTRL_H - -#include "lluictrl.h" -#include "llsettingssky.h" -#include "lltextbox.h" -#include "llsliderctrl.h" - -class LLDensityCtrl : public LLUICtrl -{ -public: - static const std::string DENSITY_RAYLEIGH; - static const std::string DENSITY_MIE; - static const std::string DENSITY_ABSORPTION; - - // Type of density profile this tab is updating - enum DensityProfileType - { - Rayleigh, - Mie, - Absorption - }; - - static const std::string& NameForDensityProfileType(DensityProfileType t); - - struct Params : public LLInitParam::Block<Params, LLUICtrl::Params> - { - Optional<LLTextBox::Params> lbl_exponential, - lbl_exponential_scale, - lbl_linear, - lbl_constant, - lbl_max_altitude, - lbl_aniso_factor; - - Optional<LLSliderCtrl::Params> exponential_slider, - exponential_scale_slider, - linear_slider, - constant_slider, - aniso_factor_slider; - - Optional<LLUIImage*> image_density_feedback; - - DensityProfileType profile_type; - Params(); - }; - - virtual BOOL postBuild() override; - virtual void setEnabled(BOOL enabled) override; - - void setProfileType(DensityProfileType t) { mProfileType = t; } - - void refresh(); - void updateProfile(); - - LLSettingsSky::ptr_t getSky() const { return mSkySettings; } - void setSky(const LLSettingsSky::ptr_t &sky) { mSkySettings = sky; refresh(); } - -protected: - friend class LLUICtrlFactory; - LLDensityCtrl(const Params&); - - LLSD getProfileConfig(); - void updatePreview(); - -private: - void onExponentialChanged(); - void onExponentialScaleFactorChanged(); - void onLinearChanged(); - void onConstantChanged(); - void onMaxAltitudeChanged(); - void onAnisoFactorChanged(); - - DensityProfileType mProfileType = Rayleigh; - LLUIImage* mImgDensityFeedback = nullptr; - LLSettingsSky::ptr_t mSkySettings; -}; - -#endif LLDENSITY_CTRL_H diff --git a/indra/newview/lldirpicker.cpp b/indra/newview/lldirpicker.cpp index a228cd7159..defbbdec25 100644 --- a/indra/newview/lldirpicker.cpp +++ b/indra/newview/lldirpicker.cpp @@ -45,11 +45,6 @@ #include "FL/Fl.H" #include "FL/Fl_Native_File_Chooser.H" #endif -// -// Globals -// - -LLDirPicker LLDirPicker::sInstance; #if LL_WINDOWS #include <shlobj.h> @@ -79,63 +74,90 @@ bool LLDirPicker::check_local_file_access_enabled() LLDirPicker::LLDirPicker() : mFileName(NULL), - mLocked(false) + mLocked(false), + pDialog(NULL) { - bi.hwndOwner = NULL; - bi.pidlRoot = NULL; - bi.pszDisplayName = NULL; - bi.lpszTitle = NULL; - bi.ulFlags = BIF_USENEWUI; - bi.lpfn = NULL; - bi.lParam = NULL; - bi.iImage = 0; } LLDirPicker::~LLDirPicker() { - // nothing + mEventListener.disconnect(); } -BOOL LLDirPicker::getDir(std::string* filename, bool blocking) +void LLDirPicker::reset() { - if( mLocked ) + if (pDialog) { - return FALSE; + IFileDialog* p_file_dialog = (IFileDialog*)pDialog; + p_file_dialog->Close(S_FALSE); + pDialog = NULL; } +} - // if local file browsing is turned off, return without opening dialog - if ( check_local_file_access_enabled() == false ) +bool LLDirPicker::getDir(std::string* filename, bool blocking) +{ + if (mLocked) { - return FALSE; + return false; } - BOOL success = FALSE; + // if local file browsing is turned off, return without opening dialog + if (!check_local_file_access_enabled()) + { + return false; + } + bool success = false; if (blocking) { // Modal, so pause agent send_agent_pause(); } - - bi.hwndOwner = (HWND)gViewerWindow->getPlatformWindow(); + else if (!mEventListener.connected()) + { + mEventListener = LLEventPumps::instance().obtain("LLApp").listen( + "DirPicker", + [this](const LLSD& stat) + { + std::string status(stat["status"]); + if (status != "running") + { + reset(); + } + return false; + }); + } ::OleInitialize(NULL); - LPITEMIDLIST pIDL = ::SHBrowseForFolder(&bi); - if(pIDL != NULL) + IFileDialog* p_file_dialog; + if (SUCCEEDED(CoCreateInstance(CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&p_file_dialog)))) { - WCHAR buffer[_MAX_PATH] = {'\0'}; - - if(::SHGetPathFromIDList(pIDL, buffer) != 0) + DWORD dwOptions; + if (SUCCEEDED(p_file_dialog->GetOptions(&dwOptions))) { - // Set the string value. - - mDir = utf16str_to_utf8str(llutf16string(buffer)); - success = TRUE; + p_file_dialog->SetOptions(dwOptions | FOS_PICKFOLDERS); } - // free the item id list - CoTaskMemFree(pIDL); + HWND owner = (HWND)gViewerWindow->getPlatformWindow(); + pDialog = p_file_dialog; + if (SUCCEEDED(p_file_dialog->Show(owner))) + { + IShellItem* psi; + if (SUCCEEDED(p_file_dialog->GetResult(&psi))) + { + wchar_t* pwstr = NULL; + if (SUCCEEDED(psi->GetDisplayName(SIGDN_FILESYSPATH, &pwstr))) + { + mDir = ll_convert_wide_to_string(pwstr); + CoTaskMemFree(pwstr); + success = true; + } + psi->Release(); + } + } + pDialog = NULL; + p_file_dialog->Release(); } ::OleUninitialize(); @@ -179,7 +201,7 @@ void LLDirPicker::reset() //static -BOOL LLDirPicker::getDir(std::string* filename, bool blocking) +bool LLDirPicker::getDir(std::string* filename, bool blocking) { LLFilePicker::ELoadFilter filter=LLFilePicker::FFLOAD_DIRECTORY; @@ -221,14 +243,14 @@ void LLDirPicker::reset() #endif } -BOOL LLDirPicker::getDir(std::string* filename, bool blocking) +bool LLDirPicker::getDir(std::string* filename, bool blocking) { reset(); // if local file browsing is turned off, return without opening dialog - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { - return FALSE; + return false; } #ifdef LL_FLTK @@ -281,9 +303,9 @@ void LLDirPicker::reset() { } -BOOL LLDirPicker::getDir(std::string* filename, bool blocking) +bool LLDirPicker::getDir(std::string* filename, bool blocking) { - return FALSE; + return false; } std::string LLDirPicker::getDirName() diff --git a/indra/newview/lldirpicker.h b/indra/newview/lldirpicker.h index fd56f37310..4bbe7db144 100644 --- a/indra/newview/lldirpicker.h +++ b/indra/newview/lldirpicker.h @@ -57,10 +57,7 @@ class LLFilePicker; class LLDirPicker { public: - // calling this before main() is undefined - static LLDirPicker& instance( void ) { return sInstance; } - - BOOL getDir(std::string* filename, bool blocking = true); + bool getDir(std::string* filename, bool blocking = true); std::string getDirName(); // clear any lists of buffers or whatever, and make sure the dir @@ -89,11 +86,8 @@ private: std::string* mFileName; std::string mDir; bool mLocked; - - static LLDirPicker sInstance; -#if LL_WINDOWS - BROWSEINFO bi; -#endif + void *pDialog; + boost::signals2::connection mEventListener; public: // don't call these directly please. diff --git a/indra/newview/lldndbutton.cpp b/indra/newview/lldndbutton.cpp index 5f8d02e3aa..6ba2de1589 100644 --- a/indra/newview/lldndbutton.cpp +++ b/indra/newview/lldndbutton.cpp @@ -35,7 +35,7 @@ LLDragAndDropButton::LLDragAndDropButton(const Params& params) : LLButton(params) {} -BOOL LLDragAndDropButton::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) +bool LLDragAndDropButton::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) { if (mDragDropHandler) { diff --git a/indra/newview/lldndbutton.h b/indra/newview/lldndbutton.h index 8a790600e9..277c2aad69 100644 --- a/indra/newview/lldndbutton.h +++ b/indra/newview/lldndbutton.h @@ -48,7 +48,7 @@ public: LLDragAndDropButton(const Params& params); typedef boost::function<bool ( - S32 /*x*/, S32 /*y*/, MASK /*mask*/, BOOL /*drop*/, + S32 /*x*/, S32 /*y*/, MASK /*mask*/, bool /*drop*/, EDragAndDropType /*cargo_type*/, void* /*cargo_data*/, EAcceptance* /*accept*/, @@ -64,9 +64,9 @@ public: /** * Process Drag-And-Drop by delegating the event to drag_drop_handler_t. * - * @return BOOL - value returned by drag_drop_handler_t if it is set, FALSE otherwise. + * @return bool - value returned by drag_drop_handler_t if it is set, false otherwise. */ - /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + /*virtual*/ bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, diff --git a/indra/newview/lldonotdisturbnotificationstorage.cpp b/indra/newview/lldonotdisturbnotificationstorage.cpp index 18456d132f..b4ced668d0 100644 --- a/indra/newview/lldonotdisturbnotificationstorage.cpp +++ b/indra/newview/lldonotdisturbnotificationstorage.cpp @@ -55,7 +55,7 @@ LLDoNotDisturbNotificationStorageTimer::~LLDoNotDisturbNotificationStorageTimer( } -BOOL LLDoNotDisturbNotificationStorageTimer::tick() +bool LLDoNotDisturbNotificationStorageTimer::tick() { LLDoNotDisturbNotificationStorage * doNotDisturbNotificationStorage = LLDoNotDisturbNotificationStorage::getInstance(); @@ -64,7 +64,7 @@ BOOL LLDoNotDisturbNotificationStorageTimer::tick() { doNotDisturbNotificationStorage->saveNotifications(); } - return FALSE; + return false; } LLDoNotDisturbNotificationStorage::LLDoNotDisturbNotificationStorage() diff --git a/indra/newview/lldonotdisturbnotificationstorage.h b/indra/newview/lldonotdisturbnotificationstorage.h index 1432d37de6..6683646a9b 100644 --- a/indra/newview/lldonotdisturbnotificationstorage.h +++ b/indra/newview/lldonotdisturbnotificationstorage.h @@ -42,7 +42,7 @@ public: ~LLDoNotDisturbNotificationStorageTimer(); public: - BOOL tick(); + bool tick(); }; class LLDoNotDisturbNotificationStorage : public LLParamSingleton<LLDoNotDisturbNotificationStorage>, public LLNotificationStorage diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 12a7a22e24..26fdf51485 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -232,7 +232,7 @@ const LLMatrix4& LLDrawable::getRenderMatrix() const return isRoot() ? getWorldMatrix() : getParent()->getWorldMatrix(); } -BOOL LLDrawable::isLight() const +bool LLDrawable::isLight() const { LLViewerObject* objectp = mVObjp; if ( objectp && (objectp->getPCode() == LL_PCODE_VOLUME) && !isDead()) @@ -241,7 +241,7 @@ BOOL LLDrawable::isLight() const } else { - return FALSE; + return false; } } @@ -339,7 +339,7 @@ LLFace* LLDrawable::addFace(const LLTextureEntry *te, LLViewerTexture *texturep) face = new LLFace(this, mVObjp); - face->setTEOffset(mFaces.size()); + face->setTEOffset(static_cast<S32>(mFaces.size())); face->setTexture(texturep); face->setPoolType(gPipeline.getPoolTypeFromTE(te, texturep)); @@ -361,7 +361,7 @@ LLFace* LLDrawable::addFace(const LLTextureEntry *te, LLViewerTexture *texturep, LLFace *face; face = new LLFace(this, mVObjp); - face->setTEOffset(mFaces.size()); + face->setTEOffset(static_cast<S32>(mFaces.size())); face->setTexture(texturep); face->setNormalMap(normalp); face->setPoolType(gPipeline.getPoolTypeFromTE(te, texturep)); @@ -384,7 +384,7 @@ LLFace* LLDrawable::addFace(const LLTextureEntry *te, LLViewerTexture *texturep, LLFace *face; face = new LLFace(this, mVObjp); - face->setTEOffset(mFaces.size()); + face->setTEOffset(static_cast<S32>(mFaces.size())); face->setTexture(texturep); face->setNormalMap(normalp); face->setSpecularMap(specularp); @@ -417,7 +417,7 @@ void LLDrawable::setNumFaces(const S32 newFaces, LLFacePool *poolp, LLViewerText else // (newFaces > mFaces.size()) { mFaces.reserve(newFaces); - for (int i = mFaces.size(); i<newFaces; i++) + for (auto i = mFaces.size(); i<newFaces; i++) { addFace(poolp, texturep); } @@ -442,7 +442,7 @@ void LLDrawable::setNumFacesFast(const S32 newFaces, LLFacePool *poolp, LLViewer else // (newFaces > mFaces.size()) { mFaces.reserve(newFaces); - for (int i = mFaces.size(); i<newFaces; i++) + for (auto i = mFaces.size(); i<newFaces; i++) { addFace(poolp, texturep); } @@ -455,10 +455,10 @@ void LLDrawable::mergeFaces(LLDrawable* src) { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE - U32 face_count = mFaces.size() + src->mFaces.size(); + auto face_count = mFaces.size() + src->mFaces.size(); mFaces.reserve(face_count); - for (U32 i = 0; i < src->mFaces.size(); i++) + for (size_t i = 0; i < src->mFaces.size(); i++) { LLFace* facep = src->mFaces[i]; facep->setDrawable(this); @@ -550,7 +550,7 @@ void LLDrawable::makeActive() } -void LLDrawable::makeStatic(BOOL warning_enabled) +void LLDrawable::makeStatic(bool warning_enabled) { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE @@ -598,11 +598,11 @@ void LLDrawable::makeStatic(BOOL warning_enabled) } // Returns "distance" between target destination and resulting xfrom -F32 LLDrawable::updateXform(BOOL undamped) +F32 LLDrawable::updateXform(bool undamped) { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE - BOOL damped = !undamped; + bool damped = !undamped; // Position const LLVector3 old_pos(mXform.getPosition()); @@ -721,7 +721,7 @@ F32 LLDrawable::updateXform(BOOL undamped) if (mSpatialBridge) { - gPipeline.markMoved(mSpatialBridge, FALSE); + gPipeline.markMoved(mSpatialBridge, false); } return dist_squared; } @@ -734,7 +734,7 @@ void LLDrawable::setRadius(F32 radius) } } -void LLDrawable::moveUpdatePipeline(BOOL moved) +void LLDrawable::moveUpdatePipeline(bool moved) { if (moved) { @@ -763,17 +763,17 @@ void LLDrawable::movePartition() } } -BOOL LLDrawable::updateMove() +bool LLDrawable::updateMove() { if (isDead()) { LL_WARNS() << "Update move on dead drawable!" << LL_ENDL; - return TRUE; + return true; } if (mVObjp.isNull()) { - return FALSE; + return false; } makeActive(); @@ -781,21 +781,21 @@ BOOL LLDrawable::updateMove() return isState(MOVE_UNDAMPED) ? updateMoveUndamped() : updateMoveDamped(); } -BOOL LLDrawable::updateMoveUndamped() +bool LLDrawable::updateMoveUndamped() { - F32 dist_squared = updateXform(TRUE); + F32 dist_squared = updateXform(true); mGeneration++; if (!isState(LLDrawable::INVISIBLE)) { - BOOL moved = (dist_squared > 0.001f && dist_squared < 255.99f); + bool moved = (dist_squared > 0.001f && dist_squared < 255.99f); moveUpdatePipeline(moved); mVObjp->updateText(); } mVObjp->clearChanged(LLXform::MOVED); - return TRUE; + return true; } void LLDrawable::updatePartition() @@ -808,7 +808,7 @@ void LLDrawable::updatePartition() } else if (mSpatialBridge) { - gPipeline.markMoved(mSpatialBridge, FALSE); + gPipeline.markMoved(mSpatialBridge, false); } else { @@ -817,22 +817,22 @@ void LLDrawable::updatePartition() } } -BOOL LLDrawable::updateMoveDamped() +bool LLDrawable::updateMoveDamped() { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE - F32 dist_squared = updateXform(FALSE); + F32 dist_squared = updateXform(false); mGeneration++; if (!isState(LLDrawable::INVISIBLE)) { - BOOL moved = (dist_squared > 0.001f && dist_squared < 128.0f); + bool moved = (dist_squared > 0.001f && dist_squared < 128.0f); moveUpdatePipeline(moved); mVObjp->updateText(); } - BOOL done_moving = (dist_squared == 0.0f) ? TRUE : FALSE; + bool done_moving = dist_squared == 0.0f; if (done_moving) { @@ -942,12 +942,12 @@ void LLDrawable::updateTexture() } } -BOOL LLDrawable::updateGeometry() +bool LLDrawable::updateGeometry() { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE llassert(mVObjp.notNull()); - BOOL res = mVObjp && mVObjp->updateGeometry(this); + bool res = mVObjp && mVObjp->updateGeometry(this); return res; } @@ -1054,7 +1054,7 @@ void LLDrawable::updateBinRadius() } } -void LLDrawable::updateSpecialHoverCursor(BOOL enabled) +void LLDrawable::updateSpecialHoverCursor(bool enabled) { // TODO: maintain a list of objects that have special // hover cursors, then use that list for per-frame @@ -1244,7 +1244,7 @@ LLSpatialPartition* LLDrawable::getSpatialPartition() // Spatial Partition Bridging Drawable //======================================= -LLSpatialBridge::LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 data_mask, LLViewerRegion* regionp) : +LLSpatialBridge::LLSpatialBridge(LLDrawable* root, bool render_by_group, U32 data_mask, LLViewerRegion* regionp) : LLDrawable(root->getVObj(), true), LLSpatialPartition(data_mask, render_by_group, regionp) { @@ -1409,7 +1409,7 @@ void LLSpatialBridge::transformExtents(const LLVector4a* src, LLVector4a* dst) } -void LLDrawable::setVisible(LLCamera& camera, std::vector<LLDrawable*>* results, BOOL for_select) +void LLDrawable::setVisible(LLCamera& camera, std::vector<LLDrawable*>* results, bool for_select) { LLViewerOctreeEntryData::setVisible(); @@ -1466,7 +1466,7 @@ public: } }; -void LLSpatialBridge::setVisible(LLCamera& camera_in, std::vector<LLDrawable*>* results, BOOL for_select) +void LLSpatialBridge::setVisible(LLCamera& camera_in, std::vector<LLDrawable*>* results, bool for_select) { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE @@ -1489,8 +1489,8 @@ void LLSpatialBridge::setVisible(LLCamera& camera_in, std::vector<LLDrawable*>* av = objparent->mDrawable; LLSpatialGroup* group = av->getSpatialGroup(); - BOOL impostor = FALSE; - BOOL loaded = FALSE; + bool impostor = false; + bool loaded = false; if (objparent->isAvatar()) { LLVOAvatar* avatarp = (LLVOAvatar*) objparent; @@ -1624,13 +1624,13 @@ void LLSpatialBridge::makeActive() LL_ERRS() << "makeActive called on spatial bridge" << LL_ENDL; } -void LLSpatialBridge::move(LLDrawable *drawablep, LLSpatialGroup *curp, BOOL immediate) +void LLSpatialBridge::move(LLDrawable *drawablep, LLSpatialGroup *curp, bool immediate) { LLSpatialPartition::move(drawablep, curp, immediate); - gPipeline.markMoved(this, FALSE); + gPipeline.markMoved(this, false); } -BOOL LLSpatialBridge::updateMove() +bool LLSpatialBridge::updateMove() { llassert_always(mDrawable); llassert_always(mDrawable->mVObjp); @@ -1641,9 +1641,9 @@ BOOL LLSpatialBridge::updateMove() mOctree->balance(); if (part) { - part->move(this, getSpatialGroup(), TRUE); + part->move(this, getSpatialGroup(), true); } - return TRUE; + return true; } void LLSpatialBridge::shiftPos(const LLVector4a& vec) @@ -1703,33 +1703,33 @@ const LLVector3 LLDrawable::getPositionAgent() const } } -BOOL LLDrawable::isAnimating() const +bool LLDrawable::isAnimating() const { if (!getVObj()) { - return TRUE; + return true; } if (getScale() != mVObjp->getScale()) { - return TRUE; + return true; } if (mVObjp->getPCode() == LLViewerObject::LL_VO_PART_GROUP) { - return TRUE; + return true; } if (mVObjp->getPCode() == LLViewerObject::LL_VO_HUD_PART_GROUP) { - return TRUE; + return true; } /*if (!isRoot() && !mVObjp->getAngularVelocity().isExactlyZero()) { //target omega - return TRUE; + return true; }*/ - return FALSE; + return false; } void LLDrawable::updateFaceSize(S32 idx) diff --git a/indra/newview/lldrawable.h b/indra/newview/lldrawable.h index 726667813a..a7ac9da618 100644 --- a/indra/newview/lldrawable.h +++ b/indra/newview/lldrawable.h @@ -84,13 +84,13 @@ public: LLDrawable(LLViewerObject *vobj, bool new_entry = false); void markDead(); // Mark this drawable as dead - BOOL isDead() const { return isState(DEAD); } - BOOL isNew() const { return !isState(BUILT); } - BOOL isUnload() const { return isState(FOR_UNLOAD); } + bool isDead() const { return isState(DEAD); } + bool isNew() const { return !isState(BUILT); } + bool isUnload() const { return isState(FOR_UNLOAD); } - BOOL isLight() const; + bool isLight() const; - virtual void setVisible(LLCamera& camera_in, std::vector<LLDrawable*>* results = NULL, BOOL for_select = FALSE); + virtual void setVisible(LLCamera& camera_in, std::vector<LLDrawable*>* results = NULL, bool for_select = false); LLSpatialGroup* getSpatialGroup()const {return (LLSpatialGroup*)getGroup();} LLViewerRegion* getRegion() const { return mVObjp->getRegion(); } @@ -116,20 +116,20 @@ public: LLXformMatrix* getXform() { return &mXform; } U32 getState() const { return mState; } - BOOL isState (U32 bits) const { return ((mState & bits) != 0); } + bool isState (U32 bits) const { return ((mState & bits) != 0); } void setState (U32 bits) { mState |= bits; } void clearState(U32 bits) { mState &= ~bits; } - BOOL isAvatar() const { return mVObjp.notNull() && mVObjp->isAvatar(); } - BOOL isRoot() const { return !mParent || mParent->isAvatar(); } + bool isAvatar() const { return mVObjp.notNull() && mVObjp->isAvatar(); } + bool isRoot() const { return !mParent || mParent->isAvatar(); } LLDrawable* getRoot(); - BOOL isSpatialRoot() const { return !mParent || mParent->isAvatar(); } - virtual BOOL isSpatialBridge() const { return FALSE; } + bool isSpatialRoot() const { return !mParent || mParent->isAvatar(); } + virtual bool isSpatialBridge() const { return false; } virtual LLSpatialPartition* asPartition() { return NULL; } LLDrawable* getParent() const { return mParent; } // must set parent through LLViewerObject:: () - //BOOL setParent(LLDrawable *parent); + //bool setParent(LLDrawable *parent); inline LLFace* getFace(const S32 i) const; inline S32 getNumFaces() const; @@ -151,32 +151,32 @@ public: void destroy(); void update(); - F32 updateXform(BOOL undamped); + F32 updateXform(bool undamped); virtual void makeActive(); - /*virtual*/ void makeStatic(BOOL warning_enabled = TRUE); + /*virtual*/ void makeStatic(bool warning_enabled = true); - BOOL isActive() const { return isState(ACTIVE); } - BOOL isStatic() const { return !isActive(); } - BOOL isAnimating() const; + bool isActive() const { return isState(ACTIVE); } + bool isStatic() const { return !isActive(); } + bool isAnimating() const; - virtual BOOL updateMove(); + virtual bool updateMove(); virtual void movePartition(); void updateTexture(); void updateMaterial(); virtual void updateDistance(LLCamera& camera, bool force_update); - BOOL updateGeometry(); + bool updateGeometry(); void updateFaceSize(S32 idx); - void updateSpecialHoverCursor(BOOL enabled); + void updateSpecialHoverCursor(bool enabled); virtual void shiftPos(const LLVector4a &shift_vector); S32 getGeneration() const { return mGeneration; } - BOOL getLit() const { return isState(UNLIT) ? FALSE : TRUE; } - void setLit(BOOL lit) { lit ? clearState(UNLIT) : setState(UNLIT); } + bool getLit() const { return !isState(UNLIT); } + void setLit(bool lit) { lit ? clearState(UNLIT) : setState(UNLIT); } bool isVisible() const; bool isRecentlyVisible() const; @@ -195,7 +195,7 @@ public: virtual void updateBinRadius(); void setRenderType(S32 type) { mRenderType = type; } - BOOL isRenderType(S32 type) { return mRenderType == type; } + bool isRenderType(S32 type) { return mRenderType == type; } S32 getRenderType() { return mRenderType; } // Debugging methods @@ -214,10 +214,10 @@ public: protected: ~LLDrawable() { destroy(); } - void moveUpdatePipeline(BOOL moved); + void moveUpdatePipeline(bool moved); void updatePartition(); - BOOL updateMoveDamped(); - BOOL updateMoveUndamped(); + bool updateMoveDamped(); + bool updateMoveUndamped(); public: friend class LLPipeline; @@ -244,11 +244,11 @@ public: { if (lhs->isVisible() && !rhs->isVisible()) { - return TRUE; //visible things come first + return true; //visible things come first } else if (!lhs->isVisible() && rhs->isVisible()) { - return FALSE; //rhs is visible, comes first + return false; //rhs is visible, comes first } return lhs->mDistanceWRTCamera < rhs->mDistanceWRTCamera; // farthest = last diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index 7532b1fc85..ba7d17cf21 100644 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -269,20 +269,20 @@ void LLFacePool::enqueue(LLFace* facep) } // virtual -BOOL LLFacePool::addFace(LLFace *facep) +bool LLFacePool::addFace(LLFace *facep) { addFaceReference(facep); - return TRUE; + return true; } // virtual -BOOL LLFacePool::removeFace(LLFace *facep) +bool LLFacePool::removeFace(LLFace *facep) { removeFaceReference(facep); vector_replace_with_last(mDrawFace, facep); - return TRUE; + return true; } // Not absolutely sure if we should be resetting all of the chained pools as well - djs @@ -315,7 +315,7 @@ void LLFacePool::addFaceReference(LLFace *facep) { if (-1 == facep->getReferenceIndex()) { - facep->setReferenceIndex(mReferences.size()); + facep->setReferenceIndex(static_cast<S32>(mReferences.size())); mReferences.push_back(facep); } } @@ -328,9 +328,9 @@ void LLFacePool::pushFaceGeometry() } } -BOOL LLFacePool::verify() const +bool LLFacePool::verify() const { - BOOL ok = TRUE; + bool ok = true; for (std::vector<LLFace*>::const_iterator iter = mDrawFace.begin(); iter != mDrawFace.end(); iter++) @@ -340,11 +340,11 @@ BOOL LLFacePool::verify() const { LL_INFOS() << "Face in wrong pool!" << LL_ENDL; facep->printDebugInfo(); - ok = FALSE; + ok = false; } else if (!facep->verify()) { - ok = FALSE; + ok = false; } } @@ -356,7 +356,7 @@ void LLFacePool::printDebugInfo() const LL_INFOS() << "Pool " << this << " Type: " << getType() << LL_ENDL; } -BOOL LLFacePool::LLOverrideFaceColor::sOverrideFaceColor = FALSE; +bool LLFacePool::LLOverrideFaceColor::sOverrideFaceColor = false; void LLFacePool::LLOverrideFaceColor::setColor(const LLColor4& color) { @@ -674,7 +674,7 @@ bool LLRenderPass::uploadMatrixPalette(LLVOAvatar* avatar, LLMeshSkinInfo* skinI return false; } const LLVOAvatar::MatrixPaletteCache& mpc = avatar->updateSkinInfoMatrixPalette(skinInfo); - U32 count = mpc.mMatrixPalette.size(); + U32 count = static_cast<U32>(mpc.mMatrixPalette.size()); if (count == 0) { @@ -684,7 +684,7 @@ bool LLRenderPass::uploadMatrixPalette(LLVOAvatar* avatar, LLMeshSkinInfo* skinI LLGLSLShader::sCurBoundShaderPtr->uniformMatrix3x4fv(LLViewerShaderMgr::AVATAR_MATRIX, count, - FALSE, + false, (GLfloat*)&(mpc.mGLMp[0])); return true; @@ -758,9 +758,12 @@ void LLRenderPass::pushGLTFBatch(LLDrawInfo& params) { auto& mat = params.mGLTFMaterial; - mat->bind(params.mTexture); + if (mat.notNull()) + { + mat->bind(params.mTexture); + } - LLGLDisable cull_face(mat->mDoubleSided ? GL_CULL_FACE : 0); + LLGLDisable cull_face(mat.notNull() && mat->mDoubleSided ? GL_CULL_FACE : 0); setup_texture_matrix(params); diff --git a/indra/newview/lldrawpool.h b/indra/newview/lldrawpool.h index 789d8d45c9..01a29f71a0 100644 --- a/indra/newview/lldrawpool.h +++ b/indra/newview/lldrawpool.h @@ -80,13 +80,13 @@ public: LLDrawPool(const U32 type); virtual ~LLDrawPool(); - virtual BOOL isDead() = 0; + virtual bool isDead() = 0; S32 getId() const { return mId; } U32 getType() const { return mType; } - BOOL getSkipRenderFlag() const { return mSkipRender;} - void setSkipRenderFlag( BOOL flag ) { mSkipRender = flag; } + bool getSkipRenderFlag() const { return mSkipRender;} + void setSkipRenderFlag( bool flag ) { mSkipRender = flag; } virtual LLViewerTexture *getDebugTexture(); virtual void beginRenderPass( S32 pass ); @@ -111,19 +111,19 @@ public: virtual void render(S32 pass = 0) {}; virtual void prerender() {}; virtual U32 getVertexDataMask() { return 0; } // DEPRECATED -- draw pool doesn't actually determine vertex data mask any more - virtual BOOL verify() const { return TRUE; } // Verify that all data in the draw pool is correct! + virtual bool verify() const { return true; } // Verify that all data in the draw pool is correct! virtual S32 getShaderLevel() const { return mShaderLevel; } static LLDrawPool* createPool(const U32 type, LLViewerTexture *tex0 = NULL); virtual LLViewerTexture* getTexture() = 0; - virtual BOOL isFacePool() { return FALSE; } + virtual bool isFacePool() { return false; } virtual void resetDrawOrders() = 0; virtual void pushFaceGeometry() {} S32 mShaderLevel; S32 mId; U32 mType; // Type of draw pool - BOOL mSkipRender; + bool mSkipRender; }; class LLRenderPass : public LLDrawPool @@ -345,7 +345,7 @@ public: virtual ~LLRenderPass(); /*virtual*/ LLViewerTexture* getDebugTexture() { return NULL; } LLViewerTexture* getTexture() { return NULL; } - BOOL isDead() { return FALSE; } + bool isDead() { return false; } void resetDrawOrders() { } static void applyModelMatrix(const LLDrawInfo& params); @@ -404,16 +404,16 @@ public: LLFacePool(const U32 type); virtual ~LLFacePool(); - BOOL isDead() { return mReferences.empty(); } + bool isDead() { return mReferences.empty(); } virtual LLViewerTexture *getTexture(); virtual void dirtyTextures(const std::set<LLViewerFetchedTexture*>& textures); virtual void enqueue(LLFace *face); - virtual BOOL addFace(LLFace *face); - virtual BOOL removeFace(LLFace *face); + virtual bool addFace(LLFace *face); + virtual bool removeFace(LLFace *face); - virtual BOOL verify() const; // Verify that all data in the draw pool is correct! + virtual bool verify() const; // Verify that all data in the draw pool is correct! virtual void resetDrawOrders(); void resetAll(); @@ -427,7 +427,7 @@ public: void printDebugInfo() const; - BOOL isFacePool() { return TRUE; } + bool isFacePool() { return true; } // call drawIndexed on every draw face void pushFaceGeometry(); @@ -446,24 +446,24 @@ public: LLOverrideFaceColor(LLDrawPool* pool) : mOverride(sOverrideFaceColor), mPool(pool) { - sOverrideFaceColor = TRUE; + sOverrideFaceColor = true; } LLOverrideFaceColor(LLDrawPool* pool, const LLColor4& color) : mOverride(sOverrideFaceColor), mPool(pool) { - sOverrideFaceColor = TRUE; + sOverrideFaceColor = true; setColor(color); } LLOverrideFaceColor(LLDrawPool* pool, const LLColor4U& color) : mOverride(sOverrideFaceColor), mPool(pool) { - sOverrideFaceColor = TRUE; + sOverrideFaceColor = true; setColor(color); } LLOverrideFaceColor(LLDrawPool* pool, F32 r, F32 g, F32 b, F32 a) : mOverride(sOverrideFaceColor), mPool(pool) { - sOverrideFaceColor = TRUE; + sOverrideFaceColor = true; setColor(r, g, b, a); } ~LLOverrideFaceColor() @@ -473,9 +473,9 @@ public: void setColor(const LLColor4& color); void setColor(const LLColor4U& color); void setColor(F32 r, F32 g, F32 b, F32 a); - BOOL mOverride; + bool mOverride; LLDrawPool* mPool; - static BOOL sOverrideFaceColor; + static bool sOverrideFaceColor; }; }; diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 60cfe9440d..34da5b29d4 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -53,7 +53,7 @@ #include "llenvironment.h" -BOOL LLDrawPoolAlpha::sShowDebugAlpha = FALSE; +bool LLDrawPoolAlpha::sShowDebugAlpha = false; #define current_shader (LLGLSLShader::sCurBoundShaderPtr) @@ -93,7 +93,7 @@ S32 LLDrawPoolAlpha::getNumPostDeferredPasses() } // set some common parameters on the given shader to prepare for alpha rendering -static void prepare_alpha_shader(LLGLSLShader* shader, bool textureGamma, bool deferredEnvironment, F32 water_sign) +static void prepare_alpha_shader(LLGLSLShader* shader, bool deferredEnvironment, F32 water_sign) { static LLCachedControl<F32> displayGamma(gSavedSettings, "RenderDeferredDisplayGamma"); F32 gamma = displayGamma; @@ -132,19 +132,15 @@ static void prepare_alpha_shader(LLGLSLShader* shader, bool textureGamma, bool d { shader->setMinimumAlpha(MINIMUM_ALPHA); } - if (textureGamma) - { - shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f); - } //also prepare rigged variant if (shader->mRiggedVariant && shader->mRiggedVariant != shader) { - prepare_alpha_shader(shader->mRiggedVariant, textureGamma, deferredEnvironment, water_sign); + prepare_alpha_shader(shader->mRiggedVariant, deferredEnvironment, water_sign); } } -extern BOOL gCubeSnapshot; +extern bool gCubeSnapshot; void LLDrawPoolAlpha::renderPostDeferred(S32 pass) { @@ -171,36 +167,36 @@ void LLDrawPoolAlpha::renderPostDeferred(S32 pass) llassert(LLPipeline::sRenderDeferred); emissive_shader = &gDeferredEmissiveProgram; - prepare_alpha_shader(emissive_shader, true, false, water_sign); + prepare_alpha_shader(emissive_shader, false, water_sign); pbr_emissive_shader = &gPBRGlowProgram; - prepare_alpha_shader(pbr_emissive_shader, true, false, water_sign); + prepare_alpha_shader(pbr_emissive_shader, false, water_sign); fullbright_shader = (LLPipeline::sImpostorRender) ? &gDeferredFullbrightAlphaMaskProgram : (LLPipeline::sRenderingHUDs) ? &gHUDFullbrightAlphaMaskAlphaProgram : &gDeferredFullbrightAlphaMaskAlphaProgram; - prepare_alpha_shader(fullbright_shader, true, true, water_sign); + prepare_alpha_shader(fullbright_shader, true, water_sign); simple_shader = (LLPipeline::sImpostorRender) ? &gDeferredAlphaImpostorProgram : (LLPipeline::sRenderingHUDs) ? &gHUDAlphaProgram : &gDeferredAlphaProgram; - prepare_alpha_shader(simple_shader, false, true, water_sign); //prime simple shader (loads shadow relevant uniforms) + prepare_alpha_shader(simple_shader, true, water_sign); //prime simple shader (loads shadow relevant uniforms) LLGLSLShader* materialShader = gDeferredMaterialProgram; for (int i = 0; i < LLMaterial::SHADER_COUNT*2; ++i) { - prepare_alpha_shader(&materialShader[i], false, true, water_sign); + prepare_alpha_shader(&materialShader[i], true, water_sign); } pbr_shader = (LLPipeline::sRenderingHUDs) ? &gHUDPBRAlphaProgram : &gDeferredPBRAlphaProgram; - prepare_alpha_shader(pbr_shader, false, true, water_sign); + prepare_alpha_shader(pbr_shader, true, water_sign); // explicitly unbind here so render loop doesn't make assumptions about the last shader // already being setup for rendering @@ -261,13 +257,12 @@ void LLDrawPoolAlpha::forwardRender(bool rigged) mAlphaDFactor = LLRender::BF_ONE_MINUS_SOURCE_ALPHA; // } gGL.blendFunc(mColorSFactor, mColorDFactor, mAlphaSFactor, mAlphaDFactor); - if (rigged) + if (rigged && mType == LLDrawPool::POOL_ALPHA_POST_WATER) { // draw GLTF scene to depth buffer before rigged alpha - gPipeline.bindDeferredShader(gDeferredPBRAlphaProgram); LL::GLTFSceneManager::instance().render(false, false); - - gPipeline.bindDeferredShader(*gDeferredPBRAlphaProgram.mRiggedVariant); LL::GLTFSceneManager::instance().render(false, true); + LL::GLTFSceneManager::instance().render(false, false, true); + LL::GLTFSceneManager::instance().render(false, true, true); } // If the face is more than 90% transparent, then don't update the Depth buffer for Dof @@ -587,8 +582,8 @@ void LLDrawPoolAlpha::renderRiggedPbrEmissives(std::vector<LLDrawInfo*>& emissiv void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged) { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; - BOOL initialized_lighting = FALSE; - BOOL light_enabled = TRUE; + bool initialized_lighting = false; + bool light_enabled = true; LLVOAvatar* lastAvatar = nullptr; U64 lastMeshId = 0; @@ -710,18 +705,18 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged) // Turn off lighting if it hasn't already been so. if (light_enabled || !initialized_lighting) { - initialized_lighting = TRUE; + initialized_lighting = true; target_shader = fullbright_shader; - light_enabled = FALSE; + light_enabled = false; } } // Turn on lighting if it isn't already. else if (!light_enabled || !initialized_lighting) { - initialized_lighting = TRUE; + initialized_lighting = true; target_shader = simple_shader; - light_enabled = TRUE; + light_enabled = true; } if (LLPipeline::sRenderingHUDs) @@ -929,7 +924,7 @@ bool LLDrawPoolAlpha::uploadMatrixPalette(const LLDrawInfo& params) return false; } const LLVOAvatar::MatrixPaletteCache& mpc = params.mAvatar.get()->updateSkinInfoMatrixPalette(params.mSkinInfo); - U32 count = mpc.mMatrixPalette.size(); + U32 count = static_cast<U32>(mpc.mMatrixPalette.size()); if (count == 0) { @@ -939,7 +934,7 @@ bool LLDrawPoolAlpha::uploadMatrixPalette(const LLDrawInfo& params) LLGLSLShader::sCurBoundShaderPtr->uniformMatrix3x4fv(LLViewerShaderMgr::AVATAR_MATRIX, count, - FALSE, + false, (GLfloat*)&(mpc.mGLMp[0])); return true; diff --git a/indra/newview/lldrawpoolalpha.h b/indra/newview/lldrawpoolalpha.h index a968149a22..0abe001714 100644 --- a/indra/newview/lldrawpoolalpha.h +++ b/indra/newview/lldrawpoolalpha.h @@ -63,12 +63,12 @@ public: void renderDebugAlpha(); - void renderGroupAlpha(LLSpatialGroup* group, U32 type, U32 mask, BOOL texture = TRUE); + void renderGroupAlpha(LLSpatialGroup* group, U32 type, U32 mask, bool texture = true); void renderAlpha(U32 mask, bool depth_only = false, bool rigged = false); void renderAlphaHighlight(); bool uploadMatrixPalette(const LLDrawInfo& params); - static BOOL sShowDebugAlpha; + static bool sShowDebugAlpha; private: LLGLSLShader* target_shader; diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 9581ee2e60..9afc705d3e 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -56,8 +56,8 @@ static U32 sShaderLevel = 0; LLGLSLShader* LLDrawPoolAvatar::sVertexProgram = NULL; -BOOL LLDrawPoolAvatar::sSkipOpaque = FALSE; -BOOL LLDrawPoolAvatar::sSkipTransparent = FALSE; +bool LLDrawPoolAvatar::sSkipOpaque = false; +bool LLDrawPoolAvatar::sSkipTransparent = false; S32 LLDrawPoolAvatar::sShadowPass = -1; S32 LLDrawPoolAvatar::sDiffuseChannel = 0; F32 LLDrawPoolAvatar::sMinimumAlpha = 0.2f; @@ -67,7 +67,7 @@ LLUUID gBlackSquareID; static bool is_deferred_render = false; static bool is_post_deferred_render = false; -extern BOOL gUseGLPick; +extern bool gUseGLPick; F32 CLOTHING_GRAVITY_EFFECT = 0.7f; F32 CLOTHING_ACCEL_FORCE_FACTOR = 0.2f; @@ -95,8 +95,8 @@ S32 AVATAR_OFFSET_TEX0 = 32; S32 AVATAR_OFFSET_TEX1 = 40; S32 AVATAR_VERTEX_BYTES = 48; -BOOL gAvatarEmbossBumpMap = FALSE; -static BOOL sRenderingSkinned = FALSE; +bool gAvatarEmbossBumpMap = false; +static bool sRenderingSkinned = false; S32 normal_channel = -1; S32 specular_channel = -1; S32 cube_channel = -1; @@ -115,16 +115,16 @@ LLDrawPoolAvatar::~LLDrawPoolAvatar() } // virtual -BOOL LLDrawPoolAvatar::isDead() +bool LLDrawPoolAvatar::isDead() { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR if (!LLFacePool::isDead()) { - return FALSE; + return false; } - return TRUE; + return true; } S32 LLDrawPoolAvatar::getShaderLevel() const @@ -167,7 +167,7 @@ void LLDrawPoolAvatar::beginDeferredPass(S32 pass) { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; - sSkipTransparent = TRUE; + sSkipTransparent = true; is_deferred_render = true; if (LLPipeline::sImpostorRender) @@ -193,7 +193,7 @@ void LLDrawPoolAvatar::endDeferredPass(S32 pass) { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; - sSkipTransparent = FALSE; + sSkipTransparent = false; is_deferred_render = false; if (LLPipeline::sImpostorRender) @@ -231,10 +231,10 @@ void LLDrawPoolAvatar::beginPostDeferredPass(S32 pass) { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR - sSkipOpaque = TRUE; + sSkipOpaque = true; sShaderLevel = mShaderLevel; sVertexProgram = &gDeferredAvatarAlphaProgram; - sRenderingSkinned = TRUE; + sRenderingSkinned = true; gPipeline.bindDeferredShader(*sVertexProgram); @@ -247,8 +247,8 @@ void LLDrawPoolAvatar::endPostDeferredPass(S32 pass) { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR // if we're in software-blending, remember to set the fence _after_ we draw so we wait till this rendering is done - sRenderingSkinned = FALSE; - sSkipOpaque = FALSE; + sRenderingSkinned = false; + sSkipOpaque = false; gPipeline.unbindDeferredShader(*sVertexProgram); sDiffuseChannel = 0; @@ -288,7 +288,7 @@ void LLDrawPoolAvatar::beginShadowPass(S32 pass) if ((sShaderLevel > 0)) // for hardware blending { - sRenderingSkinned = TRUE; + sRenderingSkinned = true; sVertexProgram->bind(); } @@ -308,7 +308,7 @@ void LLDrawPoolAvatar::beginShadowPass(S32 pass) if ((sShaderLevel > 0)) // for hardware blending { - sRenderingSkinned = TRUE; + sRenderingSkinned = true; sVertexProgram->bind(); } @@ -328,7 +328,7 @@ void LLDrawPoolAvatar::beginShadowPass(S32 pass) if ((sShaderLevel > 0)) // for hardware blending { - sRenderingSkinned = TRUE; + sRenderingSkinned = true; sVertexProgram->bind(); } @@ -345,7 +345,7 @@ void LLDrawPoolAvatar::endShadowPass(S32 pass) sVertexProgram->unbind(); } sVertexProgram = NULL; - sRenderingSkinned = FALSE; + sRenderingSkinned = false; LLDrawPoolAvatar::sShadowPass = -1; } @@ -370,8 +370,17 @@ void LLDrawPoolAvatar::renderShadow(S32 pass) return; } + static LLCachedControl<bool> friends_only(gSavedSettings, "RenderAvatarFriendsOnly", false); + if (friends_only() + && !avatarp->isControlAvatar() + && !avatarp->isSelf() + && !avatarp->isBuddy()) + { + return; + } + LLVOAvatar::AvatarOverallAppearance oa = avatarp->getOverallAppearance(); - BOOL impostor = !LLPipeline::sImpostorRender && avatarp->isImpostor(); + bool impostor = !LLPipeline::sImpostorRender && avatarp->isImpostor(); // no shadows if the shadows are causing this avatar to breach the limit. if (avatarp->isTooSlow() || impostor || (oa == LLVOAvatar::AOA_INVISIBLE)) { @@ -546,7 +555,7 @@ void LLDrawPoolAvatar::beginDeferredImpostor() sVertexProgram = &gDeferredImpostorProgram; specular_channel = sVertexProgram->enableTexture(LLViewerShaderMgr::SPECULAR_MAP); - normal_channel = sVertexProgram->enableTexture(LLViewerShaderMgr::DEFERRED_NORMAL); + normal_channel = sVertexProgram->enableTexture(LLViewerShaderMgr::NORMAL_MAP); sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP); sVertexProgram->bind(); sVertexProgram->setMinimumAlpha(0.01f); @@ -557,7 +566,7 @@ void LLDrawPoolAvatar::endDeferredImpostor() LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR sShaderLevel = mShaderLevel; - sVertexProgram->disableTexture(LLViewerShaderMgr::DEFERRED_NORMAL); + sVertexProgram->disableTexture(LLViewerShaderMgr::NORMAL_MAP); sVertexProgram->disableTexture(LLViewerShaderMgr::SPECULAR_MAP); sVertexProgram->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP); gPipeline.unbindDeferredShader(*sVertexProgram); @@ -594,7 +603,7 @@ void LLDrawPoolAvatar::beginSkinned() sVertexProgram = &gAvatarProgram; - sRenderingSkinned = TRUE; + sRenderingSkinned = true; sVertexProgram->bind(); sVertexProgram->setMinimumAlpha(LLDrawPoolAvatar::sMinimumAlpha); @@ -607,7 +616,7 @@ void LLDrawPoolAvatar::endSkinned() // if we're in software-blending, remember to set the fence _after_ we draw so we wait till this rendering is done if (sShaderLevel > 0) { - sRenderingSkinned = FALSE; + sRenderingSkinned = false; sVertexProgram->disableTexture(LLViewerShaderMgr::BUMP_MAP); gGL.getTexUnit(0)->activate(); sVertexProgram->unbind(); @@ -632,7 +641,7 @@ void LLDrawPoolAvatar::beginDeferredSkinned() sShaderLevel = mShaderLevel; sVertexProgram = &gDeferredAvatarProgram; - sRenderingSkinned = TRUE; + sRenderingSkinned = true; sVertexProgram->bind(); sVertexProgram->setMinimumAlpha(LLDrawPoolAvatar::sMinimumAlpha); @@ -645,7 +654,7 @@ void LLDrawPoolAvatar::endDeferredSkinned() LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR // if we're in software-blending, remember to set the fence _after_ we draw so we wait till this rendering is done - sRenderingSkinned = FALSE; + sRenderingSkinned = false; sVertexProgram->unbind(); sVertexProgram->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP); @@ -723,7 +732,18 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) return; } - BOOL impostor = !LLPipeline::sImpostorRender && avatarp->isImpostor() && !single_avatar; + static LLCachedControl<bool> friends_only(gSavedSettings, "RenderAvatarFriendsOnly", false); + if (!single_avatar + && friends_only() + && !avatarp->isUIAvatar() + && !avatarp->isControlAvatar() + && !avatarp->isSelf() + && !avatarp->isBuddy()) + { + return; + } + + bool impostor = !LLPipeline::sImpostorRender && avatarp->isImpostor() && !single_avatar; if (( avatarp->isInMuteList() || impostor diff --git a/indra/newview/lldrawpoolavatar.h b/indra/newview/lldrawpoolavatar.h index 3160b9e706..1a53861a03 100644 --- a/indra/newview/lldrawpoolavatar.h +++ b/indra/newview/lldrawpoolavatar.h @@ -60,7 +60,7 @@ public: }; ~LLDrawPoolAvatar(); - /*virtual*/ BOOL isDead(); + /*virtual*/ bool isDead(); typedef enum { @@ -120,8 +120,8 @@ typedef enum void renderAvatars(LLVOAvatar *single_avatar, S32 pass = -1); // renders only one avatar if single_avatar is not null. - static BOOL sSkipOpaque; - static BOOL sSkipTransparent; + static bool sSkipOpaque; + static bool sSkipTransparent; static S32 sShadowPass; static S32 sDiffuseChannel; static F32 sMinimumAlpha; @@ -136,5 +136,5 @@ extern S32 AVATAR_OFFSET_TEX1; extern S32 AVATAR_VERTEX_BYTES; const S32 AVATAR_BUFFER_ELEMENTS = 8192; // Needs to be enough to store all avatar vertices. -extern BOOL gAvatarEmbossBumpMap; +extern bool gAvatarEmbossBumpMap; #endif // LL_LLDRAWPOOLAVATAR_H diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 9b71d09db3..4ca8a184e8 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -77,7 +77,7 @@ static LLGLSLShader* shader = NULL; static S32 cube_channel = -1; static S32 diffuse_channel = -1; static S32 bump_channel = -1; -static BOOL shiny = FALSE; +static bool shiny = false; // Enabled after changing LLViewerTexture::mNeedsCreateTexture to an // LLAtomicBool; this should work just fine, now. HB @@ -165,7 +165,7 @@ void LLStandardBumpmap::addstandard() gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage = LLViewerTextureManager::getFetchedTexture(LLUUID(bump_image_id)); gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setBoostLevel(LLGLTexture::LOCAL) ; - gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setLoadedCallback(LLBumpImageList::onSourceStandardLoaded, 0, TRUE, FALSE, NULL, NULL ); + gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setLoadedCallback(LLBumpImageList::onSourceStandardLoaded, 0, true, false, NULL, NULL ); gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->forceToSaveRawImage(0, 30.f) ; LLStandardBumpmap::sStandardBumpmapCount++; } @@ -198,7 +198,7 @@ void LLStandardBumpmap::destroyGL() LLDrawPoolBump::LLDrawPoolBump() : LLRenderPass(LLDrawPool::POOL_BUMP) { - shiny = FALSE; + shiny = false; } @@ -354,7 +354,7 @@ void LLDrawPoolBump::beginFullbrightShiny() diffuse_channel = 0; } - shiny = TRUE; + shiny = true; } void LLDrawPoolBump::renderFullbrightShiny() @@ -406,7 +406,7 @@ void LLDrawPoolBump::endFullbrightShiny() diffuse_channel = -1; cube_channel = 0; - shiny = FALSE; + shiny = false; } void LLDrawPoolBump::renderGroup(LLSpatialGroup* group, U32 type, bool texture = true) @@ -426,7 +426,7 @@ void LLDrawPoolBump::renderGroup(LLSpatialGroup* group, U32 type, bool texture = // static -BOOL LLDrawPoolBump::bindBumpMap(LLDrawInfo& params, S32 channel) +bool LLDrawPoolBump::bindBumpMap(LLDrawInfo& params, S32 channel) { U8 bump_code = params.mBump; @@ -434,7 +434,7 @@ BOOL LLDrawPoolBump::bindBumpMap(LLDrawInfo& params, S32 channel) } //static -BOOL LLDrawPoolBump::bindBumpMap(LLFace* face, S32 channel) +bool LLDrawPoolBump::bindBumpMap(LLFace* face, S32 channel) { const LLTextureEntry* te = face->getTextureEntry(); if (te) @@ -443,11 +443,11 @@ BOOL LLDrawPoolBump::bindBumpMap(LLFace* face, S32 channel) return bindBumpMap(bump_code, face->getTexture(), channel); } - return FALSE; + return false; } //static -BOOL LLDrawPoolBump::bindBumpMap(U8 bump_code, LLViewerTexture* texture, S32 channel) +bool LLDrawPoolBump::bindBumpMap(U8 bump_code, LLViewerTexture* texture, S32 channel) { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //Note: texture atlas does not support bump texture now. @@ -455,7 +455,7 @@ BOOL LLDrawPoolBump::bindBumpMap(U8 bump_code, LLViewerTexture* texture, S32 cha if(!tex) { //if the texture is not a fetched texture - return FALSE; + return false; } LLViewerTexture* bump = NULL; @@ -491,10 +491,10 @@ BOOL LLDrawPoolBump::bindBumpMap(U8 bump_code, LLViewerTexture* texture, S32 cha gGL.getTexUnit(channel)->bind(bump); } - return TRUE; + return true; } - return FALSE; + return false; } //static @@ -549,7 +549,7 @@ void LLDrawPoolBump::renderDeferred(S32 pass) { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_BUMP); - shiny = TRUE; + shiny = true; for (int i = 0; i < 2; ++i) { bool rigged = i == 1; @@ -597,7 +597,7 @@ void LLDrawPoolBump::renderDeferred(S32 pass) gGL.getTexUnit(0)->activate(); } - shiny = FALSE; + shiny = false; } @@ -699,17 +699,19 @@ void LLBumpImageList::addTextureStats(U8 bump, const LLUUID& base_image_id, F32 void LLBumpImageList::updateImages() { + llassert(LLCoros::on_main_thread_main_coro()); // This code is not thread safe + for (bump_image_map_t::iterator iter = mBrightnessEntries.begin(); iter != mBrightnessEntries.end(); ) { LLViewerTexture* image = iter->second; if( image ) { - BOOL destroy = TRUE; + bool destroy = true; if( image->hasGLTexture()) { if( image->getBoundRecently() ) { - destroy = FALSE; + destroy = false; } else { @@ -733,12 +735,12 @@ void LLBumpImageList::updateImages() LLViewerTexture* image = curiter->second; if( image ) { - BOOL destroy = TRUE; + bool destroy = true; if( image->hasGLTexture()) { if( image->getBoundRecently() ) { - destroy = FALSE; + destroy = false; } else { @@ -765,7 +767,7 @@ LLViewerTexture* LLBumpImageList::getBrightnessDarknessImage(LLViewerFetchedText LLViewerTexture* bump = NULL; bump_image_map_t* entries_list = NULL; - void (*callback_func)( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ) = NULL; + void (*callback_func)( bool success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, bool final, void* userdata ) = NULL; switch( bump_code ) { @@ -789,7 +791,7 @@ LLViewerTexture* LLBumpImageList::getBrightnessDarknessImage(LLViewerFetchedText } else { - (*entries_list)[src_image->getID()] = LLViewerTextureManager::getLocalTexture( TRUE ); + (*entries_list)[src_image->getID()] = LLViewerTextureManager::getLocalTexture( true ); bump = (*entries_list)[src_image->getID()]; // In case callback was called immediately and replaced the image } @@ -800,7 +802,7 @@ LLViewerTexture* LLBumpImageList::getBrightnessDarknessImage(LLViewerFetchedText //(LLPipeline::sRenderDeferred && bump->getComponents() != 4)) { src_image->setBoostLevel(LLGLTexture::BOOST_BUMP) ; - src_image->setLoadedCallback( callback_func, 0, TRUE, FALSE, new LLUUID(src_image->getID()), NULL ); + src_image->setLoadedCallback( callback_func, 0, true, false, new LLUUID(src_image->getID()), NULL ); src_image->forceToSaveRawImage(0) ; } } @@ -810,7 +812,7 @@ LLViewerTexture* LLBumpImageList::getBrightnessDarknessImage(LLViewerFetchedText // static -void LLBumpImageList::onSourceBrightnessLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ) +void LLBumpImageList::onSourceBrightnessLoaded( bool success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, bool final, void* userdata ) { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; LLUUID* source_asset_id = (LLUUID*)userdata; @@ -822,7 +824,7 @@ void LLBumpImageList::onSourceBrightnessLoaded( BOOL success, LLViewerFetchedTex } // static -void LLBumpImageList::onSourceDarknessLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ) +void LLBumpImageList::onSourceDarknessLoaded( bool success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, bool final, void* userdata ) { LLUUID* source_asset_id = (LLUUID*)userdata; LLBumpImageList::onSourceLoaded( success, src_vi, src, *source_asset_id, BE_DARKNESS ); @@ -832,7 +834,7 @@ void LLBumpImageList::onSourceDarknessLoaded( BOOL success, LLViewerFetchedTextu } } -void LLBumpImageList::onSourceStandardLoaded( BOOL success, LLViewerFetchedTexture* src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata) +void LLBumpImageList::onSourceStandardLoaded( bool success, LLViewerFetchedTexture* src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, bool final, void* userdata) { if (success && LLPipeline::sRenderDeferred) { @@ -850,11 +852,14 @@ void LLBumpImageList::onSourceStandardLoaded( BOOL success, LLViewerFetchedTextu void LLBumpImageList::generateNormalMapFromAlpha(LLImageRaw* src, LLImageRaw* nrm_image) { + LLImageDataSharedLock lockIn(src); + LLImageDataLock lockOut(nrm_image); + U8* nrm_data = nrm_image->getData(); S32 resX = src->getWidth(); S32 resY = src->getHeight(); - U8* src_data = src->getData(); + const U8* src_data = src->getData(); S32 src_cmp = src->getComponents(); @@ -904,7 +909,7 @@ void LLBumpImageList::generateNormalMapFromAlpha(LLImageRaw* src, LLImageRaw* nr } // static -void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLImageRaw* src, LLUUID& source_asset_id, EBumpEffect bump_code ) +void LLBumpImageList::onSourceLoaded( bool success, LLViewerTexture *src_vi, LLImageRaw* src, LLUUID& source_asset_id, EBumpEffect bump_code ) { LL_PROFILE_ZONE_SCOPED; @@ -912,6 +917,7 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; + LLImageDataSharedLock lock(src); bump_image_map_t& entries_list(bump_code == BE_BRIGHTNESS ? gBumpImageList.mBrightnessEntries : gBumpImageList.mDarknessEntries ); bump_image_map_t::iterator iter = entries_list.find(source_asset_id); @@ -922,7 +928,7 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI iter->second->getWidth() != src->getWidth() || iter->second->getHeight() != src->getHeight()) // bump not cached yet or has changed resolution { //make sure an entry exists for this image - entries_list[src_vi->getID()] = LLViewerTextureManager::getLocalTexture(TRUE); + entries_list[src_vi->getID()] = LLViewerTextureManager::getLocalTexture(true); iter = entries_list.find(src_vi->getID()); } } @@ -934,7 +940,7 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI U8* dst_data = dst_image->getData(); S32 dst_data_size = dst_image->getDataSize(); - U8* src_data = src->getData(); + const U8* src_data = src->getData(); S32 src_data_size = src->getDataSize(); S32 src_components = src->getComponents(); @@ -1091,7 +1097,7 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI bump_ptr->ref(); auto create_func = [=]() { - img->setUseMipMaps(TRUE); + img->setUseMipMaps(true); // upload dst_image to GPU (greyscale in red channel) img->setExplicitFormat(GL_RED, GL_RED); @@ -1105,7 +1111,7 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI // Note: bump will still point at GPU copy of dst_image bump_ptr->setExplicitFormat(GL_RGBA, GL_RGBA); LLGLuint tex_name; - img->createGLTexture(0, nullptr, 0, 0, true, &tex_name); + img->createGLTexture(0, nullptr, false, 0, true, &tex_name); // point render target at empty buffer sRenderTarget.setColorAttachment(img, tex_name); @@ -1117,7 +1123,7 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI LLGLDepthTest depth(GL_FALSE); LLGLDisable cull(GL_CULL_FACE); LLGLDisable blend(GL_BLEND); - gGL.setColorMask(TRUE, TRUE); + gGL.setColorMask(true, true); gNormalMapGenProgram.bind(); diff --git a/indra/newview/lldrawpoolbump.h b/indra/newview/lldrawpoolbump.h index a1ed555996..65cb9af015 100644 --- a/indra/newview/lldrawpoolbump.h +++ b/indra/newview/lldrawpoolbump.h @@ -43,10 +43,10 @@ class LLViewerFetchedTexture; class LLDrawPoolBump : public LLRenderPass { protected : - LLDrawPoolBump(const U32 type):LLRenderPass(type) { mShiny = FALSE; } + LLDrawPoolBump(const U32 type):LLRenderPass(type) { mShiny = false; } public: static U32 sVertexMask; - BOOL mShiny; + bool mShiny; virtual U32 getVertexDataMask() override { return sVertexMask; } @@ -76,11 +76,11 @@ public: virtual S32 getNumPostDeferredPasses() override { return 1; } /*virtual*/ void renderPostDeferred(S32 pass) override; - static BOOL bindBumpMap(LLDrawInfo& params, S32 channel = -2); - static BOOL bindBumpMap(LLFace* face, S32 channel = -2); + static bool bindBumpMap(LLDrawInfo& params, S32 channel = -2); + static bool bindBumpMap(LLFace* face, S32 channel = -2); private: - static BOOL bindBumpMap(U8 bump_code, LLViewerTexture* tex, S32 channel); + static bool bindBumpMap(U8 bump_code, LLViewerTexture* tex, S32 channel); bool mRigged = false; // if true, doing a rigged pass }; @@ -140,14 +140,14 @@ public: LLViewerTexture* getBrightnessDarknessImage(LLViewerFetchedTexture* src_image, U8 bump_code); void addTextureStats(U8 bump, const LLUUID& base_image_id, F32 virtual_size); - static void onSourceBrightnessLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ); - static void onSourceDarknessLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ); - static void onSourceStandardLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ); + static void onSourceBrightnessLoaded( bool success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, bool final, void* userdata ); + static void onSourceDarknessLoaded( bool success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, bool final, void* userdata ); + static void onSourceStandardLoaded( bool success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, bool final, void* userdata ); static void generateNormalMapFromAlpha(LLImageRaw* src, LLImageRaw* nrm_image); private: - static void onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLImageRaw* src, LLUUID& source_asset_id, EBumpEffect bump ); + static void onSourceLoaded( bool success, LLViewerTexture *src_vi, LLImageRaw* src, LLUUID& source_asset_id, EBumpEffect bump ); private: typedef std::unordered_map<LLUUID, LLPointer<LLViewerTexture> > bump_image_map_t; diff --git a/indra/newview/lldrawpoolmaterials.cpp b/indra/newview/lldrawpoolmaterials.cpp index a098230d91..bbc93c2af9 100644 --- a/indra/newview/lldrawpoolmaterials.cpp +++ b/indra/newview/lldrawpoolmaterials.cpp @@ -250,7 +250,7 @@ void LLDrawPoolMaterials::renderDeferred(S32 pass) if (params.mAvatar != lastAvatar) { const LLVOAvatar::MatrixPaletteCache& mpc = params.mAvatar->updateSkinInfoMatrixPalette(params.mSkinInfo); - U32 count = mpc.mMatrixPalette.size(); + U32 count = static_cast<U32>(mpc.mMatrixPalette.size()); if (count == 0) { @@ -260,7 +260,7 @@ void LLDrawPoolMaterials::renderDeferred(S32 pass) mShader->uniformMatrix3x4fv(LLViewerShaderMgr::AVATAR_MATRIX, count, - FALSE, + false, (GLfloat*)&(mpc.mGLMp[0])); } } diff --git a/indra/newview/lldrawpoolpbropaque.cpp b/indra/newview/lldrawpoolpbropaque.cpp index a32b6b1687..4ea23412e6 100644 --- a/indra/newview/lldrawpoolpbropaque.cpp +++ b/indra/newview/lldrawpoolpbropaque.cpp @@ -1,25 +1,25 @@ -/** +/** * @file lldrawpoolpbropaque.cpp * @brief LLDrawPoolGLTFPBR class implementation * * $LicenseInfo:firstyear=2022&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2022, 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$ */ @@ -54,12 +54,14 @@ void LLDrawPoolGLTFPBR::renderDeferred(S32 pass) { llassert(!LLPipeline::sRenderingHUDs); - gDeferredPBROpaqueProgram.bind(); + if (mRenderType == LLPipeline::RENDER_TYPE_PASS_GLTF_PBR_ALPHA_MASK) + { + LL::GLTFSceneManager::instance().renderOpaque(); + } - LL::GLTFSceneManager::instance().renderOpaque(); + gDeferredPBROpaqueProgram.bind(); pushGLTFBatches(mRenderType); - gDeferredPBROpaqueProgram.bind(true); LL::GLTFSceneManager::instance().render(true, true); pushRiggedGLTFBatches(mRenderType + 1); diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp index 2b0ae260dc..836a90adab 100644 --- a/indra/newview/lldrawpoolsimple.cpp +++ b/indra/newview/lldrawpoolsimple.cpp @@ -36,43 +36,12 @@ #include "llspatialpartition.h" #include "llviewershadermgr.h" #include "llrender.h" +#include "gltfscenemanager.h" static LLTrace::BlockTimerStatHandle FTM_RENDER_SIMPLE_DEFERRED("Deferred Simple"); static LLTrace::BlockTimerStatHandle FTM_RENDER_GRASS_DEFERRED("Deferred Grass"); -static void setup_simple_shader(LLGLSLShader* shader) -{ - shader->bind(); -} - -static void setup_glow_shader(LLGLSLShader* shader) -{ - setup_simple_shader(shader); - if (LLPipeline::sRenderDeferred && !LLPipeline::sRenderingHUDs) - { - shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f); - } - else - { - shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.f); - } -} - -static void setup_fullbright_shader(LLGLSLShader* shader) -{ - setup_glow_shader(shader); - - S32 channel = shader->enableTexture(LLShaderMgr::EXPOSURE_MAP); - if (channel > -1) - { - gGL.getTexUnit(channel)->bind(&gPipeline.mExposureMap); - } - - shader->uniform1f(LLViewerShaderMgr::FULLBRIGHT, 1.f); -} - - void LLDrawPoolGlow::renderPostDeferred(S32 pass) { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; @@ -89,12 +58,12 @@ void LLDrawPoolGlow::renderPostDeferred(S32 pass) gGL.setColorMask(false, true); //first pass -- static objects - setup_glow_shader(shader); + shader->bind(); pushBatches(LLRenderPass::PASS_GLOW, true, true); // second pass -- rigged objects shader = shader->mRiggedVariant; - setup_glow_shader(shader); + shader->bind(); pushRiggedBatches(LLRenderPass::PASS_GLOW_RIGGED, true, true); gGL.setColorMask(true, false); @@ -133,11 +102,11 @@ void LLDrawPoolSimple::renderDeferred(S32 pass) LLGLDisable blend(GL_BLEND); //render static - setup_simple_shader(&gDeferredDiffuseProgram); + gDeferredDiffuseProgram.bind(); pushBatches(LLRenderPass::PASS_SIMPLE, true, true); //render rigged - setup_simple_shader(gDeferredDiffuseProgram.mRiggedVariant); + gDeferredDiffuseProgram.bind(true); pushRiggedBatches(LLRenderPass::PASS_SIMPLE_RIGGED, true, true); } @@ -150,11 +119,11 @@ void LLDrawPoolAlphaMask::renderDeferred(S32 pass) LLGLSLShader* shader = &gDeferredDiffuseAlphaMaskProgram; //render static - setup_simple_shader(shader); + shader->bind(); pushMaskBatches(LLRenderPass::PASS_ALPHA_MASK, true, true); //render rigged - setup_simple_shader(shader->mRiggedVariant); + shader->bind(true); pushRiggedMaskBatches(LLRenderPass::PASS_ALPHA_MASK_RIGGED, true, true); } @@ -201,13 +170,13 @@ void LLDrawPoolFullbright::renderPostDeferred(S32 pass) gGL.setSceneBlendType(LLRender::BT_ALPHA); // render static - setup_fullbright_shader(shader); + shader->bind(); pushBatches(LLRenderPass::PASS_FULLBRIGHT, true, true); if (!LLPipeline::sRenderingHUDs) { // render rigged - setup_fullbright_shader(shader->mRiggedVariant); + shader->bind(true); pushRiggedBatches(LLRenderPass::PASS_FULLBRIGHT_RIGGED, true, true); } } @@ -216,6 +185,10 @@ void LLDrawPoolFullbrightAlphaMask::renderPostDeferred(S32 pass) { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_FULLBRIGHT); + // render unrigged unlit GLTF + LL::GLTFSceneManager::instance().render(true, false, true); + LL::GLTFSceneManager::instance().render(true, true, true); + LLGLSLShader* shader = nullptr; if (LLPipeline::sRenderingHUDs) { @@ -229,13 +202,13 @@ void LLDrawPoolFullbrightAlphaMask::renderPostDeferred(S32 pass) LLGLDisable blend(GL_BLEND); // render static - setup_fullbright_shader(shader); + shader->bind(); pushMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, true, true); if (!LLPipeline::sRenderingHUDs) { // render rigged - setup_fullbright_shader(shader->mRiggedVariant); + shader->bind(true); pushRiggedMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK_RIGGED, true, true); } } diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index 02a77dc418..c8af45a907 100644 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -202,11 +202,11 @@ void LLDrawPoolTerrain::drawLoop() void LLDrawPoolTerrain::renderFullShader() { - const BOOL use_local_materials = gLocalTerrainMaterials.materialsReady(true, false); + const bool use_local_materials = gLocalTerrainMaterials.makeMaterialsReady(true, false); // Hack! Get the region that this draw pool is rendering from! LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion(); LLVLComposition *compp = regionp->getComposition(); - const BOOL use_textures = !use_local_materials && (compp->getMaterialType() == LLTerrainMaterials::Type::TEXTURE); + const bool use_textures = !use_local_materials && (compp->getMaterialType() == LLTerrainMaterials::Type::TEXTURE); if (use_textures) { @@ -325,12 +325,12 @@ void LLDrawPoolTerrain::renderFullShaderTextures() } // *TODO: Investigate use of bindFast for PBR terrain textures -void LLDrawPoolTerrain::renderFullShaderPBR(BOOL local_materials) +void LLDrawPoolTerrain::renderFullShaderPBR(bool local_materials) { // Hack! Get the region that this draw pool is rendering from! LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion(); LLVLComposition *compp = regionp->getComposition(); - LLPointer<LLFetchedGLTFMaterial> (*fetched_materials)[LLVLComposition::ASSET_COUNT] = &compp->mDetailMaterials; + LLPointer<LLFetchedGLTFMaterial> (*fetched_materials)[LLVLComposition::ASSET_COUNT] = &compp->mDetailRenderMaterials; constexpr U32 terrain_material_count = LLVLComposition::ASSET_COUNT; #ifdef SHOW_ASSERT @@ -341,7 +341,7 @@ void LLDrawPoolTerrain::renderFullShaderPBR(BOOL local_materials) if (local_materials) { // Override region terrain with the global local override terrain - fetched_materials = &gLocalTerrainMaterials.mDetailMaterials; + fetched_materials = &gLocalTerrainMaterials.mDetailRenderMaterials; } const LLGLTFMaterial* materials[terrain_material_count]; for (U32 i = 0; i < terrain_material_count; ++i) @@ -432,14 +432,50 @@ void LLDrawPoolTerrain::renderFullShaderPBR(BOOL local_materials) LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; llassert(shader); - LLGLTFMaterial::TextureTransform base_color_transform; - base_color_transform.mScale = LLVector2(sPBRDetailScale, sPBRDetailScale); - // *TODO: mOffset and mRotation left at defaults for now. (per-material texture transforms are implemented in another branch) - F32 base_color_packed[8]; - base_color_transform.getPacked(base_color_packed); - // *HACK: Use the same texture repeats for all PBR terrain textures for now - // (not compliant with KHR texture transform spec) - shader->uniform4fv(LLShaderMgr::TEXTURE_BASE_COLOR_TRANSFORM, 2, (F32*)base_color_packed); + // Like for PBR materials, PBR terrain texture transforms are defined by + // the KHR_texture_transform spec, but with the following notable + // differences: + // 1) The PBR UV origin is defined as the Southwest corner of the region, + // with positive U facing East and positive V facing South. + // 2) There is an additional scaling factor RenderTerrainPBRScale. If + // we've done our math right, RenderTerrainPBRScale should not affect the + // overall behavior of KHR_texture_transform + // 3) There is only one texture transform per material, whereas + // KHR_texture_transform supports one texture transform per texture info. + // i.e. this isn't fully compliant with KHR_texture_transform, but is + // compliant when all texture infos used by a material have the same + // texture transform. + LLGLTFMaterial::TextureTransform::PackTight transforms_packed[terrain_material_count]; + for (U32 i = 0; i < terrain_material_count; ++i) + { + const LLFetchedGLTFMaterial* fetched_material = (*fetched_materials)[i].get(); + LLGLTFMaterial::TextureTransform transform; + if (fetched_material) + { + transform = fetched_material->mTextureTransform[LLGLTFMaterial::GLTF_TEXTURE_INFO_BASE_COLOR]; +#ifdef SHOW_ASSERT + // Assert condition where the contents of the texture transforms + // differ per texture info - we currently don't support this case. + for (U32 ti = 1; ti < LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; ++ti) + { + llassert(fetched_material->mTextureTransform[0] == fetched_material->mTextureTransform[ti]); + } +#endif + } + // *NOTE: Notice here we are combining the scale from + // RenderTerrainPBRScale into the KHR_texture_transform. This only + // works if the scale is uniform and no other transforms are + // applied to the terrain UVs. + transform.mScale.mV[VX] *= sPBRDetailScale; + transform.mScale.mV[VY] *= sPBRDetailScale; + + transform.getPackedTight(transforms_packed[i]); + } + const U32 transform_param_count = LLGLTFMaterial::TextureTransform::PACK_TIGHT_SIZE * terrain_material_count; + constexpr U32 vec4_size = 4; + const U32 transform_vec4_count = (transform_param_count + (vec4_size - 1)) / vec4_size; + llassert(transform_vec4_count == 5); // If false, need to update shader + shader->uniform4fv(LLShaderMgr::TERRAIN_TEXTURE_TRANSFORMS, transform_vec4_count, (F32*)transforms_packed); LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater(); diff --git a/indra/newview/lldrawpoolterrain.h b/indra/newview/lldrawpoolterrain.h index 5ee91eb47c..a8097fb58b 100644 --- a/indra/newview/lldrawpoolterrain.h +++ b/indra/newview/lldrawpoolterrain.h @@ -80,7 +80,7 @@ protected: void renderFull4TU(); void renderFullShader(); void renderFullShaderTextures(); - void renderFullShaderPBR(BOOL local_materials = false); + void renderFullShaderPBR(bool local_materials = false); void drawLoop(); private: diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp index 43620747d4..6efd503574 100644 --- a/indra/newview/lldrawpooltree.cpp +++ b/indra/newview/lldrawpooltree.cpp @@ -132,9 +132,9 @@ void LLDrawPoolTree::endShadowPass(S32 pass) gDeferredTreeShadowProgram.unbind(); } -BOOL LLDrawPoolTree::verify() const +bool LLDrawPoolTree::verify() const { - return TRUE; + return true; } LLViewerTexture *LLDrawPoolTree::getTexture() diff --git a/indra/newview/lldrawpooltree.h b/indra/newview/lldrawpooltree.h index 773c28ad66..b13ae6c16d 100644 --- a/indra/newview/lldrawpooltree.h +++ b/indra/newview/lldrawpooltree.h @@ -55,7 +55,7 @@ public: /*virtual*/ void endShadowPass(S32 pass); /*virtual*/ void renderShadow(S32 pass); - /*virtual*/ BOOL verify() const; + /*virtual*/ bool verify() const; /*virtual*/ LLViewerTexture *getTexture(); /*virtual*/ LLViewerTexture *getDebugTexture(); /*virtual*/ LLColor3 getDebugColor() const; // For AGP debug display diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index 938bcc37ff..71b82b77eb 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -49,12 +49,12 @@ #include "llsettingssky.h" #include "llsettingswater.h" -BOOL LLDrawPoolWater::sSkipScreenCopy = FALSE; -BOOL LLDrawPoolWater::sNeedsReflectionUpdate = TRUE; -BOOL LLDrawPoolWater::sNeedsDistortionUpdate = TRUE; +bool LLDrawPoolWater::sSkipScreenCopy = false; +bool LLDrawPoolWater::sNeedsReflectionUpdate = true; +bool LLDrawPoolWater::sNeedsDistortionUpdate = true; F32 LLDrawPoolWater::sWaterFogEnd = 0.f; -extern BOOL gCubeSnapshot; +extern bool gCubeSnapshot; LLDrawPoolWater::LLDrawPoolWater() : LLFacePool(POOL_WATER) { @@ -256,7 +256,7 @@ void LLDrawPoolWater::renderPostDeferred(S32 pass) if (mShaderLevel == 1) { - fog_color.mV[VW] = log(fog_density) / log(2); + fog_color.mV[VALPHA] = log(fog_density) / log(2); } F32 water_height = environment.getWaterHeight(); @@ -325,8 +325,8 @@ void LLDrawPoolWater::renderPostDeferred(S32 pass) // Note non-void water being drawn, updates required if (!edge) // SL-16461 remove !LLPipeline::sUseOcclusion check { - sNeedsReflectionUpdate = TRUE; - sNeedsDistortionUpdate = TRUE; + sNeedsReflectionUpdate = true; + sNeedsDistortionUpdate = true; } } } diff --git a/indra/newview/lldrawpoolwater.h b/indra/newview/lldrawpoolwater.h index a9944e27e6..f64477a059 100644 --- a/indra/newview/lldrawpoolwater.h +++ b/indra/newview/lldrawpoolwater.h @@ -44,9 +44,9 @@ protected: LLPointer<LLViewerTexture> mOpaqueWaterImagep; public: - static BOOL sSkipScreenCopy; - static BOOL sNeedsReflectionUpdate; - static BOOL sNeedsDistortionUpdate; + static bool sSkipScreenCopy; + static bool sNeedsReflectionUpdate; + static bool sNeedsDistortionUpdate; static F32 sWaterFogEnd; enum diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index c16b6408d7..047e9a8112 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -46,7 +46,7 @@ #include "llsettingsvo.h" #include "llviewercontrol.h" -extern BOOL gCubeSnapshot; +extern bool gCubeSnapshot; static LLStaticHashedString sCamPosLocal("camPosLocal"); static LLStaticHashedString sCustomAlpha("custom_alpha"); diff --git a/indra/newview/lldrawpoolwlsky.h b/indra/newview/lldrawpoolwlsky.h index 19e1e060fa..3c4b94b467 100644 --- a/indra/newview/lldrawpoolwlsky.h +++ b/indra/newview/lldrawpoolwlsky.h @@ -43,7 +43,7 @@ public: LLDrawPoolWLSky(void); /*virtual*/ ~LLDrawPoolWLSky(); - /*virtual*/ BOOL isDead() { return FALSE; } + /*virtual*/ bool isDead() { return false; } /*virtual*/ S32 getNumDeferredPasses() { return 1; } /*virtual*/ void beginDeferredPass(S32 pass); @@ -52,13 +52,13 @@ public: /*virtual*/ LLViewerTexture *getDebugTexture(); /*virtual*/ U32 getVertexDataMask() { return SKY_VERTEX_DATA_MASK; } - /*virtual*/ BOOL verify() const { return TRUE; } // Verify that all data in the draw pool is correct! + /*virtual*/ bool verify() const { return true; } // Verify that all data in the draw pool is correct! /*virtual*/ S32 getShaderLevel() const { return mShaderLevel; } //static LLDrawPool* createPool(const U32 type, LLViewerTexture *tex0 = NULL); /*virtual*/ LLViewerTexture* getTexture(); - /*virtual*/ BOOL isFacePool() { return FALSE; } + /*virtual*/ bool isFacePool() { return false; } /*virtual*/ void resetDrawOrders(); static void cleanupGL(); diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp index f1145948a7..fe6cd4e37d 100644 --- a/indra/newview/lldynamictexture.cpp +++ b/indra/newview/lldynamictexture.cpp @@ -50,8 +50,8 @@ S32 LLViewerDynamicTexture::sNumRenders = 0; //----------------------------------------------------------------------------- // LLViewerDynamicTexture() //----------------------------------------------------------------------------- -LLViewerDynamicTexture::LLViewerDynamicTexture(S32 width, S32 height, S32 components, EOrder order, BOOL clamp) : - LLViewerTexture(width, height, components, FALSE), +LLViewerDynamicTexture::LLViewerDynamicTexture(S32 width, S32 height, S32 components, EOrder order, bool clamp) : + LLViewerTexture(width, height, components, false), mClamp(clamp) { llassert((1 <= components) && (components <= 4)); @@ -85,10 +85,10 @@ S8 LLViewerDynamicTexture::getType() const void LLViewerDynamicTexture::generateGLTexture() { LLViewerTexture::generateGLTexture() ; - generateGLTexture(-1, 0, 0, FALSE); + generateGLTexture(-1, 0, 0, false); } -void LLViewerDynamicTexture::generateGLTexture(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, BOOL swap_bytes) +void LLViewerDynamicTexture::generateGLTexture(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, bool swap_bytes) { if (mComponents < 1 || mComponents > 4) { @@ -100,7 +100,7 @@ void LLViewerDynamicTexture::generateGLTexture(LLGLint internal_format, LLGLenum { setExplicitFormat(internal_format, primary_format, type_format, swap_bytes); } - createGLTexture(0, raw_image, 0, TRUE, LLGLTexture::DYNAMIC_TEX); + createGLTexture(0, raw_image, 0, true, LLGLTexture::DYNAMIC_TEX); setAddressMode((mClamp) ? LLTexUnit::TAM_CLAMP : LLTexUnit::TAM_WRAP); mGLTexturep->setGLTextureCreated(false); } @@ -108,15 +108,15 @@ void LLViewerDynamicTexture::generateGLTexture(LLGLint internal_format, LLGLenum //----------------------------------------------------------------------------- // render() //----------------------------------------------------------------------------- -BOOL LLViewerDynamicTexture::render() +bool LLViewerDynamicTexture::render() { - return FALSE; + return false; } //----------------------------------------------------------------------------- // preRender() //----------------------------------------------------------------------------- -void LLViewerDynamicTexture::preRender(BOOL clear_depth) +void LLViewerDynamicTexture::preRender(bool clear_depth) { LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; @@ -142,7 +142,7 @@ void LLViewerDynamicTexture::preRender(BOOL clear_depth) //----------------------------------------------------------------------------- // postRender() //----------------------------------------------------------------------------- -void LLViewerDynamicTexture::postRender(BOOL success) +void LLViewerDynamicTexture::postRender(bool success) { { if (success) @@ -181,14 +181,14 @@ void LLViewerDynamicTexture::postRender(BOOL success) // updateDynamicTextures() // Calls update on each dynamic texture. Calls each group in order: "first," then "middle," then "last." //----------------------------------------------------------------------------- -BOOL LLViewerDynamicTexture::updateAllInstances() +bool LLViewerDynamicTexture::updateAllInstances() { LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; sNumRenders = 0; if (gGLManager.mIsDisabled) { - return TRUE; + return true; } LLRenderTarget& bake_target = gPipeline.mAuxillaryRT.deferredScreen; @@ -196,7 +196,7 @@ BOOL LLViewerDynamicTexture::updateAllInstances() if (!bake_target.isComplete()) { llassert(false); - return FALSE; + return false; } llassert(bake_target.getWidth() >= LLPipeline::MAX_BAKE_WIDTH); llassert(bake_target.getHeight() >= LLPipeline::MAX_BAKE_WIDTH); @@ -207,8 +207,8 @@ BOOL LLViewerDynamicTexture::updateAllInstances() LLGLSLShader::unbind(); LLVertexBuffer::unbind(); - BOOL result = FALSE; - BOOL ret = FALSE ; + bool result = false; + bool ret = false ; for( S32 order = 0; order < ORDER_COUNT; order++ ) { for (instance_list_t::iterator iter = LLViewerDynamicTexture::sInstances[order].begin(); @@ -217,19 +217,19 @@ BOOL LLViewerDynamicTexture::updateAllInstances() LLViewerDynamicTexture *dynamicTexture = *iter; if (dynamicTexture->needsRender()) { - llassert(dynamicTexture->getFullWidth() <= LLPipeline::MAX_BAKE_WIDTH); - llassert(dynamicTexture->getFullHeight() <= LLPipeline::MAX_BAKE_WIDTH); + llassert(dynamicTexture->getFullWidth() <= S32(LLPipeline::MAX_BAKE_WIDTH)); + llassert(dynamicTexture->getFullHeight() <= S32(LLPipeline::MAX_BAKE_WIDTH)); glClear(GL_DEPTH_BUFFER_BIT); gGL.color4f(1,1,1,1); dynamicTexture->setBoundTarget(&bake_target); dynamicTexture->preRender(); // Must be called outside of startRender() - result = FALSE; + result = false; if (dynamicTexture->render()) { - ret = TRUE ; - result = TRUE; + ret = true ; + result = true; sNumRenders++; } gGL.flush(); diff --git a/indra/newview/lldynamictexture.h b/indra/newview/lldynamictexture.h index 118afb4d5a..375828fefa 100644 --- a/indra/newview/lldynamictexture.h +++ b/indra/newview/lldynamictexture.h @@ -60,7 +60,7 @@ public: S32 height, S32 components, // = 4, EOrder order, // = ORDER_MIDDLE, - BOOL clamp); + bool clamp); /*virtual*/ S8 getType() const ; @@ -69,15 +69,15 @@ public: S32 getSize() { return mFullWidth * mFullHeight * mComponents; } - virtual BOOL needsRender() { return TRUE; } - virtual void preRender(BOOL clear_depth = TRUE); - virtual BOOL render(); - virtual void postRender(BOOL success); + virtual bool needsRender() { return true; } + virtual void preRender(bool clear_depth = true); + virtual bool render(); + virtual void postRender(bool success); virtual void restoreGLTexture() {} virtual void destroyGLTexture() {} - static BOOL updateAllInstances(); + static bool updateAllInstances(); static void destroyGL() ; static void restoreGL() ; @@ -85,10 +85,10 @@ public: protected: void generateGLTexture(); - void generateGLTexture(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, BOOL swap_bytes = FALSE); + void generateGLTexture(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, bool swap_bytes = false); protected: - BOOL mClamp; + bool mClamp; LLCoordGL mOrigin; LL_ALIGN_16(LLCamera mCamera); diff --git a/indra/newview/llemote.cpp b/indra/newview/llemote.cpp index 95ced2008f..e952a29c54 100644 --- a/indra/newview/llemote.cpp +++ b/indra/newview/llemote.cpp @@ -74,7 +74,7 @@ LLMotion::LLMotionInitStatus LLEmote::onInitialize(LLCharacter *character) //----------------------------------------------------------------------------- // LLEmote::onActivate() //----------------------------------------------------------------------------- -BOOL LLEmote::onActivate() +bool LLEmote::onActivate() { LLVisualParam* default_param = mCharacter->getVisualParam( "Express_Closed_Mouth" ); if( default_param ) @@ -89,14 +89,14 @@ BOOL LLEmote::onActivate() mCharacter->updateVisualParams(); } - return TRUE; + return true; } //----------------------------------------------------------------------------- // LLEmote::onUpdate() //----------------------------------------------------------------------------- -BOOL LLEmote::onUpdate(F32 time, U8* joint_mask) +bool LLEmote::onUpdate(F32 time, U8* joint_mask) { if( mParam ) { @@ -116,7 +116,7 @@ BOOL LLEmote::onUpdate(F32 time, U8* joint_mask) mCharacter->updateVisualParams(); } - return TRUE; + return true; } diff --git a/indra/newview/llemote.h b/indra/newview/llemote.h index f1b9d4a18d..3c453fee7b 100644 --- a/indra/newview/llemote.h +++ b/indra/newview/llemote.h @@ -69,7 +69,7 @@ public: //------------------------------------------------------------------------- // motions must specify whether or not they loop - virtual BOOL getLoop() { return FALSE; } + virtual bool getLoop() { return false; } // motions must report their total duration virtual F32 getDuration() { return EMOTE_MORPH_FADEIN_TIME + EMOTE_MORPH_IN_TIME + EMOTE_MORPH_FADEOUT_TIME; } @@ -94,19 +94,19 @@ public: virtual LLMotionInitStatus onInitialize(LLCharacter *character); // called when a motion is activated - // must return TRUE to indicate success, or else + // must return true to indicate success, or else // it will be deactivated - virtual BOOL onActivate(); + virtual bool onActivate(); // called per time step - // must return TRUE while it is active, and - // must return FALSE when the motion is completed. - virtual BOOL onUpdate(F32 time, U8* joint_mask); + // must return true while it is active, and + // must return false when the motion is completed. + virtual bool onUpdate(F32 time, U8* joint_mask); // called when a motion is deactivated virtual void onDeactivate(); - virtual BOOL canDeprecate() { return FALSE; } + virtual bool canDeprecate() { return false; } protected: diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 3c0a523317..8884905cf0 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -757,7 +757,7 @@ namespace LLEnvironment::DayInstance::ptr_t getBaseDayInstance() const { return mBaseDayInstance; } void setBaseDayInstance(const LLEnvironment::DayInstance::ptr_t &baseday); - S32 countExperiencesActive() const { return mActiveExperiences.size(); } + S32 countExperiencesActive() const { return static_cast<S32>(mActiveExperiences.size()); } bool isOverriddenSky() const { return !mSkyExperience.isNull(); } bool isOverriddenWater() const { return !mWaterExperience.isNull(); } @@ -1647,7 +1647,7 @@ LLVector4 LLEnvironment::getRotatedLightNorm() const return toLightNorm(light_direction); } -extern BOOL gCubeSnapshot; +extern bool gCubeSnapshot; //------------------------------------------------------------------------- void LLEnvironment::update(const LLViewerCamera * cam) @@ -1680,15 +1680,15 @@ void LLEnvironment::update(const LLViewerCamera * cam) end_shaders = LLViewerShaderMgr::instance()->endShaders(); for (shaders_iter = LLViewerShaderMgr::instance()->beginShaders(); shaders_iter != end_shaders; ++shaders_iter) { - if ((shaders_iter->mProgramObject != 0) - && (gPipeline.canUseWindLightShaders() - || shaders_iter->mShaderGroup == LLGLSLShader::SG_WATER)) + shaders_iter->mUniformsDirty = true; + if (shaders_iter->mRiggedVariant) { - shaders_iter->mUniformsDirty = TRUE; - if (shaders_iter->mRiggedVariant) - { - shaders_iter->mRiggedVariant->mUniformsDirty = TRUE; - } + shaders_iter->mRiggedVariant->mUniformsDirty = true; + } + + for (auto& variant : shaders_iter->mGLTFVariants) + { + variant.mUniformsDirty = true; } } } @@ -2512,7 +2512,7 @@ LLSettingsDay::ptr_t LLEnvironment::createDayCycleFromEnvironment(EnvSelection_t if (type == "sky") { - for (S32 idx = 1; idx < LLSettingsDay::TRACK_MAX; ++idx) + for (U32 idx = 1; idx < LLSettingsDay::TRACK_MAX; ++idx) day->clearCycleTrack(idx); day->setSettingsAtKeyframe(settings, 0.0f, 1); } diff --git a/indra/newview/lleventnotifier.cpp b/indra/newview/lleventnotifier.cpp index 93389bbc0f..16897e9ebd 100644 --- a/indra/newview/lleventnotifier.cpp +++ b/indra/newview/lleventnotifier.cpp @@ -294,14 +294,13 @@ void LLEventNotifier::load(const LLSD& event_options) } - -BOOL LLEventNotifier::hasNotification(const U32 event_id) +bool LLEventNotifier::hasNotification(const U32 event_id) { if (mEventNotifications.find(event_id) != mEventNotifications.end()) { - return TRUE; + return true; } - return FALSE; + return false; } void LLEventNotifier::remove(const U32 event_id) diff --git a/indra/newview/lleventnotifier.h b/indra/newview/lleventnotifier.h index d8ab2bafce..f013f6d02e 100644 --- a/indra/newview/lleventnotifier.h +++ b/indra/newview/lleventnotifier.h @@ -68,7 +68,7 @@ public: void load(const LLSD& event_options); // In the format that it comes in from login void remove(U32 event_id); - BOOL hasNotification(const U32 event_id); + bool hasNotification(const U32 event_id); void serverPushRequest(U32 event_id, bool add); typedef std::map<U32, LLEventNotification *> en_map; diff --git a/indra/newview/llexpandabletextbox.cpp b/indra/newview/llexpandabletextbox.cpp index 7ac90a04db..4c105176b6 100644 --- a/indra/newview/llexpandabletextbox.cpp +++ b/indra/newview/llexpandabletextbox.cpp @@ -93,12 +93,12 @@ public: } /*virtual*/ bool canEdit() const { return false; } // eat handleMouseDown event so we get the mouseup event - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask) { return TRUE; } - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask) { mEditor.onCommit(); return TRUE; } - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask) + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask) { return true; } + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask) { mEditor.onCommit(); return true; } + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask) { LLUI::getInstance()->getWindow()->setCursor(UI_CURSOR_HAND); - return TRUE; + return true; } private: LLTextBase& mEditor; @@ -115,11 +115,11 @@ LLExpandableTextBox::LLTextBoxEx::LLTextBoxEx(const Params& p) mExpanderLabel(p.label.isProvided() ? p.label : LLTrans::getString("More")), mExpanderVisible(false) { - setIsChrome(TRUE); + setIsChrome(true); setMaxTextLength(p.max_text_length); } -void LLExpandableTextBox::LLTextBoxEx::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLExpandableTextBox::LLTextBoxEx::reshape(S32 width, S32 height, bool called_from_parent) { LLTextEditor::reshape(width, height, called_from_parent); } @@ -253,11 +253,11 @@ void LLExpandableTextBox::draw() { if(mBGVisible && !mExpanded) { - gl_rect_2d(getLocalRect(), mBGColor.get(), TRUE); + gl_rect_2d(getLocalRect(), mBGColor.get(), true); } if(mExpandedBGVisible && mExpanded) { - gl_rect_2d(getLocalRect(), mExpandedBGColor.get(), TRUE); + gl_rect_2d(getLocalRect(), mExpandedBGColor.get(), true); } collapseIfPosChanged(); @@ -389,10 +389,10 @@ void LLExpandableTextBox::expandTextBox() // expand text box localRectToOtherView(expanded_rect, &expanded_screen_rect, getParent()); - reshape(expanded_screen_rect.getWidth(), expanded_screen_rect.getHeight(), FALSE); + reshape(expanded_screen_rect.getWidth(), expanded_screen_rect.getHeight(), false); setRect(expanded_screen_rect); - setFocus(TRUE); + setFocus(true); // this lets us receive top_lost event(needed to collapse text box) // it also draws text box above all other ui elements gViewerWindow->addPopup(this); @@ -409,7 +409,7 @@ void LLExpandableTextBox::collapseTextBox() mExpanded = false; - reshape(mCollapsedRect.getWidth(), mCollapsedRect.getHeight(), FALSE); + reshape(mCollapsedRect.getWidth(), mCollapsedRect.getHeight(), false); setRect(mCollapsedRect); updateTextBoxRect(); @@ -436,7 +436,7 @@ void LLExpandableTextBox::updateTextShape() updateTextBoxRect(); } -void LLExpandableTextBox::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLExpandableTextBox::reshape(S32 width, S32 height, bool called_from_parent) { mExpanded = false; LLUICtrl::reshape(width, height, called_from_parent); diff --git a/indra/newview/llexpandabletextbox.h b/indra/newview/llexpandabletextbox.h index d992f3131a..f074b0e6ad 100644 --- a/indra/newview/llexpandabletextbox.h +++ b/indra/newview/llexpandabletextbox.h @@ -52,7 +52,7 @@ protected: }; // adds or removes "More" link as needed - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true); /*virtual*/ void setText(const LLStringExplicit& text, const LLStyle::Params& input_params = LLStyle::Params()); void setTextBase(const std::string& text) { LLTextBase::setText(text); } @@ -147,7 +147,7 @@ public: * *HACK: Update the inner textbox shape. */ void updateTextShape(); - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + virtual void reshape(S32 width, S32 height, bool called_from_parent = true); /** * Draws text box, collapses text box if its expanded and its parent's position changed diff --git a/indra/newview/llexternaleditor.cpp b/indra/newview/llexternaleditor.cpp index f96dd6fe67..3decd15bbd 100644 --- a/indra/newview/llexternaleditor.cpp +++ b/indra/newview/llexternaleditor.cpp @@ -136,8 +136,8 @@ size_t LLExternalEditor::tokenize(string_vec_t& tokens, const std::string& str) tokenizer tokens_list(str, sep); tokenizer::iterator token_iter; - BOOL inside_quotes = FALSE; - BOOL last_was_space = FALSE; + bool inside_quotes = false; + bool last_was_space = false; for (token_iter = tokens_list.begin(); token_iter != tokens_list.end(); ++token_iter) { if (!strncmp("\"",(*token_iter).c_str(),2)) @@ -149,7 +149,7 @@ size_t LLExternalEditor::tokenize(string_vec_t& tokens, const std::string& str) if(inside_quotes) { tokens.back().append(std::string(" ")); - last_was_space = TRUE; + last_was_space = true; } } else @@ -158,7 +158,7 @@ size_t LLExternalEditor::tokenize(string_vec_t& tokens, const std::string& str) if (last_was_space) { tokens.back().append(to_push); - last_was_space = FALSE; + last_was_space = false; } else { diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index e46043b77e..a25879ab3a 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -62,7 +62,7 @@ static LLStaticHashedString sTextureIndexIn("texture_index_in"); static LLStaticHashedString sColorIn("color_in"); -BOOL LLFace::sSafeRenderSelect = TRUE; // FALSE +bool LLFace::sSafeRenderSelect = true; // false #define DOTVEC(a,b) (a.mV[0]*b.mV[0] + a.mV[1]*b.mV[1] + a.mV[2]*b.mV[2]) @@ -322,7 +322,7 @@ void LLFace::dirtyTexture() LLVOVolume* vobj = drawablep->getVOVolume(); if (vobj) { - vobj->mLODChanged = TRUE; + vobj->mLODChanged = true; vobj->updateVisualComplexity(); } @@ -628,13 +628,6 @@ void LLFace::renderOneWireframe(const LLColor4 &color, F32 fogCfx, bool wirefram { LLGLDisable depth(wireframe_selection ? 0 : GL_BLEND); - //LLGLEnable stencil(wireframe_selection ? 0 : GL_STENCIL_TEST); - - if (!wireframe_selection) - { //modify wireframe into outline selection mode - glStencilFunc(GL_NOTEQUAL, 2, 0xffff); - glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); - } #if GL_VERSION_1_1 LLGLEnable offset(GL_POLYGON_OFFSET_LINE); @@ -811,8 +804,8 @@ bool less_than_max_mag(const LLVector4a& vec) return lt == 0x7; } -BOOL LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f, - const LLMatrix4& mat_vert_in, BOOL global_volume) +bool LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f, + const LLMatrix4& mat_vert_in, bool global_volume) { LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE @@ -837,7 +830,7 @@ BOOL LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f, { LL_DEBUGS("RiggedBox") << "skipping face " << f << ", bad num vertices " << face.mNumVertices << " " << face.mNumIndices << " " << face.mWeights << LL_ENDL; - return FALSE; + return false; } //VECTORIZE THIS @@ -876,7 +869,7 @@ BOOL LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f, updateCenterAgent(); } - return TRUE; + return true; } @@ -1146,7 +1139,7 @@ void push_for_transform(LLVertexBuffer* buff, U32 source_count, U32 dest_count) } } -BOOL LLFace::getGeometryVolume(const LLVolume& volume, +bool LLFace::getGeometryVolume(const LLVolume& volume, S32 face_index, const LLMatrix4& mat_vert_in, const LLMatrix3& mat_norm_in, @@ -1167,7 +1160,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, " Attempt get access to: " << face_index << LL_ENDL; llassert(no_debug_assert); } - return FALSE; + return false; } bool rigged = isState(RIGGED); @@ -1183,7 +1176,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (mVertexBuffer.notNull()) { - if (num_indices + (S32) mIndicesIndex > mVertexBuffer->getNumIndices()) + if (num_indices + mIndicesIndex > mVertexBuffer->getNumIndices()) { if (gDebugGL) { @@ -1196,17 +1189,17 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, << " Pool Type: " << mPoolType << LL_ENDL; llassert(no_debug_assert); } - return FALSE; + return false; } - if (num_vertices + mGeomIndex > mVertexBuffer->getNumVerts()) + if (num_vertices + (U32)mGeomIndex > mVertexBuffer->getNumVerts()) { if (gDebugGL) { LL_WARNS() << "Vertex buffer overflow!" << LL_ENDL; llassert(no_debug_assert); } - return FALSE; + return false; } } @@ -1220,9 +1213,9 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, LLStrider<U16> indicesp; LLStrider<LLVector4> wght; - BOOL full_rebuild = force_rebuild || mDrawablep->isState(LLDrawable::REBUILD_VOLUME); + bool full_rebuild = force_rebuild || mDrawablep->isState(LLDrawable::REBUILD_VOLUME); - BOOL global_volume = mDrawablep->getVOVolume()->isVolumeGlobal(); + bool global_volume = mDrawablep->getVOVolume()->isVolumeGlobal(); LLVector3 scale; if (global_volume) { @@ -1244,8 +1237,8 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, const LLTextureEntry *tep = mVObjp->getTE(face_index); const U8 bump_code = tep ? tep->getBumpmap() : 0; - BOOL is_static = mDrawablep->isStatic(); - BOOL is_global = is_static; + bool is_static = mDrawablep->isStatic(); + bool is_global = is_static; LLVector3 center_sum(0.f, 0.f, 0.f); @@ -1258,11 +1251,15 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, clearState(GLOBAL); } - LLColor4U color = tep->getColor(); - - if (tep->getGLTFRenderMaterial()) + LLColor4U color{}; + if (tep) { - color = tep->getGLTFRenderMaterial()->mBaseColor; + color = tep->getColor(); + + if (tep->getGLTFRenderMaterial()) + { + color = tep->getGLTFRenderMaterial()->mBaseColor; + } } if (rebuild_color) @@ -1598,7 +1595,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, mask.setElement<2>(); mask.setElement<3>(); - U32 count = num_vertices/2 + num_vertices%2; + S32 count = num_vertices/2 + num_vertices%2; for (S32 i = 0; i < count; i++) { @@ -2014,7 +2011,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, } - return TRUE; + return true; } void LLFace::renderIndexed() @@ -2027,18 +2024,18 @@ void LLFace::renderIndexed() } //check if the face has a media -BOOL LLFace::hasMedia() const +bool LLFace::hasMedia() const { if(mHasMedia) { - return TRUE ; + return true ; } if(mTexture[LLRender::DIFFUSE_MAP].notNull()) { return mTexture[LLRender::DIFFUSE_MAP]->hasParcelMedia() ; //if has a parcel media } - return FALSE ; //no media. + return false ; //no media. } const F32 LEAST_IMPORTANCE = 0.05f ; @@ -2055,7 +2052,7 @@ F32 LLFace::getTextureVirtualSize() LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; F32 radius; F32 cos_angle_to_view_dir; - BOOL in_frustum = calcPixelArea(cos_angle_to_view_dir, radius); + bool in_frustum = calcPixelArea(cos_angle_to_view_dir, radius); if (mPixelArea < F_ALMOST_ZERO || !in_frustum) { @@ -2099,7 +2096,7 @@ F32 LLFace::getTextureVirtualSize() return face_area; } -BOOL LLFace::calcPixelArea(F32& cos_angle_to_view_dir, F32& radius) +bool LLFace::calcPixelArea(F32& cos_angle_to_view_dir, F32& radius) { LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE; @@ -2285,19 +2282,19 @@ F32 LLFace::adjustPixelArea(F32 importance, F32 pixel_area) return pixel_area ; } -BOOL LLFace::verify(const U32* indices_array) const +bool LLFace::verify(const U32* indices_array) const { - BOOL ok = TRUE; + bool ok = true; if( mVertexBuffer.isNull() ) { //no vertex buffer, face is implicitly valid - return TRUE; + return true; } // First, check whether the face data fits within the pool's range. - if ((mGeomIndex + mGeomCount) > mVertexBuffer->getNumVerts()) + if ((U32)(mGeomIndex + mGeomCount) > mVertexBuffer->getNumVerts()) { - ok = FALSE; + ok = false; LL_INFOS() << "Face references invalid vertices!" << LL_ENDL; } @@ -2305,18 +2302,18 @@ BOOL LLFace::verify(const U32* indices_array) const if (!indices_count) { - return TRUE; + return true; } if (indices_count > LL_MAX_INDICES_COUNT) { - ok = FALSE; + ok = false; LL_INFOS() << "Face has bogus indices count" << LL_ENDL; } if (mIndicesIndex + mIndicesCount > mVertexBuffer->getNumIndices()) { - ok = FALSE; + ok = false; LL_INFOS() << "Face references invalid indices!" << LL_ENDL; } @@ -2333,13 +2330,13 @@ BOOL LLFace::verify(const U32* indices_array) const { LL_WARNS() << "Face index too low!" << LL_ENDL; LL_INFOS() << "i:" << i << " Index:" << indicesp[i] << " GStart: " << geom_start << LL_ENDL; - ok = FALSE; + ok = false; } else if (delta >= geom_count) { LL_WARNS() << "Face index too high!" << LL_ENDL; LL_INFOS() << "i:" << i << " Index:" << indicesp[i] << " GEnd: " << geom_start + geom_count << LL_ENDL; - ok = FALSE; + ok = false; } } #endif diff --git a/indra/newview/llface.h b/indra/newview/llface.h index 6ee636a6c5..917f3aa0b2 100644 --- a/indra/newview/llface.h +++ b/indra/newview/llface.h @@ -107,7 +107,7 @@ public: void switchTexture(U32 ch, LLViewerTexture* new_texture); void dirtyTexture(); LLXformMatrix* getXform() const { return mXform; } - BOOL hasGeometry() const { return mGeomCount > 0; } + bool hasGeometry() const { return mGeomCount > 0; } LLVector3 getPositionAgent() const; LLVector2 surfaceToTexture(LLVector2 surface_coord, const LLVector4a& position, const LLVector4a& normal); void getPlanarProjectedParams(LLQuaternion* face_rot, LLVector3* face_pos, F32* scale) const; @@ -117,14 +117,14 @@ public: U32 getState() const { return mState; } void setState(U32 state) { mState |= state; } void clearState(U32 state) { mState &= ~state; } - BOOL isState(U32 state) const { return ((mState & state) != 0) ? TRUE : FALSE; } + bool isState(U32 state) const { return (mState & state) != 0; } void setVirtualSize(F32 size) { mVSize = size; } void setPixelArea(F32 area) { mPixelArea = area; } F32 getVirtualSize() const { return mVSize; } F32 getPixelArea() const { return mPixelArea; } - S32 getIndexInTex(U32 ch) const {llassert(ch < LLRender::NUM_TEXTURE_CHANNELS); return mIndexInTex[ch];} - void setIndexInTex(U32 ch, S32 index) { llassert(ch < LLRender::NUM_TEXTURE_CHANNELS); mIndexInTex[ch] = index ;} + S32 getIndexInTex(U32 ch) const { llassert(ch < LLRender::NUM_TEXTURE_CHANNELS); return mIndexInTex[ch]; } + void setIndexInTex(U32 ch, S32 index) { llassert(ch < LLRender::NUM_TEXTURE_CHANNELS); mIndexInTex[ch] = index; } void setWorldMatrix(const LLMatrix4& mat); const LLTextureEntry* getTextureEntry() const { return mVObjp->getTE(mTEOffset); } @@ -155,7 +155,7 @@ public: //for volumes void updateRebuildFlags(); bool canRenderAsMask(); // logic helper - BOOL getGeometryVolume(const LLVolume& volume, + bool getGeometryVolume(const LLVolume& volume, S32 face_index, const LLMatrix4& mat_vert, const LLMatrix3& mat_normal, @@ -182,8 +182,8 @@ public: void setSize(S32 numVertices, S32 num_indices = 0, bool align = false); - BOOL genVolumeBBoxes(const LLVolume &volume, S32 f, - const LLMatrix4& mat_vert_in, BOOL global_volume = FALSE); + bool genVolumeBBoxes(const LLVolume &volume, S32 f, + const LLMatrix4& mat_vert_in, bool global_volume = false); void init(LLDrawable* drawablep, LLViewerObject* objp); void destroy(); @@ -200,7 +200,7 @@ public: S32 getReferenceIndex() const { return mReferenceIndex; } void setReferenceIndex(const S32 index) { mReferenceIndex = index; } - BOOL verify(const U32* indices_array = NULL) const; + bool verify(const U32* indices_array = NULL) const; void printDebugInfo() const; void setGeomIndex(U16 idx); @@ -212,12 +212,12 @@ public: void resetVirtualSize(); void setHasMedia(bool has_media) { mHasMedia = has_media ;} - BOOL hasMedia() const ; + bool hasMedia() const ; void setMediaAllowed(bool is_media_allowed) { mIsMediaAllowed = is_media_allowed; } - BOOL isMediaAllowed() const { return mIsMediaAllowed; } + bool isMediaAllowed() const { return mIsMediaAllowed; } - BOOL switchTexture() ; + bool switchTexture() ; //vertex buffer tracking void setVertexBuffer(LLVertexBuffer* buffer); @@ -239,7 +239,7 @@ public: //aligned members private: friend class LLViewerTextureList; F32 adjustPartialOverlapPixelArea(F32 cos_angle_to_view_dir, F32 radius ); - BOOL calcPixelArea(F32& cos_angle_to_view_dir, F32& radius) ; + bool calcPixelArea(F32& cos_angle_to_view_dir, F32& radius) ; public: static F32 calcImportanceToCamera(F32 to_view_dir, F32 dist); static F32 adjustPixelArea(F32 importance, F32 pixel_area) ; @@ -309,7 +309,7 @@ private: U32 mDrawOrderIndex = 0; // see setDrawOrderIndex protected: - static BOOL sSafeRenderSelect; + static bool sSafeRenderSelect; public: struct CompareDistanceGreater diff --git a/indra/newview/llface.inl b/indra/newview/llface.inl deleted file mode 100644 index 566917d800..0000000000 --- a/indra/newview/llface.inl +++ /dev/null @@ -1,160 +0,0 @@ -/** - * @file llface.inl - * @brief Inline functions for LLFace - * - * $LicenseInfo:firstyear=2001&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_LLFACE_INL -#define LL_LLFACE_INL - -#include "llglheaders.h" -#include "llrender.h" - -inline BOOL LLFace::getDirty() const -{ - return (mGeneration != mDrawPoolp->mGeneration); -} - -inline void LLFace::clearDirty() -{ - mGeneration = mDrawPoolp->mGeneration; -} - -inline const LLTextureEntry* LLFace::getTextureEntry() const -{ - return mVObjp->getTE(mTEOffset); -} - -inline LLDrawPool* LLFace::getPool() const -{ - return mDrawPoolp; -} - -inline S32 LLFace::getStride() const -{ - return mDrawPoolp->getStride(); -} - -inline LLDrawable* LLFace::getDrawable() const -{ - return mDrawablep; -} - -inline LLViewerObject* LLFace::getViewerObject() const -{ - return mVObjp; -} - -inline S32 LLFace::getColors (LLStrider<LLColor4U> &colors) -{ - if (!mGeomCount) - { - return -1; - } - LLColor4U *colorp = NULL; - if (isState(BACKLIST)) - { - if (!mBackupMem) - { - printDebugInfo(); - LL_ERRS() << "No backup memory for face" << LL_ENDL; - } - colorp = (LLColor4U*)(mBackupMem + (4 * mIndicesCount) + (mGeomCount * mDrawPoolp->getStride())); - colors = colorp; - return 0; - } - else - { - llassert(mGeomIndex >= 0); - if (!mDrawPoolp->getColorStrider(colors, mGeomIndex)) - { - printDebugInfo(); - LL_ERRS() << "No color pointer for a color strider!" << LL_ENDL; - } - mDrawPoolp->setDirtyColors(); - return mGeomIndex; - } -} - -inline S32 LLFace::getTexCoords (LLStrider<LLVector2> &texCoords, S32 pass ) -{ - if (!mGeomCount) - { - return -1; - } - if (isState(BACKLIST)) - { - if (!mBackupMem) - { - printDebugInfo(); - LL_ERRS() << "No backup memory for face" << LL_ENDL; - } - texCoords = (LLVector2*)(mBackupMem + (4 * mIndicesCount) + mDrawPoolp->mDataOffsets[LLDrawPool::DATA_TEX_COORDS0 + pass]); - texCoords.setStride( mDrawPoolp->getStride()); - return 0; - } - else - { - llassert(mGeomIndex >= 0); - mDrawPoolp->getTexCoordStrider(texCoords, mGeomIndex, pass ); - mDrawPoolp->setDirty(); - return mGeomIndex; - } -} - -inline S32 LLFace::getIndices (U32* &indicesp) -{ - if (isState(BACKLIST)) - { - indicesp = (U32*)mBackupMem; - return 0; - } - else - { - indicesp = mDrawPoolp->getIndices(mIndicesIndex); - llassert(mGeomIndex >= 0); - return mGeomIndex; - } -} - -inline const U32* LLFace::getRawIndices() const -{ - llassert(!isState(BACKLIST)); - - return &mDrawPoolp->mIndices[mIndicesIndex]; -} - - -inline void LLFace::bindTexture(S32 stage) const -{ - if (mTexture) - { - mTexture->bindTexture(stage); - } - else - { - LLImageGL::unbindTexture(stage, GL_TEXTURE_2D); - } -} - -#endif diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index 4851f65c48..7391209935 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -59,15 +59,15 @@ using namespace LLTrace; -static const S32 MAX_VISIBLE_HISTORY = 12; -static const S32 LINE_GRAPH_HEIGHT = 240; -static const S32 MIN_BAR_HEIGHT = 3; -static const S32 RUNNING_AVERAGE_WIDTH = 100; -static const S32 NUM_FRAMES_HISTORY = 200; +static constexpr S32 MAX_VISIBLE_HISTORY = 12; +static constexpr S32 LINE_GRAPH_HEIGHT = 240; +static constexpr S32 MIN_BAR_HEIGHT = 3; +static constexpr S32 RUNNING_AVERAGE_WIDTH = 100; +static constexpr S32 NUM_FRAMES_HISTORY = 200; std::vector<BlockTimerStatHandle*> ft_display_idx; // line of table entry for display purposes (for collapse) -BOOL LLFastTimerView::sAnalyzePerformance = FALSE; +bool LLFastTimerView::sAnalyzePerformance = false; S32 get_depth(const BlockTimerStatHandle* blockp) { @@ -126,16 +126,16 @@ void LLFastTimerView::setPauseState(bool pause_state) mPauseHistory = pause_state; } -BOOL LLFastTimerView::postBuild() +bool LLFastTimerView::postBuild() { LLButton& pause_btn = getChildRef<LLButton>("pause_btn"); mScrollBar = getChild<LLScrollbar>("scroll_vert"); pause_btn.setCommitCallback(boost::bind(&LLFastTimerView::onPause, this)); - return TRUE; + return true; } -BOOL LLFastTimerView::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLFastTimerView::handleRightMouseDown(S32 x, S32 y, MASK mask) { if (mHoverTimer ) { @@ -148,14 +148,14 @@ BOOL LLFastTimerView::handleRightMouseDown(S32 x, S32 y, MASK mask) { mHoverTimer->getParent()->getTreeNode().mCollapsed = true; } - return TRUE; + return true; } else if (mBarRect.pointInRect(x, y)) { S32 bar_idx = MAX_VISIBLE_HISTORY - ((y - mBarRect.mBottom) * (MAX_VISIBLE_HISTORY + 2) / mBarRect.getHeight()); bar_idx = llclamp(bar_idx, 0, MAX_VISIBLE_HISTORY); mStatsIndex = mScrollIndex + bar_idx; - return TRUE; + return true; } return LLFloater::handleRightMouseDown(x, y, mask); } @@ -172,7 +172,7 @@ BlockTimerStatHandle* LLFastTimerView::getLegendID(S32 y) return NULL; } -BOOL LLFastTimerView::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLFastTimerView::handleDoubleClick(S32 x, S32 y, MASK mask) { for(LLTrace::block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME); it != LLTrace::end_block_timer_tree_df(); @@ -180,10 +180,10 @@ BOOL LLFastTimerView::handleDoubleClick(S32 x, S32 y, MASK mask) { (*it)->getTreeNode().mCollapsed = false; } - return TRUE; + return true; } -BOOL LLFastTimerView::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLFastTimerView::handleMouseDown(S32 x, S32 y, MASK mask) { if (x < mScrollBar->getRect().mLeft) { @@ -201,13 +201,13 @@ BOOL LLFastTimerView::handleMouseDown(S32 x, S32 y, MASK mask) else if (mGraphRect.pointInRect(x, y)) { gFocusMgr.setMouseCapture(this); - return TRUE; + return true; } return LLFloater::handleMouseDown(x, y, mask); } -BOOL LLFastTimerView::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLFastTimerView::handleMouseUp(S32 x, S32 y, MASK mask) { if (hasMouseCapture()) { @@ -216,14 +216,14 @@ BOOL LLFastTimerView::handleMouseUp(S32 x, S32 y, MASK mask) return LLFloater::handleMouseUp(x, y, mask);; } -BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask) +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 = ll_round( lerp * (F32)(mRecording.getNumRecordedPeriods() - MAX_VISIBLE_HISTORY)); mScrollIndex = llclamp( mScrollIndex, 0, (S32)mRecording.getNumRecordedPeriods()); - return TRUE; + return true; } mHoverTimer = NULL; mHoverID = NULL; @@ -238,7 +238,7 @@ BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask) MAX_VISIBLE_HISTORY); if (mHoverBarIndex == 0) { - return TRUE; + return true; } else if (mHoverBarIndex < 0) { @@ -249,7 +249,7 @@ BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask) TimerBar* hover_bar = NULL; F32Seconds mouse_time_offset = ((F32)(x - mBarRect.mLeft) / (F32)mBarRect.getWidth()) * mTotalTimeDisplay; - for (int bar_index = 0, end_index = LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount(); + for (size_t bar_index = 0, end_index = LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount(); bar_index < end_index; ++bar_index) { @@ -314,7 +314,7 @@ static std::string get_tooltip(BlockTimerStatHandle& timer, S32 history_index, P return tooltip; } -BOOL LLFastTimerView::handleToolTip(S32 x, S32 y, MASK mask) +bool LLFastTimerView::handleToolTip(S32 x, S32 y, MASK mask) { if(mPauseHistory && mBarRect.pointInRect(x, y)) { @@ -331,7 +331,7 @@ BOOL LLFastTimerView::handleToolTip(S32 x, S32 y, MASK mask) .sticky_rect(screen_rect) .delay_time(0.f)); - return TRUE; + return true; } } else @@ -344,7 +344,7 @@ BOOL LLFastTimerView::handleToolTip(S32 x, S32 y, MASK mask) { LLToolTipMgr::instance().show(get_tooltip(*idp, 0, mRecording)); - return TRUE; + return true; } } } @@ -352,7 +352,7 @@ BOOL LLFastTimerView::handleToolTip(S32 x, S32 y, MASK mask) return LLFloater::handleToolTip(x, y, mask); } -BOOL LLFastTimerView::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLFastTimerView::handleScrollWheel(S32 x, S32 y, S32 clicks) { if (x < mBarRect.mLeft) { @@ -366,7 +366,7 @@ BOOL LLFastTimerView::handleScrollWheel(S32 x, S32 y, S32 clicks) 0, llmin((S32)mRecording.getNumRecordedPeriods(), (S32)mRecording.getNumRecordedPeriods() - MAX_VISIBLE_HISTORY)); } - return TRUE; + return true; } static BlockTimerStatHandle FTM_RENDER_TIMER("Timers"); @@ -440,7 +440,7 @@ void LLFastTimerView::onOpen(const LLSD& key) void LLFastTimerView::onClose(bool app_quitting) { - setVisible(FALSE); + setVisible(false); } void saveChart(const std::string& label, const char* suffix, LLImageRaw* scratch) @@ -448,6 +448,8 @@ void saveChart(const std::string& label, const char* suffix, LLImageRaw* scratch // disable use of glReadPixels which messes up nVidia nSight graphics debugging if (!LLRender::sNsightDebugSupport) { + LLImageDataSharedLock lock(scratch); + //read result back into raw image glReadPixels(0, 0, 1024, 512, GL_RGB, GL_UNSIGNED_BYTE, scratch->getData()); @@ -704,7 +706,7 @@ void LLFastTimerView::exportCharts(const std::string& base, const std::string& t gGL.color3fv(base_col.mV); U32 count = 0; - U32 total_count = base_execution.size(); + U32 total_count = static_cast<U32>(base_execution.size()); last_p.clear(); @@ -726,7 +728,7 @@ void LLFastTimerView::exportCharts(const std::string& base, const std::string& t LLGLEnable blend(GL_BLEND); gGL.color3fv(cur_col.mV); count = 0; - total_count = cur_execution.size(); + total_count = static_cast<U32>(cur_execution.size()); for (std::vector<LLSD::Real>::iterator iter = cur_execution.begin(); iter != cur_execution.end(); ++iter) { @@ -1018,7 +1020,7 @@ void LLFastTimerView::drawLineGraph() //highlight visible range { - S32 first_frame = mRecording.getNumRecordedPeriods() - mScrollIndex; + S32 first_frame = static_cast<S32>(mRecording.getNumRecordedPeriods()) - mScrollIndex; S32 last_frame = first_frame - MAX_VISIBLE_HISTORY; F32 frame_delta = ((F32) (mGraphRect.getWidth()))/(mRecording.getNumRecordedPeriods()-1); @@ -1081,7 +1083,7 @@ void LLFastTimerView::drawLineGraph() F32 time_scale_factor = (F32)mGraphRect.getHeight() / max_time.value(); F32 hz_scale_factor = (F32) mGraphRect.getHeight() / (1.f / max_time.value()); - for (U32 j = mRecording.getNumRecordedPeriods(); + for (U32 j = static_cast<U32>(mRecording.getNumRecordedPeriods()); j > 0; j--) { @@ -1274,7 +1276,7 @@ void LLFastTimerView::drawLegend() } x += dx; - BOOL is_child_of_hover_item = (idp == mHoverID); + bool is_child_of_hover_item = (idp == mHoverID); BlockTimerStatHandle* next_parent = idp->getParent(); while(!is_child_of_hover_item && next_parent) { @@ -1383,31 +1385,31 @@ void LLFastTimerView::drawBorders( S32 y, const S32 x_start, S32 bar_height, S32 S32 by = y + 6 + (S32)LLFontGL::getFontMonospace()->getLineHeight(); //heading - gl_rect_2d(x_start-5, by, getRect().getWidth()-5, y+5, LLColor4::grey, FALSE); + gl_rect_2d(x_start-5, by, getRect().getWidth()-5, y+5, LLColor4::grey, false); //tree view - gl_rect_2d(5, by, x_start-10, 5, LLColor4::grey, FALSE); + gl_rect_2d(5, by, x_start-10, 5, LLColor4::grey, false); by = y + 5; //average bar - gl_rect_2d(x_start-5, by, getRect().getWidth()-5, by-bar_height-dy-5, LLColor4::grey, FALSE); + gl_rect_2d(x_start-5, by, getRect().getWidth()-5, by-bar_height-dy-5, LLColor4::grey, false); by -= bar_height*2+dy; //current frame bar - gl_rect_2d(x_start-5, by, getRect().getWidth()-5, by-bar_height-dy-2, LLColor4::grey, FALSE); + gl_rect_2d(x_start-5, by, getRect().getWidth()-5, by-bar_height-dy-2, LLColor4::grey, false); by -= bar_height+dy+1; //history bars - gl_rect_2d(x_start-5, by, getRect().getWidth()-5, LINE_GRAPH_HEIGHT-bar_height-dy-2, LLColor4::grey, FALSE); + gl_rect_2d(x_start-5, by, getRect().getWidth()-5, LINE_GRAPH_HEIGHT-bar_height-dy-2, LLColor4::grey, false); by = LINE_GRAPH_HEIGHT-dy; //line graph //mGraphRect = LLRect(x_start-5, by, getRect().getWidth()-5, 5); - gl_rect_2d(mGraphRect, FALSE); + gl_rect_2d(mGraphRect, false); } } @@ -1649,7 +1651,7 @@ S32 LLFastTimerView::drawBar(LLRect bar_rect, TimerBarRow& row, S32 image_width, bool children_visible = visible && !time_block->getTreeNode().mCollapsed; bar_index++; - const U32 num_bars = LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount(); + const auto num_bars = LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount(); if (bar_index < num_bars && row.mBars[bar_index].mFirstChild) { bool is_last = false; diff --git a/indra/newview/llfasttimerview.h b/indra/newview/llfasttimerview.h index f9050bd926..e0ef52f166 100644 --- a/indra/newview/llfasttimerview.h +++ b/indra/newview/llfasttimerview.h @@ -40,9 +40,9 @@ class LLFastTimerView : public LLFloater public: LLFastTimerView(const LLSD&); ~LLFastTimerView(); - BOOL postBuild(); + bool postBuild(); - static BOOL sAnalyzePerformance; + static bool sAnalyzePerformance; static void outputAllMetrics(); static void doAnalysis(std::string baseline, std::string target, std::string output); @@ -55,13 +55,13 @@ private: public: - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); - virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleToolTip(S32 x, S32 y, MASK mask); - virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleDoubleClick(S32 x, S32 y, MASK mask); + virtual bool handleRightMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleHover(S32 x, S32 y, MASK mask); + virtual bool handleToolTip(S32 x, S32 y, MASK mask); + virtual bool handleScrollWheel(S32 x, S32 y, S32 clicks); virtual void draw(); virtual void onOpen(const LLSD& key); virtual void onClose(bool app_quitting); diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index d3c9cd26d7..377710c170 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -79,7 +79,7 @@ public: } void setLandmarkID(const LLUUID& id) { mLandmarkID = id; } - const LLUUID& getLandmarkId() const { return mLandmarkID; } + const LLUUID& getLandmarkID() const { return mLandmarkID; } const std::string& getName() { @@ -160,7 +160,7 @@ class LLFavoriteLandmarkButton : public LLButton { public: - BOOL handleToolTip(S32 x, S32 y, MASK mask) + bool handleToolTip(S32 x, S32 y, MASK mask) { std::string region_name = mLandmarkInfoGetter.getName(); @@ -176,10 +176,10 @@ public: LLToolTipMgr::instance().show(params); } - return TRUE; + return true; } - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask) + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask) { LLFavoritesBarCtrl* fb = dynamic_cast<LLFavoritesBarCtrl*>(getParent()); @@ -192,7 +192,7 @@ public: } void setLandmarkID(const LLUUID& id){ mLandmarkInfoGetter.setLandmarkID(id); } - const LLUUID& getLandmarkId() const { return mLandmarkInfoGetter.getLandmarkId(); } + const LLUUID& getLandmarkID() const { return mLandmarkInfoGetter.getLandmarkID(); } void onMouseEnter(S32 x, S32 y, MASK mask) { @@ -224,7 +224,7 @@ private: class LLFavoriteLandmarkMenuItem : public LLMenuItemCallGL { public: - BOOL handleToolTip(S32 x, S32 y, MASK mask) + bool handleToolTip(S32 x, S32 y, MASK mask) { std::string region_name = mLandmarkInfoGetter.getName(); if (!region_name.empty()) @@ -234,33 +234,34 @@ public: params.sticky_rect = calcScreenRect(); LLToolTipMgr::instance().show(params); } - return TRUE; + return true; } - void setLandmarkID(const LLUUID& id){ mLandmarkInfoGetter.setLandmarkID(id); } + const LLUUID& getLandmarkID() const { return mLandmarkInfoGetter.getLandmarkID(); } + void setLandmarkID(const LLUUID& id) { mLandmarkInfoGetter.setLandmarkID(id); } - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) + virtual bool handleMouseDown(S32 x, S32 y, MASK mask) { if (mMouseDownSignal) (*mMouseDownSignal)(this, x, y, mask); return LLMenuItemCallGL::handleMouseDown(x, y, mask); } - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) + virtual bool handleMouseUp(S32 x, S32 y, MASK mask) { if (mMouseUpSignal) (*mMouseUpSignal)(this, x, y, mask); return LLMenuItemCallGL::handleMouseUp(x, y, mask); } - virtual BOOL handleHover(S32 x, S32 y, MASK mask) + virtual bool handleHover(S32 x, S32 y, MASK mask) { if (fb) { fb->handleHover(x, y, mask); } - return TRUE; + return true; } void initFavoritesBarPointer(LLFavoritesBarCtrl* fb) { this->fb = fb; } @@ -278,21 +279,50 @@ private: /** * This class was introduced just for fixing the following issue: * EXT-836 Nav bar: Favorites overflow menu passes left-mouse click through. - * We must explicitly handle drag and drop event by returning TRUE + * We must explicitly handle drag and drop event by returning true * because otherwise LLToolDragAndDrop will initiate drag and drop operation * with the world. */ class LLFavoriteLandmarkToggleableMenu : public LLToggleableMenu { public: - virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, - EDragAndDropType cargo_type, - void* cargo_data, - EAcceptance* accept, - std::string& tooltip_msg) + // virtual + bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, + void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) override + { + mToolbar->handleDragAndDropToMenu(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); + return true; + } + + // virtual + bool handleHover(S32 x, S32 y, MASK mask) override + { + mIsHovering = true; + LLToggleableMenu::handleHover(x, y, mask); + mIsHovering = false; + return true; + } + + // virtual + void setVisible(bool visible) override { - *accept = ACCEPT_NO; - return TRUE; + // Avoid of hiding the menu during hovering + if (visible || !mIsHovering) + { + LLToggleableMenu::setVisible(visible); + } + } + + void setToolbar(LLFavoritesBarCtrl* toolbar) + { + mToolbar = toolbar; + } + + ~LLFavoriteLandmarkToggleableMenu() + { + // Enable subsequent setVisible(false) + mIsHovering = false; + setVisible(false); } protected: @@ -301,6 +331,10 @@ protected: { } +private: + LLFavoritesBarCtrl* mToolbar { nullptr }; + bool mIsHovering { false }; + friend class LLUICtrlFactory; }; @@ -323,8 +357,8 @@ public: LLFavoritesBarCtrl::sWaitingForCallabck = 0.f; LLFavoritesOrderStorage::instance().setSortIndex(item, mSortField); - item->setComplete(TRUE); - item->updateServer(FALSE); + item->setComplete(true); + item->updateServer(false); gInventory.updateItem(item); gInventory.notifyObservers(); @@ -382,12 +416,13 @@ LLFavoritesBarCtrl::LLFavoritesBarCtrl(const LLFavoritesBarCtrl::Params& p) mOverflowMenuHandle(), mContextMenuHandle(), mImageDragIndication(p.image_drag_indication), - mShowDragMarker(FALSE), + mShowDragMarker(false), mLandingTab(NULL), mLastTab(NULL), mItemsListDirty(false), mUpdateDropDownItems(true), mRestoreOverflowMenu(false), + mDragToOverflowMenu(false), mGetPrevItems(true), mMouseX(0), mMouseY(0), @@ -422,20 +457,19 @@ LLFavoritesBarCtrl::~LLFavoritesBarCtrl() { gInventory.removeObserver(this); - if (mOverflowMenuHandle.get()) mOverflowMenuHandle.get()->die(); - if (mContextMenuHandle.get()) mContextMenuHandle.get()->die(); + if (mOverflowMenuHandle.get()) + mOverflowMenuHandle.get()->die(); + if (mContextMenuHandle.get()) + mContextMenuHandle.get()->die(); } -BOOL LLFavoritesBarCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, - EDragAndDropType cargo_type, - void* cargo_data, - EAcceptance* accept, - std::string& tooltip_msg) +bool LLFavoritesBarCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, + EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) { *accept = ACCEPT_NO; LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource(); - if (LLToolDragAndDrop::SOURCE_AGENT != source && LLToolDragAndDrop::SOURCE_LIBRARY != source) return FALSE; + if (LLToolDragAndDrop::SOURCE_AGENT != source && LLToolDragAndDrop::SOURCE_LIBRARY != source) return false; switch (cargo_type) { @@ -456,26 +490,52 @@ BOOL LLFavoritesBarCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, // Copy the item into the favorites folder (if it's not already there). LLInventoryItem *item = (LLInventoryItem *)cargo_data; - if (LLFavoriteLandmarkButton* dest = dynamic_cast<LLFavoriteLandmarkButton*>(findChildByLocalCoords(x, y))) + if (mDragToOverflowMenu) { - setLandingTab(dest); + LLView* overflow_menu = mOverflowMenuHandle.get(); + if (overflow_menu && !overflow_menu->isDead() && overflow_menu->getVisible()) + { + overflow_menu->handleHover(x, y, mask); + } } - else if (mLastTab && (x >= mLastTab->getRect().mRight)) + else // Drag to the toolbar itself { - /* - * the condition dest == NULL can be satisfied not only in the case - * of dragging to the right from the last tab of the favbar. there is a - * small gap between each tab. if the user drags something exactly there - * then mLandingTab will be set to NULL and the dragged item will be pushed - * to the end of the favorites bar. this is incorrect behavior. that's why - * we need an additional check which excludes the case described previously - * making sure that the mouse pointer is beyond the last tab. - */ - setLandingTab(NULL); + // Drag to a landmark button? + if (LLFavoriteLandmarkButton* dest = dynamic_cast<LLFavoriteLandmarkButton*>(findChildByLocalCoords(x, y))) + { + setLandingTab(dest); + } + else + { + // Drag to the "More" button? + if (mMoreTextBox && mMoreTextBox->getVisible() && mMoreTextBox->getRect().pointInRect(x, y)) + { + LLView* overflow_menu = mOverflowMenuHandle.get(); + if (!overflow_menu || overflow_menu->isDead() || !overflow_menu->getVisible()) + { + showDropDownMenu(); + } + } + + // Drag to the right of the last landmark button? + if (mLastTab && (x >= mLastTab->getRect().mRight)) + { + /* + * the condition dest == NULL can be satisfied not only in the case + * of dragging to the right from the last tab of the favbar. there is a + * small gap between each tab. if the user drags something exactly there + * then mLandingTab will be set to NULL and the dragged item will be pushed + * to the end of the favorites bar. this is incorrect behavior. that's why + * we need an additional check which excludes the case described previously + * making sure that the mouse pointer is beyond the last tab. + */ + setLandingTab(NULL); + } + } } - // check if we are dragging an existing item from the favorites bar - bool existing_drop = false; + // Check whether we are dragging an existing item from the favorites bar + bool existing_item = false; if (item && mDragItemId == item->getUUID()) { // There is a chance of mDragItemId being obsolete @@ -483,21 +543,19 @@ BOOL LLFavoritesBarCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, // results in viewer not geting a 'mouse up' signal for (LLInventoryModel::item_array_t::iterator i = mItems.begin(); i != mItems.end(); ++i) { - LLViewerInventoryItem* currItem = *i; - - if (currItem->getUUID() == mDragItemId) + if ((*i)->getUUID() == mDragItemId) { - existing_drop = true; + existing_item = true; break; } } } - if (existing_drop) + if (existing_item) { *accept = ACCEPT_YES_SINGLE; - showDragMarker(TRUE); + showDragMarker(true); if (drop) { @@ -515,7 +573,7 @@ BOOL LLFavoritesBarCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, *accept = ACCEPT_YES_COPY_MULTI; - showDragMarker(TRUE); + showDragMarker(true); if (drop) { @@ -533,85 +591,59 @@ BOOL LLFavoritesBarCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, break; } - return TRUE; + return true; +} + +bool LLFavoritesBarCtrl::handleDragAndDropToMenu(S32 x, S32 y, MASK mask, bool drop, + EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) +{ + mDragToOverflowMenu = true; + bool handled = handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); + mDragToOverflowMenu = false; + return handled; } void LLFavoritesBarCtrl::handleExistingFavoriteDragAndDrop(S32 x, S32 y) { - if (mItems.empty()) - { - // Isn't supposed to be empty + if (LL_UNLIKELY(mItems.empty())) return; - } - // Identify the button hovered and the side to drop - LLFavoriteLandmarkButton* dest = dynamic_cast<LLFavoriteLandmarkButton*>(mLandingTab); - bool insert_before = true; - if (!dest) - { - insert_before = false; - dest = dynamic_cast<LLFavoriteLandmarkButton*>(mLastTab); - } + LLUUID target_id; + bool insert_before = false; + if (!findDragAndDropTarget(target_id, insert_before, x, y)) + return; // There is no need to handle if an item was dragged onto itself - if (dest && dest->getLandmarkId() == mDragItemId) - { + if (target_id == mDragItemId) return; - } - - // Insert the dragged item in the right place - if (dest) - { - LLInventoryModel::updateItemsOrder(mItems, mDragItemId, dest->getLandmarkId(), insert_before); - } - else - { - // This can happen when the item list is empty - mItems.push_back(gInventory.getItem(mDragItemId)); - } + // Move the dragged item to the right place in the array + LLInventoryModel::updateItemsOrder(mItems, mDragItemId, target_id, insert_before); LLFavoritesOrderStorage::instance().saveItemsOrder(mItems); - LLToggleableMenu* menu = (LLToggleableMenu*) mOverflowMenuHandle.get(); - - if (menu && menu->getVisible()) + LLView* menu = mOverflowMenuHandle.get(); + if (menu && !menu->isDead() && menu->getVisible()) { - menu->setVisible(FALSE); - showDropDownMenu(); + updateOverflowMenuItems(); + positionAndShowOverflowMenu(); } } void LLFavoritesBarCtrl::handleNewFavoriteDragAndDrop(LLInventoryItem *item, const LLUUID& favorites_id, S32 x, S32 y) { // Identify the button hovered and the side to drop - LLFavoriteLandmarkButton* dest = NULL; - bool insert_before = true; - if (!mItems.empty()) - { - // [MAINT-2386] When multiple landmarks are selected and dragged onto an empty favorites bar, - // the viewer would crash when casting mLastTab below, as mLastTab is still null when the - // second landmark is being added. - // To ensure mLastTab is valid, we need to call updateButtons() at the end of this function - dest = dynamic_cast<LLFavoriteLandmarkButton*>(mLandingTab); - if (!dest) - { - insert_before = false; - dest = dynamic_cast<LLFavoriteLandmarkButton*>(mLastTab); - } - } - + LLUUID target_id; + bool insert_before = false; // There is no need to handle if an item was dragged onto itself - if (dest && dest->getLandmarkId() == mDragItemId) - { + if (findDragAndDropTarget(target_id, insert_before, x, y) && (target_id == mDragItemId)) return; - } LLPointer<LLViewerInventoryItem> viewer_item = new LLViewerInventoryItem(item); - // Insert the dragged item in the right place - if (dest) + // Insert the dragged item to the right place + if (target_id.notNull()) { - insertItem(mItems, dest->getLandmarkId(), viewer_item, insert_before); + insertItem(mItems, target_id, viewer_item, insert_before); } else { @@ -638,8 +670,8 @@ void LLFavoritesBarCtrl::handleNewFavoriteDragAndDrop(LLInventoryItem *item, con { LLFavoritesOrderStorage::instance().setSortIndex(currItem, ++sortField); - currItem->setComplete(TRUE); - currItem->updateServer(FALSE); + currItem->setComplete(true); + currItem->updateServer(false); gInventory.updateItem(currItem); } @@ -671,9 +703,74 @@ void LLFavoritesBarCtrl::handleNewFavoriteDragAndDrop(LLInventoryItem *item, con // landmarks to an empty favorites bar. updateButtons(); + LLView* overflow_menu = mOverflowMenuHandle.get(); + if (overflow_menu && !overflow_menu->isDead() && overflow_menu->getVisible()) + { + updateOverflowMenuItems(); + positionAndShowOverflowMenu(); + } + LL_INFOS("FavoritesBar") << "Copied inventory item #" << item->getUUID() << " to favorites." << LL_ENDL; } +bool LLFavoritesBarCtrl::findDragAndDropTarget(LLUUID& target_id, bool& insert_before, S32 x, S32 y) +{ + if (mItems.empty()) + return false; + + if (mDragToOverflowMenu) + { + LLView* overflow_menu = mOverflowMenuHandle.get(); + if (LL_UNLIKELY(!overflow_menu || overflow_menu->isDead() || !overflow_menu->getVisible())) + return false; + + // Identify the menu item hovered and the side to drop + LLFavoriteLandmarkMenuItem* target_item = dynamic_cast<LLFavoriteLandmarkMenuItem*>(overflow_menu->childFromPoint(x, y)); + if (target_item) + { + insert_before = true; + } + else + { + // Choose the bottom landmark menu item + auto begin = overflow_menu->getChildList()->begin(); + auto end = overflow_menu->getChildList()->end(); + auto check = [](const LLView* child) -> bool + { + return dynamic_cast<const LLFavoriteLandmarkMenuItem*>(child); + }; + // Menu items are placed in the backward order, so the bottom goes first + auto it = std::find_if(begin, end, check); + if (LL_UNLIKELY(it == end)) + return false; + target_item = (LLFavoriteLandmarkMenuItem*)*it; + insert_before = false; + } + target_id = target_item->getLandmarkID(); + } + else + { + // Identify the button hovered and the side to drop + LLFavoriteLandmarkButton* hovered_button = dynamic_cast<LLFavoriteLandmarkButton*>(mLandingTab); + if (hovered_button) + { + insert_before = true; + } + else + { + // Choose the right landmark button + hovered_button = dynamic_cast<LLFavoriteLandmarkButton*>(mLastTab); + if (LL_UNLIKELY(!hovered_button)) + return false; + + insert_before = false; + } + target_id = hovered_button->getLandmarkID(); + } + + return true; +} + //virtual void LLFavoritesBarCtrl::changed(U32 mask) { @@ -718,7 +815,7 @@ void LLFavoritesBarCtrl::changed(U32 mask) } //virtual -void LLFavoritesBarCtrl::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLFavoritesBarCtrl::reshape(S32 width, S32 height, bool called_from_parent) { S32 delta_width = width - getRect().getWidth(); S32 delta_height = height - getRect().getHeight(); @@ -750,7 +847,7 @@ void LLFavoritesBarCtrl::draw() mImageDragIndication->draw(rect.mRight, rect.getHeight(), w, h); } // Once drawn, mark this false so we won't draw it again (unless we hit the favorite bar again) - mShowDragMarker = FALSE; + mShowDragMarker = false; } if (mItemsChangedTimer.getStarted()) { @@ -837,12 +934,12 @@ void LLFavoritesBarCtrl::updateButtons(bool force_update) if(mItems.empty()) { - mBarLabel->setVisible(TRUE); + mBarLabel->setVisible(true); mLastTab = NULL; } else { - mBarLabel->setVisible(FALSE); + mBarLabel->setVisible(false); } const child_list_t* childs = getChildList(); child_list_const_iter_t child_it = childs->begin(); @@ -859,7 +956,7 @@ void LLFavoritesBarCtrl::updateButtons(bool force_update) if (item) { // an child's order and mItems should be same - if (button->getLandmarkId() != item->getUUID() // sort order has been changed + if (button->getLandmarkID() != item->getUUID() // sort order has been changed || button->getLabelSelected() != item->getName()) // favorite's name has been changed { break; @@ -933,11 +1030,7 @@ void LLFavoritesBarCtrl::updateButtons(bool force_update) { // mMoreTextBox was removed, so LLFavoriteLandmarkButtons // should be the only ones in the list - LLFavoriteLandmarkButton* button = dynamic_cast<LLFavoriteLandmarkButton*> (childs->back()); - if (button) - { - mLastTab = button; - } + mLastTab = dynamic_cast<LLFavoriteLandmarkButton*>(childs->back()); } mFirstDropDownItem = j; @@ -945,25 +1038,23 @@ void LLFavoritesBarCtrl::updateButtons(bool force_update) if (mFirstDropDownItem < mItems.size()) { // if updateButton had been called it means: - //or there are some new favorites, or width had been changed + // or there are some new favorites, or width had been changed // so if we need to display chevron button, we must update dropdown items too. mUpdateDropDownItems = true; S32 buttonHGap = button_params.rect.left; // default value - LLRect rect; // Chevron button should stay right aligned - rect.setOriginAndSize(getRect().mRight - mMoreTextBox->getRect().getWidth() - buttonHGap, 0, - mMoreTextBox->getRect().getWidth(), - mMoreTextBox->getRect().getHeight()); + LLRect rect(mMoreTextBox->getRect()); + rect.translate(getRect().mRight - rect.mRight - buttonHGap, 0); addChild(mMoreTextBox); mMoreTextBox->setRect(rect); - mMoreTextBox->setVisible(TRUE); + mMoreTextBox->setVisible(true); } // Update overflow menu LLToggleableMenu* overflow_menu = static_cast <LLToggleableMenu*> (mOverflowMenuHandle.get()); if (overflow_menu && overflow_menu->getVisible() && (overflow_menu->getItemCount() != mDropDownItemsCount)) { - overflow_menu->setVisible(FALSE); + overflow_menu->setVisible(false); if (mUpdateDropDownItems) { showDropDownMenu(); @@ -1027,7 +1118,7 @@ LLButton* LLFavoritesBarCtrl::createButton(const LLPointer<LLViewerInventoryItem } -BOOL LLFavoritesBarCtrl::postBuild() +bool LLFavoritesBarCtrl::postBuild() { // make the popup menu available LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_favorites.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); @@ -1038,14 +1129,14 @@ BOOL LLFavoritesBarCtrl::postBuild() menu->setBackgroundColor(LLUIColorTable::instance().getColor("MenuPopupBgColor")); mContextMenuHandle = menu->getHandle(); - return TRUE; + return true; } -BOOL LLFavoritesBarCtrl::collectFavoriteItems(LLInventoryModel::item_array_t &items) +bool LLFavoritesBarCtrl::collectFavoriteItems(LLInventoryModel::item_array_t &items) { if (mFavoriteFolderId.isNull()) - return FALSE; + return false; LLInventoryModel::cat_array_t cats; @@ -1065,7 +1156,7 @@ BOOL LLFavoritesBarCtrl::collectFavoriteItems(LLInventoryModel::item_array_t &it LLFavoritesOrderStorage::instance().mSaveOnExit = true; } - return TRUE; + return true; } void LLFavoritesBarCtrl::onMoreTextBoxClicked() @@ -1086,14 +1177,16 @@ void LLFavoritesBarCtrl::showDropDownMenu() { if (mUpdateDropDownItems) { - updateMenuItems(menu); + updateOverflowMenuItems(); + } + else + { + menu->buildDrawLabels(); } - menu->buildDrawLabels(); menu->updateParent(LLMenuGL::sMenuContainer); menu->setButtonRect(mMoreTextBox->getRect(), this); - positionAndShowMenu(menu); - mDropDownItemsCount = menu->getItemCount(); + positionAndShowOverflowMenu(); } } @@ -1107,12 +1200,14 @@ void LLFavoritesBarCtrl::createOverflowMenu() menu_p.max_scrollable_items = 10; menu_p.preferred_width = DROP_DOWN_MENU_WIDTH; - LLToggleableMenu* menu = LLUICtrlFactory::create<LLFavoriteLandmarkToggleableMenu>(menu_p); + LLFavoriteLandmarkToggleableMenu* menu = LLUICtrlFactory::create<LLFavoriteLandmarkToggleableMenu>(menu_p); + menu->setToolbar(this); mOverflowMenuHandle = menu->getHandle(); } -void LLFavoritesBarCtrl::updateMenuItems(LLToggleableMenu* menu) +void LLFavoritesBarCtrl::updateOverflowMenuItems() { + LLToggleableMenu* menu = (LLToggleableMenu*)mOverflowMenuHandle.get(); menu->empty(); U32 widest_item = 0; @@ -1141,6 +1236,8 @@ void LLFavoritesBarCtrl::updateMenuItems(LLToggleableMenu* menu) menu->addChild(menu_item); } + menu->buildDrawLabels(); + mDropDownItemsCount = menu->getItemCount(); addOpenLandmarksMenuItem(menu); mUpdateDropDownItems = false; } @@ -1153,7 +1250,7 @@ void LLFavoritesBarCtrl::fitLabelWidth(LLMenuItemCallGL* menu_item) // Check whether item name wider than menu if (menu_item->getNominalWidth() > max_width) { - S32 chars_total = item_name.length(); + S32 chars_total = static_cast<S32>(item_name.length()); S32 chars_fitted = 1; menu_item->setLabel(LLStringExplicit("")); S32 label_space = max_width - menu_item->getFont()->getWidth("...") - @@ -1197,8 +1294,9 @@ void LLFavoritesBarCtrl::addOpenLandmarksMenuItem(LLToggleableMenu* menu) menu->addChild(menu_item); } -void LLFavoritesBarCtrl::positionAndShowMenu(LLToggleableMenu* menu) +void LLFavoritesBarCtrl::positionAndShowOverflowMenu() { + LLToggleableMenu* menu = (LLToggleableMenu*)mOverflowMenuHandle.get(); U32 max_width = llmin(DROP_DOWN_MENU_WIDTH, getRect().getWidth()); S32 menu_x = getRect().getWidth() - max_width; @@ -1264,9 +1362,9 @@ void LLFavoritesBarCtrl::onButtonRightClick( LLUUID item_id,LLView* fav_button,S LLMenuGL::showPopup(fav_button, menu, x, y); } -BOOL LLFavoritesBarCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLFavoritesBarCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = childrenHandleRightMouseDown( x, y, mask) != NULL; + bool handled = childrenHandleRightMouseDown( x, y, mask) != NULL; if(!handled && !gMenuHolder->hasVisibleMenu()) { show_navbar_context_menu(this,x,y); @@ -1277,7 +1375,7 @@ BOOL LLFavoritesBarCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) } void copy_slurl_to_clipboard_cb(std::string& slurl) { - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(slurl),0,slurl.size()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(slurl), 0, static_cast<S32>(slurl.size())); LLSD args; args["SLURL"] = slurl; @@ -1407,7 +1505,7 @@ bool LLFavoritesBarCtrl::onRenameCommit(const LLSD& notification, const LLSD& re { LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); new_item->rename(landmark_name); - new_item->updateServer(FALSE); + new_item->updateServer(false); gInventory.updateItem(new_item); } } @@ -1415,17 +1513,17 @@ bool LLFavoritesBarCtrl::onRenameCommit(const LLSD& notification, const LLSD& re return false; } -BOOL LLFavoritesBarCtrl::isClipboardPasteable() const +bool LLFavoritesBarCtrl::isClipboardPasteable() const { if (!LLClipboard::instance().hasContents()) { - return FALSE; + return false; } std::vector<LLUUID> objects; LLClipboard::instance().pasteFromClipboard(objects); - S32 count = objects.size(); - for(S32 i = 0; i < count; i++) + auto count = objects.size(); + for(size_t i = 0; i < count; i++) { const LLUUID &item_id = objects.at(i); @@ -1433,16 +1531,16 @@ BOOL LLFavoritesBarCtrl::isClipboardPasteable() const const LLInventoryCategory *cat = gInventory.getCategory(item_id); if (cat) { - return FALSE; + return false; } const LLInventoryItem *item = gInventory.getItem(item_id); if (item && LLAssetType::AT_LANDMARK != item->getType()) { - return FALSE; + return false; } } - return TRUE; + return true; } void LLFavoritesBarCtrl::pasteFromClipboard() const @@ -1453,9 +1551,9 @@ void LLFavoritesBarCtrl::pasteFromClipboard() const LLInventoryItem* item = NULL; std::vector<LLUUID> objects; LLClipboard::instance().pasteFromClipboard(objects); - S32 count = objects.size(); + auto count = objects.size(); LLUUID parent_id(mFavoriteFolderId); - for(S32 i = 0; i < count; i++) + for(size_t i = 0; i < count; i++) { item = model->getItem(objects.at(i)); if (item) @@ -1482,11 +1580,11 @@ void LLFavoritesBarCtrl::onButtonMouseDown(LLUUID id, LLUICtrl* ctrl, S32 x, S32 LLMenuGL* menu = (LLMenuGL*)mContextMenuHandle.get(); if(menu && menu->getVisible()) { - menu->setVisible(FALSE); + menu->setVisible(false); } mDragItemId = id; - mStartDrag = TRUE; + mStartDrag = true; S32 screenX, screenY; localPointToScreen(x, y, &screenX, &screenY); @@ -1496,7 +1594,7 @@ void LLFavoritesBarCtrl::onButtonMouseDown(LLUUID id, LLUICtrl* ctrl, S32 x, S32 void LLFavoritesBarCtrl::onButtonMouseUp(LLUUID id, LLUICtrl* ctrl, S32 x, S32 y, MASK mask) { - mStartDrag = FALSE; + mStartDrag = false; mDragItemId = LLUUID::null; } @@ -1504,12 +1602,12 @@ void LLFavoritesBarCtrl::onEndDrag() { mEndDragConnection.disconnect(); - showDragMarker(FALSE); + showDragMarker(false); mDragItemId = LLUUID::null; LLView::getWindow()->setCursor(UI_CURSOR_ARROW); } -BOOL LLFavoritesBarCtrl::handleHover(S32 x, S32 y, MASK mask) +bool LLFavoritesBarCtrl::handleHover(S32 x, S32 y, MASK mask) { if (mDragItemId != LLUUID::null && mStartDrag) { @@ -1522,13 +1620,13 @@ BOOL LLFavoritesBarCtrl::handleHover(S32 x, S32 y, MASK mask) DAD_LANDMARK, mDragItemId, LLToolDragAndDrop::SOURCE_LIBRARY); - mStartDrag = FALSE; + mStartDrag = false; return LLToolDragAndDrop::getInstance()->handleHover(x, y, mask); } } - return TRUE; + return true; } LLUICtrl* LLFavoritesBarCtrl::findChildByLocalCoords(S32 x, S32 y) @@ -1551,19 +1649,20 @@ LLUICtrl* LLFavoritesBarCtrl::findChildByLocalCoords(S32 x, S32 y) } } } + return ctrl; } -BOOL LLFavoritesBarCtrl::needToSaveItemsOrder(const LLInventoryModel::item_array_t& items) +bool LLFavoritesBarCtrl::needToSaveItemsOrder(const LLInventoryModel::item_array_t& items) { - BOOL result = FALSE; + bool result = false; // if there is an item without sort order field set, we need to save items order for (LLInventoryModel::item_array_t::const_iterator i = items.begin(); i != items.end(); ++i) { if (LLFavoritesOrderStorage::instance().getSortIndex((*i)->getUUID()) < 0) { - result = TRUE; + result = true; break; } } @@ -1967,8 +2066,8 @@ void LLFavoritesOrderStorage::saveItemsOrder( const LLInventoryModel::item_array setSortIndex(item, ++sortField); - item->setComplete(TRUE); - item->updateServer(FALSE); + item->setComplete(true); + item->updateServer(false); gInventory.updateItem(item); @@ -1999,7 +2098,7 @@ void LLFavoritesOrderStorage::rearrangeFavoriteLandmarks(const LLUUID& source_it saveItemsOrder(items); } -BOOL LLFavoritesOrderStorage::saveFavoritesRecord(bool pref_changed) +bool LLFavoritesOrderStorage::saveFavoritesRecord(bool pref_changed) { pref_changed |= mRecreateFavoriteStorage; mRecreateFavoriteStorage = false; @@ -2007,13 +2106,13 @@ BOOL LLFavoritesOrderStorage::saveFavoritesRecord(bool pref_changed) // Can get called before inventory is done initializing. if (!gInventory.isInventoryUsable()) { - return FALSE; + return false; } LLUUID favorite_folder= gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE); if (favorite_folder.isNull()) { - return FALSE; + return false; } LLInventoryModel::item_array_t items; @@ -2125,11 +2224,11 @@ BOOL LLFavoritesOrderStorage::saveFavoritesRecord(bool pref_changed) mPrevFavorites = items; } - return TRUE; + return true; } -void LLFavoritesOrderStorage::showFavoritesOnLoginChanged(BOOL show) +void LLFavoritesOrderStorage::showFavoritesOnLoginChanged(bool show) { if (show) { @@ -2160,8 +2259,10 @@ bool LLFavoritesOrderStorage::isStorageUpdateNeeded() void AddFavoriteLandmarkCallback::fire(const LLUUID& inv_item_id) { - if (mTargetLandmarkId.isNull()) return; - - LLFavoritesOrderStorage::instance().rearrangeFavoriteLandmarks(inv_item_id, mTargetLandmarkId); + if (!mTargetLandmarkId.isNull()) + { + LLFavoritesOrderStorage::instance().rearrangeFavoriteLandmarks(inv_item_id, mTargetLandmarkId); + } } + // EOF diff --git a/indra/newview/llfavoritesbar.h b/indra/newview/llfavoritesbar.h index 92f5809b87..ee18f3ed45 100644 --- a/indra/newview/llfavoritesbar.h +++ b/indra/newview/llfavoritesbar.h @@ -57,29 +57,28 @@ protected: public: virtual ~LLFavoritesBarCtrl(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild() override; - /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, - EDragAndDropType cargo_type, - void* cargo_data, - EAcceptance* accept, - std::string& tooltip_msg); + /*virtual*/ bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, + EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) override; + bool handleDragAndDropToMenu(S32 x, S32 y, MASK mask, bool drop, + EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg); - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleRightMouseDown(S32 x, S32 y, MASK mask) override; // LLInventoryObserver observer trigger - virtual void changed(U32 mask); - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); - virtual void draw(); + /*virtual*/ void changed(U32 mask) override; + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true) override; + /*virtual*/ void draw() override; - void showDragMarker(BOOL show) { mShowDragMarker = show; } + void showDragMarker(bool show) { mShowDragMarker = show; } void setLandingTab(LLUICtrl* tab) { mLandingTab = tab; } protected: void updateButtons(bool force_update = false); LLButton* createButton(const LLPointer<LLViewerInventoryItem> item, const LLButton::Params& button_params, S32 x_offset ); const LLButton::Params& getButtonParams(); - BOOL collectFavoriteItems(LLInventoryModel::item_array_t &items); + bool collectFavoriteItems(LLInventoryModel::item_array_t &items); void onButtonClick(LLUUID id); void onButtonRightClick(LLUUID id,LLView* button,S32 x,S32 y,MASK mask); @@ -92,7 +91,7 @@ protected: bool enableSelected(const LLSD& userdata); void doToSelected(const LLSD& userdata); static bool onRenameCommit(const LLSD& notification, const LLSD& response); - BOOL isClipboardPasteable() const; + bool isClipboardPasteable() const; void pasteFromClipboard() const; void showDropDownMenu(); @@ -108,7 +107,7 @@ protected: S32 mDropDownItemsCount; bool mUpdateDropDownItems; bool mRestoreOverflowMenu; - + bool mDragToOverflowMenu; bool mGetPrevItems; LLUUID mSelectedItemID; @@ -118,21 +117,23 @@ protected: private: /* * Helper function to make code more readable. It handles all drag and drop - * operations of the existing favorites items on the favorites bar. + * operations of the existing favorites items to the favorites bar to on the overflow menu. */ void handleExistingFavoriteDragAndDrop(S32 x, S32 y); /* * Helper function to make code more readable. It handles all drag and drop - * operations of the new landmark to the favorites bar. + * operations of the new landmark to the favorites bar or to the overflow menu. */ void handleNewFavoriteDragAndDrop(LLInventoryItem *item, const LLUUID& favorites_id, S32 x, S32 y); // finds a control under the specified LOCAL point LLUICtrl* findChildByLocalCoords(S32 x, S32 y); + bool findDragAndDropTarget(LLUUID &target_id, bool &insert_before, S32 x, S32 y); + // checks if the current order of the favorites items must be saved - BOOL needToSaveItemsOrder(const LLInventoryModel::item_array_t& items); + bool needToSaveItemsOrder(const LLInventoryModel::item_array_t& items); /** * inserts an item identified by insertedItemId BEFORE an item identified by beforeItemId. @@ -145,23 +146,23 @@ private: void createOverflowMenu(); - void updateMenuItems(LLToggleableMenu* menu); + void updateOverflowMenuItems(); // Fits menu item label width with favorites menu width void fitLabelWidth(LLMenuItemCallGL* menu_item); void addOpenLandmarksMenuItem(LLToggleableMenu* menu); - void positionAndShowMenu(LLToggleableMenu* menu); + void positionAndShowOverflowMenu(); - BOOL mShowDragMarker; + bool mShowDragMarker; LLUICtrl* mLandingTab; LLUICtrl* mLastTab; LLTextBox* mMoreTextBox; LLTextBox* mBarLabel; LLUUID mDragItemId; - BOOL mStartDrag; + bool mStartDrag; LLInventoryModel::item_array_t mItems; static F64 sWaitingForCallabck; @@ -224,8 +225,8 @@ public: // Remove record of current user's favorites from file on disk. static void removeFavoritesRecordOfUser(); - BOOL saveFavoritesRecord(bool pref_changed = false); - void showFavoritesOnLoginChanged(BOOL show); + bool saveFavoritesRecord(bool pref_changed = false); + void showFavoritesOnLoginChanged(bool show); bool isStorageUpdateNeeded(); diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp index 5be48a3630..ac7d7b755b 100644 --- a/indra/newview/llfeaturemanager.cpp +++ b/indra/newview/llfeaturemanager.cpp @@ -71,8 +71,8 @@ const char FEATURE_TABLE_FILENAME[] = "featuretable.txt"; #if 0 // consuming code in #if 0 below #endif -LLFeatureInfo::LLFeatureInfo(const std::string& name, const BOOL available, const F32 level) - : mValid(TRUE), mName(name), mAvailable(available), mRecommendedLevel(level) +LLFeatureInfo::LLFeatureInfo(const std::string& name, const bool available, const F32 level) + : mValid(true), mName(name), mAvailable(available), mRecommendedLevel(level) { } @@ -85,7 +85,7 @@ LLFeatureList::~LLFeatureList() { } -void LLFeatureList::addFeature(const std::string& name, const BOOL available, const F32 level) +void LLFeatureList::addFeature(const std::string& name, const bool available, const F32 level) { if (mFeatures.count(name)) { @@ -100,7 +100,7 @@ void LLFeatureList::addFeature(const std::string& name, const BOOL available, co mFeatures[name] = fi; } -BOOL LLFeatureList::isFeatureAvailable(const std::string& name) +bool LLFeatureList::isFeatureAvailable(const std::string& name) { if (mFeatures.count(name)) { @@ -109,9 +109,9 @@ BOOL LLFeatureList::isFeatureAvailable(const std::string& name) LL_WARNS_ONCE("RenderInit") << "Feature " << name << " not on feature list!" << LL_ENDL; - // changing this to TRUE so you have to explicitly disable + // changing this to true so you have to explicitly disable // something for it to be disabled - return TRUE; + return true; } F32 LLFeatureList::getRecommendedValue(const std::string& name) @@ -126,7 +126,7 @@ F32 LLFeatureList::getRecommendedValue(const std::string& name) return 0; } -BOOL LLFeatureList::maskList(LLFeatureList &mask) +bool LLFeatureList::maskList(LLFeatureList &mask) { LL_DEBUGS_ONCE() << "Masking with " << mask.mName << LL_ENDL; // @@ -169,7 +169,7 @@ BOOL LLFeatureList::maskList(LLFeatureList &mask) dump(); LL_CONT << LL_ENDL; - return TRUE; + return true; } void LLFeatureList::dump() @@ -197,7 +197,7 @@ static const std::vector<std::string> sGraphicsLevelNames = boost::assign::list_ U32 LLFeatureManager::getMaxGraphicsLevel() const { - return sGraphicsLevelNames.size() - 1; + return static_cast<U32>(sGraphicsLevelNames.size()) - 1; } bool LLFeatureManager::isValidGraphicsLevel(U32 level) const @@ -244,13 +244,13 @@ LLFeatureList *LLFeatureManager::findMask(const std::string& name) return NULL; } -BOOL LLFeatureManager::maskFeatures(const std::string& name) +bool LLFeatureManager::maskFeatures(const std::string& name) { LLFeatureList *maskp = findMask(name); if (!maskp) { LL_DEBUGS("RenderInit") << "Unknown feature mask " << name << LL_ENDL; - return FALSE; + return false; } LL_INFOS("RenderInit") << "Applying GPU Feature list: " << name << LL_ENDL; return maskList(*maskp); @@ -295,7 +295,7 @@ bool LLFeatureManager::parseFeatureTable(std::string filename) if (!file) { LL_WARNS("RenderInit") << "Unable to open feature table " << filename << LL_ENDL; - return FALSE; + return false; } // Check file version @@ -458,7 +458,7 @@ bool LLFeatureManager::loadGPUClass() // defaults mGPUString = gGLManager.getRawGLString(); - mGPUSupported = TRUE; + mGPUSupported = true; return true; // indicates that a gpu value was established } @@ -540,7 +540,7 @@ void LLFeatureManager::applyFeatures(bool skipFeatures) // handle all the different types if(ctrl->isType(TYPE_BOOLEAN)) { - gSavedSettings.setBOOL(mIt->first, (BOOL)getRecommendedValue(mIt->first)); + gSavedSettings.setBOOL(mIt->first, (bool)getRecommendedValue(mIt->first)); } else if (ctrl->isType(TYPE_S32)) { diff --git a/indra/newview/llfeaturemanager.h b/indra/newview/llfeaturemanager.h index c333e2caeb..22de6afbae 100644 --- a/indra/newview/llfeaturemanager.h +++ b/indra/newview/llfeaturemanager.h @@ -50,15 +50,15 @@ typedef enum EGPUClass class LLFeatureInfo { public: - LLFeatureInfo() : mValid(FALSE), mAvailable(FALSE), mRecommendedLevel(-1) {} - LLFeatureInfo(const std::string& name, const BOOL available, const F32 level); + LLFeatureInfo() : mValid(false), mAvailable(false), mRecommendedLevel(-1) {} + LLFeatureInfo(const std::string& name, const bool available, const F32 level); - BOOL isValid() const { return mValid; }; + bool isValid() const { return mValid; }; public: - BOOL mValid; + bool mValid; std::string mName; - BOOL mAvailable; + bool mAvailable; F32 mRecommendedLevel; }; @@ -71,17 +71,17 @@ public: LLFeatureList(const std::string& name); virtual ~LLFeatureList(); - BOOL isFeatureAvailable(const std::string& name); + bool isFeatureAvailable(const std::string& name); F32 getRecommendedValue(const std::string& name); - void setFeatureAvailable(const std::string& name, const BOOL available); + void setFeatureAvailable(const std::string& name, const bool available); void setRecommendedLevel(const std::string& name, const F32 level); bool loadFeatureList(LLFILE *fp); - BOOL maskList(LLFeatureList &mask); + bool maskList(LLFeatureList &mask); - void addFeature(const std::string& name, const BOOL available, const F32 level); + void addFeature(const std::string& name, const bool available, const F32 level); feature_map_t& getFeatures() { @@ -115,17 +115,17 @@ public: // get the measured GPU memory bandwidth in GB/sec // may return 0 of benchmark has not been run or failed to run F32 getGPUMemoryBandwidth() { return mGPUMemoryBandwidth; } - BOOL isGPUSupported() { return mGPUSupported; } + bool isGPUSupported() { return mGPUSupported; } F32 getExpectedGLVersion() { return mExpectedGLVersion; } void cleanupFeatureTables(); S32 getVersion() const { return mTableVersion; } - void setSafe(const BOOL safe) { mSafe = safe; } - BOOL isSafe() const { return mSafe; } + void setSafe(const bool safe) { mSafe = safe; } + bool isSafe() const { return mSafe; } LLFeatureList *findMask(const std::string& name); - BOOL maskFeatures(const std::string& name); + bool maskFeatures(const std::string& name); // set the graphics to low, medium, high, or ultra. // skipFeatures forces skipping of mostly hardware settings @@ -156,32 +156,32 @@ protected: bool loadGPUClass(); bool parseFeatureTable(std::string filename); - ///< @returns TRUE is file parsed correctly, FALSE if not + ///< @returns true is file parsed correctly, false if not void initBaseMask(); std::map<std::string, LLFeatureList *> mMaskList; std::set<std::string> mSkippedFeatures; - BOOL mInited; + bool mInited; S32 mTableVersion; - BOOL mSafe; // Reinitialize everything to the "safe" mask + bool mSafe; // Reinitialize everything to the "safe" mask EGPUClass mGPUClass; F32 mGPUMemoryBandwidth = 0.f; // measured memory bandwidth of GPU in GB/second F32 mExpectedGLVersion; //expected GL version according to gpu table std::string mGPUString; - BOOL mGPUSupported; + bool mGPUSupported; }; inline LLFeatureManager::LLFeatureManager() : LLFeatureList("default"), - mInited(FALSE), + mInited(false), mTableVersion(0), - mSafe(FALSE), + mSafe(false), mGPUClass(GPU_CLASS_UNKNOWN), mExpectedGLVersion(0.f), - mGPUSupported(FALSE) + mGPUSupported(false) { } diff --git a/indra/newview/llfetchedgltfmaterial.cpp b/indra/newview/llfetchedgltfmaterial.cpp index 5296f40119..c2821d56d6 100644 --- a/indra/newview/llfetchedgltfmaterial.cpp +++ b/indra/newview/llfetchedgltfmaterial.cpp @@ -46,7 +46,7 @@ LLFetchedGLTFMaterial::LLFetchedGLTFMaterial() LLFetchedGLTFMaterial::~LLFetchedGLTFMaterial() { - + } LLFetchedGLTFMaterial& LLFetchedGLTFMaterial::operator=(const LLFetchedGLTFMaterial& rhs) @@ -142,7 +142,6 @@ void LLFetchedGLTFMaterial::bind(LLViewerTexture* media_tex) mTextureTransform[GLTF_TEXTURE_INFO_EMISSIVE].getPacked(emissive_packed); shader->uniform4fv(LLShaderMgr::TEXTURE_EMISSIVE_TRANSFORM, 2, (F32*)emissive_packed); } - } LLViewerFetchedTexture* fetch_texture(const LLUUID& id) @@ -150,8 +149,8 @@ LLViewerFetchedTexture* fetch_texture(const LLUUID& id) LLViewerFetchedTexture* img = nullptr; if (id.notNull()) { - img = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); - img->addTextureStats(64.f * 64.f, TRUE); + img = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + img->addTextureStats(64.f * 64.f, true); } return img; }; diff --git a/indra/newview/llfetchedgltfmaterial.h b/indra/newview/llfetchedgltfmaterial.h index 7550c75b45..634a4853b0 100644 --- a/indra/newview/llfetchedgltfmaterial.h +++ b/indra/newview/llfetchedgltfmaterial.h @@ -70,7 +70,7 @@ public: static LLFetchedGLTFMaterial sDefault; protected: // Lifetime management - + void materialBegin(); void materialComplete(bool success); diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp index 7f0a8d3787..0791489c84 100644 --- a/indra/newview/llfilepicker.cpp +++ b/indra/newview/llfilepicker.cpp @@ -174,9 +174,9 @@ void LLFilePicker::reset() #if LL_WINDOWS -BOOL LLFilePicker::setupFilter(ELoadFilter filter) +bool LLFilePicker::setupFilter(ELoadFilter filter) { - BOOL res = TRUE; + bool res = true; switch (filter) { case FFLOAD_ALL: @@ -247,24 +247,24 @@ BOOL LLFilePicker::setupFilter(ELoadFilter filter) L"\0"; break; default: - res = FALSE; + res = false; break; } return res; } -BOOL LLFilePicker::getOpenFile(ELoadFilter filter, bool blocking) +bool LLFilePicker::getOpenFile(ELoadFilter filter, bool blocking) { - if( mLocked ) + if (mLocked) { - return FALSE; + return false; } - BOOL success = FALSE; + bool success = false; // if local file browsing is turned off, return without opening dialog - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { - return FALSE; + return false; } // don't provide default file selection @@ -304,27 +304,27 @@ BOOL LLFilePicker::getOpenFile(ELoadFilter filter, bool blocking) return success; } -BOOL LLFilePicker::getOpenFileModeless(ELoadFilter filter, +bool LLFilePicker::getOpenFileModeless(ELoadFilter filter, void (*callback)(bool, std::vector<std::string> &, void*), void *userdata) { // not supposed to be used yet, use LLFilePickerThread LL_ERRS() << "NOT IMPLEMENTED" << LL_ENDL; - return FALSE; + return false; } -BOOL LLFilePicker::getMultipleOpenFiles(ELoadFilter filter, bool blocking) +bool LLFilePicker::getMultipleOpenFiles(ELoadFilter filter, bool blocking) { if( mLocked ) { - return FALSE; + return false; } - BOOL success = FALSE; + bool success = false; // if local file browsing is turned off, return without opening dialog - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { - return FALSE; + return false; } // don't provide default file selection @@ -390,27 +390,27 @@ BOOL LLFilePicker::getMultipleOpenFiles(ELoadFilter filter, bool blocking) return success; } -BOOL LLFilePicker::getMultipleOpenFilesModeless(ELoadFilter filter, +bool LLFilePicker::getMultipleOpenFilesModeless(ELoadFilter filter, void (*callback)(bool, std::vector<std::string> &, void*), void *userdata ) { // not supposed to be used yet, use LLFilePickerThread LL_ERRS() << "NOT IMPLEMENTED" << LL_ENDL; - return FALSE; + return false; } -BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename, bool blocking) +bool LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename, bool blocking) { if( mLocked ) { - return FALSE; + return false; } - BOOL success = FALSE; + bool success = false; // if local file browsing is turned off, return without opening dialog - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { - return FALSE; + return false; } mOFN.lpstrFile = mFilesW; @@ -520,11 +520,11 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename, case FFSAVE_GLTF: if (filename.empty()) { - wcsncpy( mFilesW,L"untitled.glb", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/ + wcsncpy( mFilesW,L"untitled.gltf", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/ } - mOFN.lpstrDefExt = L"glb"; + mOFN.lpstrDefExt = L"gltf"; mOFN.lpstrFilter = - L"glTF Asset File (*.gltf *.glb)\0*.gltf;*.glb\0" \ + L"glTF Asset File (*.gltf)\0*.gltf\0" \ L"\0"; break; case FFSAVE_XML: @@ -576,7 +576,7 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename, mOFN.lpstrFilter = L"LSL Files (*.lsl)\0*.lsl\0" L"\0"; break; default: - return FALSE; + return false; } @@ -619,14 +619,14 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename, return success; } -BOOL LLFilePicker::getSaveFileModeless(ESaveFilter filter, +bool LLFilePicker::getSaveFileModeless(ESaveFilter filter, const std::string& filename, void (*callback)(bool, std::string&, void*), void *userdata) { // not supposed to be used yet, use LLFilePickerThread LL_ERRS() << "NOT IMPLEMENTED" << LL_ENDL; - return FALSE; + return false; } #elif LL_DARWIN @@ -701,10 +701,10 @@ std::unique_ptr<std::vector<std::string>> LLFilePicker::navOpenFilterProc(ELoadF return allowedv; } -bool LLFilePicker::doNavChooseDialog(ELoadFilter filter) +bool LLFilePicker::doNavChooseDialog(ELoadFilter filter) { // if local file browsing is turned off, return without opening dialog - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { return false; } @@ -728,12 +728,12 @@ bool LLFilePicker::doNavChooseDialog(ELoadFilter filter) return false; } -bool LLFilePicker::doNavChooseDialogModeless(ELoadFilter filter, +bool LLFilePicker::doNavChooseDialogModeless(ELoadFilter filter, void (*callback)(bool, std::vector<std::string> &,void*), void *userdata) { // if local file browsing is turned off, return without opening dialog - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { return false; } @@ -796,7 +796,7 @@ void set_nav_save_data(LLFilePicker::ESaveFilter filter, std::string &extension, case LLFilePicker::FFSAVE_GLTF: type = "\?\?\?\?"; creator = "\?\?\?\?"; - extension = "glb"; + extension = "gltf"; break; case LLFilePicker::FFSAVE_XML: @@ -832,7 +832,7 @@ void set_nav_save_data(LLFilePicker::ESaveFilter filter, std::string &extension, } } -bool LLFilePicker::doNavSaveDialog(ESaveFilter filter, const std::string& filename) +bool LLFilePicker::doNavSaveDialog(ESaveFilter filter, const std::string& filename) { // Setup the type, creator, and extension std::string extension, type, creator; @@ -862,7 +862,7 @@ bool LLFilePicker::doNavSaveDialog(ESaveFilter filter, const std::string& fil return false; } -bool LLFilePicker::doNavSaveDialogModeless(ESaveFilter filter, +bool LLFilePicker::doNavSaveDialogModeless(ESaveFilter filter, const std::string& filename, void (*callback)(bool, std::string&, void*), void *userdata) @@ -886,17 +886,17 @@ bool LLFilePicker::doNavSaveDialogModeless(ESaveFilter filter, return true; } -BOOL LLFilePicker::getOpenFile(ELoadFilter filter, bool blocking) +bool LLFilePicker::getOpenFile(ELoadFilter filter, bool blocking) { if( mLocked ) - return FALSE; + return false; - BOOL success = FALSE; + bool success = false; // if local file browsing is turned off, return without opening dialog - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { - return FALSE; + return false; } reset(); @@ -906,7 +906,6 @@ BOOL LLFilePicker::getOpenFile(ELoadFilter filter, bool blocking) if (filter == FFLOAD_DIRECTORY) //This should only be called from lldirpicker. { - mPickOptions |= ( F_NAV_SUPPORT | F_DIRECTORY ); mPickOptions &= ~F_FILE; } @@ -942,17 +941,17 @@ BOOL LLFilePicker::getOpenFile(ELoadFilter filter, bool blocking) } -BOOL LLFilePicker::getOpenFileModeless(ELoadFilter filter, +bool LLFilePicker::getOpenFileModeless(ELoadFilter filter, void (*callback)(bool, std::vector<std::string> &, void*), void *userdata) { - if( mLocked ) - return FALSE; + if (mLocked) + return false; // if local file browsing is turned off, return without opening dialog - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { - return FALSE; + return false; } reset(); @@ -975,18 +974,18 @@ BOOL LLFilePicker::getOpenFileModeless(ELoadFilter filter, return doNavChooseDialogModeless(filter, callback, userdata); } -BOOL LLFilePicker::getMultipleOpenFiles(ELoadFilter filter, bool blocking) +bool LLFilePicker::getMultipleOpenFiles(ELoadFilter filter, bool blocking) { - if( mLocked ) - return FALSE; + if (mLocked) + return false; // if local file browsing is turned off, return without opening dialog - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { - return FALSE; + return false; } - BOOL success = FALSE; + bool success = false; reset(); @@ -1021,17 +1020,17 @@ BOOL LLFilePicker::getMultipleOpenFiles(ELoadFilter filter, bool blocking) } -BOOL LLFilePicker::getMultipleOpenFilesModeless(ELoadFilter filter, +bool LLFilePicker::getMultipleOpenFilesModeless(ELoadFilter filter, void (*callback)(bool, std::vector<std::string> &, void*), void *userdata ) { - if( mLocked ) - return FALSE; + if (mLocked) + return false; // if local file browsing is turned off, return without opening dialog - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { - return FALSE; + return false; } reset(); @@ -1043,15 +1042,16 @@ BOOL LLFilePicker::getMultipleOpenFilesModeless(ELoadFilter filter, return doNavChooseDialogModeless(filter, callback, userdata); } -BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename, bool blocking) +bool LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename, bool blocking) { - if( mLocked ) + if (mLocked) return false; - BOOL success = false; + + bool success = false; // if local file browsing is turned off, return without opening dialog - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { return false; } @@ -1084,16 +1084,16 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename, return success; } -BOOL LLFilePicker::getSaveFileModeless(ESaveFilter filter, +bool LLFilePicker::getSaveFileModeless(ESaveFilter filter, const std::string& filename, void (*callback)(bool, std::string&, void*), void *userdata) { - if( mLocked ) + if (mLocked) return false; // if local file browsing is turned off, return without opening dialog - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { return false; } @@ -1137,17 +1137,17 @@ BOOL LLFilePicker::getMultipleOpenFilesModeless(ELoadFilter filter, -BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename, bool blocking ) +bool LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename, bool blocking ) { return openFileDialog( filter, blocking, eSaveFile ); } -BOOL LLFilePicker::getOpenFile( ELoadFilter filter, bool blocking ) +bool LLFilePicker::getOpenFile( ELoadFilter filter, bool blocking ) { return openFileDialog( filter, blocking, eOpenFile ); } -BOOL LLFilePicker::getMultipleOpenFiles( ELoadFilter filter, bool blocking) +bool LLFilePicker::getMultipleOpenFiles( ELoadFilter filter, bool blocking) { return openFileDialog( filter, blocking, eOpenMultiple ); } @@ -1336,13 +1336,13 @@ bool LLFilePicker::openFileDialog( int32_t filter, bool blocking, EType aType ) // Hacky stubs designed to facilitate fake getSaveFile and getOpenFile with // static results, when we don't have a real filepicker. -BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename, bool blocking ) +bool LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename, bool blocking ) { // if local file browsing is turned off, return without opening dialog // (Even though this is a stub, I think we still should not return anything at all) - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { - return FALSE; + return false; } reset(); @@ -1352,27 +1352,27 @@ BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename, if (!filename.empty()) { mFiles.push_back(gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter() + filename); - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLFilePicker::getSaveFileModeless(ESaveFilter filter, +bool LLFilePicker::getSaveFileModeless(ESaveFilter filter, const std::string& filename, void (*callback)(bool, std::string&, void*), void *userdata) { LL_ERRS() << "NOT IMPLEMENTED" << LL_ENDL; - return FALSE; + return false; } -BOOL LLFilePicker::getOpenFile( ELoadFilter filter, bool blocking ) +bool LLFilePicker::getOpenFile( ELoadFilter filter, bool blocking ) { // if local file browsing is turned off, return without opening dialog // (Even though this is a stub, I think we still should not return anything at all) - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { - return FALSE; + return false; } reset(); @@ -1388,58 +1388,58 @@ BOOL LLFilePicker::getOpenFile( ELoadFilter filter, bool blocking ) } mFiles.push_back(filename); LL_INFOS() << "getOpenFile: Will try to open file: " << filename << LL_ENDL; - return TRUE; + return true; } -BOOL LLFilePicker::getOpenFileModeless(ELoadFilter filter, +bool LLFilePicker::getOpenFileModeless(ELoadFilter filter, void (*callback)(bool, std::vector<std::string> &, void*), void *userdata) { LL_ERRS() << "NOT IMPLEMENTED" << LL_ENDL; - return FALSE; + return false; } -BOOL LLFilePicker::getMultipleOpenFiles( ELoadFilter filter, bool blocking) +bool LLFilePicker::getMultipleOpenFiles( ELoadFilter filter, bool blocking) { // if local file browsing is turned off, return without opening dialog // (Even though this is a stub, I think we still should not return anything at all) - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { - return FALSE; + return false; } reset(); - return FALSE; + return false; } -BOOL LLFilePicker::getMultipleOpenFilesModeless(ELoadFilter filter, +bool LLFilePicker::getMultipleOpenFilesModeless(ELoadFilter filter, void (*callback)(bool, std::vector<std::string> &, void*), void *userdata ) { LL_ERRS() << "NOT IMPLEMENTED" << LL_ENDL; - return FALSE; + return false; } #endif // LL_FLTK #else // not implemented -BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename, bool blocking ) +bool LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename, bool blocking ) { reset(); - return FALSE; + return false; } -BOOL LLFilePicker::getOpenFile( ELoadFilter filter, bool blocking ) +bool LLFilePicker::getOpenFile( ELoadFilter filter, bool blocking ) { reset(); - return FALSE; + return false; } -BOOL LLFilePicker::getMultipleOpenFiles( ELoadFilter filter, bool blocking) +bool LLFilePicker::getMultipleOpenFiles( ELoadFilter filter, bool blocking) { reset(); - return FALSE; + return false; } #endif // LL_LINUX diff --git a/indra/newview/llfilepicker.h b/indra/newview/llfilepicker.h index faffee7aba..b99156c61e 100644 --- a/indra/newview/llfilepicker.h +++ b/indra/newview/llfilepicker.h @@ -101,17 +101,17 @@ public: }; // open the dialog. This is a modal operation - BOOL getSaveFile( ESaveFilter filter = FFSAVE_ALL, const std::string& filename = LLStringUtil::null, bool blocking = true); - BOOL getSaveFileModeless(ESaveFilter filter, + bool getSaveFile( ESaveFilter filter = FFSAVE_ALL, const std::string& filename = LLStringUtil::null, bool blocking = true); + bool getSaveFileModeless(ESaveFilter filter, const std::string& filename, void (*callback)(bool, std::string&, void*), void *userdata); - BOOL getOpenFile( ELoadFilter filter = FFLOAD_ALL, bool blocking = true ); + bool getOpenFile( ELoadFilter filter = FFLOAD_ALL, bool blocking = true ); // Todo: implement getOpenFileModeless and getMultipleOpenFilesModeless // for windows and use directly instead of ugly LLFilePickerThread - BOOL getOpenFileModeless( ELoadFilter filter, void (*callback)(bool, std::vector<std::string> &, void*), void *userdata); // MAC only. - BOOL getMultipleOpenFiles( ELoadFilter filter = FFLOAD_ALL, bool blocking = true ); - BOOL getMultipleOpenFilesModeless( ELoadFilter filter, void (*callback)(bool, std::vector<std::string> &, void*), void *userdata ); // MAC only + bool getOpenFileModeless( ELoadFilter filter, void (*callback)(bool, std::vector<std::string> &, void*), void *userdata); // MAC only. + bool getMultipleOpenFiles( ELoadFilter filter = FFLOAD_ALL, bool blocking = true ); + bool getMultipleOpenFilesModeless( ELoadFilter filter, void (*callback)(bool, std::vector<std::string> &, void*), void *userdata ); // MAC only // Get the filename(s) found. getFirstFile() sets the pointer to // the start of the structure and allows the start of iteration. @@ -154,7 +154,7 @@ private: OPENFILENAMEW mOFN; // for open and save dialogs WCHAR mFilesW[FILENAME_BUFFER_SIZE]; - BOOL setupFilter(ELoadFilter filter); + bool setupFilter(ELoadFilter filter); #endif #if LL_DARWIN diff --git a/indra/newview/llfilepicker_mac.mm b/indra/newview/llfilepicker_mac.mm index 4dd8bea4e1..b21bc724fb 100644 --- a/indra/newview/llfilepicker_mac.mm +++ b/indra/newview/llfilepicker_mac.mm @@ -121,7 +121,7 @@ void doLoadDialogModeless(const std::vector<std::string>* allowed_types, [panel beginWithCompletionHandler:^(NSModalResponse result) { std::vector<std::string> outfiles; - if (result == NSOKButton) + if (result == NSModalResponseOK) { NSArray *filesToOpen = [panel URLs]; int i, count = [filesToOpen count]; diff --git a/indra/newview/llfirstuse.cpp b/indra/newview/llfirstuse.cpp index 8c0aa4b8a5..ca42958c41 100644 --- a/indra/newview/llfirstuse.cpp +++ b/indra/newview/llfirstuse.cpp @@ -144,7 +144,7 @@ void LLFirstUse::firstUseNotification(const std::string& control_var, bool enabl LL_DEBUGS("LLFirstUse") << "Disabling first use notification " << notification_name << LL_ENDL; LLNotifications::instance().cancelByName(notification_name); // redundantly clear settings var here, in case there are no notifications to cancel - gWarningSettings.setBOOL(control_var, FALSE); + gWarningSettings.setBOOL(control_var, false); } } @@ -169,7 +169,7 @@ bool LLFirstUse::processNotification(const LLSD& notify) if (notification) { // disable any future notifications - gWarningSettings.setBOOL(notification->getPayload()["control_var"], FALSE); + gWarningSettings.setBOOL((std::string)notification->getPayload()["control_var"], false); } } return false; diff --git a/indra/newview/llflexibleobject.cpp b/indra/newview/llflexibleobject.cpp index 7ed62d68bd..367803b78a 100644 --- a/indra/newview/llflexibleobject.cpp +++ b/indra/newview/llflexibleobject.cpp @@ -60,8 +60,8 @@ LLVolumeImplFlexible::LLVolumeImplFlexible(LLViewerObject* vo, LLFlexibleObjectD { static U32 seed = 0; mID = seed++; - mInitialized = FALSE; - mUpdated = FALSE; + mInitialized = false; + mUpdated = false; mInitializedRes = -1; mSimulateRes = 0; mCollisionSphereRadius = 0.f; @@ -72,13 +72,13 @@ LLVolumeImplFlexible::LLVolumeImplFlexible(LLViewerObject* vo, LLFlexibleObjectD mVO->mDrawable->makeActive() ; } - mInstanceIndex = sInstanceList.size(); + mInstanceIndex = static_cast<S32>(sInstanceList.size()); sInstanceList.push_back(this); }//----------------------------------------------- LLVolumeImplFlexible::~LLVolumeImplFlexible() { - S32 end_idx = sInstanceList.size()-1; + S32 end_idx = static_cast<S32>(sInstanceList.size()) - 1; if (end_idx != mInstanceIndex) { @@ -119,7 +119,7 @@ LLQuaternion LLVolumeImplFlexible::getFrameRotation() const return mVO->getRenderRotation(); } -void LLVolumeImplFlexible::onParameterChanged(U16 param_type, LLNetworkData *data, BOOL in_use, bool local_origin) +void LLVolumeImplFlexible::onParameterChanged(U16 param_type, LLNetworkData *data, bool in_use, bool local_origin) { if (param_type == LLNetworkData::PARAMS_FLEXIBLE) { @@ -324,7 +324,7 @@ void LLVolumeImplFlexible::updateRenderRes() { mSimulateRes = new_res; setAttributesOfAllSections(); - mInitialized = TRUE; + mInitialized = true; } } //--------------------------------------------------------------------------------- @@ -433,7 +433,7 @@ void LLVolumeImplFlexible::doFlexibleUpdate() LLPath *path = &volume->getPath(); if ((mSimulateRes == 0 || !mInitialized) && mVO->mDrawable->isVisible()) { - BOOL force_update = mSimulateRes == 0 ? TRUE : FALSE; + bool force_update = mSimulateRes == 0; doIdleUpdate(); if (!force_update || !gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FLEXIBLE)) @@ -442,10 +442,10 @@ void LLVolumeImplFlexible::doFlexibleUpdate() } } - if(!mInitialized || !mAttributes) + if (!mInitialized || !mAttributes) { //the object is not visible - return ; + return; } // Fix for MAINT-1894 @@ -668,7 +668,7 @@ void LLVolumeImplFlexible::doFlexibleUpdate() S32 num_render_sections = 1<<mRenderRes; if (path->getPathLength() != num_render_sections+1) { - ((LLVOVolume*) mVO)->mVolumeChanged = TRUE; + ((LLVOVolume*) mVO)->mVolumeChanged = true; volume->resizePath(num_render_sections+1); } @@ -708,7 +708,7 @@ void LLVolumeImplFlexible::doFlexibleUpdate() if (!mUpdated || (np-pos).magVec()/mVO->mDrawable->mDistanceWRTCamera > 0.001f) { new_point->mPos.load3((newSection[i].mPosition * rel_xform).mV); - mUpdated = FALSE; + mUpdated = false; } new_point->mRot.loadu(LLMatrix3(rot)); @@ -741,17 +741,17 @@ void LLVolumeImplFlexible::doFlexibleRebuild(bool rebuild_volume) volume->regen(); } - mUpdated = TRUE; + mUpdated = true; } //------------------------------------------------------------------ -void LLVolumeImplFlexible::onSetScale(const LLVector3& scale, BOOL damped) +void LLVolumeImplFlexible::onSetScale(const LLVector3& scale, bool damped) { setAttributesOfAllSections((LLVector3*) &scale); } -BOOL LLVolumeImplFlexible::doUpdateGeometry(LLDrawable *drawable) +bool LLVolumeImplFlexible::doUpdateGeometry(LLDrawable *drawable) { LL_PROFILE_ZONE_SCOPED; LLVOVolume *volume = (LLVOVolume*)mVO; @@ -770,21 +770,21 @@ BOOL LLVolumeImplFlexible::doUpdateGeometry(LLDrawable *drawable) LLVOAvatar* avatar = (LLVOAvatar*) parent; if (avatar->isImpostor() && !avatar->needsImpostorUpdate()) { - return TRUE; + return true; } } } if (volume->mDrawable.isNull()) { - return TRUE; // No update to complete + return true; // No update to complete } if (volume->mLODChanged) { LLVolumeParams volume_params = volume->getVolume()->getParams(); volume->setVolume(volume_params, 0); - mUpdated = FALSE; + mUpdated = false; } volume->updateRelativeXform(); @@ -792,12 +792,12 @@ BOOL LLVolumeImplFlexible::doUpdateGeometry(LLDrawable *drawable) doFlexibleUpdate(); // Object may have been rotated, which means it needs a rebuild. See SL-47220 - BOOL rotated = FALSE; + bool rotated = false; LLQuaternion cur_rotation = getFrameRotation(); if ( cur_rotation != mLastFrameRotation ) { mLastFrameRotation = cur_rotation; - rotated = TRUE; + rotated = true; } if (volume->mLODChanged || volume->mFaceMappingChanged || @@ -822,14 +822,14 @@ BOOL LLVolumeImplFlexible::doUpdateGeometry(LLDrawable *drawable) volume->genBBoxes(isVolumeGlobal()); } - volume->mVolumeChanged = FALSE; - volume->mLODChanged = FALSE; - volume->mFaceMappingChanged = FALSE; + volume->mVolumeChanged = false; + volume->mLODChanged = false; + volume->mFaceMappingChanged = false; // clear UV flag drawable->clearState(LLDrawable::UV); - return TRUE; + return true; } //---------------------------------------------------------------------------------- diff --git a/indra/newview/llflexibleobject.h b/indra/newview/llflexibleobject.h index b4a8659c41..958bf9029c 100644 --- a/indra/newview/llflexibleobject.h +++ b/indra/newview/llflexibleobject.h @@ -87,11 +87,11 @@ private: LLVolumeInterfaceType getInterfaceType() const { return INTERFACE_FLEXIBLE; } void updateRenderRes(); void doIdleUpdate(); - BOOL doUpdateGeometry(LLDrawable *drawable); + bool doUpdateGeometry(LLDrawable *drawable); LLVector3 getPivotPosition() const; void onSetVolume(const LLVolumeParams &volume_params, const S32 detail); - void onSetScale(const LLVector3 &scale, BOOL damped); - void onParameterChanged(U16 param_type, LLNetworkData *data, BOOL in_use, bool local_origin); + void onSetScale(const LLVector3 &scale, bool damped); + void onParameterChanged(U16 param_type, LLNetworkData *data, bool in_use, bool local_origin); void onShift(const LLVector4a &shift_vector); bool isVolumeUnique() const { return true; } bool isVolumeGlobal() const { return true; } @@ -125,8 +125,8 @@ private: LLQuaternion mParentRotation; LLQuaternion mLastFrameRotation; LLQuaternion mLastSegmentRotation; - BOOL mInitialized; - BOOL mUpdated; + bool mInitialized; + bool mUpdated; LLFlexibleObjectData* mAttributes; LLFlexibleObjectSection mSection [ (1<<FLEXIBLE_OBJECT_MAX_SECTIONS)+1 ]; S32 mInitializedRes; diff --git a/indra/newview/llfloater360capture.cpp b/indra/newview/llfloater360capture.cpp index f3b924a306..66796276a9 100644 --- a/indra/newview/llfloater360capture.cpp +++ b/indra/newview/llfloater360capture.cpp @@ -1,4 +1,4 @@ -/** +/** * @file llfloater360capture.cpp * @author Callum Prentice (callum@lindenlab.com) * @brief Floater code for the 360 Capture feature @@ -67,7 +67,7 @@ LLFloater360Capture::LLFloater360Capture(const LLSD& key) mStartILMode = gAgent.getInterestListMode(); // send everything to us for as long as this floater is open - gAgent.changeInterestListMode(LLViewerRegion::IL_MODE_360); + gAgent.changeInterestListMode(IL_MODE_360); } LLFloater360Capture::~LLFloater360Capture() @@ -91,7 +91,7 @@ LLFloater360Capture::~LLFloater360Capture() } } -BOOL LLFloater360Capture::postBuild() +bool LLFloater360Capture::postBuild() { mCaptureBtn = getChild<LLUICtrl>("capture_button"); mCaptureBtn->setCommitCallback(boost::bind(&LLFloater360Capture::onCapture360ImagesBtn, this)); @@ -360,6 +360,8 @@ void LLFloater360Capture::encodeAndSave(LLPointer<LLImageRaw> raw_image, const s int jpeg_encode_quality = gSavedSettings.getU32("360CaptureJPEGEncodeQuality"); LLPointer<LLImageJPEG> jpeg_image = new LLImageJPEG(jpeg_encode_quality); + LLImageDataSharedLock lock(raw_image); + // Actually encode the JPEG image. This is where a lot of time // is spent now that the snapshot capture process has been // optimized. The encode_time parameter doesn't appear to be @@ -410,14 +412,16 @@ void LLFloater360Capture::suspendForAFrame() // Probably not needed anymore but saving here just in case. void LLFloater360Capture::mockSnapShot(LLImageRaw* raw) { + LLImageDataLock lock(raw); + unsigned int width = raw->getWidth(); unsigned int height = raw->getHeight(); unsigned int depth = raw->getComponents(); unsigned char* pixels = raw->getData(); - for (int y = 0; y < height; y++) + for (unsigned int y = 0; y < height; y++) { - for (int x = 0; x < width; x++) + for (unsigned int x = 0; x < width; x++) { unsigned long offset = y * width * depth + x * depth; unsigned char red = x * 256 / width; @@ -449,7 +453,7 @@ void LLFloater360Capture::capture360Images() if (gSavedSettings.getBOOL("360CaptureHideAvatars")) { // Turn off the avatar if UI tells us to hide it. - // Note: the original call to gAvatar.hide(FALSE) did *not* hide + // Note: the original call to gAvatar.hide(false) did *not* hide // attachments and so for most residents, there would be some debris // left behind in the snapshot. // Note: this toggles so if it set to on, this will turn it off and @@ -458,7 +462,7 @@ void LLFloater360Capture::capture360Images() // was set to off - I think this is what we need LLPipeline::toggleRenderTypeControl(LLPipeline::RENDER_TYPE_AVATAR); LLPipeline::toggleRenderTypeControl(LLPipeline::RENDER_TYPE_PARTICLES); - LLPipeline::sRenderAttachedLights = FALSE; + LLPipeline::sRenderAttachedLights = false; } // these are the 6 directions we will point the camera - essentially, @@ -807,7 +811,7 @@ void LLFloater360Capture::freezeWorld(bool enable) { // restart the clouds moving if they were not paused before // we starting using the 360 capture floater - if (clouds_scroll_paused == false) + if (!clouds_scroll_paused) { LLEnvironment::instance().resumeCloudScroll(); } diff --git a/indra/newview/llfloater360capture.h b/indra/newview/llfloater360capture.h index 3fb2c7f3c7..f0b4057645 100644 --- a/indra/newview/llfloater360capture.h +++ b/indra/newview/llfloater360capture.h @@ -46,7 +46,7 @@ class LLFloater360Capture: LLFloater360Capture(const LLSD& key); ~LLFloater360Capture(); - BOOL postBuild() override; + bool postBuild() override; void onOpen(const LLSD& key) override; void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) override; diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp index ccedf84073..a6419f5ad4 100644 --- a/indra/newview/llfloaterabout.cpp +++ b/indra/newview/llfloaterabout.cpp @@ -83,7 +83,7 @@ private: virtual ~LLFloaterAbout(); public: - /*virtual*/ BOOL postBuild(); + bool postBuild() override; /// Obtain the data used to fill out the contents string. This is /// separated so that we can programmatically access the same info. @@ -122,7 +122,7 @@ LLFloaterAbout::~LLFloaterAbout() { } -BOOL LLFloaterAbout::postBuild() +bool LLFloaterAbout::postBuild() { center(); LLViewerTextEditor *support_widget = @@ -157,7 +157,7 @@ BOOL LLFloaterAbout::postBuild() support_widget->blockUndo(); // Fix views - support_widget->setEnabled(FALSE); + support_widget->setEnabled(false); support_widget->startOfDoc(); // Get the names of contributors, extracted from .../doc/contributions.txt by viewer_manifest.py at build time @@ -175,7 +175,7 @@ BOOL LLFloaterAbout::postBuild() LL_WARNS("AboutInit") << "Could not read contributors file at " << contributors_path << LL_ENDL; } contrib_names_widget->setText(contributors); - contrib_names_widget->setEnabled(FALSE); + contrib_names_widget->setEnabled(false); contrib_names_widget->startOfDoc(); // Get the Versions and Copyrights, created at build time @@ -188,7 +188,7 @@ BOOL LLFloaterAbout::postBuild() licenses_widget->clear(); while ( std::getline(licenses_file, license_line) ) { - licenses_widget->appendText(license_line+"\n", FALSE, + licenses_widget->appendText(license_line+"\n", false, LLStyle::Params() .color(about_color)); } licenses_file.close(); @@ -198,10 +198,10 @@ BOOL LLFloaterAbout::postBuild() // this case will use the (out of date) hard coded value from the XUI LL_INFOS("AboutInit") << "Could not read licenses file at " << licenses_path << LL_ENDL; } - licenses_widget->setEnabled(FALSE); + licenses_widget->setEnabled(false); licenses_widget->startOfDoc(); - return TRUE; + return true; } LLSD LLFloaterAbout::getInfo() @@ -337,7 +337,7 @@ void LLFloaterAbout::setSupportText(const std::string& server_release_notes_url) LLUIColor about_color = LLUIColorTable::instance().getColor("TextFgReadOnlyColor"); support_widget->clear(); support_widget->appendText(LLAppViewer::instance()->getViewerInfoString(), - FALSE, LLStyle::Params() .color(about_color)); + false, LLStyle::Params() .color(about_color)); } //This is bound as a callback in postBuild() @@ -354,11 +354,11 @@ void LLFloaterAbout::setUpdateListener() // => update ready for install //version directory, .done file and either .skip or .next file exists // => update deferred - BOOL downloads = false; + bool downloads = false; std::string downloadDir = ""; - BOOL done = false; - BOOL next = false; - BOOL skip = false; + bool done = false; + bool next = false; + bool skip = false; LLSD info(LLFloaterAbout::getInfo()); std::string version = info["VIEWER_VERSION_STR"].asString(); diff --git a/indra/newview/llfloateraddpaymentmethod.cpp b/indra/newview/llfloateraddpaymentmethod.cpp index 4df993e49f..fc962ce89f 100644 --- a/indra/newview/llfloateraddpaymentmethod.cpp +++ b/indra/newview/llfloateraddpaymentmethod.cpp @@ -41,12 +41,12 @@ LLFloaterAddPaymentMethod::~LLFloaterAddPaymentMethod() { } -BOOL LLFloaterAddPaymentMethod::postBuild() +bool LLFloaterAddPaymentMethod::postBuild() { - setCanDrag(FALSE); + setCanDrag(false); getChild<LLButton>("continue_btn")->setCommitCallback(boost::bind(&LLFloaterAddPaymentMethod::onContinueBtn, this)); getChild<LLButton>("close_btn")->setCommitCallback(boost::bind(&LLFloaterAddPaymentMethod::onCloseBtn, this)); - return TRUE; + return true; } void LLFloaterAddPaymentMethod::onOpen(const LLSD& key) diff --git a/indra/newview/llfloateraddpaymentmethod.h b/indra/newview/llfloateraddpaymentmethod.h index a513893d70..252caf8f5b 100644 --- a/indra/newview/llfloateraddpaymentmethod.h +++ b/indra/newview/llfloateraddpaymentmethod.h @@ -34,8 +34,8 @@ class LLFloaterAddPaymentMethod: { friend class LLFloaterReg; public: - /*virtual*/ BOOL postBuild(); - /*virtual*/ void onOpen(const LLSD& key); + bool postBuild() override; + void onOpen(const LLSD& key) override; private: LLFloaterAddPaymentMethod(const LLSD& key); diff --git a/indra/newview/llfloaterauction.cpp b/indra/newview/llfloaterauction.cpp index f4a9400120..a87ddfd76e 100644 --- a/indra/newview/llfloaterauction.cpp +++ b/indra/newview/llfloaterauction.cpp @@ -43,7 +43,6 @@ #include "llmimetypes.h" #include "llnotifications.h" #include "llnotificationsutil.h" -#include "llsavedsettingsglue.h" #include "llviewertexturelist.h" #include "llviewerparcelmgr.h" #include "llviewerregion.h" @@ -87,9 +86,9 @@ LLFloaterAuction::~LLFloaterAuction() { } -BOOL LLFloaterAuction::postBuild() +bool LLFloaterAuction::postBuild() { - return TRUE; + return true; } void LLFloaterAuction::onOpen(const LLSD& key) @@ -111,9 +110,9 @@ void LLFloaterAuction::initialize() mParcelUpdateCapUrl = region->getCapability("ParcelPropertiesUpdate"); getChild<LLUICtrl>("parcel_text")->setValue(parcelp->getName()); - getChildView("snapshot_btn")->setEnabled(TRUE); - getChildView("reset_parcel_btn")->setEnabled(TRUE); - getChildView("start_auction_btn")->setEnabled(TRUE); + getChildView("snapshot_btn")->setEnabled(true); + getChildView("reset_parcel_btn")->setEnabled(true); + getChildView("start_auction_btn")->setEnabled(true); U32 estate_id = LLEstateInfoModel::instance().getID(); // Only enable "Sell to Anyone" on Teen grid or if we don't know the ID yet @@ -178,18 +177,20 @@ void LLFloaterAuction::onClickSnapshot(void* data) LLPointer<LLImageRaw> raw = new LLImageRaw; gForceRenderLandFence = self->getChild<LLUICtrl>("fence_check")->getValue().asBoolean(); - BOOL success = gViewerWindow->rawSnapshot(raw, + bool success = gViewerWindow->rawSnapshot(raw, gViewerWindow->getWindowWidthScaled(), gViewerWindow->getWindowHeightScaled(), - TRUE, - FALSE, - FALSE, //UI - FALSE, //HUD - FALSE); - gForceRenderLandFence = FALSE; + true, + false, + false, //UI + false, //HUD + false); + gForceRenderLandFence = false; if (success) { + LLImageDataLock lock(raw); + self->mTransactionID.generate(); self->mImageID = self->mTransactionID.makeAssetID(gAgent.getSecureSessionID()); @@ -215,7 +216,7 @@ void LLFloaterAuction::onClickSnapshot(void* data) LLFileSystem j2c_file(self->mImageID, LLAssetType::AT_TEXTURE, LLFileSystem::WRITE); j2c_file.write(j2c->getData(), j2c->getDataSize()); - self->mImage = LLViewerTextureManager::getLocalTexture((LLImageRaw*)raw, FALSE); + self->mImage = LLViewerTextureManager::getLocalTexture((LLImageRaw*)raw, false); gGL.getTexUnit(0)->bind(self->mImage); self->mImage->setAddressMode(LLTexUnit::TAM_CLAMP); } @@ -239,14 +240,14 @@ void LLFloaterAuction::onClickStartAuction(void* data) gAssetStorage->storeAssetData(self->mTransactionID, LLAssetType::AT_IMAGE_TGA, &auction_tga_upload_done, (void*)name, - FALSE); + false); self->getWindow()->incBusyCount(); std::string* j2c_name = new std::string(parcel_name.asString()); gAssetStorage->storeAssetData(self->mTransactionID, LLAssetType::AT_TEXTURE, &auction_j2c_upload_done, (void*)j2c_name, - FALSE); + false); self->getWindow()->incBusyCount(); LLNotificationsUtil::add("UploadingAuctionSnapshot"); diff --git a/indra/newview/llfloaterauction.h b/indra/newview/llfloaterauction.h index 3514d6cc3c..d736b36db1 100644 --- a/indra/newview/llfloaterauction.h +++ b/indra/newview/llfloaterauction.h @@ -47,8 +47,8 @@ class LLFloaterAuction : public LLFloater friend class LLFloaterReg; public: // LLFloater interface - /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ void draw(); + void onOpen(const LLSD& key) override; + void draw() override; private: @@ -63,7 +63,7 @@ private: bool onSellToAnyoneConfirmed(const LLSD& notification, const LLSD& response); // Sell confirmation clicked static void onClickStartAuction(void* data); - /*virtual*/ BOOL postBuild(); + bool postBuild() override; void doResetParcel(); void doSellToAnyone(); diff --git a/indra/newview/llfloaterautoreplacesettings.cpp b/indra/newview/llfloaterautoreplacesettings.cpp index bdcaf2dc22..99f24e161e 100644 --- a/indra/newview/llfloaterautoreplacesettings.cpp +++ b/indra/newview/llfloaterautoreplacesettings.cpp @@ -82,7 +82,7 @@ void LLFloaterAutoReplaceSettings::onClose(bool app_quitting) cleanUp(); } -BOOL LLFloaterAutoReplaceSettings::postBuild(void) +bool LLFloaterAutoReplaceSettings::postBuild(void) { // get copies of the current settings that we will operate on mEnabled = gSavedSettings.getBOOL("AutoReplace"); diff --git a/indra/newview/llfloaterautoreplacesettings.h b/indra/newview/llfloaterautoreplacesettings.h index 7f1953d485..94a7c00c15 100644 --- a/indra/newview/llfloaterautoreplacesettings.h +++ b/indra/newview/llfloaterautoreplacesettings.h @@ -40,10 +40,8 @@ class LLFloaterAutoReplaceSettings : public LLFloater public: LLFloaterAutoReplaceSettings(const LLSD& key); - /*virtual*/ BOOL postBuild(); - /*virtual*/ void onClose(bool app_quitting); - - void setData(void * data); + bool postBuild() override; + void onClose(bool app_quitting) override; private: diff --git a/indra/newview/llfloateravatar.cpp b/indra/newview/llfloateravatar.cpp index 929a7addb4..6a38d7549c 100644 --- a/indra/newview/llfloateravatar.cpp +++ b/indra/newview/llfloateravatar.cpp @@ -52,7 +52,7 @@ LLFloaterAvatar::~LLFloaterAvatar() } } -BOOL LLFloaterAvatar::postBuild() +bool LLFloaterAvatar::postBuild() { mAvatarPicker = findChild<LLMediaCtrl>("avatar_picker_contents"); if (mAvatarPicker) @@ -60,7 +60,7 @@ BOOL LLFloaterAvatar::postBuild() mAvatarPicker->clearCache(); } enableResizeCtrls(true, true, false); - return TRUE; + return true; } diff --git a/indra/newview/llfloateravatar.h b/indra/newview/llfloateravatar.h index 0832eef665..fb591c8306 100644 --- a/indra/newview/llfloateravatar.h +++ b/indra/newview/llfloateravatar.h @@ -37,8 +37,8 @@ class LLFloaterAvatar: friend class LLFloaterReg; private: LLFloaterAvatar(const LLSD& key); - /*virtual*/ ~LLFloaterAvatar(); - /*virtual*/ BOOL postBuild(); + ~LLFloaterAvatar(); + bool postBuild() override; LLMediaCtrl* mAvatarPicker; }; diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index f903b1bd8d..6087e6c0ee 100644 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -61,9 +61,9 @@ static const U32 AVATAR_PICKER_SEARCH_TIMEOUT = 180U; static std::map<LLUUID, LLAvatarName> sAvatarNameMap; LLFloaterAvatarPicker* LLFloaterAvatarPicker::show(select_callback_t callback, - BOOL allow_multiple, - BOOL closeOnSelect, - BOOL skip_agent, + bool allow_multiple, + bool closeOnSelect, + bool skip_agent, const std::string& name, LLView * frustumOrigin) { @@ -78,7 +78,7 @@ LLFloaterAvatarPicker* LLFloaterAvatarPicker::show(select_callback_t callback, floater->mSelectionCallback = callback; floater->setAllowMultiple(allow_multiple); - floater->mNearMeListComplete = FALSE; + floater->mNearMeListComplete = false; floater->mCloseOnSelect = closeOnSelect; floater->mExcludeAgentFromSearchResults = skip_agent; @@ -103,9 +103,9 @@ LLFloaterAvatarPicker* LLFloaterAvatarPicker::show(select_callback_t callback, LLFloaterAvatarPicker::LLFloaterAvatarPicker(const LLSD& key) : LLFloater(key), mNumResultsReturned(0), - mNearMeListComplete(FALSE), - mCloseOnSelect(FALSE), - mExcludeAgentFromSearchResults(FALSE), + mNearMeListComplete(false), + mCloseOnSelect(false), + mExcludeAgentFromSearchResults(false), mContextConeOpacity (0.f), mContextConeInAlpha(CONTEXT_CONE_IN_ALPHA), mContextConeOutAlpha(CONTEXT_CONE_OUT_ALPHA), @@ -114,19 +114,19 @@ LLFloaterAvatarPicker::LLFloaterAvatarPicker(const LLSD& key) mCommitCallbackRegistrar.add("Refresh.FriendList", boost::bind(&LLFloaterAvatarPicker::populateFriend, this)); } -BOOL LLFloaterAvatarPicker::postBuild() +bool LLFloaterAvatarPicker::postBuild() { getChild<LLLineEditor>("Edit")->setKeystrokeCallback( boost::bind(&LLFloaterAvatarPicker::editKeystroke, this, _1, _2),NULL); childSetAction("Find", boost::bind(&LLFloaterAvatarPicker::onBtnFind, this)); - getChildView("Find")->setEnabled(FALSE); + getChildView("Find")->setEnabled(false); childSetAction("Refresh", boost::bind(&LLFloaterAvatarPicker::onBtnRefresh, this)); getChild<LLUICtrl>("near_me_range")->setCommitCallback(boost::bind(&LLFloaterAvatarPicker::onRangeAdjust, this)); LLScrollListCtrl* searchresults = getChild<LLScrollListCtrl>("SearchResults"); searchresults->setDoubleClickCallback( boost::bind(&LLFloaterAvatarPicker::onBtnSelect, this)); searchresults->setCommitCallback(boost::bind(&LLFloaterAvatarPicker::onList, this)); - getChildView("SearchResults")->setEnabled(FALSE); + getChildView("SearchResults")->setEnabled(false); LLScrollListCtrl* nearme = getChild<LLScrollListCtrl>("NearMe"); nearme->setDoubleClickCallback(boost::bind(&LLFloaterAvatarPicker::onBtnSelect, this)); @@ -137,10 +137,10 @@ BOOL LLFloaterAvatarPicker::postBuild() getChild<LLUICtrl>("Friends")->setCommitCallback(boost::bind(&LLFloaterAvatarPicker::onList, this)); childSetAction("ok_btn", boost::bind(&LLFloaterAvatarPicker::onBtnSelect, this)); - getChildView("ok_btn")->setEnabled(FALSE); + getChildView("ok_btn")->setEnabled(false); childSetAction("cancel_btn", boost::bind(&LLFloaterAvatarPicker::onBtnClose, this)); - getChild<LLUICtrl>("Edit")->setFocus(TRUE); + getChild<LLUICtrl>("Edit")->setFocus(true); LLPanel* search_panel = getChild<LLPanel>("SearchPanel"); if (search_panel) @@ -154,13 +154,13 @@ BOOL LLFloaterAvatarPicker::postBuild() getChild<LLTabContainer>("ResidentChooserTabs")->setCommitCallback( boost::bind(&LLFloaterAvatarPicker::onTabChanged, this)); - setAllowMultiple(FALSE); + setAllowMultiple(false); center(); populateFriend(); - return TRUE; + return true; } void LLFloaterAvatarPicker::setOkBtnEnableCb(validate_callback_t cb) @@ -248,12 +248,12 @@ void LLFloaterAvatarPicker::onBtnSelect() mSelectionCallback(avatar_ids, avatar_names); } } - getChild<LLScrollListCtrl>("SearchResults")->deselectAllItems(TRUE); - getChild<LLScrollListCtrl>("NearMe")->deselectAllItems(TRUE); - getChild<LLScrollListCtrl>("Friends")->deselectAllItems(TRUE); + getChild<LLScrollListCtrl>("SearchResults")->deselectAllItems(true); + getChild<LLScrollListCtrl>("NearMe")->deselectAllItems(true); + getChild<LLScrollListCtrl>("Friends")->deselectAllItems(true); if(mCloseOnSelect) { - mCloseOnSelect = FALSE; + mCloseOnSelect = false; closeFloater(); } } @@ -262,7 +262,7 @@ void LLFloaterAvatarPicker::onBtnRefresh() { getChild<LLScrollListCtrl>("NearMe")->deleteAllItems(); getChild<LLScrollListCtrl>("NearMe")->setCommentText(getString("searching")); - mNearMeListComplete = FALSE; + mNearMeListComplete = false; } void LLFloaterAvatarPicker::onBtnClose() @@ -282,8 +282,8 @@ void LLFloaterAvatarPicker::onList() void LLFloaterAvatarPicker::populateNearMe() { - BOOL all_loaded = TRUE; - BOOL empty = TRUE; + bool all_loaded = true; + bool empty = true; LLScrollListCtrl* near_me_scroller = getChild<LLScrollListCtrl>("NearMe"); near_me_scroller->deleteAllItems(); @@ -301,7 +301,7 @@ void LLFloaterAvatarPicker::populateNearMe() { element["columns"][0]["column"] = "name"; element["columns"][0]["value"] = LLCacheName::getDefaultName(); - all_loaded = FALSE; + all_loaded = false; } else { @@ -313,27 +313,27 @@ void LLFloaterAvatarPicker::populateNearMe() sAvatarNameMap[av] = av_name; } near_me_scroller->addElement(element); - empty = FALSE; + empty = false; } if (empty) { - getChildView("NearMe")->setEnabled(FALSE); - getChildView("ok_btn")->setEnabled(FALSE); + getChildView("NearMe")->setEnabled(false); + getChildView("ok_btn")->setEnabled(false); near_me_scroller->setCommentText(getString("no_one_near")); } else { - getChildView("NearMe")->setEnabled(TRUE); - getChildView("ok_btn")->setEnabled(TRUE); + getChildView("NearMe")->setEnabled(true); + getChildView("ok_btn")->setEnabled(true); near_me_scroller->selectFirstItem(); onList(); - near_me_scroller->setFocus(TRUE); + near_me_scroller->setFocus(true); } if (all_loaded) { - mNearMeListComplete = TRUE; + mNearMeListComplete = true; } } @@ -353,7 +353,7 @@ void LLFloaterAvatarPicker::populateFriend() { friends_scroller->addStringUUIDItem(it->second, it->first); } - friends_scroller->sortByColumnIndex(0, TRUE); + friends_scroller->sortByColumnIndex(0, true); } void LLFloaterAvatarPicker::drawFrustum() @@ -385,7 +385,7 @@ void LLFloaterAvatarPicker::draw() } } -BOOL LLFloaterAvatarPicker::visibleItemsSelected() const +bool LLFloaterAvatarPicker::visibleItemsSelected() const { LLPanel* active_panel = getChild<LLTabContainer>("ResidentChooserTabs")->getCurrentPanel(); @@ -401,7 +401,7 @@ BOOL LLFloaterAvatarPicker::visibleItemsSelected() const { return getChild<LLScrollListCtrl>("Friends")->getFirstSelectedIndex() >= 0; } - return FALSE; + return false; } /*static*/ @@ -501,11 +501,11 @@ void LLFloaterAvatarPicker::find() getChild<LLScrollListCtrl>("SearchResults")->deleteAllItems(); getChild<LLScrollListCtrl>("SearchResults")->setCommentText(getString("searching")); - getChildView("ok_btn")->setEnabled(FALSE); + getChildView("ok_btn")->setEnabled(false); mNumResultsReturned = 0; } -void LLFloaterAvatarPicker::setAllowMultiple(BOOL allow_multiple) +void LLFloaterAvatarPicker::setAllowMultiple(bool allow_multiple) { getChild<LLScrollListCtrl>("SearchResults")->setAllowMultipleSelection(allow_multiple); getChild<LLScrollListCtrl>("NearMe")->setAllowMultipleSelection(allow_multiple); @@ -536,8 +536,8 @@ LLScrollListCtrl* LLFloaterAvatarPicker::getActiveList() return list; } -BOOL LLFloaterAvatarPicker::handleDragAndDrop(S32 x, S32 y, MASK mask, - BOOL drop, EDragAndDropType cargo_type, +bool LLFloaterAvatarPicker::handleDragAndDrop(S32 x, S32 y, MASK mask, + bool drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg) { @@ -549,7 +549,7 @@ BOOL LLFloaterAvatarPicker::handleDragAndDrop(S32 x, S32 y, MASK mask, if (localRectToOtherView(rc_point, &rc_list, list)) { // Keep selected only one item - list->deselectAllItems(TRUE); + list->deselectAllItems(true); list->selectItemAt(rc_list.mLeft, rc_list.mBottom, mask); LLScrollListItem* selection = list->getFirstSelected(); if (selection) @@ -571,7 +571,7 @@ BOOL LLFloaterAvatarPicker::handleDragAndDrop(S32 x, S32 y, MASK mask, } } *accept = ACCEPT_NO; - return TRUE; + return true; } @@ -618,7 +618,7 @@ void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void* search_results->deleteAllItems(); } - BOOL found_one = FALSE; + bool found_one = false; S32 num_new_rows = msg->getNumberOfBlocks("Data"); for (S32 i = 0; i < num_new_rows; i++) { @@ -634,14 +634,14 @@ void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void* LLStringUtil::format_map_t map; map["[TEXT]"] = floater->getChild<LLUICtrl>("Edit")->getValue().asString(); avatar_name = floater->getString("not_found", map); - search_results->setEnabled(FALSE); - floater->getChildView("ok_btn")->setEnabled(FALSE); + search_results->setEnabled(false); + floater->getChildView("ok_btn")->setEnabled(false); } else { avatar_name = LLCacheName::buildFullName(first_name, last_name); - search_results->setEnabled(TRUE); - found_one = TRUE; + search_results->setEnabled(true); + found_one = true; LLAvatarName av_name; av_name.fromString(avatar_name); @@ -659,10 +659,10 @@ void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void* if (found_one) { - floater->getChildView("ok_btn")->setEnabled(TRUE); + floater->getChildView("ok_btn")->setEnabled(true); search_results->selectFirstItem(); floater->onList(); - search_results->setFocus(TRUE); + search_results->setFocus(true); } } @@ -724,14 +724,14 @@ void LLFloaterAvatarPicker::processResponse(const LLUUID& query_id, const LLSD& { getChildView("ok_btn")->setEnabled(true); search_results->setEnabled(true); - search_results->sortByColumnIndex(1, TRUE); + search_results->sortByColumnIndex(1, true); std::string text = getChild<LLUICtrl>("Edit")->getValue().asString(); - if (!search_results->selectItemByLabel(text, TRUE, 1)) + if (!search_results->selectItemByLabel(text, true, 1)) { search_results->selectFirstItem(); } onList(); - search_results->setFocus(TRUE); + search_results->setFocus(true); } } } @@ -743,7 +743,7 @@ void LLFloaterAvatarPicker::editKeystroke(LLLineEditor* caller, void* user_data) } // virtual -BOOL LLFloaterAvatarPicker::handleKeyHere(KEY key, MASK mask) +bool LLFloaterAvatarPicker::handleKeyHere(KEY key, MASK mask) { if (key == KEY_RETURN && mask == MASK_NONE) { @@ -755,12 +755,12 @@ BOOL LLFloaterAvatarPicker::handleKeyHere(KEY key, MASK mask) { onBtnSelect(); } - return TRUE; + return true; } else if (key == KEY_ESCAPE && mask == MASK_NONE) { closeFloater(); - return TRUE; + return true; } return LLFloater::handleKeyHere(key, mask); diff --git a/indra/newview/llfloateravatarpicker.h b/indra/newview/llfloateravatarpicker.h index f50b46f181..330f1a1226 100644 --- a/indra/newview/llfloateravatarpicker.h +++ b/indra/newview/llfloateravatarpicker.h @@ -46,29 +46,29 @@ public: typedef boost::function<void (const uuid_vec_t&, const std::vector<LLAvatarName>&)> select_callback_t; // Call this to select an avatar. static LLFloaterAvatarPicker* show(select_callback_t callback, - BOOL allow_multiple = FALSE, - BOOL closeOnSelect = FALSE, - BOOL skip_agent = FALSE, + bool allow_multiple = false, + bool closeOnSelect = false, + bool skip_agent = false, const std::string& name = "", LLView * frustumOrigin = NULL); LLFloaterAvatarPicker(const LLSD& key); virtual ~LLFloaterAvatarPicker(); - virtual BOOL postBuild(); + virtual bool postBuild(); void setOkBtnEnableCb(validate_callback_t cb); static void processAvatarPickerReply(class LLMessageSystem* msg, void**); void processResponse(const LLUUID& query_id, const LLSD& content); - BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, - BOOL drop, EDragAndDropType cargo_type, + bool handleDragAndDrop(S32 x, S32 y, MASK mask, + bool drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg); void openFriendsTab(); - BOOL isExcludeAgentFromSearchResults() {return mExcludeAgentFromSearchResults;} + bool isExcludeAgentFromSearchResults() {return mExcludeAgentFromSearchResults;} private: void editKeystroke(class LLLineEditor* caller, void* user_data); @@ -84,22 +84,22 @@ private: void populateNearMe(); void populateFriend(); - BOOL visibleItemsSelected() const; // Returns true if any items in the current tab are selected. + bool visibleItemsSelected() const; // Returns true if any items in the current tab are selected. static void findCoro(std::string url, LLUUID mQueryID, std::string mName); void find(); - void setAllowMultiple(BOOL allow_multiple); + void setAllowMultiple(bool allow_multiple); LLScrollListCtrl* getActiveList(); void drawFrustum(); virtual void draw(); - virtual BOOL handleKeyHere(KEY key, MASK mask); + virtual bool handleKeyHere(KEY key, MASK mask); LLUUID mQueryID; int mNumResultsReturned; - BOOL mNearMeListComplete; - BOOL mCloseOnSelect; - BOOL mExcludeAgentFromSearchResults; + bool mNearMeListComplete; + bool mCloseOnSelect; + bool mExcludeAgentFromSearchResults; LLHandle <LLView> mFrustumOrigin; F32 mContextConeOpacity; F32 mContextConeInAlpha; diff --git a/indra/newview/llfloateravatarrendersettings.cpp b/indra/newview/llfloateravatarrendersettings.cpp index bc860308b3..9101e6eb29 100644 --- a/indra/newview/llfloateravatarrendersettings.cpp +++ b/indra/newview/llfloateravatarrendersettings.cpp @@ -84,13 +84,13 @@ LLFloaterAvatarRenderSettings::~LLFloaterAvatarRenderSettings() LLRenderMuteList::getInstance()->removeObserver(&sAvatarRenderMuteListObserver); } -BOOL LLFloaterAvatarRenderSettings::postBuild() +bool LLFloaterAvatarRenderSettings::postBuild() { LLFloater::postBuild(); mAvatarSettingsList = getChild<LLNameListCtrl>("render_settings_list"); mAvatarSettingsList->setRightMouseDownCallback(boost::bind(&LLFloaterAvatarRenderSettings::onAvatarListRightClick, this, _1, _2, _3)); - return TRUE; + return true; } void LLFloaterAvatarRenderSettings::draw() @@ -224,10 +224,10 @@ void LLFloaterAvatarRenderSettings::onClickAdd(const LLSD& userdata) visual_setting = S32(LLVOAvatar::AV_ALWAYS_RENDER); } - LLView * button = findChild<LLButton>("plus_btn", TRUE); + LLView * button = findChild<LLButton>("plus_btn", true); LLFloater* root_floater = gFloaterView->getParentFloater(this); LLFloaterAvatarPicker * picker = LLFloaterAvatarPicker::show(boost::bind(&LLFloaterAvatarRenderSettings::callbackAvatarPicked, this, _1, visual_setting), - FALSE, TRUE, FALSE, root_floater->getName(), button); + false, true, false, root_floater->getName(), button); if (root_floater) { @@ -259,14 +259,14 @@ void LLFloaterAvatarRenderSettings::setAvatarRenderSetting(const LLUUID& av_id, } } -BOOL LLFloaterAvatarRenderSettings::handleKeyHere(KEY key, MASK mask ) +bool LLFloaterAvatarRenderSettings::handleKeyHere(KEY key, MASK mask ) { - BOOL handled = FALSE; + bool handled = false; if (KEY_DELETE == key) { setAvatarRenderSetting(mAvatarSettingsList->getCurrentID(), (S32)LLVOAvatar::AV_RENDER_NORMALLY); - handled = TRUE; + handled = true; } return handled; } diff --git a/indra/newview/llfloateravatarrendersettings.h b/indra/newview/llfloateravatarrendersettings.h index 2e0a844afd..962a810f2d 100644 --- a/indra/newview/llfloateravatarrendersettings.h +++ b/indra/newview/llfloateravatarrendersettings.h @@ -40,10 +40,10 @@ public: LLFloaterAvatarRenderSettings(const LLSD& key); virtual ~LLFloaterAvatarRenderSettings(); - /*virtual*/ BOOL postBuild(); - /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ void draw(); - /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask ); + bool postBuild() override; + void onOpen(const LLSD& key) override; + void draw() override; + bool handleKeyHere(KEY key, MASK mask) override; void onAvatarListRightClick(LLUICtrl* ctrl, S32 x, S32 y); @@ -59,7 +59,6 @@ public: private: void callbackAvatarPicked(const uuid_vec_t& ids, S32 visual_setting); - void removePicker(); bool mNeedsUpdate; LLListContextMenu* mContextMenu; diff --git a/indra/newview/llfloateravatartextures.cpp b/indra/newview/llfloateravatartextures.cpp index 023e1501f6..b85e3cb267 100644 --- a/indra/newview/llfloateravatartextures.cpp +++ b/indra/newview/llfloateravatartextures.cpp @@ -51,7 +51,7 @@ LLFloaterAvatarTextures::~LLFloaterAvatarTextures() { } -BOOL LLFloaterAvatarTextures::postBuild() +bool LLFloaterAvatarTextures::postBuild() { for (U32 i=0; i < TEX_NUM_INDICES; i++) { @@ -63,7 +63,7 @@ BOOL LLFloaterAvatarTextures::postBuild() childSetAction("Dump", onClickDump, this); refresh(); - return TRUE; + return true; } void LLFloaterAvatarTextures::draw() diff --git a/indra/newview/llfloateravatartextures.h b/indra/newview/llfloateravatartextures.h index ee94f58cf4..b92992e163 100644 --- a/indra/newview/llfloateravatartextures.h +++ b/indra/newview/llfloateravatartextures.h @@ -40,10 +40,10 @@ public: LLFloaterAvatarTextures(const LLSD& id); virtual ~LLFloaterAvatarTextures(); - /*virtual*/ BOOL postBuild(); - /*virtual*/ void draw(); + bool postBuild() override; + void draw() override; - void refresh(); + void refresh() override; private: static void onClickDump(void*); diff --git a/indra/newview/llfloaterbanduration.cpp b/indra/newview/llfloaterbanduration.cpp index 6ba6c30cab..c9141322e3 100644 --- a/indra/newview/llfloaterbanduration.cpp +++ b/indra/newview/llfloaterbanduration.cpp @@ -35,16 +35,16 @@ LLFloaterBanDuration::LLFloaterBanDuration(const LLSD& target) { } -BOOL LLFloaterBanDuration::postBuild() +bool LLFloaterBanDuration::postBuild() { childSetAction("ok_btn", boost::bind(&LLFloaterBanDuration::onClickBan, this)); childSetAction("cancel_btn", boost::bind(&LLFloaterBanDuration::onClickCancel, this)); getChild<LLUICtrl>("ban_duration_radio")->setCommitCallback(boost::bind(&LLFloaterBanDuration::onClickRadio, this)); getChild<LLRadioGroup>("ban_duration_radio")->setSelectedIndex(0); - getChild<LLUICtrl>("ban_hours")->setEnabled(FALSE); + getChild<LLUICtrl>("ban_hours")->setEnabled(false); - return TRUE; + return true; } LLFloaterBanDuration* LLFloaterBanDuration::show(select_callback_t callback, uuid_vec_t ids) diff --git a/indra/newview/llfloaterbanduration.h b/indra/newview/llfloaterbanduration.h index e8ec7cc669..4793b524f7 100644 --- a/indra/newview/llfloaterbanduration.h +++ b/indra/newview/llfloaterbanduration.h @@ -35,7 +35,7 @@ class LLFloaterBanDuration : public LLFloater public: LLFloaterBanDuration(const LLSD& target); - BOOL postBuild(); + bool postBuild() override; static LLFloaterBanDuration* show(select_callback_t callback, uuid_vec_t id); private: diff --git a/indra/newview/llfloaterbeacons.cpp b/indra/newview/llfloaterbeacons.cpp index fb1da84e79..11c1c2a9f2 100644 --- a/indra/newview/llfloaterbeacons.cpp +++ b/indra/newview/llfloaterbeacons.cpp @@ -52,9 +52,9 @@ LLFloaterBeacons::LLFloaterBeacons(const LLSD& seed) mCommitCallbackRegistrar.add("Beacons.UICheck", boost::bind(&LLFloaterBeacons::onClickUICheck, this,_1)); } -BOOL LLFloaterBeacons::postBuild() +bool LLFloaterBeacons::postBuild() { - return TRUE; + return true; } // Callback attached to each check box control to both affect their main purpose @@ -73,10 +73,10 @@ void LLFloaterBeacons::onClickUICheck(LLUICtrl *ctrl) LLPipeline::getRenderScriptedBeacons() ) { LLPipeline::setRenderScriptedBeacons(false); - getChild<LLCheckBoxCtrl>("scripted")->setControlValue(LLSD(FALSE)); - getChild<LLCheckBoxCtrl>("scripted")->setValue(FALSE); - getChild<LLCheckBoxCtrl>("touch_only")->setControlValue(LLSD(TRUE)); // just to be sure it's in sync with llpipeline - getChild<LLCheckBoxCtrl>("touch_only")->setValue(TRUE); + getChild<LLCheckBoxCtrl>("scripted")->setControlValue(LLSD(false)); + getChild<LLCheckBoxCtrl>("scripted")->setValue(false); + getChild<LLCheckBoxCtrl>("touch_only")->setControlValue(LLSD(true)); // just to be sure it's in sync with llpipeline + getChild<LLCheckBoxCtrl>("touch_only")->setValue(true); } } else if(name == "scripted") @@ -88,10 +88,10 @@ void LLFloaterBeacons::onClickUICheck(LLUICtrl *ctrl) LLPipeline::getRenderScriptedBeacons() ) { LLPipeline::setRenderScriptedTouchBeacons(false); - getChild<LLCheckBoxCtrl>("touch_only")->setControlValue(LLSD(FALSE)); - getChild<LLCheckBoxCtrl>("touch_only")->setValue(FALSE); - getChild<LLCheckBoxCtrl>("scripted")->setControlValue(LLSD(TRUE)); // just to be sure it's in sync with llpipeline - getChild<LLCheckBoxCtrl>("scripted")->setValue(TRUE); + getChild<LLCheckBoxCtrl>("touch_only")->setControlValue(LLSD(false)); + getChild<LLCheckBoxCtrl>("touch_only")->setValue(false); + getChild<LLCheckBoxCtrl>("scripted")->setControlValue(LLSD(true)); // just to be sure it's in sync with llpipeline + getChild<LLCheckBoxCtrl>("scripted")->setValue(true); } } else if(name == "physical") LLPipeline::setRenderPhysicalBeacons(check->get()); @@ -107,10 +107,10 @@ void LLFloaterBeacons::onClickUICheck(LLUICtrl *ctrl) !LLPipeline::getRenderHighlights() ) { LLPipeline::setRenderBeacons(true); - getChild<LLCheckBoxCtrl>("beacons")->setControlValue(LLSD(TRUE)); - getChild<LLCheckBoxCtrl>("beacons")->setValue(TRUE); - getChild<LLCheckBoxCtrl>("highlights")->setControlValue(LLSD(FALSE)); // just to be sure it's in sync with llpipeline - getChild<LLCheckBoxCtrl>("highlights")->setValue(FALSE); + getChild<LLCheckBoxCtrl>("beacons")->setControlValue(LLSD(true)); + getChild<LLCheckBoxCtrl>("beacons")->setValue(true); + getChild<LLCheckBoxCtrl>("highlights")->setControlValue(LLSD(false)); // just to be sure it's in sync with llpipeline + getChild<LLCheckBoxCtrl>("highlights")->setValue(false); } } else if(name == "beacons") @@ -122,10 +122,10 @@ void LLFloaterBeacons::onClickUICheck(LLUICtrl *ctrl) !LLPipeline::getRenderHighlights() ) { LLPipeline::setRenderHighlights(true); - getChild<LLCheckBoxCtrl>("highlights")->setControlValue(LLSD(TRUE)); - getChild<LLCheckBoxCtrl>("highlights")->setValue(TRUE); - getChild<LLCheckBoxCtrl>("beacons")->setControlValue(LLSD(FALSE)); // just to be sure it's in sync with llpipeline - getChild<LLCheckBoxCtrl>("beacons")->setValue(FALSE); + getChild<LLCheckBoxCtrl>("highlights")->setControlValue(LLSD(true)); + getChild<LLCheckBoxCtrl>("highlights")->setValue(true); + getChild<LLCheckBoxCtrl>("beacons")->setControlValue(LLSD(false)); // just to be sure it's in sync with llpipeline + getChild<LLCheckBoxCtrl>("beacons")->setValue(false); } } } diff --git a/indra/newview/llfloaterbeacons.h b/indra/newview/llfloaterbeacons.h index 629934c346..f54fb2a50a 100644 --- a/indra/newview/llfloaterbeacons.h +++ b/indra/newview/llfloaterbeacons.h @@ -36,7 +36,7 @@ class LLFloaterBeacons : public LLFloater public: - /*virtual*/ BOOL postBuild(); + bool postBuild() override; // Needed to make the floater visibility toggle the beacons. // Too bad we can't just add control_name="BeaconAlwaysOn" to the XML. diff --git a/indra/newview/llfloaterbigpreview.cpp b/indra/newview/llfloaterbigpreview.cpp index 023607f9ab..ba682494bb 100644 --- a/indra/newview/llfloaterbigpreview.cpp +++ b/indra/newview/llfloaterbigpreview.cpp @@ -61,7 +61,7 @@ void LLFloaterBigPreview::closeOnFloaterOwnerClosing(LLFloater* floaterp) } } -BOOL LLFloaterBigPreview::postBuild() +bool LLFloaterBigPreview::postBuild() { mPreviewPlaceholder = getChild<LLUICtrl>("big_preview_placeholder"); return LLFloater::postBuild(); diff --git a/indra/newview/llfloaterbigpreview.h b/indra/newview/llfloaterbigpreview.h index 62e878233b..1d5804acf5 100644 --- a/indra/newview/llfloaterbigpreview.h +++ b/indra/newview/llfloaterbigpreview.h @@ -35,7 +35,7 @@ public: LLFloaterBigPreview(const LLSD& key); ~LLFloaterBigPreview(); - BOOL postBuild(); + bool postBuild(); void draw(); void onCancel(); diff --git a/indra/newview/llfloaterbuildoptions.cpp b/indra/newview/llfloaterbuildoptions.cpp index 51139477a0..cf3c4d29f3 100644 --- a/indra/newview/llfloaterbuildoptions.cpp +++ b/indra/newview/llfloaterbuildoptions.cpp @@ -49,9 +49,9 @@ LLFloaterBuildOptions::LLFloaterBuildOptions(const LLSD& key) LLFloaterBuildOptions::~LLFloaterBuildOptions() {} -BOOL LLFloaterBuildOptions::postBuild() +bool LLFloaterBuildOptions::postBuild() { - return TRUE; + return true; } // virtual @@ -63,5 +63,5 @@ void LLFloaterBuildOptions::onOpen(const LLSD& key) // virtual void LLFloaterBuildOptions::onClose(bool app_quitting) { - mObjectSelection = NULL; + mObjectSelection = nullptr; } diff --git a/indra/newview/llfloaterbuildoptions.h b/indra/newview/llfloaterbuildoptions.h index 7b550a7807..9b87e4d764 100644 --- a/indra/newview/llfloaterbuildoptions.h +++ b/indra/newview/llfloaterbuildoptions.h @@ -43,10 +43,10 @@ class LLFloaterBuildOptions : public LLFloater { public: - virtual BOOL postBuild(); + bool postBuild() override; - /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ void onClose(bool app_quitting); + void onOpen(const LLSD& key) override; + void onClose(bool app_quitting) override; private: friend class LLFloaterReg; diff --git a/indra/newview/llfloaterbulkpermission.cpp b/indra/newview/llfloaterbulkpermission.cpp index 243c546169..c09c02d32b 100644 --- a/indra/newview/llfloaterbulkpermission.cpp +++ b/indra/newview/llfloaterbulkpermission.cpp @@ -53,7 +53,7 @@ LLFloaterBulkPermission::LLFloaterBulkPermission(const LLSD& seed) : LLFloater(seed), - mDone(FALSE) + mDone(false) { mID.generate(); mCommitCallbackRegistrar.add("BulkPermission.Ok", boost::bind(&LLFloaterBulkPermission::onOkBtn, this)); @@ -64,7 +64,7 @@ LLFloaterBulkPermission::LLFloaterBulkPermission(const LLSD& seed) mCommitCallbackRegistrar.add("BulkPermission.CommitCopy", boost::bind(&LLFloaterBulkPermission::onCommitCopy, this)); } -BOOL LLFloaterBulkPermission::postBuild() +bool LLFloaterBulkPermission::postBuild() { mBulkChangeIncludeAnimations = gSavedSettings.getBOOL("BulkChangeIncludeAnimations"); mBulkChangeIncludeBodyParts = gSavedSettings.getBOOL("BulkChangeIncludeBodyParts"); @@ -89,7 +89,7 @@ BOOL LLFloaterBulkPermission::postBuild() { mBulkChangeNextOwnerTransfer = true; } - return TRUE; + return true; } void LLFloaterBulkPermission::doApply() @@ -120,7 +120,7 @@ void LLFloaterBulkPermission::doApply() } else { - mDone = FALSE; + mDone = false; if (!start()) { LL_WARNS() << "Unexpected bulk permission change failure." << LL_ENDL; @@ -204,16 +204,16 @@ void LLFloaterBulkPermission::onCloseBtn() void LLFloaterBulkPermission::onCommitCopy() { // Implements fair use - BOOL copyable = gSavedSettings.getBOOL("BulkChangeNextOwnerCopy"); + bool copyable = gSavedSettings.getBOOL("BulkChangeNextOwnerCopy"); if(!copyable) { - gSavedSettings.setBOOL("BulkChangeNextOwnerTransfer", TRUE); + gSavedSettings.setBOOL("BulkChangeNextOwnerTransfer", true); } LLCheckBoxCtrl* xfer =getChild<LLCheckBoxCtrl>("next_owner_transfer"); xfer->setEnabled(copyable); } -BOOL LLFloaterBulkPermission::start() +bool LLFloaterBulkPermission::start() { // note: number of top-level objects to modify is mObjectIDs.size(). getChild<LLScrollListCtrl>("queue output")->setCommentText(getString("start_text")); @@ -221,10 +221,10 @@ BOOL LLFloaterBulkPermission::start() } // Go to the next object and start if found. Returns false if no objects left, true otherwise. -BOOL LLFloaterBulkPermission::nextObject() +bool LLFloaterBulkPermission::nextObject() { - S32 count; - BOOL successful_start = FALSE; + size_t count; + bool successful_start = false; do { count = mObjectIDs.size(); @@ -240,18 +240,18 @@ BOOL LLFloaterBulkPermission::nextObject() if(isDone() && !mDone) { getChild<LLScrollListCtrl>("queue output")->setCommentText(getString("done_text")); - mDone = TRUE; + mDone = true; } return successful_start; } // Pop the top object off of the queue. -// Return TRUE if the queue has started, otherwise FALSE. -BOOL LLFloaterBulkPermission::popNext() +// Return true if the queue has started, otherwise false. +bool LLFloaterBulkPermission::popNext() { // get the head element from the container, and attempt to get its inventory. - BOOL rv = FALSE; - S32 count = mObjectIDs.size(); + bool rv = false; + auto count = mObjectIDs.size(); if(mCurrentObjectID.isNull() && (count > 0)) { mCurrentObjectID = mObjectIDs.at(0); @@ -264,7 +264,7 @@ BOOL LLFloaterBulkPermission::popNext() LLUUID* id = new LLUUID(mID); registerVOInventoryListener(obj,id); requestVOInventory(); - rv = TRUE; + rv = true; } else { @@ -276,7 +276,7 @@ BOOL LLFloaterBulkPermission::popNext() } -void LLFloaterBulkPermission::doCheckUncheckAll(BOOL check) +void LLFloaterBulkPermission::doCheckUncheckAll(bool check) { gSavedSettings.setBOOL("BulkChangeIncludeAnimations", check); gSavedSettings.setBOOL("BulkChangeIncludeBodyParts" , check); @@ -352,7 +352,7 @@ void LLFloaterBulkPermission::handleInventory(LLViewerObject* viewer_obj, LLInve perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("BulkChange")); perm.setMaskGroup(LLFloaterPerms::getGroupPerms("BulkChange")); new_item->setPermissions(perm); // here's the beef - updateInventory(object,new_item,TASK_INVENTORY_ITEM_KEY,FALSE); + updateInventory(object,new_item,TASK_INVENTORY_ITEM_KEY,false); //status_text.setArg("[STATUS]", getString("status_ok_text")); status_text.setArg("[STATUS]", ""); } diff --git a/indra/newview/llfloaterbulkpermission.h b/indra/newview/llfloaterbulkpermission.h index a1f6b3d898..23ca45b611 100644 --- a/indra/newview/llfloaterbulkpermission.h +++ b/indra/newview/llfloaterbulkpermission.h @@ -41,16 +41,16 @@ class LLFloaterBulkPermission : public LLFloater, public LLVOInventoryListener friend class LLFloaterReg; public: - BOOL postBuild(); + bool postBuild(); private: LLFloaterBulkPermission(const LLSD& seed); virtual ~LLFloaterBulkPermission() {} - BOOL start(); // returns TRUE if the queue has started, otherwise FALSE. - BOOL nextObject(); - BOOL popNext(); + bool start(); // returns true if the queue has started, otherwise false. + bool nextObject(); + bool popNext(); // This is the callback method for the viewer object currently // being worked on. @@ -73,15 +73,15 @@ private: void onOkBtn(); void onApplyBtn(); void onCommitCopy(); - void onCheckAll() { doCheckUncheckAll(TRUE); } - void onUncheckAll() { doCheckUncheckAll(FALSE); } + void onCheckAll() { doCheckUncheckAll(true); } + void onUncheckAll() { doCheckUncheckAll(false); } // returns true if this is done - BOOL isDone() const { return (mCurrentObjectID.isNull() || (mObjectIDs.size() == 0)); } + bool isDone() const { return (mCurrentObjectID.isNull() || (mObjectIDs.size() == 0)); } //Read the settings and Apply the permissions void doApply(); - void doCheckUncheckAll(BOOL check); + void doCheckUncheckAll(bool check); private: // UI @@ -91,7 +91,7 @@ private: // Object Queue std::vector<LLUUID> mObjectIDs; LLUUID mCurrentObjectID; - BOOL mDone; + bool mDone; bool mBulkChangeIncludeAnimations; bool mBulkChangeIncludeBodyParts; diff --git a/indra/newview/llfloaterbump.cpp b/indra/newview/llfloaterbump.cpp index 8138a3c976..162ad5e108 100644 --- a/indra/newview/llfloaterbump.cpp +++ b/indra/newview/llfloaterbump.cpp @@ -77,7 +77,7 @@ LLFloaterBump::~LLFloaterBump() } } -BOOL LLFloaterBump::postBuild() +bool LLFloaterBump::postBuild() { mList = getChild<LLScrollListCtrl>("bump_list"); mList->setAllowMultipleSelection(false); @@ -93,7 +93,7 @@ BOOL LLFloaterBump::postBuild() menu->setItemVisible(std::string("Impostor seperator"), false); } - return TRUE; + return true; } // virtual void LLFloaterBump::onOpen(const LLSD& key) diff --git a/indra/newview/llfloaterbump.h b/indra/newview/llfloaterbump.h index 0ca7df50dd..53e730d73f 100644 --- a/indra/newview/llfloaterbump.h +++ b/indra/newview/llfloaterbump.h @@ -43,8 +43,8 @@ protected: void onScrollListRightClicked(LLUICtrl* ctrl, S32 x, S32 y); public: - /*virtual*/ BOOL postBuild(); - /*virtual*/ void onOpen(const LLSD& key); + bool postBuild() override; + void onOpen(const LLSD& key) override; static LLFloaterBump* getInstance(); diff --git a/indra/newview/llfloaterbuy.cpp b/indra/newview/llfloaterbuy.cpp index ff2922e2ac..7d2d836689 100644 --- a/indra/newview/llfloaterbuy.cpp +++ b/indra/newview/llfloaterbuy.cpp @@ -54,10 +54,10 @@ LLFloaterBuy::LLFloaterBuy(const LLSD& key) { } -BOOL LLFloaterBuy::postBuild() +bool LLFloaterBuy::postBuild() { - getChildView("object_list")->setEnabled(FALSE); - getChildView("item_list")->setEnabled(FALSE); + getChildView("object_list")->setEnabled(false); + getChildView("item_list")->setEnabled(false); getChild<LLUICtrl>("cancel_btn")->setCommitCallback( boost::bind(&LLFloaterBuy::onClickCancel, this)); getChild<LLUICtrl>("buy_btn")->setCommitCallback( boost::bind(&LLFloaterBuy::onClickBuy, this)); @@ -70,12 +70,12 @@ BOOL LLFloaterBuy::postBuild() // mid-session and the saved rect is off-center. center(); - return TRUE; + return true; } LLFloaterBuy::~LLFloaterBuy() { - mObjectSelection = NULL; + mObjectSelection = nullptr; } void LLFloaterBuy::reset() @@ -128,7 +128,7 @@ void LLFloaterBuy::show(const LLSaleInfo& sale_info) LLUUID owner_id; std::string owner_name; - BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); + bool owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); if (!owners_identical) { LLNotificationsUtil::add("BuyObjectOneOwner"); @@ -246,12 +246,12 @@ void LLFloaterBuy::inventoryChanged(LLViewerObject* obj, LLSD row; // Compute icon for this item - BOOL item_is_multi = FALSE; + bool item_is_multi = false; if (( inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED || inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS) && !(inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_SUBTYPE_MASK)) { - item_is_multi = TRUE; + item_is_multi = true; } std::string icon_name = LLInventoryIcon::getIconName(inv_item->getType(), diff --git a/indra/newview/llfloaterbuy.h b/indra/newview/llfloaterbuy.h index 41e0161ed5..8c8a3efc64 100644 --- a/indra/newview/llfloaterbuy.h +++ b/indra/newview/llfloaterbuy.h @@ -49,19 +49,18 @@ public: LLFloaterBuy(const LLSD& key); ~LLFloaterBuy(); - /*virtual*/ BOOL postBuild(); - /*virtual*/ void onClose(bool app_quitting); + bool postBuild() override; + void onClose(bool app_quitting) override; static void show(const LLSaleInfo& sale_info); protected: void reset(); - void requestObjectInventories(); - /*virtual*/ void inventoryChanged(LLViewerObject* obj, - LLInventoryObject::object_list_t* inv, - S32 serial_num, - void* data); + void inventoryChanged(LLViewerObject* obj, + LLInventoryObject::object_list_t* inv, + S32 serial_num, + void* data) override; void onSelectionChanged(); void showViews(bool show); diff --git a/indra/newview/llfloaterbuycontents.cpp b/indra/newview/llfloaterbuycontents.cpp index 955dc79f13..ae4dfb8d42 100644 --- a/indra/newview/llfloaterbuycontents.cpp +++ b/indra/newview/llfloaterbuycontents.cpp @@ -57,15 +57,15 @@ LLFloaterBuyContents::LLFloaterBuyContents(const LLSD& key) { } -BOOL LLFloaterBuyContents::postBuild() +bool LLFloaterBuyContents::postBuild() { getChild<LLUICtrl>("cancel_btn")->setCommitCallback( boost::bind(&LLFloaterBuyContents::onClickCancel, this)); getChild<LLUICtrl>("buy_btn")->setCommitCallback( boost::bind(&LLFloaterBuyContents::onClickBuy, this)); - getChildView("item_list")->setEnabled(FALSE); - getChildView("buy_btn")->setEnabled(FALSE); - getChildView("wear_check")->setEnabled(FALSE); + getChildView("item_list")->setEnabled(false); + getChildView("buy_btn")->setEnabled(false); + getChildView("wear_check")->setEnabled(false); setDefaultBtn("cancel_btn"); // to avoid accidental buy (SL-43130) @@ -75,7 +75,7 @@ BOOL LLFloaterBuyContents::postBuild() // mid-session and the saved rect is off-center. center(); - return TRUE; + return true; } LLFloaterBuyContents::~LLFloaterBuyContents() @@ -107,7 +107,7 @@ void LLFloaterBuyContents::show(const LLSaleInfo& sale_info) LLUUID owner_id; std::string owner_name; - BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); + bool owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); if (!owners_identical) { LLNotificationsUtil::add("BuyContentsOneOwner"); @@ -167,10 +167,10 @@ void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj, // default to turning off the buy button. LLView* buy_btn = getChildView("buy_btn"); - buy_btn->setEnabled(FALSE); + buy_btn->setEnabled(false); LLUUID owner_id; - BOOL is_group_owned; + bool is_group_owned; LLAssetType::EType asset_type; LLInventoryType::EType inv_type; S32 wearable_count = 0; @@ -208,17 +208,17 @@ void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj, // There will be at least one item shown in the display, so go // ahead and enable the buy button. - buy_btn->setEnabled(TRUE); + buy_btn->setEnabled(true); // Create the line in the list LLSD row; - BOOL item_is_multi = FALSE; + bool item_is_multi = false; if ((inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED || inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS) && !(inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_SUBTYPE_MASK)) { - item_is_multi = TRUE; + item_is_multi = true; } std::string icon_name = LLInventoryIcon::getIconName(inv_item->getType(), @@ -256,7 +256,7 @@ void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj, if (wearable_count > 0) { - getChildView("wear_check")->setEnabled(TRUE); + getChildView("wear_check")->setEnabled(true); getChild<LLUICtrl>("wear_check")->setValue(LLSD(false) ); } } @@ -276,7 +276,7 @@ void LLFloaterBuyContents::onClickBuy() // We may want to wear this item if (getChild<LLUICtrl>("wear_check")->getValue()) { - LLInventoryState::sWearNewClothing = TRUE; + LLInventoryState::sWearNewClothing = true; } // Put the items where we put new folders. diff --git a/indra/newview/llfloaterbuycontents.h b/indra/newview/llfloaterbuycontents.h index c397b11400..cbb36d446d 100644 --- a/indra/newview/llfloaterbuycontents.h +++ b/indra/newview/llfloaterbuycontents.h @@ -48,14 +48,13 @@ public: LLFloaterBuyContents(const LLSD& key); ~LLFloaterBuyContents(); - /*virtual*/ BOOL postBuild(); + bool postBuild() override; protected: - void requestObjectInventories(); - /*virtual*/ void inventoryChanged(LLViewerObject* obj, - LLInventoryObject::object_list_t* inv, - S32 serial_num, - void* data); + void inventoryChanged(LLViewerObject* obj, + LLInventoryObject::object_list_t* inv, + S32 serial_num, + void* data) override; void onClickBuy(); void onClickCancel(); diff --git a/indra/newview/llfloaterbuycurrency.cpp b/indra/newview/llfloaterbuycurrency.cpp index e1bc110061..e41f893c43 100644 --- a/indra/newview/llfloaterbuycurrency.cpp +++ b/indra/newview/llfloaterbuycurrency.cpp @@ -66,13 +66,13 @@ public: void noTarget(); void target(const std::string& name, S32 price); - virtual BOOL postBuild(); + virtual bool postBuild(); void updateUI(); void collapsePanels(bool collapse); virtual void draw(); - virtual BOOL canClose(); + virtual bool canClose(); void onClickBuy(); void onClickCancel(); @@ -135,7 +135,7 @@ void LLFloaterBuyCurrencyUI::target(const std::string& name, S32 price) // virtual -BOOL LLFloaterBuyCurrencyUI::postBuild() +bool LLFloaterBuyCurrencyUI::postBuild() { mManager.prepare(); @@ -146,7 +146,7 @@ BOOL LLFloaterBuyCurrencyUI::postBuild() updateUI(); - return TRUE; + return true; } void LLFloaterBuyCurrencyUI::draw() @@ -169,7 +169,7 @@ void LLFloaterBuyCurrencyUI::draw() LLFloater::draw(); } -BOOL LLFloaterBuyCurrencyUI::canClose() +bool LLFloaterBuyCurrencyUI::canClose() { return mManager.canCancel(); } @@ -180,11 +180,11 @@ void LLFloaterBuyCurrencyUI::updateUI() mManager.updateUI(!hasError && !mManager.buying()); // hide most widgets - we'll turn them on as needed next - getChildView("info_buying")->setVisible(FALSE); - getChildView("info_need_more")->setVisible(FALSE); - getChildView("purchase_warning_repurchase")->setVisible(FALSE); - getChildView("purchase_warning_notenough")->setVisible(FALSE); - getChildView("contacting")->setVisible(FALSE); + getChildView("info_buying")->setVisible(false); + getChildView("info_need_more")->setVisible(false); + getChildView("purchase_warning_repurchase")->setVisible(false); + getChildView("purchase_warning_notenough")->setVisible(false); + getChildView("contacting")->setVisible(false); if (hasError) { @@ -199,15 +199,15 @@ void LLFloaterBuyCurrencyUI::updateUI() else { // display the main Buy L$ interface - getChildView("normal_background")->setVisible(TRUE); + getChildView("normal_background")->setVisible(true); if (mHasTarget) { - getChildView("info_need_more")->setVisible(TRUE); + getChildView("info_need_more")->setVisible(true); } else { - getChildView("info_buying")->setVisible(TRUE); + getChildView("info_buying")->setVisible(true); } if (mManager.buying()) @@ -224,18 +224,18 @@ void LLFloaterBuyCurrencyUI::updateUI() } S32 balance = gStatusBar->getBalance(); - getChildView("balance_label")->setVisible(TRUE); - getChildView("balance_amount")->setVisible(TRUE); + getChildView("balance_label")->setVisible(true); + getChildView("balance_amount")->setVisible(true); getChild<LLUICtrl>("balance_amount")->setTextArg("[AMT]", llformat("%d", balance)); S32 buying = mManager.getAmount(); - getChildView("buying_label")->setVisible(TRUE); - getChildView("buying_amount")->setVisible(TRUE); + getChildView("buying_label")->setVisible(true); + getChildView("buying_amount")->setVisible(true); getChild<LLUICtrl>("buying_amount")->setTextArg("[AMT]", llformat("%d", buying)); S32 total = balance + buying; - getChildView("total_label")->setVisible(TRUE); - getChildView("total_amount")->setVisible(TRUE); + getChildView("total_label")->setVisible(true); + getChildView("total_amount")->setVisible(true); getChild<LLUICtrl>("total_amount")->setTextArg("[AMT]", llformat("%d", total)); if (mHasTarget) diff --git a/indra/newview/llfloaterbuycurrencyhtml.cpp b/indra/newview/llfloaterbuycurrencyhtml.cpp index c138cd5f2e..d3712869b0 100644 --- a/indra/newview/llfloaterbuycurrencyhtml.cpp +++ b/indra/newview/llfloaterbuycurrencyhtml.cpp @@ -42,13 +42,13 @@ LLFloaterBuyCurrencyHTML::LLFloaterBuyCurrencyHTML( const LLSD& key ): //////////////////////////////////////////////////////////////////////////////// // -BOOL LLFloaterBuyCurrencyHTML::postBuild() +bool LLFloaterBuyCurrencyHTML::postBuild() { // observer media events mBrowser = getChild<LLMediaCtrl>( "browser" ); mBrowser->addObserver( this ); - return TRUE; + return true; } //////////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llfloaterbuycurrencyhtml.h b/indra/newview/llfloaterbuycurrencyhtml.h index 23555b261f..23a29cae4c 100644 --- a/indra/newview/llfloaterbuycurrencyhtml.h +++ b/indra/newview/llfloaterbuycurrencyhtml.h @@ -37,7 +37,7 @@ class LLFloaterBuyCurrencyHTML : public: LLFloaterBuyCurrencyHTML( const LLSD& key ); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void onClose( bool app_quitting ); // inherited from LLViewerMediaObserver diff --git a/indra/newview/llfloaterbuyland.cpp b/indra/newview/llfloaterbuyland.cpp index ac45e50c08..570a223908 100644 --- a/indra/newview/llfloaterbuyland.cpp +++ b/indra/newview/llfloaterbuyland.cpp @@ -187,7 +187,7 @@ public: void tellUserError(const std::string& message, const std::string& uri); - virtual BOOL postBuild(); + virtual bool postBuild(); void startBuyPreConfirm(); void startBuyPostConfirm(const std::string& password); @@ -197,7 +197,7 @@ public: void onClickErrorWeb(); virtual void draw(); - virtual BOOL canClose(); + virtual bool canClose(); void onVisibilityChanged ( const LLSD& new_visibility ); @@ -306,7 +306,7 @@ void LLFloaterBuyLandUI::onClose(bool app_quitting) // This object holds onto observer, transactions, and parcel state. // Despite being single_instance, destroy it to call destructors and clean // everything up. - setVisible(FALSE); + setVisible(false); destroy(); } @@ -569,7 +569,7 @@ void LLFloaterBuyLandUI::updateCovenantInfo() LLTextBox* box = getChild<LLTextBox>("covenant_text"); if(box) { - box->setVisible(FALSE); + box->setVisible(false); } // send EstateCovenantInfo message @@ -605,14 +605,14 @@ void LLFloaterBuyLandUI::updateFloaterCovenantText(const std::string &string, co refreshUI(); // remove the line stating that you must agree - box->setVisible(FALSE); + box->setVisible(false); } else { check->setEnabled(true); // remove the line stating that you must agree - box->setVisible(TRUE); + box->setVisible(true); } } @@ -733,7 +733,7 @@ void LLFloaterBuyLandUI::runWebSitePrep(const std::string& password) return; } - BOOL remove_contribution = getChild<LLUICtrl>("remove_contribution")->getValue().asBoolean(); + bool remove_contribution = getChild<LLUICtrl>("remove_contribution")->getValue().asBoolean(); mParcelBuyInfo = LLViewerParcelMgr::getInstance()->setupParcelBuy(gAgent.getID(), gAgent.getSessionID(), gAgent.getGroupID(), mIsForGroup, mIsClaim, remove_contribution); @@ -929,7 +929,7 @@ void LLFloaterBuyLandUI::tellUserError( // virtual -BOOL LLFloaterBuyLandUI::postBuild() +bool LLFloaterBuyLandUI::postBuild() { setVisibleCallback(boost::bind(&LLFloaterBuyLandUI::onVisibilityChanged, this, _2)); @@ -941,7 +941,7 @@ BOOL LLFloaterBuyLandUI::postBuild() center(); - return TRUE; + return true; } void LLFloaterBuyLandUI::setParcel(LLViewerRegion* region, LLParcelSelectionHandle parcel) @@ -994,7 +994,7 @@ void LLFloaterBuyLandUI::draw() } // virtual -BOOL LLFloaterBuyLandUI::canClose() +bool LLFloaterBuyLandUI::canClose() { // mTransactionType check for pre-buy estimation stage and mCurrency to allow exit after transaction bool can_close = !mTransaction && (mTransactionType != TransactionBuy || mCurrency.canCancel()); @@ -1097,9 +1097,9 @@ void LLFloaterBuyLandUI::refreshUI() } else { - getChildView("step_error")->setVisible(FALSE); - getChildView("error_message")->setVisible(FALSE); - getChildView("error_web")->setVisible(FALSE); + getChildView("step_error")->setVisible(false); + getChildView("error_message")->setVisible(false); + getChildView("error_web")->setVisible(false); } @@ -1134,16 +1134,16 @@ void LLFloaterBuyLandUI::refreshUI() levels->setCurrentByIndex(mUserPlanChoice); } - getChildView("step_1")->setVisible(TRUE); - getChildView("account_action")->setVisible(TRUE); - getChildView("account_reason")->setVisible(TRUE); + getChildView("step_1")->setVisible(true); + getChildView("account_action")->setVisible(true); + getChildView("account_reason")->setVisible(true); } else { - getChildView("step_1")->setVisible(FALSE); - getChildView("account_action")->setVisible(FALSE); - getChildView("account_reason")->setVisible(FALSE); - getChildView("account_level")->setVisible(FALSE); + getChildView("step_1")->setVisible(false); + getChildView("account_action")->setVisible(false); + getChildView("account_reason")->setVisible(false); + getChildView("account_level")->setVisible(false); } // section two: land use fees @@ -1201,15 +1201,15 @@ void LLFloaterBuyLandUI::refreshUI() getChild<LLUICtrl>("land_use_reason")->setValue(message); - getChildView("step_2")->setVisible(TRUE); - getChildView("land_use_action")->setVisible(TRUE); - getChildView("land_use_reason")->setVisible(TRUE); + getChildView("step_2")->setVisible(true); + getChildView("land_use_action")->setVisible(true); + getChildView("land_use_reason")->setVisible(true); } else { - getChildView("step_2")->setVisible(FALSE); - getChildView("land_use_action")->setVisible(FALSE); - getChildView("land_use_reason")->setVisible(FALSE); + getChildView("step_2")->setVisible(false); + getChildView("land_use_action")->setVisible(false); + getChildView("land_use_reason")->setVisible(false); } // section three: purchase & currency @@ -1281,18 +1281,18 @@ void LLFloaterBuyLandUI::refreshUI() llformat("%d", minContribution)); getChildView("remove_contribution")->setVisible( showRemoveContribution); - getChildView("step_3")->setVisible(TRUE); - getChildView("purchase_action")->setVisible(TRUE); - getChildView("currency_reason")->setVisible(TRUE); - getChildView("currency_balance")->setVisible(TRUE); + getChildView("step_3")->setVisible(true); + getChildView("purchase_action")->setVisible(true); + getChildView("currency_reason")->setVisible(true); + getChildView("currency_balance")->setVisible(true); } else { - getChildView("step_3")->setVisible(FALSE); - getChildView("purchase_action")->setVisible(FALSE); - getChildView("currency_reason")->setVisible(FALSE); - getChildView("currency_balance")->setVisible(FALSE); - getChildView("remove_group_donation")->setVisible(FALSE); + getChildView("step_3")->setVisible(false); + getChildView("purchase_action")->setVisible(false); + getChildView("currency_reason")->setVisible(false); + getChildView("currency_balance")->setVisible(false); + getChildView("remove_group_donation")->setVisible(false); } diff --git a/indra/newview/llfloaterbvhpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp index 1fb0a72d3e..5330518ba5 100644 --- a/indra/newview/llfloaterbvhpreview.cpp +++ b/indra/newview/llfloaterbvhpreview.cpp @@ -188,14 +188,14 @@ std::map <std::string, std::string> LLFloaterBvhPreview::getJointAliases() //----------------------------------------------------------------------------- // postBuild() //----------------------------------------------------------------------------- -BOOL LLFloaterBvhPreview::postBuild() +bool LLFloaterBvhPreview::postBuild() { LLKeyframeMotion* motionp = NULL; LLBVHLoader* loaderp = NULL; if (!LLFloaterNameDesc::postBuild()) { - return FALSE; + return false; } getChild<LLUICtrl>("name_form")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitName, this)); @@ -220,7 +220,7 @@ BOOL LLFloaterBvhPreview::postBuild() mStopButton = getChild<LLButton>( "stop_btn"); mStopButton->setClickedCallback(boost::bind(&LLFloaterBvhPreview::onBtnStop, this)); - getChildView("bad_animation_text")->setVisible(FALSE); + getChildView("bad_animation_text")->setVisible(false); mAnimPreview = new LLPreviewAnimation(256, 256); @@ -294,7 +294,7 @@ BOOL LLFloaterBvhPreview::postBuild() loaderp->serialize(dp); dp.reset(); LL_INFOS("BVH") << "Deserializing motionp" << LL_ENDL; - BOOL success = motionp && motionp->deserialize(dp, mMotionID, false); + bool success = motionp && motionp->deserialize(dp, mMotionID, false); LL_INFOS("BVH") << "Done" << LL_ENDL; delete []buffer; @@ -331,7 +331,7 @@ BOOL LLFloaterBvhPreview::postBuild() getChild<LLUICtrl>("hand_pose_combo")->setValue(LLHandMotion::getHandPoseName(motionp->getHandPose())); getChild<LLUICtrl>("ease_in_time")->setValue(LLSD(motionp->getEaseInDuration())); getChild<LLUICtrl>("ease_out_time")->setValue(LLSD(motionp->getEaseOutDuration())); - setEnabled(TRUE); + setEnabled(true); std::string seconds_string; seconds_string = llformat(" - %.2f seconds", motionp->getDuration()); @@ -363,7 +363,7 @@ BOOL LLFloaterBvhPreview::postBuild() } } - //setEnabled(FALSE); + //setEnabled(false); mMotionID.setNull(); mAnimPreview = NULL; } @@ -372,7 +372,7 @@ BOOL LLFloaterBvhPreview::postBuild() delete loaderp; - return TRUE; + return true; } //----------------------------------------------------------------------------- @@ -382,7 +382,7 @@ LLFloaterBvhPreview::~LLFloaterBvhPreview() { mAnimPreview = NULL; - setEnabled(FALSE); + setEnabled(false); } //----------------------------------------------------------------------------- @@ -433,7 +433,7 @@ void LLFloaterBvhPreview::resetMotion() return; LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar(); - BOOL paused = avatarp->areAnimationsPaused(); + bool paused = avatarp->areAnimationsPaused(); LLKeyframeMotion* motionp = dynamic_cast<LLKeyframeMotion*>(avatarp->findMotion(mMotionID)); if( motionp ) @@ -471,7 +471,7 @@ void LLFloaterBvhPreview::resetMotion() //----------------------------------------------------------------------------- // handleMouseDown() //----------------------------------------------------------------------------- -BOOL LLFloaterBvhPreview::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLFloaterBvhPreview::handleMouseDown(S32 x, S32 y, MASK mask) { if (mPreviewRect.pointInRect(x, y)) { @@ -480,7 +480,7 @@ BOOL LLFloaterBvhPreview::handleMouseDown(S32 x, S32 y, MASK mask) gViewerWindow->hideCursor(); mLastMouseX = x; mLastMouseY = y; - return TRUE; + return true; } return LLFloater::handleMouseDown(x, y, mask); @@ -489,9 +489,9 @@ BOOL LLFloaterBvhPreview::handleMouseDown(S32 x, S32 y, MASK mask) //----------------------------------------------------------------------------- // handleMouseUp() //----------------------------------------------------------------------------- -BOOL LLFloaterBvhPreview::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLFloaterBvhPreview::handleMouseUp(S32 x, S32 y, MASK mask) { - gFocusMgr.setMouseCapture(FALSE); + gFocusMgr.setMouseCapture(nullptr); gViewerWindow->showCursor(); return LLFloater::handleMouseUp(x, y, mask); } @@ -499,7 +499,7 @@ BOOL LLFloaterBvhPreview::handleMouseUp(S32 x, S32 y, MASK mask) //----------------------------------------------------------------------------- // handleHover() //----------------------------------------------------------------------------- -BOOL LLFloaterBvhPreview::handleHover(S32 x, S32 y, MASK mask) +bool LLFloaterBvhPreview::handleHover(S32 x, S32 y, MASK mask) { MASK local_mask = mask & ~MASK_ALT; @@ -548,13 +548,13 @@ BOOL LLFloaterBvhPreview::handleHover(S32 x, S32 y, MASK mask) gViewerWindow->setCursor(UI_CURSOR_TOOLZOOMIN); } - return TRUE; + return true; } //----------------------------------------------------------------------------- // handleScrollWheel() //----------------------------------------------------------------------------- -BOOL LLFloaterBvhPreview::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLFloaterBvhPreview::handleScrollWheel(S32 x, S32 y, S32 clicks) { if (!mAnimPreview) return false; @@ -562,7 +562,7 @@ BOOL LLFloaterBvhPreview::handleScrollWheel(S32 x, S32 y, S32 clicks) mAnimPreview->zoom((F32)clicks * -0.2f); mAnimPreview->requestUpdate(); - return TRUE; + return true; } //----------------------------------------------------------------------------- @@ -672,13 +672,13 @@ void LLFloaterBvhPreview::onCommitBaseAnim() { LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar(); - BOOL paused = avatarp->areAnimationsPaused(); + bool paused = avatarp->areAnimationsPaused(); // stop all other possible base motions - avatarp->stopMotion(mIDList["Standing"], TRUE); - avatarp->stopMotion(mIDList["Walking"], TRUE); - avatarp->stopMotion(mIDList["Sitting"], TRUE); - avatarp->stopMotion(mIDList["Flying"], TRUE); + avatarp->stopMotion(mIDList["Standing"], true); + avatarp->stopMotion(mIDList["Walking"], true); + avatarp->stopMotion(mIDList["Sitting"], true); + avatarp->stopMotion(mIDList["Flying"], true); resetMotion(); @@ -723,7 +723,7 @@ void LLFloaterBvhPreview::onCommitLoopIn() { motionp->setLoopIn((F32)getChild<LLUICtrl>("loop_in_point")->getValue().asReal() / 100.f); resetMotion(); - getChild<LLUICtrl>("loop_check")->setValue(LLSD(TRUE)); + getChild<LLUICtrl>("loop_check")->setValue(LLSD(true)); onCommitLoop(); } } @@ -743,7 +743,7 @@ void LLFloaterBvhPreview::onCommitLoopOut() { motionp->setLoopOut((F32)getChild<LLUICtrl>("loop_out_point")->getValue().asReal() * 0.01f * motionp->getDuration()); resetMotion(); - getChild<LLUICtrl>("loop_check")->setValue(LLSD(TRUE)); + getChild<LLUICtrl>("loop_check")->setValue(LLSD(true)); onCommitLoop(); } } @@ -939,22 +939,22 @@ void LLFloaterBvhPreview::refresh() bool show_play = true; if (!mAnimPreview) { - getChildView("bad_animation_text")->setVisible(TRUE); + getChildView("bad_animation_text")->setVisible(true); // play button visible but disabled - mPlayButton->setEnabled(FALSE); - mStopButton->setEnabled(FALSE); - getChildView("ok_btn")->setEnabled(FALSE); + mPlayButton->setEnabled(false); + mStopButton->setEnabled(false); + getChildView("ok_btn")->setEnabled(false); } else { - getChildView("bad_animation_text")->setVisible(FALSE); + getChildView("bad_animation_text")->setVisible(false); // re-enabled in case previous animation was bad - mPlayButton->setEnabled(TRUE); - mStopButton->setEnabled(TRUE); + mPlayButton->setEnabled(true); + mStopButton->setEnabled(true); LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar(); if (avatarp->isMotionActive(mMotionID)) { - mStopButton->setEnabled(TRUE); + mStopButton->setEnabled(true); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID); if (!avatarp->areAnimationsPaused()) { @@ -972,7 +972,7 @@ void LLFloaterBvhPreview::refresh() // Motion just finished playing mPauseRequest = avatarp->requestPause(); } - getChildView("ok_btn")->setEnabled(TRUE); + getChildView("ok_btn")->setEnabled(true); mAnimPreview->requestUpdate(); } mPlayButton->setVisible(show_play); @@ -1036,9 +1036,9 @@ void LLFloaterBvhPreview::onBtnOK(void* userdata) //----------------------------------------------------------------------------- // LLPreviewAnimation //----------------------------------------------------------------------------- -LLPreviewAnimation::LLPreviewAnimation(S32 width, S32 height) : LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE) +LLPreviewAnimation::LLPreviewAnimation(S32 width, S32 height) : LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, false) { - mNeedsUpdate = TRUE; + mNeedsUpdate = true; mCameraDistance = PREVIEW_CAMERA_DISTANCE; mCameraYaw = 0.f; mCameraPitch = 0.f; @@ -1055,10 +1055,10 @@ LLPreviewAnimation::LLPreviewAnimation(S32 width, S32 height) : LLViewerDynamicT mDummyAvatar->hideSkirt(); // stop extraneous animations - mDummyAvatar->stopMotion( ANIM_AGENT_HEAD_ROT, TRUE ); - mDummyAvatar->stopMotion( ANIM_AGENT_EYE, TRUE ); - mDummyAvatar->stopMotion( ANIM_AGENT_BODY_NOISE, TRUE ); - mDummyAvatar->stopMotion( ANIM_AGENT_BREATHE_ROT, TRUE ); + mDummyAvatar->stopMotion( ANIM_AGENT_HEAD_ROT, true ); + mDummyAvatar->stopMotion( ANIM_AGENT_EYE, true ); + mDummyAvatar->stopMotion( ANIM_AGENT_BODY_NOISE, true ); + mDummyAvatar->stopMotion( ANIM_AGENT_BREATHE_ROT, true ); } //----------------------------------------------------------------------------- @@ -1078,9 +1078,9 @@ S8 LLPreviewAnimation::getType() const //----------------------------------------------------------------------------- // update() //----------------------------------------------------------------------------- -BOOL LLPreviewAnimation::render() +bool LLPreviewAnimation::render() { - mNeedsUpdate = FALSE; + mNeedsUpdate = false; LLVOAvatar* avatarp = mDummyAvatar; gGL.matrixMode(LLRender::MM_PROJECTION); @@ -1123,7 +1123,7 @@ BOOL LLPreviewAnimation::render() camera->setViewNoBroadcast(LLViewerCamera::getInstance()->getDefaultFOV() / mCameraZoom); camera->setAspect((F32) mFullWidth / (F32) mFullHeight); - camera->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, FALSE); + camera->setPerspective(false, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, false); //SJB: Animation is updated in LLVOAvatar::updateCharacter @@ -1145,7 +1145,7 @@ BOOL LLPreviewAnimation::render() } gGL.color4f(1,1,1,1); - return TRUE; + return true; } //----------------------------------------------------------------------------- @@ -1153,7 +1153,7 @@ BOOL LLPreviewAnimation::render() //----------------------------------------------------------------------------- void LLPreviewAnimation::requestUpdate() { - mNeedsUpdate = TRUE; + mNeedsUpdate = true; } //----------------------------------------------------------------------------- diff --git a/indra/newview/llfloaterbvhpreview.h b/indra/newview/llfloaterbvhpreview.h index 9de74c39cd..ae64521492 100644 --- a/indra/newview/llfloaterbvhpreview.h +++ b/indra/newview/llfloaterbvhpreview.h @@ -47,18 +47,18 @@ public: /*virtual*/ S8 getType() const ; - BOOL render(); + bool render(); void requestUpdate(); void rotate(F32 yaw_radians, F32 pitch_radians); void zoom(F32 zoom_delta); void setZoom(F32 zoom_amt); void pan(F32 right, F32 up); - virtual BOOL needsUpdate() { return mNeedsUpdate; } + virtual bool needsUpdate() { return mNeedsUpdate; } LLVOAvatar* getDummyAvatar() { return mDummyAvatar; } protected: - BOOL mNeedsUpdate; + bool mNeedsUpdate; F32 mCameraDistance; F32 mCameraYaw; F32 mCameraPitch; @@ -73,12 +73,12 @@ public: LLFloaterBvhPreview(const std::string& filename); virtual ~LLFloaterBvhPreview(); - BOOL postBuild(); + bool postBuild(); - BOOL handleMouseDown(S32 x, S32 y, MASK mask); - BOOL handleMouseUp(S32 x, S32 y, MASK mask); - BOOL handleHover(S32 x, S32 y, MASK mask); - BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); + bool handleMouseDown(S32 x, S32 y, MASK mask); + bool handleMouseUp(S32 x, S32 y, MASK mask); + bool handleHover(S32 x, S32 y, MASK mask); + bool handleScrollWheel(S32 x, S32 y, S32 clicks); void onMouseCaptureLost(); void refresh(); diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index b08af851c3..76ac730362 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -72,7 +72,7 @@ public: LLPanelCameraZoom() { onCreate(); } - /* virtual */ BOOL postBuild(); + /* virtual */ bool postBuild(); /* virtual */ void draw(); protected: @@ -138,13 +138,13 @@ void set_view_visible(LLView* parent, const std::string& name, bool visible) parent->getChildView(name)->setVisible(visible); } -BOOL LLPanelCameraItem::postBuild() +bool LLPanelCameraItem::postBuild() { setMouseEnterCallback(boost::bind(set_view_visible, this, "hovered_icon", true)); setMouseLeaveCallback(boost::bind(set_view_visible, this, "hovered_icon", false)); setMouseDownCallback(boost::bind(&LLPanelCameraItem::onAnyMouseClick, this)); setRightMouseDownCallback(boost::bind(&LLPanelCameraItem::onAnyMouseClick, this)); - return TRUE; + return true; } void LLPanelCameraItem::onAnyMouseClick() @@ -176,7 +176,7 @@ void LLPanelCameraZoom::onCreate() mCommitCallbackRegistrar.add("Camera.rotate", boost::bind(&LLPanelCameraZoom::onCameraRotate, this)); } -BOOL LLPanelCameraZoom::postBuild() +bool LLPanelCameraZoom::postBuild() { mPlusBtn = getChild<LLButton>("zoom_plus_btn"); mMinusBtn = getChild<LLButton>("zoom_minus_btn"); @@ -426,7 +426,7 @@ void LLFloaterCamera::onOpen(const LLSD& key) updateState(); else toPrevMode(); - mClosed = FALSE; + mClosed = false; populatePresetCombo(); @@ -449,25 +449,25 @@ void LLFloaterCamera::onClose(bool app_quitting) mPrevMode = CAMERA_CTRL_MODE_PAN; switchMode(CAMERA_CTRL_MODE_PAN); - mClosed = TRUE; + mClosed = true; - gAgent.setMovementLocked(FALSE); + gAgent.setMovementLocked(false); } LLFloaterCamera::LLFloaterCamera(const LLSD& val) : LLFloater(val), - mClosed(FALSE), + mClosed(false), mCurrMode(CAMERA_CTRL_MODE_PAN), mPrevMode(CAMERA_CTRL_MODE_PAN) { LLHints::getInstance()->registerHintTarget("view_popup", getHandle()); mCommitCallbackRegistrar.add("CameraPresets.ChangeView", boost::bind(&LLFloaterCamera::onClickCameraItem, _2)); mCommitCallbackRegistrar.add("CameraPresets.Save", boost::bind(&LLFloaterCamera::onSavePreset, this)); - mCommitCallbackRegistrar.add("CameraPresets.ShowPresetsList", boost::bind(&LLFloaterReg::showInstance, "camera_presets", LLSD(), FALSE)); + mCommitCallbackRegistrar.add("CameraPresets.ShowPresetsList", boost::bind(&LLFloaterReg::showInstance, "camera_presets", LLSD(), false)); } // virtual -BOOL LLFloaterCamera::postBuild() +bool LLFloaterCamera::postBuild() { updateTransparency(TT_ACTIVE); // force using active floater transparency (STORM-730) @@ -480,7 +480,7 @@ BOOL LLFloaterCamera::postBuild() mPresetCombo = getChild<LLComboBox>("preset_combo"); mPreciseCtrls = getChild<LLButton>("precise_btn"); - mPreciseCtrls->setClickedCallback(boost::bind(&LLFloaterReg::showInstance, "prefs_view_advanced", LLSD(), FALSE)); + mPreciseCtrls->setClickedCallback(boost::bind(&LLFloaterReg::showInstance, "prefs_view_advanced", LLSD(), false)); mPresetCombo->setCommitCallback(boost::bind(&LLFloaterCamera::onCustomPresetSelected, this)); LLPresetsManager::getInstance()->setPresetListChangeCameraCallback(boost::bind(&LLFloaterCamera::populatePresetCombo, this)); @@ -588,7 +588,7 @@ void LLFloaterCamera::switchMode(ECameraControlMode mode) default: //normally we won't occur here - llassert_always(FALSE); + llassert_always(false); } } diff --git a/indra/newview/llfloatercamera.h b/indra/newview/llfloatercamera.h index 561e9a5bb3..7db903f470 100644 --- a/indra/newview/llfloatercamera.h +++ b/indra/newview/llfloatercamera.h @@ -92,7 +92,7 @@ private: /* return instance if it exists - created by LLFloaterReg */ static LLFloaterCamera* findInstance(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); F32 getCurrentTransparency(); @@ -129,7 +129,7 @@ private: // remains true until preset camera mode is chosen, or pan button is clicked, or escape pressed static bool sFreeCamera; static bool sAppearanceEditing; - BOOL mClosed; + bool mClosed; ECameraControlMode mPrevMode; ECameraControlMode mCurrMode; std::map<ECameraControlMode, LLButton*> mMode2Button; @@ -164,7 +164,7 @@ public: Optional<CommitCallbackParam> mousedown_callback; Params(); }; - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /** setting on/off background icon to indicate selected state */ /*virtual*/ void setValue(const LLSD& value); // sends commit signal diff --git a/indra/newview/llfloatercamerapresets.cpp b/indra/newview/llfloatercamerapresets.cpp index eaf03dea81..b033af2564 100644 --- a/indra/newview/llfloatercamerapresets.cpp +++ b/indra/newview/llfloatercamerapresets.cpp @@ -38,14 +38,14 @@ LLFloaterCameraPresets::LLFloaterCameraPresets(const LLSD& key) LLFloaterCameraPresets::~LLFloaterCameraPresets() {} -BOOL LLFloaterCameraPresets::postBuild() +bool LLFloaterCameraPresets::postBuild() { mPresetList = getChild<LLFlatListView>("preset_list"); mPresetList->setCommitCallback(boost::bind(&LLFloaterCameraPresets::onSelectionChange, this)); mPresetList->setCommitOnSelectionChange(true); LLPresetsManager::getInstance()->setPresetListChangeCameraCallback(boost::bind(&LLFloaterCameraPresets::populateList, this)); - return TRUE; + return true; } void LLFloaterCameraPresets::onOpen(const LLSD& key) { @@ -99,7 +99,7 @@ LLCameraPresetFlatItem::~LLCameraPresetFlatItem() { } -BOOL LLCameraPresetFlatItem::postBuild() +bool LLCameraPresetFlatItem::postBuild() { mDeleteBtn = getChild<LLButton>("delete_btn"); mDeleteBtn->setVisible(false); diff --git a/indra/newview/llfloatercamerapresets.h b/indra/newview/llfloatercamerapresets.h index 082cb4c4dd..4e12617242 100644 --- a/indra/newview/llfloatercamerapresets.h +++ b/indra/newview/llfloatercamerapresets.h @@ -34,7 +34,7 @@ class LLFloaterCameraPresets : public LLFloater { friend class LLFloaterReg; - virtual BOOL postBuild(); + virtual bool postBuild(); virtual void onOpen(const LLSD& key); void populateList(); @@ -55,7 +55,7 @@ public: void setValue(const LLSD& value); - virtual BOOL postBuild(); + virtual bool postBuild(); virtual void onMouseEnter(S32 x, S32 y, MASK mask); virtual void onMouseLeave(S32 x, S32 y, MASK mask); diff --git a/indra/newview/llfloaterchangeitemthumbnail.cpp b/indra/newview/llfloaterchangeitemthumbnail.cpp index ec01571e32..3e2e7cb7a3 100644 --- a/indra/newview/llfloaterchangeitemthumbnail.cpp +++ b/indra/newview/llfloaterchangeitemthumbnail.cpp @@ -52,26 +52,32 @@ class LLThumbnailImagePicker : public LLFilePickerThread { public: - LLThumbnailImagePicker(const LLUUID &item_id); - LLThumbnailImagePicker(const LLUUID &item_id, const LLUUID &task_id); + LLThumbnailImagePicker(const LLUUID &item_id, LLFloaterSimpleSnapshot::completion_t callback); + LLThumbnailImagePicker(const LLUUID &item_id, const LLUUID &task_id, LLFloaterSimpleSnapshot::completion_t callback); ~LLThumbnailImagePicker(); void notify(const std::vector<std::string>& filenames) override; private: LLUUID mInventoryId; LLUUID mTaskId; + LLFloaterSimpleSnapshot::completion_t mCallback; }; -LLThumbnailImagePicker::LLThumbnailImagePicker(const LLUUID &item_id) +LLThumbnailImagePicker::LLThumbnailImagePicker(const LLUUID &item_id, + LLFloaterSimpleSnapshot::completion_t callback) : LLFilePickerThread(LLFilePicker::FFLOAD_IMAGE) , mInventoryId(item_id) + , mCallback(callback) { } -LLThumbnailImagePicker::LLThumbnailImagePicker(const LLUUID &item_id, const LLUUID &task_id) +LLThumbnailImagePicker::LLThumbnailImagePicker(const LLUUID &item_id, + const LLUUID &task_id, + LLFloaterSimpleSnapshot::completion_t callback) : LLFilePickerThread(LLFilePicker::FFLOAD_IMAGE) , mInventoryId(item_id) , mTaskId(task_id) + , mCallback(callback) { } @@ -91,12 +97,13 @@ void LLThumbnailImagePicker::notify(const std::vector<std::string>& filenames) return; } - LLFloaterSimpleSnapshot::uploadThumbnail(file_path, mInventoryId, mTaskId); + LLFloaterSimpleSnapshot::uploadThumbnail(file_path, mInventoryId, mTaskId, mCallback); } LLFloaterChangeItemThumbnail::LLFloaterChangeItemThumbnail(const LLSD& key) : LLFloater(key) , mObserverInitialized(false) + , mMultipleThumbnails(false) , mTooltipState(TOOLTIP_NONE) { } @@ -107,15 +114,17 @@ LLFloaterChangeItemThumbnail::~LLFloaterChangeItemThumbnail() removeVOInventoryListener(); } -BOOL LLFloaterChangeItemThumbnail::postBuild() +bool LLFloaterChangeItemThumbnail::postBuild() { mItemNameText = getChild<LLUICtrl>("item_name"); mItemTypeIcon = getChild<LLIconCtrl>("item_type_icon"); mThumbnailCtrl = getChild<LLThumbnailCtrl>("item_thumbnail"); mToolTipTextBox = getChild<LLTextBox>("tooltip_text"); + mMultipleTextBox = getChild<LLTextBox>("multiple_lbl"); LLSD tooltip_text; mToolTipTextBox->setValue(tooltip_text); + mMultipleTextBox->setVisible(false); LLButton *upload_local = getChild<LLButton>("upload_local"); upload_local->setClickedCallback(onUploadLocal, (void*)this); @@ -152,21 +161,55 @@ BOOL LLFloaterChangeItemThumbnail::postBuild() void LLFloaterChangeItemThumbnail::onOpen(const LLSD& key) { - if (!key.has("item_id") && !key.isUUID()) + if (!key.has("item_id") && !key.isUUID() && !key.isArray()) { closeFloater(); } - if (key.isUUID()) + mItemList.clear(); + mMultipleThumbnails = false; + if (key.isArray()) { - mItemId = key.asUUID(); + if (key.size() > 50) + { + // incident avoidance + LLNotificationsUtil::add("ThumbnailSelectionTooLarge"); + closeFloater(); + } + + LLUUID image_id; + for (LLSD::array_const_iterator it = key.beginArray(); it != key.endArray(); ++it) + { + LLInventoryObject* obj = gInventory.getObject(it->asUUID()); + if (obj) + { + if (mItemList.empty()) + { + image_id = obj->getThumbnailUUID(); + } + mItemList.insert(it->asUUID()); + if (image_id != obj->getThumbnailUUID()) + { + mMultipleThumbnails = true; + } + } + } + } + else if (key.isUUID()) + { + mItemList.insert(key.asUUID()); } else { - mItemId = key["item_id"].asUUID(); + mItemList.insert(key["item_id"].asUUID()); mTaskId = key["task_id"].asUUID(); } + if (mItemList.size() == 0) + { + closeFloater(); + } + refreshFromInventory(); } @@ -180,11 +223,11 @@ void LLFloaterChangeItemThumbnail::onMouseEnter(S32 x, S32 y, MASK mask) mPasteFromClipboardBtn->setEnabled(LLClipboard::instance().hasContents()); } -BOOL LLFloaterChangeItemThumbnail::handleDragAndDrop( +bool LLFloaterChangeItemThumbnail::handleDragAndDrop( S32 x, S32 y, MASK mask, - BOOL drop, + bool drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, @@ -214,14 +257,14 @@ BOOL LLFloaterChangeItemThumbnail::handleDragAndDrop( LL_DEBUGS("UserInput") << "dragAndDrop handled by LLFloaterChangeItemThumbnail " << getKey() << LL_ENDL; - return TRUE; + return true; } void LLFloaterChangeItemThumbnail::changed(U32 mask) { //LLInventoryObserver - if (mTaskId.notNull() || mItemId.isNull()) + if (mTaskId.notNull() || mItemList.size() == 0) { // Task inventory or not set up yet return; @@ -229,13 +272,13 @@ void LLFloaterChangeItemThumbnail::changed(U32 mask) const std::set<LLUUID>& mChangedItemIDs = gInventory.getChangedIDs(); std::set<LLUUID>::const_iterator it; + const LLUUID expected_id = *mItemList.begin(); for (it = mChangedItemIDs.begin(); it != mChangedItemIDs.end(); it++) { - // set dirty for 'item profile panel' only if changed item is the item for which 'item profile panel' is shown (STORM-288) - if (*it == mItemId) + // check if there's a change we're interested in. + if (*it == expected_id) { - // if there's a change we're interested in. if ((mask & (LLInventoryObserver::LABEL | LLInventoryObserver::INTERNAL | LLInventoryObserver::REMOVE)) != 0) { refreshFromInventory(); @@ -255,6 +298,12 @@ void LLFloaterChangeItemThumbnail::inventoryChanged(LLViewerObject* object, LLInventoryObject* LLFloaterChangeItemThumbnail::getInventoryObject() { + if (mItemList.size() == 0) + { + return NULL; + } + + const LLUUID item_id = *mItemList.begin(); LLInventoryObject* obj = NULL; if (mTaskId.isNull()) { @@ -265,7 +314,7 @@ LLInventoryObject* LLFloaterChangeItemThumbnail::getInventoryObject() mObserverInitialized = true; } - obj = gInventory.getObject(mItemId); + obj = gInventory.getObject(item_id); } else { @@ -278,7 +327,7 @@ LLInventoryObject* LLFloaterChangeItemThumbnail::getInventoryObject() mObserverInitialized = false; } - obj = object->getInventoryObject(mItemId); + obj = object->getInventoryObject(item_id); } } return obj; @@ -337,7 +386,7 @@ void LLFloaterChangeItemThumbnail::refreshFromObject(LLInventoryObject* obj) { setTitle(getString("title_item_thumbnail")); - icon_img = LLInventoryIcon::getIcon(item->getType(), item->getInventoryType(), item->getFlags(), FALSE); + icon_img = LLInventoryIcon::getIcon(item->getType(), item->getInventoryType(), item->getFlags(), false); mRemoveImageBtn->setEnabled(thumbnail_id.notNull() && ((item->getActualType() != LLAssetType::AT_TEXTURE) || (item->getAssetUUID() != thumbnail_id))); } else @@ -357,7 +406,7 @@ void LLFloaterChangeItemThumbnail::refreshFromObject(LLInventoryObject* obj) LLInventoryModel::item_array_t items; // Not LLIsOfAssetType, because we allow links LLIsOutfitTextureType f; - gInventory.getDirectDescendentsOf(mItemId, cats, items, f); + gInventory.getDirectDescendentsOf(*mItemList.begin(), cats, items, f); if (1 == items.size()) { @@ -384,12 +433,44 @@ void LLFloaterChangeItemThumbnail::refreshFromObject(LLInventoryObject* obj) mRemoveImageBtn->setEnabled(thumbnail_id.notNull()); } } - mItemTypeIcon->setImage(icon_img); - mItemNameText->setValue(obj->getName()); + if (mItemList.size() == 1) + { + mItemTypeIcon->setImage(icon_img); + mItemTypeIcon->setVisible(true); + mMultipleTextBox->setVisible(false); + mItemNameText->setValue(obj->getName()); + mItemNameText->setToolTip(std::string()); + } + else + { + mItemTypeIcon->setVisible(false); + mMultipleTextBox->setVisible(mMultipleThumbnails); + mItemNameText->setValue(getString("multiple_item_names")); + + // Display first five names as a tooltip + const S32 ITEMS_TO_SHOW = 5; + std::string items_str; + uuid_set_t::iterator iter = mItemList.begin(); + uuid_set_t::iterator end = mItemList.end(); + for (S32 i = 0; (iter != end) && (i < ITEMS_TO_SHOW); iter++, i++) + { + LLInventoryObject* pobj = gInventory.getObject(*iter); + if (pobj) + { + items_str += pobj->getName(); + items_str += '\n'; + } + } + if (mItemList.size() > ITEMS_TO_SHOW) + { + items_str += "..."; + } + mItemNameText->setToolTip(items_str); + } mThumbnailCtrl->setValue(thumbnail_id); - mCopyToClipboardBtn->setEnabled(thumbnail_id.notNull()); + mCopyToClipboardBtn->setEnabled(thumbnail_id.notNull() && !mMultipleThumbnails); mPasteFromClipboardBtn->setEnabled(LLClipboard::instance().hasContents()); // todo: some elements might not support setting thumbnails @@ -401,7 +482,17 @@ void LLFloaterChangeItemThumbnail::onUploadLocal(void *userdata) { LLFloaterChangeItemThumbnail *self = (LLFloaterChangeItemThumbnail*)userdata; - (new LLThumbnailImagePicker(self->mItemId, self->mTaskId))->getFile(); + LLUUID task_id = self->mTaskId; + uuid_set_t inventory_ids = self->mItemList; + LLHandle<LLFloater> handle = self->getHandle(); + (new LLThumbnailImagePicker( + *self->mItemList.begin(), + self->mTaskId, + [inventory_ids, task_id, handle](const LLUUID& asset_id) + { + onUploadComplete(asset_id, task_id, inventory_ids, handle); + } + ))->getFile(); LLFloater* floaterp = self->mPickerHandle.get(); if (floaterp) @@ -428,7 +519,7 @@ void LLFloaterChangeItemThumbnail::onUploadSnapshot(void *userdata) else { LLSD key; - key["item_id"] = self->mItemId; + key["item_id"] = *self->mItemList.begin(); key["task_id"] = self->mTaskId; LLFloaterSimpleSnapshot* snapshot_floater = (LLFloaterSimpleSnapshot*)LLFloaterReg::showInstance("simple_snapshot", key, true); if (snapshot_floater) @@ -436,6 +527,14 @@ void LLFloaterChangeItemThumbnail::onUploadSnapshot(void *userdata) self->addDependentFloater(snapshot_floater); self->mSnapshotHandle = snapshot_floater->getHandle(); snapshot_floater->setOwner(self); + LLUUID task_id = self->mTaskId; + uuid_set_t inventory_ids = self->mItemList; + LLHandle<LLFloater> handle = self->getHandle(); + snapshot_floater->setComplectionCallback( + [inventory_ids, task_id, handle](const LLUUID& asset_id) + { + onUploadComplete(asset_id, task_id, inventory_ids, handle); + }); } } @@ -532,7 +631,7 @@ void LLFloaterChangeItemThumbnail::onRemove(void *userdata) LLFloaterChangeItemThumbnail *self = (LLFloaterChangeItemThumbnail*)userdata; LLSD payload; - payload["item_id"] = self->mItemId; + payload["item_id"] = *self->mItemList.begin(); payload["object_id"] = self->mTaskId; LLNotificationsUtil::add("DeleteThumbnail", LLSD(), payload, boost::bind(&LLFloaterChangeItemThumbnail::onRemovalConfirmation, _1, _2, self->getHandle())); } @@ -551,7 +650,8 @@ void LLFloaterChangeItemThumbnail::onRemovalConfirmation(const LLSD& notificatio struct ImageLoadedData { LLUUID mThumbnailId; - LLUUID mObjectId; + LLUUID mTaskId; + uuid_set_t mItemIds; LLHandle<LLFloater> mFloaterHandle; bool mSilent; // Keep image reference to prevent deletion on timeout @@ -581,7 +681,8 @@ void LLFloaterChangeItemThumbnail::assignAndValidateAsset(const LLUUID &asset_id mExpectingAssetId = asset_id; } ImageLoadedData *data = new ImageLoadedData(); - data->mObjectId = mItemId; + data->mTaskId = mTaskId; + data->mItemIds = mItemList; data->mThumbnailId = asset_id; data->mFloaterHandle = getHandle(); data->mSilent = silent; @@ -589,11 +690,11 @@ void LLFloaterChangeItemThumbnail::assignAndValidateAsset(const LLUUID &asset_id texturep->setLoadedCallback(onImageDataLoaded, MAX_DISCARD_LEVEL, // Don't need full image, just size data - FALSE, - FALSE, + false, + false, (void*)data, NULL, - FALSE); + false); } else { @@ -647,12 +748,12 @@ bool LLFloaterChangeItemThumbnail::validateAsset(const LLUUID &asset_id) //static void LLFloaterChangeItemThumbnail::onImageDataLoaded( - BOOL success, + bool success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, - BOOL final, + bool final, void* userdata) { if (!userdata) return; @@ -663,10 +764,13 @@ void LLFloaterChangeItemThumbnail::onImageDataLoaded( if (success) { - // Update the item, set it even if floater is dead + // Update items, set thumnails even if floater is dead if (validateAsset(data->mThumbnailId)) { - setThumbnailId(data->mThumbnailId, data->mObjectId); + for (const LLUUID& id : data->mItemIds) + { + setThumbnailId(data->mThumbnailId, data->mTaskId, id); + } } else if (!data->mSilent) { @@ -690,12 +794,12 @@ void LLFloaterChangeItemThumbnail::onImageDataLoaded( //static void LLFloaterChangeItemThumbnail::onFullImageLoaded( - BOOL success, + bool success, LLViewerFetchedTexture* src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, - BOOL final, + bool final, void* userdata) { if (!userdata) return; @@ -716,11 +820,23 @@ void LLFloaterChangeItemThumbnail::onFullImageLoaded( } else if (src_vi->getFullWidth() > LLFloaterSimpleSnapshot::THUMBNAIL_SNAPSHOT_DIM_MAX) { - LLFloaterSimpleSnapshot::uploadThumbnail(src, data->mObjectId, LLUUID::null); + LLUUID task_id = data->mTaskId; + uuid_set_t inventory_ids = data->mItemIds; + LLHandle<LLFloater> handle = data->mFloaterHandle; + LLFloaterSimpleSnapshot::uploadThumbnail(src, + *data->mItemIds.begin(), + task_id, + [inventory_ids, task_id, handle](const LLUUID& asset_id) + { + onUploadComplete(asset_id, task_id, inventory_ids, handle); + }); } else { - setThumbnailId(data->mThumbnailId, data->mObjectId); + for (const LLUUID& id : data->mItemIds) + { + setThumbnailId(data->mThumbnailId, data->mTaskId, id); + } } } @@ -745,12 +861,12 @@ void LLFloaterChangeItemThumbnail::showTexturePicker(const LLUUID &thumbnail_id) thumbnail_id, thumbnail_id, thumbnail_id, - FALSE, - TRUE, + false, + true, "SELECT PHOTO", PERM_NONE, PERM_NONE, - FALSE, + false, NULL, PICK_TEXTURE); @@ -770,8 +886,8 @@ void LLFloaterChangeItemThumbnail::showTexturePicker(const LLUUID &thumbnail_id) } ); - texture_floaterp->setLocalTextureEnabled(FALSE); - texture_floaterp->setBakeTextureEnabled(FALSE); + texture_floaterp->setLocalTextureEnabled(false); + texture_floaterp->setBakeTextureEnabled(false); texture_floaterp->setCanApplyImmediately(false); texture_floaterp->setCanApply(false, true, false /*Hide 'preview disabled'*/); texture_floaterp->setMinDimentionsLimits(LLFloaterSimpleSnapshot::THUMBNAIL_SNAPSHOT_DIM_MIN); @@ -781,7 +897,7 @@ void LLFloaterChangeItemThumbnail::showTexturePicker(const LLUUID &thumbnail_id) floaterp->openFloater(); } - floaterp->setFocus(TRUE); + floaterp->setFocus(true); } void LLFloaterChangeItemThumbnail::onTexturePickerCommit() @@ -838,19 +954,34 @@ void LLFloaterChangeItemThumbnail::onTexturePickerCommit() && (texturep->getCachedRawImageLevel() == 0 || texturep->getRawImageLevel() == 0) && (texturep->isCachedRawImageReady() || texturep->isRawImageValid())) { + LLUUID task_id = mTaskId; + uuid_set_t inventory_ids = mItemList; + LLHandle<LLFloater> handle = getHandle(); + LLFloaterSimpleSnapshot::completion_t callback = + [inventory_ids, task_id, handle](const LLUUID& asset_id) + { + onUploadComplete(asset_id, task_id, inventory_ids, handle); + }; if (texturep->isRawImageValid()) { - LLFloaterSimpleSnapshot::uploadThumbnail(texturep->getRawImage(), mItemId, mTaskId); + LLFloaterSimpleSnapshot::uploadThumbnail(texturep->getRawImage(), + *mItemList.begin(), + mTaskId, + callback); } else { - LLFloaterSimpleSnapshot::uploadThumbnail(texturep->getCachedRawImage(), mItemId, mTaskId); + LLFloaterSimpleSnapshot::uploadThumbnail(texturep->getCachedRawImage(), + *mItemList.begin(), + mTaskId, + callback); } } else { ImageLoadedData* data = new ImageLoadedData(); - data->mObjectId = mItemId; + data->mTaskId = mTaskId; + data->mItemIds = mItemList; data->mThumbnailId = asset_id; data->mFloaterHandle = getHandle(); data->mSilent = false; @@ -860,11 +991,11 @@ void LLFloaterChangeItemThumbnail::onTexturePickerCommit() texturep->setMinDiscardLevel(0); texturep->setLoadedCallback(onFullImageLoaded, 0, // Need best quality - TRUE, - FALSE, + true, + false, (void*)data, NULL, - FALSE); + false); texturep->forceToSaveRawImage(0); } return; @@ -874,6 +1005,41 @@ void LLFloaterChangeItemThumbnail::onTexturePickerCommit() } } +//static +void LLFloaterChangeItemThumbnail::onUploadComplete(const LLUUID& asset_id, + const LLUUID& task_id, + const uuid_set_t& inventory_ids, + LLHandle<LLFloater> handle) +{ + if (asset_id.isNull()) + { + // failure + return; + } + uuid_set_t::iterator iter = inventory_ids.begin(); + uuid_set_t::iterator end = inventory_ids.end(); + if (iter == end) + { + LL_WARNS() << "Received empty item list!" << LL_ENDL; + } + else + { + iter++; // first element was set by upload + for (; iter != end; iter++) + { + setThumbnailId(asset_id, task_id, *iter); + } + } + if (!handle.isDead()) + { + LLFloaterChangeItemThumbnail* floater = (LLFloaterChangeItemThumbnail*)handle.get(); + if (floater) + { + floater->mMultipleThumbnails = false; + floater->mMultipleTextBox->setVisible(false); + } + } +} void LLFloaterChangeItemThumbnail::setThumbnailId(const LLUUID &new_thumbnail_id) { @@ -889,20 +1055,28 @@ void LLFloaterChangeItemThumbnail::setThumbnailId(const LLUUID &new_thumbnail_id return; } - setThumbnailId(new_thumbnail_id, mItemId, obj); + for (const LLUUID &id : mItemList) + { + setThumbnailId(new_thumbnail_id, id, obj); + } } -void LLFloaterChangeItemThumbnail::setThumbnailId(const LLUUID& new_thumbnail_id, const LLUUID& object_id) +void LLFloaterChangeItemThumbnail::setThumbnailId(const LLUUID& new_thumbnail_id, const LLUUID& task_id, const LLUUID& inv_obj_id) { - LLInventoryObject* obj = gInventory.getObject(object_id); + if (task_id.notNull()) + { + LL_WARNS() << "Not supported" << LL_ENDL; + return; + } + LLInventoryObject* obj = gInventory.getObject(inv_obj_id); if (!obj) { return; } - setThumbnailId(new_thumbnail_id, object_id, obj); + setThumbnailId(new_thumbnail_id, inv_obj_id, obj); } -void LLFloaterChangeItemThumbnail::setThumbnailId(const LLUUID& new_thumbnail_id, const LLUUID& object_id, LLInventoryObject* obj) +void LLFloaterChangeItemThumbnail::setThumbnailId(const LLUUID& new_thumbnail_id, const LLUUID& inv_obj_id, LLInventoryObject* obj) { if (obj->getThumbnailUUID() != new_thumbnail_id) { @@ -920,12 +1094,12 @@ void LLFloaterChangeItemThumbnail::setThumbnailId(const LLUUID& new_thumbnail_id LLViewerInventoryCategory* view_folder = dynamic_cast<LLViewerInventoryCategory*>(obj); if (view_folder) { - update_inventory_category(object_id, updates, NULL); + update_inventory_category(inv_obj_id, updates, NULL); } LLViewerInventoryItem* view_item = dynamic_cast<LLViewerInventoryItem*>(obj); if (view_item) { - update_inventory_item(object_id, updates, NULL); + update_inventory_item(inv_obj_id, updates, NULL); } } } diff --git a/indra/newview/llfloaterchangeitemthumbnail.h b/indra/newview/llfloaterchangeitemthumbnail.h index bad5342e73..46f63801fe 100644 --- a/indra/newview/llfloaterchangeitemthumbnail.h +++ b/indra/newview/llfloaterchangeitemthumbnail.h @@ -45,16 +45,16 @@ public: LLFloaterChangeItemThumbnail(const LLSD& key); ~LLFloaterChangeItemThumbnail(); - BOOL postBuild() override; + bool postBuild() override; void onOpen(const LLSD& key) override; void onFocusReceived() override; void onMouseEnter(S32 x, S32 y, MASK mask) override; - BOOL handleDragAndDrop( + bool handleDragAndDrop( S32 x, S32 y, MASK mask, - BOOL drop, + bool drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, @@ -83,27 +83,28 @@ private: static void onRemovalConfirmation(const LLSD& notification, const LLSD& response, LLHandle<LLFloater> handle); void assignAndValidateAsset(const LLUUID &asset_id, bool silent = false); - static void onImageDataLoaded(BOOL success, + static void onImageDataLoaded(bool success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, - BOOL final, + bool final, void* userdata); - static void onFullImageLoaded(BOOL success, + static void onFullImageLoaded(bool success, LLViewerFetchedTexture* src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, - BOOL final, + bool final, void* userdata); void showTexturePicker(const LLUUID &thumbnail_id); void onTexturePickerCommit(); + static void onUploadComplete(const LLUUID& asset_id, const LLUUID& task_id, const uuid_set_t& inventory_ids, LLHandle<LLFloater> handle); void setThumbnailId(const LLUUID &new_thumbnail_id); - static void setThumbnailId(const LLUUID& new_thumbnail_id, const LLUUID& object_id); - static void setThumbnailId(const LLUUID& new_thumbnail_id, const LLUUID& object_id, LLInventoryObject* obj); + static void setThumbnailId(const LLUUID& new_thumbnail_id, const LLUUID& task_id, const LLUUID& inv_obj_id); + static void setThumbnailId(const LLUUID& new_thumbnail_id, const LLUUID& inv_obj_id, LLInventoryObject* obj); enum EToolTipState { @@ -120,8 +121,9 @@ private: void onButtonMouseLeave(LLUICtrl* button, const LLSD& param, EToolTipState state); bool mObserverInitialized; + bool mMultipleThumbnails; // for multiselection EToolTipState mTooltipState; - LLUUID mItemId; + uuid_set_t mItemList; LLUUID mTaskId; LLUUID mExpectingAssetId; @@ -129,6 +131,7 @@ private: LLUICtrl *mItemNameText; LLThumbnailCtrl *mThumbnailCtrl; LLTextBox *mToolTipTextBox; + LLTextBox *mMultipleTextBox; LLButton *mCopyToClipboardBtn; LLButton *mPasteFromClipboardBtn; LLButton *mRemoveImageBtn; diff --git a/indra/newview/llfloaterclassified.cpp b/indra/newview/llfloaterclassified.cpp index 3520b0f67a..9001f2198e 100644 --- a/indra/newview/llfloaterclassified.cpp +++ b/indra/newview/llfloaterclassified.cpp @@ -51,9 +51,9 @@ void LLFloaterClassified::onOpen(const LLSD& key) LLFloater::onOpen(key); } -BOOL LLFloaterClassified::postBuild() +bool LLFloaterClassified::postBuild() { - return TRUE; + return true; } diff --git a/indra/newview/llfloaterclassified.h b/indra/newview/llfloaterclassified.h index 2c95d82b2c..45bd56695d 100644 --- a/indra/newview/llfloaterclassified.h +++ b/indra/newview/llfloaterclassified.h @@ -37,7 +37,7 @@ public: virtual ~LLFloaterClassified(); void onOpen(const LLSD& key) override; - BOOL postBuild() override; + bool postBuild() override; bool matchesKey(const LLSD& key) override; }; diff --git a/indra/newview/llfloatercolorpicker.cpp b/indra/newview/llfloatercolorpicker.cpp index 8ad13367c0..603f54fb49 100644 --- a/indra/newview/llfloatercolorpicker.cpp +++ b/indra/newview/llfloatercolorpicker.cpp @@ -68,12 +68,12 @@ // ////////////////////////////////////////////////////////////////////////////// -LLFloaterColorPicker::LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show_apply_immediate ) +LLFloaterColorPicker::LLFloaterColorPicker (LLColorSwatchCtrl* swatch, bool show_apply_immediate ) : LLFloater(LLSD()), mComponents ( 3 ), - mMouseDownInLumRegion ( FALSE ), - mMouseDownInHueRegion ( FALSE ), - mMouseDownInSwatch ( FALSE ), + mMouseDownInLumRegion ( false ), + mMouseDownInHueRegion ( false ), + mMouseDownInSwatch ( false ), // *TODO: Specify this in XML mRGBViewerImageLeft ( 140 ), mRGBViewerImageTop ( 356 ), @@ -99,7 +99,7 @@ LLFloaterColorPicker::LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show mPaletteRegionWidth ( mLumRegionLeft + mLumRegionWidth - 10 ), mPaletteRegionHeight ( 40 ), mSwatch ( swatch ), - mActive ( TRUE ), + mActive ( true ), mCanApplyImmediately ( show_apply_immediate ), mContextConeOpacity ( 0.f ), mContextConeInAlpha (CONTEXT_CONE_IN_ALPHA), @@ -113,8 +113,8 @@ LLFloaterColorPicker::LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show if (!mCanApplyImmediately) { - mApplyImmediateCheck->setEnabled(FALSE); - mApplyImmediateCheck->set(FALSE); + mApplyImmediateCheck->setEnabled(false); + mApplyImmediateCheck->set(false); } } @@ -131,6 +131,8 @@ void LLFloaterColorPicker::createUI () // create RGB type area (not really RGB but it's got R,G & B in it.,.. LLPointer<LLImageRaw> raw = new LLImageRaw ( mRGBViewerImageWidth, mRGBViewerImageHeight, mComponents ); + LLImageDataLock lock(raw); + U8* bits = raw->getData(); S32 linesize = mRGBViewerImageWidth * mComponents; for ( S32 y = 0; y < mRGBViewerImageHeight; ++y ) @@ -151,7 +153,7 @@ void LLFloaterColorPicker::createUI () * ( bits + x + y * linesize + 2 ) = ( U8 )( bVal * 255.0f ); } } - mRGBImage = LLViewerTextureManager::getLocalTexture( (LLImageRaw*)raw, FALSE ); + mRGBImage = LLViewerTextureManager::getLocalTexture( (LLImageRaw*)raw, false ); gGL.getTexUnit(0)->bind(mRGBImage); mRGBImage->setAddressMode(LLTexUnit::TAM_CLAMP); @@ -167,15 +169,15 @@ void LLFloaterColorPicker::createUI () void LLFloaterColorPicker::showUI () { openFloater(getKey()); - setVisible ( TRUE ); - setFocus ( TRUE ); + setVisible ( true ); + setFocus ( true ); // HACK: if system color picker is required - close the SL one we made and use default system dialog if ( gSavedSettings.getBOOL ( "UseDefaultColorPicker" ) ) { LLColorSwatchCtrl* swatch = getSwatch (); - setVisible ( FALSE ); + setVisible ( false ); // code that will get switched in for default system color picker if ( swatch ) @@ -205,14 +207,14 @@ void LLFloaterColorPicker::showUI () ////////////////////////////////////////////////////////////////////////////// // called after the dialog is rendered -BOOL LLFloaterColorPicker::postBuild() +bool LLFloaterColorPicker::postBuild() { mCancelBtn = getChild<LLButton>( "cancel_btn" ); mCancelBtn->setClickedCallback ( onClickCancel, this ); mSelectBtn = getChild<LLButton>( "select_btn"); mSelectBtn->setClickedCallback ( onClickSelect, this ); - mSelectBtn->setFocus ( TRUE ); + mSelectBtn->setFocus ( true ); mPipetteBtn = getChild<LLButton>("color_pipette" ); @@ -233,7 +235,7 @@ BOOL LLFloaterColorPicker::postBuild() LLToolPipette::getInstance()->setToolSelectCallback(boost::bind(&LLFloaterColorPicker::onColorSelect, this, _1)); - return TRUE; + return true; } ////////////////////////////////////////////////////////////////////////////// @@ -419,7 +421,7 @@ void LLFloaterColorPicker::onClickSelect ( void* data ) void LLFloaterColorPicker::onClickPipette( ) { - BOOL pipette_active = mPipetteBtn->getToggleState(); + bool pipette_active = mPipetteBtn->getToggleState(); pipette_active = !pipette_active; if (pipette_active) { @@ -466,8 +468,8 @@ void LLFloaterColorPicker::onColorSelect( const LLTextureEntry& te ) void LLFloaterColorPicker::onMouseCaptureLost() { - setMouseDownInHueRegion(FALSE); - setMouseDownInLumRegion(FALSE); + setMouseDownInHueRegion(false); + setMouseDownInLumRegion(false); } F32 LLFloaterColorPicker::getSwatchTransparency() @@ -476,7 +478,7 @@ F32 LLFloaterColorPicker::getSwatchTransparency() return getTransparencyType() == TT_ACTIVE ? 1.f : LLFloater::getCurrentTransparency(); } -BOOL LLFloaterColorPicker::isColorChanged() +bool LLFloaterColorPicker::isColorChanged() { return ((getOrigR() != getCurR()) || (getOrigG() != getCurG()) || (getOrigB() != getCurB())); } @@ -521,7 +523,7 @@ void LLFloaterColorPicker::draw() mRGBViewerImageLeft + mRGBViewerImageWidth + 1, mRGBViewerImageTop, LLColor4 ( 0.0f, 0.0f, 0.0f, alpha ), - FALSE ); + false ); // draw luminance slider for ( S32 y = 0; y < mLumRegionHeight; ++y ) @@ -543,7 +545,7 @@ void LLFloaterColorPicker::draw() gl_triangle_2d ( startX, startY, startX + mLumMarkerSize, startY - mLumMarkerSize, startX + mLumMarkerSize, startY + mLumMarkerSize, - LLColor4 ( 0.75f, 0.75f, 0.75f, 1.0f ), TRUE ); + LLColor4 ( 0.75f, 0.75f, 0.75f, 1.0f ), true ); // draw luminance slider outline gl_rect_2d ( mLumRegionLeft, @@ -551,7 +553,7 @@ void LLFloaterColorPicker::draw() mLumRegionLeft + mLumRegionWidth + 1, mLumRegionTop, LLColor4 ( 0.0f, 0.0f, 0.0f, 1.0f ), - FALSE ); + false ); // draw selected color swatch gl_rect_2d ( mSwatchRegionLeft, @@ -559,7 +561,7 @@ void LLFloaterColorPicker::draw() mSwatchRegionLeft + mSwatchRegionWidth, mSwatchRegionTop, LLColor4 ( getCurR (), getCurG (), getCurB (), alpha ), - TRUE ); + true ); // draw selected color swatch outline gl_rect_2d ( mSwatchRegionLeft, @@ -567,7 +569,7 @@ void LLFloaterColorPicker::draw() mSwatchRegionLeft + mSwatchRegionWidth + 1, mSwatchRegionTop, LLColor4 ( 0.0f, 0.0f, 0.0f, 1.0f ), - FALSE ); + false ); // color palette code is a little more involved so break it out into its' own method drawPalette (); @@ -635,8 +637,8 @@ void LLFloaterColorPicker::drawPalette () // draw palette entry color if ( mPalette [ curEntry ] ) { - gl_rect_2d ( x1 + 2, y1 - 2, x2 - 2, y2 + 2, *mPalette [ curEntry++ ] % alpha, TRUE ); - gl_rect_2d ( x1 + 1, y1 - 1, x2 - 1, y2 + 1, LLColor4 ( 0.0f, 0.0f, 0.0f, 1.0f ), FALSE ); + gl_rect_2d ( x1 + 2, y1 - 2, x2 - 2, y2 + 2, *mPalette [ curEntry++ ] % alpha, true ); + gl_rect_2d ( x1 + 1, y1 - 1, x2 - 1, y2 + 1, LLColor4 ( 0.0f, 0.0f, 0.0f, 1.0f ), false ); } } } @@ -740,7 +742,7 @@ void LLFloaterColorPicker::onTextEntryChanged ( LLUICtrl* ctrl ) ////////////////////////////////////////////////////////////////////////////// // -BOOL LLFloaterColorPicker::updateRgbHslFromPoint ( S32 xPosIn, S32 yPosIn ) +bool LLFloaterColorPicker::updateRgbHslFromPoint ( S32 xPosIn, S32 yPosIn ) { if ( xPosIn >= mRGBViewerImageLeft && xPosIn <= mRGBViewerImageLeft + mRGBViewerImageWidth && @@ -753,7 +755,7 @@ BOOL LLFloaterColorPicker::updateRgbHslFromPoint ( S32 xPosIn, S32 yPosIn ) getCurL () ); // indicate a value changed - return TRUE; + return true; } else if ( xPosIn >= mLumRegionLeft && @@ -768,15 +770,15 @@ BOOL LLFloaterColorPicker::updateRgbHslFromPoint ( S32 xPosIn, S32 yPosIn ) ( ( F32 )yPosIn - ( ( F32 )mRGBViewerImageTop - ( F32 )mRGBViewerImageHeight ) ) / ( F32 )mRGBViewerImageHeight ); // indicate a value changed - return TRUE; + return true; } - return FALSE; + return false; } ////////////////////////////////////////////////////////////////////////////// // -BOOL LLFloaterColorPicker::handleMouseDown ( S32 x, S32 y, MASK mask ) +bool LLFloaterColorPicker::handleMouseDown ( S32 x, S32 y, MASK mask ) { // make it the frontmost gFloaterView->bringToFront(this); @@ -791,13 +793,13 @@ BOOL LLFloaterColorPicker::handleMouseDown ( S32 x, S32 y, MASK mask ) { gFocusMgr.setMouseCapture(this); // mouse button down - setMouseDownInHueRegion ( TRUE ); + setMouseDownInHueRegion ( true ); // update all values based on initial click updateRgbHslFromPoint ( x, y ); // required by base class - return TRUE; + return true; } // rect containing RGB area @@ -810,10 +812,10 @@ BOOL LLFloaterColorPicker::handleMouseDown ( S32 x, S32 y, MASK mask ) { gFocusMgr.setMouseCapture(this); // mouse button down - setMouseDownInLumRegion ( TRUE ); + setMouseDownInLumRegion ( true ); // required by base class - return TRUE; + return true; } // rect containing swatch area @@ -822,13 +824,13 @@ BOOL LLFloaterColorPicker::handleMouseDown ( S32 x, S32 y, MASK mask ) mSwatchRegionLeft + mSwatchRegionWidth, mSwatchRegionTop - mSwatchRegionHeight ); - setMouseDownInSwatch( FALSE ); + setMouseDownInSwatch( false ); if ( swatchRect.pointInRect ( x, y ) ) { - setMouseDownInSwatch( TRUE ); + setMouseDownInSwatch( true ); // required - dont drag windows here. - return TRUE; + return true; } // rect containing palette area @@ -842,7 +844,7 @@ BOOL LLFloaterColorPicker::handleMouseDown ( S32 x, S32 y, MASK mask ) // release keyboard focus so we can change text values if (gFocusMgr.childHasKeyboardFocus(this)) { - mSelectBtn->setFocus(TRUE); + mSelectBtn->setFocus(true); } // calculate which palette index we selected @@ -865,7 +867,7 @@ BOOL LLFloaterColorPicker::handleMouseDown ( S32 x, S32 y, MASK mask ) updateTextEntry (); } - return TRUE; + return true; } // dispatch to base class for the rest of things @@ -875,7 +877,7 @@ BOOL LLFloaterColorPicker::handleMouseDown ( S32 x, S32 y, MASK mask ) ////////////////////////////////////////////////////////////////////////////// // -BOOL LLFloaterColorPicker::handleHover ( S32 x, S32 y, MASK mask ) +bool LLFloaterColorPicker::handleHover ( S32 x, S32 y, MASK mask ) { // if we're the front most window if ( isFrontmost () ) @@ -895,7 +897,7 @@ BOOL LLFloaterColorPicker::handleHover ( S32 x, S32 y, MASK mask ) clamped_y = llclamp(y, mLumRegionTop - mLumRegionHeight, mLumRegionTop); } - // update the stored RGB/HSL values using the mouse position - returns TRUE if RGB was updated + // update the stored RGB/HSL values using the mouse position - returns true if RGB was updated if ( updateRgbHslFromPoint ( clamped_x, clamped_y ) ) { // update text entry fields @@ -933,7 +935,7 @@ BOOL LLFloaterColorPicker::handleHover ( S32 x, S32 y, MASK mask ) highlightEntry = xOffset + yOffset * numPaletteColumns; } - return TRUE; + return true; } } @@ -943,7 +945,7 @@ BOOL LLFloaterColorPicker::handleHover ( S32 x, S32 y, MASK mask ) ////////////////////////////////////////////////////////////////////////////// // reverts state once mouse button is released -BOOL LLFloaterColorPicker::handleMouseUp ( S32 x, S32 y, MASK mask ) +bool LLFloaterColorPicker::handleMouseUp ( S32 x, S32 y, MASK mask ) { getWindow()->setCursor ( UI_CURSOR_ARROW ); @@ -1001,8 +1003,8 @@ BOOL LLFloaterColorPicker::handleMouseUp ( S32 x, S32 y, MASK mask ) } // mouse button not down anymore - setMouseDownInHueRegion ( FALSE ); - setMouseDownInLumRegion ( FALSE ); + setMouseDownInHueRegion ( false ); + setMouseDownInLumRegion ( false ); // mouse button not down in color swatch anymore mMouseDownInSwatch = false; @@ -1027,10 +1029,10 @@ void LLFloaterColorPicker::cancelSelection () LLColorSwatchCtrl::onColorChanged( getSwatch(), LLColorSwatchCtrl::COLOR_CANCEL ); // hide picker dialog - this->setVisible ( FALSE ); + this->setVisible ( false ); } -void LLFloaterColorPicker::setMouseDownInHueRegion ( BOOL mouse_down_in_region ) +void LLFloaterColorPicker::setMouseDownInHueRegion ( bool mouse_down_in_region ) { mMouseDownInHueRegion = mouse_down_in_region; if (mouse_down_in_region) @@ -1038,12 +1040,12 @@ void LLFloaterColorPicker::setMouseDownInHueRegion ( BOOL mouse_down_in_region ) if (gFocusMgr.childHasKeyboardFocus(this)) { // get focus out of spinners so that they can update freely - mSelectBtn->setFocus(TRUE); + mSelectBtn->setFocus(true); } } } -void LLFloaterColorPicker::setMouseDownInLumRegion ( BOOL mouse_down_in_region ) +void LLFloaterColorPicker::setMouseDownInLumRegion ( bool mouse_down_in_region ) { mMouseDownInLumRegion = mouse_down_in_region; if (mouse_down_in_region) @@ -1051,12 +1053,12 @@ void LLFloaterColorPicker::setMouseDownInLumRegion ( BOOL mouse_down_in_region ) if (gFocusMgr.childHasKeyboardFocus(this)) { // get focus out of spinners so that they can update freely - mSelectBtn->setFocus(TRUE); + mSelectBtn->setFocus(true); } } } -void LLFloaterColorPicker::setMouseDownInSwatch (BOOL mouse_down_in_swatch) +void LLFloaterColorPicker::setMouseDownInSwatch (bool mouse_down_in_swatch) { mMouseDownInSwatch = mouse_down_in_swatch; if (mouse_down_in_swatch) @@ -1064,12 +1066,12 @@ void LLFloaterColorPicker::setMouseDownInSwatch (BOOL mouse_down_in_swatch) if (gFocusMgr.childHasKeyboardFocus(this)) { // get focus out of spinners so that they can update freely - mSelectBtn->setFocus(TRUE); + mSelectBtn->setFocus(true); } } } -void LLFloaterColorPicker::setActive(BOOL active) +void LLFloaterColorPicker::setActive(bool active) { // shut down pipette tool if active if (!active && mPipetteBtn->getToggleState()) diff --git a/indra/newview/llfloatercolorpicker.h b/indra/newview/llfloatercolorpicker.h index ab7c6e3a43..5c27fffd08 100644 --- a/indra/newview/llfloatercolorpicker.h +++ b/indra/newview/llfloatercolorpicker.h @@ -44,15 +44,15 @@ class LLFloaterColorPicker : public LLFloater { public: - LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show_apply_immediate = FALSE); + LLFloaterColorPicker (LLColorSwatchCtrl* swatch, bool show_apply_immediate = false); virtual ~LLFloaterColorPicker (); // overrides - virtual BOOL postBuild (); + virtual bool postBuild (); virtual void draw (); - virtual BOOL handleMouseDown ( S32 x, S32 y, MASK mask ); - virtual BOOL handleMouseUp ( S32 x, S32 y, MASK mask ); - virtual BOOL handleHover ( S32 x, S32 y, MASK mask ); + virtual bool handleMouseDown ( S32 x, S32 y, MASK mask ); + virtual bool handleMouseUp ( S32 x, S32 y, MASK mask ); + virtual bool handleHover ( S32 x, S32 y, MASK mask ); virtual void onMouseCaptureLost(); virtual F32 getSwatchTransparency(); @@ -87,7 +87,7 @@ class LLFloaterColorPicker F32 getCurL () { return curL; }; // updates current RGB/HSL values based on point in picker - BOOL updateRgbHslFromPoint ( S32 xPosIn, S32 yPosIn ); + bool updateRgbHslFromPoint ( S32 xPosIn, S32 yPosIn ); // updates text entry fields with current RGB/HSL void updateTextEntry (); @@ -95,16 +95,16 @@ class LLFloaterColorPicker void stopUsingPipette(); // mutator / accessor for mouse button pressed in region - void setMouseDownInHueRegion ( BOOL mouse_down_in_region ); - BOOL getMouseDownInHueRegion () { return mMouseDownInHueRegion; }; + void setMouseDownInHueRegion ( bool mouse_down_in_region ); + bool getMouseDownInHueRegion () { return mMouseDownInHueRegion; }; - void setMouseDownInLumRegion ( BOOL mouse_down_in_region ); - BOOL getMouseDownInLumRegion () { return mMouseDownInLumRegion; }; + void setMouseDownInLumRegion ( bool mouse_down_in_region ); + bool getMouseDownInLumRegion () { return mMouseDownInLumRegion; }; - void setMouseDownInSwatch (BOOL mouse_down_in_swatch); - BOOL getMouseDownInSwatch () { return mMouseDownInSwatch; } + void setMouseDownInSwatch (bool mouse_down_in_swatch); + bool getMouseDownInSwatch () { return mMouseDownInSwatch; } - BOOL isColorChanged (); + bool isColorChanged (); // called when text entries (RGB/HSL etc.) are changed by user void onTextEntryChanged ( LLUICtrl* ctrl ); @@ -113,7 +113,7 @@ class LLFloaterColorPicker void hslToRgb ( F32 hValIn, F32 sValIn, F32 lValIn, F32& rValOut, F32& gValOut, F32& bValOut ); F32 hueToRgb ( F32 val1In, F32 val2In, F32 valHUeIn ); - void setActive(BOOL active); + void setActive(bool active); protected: // callbacks @@ -142,9 +142,9 @@ class LLFloaterColorPicker const S32 mComponents; - BOOL mMouseDownInLumRegion; - BOOL mMouseDownInHueRegion; - BOOL mMouseDownInSwatch; + bool mMouseDownInLumRegion; + bool mMouseDownInHueRegion; + bool mMouseDownInSwatch; const S32 mRGBViewerImageLeft; const S32 mRGBViewerImageTop; @@ -181,11 +181,11 @@ class LLFloaterColorPicker LLColorSwatchCtrl* mSwatch; // are we actively tied to some output? - BOOL mActive; + bool mActive; // enable/disable immediate updates LLCheckBoxCtrl* mApplyImmediateCheck; - BOOL mCanApplyImmediately; + bool mCanApplyImmediately; LLButton* mSelectBtn; LLButton* mCancelBtn; diff --git a/indra/newview/llfloaterconversationlog.cpp b/indra/newview/llfloaterconversationlog.cpp index 23f5c1e96d..648d3af5a5 100644 --- a/indra/newview/llfloaterconversationlog.cpp +++ b/indra/newview/llfloaterconversationlog.cpp @@ -39,7 +39,7 @@ LLFloaterConversationLog::LLFloaterConversationLog(const LLSD& key) mEnableCallbackRegistrar.add("CallLog.Check", boost::bind(&LLFloaterConversationLog::isActionChecked, this, _2)); } -BOOL LLFloaterConversationLog::postBuild() +bool LLFloaterConversationLog::postBuild() { mConversationLogList = getChild<LLConversationLogList>("conversation_log_list"); diff --git a/indra/newview/llfloaterconversationlog.h b/indra/newview/llfloaterconversationlog.h index 9327fae227..85ca37c530 100644 --- a/indra/newview/llfloaterconversationlog.h +++ b/indra/newview/llfloaterconversationlog.h @@ -37,9 +37,9 @@ public: LLFloaterConversationLog(const LLSD& key); virtual ~LLFloaterConversationLog(){}; - virtual BOOL postBuild(); + bool postBuild() override; - virtual void draw(); + void draw() override; void onFilterEdit(const std::string& search_string); diff --git a/indra/newview/llfloaterconversationpreview.cpp b/indra/newview/llfloaterconversationpreview.cpp index 92bf91ab05..837aa858f5 100644 --- a/indra/newview/llfloaterconversationpreview.cpp +++ b/indra/newview/llfloaterconversationpreview.cpp @@ -60,7 +60,7 @@ LLFloaterConversationPreview::~LLFloaterConversationPreview() { } -BOOL LLFloaterConversationPreview::postBuild() +bool LLFloaterConversationPreview::postBuild() { mChatHistory = getChild<LLChatHistory>("chat_history"); @@ -108,7 +108,7 @@ void LLFloaterConversationPreview::setPages(std::list<LLSD>* messages, const std delete mMessages; // Clean up temporary message list with "Loading..." text } mMessages = messages; - mCurrentPage = (mMessages->size() ? (mMessages->size() - 1) / mPageSize : 0); + mCurrentPage = (mMessages->size() ? (static_cast<int>(mMessages->size()) - 1) / mPageSize : 0); mPageSpinner->setEnabled(true); mPageSpinner->setMaxValue(mCurrentPage+1); diff --git a/indra/newview/llfloaterconversationpreview.h b/indra/newview/llfloaterconversationpreview.h index f7f54a318d..563592fb20 100644 --- a/indra/newview/llfloaterconversationpreview.h +++ b/indra/newview/llfloaterconversationpreview.h @@ -41,12 +41,12 @@ public: LLFloaterConversationPreview(const LLSD& session_id); virtual ~LLFloaterConversationPreview(); - virtual BOOL postBuild(); + bool postBuild() override; void setPages(std::list<LLSD>* messages,const std::string& file_name); - virtual void draw(); - virtual void onOpen(const LLSD& key); - virtual void onClose(bool app_quitting); + void draw() override; + void onOpen(const LLSD& key) override; + void onClose(bool app_quitting) override; private: void onMoreHistoryBtnClick(); diff --git a/indra/newview/llfloatercreatelandmark.cpp b/indra/newview/llfloatercreatelandmark.cpp index f810f3afe7..77ea544c5d 100644 --- a/indra/newview/llfloatercreatelandmark.cpp +++ b/indra/newview/llfloatercreatelandmark.cpp @@ -117,7 +117,7 @@ LLFloaterCreateLandmark::~LLFloaterCreateLandmark() removeObserver(); } -BOOL LLFloaterCreateLandmark::postBuild() +bool LLFloaterCreateLandmark::postBuild() { mFolderCombo = getChild<LLComboBox>("folder_combo"); mLandmarkTitleEditor = getChild<LLLineEditor>("title_editor"); @@ -132,7 +132,7 @@ BOOL LLFloaterCreateLandmark::postBuild() mLandmarksID = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK); - return TRUE; + return true; } void LLFloaterCreateLandmark::removeObserver() @@ -349,7 +349,7 @@ void LLFloaterCreateLandmark::onSaveClicked() gInventory.accountForUpdate(update); new_item->setParent(folder_id); - new_item->updateParentOnServer(FALSE); + new_item->updateParentOnServer(false); } removeObserver(); diff --git a/indra/newview/llfloatercreatelandmark.h b/indra/newview/llfloatercreatelandmark.h index 89e0a0bb6a..bcf9d8578c 100644 --- a/indra/newview/llfloatercreatelandmark.h +++ b/indra/newview/llfloatercreatelandmark.h @@ -45,8 +45,8 @@ public: LLFloaterCreateLandmark(const LLSD& key); ~LLFloaterCreateLandmark(); - BOOL postBuild(); - void onOpen(const LLSD& key); + bool postBuild() override; + void onOpen(const LLSD& key) override; void setItem(const uuid_set_t& items); void updateItem(const uuid_set_t& items, U32 mask); diff --git a/indra/newview/llfloaterdeleteprefpreset.cpp b/indra/newview/llfloaterdeleteprefpreset.cpp index 6b87ec2f98..1a01122afb 100644 --- a/indra/newview/llfloaterdeleteprefpreset.cpp +++ b/indra/newview/llfloaterdeleteprefpreset.cpp @@ -42,7 +42,7 @@ LLFloaterDeletePrefPreset::LLFloaterDeletePrefPreset(const LLSD &key) } // virtual -BOOL LLFloaterDeletePrefPreset::postBuild() +bool LLFloaterDeletePrefPreset::postBuild() { LLFloaterPreference* preferences = LLFloaterReg::getTypedInstance<LLFloaterPreference>("preferences"); if (preferences) @@ -53,7 +53,7 @@ BOOL LLFloaterDeletePrefPreset::postBuild() getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterDeletePrefPreset::onBtnCancel, this)); LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterDeletePrefPreset::onPresetsListChange, this)); - return TRUE; + return true; } void LLFloaterDeletePrefPreset::onOpen(const LLSD& key) diff --git a/indra/newview/llfloaterdeleteprefpreset.h b/indra/newview/llfloaterdeleteprefpreset.h index f94374edc4..f6ba8c2d19 100644 --- a/indra/newview/llfloaterdeleteprefpreset.h +++ b/indra/newview/llfloaterdeleteprefpreset.h @@ -38,8 +38,8 @@ class LLFloaterDeletePrefPreset : public LLFloater public: LLFloaterDeletePrefPreset(const LLSD &key); - /*virtual*/ BOOL postBuild(); - /*virtual*/ void onOpen(const LLSD& key); + bool postBuild() override; + void onOpen(const LLSD& key) override; void onBtnDelete(); void onBtnCancel(); diff --git a/indra/newview/llfloaterdestinations.cpp b/indra/newview/llfloaterdestinations.cpp index 81d7d0078b..93cf02e835 100644 --- a/indra/newview/llfloaterdestinations.cpp +++ b/indra/newview/llfloaterdestinations.cpp @@ -45,10 +45,10 @@ LLFloaterDestinations::~LLFloaterDestinations() { } -BOOL LLFloaterDestinations::postBuild() +bool LLFloaterDestinations::postBuild() { enableResizeCtrls(true, true, false); - return TRUE; + return true; } diff --git a/indra/newview/llfloaterdestinations.h b/indra/newview/llfloaterdestinations.h index 3b88f5cc60..e2bc06882a 100644 --- a/indra/newview/llfloaterdestinations.h +++ b/indra/newview/llfloaterdestinations.h @@ -36,8 +36,8 @@ class LLFloaterDestinations: friend class LLFloaterReg; private: LLFloaterDestinations(const LLSD& key); - /*virtual*/ ~LLFloaterDestinations(); - /*virtual*/ BOOL postBuild(); + ~LLFloaterDestinations(); + bool postBuild() override; }; #endif diff --git a/indra/newview/llfloaterdisplayname.cpp b/indra/newview/llfloaterdisplayname.cpp index 261dc86e59..236aadfbc1 100644 --- a/indra/newview/llfloaterdisplayname.cpp +++ b/indra/newview/llfloaterdisplayname.cpp @@ -45,7 +45,7 @@ class LLFloaterDisplayName : public LLFloater public: LLFloaterDisplayName(const LLSD& key); virtual ~LLFloaterDisplayName() { } - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); void onSave(); void onReset(); void onCancel(); @@ -87,7 +87,7 @@ void LLFloaterDisplayName::onOpen(const LLSD& key) getChild<LLUICtrl>("save_btn")->setEnabled(false); getChild<LLUICtrl>("display_name_editor")->setEnabled(false); getChild<LLUICtrl>("display_name_confirm")->setEnabled(false); - getChild<LLUICtrl>("cancel_btn")->setFocus(TRUE); + getChild<LLUICtrl>("cancel_btn")->setFocus(true); } else @@ -100,7 +100,7 @@ void LLFloaterDisplayName::onOpen(const LLSD& key) } } -BOOL LLFloaterDisplayName::postBuild() +bool LLFloaterDisplayName::postBuild() { getChild<LLUICtrl>("reset_btn")->setCommitCallback(boost::bind(&LLFloaterDisplayName::onReset, this)); getChild<LLUICtrl>("cancel_btn")->setCommitCallback(boost::bind(&LLFloaterDisplayName::onCancel, this)); @@ -108,7 +108,7 @@ BOOL LLFloaterDisplayName::postBuild() center(); - return TRUE; + return true; } void LLFloaterDisplayName::onCacheSetName(bool success, @@ -171,7 +171,7 @@ void LLFloaterDisplayName::onReset() { // UI is enabled, fill the first field getChild<LLUICtrl>("display_name_confirm")->clear(); - getChild<LLUICtrl>("display_name_confirm")->setFocus(TRUE); + getChild<LLUICtrl>("display_name_confirm")->setFocus(true); } else { diff --git a/indra/newview/llfloatereditenvironmentbase.cpp b/indra/newview/llfloatereditenvironmentbase.cpp index 109c7a286c..bd5839ed17 100644 --- a/indra/newview/llfloatereditenvironmentbase.cpp +++ b/indra/newview/llfloatereditenvironmentbase.cpp @@ -443,7 +443,7 @@ void LLFloaterEditEnvironmentBase::onInventoryCreated(LLUUID asset_id, LLUUID in } clearDirtyFlag(); - setFocus(TRUE); // Call back the focus... + setFocus(true); // Call back the focus... loadInventoryItem(inventory_id, can_trans); } diff --git a/indra/newview/llfloatereditenvironmentbase.h b/indra/newview/llfloatereditenvironmentbase.h index 1b7771fe94..37fda5d33e 100644 --- a/indra/newview/llfloatereditenvironmentbase.h +++ b/indra/newview/llfloatereditenvironmentbase.h @@ -57,7 +57,7 @@ public: virtual LLSettingsBase::ptr_t getEditSettings() const = 0; - virtual BOOL isDirty() const override { return getIsDirty(); } + virtual bool isDirty() const override { return getIsDirty(); } protected: typedef std::function<void()> on_confirm_fn; diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 2db1ef381d..ebccb2214c 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -203,7 +203,7 @@ LLFloaterEditExtDayCycle::~LLFloaterEditExtDayCycle() } // virtual -BOOL LLFloaterEditExtDayCycle::postBuild() +bool LLFloaterEditExtDayCycle::postBuild() { getChild<LLLineEditor>(TXT_DAY_NAME)->setKeystrokeCallback(boost::bind(&LLFloaterEditExtDayCycle::onCommitName, this, _1, _2), NULL); @@ -264,7 +264,7 @@ BOOL LLFloaterEditExtDayCycle::postBuild() panel->setOnDirtyFlagChanged([this](LLPanel *, bool val) { onPanelDirtyFlagChanged(val); }); } - return TRUE; + return true; } void LLFloaterEditExtDayCycle::onOpen(const LLSD& key) @@ -423,7 +423,7 @@ void LLFloaterEditExtDayCycle::onClose(bool app_quitting) } -void LLFloaterEditExtDayCycle::onVisibilityChange(BOOL new_visibility) +void LLFloaterEditExtDayCycle::onVisibilityChange(bool new_visibility) { } @@ -534,7 +534,7 @@ void LLFloaterEditExtDayCycle::setEditName(const std::string &name) } /* virtual */ -BOOL LLFloaterEditExtDayCycle::handleKeyUp(KEY key, MASK mask, BOOL called_from_parent) +bool LLFloaterEditExtDayCycle::handleKeyUp(KEY key, MASK mask, bool called_from_parent) { if (!mEditDay) { @@ -890,7 +890,7 @@ void LLFloaterEditExtDayCycle::onFrameSliderCallback(const LLSD &data) keymap_t::iterator it = mSliderKeyMap.find(curslider); if (it != mSliderKeyMap.end()) { - if (gKeyboard->currentMask(TRUE) == MASK_SHIFT && mShiftCopyEnabled && mCanMod) + if (gKeyboard->currentMask(true) == MASK_SHIFT && mShiftCopyEnabled && mCanMod) { // don't move the point/frame as long as shift is pressed and user is attempting to copy // handleKeyUp will do the move if user releases key too early. @@ -961,7 +961,7 @@ void LLFloaterEditExtDayCycle::onFrameSliderMouseDown(S32 x, S32 y, MASK mask) std::string slidername = mFramesSlider->getCurSlider(); - mShiftCopyEnabled = !slidername.empty() && gKeyboard->currentMask(TRUE) == MASK_SHIFT; + mShiftCopyEnabled = !slidername.empty() && gKeyboard->currentMask(true) == MASK_SHIFT; if (!slidername.empty()) { @@ -1195,7 +1195,7 @@ void LLFloaterEditExtDayCycle::updateButtons() } else { - for (S32 track = 1; track < LLSettingsDay::TRACK_MAX; ++track) + for (U32 track = 1; track < LLSettingsDay::TRACK_MAX; ++track) { if (track == mCurrentTrack) continue; @@ -1213,14 +1213,14 @@ void LLFloaterEditExtDayCycle::updateButtons() mDeleteFrameButton->setEnabled(can_manipulate && isRemovingFrameAllowed()); mLoadFrame->setEnabled(can_manipulate); - BOOL enable_play = mEditDay ? TRUE : FALSE; + bool enable_play = (bool)mEditDay; childSetEnabled(BTN_PLAY, enable_play); childSetEnabled(BTN_SKIP_BACK, enable_play); childSetEnabled(BTN_SKIP_FORWARD, enable_play); // update track buttons bool extended_env = LLEnvironment::instance().isExtendedEnvironmentEnabled(); - for (S32 track = 0; track < LLSettingsDay::TRACK_MAX; ++track) + for (U32 track = 0; track < LLSettingsDay::TRACK_MAX; ++track) { LLButton* button = getChild<LLButton>(track_tabs[track], true); button->setEnabled(extended_env); @@ -1562,8 +1562,8 @@ void LLFloaterEditExtDayCycle::startPlay() gIdleCallbacks.addFunction(onIdlePlay, this); mPlayStartFrame = mTimeSlider->getCurSliderValue(); - getChild<LLView>("play_layout", true)->setVisible(FALSE); - getChild<LLView>("pause_layout", true)->setVisible(TRUE); + getChild<LLView>("play_layout", true)->setVisible(false); + getChild<LLView>("pause_layout", true)->setVisible(true); } void LLFloaterEditExtDayCycle::stopPlay() @@ -1577,8 +1577,8 @@ void LLFloaterEditExtDayCycle::stopPlay() F32 frame = mTimeSlider->getCurSliderValue(); selectFrame(frame, LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR); - getChild<LLView>("play_layout", true)->setVisible(TRUE); - getChild<LLView>("pause_layout", true)->setVisible(FALSE); + getChild<LLView>("play_layout", true)->setVisible(true); + getChild<LLView>("pause_layout", true)->setVisible(false); } //static @@ -1698,7 +1698,7 @@ void LLFloaterEditExtDayCycle::doOpenInventoryFloater(LLSettingsType::type_e typ picker->setTrackMode(LLFloaterSettingsPicker::TRACK_NONE); } picker->openFloater(); - picker->setFocus(TRUE); + picker->setFocus(true); } void LLFloaterEditExtDayCycle::onPickerCommitSetting(LLUUID item_id, S32 track) diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h index 0f32a1b5e2..655915b6e8 100644 --- a/indra/newview/llfloatereditextdaycycle.h +++ b/indra/newview/llfloatereditextdaycycle.h @@ -79,12 +79,12 @@ public: LLFloaterEditExtDayCycle(const LLSD &key); virtual ~LLFloaterEditExtDayCycle(); - virtual BOOL postBuild() override; + virtual bool postBuild() override; virtual void onOpen(const LLSD& key) override; virtual void onClose(bool app_quitting) override; //virtual void onFocusReceived() override; //virtual void onFocusLost() override; - virtual void onVisibilityChange(BOOL new_visibility) override; + virtual void onVisibilityChange(bool new_visibility) override; connection_t setEditCommitSignal(edit_commit_signal_t::slot_type cb); @@ -100,7 +100,7 @@ public: virtual LLSettingsBase::ptr_t getEditSettings() const override { return mEditDay; } - BOOL handleKeyUp(KEY key, MASK mask, BOOL called_from_parent) override; + bool handleKeyUp(KEY key, MASK mask, bool called_from_parent) override; protected: virtual void setEditSettingsAndUpdate(const LLSettingsBase::ptr_t &settings) override; diff --git a/indra/newview/llfloatereditsky.cpp b/indra/newview/llfloatereditsky.cpp deleted file mode 100644 index 58e58cfc5d..0000000000 --- a/indra/newview/llfloatereditsky.cpp +++ /dev/null @@ -1,699 +0,0 @@ -/** - * @file llfloatereditsky.cpp - * @brief Floater to create or edit a sky preset - * - * $LicenseInfo:firstyear=2011&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, 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 "llviewerprecompiledheaders.h" - -#include "llfloatereditsky.h" - -#include <boost/make_shared.hpp> - -// libs -#include "llbutton.h" -#include "llcheckboxctrl.h" -#include "llcombobox.h" -#include "llmultisliderctrl.h" -#include "llnotifications.h" -#include "llnotificationsutil.h" -#include "llsliderctrl.h" -#include "lltabcontainer.h" -#include "lltimectrl.h" -#include "lljoystickbutton.h" - -// newview -#include "llagent.h" -#include "llcolorswatch.h" -#include "llregioninfomodel.h" -#include "llviewerregion.h" - -#include "v3colorutil.h" -#include "llenvironment.h" -#include "llenvadapters.h" - -namespace -{ - const F32 WL_SUN_AMBIENT_SLIDER_SCALE(3.0f); - const F32 WL_BLUE_HORIZON_DENSITY_SCALE(2.0f); - const F32 WL_CLOUD_SLIDER_SCALE(1.0f); -} - - -static F32 time24_to_sun_pos(F32 time24) -{ - F32 sun_pos = fmodf((time24 - 6) / 24.0f, 1.0f); - if (sun_pos < 0) ++sun_pos; - return sun_pos; -} - -LLFloaterEditSky::LLFloaterEditSky(const LLSD &key): - LLFloater(key), - mSkyPresetNameEditor(NULL), - mSkyPresetCombo(NULL), - mMakeDefaultCheckBox(NULL), - mSaveButton(NULL), - mSkyAdapter() -{ -} - -// virtual -BOOL LLFloaterEditSky::postBuild() -{ - mSkyPresetNameEditor = getChild<LLLineEditor>("sky_preset_name"); - mSkyPresetCombo = getChild<LLComboBox>("sky_preset_combo"); - mMakeDefaultCheckBox = getChild<LLCheckBoxCtrl>("make_default_cb"); - mSaveButton = getChild<LLButton>("save"); - mSkyAdapter = std::make_shared<LLSkySettingsAdapter>(); - - LLEnvironment::instance().setSkyListChange(boost::bind(&LLFloaterEditSky::onSkyPresetListChange, this)); - - initCallbacks(); - -// // Create the sun position scrubber on the slider. -// getChild<LLMultiSliderCtrl>("WLSunPos")->addSlider(12.f); - - return TRUE; -} - -// virtual -void LLFloaterEditSky::onOpen(const LLSD& key) -{ - bool new_preset = isNewPreset(); - std::string param = key.asString(); - std::string floater_title = getString(std::string("title_") + param); - std::string hint = getString(std::string("hint_" + param)); - - // Update floater title. - setTitle(floater_title); - - // Update the hint at the top. - getChild<LLUICtrl>("hint")->setValue(hint); - - // Hide the hint to the right of the combo if we're invoked to create a new preset. - getChildView("note")->setVisible(!new_preset); - - // Switch between the sky presets combobox and preset name input field. - mSkyPresetCombo->setVisible(!new_preset); - mSkyPresetNameEditor->setVisible(new_preset); - - reset(); -} - -// virtual -void LLFloaterEditSky::onClose(bool app_quitting) -{ - if (!app_quitting) // there's no point to change environment if we're quitting - { - LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_EDIT); - LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); - } -} - -// virtual -void LLFloaterEditSky::draw() -{ - syncControls(); - LLFloater::draw(); -} - -void LLFloaterEditSky::initCallbacks(void) -{ - // *TODO: warn user if a region environment update comes while we're editing a region sky preset. - - mSkyPresetNameEditor->setKeystrokeCallback(boost::bind(&LLFloaterEditSky::onSkyPresetNameEdited, this), NULL); - mSkyPresetCombo->setCommitCallback(boost::bind(&LLFloaterEditSky::onSkyPresetSelected, this)); - mSkyPresetCombo->setTextEntryCallback(boost::bind(&LLFloaterEditSky::onSkyPresetNameEdited, this)); - - mSaveButton->setCommitCallback(boost::bind(&LLFloaterEditSky::onBtnSave, this)); - getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterEditSky::onBtnCancel, this)); - - // Connect to region info updates. - LLRegionInfoModel::instance().setUpdateCallback(boost::bind(&LLFloaterEditSky::onRegionInfoUpdate, this)); - - // sunlight - getChild<LLUICtrl>("WLSunlight")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &mSkyAdapter->mSunlight)); - - // glow - getChild<LLUICtrl>("WLGlowR")->setCommitCallback(boost::bind(&LLFloaterEditSky::onGlowRMoved, this, _1, &mSkyAdapter->mGlow)); - getChild<LLUICtrl>("WLGlowB")->setCommitCallback(boost::bind(&LLFloaterEditSky::onGlowBMoved, this, _1, &mSkyAdapter->mGlow)); - - // time of day -// getChild<LLUICtrl>("WLSunPos")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunMoved, this, _1, &mSkyAdapter->mLightnorm)); // multi-slider -// getChild<LLTimeCtrl>("WLDayTime")->setCommitCallback(boost::bind(&LLFloaterEditSky::onTimeChanged, this)); // time ctrl -// getChild<LLUICtrl>("WLEastAngle")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunMoved, this, _1, &mSkyAdapter->mLightnorm)); - getChild<LLJoystickQuaternion>("WLSunRotation")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunRotationChanged, this)); - getChild<LLJoystickQuaternion>("WLMoonRotation")->setCommitCallback(boost::bind(&LLFloaterEditSky::onMoonRotationChanged, this)); - - // Clouds - - // Cloud Color - getChild<LLUICtrl>("WLCloudColor")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &mSkyAdapter->mCloudColor)); - - // Cloud - getChild<LLUICtrl>("WLCloudX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlRMoved, this, _1, &mSkyAdapter->mCloudMain)); - getChild<LLUICtrl>("WLCloudY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlGMoved, this, _1, &mSkyAdapter->mCloudMain)); - getChild<LLUICtrl>("WLCloudDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlBMoved, this, _1, &mSkyAdapter->mCloudMain)); - - // Cloud Detail - getChild<LLUICtrl>("WLCloudDetailX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlRMoved, this, _1, &mSkyAdapter->mCloudDetail)); - getChild<LLUICtrl>("WLCloudDetailY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlGMoved, this, _1, &mSkyAdapter->mCloudDetail)); - getChild<LLUICtrl>("WLCloudDetailDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlBMoved, this, _1, &mSkyAdapter->mCloudDetail)); - - // Cloud extras - getChild<LLUICtrl>("WLCloudCoverage")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mCloudCoverage)); - getChild<LLUICtrl>("WLCloudScale")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mCloudScale)); - getChild<LLUICtrl>("WLCloudScrollX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onCloudScrollXMoved, this, _1)); - getChild<LLUICtrl>("WLCloudScrollY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onCloudScrollYMoved, this, _1)); - - - // Dome - getChild<LLUICtrl>("WLGamma")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mWLGamma)); - getChild<LLUICtrl>("WLStarAlpha")->setCommitCallback(boost::bind(&LLFloaterEditSky::onStarAlphaMoved, this, _1)); -} - -//================================================================================================= - -void LLFloaterEditSky::syncControls() -{ - LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); - mEditSettings = psky; - - std::string name = psky->getName(); - - mSkyPresetNameEditor->setText(name); - mSkyPresetCombo->setValue(name); - - // Lighting - - // sunlight - mSkyAdapter->mSunlight.setColor3( psky->getSunlightColor() ); - setColorSwatch("WLSunlight", mSkyAdapter->mSunlight, WL_SUN_AMBIENT_SLIDER_SCALE); - - // glow - mSkyAdapter->mGlow.setColor3( psky->getGlow() ); - childSetValue("WLGlowR", 2 - mSkyAdapter->mGlow.getRed() / 20.0f); - childSetValue("WLGlowB", -mSkyAdapter->mGlow.getBlue() / 5.0f); - -// LLSettingsSky::azimalt_t azal = psky->getSunRotationAzAl(); -// -// F32 time24 = sun_pos_to_time24(azal.second / F_TWO_PI); -// getChild<LLMultiSliderCtrl>("WLSunPos")->setCurSliderValue(time24, TRUE); -// getChild<LLTimeCtrl>("WLDayTime")->setTime24(time24); -// childSetValue("WLEastAngle", azal.first / F_TWO_PI); - getChild<LLJoystickQuaternion>("WLSunRotation")->setRotation(psky->getSunRotation()); - getChild<LLJoystickQuaternion>("WLMoonRotation")->setRotation(psky->getMoonRotation()); - - // Clouds - - // Cloud Color - mSkyAdapter->mCloudColor.setColor3( psky->getCloudColor() ); - setColorSwatch("WLCloudColor", mSkyAdapter->mCloudColor, WL_CLOUD_SLIDER_SCALE); - - // Cloud - mSkyAdapter->mCloudMain.setColor3( psky->getCloudPosDensity1() ); - childSetValue("WLCloudX", mSkyAdapter->mCloudMain.getRed()); - childSetValue("WLCloudY", mSkyAdapter->mCloudMain.getGreen()); - childSetValue("WLCloudDensity", mSkyAdapter->mCloudMain.getBlue()); - - // Cloud Detail - mSkyAdapter->mCloudDetail.setColor3( psky->getCloudPosDensity2() ); - childSetValue("WLCloudDetailX", mSkyAdapter->mCloudDetail.getRed()); - childSetValue("WLCloudDetailY", mSkyAdapter->mCloudDetail.getGreen()); - childSetValue("WLCloudDetailDensity", mSkyAdapter->mCloudDetail.getBlue()); - - // Cloud extras - mSkyAdapter->mCloudCoverage = psky->getCloudShadow(); - mSkyAdapter->mCloudScale = psky->getCloudScale(); - childSetValue("WLCloudCoverage", (F32) mSkyAdapter->mCloudCoverage); - childSetValue("WLCloudScale", (F32) mSkyAdapter->mCloudScale); - - // cloud scrolling - LLVector2 scroll_rate = psky->getCloudScrollRate(); - - // LAPRAS: These should go away... - childDisable("WLCloudLockX"); - childDisable("WLCloudLockY"); - - // disable if locked, enable if not - childEnable("WLCloudScrollX"); - childEnable("WLCloudScrollY"); - - // *HACK cloud scrolling is off my an additive of 10 - childSetValue("WLCloudScrollX", scroll_rate[0] - 10.0f); - childSetValue("WLCloudScrollY", scroll_rate[1] - 10.0f); - - // Tweak extras - - mSkyAdapter->mWLGamma = psky->getGamma(); - childSetValue("WLGamma", (F32) mSkyAdapter->mWLGamma); - - childSetValue("WLStarAlpha", psky->getStarBrightness()); -} - -void LLFloaterEditSky::setColorSwatch(const std::string& name, const WLColorControl& from_ctrl, F32 k) -{ - // Set the value, dividing it by <k> first. - LLColor4 color = from_ctrl.getColor4(); - getChild<LLColorSwatchCtrl>(name)->set(color / k); -} - -// color control callbacks -void LLFloaterEditSky::onColorControlMoved(LLUICtrl* ctrl, WLColorControl* color_ctrl) -{ - LLColorSwatchCtrl* swatch = static_cast<LLColorSwatchCtrl*>(ctrl); - LLColor4 color_vec(swatch->get().mV); - - // Multiply RGB values by the appropriate factor. - F32 k = WL_CLOUD_SLIDER_SCALE; - if (color_ctrl->getIsSunOrAmbientColor()) - { - k = WL_SUN_AMBIENT_SLIDER_SCALE; - } - else if (color_ctrl->getIsBlueHorizonOrDensity()) - { - k = WL_BLUE_HORIZON_DENSITY_SCALE; - } - - color_vec *= k; // intensity isn't affected by the multiplication - - // Set intensity to maximum of the RGB values. - color_vec.mV[3] = color_max(color_vec); - - // Apply the new RGBI value. - color_ctrl->setColor4(color_vec); - color_ctrl->update(mEditSettings); -} - -void LLFloaterEditSky::onColorControlRMoved(LLUICtrl* ctrl, void* userdata) -{ - LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl); - WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata); - - F32 red_value = sldr_ctrl->getValueF32(); - F32 k = 1.0f; - - if (color_ctrl->getIsSunOrAmbientColor()) - { - k = WL_SUN_AMBIENT_SLIDER_SCALE; - } - if (color_ctrl->getIsBlueHorizonOrDensity()) - { - k = WL_BLUE_HORIZON_DENSITY_SCALE; - } - color_ctrl->setRed(red_value * k); - - adjustIntensity(color_ctrl, red_value, k); - color_ctrl->update(mEditSettings); -} - -void LLFloaterEditSky::onColorControlGMoved(LLUICtrl* ctrl, void* userdata) -{ - LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl); - WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata); - - F32 green_value = sldr_ctrl->getValueF32(); - F32 k = 1.0f; - - if (color_ctrl->getIsSunOrAmbientColor()) - { - k = WL_SUN_AMBIENT_SLIDER_SCALE; - } - if (color_ctrl->getIsBlueHorizonOrDensity()) - { - k = WL_BLUE_HORIZON_DENSITY_SCALE; - } - color_ctrl->setGreen(green_value * k); - - adjustIntensity(color_ctrl, green_value, k); - color_ctrl->update(mEditSettings); -} - -void LLFloaterEditSky::onColorControlBMoved(LLUICtrl* ctrl, void* userdata) -{ - LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl); - WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata); - - F32 blue_value = sldr_ctrl->getValueF32(); - F32 k = 1.0f; - - if (color_ctrl->getIsSunOrAmbientColor()) - { - k = WL_SUN_AMBIENT_SLIDER_SCALE; - } - if (color_ctrl->getIsBlueHorizonOrDensity()) - { - k = WL_BLUE_HORIZON_DENSITY_SCALE; - } - color_ctrl->setBlue(blue_value * k); - - adjustIntensity(color_ctrl, blue_value, k); - color_ctrl->update(mEditSettings); -} - -void LLFloaterEditSky::adjustIntensity(WLColorControl *ctrl, F32 val, F32 scale) -{ - if (ctrl->getHasSliderName()) - { - LLColor4 color = ctrl->getColor4(); - F32 i = color_max(color) / scale; - ctrl->setIntensity(i); - std::string name = ctrl->getSliderName(); - name.append("I"); - - childSetValue(name, i); - } -} - - -/// GLOW SPECIFIC CODE -void LLFloaterEditSky::onGlowRMoved(LLUICtrl* ctrl, void* userdata) -{ - - LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl); - WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata); - - // scaled by 20 - color_ctrl->setRed((2 - sldr_ctrl->getValueF32()) * 20); - - color_ctrl->update(mEditSettings); -} - -/// \NOTE that we want NEGATIVE (-) B -void LLFloaterEditSky::onGlowBMoved(LLUICtrl* ctrl, void* userdata) -{ - LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl); - WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata); - - /// \NOTE that we want NEGATIVE (-) B and NOT by 20 as 20 is too big - color_ctrl->setBlue(-sldr_ctrl->getValueF32() * 5); - - color_ctrl->update(mEditSettings); -} - -void LLFloaterEditSky::onFloatControlMoved(LLUICtrl* ctrl, void* userdata) -{ - LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl); - WLFloatControl * floatControl = static_cast<WLFloatControl *>(userdata); - - floatControl->setValue(sldr_ctrl->getValueF32() / floatControl->getMult()); - - floatControl->update(mEditSettings); -} - - -// Lighting callbacks - -// time of day -void LLFloaterEditSky::onSunMoved(LLUICtrl* ctrl, void* userdata) -{ - LLMultiSliderCtrl* sun_msldr = getChild<LLMultiSliderCtrl>("WLSunPos"); - LLSliderCtrl* east_sldr = getChild<LLSliderCtrl>("WLEastAngle"); - LLTimeCtrl* time_ctrl = getChild<LLTimeCtrl>("WLDayTime"); - WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata); - - F32 time24 = sun_msldr->getCurSliderValue(); - time_ctrl->setTime24(time24); // sync the time ctrl with the new sun position - - // get the two angles - F32 azimuth = F_TWO_PI * east_sldr->getValueF32(); - F32 altitude = F_TWO_PI * time24_to_sun_pos(time24); - mEditSettings->setSunRotation(azimuth, altitude); - mEditSettings->setMoonRotation(azimuth + F_PI, -altitude); - - LLVector4 sunnorm( mEditSettings->getSunDirection(), 1.f ); - - color_ctrl->update(mEditSettings); -} - -void LLFloaterEditSky::onTimeChanged() -{ - F32 time24 = getChild<LLTimeCtrl>("WLDayTime")->getTime24(); - getChild<LLMultiSliderCtrl>("WLSunPos")->setCurSliderValue(time24, TRUE); - onSunMoved(getChild<LLUICtrl>("WLSunPos"), &(mSkyAdapter->mLightnorm)); -} - -void LLFloaterEditSky::onSunRotationChanged() -{ - LLJoystickQuaternion* sun_spinner = getChild<LLJoystickQuaternion>("WLSunRotation"); - LLQuaternion sunrot(sun_spinner->getRotation()); - - mEditSettings->setSunRotation(sunrot); -} - -void LLFloaterEditSky::onMoonRotationChanged() -{ - LLJoystickQuaternion* moon_spinner = getChild<LLJoystickQuaternion>("WLMoonRotation"); - LLQuaternion moonrot(moon_spinner->getRotation()); - - mEditSettings->setMoonRotation(moonrot); -} - -void LLFloaterEditSky::onStarAlphaMoved(LLUICtrl* ctrl) -{ - LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl); - - mEditSettings->setStarBrightness(sldr_ctrl->getValueF32()); -} - -// Clouds -void LLFloaterEditSky::onCloudScrollXMoved(LLUICtrl* ctrl) -{ - LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl); - // *HACK all cloud scrolling is off by an additive of 10. - mEditSettings->setCloudScrollRateX(sldr_ctrl->getValueF32() + 10.0f); -} - -void LLFloaterEditSky::onCloudScrollYMoved(LLUICtrl* ctrl) -{ - LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl); - - // *HACK all cloud scrolling is off by an additive of 10. - mEditSettings->setCloudScrollRateY(sldr_ctrl->getValueF32() + 10.0f); -} - -//================================================================================================= - -void LLFloaterEditSky::reset() -{ - if (isNewPreset()) - { - mSkyPresetNameEditor->setValue(LLSD()); - mSaveButton->setEnabled(FALSE); // will be enabled as soon as users enters a name - } - else - { - refreshSkyPresetsList(); - - // Disable controls until a sky preset to edit is selected. - enableEditing(false); - } -} - -bool LLFloaterEditSky::isNewPreset() const -{ - return mKey.asString() == "new"; -} - -void LLFloaterEditSky::refreshSkyPresetsList() -{ - mSkyPresetCombo->removeall(); - - LLEnvironment::list_name_id_t list = LLEnvironment::instance().getSkyList(); - - for (LLEnvironment::list_name_id_t::iterator it = list.begin(); it != list.end(); ++it) - { - mSkyPresetCombo->add((*it).first, llsd::array((*it).first, (*it).second)); - } - - mSkyPresetCombo->setLabel(getString("combo_label")); -} - -void LLFloaterEditSky::enableEditing(bool enable) -{ - // Enable/disable the tab and their contents. - LLTabContainer* tab_container = getChild<LLTabContainer>("WindLight Tabs"); - tab_container->setEnabled(enable); - for (S32 i = 0; i < tab_container->getTabCount(); ++i) - { - tab_container->enableTabButton(i, enable); - tab_container->getPanelByIndex(i)->setCtrlsEnabled(enable); - } - - // Enable/disable saving. - mSaveButton->setEnabled(enable); - mMakeDefaultCheckBox->setEnabled(enable); -} - -void LLFloaterEditSky::saveRegionSky() -{ -#if 0 - LLWLParamKey key(getSelectedSkyPreset()); - llassert(key.scope == LLEnvKey::SCOPE_REGION); - - LL_DEBUGS("Windlight") << "Saving region sky preset: " << key.name << LL_ENDL; - LLWLParamManager& wl_mgr = LLWLParamManager::instance(); - wl_mgr.mCurParams.mName = key.name; - wl_mgr.setParamSet(key, wl_mgr.mCurParams); - - // *TODO: save to cached region settings. - LL_WARNS("Windlight") << "Saving region sky is not fully implemented yet" << LL_ENDL; -#endif -} - -std::string LLFloaterEditSky::getSelectedPresetName() const -{ - std::string name; - if (mSkyPresetNameEditor->getVisible()) - { - name = mSkyPresetNameEditor->getText(); - } - else - { - LLSD combo_val = mSkyPresetCombo->getValue(); - name = combo_val[0].asString(); - } - - return name; -} - -void LLFloaterEditSky::onSkyPresetNameEdited() -{ - std::string name = mSkyPresetNameEditor->getText(); - LLSettingsWater::ptr_t psky = LLEnvironment::instance().getCurrentWater(); - - psky->setName(name); -} - -void LLFloaterEditSky::onSkyPresetSelected() -{ - std::string name; - - name = getSelectedPresetName(); - - LLSettingsSky::ptr_t psky = LLEnvironment::instance().findSkyByName(name); - - if (!psky) - { - LL_WARNS("WATEREDIT") << "Could not find water preset" << LL_ENDL; - enableEditing(false); - return; - } - - psky = psky->buildClone(); - LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, psky); - mEditSettings = psky; - - syncControls(); - enableEditing(true); - -} - -bool LLFloaterEditSky::onSaveAnswer(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - - // If they choose save, do it. Otherwise, don't do anything - if (option == 0) - { - onSaveConfirmed(); - } - - return false; -} - -void LLFloaterEditSky::onSaveConfirmed() -{ - // Save currently displayed water params to the selected preset. - std::string name = mEditSettings->getName(); - - LL_DEBUGS("Windlight") << "Saving sky preset " << name << LL_ENDL; - - LLEnvironment::instance().addSky(mEditSettings); - - // Change preference if requested. - if (mMakeDefaultCheckBox->getEnabled() && mMakeDefaultCheckBox->getValue()) - { - LL_DEBUGS("Windlight") << name << " is now the new preferred sky preset" << LL_ENDL; - LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, mEditSettings); - } - - closeFloater(); -} - -void LLFloaterEditSky::onBtnSave() -{ - LLEnvironment::instance().addSky(mEditSettings); - LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, mEditSettings); - - closeFloater(); -} - -void LLFloaterEditSky::onBtnCancel() -{ - closeFloater(); -} - -void LLFloaterEditSky::onSkyPresetListChange() -{ - refreshSkyPresetsList(); -} - -void LLFloaterEditSky::onRegionSettingsChange() -{ -#if 0 - // If creating a new sky, don't bother. - if (isNewPreset()) - { - return; - } - - if (getSelectedSkyPreset().scope == LLEnvKey::SCOPE_REGION) // if editing a region sky - { - // reset the floater to its initial state - reset(); - - // *TODO: Notify user? - } - else // editing a local sky - { - refreshSkyPresetsList(); - } -#endif -} - -void LLFloaterEditSky::onRegionInfoUpdate() -{ -#if 0 - bool can_edit = true; - - // If we've selected a region sky preset for editing. - if (getSelectedSkyPreset().scope == LLEnvKey::SCOPE_REGION) - { - // check whether we have the access - can_edit = LLEnvManagerNew::canEditRegionSettings(); - } - - enableEditing(can_edit); -#endif -} diff --git a/indra/newview/llfloatereditwater.cpp b/indra/newview/llfloatereditwater.cpp deleted file mode 100644 index 9333967b8e..0000000000 --- a/indra/newview/llfloatereditwater.cpp +++ /dev/null @@ -1,526 +0,0 @@ -/** - * @file llfloatereditwater.cpp - * @brief Floater to create or edit a water preset - * - * $LicenseInfo:firstyear=2011&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, 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 "llviewerprecompiledheaders.h" - -#include "llfloatereditwater.h" - -#include <boost/make_shared.hpp> - -// libs -#include "llbutton.h" -#include "llcheckboxctrl.h" -#include "llcolorswatch.h" -#include "llcombobox.h" -//#include "llnotifications.h" -#include "llnotificationsutil.h" -#include "llsliderctrl.h" -#include "lltexturectrl.h" - -// newview -#include "llagent.h" -#include "llregioninfomodel.h" -#include "llviewerregion.h" - -#include "llenvironment.h" -#include "llsettingswater.h" -#include "llenvadapters.h" - -#include "v3colorutil.h" - -#undef max // Fixes a Windows compiler error - -LLFloaterEditWater::LLFloaterEditWater(const LLSD &key): - LLFloater(key), - mWaterPresetNameEditor(NULL), - mWaterPresetCombo(NULL), - mMakeDefaultCheckBox(NULL), - mSaveButton(NULL), - mWaterAdapter() -{ -} - -// virtual -BOOL LLFloaterEditWater::postBuild() -{ - mWaterPresetNameEditor = getChild<LLLineEditor>("water_preset_name"); - mWaterPresetCombo = getChild<LLComboBox>("water_preset_combo"); - mMakeDefaultCheckBox = getChild<LLCheckBoxCtrl>("make_default_cb"); - mSaveButton = getChild<LLButton>("save"); - - mWaterAdapter = std::make_shared<LLWatterSettingsAdapter>(); - - LLEnvironment::instance().setWaterListChange(boost::bind(&LLFloaterEditWater::onWaterPresetListChange, this)); - - initCallbacks(); - refreshWaterPresetsList(); - syncControls(); - - return TRUE; -} - -// virtual -void LLFloaterEditWater::onOpen(const LLSD& key) -{ - bool new_preset = isNewPreset(); - std::string param = key.asString(); - std::string floater_title = getString(std::string("title_") + param); - std::string hint = getString(std::string("hint_" + param)); - - // Update floater title. - setTitle(floater_title); - - // Update the hint at the top. - getChild<LLUICtrl>("hint")->setValue(hint); - - // Hide the hint to the right of the combo if we're invoked to create a new preset. - getChildView("note")->setVisible(!new_preset); - - // Switch between the water presets combobox and preset name input field. - mWaterPresetCombo->setVisible(!new_preset); - mWaterPresetNameEditor->setVisible(new_preset); - - reset(); -} - -// virtual -void LLFloaterEditWater::onClose(bool app_quitting) -{ - if (!app_quitting) // there's no point to change environment if we're quitting - { - LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_EDIT); - LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); - } -} - -// virtual -void LLFloaterEditWater::draw() -{ - syncControls(); - LLFloater::draw(); -} - -void LLFloaterEditWater::initCallbacks(void) -{ - mWaterPresetNameEditor->setKeystrokeCallback(boost::bind(&LLFloaterEditWater::onWaterPresetNameEdited, this), NULL); - mWaterPresetCombo->setCommitCallback(boost::bind(&LLFloaterEditWater::onWaterPresetSelected, this)); - mWaterPresetCombo->setTextEntryCallback(boost::bind(&LLFloaterEditWater::onWaterPresetNameEdited, this)); - - mSaveButton->setCommitCallback(boost::bind(&LLFloaterEditWater::onBtnSave, this)); - getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterEditWater::onBtnCancel, this)); - - // Connect to region info updates. - LLRegionInfoModel::instance().setUpdateCallback(boost::bind(&LLFloaterEditWater::onRegionInfoUpdate, this)); - - //------------------------------------------------------------------------- - - getChild<LLUICtrl>("WaterFogColor")->setCommitCallback(boost::bind(&LLFloaterEditWater::onColorControlMoved, this, _1, &mWaterAdapter->mFogColor)); - - // fog density - getChild<LLUICtrl>("WaterFogDensity")->setCommitCallback(boost::bind(&LLFloaterEditWater::onExpFloatControlMoved, this, _1, &mWaterAdapter->mFogDensity)); - getChild<LLUICtrl>("WaterUnderWaterFogMod")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mUnderWaterFogMod)); - - // blue density - getChild<LLUICtrl>("WaterNormalScaleX")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector3ControlXMoved, this, _1, &mWaterAdapter->mNormalScale)); - getChild<LLUICtrl>("WaterNormalScaleY")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector3ControlYMoved, this, _1, &mWaterAdapter->mNormalScale)); - getChild<LLUICtrl>("WaterNormalScaleZ")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector3ControlZMoved, this, _1, &mWaterAdapter->mNormalScale)); - - // fresnel - getChild<LLUICtrl>("WaterFresnelScale")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mFresnelScale)); - getChild<LLUICtrl>("WaterFresnelOffset")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mFresnelOffset)); - - // scale above/below - getChild<LLUICtrl>("WaterScaleAbove")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mScaleAbove)); - getChild<LLUICtrl>("WaterScaleBelow")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mScaleBelow)); - - // blur mult - getChild<LLUICtrl>("WaterBlurMult")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mBlurMultiplier)); - - // wave direction - getChild<LLUICtrl>("WaterWave1DirX")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector2ControlXMoved, this, _1, &mWaterAdapter->mWave1Dir)); - getChild<LLUICtrl>("WaterWave1DirY")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector2ControlYMoved, this, _1, &mWaterAdapter->mWave1Dir)); - getChild<LLUICtrl>("WaterWave2DirX")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector2ControlXMoved, this, _1, &mWaterAdapter->mWave2Dir)); - getChild<LLUICtrl>("WaterWave2DirY")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector2ControlYMoved, this, _1, &mWaterAdapter->mWave2Dir)); - - LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("WaterNormalMap"); - texture_ctrl->setDefaultImageAssetID(DEFAULT_WATER_NORMAL); - texture_ctrl->setCommitCallback(boost::bind(&LLFloaterEditWater::onNormalMapPicked, this, _1)); -} - -//============================================================================= - -void LLFloaterEditWater::syncControls() -{ - // *TODO: Eliminate slow getChild() calls. - - LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater(); - mEditSettings = pwater; - - std::string name = pwater->getName(); - mWaterPresetNameEditor->setText(name); - mWaterPresetCombo->setValue(name); - - //getChild<LLUICtrl>("WaterGlow")->setValue(col.mV[3]); - getChild<LLColorSwatchCtrl>("WaterFogColor")->set(LLColor4(pwater->getWaterFogColor())); - - // fog and wavelets - mWaterAdapter->mFogDensity = pwater->getWaterFogDensity(); - getChild<LLUICtrl>("WaterFogDensity")->setValue(mWaterAdapter->mFogDensity.getExp()); - - mWaterAdapter->mUnderWaterFogMod = pwater->getFogMod(); - getChild<LLUICtrl>("WaterUnderWaterFogMod")->setValue(static_cast<F32>(mWaterAdapter->mUnderWaterFogMod)); - - mWaterAdapter->mNormalScale = pwater->getNormalScale(); - getChild<LLUICtrl>("WaterNormalScaleX")->setValue(mWaterAdapter->mNormalScale.getX()); - getChild<LLUICtrl>("WaterNormalScaleY")->setValue(mWaterAdapter->mNormalScale.getY()); - getChild<LLUICtrl>("WaterNormalScaleZ")->setValue(mWaterAdapter->mNormalScale.getZ()); - - // Fresnel - mWaterAdapter->mFresnelScale = pwater->getFresnelScale(); - getChild<LLUICtrl>("WaterFresnelScale")->setValue(static_cast<F32>(mWaterAdapter->mFresnelScale)); - mWaterAdapter->mFresnelOffset = pwater->getFresnelOffset(); - getChild<LLUICtrl>("WaterFresnelOffset")->setValue(static_cast<F32>(mWaterAdapter->mFresnelOffset)); - - // Scale Above/Below - mWaterAdapter->mScaleAbove = pwater->getScaleAbove(); - getChild<LLUICtrl>("WaterScaleAbove")->setValue(static_cast<F32>(mWaterAdapter->mScaleAbove)); - mWaterAdapter->mScaleBelow = pwater->getScaleBelow(); - getChild<LLUICtrl>("WaterScaleBelow")->setValue(static_cast<F32>(mWaterAdapter->mScaleBelow)); - - // blur mult - mWaterAdapter->mBlurMultiplier = pwater->getBlurMultiplier(); - getChild<LLUICtrl>("WaterBlurMult")->setValue(static_cast<F32>(mWaterAdapter->mBlurMultiplier)); - - // wave directions - mWaterAdapter->mWave1Dir = pwater->getWave1Dir(); - getChild<LLUICtrl>("WaterWave1DirX")->setValue(mWaterAdapter->mWave1Dir.getU()); - getChild<LLUICtrl>("WaterWave1DirY")->setValue(mWaterAdapter->mWave1Dir.getV()); - - mWaterAdapter->mWave2Dir = pwater->getWave2Dir(); - getChild<LLUICtrl>("WaterWave2DirX")->setValue(mWaterAdapter->mWave2Dir.getU()); - getChild<LLUICtrl>("WaterWave2DirY")->setValue(mWaterAdapter->mWave2Dir.getV()); - - LLTextureCtrl* textCtrl = getChild<LLTextureCtrl>("WaterNormalMap"); - textCtrl->setImageAssetID(pwater->getNormalMapID()); -} - - -// vector control callbacks -void LLFloaterEditWater::onVector3ControlXMoved(LLUICtrl* ctrl, WLVect3Control* vector_ctrl) -{ - LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl); - - vector_ctrl->setX( sldr_ctrl->getValueF32() ); - vector_ctrl->update(mEditSettings); -} - -// vector control callbacks -void LLFloaterEditWater::onVector3ControlYMoved(LLUICtrl* ctrl, WLVect3Control* vector_ctrl) -{ - LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl); - - vector_ctrl->setY(sldr_ctrl->getValueF32()); - vector_ctrl->update(mEditSettings); -} - -// vector control callbacks -void LLFloaterEditWater::onVector3ControlZMoved(LLUICtrl* ctrl, WLVect3Control* vector_ctrl) -{ - LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl); - - vector_ctrl->setZ(sldr_ctrl->getValueF32()); - vector_ctrl->update(mEditSettings); -} - - -// vector control callbacks -void LLFloaterEditWater::onVector2ControlXMoved(LLUICtrl* ctrl, WLVect2Control* vector_ctrl) -{ - LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl); - - vector_ctrl->setU(sldr_ctrl->getValueF32()); - vector_ctrl->update(mEditSettings); -} - -// vector control callbacks -void LLFloaterEditWater::onVector2ControlYMoved(LLUICtrl* ctrl, WLVect2Control* vector_ctrl) -{ - LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl); - - vector_ctrl->setV(sldr_ctrl->getValueF32()); - vector_ctrl->update(mEditSettings); -} - -void LLFloaterEditWater::onFloatControlMoved(LLUICtrl* ctrl, WLFloatControl* floatControl) -{ - LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl); - - floatControl->setValue(sldr_ctrl->getValueF32()); - floatControl->update(mEditSettings); -} - -void LLFloaterEditWater::onExpFloatControlMoved(LLUICtrl* ctrl, WLXFloatControl* expFloatControl) -{ - LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl); - - expFloatControl->setExp(sldr_ctrl->getValueF32()); - expFloatControl->update(mEditSettings); -} - -void LLFloaterEditWater::onColorControlMoved(LLUICtrl* ctrl, WLColorControl* color_ctrl) -{ - LLColorSwatchCtrl* swatch = static_cast<LLColorSwatchCtrl*>(ctrl); - color_ctrl->setColor4( swatch->get() ); - color_ctrl->update(mEditSettings); -} - -void LLFloaterEditWater::onNormalMapPicked(LLUICtrl* ctrl) -{ - LLTextureCtrl* textCtrl = static_cast<LLTextureCtrl*>(ctrl); - LLUUID textID = textCtrl->getImageAssetID(); - mEditSettings->setNormalMapID(textID); -} - -//============================================================================= - -void LLFloaterEditWater::reset() -{ - if (isNewPreset()) - { - mWaterPresetNameEditor->setValue(LLSD()); - mSaveButton->setEnabled(FALSE); // will be enabled as soon as users enters a name - } - else - { - refreshWaterPresetsList(); - - // Disable controls until a water preset to edit is selected. - enableEditing(false); - } -} - -bool LLFloaterEditWater::isNewPreset() const -{ - return mKey.asString() == "new"; -} - -void LLFloaterEditWater::refreshWaterPresetsList() -{ - mWaterPresetCombo->removeall(); - - LLEnvironment::list_name_id_t list = LLEnvironment::instance().getWaterList(); - - for (LLEnvironment::list_name_id_t::iterator it = list.begin(); it != list.end(); ++it) - { - mWaterPresetCombo->add((*it).first, llsd::array((*it).first, (*it).second)); - } - - mWaterPresetCombo->setLabel(getString("combo_label")); -} - -void LLFloaterEditWater::enableEditing(bool enable) -{ - // Enable/disable water controls. - getChild<LLPanel>("panel_water_preset")->setCtrlsEnabled(enable); - - // Enable/disable saving. - mSaveButton->setEnabled(enable); - mMakeDefaultCheckBox->setEnabled(enable); -} - -void LLFloaterEditWater::saveRegionWater() -{ -#if 0 - llassert(getCurrentScope() == LLEnvKey::SCOPE_REGION); // make sure we're editing region water - - LL_DEBUGS("Windlight") << "Saving region water preset" << LL_ENDL; - - //LLWaterParamSet region_water = water_mgr.mCurParams; - - // *TODO: save to cached region settings. - LL_WARNS("Windlight") << "Saving region water is not fully implemented yet" << LL_ENDL; -#endif -} - -#if 0 -std::string LLFloaterEditWater::getCurrentPresetName() const -{ - std::string name; - LLEnvKey::EScope scope; - getSelectedPreset(name, scope); - return name; -} -#endif - -#if 0 -LLEnvKey::EScope LLFloaterEditWater::getCurrentScope() const -{ - std::string name; - LLEnvKey::EScope scope; - getSelectedPreset(name, scope); - return scope; -} -#endif - -std::string LLFloaterEditWater::getSelectedPresetName() const -{ - std::string name; - if (mWaterPresetNameEditor->getVisible()) - { - name = mWaterPresetNameEditor->getText(); - } - else - { - LLSD combo_val = mWaterPresetCombo->getValue(); - name = combo_val[0].asString(); - } - - return name; -} - -void LLFloaterEditWater::onWaterPresetNameEdited() -{ - std::string name = mWaterPresetNameEditor->getText(); - LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater(); - - pwater->setName(name); -#if 0 - // Disable saving a water preset having empty name. - mSaveButton->setEnabled(!getCurrentPresetName().empty()); -#endif -} - -void LLFloaterEditWater::onWaterPresetSelected() -{ - std::string name; - - name = getSelectedPresetName(); - - LLSettingsWater::ptr_t pwater = LLEnvironment::instance().findWaterByName(name); - - if (!pwater) - { - LL_WARNS("WATEREDIT") << "Could not find water preset" << LL_ENDL; - enableEditing(false); - return; - } - - pwater = pwater->buildClone(); - LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, pwater); - mEditSettings = pwater; - - syncControls(); - enableEditing(true); -} - -bool LLFloaterEditWater::onSaveAnswer(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - - // If they choose save, do it. Otherwise, don't do anything - if (option == 0) - { - onSaveConfirmed(); - } - - return false; -} - -void LLFloaterEditWater::onSaveConfirmed() -{ - // Save currently displayed water params to the selected preset. - std::string name = mEditSettings->getName(); - - LL_DEBUGS("Windlight") << "Saving sky preset " << name << LL_ENDL; - - LLEnvironment::instance().addWater(mEditSettings); - - // Change preference if requested. - if (mMakeDefaultCheckBox->getEnabled() && mMakeDefaultCheckBox->getValue()) - { - LL_DEBUGS("Windlight") << name << " is now the new preferred water preset" << LL_ENDL; - LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, mEditSettings); - } - - closeFloater(); -} - -void LLFloaterEditWater::onBtnSave() -{ - LLEnvironment::instance().addWater(mEditSettings); - LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, mEditSettings); - - closeFloater(); -} - -void LLFloaterEditWater::onBtnCancel() -{ - closeFloater(); -} - -void LLFloaterEditWater::onWaterPresetListChange() -{ - refreshWaterPresetsList(); -} - -void LLFloaterEditWater::onRegionSettingsChange() -{ -#if 0 - // If creating a new preset, don't bother. - if (isNewPreset()) - { - return; - } - - if (getCurrentScope() == LLEnvKey::SCOPE_REGION) // if editing region water - { - // reset the floater to its initial state - reset(); - - // *TODO: Notify user? - } - else // editing a local preset - { - refreshWaterPresetsList(); - } -#endif -} - -void LLFloaterEditWater::onRegionInfoUpdate() -{ -#if 0 - bool can_edit = true; - - // If we've selected the region water for editing. - if (getCurrentScope() == LLEnvKey::SCOPE_REGION) - { - // check whether we have the access - can_edit = LLEnvManagerNew::canEditRegionSettings(); - } - - enableEditing(can_edit); -#endif -} diff --git a/indra/newview/llfloateremojipicker.cpp b/indra/newview/llfloateremojipicker.cpp index c9d14c45f8..a8eea23e4b 100644 --- a/indra/newview/llfloateremojipicker.cpp +++ b/indra/newview/llfloateremojipicker.cpp @@ -39,9 +39,9 @@ #include "llscrolllistctrl.h" #include "llscrolllistitem.h" #include "llsdserialize.h" -#include "lltextbox.h" +#include "lltextbox.h" #include "lltrans.h" -#include "llviewerchat.h" +#include "llviewerchat.h" namespace { // The following variables and constants are used for storing the floater state @@ -80,7 +80,7 @@ public: addChild(mList); } - virtual void updatePanel(BOOL allow_modify) override {} + virtual void updatePanel(bool allow_modify) override {} public: LLScrollingPanelList* mList; @@ -102,19 +102,19 @@ public: F32 x = 4; // padding-left F32 y = getRect().getHeight() / 2; LLFontGL::getFontSansSerif()->render( - mText, // wstr - 0, // begin_offset - x, // x - y, // y - LLColor4::white, // color - LLFontGL::LEFT, // halign - LLFontGL::VCENTER, // valign - LLFontGL::NORMAL, // style - LLFontGL::DROP_SHADOW_SOFT, // shadow - mText.size()); // max_chars + mText, // wstr + 0, // begin_offset + x, // x + y, // y + LLColor4::white, // color + LLFontGL::LEFT, // halign + LLFontGL::VCENTER, // valign + LLFontGL::NORMAL, // style + LLFontGL::DROP_SHADOW_SOFT, // shadow + static_cast<S32>(mText.size())); // max_chars } - virtual void updatePanel(BOOL allow_modify) override {} + virtual void updatePanel(bool allow_modify) override {} private: const LLWString mText; @@ -151,7 +151,7 @@ public: 1); // max_chars } - virtual void updatePanel(BOOL allow_modify) override {} + virtual void updatePanel(bool allow_modify) override {} const LLEmojiSearchResult& getData() const { return mData; } const LLWString& getChar() const { return mChar; } @@ -234,17 +234,17 @@ protected: { std::string text = mTitle.substr(0, mBegin); font->renderUTF8( - text, // text - 0, // begin_offset - x0, // x - y, // y - color, // color - LLFontGL::LEFT, // halign - LLFontGL::VCENTER, // valign - LLFontGL::NORMAL, // style - LLFontGL::DROP_SHADOW_SOFT, // shadow - text.size(), // max_chars - x1); // max_pixels + text, // text + 0, // begin_offset + x0, // x + y, // y + color, // color + LLFontGL::LEFT, // halign + LLFontGL::VCENTER, // valign + LLFontGL::NORMAL, // style + LLFontGL::DROP_SHADOW_SOFT, // shadow + static_cast<S32>(text.size()), // max_chars + x1); // max_pixels F32 dx = font->getWidthF32(text); x0 += dx; x1 -= dx; @@ -253,17 +253,17 @@ protected: { std::string text = mTitle.substr(mBegin, mEnd - mBegin); font->renderUTF8( - text, // text - 0, // begin_offset - x0, // x - y, // y - LLColor4::yellow6, // color - LLFontGL::LEFT, // halign - LLFontGL::VCENTER, // valign - LLFontGL::NORMAL, // style - LLFontGL::DROP_SHADOW_SOFT, // shadow - text.size(), // max_chars - x1); // max_pixels + text, // text + 0, // begin_offset + x0, // x + y, // y + LLColor4::yellow6, // color + LLFontGL::LEFT, // halign + LLFontGL::VCENTER, // valign + LLFontGL::NORMAL, // style + LLFontGL::DROP_SHADOW_SOFT, // shadow + static_cast<S32>(text.size()), // max_chars + x1); // max_pixels F32 dx = font->getWidthF32(text); x0 += dx; x1 -= dx; @@ -272,17 +272,17 @@ protected: { std::string text = mEnd ? mTitle.substr(mEnd) : mTitle; font->renderUTF8( - text, // text - 0, // begin_offset - x0, // x - y, // y - color, // color - LLFontGL::LEFT, // halign - LLFontGL::VCENTER, // valign - LLFontGL::NORMAL, // style - LLFontGL::DROP_SHADOW_SOFT, // shadow - text.size(), // max_chars - x1); // max_pixels + text, // text + 0, // begin_offset + x0, // x + y, // y + color, // color + LLFontGL::LEFT, // halign + LLFontGL::VCENTER, // valign + LLFontGL::NORMAL, // style + LLFontGL::DROP_SHADOW_SOFT, // shadow + static_cast<S32>(text.size()), // max_chars + x1); // max_pixels } } @@ -298,14 +298,14 @@ LLFloaterEmojiPicker::LLFloaterEmojiPicker(const LLSD& key) : super(key) { // This floater should hover on top of our dependent (with the dependent having the focus) - setFocusStealsFrontmost(FALSE); - setBackgroundVisible(FALSE); - setAutoFocus(FALSE); + setFocusStealsFrontmost(false); + setBackgroundVisible(false); + setAutoFocus(false); loadState(); } -BOOL LLFloaterEmojiPicker::postBuild() +bool LLFloaterEmojiPicker::postBuild() { mGroups = getChild<LLPanel>("Groups"); mBadge = getChild<LLPanel>("Badge"); @@ -314,7 +314,7 @@ BOOL LLFloaterEmojiPicker::postBuild() mDummy = getChild<LLTextBox>("Dummy"); mPreview = new LLEmojiPreviewPanel(); - mPreview->setVisible(FALSE); + mPreview->setVisible(false); addChild(mPreview); return LLFloater::postBuild(); @@ -329,7 +329,7 @@ void LLFloaterEmojiPicker::onOpen(const LLSD& key) initialize(); - gFloaterView->adjustToFitScreen(this, FALSE); + gFloaterView->adjustToFitScreen(this, false); } void LLFloaterEmojiPicker::onClose(bool app_quitting) @@ -382,7 +382,7 @@ void LLFloaterEmojiPicker::initialize() return; } - mGroups->setVisible(FALSE); + mGroups->setVisible(false); mFocusedIconRow = -1; mFocusedIconCol = -1; mFocusedIcon = nullptr; @@ -407,17 +407,17 @@ void LLFloaterEmojiPicker::initialize() return; } - mGroups->setVisible(TRUE); + mGroups->setVisible(true); mPreview->setIcon(nullptr); showPreview(true); mSelectedGroupIndex = groupIndex == ALL_EMOJIS_GROUP_INDEX ? 0 : - (1 + std::distance(mFilteredEmojiGroups.begin(), + static_cast<U32>((1 + std::distance(mFilteredEmojiGroups.begin(), std::find(mFilteredEmojiGroups.begin(), mFilteredEmojiGroups.end(), groupIndex))) % - (1 + mFilteredEmojiGroups.size()); + (1 + mFilteredEmojiGroups.size())); - mGroupButtons[mSelectedGroupIndex]->setToggleState(TRUE); - mGroupButtons[mSelectedGroupIndex]->setUseFontColor(TRUE); + mGroupButtons[mSelectedGroupIndex]->setToggleState(true); + mGroupButtons[mSelectedGroupIndex]->setUseFontColor(true); fillEmojis(); } @@ -559,9 +559,9 @@ void LLFloaterEmojiPicker::createGroupButton(LLButton::Params& params, const LLR button->setMouseLeaveCallback([this](LLUICtrl* ctrl, const LLSD&) { onGroupButtonMouseLeave(ctrl); }); button->setRect(rect); - button->setTabStop(FALSE); + button->setTabStop(false); button->setLabel(LLUIString(LLWString(1, emoji))); - button->setUseFontColor(FALSE); + button->setUseFontColor(false); mGroupButtons.push_back(button); mGroups->addChild(button); @@ -598,13 +598,13 @@ void LLFloaterEmojiPicker::selectEmojiGroup(U32 index) if (mSelectedGroupIndex < mGroupButtons.size()) { - mGroupButtons[mSelectedGroupIndex]->setUseFontColor(FALSE); - mGroupButtons[mSelectedGroupIndex]->setToggleState(FALSE); + mGroupButtons[mSelectedGroupIndex]->setUseFontColor(false); + mGroupButtons[mSelectedGroupIndex]->setToggleState(false); } mSelectedGroupIndex = index; - mGroupButtons[mSelectedGroupIndex]->setToggleState(TRUE); - mGroupButtons[mSelectedGroupIndex]->setUseFontColor(TRUE); + mGroupButtons[mSelectedGroupIndex]->setToggleState(true); + mGroupButtons[mSelectedGroupIndex]->setUseFontColor(true); LLButton* button = mGroupButtons[mSelectedGroupIndex]; LLRect rect = mBadge->getRect(); @@ -658,7 +658,7 @@ void LLFloaterEmojiPicker::fillEmojis(bool fromResize) LLScrollingPanelList::Params row_list_params; row_list_params.rect = row_panel_params.rect; - row_list_params.is_horizontal = TRUE; + row_list_params.is_horizontal = true; row_list_params.padding = 0; row_list_params.spacing = icon_spacing; @@ -800,8 +800,8 @@ void LLFloaterEmojiPicker::createEmojiIcon(const LLEmojiSearchResult& emoji, void LLFloaterEmojiPicker::showPreview(bool show) { //mPreview->setIcon(nullptr); - mDummy->setVisible(show ? FALSE : TRUE); - mPreview->setVisible(show ? TRUE : FALSE); + mDummy->setVisible(show); + mPreview->setVisible(show); } void LLFloaterEmojiPicker::onGroupButtonClick(LLUICtrl* ctrl) @@ -823,7 +823,7 @@ void LLFloaterEmojiPicker::onGroupButtonMouseEnter(LLUICtrl* ctrl) { if (LLButton* button = dynamic_cast<LLButton*>(ctrl)) { - button->setUseFontColor(TRUE); + button->setUseFontColor(true); } } @@ -897,7 +897,7 @@ void LLFloaterEmojiPicker::onEmojiMouseUp(LLUICtrl* ctrl) onCommit(); - if (!mHint.empty() || !(gKeyboard->currentMask(TRUE) & MASK_SHIFT)) + if (!mHint.empty() || !(gKeyboard->currentMask(true) & MASK_SHIFT)) { hideFloater(); } @@ -941,15 +941,15 @@ bool LLFloaterEmojiPicker::moveFocusedIconUp() bool LLFloaterEmojiPicker::moveFocusedIconDown() { - S32 rowCount = mEmojiGrid->getPanelList().size(); - for (S32 i = mFocusedIconRow + 1; i < rowCount; ++i) + auto rowCount = mEmojiGrid->getPanelList().size(); + for (size_t i = mFocusedIconRow + 1; i < rowCount; ++i) { LLScrollingPanel* panel = mEmojiGrid->getPanelList()[i]; LLEmojiGridRow* row = dynamic_cast<LLEmojiGridRow*>(panel); if (row && row->mList->getPanelList().size() > mFocusedIconCol) { mEmojiScroll->scrollToShowRect(row->getBoundingRect()); - mFocusedIconRow = i; + mFocusedIconRow = static_cast<S32>(i); selectFocusedIcon(); return true; } @@ -977,7 +977,7 @@ bool LLFloaterEmojiPicker::moveFocusedIconPrev() if (row && row->mList->getPanelList().size()) { mEmojiScroll->scrollToShowRect(row->getBoundingRect()); - mFocusedIconCol = row->mList->getPanelList().size() - 1; + mFocusedIconCol = static_cast<S32>(row->mList->getPanelList().size()) - 1; mFocusedIconRow = i; selectFocusedIcon(); return true; @@ -994,7 +994,7 @@ bool LLFloaterEmojiPicker::moveFocusedIconNext() LLScrollingPanel* panel = mEmojiGrid->getPanelList()[mFocusedIconRow]; LLEmojiGridRow* row = dynamic_cast<LLEmojiGridRow*>(panel); - S32 colCount = row ? row->mList->getPanelList().size() : 0; + S32 colCount = row ? static_cast<S32>(row->mList->getPanelList().size()) : 0; if (mFocusedIconCol < colCount - 1) { mFocusedIconCol++; @@ -1002,8 +1002,8 @@ bool LLFloaterEmojiPicker::moveFocusedIconNext() return true; } - S32 rowCount = mEmojiGrid->getPanelList().size(); - for (S32 i = mFocusedIconRow + 1; i < rowCount; ++i) + auto rowCount = mEmojiGrid->getPanelList().size(); + for (size_t i = mFocusedIconRow + 1; i < rowCount; ++i) { LLScrollingPanel* panel = mEmojiGrid->getPanelList()[i]; LLEmojiGridRow* row = dynamic_cast<LLEmojiGridRow*>(panel); @@ -1011,7 +1011,7 @@ bool LLFloaterEmojiPicker::moveFocusedIconNext() { mEmojiScroll->scrollToShowRect(row->getBoundingRect()); mFocusedIconCol = 0; - mFocusedIconRow = i; + mFocusedIconRow = static_cast<S32>(i); selectFocusedIcon(); return true; } @@ -1022,18 +1022,18 @@ bool LLFloaterEmojiPicker::moveFocusedIconNext() void LLFloaterEmojiPicker::selectGridIcon(LLEmojiGridIcon* icon) { - icon->setBackgroundVisible(TRUE); + icon->setBackgroundVisible(true); mPreview->setIcon(icon); } void LLFloaterEmojiPicker::unselectGridIcon(LLEmojiGridIcon* icon) { - icon->setBackgroundVisible(FALSE); + icon->setBackgroundVisible(false); mPreview->setIcon(nullptr); } // virtual -BOOL LLFloaterEmojiPicker::handleKey(KEY key, MASK mask, BOOL called_from_parent) +bool LLFloaterEmojiPicker::handleKey(KEY key, MASK mask, bool called_from_parent) { if (mask == MASK_NONE) { @@ -1041,19 +1041,19 @@ BOOL LLFloaterEmojiPicker::handleKey(KEY key, MASK mask, BOOL called_from_parent { case KEY_UP: moveFocusedIconUp(); - return TRUE; + return true; case KEY_DOWN: moveFocusedIconDown(); - return TRUE; + return true; case KEY_LEFT: moveFocusedIconPrev(); - return TRUE; + return true; case KEY_RIGHT: moveFocusedIconNext(); - return TRUE; + return true; case KEY_ESCAPE: hideFloater(); - return TRUE; + return true; } } @@ -1062,11 +1062,11 @@ BOOL LLFloaterEmojiPicker::handleKey(KEY key, MASK mask, BOOL called_from_parent switch (key) { case KEY_LEFT: - selectEmojiGroup((mSelectedGroupIndex + mFilteredEmojis.size()) % mGroupButtons.size()); - return TRUE; + selectEmojiGroup(static_cast<U32>((mSelectedGroupIndex + mFilteredEmojis.size()) % mGroupButtons.size())); + return true; case KEY_RIGHT: - selectEmojiGroup((mSelectedGroupIndex + 1) % mGroupButtons.size()); - return TRUE; + selectEmojiGroup(static_cast<U32>((mSelectedGroupIndex + 1) % mGroupButtons.size())); + return true; } } @@ -1080,7 +1080,7 @@ BOOL LLFloaterEmojiPicker::handleKey(KEY key, MASK mask, BOOL called_from_parent onEmojiMouseUp(mFocusedIcon); } mRecentReturnPressedMs = time; - return TRUE; + return true; } if (mHint.empty()) @@ -1096,7 +1096,7 @@ BOOL LLFloaterEmojiPicker::handleKey(KEY key, MASK mask, BOOL called_from_parent mFilterPattern += (char)key; initialize(); } - return TRUE; + return true; } else if (key == KEY_BACKSPACE) { @@ -1109,7 +1109,7 @@ BOOL LLFloaterEmojiPicker::handleKey(KEY key, MASK mask, BOOL called_from_parent } initialize(); } - return TRUE; + return true; } } diff --git a/indra/newview/llfloateremojipicker.h b/indra/newview/llfloateremojipicker.h index bc64cb1f35..b807adb67d 100644 --- a/indra/newview/llfloateremojipicker.h +++ b/indra/newview/llfloateremojipicker.h @@ -45,7 +45,7 @@ public: LLFloaterEmojiPicker(const LLSD& key); - virtual BOOL postBuild() override; + virtual bool postBuild() override; virtual void dirtyRect() override; virtual void goneFromFront() override; @@ -94,7 +94,7 @@ private: void onOpen(const LLSD& key) override; void onClose(bool app_quitting) override; - virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent) override; + virtual bool handleKey(KEY key, MASK mask, bool called_from_parent) override; class LLPanel* mGroups { nullptr }; class LLPanel* mBadge { nullptr }; diff --git a/indra/newview/llfloaterenvironmentadjust.cpp b/indra/newview/llfloaterenvironmentadjust.cpp index 242655b0b6..32c4f6205d 100644 --- a/indra/newview/llfloaterenvironmentadjust.cpp +++ b/indra/newview/llfloaterenvironmentadjust.cpp @@ -84,7 +84,7 @@ LLFloaterEnvironmentAdjust::~LLFloaterEnvironmentAdjust() {} //------------------------------------------------------------------------- -BOOL LLFloaterEnvironmentAdjust::postBuild() +bool LLFloaterEnvironmentAdjust::postBuild() { getChild<LLUICtrl>(FIELD_SKY_AMBIENT_LIGHT)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onAmbientLightChanged(); }); getChild<LLUICtrl>(FIELD_SKY_BLUE_HORIZON)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onBlueHorizonChanged(); }); @@ -113,7 +113,7 @@ BOOL LLFloaterEnvironmentAdjust::postBuild() getChild<LLTextureCtrl>(FIELD_SKY_CLOUD_MAP)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudMapChanged(); }); getChild<LLTextureCtrl>(FIELD_SKY_CLOUD_MAP)->setDefaultImageAssetID(LLSettingsSky::GetDefaultCloudNoiseTextureId()); - getChild<LLTextureCtrl>(FIELD_SKY_CLOUD_MAP)->setAllowNoTexture(TRUE); + getChild<LLTextureCtrl>(FIELD_SKY_CLOUD_MAP)->setAllowNoTexture(true); getChild<LLTextureCtrl>(FIELD_WATER_NORMAL_MAP)->setDefaultImageAssetID(LLSettingsWater::GetDefaultWaterNormalAssetId()); getChild<LLTextureCtrl>(FIELD_WATER_NORMAL_MAP)->setBlankImageAssetID(BLANK_OBJECT_NORMAL); @@ -122,7 +122,7 @@ BOOL LLFloaterEnvironmentAdjust::postBuild() getChild<LLUICtrl>(FIELD_REFLECTION_PROBE_AMBIANCE)->setCommitCallback([this](LLUICtrl*, const LLSD&) { onReflectionProbeAmbianceChanged(); }); refresh(); - return TRUE; + return true; } void LLFloaterEnvironmentAdjust::onOpen(const LLSD& key) @@ -157,12 +157,12 @@ void LLFloaterEnvironmentAdjust::refresh() { if (!mLiveSky || !mLiveWater) { - setAllChildrenEnabled(FALSE); + setAllChildrenEnabled(false); return; } - setEnabled(TRUE); - setAllChildrenEnabled(TRUE); + setEnabled(true); + setAllChildrenEnabled(true); getChild<LLColorSwatchCtrl>(FIELD_SKY_AMBIENT_LIGHT)->set(mLiveSky->getAmbientColor() / SLIDER_SCALE_SUN_AMBIENT); getChild<LLColorSwatchCtrl>(FIELD_SKY_BLUE_HORIZON)->set(mLiveSky->getBlueHorizon() / SLIDER_SCALE_BLUE_HORIZON_DENSITY); diff --git a/indra/newview/llfloaterenvironmentadjust.h b/indra/newview/llfloaterenvironmentadjust.h index 20ab2138b0..c894473582 100644 --- a/indra/newview/llfloaterenvironmentadjust.h +++ b/indra/newview/llfloaterenvironmentadjust.h @@ -49,7 +49,7 @@ public: virtual ~LLFloaterEnvironmentAdjust(); - virtual BOOL postBuild() override; + virtual bool postBuild() override; virtual void onOpen(const LLSD& key) override; virtual void onClose(bool app_quitting) override; diff --git a/indra/newview/llfloaterevent.cpp b/indra/newview/llfloaterevent.cpp index b07f2963b2..85d3b27f22 100644 --- a/indra/newview/llfloaterevent.cpp +++ b/indra/newview/llfloaterevent.cpp @@ -71,7 +71,7 @@ LLFloaterEvent::~LLFloaterEvent() } -BOOL LLFloaterEvent::postBuild() +bool LLFloaterEvent::postBuild() { mBrowser = getChild<LLMediaCtrl>("browser"); if (mBrowser) @@ -79,7 +79,7 @@ BOOL LLFloaterEvent::postBuild() mBrowser->addObserver(this); } - return TRUE; + return true; } void LLFloaterEvent::handleMediaEvent(LLPluginClassMedia *self, EMediaEvent event) diff --git a/indra/newview/llfloaterevent.h b/indra/newview/llfloaterevent.h index 071b907cd9..3854885a5f 100644 --- a/indra/newview/llfloaterevent.h +++ b/indra/newview/llfloaterevent.h @@ -42,7 +42,7 @@ public: LLFloaterEvent(const LLSD& key); /*virtual*/ ~LLFloaterEvent(); - /*virtual*/ BOOL postBuild(); + bool postBuild() override; void setEventID(const U32 event_id); @@ -51,7 +51,7 @@ public: protected: - /*virtual*/ void handleMediaEvent(LLPluginClassMedia *self, EMediaEvent event); + void handleMediaEvent(LLPluginClassMedia *self, EMediaEvent event) override; U32 mEventID; diff --git a/indra/newview/llfloaterexperiencepicker.cpp b/indra/newview/llfloaterexperiencepicker.cpp index 93eaa6b64b..721ffd30a0 100644 --- a/indra/newview/llfloaterexperiencepicker.cpp +++ b/indra/newview/llfloaterexperiencepicker.cpp @@ -44,7 +44,7 @@ #include "lldraghandle.h" #include "llpanelexperiencepicker.h" -LLFloaterExperiencePicker* LLFloaterExperiencePicker::show( select_callback_t callback, const LLUUID& key, BOOL allow_multiple, BOOL close_on_select, filter_list filters, LLView * frustumOrigin ) +LLFloaterExperiencePicker* LLFloaterExperiencePicker::show( select_callback_t callback, const LLUUID& key, bool allow_multiple, bool close_on_select, filter_list filters, LLView * frustumOrigin ) { LLFloaterExperiencePicker* floater = LLFloaterReg::showTypedInstance<LLFloaterExperiencePicker>("experience_search", key); @@ -99,7 +99,7 @@ LLFloaterExperiencePicker::~LLFloaterExperiencePicker() gFocusMgr.releaseFocusIfNeeded( this ); } -BOOL LLFloaterExperiencePicker::postBuild() +bool LLFloaterExperiencePicker::postBuild() { mSearchPanel = new LLPanelExperiencePicker(); addChild(mSearchPanel); diff --git a/indra/newview/llfloaterexperiencepicker.h b/indra/newview/llfloaterexperiencepicker.h index 49f96dfea0..0a001478f1 100644 --- a/indra/newview/llfloaterexperiencepicker.h +++ b/indra/newview/llfloaterexperiencepicker.h @@ -43,14 +43,14 @@ public: typedef boost::function<bool (const LLSD&)> filter_function; typedef std::vector<filter_function> filter_list; - static LLFloaterExperiencePicker* show( select_callback_t callback, const LLUUID& key, BOOL allow_multiple, BOOL close_on_select, filter_list filters, LLView * frustumOrigin); + static LLFloaterExperiencePicker* show( select_callback_t callback, const LLUUID& key, bool allow_multiple, bool close_on_select, filter_list filters, LLView * frustumOrigin); LLFloaterExperiencePicker(const LLSD& key); virtual ~LLFloaterExperiencePicker(); - BOOL postBuild(); + bool postBuild() override; - virtual void draw(); + void draw() override; private: LLPanelExperiencePicker* mSearchPanel; diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index 0966eaa1bf..eb4976fc9e 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -140,7 +140,7 @@ LLFloaterExperienceProfile::~LLFloaterExperienceProfile() } -BOOL LLFloaterExperienceProfile::postBuild() +bool LLFloaterExperienceProfile::postBuild() { if (mExperienceId.notNull()) @@ -178,7 +178,7 @@ BOOL LLFloaterExperienceProfile::postBuild() childSetCommitCallback(EDIT IMG_LOGO, boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this), NULL); - getChild<LLTextEditor>(EDIT TF_DESC)->setCommitOnFocusLost(TRUE); + getChild<LLTextEditor>(EDIT TF_DESC)->setCommitOnFocusLost(true); LLEventPumps::instance().obtain("experience_permission").listen(mExperienceId.asString()+"-profile", @@ -190,7 +190,7 @@ BOOL LLFloaterExperienceProfile::postBuild() changeToEdit(); } - return TRUE; + return true; } void LLFloaterExperienceProfile::experienceCallback(LLHandle<LLFloaterExperienceProfile> handle, const LLSD& experience ) @@ -314,11 +314,11 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) LLLayoutPanel* topPanel = getChild<LLLayoutPanel>(PNL_TOP); - imagePanel->setVisible(FALSE); - descriptionPanel->setVisible(FALSE); - locationPanel->setVisible(FALSE); - marketplacePanel->setVisible(FALSE); - topPanel->setVisible(FALSE); + imagePanel->setVisible(false); + descriptionPanel->setVisible(false); + locationPanel->setVisible(false); + marketplacePanel->setVisible(false); + topPanel->setVisible(false); LLTextBox* child = getChild<LLTextBox>(TF_NAME); @@ -380,9 +380,9 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) enable = getChild<LLCheckBoxCtrl>(EDIT BTN_PRIVATE); enable->set(properties & LLExperienceCache::PROPERTY_PRIVATE); - topPanel->setVisible(TRUE); + topPanel->setVisible(true); child=getChild<LLTextBox>(TF_GRID_WIDE); - child->setVisible(TRUE); + child->setVisible(true); if(properties & LLExperienceCache::PROPERTY_GRID) { @@ -395,13 +395,13 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) if(getChild<LLButton>(BTN_EDIT)->getVisible()) { - topPanel->setVisible(TRUE); + topPanel->setVisible(true); } if(properties & LLExperienceCache::PROPERTY_PRIVILEGED) { child = getChild<LLTextBox>(TF_PRIVILEGED); - child->setVisible(TRUE); + child->setVisible(true); } else { @@ -433,16 +433,16 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) child->setText(value); if(value.size()) { - marketplacePanel->setVisible(TRUE); + marketplacePanel->setVisible(true); } else { - marketplacePanel->setVisible(FALSE); + marketplacePanel->setVisible(false); } } else { - marketplacePanel->setVisible(FALSE); + marketplacePanel->setVisible(false); } linechild = getChild<LLLineEditor>(EDIT TF_MRKT); @@ -454,7 +454,7 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) LLUUID id = data[IMG_LOGO].asUUID(); logo->setImageAssetID(id); - imagePanel->setVisible(TRUE); + imagePanel->setVisible(true); logo = getChild<LLTextureCtrl>(EDIT IMG_LOGO); logo->setImageAssetID(data[IMG_LOGO].asUUID()); @@ -464,8 +464,8 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) } else { - marketplacePanel->setVisible(FALSE); - imagePanel->setVisible(FALSE); + marketplacePanel->setVisible(false); + imagePanel->setVisible(false); } mDirty=false; @@ -533,17 +533,17 @@ void LLFloaterExperienceProfile::onFieldChanged() } -BOOL LLFloaterExperienceProfile::canClose() +bool LLFloaterExperienceProfile::canClose() { if(mForceClose || !mDirty) { - return TRUE; + return true; } else { // Bring up view-modal dialog: Save changes? Yes, No, Cancel LLNotificationsUtil::add("SaveChanges", LLSD(), LLSD(), boost::bind(&LLFloaterExperienceProfile::handleSaveChangesDialog, this, _1, _2, CLOSE)); - return FALSE; + return false; } } @@ -560,7 +560,7 @@ bool LLFloaterExperienceProfile::handleSaveChangesDialog( const LLSD& notificati case 1: // "No" if(action != NOTHING) { - mForceClose = TRUE; + mForceClose = true; if(action==CLOSE) { closeFloater(); @@ -738,37 +738,37 @@ void LLFloaterExperienceProfile::updatePermission( const LLSD& permission ) void LLFloaterExperienceProfile::experienceAllowed() { LLButton* button=getChild<LLButton>(BTN_ALLOW); - button->setEnabled(FALSE); + button->setEnabled(false); button=getChild<LLButton>(BTN_FORGET); - button->setEnabled(TRUE); + button->setEnabled(true); button=getChild<LLButton>(BTN_BLOCK); - button->setEnabled(TRUE); + button->setEnabled(true); } void LLFloaterExperienceProfile::experienceForgotten() { LLButton* button=getChild<LLButton>(BTN_ALLOW); - button->setEnabled(TRUE); + button->setEnabled(true); button=getChild<LLButton>(BTN_FORGET); - button->setEnabled(FALSE); + button->setEnabled(false); button=getChild<LLButton>(BTN_BLOCK); - button->setEnabled(TRUE); + button->setEnabled(true); } void LLFloaterExperienceProfile::experienceBlocked() { LLButton* button=getChild<LLButton>(BTN_ALLOW); - button->setEnabled(TRUE); + button->setEnabled(true); button=getChild<LLButton>(BTN_FORGET); - button->setEnabled(TRUE); + button->setEnabled(true); button=getChild<LLButton>(BTN_BLOCK); - button->setEnabled(FALSE); + button->setEnabled(false); } void LLFloaterExperienceProfile::onClose( bool app_quitting ) @@ -918,8 +918,8 @@ void LLFloaterExperienceProfile::experienceIsAdmin(LLHandle<LLFloaterExperienceP } if (enabled && result["status"].asBoolean()) { - parent->getChild<LLLayoutPanel>(PNL_TOP)->setVisible(TRUE); - parent->getChild<LLButton>(BTN_EDIT)->setVisible(TRUE); + parent->getChild<LLLayoutPanel>(PNL_TOP)->setVisible(true); + parent->getChild<LLButton>(BTN_EDIT)->setVisible(true); } } diff --git a/indra/newview/llfloaterexperienceprofile.h b/indra/newview/llfloaterexperienceprofile.h index 16bda14cbf..d23a2be3ce 100644 --- a/indra/newview/llfloaterexperienceprofile.h +++ b/indra/newview/llfloaterexperienceprofile.h @@ -60,7 +60,7 @@ public: void refreshExperience(const LLSD& experience); void onSaveComplete( const LLSD& content ); - virtual BOOL canClose(); + virtual bool canClose(); virtual void onClose(bool app_quitting); protected: @@ -87,7 +87,7 @@ protected: static void experienceCallback(LLHandle<LLFloaterExperienceProfile> handle, const LLSD& experience); static bool experiencePermission(LLHandle<LLFloaterExperienceProfile> handle, const LLSD& permission); - BOOL postBuild(); + bool postBuild(); bool setMaturityString(U8 maturity, LLTextBox* child, LLComboBox* combo); bool handleSaveChangesDialog(const LLSD& notification, const LLSD& response, PostSaveAction action); void doSave( int success_action ); diff --git a/indra/newview/llfloaterexperiences.cpp b/indra/newview/llfloaterexperiences.cpp index 8fc1d88cc9..e79055fdae 100644 --- a/indra/newview/llfloaterexperiences.cpp +++ b/indra/newview/llfloaterexperiences.cpp @@ -58,7 +58,7 @@ LLPanelExperiences* LLFloaterExperiences::addTab(const std::string& name, bool s return newPanel; } -BOOL LLFloaterExperiences::postBuild() +bool LLFloaterExperiences::postBuild() { getChild<LLTabContainer>("xp_tabs")->addTabPanel(new LLPanelExperiencePicker()); addTab("Allowed_Experiences_Tab", true); @@ -74,7 +74,7 @@ BOOL LLFloaterExperiences::postBuild() getChild<LLTabContainer>("xp_tabs")->addTabPanel(new LLPanelExperienceLog()); resizeToTabs(); - return TRUE; + return true; } @@ -129,7 +129,7 @@ void LLFloaterExperiences::resizeToTabs() { rect.mRight = rect.mLeft + tabs->getTotalTabWidth() + TAB_WIDTH_PADDING; } - reshape(rect.getWidth(), rect.getHeight(), FALSE); + reshape(rect.getWidth(), rect.getHeight(), false); } void LLFloaterExperiences::refreshContents() diff --git a/indra/newview/llfloaterexperiences.h b/indra/newview/llfloaterexperiences.h index 6fb77c5935..5e657767d2 100644 --- a/indra/newview/llfloaterexperiences.h +++ b/indra/newview/llfloaterexperiences.h @@ -47,7 +47,7 @@ protected: void clearFromRecent(const LLSD& ids); void resizeToTabs(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); void refreshContents(); void setupRecentTabs(); LLPanelExperiences* addTab(const std::string& name, bool select); diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp index ad9f83701c..6829e6b479 100644 --- a/indra/newview/llfloaterfixedenvironment.cpp +++ b/indra/newview/llfloaterfixedenvironment.cpp @@ -94,12 +94,12 @@ LLFloaterFixedEnvironment::~LLFloaterFixedEnvironment() delete mFlyoutControl; } -BOOL LLFloaterFixedEnvironment::postBuild() +bool LLFloaterFixedEnvironment::postBuild() { mTab = getChild<LLTabContainer>(CONTROL_TAB_AREA); mTxtName = getChild<LLLineEditor>(FIELD_SETTINGS_NAME); - mTxtName->setCommitOnFocusLost(TRUE); + mTxtName->setCommitOnFocusLost(true); mTxtName->setCommitCallback([this](LLUICtrl *, const LLSD &) { onNameChanged(mTxtName->getValue().asString()); }); getChild<LLButton>(BUTTON_NAME_IMPORT)->setClickedCallback([this](LLUICtrl *, const LLSD &) { onButtonImport(); }); @@ -110,7 +110,7 @@ BOOL LLFloaterFixedEnvironment::postBuild() mFlyoutControl->setAction([this](LLUICtrl *ctrl, const LLSD &data) { onButtonApply(ctrl, data); }); mFlyoutControl->setMenuItemVisible(ACTION_COMMIT, false); - return TRUE; + return true; } void LLFloaterFixedEnvironment::onOpen(const LLSD& key) @@ -367,7 +367,7 @@ void LLFloaterFixedEnvironment::onInventoryCreated(LLUUID asset_id, LLUUID inven } } clearDirtyFlag(); - setFocus(TRUE); // Call back the focus... + setFocus(true); // Call back the focus... loadInventoryItem(inventory_id, can_trans); } @@ -404,7 +404,7 @@ void LLFloaterFixedEnvironment::doSelectFromInventory() picker->setSettingsFilter(mSettings->getSettingsTypeValue()); picker->openFloater(); - picker->setFocus(TRUE); + picker->setFocus(true); } //========================================================================= @@ -412,10 +412,10 @@ LLFloaterFixedEnvironmentWater::LLFloaterFixedEnvironmentWater(const LLSD &key): LLFloaterFixedEnvironment(key) {} -BOOL LLFloaterFixedEnvironmentWater::postBuild() +bool LLFloaterFixedEnvironmentWater::postBuild() { if (!LLFloaterFixedEnvironment::postBuild()) - return FALSE; + return false; LLPanelSettingsWater * panel; panel = new LLPanelSettingsWaterMainTab; @@ -424,7 +424,7 @@ BOOL LLFloaterFixedEnvironmentWater::postBuild() panel->setOnDirtyFlagChanged( [this] (LLPanel *, bool value) { onPanelDirtyFlagChanged(value); }); mTab->addTabPanel(LLTabContainer::TabPanelParams().panel(panel).select_tab(true)); - return TRUE; + return true; } void LLFloaterFixedEnvironmentWater::updateEditEnvironment(void) @@ -479,10 +479,10 @@ LLFloaterFixedEnvironmentSky::LLFloaterFixedEnvironmentSky(const LLSD &key) : LLFloaterFixedEnvironment(key) {} -BOOL LLFloaterFixedEnvironmentSky::postBuild() +bool LLFloaterFixedEnvironmentSky::postBuild() { if (!LLFloaterFixedEnvironment::postBuild()) - return FALSE; + return false; LLPanelSettingsSky * panel; panel = new LLPanelSettingsSkyAtmosTab; @@ -503,7 +503,7 @@ BOOL LLFloaterFixedEnvironmentSky::postBuild() panel->setOnDirtyFlagChanged([this](LLPanel *, bool value) { onPanelDirtyFlagChanged(value); }); mTab->addTabPanel(LLTabContainer::TabPanelParams().panel(panel).select_tab(false)); - return TRUE; + return true; } void LLFloaterFixedEnvironmentSky::updateEditEnvironment(void) diff --git a/indra/newview/llfloaterfixedenvironment.h b/indra/newview/llfloaterfixedenvironment.h index c616cc64bf..ac6acdd568 100644 --- a/indra/newview/llfloaterfixedenvironment.h +++ b/indra/newview/llfloaterfixedenvironment.h @@ -50,7 +50,7 @@ public: LLFloaterFixedEnvironment(const LLSD &key); ~LLFloaterFixedEnvironment(); - virtual BOOL postBuild() override; + virtual bool postBuild() override; virtual void onOpen(const LLSD& key) override; virtual void onClose(bool app_quitting) override; @@ -101,7 +101,7 @@ class LLFloaterFixedEnvironmentWater : public LLFloaterFixedEnvironment public: LLFloaterFixedEnvironmentWater(const LLSD &key); - BOOL postBuild() override; + bool postBuild() override; virtual void onOpen(const LLSD& key) override; @@ -121,7 +121,7 @@ class LLFloaterFixedEnvironmentSky : public LLFloaterFixedEnvironment public: LLFloaterFixedEnvironmentSky(const LLSD &key); - BOOL postBuild() override; + bool postBuild() override; virtual void onOpen(const LLSD& key) override; virtual void onClose(bool app_quitting) override; diff --git a/indra/newview/llfloaterforgetuser.cpp b/indra/newview/llfloaterforgetuser.cpp index 13787c4435..874bb7d545 100644 --- a/indra/newview/llfloaterforgetuser.cpp +++ b/indra/newview/llfloaterforgetuser.cpp @@ -56,7 +56,7 @@ LLFloaterForgetUser::~LLFloaterForgetUser() } } -BOOL LLFloaterForgetUser::postBuild() +bool LLFloaterForgetUser::postBuild() { mScrollList = getChild<LLScrollListCtrl>("user_list"); @@ -120,12 +120,12 @@ BOOL LLFloaterForgetUser::postBuild() bool enable_button = mScrollList->getFirstSelectedIndex() != -1; LLCheckBoxCtrl *chk_box = getChild<LLCheckBoxCtrl>("delete_data"); chk_box->setEnabled(enable_button); - chk_box->set(FALSE); + chk_box->set(false); LLButton *button = getChild<LLButton>("forget"); button->setEnabled(enable_button); button->setCommitCallback(boost::bind(&LLFloaterForgetUser::onForgetClicked, this)); - return TRUE; + return true; } void LLFloaterForgetUser::onForgetClicked() @@ -135,7 +135,7 @@ void LLFloaterForgetUser::onForgetClicked() const std::string user_id = user_data["user_id"]; LLCheckBoxCtrl *chk_box = getChild<LLCheckBoxCtrl>("delete_data"); - BOOL delete_data = chk_box->getValue(); + bool delete_data = chk_box->getValue(); if (delete_data && mUserGridsCount[user_id] > 1) { @@ -192,7 +192,7 @@ void LLFloaterForgetUser::processForgetUser() { LLScrollListCtrl *scroll_list = getChild<LLScrollListCtrl>("user_list"); LLCheckBoxCtrl *chk_box = getChild<LLCheckBoxCtrl>("delete_data"); - BOOL delete_data = chk_box->getValue(); + bool delete_data = chk_box->getValue(); LLSD user_data = scroll_list->getSelectedValue(); const std::string user_id = user_data["user_id"]; const std::string grid = user_data["grid"]; diff --git a/indra/newview/llfloaterforgetuser.h b/indra/newview/llfloaterforgetuser.h index 039b24c783..99a724b648 100644 --- a/indra/newview/llfloaterforgetuser.h +++ b/indra/newview/llfloaterforgetuser.h @@ -37,7 +37,7 @@ public: LLFloaterForgetUser(const LLSD &key); ~LLFloaterForgetUser(); - BOOL postBuild(); + bool postBuild() override; void onForgetClicked(); private: diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp index 3b2132d4b1..936096d8fe 100644 --- a/indra/newview/llfloatergesture.cpp +++ b/indra/newview/llfloatergesture.cpp @@ -51,7 +51,7 @@ #include "llviewercontrol.h" #include "llfloaterperms.h" -BOOL item_name_precedes( LLInventoryItem* a, LLInventoryItem* b ) +bool item_name_precedes( LLInventoryItem* a, LLInventoryItem* b ) { return LLStringUtil::precedesDict( a->getName(), b->getName() ); } @@ -85,7 +85,7 @@ public: perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Gestures")); perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Gestures")); item->setPermissions(perm); - item->updateServer(FALSE); + item->updateServer(false); } } }; @@ -188,7 +188,7 @@ LLFloaterGesture::~LLFloaterGesture() } // virtual -BOOL LLFloaterGesture::postBuild() +bool LLFloaterGesture::postBuild() { std::string label; @@ -224,9 +224,9 @@ BOOL LLFloaterGesture::postBuild() { buildGestureList(); - mGestureList->setFocus(TRUE); + mGestureList->setFocus(true); - const BOOL ascending = TRUE; + constexpr bool ascending = true; mGestureList->sortByColumn(std::string("name"), ascending); mGestureList->selectFirstItem(); } @@ -234,7 +234,7 @@ BOOL LLFloaterGesture::postBuild() // Update button labels onCommitList(); - return TRUE; + return true; } @@ -457,8 +457,8 @@ void LLFloaterGesture::onClickPlay() if(!LLGestureMgr::instance().isGestureActive(item_id)) { // we need to inform server about gesture activating to be consistent with LLPreviewGesture and LLGestureComboList. - BOOL inform_server = TRUE; - BOOL deactivate_similar = FALSE; + bool inform_server = true; + bool deactivate_similar = false; LLGestureMgr::instance().setGestureLoadedCallback(item_id, boost::bind(&LLFloaterGesture::playGesture, this, item_id)); LLViewerInventoryItem *item = gInventory.getItem(item_id); llassert(item); @@ -499,13 +499,13 @@ void LLFloaterGesture::onActivateBtnClick() LLGestureMgr* gm = LLGestureMgr::getInstance(); uuid_vec_t::const_iterator it = ids.begin(); - BOOL first_gesture_state = gm->isGestureActive(*it); - BOOL is_mixed = FALSE; + bool first_gesture_state = gm->isGestureActive(*it); + bool is_mixed = false; while( ++it != ids.end() ) { if(first_gesture_state != gm->isGestureActive(*it)) { - is_mixed = TRUE; + is_mixed = true; break; } } @@ -678,7 +678,7 @@ void LLFloaterGesture::onDeleteSelected() new_item->setParent(trash_id); // no need to restamp it though it's a move into trash because // it's a brand new item already. - new_item->updateParentOnServer(FALSE); + new_item->updateParentOnServer(false); gInventory.updateItem(new_item); } } diff --git a/indra/newview/llfloatergesture.h b/indra/newview/llfloatergesture.h index ae329da4d1..8116246f31 100644 --- a/indra/newview/llfloatergesture.h +++ b/indra/newview/llfloatergesture.h @@ -56,7 +56,7 @@ public: LLFloaterGesture(const LLSD& key); virtual ~LLFloaterGesture(); - virtual BOOL postBuild(); + virtual bool postBuild(); virtual void done (); void refreshAll(); /** diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp index 3b99139aba..6c1d5b5cca 100644 --- a/indra/newview/llfloatergodtools.cpp +++ b/indra/newview/llfloatergodtools.cpp @@ -82,10 +82,10 @@ const F32 SECONDS_BETWEEN_UPDATE_REQUESTS = 5.0f; void LLFloaterGodTools::onOpen(const LLSD& key) { center(); - setFocus(TRUE); + setFocus(true); // LLPanel *panel = getChild<LLTabContainer>("GodTools Tabs")->getCurrentPanel(); // if (panel) -// panel->setFocus(TRUE); +// panel->setFocus(true); if (mPanelObjectTools) mPanelObjectTools->setTargetAvatar(LLUUID::null); @@ -124,11 +124,11 @@ LLFloaterGodTools::LLFloaterGodTools(const LLSD& key) mFactoryMap["request"] = LLCallbackMap(createPanelRequest, this); } -BOOL LLFloaterGodTools::postBuild() +bool LLFloaterGodTools::postBuild() { sendRegionInfoRequest(); getChild<LLTabContainer>("GodTools Tabs")->selectTabByName("region"); - return TRUE; + return true; } // static void* LLFloaterGodTools::createPanelGrid(void *userdata) @@ -200,7 +200,7 @@ void LLFloaterGodTools::showPanel(const std::string& panel_name) openFloater(); LLPanel *panel = getChild<LLTabContainer>("GodTools Tabs")->getCurrentPanel(); if (panel) - panel->setFocus(TRUE); + panel->setFocus(true); } // static @@ -442,22 +442,22 @@ LLPanelRegionTools::LLPanelRegionTools() mCommitCallbackRegistrar.add("RegionTools.SaveState", boost::bind(&LLPanelRegionTools::onSaveState, this)); } -BOOL LLPanelRegionTools::postBuild() +bool LLPanelRegionTools::postBuild() { getChild<LLLineEditor>("region name")->setKeystrokeCallback(onChangeSimName, this); getChild<LLLineEditor>("region name")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe); getChild<LLLineEditor>("estate")->setPrevalidate(&LLTextValidate::validatePositiveS32); getChild<LLLineEditor>("parentestate")->setPrevalidate(&LLTextValidate::validatePositiveS32); - getChildView("parentestate")->setEnabled(FALSE); + getChildView("parentestate")->setEnabled(false); getChild<LLLineEditor>("gridposx")->setPrevalidate(&LLTextValidate::validatePositiveS32); - getChildView("gridposx")->setEnabled(FALSE); + getChildView("gridposx")->setEnabled(false); getChild<LLLineEditor>("gridposy")->setPrevalidate(&LLTextValidate::validatePositiveS32); - getChildView("gridposy")->setEnabled(FALSE); + getChildView("gridposy")->setEnabled(false); getChild<LLLineEditor>("redirectx")->setPrevalidate(&LLTextValidate::validatePositiveS32); getChild<LLLineEditor>("redirecty")->setPrevalidate(&LLTextValidate::validatePositiveS32); - return TRUE; + return true; } // Destroys the object @@ -483,41 +483,41 @@ void LLPanelRegionTools::clearAllWidgets() { // clear all widgets getChild<LLUICtrl>("region name")->setValue("unknown"); - getChild<LLUICtrl>("region name")->setFocus( FALSE); + getChild<LLUICtrl>("region name")->setFocus( false); - getChild<LLUICtrl>("check prelude")->setValue(FALSE); - getChildView("check prelude")->setEnabled(FALSE); + getChild<LLUICtrl>("check prelude")->setValue(false); + getChildView("check prelude")->setEnabled(false); - getChild<LLUICtrl>("check fixed sun")->setValue(FALSE); - getChildView("check fixed sun")->setEnabled(FALSE); + getChild<LLUICtrl>("check fixed sun")->setValue(false); + getChildView("check fixed sun")->setEnabled(false); - getChild<LLUICtrl>("check reset home")->setValue(FALSE); - getChildView("check reset home")->setEnabled(FALSE); + getChild<LLUICtrl>("check reset home")->setValue(false); + getChildView("check reset home")->setEnabled(false); - getChild<LLUICtrl>("check damage")->setValue(FALSE); - getChildView("check damage")->setEnabled(FALSE); + getChild<LLUICtrl>("check damage")->setValue(false); + getChildView("check damage")->setEnabled(false); - getChild<LLUICtrl>("check visible")->setValue(FALSE); - getChildView("check visible")->setEnabled(FALSE); + getChild<LLUICtrl>("check visible")->setValue(false); + getChildView("check visible")->setEnabled(false); - getChild<LLUICtrl>("block terraform")->setValue(FALSE); - getChildView("block terraform")->setEnabled(FALSE); + getChild<LLUICtrl>("block terraform")->setValue(false); + getChildView("block terraform")->setEnabled(false); - getChild<LLUICtrl>("block dwell")->setValue(FALSE); - getChildView("block dwell")->setEnabled(FALSE); + getChild<LLUICtrl>("block dwell")->setValue(false); + getChildView("block dwell")->setEnabled(false); - getChild<LLUICtrl>("is sandbox")->setValue(FALSE); - getChildView("is sandbox")->setEnabled(FALSE); + getChild<LLUICtrl>("is sandbox")->setValue(false); + getChildView("is sandbox")->setEnabled(false); getChild<LLUICtrl>("billable factor")->setValue(BILLABLE_FACTOR_DEFAULT); - getChildView("billable factor")->setEnabled(FALSE); + getChildView("billable factor")->setEnabled(false); getChild<LLUICtrl>("land cost")->setValue(PRICE_PER_METER_DEFAULT); - getChildView("land cost")->setEnabled(FALSE); + getChildView("land cost")->setEnabled(false); - getChildView("Apply")->setEnabled(FALSE); - getChildView("Bake Terrain")->setEnabled(FALSE); - getChildView("Autosave now")->setEnabled(FALSE); + getChildView("Apply")->setEnabled(false); + getChildView("Bake Terrain")->setEnabled(false); + getChildView("Autosave now")->setEnabled(false); } @@ -525,21 +525,21 @@ void LLPanelRegionTools::enableAllWidgets() { // enable all of the widgets - getChildView("check prelude")->setEnabled(TRUE); - getChildView("check fixed sun")->setEnabled(TRUE); - getChildView("check reset home")->setEnabled(TRUE); - getChildView("check damage")->setEnabled(TRUE); - getChildView("check visible")->setEnabled(FALSE); // use estates to update... - getChildView("block terraform")->setEnabled(TRUE); - getChildView("block dwell")->setEnabled(TRUE); - getChildView("is sandbox")->setEnabled(TRUE); + getChildView("check prelude")->setEnabled(true); + getChildView("check fixed sun")->setEnabled(true); + getChildView("check reset home")->setEnabled(true); + getChildView("check damage")->setEnabled(true); + getChildView("check visible")->setEnabled(false); // use estates to update... + getChildView("block terraform")->setEnabled(true); + getChildView("block dwell")->setEnabled(true); + getChildView("is sandbox")->setEnabled(true); - getChildView("billable factor")->setEnabled(TRUE); - getChildView("land cost")->setEnabled(TRUE); + getChildView("billable factor")->setEnabled(true); + getChildView("land cost")->setEnabled(true); - getChildView("Apply")->setEnabled(FALSE); // don't enable this one - getChildView("Bake Terrain")->setEnabled(TRUE); - getChildView("Autosave now")->setEnabled(TRUE); + getChildView("Apply")->setEnabled(false); // don't enable this one + getChildView("Bake Terrain")->setEnabled(true); + getChildView("Autosave now")->setEnabled(true); } void LLPanelRegionTools::onSaveState(void* userdata) @@ -718,14 +718,14 @@ void LLPanelRegionTools::setParentEstateID(U32 id) void LLPanelRegionTools::setCheckFlags(U64 flags) { - getChild<LLUICtrl>("check prelude")->setValue(is_prelude(flags) ? TRUE : FALSE); - getChild<LLUICtrl>("check fixed sun")->setValue(flags & REGION_FLAGS_SUN_FIXED ? TRUE : FALSE); - getChild<LLUICtrl>("check reset home")->setValue(flags & REGION_FLAGS_RESET_HOME_ON_TELEPORT ? TRUE : FALSE); - getChild<LLUICtrl>("check damage")->setValue(flags & REGION_FLAGS_ALLOW_DAMAGE ? TRUE : FALSE); - getChild<LLUICtrl>("check visible")->setValue(flags & REGION_FLAGS_EXTERNALLY_VISIBLE ? TRUE : FALSE); - getChild<LLUICtrl>("block terraform")->setValue(flags & REGION_FLAGS_BLOCK_TERRAFORM ? TRUE : FALSE); - getChild<LLUICtrl>("block dwell")->setValue(flags & REGION_FLAGS_BLOCK_DWELL ? TRUE : FALSE); - getChild<LLUICtrl>("is sandbox")->setValue(flags & REGION_FLAGS_SANDBOX ? TRUE : FALSE ); + getChild<LLUICtrl>("check prelude")->setValue(is_prelude(flags)); + getChild<LLUICtrl>("check fixed sun")->setValue(is_flag_set(flags, REGION_FLAGS_SUN_FIXED)); + getChild<LLUICtrl>("check reset home")->setValue(is_flag_set(flags, REGION_FLAGS_RESET_HOME_ON_TELEPORT)); + getChild<LLUICtrl>("check damage")->setValue(is_flag_set(flags, REGION_FLAGS_ALLOW_DAMAGE)); + getChild<LLUICtrl>("check visible")->setValue(is_flag_set(flags, REGION_FLAGS_EXTERNALLY_VISIBLE)); + getChild<LLUICtrl>("block terraform")->setValue(is_flag_set(flags, REGION_FLAGS_BLOCK_TERRAFORM)); + getChild<LLUICtrl>("block dwell")->setValue(is_flag_set(flags, REGION_FLAGS_BLOCK_DWELL)); + getChild<LLUICtrl>("is sandbox")->setValue(is_flag_set(flags, REGION_FLAGS_SANDBOX)); } void LLPanelRegionTools::setBillableFactor(F32 billable_factor) @@ -742,7 +742,7 @@ void LLPanelRegionTools::onChangeAnything() { if (gAgent.isGodlike()) { - getChildView("Apply")->setEnabled(TRUE); + getChildView("Apply")->setEnabled(true); } } @@ -751,8 +751,8 @@ void LLPanelRegionTools::onChangePrelude() // checking prelude auto-checks fixed sun if (getChild<LLUICtrl>("check prelude")->getValue().asBoolean()) { - getChild<LLUICtrl>("check fixed sun")->setValue(TRUE); - getChild<LLUICtrl>("check reset home")->setValue(TRUE); + getChild<LLUICtrl>("check fixed sun")->setValue(true); + getChild<LLUICtrl>("check reset home")->setValue(true); onChangeAnything(); } // pass on to default onChange handler @@ -765,7 +765,7 @@ void LLPanelRegionTools::onChangeSimName(LLLineEditor* caller, void* userdata ) if (userdata && gAgent.isGodlike()) { LLPanelRegionTools* region_tools = (LLPanelRegionTools*) userdata; - region_tools->getChildView("Apply")->setEnabled(TRUE); + region_tools->getChildView("Apply")->setEnabled(true); } } @@ -790,7 +790,7 @@ void LLPanelRegionTools::onApplyChanges() LLViewerRegion *region = gAgent.getRegion(); if (region && gAgent.isGodlike()) { - getChildView("Apply")->setEnabled(FALSE); + getChildView("Apply")->setEnabled(false); god_tools->sendGodUpdateRegionInfo(); //LLFloaterReg::getTypedInstance<LLFloaterGodTools>("god_tools")->sendGodUpdateRegionInfo(); } @@ -824,7 +824,7 @@ void LLPanelRegionTools::onSelectRegion() LLVector3d north_east(REGION_WIDTH_METERS, REGION_WIDTH_METERS, 0); LLViewerParcelMgr::getInstance()->selectLand(regionp->getOriginGlobal(), - regionp->getOriginGlobal() + north_east, FALSE); + regionp->getOriginGlobal() + north_east, false); } @@ -862,9 +862,9 @@ LLPanelGridTools::~LLPanelGridTools() { } -BOOL LLPanelGridTools::postBuild() +bool LLPanelGridTools::postBuild() { - return TRUE; + return true; } void LLPanelGridTools::refresh() @@ -946,10 +946,10 @@ LLPanelObjectTools::~LLPanelObjectTools() // base class will take care of everything } -BOOL LLPanelObjectTools::postBuild() +bool LLPanelObjectTools::postBuild() { refresh(); - return TRUE; + return true; } void LLPanelObjectTools::setTargetAvatar(const LLUUID &target_id) @@ -1004,36 +1004,36 @@ U64 LLPanelObjectTools::computeRegionFlags(U64 flags) const void LLPanelObjectTools::setCheckFlags(U64 flags) { - getChild<LLUICtrl>("disable scripts")->setValue(flags & REGION_FLAGS_SKIP_SCRIPTS ? TRUE : FALSE); - getChild<LLUICtrl>("disable collisions")->setValue(flags & REGION_FLAGS_SKIP_COLLISIONS ? TRUE : FALSE); - getChild<LLUICtrl>("disable physics")->setValue(flags & REGION_FLAGS_SKIP_PHYSICS ? TRUE : FALSE); + getChild<LLUICtrl>("disable scripts")->setValue(is_flag_set(flags, REGION_FLAGS_SKIP_SCRIPTS)); + getChild<LLUICtrl>("disable collisions")->setValue(is_flag_set(flags, REGION_FLAGS_SKIP_COLLISIONS)); + getChild<LLUICtrl>("disable physics")->setValue(is_flag_set(flags, REGION_FLAGS_SKIP_PHYSICS)); } void LLPanelObjectTools::clearAllWidgets() { - getChild<LLUICtrl>("disable scripts")->setValue(FALSE); - getChildView("disable scripts")->setEnabled(FALSE); + getChild<LLUICtrl>("disable scripts")->setValue(false); + getChildView("disable scripts")->setEnabled(false); - getChildView("Apply")->setEnabled(FALSE); - getChildView("Set Target")->setEnabled(FALSE); - getChildView("Delete Target's Scripted Objects On Others Land")->setEnabled(FALSE); - getChildView("Delete Target's Scripted Objects On *Any* Land")->setEnabled(FALSE); - getChildView("Delete *ALL* Of Target's Objects")->setEnabled(FALSE); + getChildView("Apply")->setEnabled(false); + getChildView("Set Target")->setEnabled(false); + getChildView("Delete Target's Scripted Objects On Others Land")->setEnabled(false); + getChildView("Delete Target's Scripted Objects On *Any* Land")->setEnabled(false); + getChildView("Delete *ALL* Of Target's Objects")->setEnabled(false); } void LLPanelObjectTools::enableAllWidgets() { - getChildView("disable scripts")->setEnabled(TRUE); + getChildView("disable scripts")->setEnabled(true); - getChildView("Apply")->setEnabled(FALSE); // don't enable this one - getChildView("Set Target")->setEnabled(TRUE); - getChildView("Delete Target's Scripted Objects On Others Land")->setEnabled(TRUE); - getChildView("Delete Target's Scripted Objects On *Any* Land")->setEnabled(TRUE); - getChildView("Delete *ALL* Of Target's Objects")->setEnabled(TRUE); - getChildView("Get Top Colliders")->setEnabled(TRUE); - getChildView("Get Top Scripts")->setEnabled(TRUE); + getChildView("Apply")->setEnabled(false); // don't enable this one + getChildView("Set Target")->setEnabled(true); + getChildView("Delete Target's Scripted Objects On Others Land")->setEnabled(true); + getChildView("Delete Target's Scripted Objects On *Any* Land")->setEnabled(true); + getChildView("Delete *ALL* Of Target's Objects")->setEnabled(true); + getChildView("Get Top Colliders")->setEnabled(true); + getChildView("Get Top Scripts")->setEnabled(true); } @@ -1154,7 +1154,7 @@ void LLPanelObjectTools::onClickSet() { LLView * button = findChild<LLButton>("Set Target"); LLFloater * root_floater = gFloaterView->getParentFloater(this); - LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelObjectTools::callbackAvatarID, this, _1,_2), FALSE, FALSE, FALSE, root_floater->getName(), button); + LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelObjectTools::callbackAvatarID, this, _1,_2), false, false, false, root_floater->getName(), button); // grandparent is a floater, which can have a dependent if (picker) { @@ -1167,7 +1167,7 @@ void LLPanelObjectTools::onClickSetBySelection(void* data) LLPanelObjectTools* panelp = (LLPanelObjectTools*) data; if (!panelp) return; - const BOOL non_root_ok = TRUE; + const bool non_root_ok = true; LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(NULL, non_root_ok); if (!node) return; @@ -1195,7 +1195,7 @@ void LLPanelObjectTools::onChangeAnything() { if (gAgent.isGodlike()) { - getChildView("Apply")->setEnabled(TRUE); + getChildView("Apply")->setEnabled(true); } } @@ -1207,7 +1207,7 @@ void LLPanelObjectTools::onApplyChanges() if (region && gAgent.isGodlike()) { // TODO -- implement this - getChildView("Apply")->setEnabled(FALSE); + getChildView("Apply")->setEnabled(false); god_tools->sendGodUpdateRegionInfo(); //LLFloaterReg::getTypedInstance<LLFloaterGodTools>("god_tools")->sendGodUpdateRegionInfo(); } @@ -1231,11 +1231,11 @@ LLPanelRequestTools::~LLPanelRequestTools() { } -BOOL LLPanelRequestTools::postBuild() +bool LLPanelRequestTools::postBuild() { refresh(); - return TRUE; + return true; } void LLPanelRequestTools::refresh() @@ -1344,7 +1344,7 @@ void LLPanelRequestTools::sendRequest(const LLHost& host) { gXferManager->requestFile(std::string("terrain.raw"), std::string("terrain.raw"), LL_PATH_NONE, host, - FALSE, + false, terrain_download_done, NULL); } diff --git a/indra/newview/llfloatergodtools.h b/indra/newview/llfloatergodtools.h index 3bf5f15b89..03ac91404d 100644 --- a/indra/newview/llfloatergodtools.h +++ b/indra/newview/llfloatergodtools.h @@ -102,7 +102,7 @@ protected: protected: - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); // When the floater is going away, reset any options that need to be // cleared. void resetToolState(); @@ -127,7 +127,7 @@ public: LLPanelRegionTools(); /*virtual*/ ~LLPanelRegionTools(); - BOOL postBuild(); + bool postBuild(); /*virtual*/ void refresh(); @@ -189,7 +189,7 @@ public: LLPanelGridTools(); virtual ~LLPanelGridTools(); - BOOL postBuild(); + bool postBuild(); void refresh(); @@ -213,7 +213,7 @@ public: LLPanelObjectTools(); /*virtual*/ ~LLPanelObjectTools(); - BOOL postBuild(); + bool postBuild(); /*virtual*/ void refresh(); @@ -254,7 +254,7 @@ public: LLPanelRequestTools(); /*virtual*/ ~LLPanelRequestTools(); - BOOL postBuild(); + bool postBuild(); void refresh(); diff --git a/indra/newview/llfloatergotoline.cpp b/indra/newview/llfloatergotoline.cpp index 005a7b3d4a..09ca0ab530 100644 --- a/indra/newview/llfloatergotoline.cpp +++ b/indra/newview/llfloatergotoline.cpp @@ -58,16 +58,16 @@ LLFloaterGotoLine::LLFloaterGotoLine(LLScriptEdCore* editor_core) } } -BOOL LLFloaterGotoLine::postBuild() +bool LLFloaterGotoLine::postBuild() { mGotoBox = getChild<LLLineEditor>("goto_line"); mGotoBox->setCommitCallback(boost::bind(&LLFloaterGotoLine::onGotoBoxCommit, this)); - mGotoBox->setCommitOnFocusLost(FALSE); + mGotoBox->setCommitOnFocusLost(false); getChild<LLLineEditor>("goto_line")->setPrevalidate(LLTextValidate::validateNonNegativeS32); childSetAction("goto_btn", onBtnGoto,this); setDefaultBtn("goto_btn"); - return TRUE; + return true; } //static @@ -111,7 +111,7 @@ void LLFloaterGotoLine::handleBtnGoto() { mEditorCore->mEditor->deselect(); mEditorCore->mEditor->setCursor(row, column); - mEditorCore->mEditor->setFocus(TRUE); + mEditorCore->mEditor->setFocus(true); } } } @@ -122,17 +122,17 @@ bool LLFloaterGotoLine::hasAccelerators() const { return mEditorCore->hasAccelerators(); } - return FALSE; + return false; } -BOOL LLFloaterGotoLine::handleKeyHere(KEY key, MASK mask) +bool LLFloaterGotoLine::handleKeyHere(KEY key, MASK mask) { if (mEditorCore) { return mEditorCore->handleKeyHere(key, mask); } - return FALSE; + return false; } void LLFloaterGotoLine::onGotoBoxCommit() @@ -148,11 +148,11 @@ void LLFloaterGotoLine::onGotoBoxCommit() S32 rownew = 0; S32 columnnew = 0; - mEditorCore->mEditor->getCurrentLineAndColumn( &rownew, &columnnew, FALSE ); // don't include wordwrap + mEditorCore->mEditor->getCurrentLineAndColumn( &rownew, &columnnew, false ); // don't include wordwrap if (rownew == row && columnnew == column) { mEditorCore->mEditor->deselect(); - mEditorCore->mEditor->setFocus(TRUE); + mEditorCore->mEditor->setFocus(true); sInstance->closeFloater(); } //else do nothing (if the cursor-position didn't change) } diff --git a/indra/newview/llfloatergotoline.h b/indra/newview/llfloatergotoline.h index 04618ba881..02f3747cb2 100644 --- a/indra/newview/llfloatergotoline.h +++ b/indra/newview/llfloatergotoline.h @@ -40,7 +40,7 @@ public: LLFloaterGotoLine(LLScriptEdCore* editor_core); ~LLFloaterGotoLine(); - /*virtual*/ BOOL postBuild(); + bool postBuild() override; static void show(LLScriptEdCore* editor_core); static void onBtnGoto(void* userdata); @@ -49,8 +49,8 @@ public: LLScriptEdCore* getEditorCore() { return mEditorCore; } static LLFloaterGotoLine* getInstance() { return sInstance; } - virtual bool hasAccelerators() const; - virtual BOOL handleKeyHere(KEY key, MASK mask); + bool hasAccelerators() const override; + bool handleKeyHere(KEY key, MASK mask) override; private: diff --git a/indra/newview/llfloatergridstatus.cpp b/indra/newview/llfloatergridstatus.cpp index cfb0f7c20b..b6b844b307 100644 --- a/indra/newview/llfloatergridstatus.cpp +++ b/indra/newview/llfloatergridstatus.cpp @@ -43,16 +43,16 @@ const std::string DEFAULT_GRID_STATUS_URL = "http://status.secondlifegrid.net/"; LLFloaterGridStatus::LLFloaterGridStatus(const Params& key) : LLFloaterWebContent(key), - mIsFirstUpdate(TRUE) + mIsFirstUpdate(true) { } -BOOL LLFloaterGridStatus::postBuild() +bool LLFloaterGridStatus::postBuild() { LLFloaterWebContent::postBuild(); mWebBrowser->addObserver(this); - return TRUE; + return true; } void LLFloaterGridStatus::onOpen(const LLSD& key) @@ -154,7 +154,7 @@ void LLFloaterGridStatus::getGridStatusRSSCoro() { gToolBarView->flashCommand(LLCommandId("gridstatus"), true); } - getInstance()->setFirstUpdate(FALSE); + getInstance()->setFirstUpdate(false); } // virtual diff --git a/indra/newview/llfloatergridstatus.h b/indra/newview/llfloatergridstatus.h index 51fc397574..570479d990 100644 --- a/indra/newview/llfloatergridstatus.h +++ b/indra/newview/llfloatergridstatus.h @@ -50,21 +50,21 @@ public: static void getGridStatusRSSCoro(); void startGridStatusTimer(); - BOOL isFirstUpdate() { return mIsFirstUpdate; } - void setFirstUpdate(BOOL first_update) { mIsFirstUpdate = first_update; } + bool isFirstUpdate() { return mIsFirstUpdate; } + void setFirstUpdate(bool first_update) { mIsFirstUpdate = first_update; } static LLFloaterGridStatus* getInstance(); private: - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); void applyPreferredRect(); static std::map<std::string, std::string> sItemsMap; LLFrameTimer mGridStatusTimer; - BOOL mIsFirstUpdate; + bool mIsFirstUpdate; }; #endif // LL_LLFLOATERGRIDSTATUS_H diff --git a/indra/newview/llfloatergroups.cpp b/indra/newview/llfloatergroups.cpp index 0444927d07..2fd1a482e5 100644 --- a/indra/newview/llfloatergroups.cpp +++ b/indra/newview/llfloatergroups.cpp @@ -75,7 +75,7 @@ void LLFloaterGroupPicker::setPowersMask(U64 powers_mask) } -BOOL LLFloaterGroupPicker::postBuild() +bool LLFloaterGroupPicker::postBuild() { LLScrollListCtrl* list_ctrl = getChild<LLScrollListCtrl>("group list"); if (list_ctrl) @@ -91,9 +91,9 @@ BOOL LLFloaterGroupPicker::postBuild() setDefaultBtn("OK"); - getChildView("OK")->setEnabled(TRUE); + getChildView("OK")->setEnabled(true); - return TRUE; + return true; } void LLFloaterGroupPicker::removeNoneOption() @@ -179,7 +179,7 @@ void LLPanelGroups::reset() enableButtons(); } -BOOL LLPanelGroups::postBuild() +bool LLPanelGroups::postBuild() { childSetCommitCallback("group list", onGroupList, this); @@ -210,7 +210,7 @@ BOOL LLPanelGroups::postBuild() reset(); - return TRUE; + return true; } void LLPanelGroups::enableButtons() @@ -224,23 +224,23 @@ void LLPanelGroups::enableButtons() if(group_id != gAgent.getGroupID()) { - getChildView("Activate")->setEnabled(TRUE); + getChildView("Activate")->setEnabled(true); } else { - getChildView("Activate")->setEnabled(FALSE); + getChildView("Activate")->setEnabled(false); } if (group_id.notNull()) { - getChildView("Info")->setEnabled(TRUE); - getChildView("IM")->setEnabled(TRUE); - getChildView("Leave")->setEnabled(TRUE); + getChildView("Info")->setEnabled(true); + getChildView("IM")->setEnabled(true); + getChildView("Leave")->setEnabled(true); } else { - getChildView("Info")->setEnabled(FALSE); - getChildView("IM")->setEnabled(FALSE); - getChildView("Leave")->setEnabled(FALSE); + getChildView("Info")->setEnabled(false); + getChildView("IM")->setEnabled(false); + getChildView("Leave")->setEnabled(false); } getChildView("Create")->setEnabled(gAgent.canJoinGroups()); } @@ -342,13 +342,13 @@ void LLPanelGroups::onGroupList(LLUICtrl* ctrl, void* userdata) void init_group_list(LLScrollListCtrl* group_list, const LLUUID& highlight_id, U64 powers_mask) { - S32 count = gAgent.mGroups.size(); + auto count = gAgent.mGroups.size(); LLUUID id; if (!group_list) return; group_list->operateOnAll(LLCtrlListInterface::OP_DELETE); - for(S32 i = 0; i < count; ++i) + for(size_t i = 0; i < count; ++i) { id = gAgent.mGroups.at(i).mID; LLGroupData* group_datap = &gAgent.mGroups.at(i); @@ -371,7 +371,7 @@ void init_group_list(LLScrollListCtrl* group_list, const LLUUID& highlight_id, U } } - group_list->sortOnce(0, TRUE); + group_list->sortOnce(0, true); // add "none" to list at top { diff --git a/indra/newview/llfloatergroups.h b/indra/newview/llfloatergroups.h index 1e3d7dd630..be6ced40bf 100644 --- a/indra/newview/llfloatergroups.h +++ b/indra/newview/llfloatergroups.h @@ -60,11 +60,7 @@ public: typedef boost::signals2::signal<void (LLUUID id)> signal_t; void setSelectGroupCallback(const signal_t::slot_type& cb) { mGroupSelectSignal.connect(cb); } void setPowersMask(U64 powers_mask); - BOOL postBuild(); - - // implementation of factory policy - static LLFloaterGroupPicker* findInstance(const LLSD& seed); - static LLFloaterGroupPicker* createInstance(const LLSD& seed); + bool postBuild(); // for cases like inviting avatar to group we don't want the none option void removeNoneOption(); @@ -97,7 +93,7 @@ public: protected: // initialize based on the type - BOOL postBuild(); + bool postBuild(); // highlight_id is a group id to highlight void enableButtons(); @@ -109,8 +105,6 @@ protected: static void onBtnIM(void* userdata); static void onBtnLeave(void* userdata); static void onBtnSearch(void* userdata); - static void onBtnVote(void* userdata); - static void onDoubleClickGroup(void* userdata); void create(); void activate(); @@ -118,10 +112,6 @@ protected: void startIM(); void leave(); void search(); - void callVote(); - - static bool callbackLeaveGroup(const LLSD& notification, const LLSD& response); - }; diff --git a/indra/newview/llfloaterhelpbrowser.cpp b/indra/newview/llfloaterhelpbrowser.cpp index f651342018..e77fa83606 100644 --- a/indra/newview/llfloaterhelpbrowser.cpp +++ b/indra/newview/llfloaterhelpbrowser.cpp @@ -47,7 +47,7 @@ LLFloaterHelpBrowser::LLFloaterHelpBrowser(const LLSD& key) { } -BOOL LLFloaterHelpBrowser::postBuild() +bool LLFloaterHelpBrowser::postBuild() { mBrowser = getChild<LLMediaCtrl>("browser"); mBrowser->addObserver(this); @@ -56,7 +56,7 @@ BOOL LLFloaterHelpBrowser::postBuild() childSetAction("open_browser", onClickOpenWebBrowser, this); buildURLHistory(); - return TRUE; + return true; } void LLFloaterHelpBrowser::buildURLHistory() @@ -74,7 +74,7 @@ void LLFloaterHelpBrowser::buildURLHistory() void LLFloaterHelpBrowser::onOpen(const LLSD& key) { - gSavedSettings.setBOOL("HelpFloaterOpen", TRUE); + gSavedSettings.setBOOL("HelpFloaterOpen", true); std::string topic = key.asString(); mBrowser->navigateTo(LLViewerHelp::instance().getURL(topic)); @@ -85,7 +85,7 @@ void LLFloaterHelpBrowser::onClose(bool app_quitting) { if (!app_quitting) { - gSavedSettings.setBOOL("HelpFloaterOpen", FALSE); + gSavedSettings.setBOOL("HelpFloaterOpen", false); } // really really destroy the help browser when it's closed, it'll be recreated. destroy(); // really destroy this dialog on closure, it's relatively heavyweight. diff --git a/indra/newview/llfloaterhelpbrowser.h b/indra/newview/llfloaterhelpbrowser.h index 0dd944bf92..cbf3704190 100644 --- a/indra/newview/llfloaterhelpbrowser.h +++ b/indra/newview/llfloaterhelpbrowser.h @@ -40,7 +40,7 @@ class LLFloaterHelpBrowser : public: LLFloaterHelpBrowser(const LLSD& key); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void onClose(bool app_quitting); /*virtual*/ void onOpen(const LLSD& key); diff --git a/indra/newview/llfloaterhoverheight.cpp b/indra/newview/llfloaterhoverheight.cpp index 2d9bb61dc1..ef3e306da9 100644 --- a/indra/newview/llfloaterhoverheight.cpp +++ b/indra/newview/llfloaterhoverheight.cpp @@ -45,7 +45,7 @@ void LLFloaterHoverHeight::syncFromPreferenceSetting(void *user_data, bool updat LLFloaterHoverHeight *self = static_cast<LLFloaterHoverHeight*>(user_data); LLSliderCtrl* sldrCtrl = self->getChild<LLSliderCtrl>("HoverHeightSlider"); - sldrCtrl->setValue(value,FALSE); + sldrCtrl->setValue(value,false); if (isAgentAvatarValid() && update_offset) { @@ -56,7 +56,7 @@ void LLFloaterHoverHeight::syncFromPreferenceSetting(void *user_data, bool updat } } -BOOL LLFloaterHoverHeight::postBuild() +bool LLFloaterHoverHeight::postBuild() { LLSliderCtrl* sldrCtrl = getChild<LLSliderCtrl>("HoverHeightSlider"); sldrCtrl->setMinValue(MIN_HOVER_Z); @@ -86,7 +86,7 @@ BOOL LLFloaterHoverHeight::postBuild() // Set up based on initial region. onRegionChanged(); - return TRUE; + return true; } void LLFloaterHoverHeight::onClose(bool app_quitting) diff --git a/indra/newview/llfloaterhoverheight.h b/indra/newview/llfloaterhoverheight.h index 778df644ef..029370b26b 100644 --- a/indra/newview/llfloaterhoverheight.h +++ b/indra/newview/llfloaterhoverheight.h @@ -33,7 +33,7 @@ class LLFloaterHoverHeight: public LLFloater { public: LLFloaterHoverHeight(const LLSD& key); - BOOL postBuild(); + bool postBuild(); static void onSliderMoved(LLUICtrl* ctrl, void* userData); diff --git a/indra/newview/llfloaterhowto.cpp b/indra/newview/llfloaterhowto.cpp index b414db6fc5..6a9f113d53 100644 --- a/indra/newview/llfloaterhowto.cpp +++ b/indra/newview/llfloaterhowto.cpp @@ -33,8 +33,8 @@ #include "llweb.h" -const S32 STACK_WIDTH = 300; -const S32 STACK_HEIGHT = 505; // content will be 500 +constexpr S32 STACK_WIDTH = 300; +constexpr S32 STACK_HEIGHT = 505; // content will be 500 LLFloaterHowTo::LLFloaterHowTo(const Params& key) : LLFloaterWebContent(key) @@ -42,11 +42,11 @@ LLFloaterHowTo::LLFloaterHowTo(const Params& key) : mShowPageTitle = false; } -BOOL LLFloaterHowTo::postBuild() +bool LLFloaterHowTo::postBuild() { LLFloaterWebContent::postBuild(); - return TRUE; + return true; } void LLFloaterHowTo::onOpen(const LLSD& key) @@ -78,14 +78,14 @@ LLFloaterHowTo* LLFloaterHowTo::getInstance() return LLFloaterReg::getTypedInstance<LLFloaterHowTo>("guidebook"); } -BOOL LLFloaterHowTo::handleKeyHere(KEY key, MASK mask) +bool LLFloaterHowTo::handleKeyHere(KEY key, MASK mask) { - BOOL handled = FALSE; + bool handled = false; if (KEY_F1 == key ) { closeFloater(); - handled = TRUE; + handled = true; } return handled; diff --git a/indra/newview/llfloaterhowto.h b/indra/newview/llfloaterhowto.h index 566e5454ad..9d7793817a 100644 --- a/indra/newview/llfloaterhowto.h +++ b/indra/newview/llfloaterhowto.h @@ -44,14 +44,14 @@ public: void onOpen(const LLSD& key) override; - BOOL handleKeyHere(KEY key, MASK mask) override; + bool handleKeyHere(KEY key, MASK mask) override; static LLFloaterHowTo* getInstance(); bool matchesKey(const LLSD& key) override { return true; /*single instance*/ }; private: - BOOL postBuild() override; + bool postBuild() override; }; #endif // LL_LLFLOATERHOWTO_H diff --git a/indra/newview/llfloaterhud.cpp b/indra/newview/llfloaterhud.cpp index 6c9535d9ad..c5ef187a46 100644 --- a/indra/newview/llfloaterhud.cpp +++ b/indra/newview/llfloaterhud.cpp @@ -55,10 +55,10 @@ LLFloaterHUD::LLFloaterHUD(const LLSD& key) } // Opaque background since we never get the focus - setBackgroundOpaque(TRUE); + setBackgroundOpaque(true); } -BOOL LLFloaterHUD::postBuild() +bool LLFloaterHUD::postBuild() { mWebBrowser = getChild<LLMediaCtrl>("floater_hud_browser" ); if (mWebBrowser) @@ -75,7 +75,7 @@ BOOL LLFloaterHUD::postBuild() mWebBrowser->navigateTo(url); } - return TRUE; + return true; } // Destructor diff --git a/indra/newview/llfloaterhud.h b/indra/newview/llfloaterhud.h index b761794295..710a44fc57 100644 --- a/indra/newview/llfloaterhud.h +++ b/indra/newview/llfloaterhud.h @@ -36,7 +36,7 @@ class LLFloaterHUD : public LLFloater friend class LLFloaterReg; public: - BOOL postBuild(); + bool postBuild() override; private: // Handles its own construction and destruction, so private. diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp index 73adb2175a..ea49c88755 100644 --- a/indra/newview/llfloaterimagepreview.cpp +++ b/indra/newview/llfloaterimagepreview.cpp @@ -87,11 +87,11 @@ LLFloaterImagePreview::LLFloaterImagePreview(const std::string& filename) : //----------------------------------------------------------------------------- // postBuild() //----------------------------------------------------------------------------- -BOOL LLFloaterImagePreview::postBuild() +bool LLFloaterImagePreview::postBuild() { if (!LLFloaterNameDesc::postBuild()) { - return FALSE; + return false; } LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo"); @@ -107,12 +107,12 @@ BOOL LLFloaterImagePreview::postBuild() PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD); mPreviewImageRect.set(0.f, 1.f, 1.f, 0.f); - getChildView("bad_image_text")->setVisible(FALSE); + getChildView("bad_image_text")->setVisible(false); if (mRawImagep.notNull() && gAgent.getRegion() != NULL) { mAvatarPreview = new LLImagePreviewAvatar(256, 256); - mAvatarPreview->setPreviewTarget("mPelvis", "mUpperBodyMesh0", mRawImagep, 2.f, FALSE); + mAvatarPreview->setPreviewTarget("mPelvis", "mUpperBodyMesh0", mRawImagep, 2.f, false); mSculptedPreview = new LLImagePreviewSculpted(256, 256); mSculptedPreview->setPreviewTarget(mRawImagep, 2.0f); @@ -122,7 +122,7 @@ BOOL LLFloaterImagePreview::postBuild() // We want "lossless_check" to be unchecked when it is disabled, regardless of // LosslessJ2CUpload state, so only assign control when enabling checkbox LLCheckBoxCtrl* check_box = getChild<LLCheckBoxCtrl>("lossless_check"); - check_box->setEnabled(TRUE); + check_box->setEnabled(true); check_box->setControlVariable(gSavedSettings.getControl("LosslessJ2CUpload")); } } @@ -130,9 +130,9 @@ BOOL LLFloaterImagePreview::postBuild() { mAvatarPreview = NULL; mSculptedPreview = NULL; - getChildView("bad_image_text")->setVisible(TRUE); - getChildView("clothing_type_combo")->setEnabled(FALSE); - getChildView("ok_btn")->setEnabled(FALSE); + getChildView("bad_image_text")->setVisible(true); + getChildView("clothing_type_combo")->setEnabled(false); + getChildView("ok_btn")->setEnabled(false); if(!mImageLoadError.empty()) { @@ -142,7 +142,7 @@ BOOL LLFloaterImagePreview::postBuild() getChild<LLUICtrl>("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this)); - return TRUE; + return true; } @@ -191,28 +191,28 @@ void LLFloaterImagePreview::onPreviewTypeCommit(LLUICtrl* ctrl, void* userdat case 0: break; case 1: - fp->mAvatarPreview->setPreviewTarget("mSkull", "mHairMesh0", fp->mRawImagep, 0.4f, FALSE); + fp->mAvatarPreview->setPreviewTarget("mSkull", "mHairMesh0", fp->mRawImagep, 0.4f, false); break; case 2: - fp->mAvatarPreview->setPreviewTarget("mSkull", "mHeadMesh0", fp->mRawImagep, 0.4f, FALSE); + fp->mAvatarPreview->setPreviewTarget("mSkull", "mHeadMesh0", fp->mRawImagep, 0.4f, false); break; case 3: - fp->mAvatarPreview->setPreviewTarget("mChest", "mUpperBodyMesh0", fp->mRawImagep, 1.0f, FALSE); + fp->mAvatarPreview->setPreviewTarget("mChest", "mUpperBodyMesh0", fp->mRawImagep, 1.0f, false); break; case 4: - fp->mAvatarPreview->setPreviewTarget("mKneeLeft", "mLowerBodyMesh0", fp->mRawImagep, 1.2f, FALSE); + fp->mAvatarPreview->setPreviewTarget("mKneeLeft", "mLowerBodyMesh0", fp->mRawImagep, 1.2f, false); break; case 5: - fp->mAvatarPreview->setPreviewTarget("mSkull", "mHeadMesh0", fp->mRawImagep, 0.4f, TRUE); + fp->mAvatarPreview->setPreviewTarget("mSkull", "mHeadMesh0", fp->mRawImagep, 0.4f, true); break; case 6: - fp->mAvatarPreview->setPreviewTarget("mChest", "mUpperBodyMesh0", fp->mRawImagep, 1.2f, TRUE); + fp->mAvatarPreview->setPreviewTarget("mChest", "mUpperBodyMesh0", fp->mRawImagep, 1.2f, true); break; case 7: - fp->mAvatarPreview->setPreviewTarget("mKneeLeft", "mLowerBodyMesh0", fp->mRawImagep, 1.2f, TRUE); + fp->mAvatarPreview->setPreviewTarget("mKneeLeft", "mLowerBodyMesh0", fp->mRawImagep, 1.2f, true); break; case 8: - fp->mAvatarPreview->setPreviewTarget("mKneeLeft", "mSkirtMesh0", fp->mRawImagep, 1.3f, FALSE); + fp->mAvatarPreview->setPreviewTarget("mKneeLeft", "mSkirtMesh0", fp->mRawImagep, 1.3f, false); break; case 9: fp->mSculptedPreview->setPreviewTarget(fp->mRawImagep, 2.0f); @@ -268,7 +268,7 @@ void LLFloaterImagePreview::draw() } else { - mImagep = LLViewerTextureManager::getLocalTexture(mRawImagep.get(), FALSE) ; + mImagep = LLViewerTextureManager::getLocalTexture(mRawImagep.get(), false) ; gGL.getTexUnit(0)->unbind(mImagep->getTarget()) ; gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mImagep->getTexName()); @@ -344,54 +344,54 @@ bool LLFloaterImagePreview::loadImage(const std::string& src_filename) { try { - std::string exten = gDirUtilp->getExtension(src_filename); - U32 codec = LLImageBase::getCodecFromExtension(exten); + std::string exten = gDirUtilp->getExtension(src_filename); + U32 codec = LLImageBase::getCodecFromExtension(exten); - LLImageDimensionsInfo image_info; - if (!image_info.load(src_filename, codec)) - { - mImageLoadError = image_info.getLastError(); - return false; - } + LLImageDimensionsInfo image_info; + if (!image_info.load(src_filename,codec)) + { + mImageLoadError = image_info.getLastError(); + return false; + } - S32 max_width = gSavedSettings.getS32("max_texture_dimension_X"); - S32 max_height = gSavedSettings.getS32("max_texture_dimension_Y"); + S32 max_width = gSavedSettings.getS32("max_texture_dimension_X"); + S32 max_height = gSavedSettings.getS32("max_texture_dimension_Y"); - if ((image_info.getWidth() > max_width) || (image_info.getHeight() > max_height)) - { - LLStringUtil::format_map_t args; - args["WIDTH"] = llformat("%d", max_width); - args["HEIGHT"] = llformat("%d", max_height); + if ((image_info.getWidth() > max_width) || (image_info.getHeight() > max_height)) + { + LLStringUtil::format_map_t args; + args["WIDTH"] = llformat("%d", max_width); + args["HEIGHT"] = llformat("%d", max_height); - mImageLoadError = LLTrans::getString("texture_load_dimensions_error", args); - return false; - } + mImageLoadError = LLTrans::getString("texture_load_dimensions_error", args); + return false; + } - // Load the image - LLPointer<LLImageFormatted> image = LLImageFormatted::createFromType(codec); - if (image.isNull()) - { - return false; - } - if (!image->load(src_filename)) - { - return false; - } - // Decompress or expand it in a raw image structure - LLPointer<LLImageRaw> raw_image = new LLImageRaw; - if (!image->decode(raw_image, 0.0f)) - { - return false; - } - // Check the image constraints - if ((image->getComponents() != 3) && (image->getComponents() != 4)) - { - image->setLastError("Image files with less than 3 or more than 4 components are not supported."); - return false; - } + // Load the image + LLPointer<LLImageFormatted> image = LLImageFormatted::createFromType(codec); + if (image.isNull()) + { + return false; + } + if (!image->load(src_filename)) + { + return false; + } + // Decompress or expand it in a raw image structure + LLPointer<LLImageRaw> raw_image = new LLImageRaw; + if (!image->decode(raw_image, 0.0f)) + { + return false; + } + // Check the image constraints + if ((image->getComponents() != 3) && (image->getComponents() != 4)) + { + image->setLastError("Image files with less than 3 or more than 4 components are not supported."); + return false; + } - raw_image->biasedScaleToPowerOfTwo(LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT); - mRawImagep = raw_image; + raw_image->biasedScaleToPowerOfTwo(LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT); + mRawImagep = raw_image; } catch (...) { @@ -405,7 +405,7 @@ bool LLFloaterImagePreview::loadImage(const std::string& src_filename) //----------------------------------------------------------------------------- // handleMouseDown() //----------------------------------------------------------------------------- -BOOL LLFloaterImagePreview::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLFloaterImagePreview::handleMouseDown(S32 x, S32 y, MASK mask) { if (mPreviewRect.pointInRect(x, y)) { @@ -414,7 +414,7 @@ BOOL LLFloaterImagePreview::handleMouseDown(S32 x, S32 y, MASK mask) gViewerWindow->hideCursor(); mLastMouseX = x; mLastMouseY = y; - return TRUE; + return true; } return LLFloater::handleMouseDown(x, y, mask); @@ -423,9 +423,9 @@ BOOL LLFloaterImagePreview::handleMouseDown(S32 x, S32 y, MASK mask) //----------------------------------------------------------------------------- // handleMouseUp() //----------------------------------------------------------------------------- -BOOL LLFloaterImagePreview::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLFloaterImagePreview::handleMouseUp(S32 x, S32 y, MASK mask) { - gFocusMgr.setMouseCapture(FALSE); + gFocusMgr.setMouseCapture(nullptr); gViewerWindow->showCursor(); return LLFloater::handleMouseUp(x, y, mask); } @@ -433,7 +433,7 @@ BOOL LLFloaterImagePreview::handleMouseUp(S32 x, S32 y, MASK mask) //----------------------------------------------------------------------------- // handleHover() //----------------------------------------------------------------------------- -BOOL LLFloaterImagePreview::handleHover(S32 x, S32 y, MASK mask) +bool LLFloaterImagePreview::handleHover(S32 x, S32 y, MASK mask) { MASK local_mask = mask & ~MASK_ALT; @@ -547,13 +547,13 @@ BOOL LLFloaterImagePreview::handleHover(S32 x, S32 y, MASK mask) gViewerWindow->setCursor(UI_CURSOR_TOOLZOOMIN); } - return TRUE; + return true; } //----------------------------------------------------------------------------- // handleScrollWheel() //----------------------------------------------------------------------------- -BOOL LLFloaterImagePreview::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLFloaterImagePreview::handleScrollWheel(S32 x, S32 y, S32 clicks) { if (mPreviewRect.pointInRect(x, y) && mAvatarPreview) { @@ -564,7 +564,7 @@ BOOL LLFloaterImagePreview::handleScrollWheel(S32 x, S32 y, S32 clicks) mSculptedPreview->refresh(); } - return TRUE; + return true; } //----------------------------------------------------------------------------- @@ -580,9 +580,9 @@ void LLFloaterImagePreview::onMouseCaptureLostImagePreview(LLMouseHandler* handl //----------------------------------------------------------------------------- // LLImagePreviewAvatar //----------------------------------------------------------------------------- -LLImagePreviewAvatar::LLImagePreviewAvatar(S32 width, S32 height) : LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE) +LLImagePreviewAvatar::LLImagePreviewAvatar(S32 width, S32 height) : LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, false) { - mNeedsUpdate = TRUE; + mNeedsUpdate = true; mTargetJoint = NULL; mTargetMesh = NULL; mCameraDistance = 0.f; @@ -608,7 +608,7 @@ S8 LLImagePreviewAvatar::getType() const return LLViewerDynamicTexture::LL_IMAGE_PREVIEW_AVATAR ; } -void LLImagePreviewAvatar::setPreviewTarget(const std::string& joint_name, const std::string& mesh_name, LLImageRaw* imagep, F32 distance, BOOL male) +void LLImagePreviewAvatar::setPreviewTarget(const std::string& joint_name, const std::string& mesh_name, LLImageRaw* imagep, F32 distance, bool male) { mTargetJoint = mDummyAvatar->mRoot->findJoint(joint_name); // clear out existing test mesh @@ -629,11 +629,11 @@ void LLImagePreviewAvatar::setPreviewTarget(const std::string& joint_name, const mDummyAvatar->updateVisualParams(); mDummyAvatar->updateGeometry(mDummyAvatar->mDrawable); } - mDummyAvatar->mRoot->setVisible(FALSE, TRUE); + mDummyAvatar->mRoot->setVisible(false, true); mTargetMesh = dynamic_cast<LLViewerJointMesh*>(mDummyAvatar->mRoot->findJoint(mesh_name)); mTargetMesh->setTestTexture(mTextureName); - mTargetMesh->setVisible(TRUE, FALSE); + mTargetMesh->setVisible(true, false); mCameraDistance = distance; mCameraZoom = 1.f; mCameraPitch = 0.f; @@ -660,9 +660,9 @@ void LLImagePreviewAvatar::clearPreviewTexture(const std::string& mesh_name) //----------------------------------------------------------------------------- // update() //----------------------------------------------------------------------------- -BOOL LLImagePreviewAvatar::render() +bool LLImagePreviewAvatar::render() { - mNeedsUpdate = FALSE; + mNeedsUpdate = false; LLVOAvatar* avatarp = mDummyAvatar; gGL.pushUIMatrix(); @@ -707,7 +707,7 @@ BOOL LLImagePreviewAvatar::render() LLViewerCamera::getInstance()->setAspect((F32)mFullWidth / mFullHeight); LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / mCameraZoom); - LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, FALSE); + LLViewerCamera::getInstance()->setPerspective(false, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, false); LLVertexBuffer::unbind(); avatarp->updateLOD(); @@ -729,7 +729,7 @@ BOOL LLImagePreviewAvatar::render() gGL.popUIMatrix(); gGL.color4f(1,1,1,1); - return TRUE; + return true; } //----------------------------------------------------------------------------- @@ -737,7 +737,7 @@ BOOL LLImagePreviewAvatar::render() //----------------------------------------------------------------------------- void LLImagePreviewAvatar::refresh() { - mNeedsUpdate = TRUE; + mNeedsUpdate = true; } //----------------------------------------------------------------------------- @@ -769,9 +769,9 @@ void LLImagePreviewAvatar::pan(F32 right, F32 up) // LLImagePreviewSculpted //----------------------------------------------------------------------------- -LLImagePreviewSculpted::LLImagePreviewSculpted(S32 width, S32 height) : LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE) +LLImagePreviewSculpted::LLImagePreviewSculpted(S32 width, S32 height) : LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, false) { - mNeedsUpdate = TRUE; + mNeedsUpdate = true; mCameraDistance = 0.f; mCameraYaw = 0.f; mCameraPitch = 0.f; @@ -807,6 +807,7 @@ void LLImagePreviewSculpted::setPreviewTarget(LLImageRaw* imagep, F32 distance) if (imagep) { + LLImageDataSharedLock lock(imagep); mVolume->sculpt(imagep->getWidth(), imagep->getHeight(), imagep->getComponents(), imagep->getData(), 0, false); } @@ -863,9 +864,9 @@ void LLImagePreviewSculpted::setPreviewTarget(LLImageRaw* imagep, F32 distance) //----------------------------------------------------------------------------- // render() //----------------------------------------------------------------------------- -BOOL LLImagePreviewSculpted::render() +bool LLImagePreviewSculpted::render() { - mNeedsUpdate = FALSE; + mNeedsUpdate = false; LLGLSUIDefault def; LLGLDisable no_blend(GL_BLEND); LLGLEnable cull(GL_CULL_FACE); @@ -909,7 +910,7 @@ BOOL LLImagePreviewSculpted::render() LLViewerCamera::getInstance()->setAspect((F32) mFullWidth / mFullHeight); LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / mCameraZoom); - LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, FALSE); + LLViewerCamera::getInstance()->setPerspective(false, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, false); const LLVolumeFace &vf = mVolume->getVolumeFace(0); U32 num_indices = vf.mNumIndices; @@ -932,7 +933,7 @@ BOOL LLImagePreviewSculpted::render() gObjectPreviewProgram.unbind(); - return TRUE; + return true; } //----------------------------------------------------------------------------- @@ -940,7 +941,7 @@ BOOL LLImagePreviewSculpted::render() //----------------------------------------------------------------------------- void LLImagePreviewSculpted::refresh() { - mNeedsUpdate = TRUE; + mNeedsUpdate = true; } //----------------------------------------------------------------------------- diff --git a/indra/newview/llfloaterimagepreview.h b/indra/newview/llfloaterimagepreview.h index 6cd5bb4ca7..ed395722de 100644 --- a/indra/newview/llfloaterimagepreview.h +++ b/indra/newview/llfloaterimagepreview.h @@ -53,15 +53,15 @@ protected: void setPreviewTarget(LLImageRaw *imagep, F32 distance); void setTexture(U32 name) { mTextureName = name; } - BOOL render() override; + bool render() override; void refresh(); void rotate(F32 yaw_radians, F32 pitch_radians); void zoom(F32 zoom_amt); void pan(F32 right, F32 up); - virtual BOOL needsRender() override { return mNeedsUpdate; } + virtual bool needsRender() override { return mNeedsUpdate; } protected: - BOOL mNeedsUpdate; + bool mNeedsUpdate; U32 mTextureName; F32 mCameraDistance; F32 mCameraYaw; @@ -83,19 +83,19 @@ public: S8 getType() const override; - void setPreviewTarget(const std::string& joint_name, const std::string& mesh_name, LLImageRaw* imagep, F32 distance, BOOL male); + void setPreviewTarget(const std::string& joint_name, const std::string& mesh_name, LLImageRaw* imagep, F32 distance, bool male); void setTexture(U32 name) { mTextureName = name; } void clearPreviewTexture(const std::string& mesh_name); - BOOL render() override; + bool render() override; void refresh(); void rotate(F32 yaw_radians, F32 pitch_radians); void zoom(F32 zoom_amt); void pan(F32 right, F32 up); - virtual BOOL needsRender() override { return mNeedsUpdate; } + virtual bool needsRender() override { return mNeedsUpdate; } protected: - BOOL mNeedsUpdate; + bool mNeedsUpdate; LLJoint* mTargetJoint; LLViewerJointMesh* mTargetMesh; F32 mCameraDistance; @@ -113,14 +113,14 @@ public: LLFloaterImagePreview(const std::string& filename); virtual ~LLFloaterImagePreview(); - BOOL postBuild() override; + bool postBuild() override; S32 getExpectedUploadCost() const override; - BOOL handleMouseDown(S32 x, S32 y, MASK mask) override; - BOOL handleMouseUp(S32 x, S32 y, MASK mask) override; - BOOL handleHover(S32 x, S32 y, MASK mask) override; - BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) override; + bool handleMouseDown(S32 x, S32 y, MASK mask) override; + bool handleMouseUp(S32 x, S32 y, MASK mask) override; + bool handleHover(S32 x, S32 y, MASK mask) override; + bool handleScrollWheel(S32 x, S32 y, S32 clicks) override; static void onMouseCaptureLostImagePreview(LLMouseHandler*); diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 8d0f0a0e57..add389748f 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -88,7 +88,7 @@ LLFloaterIMContainer::LLFloaterIMContainer(const LLSD& seed, const Params& param // Firstly add our self to IMSession observers, so we catch session events LLIMMgr::getInstance()->addSessionObserver(this); - mAutoResize = FALSE; + mAutoResize = false; LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::IM, this); } @@ -114,7 +114,7 @@ LLFloaterIMContainer::~LLFloaterIMContainer() } } -void LLFloaterIMContainer::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, BOOL has_offline_msg) +void LLFloaterIMContainer::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, bool has_offline_msg) { addConversationListItem(session_id); LLFloaterIMSessionTab::addToHost(session_id); @@ -182,7 +182,7 @@ void LLFloaterIMContainer::onCurrentChannelChanged(const LLUUID& session_id) } } -BOOL LLFloaterIMContainer::postBuild() +bool LLFloaterIMContainer::postBuild() { mOrigMinWidth = getMinWidth(); mOrigMinHeight = getMinHeight(); @@ -267,7 +267,7 @@ BOOL LLFloaterIMContainer::postBuild() S32 conversations_panel_width = gSavedPerAccountSettings.getS32("ConversationsListPaneWidth"); LLRect conversations_panel_rect = mConversationsPane->getRect(); conversations_panel_rect.mRight = conversations_panel_rect.mLeft + conversations_panel_width; - mConversationsPane->handleReshape(conversations_panel_rect, TRUE); + mConversationsPane->handleReshape(conversations_panel_rect, true); } // Init the sort order now that the root had been created @@ -294,7 +294,7 @@ BOOL LLFloaterIMContainer::postBuild() mParticipantRefreshTimer.setTimerExpirySec(0); mParticipantRefreshTimer.start(); - return TRUE; + return true; } void LLFloaterIMContainer::onOpen(const LLSD& key) @@ -309,7 +309,7 @@ void LLFloaterIMContainer::onOpen(const LLSD& key) // virtual void LLFloaterIMContainer::addFloater(LLFloater* floaterp, - BOOL select_added_floater, + bool select_added_floater, LLTabContainer::eInsertionPoint insertion_point) { if(!floaterp) return; @@ -329,7 +329,7 @@ void LLFloaterIMContainer::addFloater(LLFloater* floaterp, LLIconCtrl* icon = 0; - bool is_in_group = gAgent.isInGroup(session_id, TRUE); + bool is_in_group = gAgent.isInGroup(session_id, true); LLUUID icon_id; if (is_in_group) @@ -372,7 +372,7 @@ void LLFloaterIMContainer::addFloater(LLFloater* floaterp, void LLFloaterIMContainer::onCloseFloater(LLUUID& id) { mSessions.erase(id); - setFocus(TRUE); + setFocus(true); } void LLFloaterIMContainer::onNewMessageReceived(const LLSD& data) @@ -384,8 +384,8 @@ void LLFloaterIMContainer::onNewMessageReceived(const LLSD& data) if(floaterp && current_floater && floaterp != current_floater) { if(LLMultiFloater::isFloaterFlashing(floaterp)) - LLMultiFloater::setFloaterFlashing(floaterp, FALSE); - LLMultiFloater::setFloaterFlashing(floaterp, TRUE); + LLMultiFloater::setFloaterFlashing(floaterp, false); + LLMultiFloater::setFloaterFlashing(floaterp, true); } } @@ -634,7 +634,7 @@ void LLFloaterIMContainer::handleConversationModelEvent(const LLSD& event) { participant_view = createConversationViewParticipant(participant_model); participant_view->addToFolder(session_view); - participant_view->setVisible(TRUE); + participant_view->setVisible(true); } } // Add a participant view to the conversation floater @@ -718,7 +718,7 @@ void LLFloaterIMContainer::returnFloaterToHost() floater->onTearOffClicked(); } -void LLFloaterIMContainer::setMinimized(BOOL b) +void LLFloaterIMContainer::setMinimized(bool b) { bool was_minimized = isMinimized(); LLMultiFloater::setMinimized(b); @@ -741,7 +741,7 @@ void LLFloaterIMContainer::setMinimized(BOOL b) } } -void LLFloaterIMContainer::setVisible(BOOL visible) +void LLFloaterIMContainer::setVisible(bool visible) { LLFloaterIMNearbyChat* nearby_chat; if (visible) @@ -823,7 +823,7 @@ void LLFloaterIMContainer::getDetachedConversationFloaters(floater_list_t& float } } -void LLFloaterIMContainer::setVisibleAndFrontmost(BOOL take_focus, const LLSD& key) +void LLFloaterIMContainer::setVisibleAndFrontmost(bool take_focus, const LLSD& key) { LLMultiFloater::setVisibleAndFrontmost(take_focus, key); // Do not select "Nearby Chat" conversation, since it will bring its window to front @@ -988,7 +988,7 @@ void LLFloaterIMContainer::onAddButtonClicked() { LLView * button = findChild<LLView>("conversations_pane_buttons_expanded")->findChild<LLButton>("add_btn"); LLFloater* root_floater = gFloaterView->getParentFloater(this); - LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLFloaterIMContainer::onAvatarPicked, this, _1), TRUE, TRUE, TRUE, root_floater->getName(), button); + LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLFloaterIMContainer::onAvatarPicked, this, _1), true, true, true, root_floater->getName(), button); if (picker && root_floater) { @@ -1058,7 +1058,7 @@ void LLFloaterIMContainer::onCustomAction(const LLSD& userdata) } } -BOOL LLFloaterIMContainer::isActionChecked(const LLSD& userdata) +bool LLFloaterIMContainer::isActionChecked(const LLSD& userdata) { LLConversationSort order = mConversationViewModel.getSorter(); std::string command = userdata.asString(); @@ -1094,7 +1094,7 @@ BOOL LLFloaterIMContainer::isActionChecked(const LLSD& userdata) { return gSavedSettings.getBOOL("TranslateChat"); } - return FALSE; + return false; } void LLFloaterIMContainer::setSortOrderSessions(const LLConversationFilter::ESortOrderType order) @@ -1706,9 +1706,9 @@ void LLFloaterIMContainer::selectNextConversationByID(const LLUUID& uuid) } // Synchronous select the conversation item and the conversation floater -BOOL LLFloaterIMContainer::selectConversationPair(const LLUUID& session_id, bool select_widget, bool focus_floater/*=true*/) +bool LLFloaterIMContainer::selectConversationPair(const LLUUID& session_id, bool select_widget, bool focus_floater/*=true*/) { - BOOL handled = TRUE; + bool handled = true; LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::findConversation(session_id); /* widget processing */ @@ -1717,7 +1717,7 @@ BOOL LLFloaterIMContainer::selectConversationPair(const LLUUID& session_id, bool LLFolderViewItem* widget = get_ptr_in_map(mConversationsWidgets,session_id); if (widget && widget->getParentFolder()) { - widget->getParentFolder()->setSelection(widget, FALSE, FALSE); + widget->getParentFolder()->setSelection(widget, false, false); mConversationsRoot->scrollToShowSelection(); } } @@ -1787,8 +1787,8 @@ void LLFloaterIMContainer::setNearbyDistances() // Get the position of the agent const LLVector3d& me_pos = gAgent.getPositionGlobal(); // For each nearby avatar, compute and update the distance - int avatar_count = positions.size(); - for (int i = 0; i < avatar_count; i++) + auto avatar_count = positions.size(); + for (size_t i = 0; i < avatar_count; i++) { F64 dist = dist_vec_squared(positions[i], me_pos); item->setDistance(avatar_ids[i],dist); @@ -1898,10 +1898,10 @@ bool LLFloaterIMContainer::removeConversationListItem(const LLUUID& uuid, bool c is_widget_selected = widget->isSelected(); if (mConversationsRoot) { - new_selection = mConversationsRoot->getNextFromChild(widget, FALSE); + new_selection = mConversationsRoot->getNextFromChild(widget, false); if (!new_selection) { - new_selection = mConversationsRoot->getPreviousFromChild(widget, FALSE); + new_selection = mConversationsRoot->getPreviousFromChild(widget, false); } } @@ -1918,7 +1918,7 @@ bool LLFloaterIMContainer::removeConversationListItem(const LLUUID& uuid, bool c // Don't let the focus fall IW, select and refocus on the first conversation in the list if (change_focus) { - setFocus(TRUE); + setFocus(true); if (new_selection) { if (mConversationsWidgets.size() == 1) @@ -2250,7 +2250,7 @@ void LLFloaterIMContainer::openNearbyChat() if (nearby_chat) { reSelectConversation(); - nearby_chat->setOpen(TRUE); + nearby_chat->setOpen(true); } } } @@ -2310,27 +2310,27 @@ bool LLFloaterIMContainer::isScrolledOutOfSight(LLConversationViewSession* conve return !mConversationsRoot->getVisibleRect().overlaps(widget_rect); } -BOOL LLFloaterIMContainer::handleKeyHere(KEY key, MASK mask ) +bool LLFloaterIMContainer::handleKeyHere(KEY key, MASK mask ) { - BOOL handled = FALSE; + bool handled = false; if(mask == MASK_ALT) { if (KEY_RETURN == key ) { expandConversation(); - handled = TRUE; + handled = true; } if ((KEY_DOWN == key ) || (KEY_RIGHT == key)) { selectNextorPreviousConversation(true); - handled = TRUE; + handled = true; } if ((KEY_UP == key) || (KEY_LEFT == key)) { selectNextorPreviousConversation(false); - handled = TRUE; + handled = true; } } return handled; @@ -2358,11 +2358,11 @@ bool LLFloaterIMContainer::selectNextorPreviousConversation(bool select_next, bo { if(select_next) { - new_selection = mConversationsRoot->getNextFromChild(widget, FALSE); + new_selection = mConversationsRoot->getNextFromChild(widget, false); } else { - new_selection = mConversationsRoot->getPreviousFromChild(widget, FALSE); + new_selection = mConversationsRoot->getPreviousFromChild(widget, false); } if (new_selection) { @@ -2403,12 +2403,12 @@ bool LLFloaterIMContainer::isParticipantListExpanded() return is_expanded; } -// By default, if torn off session is currently frontmost, LLFloater::isFrontmost() will return FALSE, which can lead to some bugs +// By default, if torn off session is currently frontmost, LLFloater::isFrontmost() will return false, which can lead to some bugs // So LLFloater::isFrontmost() is overriden here to check both selected session and the IM floater itself // Exclude "Nearby Chat" session from the check, as "Nearby Chat" window and "Conversations" floater can be brought // to front independently /*virtual*/ -BOOL LLFloaterIMContainer::isFrontmost() +bool LLFloaterIMContainer::isFrontmost() { LLFloaterIMSessionTab* selected_session = LLFloaterIMSessionTab::getConversation(mSelectedSession); LLFloaterIMNearbyChat* nearby_chat = LLFloaterReg::findTypedInstance<LLFloaterIMNearbyChat>("nearby_chat"); diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h index 71fe2bd204..e11445d779 100644 --- a/indra/newview/llfloaterimcontainer.h +++ b/indra/newview/llfloaterimcontainer.h @@ -56,25 +56,25 @@ public: LLFloaterIMContainer(const LLSD& seed, const Params& params = getDefaultParams()); virtual ~LLFloaterIMContainer(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void draw(); - /*virtual*/ void setMinimized(BOOL b); - /*virtual*/ void setVisible(BOOL visible); - /*virtual*/ void setVisibleAndFrontmost(BOOL take_focus=TRUE, const LLSD& key = LLSD()); + /*virtual*/ void setMinimized(bool b); + /*virtual*/ void setVisible(bool visible); + /*virtual*/ void setVisibleAndFrontmost(bool take_focus=true, const LLSD& key = LLSD()); /*virtual*/ void updateResizeLimits(); /*virtual*/ void handleReshape(const LLRect& rect, bool by_user); void onCloseFloater(LLUUID& id); /*virtual*/ void addFloater(LLFloater* floaterp, - BOOL select_added_floater, + bool select_added_floater, LLTabContainer::eInsertionPoint insertion_point = LLTabContainer::END); void returnFloaterToHost(); void showConversation(const LLUUID& session_id); void selectConversation(const LLUUID& session_id); void selectNextConversationByID(const LLUUID& session_id); - BOOL selectConversationPair(const LLUUID& session_id, bool select_widget, bool focus_floater = true); + bool selectConversationPair(const LLUUID& session_id, bool select_widget, bool focus_floater = true); void clearAllFlashStates(); bool selectAdjacentConversation(bool focus_selected); bool selectNextorPreviousConversation(bool select_next, bool focus_selected = true); @@ -83,7 +83,6 @@ public: /*virtual*/ void tabClose(); void showStub(bool visible); - static LLFloater* getCurrentVoiceFloater(); static LLFloaterIMContainer* findInstance(); static LLFloaterIMContainer* getInstance(); @@ -97,7 +96,7 @@ public: static void idle(void* user_data); // LLIMSessionObserver observe triggers - /*virtual*/ void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, BOOL has_offline_msg); + /*virtual*/ void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, bool has_offline_msg); /*virtual*/ void sessionActivated(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id); /*virtual*/ void sessionVoiceOrIMStarted(const LLUUID& session_id); /*virtual*/ void sessionRemoved(const LLUUID& session_id); @@ -116,11 +115,11 @@ public: void doToParticipants(const std::string& item, uuid_vec_t& selectedIDS); void assignResizeLimits(); - virtual BOOL handleKeyHere(KEY key, MASK mask ); + virtual bool handleKeyHere(KEY key, MASK mask ); /*virtual*/ void closeFloater(bool app_quitting = false); void closeAllConversations(); void closeSelectedConversations(const uuid_vec_t& ids); - /*virtual*/ BOOL isFrontmost(); + /*virtual*/ bool isFrontmost(); private: @@ -147,7 +146,7 @@ private: void onAddButtonClicked(); void onAvatarPicked(const uuid_vec_t& ids); - BOOL isActionChecked(const LLSD& userdata); + bool isActionChecked(const LLSD& userdata); void onCustomAction (const LLSD& userdata); void setSortOrderSessions(const LLConversationFilter::ESortOrderType order); void setSortOrderParticipants(const LLConversationFilter::ESortOrderType order); @@ -213,7 +212,7 @@ public: void highlightConversationItemWidget(const LLUUID& session_id, bool is_highlighted); bool isScrolledOutOfSight(LLConversationViewSession* conversation_item_widget); boost::signals2::connection mMicroChangedSignal; - S32 getConversationListItemSize() { return mConversationsWidgets.size(); } + S32 getConversationListItemSize() { return static_cast<S32>(mConversationsWidgets.size()); } typedef std::list<LLFloater*> floater_list_t; void getDetachedConversationFloaters(floater_list_t& floaters); diff --git a/indra/newview/llfloaterimnearbychat.cpp b/indra/newview/llfloaterimnearbychat.cpp index e64f468cbe..28c651f0cd 100644 --- a/indra/newview/llfloaterimnearbychat.cpp +++ b/indra/newview/llfloaterimnearbychat.cpp @@ -71,9 +71,9 @@ S32 LLFloaterIMNearbyChat::sLastSpecialChatChannel = 0; -const S32 EXPANDED_HEIGHT = 266; -const S32 COLLAPSED_HEIGHT = 60; -const S32 EXPANDED_MIN_HEIGHT = 150; +constexpr S32 EXPANDED_HEIGHT = 266; +constexpr S32 COLLAPSED_HEIGHT = 60; +constexpr S32 EXPANDED_MIN_HEIGHT = 150; // legacy callback glue void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel); @@ -120,10 +120,10 @@ LLFloaterIMNearbyChat* LLFloaterIMNearbyChat::buildFloater(const LLSD& key) } //virtual -BOOL LLFloaterIMNearbyChat::postBuild() +bool LLFloaterIMNearbyChat::postBuild() { - setIsSingleInstance(TRUE); - BOOL result = LLFloaterIMSessionTab::postBuild(); + setIsSingleInstance(true); + bool result = LLFloaterIMSessionTab::postBuild(); mInputEditor->setAutoreplaceCallback(boost::bind(&LLAutoReplace::autoreplaceCallback, LLAutoReplace::getInstance(), _1, _2, _3, _4, _5)); mInputEditor->setCommitCallback(boost::bind(&LLFloaterIMNearbyChat::onChatBoxCommit, this)); @@ -154,7 +154,7 @@ void LLFloaterIMNearbyChat::closeHostedFloater() // If detached from conversations window close anyway if (!getHost()) { - setVisible(FALSE); + setVisible(false); } // Should check how many conversations are ongoing. Select next to "Nearby Chat" in case there are some other besides. @@ -270,7 +270,7 @@ void LLFloaterIMNearbyChat::removeScreenChat() } -void LLFloaterIMNearbyChat::setVisible(BOOL visible) +void LLFloaterIMNearbyChat::setVisible(bool visible) { LLFloaterIMSessionTab::setVisible(visible); @@ -281,7 +281,7 @@ void LLFloaterIMNearbyChat::setVisible(BOOL visible) } -void LLFloaterIMNearbyChat::setVisibleAndFrontmost(BOOL take_focus, const LLSD& key) +void LLFloaterIMNearbyChat::setVisibleAndFrontmost(bool take_focus, const LLSD& key) { LLFloaterIMSessionTab::setVisibleAndFrontmost(take_focus, key); @@ -382,7 +382,7 @@ void LLFloaterIMNearbyChat::showHistory() } else { - LLFloaterIMContainer::getInstance()->setFocus(TRUE); + LLFloaterIMContainer::getInstance()->setFocus(true); } setResizeLimits(getMinWidth(), EXPANDED_MIN_HEIGHT); } @@ -393,21 +393,21 @@ std::string LLFloaterIMNearbyChat::getCurrentChat() } // virtual -BOOL LLFloaterIMNearbyChat::handleKeyHere( KEY key, MASK mask ) +bool LLFloaterIMNearbyChat::handleKeyHere( KEY key, MASK mask ) { - BOOL handled = FALSE; + bool handled = false; if( KEY_RETURN == key && mask == MASK_CONTROL) { // shout sendChat(CHAT_TYPE_SHOUT); - handled = TRUE; + handled = true; } else if (KEY_RETURN == key && mask == MASK_SHIFT) { // whisper sendChat(CHAT_TYPE_WHISPER); - handled = TRUE; + handled = true; } @@ -417,21 +417,21 @@ BOOL LLFloaterIMNearbyChat::handleKeyHere( KEY key, MASK mask ) if ((KEY_UP == key) || (KEY_LEFT == key)) { floater_container->selectNextorPreviousConversation(false); - handled = TRUE; + handled = true; } if ((KEY_DOWN == key ) || (KEY_RIGHT == key)) { floater_container->selectNextorPreviousConversation(true); - handled = TRUE; + handled = true; } } return handled; } -BOOL LLFloaterIMNearbyChat::matchChatTypeTrigger(const std::string& in_str, std::string* out_str) +bool LLFloaterIMNearbyChat::matchChatTypeTrigger(const std::string& in_str, std::string* out_str) { - U32 in_len = in_str.length(); + auto in_len = in_str.length(); S32 cnt = sizeof(sChatTypeTriggers) / sizeof(*sChatTypeTriggers); bool string_was_found = false; @@ -470,7 +470,7 @@ void LLFloaterIMNearbyChat::onChatBoxKeystroke() // to eat trailing spaces that might be part of a gesture. LLWStringUtil::trimHead(raw_text); - S32 length = raw_text.length(); + auto length = raw_text.length(); if( (length > 0) && (raw_text[0] != '/') ) // forward slash is used for escape (eg. emote) sequences { @@ -517,7 +517,7 @@ void LLFloaterIMNearbyChat::onChatBoxKeystroke() mInputEditor->setText(utf8_trigger + rest_of_match); // keep original capitalization for user-entered part // Select to end of line, starting from the character // after the last one the user typed. - mInputEditor->selectByCursorPosition(utf8_out_str.size()-rest_of_match.size(),utf8_out_str.size()); + mInputEditor->selectByCursorPosition(static_cast<S32>(utf8_out_str.size() - rest_of_match.size()), static_cast<S32>(utf8_out_str.size())); } } @@ -549,7 +549,7 @@ void LLFloaterIMNearbyChat::onChatBoxFocusReceived() EChatType LLFloaterIMNearbyChat::processChatTypeTriggers(EChatType type, std::string &str) { - U32 length = str.length(); + auto length = str.length(); S32 cnt = sizeof(sChatTypeTriggers) / sizeof(*sChatTypeTriggers); for (S32 n = 0; n < cnt; n++) @@ -560,7 +560,7 @@ EChatType LLFloaterIMNearbyChat::processChatTypeTriggers(EChatType type, std::st if (!LLStringUtil::compareInsensitive(trigger, sChatTypeTriggers[n].name)) { - U32 trigger_length = sChatTypeTriggers[n].name.length(); + auto trigger_length = sChatTypeTriggers[n].name.length(); // It's to remove space after trigger name if (length > trigger_length && str[trigger_length] == ' ') @@ -682,8 +682,8 @@ void LLFloaterIMNearbyChat::displaySpeakingIndicator() LLUUID id; id.setNull(); - mSpeakerMgr->update(FALSE); - mSpeakerMgr->getSpeakerList(&speaker_list, FALSE); + mSpeakerMgr->update(false); + mSpeakerMgr->getSpeakerList(&speaker_list, false); for (LLSpeakerMgr::speaker_list_t::iterator i = speaker_list.begin(); i != speaker_list.end(); ++i) { @@ -696,12 +696,12 @@ void LLFloaterIMNearbyChat::displaySpeakingIndicator() } } -void LLFloaterIMNearbyChat::sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate) +void LLFloaterIMNearbyChat::sendChatFromViewer(const std::string &utf8text, EChatType type, bool animate) { sendChatFromViewer(utf8str_to_wstring(utf8text), type, animate); } -void LLFloaterIMNearbyChat::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate) +void LLFloaterIMNearbyChat::sendChatFromViewer(const LLWString &wtext, EChatType type, bool animate) { // Look for "/20 foo" channel chats. S32 channel = 0; @@ -754,8 +754,8 @@ void LLFloaterIMNearbyChat::sendChatFromViewer(const LLWString &wtext, EChatType bool LLFloaterIMNearbyChat::isWordsName(const std::string& name) { // checking to see if it's display name plus username in parentheses - S32 open_paren = name.find(" (", 0); - S32 close_paren = name.find(')', 0); + auto open_paren = name.find(" (", 0); + auto close_paren = name.find(')', 0); if (open_paren != std::string::npos && close_paren == name.length()-1) @@ -765,7 +765,7 @@ bool LLFloaterIMNearbyChat::isWordsName(const std::string& name) else { //checking for a single space - S32 pos = name.find(' ', 0); + auto pos = name.find(' ', 0); return std::string::npos != pos && name.rfind(' ', name.length()) == pos && 0 != pos && name.length()-1 != pos; } } @@ -785,7 +785,7 @@ void LLFloaterIMNearbyChat::startChat(const char* line) nearby_chat->setMinimized(false); } nearby_chat->show(); - nearby_chat->setFocus(TRUE); + nearby_chat->setFocus(true); if (line) { @@ -804,7 +804,7 @@ void LLFloaterIMNearbyChat::stopChat() LLFloaterIMNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat"); if (nearby_chat) { - nearby_chat->mInputEditor->setFocus(FALSE); + nearby_chat->mInputEditor->setFocus(false); gAgent.stopTyping(); } } diff --git a/indra/newview/llfloaterimnearbychat.h b/indra/newview/llfloaterimnearbychat.h index 2c2e19e9ca..abcaa13442 100644 --- a/indra/newview/llfloaterimnearbychat.h +++ b/indra/newview/llfloaterimnearbychat.h @@ -50,11 +50,11 @@ public: static LLFloaterIMNearbyChat* buildFloater(const LLSD& key); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void onClose(bool app_quitting); - /*virtual*/ void setVisible(BOOL visible); - /*virtual*/ void setVisibleAndFrontmost(BOOL take_focus=TRUE, const LLSD& key = LLSD()); + /*virtual*/ void setVisible(bool visible); + /*virtual*/ void setVisibleAndFrontmost(bool take_focus=true, const LLSD& key = LLSD()); /*virtual*/ void closeHostedFloater(); void loadHistory(); @@ -70,22 +70,22 @@ public: LLChatEntry* getChatBox() { return mInputEditor; } std::string getCurrentChat(); - S32 getMessageArchiveLength() {return mMessageArchive.size();} + S32 getMessageArchiveLength() { return static_cast<S32>(mMessageArchive.size()); } - virtual BOOL handleKeyHere( KEY key, MASK mask ); + virtual bool handleKeyHere( KEY key, MASK mask ); static void startChat(const char* line); static void stopChat(); - static void sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate); - static void sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate); + static void sendChatFromViewer(const std::string &utf8text, EChatType type, bool animate); + static void sendChatFromViewer(const LLWString &wtext, EChatType type, bool animate); static bool isWordsName(const std::string& name); void showHistory(); protected: - static BOOL matchChatTypeTrigger(const std::string& in_str, std::string* out_str); + static bool matchChatTypeTrigger(const std::string& in_str, std::string* out_str); void onChatBoxKeystroke(); void onChatBoxFocusLost(); void onChatBoxFocusReceived(); diff --git a/indra/newview/llfloaterimnearbychathandler.cpp b/indra/newview/llfloaterimnearbychathandler.cpp index 77ceea19af..ef7ec9e950 100644 --- a/indra/newview/llfloaterimnearbychathandler.cpp +++ b/indra/newview/llfloaterimnearbychathandler.cpp @@ -123,7 +123,7 @@ protected: { if (!toast) return; LL_DEBUGS("NearbyChat") << "Pooling toast" << LL_ENDL; - toast->setVisible(FALSE); + toast->setVisible(false); toast->stopTimer(); toast->setIsHidden(true); @@ -282,7 +282,7 @@ bool LLFloaterIMNearbyChatScreenChannel::createPoolToast() void LLFloaterIMNearbyChatScreenChannel::addChat(LLSD& chat) { //look in pool. if there is any message - if(mStopProcessing) + if (mStopProcessing) return; if (mFloaterSnapRegion == NULL) @@ -297,7 +297,7 @@ void LLFloaterIMNearbyChatScreenChannel::addChat(LLSD& chat) find last toast and check ID */ - if(m_active_toasts.size()) + if (m_active_toasts.size()) { LLUUID fromID = chat["from_id"].asUUID(); // agent id or object id std::string from = chat["from"].asString(); @@ -306,7 +306,7 @@ void LLFloaterIMNearbyChatScreenChannel::addChat(LLSD& chat) { LLFloaterIMNearbyChatToastPanel* panel = dynamic_cast<LLFloaterIMNearbyChatToastPanel*>(toast->getPanel()); - if(panel && panel->messageID() == fromID && panel->getFromName() == from && panel->canAddText()) + if (panel && panel->messageID() == fromID && panel->getFromName() == from && panel->canAddText()) { panel->addMessage(chat); toast->reshapeToPanel(); @@ -320,7 +320,7 @@ void LLFloaterIMNearbyChatScreenChannel::addChat(LLSD& chat) - if(m_toast_pool.empty()) + if (m_toast_pool.empty()) { //"pool" is empty - create one more panel LL_DEBUGS("NearbyChat") << "Empty pool" << LL_ENDL; @@ -332,15 +332,14 @@ void LLFloaterIMNearbyChatScreenChannel::addChat(LLSD& chat) int chat_type = chat["chat_type"].asInteger(); - if( ((EChatType)chat_type == CHAT_TYPE_DEBUG_MSG)) + if (chat_type == CHAT_TYPE_DEBUG_MSG) { - if(gSavedSettings.getBOOL("ShowScriptErrors") == FALSE) + if (!gSavedSettings.getBOOL("ShowScriptErrors")) return; - if(gSavedSettings.getS32("ShowScriptErrorsLocation")== 1) + if (gSavedSettings.getS32("ShowScriptErrorsLocation") == 1) return; } - //take 1st element from pool, (re)initialize it, put it in active toasts LL_DEBUGS("NearbyChat") << "Getting toast from pool" << LL_ENDL; @@ -350,7 +349,7 @@ void LLFloaterIMNearbyChatScreenChannel::addChat(LLSD& chat) LLFloaterIMNearbyChatToastPanel* panel = dynamic_cast<LLFloaterIMNearbyChatToastPanel*>(toast->getPanel()); - if(!panel) + if (!panel) return; panel->init(chat); @@ -442,7 +441,7 @@ void LLFloaterIMNearbyChatScreenChannel::arrangeToasts() if (toast) { toast->setIsHidden(false); - toast->setVisible(TRUE); + toast->setVisible(true); } } @@ -487,11 +486,11 @@ void LLFloaterIMNearbyChatHandler::initChannel() void LLFloaterIMNearbyChatHandler::processChat(const LLChat& chat_msg, const LLSD &args) { - if(chat_msg.mMuted == TRUE) + if (chat_msg.mMuted) return; - if(chat_msg.mText.empty()) - return;//don't process empty messages + if (chat_msg.mText.empty()) + return; // don't process empty messages LLFloaterReg::getInstance("im_container"); LLFloaterIMNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat"); @@ -522,9 +521,10 @@ void LLFloaterIMNearbyChatHandler::processChat(const LLChat& chat_msg, // errors in separate window. if (chat_msg.mChatType == CHAT_TYPE_DEBUG_MSG) { - if (LLFloater::isQuitRequested()) return; + if (LLFloater::isQuitRequested()) + return; - if(gSavedSettings.getBOOL("ShowScriptErrors") == FALSE) + if (!gSavedSettings.getBOOL("ShowScriptErrors")) return; // don't process debug messages from not owned objects, see EXT-7762 @@ -533,7 +533,7 @@ void LLFloaterIMNearbyChatHandler::processChat(const LLChat& chat_msg, return; } - if (gSavedSettings.getS32("ShowScriptErrorsLocation")== 1)// show error in window //("ScriptErrorsAsChat")) + if (gSavedSettings.getS32("ShowScriptErrorsLocation") == 1)// show error in window //("ScriptErrorsAsChat")) { LLColor4 txt_color; @@ -550,7 +550,7 @@ void LLFloaterIMNearbyChatHandler::processChat(const LLChat& chat_msg, nearby_chat->addMessage(chat_msg, true, args); - if(chat_msg.mSourceType == CHAT_SOURCE_AGENT + if (chat_msg.mSourceType == CHAT_SOURCE_AGENT && chat_msg.mFromID.notNull() && chat_msg.mFromID != gAgentID) { diff --git a/indra/newview/llfloaterimnearbychatlistener.cpp b/indra/newview/llfloaterimnearbychatlistener.cpp index 616acf0eae..43173d3680 100644 --- a/indra/newview/llfloaterimnearbychatlistener.cpp +++ b/indra/newview/llfloaterimnearbychatlistener.cpp @@ -95,6 +95,6 @@ void LLFloaterIMNearbyChatListener::sendChat(LLSD const & chat_data) const } // Send it as if it was typed in - mChatbar.sendChatFromViewer(chat_to_send, type_o_chat, ((BOOL)(channel == 0)) && gSavedSettings.getBOOL("PlayChatAnim")); + mChatbar.sendChatFromViewer(chat_to_send, type_o_chat, ((bool)(channel == 0)) && gSavedSettings.getBOOL("PlayChatAnim")); } diff --git a/indra/newview/llfloaterimsession.cpp b/indra/newview/llfloaterimsession.cpp index b782515c14..5dd78fe1db 100644 --- a/indra/newview/llfloaterimsession.cpp +++ b/indra/newview/llfloaterimsession.cpp @@ -109,7 +109,7 @@ void LLFloaterIMSession::refresh() if (mMeTypingTimer.getElapsedTimeF32() > ME_TYPING_TIMEOUT && false == mShouldSendTypingState) { LL_DEBUGS("TypingMsgs") << "Send additional Start Typing packet" << LL_ENDL; - LLIMModel::instance().sendTypingState(mSessionID, mOtherParticipantUUID, TRUE); + LLIMModel::instance().sendTypingState(mSessionID, mOtherParticipantUUID, true); mMeTypingTimer.reset(); } @@ -333,7 +333,7 @@ void LLFloaterIMSession::initIMFloater() // Disable input editor if session cannot accept text if ( mSession && !mSession->mTextIMPossible ) { - mInputEditor->setEnabled(FALSE); + mInputEditor->setEnabled(false); mInputEditor->setLabel(LLTrans::getString("IM_unavailable_text_label")); } @@ -345,9 +345,9 @@ void LLFloaterIMSession::initIMFloater() } //virtual -BOOL LLFloaterIMSession::postBuild() +bool LLFloaterIMSession::postBuild() { - BOOL result = LLFloaterIMSessionTab::postBuild(); + bool result = LLFloaterIMSessionTab::postBuild(); mInputEditor->setMaxTextLength(1023); mInputEditor->setAutoreplaceCallback(boost::bind(&LLAutoReplace::autoreplaceCallback, LLAutoReplace::getInstance(), _1, _2, _3, _4, _5)); @@ -380,7 +380,7 @@ void LLFloaterIMSession::onAddButtonClicked() { LLView * button = findChild<LLView>("toolbar_panel")->findChild<LLButton>("add_btn"); LLFloater* root_floater = gFloaterView->getParentFloater(this); - LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLFloaterIMSession::addSessionParticipants, this, _1), TRUE, TRUE, FALSE, root_floater->getName(), button); + LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLFloaterIMSession::addSessionParticipants, this, _1), true, true, false, root_floater->getName(), button); if (!picker) { return; @@ -615,13 +615,13 @@ LLFloaterIMSession* LLFloaterIMSession::show(const LLUUID& session_id) LLTabContainer::eInsertionPoint i_pt = LLTabContainer::END; if (floater_container) { - floater_container->addFloater(floater, TRUE, i_pt); + floater_container->addFloater(floater, true, i_pt); } } floater->openFloater(floater->getKey()); - floater->setVisible(TRUE); + floater->setVisible(true); return floater; } @@ -679,7 +679,7 @@ void LLFloaterIMSession::setDocked(bool docked, bool pop_on_undock) } } -void LLFloaterIMSession::setMinimized(BOOL b) +void LLFloaterIMSession::setMinimized(bool b) { bool wasMinimized = isMinimized(); LLFloaterIMSessionTab::setMinimized(b); @@ -696,7 +696,7 @@ void LLFloaterIMSession::setMinimized(BOOL b) } } -void LLFloaterIMSession::setVisible(BOOL visible) +void LLFloaterIMSession::setVisible(bool visible) { LLNotificationsUI::LLScreenChannel* channel = static_cast<LLNotificationsUI::LLScreenChannel*> (LLNotificationsUI::LLChannelManager::getInstance()-> @@ -732,7 +732,7 @@ void LLFloaterIMSession::setVisible(BOOL visible) } -BOOL LLFloaterIMSession::getVisible() +bool LLFloaterIMSession::getVisible() { bool visible; @@ -751,7 +751,7 @@ BOOL LLFloaterIMSession::getVisible() } else { - // getVisible() returns TRUE when Tabbed IM window is minimized. + // getVisible() returns true when Tabbed IM window is minimized. visible = is_active && !im_container->isMinimized() && im_container->getVisible(); } @@ -764,7 +764,7 @@ BOOL LLFloaterIMSession::getVisible() return visible; } -void LLFloaterIMSession::setFocus(BOOL focus) +void LLFloaterIMSession::setFocus(bool focus) { LLFloaterIMSessionTab::setFocus(focus); @@ -792,8 +792,8 @@ bool LLFloaterIMSession::toggle(const LLUUID& session_id) } else if(floater && ((!floater->isDocked() || floater->getVisible()) && !floater->hasFocus())) { - floater->setVisible(TRUE); - floater->setFocus(TRUE); + floater->setVisible(true); + floater->setFocus(true); return true; } } @@ -999,7 +999,7 @@ void LLFloaterIMSession::setTyping(bool typing) if ( mTypingTimer.getElapsedTimeF32() > 1.f ) { // Still typing, send 'start typing' notification - LLIMModel::instance().sendTypingState(mSessionID, mOtherParticipantUUID, TRUE); + LLIMModel::instance().sendTypingState(mSessionID, mOtherParticipantUUID, true); mShouldSendTypingState = false; mMeTypingTimer.reset(); } @@ -1007,7 +1007,7 @@ void LLFloaterIMSession::setTyping(bool typing) else { // Send 'stop typing' notification immediately - LLIMModel::instance().sendTypingState(mSessionID, mOtherParticipantUUID, FALSE); + LLIMModel::instance().sendTypingState(mSessionID, mOtherParticipantUUID, false); mShouldSendTypingState = false; } } @@ -1017,12 +1017,12 @@ void LLFloaterIMSession::setTyping(bool typing) LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID); if (speaker_mgr) { - speaker_mgr->setSpeakerTyping(gAgent.getID(), FALSE); + speaker_mgr->setSpeakerTyping(gAgent.getID(), false); } } } -void LLFloaterIMSession::processIMTyping(const LLUUID& from_id, BOOL typing) +void LLFloaterIMSession::processIMTyping(const LLUUID& from_id, bool typing) { LL_DEBUGS("TypingMsgs") << "typing=" << typing << LL_ENDL; if ( typing ) @@ -1063,7 +1063,7 @@ void LLFloaterIMSession::processAgentListUpdates(const LLSD& body) // process the moderator mutes if (agent_id == gAgentID && agent_data.has("info") && agent_data["info"].has("mutes")) { - BOOL moderator_muted_text = agent_data["info"]["mutes"]["text"].asBoolean(); + bool moderator_muted_text = agent_data["info"]["mutes"]["text"].asBoolean(); mInputEditor->setEnabled(!moderator_muted_text); std::string label; if (moderator_muted_text) @@ -1108,7 +1108,7 @@ void LLFloaterIMSession::processSessionUpdate(const LLSD& session_update) if ( false && session_update.has("moderated_mode") && session_update["moderated_mode"].has("voice") ) { - BOOL voice_moderated = session_update["moderated_mode"]["voice"]; + bool voice_moderated = session_update["moderated_mode"]["voice"]; const std::string session_label = LLIMModel::instance().getName(mSessionID); if (voice_moderated) @@ -1141,7 +1141,7 @@ void LLFloaterIMSession::draw() } // virtual -BOOL LLFloaterIMSession::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +bool LLFloaterIMSession::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -1164,7 +1164,7 @@ BOOL LLFloaterIMSession::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, cargo_type, cargo_data, accept); } - return TRUE; + return true; } bool LLFloaterIMSession::dropPerson(LLUUID* person_id, bool drop) @@ -1187,21 +1187,21 @@ bool LLFloaterIMSession::dropPerson(LLUUID* person_id, bool drop) return res; } -BOOL LLFloaterIMSession::isInviteAllowed() const +bool LLFloaterIMSession::isInviteAllowed() const { return ( (IM_SESSION_CONFERENCE_START == mDialog) || (IM_SESSION_INVITE == mDialog && !gAgent.isInGroup(mSessionID)) || mIsP2PChat); } -BOOL LLFloaterIMSession::inviteToSession(const uuid_vec_t& ids) +bool LLFloaterIMSession::inviteToSession(const uuid_vec_t& ids) { LLViewerRegion* region = gAgent.getRegion(); bool is_region_exist = region != NULL; if (is_region_exist) { - S32 count = ids.size(); + auto count = ids.size(); if( isInviteAllowed() && (count > 0) ) { @@ -1211,7 +1211,7 @@ BOOL LLFloaterIMSession::inviteToSession(const uuid_vec_t& ids) LLSD data; data["params"] = LLSD::emptyArray(); - for (int i = 0; i < count; i++) + for (size_t i = 0; i < count; i++) { data["params"].append(ids[i]); } @@ -1275,7 +1275,7 @@ Note: OTHER_TYPING_TIMEOUT must be > ME_TYPING_TIMEOUT for proper operation of t LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID); if ( speaker_mgr ) { - speaker_mgr->setSpeakerTyping(from_id, TRUE); + speaker_mgr->setSpeakerTyping(from_id, true); } } } @@ -1292,7 +1292,7 @@ void LLFloaterIMSession::removeTypingIndicator(const LLUUID& from_id) LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID); if (speaker_mgr) { - speaker_mgr->setSpeakerTyping(from_id, FALSE); + speaker_mgr->setSpeakerTyping(from_id, false); } } } diff --git a/indra/newview/llfloaterimsession.h b/indra/newview/llfloaterimsession.h index 5180b0cee1..7bc54cf3da 100644 --- a/indra/newview/llfloaterimsession.h +++ b/indra/newview/llfloaterimsession.h @@ -64,15 +64,15 @@ public: void initIMFloater(); // LLView overrides - /*virtual*/ BOOL postBuild(); - /*virtual*/ void setMinimized(BOOL b); - /*virtual*/ void setVisible(BOOL visible); - /*virtual*/ BOOL getVisible(); - /*virtual*/ void setFocus(BOOL focus); + /*virtual*/ bool postBuild(); + /*virtual*/ void setMinimized(bool b); + /*virtual*/ void setVisible(bool visible); + /*virtual*/ bool getVisible(); + /*virtual*/ void setFocus(bool focus); // Check typing timeout timer. /*virtual*/ void draw(); - /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + /*virtual*/ bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -121,7 +121,7 @@ public: const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state); - void processIMTyping(const LLUUID& from_id, BOOL typing); + void processIMTyping(const LLUUID& from_id, bool typing); void processAgentListUpdates(const LLSD& body); void processSessionUpdate(const LLSD& session_update); @@ -147,8 +147,8 @@ private: bool dropPerson(LLUUID* person_id, bool drop); - BOOL isInviteAllowed() const; - BOOL inviteToSession(const uuid_vec_t& agent_ids); + bool isInviteAllowed() const; + bool inviteToSession(const uuid_vec_t& agent_ids); static void onInputEditorFocusReceived( LLFocusableElement* caller,void* userdata ); static void onInputEditorFocusLost(LLFocusableElement* caller, void* userdata); static void onInputEditorKeystroke(LLTextEditor* caller, void* userdata); diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index 0ed84c381f..a0b56b14f0 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -78,7 +78,7 @@ LLFloaterIMSessionTab::LLFloaterIMSessionTab(const LLSD& session_id) mInputPanels(NULL), mChatLayoutPanelHeight(0) { - setAutoFocus(FALSE); + setAutoFocus(false); mSession = LLIMModel::getInstance()->findIMSession(mSessionID); mCommitCallbackRegistrar.add("IMSession.Menu.Action", @@ -161,7 +161,7 @@ LLFloaterIMSessionTab* LLFloaterIMSessionTab::getConversation(const LLUUID& uuid }; // virtual -void LLFloaterIMSessionTab::setVisible(BOOL visible) +void LLFloaterIMSessionTab::setVisible(bool visible) { if (visible && !mHasVisibleBeenInitialized) { @@ -184,7 +184,7 @@ void LLFloaterIMSessionTab::setVisible(BOOL visible) } // virtual -void LLFloaterIMSessionTab::setFocus(BOOL focus) +void LLFloaterIMSessionTab::setFocus(bool focus) { super::setFocus(focus); @@ -195,7 +195,7 @@ void LLFloaterIMSessionTab::setFocus(BOOL focus) if (mInputEditor) { - mInputEditor->setFocus(TRUE); + mInputEditor->setFocus(true); } } } @@ -258,9 +258,9 @@ void LLFloaterIMSessionTab::assignResizeLimits() } // virtual -BOOL LLFloaterIMSessionTab::postBuild() +bool LLFloaterIMSessionTab::postBuild() { - BOOL result; + bool result; mBodyStack = getChild<LLLayoutStack>("main_stack"); mParticipantListAndHistoryStack = getChild<LLLayoutStack>("im_panels"); @@ -329,8 +329,8 @@ BOOL LLFloaterIMSessionTab::postBuild() mInputEditor->setTextExpandedCallback(boost::bind(&LLFloaterIMSessionTab::reshapeChatLayoutPanel, this)); mInputEditor->setMouseUpCallback(boost::bind(&LLFloaterIMSessionTab::onInputEditorClicked, this)); - mInputEditor->setCommitOnFocusLost( FALSE ); - mInputEditor->setPassDelete(TRUE); + mInputEditor->setCommitOnFocusLost( false ); + mInputEditor->setPassDelete(true); mInputEditor->setFont(LLViewerChat::getChatFont()); mChatLayoutPanelHeight = mChatLayoutPanel->getRect().getHeight(); @@ -477,19 +477,19 @@ void LLFloaterIMSessionTab::onInputEditorClicked() void LLFloaterIMSessionTab::onEmojiRecentPanelToggleBtnClicked() { - BOOL show = mEmojiRecentPanel->getVisible() ? FALSE : TRUE; + bool show = !mEmojiRecentPanel->getVisible(); if (show) { initEmojiRecentPanel(); } mEmojiRecentPanel->setVisible(show); - mInputEditor->setFocus(TRUE); + mInputEditor->setFocus(true); } void LLFloaterIMSessionTab::onEmojiPickerShowBtnClicked() { - mInputEditor->setFocus(TRUE); + mInputEditor->setFocus(true); mInputEditor->showEmojiHelper(); } @@ -498,8 +498,8 @@ void LLFloaterIMSessionTab::initEmojiRecentPanel() std::list<llwchar>& recentlyUsed = LLFloaterEmojiPicker::getRecentlyUsed(); if (recentlyUsed.empty()) { - mEmojiRecentEmptyText->setVisible(TRUE); - mEmojiRecentContainer->setVisible(FALSE); + mEmojiRecentEmptyText->setVisible(true); + mEmojiRecentContainer->setVisible(false); } else { @@ -509,8 +509,8 @@ void LLFloaterIMSessionTab::initEmojiRecentPanel() emojis += emoji; } mEmojiRecentIconsCtrl->setEmojis(emojis); - mEmojiRecentEmptyText->setVisible(FALSE); - mEmojiRecentContainer->setVisible(TRUE); + mEmojiRecentEmptyText->setVisible(false); + mEmojiRecentContainer->setVisible(true); } } @@ -587,13 +587,13 @@ void LLFloaterIMSessionTab::appendMessage(const LLChat& chat, const LLSD& args) mChatHistory->appendMessage(chat, chat_args); } -void LLFloaterIMSessionTab::updateUsedEmojis(LLWString text) +void LLFloaterIMSessionTab::updateUsedEmojis(LLWStringView text) { LLEmojiDictionary* dictionary = LLEmojiDictionary::getInstance(); llassert_always(dictionary); bool emojiSent = false; - for (llwchar& c : text) + for (const llwchar& c : text) { if (dictionary->isEmoji(c)) { @@ -674,7 +674,7 @@ void LLFloaterIMSessionTab::addConversationViewParticipant(LLConversationItem* p mConversationsWidgets[uuid] = participant_view; participant_view->addToFolder(mConversationsRoot); participant_view->addToSession(mSessionID); - participant_view->setVisible(TRUE); + participant_view->setVisible(true); } } @@ -688,7 +688,7 @@ void LLFloaterIMSessionTab::removeConversationViewParticipant(const LLUUID& part { // This is the last pointer, remove participant from session // before participant gets deleted on destroyView. - // + // // Floater (widget) and participant's view can simultaneously // co-own the model, in which case view is responsible for // the deletion and floater is free to clear and recreate @@ -697,7 +697,7 @@ void LLFloaterIMSessionTab::removeConversationViewParticipant(const LLUUID& part // See "add_participant". // // Todo: If it keeps causing issues turn participants - // into LLPointers in the session + // into LLPointers in the session LLParticipantList* session = getParticipantList(); if (session) { @@ -740,7 +740,7 @@ void LLFloaterIMSessionTab::refreshConversation() if (widget_it->second->getViewModelItem()) { widget_it->second->refresh(); - widget_it->second->setVisible(TRUE); + widget_it->second->setVisible(true); } ++widget_it; } @@ -985,7 +985,7 @@ void LLFloaterIMSessionTab::forceReshape() void LLFloaterIMSessionTab::reshapeChatLayoutPanel() { - mChatLayoutPanel->reshape(mChatLayoutPanel->getRect().getWidth(), mInputEditor->getRect().getHeight() + mInputEditorPad, FALSE); + mChatLayoutPanel->reshape(mChatLayoutPanel->getRect().getWidth(), mInputEditor->getRect().getHeight() + mInputEditorPad, false); } // static @@ -1146,7 +1146,7 @@ void LLFloaterIMSessionTab::onOpen(const LLSD& key) mInputButtonPanel->setVisible(isTornOff()); - setFocus(TRUE); + setFocus(true); } @@ -1178,8 +1178,7 @@ void LLFloaterIMSessionTab::onTearOffClicked() void LLFloaterIMSessionTab::updateGearBtn() { - - BOOL prevVisibility = mGearBtn->getVisible(); + bool prevVisibility = mGearBtn->getVisible(); mGearBtn->setVisible(checkIfTornOff() && mIsP2PChat); @@ -1324,9 +1323,9 @@ LLView* LLFloaterIMSessionTab::getChatHistory() return mChatHistory; } -BOOL LLFloaterIMSessionTab::handleKeyHere(KEY key, MASK mask ) +bool LLFloaterIMSessionTab::handleKeyHere(KEY key, MASK mask ) { - BOOL handled = FALSE; + bool handled = false; if(mask == MASK_ALT) { @@ -1334,17 +1333,17 @@ BOOL LLFloaterIMSessionTab::handleKeyHere(KEY key, MASK mask ) if (KEY_RETURN == key && !isTornOff()) { floater_container->expandConversation(); - handled = TRUE; + handled = true; } if ((KEY_UP == key) || (KEY_LEFT == key)) { floater_container->selectNextorPreviousConversation(false); - handled = TRUE; + handled = true; } if ((KEY_DOWN == key ) || (KEY_RIGHT == key)) { floater_container->selectNextorPreviousConversation(true); - handled = TRUE; + handled = true; } } return handled; diff --git a/indra/newview/llfloaterimsessiontab.h b/indra/newview/llfloaterimsessiontab.h index 00b43f499b..0a8502cfc5 100644 --- a/indra/newview/llfloaterimsessiontab.h +++ b/indra/newview/llfloaterimsessiontab.h @@ -77,10 +77,10 @@ public: // LLFloater overrides /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void draw(); - /*virtual*/ void setVisible(BOOL visible); - /*virtual*/ void setFocus(BOOL focus); + /*virtual*/ void setVisible(bool visible); + /*virtual*/ void setFocus(bool focus); /*virtual*/ void closeFloater(bool app_quitting = false); // Handle the left hand participant list widgets @@ -97,7 +97,7 @@ public: virtual void updateMessages() {} LLConversationItem* getCurSelectedViewModelItem(); void forceReshape(); - virtual BOOL handleKeyHere( KEY key, MASK mask ); + virtual bool handleKeyHere( KEY key, MASK mask ); bool isMessagePaneExpanded(){return mMessagePaneExpanded;} void setMessagePaneExpanded(bool expanded){mMessagePaneExpanded = expanded;} void restoreFloater(); @@ -147,7 +147,7 @@ protected: std::string appendTime(); void assignResizeLimits(); - void updateUsedEmojis(LLWString text); + void updateUsedEmojis(LLWStringView text); S32 mFloaterExtraWidth; diff --git a/indra/newview/llfloaterinspect.cpp b/indra/newview/llfloaterinspect.cpp index 7190bccb81..4f993ca0e1 100644 --- a/indra/newview/llfloaterinspect.cpp +++ b/indra/newview/llfloaterinspect.cpp @@ -47,7 +47,7 @@ LLFloaterInspect::LLFloaterInspect(const LLSD& key) : LLFloater(key), - mDirty(FALSE), + mDirty(false), mOwnerNameCacheConnection(), mCreatorNameCacheConnection() { @@ -56,7 +56,7 @@ LLFloaterInspect::LLFloaterInspect(const LLSD& key) mCommitCallbackRegistrar.add("Inspect.SelectObject", boost::bind(&LLFloaterInspect::onSelectObject, this)); } -BOOL LLFloaterInspect::postBuild() +bool LLFloaterInspect::postBuild() { mObjectList = getChild<LLScrollListCtrl>("object_list"); // childSetAction("button owner",onClickOwnerProfile, this); @@ -65,7 +65,7 @@ BOOL LLFloaterInspect::postBuild() refresh(); - return TRUE; + return true; } LLFloaterInspect::~LLFloaterInspect(void) @@ -89,13 +89,13 @@ LLFloaterInspect::~LLFloaterInspect(void) } else { - LLFloaterReg::showInstance("build", LLSD(), TRUE); + LLFloaterReg::showInstance("build", LLSD(), true); } } void LLFloaterInspect::onOpen(const LLSD& key) { - BOOL forcesel = LLSelectMgr::getInstance()->setForceSelection(TRUE); + bool forcesel = LLSelectMgr::getInstance()->setForceSelection(true); LLToolMgr::getInstance()->setTransientTool(LLToolCompInspect::getInstance()); LLSelectMgr::getInstance()->setForceSelection(forcesel); // restore previouis value mObjectSelection = LLSelectMgr::getInstance()->getSelection(); @@ -345,7 +345,7 @@ void LLFloaterInspect::draw() if (mDirty) { refresh(); - mDirty = FALSE; + mDirty = false; } LLFloater::draw(); diff --git a/indra/newview/llfloaterinspect.h b/indra/newview/llfloaterinspect.h index a18aba1155..961c6c8dc3 100644 --- a/indra/newview/llfloaterinspect.h +++ b/indra/newview/llfloaterinspect.h @@ -44,12 +44,12 @@ public: // static void show(void* ignored = NULL); void onOpen(const LLSD& key); - virtual BOOL postBuild(); + virtual bool postBuild(); void dirty(); LLUUID getSelectedUUID(); virtual void draw(); virtual void refresh(); -// static BOOL isVisible(); +// static bool isVisible(); virtual void onFocusReceived(); void onClickCreatorProfile(); void onClickOwnerProfile(); @@ -58,7 +58,7 @@ public: LLScrollListCtrl* mObjectList; protected: // protected members - void setDirty() { mDirty = TRUE; } + void setDirty() { mDirty = true; } bool mDirty; private: diff --git a/indra/newview/llfloaterinventorysettings.cpp b/indra/newview/llfloaterinventorysettings.cpp index 29d6e90a33..e5ee69f240 100644 --- a/indra/newview/llfloaterinventorysettings.cpp +++ b/indra/newview/llfloaterinventorysettings.cpp @@ -36,9 +36,9 @@ LLFloaterInventorySettings::LLFloaterInventorySettings(const LLSD& key) LLFloaterInventorySettings::~LLFloaterInventorySettings() {} -BOOL LLFloaterInventorySettings::postBuild() +bool LLFloaterInventorySettings::postBuild() { getChild<LLButton>("ok_btn")->setCommitCallback(boost::bind(&LLFloater::closeFloater, this, false)); - return TRUE; + return true; } diff --git a/indra/newview/llfloaterinventorysettings.h b/indra/newview/llfloaterinventorysettings.h index 50304276c7..3fe3a001b9 100644 --- a/indra/newview/llfloaterinventorysettings.h +++ b/indra/newview/llfloaterinventorysettings.h @@ -35,7 +35,7 @@ class LLFloaterInventorySettings friend class LLFloaterReg; public: - virtual BOOL postBuild(); + bool postBuild() override; private: LLFloaterInventorySettings(const LLSD& key); diff --git a/indra/newview/llfloaterinventorythumbnailshelper.cpp b/indra/newview/llfloaterinventorythumbnailshelper.cpp index 814f88e9b9..9775eda697 100644 --- a/indra/newview/llfloaterinventorythumbnailshelper.cpp +++ b/indra/newview/llfloaterinventorythumbnailshelper.cpp @@ -52,7 +52,7 @@ LLFloaterInventoryThumbnailsHelper::~LLFloaterInventoryThumbnailsHelper() { } -BOOL LLFloaterInventoryThumbnailsHelper::postBuild() +bool LLFloaterInventoryThumbnailsHelper::postBuild() { mInventoryThumbnailsList = getChild<LLScrollListCtrl>("inventory_thumbnails_list"); mInventoryThumbnailsList->setAllowMultipleSelection(true); diff --git a/indra/newview/llfloaterinventorythumbnailshelper.h b/indra/newview/llfloaterinventorythumbnailshelper.h index b42a85d1a5..71eeef31ee 100644 --- a/indra/newview/llfloaterinventorythumbnailshelper.h +++ b/indra/newview/llfloaterinventorythumbnailshelper.h @@ -40,7 +40,7 @@ class LLFloaterInventoryThumbnailsHelper: friend class LLFloaterReg; private: LLFloaterInventoryThumbnailsHelper(const LLSD& key); - BOOL postBuild() override; + bool postBuild() override; ~LLFloaterInventoryThumbnailsHelper(); LLScrollListCtrl* mInventoryThumbnailsList; diff --git a/indra/newview/llfloaterjoystick.cpp b/indra/newview/llfloaterjoystick.cpp index 128cf56be0..7db3621a4b 100644 --- a/indra/newview/llfloaterjoystick.cpp +++ b/indra/newview/llfloaterjoystick.cpp @@ -132,7 +132,7 @@ void LLFloaterJoystick::draw() LLFloater::draw(); } -BOOL LLFloaterJoystick::postBuild() +bool LLFloaterJoystick::postBuild() { center(); F32 range = gSavedSettings.getBOOL("Cursor3D") ? 128.f : 2.f; @@ -160,7 +160,7 @@ BOOL LLFloaterJoystick::postBuild() refresh(); refreshListOfDevices(); - return TRUE; + return true; } LLFloaterJoystick::~LLFloaterJoystick() @@ -416,7 +416,7 @@ void LLFloaterJoystick::onCommitJoystickEnabled(LLUICtrl*, void *joy_panel) joystick_enabled = true; } gSavedSettings.setBOOL("JoystickEnabled", joystick_enabled); - BOOL flycam_enabled = self->mCheckFlycamEnabled->get(); + bool flycam_enabled = self->mCheckFlycamEnabled->get(); if (!joystick_enabled || !flycam_enabled) { diff --git a/indra/newview/llfloaterjoystick.h b/indra/newview/llfloaterjoystick.h index e304431153..b94223a738 100644 --- a/indra/newview/llfloaterjoystick.h +++ b/indra/newview/llfloaterjoystick.h @@ -39,7 +39,7 @@ class LLFloaterJoystick : public LLFloater public: - virtual BOOL postBuild(); + virtual bool postBuild(); virtual void refresh(); virtual void apply(); // Apply the changed values. virtual void cancel(); // Cancel the changed values. diff --git a/indra/newview/llfloaterlagmeter.cpp b/indra/newview/llfloaterlagmeter.cpp index 3d4d0e55d4..28fa8dea9a 100644 --- a/indra/newview/llfloaterlagmeter.cpp +++ b/indra/newview/llfloaterlagmeter.cpp @@ -50,11 +50,11 @@ LLFloaterLagMeter::LLFloaterLagMeter(const LLSD& key) mCommitCallbackRegistrar.add("LagMeter.ClickShrink", boost::bind(&LLFloaterLagMeter::onClickShrink, this)); } -BOOL LLFloaterLagMeter::postBuild() +bool LLFloaterLagMeter::postBuild() { // Don't let this window take keyboard focus -- it's confusing to // lose arrow-key driving when testing lag. - setIsChrome(TRUE); + setIsChrome(true); // were we shrunk last time? if (isShrunk()) @@ -117,7 +117,7 @@ BOOL LLFloaterLagMeter::postBuild() // childSetAction("minimize", onClickShrink, this); updateControls(isShrunk()); // if expanded append colon to the labels (EXT-4079) - return TRUE; + return true; } LLFloaterLagMeter::~LLFloaterLagMeter() { @@ -179,10 +179,6 @@ void LLFloaterLagMeter::determineClient() { mClientCause->setText( getString("client_texture_loading_cause_msg", mStringArgs) ); } - else if(LLViewerTexture::isMemoryForTextureLow()) - { - mClientCause->setText( getString("client_texture_memory_cause_msg", mStringArgs) ); - } else { mClientCause->setText( getString("client_complex_objects_cause_msg", mStringArgs) ); @@ -348,7 +344,7 @@ void LLFloaterLagMeter::updateControls(bool shrink) button->setLabel( getString("bigger_label", mStringArgs) ); } // Don't put keyboard focus on the button - button->setFocus(FALSE); + button->setFocus(false); // self->mClientText->setVisible(self->mShrunk); // self->mClientCause->setVisible(self->mShrunk); @@ -365,7 +361,7 @@ void LLFloaterLagMeter::updateControls(bool shrink) // self->mShrunk = !self->mShrunk; } -BOOL LLFloaterLagMeter::isShrunk() +bool LLFloaterLagMeter::isShrunk() { return gSavedSettings.getBOOL("LagMeterShrunk"); } diff --git a/indra/newview/llfloaterlagmeter.h b/indra/newview/llfloaterlagmeter.h index 774a42b2d3..1b5ff65781 100644 --- a/indra/newview/llfloaterlagmeter.h +++ b/indra/newview/llfloaterlagmeter.h @@ -37,7 +37,7 @@ class LLFloaterLagMeter : public LLFloater public: /*virtual*/ void draw(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); private: LLFloaterLagMeter(const LLSD& key); @@ -46,7 +46,7 @@ private: void determineNetwork(); void determineServer(); void updateControls(bool shrink); - BOOL isShrunk(); + bool isShrunk(); void onClickShrink(); diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index a6afa03e6a..9a794d1775 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -93,8 +93,8 @@ static std::string OWNER_GROUP = "2"; static std::string MATURITY = "[MATURITY]"; // constants used in callbacks below - syntactic sugar. -static const BOOL BUY_GROUP_LAND = TRUE; -static const BOOL BUY_PERSONAL_LAND = FALSE; +static const bool BUY_GROUP_LAND = true; +static const bool BUY_PERSONAL_LAND = false; LLPointer<LLParcelSelection> LLPanelLandGeneral::sSelectionForBuyPass = NULL; // Statics @@ -125,7 +125,7 @@ class LLPanelLandExperiences { public: LLPanelLandExperiences(LLSafeHandle<LLParcelSelection>& parcelp); - virtual BOOL postBuild(); + virtual bool postBuild(); void refresh(); void experienceAdded(const LLUUID& id, U32 xp_type, U32 access_type); @@ -155,7 +155,7 @@ public: return ((parcelp) ? (parcelp->getArea() >= MINIMUM_PARCEL_SIZE) : false); } - virtual BOOL postBuild() override; + virtual bool postBuild() override; virtual void refresh() override; virtual LLParcel * getParcel() override; @@ -318,7 +318,7 @@ LLFloaterLand::LLFloaterLand(const LLSD& seed) LLViewerParcelMgr::getInstance()->addObserver( sObserver ); } -BOOL LLFloaterLand::postBuild() +bool LLFloaterLand::postBuild() { setVisibleCallback(boost::bind(&LLFloaterLand::onVisibilityChanged, this, _2)); @@ -331,7 +331,7 @@ BOOL LLFloaterLand::postBuild() tab->selectTab(sLastTab); } - return TRUE; + return true; } @@ -439,19 +439,19 @@ void* LLFloaterLand::createPanelLandEnvironment(void* data) LLPanelLandGeneral::LLPanelLandGeneral(LLParcelSelectionHandle& parcel) : LLPanel(), - mUncheckedSell(FALSE), + mUncheckedSell(false), mParcel(parcel) { } -BOOL LLPanelLandGeneral::postBuild() +bool LLPanelLandGeneral::postBuild() { mEditName = getChild<LLLineEditor>("Name"); mEditName->setCommitCallback(onCommitAny, this); getChild<LLLineEditor>("Name")->setPrevalidate(LLTextValidate::validateASCIIPrintableNoPipe); mEditDesc = getChild<LLTextEditor>("Description"); - mEditDesc->setCommitOnFocusLost(TRUE); + mEditDesc->setCommitOnFocusLost(true); mEditDesc->setCommitCallback(onCommitAny, this); mEditDesc->setContentTrusted(false); // No prevalidate function - historically the prevalidate function was broken, @@ -544,7 +544,7 @@ BOOL LLPanelLandGeneral::postBuild() if(gDisconnected) { - return TRUE; + return true; } // note: on region change this will not be re checked, should not matter on Agni as @@ -566,7 +566,7 @@ BOOL LLPanelLandGeneral::postBuild() } } - return TRUE; + return true; } @@ -578,51 +578,51 @@ LLPanelLandGeneral::~LLPanelLandGeneral() // public void LLPanelLandGeneral::refresh() { - mEditName->setEnabled(FALSE); + mEditName->setEnabled(false); mEditName->setText(LLStringUtil::null); - mEditDesc->setEnabled(FALSE); + mEditDesc->setEnabled(false); mEditDesc->setText(getString("no_selection_text")); mTextSalePending->setText(LLStringUtil::null); - mTextSalePending->setEnabled(FALSE); + mTextSalePending->setEnabled(false); - mBtnDeedToGroup->setEnabled(FALSE); - mBtnSetGroup->setEnabled(FALSE); - mBtnStartAuction->setEnabled(FALSE); + mBtnDeedToGroup->setEnabled(false); + mBtnSetGroup->setEnabled(false); + mBtnStartAuction->setEnabled(false); - mCheckDeedToGroup ->set(FALSE); - mCheckDeedToGroup ->setEnabled(FALSE); - mCheckContributeWithDeed->set(FALSE); - mCheckContributeWithDeed->setEnabled(FALSE); + mCheckDeedToGroup ->set(false); + mCheckDeedToGroup ->setEnabled(false); + mCheckContributeWithDeed->set(false); + mCheckContributeWithDeed->setEnabled(false); mTextOwner->setText(LLStringUtil::null); mContentRating->setText(LLStringUtil::null); mLandType->setText(LLStringUtil::null); mBtnProfile->setLabel(getString("profile_text")); - mBtnProfile->setEnabled(FALSE); + mBtnProfile->setEnabled(false); mTextClaimDate->setText(LLStringUtil::null); mTextGroup->setText(LLStringUtil::null); mTextPrice->setText(LLStringUtil::null); - mSaleInfoForSale1->setVisible(FALSE); - mSaleInfoForSale2->setVisible(FALSE); - mSaleInfoForSaleObjects->setVisible(FALSE); - mSaleInfoForSaleNoObjects->setVisible(FALSE); - mSaleInfoNotForSale->setVisible(FALSE); - mBtnSellLand->setVisible(FALSE); - mBtnStopSellLand->setVisible(FALSE); + mSaleInfoForSale1->setVisible(false); + mSaleInfoForSale2->setVisible(false); + mSaleInfoForSaleObjects->setVisible(false); + mSaleInfoForSaleNoObjects->setVisible(false); + mSaleInfoNotForSale->setVisible(false); + mBtnSellLand->setVisible(false); + mBtnStopSellLand->setVisible(false); mTextPriceLabel->setText(LLStringUtil::null); mTextDwell->setText(LLStringUtil::null); - mBtnBuyLand->setEnabled(FALSE); - mBtnScriptLimits->setEnabled(FALSE); - mBtnBuyGroupLand->setEnabled(FALSE); - mBtnReleaseLand->setEnabled(FALSE); - mBtnReclaimLand->setEnabled(FALSE); - mBtnBuyPass->setEnabled(FALSE); + mBtnBuyLand->setEnabled(false); + mBtnScriptLimits->setEnabled(false); + mBtnBuyGroupLand->setEnabled(false); + mBtnReleaseLand->setEnabled(false); + mBtnReclaimLand->setEnabled(false); + mBtnBuyPass->setEnabled(false); if(gDisconnected) { @@ -635,24 +635,24 @@ void LLPanelLandGeneral::refresh() if(regionp && (regionp->getOwner() == gAgent.getID())) { region_owner = true; - mBtnReleaseLand->setVisible(FALSE); - mBtnReclaimLand->setVisible(TRUE); + mBtnReleaseLand->setVisible(false); + mBtnReclaimLand->setVisible(true); } else { - mBtnReleaseLand->setVisible(TRUE); - mBtnReclaimLand->setVisible(FALSE); + mBtnReleaseLand->setVisible(true); + mBtnReclaimLand->setVisible(false); } LLParcel *parcel = mParcel->getParcel(); if (parcel) { // something selected, hooray! - BOOL is_leased = (LLParcel::OS_LEASED == parcel->getOwnershipStatus()); - BOOL region_xfer = FALSE; + bool is_leased = (LLParcel::OS_LEASED == parcel->getOwnershipStatus()); + bool region_xfer = false; if(regionp && !(regionp->getRegionFlag(REGION_FLAGS_BLOCK_LAND_RESELL))) { - region_xfer = TRUE; + region_xfer = true; } if (regionp) @@ -662,57 +662,57 @@ void LLPanelLandGeneral::refresh() } // estate owner/manager cannot edit other parts of the parcel - BOOL estate_manager_sellable = !parcel->getAuctionID() + bool estate_manager_sellable = !parcel->getAuctionID() && gAgent.canManageEstate() // estate manager/owner can only sell parcels owned by estate owner && regionp && (parcel->getOwnerID() == regionp->getOwner()); - BOOL owner_sellable = region_xfer && !parcel->getAuctionID() + bool owner_sellable = region_xfer && !parcel->getAuctionID() && LLViewerParcelMgr::isParcelModifiableByAgent( parcel, GP_LAND_SET_SALE_INFO); - BOOL can_be_sold = owner_sellable || estate_manager_sellable; + bool can_be_sold = owner_sellable || estate_manager_sellable; const LLUUID &owner_id = parcel->getOwnerID(); - BOOL is_public = parcel->isPublic(); + bool is_public = parcel->isPublic(); // Is it owned? if (is_public) { mTextSalePending->setText(LLStringUtil::null); - mTextSalePending->setEnabled(FALSE); + mTextSalePending->setEnabled(false); mTextOwner->setText(getString("public_text")); - mTextOwner->setEnabled(FALSE); - mBtnProfile->setEnabled(FALSE); + mTextOwner->setEnabled(false); + mBtnProfile->setEnabled(false); mTextClaimDate->setText(LLStringUtil::null); - mTextClaimDate->setEnabled(FALSE); + mTextClaimDate->setEnabled(false); mTextGroup->setText(getString("none_text")); - mTextGroup->setEnabled(FALSE); - mBtnStartAuction->setEnabled(FALSE); + mTextGroup->setEnabled(false); + mBtnStartAuction->setEnabled(false); } else { if(!is_leased && (owner_id == gAgent.getID())) { mTextSalePending->setText(getString("need_tier_to_modify")); - mTextSalePending->setEnabled(TRUE); + mTextSalePending->setEnabled(true); } else if(parcel->getAuctionID()) { mTextSalePending->setText(getString("auction_id_text")); mTextSalePending->setTextArg("[ID]", llformat("%u", parcel->getAuctionID())); - mTextSalePending->setEnabled(TRUE); + mTextSalePending->setEnabled(true); } else { // not the owner, or it is leased mTextSalePending->setText(LLStringUtil::null); - mTextSalePending->setEnabled(FALSE); + mTextSalePending->setEnabled(false); } //refreshNames(); - mTextOwner->setEnabled(TRUE); + mTextOwner->setEnabled(true); // We support both group and personal profiles - mBtnProfile->setEnabled(TRUE); + mBtnProfile->setEnabled(true); if (parcel->getGroupID().isNull()) { @@ -720,7 +720,7 @@ void LLPanelLandGeneral::refresh() mBtnProfile->setLabel(getString("profile_text")); mTextGroup->setText(getString("none_text")); - mTextGroup->setEnabled(FALSE); + mTextGroup->setEnabled(false); } else { @@ -728,7 +728,7 @@ void LLPanelLandGeneral::refresh() mBtnProfile->setLabel(getString("info_text")); //mTextGroup->setText("HIPPOS!");//parcel->getGroupName()); - mTextGroup->setEnabled(TRUE); + mTextGroup->setEnabled(true); } // Display claim date @@ -740,25 +740,25 @@ void LLPanelLandGeneral::refresh() mTextClaimDate->setText(claim_date_str); mTextClaimDate->setEnabled(is_leased); - BOOL enable_auction = (gAgent.getGodLevel() >= GOD_LIAISON) + bool enable_auction = (gAgent.getGodLevel() >= GOD_LIAISON) && (owner_id == GOVERNOR_LINDEN_ID) && (parcel->getAuctionID() == 0); mBtnStartAuction->setEnabled(enable_auction); } // Display options - BOOL can_edit_identity = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_CHANGE_IDENTITY); + bool can_edit_identity = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_CHANGE_IDENTITY); mEditName->setEnabled(can_edit_identity); mEditDesc->setEnabled(can_edit_identity); mEditDesc->setParseURLs(!can_edit_identity); - BOOL can_edit_agent_only = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_NO_POWERS); + bool can_edit_agent_only = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_NO_POWERS); mBtnSetGroup->setEnabled(can_edit_agent_only && !parcel->getIsGroupOwned()); const LLUUID& group_id = parcel->getGroupID(); // Can only allow deeding if you own it and it's got a group. - BOOL enable_deed = (owner_id == gAgent.getID() + bool enable_deed = (owner_id == gAgent.getID() && group_id.notNull() && gAgent.isInGroup(group_id)); // You don't need special powers to allow your object to @@ -770,7 +770,7 @@ void LLPanelLandGeneral::refresh() // Actually doing the deeding requires you to have GP_LAND_DEED // powers in the group. - BOOL can_deed = gAgent.hasPowerInGroup(group_id, GP_LAND_DEED); + bool can_deed = gAgent.hasPowerInGroup(group_id, GP_LAND_DEED); mBtnDeedToGroup->setEnabled( parcel->getAllowDeedToGroup() && group_id.notNull() && can_deed @@ -780,10 +780,10 @@ void LLPanelLandGeneral::refresh() mEditName->setText( parcel->getName() ); mEditDesc->setText( parcel->getDesc() ); - BOOL for_sale = parcel->getForSale(); + bool for_sale = parcel->getForSale(); - mBtnSellLand->setVisible(FALSE); - mBtnStopSellLand->setVisible(FALSE); + mBtnSellLand->setVisible(false); + mBtnStopSellLand->setVisible(false); // show pricing information S32 area; @@ -812,19 +812,19 @@ void LLPanelLandGeneral::refresh() if (for_sale) { - mSaleInfoForSale1->setVisible(TRUE); - mSaleInfoForSale2->setVisible(TRUE); + mSaleInfoForSale1->setVisible(true); + mSaleInfoForSale2->setVisible(true); if (parcel->getSellWithObjects()) { - mSaleInfoForSaleObjects->setVisible(TRUE); - mSaleInfoForSaleNoObjects->setVisible(FALSE); + mSaleInfoForSaleObjects->setVisible(true); + mSaleInfoForSaleNoObjects->setVisible(false); } else { - mSaleInfoForSaleObjects->setVisible(FALSE); - mSaleInfoForSaleNoObjects->setVisible(TRUE); + mSaleInfoForSaleObjects->setVisible(false); + mSaleInfoForSaleNoObjects->setVisible(true); } - mSaleInfoNotForSale->setVisible(FALSE); + mSaleInfoNotForSale->setVisible(false); F32 cost_per_sqm = 0.0f; if (area > 0) @@ -837,19 +837,19 @@ void LLPanelLandGeneral::refresh() mSaleInfoForSale1->setTextArg("[PRICE_PER_SQM]", llformat("%.1f", cost_per_sqm)); if (can_be_sold) { - mBtnStopSellLand->setVisible(TRUE); + mBtnStopSellLand->setVisible(true); } } else { - mSaleInfoForSale1->setVisible(FALSE); - mSaleInfoForSale2->setVisible(FALSE); - mSaleInfoForSaleObjects->setVisible(FALSE); - mSaleInfoForSaleNoObjects->setVisible(FALSE); - mSaleInfoNotForSale->setVisible(TRUE); + mSaleInfoForSale1->setVisible(false); + mSaleInfoForSale2->setVisible(false); + mSaleInfoForSaleObjects->setVisible(false); + mSaleInfoForSaleNoObjects->setVisible(false); + mSaleInfoNotForSale->setVisible(true); if (can_be_sold) { - mBtnSellLand->setVisible(TRUE); + mBtnSellLand->setVisible(true); } } @@ -869,15 +869,15 @@ void LLPanelLandGeneral::refresh() } else { - BOOL is_owner_release = LLViewerParcelMgr::isParcelOwnedByAgent(parcel, GP_LAND_RELEASE); - BOOL is_manager_release = (gAgent.canManageEstate() && + bool is_owner_release = LLViewerParcelMgr::isParcelOwnedByAgent(parcel, GP_LAND_RELEASE); + bool is_manager_release = (gAgent.canManageEstate() && regionp && (parcel->getOwnerID() != regionp->getOwner())); - BOOL can_release = is_owner_release || is_manager_release; + bool can_release = is_owner_release || is_manager_release; mBtnReleaseLand->setEnabled( can_release ); } - BOOL use_pass = parcel->getOwnerID()!= gAgent.getID() && parcel->getParcelFlag(PF_USE_PASS_LIST) && !LLViewerParcelMgr::getInstance()->isCollisionBanned();; + bool use_pass = parcel->getOwnerID()!= gAgent.getID() && parcel->getParcelFlag(PF_USE_PASS_LIST) && !LLViewerParcelMgr::getInstance()->isCollisionBanned();; mBtnBuyPass->setEnabled(use_pass); } @@ -996,7 +996,7 @@ void LLPanelLandGeneral::setGroup(const LLUUID& group_id) // static void LLPanelLandGeneral::onClickBuyLand(void* data) { - BOOL* for_group = (BOOL*)data; + bool* for_group = (bool*)data; LLViewerParcelMgr::getInstance()->startBuyLand(*for_group); } @@ -1035,7 +1035,7 @@ void LLPanelLandGeneral::onClickReclaim(void*) } // static -BOOL LLPanelLandGeneral::enableBuyPass(void* data) +bool LLPanelLandGeneral::enableBuyPass(void* data) { LLPanelLandGeneral* panelp = (LLPanelLandGeneral*)data; LLParcel* parcel = panelp != NULL ? panelp->mParcel->getParcel() : LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(); @@ -1123,8 +1123,8 @@ void LLPanelLandGeneral::onCommitAny(LLUICtrl *ctrl, void *userdata) parcel->setName(name); parcel->setDesc(desc); - BOOL allow_deed_to_group= panelp->mCheckDeedToGroup->get(); - BOOL contribute_with_deed = panelp->mCheckContributeWithDeed->get(); + bool allow_deed_to_group= panelp->mCheckDeedToGroup->get(); + bool contribute_with_deed = panelp->mCheckContributeWithDeed->get(); parcel->setParcelFlag(PF_ALLOW_DEED_TO_GROUP, allow_deed_to_group); parcel->setContributeWithDeed(contribute_with_deed); @@ -1150,7 +1150,7 @@ void LLPanelLandGeneral::onClickStopSellLand(void* data) LLPanelLandGeneral* panelp = (LLPanelLandGeneral*)data; LLParcel* parcel = panelp->mParcel->getParcel(); - parcel->setParcelFlag(PF_FOR_SALE, FALSE); + parcel->setParcelFlag(PF_FOR_SALE, false); parcel->setSalePrice(0); parcel->setAuthorizedBuyerID(LLUUID::null); @@ -1183,18 +1183,18 @@ LLPanelLandObjects::LLPanelLandObjects(LLParcelSelectionHandle& parcel) mBtnRefresh(NULL), mBtnReturnOwnerList(NULL), mOwnerList(NULL), - mFirstReply(TRUE), + mFirstReply(true), mSelectedCount(0), - mSelectedIsGroup(FALSE) + mSelectedIsGroup(false) { } -BOOL LLPanelLandObjects::postBuild() +bool LLPanelLandObjects::postBuild() { - mFirstReply = TRUE; + mFirstReply = true; mParcelObjectBonus = getChild<LLTextBox>("parcel_object_bonus"); mSWTotalObjects = getChild<LLTextBox>("objects_available"); mObjectContribution = getChild<LLTextBox>("object_contrib_text"); @@ -1240,12 +1240,12 @@ BOOL LLPanelLandObjects::postBuild() mOwnerList = getChild<LLNameListCtrl>("owner list"); mOwnerList->setIsFriendCallback(LLAvatarActions::isFriend); - mOwnerList->sortByColumnIndex(3, FALSE); + mOwnerList->sortByColumnIndex(3, false); childSetCommitCallback("owner list", onCommitList, this); mOwnerList->setDoubleClickCallback(onDoubleClickOwner, this); mOwnerList->setContextMenu(LLScrollListCtrl::MENU_AVATAR); - return TRUE; + return true; } @@ -1272,7 +1272,7 @@ void LLPanelLandObjects::onDoubleClickOwner(void *userdata) return; } // Is this a group? - BOOL is_group = cell->getValue().asString() == OWNER_GROUP; + bool is_group = cell->getValue().asString() == OWNER_GROUP; if (is_group) { LLGroupActions::show(owner_id); @@ -1289,19 +1289,19 @@ void LLPanelLandObjects::refresh() { LLParcel *parcel = mParcel->getParcel(); - mBtnShowOwnerObjects->setEnabled(FALSE); - mBtnShowGroupObjects->setEnabled(FALSE); - mBtnShowOtherObjects->setEnabled(FALSE); - mBtnReturnOwnerObjects->setEnabled(FALSE); - mBtnReturnGroupObjects->setEnabled(FALSE); - mBtnReturnOtherObjects->setEnabled(FALSE); - mCleanOtherObjectsTime->setEnabled(FALSE); - mBtnRefresh-> setEnabled(FALSE); - mBtnReturnOwnerList-> setEnabled(FALSE); + mBtnShowOwnerObjects->setEnabled(false); + mBtnShowGroupObjects->setEnabled(false); + mBtnShowOtherObjects->setEnabled(false); + mBtnReturnOwnerObjects->setEnabled(false); + mBtnReturnGroupObjects->setEnabled(false); + mBtnReturnOtherObjects->setEnabled(false); + mCleanOtherObjectsTime->setEnabled(false); + mBtnRefresh-> setEnabled(false); + mBtnReturnOwnerList-> setEnabled(false); mSelectedOwners.clear(); mOwnerList->deleteAllItems(); - mOwnerList->setEnabled(FALSE); + mOwnerList->setEnabled(false); if (!parcel || gDisconnected) { @@ -1340,12 +1340,12 @@ void LLPanelLandObjects::refresh() if (parcel_object_bonus != 1.0f) { - mParcelObjectBonus->setVisible(TRUE); + mParcelObjectBonus->setVisible(true); mParcelObjectBonus->setTextArg("[BONUS]", llformat("%.2f", parcel_object_bonus)); } else { - mParcelObjectBonus->setVisible(FALSE); + mParcelObjectBonus->setVisible(false); } if (sw_total > sw_max) @@ -1369,30 +1369,30 @@ void LLPanelLandObjects::refresh() mSelectedObjects->setTextArg("[COUNT]", llformat("%d", selected)); mCleanOtherObjectsTime->setText(llformat("%d", mOtherTime)); - BOOL can_return_owned = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_RETURN_GROUP_OWNED); - BOOL can_return_group_set = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_RETURN_GROUP_SET); - BOOL can_return_other = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_RETURN_NON_GROUP); + bool can_return_owned = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_RETURN_GROUP_OWNED); + bool can_return_group_set = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_RETURN_GROUP_SET); + bool can_return_other = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_RETURN_NON_GROUP); if (can_return_owned || can_return_group_set || can_return_other) { if (owned && can_return_owned) { - mBtnShowOwnerObjects->setEnabled(TRUE); - mBtnReturnOwnerObjects->setEnabled(TRUE); + mBtnShowOwnerObjects->setEnabled(true); + mBtnReturnOwnerObjects->setEnabled(true); } if (group && can_return_group_set) { - mBtnShowGroupObjects->setEnabled(TRUE); - mBtnReturnGroupObjects->setEnabled(TRUE); + mBtnShowGroupObjects->setEnabled(true); + mBtnReturnGroupObjects->setEnabled(true); } if (other && can_return_other) { - mBtnShowOtherObjects->setEnabled(TRUE); - mBtnReturnOtherObjects->setEnabled(TRUE); + mBtnShowOtherObjects->setEnabled(true); + mBtnReturnOtherObjects->setEnabled(true); } - mCleanOtherObjectsTime->setEnabled(TRUE); - mBtnRefresh->setEnabled(TRUE); + mCleanOtherObjectsTime->setEnabled(true); + mBtnRefresh->setEnabled(true); } } } @@ -1617,8 +1617,8 @@ void LLPanelLandObjects::onClickRefresh(void* userdata) // ready the list for results self->mOwnerList->deleteAllItems(); self->mOwnerList->setCommentText(LLTrans::getString("Searching")); - self->mOwnerList->setEnabled(FALSE); - self->mFirstReply = TRUE; + self->mOwnerList->setEnabled(false); + self->mFirstReply = true; // send the message msg->newMessageFast(_PREHASH_ParcelObjectOwnersRequest); @@ -1649,18 +1649,18 @@ void LLPanelLandObjects::processParcelObjectOwnersReply(LLMessageSystem *msg, vo S32 rows = msg->getNumberOfBlocksFast(_PREHASH_Data); //uuid_list_t return_ids; LLUUID owner_id; - BOOL is_group_owned; + bool is_group_owned; S32 object_count; U32 most_recent_time = 0; - BOOL is_online; + bool is_online; std::string object_count_str; - //BOOL b_need_refresh = FALSE; + //bool b_need_refresh = false; // If we were waiting for the first reply, clear the "Searching..." text. if (self->mFirstReply) { self->mOwnerList->deleteAllItems(); - self->mFirstReply = FALSE; + self->mFirstReply = false; } for(S32 i = 0; i < rows; ++i) @@ -1720,7 +1720,7 @@ void LLPanelLandObjects::processParcelObjectOwnersReply(LLMessageSystem *msg, vo } else { - self->mOwnerList->setEnabled(TRUE); + self->mOwnerList->setEnabled(true); } self->mBtnRefresh->setEnabled(true); @@ -1731,7 +1731,7 @@ void LLPanelLandObjects::onCommitList(LLUICtrl* ctrl, void* data) { LLPanelLandObjects* self = (LLPanelLandObjects*)data; - if (FALSE == self->mOwnerList->getCanSelect()) + if (false == self->mOwnerList->getCanSelect()) { return; } @@ -1755,7 +1755,7 @@ void LLPanelLandObjects::onCommitList(LLUICtrl* ctrl, void* data) // Set the selection, and enable the return button. self->mSelectedOwners.clear(); self->mSelectedOwners.insert(item->getUUID()); - self->mBtnReturnOwnerList->setEnabled(TRUE); + self->mBtnReturnOwnerList->setEnabled(true); // Highlight this user's objects clickShowCore(self, RT_LIST, &(self->mSelectedOwners)); @@ -1934,7 +1934,7 @@ LLPanelLandOptions::LLPanelLandOptions(LLParcelSelectionHandle& parcel) } -BOOL LLPanelLandOptions::postBuild() +bool LLPanelLandOptions::postBuild() { mCheckEditObjects = getChild<LLCheckBoxCtrl>( "edit objects check"); childSetCommitCallback("edit objects check", onCommitAny, this); @@ -1992,8 +1992,8 @@ BOOL LLPanelLandOptions::postBuild() if (gAgent.wantsPGOnly()) { // Disable these buttons if they are PG (Teen) users - mMatureCtrl->setVisible(FALSE); - mMatureCtrl->setEnabled(FALSE); + mMatureCtrl->setVisible(false); + mMatureCtrl->setEnabled(false); } @@ -2001,7 +2001,7 @@ BOOL LLPanelLandOptions::postBuild() if (mSnapshotCtrl) { mSnapshotCtrl->setCommitCallback( onCommitAny, this ); - mSnapshotCtrl->setAllowNoTexture ( TRUE ); + mSnapshotCtrl->setAllowNoTexture ( true ); mSnapshotCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); mSnapshotCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); } @@ -2024,7 +2024,7 @@ BOOL LLPanelLandOptions::postBuild() mLandingTypeCombo = getChild<LLComboBox>( "landing type"); childSetCommitCallback("landing type", onCommitAny, this); - return TRUE; + return true; } @@ -2041,55 +2041,55 @@ void LLPanelLandOptions::refresh() LLParcel *parcel = mParcel->getParcel(); if (!parcel || gDisconnected) { - mCheckEditObjects ->set(FALSE); - mCheckEditObjects ->setEnabled(FALSE); + mCheckEditObjects ->set(false); + mCheckEditObjects ->setEnabled(false); - mCheckEditGroupObjects ->set(FALSE); - mCheckEditGroupObjects ->setEnabled(FALSE); + mCheckEditGroupObjects ->set(false); + mCheckEditGroupObjects ->setEnabled(false); - mCheckAllObjectEntry ->set(FALSE); - mCheckAllObjectEntry ->setEnabled(FALSE); + mCheckAllObjectEntry ->set(false); + mCheckAllObjectEntry ->setEnabled(false); - mCheckGroupObjectEntry ->set(FALSE); - mCheckGroupObjectEntry ->setEnabled(FALSE); + mCheckGroupObjectEntry ->set(false); + mCheckGroupObjectEntry ->setEnabled(false); - mCheckSafe ->set(FALSE); - mCheckSafe ->setEnabled(FALSE); + mCheckSafe ->set(false); + mCheckSafe ->setEnabled(false); - mCheckFly ->set(FALSE); - mCheckFly ->setEnabled(FALSE); + mCheckFly ->set(false); + mCheckFly ->setEnabled(false); - mCheckGroupScripts ->set(FALSE); - mCheckGroupScripts ->setEnabled(FALSE); + mCheckGroupScripts ->set(false); + mCheckGroupScripts ->setEnabled(false); - mCheckOtherScripts ->set(FALSE); - mCheckOtherScripts ->setEnabled(FALSE); + mCheckOtherScripts ->set(false); + mCheckOtherScripts ->setEnabled(false); - mPushRestrictionCtrl->set(FALSE); - mPushRestrictionCtrl->setEnabled(FALSE); + mPushRestrictionCtrl->set(false); + mPushRestrictionCtrl->setEnabled(false); - mSeeAvatarsCtrl->set(TRUE); - mSeeAvatarsCtrl->setEnabled(FALSE); - mSeeAvatarsText->setEnabled(FALSE); + mSeeAvatarsCtrl->set(true); + mSeeAvatarsCtrl->setEnabled(false); + mSeeAvatarsText->setEnabled(false); mLandingTypeCombo->setCurrentByIndex(0); - mLandingTypeCombo->setEnabled(FALSE); + mLandingTypeCombo->setEnabled(false); mSnapshotCtrl->setImageAssetID(LLUUID::null); - mSnapshotCtrl->setEnabled(FALSE); + mSnapshotCtrl->setEnabled(false); mLocationText->setTextArg("[LANDING]", getString("landing_point_none")); - mSetBtn->setEnabled(FALSE); - mClearBtn->setEnabled(FALSE); + mSetBtn->setEnabled(false); + mClearBtn->setEnabled(false); - mMatureCtrl->setEnabled(FALSE); + mMatureCtrl->setEnabled(false); } else { // something selected, hooray! // Display options - BOOL can_change_options = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_OPTIONS); + bool can_change_options = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_OPTIONS); mCheckEditObjects ->set( parcel->getAllowModify() ); mCheckEditObjects ->setEnabled( can_change_options ); @@ -2119,7 +2119,7 @@ void LLPanelLandOptions::refresh() { mPushRestrictionCtrl->setLabel(getString("push_restrict_region_text")); mPushRestrictionCtrl->setEnabled(false); - mPushRestrictionCtrl->set(TRUE); + mPushRestrictionCtrl->set(true); } else { @@ -2131,7 +2131,7 @@ void LLPanelLandOptions::refresh() mSeeAvatarsCtrl->setEnabled(can_change_options && parcel->getHaveNewParcelLimitData()); mSeeAvatarsText->setEnabled(can_change_options && parcel->getHaveNewParcelLimitData()); - BOOL can_change_landing_point = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, + bool can_change_landing_point = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_SET_LANDING_POINT); mLandingTypeCombo->setCurrentByIndex((S32)parcel->getLandingType()); mLandingTypeCombo->setEnabled( can_change_landing_point ); @@ -2166,13 +2166,13 @@ void LLPanelLandOptions::refresh() if (gAgent.wantsPGOnly()) { // Disable these buttons if they are PG (Teen) users - mMatureCtrl->setVisible(FALSE); - mMatureCtrl->setEnabled(FALSE); + mMatureCtrl->setVisible(false); + mMatureCtrl->setEnabled(false); } else { // not teen so fill in the data for the maturity control - mMatureCtrl->setVisible(TRUE); + mMatureCtrl->setVisible(true); LLStyle::Params style; style.image(LLUI::getUIImage(gFloaterView->getParentFloater(this)->getString("maturity_icon_moderate"))); LLCheckBoxWithTBAcess* fullaccess_mature_ctrl = (LLCheckBoxWithTBAcess*)mMatureCtrl; @@ -2180,7 +2180,7 @@ void LLPanelLandOptions::refresh() fullaccess_mature_ctrl->getTextBox()->appendImageSegment(style); fullaccess_mature_ctrl->getTextBox()->appendText(getString("mature_check_mature"), false); fullaccess_mature_ctrl->setToolTip(getString("mature_check_mature_tooltip")); - fullaccess_mature_ctrl->reshape(fullaccess_mature_ctrl->getRect().getWidth(), fullaccess_mature_ctrl->getRect().getHeight(), FALSE); + fullaccess_mature_ctrl->reshape(fullaccess_mature_ctrl->getRect().getWidth(), fullaccess_mature_ctrl->getRect().getHeight(), false); // they can see the checkbox, but its disposition depends on the // state of the region @@ -2189,8 +2189,8 @@ void LLPanelLandOptions::refresh() { if (regionp->getSimAccess() == SIM_ACCESS_PG) { - mMatureCtrl->setEnabled(FALSE); - mMatureCtrl->set(FALSE); + mMatureCtrl->setEnabled(false); + mMatureCtrl->set(false); } else if (regionp->getSimAccess() == SIM_ACCESS_MATURE) { @@ -2199,8 +2199,8 @@ void LLPanelLandOptions::refresh() } else if (regionp->getSimAccess() == SIM_ACCESS_ADULT) { - mMatureCtrl->setEnabled(FALSE); - mMatureCtrl->set(TRUE); + mMatureCtrl->setEnabled(false); + mMatureCtrl->set(true); mMatureCtrl->setLabel(getString("mature_check_adult")); mMatureCtrl->setToolTip(getString("mature_check_adult_tooltip")); } @@ -2222,12 +2222,12 @@ void LLPanelLandOptions::refreshSearch() LLParcel *parcel = mParcel->getParcel(); if (!parcel || gDisconnected) { - mCheckShowDirectory->set(FALSE); - mCheckShowDirectory->setEnabled(FALSE); + mCheckShowDirectory->set(false); + mCheckShowDirectory->setEnabled(false); const std::string& none_string = LLParcel::getCategoryString(LLParcel::C_NONE); mCategoryCombo->setValue(none_string); - mCategoryCombo->setEnabled(FALSE); + mCategoryCombo->setEnabled(false); return; } @@ -2240,7 +2240,7 @@ void LLPanelLandOptions::refreshSearch() && region && !(region->getRegionFlag(REGION_FLAGS_BLOCK_PARCEL_SEARCH)); - BOOL show_directory = parcel->getParcelFlag(PF_SHOW_DIRECTORY); + bool show_directory = parcel->getParcelFlag(PF_SHOW_DIRECTORY); mCheckShowDirectory->set(show_directory); // Set by string in case the order in UI doesn't match the order by index. @@ -2315,21 +2315,21 @@ void LLPanelLandOptions::onCommitAny(LLUICtrl *ctrl, void *userdata) } // Extract data from UI - BOOL create_objects = self->mCheckEditObjects->get(); - BOOL create_group_objects = self->mCheckEditGroupObjects->get() || self->mCheckEditObjects->get(); - BOOL all_object_entry = self->mCheckAllObjectEntry->get(); - BOOL group_object_entry = self->mCheckGroupObjectEntry->get() || self->mCheckAllObjectEntry->get(); - BOOL allow_terraform = false; // removed from UI so always off now - self->mCheckEditLand->get(); - BOOL allow_damage = !self->mCheckSafe->get(); - BOOL allow_fly = self->mCheckFly->get(); - BOOL allow_landmark = TRUE; // cannot restrict landmark creation - BOOL allow_other_scripts = self->mCheckOtherScripts->get(); - BOOL allow_group_scripts = self->mCheckGroupScripts->get() || allow_other_scripts; - BOOL allow_publish = FALSE; - BOOL mature_publish = self->mMatureCtrl->get(); - BOOL push_restriction = self->mPushRestrictionCtrl->get(); - BOOL see_avs = self->mSeeAvatarsCtrl->get(); - BOOL show_directory = self->mCheckShowDirectory->get(); + bool create_objects = self->mCheckEditObjects->get(); + bool create_group_objects = self->mCheckEditGroupObjects->get() || self->mCheckEditObjects->get(); + bool all_object_entry = self->mCheckAllObjectEntry->get(); + bool group_object_entry = self->mCheckGroupObjectEntry->get() || self->mCheckAllObjectEntry->get(); + bool allow_terraform = false; // removed from UI so always off now - self->mCheckEditLand->get(); + bool allow_damage = !self->mCheckSafe->get(); + bool allow_fly = self->mCheckFly->get(); + bool allow_landmark = true; // cannot restrict landmark creation + bool allow_other_scripts = self->mCheckOtherScripts->get(); + bool allow_group_scripts = self->mCheckGroupScripts->get() || allow_other_scripts; + bool allow_publish = false; + bool mature_publish = self->mMatureCtrl->get(); + bool push_restriction = self->mPushRestrictionCtrl->get(); + bool see_avs = self->mSeeAvatarsCtrl->get(); + bool show_directory = self->mCheckShowDirectory->get(); // we have to get the index from a lookup, not from the position in the dropdown! S32 category_index = LLParcel::getCategoryFromString(self->mCategoryCombo->getSelectedValue()); S32 landing_type_index = self->mLandingTypeCombo->getCurrentIndex(); @@ -2441,7 +2441,7 @@ LLPanelLandAccess::LLPanelLandAccess(LLParcelSelectionHandle& parcel) } -BOOL LLPanelLandAccess::postBuild() +bool LLPanelLandAccess::postBuild() { childSetCommitCallback("public_access", onCommitPublicAccess, this); childSetCommitCallback("limit_payment", onCommitAny, this); @@ -2460,19 +2460,19 @@ BOOL LLPanelLandAccess::postBuild() mListAccess = getChild<LLNameListCtrl>("AccessList"); if (mListAccess) { - mListAccess->sortByColumnIndex(0, TRUE); // ascending + mListAccess->sortByColumnIndex(0, true); // ascending mListAccess->setContextMenu(LLScrollListCtrl::MENU_AVATAR); } mListBanned = getChild<LLNameListCtrl>("BannedList"); if (mListBanned) { - mListBanned->sortByColumnIndex(0, TRUE); // ascending + mListBanned->sortByColumnIndex(0, true); // ascending mListBanned->setContextMenu(LLScrollListCtrl::MENU_AVATAR); mListBanned->setAlternateSort(); } - return TRUE; + return true; } @@ -2488,9 +2488,9 @@ void LLPanelLandAccess::refresh() // Display options if (parcel && !gDisconnected) { - BOOL use_access_list = parcel->getParcelFlag(PF_USE_ACCESS_LIST); - BOOL use_group = parcel->getParcelFlag(PF_USE_ACCESS_GROUP); - BOOL public_access = !use_access_list; + bool use_access_list = parcel->getParcelFlag(PF_USE_ACCESS_LIST); + bool use_group = parcel->getParcelFlag(PF_USE_ACCESS_GROUP); + bool public_access = !use_access_list; if (parcel->getRegionAllowAccessOverride()) { @@ -2499,8 +2499,8 @@ void LLPanelLandAccess::refresh() } else { - getChild<LLUICtrl>("public_access")->setValue(TRUE); - getChild<LLUICtrl>("GroupCheck")->setValue(FALSE); + getChild<LLUICtrl>("public_access")->setValue(true); + getChild<LLUICtrl>("GroupCheck")->setValue(false); } std::string group_name; gCacheName->getGroupName(parcel->getGroupID(), group_name); @@ -2512,7 +2512,7 @@ void LLPanelLandAccess::refresh() // Clear the sort order so we don't re-sort on every add. mListAccess->clearSortOrder(); mListAccess->deleteAllItems(); - S32 count = parcel->mAccessList.size(); + auto count = parcel->mAccessList.size(); getChild<LLUICtrl>("AllowedText")->setTextArg("[COUNT]", llformat("%d",count)); getChild<LLUICtrl>("AllowedText")->setTextArg("[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST)); @@ -2549,9 +2549,9 @@ void LLPanelLandAccess::refresh() } prefix.append(" " + parent_floater->getString("Remaining") + ") "); } - mListAccess->addNameItem(entry.mID, ADD_DEFAULT, TRUE, "", prefix); + mListAccess->addNameItem(entry.mID, ADD_DEFAULT, true, "", prefix); } - mListAccess->sortByName(TRUE); + mListAccess->sortByName(true); } // Ban List @@ -2560,7 +2560,7 @@ void LLPanelLandAccess::refresh() // Clear the sort order so we don't re-sort on every add. mListBanned->clearSortOrder(); mListBanned->deleteAllItems(); - S32 count = parcel->mBanList.size(); + auto count = parcel->mBanList.size(); getChild<LLUICtrl>("BanCheck")->setTextArg("[COUNT]", llformat("%d",count)); getChild<LLUICtrl>("BanCheck")->setTextArg("[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST)); @@ -2617,12 +2617,12 @@ void LLPanelLandAccess::refresh() columns[1]["alt_value"] = entry.mTime != 0 ? std::to_string(seconds) : "Always"; mListBanned->addElement(item); } - mListBanned->sortByName(TRUE); + mListBanned->sortByName(true); } if(parcel->getRegionDenyAnonymousOverride()) { - getChild<LLUICtrl>("limit_payment")->setValue(TRUE); + getChild<LLUICtrl>("limit_payment")->setValue(true); getChild<LLUICtrl>("limit_payment")->setLabelArg("[ESTATE_PAYMENT_LIMIT]", getString("access_estate_defined") ); } else @@ -2632,7 +2632,7 @@ void LLPanelLandAccess::refresh() } if(parcel->getRegionDenyAgeUnverifiedOverride()) { - getChild<LLUICtrl>("limit_age_verified")->setValue(TRUE); + getChild<LLUICtrl>("limit_age_verified")->setValue(true); getChild<LLUICtrl>("limit_age_verified")->setLabelArg("[ESTATE_AGE_LIMIT]", getString("access_estate_defined") ); } else @@ -2641,7 +2641,7 @@ void LLPanelLandAccess::refresh() getChild<LLUICtrl>("limit_age_verified")->setLabelArg("[ESTATE_AGE_LIMIT]", std::string() ); } - BOOL use_pass = parcel->getParcelFlag(PF_USE_PASS_LIST); + bool use_pass = parcel->getParcelFlag(PF_USE_PASS_LIST); getChild<LLUICtrl>("PassCheck")->setValue(use_pass); LLCtrlSelectionInterface* passcombo = childGetSelectionInterface("pass_combo"); if (passcombo) @@ -2660,12 +2660,12 @@ void LLPanelLandAccess::refresh() } else { - getChild<LLUICtrl>("public_access")->setValue(FALSE); - getChild<LLUICtrl>("limit_payment")->setValue(FALSE); - getChild<LLUICtrl>("limit_age_verified")->setValue(FALSE); - getChild<LLUICtrl>("GroupCheck")->setValue(FALSE); + getChild<LLUICtrl>("public_access")->setValue(false); + getChild<LLUICtrl>("limit_payment")->setValue(false); + getChild<LLUICtrl>("limit_age_verified")->setValue(false); + getChild<LLUICtrl>("GroupCheck")->setValue(false); getChild<LLUICtrl>("GroupCheck")->setLabelArg("[GROUP]", LLStringUtil::null ); - getChild<LLUICtrl>("PassCheck")->setValue(FALSE); + getChild<LLUICtrl>("PassCheck")->setValue(false); getChild<LLUICtrl>("PriceSpin")->setValue((F32)PARCEL_PASS_PRICE_DEFAULT); getChild<LLUICtrl>("HoursSpin")->setValue(PARCEL_PASS_HOURS_DEFAULT ); getChild<LLUICtrl>("AccessList")->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",0)); @@ -2677,26 +2677,26 @@ void LLPanelLandAccess::refresh() void LLPanelLandAccess::refresh_ui() { - getChildView("public_access")->setEnabled(FALSE); - getChildView("limit_payment")->setEnabled(FALSE); - getChildView("limit_age_verified")->setEnabled(FALSE); - getChildView("GroupCheck")->setEnabled(FALSE); - getChildView("PassCheck")->setEnabled(FALSE); - getChildView("pass_combo")->setEnabled(FALSE); - getChildView("PriceSpin")->setEnabled(FALSE); - getChildView("HoursSpin")->setEnabled(FALSE); - getChildView("AccessList")->setEnabled(FALSE); - getChildView("BannedList")->setEnabled(FALSE); - getChildView("add_allowed")->setEnabled(FALSE); - getChildView("remove_allowed")->setEnabled(FALSE); - getChildView("add_banned")->setEnabled(FALSE); - getChildView("remove_banned")->setEnabled(FALSE); + getChildView("public_access")->setEnabled(false); + getChildView("limit_payment")->setEnabled(false); + getChildView("limit_age_verified")->setEnabled(false); + getChildView("GroupCheck")->setEnabled(false); + getChildView("PassCheck")->setEnabled(false); + getChildView("pass_combo")->setEnabled(false); + getChildView("PriceSpin")->setEnabled(false); + getChildView("HoursSpin")->setEnabled(false); + getChildView("AccessList")->setEnabled(false); + getChildView("BannedList")->setEnabled(false); + getChildView("add_allowed")->setEnabled(false); + getChildView("remove_allowed")->setEnabled(false); + getChildView("add_banned")->setEnabled(false); + getChildView("remove_banned")->setEnabled(false); LLParcel *parcel = mParcel->getParcel(); if (parcel && !gDisconnected) { - BOOL can_manage_allowed = false; - BOOL can_manage_banned = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_MANAGE_BANNED); + bool can_manage_allowed = false; + bool can_manage_banned = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_MANAGE_BANNED); if (parcel->getRegionAllowAccessOverride()) { // Estate owner may have disabled allowing the parcel owner from managing access. @@ -2704,14 +2704,14 @@ void LLPanelLandAccess::refresh_ui() } getChildView("public_access")->setEnabled(can_manage_allowed); - BOOL public_access = getChild<LLUICtrl>("public_access")->getValue().asBoolean(); + bool public_access = getChild<LLUICtrl>("public_access")->getValue().asBoolean(); if (public_access) { bool override = false; if(parcel->getRegionDenyAnonymousOverride()) { override = true; - getChildView("limit_payment")->setEnabled(FALSE); + getChildView("limit_payment")->setEnabled(false); } else { @@ -2720,7 +2720,7 @@ void LLPanelLandAccess::refresh_ui() if(parcel->getRegionDenyAgeUnverifiedOverride()) { override = true; - getChildView("limit_age_verified")->setEnabled(FALSE); + getChildView("limit_age_verified")->setEnabled(false); } else { @@ -2734,17 +2734,17 @@ void LLPanelLandAccess::refresh_ui() { getChildView("Only Allow")->setToolTip(std::string()); } - getChildView("PassCheck")->setEnabled(FALSE); - getChildView("pass_combo")->setEnabled(FALSE); - getChildView("AccessList")->setEnabled(FALSE); + getChildView("PassCheck")->setEnabled(false); + getChildView("pass_combo")->setEnabled(false); + getChildView("AccessList")->setEnabled(false); } else { - getChildView("limit_payment")->setEnabled(FALSE); - getChildView("limit_age_verified")->setEnabled(FALSE); + getChildView("limit_payment")->setEnabled(false); + getChildView("limit_age_verified")->setEnabled(false); - BOOL sell_passes = getChild<LLUICtrl>("PassCheck")->getValue().asBoolean(); + bool sell_passes = getChild<LLUICtrl>("PassCheck")->getValue().asBoolean(); getChildView("PassCheck")->setEnabled(can_manage_allowed); if (sell_passes) { @@ -2760,13 +2760,13 @@ void LLPanelLandAccess::refresh_ui() getChildView("GroupCheck")->setEnabled(can_manage_allowed && can_allow_groups); } getChildView("AccessList")->setEnabled(can_manage_allowed); - S32 allowed_list_count = parcel->mAccessList.size(); + auto allowed_list_count = parcel->mAccessList.size(); getChildView("add_allowed")->setEnabled(can_manage_allowed && allowed_list_count < PARCEL_MAX_ACCESS_LIST); - BOOL has_selected = (mListAccess && mListAccess->getSelectionInterface()->getFirstSelectedIndex() >= 0); + bool has_selected = (mListAccess && mListAccess->getSelectionInterface()->getFirstSelectedIndex() >= 0); getChildView("remove_allowed")->setEnabled(can_manage_allowed && has_selected); getChildView("BannedList")->setEnabled(can_manage_banned); - S32 banned_list_count = parcel->mBanList.size(); + auto banned_list_count = parcel->mBanList.size(); getChildView("add_banned")->setEnabled(can_manage_banned && banned_list_count < PARCEL_MAX_ACCESS_LIST); has_selected = (mListBanned && mListBanned->getSelectionInterface()->getFirstSelectedIndex() >= 0); getChildView("remove_banned")->setEnabled(can_manage_banned && has_selected); @@ -2817,8 +2817,8 @@ void LLPanelLandAccess::onCommitGroupCheck(LLUICtrl *ctrl, void *userdata) return; } - BOOL use_pass_list = !self->getChild<LLUICtrl>("public_access")->getValue().asBoolean(); - BOOL use_access_group = self->getChild<LLUICtrl>("GroupCheck")->getValue().asBoolean(); + bool use_pass_list = !self->getChild<LLUICtrl>("public_access")->getValue().asBoolean(); + bool use_access_group = self->getChild<LLUICtrl>("GroupCheck")->getValue().asBoolean(); LLCtrlSelectionInterface* passcombo = self->childGetSelectionInterface("pass_combo"); if (passcombo) { @@ -2846,30 +2846,30 @@ void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata) } // Extract data from UI - BOOL public_access = self->getChild<LLUICtrl>("public_access")->getValue().asBoolean(); - BOOL use_access_group = self->getChild<LLUICtrl>("GroupCheck")->getValue().asBoolean(); + bool public_access = self->getChild<LLUICtrl>("public_access")->getValue().asBoolean(); + bool use_access_group = self->getChild<LLUICtrl>("GroupCheck")->getValue().asBoolean(); if (use_access_group) { std::string group_name; if (!gCacheName->getGroupName(parcel->getGroupID(), group_name)) { - use_access_group = FALSE; + use_access_group = false; } } - BOOL limit_payment = FALSE, limit_age_verified = FALSE; - BOOL use_access_list = FALSE; - BOOL use_pass_list = FALSE; + bool limit_payment = false, limit_age_verified = false; + bool use_access_list = false; + bool use_pass_list = false; if (public_access) { - use_access_list = FALSE; + use_access_list = false; limit_payment = self->getChild<LLUICtrl>("limit_payment")->getValue().asBoolean(); limit_age_verified = self->getChild<LLUICtrl>("limit_age_verified")->getValue().asBoolean(); } else { - use_access_list = TRUE; + use_access_list = true; use_pass_list = self->getChild<LLUICtrl>("PassCheck")->getValue().asBoolean(); LLCtrlSelectionInterface* passcombo = self->childGetSelectionInterface("pass_combo"); if (passcombo) @@ -2878,7 +2878,7 @@ void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata) { if (passcombo->getSelectedValue().asString() == "group") { - use_access_group = FALSE; + use_access_group = false; } } } @@ -2891,7 +2891,7 @@ void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata) parcel->setParcelFlag(PF_USE_ACCESS_GROUP, use_access_group); parcel->setParcelFlag(PF_USE_ACCESS_LIST, use_access_list); parcel->setParcelFlag(PF_USE_PASS_LIST, use_pass_list); - parcel->setParcelFlag(PF_USE_BAN_LIST, TRUE); + parcel->setParcelFlag(PF_USE_BAN_LIST, true); parcel->setParcelFlag(PF_DENY_ANONYMOUS, limit_payment); parcel->setParcelFlag(PF_DENY_AGEUNVERIFIED, limit_age_verified); @@ -2910,7 +2910,7 @@ void LLPanelLandAccess::onClickAddAccess() LLView * button = findChild<LLButton>("add_allowed"); LLFloater * root_floater = gFloaterView->getParentFloater(this); LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show( - boost::bind(&LLPanelLandAccess::callbackAvatarCBAccess, this, _1), FALSE, FALSE, FALSE, root_floater->getName(), button); + boost::bind(&LLPanelLandAccess::callbackAvatarCBAccess, this, _1), false, false, false, root_floater->getName(), button); if (picker) { root_floater->addDependentFloater(picker); @@ -2967,7 +2967,7 @@ void LLPanelLandAccess::onClickAddBanned() LLView * button = findChild<LLButton>("add_banned"); LLFloater * root_floater = gFloaterView->getParentFloater(this); LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show( - boost::bind(&LLPanelLandAccess::callbackAvatarCBBanned, this, _1), TRUE, FALSE, FALSE, root_floater->getName(), button); + boost::bind(&LLPanelLandAccess::callbackAvatarCBBanned, this, _1), true, false, false, root_floater->getName(), button); if (picker) { root_floater->addDependentFloater(picker); @@ -3051,13 +3051,13 @@ LLPanelLandCovenant::~LLPanelLandCovenant() { } -BOOL LLPanelLandCovenant::postBuild() +bool LLPanelLandCovenant::postBuild() { mLastRegionID = LLUUID::null; mNextUpdateTime = 0; mTextEstateOwner = getChild<LLTextBox>("estate_owner_text"); mTextEstateOwner->setIsFriendCallback(LLAvatarActions::isFriend); - return TRUE; + return true; } // virtual @@ -3224,7 +3224,7 @@ LLPanelLandExperiences::LLPanelLandExperiences( LLSafeHandle<LLParcelSelection>& } -BOOL LLPanelLandExperiences::postBuild() +bool LLPanelLandExperiences::postBuild() { mAllowed = setupList("panel_allowed", EXPERIENCE_KEY_TYPE_ALLOWED, AL_ALLOW_EXPERIENCE); mBlocked = setupList("panel_blocked", EXPERIENCE_KEY_TYPE_BLOCKED, AL_BLOCK_EXPERIENCE); @@ -3235,8 +3235,8 @@ BOOL LLPanelLandExperiences::postBuild() // no privileged ones mBlocked->addFilter(boost::bind(LLPanelExperiencePicker::FilterWithoutProperties, _1, LLExperienceCache::PROPERTY_PRIVILEGED|LLExperienceCache::PROPERTY_GRID)); - getChild<LLLayoutPanel>("trusted_layout_panel")->setVisible(FALSE); - getChild<LLTextBox>("experiences_help_text")->setVisible(FALSE); + getChild<LLLayoutPanel>("trusted_layout_panel")->setVisible(false); + getChild<LLTextBox>("experiences_help_text")->setVisible(false); getChild<LLTextBox>("allowed_text_help")->setText(getString("allowed_parcel_text")); getChild<LLTextBox>("blocked_text_help")->setText(getString("blocked_parcel_text")); @@ -3291,13 +3291,13 @@ void LLPanelLandExperiences::refreshPanel(LLPanelExperienceListEditor* panel, U3 if (!parcel || gDisconnected) { // disable the panel - panel->setEnabled(FALSE); + panel->setEnabled(false); panel->setExperienceIds(LLSD::emptyArray()); } else { // enable the panel - panel->setEnabled(TRUE); + panel->setEnabled(true); LLAccessEntry::map entries = parcel->getExperienceKeysByType(xp_type); LLAccessEntry::map::iterator it = entries.begin(); LLSD ids = LLSD::emptyArray(); @@ -3326,17 +3326,17 @@ LLPanelLandEnvironment::LLPanelLandEnvironment(LLParcelSelectionHandle& parcel) { } -BOOL LLPanelLandEnvironment::postBuild() +bool LLPanelLandEnvironment::postBuild() { if (!LLPanelEnvironmentInfo::postBuild()) - return FALSE; + return false; getChild<LLUICtrl>(BTN_USEDEFAULT)->setLabelArg("[USEDEFAULT]", getString(STR_LABEL_USEREGION)); - getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setVisible(FALSE); - getChild<LLUICtrl>(PNL_REGION_MSG)->setVisible(FALSE); - getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES)->setVisible(TRUE); + getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setVisible(false); + getChild<LLUICtrl>(PNL_REGION_MSG)->setVisible(false); + getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES)->setVisible(true); - return TRUE; + return true; } void LLPanelLandEnvironment::refresh() diff --git a/indra/newview/llfloaterland.h b/indra/newview/llfloaterland.h index d024de199f..3560304566 100644 --- a/indra/newview/llfloaterland.h +++ b/indra/newview/llfloaterland.h @@ -82,7 +82,7 @@ public: LLParcel* getCurrentSelectedParcel(); virtual void onOpen(const LLSD& key); - virtual BOOL postBuild(); + virtual bool postBuild(); private: // Does its own instance management, so clients not allowed @@ -130,7 +130,7 @@ public: // we send an update to the simulator, it usually replies with the // parcel information, causing the land to be reselected. This allows // us to suppress that behavior. - static BOOL sRequestReplyOnUpdate; + static bool sRequestReplyOnUpdate; }; @@ -153,7 +153,7 @@ public: static void onClickRelease(void*); static void onClickReclaim(void*); static void onClickBuyPass(void* deselect_when_done); - static BOOL enableBuyPass(void*); + static bool enableBuyPass(void*); static void onCommitAny(LLUICtrl* ctrl, void *userdata); static void finalizeCommit(void * userdata); static void onForSaleChange(LLUICtrl *ctrl, void * userdata); @@ -175,10 +175,10 @@ public: static void confirmSaleChange(S32 landSize, S32 salePrice, std::string authorizedName, void(*callback)(void*), void* userdata); static void callbackConfirmSaleChange(S32 option, void* userdata); - virtual BOOL postBuild(); + virtual bool postBuild(); protected: - BOOL mUncheckedSell; // True only when verifying land information when land is for sale on sale info change + bool mUncheckedSell; // True only when verifying land information when land is for sale on sale info change LLTextBox* mLabelName; LLLineEditor* mEditName; @@ -274,7 +274,7 @@ public: static void onCommitClean(LLUICtrl* caller, void* user_data); static void processParcelObjectOwnersReply(LLMessageSystem *msg, void **); - virtual BOOL postBuild(); + virtual bool postBuild(); protected: @@ -302,12 +302,12 @@ protected: LLPointer<LLUIImage> mIconAvatarOffline; LLPointer<LLUIImage> mIconGroup; - BOOL mFirstReply; + bool mFirstReply; uuid_list_t mSelectedOwners; std::string mSelectedName; S32 mSelectedCount; - BOOL mSelectedIsGroup; + bool mSelectedIsGroup; LLSafeHandle<LLParcelSelection>& mParcel; }; @@ -319,7 +319,7 @@ class LLPanelLandOptions public: LLPanelLandOptions(LLSafeHandle<LLParcelSelection>& parcelp); virtual ~LLPanelLandOptions(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void draw(); /*virtual*/ void refresh(); @@ -378,7 +378,7 @@ public: static void onClickRemoveAccess(void*); static void onClickRemoveBanned(void*); - virtual BOOL postBuild(); + virtual bool postBuild(); void onClickAddAccess(); void onClickAddBanned(); @@ -400,7 +400,7 @@ class LLPanelLandCovenant public: LLPanelLandCovenant(LLSafeHandle<LLParcelSelection>& parcelp); virtual ~LLPanelLandCovenant(); - virtual BOOL postBuild(); + virtual bool postBuild(); void refresh(); static void updateCovenantText(const std::string& string); static void updateEstateName(const std::string& name); diff --git a/indra/newview/llfloaterlandholdings.cpp b/indra/newview/llfloaterlandholdings.cpp index d33756c53b..63c05b14f8 100644 --- a/indra/newview/llfloaterlandholdings.cpp +++ b/indra/newview/llfloaterlandholdings.cpp @@ -60,24 +60,24 @@ LLFloaterLandHoldings::LLFloaterLandHoldings(const LLSD& key) : LLFloater(key), mActualArea(0), mBillableArea(0), - mFirstPacketReceived(FALSE), + mFirstPacketReceived(false), mSortColumn(""), - mSortAscending(TRUE) + mSortAscending(true) { } -BOOL LLFloaterLandHoldings::postBuild() +bool LLFloaterLandHoldings::postBuild() { childSetAction("Teleport", onClickTeleport, this); childSetAction("Show on Map", onClickMap, this); // Grant list LLScrollListCtrl* grant_list = getChild<LLScrollListCtrl>("grant list"); - grant_list->sortByColumnIndex(0, TRUE); + grant_list->sortByColumnIndex(0, true); grant_list->setDoubleClickCallback(onGrantList, this); - S32 count = gAgent.mGroups.size(); - for(S32 i = 0; i < count; ++i) + auto count = gAgent.mGroups.size(); + for(size_t i = 0; i < count; ++i) { LLUUID id(gAgent.mGroups.at(i).mID); LLUIString areastr = getString("area_string"); @@ -99,7 +99,7 @@ BOOL LLFloaterLandHoldings::postBuild() center(); - return TRUE; + return true; } @@ -139,10 +139,10 @@ void LLFloaterLandHoldings::draw() void LLFloaterLandHoldings::refresh() { LLCtrlSelectionInterface *list = childGetSelectionInterface("parcel list"); - BOOL enable_btns = FALSE; + bool enable_btns = false; if (list && list->getFirstSelectedIndex()> -1) { - enable_btns = TRUE; + enable_btns = true; } getChildView("Teleport")->setEnabled(enable_btns); @@ -183,7 +183,7 @@ void LLFloaterLandHoldings::processPlacesReply(LLMessageSystem* msg, void**) // If this is the first packet, clear out the "loading..." indicator if (!self->mFirstPacketReceived) { - self->mFirstPacketReceived = TRUE; + self->mFirstPacketReceived = true; list->operateOnAll(LLCtrlSelectionInterface::OP_DELETE); } diff --git a/indra/newview/llfloaterlandholdings.h b/indra/newview/llfloaterlandholdings.h index 7e99c9e671..d8a823e49c 100644 --- a/indra/newview/llfloaterlandholdings.h +++ b/indra/newview/llfloaterlandholdings.h @@ -41,7 +41,7 @@ public: LLFloaterLandHoldings(const LLSD& key); virtual ~LLFloaterLandHoldings(); - virtual BOOL postBuild(); + virtual bool postBuild(); virtual void onOpen(const LLSD& key); virtual void draw(); @@ -69,10 +69,10 @@ protected: // Has a packet of data been received? // Used to clear out the mParcelList's "Loading..." indicator - BOOL mFirstPacketReceived; + bool mFirstPacketReceived; std::string mSortColumn; - BOOL mSortAscending; + bool mSortAscending; }; #endif diff --git a/indra/newview/llfloaterlinkreplace.cpp b/indra/newview/llfloaterlinkreplace.cpp index bd1d8ddae8..c961070787 100644 --- a/indra/newview/llfloaterlinkreplace.cpp +++ b/indra/newview/llfloaterlinkreplace.cpp @@ -52,7 +52,7 @@ LLFloaterLinkReplace::~LLFloaterLinkReplace() { } -BOOL LLFloaterLinkReplace::postBuild() +bool LLFloaterLinkReplace::postBuild() { mStartBtn = getChild<LLButton>("btn_start"); mStartBtn->setCommitCallback(boost::bind(&LLFloaterLinkReplace::onStartClicked, this)); @@ -68,7 +68,7 @@ BOOL LLFloaterLinkReplace::postBuild() mStatusText = getChild<LLTextBox>("status_text"); - return TRUE; + return true; } void LLFloaterLinkReplace::onOpen(const LLSD& key) @@ -199,8 +199,8 @@ void LLFloaterLinkReplace::onStartClickedResponse(const LLSD& notification, cons args["NUM"] = llformat("%d", mRemainingItems); mStatusText->setText(getString("ItemsRemaining", args)); - mStartBtn->setEnabled(FALSE); - mRefreshBtn->setEnabled(FALSE); + mStartBtn->setEnabled(false); + mRefreshBtn->setEnabled(false); mEventTimer.start(); tick(); @@ -296,8 +296,8 @@ void LLFloaterLinkReplace::decreaseOpenItemCount() if (mRemainingItems == 0) { mStatusText->setText(getString("ReplaceFinished")); - mStartBtn->setEnabled(TRUE); - mRefreshBtn->setEnabled(TRUE); + mStartBtn->setEnabled(true); + mRefreshBtn->setEnabled(true); mEventTimer.stop(); LL_INFOS() << "Inventory link replace finished." << LL_ENDL; } @@ -310,7 +310,7 @@ void LLFloaterLinkReplace::decreaseOpenItemCount() } } -BOOL LLFloaterLinkReplace::tick() +bool LLFloaterLinkReplace::tick() { LL_DEBUGS() << "Calling tick - remaining items = " << mRemainingInventoryItems.size() << LL_ENDL; @@ -329,7 +329,7 @@ BOOL LLFloaterLinkReplace::tick() } processBatch(current_batch); - return FALSE; + return false; } void LLFloaterLinkReplace::processBatch(LLInventoryModel::item_array_t items) @@ -378,7 +378,7 @@ void LLFloaterLinkReplace::processBatch(LLInventoryModel::item_array_t items) static LLDefaultChildRegistry::Register<LLInventoryLinkReplaceDropTarget> r("inventory_link_replace_drop_target"); -BOOL LLInventoryLinkReplaceDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +bool LLInventoryLinkReplaceDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -411,7 +411,7 @@ BOOL LLInventoryLinkReplaceDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask *accept = ACCEPT_NO; } - return TRUE; + return true; } void LLInventoryLinkReplaceDropTarget::setItem(LLInventoryItem* item) diff --git a/indra/newview/llfloaterlinkreplace.h b/indra/newview/llfloaterlinkreplace.h index 0eee0d6935..7f9f0b59e1 100644 --- a/indra/newview/llfloaterlinkreplace.h +++ b/indra/newview/llfloaterlinkreplace.h @@ -56,13 +56,13 @@ public: return mDADSignal.connect(cb); } - virtual BOOL postBuild() + virtual bool postBuild() { - setEnabled(FALSE); + setEnabled(false); return LLLineEditor::postBuild(); } - virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + virtual bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -86,10 +86,10 @@ public: LLFloaterLinkReplace(const LLSD& key); virtual ~LLFloaterLinkReplace(); - BOOL postBuild(); + bool postBuild(); virtual void onOpen(const LLSD& key); - virtual BOOL tick(); + virtual bool tick(); private: void checkEnableStart(); diff --git a/indra/newview/llfloaterloadprefpreset.cpp b/indra/newview/llfloaterloadprefpreset.cpp index 77fd37c741..2396e2659a 100644 --- a/indra/newview/llfloaterloadprefpreset.cpp +++ b/indra/newview/llfloaterloadprefpreset.cpp @@ -41,7 +41,7 @@ LLFloaterLoadPrefPreset::LLFloaterLoadPrefPreset(const LLSD &key) } // virtual -BOOL LLFloaterLoadPrefPreset::postBuild() +bool LLFloaterLoadPrefPreset::postBuild() { LLFloaterPreference* preferences = LLFloaterReg::getTypedInstance<LLFloaterPreference>("preferences"); if (preferences) @@ -52,7 +52,7 @@ BOOL LLFloaterLoadPrefPreset::postBuild() getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterLoadPrefPreset::onBtnCancel, this)); LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterLoadPrefPreset::onPresetsListChange, this)); - return TRUE; + return true; } void LLFloaterLoadPrefPreset::onOpen(const LLSD& key) diff --git a/indra/newview/llfloaterloadprefpreset.h b/indra/newview/llfloaterloadprefpreset.h index e0b5b4979e..9e7d03f0c4 100644 --- a/indra/newview/llfloaterloadprefpreset.h +++ b/indra/newview/llfloaterloadprefpreset.h @@ -38,8 +38,8 @@ class LLFloaterLoadPrefPreset : public LLFloater public: LLFloaterLoadPrefPreset(const LLSD &key); - /*virtual*/ BOOL postBuild(); - /*virtual*/ void onOpen(const LLSD& key); + bool postBuild() override; + void onOpen(const LLSD& key) override; void onBtnOk(); void onBtnCancel(); diff --git a/indra/newview/llfloatermap.cpp b/indra/newview/llfloatermap.cpp index 6b7f52b0d0..83abbb0357 100755 --- a/indra/newview/llfloatermap.cpp +++ b/indra/newview/llfloatermap.cpp @@ -75,7 +75,7 @@ LLFloaterMap::~LLFloaterMap() { } -BOOL LLFloaterMap::postBuild() +bool LLFloaterMap::postBuild() { mMap = getChild<LLNetMap>("Net Map"); mMap->setToolTipMsg(getString("ToolTipMsg")); @@ -117,13 +117,13 @@ BOOL LLFloaterMap::postBuild() return true; } -BOOL LLFloaterMap::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLFloaterMap::handleDoubleClick(S32 x, S32 y, MASK mask) { // If floater is minimized, minimap should be shown on doubleclick (STORM-299) if (isMinimized()) { - setMinimized(FALSE); - return TRUE; + setMinimized(false); + return true; } LLVector3d pos_global = mMap->viewPosToGlobal(x, y); @@ -144,7 +144,7 @@ BOOL LLFloaterMap::handleDoubleClick(S32 x, S32 y, MASK mask) { LLFloaterReg::showInstance("world_map"); } - return TRUE; + return true; } void LLFloaterMap::setDirectionPos(LLTextBox *text_box, F32 rotation) @@ -229,19 +229,19 @@ void LLFloaterMap::draw() // Note: we can't just gAgent.check cameraMouselook() because the transition states are wrong. if(gAgentCamera.cameraMouselook()) { - setMouseOpaque(FALSE); - getDragHandle()->setMouseOpaque(FALSE); + setMouseOpaque(false); + getDragHandle()->setMouseOpaque(false); } else { - setMouseOpaque(TRUE); - getDragHandle()->setMouseOpaque(TRUE); + setMouseOpaque(true); + getDragHandle()->setMouseOpaque(true); } LLFloater::draw(); } -void LLFloaterMap::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLFloaterMap::reshape(S32 width, S32 height, bool called_from_parent) { LLFloater::reshape(width, height, called_from_parent); diff --git a/indra/newview/llfloatermap.h b/indra/newview/llfloatermap.h index 333424ba71..1955372567 100644 --- a/indra/newview/llfloatermap.h +++ b/indra/newview/llfloatermap.h @@ -42,10 +42,10 @@ public: static LLFloaterMap* getInstance(); virtual ~LLFloaterMap(); - /*virtual*/ BOOL postBuild(); - /*virtual*/ BOOL handleDoubleClick( S32 x, S32 y, MASK mask ); - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); - /*virtual*/ void draw(); + bool postBuild() override; + bool handleDoubleClick( S32 x, S32 y, MASK mask ) override; + void reshape(S32 width, S32 height, bool called_from_parent = true) override; + void draw() override; private: void setDirectionPos( LLTextBox* text_box, F32 rotation ); diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp index 266648bc54..f20fea01c5 100644 --- a/indra/newview/llfloatermarketplacelistings.cpp +++ b/indra/newview/llfloatermarketplacelistings.cpp @@ -62,7 +62,7 @@ LLPanelMarketplaceListings::LLPanelMarketplaceListings() mEnableCallbackRegistrar.add("Marketplace.ViewSort.CheckItem", boost::bind(&LLPanelMarketplaceListings::onViewSortMenuItemCheck, this, _2)); } -BOOL LLPanelMarketplaceListings::postBuild() +bool LLPanelMarketplaceListings::postBuild() { childSetAction("add_btn", boost::bind(&LLPanelMarketplaceListings::onAddButtonClicked, this)); childSetAction("audit_btn", boost::bind(&LLPanelMarketplaceListings::onAuditButtonClicked, this)); @@ -71,19 +71,19 @@ BOOL LLPanelMarketplaceListings::postBuild() mFilterEditor->setCommitCallback(boost::bind(&LLPanelMarketplaceListings::onFilterEdit, this, _2)); mAuditBtn = getChild<LLButton>("audit_btn"); - mAuditBtn->setEnabled(FALSE); + mAuditBtn->setEnabled(false); return LLPanel::postBuild(); } -BOOL LLPanelMarketplaceListings::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +bool LLPanelMarketplaceListings::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) { LLView * handled_view = childrenHandleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); - BOOL handled = (handled_view != NULL); + bool handled = (handled_view != NULL); // Special case the drop zone if (handled && (handled_view->getName() == "marketplace_drop_zone")) { @@ -190,7 +190,7 @@ void LLPanelMarketplaceListings::draw() LLPanel::draw(); } -void LLPanelMarketplaceListings::onSelectionChange(LLInventoryPanel *panel, const std::deque<LLFolderViewItem*>& items, BOOL user_action) +void LLPanelMarketplaceListings::onSelectionChange(LLInventoryPanel *panel, const std::deque<LLFolderViewItem*>& items, bool user_action) { panel->onSelectionChange(items, user_action); } @@ -251,8 +251,8 @@ void LLPanelMarketplaceListings::onAddButtonClicked() if (panel) { gInventory.notifyObservers(); - panel->setSelectionByID(new_cat_id, TRUE); - panel->getRootFolder()->setNeedsAutoRename(TRUE); + panel->setSelectionByID(new_cat_id, true); + panel->getRootFolder()->setNeedsAutoRename(true); } } ); @@ -395,7 +395,7 @@ LLFloaterMarketplaceListings::~LLFloaterMarketplaceListings() delete mCategoryAddedObserver; } -BOOL LLFloaterMarketplaceListings::postBuild() +bool LLFloaterMarketplaceListings::postBuild() { mInventoryStatus = getChild<LLTextBox>("marketplace_status"); mInventoryInitializationInProgress = getChild<LLView>("initialization_progress_indicator"); @@ -420,7 +420,7 @@ BOOL LLFloaterMarketplaceListings::postBuild() } - return TRUE; + return true; } void LLFloaterMarketplaceListings::onClose(bool app_quitting) @@ -577,7 +577,7 @@ S32 LLFloaterMarketplaceListings::getFolderCount() LLInventoryModel::item_array_t * items; gInventory.getDirectDescendentsOf(mRootFolderId, cats, items); - return (cats->size() + items->size()); + return static_cast<S32>(cats->size() + items->size()); } else { @@ -612,7 +612,7 @@ void LLFloaterMarketplaceListings::updateView() { // Just show the loading indicator in that case and fetch the data (fetch will be skipped if it's already loading) mInventoryInitializationInProgress->setVisible(true); - mPanelListings->setVisible(FALSE); + mPanelListings->setVisible(false); fetchContents(); return; } @@ -629,13 +629,13 @@ void LLFloaterMarketplaceListings::updateView() // We need to rebuild the tabs cleanly the first time we make them visible setPanels(); } - mPanelListings->setVisible(TRUE); - mInventoryPlaceholder->setVisible(FALSE); + mPanelListings->setVisible(true); + mInventoryPlaceholder->setVisible(false); } else { - mPanelListings->setVisible(FALSE); - mInventoryPlaceholder->setVisible(TRUE); + mPanelListings->setVisible(false); + mInventoryPlaceholder->setVisible(true); std::string text; std::string title; @@ -704,7 +704,7 @@ bool LLFloaterMarketplaceListings::isAccepted(EAcceptance accept) return (accept >= ACCEPT_YES_COPY_SINGLE); } -BOOL LLFloaterMarketplaceListings::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +bool LLFloaterMarketplaceListings::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -713,14 +713,14 @@ BOOL LLFloaterMarketplaceListings::handleDragAndDrop(S32 x, S32 y, MASK mask, BO // If there's no panel to accept drops or no existing marketplace listings folder, we refuse all drop if (!mPanelListings || mRootFolderId.isNull()) { - return FALSE; + return false; } tooltip_msg = ""; // Pass to the children LLView * handled_view = childrenHandleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); - BOOL handled = (handled_view != NULL); + bool handled = (handled_view != NULL); // If no one handled it or it was not accepted and we drop on an empty panel, we try to accept it at the floater level // as if it was dropped on the marketplace listings root folder @@ -737,7 +737,7 @@ BOOL LLFloaterMarketplaceListings::handleDragAndDrop(S32 x, S32 y, MASK mask, BO return handled; } -BOOL LLFloaterMarketplaceListings::handleHover(S32 x, S32 y, MASK mask) +bool LLFloaterMarketplaceListings::handleHover(S32 x, S32 y, MASK mask) { return LLFloater::handleHover(x, y, mask); } @@ -785,9 +785,9 @@ LLFloaterAssociateListing::~LLFloaterAssociateListing() gFocusMgr.releaseFocusIfNeeded( this ); } -BOOL LLFloaterAssociateListing::postBuild() +bool LLFloaterAssociateListing::postBuild() { - getChild<LLButton>("OK")->setCommitCallback(boost::bind(&LLFloaterAssociateListing::apply, this, TRUE)); + getChild<LLButton>("OK")->setCommitCallback(boost::bind(&LLFloaterAssociateListing::apply, this, true)); getChild<LLButton>("Cancel")->setCommitCallback(boost::bind(&LLFloaterAssociateListing::cancel, this)); getChild<LLLineEditor>("listing_id")->setPrevalidate(&LLTextValidate::validateNonNegativeS32); center(); @@ -795,17 +795,17 @@ BOOL LLFloaterAssociateListing::postBuild() return LLFloater::postBuild(); } -BOOL LLFloaterAssociateListing::handleKeyHere(KEY key, MASK mask) +bool LLFloaterAssociateListing::handleKeyHere(KEY key, MASK mask) { if (key == KEY_RETURN && mask == MASK_NONE) { apply(); - return TRUE; + return true; } else if (key == KEY_ESCAPE && mask == MASK_NONE) { cancel(); - return TRUE; + return true; } return LLFloater::handleKeyHere(key, mask); @@ -827,11 +827,11 @@ void LLFloaterAssociateListing::callback_apply(const LLSD& notification, const L S32 option = LLNotificationsUtil::getSelectedOption(notification, response); if (option == 0) // YES { - apply(FALSE); + apply(false); } } -void LLFloaterAssociateListing::apply(BOOL user_confirm) +void LLFloaterAssociateListing::apply(bool user_confirm) { if (mUUID.notNull()) { @@ -876,17 +876,17 @@ mEditor(NULL) { } -BOOL LLFloaterMarketplaceValidation::postBuild() +bool LLFloaterMarketplaceValidation::postBuild() { childSetAction("OK", onOK, this); // This widget displays the validation messages mEditor = getChild<LLTextEditor>("validation_text"); - mEditor->setEnabled(FALSE); - mEditor->setFocus(TRUE); + mEditor->setEnabled(false); + mEditor->setFocus(true); mEditor->setValue(LLSD()); - return TRUE; + return true; } LLFloaterMarketplaceValidation::~LLFloaterMarketplaceValidation() @@ -1021,7 +1021,7 @@ LLFloaterItemProperties::~LLFloaterItemProperties() { } -BOOL LLFloaterItemProperties::postBuild() +bool LLFloaterItemProperties::postBuild() { return LLFloater::postBuild(); } diff --git a/indra/newview/llfloatermarketplacelistings.h b/indra/newview/llfloatermarketplacelistings.h index e7bd5031e9..09b3dc64b6 100644 --- a/indra/newview/llfloatermarketplacelistings.h +++ b/indra/newview/llfloatermarketplacelistings.h @@ -52,8 +52,8 @@ class LLPanelMarketplaceListings : public LLPanel { public: LLPanelMarketplaceListings(); - BOOL postBuild(); - BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + bool postBuild(); + bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -72,7 +72,7 @@ private: bool onViewSortMenuItemCheck(const LLSD& userdata); void onAddButtonClicked(); void onAuditButtonClicked(); - void onSelectionChange(LLInventoryPanel *panel, const std::deque<LLFolderViewItem*>& items, BOOL user_action); + void onSelectionChange(LLInventoryPanel *panel, const std::deque<LLFolderViewItem*>& items, bool user_action); void onTabChange(); void onFilterEdit(const std::string& search_string); @@ -99,8 +99,8 @@ public: void initializeMarketPlace(); // virtuals - BOOL postBuild(); - BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + bool postBuild(); + bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -108,7 +108,7 @@ public: void showNotification(const LLNotificationPtr& notification); - BOOL handleHover(S32 x, S32 y, MASK mask); + bool handleHover(S32 x, S32 y, MASK mask); void onMouseLeave(S32 x, S32 y, MASK mask); protected: @@ -152,8 +152,8 @@ class LLFloaterAssociateListing : public LLFloater { friend class LLFloaterReg; public: - virtual BOOL postBuild(); - virtual BOOL handleKeyHere(KEY key, MASK mask); + virtual bool postBuild(); + virtual bool handleKeyHere(KEY key, MASK mask); static LLFloaterAssociateListing* show(const LLUUID& folder_id); @@ -162,7 +162,7 @@ private: virtual ~LLFloaterAssociateListing(); // UI Callbacks - void apply(BOOL user_confirm = TRUE); + void apply(bool user_confirm = true); void cancel(); void callback_apply(const LLSD& notification, const LLSD& response); @@ -184,7 +184,7 @@ public: LLFloaterMarketplaceValidation(const LLSD& key); virtual ~LLFloaterMarketplaceValidation(); - virtual BOOL postBuild(); + virtual bool postBuild(); virtual void draw(); virtual void onOpen(const LLSD& key); @@ -219,7 +219,7 @@ public: LLFloaterItemProperties(const LLSD& key); virtual ~LLFloaterItemProperties(); - BOOL postBuild(); + bool postBuild(); virtual void onOpen(const LLSD& key); private: diff --git a/indra/newview/llfloatermediasettings.cpp b/indra/newview/llfloatermediasettings.cpp index c1bbbf29be..2496887c9d 100644 --- a/indra/newview/llfloatermediasettings.cpp +++ b/indra/newview/llfloatermediasettings.cpp @@ -80,7 +80,7 @@ LLFloaterMediaSettings::~LLFloaterMediaSettings() //////////////////////////////////////////////////////////////////////////////// // -BOOL LLFloaterMediaSettings::postBuild() +bool LLFloaterMediaSettings::postBuild() { mApplyBtn = getChild<LLButton>("Apply"); mApplyBtn->setClickedCallback(onBtnApply, this); @@ -121,7 +121,7 @@ BOOL LLFloaterMediaSettings::postBuild() sInstance = this; - return TRUE; + return true; } //static diff --git a/indra/newview/llfloatermediasettings.h b/indra/newview/llfloatermediasettings.h index ceaea91d23..38730ddc98 100644 --- a/indra/newview/llfloatermediasettings.h +++ b/indra/newview/llfloatermediasettings.h @@ -41,9 +41,9 @@ public: LLFloaterMediaSettings(const LLSD& key); ~LLFloaterMediaSettings(); - /*virtual*/ BOOL postBuild(); - /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ void onClose(bool app_quitting); + bool postBuild() override; + void onOpen(const LLSD& key) override; + void onClose(bool app_quitting) override; static LLFloaterMediaSettings* getInstance(); static bool instanceExists(); @@ -55,7 +55,7 @@ public: const std::string getHomeUrl(); //bool passesWhiteList( const std::string& test_url ); - virtual void draw(); + virtual void draw() override; bool mIdenticalHasMediaInfo; bool mMultipleMedia; diff --git a/indra/newview/llfloatermemleak.cpp b/indra/newview/llfloatermemleak.cpp index fda9eeca51..cd5bea1be4 100644 --- a/indra/newview/llfloatermemleak.cpp +++ b/indra/newview/llfloatermemleak.cpp @@ -40,9 +40,9 @@ U32 LLFloaterMemLeak::sMemLeakingSpeed = 0 ; //bytes leaked per frame U32 LLFloaterMemLeak::sMaxLeakedMem = 0 ; //maximum allowed leaked memory U32 LLFloaterMemLeak::sTotalLeaked = 0 ; S32 LLFloaterMemLeak::sStatus = LLFloaterMemLeak::STOP ; -BOOL LLFloaterMemLeak::sbAllocationFailed = FALSE ; +bool LLFloaterMemLeak::sbAllocationFailed = false ; -extern BOOL gSimulateMemLeak; +extern bool gSimulateMemLeak; LLFloaterMemLeak::LLFloaterMemLeak(const LLSD& key) : LLFloater(key) @@ -57,7 +57,7 @@ LLFloaterMemLeak::LLFloaterMemLeak(const LLSD& key) } //---------------------------------------------- -BOOL LLFloaterMemLeak::postBuild(void) +bool LLFloaterMemLeak::postBuild(void) { F32 a, b ; a = getChild<LLUICtrl>("leak_speed")->getValue().asReal(); @@ -79,8 +79,8 @@ BOOL LLFloaterMemLeak::postBuild(void) sMaxLeakedMem = ((U32)b) << 20 ; } - sbAllocationFailed = FALSE ; - return TRUE ; + sbAllocationFailed = false ; + return true ; } LLFloaterMemLeak::~LLFloaterMemLeak() { @@ -105,14 +105,14 @@ void LLFloaterMemLeak::release() sStatus = STOP ; sTotalLeaked = 0 ; - sbAllocationFailed = FALSE ; - gSimulateMemLeak = FALSE; + sbAllocationFailed = false ; + gSimulateMemLeak = false; } void LLFloaterMemLeak::stop() { sStatus = STOP ; - sbAllocationFailed = TRUE ; + sbAllocationFailed = true ; } void LLFloaterMemLeak::idle() @@ -122,7 +122,7 @@ void LLFloaterMemLeak::idle() return ; } - sbAllocationFailed = FALSE ; + sbAllocationFailed = false ; if(RELEASE == sStatus) { @@ -183,7 +183,7 @@ void LLFloaterMemLeak::onChangeMaxMemLeaking() void LLFloaterMemLeak::onClickStart() { sStatus = START ; - gSimulateMemLeak = TRUE; + gSimulateMemLeak = true; } void LLFloaterMemLeak::onClickStop() @@ -198,7 +198,7 @@ void LLFloaterMemLeak::onClickRelease() void LLFloaterMemLeak::onClickClose() { - setVisible(FALSE); + setVisible(false); } void LLFloaterMemLeak::draw() diff --git a/indra/newview/llfloatermemleak.h b/indra/newview/llfloatermemleak.h index 6b760cc236..810c946e61 100644 --- a/indra/newview/llfloatermemleak.h +++ b/indra/newview/llfloatermemleak.h @@ -35,8 +35,8 @@ class LLFloaterMemLeak : public LLFloater public: /// initialize all the callbacks for the menu - virtual BOOL postBuild() ; - virtual void draw() ; + bool postBuild() override; + void draw() override; void onChangeLeakingSpeed(); void onChangeMaxMemLeaking(); @@ -67,7 +67,7 @@ private: static U32 sMaxLeakedMem ; //maximum allowed leaked memory static U32 sTotalLeaked ; static S32 sStatus ; //0: stop ; >0: start ; <0: release - static BOOL sbAllocationFailed ; + static bool sbAllocationFailed ; std::vector<char*> mLeakedMem ; }; diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 0ef7353eac..a91cdba5c0 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -75,15 +75,15 @@ LLFloaterModelPreview* LLFloaterModelPreview::sInstance = NULL; // should be represented by Retain spinner with values from 1 to 100 by 1. // To achieve this, RETAIN_COEFFICIENT is used while creating spinner // and when value is requested from spinner. -const double RETAIN_COEFFICIENT = 100; +constexpr double RETAIN_COEFFICIENT = 100; // "Cosine%" decomp parameter has values from 0.9 to 1 by 0.001 // But according to the UI spec for upload model floater, this parameter // should be represented by Smooth combobox with only 10 values. // So this const is used as a size of Smooth combobox list. -const S32 SMOOTH_VALUES_NUMBER = 10; -const S32 PREVIEW_RENDER_SIZE = 1024; -const F32 PREVIEW_CAMERA_DISTANCE = 16.f; +constexpr S32 SMOOTH_VALUES_NUMBER = 10; +constexpr S32 PREVIEW_RENDER_SIZE = 1024; +constexpr F32 PREVIEW_CAMERA_DISTANCE = 16.f; class LLMeshFilePicker : public LLFilePickerThread { @@ -148,11 +148,11 @@ mAvatarTabIndex(0) //----------------------------------------------------------------------------- // postBuild() //----------------------------------------------------------------------------- -BOOL LLFloaterModelPreview::postBuild() +bool LLFloaterModelPreview::postBuild() { if (!LLFloater::postBuild()) { - return FALSE; + return false; } childSetCommitCallback("cancel_btn", onCancel, this); @@ -283,14 +283,14 @@ BOOL LLFloaterModelPreview::postBuild() mCalculateBtn->setEnabled(false); } - return TRUE; + return true; } //----------------------------------------------------------------------------- // reshape() //----------------------------------------------------------------------------- -void LLFloaterModelPreview::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLFloaterModelPreview::reshape(S32 width, S32 height, bool called_from_parent) { LLFloaterModelUploadBase::reshape(width, height, called_from_parent); @@ -849,7 +849,7 @@ void LLFloaterModelPreview::draw() //----------------------------------------------------------------------------- // handleMouseDown() //----------------------------------------------------------------------------- -BOOL LLFloaterModelPreview::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLFloaterModelPreview::handleMouseDown(S32 x, S32 y, MASK mask) { if (mPreviewRect.pointInRect(x, y)) { @@ -858,7 +858,7 @@ BOOL LLFloaterModelPreview::handleMouseDown(S32 x, S32 y, MASK mask) gViewerWindow->hideCursor(); mLastMouseX = x; mLastMouseY = y; - return TRUE; + return true; } return LLFloater::handleMouseDown(x, y, mask); @@ -867,9 +867,9 @@ BOOL LLFloaterModelPreview::handleMouseDown(S32 x, S32 y, MASK mask) //----------------------------------------------------------------------------- // handleMouseUp() //----------------------------------------------------------------------------- -BOOL LLFloaterModelPreview::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLFloaterModelPreview::handleMouseUp(S32 x, S32 y, MASK mask) { - gFocusMgr.setMouseCapture(FALSE); + gFocusMgr.setMouseCapture(nullptr); gViewerWindow->showCursor(); return LLFloater::handleMouseUp(x, y, mask); } @@ -877,7 +877,7 @@ BOOL LLFloaterModelPreview::handleMouseUp(S32 x, S32 y, MASK mask) //----------------------------------------------------------------------------- // handleHover() //----------------------------------------------------------------------------- -BOOL LLFloaterModelPreview::handleHover (S32 x, S32 y, MASK mask) +bool LLFloaterModelPreview::handleHover (S32 x, S32 y, MASK mask) { MASK local_mask = mask & ~MASK_ALT; @@ -928,13 +928,13 @@ BOOL LLFloaterModelPreview::handleHover (S32 x, S32 y, MASK mask) gViewerWindow->setCursor(UI_CURSOR_TOOLZOOMIN); } - return TRUE; + return true; } //----------------------------------------------------------------------------- // handleScrollWheel() //----------------------------------------------------------------------------- -BOOL LLFloaterModelPreview::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLFloaterModelPreview::handleScrollWheel(S32 x, S32 y, S32 clicks) { if (mPreviewRect.pointInRect(x, y) && mModelPreview) { @@ -945,7 +945,7 @@ BOOL LLFloaterModelPreview::handleScrollWheel(S32 x, S32 y, S32 clicks) { LLFloaterModelUploadBase::handleScrollWheel(x, y, clicks); } - return TRUE; + return true; } /*virtual*/ @@ -1420,7 +1420,7 @@ void LLFloaterModelPreview::updateAvatarTab(bool highlight_overrides) LLModel* model = instance.mModel; const LLMeshSkinInfo *skin = &model->mSkinInfo; U32 joint_count = LLSkinningUtil::getMeshJointCount(skin); - U32 bind_count = highlight_overrides ? skin->mAlternateBindMatrix.size() : 0; // simply do not include overrides if data is not needed + U32 bind_count = highlight_overrides ? static_cast<U32>(skin->mAlternateBindMatrix.size()) : 0; // simply do not include overrides if data is not needed if (bind_count > 0 && bind_count != joint_count) { std::ostringstream out; @@ -1544,7 +1544,7 @@ void LLFloaterModelPreview::addStringToLogTab(const std::string& str, bool flash } LLWString text = utf8str_to_wstring(str); - S32 add_text_len = text.length() + 1; // newline + S32 add_text_len = static_cast<S32>(text.length()) + 1; // newline S32 editor_max_len = mUploadLogText->getMaxTextLength(); if (add_text_len > editor_max_len) { diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index 20e645532b..6adc084fe8 100644 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -69,16 +69,16 @@ public: LLFloaterModelPreview(const LLSD& key); virtual ~LLFloaterModelPreview(); - virtual BOOL postBuild(); - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + virtual bool postBuild(); + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true); void initModelPreview(); static bool showModelPreview(); - BOOL handleMouseDown(S32 x, S32 y, MASK mask); - BOOL handleMouseUp(S32 x, S32 y, MASK mask); - BOOL handleHover(S32 x, S32 y, MASK mask); - BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); + bool handleMouseDown(S32 x, S32 y, MASK mask); + bool handleMouseUp(S32 x, S32 y, MASK mask); + bool handleHover(S32 x, S32 y, MASK mask); + bool handleScrollWheel(S32 x, S32 y, S32 clicks); /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void onClose(bool app_quitting); diff --git a/indra/newview/llfloatermyenvironment.cpp b/indra/newview/llfloatermyenvironment.cpp index f93af9c312..df4526e69d 100644 --- a/indra/newview/llfloatermyenvironment.cpp +++ b/indra/newview/llfloatermyenvironment.cpp @@ -97,7 +97,7 @@ LLFloaterMyEnvironment::~LLFloaterMyEnvironment() } -BOOL LLFloaterMyEnvironment::postBuild() +bool LLFloaterMyEnvironment::postBuild() { mInventoryList = getChild<LLInventoryPanel>(PANEL_SETTINGS); @@ -108,7 +108,7 @@ BOOL LLFloaterMyEnvironment::postBuild() mInventoryList->setFilterTypes(filter_types); - mInventoryList->setSelectCallback([this](const std::deque<LLFolderViewItem*>&, BOOL) { onSelectionChange(); }); + mInventoryList->setSelectCallback([this](const std::deque<LLFolderViewItem*>&, bool) { onSelectionChange(); }); mInventoryList->setShowFolderState(mShowFolders); mInventoryList->setFilterSettingsTypes(mTypeFilter); } @@ -122,8 +122,8 @@ BOOL LLFloaterMyEnvironment::postBuild() mFilterEdit->setCommitCallback([this](LLUICtrl*, const LLSD& param){ onFilterEdit(param.asString()); }); childSetCommitCallback(BUTTON_DELETE, [this](LLUICtrl *, void*) { onDeleteSelected(); }, nullptr); - mSavedFolderState.setApply(FALSE); - return TRUE; + mSavedFolderState.setApply(false); + return true; } void LLFloaterMyEnvironment::refresh() @@ -205,7 +205,7 @@ void LLFloaterMyEnvironment::onFilterEdit(const std::string& search_string) return; } - mSavedFolderState.setApply(TRUE); + mSavedFolderState.setApply(true); mInventoryList->getRootFolder()->applyFunctorRecursively(mSavedFolderState); // add folder with current item to list of previously opened folders LLOpenFoldersWithSelection opener; @@ -216,7 +216,7 @@ void LLFloaterMyEnvironment::onFilterEdit(const std::string& search_string) else if (mInventoryList->getFilterSubString().empty()) { // first letter in search term, save existing folder open state - mSavedFolderState.setApply(FALSE); + mSavedFolderState.setApply(false); mInventoryList->getRootFolder()->applyFunctorRecursively(mSavedFolderState); } @@ -247,7 +247,7 @@ void LLFloaterMyEnvironment::onDeleteSelected() LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(inv_item); new_item->setParent(trash_id); - new_item->updateParentOnServer(FALSE); + new_item->updateParentOnServer(false); gInventory.updateItem(new_item); } } diff --git a/indra/newview/llfloatermyenvironment.h b/indra/newview/llfloatermyenvironment.h index 54e23c4f6e..8e81b8e5e2 100644 --- a/indra/newview/llfloatermyenvironment.h +++ b/indra/newview/llfloatermyenvironment.h @@ -43,7 +43,7 @@ public: LLFloaterMyEnvironment(const LLSD& key); virtual ~LLFloaterMyEnvironment(); - virtual BOOL postBuild() override; + virtual bool postBuild() override; virtual void refresh() override; virtual void onOpen(const LLSD& key) override; diff --git a/indra/newview/llfloatermyscripts.cpp b/indra/newview/llfloatermyscripts.cpp index 5426629430..0283855f15 100644 --- a/indra/newview/llfloatermyscripts.cpp +++ b/indra/newview/llfloatermyscripts.cpp @@ -36,7 +36,7 @@ #include "lltrans.h" #include "llviewerregion.h" -const S32 SIZE_OF_ONE_KB = 1024; +constexpr S32 SIZE_OF_ONE_KB = 1024; LLFloaterMyScripts::LLFloaterMyScripts(const LLSD& seed) : LLFloater(seed), @@ -50,14 +50,14 @@ LLFloaterMyScripts::LLFloaterMyScripts(const LLSD& seed) { } -BOOL LLFloaterMyScripts::postBuild() +bool LLFloaterMyScripts::postBuild() { childSetAction("refresh_list_btn", onClickRefresh, this); std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestWaiting"); getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting)); mAttachmentDetailsRequested = requestAttachmentDetails(); - return TRUE; + return true; } // virtual @@ -137,7 +137,7 @@ void LLFloaterMyScripts::setAttachmentDetails(LLSD content) return; } - S32 number_attachments = content["attachments"].size(); + S32 number_attachments = static_cast<S32>(content["attachments"].size()); for(int i = 0; i < number_attachments; i++) { @@ -148,7 +148,7 @@ void LLFloaterMyScripts::setAttachmentDetails(LLSD content) humanReadableLocation = LLTrans::getString(actualLocation.c_str()); } - S32 number_objects = content["attachments"][i]["objects"].size(); + S32 number_objects = static_cast<S32>(content["attachments"][i]["objects"].size()); for(int j = 0; j < number_objects; j++) { LLUUID task_id = content["attachments"][i]["objects"][j]["id"].asUUID(); diff --git a/indra/newview/llfloatermyscripts.h b/indra/newview/llfloatermyscripts.h index 857a2d72f2..09affabd6a 100644 --- a/indra/newview/llfloatermyscripts.h +++ b/indra/newview/llfloatermyscripts.h @@ -35,8 +35,8 @@ class LLFloaterMyScripts : public LLFloater public: LLFloaterMyScripts(const LLSD& seed); - BOOL postBuild(); - /*virtual*/ void onOpen(const LLSD& key); + bool postBuild() override; + void onOpen(const LLSD& key) override; void setAttachmentDetails(LLSD content); void setAttachmentSummary(LLSD content); bool requestAttachmentDetails(); diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp index b47deb838b..01c50d89c5 100644 --- a/indra/newview/llfloaternamedesc.cpp +++ b/indra/newview/llfloaternamedesc.cpp @@ -64,7 +64,7 @@ const S32 PREVIEW_HPAD = PREVIEW_RESIZE_HANDLE_SIZE; //----------------------------------------------------------------------------- LLFloaterNameDesc::LLFloaterNameDesc(const LLSD& filename ) : LLFloater(filename), - mIsAudio(FALSE) + mIsAudio(false) { mFilenameAndPath = filename.asString(); mFilename = gDirUtilp->getBaseFileName(mFilenameAndPath, false); @@ -73,7 +73,7 @@ LLFloaterNameDesc::LLFloaterNameDesc(const LLSD& filename ) //----------------------------------------------------------------------------- // postBuild() //----------------------------------------------------------------------------- -BOOL LLFloaterNameDesc::postBuild() +bool LLFloaterNameDesc::postBuild() { LLRect r; @@ -135,7 +135,7 @@ BOOL LLFloaterNameDesc::postBuild() setDefaultBtn("ok_btn"); - return TRUE; + return true; } S32 LLFloaterNameDesc::getExpectedUploadCost() const @@ -186,7 +186,7 @@ void LLFloaterNameDesc::doCommit() //----------------------------------------------------------------------------- void LLFloaterNameDesc::onBtnOK( ) { - getChildView("ok_btn")->setEnabled(FALSE); // don't allow inadvertent extra uploads + getChildView("ok_btn")->setEnabled(false); // don't allow inadvertent extra uploads LLAssetStorage::LLStoreAssetCallback callback; S32 expected_upload_cost = getExpectedUploadCost(); @@ -233,17 +233,17 @@ void LLFloaterNameDesc::onBtnCancel() LLFloaterSoundPreview::LLFloaterSoundPreview(const LLSD& filename ) : LLFloaterNameDesc(filename) { - mIsAudio = TRUE; + mIsAudio = true; } -BOOL LLFloaterSoundPreview::postBuild() +bool LLFloaterSoundPreview::postBuild() { if (!LLFloaterNameDesc::postBuild()) { - return FALSE; + return false; } getChild<LLUICtrl>("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this)); - return TRUE; + return true; } @@ -256,14 +256,14 @@ LLFloaterAnimPreview::LLFloaterAnimPreview(const LLSD& filename ) { } -BOOL LLFloaterAnimPreview::postBuild() +bool LLFloaterAnimPreview::postBuild() { if (!LLFloaterNameDesc::postBuild()) { - return FALSE; + return false; } getChild<LLUICtrl>("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this)); - return TRUE; + return true; } //----------------------------------------------------------------------------- @@ -273,15 +273,15 @@ BOOL LLFloaterAnimPreview::postBuild() LLFloaterScriptPreview::LLFloaterScriptPreview(const LLSD& filename ) : LLFloaterNameDesc(filename) { - mIsText = TRUE; + mIsText = true; } -BOOL LLFloaterScriptPreview::postBuild() +bool LLFloaterScriptPreview::postBuild() { if (!LLFloaterNameDesc::postBuild()) { - return FALSE; + return false; } getChild<LLUICtrl>("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this)); - return TRUE; + return true; } diff --git a/indra/newview/llfloaternamedesc.h b/indra/newview/llfloaternamedesc.h index 4b3a9b536d..aa5571ccc0 100644 --- a/indra/newview/llfloaternamedesc.h +++ b/indra/newview/llfloaternamedesc.h @@ -41,7 +41,7 @@ class LLFloaterNameDesc : public LLFloater public: LLFloaterNameDesc(const LLSD& filename); virtual ~LLFloaterNameDesc(); - virtual BOOL postBuild(); + bool postBuild() override; void onBtnOK(); void onBtnCancel(); @@ -50,10 +50,10 @@ public: virtual S32 getExpectedUploadCost() const; protected: - virtual void onCommit(); + virtual void onCommit() override; protected: - BOOL mIsAudio; + bool mIsAudio; bool mIsText; std::string mFilenameAndPath; @@ -64,21 +64,21 @@ class LLFloaterSoundPreview : public LLFloaterNameDesc { public: LLFloaterSoundPreview(const LLSD& filename ); - virtual BOOL postBuild(); + bool postBuild() override; }; class LLFloaterAnimPreview : public LLFloaterNameDesc { public: LLFloaterAnimPreview(const LLSD& filename ); - virtual BOOL postBuild(); + bool postBuild() override; }; class LLFloaterScriptPreview : public LLFloaterNameDesc { public: LLFloaterScriptPreview(const LLSD& filename ); - virtual BOOL postBuild(); + bool postBuild() override; }; #endif // LL_LLFLOATERNAMEDESC_H diff --git a/indra/newview/llfloaternewfeaturenotification.cpp b/indra/newview/llfloaternewfeaturenotification.cpp index 989b9c3b44..369727ff1e 100644 --- a/indra/newview/llfloaternewfeaturenotification.cpp +++ b/indra/newview/llfloaternewfeaturenotification.cpp @@ -38,9 +38,9 @@ LLFloaterNewFeatureNotification::~LLFloaterNewFeatureNotification() { } -BOOL LLFloaterNewFeatureNotification::postBuild() +bool LLFloaterNewFeatureNotification::postBuild() { - setCanDrag(FALSE); + setCanDrag(false); getChild<LLButton>("close_btn")->setCommitCallback(boost::bind(&LLFloaterNewFeatureNotification::onCloseBtn, this)); const std::string title_txt = "title_txt"; @@ -57,7 +57,7 @@ BOOL LLFloaterNewFeatureNotification::postBuild() reshape(rect.getWidth() + 90, rect.getHeight() + 45); } - return TRUE; + return true; } void LLFloaterNewFeatureNotification::onOpen(const LLSD& key) diff --git a/indra/newview/llfloaternewfeaturenotification.h b/indra/newview/llfloaternewfeaturenotification.h index 42f624a04a..5afb8e71e8 100644 --- a/indra/newview/llfloaternewfeaturenotification.h +++ b/indra/newview/llfloaternewfeaturenotification.h @@ -34,7 +34,7 @@ class LLFloaterNewFeatureNotification: { friend class LLFloaterReg; public: - BOOL postBuild() override; + bool postBuild() override; void onOpen(const LLSD& key) override; private: diff --git a/indra/newview/llfloaternotificationsconsole.cpp b/indra/newview/llfloaternotificationsconsole.cpp index dbeb5ca573..a819b30e30 100644 --- a/indra/newview/llfloaternotificationsconsole.cpp +++ b/indra/newview/llfloaternotificationsconsole.cpp @@ -42,7 +42,7 @@ class LLNotificationChannelPanel : public LLLayoutPanel public: LLNotificationChannelPanel(const Params& p); ~LLNotificationChannelPanel(); - BOOL postBuild(); + bool postBuild(); private: bool update(const LLSD& payload); @@ -72,7 +72,7 @@ LLNotificationChannelPanel::~LLNotificationChannelPanel() } } -BOOL LLNotificationChannelPanel::postBuild() +bool LLNotificationChannelPanel::postBuild() { LLButton* header_button = getChild<LLButton>("header"); header_button->setLabel(mChannelPtr->getName()); @@ -83,7 +83,7 @@ BOOL LLNotificationChannelPanel::postBuild() LLScrollListCtrl* scroll = getChild<LLScrollListCtrl>("notifications_list"); scroll->setDoubleClickCallback(onClickNotification, this); scroll->setRect(LLRect( getRect().mLeft, getRect().mTop, getRect().mRight, 0)); - return TRUE; + return true; } //static @@ -117,7 +117,7 @@ void LLNotificationChannelPanel::onClickNotification(void* user_data) void* data = firstselected->getUserdata(); if (data) { - gFloaterView->getParentFloater(self)->addDependentFloater(new LLFloaterNotification((LLNotification*)data), TRUE); + gFloaterView->getParentFloater(self)->addDependentFloater(new LLFloaterNotification((LLNotification*)data), true); } } } @@ -154,7 +154,7 @@ LLFloaterNotificationConsole::LLFloaterNotificationConsole(const LLSD& key) mCommitCallbackRegistrar.add("ClickAdd", boost::bind(&LLFloaterNotificationConsole::onClickAdd, this)); } -BOOL LLFloaterNotificationConsole::postBuild() +bool LLFloaterNotificationConsole::postBuild() { // these are in the order of processing addChannel("Unexpired"); @@ -181,7 +181,7 @@ BOOL LLFloaterNotificationConsole::postBuild() } notifications->sortByName(); - return TRUE; + return true; } void LLFloaterNotificationConsole::addChannel(const std::string& name, bool open) @@ -240,7 +240,7 @@ LLFloaterNotification::LLFloaterNotification(LLNotification* note) buildFromFile("floater_notification.xml"); } -BOOL LLFloaterNotification::postBuild() +bool LLFloaterNotification::postBuild() { setTitle(mNote->getName()); getChild<LLUICtrl>("payload")->setValue(mNote->getMessage()); @@ -250,7 +250,7 @@ BOOL LLFloaterNotification::postBuild() LLNotificationFormPtr form(mNote->getForm()); if(!form) { - return TRUE; + return true; } responses_combo->setCommitCallback(onCommitResponse, this); @@ -264,7 +264,7 @@ BOOL LLFloaterNotification::postBuild() response_list->addSimpleElement(text); } - return TRUE; + return true; } void LLFloaterNotification::respond() diff --git a/indra/newview/llfloaternotificationsconsole.h b/indra/newview/llfloaternotificationsconsole.h index 75161f8096..d644f74e13 100644 --- a/indra/newview/llfloaternotificationsconsole.h +++ b/indra/newview/llfloaternotificationsconsole.h @@ -41,7 +41,7 @@ class LLFloaterNotificationConsole : public: // LLPanel - BOOL postBuild(); + bool postBuild(); void addChannel(const std::string& type, bool open = false); void updateResizeLimits(LLLayoutStack &stack); @@ -64,7 +64,7 @@ public: LLFloaterNotification(LLNotification* note); // LLPanel - BOOL postBuild(); + bool postBuild(); void respond(); private: diff --git a/indra/newview/llfloaternotificationstabbed.cpp b/indra/newview/llfloaternotificationstabbed.cpp index 28ef403cf7..e571011acf 100644 --- a/indra/newview/llfloaternotificationstabbed.cpp +++ b/indra/newview/llfloaternotificationstabbed.cpp @@ -58,7 +58,7 @@ LLFloaterNotificationsTabbed::LLFloaterNotificationsTabbed(const LLSD& key) : LL } //--------------------------------------------------------------------------------- -BOOL LLFloaterNotificationsTabbed::postBuild() +bool LLFloaterNotificationsTabbed::postBuild() { mGroupInviteMessageList = getChild<LLNotificationListView>("group_invite_notification_list"); mGroupNoticeMessageList = getChild<LLNotificationListView>("group_notice_notification_list"); @@ -78,14 +78,14 @@ BOOL LLFloaterNotificationsTabbed::postBuild() // get a corresponding channel initChannel(); - BOOL rv = LLTransientDockableFloater::postBuild(); + bool rv = LLTransientDockableFloater::postBuild(); setTitle(getString("title_notification_tabbed_window")); return rv; } //--------------------------------------------------------------------------------- -void LLFloaterNotificationsTabbed::setMinimized(BOOL minimize) +void LLFloaterNotificationsTabbed::setMinimized(bool minimize) { LLTransientDockableFloater::setMinimized(minimize); } @@ -101,7 +101,7 @@ void LLFloaterNotificationsTabbed::handleReshape(const LLRect& rect, bool by_use void LLFloaterNotificationsTabbed::onStartUpToastClick(S32 x, S32 y, MASK mask) { // just set floater visible. Screen channels will be cleared. - setVisible(TRUE); + setVisible(true); } //--------------------------------------------------------------------------------- @@ -140,7 +140,7 @@ void LLFloaterNotificationsTabbed::removeItemByID(const LLUUID& id, std::string // hide chiclet window if there are no items left if(isWindowEmpty()) { - setVisible(FALSE); + setVisible(false); } } @@ -168,7 +168,7 @@ void LLFloaterNotificationsTabbed::initChannel() } //--------------------------------------------------------------------------------- -void LLFloaterNotificationsTabbed::setVisible(BOOL visible) +void LLFloaterNotificationsTabbed::setVisible(bool visible) { if (visible) { @@ -186,7 +186,7 @@ void LLFloaterNotificationsTabbed::setVisible(BOOL visible) } // do not show empty window - if (NULL == mNotificationsSeparator || isWindowEmpty()) visible = FALSE; + if (NULL == mNotificationsSeparator || isWindowEmpty()) visible = false; LLTransientDockableFloater::setVisible(visible); @@ -356,7 +356,7 @@ void LLFloaterNotificationsTabbed::collapseAllOnCurrentTab() { LLNotificationListItem* notify_item = dynamic_cast<LLNotificationListItem*>(*iter); if (notify_item) - notify_item->setExpanded(FALSE); + notify_item->setExpanded(false); } } @@ -411,7 +411,7 @@ void LLFloaterNotificationsTabbed::onItemClick(LLNotificationListItem* item) } else { - item->setExpanded(TRUE); + item->setExpanded(true); } } diff --git a/indra/newview/llfloaternotificationstabbed.h b/indra/newview/llfloaternotificationstabbed.h index 4cdcce82c1..87e880c8d2 100644 --- a/indra/newview/llfloaternotificationstabbed.h +++ b/indra/newview/llfloaternotificationstabbed.h @@ -72,7 +72,7 @@ public: LLFloaterNotificationsTabbed(const LLSD& key); virtual ~LLFloaterNotificationsTabbed(); - BOOL postBuild(); + bool postBuild(); // other interface functions // check is window empty @@ -85,11 +85,11 @@ public: void updateNotificationCounter(S32 panelIndex, S32 counterValue, std::string stringName); // Operating with outfit - virtual void setVisible(BOOL visible); + virtual void setVisible(bool visible); /*virtual*/ void setDocked(bool docked, bool pop_on_undock = true); // override LLFloater's minimization according to EXT-1216 - /*virtual*/ void setMinimized(BOOL minimize); + /*virtual*/ void setMinimized(bool minimize); /*virtual*/ void handleReshape(const LLRect& rect, bool by_user); void onStartUpToastClick(S32 x, S32 y, MASK mask); @@ -101,8 +101,8 @@ public: static LLFloaterNotificationsTabbed* getInstance(const LLSD& key = LLSD()); // size constants for the window and for its elements - static const S32 MAX_WINDOW_HEIGHT = 200; - static const S32 MIN_WINDOW_WIDTH = 318; + static constexpr S32 MAX_WINDOW_HEIGHT = 200; + static constexpr S32 MIN_WINDOW_WIDTH = 318; private: // init Window's channel diff --git a/indra/newview/llfloaterobjectweights.cpp b/indra/newview/llfloaterobjectweights.cpp index 090b0657d1..26b7304b9a 100644 --- a/indra/newview/llfloaterobjectweights.cpp +++ b/indra/newview/llfloaterobjectweights.cpp @@ -84,7 +84,7 @@ LLFloaterObjectWeights::~LLFloaterObjectWeights() } // virtual -BOOL LLFloaterObjectWeights::postBuild() +bool LLFloaterObjectWeights::postBuild() { mSelectedObjects = getChild<LLTextBox>("objects"); mSelectedPrims = getChild<LLTextBox>("prims"); @@ -99,7 +99,7 @@ BOOL LLFloaterObjectWeights::postBuild() mRemainingCapacity = getChild<LLTextBox>("remaining_capacity"); mTotalCapacity = getChild<LLTextBox>("total_capacity"); - return TRUE; + return true; } // virtual diff --git a/indra/newview/llfloaterobjectweights.h b/indra/newview/llfloaterobjectweights.h index 10e790f5aa..3b999f6b9b 100644 --- a/indra/newview/llfloaterobjectweights.h +++ b/indra/newview/llfloaterobjectweights.h @@ -58,7 +58,7 @@ public: LLFloaterObjectWeights(const LLSD& key); ~LLFloaterObjectWeights(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void onOpen(const LLSD& key); diff --git a/indra/newview/llfloateropenobject.cpp b/indra/newview/llfloateropenobject.cpp index 408eac6289..b06e35f65d 100644 --- a/indra/newview/llfloateropenobject.cpp +++ b/indra/newview/llfloateropenobject.cpp @@ -53,7 +53,7 @@ LLFloaterOpenObject::LLFloaterOpenObject(const LLSD& key) : LLFloater(key), mPanelInventoryObject(NULL), - mDirty(TRUE) + mDirty(true) { mCommitCallbackRegistrar.add("OpenObject.MoveToInventory", boost::bind(&LLFloaterOpenObject::onClickMoveToInventory, this)); mCommitCallbackRegistrar.add("OpenObject.Cancel", boost::bind(&LLFloaterOpenObject::onClickCancel, this)); @@ -65,13 +65,13 @@ LLFloaterOpenObject::~LLFloaterOpenObject() } // virtual -BOOL LLFloaterOpenObject::postBuild() +bool LLFloaterOpenObject::postBuild() { getChild<LLUICtrl>("object_name")->setTextArg("[DESC]", std::string("Object") ); // *Note: probably do not want to translate this mPanelInventoryObject = getChild<LLPanelObjectInventory>("object_contents"); refresh(); - return TRUE; + return true; } void LLFloaterOpenObject::onOpen(const LLSD& key) @@ -97,18 +97,18 @@ void LLFloaterOpenObject::refresh() mPanelInventoryObject->refresh(); std::string name = ""; - BOOL enabled = FALSE; + bool enabled = false; LLSelectNode* node = mObjectSelection->getFirstRootNode(); if (node) { name = node->mName; - enabled = TRUE; + enabled = true; } else { name = ""; - enabled = FALSE; + enabled = false; } getChild<LLUICtrl>("object_name")->setTextArg("[DESC]", name); @@ -123,14 +123,14 @@ void LLFloaterOpenObject::draw() if (mDirty) { refresh(); - mDirty = FALSE; + mDirty = false; } LLFloater::draw(); } void LLFloaterOpenObject::dirty() { - mDirty = TRUE; + mDirty = true; } @@ -184,9 +184,9 @@ void LLFloaterOpenObject::callbackCreateInventoryCategory(const LLUUID& category // Copy and/or move the items into the newly created folder. // Ignore any "you're going to break this item" messages. - BOOL success = move_inv_category_world_to_agent(object_id, + bool success = move_inv_category_world_to_agent(object_id, category_id, - TRUE, + true, [](S32 result, void* data, const LLMoveInv*) { callbackMoveInventory(result, data); diff --git a/indra/newview/llfloateropenobject.h b/indra/newview/llfloateropenobject.h index 58d491a5d7..3670dbc5e6 100644 --- a/indra/newview/llfloateropenobject.h +++ b/indra/newview/llfloateropenobject.h @@ -55,7 +55,7 @@ public: protected: - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); void refresh(); void draw(); virtual void onOpen(const LLSD& key); @@ -76,7 +76,7 @@ protected: LLPanelObjectInventory* mPanelInventoryObject; LLSafeHandle<LLObjectSelection> mObjectSelection; - BOOL mDirty; + bool mDirty; }; #endif diff --git a/indra/newview/llfloaterpathfindingcharacters.cpp b/indra/newview/llfloaterpathfindingcharacters.cpp index b6775f3061..848672b1fc 100644 --- a/indra/newview/llfloaterpathfindingcharacters.cpp +++ b/indra/newview/llfloaterpathfindingcharacters.cpp @@ -65,17 +65,17 @@ void LLFloaterPathfindingCharacters::onClose(bool pIsAppQuitting) LLFloaterPathfindingObjects::onClose( pIsAppQuitting ); } -BOOL LLFloaterPathfindingCharacters::isShowPhysicsCapsule() const +bool LLFloaterPathfindingCharacters::isShowPhysicsCapsule() const { return mShowPhysicsCapsuleCheckBox->get(); } -void LLFloaterPathfindingCharacters::setShowPhysicsCapsule(BOOL pIsShowPhysicsCapsule) +void LLFloaterPathfindingCharacters::setShowPhysicsCapsule(bool pIsShowPhysicsCapsule) { mShowPhysicsCapsuleCheckBox->set(pIsShowPhysicsCapsule && (LLPathingLib::getInstance() != NULL)); } -BOOL LLFloaterPathfindingCharacters::isPhysicsCapsuleEnabled(LLUUID& id, LLVector3& pos, LLQuaternion& rot) const +bool LLFloaterPathfindingCharacters::isPhysicsCapsuleEnabled(LLUUID& id, LLVector3& pos, LLQuaternion& rot) const { id = mSelectedCharacterId; // Physics capsule is enable if the checkbox is enabled and if we can get the required render @@ -117,7 +117,7 @@ LLFloaterPathfindingCharacters::~LLFloaterPathfindingCharacters() { } -BOOL LLFloaterPathfindingCharacters::postBuild() +bool LLFloaterPathfindingCharacters::postBuild() { mBeaconColor = LLUIColorTable::getInstance()->getColor("PathfindingCharacterBeaconColor"); @@ -195,7 +195,7 @@ void LLFloaterPathfindingCharacters::onShowPhysicsCapsuleClicked() { if (isShowPhysicsCapsule()) { - setShowPhysicsCapsule(FALSE); + setShowPhysicsCapsule(false); } } else @@ -246,7 +246,7 @@ void LLFloaterPathfindingCharacters::updateStateOnDisplayControls() mShowPhysicsCapsuleCheckBox->setEnabled(isEditEnabled); if (!isEditEnabled) { - setShowPhysicsCapsule(FALSE); + setShowPhysicsCapsule(false); } } @@ -284,7 +284,7 @@ void LLFloaterPathfindingCharacters::showCapsule() const if (LLPathingLib::getInstance() != NULL) { LLPathingLib::getInstance()->createPhysicsCapsuleRep(character->getLength(), character->getRadius(), - character->isHorizontal(), character->getUUID()); + (BOOL)character->isHorizontal(), character->getUUID()); } } diff --git a/indra/newview/llfloaterpathfindingcharacters.h b/indra/newview/llfloaterpathfindingcharacters.h index 4f9c7aadc0..1215bb72ec 100644 --- a/indra/newview/llfloaterpathfindingcharacters.h +++ b/indra/newview/llfloaterpathfindingcharacters.h @@ -44,10 +44,10 @@ class LLFloaterPathfindingCharacters : public LLFloaterPathfindingObjects public: virtual void onClose(bool pIsAppQuitting); - BOOL isShowPhysicsCapsule() const; - void setShowPhysicsCapsule(BOOL pIsShowPhysicsCapsule); + bool isShowPhysicsCapsule() const; + void setShowPhysicsCapsule(bool pIsShowPhysicsCapsule); - BOOL isPhysicsCapsuleEnabled(LLUUID& id, LLVector3& pos, LLQuaternion& rot) const; + bool isPhysicsCapsuleEnabled(LLUUID& id, LLVector3& pos, LLQuaternion& rot) const; static void openCharactersWithSelectedObjects(); static LLHandle<LLFloaterPathfindingCharacters> getInstanceHandle(); @@ -58,7 +58,7 @@ protected: LLFloaterPathfindingCharacters(const LLSD& pSeed); virtual ~LLFloaterPathfindingCharacters(); - virtual BOOL postBuild(); + virtual bool postBuild(); virtual void requestGetObjects(); diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index f2dffb2b67..994a5c0c02 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -30,10 +30,6 @@ #include "llfloaterpathfindingconsole.h" -#include <vector> - -#include <boost/signals2.hpp> - #include "llagent.h" #include "llbutton.h" #include "llcheckboxctrl.h" @@ -46,7 +42,6 @@ #include "llpanel.h" #include "llpathfindingnavmeshzone.h" #include "llpathfindingpathtool.h" -#include "llpathinglib.h" #include "llsliderctrl.h" #include "llsd.h" #include "lltabcontainer.h" @@ -95,7 +90,7 @@ LLHandle<LLFloaterPathfindingConsole> LLFloaterPathfindingConsole::sInstanceHand // LLFloaterPathfindingConsole //--------------------------------------------------------------------------- -BOOL LLFloaterPathfindingConsole::postBuild() +bool LLFloaterPathfindingConsole::postBuild() { mViewTestTabContainer = findChild<LLTabContainer>("view_test_tab_container"); llassert(mViewTestTabContainer != NULL); @@ -297,94 +292,94 @@ LLHandle<LLFloaterPathfindingConsole> LLFloaterPathfindingConsole::getInstanceHa return sInstanceHandle; } -BOOL LLFloaterPathfindingConsole::isRenderNavMesh() const +bool LLFloaterPathfindingConsole::isRenderNavMesh() const { return mShowNavMeshCheckBox->get(); } -void LLFloaterPathfindingConsole::setRenderNavMesh(BOOL pIsRenderNavMesh) +void LLFloaterPathfindingConsole::setRenderNavMesh(bool pIsRenderNavMesh) { mShowNavMeshCheckBox->set(pIsRenderNavMesh); setNavMeshRenderState(); } -BOOL LLFloaterPathfindingConsole::isRenderWalkables() const +bool LLFloaterPathfindingConsole::isRenderWalkables() const { return mShowWalkablesCheckBox->get(); } -void LLFloaterPathfindingConsole::setRenderWalkables(BOOL pIsRenderWalkables) +void LLFloaterPathfindingConsole::setRenderWalkables(bool pIsRenderWalkables) { mShowWalkablesCheckBox->set(pIsRenderWalkables); } -BOOL LLFloaterPathfindingConsole::isRenderStaticObstacles() const +bool LLFloaterPathfindingConsole::isRenderStaticObstacles() const { return mShowStaticObstaclesCheckBox->get(); } -void LLFloaterPathfindingConsole::setRenderStaticObstacles(BOOL pIsRenderStaticObstacles) +void LLFloaterPathfindingConsole::setRenderStaticObstacles(bool pIsRenderStaticObstacles) { mShowStaticObstaclesCheckBox->set(pIsRenderStaticObstacles); } -BOOL LLFloaterPathfindingConsole::isRenderMaterialVolumes() const +bool LLFloaterPathfindingConsole::isRenderMaterialVolumes() const { return mShowMaterialVolumesCheckBox->get(); } -void LLFloaterPathfindingConsole::setRenderMaterialVolumes(BOOL pIsRenderMaterialVolumes) +void LLFloaterPathfindingConsole::setRenderMaterialVolumes(bool pIsRenderMaterialVolumes) { mShowMaterialVolumesCheckBox->set(pIsRenderMaterialVolumes); } -BOOL LLFloaterPathfindingConsole::isRenderExclusionVolumes() const +bool LLFloaterPathfindingConsole::isRenderExclusionVolumes() const { return mShowExclusionVolumesCheckBox->get(); } -void LLFloaterPathfindingConsole::setRenderExclusionVolumes(BOOL pIsRenderExclusionVolumes) +void LLFloaterPathfindingConsole::setRenderExclusionVolumes(bool pIsRenderExclusionVolumes) { mShowExclusionVolumesCheckBox->set(pIsRenderExclusionVolumes); } -BOOL LLFloaterPathfindingConsole::isRenderWorld() const +bool LLFloaterPathfindingConsole::isRenderWorld() const { return mShowWorldCheckBox->get(); } -void LLFloaterPathfindingConsole::setRenderWorld(BOOL pIsRenderWorld) +void LLFloaterPathfindingConsole::setRenderWorld(bool pIsRenderWorld) { mShowWorldCheckBox->set(pIsRenderWorld); setWorldRenderState(); } -BOOL LLFloaterPathfindingConsole::isRenderWorldMovablesOnly() const +bool LLFloaterPathfindingConsole::isRenderWorldMovablesOnly() const { return (mShowWorldCheckBox->get() && mShowWorldMovablesOnlyCheckBox->get()); } -void LLFloaterPathfindingConsole::setRenderWorldMovablesOnly(BOOL pIsRenderWorldMovablesOnly) +void LLFloaterPathfindingConsole::setRenderWorldMovablesOnly(bool pIsRenderWorldMovablesOnly) { mShowWorldMovablesOnlyCheckBox->set(pIsRenderWorldMovablesOnly); } -BOOL LLFloaterPathfindingConsole::isRenderWaterPlane() const +bool LLFloaterPathfindingConsole::isRenderWaterPlane() const { return mShowRenderWaterPlaneCheckBox->get(); } -void LLFloaterPathfindingConsole::setRenderWaterPlane(BOOL pIsRenderWaterPlane) +void LLFloaterPathfindingConsole::setRenderWaterPlane(bool pIsRenderWaterPlane) { mShowRenderWaterPlaneCheckBox->set(pIsRenderWaterPlane); } -BOOL LLFloaterPathfindingConsole::isRenderXRay() const +bool LLFloaterPathfindingConsole::isRenderXRay() const { return mShowXRayCheckBox->get(); } -void LLFloaterPathfindingConsole::setRenderXRay(BOOL pIsRenderXRay) +void LLFloaterPathfindingConsole::setRenderXRay(bool pIsRenderXRay) { mShowXRayCheckBox->set(pIsRenderXRay); } @@ -603,8 +598,8 @@ void LLFloaterPathfindingConsole::handleNavMeshZoneStatus(LLPathfindingNavMeshZo void LLFloaterPathfindingConsole::onRegionBoundaryCross() { initializeNavMeshZoneForCurrentRegion(); - setRenderWorld(TRUE); - setRenderWorldMovablesOnly(FALSE); + setRenderWorld(true); + setRenderWorldMovablesOnly(false); } void LLFloaterPathfindingConsole::onPathEvent() @@ -644,15 +639,15 @@ void LLFloaterPathfindingConsole::onPathEvent() void LLFloaterPathfindingConsole::setDefaultInputs() { mViewTestTabContainer->selectTab(XUI_VIEW_TAB_INDEX); - setRenderWorld(TRUE); - setRenderWorldMovablesOnly(FALSE); - setRenderNavMesh(FALSE); - setRenderWalkables(FALSE); - setRenderMaterialVolumes(FALSE); - setRenderStaticObstacles(FALSE); - setRenderExclusionVolumes(FALSE); - setRenderWaterPlane(FALSE); - setRenderXRay(FALSE); + setRenderWorld(true); + setRenderWorldMovablesOnly(false); + setRenderNavMesh(false); + setRenderWalkables(false); + setRenderMaterialVolumes(false); + setRenderStaticObstacles(false); + setRenderExclusionVolumes(false); + setRenderWaterPlane(false); + setRenderXRay(false); } void LLFloaterPathfindingConsole::setConsoleState(EConsoleState pConsoleState) @@ -665,18 +660,18 @@ void LLFloaterPathfindingConsole::setConsoleState(EConsoleState pConsoleState) void LLFloaterPathfindingConsole::setWorldRenderState() { - BOOL renderWorld = isRenderWorld(); + bool renderWorld = isRenderWorld(); mShowWorldMovablesOnlyCheckBox->setEnabled(renderWorld && mShowWorldCheckBox->getEnabled()); if (!renderWorld) { - mShowWorldMovablesOnlyCheckBox->set(FALSE); + mShowWorldMovablesOnlyCheckBox->set(false); } } void LLFloaterPathfindingConsole::setNavMeshRenderState() { - BOOL renderNavMesh = isRenderNavMesh(); + bool renderNavMesh = isRenderNavMesh(); mShowNavMeshWalkabilityLabel->setEnabled(renderNavMesh); mShowNavMeshWalkabilityComboBox->setEnabled(renderNavMesh); @@ -702,106 +697,106 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() case kConsoleStateRegionNotEnabled : case kConsoleStateRegionLoading : mViewTestTabContainer->selectTab(XUI_VIEW_TAB_INDEX); - mViewTab->setEnabled(FALSE); - mShowLabel->setEnabled(FALSE); - mShowWorldCheckBox->setEnabled(FALSE); - mShowWorldMovablesOnlyCheckBox->setEnabled(FALSE); - mShowNavMeshCheckBox->setEnabled(FALSE); - mShowNavMeshWalkabilityLabel->setEnabled(FALSE); - mShowNavMeshWalkabilityComboBox->setEnabled(FALSE); - mShowWalkablesCheckBox->setEnabled(FALSE); - mShowStaticObstaclesCheckBox->setEnabled(FALSE); - mShowMaterialVolumesCheckBox->setEnabled(FALSE); - mShowExclusionVolumesCheckBox->setEnabled(FALSE); - mShowRenderWaterPlaneCheckBox->setEnabled(FALSE); - mShowXRayCheckBox->setEnabled(FALSE); - mTestTab->setEnabled(FALSE); - mCtrlClickLabel->setEnabled(FALSE); - mShiftClickLabel->setEnabled(FALSE); - mCharacterWidthLabel->setEnabled(FALSE); - mCharacterWidthUnitLabel->setEnabled(FALSE); - mCharacterWidthSlider->setEnabled(FALSE); - mCharacterTypeLabel->setEnabled(FALSE); - mCharacterTypeComboBox->setEnabled(FALSE); - mClearPathButton->setEnabled(FALSE); + mViewTab->setEnabled(false); + mShowLabel->setEnabled(false); + mShowWorldCheckBox->setEnabled(false); + mShowWorldMovablesOnlyCheckBox->setEnabled(false); + mShowNavMeshCheckBox->setEnabled(false); + mShowNavMeshWalkabilityLabel->setEnabled(false); + mShowNavMeshWalkabilityComboBox->setEnabled(false); + mShowWalkablesCheckBox->setEnabled(false); + mShowStaticObstaclesCheckBox->setEnabled(false); + mShowMaterialVolumesCheckBox->setEnabled(false); + mShowExclusionVolumesCheckBox->setEnabled(false); + mShowRenderWaterPlaneCheckBox->setEnabled(false); + mShowXRayCheckBox->setEnabled(false); + mTestTab->setEnabled(false); + mCtrlClickLabel->setEnabled(false); + mShiftClickLabel->setEnabled(false); + mCharacterWidthLabel->setEnabled(false); + mCharacterWidthUnitLabel->setEnabled(false); + mCharacterWidthSlider->setEnabled(false); + mCharacterTypeLabel->setEnabled(false); + mCharacterTypeComboBox->setEnabled(false); + mClearPathButton->setEnabled(false); clearPath(); break; case kConsoleStateLibraryNotImplemented : mViewTestTabContainer->selectTab(XUI_VIEW_TAB_INDEX); - mViewTab->setEnabled(FALSE); - mShowLabel->setEnabled(FALSE); - mShowWorldCheckBox->setEnabled(FALSE); - mShowWorldMovablesOnlyCheckBox->setEnabled(FALSE); - mShowNavMeshCheckBox->setEnabled(FALSE); - mShowNavMeshWalkabilityLabel->setEnabled(FALSE); - mShowNavMeshWalkabilityComboBox->setEnabled(FALSE); - mShowWalkablesCheckBox->setEnabled(FALSE); - mShowStaticObstaclesCheckBox->setEnabled(FALSE); - mShowMaterialVolumesCheckBox->setEnabled(FALSE); - mShowExclusionVolumesCheckBox->setEnabled(FALSE); - mShowRenderWaterPlaneCheckBox->setEnabled(FALSE); - mShowXRayCheckBox->setEnabled(FALSE); - mTestTab->setEnabled(FALSE); - mCtrlClickLabel->setEnabled(FALSE); - mShiftClickLabel->setEnabled(FALSE); - mCharacterWidthLabel->setEnabled(FALSE); - mCharacterWidthUnitLabel->setEnabled(FALSE); - mCharacterWidthSlider->setEnabled(FALSE); - mCharacterTypeLabel->setEnabled(FALSE); - mCharacterTypeComboBox->setEnabled(FALSE); - mClearPathButton->setEnabled(FALSE); + mViewTab->setEnabled(false); + mShowLabel->setEnabled(false); + mShowWorldCheckBox->setEnabled(false); + mShowWorldMovablesOnlyCheckBox->setEnabled(false); + mShowNavMeshCheckBox->setEnabled(false); + mShowNavMeshWalkabilityLabel->setEnabled(false); + mShowNavMeshWalkabilityComboBox->setEnabled(false); + mShowWalkablesCheckBox->setEnabled(false); + mShowStaticObstaclesCheckBox->setEnabled(false); + mShowMaterialVolumesCheckBox->setEnabled(false); + mShowExclusionVolumesCheckBox->setEnabled(false); + mShowRenderWaterPlaneCheckBox->setEnabled(false); + mShowXRayCheckBox->setEnabled(false); + mTestTab->setEnabled(false); + mCtrlClickLabel->setEnabled(false); + mShiftClickLabel->setEnabled(false); + mCharacterWidthLabel->setEnabled(false); + mCharacterWidthUnitLabel->setEnabled(false); + mCharacterWidthSlider->setEnabled(false); + mCharacterTypeLabel->setEnabled(false); + mCharacterTypeComboBox->setEnabled(false); + mClearPathButton->setEnabled(false); clearPath(); break; case kConsoleStateCheckingVersion : case kConsoleStateDownloading : case kConsoleStateError : mViewTestTabContainer->selectTab(XUI_VIEW_TAB_INDEX); - mViewTab->setEnabled(FALSE); - mShowLabel->setEnabled(FALSE); - mShowWorldCheckBox->setEnabled(FALSE); - mShowWorldMovablesOnlyCheckBox->setEnabled(FALSE); - mShowNavMeshCheckBox->setEnabled(FALSE); - mShowNavMeshWalkabilityLabel->setEnabled(FALSE); - mShowNavMeshWalkabilityComboBox->setEnabled(FALSE); - mShowWalkablesCheckBox->setEnabled(FALSE); - mShowStaticObstaclesCheckBox->setEnabled(FALSE); - mShowMaterialVolumesCheckBox->setEnabled(FALSE); - mShowExclusionVolumesCheckBox->setEnabled(FALSE); - mShowRenderWaterPlaneCheckBox->setEnabled(FALSE); - mShowXRayCheckBox->setEnabled(FALSE); - mTestTab->setEnabled(FALSE); - mCtrlClickLabel->setEnabled(FALSE); - mShiftClickLabel->setEnabled(FALSE); - mCharacterWidthLabel->setEnabled(FALSE); - mCharacterWidthUnitLabel->setEnabled(FALSE); - mCharacterWidthSlider->setEnabled(FALSE); - mCharacterTypeLabel->setEnabled(FALSE); - mCharacterTypeComboBox->setEnabled(FALSE); - mClearPathButton->setEnabled(FALSE); + mViewTab->setEnabled(false); + mShowLabel->setEnabled(false); + mShowWorldCheckBox->setEnabled(false); + mShowWorldMovablesOnlyCheckBox->setEnabled(false); + mShowNavMeshCheckBox->setEnabled(false); + mShowNavMeshWalkabilityLabel->setEnabled(false); + mShowNavMeshWalkabilityComboBox->setEnabled(false); + mShowWalkablesCheckBox->setEnabled(false); + mShowStaticObstaclesCheckBox->setEnabled(false); + mShowMaterialVolumesCheckBox->setEnabled(false); + mShowExclusionVolumesCheckBox->setEnabled(false); + mShowRenderWaterPlaneCheckBox->setEnabled(false); + mShowXRayCheckBox->setEnabled(false); + mTestTab->setEnabled(false); + mCtrlClickLabel->setEnabled(false); + mShiftClickLabel->setEnabled(false); + mCharacterWidthLabel->setEnabled(false); + mCharacterWidthUnitLabel->setEnabled(false); + mCharacterWidthSlider->setEnabled(false); + mCharacterTypeLabel->setEnabled(false); + mCharacterTypeComboBox->setEnabled(false); + mClearPathButton->setEnabled(false); clearPath(); break; case kConsoleStateHasNavMesh : - mViewTab->setEnabled(TRUE); - mShowLabel->setEnabled(TRUE); - mShowWorldCheckBox->setEnabled(TRUE); + mViewTab->setEnabled(true); + mShowLabel->setEnabled(true); + mShowWorldCheckBox->setEnabled(true); setWorldRenderState(); - mShowNavMeshCheckBox->setEnabled(TRUE); + mShowNavMeshCheckBox->setEnabled(true); setNavMeshRenderState(); - mShowWalkablesCheckBox->setEnabled(TRUE); - mShowStaticObstaclesCheckBox->setEnabled(TRUE); - mShowMaterialVolumesCheckBox->setEnabled(TRUE); - mShowExclusionVolumesCheckBox->setEnabled(TRUE); - mShowRenderWaterPlaneCheckBox->setEnabled(TRUE); - mShowXRayCheckBox->setEnabled(TRUE); - mTestTab->setEnabled(TRUE); - mCtrlClickLabel->setEnabled(TRUE); - mShiftClickLabel->setEnabled(TRUE); - mCharacterWidthLabel->setEnabled(TRUE); - mCharacterWidthUnitLabel->setEnabled(TRUE); - mCharacterWidthSlider->setEnabled(TRUE); - mCharacterTypeLabel->setEnabled(TRUE); - mCharacterTypeComboBox->setEnabled(TRUE); - mClearPathButton->setEnabled(TRUE); + mShowWalkablesCheckBox->setEnabled(true); + mShowStaticObstaclesCheckBox->setEnabled(true); + mShowMaterialVolumesCheckBox->setEnabled(true); + mShowExclusionVolumesCheckBox->setEnabled(true); + mShowRenderWaterPlaneCheckBox->setEnabled(true); + mShowXRayCheckBox->setEnabled(true); + mTestTab->setEnabled(true); + mCtrlClickLabel->setEnabled(true); + mShiftClickLabel->setEnabled(true); + mCharacterWidthLabel->setEnabled(true); + mCharacterWidthUnitLabel->setEnabled(true); + mCharacterWidthSlider->setEnabled(true); + mCharacterTypeLabel->setEnabled(true); + mCharacterTypeComboBox->setEnabled(true); + mClearPathButton->setEnabled(true); break; default : llassert(0); @@ -1065,7 +1060,7 @@ void LLFloaterPathfindingConsole::updatePathTestStatus() } -BOOL LLFloaterPathfindingConsole::isRenderAnyShapes() const +bool LLFloaterPathfindingConsole::isRenderAnyShapes() const { return (isRenderWalkables() || isRenderStaticObstacles() || isRenderMaterialVolumes() || isRenderExclusionVolumes()); diff --git a/indra/newview/llfloaterpathfindingconsole.h b/indra/newview/llfloaterpathfindingconsole.h index 42aee1ec46..bcbc94e10e 100644 --- a/indra/newview/llfloaterpathfindingconsole.h +++ b/indra/newview/llfloaterpathfindingconsole.h @@ -55,40 +55,40 @@ class LLFloaterPathfindingConsole friend class LLFloaterReg; public: - virtual BOOL postBuild(); + virtual bool postBuild(); virtual void onOpen(const LLSD& pKey); virtual void onClose(bool pIsAppQuitting); static LLHandle<LLFloaterPathfindingConsole> getInstanceHandle(); - BOOL isRenderNavMesh() const; - void setRenderNavMesh(BOOL pIsRenderNavMesh); + bool isRenderNavMesh() const; + void setRenderNavMesh(bool pIsRenderNavMesh); - BOOL isRenderWalkables() const; - void setRenderWalkables(BOOL pIsRenderWalkables); + bool isRenderWalkables() const; + void setRenderWalkables(bool pIsRenderWalkables); - BOOL isRenderStaticObstacles() const; - void setRenderStaticObstacles(BOOL pIsRenderStaticObstacles); + bool isRenderStaticObstacles() const; + void setRenderStaticObstacles(bool pIsRenderStaticObstacles); - BOOL isRenderMaterialVolumes() const; - void setRenderMaterialVolumes(BOOL pIsRenderMaterialVolumes); + bool isRenderMaterialVolumes() const; + void setRenderMaterialVolumes(bool pIsRenderMaterialVolumes); - BOOL isRenderExclusionVolumes() const; - void setRenderExclusionVolumes(BOOL pIsRenderExclusionVolumes); + bool isRenderExclusionVolumes() const; + void setRenderExclusionVolumes(bool pIsRenderExclusionVolumes); - BOOL isRenderWorld() const; - void setRenderWorld(BOOL pIsRenderWorld); + bool isRenderWorld() const; + void setRenderWorld(bool pIsRenderWorld); - BOOL isRenderWorldMovablesOnly() const; - void setRenderWorldMovablesOnly(BOOL pIsRenderWorldMovablesOnly); + bool isRenderWorldMovablesOnly() const; + void setRenderWorldMovablesOnly(bool pIsRenderWorldMovablesOnly); - BOOL isRenderWaterPlane() const; - void setRenderWaterPlane(BOOL pIsRenderWaterPlane); + bool isRenderWaterPlane() const; + void setRenderWaterPlane(bool pIsRenderWaterPlane); - BOOL isRenderXRay() const; - void setRenderXRay(BOOL pIsRenderXRay); + bool isRenderXRay() const; + void setRenderXRay(bool pIsRenderXRay); - BOOL isRenderAnyShapes() const; + bool isRenderAnyShapes() const; U32 getRenderShapeFlags(); LLPathingLib::LLPLCharacterType getRenderHeatmapType() const; diff --git a/indra/newview/llfloaterpathfindinglinksets.cpp b/indra/newview/llfloaterpathfindinglinksets.cpp index 66e756720c..7ed64383f0 100644 --- a/indra/newview/llfloaterpathfindinglinksets.cpp +++ b/indra/newview/llfloaterpathfindinglinksets.cpp @@ -111,7 +111,7 @@ LLFloaterPathfindingLinksets::~LLFloaterPathfindingLinksets() { } -BOOL LLFloaterPathfindingLinksets::postBuild() +bool LLFloaterPathfindingLinksets::postBuild() { mBeaconColor = LLUIColorTable::getInstance()->getColor("PathfindingLinksetBeaconColor"); @@ -577,12 +577,12 @@ void LLFloaterPathfindingLinksets::updateStateOnEditFields() void LLFloaterPathfindingLinksets::updateStateOnEditLinksetUse() { - BOOL useWalkable = FALSE; - BOOL useStaticObstacle = FALSE; - BOOL useDynamicObstacle = FALSE; - BOOL useMaterialVolume = FALSE; - BOOL useExclusionVolume = FALSE; - BOOL useDynamicPhantom = FALSE; + bool useWalkable = false; + bool useStaticObstacle = false; + bool useDynamicObstacle = false; + bool useMaterialVolume = false; + bool useExclusionVolume = false; + bool useDynamicPhantom = false; LLPathfindingObjectListPtr selectedObjects = getSelectedObjects(); if ((selectedObjects != NULL) && !selectedObjects->isEmpty()) diff --git a/indra/newview/llfloaterpathfindinglinksets.h b/indra/newview/llfloaterpathfindinglinksets.h index e14f5c5663..ecf705d2d4 100644 --- a/indra/newview/llfloaterpathfindinglinksets.h +++ b/indra/newview/llfloaterpathfindinglinksets.h @@ -55,7 +55,7 @@ protected: LLFloaterPathfindingLinksets(const LLSD& pSeed); virtual ~LLFloaterPathfindingLinksets(); - virtual BOOL postBuild(); + virtual bool postBuild(); virtual void requestGetObjects(); diff --git a/indra/newview/llfloaterpathfindingobjects.cpp b/indra/newview/llfloaterpathfindingobjects.cpp index b264df085a..402da273c8 100644 --- a/indra/newview/llfloaterpathfindingobjects.cpp +++ b/indra/newview/llfloaterpathfindingobjects.cpp @@ -75,7 +75,7 @@ void LLFloaterPathfindingObjects::onOpen(const LLSD &pKey) LLFloater::onOpen(pKey); selectNoneObjects(); - mObjectsScrollList->setCommitOnSelectionChange(TRUE); + mObjectsScrollList->setCommitOnSelectionChange(true); if (!mSelectionUpdateSlot.connected()) { @@ -112,7 +112,7 @@ void LLFloaterPathfindingObjects::onClose(bool pIsAppQuitting) mSelectionUpdateSlot.disconnect(); } - mObjectsScrollList->setCommitOnSelectionChange(FALSE); + mObjectsScrollList->setCommitOnSelectionChange(false); selectNoneObjects(); if (mObjectsSelection.notNull()) @@ -135,7 +135,7 @@ void LLFloaterPathfindingObjects::draw() std::vector<LLScrollListItem *> selectedItems = mObjectsScrollList->getAllSelected(); if (!selectedItems.empty()) { - int numSelectedItems = selectedItems.size(); + auto numSelectedItems = selectedItems.size(); S32 nameColumnIndex = getNameColumnIndex(); const LLColor4 &beaconColor = getBeaconColor(); const LLColor4 &beaconTextColor = getBeaconTextColor(); @@ -194,7 +194,7 @@ LLFloaterPathfindingObjects::~LLFloaterPathfindingObjects() clearAllObjects(); } -BOOL LLFloaterPathfindingObjects::postBuild() +bool LLFloaterPathfindingObjects::postBuild() { mDefaultBeaconColor = LLUIColorTable::getInstance()->getColor("PathfindingDefaultBeaconColor"); mDefaultBeaconTextColor = LLUIColorTable::getInstance()->getColor("PathfindingDefaultBeaconTextColor"); @@ -204,7 +204,7 @@ BOOL LLFloaterPathfindingObjects::postBuild() mObjectsScrollList = findChild<LLScrollListCtrl>("objects_scroll_list"); llassert(mObjectsScrollList != NULL); mObjectsScrollList->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onScrollListSelectionChanged, this)); - mObjectsScrollList->sortByColumnIndex(static_cast<U32>(getNameColumnIndex()), TRUE); + mObjectsScrollList->sortByColumnIndex(static_cast<U32>(getNameColumnIndex()), true); mMessagingStatus = findChild<LLTextBase>("messaging_status"); llassert(mMessagingStatus != NULL); @@ -334,7 +334,7 @@ void LLFloaterPathfindingObjects::rebuildObjectsScrollList(bool update_if_needed if (!mHasObjectsToBeSelected) { std::vector<LLScrollListItem*> selectedItems = mObjectsScrollList->getAllSelected(); - int numSelectedItems = selectedItems.size(); + auto numSelectedItems = selectedItems.size(); if (numSelectedItems > 0) { mObjectsToBeSelected.reserve(selectedItems.size()); @@ -494,14 +494,14 @@ void LLFloaterPathfindingObjects::showFloaterWithSelectionObjects() rebuildObjectsScrollList(true); if (isMinimized()) { - setMinimized(FALSE); + setMinimized(false); } setVisibleAndFrontmost(); } - setFocus(TRUE); + setFocus(true); } -BOOL LLFloaterPathfindingObjects::isShowBeacons() const +bool LLFloaterPathfindingObjects::isShowBeacons() const { return mShowBeaconCheckBox->get(); } @@ -788,22 +788,22 @@ void LLFloaterPathfindingObjects::updateStateOnListControls() case kMessagingUnknown: case kMessagingGetRequestSent : case kMessagingSetRequestSent : - mRefreshListButton->setEnabled(FALSE); - mSelectAllButton->setEnabled(FALSE); - mSelectNoneButton->setEnabled(FALSE); + mRefreshListButton->setEnabled(false); + mSelectAllButton->setEnabled(false); + mSelectNoneButton->setEnabled(false); break; case kMessagingGetError : case kMessagingSetError : case kMessagingNotEnabled : - mRefreshListButton->setEnabled(TRUE); - mSelectAllButton->setEnabled(FALSE); - mSelectNoneButton->setEnabled(FALSE); + mRefreshListButton->setEnabled(true); + mSelectAllButton->setEnabled(false); + mSelectNoneButton->setEnabled(false); break; case kMessagingComplete : { int numItems = mObjectsScrollList->getItemCount(); int numSelectedItems = mObjectsScrollList->getNumSelected(); - mRefreshListButton->setEnabled(TRUE); + mRefreshListButton->setEnabled(true); mSelectAllButton->setEnabled(numSelectedItems < numItems); mSelectNoneButton->setEnabled(numSelectedItems > 0); } @@ -835,7 +835,7 @@ void LLFloaterPathfindingObjects::selectScrollListItemsInWorld() std::vector<LLScrollListItem *> selectedItems = mObjectsScrollList->getAllSelected(); if (!selectedItems.empty()) { - int numSelectedItems = selectedItems.size(); + auto numSelectedItems = selectedItems.size(); std::vector<LLViewerObject *>viewerObjects; viewerObjects.reserve(numSelectedItems); diff --git a/indra/newview/llfloaterpathfindingobjects.h b/indra/newview/llfloaterpathfindingobjects.h index 3174a47f65..44fb0fa92d 100644 --- a/indra/newview/llfloaterpathfindingobjects.h +++ b/indra/newview/llfloaterpathfindingobjects.h @@ -73,7 +73,7 @@ protected: LLFloaterPathfindingObjects(const LLSD &pSeed); virtual ~LLFloaterPathfindingObjects(); - virtual BOOL postBuild(); + virtual bool postBuild(); virtual void requestGetObjects(); LLPathfindingManager::request_id_t getNewRequestId(); @@ -96,7 +96,7 @@ protected: void showFloaterWithSelectionObjects(); - BOOL isShowBeacons() const; + bool isShowBeacons() const; void clearAllObjects(); void selectAllObjects(); void selectNoneObjects(); diff --git a/indra/newview/llfloaterpay.cpp b/indra/newview/llfloaterpay.cpp index d607f2361a..e4e7c4ee39 100644 --- a/indra/newview/llfloaterpay.cpp +++ b/indra/newview/llfloaterpay.cpp @@ -83,7 +83,7 @@ class LLFloaterPay : public LLFloater public: LLFloaterPay(const LLSD& key); virtual ~LLFloaterPay(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void onClose(bool app_quitting); void setCallback(money_callback callback) { mCallback = callback; } @@ -104,15 +104,15 @@ private: static void onGive(give_money_ptr info); void give(S32 amount); static void processPayPriceReply(LLMessageSystem* msg, void **userdata); - void finishPayUI(const LLUUID& target_id, BOOL is_group); + void finishPayUI(const LLUUID& target_id, bool is_group); protected: std::vector<give_money_ptr> mCallbackData; money_callback mCallback; LLTextBox* mObjectNameText; LLUUID mTargetUUID; - BOOL mTargetIsGroup; - BOOL mHaveName; + bool mTargetIsGroup; + bool mHaveName; LLButton* mQuickPayButton[MAX_PAY_BUTTONS]; give_money_ptr mQuickPayInfo[MAX_PAY_BUTTONS]; @@ -130,8 +130,8 @@ LLFloaterPay::LLFloaterPay(const LLSD& key) mCallback(NULL), mObjectNameText(NULL), mTargetUUID(key.asUUID()), - mTargetIsGroup(FALSE), - mHaveName(FALSE) + mTargetIsGroup(false), + mHaveName(false) { } @@ -150,7 +150,7 @@ LLFloaterPay::~LLFloaterPay() gMessageSystem->setHandlerFuncFast(_PREHASH_PayPriceReply, 0, 0); } -BOOL LLFloaterPay::postBuild() +bool LLFloaterPay::postBuild() { S32 i = 0; @@ -158,7 +158,7 @@ BOOL LLFloaterPay::postBuild() mCallbackData.push_back(info); childSetAction("fastpay 1", boost::bind(LLFloaterPay::onGive, info)); - getChildView("fastpay 1")->setVisible(FALSE); + getChildView("fastpay 1")->setVisible(false); mQuickPayButton[i] = getChild<LLButton>("fastpay 1"); mQuickPayInfo[i] = info; @@ -168,7 +168,7 @@ BOOL LLFloaterPay::postBuild() mCallbackData.push_back(info); childSetAction("fastpay 5", boost::bind(LLFloaterPay::onGive, info)); - getChildView("fastpay 5")->setVisible(FALSE); + getChildView("fastpay 5")->setVisible(false); mQuickPayButton[i] = getChild<LLButton>("fastpay 5"); mQuickPayInfo[i] = info; @@ -178,7 +178,7 @@ BOOL LLFloaterPay::postBuild() mCallbackData.push_back(info); childSetAction("fastpay 10", boost::bind(LLFloaterPay::onGive, info)); - getChildView("fastpay 10")->setVisible(FALSE); + getChildView("fastpay 10")->setVisible(false); mQuickPayButton[i] = getChild<LLButton>("fastpay 10"); mQuickPayInfo[i] = info; @@ -188,15 +188,15 @@ BOOL LLFloaterPay::postBuild() mCallbackData.push_back(info); childSetAction("fastpay 20", boost::bind(LLFloaterPay::onGive, info)); - getChildView("fastpay 20")->setVisible(FALSE); + getChildView("fastpay 20")->setVisible(false); mQuickPayButton[i] = getChild<LLButton>("fastpay 20"); mQuickPayInfo[i] = info; ++i; - getChildView("amount text")->setVisible(FALSE); - getChildView("amount")->setVisible(FALSE); + getChildView("amount text")->setVisible(false); + getChildView("amount")->setVisible(false); getChild<LLLineEditor>("amount")->setKeystrokeCallback(&LLFloaterPay::onKeystroke, this); getChild<LLLineEditor>("amount")->setPrevalidate(LLTextValidate::validateNonNegativeS32); @@ -206,12 +206,12 @@ BOOL LLFloaterPay::postBuild() childSetAction("pay btn", boost::bind(LLFloaterPay::onGive, info)); setDefaultBtn("pay btn"); - getChildView("pay btn")->setVisible(FALSE); - getChildView("pay btn")->setEnabled(FALSE); + getChildView("pay btn")->setVisible(false); + getChildView("pay btn")->setEnabled(false); childSetAction("cancel btn",&LLFloaterPay::onCancel,this); - return TRUE; + return true; } // virtual @@ -241,25 +241,25 @@ void LLFloaterPay::processPayPriceReply(LLMessageSystem* msg, void **userdata) if (PAY_PRICE_HIDE == price) { - self->getChildView("amount")->setVisible(FALSE); - self->getChildView("pay btn")->setVisible(FALSE); - self->getChildView("amount text")->setVisible(FALSE); + self->getChildView("amount")->setVisible(false); + self->getChildView("pay btn")->setVisible(false); + self->getChildView("amount text")->setVisible(false); } else if (PAY_PRICE_DEFAULT == price) { - self->getChildView("amount")->setVisible(TRUE); - self->getChildView("pay btn")->setVisible(TRUE); - self->getChildView("amount text")->setVisible(TRUE); + self->getChildView("amount")->setVisible(true); + self->getChildView("pay btn")->setVisible(true); + self->getChildView("amount text")->setVisible(true); } else { // PAY_PRICE_HIDE and PAY_PRICE_DEFAULT are negative values // So we take the absolute value here after we have checked for those cases - self->getChildView("amount")->setVisible(TRUE); - self->getChildView("pay btn")->setVisible(TRUE); - self->getChildView("pay btn")->setEnabled(TRUE); - self->getChildView("amount text")->setVisible(TRUE); + self->getChildView("amount")->setVisible(true); + self->getChildView("pay btn")->setVisible(true); + self->getChildView("pay btn")->setEnabled(true); + self->getChildView("amount text")->setVisible(true); self->getChild<LLUICtrl>("amount")->setValue(llformat("%d", llabs(price))); } @@ -282,7 +282,7 @@ void LLFloaterPay::processPayPriceReply(LLMessageSystem* msg, void **userdata) self->mQuickPayButton[i]->setLabelSelected(button_str); self->mQuickPayButton[i]->setLabelUnselected(button_str); - self->mQuickPayButton[i]->setVisible(TRUE); + self->mQuickPayButton[i]->setVisible(true); self->mQuickPayInfo[i]->mAmount = pay_button; if ( pay_button > max_pay_amount ) @@ -292,7 +292,7 @@ void LLFloaterPay::processPayPriceReply(LLMessageSystem* msg, void **userdata) } else { - self->mQuickPayButton[i]->setVisible(FALSE); + self->mQuickPayButton[i]->setVisible(false); } } @@ -345,10 +345,10 @@ void LLFloaterPay::processPayPriceReply(LLMessageSystem* msg, void **userdata) for (i=num_blocks;i<MAX_PAY_BUTTONS;++i) { - self->mQuickPayButton[i]->setVisible(FALSE); + self->mQuickPayButton[i]->setVisible(false); } - self->reshape( self->getRect().getWidth() + padding_required, self->getRect().getHeight(), FALSE ); + self->reshape( self->getRect().getWidth() + padding_required, self->getRect().getHeight(), false ); } msg->setHandlerFunc("PayPriceReply",NULL,NULL); } @@ -388,7 +388,7 @@ void LLFloaterPay::payViaObject(money_callback callback, LLSafeHandle<LLObjectSe msg->setHandlerFuncFast(_PREHASH_PayPriceReply, processPayPriceReply,(void **)floater); LLUUID owner_id; - BOOL is_group = FALSE; + bool is_group = false; node->mPermissions->getOwnership(owner_id, is_group); floater->getChild<LLUICtrl>("object_name_text")->setValue(node->mName); @@ -407,13 +407,13 @@ void LLFloaterPay::payDirectly(money_callback callback, floater->setCallback(callback); floater->mObjectSelection = NULL; - floater->getChildView("amount")->setVisible(TRUE); - floater->getChildView("pay btn")->setVisible(TRUE); - floater->getChildView("amount text")->setVisible(TRUE); + floater->getChildView("amount")->setVisible(true); + floater->getChildView("pay btn")->setVisible(true); + floater->getChildView("amount text")->setVisible(true); for(S32 i=0;i<MAX_PAY_BUTTONS;++i) { - floater->mQuickPayButton[i]->setVisible(TRUE); + floater->mQuickPayButton[i]->setVisible(true); } floater->finishPayUI(target_id, is_group); @@ -436,7 +436,7 @@ bool LLFloaterPay::payConfirmationCallback(const LLSD& notification, const LLSD& return false; } -void LLFloaterPay::finishPayUI(const LLUUID& target_id, BOOL is_group) +void LLFloaterPay::finishPayUI(const LLUUID& target_id, bool is_group) { std::string slurl; if (is_group) @@ -454,7 +454,7 @@ void LLFloaterPay::finishPayUI(const LLUUID& target_id, BOOL is_group) // Make sure the amount field has focus LLLineEditor* amount = getChild<LLLineEditor>("amount"); - amount->setFocus(TRUE); + amount->setFocus(true); amount->selectAll(); mTargetIsGroup = is_group; @@ -505,7 +505,7 @@ void LLFloaterPay::onGive(give_money_ptr info) if (amount > PAY_AMOUNT_NOTIFICATION && gStatusBar && gStatusBar->getBalance() > amount) { LLUUID payee_id = LLUUID::null; - BOOL is_group = false; + bool is_group = false; if (floater->mObjectSelection.notNull()) { LLSelectNode* node = floater->mObjectSelection->getFirstRootNode(); @@ -569,7 +569,7 @@ void LLFloaterPay::give(S32 amount) } S32 tx_type = TRANS_PAY_OBJECT; if(dest_object->isAvatar()) tx_type = TRANS_GIFT; - mCallback(mTargetUUID, region, amount, FALSE, tx_type, object_name); + mCallback(mTargetUUID, region, amount, false, tx_type, object_name); mObjectSelection = NULL; // request the object owner in order to check if the owner needs to be unmuted diff --git a/indra/newview/llfloaterpay.h b/indra/newview/llfloaterpay.h index fe48d00867..190bf9f013 100644 --- a/indra/newview/llfloaterpay.h +++ b/indra/newview/llfloaterpay.h @@ -32,7 +32,7 @@ class LLObjectSelection; class LLUUID; class LLViewerRegion; -typedef void (*money_callback)(const LLUUID&, LLViewerRegion*,S32,BOOL,S32,const std::string&); +typedef void (*money_callback)(const LLUUID&, LLViewerRegion*,S32,bool,S32,const std::string&); namespace LLFloaterPayUtil { diff --git a/indra/newview/llfloaterperformance.cpp b/indra/newview/llfloaterperformance.cpp index ba655ab760..01579ac165 100644 --- a/indra/newview/llfloaterperformance.cpp +++ b/indra/newview/llfloaterperformance.cpp @@ -91,7 +91,7 @@ LLFloaterPerformance::~LLFloaterPerformance() delete mUpdateTimer; } -BOOL LLFloaterPerformance::postBuild() +bool LLFloaterPerformance::postBuild() { mMainPanel = getChild<LLPanel>("panel_performance_main"); mNearbyPanel = getChild<LLPanel>("panel_performance_nearby"); @@ -152,16 +152,16 @@ BOOL LLFloaterPerformance::postBuild() mStartAutotuneBtn->setCommitCallback(boost::bind(&LLFloaterPerformance::startAutotune, this)); mStopAutotuneBtn->setCommitCallback(boost::bind(&LLFloaterPerformance::stopAutotune, this)); - gSavedPerAccountSettings.declareBOOL("HadEnabledAutoFPS", FALSE, "User had enabled AutoFPS at least once", LLControlVariable::PERSIST_ALWAYS); + gSavedPerAccountSettings.declareBOOL("HadEnabledAutoFPS", false, "User had enabled AutoFPS at least once", LLControlVariable::PERSIST_ALWAYS); - return TRUE; + return true; } void LLFloaterPerformance::showSelectedPanel(LLPanel* selected_panel) { hidePanels(); - mMainPanel->setVisible(FALSE); - selected_panel->setVisible(TRUE); + mMainPanel->setVisible(false); + selected_panel->setVisible(true); if (mHUDsPanel == selected_panel) { @@ -214,16 +214,16 @@ void LLFloaterPerformance::draw() void LLFloaterPerformance::showMainPanel() { hidePanels(); - mMainPanel->setVisible(TRUE); + mMainPanel->setVisible(true); } void LLFloaterPerformance::hidePanels() { - mNearbyPanel->setVisible(FALSE); - mComplexityPanel->setVisible(FALSE); - mHUDsPanel->setVisible(FALSE); - mSettingsPanel->setVisible(FALSE); - mAutoadjustmentsPanel->setVisible(FALSE); + mNearbyPanel->setVisible(false); + mComplexityPanel->setVisible(false); + mHUDsPanel->setVisible(false); + mSettingsPanel->setVisible(false); + mAutoadjustmentsPanel->setVisible(false); } void LLFloaterPerformance::initBackBtn(LLPanel* panel) @@ -321,7 +321,7 @@ void LLFloaterPerformance::populateHUDList() } } } - mHUDList->sortByColumnIndex(1, FALSE); + mHUDList->sortByColumnIndex(1, false); mHUDList->setScrollPos(prev_pos); mHUDList->selectItemBySpecialId(prev_selected_id); } @@ -413,7 +413,7 @@ void LLFloaterPerformance::populateObjectList() } } } - mObjectList->sortByColumnIndex(1, FALSE); + mObjectList->sortByColumnIndex(1, false); mObjectList->setScrollPos(prev_pos); mObjectList->selectItemBySpecialId(prev_selected_id); } @@ -503,7 +503,7 @@ void LLFloaterPerformance::populateNearbyList() } char_iter++; } - mNearbyList->sortByColumnIndex(1, FALSE); + mNearbyList->sortByColumnIndex(1, false); mNearbyList->setScrollPos(prev_pos); mNearbyList->selectByID(prev_selected_id); } @@ -736,7 +736,7 @@ void LLFloaterPerformance::enableAutotuneWarning() { if (!gSavedPerAccountSettings.getBOOL("HadEnabledAutoFPS") && LLPerfStats::tunables.userAutoTuneEnabled) { - gSavedPerAccountSettings.setBOOL("HadEnabledAutoFPS", TRUE); + gSavedPerAccountSettings.setBOOL("HadEnabledAutoFPS", true); LLNotificationsUtil::add("EnableAutoFPSWarning", LLSD(), LLSD(), [](const LLSD& notif, const LLSD& resp) diff --git a/indra/newview/llfloaterperformance.h b/indra/newview/llfloaterperformance.h index 03fa9e8184..797b800b62 100644 --- a/indra/newview/llfloaterperformance.h +++ b/indra/newview/llfloaterperformance.h @@ -38,7 +38,7 @@ public: LLFloaterPerformance(const LLSD& key); virtual ~LLFloaterPerformance(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void draw(); void showSelectedPanel(LLPanel* selected_panel); diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index 15ca87c326..7311f0deb6 100644 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -46,9 +46,9 @@ LLFloaterPerms::LLFloaterPerms(const LLSD& seed) { } -BOOL LLFloaterPerms::postBuild() +bool LLFloaterPerms::postBuild() { - return TRUE; + return true; } //static @@ -126,7 +126,7 @@ const std::string LLFloaterPermsDefault::sCategoryNames[CAT_LAST] = "Materials" }; -BOOL LLFloaterPermsDefault::postBuild() +bool LLFloaterPermsDefault::postBuild() { if(!gSavedSettings.getBOOL("DefaultUploadPermissionsConverted")) { @@ -162,17 +162,17 @@ void LLFloaterPermsDefault::onCommitCopy(const LLSD& user_data) // Implements fair use std::string prefix = user_data.asString(); - BOOL copyable = gSavedSettings.getBOOL(prefix+"NextOwnerCopy"); + bool copyable = gSavedSettings.getBOOL(prefix+"NextOwnerCopy"); if(!copyable) { - gSavedSettings.setBOOL(prefix+"NextOwnerTransfer", TRUE); + gSavedSettings.setBOOL(prefix+"NextOwnerTransfer", true); } LLCheckBoxCtrl* xfer = getChild<LLCheckBoxCtrl>(prefix+"_transfer"); xfer->setEnabled(copyable); } -const int MAX_HTTP_RETRIES = 5; -const float RETRY_TIMEOUT = 5.0; +constexpr int MAX_HTTP_RETRIES = 5; +constexpr float RETRY_TIMEOUT = 5.0; void LLFloaterPermsDefault::sendInitialPerms() { diff --git a/indra/newview/llfloaterperms.h b/indra/newview/llfloaterperms.h index 639d678781..ad3776a8c6 100644 --- a/indra/newview/llfloaterperms.h +++ b/indra/newview/llfloaterperms.h @@ -37,7 +37,7 @@ class LLFloaterPerms : public LLFloater friend class LLFloaterReg; public: - /*virtual*/ BOOL postBuild(); + bool postBuild() override; // Convenience methods to get current permission preference bitfields from saved settings: static U32 getEveryonePerms(std::string prefix=""); // prefix + "EveryoneCopy" @@ -55,7 +55,7 @@ class LLFloaterPermsDefault : public LLFloater friend class LLFloaterReg; public: - /*virtual*/ BOOL postBuild(); + bool postBuild() override; void ok(); void cancel(); void onClickOK(); @@ -81,7 +81,7 @@ enum Categories private: LLFloaterPermsDefault(const LLSD& seed); - void refresh(); + void refresh() override; static const std::string sCategoryNames[CAT_LAST]; static void updateCapCoro(std::string url); diff --git a/indra/newview/llfloaterpostprocess.cpp b/indra/newview/llfloaterpostprocess.cpp index af4f6b53bb..616c13cdc7 100644 --- a/indra/newview/llfloaterpostprocess.cpp +++ b/indra/newview/llfloaterpostprocess.cpp @@ -49,7 +49,7 @@ LLFloaterPostProcess::~LLFloaterPostProcess() } -BOOL LLFloaterPostProcess::postBuild() +bool LLFloaterPostProcess::postBuild() { /// Color Filter Callbacks childSetCommitCallback("ColorFilterToggle", &LLFloaterPostProcess::onBoolToggle, (char*)"enable_color_filter"); @@ -84,7 +84,7 @@ BOOL LLFloaterPostProcess::postBuild() getChild<LLComboBox>("PPSaveEffect")->setCommitCallback(boost::bind(&LLFloaterPostProcess::onSaveEffect, this, editBox)); syncMenu(); - return TRUE; + return true; } // Bool Toggle diff --git a/indra/newview/llfloaterpostprocess.h b/indra/newview/llfloaterpostprocess.h index 9e38e34170..50b48d8410 100644 --- a/indra/newview/llfloaterpostprocess.h +++ b/indra/newview/llfloaterpostprocess.h @@ -49,7 +49,7 @@ public: LLFloaterPostProcess(const LLSD& key); virtual ~LLFloaterPostProcess(); - /*virtual*/ BOOL postBuild(); + bool postBuild(); /// post process callbacks static void onBoolToggle(LLUICtrl* ctrl, void* userData); @@ -67,11 +67,6 @@ public: /// sync up sliders void syncMenu(); - -/* - void refresh(); -*/ -public: }; #endif diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 23ddd087eb..1b62f94a13 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -181,7 +181,7 @@ bool callback_clear_cache(const LLSD& notification, const LLSD& response) if ( option == 0 ) // YES { // flag client texture cache for clearing next time the client runs - gSavedSettings.setBOOL("PurgeCacheOnNextStartup", TRUE); + gSavedSettings.setBOOL("PurgeCacheOnNextStartup", true); LLNotificationsUtil::add("CacheWillClear"); } @@ -201,7 +201,7 @@ bool callback_clear_browser_cache(const LLSD& notification, const LLSD& response LLNavigationBar::getInstance()->clearHistoryCache(); // flag client texture cache for clearing next time the client runs - gSavedSettings.setBOOL("PurgeCacheOnNextStartup", TRUE); + gSavedSettings.setBOOL("PurgeCacheOnNextStartup", true); LLNotificationsUtil::add("CacheWillClear"); LLSearchHistory::getInstance()->clearHistory(); @@ -430,7 +430,7 @@ void LLFloaterPreference::saveAvatarPropertiesCoro(const std::string cap_url, bo LL_DEBUGS("Preferences") << "Agent id: " << gAgentID << " Data: " << data << " Result: " << httpResults << LL_ENDL; } -BOOL LLFloaterPreference::postBuild() +bool LLFloaterPreference::postBuild() { gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLFloaterIMSessionTab::processChatHistoryStyleUpdate, false)); @@ -440,6 +440,12 @@ BOOL LLFloaterPreference::postBuild() gSavedSettings.getControl("PreferredMaturity")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeMaturity, this)); + gSavedSettings.getControl("RenderAvatarComplexityMode")->getSignal()->connect( + [this](LLControlVariable* control, const LLSD& new_val, const LLSD& old_val) + { + onChangeComplexityMode(new_val); + }); + gSavedPerAccountSettings.getControl("ModelUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeModelFolder, this)); gSavedPerAccountSettings.getControl("PBRUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangePBRFolder, this)); gSavedPerAccountSettings.getControl("TextureUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeTextureFolder, this)); @@ -450,11 +456,11 @@ BOOL LLFloaterPreference::postBuild() if (!tabcontainer->selectTab(gSavedSettings.getS32("LastPrefTab"))) tabcontainer->selectFirstTab(); - getChild<LLUICtrl>("cache_location")->setEnabled(FALSE); // make it read-only but selectable (STORM-227) + getChild<LLUICtrl>("cache_location")->setEnabled(false); // make it read-only but selectable (STORM-227) std::string cache_location = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""); setCacheLocation(cache_location); - getChild<LLUICtrl>("log_path_string")->setEnabled(FALSE); // make it read-only but selectable + getChild<LLUICtrl>("log_path_string")->setEnabled(false); // make it read-only but selectable getChild<LLComboBox>("language_combobox")->setCommitCallback(boost::bind(&LLFloaterPreference::onLanguageChange, this)); @@ -480,6 +486,9 @@ BOOL LLFloaterPreference::postBuild() fov_slider->setMinValue(LLViewerCamera::getInstance()->getMinView()); fov_slider->setMaxValue(LLViewerCamera::getInstance()->getMaxView()); + bool enable_complexity = gSavedSettings.getS32("RenderAvatarComplexityMode") != LLVOAvatar::AV_RENDER_ONLY_SHOW_FRIENDS; + getChild<LLSliderCtrl>("IndirectMaxComplexity")->setEnabled(enable_complexity); + // Hook up and init for filtering mFilterEdit = getChild<LLSearchEditor>("search_prefs_edit"); mFilterEdit->setKeystrokeCallback(boost::bind(&LLFloaterPreference::onUpdateFilterTerm, this, false)); @@ -507,7 +516,7 @@ BOOL LLFloaterPreference::postBuild() getChild<LLComboBox>("language_combobox")->add("System default", LLSD("default"), ADD_TOP, true); } - return TRUE; + return true; } void LLFloaterPreference::updateDeleteTranscriptsButton() @@ -517,7 +526,7 @@ void LLFloaterPreference::updateDeleteTranscriptsButton() void LLFloaterPreference::onDoNotDisturbResponseChanged() { - // set "DoNotDisturbResponseChanged" TRUE if user edited message differs from default, FALSE otherwise + // set "DoNotDisturbResponseChanged" true if user edited message differs from default, false otherwise bool response_changed_flag = LLTrans::getString("DoNotDisturbModeResponseDefault") != getChild<LLUICtrl>("do_not_disturb_response")->getValue().asString(); @@ -534,7 +543,7 @@ LLFloaterPreference::~LLFloaterPreference() void LLFloaterPreference::draw() { - BOOL has_first_selected = (getChildRef<LLScrollListCtrl>("disabled_popups").getFirstSelected()!=NULL); + bool has_first_selected = (getChildRef<LLScrollListCtrl>("disabled_popups").getFirstSelected()!=NULL); gSavedSettings.setBOOL("FirstSelectedDisabledPopups", has_first_selected); has_first_selected = (getChildRef<LLScrollListCtrl>("enabled_popups").getFirstSelected()!=NULL); @@ -589,7 +598,7 @@ void LLFloaterPreference::apply() LLViewerMedia::getInstance()->setCookiesEnabled(getChild<LLUICtrl>("cookies_enabled")->getValue()); - if (hasChild("web_proxy_enabled", TRUE) &&hasChild("web_proxy_editor", TRUE) && hasChild("web_proxy_port", TRUE)) + if (hasChild("web_proxy_enabled", true) &&hasChild("web_proxy_editor", true) && hasChild("web_proxy_port", true)) { bool proxy_enable = getChild<LLUICtrl>("web_proxy_enabled")->getValue(); std::string proxy_address = getChild<LLUICtrl>("web_proxy_editor")->getValue(); @@ -622,7 +631,7 @@ void LLFloaterPreference::apply() saveAvatarProperties(); } -void LLFloaterPreference::cancel() +void LLFloaterPreference::cancel(const std::vector<std::string> settings_to_skip) { LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core"); // Call cancel() on all panels that derive from LLPanelPreference @@ -632,7 +641,7 @@ void LLFloaterPreference::cancel() LLView* view = *iter; LLPanelPreference* panel = dynamic_cast<LLPanelPreference*>(view); if (panel) - panel->cancel(); + panel->cancel(settings_to_skip); } // hide joystick pref floater LLFloaterReg::hideInstance("pref_joystick"); @@ -679,7 +688,7 @@ void LLFloaterPreference::cancel() void LLFloaterPreference::onOpen(const LLSD& key) { // this variable and if that follows it are used to properly handle do not disturb mode response message - static bool initialized = FALSE; + static bool initialized = false; // if user is logged in and we haven't initialized do not disturb mode response yet, do it if (!initialized && LLStartUp::getStartupState() == STATE_STARTED) { @@ -688,8 +697,8 @@ void LLFloaterPreference::onOpen(const LLSD& key) // To keep track of whether do not disturb response is default or changed by user additional setting DoNotDisturbResponseChanged // was added into per account settings. - // initialization should happen once,so setting variable to TRUE - initialized = TRUE; + // initialization should happen once,so setting variable to true + initialized = true; // this connection is needed to properly set "DoNotDisturbResponseChanged" setting when user makes changes in // do not disturb response message. gSavedPerAccountSettings.getControl("DoNotDisturbModeResponse")->getSignal()->connect(boost::bind(&LLFloaterPreference::onDoNotDisturbResponseChanged, this)); @@ -862,7 +871,7 @@ void LLFloaterPreference::setRecommendedSettings() void LLFloaterPreference::resetAutotuneSettings() { - gSavedSettings.setBOOL("AutoTuneFPS", FALSE); + gSavedSettings.setBOOL("AutoTuneFPS", false); const std::string autotune_settings[] = { "AutoTuneLock", @@ -976,12 +985,12 @@ void LLFloaterPreference::onBtnOK(const LLSD& userdata) } LLUIColorTable::instance().saveUserSettings(); - gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE); + gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), true); //Only save once logged in and loaded per account settings if(mGotPersonalInfo) { - gSavedPerAccountSettings.saveToFile(gSavedSettings.getString("PerAccountSettingsFile"), TRUE); + gSavedPerAccountSettings.saveToFile(gSavedSettings.getString("PerAccountSettingsFile"), true); } } else @@ -1012,14 +1021,15 @@ void LLFloaterPreference::onBtnCancel(const LLSD& userdata) } refresh(); } - cancel(); if (userdata.asString() == "closeadvanced") { + cancel({"RenderQualityPerformance"}); LLFloaterReg::hideInstance("prefs_graphics_advanced"); } else { + cancel(); closeFloater(); } } @@ -1231,10 +1241,10 @@ void LLFloaterPreference::refreshEnabledState() LLCheckBoxCtrl* ctrl_pbr = getChild<LLCheckBoxCtrl>("UsePBRShaders"); //PBR - ctrl_pbr->setEnabled(TRUE); + ctrl_pbr->setEnabled(true); // Cannot have floater active until caps have been received - getChild<LLButton>("default_creation_permissions")->setEnabled(LLStartUp::getStartupState() < STATE_STARTED ? false : true); + getChild<LLButton>("default_creation_permissions")->setEnabled(LLStartUp::getStartupState() >= STATE_STARTED); getChildView("block_list")->setEnabled(LLLoginInstance::getInstance()->authSuccess()); } @@ -1327,9 +1337,9 @@ void LLFloaterPreference::onClickEnablePopup() for (itor = items.begin(); itor != items.end(); ++itor) { LLNotificationTemplatePtr templatep = LLNotifications::instance().getTemplate(*(std::string*)((*itor)->getUserdata())); - //gSavedSettings.setWarning(templatep->mName, TRUE); + //gSavedSettings.setWarning(templatep->mName, true); std::string notification_name = templatep->mName; - LLUI::getInstance()->mSettingGroups["ignores"]->setBOOL(notification_name, TRUE); + LLUI::getInstance()->mSettingGroups["ignores"]->setBOOL(notification_name, true); } buildPopupLists(); @@ -1478,28 +1488,28 @@ void LLFloaterPreference::setPersonalInfo(const std::string& visibility) if (visibility == VISIBILITY_DEFAULT) { mOriginalHideOnlineStatus = false; - getChildView("online_visibility")->setEnabled(TRUE); + getChildView("online_visibility")->setEnabled(true); } else if (visibility == VISIBILITY_HIDDEN) { mOriginalHideOnlineStatus = true; - getChildView("online_visibility")->setEnabled(TRUE); + getChildView("online_visibility")->setEnabled(true); } else { mOriginalHideOnlineStatus = true; } - getChild<LLUICtrl>("online_searchresults")->setEnabled(TRUE); - getChildView("friends_online_notify_checkbox")->setEnabled(TRUE); + getChild<LLUICtrl>("online_searchresults")->setEnabled(true); + getChildView("friends_online_notify_checkbox")->setEnabled(true); getChild<LLUICtrl>("online_visibility")->setValue(mOriginalHideOnlineStatus); getChild<LLUICtrl>("online_visibility")->setLabelArg("[DIR_VIS]", mDirectoryVisibility); - getChildView("favorites_on_login_check")->setEnabled(TRUE); - getChildView("log_path_button")->setEnabled(TRUE); - getChildView("chat_font_size")->setEnabled(TRUE); - getChildView("conversation_log_combo")->setEnabled(TRUE); - getChild<LLUICtrl>("voice_call_friends_only_check")->setEnabled(TRUE); + getChildView("favorites_on_login_check")->setEnabled(true); + getChildView("log_path_button")->setEnabled(true); + getChildView("chat_font_size")->setEnabled(true); + getChildView("conversation_log_combo")->setEnabled(true); + getChild<LLUICtrl>("voice_call_friends_only_check")->setEnabled(true); getChild<LLUICtrl>("voice_call_friends_only_check")->setValue(gSavedPerAccountSettings.getBOOL("VoiceCallsFriendsOnly")); } @@ -1669,6 +1679,12 @@ void LLFloaterPreference::onChangeMaturity() getChild<LLIconCtrl>("rating_icon_adult")->setVisible(sim_access == SIM_ACCESS_ADULT); } +void LLFloaterPreference::onChangeComplexityMode(const LLSD& newvalue) +{ + bool enable_complexity = newvalue.asInteger() != LLVOAvatar::AV_RENDER_ONLY_SHOW_FRIENDS; + getChild<LLSliderCtrl>("IndirectMaxComplexity")->setEnabled(enable_complexity); +} + std::string get_category_path(LLFolderType::EType cat_type) { LLUUID cat_id = gInventory.findUserDefinedCategoryUUIDForType(cat_type); @@ -1785,9 +1801,9 @@ void LLFloaterPreference::onAtmosShaderChange() if(ctrl_alm) { //Deferred/SSAO/Shadows - BOOL bumpshiny = LLCubeMap::sUseCubeMaps && LLFeatureManager::getInstance()->isFeatureAvailable("RenderObjectBump") && gSavedSettings.getBOOL("RenderObjectBump"); - BOOL shaders = gSavedSettings.getBOOL("WindLightUseAtmosShaders"); - BOOL enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") && + bool bumpshiny = LLCubeMap::sUseCubeMaps && LLFeatureManager::getInstance()->isFeatureAvailable("RenderObjectBump") && gSavedSettings.getBOOL("RenderObjectBump"); + bool shaders = gSavedSettings.getBOOL("WindLightUseAtmosShaders"); + bool enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") && bumpshiny && shaders; @@ -2001,12 +2017,12 @@ public: protected: - BOOL tick() + bool tick() { mCallback(mNewValue); mEventTimer.stop(); - return FALSE; + return false; } private: @@ -2028,31 +2044,31 @@ LLPanelPreference::LLPanelPreference() } //virtual -BOOL LLPanelPreference::postBuild() +bool LLPanelPreference::postBuild() { ////////////////////// PanelGeneral /////////////////// - if (hasChild("display_names_check", TRUE)) + if (hasChild("display_names_check", true)) { - BOOL use_people_api = gSavedSettings.getBOOL("UsePeopleAPI"); + bool use_people_api = gSavedSettings.getBOOL("UsePeopleAPI"); LLCheckBoxCtrl* ctrl_display_name = getChild<LLCheckBoxCtrl>("display_names_check"); ctrl_display_name->setEnabled(use_people_api); if (!use_people_api) { - ctrl_display_name->setValue(FALSE); + ctrl_display_name->setValue(false); } } ////////////////////// PanelVoice /////////////////// - if (hasChild("voice_unavailable", TRUE)) + if (hasChild("voice_unavailable", true)) { - BOOL voice_disabled = gSavedSettings.getBOOL("CmdLineDisableVoice"); + bool voice_disabled = gSavedSettings.getBOOL("CmdLineDisableVoice"); getChildView("voice_unavailable")->setVisible( voice_disabled); getChildView("enable_voice_check")->setVisible( !voice_disabled); } //////////////////////PanelSkins /////////////////// - if (hasChild("skin_selection", TRUE)) + if (hasChild("skin_selection", true)) { LLFloaterPreference::refreshSkin(this); @@ -2066,32 +2082,32 @@ BOOL LLPanelPreference::postBuild() } //////////////////////PanelPrivacy /////////////////// - if (hasChild("media_enabled", TRUE)) + if (hasChild("media_enabled", true)) { bool media_enabled = gSavedSettings.getBOOL("AudioStreamingMedia"); getChild<LLCheckBoxCtrl>("media_enabled")->set(media_enabled); getChild<LLCheckBoxCtrl>("autoplay_enabled")->setEnabled(media_enabled); } - if (hasChild("music_enabled", TRUE)) + if (hasChild("music_enabled", true)) { getChild<LLCheckBoxCtrl>("music_enabled")->set(gSavedSettings.getBOOL("AudioStreamingMusic")); } - if (hasChild("voice_call_friends_only_check", TRUE)) + if (hasChild("voice_call_friends_only_check", true)) { getChild<LLCheckBoxCtrl>("voice_call_friends_only_check")->setCommitCallback(boost::bind(&showFriendsOnlyWarning, _1, _2)); } - if (hasChild("allow_multiple_viewer_check", TRUE)) + if (hasChild("allow_multiple_viewer_check", true)) { getChild<LLCheckBoxCtrl>("allow_multiple_viewer_check")->setCommitCallback(boost::bind(&showMultipleViewersWarning, _1, _2)); } - if (hasChild("favorites_on_login_check", TRUE)) + if (hasChild("favorites_on_login_check", true)) { getChild<LLCheckBoxCtrl>("favorites_on_login_check")->setCommitCallback(boost::bind(&handleFavoritesOnLoginChanged, _1, _2)); bool show_favorites_at_login = LLPanelLogin::getShowFavorites(); getChild<LLCheckBoxCtrl>("favorites_on_login_check")->setValue(show_favorites_at_login); } - if (hasChild("mute_chb_label", TRUE)) + if (hasChild("mute_chb_label", true)) { getChild<LLTextBox>("mute_chb_label")->setShowCursorHand(false); getChild<LLTextBox>("mute_chb_label")->setSoundFlags(LLView::MOUSE_UP); @@ -2099,7 +2115,7 @@ BOOL LLPanelPreference::postBuild() } //////////////////////PanelSetup /////////////////// - if (hasChild("max_bandwidth", TRUE)) + if (hasChild("max_bandwidth", true)) { mBandWidthUpdater = new LLPanelPreference::Updater(boost::bind(&handleBandwidthChanged, _1), BANDWIDTH_UPDATER_TIMEOUT); gSavedSettings.getControl("ThrottleBandwidthKBPS")->getSignal()->connect(boost::bind(&LLPanelPreference::Updater::update, mBandWidthUpdater, _2)); @@ -2228,7 +2244,7 @@ void LLPanelPreference::toggleMuteWhenMinimized() } } -void LLPanelPreference::cancel() +void LLPanelPreference::cancel(const std::vector<std::string> settings_to_skip) { for (control_values_map_t::iterator iter = mSavedValues.begin(); iter != mSavedValues.end(); ++iter) @@ -2241,6 +2257,12 @@ void LLPanelPreference::cancel() continue; } + auto found = std::find(settings_to_skip.begin(), settings_to_skip.end(), control->getName()); + if (found != settings_to_skip.end()) + { + continue; + } + control->set(ctrl_value); } @@ -2262,7 +2284,7 @@ void LLPanelPreference::setControlFalse(const LLSD& user_data) LLControlVariable* control = findControl(control_name); if (control) - control->set(LLSD(FALSE)); + control->set(LLSD(false)); } void LLPanelPreference::updateMediaAutoPlayCheckbox(LLUICtrl* ctrl) @@ -2339,7 +2361,7 @@ private: static LLPanelInjector<LLPanelPreferenceGraphics> t_pref_graph("panel_preference_graphics"); static LLPanelInjector<LLPanelPreferencePrivacy> t_pref_privacy("panel_preference_privacy"); -BOOL LLPanelPreferenceGraphics::postBuild() +bool LLPanelPreferenceGraphics::postBuild() { LLFloaterReg::showInstance("prefs_graphics_advanced"); LLFloaterReg::hideInstance("prefs_graphics_advanced"); @@ -2483,9 +2505,9 @@ void LLPanelPreferenceGraphics::resetDirtyChilds() } } -void LLPanelPreferenceGraphics::cancel() +void LLPanelPreferenceGraphics::cancel(const std::vector<std::string> settings_to_skip) { - LLPanelPreference::cancel(); + LLPanelPreference::cancel(settings_to_skip); } void LLPanelPreferenceGraphics::saveSettings() { @@ -2526,7 +2548,7 @@ LLPanelPreferenceControls::~LLPanelPreferenceControls() { } -BOOL LLPanelPreferenceControls::postBuild() +bool LLPanelPreferenceControls::postBuild() { // populate list of controls pControlsTable = getChild<LLScrollListCtrl>("controls_list"); @@ -2536,7 +2558,7 @@ BOOL LLPanelPreferenceControls::postBuild() pKeyModeBox->setCommitCallback(boost::bind(&LLPanelPreferenceControls::onModeCommit, this)); getChild<LLButton>("restore_defaults")->setCommitCallback(boost::bind(&LLPanelPreferenceControls::onRestoreDefaultsBtn, this)); - return TRUE; + return true; } void LLPanelPreferenceControls::regenerateControls() @@ -2773,7 +2795,7 @@ void LLPanelPreferenceControls::apply() } } -void LLPanelPreferenceControls::cancel() +void LLPanelPreferenceControls::cancel(const std::vector<std::string> settings_to_skip) { for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT - 1; ++i) { @@ -2862,7 +2884,7 @@ void LLPanelPreferenceControls::onListCommit() if (root_floater) root_floater->addDependentFloater(dialog); dialog->openFloater(); - dialog->setFocus(TRUE); + dialog->setFocus(true); } } else @@ -3128,12 +3150,12 @@ LLFloaterPreferenceProxy::~LLFloaterPreferenceProxy() { } -BOOL LLFloaterPreferenceProxy::postBuild() +bool LLFloaterPreferenceProxy::postBuild() { LLRadioGroup* socksAuth = getChild<LLRadioGroup>("socks5_auth_type"); if (!socksAuth) { - return FALSE; + return false; } if (socksAuth->getSelectedValue().asString() == "None") { @@ -3148,7 +3170,7 @@ BOOL LLFloaterPreferenceProxy::postBuild() getChild<LLLineEditor>("socks5_password")->setValue(socks_cred->getAuthenticator()["creds"].asString()); } - return TRUE; + return true; } void LLFloaterPreferenceProxy::onOpen(const LLSD& key) @@ -3300,9 +3322,9 @@ void LLFloaterPreferenceProxy::onChangeSocksSettings() // Check for invalid states for the other HTTP proxy radio LLRadioGroup* otherHttpProxy = getChild<LLRadioGroup>("other_http_proxy_type"); if ((otherHttpProxy->getSelectedValue().asString() == "Socks" && - getChild<LLCheckBoxCtrl>("socks_proxy_enabled")->get() == FALSE )||( + !getChild<LLCheckBoxCtrl>("socks_proxy_enabled")->get())||( otherHttpProxy->getSelectedValue().asString() == "Web" && - getChild<LLCheckBoxCtrl>("web_proxy_enabled")->get() == FALSE ) ) + !getChild<LLCheckBoxCtrl>("web_proxy_enabled")->get())) { otherHttpProxy->selectFirstItem(); } @@ -3311,10 +3333,10 @@ void LLFloaterPreferenceProxy::onChangeSocksSettings() void LLFloaterPreference::onUpdateFilterTerm(bool force) { - LLWString seachValue = utf8str_to_wstring( mFilterEdit->getValue() ); - LLWStringUtil::toLower( seachValue ); + LLWString seachValue = utf8str_to_wstring(mFilterEdit->getValue()); + LLWStringUtil::toLower(seachValue); - if( !mSearchData || (mSearchData->mLastFilter == seachValue && !force)) + if (!mSearchData || (mSearchData->mLastFilter == seachValue && !force)) return; if (mSearchDataDirty) @@ -3325,14 +3347,13 @@ void LLFloaterPreference::onUpdateFilterTerm(bool force) mSearchData->mLastFilter = seachValue; - if( !mSearchData->mRootTab ) + if (!mSearchData->mRootTab) return; mSearchData->mRootTab->hightlightAndHide( seachValue ); filterIgnorableNotifications(); - LLTabContainer *pRoot = getChild< LLTabContainer >( "pref core" ); - if( pRoot ) + if (LLTabContainer* pRoot = getChild<LLTabContainer>("pref core")) pRoot->selectFirstTab(); } @@ -3349,72 +3370,69 @@ void LLFloaterPreference::filterIgnorableNotifications() void collectChildren( LLView const *aView, ll::prefs::PanelDataPtr aParentPanel, ll::prefs::TabContainerDataPtr aParentTabContainer ) { - if( !aView ) + if (!aView) return; - llassert_always( aParentPanel || aParentTabContainer ); + llassert_always(aParentPanel || aParentTabContainer); - LLView::child_list_const_iter_t itr = aView->beginChild(); - LLView::child_list_const_iter_t itrEnd = aView->endChild(); - - while( itr != itrEnd ) + for (LLView* pView : *aView->getChildList()) { - LLView *pView = *itr; + if (!pView) + continue; + ll::prefs::PanelDataPtr pCurPanelData = aParentPanel; ll::prefs::TabContainerDataPtr pCurTabContainer = aParentTabContainer; - if( !pView ) - continue; - LLPanel const *pPanel = dynamic_cast< LLPanel const *>( pView ); - LLTabContainer const *pTabContainer = dynamic_cast< LLTabContainer const *>( pView ); - ll::ui::SearchableControl const *pSCtrl = dynamic_cast< ll::ui::SearchableControl const *>( pView ); - if( pTabContainer ) + LLPanel const *pPanel = dynamic_cast<LLPanel const*>(pView); + LLTabContainer const *pTabContainer = dynamic_cast<LLTabContainer const*>(pView); + ll::ui::SearchableControl const *pSCtrl = dynamic_cast<ll::ui::SearchableControl const*>( pView ); + + if (pTabContainer) { pCurPanelData.reset(); - pCurTabContainer = ll::prefs::TabContainerDataPtr( new ll::prefs::TabContainerData ); - pCurTabContainer->mTabContainer = const_cast< LLTabContainer *>( pTabContainer ); + pCurTabContainer = ll::prefs::TabContainerDataPtr(new ll::prefs::TabContainerData); + pCurTabContainer->mTabContainer = const_cast< LLTabContainer *>(pTabContainer); pCurTabContainer->mLabel = pTabContainer->getLabel(); pCurTabContainer->mPanel = 0; - if( aParentPanel ) - aParentPanel->mChildPanel.push_back( pCurTabContainer ); - if( aParentTabContainer ) - aParentTabContainer->mChildPanel.push_back( pCurTabContainer ); + if (aParentPanel) + aParentPanel->mChildPanel.push_back(pCurTabContainer); + if (aParentTabContainer) + aParentTabContainer->mChildPanel.push_back(pCurTabContainer); } - else if( pPanel ) + else if (pPanel) { pCurTabContainer.reset(); - pCurPanelData = ll::prefs::PanelDataPtr( new ll::prefs::PanelData ); + pCurPanelData = ll::prefs::PanelDataPtr(new ll::prefs::PanelData); pCurPanelData->mPanel = pPanel; pCurPanelData->mLabel = pPanel->getLabel(); llassert_always( aParentPanel || aParentTabContainer ); - if( aParentTabContainer ) - aParentTabContainer->mChildPanel.push_back( pCurPanelData ); - else if( aParentPanel ) - aParentPanel->mChildPanel.push_back( pCurPanelData ); + if (aParentTabContainer) + aParentTabContainer->mChildPanel.push_back(pCurPanelData); + else if (aParentPanel) + aParentPanel->mChildPanel.push_back(pCurPanelData); } - else if( pSCtrl && pSCtrl->getSearchText().size() ) + else if (pSCtrl && pSCtrl->getSearchText().size()) { - ll::prefs::SearchableItemPtr item = ll::prefs::SearchableItemPtr( new ll::prefs::SearchableItem() ); + ll::prefs::SearchableItemPtr item = ll::prefs::SearchableItemPtr(new ll::prefs::SearchableItem()); item->mView = pView; item->mCtrl = pSCtrl; - item->mLabel = utf8str_to_wstring( pSCtrl->getSearchText() ); - LLWStringUtil::toLower( item->mLabel ); + item->mLabel = utf8str_to_wstring(pSCtrl->getSearchText()); + LLWStringUtil::toLower(item->mLabel); - llassert_always( aParentPanel || aParentTabContainer ); + llassert_always(aParentPanel || aParentTabContainer); - if( aParentPanel ) - aParentPanel->mChildren.push_back( item ); - if( aParentTabContainer ) - aParentTabContainer->mChildren.push_back( item ); + if (aParentPanel) + aParentPanel->mChildren.push_back(item); + if (aParentTabContainer) + aParentTabContainer->mChildren.push_back(item); } - collectChildren( pView, pCurPanelData, pCurTabContainer ); - ++itr; + collectChildren(pView, pCurPanelData, pCurTabContainer); } } diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index bb7892362c..c26569f17c 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -79,9 +79,9 @@ public: ~LLFloaterPreference(); void apply(); - void cancel(); + void cancel(const std::vector<std::string> settings_to_skip = {}); /*virtual*/ void draw(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void onClose(bool app_quitting); /*virtual*/ void changed(); @@ -164,7 +164,6 @@ public: void onClickLogPath(); void changeLogPath(const std::vector<std::string>& filenames, std::string proposed_name); bool moveTranscriptsAndLog(); - void enableHistory(); void setPersonalInfo(const std::string& visibility); void refreshEnabledState(); void onCommitWindowedMode(); @@ -174,10 +173,8 @@ public: void refreshUI(); - void onCommitMediaEnabled(); - void onCommitMusicEnabled(); - void applyResolution(); void onChangeMaturity(); + void onChangeComplexityMode(const LLSD& newvalue); void onChangeModelFolder(); void onChangePBRFolder(); void onChangeTextureFolder(); @@ -199,7 +196,6 @@ public: void buildPopupLists(); static void refreshSkin(void* data); void selectPanel(const LLSD& name); - void saveCameraPreset(std::string& preset); void saveGraphicsPreset(std::string& preset); void setRecommendedSettings(); @@ -250,12 +246,12 @@ class LLPanelPreference : public LLPanel { public: LLPanelPreference(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); virtual ~LLPanelPreference(); virtual void apply(); - virtual void cancel(); + virtual void cancel(const std::vector<std::string> settings_to_skip = {}); void setControlFalse(const LLSD& user_data); virtual void setHardwareDefaults(); @@ -296,16 +292,14 @@ private: class LLPanelPreferenceGraphics : public LLPanelPreference { public: - BOOL postBuild(); + bool postBuild(); void draw(); - void cancel(); + void cancel(const std::vector<std::string> settings_to_skip = {}); void saveSettings(); void resetDirtyChilds(); void setHardwareDefaults(); void setPresetText(); - static const std::string getPresetsPath(); - protected: bool hasDirtyChilds(); @@ -321,10 +315,10 @@ public: LLPanelPreferenceControls(); virtual ~LLPanelPreferenceControls(); - BOOL postBuild(); + bool postBuild(); void apply(); - void cancel(); + void cancel(const std::vector<std::string> settings_to_skip = {}); void saveSettings(); void resetDirtyChilds(); @@ -392,7 +386,7 @@ public: void cancel(); protected: - BOOL postBuild(); + bool postBuild(); void onOpen(const LLSD& key); void onClose(bool app_quitting); void saveSettings(); diff --git a/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp b/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp index ae1c5cf6c9..7c9fa161d5 100644 --- a/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp +++ b/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp @@ -51,18 +51,17 @@ LLFloaterPreferenceGraphicsAdvanced::LLFloaterPreferenceGraphicsAdvanced(const L mCommitCallbackRegistrar.add("Pref.Cancel", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::onBtnCancel, this, _2)); mCommitCallbackRegistrar.add("Pref.OK", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::onBtnOK, this, _2)); - - mImpostorsChangedSignal = gSavedSettings.getControl("RenderAvatarMaxNonImpostors")->getSignal()->connect(boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateIndirectMaxNonImpostors, this, _2)); } LLFloaterPreferenceGraphicsAdvanced::~LLFloaterPreferenceGraphicsAdvanced() { mComplexityChangedSignal.disconnect(); + mComplexityModeChangedSignal.disconnect(); mLODFactorChangedSignal.disconnect(); - mImpostorsChangedSignal.disconnect(); + mNumImpostorsChangedSignal.disconnect(); } -BOOL LLFloaterPreferenceGraphicsAdvanced::postBuild() +bool LLFloaterPreferenceGraphicsAdvanced::postBuild() { // Don't do this on Mac as their braindead GL versioning // sets this when 8x and 16x are indeed available @@ -76,12 +75,30 @@ BOOL LLFloaterPreferenceGraphicsAdvanced::postBuild() } LLCheckBoxCtrl *use_HiDPI = getChild<LLCheckBoxCtrl>("use HiDPI"); - use_HiDPI->setVisible(FALSE); + use_HiDPI->setVisible(false); #endif - mComplexityChangedSignal = gSavedSettings.getControl("RenderAvatarMaxComplexity")->getCommitSignal()->connect(boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateComplexityText, this)); - mLODFactorChangedSignal = gSavedSettings.getControl("RenderVolumeLODFactor")->getCommitSignal()->connect(boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateObjectMeshDetailText, this)); - return TRUE; + mComplexityChangedSignal = gSavedSettings.getControl("RenderAvatarMaxComplexity")->getCommitSignal()->connect( + [this](LLControlVariable* control, const LLSD& new_val, const LLSD& old_val) + { + updateComplexityText(); + }); + mComplexityModeChangedSignal = gSavedSettings.getControl("RenderAvatarComplexityMode")->getSignal()->connect( + [this](LLControlVariable* control, const LLSD& new_val, const LLSD& old_val) + { + updateComplexityMode(new_val); + }); + mLODFactorChangedSignal = gSavedSettings.getControl("RenderVolumeLODFactor")->getCommitSignal()->connect( + [this](LLControlVariable* control, const LLSD& new_val, const LLSD& old_val) + { + updateObjectMeshDetailText(); + }); + mNumImpostorsChangedSignal = gSavedSettings.getControl("RenderAvatarMaxNonImpostors")->getSignal()->connect( + [this](LLControlVariable* control, const LLSD& new_val, const LLSD& old_val) + { + updateIndirectMaxNonImpostors(new_val); + }); + return true; } void LLFloaterPreferenceGraphicsAdvanced::onOpen(const LLSD& key) @@ -94,7 +111,7 @@ void LLFloaterPreferenceGraphicsAdvanced::onClickCloseBtn(bool app_quitting) LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences"); if (instance) { - instance->cancel(); + instance->cancel({"RenderQualityPerformance"}); } updateMaxComplexity(); } @@ -145,6 +162,10 @@ void LLFloaterPreferenceGraphicsAdvanced::refresh() gSavedSettings.getU32("RenderAvatarMaxComplexity"), getChild<LLTextBox>("IndirectMaxComplexityText", true)); refreshEnabledState(); + + bool enable_complexity = gSavedSettings.getS32("RenderAvatarComplexityMode") != LLVOAvatar::AV_RENDER_ONLY_SHOW_FRIENDS; + getChild<LLSliderCtrl>("IndirectMaxComplexity")->setEnabled(enable_complexity); + getChild<LLSliderCtrl>("IndirectMaxNonImpostors")->setEnabled(enable_complexity); } void LLFloaterPreferenceGraphicsAdvanced::refreshEnabledGraphics() @@ -160,6 +181,13 @@ void LLFloaterPreferenceGraphicsAdvanced::updateMaxComplexity() getChild<LLTextBox>("IndirectMaxComplexityText")); } +void LLFloaterPreferenceGraphicsAdvanced::updateComplexityMode(const LLSD& newvalue) +{ + bool enable_complexity = newvalue.asInteger() != LLVOAvatar::AV_RENDER_ONLY_SHOW_FRIENDS; + getChild<LLSliderCtrl>("IndirectMaxComplexity")->setEnabled(enable_complexity); + getChild<LLSliderCtrl>("IndirectMaxNonImpostors")->setEnabled(enable_complexity); +} + void LLFloaterPreferenceGraphicsAdvanced::updateComplexityText() { LLAvatarComplexityControls::setText(gSavedSettings.getU32("RenderAvatarMaxComplexity"), @@ -256,96 +284,96 @@ void LLFloaterPreferenceGraphicsAdvanced::disableUnavailableSettings() // disabled windlight if (!LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders")) { - ctrl_wind_light->setEnabled(FALSE); - ctrl_wind_light->setValue(FALSE); + ctrl_wind_light->setEnabled(false); + ctrl_wind_light->setValue(false); - sky->setEnabled(FALSE); - sky_text->setEnabled(FALSE); + sky->setEnabled(false); + sky_text->setEnabled(false); //deferred needs windlight, disable deferred - ctrl_shadows->setEnabled(FALSE); + ctrl_shadows->setEnabled(false); ctrl_shadows->setValue(0); - shadows_text->setEnabled(FALSE); + shadows_text->setEnabled(false); - ctrl_ssao->setEnabled(FALSE); - ctrl_ssao->setValue(FALSE); + ctrl_ssao->setEnabled(false); + ctrl_ssao->setValue(false); - ctrl_dof->setEnabled(FALSE); - ctrl_dof->setValue(FALSE); + ctrl_dof->setEnabled(false); + ctrl_dof->setValue(false); - ctrl_deferred->setEnabled(FALSE); - ctrl_deferred->setValue(FALSE); + ctrl_deferred->setEnabled(false); + ctrl_deferred->setValue(false); } // disabled deferred if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred")) { - ctrl_shadows->setEnabled(FALSE); + ctrl_shadows->setEnabled(false); ctrl_shadows->setValue(0); - shadows_text->setEnabled(FALSE); + shadows_text->setEnabled(false); - ctrl_ssao->setEnabled(FALSE); - ctrl_ssao->setValue(FALSE); + ctrl_ssao->setEnabled(false); + ctrl_ssao->setValue(false); - ctrl_dof->setEnabled(FALSE); - ctrl_dof->setValue(FALSE); + ctrl_dof->setEnabled(false); + ctrl_dof->setValue(false); - ctrl_deferred->setEnabled(FALSE); - ctrl_deferred->setValue(FALSE); + ctrl_deferred->setEnabled(false); + ctrl_deferred->setValue(false); } // disabled deferred SSAO if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferredSSAO")) { - ctrl_ssao->setEnabled(FALSE); - ctrl_ssao->setValue(FALSE); + ctrl_ssao->setEnabled(false); + ctrl_ssao->setValue(false); } // disabled deferred shadows if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderShadowDetail")) { - ctrl_shadows->setEnabled(FALSE); + ctrl_shadows->setEnabled(false); ctrl_shadows->setValue(0); - shadows_text->setEnabled(FALSE); + shadows_text->setEnabled(false); } // disabled reflections if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderReflectionDetail")) { - ctrl_reflections->setEnabled(FALSE); - ctrl_reflections->setValue(FALSE); - reflections_text->setEnabled(FALSE); + ctrl_reflections->setEnabled(false); + ctrl_reflections->setValue(false); + reflections_text->setEnabled(false); } // disabled av if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderAvatarVP")) { - ctrl_avatar_vp->setEnabled(FALSE); - ctrl_avatar_vp->setValue(FALSE); + ctrl_avatar_vp->setEnabled(false); + ctrl_avatar_vp->setValue(false); - ctrl_avatar_cloth->setEnabled(FALSE); - ctrl_avatar_cloth->setValue(FALSE); + ctrl_avatar_cloth->setEnabled(false); + ctrl_avatar_cloth->setValue(false); //deferred needs AvatarVP, disable deferred - ctrl_shadows->setEnabled(FALSE); + ctrl_shadows->setEnabled(false); ctrl_shadows->setValue(0); - shadows_text->setEnabled(FALSE); + shadows_text->setEnabled(false); - ctrl_ssao->setEnabled(FALSE); - ctrl_ssao->setValue(FALSE); + ctrl_ssao->setEnabled(false); + ctrl_ssao->setValue(false); - ctrl_dof->setEnabled(FALSE); - ctrl_dof->setValue(FALSE); + ctrl_dof->setEnabled(false); + ctrl_dof->setValue(false); - ctrl_deferred->setEnabled(FALSE); - ctrl_deferred->setValue(FALSE); + ctrl_deferred->setEnabled(false); + ctrl_deferred->setValue(false); } // disabled cloth if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderAvatarCloth")) { - ctrl_avatar_cloth->setEnabled(FALSE); - ctrl_avatar_cloth->setValue(FALSE); + ctrl_avatar_cloth->setEnabled(false); + ctrl_avatar_cloth->setValue(false); } } @@ -355,14 +383,14 @@ void LLFloaterPreferenceGraphicsAdvanced::refreshEnabledState() LLTextBox* reflections_text = getChild<LLTextBox>("ReflectionsText"); // Reflections - BOOL reflections = LLCubeMap::sUseCubeMaps; + bool reflections = LLCubeMap::sUseCubeMaps; ctrl_reflections->setEnabled(reflections); reflections_text->setEnabled(reflections); // Bump & Shiny LLCheckBoxCtrl* bumpshiny_ctrl = getChild<LLCheckBoxCtrl>("BumpShiny"); bool bumpshiny = LLCubeMap::sUseCubeMaps && LLFeatureManager::getInstance()->isFeatureAvailable("RenderObjectBump"); - bumpshiny_ctrl->setEnabled(bumpshiny ? TRUE : FALSE); + bumpshiny_ctrl->setEnabled(bumpshiny); // Avatar Mode // Enable Avatar Shaders @@ -374,44 +402,37 @@ void LLFloaterPreferenceGraphicsAdvanced::refreshEnabledState() if (LLViewerShaderMgr::sInitialized) { S32 max_avatar_shader = LLViewerShaderMgr::instance()->mMaxAvatarShaderLevel; - avatar_vp_enabled = (max_avatar_shader > 0) ? TRUE : FALSE; + avatar_vp_enabled = max_avatar_shader > 0; } ctrl_avatar_vp->setEnabled(avatar_vp_enabled); - if (gSavedSettings.getBOOL("RenderAvatarVP") == FALSE) - { - ctrl_avatar_cloth->setEnabled(FALSE); - } - else - { - ctrl_avatar_cloth->setEnabled(TRUE); - } + ctrl_avatar_cloth->setEnabled(gSavedSettings.getBOOL("RenderAvatarVP")); // Vertex Shaders, Global Shader Enable // SL-12594 Basic shaders are always enabled. DJH TODO clean up now-orphaned state handling code LLSliderCtrl* terrain_detail = getChild<LLSliderCtrl>("TerrainDetail"); // can be linked with control var LLTextBox* terrain_text = getChild<LLTextBox>("TerrainDetailText"); - terrain_detail->setEnabled(FALSE); - terrain_text->setEnabled(FALSE); + terrain_detail->setEnabled(false); + terrain_text->setEnabled(false); // WindLight //LLCheckBoxCtrl* ctrl_wind_light = getChild<LLCheckBoxCtrl>("WindLightUseAtmosShaders"); - //ctrl_wind_light->setEnabled(TRUE); + //ctrl_wind_light->setEnabled(true); LLSliderCtrl* sky = getChild<LLSliderCtrl>("SkyMeshDetail"); LLTextBox* sky_text = getChild<LLTextBox>("SkyMeshDetailText"); - sky->setEnabled(TRUE); - sky_text->setEnabled(TRUE); + sky->setEnabled(true); + sky_text->setEnabled(true); - BOOL enabled = TRUE; + bool enabled = true; #if 0 // deferred always on now //Deferred/SSAO/Shadows LLCheckBoxCtrl* ctrl_deferred = getChild<LLCheckBoxCtrl>("UseLightShaders"); enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") && - ((bumpshiny_ctrl && bumpshiny_ctrl->get()) ? TRUE : FALSE) && - (ctrl_wind_light->get()) ? TRUE : FALSE; + bumpshiny_ctrl && bumpshiny_ctrl->get() && + ctrl_wind_light->get(); ctrl_deferred->setEnabled(enabled); #endif @@ -419,7 +440,7 @@ void LLFloaterPreferenceGraphicsAdvanced::refreshEnabledState() LLCheckBoxCtrl* ctrl_pbr = getChild<LLCheckBoxCtrl>("UsePBRShaders"); //PBR - ctrl_pbr->setEnabled(TRUE); + ctrl_pbr->setEnabled(true); LLCheckBoxCtrl* ctrl_ssao = getChild<LLCheckBoxCtrl>("UseSSAO"); LLCheckBoxCtrl* ctrl_dof = getChild<LLCheckBoxCtrl>("UseDoF"); @@ -427,7 +448,7 @@ void LLFloaterPreferenceGraphicsAdvanced::refreshEnabledState() LLTextBox* shadow_text = getChild<LLTextBox>("RenderShadowDetailText"); // note, okay here to get from ctrl_deferred as it's twin, ctrl_deferred2 will alway match it - enabled = enabled && LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferredSSAO");// && (ctrl_deferred->get() ? TRUE : FALSE); + enabled = enabled && LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferredSSAO");// && ctrl_deferred->get(); //ctrl_deferred->set(gSavedSettings.getBOOL("RenderDeferred")); @@ -443,12 +464,12 @@ void LLFloaterPreferenceGraphicsAdvanced::refreshEnabledState() if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderVBOEnable")) { - getChildView("vbo")->setEnabled(FALSE); + getChildView("vbo")->setEnabled(false); } if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderCompressTextures")) { - getChildView("texture compression")->setEnabled(FALSE); + getChildView("texture compression")->setEnabled(false); } // if no windlight shaders, turn off nighttime brightness, gamma, and fog distance diff --git a/indra/newview/llfloaterpreferencesgraphicsadvanced.h b/indra/newview/llfloaterpreferencesgraphicsadvanced.h index bab51b712b..61203be068 100644 --- a/indra/newview/llfloaterpreferencesgraphicsadvanced.h +++ b/indra/newview/llfloaterpreferencesgraphicsadvanced.h @@ -37,7 +37,7 @@ class LLFloaterPreferenceGraphicsAdvanced : public LLFloater public: LLFloaterPreferenceGraphicsAdvanced(const LLSD& key); ~LLFloaterPreferenceGraphicsAdvanced(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); void onOpen(const LLSD& key); void onClickCloseBtn(bool app_quitting); void disableUnavailableSettings(); @@ -48,6 +48,7 @@ public: void updateIndirectMaxNonImpostors(const LLSD& newvalue); void setMaxNonImpostorsText(U32 value, LLTextBox* text_box); void updateMaxComplexity(); + void updateComplexityMode(const LLSD& newvalue); void updateComplexityText(); void updateObjectMeshDetailText(); void refresh(); @@ -60,9 +61,10 @@ protected: void onBtnOK(const LLSD& userdata); void onBtnCancel(const LLSD& userdata); - boost::signals2::connection mImpostorsChangedSignal; boost::signals2::connection mComplexityChangedSignal; + boost::signals2::connection mComplexityModeChangedSignal; boost::signals2::connection mLODFactorChangedSignal; + boost::signals2::connection mNumImpostorsChangedSignal; }; #endif //LLFLOATERPREFERENCEGRAPHICSADVANCED_H diff --git a/indra/newview/llfloaterpreviewtrash.cpp b/indra/newview/llfloaterpreviewtrash.cpp index af33e43109..21e7585c40 100644 --- a/indra/newview/llfloaterpreviewtrash.cpp +++ b/indra/newview/llfloaterpreviewtrash.cpp @@ -37,7 +37,7 @@ LLFloaterPreviewTrash::LLFloaterPreviewTrash(const LLSD& key) { } -BOOL LLFloaterPreviewTrash::postBuild() +bool LLFloaterPreviewTrash::postBuild() { getChild<LLUICtrl>("empty_btn")->setCommitCallback( boost::bind(&LLFloaterPreviewTrash::onClickEmpty, this)); @@ -49,7 +49,7 @@ BOOL LLFloaterPreviewTrash::postBuild() // mid-session and the saved rect is off-center. center(); - return TRUE; + return true; } LLFloaterPreviewTrash::~LLFloaterPreviewTrash() @@ -60,7 +60,7 @@ LLFloaterPreviewTrash::~LLFloaterPreviewTrash() // static void LLFloaterPreviewTrash::show() { - LLFloaterReg::showTypedInstance<LLFloaterPreviewTrash>("preview_trash", LLSD(), TRUE); + LLFloaterReg::showTypedInstance<LLFloaterPreviewTrash>("preview_trash", LLSD(), true); } // static diff --git a/indra/newview/llfloaterpreviewtrash.h b/indra/newview/llfloaterpreviewtrash.h index 7d130077c5..2be36cb188 100644 --- a/indra/newview/llfloaterpreviewtrash.h +++ b/indra/newview/llfloaterpreviewtrash.h @@ -39,7 +39,7 @@ public: LLFloaterPreviewTrash(const LLSD& key); ~LLFloaterPreviewTrash(); - /*virtual*/ BOOL postBuild(); + bool postBuild() override; protected: void onClickEmpty(); diff --git a/indra/newview/llfloaterprofile.cpp b/indra/newview/llfloaterprofile.cpp index 8df42a4faa..ee92785b6f 100644 --- a/indra/newview/llfloaterprofile.cpp +++ b/indra/newview/llfloaterprofile.cpp @@ -59,11 +59,11 @@ void LLFloaterProfile::onOpen(const LLSD& key) mNameCallbackConnection = LLAvatarNameCache::get(mAvatarId, boost::bind(&LLFloaterProfile::onAvatarNameCache, this, _1, _2)); } -BOOL LLFloaterProfile::postBuild() +bool LLFloaterProfile::postBuild() { mPanelProfile = findChild<LLPanelProfile>(PANEL_PROFILE_VIEW); - return TRUE; + return true; } void LLFloaterProfile::onClickCloseBtn(bool app_quitting) diff --git a/indra/newview/llfloaterprofile.h b/indra/newview/llfloaterprofile.h index b3ed02fc2c..20c82c07b1 100644 --- a/indra/newview/llfloaterprofile.h +++ b/indra/newview/llfloaterprofile.h @@ -40,7 +40,7 @@ public: LLFloaterProfile(const LLSD& key); virtual ~LLFloaterProfile(); - BOOL postBuild() override; + bool postBuild() override; void onOpen(const LLSD& key) override; void onClickCloseBtn(bool app_quitting = false) override; diff --git a/indra/newview/llfloaterprofiletexture.cpp b/indra/newview/llfloaterprofiletexture.cpp index 7108047a6b..47b3aa015b 100644 --- a/indra/newview/llfloaterprofiletexture.cpp +++ b/indra/newview/llfloaterprofiletexture.cpp @@ -129,7 +129,7 @@ void LLProfileImageCtrl::setImageAssetId(const LLUUID& asset_id) if ((mImage->getFullWidth() * mImage->getFullHeight()) == 0) { mImage->setLoadedCallback(LLProfileImageCtrl::onImageLoaded, - 0, TRUE, FALSE, new LLHandle<LLUICtrl>(getHandle()), &mCallbackTextureList); + 0, true, false, new LLHandle<LLUICtrl>(getHandle()), &mCallbackTextureList); } else { @@ -147,12 +147,12 @@ void LLProfileImageCtrl::onImageLoaded(bool success, LLViewerFetchedTexture* img } // static -void LLProfileImageCtrl::onImageLoaded(BOOL success, +void LLProfileImageCtrl::onImageLoaded(bool success, LLViewerFetchedTexture* src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, - BOOL final, + bool final, void* userdata) { if (!userdata) return; @@ -196,19 +196,19 @@ LLFloaterProfileTexture::~LLFloaterProfileTexture() } // virtual -BOOL LLFloaterProfileTexture::postBuild() +bool LLFloaterProfileTexture::postBuild() { mProfileIcon = getChild<LLProfileImageCtrl>("profile_pic"); - mProfileIcon->setImageLoadedCallback([this](BOOL success, LLViewerFetchedTexture* imagep) {onImageLoaded(success, imagep); }); + mProfileIcon->setImageLoadedCallback([this](bool success, LLViewerFetchedTexture* imagep) {onImageLoaded(success, imagep); }); mCloseButton = getChild<LLButton>("close_btn"); mCloseButton->setCommitCallback([this](LLUICtrl*, void*) { closeFloater(); }, nullptr); - return TRUE; + return true; } // virtual -void LLFloaterProfileTexture::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLFloaterProfileTexture::reshape(S32 width, S32 height, bool called_from_parent) { LLFloater::reshape(width, height, called_from_parent); } @@ -251,7 +251,7 @@ void LLFloaterProfileTexture::updateDimensions() //reshape floater reshape(width, height); - gFloaterView->adjustToFitScreen(this, FALSE); + gFloaterView->adjustToFitScreen(this, false); } void LLFloaterProfileTexture::draw() @@ -279,7 +279,7 @@ void LLFloaterProfileTexture::loadAsset(const LLUUID &image_id) updateDimensions(); } -void LLFloaterProfileTexture::onImageLoaded(BOOL success, LLViewerFetchedTexture* imagep) +void LLFloaterProfileTexture::onImageLoaded(bool success, LLViewerFetchedTexture* imagep) { if (success) { diff --git a/indra/newview/llfloaterprofiletexture.h b/indra/newview/llfloaterprofiletexture.h index 12efbab572..cdb1b92ba9 100644 --- a/indra/newview/llfloaterprofiletexture.h +++ b/indra/newview/llfloaterprofiletexture.h @@ -1,25 +1,25 @@ -/** +/** * @file llfloaterprofiletexture.h * @brief LLFloaterProfileTexture class definition * * $LicenseInfo:firstyear=2022&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2022, 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$ */ @@ -54,12 +54,12 @@ public: boost::signals2::connection setImageLoadedCallback(const image_loaded_signal_t::slot_type& cb); private: void onImageLoaded(bool success, LLViewerFetchedTexture* src_vi); - static void onImageLoaded(BOOL success, + static void onImageLoaded(bool success, LLViewerFetchedTexture* src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, - BOOL final, + bool final, void* userdata); void releaseTexture(); @@ -85,13 +85,13 @@ public: void resetAsset(); void loadAsset(const LLUUID &image_id); - void onImageLoaded(BOOL success, LLViewerFetchedTexture* imagep); + void onImageLoaded(bool success, LLViewerFetchedTexture* imagep); - void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE) override; + void reshape(S32 width, S32 height, bool called_from_parent = true) override; LLHandle<LLFloater> getHandle() const { return LLFloater::getHandle(); } protected: - BOOL postBuild() override; + bool postBuild() override; private: void updateDimensions(); diff --git a/indra/newview/llfloaterregiondebugconsole.cpp b/indra/newview/llfloaterregiondebugconsole.cpp index afcd07f1ec..26647333dc 100644 --- a/indra/newview/llfloaterregiondebugconsole.cpp +++ b/indra/newview/llfloaterregiondebugconsole.cpp @@ -106,7 +106,7 @@ LLFloaterRegionDebugConsole::~LLFloaterRegionDebugConsole() mReplySignalConnection.disconnect(); } -BOOL LLFloaterRegionDebugConsole::postBuild() +bool LLFloaterRegionDebugConsole::postBuild() { LLLineEditor* input = getChild<LLLineEditor>("region_debug_console_input"); input->setEnableLineHistory(true); @@ -126,12 +126,12 @@ BOOL LLFloaterRegionDebugConsole::postBuild() mOutput->appendText( CONSOLE_NOT_SUPPORTED + PROMPT, false); - return TRUE; + return true; } } mOutput->appendText("> ", false); - return TRUE; + return true; } void LLFloaterRegionDebugConsole::onInput(LLUICtrl* ctrl, const LLSD& param) diff --git a/indra/newview/llfloaterregiondebugconsole.h b/indra/newview/llfloaterregiondebugconsole.h index e7dc0f3a5f..a26cf1a30f 100644 --- a/indra/newview/llfloaterregiondebugconsole.h +++ b/indra/newview/llfloaterregiondebugconsole.h @@ -43,8 +43,7 @@ public: LLFloaterRegionDebugConsole(LLSD const & key); virtual ~LLFloaterRegionDebugConsole(); - // virtual - BOOL postBuild(); + bool postBuild() override; void onInput(LLUICtrl* ctrl, const LLSD& param); diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 0a66b7d037..6d30cb1f95 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -68,6 +68,7 @@ #include "llnamelistctrl.h" #include "llnotifications.h" #include "llnotificationsutil.h" +#include "llpbrterrainfeatures.h" #include "llregioninfomodel.h" #include "llscrolllistitem.h" #include "llsliderctrl.h" @@ -195,7 +196,7 @@ public: bool refreshFromRegion(LLViewerRegion* region); - virtual BOOL postBuild() override; + virtual bool postBuild() override; virtual void onOpen(const LLSD& key) override {}; virtual S32 getParcelId() override { return INVALID_PARCEL_ID; } @@ -233,7 +234,7 @@ LLFloaterRegionInfo::LLFloaterRegionInfo(const LLSD& seed) mRegionChangedCallback() {} -BOOL LLFloaterRegionInfo::postBuild() +bool LLFloaterRegionInfo::postBuild() { mTab = getChild<LLTabContainer>("region_panels"); mTab->setCommitCallback(boost::bind(&LLFloaterRegionInfo::onTabSelected, this, _2)); @@ -263,7 +264,16 @@ BOOL LLFloaterRegionInfo::postBuild() panel = new LLPanelRegionTerrainInfo; mInfoPanels.push_back(panel); - panel->buildFromFile("panel_region_terrain.xml"); + static LLCachedControl<bool> feature_pbr_terrain_enabled(gSavedSettings, "RenderTerrainPBREnabled", false); + static LLCachedControl<bool> feature_pbr_terrain_transforms_enabled(gSavedSettings, "RenderTerrainPBRTransformsEnabled", false); + if (!feature_pbr_terrain_transforms_enabled || !feature_pbr_terrain_enabled) + { + panel->buildFromFile("panel_region_terrain.xml"); + } + else + { + panel->buildFromFile("panel_region_terrain_texture_transform.xml"); + } mTab->addTabPanel(panel); mEnvironmentPanel = new LLPanelRegionEnvironment; @@ -278,7 +288,7 @@ BOOL LLFloaterRegionInfo::postBuild() if(gDisconnected) { - return TRUE; + return true; } if(!gAgent.getRegionCapability("RegionExperiences").empty()) @@ -296,7 +306,7 @@ BOOL LLFloaterRegionInfo::postBuild() // Request region info when agent region changes. mRegionChangedCallback = gAgent.addRegionChangedCallback(boost::bind(&LLFloaterRegionInfo::onRegionChanged, this)); - return TRUE; + return true; } LLFloaterRegionInfo::~LLFloaterRegionInfo() @@ -344,11 +354,11 @@ void LLFloaterRegionInfo::requestRegionInfo() LLTabContainer* tab = findChild<LLTabContainer>("region_panels"); if (tab) { - tab->getChild<LLPanel>("General")->setCtrlsEnabled(FALSE); - tab->getChild<LLPanel>("Debug")->setCtrlsEnabled(FALSE); - tab->getChild<LLPanel>("Terrain")->setCtrlsEnabled(FALSE); - tab->getChild<LLPanel>("Estate")->setCtrlsEnabled(FALSE); - tab->getChild<LLPanel>("Access")->setCtrlsEnabled(FALSE); + tab->getChild<LLPanel>("General")->setCtrlsEnabled(false); + tab->getChild<LLPanel>("Debug")->setCtrlsEnabled(false); + tab->getChild<LLPanel>("Terrain")->setAllChildrenEnabled(false, true); + tab->getChild<LLPanel>("Estate")->setCtrlsEnabled(false); + tab->getChild<LLPanel>("Access")->setCtrlsEnabled(false); } // Must allow anyone to request the RegionInfo data @@ -419,7 +429,7 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels"); LLViewerRegion* region = gAgent.getRegion(); - BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate()); + bool allow_modify = gAgent.isGodlike() || (region && region->canManageEstate()); // *TODO: Replace parsing msg with accessing the region info model. LLRegionInfoModel& region_info = LLRegionInfoModel::instance(); @@ -435,7 +445,7 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) F32 water_height; F32 terrain_raise_limit; F32 terrain_lower_limit; - BOOL use_estate_sun; + bool use_estate_sun; F32 sun_hour; msg->getString("RegionInfo", "SimName", sim_name); msg->getU8("RegionInfo", "MaxAgents", agent_limit); @@ -497,17 +507,17 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) panel->getChild<LLUICtrl>("region_type")->setValue(LLSD(sim_type)); panel->getChild<LLUICtrl>("version_channel_text")->setValue(gLastVersionChannel); - panel->getChild<LLUICtrl>("block_terraform_check")->setValue((region_flags & REGION_FLAGS_BLOCK_TERRAFORM) ? TRUE : FALSE ); - panel->getChild<LLUICtrl>("block_fly_check")->setValue((region_flags & REGION_FLAGS_BLOCK_FLY) ? TRUE : FALSE ); - panel->getChild<LLUICtrl>("block_fly_over_check")->setValue((region_flags & REGION_FLAGS_BLOCK_FLYOVER) ? TRUE : FALSE ); - panel->getChild<LLUICtrl>("allow_damage_check")->setValue((region_flags & REGION_FLAGS_ALLOW_DAMAGE) ? TRUE : FALSE ); - panel->getChild<LLUICtrl>("restrict_pushobject")->setValue((region_flags & REGION_FLAGS_RESTRICT_PUSHOBJECT) ? TRUE : FALSE ); - panel->getChild<LLUICtrl>("allow_land_resell_check")->setValue((region_flags & REGION_FLAGS_BLOCK_LAND_RESELL) ? FALSE : TRUE ); - panel->getChild<LLUICtrl>("allow_parcel_changes_check")->setValue((region_flags & REGION_FLAGS_ALLOW_PARCEL_CHANGES) ? TRUE : FALSE ); - panel->getChild<LLUICtrl>("block_parcel_search_check")->setValue((region_flags & REGION_FLAGS_BLOCK_PARCEL_SEARCH) ? TRUE : FALSE ); - panel->getChild<LLUICtrl>("agent_limit_spin")->setValue(LLSD((F32)agent_limit) ); - panel->getChild<LLUICtrl>("object_bonus_spin")->setValue(LLSD(object_bonus_factor) ); - panel->getChild<LLUICtrl>("access_combo")->setValue(LLSD(sim_access) ); + panel->getChild<LLUICtrl>("block_terraform_check")->setValue(is_flag_set(region_flags, REGION_FLAGS_BLOCK_TERRAFORM)); + panel->getChild<LLUICtrl>("block_fly_check")->setValue(is_flag_set(region_flags, REGION_FLAGS_BLOCK_FLY)); + panel->getChild<LLUICtrl>("block_fly_over_check")->setValue(is_flag_set(region_flags, REGION_FLAGS_BLOCK_FLYOVER)); + panel->getChild<LLUICtrl>("allow_damage_check")->setValue(is_flag_set(region_flags, REGION_FLAGS_ALLOW_DAMAGE)); + panel->getChild<LLUICtrl>("restrict_pushobject")->setValue(is_flag_set(region_flags, REGION_FLAGS_RESTRICT_PUSHOBJECT)); + panel->getChild<LLUICtrl>("allow_land_resell_check")->setValue(!is_flag_set(region_flags, REGION_FLAGS_BLOCK_LAND_RESELL)); + panel->getChild<LLUICtrl>("allow_parcel_changes_check")->setValue(is_flag_set(region_flags, REGION_FLAGS_ALLOW_PARCEL_CHANGES)); + panel->getChild<LLUICtrl>("block_parcel_search_check")->setValue(is_flag_set(region_flags, REGION_FLAGS_BLOCK_PARCEL_SEARCH)); + panel->getChild<LLUICtrl>("agent_limit_spin")->setValue(LLSD((F32)agent_limit)); + panel->getChild<LLUICtrl>("object_bonus_spin")->setValue(LLSD(object_bonus_factor)); + panel->getChild<LLUICtrl>("access_combo")->setValue(LLSD(sim_access)); panel->getChild<LLSpinCtrl>("agent_limit_spin")->setMaxValue(hard_agent_limit); @@ -521,7 +531,7 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) U32 parent_estate_id; msg->getU32("RegionInfo", "ParentEstateID", parent_estate_id); - BOOL teen_grid = (parent_estate_id == 5); // *TODO add field to estate table and test that + bool teen_grid = (parent_estate_id == 5); // *TODO add field to estate table and test that panel->getChildView("access_combo")->setEnabled(gAgent.isGodlike() || (region && region->canManageEstate() && !teen_grid)); panel->setCtrlsEnabled(allow_modify); @@ -530,9 +540,9 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) panel = tab->getChild<LLPanel>("Debug"); panel->getChild<LLUICtrl>("region_text")->setValue(LLSD(sim_name) ); - panel->getChild<LLUICtrl>("disable_scripts_check")->setValue(LLSD((BOOL)((region_flags & REGION_FLAGS_SKIP_SCRIPTS) ? TRUE : FALSE )) ); - panel->getChild<LLUICtrl>("disable_collisions_check")->setValue(LLSD((BOOL)((region_flags & REGION_FLAGS_SKIP_COLLISIONS) ? TRUE : FALSE )) ); - panel->getChild<LLUICtrl>("disable_physics_check")->setValue(LLSD((BOOL)((region_flags & REGION_FLAGS_SKIP_PHYSICS) ? TRUE : FALSE )) ); + panel->getChild<LLUICtrl>("disable_scripts_check")->setValue(LLSD((bool)(region_flags & REGION_FLAGS_SKIP_SCRIPTS))); + panel->getChild<LLUICtrl>("disable_collisions_check")->setValue(LLSD((bool)(region_flags & REGION_FLAGS_SKIP_COLLISIONS))); + panel->getChild<LLUICtrl>("disable_physics_check")->setValue(LLSD((bool)(region_flags & REGION_FLAGS_SKIP_PHYSICS))); panel->setCtrlsEnabled(allow_modify); // TERRAIN PANEL @@ -543,7 +553,7 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) panel->getChild<LLUICtrl>("terrain_raise_spin")->setValue(region_info.mTerrainRaiseLimit); panel->getChild<LLUICtrl>("terrain_lower_spin")->setValue(region_info.mTerrainLowerLimit); - panel->setCtrlsEnabled(allow_modify); + panel->setAllChildrenEnabled(allow_modify, true); if (floater->getVisible()) { @@ -554,6 +564,20 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) } // static +void LLFloaterRegionInfo::sRefreshFromRegion(LLViewerRegion* region) +{ + if (region != gAgent.getRegion()) { return; } + + LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info"); + if (!floater) { return; } + + if (floater->getVisible() && region == gAgent.getRegion()) + { + floater->refreshFromRegion(region); + } +} + +// static LLPanelEstateInfo* LLFloaterRegionInfo::getPanelEstate() { LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info"); @@ -642,12 +666,12 @@ void LLFloaterRegionInfo::disableTabCtrls() { LLTabContainer* tab = getChild<LLTabContainer>("region_panels"); - tab->getChild<LLPanel>("General")->setCtrlsEnabled(FALSE); - tab->getChild<LLPanel>("Debug")->setCtrlsEnabled(FALSE); - tab->getChild<LLPanel>("Terrain")->setCtrlsEnabled(FALSE); - tab->getChild<LLPanel>("panel_env_info")->setCtrlsEnabled(FALSE); - tab->getChild<LLPanel>("Estate")->setCtrlsEnabled(FALSE); - tab->getChild<LLPanel>("Access")->setCtrlsEnabled(FALSE); + tab->getChild<LLPanel>("General")->setCtrlsEnabled(false); + tab->getChild<LLPanel>("Debug")->setCtrlsEnabled(false); + tab->getChild<LLPanel>("Terrain")->setAllChildrenEnabled(false, true); + tab->getChild<LLPanel>("panel_env_info")->setCtrlsEnabled(false); + tab->getChild<LLPanel>("Estate")->setCtrlsEnabled(false); + tab->getChild<LLPanel>("Access")->setCtrlsEnabled(false); } void LLFloaterRegionInfo::onTabSelected(const LLSD& param) @@ -750,7 +774,7 @@ void LLPanelRegionInfo::onChangeText(LLLineEditor* caller, void* user_data) // virtual -BOOL LLPanelRegionInfo::postBuild() +bool LLPanelRegionInfo::postBuild() { // If the panel has an Apply button, set a callback for it. LLUICtrl* apply_btn = findChild<LLUICtrl>("apply_btn"); @@ -760,7 +784,7 @@ BOOL LLPanelRegionInfo::postBuild() } refresh(); - return TRUE; + return true; } // virtual @@ -808,7 +832,7 @@ void LLPanelRegionInfo::sendEstateOwnerMessage( msg->sendReliable(mHost); } -void LLPanelRegionInfo::enableButton(const std::string& btn_name, BOOL enable) +void LLPanelRegionInfo::enableButton(const std::string& btn_name, bool enable) { LLView* button = findChildView(btn_name); if (button) button->setEnabled(enable); @@ -817,7 +841,7 @@ void LLPanelRegionInfo::enableButton(const std::string& btn_name, BOOL enable) void LLPanelRegionInfo::disableButton(const std::string& btn_name) { LLView* button = findChildView(btn_name); - if (button) button->setEnabled(FALSE); + if (button) button->setEnabled(false); } void LLPanelRegionInfo::initCtrl(const std::string& name) @@ -825,6 +849,13 @@ void LLPanelRegionInfo::initCtrl(const std::string& name) getChild<LLUICtrl>(name)->setCommitCallback(boost::bind(&LLPanelRegionInfo::onChangeAnything, this)); } +template<typename CTRL> +void LLPanelRegionInfo::initAndSetCtrl(CTRL*& ctrl, const std::string& name) +{ + initCtrl(name); + ctrl = findChild<CTRL>(name); +} + void LLPanelRegionInfo::onClickManageTelehub() { LLFloaterReg::hideInstance("region_info"); @@ -836,9 +867,9 @@ void LLPanelRegionInfo::onClickManageTelehub() // bool LLPanelRegionGeneralInfo::refreshFromRegion(LLViewerRegion* region) { - BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate()); + bool allow_modify = gAgent.isGodlike() || (region && region->canManageEstate()); setCtrlsEnabled(allow_modify); - getChildView("apply_btn")->setEnabled(FALSE); + getChildView("apply_btn")->setEnabled(false); getChildView("access_text")->setEnabled(allow_modify); // getChildView("access_combo")->setEnabled(allow_modify); // now set in processRegionInfo for teen grid detection @@ -852,7 +883,7 @@ bool LLPanelRegionGeneralInfo::refreshFromRegion(LLViewerRegion* region) return LLPanelRegionInfo::refreshFromRegion(region); } -BOOL LLPanelRegionGeneralInfo::postBuild() +bool LLPanelRegionGeneralInfo::postBuild() { // Enable the "Apply" button if something is changed. JC initCtrl("block_terraform_check"); @@ -879,7 +910,7 @@ BOOL LLPanelRegionGeneralInfo::postBuild() } refresh(); - return TRUE; + return true; } void LLPanelRegionGeneralInfo::onBtnSet() @@ -919,7 +950,7 @@ void LLPanelRegionGeneralInfo::onClickKick() LLView * button = findChild<LLButton>("kick_btn"); LLFloater* parent_floater = gFloaterView->getParentFloater(this); LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelRegionGeneralInfo::onKickCommit, this, _1), - FALSE, TRUE, FALSE, parent_floater->getName(), button); + false, true, false, parent_floater->getName(), button); if (child_floater) { parent_floater->addDependentFloater(child_floater); @@ -1024,7 +1055,7 @@ bool LLPanelRegionGeneralInfo::onMessageCommit(const LLSD& notification, const L // strings[7] = restrict pushobject // strings[8] = 'Y' - allow parcel subdivide, 'N' - not // strings[9] = 'Y' - block parcel search, 'N' - allow -BOOL LLPanelRegionGeneralInfo::sendUpdate() +bool LLPanelRegionGeneralInfo::sendUpdate() { LL_INFOS() << "LLPanelRegionGeneralInfo::sendUpdate()" << LL_ENDL; @@ -1093,13 +1124,13 @@ BOOL LLPanelRegionGeneralInfo::sendUpdate() LLNotificationsUtil::add("RegionMaturityChange"); } - return TRUE; + return true; } ///////////////////////////////////////////////////////////////////////////// // LLPanelRegionDebugInfo ///////////////////////////////////////////////////////////////////////////// -BOOL LLPanelRegionDebugInfo::postBuild() +bool LLPanelRegionDebugInfo::postBuild() { LLPanelRegionInfo::postBuild(); initCtrl("disable_scripts_check"); @@ -1114,16 +1145,16 @@ BOOL LLPanelRegionDebugInfo::postBuild() childSetAction("cancel_restart_btn", onClickCancelRestart, this); childSetAction("region_debug_console_btn", onClickDebugConsole, this); - return TRUE; + return true; } // virtual bool LLPanelRegionDebugInfo::refreshFromRegion(LLViewerRegion* region) { - BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate()); + bool allow_modify = gAgent.isGodlike() || (region && region->canManageEstate()); setCtrlsEnabled(allow_modify); - getChildView("apply_btn")->setEnabled(FALSE); - getChildView("target_avatar_name")->setEnabled(FALSE); + getChildView("apply_btn")->setEnabled(false); + getChildView("target_avatar_name")->setEnabled(false); getChildView("choose_avatar_btn")->setEnabled(allow_modify); getChildView("return_scripts")->setEnabled(allow_modify && !mTargetAvatar.isNull()); @@ -1140,7 +1171,7 @@ bool LLPanelRegionDebugInfo::refreshFromRegion(LLViewerRegion* region) } // virtual -BOOL LLPanelRegionDebugInfo::sendUpdate() +bool LLPanelRegionDebugInfo::sendUpdate() { LL_INFOS() << "LLPanelRegionDebugInfo::sendUpdate" << LL_ENDL; strings_t strings; @@ -1157,7 +1188,7 @@ BOOL LLPanelRegionDebugInfo::sendUpdate() LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); sendEstateOwnerMessage(gMessageSystem, "setregiondebug", invoice, strings); - return TRUE; + return true; } void LLPanelRegionDebugInfo::onClickChooseAvatar() @@ -1165,7 +1196,7 @@ void LLPanelRegionDebugInfo::onClickChooseAvatar() LLView * button = findChild<LLButton>("choose_avatar_btn"); LLFloater* parent_floater = gFloaterView->getParentFloater(this); LLFloater * child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelRegionDebugInfo::callbackAvatarID, this, _1, _2), - FALSE, TRUE, FALSE, parent_floater->getName(), button); + false, true, false, parent_floater->getName(), button); if (child_floater) { parent_floater->addDependentFloater(child_floater); @@ -1468,7 +1499,7 @@ bool LLPanelRegionTerrainInfo::validateMaterials() return valid; } -BOOL LLPanelRegionTerrainInfo::validateTextureHeights() +bool LLPanelRegionTerrainInfo::validateTextureHeights() { for (S32 i = 0; i < CORNER_COUNT; ++i) { @@ -1477,11 +1508,11 @@ BOOL LLPanelRegionTerrainInfo::validateTextureHeights() if (getChild<LLUICtrl>(low)->getValue().asReal() > getChild<LLUICtrl>(high)->getValue().asReal()) { - return FALSE; + return false; } } - return TRUE; + return true; } ///////////////////////////////////////////////////////////////////////////// @@ -1494,17 +1525,23 @@ LLPanelRegionTerrainInfo::LLPanelRegionTerrainInfo() const LLUUID (&default_textures)[LLVLComposition::ASSET_COUNT] = LLVLComposition::getDefaultTextures(); for (S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i) { + mTextureDetailCtrl[i] = nullptr; + mMaterialDetailCtrl[i] = nullptr; + mLastSetTextures[i] = default_textures[i]; - } - for (S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i) - { mLastSetMaterials[i] = BLANK_MATERIAL_ASSET_ID; + + mMaterialScaleUCtrl[i] = nullptr; + mMaterialScaleVCtrl[i] = nullptr; + mMaterialRotationCtrl[i] = nullptr; + mMaterialOffsetUCtrl[i] = nullptr; + mMaterialOffsetVCtrl[i] = nullptr; } } // Initialize statics -BOOL LLPanelRegionTerrainInfo::postBuild() +bool LLPanelRegionTerrainInfo::postBuild() { LLPanelRegionInfo::postBuild(); @@ -1519,15 +1556,18 @@ BOOL LLPanelRegionTerrainInfo::postBuild() for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i) { - buffer = llformat("texture_detail_%d", i); - initCtrl(buffer); - mTextureDetailCtrl[i] = findChild<LLTextureCtrl>(buffer); - } - for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i) - { - buffer = llformat("material_detail_%d", i); - initCtrl(buffer); - mMaterialDetailCtrl[i] = findChild<LLTextureCtrl>(buffer); + initAndSetCtrl(mTextureDetailCtrl[i], llformat("texture_detail_%d", i)); + if (mTextureDetailCtrl[i]) + { + mTextureDetailCtrl[i]->setBakeTextureEnabled(false); + } + initAndSetCtrl(mMaterialDetailCtrl[i], llformat("material_detail_%d", i)); + + initAndSetCtrl(mMaterialScaleUCtrl[i], llformat("terrain%dScaleU", i)); + initAndSetCtrl(mMaterialScaleVCtrl[i], llformat("terrain%dScaleV", i)); + initAndSetCtrl(mMaterialRotationCtrl[i], llformat("terrain%dRotation", i)); + initAndSetCtrl(mMaterialOffsetUCtrl[i], llformat("terrain%dOffsetU", i)); + initAndSetCtrl(mMaterialOffsetVCtrl[i], llformat("terrain%dOffsetV", i)); } for(S32 i = 0; i < CORNER_COUNT; ++i) @@ -1579,6 +1619,17 @@ void LLPanelRegionTerrainInfo::updateForMaterialType() } } + // Toggle visibility of terrain tabs + LLTabContainer* terrain_tabs = findChild<LLTabContainer>("terrain_tabs"); + if (terrain_tabs) + { + LLPanel* pbr_terrain_repeats_tab = findChild<LLPanel>("terrain_transform_panel"); + if (pbr_terrain_repeats_tab) + { + terrain_tabs->setTabVisibility(pbr_terrain_repeats_tab, show_material_controls); + } + } + // Toggle visibility of labels LLUICtrl* texture_label = findChild<LLUICtrl>("detail_texture_text"); if (texture_label) { texture_label->setVisible(show_texture_controls); } @@ -1602,13 +1653,13 @@ void LLPanelRegionTerrainInfo::updateForMaterialType() // virtual bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region) { - BOOL owner_or_god = gAgent.isGodlike() + bool owner_or_god = gAgent.isGodlike() || (region && (region->getOwner() == gAgent.getID())); - BOOL owner_or_god_or_manager = owner_or_god + bool owner_or_god_or_manager = owner_or_god || (region && region->isEstateManager()); - setCtrlsEnabled(owner_or_god_or_manager); + setAllChildrenEnabled(owner_or_god_or_manager, true); - getChildView("apply_btn")->setEnabled(FALSE); + getChildView("apply_btn")->setEnabled(false); if (region) { @@ -1618,8 +1669,8 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region) static LLCachedControl<bool> feature_pbr_terrain_enabled(gSavedSettings, "RenderTerrainPBREnabled", false); - const bool textures_ready = compp->texturesReady(false, false); - const bool materials_ready = feature_pbr_terrain_enabled && compp->materialsReady(false, false); + const bool textures_ready = compp->makeTexturesReady(false, false); + const bool materials_ready = feature_pbr_terrain_enabled && compp->makeMaterialsReady(false, false); bool set_texture_swatches; bool set_material_swatches; @@ -1707,6 +1758,21 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region) } } + for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i) + { + if (!mMaterialScaleUCtrl[i] || !mMaterialScaleVCtrl[i] || !mMaterialRotationCtrl[i] || !mMaterialOffsetUCtrl[i] || !mMaterialOffsetVCtrl[i]) { continue; } + const LLGLTFMaterial* mat_override = compp->getMaterialOverride(i); + if (!mat_override) { mat_override = &LLGLTFMaterial::sDefault; } + + // Assume all texture transforms have the same value + const LLGLTFMaterial::TextureTransform& transform = mat_override->mTextureTransform[LLGLTFMaterial::GLTF_TEXTURE_INFO_BASE_COLOR]; + mMaterialScaleUCtrl[i]->setValue(transform.mScale.mV[VX]); + mMaterialScaleVCtrl[i]->setValue(transform.mScale.mV[VY]); + mMaterialRotationCtrl[i]->setValue(transform.mRotation * RAD_TO_DEG); + mMaterialOffsetUCtrl[i]->setValue(transform.mOffset.mV[VX]); + mMaterialOffsetVCtrl[i]->setValue(transform.mOffset.mV[VY]); + } + std::string buffer; for(S32 i = 0; i < CORNER_COUNT; ++i) { @@ -1734,20 +1800,27 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region) // virtual -BOOL LLPanelRegionTerrainInfo::sendUpdate() +bool LLPanelRegionTerrainInfo::sendUpdate() { - LL_INFOS() << "LLPanelRegionTerrainInfo::sendUpdate" << LL_ENDL; + LL_INFOS() << __FUNCTION__ << LL_ENDL; + + LLUICtrl* apply_btn = getChild<LLUICtrl>("apply_btn"); + if (apply_btn && !apply_btn->getEnabled()) + { + LL_WARNS() << "Duplicate update, ignored" << LL_ENDL; + return false; + } // Make sure user hasn't chosen wacky textures. if (!validateTextureSizes()) { - return FALSE; + return false; } // Prevent applying unsupported alpha blend/double-sided materials if (!validateMaterials()) { - return FALSE; + return false; } // Check if terrain Elevation Ranges are correct @@ -1757,11 +1830,11 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate() { LLNotificationsUtil::add("ConfirmTextureHeights", LLSD(), LLSD(), boost::bind(&LLPanelRegionTerrainInfo::callbackTextureHeights, this, _1, _2)); mAskedTextureHeights = true; - return FALSE; + return false; } else if (!mConfirmedTextureHeights) { - return FALSE; + return false; } } @@ -1837,7 +1910,52 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate() sendEstateOwnerMessage(msg, "texturecommit", invoice, strings); - return TRUE; + // ======================================== + // POST to ModifyRegion endpoint, if enabled + + static LLCachedControl<bool> feature_pbr_terrain_transforms_enabled(gSavedSettings, "RenderTerrainPBRTransformsEnabled", false); + if (material_type == LLTerrainMaterials::Type::PBR && feature_pbr_terrain_transforms_enabled) + { + LLTerrainMaterials composition; + for (S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i) + { + LLPointer<LLGLTFMaterial> mat_override = new LLGLTFMaterial(); + + const bool transform_controls_valid = mMaterialScaleUCtrl[i] && mMaterialScaleVCtrl[i] && mMaterialRotationCtrl[i] && mMaterialOffsetUCtrl[i] && mMaterialOffsetVCtrl[i]; + if (transform_controls_valid) + { + // Set texture transforms for all texture infos to the same value, + // because the PBR terrain shader doesn't currently support + // different transforms per texture info. See also + // LLDrawPoolTerrain::renderFullShaderPBR . + for (U32 tt = 0; tt < LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; ++tt) + { + LLGLTFMaterial::TextureTransform& transform = mat_override->mTextureTransform[tt]; + transform.mScale.mV[VX] = mMaterialScaleUCtrl[i]->getValue().asReal(); + transform.mScale.mV[VY] = mMaterialScaleVCtrl[i]->getValue().asReal(); + transform.mRotation = mMaterialRotationCtrl[i]->getValue().asReal() * DEG_TO_RAD; + transform.mOffset.mV[VX] = mMaterialOffsetUCtrl[i]->getValue().asReal(); + transform.mOffset.mV[VY] = mMaterialOffsetVCtrl[i]->getValue().asReal(); + } + } + + if (*mat_override == LLGLTFMaterial::sDefault) { mat_override = nullptr; } + composition.setMaterialOverride(i, mat_override.get()); + } + + // queueModify leads to a few messages being sent back and forth: + // viewer: POST ModifyRegion + // simulator: RegionHandshake + // viewer: GET ModifyRegion + LLViewerRegion* region = gAgent.getRegion(); + llassert(region); + if (region) + { + LLPBRTerrainFeatures::queueModify(*region, composition); + } + } + + return true; } bool LLPanelRegionTerrainInfo::callbackTextureHeights(const LLSD& notification, const LLSD& response) @@ -1853,7 +1971,7 @@ bool LLPanelRegionTerrainInfo::callbackTextureHeights(const LLSD& notification, } else if (option == 2) // don't ask { - gSavedSettings.setBOOL("RegionCheckTextureHeights", FALSE); + gSavedSettings.setBOOL("RegionCheckTextureHeights", false); mConfirmedTextureHeights = true; } @@ -1968,7 +2086,7 @@ void LLPanelEstateInfo::onClickKickUser() LLView * button = findChild<LLButton>("kick_user_from_estate_btn"); LLFloater* parent_floater = gFloaterView->getParentFloater(this); LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelEstateInfo::onKickUserCommit, this, _1), - FALSE, TRUE, FALSE, parent_floater->getName(), button); + false, true, false, parent_floater->getName(), button); if (child_floater) { parent_floater->addDependentFloater(child_floater); @@ -2109,13 +2227,13 @@ void LLPanelEstateInfo::updateEstateName(const std::string& name) void LLPanelEstateInfo::updateControls(LLViewerRegion* region) { - BOOL god = gAgent.isGodlike(); - BOOL owner = (region && (region->getOwner() == gAgent.getID())); - BOOL manager = (region && region->isEstateManager()); + bool god = gAgent.isGodlike(); + bool owner = (region && (region->getOwner() == gAgent.getID())); + bool manager = (region && region->isEstateManager()); setCtrlsEnabled(god || owner || manager); - getChildView("apply_btn")->setEnabled(FALSE); - getChildView("estate_owner")->setEnabled(TRUE); + getChildView("apply_btn")->setEnabled(false); + getChildView("estate_owner")->setEnabled(true); getChildView("message_estate_btn")->setEnabled(god || owner || manager); getChildView("kick_user_from_estate_btn")->setEnabled(god || owner || manager); @@ -2160,7 +2278,7 @@ bool LLPanelEstateInfo::estateUpdate(LLMessageSystem* msg) } -BOOL LLPanelEstateInfo::postBuild() +bool LLPanelEstateInfo::postBuild() { // set up the callbacks for the generic controls initCtrl("externally_visible_radio"); @@ -2176,7 +2294,7 @@ BOOL LLPanelEstateInfo::postBuild() getChild<LLUICtrl>("parcel_access_override")->setCommitCallback(boost::bind(&LLPanelEstateInfo::onChangeAccessOverride, this)); - getChild<LLUICtrl>("externally_visible_radio")->setFocus(TRUE); + getChild<LLUICtrl>("externally_visible_radio")->setFocus(true); getChild<LLTextBox>("estate_owner")->setIsFriendCallback(LLAvatarActions::isFriend); @@ -2194,7 +2312,7 @@ void LLPanelEstateInfo::refresh() getChildView("limit_bots")->setEnabled(public_access); // if this is set to false, then the limit fields are meaningless and should be turned off - if (public_access == false) + if (!public_access) { getChild<LLUICtrl>("limit_payment")->setValue(false); getChild<LLUICtrl>("limit_age_verified")->setValue(false); @@ -2222,7 +2340,7 @@ void LLPanelEstateInfo::refreshFromEstate() refresh(); } -BOOL LLPanelEstateInfo::sendUpdate() +bool LLPanelEstateInfo::sendUpdate() { LL_INFOS() << "LLPanelEsateInfo::sendUpdate()" << LL_ENDL; @@ -2239,7 +2357,7 @@ BOOL LLPanelEstateInfo::sendUpdate() // for normal estates, just make the change LLNotifications::instance().forceResponse(params, 0); } - return TRUE; + return true; } bool LLPanelEstateInfo::callbackChangeLindenEstate(const LLSD& notification, const LLSD& response) @@ -2426,7 +2544,7 @@ bool LLPanelEstateCovenant::estateUpdate(LLMessageSystem* msg) } // virtual -BOOL LLPanelEstateCovenant::postBuild() +bool LLPanelEstateCovenant::postBuild() { mEstateNameText = getChild<LLTextBox>("estate_name_text"); mEstateOwnerText = getChild<LLTextBox>("estate_owner_text"); @@ -2446,7 +2564,7 @@ void LLPanelEstateCovenant::updateChild(LLUICtrl* child_ctrl) } // virtual -BOOL LLPanelEstateCovenant::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +bool LLPanelEstateCovenant::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -2457,7 +2575,7 @@ BOOL LLPanelEstateCovenant::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop if (!gAgent.canManageEstate()) { *accept = ACCEPT_NO; - return TRUE; + return true; } switch(cargo_type) @@ -2477,7 +2595,7 @@ BOOL LLPanelEstateCovenant::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop break; } - return TRUE; + return true; } // static @@ -2526,7 +2644,7 @@ bool LLPanelEstateCovenant::confirmResetCovenantCallback(const LLSD& notificatio void LLPanelEstateCovenant::loadInvItem(LLInventoryItem *itemp) { - const BOOL high_priority = TRUE; + const bool high_priority = true; if (itemp) { gAssetStorage->getInvItemAsset(gAgent.getRegionHost(), @@ -2638,9 +2756,9 @@ void LLPanelEstateCovenant::sendChangeCovenantID(const LLUUID &asset_id) } // virtual -BOOL LLPanelEstateCovenant::sendUpdate() +bool LLPanelEstateCovenant::sendUpdate() { - return TRUE; + return true; } std::string LLPanelEstateCovenant::getEstateName() const @@ -2807,13 +2925,13 @@ bool LLDispatchSetEstateExperience::operator()( return true; } -BOOL LLPanelRegionExperiences::postBuild() +bool LLPanelRegionExperiences::postBuild() { mAllowed = setupList("panel_allowed", ESTATE_EXPERIENCE_ALLOWED_ADD, ESTATE_EXPERIENCE_ALLOWED_REMOVE); mTrusted = setupList("panel_trusted", ESTATE_EXPERIENCE_TRUSTED_ADD, ESTATE_EXPERIENCE_TRUSTED_REMOVE); mBlocked = setupList("panel_blocked", ESTATE_EXPERIENCE_BLOCKED_ADD, ESTATE_EXPERIENCE_BLOCKED_REMOVE); - getChild<LLLayoutPanel>("trusted_layout_panel")->setVisible(TRUE); + getChild<LLLayoutPanel>("trusted_layout_panel")->setVisible(true); getChild<LLTextBox>("experiences_help_text")->setText(getString("estate_caption")); getChild<LLTextBox>("trusted_text_help")->setText(getString("trusted_estate_text")); getChild<LLTextBox>("allowed_text_help")->setText(getString("allowed_estate_text")); @@ -2954,7 +3072,7 @@ std::string LLPanelRegionExperiences::regionCapabilityQuery(LLViewerRegion* regi bool LLPanelRegionExperiences::refreshFromRegion(LLViewerRegion* region) { - BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate()); + bool allow_modify = gAgent.isGodlike() || (region && region->canManageEstate()); mAllowed->loading(); mAllowed->setReadonly(!allow_modify); @@ -2993,7 +3111,7 @@ LLSD LLPanelRegionExperiences::addIds(LLPanelExperienceListEditor* panel) } -BOOL LLPanelRegionExperiences::sendUpdate() +bool LLPanelRegionExperiences::sendUpdate() { LLViewerRegion* region = gAgent.getRegion(); @@ -3006,7 +3124,7 @@ BOOL LLPanelRegionExperiences::sendUpdate() LLExperienceCache::instance().setRegionExperiences(boost::bind(&LLPanelRegionExperiences::regionCapabilityQuery, region, _1), content, boost::bind(&LLPanelRegionExperiences::infoCallback, getDerivedHandle<LLPanelRegionExperiences>(), _1)); - return TRUE; + return true; } void LLPanelRegionExperiences::itemChanged( U32 event_type, const LLUUID& id ) @@ -3071,13 +3189,13 @@ LLPanelEstateAccess::LLPanelEstateAccess() : LLPanelRegionInfo(), mPendingUpdate(false) {} -BOOL LLPanelEstateAccess::postBuild() +bool LLPanelEstateAccess::postBuild() { getChild<LLUICtrl>("allowed_avatar_name_list")->setCommitCallback(boost::bind(&LLPanelEstateInfo::onChangeChildCtrl, this, _1)); LLNameListCtrl *avatar_name_list = getChild<LLNameListCtrl>("allowed_avatar_name_list"); if (avatar_name_list) { - avatar_name_list->setCommitOnSelectionChange(TRUE); + avatar_name_list->setCommitOnSelectionChange(true); avatar_name_list->setMaxItemCount(ESTATE_MAX_ACCESS_IDS); } @@ -3090,7 +3208,7 @@ BOOL LLPanelEstateAccess::postBuild() LLNameListCtrl* group_name_list = getChild<LLNameListCtrl>("allowed_group_name_list"); if (group_name_list) { - group_name_list->setCommitOnSelectionChange(TRUE); + group_name_list->setCommitOnSelectionChange(true); group_name_list->setMaxItemCount(ESTATE_MAX_ACCESS_IDS); } @@ -3103,7 +3221,7 @@ BOOL LLPanelEstateAccess::postBuild() LLNameListCtrl* banned_name_list = getChild<LLNameListCtrl>("banned_avatar_name_list"); if (banned_name_list) { - banned_name_list->setCommitOnSelectionChange(TRUE); + banned_name_list->setCommitOnSelectionChange(true); banned_name_list->setMaxItemCount(ESTATE_MAX_BANNED_IDS); } @@ -3116,36 +3234,41 @@ BOOL LLPanelEstateAccess::postBuild() LLNameListCtrl* manager_name_list = getChild<LLNameListCtrl>("estate_manager_name_list"); if (manager_name_list) { - manager_name_list->setCommitOnSelectionChange(TRUE); + manager_name_list->setCommitOnSelectionChange(true); manager_name_list->setMaxItemCount(ESTATE_MAX_MANAGERS * 4); // Allow extras for dupe issue } childSetAction("add_estate_manager_btn", boost::bind(&LLPanelEstateAccess::onClickAddEstateManager, this)); childSetAction("remove_estate_manager_btn", boost::bind(&LLPanelEstateAccess::onClickRemoveEstateManager, this)); - return TRUE; + return true; } void LLPanelEstateAccess::updateControls(LLViewerRegion* region) { - BOOL god = gAgent.isGodlike(); - BOOL owner = (region && (region->getOwner() == gAgent.getID())); - BOOL manager = (region && region->isEstateManager()); - BOOL enable_cotrols = god || owner || manager; + bool god = gAgent.isGodlike(); + bool owner = (region && (region->getOwner() == gAgent.getID())); + bool manager = (region && region->isEstateManager()); + bool enable_cotrols = god || owner || manager; setCtrlsEnabled(enable_cotrols); - BOOL has_allowed_avatar = getChild<LLNameListCtrl>("allowed_avatar_name_list")->getFirstSelected() ? TRUE : FALSE; - BOOL has_allowed_group = getChild<LLNameListCtrl>("allowed_group_name_list")->getFirstSelected() ? TRUE : FALSE; - BOOL has_banned_agent = getChild<LLNameListCtrl>("banned_avatar_name_list")->getFirstSelected() ? TRUE : FALSE; - BOOL has_estate_manager = getChild<LLNameListCtrl>("estate_manager_name_list")->getFirstSelected() ? TRUE : FALSE; + LLNameListCtrl* allowedAvatars = getChild<LLNameListCtrl>("allowed_avatar_name_list"); + LLNameListCtrl* allowedGroups = getChild<LLNameListCtrl>("allowed_group_name_list"); + LLNameListCtrl* bannedAvatars = getChild<LLNameListCtrl>("banned_avatar_name_list"); + LLNameListCtrl* estateManagers = getChild<LLNameListCtrl>("estate_manager_name_list"); + + bool has_allowed_avatar = allowedAvatars->getFirstSelected(); + bool has_allowed_group = allowedGroups->getFirstSelected(); + bool has_banned_agent = bannedAvatars->getFirstSelected(); + bool has_estate_manager = estateManagers->getFirstSelected(); getChildView("add_allowed_avatar_btn")->setEnabled(enable_cotrols); getChildView("remove_allowed_avatar_btn")->setEnabled(has_allowed_avatar && enable_cotrols); - getChildView("allowed_avatar_name_list")->setEnabled(enable_cotrols); + allowedAvatars->setEnabled(enable_cotrols); getChildView("add_allowed_group_btn")->setEnabled(enable_cotrols); getChildView("remove_allowed_group_btn")->setEnabled(has_allowed_group && enable_cotrols); - getChildView("allowed_group_name_list")->setEnabled(enable_cotrols); + allowedGroups->setEnabled(enable_cotrols); // Can't ban people from mainland, orientation islands, etc. because this // creates much network traffic and server load. @@ -3154,12 +3277,12 @@ void LLPanelEstateAccess::updateControls(LLViewerRegion* region) bool enable_ban = enable_cotrols && !linden_estate; getChildView("add_banned_avatar_btn")->setEnabled(enable_ban); getChildView("remove_banned_avatar_btn")->setEnabled(has_banned_agent && enable_ban); - getChildView("banned_avatar_name_list")->setEnabled(enable_cotrols); + bannedAvatars->setEnabled(enable_cotrols); // estate managers can't add estate managers getChildView("add_estate_manager_btn")->setEnabled(god || owner); getChildView("remove_estate_manager_btn")->setEnabled(has_estate_manager && (god || owner)); - getChildView("estate_manager_name_list")->setEnabled(god || owner); + estateManagers->setEnabled(god || owner); if (enable_cotrols != mCtrlsEnabled) { @@ -3400,7 +3523,7 @@ bool LLPanelEstateAccess::accessAddCore2(const LLSD& notification, const LLSD& r // avatar picker yes multi-select, yes close-on-select LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelEstateAccess::accessAddCore3, _1, _2, (void*)change_info), - TRUE, TRUE, FALSE, parent_floater_name, button); + true, true, false, parent_floater_name, button); //Allows the closed parent floater to close the child floater (avatar picker) if (child_floater) @@ -3866,7 +3989,7 @@ void LLPanelEstateAccess::requestEstateGetAccessCoro(std::string url) LLUUID id = (*it)["id"].asUUID(); allowed_agent_name_list->addNameItem(id); } - allowed_agent_name_list->sortByName(TRUE); + allowed_agent_name_list->sortByName(true); } LLNameListCtrl* banned_agent_name_list = panel->getChild<LLNameListCtrl>("banned_avatar_name_list"); @@ -3909,7 +4032,7 @@ void LLPanelEstateAccess::requestEstateGetAccessCoro(std::string url) banned_agent_name_list->addElement(item); } - banned_agent_name_list->sortByName(TRUE); + banned_agent_name_list->sortByName(true); } LLNameListCtrl* allowed_group_name_list = panel->getChild<LLNameListCtrl>("allowed_group_name_list"); @@ -3928,7 +4051,7 @@ void LLPanelEstateAccess::requestEstateGetAccessCoro(std::string url) LLUUID id = (*it)["id"].asUUID(); allowed_group_name_list->addGroupNameItem(id); } - allowed_group_name_list->sortByName(TRUE); + allowed_group_name_list->sortByName(true); } LLNameListCtrl* estate_manager_name_list = panel->getChild<LLNameListCtrl>("estate_manager_name_list"); @@ -3947,7 +4070,7 @@ void LLPanelEstateAccess::requestEstateGetAccessCoro(std::string url) LLUUID id = (*it)["agent_id"].asUUID(); estate_manager_name_list->addNameItem(id); } - estate_manager_name_list->sortByName(TRUE); + estate_manager_name_list->sortByName(true); } @@ -3992,7 +4115,7 @@ void LLPanelEstateAccess::searchAgent(LLNameListCtrl* listCtrl, const std::strin } else { - listCtrl->deselectAllItems(TRUE); + listCtrl->deselectAllItems(true); } } @@ -4022,7 +4145,7 @@ void LLPanelEstateAccess::copyListToClipboard(std::string list_name) } } - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(list_to_copy), 0, list_to_copy.length()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(list_to_copy), 0, static_cast<S32>(list_to_copy.length())); } bool LLPanelEstateAccess::refreshFromRegion(LLViewerRegion* region) @@ -4046,21 +4169,21 @@ LLPanelRegionEnvironment::~LLPanelRegionEnvironment() mCommitConnect.disconnect(); } -BOOL LLPanelRegionEnvironment::postBuild() +bool LLPanelRegionEnvironment::postBuild() { LLEstateInfoModel& estate_info = LLEstateInfoModel::instance(); if (!LLPanelEnvironmentInfo::postBuild()) - return FALSE; + return false; getChild<LLUICtrl>(BTN_USEDEFAULT)->setLabelArg("[USEDEFAULT]", getString(STR_LABEL_USEDEFAULT)); - getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setVisible(TRUE); - getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES)->setVisible(TRUE); + getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setVisible(true); + getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES)->setVisible(true); getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setCommitCallback([this](LLUICtrl *, const LLSD &value){ onChkAllowOverride(value.asBoolean()); }); mCommitConnect = estate_info.setCommitCallback(boost::bind(&LLPanelRegionEnvironment::refreshFromEstate, this)); - return TRUE; + return true; } diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index c96e11b5be..5623bc20cb 100644 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -79,12 +79,13 @@ public: void onOpen(const LLSD& key) override; void onClose(bool app_quitting) override; - BOOL postBuild() override; + bool postBuild() override; static void processEstateOwnerRequest(LLMessageSystem* msg, void**); // get and process region info if necessary. static void processRegionInfo(LLMessageSystem* msg); + static void sRefreshFromRegion(LLViewerRegion* region); static const LLUUID& getLastInvoice() { return sRequestInvoice; } static void nextInvoice() { sRequestInvoice.generate(); } @@ -146,20 +147,21 @@ public: virtual bool refreshFromRegion(LLViewerRegion* region); virtual bool estateUpdate(LLMessageSystem* msg) { return true; } - BOOL postBuild() override; + bool postBuild() override; virtual void updateChild(LLUICtrl* child_ctrl); - void enableButton(const std::string& btn_name, BOOL enable = TRUE); + void enableButton(const std::string& btn_name, bool enable = true); void disableButton(const std::string& btn_name); void onClickManageTelehub(); protected: void initCtrl(const std::string& name); + template<typename CTRL> void initAndSetCtrl(CTRL*& ctrl, const std::string& name); - // Returns TRUE if update sent and apply button should be + // Returns true if update sent and apply button should be // disabled. - virtual BOOL sendUpdate() { return TRUE; } + virtual bool sendUpdate() { return true; } typedef std::vector<std::string> strings_t; //typedef std::vector<U32> integers_t; @@ -188,13 +190,13 @@ public: bool refreshFromRegion(LLViewerRegion* region) override; - BOOL postBuild() override; + bool postBuild() override; void onBtnSet(); void setObjBonusFactor(F32 object_bonus_factor) {mObjBonusFactor = object_bonus_factor;} protected: - BOOL sendUpdate() override; + bool sendUpdate() override; void onClickKick(); void onKickCommit(const uuid_vec_t& ids); static void onClickKickAll(void* userdata); @@ -216,12 +218,12 @@ public: : LLPanelRegionInfo(), mTargetAvatar() {} ~LLPanelRegionDebugInfo() {} - BOOL postBuild() override; + bool postBuild() override; bool refreshFromRegion(LLViewerRegion* region) override; protected: - BOOL sendUpdate() override; + bool sendUpdate() override; void onClickChooseAvatar(); void callbackAvatarID(const uuid_vec_t& ids, const std::vector<LLAvatarName> names); @@ -248,14 +250,14 @@ public: LLPanelRegionTerrainInfo(); ~LLPanelRegionTerrainInfo() {} - BOOL postBuild() override; + bool postBuild() override; bool refreshFromRegion(LLViewerRegion* region) override; // refresh local settings from region update from simulator void setEnvControls(bool available); // Whether environment settings are available for this region bool validateTextureSizes(); bool validateMaterials(); - BOOL validateTextureHeights(); + bool validateTextureHeights(); //static void onChangeAnything(LLUICtrl* ctrl, void* userData); // callback for any change, to enable commit button @@ -269,7 +271,7 @@ public: bool callbackTextureHeights(const LLSD& notification, const LLSD& response); protected: - BOOL sendUpdate() override; + bool sendUpdate() override; private: bool mConfirmedTextureHeights; @@ -277,8 +279,15 @@ private: LLCheckBoxCtrl* mMaterialTypeCtrl = nullptr; LLTextureCtrl* mTextureDetailCtrl[LLTerrainMaterials::ASSET_COUNT]; LLTextureCtrl* mMaterialDetailCtrl[LLTerrainMaterials::ASSET_COUNT]; + LLUUID mLastSetTextures[LLTerrainMaterials::ASSET_COUNT]; LLUUID mLastSetMaterials[LLTerrainMaterials::ASSET_COUNT]; + + LLSpinCtrl* mMaterialScaleUCtrl[LLTerrainMaterials::ASSET_COUNT]; + LLSpinCtrl* mMaterialScaleVCtrl[LLTerrainMaterials::ASSET_COUNT]; + LLSpinCtrl* mMaterialRotationCtrl[LLTerrainMaterials::ASSET_COUNT]; + LLSpinCtrl* mMaterialOffsetUCtrl[LLTerrainMaterials::ASSET_COUNT]; + LLSpinCtrl* mMaterialOffsetVCtrl[LLTerrainMaterials::ASSET_COUNT]; }; ///////////////////////////////////////////////////////////////////////////// @@ -317,7 +326,7 @@ public: bool refreshFromRegion(LLViewerRegion* region) override; bool estateUpdate(LLMessageSystem* msg) override; - BOOL postBuild() override; + bool postBuild() override; void updateChild(LLUICtrl* child_ctrl) override; void refresh() override; @@ -329,14 +338,14 @@ public: void setOwnerName(const std::string& name); protected: - BOOL sendUpdate() override; + bool sendUpdate() override; // confirmation dialog callback bool callbackChangeLindenEstate(const LLSD& notification, const LLSD& response); void commitEstateAccess(); void commitEstateManagers(); - BOOL checkSunHourSlider(LLUICtrl* child_ctrl); + bool checkSunHourSlider(LLUICtrl* child_ctrl); U32 mEstateID; }; @@ -349,14 +358,14 @@ public: LLPanelEstateCovenant(); ~LLPanelEstateCovenant() {} - BOOL postBuild() override; + bool postBuild() override; void updateChild(LLUICtrl* child_ctrl) override; bool refreshFromRegion(LLViewerRegion* region) override; bool estateUpdate(LLMessageSystem* msg) override; // LLView overrides - BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, - BOOL drop, EDragAndDropType cargo_type, + bool handleDragAndDrop(S32 x, S32 y, MASK mask, + bool drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg) override; static bool confirmChangeCovenantCallback(const LLSD& notification, const LLSD& response); @@ -391,7 +400,7 @@ public: } EAssetStatus; protected: - BOOL sendUpdate() override; + bool sendUpdate() override; LLTextBox* mEstateNameText; LLTextBox* mEstateOwnerText; LLTextBox* mLastModifiedText; @@ -410,7 +419,7 @@ class LLPanelRegionExperiences : public LLPanelRegionInfo public: LLPanelRegionExperiences(){} - BOOL postBuild() override; + bool postBuild() override; static bool experienceCoreConfirm(const LLSD& notification, const LLSD& response); static void sendEstateExperienceDelta(U32 flags, const LLUUID& agent_id); @@ -421,7 +430,7 @@ public: void processResponse( const LLSD& content ); protected: - BOOL sendUpdate() override; + bool sendUpdate() override; private: void refreshRegionExperiences(); @@ -447,7 +456,7 @@ class LLPanelEstateAccess : public LLPanelRegionInfo public: LLPanelEstateAccess(); - BOOL postBuild() override; + bool postBuild() override; void updateChild(LLUICtrl* child_ctrl) override; void updateControls(LLViewerRegion* region); @@ -498,7 +507,7 @@ private: void copyListToClipboard(std::string list_name); bool mPendingUpdate; - BOOL mCtrlsEnabled; + bool mCtrlsEnabled; }; #endif diff --git a/indra/newview/llfloaterregionrestarting.cpp b/indra/newview/llfloaterregionrestarting.cpp index 1df2825fe0..6b795e5bc5 100644 --- a/indra/newview/llfloaterregionrestarting.cpp +++ b/indra/newview/llfloaterregionrestarting.cpp @@ -50,7 +50,7 @@ LLFloaterRegionRestarting::~LLFloaterRegionRestarting() mRegionChangedConnection.disconnect(); } -BOOL LLFloaterRegionRestarting::postBuild() +bool LLFloaterRegionRestarting::postBuild() { mRegionChangedConnection = gAgent.addRegionChangedCallback(boost::bind(&LLFloaterRegionRestarting::regionChange, this)); @@ -66,7 +66,7 @@ BOOL LLFloaterRegionRestarting::postBuild() refresh(); - return TRUE; + return true; } void LLFloaterRegionRestarting::regionChange() @@ -74,11 +74,11 @@ void LLFloaterRegionRestarting::regionChange() close(); } -BOOL LLFloaterRegionRestarting::tick() +bool LLFloaterRegionRestarting::tick() { refresh(); - return FALSE; + return false; } void LLFloaterRegionRestarting::refresh() diff --git a/indra/newview/llfloaterregionrestarting.h b/indra/newview/llfloaterregionrestarting.h index ab080073e7..ee836dd00d 100644 --- a/indra/newview/llfloaterregionrestarting.h +++ b/indra/newview/llfloaterregionrestarting.h @@ -42,8 +42,8 @@ public: private: LLFloaterRegionRestarting(const LLSD& key); virtual ~LLFloaterRegionRestarting(); - virtual BOOL postBuild(); - virtual BOOL tick(); + virtual bool postBuild(); + virtual bool tick(); virtual void refresh(); virtual void draw(); virtual void regionChange(); diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index bcfe422d7a..e2c6305f4f 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -151,10 +151,10 @@ LLFloaterReporter::LLFloaterReporter(const LLSD& key) mScreenID(), mAbuserID(), mOwnerName(), - mDeselectOnClose( FALSE ), - mPicking( FALSE), + mDeselectOnClose( false ), + mPicking( false), mPosition(), - mCopyrightWarningSeen( FALSE ), + mCopyrightWarningSeen( false ), mResourceDatap(new LLResourceData()), mAvatarNameCacheConnection() { @@ -162,13 +162,13 @@ LLFloaterReporter::LLFloaterReporter(const LLSD& key) } // virtual -BOOL LLFloaterReporter::postBuild() +bool LLFloaterReporter::postBuild() { LLSLURL slurl; LLAgentUI::buildSLURL(slurl); getChild<LLUICtrl>("abuse_location_edit")->setValue(slurl.getSLURLString()); - enableControls(TRUE); + enableControls(true); // convert the position to a string LLVector3d pos = gAgent.getPositionGlobal(); @@ -185,7 +185,7 @@ BOOL LLFloaterReporter::postBuild() getChild<LLUICtrl>("owner_name")->setValue(LLStringUtil::null); mOwnerName = LLStringUtil::null; - getChild<LLUICtrl>("summary_edit")->setFocus(TRUE); + getChild<LLUICtrl>("summary_edit")->setFocus(true); mDefaultSummary = getChild<LLUICtrl>("details_edit")->getValue().asString(); @@ -229,7 +229,7 @@ BOOL LLFloaterReporter::postBuild() center(); - return TRUE; + return true; } // virtual @@ -268,11 +268,11 @@ void LLFloaterReporter::onIdle(void* user_data) } } -void LLFloaterReporter::enableControls(BOOL enable) +void LLFloaterReporter::enableControls(bool enable) { getChildView("category_combo")->setEnabled(enable); getChildView("chat_check")->setEnabled(enable); - getChildView("screenshot")->setEnabled(FALSE); + getChildView("screenshot")->setEnabled(false); getChildView("pick_btn")->setEnabled(enable); getChildView("summary_edit")->setEnabled(enable); getChildView("details_edit")->setEnabled(enable); @@ -365,10 +365,10 @@ void LLFloaterReporter::getObjectInfo(const LLUUID& object_id) void LLFloaterReporter::onClickSelectAbuser() { - LLView * button = findChild<LLButton>("select_abuser", TRUE); + LLView * button = findChild<LLButton>("select_abuser", true); LLFloater * root_floater = gFloaterView->getParentFloater(this); - LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLFloaterReporter::callbackAvatarID, this, _1, _2), FALSE, TRUE, FALSE, root_floater->getName(), button); + LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLFloaterReporter::callbackAvatarID, this, _1, _2), false, true, false, root_floater->getName(), button); if (picker) { root_floater->addDependentFloater(picker); @@ -504,7 +504,7 @@ void LLFloaterReporter::onClickSend(void *userdata) category_value == IP_PERMISSONS_EXPLOIT) { LLNotificationsUtil::add("HelpReportAbuseContainsCopyright"); - self->mCopyrightWarningSeen = TRUE; + self->mCopyrightWarningSeen = true; return; } } @@ -528,8 +528,8 @@ void LLFloaterReporter::onClickSend(void *userdata) } else { - self->getChildView("send_btn")->setEnabled(FALSE); - self->getChildView("cancel_btn")->setEnabled(FALSE); + self->getChildView("send_btn")->setEnabled(false); + self->getChildView("cancel_btn")->setEnabled(false); // the callback from uploading the image calls sendReportViaLegacy() self->uploadImage(); } @@ -543,7 +543,7 @@ void LLFloaterReporter::onClickCancel(void *userdata) LLFloaterReporter *self = (LLFloaterReporter *)userdata; // reset flag in case the next report also contains this text - self->mCopyrightWarningSeen = FALSE; + self->mCopyrightWarningSeen = false; if (self->mPicking) { @@ -559,12 +559,12 @@ void LLFloaterReporter::onClickObjPicker(void *userdata) LLFloaterReporter *self = (LLFloaterReporter *)userdata; LLToolObjPicker::getInstance()->setExitCallback(LLFloaterReporter::closePickTool, self); LLToolMgr::getInstance()->setTransientTool(LLToolObjPicker::getInstance()); - self->mPicking = TRUE; + self->mPicking = true; self->getChild<LLUICtrl>("object_name")->setValue(LLStringUtil::null); self->getChild<LLUICtrl>("owner_name")->setValue(LLStringUtil::null); self->mOwnerName = LLStringUtil::null; LLButton* pick_btn = self->getChild<LLButton>("pick_btn"); - if (pick_btn) pick_btn->setToggleState(TRUE); + if (pick_btn) pick_btn->setToggleState(true); } @@ -577,9 +577,9 @@ void LLFloaterReporter::closePickTool(void *userdata) self->getObjectInfo(object_id); LLToolMgr::getInstance()->clearTransientTool(); - self->mPicking = FALSE; + self->mPicking = false; LLButton* pick_btn = self->getChild<LLButton>("pick_btn"); - if (pick_btn) pick_btn->setToggleState(FALSE); + if (pick_btn) pick_btn->setToggleState(false); } @@ -594,7 +594,7 @@ void LLFloaterReporter::showFromMenu(EReportType report_type) LLFloaterReporter* reporter_floater = LLFloaterReg::findTypedInstance<LLFloaterReporter>("reporter"); if(reporter_floater && reporter_floater->isInVisibleChain()) { - gSavedPerAccountSettings.setBOOL("PreviousScreenshotForReport", FALSE); + gSavedPerAccountSettings.setBOOL("PreviousScreenshotForReport", false); } reporter_floater = LLFloaterReg::showTypedInstance<LLFloaterReporter>("reporter", LLSD()); if (reporter_floater) @@ -609,7 +609,7 @@ void LLFloaterReporter::show(const LLUUID& object_id, const std::string& avatar_ LLFloaterReporter* reporter_floater = LLFloaterReg::findTypedInstance<LLFloaterReporter>("reporter"); if(reporter_floater && reporter_floater->isInVisibleChain()) { - gSavedPerAccountSettings.setBOOL("PreviousScreenshotForReport", FALSE); + gSavedPerAccountSettings.setBOOL("PreviousScreenshotForReport", false); } reporter_floater = LLFloaterReg::showTypedInstance<LLFloaterReporter>("reporter"); if (avatar_name.empty()) @@ -627,7 +627,7 @@ void LLFloaterReporter::show(const LLUUID& object_id, const std::string& avatar_ } // Need to deselect on close - reporter_floater->mDeselectOnClose = TRUE; + reporter_floater->mDeselectOnClose = true; } @@ -637,13 +637,13 @@ void LLFloaterReporter::showFromExperience( const LLUUID& experience_id ) LLFloaterReporter* reporter_floater = LLFloaterReg::findTypedInstance<LLFloaterReporter>("reporter"); if(reporter_floater && reporter_floater->isInVisibleChain()) { - gSavedPerAccountSettings.setBOOL("PreviousScreenshotForReport", FALSE); + gSavedPerAccountSettings.setBOOL("PreviousScreenshotForReport", false); } reporter_floater = LLFloaterReg::showTypedInstance<LLFloaterReporter>("reporter"); reporter_floater->getExperienceInfo(experience_id); // Need to deselect on close - reporter_floater->mDeselectOnClose = TRUE; + reporter_floater->mDeselectOnClose = true; } @@ -739,7 +739,7 @@ LLSD LLFloaterReporter::gatherReport() if (!regionp) return LLSD(); // *TODO handle this failure case more gracefully // reset flag in case the next report also contains this text - mCopyrightWarningSeen = FALSE; + mCopyrightWarningSeen = false; std::ostringstream summary; if (!LLGridManager::getInstance()->isInProductionGrid()) @@ -873,7 +873,7 @@ void LLFloaterReporter::sendReportViaCaps(std::string url, std::string sshot_url void LLFloaterReporter::takeScreenshot(bool use_prev_screenshot) { - gSavedPerAccountSettings.setBOOL("PreviousScreenshotForReport", TRUE); + gSavedPerAccountSettings.setBOOL("PreviousScreenshotForReport", true); if(!use_prev_screenshot) { std::string screenshot_filename(gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter() + SCREEN_PREV_FILENAME); @@ -917,7 +917,7 @@ void LLFloaterReporter::takeScreenshot(bool use_prev_screenshot) // store in the image list so it doesn't try to fetch from the server LLPointer<LLViewerFetchedTexture> image_in_list = LLViewerTextureManager::getFetchedTexture(mResourceDatap->mAssetInfo.mUuid); - image_in_list->createGLTexture(0, mImageRaw, 0, TRUE, LLGLTexture::OTHER); + image_in_list->createGLTexture(0, mImageRaw, 0, true, LLGLTexture::OTHER); // the texture picker then uses that texture LLTextureCtrl* texture = getChild<LLTextureCtrl>("screenshot"); @@ -937,14 +937,14 @@ void LLFloaterReporter::takeNewSnapshot() const S32 IMAGE_HEIGHT = 768; // Take a screenshot, but don't draw this floater. - setVisible(FALSE); - if (!gViewerWindow->rawSnapshot(mImageRaw,IMAGE_WIDTH, IMAGE_HEIGHT, TRUE, FALSE, TRUE /*UI*/, TRUE, FALSE)) + setVisible(false); + if (!gViewerWindow->rawSnapshot(mImageRaw,IMAGE_WIDTH, IMAGE_HEIGHT, true, false, true /*UI*/, true, false)) { LL_WARNS() << "Unable to take screenshot" << LL_ENDL; - setVisible(TRUE); + setVisible(true); return; } - setVisible(TRUE); + setVisible(true); if(gSavedPerAccountSettings.getBOOL("PreviousScreenshotForReport")) { @@ -988,7 +988,7 @@ void LLFloaterReporter::uploadImage() gAssetStorage->storeAssetData(mResourceDatap->mAssetInfo.mTransactionID, mResourceDatap->mAssetInfo.mType, LLFloaterReporter::uploadDoneCallback, - (void*)mResourceDatap, TRUE); + (void*)mResourceDatap, true); } diff --git a/indra/newview/llfloaterreporter.h b/indra/newview/llfloaterreporter.h index f10fcc8a0c..31b05235a6 100644 --- a/indra/newview/llfloaterreporter.h +++ b/indra/newview/llfloaterreporter.h @@ -80,7 +80,7 @@ class LLFloaterReporter public: LLFloaterReporter(const LLSD& key); /*virtual*/ ~LLFloaterReporter(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void onClose(bool app_quitting); @@ -119,7 +119,7 @@ private: void sendReportViaLegacy(const LLSD & report); void sendReportViaCaps(std::string url, std::string sshot_url, const LLSD & report); void setPosBox(const LLVector3d &pos); - void enableControls(BOOL own_avatar); + void enableControls(bool own_avatar); void getExperienceInfo(const LLUUID& object_id); void getObjectInfo(const LLUUID& object_id); void callbackAvatarID(const uuid_vec_t& ids, const std::vector<LLAvatarName> names); @@ -137,10 +137,10 @@ private: LLUUID mExperienceID; // Store the real name, not the link, for upstream reporting std::string mOwnerName; - BOOL mDeselectOnClose; - BOOL mPicking; + bool mDeselectOnClose; + bool mPicking; LLVector3 mPosition; - BOOL mCopyrightWarningSeen; + bool mCopyrightWarningSeen; std::string mDefaultSummary; LLResourceData* mResourceDatap; boost::signals2::connection mAvatarNameCacheConnection; diff --git a/indra/newview/llfloatersavecamerapreset.cpp b/indra/newview/llfloatersavecamerapreset.cpp index 0224d8652e..53c5e6ce31 100644 --- a/indra/newview/llfloatersavecamerapreset.cpp +++ b/indra/newview/llfloatersavecamerapreset.cpp @@ -47,7 +47,7 @@ LLFloaterSaveCameraPreset::LLFloaterSaveCameraPreset(const LLSD &key) } // virtual -BOOL LLFloaterSaveCameraPreset::postBuild() +bool LLFloaterSaveCameraPreset::postBuild() { mPresetCombo = getChild<LLComboBox>("preset_combo"); @@ -64,7 +64,7 @@ BOOL LLFloaterSaveCameraPreset::postBuild() LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterSaveCameraPreset::onPresetsListChange, this)); - return TRUE; + return true; } void LLFloaterSaveCameraPreset::onPresetNameEdited() @@ -113,7 +113,7 @@ void LLFloaterSaveCameraPreset::onBtnSave() gSavedSettings.setVector3("CameraOffsetRearView", gAgentCamera.getCurrentCameraOffset()); gSavedSettings.setVector3d("FocusOffsetRearView", gAgentCamera.getCurrentFocusOffset()); gAgentCamera.resetCameraZoomFraction(); - gAgentCamera.setFocusOnAvatar(TRUE, TRUE, FALSE); + gAgentCamera.setFocusOnAvatar(true, true, false); } else { diff --git a/indra/newview/llfloatersavecamerapreset.h b/indra/newview/llfloatersavecamerapreset.h index b90b406d1f..b37713a81a 100644 --- a/indra/newview/llfloatersavecamerapreset.h +++ b/indra/newview/llfloatersavecamerapreset.h @@ -40,8 +40,8 @@ class LLFloaterSaveCameraPreset : public LLModalDialog public: LLFloaterSaveCameraPreset(const LLSD &key); - /*virtual*/ BOOL postBuild(); - /*virtual*/ void onOpen(const LLSD& key); + bool postBuild() override; + void onOpen(const LLSD& key) override; void onBtnSave(); void onBtnCancel(); diff --git a/indra/newview/llfloatersaveprefpreset.cpp b/indra/newview/llfloatersaveprefpreset.cpp index f70dc04d14..170f74abd3 100644 --- a/indra/newview/llfloatersaveprefpreset.cpp +++ b/indra/newview/llfloatersaveprefpreset.cpp @@ -42,7 +42,7 @@ LLFloaterSavePrefPreset::LLFloaterSavePrefPreset(const LLSD &key) } // virtual -BOOL LLFloaterSavePrefPreset::postBuild() +bool LLFloaterSavePrefPreset::postBuild() { LLFloaterPreference* preferences = LLFloaterReg::getTypedInstance<LLFloaterPreference>("preferences"); if (preferences) @@ -61,7 +61,7 @@ BOOL LLFloaterSavePrefPreset::postBuild() mSaveButton = getChild<LLButton>("save"); mPresetCombo = getChild<LLComboBox>("preset_combo"); - return TRUE; + return true; } void LLFloaterSavePrefPreset::onPresetNameEdited() diff --git a/indra/newview/llfloatersaveprefpreset.h b/indra/newview/llfloatersaveprefpreset.h index c6bfbd37ba..db48749e38 100644 --- a/indra/newview/llfloatersaveprefpreset.h +++ b/indra/newview/llfloatersaveprefpreset.h @@ -38,8 +38,8 @@ class LLFloaterSavePrefPreset : public LLFloater public: LLFloaterSavePrefPreset(const LLSD &key); - /*virtual*/ BOOL postBuild(); - /*virtual*/ void onOpen(const LLSD& key); + bool postBuild() override; + void onOpen(const LLSD& key) override; void onBtnSave(); void onBtnCancel(); diff --git a/indra/newview/llfloatersceneloadstats.cpp b/indra/newview/llfloatersceneloadstats.cpp index 99b098e205..58b32bde9b 100644 --- a/indra/newview/llfloatersceneloadstats.cpp +++ b/indra/newview/llfloatersceneloadstats.cpp @@ -34,7 +34,7 @@ LLFloaterSceneLoadStats::LLFloaterSceneLoadStats( const LLSD& key ) : LLFloater(key) {} -BOOL LLFloaterSceneLoadStats::postBuild() +bool LLFloaterSceneLoadStats::postBuild() { - return TRUE; + return true; } diff --git a/indra/newview/llfloatersceneloadstats.h b/indra/newview/llfloatersceneloadstats.h index f6b99d7dab..1522e54137 100644 --- a/indra/newview/llfloatersceneloadstats.h +++ b/indra/newview/llfloatersceneloadstats.h @@ -36,7 +36,7 @@ private: LLFloaterSceneLoadStats(const LLSD& key); public: - BOOL postBuild(); + bool postBuild() override; }; diff --git a/indra/newview/llfloaterscriptdebug.cpp b/indra/newview/llfloaterscriptdebug.cpp index 8331e034c0..49cb5d34ff 100644 --- a/indra/newview/llfloaterscriptdebug.cpp +++ b/indra/newview/llfloaterscriptdebug.cpp @@ -55,9 +55,9 @@ LLFloaterScriptDebug::LLFloaterScriptDebug(const LLSD& key) { // avoid resizing of the window to match // the initial size of the tabbed-childs, whenever a tab is opened or closed - mAutoResize = FALSE; + mAutoResize = false; // enabled autocous blocks controling focus via LLFloaterReg::showInstance - setAutoFocus(FALSE); + setAutoFocus(false); } LLFloaterScriptDebug::~LLFloaterScriptDebug() @@ -69,26 +69,26 @@ void LLFloaterScriptDebug::show(const LLUUID& object_id) addOutputWindow(object_id); } -BOOL LLFloaterScriptDebug::postBuild() +bool LLFloaterScriptDebug::postBuild() { LLMultiFloater::postBuild(); if (mTabContainer) { - return TRUE; + return true; } - return FALSE; + return false; } -void LLFloaterScriptDebug::setVisible(BOOL visible) +void LLFloaterScriptDebug::setVisible(bool visible) { if(visible) { LLFloaterScriptDebugOutput* floater_output = LLFloaterReg::findTypedInstance<LLFloaterScriptDebugOutput>("script_debug_output", LLUUID::null); if (floater_output == NULL) { - floater_output = dynamic_cast<LLFloaterScriptDebugOutput*>(LLFloaterReg::showInstance("script_debug_output", LLUUID::null, FALSE)); + floater_output = dynamic_cast<LLFloaterScriptDebugOutput*>(LLFloaterReg::showInstance("script_debug_output", LLUUID::null, false)); if (floater_output) { addFloater(floater_output, false); @@ -119,7 +119,7 @@ LLFloater* LLFloaterScriptDebug::addOutputWindow(const LLUUID &object_id) LLFloater::setFloaterHost(host); // prevent stealing focus, see EXT-8040 - LLFloater* floaterp = LLFloaterReg::showInstance("script_debug_output", object_id, FALSE); + LLFloater* floaterp = LLFloaterReg::showInstance("script_debug_output", object_id, false); LLFloater::setFloaterHost(NULL); return floaterp; @@ -140,12 +140,12 @@ void LLFloaterScriptDebug::addScriptLine(const std::string &utf8mesg, const std: { if (isAgentAvatarValid()) { - ((LLViewerObject*)gAgentAvatarp)->setIcon(LLViewerTextureManager::getFetchedTextureFromFile("script_error.j2c", FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_UI)); + ((LLViewerObject*)gAgentAvatarp)->setIcon(LLViewerTextureManager::getFetchedTextureFromFile("script_error.j2c", FTT_LOCAL_FILE, true, LLGLTexture::BOOST_UI)); } } else { - objectp->setIcon(LLViewerTextureManager::getFetchedTextureFromFile("script_error.j2c", FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_UI)); + objectp->setIcon(LLViewerTextureManager::getFetchedTextureFromFile("script_error.j2c", FTT_LOCAL_FILE, true, LLGLTexture::BOOST_UI)); } floater_label = llformat("%s(%.0f, %.0f, %.0f)", user_name.c_str(), @@ -184,14 +184,14 @@ LLFloaterScriptDebugOutput::LLFloaterScriptDebugOutput(const LLSD& object_id) mObjectID(object_id.asUUID()) { // enabled autocous blocks controling focus via LLFloaterReg::showInstance - setAutoFocus(FALSE); + setAutoFocus(false); } -BOOL LLFloaterScriptDebugOutput::postBuild() +bool LLFloaterScriptDebugOutput::postBuild() { LLFloater::postBuild(); mHistoryEditor = getChild<LLViewerTextEditor>("Chat History Editor"); - return TRUE; + return true; } LLFloaterScriptDebugOutput::~LLFloaterScriptDebugOutput() @@ -202,8 +202,8 @@ void LLFloaterScriptDebugOutput::addLine(const std::string &utf8mesg, const std: { if (mObjectID.isNull()) { - setCanTearOff(FALSE); - setCanClose(FALSE); + setCanTearOff(false); + setCanClose(false); } else { diff --git a/indra/newview/llfloaterscriptdebug.h b/indra/newview/llfloaterscriptdebug.h index 9a5ccecb8c..972202257b 100644 --- a/indra/newview/llfloaterscriptdebug.h +++ b/indra/newview/llfloaterscriptdebug.h @@ -37,8 +37,8 @@ class LLFloaterScriptDebug : public LLMultiFloater public: LLFloaterScriptDebug(const LLSD& key); virtual ~LLFloaterScriptDebug(); - virtual BOOL postBuild(); - virtual void setVisible(BOOL visible); + virtual bool postBuild(); + virtual void setVisible(bool visible); static void show(const LLUUID& object_id); /*virtual*/ void closeFloater(bool app_quitting = false); @@ -59,7 +59,7 @@ public: void addLine(const std::string &utf8mesg, const std::string &user_name, const LLColor4& color); - virtual BOOL postBuild(); + virtual bool postBuild(); protected: LLTextEditor* mHistoryEditor; diff --git a/indra/newview/llfloaterscriptedprefs.cpp b/indra/newview/llfloaterscriptedprefs.cpp index 89c5d3617c..a38c4b51f2 100644 --- a/indra/newview/llfloaterscriptedprefs.cpp +++ b/indra/newview/llfloaterscriptedprefs.cpp @@ -40,7 +40,7 @@ LLFloaterScriptEdPrefs::LLFloaterScriptEdPrefs(const LLSD& key) mCommitCallbackRegistrar.add("ScriptPref.getUIColor", boost::bind(&LLFloaterScriptEdPrefs::getUIColor, this ,_1, _2)); } -BOOL LLFloaterScriptEdPrefs::postBuild() +bool LLFloaterScriptEdPrefs::postBuild() { mEditor = getChild<LLScriptEditor>("Script Preview"); if (mEditor) @@ -48,7 +48,7 @@ BOOL LLFloaterScriptEdPrefs::postBuild() mEditor->initKeywords(); mEditor->loadKeywords(); } - return TRUE; + return true; } void LLFloaterScriptEdPrefs::applyUIColor(LLUICtrl* ctrl, const LLSD& param) diff --git a/indra/newview/llfloaterscriptedprefs.h b/indra/newview/llfloaterscriptedprefs.h index 135c5bb6c7..6654832a6d 100644 --- a/indra/newview/llfloaterscriptedprefs.h +++ b/indra/newview/llfloaterscriptedprefs.h @@ -37,7 +37,7 @@ class LLFloaterScriptEdPrefs : public LLFloater { public: LLFloaterScriptEdPrefs(const LLSD& key); - BOOL postBuild(); + bool postBuild() override; private: ~LLFloaterScriptEdPrefs() {}; diff --git a/indra/newview/llfloaterscriptlimits.cpp b/indra/newview/llfloaterscriptlimits.cpp index 8f3260ca3e..b3452a25c5 100644 --- a/indra/newview/llfloaterscriptlimits.cpp +++ b/indra/newview/llfloaterscriptlimits.cpp @@ -88,14 +88,14 @@ LLFloaterScriptLimits::LLFloaterScriptLimits(const LLSD& seed) { } -BOOL LLFloaterScriptLimits::postBuild() +bool LLFloaterScriptLimits::postBuild() { mTab = getChild<LLTabContainer>("scriptlimits_panels"); if(!mTab) { LL_WARNS() << "Error! couldn't get scriptlimits_panels, aborting Script Information setup" << LL_ENDL; - return FALSE; + return false; } // contruct the panel @@ -104,7 +104,7 @@ BOOL LLFloaterScriptLimits::postBuild() panel_memory->buildFromFile( "panel_script_limits_region_memory.xml"); mTab->addTabPanel(panel_memory); mTab->selectTab(0); - return TRUE; + return true; } LLFloaterScriptLimits::~LLFloaterScriptLimits() @@ -132,10 +132,10 @@ LLPanelScriptLimitsInfo::LLPanelScriptLimitsInfo() // virtual -BOOL LLPanelScriptLimitsInfo::postBuild() +bool LLPanelScriptLimitsInfo::postBuild() { refresh(); - return TRUE; + return true; } // virtual @@ -156,9 +156,9 @@ LLPanelScriptLimitsRegionMemory::~LLPanelScriptLimitsRegionMemory() } }; -BOOL LLPanelScriptLimitsRegionMemory::getLandScriptResources() +bool LLPanelScriptLimitsRegionMemory::getLandScriptResources() { - if (!gAgent.getRegion()) return FALSE; + if (!gAgent.getRegion()) return false; LLSD body; std::string url = gAgent.getRegion()->getCapability("LandResources"); @@ -166,11 +166,11 @@ BOOL LLPanelScriptLimitsRegionMemory::getLandScriptResources() { LLCoros::instance().launch("LLPanelScriptLimitsRegionMemory::getLandScriptResourcesCoro", boost::bind(&LLPanelScriptLimitsRegionMemory::getLandScriptResourcesCoro, this, url)); - return TRUE; + return true; } else { - return FALSE; + return false; } } @@ -403,7 +403,7 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content) return; } - S32 number_parcels = content["parcels"].size(); + auto number_parcels = content["parcels"].size(); LLStringUtil::format_map_t args_parcels; args_parcels["[PARCELS]"] = llformat ("%d", number_parcels); @@ -418,10 +418,10 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content) bool has_locations = false; bool has_local_ids = false; - for(S32 i = 0; i < number_parcels; i++) + for(size_t i = 0; i < number_parcels; i++) { std::string parcel_name = content["parcels"][i]["name"].asString(); - S32 number_objects = content["parcels"][i]["objects"].size(); + auto number_objects = content["parcels"][i]["objects"].size(); S32 local_id = 0; if(content["parcels"][i].has("local_id")) @@ -431,7 +431,7 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content) local_id = content["parcels"][i]["local_id"].asInteger(); } - for(S32 j = 0; j < number_objects; j++) + for(size_t j = 0; j < number_objects; j++) { S32 size = content["parcels"][i]["objects"][j]["resources"]["memory"].asInteger() / SIZE_OF_ONE_KB; @@ -468,7 +468,7 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content) // ...and if not use the slightly more painful method of disovery: else { - BOOL name_is_cached; + bool name_is_cached; if (is_group_owned) { name_is_cached = gCacheName->getGroupName(owner_id, owner_buf); @@ -640,7 +640,7 @@ void LLPanelScriptLimitsRegionMemory::setRegionSummary(LLSD content) } } -BOOL LLPanelScriptLimitsRegionMemory::postBuild() +bool LLPanelScriptLimitsRegionMemory::postBuild() { childSetAction("refresh_list_btn", onClickRefresh, this); childSetAction("highlight_btn", onClickHighlight, this); @@ -652,7 +652,7 @@ BOOL LLPanelScriptLimitsRegionMemory::postBuild() LLScrollListCtrl *list = getChild<LLScrollListCtrl>("scripts_list"); if(!list) { - return FALSE; + return false; } list->setCommitCallback(boost::bind(&LLPanelScriptLimitsRegionMemory::checkButtonsEnabled, this)); checkButtonsEnabled(); @@ -661,13 +661,13 @@ BOOL LLPanelScriptLimitsRegionMemory::postBuild() for(S32 column = 0; column < list->getNumColumns(); column++) { LLScrollListColumn* columnp = list->getColumn(column); - columnp->mHeader->setHasResizableElement(TRUE); + columnp->mHeader->setHasResizableElement(true); } return StartRequestChain(); } -BOOL LLPanelScriptLimitsRegionMemory::StartRequestChain() +bool LLPanelScriptLimitsRegionMemory::StartRequestChain() { LLUUID region_id; @@ -677,7 +677,7 @@ BOOL LLPanelScriptLimitsRegionMemory::StartRequestChain() getChild<LLUICtrl>("loading_text")->setValue(LLSD(std::string(""))); //might have to do parent post build here //if not logic below could use early outs - return FALSE; + return false; } LLParcel* parcel = instance->getCurrentSelectedParcel(); LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion(); @@ -693,7 +693,7 @@ BOOL LLPanelScriptLimitsRegionMemory::StartRequestChain() { std::string msg_wrong_region = LLTrans::getString("ScriptLimitsRequestWrongRegion"); getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_wrong_region)); - return FALSE; + return false; } LLVector3d pos_global = region->getCenterGlobal(); @@ -898,10 +898,10 @@ void LLPanelScriptLimitsRegionMemory::returnObjects() return; } - S32 number_parcels = mContent["parcels"].size(); + auto number_parcels = mContent["parcels"].size(); // a message per parcel containing all objects to be returned from that parcel - for(S32 i = 0; i < number_parcels; i++) + for(size_t i = 0; i < number_parcels; i++) { S32 local_id = 0; if(mContent["parcels"][i].has("local_id")) diff --git a/indra/newview/llfloaterscriptlimits.h b/indra/newview/llfloaterscriptlimits.h index 8c5bdb99cd..e1eb8cb079 100644 --- a/indra/newview/llfloaterscriptlimits.h +++ b/indra/newview/llfloaterscriptlimits.h @@ -47,7 +47,7 @@ class LLFloaterScriptLimits : public LLFloater friend class LLFloaterReg; public: - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); // from LLPanel virtual void refresh(); @@ -71,7 +71,7 @@ class LLPanelScriptLimitsInfo : public LLPanel public: LLPanelScriptLimitsInfo(); - virtual BOOL postBuild(); + virtual bool postBuild(); virtual void updateChild(LLUICtrl* child_ctrl); protected: @@ -102,14 +102,14 @@ public: ~LLPanelScriptLimitsRegionMemory(); // LLPanel - virtual BOOL postBuild(); + virtual bool postBuild(); void setRegionDetails(LLSD content); void setRegionSummary(LLSD content); - BOOL StartRequestChain(); + bool StartRequestChain(); - BOOL getLandScriptResources(); + bool getLandScriptResources(); void clearList(); void showBeacon(); void returnObjectsFromParcel(S32 local_id); diff --git a/indra/newview/llfloatersearch.cpp b/indra/newview/llfloatersearch.cpp index bd32807bb9..d3c8bf3451 100644 --- a/indra/newview/llfloatersearch.cpp +++ b/indra/newview/llfloatersearch.cpp @@ -100,12 +100,12 @@ LLFloaterSearch::LLFloaterSearch(const Params& key) : mCollectionType.insert("people"); } -BOOL LLFloaterSearch::postBuild() +bool LLFloaterSearch::postBuild() { LLFloaterWebContent::postBuild(); mWebBrowser->addObserver(this); - return TRUE; + return true; } void LLFloaterSearch::onOpen(const LLSD& key) @@ -115,7 +115,7 @@ void LLFloaterSearch::onOpen(const LLSD& key) p.allow_address_entry = false; LLFloaterWebContent::onOpen(p); - mWebBrowser->setFocus(TRUE); + mWebBrowser->setFocus(true); search(p.search); } @@ -147,7 +147,7 @@ void LLFloaterSearch::search(const SearchQuery &p) } // reset the god level warning as we're sending the latest state - getChildView("refresh_search")->setVisible(FALSE); + getChildView("refresh_search")->setVisible(false); mSearchGodLevel = gAgent.getGodLevel(); // work out the subdir to use based on the requested category diff --git a/indra/newview/llfloatersearch.h b/indra/newview/llfloatersearch.h index 5350c34c56..beaac2ad2f 100644 --- a/indra/newview/llfloatersearch.h +++ b/indra/newview/llfloatersearch.h @@ -83,7 +83,7 @@ public: void godLevelChanged(U8 godlevel); private: - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); std::set<std::string> mSearchType; std::set<std::string> mCollectionType; diff --git a/indra/newview/llfloatersellland.cpp b/indra/newview/llfloatersellland.cpp index f44c9ea953..691458d80a 100644 --- a/indra/newview/llfloatersellland.cpp +++ b/indra/newview/llfloatersellland.cpp @@ -99,7 +99,7 @@ private: void onBuyerNameCache(const LLAvatarName& av_name); public: - virtual BOOL postBuild(); + virtual bool postBuild(); bool setParcel(LLViewerRegion* region, LLParcelSelectionHandle parcel); static bool callbackHighlightTransferable(const LLSD& notification, const LLSD& response); @@ -165,7 +165,7 @@ void LLFloaterSellLandUI::SelectionObserver::changed() } } -BOOL LLFloaterSellLandUI::postBuild() +bool LLFloaterSellLandUI::postBuild() { childSetCommitCallback("sell_to", onChangeValue, this); childSetCommitCallback("price", onChangeValue, this); @@ -177,7 +177,7 @@ BOOL LLFloaterSellLandUI::postBuild() childSetAction("show_objects", doShowObjects, this); center(); getChild<LLUICtrl>("profile_scroll")->setTabStop(true); - return TRUE; + return true; } bool LLFloaterSellLandUI::setParcel(LLViewerRegion* region, LLParcelSelectionHandle parcel) @@ -289,13 +289,13 @@ void LLFloaterSellLandUI::refreshUI() F32 per_meter_price = 0; per_meter_price = F32(mParcelPrice) / F32(mParcelActualArea); getChild<LLUICtrl>("price_per_m")->setTextArg("[PER_METER]", llformat("%0.2f", per_meter_price)); - getChildView("price_per_m")->setVisible(TRUE); + getChildView("price_per_m")->setVisible(true); setBadge("step_price", BADGE_OK); } else { - getChildView("price_per_m")->setVisible(FALSE); + getChildView("price_per_m")->setVisible(false); if (price_str.empty()) { @@ -310,8 +310,8 @@ void LLFloaterSellLandUI::refreshUI() if (mSellToBuyer) { getChild<LLUICtrl>("sell_to")->setValue("user"); - getChildView("sell_to_agent")->setVisible(TRUE); - getChildView("sell_to_select_agent")->setVisible(TRUE); + getChildView("sell_to_agent")->setVisible(true); + getChildView("sell_to_select_agent")->setVisible(true); } else { @@ -323,8 +323,8 @@ void LLFloaterSellLandUI::refreshUI() { getChild<LLUICtrl>("sell_to")->setValue("select"); } - getChildView("sell_to_agent")->setVisible(FALSE); - getChildView("sell_to_select_agent")->setVisible(FALSE); + getChildView("sell_to_agent")->setVisible(false); + getChildView("sell_to_select_agent")->setVisible(false); } // Must select Sell To: Anybody, or User (with a specified username) @@ -351,11 +351,11 @@ void LLFloaterSellLandUI::refreshUI() if (valid_sell_to && valid_price && valid_sell_objects) { - getChildView("sell_btn")->setEnabled(TRUE); + getChildView("sell_btn")->setEnabled(true); } else { - getChildView("sell_btn")->setEnabled(FALSE); + getChildView("sell_btn")->setEnabled(false); } } @@ -398,7 +398,7 @@ void LLFloaterSellLandUI::onChangeValue(LLUICtrl *ctrl, void *userdata) void LLFloaterSellLandUI::doSelectAgent() { LLView * button = findChild<LLView>("sell_to_select_agent"); - LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLFloaterSellLandUI::callbackAvatarPick, this, _1, _2), FALSE, TRUE, FALSE, this->getName(), button); + LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLFloaterSellLandUI::callbackAvatarPick, this, _1, _2), false, true, false, this->getName(), button); // grandparent is a floater, in order to set up dependency if (picker) { @@ -532,7 +532,7 @@ bool LLFloaterSellLandUI::onConfirmSale(const LLSD& notification, const LLSD& re // return; // } - parcel->setParcelFlag(PF_FOR_SALE, TRUE); + parcel->setParcelFlag(PF_FOR_SALE, true); parcel->setSalePrice(sale_price); bool sell_with_objects = false; if ("yes" == getChild<LLUICtrl>("sell_objects")->getValue().asString()) diff --git a/indra/newview/llfloatersettingsdebug.cpp b/indra/newview/llfloatersettingsdebug.cpp index 0c5762e4b1..17707e808e 100644 --- a/indra/newview/llfloatersettingsdebug.cpp +++ b/indra/newview/llfloatersettingsdebug.cpp @@ -47,7 +47,7 @@ LLFloaterSettingsDebug::LLFloaterSettingsDebug(const LLSD& key) LLFloaterSettingsDebug::~LLFloaterSettingsDebug() {} -BOOL LLFloaterSettingsDebug::postBuild() +bool LLFloaterSettingsDebug::postBuild() { enableResizeCtrls(true, false, true); @@ -56,14 +56,14 @@ BOOL LLFloaterSettingsDebug::postBuild() getChild<LLFilterEditor>("filter_input")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::setSearchFilter, this, _2)); mSettingList = getChild<LLScrollListCtrl>("setting_list"); - mSettingList->setCommitOnSelectionChange(TRUE); + mSettingList->setCommitOnSelectionChange(true); mSettingList->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onSettingSelect, this)); updateList(); gSavedSettings.getControl("DebugSettingsHideDefault")->getCommitSignal()->connect(boost::bind(&LLFloaterSettingsDebug::updateList, this, false)); - return TRUE; + return true; } void LLFloaterSettingsDebug::draw() @@ -247,7 +247,7 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) switch(type) { case TYPE_U32: - spinner1->setVisible(TRUE); + spinner1->setVisible(true); spinner1->setLabel(std::string("value")); // Debug, don't translate if (!spinner1->hasFocus()) { @@ -259,7 +259,7 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) } break; case TYPE_S32: - spinner1->setVisible(TRUE); + spinner1->setVisible(true); spinner1->setLabel(std::string("value")); // Debug, don't translate if (!spinner1->hasFocus()) { @@ -271,7 +271,7 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) } break; case TYPE_F32: - spinner1->setVisible(TRUE); + spinner1->setVisible(true); spinner1->setLabel(std::string("value")); // Debug, don't translate if (!spinner1->hasFocus()) { @@ -293,7 +293,7 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) } break; case TYPE_STRING: - getChildView("val_text")->setVisible( TRUE); + getChildView("val_text")->setVisible( true); if (!getChild<LLUICtrl>("val_text")->hasFocus()) { getChild<LLUICtrl>("val_text")->setValue(sd); @@ -303,11 +303,11 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) { LLVector3 v; v.setValue(sd); - spinner1->setVisible(TRUE); + spinner1->setVisible(true); spinner1->setLabel(std::string("X")); - spinner2->setVisible(TRUE); + spinner2->setVisible(true); spinner2->setLabel(std::string("Y")); - spinner3->setVisible(TRUE); + spinner3->setVisible(true); spinner3->setLabel(std::string("Z")); if (!spinner1->hasFocus()) { @@ -330,11 +330,11 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) { LLVector3d v; v.setValue(sd); - spinner1->setVisible(TRUE); + spinner1->setVisible(true); spinner1->setLabel(std::string("X")); - spinner2->setVisible(TRUE); + spinner2->setVisible(true); spinner2->setLabel(std::string("Y")); - spinner3->setVisible(TRUE); + spinner3->setVisible(true); spinner3->setLabel(std::string("Z")); if (!spinner1->hasFocus()) { @@ -357,13 +357,13 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) { LLQuaternion q; q.setValue(sd); - spinner1->setVisible(TRUE); + spinner1->setVisible(true); spinner1->setLabel(std::string("X")); - spinner2->setVisible(TRUE); + spinner2->setVisible(true); spinner2->setLabel(std::string("Y")); - spinner3->setVisible(TRUE); + spinner3->setVisible(true); spinner3->setLabel(std::string("Z")); - spinner4->setVisible(TRUE); + spinner4->setVisible(true); spinner4->setLabel(std::string("S")); if (!spinner1->hasFocus()) { @@ -391,13 +391,13 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) { LLRect r; r.setValue(sd); - spinner1->setVisible(TRUE); + spinner1->setVisible(true); spinner1->setLabel(std::string("Left")); - spinner2->setVisible(TRUE); + spinner2->setVisible(true); spinner2->setLabel(std::string("Right")); - spinner3->setVisible(TRUE); + spinner3->setVisible(true); spinner3->setLabel(std::string("Bottom")); - spinner4->setVisible(TRUE); + spinner4->setVisible(true); spinner4->setLabel(std::string("Top")); if (!spinner1->hasFocus()) { @@ -441,13 +441,13 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) { LLColor4 clr; clr.setValue(sd); - color_swatch->setVisible(TRUE); + color_swatch->setVisible(true); // only set if changed so color picker doesn't update if(clr != LLColor4(color_swatch->getValue())) { - color_swatch->set(LLColor4(sd), TRUE, FALSE); + color_swatch->set(LLColor4(sd), true, false); } - spinner4->setVisible(TRUE); + spinner4->setVisible(true); spinner4->setLabel(std::string("Alpha")); if (!spinner4->hasFocus()) { @@ -462,7 +462,7 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) { LLColor3 clr; clr.setValue(sd); - color_swatch->setVisible(TRUE); + color_swatch->setVisible(true); color_swatch->setValue(sd); break; } diff --git a/indra/newview/llfloatersettingsdebug.h b/indra/newview/llfloatersettingsdebug.h index 5a392e766c..4df0dc8dd2 100644 --- a/indra/newview/llfloatersettingsdebug.h +++ b/indra/newview/llfloatersettingsdebug.h @@ -39,7 +39,7 @@ class LLFloaterSettingsDebug public: - virtual BOOL postBuild(); + virtual bool postBuild(); virtual void draw(); void updateControl(LLControlVariable* control); diff --git a/indra/newview/llfloatersidepanelcontainer.cpp b/indra/newview/llfloatersidepanelcontainer.cpp index c99d156c3a..2f6d14d6b5 100644 --- a/indra/newview/llfloatersidepanelcontainer.cpp +++ b/indra/newview/llfloatersidepanelcontainer.cpp @@ -125,7 +125,7 @@ LLPanel* LLFloaterSidePanelContainer::openChildPanel(const std::string& panel_na } else if (!hasFocus()) { - setFocus(TRUE); + setFocus(true); } LLPanel* panel = NULL; diff --git a/indra/newview/llfloatersimplesnapshot.cpp b/indra/newview/llfloatersimplesnapshot.cpp index 5d65bf2d0d..c0de8ab811 100644 --- a/indra/newview/llfloatersimplesnapshot.cpp +++ b/indra/newview/llfloatersimplesnapshot.cpp @@ -50,7 +50,7 @@ const S32 LLFloaterSimpleSnapshot::THUMBNAIL_SNAPSHOT_DIM_MIN = 64; static const std::string THUMBNAIL_UPLOAD_CAP = "InventoryThumbnailUpload"; -void post_thumbnail_image_coro(std::string cap_url, std::string path_to_image, LLSD first_data) +void post_thumbnail_image_coro(std::string cap_url, std::string path_to_image, LLSD first_data, LLFloaterSimpleSnapshot::completion_t callback) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -129,6 +129,11 @@ void post_thumbnail_image_coro(std::string cap_url, std::string path_to_image, L { LL_WARNS("Thumbnail") << "Failed to upload image " << result << LL_ENDL; } + + if (callback) + { + callback(LLUUID()); + } return; } @@ -153,6 +158,11 @@ void post_thumbnail_image_coro(std::string cap_url, std::string path_to_image, L // Are we supposed to get BulkUpdateInventory? gInventory.addChangedMask(LLInventoryObserver::INTERNAL, item_id); } + + if (callback) + { + callback(result["new_asset"].asUUID()); + } } ///---------------------------------------------------------------------------- @@ -218,8 +228,8 @@ void LLFloaterSimpleSnapshot::Impl::updateResolution(void* data) if (original_width != width || original_height != height) { // hide old preview as the aspect ratio could be wrong - checkAutoSnapshot(previewp, FALSE); - previewp->updateSnapshot(TRUE); + checkAutoSnapshot(previewp, false); + previewp->updateSnapshot(true); } } } @@ -258,7 +268,7 @@ LLFloaterSimpleSnapshot::~LLFloaterSimpleSnapshot() { } -BOOL LLFloaterSimpleSnapshot::postBuild() +bool LLFloaterSimpleSnapshot::postBuild() { childSetAction("new_snapshot_btn", ImplBase::onClickNewSnapshot, this); childSetAction("save_btn", boost::bind(&LLFloaterSimpleSnapshot::onSend, this)); @@ -281,15 +291,15 @@ BOOL LLFloaterSimpleSnapshot::postBuild() impl->setAdvanced(true); impl->setSkipReshaping(true); - previewp->mKeepAspectRatio = FALSE; + previewp->mKeepAspectRatio = false; previewp->setThumbnailPlaceholderRect(getThumbnailPlaceholderRect()); previewp->setAllowRenderUI(false); - previewp->setThumbnailSubsampled(TRUE); + previewp->setThumbnailSubsampled(true); - return TRUE; + return true; } -const S32 PREVIEW_OFFSET_Y = 70; +constexpr S32 PREVIEW_OFFSET_Y = 70; void LLFloaterSimpleSnapshot::draw() { @@ -338,12 +348,12 @@ void LLFloaterSimpleSnapshot::onOpen(const LLSD& key) LLSnapshotLivePreview* preview = getPreviewView(); if (preview) { - preview->updateSnapshot(TRUE); + preview->updateSnapshot(true); } - focusFirstItem(FALSE); - gSnapshotFloaterView->setEnabled(TRUE); - gSnapshotFloaterView->setVisible(TRUE); - gSnapshotFloaterView->adjustToFitScreen(this, FALSE); + focusFirstItem(false); + gSnapshotFloaterView->setEnabled(true); + gSnapshotFloaterView->setVisible(true); + gSnapshotFloaterView->adjustToFitScreen(this, false); impl->updateControls(this); impl->setStatus(ImplBase::STATUS_READY); @@ -364,7 +374,7 @@ void LLFloaterSimpleSnapshot::onSend() std::string temp_file = gDirUtilp->getTempFilename(); if (previewp->createUploadFile(temp_file, THUMBNAIL_SNAPSHOT_DIM_MAX, THUMBNAIL_SNAPSHOT_DIM_MIN)) { - uploadImageUploadFile(temp_file, mInventoryId, mTaskId); + uploadImageUploadFile(temp_file, mInventoryId, mTaskId, mUploadCompletionCallback); closeFloater(); } else @@ -372,6 +382,10 @@ void LLFloaterSimpleSnapshot::onSend() LLSD notif_args; notif_args["REASON"] = LLImage::getLastThreadError().c_str(); LLNotificationsUtil::add("CannotUploadTexture", notif_args); + if (mUploadCompletionCallback) + { + mUploadCompletionCallback(LLUUID::null); + } } } @@ -381,7 +395,10 @@ void LLFloaterSimpleSnapshot::postSave() } // static -void LLFloaterSimpleSnapshot::uploadThumbnail(const std::string &file_path, const LLUUID &inventory_id, const LLUUID &task_id) +void LLFloaterSimpleSnapshot::uploadThumbnail(const std::string &file_path, + const LLUUID &inventory_id, + const LLUUID &task_id, + completion_t callback) { // generate a temp texture file for coroutine std::string temp_file = gDirUtilp->getTempFilename(); @@ -394,11 +411,14 @@ void LLFloaterSimpleSnapshot::uploadThumbnail(const std::string &file_path, cons LL_WARNS("Thumbnail") << "Failed to upload thumbnail for " << inventory_id << " " << task_id << ", reason: " << notif_args["REASON"].asString() << LL_ENDL; return; } - uploadImageUploadFile(temp_file, inventory_id, task_id); + uploadImageUploadFile(temp_file, inventory_id, task_id, callback); } // static -void LLFloaterSimpleSnapshot::uploadThumbnail(LLPointer<LLImageRaw> raw_image, const LLUUID& inventory_id, const LLUUID& task_id) +void LLFloaterSimpleSnapshot::uploadThumbnail(LLPointer<LLImageRaw> raw_image, + const LLUUID& inventory_id, + const LLUUID& task_id, + completion_t callback) { std::string temp_file = gDirUtilp->getTempFilename(); if (!LLViewerTextureList::createUploadFile(raw_image, temp_file, THUMBNAIL_SNAPSHOT_DIM_MAX, THUMBNAIL_SNAPSHOT_DIM_MIN)) @@ -409,11 +429,14 @@ void LLFloaterSimpleSnapshot::uploadThumbnail(LLPointer<LLImageRaw> raw_image, c LL_WARNS("Thumbnail") << "Failed to upload thumbnail for " << inventory_id << " " << task_id << ", reason: " << notif_args["REASON"].asString() << LL_ENDL; return; } - uploadImageUploadFile(temp_file, inventory_id, task_id); + uploadImageUploadFile(temp_file, inventory_id, task_id, callback); } // static -void LLFloaterSimpleSnapshot::uploadImageUploadFile(const std::string &temp_file, const LLUUID &inventory_id, const LLUUID &task_id) +void LLFloaterSimpleSnapshot::uploadImageUploadFile(const std::string &temp_file, + const LLUUID &inventory_id, + const LLUUID &task_id, + completion_t callback) { LLSD data; @@ -442,7 +465,7 @@ void LLFloaterSimpleSnapshot::uploadImageUploadFile(const std::string &temp_file } LLCoros::instance().launch("postAgentUserImageCoro", - boost::bind(post_thumbnail_image_coro, cap_url, temp_file, data)); + boost::bind(post_thumbnail_image_coro, cap_url, temp_file, data, callback)); } void LLFloaterSimpleSnapshot::update() @@ -482,7 +505,7 @@ void LLFloaterSimpleSnapshot::saveTexture() return; } - previewp->saveTexture(TRUE, getInventoryId().asString()); + previewp->saveTexture(true, getInventoryId().asString()); closeFloater(); } diff --git a/indra/newview/llfloatersimplesnapshot.h b/indra/newview/llfloatersimplesnapshot.h index f6b79fd2ea..487e77469c 100644 --- a/indra/newview/llfloatersimplesnapshot.h +++ b/indra/newview/llfloatersimplesnapshot.h @@ -44,7 +44,7 @@ public: LLFloaterSimpleSnapshot(const LLSD& key); ~LLFloaterSimpleSnapshot(); - BOOL postBuild(); + bool postBuild(); void onOpen(const LLSD& key); void draw(); @@ -62,8 +62,17 @@ public: void setOwner(LLView *owner_view) { mOwner = owner_view; } void postSave(); - static void uploadThumbnail(const std::string &file_path, const LLUUID &inventory_id, const LLUUID &task_id); - static void uploadThumbnail(LLPointer<LLImageRaw> raw_image, const LLUUID& inventory_id, const LLUUID& task_id); + + typedef boost::function<void(const LLUUID& asset_id)> completion_t; + void setComplectionCallback(completion_t callback) { mUploadCompletionCallback = callback; } + static void uploadThumbnail(const std::string &file_path, + const LLUUID &inventory_id, + const LLUUID &task_id, + completion_t callback = completion_t()); + static void uploadThumbnail(LLPointer<LLImageRaw> raw_image, + const LLUUID& inventory_id, + const LLUUID& task_id, + completion_t callback = completion_t()); class Impl; friend class Impl; @@ -76,13 +85,17 @@ private: void onCancel(); // uploads upload-ready file - static void uploadImageUploadFile(const std::string &temp_file, const LLUUID &inventory_id, const LLUUID &task_id); + static void uploadImageUploadFile(const std::string &temp_file, + const LLUUID &inventory_id, + const LLUUID &task_id, + completion_t callback); LLUUID mInventoryId; LLUUID mTaskId; LLView* mOwner; F32 mContextConeOpacity; + completion_t mUploadCompletionCallback; }; ///---------------------------------------------------------------------------- diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index 68ed0f5873..2bac7d6360 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -100,7 +100,7 @@ LLSpinCtrl* LLFloaterSnapshot::Impl::getHeightSpinner(LLFloaterSnapshotBase* flo return active_panel ? active_panel->getHeightSpinner() : floater->getChild<LLSpinCtrl>("snapshot_height"); } -void LLFloaterSnapshot::Impl::enableAspectRatioCheckbox(LLFloaterSnapshotBase* floater, BOOL enable) +void LLFloaterSnapshot::Impl::enableAspectRatioCheckbox(LLFloaterSnapshotBase* floater, bool enable) { LLPanelSnapshot* active_panel = getActivePanel(floater); if (active_panel) @@ -109,7 +109,7 @@ void LLFloaterSnapshot::Impl::enableAspectRatioCheckbox(LLFloaterSnapshotBase* f } } -void LLFloaterSnapshot::Impl::setAspectRatioCheckboxValue(LLFloaterSnapshotBase* floater, BOOL checked) +void LLFloaterSnapshot::Impl::setAspectRatioCheckboxValue(LLFloaterSnapshotBase* floater, bool checked) { LLPanelSnapshot* active_panel = getActivePanel(floater); if (active_panel) @@ -145,8 +145,8 @@ LLSnapshotModel::ESnapshotLayerType LLFloaterSnapshot::Impl::getLayerType(LLFloa void LLFloaterSnapshot::Impl::setResolution(LLFloaterSnapshotBase* floater, const std::string& comboname) { LLComboBox* combo = floater->getChild<LLComboBox>(comboname); - combo->setVisible(TRUE); - updateResolution(combo, floater, FALSE); // to sync spinners with combo + combo->setVisible(true); + updateResolution(combo, floater, false); // to sync spinners with combo } //virtual @@ -179,7 +179,7 @@ void LLFloaterSnapshotBase::ImplBase::updateLayout(LLFloaterSnapshotBase* floate floaterp->getChild<LLUICtrl>("image_res_text")->setVisible(mAdvanced); floaterp->getChild<LLUICtrl>("file_size_label")->setVisible(mAdvanced); - if (floaterp->hasChild("360_label", TRUE)) + if (floaterp->hasChild("360_label", true)) { floaterp->getChild<LLUICtrl>("360_label")->setVisible(mAdvanced); } @@ -197,7 +197,7 @@ void LLFloaterSnapshotBase::ImplBase::updateLayout(LLFloaterSnapshotBase* floate if (use_freeze_frame) { // stop all mouse events at fullscreen preview layer - floaterp->getParent()->setMouseOpaque(TRUE); + floaterp->getParent()->setMouseOpaque(true); // shrink to smaller layout // *TODO: unneeded? @@ -206,8 +206,8 @@ void LLFloaterSnapshotBase::ImplBase::updateLayout(LLFloaterSnapshotBase* floate // can see and interact with fullscreen preview now if (previewp) { - previewp->setVisible(TRUE); - previewp->setEnabled(TRUE); + previewp->setVisible(true); + previewp->setEnabled(true); } //RN: freeze all avatars @@ -220,7 +220,7 @@ void LLFloaterSnapshotBase::ImplBase::updateLayout(LLFloaterSnapshotBase* floate } // freeze everything else - gSavedSettings.setBOOL("FreezeTime", TRUE); + gSavedSettings.setBOOL("FreezeTime", true); if (LLToolMgr::getInstance()->getCurrentToolset() != gCameraToolset) { @@ -230,20 +230,20 @@ void LLFloaterSnapshotBase::ImplBase::updateLayout(LLFloaterSnapshotBase* floate } else // turning off freeze frame mode { - floaterp->getParent()->setMouseOpaque(FALSE); + floaterp->getParent()->setMouseOpaque(false); // *TODO: unneeded? floaterp->reshape(floaterp->getRect().getWidth(), floaterp->getRect().getHeight()); if (previewp) { - previewp->setVisible(FALSE); - previewp->setEnabled(FALSE); + previewp->setVisible(false); + previewp->setEnabled(false); } //RN: thaw all avatars floaterp->impl->mAvatarPauseHandles.clear(); // thaw everything else - gSavedSettings.setBOOL("FreezeTime", FALSE); + gSavedSettings.setBOOL("FreezeTime", false); // restore last tool (e.g. pie menu, etc) if (floaterp->impl->mLastToolset) @@ -324,8 +324,8 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshotBase* floater) } LLSnapshotLivePreview* previewp = getPreviewView(); - BOOL got_bytes = previewp && previewp->getDataSize() > 0; - BOOL got_snap = previewp && previewp->getSnapshotUpToDate(); + bool got_bytes = previewp && previewp->getDataSize() > 0; + bool got_snap = previewp && previewp->getSnapshotUpToDate(); // *TODO: Separate maximum size for Web images from postcards LL_DEBUGS() << "Is snapshot up-to-date? " << got_snap << LL_ENDL; @@ -433,11 +433,11 @@ void LLFloaterSnapshotBase::ImplBase::setNeedRefresh(bool need) } // virtual -void LLFloaterSnapshotBase::ImplBase::checkAutoSnapshot(LLSnapshotLivePreview* previewp, BOOL update_thumbnail) +void LLFloaterSnapshotBase::ImplBase::checkAutoSnapshot(LLSnapshotLivePreview* previewp, bool update_thumbnail) { if (previewp) { - BOOL autosnap = gSavedSettings.getBOOL("AutoSnapshot"); + bool autosnap = gSavedSettings.getBOOL("AutoSnapshot"); LL_DEBUGS() << "updating " << (autosnap ? "snapshot" : "thumbnail") << LL_ENDL; previewp->updateSnapshot(autosnap, update_thumbnail, autosnap ? AUTO_SNAPSHOT_TIME_DELAY : 0.f); } @@ -452,7 +452,7 @@ void LLFloaterSnapshotBase::ImplBase::onClickNewSnapshot(void* data) { floater->impl->setStatus(ImplBase::STATUS_READY); LL_DEBUGS() << "updating snapshot" << LL_ENDL; - previewp->mForceUpdateSnapshot = TRUE; + previewp->mForceUpdateSnapshot = true; } } @@ -473,11 +473,11 @@ void LLFloaterSnapshotBase::ImplBase::onClickAutoSnap(LLUICtrl *ctrl, void* data // static void LLFloaterSnapshotBase::ImplBase::onClickNoPost(LLUICtrl *ctrl, void* data) { - BOOL no_post = ((LLCheckBoxCtrl*)ctrl)->get(); + bool no_post = ((LLCheckBoxCtrl*)ctrl)->get(); gSavedSettings.setBOOL("RenderSnapshotNoPost", no_post); LLFloaterSnapshotBase* view = (LLFloaterSnapshotBase*)data; - view->getPreviewView()->updateSnapshot(TRUE, TRUE); + view->getPreviewView()->updateSnapshot(true, true); view->impl->updateControls(view); } @@ -496,7 +496,7 @@ void LLFloaterSnapshotBase::ImplBase::onClickFilter(LLUICtrl *ctrl, void* data) LLComboBox* filterbox = static_cast<LLComboBox *>(view->getChild<LLComboBox>("filters_combobox")); std::string filter_name = (filterbox->getCurrentIndex() ? filterbox->getSimple() : ""); previewp->setFilter(filter_name); - previewp->updateSnapshot(TRUE); + previewp->updateSnapshot(true); } } } @@ -513,7 +513,7 @@ void LLFloaterSnapshotBase::ImplBase::onClickUICheck(LLUICtrl *ctrl, void* data) LLSnapshotLivePreview* previewp = view->getPreviewView(); if(previewp) { - previewp->updateSnapshot(TRUE, TRUE); + previewp->updateSnapshot(true, true); } view->impl->updateControls(view); } @@ -531,13 +531,13 @@ void LLFloaterSnapshotBase::ImplBase::onClickHUDCheck(LLUICtrl *ctrl, void* data LLSnapshotLivePreview* previewp = view->getPreviewView(); if(previewp) { - previewp->updateSnapshot(TRUE, TRUE); + previewp->updateSnapshot(true, true); } view->impl->updateControls(view); } } -void LLFloaterSnapshot::Impl::applyKeepAspectCheck(LLFloaterSnapshotBase* view, BOOL checked) +void LLFloaterSnapshot::Impl::applyKeepAspectCheck(LLFloaterSnapshotBase* view, bool checked) { gSavedSettings.setBOOL("KeepAspectForSnapshot", checked); @@ -557,12 +557,12 @@ void LLFloaterSnapshot::Impl::applyKeepAspectCheck(LLFloaterSnapshotBase* view, S32 w, h ; previewp->getSize(w, h) ; - updateSpinners(view, previewp, w, h, TRUE); // may change w and h + updateSpinners(view, previewp, w, h, true); // may change w and h LL_DEBUGS() << "updating thumbnail" << LL_ENDL; previewp->setSize(w, h) ; - previewp->updateSnapshot(TRUE); - checkAutoSnapshot(previewp, TRUE); + previewp->updateSnapshot(true); + checkAutoSnapshot(previewp, true); } } } @@ -596,26 +596,26 @@ void LLFloaterSnapshot::Impl::checkAspectRatio(LLFloaterSnapshotBase *view, S32 // Don't round texture sizes; textures are commonly stretched in world, profiles, etc and need to be "squashed" during upload, not cropped here if (LLSnapshotModel::SNAPSHOT_TEXTURE == getActiveSnapshotType(view)) { - previewp->mKeepAspectRatio = FALSE ; + previewp->mKeepAspectRatio = false ; return ; } - BOOL keep_aspect = FALSE, enable_cb = FALSE; + bool keep_aspect = false, enable_cb = false; if (0 == index) // current window size { - enable_cb = FALSE; - keep_aspect = TRUE; + enable_cb = false; + keep_aspect = true; } else if (-1 == index) // custom { - enable_cb = TRUE; + enable_cb = true; keep_aspect = gSavedSettings.getBOOL("KeepAspectForSnapshot"); } else // predefined resolution { - enable_cb = FALSE; - keep_aspect = FALSE; + enable_cb = false; + keep_aspect = false; } view->impl->mAspectRatioCheckOff = !enable_cb; @@ -672,7 +672,7 @@ void LLFloaterSnapshot::Impl::setFinished(bool finished, bool ok, const std::str } // Apply a new resolution selected from the given combobox. -void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL do_update) +void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, bool do_update) { LLComboBox* combobox = (LLComboBox*)ctrl; LLFloaterSnapshot *view = (LLFloaterSnapshot *)data; @@ -771,10 +771,10 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL previewp->setSize(width, height); // hide old preview as the aspect ratio could be wrong - checkAutoSnapshot(previewp, FALSE); + checkAutoSnapshot(previewp, false); LL_DEBUGS() << "updating thumbnail" << LL_ENDL; // Don't update immediately, give window chance to redraw - getPreviewView()->updateSnapshot(TRUE, FALSE, 1.f); + getPreviewView()->updateSnapshot(true, false, 1.f); if(do_update) { LL_DEBUGS() << "Will update controls" << LL_ENDL; @@ -798,8 +798,8 @@ void LLFloaterSnapshot::Impl::onCommitLayerTypes(LLUICtrl* ctrl, void*data) { previewp->setSnapshotBufferType((LLSnapshotModel::ESnapshotLayerType)combobox->getCurrentIndex()); } - view->impl->checkAutoSnapshot(previewp, TRUE); - previewp->updateSnapshot(TRUE, TRUE); + view->impl->checkAutoSnapshot(previewp, true); + previewp->updateSnapshot(true, true); } } @@ -818,7 +818,7 @@ void LLFloaterSnapshot::Impl::onImageFormatChange(LLFloaterSnapshotBase* view) { gSavedSettings.setS32("SnapshotFormat", getImageFormat(view)); LL_DEBUGS() << "image format changed, updating snapshot" << LL_ENDL; - getPreviewView()->updateSnapshot(TRUE); + getPreviewView()->updateSnapshot(true); updateControls(view); } } @@ -832,7 +832,7 @@ void LLFloaterSnapshot::Impl::comboSetCustom(LLFloaterSnapshotBase* floater, con } // Update supplied width and height according to the constrain proportions flag; limit them by max_val. -BOOL LLFloaterSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value) +bool LLFloaterSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, bool isWidthChanged, S32 max_value) { S32 w = width ; S32 h = height ; @@ -841,7 +841,7 @@ BOOL LLFloaterSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previewp, S3 { if(gViewerWindow->getWindowWidthRaw() < 1 || gViewerWindow->getWindowHeightRaw() < 1) { - return FALSE ; + return false ; } //aspect ratio of the current window @@ -887,7 +887,7 @@ void LLFloaterSnapshot::Impl::setImageSizeSpinnersValues(LLFloaterSnapshotBase* } } -void LLFloaterSnapshot::Impl::updateSpinners(LLFloaterSnapshotBase* view, LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL is_width_changed) +void LLFloaterSnapshot::Impl::updateSpinners(LLFloaterSnapshotBase* view, LLSnapshotLivePreview* previewp, S32& width, S32& height, bool is_width_changed) { getWidthSpinner(view)->resetDirty(); getHeightSpinner(view)->resetDirty(); @@ -914,13 +914,13 @@ void LLFloaterSnapshot::Impl::applyCustomResolution(LLFloaterSnapshotBase* view, previewp->setMaxImageSize((S32) getWidthSpinner(view)->getMaxValue()) ; previewp->setSize(w,h); - checkAutoSnapshot(previewp, FALSE); + checkAutoSnapshot(previewp, false); comboSetCustom(view, "profile_size_combo"); comboSetCustom(view, "postcard_size_combo"); comboSetCustom(view, "texture_size_combo"); comboSetCustom(view, "local_size_combo"); LL_DEBUGS() << "applied custom resolution, updating thumbnail" << LL_ENDL; - previewp->updateSnapshot(TRUE); + previewp->updateSnapshot(true); } } } @@ -956,7 +956,7 @@ LLFloaterSnapshotBase::~LLFloaterSnapshotBase() if (impl->mPreviewHandle.get()) impl->mPreviewHandle.get()->die(); //unfreeze everything else - gSavedSettings.setBOOL("FreezeTime", FALSE); + gSavedSettings.setBOOL("FreezeTime", false); if (impl->mLastToolset) { @@ -982,7 +982,7 @@ LLFloaterSnapshot::~LLFloaterSnapshot() } // virtual -BOOL LLFloaterSnapshot::postBuild() +bool LLFloaterSnapshot::postBuild() { mRefreshBtn = getChild<LLUICtrl>("new_snapshot_btn"); childSetAction("new_snapshot_btn", ImplBase::onClickNewSnapshot, this); @@ -1000,7 +1000,7 @@ BOOL LLFloaterSnapshot::postBuild() childSetCommitCallback("layer_types", Impl::onCommitLayerTypes, this); getChild<LLUICtrl>("layer_types")->setValue("colors"); - getChildView("layer_types")->setEnabled(FALSE); + getChildView("layer_types")->setEnabled(false); getChild<LLUICtrl>("freeze_frame_check")->setValue(gSavedSettings.getBOOL("UseFreezeFrame")); childSetCommitCallback("freeze_frame_check", ImplBase::onCommitFreezeFrame, this); @@ -1064,7 +1064,7 @@ BOOL LLFloaterSnapshot::postBuild() previewp->setThumbnailPlaceholderRect(getThumbnailPlaceholderRect()); - return TRUE; + return true; } // virtual @@ -1123,13 +1123,13 @@ void LLFloaterSnapshot::onOpen(const LLSD& key) if(preview) { LL_DEBUGS() << "opened, updating snapshot" << LL_ENDL; - preview->setAllowFullScreenPreview(TRUE); - preview->updateSnapshot(TRUE); + preview->setAllowFullScreenPreview(true); + preview->updateSnapshot(true); } - focusFirstItem(FALSE); - gSnapshotFloaterView->setEnabled(TRUE); - gSnapshotFloaterView->setVisible(TRUE); - gSnapshotFloaterView->adjustToFitScreen(this, FALSE); + focusFirstItem(false); + gSnapshotFloaterView->setEnabled(true); + gSnapshotFloaterView->setVisible(true); + gSnapshotFloaterView->adjustToFitScreen(this, false); impl->updateControls(this); impl->setAdvanced(gSavedSettings.getBOOL("AdvanceSnapshot")); @@ -1153,18 +1153,18 @@ void LLFloaterSnapshot::on360Snapshot() //virtual void LLFloaterSnapshotBase::onClose(bool app_quitting) { - getParent()->setMouseOpaque(FALSE); + getParent()->setMouseOpaque(false); //unfreeze everything, hide fullscreen preview LLSnapshotLivePreview* previewp = getPreviewView(); if (previewp) { - previewp->setAllowFullScreenPreview(FALSE); - previewp->setVisible(FALSE); - previewp->setEnabled(FALSE); + previewp->setAllowFullScreenPreview(false); + previewp->setVisible(false); + previewp->setEnabled(false); } - gSavedSettings.setBOOL("FreezeTime", FALSE); + gSavedSettings.setBOOL("FreezeTime", false); impl->mAvatarPauseHandles.clear(); if (impl->mLastToolset) @@ -1263,17 +1263,17 @@ S32 LLFloaterSnapshot::notify(const LLSD& info) return 0; } -BOOL LLFloaterSnapshot::isWaitingState() +bool LLFloaterSnapshot::isWaitingState() { return (impl->getStatus() == ImplBase::STATUS_WORKING); } -BOOL LLFloaterSnapshotBase::ImplBase::updatePreviewList(bool initialized) +bool LLFloaterSnapshotBase::ImplBase::updatePreviewList(bool initialized) { if (!initialized) - return FALSE; + return false; - BOOL changed = FALSE; + bool changed = false; LL_DEBUGS() << "npreviews: " << LLSnapshotLivePreview::sList.size() << LL_ENDL; for (std::set<LLSnapshotLivePreview*>::iterator iter = LLSnapshotLivePreview::sList.begin(); iter != LLSnapshotLivePreview::sList.end(); ++iter) @@ -1424,7 +1424,7 @@ LLSnapshotFloaterView::~LLSnapshotFloaterView() } // virtual -BOOL LLSnapshotFloaterView::handleKey(KEY key, MASK mask, BOOL called_from_parent) +bool LLSnapshotFloaterView::handleKey(KEY key, MASK mask, bool called_from_parent) { // use default handler when not in freeze-frame mode if(!gSavedSettings.getBOOL("FreezeTime")) @@ -1440,13 +1440,13 @@ BOOL LLSnapshotFloaterView::handleKey(KEY key, MASK mask, BOOL called_from_paren else { // bounce keystrokes back down - LLFloaterView::handleKey(key, mask, TRUE); + LLFloaterView::handleKey(key, mask, true); } - return TRUE; + return true; } // virtual -BOOL LLSnapshotFloaterView::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLSnapshotFloaterView::handleMouseDown(S32 x, S32 y, MASK mask) { // use default handler when not in freeze-frame mode if(!gSavedSettings.getBOOL("FreezeTime")) @@ -1458,11 +1458,11 @@ BOOL LLSnapshotFloaterView::handleMouseDown(S32 x, S32 y, MASK mask) { LLToolMgr::getInstance()->getCurrentTool()->handleMouseDown( x, y, mask ); } - return TRUE; + return true; } // virtual -BOOL LLSnapshotFloaterView::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLSnapshotFloaterView::handleMouseUp(S32 x, S32 y, MASK mask) { // use default handler when not in freeze-frame mode if(!gSavedSettings.getBOOL("FreezeTime")) @@ -1474,11 +1474,11 @@ BOOL LLSnapshotFloaterView::handleMouseUp(S32 x, S32 y, MASK mask) { LLToolMgr::getInstance()->getCurrentTool()->handleMouseUp( x, y, mask ); } - return TRUE; + return true; } // virtual -BOOL LLSnapshotFloaterView::handleHover(S32 x, S32 y, MASK mask) +bool LLSnapshotFloaterView::handleHover(S32 x, S32 y, MASK mask) { // use default handler when not in freeze-frame mode if(!gSavedSettings.getBOOL("FreezeTime")) @@ -1490,5 +1490,5 @@ BOOL LLSnapshotFloaterView::handleHover(S32 x, S32 y, MASK mask) { LLToolMgr::getInstance()->getCurrentTool()->handleHover( x, y, mask ); } - return TRUE; + return true; } diff --git a/indra/newview/llfloatersnapshot.h b/indra/newview/llfloatersnapshot.h index b70d07434a..ac5a472b03 100644 --- a/indra/newview/llfloatersnapshot.h +++ b/indra/newview/llfloatersnapshot.h @@ -119,13 +119,13 @@ public: virtual EStatus getStatus() const { return mStatus; } virtual void setNeedRefresh(bool need); - static BOOL updatePreviewList(bool initialized); + static bool updatePreviewList(bool initialized); void setAdvanced(bool advanced) { mAdvanced = advanced; } void setSkipReshaping(bool skip) { mSkipReshaping = skip; } virtual LLSnapshotModel::ESnapshotLayerType getLayerType(LLFloaterSnapshotBase* floater) = 0; - virtual void checkAutoSnapshot(LLSnapshotLivePreview* floater, BOOL update_thumbnail = FALSE); + virtual void checkAutoSnapshot(LLSnapshotLivePreview* floater, bool update_thumbnail = false); void setWorking(bool working); virtual void setFinished(bool finished, bool ok = true, const std::string& msg = LLStringUtil::null) = 0; @@ -150,7 +150,7 @@ public: LLFloaterSnapshot(const LLSD& key); /*virtual*/ ~LLFloaterSnapshot(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ S32 notify(const LLSD& info); @@ -167,7 +167,7 @@ public: void saveLocal(const snapshot_saved_signal_t::slot_type& success_cb, const snapshot_saved_signal_t::slot_type& failure_cb); static void setAgentEmail(const std::string& email); - BOOL isWaitingState(); + bool isWaitingState(); class Impl; friend class Impl; @@ -187,24 +187,24 @@ public: ~Impl() {} - void applyKeepAspectCheck(LLFloaterSnapshotBase* view, BOOL checked); - void updateResolution(LLUICtrl* ctrl, void* data, BOOL do_update = TRUE); + void applyKeepAspectCheck(LLFloaterSnapshotBase* view, bool checked); + void updateResolution(LLUICtrl* ctrl, void* data, bool do_update = true); static void onCommitLayerTypes(LLUICtrl* ctrl, void*data); void onImageQualityChange(LLFloaterSnapshotBase* view, S32 quality_val); void onImageFormatChange(LLFloaterSnapshotBase* view); void applyCustomResolution(LLFloaterSnapshotBase* view, S32 w, S32 h); static void onSendingPostcardFinished(LLFloaterSnapshotBase* floater, bool status); - BOOL checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value); + bool checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, bool isWidthChanged, S32 max_value); void setImageSizeSpinnersValues(LLFloaterSnapshotBase *view, S32 width, S32 height); - void updateSpinners(LLFloaterSnapshotBase* view, LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL is_width_changed); + void updateSpinners(LLFloaterSnapshotBase* view, LLSnapshotLivePreview* previewp, S32& width, S32& height, bool is_width_changed); static void onSnapshotUploadFinished(LLFloaterSnapshotBase* floater, bool status); /*virtual*/ LLPanelSnapshot* getActivePanel(LLFloaterSnapshotBase* floater, bool ok_if_not_found = true); /*virtual*/ LLSnapshotModel::ESnapshotFormat getImageFormat(LLFloaterSnapshotBase* floater); LLSpinCtrl* getWidthSpinner(LLFloaterSnapshotBase* floater); LLSpinCtrl* getHeightSpinner(LLFloaterSnapshotBase* floater); - void enableAspectRatioCheckbox(LLFloaterSnapshotBase* floater, BOOL enable); - void setAspectRatioCheckboxValue(LLFloaterSnapshotBase* floater, BOOL checked); + void enableAspectRatioCheckbox(LLFloaterSnapshotBase* floater, bool enable); + void setAspectRatioCheckboxValue(LLFloaterSnapshotBase* floater, bool checked); /*virtual*/ std::string getSnapshotPanelPrefix(); void setResolution(LLFloaterSnapshotBase* floater, const std::string& comboname); @@ -232,10 +232,10 @@ protected: public: virtual ~LLSnapshotFloaterView(); - /*virtual*/ BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleKey(KEY key, MASK mask, bool called_from_parent); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); }; extern LLSnapshotFloaterView* gSnapshotFloaterView; diff --git a/indra/newview/llfloatersounddevices.cpp b/indra/newview/llfloatersounddevices.cpp index a5064fa53d..f11c5c0ad8 100644 --- a/indra/newview/llfloatersounddevices.cpp +++ b/indra/newview/llfloatersounddevices.cpp @@ -51,7 +51,7 @@ LLFloaterSoundDevices::~LLFloaterSoundDevices() } // virtual -BOOL LLFloaterSoundDevices::postBuild() +bool LLFloaterSoundDevices::postBuild() { LLTransientDockableFloater::postBuild(); @@ -65,7 +65,7 @@ BOOL LLFloaterSoundDevices::postBuild() getChild<LLUICtrl>("voice_output_device")->setCommitCallback(boost::bind(&LLPanelVoiceDeviceSettings::apply, panel)); getChild<LLUICtrl>("mic_volume_slider")->setCommitCallback(boost::bind(&LLPanelVoiceDeviceSettings::apply, panel)); } - return TRUE; + return true; } //virtual @@ -75,7 +75,7 @@ void LLFloaterSoundDevices::setDocked(bool docked, bool pop_on_undock/* = true*/ } // virtual -void LLFloaterSoundDevices::setFocus( BOOL b ) +void LLFloaterSoundDevices::setFocus(bool b) { LLTransientDockableFloater::setFocus(b); diff --git a/indra/newview/llfloatersounddevices.h b/indra/newview/llfloatersounddevices.h index b68e1c737b..9b21b62747 100644 --- a/indra/newview/llfloatersounddevices.h +++ b/indra/newview/llfloatersounddevices.h @@ -39,9 +39,9 @@ public: LLFloaterSoundDevices(const LLSD& key); ~LLFloaterSoundDevices(); - /*virtual*/ BOOL postBuild(); - /*virtual*/ void setDocked(bool docked, bool pop_on_undock = true); - /*virtual*/ void setFocus( BOOL b ); + bool postBuild() override; + void setDocked(bool docked, bool pop_on_undock = true) override; + void setFocus(bool b) override; }; diff --git a/indra/newview/llfloaterspellchecksettings.cpp b/indra/newview/llfloaterspellchecksettings.cpp index 47ec3a16fb..735776f7e5 100644 --- a/indra/newview/llfloaterspellchecksettings.cpp +++ b/indra/newview/llfloaterspellchecksettings.cpp @@ -61,7 +61,7 @@ void LLFloaterSpellCheckerSettings::draw() getChild<LLUICtrl>("spellcheck_remove_btn")->setEnabled(enable_remove); } -BOOL LLFloaterSpellCheckerSettings::postBuild(void) +bool LLFloaterSpellCheckerSettings::postBuild(void) { gSavedSettings.getControl("SpellCheck")->getSignal()->connect(boost::bind(&LLFloaterSpellCheckerSettings::refreshDictionaries, this, false)); LLSpellChecker::setSettingsChangeCallback(boost::bind(&LLFloaterSpellCheckerSettings::onSpellCheckSettingsChange, this)); @@ -248,7 +248,7 @@ LLFloaterSpellCheckerImport::LLFloaterSpellCheckerImport(const LLSD& key) { } -BOOL LLFloaterSpellCheckerImport::postBuild(void) +bool LLFloaterSpellCheckerImport::postBuild() { getChild<LLUICtrl>("dictionary_path_browse")->setCommitCallback(boost::bind(&LLFloaterSpellCheckerImport::onBtnBrowse, this)); getChild<LLUICtrl>("ok_btn")->setCommitCallback(boost::bind(&LLFloaterSpellCheckerImport::onBtnOK, this)); diff --git a/indra/newview/llfloaterspellchecksettings.h b/indra/newview/llfloaterspellchecksettings.h index ab64625b8d..f05bf68040 100644 --- a/indra/newview/llfloaterspellchecksettings.h +++ b/indra/newview/llfloaterspellchecksettings.h @@ -34,10 +34,10 @@ class LLFloaterSpellCheckerSettings : public LLFloater public: LLFloaterSpellCheckerSettings(const LLSD& key); - /*virtual*/ void draw(); - /*virtual*/ BOOL postBuild(); - /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ void onClose(bool app_quitting); + void draw() override; + bool postBuild() override; + void onOpen(const LLSD& key) override; + void onClose(bool app_quitting) override; protected: void onBtnImport(); @@ -52,7 +52,7 @@ class LLFloaterSpellCheckerImport : public LLFloater public: LLFloaterSpellCheckerImport(const LLSD& key); - /*virtual*/ BOOL postBuild(); + bool postBuild() override; protected: void onBtnBrowse(); diff --git a/indra/newview/llfloatertelehub.cpp b/indra/newview/llfloatertelehub.cpp index 20e281f454..e49b5045e3 100644 --- a/indra/newview/llfloatertelehub.cpp +++ b/indra/newview/llfloatertelehub.cpp @@ -53,7 +53,7 @@ LLFloaterTelehub::LLFloaterTelehub(const LLSD& key) { } -BOOL LLFloaterTelehub::postBuild() +bool LLFloaterTelehub::postBuild() { gMessageSystem->setHandlerFunc("TelehubInfo", processTelehubInfo); @@ -66,10 +66,10 @@ BOOL LLFloaterTelehub::postBuild() if (list) { // otherwise you can't walk with arrow keys while floater is up - list->setAllowKeyboardMovement(FALSE); + list->setAllowKeyboardMovement(false); } - return TRUE; + return true; } void LLFloaterTelehub::onOpen(const LLSD& key) { @@ -100,29 +100,29 @@ void LLFloaterTelehub::draw() // Per-frame updates, because we don't have a selection manager observer. void LLFloaterTelehub::refresh() { - const BOOL children_ok = TRUE; + constexpr bool children_ok = true; LLViewerObject* object = mObjectSelection->getFirstRootObject(children_ok); - BOOL have_selection = (object != NULL); - BOOL all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ); + bool have_selection = (object != NULL); + bool all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ); getChildView("connect_btn")->setEnabled(have_selection && all_volume); - BOOL have_telehub = mTelehubObjectID.notNull(); + bool have_telehub = mTelehubObjectID.notNull(); getChildView("disconnect_btn")->setEnabled(have_telehub); - BOOL space_avail = (mNumSpawn < MAX_SPAWNPOINTS_PER_TELEHUB); + bool space_avail = (mNumSpawn < MAX_SPAWNPOINTS_PER_TELEHUB); getChildView("add_spawn_point_btn")->setEnabled(have_selection && all_volume && space_avail); LLScrollListCtrl* list = getChild<LLScrollListCtrl>("spawn_points_list"); if (list) { - BOOL enable_remove = (list->getFirstSelected() != NULL); + bool enable_remove = (list->getFirstSelected() != NULL); getChildView("remove_spawn_point_btn")->setEnabled(enable_remove); } } // static -BOOL LLFloaterTelehub::renderBeacons() +bool LLFloaterTelehub::renderBeacons() { // only render if we've got a telehub LLFloaterTelehub* floater = LLFloaterReg::findTypedInstance<LLFloaterTelehub>("telehubs"); diff --git a/indra/newview/llfloatertelehub.h b/indra/newview/llfloatertelehub.h index a42ed6e85c..2ae450ba32 100644 --- a/indra/newview/llfloatertelehub.h +++ b/indra/newview/llfloatertelehub.h @@ -41,15 +41,15 @@ public: LLFloaterTelehub(const LLSD& key); ~LLFloaterTelehub(); - /*virtual*/ BOOL postBuild(); - /*virtual*/ void onOpen(const LLSD& key); + bool postBuild() override; + void onOpen(const LLSD& key) override; - /*virtual*/ void draw(); + void draw() override; - static BOOL renderBeacons(); + static bool renderBeacons(); static void addBeacons(); - void refresh(); + void refresh() override; void sendTelehubInfoRequest(); void onClickConnect(); diff --git a/indra/newview/llfloatertestinspectors.cpp b/indra/newview/llfloatertestinspectors.cpp index f6f4324e71..7f8d122435 100644 --- a/indra/newview/llfloatertestinspectors.cpp +++ b/indra/newview/llfloatertestinspectors.cpp @@ -45,7 +45,7 @@ LLFloaterTestInspectors::LLFloaterTestInspectors(const LLSD& seed) LLFloaterTestInspectors::~LLFloaterTestInspectors() {} -BOOL LLFloaterTestInspectors::postBuild() +bool LLFloaterTestInspectors::postBuild() { // Test the dummy widget construction code getChild<LLUICtrl>("intentionally-not-found")->setEnabled(true); diff --git a/indra/newview/llfloatertestinspectors.h b/indra/newview/llfloatertestinspectors.h index 32954df66d..ab634771d5 100644 --- a/indra/newview/llfloatertestinspectors.h +++ b/indra/newview/llfloatertestinspectors.h @@ -40,7 +40,7 @@ private: LLFloaterTestInspectors(const LLSD& seed); ~LLFloaterTestInspectors(); - /*virtual*/ BOOL postBuild(); + bool postBuild() override; // Button callback to show void showAvatarInspector(LLUICtrl*, const LLSD& avatar_id); diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index ccecdd89f0..aadc5b9580 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -217,10 +217,10 @@ LLPCode toolData[]={ LL_PCODE_LEGACY_TREE, LL_PCODE_LEGACY_GRASS}; -BOOL LLFloaterTools::postBuild() +bool LLFloaterTools::postBuild() { // Hide until tool selected - setVisible(FALSE); + setVisible(false); // Since we constantly show and hide this during drags, don't // make sounds on visibility changes. @@ -243,13 +243,13 @@ BOOL LLFloaterTools::postBuild() mBtnUnlink = getChild<LLButton>("unlink_btn"); mCheckSelectIndividual = getChild<LLCheckBoxCtrl>("checkbox edit linked parts"); - getChild<LLUICtrl>("checkbox edit linked parts")->setValue((BOOL)gSavedSettings.getBOOL("EditLinkedParts")); + getChild<LLUICtrl>("checkbox edit linked parts")->setValue((bool)gSavedSettings.getBOOL("EditLinkedParts")); mCheckSnapToGrid = getChild<LLCheckBoxCtrl>("checkbox snap to grid"); - getChild<LLUICtrl>("checkbox snap to grid")->setValue((BOOL)gSavedSettings.getBOOL("SnapEnabled")); + getChild<LLUICtrl>("checkbox snap to grid")->setValue((bool)gSavedSettings.getBOOL("SnapEnabled")); mCheckStretchUniform = getChild<LLCheckBoxCtrl>("checkbox uniform"); - getChild<LLUICtrl>("checkbox uniform")->setValue((BOOL)gSavedSettings.getBOOL("ScaleUniform")); + getChild<LLUICtrl>("checkbox uniform")->setValue((bool)gSavedSettings.getBOOL("ScaleUniform")); mCheckStretchTexture = getChild<LLCheckBoxCtrl>("checkbox stretch textures"); - getChild<LLUICtrl>("checkbox stretch textures")->setValue((BOOL)gSavedSettings.getBOOL("ScaleStretchTextures")); + getChild<LLUICtrl>("checkbox stretch textures")->setValue((bool)gSavedSettings.getBOOL("ScaleStretchTextures")); mComboGridMode = getChild<LLComboBox>("combobox grid mode"); // @@ -268,13 +268,13 @@ BOOL LLFloaterTools::postBuild() } } mCheckCopySelection = getChild<LLCheckBoxCtrl>("checkbox copy selection"); - getChild<LLUICtrl>("checkbox copy selection")->setValue((BOOL)gSavedSettings.getBOOL("CreateToolCopySelection")); + getChild<LLUICtrl>("checkbox copy selection")->setValue((bool)gSavedSettings.getBOOL("CreateToolCopySelection")); mCheckSticky = getChild<LLCheckBoxCtrl>("checkbox sticky"); - getChild<LLUICtrl>("checkbox sticky")->setValue((BOOL)gSavedSettings.getBOOL("CreateToolKeepSelected")); + getChild<LLUICtrl>("checkbox sticky")->setValue((bool)gSavedSettings.getBOOL("CreateToolKeepSelected")); mCheckCopyCenters = getChild<LLCheckBoxCtrl>("checkbox copy centers"); - getChild<LLUICtrl>("checkbox copy centers")->setValue((BOOL)gSavedSettings.getBOOL("CreateToolCopyCenters")); + getChild<LLUICtrl>("checkbox copy centers")->setValue((bool)gSavedSettings.getBOOL("CreateToolCopyCenters")); mCheckCopyRotates = getChild<LLCheckBoxCtrl>("checkbox copy rotates"); - getChild<LLUICtrl>("checkbox copy rotates")->setValue((BOOL)gSavedSettings.getBOOL("CreateToolCopyRotates")); + getChild<LLUICtrl>("checkbox copy rotates")->setValue((bool)gSavedSettings.getBOOL("CreateToolCopyRotates")); mRadioGroupLand = getChild<LLRadioGroup>("land_radio_group"); mBtnApplyToSelection = getChild<LLButton>("button apply to selection"); @@ -290,7 +290,7 @@ BOOL LLFloaterTools::postBuild() if(mTab) { mTab->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT); - mTab->setBorderVisible(FALSE); + mTab->setBorderVisible(false); mTab->selectFirstTab(); } @@ -305,7 +305,7 @@ BOOL LLFloaterTools::postBuild() sShowObjectCost = gSavedSettings.getBOOL("ShowObjectRenderingCost"); - return TRUE; + return true; } // Create the popupview with a dummy center. It will be moved into place @@ -365,12 +365,12 @@ LLFloaterTools::LLFloaterTools(const LLSD& key) mLandImpactsObserver(NULL), - mDirty(TRUE), - mHasSelection(TRUE) + mDirty(true), + mHasSelection(true) { gFloaterTools = this; - setAutoFocus(FALSE); + setAutoFocus(false); mFactoryMap["General"] = LLCallbackMap(createPanelPermissions, this);//LLPanelPermissions mFactoryMap["Object"] = LLCallbackMap(createPanelObject, this);//LLPanelObject mFactoryMap["Features"] = LLCallbackMap(createPanelVolume, this);//LLPanelVolume @@ -425,7 +425,7 @@ void LLFloaterTools::refresh() const S32 INFO_WIDTH = getRect().getWidth(); const S32 INFO_HEIGHT = 384; LLRect object_info_rect(0, 0, INFO_WIDTH, -INFO_HEIGHT); - BOOL all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ); + bool all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ); S32 idx_features = mTab->getPanelIndexByTitle(PANEL_NAMES[PANEL_FEATURES]); S32 idx_face = mTab->getPanelIndexByTitle(PANEL_NAMES[PANEL_FACE]); @@ -560,17 +560,17 @@ void LLFloaterTools::refresh() void LLFloaterTools::draw() { - BOOL has_selection = !LLSelectMgr::getInstance()->getSelection()->isEmpty(); + bool has_selection = !LLSelectMgr::getInstance()->getSelection()->isEmpty(); if(!has_selection && (mHasSelection != has_selection)) { - mDirty = TRUE; + mDirty = true; } mHasSelection = has_selection; if (mDirty) { refresh(); - mDirty = FALSE; + mDirty = false; } // mCheckSelectIndividual->set(gSavedSettings.getBOOL("EditLinkedParts")); @@ -579,7 +579,7 @@ void LLFloaterTools::draw() void LLFloaterTools::dirty() { - mDirty = TRUE; + mDirty = true; LLFloaterOpenObject* instance = LLFloaterReg::findTypedInstance<LLFloaterOpenObject>("openobject"); if (instance) instance->dirty(); } @@ -588,12 +588,12 @@ void LLFloaterTools::dirty() // floater is closed. void LLFloaterTools::resetToolState() { - gCameraBtnZoom = TRUE; - gCameraBtnOrbit = FALSE; - gCameraBtnPan = FALSE; + gCameraBtnZoom = true; + gCameraBtnOrbit = false; + gCameraBtnPan = false; - gGrabBtnSpin = FALSE; - gGrabBtnVertical = FALSE; + gGrabBtnSpin = false; + gGrabBtnVertical = false; } void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) @@ -613,7 +613,7 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) } // Focus buttons - BOOL focus_visible = ( tool == LLToolCamera::getInstance() ); + bool focus_visible = ( tool == LLToolCamera::getInstance() ); mBtnFocus ->setToggleState( focus_visible ); @@ -647,7 +647,7 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) getChild<LLUICtrl>("slider zoom")->setValue(gAgentCamera.getCameraZoomFraction() * 0.5f); // Move buttons - BOOL move_visible = (tool == LLToolGrab::getInstance()); + bool move_visible = (tool == LLToolGrab::getInstance()); if (mBtnMove) mBtnMove ->setToggleState( move_visible ); @@ -672,7 +672,7 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) } // Edit buttons - BOOL edit_visible = tool == LLToolCompTranslate::getInstance() || + bool edit_visible = tool == LLToolCompTranslate::getInstance() || tool == LLToolCompRotate::getInstance() || tool == LLToolCompScale::getInstance() || tool == LLToolFace::getInstance() || @@ -750,7 +750,7 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) if (mCheckStretchUniformLabel) mCheckStretchUniformLabel->setVisible( edit_visible ); // Create buttons - BOOL create_visible = (tool == LLToolCompCreate::getInstance()); + bool create_visible = (tool == LLToolCompCreate::getInstance()); mBtnCreate ->setToggleState( tool == LLToolCompCreate::getInstance() ); @@ -760,7 +760,7 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) // don't highlight any placer button for (std::vector<LLButton*>::size_type i = 0; i < mButtons.size(); i++) { - mButtons[i]->setToggleState(FALSE); + mButtons[i]->setToggleState(false); mButtons[i]->setVisible( create_visible ); } } @@ -771,7 +771,7 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) { LLPCode pcode = LLToolPlacer::getObjectType(); LLPCode button_pcode = toolData[t]; - BOOL state = (pcode == button_pcode); + bool state = (pcode == button_pcode); mButtons[t]->setToggleState( state ); mButtons[t]->setVisible( create_visible ); } @@ -786,7 +786,7 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) if (mCheckCopyRotates && mCheckCopySelection) mCheckCopyRotates->setEnabled( mCheckCopySelection->get() ); // Land buttons - BOOL land_visible = (tool == LLToolBrushLand::getInstance() || tool == LLToolSelectLand::getInstance() ); + bool land_visible = (tool == LLToolBrushLand::getInstance() || tool == LLToolSelectLand::getInstance() ); mCostTextBorder->setVisible(!land_visible); @@ -855,7 +855,7 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) // virtual -BOOL LLFloaterTools::canClose() +bool LLFloaterTools::canClose() { // don't close when quitting, so camera will stay put return !LLApp::isExiting(); @@ -881,17 +881,17 @@ void LLFloaterTools::onOpen(const LLSD& key) // so it won't be getting any layout or visibility updates, update once // further updates will come from updateLayout() LLCoordGL select_center_screen; - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); updatePopup(select_center_screen, mask); } - //gMenuBarView->setItemVisible("BuildTools", TRUE); + //gMenuBarView->setItemVisible("BuildTools", true); } // virtual void LLFloaterTools::onClose(bool app_quitting) { - mTab->setVisible(FALSE); + mTab->setVisible(false); LLViewerJoystick::getInstance()->moveAvatar(false); @@ -904,7 +904,7 @@ void LLFloaterTools::onClose(bool app_quitting) // exit component selection mode LLSelectMgr::getInstance()->promoteSelectionToRoot(); - gSavedSettings.setBOOL("EditLinkedParts", FALSE); + gSavedSettings.setBOOL("EditLinkedParts", false); gViewerWindow->showCursor(); @@ -919,7 +919,7 @@ void LLFloaterTools::onClose(bool app_quitting) // so manually reset tool to default (pie menu tool) LLToolMgr::getInstance()->getCurrentToolset()->selectFirstTool(); - //gMenuBarView->setItemVisible("BuildTools", FALSE); + //gMenuBarView->setItemVisible("BuildTools", false); LLFloaterReg::hideInstance("media_settings"); // hide the advanced object weights floater @@ -934,7 +934,7 @@ void LLFloaterTools::onClose(bool app_quitting) if(sPreviousFocusOnAvatar) { sPreviousFocusOnAvatar = false; - gAgentCamera.setAllowChangeToFollow(TRUE); + gAgentCamera.setAllowChangeToFollow(true); } } @@ -953,18 +953,18 @@ void commit_radio_group_move(LLUICtrl* ctrl) std::string selected = group->getValue().asString(); if (selected == "radio move") { - gGrabBtnVertical = FALSE; - gGrabBtnSpin = FALSE; + gGrabBtnVertical = false; + gGrabBtnSpin = false; } else if (selected == "radio lift") { - gGrabBtnVertical = TRUE; - gGrabBtnSpin = FALSE; + gGrabBtnVertical = true; + gGrabBtnSpin = false; } else if (selected == "radio spin") { - gGrabBtnVertical = FALSE; - gGrabBtnSpin = TRUE; + gGrabBtnVertical = false; + gGrabBtnSpin = true; } } @@ -974,21 +974,21 @@ void commit_radio_group_focus(LLUICtrl* ctrl) std::string selected = group->getValue().asString(); if (selected == "radio zoom") { - gCameraBtnZoom = TRUE; - gCameraBtnOrbit = FALSE; - gCameraBtnPan = FALSE; + gCameraBtnZoom = true; + gCameraBtnOrbit = false; + gCameraBtnPan = false; } else if (selected == "radio orbit") { - gCameraBtnZoom = FALSE; - gCameraBtnOrbit = TRUE; - gCameraBtnPan = FALSE; + gCameraBtnZoom = false; + gCameraBtnOrbit = true; + gCameraBtnPan = false; } else if (selected == "radio pan") { - gCameraBtnZoom = FALSE; - gCameraBtnOrbit = FALSE; - gCameraBtnPan = TRUE; + gCameraBtnZoom = false; + gCameraBtnOrbit = false; + gCameraBtnPan = true; } } @@ -1074,7 +1074,7 @@ void commit_select_component(void *data) gFocusMgr.setKeyboardFocus(NULL); } - BOOL select_individuals = floaterp->mCheckSelectIndividual->get(); + bool select_individuals = floaterp->mCheckSelectIndividual->get(); gSavedSettings.setBOOL("EditLinkedParts", select_individuals); floaterp->dirty(); @@ -1092,7 +1092,7 @@ void commit_select_component(void *data) void LLFloaterTools::setObjectType( LLPCode pcode ) { LLToolPlacer::setObjectType( pcode ); - gSavedSettings.setBOOL("CreateToolCopySelection", FALSE); + gSavedSettings.setBOOL("CreateToolCopySelection", false); gFocusMgr.setMouseCapture(NULL); } diff --git a/indra/newview/llfloatertools.h b/indra/newview/llfloatertools.h index f6e03afc11..f9c3b401bb 100644 --- a/indra/newview/llfloatertools.h +++ b/indra/newview/llfloatertools.h @@ -55,7 +55,7 @@ class LLFloaterTools : public LLFloater { public: - virtual BOOL postBuild(); + virtual bool postBuild(); static void* createPanelPermissions(void* vdata); static void* createPanelObject(void* vdata); static void* createPanelVolume(void* vdata); @@ -67,7 +67,7 @@ public: virtual ~LLFloaterTools(); /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ BOOL canClose(); + /*virtual*/ bool canClose(); /*virtual*/ void onClose(bool app_quitting); /*virtual*/ void draw(); /*virtual*/ void onFocusReceived(); @@ -181,8 +181,8 @@ public: LLObjectSelectionHandle mObjectSelection; private: - BOOL mDirty; - BOOL mHasSelection; + bool mDirty; + bool mHasSelection; std::map<std::string, std::string> mStatusText; diff --git a/indra/newview/llfloatertopobjects.cpp b/indra/newview/llfloatertopobjects.cpp index c630daa836..64b22c4bb1 100644 --- a/indra/newview/llfloatertopobjects.cpp +++ b/indra/newview/llfloatertopobjects.cpp @@ -73,7 +73,7 @@ void LLFloaterTopObjects::show() */ LLFloaterTopObjects::LLFloaterTopObjects(const LLSD& key) : LLFloater(key), - mInitialized(FALSE), + mInitialized(false), mtotalScore(0.f) { mCommitCallbackRegistrar.add("TopObjects.ShowBeacon", boost::bind(&LLFloaterTopObjects::onClickShowBeacon, this)); @@ -93,12 +93,12 @@ LLFloaterTopObjects::~LLFloaterTopObjects() } // virtual -BOOL LLFloaterTopObjects::postBuild() +bool LLFloaterTopObjects::postBuild() { mObjectsScrollList = getChild<LLScrollListCtrl>("objects_list"); - mObjectsScrollList->setFocus(TRUE); + mObjectsScrollList->setFocus(true); mObjectsScrollList->setDoubleClickCallback(onDoubleClickObjectsList, this); - mObjectsScrollList->setCommitOnSelectionChange(TRUE); + mObjectsScrollList->setCommitOnSelectionChange(true); mObjectsScrollList->setCommitCallback(boost::bind(&LLFloaterTopObjects::onSelectionChanged, this)); setDefaultBtn("show_beacon_btn"); @@ -107,7 +107,7 @@ BOOL LLFloaterTopObjects::postBuild() mFlags = 0; mFilter.clear(); - return TRUE; + return true; } // static void LLFloaterTopObjects::setMode(U32 mode) @@ -129,7 +129,7 @@ void LLFloaterTopObjects::handle_land_reply(LLMessageSystem* msg, void** data) if (!instance->mObjectListIDs.size() && !instance->mInitialized) { instance->onRefresh(); - instance->mInitialized = TRUE; + instance->mInitialized = true; } } else diff --git a/indra/newview/llfloatertopobjects.h b/indra/newview/llfloatertopobjects.h index a3f987f2e1..5ceace6d01 100644 --- a/indra/newview/llfloatertopobjects.h +++ b/indra/newview/llfloatertopobjects.h @@ -62,7 +62,7 @@ public: void clearList(); void updateSelectionInfo(); - virtual BOOL postBuild(); + virtual bool postBuild(); void onRefresh(); @@ -104,7 +104,7 @@ private: U32 mFlags; std::string mFilter; - BOOL mInitialized; + bool mInitialized; F32 mtotalScore; diff --git a/indra/newview/llfloatertos.cpp b/indra/newview/llfloatertos.cpp index 241d44ddf8..63ba51e559 100644 --- a/indra/newview/llfloatertos.cpp +++ b/indra/newview/llfloatertos.cpp @@ -56,7 +56,7 @@ LLFloaterTOS::LLFloaterTOS(const LLSD& data) { } -BOOL LLFloaterTOS::postBuild() +bool LLFloaterTOS::postBuild() { childSetAction("Continue", onContinue, this); childSetAction("Cancel", onCancel, this); @@ -66,11 +66,11 @@ BOOL LLFloaterTOS::postBuild() { // this displays the critical message LLUICtrl *tos_text = getChild<LLUICtrl>("tos_text"); - tos_text->setEnabled( FALSE ); - tos_text->setFocus(TRUE); + tos_text->setEnabled(false); + tos_text->setFocus(true); tos_text->setValue(LLSD(mMessage)); - return TRUE; + return true; } // disable Agree to TOS radio button until the page has fully loaded @@ -78,7 +78,7 @@ BOOL LLFloaterTOS::postBuild() // hide the SL text widget if we're displaying TOS with using a browser widget. LLUICtrl *editor = getChild<LLUICtrl>("tos_text"); - editor->setVisible( FALSE ); + editor->setVisible(false); LLMediaCtrl* web_browser = getChild<LLMediaCtrl>("tos_html"); if ( web_browser ) @@ -113,7 +113,7 @@ BOOL LLFloaterTOS::postBuild() #endif } - return TRUE; + return true; } void LLFloaterTOS::setSiteIsAlive( bool alive ) diff --git a/indra/newview/llfloatertos.h b/indra/newview/llfloatertos.h index b4f08be00b..3bec4da58d 100644 --- a/indra/newview/llfloatertos.h +++ b/indra/newview/llfloatertos.h @@ -47,9 +47,9 @@ public: LLFloaterTOS(const LLSD& data); virtual ~LLFloaterTOS(); - BOOL postBuild(); + bool postBuild() override; - virtual void draw(); + void draw() override; static void updateAgree( LLUICtrl *, void* userdata ); static void onContinue( void* userdata ); @@ -60,7 +60,7 @@ public: void updateAgreeEnabled(bool enabled); // inherited from LLViewerMediaObserver - /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event); + void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) override; private: static void testSiteIsAliveCoro(LLHandle<LLFloater> handle, std::string url); @@ -70,8 +70,6 @@ private: bool mSiteAlive; bool mRealNavigateBegun; std::string mReplyPumpName; - - }; #endif // LL_LLFLOATERTOS_H diff --git a/indra/newview/llfloatertoybox.cpp b/indra/newview/llfloatertoybox.cpp index 635d1e2bc4..f6257dbd3d 100644 --- a/indra/newview/llfloatertoybox.cpp +++ b/indra/newview/llfloatertoybox.cpp @@ -57,7 +57,7 @@ bool compare_localized_command_labels(LLCommand * cmd1, LLCommand * cmd2) return (lab1 < lab2); } -BOOL LLFloaterToybox::postBuild() +bool LLFloaterToybox::postBuild() { mToolBar = getChild<LLToolBar>("toybox_toolbar"); @@ -94,7 +94,7 @@ BOOL LLFloaterToybox::postBuild() mToolBar->addCommand((*it)->id()); } - return TRUE; + return true; } void LLFloaterToybox::draw() @@ -151,7 +151,7 @@ void LLFloaterToybox::onBtnClearAll() LLNotificationsUtil::add("ConfirmClearAllToybox"); } -BOOL LLFloaterToybox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +bool LLFloaterToybox::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, diff --git a/indra/newview/llfloatertoybox.h b/indra/newview/llfloatertoybox.h index fa7ef51703..4fe723c8cb 100644 --- a/indra/newview/llfloatertoybox.h +++ b/indra/newview/llfloatertoybox.h @@ -41,13 +41,13 @@ public: virtual ~LLFloaterToybox(); // virtuals - BOOL postBuild(); - void draw(); - /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + bool postBuild() override; + void draw() override; + bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, - std::string& tooltip_msg); + std::string& tooltip_msg) override; protected: void onBtnClearAll(); diff --git a/indra/newview/llfloatertranslationsettings.cpp b/indra/newview/llfloatertranslationsettings.cpp index 61c4e05183..71fd7fbb41 100644 --- a/indra/newview/llfloatertranslationsettings.cpp +++ b/indra/newview/llfloatertranslationsettings.cpp @@ -52,7 +52,7 @@ LLFloaterTranslationSettings::LLFloaterTranslationSettings(const LLSD& key) } // virtual -BOOL LLFloaterTranslationSettings::postBuild() +bool LLFloaterTranslationSettings::postBuild() { mMachineTranslationCB = getChild<LLCheckBoxCtrl>("translate_chat_checkbox"); mLanguageCombo = getChild<LLComboBox>("translate_language_combo"); @@ -106,15 +106,15 @@ BOOL LLFloaterTranslationSettings::postBuild() }); center(); - return TRUE; + return true; } // virtual void LLFloaterTranslationSettings::onOpen(const LLSD& key) { mMachineTranslationCB->setValue(gSavedSettings.getBOOL("TranslateChat")); - mLanguageCombo->setSelectedByValue(gSavedSettings.getString("TranslateLanguage"), TRUE); - mTranslationServiceRadioGroup->setSelectedByValue(gSavedSettings.getString("TranslationService"), TRUE); + mLanguageCombo->setSelectedByValue(gSavedSettings.getString("TranslateLanguage"), true); + mTranslationServiceRadioGroup->setSelectedByValue(gSavedSettings.getString("TranslationService"), true); LLSD azure_key = gSavedSettings.getLLSD("AzureTranslateAPIKey"); if (azure_key.isMap() && !azure_key["id"].asString().empty()) @@ -135,22 +135,22 @@ void LLFloaterTranslationSettings::onOpen(const LLSD& key) } else { - mAzureAPIKeyEditor->setTentative(TRUE); + mAzureAPIKeyEditor->setTentative(true); mAzureAPIRegionEditor->setTentative(true); - mAzureKeyVerified = FALSE; + mAzureKeyVerified = false; } std::string google_key = gSavedSettings.getString("GoogleTranslateAPIKey"); if (!google_key.empty()) { mGoogleAPIKeyEditor->setText(google_key); - mGoogleAPIKeyEditor->setTentative(FALSE); + mGoogleAPIKeyEditor->setTentative(false); verifyKey(LLTranslate::SERVICE_GOOGLE, google_key, false); } else { - mGoogleAPIKeyEditor->setTentative(TRUE); - mGoogleKeyVerified = FALSE; + mGoogleAPIKeyEditor->setTentative(true); + mGoogleKeyVerified = false; } LLSD deepl_key = gSavedSettings.getLLSD("DeepLTranslateAPIKey"); @@ -163,8 +163,8 @@ void LLFloaterTranslationSettings::onOpen(const LLSD& key) } else { - mDeepLAPIKeyEditor->setTentative(TRUE); - mDeepLKeyVerified = FALSE; + mDeepLAPIKeyEditor->setTentative(true); + mDeepLKeyVerified = false; } updateControlsEnabledState(); @@ -340,7 +340,7 @@ void LLFloaterTranslationSettings::onEditorFocused(LLFocusableElement* control) if (editor->getTentative()) { editor->setText(LLStringUtil::null); - editor->setTentative(FALSE); + editor->setTentative(false); } } } diff --git a/indra/newview/llfloatertranslationsettings.h b/indra/newview/llfloatertranslationsettings.h index 1801184c7e..3995059900 100644 --- a/indra/newview/llfloatertranslationsettings.h +++ b/indra/newview/llfloatertranslationsettings.h @@ -39,13 +39,13 @@ class LLFloaterTranslationSettings : public LLFloater { public: LLFloaterTranslationSettings(const LLSD& key); - /*virtual*/ BOOL postBuild(); - /*virtual*/ void onOpen(const LLSD& key); + bool postBuild() override; + void onOpen(const LLSD& key) override; void setAzureVerified(bool ok, bool alert, S32 status); void setGoogleVerified(bool ok, bool alert, S32 status); void setDeepLVerified(bool ok, bool alert, S32 status); - void onClose(bool app_quitting); + void onClose(bool app_quitting) override; private: std::string getSelectedService() const; diff --git a/indra/newview/llfloateruipreview.cpp b/indra/newview/llfloateruipreview.cpp index b2de352793..69459a4e98 100644 --- a/indra/newview/llfloateruipreview.cpp +++ b/indra/newview/llfloateruipreview.cpp @@ -139,23 +139,23 @@ public: virtual ~LLFloaterUIPreview(); std::string getLocStr(S32 ID); // fetches the localization string based on what is selected in the drop-down menu - void displayFloater(BOOL click, S32 ID); // needs to be public so live file can call it when it finds an update + void displayFloater(bool click, S32 ID); // needs to be public so live file can call it when it finds an update - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void onClose(bool app_quitting); void refreshList(); // refresh list (empty it out and fill it up from scratch) void addFloaterEntry(const std::string& path); // add a single file's entry to the list of floaters - static BOOL containerType(LLView* viewp); // check if the element is a container type and tree traverses need to look at its children + static bool containerType(LLView* viewp); // check if the element is a container type and tree traverses need to look at its children public: LLPreviewedFloater* mDisplayedFloater; // the floater which is currently being displayed LLPreviewedFloater* mDisplayedFloater_2; // the floater which is currently being displayed LLGUIPreviewLiveFile* mLiveFile; // live file for checking for updates to the currently-displayed XML file LLOverlapPanel* mOverlapPanel; // custom overlapping elements panel - // BOOL mHighlightingDiffs; // bool for whether localization diffs are being highlighted or not - BOOL mHighlightingOverlaps; // bool for whether overlapping elements are being highlighted + // bool mHighlightingDiffs; // bool for whether localization diffs are being highlighted or not + bool mHighlightingOverlaps; // bool for whether overlapping elements are being highlighted // typedef std::map<std::string,std::pair<std::list<std::string>,std::list<std::string> > > DiffMap; // this version copies the lists etc., and thus is bad memory-wise typedef std::list<std::string> StringList; @@ -196,11 +196,11 @@ private: void highlightChangedElements(); // look up the list of elements to highlight and highlight them in the current floater void highlightChangedFiles(); // look up the list of changed files to highlight and highlight them in the scroll list void findOverlapsInChildren(LLView* parent); // fill the map below with element overlap information - static BOOL overlapIgnorable(LLView* viewp); // check it the element can be ignored for overlap/localization purposes + static bool overlapIgnorable(LLView* viewp); // check it the element can be ignored for overlap/localization purposes // check if two elements overlap using their rectangles // used instead of llrect functions because by adding a few pixels of leeway I can cut down drastically on the number of overlaps - BOOL elementOverlap(LLView* view1, LLView* view2); + bool elementOverlap(LLView* view1, LLView* view2); // Button/drop-down action listeners (self explanatory) void onClickDisplayFloater(S32 id); @@ -244,7 +244,7 @@ public: virtual ~LLGUIPreviewLiveFile(); LLFloaterUIPreview* mParent; LLFadeEventTimer* mFadeTimer; // timer for fade-to-yellow-and-back effect to warn that file has been reloaded - BOOL mFirstFade; // setting this avoids showing the fade reload warning on first load + bool mFirstFade; // setting this avoids showing the fade reload warning on first load std::string mFileName; protected: bool loadFile(); @@ -255,10 +255,10 @@ class LLFadeEventTimer : public LLEventTimer { public: LLFadeEventTimer(F32 refresh, LLGUIPreviewLiveFile* parent); - BOOL tick(); + bool tick(); LLGUIPreviewLiveFile* mParent; private: - BOOL mFadingOut; // fades in then out; this is toggled in between + bool mFadingOut; // fades in then out; this is toggled in between LLColor4 mOriginalColor; // original color; color is reset to this after fade is coimplete }; @@ -274,9 +274,9 @@ public: } virtual void draw(); - BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - BOOL handleToolTip(S32 x, S32 y, MASK mask); - BOOL selectElement(LLView* parent, int x, int y, int depth); // select element to display its overlappers + bool handleRightMouseDown(S32 x, S32 y, MASK mask); + bool handleToolTip(S32 x, S32 y, MASK mask); + bool selectElement(LLView* parent, int x, int y, int depth); // select element to display its overlappers LLFloaterUIPreview* mFloaterUIPreview; @@ -312,7 +312,7 @@ LLLocalizationResetForcer::~LLLocalizationResetForcer() LLGUIPreviewLiveFile::LLGUIPreviewLiveFile(std::string path, std::string name, LLFloaterUIPreview* parent) : mFileName(name), mParent(parent), - mFirstFade(TRUE), + mFirstFade(true), mFadeTimer(NULL), LLLiveFile(path, 1.0) {} @@ -330,10 +330,10 @@ LLGUIPreviewLiveFile::~LLGUIPreviewLiveFile() // Live file load bool LLGUIPreviewLiveFile::loadFile() { - mParent->displayFloater(FALSE,1); // redisplay the floater - if(mFirstFade) // only fade if it wasn't just clicked on; can't use "clicked" BOOL below because of an oddity with setting LLLiveFile initial state + mParent->displayFloater(false,1); // redisplay the floater + if(mFirstFade) // only fade if it wasn't just clicked on; can't use "clicked" bool below because of an oddity with setting LLLiveFile initial state { - mFirstFade = FALSE; + mFirstFade = false; } else { @@ -349,24 +349,24 @@ bool LLGUIPreviewLiveFile::loadFile() // Initialize fade event timer LLFadeEventTimer::LLFadeEventTimer(F32 refresh, LLGUIPreviewLiveFile* parent) : mParent(parent), - mFadingOut(TRUE), + mFadingOut(true), LLEventTimer(refresh) { mOriginalColor = mParent->mParent->mDisplayedFloater->getBackgroundColor(); } // Single tick of fade event timer: increment the color -BOOL LLFadeEventTimer::tick() +bool LLFadeEventTimer::tick() { float diff = 0.04f; - if(TRUE == mFadingOut) // set fade for in/out color direction + if(true == mFadingOut) // set fade for in/out color direction { diff = -diff; } if(NULL == mParent) // no more need to tick, so suicide { - return TRUE; + return true; } // Set up colors @@ -386,10 +386,10 @@ BOOL LLFadeEventTimer::tick() if(bg_color[2] <= 0.0f) // end of fade out, start fading in { - mFadingOut = FALSE; + mFadingOut = false; } - return FALSE; + return false; } // Constructor @@ -398,8 +398,8 @@ LLFloaterUIPreview::LLFloaterUIPreview(const LLSD& key) mDisplayedFloater(NULL), mDisplayedFloater_2(NULL), mLiveFile(NULL), - // sHighlightingDiffs(FALSE), - mHighlightingOverlaps(FALSE), + // sHighlightingDiffs(false), + mHighlightingOverlaps(false), mLastDisplayedX(0), mLastDisplayedY(0) { @@ -424,7 +424,7 @@ LLFloaterUIPreview::~LLFloaterUIPreview() } // Perform post-build setup (defined in superclass) -BOOL LLFloaterUIPreview::postBuild() +bool LLFloaterUIPreview::postBuild() { LLPanel* main_panel_tmp = getChild<LLPanel>("main_panel"); // get a pointer to the main panel in order to... mFileList = main_panel_tmp->getChild<LLScrollListCtrl>("name_list"); // save pointer to file list @@ -482,8 +482,8 @@ BOOL LLFloaterUIPreview::postBuild() mDelim = gDirUtilp->getDirDelimiter(); // initialize delimiter to dir sep slash // refresh list of available languages (EN will still be default) - BOOL found = TRUE; - BOOL found_en_us = FALSE; + bool found = true; + bool found_en_us = false; std::string language_directory; std::string xui_dir = get_xui_dir(); // directory containing localizations -- don't forget trailing delim mLanguageSelection->removeall(); // clear out anything temporarily in list from XML @@ -503,7 +503,7 @@ BOOL LLFloaterUIPreview::postBuild() { if(!strncmp("en",language_directory.c_str(),5)) // remember if we've seen en, so we can make it default { - found_en_us = TRUE; + found_en_us = true; } else { @@ -528,7 +528,7 @@ BOOL LLFloaterUIPreview::postBuild() refreshList(); // refresh the list of available floaters - return TRUE; + return true; } // Callback for language combo box selection: refresh current floater when you change languages @@ -542,7 +542,7 @@ void LLFloaterUIPreview::onLanguageComboSelect(LLUICtrl* ctrl) if(mDisplayedFloater) { onClickCloseDisplayedFloater(PRIMARY_FLOATER); - displayFloater(TRUE,1); + displayFloater(true,1); } } else @@ -550,7 +550,7 @@ void LLFloaterUIPreview::onLanguageComboSelect(LLUICtrl* ctrl) if(mDisplayedFloater_2) { onClickCloseDisplayedFloater(PRIMARY_FLOATER); - displayFloater(TRUE,2); // *TODO: make take an arg + displayFloater(true,2); // *TODO: make take an arg } } @@ -642,7 +642,7 @@ void LLFloaterUIPreview::refreshList() // Note: the mask doesn't seem to accept regular expressions, so there need to be two directory searches here mFileList->clearRows(); // empty list std::string name; - BOOL found = TRUE; + bool found = true; LLDirIterator floater_iter(getLocalizedDirectory(), "floater_*.xml"); while(found) // for every floater file that matches the pattern @@ -652,7 +652,7 @@ void LLFloaterUIPreview::refreshList() addFloaterEntry(name.c_str()); // and add it to the list (file name only; localization code takes care of rest of path) } } - found = TRUE; + found = true; LLDirIterator inspect_iter(getLocalizedDirectory(), "inspect_*.xml"); while(found) // for every inspector file that matches the pattern @@ -662,7 +662,7 @@ void LLFloaterUIPreview::refreshList() addFloaterEntry(name.c_str()); // and add it to the list (file name only; localization code takes care of rest of path) } } - found = TRUE; + found = true; LLDirIterator menu_iter(getLocalizedDirectory(), "menu_*.xml"); while(found) // for every menu file that matches the pattern @@ -672,7 +672,7 @@ void LLFloaterUIPreview::refreshList() addFloaterEntry(name.c_str()); // and add it to the list (file name only; localization code takes care of rest of path) } } - found = TRUE; + found = true; LLDirIterator panel_iter(getLocalizedDirectory(), "panel_*.xml"); while(found) // for every panel file that matches the pattern @@ -682,7 +682,7 @@ void LLFloaterUIPreview::refreshList() addFloaterEntry(name.c_str()); // and add it to the list (file name only; localization code takes care of rest of path) } } - found = TRUE; + found = true; LLDirIterator sidepanel_iter(getLocalizedDirectory(), "sidepanel_*.xml"); while(found) // for every sidepanel file that matches the pattern @@ -715,7 +715,7 @@ void LLFloaterUIPreview::addFloaterEntry(const std::string& path) // Get name of floater: LLXmlTree xml_tree; std::string full_path = getLocalizedDirectory() + path; // get full path - BOOL success = xml_tree.parseFile(full_path.c_str(), TRUE); // parse xml + bool success = xml_tree.parseFile(full_path.c_str(), true); // parse xml std::string entry_name; std::string entry_title; if(success) @@ -772,13 +772,13 @@ void LLFloaterUIPreview::addFloaterEntry(const std::string& path) // Respond to button click to display/refresh currently-selected floater void LLFloaterUIPreview::onClickDisplayFloater(S32 caller_id) { - displayFloater(TRUE, caller_id); + displayFloater(true, caller_id); } // Saves the current floater/panel void LLFloaterUIPreview::onClickSaveFloater(S32 caller_id) { - displayFloater(TRUE, caller_id); + displayFloater(true, caller_id); popupAndPrintWarning("Save-floater functionality removed, use XML schema to clean up XUI files"); } @@ -790,7 +790,7 @@ void LLFloaterUIPreview::onClickSaveAll(S32 caller_id) for (int index = 0; index < listSize; index++) { mFileList->selectNthItem(index); - displayFloater(TRUE, caller_id); + displayFloater(true, caller_id); } popupAndPrintWarning("Save-floater functionality removed, use XML schema to clean up XUI files"); } @@ -798,7 +798,7 @@ void LLFloaterUIPreview::onClickSaveAll(S32 caller_id) // Actually display the floater // Only set up a new live file if this came from a click (at which point there should be no existing live file), rather than from the live file's update itself; // otherwise, we get an infinite loop as the live file keeps recreating itself. That means this function is generally called twice. -void LLFloaterUIPreview::displayFloater(BOOL click, S32 ID) +void LLFloaterUIPreview::displayFloater(bool click, S32 ID) { // Convince UI that we're in a different language (the one selected on the drop-down menu) LLLocalizationResetForcer reset_forcer(this, ID); // save old language in reset forcer object (to be reset upon destruction when it falls out of scope) @@ -806,7 +806,7 @@ void LLFloaterUIPreview::displayFloater(BOOL click, S32 ID) LLPreviewedFloater** floaterp = (ID == 1 ? &(mDisplayedFloater) : &(mDisplayedFloater_2)); if(ID == 1) { - BOOL floater_already_open = mDisplayedFloater != NULL; + bool floater_already_open = mDisplayedFloater != NULL; if(floater_already_open) // if we are already displaying a floater { mLastDisplayedX = mDisplayedFloater->calcScreenRect().mLeft; // save floater's last known position to put the new one there @@ -860,7 +860,7 @@ void LLFloaterUIPreview::displayFloater(BOOL click, S32 ID) panel->buildFromFile(path); // build it panel->setOrigin(2,2); // reset its origin point so it's not offset by -left or other XUI attributes (*floaterp)->setTitle(path); // use the file name as its title, since panels have no guaranteed meaningful name attribute - panel->setUseBoundingRect(TRUE); // enable the use of its outer bounding rect (normally disabled because it's O(n) on the number of sub-elements) + panel->setUseBoundingRect(true); // enable the use of its outer bounding rect (normally disabled because it's O(n) on the number of sub-elements) panel->updateBoundingRect(); // update bounding rect LLRect bounding_rect = panel->getBoundingRect(); // get the bounding rect LLRect new_rect = panel->getRect(); // get the panel's rect @@ -880,15 +880,15 @@ void LLFloaterUIPreview::displayFloater(BOOL click, S32 ID) // *HACK: Remove ability to close it; if you close it, its destructor gets called, but we don't know it's null and try to delete it again, // resulting in a double free - (*floaterp)->setCanClose(FALSE); + (*floaterp)->setCanClose(false); if(ID == 1) { - mCloseOtherButton->setEnabled(TRUE); // enable my floater's close button + mCloseOtherButton->setEnabled(true); // enable my floater's close button } else { - mCloseOtherButton_2->setEnabled(TRUE); + mCloseOtherButton_2->setEnabled(true); } // Add localization to title so user knows whether it's localized or defaulted to en @@ -921,7 +921,7 @@ void LLFloaterUIPreview::displayFloater(BOOL click, S32 ID) if(ID == 1) { - mToggleOverlapButton->setEnabled(TRUE); + mToggleOverlapButton->setEnabled(true); } if(LLView::sHighlightingDiffs && click && ID == 1) @@ -1035,7 +1035,7 @@ void LLFloaterUIPreview::getExecutablePath(const std::vector<std::string>& filen #if LL_DARWIN // on Mac, if it's an application bundle, figure out the actual path from the Info.plist file CFStringRef path_cfstr = CFStringCreateWithCString(kCFAllocatorDefault, chosen_path.c_str(), kCFStringEncodingMacRoman); // get path as a CFStringRef - CFURLRef path_url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, path_cfstr, kCFURLPOSIXPathStyle, TRUE); // turn it into a CFURLRef + CFURLRef path_url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, path_cfstr, kCFURLPOSIXPathStyle, true); // turn it into a CFURLRef CFBundleRef chosen_bundle = CFBundleCreate(kCFAllocatorDefault, path_url); // get a handle for the bundle if(NULL != chosen_bundle) { @@ -1114,13 +1114,13 @@ void LLFloaterUIPreview::onClickToggleDiffHighlighting() { // Get the file and make sure it exists std::string path_in_textfield = mDiffPathTextBox->getText(); // get file path - BOOL error = FALSE; + bool error = false; if(std::string("") == path_in_textfield) // check for blank file { std::string warning = "Unable to highlight differences because no file was provided; fill in the relevant text field"; popupAndPrintWarning(warning); - error = TRUE; + error = true; } llstat dummy; @@ -1128,13 +1128,13 @@ void LLFloaterUIPreview::onClickToggleDiffHighlighting() { std::string warning = std::string("Unable to highlight differences because an invalid path to a difference file was provided:\"") + path_in_textfield + "\""; popupAndPrintWarning(warning); - error = TRUE; + error = true; } // Build a list of changed elements as given by the XML std::list<std::string> changed_element_names; LLXmlTree xml_tree; - BOOL success = xml_tree.parseFile(path_in_textfield.c_str(), TRUE); + bool success = xml_tree.parseFile(path_in_textfield.c_str(), true); if(success && !error) { @@ -1164,7 +1164,7 @@ void LLFloaterUIPreview::onClickToggleDiffHighlighting() { std::string warning = std::string("Child was neither a file or an error, but rather the following:\"") + std::string(child->getName()) + "\""; popupAndPrintWarning(warning); - error = TRUE; + error = true; break; } } @@ -1173,19 +1173,19 @@ void LLFloaterUIPreview::onClickToggleDiffHighlighting() { std::string warning = std::string("Root node not named XuiDelta:\"") + path_in_textfield + "\""; popupAndPrintWarning(warning); - error = TRUE; + error = true; } } else if(!error) { std::string warning = std::string("Unable to create tree from XML:\"") + path_in_textfield + "\""; popupAndPrintWarning(warning); - error = TRUE; + error = true; } if(error) // if we encountered an error, reset the button to off { - mToggleHighlightButton->setToggleState(FALSE); + mToggleHighlightButton->setToggleState(false); } else // only toggle if we didn't encounter an error { @@ -1259,17 +1259,17 @@ void LLFloaterUIPreview::highlightChangedElements() boost::char_separator<char> sep("."); tokenizer tokens(*iter, sep); tokenizer::iterator token_iter; - BOOL failed = FALSE; + bool failed = false; for(token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter) { - element = element->findChild<LLView>(*token_iter,FALSE); // try to find element: don't recur, and don't create if missing + element = element->findChild<LLView>(*token_iter,false); // try to find element: don't recur, and don't create if missing // if we still didn't find it... if(NULL == element) { LL_INFOS() << "Unable to find element in XuiDelta file named \"" << *iter << "\" in file \"" << mLiveFile->mFileName << "\". The element may no longer exist, the path may be incorrect, or it may not be a non-displayable element (not an LLView) such as a \"string\" type." << LL_ENDL; - failed = TRUE; + failed = true; break; } } @@ -1302,10 +1302,10 @@ void LLFloaterUIPreview::highlightChangedFiles() { for(DiffMap::iterator iter = mDiffsMap.begin(); iter != mDiffsMap.end(); ++iter) // for every file listed in diffs { - LLScrollListItem* item = mFileList->getItemByLabel(std::string(iter->first), FALSE, 1); + LLScrollListItem* item = mFileList->getItemByLabel(std::string(iter->first), false, 1); if(item) { - item->setHighlighted(TRUE); + item->setHighlighted(true); } } } @@ -1315,8 +1315,8 @@ void LLFloaterUIPreview::onClickCloseDisplayedFloater(S32 caller_id) { if(caller_id == PRIMARY_FLOATER) { - mCloseOtherButton->setEnabled(FALSE); - mToggleOverlapButton->setEnabled(FALSE); + mCloseOtherButton->setEnabled(false); + mToggleOverlapButton->setEnabled(false); if(mDisplayedFloater) { @@ -1343,7 +1343,7 @@ void LLFloaterUIPreview::onClickCloseDisplayedFloater(S32 caller_id) } else { - mCloseOtherButton_2->setEnabled(FALSE); + mCloseOtherButton_2->setEnabled(false); delete mDisplayedFloater_2; mDisplayedFloater_2 = NULL; } @@ -1370,7 +1370,7 @@ void append_view_tooltip(LLView* tooltip_view, std::string *tooltip_msg) tooltip_msg->append( msg ); } -BOOL LLPreviewedFloater::handleToolTip(S32 x, S32 y, MASK mask) +bool LLPreviewedFloater::handleToolTip(S32 x, S32 y, MASK mask) { if (!sShowRectangles) { @@ -1414,13 +1414,13 @@ BOOL LLPreviewedFloater::handleToolTip(S32 x, S32 y, MASK mask) LLToolTipMgr::instance().show(LLToolTip::Params() .message(tooltip_msg) .max_width(400)); - return TRUE; + return true; } -BOOL LLPreviewedFloater::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLPreviewedFloater::handleRightMouseDown(S32 x, S32 y, MASK mask) { selectElement(this,x,y,0); - return TRUE; + return true; } // *NOTE: In order to hide all of the overlapping elements of the selected element so as to see it in context, here is what you would need to do: @@ -1428,15 +1428,15 @@ BOOL LLPreviewedFloater::handleRightMouseDown(S32 x, S32 y, MASK mask) // what you've really selected is a list of elements: the one you clicked on and everything that overlaps it. // -The user then selects one of the elements from this list the overlap panel (click handling to the overlap panel would have to be added). // This becomes the final selection (as opposed to the intermediate selection that was just made). -// -Everything else that is currently displayed on the overlap panel should be hidden from view in the previewed floater itself (setVisible(FALSE)). +// -Everything else that is currently displayed on the overlap panel should be hidden from view in the previewed floater itself (setVisible(false)). // -Subsequent clicks on other elements in the overlap panel (they should still be there) should make other elements the final selection. // -On close or on the click of a new button, everything should be shown again and all selection state should be cleared. // ~Jacob, 8/08 -BOOL LLPreviewedFloater::selectElement(LLView* parent, int x, int y, int depth) +bool LLPreviewedFloater::selectElement(LLView* parent, int x, int y, int depth) { if(getVisible()) { - BOOL handled = FALSE; + bool handled = false; if(LLFloaterUIPreview::containerType(parent)) { for(child_list_const_iter_t child_it = parent->getChildList()->begin(); child_it != parent->getChildList()->end(); ++child_it) @@ -1448,7 +1448,7 @@ BOOL LLPreviewedFloater::selectElement(LLView* parent, int x, int y, int depth) child->getVisible() && selectElement(child, x, y, ++depth)) { - handled = TRUE; + handled = true; break; } } @@ -1458,11 +1458,11 @@ BOOL LLPreviewedFloater::selectElement(LLView* parent, int x, int y, int depth) { LLView::sPreviewClickedElement = parent; } - return TRUE; + return true; } else { - return FALSE; + return false; } } @@ -1473,7 +1473,7 @@ void LLPreviewedFloater::draw() // Set and unset sDrawPreviewHighlights flag so as to avoid using two flags if(mFloaterUIPreview->mHighlightingOverlaps) { - LLView::sDrawPreviewHighlights = TRUE; + LLView::sDrawPreviewHighlights = true; } // If we're looking for truncations, draw debug rects for the displayed @@ -1493,7 +1493,7 @@ void LLPreviewedFloater::draw() if(mFloaterUIPreview->mHighlightingOverlaps) { - LLView::sDrawPreviewHighlights = FALSE; + LLView::sDrawPreviewHighlights = false; } } } @@ -1519,7 +1519,7 @@ void LLFloaterUIPreview::onClickToggleOverlapping() else { mHighlightingOverlaps = !mHighlightingOverlaps; - displayFloater(FALSE,1); + displayFloater(false,1); setRect(LLRect(getRect().mLeft,getRect().mTop,getRect().mRight + mOverlapPanel->getRect().getWidth(),getRect().mBottom)); setResizeLimits(width + mOverlapPanel->getRect().getWidth(), height); } @@ -1564,7 +1564,7 @@ void LLFloaterUIPreview::findOverlapsInChildren(LLView* parent) // *HACK: don't overlap with the drag handle and various other elements // This is using dynamic casts because there is no object-oriented way to tell which elements contain localizable text. These are a few that are ignorable. // *NOTE: If a list of elements which have localizable content were created, this function should return false if viewp's class is in that list. -BOOL LLFloaterUIPreview::overlapIgnorable(LLView* viewp) +bool LLFloaterUIPreview::overlapIgnorable(LLView* viewp) { return NULL != dynamic_cast<LLDragHandle*>(viewp) || NULL != dynamic_cast<LLViewBorder*>(viewp) || @@ -1573,13 +1573,13 @@ BOOL LLFloaterUIPreview::overlapIgnorable(LLView* viewp) // *HACK: these are the only two container types as of 8/08, per Richard // This is using dynamic casts because there is no object-oriented way to tell which elements are containers. -BOOL LLFloaterUIPreview::containerType(LLView* viewp) +bool LLFloaterUIPreview::containerType(LLView* viewp) { return NULL != dynamic_cast<LLPanel*>(viewp) || NULL != dynamic_cast<LLLayoutStack*>(viewp); } // Check if two llview's rectangles overlap, with some tolerance -BOOL LLFloaterUIPreview::elementOverlap(LLView* view1, LLView* view2) +bool LLFloaterUIPreview::elementOverlap(LLView* view1, LLView* view2) { LLSD rec1 = view1->getRect().getValue(); LLSD rec2 = view2->getRect().getValue(); @@ -1600,7 +1600,7 @@ void LLOverlapPanel::draw() if(!LLView::sPreviewClickedElement) { LLUI::translate(5,getRect().getHeight()-20); // translate to top-5,left-5 - LLView::sDrawPreviewHighlights = FALSE; + LLView::sDrawPreviewHighlights = false; LLFontGL::getFontSansSerifSmall()->renderUTF8(current_selection_text, 0, 0, 0, text_color, LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::NORMAL, LLFontGL::NO_SHADOW); } @@ -1616,7 +1616,7 @@ void LLOverlapPanel::draw() if(overlappers.size() == 0) { LLUI::translate(5,getRect().getHeight()-20); // translate to top-5,left-5 - LLView::sDrawPreviewHighlights = FALSE; + LLView::sDrawPreviewHighlights = false; std::string current_selection = std::string(current_selection_text + LLView::sPreviewClickedElement->getName() + " (no elements overlap)"); S32 text_width = LLFontGL::getFontSansSerifSmall()->getWidth(current_selection) + 10; LLFontGL::getFontSansSerifSmall()->renderUTF8(current_selection, 0, 0, 0, text_color, @@ -1628,10 +1628,10 @@ void LLOverlapPanel::draw() } // recalculate required with and height; otherwise use cached - BOOL need_to_recalculate_bounds = FALSE; + bool need_to_recalculate_bounds = false; if(mLastClickedElement == NULL) { - need_to_recalculate_bounds = TRUE; + need_to_recalculate_bounds = true; } if(NULL == mLastClickedElement) @@ -1681,7 +1681,7 @@ void LLOverlapPanel::draw() } LLUI::translate(5,getRect().getHeight()-10); // translate to top left - LLView::sDrawPreviewHighlights = FALSE; + LLView::sDrawPreviewHighlights = false; // draw currently-selected element at top of overlappers LLUI::translate(0,-mSpacing); diff --git a/indra/newview/llfloaterurlentry.cpp b/indra/newview/llfloaterurlentry.cpp index 6d75c4eb94..7651b2528f 100644 --- a/indra/newview/llfloaterurlentry.cpp +++ b/indra/newview/llfloaterurlentry.cpp @@ -60,7 +60,7 @@ LLFloaterURLEntry::~LLFloaterURLEntry() sInstance = NULL; } -BOOL LLFloaterURLEntry::postBuild() +bool LLFloaterURLEntry::postBuild() { mMediaURLEdit = getChild<LLComboBox>("media_entry"); @@ -71,7 +71,7 @@ BOOL LLFloaterURLEntry::postBuild() childSetAction("clear_btn", onBtnClear, this); // clear media list button LLSD parcel_history = LLURLHistory::getURLHistory("parcel"); - bool enable_clear_button = parcel_history.size() > 0 ? true : false; + bool enable_clear_button = parcel_history.size() > 0; getChildView("clear_btn")->setEnabled(enable_clear_button ); // OK button @@ -80,7 +80,7 @@ BOOL LLFloaterURLEntry::postBuild() setDefaultBtn("ok_btn"); buildURLHistory(); - return TRUE; + return true; } void LLFloaterURLEntry::buildURLHistory() { diff --git a/indra/newview/llfloaterurlentry.h b/indra/newview/llfloaterurlentry.h index 8118803422..d8cd946279 100644 --- a/indra/newview/llfloaterurlentry.h +++ b/indra/newview/llfloaterurlentry.h @@ -41,8 +41,8 @@ public: // Can only be shown by LLPanelLandMedia, and pushes data back into // that panel via the handle. static LLHandle<LLFloater> show(LLHandle<LLPanel> panel_land_media_handle, const std::string media_url); - /*virtual*/ BOOL postBuild(); - /*virtual*/ void onClose( bool app_quitting ); + bool postBuild() override; + void onClose( bool app_quitting ) override; void headerFetchComplete(S32 status, const std::string& mime_type); bool addURLToCombobox(const std::string& media_url); diff --git a/indra/newview/llfloatervoiceeffect.cpp b/indra/newview/llfloatervoiceeffect.cpp index 4bde73c7ec..9f7c9aba87 100644 --- a/indra/newview/llfloatervoiceeffect.cpp +++ b/indra/newview/llfloatervoiceeffect.cpp @@ -56,7 +56,7 @@ LLFloaterVoiceEffect::~LLFloaterVoiceEffect() } // virtual -BOOL LLFloaterVoiceEffect::postBuild() +bool LLFloaterVoiceEffect::postBuild() { setDefaultBtn("record_btn"); getChild<LLButton>("record_btn")->setFocus(true); @@ -81,7 +81,7 @@ BOOL LLFloaterVoiceEffect::postBuild() refreshEffectList(); updateControls(); - return TRUE; + return true; } // virtual diff --git a/indra/newview/llfloatervoiceeffect.h b/indra/newview/llfloatervoiceeffect.h index f45c46dcd9..323beb64ae 100644 --- a/indra/newview/llfloatervoiceeffect.h +++ b/indra/newview/llfloatervoiceeffect.h @@ -44,8 +44,8 @@ public: LLFloaterVoiceEffect(const LLSD& key); virtual ~LLFloaterVoiceEffect(); - virtual BOOL postBuild(); - virtual void onClose(bool app_quitting); + bool postBuild() override; + void onClose(bool app_quitting) override; private: enum ColumnIndex @@ -58,7 +58,7 @@ private: void updateControls(); /// Called by voice effect provider when voice effect list is changed. - virtual void onVoiceEffectChanged(bool effect_list_updated); + virtual void onVoiceEffectChanged(bool effect_list_updated) override; void onClickRecord(); void onClickPlay(); diff --git a/indra/newview/llfloatervoicevolume.cpp b/indra/newview/llfloatervoicevolume.cpp index ec1a09f877..17783ee810 100644 --- a/indra/newview/llfloatervoicevolume.cpp +++ b/indra/newview/llfloatervoicevolume.cpp @@ -60,7 +60,7 @@ public: LLFloaterVoiceVolume(const LLSD& avatar_id); virtual ~LLFloaterVoiceVolume(); - /*virtual*/ BOOL postBuild(void); + /*virtual*/ bool postBuild(void); // Because floater is single instance, need to re-parse data on each spawn // (for example, inspector about same avatar but in different position) @@ -104,7 +104,7 @@ LLFloaterVoiceVolume::~LLFloaterVoiceVolume() } /*virtual*/ -BOOL LLFloaterVoiceVolume::postBuild(void) +bool LLFloaterVoiceVolume::postBuild(void) { getChild<LLUICtrl>("mute_btn")->setCommitCallback( boost::bind(&LLFloaterVoiceVolume::onClickMuteVolume, this) ); @@ -112,7 +112,7 @@ BOOL LLFloaterVoiceVolume::postBuild(void) getChild<LLUICtrl>("volume_slider")->setCommitCallback( boost::bind(&LLFloaterVoiceVolume::onVolumeChange, this, _2)); - return TRUE; + return true; } diff --git a/indra/newview/llfloaterwebcontent.cpp b/indra/newview/llfloaterwebcontent.cpp index 71f1181566..f5b5b8293f 100644 --- a/indra/newview/llfloaterwebcontent.cpp +++ b/indra/newview/llfloaterwebcontent.cpp @@ -84,7 +84,7 @@ LLFloaterWebContent::LLFloaterWebContent( const Params& params ) mCommitCallbackRegistrar.add( "WebContent.TestURL", boost::bind(&LLFloaterWebContent::onTestURL, this, _2)); } -BOOL LLFloaterWebContent::postBuild() +bool LLFloaterWebContent::postBuild() { // these are used in a bunch of places so cache them mWebBrowser = getChild< LLMediaCtrl >( "webbrowser" ); @@ -111,7 +111,7 @@ BOOL LLFloaterWebContent::postBuild() // initialize the URL history using the system URL History manager initializeURLHistory(); - return TRUE; + return true; } void LLFloaterWebContent::initializeURLHistory() diff --git a/indra/newview/llfloaterwebcontent.h b/indra/newview/llfloaterwebcontent.h index e4f8cf4279..9bb6d73e5e 100644 --- a/indra/newview/llfloaterwebcontent.h +++ b/indra/newview/llfloaterwebcontent.h @@ -77,7 +77,7 @@ public: static void geometryChanged(const std::string &uuid, S32 x, S32 y, S32 width, S32 height); void geometryChanged(S32 x, S32 y, S32 width, S32 height); - /* virtual */ BOOL postBuild(); + /* virtual */ bool postBuild(); /* virtual */ void onOpen(const LLSD& key); /* virtual */ bool matchesKey(const LLSD& key); /* virtual */ void onClose(bool app_quitting); diff --git a/indra/newview/llfloaterwhitelistentry.cpp b/indra/newview/llfloaterwhitelistentry.cpp index d0ad176625..ca6c34484a 100644 --- a/indra/newview/llfloaterwhitelistentry.cpp +++ b/indra/newview/llfloaterwhitelistentry.cpp @@ -51,7 +51,7 @@ LLFloaterWhiteListEntry::~LLFloaterWhiteListEntry() /////////////////////////////////////////////////////////////////////////////// // -BOOL LLFloaterWhiteListEntry::postBuild() +bool LLFloaterWhiteListEntry::postBuild() { mWhiteListEdit = getChild<LLLineEditor>("whitelist_entry"); @@ -60,7 +60,7 @@ BOOL LLFloaterWhiteListEntry::postBuild() setDefaultBtn("ok_btn"); - return TRUE; + return true; } /////////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llfloaterwhitelistentry.h b/indra/newview/llfloaterwhitelistentry.h index 9e4e6b381c..bb6944635b 100644 --- a/indra/newview/llfloaterwhitelistentry.h +++ b/indra/newview/llfloaterwhitelistentry.h @@ -38,7 +38,7 @@ class LLFloaterWhiteListEntry : LLFloaterWhiteListEntry(const LLSD& key); ~LLFloaterWhiteListEntry(); - BOOL postBuild(); + bool postBuild() override; private: LLLineEditor* mWhiteListEdit; diff --git a/indra/newview/llfloaterwindowsize.cpp b/indra/newview/llfloaterwindowsize.cpp index 1ae7ea9692..442695c3bc 100644 --- a/indra/newview/llfloaterwindowsize.cpp +++ b/indra/newview/llfloaterwindowsize.cpp @@ -63,7 +63,7 @@ LLFloaterWindowSize::LLFloaterWindowSize(const LLSD& key) LLFloaterWindowSize::~LLFloaterWindowSize() {} -BOOL LLFloaterWindowSize::postBuild() +bool LLFloaterWindowSize::postBuild() { center(); initWindowSizeControls(); @@ -72,7 +72,7 @@ BOOL LLFloaterWindowSize::postBuild() getChild<LLUICtrl>("cancel_btn")->setCommitCallback( boost::bind(&LLFloaterWindowSize::onClickCancel, this)); setDefaultBtn("set_btn"); - return TRUE; + return true; } void LLFloaterWindowSize::initWindowSizeControls() diff --git a/indra/newview/llfloaterwindowsize.h b/indra/newview/llfloaterwindowsize.h index aabbe401d7..49bd08e549 100644 --- a/indra/newview/llfloaterwindowsize.h +++ b/indra/newview/llfloaterwindowsize.h @@ -40,7 +40,7 @@ private: virtual ~LLFloaterWindowSize(); public: - /*virtual*/ BOOL postBuild(); + bool postBuild() override; void initWindowSizeControls(); void onClickSet(); void onClickCancel(); diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index bb4ae7e8ab..2a72a361d6 100755 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -209,7 +209,7 @@ public: //Get the ID LLUUID id; - if (!id.set( params[0], FALSE )) + if (!id.set( params[0], false )) { return false; } @@ -278,9 +278,9 @@ LLFloaterWorldMap::LLFloaterWorldMap(const LLSD& key) mFriendObserver(NULL), mCompletingRegionName(), mCompletingRegionPos(), - mWaitingForTracker(FALSE), - mIsClosing(FALSE), - mSetToUserPosition(TRUE), + mWaitingForTracker(false), + mIsClosing(false), + mSetToUserPosition(true), mTrackedLocation(0,0,0), mTrackedStatus(LLTracker::TRACKING_NOTHING), mListFriendCombo(NULL), @@ -312,7 +312,7 @@ void* LLFloaterWorldMap::createWorldMapView(void* data) return new LLWorldMapView(); } -BOOL LLFloaterWorldMap::postBuild() +bool LLFloaterWorldMap::postBuild() { mMapView = dynamic_cast<LLWorldMapView*>(getChild<LLPanel>("objects_mapview")); mMapView->setPan(0, 0, true); @@ -345,7 +345,7 @@ BOOL LLFloaterWorldMap::postBuild() onChangeMaturity(); - return TRUE; + return true; } // virtual @@ -388,7 +388,7 @@ void LLFloaterWorldMap::onOpen(const LLSD& key) bool center_on_target = (key.asString() == "center"); - mIsClosing = FALSE; + mIsClosing = false; mMapView->clearLastClick(); @@ -414,7 +414,7 @@ void LLFloaterWorldMap::onOpen(const LLSD& key) const LLUUID landmark_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK); LLInventoryModelBackgroundFetch::instance().start(landmark_folder_id); - getChild<LLUICtrl>("location")->setFocus( TRUE); + getChild<LLUICtrl>("location")->setFocus( true); gFocusMgr.triggerFocusFlash(); buildAvatarIDList(); @@ -426,7 +426,7 @@ void LLFloaterWorldMap::onOpen(const LLSD& key) if (center_on_target) { - centerOnTarget(FALSE); + centerOnTarget(false); } } @@ -437,14 +437,14 @@ void LLFloaterWorldMap::reloadIcons(void*) } // virtual -BOOL LLFloaterWorldMap::handleHover(S32 x, S32 y, MASK mask) +bool LLFloaterWorldMap::handleHover(S32 x, S32 y, MASK mask) { - BOOL handled; + bool handled; handled = LLFloater::handleHover(x, y, mask); return handled; } -BOOL LLFloaterWorldMap::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLFloaterWorldMap::handleScrollWheel(S32 x, S32 y, S32 clicks) { if (!isMinimized() && isFrontmost()) { @@ -465,7 +465,7 @@ BOOL LLFloaterWorldMap::handleScrollWheel(S32 x, S32 y, S32 clicks) // virtual -void LLFloaterWorldMap::reshape( S32 width, S32 height, BOOL called_from_parent ) +void LLFloaterWorldMap::reshape( S32 width, S32 height, bool called_from_parent ) { LLFloater::reshape( width, height, called_from_parent ); } @@ -529,16 +529,16 @@ void LLFloaterWorldMap::draw() // check for completion of tracking data if (mWaitingForTracker) { - centerOnTarget(TRUE); + centerOnTarget(true); } - getChildView("Teleport")->setEnabled((BOOL)tracking_status); - // getChildView("Clear")->setEnabled((BOOL)tracking_status); - getChildView("Show Destination")->setEnabled((BOOL)tracking_status || LLWorldMap::getInstance()->isTracking()); + getChildView("Teleport")->setEnabled((bool)tracking_status); + // getChildView("Clear")->setEnabled((bool)tracking_status); + getChildView("Show Destination")->setEnabled((bool)tracking_status || LLWorldMap::getInstance()->isTracking()); getChildView("copy_slurl")->setEnabled((mSLURL.isValid()) ); - setMouseOpaque(TRUE); - getDragHandle()->setMouseOpaque(TRUE); + setMouseOpaque(true); + getDragHandle()->setMouseOpaque(true); mMapView->zoom((F32)getChild<LLUICtrl>("zoom slider")->getValue().asReal()); @@ -599,13 +599,13 @@ void LLFloaterWorldMap::trackLandmark( const LLUUID& landmark_item_id ) if (!iface) return; buildLandmarkIDLists(); - BOOL found = FALSE; + bool found = false; S32 idx; for (idx = 0; idx < mLandmarkItemIDList.size(); idx++) { if ( mLandmarkItemIDList.at(idx) == landmark_item_id) { - found = TRUE; + found = true; break; } } @@ -754,7 +754,7 @@ void LLFloaterWorldMap::updateLocation() gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal( agentPos, agent_sim_name ); if ( gotSimName ) { - mSetToUserPosition = FALSE; + mSetToUserPosition = false; // Fill out the location field getChild<LLUICtrl>("location")->setValue(agent_sim_name); @@ -966,8 +966,8 @@ void LLFloaterWorldMap::buildLandmarkIDLists() mLandmarkAssetIDList.reserve(mLandmarkAssetIDList.size() + items.size()); mLandmarkItemIDList.reserve(mLandmarkItemIDList.size() + items.size()); - S32 count = items.size(); - for(S32 i = 0; i < count; ++i) + auto count = items.size(); + for(size_t i = 0; i < count; ++i) { LLInventoryItem* item = items.at(i); @@ -993,7 +993,7 @@ F32 LLFloaterWorldMap::getDistanceToDestination(const LLVector3d &destination, } -void LLFloaterWorldMap::clearLocationSelection(BOOL clear_ui, BOOL dest_reached) +void LLFloaterWorldMap::clearLocationSelection(bool clear_ui, bool dest_reached) { LLCtrlListInterface *list = mListSearchResults; if (list && (!dest_reached || (list->getItemCount() == 1))) @@ -1005,7 +1005,7 @@ void LLFloaterWorldMap::clearLocationSelection(BOOL clear_ui, BOOL dest_reached) } -void LLFloaterWorldMap::clearLandmarkSelection(BOOL clear_ui) +void LLFloaterWorldMap::clearLandmarkSelection(bool clear_ui) { if (clear_ui || !childHasKeyboardFocus("landmark combo")) { @@ -1018,7 +1018,7 @@ void LLFloaterWorldMap::clearLandmarkSelection(BOOL clear_ui) } -void LLFloaterWorldMap::clearAvatarSelection(BOOL clear_ui) +void LLFloaterWorldMap::clearAvatarSelection(bool clear_ui) { if (clear_ui || !childHasKeyboardFocus("friend combo")) { @@ -1246,7 +1246,7 @@ void LLFloaterWorldMap::onLocationCommit() return; } - clearLocationSelection(FALSE); + clearLocationSelection(false); mCompletingRegionName = ""; mLastRegionName = ""; @@ -1302,12 +1302,12 @@ void LLFloaterWorldMap::onClearBtn() LLTracker::stopTracking(true); LLWorldMap::getInstance()->cancelTracking(); mSLURL = LLSLURL(); // Clear the SLURL since it's invalid - mSetToUserPosition = TRUE; // Revert back to the current user position + mSetToUserPosition = true; // Revert back to the current user position } void LLFloaterWorldMap::onShowTargetBtn() { - centerOnTarget(TRUE); + centerOnTarget(true); } void LLFloaterWorldMap::onShowAgentBtn() @@ -1349,7 +1349,7 @@ void LLFloaterWorldMap::onExpandCollapseBtn() } // protected -void LLFloaterWorldMap::centerOnTarget(BOOL animate) +void LLFloaterWorldMap::centerOnTarget(bool animate) { LLVector3d pos_global; if(LLTracker::getTrackingStatus() != LLTracker::TRACKING_NOTHING) @@ -1359,7 +1359,7 @@ void LLFloaterWorldMap::centerOnTarget(BOOL animate) // absolute zero, and keep trying in the draw loop if (tracked_position.isExactlyZero()) { - mWaitingForTracker = TRUE; + mWaitingForTracker = true; return; } else @@ -1386,7 +1386,7 @@ void LLFloaterWorldMap::centerOnTarget(BOOL animate) mMapView->setPanWithInterpTime(-llfloor((F32)(pos_global.mdV[VX] * map_scale / REGION_WIDTH_METERS)), -llfloor((F32)(pos_global.mdV[VY] * map_scale / REGION_WIDTH_METERS)), !animate, 0.1f); - mWaitingForTracker = FALSE; + mWaitingForTracker = false; } // protected @@ -1411,7 +1411,7 @@ void LLFloaterWorldMap::fly() // protected void LLFloaterWorldMap::teleport() { - BOOL teleport_home = FALSE; + bool teleport_home = false; LLVector3d pos_global; LLAvatarTracker& av_tracker = LLAvatarTracker::instance(); @@ -1426,7 +1426,7 @@ void LLFloaterWorldMap::teleport() { if( LLTracker::getTrackedLandmarkAssetID() == sHomeID ) { - teleport_home = TRUE; + teleport_home = true; } else { @@ -1485,12 +1485,12 @@ void LLFloaterWorldMap::flyToLandmark() void LLFloaterWorldMap::teleportToLandmark() { - BOOL has_destination = FALSE; + bool has_destination = false; LLUUID destination_id; // Null means "home" if( LLTracker::getTrackedLandmarkAssetID() == sHomeID ) { - has_destination = TRUE; + has_destination = true; } else { @@ -1499,7 +1499,7 @@ void LLFloaterWorldMap::teleportToLandmark() if(landmark && landmark->getGlobalPos(global_pos)) { destination_id = LLTracker::getTrackedLandmarkAssetID(); - has_destination = TRUE; + has_destination = true; } else if(landmark) { @@ -1552,7 +1552,7 @@ void LLFloaterWorldMap::updateSims(bool found_null_sim) LLScrollListCtrl *list = getChild<LLScrollListCtrl>("search_results"); list->operateOnAll(LLCtrlListInterface::OP_DELETE); - S32 name_length = mCompletingRegionName.length(); + auto name_length = mCompletingRegionName.length(); LLSD match; @@ -1600,7 +1600,7 @@ void LLFloaterWorldMap::updateSims(bool found_null_sim) { list->selectFirstItem(); } - getChild<LLUICtrl>("search_results")->setFocus(TRUE); + getChild<LLUICtrl>("search_results")->setFocus(true); onCommitSearchResult(); } else @@ -1615,7 +1615,7 @@ void LLFloaterWorldMap::onTeleportFinished() { if(isInVisibleChain()) { - mMapView->setPan(0, 0, TRUE); + mMapView->setPan(0, 0, true); } } @@ -1680,11 +1680,11 @@ void LLFloaterWorldMap::onChangeMaturity() // disable mature / adult events. if (!can_access_mature) { - gSavedSettings.setBOOL("ShowMatureEvents", FALSE); + gSavedSettings.setBOOL("ShowMatureEvents", false); } if (!can_access_adult) { - gSavedSettings.setBOOL("ShowAdultEvents", FALSE); + gSavedSettings.setBOOL("ShowAdultEvents", false); } } @@ -1707,14 +1707,14 @@ LLPanelHideBeacon* LLPanelHideBeacon::getInstance() } -BOOL LLPanelHideBeacon::postBuild() +bool LLPanelHideBeacon::postBuild() { mHideButton = getChild<LLButton>("hide_beacon_btn"); mHideButton->setCommitCallback(boost::bind(&LLPanelHideBeacon::onHideButtonClick, this)); gViewerWindow->setOnWorldViewRectUpdated(boost::bind(&LLPanelHideBeacon::updatePosition, this)); - return TRUE; + return true; } //virtual @@ -1731,7 +1731,7 @@ void LLPanelHideBeacon::draw() } //virtual -void LLPanelHideBeacon::setVisible(BOOL visible) +void LLPanelHideBeacon::setVisible(bool visible) { if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK) visible = false; diff --git a/indra/newview/llfloaterworldmap.h b/indra/newview/llfloaterworldmap.h index 25306d0601..6765157e55 100644 --- a/indra/newview/llfloaterworldmap.h +++ b/indra/newview/llfloaterworldmap.h @@ -56,16 +56,16 @@ public: static LLFloaterWorldMap* getInstance(); static void *createWorldMapView(void* data); - BOOL postBuild(); + bool postBuild(); /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void onClose(bool app_quitting); static void reloadIcons(void*); - /*virtual*/ void reshape( S32 width, S32 height, BOOL called_from_parent = TRUE ); - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); + /*virtual*/ void reshape( S32 width, S32 height, bool called_from_parent = true ); + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleScrollWheel(S32 x, S32 y, S32 clicks); /*virtual*/ void draw(); /*virtual*/ void onFocusLost(); @@ -94,9 +94,9 @@ public: // A z_attenuation of 0.0f collapses the distance into the X-Y plane F32 getDistanceToDestination(const LLVector3d& pos_global, F32 z_attenuation = 0.5f) const; - void clearLocationSelection(BOOL clear_ui = FALSE, BOOL dest_reached = FALSE); - void clearAvatarSelection(BOOL clear_ui = FALSE); - void clearLandmarkSelection(BOOL clear_ui = FALSE); + void clearLocationSelection(bool clear_ui = false, bool dest_reached = false); + void clearAvatarSelection(bool clear_ui = false); + void clearLandmarkSelection(bool clear_ui = false); // Adjust the maximally zoomed out limit of the zoom slider so you can // see the whole world, plus a little. @@ -133,7 +133,7 @@ protected: void onExpandCollapseBtn(); - void centerOnTarget(BOOL animate); + void centerOnTarget(bool animate); void updateLocation(); // fly to the tracked item, if there is one @@ -180,10 +180,10 @@ private: LLVector3 mCompletingRegionPos; std::string mLastRegionName; - BOOL mWaitingForTracker; + bool mWaitingForTracker; - BOOL mIsClosing; - BOOL mSetToUserPosition; + bool mIsClosing; + bool mSetToUserPosition; LLVector3d mTrackedLocation; LLTracker::ETrackingStatus mTrackedStatus; @@ -207,8 +207,8 @@ public: static LLPanelHideBeacon* getInstance(); LLPanelHideBeacon(); - /*virtual*/ BOOL postBuild(); - /*virtual*/ void setVisible(BOOL visible); + /*virtual*/ bool postBuild(); + /*virtual*/ void setVisible(bool visible); /*virtual*/ void draw(); private: diff --git a/indra/newview/llfolderviewmodelinventory.h b/indra/newview/llfolderviewmodelinventory.h index c8fb155176..48b4ee5fd9 100644 --- a/indra/newview/llfolderviewmodelinventory.h +++ b/indra/newview/llfolderviewmodelinventory.h @@ -45,10 +45,10 @@ public: virtual PermissionMask getPermissionMask() const = 0; virtual LLFolderType::EType getPreferredType() const = 0; virtual void showProperties(void) = 0; - virtual BOOL isItemInTrash( void) const { return FALSE; } // TODO: make into pure virtual. + virtual bool isItemInTrash( void) const { return false; } // TODO: make into pure virtual. virtual bool isItemInOutfits() const { return false; } - virtual BOOL isAgentInventory() const { return FALSE; } - virtual BOOL isUpToDate() const = 0; + virtual bool isAgentInventory() const { return false; } + virtual bool isUpToDate() const = 0; virtual void addChild(LLFolderViewModelItem* child); virtual bool hasChildren() const = 0; virtual LLInventoryType::EType getInventoryType() const = 0; @@ -62,7 +62,7 @@ public: virtual bool filter( LLFolderViewFilter& filter); virtual bool filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter); - virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const = 0; + virtual bool startDrag(EDragAndDropType* type, LLUUID* id) const = 0; virtual LLToolDragAndDrop::ESource getDragSource() const = 0; protected: bool mPrevPassedAllFilters; diff --git a/indra/newview/llfollowcam.cpp b/indra/newview/llfollowcam.cpp index 561ac96504..89f77414a1 100644 --- a/indra/newview/llfollowcam.cpp +++ b/indra/newview/llfollowcam.cpp @@ -443,9 +443,9 @@ void LLFollowCam::update() //------------------------------------------------------------------------------------- -BOOL LLFollowCam::updateBehindnessConstraint(LLVector3 focus, LLVector3& cam_position) +bool LLFollowCam::updateBehindnessConstraint(LLVector3 focus, LLVector3& cam_position) { - BOOL constraint_active = FALSE; + bool constraint_active = false; // only apply this stuff if the behindness angle is something other than opened up all the way if ( mBehindnessMaxAngle < FOLLOW_CAM_MAX_BEHINDNESS_ANGLE - FOLLOW_CAM_BEHINDNESS_EPSILON ) { @@ -486,7 +486,7 @@ BOOL LLFollowCam::updateBehindnessConstraint(LLVector3 focus, LLVector3& cam_pos F32 fraction = ((cameraOffsetAngle - mBehindnessMaxAngle) / cameraOffsetAngle) * LLSmoothInterpolation::getInterpolant(mBehindnessLag); cam_position = focus + horizontalSubjectBack * (slerp(fraction, camera_offset_rotation, LLQuaternion::DEFAULT)); cam_position.mV[VZ] = cameraZ; // clamp z value back to what it was before we started messing with it - constraint_active = TRUE; + constraint_active = true; } } return constraint_active; @@ -839,7 +839,7 @@ void LLFollowCamMgr::setCameraActive( const LLUUID& source, bool active ) void LLFollowCamMgr::removeFollowCamParams(const LLUUID& source) { - setCameraActive(source, FALSE); + setCameraActive(source, false); LLFollowCamParams* params = getParamsForID(source); mParamMap.erase(source); delete params; diff --git a/indra/newview/llfollowcam.h b/indra/newview/llfollowcam.h index 509d654fb6..20f3d45cbb 100644 --- a/indra/newview/llfollowcam.h +++ b/indra/newview/llfollowcam.h @@ -188,7 +188,7 @@ protected: //------------------------------------------ protected: void calculatePitchSineAndCosine(); - BOOL updateBehindnessConstraint(LLVector3 focus, LLVector3& cam_position); + bool updateBehindnessConstraint(LLVector3 focus, LLVector3& cam_position); };// end of FollowCam class diff --git a/indra/newview/llfriendcard.cpp b/indra/newview/llfriendcard.cpp index 3f9c3ee683..5300627cec 100644 --- a/indra/newview/llfriendcard.cpp +++ b/indra/newview/llfriendcard.cpp @@ -83,7 +83,7 @@ const LLUUID& get_folder_uuid(const LLUUID& parentFolderUUID, LLInventoryCollect gInventory.collectDescendentsIf(parentFolderUUID, cats, items, LLInventoryModel::EXCLUDE_TRASH, matchFunctor); - S32 cats_count = cats.size(); + auto cats_count = cats.size(); if (cats_count > 1) { @@ -177,7 +177,7 @@ void LLFriendCardsManager::putAvatarData(const LLUUID& avatarID) LL_INFOS() << "Store avatar data, avatarID: " << avatarID << LL_ENDL; std::pair< avatar_uuid_set_t::iterator, bool > pr; pr = mBuddyIDSet.insert(avatarID); - if (pr.second == false) + if (!pr.second) { LL_WARNS() << "Trying to add avatar UUID for the stored avatar: " << avatarID @@ -244,7 +244,7 @@ bool LLFriendCardsManager::isObjDirectDescendentOfCategory(const LLInventoryObje { LLUUID creator_id = item->getCreatorUUID(); LLViewerInventoryItem* cur_item = NULL; - for ( S32 i = items->size() - 1; i >= 0; --i ) + for (S32 i = static_cast<S32>(items->size()) - 1; i >= 0; --i) { cur_item = items->at(i); if ( creator_id == cur_item->getCreatorUUID() ) @@ -261,7 +261,7 @@ bool LLFriendCardsManager::isObjDirectDescendentOfCategory(const LLInventoryObje // Note: UUID's of compared items also may be not equal. std::string obj_name = obj->getName(); LLViewerInventoryItem* cur_item = NULL; - for ( S32 i = items->size() - 1; i >= 0; --i ) + for (S32 i = static_cast<S32>(items->size()) - 1; i >= 0; --i) { cur_item = items->at(i); if ( obj->getType() != cur_item->getType() ) @@ -281,7 +281,7 @@ bool LLFriendCardsManager::isObjDirectDescendentOfCategory(const LLInventoryObje // then return true. Note: UUID's of compared items also may be not equal. std::string obj_name = obj->getName(); LLViewerInventoryCategory* cur_cat = NULL; - for ( S32 i = cats->size() - 1; i >= 0; --i ) + for (S32 i = static_cast<S32>(cats->size()) - 1; i >= 0; --i) { cur_cat = cats->at(i); if ( obj->getType() != cur_cat->getType() ) @@ -303,7 +303,7 @@ bool LLFriendCardsManager::isCategoryInFriendFolder(const LLViewerInventoryCateg { if (NULL == cat) return false; - return TRUE == gInventory.isObjectDescendentOf(cat->getUUID(), findFriendFolderUUIDImpl()); + return true == gInventory.isObjectDescendentOf(cat->getUUID(), findFriendFolderUUIDImpl()); } bool LLFriendCardsManager::isAnyFriendCategory(const LLUUID& catID) const @@ -312,7 +312,7 @@ bool LLFriendCardsManager::isAnyFriendCategory(const LLUUID& catID) const if (catID == friendFolderID) return true; - return TRUE == gInventory.isObjectDescendentOf(catID, friendFolderID); + return true == gInventory.isObjectDescendentOf(catID, friendFolderID); } void LLFriendCardsManager::syncFriendCardsFolders() diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index 5671f6dd59..8ee11cdbd2 100644 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -65,7 +65,7 @@ const F32 MAX_WAIT_KEY_SECS = 60.f * 10.f; // Lightweight constructor. // init() does the heavy lifting. LLGestureMgr::LLGestureMgr() -: mValid(FALSE), +: mValid(false), mPlaying(), mActive(), mLoadingCount(0) @@ -145,8 +145,8 @@ void LLGestureMgr::activateGesture(const LLUUID& item_id) mLoadingCount = 1; mDeactivateSimilarNames.clear(); - const BOOL inform_server = TRUE; - const BOOL deactivate_similar = FALSE; + const bool inform_server = true; + const bool deactivate_similar = false; activateGestureWithAsset(item_id, asset_id, inform_server, deactivate_similar); } @@ -185,8 +185,8 @@ void LLGestureMgr::activateGestures(LLViewerInventoryItem::item_array_t& items) } // Don't inform server, we'll do that in bulk - const BOOL no_inform_server = FALSE; - const BOOL deactivate_similar = TRUE; + const bool no_inform_server = false; + const bool deactivate_similar = true; activateGestureWithAsset(item->getUUID(), item->getAssetUUID(), no_inform_server, deactivate_similar); @@ -195,7 +195,7 @@ void LLGestureMgr::activateGestures(LLViewerInventoryItem::item_array_t& items) // Inform the database of this change LLMessageSystem* msg = gMessageSystem; - BOOL start_message = TRUE; + bool start_message = true; for (it = items.begin(); it != items.end(); ++it) { @@ -213,7 +213,7 @@ void LLGestureMgr::activateGestures(LLViewerInventoryItem::item_array_t& items) msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); msg->addU32("Flags", 0x0); - start_message = FALSE; + start_message = false; } msg->nextBlock("Data"); @@ -224,7 +224,7 @@ void LLGestureMgr::activateGestures(LLViewerInventoryItem::item_array_t& items) if (msg->getCurrentSendTotal() > MTUBYTES) { gAgent.sendReliableMessage(); - start_message = TRUE; + start_message = true; } } @@ -238,8 +238,8 @@ void LLGestureMgr::activateGestures(LLViewerInventoryItem::item_array_t& items) struct LLLoadInfo { LLUUID mItemID; - BOOL mInformServer; - BOOL mDeactivateSimilar; + bool mInformServer; + bool mDeactivateSimilar; }; // If inform_server is true, will send a message upstream to update @@ -249,8 +249,8 @@ struct LLLoadInfo */ void LLGestureMgr::activateGestureWithAsset(const LLUUID& item_id, const LLUUID& asset_id, - BOOL inform_server, - BOOL deactivate_similar) + bool inform_server, + bool deactivate_similar) { const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id); @@ -284,7 +284,7 @@ void LLGestureMgr::activateGestureWithAsset(const LLUUID& item_id, info->mInformServer = inform_server; info->mDeactivateSimilar = deactivate_similar; - const BOOL high_priority = TRUE; + const bool high_priority = true; gAssetStorage->getAssetData(asset_id, LLAssetType::AT_GESTURE, onLoadComplete, @@ -391,7 +391,7 @@ void LLGestureMgr::deactivateSimilarGestures(LLMultiGesture* in, const LLUUID& i // Inform database of the change LLMessageSystem* msg = gMessageSystem; - BOOL start_message = TRUE; + bool start_message = true; uuid_vec_t::const_iterator vit = gest_item_ids.begin(); while (vit != gest_item_ids.end()) { @@ -402,7 +402,7 @@ void LLGestureMgr::deactivateSimilarGestures(LLMultiGesture* in, const LLUUID& i msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); msg->addU32("Flags", 0x0); - start_message = FALSE; + start_message = false; } msg->nextBlock("Data"); @@ -412,7 +412,7 @@ void LLGestureMgr::deactivateSimilarGestures(LLMultiGesture* in, const LLUUID& i if (msg->getCurrentSendTotal() > MTUBYTES) { gAgent.sendReliableMessage(); - start_message = TRUE; + start_message = true; } ++vit; @@ -437,7 +437,7 @@ void LLGestureMgr::deactivateSimilarGestures(LLMultiGesture* in, const LLUUID& i } -BOOL LLGestureMgr::isGestureActive(const LLUUID& item_id) +bool LLGestureMgr::isGestureActive(const LLUUID& item_id) { const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id); item_map_t::iterator it = mActive.find(base_item_id); @@ -445,24 +445,24 @@ BOOL LLGestureMgr::isGestureActive(const LLUUID& item_id) } -BOOL LLGestureMgr::isGesturePlaying(const LLUUID& item_id) +bool LLGestureMgr::isGesturePlaying(const LLUUID& item_id) { const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id); item_map_t::iterator it = mActive.find(base_item_id); - if (it == mActive.end()) return FALSE; + if (it == mActive.end()) return false; LLMultiGesture* gesture = (*it).second; - if (!gesture) return FALSE; + if (!gesture) return false; return gesture->mPlaying; } -BOOL LLGestureMgr::isGesturePlaying(LLMultiGesture* gesture) +bool LLGestureMgr::isGesturePlaying(LLMultiGesture* gesture) { if(!gesture) { - return FALSE; + return false; } return gesture->mPlaying; @@ -501,10 +501,10 @@ void LLGestureMgr::replaceGesture(const LLUUID& item_id, LLMultiGesture* new_ges LLLoadInfo* info = new LLLoadInfo; info->mItemID = base_item_id; - info->mInformServer = TRUE; - info->mDeactivateSimilar = FALSE; + info->mInformServer = true; + info->mDeactivateSimilar = false; - const BOOL high_priority = TRUE; + const bool high_priority = true; gAssetStorage->getAssetData(asset_id, LLAssetType::AT_GESTURE, onLoadComplete, @@ -540,7 +540,7 @@ void LLGestureMgr::playGesture(LLMultiGesture* gesture, bool fromKeyPress) gesture->mTriggeredByKey = fromKeyPress; // Add to list of playing - gesture->mPlaying = TRUE; + gesture->mPlaying = true; mPlaying.push_back(gesture); // Load all needed assets to minimize the delays @@ -569,7 +569,7 @@ void LLGestureMgr::playGesture(LLMultiGesture* gesture, bool fromKeyPress) LLAssetType::AT_ANIMATION, onAssetLoadComplete, (void *)id, - TRUE); + true); } break; } @@ -586,7 +586,7 @@ void LLGestureMgr::playGesture(LLMultiGesture* gesture, bool fromKeyPress) LLAssetType::AT_SOUND, onAssetLoadComplete, NULL, - TRUE); + true); } break; } @@ -628,12 +628,12 @@ void LLGestureMgr::playGesture(const LLUUID& item_id) // Iterates through space delimited tokens in string, triggering any gestures found. // Generates a revised string that has the found tokens replaced by their replacement strings // and (as a minor side effect) has multiple spaces in a row replaced by single spaces. -BOOL LLGestureMgr::triggerAndReviseString(const std::string &utf8str, std::string* revised_string) +bool LLGestureMgr::triggerAndReviseString(const std::string &utf8str, std::string* revised_string) { std::string tokenized = utf8str; - BOOL found_gestures = FALSE; - BOOL first_token = TRUE; + bool found_gestures = false; + bool first_token = true; typedef boost::tokenizer<boost::char_separator<char> > tokenizer; boost::char_separator<char> sep(" "); @@ -671,7 +671,7 @@ BOOL LLGestureMgr::triggerAndReviseString(const std::string &utf8str, std::strin { // choose one at random { - S32 random = ll_rand(matching.size()); + S32 random = ll_rand(static_cast<S32>(matching.size())); gesture = matching[random]; @@ -697,7 +697,7 @@ BOOL LLGestureMgr::triggerAndReviseString(const std::string &utf8str, std::strin revised_string->append( gesture->mReplaceText ); } } - found_gestures = TRUE; + found_gestures = true; } } } @@ -714,14 +714,14 @@ BOOL LLGestureMgr::triggerAndReviseString(const std::string &utf8str, std::strin revised_string->append( cur_token ); } - first_token = FALSE; + first_token = false; gesture = NULL; } return found_gestures; } -BOOL LLGestureMgr::triggerGesture(KEY key, MASK mask) +bool LLGestureMgr::triggerGesture(KEY key, MASK mask) { std::vector <LLMultiGesture *> matching; item_map_t::iterator it; @@ -736,7 +736,7 @@ BOOL LLGestureMgr::triggerGesture(KEY key, MASK mask) if (gesture->mKey == key && gesture->mMask == mask - && gesture->mWaitingKeyRelease == FALSE) + && gesture->mWaitingKeyRelease == false) { matching.push_back(gesture); } @@ -745,18 +745,18 @@ BOOL LLGestureMgr::triggerGesture(KEY key, MASK mask) // choose one and play it if (matching.size() > 0) { - U32 random = ll_rand(matching.size()); + U32 random = ll_rand(static_cast<S32>(matching.size())); LLMultiGesture* gesture = matching[random]; - playGesture(gesture, TRUE); - return TRUE; + playGesture(gesture, true); + return true; } - return FALSE; + return false; } -BOOL LLGestureMgr::triggerGestureRelease(KEY key, MASK mask) +bool LLGestureMgr::triggerGestureRelease(KEY key, MASK mask) { std::vector <LLMultiGesture *> matching; item_map_t::iterator it; @@ -772,7 +772,7 @@ BOOL LLGestureMgr::triggerGestureRelease(KEY key, MASK mask) if (gesture->mKey == key && gesture->mMask == mask) { - gesture->mKeyReleased = TRUE; + gesture->mKeyReleased = true; } } @@ -783,7 +783,7 @@ BOOL LLGestureMgr::triggerGestureRelease(KEY key, MASK mask) S32 LLGestureMgr::getPlayingCount() const { - return mPlaying.size(); + return static_cast<S32>(mPlaying.size()); } @@ -890,7 +890,7 @@ void LLGestureMgr::stepGesture(LLMultiGesture* gesture) } // Run the current steps - BOOL waiting = FALSE; + bool waiting = false; while (!waiting && gesture->mPlaying) { // Get the current step, if there is one. @@ -904,7 +904,7 @@ void LLGestureMgr::stepGesture(LLMultiGesture* gesture) else { // step stays null, we're off the end - gesture->mWaitingAtEnd = TRUE; + gesture->mWaitingAtEnd = true; } @@ -919,12 +919,12 @@ void LLGestureMgr::stepGesture(LLMultiGesture* gesture) && gesture->mPlayingAnimIDs.empty())) { // all animations are done playing - gesture->mWaitingAtEnd = FALSE; - gesture->mPlaying = FALSE; + gesture->mWaitingAtEnd = false; + gesture->mPlaying = false; } else { - waiting = TRUE; + waiting = true; } continue; } @@ -937,20 +937,20 @@ void LLGestureMgr::stepGesture(LLMultiGesture* gesture) if (gesture->mKeyReleased) { // wait is done, continue execution - gesture->mWaitingKeyRelease = FALSE; + gesture->mWaitingKeyRelease = false; gesture->mCurrentStep++; } else if (gesture->mWaitTimer.getElapsedTimeF32() > MAX_WAIT_KEY_SECS) { LL_INFOS("GestureMgr") << "Waited too long for key release, continuing gesture." << LL_ENDL; - gesture->mWaitingKeyRelease = FALSE; + gesture->mWaitingKeyRelease = false; gesture->mCurrentStep++; } else { // we're waiting, so execution is done for now - waiting = TRUE; + waiting = true; } continue; } @@ -965,7 +965,7 @@ void LLGestureMgr::stepGesture(LLMultiGesture* gesture) && gesture->mPlayingAnimIDs.empty())) { // all animations are done playing - gesture->mWaitingAnimations = FALSE; + gesture->mWaitingAnimations = false; gesture->mCurrentStep++; } else if (gesture->mWaitTimer.getElapsedTimeF32() > MAX_WAIT_ANIM_SECS) @@ -973,12 +973,12 @@ void LLGestureMgr::stepGesture(LLMultiGesture* gesture) // we've waited too long for an animation LL_INFOS("GestureMgr") << "Waited too long for animations to stop, continuing gesture." << LL_ENDL; - gesture->mWaitingAnimations = FALSE; + gesture->mWaitingAnimations = false; gesture->mCurrentStep++; } else { - waiting = TRUE; + waiting = true; } continue; } @@ -994,13 +994,13 @@ void LLGestureMgr::stepGesture(LLMultiGesture* gesture) if (elapsed > wait_step->mWaitSeconds) { // wait is done, continue execution - gesture->mWaitingTimer = FALSE; + gesture->mWaitingTimer = false; gesture->mCurrentStep++; } else { // we're waiting, so execution is done for now - waiting = TRUE; + waiting = true; } continue; } @@ -1060,7 +1060,7 @@ void LLGestureMgr::runStep(LLMultiGesture* gesture, LLGestureStep* step) // Don't animate the nodding, as this might not blend with // other playing animations. - const BOOL animate = FALSE; + const bool animate = false; (LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat"))-> sendChatFromViewer(chat_text, CHAT_TYPE_NORMAL, animate); @@ -1072,23 +1072,23 @@ void LLGestureMgr::runStep(LLMultiGesture* gesture, LLGestureStep* step) { LLGestureStepWait* wait_step = (LLGestureStepWait*)step; if (gesture->mTriggeredByKey // Only wait here IF we were triggered by a key! - && gesture->mWaitingKeyRelease == FALSE // We can only do this once! Prevent gestures infinitely running + && gesture->mWaitingKeyRelease == false // We can only do this once! Prevent gestures infinitely running && wait_step->mFlags & WAIT_FLAG_KEY_RELEASE) { // Lets wait for the key release first so we don't hold up re-presses - gesture->mWaitingKeyRelease = TRUE; - gesture->mKeyReleased = FALSE; + gesture->mWaitingKeyRelease = true; + gesture->mKeyReleased = false; // Use the wait timer as a deadlock breaker for key release waits. gesture->mWaitTimer.reset(); } else if (wait_step->mFlags & WAIT_FLAG_TIME) { - gesture->mWaitingTimer = TRUE; + gesture->mWaitingTimer = true; gesture->mWaitTimer.reset(); } else if (wait_step->mFlags & WAIT_FLAG_ALL_ANIM) { - gesture->mWaitingAnimations = TRUE; + gesture->mWaitingAnimations = true; // Use the wait timer as a deadlock breaker for animation waits. gesture->mWaitTimer.reset(); } @@ -1115,8 +1115,8 @@ void LLGestureMgr::onLoadComplete(const LLUUID& asset_uuid, LLLoadInfo* info = (LLLoadInfo*)user_data; LLUUID item_id = info->mItemID; - BOOL inform_server = info->mInformServer; - BOOL deactivate_similar = info->mDeactivateSimilar; + bool inform_server = info->mInformServer; + bool deactivate_similar = info->mDeactivateSimilar; delete info; info = NULL; @@ -1137,7 +1137,7 @@ void LLGestureMgr::onLoadComplete(const LLUUID& asset_uuid, LLMultiGesture* gesture = new LLMultiGesture(); LLDataPackerAsciiBuffer dp(&buffer[0], size+1); - BOOL ok = gesture->deserialize(dp); + bool ok = gesture->deserialize(dp); if (ok) { @@ -1460,9 +1460,9 @@ void LLGestureMgr::notifyObservers() } } -BOOL LLGestureMgr::matchPrefix(const std::string& in_str, std::string* out_str) +bool LLGestureMgr::matchPrefix(const std::string& in_str, std::string* out_str) { - S32 in_len = in_str.length(); + auto in_len = in_str.length(); //return whole trigger, if received text equals to it item_map_t::iterator it; @@ -1475,7 +1475,7 @@ BOOL LLGestureMgr::matchPrefix(const std::string& in_str, std::string* out_str) if (!LLStringUtil::compareInsensitive(in_str, trigger)) { *out_str = trigger; - return TRUE; + return true; } } } @@ -1490,7 +1490,7 @@ BOOL LLGestureMgr::matchPrefix(const std::string& in_str, std::string* out_str) { const std::string& trigger = gesture->getTrigger(); - if (in_len > (S32)trigger.length()) + if (in_len > trigger.length()) { // too short, bail out continue; @@ -1526,7 +1526,7 @@ BOOL LLGestureMgr::matchPrefix(const std::string& in_str, std::string* out_str) } if (rest_of_match.compare("") == 0) { - return TRUE; + return true; } if (buf.compare("") != 0) { @@ -1540,10 +1540,10 @@ BOOL LLGestureMgr::matchPrefix(const std::string& in_str, std::string* out_str) if (rest_of_match.compare("") != 0) { *out_str = in_str+rest_of_match; - return TRUE; + return true; } - return FALSE; + return false; } diff --git a/indra/newview/llgesturemgr.h b/indra/newview/llgesturemgr.h index b41f0ee106..8db36c6d89 100644 --- a/indra/newview/llgesturemgr.h +++ b/indra/newview/llgesturemgr.h @@ -80,11 +80,11 @@ public: // Load gesture into in-memory active form. // Can be called even if the inventory item isn't loaded yet. - // inform_server TRUE will send message upstream to update database + // inform_server true will send message upstream to update database // user_gesture_active table, which isn't necessary on login. // deactivate_similar will cause other gestures with the same trigger phrase // or keybinding to be deactivated. - void activateGestureWithAsset(const LLUUID& item_id, const LLUUID& asset_id, BOOL inform_server, BOOL deactivate_similar); + void activateGestureWithAsset(const LLUUID& item_id, const LLUUID& asset_id, bool inform_server, bool deactivate_similar); // Takes gesture out of active list and deletes it. void deactivateGesture(const LLUUID& item_id); @@ -93,18 +93,18 @@ public: // or this hot key. void deactivateSimilarGestures(LLMultiGesture* gesture, const LLUUID& in_item_id); - BOOL isGestureActive(const LLUUID& item_id); + bool isGestureActive(const LLUUID& item_id); - BOOL isGesturePlaying(const LLUUID& item_id); + bool isGesturePlaying(const LLUUID& item_id); - BOOL isGesturePlaying(LLMultiGesture* gesture); + bool isGesturePlaying(LLMultiGesture* gesture); 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, bool fromKeyPress); void playGesture(LLMultiGesture* gesture) { - playGesture(gesture, FALSE); + playGesture(gesture, false); } void playGesture(const LLUUID& item_id); @@ -122,18 +122,18 @@ public: mCallbackMap[inv_item_id] = cb; } // Trigger a random gesture that matches this key. - // Returns TRUE if it finds a gesture bound to that key. - BOOL triggerGesture(KEY key, MASK mask); + // Returns true if it finds a gesture bound to that key. + bool triggerGesture(KEY key, MASK mask); // Trigger release wait on all gestures that matches this key. - // Returns TRUE if it finds a gesture bound to that key. - BOOL triggerGestureRelease(KEY key, MASK mask); + // Returns true if it finds a gesture bound to that key. + bool triggerGestureRelease(KEY key, MASK mask); // Trigger all gestures referenced as substrings in this string - BOOL triggerAndReviseString(const std::string &str, std::string *revised_string = NULL); + bool triggerAndReviseString(const std::string &str, std::string *revised_string = NULL); // Does some gesture have this key bound? - BOOL isKeyBound(KEY key, MASK mask); + bool isKeyBound(KEY key, MASK mask); S32 getPlayingCount() const; @@ -144,7 +144,7 @@ public: // Overriding so we can update active gesture names and notify observers void changed(U32 mask) override; - BOOL matchPrefix(const std::string& in_str, std::string* out_str); + bool matchPrefix(const std::string& in_str, std::string* out_str); // Copy item ids into the vector void getItemIDs(uuid_vec_t* ids); @@ -187,7 +187,7 @@ private: std::vector<LLGestureManagerObserver*> mObservers; callback_map_t mCallbackMap; std::vector<LLMultiGesture*> mPlaying; - BOOL mValid; + bool mValid; std::set<LLUUID> mLoadingAssets; diff --git a/indra/newview/llgiveinventory.cpp b/indra/newview/llgiveinventory.cpp index abe44ae019..1259b65ebe 100644 --- a/indra/newview/llgiveinventory.cpp +++ b/indra/newview/llgiveinventory.cpp @@ -79,7 +79,7 @@ bool LLGiveable::operator()(LLInventoryCategory* cat, LLInventoryItem* item) !item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) { - allowed = FALSE; + allowed = false; } if (allowed && !item->getPermissions().allowCopyBy(gAgent.getID())) @@ -242,9 +242,9 @@ bool LLGiveInventory::doGiveInventoryCategory(const LLUUID& to_agent, items, LLInventoryModel::EXCLUDE_TRASH, giveable); - S32 count = cats.size(); + auto count = cats.size(); bool complete = true; - for(S32 i = 0; i < count; ++i) + for(size_t i = 0; i < count; ++i) { if (!gInventory.isCategoryComplete(cats.at(i)->getUUID())) { @@ -392,7 +392,7 @@ void LLGiveInventory::commitGiveInventoryItem(const LLUUID& to_agent, pack_instant_message( gMessageSystem, gAgentID, - FALSE, + false, gAgentSessionID, to_agent, name, @@ -409,7 +409,7 @@ void LLGiveInventory::commitGiveInventoryItem(const LLUUID& to_agent, gAgent.sendReliableMessage(); // VEFFECT: giveInventory - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, true); effectp->setSourceObject(gAgentAvatarp); effectp->setTargetObject(gObjectList.findObject(to_agent)); effectp->setDuration(LL_HUD_DUR_SHORT); @@ -446,8 +446,8 @@ bool LLGiveInventory::handleCopyProtectedCategory(const LLSD& notification, cons items, LLInventoryModel::EXCLUDE_TRASH, remove); - S32 count = items.size(); - for(S32 i = 0; i < count; ++i) + auto count = items.size(); + for(size_t i = 0; i < count; ++i) { gInventory.deleteObject(items.at(i)->getUUID()); } @@ -503,7 +503,7 @@ bool LLGiveInventory::commitGiveInventoryCategory(const LLUUID& to_agent, // MAX ITEMS is based on (sizeof(uuid)+2) * count must be < // MTUBYTES or 18 * count < 1200 => count < 1200/18 => // 66. I've cut it down a bit from there to give some pad. - S32 count = items.size() + cats.size(); + auto count = items.size() + cats.size(); if (count > MAX_ITEMS) { LLNotificationsUtil::add("TooManyItems"); @@ -520,7 +520,7 @@ bool LLGiveInventory::commitGiveInventoryCategory(const LLUUID& to_agent, LLAgentUI::buildFullname(name); LLUUID transaction_id; transaction_id.generate(); - S32 bucket_size = (sizeof(U8) + UUID_BYTES) * (count + 1); + S32 bucket_size = (sizeof(U8) + UUID_BYTES) * (static_cast<S32>(count) + 1); U8* bucket = new U8[bucket_size]; U8* pos = bucket; U8 type = (U8)cat->getType(); @@ -549,7 +549,7 @@ bool LLGiveInventory::commitGiveInventoryCategory(const LLUUID& to_agent, pack_instant_message( gMessageSystem, gAgent.getID(), - FALSE, + false, gAgent.getSessionID(), to_agent, name, @@ -567,7 +567,7 @@ bool LLGiveInventory::commitGiveInventoryCategory(const LLUUID& to_agent, delete[] bucket; // VEFFECT: giveInventoryCategory - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, true); effectp->setSourceObject(gAgentAvatarp); effectp->setTargetObject(gObjectList.findObject(to_agent)); effectp->setDuration(LL_HUD_DUR_SHORT); diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index a688689013..08f8918e5d 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -77,7 +77,7 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask) F32 select_dist_squared = gSavedSettings.getF32("MaxSelectDistance"); select_dist_squared = select_dist_squared * select_dist_squared; - BOOL deselect = (mask == MASK_CONTROL); + bool deselect = (mask == MASK_CONTROL); S32 left = llmin(x, mDragStartX); S32 right = llmax(x, mDragStartX); S32 top = llmax(y, mDragStartY); @@ -94,16 +94,16 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask) S32 width = right - left + 1; S32 height = top - bottom + 1; - BOOL grow_selection = FALSE; - BOOL shrink_selection = FALSE; + bool grow_selection = false; + bool shrink_selection = false; if (height > mDragLastHeight || width > mDragLastWidth) { - grow_selection = TRUE; + grow_selection = true; } if (height < mDragLastHeight || width < mDragLastWidth) { - shrink_selection = TRUE; + shrink_selection = true; } if (!grow_selection && !shrink_selection) @@ -122,7 +122,7 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask) gGL.matrixMode(LLRender::MM_PROJECTION); gGL.pushMatrix(); - BOOL limit_select_distance = gSavedSettings.getBOOL("LimitSelectDistance"); + bool limit_select_distance = gSavedSettings.getBOOL("LimitSelectDistance"); if (limit_select_distance) { // ...select distance from control @@ -187,7 +187,7 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask) LLSpatialPartition* part = region->getSpatialPartition(i); if (part) { - part->cull(*LLViewerCamera::getInstance(), &potentials, TRUE); + part->cull(*LLViewerCamera::getInstance(), &potentials, true); } } } @@ -605,7 +605,7 @@ void LLViewerParcelMgr::renderHighlightSegments(const U8* segments, LLViewerRegi } -void LLViewerParcelMgr::renderCollisionSegments(U8* segments, BOOL use_pass, LLViewerRegion* regionp) +void LLViewerParcelMgr::renderCollisionSegments(U8* segments, bool use_pass, LLViewerRegion* regionp) { S32 x, y; @@ -744,7 +744,7 @@ void LLViewerParcelMgr::renderCollisionSegments(U8* segments, BOOL use_pass, LLV void LLViewerParcelMgr::resetCollisionTimer() { mCollisionTimer.reset(); - mRenderCollision = TRUE; + mRenderCollision = true; } void draw_line_cube(F32 width, const LLVector3& center) @@ -869,7 +869,7 @@ void LLViewerObjectList::renderObjectBeacons() } LLHUDText *hud_textp = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT); - hud_textp->setZCompare(FALSE); + hud_textp->setZCompare(false); LLColor4 color; color = debug_beacon.mTextColor; color.mV[3] *= 1.f; @@ -939,7 +939,7 @@ public: { // takes (count, pointer) // &vector[0] gets pointer to contiguous array - LLImageGL::generateTextures(source.size(), &source[0]); + LLImageGL::generateTextures(static_cast<S32>(source.size()), &source[0]); } ~TextureHolder() @@ -950,7 +950,7 @@ public: texUnit->unbind(LLTexUnit::TT_TEXTURE); } // ensure that we delete these textures regardless of how we exit - LLImageGL::deleteTextures(source.size(), &source[0]); + LLImageGL::deleteTextures(static_cast<S32>(source.size()), &source[0]); } bool bind(U32 index) @@ -1009,7 +1009,7 @@ F32 gpu_benchmark() gBenchmarkProgram.mShaderFiles.push_back(std::make_pair("interface/benchmarkV.glsl", GL_VERTEX_SHADER)); gBenchmarkProgram.mShaderFiles.push_back(std::make_pair("interface/benchmarkF.glsl", GL_FRAGMENT_SHADER)); gBenchmarkProgram.mShaderLevel = 1; - if (!gBenchmarkProgram.createShader(NULL, NULL)) + if (!gBenchmarkProgram.createShader()) { return -1.f; } diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp index 4c9dc8f7cd..215f3dd3a7 100644 --- a/indra/newview/llgltfmateriallist.cpp +++ b/indra/newview/llgltfmateriallist.cpp @@ -47,9 +47,6 @@ #include "tinygltf/tiny_gltf.h" #include <strstream> -#include "json/reader.h" -#include "json/value.h" - #include <unordered_set> LLGLTFMaterialList gGLTFMaterialList; @@ -76,7 +73,7 @@ static bool is_valid_update(const LLSD& data) ++count; } else - { + { LL_WARNS() << "Missing required parameter: object_id" << LL_ENDL; return false; } @@ -96,7 +93,7 @@ static bool is_valid_update(const LLSD& data) ++count; } else - { + { LL_WARNS() << "Missing required parameter: side" << LL_ENDL; return false; } @@ -122,7 +119,7 @@ static bool is_valid_update(const LLSD& data) } if (count < 3) - { + { LL_WARNS() << "Only specified object_id and side, update won't actually change anything and is just noise" << LL_ENDL; return false; } @@ -176,7 +173,7 @@ void LLGLTFMaterialList::applyOverrideMessage(LLMessageSystem* msg, const std::s LLSDSerialize::fromNotation(data, str, data_in.length()); const LLHost& host = msg->getSender(); - + LLViewerRegion* region = LLWorld::instance().getRegion(host); llassert(region); @@ -202,14 +199,14 @@ void LLGLTFMaterialList::applyOverrideMessage(LLMessageSystem* msg, const std::s bool has_te[MAX_TES] = { false }; if (tes.isArray()) // NOTE: if no "te" array exists, this is a malformed message (null out all overrides will come in as an empty te array) - { + { LLGLTFOverrideCacheEntry cache; cache.mLocalId = local_id; cache.mObjectId = id; cache.mRegionHandle = region->getHandle(); - U32 count = llmin(tes.size(), MAX_TES); - for (U32 i = 0; i < count; ++i) + auto count = llmin(tes.size(), MAX_TES); + for (size_t i = 0; i < count; ++i) { LLGLTFMaterial* mat = new LLGLTFMaterial(); // setTEGLTFMaterialOverride and cache will take ownership mat->applyOverrideLLSD(od[i]); @@ -255,7 +252,7 @@ void LLGLTFMaterialList::queueOverrideUpdate(const LLUUID& id, S32 side, LLGLTFM { #if 0 override_list_t& overrides = mQueuedOverrides[id]; - + if (overrides.size() < side + 1) { overrides.resize(side + 1); @@ -375,7 +372,7 @@ void LLGLTFMaterialList::queueUpdate(const LLSD& data) { sUpdates = LLSD::emptyArray(); } - + sUpdates[sUpdates.size()] = data; } @@ -383,7 +380,7 @@ void LLGLTFMaterialList::flushUpdates(void(*done_callback)(bool)) { LLSD& data = sUpdates; - S32 i = data.size(); + auto i = data.size(); for (ModifyMaterialData& e : sModifyQueue) { @@ -395,7 +392,7 @@ void LLGLTFMaterialList::flushUpdates(void(*done_callback)(bool)) data[i]["object_id"] = e.object_id; data[i]["side"] = e.side; - + if (e.has_override) { data[i]["gltf_json"] = e.override_data.asJSON(); @@ -494,7 +491,7 @@ void LLGLTFMaterialList::onAssetLoadComplete(const LLUUID& id, LLAssetType::ETyp } buffer.resize(size); - file.read((U8*)&buffer[0], buffer.size()); + file.read((U8*)&buffer[0], static_cast<S32>(buffer.size())); } { @@ -503,7 +500,7 @@ void LLGLTFMaterialList::onAssetLoadComplete(const LLUUID& id, LLAssetType::ETyp LLSD asset; // read file into buffer - std::istrstream str(&buffer[0], buffer.size()); + std::istrstream str(&buffer[0], static_cast<S32>(buffer.size())); if (LLSDSerialize::deserialize(asset, str, buffer.size())) { @@ -520,7 +517,7 @@ void LLGLTFMaterialList::onAssetLoadComplete(const LLUUID& id, LLAssetType::ETyp LL_PROFILE_ZONE_SCOPED; tinygltf::TinyGLTF gltf; - if (!gltf.LoadASCIIFromString(&asset_data->mModelIn, &error_msg, &warn_msg, data.c_str(), data.length(), "")) + if (!gltf.LoadASCIIFromString(&asset_data->mModelIn, &error_msg, &warn_msg, data.c_str(), static_cast<U32>(data.length()), "")) { LL_WARNS("GLTF") << "Failed to decode material asset: " << LL_NEWLINE @@ -581,7 +578,7 @@ LLFetchedGLTFMaterial* LLGLTFMaterialList::getMaterial(const LLUUID& id) gAssetStorage->getAssetData(id, LLAssetType::AT_MATERIAL, onAssetLoadComplete, (void*)user_data); } - + return mat; } diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h index 6eab86ff0a..982538f106 100644 --- a/indra/newview/llgltfmateriallist.h +++ b/indra/newview/llgltfmateriallist.h @@ -79,14 +79,14 @@ public: static void flushUpdates(void(*done_callback)(bool) = nullptr); static void addSelectionUpdateCallback(void(*update_callback)(const LLUUID& object_id, S32 side)); - + // Queue an explicit LLSD ModifyMaterialParams update apply given override data // overrides -- LLSD map (or array of maps) in the format: // object_id UUID(required) id of object // side integer(required) TE index of face to set, or -1 for all faces // gltf_json string(optional) override data to set, empty string nulls out override data, omissions of this parameter keeps existing data // asset_id UUID(optional) id of material asset to set, omission of this parameter keeps existing material asset id - // + // // NOTE: Unless you already have a gltf_json string you want to send, strongly prefer using queueModify // If the queue/flush API is insufficient, extend it. static void queueUpdate(const LLSD& data); diff --git a/indra/newview/llgltfmaterialpreviewmgr.cpp b/indra/newview/llgltfmaterialpreviewmgr.cpp index 730a625879..a198d1bdf4 100644 --- a/indra/newview/llgltfmaterialpreviewmgr.cpp +++ b/indra/newview/llgltfmaterialpreviewmgr.cpp @@ -118,7 +118,7 @@ namespace } else { - img = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + img = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); } } if (img) @@ -185,7 +185,7 @@ namespace }; // namespace LLGLTFPreviewTexture::LLGLTFPreviewTexture(LLPointer<LLFetchedGLTFMaterial> material, S32 width) - : LLViewerDynamicTexture(width, width, 4, EOrder::ORDER_MIDDLE, FALSE) + : LLViewerDynamicTexture(width, width, 4, EOrder::ORDER_MIDDLE, false) , mGLTFMaterial(material) { } @@ -196,7 +196,7 @@ LLPointer<LLGLTFPreviewTexture> LLGLTFPreviewTexture::create(LLPointer<LLFetched return new LLGLTFPreviewTexture(material, LLPipeline::MAX_BAKE_WIDTH); } -BOOL LLGLTFPreviewTexture::needsRender() +bool LLGLTFPreviewTexture::needsRender() { LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; @@ -211,7 +211,7 @@ BOOL LLGLTFPreviewTexture::needsRender() return false; } -void LLGLTFPreviewTexture::preRender(BOOL clear_depth) +void LLGLTFPreviewTexture::preRender(bool clear_depth) { LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; @@ -393,7 +393,7 @@ void fixup_shader_constants(LLGLSLShader& shader) const S32 channel = shader.getTextureChannel(LLShaderMgr::DEFERRED_SHADOW0+i); if (channel != -1) { - gGL.getTexUnit(channel)->bind(LLViewerFetchedTexture::sWhiteImagep, TRUE); + gGL.getTexUnit(channel)->bind(LLViewerFetchedTexture::sWhiteImagep, true); } } } @@ -419,11 +419,11 @@ struct SetTemporarily }; // namespace -BOOL LLGLTFPreviewTexture::render() +bool LLGLTFPreviewTexture::render() { LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; - if (!mShouldRender) { return FALSE; } + if (!mShouldRender) { return false; } glClearColor(0, 0, 0, 0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -464,7 +464,7 @@ BOOL LLGLTFPreviewTexture::render() camera.lookAt(origin, object_position); camera.setAspect(mFullHeight / mFullWidth); const LLRect texture_rect(0, mFullHeight, mFullWidth, 0); - camera.setPerspective(NOT_FOR_SELECTION, texture_rect.mLeft, texture_rect.mBottom, texture_rect.getWidth(), texture_rect.getHeight(), FALSE, camera.getNear(), MAX_FAR_CLIP*2.f); + camera.setPerspective(NOT_FOR_SELECTION, texture_rect.mLeft, texture_rect.mBottom, texture_rect.getWidth(), texture_rect.getHeight(), false, camera.getNear(), MAX_FAR_CLIP*2.f); // Generate sphere object on-the-fly. Discard afterwards. (Vertex buffer is // discarded, but the sphere should be cached in LLVolumeMgr.) @@ -554,10 +554,10 @@ BOOL LLGLTFPreviewTexture::render() gPipeline.mReflectionMapManager.forceDefaultProbeAndUpdateUniforms(false); gSavedSettings.set<S32>("RenderLocalLightCount", old_local_light_count); - return TRUE; + return true; } -void LLGLTFPreviewTexture::postRender(BOOL success) +void LLGLTFPreviewTexture::postRender(bool success) { LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; diff --git a/indra/newview/llgltfmaterialpreviewmgr.h b/indra/newview/llgltfmaterialpreviewmgr.h index 981c8b0592..f320886157 100644 --- a/indra/newview/llgltfmaterialpreviewmgr.h +++ b/indra/newview/llgltfmaterialpreviewmgr.h @@ -40,10 +40,10 @@ public: // Width scales with size of material's textures static LLPointer<LLGLTFPreviewTexture> create(LLPointer<LLFetchedGLTFMaterial> material); - BOOL needsRender() override; - void preRender(BOOL clear_depth = TRUE) override; - BOOL render() override; - void postRender(BOOL success) override; + bool needsRender() override; + void preRender(bool clear_depth = true) override; + bool render() override; + void postRender(bool success) override; struct MaterialLoadLevels { diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp index 58cb1a614d..ba9c9fa13f 100644 --- a/indra/newview/llgroupactions.cpp +++ b/indra/newview/llgroupactions.cpp @@ -118,7 +118,7 @@ public: } LLUUID group_id; - if (!group_id.set(tokens[0], FALSE)) + if (!group_id.set(tokens[0], false)) { return false; } @@ -186,7 +186,7 @@ public: } else if (!gdatap->isMemberDataComplete()) { - LL_WARNS() << "LLGroupMgr::getInstance()->getGroupData()->isMemberDataComplete() was FALSE" << LL_ENDL; + LL_WARNS() << "LLGroupMgr::getInstance()->getGroupData()->isMemberDataComplete() was false" << LL_ENDL; processGroupData(); mRequestProcessed = true; } @@ -425,7 +425,7 @@ void LLGroupActions::show(const LLUUID &group_id, bool expand_notices_tab) LLFloater *floater = LLFloaterReg::getTypedInstance<LLFloaterSidePanelContainer>("people"); if (!floater->isFrontmost()) { - floater->setVisibleAndFrontmost(TRUE, params); + floater->setVisibleAndFrontmost(true, params); } } diff --git a/indra/newview/llgrouplist.cpp b/indra/newview/llgrouplist.cpp index 38b2f4adc8..7659e5f082 100644 --- a/indra/newview/llgrouplist.cpp +++ b/indra/newview/llgrouplist.cpp @@ -163,9 +163,9 @@ void LLGroupList::draw() } // virtual -BOOL LLGroupList::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLGroupList::handleRightMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = LLUICtrl::handleRightMouseDown(x, y, mask); + bool handled = LLUICtrl::handleRightMouseDown(x, y, mask); if (mForAgent) { @@ -182,9 +182,9 @@ BOOL LLGroupList::handleRightMouseDown(S32 x, S32 y, MASK mask) } // virtual -BOOL LLGroupList::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLGroupList::handleDoubleClick(S32 x, S32 y, MASK mask) { - BOOL handled = LLView::handleDoubleClick(x, y, mask); + bool handled = LLView::handleDoubleClick(x, y, mask); // Handle double click only for the selected item in the list, skip clicks on empty space. if (handled) { @@ -223,7 +223,7 @@ void LLGroupList::refresh() if (mForAgent) { const LLUUID& highlight_id = gAgent.getGroupID(); - S32 count = gAgent.mGroups.size(); + S32 count = static_cast<S32>(gAgent.mGroups.size()); LLUUID id; bool have_filter = !mNameFilter.empty(); @@ -426,7 +426,7 @@ LLGroupListItem::~LLGroupListItem() } //virtual -BOOL LLGroupListItem::postBuild() +bool LLGroupListItem::postBuild() { mGroupIcon = getChild<LLGroupIconCtrl>("group_icon"); mGroupNameBox = getChild<LLTextBox>("group_name"); @@ -457,7 +457,7 @@ BOOL LLGroupListItem::postBuild() // have icons of different sizes so we need to figure it per file. mIconWidth = mGroupNameBox->getRect().mLeft - mGroupIcon->getRect().mLeft; - return TRUE; + return true; } //virtual @@ -482,9 +482,9 @@ void LLGroupListItem::onMouseEnter(S32 x, S32 y, MASK mask) { if (mVisibilityHideBtn) { - mVisibilityHideBtn->setVisible(agent_gdatap.mListInProfile); - mVisibilityShowBtn->setVisible(!agent_gdatap.mListInProfile); - } + mVisibilityHideBtn->setVisible(agent_gdatap.mListInProfile); + mVisibilityShowBtn->setVisible(!agent_gdatap.mListInProfile); + } mNoticesBtn->setVisible(true); } } @@ -544,7 +544,7 @@ void LLGroupListItem::setGroupIconID(const LLUUID& group_icon_id) void LLGroupListItem::setGroupIconVisible(bool visible) { // Already done? Then do nothing. - if (mGroupIcon->getVisible() == (BOOL)visible) + if (mGroupIcon->getVisible() == (bool)visible) return; // Show/hide the group icon. diff --git a/indra/newview/llgrouplist.h b/indra/newview/llgrouplist.h index 0e2dcf5fb3..19d4e82a93 100644 --- a/indra/newview/llgrouplist.h +++ b/indra/newview/llgrouplist.h @@ -60,8 +60,8 @@ public: void enableForAgent(bool show_icons); virtual void draw(); // from LLView - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); // from LLView - /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); // from LLView + /*virtual*/ bool handleRightMouseDown(S32 x, S32 y, MASK mask); // from LLView + /*virtual*/ bool handleDoubleClick(S32 x, S32 y, MASK mask); // from LLView void setNameFilter(const std::string& filter); void toggleIcons(); @@ -103,7 +103,7 @@ class LLGroupListItem : public LLPanel public: LLGroupListItem(bool for_agent, bool show_icons); ~LLGroupListItem(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void setValue(const LLSD& value); void onMouseEnter(S32 x, S32 y, MASK mask); void onMouseLeave(S32 x, S32 y, MASK mask); diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index ceb3c63bc7..100aacb8ac 100644 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -93,7 +93,7 @@ LLGroupMemberData::LLGroupMemberData(const LLUUID& id, U64 agent_powers, const std::string& title, const std::string& online_status, - BOOL is_owner) : + bool is_owner) : mID(id), mContribution(contribution), mAgentPowers(agent_powers), @@ -137,7 +137,7 @@ LLGroupRoleData::LLGroupRoleData(const LLUUID& role_id, const S32 member_count) : mRoleID(role_id), mMemberCount(member_count), - mMembersNeedsSort(FALSE) + mMembersNeedsSort(false) { mRoleData.mRoleName = role_name; mRoleData.mRoleTitle = role_title; @@ -152,7 +152,7 @@ LLGroupRoleData::LLGroupRoleData(const LLUUID& role_id, mRoleID(role_id), mRoleData(role_data), mMemberCount(member_count), - mMembersNeedsSort(FALSE) + mMembersNeedsSort(false) { } @@ -162,20 +162,20 @@ LLGroupRoleData::~LLGroupRoleData() } S32 LLGroupRoleData::getMembersInRole(uuid_vec_t members, - BOOL needs_sort) + bool needs_sort) { if (mRoleID.isNull()) { // This is the everyone role, just return the size of members, // because everyone is in the everyone role. - return members.size(); + return static_cast<S32>(members.size()); } // Sort the members list, if needed. if (mMembersNeedsSort) { std::sort(mMemberIDs.begin(), mMemberIDs.end()); - mMembersNeedsSort = FALSE; + mMembersNeedsSort = false; } if (needs_sort) { @@ -184,7 +184,7 @@ S32 LLGroupRoleData::getMembersInRole(uuid_vec_t members, } // Return the number of members in the intersection. - S32 max_size = llmin( members.size(), mMemberIDs.size() ); + auto max_size = llmin( members.size(), mMemberIDs.size() ); uuid_vec_t in_role( max_size ); uuid_vec_t::iterator in_role_end; in_role_end = std::set_intersection(mMemberIDs.begin(), mMemberIDs.end(), @@ -195,7 +195,7 @@ S32 LLGroupRoleData::getMembersInRole(uuid_vec_t members, void LLGroupRoleData::addMember(const LLUUID& member) { - mMembersNeedsSort = TRUE; + mMembersNeedsSort = true; mMemberIDs.push_back(member); } @@ -205,7 +205,7 @@ bool LLGroupRoleData::removeMember(const LLUUID& member) if (it != mMemberIDs.end()) { - mMembersNeedsSort = TRUE; + mMembersNeedsSort = true; mMemberIDs.erase(it); return true; } @@ -215,7 +215,7 @@ bool LLGroupRoleData::removeMember(const LLUUID& member) void LLGroupRoleData::clearMembers() { - mMembersNeedsSort = FALSE; + mMembersNeedsSort = false; mMemberIDs.clear(); } @@ -226,13 +226,13 @@ void LLGroupRoleData::clearMembers() LLGroupMgrGroupData::LLGroupMgrGroupData(const LLUUID& id) : mID(id), - mShowInList(TRUE), - mOpenEnrollment(FALSE), + mShowInList(true), + mOpenEnrollment(false), mMembershipFee(0), - mAllowPublish(FALSE), - mListInProfile(FALSE), - mMaturePublish(FALSE), - mChanged(FALSE), + mAllowPublish(false), + mListInProfile(false), + mMaturePublish(false), + mChanged(false), mMemberCount(0), mRoleCount(0), mReceivedRoleMemberPairs(0), @@ -252,7 +252,7 @@ void LLGroupMgrGroupData::setAccessed() mAccessTime = (F32)LLFrameTimer::getTotalSeconds(); } -BOOL LLGroupMgrGroupData::getRoleData(const LLUUID& role_id, LLRoleData& role_data) +bool LLGroupMgrGroupData::getRoleData(const LLUUID& role_id, LLRoleData& role_data) { role_data_map_t::const_iterator it; @@ -260,10 +260,10 @@ BOOL LLGroupMgrGroupData::getRoleData(const LLUUID& role_id, LLRoleData& role_da it = mRoleChanges.find(role_id); if (it != mRoleChanges.end()) { - if ((*it).second.mChangeType == RC_DELETE) return FALSE; + if ((*it).second.mChangeType == RC_DELETE) return false; role_data = (*it).second; - return TRUE; + return true; } // Ok, no changes, hasn't been deleted, isn't a new role, just find the role. @@ -271,11 +271,11 @@ BOOL LLGroupMgrGroupData::getRoleData(const LLUUID& role_id, LLRoleData& role_da if (rit != mRoles.end()) { role_data = (*rit).second->getRoleData(); - return TRUE; + return true; } // This role must not exist. - return FALSE; + return false; } @@ -337,7 +337,7 @@ void LLGroupMgrGroupData::setRoleData(const LLUUID& role_id, LLRoleData role_dat } } -BOOL LLGroupMgrGroupData::pendingRoleChanges() +bool LLGroupMgrGroupData::pendingRoleChanges() { return (!mRoleChanges.empty()); } @@ -517,7 +517,7 @@ bool LLGroupMgrGroupData::changeRoleMember(const LLUUID& role_id, //TODO move this into addrole function //see if they added someone to the owner role and update isOwner - gmd->mIsOwner = (role_id == mOwnerRole) ? TRUE : gmd->mIsOwner; + gmd->mIsOwner = (role_id == mOwnerRole) ? true : gmd->mIsOwner; } else if (RMC_REMOVE == rmc) { @@ -526,7 +526,7 @@ bool LLGroupMgrGroupData::changeRoleMember(const LLUUID& role_id, gmd->removeRole(role_id); //see if they removed someone from the owner role and update isOwner - gmd->mIsOwner = (role_id == mOwnerRole) ? FALSE : gmd->mIsOwner; + gmd->mIsOwner = (role_id == mOwnerRole) ? false : gmd->mIsOwner; } lluuid_pair role_member; @@ -568,7 +568,7 @@ bool LLGroupMgrGroupData::changeRoleMember(const LLUUID& role_id, recalcAgentPowers(member_id); - mChanged = TRUE; + mChanged = true; return true; } @@ -980,7 +980,7 @@ void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data) std::string online_status; std::string title; U64 agent_powers = 0; - BOOL is_owner = FALSE; + bool is_owner = false; S32 num_members = msg->getNumberOfBlocksFast(_PREHASH_MemberData); for (S32 i = 0; i < num_members; i++) @@ -1049,7 +1049,7 @@ void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data) } } - group_datap->mChanged = TRUE; + group_datap->mChanged = true; LLGroupMgr::getInstance()->notifyObservers(GC_MEMBER_DATA); } @@ -1075,7 +1075,7 @@ void LLGroupMgr::processGroupPropertiesReply(LLMessageSystem* msg, void** data) LLUUID group_id; std::string name; std::string charter; - BOOL show_in_list = FALSE; + bool show_in_list = false; LLUUID founder_id; U64 powers_mask = GP_NO_POWERS; S32 money = 0; @@ -1083,11 +1083,11 @@ void LLGroupMgr::processGroupPropertiesReply(LLMessageSystem* msg, void** data) LLUUID insignia_id; LLUUID owner_role; U32 membership_fee = 0; - BOOL open_enrollment = FALSE; + bool open_enrollment = false; S32 num_group_members = 0; S32 num_group_roles = 0; - BOOL allow_publish = FALSE; - BOOL mature = FALSE; + bool allow_publish = false; + bool mature = false; msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupID, group_id ); msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_FounderID, founder_id); @@ -1122,7 +1122,7 @@ void LLGroupMgr::processGroupPropertiesReply(LLMessageSystem* msg, void** data) group_datap->mRoleCount = num_group_roles + 1; // Add the everyone role. group_datap->mGroupPropertiesDataComplete = true; - group_datap->mChanged = TRUE; + group_datap->mChanged = true; properties_request_map_t::iterator request = LLGroupMgr::getInstance()->mPropRequests.find(group_id); if (request != LLGroupMgr::getInstance()->mPropRequests.end()) @@ -1219,7 +1219,7 @@ void LLGroupMgr::processGroupRoleDataReply(LLMessageSystem* msg, void** data) } } - group_datap->mChanged = TRUE; + group_datap->mChanged = true; LLGroupMgr::getInstance()->notifyObservers(GC_ROLE_DATA); } @@ -1329,7 +1329,7 @@ void LLGroupMgr::processGroupRoleMembersReply(LLMessageSystem* msg, void** data) group_datap->mRoleMembersRequestID.setNull(); } - group_datap->mChanged = TRUE; + group_datap->mChanged = true; LLGroupMgr::getInstance()->notifyObservers(GC_ROLE_MEMBER_DATA); if (group_datap->mPendingBanRequest) @@ -1379,7 +1379,7 @@ void LLGroupMgr::processGroupTitlesReply(LLMessageSystem* msg, void** data) } } - group_datap->mChanged = TRUE; + group_datap->mChanged = true; LLGroupMgr::getInstance()->notifyObservers(GC_TITLES); } @@ -1389,7 +1389,7 @@ void LLGroupMgr::processEjectGroupMemberReply(LLMessageSystem* msg, void ** data LL_DEBUGS("GrpMgr") << "processEjectGroupMemberReply" << LL_ENDL; LLUUID group_id; msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupID, group_id); - BOOL success; + bool success; msg->getBOOLFast(_PREHASH_EjectData, _PREHASH_Success, success); // If we had a failure, the group panel needs to be updated. @@ -1404,7 +1404,7 @@ void LLGroupMgr::processJoinGroupReply(LLMessageSystem* msg, void ** data) { LL_DEBUGS("GrpMgr") << "processJoinGroupReply" << LL_ENDL; LLUUID group_id; - BOOL success; + bool success; msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupID, group_id); msg->getBOOLFast(_PREHASH_GroupData, _PREHASH_Success, success); @@ -1424,7 +1424,7 @@ void LLGroupMgr::processLeaveGroupReply(LLMessageSystem* msg, void ** data) { LL_DEBUGS("GrpMgr") << "processLeaveGroupReply" << LL_ENDL; LLUUID group_id; - BOOL success; + bool success; msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupID, group_id); msg->getBOOLFast(_PREHASH_GroupData, _PREHASH_Success, success); @@ -1443,7 +1443,7 @@ void LLGroupMgr::processLeaveGroupReply(LLMessageSystem* msg, void ** data) void LLGroupMgr::processCreateGroupReply(LLMessageSystem* msg, void ** data) { LLUUID group_id; - BOOL success; + bool success; std::string message; msg->getUUIDFast(_PREHASH_ReplyData, _PREHASH_GroupID, group_id ); @@ -1460,8 +1460,8 @@ void LLGroupMgr::processCreateGroupReply(LLMessageSystem* msg, void ** data) // This is so when we go to modify the group we will be able to do so. // This isn't actually too bad because real data will come down in 2 or 3 miliseconds and replace this. LLGroupData gd; - gd.mAcceptNotices = TRUE; - gd.mListInProfile = TRUE; + gd.mAcceptNotices = true; + gd.mListInProfile = true; gd.mContribution = 0; gd.mID = group_id; gd.mName = "new group"; @@ -1546,7 +1546,7 @@ void LLGroupMgr::notifyObservers(LLGroupChange gc) { oi->second->changed(gc); } - gi->second->mChanged = FALSE; + gi->second->mChanged = false; // notify LLParticularGroupObserver @@ -1685,7 +1685,7 @@ void LLGroupMgr::sendGroupRoleMembersRequest(const LLUUID& group_id) LL_INFOS("GrpMgr") << " Pending: " << (group_datap->mPendingRoleMemberRequest ? "Y" : "N") << " MemberDataComplete: " << (group_datap->mMemberDataComplete ? "Y" : "N") << " RoleDataComplete: " << (group_datap->mRoleDataComplete ? "Y" : "N") << LL_ENDL; - group_datap->mPendingRoleMemberRequest = TRUE; + group_datap->mPendingRoleMemberRequest = true; return; } @@ -1744,11 +1744,11 @@ void LLGroupMgr::sendGroupTitleUpdate(const LLUUID& group_id, const LLUUID& titl { if (iter->mRoleID == title_role_id) { - iter->mSelected = TRUE; + iter->mSelected = true; } else if (iter->mSelected) { - iter->mSelected = FALSE; + iter->mSelected = false; } } } @@ -1759,9 +1759,9 @@ void LLGroupMgr::sendCreateGroupRequest(const std::string& name, U8 show_in_list, const LLUUID& insignia, S32 membership_fee, - BOOL open_enrollment, - BOOL allow_publish, - BOOL mature_publish) + bool open_enrollment, + bool allow_publish, + bool mature_publish) { LLMessageSystem* msg = gMessageSystem; msg->newMessage("CreateGroupRequest"); @@ -1807,7 +1807,7 @@ void LLGroupMgr::sendUpdateGroupInfo(const LLUUID& group_id) gAgent.sendReliableMessage(); // Not expecting a response, so let anyone else watching know the data has changed. - group_datap->mChanged = TRUE; + group_datap->mChanged = true; notifyObservers(GC_PROPERTIES); } @@ -1853,7 +1853,7 @@ void LLGroupMgr::sendGroupRoleMemberChanges(const LLUUID& group_id) group_datap->mRoleMemberChanges.clear(); // Not expecting a response, so let anyone else watching know the data has changed. - group_datap->mChanged = TRUE; + group_datap->mChanged = true; notifyObservers(GC_ROLE_MEMBER_DATA); } @@ -2147,7 +2147,7 @@ void LLGroupMgr::processGroupBanRequest(const LLSD& content) gdatap->createBanEntry(ban_id, ban_data); } - gdatap->mChanged = TRUE; + gdatap->mChanged = true; LLGroupMgr::getInstance()->notifyObservers(GC_BANLIST); } @@ -2251,7 +2251,7 @@ void LLGroupMgr::processCapGroupMembersRequest(const LLSD& content) LL_INFOS("GrpMgr") << "Received empty group members list for group id: " << group_id.asString() << LL_ENDL; // Set mMemberDataComplete for correct handling of empty responses. See MAINT-5237 group_datap->mMemberDataComplete = true; - group_datap->mChanged = TRUE; + group_datap->mChanged = true; LLGroupMgr::getInstance()->notifyObservers(GC_MEMBER_DATA); return; } @@ -2267,7 +2267,7 @@ void LLGroupMgr::processCapGroupMembersRequest(const LLSD& content) S32 contribution; U64 member_powers; // If this is changed to a bool, make sure to change the LLGroupMemberData constructor - BOOL is_owner; + bool is_owner; // Compute this once, rather than every time. U64 default_powers = llstrtou64(defaults["default_powers"].asString().c_str(), NULL, 16); @@ -2355,7 +2355,7 @@ void LLGroupMgr::processCapGroupMembersRequest(const LLSD& content) sendGroupRoleMembersRequest(group_id); } - group_datap->mChanged = TRUE; + group_datap->mChanged = true; notifyObservers(GC_MEMBER_DATA); } @@ -2371,7 +2371,7 @@ void LLGroupMgr::sendGroupRoleChanges(const LLUUID& group_id) group_datap->sendRoleChanges(); // Not expecting a response, so let anyone else watching know the data has changed. - group_datap->mChanged = TRUE; + group_datap->mChanged = true; notifyObservers(GC_ROLE_DATA); } } @@ -2389,7 +2389,7 @@ bool LLGroupMgr::parseRoleActions(const std::string& xml_filename) { LLXMLNodePtr root; - BOOL success = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root); + bool success = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root); if (!success || !root || !root->hasName( "role_actions" )) { diff --git a/indra/newview/llgroupmgr.h b/indra/newview/llgroupmgr.h index c12a0b019a..18efae7654 100644 --- a/indra/newview/llgroupmgr.h +++ b/indra/newview/llgroupmgr.h @@ -84,14 +84,14 @@ public: U64 agent_powers, const std::string& title, const std::string& online_status, - BOOL is_owner); + bool is_owner); ~LLGroupMemberData(); const LLUUID& getID() const { return mID; } S32 getContribution() const { return mContribution; } U64 getAgentPowers() const { return mAgentPowers; } - BOOL isOwner() const { return mIsOwner; } + bool isOwner() const { return mIsOwner; } const std::string& getTitle() const { return mTitle; } const std::string& getOnlineStatus() const { return mOnlineStatus; } void addRole(const LLUUID& role, LLGroupRoleData* rd); @@ -100,7 +100,7 @@ public: role_list_t::iterator roleBegin() { return mRolesList.begin(); } role_list_t::iterator roleEnd() { return mRolesList.end(); } - BOOL isInRole(const LLUUID& role_id) { return (mRolesList.find(role_id) != mRolesList.end()); } + bool isInRole(const LLUUID& role_id) { return (mRolesList.find(role_id) != mRolesList.end()); } private: LLUUID mID; @@ -108,7 +108,7 @@ private: U64 mAgentPowers; std::string mTitle; std::string mOnlineStatus; - BOOL mIsOwner; + bool mIsOwner; role_list_t mRolesList; }; @@ -150,8 +150,8 @@ public: const LLUUID& getID() const { return mRoleID; } const uuid_vec_t& getRoleMembers() const { return mMemberIDs; } - S32 getMembersInRole(uuid_vec_t members, BOOL needs_sort = TRUE); - S32 getTotalMembersInRole() { return mMemberCount ? mMemberCount : mMemberIDs.size(); } //FIXME: Returns 0 for Everyone role when Member list isn't yet loaded, see MAINT-5225 + S32 getMembersInRole(uuid_vec_t members, bool needs_sort = true); + S32 getTotalMembersInRole() { return mMemberCount ? mMemberCount : static_cast<S32>(mMemberIDs.size()); } //FIXME: Returns 0 for Everyone role when Member list isn't yet loaded, see MAINT-5225 LLRoleData getRoleData() const { return mRoleData; } void setRoleData(LLRoleData data) { mRoleData = data; } @@ -169,7 +169,7 @@ public: protected: LLGroupRoleData() - : mMemberCount(0), mMembersNeedsSort(FALSE) {} + : mMemberCount(0), mMembersNeedsSort(false) {} LLUUID mRoleID; LLRoleData mRoleData; @@ -178,7 +178,7 @@ protected: S32 mMemberCount; private: - BOOL mMembersNeedsSort; + bool mMembersNeedsSort; }; struct LLRoleMemberChange @@ -221,7 +221,7 @@ struct LLGroupTitle { std::string mTitle; LLUUID mRoleID; - BOOL mSelected; + bool mSelected; }; class LLGroupMgrGroupData @@ -234,11 +234,11 @@ public: const LLUUID& getID() { return mID; } - BOOL getRoleData(const LLUUID& role_id, LLRoleData& role_data); + bool getRoleData(const LLUUID& role_id, LLRoleData& role_data); void setRoleData(const LLUUID& role_id, LLRoleData role_data); void createRole(const LLUUID& role_id, LLRoleData role_data); void deleteRole(const LLUUID& role_id); - BOOL pendingRoleChanges(); + bool pendingRoleChanges(); void addRolePower(const LLUUID& role_id, U64 power); void removeRolePower(const LLUUID& role_id, U64 power); @@ -297,15 +297,15 @@ public: LLUUID mOwnerRole; std::string mName; std::string mCharter; - BOOL mShowInList; + bool mShowInList; LLUUID mInsigniaID; LLUUID mFounderID; - BOOL mOpenEnrollment; + bool mOpenEnrollment; S32 mMembershipFee; - BOOL mAllowPublish; - BOOL mListInProfile; - BOOL mMaturePublish; - BOOL mChanged; + bool mAllowPublish; + bool mListInProfile; + bool mMaturePublish; + bool mChanged; S32 mMemberCount; S32 mRoleCount; @@ -398,9 +398,9 @@ public: U8 show_in_list, const LLUUID& insignia, S32 membership_fee, - BOOL open_enrollment, - BOOL allow_publish, - BOOL mature_publish); + bool open_enrollment, + bool allow_publish, + bool mature_publish); static void sendGroupMemberJoin(const LLUUID& group_id); static void sendGroupMemberInvites(const LLUUID& group_id, std::map<LLUUID,LLUUID>& role_member_pairs); diff --git a/indra/newview/llheroprobemanager.cpp b/indra/newview/llheroprobemanager.cpp index efe72128d4..66ccdd2b32 100644 --- a/indra/newview/llheroprobemanager.cpp +++ b/indra/newview/llheroprobemanager.cpp @@ -42,8 +42,8 @@ #include "llviewerjoystick.h" #include "llviewermediafocus.h" -extern BOOL gCubeSnapshot; -extern BOOL gTeleportDisplay; +extern bool gCubeSnapshot; +extern bool gTeleportDisplay; // get the next highest power of two of v (or v if v is already a power of two) //defined in llvertexbuffer.cpp @@ -101,7 +101,7 @@ void LLHeroProbeManager::update() U32 count = log2((F32)res) + 0.5f; mMipChain.resize(count); - for (int i = 0; i < count; ++i) + for (U32 i = 0; i < count; ++i) { mMipChain[i].allocate(res, res, GL_RGBA16F); res /= 2; @@ -188,18 +188,8 @@ void LLHeroProbeManager::update() LLVector3(0, 0, -1) }; - // Iterate through each face of the cube - for (int i = 0; i < 6; i++) - { - float cube_facing = fmax(-1, fmin(1.0f, cameraDirection * cubeFaces[i])); - - cube_facing = 1 - cube_facing; - - mFaceUpdateList[i] = ceilf(cube_facing * gPipeline.RenderHeroProbeConservativeUpdateMultiplier); - } - - mProbes[0]->mOrigin = probe_pos; + mProbes[0]->mRadius = mNearestHero->getScale().magVec() * 0.5f; } else { @@ -208,7 +198,7 @@ void LLHeroProbeManager::update() mHeroProbeStrength = 1; } -} + } void LLHeroProbeManager::renderProbes() { @@ -220,9 +210,10 @@ void LLHeroProbeManager::renderProbes() static LLCachedControl<S32> sDetail(gSavedSettings, "RenderHeroReflectionProbeDetail", -1); static LLCachedControl<S32> sLevel(gSavedSettings, "RenderHeroReflectionProbeLevel", 3); + static LLCachedControl<S32> sUpdateRate(gSavedSettings, "RenderHeroProbeUpdateRate", 0); F32 near_clip = 0.01f; - if (mNearestHero != nullptr && (gPipeline.RenderHeroProbeUpdateRate == 0 || (gFrameCount % gPipeline.RenderHeroProbeUpdateRate) == 0) && + if (mNearestHero != nullptr && !gTeleportDisplay && !gDisconnected && !LLAppViewer::instance()->logoutRequestSent()) { LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("hpmu - realtime"); @@ -230,22 +221,38 @@ void LLHeroProbeManager::renderProbes() bool radiance_pass = gPipeline.mReflectionMapManager.isRadiancePass(); gPipeline.mReflectionMapManager.mRadiancePass = true; - mRenderingMirror = true; + mRenderingMirror = true; + + S32 rate = sUpdateRate; + + // rate must be divisor of 6 (1, 2, 3, or 6) + if (rate < 1) + { + rate = 1; + } + else if (rate > 3) + { + rate = 6; + } - doOcclusion(); + S32 face = gFrameCount % 6; - for (U32 j = 0; j < mProbes.size(); j++) + if (!mProbes.empty() && !mProbes[0].isNull() && !mProbes[0]->mOccluded) { + LL_PROFILE_ZONE_NUM(gFrameCount % rate); + LL_PROFILE_ZONE_NUM(rate); + for (U32 i = 0; i < 6; ++i) { - if (mFaceUpdateList[i] > 0 && mCurrentProbeUpdateFrame % mFaceUpdateList[i] == 0) - { - updateProbeFace(mProbes[j], i, mNearestHero->getReflectionProbeIsDynamic() && sDetail > 0, near_clip); - mCurrentProbeUpdateFrame = 0; + if ((gFrameCount % rate) == (i % rate)) + { // update 6/rate faces per frame + LL_PROFILE_ZONE_NUM(i); + updateProbeFace(mProbes[0], i, mNearestHero->getReflectionProbeIsDynamic() && sDetail > 0, near_clip); } } - generateRadiance(mProbes[j]); + generateRadiance(mProbes[0]); } + mRenderingMirror = false; gPipeline.mReflectionMapManager.mRadiancePass = radiance_pass; @@ -253,8 +260,6 @@ void LLHeroProbeManager::renderProbes() mProbes[0]->mViewerObject = mNearestHero; mProbes[0]->autoAdjustOrigin(); } - - mCurrentProbeUpdateFrame++; } // Do the reflection map update render passes. @@ -359,7 +364,8 @@ void LLHeroProbeManager::updateProbeFace(LLReflectionMap* probe, U32 face, bool res /= 2; - S32 mip = i - (mMipChain.size() - mips); + llassert(mMipChain.size() <= size_t(S32_MAX)); + GLint mip = i - (S32(mMipChain.size()) - mips); if (mip >= 0) { @@ -387,6 +393,7 @@ void LLHeroProbeManager::updateProbeFace(LLReflectionMap* probe, U32 face, bool // Useful when we may not always be rendering a full set of faces of the probe. void LLHeroProbeManager::generateRadiance(LLReflectionMap* probe) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY; S32 sourceIdx = mReflectionProbeCount; // Unlike the reflectionmap manager, all probes are considered "realtime" for hero probes. @@ -487,7 +494,8 @@ void LLHeroProbeManager::updateUniforms() mHeroData.heroSphere.mV[3] = mProbes[0]->mRadius; } - mHeroData.heroMipCount = mMipChain.size(); + llassert(mMipChain.size() <= size_t(S32_MAX)); + mHeroData.heroMipCount = S32(mMipChain.size()); } void LLHeroProbeManager::renderDebug() @@ -592,7 +600,7 @@ void LLHeroProbeManager::doOcclusion() for (auto& probe : mProbes) { - if (probe != nullptr && probe != mDefaultProbe) + if (probe != nullptr) { probe->doOcclusion(eye); } diff --git a/indra/newview/llheroprobemanager.h b/indra/newview/llheroprobemanager.h index e45b0049b2..28852770c3 100644 --- a/indra/newview/llheroprobemanager.h +++ b/indra/newview/llheroprobemanager.h @@ -51,18 +51,18 @@ class alignas(16) LLHeroProbeManager { LL_ALIGN_NEW public: - enum class DetailLevel + enum class DetailLevel { STATIC_ONLY = 0, STATIC_AND_DYNAMIC, REALTIME = 2 }; - // allocate an environment map of the given resolution + // allocate an environment map of the given resolution LLHeroProbeManager(); ~LLHeroProbeManager(); - // release any GL state + // release any GL state void cleanup(); // maintain reflection probes @@ -90,11 +90,11 @@ public: LLVector3 mMirrorPosition; LLVector3 mMirrorNormal; HeroProbeData mHeroData; - + private: friend class LLPipeline; friend class LLReflectionMapManager; - + // update UBO used for rendering (call only once per render pipe flush) void updateUniforms(); @@ -103,7 +103,7 @@ private: // render target for cube snapshots // used to generate mipmaps without doing a copy-to-texture LLRenderTarget mRenderTarget; - + LLRenderTarget mHeroRenderTarget; std::vector<LLRenderTarget> mMipChain; @@ -120,7 +120,7 @@ private: // update the specified face of the specified probe void updateProbeFace(LLReflectionMap* probe, U32 face, bool is_dynamic, F32 near_clip); void generateRadiance(LLReflectionMap *probe); - + // list of active reflection maps std::vector<LLPointer<LLReflectionMap>> mProbes; @@ -136,10 +136,10 @@ private: // resolution of reflection probes U32 mProbeResolution = 1024; - + // maximum LoD of reflection probes (mip levels - 1) F32 mMaxProbeLOD = 6.f; - + F32 mHeroProbeStrength = 1.f; bool mIsInTransition = false; @@ -147,10 +147,7 @@ private: bool mReset = false; bool mRenderingMirror = false; - std::map<int, int> mFaceUpdateList; - - U32 mCurrentProbeUpdateFrame = 0; - + std::vector<LLPointer<LLVOVolume>> mHeroVOList; LLPointer<LLVOVolume> mNearestHero; diff --git a/indra/newview/llhints.cpp b/indra/newview/llhints.cpp index 1de2a64d72..d480274691 100644 --- a/indra/newview/llhints.cpp +++ b/indra/newview/llhints.cpp @@ -110,7 +110,7 @@ public: LLHintPopup(const Params&); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); void onClickClose() { @@ -180,7 +180,7 @@ LLHintPopup::LLHintPopup(const LLHintPopup::Params& p) } } -BOOL LLHintPopup::postBuild() +bool LLHintPopup::postBuild() { LLTextBox& hint_text = getChildRef<LLTextBox>("hint_text"); hint_text.setText(mNotification->getMessage()); @@ -193,7 +193,7 @@ BOOL LLHintPopup::postBuild() reshape(getRect().getWidth(), getRect().getHeight() + delta_height); hint_text.reshape(hint_text.getRect().getWidth(), hint_text.getRect().getHeight() + delta_height); // hint_text.translate(0, -delta_height); - return TRUE; + return true; } void LLHintPopup::draw() diff --git a/indra/newview/llhudeffect.cpp b/indra/newview/llhudeffect.cpp index f845284c8c..4d6636aa4c 100644 --- a/indra/newview/llhudeffect.cpp +++ b/indra/newview/llhudeffect.cpp @@ -42,9 +42,9 @@ LLHUDEffect::LLHUDEffect(const U8 type) mDuration(1.f), mColor() { - mNeedsSendToSim = FALSE; - mOriginatedHere = FALSE; - mDead = FALSE; + mNeedsSendToSim = false; + mOriginatedHere = false; + mDead = false; } LLHUDEffect::~LLHUDEffect() @@ -94,23 +94,23 @@ void LLHUDEffect::setDuration(const F32 duration) mDuration = duration; } -void LLHUDEffect::setNeedsSendToSim(const BOOL send_to_sim) +void LLHUDEffect::setNeedsSendToSim(const bool send_to_sim) { mNeedsSendToSim = send_to_sim; } -BOOL LLHUDEffect::getNeedsSendToSim() const +bool LLHUDEffect::getNeedsSendToSim() const { return mNeedsSendToSim; } -void LLHUDEffect::setOriginatedHere(const BOOL orig_here) +void LLHUDEffect::setOriginatedHere(const bool orig_here) { mOriginatedHere = orig_here; } -BOOL LLHUDEffect::getOriginatedHere() const +bool LLHUDEffect::getOriginatedHere() const { return mOriginatedHere; } @@ -122,7 +122,7 @@ void LLHUDEffect::getIDType(LLMessageSystem *mesgsys, S32 blocknum, LLUUID &id, mesgsys->getU8Fast(_PREHASH_Effect, _PREHASH_Type, type, blocknum); } -BOOL LLHUDEffect::isDead() const +bool LLHUDEffect::isDead() const { return mDead; } diff --git a/indra/newview/llhudeffect.h b/indra/newview/llhudeffect.h index e5f05599c9..cace745de6 100644 --- a/indra/newview/llhudeffect.h +++ b/indra/newview/llhudeffect.h @@ -40,17 +40,17 @@ class LLMessageSystem; class LLHUDEffect : public LLHUDObject { public: - void setNeedsSendToSim(const BOOL send_to_sim); - BOOL getNeedsSendToSim() const; - void setOriginatedHere(const BOOL orig_here); - BOOL getOriginatedHere() const; + void setNeedsSendToSim(const bool send_to_sim); + bool getNeedsSendToSim() const; + void setOriginatedHere(const bool orig_here); + bool getOriginatedHere() const; void setDuration(const F32 duration); void setColor(const LLColor4U &color); void setID(const LLUUID &id); const LLUUID &getID() const; - BOOL isDead() const; + bool isDead() const; friend class LLHUDManager; protected: @@ -70,8 +70,8 @@ protected: F32 mDuration; LLColor4U mColor; - BOOL mNeedsSendToSim; - BOOL mOriginatedHere; + bool mNeedsSendToSim; + bool mOriginatedHere; }; #endif // LL_LLHUDEFFECT_H diff --git a/indra/newview/llhudeffectbeam.cpp b/indra/newview/llhudeffectbeam.cpp index b3e98ba561..74d0e0af0b 100644 --- a/indra/newview/llhudeffectbeam.cpp +++ b/indra/newview/llhudeffectbeam.cpp @@ -116,7 +116,7 @@ void LLHUDEffectBeam::packData(LLMessageSystem *mesgsys) void LLHUDEffectBeam::unpackData(LLMessageSystem *mesgsys, S32 blocknum) { LL_ERRS() << "Got beam!" << LL_ENDL; - BOOL use_target_object; + bool use_target_object; LLVector3d new_target; U8 packed_data[41]; diff --git a/indra/newview/llhudeffectlookat.cpp b/indra/newview/llhudeffectlookat.cpp index eb49e53c86..c8b7e00776 100644 --- a/indra/newview/llhudeffectlookat.cpp +++ b/indra/newview/llhudeffectlookat.cpp @@ -42,7 +42,7 @@ #include "llxmltree.h" -BOOL LLHUDEffectLookAt::sDebugLookAt = FALSE; +bool LLHUDEffectLookAt::sDebugLookAt = false; // packet layout const S32 SOURCE_AVATAR = 0; @@ -138,11 +138,11 @@ static LLAttentionSet gGirlAttentions(GIRL_ATTS); -static BOOL loadGender(LLXmlTreeNode* gender) +static bool loadGender(LLXmlTreeNode* gender) { if( !gender) { - return FALSE; + return false; } std::string str; gender->getAttributeString("name", str); @@ -162,7 +162,7 @@ static BOOL loadGender(LLXmlTreeNode* gender) else if(str == "select") attention = &attentions[LOOKAT_TARGET_SELECT]; else if(str == "focus") attention = &attentions[LOOKAT_TARGET_FOCUS]; else if(str == "mouselook") attention = &attentions[LOOKAT_TARGET_MOUSELOOK]; - else return FALSE; + else return false; F32 priority, timeout; attention_node->getAttributeF32("priority", priority); @@ -171,30 +171,30 @@ static BOOL loadGender(LLXmlTreeNode* gender) attention->mPriority = priority; attention->mTimeout = timeout; } - return TRUE; + return true; } -static BOOL loadAttentions() +static bool loadAttentions() { - static BOOL first_time = TRUE; + static bool first_time = true; if( ! first_time) { - return TRUE; // maybe not ideal but otherwise it can continue to fail forever. + return true; // maybe not ideal but otherwise it can continue to fail forever. } - first_time = FALSE; + first_time = false; std::string filename; filename = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,"attentions.xml"); LLXmlTree xml_tree; - BOOL success = xml_tree.parseFile( filename, FALSE ); + bool success = xml_tree.parseFile( filename, false ); if( !success ) { - return FALSE; + return false; } LLXmlTreeNode* root = xml_tree.getRoot(); if( !root ) { - return FALSE; + return false; } //------------------------------------------------------------------------- @@ -203,7 +203,7 @@ static BOOL loadAttentions() if( !root->hasName( "linden_attentions" ) ) { LL_WARNS() << "Invalid linden_attentions file header: " << filename << LL_ENDL; - return FALSE; + return false; } std::string version; @@ -211,7 +211,7 @@ static BOOL loadAttentions() if( !root->getFastAttributeString( version_string, version ) || (version != "1.0") ) { LL_WARNS() << "Invalid linden_attentions file version: " << version << LL_ENDL; - return FALSE; + return false; } //------------------------------------------------------------------------- @@ -223,11 +223,11 @@ static BOOL loadAttentions() { if( !loadGender( child ) ) { - return FALSE; + return false; } } - return TRUE; + return true; } @@ -389,29 +389,29 @@ void LLHUDEffectLookAt::setTargetPosGlobal(const LLVector3d &target_pos_global) // setLookAt() // called by agent logic to set look at behavior locally, and propagate to sim //----------------------------------------------------------------------------- -BOOL LLHUDEffectLookAt::setLookAt(ELookAtType target_type, LLViewerObject *object, LLVector3 position) +bool LLHUDEffectLookAt::setLookAt(ELookAtType target_type, LLViewerObject *object, LLVector3 position) { if (!mSourceObject) { - return FALSE; + return false; } if (target_type >= LOOKAT_NUM_TARGETS) { LL_WARNS() << "Bad target_type " << (int)target_type << " - ignoring." << LL_ENDL; - return FALSE; + return false; } // must be same or higher priority than existing effect if ((*mAttentions)[target_type].mPriority < (*mAttentions)[mTargetType].mPriority) { - return FALSE; + return false; } F32 current_time = mTimer.getElapsedTimeF32(); // type of lookat behavior or target object has changed - BOOL lookAtChanged = (target_type != mTargetType) || (object != mTargetObject); + bool lookAtChanged = (target_type != mTargetType) || (object != mTargetObject); // lookat position has moved a certain amount and we haven't just sent an update lookAtChanged = lookAtChanged || ((dist_vec_squared(position, mLastSentOffsetGlobal) > MIN_DELTAPOS_FOR_UPDATE_SQUARED) && @@ -422,7 +422,7 @@ BOOL LLHUDEffectLookAt::setLookAt(ELookAtType target_type, LLViewerObject *objec mLastSentOffsetGlobal = position; F32 timeout = (*mAttentions)[target_type].mTimeout; setDuration(timeout); - setNeedsSendToSim(TRUE); + setNeedsSendToSim(true); } if (target_type == LOOKAT_TARGET_CLEAR) @@ -445,7 +445,7 @@ BOOL LLHUDEffectLookAt::setLookAt(ELookAtType target_type, LLViewerObject *objec update(); } - return TRUE; + return true; } //----------------------------------------------------------------------------- @@ -553,7 +553,7 @@ void LLHUDEffectLookAt::update() { clearLookAtTarget(); // look at timed out (only happens on own avatar), so tell everyone - setNeedsSendToSim(TRUE); + setNeedsSendToSim(true); } } @@ -610,7 +610,7 @@ bool LLHUDEffectLookAt::calcTargetPosition() { LLVOAvatar *target_av = (LLVOAvatar *)target_obj; - BOOL looking_at_self = source_avatar->isSelf() && target_av->isSelf(); + bool looking_at_self = source_avatar->isSelf() && target_av->isSelf(); // if selecting self, stare forward if (looking_at_self && mTargetOffsetGlobal.magVecSquared() < MIN_TARGET_OFFSET_SQUARED) diff --git a/indra/newview/llhudeffectlookat.h b/indra/newview/llhudeffectlookat.h index 9e92212cc8..0e57422ee1 100644 --- a/indra/newview/llhudeffectlookat.h +++ b/indra/newview/llhudeffectlookat.h @@ -57,7 +57,7 @@ public: /*virtual*/ void markDead(); /*virtual*/ void setSourceObject(LLViewerObject* objectp); - BOOL setLookAt(ELookAtType target_type, LLViewerObject *object, LLVector3 position); + bool setLookAt(ELookAtType target_type, LLViewerObject *object, LLVector3 position); void clearLookAtTarget(); ELookAtType getLookAtType() { return mTargetType; } @@ -79,7 +79,7 @@ protected: void setTargetPosGlobal(const LLVector3d &target_pos_global); public: - static BOOL sDebugLookAt; + static bool sDebugLookAt; private: ELookAtType mTargetType; diff --git a/indra/newview/llhudeffectpointat.cpp b/indra/newview/llhudeffectpointat.cpp index bfa81c7fd1..eeb38cd6aa 100644 --- a/indra/newview/llhudeffectpointat.cpp +++ b/indra/newview/llhudeffectpointat.cpp @@ -72,7 +72,7 @@ const S32 POINTAT_PRIORITIES[POINTAT_NUM_TARGETS] = // statics -BOOL LLHUDEffectPointAt::sDebugPointAt; +bool LLHUDEffectPointAt::sDebugPointAt; //----------------------------------------------------------------------------- @@ -219,39 +219,39 @@ void LLHUDEffectPointAt::setTargetPosGlobal(const LLVector3d &target_pos_global) // setPointAt() // called by agent logic to set look at behavior locally, and propagate to sim //----------------------------------------------------------------------------- -BOOL LLHUDEffectPointAt::setPointAt(EPointAtType target_type, LLViewerObject *object, LLVector3 position) +bool LLHUDEffectPointAt::setPointAt(EPointAtType target_type, LLViewerObject *object, LLVector3 position) { if (!mSourceObject) { - return FALSE; + return false; } if (target_type >= POINTAT_NUM_TARGETS) { LL_WARNS() << "Bad target_type " << (int)target_type << " - ignoring." << LL_ENDL; - return FALSE; + return false; } // must be same or higher priority than existing effect if (POINTAT_PRIORITIES[target_type] < POINTAT_PRIORITIES[mTargetType]) { - return FALSE; + return false; } F32 current_time = mTimer.getElapsedTimeF32(); // type of pointat behavior or target object has changed - BOOL targetTypeChanged = (target_type != mTargetType) || + bool targetTypeChanged = (target_type != mTargetType) || (object != mTargetObject); - BOOL targetPosChanged = (dist_vec_squared(position, mLastSentOffsetGlobal) > MIN_DELTAPOS_FOR_UPDATE_SQUARED) && + bool targetPosChanged = (dist_vec_squared(position, mLastSentOffsetGlobal) > MIN_DELTAPOS_FOR_UPDATE_SQUARED) && ((current_time - mLastSendTime) > (1.f / MAX_SENDS_PER_SEC)); if (targetTypeChanged || targetPosChanged) { mLastSentOffsetGlobal = position; setDuration(POINTAT_TIMEOUTS[target_type]); - setNeedsSendToSim(TRUE); + setNeedsSendToSim(true); // LL_INFOS() << "Sending pointat data" << LL_ENDL; } @@ -278,7 +278,7 @@ BOOL LLHUDEffectPointAt::setPointAt(EPointAtType target_type, LLViewerObject *ob update(); } - return TRUE; + return true; } //----------------------------------------------------------------------------- diff --git a/indra/newview/llhudeffectpointat.h b/indra/newview/llhudeffectpointat.h index 501e2992e2..34257d8da9 100644 --- a/indra/newview/llhudeffectpointat.h +++ b/indra/newview/llhudeffectpointat.h @@ -50,7 +50,7 @@ public: /*virtual*/ void markDead(); /*virtual*/ void setSourceObject(LLViewerObject* objectp); - BOOL setPointAt(EPointAtType target_type, LLViewerObject *object, LLVector3 position); + bool setPointAt(EPointAtType target_type, LLViewerObject *object, LLVector3 position); void clearPointAtTarget(); EPointAtType getPointAtType() { return mTargetType; } @@ -70,7 +70,7 @@ protected: bool calcTargetPosition(); void update(); public: - static BOOL sDebugPointAt; + static bool sDebugPointAt; private: EPointAtType mTargetType; LLVector3d mTargetOffsetGlobal; diff --git a/indra/newview/llhudeffecttrail.cpp b/indra/newview/llhudeffecttrail.cpp index ebdb15746b..48abd730c9 100644 --- a/indra/newview/llhudeffecttrail.cpp +++ b/indra/newview/llhudeffecttrail.cpp @@ -42,7 +42,7 @@ #include "llvoavatar.h" #include "llworld.h" -LLHUDEffectSpiral::LLHUDEffectSpiral(const U8 type) : LLHUDEffect(type), mbInit(FALSE) +LLHUDEffectSpiral::LLHUDEffectSpiral(const U8 type) : LLHUDEffect(type), mbInit(false) { mKillTime = 10.f; mVMag = 1.f; @@ -167,7 +167,7 @@ void LLHUDEffectSpiral::triggerLocal() { mKillTime = mTimer.getElapsedTimeF32() + mDuration; - BOOL show_beam = gSavedSettings.getBOOL("ShowSelectionBeam"); + bool show_beam = gSavedSettings.getBOOL("ShowSelectionBeam"); LLColor4 color; color.setVec(mColor); @@ -247,7 +247,7 @@ void LLHUDEffectSpiral::triggerLocal() } } - mbInit = TRUE; + mbInit = true; } void LLHUDEffectSpiral::setTargetObject(LLViewerObject *objp) diff --git a/indra/newview/llhudeffecttrail.h b/indra/newview/llhudeffecttrail.h index 39418ccef0..042dfd8f20 100644 --- a/indra/newview/llhudeffecttrail.h +++ b/indra/newview/llhudeffecttrail.h @@ -76,7 +76,7 @@ private: F32 mOffset[NUM_TRAIL_POINTS]; */ - BOOL mbInit; + bool mbInit; LLPointer<LLViewerPartSource> mPartSourcep; F32 mKillTime; diff --git a/indra/newview/llhudicon.cpp b/indra/newview/llhudicon.cpp index dfff6c1dc4..8fa4118a40 100644 --- a/indra/newview/llhudicon.cpp +++ b/indra/newview/llhudicon.cpp @@ -65,7 +65,7 @@ LLHUDIcon::LLHUDIcon(const U8 type) : LLHUDObject(type), mImagep(NULL), mScale(0.1f), - mHidden(FALSE) + mHidden(false) { sIconInstances.push_back(this); } @@ -186,15 +186,15 @@ void LLHUDIcon::markDead() LLHUDObject::markDead(); } -BOOL LLHUDIcon::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, LLVector4a* intersection) +bool LLHUDIcon::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, LLVector4a* intersection) { if (mHidden) - return FALSE; + return false; if (mSourceObject.isNull() || mImagep.isNull()) { markDead(); - return FALSE; + return false; } LLVector3 obj_position = mSourceObject->getRenderPosition(); @@ -233,7 +233,7 @@ BOOL LLHUDIcon::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& if (time_elapsed > MAX_VISIBLE_TIME) { markDead(); - return FALSE; + return false; } F32 image_aspect = (F32)mImagep->getFullWidth() / (F32)mImagep->getFullHeight() ; @@ -272,10 +272,10 @@ BOOL LLHUDIcon::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& dir.mul(t); intersection->setAdd(start, dir); } - return TRUE; + return true; } - return FALSE; + return false; } //static @@ -312,7 +312,7 @@ void LLHUDIcon::updateAll() } //static -BOOL LLHUDIcon::iconsNearby() +bool LLHUDIcon::iconsNearby() { return !sIconInstances.empty(); } diff --git a/indra/newview/llhudicon.h b/indra/newview/llhudicon.h index edc843aa8c..b18a4a3b76 100644 --- a/indra/newview/llhudicon.h +++ b/indra/newview/llhudicon.h @@ -62,12 +62,12 @@ public: static void cleanupDeadIcons(); static S32 getNumInstances(); - static BOOL iconsNearby(); + static bool iconsNearby(); - BOOL getHidden() const { return mHidden; } - void setHidden( BOOL hide ) { mHidden = hide; } + bool getHidden() const { return mHidden; } + void setHidden( bool hide ) { mHidden = hide; } - BOOL lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, LLVector4a* intersection); + bool lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, LLVector4a* intersection); protected: LLHUDIcon(const U8 type); @@ -79,7 +79,7 @@ private: LLFrameTimer mLifeTimer; F32 mDistance; F32 mScale; - BOOL mHidden; + bool mHidden; typedef std::vector<LLPointer<LLHUDIcon> > icon_instance_t; static icon_instance_t sIconInstances; diff --git a/indra/newview/llhudmanager.cpp b/indra/newview/llhudmanager.cpp index 531ca804ef..fd8efe6816 100644 --- a/indra/newview/llhudmanager.cpp +++ b/indra/newview/llhudmanager.cpp @@ -96,7 +96,7 @@ void LLHUDManager::sendEffects() msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_Effect); hep->packData(msg); - hep->setNeedsSendToSim(FALSE); + hep->setNeedsSendToSim(false); gAgent.sendMessage(); } } @@ -125,7 +125,7 @@ void LLHUDManager::cleanupEffects() } } -LLHUDEffect *LLHUDManager::createViewerEffect(const U8 type, BOOL send_to_sim, BOOL originated_here) +LLHUDEffect *LLHUDManager::createViewerEffect(const U8 type, bool send_to_sim, bool originated_here) { // SJB: DO NOT USE addHUDObject!!! Not all LLHUDObjects are LLHUDEffects! LLHUDEffect *hep = LLHUDObject::addHUDEffect(type); @@ -191,7 +191,7 @@ void LLHUDManager::processViewerEffect(LLMessageSystem *mesgsys, void **user_dat { if (!effectp) { - effectp = LLHUDManager::getInstance()->createViewerEffect(effect_type, FALSE, FALSE); + effectp = LLHUDManager::getInstance()->createViewerEffect(effect_type, false, false); } if (effectp) diff --git a/indra/newview/llhudmanager.h b/indra/newview/llhudmanager.h index 27e5bafe61..58de31a061 100644 --- a/indra/newview/llhudmanager.h +++ b/indra/newview/llhudmanager.h @@ -40,7 +40,7 @@ class LLHUDManager : public LLSingleton<LLHUDManager> ~LLHUDManager(); public: - LLHUDEffect *createViewerEffect(const U8 type, BOOL send_to_sim = TRUE, BOOL originated_here = TRUE); + LLHUDEffect *createViewerEffect(const U8 type, bool send_to_sim = true, bool originated_here = true); void updateEffects(); void sendEffects(); diff --git a/indra/newview/llhudnametag.cpp b/indra/newview/llhudnametag.cpp index f873eff87d..e1bf6c2077 100644 --- a/indra/newview/llhudnametag.cpp +++ b/indra/newview/llhudnametag.cpp @@ -65,7 +65,7 @@ const F32 LOD_2_SCREEN_COVERAGE = 0.40f; std::set<LLPointer<LLHUDNameTag> > LLHUDNameTag::sTextObjects; std::vector<LLPointer<LLHUDNameTag> > LLHUDNameTag::sVisibleTextObjects; -BOOL LLHUDNameTag::sDisplayText = TRUE ; +bool LLHUDNameTag::sDisplayText = true ; const F32 LLHUDNameTag::NAMETAG_MAX_WIDTH = 298.f; const F32 LLHUDNameTag::HUD_TEXT_MAX_WIDTH = 190.f; @@ -77,13 +77,13 @@ bool llhudnametag_further_away::operator()(const LLPointer<LLHUDNameTag>& lhs, c LLHUDNameTag::LLHUDNameTag(const U8 type) : LLHUDObject(type), - mDoFade(TRUE), + mDoFade(true), mFadeDistance(8.f), mFadeRange(4.f), mLastDistance(0.f), - mZCompare(TRUE), - mVisibleOffScreen(FALSE), - mOffscreen(FALSE), + mZCompare(true), + mVisibleOffScreen(false), + mOffscreen(false), mColor(1.f, 1.f, 1.f, 1.f), // mScale(), mWidth(0.f), @@ -102,7 +102,7 @@ LLHUDNameTag::LLHUDNameTag(const U8 type) mTextAlignment(ALIGN_TEXT_CENTER), mVertAlignment(ALIGN_VERT_CENTER), mLOD(0), - mHidden(FALSE) + mHidden(false) { LLPointer<LLHUDNameTag> ptr(this); sTextObjects.insert(ptr); @@ -116,17 +116,17 @@ LLHUDNameTag::~LLHUDNameTag() } -BOOL LLHUDNameTag::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, LLVector4a& intersection, BOOL debug_render) +bool LLHUDNameTag::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, LLVector4a& intersection, bool debug_render) { if (!mVisible || mHidden) { - return FALSE; + return false; } // don't pick text that isn't bound to a viewerobject if (!mSourceObject || mSourceObject->mDrawable.isNull()) { - return FALSE; + return false; } F32 alpha_factor = 1.f; @@ -141,7 +141,7 @@ BOOL LLHUDNameTag::lineSegmentIntersect(const LLVector4a& start, const LLVector4 } if (text_color.mV[3] < 0.01f) { - return FALSE; + return false; } mOffsetY = lltrunc(mHeight * ((mVertAlignment == ALIGN_VERT_CENTER) ? 0.5f : 1.f)); @@ -176,7 +176,7 @@ BOOL LLHUDNameTag::lineSegmentIntersect(const LLVector4a& start, const LLVector4 LLVector3 height_vec = mHeight * y_pixel_vec; LLCoordGL screen_pos; - LLViewerCamera::getInstance()->projectPosAgentToScreen(position, screen_pos, FALSE); + LLViewerCamera::getInstance()->projectPosAgentToScreen(position, screen_pos, false); LLVector2 screen_offset; screen_offset = updateScreenPos(mPositionOffset); @@ -216,11 +216,11 @@ BOOL LLHUDNameTag::lineSegmentIntersect(const LLVector4a& start, const LLVector4 { dir.mul(t); intersection.setAdd(start, dir); - return TRUE; + return true; } } - return FALSE; + return false; } void LLHUDNameTag::render() @@ -230,11 +230,11 @@ void LLHUDNameTag::render() { LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); //LLGLDisable gls_stencil(GL_STENCIL_TEST); - renderText(FALSE); + renderText(false); } } -void LLHUDNameTag::renderText(BOOL for_select) +void LLHUDNameTag::renderText(bool for_select) { if (!mVisible || mHidden) { @@ -257,7 +257,7 @@ void LLHUDNameTag::renderText(BOOL for_select) gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); } - LLGLState gls_blend(GL_BLEND, for_select ? FALSE : TRUE); + LLGLState gls_blend(GL_BLEND, !for_select); LLColor4 shadow_color(0.f, 0.f, 0.f, 1.f); F32 alpha_factor = 1.f; @@ -296,7 +296,7 @@ void LLHUDNameTag::renderText(BOOL for_select) mRadius = (width_vec + height_vec).magVec() * 0.5f; LLCoordGL screen_pos; - LLViewerCamera::getInstance()->projectPosAgentToScreen(mPositionAgent, screen_pos, FALSE); + LLViewerCamera::getInstance()->projectPosAgentToScreen(mPositionAgent, screen_pos, false); LLVector2 screen_offset = updateScreenPos(mPositionOffset); @@ -342,7 +342,7 @@ void LLHUDNameTag::renderText(BOOL for_select) LLColor4 label_color(0.f, 0.f, 0.f, 1.f); label_color.mV[VALPHA] = alpha_factor; - hud_render_text(segment_iter->getText(), render_position, *fontp, segment_iter->mStyle, LLFontGL::NO_SHADOW, x_offset, y_offset, label_color, FALSE); + hud_render_text(segment_iter->getText(), render_position, *fontp, segment_iter->mStyle, LLFontGL::NO_SHADOW, x_offset, y_offset, label_color, false); } } @@ -387,7 +387,7 @@ void LLHUDNameTag::renderText(BOOL for_select) text_color = segment_iter->mColor; text_color.mV[VALPHA] *= alpha_factor; - hud_render_text(segment_iter->getText(), render_position, *fontp, style, shadow, x_offset, y_offset, text_color, FALSE); + hud_render_text(segment_iter->getText(), render_position, *fontp, style, shadow, x_offset, y_offset, text_color, false); } } /// Reset the default color to white. The renderer expects this to be the default. @@ -443,7 +443,7 @@ void LLHUDNameTag::addLine(const std::string &text_utf8, // "QualityAssurance AssuresQuality1" will end up as "QualityAssurance AssuresQua..." because we are enforcing single line do { - S32 segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels, wline.length(), LLFontGL::ANYWHERE); + auto segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels, static_cast<S32>(wline.length()), LLFontGL::ANYWHERE); if (segment_length + line_length < wline.length()) // since we only draw one string, line_length should be 0 { // token does does not fit into signle line, need to draw "...". @@ -451,7 +451,7 @@ void LLHUDNameTag::addLine(const std::string &text_utf8, const LLWString dots_pad(utf8str_to_wstring(std::string("...."))); S32 elipses_width = font->getWidthF32(dots_pad.c_str()); // truncated string length - segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels - elipses_width, wline.length(), LLFontGL::ANYWHERE); + segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels - elipses_width, static_cast<S32>(wline.length()), LLFontGL::ANYWHERE); const LLWString dots(utf8str_to_wstring(std::string("..."))); LLHUDTextSegment segment(iter->substr(line_length, segment_length) + dots, style, color, font); mTextSegments.push_back(segment); @@ -472,7 +472,7 @@ void LLHUDNameTag::addLine(const std::string &text_utf8, // "QualityAssurance AssuresQuality 1" will be split into two lines "QualityAssurance" and "AssuresQuality" do { - S32 segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels, wline.length(), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); + S32 segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels, static_cast<S32>(wline.length()), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); LLHUDTextSegment segment(iter->substr(line_length, segment_length), style, color, font); mTextSegments.push_back(segment); line_length += segment_length; @@ -511,7 +511,7 @@ void LLHUDNameTag::addLabel(const std::string& label_utf8, F32 max_pixels) do { S32 segment_length = mFontp->maxDrawableChars(iter->substr(line_length).c_str(), - max_pixels, wstr.length(), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); + max_pixels, static_cast<S32>(wstr.length()), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); LLHUDTextSegment segment(iter->substr(line_length, segment_length), LLFontGL::NORMAL, mColor, mFontp); mLabelSegments.push_back(segment); line_length += segment_length; @@ -522,7 +522,7 @@ void LLHUDNameTag::addLabel(const std::string& label_utf8, F32 max_pixels) } } -void LLHUDNameTag::setZCompare(const BOOL zcompare) +void LLHUDNameTag::setZCompare(const bool zcompare) { mZCompare = zcompare; } @@ -554,7 +554,7 @@ void LLHUDNameTag::setAlpha(F32 alpha) } -void LLHUDNameTag::setDoFade(const BOOL do_fade) +void LLHUDNameTag::setDoFade(const bool do_fade) { mDoFade = do_fade; } @@ -571,7 +571,7 @@ void LLHUDNameTag::updateVisibility() if (!mSourceObject) { //LL_WARNS() << "LLHUDNameTag::updateScreenPos -- mSourceObject is NULL!" << LL_ENDL; - mVisible = TRUE; + mVisible = true; sVisibleTextObjects.push_back(LLPointer<LLHUDNameTag> (this)); return; } @@ -579,7 +579,7 @@ void LLHUDNameTag::updateVisibility() // Not visible if parent object is dead if (mSourceObject->isDead()) { - mVisible = FALSE; + mVisible = false; return; } @@ -590,7 +590,7 @@ void LLHUDNameTag::updateVisibility() if (dir_from_camera * LLViewerCamera::getInstance()->getAtAxis() <= 0.f) { //text is behind camera, don't render - mVisible = FALSE; + mVisible = false; return; } @@ -607,7 +607,7 @@ void LLHUDNameTag::updateVisibility() if (mLOD >= 3 || !mTextSegments.size() || (mDoFade && (mLastDistance > mFadeDistance + mFadeRange))) { - mVisible = FALSE; + mVisible = false; return; } @@ -620,21 +620,21 @@ void LLHUDNameTag::updateVisibility() (x_pixel_vec * mPositionOffset.mV[VX]) + (y_pixel_vec * mPositionOffset.mV[VY]); - mOffscreen = FALSE; + mOffscreen = false; if (!LLViewerCamera::getInstance()->sphereInFrustum(render_position, mRadius)) { if (!mVisibleOffScreen) { - mVisible = FALSE; + mVisible = false; return; } else { - mOffscreen = TRUE; + mOffscreen = true; } } - mVisible = TRUE; + mVisible = true; sVisibleTextObjects.push_back(LLPointer<LLHUDNameTag> (this)); } @@ -646,7 +646,7 @@ LLVector2 LLHUDNameTag::updateScreenPos(LLVector2 &offset) LLVector3 y_pixel_vec; LLViewerCamera::getInstance()->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec); LLVector3 world_pos = mPositionAgent + (offset.mV[VX] * x_pixel_vec) + (offset.mV[VY] * y_pixel_vec); - if (!LLViewerCamera::getInstance()->projectPosAgentToScreen(world_pos, screen_pos, FALSE) && mVisibleOffScreen) + if (!LLViewerCamera::getInstance()->projectPosAgentToScreen(world_pos, screen_pos, false) && mVisibleOffScreen) { // bubble off-screen, so find a spot for it along screen edge LLViewerCamera::getInstance()->projectPosAgentToScreenEdge(world_pos, screen_pos); diff --git a/indra/newview/llhudnametag.h b/indra/newview/llhudnametag.h index 36d774cccf..9abd8f33cc 100644 --- a/indra/newview/llhudnametag.h +++ b/indra/newview/llhudnametag.h @@ -111,9 +111,9 @@ public: void setFont(const LLFontGL* font); void setColor(const LLColor4 &color); void setAlpha(F32 alpha); - void setZCompare(const BOOL zcompare); - void setDoFade(const BOOL do_fade); - void setVisibleOffScreen(BOOL visible) { mVisibleOffScreen = visible; } + void setZCompare(const bool zcompare); + void setDoFade(const bool do_fade); + void setVisibleOffScreen(bool visible) { mVisibleOffScreen = visible; } // mMaxLines of -1 means unlimited lines. void setMaxLines(S32 max_lines) { mMaxLines = max_lines; } @@ -128,37 +128,37 @@ public: friend class LLHUDObject; /*virtual*/ F32 getDistance() const { return mLastDistance; } S32 getLOD() const { return mLOD; } - BOOL getVisible() const { return mVisible; } - BOOL getHidden() const { return mHidden; } - void setHidden( BOOL hide ) { mHidden = hide; } + bool getVisible() const { return mVisible; } + bool getHidden() const { return mHidden; } + void setHidden( bool hide ) { mHidden = hide; } void shift(const LLVector3& offset); F32 getWorldHeight() const; - BOOL lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, LLVector4a& intersection, BOOL debug_render = FALSE); + bool lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, LLVector4a& intersection, bool debug_render = false); static void shiftAll(const LLVector3& offset); static void addPickable(std::set<LLViewerObject*> &pick_list); static void reshape(); - static void setDisplayText(BOOL flag) { sDisplayText = flag ; } + static void setDisplayText(bool flag) { sDisplayText = flag ; } protected: LLHUDNameTag(const U8 type); /*virtual*/ void render(); - void renderText(BOOL for_select); + void renderText(bool for_select); static void updateAll(); void setLOD(S32 lod); S32 getMaxLines(); private: ~LLHUDNameTag(); - BOOL mDoFade; + bool mDoFade; F32 mFadeRange; F32 mFadeDistance; F32 mLastDistance; - BOOL mZCompare; - BOOL mVisibleOffScreen; - BOOL mOffscreen; + bool mZCompare; + bool mVisibleOffScreen; + bool mOffscreen; LLColor4 mColor; // LLVector3 mScale; F32 mWidth; @@ -180,11 +180,11 @@ private: ETextAlignment mTextAlignment; EVertAlignment mVertAlignment; S32 mLOD; - BOOL mHidden; + bool mHidden; LLPointer<LLUIImage> mRoundedRectImgp; LLPointer<LLUIImage> mRoundedRectTopImgp; - static BOOL sDisplayText ; + static bool sDisplayText ; static std::set<LLPointer<LLHUDNameTag> > sTextObjects; static std::vector<LLPointer<LLHUDNameTag> > sVisibleTextObjects; // static std::vector<LLPointer<LLHUDNameTag> > sVisibleHUDTextObjects; diff --git a/indra/newview/llhudobject.cpp b/indra/newview/llhudobject.cpp index e922e8230c..e6fbfbfb38 100644 --- a/indra/newview/llhudobject.cpp +++ b/indra/newview/llhudobject.cpp @@ -52,7 +52,7 @@ struct hud_object_further_away bool hud_object_further_away::operator()(const LLPointer<LLHUDObject>& lhs, const LLPointer<LLHUDObject>& rhs) const { - return (lhs->getDistance() > rhs->getDistance()) ? true : false; + return lhs->getDistance() > rhs->getDistance(); } @@ -61,9 +61,9 @@ LLHUDObject::LLHUDObject(const U8 type) : mSourceObject(NULL), mTargetObject(NULL) { - mVisible = TRUE; + mVisible = true; mType = type; - mDead = FALSE; + mDead = false; } LLHUDObject::~LLHUDObject() @@ -72,8 +72,8 @@ LLHUDObject::~LLHUDObject() void LLHUDObject::markDead() { - mVisible = FALSE; - mDead = TRUE; + mVisible = false; + mDead = true; mSourceObject = NULL; mTargetObject = NULL; } diff --git a/indra/newview/llhudobject.h b/indra/newview/llhudobject.h index 13953d2329..8c628e3f92 100644 --- a/indra/newview/llhudobject.h +++ b/indra/newview/llhudobject.h @@ -58,7 +58,7 @@ public: void setPositionGlobal(const LLVector3d &position_global); void setPositionAgent(const LLVector3 &position_agent); - BOOL isVisible() const { return mVisible; } + bool isVisible() const { return mVisible; } U8 getType() const { return mType; } @@ -109,8 +109,8 @@ protected: protected: U8 mType; - BOOL mDead; - BOOL mVisible; + bool mDead; + bool mVisible; LLVector3d mPositionGlobal; LLPointer<LLViewerObject> mSourceObject; LLPointer<LLViewerObject> mTargetObject; diff --git a/indra/newview/llhudrender.cpp b/indra/newview/llhudrender.cpp index 563f1dbf96..ead45b7dcc 100644 --- a/indra/newview/llhudrender.cpp +++ b/indra/newview/llhudrender.cpp @@ -44,7 +44,7 @@ void hud_render_utf8text(const std::string &str, const LLVector3 &pos_agent, const LLFontGL::ShadowType shadow, const F32 x_offset, const F32 y_offset, const LLColor4& color, - const BOOL orthographic) + const bool orthographic) { LLWString wstr(utf8str_to_wstring(str)); hud_render_text(wstr, pos_agent, font, style, shadow, x_offset, y_offset, color, orthographic); @@ -56,7 +56,7 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent, const LLFontGL::ShadowType shadow, const F32 x_offset, const F32 y_offset, const LLColor4& color, - const BOOL orthographic) + const bool orthographic) { LLViewerCamera* camera = LLViewerCamera::getInstance(); // Do cheap plane culling @@ -140,7 +140,7 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent, LLUI::translate((F32) winX*1.0f/LLFontGL::sScaleX, (F32) winY*1.0f/(LLFontGL::sScaleY), -(((F32) winZ*2.f)-1.f)); F32 right_x; - font.render(wstr, 0, 0, 1, color, LLFontGL::LEFT, LLFontGL::BASELINE, style, shadow, wstr.length(), 1000, &right_x, /*use_ellipses*/false, /*use_color*/true); + font.render(wstr, 0, 0, 1, color, LLFontGL::LEFT, LLFontGL::BASELINE, style, shadow, static_cast<S32>(wstr.length()), 1000, &right_x, /*use_ellipses*/false, /*use_color*/true); LLUI::popMatrix(); gGL.popMatrix(); diff --git a/indra/newview/llhudrender.h b/indra/newview/llhudrender.h index 5b95ff9b71..eb8f07e4d4 100644 --- a/indra/newview/llhudrender.h +++ b/indra/newview/llhudrender.h @@ -41,7 +41,7 @@ void hud_render_text(const LLWString &wstr, const F32 x_offset, const F32 y_offset, const LLColor4& color, - const BOOL orthographic); + const bool orthographic); // Legacy, slower void hud_render_utf8text(const std::string &str, @@ -52,7 +52,7 @@ void hud_render_utf8text(const std::string &str, const F32 x_offset, const F32 y_offset, const LLColor4& color, - const BOOL orthographic); + const bool orthographic); #endif //LL_LLHUDRENDER_H diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp index 736c0a5bcd..5ee0ab437d 100644 --- a/indra/newview/llhudtext.cpp +++ b/indra/newview/llhudtext.cpp @@ -58,7 +58,7 @@ const F32 MAX_DRAW_DISTANCE = 300.f; std::set<LLPointer<LLHUDText> > LLHUDText::sTextObjects; std::vector<LLPointer<LLHUDText> > LLHUDText::sVisibleTextObjects; std::vector<LLPointer<LLHUDText> > LLHUDText::sVisibleHUDTextObjects; -BOOL LLHUDText::sDisplayText = TRUE ; +bool LLHUDText::sDisplayText = true ; bool lltextobject_further_away::operator()(const LLPointer<LLHUDText>& lhs, const LLPointer<LLHUDText>& rhs) const { @@ -68,8 +68,8 @@ bool lltextobject_further_away::operator()(const LLPointer<LLHUDText>& lhs, cons LLHUDText::LLHUDText(const U8 type) : LLHUDObject(type), - mOnHUDAttachment(FALSE), -// mVisibleOffScreen(FALSE), + mOnHUDAttachment(false), +// mVisibleOffScreen(false), mWidth(0.f), mHeight(0.f), mFontp(LLFontGL::getFontSansSerifSmall()), @@ -80,14 +80,14 @@ LLHUDText::LLHUDText(const U8 type) : mTextAlignment(ALIGN_TEXT_CENTER), mVertAlignment(ALIGN_VERT_CENTER), // mLOD(0), - mHidden(FALSE) + mHidden(false) { mColor = LLColor4(1.f, 1.f, 1.f, 1.f); - mDoFade = TRUE; + mDoFade = true; mFadeDistance = 8.f; mFadeRange = 4.f; - mZCompare = TRUE; - mOffscreen = FALSE; + mZCompare = true; + mOffscreen = false; mRadius = 0.1f; LLPointer<LLHUDText> ptr(this); sTextObjects.insert(ptr); @@ -116,7 +116,7 @@ void LLHUDText::renderText() gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); - LLGLState gls_blend(GL_BLEND, TRUE); + LLGLState gls_blend(GL_BLEND, true); LLColor4 shadow_color(0.f, 0.f, 0.f, 1.f); F32 alpha_factor = 1.f; @@ -274,7 +274,7 @@ void LLHUDText::addLine(const std::string &text_utf8, do { F32 max_pixels = HUD_TEXT_MAX_WIDTH_NO_BUBBLE; - S32 segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels, wline.length(), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); + S32 segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels, static_cast<S32>(wline.length()), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); LLHUDTextSegment segment(iter->substr(line_length, segment_length), style, color, font); mTextSegments.push_back(segment); line_length += segment_length; @@ -285,7 +285,7 @@ void LLHUDText::addLine(const std::string &text_utf8, } } -void LLHUDText::setZCompare(const BOOL zcompare) +void LLHUDText::setZCompare(const bool zcompare) { mZCompare = zcompare; } @@ -317,7 +317,7 @@ void LLHUDText::setAlpha(F32 alpha) } -void LLHUDText::setDoFade(const BOOL do_fade) +void LLHUDText::setDoFade(const bool do_fade) { mDoFade = do_fade; } @@ -334,7 +334,7 @@ void LLHUDText::updateVisibility() if (!mSourceObject) { // Beacons - mVisible = TRUE; + mVisible = true; if (mOnHUDAttachment) { sVisibleHUDTextObjects.push_back(LLPointer<LLHUDText> (this)); @@ -349,14 +349,14 @@ void LLHUDText::updateVisibility() // Not visible if parent object is dead if (mSourceObject->isDead()) { - mVisible = FALSE; + mVisible = false; return; } // for now, all text on hud objects is visible if (mOnHUDAttachment) { - mVisible = TRUE; + mVisible = true; sVisibleHUDTextObjects.push_back(LLPointer<LLHUDText> (this)); mLastDistance = mPositionAgent.mV[VX]; return; @@ -369,7 +369,7 @@ void LLHUDText::updateVisibility() if (dir_from_camera * LLViewerCamera::getInstance()->getAtAxis() <= 0.f) { //text is behind camera, don't render - mVisible = FALSE; + mVisible = false; return; } @@ -386,7 +386,7 @@ void LLHUDText::updateVisibility() if (!mTextSegments.size() || (mDoFade && (mLastDistance > mFadeDistance + mFadeRange))) { - mVisible = FALSE; + mVisible = false; return; } @@ -407,7 +407,7 @@ void LLHUDText::updateVisibility() if(last_distance_center > max_draw_distance) { - mVisible = FALSE; + mVisible = false; return; } @@ -421,21 +421,21 @@ void LLHUDText::updateVisibility() (x_pixel_vec * mPositionOffset.mV[VX]) + (y_pixel_vec * mPositionOffset.mV[VY]); - mOffscreen = FALSE; + mOffscreen = false; if (!LLViewerCamera::getInstance()->sphereInFrustum(render_position, mRadius)) { // if (!mVisibleOffScreen) // { - mVisible = FALSE; + mVisible = false; return; // } // else // { -// mOffscreen = TRUE; +// mOffscreen = true; // } } - mVisible = TRUE; + mVisible = true; sVisibleTextObjects.push_back(LLPointer<LLHUDText> (this)); } @@ -447,7 +447,7 @@ LLVector2 LLHUDText::updateScreenPos(LLVector2 &offset) LLVector3 y_pixel_vec; LLViewerCamera::getInstance()->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec); // LLVector3 world_pos = mPositionAgent + (offset.mV[VX] * x_pixel_vec) + (offset.mV[VY] * y_pixel_vec); -// if (!LLViewerCamera::getInstance()->projectPosAgentToScreen(world_pos, screen_pos, FALSE) && mVisibleOffScreen) +// if (!LLViewerCamera::getInstance()->projectPosAgentToScreen(world_pos, screen_pos, false) && mVisibleOffScreen) // { // // bubble off-screen, so find a spot for it along screen edge // LLViewerCamera::getInstance()->projectPosAgentToScreenEdge(world_pos, screen_pos); diff --git a/indra/newview/llhudtext.h b/indra/newview/llhudtext.h index 1bfd12256e..a81fdebb17 100644 --- a/indra/newview/llhudtext.h +++ b/indra/newview/llhudtext.h @@ -97,9 +97,9 @@ public: void setFont(const LLFontGL* font); void setColor(const LLColor4 &color); void setAlpha(F32 alpha); - void setZCompare(const BOOL zcompare); - void setDoFade(const BOOL do_fade); -// void setVisibleOffScreen(BOOL visible) { mVisibleOffScreen = visible; } + void setZCompare(const bool zcompare); + void setDoFade(const bool do_fade); +// void setVisibleOffScreen(bool visible) { mVisibleOffScreen = visible; } // mMaxLines of -1 means unlimited lines. void setMaxLines(S32 max_lines) { mMaxLines = max_lines; } @@ -113,16 +113,16 @@ public: /*virtual*/ void markDead(); friend class LLHUDObject; /*virtual*/ F32 getDistance() const { return mLastDistance; } - BOOL getVisible() { return mVisible; } - BOOL getHidden() const { return mHidden; } - void setHidden( BOOL hide ) { mHidden = hide; } - void setOnHUDAttachment(BOOL on_hud) { mOnHUDAttachment = on_hud; } + bool getVisible() { return mVisible; } + bool getHidden() const { return mHidden; } + void setHidden( bool hide ) { mHidden = hide; } + void setOnHUDAttachment(bool on_hud) { mOnHUDAttachment = on_hud; } void shift(const LLVector3& offset); static void shiftAll(const LLVector3& offset); static void renderAllHUD(); static void reshape(); - static void setDisplayText(BOOL flag) { sDisplayText = flag ; } + static void setDisplayText(bool flag) { sDisplayText = flag ; } protected: LLHUDText(const U8 type); @@ -134,14 +134,14 @@ protected: private: ~LLHUDText(); - BOOL mOnHUDAttachment; - BOOL mDoFade; + bool mOnHUDAttachment; + bool mDoFade; F32 mFadeRange; F32 mFadeDistance; F32 mLastDistance; - BOOL mZCompare; -// BOOL mVisibleOffScreen; - BOOL mOffscreen; + bool mZCompare; +// bool mVisibleOffScreen; + bool mOffscreen; LLColor4 mColor; LLVector3 mScale; F32 mWidth; @@ -160,9 +160,9 @@ private: std::vector<LLHUDTextSegment> mTextSegments; ETextAlignment mTextAlignment; EVertAlignment mVertAlignment; - BOOL mHidden; + bool mHidden; - static BOOL sDisplayText ; + static bool sDisplayText ; static std::set<LLPointer<LLHUDText> > sTextObjects; static std::vector<LLPointer<LLHUDText> > sVisibleTextObjects; static std::vector<LLPointer<LLHUDText> > sVisibleHUDTextObjects; diff --git a/indra/newview/llhudview.cpp b/indra/newview/llhudview.cpp index be4c5f9d33..23fdf4b0fd 100644 --- a/indra/newview/llhudview.cpp +++ b/indra/newview/llhudview.cpp @@ -62,11 +62,11 @@ void LLHUDView::draw() } /*virtual*/ -BOOL LLHUDView::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLHUDView::handleMouseDown(S32 x, S32 y, MASK mask) { if (LLTracker::handleMouseDown(x, y)) { - return TRUE; + return true; } return LLView::handleMouseDown(x, y, mask); } diff --git a/indra/newview/llhudview.h b/indra/newview/llhudview.h index dd99996818..1a98d635d0 100644 --- a/indra/newview/llhudview.h +++ b/indra/newview/llhudview.h @@ -42,7 +42,7 @@ public: virtual void draw(); protected: - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); }; extern LLHUDView *gHUDView; diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp deleted file mode 100644 index 3de18ba92f..0000000000 --- a/indra/newview/llimpanel.cpp +++ /dev/null @@ -1,978 +0,0 @@ -/** - * @file llimpanel.cpp - * @brief LLIMPanel class definition - * - * $LicenseInfo:firstyear=2001&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 "llviewerprecompiledheaders.h" - -#include "llimpanel.h" - -#include "indra_constants.h" -#include "llfloaterreg.h" -#include "llfocusmgr.h" -#include "llfontgl.h" -#include "llrect.h" -#include "llerror.h" -#include "llmultifloater.h" -#include "llstring.h" -#include "message.h" -#include "lltextbox.h" - -#include "llagent.h" -#include "llbutton.h" -#include "llcallingcard.h" -#include "llchannelmanager.h" -#include "llchat.h" -#include "llchiclet.h" -#include "llconsole.h" -#include "llgroupactions.h" -#include "llfloater.h" -#include "llfloateractivespeakers.h" -#include "llavataractions.h" -#include "llinventory.h" -#include "llinventorymodel.h" -#include "llfloaterinventory.h" -#include "lliconctrl.h" -#include "llkeyboard.h" -#include "lllineeditor.h" -#include "llpanelimcontrolpanel.h" -#include "llrecentpeople.h" -#include "llresmgr.h" -#include "lltooldraganddrop.h" -#include "lltrans.h" -#include "lltabcontainer.h" -#include "llviewertexteditor.h" -#include "llviewermessage.h" -#include "llviewerstats.h" -#include "llviewercontrol.h" -#include "lluictrlfactory.h" -#include "llviewerwindow.h" -#include "llvoicechannel.h" -#include "lllogchat.h" -#include "llweb.h" -#include "llhttpclient.h" -#include "llmutelist.h" -#include "llstylemap.h" -#include "llappviewer.h" - -// -// Constants -// -const S32 LINE_HEIGHT = 16; -const S32 MIN_WIDTH = 200; -const S32 MIN_HEIGHT = 130; - -// -// Statics -// -// -static std::string sTitleString = "Instant Message with [NAME]"; -static std::string sTypingStartString = "[NAME]: ..."; -static std::string sSessionStartString = "Starting session with [NAME] please wait."; - - -// -// LLFloaterIMPanel -// - -LLFloaterIMPanel::LLFloaterIMPanel(const std::string& session_label, - const LLUUID& session_id, - const LLUUID& other_participant_id, - const std::vector<LLUUID>& ids, - EInstantMessage dialog) -: LLFloater(session_id), - mInputEditor(NULL), - mHistoryEditor(NULL), - mSessionUUID(session_id), - mSessionLabel(session_label), - mSessionInitialized(FALSE), - mSessionStartMsgPos(0), - mOtherParticipantUUID(other_participant_id), - mDialog(dialog), - mSessionInitialTargetIDs(ids), - mTyping(FALSE), - mOtherTyping(FALSE), - mTypingLineStartIndex(0), - mSentTypingState(TRUE), - mNumUnreadMessages(0), - mShowSpeakersOnConnect(TRUE), - mTextIMPossible(TRUE), - mProfileButtonEnabled(TRUE), - mCallBackEnabled(TRUE), - mSpeakerPanel(NULL), - mFirstKeystrokeTimer(), - mLastKeystrokeTimer() -{ - std::string xml_filename; - switch(mDialog) - { - case IM_SESSION_GROUP_START: - mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, this); - xml_filename = "floater_instant_message_group.xml"; - break; - case IM_SESSION_INVITE: - mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, this); - if (gAgent.isInGroup(mSessionUUID)) - { - xml_filename = "floater_instant_message_group.xml"; - } - else // must be invite to ad hoc IM - { - xml_filename = "floater_instant_message_ad_hoc.xml"; - } - break; - case IM_SESSION_P2P_INVITE: - xml_filename = "floater_instant_message.xml"; - break; - case IM_SESSION_CONFERENCE_START: - mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, this); - xml_filename = "floater_instant_message_ad_hoc.xml"; - break; - // just received text from another user - case IM_NOTHING_SPECIAL: - - xml_filename = "floater_instant_message.xml"; - - mTextIMPossible = LLVoiceClient::getInstance()->isSessionTextIMPossible(mSessionUUID); - mProfileButtonEnabled = LLVoiceClient::getInstance()->isParticipantAvatar(mSessionUUID); - mCallBackEnabled = LLVoiceClient::getInstance()->isSessionCallBackPossible(mSessionUUID); - break; - default: - LL_WARNS() << "Unknown session type" << LL_ENDL; - xml_filename = "floater_instant_message.xml"; - break; - } - - LLUICtrlFactory::getInstance()->buildFloater(this, xml_filename, NULL); - - setTitle(mSessionLabel); - mInputEditor->setMaxTextLength(DB_IM_MSG_STR_LEN); - // enable line history support for instant message bar - mInputEditor->setEnableLineHistory(TRUE); - - //*TODO we probably need the same "awaiting message" thing in LLFloaterIMSession - LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(mSessionUUID); - if (!im_session) - { - llerror("im session with id " + mSessionUUID.asString() + " does not exist!", 0); - return; - } - - mSessionInitialized = im_session->mSessionInitialized; - if (!mSessionInitialized) - { - //locally echo a little "starting session" message - LLUIString session_start = sSessionStartString; - - session_start.setArg("[NAME]", getTitle()); - mSessionStartMsgPos = - mHistoryEditor->getWText().length(); - - addHistoryLine( - session_start, - LLUIColorTable::instance().getColor("SystemChatColor"), - false); - } -} - - -LLFloaterIMPanel::~LLFloaterIMPanel() -{ - //delete focus lost callback - mFocusCallbackConnection.disconnect(); -} - -BOOL LLFloaterIMPanel::postBuild() -{ - setVisibleCallback(boost::bind(&LLFloaterIMPanel::onVisibilityChange, this, _2)); - - mInputEditor = getChild<LLLineEditor>("chat_editor"); - mInputEditor->setFocusReceivedCallback( boost::bind(onInputEditorFocusReceived, _1, this) ); - mFocusCallbackConnection = mInputEditor->setFocusLostCallback( boost::bind(onInputEditorFocusLost, _1, this)); - mInputEditor->setKeystrokeCallback( onInputEditorKeystroke, this ); - mInputEditor->setCommitCallback( onCommitChat, this ); - mInputEditor->setCommitOnFocusLost( FALSE ); - mInputEditor->setRevertOnEsc( FALSE ); - mInputEditor->setReplaceNewlinesWithSpaces( FALSE ); - - childSetAction("profile_callee_btn", onClickProfile, this); - childSetAction("group_info_btn", onClickGroupInfo, this); - - childSetAction("start_call_btn", onClickStartCall, this); - childSetAction("end_call_btn", onClickEndCall, this); - childSetAction("send_btn", onClickSend, this); - childSetAction("toggle_active_speakers_btn", onClickToggleActiveSpeakers, this); - - childSetAction("moderator_kick_speaker", onKickSpeaker, this); - //LLButton* close_btn = getChild<LLButton>("close_btn"); - //close_btn->setClickedCallback(&LLFloaterIMPanel::onClickClose, this); - - mHistoryEditor = getChild<LLViewerTextEditor>("im_history"); - - if ( IM_SESSION_GROUP_START == mDialog ) - { - childSetEnabled("profile_btn", FALSE); - } - - if(!mProfileButtonEnabled) - { - childSetEnabled("profile_callee_btn", FALSE); - } - - sTitleString = getString("title_string"); - sTypingStartString = getString("typing_start_string"); - sSessionStartString = getString("session_start_string"); - - if (mSpeakerPanel) - { - mSpeakerPanel->refreshSpeakers(); - } - - if (mDialog == IM_NOTHING_SPECIAL) - { - childSetAction("mute_btn", onClickMuteVoice, this); - childSetCommitCallback("speaker_volume", onVolumeChange, this); - } - - setDefaultBtn("send_btn"); - return TRUE; -} - -void* LLFloaterIMPanel::createSpeakersPanel(void* data) -{ - LLFloaterIMPanel* floaterp = (LLFloaterIMPanel*)data; - LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(floaterp->mSessionUUID); - floaterp->mSpeakerPanel = new LLPanelActiveSpeakers(speaker_mgr, TRUE); - return floaterp->mSpeakerPanel; -} - -//static -void LLFloaterIMPanel::onClickMuteVoice(void* user_data) -{ - LLFloaterIMPanel* floaterp = (LLFloaterIMPanel*)user_data; - if (floaterp) - { - BOOL is_muted = LLMuteList::getInstance()->isMuted(floaterp->mOtherParticipantUUID, LLMute::flagVoiceChat); - - LLMute mute(floaterp->mOtherParticipantUUID, floaterp->getTitle(), LLMute::AGENT); - if (!is_muted) - { - LLMuteList::getInstance()->add(mute, LLMute::flagVoiceChat); - } - else - { - LLMuteList::getInstance()->remove(mute, LLMute::flagVoiceChat); - } - } -} - -//static -void LLFloaterIMPanel::onVolumeChange(LLUICtrl* source, void* user_data) -{ - LLFloaterIMPanel* floaterp = (LLFloaterIMPanel*)user_data; - if (floaterp) - { - LLVoiceClient::getInstance()->setUserVolume(floaterp->mOtherParticipantUUID, (F32)source->getValue().asReal()); - } -} - - -// virtual -void LLFloaterIMPanel::draw() -{ - LLViewerRegion* region = gAgent.getRegion(); - - BOOL enable_connect = (region && region->getCapability("ChatSessionRequest") != "") - && mSessionInitialized - && LLVoiceClient::getInstance()->voiceEnabled() - && mCallBackEnabled; - - // hide/show start call and end call buttons - LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionUUID); - if (!voice_channel) - return; - - childSetVisible("end_call_btn", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->getState() >= LLVoiceChannel::STATE_CALL_STARTED); - childSetVisible("start_call_btn", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->getState() < LLVoiceChannel::STATE_CALL_STARTED); - childSetEnabled("start_call_btn", enable_connect); - childSetEnabled("send_btn", !childGetValue("chat_editor").asString().empty()); - - LLPointer<LLSpeaker> self_speaker; - LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionUUID); - if (speaker_mgr) - { - self_speaker = speaker_mgr->findSpeaker(gAgent.getID()); - } - if(!mTextIMPossible) - { - mInputEditor->setEnabled(FALSE); - mInputEditor->setLabel(getString("unavailable_text_label")); - } - else if (self_speaker.notNull() && self_speaker->mModeratorMutedText) - { - mInputEditor->setEnabled(FALSE); - mInputEditor->setLabel(getString("muted_text_label")); - } - else - { - mInputEditor->setEnabled(TRUE); - mInputEditor->setLabel(getString("default_text_label")); - } - - // show speakers window when voice first connects - if (mShowSpeakersOnConnect && voice_channel->isActive()) - { - childSetVisible("active_speakers_panel", TRUE); - mShowSpeakersOnConnect = FALSE; - } - childSetValue("toggle_active_speakers_btn", childIsVisible("active_speakers_panel")); - - if (mTyping) - { - // Time out if user hasn't typed for a while. - if (mLastKeystrokeTimer.getElapsedTimeF32() > LLAgent::TYPING_TIMEOUT_SECS) - { - setTyping(FALSE); - } - - // If we are typing, and it's been a little while, send the - // typing indicator - if (!mSentTypingState - && mFirstKeystrokeTimer.getElapsedTimeF32() > 1.f) - { - sendTypingState(TRUE); - mSentTypingState = TRUE; - } - } - - // use embedded panel if available - if (mSpeakerPanel) - { - if (mSpeakerPanel->getVisible()) - { - mSpeakerPanel->refreshSpeakers(); - } - } - else - { - // refresh volume and mute checkbox - childSetVisible("speaker_volume", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->isActive()); - childSetValue("speaker_volume", LLVoiceClient::getInstance()->getUserVolume(mOtherParticipantUUID)); - - childSetValue("mute_btn", LLMuteList::getInstance()->isMuted(mOtherParticipantUUID, LLMute::flagVoiceChat)); - childSetVisible("mute_btn", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->isActive()); - } - LLFloater::draw(); -} - -class LLSessionInviteResponder : public LLHTTPClient::Responder -{ - LOG_CLASS(LLSessionInviteResponder); -public: - LLSessionInviteResponder(const LLUUID& session_id) - { - mSessionID = session_id; - } - -protected: - void httpFailure() - { - LL_WARNS() << "Error inviting all agents to session " << dumpResponse() << LL_ENDL; - //throw something back to the viewer here? - } - -private: - LLUUID mSessionID; -}; - -BOOL LLFloaterIMPanel::inviteToSession(const std::vector<LLUUID>& ids) -{ - LLViewerRegion* region = gAgent.getRegion(); - if (!region) - { - return FALSE; - } - - S32 count = ids.size(); - - if( isInviteAllowed() && (count > 0) ) - { - LL_INFOS() << "LLFloaterIMPanel::inviteToSession() - inviting participants" << LL_ENDL; - - std::string url = region->getCapability("ChatSessionRequest"); - - LLSD data; - - data["params"] = LLSD::emptyArray(); - for (int i = 0; i < count; i++) - { - data["params"].append(ids[i]); - } - - data["method"] = "invite"; - data["session-id"] = mSessionUUID; - LLHTTPClient::post( - url, - data, - new LLSessionInviteResponder( - mSessionUUID)); - } - else - { - LL_INFOS() << "LLFloaterIMPanel::inviteToSession -" - << " no need to invite agents for " - << mDialog << LL_ENDL; - // successful add, because everyone that needed to get added - // was added. - } - - return TRUE; -} - -void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, const LLColor4& color, bool log_to_file, const LLUUID& source, const std::string& name) -{ - // start tab flashing when receiving im for background session from user - if (source != LLUUID::null) - { - LLMultiFloater* hostp = getHost(); - if( !isInVisibleChain() - && hostp - && source != gAgent.getID()) - { - hostp->setFloaterFlashing(this, TRUE); - } - } - - // Now we're adding the actual line of text, so erase the - // "Foo is typing..." text segment, and the optional timestamp - // if it was present. JC - removeTypingIndicator(NULL); - - // Actually add the line - std::string timestring; - bool prepend_newline = true; - if (gSavedSettings.getBOOL("IMShowTimestamps")) - { - timestring = mHistoryEditor->appendTime(prepend_newline); - prepend_newline = false; - } - - std::string separator_string(": "); - - // 'name' is a sender name that we want to hotlink so that clicking on it opens a profile. - if (!name.empty()) // If name exists, then add it to the front of the message. - { - // Don't hotlink any messages from the system (e.g. "Second Life:"), so just add those in plain text. - if (name == SYSTEM_FROM) - { - mHistoryEditor->appendText(name + separator_string, prepend_newline, LLStyle::Params().color(color)); - } - else - { - // Convert the name to a hotlink and add to message. - mHistoryEditor->appendText(name + separator_string, prepend_newline, LLStyleMap::instance().lookupAgent(source)); - } - prepend_newline = false; - } - mHistoryEditor->appendText(utf8msg, prepend_newline, LLStyle::Params().color(color)); - mHistoryEditor->blockUndo(); - - if (!isInVisibleChain()) - { - mNumUnreadMessages++; - } -} - - -void LLFloaterIMPanel::setInputFocus( BOOL b ) -{ - mInputEditor->setFocus( b ); -} - - -void LLFloaterIMPanel::selectAll() -{ - mInputEditor->selectAll(); -} - - -void LLFloaterIMPanel::selectNone() -{ - mInputEditor->deselect(); -} - -BOOL LLFloaterIMPanel::handleKeyHere( KEY key, MASK mask ) -{ - BOOL handled = FALSE; - if( KEY_RETURN == key && mask == MASK_NONE) - { - sendMsg(); - handled = TRUE; - } - else if ( KEY_ESCAPE == key ) - { - handled = TRUE; - gFocusMgr.setKeyboardFocus(NULL); - } - - // May need to call base class LLPanel::handleKeyHere if not handled - // in order to tab between buttons. JNC 1.2.2002 - return handled; -} - -BOOL LLFloaterIMPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, - EDragAndDropType cargo_type, - void* cargo_data, - EAcceptance* accept, - std::string& tooltip_msg) -{ - - if (mDialog == IM_NOTHING_SPECIAL) - { - LLToolDragAndDrop::handleGiveDragAndDrop(mOtherParticipantUUID, mSessionUUID, drop, - cargo_type, cargo_data, accept); - } - - // handle case for dropping calling cards (and folders of calling cards) onto invitation panel for invites - else if (isInviteAllowed()) - { - *accept = ACCEPT_NO; - - if (cargo_type == DAD_CALLINGCARD) - { - if (dropCallingCard((LLInventoryItem*)cargo_data, drop)) - { - *accept = ACCEPT_YES_MULTI; - } - } - else if (cargo_type == DAD_CATEGORY) - { - if (dropCategory((LLInventoryCategory*)cargo_data, drop)) - { - *accept = ACCEPT_YES_MULTI; - } - } - } - return TRUE; -} - -BOOL LLFloaterIMPanel::dropCallingCard(LLInventoryItem* item, BOOL drop) -{ - BOOL rv = isInviteAllowed(); - if(rv && item && item->getCreatorUUID().notNull()) - { - if(drop) - { - std::vector<LLUUID> ids; - ids.push_back(item->getCreatorUUID()); - inviteToSession(ids); - } - } - else - { - // set to false if creator uuid is null. - rv = FALSE; - } - return rv; -} - -BOOL LLFloaterIMPanel::dropCategory(LLInventoryCategory* category, BOOL drop) -{ - BOOL rv = isInviteAllowed(); - if(rv && category) - { - LLInventoryModel::cat_array_t cats; - LLInventoryModel::item_array_t items; - LLUniqueBuddyCollector buddies; - gInventory.collectDescendentsIf(category->getUUID(), - cats, - items, - LLInventoryModel::EXCLUDE_TRASH, - buddies); - S32 count = items.count(); - if(count == 0) - { - rv = FALSE; - } - else if(drop) - { - std::vector<LLUUID> ids; - ids.reserve(count); - for(S32 i = 0; i < count; ++i) - { - ids.push_back(items.get(i)->getCreatorUUID()); - } - inviteToSession(ids); - } - } - return rv; -} - -BOOL LLFloaterIMPanel::isInviteAllowed() const -{ - - return ( (IM_SESSION_CONFERENCE_START == mDialog) - || (IM_SESSION_INVITE == mDialog) ); -} - - -// static -void LLFloaterIMPanel::onTabClick(void* userdata) -{ - LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata; - self->setInputFocus(TRUE); -} - - -// static -void LLFloaterIMPanel::onClickProfile( void* userdata ) -{ - // Bring up the Profile window - LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata; - - if (self->getOtherParticipantID().notNull()) - { - LLAvatarActions::showProfile(self->getOtherParticipantID()); - } -} - -// static -void LLFloaterIMPanel::onClickGroupInfo( void* userdata ) -{ - // Bring up the Profile window - LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata; - - LLGroupActions::show(self->mSessionUUID); - -} - -// static -void LLFloaterIMPanel::onClickClose( void* userdata ) -{ - LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata; - if(self) - { - self->closeFloater(); - } -} - -// static -void LLFloaterIMPanel::onClickStartCall(void* userdata) -{ - LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata; - - gIMMgr->startCall(self->mSessionUUID); -} - -// static -void LLFloaterIMPanel::onClickEndCall(void* userdata) -{ - LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata; - - gIMMgr->endCall(self->mSessionUUID); -} - -// static -void LLFloaterIMPanel::onClickSend(void* userdata) -{ - LLFloaterIMPanel* self = (LLFloaterIMPanel*)userdata; - self->sendMsg(); -} - -// static -void LLFloaterIMPanel::onClickToggleActiveSpeakers(void* userdata) -{ - LLFloaterIMPanel* self = (LLFloaterIMPanel*)userdata; - - self->childSetVisible("active_speakers_panel", !self->childIsVisible("active_speakers_panel")); -} - -// static -void LLFloaterIMPanel::onCommitChat(LLUICtrl* caller, void* userdata) -{ - LLFloaterIMPanel* self= (LLFloaterIMPanel*) userdata; - self->sendMsg(); -} - -// static -void LLFloaterIMPanel::onInputEditorFocusReceived( LLFocusableElement* caller, void* userdata ) -{ - LLFloaterIMPanel* self= (LLFloaterIMPanel*) userdata; - self->mHistoryEditor->setCursorAndScrollToEnd(); -} - -// static -void LLFloaterIMPanel::onInputEditorFocusLost(LLFocusableElement* caller, void* userdata) -{ - LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata; - self->setTyping(FALSE); -} - -// static -void LLFloaterIMPanel::onInputEditorKeystroke(LLLineEditor* caller, void* userdata) -{ - LLFloaterIMPanel* self = (LLFloaterIMPanel*)userdata; - std::string text = self->mInputEditor->getText(); - if (!text.empty()) - { - self->setTyping(TRUE); - } - else - { - // Deleting all text counts as stopping typing. - self->setTyping(FALSE); - } -} - -// virtual -void LLFloaterIMPanel::onClose(bool app_quitting) -{ - setTyping(FALSE); - - gIMMgr->leaveSession(mSessionUUID); - - // *HACK hide the voice floater - LLFloaterReg::hideInstance("voice_call", mSessionUUID); -} - -void LLFloaterIMPanel::onVisibilityChange(const LLSD& new_visibility) -{ - if (new_visibility.asBoolean()) - { - mNumUnreadMessages = 0; - } - - LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionUUID); - if (voice_channel && voice_channel->getState() == LLVoiceChannel::STATE_CONNECTED) - { - if (new_visibility.asBoolean()) - LLFloaterReg::showInstance("voice_call", mSessionUUID); - else - LLFloaterReg::hideInstance("voice_call", mSessionUUID); - } -} - -void LLFloaterIMPanel::sendMsg() -{ - if (!gAgent.isGodlike() - && (mDialog == IM_NOTHING_SPECIAL) - && mOtherParticipantUUID.isNull()) - { - LL_INFOS() << "Cannot send IM to everyone unless you're a god." << LL_ENDL; - return; - } - - if (mInputEditor) - { - LLWString text = mInputEditor->getConvertedText(); - if(!text.empty()) - { - // store sent line in history, duplicates will get filtered - if (mInputEditor) mInputEditor->updateHistory(); - // Truncate and convert to UTF8 for transport - std::string utf8_text = wstring_to_utf8str(text); - utf8_text = utf8str_truncate(utf8_text, MAX_MSG_BUF_SIZE - 1); - - if ( mSessionInitialized ) - { - LLIMModel::sendMessage(utf8_text, - mSessionUUID, - mOtherParticipantUUID, - mDialog); - - } - else - { - //queue up the message to send once the session is - //initialized - mQueuedMsgsForInit.append(utf8_text); - } - } - - LLViewerStats::getInstance()->incStat(LLViewerStats::ST_IM_COUNT); - - mInputEditor->setText(LLStringUtil::null); - } - - // Don't need to actually send the typing stop message, the other - // client will infer it from receiving the message. - mTyping = FALSE; - mSentTypingState = TRUE; -} - -void LLFloaterIMPanel::processSessionUpdate(const LLSD& session_update) -{ - if ( - session_update.has("moderated_mode") && - session_update["moderated_mode"].has("voice") ) - { - BOOL voice_moderated = session_update["moderated_mode"]["voice"]; - - if (voice_moderated) - { - setTitle(mSessionLabel + std::string(" ") + getString("moderated_chat_label")); - } - else - { - setTitle(mSessionLabel); - } - - - //update the speakers dropdown too, if it's available - if (mSpeakerPanel) - { - mSpeakerPanel->setVoiceModerationCtrlMode(voice_moderated); - } - } -} - -void LLFloaterIMPanel::sessionInitReplyReceived(const LLUUID& session_id) -{ - mSessionUUID = session_id; - mSessionInitialized = TRUE; - - //we assume the history editor hasn't moved at all since - //we added the starting session message - //so, we count how many characters to remove - S32 chars_to_remove = mHistoryEditor->getWText().length() - - mSessionStartMsgPos; - mHistoryEditor->removeTextFromEnd(chars_to_remove); - - //and now, send the queued msg - LLSD::array_iterator iter; - for ( iter = mQueuedMsgsForInit.beginArray(); - iter != mQueuedMsgsForInit.endArray(); - ++iter) - { - LLIMModel::sendMessage( - iter->asString(), - mSessionUUID, - mOtherParticipantUUID, - mDialog); - } -} - -void LLFloaterIMPanel::setTyping(BOOL typing) -{ - LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionUUID); - if (typing) - { - // Every time you type something, reset this timer - mLastKeystrokeTimer.reset(); - - if (!mTyping) - { - // You just started typing. - mFirstKeystrokeTimer.reset(); - - // Will send typing state after a short delay. - mSentTypingState = FALSE; - } - - if (speaker_mgr) - speaker_mgr->setSpeakerTyping(gAgent.getID(), TRUE); - } - else - { - if (mTyping) - { - // you just stopped typing, send state immediately - sendTypingState(FALSE); - mSentTypingState = TRUE; - } - if (speaker_mgr) - speaker_mgr->setSpeakerTyping(gAgent.getID(), FALSE); - } - - mTyping = typing; -} - -void LLFloaterIMPanel::sendTypingState(BOOL typing) -{ - // Don't want to send typing indicators to multiple people, potentially too - // much network traffic. Only send in person-to-person IMs. - if (mDialog != IM_NOTHING_SPECIAL) return; - - LLIMModel::instance().sendTypingState(mSessionUUID, mOtherParticipantUUID, typing); -} - - -void LLFloaterIMPanel::processIMTyping(const LLIMInfo* im_info, BOOL typing) -{ - if (typing) - { - // other user started typing - addTypingIndicator(im_info->mName); - } - else - { - // other user stopped typing - removeTypingIndicator(im_info); - } -} - - -void LLFloaterIMPanel::addTypingIndicator(const std::string &name) -{ - // we may have lost a "stop-typing" packet, don't add it twice - if (!mOtherTyping) - { - mTypingLineStartIndex = mHistoryEditor->getWText().length(); - LLUIString typing_start = sTypingStartString; - typing_start.setArg("[NAME]", name); - addHistoryLine(typing_start, LLUIColorTable::instance().getColor("SystemChatColor"), false); - mOtherTypingName = name; - mOtherTyping = TRUE; - } - // MBW -- XXX -- merge from release broke this (argument to this function changed from an LLIMInfo to a name) - // Richard will fix. -// mSpeakers->setSpeakerTyping(im_info->mFromID, TRUE); -} - - -void LLFloaterIMPanel::removeTypingIndicator(const LLIMInfo* im_info) -{ - if (mOtherTyping) - { - // Must do this first, otherwise addHistoryLine calls us again. - mOtherTyping = FALSE; - - S32 chars_to_remove = mHistoryEditor->getWText().length() - mTypingLineStartIndex; - mHistoryEditor->removeTextFromEnd(chars_to_remove); - if (im_info) - { - LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionUUID); - if (speaker_mgr) - { - speaker_mgr->setSpeakerTyping(im_info->mFromID, FALSE); - } - } - } -} - -//static -void LLFloaterIMPanel::onKickSpeaker(void* user_data) -{ - -} diff --git a/indra/newview/llimpanel.h b/indra/newview/llimpanel.h deleted file mode 100644 index 01cd0c5861..0000000000 --- a/indra/newview/llimpanel.h +++ /dev/null @@ -1,212 +0,0 @@ -/** - * @file llimpanel.h - * @brief LLIMPanel class definition - * - * $LicenseInfo:firstyear=2001&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_IMPANEL_H -#define LL_IMPANEL_H - -#include "lldockablefloater.h" -#include "lllogchat.h" -#include "lluuid.h" -#include "lldarray.h" -#include "llinstantmessage.h" -#include "llvoiceclient.h" -#include "llstyle.h" - -class LLLineEditor; -class LLViewerTextEditor; -class LLInventoryItem; -class LLInventoryCategory; -class LLIMSpeakerMgr; -class LLPanelActiveSpeakers; -class LLPanelChatControlPanel; - -class LLFloaterIMPanel : public LLFloater -{ -public: - - // The session id is the id of the session this is for. The target - // refers to the user (or group) that where this session serves as - // the default. For example, if you open a session though a - // calling card, a new session id will be generated, but the - // target_id will be the agent referenced by the calling card. - LLFloaterIMPanel(const std::string& session_label, - const LLUUID& session_id, - const LLUUID& target_id, - const std::vector<LLUUID>& ids, - EInstantMessage dialog); - virtual ~LLFloaterIMPanel(); - - /*virtual*/ BOOL postBuild(); - - // Check typing timeout timer. - /*virtual*/ void draw(); - - /*virtual*/ void onClose(bool app_quitting); - void onVisibilityChange(const LLSD& new_visibility); - - // add target ids to the session. - // Return TRUE if successful, otherwise FALSE. - BOOL inviteToSession(const std::vector<LLUUID>& agent_ids); - - void addHistoryLine(const std::string &utf8msg, - const LLColor4& color = LLColor4::white, - bool log_to_file = true, - const LLUUID& source = LLUUID::null, - const std::string& name = LLStringUtil::null); - - void setInputFocus( BOOL b ); - - void selectAll(); - void selectNone(); - - S32 getNumUnreadMessages() { return mNumUnreadMessages; } - - BOOL handleKeyHere(KEY key, MASK mask); - BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, - BOOL drop, EDragAndDropType cargo_type, - void *cargo_data, EAcceptance *accept, - std::string& tooltip_msg); - - static void onInputEditorFocusReceived( LLFocusableElement* caller, void* userdata ); - static void onInputEditorFocusLost(LLFocusableElement* caller, void* userdata); - static void onInputEditorKeystroke(LLLineEditor* caller, void* userdata); - static void onCommitChat(LLUICtrl* caller, void* userdata); - static void onTabClick( void* userdata ); - - static void onClickProfile( void* userdata ); - static void onClickGroupInfo( void* userdata ); - static void onClickClose( void* userdata ); - static void onClickStartCall( void* userdata ); - static void onClickEndCall( void* userdata ); - static void onClickSend( void* userdata ); - static void onClickToggleActiveSpeakers( void* userdata ); - static void* createSpeakersPanel(void* data); - static void onKickSpeaker(void* user_data); - - //callbacks for P2P muting and volume control - static void onClickMuteVoice(void* user_data); - static void onVolumeChange(LLUICtrl* source, void* user_data); - - const LLUUID& getSessionID() const { return mSessionUUID; } - const LLUUID& getOtherParticipantID() const { return mOtherParticipantUUID; } - void processSessionUpdate(const LLSD& update); - EInstantMessage getDialogType() const { return mDialog; } - void setDialogType(EInstantMessage dialog) { mDialog = dialog; } - - void sessionInitReplyReceived(const LLUUID& im_session_id); - - // Handle other participant in the session typing. - void processIMTyping(const LLIMInfo* im_info, BOOL typing); - -private: - // Called by UI methods. - void sendMsg(); - - // for adding agents via the UI. Return TRUE if possible, do it if - BOOL dropCallingCard(LLInventoryItem* item, BOOL drop); - BOOL dropCategory(LLInventoryCategory* category, BOOL drop); - - // test if local agent can add agents. - BOOL isInviteAllowed() const; - - // Called whenever the user starts or stops typing. - // Sends the typing state to the other user if necessary. - void setTyping(BOOL typing); - - // Add the "User is typing..." indicator. - void addTypingIndicator(const std::string &name); - - // Remove the "User is typing..." indicator. - void removeTypingIndicator(const LLIMInfo* im_info); - - void sendTypingState(BOOL typing); - -private: - LLLineEditor* mInputEditor; - LLViewerTextEditor* mHistoryEditor; - - // The value of the mSessionUUID depends on how the IM session was started: - // one-on-one ==> random id - // group ==> group_id - // inventory folder ==> folder item_id - // 911 ==> Gaurdian_Angel_Group_ID ^ gAgent.getID() - LLUUID mSessionUUID; - - std::string mSessionLabel; - - BOOL mSessionInitialized; - LLSD mQueuedMsgsForInit; - - // The value mOtherParticipantUUID depends on how the IM session was started: - // one-on-one = recipient's id - // group ==> group_id - // inventory folder ==> first target id in list - // 911 ==> sender - LLUUID mOtherParticipantUUID; - std::vector<LLUUID> mSessionInitialTargetIDs; - - EInstantMessage mDialog; - - // Are you currently typing? - BOOL mTyping; - - // Is other user currently typing? - BOOL mOtherTyping; - - // name of other user who is currently typing - std::string mOtherTypingName; - - // Where does the "User is typing..." line start? - S32 mTypingLineStartIndex; - // Where does the "Starting session..." line start? - S32 mSessionStartMsgPos; - - S32 mNumUnreadMessages; - - BOOL mSentTypingState; - - BOOL mShowSpeakersOnConnect; - - BOOL mTextIMPossible; - BOOL mProfileButtonEnabled; - BOOL mCallBackEnabled; - - LLPanelActiveSpeakers* mSpeakerPanel; - - // Optimization: Don't send "User is typing..." until the - // user has actually been typing for a little while. Prevents - // extra IMs for brief "lol" type utterences. - LLFrameTimer mFirstKeystrokeTimer; - - // Timer to detect when user has stopped typing. - LLFrameTimer mLastKeystrokeTimer; - - boost::signals2::connection mFocusCallbackConnection; - - void disableWhileSessionStarting(); -}; - -#endif // LL_IMPANEL_H diff --git a/indra/newview/llimprocessing.cpp b/indra/newview/llimprocessing.cpp index ff803ae312..e2e83ef42b 100644 --- a/indra/newview/llimprocessing.cpp +++ b/indra/newview/llimprocessing.cpp @@ -118,7 +118,7 @@ static std::string clean_name_from_im(const std::string& name, EInstantMessage t } static std::string clean_name_from_task_im(const std::string& msg, - BOOL from_group) + bool from_group) { boost::smatch match; static const boost::regex returned_exp( @@ -203,7 +203,7 @@ void inventory_offer_handler(LLOfferInfo* info) // Strip any SLURL from the message display. (DEV-2754) std::string msg = info->mDesc; - int indx = msg.find(" ( http://slurl.com/secondlife/"); + auto indx = msg.find(" ( http://slurl.com/secondlife/"); if (indx == std::string::npos) { // try to find new slurl host @@ -249,7 +249,7 @@ void inventory_offer_handler(LLOfferInfo* info) // faked for toast one. payload["object_id"] = object_id; // Flag indicating that this notification is faked for toast. - payload["give_inventory_notification"] = FALSE; + payload["give_inventory_notification"] = false; args["OBJECTFROMNAME"] = info->mFromName; args["NAME"] = info->mFromName; if (info->mFromGroup) @@ -278,7 +278,7 @@ void inventory_offer_handler(LLOfferInfo* info) p.name = info->mFromID == gAgentID ? "OwnObjectGiveItem" : "ObjectGiveItem"; // Pop up inv offer chiclet and let the user accept (keep), or reject (and silently delete) the inventory. - LLPostponedNotification::add<LLPostponedOfferNotification>(p, info->mFromID, info->mFromGroup == TRUE); + LLPostponedNotification::add<LLPostponedOfferNotification>(p, info->mFromID, info->mFromGroup); } else // Agent -> Agent Inventory Offer { @@ -315,7 +315,7 @@ void inventory_offer_handler(LLOfferInfo* info) if (!bAutoAccept) // if we auto accept, do not pester the user { // Inform user that there is a script floater via toast system - payload["give_inventory_notification"] = TRUE; + payload["give_inventory_notification"] = true; p.payload = payload; LLPostponedNotification::add<LLPostponedOfferNotification>(p, info->mFromID, false); } @@ -412,7 +412,7 @@ static void notification_display_name_callback(const LLUUID& id, } void LLIMProcessing::processNewMessage(LLUUID from_id, - BOOL from_group, + bool from_group, LLUUID to_id, U8 offline, EInstantMessage dialog, // U8 @@ -445,14 +445,14 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, // IDEVO convert new-style "Resident" names for display name = clean_name_from_im(name, dialog); - BOOL is_do_not_disturb = gAgent.isDoNotDisturb(); - BOOL is_muted = LLMuteList::getInstance()->isMuted(from_id, name, LLMute::flagTextChat) + 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)); - BOOL is_owned_by_me = FALSE; - BOOL is_friend = (LLAvatarTracker::instance().getBuddyInfo(from_id) == NULL) ? false : true; - BOOL accept_im_from_only_friend = gSavedPerAccountSettings.getBOOL("VoiceCallsFriendsOnly"); - BOOL is_linden = chat.mSourceType != CHAT_SOURCE_OBJECT && + bool is_owned_by_me = false; + bool is_friend = LLAvatarTracker::instance().getBuddyInfo(from_id) != NULL; + bool accept_im_from_only_friend = gSavedPerAccountSettings.getBOOL("VoiceCallsFriendsOnly"); + bool is_linden = chat.mSourceType != CHAT_SOURCE_OBJECT && LLMuteList::isLinden(name); chat.mMuted = is_muted; @@ -640,8 +640,8 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, { // aux_id contains group id, binary bucket contains name and asset type group_id = aux_id; - has_inventory = binary_bucket_size > 1 ? TRUE : FALSE; - from_group = TRUE; // inaccurate value correction + has_inventory = binary_bucket_size > 1; + from_group = true; // inaccurate value correction if (has_inventory) { std::string str_bucket = ll_safe_string((char*)binary_bucket, binary_bucket_size); @@ -701,7 +701,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, } else { - S32 index = original_name.find(" Resident"); + auto index = original_name.find(" Resident"); if (index != std::string::npos) { original_name = original_name.substr(0, index); @@ -865,7 +865,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, bucketp = (struct offer_agent_bucket_t*) &binary_bucket[0]; info->mType = (LLAssetType::EType) bucketp->asset_type; info->mObjectID = bucketp->object_id; - info->mFromObject = FALSE; + info->mFromObject = false; } else // IM_TASK_INVENTORY_OFFERED { @@ -894,7 +894,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, LL_WARNS("Messaging") << "Malformed inventory offer from object, type might be " << info->mType << LL_ENDL; } info->mObjectID = LLUUID::null; - info->mFromObject = TRUE; + info->mFromObject = true; } info->mIM = dialog; @@ -1252,7 +1252,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, LLSD payload; payload["from_id"] = from_id; payload["lure_id"] = session_id; - payload["godlike"] = FALSE; + payload["godlike"] = false; payload["region_maturity"] = region_access; if (!canUserAccessDstRegion) @@ -1357,7 +1357,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, LLSD payload; payload["from_id"] = from_id; payload["lure_id"] = session_id; - payload["godlike"] = TRUE; + payload["godlike"] = true; payload["region_maturity"] = region_access; if (!canUserAccessDstRegion) @@ -1494,7 +1494,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, void LLIMProcessing::requestOfflineMessages() { - static BOOL requested = FALSE; + static bool requested = false; if (!requested && gMessageSystem && !gDisconnected @@ -1521,7 +1521,7 @@ void LLIMProcessing::requestOfflineMessages() LLCoros::instance().launch("LLIMProcessing::requestOfflineMessagesCoro", boost::bind(&LLIMProcessing::requestOfflineMessagesCoro, cap_url)); } - requested = TRUE; + requested = true; } } @@ -1621,7 +1621,7 @@ void LLIMProcessing::requestOfflineMessagesCoro(std::string url) } // Todo: once drtsim-451 releases, remove the string option - BOOL from_group; + bool from_group; if (message_data["from_group"].isInteger()) { from_group = message_data["from_group"].asInteger(); @@ -1637,23 +1637,29 @@ void LLIMProcessing::requestOfflineMessagesCoro(std::string url) { session_id = message_data["asset_id"].asUUID(); } - LLIMProcessing::processNewMessage( - message_data["from_agent_id"].asUUID(), - from_group, - message_data["to_agent_id"].asUUID(), - message_data.has("offline") ? static_cast<U8>(message_data["offline"].asInteger()) : IM_OFFLINE, - dialog, - session_id, - static_cast<U32>(message_data["timestamp"].asInteger()), - message_data["from_agent_name"].asString(), - message_data["message"].asString(), - static_cast<U32>((message_data.has("parent_estate_id")) ? message_data["parent_estate_id"].asInteger() : 1), // 1 - IMMainland - message_data["region_id"].asUUID(), - position, - bin_bucket.data(), - bin_bucket.size(), - sender, - message_data["asset_id"].asUUID()); + + LLAppViewer::instance()->postToMainCoro([=]() + { + std::vector<U8> local_bin_bucket = bin_bucket; + LLHost local_sender = sender; + LLIMProcessing::processNewMessage( + message_data["from_agent_id"].asUUID(), + from_group, + message_data["to_agent_id"].asUUID(), + message_data.has("offline") ? static_cast<U8>(message_data["offline"].asInteger()) : IM_OFFLINE, + dialog, + session_id, + static_cast<U32>(message_data["timestamp"].asInteger()), + message_data["from_agent_name"].asString(), + message_data["message"].asString(), + static_cast<U32>((message_data.has("parent_estate_id")) ? message_data["parent_estate_id"].asInteger() : 1), // 1 - IMMainland + message_data["region_id"].asUUID(), + position, + local_bin_bucket.data(), + S32(local_bin_bucket.size()), + local_sender, + message_data["asset_id"].asUUID()); + }); } } diff --git a/indra/newview/llimprocessing.h b/indra/newview/llimprocessing.h index 4d20b963a4..030d28b198 100644 --- a/indra/newview/llimprocessing.h +++ b/indra/newview/llimprocessing.h @@ -34,7 +34,7 @@ class LLIMProcessing public: // Pre-process message for IM manager static void processNewMessage(LLUUID from_id, - BOOL from_group, + bool from_group, LLUUID to_id, U8 offline, EInstantMessage dialog, // U8 diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index a29b883f6b..d402f8b74f 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -117,16 +117,16 @@ const LLUUID LLOutgoingCallDialog::OCD_KEY = LLUUID("7CF78E11-0CFE-498D-ADB9-141 LLIMMgr* gIMMgr = NULL; -BOOL LLSessionTimeoutTimer::tick() +bool LLSessionTimeoutTimer::tick() { - if (mSessionId.isNull()) return TRUE; + if (mSessionId.isNull()) return true; LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(mSessionId); if (session && !session->mSessionInitialized) { gIMMgr->showSessionStartError("session_initialization_timed_out_error", mSessionId); } - return TRUE; + return true; } @@ -224,26 +224,26 @@ void notify_of_message(const LLSD& msg, bool is_dnd_msg) if (msg["source_type"].asInteger() == CHAT_SOURCE_OBJECT) { user_preferences = gSavedSettings.getString("NotificationObjectIMOptions"); - if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundObjectIM") == TRUE)) + if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundObjectIM"))) { make_ui_sound("UISndNewIncomingIMSession"); } } else { - user_preferences = gSavedSettings.getString("NotificationNearbyChatOptions"); - if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNearbyChatIM") == TRUE)) + user_preferences = gSavedSettings.getString("NotificationNearbyChatOptions"); + if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNearbyChatIM"))) { make_ui_sound("UISndNewIncomingIMSession"); - } + } } } - else if(session->isP2PSessionType()) + else if (session->isP2PSessionType()) { if (LLAvatarTracker::instance().isBuddy(participant_id)) { user_preferences = gSavedSettings.getString("NotificationFriendIMOptions"); - if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundFriendIM") == TRUE)) + if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundFriendIM"))) { make_ui_sound("UISndNewIncomingIMSession"); } @@ -251,24 +251,24 @@ void notify_of_message(const LLSD& msg, bool is_dnd_msg) else { user_preferences = gSavedSettings.getString("NotificationNonFriendIMOptions"); - if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNonFriendIM") == TRUE)) + if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNonFriendIM"))) { make_ui_sound("UISndNewIncomingIMSession"); + } } } - } - else if(session->isAdHocSessionType()) + else if (session->isAdHocSessionType()) { user_preferences = gSavedSettings.getString("NotificationConferenceIMOptions"); - if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundConferenceIM") == TRUE)) + if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundConferenceIM"))) { make_ui_sound("UISndNewIncomingIMSession"); - } + } } else if(session->isGroupSessionType()) { user_preferences = gSavedSettings.getString("NotificationGroupChatOptions"); - if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundGroupChatIM") == TRUE)) + if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundGroupChatIM"))) { make_ui_sound("UISndNewIncomingIMSession"); } @@ -318,8 +318,7 @@ void notify_of_message(const LLSD& msg, bool is_dnd_msg) else { store_dnd_message = true; - } - + } } // 2. Flash line item @@ -773,7 +772,7 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, } else { - //tick returns TRUE - timer will be deleted after the tick + //tick returns true - timer will be deleted after the tick new LLSessionTimeoutTimer(mSessionID, SESSION_INITIALIZATION_TIMEOUT); } @@ -868,7 +867,7 @@ void LLIMModel::LLIMSession::onAdHocNameCache(const LLAvatarName& av_name) if (!av_name.isValidName()) { - S32 separator_index = mName.rfind(" "); + auto separator_index = mName.rfind(" "); std::string name = mName.substr(0, separator_index); ++separator_index; std::string conference_word = mName.substr(separator_index, mName.length()); @@ -1044,7 +1043,7 @@ void LLIMModel::LLIMSession::addMessage(const std::string& from, if (mSpeakers && from_id.notNull()) { mSpeakers->speakerChatted(from_id); - mSpeakers->setSpeakerTyping(from_id, FALSE); + mSpeakers->setSpeakerTyping(from_id, false); } } @@ -1302,7 +1301,7 @@ void LLIMModel::LLIMSession::addMessagesFromServerHistory(const LLSD& history, } } - S32 shifted_size = shift_msgs.size(); + auto shifted_size = shift_msgs.size(); while (shift_msgs.size() > 0) { // Finally add back any new messages, and tweak the index value to be correct. LLSD newer_message = shift_msgs.front(); @@ -1364,7 +1363,7 @@ LLIMModel::LLIMSession* LLIMModel::findIMSession(const LLUUID& session_id) const //*TODO consider switching to using std::set instead of std::list for holding LLUUIDs across the whole code LLIMModel::LLIMSession* LLIMModel::findAdHocIMSession(const uuid_vec_t& ids) { - S32 num = ids.size(); + auto num = ids.size(); if (!num) return NULL; if (mId2SessionMap.empty()) return NULL; @@ -1407,7 +1406,7 @@ bool LLIMModel::LLIMSession::isOutgoingAdHoc() const bool LLIMModel::LLIMSession::isAdHoc() { - return IM_SESSION_CONFERENCE_START == mType || (IM_SESSION_INVITE == mType && !gAgent.isInGroup(mSessionID, TRUE)); + return IM_SESSION_CONFERENCE_START == mType || (IM_SESSION_INVITE == mType && !gAgent.isInGroup(mSessionID, true)); } bool LLIMModel::LLIMSession::isP2P() @@ -1417,7 +1416,7 @@ bool LLIMModel::LLIMSession::isP2P() bool LLIMModel::LLIMSession::isGroupChat() { - return IM_SESSION_GROUP_START == mType || (IM_SESSION_INVITE == mType && gAgent.isInGroup(mSessionID, TRUE)); + return IM_SESSION_GROUP_START == mType || (IM_SESSION_INVITE == mType && gAgent.isInGroup(mSessionID, true)); } LLUUID LLIMModel::LLIMSession::generateOutgoingAdHocHash() const @@ -1618,7 +1617,7 @@ void LLIMModel::getMessagesSilently(const LLUUID& session_id, chat_message_list_ return; } - int i = session->mMsgs.size() - start_index; + int i = static_cast<int>(session->mMsgs.size()) - start_index; for (chat_message_list_t::iterator iter = session->mMsgs.begin(); iter != session->mMsgs.end() && i > 0; @@ -1874,7 +1873,7 @@ const std::string& LLIMModel::getHistoryFileName(const LLUUID& session_id) const // TODO get rid of other participant ID -void LLIMModel::sendTypingState(LLUUID session_id, LLUUID other_participant_id, BOOL typing) +void LLIMModel::sendTypingState(LLUUID session_id, LLUUID other_participant_id, bool typing) { std::string name; LLAgentUI::buildFullname(name); @@ -1882,7 +1881,7 @@ void LLIMModel::sendTypingState(LLUUID session_id, LLUUID other_participant_id, pack_instant_message( gMessageSystem, gAgent.getID(), - FALSE, + false, gAgent.getSessionID(), other_participant_id, name, @@ -1902,7 +1901,7 @@ void LLIMModel::sendLeaveSession(const LLUUID& session_id, const LLUUID& other_p pack_instant_message( gMessageSystem, gAgent.getID(), - FALSE, + false, gAgent.getSessionID(), other_participant_id, name, @@ -1950,7 +1949,7 @@ void LLIMModel::sendMessage(const std::string& utf8_text, pack_instant_message( gMessageSystem, gAgent.getID(), - FALSE, + false, gAgent.getSessionID(), other_participant_id, name.c_str(), @@ -2009,7 +2008,7 @@ void LLIMModel::sendMessage(const std::string& utf8_text, if (speaker_mgr) { speaker_mgr->speakerChatted(gAgentID); - speaker_mgr->setSpeakerTyping(gAgentID, FALSE); + speaker_mgr->setSpeakerTyping(gAgentID, false); } } @@ -2074,7 +2073,7 @@ void session_starter_helper( msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_MessageBlock); - msg->addBOOLFast(_PREHASH_FromGroup, FALSE); + msg->addBOOLFast(_PREHASH_FromGroup, false); msg->addUUIDFast(_PREHASH_ToAgentID, other_participant_id); msg->addU8Fast(_PREHASH_Offline, IM_ONLINE); msg->addU8Fast(_PREHASH_Dialog, im_type); @@ -2099,12 +2098,12 @@ void start_deprecated_conference_chat( { U8* bucket; U8* pos; - S32 count; + size_t count; S32 bucket_size; // *FIX: this could suffer from endian issues count = agents_to_invite.size(); - bucket_size = UUID_BYTES * count; + bucket_size = UUID_BYTES * static_cast<S32>(count); bucket = new U8[bucket_size]; pos = bucket; @@ -2238,7 +2237,7 @@ LLUUID LLIMMgr::computeSessionID( } } - if (gAgent.isInGroup(session_id, TRUE) && (session_id != other_participant_id)) + if (gAgent.isInGroup(session_id, true) && (session_id != other_participant_id)) { LL_WARNS() << "Group session id different from group id: IM type = " << dialog << ", session id = " << session_id << ", group id = " << other_participant_id << LL_ENDL; } @@ -2321,7 +2320,7 @@ LLIMMgr::onConfirmForceCloseError( LLFloater* floater = LLFloaterIMSession::findInstance(session_id); if ( floater ) { - floater->closeFloater(FALSE); + floater->closeFloater(false); } return false; } @@ -2476,7 +2475,7 @@ LLCallDialog::LLCallDialog(const LLSD& payload) mPayload(payload), mLifetime(DEFAULT_LIFETIME) { - setAutoFocus(FALSE); + setAutoFocus(false); // force docked state since this floater doesn't save it between recreations setDocked(true); } @@ -2486,14 +2485,14 @@ LLCallDialog::~LLCallDialog() LLUI::getInstance()->removePopup(this); } -BOOL LLCallDialog::postBuild() +bool LLCallDialog::postBuild() { if (!LLDockableFloater::postBuild() || !gToolBarView) - return FALSE; + return false; dockToToolbarButton("speak"); - return TRUE; + return true; } void LLCallDialog::dockToToolbarButton(const std::string& toolbarButtonName) @@ -2567,7 +2566,7 @@ void LLCallDialog::setIcon(const LLSD& session_id, const LLSD& participant_id) { bool participant_is_avatar = LLVoiceClient::getInstance()->isParticipantAvatar(session_id); - bool is_group = participant_is_avatar && gAgent.isInGroup(session_id, TRUE); + bool is_group = participant_is_avatar && gAgent.isInGroup(session_id, true); LLAvatarIconCtrl* avatar_icon = getChild<LLAvatarIconCtrl>("avatar_icon"); LLGroupIconCtrl* group_icon = getChild<LLGroupIconCtrl>("group_icon"); @@ -2756,13 +2755,13 @@ void LLOutgoingCallDialog::onCancel(void* user_data) } -BOOL LLOutgoingCallDialog::postBuild() +bool LLOutgoingCallDialog::postBuild() { - BOOL success = LLCallDialog::postBuild(); + bool success = LLCallDialog::postBuild(); childSetAction("Cancel", onCancel, this); - setCanDrag(FALSE); + setCanDrag(false); return success; } @@ -2810,14 +2809,14 @@ void LLIncomingCallDialog::onLifetimeExpired() } } -BOOL LLIncomingCallDialog::postBuild() +bool LLIncomingCallDialog::postBuild() { LLCallDialog::postBuild(); if (!mPayload.isMap() || mPayload.size() == 0) { LL_INFOS("IMVIEW") << "IncomingCall: invalid argument" << LL_ENDL; - return TRUE; + return true; } LLUUID session_id = mPayload["session_id"].asUUID(); @@ -2827,14 +2826,14 @@ BOOL LLIncomingCallDialog::postBuild() if (session_id.isNull() && caller_id.asUUID().isNull()) { LL_INFOS("IMVIEW") << "IncomingCall: invalid ids" << LL_ENDL; - return TRUE; + return true; } std::string notify_box_type = mPayload["notify_box_type"].asString(); if (!is_voice_call_type(notify_box_type)) { LL_INFOS("IMVIEW") << "IncomingCall: notify_box_type was not provided" << LL_ENDL; - return TRUE; + return true; } // init notification's lifetime @@ -2845,7 +2844,7 @@ BOOL LLIncomingCallDialog::postBuild() } std::string call_type; - if (gAgent.isInGroup(session_id, TRUE)) + if (gAgent.isInGroup(session_id, true)) { LLStringUtil::format_map_t args; LLGroupData data; @@ -2896,8 +2895,8 @@ BOOL LLIncomingCallDialog::postBuild() bool is_avatar = LLVoiceClient::getInstance()->isParticipantAvatar(session_id); getChildView("Start IM")->setVisible( is_avatar && notify_box_type != "VoiceInviteAdHoc" && notify_box_type != "VoiceInviteGroup"); - setCanDrag(FALSE); - return TRUE; + setCanDrag(false); + return true; } void LLIncomingCallDialog::setCallerName(const std::string& ui_title, @@ -3017,7 +3016,7 @@ void LLIncomingCallDialog::processCallResponse(S32 response, const LLSD &payload case IM_SESSION_CONFERENCE_START: case IM_SESSION_GROUP_START: case IM_SESSION_INVITE: - if (gAgent.isInGroup(session_id, TRUE)) + if (gAgent.isInGroup(session_id, true)) { LLGroupData data; if (!gAgent.getGroupData(session_id, data)) break; @@ -3125,7 +3124,7 @@ LLIMMgr::LLIMMgr() LLIMModel::getInstance()->addNewMsgCallback(boost::bind(&LLFloaterIMSession::sRemoveTypingIndicator, _1)); - gSavedPerAccountSettings.declareBOOL("FetchGroupChatHistory", TRUE, "Fetch recent messages from group chat servers when a group window opens", LLControlVariable::PERSIST_ALWAYS); + gSavedPerAccountSettings.declareBOOL("FetchGroupChatHistory", true, "Fetch recent messages from group chat servers when a group window opens", LLControlVariable::PERSIST_ALWAYS); } // Add a message to a session. @@ -3239,7 +3238,7 @@ void LLIMMgr::addMessage( } //Play sound for new conversations - if (!skip_message & !gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNewConversation") == TRUE)) + if (!skip_message & !gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNewConversation"))) { make_ui_sound("UISndNewIncomingIMSession"); } @@ -3501,7 +3500,7 @@ void LLIMMgr::inviteToSession( // voice invite question is different from default only for group call (EXT-7118) std::string question_type = "VoiceInviteQuestionDefault"; - BOOL voice_invite = FALSE; + bool voice_invite = false; bool is_linden = LLMuteList::isLinden(caller_name); @@ -3509,21 +3508,21 @@ void LLIMMgr::inviteToSession( { //P2P is different...they only have voice invitations notify_box_type = "VoiceInviteP2P"; - voice_invite = TRUE; + voice_invite = true; } - else if ( gAgent.isInGroup(session_id, TRUE) ) + else if ( gAgent.isInGroup(session_id, true) ) { //only really old school groups have voice invitations notify_box_type = "VoiceInviteGroup"; question_type = "VoiceInviteQuestionGroup"; - voice_invite = TRUE; + voice_invite = true; } else if ( inv_type == INVITATION_TYPE_VOICE ) { //else it's an ad-hoc //and a voice ad-hoc notify_box_type = "VoiceInviteAdHoc"; - voice_invite = TRUE; + voice_invite = true; } else if ( inv_type == INVITATION_TYPE_IMMEDIATE ) { @@ -3614,7 +3613,7 @@ void LLIMMgr::inviteToSession( } else { - LLFloaterReg::showInstance("incoming_call", payload, FALSE); + LLFloaterReg::showInstance("incoming_call", payload, false); } // Add the caller to the Recent List here (at this point @@ -3636,7 +3635,7 @@ void LLIMMgr::onInviteNameLookup(LLSD payload, const LLUUID& id, const LLAvatarN std::string notify_box_type = payload["notify_box_type"].asString(); - LLFloaterReg::showInstance("incoming_call", payload, FALSE); + LLFloaterReg::showInstance("incoming_call", payload, false); } //*TODO disconnects all sessions @@ -3645,7 +3644,7 @@ void LLIMMgr::disconnectAllSessions() //*TODO disconnects all IM sessions } -BOOL LLIMMgr::hasSession(const LLUUID& session_id) +bool LLIMMgr::hasSession(const LLUUID& session_id) { return LLIMModel::getInstance()->findIMSession(session_id) != NULL; } @@ -3874,7 +3873,7 @@ bool LLIMMgr::endCall(const LLUUID& session_id) if (im_session) { // need to update speakers' state - im_session->mSpeakers->update(FALSE); + im_session->mSpeakers->update(false); } return true; } @@ -3934,7 +3933,7 @@ void LLIMMgr::noteOfflineUsers( const LLUUID& session_id, const std::vector<LLUUID>& ids) { - S32 count = ids.size(); + auto count = ids.size(); if(count == 0) { const std::string& only_user = LLTrans::getString("only_user_message"); @@ -3972,7 +3971,7 @@ void LLIMMgr::noteMutedUsers(const LLUUID& session_id, return; } - S32 count = ids.size(); + auto count = ids.size(); if(count > 0) { LLIMModel* im_model = LLIMModel::getInstance(); @@ -3992,15 +3991,15 @@ void LLIMMgr::noteMutedUsers(const LLUUID& session_id, void LLIMMgr::processIMTypingStart(const LLUUID& from_id, const EInstantMessage im_type) { - processIMTypingCore(from_id, im_type, TRUE); + processIMTypingCore(from_id, im_type, true); } void LLIMMgr::processIMTypingStop(const LLUUID& from_id, const EInstantMessage im_type) { - processIMTypingCore(from_id, im_type, FALSE); + processIMTypingCore(from_id, im_type, false); } -void LLIMMgr::processIMTypingCore(const LLUUID& from_id, const EInstantMessage im_type, BOOL typing) +void LLIMMgr::processIMTypingCore(const LLUUID& from_id, const EInstantMessage im_type, bool typing) { LLUUID session_id = computeSessionID(im_type, from_id); LLFloaterIMSession* im_floater = LLFloaterIMSession::findInstance(session_id); @@ -4210,7 +4209,7 @@ public: time_t timestamp = (time_t) message_params["timestamp"].asInteger(); - BOOL is_do_not_disturb = gAgent.isDoNotDisturb(); + bool is_do_not_disturb = gAgent.isDoNotDisturb(); //don't return if user is muted b/c proper way to ignore a muted user who //initiated an adhoc/group conference is to create then leave the session (see STORM-1731) @@ -4270,7 +4269,7 @@ public: return; } - BOOL session_type_p2p = input["body"]["voice"].get("invitation_type").asInteger() == EMultiAgentChatSessionType::P2P_CHAT_SESSION; + bool session_type_p2p = input["body"]["voice"].get("invitation_type").asInteger() == EMultiAgentChatSessionType::P2P_CHAT_SESSION; LL_DEBUGS("Voice") << "Received voice information from the server: " << input["body"]<< LL_ENDL; gIMMgr->inviteToSession( input["body"]["session_id"].asUUID(), diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index 9fd5e9d5c4..99b19c9fa9 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -51,7 +51,7 @@ class LLSessionTimeoutTimer : public LLEventTimer public: LLSessionTimeoutTimer(const LLUUID& session_id, F32 period) : LLEventTimer(period), mSessionId(session_id) {} virtual ~LLSessionTimeoutTimer() {}; - /* virtual */ BOOL tick(); + /* virtual */ bool tick(); private: LLUUID mSessionId; @@ -300,7 +300,7 @@ public: static void sendLeaveSession(const LLUUID& session_id, const LLUUID& other_participant_id); static bool sendStartSession(const LLUUID& temp_session_id, const LLUUID& other_participant_id, const uuid_vec_t& ids, EInstantMessage dialog, bool p2p_as_adhoc_call); - static void sendTypingState(LLUUID session_id, LLUUID other_participant_id, BOOL typing); + static void sendTypingState(LLUUID session_id, LLUUID other_participant_id, bool typing); static void sendMessage(const std::string& utf8_text, const LLUUID& im_session_id, const LLUUID& other_participant_id, EInstantMessage dialog); @@ -333,7 +333,7 @@ class LLIMSessionObserver { public: virtual ~LLIMSessionObserver() {} - virtual void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, BOOL has_offline_msg) = 0; + virtual void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, bool has_offline_msg) = 0; virtual void sessionActivated(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) = 0; virtual void sessionVoiceOrIMStarted(const LLUUID& session_id) = 0; virtual void sessionRemoved(const LLUUID& session_id) = 0; @@ -441,7 +441,7 @@ public: // good connection. void disconnectAllSessions(); - BOOL hasSession(const LLUUID& session_id); + bool hasSession(const LLUUID& session_id); static LLUUID computeSessionID(EInstantMessage dialog, const LLUUID& other_participant_id); @@ -501,7 +501,7 @@ private: void noteOfflineUsers(const LLUUID& session_id, const std::vector<LLUUID>& ids); void noteMutedUsers(const LLUUID& session_id, const std::vector<LLUUID>& ids); - void processIMTypingCore(const LLUUID& from_id, const EInstantMessage im_type, BOOL typing); + void processIMTypingCore(const LLUUID& from_id, const EInstantMessage im_type, bool typing); static void onInviteNameLookup(LLSD payload, const LLUUID& id, const LLAvatarName& name); @@ -556,7 +556,7 @@ public: LLCallDialog(const LLSD& payload); virtual ~LLCallDialog(); - virtual BOOL postBuild(); + virtual bool postBuild(); void dockToToolbarButton(const std::string& toolbarButtonName); @@ -601,7 +601,7 @@ public: } } - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void onOpen(const LLSD& key); static void onAccept(void* user_data); @@ -627,7 +627,7 @@ class LLOutgoingCallDialog : public LLCallDialog public: LLOutgoingCallDialog(const LLSD& payload); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); void show(const LLSD& key); static void onCancel(void* user_data); diff --git a/indra/newview/llinspect.cpp b/indra/newview/llinspect.cpp index 101b9bdc2d..bfef4860c4 100644 --- a/indra/newview/llinspect.cpp +++ b/indra/newview/llinspect.cpp @@ -93,15 +93,15 @@ void LLInspect::onFocusLost() } // virtual -BOOL LLInspect::handleHover(S32 x, S32 y, MASK mask) +bool LLInspect::handleHover(S32 x, S32 y, MASK mask) { mOpenTimer.pause(); return LLView::handleHover(x, y, mask); } -BOOL LLInspect::handleToolTip(S32 x, S32 y, MASK mask) +bool LLInspect::handleToolTip(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; //delegate handling of tooltip to the hovered child @@ -115,7 +115,7 @@ BOOL LLInspect::handleToolTip(S32 x, S32 y, MASK mask) //set up delay if there is no visible tooltip at this moment params.delay_time = LLToolTipMgr::instance().toolTipVisible() ? 0.f : LLUI::getInstance()->mSettingGroups["config"]->getF32( "ToolTipDelay" ); LLToolTipMgr::instance().show(params); - handled = TRUE; + handled = true; } return handled; } diff --git a/indra/newview/llinspect.h b/indra/newview/llinspect.h index 881043389d..8113bf460b 100644 --- a/indra/newview/llinspect.h +++ b/indra/newview/llinspect.h @@ -40,8 +40,8 @@ public: /// Inspectors have a custom fade-in/fade-out animation /*virtual*/ void draw(); - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleToolTip(S32 x, S32 y, MASK mask); /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask); /// Start open animation diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp index 2bd4796bd0..b03b7beed6 100644 --- a/indra/newview/llinspectavatar.cpp +++ b/indra/newview/llinspectavatar.cpp @@ -67,7 +67,7 @@ public: LLInspectAvatar(const LLSD& avatar_id); virtual ~LLInspectAvatar(); - /*virtual*/ BOOL postBuild(void); + /*virtual*/ bool postBuild(void); // Because floater is single instance, need to re-parse data on each spawn // (for example, inspector about same avatar but in different position) @@ -179,7 +179,7 @@ LLInspectAvatar::~LLInspectAvatar() } /*virtual*/ -BOOL LLInspectAvatar::postBuild(void) +bool LLInspectAvatar::postBuild(void) { getChild<LLUICtrl>("mute_btn")->setCommitCallback( boost::bind(&LLInspectAvatar::onClickMuteVolume, this) ); @@ -187,7 +187,7 @@ BOOL LLInspectAvatar::postBuild(void) getChild<LLUICtrl>("volume_slider")->setCommitCallback( boost::bind(&LLInspectAvatar::onVolumeChange, this, _2)); - return TRUE; + return true; } // Multiple calls to showInstance("inspect_avatar", foo) will provide different @@ -265,8 +265,8 @@ void LLInspectAvatar::processAvatarData(LLAvatarData* data) std::string birth_date = LLTrans::getString(data->hide_age ? "AvatarBirthDateFormatShort" : "AvatarBirthDateFormatFull"); - LLStringUtil::format(birth_date, LLSD().with("datetime", (S32)data->born_on.secondsSinceEpoch())); - args["[BORN_ON]"] = birth_date; + LLStringUtil::format(birth_date, LLSD().with("datetime", (S32) data->born_on.secondsSinceEpoch())); + args["[BORN_ON]"] = birth_date; args["[AGE]"] = data->hide_age ? LLStringUtilBase<char>::null : LLDateUtil::ageFromDate(data->born_on, LLDate::now()); diff --git a/indra/newview/llinspectobject.cpp b/indra/newview/llinspectobject.cpp index eccc359a3a..eb2cdb8632 100644 --- a/indra/newview/llinspectobject.cpp +++ b/indra/newview/llinspectobject.cpp @@ -70,7 +70,7 @@ public: LLInspectObject(const LLSD& object_id); virtual ~LLInspectObject(); - /*virtual*/ BOOL postBuild(void); + /*virtual*/ bool postBuild(void); // Because floater is single instance, need to re-parse data on each spawn // (for example, inspector about same avatar but in different position) @@ -149,7 +149,7 @@ LLInspectObject::~LLInspectObject() } /*virtual*/ -BOOL LLInspectObject::postBuild(void) +bool LLInspectObject::postBuild(void) { // The XML file has sample data in it. Clear that out so we don't // flicker when data arrives off network. @@ -187,7 +187,7 @@ BOOL LLInspectObject::postBuild(void) boost::bind(&LLInspectObject::update, this)); } - return TRUE; + return true; } // Multiple calls to showInstance("inspect_avatar", foo) will provide different @@ -218,14 +218,14 @@ void LLInspectObject::onOpen(const LLSD& data) LLViewerMediaFocus::getInstance()->clearFocus(); LLSelectMgr::instance().deselectAll(); - mObjectSelection = LLSelectMgr::instance().selectObjectAndFamily(obj,FALSE,TRUE); + mObjectSelection = LLSelectMgr::instance().selectObjectAndFamily(obj,false,true); // Mark this as a transient selection struct SetTransient : public LLSelectedNodeFunctor { bool apply(LLSelectNode* node) { - node->setTransient(TRUE); + node->setTransient(true); return true; } } functor; @@ -372,7 +372,7 @@ void LLInspectObject::updateButtons(LLSelectNode* nodep) } // No flash - focusFirstItem(FALSE, FALSE); + focusFirstItem(false, false); } void LLInspectObject::updateSitLabel(LLSelectNode* nodep) diff --git a/indra/newview/llinspectremoteobject.cpp b/indra/newview/llinspectremoteobject.cpp index bf4ca40397..0060fe544d 100644 --- a/indra/newview/llinspectremoteobject.cpp +++ b/indra/newview/llinspectremoteobject.cpp @@ -51,7 +51,7 @@ public: LLInspectRemoteObject(const LLSD& object_id); virtual ~LLInspectRemoteObject() {}; - /*virtual*/ BOOL postBuild(void); + /*virtual*/ bool postBuild(void); /*virtual*/ void onOpen(const LLSD& avatar_id); void onClickMap(); @@ -80,7 +80,7 @@ LLInspectRemoteObject::LLInspectRemoteObject(const LLSD& sd) : } /*virtual*/ -BOOL LLInspectRemoteObject::postBuild(void) +bool LLInspectRemoteObject::postBuild(void) { // hook up the inspector's buttons getChild<LLUICtrl>("map_btn")->setCommitCallback( @@ -90,7 +90,7 @@ BOOL LLInspectRemoteObject::postBuild(void) getChild<LLUICtrl>("close_btn")->setCommitCallback( boost::bind(&LLInspectRemoteObject::onClickClose, this)); - return TRUE; + return true; } /*virtual*/ diff --git a/indra/newview/llinspecttexture.cpp b/indra/newview/llinspecttexture.cpp index add9a22f15..75366c4831 100644 --- a/indra/newview/llinspecttexture.cpp +++ b/indra/newview/llinspecttexture.cpp @@ -146,7 +146,7 @@ void LLTexturePreviewView::draw() if (4 == m_Image->getComponents()) { const LLColor4 color(.098f, .098f, .098f); - gl_rect_2d(rctClient, color, TRUE); + gl_rect_2d(rctClient, color, true); } gl_draw_scaled_image(rctClient.mLeft, rctClient.mBottom, rctClient.getWidth(), rctClient.getHeight(), m_Image); diff --git a/indra/newview/llinspecttoast.cpp b/indra/newview/llinspecttoast.cpp index 2e05893489..e3bf960c6d 100644 --- a/indra/newview/llinspecttoast.cpp +++ b/indra/newview/llinspecttoast.cpp @@ -46,7 +46,7 @@ public: virtual ~LLInspectToast(); /*virtual*/ void onOpen(const LLSD& notification_id); - /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleToolTip(S32 x, S32 y, MASK mask); /*virtual*/ void deleteAllChildren(); /*virtual*/ void removeChild(LLView* child); private: @@ -96,14 +96,14 @@ void LLInspectToast::onOpen(const LLSD& notification_id) LL_WARNS() << "Could not get toast's panel." << LL_ENDL; return; } - panel->setVisible(TRUE); - panel->setMouseOpaque(FALSE); + panel->setVisible(true); + panel->setMouseOpaque(false); if(mPanel != NULL && mPanel->getParent() == this) { LLInspect::removeChild(mPanel); } addChild(panel); - panel->setFocus(TRUE); + panel->setFocus(true); mPanel = panel; @@ -115,7 +115,7 @@ void LLInspectToast::onOpen(const LLSD& notification_id) } // virtual -BOOL LLInspectToast::handleToolTip(S32 x, S32 y, MASK mask) +bool LLInspectToast::handleToolTip(S32 x, S32 y, MASK mask) { // We don't like the way LLInspect handles tooltips // (black tooltips look weird), diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index bbd8e20c68..df57504969 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -124,7 +124,7 @@ bool isMarketplaceSendAction(const std::string& action) bool isPanelActive(const std::string& panel_name) { - LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE); + LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(false); return (active_panel && (active_panel->getName() == panel_name)); } @@ -207,7 +207,7 @@ public: panel->getRootFolder()->update(); has_elements = true; } - panel->getRootFolder()->changeSelection(item, TRUE); + panel->getRootFolder()->changeSelection(item, true); } } } @@ -232,7 +232,7 @@ LLInvFVBridge::LLInvFVBridge(LLInventoryPanel* inventory, mUUID(uuid), mRoot(root), mInvType(LLInventoryType::IT_NONE), - mIsLink(FALSE), + mIsLink(false), LLFolderViewModelItemInventory(inventory->getRootViewModel()) { mInventoryPanel = inventory->getInventoryPanelHandle(); @@ -309,23 +309,23 @@ void LLInvFVBridge::setCreationDate(time_t creation_date_utc) // Can be destroyed (or moved to trash) -BOOL LLInvFVBridge::isItemRemovable(bool check_worn) const +bool LLInvFVBridge::isItemRemovable(bool check_worn) const { return get_is_item_removable(getInventoryModel(), mUUID, check_worn); } // Can be moved to another folder -BOOL LLInvFVBridge::isItemMovable() const +bool LLInvFVBridge::isItemMovable() const { - return TRUE; + return true; } -BOOL LLInvFVBridge::isLink() const +bool LLInvFVBridge::isLink() const { return mIsLink; } -BOOL LLInvFVBridge::isLibraryItem() const +bool LLInvFVBridge::isLibraryItem() const { return gInventory.isObjectDescendentOf(getUUID(),gInventory.getLibraryRootFolderID()); } @@ -334,19 +334,19 @@ BOOL LLInvFVBridge::isLibraryItem() const /** * @brief Adds this item into clipboard storage */ -BOOL LLInvFVBridge::cutToClipboard() +bool LLInvFVBridge::cutToClipboard() { const LLInventoryObject* obj = gInventory.getObject(mUUID); if (obj && isItemMovable() && isItemRemovable()) { const LLUUID &marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS); - const BOOL cut_from_marketplacelistings = gInventory.isObjectDescendentOf(mUUID, marketplacelistings_id); + const bool cut_from_marketplacelistings = gInventory.isObjectDescendentOf(mUUID, marketplacelistings_id); if (cut_from_marketplacelistings && (LLMarketplaceData::instance().isInActiveFolder(mUUID) || LLMarketplaceData::instance().isListedAndActive(mUUID))) { LLUUID parent_uuid = obj->getParentUUID(); - BOOL result = perform_cutToClipboard(); + bool result = perform_cutToClipboard(); gInventory.addChangedMask(LLInventoryObserver::STRUCTURE, parent_uuid); return result; } @@ -356,7 +356,7 @@ BOOL LLInvFVBridge::cutToClipboard() return perform_cutToClipboard(); } } - return FALSE; + return false; } // virtual @@ -370,17 +370,17 @@ bool LLInvFVBridge::isCutToClipboard() } // Callback for cutToClipboard if DAMA required... -BOOL LLInvFVBridge::callback_cutToClipboard(const LLSD& notification, const LLSD& response) +bool LLInvFVBridge::callback_cutToClipboard(const LLSD& notification, const LLSD& response) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); if (option == 0) // YES { return perform_cutToClipboard(); } - return FALSE; + return false; } -BOOL LLInvFVBridge::perform_cutToClipboard() +bool LLInvFVBridge::perform_cutToClipboard() { const LLInventoryObject* obj = gInventory.getObject(mUUID); if (obj && isItemMovable() && isItemRemovable()) @@ -388,24 +388,24 @@ BOOL LLInvFVBridge::perform_cutToClipboard() LLClipboard::instance().setCutMode(true); return LLClipboard::instance().addToClipboard(mUUID); } - return FALSE; + return false; } -BOOL LLInvFVBridge::copyToClipboard() const +bool LLInvFVBridge::copyToClipboard() const { const LLInventoryObject* obj = gInventory.getObject(mUUID); if (obj && isItemCopyable()) { return LLClipboard::instance().addToClipboard(mUUID); } - return FALSE; + return false; } void LLInvFVBridge::showProperties() { if (isMarketplaceListingsFolder()) { - LLFloaterReg::showInstance("item_properties", LLSD().with("id",mUUID),TRUE); + LLFloaterReg::showInstance("item_properties", LLSD().with("id",mUUID),true); // Force it to show on top as this floater has a tendency to hide when confirmation dialog shows up LLFloater* floater_properties = LLFloaterReg::findInstance("item_properties", LLSD().with("id",mUUID)); if (floater_properties) @@ -454,8 +454,8 @@ void LLInvFVBridge::removeBatch(std::vector<LLFolderViewModelItem*>& batch) LLViewerInventoryCategory* cat = NULL; LLInventoryModel::cat_array_t descendent_categories; LLInventoryModel::item_array_t descendent_items; - S32 count = batch.size(); - S32 i,j; + size_t count = batch.size(); + size_t i,j; for(i = 0; i < count; ++i) { bridge = (LLInvFVBridge*)(batch[i]); @@ -476,7 +476,7 @@ void LLInvFVBridge::removeBatch(std::vector<LLFolderViewModelItem*>& batch) cat = (LLViewerInventoryCategory*)model->getCategory(bridge->getUUID()); if (cat) { - gInventory.collectDescendents( cat->getUUID(), descendent_categories, descendent_items, FALSE ); + gInventory.collectDescendents( cat->getUUID(), descendent_categories, descendent_items, false ); for (j=0; j<descendent_items.size(); j++) { if(LLAssetType::AT_GESTURE == descendent_items[j]->getType()) @@ -506,8 +506,8 @@ void LLInvFVBridge::removeBatchNoCheck(std::vector<LLFolderViewModelItem*>& ba uuid_vec_t move_ids; LLInventoryModel::update_map_t update; bool start_new_message = true; - S32 count = batch.size(); - S32 i; + size_t count = batch.size(); + size_t i; // first, hide any 'preview' floaters that correspond to the items // being deleted. @@ -542,7 +542,7 @@ void LLInvFVBridge::removeBatchNoCheck(std::vector<LLFolderViewModelItem*>& ba msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->addBOOLFast(_PREHASH_Stamp, TRUE); + msg->addBOOLFast(_PREHASH_Stamp, true); } msg->nextBlockFast(_PREHASH_InventoryData); msg->addUUIDFast(_PREHASH_ItemID, item->getUUID()); @@ -583,7 +583,7 @@ void LLInvFVBridge::removeBatchNoCheck(std::vector<LLFolderViewModelItem*>& ba msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->addBOOL("Stamp", TRUE); + msg->addBOOL("Stamp", true); } msg->nextBlockFast(_PREHASH_InventoryData); msg->addUUIDFast(_PREHASH_FolderID, cat->getUUID()); @@ -620,40 +620,37 @@ void LLInvFVBridge::removeBatchNoCheck(std::vector<LLFolderViewModelItem*>& ba model->notifyObservers(); } -BOOL LLInvFVBridge::isClipboardPasteable() const +bool LLInvFVBridge::isClipboardPasteable() const { - // Return FALSE on degenerated cases: empty clipboard, no inventory, no agent + // Return false on degenerated cases: empty clipboard, no inventory, no agent if (!LLClipboard::instance().hasContents() || !isAgentInventory()) { - return FALSE; + return false; } LLInventoryModel* model = getInventoryModel(); if (!model) { - return FALSE; + return false; } // In cut mode, whatever is on the clipboard is always pastable if (LLClipboard::instance().isCutMode()) { - return TRUE; + return true; } // In normal mode, we need to check each element of the clipboard to know if we can paste or not std::vector<LLUUID> objects; LLClipboard::instance().pasteFromClipboard(objects); - S32 count = objects.size(); - for(S32 i = 0; i < count; i++) + for (const auto& item_id : objects) { - const LLUUID &item_id = objects.at(i); - // Folders are pastable if all items in there are copyable const LLInventoryCategory *cat = model->getCategory(item_id); if (cat) { LLFolderBridge cat_br(mInventoryPanel.get(), mRoot, item_id); if (!cat_br.isItemCopyable(false)) - return FALSE; + return false; // Skip to the next item in the clipboard continue; } @@ -662,49 +659,48 @@ BOOL LLInvFVBridge::isClipboardPasteable() const LLItemBridge item_br(mInventoryPanel.get(), mRoot, item_id); if (!item_br.isItemCopyable(false)) { - return FALSE; + return false; } } - return TRUE; + return true; } -BOOL LLInvFVBridge::isClipboardPasteableAsLink() const +bool LLInvFVBridge::isClipboardPasteableAsLink() const { if (!LLClipboard::instance().hasContents() || !isAgentInventory()) { - return FALSE; + return false; } const LLInventoryModel* model = getInventoryModel(); if (!model) { - return FALSE; + return false; } std::vector<LLUUID> objects; LLClipboard::instance().pasteFromClipboard(objects); - S32 count = objects.size(); - for(S32 i = 0; i < count; i++) + for (const auto& item_id : objects) { - const LLInventoryItem *item = model->getItem(objects.at(i)); + const LLInventoryItem *item = model->getItem(item_id); if (item) { if (!LLAssetType::lookupCanLink(item->getActualType())) { - return FALSE; + return false; } if (gInventory.isObjectDescendentOf(item->getUUID(), gInventory.getLibraryRootFolderID())) { - return FALSE; + return false; } } - const LLViewerInventoryCategory *cat = model->getCategory(objects.at(i)); + const LLViewerInventoryCategory *cat = model->getCategory(item_id); if (cat && LLFolderType::lookupIsProtectedType(cat->getPreferredType())) { - return FALSE; + return false; } } - return TRUE; + return true; } void disable_context_entries_if_present(LLMenuGL& menu, @@ -738,12 +734,12 @@ void disable_context_entries_if_present(LLMenuGL& menu, if (found) { - menu_item->setVisible(TRUE); + menu_item->setVisible(true); // A bit of a hack so we can remember that some UI element explicitly set this to be visible // so that some other UI element from multi-select doesn't later set this invisible. - menu_item->pushVisible(TRUE); + menu_item->pushVisible(true); - menu_item->setEnabled(FALSE); + menu_item->setEnabled(false); } } } @@ -792,7 +788,7 @@ void hide_context_entries(LLMenuGL& menu, { if (!menu_item->getLastVisible()) { - menu_item->setVisible(FALSE); + menu_item->setVisible(false); } if (menu_item->getEnabled()) @@ -807,16 +803,16 @@ void hide_context_entries(LLMenuGL& menu, menuentry_vec_t::const_iterator itor2 = std::find(exceptions.begin(), exceptions.end(), name); if (itor2 == exceptions.end()) { - menu_item->setEnabled(FALSE); + menu_item->setEnabled(false); } } } else { - menu_item->setVisible(TRUE); + menu_item->setVisible(true); // A bit of a hack so we can remember that some UI element explicitly set this to be visible // so that some other UI element from multi-select doesn't later set this invisible. - menu_item->pushVisible(TRUE); + menu_item->pushVisible(true); bool enabled = true; for (itor2 = disabled_entries.begin(); enabled && (itor2 != disabled_entries.end()); ++itor2) @@ -1075,7 +1071,7 @@ void LLInvFVBridge::addDeleteContextMenuOptions(menuentry_vec_t &items, void LLInvFVBridge::addOpenRightClickMenuOption(menuentry_vec_t &items) { const LLInventoryObject *obj = getInventoryObject(); - const BOOL is_link = (obj && obj->getIsLinkType()); + const bool is_link = (obj && obj->getIsLinkType()); if (is_link) items.push_back(std::string("Open Original")); @@ -1187,11 +1183,11 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags, LLUUID local_version_folder_id = nested_parent_id(mUUID,depth-1); LLInventoryModel::cat_array_t categories; LLInventoryModel::item_array_t items; - gInventory.collectDescendents(local_version_folder_id, categories, items, FALSE); - LLCachedControl<U32> max_depth(gSavedSettings, "InventoryOutboxMaxFolderDepth", 4); - LLCachedControl<U32> max_count(gSavedSettings, "InventoryOutboxMaxFolderCount", 20); - if (categories.size() >= max_count - || depth > (max_depth + 1)) + gInventory.collectDescendents(local_version_folder_id, categories, items, false); + static LLCachedControl<U32> max_depth(gSavedSettings, "InventoryOutboxMaxFolderDepth", 4); + static LLCachedControl<U32> max_count(gSavedSettings, "InventoryOutboxMaxFolderCount", 20); + if (categories.size() >= (size_t)max_count + || (U32)depth > (max_depth + 1)) { disabled_items.push_back(std::string("New Folder")); } @@ -1233,9 +1229,9 @@ bool LLInvFVBridge::canMenuCut() } // *TODO: remove this -BOOL LLInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const +bool LLInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const { - BOOL rv = FALSE; + bool rv = false; const LLInventoryObject* obj = getInventoryObject(); @@ -1244,7 +1240,7 @@ BOOL LLInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const *type = LLViewerAssetType::lookupDragAndDropType(obj->getActualType()); if(*type == DAD_NONE) { - return FALSE; + return false; } *id = obj->getUUID(); @@ -1255,7 +1251,7 @@ BOOL LLInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const LLInventoryModelBackgroundFetch::instance().start(obj->getUUID()); } - rv = TRUE; + rv = true; } return rv; @@ -1284,27 +1280,27 @@ LLInventoryFilter* LLInvFVBridge::getInventoryFilter() const return panel ? &(panel->getFilter()) : NULL; } -BOOL LLInvFVBridge::isItemInTrash() const +bool LLInvFVBridge::isItemInTrash() const { LLInventoryModel* model = getInventoryModel(); - if(!model) return FALSE; + if(!model) return false; const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); return model->isObjectDescendentOf(mUUID, trash_id); } -BOOL LLInvFVBridge::isLinkedObjectInTrash() const +bool LLInvFVBridge::isLinkedObjectInTrash() const { - if (isItemInTrash()) return TRUE; + if (isItemInTrash()) return true; const LLInventoryObject *obj = getInventoryObject(); if (obj && obj->getIsLinkType()) { LLInventoryModel* model = getInventoryModel(); - if(!model) return FALSE; + if(!model) return false; const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); return model->isObjectDescendentOf(obj->getLinkedUUID(), trash_id); } - return FALSE; + return false; } bool LLInvFVBridge::isItemInOutfits() const @@ -1317,68 +1313,68 @@ bool LLInvFVBridge::isItemInOutfits() const return isCOFFolder() || (my_outfits_cat == mUUID) || model->isObjectDescendentOf(mUUID, my_outfits_cat); } -BOOL LLInvFVBridge::isLinkedObjectMissing() const +bool LLInvFVBridge::isLinkedObjectMissing() const { const LLInventoryObject *obj = getInventoryObject(); if (!obj) { - return TRUE; + return true; } if (obj->getIsLinkType() && LLAssetType::lookupIsLinkType(obj->getType())) { - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLInvFVBridge::isAgentInventory() const +bool LLInvFVBridge::isAgentInventory() const { const LLInventoryModel* model = getInventoryModel(); - if(!model) return FALSE; - if(gInventory.getRootFolderID() == mUUID) return TRUE; + if(!model) return false; + if(gInventory.getRootFolderID() == mUUID) return true; return model->isObjectDescendentOf(mUUID, gInventory.getRootFolderID()); } -BOOL LLInvFVBridge::isCOFFolder() const +bool LLInvFVBridge::isCOFFolder() const { return LLAppearanceMgr::instance().getIsInCOF(mUUID); } // *TODO : Suppress isInboxFolder() once Merchant Outbox is fully deprecated -BOOL LLInvFVBridge::isInboxFolder() const +bool LLInvFVBridge::isInboxFolder() const { const LLUUID inbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX); if (inbox_id.isNull()) { - return FALSE; + return false; } return gInventory.isObjectDescendentOf(mUUID, inbox_id); } -BOOL LLInvFVBridge::isMarketplaceListingsFolder() const +bool LLInvFVBridge::isMarketplaceListingsFolder() const { const LLUUID folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS); if (folder_id.isNull()) { - return FALSE; + return false; } return gInventory.isObjectDescendentOf(mUUID, folder_id); } -BOOL LLInvFVBridge::isItemPermissive() const +bool LLInvFVBridge::isItemPermissive() const { - return FALSE; + return false; } // static void LLInvFVBridge::changeItemParent(LLInventoryModel* model, LLViewerInventoryItem* item, const LLUUID& new_parent_id, - BOOL restamp) + bool restamp) { model->changeItemParent(item, new_parent_id, restamp); } @@ -1387,7 +1383,7 @@ void LLInvFVBridge::changeItemParent(LLInventoryModel* model, void LLInvFVBridge::changeCategoryParent(LLInventoryModel* model, LLViewerInventoryCategory* cat, const LLUUID& new_parent_id, - BOOL restamp) + bool restamp) { model->changeCategoryParent(cat, new_parent_id, restamp); } @@ -1912,7 +1908,7 @@ void LLItemBridge::restoreItem() const LLUUID new_parent = model->findCategoryUUIDForType(is_snapshot? LLFolderType::FT_SNAPSHOT_CATEGORY : LLFolderType::assetTypeToFolderType(item->getType())); // do not restamp on restore. - LLInvFVBridge::changeItemParent(model, item, new_parent, FALSE); + LLInvFVBridge::changeItemParent(model, item, new_parent, false); } } @@ -2050,29 +2046,29 @@ std::string LLItemBridge::getLabelSuffix() const if(item) { // Any type can have the link suffix... - BOOL broken_link = LLAssetType::lookupIsLinkType(item->getType()); + bool broken_link = LLAssetType::lookupIsLinkType(item->getType()); if (broken_link) return BROKEN_LINK; - BOOL link = item->getIsLinkType(); + bool link = item->getIsLinkType(); if (link) return LINK; // ...but it's a bit confusing to put nocopy/nomod/etc suffixes on calling cards. if(LLAssetType::AT_CALLINGCARD != item->getType() && item->getPermissions().getOwner() == gAgent.getID()) { - BOOL copy = item->getPermissions().allowCopyBy(gAgent.getID()); + bool copy = item->getPermissions().allowCopyBy(gAgent.getID()); if (!copy) { suffix += " "; suffix += NO_COPY; } - BOOL mod = item->getPermissions().allowModifyBy(gAgent.getID()); + bool mod = item->getPermissions().allowModifyBy(gAgent.getID()); if (!mod) { suffix += suffix.empty() ? " " : ","; suffix += NO_MOD; } - BOOL xfer = item->getPermissions().allowOperationBy(PERM_TRANSFER, + bool xfer = item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()); if (!xfer) { @@ -2095,7 +2091,7 @@ time_t LLItemBridge::getCreationDate() const } -BOOL LLItemBridge::isItemRenameable() const +bool LLItemBridge::isItemRenameable() const { LLViewerInventoryItem* item = getItem(); if(item) @@ -2104,32 +2100,32 @@ BOOL LLItemBridge::isItemRenameable() const // what the calling card points to. if (item->getInventoryType() == LLInventoryType::IT_CALLINGCARD) { - return FALSE; + return false; } if (!item->isFinished()) // EXT-8662 { - return FALSE; + return false; } if (isInboxFolder()) { - return FALSE; + return false; } return (item->getPermissions().allowModifyBy(gAgent.getID())); } - return FALSE; + return false; } -BOOL LLItemBridge::renameItem(const std::string& new_name) +bool LLItemBridge::renameItem(const std::string& new_name) { if(!isItemRenameable()) - return FALSE; + return false; LLPreview::dirty(mUUID); LLInventoryModel* model = getInventoryModel(); if(!model) - return FALSE; + return false; LLViewerInventoryItem* item = getItem(); if(item && (item->getName() != new_name)) { @@ -2137,30 +2133,30 @@ BOOL LLItemBridge::renameItem(const std::string& new_name) updates["name"] = new_name; update_inventory_item(item->getUUID(),updates, NULL); } - // return FALSE because we either notified observers (& therefore + // return false because we either notified observers (& therefore // rebuilt) or we didn't update. - return FALSE; + return false; } -BOOL LLItemBridge::removeItem() +bool LLItemBridge::removeItem() { if(!isItemRemovable()) { - return FALSE; + return false; } // move it to the trash LLInventoryModel* model = getInventoryModel(); - if(!model) return FALSE; + if(!model) return false; const LLUUID& trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); LLViewerInventoryItem* item = getItem(); - if (!item) return FALSE; + if (!item) return false; if (item->getType() != LLAssetType::AT_LSL_TEXT) { - LLPreview::hide(mUUID, TRUE); + LLPreview::hide(mUUID, true); } // Already in trash - if (model->isObjectDescendentOf(mUUID, trash_id)) return FALSE; + if (model->isObjectDescendentOf(mUUID, trash_id)) return false; LLNotification::Params params("ConfirmItemDeleteHasLinks"); params.functor.function(boost::bind(&LLItemBridge::confirmRemoveItem, this, _1, _2)); @@ -2175,42 +2171,41 @@ BOOL LLItemBridge::removeItem() if (!item->getIsLinkType()) { LLInventoryModel::item_array_t item_array = gInventory.collectLinksTo(mUUID); - const U32 num_links = item_array.size(); - if (num_links > 0) + if (!item_array.empty()) { // Warn if the user is will break any links when deleting this item. LLNotifications::instance().add(params); - return FALSE; + return false; } } } LLNotifications::instance().forceResponse(params, 0); model->checkTrashOverflow(); - return TRUE; + return true; } -BOOL LLItemBridge::confirmRemoveItem(const LLSD& notification, const LLSD& response) +bool LLItemBridge::confirmRemoveItem(const LLSD& notification, const LLSD& response) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if (option != 0) return FALSE; + if (option != 0) return false; LLInventoryModel* model = getInventoryModel(); - if (!model) return FALSE; + if (!model) return false; LLViewerInventoryItem* item = getItem(); - if (!item) return FALSE; + if (!item) return false; const LLUUID& trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); // if item is not already in trash if(item && !model->isObjectDescendentOf(mUUID, trash_id)) { // move to trash, and restamp - LLInvFVBridge::changeItemParent(model, item, trash_id, TRUE); + LLInvFVBridge::changeItemParent(model, item, trash_id, true); // delete was successful - return TRUE; + return true; } - return FALSE; + return false; } bool LLItemBridge::isItemCopyable(bool can_copy_as_link) const @@ -2260,14 +2255,14 @@ const LLUUID& LLItemBridge::getThumbnailUUID() const return LLUUID::null; } -BOOL LLItemBridge::isItemPermissive() const +bool LLItemBridge::isItemPermissive() const { LLViewerInventoryItem* item = getItem(); if(item) { return item->getIsFullPerm(); } - return FALSE; + return false; } // +=================================================+ @@ -2277,17 +2272,17 @@ BOOL LLItemBridge::isItemPermissive() const LLHandle<LLFolderBridge> LLFolderBridge::sSelf; // Can be moved to another folder -BOOL LLFolderBridge::isItemMovable() const +bool LLFolderBridge::isItemMovable() const { LLInventoryObject* obj = getInventoryObject(); if(obj) { // If it's a protected type folder, we can't move it if (LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)obj)->getPreferredType())) - return FALSE; - return TRUE; + return false; + return true; } - return FALSE; + return false; } void LLFolderBridge::selectItem() @@ -2345,10 +2340,9 @@ void LLFolderBridge::buildDisplayName() const std::string LLFolderBridge::getLabelSuffix() const { - static LLCachedControl<F32> folder_loading_message_delay(gSavedSettings, "FolderLoadingMessageWaitTime", 0.5f); static LLCachedControl<bool> xui_debug(gSavedSettings, "DebugShowXUINames", 0); - if (mIsLoading && mTimeSinceRequestStart.getElapsedTimeF32() >= folder_loading_message_delay()) + if (mIsLoading && mTimeSinceRequestStart.getElapsedTimeF32() >= FOLDER_LOADING_MESSAGE_DELAY) { return llformat(" ( %s ) ", LLTrans::getString("LoadingData").c_str()); } @@ -2375,9 +2369,9 @@ std::string LLFolderBridge::getLabelSuffix() const { LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t item_array; - gInventory.collectDescendents(getUUID(), cat_array, item_array, TRUE); - S32 count = item_array.size(); - if(count > 0) + gInventory.collectDescendents(getUUID(), cat_array, item_array, true); + auto count = item_array.size(); + if (count > 0) { std::ostringstream oss; oss << count; @@ -2424,30 +2418,30 @@ void LLFolderBridge::update() } // Can be destroyed (or moved to trash) -BOOL LLFolderBridge::isItemRemovable(bool check_worn) const +bool LLFolderBridge::isItemRemovable(bool check_worn) const { if (!get_is_category_and_children_removable(getInventoryModel(), mUUID, check_worn)) { - return FALSE; + return false; } if (isMarketplaceListingsFolder() && (!LLMarketplaceData::instance().isSLMDataFetched() || LLMarketplaceData::instance().getActivationState(mUUID))) { - return FALSE; + return false; } - return TRUE; + return true; } -BOOL LLFolderBridge::isUpToDate() const +bool LLFolderBridge::isUpToDate() const { LLInventoryModel* model = getInventoryModel(); - if(!model) return FALSE; + if(!model) return false; LLViewerInventoryCategory* category = (LLViewerInventoryCategory*)model->getCategory(mUUID); if( !category ) { - return FALSE; + return false; } return category->getVersion() != LLViewerInventoryCategory::VERSION_UNKNOWN; @@ -2495,10 +2489,10 @@ bool LLFolderBridge::isItemCopyable(bool can_copy_as_link) const return true; } -BOOL LLFolderBridge::isClipboardPasteable() const +bool LLFolderBridge::isClipboardPasteable() const { if ( ! LLInvFVBridge::isClipboardPasteable() ) - return FALSE; + return false; // Don't allow pasting duplicates to the Calling Card/Friends subfolders, see bug EXT-1599 if ( LLFriendCardsManager::instance().isCategoryInFriendFolder( getCategory() ) ) @@ -2506,7 +2500,7 @@ BOOL LLFolderBridge::isClipboardPasteable() const LLInventoryModel* model = getInventoryModel(); if ( !model ) { - return FALSE; + return false; } std::vector<LLUUID> objects; @@ -2515,44 +2509,42 @@ BOOL LLFolderBridge::isClipboardPasteable() const // Search for the direct descendent of current Friends subfolder among all pasted items, // and return false if is found. - for(S32 i = objects.size() - 1; i >= 0; --i) + for (S32 i = static_cast<S32>(objects.size()) - 1; i >= 0; --i) { const LLUUID &obj_id = objects.at(i); if ( LLFriendCardsManager::instance().isObjDirectDescendentOfCategory(model->getObject(obj_id), current_cat) ) { - return FALSE; + return false; } } } - return TRUE; + return true; } -BOOL LLFolderBridge::isClipboardPasteableAsLink() const +bool LLFolderBridge::isClipboardPasteableAsLink() const { // Check normal paste-as-link permissions if (!LLInvFVBridge::isClipboardPasteableAsLink()) { - return FALSE; + return false; } const LLInventoryModel* model = getInventoryModel(); if (!model) { - return FALSE; + return false; } const LLViewerInventoryCategory *current_cat = getCategory(); if (current_cat) { - const BOOL is_in_friend_folder = LLFriendCardsManager::instance().isCategoryInFriendFolder( current_cat ); + const bool is_in_friend_folder = LLFriendCardsManager::instance().isCategoryInFriendFolder( current_cat ); const LLUUID ¤t_cat_id = current_cat->getUUID(); std::vector<LLUUID> objects; LLClipboard::instance().pasteFromClipboard(objects); - S32 count = objects.size(); - for(S32 i = 0; i < count; i++) + for (const auto& obj_id : objects) { - const LLUUID &obj_id = objects.at(i); const LLInventoryCategory *cat = model->getCategory(obj_id); if (cat) { @@ -2561,7 +2553,7 @@ BOOL LLFolderBridge::isClipboardPasteableAsLink() const if ((cat_id == current_cat_id) || model->isObjectDescendentOf(current_cat_id, cat_id)) { - return FALSE; + return false; } } // Don't allow pasting duplicates to the Calling Card/Friends subfolders, see bug EXT-1599 @@ -2572,30 +2564,30 @@ BOOL LLFolderBridge::isClipboardPasteableAsLink() const // in case type of obj_id is LLInventoryItem. if ( LLFriendCardsManager::instance().isObjDirectDescendentOfCategory(model->getObject(obj_id), current_cat) ) { - return FALSE; + return false; } } } } - return TRUE; + return true; } -BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, - BOOL drop, +bool LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, + bool drop, std::string& tooltip_msg, - BOOL is_link, - BOOL user_confirm, + bool is_link, + bool user_confirm, LLPointer<LLInventoryCallback> cb) { LLInventoryModel* model = getInventoryModel(); - if (!inv_cat) return FALSE; // shouldn't happen, but in case item is incorrectly parented in which case inv_cat will be NULL - if (!model) return FALSE; - if (!isAgentAvatarValid()) return FALSE; - if (!isAgentInventory()) return FALSE; // cannot drag categories into library + if (!inv_cat) return false; // shouldn't happen, but in case item is incorrectly parented in which case inv_cat will be NULL + if (!model) return false; + if (!isAgentAvatarValid()) return false; + if (!isAgentInventory()) return false; // cannot drag categories into library LLInventoryPanel* destination_panel = mInventoryPanel.get(); if (!destination_panel) return false; @@ -2608,18 +2600,18 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS); const LLUUID from_folder_uuid = inv_cat->getParentUUID(); - const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id); - const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); - const BOOL move_is_from_marketplacelistings = model->isObjectDescendentOf(cat_id, marketplacelistings_id); + const bool move_is_into_current_outfit = (mUUID == current_outfit_id); + const bool move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); + const bool move_is_from_marketplacelistings = model->isObjectDescendentOf(cat_id, marketplacelistings_id); // check to make sure source is agent inventory, and is represented there. LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource(); - const BOOL is_agent_inventory = (model->getCategory(cat_id) != NULL) + const bool is_agent_inventory = (model->getCategory(cat_id) != NULL) && (LLToolDragAndDrop::SOURCE_AGENT == source); - BOOL accept = FALSE; + bool accept = false; U64 filter_types = filter->getFilterTypes(); - BOOL use_filter = filter_types && (filter_types&LLInventoryFilter::FILTERTYPE_DATE || (filter_types&LLInventoryFilter::FILTERTYPE_OBJECT)==0); + bool use_filter = filter_types && (filter_types&LLInventoryFilter::FILTERTYPE_DATE || (filter_types&LLInventoryFilter::FILTERTYPE_OBJECT)==0); if (is_agent_inventory) { @@ -2628,44 +2620,44 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, const LLUUID &my_outifts_id = model->findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); const LLUUID &lost_and_found_id = model->findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND); - const BOOL move_is_into_trash = (mUUID == trash_id) || model->isObjectDescendentOf(mUUID, trash_id); - const BOOL move_is_into_my_outfits = (mUUID == my_outifts_id) || model->isObjectDescendentOf(mUUID, my_outifts_id); - const BOOL move_is_into_outfit = move_is_into_my_outfits || (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); - const BOOL move_is_into_current_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_CURRENT_OUTFIT); - const BOOL move_is_into_landmarks = (mUUID == landmarks_id) || model->isObjectDescendentOf(mUUID, landmarks_id); - const BOOL move_is_into_lost_and_found = model->isObjectDescendentOf(mUUID, lost_and_found_id); + const bool move_is_into_trash = (mUUID == trash_id) || model->isObjectDescendentOf(mUUID, trash_id); + const bool move_is_into_my_outfits = (mUUID == my_outifts_id) || model->isObjectDescendentOf(mUUID, my_outifts_id); + const bool move_is_into_outfit = move_is_into_my_outfits || (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); + const bool move_is_into_current_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_CURRENT_OUTFIT); + const bool move_is_into_landmarks = (mUUID == landmarks_id) || model->isObjectDescendentOf(mUUID, landmarks_id); + const bool move_is_into_lost_and_found = model->isObjectDescendentOf(mUUID, lost_and_found_id); //-------------------------------------------------------------------------------- // Determine if folder can be moved. // - BOOL is_movable = TRUE; + bool is_movable = true; if (is_movable && (marketplacelistings_id == cat_id)) { - is_movable = FALSE; + is_movable = false; tooltip_msg = LLTrans::getString("TooltipOutboxCannotMoveRoot"); } if (is_movable && move_is_from_marketplacelistings && LLMarketplaceData::instance().getActivationState(cat_id)) { // If the incoming folder is listed and active (and is therefore either the listing or the version folder), // then moving is *not* allowed - is_movable = FALSE; + is_movable = false; tooltip_msg = LLTrans::getString("TooltipOutboxDragActive"); } if (is_movable && (mUUID == cat_id)) { - is_movable = FALSE; + is_movable = false; tooltip_msg = LLTrans::getString("TooltipDragOntoSelf"); } if (is_movable && (model->isObjectDescendentOf(mUUID, cat_id))) { - is_movable = FALSE; + is_movable = false; tooltip_msg = LLTrans::getString("TooltipDragOntoOwnChild"); } if (is_movable && LLFolderType::lookupIsProtectedType(inv_cat->getPreferredType())) { - is_movable = FALSE; + is_movable = false; // tooltip? } @@ -2700,21 +2692,21 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, } if(is_movable && move_is_into_current_outfit && is_link) { - is_movable = FALSE; + is_movable = false; } if (is_movable && move_is_into_lost_and_found) { - is_movable = FALSE; + is_movable = false; } if (is_movable && (mUUID == model->findCategoryUUIDForType(LLFolderType::FT_FAVORITE))) { - is_movable = FALSE; + is_movable = false; // tooltip? } if (is_movable && (getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK)) { // One cannot move a folder into a stock folder - is_movable = FALSE; + is_movable = false; // tooltip? } @@ -2722,14 +2714,14 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, LLInventoryModel::item_array_t descendent_items; if (is_movable) { - model->collectDescendents(cat_id, descendent_categories, descendent_items, FALSE); + model->collectDescendents(cat_id, descendent_categories, descendent_items, false); for (S32 i=0; i < descendent_categories.size(); ++i) { LLInventoryCategory* category = descendent_categories[i]; if(LLFolderType::lookupIsProtectedType(category->getPreferredType())) { // Can't move "special folders" (e.g. Textures Folder). - is_movable = FALSE; + is_movable = false; break; } } @@ -2750,7 +2742,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, if (items.size() > max_items_to_wear) { // Can't move 'large' folders into current outfit: MAINT-4086 - is_movable = FALSE; + is_movable = false; LLStringUtil::format_map_t args; args["AMOUNT"] = llformat("%d", max_items_to_wear); tooltip_msg = LLTrans::getString("TooltipTooManyWearables",args); @@ -2763,7 +2755,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, LLInventoryItem* item = descendent_items[i]; if (get_is_item_worn(item->getUUID())) { - is_movable = FALSE; + is_movable = false; break; // It's generally movable, but not into the trash. } } @@ -2778,7 +2770,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, // We use getType() instead of getActua;Type() to allow links to landmarks and folders. if (LLAssetType::AT_LANDMARK != item->getType() && LLAssetType::AT_CATEGORY != item->getType()) { - is_movable = FALSE; + is_movable = false; break; // It's generally movable, but not into Landmarks. } } @@ -2794,7 +2786,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, if (is_movable && !move_is_into_landmarks) { - LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE); + LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(false); is_movable = active_panel != NULL; // For a folder to pass the filter all its descendants are required to pass. @@ -2900,7 +2892,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, inv_cat->getPreferredType() == LLFolderType::FT_OUTFIT)) { // traverse category and add all contents to currently worn. - BOOL append = true; + bool append = true; LLAppearanceMgr::instance().wearInventoryCategory(inv_cat, false, append); if (cb) cb->fire(inv_cat->getUUID()); } @@ -2965,7 +2957,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, if (move_is_into_marketplacelistings) { tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory"); - accept = FALSE; + accept = false; } else { @@ -2992,7 +2984,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, if (move_is_into_marketplacelistings) { tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory"); - accept = FALSE; + accept = false; } else { @@ -3052,9 +3044,9 @@ void warn_move_inventory(LLViewerObject* object, std::shared_ptr<LLMoveInv> move // Move/copy all inventory items from the Contents folder of an in-world // object to the agent's inventory, inside a given category. -BOOL move_inv_category_world_to_agent(const LLUUID& object_id, +bool move_inv_category_world_to_agent(const LLUUID& object_id, const LLUUID& category_id, - BOOL drop, + bool drop, std::function<void(S32, void*, const LLMoveInv*)> callback, void* user_data, LLInventoryFilter* filter) @@ -3067,7 +3059,7 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id, if(!object) { LL_INFOS() << "Object not found for drop." << LL_ENDL; - return FALSE; + return false; } // this folder is coming from an object, as there is only one folder in an object, the root, @@ -3078,12 +3070,12 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id, if (inventory_objects.empty()) { LL_INFOS() << "Object contents not found for drop." << LL_ENDL; - return FALSE; + return false; } - BOOL accept = FALSE; - BOOL is_move = FALSE; - BOOL use_filter = FALSE; + bool accept = false; + bool is_move = false; + bool use_filter = false; if (filter) { U64 filter_types = filter->getFilterTypes(); @@ -3110,15 +3102,15 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id, && perm.allowTransferTo(gAgent.getID()))) // || gAgent.isGodlike()) { - accept = TRUE; + accept = true; } else if(object->permYouOwner()) { // If the object cannot be copied, but the object the // inventory is owned by the agent, then the item can be // moved from the task to agent inventory. - is_move = TRUE; - accept = TRUE; + is_move = true; + accept = true; } if (accept && use_filter) @@ -3194,13 +3186,13 @@ void LLRightClickInventoryFetchDescendentsObserver::execute(bool clear_observer) LLInventoryModel::item_array_t* item_array; gInventory.getDirectDescendentsOf(*current_folder, cat_array, item_array); - S32 item_count(0); + size_t item_count(0); if( item_array ) { item_count = item_array->size(); } - S32 cat_count(0); + size_t cat_count(0); if( cat_array ) { cat_count = cat_array->size(); @@ -3219,18 +3211,18 @@ void LLRightClickInventoryFetchDescendentsObserver::execute(bool clear_observer) // Fetch the items if (item_count) { - for (S32 i = 0; i < item_count; ++i) + for (size_t i = 0; i < item_count; ++i) { - ids.push_back(item_array->at(i)->getUUID()); + ids.emplace_back(item_array->at(i)->getUUID()); } outfit = new LLRightClickInventoryFetchObserver(ids); } // Fetch the subfolders if (cat_count) { - for (S32 i = 0; i < cat_count; ++i) + for (size_t i = 0; i < cat_count; ++i) { - ids.push_back(cat_array->at(i)->getUUID()); + ids.emplace_back(cat_array->at(i)->getUUID()); } categories = new LLRightClickInventoryFetchDescendentsObserver(ids); } @@ -3315,7 +3307,7 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask) { if ((*id_it) == mCatID) { - mFolderAdded = TRUE; + mFolderAdded = true; break; } } @@ -3335,7 +3327,7 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask) mContentsCount) { gInventory.removeObserver(this); - LLAppearanceMgr::instance().wearInventoryCategory(category, FALSE, !mReplace); + LLAppearanceMgr::instance().wearInventoryCategory(category, false, !mReplace); delete this; } } @@ -3381,12 +3373,12 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) } else if ("replaceoutfit" == action) { - modifyOutfit(FALSE); + modifyOutfit(false); return; } else if ("addtooutfit" == action) { - modifyOutfit(TRUE); + modifyOutfit(true); return; } else if ("show_in_main_panel" == action) @@ -3615,7 +3607,7 @@ void LLFolderBridge::copyOutfitToClipboard() LLInventoryModel::item_array_t* item_array; gInventory.getDirectDescendentsOf(mUUID, cat_array, item_array); - S32 item_count(0); + size_t item_count(0); if( item_array ) { item_count = item_array->size(); @@ -3623,7 +3615,7 @@ void LLFolderBridge::copyOutfitToClipboard() if (item_count) { - for (S32 i = 0; i < item_count;) + for (size_t i = 0; i < item_count;) { LLSD uuid =item_array->at(i)->getUUID(); LLViewerInventoryItem* item = gInventory.getItem(uuid); @@ -3637,7 +3629,7 @@ void LLFolderBridge::copyOutfitToClipboard() } } - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(text),0,text.size()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(text), 0, static_cast<S32>(text.size())); } void LLFolderBridge::openItem() @@ -3687,7 +3679,7 @@ void LLFolderBridge::determineFolderType() } } -BOOL LLFolderBridge::isItemRenameable() const +bool LLFolderBridge::isItemRenameable() const { return get_is_category_renameable(getInventoryModel(), mUUID); } @@ -3701,7 +3693,7 @@ void LLFolderBridge::restoreItem() LLInventoryModel* model = getInventoryModel(); const LLUUID new_parent = model->findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(cat->getType())); // do not restamp children on restore - LLInvFVBridge::changeCategoryParent(model, cat, new_parent, FALSE); + LLInvFVBridge::changeCategoryParent(model, cat, new_parent, false); } } @@ -3720,15 +3712,15 @@ LLFolderType::EType LLFolderBridge::getPreferredType() const // Icons for folders are based on the preferred type LLUIImagePtr LLFolderBridge::getIcon() const { - return getFolderIcon(FALSE); + return getFolderIcon(false); } LLUIImagePtr LLFolderBridge::getIconOpen() const { - return getFolderIcon(TRUE); + return getFolderIcon(true); } -LLUIImagePtr LLFolderBridge::getFolderIcon(BOOL is_open) const +LLUIImagePtr LLFolderBridge::getFolderIcon(bool is_open) const { LLFolderType::EType preferred_type = getPreferredType(); return LLUI::getUIImage(LLViewerFolderType::lookupIconName(preferred_type, is_open)); @@ -3737,7 +3729,7 @@ LLUIImagePtr LLFolderBridge::getFolderIcon(BOOL is_open) const // static : use by LLLinkFolderBridge to get the closed type icons LLUIImagePtr LLFolderBridge::getIcon(LLFolderType::EType preferred_type) { - return LLUI::getUIImage(LLViewerFolderType::lookupIconName(preferred_type, FALSE)); + return LLUI::getUIImage(LLViewerFolderType::lookupIconName(preferred_type, false)); } LLUIImagePtr LLFolderBridge::getIconOverlay() const @@ -3749,7 +3741,7 @@ LLUIImagePtr LLFolderBridge::getIconOverlay() const return NULL; } -BOOL LLFolderBridge::renameItem(const std::string& new_name) +bool LLFolderBridge::renameItem(const std::string& new_name) { LLScrollOnRenameObserver *observer = new LLScrollOnRenameObserver(mUUID, mRoot); @@ -3757,16 +3749,16 @@ BOOL LLFolderBridge::renameItem(const std::string& new_name) rename_category(getInventoryModel(), mUUID, new_name); - // return FALSE because we either notified observers (& therefore + // return false because we either notified observers (& therefore // rebuilt) or we didn't update. - return FALSE; + return false; } -BOOL LLFolderBridge::removeItem() +bool LLFolderBridge::removeItem() { if(!isItemRemovable()) { - return FALSE; + return false; } const LLViewerInventoryCategory *cat = getCategory(); @@ -3777,16 +3769,16 @@ BOOL LLFolderBridge::removeItem() LLNotification::Params params("ConfirmDeleteProtectedCategory"); params.payload(payload).substitutions(args).functor.function(boost::bind(&LLFolderBridge::removeItemResponse, this, _1, _2)); LLNotifications::instance().forceResponse(params, 0); - return TRUE; + return true; } -BOOL LLFolderBridge::removeSystemFolder() +bool LLFolderBridge::removeSystemFolder() { const LLViewerInventoryCategory *cat = getCategory(); if (!LLFolderType::lookupIsProtectedType(cat->getPreferredType())) { - return FALSE; + return false; } LLSD payload; @@ -3798,7 +3790,7 @@ BOOL LLFolderBridge::removeSystemFolder() { LLNotifications::instance().add(params); } - return TRUE; + return true; } bool LLFolderBridge::removeItemResponse(const LLSD& notification, const LLSD& response) @@ -3811,9 +3803,9 @@ bool LLFolderBridge::removeItemResponse(const LLSD& notification, const LLSD& re // move it to the trash LLPreview::hide(mUUID); getInventoryModel()->removeCategory(mUUID); - return TRUE; + return true; } - return FALSE; + return false; } //Recursively update the folder's creation date @@ -3835,9 +3827,9 @@ void LLFolderBridge::pasteFromClipboard() if (model && isClipboardPasteable()) { const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS); - const BOOL paste_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); + const bool paste_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); - BOOL cut_from_marketplacelistings = FALSE; + bool cut_from_marketplacelistings = false; if (LLClipboard::instance().isCutMode()) { //Items are not removed from folder on "cut", so we need update listing folder on "paste" operation @@ -3849,7 +3841,7 @@ void LLFolderBridge::pasteFromClipboard() if(gInventory.isObjectDescendentOf(item_id, marketplacelistings_id) && (LLMarketplaceData::instance().isInActiveFolder(item_id) || LLMarketplaceData::instance().isListedAndActive(item_id))) { - cut_from_marketplacelistings = TRUE; + cut_from_marketplacelistings = true; break; } } @@ -3901,12 +3893,12 @@ void LLFolderBridge::perform_pasteFromClipboard() const LLUUID &my_outifts_id = model->findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); const LLUUID &lost_and_found_id = model->findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND); - const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id); - const BOOL move_is_into_my_outfits = (mUUID == my_outifts_id) || model->isObjectDescendentOf(mUUID, my_outifts_id); - const BOOL move_is_into_outfit = move_is_into_my_outfits || (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); - const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); - const BOOL move_is_into_favorites = (mUUID == favorites_id); - const BOOL move_is_into_lost_and_found = model->isObjectDescendentOf(mUUID, lost_and_found_id); + const bool move_is_into_current_outfit = (mUUID == current_outfit_id); + const bool move_is_into_my_outfits = (mUUID == my_outifts_id) || model->isObjectDescendentOf(mUUID, my_outifts_id); + const bool move_is_into_outfit = move_is_into_my_outfits || (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); + const bool move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); + const bool move_is_into_favorites = (mUUID == favorites_id); + const bool move_is_into_lost_and_found = model->isObjectDescendentOf(mUUID, lost_and_found_id); std::vector<LLUUID> objects; LLClipboard::instance().pasteFromClipboard(objects); @@ -3930,11 +3922,11 @@ void LLFolderBridge::perform_pasteFromClipboard() LLInventoryItem *item = model->getItem(item_id); LLInventoryCategory *cat = model->getCategory(item_id); - if (item && !can_move_item_to_marketplace(master_folder, dest_folder, item, error_msg, objects.size() - index, true)) + if (item && !can_move_item_to_marketplace(master_folder, dest_folder, item, error_msg, static_cast<S32>(objects.size()) - index, true)) { break; } - if (cat && !can_move_folder_to_marketplace(master_folder, dest_folder, cat, error_msg, objects.size() - index, true, true)) + if (cat && !can_move_folder_to_marketplace(master_folder, dest_folder, cat, error_msg, static_cast<S32>(objects.size()) - index, true, true)) { break; } @@ -4034,7 +4026,7 @@ void LLFolderBridge::perform_pasteFromClipboard() if (viitem) { //changeItemParent() implicity calls dirtyFilter - changeItemParent(model, viitem, parent_id, FALSE); + changeItemParent(model, viitem, parent_id, false); if (cb) cb->fire(item_id); } } @@ -4066,7 +4058,7 @@ void LLFolderBridge::perform_pasteFromClipboard() else { //changeCategoryParent() implicity calls dirtyFilter - changeCategoryParent(model, vicat, parent_id, FALSE); + changeCategoryParent(model, vicat, parent_id, false); } if (cb) cb->fire(item_id); } @@ -4088,7 +4080,7 @@ void LLFolderBridge::perform_pasteFromClipboard() else { //changeItemParent() implicity calls dirtyFilter - changeItemParent(model, viitem, parent_id, FALSE); + changeItemParent(model, viitem, parent_id, false); } if (cb) cb->fire(item_id); } @@ -4164,10 +4156,10 @@ void LLFolderBridge::pasteLinkFromClipboard() const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS); const LLUUID &my_outifts_id = model->findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); - const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id); - const BOOL move_is_into_my_outfits = (mUUID == my_outifts_id) || model->isObjectDescendentOf(mUUID, my_outifts_id); - const BOOL move_is_into_outfit = move_is_into_my_outfits || (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); - const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); + const bool move_is_into_current_outfit = (mUUID == current_outfit_id); + const bool move_is_into_my_outfits = (mUUID == my_outifts_id) || model->isObjectDescendentOf(mUUID, my_outifts_id); + const bool move_is_into_outfit = move_is_into_my_outfits || (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); + const bool move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); if (move_is_into_marketplacelistings) { @@ -4220,7 +4212,7 @@ void LLFolderBridge::staticFolderOptionsMenu() } } -BOOL LLFolderBridge::checkFolderForContentsOfType(LLInventoryModel* model, LLInventoryCollectFunctor& is_type) +bool LLFolderBridge::checkFolderForContentsOfType(LLInventoryModel* model, LLInventoryCollectFunctor& is_type) { LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t item_array; @@ -4229,7 +4221,7 @@ BOOL LLFolderBridge::checkFolderForContentsOfType(LLInventoryModel* model, LLInv item_array, LLInventoryModel::EXCLUDE_TRASH, is_type); - return ((item_array.size() > 0) ? TRUE : FALSE ); + return !item_array.empty(); } void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items, menuentry_vec_t& disabled_items) @@ -4401,12 +4393,12 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items } //Added by aura to force inventory pull on right-click to display folder options correctly. 07-17-06 - mCallingCards = mWearables = FALSE; + mCallingCards = mWearables = false; LLIsType is_callingcard(LLAssetType::AT_CALLINGCARD); if (checkFolderForContentsOfType(model, is_callingcard)) { - mCallingCards=TRUE; + mCallingCards=true; } LLFindWearables is_wearable; @@ -4417,7 +4409,7 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items checkFolderForContentsOfType(model, is_object) || checkFolderForContentsOfType(model, is_gesture) ) { - mWearables=TRUE; + mWearables=true; } } else @@ -4438,7 +4430,7 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items checkFolderForContentsOfType(model, is_object) || checkFolderForContentsOfType(model, is_gesture)) { - mWearables = TRUE; + mWearables = true; } if (!is_system_folder) @@ -4647,13 +4639,13 @@ void LLFolderBridge::addOpenFolderMenuOptions(U32 flags, menuentry_vec_t& items) bool LLFolderBridge::hasChildren() const { LLInventoryModel* model = getInventoryModel(); - if(!model) return FALSE; + if(!model) return false; LLInventoryModel::EHasChildren has_children; has_children = gInventory.categoryHasChildren(mUUID); return has_children != LLInventoryModel::CHILDREN_NO; } -BOOL LLFolderBridge::dragOrDrop(MASK mask, BOOL drop, +bool LLFolderBridge::dragOrDrop(MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, std::string& tooltip_msg) @@ -4673,7 +4665,7 @@ BOOL LLFolderBridge::dragOrDrop(MASK mask, BOOL drop, //LL_INFOS() << "LLFolderBridge::dragOrDrop()" << LL_ENDL; - BOOL accept = FALSE; + bool accept = false; switch(cargo_type) { case DAD_TEXTURE: @@ -4690,7 +4682,7 @@ BOOL LLFolderBridge::dragOrDrop(MASK mask, BOOL drop, case DAD_MESH: case DAD_SETTINGS: case DAD_MATERIAL: - accept = dragItemIntoFolder(inv_item, drop, tooltip_msg, TRUE, drop_cb); + accept = dragItemIntoFolder(inv_item, drop, tooltip_msg, true, drop_cb); break; case DAD_LINK: // DAD_LINK type might mean one of two asset types: AT_LINK or AT_LINK_FOLDER. @@ -4701,22 +4693,22 @@ BOOL LLFolderBridge::dragOrDrop(MASK mask, BOOL drop, LLInventoryCategory* linked_category = gInventory.getCategory(inv_item->getLinkedUUID()); if (linked_category) { - accept = dragCategoryIntoFolder((LLInventoryCategory*)linked_category, drop, tooltip_msg, TRUE, TRUE, drop_cb); + accept = dragCategoryIntoFolder((LLInventoryCategory*)linked_category, drop, tooltip_msg, true, true, drop_cb); } } else { - accept = dragItemIntoFolder(inv_item, drop, tooltip_msg, TRUE, drop_cb); + accept = dragItemIntoFolder(inv_item, drop, tooltip_msg, true, drop_cb); } break; case DAD_CATEGORY: if (LLFriendCardsManager::instance().isAnyFriendCategory(mUUID)) { - accept = FALSE; + accept = false; } else { - accept = dragCategoryIntoFolder((LLInventoryCategory*)cargo_data, drop, tooltip_msg, FALSE, TRUE, drop_cb); + accept = dragCategoryIntoFolder((LLInventoryCategory*)cargo_data, drop, tooltip_msg, false, true, drop_cb); } break; case DAD_ROOT_CATEGORY: @@ -4844,7 +4836,7 @@ void LLFolderBridge::createWearable(LLFolderBridge* bridge, LLWearableType::ETyp LLAgentWearables::createWearable(type, false, parent_id); } -void LLFolderBridge::modifyOutfit(BOOL append) +void LLFolderBridge::modifyOutfit(bool append) { LLInventoryModel* model = getInventoryModel(); if(!model) return; @@ -4872,12 +4864,12 @@ void LLFolderBridge::modifyOutfit(BOOL append) if (isAgentInventory()) { - LLAppearanceMgr::instance().wearInventoryCategory(cat, FALSE, append); + LLAppearanceMgr::instance().wearInventoryCategory(cat, false, append); } else { // Library, we need to copy content first - LLAppearanceMgr::instance().wearInventoryCategory(cat, TRUE, append); + LLAppearanceMgr::instance().wearInventoryCategory(cat, true, append); } } @@ -5084,15 +5076,15 @@ LLFolderBridge(inventory, root, uuid) LLUIImagePtr LLMarketplaceFolderBridge::getIcon() const { - return getMarketplaceFolderIcon(FALSE); + return getMarketplaceFolderIcon(false); } LLUIImagePtr LLMarketplaceFolderBridge::getIconOpen() const { - return getMarketplaceFolderIcon(TRUE); + return getMarketplaceFolderIcon(true); } -LLUIImagePtr LLMarketplaceFolderBridge::getMarketplaceFolderIcon(BOOL is_open) const +LLUIImagePtr LLMarketplaceFolderBridge::getMarketplaceFolderIcon(bool is_open) const { LLFolderType::EType preferred_type = getPreferredType(); if (!LLMarketplaceData::instance().isUpdating(getUUID())) @@ -5194,7 +5186,7 @@ bool move_task_inventory_callback(const LLSD& notification, const LLSD& response { LLInventoryObject::object_list_t inventory_objects; object->getInventoryContents(inventory_objects); - int contents_count = inventory_objects.size(); + int contents_count = static_cast<int>(inventory_objects.size()); LLInventoryCopyAndWearObserver* inventoryObserver = new LLInventoryCopyAndWearObserver(cat_and_wear->mCatID, contents_count, cat_and_wear->mFolderResponded, cat_and_wear->mReplace); @@ -5232,8 +5224,8 @@ LLFolderBridge::LLFolderBridge(LLInventoryPanel* inventory, LLFolderView* root, const LLUUID& uuid) : LLInvFVBridge(inventory, root, uuid) - , mCallingCards(FALSE) - , mWearables(FALSE) + , mCallingCards(false) + , mWearables(false) , mIsLoading(false) , mShowDescendantsCount(false) , mCanDeleteFolderState(CDS_DONE) @@ -5277,7 +5269,7 @@ void LLFolderBridge::dropToFavorites(LLInventoryItem* inv_item, LLPointer<LLInve callback); } -void LLFolderBridge::dropToOutfit(LLInventoryItem* inv_item, BOOL move_is_into_current_outfit, LLPointer<LLInventoryCallback> cb) +void LLFolderBridge::dropToOutfit(LLInventoryItem* inv_item, bool move_is_into_current_outfit, LLPointer<LLInventoryCallback> cb) { if((inv_item->getInventoryType() == LLInventoryType::IT_TEXTURE) || (inv_item->getInventoryType() == LLInventoryType::IT_SNAPSHOT)) { @@ -5373,7 +5365,7 @@ void LLFolderBridge::callback_dropItemIntoFolder(const LLSD& notification, const if (option == 0) // YES { std::string tooltip_msg; - dragItemIntoFolder(inv_item, TRUE, tooltip_msg, FALSE); + dragItemIntoFolder(inv_item, true, tooltip_msg, false); } } @@ -5384,24 +5376,24 @@ void LLFolderBridge::callback_dropCategoryIntoFolder(const LLSD& notification, c if (option == 0) // YES { std::string tooltip_msg; - dragCategoryIntoFolder(inv_category, TRUE, tooltip_msg, FALSE, FALSE); + dragCategoryIntoFolder(inv_category, true, tooltip_msg, false, false); } } // This is used both for testing whether an item can be dropped // into the folder, as well as performing the actual drop, depending -// if drop == TRUE. -BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, - BOOL drop, +// if drop == true. +bool LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, + bool drop, std::string& tooltip_msg, - BOOL user_confirm, + bool user_confirm, LLPointer<LLInventoryCallback> cb) { LLInventoryModel* model = getInventoryModel(); - if (!model || !inv_item) return FALSE; - if (!isAgentInventory()) return FALSE; // cannot drag into library - if (!isAgentAvatarValid()) return FALSE; + if (!model || !inv_item) return false; + if (!isAgentInventory()) return false; // cannot drag into library + if (!isAgentAvatarValid()) return false; LLInventoryPanel* destination_panel = mInventoryPanel.get(); if (!destination_panel) return false; @@ -5416,33 +5408,33 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, const LLUUID &my_outifts_id = model->findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); const LLUUID from_folder_uuid = inv_item->getParentUUID(); - const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id); - const BOOL move_is_into_favorites = (mUUID == favorites_id); - const BOOL move_is_into_my_outfits = (mUUID == my_outifts_id) || model->isObjectDescendentOf(mUUID, my_outifts_id); - const BOOL move_is_into_outfit = move_is_into_my_outfits || (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); - const BOOL move_is_into_landmarks = (mUUID == landmarks_id) || model->isObjectDescendentOf(mUUID, landmarks_id); - const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); - const BOOL move_is_from_marketplacelistings = model->isObjectDescendentOf(inv_item->getUUID(), marketplacelistings_id); + const bool move_is_into_current_outfit = (mUUID == current_outfit_id); + const bool move_is_into_favorites = (mUUID == favorites_id); + const bool move_is_into_my_outfits = (mUUID == my_outifts_id) || model->isObjectDescendentOf(mUUID, my_outifts_id); + const bool move_is_into_outfit = move_is_into_my_outfits || (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); + const bool move_is_into_landmarks = (mUUID == landmarks_id) || model->isObjectDescendentOf(mUUID, landmarks_id); + const bool move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); + const bool move_is_from_marketplacelistings = model->isObjectDescendentOf(inv_item->getUUID(), marketplacelistings_id); LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource(); - BOOL accept = FALSE; + bool accept = false; U64 filter_types = filter->getFilterTypes(); // We shouldn't allow to drop non recent items into recent tab (or some similar transactions) // while we are allowing to interact with regular filtered inventory - BOOL use_filter = filter_types && (filter_types&LLInventoryFilter::FILTERTYPE_DATE || (filter_types&LLInventoryFilter::FILTERTYPE_OBJECT)==0); + bool use_filter = filter_types && (filter_types&LLInventoryFilter::FILTERTYPE_DATE || (filter_types&LLInventoryFilter::FILTERTYPE_OBJECT)==0); LLViewerObject* object = NULL; if(LLToolDragAndDrop::SOURCE_AGENT == source) { const LLUUID &trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); - const BOOL move_is_into_trash = (mUUID == trash_id) || model->isObjectDescendentOf(mUUID, trash_id); - const BOOL move_is_outof_current_outfit = LLAppearanceMgr::instance().getIsInCOF(inv_item->getUUID()); + const bool move_is_into_trash = (mUUID == trash_id) || model->isObjectDescendentOf(mUUID, trash_id); + const bool move_is_outof_current_outfit = LLAppearanceMgr::instance().getIsInCOF(inv_item->getUUID()); //-------------------------------------------------------------------------------- // Determine if item can be moved. // - BOOL is_movable = TRUE; + bool is_movable = true; switch (inv_item->getActualType()) { @@ -5455,7 +5447,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, // Can't explicitly drag things out of the COF. if (move_is_outof_current_outfit) { - is_movable = FALSE; + is_movable = false; } if (move_is_into_trash) { @@ -5478,15 +5470,15 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, // Determine if item can be moved & dropped // Note: if user_confirm is false, we already went through those accept logic test and can skip them - accept = TRUE; + accept = true; if (user_confirm && !is_movable) { - accept = FALSE; + accept = false; } else if (user_confirm && (mUUID == inv_item->getParentUUID()) && !move_is_into_favorites) { - accept = FALSE; + accept = false; } else if (user_confirm && (move_is_into_current_outfit || move_is_into_outfit)) { @@ -5510,7 +5502,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, accept = dest_folder->acceptItem(inv_item); } - LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE); + LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(false); // Check whether the item being dragged from active inventory panel // passes the filter of the destination panel. @@ -5639,26 +5631,26 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, if (!object) { LL_INFOS() << "Object not found for drop." << LL_ENDL; - return FALSE; + return false; } // coming from a task. Need to figure out if the person can // move/copy this item. LLPermissions perm(inv_item->getPermissions()); - BOOL is_move = FALSE; + bool is_move = false; if ((perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID()) && perm.allowTransferTo(gAgent.getID()))) // || gAgent.isGodlike()) { - accept = TRUE; + accept = true; } else if(object->permYouOwner()) { // If the object cannot be copied, but the object the // inventory is owned by the agent, then the item can be // moved from the task to agent inventory. - is_move = TRUE; - accept = TRUE; + is_move = true; + accept = true; } // Don't allow placing an original item into Current Outfit or an outfit folder @@ -5666,19 +5658,19 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, // *TODO: Probably we should create a link to an item if it was dragged to outfit or COF. if (move_is_into_current_outfit || move_is_into_outfit) { - accept = FALSE; + accept = false; } // Don't allow to move a single item to Favorites or Landmarks // if it is not a landmark or a link to a landmark. else if ((move_is_into_favorites || move_is_into_landmarks) && !can_move_to_landmarks(inv_item)) { - accept = FALSE; + accept = false; } else if (move_is_into_marketplacelistings) { tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory"); - accept = FALSE; + accept = false; } // Check whether the item being dragged from in world @@ -5721,12 +5713,12 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, if (move_is_into_marketplacelistings) { tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory"); - accept = FALSE; + accept = false; } else if ((inv_item->getActualType() == LLAssetType::AT_SETTINGS) && !LLEnvironment::instance().isInventoryEnabled()) { tooltip_msg = LLTrans::getString("NoEnvironmentSettings"); - accept = FALSE; + accept = false; } else { @@ -5755,12 +5747,12 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, LLViewerInventoryItem* item = (LLViewerInventoryItem*)inv_item; if(item && item->isFinished()) { - accept = TRUE; + accept = true; if (move_is_into_marketplacelistings) { tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory"); - accept = FALSE; + accept = false; } else if (move_is_into_current_outfit || move_is_into_outfit) { @@ -5773,7 +5765,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, accept = can_move_to_landmarks(inv_item); } - LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE); + LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(false); // Check whether the item being dragged from the library // passes the filter of the destination panel. @@ -5835,10 +5827,10 @@ bool check_category(LLInventoryModel* model, LLInventoryModel::cat_array_t descendent_categories; LLInventoryModel::item_array_t descendent_items; - model->collectDescendents(cat_id, descendent_categories, descendent_items, TRUE); + model->collectDescendents(cat_id, descendent_categories, descendent_items, true); - S32 num_descendent_categories = descendent_categories.size(); - S32 num_descendent_items = descendent_items.size(); + auto num_descendent_categories = descendent_categories.size(); + auto num_descendent_items = descendent_items.size(); if (num_descendent_categories + num_descendent_items == 0) { @@ -5848,7 +5840,7 @@ bool check_category(LLInventoryModel* model, return check_item(cat_id, active_panel, filter); } - for (S32 i = 0; i < num_descendent_categories; ++i) + for (size_t i = 0; i < num_descendent_categories; ++i) { LLInventoryCategory* category = descendent_categories[i]; if(!check_category(model, category->getUUID(), active_panel, filter)) @@ -5857,7 +5849,7 @@ bool check_category(LLInventoryModel* model, } } - for (S32 i = 0; i < num_descendent_items; ++i) + for (size_t i = 0; i < num_descendent_items; ++i) { LLViewerInventoryItem* item = descendent_items[i]; if(!check_item(item->getUUID(), active_panel, filter)) @@ -6082,16 +6074,16 @@ LLLandmarkBridge::LLLandmarkBridge(LLInventoryPanel* inventory, U32 flags/* = 0x00*/) : LLItemBridge(inventory, root, uuid) { - mVisited = FALSE; + mVisited = false; if (flags & LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED) { - mVisited = TRUE; + mVisited = true; } } LLUIImagePtr LLLandmarkBridge::getIcon() const { - return LLInventoryIcon::getIcon(LLAssetType::AT_LANDMARK, LLInventoryType::IT_LANDMARK, mVisited, FALSE); + return LLInventoryIcon::getIcon(LLAssetType::AT_LANDMARK, LLInventoryType::IT_LANDMARK, mVisited, false); } void LLLandmarkBridge::buildContextMenu(LLMenuGL& menu, U32 flags) @@ -6271,8 +6263,8 @@ void LLCallingCardBridge::checkSearchBySuffixChanges() // changes in mDisplayName are processed by rename function and here it will be always same // suffixes are also of fixed length, and we are processing change of one at a time, // so it should be safe to use length (note: mSearchableName is capitalized) - S32 old_length = mSearchableName.length(); - S32 new_length = mDisplayName.length() + getLabelSuffix().length(); + auto old_length = mSearchableName.length(); + auto new_length = mDisplayName.length() + getLabelSuffix().length(); if (old_length == new_length) { return; @@ -6348,13 +6340,13 @@ void LLCallingCardBridge::performAction(LLInventoryModel* model, std::string act LLUIImagePtr LLCallingCardBridge::getIcon() const { - BOOL online = FALSE; + bool online = false; LLViewerInventoryItem* item = getItem(); if(item) { online = LLAvatarTracker::instance().isBuddyOnline(item->getCreatorUUID()); } - return LLInventoryIcon::getIcon(LLAssetType::AT_CALLINGCARD, LLInventoryType::IT_CALLINGCARD, online, FALSE); + return LLInventoryIcon::getIcon(LLAssetType::AT_CALLINGCARD, LLInventoryType::IT_CALLINGCARD, online, false); } std::string LLCallingCardBridge::getLabelSuffix() const @@ -6420,10 +6412,10 @@ void LLCallingCardBridge::buildContextMenu(LLMenuGL& menu, U32 flags) getClipboardEntries(true, items, disabled_items, flags); LLInventoryItem* item = getItem(); - BOOL good_card = (item + bool good_card = (item && (LLUUID::null != item->getCreatorUUID()) && (item->getCreatorUUID() != gAgent.getID())); - BOOL user_online = FALSE; + bool user_online = false; if (item) { user_online = (LLAvatarTracker::instance().isBuddyOnline(item->getCreatorUUID())); @@ -6449,13 +6441,13 @@ void LLCallingCardBridge::buildContextMenu(LLMenuGL& menu, U32 flags) hide_context_entries(menu, items, disabled_items); } -BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop, +bool LLCallingCardBridge::dragOrDrop(MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, std::string& tooltip_msg) { LLViewerInventoryItem* item = getItem(); - BOOL rv = FALSE; + bool rv = false; if(item) { // check the type @@ -6480,7 +6472,7 @@ BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop, if(gInventory.getItem(inv_item->getUUID()) && perm.allowOperationBy(PERM_TRANSFER, gAgent.getID())) { - rv = TRUE; + rv = true; if(drop) { LLGiveInventory::doGiveInventoryItem(item->getCreatorUUID(), @@ -6492,7 +6484,7 @@ BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop, // It's not in the user's inventory (it's probably in // an object's contents), so disallow dragging it here. // You can't give something you don't yet have. - rv = FALSE; + rv = false; } break; } @@ -6501,7 +6493,7 @@ BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop, LLInventoryCategory* inv_cat = (LLInventoryCategory*)cargo_data; if( gInventory.getCategory( inv_cat->getUUID() ) ) { - rv = TRUE; + rv = true; if(drop) { LLGiveInventory::doGiveInventoryCategory( @@ -6514,7 +6506,7 @@ BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop, // It's not in the user's inventory (it's probably in // an object's contents), so disallow dragging it here. // You can't give something you don't yet have. - rv = FALSE; + rv = false; } break; } @@ -6619,8 +6611,8 @@ void LLGestureBridge::performAction(LLInventoryModel* model, std::string action) if(!LLGestureMgr::instance().isGestureActive(mUUID)) { // we need to inform server about gesture activating to be consistent with LLPreviewGesture and LLGestureComboList. - BOOL inform_server = TRUE; - BOOL deactivate_similar = FALSE; + bool inform_server = true; + bool deactivate_similar = false; LLGestureMgr::instance().setGestureLoadedCallback(mUUID, boost::bind(&LLGestureBridge::playGesture, mUUID)); LLViewerInventoryItem* item = gInventory.getItem(mUUID); llassert(item); @@ -6650,19 +6642,19 @@ void LLGestureBridge::openItem() if (item) { LLPreviewGesture* preview = LLPreviewGesture::show(mUUID, LLUUID::null); - preview->setFocus(TRUE); + preview->setFocus(true); } */ } -BOOL LLGestureBridge::removeItem() +bool LLGestureBridge::removeItem() { // Grab class information locally since *this may be deleted // within this function. Not a great pattern... const LLInventoryModel* model = getInventoryModel(); if(!model) { - return FALSE; + return false; } const LLUUID item_id = mUUID; @@ -6673,7 +6665,7 @@ BOOL LLGestureBridge::removeItem() // If deactivateGesture deleted *this, then return out immediately. if (!model->getObject(item_id)) { - return TRUE; + return true; } return LLItemBridge::removeItem(); @@ -6836,7 +6828,7 @@ LLObjectBridge::LLObjectBridge(LLInventoryPanel* inventory, LLItemBridge(inventory, root, uuid) { mAttachPt = (flags & 0xff); // low bye of inventory flags - mIsMultiObject = ( flags & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS ) ? TRUE: FALSE; + mIsMultiObject = is_flag_set(flags, LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS); mInvType = type; } @@ -7018,7 +7010,7 @@ bool confirm_attachment_rez(const LLSD& notification, const LLSD& response) // attachments are batched up all into one message versus each attachment // being sent in its own separate attachments message. U8 attachment_pt = notification["payload"]["attachment_point"].asInteger(); - BOOL is_add = notification["payload"]["is_add"].asBoolean(); + bool is_add = notification["payload"]["is_add"].asBoolean(); LL_DEBUGS("Avatar") << "ATT calling addAttachmentRequest " << (itemp ? itemp->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL; LLAttachmentsMgr::instance().addAttachmentRequest(item_id, attachment_pt, is_add); @@ -7096,8 +7088,8 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) disabled_items.push_back(std::string("Attach To")); disabled_items.push_back(std::string("Attach To HUD")); } - LLMenuGL* attach_menu = menu.findChildMenuByName("Attach To", TRUE); - LLMenuGL* attach_hud_menu = menu.findChildMenuByName("Attach To HUD", TRUE); + LLMenuGL* attach_menu = menu.findChildMenuByName("Attach To", true); + LLMenuGL* attach_hud_menu = menu.findChildMenuByName("Attach To HUD", true); if (attach_menu && (attach_menu->getChildCount() == 0) && attach_hud_menu @@ -7138,20 +7130,20 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) hide_context_entries(menu, items, disabled_items); } -BOOL LLObjectBridge::renameItem(const std::string& new_name) +bool LLObjectBridge::renameItem(const std::string& new_name) { if(!isItemRenameable()) - return FALSE; + return false; LLPreview::dirty(mUUID); LLInventoryModel* model = getInventoryModel(); if(!model) - return FALSE; + return false; LLViewerInventoryItem* item = getItem(); if(item && (item->getName() != new_name)) { LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); new_item->rename(new_name); - new_item->updateServer(FALSE); + new_item->updateServer(false); model->updateItem(new_item); model->notifyObservers(); buildDisplayName(); @@ -7162,15 +7154,15 @@ BOOL LLObjectBridge::renameItem(const std::string& new_name) if(obj) { LLSelectMgr::getInstance()->deselectAll(); - LLSelectMgr::getInstance()->addAsIndividual( obj, SELECT_ALL_TES, FALSE ); + LLSelectMgr::getInstance()->addAsIndividual( obj, SELECT_ALL_TES, false ); LLSelectMgr::getInstance()->selectionSetObjectName( new_name ); LLSelectMgr::getInstance()->deselectAll(); } } } - // return FALSE because we either notified observers (& therefore + // return false because we either notified observers (& therefore // rebuilt) or we didn't update. - return FALSE; + return false; } // +=================================================+ @@ -7204,7 +7196,7 @@ LLWearableBridge::LLWearableBridge(LLInventoryPanel* inventory, mInvType = inv_type; } -BOOL LLWearableBridge::renameItem(const std::string& new_name) +bool LLWearableBridge::renameItem(const std::string& new_name) { if (get_is_item_worn(mUUID)) { @@ -7228,7 +7220,7 @@ std::string LLWearableBridge::getLabelSuffix() const LLUIImagePtr LLWearableBridge::getIcon() const { - return LLInventoryIcon::getIcon(mAssetType, mInvType, mWearableType, FALSE); + return LLInventoryIcon::getIcon(mAssetType, mInvType, mWearableType, false); } // virtual @@ -7278,7 +7270,7 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } else { // FWIW, it looks like SUPPRESS_OPEN_ITEM is not set anywhere - BOOL can_open = ((flags & SUPPRESS_OPEN_ITEM) != SUPPRESS_OPEN_ITEM); + bool can_open = ((flags & SUPPRESS_OPEN_ITEM) != SUPPRESS_OPEN_ITEM); // If we have clothing, don't add "Open" as it's the same action as "Wear" SL-18976 LLViewerInventoryItem* item = getItem(); @@ -7289,7 +7281,7 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } if (isLinkedObjectMissing()) { - can_open = FALSE; + can_open = false; } items.push_back(std::string("Share")); if (!canShare()) @@ -7367,14 +7359,14 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) // Called from menus // static -BOOL LLWearableBridge::canWearOnAvatar(void* user_data) +bool LLWearableBridge::canWearOnAvatar(void* user_data) { LLWearableBridge* self = (LLWearableBridge*)user_data; - if(!self) return FALSE; + if(!self) return false; if(!self->isAgentInventory()) { LLViewerInventoryItem* item = (LLViewerInventoryItem*)self->getItem(); - if(!item || !item->isFinished()) return FALSE; + if(!item || !item->isFinished()) return false; } return (!get_is_item_worn(self->mUUID)); } @@ -7463,10 +7455,10 @@ void LLWearableBridge::onWearAddOnAvatarArrived( LLViewerWearable* wearable, voi } // static -BOOL LLWearableBridge::canEditOnAvatar(void* user_data) +bool LLWearableBridge::canEditOnAvatar(void* user_data) { LLWearableBridge* self = (LLWearableBridge*)user_data; - if(!self) return FALSE; + if(!self) return false; return (get_is_item_worn(self->mUUID)); } @@ -7487,14 +7479,14 @@ void LLWearableBridge::editOnAvatar() } // static -BOOL LLWearableBridge::canRemoveFromAvatar(void* user_data) +bool LLWearableBridge::canRemoveFromAvatar(void* user_data) { LLWearableBridge* self = (LLWearableBridge*)user_data; if( self && (LLAssetType::AT_BODYPART != self->mAssetType) ) { return get_is_item_worn( self->mUUID ); } - return FALSE; + return false; } void LLWearableBridge::removeFromAvatar() @@ -7552,7 +7544,7 @@ LLSettingsBridge::LLSettingsBridge(LLInventoryPanel* inventory, LLUIImagePtr LLSettingsBridge::getIcon() const { - return LLInventoryIcon::getIcon(LLAssetType::AT_SETTINGS, LLInventoryType::IT_SETTINGS, mSettingsType, FALSE); + return LLInventoryIcon::getIcon(LLAssetType::AT_SETTINGS, LLInventoryType::IT_SETTINGS, mSettingsType, false); } void LLSettingsBridge::performAction(LLInventoryModel* model, std::string action) @@ -7658,20 +7650,20 @@ void LLSettingsBridge::buildContextMenu(LLMenuGL& menu, U32 flags) hide_context_entries(menu, items, disabled_items); } -BOOL LLSettingsBridge::renameItem(const std::string& new_name) +bool LLSettingsBridge::renameItem(const std::string& new_name) { /*TODO: change internal settings name? */ return LLItemBridge::renameItem(new_name); } -BOOL LLSettingsBridge::isItemRenameable() const +bool LLSettingsBridge::isItemRenameable() const { LLViewerInventoryItem* item = getItem(); if (item) { return (item->getPermissions().allowModifyBy(gAgent.getID())); } - return FALSE; + return false; } bool LLSettingsBridge::canUpdateParcel() const @@ -7780,7 +7772,7 @@ void LLLinkFolderBridge::gotoItem() LLFolderViewItem *base_folder = LLInventoryPanel::getActiveInventoryPanel()->getItemByID(cat_uuid); if (base_folder) { - base_folder->setOpen(TRUE); + base_folder->setOpen(true); } } } @@ -7967,7 +7959,7 @@ public: if (item) { LLPreviewGesture* preview = LLPreviewGesture::show(mUUID, LLUUID::null); - preview->setFocus(TRUE); + preview->setFocus(true); } LLInvFVBridgeAction::doIt(); } @@ -8050,24 +8042,24 @@ public: virtual ~LLWearableBridgeAction(){} protected: LLWearableBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {} - BOOL isItemInTrash() const; + bool isItemInTrash() const; // return true if the item is in agent inventory. if false, it // must be lost or in the inventory library. - BOOL isAgentInventory() const; + bool isAgentInventory() const; void wearOnAvatar(); }; -BOOL LLWearableBridgeAction::isItemInTrash() const +bool LLWearableBridgeAction::isItemInTrash() const { - if(!mModel) return FALSE; + if(!mModel) return false; const LLUUID trash_id = mModel->findCategoryUUIDForType(LLFolderType::FT_TRASH); return mModel->isObjectDescendentOf(mUUID, trash_id); } -BOOL LLWearableBridgeAction::isAgentInventory() const +bool LLWearableBridgeAction::isAgentInventory() const { - if(!mModel) return FALSE; - if(gInventory.getRootFolderID() == mUUID) return TRUE; + if(!mModel) return false; + if(gInventory.getRootFolderID() == mUUID) return true; return mModel->isObjectDescendentOf(mUUID, gInventory.getRootFolderID()); } diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 70a457f98c..3e7f74384b 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -111,35 +111,35 @@ public: virtual void closeItem() {} virtual void navigateToFolder(bool new_window = false, bool change_mode = false); virtual void showProperties(); - virtual BOOL isItemRenameable() const { return TRUE; } - virtual BOOL isMultiPreviewAllowed() { return TRUE; } - //virtual BOOL renameItem(const std::string& new_name) {} - virtual BOOL isItemRemovable(bool check_worn = true) const; - virtual BOOL isItemMovable() const; - virtual BOOL isItemInTrash() const; + virtual bool isItemRenameable() const { return true; } + virtual bool isMultiPreviewAllowed() { return true; } + //virtual bool renameItem(const std::string& new_name) {} + virtual bool isItemRemovable(bool check_worn = true) const; + virtual bool isItemMovable() const; + virtual bool isItemInTrash() const; virtual bool isItemInOutfits() const; - virtual BOOL isLink() const; - virtual BOOL isLibraryItem() const; - //virtual BOOL removeItem() = 0; + virtual bool isLink() const; + virtual bool isLibraryItem() const; + //virtual bool removeItem() = 0; virtual void removeBatch(std::vector<LLFolderViewModelItem*>& batch); virtual void move(LLFolderViewModelItem* new_parent_bridge) {} virtual bool isItemCopyable(bool can_copy_as_link = true) const { return false; } - virtual BOOL copyToClipboard() const; - virtual BOOL cutToClipboard(); + virtual bool copyToClipboard() const; + virtual bool cutToClipboard(); virtual bool isCutToClipboard(); - virtual BOOL isClipboardPasteable() const; - virtual BOOL isClipboardPasteableAsLink() const; + virtual bool isClipboardPasteable() const; + virtual bool isClipboardPasteableAsLink() const; virtual void pasteFromClipboard() {} virtual void pasteLinkFromClipboard() {} void getClipboardEntries(bool show_asset_id, menuentry_vec_t &items, menuentry_vec_t &disabled_items, U32 flags); virtual void buildContextMenu(LLMenuGL& menu, U32 flags); virtual LLToolDragAndDrop::ESource getDragSource() const; - virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const; - virtual BOOL dragOrDrop(MASK mask, BOOL drop, + virtual bool startDrag(EDragAndDropType* type, LLUUID* id) const; + virtual bool dragOrDrop(MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, - std::string& tooltip_msg) { return FALSE; } + std::string& tooltip_msg) { return false; } virtual LLInventoryType::EType getInventoryType() const { return mInvType; } virtual LLWearableType::EType getWearableType() const { return LLWearableType::WT_NONE; } virtual LLSettingsType::type_e getSettingsType() const { return LLSettingsType::ST_NONE; } @@ -171,28 +171,28 @@ protected: LLInventoryModel* getInventoryModel() const; LLInventoryFilter* getInventoryFilter() const; - BOOL isLinkedObjectInTrash() const; // Is this obj or its baseobj in the trash? - BOOL isLinkedObjectMissing() const; // Is this a linked obj whose baseobj is not in inventory? + bool isLinkedObjectInTrash() const; // Is this obj or its baseobj in the trash? + bool isLinkedObjectMissing() const; // Is this a linked obj whose baseobj is not in inventory? - BOOL isAgentInventory() const; // false if lost or in the inventory library - BOOL isCOFFolder() const; // true if COF or descendant of - BOOL isInboxFolder() const; // true if COF or descendant of marketplace inbox + bool isAgentInventory() const; // false if lost or in the inventory library + bool isCOFFolder() const; // true if COF or descendant of + bool isInboxFolder() const; // true if COF or descendant of marketplace inbox - BOOL isMarketplaceListingsFolder() const; // true if descendant of Marketplace listings folder + bool isMarketplaceListingsFolder() const; // true if descendant of Marketplace listings folder - virtual BOOL isItemPermissive() const; + virtual bool isItemPermissive() const; static void changeItemParent(LLInventoryModel* model, LLViewerInventoryItem* item, const LLUUID& new_parent, - BOOL restamp); + bool restamp); static void changeCategoryParent(LLInventoryModel* model, LLViewerInventoryCategory* item, const LLUUID& new_parent, - BOOL restamp); + bool restamp); void removeBatchNoCheck(std::vector<LLFolderViewModelItem*>& batch); - BOOL callback_cutToClipboard(const LLSD& notification, const LLSD& response); - BOOL perform_cutToClipboard(); + bool callback_cutToClipboard(const LLSD& notification, const LLSD& response); + bool perform_cutToClipboard(); LLHandle<LLInventoryPanel> mInventoryPanel; LLFolderView* mRoot; @@ -249,20 +249,20 @@ public: virtual LLFontGL::StyleFlags getLabelStyle() const; virtual PermissionMask getPermissionMask() const; virtual time_t getCreationDate() const; - virtual BOOL isItemRenameable() const; - virtual BOOL renameItem(const std::string& new_name); - virtual BOOL removeItem(); + virtual bool isItemRenameable() const; + virtual bool renameItem(const std::string& new_name); + virtual bool removeItem(); virtual bool isItemCopyable(bool can_copy_as_link = true) const; - virtual bool hasChildren() const { return FALSE; } - virtual BOOL isUpToDate() const { return TRUE; } + virtual bool hasChildren() const { return false; } + virtual bool isUpToDate() const { return true; } virtual LLUIImagePtr getIconOverlay() const; LLViewerInventoryItem* getItem() const; virtual const LLUUID& getThumbnailUUID() const; protected: - BOOL confirmRemoveItem(const LLSD& notification, const LLSD& response); - virtual BOOL isItemPermissive() const; + bool confirmRemoveItem(const LLSD& notification, const LLSD& response); + virtual bool isItemPermissive() const; virtual void buildDisplayName() const; void doActionOnCurSelectedLandmark(LLLandmarkList::loaded_callback_t cb); @@ -279,8 +279,8 @@ public: ~LLFolderBridge(); - BOOL dragItemIntoFolder(LLInventoryItem* inv_item, BOOL drop, std::string& tooltip_msg, BOOL user_confirm = TRUE, LLPointer<LLInventoryCallback> cb = NULL); - BOOL dragCategoryIntoFolder(LLInventoryCategory* inv_category, BOOL drop, std::string& tooltip_msg, BOOL is_link = FALSE, BOOL user_confirm = TRUE, LLPointer<LLInventoryCallback> cb = NULL); + bool dragItemIntoFolder(LLInventoryItem* inv_item, bool drop, std::string& tooltip_msg, bool user_confirm = true, LLPointer<LLInventoryCallback> cb = NULL); + bool dragCategoryIntoFolder(LLInventoryCategory* inv_category, bool drop, std::string& tooltip_msg, bool is_link = false, bool user_confirm = true, LLPointer<LLInventoryCallback> cb = NULL); void callback_dropItemIntoFolder(const LLSD& notification, const LLSD& response, LLInventoryItem* inv_item); void callback_dropCategoryIntoFolder(const LLSD& notification, const LLSD& response, LLInventoryCategory* inv_category); @@ -289,7 +289,7 @@ public: virtual void performAction(LLInventoryModel* model, std::string action); virtual void openItem(); virtual void closeItem(); - virtual BOOL isItemRenameable() const; + virtual bool isItemRenameable() const; virtual void selectItem(); virtual void restoreItem(); @@ -304,10 +304,10 @@ public: void setShowDescendantsCount(bool show_count) {mShowDescendantsCount = show_count;} - virtual BOOL renameItem(const std::string& new_name); + virtual bool renameItem(const std::string& new_name); - virtual BOOL removeItem(); - BOOL removeSystemFolder(); + virtual bool removeItem(); + bool removeSystemFolder(); bool removeItemResponse(const LLSD& notification, const LLSD& response); void updateHierarchyCreationDate(time_t date); @@ -315,17 +315,17 @@ public: virtual void pasteLinkFromClipboard(); virtual void buildContextMenu(LLMenuGL& menu, U32 flags); virtual bool hasChildren() const; - virtual BOOL dragOrDrop(MASK mask, BOOL drop, + virtual bool dragOrDrop(MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, std::string& tooltip_msg); - virtual BOOL isItemRemovable(bool check_worn = true) const; - virtual BOOL isItemMovable() const ; - virtual BOOL isUpToDate() const; + virtual bool isItemRemovable(bool check_worn = true) const; + virtual bool isItemMovable() const ; + virtual bool isUpToDate() const; virtual bool isItemCopyable(bool can_copy_as_link = true) const; - virtual BOOL isClipboardPasteable() const; - virtual BOOL isClipboardPasteableAsLink() const; + virtual bool isClipboardPasteable() const; + virtual bool isClipboardPasteableAsLink() const; EInventorySortGroup getSortGroup() const; virtual void update(); @@ -360,14 +360,14 @@ protected: static void createNewHair(void* user_data); static void createNewEyes(void* user_data); - BOOL checkFolderForContentsOfType(LLInventoryModel* model, LLInventoryCollectFunctor& typeToCheck); + bool checkFolderForContentsOfType(LLInventoryModel* model, LLInventoryCollectFunctor& typeToCheck); - void modifyOutfit(BOOL append); + void modifyOutfit(bool append); void copyOutfitToClipboard(); void determineFolderType(); void dropToFavorites(LLInventoryItem* inv_item, LLPointer<LLInventoryCallback> cb = NULL); - void dropToOutfit(LLInventoryItem* inv_item, BOOL move_is_into_current_outfit, LLPointer<LLInventoryCallback> cb = NULL); + void dropToOutfit(LLInventoryItem* inv_item, bool move_is_into_current_outfit, LLPointer<LLInventoryCallback> cb = NULL); void dropToMyOutfits(LLInventoryCategory* inv_cat, LLPointer<LLInventoryCallback> cb = NULL); //-------------------------------------------------------------------- @@ -385,7 +385,7 @@ protected: void callback_pasteFromClipboard(const LLSD& notification, const LLSD& response); void perform_pasteFromClipboard(); void gatherMessage(std::string& message, S32 depth, LLError::ELevel log_level); - LLUIImagePtr getFolderIcon(BOOL is_open) const; + LLUIImagePtr getFolderIcon(bool is_open) const; bool mCallingCards; bool mWearables; @@ -467,7 +467,7 @@ public: virtual LLUIImagePtr getIcon() const; virtual void openItem(); protected: - BOOL mVisited; + bool mVisited; }; class LLCallingCardBridge : public LLItemBridge @@ -483,7 +483,7 @@ public: virtual void performAction(LLInventoryModel* model, std::string action); virtual void openItem(); virtual void buildContextMenu(LLMenuGL& menu, U32 flags); - virtual BOOL dragOrDrop(MASK mask, BOOL drop, + virtual bool dragOrDrop(MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, std::string& tooltip_msg); @@ -518,7 +518,7 @@ public: virtual std::string getLabelSuffix() const; virtual void performAction(LLInventoryModel* model, std::string action); virtual void openItem(); - virtual BOOL removeItem(); + virtual bool removeItem(); virtual void buildContextMenu(LLMenuGL& menu, U32 flags); static void playGesture(const LLUUID& item_id); }; @@ -546,17 +546,17 @@ public: virtual LLUIImagePtr getIcon() const; virtual void performAction(LLInventoryModel* model, std::string action); virtual void openItem(); - virtual BOOL isItemWearable() const { return TRUE; } + virtual bool isItemWearable() const { return true; } virtual std::string getLabelSuffix() const; virtual void buildContextMenu(LLMenuGL& menu, U32 flags); - virtual BOOL renameItem(const std::string& new_name); + virtual bool renameItem(const std::string& new_name); LLInventoryObject* getObject() const; LLViewerInventoryItem* getItem() const; LLViewerInventoryCategory* getCategory() const; protected: static LLUUID sContextMenuItemID; // Only valid while the context menu is open. U32 mAttachPt; - BOOL mIsMultiObject; + bool mIsMultiObject; }; class LLLSLTextBridge : public LLItemBridge @@ -581,26 +581,25 @@ public: virtual LLUIImagePtr getIcon() const; virtual void performAction(LLInventoryModel* model, std::string action); virtual void openItem(); - virtual BOOL isItemWearable() const { return TRUE; } + virtual bool isItemWearable() const { return true; } virtual void buildContextMenu(LLMenuGL& menu, U32 flags); virtual std::string getLabelSuffix() const; - virtual BOOL renameItem(const std::string& new_name); + virtual bool renameItem(const std::string& new_name); virtual LLWearableType::EType getWearableType() const { return mWearableType; } static void onWearOnAvatar( void* userdata ); // Access to wearOnAvatar() from menu - static BOOL canWearOnAvatar( void* userdata ); + static bool canWearOnAvatar( void* userdata ); static void onWearOnAvatarArrived( LLViewerWearable* wearable, void* userdata ); void wearOnAvatar(); static void onWearAddOnAvatarArrived( LLViewerWearable* wearable, void* userdata ); void wearAddOnAvatar(); - static BOOL canEditOnAvatar( void* userdata ); // Access to editOnAvatar() from menu + static bool canEditOnAvatar( void* userdata ); // Access to editOnAvatar() from menu static void onEditOnAvatar( void* userdata ); void editOnAvatar(); - static BOOL canRemoveFromAvatar( void* userdata ); - static void removeAllClothesFromAvatar(); + static bool canRemoveFromAvatar( void* userdata ); void removeFromAvatar(); protected: LLAssetType::EType mAssetType; @@ -659,10 +658,10 @@ public: virtual LLUIImagePtr getIcon() const; virtual void performAction(LLInventoryModel* model, std::string action); virtual void openItem(); - virtual BOOL isMultiPreviewAllowed() { return FALSE; } + virtual bool isMultiPreviewAllowed() { return false; } virtual void buildContextMenu(LLMenuGL& menu, U32 flags); - virtual BOOL renameItem(const std::string& new_name); - virtual BOOL isItemRenameable() const; + virtual bool renameItem(const std::string& new_name); + virtual bool isItemRenameable() const; virtual LLSettingsType::type_e getSettingsType() const { return mSettingsType; } protected: @@ -772,7 +771,7 @@ public: virtual LLFontGL::StyleFlags getLabelStyle() const; private: - LLUIImagePtr getMarketplaceFolderIcon(BOOL is_open) const; + LLUIImagePtr getMarketplaceFolderIcon(bool is_open) const; // Those members are mutable because they are cached variablse to speed up display, not a state variables mutable S32 m_depth; mutable S32 m_stockCountCache; @@ -785,9 +784,9 @@ void rez_attachment(LLViewerInventoryItem* item, // Move items from an in-world object's "Contents" folder to a specified // folder in agent inventory. -BOOL move_inv_category_world_to_agent(const LLUUID& object_id, +bool move_inv_category_world_to_agent(const LLUUID& object_id, const LLUUID& category_id, - BOOL drop, + bool drop, std::function<void(S32, void*, const LLMoveInv *)> callback = NULL, void* user_data = NULL, LLInventoryFilter* filter = NULL); diff --git a/indra/newview/llinventoryclipboard.cpp b/indra/newview/llinventoryclipboard.cpp deleted file mode 100644 index d21e4da880..0000000000 --- a/indra/newview/llinventoryclipboard.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/** - * @file llinventoryclipboard.cpp - * @brief LLInventoryClipboard class implementation - * - * $LicenseInfo:firstyear=2002&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 "llviewerprecompiledheaders.h" - -#include "llinventoryclipboard.h" - - -LLInventoryClipboard LLInventoryClipboard::sInstance; - -///---------------------------------------------------------------------------- -/// Local function declarations, constants, enums, and typedefs -///---------------------------------------------------------------------------- - - -///---------------------------------------------------------------------------- -/// Class LLInventoryClipboard -///---------------------------------------------------------------------------- - -LLInventoryClipboard::LLInventoryClipboard() -: mCutMode(false) -{ -} - -LLInventoryClipboard::~LLInventoryClipboard() -{ - reset(); -} - -void LLInventoryClipboard::add(const LLUUID& object) -{ - mObjects.put(object); -} - -// this stores a single inventory object -void LLInventoryClipboard::store(const LLUUID& object) -{ - reset(); - mObjects.put(object); -} - -void LLInventoryClipboard::store(const LLDynamicArray<LLUUID>& inv_objects) -{ - reset(); - S32 count = inv_objects.count(); - for(S32 i = 0; i < count; i++) - { - mObjects.put(inv_objects[i]); - } -} - -void LLInventoryClipboard::cut(const LLUUID& object) -{ - if(!mCutMode && !mObjects.empty()) - { - //looks like there are some stored items, reset clipboard state - reset(); - } - mCutMode = true; - add(object); -} -void LLInventoryClipboard::retrieve(LLDynamicArray<LLUUID>& inv_objects) const -{ - inv_objects.reset(); - S32 count = mObjects.count(); - for(S32 i = 0; i < count; i++) - { - inv_objects.put(mObjects[i]); - } -} - -void LLInventoryClipboard::reset() -{ - mObjects.reset(); - mCutMode = false; -} - -// returns true if the clipboard has something pasteable in it. -BOOL LLInventoryClipboard::hasContents() const -{ - return (mObjects.count() > 0); -} - - -///---------------------------------------------------------------------------- -/// Local function definitions -///---------------------------------------------------------------------------- diff --git a/indra/newview/llinventoryclipboard.h b/indra/newview/llinventoryclipboard.h deleted file mode 100644 index 487325d070..0000000000 --- a/indra/newview/llinventoryclipboard.h +++ /dev/null @@ -1,86 +0,0 @@ -/** - * @file llinventoryclipboard.h - * @brief LLInventoryClipboard class header file - * - * $LicenseInfo:firstyear=2002&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_LLINVENTORYCLIPBOARD_H -#define LL_LLINVENTORYCLIPBOARD_H - -#include "lldarray.h" -#include "lluuid.h" - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLInventoryClipboard -// -// This class is used to cut/copy/paste inventory items around the -// world. This class is accessed through a singleton (only one -// inventory clipboard for now) which can be referenced using the -// instance() method. -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -class LLInventoryClipboard -{ -public: - // calling this before main() is undefined - static LLInventoryClipboard& instance() { return sInstance; } - - // this method adds to the current list. - void add(const LLUUID& object); - - // this stores a single inventory object - void store(const LLUUID& object); - - // this method stores an array of objects - void store(const LLDynamicArray<LLUUID>& inventory_objects); - - void cut(const LLUUID& object); - // this method gets the objects in the clipboard by copying them - // into the array provided. - void retrieve(LLDynamicArray<LLUUID>& inventory_objects) const; - - // this method empties out the clipboard - void reset(); - - // returns true if the clipboard has something pasteable in it. - BOOL hasContents() const; - bool isCutMode() const { return mCutMode; } - -protected: - static LLInventoryClipboard sInstance; - - LLDynamicArray<LLUUID> mObjects; - bool mCutMode; - -public: - // please don't actually call these - LLInventoryClipboard(); - ~LLInventoryClipboard(); -private: - // please don't implement these - LLInventoryClipboard(const LLInventoryClipboard&); - LLInventoryClipboard& operator=(const LLInventoryClipboard&); -}; - - -#endif // LL_LLINVENTORYCLIPBOARD_H diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index b9ce90ff7b..114ccfdd3f 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -96,7 +96,7 @@ bool LLInventoryFilter::check(const LLFolderViewModelItem* item) const LLFolderViewModelItemInventory* listener = dynamic_cast<const LLFolderViewModelItemInventory*>(item); // If it's a folder and we're showing all folders, return automatically. - const BOOL is_folder = listener->getInventoryType() == LLInventoryType::IT_CATEGORY; + const bool is_folder = listener->getInventoryType() == LLInventoryType::IT_CATEGORY; if (is_folder && (mFilterOps.mShowFolderState == LLInventoryFilter::SHOW_ALL_FOLDERS)) { return true; @@ -297,7 +297,7 @@ bool LLInventoryFilter::checkFolder(const LLUUID& folder_id) const bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInventory* listener) const { - if (!listener) return FALSE; + if (!listener) return false; LLInventoryType::EType object_type = listener->getInventoryType(); const LLUUID object_id = listener->getUUID(); @@ -316,7 +316,7 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInvent // If it has no type, pass it, unless it's a link. if (object && object->getIsLinkType()) { - return FALSE; + return false; } break; case LLInventoryType::IT_UNKNOWN: @@ -325,14 +325,14 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInvent // Unknows are 255 and won't fit in 64 bits. if (mFilterOps.mFilterObjectTypes != 0xffffffffffffffffULL) { - return FALSE; + return false; } break; } default: if ((1LL << object_type & mFilterOps.mFilterObjectTypes) == U64(0)) { - return FALSE; + return false; } break; } @@ -342,7 +342,7 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInvent { if (!get_is_item_worn(object_id)) { - return FALSE; + return false; } } @@ -351,10 +351,10 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInvent // Pass if this item is the target UUID or if it links to the target UUID if (filterTypes & FILTERTYPE_UUID) { - if (!object) return FALSE; + if (!object) return false; if (object->getLinkedUUID() != mFilterOps.mFilterUUID) - return FALSE; + return false; } //////////////////////////////////////////////////////////////////////////////// @@ -378,13 +378,13 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInvent { if (listener->getCreationDate() < earliest || listener->getCreationDate() > mFilterOps.mMaxDate) - return FALSE; + return false; } else { if (listener->getCreationDate() > earliest || listener->getCreationDate() > mFilterOps.mMaxDate) - return FALSE; + return false; } } @@ -397,7 +397,7 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInvent if ((object_type == LLInventoryType::IT_WEARABLE) && (((0x1LL << type) & mFilterOps.mFilterWearableTypes) == 0)) { - return FALSE; + return false; } } @@ -410,7 +410,7 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInvent if ((object_type == LLInventoryType::IT_SETTINGS) && (((0x1LL << type) & mFilterOps.mFilterSettingsTypes) == 0)) { - return FALSE; + return false; } } @@ -434,20 +434,20 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInvent LLInventoryModel::cat_array_t* cat_array = NULL; LLInventoryModel::item_array_t* item_array = NULL; gInventory.getDirectDescendentsOf(object_id,cat_array,item_array); - S32 descendents_actual = 0; + size_t descendents_actual = 0; if(cat_array && item_array) { descendents_actual = cat_array->size() + item_array->size(); } if (descendents_actual == 0) { - return FALSE; + return false; } } } } - return TRUE; + return true; } bool LLInventoryFilter::checkAgainstFilterType(const LLInventoryItem* item) const @@ -467,7 +467,7 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLInventoryItem* item) cons // If it has no type, pass it, unless it's a link. if (item && item->getIsLinkType()) { - return FALSE; + return false; } break; case LLInventoryType::IT_UNKNOWN: @@ -476,14 +476,14 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLInventoryItem* item) cons // Unknows are 255 and won't fit in 64 bits. if (mFilterOps.mFilterObjectTypes != 0xffffffffffffffffULL) { - return FALSE; + return false; } break; } default: if ((1LL << object_type & mFilterOps.mFilterObjectTypes) == U64(0)) { - return FALSE; + return false; } break; } @@ -540,7 +540,7 @@ bool LLInventoryFilter::checkAgainstClipboard(const LLUUID& object_id) const bool LLInventoryFilter::checkAgainstPermissions(const LLFolderViewModelItemInventory* listener) const { - if (!listener) return FALSE; + if (!listener) return false; PermissionMask perm = listener->getPermissionMask(); const LLInvFVBridge *bridge = dynamic_cast<const LLInvFVBridge *>(listener); @@ -567,18 +567,18 @@ bool LLInventoryFilter::checkAgainstPermissions(const LLInventoryItem* item) con bool LLInventoryFilter::checkAgainstFilterLinks(const LLFolderViewModelItemInventory* listener) const { - if (!listener) return TRUE; + if (!listener) return true; const LLUUID object_id = listener->getUUID(); const LLInventoryObject *object = gInventory.getObject(object_id); - if (!object) return TRUE; + if (!object) return true; - const BOOL is_link = object->getIsLinkType(); + const bool is_link = object->getIsLinkType(); if (is_link && (mFilterOps.mFilterLinks == FILTERLINK_EXCLUDE_LINKS)) - return FALSE; + return false; if (!is_link && (mFilterOps.mFilterLinks == FILTERLINK_ONLY_LINKS)) - return FALSE; - return TRUE; + return false; + return true; } bool LLInventoryFilter::checkAgainstFilterThumbnails(const LLUUID& object_id) const @@ -596,47 +596,47 @@ bool LLInventoryFilter::checkAgainstFilterThumbnails(const LLUUID& object_id) co bool LLInventoryFilter::checkAgainstCreator(const LLFolderViewModelItemInventory* listener) const { - if (!listener) return TRUE; - const BOOL is_folder = listener->getInventoryType() == LLInventoryType::IT_CATEGORY; + if (!listener) return true; + const bool is_folder = listener->getInventoryType() == LLInventoryType::IT_CATEGORY; switch (mFilterOps.mFilterCreatorType) { case FILTERCREATOR_SELF: - if(is_folder) return FALSE; + if(is_folder) return false; return (listener->getSearchableCreatorName() == mUsername); case FILTERCREATOR_OTHERS: - if(is_folder) return FALSE; + if(is_folder) return false; return (listener->getSearchableCreatorName() != mUsername); case FILTERCREATOR_ALL: default: - return TRUE; + return true; } } bool LLInventoryFilter::checkAgainstSearchVisibility(const LLFolderViewModelItemInventory* listener) const { - if (!listener || !hasFilterString()) return TRUE; + if (!listener || !hasFilterString()) return true; const LLUUID object_id = listener->getUUID(); const LLInventoryObject *object = gInventory.getObject(object_id); - if (!object) return TRUE; + if (!object) return true; - const BOOL is_link = object->getIsLinkType(); + const bool is_link = object->getIsLinkType(); if (is_link && ((mFilterOps.mSearchVisibility & VISIBILITY_LINKS) == 0)) - return FALSE; + return false; if (listener->isItemInOutfits() && ((mFilterOps.mSearchVisibility & VISIBILITY_OUTFITS) == 0)) - return FALSE; + return false; if (listener->isItemInTrash() && ((mFilterOps.mSearchVisibility & VISIBILITY_TRASH) == 0)) - return FALSE; + return false; if (!listener->isAgentInventory() && ((mFilterOps.mSearchVisibility & VISIBILITY_LIBRARY) == 0)) - return FALSE; + return false; - return TRUE; + return true; } -const std::string& LLInventoryFilter::getFilterSubString(BOOL trim) const +const std::string& LLInventoryFilter::getFilterSubString(bool trim) const { return mFilterSubString; } @@ -964,11 +964,11 @@ void LLInventoryFilter::setFilterSubString(const std::string& string) } // hitting BACKSPACE, for example - const BOOL less_restrictive = mFilterSubString.size() >= filter_sub_string_new.size() + const bool less_restrictive = mFilterSubString.size() >= filter_sub_string_new.size() && !mFilterSubString.substr(0, filter_sub_string_new.size()).compare(filter_sub_string_new); // appending new characters - const BOOL more_restrictive = mFilterSubString.size() < filter_sub_string_new.size() + const bool more_restrictive = mFilterSubString.size() < filter_sub_string_new.size() && !filter_sub_string_new.substr(0, mFilterSubString.size()).compare(mFilterSubString); mFilterSubString = filter_sub_string_new; @@ -1019,8 +1019,8 @@ void LLInventoryFilter::setSearchVisibilityTypes(U32 types) if (mFilterOps.mSearchVisibility != types) { // keep current items only if no perm bits getting turned off - BOOL fewer_bits_set = (mFilterOps.mSearchVisibility & ~types); - BOOL more_bits_set = (~mFilterOps.mSearchVisibility & types); + bool fewer_bits_set = (mFilterOps.mSearchVisibility & ~types); + bool more_bits_set = (~mFilterOps.mSearchVisibility & types); mFilterOps.mSearchVisibility = types; if (more_bits_set && fewer_bits_set) @@ -1057,8 +1057,8 @@ void LLInventoryFilter::setFilterPermissions(PermissionMask perms) if (mFilterOps.mPermissions != perms) { // keep current items only if no perm bits getting turned off - BOOL fewer_bits_set = (mFilterOps.mPermissions & ~perms); - BOOL more_bits_set = (~mFilterOps.mPermissions & perms); + bool fewer_bits_set = (mFilterOps.mPermissions & ~perms); + bool more_bits_set = (~mFilterOps.mPermissions & perms); mFilterOps.mPermissions = perms; if (more_bits_set && fewer_bits_set) @@ -1101,7 +1101,7 @@ void LLInventoryFilter::setDateRange(time_t min_date, time_t max_date) } } -void LLInventoryFilter::setDateRangeLastLogoff(BOOL sl) +void LLInventoryFilter::setDateRangeLastLogoff(bool sl) { static LLCachedControl<U32> s_last_logoff(gSavedPerAccountSettings, "LastLogoff", 0); if (sl && !isSinceLogoff()) @@ -1150,8 +1150,8 @@ void LLInventoryFilter::setHoursAgo(U32 hours) bool is_increasing_from_zero = is_increasing && !mFilterOps.mHoursAgo && !isSinceLogoff(); // *NOTE: need to cache last filter time, in case filter goes stale - BOOL less_restrictive; - BOOL more_restrictive; + bool less_restrictive; + bool more_restrictive; if (FILTERDATEDIRECTION_NEWER == mFilterOps.mDateSearchDirection) { less_restrictive = ((are_date_limits_valid && ((is_increasing && mFilterOps.mHoursAgo))) || !hours); @@ -1314,8 +1314,8 @@ const std::string& LLInventoryFilter::getFilterText() std::string filtered_types; std::string not_filtered_types; - BOOL filtered_by_type = FALSE; - BOOL filtered_by_all_types = TRUE; + bool filtered_by_type = false; + bool filtered_by_all_types = true; S32 num_filter_types = 0; mFilterText.clear(); @@ -1323,158 +1323,158 @@ const std::string& LLInventoryFilter::getFilterText() if (isFilterObjectTypesWith(LLInventoryType::IT_ANIMATION)) { filtered_types += LLTrans::getString("Animations"); - filtered_by_type = TRUE; + filtered_by_type = true; num_filter_types++; } else { not_filtered_types += LLTrans::getString("Animations"); - filtered_by_all_types = FALSE; + filtered_by_all_types = false; } if (isFilterObjectTypesWith(LLInventoryType::IT_CALLINGCARD)) { filtered_types += LLTrans::getString("Calling Cards"); - filtered_by_type = TRUE; + filtered_by_type = true; num_filter_types++; } else { not_filtered_types += LLTrans::getString("Calling Cards"); - filtered_by_all_types = FALSE; + filtered_by_all_types = false; } if (isFilterObjectTypesWith(LLInventoryType::IT_WEARABLE)) { filtered_types += LLTrans::getString("Clothing"); - filtered_by_type = TRUE; + filtered_by_type = true; num_filter_types++; } else { not_filtered_types += LLTrans::getString("Clothing"); - filtered_by_all_types = FALSE; + filtered_by_all_types = false; } if (isFilterObjectTypesWith(LLInventoryType::IT_GESTURE)) { filtered_types += LLTrans::getString("Gestures"); - filtered_by_type = TRUE; + filtered_by_type = true; num_filter_types++; } else { not_filtered_types += LLTrans::getString("Gestures"); - filtered_by_all_types = FALSE; + filtered_by_all_types = false; } if (isFilterObjectTypesWith(LLInventoryType::IT_LANDMARK)) { filtered_types += LLTrans::getString("Landmarks"); - filtered_by_type = TRUE; + filtered_by_type = true; num_filter_types++; } else { not_filtered_types += LLTrans::getString("Landmarks"); - filtered_by_all_types = FALSE; + filtered_by_all_types = false; } if (isFilterObjectTypesWith(LLInventoryType::IT_MATERIAL)) { filtered_types += LLTrans::getString("Materials"); - filtered_by_type = TRUE; + filtered_by_type = true; num_filter_types++; } else { not_filtered_types += LLTrans::getString("Materials"); - filtered_by_all_types = FALSE; + filtered_by_all_types = false; } if (isFilterObjectTypesWith(LLInventoryType::IT_NOTECARD)) { filtered_types += LLTrans::getString("Notecards"); - filtered_by_type = TRUE; + filtered_by_type = true; num_filter_types++; } else { not_filtered_types += LLTrans::getString("Notecards"); - filtered_by_all_types = FALSE; + filtered_by_all_types = false; } if (isFilterObjectTypesWith(LLInventoryType::IT_OBJECT) && isFilterObjectTypesWith(LLInventoryType::IT_ATTACHMENT)) { filtered_types += LLTrans::getString("Objects"); - filtered_by_type = TRUE; + filtered_by_type = true; num_filter_types++; } else { not_filtered_types += LLTrans::getString("Objects"); - filtered_by_all_types = FALSE; + filtered_by_all_types = false; } if (isFilterObjectTypesWith(LLInventoryType::IT_LSL)) { filtered_types += LLTrans::getString("Scripts"); - filtered_by_type = TRUE; + filtered_by_type = true; num_filter_types++; } else { not_filtered_types += LLTrans::getString("Scripts"); - filtered_by_all_types = FALSE; + filtered_by_all_types = false; } if (isFilterObjectTypesWith(LLInventoryType::IT_SOUND)) { filtered_types += LLTrans::getString("Sounds"); - filtered_by_type = TRUE; + filtered_by_type = true; num_filter_types++; } else { not_filtered_types += LLTrans::getString("Sounds"); - filtered_by_all_types = FALSE; + filtered_by_all_types = false; } if (isFilterObjectTypesWith(LLInventoryType::IT_TEXTURE)) { filtered_types += LLTrans::getString("Textures"); - filtered_by_type = TRUE; + filtered_by_type = true; num_filter_types++; } else { not_filtered_types += LLTrans::getString("Textures"); - filtered_by_all_types = FALSE; + filtered_by_all_types = false; } if (isFilterObjectTypesWith(LLInventoryType::IT_SNAPSHOT)) { filtered_types += LLTrans::getString("Snapshots"); - filtered_by_type = TRUE; + filtered_by_type = true; num_filter_types++; } else { not_filtered_types += LLTrans::getString("Snapshots"); - filtered_by_all_types = FALSE; + filtered_by_all_types = false; } if (isFilterObjectTypesWith(LLInventoryType::IT_SETTINGS)) { filtered_types += LLTrans::getString("Settings"); - filtered_by_type = TRUE; + filtered_by_type = true; num_filter_types++; } else { not_filtered_types += LLTrans::getString("Settings"); - filtered_by_all_types = FALSE; + filtered_by_all_types = false; } if (!LLInventoryModelBackgroundFetch::instance().folderFetchActive() diff --git a/indra/newview/llinventoryfilter.h b/indra/newview/llinventoryfilter.h index e45375deca..7203c6f743 100644 --- a/indra/newview/llinventoryfilter.h +++ b/indra/newview/llinventoryfilter.h @@ -247,7 +247,7 @@ public: void setSearchVisibilityTypes(const Params& params); void setFilterSubString(const std::string& string); - const std::string& getFilterSubString(BOOL trim = FALSE) const; + const std::string& getFilterSubString(bool trim = false) const; const std::string& getFilterSubStringOrig() const { return mFilterSubStringOrig; } bool hasFilterString() const; @@ -257,7 +257,7 @@ public: PermissionMask getFilterPermissions() const; void setDateRange(time_t min_date, time_t max_date); - void setDateRangeLastLogoff(BOOL sl); + void setDateRangeLastLogoff(bool sl); time_t getMinDate() const; time_t getMaxDate() const; diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 016b0880eb..8471b2cea1 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -91,7 +91,7 @@ #include "llvoavatarself.h" #include "llwearablelist.h" -BOOL LLInventoryState::sWearNewClothing = FALSE; +bool LLInventoryState::sWearNewClothing = false; LLUUID LLInventoryState::sWearNewClothingTransactionID; std::list<LLUUID> LLInventoryAction::sMarketplaceFolders; bool LLInventoryAction::sDeleteConfirmationDisplayed = false; @@ -156,7 +156,7 @@ S32 count_descendants_items(const LLUUID& cat_id) LLInventoryModel::item_array_t* item_array; gInventory.getDirectDescendentsOf(cat_id,cat_array,item_array); - S32 count = item_array->size(); + S32 count = static_cast<S32>(item_array->size()); LLInventoryModel::cat_array_t cat_array_copy = *cat_array; for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++) @@ -553,12 +553,12 @@ public: } }; -BOOL get_is_parent_to_worn_item(const LLUUID& id) +bool get_is_parent_to_worn_item(const LLUUID& id) { const LLViewerInventoryCategory* cat = gInventory.getCategory(id); if (!cat) { - return FALSE; + return false; } LLInventoryModel::cat_array_t cats; @@ -585,7 +585,7 @@ BOOL get_is_parent_to_worn_item(const LLUUID& id) if (cat == parent_cat) { - return TRUE; + return true; } parent_id = parent_cat->getParentUUID(); @@ -593,23 +593,23 @@ BOOL get_is_parent_to_worn_item(const LLUUID& id) } } - return FALSE; + return false; } -BOOL get_is_item_worn(const LLUUID& id, const LLViewerInventoryItem* item) +bool get_is_item_worn(const LLUUID& id, const LLViewerInventoryItem* item) { if (!item) - return FALSE; + return false; if (item->getIsLinkType() && !gInventory.getItem(item->getLinkedUUID())) { - return FALSE; + return false; } // Consider the item as worn if it has links in COF. if (LLAppearanceMgr::instance().isLinkedInCOF(id)) { - return TRUE; + return true; } switch(item->getType()) @@ -617,55 +617,55 @@ BOOL get_is_item_worn(const LLUUID& id, const LLViewerInventoryItem* item) case LLAssetType::AT_OBJECT: { if (isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item->getLinkedUUID())) - return TRUE; + return true; break; } case LLAssetType::AT_BODYPART: case LLAssetType::AT_CLOTHING: if(gAgentWearables.isWearingItem(item->getLinkedUUID())) - return TRUE; + return true; break; case LLAssetType::AT_GESTURE: if (LLGestureMgr::instance().isGestureActive(item->getLinkedUUID())) - return TRUE; + return true; break; default: break; } - return FALSE; + return false; } -BOOL get_is_item_worn(const LLUUID& id) +bool get_is_item_worn(const LLUUID& id) { const LLViewerInventoryItem* item = gInventory.getItem(id); return get_is_item_worn(id, item); } -BOOL get_is_item_worn(const LLViewerInventoryItem* item) +bool get_is_item_worn(const LLViewerInventoryItem* item) { if (!item) { - return FALSE; + return false; } return get_is_item_worn(item->getUUID(), item); } -BOOL get_can_item_be_worn(const LLUUID& id) +bool get_can_item_be_worn(const LLUUID& id) { const LLViewerInventoryItem* item = gInventory.getItem(id); if (!item) - return FALSE; + return false; if (LLAppearanceMgr::instance().isLinkedInCOF(item->getLinkedUUID())) { // an item having links in COF (i.e. a worn item) - return FALSE; + return false; } if (gInventory.isObjectDescendentOf(id, LLAppearanceMgr::instance().getCOF())) { // a non-link object in COF (should not normally happen) - return FALSE; + return false; } const LLUUID trash_id = gInventory.findCategoryUUIDForType( @@ -685,12 +685,12 @@ BOOL get_can_item_be_worn(const LLUUID& id) if (isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item->getLinkedUUID())) { // Already being worn - return FALSE; + return false; } else { // Not being worn yet. - return TRUE; + return true; } break; } @@ -699,18 +699,18 @@ BOOL get_can_item_be_worn(const LLUUID& id) if(gAgentWearables.isWearingItem(item->getLinkedUUID())) { // Already being worn - return FALSE; + return false; } else { // Not being worn yet. - return TRUE; + return true; } break; default: break; } - return FALSE; + return false; } bool get_is_item_removable(const LLInventoryModel* model, const LLUUID& id, bool check_worn) @@ -792,7 +792,7 @@ void handle_item_edit(const LLUUID& inv_item_id) } } -BOOL get_is_category_removable(const LLInventoryModel* model, const LLUUID& id) +bool get_is_category_removable(const LLInventoryModel* model, const LLUUID& id) { // NOTE: This function doesn't check the folder's children. // See LLFolderBridge::isItemRemovable for a function that does @@ -800,27 +800,27 @@ BOOL get_is_category_removable(const LLInventoryModel* model, const LLUUID& id) if (!model) { - return FALSE; + return false; } if (!model->isObjectDescendentOf(id, gInventory.getRootFolderID())) { - return FALSE; + return false; } - if (!isAgentAvatarValid()) return FALSE; + if (!isAgentAvatarValid()) return false; const LLInventoryCategory* category = model->getCategory(id); if (!category) { - return FALSE; + return false; } const LLFolderType::EType folder_type = category->getPreferredType(); if (LLFolderType::lookupIsProtectedType(folder_type)) { - return FALSE; + return false; } // Can't delete the outfit that is currently being worn. @@ -829,11 +829,11 @@ BOOL get_is_category_removable(const LLInventoryModel* model, const LLUUID& id) const LLViewerInventoryItem *base_outfit_link = LLAppearanceMgr::instance().getBaseOutfitLink(); if (base_outfit_link && (category == base_outfit_link->getLinkedCategory())) { - return FALSE; + return false; } } - return TRUE; + return true; } bool get_is_category_and_children_removable(LLInventoryModel* model, const LLUUID& folder_id, bool check_worn) @@ -898,11 +898,11 @@ bool get_is_category_and_children_removable(LLInventoryModel* model, const LLUUI return true; } -BOOL get_is_category_renameable(const LLInventoryModel* model, const LLUUID& id) +bool get_is_category_renameable(const LLInventoryModel* model, const LLUUID& id) { if (!model) { - return FALSE; + return false; } LLViewerInventoryCategory* cat = model->getCategory(id); @@ -910,9 +910,9 @@ BOOL get_is_category_renameable(const LLInventoryModel* model, const LLUUID& id) if (cat && !LLFolderType::lookupIsProtectedType(cat->getPreferredType()) && cat->getOwnerID() == gAgent.getID()) { - return TRUE; + return true; } - return FALSE; + return false; } void show_task_item_profile(const LLUUID& item_uuid, const LLUUID& object_id) @@ -1098,7 +1098,7 @@ S32 compute_stock_count(LLUUID cat_uuid, bool force_count /* false */) LLInventoryModel::cat_array_t* cat_array; LLInventoryModel::item_array_t* item_array; gInventory.getDirectDescendentsOf(cat_uuid,cat_array,item_array); - return item_array->size(); + return static_cast<S32>(item_array->size()); } // When force_count is true, we do not do any verification of the marketplace status and simply compute @@ -1327,12 +1327,12 @@ bool can_move_item_to_marketplace(const LLInventoryCategory* root_folder, LLInve if (accept) { // If the dest folder is a stock folder, we do not count the incoming items toward the total (stock items are seen as one) - int existing_item_count = (move_in_stock ? 0 : bundle_size); + unsigned int existing_item_count = (move_in_stock ? 0 : bundle_size); // If the dest folder is a stock folder, we do assume that the incoming items are also stock items (they should anyway) - int existing_stock_count = (move_in_stock ? bundle_size : 0); + unsigned int existing_stock_count = (move_in_stock ? bundle_size : 0); - int existing_folder_count = 0; + unsigned int existing_folder_count = 0; // Get the version folder: that's where the counts start from const LLViewerInventoryCategory * version_folder = ((root_folder && (root_folder != dest_folder)) ? gInventory.getFirstDescendantOf(root_folder->getUUID(), dest_folder->getUUID()) : NULL); @@ -1348,11 +1348,11 @@ bool can_move_item_to_marketplace(const LLInventoryCategory* root_folder, LLInve LLInventoryModel::cat_array_t existing_categories; LLInventoryModel::item_array_t existing_items; - gInventory.collectDescendents(version_folder->getUUID(), existing_categories, existing_items, FALSE); + gInventory.collectDescendents(version_folder->getUUID(), existing_categories, existing_items, false); existing_item_count += count_copyable_items(existing_items) + count_stock_folders(existing_categories); existing_stock_count += count_stock_items(existing_items); - existing_folder_count += existing_categories.size(); + existing_folder_count += static_cast<S32>(existing_categories.size()); // If the incoming item is a nocopy (stock) item, we need to consider that it will create a stock folder if (!inv_item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID()) && !move_in_stock) @@ -1422,9 +1422,9 @@ bool can_move_folder_to_marketplace(const LLInventoryCategory* root_folder, LLIn { LLInventoryModel::cat_array_t descendent_categories; LLInventoryModel::item_array_t descendent_items; - gInventory.collectDescendents(inv_cat->getUUID(), descendent_categories, descendent_items, FALSE); + gInventory.collectDescendents(inv_cat->getUUID(), descendent_categories, descendent_items, false); - int dragged_folder_count = descendent_categories.size() + bundle_size; // Note: We assume that we're moving a bunch of folders in. That might be wrong... + int dragged_folder_count = static_cast<int>(descendent_categories.size()) + bundle_size; // Note: We assume that we're moving a bunch of folders in. That might be wrong... int dragged_item_count = count_copyable_items(descendent_items) + count_stock_folders(descendent_categories); int dragged_stock_count = count_stock_items(descendent_items); int existing_item_count = 0; @@ -1444,16 +1444,16 @@ bool can_move_folder_to_marketplace(const LLInventoryCategory* root_folder, LLIn // Tally the total number of categories and items inside the root folder LLInventoryModel::cat_array_t existing_categories; LLInventoryModel::item_array_t existing_items; - gInventory.collectDescendents(version_folder->getUUID(), existing_categories, existing_items, FALSE); + gInventory.collectDescendents(version_folder->getUUID(), existing_categories, existing_items, false); - existing_folder_count += existing_categories.size(); + existing_folder_count += static_cast<int>(existing_categories.size()); existing_item_count += count_copyable_items(existing_items) + count_stock_folders(existing_categories); existing_stock_count += count_stock_items(existing_items); } - const int total_folder_count = existing_folder_count + dragged_folder_count; - const int total_item_count = existing_item_count + dragged_item_count; - const int total_stock_count = existing_stock_count + dragged_stock_count; + const unsigned int total_folder_count = existing_folder_count + dragged_folder_count; + const unsigned int total_item_count = existing_item_count + dragged_item_count; + const unsigned int total_stock_count = existing_stock_count + dragged_stock_count; if (total_folder_count > gSavedSettings.getU32("InventoryOutboxMaxFolderCount")) { @@ -1876,7 +1876,7 @@ void validate_marketplacelistings( } // How many types of items? Which type is it if only one? - S32 count = items_vector.size(); + auto count = items_vector.size(); U32 default_key = (U32)(LLInventoryType::IT_COUNT) << 24; // This is the key for any normal copyable item U32 unique_key = (count == 1 ? items_vector.begin()->first : default_key); // The key in the case of one item type only @@ -2159,7 +2159,7 @@ void change_item_parent(const LLUUID& item_id, const LLUUID& new_parent_id) LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(inv_item); new_item->setParent(new_parent_id); - new_item->updateParentOnServer(FALSE); + new_item->updateParentOnServer(false); gInventory.updateItem(new_item); gInventory.notifyObservers(); } @@ -2199,7 +2199,7 @@ void move_items_to_folder(const LLUUID& new_cat_uuid, const uuid_vec_t& selected LLFolderViewItem* fv_folder = sidepanel_inventory->getActivePanel()->getItemByID(new_cat_uuid); if (fv_folder) { - fv_folder->setOpen(TRUE); + fv_folder->setOpen(true); } } } @@ -2263,7 +2263,7 @@ std::string get_category_path(LLUUID cat_id) } } // Returns true if the item can be moved to Current Outfit or any outfit folder. -bool can_move_to_outfit(LLInventoryItem* inv_item, BOOL move_is_into_current_outfit) +bool can_move_to_outfit(LLInventoryItem* inv_item, bool move_is_into_current_outfit) { LLInventoryType::EType inv_type = inv_item->getInventoryType(); if ((inv_type != LLInventoryType::IT_WEARABLE) && @@ -2295,7 +2295,7 @@ bool can_move_to_outfit(LLInventoryItem* inv_item, BOOL move_is_into_current_out return true; } -// Returns TRUE if item is a landmark or a link to a landmark +// Returns true if item is a landmark or a link to a landmark // and can be moved to Favorites or Landmarks folder. bool can_move_to_landmarks(LLInventoryItem* inv_item) { @@ -2629,40 +2629,40 @@ bool LLIsType::operator()(LLInventoryCategory* cat, LLInventoryItem* item) { if(mType == LLAssetType::AT_CATEGORY) { - if(cat) return TRUE; + if(cat) return true; } if(item) { - if(item->getType() == mType) return TRUE; + if(item->getType() == mType) return true; } - return FALSE; + return false; } bool LLIsNotType::operator()(LLInventoryCategory* cat, LLInventoryItem* item) { if(mType == LLAssetType::AT_CATEGORY) { - if(cat) return FALSE; + if(cat) return false; } if(item) { - if(item->getType() == mType) return FALSE; - else return TRUE; + if(item->getType() == mType) return false; + else return true; } - return TRUE; + return true; } bool LLIsOfAssetType::operator()(LLInventoryCategory* cat, LLInventoryItem* item) { if(mType == LLAssetType::AT_CATEGORY) { - if(cat) return TRUE; + if(cat) return true; } if(item) { - if(item->getActualType() == mType) return TRUE; + if(item->getActualType() == mType) return true; } - return FALSE; + return false; } bool LLAssetIDAndTypeMatches::operator()(LLInventoryCategory* cat, LLInventoryItem* item) @@ -2684,7 +2684,7 @@ bool LLIsTypeWithPermissions::operator()(LLInventoryCategory* cat, LLInventoryIt { if(cat) { - return TRUE; + return true; } } if(item) @@ -2694,11 +2694,11 @@ bool LLIsTypeWithPermissions::operator()(LLInventoryCategory* cat, LLInventoryIt LLPermissions perm = item->getPermissions(); if ((perm.getMaskBase() & mPerm) == mPerm) { - return TRUE; + return true; } } } - return FALSE; + return false; } bool LLBuddyCollector::operator()(LLInventoryCategory* cat, @@ -2742,10 +2742,10 @@ bool LLParticularBuddyCollector::operator()(LLInventoryCategory* cat, if((LLAssetType::AT_CALLINGCARD == item->getType()) && (item->getCreatorUUID() == mBuddyID)) { - return TRUE; + return true; } } - return FALSE; + return false; } @@ -2797,9 +2797,9 @@ bool LLFindBrokenLinks::operator()(LLInventoryCategory* cat, // it is linked too if (item && LLAssetType::lookupIsLinkType(item->getType())) { - return TRUE; + return true; } - return FALSE; + return false; } bool LLFindWearables::operator()(LLInventoryCategory* cat, @@ -2810,10 +2810,10 @@ bool LLFindWearables::operator()(LLInventoryCategory* cat, if((item->getType() == LLAssetType::AT_CLOTHING) || (item->getType() == LLAssetType::AT_BODYPART)) { - return TRUE; + return true; } } - return FALSE; + return false; } LLFindWearablesEx::LLFindWearablesEx(bool is_worn, bool include_body_parts) @@ -2905,7 +2905,7 @@ bool LLLinkedItemIDMatches::operator()(LLInventoryCategory* cat, LLInventoryItem (item->getLinkedUUID() == mBaseItemID)); // A linked item's assetID will be the compared-to item's itemID. } -void LLSaveFolderState::setApply(BOOL apply) +void LLSaveFolderState::setApply(bool apply) { mApply = apply; // before generating new list of open folders, clear the old one @@ -2928,7 +2928,7 @@ void LLSaveFolderState::doFolder(LLFolderViewFolder* folder) { if (!folder->isOpen()) { - folder->setOpen(TRUE); + folder->setOpen(true); } } else @@ -2936,7 +2936,7 @@ void LLSaveFolderState::doFolder(LLFolderViewFolder* folder) // keep selected filter in its current state, this is less jarring to user if (!folder->isSelected() && folder->isOpen()) { - folder->setOpen(FALSE); + folder->setOpen(false); } } } @@ -2954,7 +2954,7 @@ void LLOpenFilteredFolders::doItem(LLFolderViewItem *item) { if (item->passedFilter()) { - item->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP); + item->getParentFolder()->setOpenArrangeRecursively(true, LLFolderViewFolder::RECURSE_UP); } } @@ -2962,12 +2962,12 @@ void LLOpenFilteredFolders::doFolder(LLFolderViewFolder* folder) { if (folder->LLFolderViewItem::passedFilter() && folder->getParentFolder()) { - folder->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP); + folder->getParentFolder()->setOpenArrangeRecursively(true, LLFolderViewFolder::RECURSE_UP); } // if this folder didn't pass the filter, and none of its descendants did else if (!folder->getViewModelItem()->passedFilter() && !folder->getViewModelItem()->descendantsPassedFilter()) { - folder->setOpenArrangeRecursively(FALSE, LLFolderViewFolder::RECURSE_NO); + folder->setOpenArrangeRecursively(false, LLFolderViewFolder::RECURSE_NO); } } @@ -2975,12 +2975,12 @@ void LLSelectFirstFilteredItem::doItem(LLFolderViewItem *item) { if (item->passedFilter() && !mItemSelected) { - item->getRoot()->setSelection(item, FALSE, FALSE); + item->getRoot()->setSelection(item, false, false); if (item->getParentFolder()) { - item->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP); + item->getParentFolder()->setOpenArrangeRecursively(true, LLFolderViewFolder::RECURSE_UP); } - mItemSelected = TRUE; + mItemSelected = true; } } @@ -2989,9 +2989,9 @@ void LLSelectFirstFilteredItem::doFolder(LLFolderViewFolder* folder) // Skip if folder or item already found, if not filtered or if no parent (root folder is not selectable) if (!mFolderSelected && !mItemSelected && folder->LLFolderViewItem::passedFilter() && folder->getParentFolder()) { - folder->getRoot()->setSelection(folder, FALSE, FALSE); - folder->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP); - mFolderSelected = TRUE; + folder->getRoot()->setSelection(folder, false, false); + folder->getParentFolder()->setOpenArrangeRecursively(true, LLFolderViewFolder::RECURSE_UP); + mFolderSelected = true; } } @@ -2999,7 +2999,7 @@ void LLOpenFoldersWithSelection::doItem(LLFolderViewItem *item) { if (item->getParentFolder() && item->isSelected()) { - item->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP); + item->getParentFolder()->setOpenArrangeRecursively(true, LLFolderViewFolder::RECURSE_UP); } } @@ -3007,7 +3007,7 @@ void LLOpenFoldersWithSelection::doFolder(LLFolderViewFolder* folder) { if (folder->getParentFolder() && folder->isSelected()) { - folder->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP); + folder->getParentFolder()->setOpenArrangeRecursively(true, LLFolderViewFolder::RECURSE_UP); } } @@ -3017,7 +3017,7 @@ void LLInventoryAction::callback_doToSelected(const LLSD& notification, const LL S32 option = LLNotificationsUtil::getSelectedOption(notification, response); if (option == 0) // YES { - doToSelected(model, root, action, FALSE); + doToSelected(model, root, action, false); } } @@ -3026,11 +3026,11 @@ void LLInventoryAction::callback_copySelected(const LLSD& notification, const LL S32 option = LLNotificationsUtil::getSelectedOption(notification, response); if (option == 0) // YES, Move no copy item(s) { - doToSelected(model, root, "copy_or_move_to_marketplace_listings", FALSE); + doToSelected(model, root, "copy_or_move_to_marketplace_listings", false); } else if (option == 1) // NO, Don't move no copy item(s) (leave them behind) { - doToSelected(model, root, "copy_to_marketplace_listings", FALSE); + doToSelected(model, root, "copy_to_marketplace_listings", false); } } @@ -3063,7 +3063,7 @@ bool get_selection_object_uuids(LLFolderView *root, uuid_vec_t& ids) } -void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root, const std::string& action, BOOL user_confirm) +void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root, const std::string& action, bool user_confirm) { std::set<LLFolderViewItem*> selected_items = root->getSelectionList(); if (selected_items.empty() @@ -3181,7 +3181,7 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root LLInventoryModel::cat_array_t categories; LLInventoryModel::item_array_t items; - gInventory.collectDescendents(obj_id, categories, items, FALSE); + gInventory.collectDescendents(obj_id, categories, items, false); for (LLInventoryModel::item_array_t::value_type& item : items) { @@ -3455,6 +3455,23 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root ungroup_folder_items(*ids.begin()); } } + else if ("thumbnail" == action) + { + if (selected_items.size() > 0) + { + LLSD data; + std::set<LLFolderViewItem*>::iterator set_iter; + for (set_iter = selected_items.begin(); set_iter != selected_items.end(); ++set_iter) + { + LLFolderViewItem* folder_item = *set_iter; + if (!folder_item) continue; + LLInvFVBridge* bridge = (LLInvFVBridge*)folder_item->getViewModelItem(); + if (!bridge) continue; + data.append(bridge->getUUID()); + } + LLFloaterReg::showInstance("change_item_thumbnail", data); + } + } else { std::set<LLFolderViewItem*>::iterator set_iter; @@ -3582,7 +3599,7 @@ void LLInventoryAction::onItemsRemovalConfirmation(const LLSD& notification, con LLInventoryModel::cat_array_t categories; LLInventoryModel::item_array_t items; - gInventory.collectDescendents(obj_id, categories, items, FALSE); + gInventory.collectDescendents(obj_id, categories, items, false); for (LLInventoryModel::item_array_t::value_type& item : items) { diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index 5cb996ad54..a25c0d5ad6 100644 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -43,14 +43,14 @@ const S32 COMPUTE_STOCK_NOT_EVALUATED = -2; **/ // Is this a parent folder to a worn item -BOOL get_is_parent_to_worn_item(const LLUUID& id); +bool get_is_parent_to_worn_item(const LLUUID& id); // Is this item or its baseitem is worn, attached, etc... -BOOL get_is_item_worn(const LLUUID& id); -BOOL get_is_item_worn(const LLViewerInventoryItem* item); +bool get_is_item_worn(const LLUUID& id); +bool get_is_item_worn(const LLViewerInventoryItem* item); // Could this item be worn (correct type + not already being worn) -BOOL get_can_item_be_worn(const LLUUID& id); +bool get_can_item_be_worn(const LLUUID& id); bool get_is_item_removable(const LLInventoryModel* model, const LLUUID& id, bool check_worn); @@ -58,10 +58,10 @@ bool get_is_item_removable(const LLInventoryModel* model, const LLUUID& id, bool bool get_is_item_editable(const LLUUID& inv_item_id); void handle_item_edit(const LLUUID& inv_item_id); -BOOL get_is_category_removable(const LLInventoryModel* model, const LLUUID& id); +bool get_is_category_removable(const LLInventoryModel* model, const LLUUID& id); bool get_is_category_and_children_removable(LLInventoryModel* model, const LLUUID& folder_id, bool check_worn); -BOOL get_is_category_renameable(const LLInventoryModel* model, const LLUUID& id); +bool get_is_category_renameable(const LLInventoryModel* model, const LLUUID& id); void show_item_profile(const LLUUID& item_uuid); void show_task_item_profile(const LLUUID& item_uuid, const LLUUID& object_id); @@ -110,7 +110,7 @@ bool is_only_cats_selected(const uuid_vec_t& selected_uuids); bool is_only_items_selected(const uuid_vec_t& selected_uuids); std::string get_category_path(LLUUID cat_id); -bool can_move_to_outfit(LLInventoryItem* inv_item, BOOL move_is_into_current_outfit); +bool can_move_to_outfit(LLInventoryItem* inv_item, bool move_is_into_current_outfit); bool can_move_to_landmarks(LLInventoryItem* inv_item); bool can_move_to_my_outfits(LLInventoryModel* model, LLInventoryCategory* inv_cat, U32 wear_limit); std::string get_localized_folder_name(LLUUID cat_uuid); @@ -180,7 +180,7 @@ private: // Base class for LLInventoryModel::collectDescendentsIf() method // which accepts an instance of one of these objects to use as the // function to determine if it should be added. Derive from this class -// and override the () operator to return TRUE if you want to collect +// and override the () operator to return true if you want to collect // the category or item passed in. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class LLInventoryCollectFunctor @@ -230,7 +230,7 @@ protected: //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLIsType // -// Implementation of a LLInventoryCollectFunctor which returns TRUE if +// Implementation of a LLInventoryCollectFunctor which returns true if // the type is the type passed in during construction. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -248,7 +248,7 @@ protected: //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLIsNotType // -// Implementation of a LLInventoryCollectFunctor which returns FALSE if the +// Implementation of a LLInventoryCollectFunctor which returns false if the // type is the type passed in during construction, otherwise false. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class LLIsNotType : public LLInventoryCollectFunctor @@ -265,7 +265,7 @@ protected: //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLIsOfAssetType // -// Implementation of a LLInventoryCollectFunctor which returns TRUE if +// Implementation of a LLInventoryCollectFunctor which returns true if // the item or category is of asset type passed in during construction. // Link types are treated as links, not as the types they point to. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -284,7 +284,7 @@ protected: //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLAssetIDAndTypeMatches // -// Implementation of a LLInventoryCollectFunctor which returns TRUE if +// Implementation of a LLInventoryCollectFunctor which returns true if // the item matches both asset type and asset id. // This is needed in case you are looking for a specific type with default id // (since null is default for multiple asset types) @@ -572,13 +572,13 @@ class LLInventoryState { public: // HACK: Until we can route this info through the instant message hierarchy - static BOOL sWearNewClothing; + static bool sWearNewClothing; static LLUUID sWearNewClothingTransactionID; // wear all clothing in this transaction }; struct LLInventoryAction { - static void doToSelected(LLInventoryModel* model, LLFolderView* root, const std::string& action, BOOL user_confirm = TRUE); + static void doToSelected(LLInventoryModel* model, LLFolderView* root, const std::string& action, bool user_confirm = true); static void callback_doToSelected(const LLSD& notification, const LLSD& response, class LLInventoryModel* model, class LLFolderView* root, const std::string& action); static void callback_copySelected(const LLSD& notification, const LLSD& response, class LLInventoryModel* model, class LLFolderView* root, const std::string& action); static void onItemsRemovalConfirmation(const LLSD& notification, const LLSD& response, LLHandle<LLFolderView> root); diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp index 329c0d751a..c69f797868 100644 --- a/indra/newview/llinventorygallery.cpp +++ b/indra/newview/llinventorygallery.cpp @@ -61,18 +61,18 @@ const S32 GALLERY_ITEMS_PER_ROW_MIN = 2; const S32 FAST_LOAD_THUMBNAIL_TRSHOLD = 50; // load folders below this value immediately // Helper dnd functions -BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, BOOL drop, std::string& tooltip_msg, BOOL is_link); -BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, std::string& tooltip_msg, BOOL user_confirm); +bool dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, bool drop, std::string& tooltip_msg, bool is_link); +bool dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, bool drop, std::string& tooltip_msg, bool user_confirm); void dropToMyOutfits(LLInventoryCategory* inv_cat); class LLGalleryPanel: public LLPanel { public: - BOOL canFocusChildren() const override + bool canFocusChildren() const override { // Tell Tab to not focus children - return FALSE; + return false; } protected: @@ -144,7 +144,7 @@ const LLInventoryGallery::Params& LLInventoryGallery::getDefaultParams() return LLUICtrlFactory::getDefaultParams<LLInventoryGallery>(); } -BOOL LLInventoryGallery::postBuild() +bool LLInventoryGallery::postBuild() { mScrollPanel = getChild<LLScrollContainer>("gallery_scroll_panel"); LLPanel::Params params = LLPanel::getDefaultParams(); @@ -153,7 +153,7 @@ BOOL LLInventoryGallery::postBuild() mInventoryGalleryMenu = new LLInventoryGalleryContextMenu(this); mRootGalleryMenu = new LLInventoryGalleryContextMenu(this); mRootGalleryMenu->setRootFolder(true); - return TRUE; + return true; } LLInventoryGallery::~LLInventoryGallery() @@ -187,7 +187,7 @@ LLInventoryGallery::~LLInventoryGallery() mHiddenItems.pop_back(); panelp->die(); } - + if (gInventory.containsObserver(mCategoriesObserver)) { @@ -200,7 +200,7 @@ LLInventoryGallery::~LLInventoryGallery() gInventory.removeObserver(mThumbnailsObserver); } delete mThumbnailsObserver; - + LLGestureMgr::instance().removeObserver(mGestureObserver); delete mGestureObserver; } @@ -223,7 +223,7 @@ void LLInventoryGallery::setRootFolder(const LLUUID cat_id) { if (mItemMap[id]) { - mItemMap[id]->setSelected(FALSE); + mItemMap[id]->setSelected(false); } } @@ -257,13 +257,13 @@ void LLInventoryGallery::updateRootFolder() { updateRemovedItem(mItems[i]->getUUID()); } - S32 hidden_count = mHiddenItems.size(); + S32 hidden_count = static_cast<S32>(mHiddenItems.size()); for (S32 i = hidden_count - 1; i >= 0; i--) { updateRemovedItem(mHiddenItems[i]->getUUID()); } mItemBuildQuery.clear(); - + if (gInventory.containsObserver(mCategoriesObserver)) { gInventory.removeObserver(mCategoriesObserver); @@ -284,7 +284,7 @@ void LLInventoryGallery::updateRootFolder() mRootChangedSignal(); gInventory.addObserver(mCategoriesObserver); - + // Start observing changes in selected category. mCategoriesObserver->addCategory(mFolderID, boost::bind(&LLInventoryGallery::refreshList, this, mFolderID)); @@ -294,7 +294,7 @@ void LLInventoryGallery::updateRootFolder() // the observer will refresh the list as soon as the new items // arrive. category->fetch(); - + //refreshList(cat_id); LLInventoryModel::cat_array_t* cat_array; LLInventoryModel::item_array_t* item_array; @@ -308,7 +308,7 @@ void LLInventoryGallery::updateRootFolder() { mItemBuildQuery.insert((*iter)->getUUID()); } - + for (LLInventoryModel::item_array_t::const_iterator iter = item_array->begin(); iter != item_array->end(); iter++) @@ -343,7 +343,7 @@ void LLInventoryGallery::initGallery() { uuid_vec_t cats; getCurrentCategories(cats); - int n = cats.size(); + int n = static_cast<int>(cats.size()); buildGalleryPanel(n); mScrollPanel->addChild(mGalleryPanel); for (int i = 0; i < n; i++) @@ -367,7 +367,7 @@ void LLInventoryGallery::draw() } } -void LLInventoryGallery::onVisibilityChange(BOOL new_visibility) +void LLInventoryGallery::onVisibilityChange(bool new_visibility) { if (new_visibility) { @@ -448,7 +448,7 @@ void LLInventoryGallery::reArrangeRows(S32 row_diff) buf_items.push_back(*it); } mHiddenItems.clear(); - + mItemsInRow+= row_diff; updateGalleryWidth(); @@ -458,7 +458,7 @@ void LLInventoryGallery::reArrangeRows(S32 row_diff) { return compareGalleryItem(item1, item2, sort_by_date, sort_folders_by_name); }); - + for (std::vector<LLInventoryGalleryItem*>::const_iterator it = buf_items.begin(); it != buf_items.end(); ++it) { (*it)->setHidden(false); @@ -619,8 +619,8 @@ void LLInventoryGallery::removeFromGalleryMiddle(LLInventoryGalleryItem* item) removeFromGalleryLast(mItems[i]); } removeFromGalleryLast(mItems[n]); - int saved_count = saved.size(); - for (int i = 0; i < saved_count; i++) + size_t saved_count = saved.size(); + for (size_t i = 0; i < saved_count; i++) { addToGallery(saved.back()); saved.pop_back(); @@ -735,7 +735,7 @@ void LLInventoryGallery::setFilterSubString(const std::string& string) { mFilterSubString = string; mFilter->setFilterSubString(string); - + //reArrangeRows(); } @@ -763,7 +763,7 @@ bool LLInventoryGallery::checkAgainstFilters(LLInventoryGalleryItem* item, const { return false; } - + bool hidden = false; if(mFilter->getFilterCreatorType() == LLInventoryFilter::FILTERCREATOR_SELF) @@ -806,7 +806,7 @@ bool LLInventoryGallery::checkAgainstFilters(LLInventoryGalleryItem* item, const desc = item->getItemName() + item->getItemNameSuffix(); break; } - + LLStringUtil::toUpper(desc); std::string cur_filter = filter_substring; @@ -1020,7 +1020,7 @@ void LLInventoryGallery::updateItemThumbnail(LLUUID item_id) } } -BOOL LLInventoryGallery::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLInventoryGallery::handleRightMouseDown(S32 x, S32 y, MASK mask) { if (mSelectedItemIDs.size() > 0) { @@ -1029,7 +1029,7 @@ BOOL LLInventoryGallery::handleRightMouseDown(S32 x, S32 y, MASK mask) mLastInteractedUUID = LLUUID::null; // Scroll is going to always return true - BOOL res = LLPanel::handleRightMouseDown(x, y, mask); + bool res = LLPanel::handleRightMouseDown(x, y, mask); if (mLastInteractedUUID.isNull()) // no child were hit { @@ -1039,16 +1039,16 @@ BOOL LLInventoryGallery::handleRightMouseDown(S32 x, S32 y, MASK mask) uuid_vec_t selected_uuids; selected_uuids.push_back(mFolderID); mRootGalleryMenu->show(this, selected_uuids, x, y); - return TRUE; + return true; } } return res; } -BOOL LLInventoryGallery::handleKeyHere(KEY key, MASK mask) +bool LLInventoryGallery::handleKeyHere(KEY key, MASK mask) { - BOOL handled = FALSE; + bool handled = false; switch (key) { case KEY_RETURN: @@ -1060,7 +1060,7 @@ BOOL LLInventoryGallery::handleKeyHere(KEY key, MASK mask) if (category) { setRootFolder(*iter); - handled = TRUE; + handled = true; } else { @@ -1071,7 +1071,7 @@ BOOL LLInventoryGallery::handleKeyHere(KEY key, MASK mask) } } } - handled = TRUE; + handled = true; break; case KEY_DELETE: #if LL_DARWIN @@ -1083,7 +1083,7 @@ BOOL LLInventoryGallery::handleKeyHere(KEY key, MASK mask) { deleteSelection(); } - handled = TRUE; + handled = true; break; case KEY_F2: @@ -1092,7 +1092,7 @@ BOOL LLInventoryGallery::handleKeyHere(KEY key, MASK mask) { mInventoryGalleryMenu->rename(mSelectedItemIDs.front()); } - handled = TRUE; + handled = true; break; case KEY_PAGE_UP: @@ -1101,7 +1101,7 @@ BOOL LLInventoryGallery::handleKeyHere(KEY key, MASK mask) { mScrollPanel->pageUp(30); } - handled = TRUE; + handled = true; break; case KEY_PAGE_DOWN: @@ -1110,7 +1110,7 @@ BOOL LLInventoryGallery::handleKeyHere(KEY key, MASK mask) { mScrollPanel->pageDown(30); } - handled = TRUE; + handled = true; break; case KEY_HOME: @@ -1119,7 +1119,7 @@ BOOL LLInventoryGallery::handleKeyHere(KEY key, MASK mask) { mScrollPanel->goToTop(); } - handled = TRUE; + handled = true; break; case KEY_END: @@ -1128,27 +1128,27 @@ BOOL LLInventoryGallery::handleKeyHere(KEY key, MASK mask) { mScrollPanel->goToBottom(); } - handled = TRUE; + handled = true; break; case KEY_LEFT: moveLeft(mask); - handled = TRUE; + handled = true; break; case KEY_RIGHT: moveRight(mask); - handled = TRUE; + handled = true; break; case KEY_UP: moveUp(mask); - handled = TRUE; + handled = true; break; case KEY_DOWN: moveDown(mask); - handled = TRUE; + handled = true; break; default: @@ -1188,7 +1188,7 @@ void LLInventoryGallery::moveUp(MASK mask) { changeItemSelection(item_id, true); } - item->setFocus(TRUE); + item->setFocus(true); claimEditHandler(); } } @@ -1200,7 +1200,7 @@ void LLInventoryGallery::moveUp(MASK mask) { item = mIndexToItemMap[target]; toggleSelectionRangeFromLast(item->getUUID()); - item->setFocus(TRUE); + item->setFocus(true); claimEditHandler(); } } @@ -1233,7 +1233,7 @@ void LLInventoryGallery::moveDown(MASK mask) { changeItemSelection(item_id, true); } - item->setFocus(TRUE); + item->setFocus(true); claimEditHandler(); } } @@ -1245,7 +1245,7 @@ void LLInventoryGallery::moveDown(MASK mask) { item = mIndexToItemMap[target]; toggleSelectionRangeFromLast(item->getUUID()); - item->setFocus(TRUE); + item->setFocus(true); claimEditHandler(); } } @@ -1295,7 +1295,7 @@ void LLInventoryGallery::moveLeft(MASK mask) { changeItemSelection(item_id, true); } - item->setFocus(TRUE); + item->setFocus(true); claimEditHandler(); } } @@ -1338,7 +1338,7 @@ void LLInventoryGallery::moveRight(MASK mask) { changeItemSelection(item_id, true); } - item->setFocus(TRUE); + item->setFocus(true); claimEditHandler(); } } @@ -1443,7 +1443,7 @@ void LLInventoryGallery::onFocusReceived() } if (focus_item) { - focus_item->setFocus(TRUE); + focus_item->setFocus(true); } } else if (mIndexToItemMap.size() > 0 && mItemsToSelect.empty()) @@ -1455,7 +1455,7 @@ void LLInventoryGallery::onFocusReceived() LLInventoryGalleryItem* focus_item = mIndexToItemMap[n]; changeItemSelection(focus_item->getUUID(), true); - focus_item->setFocus(TRUE); + focus_item->setFocus(true); } LLPanel::onFocusReceived(); @@ -1480,7 +1480,7 @@ void LLInventoryGallery::changeItemSelection(const LLUUID& item_id, bool scroll_ { if (mItemMap[id]) { - mItemMap[id]->setSelected(FALSE); + mItemMap[id]->setSelected(false); } } mSelectedItemIDs.clear(); @@ -1501,7 +1501,7 @@ void LLInventoryGallery::changeItemSelection(const LLUUID& item_id, bool scroll_ if (mItemMap[item_id]) { - mItemMap[item_id]->setSelected(TRUE); + mItemMap[item_id]->setSelected(true); } mSelectedItemIDs.push_back(item_id); signalSelectionItemID(item_id); @@ -1529,7 +1529,7 @@ void LLInventoryGallery::addItemSelection(const LLUUID& item_id, bool scroll_to_ if (mItemMap[item_id]) { - mItemMap[item_id]->setSelected(TRUE); + mItemMap[item_id]->setSelected(true); } mSelectedItemIDs.push_back(item_id); signalSelectionItemID(item_id); @@ -1554,7 +1554,7 @@ bool LLInventoryGallery::toggleItemSelection(const LLUUID& item_id, bool scroll_ { if (mItemMap[item_id]) { - mItemMap[item_id]->setSelected(FALSE); + mItemMap[item_id]->setSelected(false); } mSelectedItemIDs.erase(found); result = false; @@ -1563,7 +1563,7 @@ bool LLInventoryGallery::toggleItemSelection(const LLUUID& item_id, bool scroll_ { if (mItemMap[item_id]) { - mItemMap[item_id]->setSelected(TRUE); + mItemMap[item_id]->setSelected(true); } mSelectedItemIDs.push_back(item_id); signalSelectionItemID(item_id); @@ -1631,22 +1631,22 @@ void LLInventoryGallery::copy() mFilterSubString.clear(); } -BOOL LLInventoryGallery::canCopy() const +bool LLInventoryGallery::canCopy() const { if (!getVisible() || !getEnabled() || mSelectedItemIDs.empty()) { - return FALSE; + return false; } for (const LLUUID& id : mSelectedItemIDs) { if (!isItemCopyable(id)) { - return FALSE; + return false; } } - return TRUE; + return true; } void LLInventoryGallery::cut() @@ -1707,11 +1707,11 @@ bool is_category_removable(const LLUUID& folder_id, bool check_worn) return true; } -BOOL LLInventoryGallery::canCut() const +bool LLInventoryGallery::canCut() const { if (!getVisible() || !getEnabled() || mSelectedItemIDs.empty()) { - return FALSE; + return false; } for (const LLUUID& id : mSelectedItemIDs) @@ -1721,16 +1721,16 @@ BOOL LLInventoryGallery::canCut() const { if (!get_is_category_and_children_removable(&gInventory, id, true)) { - return FALSE; + return false; } } else if (!get_is_item_removable(&gInventory, id, true)) { - return FALSE; + return false; } } - return TRUE; + return true; } void LLInventoryGallery::paste() @@ -1770,7 +1770,7 @@ void LLInventoryGallery::paste() { if (mItemMap[id]) { - mItemMap[id]->setSelected(FALSE); + mItemMap[id]->setSelected(false); } } mSelectedItemIDs.clear(); @@ -1867,35 +1867,32 @@ void LLInventoryGallery::paste(const LLUUID& dest, LLClipboard::instance().setCutMode(false); } -BOOL LLInventoryGallery::canPaste() const +bool LLInventoryGallery::canPaste() const { - // Return FALSE on degenerated cases: empty clipboard, no inventory, no agent + // Return false on degenerated cases: empty clipboard, no inventory, no agent if (!LLClipboard::instance().hasContents()) { - return FALSE; + return false; } // In cut mode, whatever is on the clipboard is always pastable if (LLClipboard::instance().isCutMode()) { - return TRUE; + return true; } // In normal mode, we need to check each element of the clipboard to know if we can paste or not - std::vector<LLUUID> objects; + uuid_vec_t objects; LLClipboard::instance().pasteFromClipboard(objects); - S32 count = objects.size(); - for (S32 i = 0; i < count; i++) + for (const auto& item_id : objects) { - const LLUUID& item_id = objects.at(i); - // Each item must be copyable to be pastable if (!isItemCopyable(item_id)) { - return FALSE; + return false; } } - return TRUE; + return true; } void LLInventoryGallery::onDelete(const LLSD& notification, const LLSD& response, const selection_deque selected_ids) @@ -1918,7 +1915,7 @@ void LLInventoryGallery::onDelete(const LLSD& notification, const LLSD& response LLInventoryModel::cat_array_t categories; LLInventoryModel::item_array_t items; - gInventory.collectDescendents(obj_id, categories, items, FALSE); + gInventory.collectDescendents(obj_id, categories, items, false); for (LLInventoryModel::item_array_t::value_type& item : items) { @@ -1984,7 +1981,7 @@ void LLInventoryGallery::deleteSelection() LLInventoryModel::cat_array_t categories; LLInventoryModel::item_array_t items; - gInventory.collectDescendents(id, categories, items, FALSE); + gInventory.collectDescendents(id, categories, items, false); for (LLInventoryModel::item_array_t::value_type& item : items) { @@ -2012,7 +2009,7 @@ void LLInventoryGallery::deleteSelection() if (item && get_is_item_worn(item)) { has_worn = true; - LLWearableType::EType type = item->getWearableType(); + LLWearableType::EType type = item->getWearableType(); if (type == LLWearableType::WT_SHAPE || type == LLWearableType::WT_SKIN || type == LLWearableType::WT_HAIR @@ -2113,7 +2110,7 @@ void LLInventoryGallery::pasteAsLink() { if (mItemMap[id]) { - mItemMap[id]->setSelected(FALSE); + mItemMap[id]->setSelected(false); } } mSelectedItemIDs.clear(); @@ -2130,9 +2127,9 @@ void LLInventoryGallery::pasteAsLink(const LLUUID& dest, const LLUUID& marketplacelistings_id, const LLUUID& my_outifts_id) { - const BOOL move_is_into_current_outfit = (dest == current_outfit_id); - const BOOL move_is_into_my_outfits = (dest == my_outifts_id) || gInventory.isObjectDescendentOf(dest, my_outifts_id); - const BOOL move_is_into_marketplacelistings = gInventory.isObjectDescendentOf(dest, marketplacelistings_id); + const bool move_is_into_current_outfit = (dest == current_outfit_id); + const bool move_is_into_my_outfits = (dest == my_outifts_id) || gInventory.isObjectDescendentOf(dest, my_outifts_id); + const bool move_is_into_marketplacelistings = gInventory.isObjectDescendentOf(dest, marketplacelistings_id); if (move_is_into_marketplacelistings || move_is_into_current_outfit || move_is_into_my_outfits) { @@ -2168,6 +2165,39 @@ void LLInventoryGallery::pasteAsLink(const LLUUID& dest, } } +void LLInventoryGallery::doCreate(const LLUUID& dest, const LLSD& userdata) +{ + + LLViewerInventoryCategory* cat = gInventory.getCategory(dest); + if (cat && mFolderID != dest) + { + menu_create_inventory_item(NULL, dest, userdata, LLUUID::null); + } + else + { + // todo: needs to reset current floater's filter, + // like reset_inventory_filter() + + LLHandle<LLPanel> handle = getHandle(); + std::function<void(const LLUUID&)> callback_cat_created = + [handle](const LLUUID& new_id) + { + gInventory.notifyObservers(); + LLInventoryGallery* panel = static_cast<LLInventoryGallery*>(handle.get()); + if (panel && new_id.notNull()) + { + panel->clearSelection(); + if (panel->mItemMap.count(new_id) != 0) + { + panel->addItemSelection(new_id, true); + } + } + }; + + menu_create_inventory_item(NULL, mFolderID, userdata, LLUUID::null, callback_cat_created); + } +} + void LLInventoryGallery::claimEditHandler() { gEditMenuHandler = this; @@ -2355,7 +2385,7 @@ void LLInventoryGallery::onCOFChanged() LLCommonUtils::computeDifference(vnew, mCOFLinkedItems, vadded, vremoved); mCOFLinkedItems = vnew; - + for (uuid_vec_t::const_iterator iter = vadded.begin(); iter != vadded.end(); ++iter) @@ -2386,7 +2416,7 @@ void LLInventoryGallery::onGesturesChanged() LLCommonUtils::computeDifference(vnew, mActiveGestures, vadded, vremoved); mActiveGestures = vnew; - + for (uuid_vec_t::const_iterator iter = vadded.begin(); iter != vadded.end(); ++iter) @@ -2406,7 +2436,7 @@ void LLInventoryGallery::deselectItem(const LLUUID& category_id) LLInventoryGalleryItem* item = mItemMap[category_id]; if (item && item->isSelected()) { - mItemMap[category_id]->setSelected(FALSE); + mItemMap[category_id]->setSelected(false); setFocus(true); // Todo: support multiselect // signalSelectionItemID(LLUUID::null); @@ -2425,7 +2455,7 @@ void LLInventoryGallery::clearSelection() { if (mItemMap[id]) { - mItemMap[id]->setSelected(FALSE); + mItemMap[id]->setSelected(false); } } if (!mSelectedItemIDs.empty()) @@ -2527,12 +2557,12 @@ bool LLInventoryGallery::isForwardAvailable() return (!mForwardFolders.empty() && (mFolderID != mForwardFolders.back())); } -BOOL LLInventoryGallery::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +bool LLInventoryGallery::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) { // have children handle it first - BOOL handled = LLView::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, + bool handled = LLView::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); // when drop is not handled by child, it should be handled by the root folder . @@ -2564,7 +2594,7 @@ void LLInventoryGallery::startDrag() ids.push_back(selected_id); } - const LLViewerInventoryCategory* cat = gInventory.getCategory(selected_id); + const LLViewerInventoryCategory* cat = gInventory.getCategory(selected_id); if (cat) { if (gInventory.isObjectDescendentOf(selected_id, gInventory.getLibraryRootFolderID())) @@ -2642,7 +2672,7 @@ bool LLInventoryGallery::checkAgainstFilterType(const LLUUID& object_id) break; } } - + if (filterTypes & LLInventoryFilter::FILTERTYPE_DATE) { const U16 HOURS_TO_SECONDS = 3600; @@ -2727,13 +2757,13 @@ LLInventoryGalleryItem::~LLInventoryGalleryItem() { } -BOOL LLInventoryGalleryItem::postBuild() +bool LLInventoryGalleryItem::postBuild() { mNameText = getChild<LLTextBox>("item_name"); mTextBgPanel = getChild<LLPanel>("text_bg_panel"); mThumbnailCtrl = getChild<LLThumbnailCtrl>("preview_thumbnail"); - return TRUE; + return true; } void LLInventoryGalleryItem::setType(LLAssetType::EType type, LLInventoryType::EType inventory_type, U32 flags, bool is_link) @@ -2837,7 +2867,7 @@ void LLInventoryGalleryItem::draw() LLRect border = mThumbnailCtrl->getRect(); border.mRight = border.mRight + 1; border.mTop = border.mTop + 1; - gl_rect_2d(border, border_color.get(), FALSE); + gl_rect_2d(border, border_color.get(), false); } } @@ -2862,7 +2892,7 @@ void LLInventoryGalleryItem::setSelected(bool value) } } -BOOL LLInventoryGalleryItem::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLInventoryGalleryItem::handleMouseDown(S32 x, S32 y, MASK mask) { // call changeItemSelection directly, before setFocus // to avoid autoscroll from LLInventoryGallery::onFocusReceived() @@ -2878,7 +2908,7 @@ BOOL LLInventoryGalleryItem::handleMouseDown(S32 x, S32 y, MASK mask) { mGallery->changeItemSelection(mUUID, false); } - setFocus(TRUE); + setFocus(true); mGallery->claimEditHandler(); gFocusMgr.setMouseCapture(this); @@ -2886,10 +2916,10 @@ BOOL LLInventoryGalleryItem::handleMouseDown(S32 x, S32 y, MASK mask) S32 screen_y; localPointToScreen(x, y, &screen_x, &screen_y ); LLToolDragAndDrop::getInstance()->setDragStart(screen_x, screen_y); - return TRUE; + return true; } -BOOL LLInventoryGalleryItem::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLInventoryGalleryItem::handleRightMouseDown(S32 x, S32 y, MASK mask) { if (!isSelected()) { @@ -2900,25 +2930,25 @@ BOOL LLInventoryGalleryItem::handleRightMouseDown(S32 x, S32 y, MASK mask) // refresh last interacted mGallery->addItemSelection(mUUID, false); } - setFocus(TRUE); + setFocus(true); mGallery->claimEditHandler(); mGallery->showContextMenu(this, x, y, mUUID); LLUICtrl::handleRightMouseDown(x, y, mask); - return TRUE; + return true; } -BOOL LLInventoryGalleryItem::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLInventoryGalleryItem::handleMouseUp(S32 x, S32 y, MASK mask) { if(hasMouseCapture()) { gFocusMgr.setMouseCapture(NULL); - return TRUE; + return true; } return LLPanel::handleMouseUp(x, y, mask); } -BOOL LLInventoryGalleryItem::handleHover(S32 x, S32 y, MASK mask) +bool LLInventoryGalleryItem::handleHover(S32 x, S32 y, MASK mask) { if(hasMouseCapture()) { @@ -2935,7 +2965,7 @@ BOOL LLInventoryGalleryItem::handleHover(S32 x, S32 y, MASK mask) return LLUICtrl::handleHover(x,y,mask); } -BOOL LLInventoryGalleryItem::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLInventoryGalleryItem::handleDoubleClick(S32 x, S32 y, MASK mask) { if (mIsFolder && mGallery) { @@ -2958,10 +2988,10 @@ BOOL LLInventoryGalleryItem::handleDoubleClick(S32 x, S32 y, MASK mask) LLInvFVBridgeAction::doAction(mUUID, &gInventory); } - return TRUE; + return true; } -BOOL LLInventoryGalleryItem::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +bool LLInventoryGalleryItem::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -2969,19 +2999,19 @@ BOOL LLInventoryGalleryItem::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL dro { if (!mIsFolder) { - return FALSE; + return false; } return mGallery->baseHandleDragAndDrop(mUUID, drop, cargo_type, cargo_data, accept, tooltip_msg); } -BOOL LLInventoryGalleryItem::handleKeyHere(KEY key, MASK mask) +bool LLInventoryGalleryItem::handleKeyHere(KEY key, MASK mask) { if (!mGallery) { - return FALSE; + return false; } - BOOL handled = FALSE; + bool handled = false; switch (key) { case KEY_LEFT: @@ -3085,7 +3115,7 @@ void LLThumbnailsObserver::changed(U32 mask) { const LLUUID& obj_id = (*iter).first; LLItemData& data = (*iter).second; - + LLInventoryObject* obj = gInventory.getObject(obj_id); if (!obj) { @@ -3128,7 +3158,7 @@ void LLThumbnailsObserver::removeItem(const LLUUID& obj_id) // Helper drag&drop functions //----------------------------- -BOOL LLInventoryGallery::baseHandleDragAndDrop(LLUUID dest_id, BOOL drop, +bool LLInventoryGallery::baseHandleDragAndDrop(LLUUID dest_id, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -3141,7 +3171,7 @@ BOOL LLInventoryGallery::baseHandleDragAndDrop(LLUUID dest_id, BOOL drop, clearSelection(); } - BOOL accepted = FALSE; + bool accepted = false; switch(cargo_type) { case DAD_TEXTURE: @@ -3173,12 +3203,12 @@ BOOL LLInventoryGallery::baseHandleDragAndDrop(LLUUID dest_id, BOOL drop, LLInventoryCategory* linked_category = gInventory.getCategory(inv_item->getLinkedUUID()); if (linked_category) { - accepted = dragCategoryIntoFolder(dest_id, (LLInventoryCategory*)linked_category, drop, tooltip_msg, TRUE); + accepted = dragCategoryIntoFolder(dest_id, (LLInventoryCategory*)linked_category, drop, tooltip_msg, true); } } else { - accepted = dragItemIntoFolder(dest_id, inv_item, drop, tooltip_msg, TRUE); + accepted = dragItemIntoFolder(dest_id, inv_item, drop, tooltip_msg, true); } if (accepted && drop && inv_item) { @@ -3188,12 +3218,12 @@ BOOL LLInventoryGallery::baseHandleDragAndDrop(LLUUID dest_id, BOOL drop, case DAD_CATEGORY: if (LLFriendCardsManager::instance().isAnyFriendCategory(dest_id)) { - accepted = FALSE; + accepted = false; } else { LLInventoryCategory* cat_ptr = (LLInventoryCategory*)cargo_data; - accepted = dragCategoryIntoFolder(dest_id, cat_ptr, drop, tooltip_msg, FALSE); + accepted = dragCategoryIntoFolder(dest_id, cat_ptr, drop, tooltip_msg, false); if (accepted && drop) { mItemsToSelect.push_back(cat_ptr->getUUID()); @@ -3219,23 +3249,23 @@ BOOL LLInventoryGallery::baseHandleDragAndDrop(LLUUID dest_id, BOOL drop, } // copy of LLFolderBridge::dragItemIntoFolder -BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, std::string& tooltip_msg, BOOL user_confirm) +bool dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, bool drop, std::string& tooltip_msg, bool user_confirm) { LLViewerInventoryCategory * cat = gInventory.getCategory(folder_id); if (!cat) { - return FALSE; + return false; } LLInventoryModel* model = &gInventory; - if (!model || !inv_item) return FALSE; + if (!model || !inv_item) return false; // cannot drag into library if((gInventory.getRootFolderID() != folder_id) && !model->isObjectDescendentOf(folder_id, gInventory.getRootFolderID())) { - return FALSE; + return false; } - if (!isAgentAvatarValid()) return FALSE; + if (!isAgentAvatarValid()) return false; const LLUUID ¤t_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); const LLUUID &favorites_id = model->findCategoryUUIDForType(LLFolderType::FT_FAVORITE); @@ -3243,29 +3273,29 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS); const LLUUID &my_outifts_id = model->findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); - const BOOL move_is_into_current_outfit = (folder_id == current_outfit_id); - const BOOL move_is_into_favorites = (folder_id == favorites_id); - const BOOL move_is_into_my_outfits = (folder_id == my_outifts_id) || model->isObjectDescendentOf(folder_id, my_outifts_id); - const BOOL move_is_into_outfit = move_is_into_my_outfits || (cat && cat->getPreferredType()==LLFolderType::FT_OUTFIT); - const BOOL move_is_into_landmarks = (folder_id == landmarks_id) || model->isObjectDescendentOf(folder_id, landmarks_id); - const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(folder_id, marketplacelistings_id); - const BOOL move_is_from_marketplacelistings = model->isObjectDescendentOf(inv_item->getUUID(), marketplacelistings_id); + const bool move_is_into_current_outfit = (folder_id == current_outfit_id); + const bool move_is_into_favorites = (folder_id == favorites_id); + const bool move_is_into_my_outfits = (folder_id == my_outifts_id) || model->isObjectDescendentOf(folder_id, my_outifts_id); + const bool move_is_into_outfit = move_is_into_my_outfits || (cat && cat->getPreferredType()==LLFolderType::FT_OUTFIT); + const bool move_is_into_landmarks = (folder_id == landmarks_id) || model->isObjectDescendentOf(folder_id, landmarks_id); + const bool move_is_into_marketplacelistings = model->isObjectDescendentOf(folder_id, marketplacelistings_id); + const bool move_is_from_marketplacelistings = model->isObjectDescendentOf(inv_item->getUUID(), marketplacelistings_id); LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource(); - BOOL accept = FALSE; + bool accept = false; LLViewerObject* object = NULL; if(LLToolDragAndDrop::SOURCE_AGENT == source) { const LLUUID &trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); - const BOOL move_is_into_trash = (folder_id == trash_id) || model->isObjectDescendentOf(folder_id, trash_id); - const BOOL move_is_outof_current_outfit = LLAppearanceMgr::instance().getIsInCOF(inv_item->getUUID()); + const bool move_is_into_trash = (folder_id == trash_id) || model->isObjectDescendentOf(folder_id, trash_id); + const bool move_is_outof_current_outfit = LLAppearanceMgr::instance().getIsInCOF(inv_item->getUUID()); //-------------------------------------------------------------------------------- // Determine if item can be moved. // - BOOL is_movable = TRUE; + bool is_movable = true; switch (inv_item->getActualType()) { @@ -3278,7 +3308,7 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, // Can't explicitly drag things out of the COF. if (move_is_outof_current_outfit) { - is_movable = FALSE; + is_movable = false; } if (move_is_into_trash) { @@ -3296,20 +3326,20 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, // //-------------------------------------------------------------------------------- - + //-------------------------------------------------------------------------------- // Determine if item can be moved & dropped // Note: if user_confirm is false, we already went through those accept logic test and can skip them - accept = TRUE; + accept = true; if (user_confirm && !is_movable) { - accept = FALSE; + accept = false; } else if (user_confirm && (folder_id == inv_item->getParentUUID()) && !move_is_into_favorites) { - accept = FALSE; + accept = false; } else if (user_confirm && (move_is_into_current_outfit || move_is_into_outfit)) { @@ -3322,8 +3352,8 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, else if (user_confirm && move_is_into_marketplacelistings) { //disable dropping in or out of marketplace for now - return FALSE; - + return false; + /*const LLViewerInventoryCategory * master_folder = model->getFirstDescendantOf(marketplacelistings_id, folder_id); LLViewerInventoryCategory * dest_folder = cat; accept = can_move_item_to_marketplace(master_folder, dest_folder, inv_item, tooltip_msg, LLToolDragAndDrop::instance().getCargoCount() - LLToolDragAndDrop::instance().getCargoIndex());*/ @@ -3335,8 +3365,9 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, LLViewerInventoryCategory * dest_folder = cat; accept = dest_folder->acceptItem(inv_item); } - - LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE); + + LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(false); + if (accept && drop) { @@ -3357,7 +3388,7 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, if (user_confirm && (move_is_from_marketplacelistings || move_is_into_marketplacelistings)) { //disable dropping in or out of marketplace for now - return FALSE; + return false; } //-------------------------------------------------------------------------------- @@ -3395,7 +3426,7 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, else if (move_is_into_marketplacelistings) { //move_item_to_marketplacelistings(inv_item, mUUID); - return FALSE; + return false; } // NORMAL or TRASH folder // (move the item, restamp if into trash) @@ -3409,7 +3440,7 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, gInventory.changeItemParent((LLViewerInventoryItem*)inv_item, folder_id, move_is_into_trash); } - + if (move_is_from_marketplacelistings) { // If we move from an active (listed) listing, checks that it's still valid, if not, unlist @@ -3426,7 +3457,7 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, } }); }*/ - return FALSE; + return false; } // @@ -3442,7 +3473,7 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, if (!object) { LL_INFOS() << "Object not found for drop." << LL_ENDL; - return FALSE; + return false; } // coming from a task. Need to figure out if the person can @@ -3453,7 +3484,7 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, && perm.allowTransferTo(gAgent.getID()))) // || gAgent.isGodlike()) { - accept = TRUE; + accept = true; } else if(object->permYouOwner()) { @@ -3461,26 +3492,26 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, // inventory is owned by the agent, then the item can be // moved from the task to agent inventory. is_move = true; - accept = TRUE; + accept = true; } // Don't allow placing an original item into Current Outfit or an outfit folder // because they must contain only links to wearable items. if (move_is_into_current_outfit || move_is_into_outfit) { - accept = FALSE; + accept = false; } // Don't allow to move a single item to Favorites or Landmarks // if it is not a landmark or a link to a landmark. else if ((move_is_into_favorites || move_is_into_landmarks) && !can_move_to_landmarks(inv_item)) { - accept = FALSE; + accept = false; } else if (move_is_into_marketplacelistings) { tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory"); - accept = FALSE; + accept = false; } if (accept && drop) @@ -3511,12 +3542,12 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, if (move_is_into_marketplacelistings) { tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory"); - accept = FALSE; + accept = false; } else if ((inv_item->getActualType() == LLAssetType::AT_SETTINGS) && !LLEnvironment::instance().isInventoryEnabled()) { tooltip_msg = LLTrans::getString("NoEnvironmentSettings"); - accept = FALSE; + accept = false; } else { @@ -3538,12 +3569,12 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, LLViewerInventoryItem* item = (LLViewerInventoryItem*)inv_item; if(item && item->isFinished()) { - accept = TRUE; + accept = true; if (move_is_into_marketplacelistings) { tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory"); - accept = FALSE; + accept = false; } else if (move_is_into_current_outfit || move_is_into_outfit) { @@ -3605,41 +3636,40 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, } // copy of LLFolderBridge::dragCategoryIntoFolder -BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, - BOOL drop, std::string& tooltip_msg, BOOL is_link) +bool dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, + bool drop, std::string& tooltip_msg, bool is_link) { - BOOL user_confirm = TRUE; + bool user_confirm = true; LLInventoryModel* model = &gInventory; LLViewerInventoryCategory * dest_cat = gInventory.getCategory(dest_id); if (!dest_cat) { - return FALSE; + return false; } - if (!inv_cat) return FALSE; // shouldn't happen, but in case item is incorrectly parented in which case inv_cat will be NULL + if (!inv_cat) return false; // shouldn't happen, but in case item is incorrectly parented in which case inv_cat will be NULL - if (!isAgentAvatarValid()) return FALSE; + if (!isAgentAvatarValid()) return false; // cannot drag into library if((gInventory.getRootFolderID() != dest_id) && !model->isObjectDescendentOf(dest_id, gInventory.getRootFolderID())) { - return FALSE; + return false; } const LLUUID &cat_id = inv_cat->getUUID(); const LLUUID ¤t_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS); //const LLUUID from_folder_uuid = inv_cat->getParentUUID(); - - const BOOL move_is_into_current_outfit = (dest_id == current_outfit_id); - const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(dest_id, marketplacelistings_id); - const BOOL move_is_from_marketplacelistings = model->isObjectDescendentOf(cat_id, marketplacelistings_id); + const bool move_is_into_current_outfit = (dest_id == current_outfit_id); + const bool move_is_into_marketplacelistings = model->isObjectDescendentOf(dest_id, marketplacelistings_id); + const bool move_is_from_marketplacelistings = model->isObjectDescendentOf(cat_id, marketplacelistings_id); // check to make sure source is agent inventory, and is represented there. LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource(); - const BOOL is_agent_inventory = (model->getCategory(cat_id) != NULL) + const bool is_agent_inventory = (model->getCategory(cat_id) != NULL) && (LLToolDragAndDrop::SOURCE_AGENT == source); - BOOL accept = FALSE; + bool accept = false; if (is_agent_inventory) { @@ -3648,22 +3678,22 @@ BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, const LLUUID &my_outifts_id = model->findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); const LLUUID &lost_and_found_id = model->findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND); - const BOOL move_is_into_trash = (dest_id == trash_id) || model->isObjectDescendentOf(dest_id, trash_id); - const BOOL move_is_into_my_outfits = (dest_id == my_outifts_id) || model->isObjectDescendentOf(dest_id, my_outifts_id); - const BOOL move_is_into_outfit = move_is_into_my_outfits || (dest_cat && dest_cat->getPreferredType()==LLFolderType::FT_OUTFIT); - const BOOL move_is_into_current_outfit = (dest_cat && dest_cat->getPreferredType()==LLFolderType::FT_CURRENT_OUTFIT); - const BOOL move_is_into_landmarks = (dest_id == landmarks_id) || model->isObjectDescendentOf(dest_id, landmarks_id); - const BOOL move_is_into_lost_and_found = model->isObjectDescendentOf(dest_id, lost_and_found_id); + const bool move_is_into_trash = (dest_id == trash_id) || model->isObjectDescendentOf(dest_id, trash_id); + const bool move_is_into_my_outfits = (dest_id == my_outifts_id) || model->isObjectDescendentOf(dest_id, my_outifts_id); + const bool move_is_into_outfit = move_is_into_my_outfits || (dest_cat && dest_cat->getPreferredType()==LLFolderType::FT_OUTFIT); + const bool move_is_into_current_outfit = (dest_cat && dest_cat->getPreferredType()==LLFolderType::FT_CURRENT_OUTFIT); + const bool move_is_into_landmarks = (dest_id == landmarks_id) || model->isObjectDescendentOf(dest_id, landmarks_id); + const bool move_is_into_lost_and_found = model->isObjectDescendentOf(dest_id, lost_and_found_id); //-------------------------------------------------------------------------------- // Determine if folder can be moved. // - BOOL is_movable = TRUE; + bool is_movable = true; if (is_movable && (marketplacelistings_id == cat_id)) { - is_movable = FALSE; + is_movable = false; tooltip_msg = LLTrans::getString("TooltipOutboxCannotMoveRoot"); } if (is_movable && move_is_from_marketplacelistings) @@ -3671,22 +3701,22 @@ BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, { // If the incoming folder is listed and active (and is therefore either the listing or the version folder), // then moving is *not* allowed - is_movable = FALSE; + is_movable = false; tooltip_msg = LLTrans::getString("TooltipOutboxDragActive"); } if (is_movable && (dest_id == cat_id)) { - is_movable = FALSE; + is_movable = false; tooltip_msg = LLTrans::getString("TooltipDragOntoSelf"); } if (is_movable && (model->isObjectDescendentOf(dest_id, cat_id))) { - is_movable = FALSE; + is_movable = false; tooltip_msg = LLTrans::getString("TooltipDragOntoOwnChild"); } if (is_movable && LLFolderType::lookupIsProtectedType(inv_cat->getPreferredType())) { - is_movable = FALSE; + is_movable = false; // tooltip? } @@ -3721,36 +3751,36 @@ BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, } if(is_movable && move_is_into_current_outfit && is_link) { - is_movable = FALSE; + is_movable = false; } if (is_movable && move_is_into_lost_and_found) { - is_movable = FALSE; + is_movable = false; } if (is_movable && (dest_id == model->findCategoryUUIDForType(LLFolderType::FT_FAVORITE))) { - is_movable = FALSE; + is_movable = false; // tooltip? } if (is_movable && (dest_cat->getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK)) { // One cannot move a folder into a stock folder - is_movable = FALSE; + is_movable = false; // tooltip? } - + LLInventoryModel::cat_array_t descendent_categories; LLInventoryModel::item_array_t descendent_items; if (is_movable) { - model->collectDescendents(cat_id, descendent_categories, descendent_items, FALSE); + model->collectDescendents(cat_id, descendent_categories, descendent_items, false); for (S32 i=0; i < descendent_categories.size(); ++i) { LLInventoryCategory* category = descendent_categories[i]; if(LLFolderType::lookupIsProtectedType(category->getPreferredType())) { // Can't move "special folders" (e.g. Textures Folder). - is_movable = FALSE; + is_movable = false; break; } } @@ -3771,7 +3801,7 @@ BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, if (items.size() > max_items_to_wear) { // Can't move 'large' folders into current outfit: MAINT-4086 - is_movable = FALSE; + is_movable = false; LLStringUtil::format_map_t args; args["AMOUNT"] = llformat("%d", max_items_to_wear); tooltip_msg = LLTrans::getString("TooltipTooManyWearables",args); @@ -3784,7 +3814,7 @@ BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, LLInventoryItem* item = descendent_items[i]; if (get_is_item_worn(item->getUUID())) { - is_movable = FALSE; + is_movable = false; break; // It's generally movable, but not into the trash. } } @@ -3799,12 +3829,12 @@ BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, // We use getType() instead of getActua;Type() to allow links to landmarks and folders. if (LLAssetType::AT_LANDMARK != item->getType() && LLAssetType::AT_CATEGORY != item->getType()) { - is_movable = FALSE; + is_movable = false; break; // It's generally movable, but not into Landmarks. } } } - + if (is_movable && move_is_into_marketplacelistings) { const LLViewerInventoryCategory * master_folder = model->getFirstDescendantOf(marketplacelistings_id, dest_id); @@ -3824,7 +3854,7 @@ BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, if (user_confirm && (move_is_from_marketplacelistings || move_is_into_marketplacelistings)) { //disable dropping in or out of marketplace for now - return FALSE; + return false; } // Look for any gestures and deactivate them if (move_is_into_trash) @@ -3852,7 +3882,7 @@ BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, inv_cat->getPreferredType() == LLFolderType::FT_OUTFIT)) { // traverse category and add all contents to currently worn. - BOOL append = true; + bool append = true; LLAppearanceMgr::instance().wearInventoryCategory(inv_cat, false, append); } else if (move_is_into_marketplacelistings) @@ -3876,8 +3906,8 @@ BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, if (move_is_from_marketplacelistings) { //disable dropping in or out of marketplace for now - return FALSE; - + return false; + // If we are moving a folder at the listing folder level (i.e. its parent is the marketplace listings folder) /*if (from_folder_uuid == marketplacelistings_id) { @@ -3915,7 +3945,7 @@ BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, if (move_is_into_marketplacelistings) { tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory"); - accept = FALSE; + accept = false; } else { @@ -3927,7 +3957,7 @@ BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, if (move_is_into_marketplacelistings) { tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory"); - accept = FALSE; + accept = false; } else { diff --git a/indra/newview/llinventorygallery.h b/indra/newview/llinventorygallery.h index 51444d24b0..afc7bdc9f8 100644 --- a/indra/newview/llinventorygallery.h +++ b/indra/newview/llinventorygallery.h @@ -75,15 +75,15 @@ public: LLInventoryGallery(const LLInventoryGallery::Params& params = getDefaultParams()); ~LLInventoryGallery(); - BOOL postBuild() override; + bool postBuild() override; void initGallery(); void draw() override; - void onVisibilityChange(BOOL new_visibility) override; - BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, + void onVisibilityChange(bool new_visibility) override; + bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) override; void startDrag(); - BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) override; - BOOL handleKeyHere(KEY key, MASK mask) override; + bool handleRightMouseDown(S32 x, S32 y, MASK mask) override; + bool handleKeyHere(KEY key, MASK mask) override; void moveUp(MASK mask); void moveDown(MASK mask); void moveLeft(MASK mask); @@ -153,19 +153,20 @@ public: // Copy & paste (LLEditMenuHandler) void copy() override; - BOOL canCopy() const override; + bool canCopy() const override; void cut() override; - BOOL canCut() const override; + bool canCut() const override; void paste() override; - BOOL canPaste() const override; + bool canPaste() const override; // Copy & paste & delete static void onDelete(const LLSD& notification, const LLSD& response, const selection_deque selected_ids); void deleteSelection(); bool canDeleteSelection(); void pasteAsLink(); + void doCreate(const LLUUID& dest, const LLSD& userdata); void setSortOrder(U32 order, bool update = false); U32 getSortOrder() { return mSortOrder; }; @@ -174,7 +175,7 @@ public: void resetEditHandler(); static bool isItemCopyable(const LLUUID & item_id); - BOOL baseHandleDragAndDrop(LLUUID dest_id, BOOL drop, EDragAndDropType cargo_type, + bool baseHandleDragAndDrop(LLUUID dest_id, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg); void showContextMenu(LLUICtrl* ctrl, S32 x, S32 y, const LLUUID& item_id); @@ -298,19 +299,19 @@ public: LLInventoryGalleryItem(const Params& p); virtual ~LLInventoryGalleryItem(); - BOOL postBuild(); + bool postBuild(); void draw(); - BOOL handleMouseDown(S32 x, S32 y, MASK mask); - BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - BOOL handleDoubleClick(S32 x, S32 y, MASK mask); - BOOL handleMouseUp(S32 x, S32 y, MASK mask); - BOOL handleHover(S32 x, S32 y, MASK mask); - BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + bool handleMouseDown(S32 x, S32 y, MASK mask); + bool handleRightMouseDown(S32 x, S32 y, MASK mask); + bool handleDoubleClick(S32 x, S32 y, MASK mask); + bool handleMouseUp(S32 x, S32 y, MASK mask); + bool handleHover(S32 x, S32 y, MASK mask); + bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg); - BOOL handleKeyHere(KEY key, MASK mask); + bool handleKeyHere(KEY key, MASK mask); void onFocusLost(); void onFocusReceived(); diff --git a/indra/newview/llinventorygallerymenu.cpp b/indra/newview/llinventorygallerymenu.cpp index 5f5474b359..dbf4821ca1 100644 --- a/indra/newview/llinventorygallerymenu.cpp +++ b/indra/newview/llinventorygallerymenu.cpp @@ -32,9 +32,11 @@ #include "llappearancemgr.h" #include "llavataractions.h" #include "llclipboard.h" +#include "llenvironment.h" #include "llfloaterreg.h" #include "llfloatersidepanelcontainer.h" #include "llfloaterworldmap.h" +#include "llfriendcard.h" #include "llinventorybridge.h" #include "llinventoryfunctions.h" #include "llinventorymodel.h" @@ -48,6 +50,41 @@ #include "llviewerwindow.h" #include "llvoavatarself.h" + +void modify_outfit(bool append, const LLUUID& cat_id, LLInventoryModel* model) +{ + LLViewerInventoryCategory* cat = model->getCategory(cat_id); + if (!cat) return; + + // checking amount of items to wear + static LLCachedControl<U32> max_items(gSavedSettings, "WearFolderLimit", 125); + LLInventoryModel::cat_array_t cats; + LLInventoryModel::item_array_t items; + LLFindWearablesEx not_worn(/*is_worn=*/ false, /*include_body_parts=*/ false); + model->collectDescendentsIf(cat_id, + cats, + items, + LLInventoryModel::EXCLUDE_TRASH, + not_worn); + + if (items.size() > max_items()) + { + LLSD args; + args["AMOUNT"] = llformat("%u", max_items()); + LLNotificationsUtil::add("TooManyWearables", args); + return; + } + if (model->isObjectDescendentOf(cat_id, gInventory.getRootFolderID())) + { + LLAppearanceMgr::instance().wearInventoryCategory(cat, false, append); + } + else + { + // Library, we need to copy content first + LLAppearanceMgr::instance().wearInventoryCategory(cat, true, append); + } +} + LLContextMenu* LLInventoryGalleryContextMenu::createMenu() { LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; @@ -57,12 +94,35 @@ LLContextMenu* LLInventoryGalleryContextMenu::createMenu() registrar.add("Inventory.FileUploadLocation", boost::bind(&LLInventoryGalleryContextMenu::fileUploadLocation, this, _2)); registrar.add("Inventory.EmptyTrash", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyTrash", LLFolderType::FT_TRASH)); registrar.add("Inventory.EmptyLostAndFound", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyLostAndFound", LLFolderType::FT_LOST_AND_FOUND)); + registrar.add("Inventory.DoCreate", [this](LLUICtrl*, const LLSD& data) + { + if (mRootFolder) + { + mGallery->doCreate(mGallery->getRootFolder(), data); + } + else + { + mGallery->doCreate(mUUIDs.front(), data); + } + }); std::set<LLUUID> uuids(mUUIDs.begin(), mUUIDs.end()); registrar.add("Inventory.Share", boost::bind(&LLAvatarActions::shareWithAvatars, uuids, gFloaterView->getParentFloater(mGallery))); enable_registrar.add("Inventory.CanSetUploadLocation", boost::bind(&LLInventoryGalleryContextMenu::canSetUploadLocation, this, _2)); - + + enable_registrar.add("Inventory.EnvironmentEnabled", [](LLUICtrl*, const LLSD&) + { + return LLEnvironment::instance().isInventoryEnabled(); + }); + enable_registrar.add("Inventory.MaterialsEnabled", [](LLUICtrl*, const LLSD&) + { + std::string agent_url = gAgent.getRegionCapability("UpdateMaterialAgentInventory"); + std::string task_url = gAgent.getRegionCapability("UpdateMaterialTaskInventory"); + + return (!agent_url.empty() && !task_url.empty()); + }); + LLContextMenu* menu = createFromFile("menu_gallery_inventory.xml"); updateMenuItemsVisibility(menu); @@ -138,7 +198,11 @@ void LLInventoryGalleryContextMenu::doToSelected(const LLSD& userdata) } else if ("thumbnail" == action) { - LLSD data(mUUIDs.front()); + LLSD data; + for (const LLUUID& id : mUUIDs) + { + data.append(id); + } LLFloaterReg::showInstance("change_item_thumbnail", data); } else if ("cut" == action) @@ -186,6 +250,22 @@ void LLInventoryGalleryContextMenu::doToSelected(const LLSD& userdata) { ungroup_folder_items(mUUIDs.front()); } + else if ("replaceoutfit" == action) + { + modify_outfit(false, mUUIDs.front(), &gInventory); + } + else if ("addtooutfit" == action) + { + modify_outfit(true, mUUIDs.front(), &gInventory); + } + else if ("removefromoutfit" == action) + { + LLViewerInventoryCategory* cat = gInventory.getCategory(mUUIDs.front()); + if (cat) + { + LLAppearanceMgr::instance().takeOffOutfit(cat->getLinkedUUID()); + } + } else if ("take_off" == action || "detach" == action) { for (LLUUID& selected_id : mUUIDs) @@ -295,6 +375,54 @@ void LLInventoryGalleryContextMenu::doToSelected(const LLSD& userdata) preview_texture->saveAs(); } } + else if (("copy_to_marketplace_listings" == action) + || ("move_to_marketplace_listings" == action)) + { + LLViewerInventoryItem* itemp = gInventory.getItem(mUUIDs.front()); + bool copy_operation = "copy_to_marketplace_listings" == action; + bool can_copy = itemp ? itemp->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID()) : false; + + + if (can_copy) + { + const LLUUID& marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS); + if (itemp) + { + move_item_to_marketplacelistings(itemp, marketplacelistings_id, copy_operation); + } + } + else + { + uuid_vec_t lamdba_list = mUUIDs; + LLNotificationsUtil::add( + "ConfirmCopyToMarketplace", + LLSD(), + LLSD(), + [lamdba_list](const LLSD& notification, const LLSD& response) + { + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + // option == 0 Move no copy item(s) + // option == 1 Don't move no copy item(s) (leave them behind) + bool copy_and_move = option == 0; + const LLUUID& marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS); + + // main inventory only allows one item? + LLViewerInventoryItem* itemp = gInventory.getItem(lamdba_list.front()); + if (itemp) + { + if (itemp->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID())) + { + move_item_to_marketplacelistings(itemp, marketplacelistings_id, true); + } + else if (copy_and_move) + { + move_item_to_marketplacelistings(itemp, marketplacelistings_id, false); + } + } + } + ); + } + } } void LLInventoryGalleryContextMenu::rename(const LLUUID& item_id) @@ -321,7 +449,7 @@ void LLInventoryGalleryContextMenu::onRename(const LLSD& notification, const LLS if (!new_name.empty()) { LLUUID id = notification["payload"]["id"].asUUID(); - + LLViewerInventoryCategory* cat = gInventory.getCategory(id); if(cat && (cat->getName() != new_name)) { @@ -330,7 +458,7 @@ void LLInventoryGalleryContextMenu::onRename(const LLSD& notification, const LLS update_inventory_category(cat->getUUID(),updates, NULL); return; } - + LLViewerInventoryItem* item = gInventory.getItem(id); if(item && (item->getName() != new_name)) { @@ -379,15 +507,65 @@ bool LLInventoryGalleryContextMenu::canSetUploadLocation(const LLSD& userdata) bool is_inbox_folder(LLUUID item_id) { const LLUUID inbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX); - + if (inbox_id.isNull()) { return false; } - + return gInventory.isObjectDescendentOf(item_id, inbox_id); } +bool can_list_on_marketplace(const LLUUID &id) +{ + const LLInventoryObject* obj = gInventory.getObject(id); + bool can_list = (obj != NULL); + + if (can_list) + { + const LLUUID& object_id = obj->getLinkedUUID(); + can_list = object_id.notNull(); + + if (can_list) + { + std::string error_msg; + const LLUUID& marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS); + if (marketplacelistings_id.notNull()) + { + LLViewerInventoryCategory* master_folder = gInventory.getCategory(marketplacelistings_id); + LLInventoryCategory* cat = gInventory.getCategory(id); + if (cat) + { + can_list = can_move_folder_to_marketplace(master_folder, master_folder, cat, error_msg); + } + else + { + LLInventoryItem* item = gInventory.getItem(id); + can_list = (item ? can_move_item_to_marketplace(master_folder, master_folder, item, error_msg) : false); + } + } + else + { + can_list = false; + } + } + } + + return can_list; +} + +bool check_folder_for_contents_of_type(const LLUUID &id, LLInventoryModel* model, LLInventoryCollectFunctor& is_type) +{ + LLInventoryModel::cat_array_t cat_array; + LLInventoryModel::item_array_t item_array; + model->collectDescendentsIf(id, + cat_array, + item_array, + LLInventoryModel::EXCLUDE_TRASH, + is_type); + return item_array.size() > 0; +} + void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* menu) { LLUUID selected_id = mUUIDs.front(); @@ -409,6 +587,7 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men bool is_in_trash = gInventory.isObjectDescendentOf(selected_id, gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH)); bool is_lost_and_found = (selected_id == gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND)); bool is_outfits= (selected_id == gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS)); + bool is_in_favorites = gInventory.isObjectDescendentOf(selected_id, gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE)); //bool is_favorites= (selected_id == gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE)); bool is_system_folder = false; @@ -456,6 +635,49 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men items.push_back(std::string("open_in_new_window")); items.push_back(std::string("Open Folder Separator")); } + + // wearables related functionality for folders. + LLFindWearables is_wearable; + LLIsType is_object(LLAssetType::AT_OBJECT); + LLIsType is_gesture(LLAssetType::AT_GESTURE); + + if (check_folder_for_contents_of_type(selected_id, &gInventory, is_wearable) + || check_folder_for_contents_of_type(selected_id, &gInventory, is_object) + || check_folder_for_contents_of_type(selected_id, &gInventory, is_gesture)) + { + // Only enable add/replace outfit for non-system folders. + if (!is_system_folder) + { + // Adding an outfit onto another (versus replacing) doesn't make sense. + if (folder_type != LLFolderType::FT_OUTFIT) + { + items.push_back(std::string("Add To Outfit")); + if (!LLAppearanceMgr::instance().getCanAddToCOF(selected_id)) + { + disabled_items.push_back(std::string("Add To Outfit")); + } + } + + items.push_back(std::string("Replace Outfit")); + if (!LLAppearanceMgr::instance().getCanReplaceCOF(selected_id)) + { + disabled_items.push_back(std::string("Replace Outfit")); + } + } + if (is_agent_inventory) + { + items.push_back(std::string("Folder Wearables Separator")); + // Note: If user tries to unwear "My Inventory", it's going to deactivate everything including gestures + // Might be safer to disable this for "My Inventory" + items.push_back(std::string("Remove From Outfit")); + if (folder_type != LLFolderType::FT_ROOT_INVENTORY // Unless COF is empty, whih shouldn't be, warrantied to have worn items + && !LLAppearanceMgr::getCanRemoveFromCOF(selected_id)) // expensive from root! + { + disabled_items.push_back(std::string("Remove From Outfit")); + } + } + items.push_back(std::string("Outfit Separator")); + } } else { @@ -503,11 +725,30 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men } else { + if (is_agent_inventory && !is_inbox && !is_cof && !is_in_favorites && !is_outfits) + { + LLViewerInventoryCategory* category = gInventory.getCategory(selected_id); + if (!category || !LLFriendCardsManager::instance().isCategoryInFriendFolder(category)) + { + items.push_back(std::string("New Folder")); + } + + items.push_back(std::string("create_new")); + items.push_back(std::string("New Script")); + items.push_back(std::string("New Note")); + items.push_back(std::string("New Gesture")); + items.push_back(std::string("New Material")); + items.push_back(std::string("New Clothes")); + items.push_back(std::string("New Body Parts")); + items.push_back(std::string("New Settings")); + } + if(can_share_item(selected_id)) { items.push_back(std::string("Share")); } - if (LLClipboard::instance().hasContents() && is_agent_inventory && !is_cof && !is_inbox_folder(selected_id)) + + if (LLClipboard::instance().hasContents() && is_agent_inventory && !is_cof && !is_inbox) { items.push_back(std::string("Paste")); @@ -519,7 +760,7 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men } if (is_folder && is_agent_inventory) { - if (!is_cof && (folder_type != LLFolderType::FT_OUTFIT) && !is_outfits && !is_inbox_folder(selected_id)) + if (!is_cof && (folder_type != LLFolderType::FT_OUTFIT) && !is_outfits && !is_inbox) { if (!gInventory.isObjectDescendentOf(selected_id, gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD)) && !isRootFolder()) { @@ -625,7 +866,7 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men disabled_items.push_back(std::string("Open")); disabled_items.push_back(std::string("Open Original")); } - + if(LLAssetType::AT_GESTURE == obj->getType()) { items.push_back(std::string("Gesture Separator")); @@ -715,6 +956,54 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men disabled_items.push_back(std::string("New Folder")); disabled_items.push_back(std::string("upload_def")); + disabled_items.push_back(std::string("create_new")); + } + + if (is_agent_inventory && !mRootFolder) + { + items.push_back(std::string("New folder from selected")); + items.push_back(std::string("Subfolder Separator")); + if (!is_only_items_selected(mUUIDs) && !is_only_cats_selected(mUUIDs)) + { + disabled_items.push_back(std::string("New folder from selected")); + } + } + + // Marketplace + bool can_list = false; + const LLUUID marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS); + if (marketplacelistings_id.notNull() && !is_inbox && !obj->getIsLinkType()) + { + if (is_folder) + { + LLViewerInventoryCategory* cat = gInventory.getCategory(selected_id); + if (cat + && !LLFolderType::lookupIsProtectedType(cat->getPreferredType()) + && gInventory.isObjectDescendentOf(selected_id, gInventory.getRootFolderID())) + { + can_list = true; + } + } + else if (selected_item + && selected_item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()) + && selected_item->getPermissions().getOwner() != ALEXANDRIA_LINDEN_ID + && LLAssetType::AT_CALLINGCARD != selected_item->getType()) + { + can_list = true; + } + } + + if (can_list) + { + items.push_back(std::string("Marketplace Separator")); + items.push_back(std::string("Marketplace Copy")); + items.push_back(std::string("Marketplace Move")); + + if (!can_list_on_marketplace(selected_id)) + { + disabled_items.push_back(std::string("Marketplace Copy")); + disabled_items.push_back(std::string("Marketplace Move")); + } } } diff --git a/indra/newview/llinventoryicon.cpp b/indra/newview/llinventoryicon.cpp index a8e59b61c5..94b8c4bebf 100644 --- a/indra/newview/llinventoryicon.cpp +++ b/indra/newview/llinventoryicon.cpp @@ -110,7 +110,7 @@ LLIconDictionary::LLIconDictionary() LLUIImagePtr LLInventoryIcon::getIcon(LLAssetType::EType asset_type, LLInventoryType::EType inventory_type, U32 misc_flag, - BOOL item_is_multi) + bool item_is_multi) { const std::string& icon_name = getIconName(asset_type, inventory_type, misc_flag, item_is_multi); return LLUI::getUIImage(icon_name); @@ -124,7 +124,7 @@ LLUIImagePtr LLInventoryIcon::getIcon(LLInventoryType::EIconName idx) const std::string& LLInventoryIcon::getIconName(LLAssetType::EType asset_type, LLInventoryType::EType inventory_type, U32 misc_flag, - BOOL item_is_multi) + bool item_is_multi) { LLInventoryType::EIconName idx = LLInventoryType::ICONNAME_OBJECT; if (item_is_multi) diff --git a/indra/newview/llinventoryicon.h b/indra/newview/llinventoryicon.h index ca17956252..32e2d8b29d 100644 --- a/indra/newview/llinventoryicon.h +++ b/indra/newview/llinventoryicon.h @@ -37,13 +37,13 @@ public: static const std::string& getIconName(LLAssetType::EType asset_type, LLInventoryType::EType inventory_type = LLInventoryType::IT_NONE, U32 misc_flag = 0, // different meanings depending on item type - BOOL item_is_multi = FALSE); + bool item_is_multi = false); static const std::string& getIconName(LLInventoryType::EIconName idx); static LLPointer<class LLUIImage> getIcon(LLAssetType::EType asset_type, LLInventoryType::EType inventory_type = LLInventoryType::IT_NONE, U32 misc_flag = 0, // different meanings depending on item type - BOOL item_is_multi = FALSE); + bool item_is_multi = false); static LLPointer<class LLUIImage> getIcon(LLInventoryType::EIconName idx); protected: diff --git a/indra/newview/llinventorylistitem.cpp b/indra/newview/llinventorylistitem.cpp index af5319587f..e210975a5a 100644 --- a/indra/newview/llinventorylistitem.cpp +++ b/indra/newview/llinventorylistitem.cpp @@ -158,12 +158,12 @@ void LLPanelInventoryListItemBase::setShowWidget(LLUICtrl* ctrl, bool show) ctrl->setEnabled(show); } -BOOL LLPanelInventoryListItemBase::postBuild() +bool LLPanelInventoryListItemBase::postBuild() { LLViewerInventoryItem* inv_item = getItem(); if (inv_item) { - mIconImage = LLInventoryIcon::getIcon(inv_item->getType(), inv_item->getInventoryType(), inv_item->getFlags(), FALSE); + mIconImage = LLInventoryIcon::getIcon(inv_item->getType(), inv_item->getInventoryType(), inv_item->getFlags(), false); updateItem(inv_item->getName()); } @@ -172,7 +172,7 @@ BOOL LLPanelInventoryListItemBase::postBuild() setWidgetsVisible(false); reshapeWidgets(); - return TRUE; + return true; } void LLPanelInventoryListItemBase::setValue(const LLSD& value) @@ -182,7 +182,7 @@ void LLPanelInventoryListItemBase::setValue(const LLSD& value) mSelected = value["selected"]; } -BOOL LLPanelInventoryListItemBase::handleHover(S32 x, S32 y, MASK mask) +bool LLPanelInventoryListItemBase::handleHover(S32 x, S32 y, MASK mask) { mHovered = true; return LLPanel::handleHover(x, y, mask); @@ -399,13 +399,13 @@ void LLPanelInventoryListItemBase::setTitle(const std::string& title, highlit_text); } -BOOL LLPanelInventoryListItemBase::handleToolTip( S32 x, S32 y, MASK mask) +bool LLPanelInventoryListItemBase::handleToolTip( S32 x, S32 y, MASK mask) { LLRect text_box_rect = mTitleCtrl->getRect(); if (text_box_rect.pointInRect(x, y) && mTitleCtrl->getTextPixelWidth() <= text_box_rect.getWidth()) { - return FALSE; + return false; } return LLPanel::handleToolTip(x, y, mask); } diff --git a/indra/newview/llinventorylistitem.h b/indra/newview/llinventorylistitem.h index 0d10e26633..21540a380b 100644 --- a/indra/newview/llinventorylistitem.h +++ b/indra/newview/llinventorylistitem.h @@ -117,7 +117,7 @@ public: /** * Inheritors need to call base implementation of postBuild() */ - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /** * Handles item selection @@ -130,7 +130,7 @@ public: /*virtual*/ S32 notify(const LLSD& info); /* Highlights item */ - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); /* Removes item highlight */ /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask); @@ -153,7 +153,7 @@ public: LLViewerInventoryItem* getItem() const; void setSeparatorVisible(bool visible) { mSeparatorVisible = visible; } - void resetHighlight() { mHovered = FALSE; } + void resetHighlight() { mHovered = false; } virtual ~LLPanelInventoryListItemBase(){} @@ -194,7 +194,7 @@ protected: /** * Show tool tip if item name text size > panel size */ - virtual BOOL handleToolTip( S32 x, S32 y, MASK mask); + virtual bool handleToolTip( S32 x, S32 y, MASK mask); const LLUUID mInventoryItemUUID; bool mHovered; diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index c6192ddf1a..53ea02983a 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -79,7 +79,7 @@ // Increment this if the inventory contents change in a non-backwards-compatible way. // For viewer 2, the addition of link items makes a pre-viewer-2 cache incorrect. const S32 LLInventoryModel::sCurrentInvCacheVersion = 3; -BOOL LLInventoryModel::sFirstTimeInViewer2 = TRUE; +bool LLInventoryModel::sFirstTimeInViewer2 = true; S32 LLInventoryModel::sPendingSystemFolders = 0; @@ -87,7 +87,7 @@ S32 LLInventoryModel::sPendingSystemFolders = 0; /// Local function declarations, constants, enums, and typedefs ///---------------------------------------------------------------------------- -//BOOL decompress_file(const char* src_filename, const char* dst_filename); +//bool decompress_file(const char* src_filename, const char* dst_filename); static const char PRODUCTION_CACHE_FORMAT_STRING[] = "%s.inv.llsd"; static const char GRID_CACHE_FORMAT_STRING[] = "%s.%s.inv.llsd"; static const char * const LOG_INV("Inventory"); @@ -316,7 +316,7 @@ public: if (LLInventoryState::sWearNewClothing) { LLInventoryState::sWearNewClothingTransactionID = tid; - LLInventoryState::sWearNewClothing = FALSE; + LLInventoryState::sWearNewClothing = false; } if (tid.notNull() && tid == LLInventoryState::sWearNewClothingTransactionID) @@ -333,7 +333,7 @@ public: if (LLInventoryState::sWearNewClothing && wearable_ids.size() > 0) { - LLInventoryState::sWearNewClothing = FALSE; + LLInventoryState::sWearNewClothing = false; size_t count = wearable_ids.size(); for (S32 i = 0; i < count; ++i) @@ -441,7 +441,7 @@ LLInventoryModel::LLInventoryModel() mParentChildCategoryTree(), mParentChildItemTree(), mLastItem(NULL), - mIsNotifyObservers(FALSE), + mIsNotifyObservers(false), mModifyMask(LLInventoryObserver::ALL), mChangedItemIDs(), mBulkFecthCallbackSlot(), @@ -493,10 +493,10 @@ void LLInventoryModel::cleanupInventory() // This is a convenience function to check if one object has a parent // chain up to the category specified by UUID. -BOOL LLInventoryModel::isObjectDescendentOf(const LLUUID& obj_id, +bool LLInventoryModel::isObjectDescendentOf(const LLUUID& obj_id, const LLUUID& cat_id) const { - if (obj_id == cat_id) return TRUE; + if (obj_id == cat_id) return true; const LLInventoryObject* obj = getObject(obj_id); while(obj) @@ -504,17 +504,17 @@ BOOL LLInventoryModel::isObjectDescendentOf(const LLUUID& obj_id, const LLUUID& parent_id = obj->getParentUUID(); if( parent_id.isNull() ) { - return FALSE; + return false; } if(parent_id == cat_id) { - return TRUE; + return true; } // Since we're scanning up the parents, we only need to check // in the category list. obj = getCategory(parent_id); } - return FALSE; + return false; } const LLViewerInventoryCategory *LLInventoryModel::getFirstNondefaultParent(const LLUUID& obj_id) const @@ -657,12 +657,12 @@ LLViewerInventoryCategory* LLInventoryModel::getCategory(const LLUUID& id) const S32 LLInventoryModel::getItemCount() const { - return mItemMap.size(); + return static_cast<S32>(mItemMap.size()); } S32 LLInventoryModel::getCategoryCount() const { - return mCategoryMap.size(); + return static_cast<S32>(mCategoryMap.size()); } // Return the direct descendents of the id provided. The array @@ -782,7 +782,7 @@ void LLInventoryModel::consolidateForType(const LLUUID& main_id, LLFolderType::E for (std::vector<LLUUID>::const_iterator it = list_uuids.begin(); it != list_uuids.end(); ++it) { LLViewerInventoryItem* item = getItem(*it); - changeItemParent(item, main_id, TRUE); + changeItemParent(item, main_id, true); } // Move all folders to the main folder @@ -794,7 +794,7 @@ void LLInventoryModel::consolidateForType(const LLUUID& main_id, LLFolderType::E for (std::vector<LLUUID>::const_iterator it = list_uuids.begin(); it != list_uuids.end(); ++it) { LLViewerInventoryCategory* cat = getCategory(*it); - changeCategoryParent(cat, main_id, TRUE); + changeCategoryParent(cat, main_id, true); } // Purge the emptied folder @@ -805,7 +805,7 @@ void LLInventoryModel::consolidateForType(const LLUUID& main_id, LLFolderType::E const LLUUID trash_id = findCategoryUUIDForType(LLFolderType::FT_TRASH); if (trash_id.notNull()) { - changeCategoryParent(cat, trash_id, TRUE); + changeCategoryParent(cat, trash_id, true); } } remove_inventory_category(folder_id, NULL); @@ -822,17 +822,14 @@ void LLInventoryModel::ensureCategoryForTypeExists(LLFolderType::EType preferred } else if (root_id.notNull()) { - cat_array_t* cats = NULL; - cats = get_ptr_in_map(mParentChildCategoryTree, root_id); + cat_array_t* cats = get_ptr_in_map(mParentChildCategoryTree, root_id); if (cats) { - S32 count = cats->size(); - for (S32 i = 0; i < count; ++i) + for (auto& p_cat : *cats) { - LLViewerInventoryCategory* p_cat = cats->at(i); if (p_cat && p_cat->getPreferredType() == preferred_type) { - const LLUUID& folder_id = cats->at(i)->getUUID(); + const LLUUID& folder_id = p_cat->getUUID(); if (rv.isNull() || folder_id < rv) { rv = folder_id; @@ -891,17 +888,14 @@ const LLUUID LLInventoryModel::findCategoryUUIDForTypeInRoot( } else if (root_id.notNull()) { - cat_array_t* cats = NULL; - cats = get_ptr_in_map(mParentChildCategoryTree, root_id); + cat_array_t* cats = get_ptr_in_map(mParentChildCategoryTree, root_id); if(cats) { - S32 count = cats->size(); - for(S32 i = 0; i < count; ++i) + for (auto& p_cat : *cats) { - LLViewerInventoryCategory* p_cat = cats->at(i); if(p_cat && p_cat->getPreferredType() == preferred_type) { - const LLUUID& folder_id = cats->at(i)->getUUID(); + const LLUUID& folder_id = p_cat->getUUID(); if (rv.isNull() || folder_id < rv) { rv = folder_id; @@ -1257,14 +1251,14 @@ public: virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item) { - return TRUE; + return true; } }; void LLInventoryModel::collectDescendents(const LLUUID& id, cat_array_t& cats, item_array_t& items, - BOOL include_trash) + bool include_trash) { LLAlwaysCollect always; collectDescendentsIf(id, cats, items, include_trash, always); @@ -1273,7 +1267,7 @@ void LLInventoryModel::collectDescendents(const LLUUID& id, void LLInventoryModel::collectDescendentsIf(const LLUUID& id, cat_array_t& cats, item_array_t& items, - BOOL include_trash, + bool include_trash, LLInventoryCollectFunctor& add) { // Start with categories @@ -1286,10 +1280,8 @@ void LLInventoryModel::collectDescendentsIf(const LLUUID& id, cat_array_t* cat_array = get_ptr_in_map(mParentChildCategoryTree, id); if(cat_array) { - S32 count = cat_array->size(); - for(S32 i = 0; i < count; ++i) + for (auto& cat : *cat_array) { - LLViewerInventoryCategory* cat = cat_array->at(i); if(add(cat,NULL)) { cats.push_back(cat); @@ -1298,16 +1290,13 @@ void LLInventoryModel::collectDescendentsIf(const LLUUID& id, } } - LLViewerInventoryItem* item = NULL; item_array_t* item_array = get_ptr_in_map(mParentChildItemTree, id); // Move onto items if(item_array) { - S32 count = item_array->size(); - for(S32 i = 0; i < count; ++i) + for (auto& item : *item_array) { - item = item_array->at(i); if(add(NULL, item)) { items.push_back(item); @@ -1400,7 +1389,9 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item, U32 mask) return mask; } - if (item->getType() == LLAssetType::AT_MESH) + if (item->getType() == LLAssetType::AT_MESH || + item->getType() == LLAssetType::AT_GLTF || + item->getType() == LLAssetType::AT_GLTF_BIN) { return mask; } @@ -1474,7 +1465,7 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item, U32 mask) { // Parent id at server is null, so update server even if item already is in the same folder old_item->setParent(new_parent_id); - new_item->updateParentOnServer(FALSE); + new_item->updateParentOnServer(false); } mask |= LLInventoryObserver::INTERNAL; } @@ -1495,7 +1486,7 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item, U32 mask) gInventory.accountForUpdate(update); // *FIX: bit of a hack to call update server from here... - new_item->updateParentOnServer(FALSE); + new_item->updateParentOnServer(false); item_array->push_back(new_item); } else @@ -1540,7 +1531,7 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item, U32 mask) gInventory.accountForUpdate(update); // *FIX: bit of a hack to call update server from // here... - new_item->updateParentOnServer(FALSE); + new_item->updateParentOnServer(false); item_array->push_back(new_item); } else @@ -1558,7 +1549,7 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item, U32 mask) // Target ID is stored in the description field of the card. LLUUID id; std::string desc = new_item->getDescription(); - BOOL isId = desc.empty() ? FALSE : id.set(desc, FALSE); + bool isId = desc.empty() ? false : id.set(desc, false); if (isId) { // Valid UUID; set the item UUID and rename it @@ -1593,7 +1584,7 @@ LLInventoryModel::cat_array_t* LLInventoryModel::getUnlockedCatArray(const LLUUI cat_array_t* cat_array = get_ptr_in_map(mParentChildCategoryTree, id); if (cat_array) { - llassert_always(mCategoryLock[id] == false); + llassert_always(!mCategoryLock[id]); } return cat_array; } @@ -1603,7 +1594,7 @@ LLInventoryModel::item_array_t* LLInventoryModel::getUnlockedItemArray(const LLU item_array_t* item_array = get_ptr_in_map(mParentChildItemTree, id); if (item_array) { - llassert_always(mItemLock[id] == false); + llassert_always(!mItemLock[id]); } return item_array; } @@ -1675,8 +1666,8 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat, U32 } // make space in the tree for this category's children. - llassert_always(mCategoryLock[new_cat->getUUID()] == false); - llassert_always(mItemLock[new_cat->getUUID()] == false); + llassert_always(!mCategoryLock[new_cat->getUUID()]); + llassert_always(!mItemLock[new_cat->getUUID()]); cat_array_t* catsp = new cat_array_t; item_array_t* itemsp = new item_array_t; mParentChildCategoryTree[new_cat->getUUID()] = catsp; @@ -1732,7 +1723,7 @@ void LLInventoryModel::moveObject(const LLUUID& object_id, const LLUUID& cat_id) // Migrated from llinventoryfunctions void LLInventoryModel::changeItemParent(LLViewerInventoryItem* item, const LLUUID& new_parent_id, - BOOL restamp) + bool restamp) { if (item->getParentUUID() == new_parent_id) { @@ -1760,7 +1751,7 @@ void LLInventoryModel::changeItemParent(LLViewerInventoryItem* item, // Migrated from llinventoryfunctions void LLInventoryModel::changeCategoryParent(LLViewerInventoryCategory* cat, const LLUUID& new_parent_id, - BOOL restamp) + bool restamp) { if (!cat) { @@ -1906,10 +1897,10 @@ void LLInventoryModel::onDescendentsPurgedFromServer(const LLUUID& object_id, bo categories, items, LLInventoryModel::INCLUDE_TRASH); - S32 count = items.size(); + auto count = items.size(); LLUUID uu_id; - for(S32 i = 0; i < count; ++i) + for(size_t i = 0; i < count; ++i) { uu_id = items.at(i)->getUUID(); @@ -1985,7 +1976,7 @@ void LLInventoryModel::onObjectDeletedFromServer(const LLUUID& object_id, bool f LLViewerInventoryItem *item = getItem(object_id); if (item && (item->getType() != LLAssetType::AT_LSL_TEXT)) { - LLPreview::hide(object_id, TRUE); + LLPreview::hide(object_id, true); } deleteObject(object_id, fix_broken_links, do_notify_observers); } @@ -2104,7 +2095,7 @@ void LLInventoryModel::removeObserver(LLInventoryObserver* observer) mObservers.erase(observer); } -BOOL LLInventoryModel::containsObserver(LLInventoryObserver* observer) const +bool LLInventoryModel::containsObserver(LLInventoryObserver* observer) const { return mObservers.find(observer) != mObservers.end(); } @@ -2147,7 +2138,7 @@ void LLInventoryModel::notifyObservers() return; } - mIsNotifyObservers = TRUE; + mIsNotifyObservers = true; for (observer_list_t::iterator iter = mObservers.begin(); iter != mObservers.end(); ) { @@ -2170,7 +2161,7 @@ void LLInventoryModel::notifyObservers() mChangedItemIDsBacklog.clear(); mAddedItemIDsBacklog.clear(); - mIsNotifyObservers = FALSE; + mIsNotifyObservers = false; } // store flag for change @@ -2689,8 +2680,8 @@ bool LLInventoryModel::loadSkeleton( } } - S32 cached_category_count = 0; - S32 cached_item_count = 0; + size_t cached_category_count = 0; + size_t cached_item_count = 0; if(!temp_cats.empty()) { update_map_t child_counts; @@ -2739,12 +2730,10 @@ bool LLInventoryModel::loadSkeleton( // found to generate a set of categories we should add. We // will go through each category loaded and if the version // does not match, invalidate the version. - S32 count = categories.size(); cat_set_t::iterator not_cached = temp_cats.end(); - std::set<LLUUID> cached_ids; - for(S32 i = 0; i < count; ++i) + uuid_set_t cached_ids; + for (auto& cat : categories) { - LLViewerInventoryCategory* cat = categories[i]; cat_set_t::iterator cit = temp_cats.find(cat); if (cit == temp_cats.end()) { @@ -2965,13 +2954,13 @@ void LLInventoryModel::buildParentChildMap() cats.push_back(cat); if (mParentChildCategoryTree.count(cat->getUUID()) == 0) { - llassert_always(mCategoryLock[cat->getUUID()] == false); + llassert_always(!mCategoryLock[cat->getUUID()]); catsp = new cat_array_t; mParentChildCategoryTree[cat->getUUID()] = catsp; } if (mParentChildItemTree.count(cat->getUUID()) == 0) { - llassert_always(mItemLock[cat->getUUID()] == false); + llassert_always(!mItemLock[cat->getUUID()]); itemsp = new item_array_t; mParentChildItemTree[cat->getUUID()] = itemsp; } @@ -2990,13 +2979,11 @@ void LLInventoryModel::buildParentChildMap() // Now we have a structure with all of the categories that we can // iterate over and insert into the correct place in the child // category tree. - S32 count = cats.size(); S32 i; S32 lost = 0; cat_array_t lost_cats; - for(i = 0; i < count; ++i) + for (auto& cat : cats) { - LLViewerInventoryCategory* cat = cats.at(i); catsp = getUnlockedCatArray(cat->getParentUUID()); if(catsp && // Only the two root folders should be children of null. @@ -3050,10 +3037,10 @@ void LLInventoryModel::buildParentChildMap() // FIXME note that updateServer() fails with protected // types, so this will not work as intended in that case. // UpdateServer uses AIS, AIS cat move is not implemented yet - // cat->updateServer(TRUE); + // cat->updateServer(true); // MoveInventoryFolder message, intentionally per item - cat->updateParentOnServer(FALSE); + cat->updateParentOnServer(false); catsp = getUnlockedCatArray(cat->getParentUUID()); if(catsp) { @@ -3065,7 +3052,7 @@ void LLInventoryModel::buildParentChildMap() } } - const BOOL COF_exists = (findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT) != LLUUID::null); + const bool COF_exists = (findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT) != LLUUID::null); sFirstTimeInViewer2 = !COF_exists || gAgent.isFirstLogin(); @@ -3082,13 +3069,10 @@ void LLInventoryModel::buildParentChildMap() items.push_back(item); } } - count = items.size(); lost = 0; uuid_vec_t lost_item_ids; - for(i = 0; i < count; ++i) + for (auto& item : items) { - LLPointer<LLViewerInventoryItem> item; - item = items.at(i); itemsp = getUnlockedItemArray(item->getParentUUID()); if(itemsp) { @@ -3121,18 +3105,18 @@ void LLInventoryModel::buildParentChildMap() { LL_WARNS(LOG_INV) << "Found " << lost << " lost items." << LL_ENDL; LLMessageSystem* msg = gMessageSystem; - BOOL start_new_message = TRUE; + bool start_new_message = true; const LLUUID lnf = findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND); for(uuid_vec_t::iterator it = lost_item_ids.begin() ; it < lost_item_ids.end(); ++it) { if(start_new_message) { - start_new_message = FALSE; + start_new_message = false; msg->newMessageFast(_PREHASH_MoveInventoryItem); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->addBOOLFast(_PREHASH_Stamp, FALSE); + msg->addBOOLFast(_PREHASH_Stamp, false); } msg->nextBlockFast(_PREHASH_InventoryData); msg->addUUIDFast(_PREHASH_ItemID, (*it)); @@ -3140,7 +3124,7 @@ void LLInventoryModel::buildParentChildMap() msg->addString("NewName", NULL); if(msg->isSendFull(NULL)) { - start_new_message = TRUE; + start_new_message = true; gAgent.sendReliableMessage(); } } @@ -3469,12 +3453,9 @@ bool LLInventoryModel::saveToFile(const std::string& filename, fileXML << LLSDOStreamer<LLSDNotationFormatter>(cache_ver) << std::endl; - S32 count = categories.size(); S32 cat_count = 0; - S32 i; - for (i = 0; i < count; ++i) + for (auto& cat : categories) { - LLViewerInventoryCategory* cat = categories[i]; if (cat->getVersion() != LLViewerInventoryCategory::VERSION_UNKNOWN) { fileXML << LLSDOStreamer<LLSDNotationFormatter>(cat->exportLLSD()) << std::endl; @@ -3488,10 +3469,10 @@ bool LLInventoryModel::saveToFile(const std::string& filename, } } - S32 it_count = items.size(); - for (i = 0; i < it_count; ++i) + auto it_count = items.size(); + for (auto& item : items) { - fileXML << LLSDOStreamer<LLSDNotationFormatter>(items[i]->asLLSD()) << std::endl; + fileXML << LLSDOStreamer<LLSDNotationFormatter>(item->asLLSD()) << std::endl; if (fileXML.fail()) { @@ -3952,16 +3933,14 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) if (LLInventoryState::sWearNewClothing) { LLInventoryState::sWearNewClothingTransactionID = tid; - LLInventoryState::sWearNewClothing = FALSE; + LLInventoryState::sWearNewClothing = false; } if (tid.notNull() && tid == LLInventoryState::sWearNewClothingTransactionID) { - count = wearable_ids.size(); - for (i = 0; i < count; ++i) + for (const auto& wearable_id : wearable_ids) { - LLViewerInventoryItem* wearable_item; - wearable_item = gInventory.getItem(wearable_ids[i]); + LLViewerInventoryItem* wearable_item = gInventory.getItem(wearable_id); LLAppearanceMgr::instance().wearItemOnAvatar(wearable_item->getUUID(), true, true); } } @@ -4056,7 +4035,7 @@ void LLInventoryModel::emptyFolderType(const std::string notification, LLFolderT LLInventoryModel::item_array_t items; const LLUUID trash_id = findCategoryUUIDForType(preferred_type); gInventory.collectDescendents(trash_id, cats, items, LLInventoryModel::INCLUDE_TRASH); //All descendants - S32 item_count = items.size() + cats.size(); + S32 item_count = static_cast<S32>(items.size() + cats.size()); args["COUNT"] = item_count; } LLNotificationsUtil::add(notification, args, LLSD(), @@ -4084,7 +4063,7 @@ void LLInventoryModel::removeItem(const LLUUID& item_id) if (new_parent.notNull()) { LL_INFOS("Inventory") << "Moving to Trash (" << new_parent << "):" << LL_ENDL; - changeItemParent(item, new_parent, TRUE); + changeItemParent(item, new_parent, true); } } } @@ -4099,7 +4078,7 @@ void LLInventoryModel::removeCategory(const LLUUID& category_id) // Look for any gestures and deactivate them LLInventoryModel::cat_array_t descendent_categories; LLInventoryModel::item_array_t descendent_items; - collectDescendents(category_id, descendent_categories, descendent_items, FALSE); + collectDescendents(category_id, descendent_categories, descendent_items, false); for (LLInventoryModel::item_array_t::const_iterator iter = descendent_items.begin(); iter != descendent_items.end(); @@ -4120,7 +4099,7 @@ void LLInventoryModel::removeCategory(const LLUUID& category_id) const LLUUID trash_id = findCategoryUUIDForType(LLFolderType::FT_TRASH); if (trash_id.notNull()) { - changeCategoryParent(cat, trash_id, TRUE); + changeCategoryParent(cat, trash_id, true); } } @@ -4178,7 +4157,7 @@ void LLInventoryModel::checkTrashOverflow() LLInventoryModel::item_array_t items; const LLUUID trash_id = findCategoryUUIDForType(LLFolderType::FT_TRASH); gInventory.collectDescendents(trash_id, cats, items, LLInventoryModel::INCLUDE_TRASH); - S32 item_count = items.size() + cats.size(); + auto item_count = items.size() + cats.size(); if (item_count >= trash_max_capacity) { @@ -4226,13 +4205,13 @@ void LLInventoryModel::setLibraryOwnerID(const LLUUID& val) } // static -BOOL LLInventoryModel::getIsFirstTimeInViewer2() +bool LLInventoryModel::getIsFirstTimeInViewer2() { // Do not call this before parentchild map is built. if (!gInventory.mIsAgentInvUsable) { LL_WARNS() << "Parent Child Map not yet built; guessing as first time in viewer2." << LL_ENDL; - return TRUE; + return true; } return sFirstTimeInViewer2; @@ -4851,9 +4830,9 @@ std::string LLInventoryModel::getFullPath(const LLInventoryObject *obj) const #if 0 -BOOL decompress_file(const char* src_filename, const char* dst_filename) +bool decompress_file(const char* src_filename, const char* dst_filename) { - BOOL rv = FALSE; + bool rv = false; gzFile src = NULL; U8* buffer = NULL; LLFILE* dst = NULL; @@ -4881,7 +4860,7 @@ BOOL decompress_file(const char* src_filename, const char* dst_filename) } while(gzeof(src) == 0); // success - rv = TRUE; + rv = true; err_decompress: if(src != NULL) gzclose(src); @@ -4987,7 +4966,7 @@ void LLInventoryModel::FetchItemHttpHandler::processData(LLSD & content, LLCore: LLInventoryModel::update_map_t update; LLUUID folder_id; LLSD content_items(content["items"]); - const S32 count(content_items.size()); + const S32 count(static_cast<S32>(content_items.size())); // Does this loop ever execute more than once? for (S32 i(0); i < count; ++i) diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h index e179f4a740..1472b705e4 100644 --- a/indra/newview/llinventorymodel.h +++ b/indra/newview/llinventorymodel.h @@ -225,11 +225,11 @@ private: // Login //-------------------------------------------------------------------- public: - static BOOL getIsFirstTimeInViewer2(); + static bool getIsFirstTimeInViewer2(); static bool isSysFoldersReady() { return (sPendingSystemFolders == 0); } private: - static BOOL sFirstTimeInViewer2; + static bool sFirstTimeInViewer2; const static S32 sCurrentInvCacheVersion; // expected inventory cache version static S32 sPendingSystemFolders; @@ -272,8 +272,8 @@ public: // Do not store a copy of the pointers collected - use them, and // collect them again later if you need to reference the same objects. enum { - EXCLUDE_TRASH = FALSE, - INCLUDE_TRASH = TRUE + EXCLUDE_TRASH = false, + INCLUDE_TRASH = true }; // Simpler existence test if matches don't actually need to be collected. bool hasMatchingDirectDescendent(const LLUUID& cat_id, @@ -281,11 +281,11 @@ public: void collectDescendents(const LLUUID& id, cat_array_t& categories, item_array_t& items, - BOOL include_trash); + bool include_trash); void collectDescendentsIf(const LLUUID& id, cat_array_t& categories, item_array_t& items, - BOOL include_trash, + bool include_trash, LLInventoryCollectFunctor& add); // Collect all items in inventory that are linked to item_id. @@ -293,7 +293,7 @@ public: item_array_t collectLinksTo(const LLUUID& item_id); // Check if one object has a parent chain up to the category specified by UUID. - BOOL isObjectDescendentOf(const LLUUID& obj_id, const LLUUID& cat_id) const; + bool isObjectDescendentOf(const LLUUID& obj_id, const LLUUID& cat_id) const; enum EAncestorResult{ ANCESTOR_OK = 0, @@ -404,12 +404,12 @@ public: // Migrated from llinventoryfunctions void changeItemParent(LLViewerInventoryItem* item, const LLUUID& new_parent_id, - BOOL restamp); + bool restamp); // Migrated from llinventoryfunctions void changeCategoryParent(LLViewerInventoryCategory* cat, const LLUUID& new_parent_id, - BOOL restamp); + bool restamp); // Marks links from a "possibly" broken list for a rebuild // clears the list @@ -577,7 +577,7 @@ protected: private: // Flag set when notifyObservers is being called, to look for bugs // where it's called recursively. - BOOL mIsNotifyObservers; + bool mIsNotifyObservers; // Variables used to track what has changed since the last notify. U32 mModifyMask; changed_items_t mChangedItemIDs; @@ -599,7 +599,7 @@ public: // If the observer is destroyed, be sure to remove it. void addObserver(LLInventoryObserver* observer); void removeObserver(LLInventoryObserver* observer); - BOOL containsObserver(LLInventoryObserver* observer) const; + bool containsObserver(LLInventoryObserver* observer) const; private: typedef std::set<LLInventoryObserver*> observer_list_t; observer_list_t mObservers; diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp index 77cf5bdcf2..d9ace1542b 100644 --- a/indra/newview/llinventorymodelbackgroundfetch.cpp +++ b/indra/newview/llinventorymodelbackgroundfetch.cpp @@ -250,7 +250,7 @@ bool LLInventoryModelBackgroundFetch::isEverythingFetched() const return mAllRecursiveFoldersFetched; } -BOOL LLInventoryModelBackgroundFetch::folderFetchActive() const +bool LLInventoryModelBackgroundFetch::folderFetchActive() const { return mFolderFetchActive; } @@ -751,7 +751,7 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis() // Reserve one request for actions outside of fetch (like renames) const U32 max_concurrent_fetches = llclamp(ais_pool - 1, 1, 50); - if (mFetchCount >= max_concurrent_fetches) + if ((U32)mFetchCount >= max_concurrent_fetches) { return; } @@ -764,7 +764,7 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis() const F64 end_time = curent_time + max_time; S32 last_fetch_count = mFetchCount; - while (!mFetchFolderQueue.empty() && mFetchCount < max_concurrent_fetches && curent_time < end_time) + while (!mFetchFolderQueue.empty() && (U32)mFetchCount < max_concurrent_fetches && curent_time < end_time) { const FetchQueueInfo & fetch_info(mFetchFolderQueue.front()); bulkFetchViaAis(fetch_info); @@ -775,7 +775,7 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis() // Ideally we shouldn't fetch items if recursive fetch isn't done, // but there is a chance some request will start timeouting and recursive // fetch will get stuck on a signle folder, don't block item fetch in such case - while (!mFetchItemQueue.empty() && mFetchCount < max_concurrent_fetches && curent_time < end_time) + while (!mFetchItemQueue.empty() && (U32)mFetchCount < max_concurrent_fetches && curent_time < end_time) { const FetchQueueInfo& fetch_info(mFetchItemQueue.front()); bulkFetchViaAis(fetch_info); @@ -1126,8 +1126,8 @@ void LLInventoryModelBackgroundFetch::bulkFetch() folder_sd["folder_id"] = cat->getUUID(); folder_sd["owner_id"] = cat->getOwnerID(); folder_sd["sort_order"] = LLSD::Integer(sort_order); - folder_sd["fetch_folders"] = LLSD::Boolean(TRUE); //(LLSD::Boolean)sFullFetchStarted; - folder_sd["fetch_items"] = LLSD::Boolean(TRUE); + folder_sd["fetch_folders"] = LLSD::Boolean(true); //(LLSD::Boolean)sFullFetchStarted; + folder_sd["fetch_items"] = LLSD::Boolean(true); if (ALEXANDRIA_LINDEN_ID == cat->getOwnerID()) { @@ -1409,7 +1409,7 @@ void BGFolderHttpHandler::processData(LLSD & content, LLCore::HttpResponse * res gInventory.accountForUpdate(update); titem->setParent(lost_uuid); - titem->updateParentOnServer(FALSE); + titem->updateParentOnServer(false); gInventory.updateItem(titem); } } @@ -1513,7 +1513,7 @@ void BGFolderHttpHandler::processFailure(LLCore::HttpStatus status, LLCore::Http return; } - S32 size = mRequestSD["folders"].size(); + auto size = mRequestSD["folders"].size(); if (size > 1) { @@ -1530,7 +1530,7 @@ void BGFolderHttpHandler::processFailure(LLCore::HttpStatus status, LLCore::Http { recursive_cats.push_back(folder_id); } - if (folders.size() == (S32)(size / 2)) + if (folders.size() == (size / 2)) { LLSD request_body; request_body["folders"] = folders; @@ -1571,7 +1571,7 @@ void BGFolderHttpHandler::processFailure(LLCore::HttpStatus status, LLCore::Http { LLSD folder_sd(*folder_it); LLUUID folder_id(folder_sd["folder_id"].asUUID()); - const BOOL recursive = getIsRecursive(folder_id); + const bool recursive = getIsRecursive(folder_id); fetcher->addRequestAtFront(folder_id, recursive, true); } } @@ -1608,7 +1608,7 @@ void BGFolderHttpHandler::processFailure(const char * const reason, LLCore::Http { LLSD folder_sd(*folder_it); LLUUID folder_id(folder_sd["folder_id"].asUUID()); - const BOOL recursive = getIsRecursive(folder_id); + const bool recursive = getIsRecursive(folder_id); fetcher->addRequestAtFront(folder_id, recursive, true); } } diff --git a/indra/newview/llinventorymodelbackgroundfetch.h b/indra/newview/llinventorymodelbackgroundfetch.h index 54077b71b2..b3fbe66c69 100644 --- a/indra/newview/llinventorymodelbackgroundfetch.h +++ b/indra/newview/llinventorymodelbackgroundfetch.h @@ -60,7 +60,7 @@ public: // AIS3 only void fetchCOF(nullary_func_t callback); - BOOL folderFetchActive() const; + bool folderFetchActive() const; bool isEverythingFetched() const; // completing the fetch once per session should be sufficient bool libraryFetchStarted() const; diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index 1c76c154a1..ac791e224e 100644 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -85,7 +85,7 @@ LLInventoryFetchObserver::LLInventoryFetchObserver(const uuid_vec_t& ids) setFetchIDs(ids); } -BOOL LLInventoryFetchObserver::isFinished() const +bool LLInventoryFetchObserver::isFinished() const { return mIncomplete.empty(); } @@ -454,14 +454,14 @@ void LLInventoryFetchDescendentsObserver::startFetch() } } -BOOL LLInventoryFetchDescendentsObserver::isCategoryComplete(const LLViewerInventoryCategory* cat) const +bool LLInventoryFetchDescendentsObserver::isCategoryComplete(const LLViewerInventoryCategory* cat) const { const S32 version = cat->getVersion(); const S32 expected_num_descendents = cat->getDescendentCount(); if ((version == LLViewerInventoryCategory::VERSION_UNKNOWN) || (expected_num_descendents == LLViewerInventoryCategory::DESCENDENT_COUNT_UNKNOWN)) { - return FALSE; + return false; } // it might be complete - check known descendents against // currently available. @@ -475,14 +475,14 @@ BOOL LLInventoryFetchDescendentsObserver::isCategoryComplete(const LLViewerInven // that the cat just doesn't have any items or subfolders). // Unrecoverable, so just return done so that this observer can be cleared // from memory. - return TRUE; + return true; } - const S32 current_num_known_descendents = cats->size() + items->size(); + const S32 current_num_known_descendents = static_cast<S32>(cats->size() + items->size()); // Got the number of descendents that we were expecting, so we're done. if (current_num_known_descendents == expected_num_descendents) { - return TRUE; + return true; } // Error condition, but recoverable. This happens if something was added to the @@ -492,9 +492,9 @@ BOOL LLInventoryFetchDescendentsObserver::isCategoryComplete(const LLViewerInven { LL_WARNS() << "Category '" << cat->getName() << "' expected descendentcount:" << expected_num_descendents << " descendents but got descendentcount:" << current_num_known_descendents << LL_ENDL; const_cast<LLViewerInventoryCategory *>(cat)->setDescendentCount(current_num_known_descendents); - return TRUE; + return true; } - return FALSE; + return false; } LLInventoryFetchComboObserver::LLInventoryFetchComboObserver(const uuid_vec_t& folder_ids, @@ -715,7 +715,7 @@ void LLInventoryCategoriesObserver::changed(U32 mask) continue; } - const S32 current_num_known_descendents = cats->size() + items->size(); + const S32 current_num_known_descendents = static_cast<S32>(cats->size() + items->size()); bool cat_changed = false; @@ -795,7 +795,7 @@ bool LLInventoryCategoriesObserver::addCategory(const LLUUID& cat_id, callback_t } else { - current_num_known_descendents = cats->size() + items->size(); + current_num_known_descendents = static_cast<S32>(cats->size() + items->size()); } } diff --git a/indra/newview/llinventoryobserver.h b/indra/newview/llinventoryobserver.h index 43bcf14d89..950b02d3cf 100644 --- a/indra/newview/llinventoryobserver.h +++ b/indra/newview/llinventoryobserver.h @@ -80,7 +80,7 @@ public: void setFetchID(const LLUUID& id); void setFetchIDs(const uuid_vec_t& ids); - BOOL isFinished() const; + bool isFinished() const; virtual void startFetch() = 0; virtual void changed(U32 mask) = 0; @@ -131,7 +131,7 @@ public: virtual void startFetch(); /*virtual*/ void changed(U32 mask); protected: - BOOL isCategoryComplete(const LLViewerInventoryCategory* cat) const; + bool isCategoryComplete(const LLViewerInventoryCategory* cat) const; }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 6f8a33933f..43bfe76b7f 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -377,7 +377,7 @@ void LLInventoryPanel::initializeViewBuilding() } /*virtual*/ -void LLInventoryPanel::onVisibilityChange(BOOL new_visibility) +void LLInventoryPanel::onVisibilityChange(bool new_visibility) { if (new_visibility && mViewsInitialized == VIEWS_UNINITIALIZED) { @@ -476,7 +476,7 @@ U32 LLInventoryPanel::getSortOrder() const return getFolderViewModel()->getSorter().getSortOrder(); } -void LLInventoryPanel::setSinceLogoff(BOOL sl) +void LLInventoryPanel::setSinceLogoff(bool sl) { getFilter().setDateRangeLastLogoff(sl); } @@ -563,7 +563,7 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve view_item->refresh(); } LLFolderViewFolder* parent = view_item->getParentFolder(); - if(parent) + if(parent && parent->getViewModelItem()) { parent->getViewModelItem()->dirtyDescendantsFilter(); } @@ -614,7 +614,7 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve // Sort the folder. if (mask & LLInventoryObserver::SORT) { - if (view_folder) + if (view_folder && view_folder->getViewModelItem()) { view_folder->getViewModelItem()->requestSort(); } @@ -645,7 +645,7 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve // Select any newly created object that has the auto rename at top of folder root set. if(mFolderRoot.get()->getRoot()->needsAutoRename()) { - setSelection(item_id, FALSE); + setSelection(item_id, false); } updateFolderLabel(model_item->getParentUUID()); } @@ -659,7 +659,8 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve // Don't process the item if it is the root if (old_parent) { - LLFolderViewModelItemInventory* viewmodel_folder = static_cast<LLFolderViewModelItemInventory*>(old_parent->getViewModelItem()); + LLFolderViewModelItem* old_parent_vmi = old_parent->getViewModelItem(); + LLFolderViewModelItemInventory* viewmodel_folder = static_cast<LLFolderViewModelItemInventory*>(old_parent_vmi); LLFolderViewFolder* new_parent = (LLFolderViewFolder*)getItemByID(model_item->getParentUUID()); // Item has been moved. if (old_parent != new_parent) @@ -674,7 +675,7 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve const LLUUID trash_id = mInventory->findCategoryUUIDForType(LLFolderType::FT_TRASH); if (trash_id != model_item->getParentUUID() && (mask & LLInventoryObserver::INTERNAL) && new_parent->isOpen()) { - setSelection(item_id, FALSE); + setSelection(item_id, false); } } updateFolderLabel(model_item->getParentUUID()); @@ -693,7 +694,10 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve { updateFolderLabel(viewmodel_folder->getUUID()); } - old_parent->getViewModelItem()->dirtyDescendantsFilter(); + if (old_parent_vmi) + { + old_parent_vmi->dirtyDescendantsFilter(); + } } } } @@ -709,11 +713,15 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve view_item->destroyView(); if(parent) { - parent->getViewModelItem()->dirtyDescendantsFilter(); - LLFolderViewModelItemInventory* viewmodel_folder = static_cast<LLFolderViewModelItemInventory*>(parent->getViewModelItem()); - if(viewmodel_folder) + LLFolderViewModelItem* parent_wmi = parent->getViewModelItem(); + if (parent_wmi) { - updateFolderLabel(viewmodel_folder->getUUID()); + parent_wmi->dirtyDescendantsFilter(); + LLFolderViewModelItemInventory* viewmodel_folder = static_cast<LLFolderViewModelItemInventory*>(parent_wmi); + if (viewmodel_folder) + { + updateFolderLabel(viewmodel_folder->getUUID()); + } } } } @@ -883,16 +891,16 @@ void LLInventoryPanel::idle(void* user_data) EAcceptance last_accept = LLToolDragAndDrop::getInstance()->getLastAccept(); if (last_accept == ACCEPT_YES_SINGLE || last_accept == ACCEPT_YES_COPY_SINGLE) { - panel->mFolderRoot.get()->setShowSingleSelection(TRUE); + panel->mFolderRoot.get()->setShowSingleSelection(true); } else { - panel->mFolderRoot.get()->setShowSingleSelection(FALSE); + panel->mFolderRoot.get()->setShowSingleSelection(false); } } else { - panel->mFolderRoot.get()->setShowSingleSelection(FALSE); + panel->mFolderRoot.get()->setShowSingleSelection(false); } } else @@ -946,14 +954,14 @@ void LLInventoryPanel::initializeViews(F64 max_time) LLFolderViewFolder* lib_folder = getFolderByID(gInventory.getLibraryRootFolderID()); if (lib_folder) { - lib_folder->setOpen(TRUE); + lib_folder->setOpen(true); } // Auto close the user's my inventory folder LLFolderViewFolder* my_inv_folder = getFolderByID(gInventory.getRootFolderID()); if (my_inv_folder) { - my_inv_folder->setOpenArrangeRecursively(FALSE, LLFolderViewFolder::RECURSE_DOWN); + my_inv_folder->setOpenArrangeRecursively(false, LLFolderViewFolder::RECURSE_DOWN); } } } @@ -1142,7 +1150,7 @@ LLFolderViewItem* LLInventoryPanel::buildViewsTree(const LLUUID& id, // In the case of the root folder been shown, open that folder by default once the widget is created if (create_root) { - folder_view_item->setOpen(TRUE); + folder_view_item->setOpen(true); } } } @@ -1220,7 +1228,7 @@ LLFolderViewItem* LLInventoryPanel::buildViewsTree(const LLUUID& id, // Make sure panel won't lock in a loop over existing items if // folder is enormous and at least some work gets done const S32 MIN_ITEMS_PER_CALL = 500; - const S32 starting_item_count = mItemMap.size(); + const S32 starting_item_count = static_cast<S32>(mItemMap.size()); LLFolderViewFolder *parentp = dynamic_cast<LLFolderViewFolder*>(folder_view_item); bool done = true; @@ -1251,7 +1259,7 @@ LLFolderViewItem* LLInventoryPanel::buildViewsTree(const LLUUID& id, if (!mBuildChildrenViews && mode == BUILD_TIMELIMIT - && MIN_ITEMS_PER_CALL + starting_item_count < mItemMap.size()) + && MIN_ITEMS_PER_CALL + starting_item_count < static_cast<S32>(mItemMap.size())) { // Single folder view, check if we still have time // @@ -1326,7 +1334,7 @@ void LLInventoryPanel::openStartFolderOrMyInventory() && fchild->getViewModelItem() && fchild->getViewModelItem()->getName() == "My Inventory") { - fchild->setOpen(TRUE); + fchild->setOpen(true); break; } } @@ -1348,13 +1356,13 @@ void LLInventoryPanel::openSelected() void LLInventoryPanel::unSelectAll() { - mFolderRoot.get()->setSelection(NULL, FALSE, FALSE); + mFolderRoot.get()->setSelection(NULL, false, false); } -BOOL LLInventoryPanel::handleHover(S32 x, S32 y, MASK mask) +bool LLInventoryPanel::handleHover(S32 x, S32 y, MASK mask) { - BOOL handled = LLView::handleHover(x, y, mask); + bool handled = LLView::handleHover(x, y, mask); if(handled) { // getCursor gets current cursor, setCursor sets next cursor @@ -1370,10 +1378,10 @@ BOOL LLInventoryPanel::handleHover(S32 x, S32 y, MASK mask) { getWindow()->setCursor(UI_CURSOR_ARROW); } - return TRUE; + return true; } -BOOL LLInventoryPanel::handleToolTip(S32 x, S32 y, MASK mask) +bool LLInventoryPanel::handleToolTip(S32 x, S32 y, MASK mask) { if (const LLFolderViewItem* hover_item_p = (!mFolderRoot.isDead()) ? mFolderRoot.get()->getHoveredItem() : nullptr) { @@ -1398,19 +1406,19 @@ BOOL LLInventoryPanel::handleToolTip(S32 x, S32 y, MASK mask) .delay_time(LLView::getTooltipTimeout()) .create_callback(boost::bind(&LLInspectTextureUtil::createInventoryToolTip, _1)) .create_params(params)); - return TRUE; + return true; } } return LLPanel::handleToolTip(x, y, mask); } -BOOL LLInventoryPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +bool LLInventoryPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) { - BOOL handled = FALSE; + bool handled = false; if (mAcceptsDragAndDrop) { @@ -1478,11 +1486,11 @@ bool LLInventoryPanel::addBadge(LLBadge * badge) void LLInventoryPanel::openAllFolders() { - mFolderRoot.get()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_DOWN); + mFolderRoot.get()->setOpenArrangeRecursively(true, LLFolderViewFolder::RECURSE_DOWN); mFolderRoot.get()->arrangeAll(); } -void LLInventoryPanel::setSelection(const LLUUID& obj_id, BOOL take_keyboard_focus) +void LLInventoryPanel::setSelection(const LLUUID& obj_id, bool take_keyboard_focus) { // Don't select objects in COF (e.g. to prevent refocus when items are worn). const LLInventoryObject *obj = mInventory->getObject(obj_id); @@ -1493,7 +1501,7 @@ void LLInventoryPanel::setSelection(const LLUUID& obj_id, BOOL take_keyboard_foc setSelectionByID(obj_id, take_keyboard_focus); } -void LLInventoryPanel::setSelectCallback(const boost::function<void (const std::deque<LLFolderViewItem*>& items, BOOL user_action)>& cb) +void LLInventoryPanel::setSelectCallback(const boost::function<void (const std::deque<LLFolderViewItem*>& items, bool user_action)>& cb) { if (mFolderRoot.get()) { @@ -1513,7 +1521,7 @@ LLInventoryPanel::selected_items_t LLInventoryPanel::getSelectedItems() const return mFolderRoot.get()->getSelectionList(); } -void LLInventoryPanel::onSelectionChange(const std::deque<LLFolderViewItem*>& items, BOOL user_action) +void LLInventoryPanel::onSelectionChange(const std::deque<LLFolderViewItem*>& items, bool user_action) { // Schedule updating the folder view context menu when all selected items become complete (STORM-373). mCompletionObserver->reset(); @@ -1541,7 +1549,7 @@ void LLInventoryPanel::onSelectionChange(const std::deque<LLFolderViewItem*>& it LLFolderView* fv = mFolderRoot.get(); if (fv->needsAutoRename()) // auto-selecting a new user-created asset and preparing to rename { - fv->setNeedsAutoRename(FALSE); + fv->setNeedsAutoRename(false); if (items.size()) // new asset is visible and selected { fv->startRenamingSelectedItem(); @@ -1665,7 +1673,7 @@ bool LLInventoryPanel::beginIMSession() item_array, LLInventoryModel::EXCLUDE_TRASH, is_buddy); - S32 count = item_array.size(); + auto count = item_array.size(); if(count > 0) { //*TODO by what to replace that? @@ -1674,7 +1682,7 @@ bool LLInventoryPanel::beginIMSession() // create the session LLAvatarTracker& at = LLAvatarTracker::instance(); LLUUID id; - for(S32 i = 0; i < count; ++i) + for(size_t i = 0; i < count; ++i) { id = item_array.at(i)->getCreatorUUID(); if(at.isBuddyOnline(id)) @@ -1761,7 +1769,7 @@ void LLInventoryPanel::purgeSelectedItems() const std::set<LLFolderViewItem*> inventory_selected = mFolderRoot.get()->getSelectionList(); if (inventory_selected.empty()) return; LLSD args; - S32 count = inventory_selected.size(); + auto count = inventory_selected.size(); std::vector<LLUUID> selected_items; for (std::set<LLFolderViewItem*>::const_iterator it = inventory_selected.begin(), end_it = inventory_selected.end(); it != end_it; @@ -1774,7 +1782,7 @@ void LLInventoryPanel::purgeSelectedItems() count += items.size() + cats.size(); selected_items.push_back(item_id); } - args["COUNT"] = count; + args["COUNT"] = static_cast<S32>(count); LLNotificationsUtil::add("PurgeSelectedItems", args, LLSD(), boost::bind(callbackPurgeSelectedItems, _1, _2, selected_items)); } @@ -1813,7 +1821,7 @@ bool LLInventoryPanel::attachObject(const LLSD& userdata) return true; } -BOOL LLInventoryPanel::getSinceLogoff() +bool LLInventoryPanel::getSinceLogoff() { return getFilter().isSinceLogoff(); } @@ -1826,15 +1834,15 @@ void LLInventoryPanel::dumpSelectionInformation(void* user_data) iv->mFolderRoot.get()->dumpSelectionInformation(); } -BOOL is_inventorysp_active() +bool is_inventorysp_active() { LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory"); - if (!sidepanel_inventory || !sidepanel_inventory->isInVisibleChain()) return FALSE; + if (!sidepanel_inventory || !sidepanel_inventory->isInVisibleChain()) return false; return sidepanel_inventory->isMainInventoryPanelActive(); } // static -LLInventoryPanel* LLInventoryPanel::getActiveInventoryPanel(BOOL auto_open) +LLInventoryPanel* LLInventoryPanel::getActiveInventoryPanel(bool auto_open) { S32 z_min = S32_MAX; LLInventoryPanel* res = NULL; @@ -1844,7 +1852,7 @@ LLInventoryPanel* LLInventoryPanel::getActiveInventoryPanel(BOOL auto_open) if (!floater_inventory) { LL_WARNS() << "Could not find My Inventory floater" << LL_ENDL; - return FALSE; + return nullptr; } LLSidepanelInventory *inventory_panel = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory"); @@ -1873,7 +1881,7 @@ LLInventoryPanel* LLInventoryPanel::getActiveInventoryPanel(BOOL auto_open) // Make sure the floater is not minimized (STORM-438). if (active_inv_floaterp && active_inv_floaterp->isMinimized()) { - active_inv_floaterp->setMinimized(FALSE); + active_inv_floaterp->setMinimized(false); } } else if (auto_open) @@ -1956,7 +1964,7 @@ void LLInventoryPanel::openInventoryPanelAndSetSelection(bool auto_open, const L LLFloater* floater_inventory = LLFloaterReg::getInstance("inventory"); if (floater_inventory) { - floater_inventory->setFocus(TRUE); + floater_inventory->setFocus(true); } active_panel->setSelection(obj_id, take_keyboard_focus); } @@ -1991,7 +1999,7 @@ void LLInventoryPanel::addHideFolderType(LLFolderType::EType folder_type) getFilter().setFilterCategoryTypes(getFilter().getFilterCategoryTypes() & ~(1ULL << folder_type)); } -BOOL LLInventoryPanel::getIsHiddenFolderType(LLFolderType::EType folder_type) const +bool LLInventoryPanel::getIsHiddenFolderType(LLFolderType::EType folder_type) const { return !(getFilter().getFilterCategoryTypes() & (1ULL << folder_type)); } @@ -2005,7 +2013,7 @@ void LLInventoryPanel::removeItemID(const LLUUID& id) { LLInventoryModel::cat_array_t categories; LLInventoryModel::item_array_t items; - gInventory.collectDescendents(id, categories, items, TRUE); + gInventory.collectDescendents(id, categories, items, true); mItemMap.erase(id); @@ -2045,7 +2053,7 @@ LLFolderViewFolder* LLInventoryPanel::getFolderByID(const LLUUID& id) } -void LLInventoryPanel::setSelectionByID( const LLUUID& obj_id, BOOL take_keyboard_focus ) +void LLInventoryPanel::setSelectionByID( const LLUUID& obj_id, bool take_keyboard_focus ) { LLFolderViewItem* itemp = getItemByID(obj_id); @@ -2060,7 +2068,7 @@ void LLInventoryPanel::setSelectionByID( const LLUUID& obj_id, BOOL take_keyb if(itemp && itemp->getViewModelItem()) { - itemp->arrangeAndSet(TRUE, take_keyboard_focus); + itemp->arrangeAndSet(true, take_keyboard_focus); mSelectThisID.setNull(); mFocusSelection = false; return; @@ -2093,9 +2101,9 @@ void LLInventoryPanel::doToSelected(const LLSD& userdata) return; } -BOOL LLInventoryPanel::handleKeyHere( KEY key, MASK mask ) +bool LLInventoryPanel::handleKeyHere( KEY key, MASK mask ) { - BOOL handled = FALSE; + bool handled = false; switch (key) { case KEY_RETURN: @@ -2115,7 +2123,7 @@ BOOL LLInventoryPanel::handleKeyHere( KEY key, MASK mask ) } } LLInventoryAction::doToSelected(mInventory, mFolderRoot.get(), "open"); - handled = TRUE; + handled = true; } break; case KEY_DELETE: @@ -2127,7 +2135,7 @@ BOOL LLInventoryPanel::handleKeyHere( KEY key, MASK mask ) if (isSelectionRemovable() && (mask == MASK_NONE)) { LLInventoryAction::doToSelected(mInventory, mFolderRoot.get(), "delete"); - handled = TRUE; + handled = true; } break; } @@ -2238,7 +2246,7 @@ void LLInventorySingleFolderPanel::onFocusReceived() if (folder_view->getVisible()) { const LLFolderViewModelItemInventory* modelp = static_cast<const LLFolderViewModelItemInventory*>(folder_view->getViewModelItem()); - setSelectionByID(modelp->getUUID(), TRUE); + setSelectionByID(modelp->getUUID(), true); // quick and dirty fix: don't scroll on switching focus // todo: better 'tab' support, one that would work for LLInventoryPanel mFolderRoot.get()->stopAutoScollining(); @@ -2259,7 +2267,7 @@ void LLInventorySingleFolderPanel::onFocusReceived() if (item_view->getVisible()) { const LLFolderViewModelItemInventory* modelp = static_cast<const LLFolderViewModelItemInventory*>(item_view->getViewModelItem()); - setSelectionByID(modelp->getUUID(), TRUE); + setSelectionByID(modelp->getUUID(), true); mFolderRoot.get()->stopAutoScollining(); break; } @@ -2485,13 +2493,13 @@ void LLAssetFilteredInventoryPanel::initFromParams(const Params& p) getFilter().setFilterNoMarketplaceFolder(); } -BOOL LLAssetFilteredInventoryPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +bool LLAssetFilteredInventoryPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) { - BOOL result = FALSE; + bool result = false; if (mAcceptsDragAndDrop) { diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index c6984fb53b..6dead2cf6d 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -161,16 +161,16 @@ public: LLFolderViewModelInventory& getRootViewModel() { return mInventoryViewModel; } // LLView methods - /*virtual*/ void onVisibilityChange(BOOL new_visibility) override; + /*virtual*/ void onVisibilityChange(bool new_visibility) override; void draw() override; - /*virtual*/ BOOL handleKeyHere( KEY key, MASK mask ) override; - BOOL handleHover(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + /*virtual*/ bool handleKeyHere( KEY key, MASK mask ) override; + bool handleHover(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) override; - BOOL handleToolTip(S32 x, S32 y, MASK mask) override; + bool handleToolTip(S32 x, S32 y, MASK mask) override; // LLUICtrl methods /*virtual*/ void onFocusLost() override; /*virtual*/ void onFocusReceived() override; @@ -181,8 +181,8 @@ public: // Call this method to set the selection. void openAllFolders(); - void setSelection(const LLUUID& obj_id, BOOL take_keyboard_focus); - void setSelectCallback(const boost::function<void (const std::deque<LLFolderViewItem*>& items, BOOL user_action)>& cb); + void setSelection(const LLUUID& obj_id, bool take_keyboard_focus); + void setSelectCallback(const boost::function<void (const std::deque<LLFolderViewItem*>& items, bool user_action)>& cb); void clearSelection(); selected_items_t getSelectedItems() const; @@ -198,10 +198,10 @@ public: void setFilterSettingsTypes(U64 filter); void setFilterSubString(const std::string& string); const std::string getFilterSubString(); - void setSinceLogoff(BOOL sl); + void setSinceLogoff(bool sl); void setHoursAgo(U32 hours); void setDateSearchDirection(U32 direction); - BOOL getSinceLogoff(); + bool getSinceLogoff(); void setFilterLinks(U64 filter_links); void setSearchType(LLInventoryFilter::ESearchType type); LLInventoryFilter::ESearchType getSearchType(); @@ -216,7 +216,7 @@ public: bool getAllowDropOnRoot() { return mParams.allow_drop_on_root; } bool areViewsInitialized() { return mViewsInitialized == VIEWS_INITIALIZED && mFolderRoot.get() && !mFolderRoot.get()->needsArrange(); } - void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action); + void onSelectionChange(const std::deque<LLFolderViewItem*> &items, bool user_action); LLHandle<LLInventoryPanel> getInventoryPanelHandle() const { return getDerivedHandle<LLInventoryPanel>(); } @@ -242,7 +242,7 @@ public: // Find whichever inventory panel is active / on top. // "Auto_open" determines if we open an inventory panel if none are open. - static LLInventoryPanel *getActiveInventoryPanel(BOOL auto_open = TRUE); + static LLInventoryPanel *getActiveInventoryPanel(bool auto_open = true); static void openInventoryPanelAndSetSelection(bool auto_open, const LLUUID& obj_id, @@ -254,7 +254,7 @@ public: void removeItemID(const LLUUID& id); LLFolderViewItem* getItemByID(const LLUUID& id); LLFolderViewFolder* getFolderByID(const LLUUID& id); - void setSelectionByID(const LLUUID& obj_id, BOOL take_keyboard_focus); + void setSelectionByID(const LLUUID& obj_id, bool take_keyboard_focus); void updateSelection(); void setSuppressOpenItemAction(bool supress_open_item) { mSuppressOpenItemAction = supress_open_item; } @@ -364,13 +364,13 @@ protected: virtual bool typedViewsFilter(const LLUUID& id, LLInventoryObject const* objectp) { return true; } virtual void itemChanged(const LLUUID& item_id, U32 mask, const LLInventoryObject* model_item); - BOOL getIsHiddenFolderType(LLFolderType::EType folder_type) const; + bool getIsHiddenFolderType(LLFolderType::EType folder_type) const; virtual LLFolderView * createFolderRoot(LLUUID root_id ); virtual LLFolderViewFolder* createFolderViewFolder(LLInvFVBridge * bridge, bool allow_drop); virtual LLFolderViewItem* createFolderViewItem(LLInvFVBridge * bridge); - boost::function<void(const std::deque<LLFolderViewItem*>& items, BOOL user_action)> mSelectionCallback; + boost::function<void(const std::deque<LLFolderViewItem*>& items, bool user_action)> mSelectionCallback; private: // buildViewsTree does not include some checks and is meant // for recursive use, use buildNewViews() for first call @@ -471,7 +471,7 @@ protected: public: ~LLAssetFilteredInventoryPanel() {} - /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + /*virtual*/ bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, diff --git a/indra/newview/lljoystickbutton.cpp b/indra/newview/lljoystickbutton.cpp index 70a8020d78..00dbf9a9f8 100644 --- a/indra/newview/lljoystickbutton.cpp +++ b/indra/newview/lljoystickbutton.cpp @@ -79,7 +79,7 @@ LLJoystick::LLJoystick(const LLJoystick::Params& p) mVertSlopFar(0), mHorizSlopNear(0), mHorizSlopFar(0), - mHeldDown(FALSE), + mHeldDown(false), mHeldDownTimer(), mInitialQuadrant(p.quadrant) { @@ -160,7 +160,7 @@ bool LLJoystick::pointInCenterDot(S32 x, S32 y, S32 radius) const return in_center_circle; } -BOOL LLJoystick::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLJoystick::handleMouseDown(S32 x, S32 y, MASK mask) { //LL_INFOS() << "joystick mouse down " << x << ", " << y << LL_ENDL; bool handles = false; @@ -177,14 +177,14 @@ BOOL LLJoystick::handleMouseDown(S32 x, S32 y, MASK mask) } -BOOL LLJoystick::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLJoystick::handleMouseUp(S32 x, S32 y, MASK mask) { // LL_INFOS() << "joystick mouse up " << x << ", " << y << LL_ENDL; if( hasMouseCapture() ) { mLastMouse.set(x, y); - mHeldDown = FALSE; + mHeldDown = false; onMouseUp(); } @@ -192,7 +192,7 @@ BOOL LLJoystick::handleMouseUp(S32 x, S32 y, MASK mask) } -BOOL LLJoystick::handleHover(S32 x, S32 y, MASK mask) +bool LLJoystick::handleHover(S32 x, S32 y, MASK mask) { if( hasMouseCapture() ) { @@ -220,7 +220,7 @@ void LLJoystick::onBtnHeldDown(void *userdata) LLJoystick *self = (LLJoystick *)userdata; if (self) { - self->mHeldDown = TRUE; + self->mHeldDown = true; self->onHeldDown(); } } @@ -419,11 +419,11 @@ void LLJoystickAgentSlide::onHeldDown() LLJoystickCameraRotate::LLJoystickCameraRotate(const LLJoystickCameraRotate::Params& p) : LLJoystick(p), - mInLeft( FALSE ), - mInTop( FALSE ), - mInRight( FALSE ), - mInBottom( FALSE ), - mInCenter( FALSE ) + mInLeft( false ), + mInTop( false ), + mInRight( false ), + mInBottom( false ), + mInCenter( false ) { mCenterImageName = "Cam_Rotate_Center"; } @@ -444,9 +444,9 @@ void LLJoystickCameraRotate::updateSlop() } -BOOL LLJoystickCameraRotate::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLJoystickCameraRotate::handleMouseDown(S32 x, S32 y, MASK mask) { - gAgent.setMovementLocked(TRUE); + gAgent.setMovementLocked(true); updateSlop(); // Set initial offset based on initial click location @@ -461,7 +461,7 @@ BOOL LLJoystickCameraRotate::handleMouseDown(S32 x, S32 y, MASK mask) mInitialOffset.mX = 0; mInitialOffset.mY = 0; mInitialQuadrant = JQ_ORIGIN; - mInCenter = TRUE; + mInCenter = true; resetJoystickCamera(); } @@ -497,18 +497,18 @@ BOOL LLJoystickCameraRotate::handleMouseDown(S32 x, S32 y, MASK mask) return LLJoystick::handleMouseDown(x, y, mask); } -BOOL LLJoystickCameraRotate::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLJoystickCameraRotate::handleMouseUp(S32 x, S32 y, MASK mask) { - gAgent.setMovementLocked(FALSE); - mInCenter = FALSE; + gAgent.setMovementLocked(false); + mInCenter = false; return LLJoystick::handleMouseUp(x, y, mask); } -BOOL LLJoystickCameraRotate::handleHover(S32 x, S32 y, MASK mask) +bool LLJoystickCameraRotate::handleHover(S32 x, S32 y, MASK mask) { if (!pointInCenterDot(x, y, CENTER_DOT_RADIUS)) { - mInCenter = FALSE; + mInCenter = false; } return LLJoystick::handleHover(x, y, mask); @@ -568,7 +568,7 @@ F32 LLJoystickCameraRotate::getOrbitRate() // Only used for drawing -void LLJoystickCameraRotate::setToggleState( BOOL left, BOOL top, BOOL right, BOOL bottom ) +void LLJoystickCameraRotate::setToggleState( bool left, bool top, bool right, bool bottom ) { mInLeft = left; mInTop = top; @@ -737,7 +737,7 @@ LLJoystickQuaternion::LLJoystickQuaternion(const LLJoystickQuaternion::Params &p } } -void LLJoystickQuaternion::setToggleState(BOOL left, BOOL top, BOOL right, BOOL bottom) +void LLJoystickQuaternion::setToggleState(bool left, bool top, bool right, bool bottom) { mInLeft = left; mInTop = top; @@ -745,7 +745,7 @@ void LLJoystickQuaternion::setToggleState(BOOL left, BOOL top, BOOL right, BOOL mInBottom = bottom; } -BOOL LLJoystickQuaternion::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLJoystickQuaternion::handleMouseDown(S32 x, S32 y, MASK mask) { updateSlop(); @@ -788,7 +788,7 @@ BOOL LLJoystickQuaternion::handleMouseDown(S32 x, S32 y, MASK mask) return LLJoystick::handleMouseDown(x, y, mask); } -BOOL LLJoystickQuaternion::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLJoystickQuaternion::handleMouseUp(S32 x, S32 y, MASK mask) { return LLJoystick::handleMouseUp(x, y, mask); } diff --git a/indra/newview/lljoystickbutton.h b/indra/newview/lljoystickbutton.h index 053cf0348a..12394ca63e 100644 --- a/indra/newview/lljoystickbutton.h +++ b/indra/newview/lljoystickbutton.h @@ -63,9 +63,9 @@ public: }; LLJoystick(const Params&); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleHover(S32 x, S32 y, MASK mask); virtual void onMouseUp() {} virtual void onHeldDown() = 0; @@ -100,7 +100,7 @@ protected: S32 mVertSlopFar; // where the slop regions end S32 mHorizSlopNear; // where the slop regions end S32 mHorizSlopFar; // where the slop regions end - BOOL mHeldDown; + bool mHeldDown; LLFrameTimer mHeldDownTimer; }; @@ -145,11 +145,11 @@ public: LLJoystickCameraRotate(const LLJoystickCameraRotate::Params&); - virtual void setToggleState( BOOL left, BOOL top, BOOL right, BOOL bottom ); + virtual void setToggleState( bool left, bool top, bool right, bool bottom ); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleHover(S32 x, S32 y, MASK mask); virtual void onHeldDown(); virtual void resetJoystickCamera(); virtual void draw(); @@ -160,11 +160,11 @@ protected: void drawRotatedImage( LLPointer<LLUIImage> image, S32 rotations ); protected: - BOOL mInLeft; - BOOL mInTop; - BOOL mInRight; - BOOL mInBottom; - BOOL mInCenter; + bool mInLeft; + bool mInTop; + bool mInRight; + bool mInBottom; + bool mInCenter; std::string mCenterImageName; }; @@ -199,10 +199,10 @@ public: LLJoystickQuaternion(const LLJoystickQuaternion::Params &); - virtual void setToggleState(BOOL left, BOOL top, BOOL right, BOOL bottom); + virtual void setToggleState(bool left, bool top, bool right, bool bottom); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); virtual void onHeldDown(); virtual void draw(); @@ -214,10 +214,10 @@ protected: virtual void updateSlop(); void drawRotatedImage(LLPointer<LLUIImage> image, S32 rotations); - BOOL mInLeft; - BOOL mInTop; - BOOL mInRight; - BOOL mInBottom; + bool mInLeft; + bool mInTop; + bool mInRight; + bool mInBottom; S32 mXAxisIndex; S32 mYAxisIndex; diff --git a/indra/newview/llkeyconflict.cpp b/indra/newview/llkeyconflict.cpp index af70025647..666ab4f5d0 100644 --- a/indra/newview/llkeyconflict.cpp +++ b/indra/newview/llkeyconflict.cpp @@ -476,8 +476,8 @@ void LLKeyConflictHandler::saveToSettings(bool temporary) // so make sure to cleanup. // Also this helps in keeping file small. iter->second.mKeyBind.trimEmpty(); - U32 size = iter->second.mKeyBind.getDataCount(); - for (U32 i = 0; i < size; ++i) + auto size = iter->second.mKeyBind.getDataCount(); + for (size_t i = 0; i < size; ++i) { if (iter->first.empty()) { @@ -491,7 +491,7 @@ void LLKeyConflictHandler::saveToSettings(bool temporary) continue; } - LLKeyData data = key.mKeyBind.getKeyData(i); + LLKeyData data = key.mKeyBind.getKeyData(static_cast<U32>(i)); // Still write empty LLKeyData to make sure we will maintain UI position if (data.mKey == KEY_NONE) { diff --git a/indra/newview/lllandmarkactions.cpp b/indra/newview/lllandmarkactions.cpp index a5f53900ff..73425e9f4c 100644 --- a/indra/newview/lllandmarkactions.cpp +++ b/indra/newview/lllandmarkactions.cpp @@ -84,12 +84,12 @@ class LLFetchLandmarksByName : public LLInventoryCollectFunctor { private: std::string name; - BOOL use_substring; + bool use_substring; //this member will be contain copy of founded items to keep the result unique std::set<std::string> check_duplicate; public: -LLFetchLandmarksByName(std::string &landmark_name, BOOL if_use_substring) +LLFetchLandmarksByName(std::string &landmark_name, bool if_use_substring) :name(landmark_name), use_substring(if_use_substring) { @@ -178,7 +178,7 @@ static void fetch_landmarks(LLInventoryModel::cat_array_t& cats, add); } -LLInventoryModel::item_array_t LLLandmarkActions::fetchLandmarksByName(std::string& name, BOOL use_substring) +LLInventoryModel::item_array_t LLLandmarkActions::fetchLandmarksByName(std::string& name, bool use_substring) { LLInventoryModel::cat_array_t cats; LLInventoryModel::item_array_t items; diff --git a/indra/newview/lllandmarkactions.h b/indra/newview/lllandmarkactions.h index 29ffc1dcee..1abf10e110 100644 --- a/indra/newview/lllandmarkactions.h +++ b/indra/newview/lllandmarkactions.h @@ -45,7 +45,7 @@ public: /** * @brief Fetches landmark LLViewerInventoryItems for the given landmark name. */ - static LLInventoryModel::item_array_t fetchLandmarksByName(std::string& name, BOOL if_use_substring); + static LLInventoryModel::item_array_t fetchLandmarksByName(std::string& name, bool if_use_substring); /** * @brief Checks whether landmark exists for current agent position. */ diff --git a/indra/newview/lllandmarklist.cpp b/indra/newview/lllandmarklist.cpp index 6ec77bca86..3fa0ab99f3 100644 --- a/indra/newview/lllandmarklist.cpp +++ b/indra/newview/lllandmarklist.cpp @@ -118,7 +118,7 @@ void LLLandmarkList::processGetAssetReply( file.read((U8*)&buffer[0], file_length); buffer[file_length] = 0; - LLLandmark* landmark = LLLandmark::constructFromString(&buffer[0], buffer.size()); + LLLandmark* landmark = LLLandmark::constructFromString(&buffer[0], static_cast<S32>(buffer.size())); if (landmark) { gLandmarkList.mList[uuid] = landmark; @@ -176,12 +176,12 @@ void LLLandmarkList::processGetAssetReply( } } -BOOL LLLandmarkList::isAssetInLoadedCallbackMap(const LLUUID& asset_uuid) +bool LLLandmarkList::isAssetInLoadedCallbackMap(const LLUUID& asset_uuid) { return mLoadedCallbackMap.find(asset_uuid) != mLoadedCallbackMap.end(); } -BOOL LLLandmarkList::assetExists(const LLUUID& asset_uuid) +bool LLLandmarkList::assetExists(const LLUUID& asset_uuid) { return mList.count(asset_uuid) != 0 || mBadList.count(asset_uuid) != 0; } diff --git a/indra/newview/lllandmarklist.h b/indra/newview/lllandmarklist.h index bea5c84a9b..508148abde 100644 --- a/indra/newview/lllandmarklist.h +++ b/indra/newview/lllandmarklist.h @@ -49,7 +49,7 @@ public: //const LLLandmark* getFirst() { return mList.getFirstData(); } //const LLLandmark* getNext() { return mList.getNextData(); } - BOOL assetExists(const LLUUID& asset_uuid); + bool assetExists(const LLUUID& asset_uuid); LLLandmark* getAsset(const LLUUID& asset_uuid, loaded_callback_t cb = NULL); static void processGetAssetReply( const LLUUID& uuid, @@ -58,9 +58,9 @@ public: S32 status, LLExtStat ext_status ); - // Returns TRUE if loading the landmark with given asset_uuid has been requested + // Returns true if loading the landmark with given asset_uuid has been requested // but is not complete yet. - BOOL isAssetInLoadedCallbackMap(const LLUUID& asset_uuid); + bool isAssetInLoadedCallbackMap(const LLUUID& asset_uuid); protected: void onRegionHandle(const LLUUID& landmark_id); diff --git a/indra/newview/lllegacyatmospherics.cpp b/indra/newview/lllegacyatmospherics.cpp index e5b681106a..1403845d07 100644 --- a/indra/newview/lllegacyatmospherics.cpp +++ b/indra/newview/lllegacyatmospherics.cpp @@ -180,7 +180,7 @@ LLAtmospherics::LLAtmospherics() mWorldScale(1.f) { /// WL PARAMS - mInitialized = FALSE; + mInitialized = false; mAmbientScale = gSavedSettings.getF32("SkyAmbientScale"); mNightColorShift = gSavedSettings.getColor3("SkyNightColorShift"); mFogColor.mV[VRED] = mFogColor.mV[VGREEN] = mFogColor.mV[VBLUE] = 0.5f; @@ -505,7 +505,7 @@ void LLAtmospherics::updateFog(const F32 distance, const LLVector3& tosun_in) } // Functions used a lot. -F32 color_norm_pow(LLColor3& col, F32 e, BOOL postmultiply) +F32 color_norm_pow(LLColor3& col, F32 e, bool postmultiply) { F32 mv = color_max(col); if (0 == mv) diff --git a/indra/newview/lllegacyatmospherics.h b/indra/newview/lllegacyatmospherics.h index ade6ed9569..17a01c1e04 100644 --- a/indra/newview/lllegacyatmospherics.h +++ b/indra/newview/lllegacyatmospherics.h @@ -267,7 +267,7 @@ protected: F32 mHazeConcentration; F32 mCloudDensity; F32 mWind; - BOOL mInitialized; + bool mInitialized; LLVector3 mLastLightingDirection; LLColor3 mLastTotalAmbient; F32 mAmbientScale; diff --git a/indra/newview/lllistbrowser.cpp b/indra/newview/lllistbrowser.cpp deleted file mode 100644 index 143415adee..0000000000 --- a/indra/newview/lllistbrowser.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/** - * @file lllistbrowser.cpp - * @brief UI widget showing a search filter, list view, icon action buttons, - * and verb action buttons, as usually embedded in the side tray. - * - * $LicenseInfo:firstyear=2009&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 "llviewerprecompiledheaders.h" - -#include "lllistbrowser.h" - -// TODO diff --git a/indra/newview/lllistbrowser.h b/indra/newview/lllistbrowser.h deleted file mode 100644 index 9cd5c730a9..0000000000 --- a/indra/newview/lllistbrowser.h +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @file lllistbrowser.h - * @brief UI widget showing a search filter, list view, icon action buttons, - * and verb action buttons, as usually embedded in the side tray. - * - * $LicenseInfo:firstyear=2009&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 LLLISTBROWSER_H -#define LLLISTBROWSER_H - -#endif // LLLISTBROWSER_H diff --git a/indra/newview/lllocalbitmaps.cpp b/indra/newview/lllocalbitmaps.cpp index 5b7243ece2..6ab5e05b7d 100644 --- a/indra/newview/lllocalbitmaps.cpp +++ b/indra/newview/lllocalbitmaps.cpp @@ -72,7 +72,7 @@ /*=======================================*/ static const F32 LL_LOCAL_TIMER_HEARTBEAT = 3.0; -static const BOOL LL_LOCAL_USE_MIPMAPS = true; +static const bool LL_LOCAL_USE_MIPMAPS = true; static const S32 LL_LOCAL_DISCARD_LEVEL = 0; static const bool LL_LOCAL_SLAM_FOR_DEBUG = true; static const bool LL_LOCAL_REPLACE_ON_DEL = true; @@ -438,7 +438,7 @@ std::vector<LLViewerObject*> LLLocalBitmap::prepUpdateObjects(LLUUID old_id, U32 std::vector<LLViewerObject*> obj_list; LLViewerFetchedTexture* old_texture = gTextureList.findImage(old_id, TEX_LIST_STANDARD); - for(U32 face_iterator = 0; face_iterator < old_texture->getNumFaces(channel); face_iterator++) + for (S32 face_iterator = 0; face_iterator < old_texture->getNumFaces(channel); face_iterator++) { // getting an object from a face LLFace* face_to_object = (*old_texture->getFaceList(channel))[face_iterator]; @@ -554,7 +554,7 @@ void LLLocalBitmap::updateUserPrims(LLUUID old_id, LLUUID new_id, U32 channel) void LLLocalBitmap::updateUserVolumes(LLUUID old_id, LLUUID new_id, U32 channel) { LLViewerFetchedTexture* old_texture = gTextureList.findImage(old_id, TEX_LIST_STANDARD); - for (U32 volume_iter = 0; volume_iter < old_texture->getNumVolumes(channel); volume_iter++) + for (S32 volume_iter = 0; volume_iter < old_texture->getNumVolumes(channel); volume_iter++) { LLVOVolume* volobjp = (*old_texture->getVolumeList(channel))[volume_iter]; switch (channel) @@ -579,7 +579,7 @@ void LLLocalBitmap::updateUserVolumes(LLUUID old_id, LLUUID new_id, U32 channel) LLSculptParams* old_params = (LLSculptParams*)object->getParameterEntry(LLNetworkData::PARAMS_SCULPT); LLSculptParams new_params(*old_params); new_params.setSculptTexture(new_id, (*old_params).getSculptType()); - object->setParameterEntry(LLNetworkData::PARAMS_SCULPT, new_params, TRUE); + object->setParameterEntry(LLNetworkData::PARAMS_SCULPT, new_params, true); } } } @@ -613,7 +613,7 @@ void LLLocalBitmap::updateUserLayers(LLUUID old_id, LLUUID new_id, LLWearableTyp U32 index; if (gAgentWearables.getWearableIndex(wearable,index)) { - gAgentAvatarp->setLocalTexture(reg_texind, gTextureList.getImage(new_id), FALSE, index); + gAgentAvatarp->setLocalTexture(reg_texind, gTextureList.getImage(new_id), false, index); gAgentAvatarp->wearableUpdated(type); /* telling the manager to rebake once update cycle is fully done */ LLLocalBitmapMgr::getInstance()->setNeedsRebake(); @@ -1009,10 +1009,10 @@ bool LLLocalBitmapTimer::isRunning() return mEventTimer.getStarted(); } -BOOL LLLocalBitmapTimer::tick() +bool LLLocalBitmapTimer::tick() { LLLocalBitmapMgr::getInstance()->doUpdates(); - return FALSE; + return false; } /*=======================================*/ @@ -1091,8 +1091,9 @@ bool LLLocalBitmapMgr::checkTextureDimensions(std::string filename) return false; } - S32 max_width = gSavedSettings.getS32("max_texture_dimension_X"); - S32 max_height = gSavedSettings.getS32("max_texture_dimension_Y"); + // allow loading up to 4x max rez but implicitly downrez to max rez before upload + S32 max_width = gSavedSettings.getS32("max_texture_dimension_X")*4; + S32 max_height = gSavedSettings.getS32("max_texture_dimension_Y")*4; if ((image_info.getWidth() > max_width) || (image_info.getHeight() > max_height)) { @@ -1137,6 +1138,20 @@ void LLLocalBitmapMgr::delUnit(LLUUID tracking_id) } } +LLUUID LLLocalBitmapMgr::getTrackingID(const LLUUID& world_id) const +{ + for (local_list_citer iter = mBitmapList.begin(); iter != mBitmapList.end(); iter++) + { + LLLocalBitmap* unit = *iter; + if (unit->getWorldID() == world_id) + { + return unit->getTrackingID(); + } + } + + return LLUUID::null; +} + LLUUID LLLocalBitmapMgr::getWorldID(const LLUUID &tracking_id) const { LLUUID world_id = LLUUID::null; diff --git a/indra/newview/lllocalbitmaps.h b/indra/newview/lllocalbitmaps.h index 5dbc514f56..e169f96e70 100644 --- a/indra/newview/lllocalbitmaps.h +++ b/indra/newview/lllocalbitmaps.h @@ -121,7 +121,7 @@ class LLLocalBitmapTimer : public LLEventTimer void startTimer(); void stopTimer(); bool isRunning(); - BOOL tick(); + bool tick(); }; @@ -135,6 +135,7 @@ public: void delUnit(LLUUID tracking_id); bool checkTextureDimensions(std::string filename); + LLUUID getTrackingID(const LLUUID& world_id) const; LLUUID getWorldID(const LLUUID &tracking_id) const; bool isLocal(const LLUUID& world_id) const; std::string getFilename(const LLUUID &tracking_id) const; diff --git a/indra/newview/lllocalgltfmaterials.cpp b/indra/newview/lllocalgltfmaterials.cpp index 58f06d7748..fab18f2d26 100644 --- a/indra/newview/lllocalgltfmaterials.cpp +++ b/indra/newview/lllocalgltfmaterials.cpp @@ -177,6 +177,8 @@ bool LLLocalGLTFMaterial::updateSelf() } } + materialBegin(); + materialComplete(true); updated = true; } @@ -201,6 +203,8 @@ bool LLLocalGLTFMaterial::updateSelf() LLNotificationsUtil::add("LocalBitmapsUpdateFailedFinal", notif_args); mLinkStatus = LS_BROKEN; + materialBegin(); + materialComplete(false); } } } @@ -218,6 +222,8 @@ bool LLLocalGLTFMaterial::updateSelf() LLNotificationsUtil::add("LocalBitmapsUpdateFileNotFound", notif_args); mLinkStatus = LS_BROKEN; + materialBegin(); + materialComplete(false); } } @@ -301,11 +307,11 @@ bool LLLocalGLTFMaterialTimer::isRunning() return mEventTimer.getStarted(); } -BOOL LLLocalGLTFMaterialTimer::tick() +bool LLLocalGLTFMaterialTimer::tick() { // todo: do on idle? No point in timer LLLocalGLTFMaterialMgr::getInstance()->doUpdates(); - return FALSE; + return false; } /*=======================================*/ @@ -340,19 +346,19 @@ S32 LLLocalGLTFMaterialMgr::addUnit(const std::string& filename) tinygltf::Model model; LLTinyGLTFHelper::loadModel(filename, model); - S32 materials_in_file = model.materials.size(); + auto materials_in_file = model.materials.size(); if (materials_in_file <= 0) { return 0; } S32 loaded_materials = 0; - for (S32 i = 0; i < materials_in_file; i++) + for (size_t i = 0; i < materials_in_file; i++) { // Todo: this is rather inefficient, files will be spammed with // separate loads and date checks, find a way to improve this. // May be doUpdates() should be checking individual files. - LLPointer<LLLocalGLTFMaterial> unit = new LLLocalGLTFMaterial(filename, i); + LLPointer<LLLocalGLTFMaterial> unit = new LLLocalGLTFMaterial(filename, static_cast<S32>(i)); // load material from file if (unit->updateSelf()) diff --git a/indra/newview/lllocalgltfmaterials.h b/indra/newview/lllocalgltfmaterials.h index a85bbf33ce..b806b54508 100644 --- a/indra/newview/lllocalgltfmaterials.h +++ b/indra/newview/lllocalgltfmaterials.h @@ -90,7 +90,7 @@ public: void startTimer(); void stopTimer(); bool isRunning(); - BOOL tick(); + bool tick(); }; class LLLocalGLTFMaterialMgr : public LLSingleton<LLLocalGLTFMaterialMgr> diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp index aa3eb3993a..54dd5792a0 100644 --- a/indra/newview/lllocationinputctrl.cpp +++ b/indra/newview/lllocationinputctrl.cpp @@ -454,7 +454,7 @@ LLLocationInputCtrl::~LLLocationInputCtrl() mLocationHistoryConnection.disconnect(); } -void LLLocationInputCtrl::setEnabled(BOOL enabled) +void LLLocationInputCtrl::setEnabled(bool enabled) { LLComboBox::setEnabled(enabled); mAddLandmarkBtn->setEnabled(enabled); @@ -467,7 +467,7 @@ void LLLocationInputCtrl::hideList() focusTextEntry(); } -BOOL LLLocationInputCtrl::handleToolTip(S32 x, S32 y, MASK mask) +bool LLLocationInputCtrl::handleToolTip(S32 x, S32 y, MASK mask) { if(mAddLandmarkBtn->parentPointInView(x,y)) @@ -495,15 +495,15 @@ BOOL LLLocationInputCtrl::handleToolTip(S32 x, S32 y, MASK mask) } } - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLLocationInputCtrl::handleKeyHere(KEY key, MASK mask) +bool LLLocationInputCtrl::handleKeyHere(KEY key, MASK mask) { - BOOL result = LLComboBox::handleKeyHere(key, mask); + bool result = LLComboBox::handleKeyHere(key, mask); if (key == KEY_DOWN && hasFocus() && mList->getItemCount() != 0 && !mList->getVisible()) { @@ -516,7 +516,7 @@ BOOL LLLocationInputCtrl::handleKeyHere(KEY key, MASK mask) void LLLocationInputCtrl::onTextEntry(LLLineEditor* line_editor) { KEY key = gKeyboard->currentKey(); - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); // Typing? (moving cursor should not affect showing the list) bool typing = mask != MASK_CONTROL && key != KEY_LEFT && key != KEY_RIGHT && key != KEY_HOME && key != KEY_END; @@ -556,16 +556,16 @@ void LLLocationInputCtrl::setText(const LLStringExplicit& text) { mTextEntry->setText(text); } - mHasAutocompletedText = FALSE; + mHasAutocompletedText = false; } -void LLLocationInputCtrl::setFocus(BOOL b) +void LLLocationInputCtrl::setFocus(bool b) { LLComboBox::setFocus(b); if (mTextEntry && b && !mList->getVisible()) { - mTextEntry->setFocus(TRUE); + mTextEntry->setFocus(true); } } @@ -612,7 +612,7 @@ void LLLocationInputCtrl::draw() LLComboBox::draw(); } -void LLLocationInputCtrl::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLLocationInputCtrl::reshape(S32 width, S32 height, bool called_from_parent) { LLComboBox::reshape(width, height, called_from_parent); @@ -698,7 +698,7 @@ void LLLocationInputCtrl::onLocationPrearrange(const LLSD& data) //Let's add landmarks to the top of the list if any if(!filter.empty() ) { - LLInventoryModel::item_array_t landmark_items = LLLandmarkActions::fetchLandmarksByName(filter, TRUE); + LLInventoryModel::item_array_t landmark_items = LLLandmarkActions::fetchLandmarksByName(filter, true); for(U32 i=0; i < landmark_items.size(); i++) { @@ -1026,7 +1026,7 @@ void LLLocationInputCtrl::rebuildLocationHistory(const std::string& filter) void LLLocationInputCtrl::focusTextEntry() { - // We can't use "mTextEntry->setFocus(TRUE)" instead because + // We can't use "mTextEntry->setFocus(true)" instead because // if the "select_on_focus" parameter is true it places the cursor // at the beginning (after selecting text), thus screwing up updateSelection(). if (mTextEntry) @@ -1114,7 +1114,7 @@ void LLLocationInputCtrl::changeLocationPresentation() mTextEntry->setText(LLURI::unescape(slurl.getSLURLString())); mTextEntry->selectAll(); - mMaturityButton->setVisible(FALSE); + mMaturityButton->setVisible(false); isHumanReadableLocationVisible = false; } diff --git a/indra/newview/lllocationinputctrl.h b/indra/newview/lllocationinputctrl.h index 5ab42044cc..56e5555ba5 100644 --- a/indra/newview/lllocationinputctrl.h +++ b/indra/newview/lllocationinputctrl.h @@ -88,17 +88,17 @@ public: }; // LLView interface - /*virtual*/ void setEnabled(BOOL enabled); - /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); + /*virtual*/ void setEnabled(bool enabled); + /*virtual*/ bool handleToolTip(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleKeyHere(KEY key, MASK mask); /*virtual*/ void onFocusReceived(); /*virtual*/ void onFocusLost(); /*virtual*/ void draw(); - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true); //======================================================================== // LLUICtrl interface - /*virtual*/ void setFocus(BOOL b); + /*virtual*/ void setFocus(bool b); //======================================================================== // LLComboBox interface diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index 4b650aeebe..329fb881e3 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -452,16 +452,16 @@ void LLLogChat::loadChatHistory(const std::string& file_name, std::list<LLSD>& m return; } - S32 save_num_messages = messages.size(); + auto save_num_messages = messages.size(); char buffer[LOG_RECALL_SIZE]; /*Flawfinder: ignore*/ char *bptr; - S32 len; - bool firstline = TRUE; + size_t len; + bool firstline = true; if (load_all_history || fseek(fptr, (LOG_RECALL_SIZE - 1) * -1 , SEEK_END)) { //We need to load the whole historyFile or it's smaller than recall size, so get it all. - firstline = FALSE; + firstline = false; if (fseek(fptr, 0, SEEK_SET)) { fclose(fptr); @@ -476,7 +476,7 @@ void LLLogChat::loadChatHistory(const std::string& file_name, std::list<LLSD>& m if (firstline) { - firstline = FALSE; + firstline = false; continue; } @@ -1142,7 +1142,7 @@ void LLLoadHistoryThread::run() if(mNewLoad) { loadHistory(mFileName, mMessages, mLoadParams); - int count = mMessages->size(); + auto count = mMessages->size(); LL_INFOS() << "mMessages->size(): " << count << LL_ENDL; setFinished(); } @@ -1189,12 +1189,12 @@ void LLLoadHistoryThread::loadHistory(const std::string& file_name, std::list<LL char buffer[LOG_RECALL_SIZE]; /*Flawfinder: ignore*/ char *bptr; - S32 len; - bool firstline = TRUE; + size_t len; + bool firstline = true; if (load_all_history || fseek(fptr, (LOG_RECALL_SIZE - 1) * -1 , SEEK_END)) { //We need to load the whole historyFile or it's smaller than recall size, so get it all. - firstline = FALSE; + firstline = false; if (fseek(fptr, 0, SEEK_SET)) { fclose(fptr); @@ -1214,7 +1214,7 @@ void LLLoadHistoryThread::loadHistory(const std::string& file_name, std::list<LL if (firstline) { - firstline = FALSE; + firstline = false; continue; } std::string line(remove_utf8_bom(buffer)); diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp index cf1aebf26b..a471daf24e 100644 --- a/indra/newview/lllogininstance.cpp +++ b/indra/newview/lllogininstance.cpp @@ -198,7 +198,7 @@ void LLLoginInstance::constructAuthParams(LLPointer<LLCredential> user_credentia requested_options.append("global-textures"); if(gSavedSettings.getBOOL("ConnectAsGod")) { - gSavedSettings.setBOOL("UseDebugMenus", TRUE); + gSavedSettings.setBOOL("UseDebugMenus", true); requested_options.append("god-connect"); } @@ -345,7 +345,7 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event) data["message"] = message_response; data["reply_pump"] = TOS_REPLY_PUMP; if (gViewerWindow) - gViewerWindow->setShowProgress(FALSE); + gViewerWindow->setShowProgress(false); LLFloaterReg::showInstance("message_tos", data); LLEventPumps::instance().obtain(TOS_REPLY_PUMP) .listen(TOS_LISTENER_NAME, @@ -369,7 +369,7 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event) } if (gViewerWindow) - gViewerWindow->setShowProgress(FALSE); + gViewerWindow->setShowProgress(false); LLFloaterReg::showInstance("message_critical", data); LLEventPumps::instance().obtain(TOS_REPLY_PUMP) @@ -408,7 +408,7 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event) } if (gViewerWindow) - gViewerWindow->setShowProgress(FALSE); + gViewerWindow->setShowProgress(false); LLSD args; args["VERSION"] = login_version; @@ -447,7 +447,7 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event) if (gViewerWindow) { - gViewerWindow->setShowProgress(FALSE); + gViewerWindow->setShowProgress(false); } showMFAChallange(LLTrans::getString(response["message_id"])); @@ -467,7 +467,7 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event) LL_WARNS("LLLogin") << "Login failed for an unknown reason: " << LLSDOStreamer<LLSDNotationFormatter>(response) << LL_ENDL; if (gViewerWindow) - gViewerWindow->setShowProgress(FALSE); + gViewerWindow->setShowProgress(false); LLNotificationsUtil::add("LoginFailedUnknown", LLSD::emptyMap(), LLSD::emptyMap(), boost::bind(&LLLoginInstance::handleLoginDisallowed, this, _1, _2)); } diff --git a/indra/newview/llmanip.cpp b/indra/newview/llmanip.cpp index b852ba0e3c..3e39a52813 100644 --- a/indra/newview/llmanip.cpp +++ b/indra/newview/llmanip.cpp @@ -99,7 +99,7 @@ void LLManip::rebuild(LLViewerObject* vobj) LLManip::LLManip( const std::string& name, LLToolComposite* composite ) : LLTool( name, composite ), - mInSnapRegime(FALSE), + mInSnapRegime(false), mHighlightedPart(LL_NO_PART), mManipPart(LL_NO_PART) { @@ -147,7 +147,7 @@ void LLManip::getManipNormal(LLViewerObject* object, EManipPart manip, LLVector3 } -BOOL LLManip::getManipAxis(LLViewerObject* object, EManipPart manip, LLVector3 &axis) +bool LLManip::getManipAxis(LLViewerObject* object, EManipPart manip, LLVector3 &axis) { LLVector3 grid_origin; LLVector3 grid_scale; @@ -169,11 +169,11 @@ BOOL LLManip::getManipAxis(LLViewerObject* object, EManipPart manip, LLVector3 & } else { - return FALSE; + return false; } axis.rotVec( grid_rotation ); - return TRUE; + return true; } F32 LLManip::getSubdivisionLevel(const LLVector3 &reference_point, const LLVector3 &translate_axis, F32 grid_scale, S32 min_pixel_spacing, F32 min_subdivisions, F32 max_subdivisions) @@ -215,7 +215,7 @@ LLObjectSelectionHandle LLManip::getSelection() return mObjectSelection; } -BOOL LLManip::handleHover(S32 x, S32 y, MASK mask) +bool LLManip::handleHover(S32 x, S32 y, MASK mask) { // We only handle the event if mousedown started with us if( hasMouseCapture() ) @@ -224,7 +224,7 @@ BOOL LLManip::handleHover(S32 x, S32 y, MASK mask) { // Somehow the object got deselected while we were dragging it. // Release the mouse - setMouseCapture( FALSE ); + setMouseCapture( false ); } LL_DEBUGS("UserInput") << "hover handled by LLManip (active)" << LL_ENDL; @@ -234,17 +234,17 @@ BOOL LLManip::handleHover(S32 x, S32 y, MASK mask) LL_DEBUGS("UserInput") << "hover handled by LLManip (inactive)" << LL_ENDL; } gViewerWindow->setCursor(UI_CURSOR_ARROW); - return TRUE; + return true; } -BOOL LLManip::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLManip::handleMouseUp(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; if( hasMouseCapture() ) { - handled = TRUE; - setMouseCapture( FALSE ); + handled = true; + setMouseCapture( false ); } return handled; } @@ -254,20 +254,20 @@ void LLManip::updateGridSettings() sGridMaxSubdivisionLevel = gSavedSettings.getBOOL("GridSubUnit") ? (F32)gSavedSettings.getS32("GridSubdivision") : 1.f; } -BOOL LLManip::getMousePointOnPlaneAgent(LLVector3& point, S32 x, S32 y, LLVector3 origin, LLVector3 normal) +bool LLManip::getMousePointOnPlaneAgent(LLVector3& point, S32 x, S32 y, LLVector3 origin, LLVector3 normal) { LLVector3d origin_double = gAgent.getPosGlobalFromAgent(origin); LLVector3d global_point; - BOOL result = getMousePointOnPlaneGlobal(global_point, x, y, origin_double, normal); + bool result = getMousePointOnPlaneGlobal(global_point, x, y, origin_double, normal); point = gAgent.getPosAgentFromGlobal(global_point); return result; } -BOOL LLManip::getMousePointOnPlaneGlobal(LLVector3d& point, S32 x, S32 y, LLVector3d origin, LLVector3 normal) const +bool LLManip::getMousePointOnPlaneGlobal(LLVector3d& point, S32 x, S32 y, LLVector3d origin, LLVector3 normal) const { if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) { - BOOL result = FALSE; + bool result = false; F32 mouse_x = ((F32)x / gViewerWindow->getWorldViewWidthScaled() - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgentCamera.mHUDCurZoom; F32 mouse_y = ((F32)y / gViewerWindow->getWorldViewHeightScaled() - 0.5f) / gAgentCamera.mHUDCurZoom; @@ -282,7 +282,7 @@ BOOL LLManip::getMousePointOnPlaneGlobal(LLVector3d& point, S32 x, S32 y, LLVect { mouse_pos.mV[VX] = (normal * (origin_agent - mouse_pos)) / (normal.mV[VX]); - result = TRUE; + result = true; } point = gAgent.getPosGlobalFromAgent(mouse_pos); @@ -294,13 +294,13 @@ BOOL LLManip::getMousePointOnPlaneGlobal(LLVector3d& point, S32 x, S32 y, LLVect point, x, y, origin, normal ); } - //return FALSE; + //return false; } // Given the line defined by mouse cursor (a1 + a_param*(a2-a1)) and the line defined by b1 + b_param*(b2-b1), // returns a_param and b_param for the points where lines are closest to each other. // Returns false if the two lines are parallel. -BOOL LLManip::nearestPointOnLineFromMouse( S32 x, S32 y, const LLVector3& b1, const LLVector3& b2, F32 &a_param, F32 &b_param ) +bool LLManip::nearestPointOnLineFromMouse( S32 x, S32 y, const LLVector3& b1, const LLVector3& b2, F32 &a_param, F32 &b_param ) { LLVector3 a1; LLVector3 a2; @@ -318,7 +318,7 @@ BOOL LLManip::nearestPointOnLineFromMouse( S32 x, S32 y, const LLVector3& b1, co a2 = gAgentCamera.getCameraPositionAgent() + LLVector3(gViewerWindow->mouseDirectionGlobal(x, y)); } - BOOL parallel = TRUE; + bool parallel = true; LLVector3 a = a2 - a1; LLVector3 b = b2 - b1; @@ -332,7 +332,7 @@ BOOL LLManip::nearestPointOnLineFromMouse( S32 x, S32 y, const LLVector3& b1, co if( (denom < -F_APPROXIMATELY_ZERO) || (F_APPROXIMATELY_ZERO < denom) ) { a_param = (dist - normal * a1) / denom; - parallel = FALSE; + parallel = false; } normal = (a % b) % a; // normal to plane (P) through a and (shortest line between a and b) @@ -342,7 +342,7 @@ BOOL LLManip::nearestPointOnLineFromMouse( S32 x, S32 y, const LLVector3& b1, co if( (denom < -F_APPROXIMATELY_ZERO) || (F_APPROXIMATELY_ZERO < denom) ) { b_param = (dist - normal * b1) / denom; - parallel = FALSE; + parallel = false; } return parallel; @@ -369,14 +369,14 @@ LLVector3 LLManip::getPivotPoint() } -void LLManip::renderGuidelines(BOOL draw_x, BOOL draw_y, BOOL draw_z) +void LLManip::renderGuidelines(bool draw_x, bool draw_y, bool draw_z) { LLVector3 grid_origin; LLQuaternion grid_rot; LLVector3 grid_scale; LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rot, grid_scale); - const BOOL children_ok = TRUE; + const bool children_ok = true; LLViewerObject* object = mObjectSelection->getFirstRootObject(children_ok); if (!object) { @@ -502,7 +502,7 @@ void LLManip::renderTickText(const LLVector3& pos, const std::string& text, cons { const LLFontGL* big_fontp = LLFontGL::getFontSansSerif(); - BOOL hud_selection = mObjectSelection->getSelectType() == SELECT_TYPE_HUD; + bool hud_selection = mObjectSelection->getSelectType() == SELECT_TYPE_HUD; gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); LLVector3 render_pos = pos; @@ -560,7 +560,7 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const std::string } } - BOOL hud_selection = mObjectSelection->getSelectType() == SELECT_TYPE_HUD; + bool hud_selection = mObjectSelection->getSelectType() == SELECT_TYPE_HUD; gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); { diff --git a/indra/newview/llmanip.h b/indra/newview/llmanip.h index 82f85395ea..6208eca967 100644 --- a/indra/newview/llmanip.h +++ b/indra/newview/llmanip.h @@ -1,4 +1,4 @@ -/** +/** * @file llmanip.h * @brief LLManip class definition * @@ -117,16 +117,16 @@ public: LLManip( const std::string& name, LLToolComposite* composite ); - virtual BOOL handleMouseDownOnPart(S32 x, S32 y, MASK mask) = 0; - void renderGuidelines(BOOL draw_x = TRUE, BOOL draw_y = TRUE, BOOL draw_z = TRUE); + virtual bool handleMouseDownOnPart(S32 x, S32 y, MASK mask) = 0; + void renderGuidelines(bool draw_x = true, bool draw_y = true, bool draw_z = true); static void renderXYZ(const LLVector3 &vec); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); virtual void highlightManipulators(S32 x, S32 y) = 0; virtual void handleSelect(); virtual void handleDeselect(); - virtual BOOL canAffectSelection() = 0; + virtual bool canAffectSelection() = 0; EManipPart getHighlightedPart() { return mHighlightedPart; } @@ -136,18 +136,18 @@ protected: LLVector3 getSavedPivotPoint() const; LLVector3 getPivotPoint(); void getManipNormal(LLViewerObject* object, EManipPart manip, LLVector3 &normal); - BOOL getManipAxis(LLViewerObject* object, EManipPart manip, LLVector3 &axis); + bool getManipAxis(LLViewerObject* object, EManipPart manip, LLVector3 &axis); F32 getSubdivisionLevel(const LLVector3 &reference_point, const LLVector3 &translate_axis, F32 grid_scale, S32 min_pixel_spacing = MIN_DIVISION_PIXEL_WIDTH, F32 min_subdivisions = sGridMinSubdivisionLevel, F32 max_subdivisions = sGridMaxSubdivisionLevel); void renderTickValue(const LLVector3& pos, F32 value, const std::string& suffix, const LLColor4 &color); void renderTickText(const LLVector3& pos, const std::string& suffix, const LLColor4 &color); void updateGridSettings(); - BOOL getMousePointOnPlaneGlobal(LLVector3d& point, S32 x, S32 y, LLVector3d origin, LLVector3 normal) const; - BOOL getMousePointOnPlaneAgent(LLVector3& point, S32 x, S32 y, LLVector3 origin, LLVector3 normal); - BOOL nearestPointOnLineFromMouse( S32 x, S32 y, const LLVector3& b1, const LLVector3& b2, F32 &a_param, F32 &b_param ); + bool getMousePointOnPlaneGlobal(LLVector3d& point, S32 x, S32 y, LLVector3d origin, LLVector3 normal) const; + bool getMousePointOnPlaneAgent(LLVector3& point, S32 x, S32 y, LLVector3 origin, LLVector3 normal); + bool nearestPointOnLineFromMouse( S32 x, S32 y, const LLVector3& b1, const LLVector3& b2, F32 &a_param, F32 &b_param ); LLColor4 setupSnapGuideRenderPass(S32 pass); protected: LLFrameTimer mHelpTextTimer; - BOOL mInSnapRegime; + bool mInSnapRegime; LLSafeHandle<LLObjectSelection> mObjectSelection; EManipPart mHighlightedPart; EManipPart mManipPart; diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp index 7e8b5db942..b63b8be095 100644 --- a/indra/newview/llmaniprotate.cpp +++ b/indra/newview/llmaniprotate.cpp @@ -95,9 +95,9 @@ LLManipRotate::LLManipRotate( LLToolComposite* composite ) mCenterToCamMag(0.f), mCenterToProfilePlane(), mCenterToProfilePlaneMag(0.f), - mSendUpdateOnMouseUp( FALSE ), - mSmoothRotate( FALSE ), - mCamEdgeOn(FALSE), + mSendUpdateOnMouseUp( false ), + mSmoothRotate( false ), + mCamEdgeOn(false), mManipulatorScales(1.f, 1.f, 1.f, 1.f) { } @@ -120,7 +120,7 @@ void LLManipRotate::render() LLGLEnable gl_blend(GL_BLEND); // You can rotate if you can move - LLViewerObject* first_object = mObjectSelection->getFirstMoveableObject(TRUE); + LLViewerObject* first_object = mObjectSelection->getFirstMoveableObject(true); if( !first_object ) { return; @@ -202,7 +202,7 @@ void LLManipRotate::render() { gGL.color4f( 0.7f, 0.7f, 0.7f, 0.3f ); gGL.diffuseColor4f(0.7f, 0.7f, 0.7f, 0.3f); - gl_circle_2d( 0, 0, mRadiusMeters, CIRCLE_STEPS, TRUE ); + gl_circle_2d( 0, 0, mRadiusMeters, CIRCLE_STEPS, true ); } gGL.flush(); @@ -364,11 +364,11 @@ void LLManipRotate::render() renderXYZ(euler_angles); } -BOOL LLManipRotate::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLManipRotate::handleMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; - LLViewerObject* first_object = mObjectSelection->getFirstMoveableObject(TRUE); + LLViewerObject* first_object = mObjectSelection->getFirstMoveableObject(true); if( first_object ) { if( mHighlightedPart != LL_NO_PART ) @@ -381,12 +381,12 @@ BOOL LLManipRotate::handleMouseDown(S32 x, S32 y, MASK mask) } // Assumes that one of the parts of the manipulator was hit. -BOOL LLManipRotate::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) +bool LLManipRotate::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) { - BOOL can_rotate = canAffectSelection(); + bool can_rotate = canAffectSelection(); if (!can_rotate) { - return FALSE; + return false; } highlightManipulators(x, y); @@ -441,12 +441,12 @@ BOOL LLManipRotate::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) mAgentSelfAtAxis = gAgent.getAtAxis(); // no point checking if avatar was selected, just save the value // Route future Mouse messages here preemptively. (Release on mouse up.) - setMouseCapture( TRUE ); - LLSelectMgr::getInstance()->enableSilhouette(FALSE); + setMouseCapture( true ); + LLSelectMgr::getInstance()->enableSilhouette(false); mHelpTextTimer.reset(); sNumTimesHelpTextShown++; - return TRUE; + return true; } @@ -461,7 +461,7 @@ LLVector3 LLManipRotate::findNearestPointOnRing( S32 x, S32 y, const LLVector3& return center + proj_onto_ring * mRadiusMeters; } -BOOL LLManipRotate::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLManipRotate::handleMouseUp(S32 x, S32 y, MASK mask) { // first, perform normal processing in case this was a quick-click handleHover(x, y, mask); @@ -488,7 +488,7 @@ BOOL LLManipRotate::handleMouseUp(S32 x, S32 y, MASK mask) // Might have missed last update due to timing. LLSelectMgr::getInstance()->sendMultipleUpdate( UPD_ROTATION | UPD_POSITION ); - LLSelectMgr::getInstance()->enableSilhouette(TRUE); + LLSelectMgr::getInstance()->enableSilhouette(true); //gAgent.setObjectTracking(gSavedSettings.getBOOL("TrackFocusObject")); LLSelectMgr::getInstance()->updateSelectionCenter(); @@ -499,14 +499,14 @@ BOOL LLManipRotate::handleMouseUp(S32 x, S32 y, MASK mask) } -BOOL LLManipRotate::handleHover(S32 x, S32 y, MASK mask) +bool LLManipRotate::handleHover(S32 x, S32 y, MASK mask) { if( hasMouseCapture() ) { if( mObjectSelection->isEmpty() ) { // Somehow the object got deselected while we were dragging it. - setMouseCapture( FALSE ); + setMouseCapture( false ); } else { @@ -522,11 +522,11 @@ BOOL LLManipRotate::handleHover(S32 x, S32 y, MASK mask) } gViewerWindow->setCursor(UI_CURSOR_TOOLROTATE); - return TRUE; + return true; } -LLVector3 LLManipRotate::projectToSphere( F32 x, F32 y, BOOL* on_sphere ) +LLVector3 LLManipRotate::projectToSphere( F32 x, F32 y, bool* on_sphere ) { F32 z = 0.f; F32 dist_squared = x*x + y*y; @@ -556,8 +556,8 @@ void LLManipRotate::drag( S32 x, S32 y ) mRotation = dragConstrained(x, y); } - BOOL damped = mSmoothRotate; - mSmoothRotate = FALSE; + bool damped = mSmoothRotate; + mSmoothRotate = false; bool gltf_mode = false; for (LLObjectSelection::iterator iter = mObjectSelection->begin(); @@ -772,13 +772,13 @@ void LLManipRotate::renderActiveRing( F32 radius, F32 width, const LLColor4& fro { LLGLEnable cull_face(GL_CULL_FACE); { - gl_ring(radius, width, back_color, back_color * 0.5f, CIRCLE_STEPS, FALSE); - gl_ring(radius, width, back_color, back_color * 0.5f, CIRCLE_STEPS, TRUE); + gl_ring(radius, width, back_color, back_color * 0.5f, CIRCLE_STEPS, false); + gl_ring(radius, width, back_color, back_color * 0.5f, CIRCLE_STEPS, true); } { LLGLDepthTest gls_depth(GL_FALSE); - gl_ring(radius, width, front_color, front_color * 0.5f, CIRCLE_STEPS, FALSE); - gl_ring(radius, width, front_color, front_color * 0.5f, CIRCLE_STEPS, TRUE); + gl_ring(radius, width, front_color, front_color * 0.5f, CIRCLE_STEPS, false); + gl_ring(radius, width, front_color, front_color * 0.5f, CIRCLE_STEPS, true); } } @@ -813,7 +813,7 @@ void LLManipRotate::renderSnapGuides() LLVector3 world_snap_axis; LLVector3 test_axis = constraint_axis; - BOOL constrain_to_ref_object = FALSE; + bool constrain_to_ref_object = false; if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && isAgentAvatarValid()) { test_axis = test_axis * ~grid_rotation; @@ -821,7 +821,7 @@ void LLManipRotate::renderSnapGuides() else if (LLSelectMgr::getInstance()->getGridMode() == GRID_MODE_REF_OBJECT) { test_axis = test_axis * ~grid_rotation; - constrain_to_ref_object = TRUE; + constrain_to_ref_object = true; } test_axis.abs(); @@ -900,17 +900,17 @@ void LLManipRotate::renderSnapGuides() F32 end_angle = atan2(y_axis_snap * edge_normal, x_axis_snap * edge_normal); //F32 start_angle = angle_between((-1.f * LLVector3::x_axis) * snap_guide_rot, edge_normal); F32 start_angle = end_angle - F_PI; - gl_arc_2d(0.f, 0.f, mRadiusMeters * SNAP_GUIDE_INNER_RADIUS, CIRCLE_STEPS, FALSE, start_angle, end_angle); + gl_arc_2d(0.f, 0.f, mRadiusMeters * SNAP_GUIDE_INNER_RADIUS, CIRCLE_STEPS, false, start_angle, end_angle); } else { - gl_circle_2d(0.f, 0.f, mRadiusMeters * SNAP_GUIDE_INNER_RADIUS, CIRCLE_STEPS, FALSE); + gl_circle_2d(0.f, 0.f, mRadiusMeters * SNAP_GUIDE_INNER_RADIUS, CIRCLE_STEPS, false); } gGL.popMatrix(); for (S32 i = 0; i < 64; i++) { - BOOL render_text = TRUE; + bool render_text = true; F32 deg = 5.625f * (F32)i; LLVector3 inner_point; LLVector3 outer_point; @@ -948,7 +948,7 @@ void LLManipRotate::renderSnapGuides() if (dot > 0.f) { outer_point = inner_point; - render_text = FALSE; + render_text = false; } else { @@ -1087,7 +1087,7 @@ void LLManipRotate::renderSnapGuides() getObjectAxisClosestToMouse(object_axis); // project onto constraint plane - LLSelectNode* first_node = mObjectSelection->getFirstMoveableNode(TRUE); + LLSelectNode* first_node = mObjectSelection->getFirstMoveableNode(true); object_axis = object_axis * first_node->getObject()->getRenderRotation(); object_axis = object_axis - (object_axis * getConstraintAxis()) * getConstraintAxis(); object_axis.normVec(); @@ -1179,8 +1179,8 @@ void LLManipRotate::renderSnapGuides() } } -// Returns TRUE if center of sphere is visible. Also sets a bunch of member variables that are used later (e.g. mCenterToCam) -BOOL LLManipRotate::updateVisiblity() +// Returns true if center of sphere is visible. Also sets a bunch of member variables that are used later (e.g. mCenterToCam) +bool LLManipRotate::updateVisiblity() { // Don't want to recalculate the center of the selection during a drag. // Due to packet delays, sometimes half the objects in the selection have their @@ -1193,7 +1193,7 @@ BOOL LLManipRotate::updateVisiblity() mRotationCenter = gAgent.getPosGlobalFromAgent( getPivotPoint() );//LLSelectMgr::getInstance()->getSelectionCenterGlobal(); } - BOOL visible = FALSE; + bool visible = false; //Assume that UI scale factor is equivalent for X and Y axis F32 ui_scale_factor = LLUI::getScaleFactor().mV[VX]; @@ -1217,7 +1217,7 @@ BOOL LLManipRotate::updateVisiblity() // so use getWorldViewHeightRaw as scale factor when converting to pixel coordinates mCenterScreen.set((S32)((0.5f - center.mV[VY]) / gAgentCamera.mHUDCurZoom * gViewerWindow->getWorldViewHeightScaled()), (S32)((center.mV[VZ] + 0.5f) / gAgentCamera.mHUDCurZoom * gViewerWindow->getWorldViewHeightScaled())); - visible = TRUE; + visible = true; } else { @@ -1238,7 +1238,7 @@ BOOL LLManipRotate::updateVisiblity() F32 max_select_distance = gSavedSettings.getF32("MaxSelectDistance"); if (dist_vec_squared(gAgent.getPositionAgent(), center) > (max_select_distance * max_select_distance)) { - visible = FALSE; + visible = false; } } @@ -1254,16 +1254,16 @@ BOOL LLManipRotate::updateVisiblity() } else { - visible = FALSE; + visible = false; } } } - mCamEdgeOn = FALSE; + mCamEdgeOn = false; F32 axis_onto_cam = mManipPart >= LL_ROT_X ? llabs( getConstraintAxis() * mCenterToCamNorm ) : 0.f; if( axis_onto_cam < AXIS_ONTO_CAM_TOLERANCE ) { - mCamEdgeOn = TRUE; + mCamEdgeOn = true; } return visible; @@ -1356,7 +1356,7 @@ LLVector3 LLManipRotate::getConstraintAxis() LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale); - LLSelectNode* first_node = mObjectSelection->getFirstMoveableNode(TRUE); + LLSelectNode* first_node = mObjectSelection->getFirstMoveableNode(true); if (first_node) { // *FIX: get agent local attachment grid working @@ -1370,7 +1370,7 @@ LLVector3 LLManipRotate::getConstraintAxis() LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) { - LLSelectNode* first_object_node = mObjectSelection->getFirstMoveableNode(TRUE); + LLSelectNode* first_object_node = mObjectSelection->getFirstMoveableNode(true); LLVector3 constraint_axis = getConstraintAxis(); LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter ); @@ -1444,7 +1444,7 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) } LLVector3 projected_mouse; - BOOL hit = getMousePointOnPlaneAgent(projected_mouse, x, y, snap_plane_center, constraint_axis); + bool hit = getMousePointOnPlaneAgent(projected_mouse, x, y, snap_plane_center, constraint_axis); projected_mouse -= snap_plane_center; if (gSavedSettings.getBOOL("SnapEnabled")) { @@ -1559,9 +1559,9 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) if (!mInSnapRegime) { - mSmoothRotate = TRUE; + mSmoothRotate = true; } - mInSnapRegime = TRUE; + mInSnapRegime = true; // 0 to 360 deg F32 mouse_angle = fmodf(atan2(projected_mouse * axis1, projected_mouse * axis2) * RAD_TO_DEG + 360.f, 360.f); @@ -1593,17 +1593,17 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) { if (mInSnapRegime) { - mSmoothRotate = TRUE; + mSmoothRotate = true; } - mInSnapRegime = FALSE; + mInSnapRegime = false; } } else { if (mInSnapRegime) { - mSmoothRotate = TRUE; + mSmoothRotate = true; } - mInSnapRegime = FALSE; + mInSnapRegime = false; } if (!mInSnapRegime) @@ -1645,9 +1645,9 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) { if (!mInSnapRegime) { - mSmoothRotate = TRUE; + mSmoothRotate = true; } - mInSnapRegime = TRUE; + mInSnapRegime = true; // 0 to 360 deg F32 mouse_angle = fmodf(atan2(projected_mouse * axis1, projected_mouse * axis2) * RAD_TO_DEG + 360.f, 360.f); @@ -1676,9 +1676,9 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) { if (mInSnapRegime) { - mSmoothRotate = TRUE; + mSmoothRotate = true; } - mInSnapRegime = FALSE; + mInSnapRegime = false; } LLVector3 cross_product = mMouseDown % mMouseCur; @@ -1765,7 +1765,7 @@ void LLManipRotate::highlightManipulators( S32 x, S32 y ) mHighlightedPart = LL_NO_PART; //LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection(); - LLViewerObject *first_object = mObjectSelection->getFirstMoveableObject(TRUE); + LLViewerObject *first_object = mObjectSelection->getFirstMoveableObject(true); if (!first_object) { @@ -1900,7 +1900,7 @@ void LLManipRotate::highlightManipulators( S32 x, S32 y ) S32 LLManipRotate::getObjectAxisClosestToMouse(LLVector3& object_axis) { - LLSelectNode* first_object_node = mObjectSelection->getFirstMoveableNode(TRUE); + LLSelectNode* first_object_node = mObjectSelection->getFirstMoveableNode(true); if (!first_object_node) { @@ -1955,9 +1955,9 @@ S32 LLManipRotate::getObjectAxisClosestToMouse(LLVector3& object_axis) } //virtual -BOOL LLManipRotate::canAffectSelection() +bool LLManipRotate::canAffectSelection() { - BOOL can_rotate = mObjectSelection->getObjectCount() != 0; + bool can_rotate = mObjectSelection->getObjectCount() != 0; if (can_rotate) { struct f : public LLSelectedObjectFunctor diff --git a/indra/newview/llmaniprotate.h b/indra/newview/llmaniprotate.h index 92a8d7fece..fa764a9ced 100644 --- a/indra/newview/llmaniprotate.h +++ b/indra/newview/llmaniprotate.h @@ -53,27 +53,27 @@ public: LLManipRotate( LLToolComposite* composite ); - virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ); - virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask ); - virtual BOOL handleHover( S32 x, S32 y, MASK mask ); + virtual bool handleMouseDown( S32 x, S32 y, MASK mask ); + virtual bool handleMouseUp( S32 x, S32 y, MASK mask ); + virtual bool handleHover( S32 x, S32 y, MASK mask ); virtual void render(); virtual void handleSelect(); - virtual BOOL handleMouseDownOnPart(S32 x, S32 y, MASK mask); + virtual bool handleMouseDownOnPart(S32 x, S32 y, MASK mask); virtual void highlightManipulators(S32 x, S32 y); - virtual BOOL canAffectSelection(); + virtual bool canAffectSelection(); private: void updateHoverView(); void drag( S32 x, S32 y ); - LLVector3 projectToSphere( F32 x, F32 y, BOOL* on_sphere ); + LLVector3 projectToSphere( F32 x, F32 y, bool* on_sphere ); void renderSnapGuides(); void renderActiveRing(F32 radius, F32 width, const LLColor4& center_color, const LLColor4& side_color); - BOOL updateVisiblity(); + bool updateVisiblity(); LLVector3 findNearestPointOnRing( S32 x, S32 y, const LLVector3& center, const LLVector3& axis ); LLQuaternion dragUnconstrained( S32 x, S32 y ); @@ -104,10 +104,10 @@ private: LLVector3 mCenterToProfilePlane; F32 mCenterToProfilePlaneMag; - BOOL mSendUpdateOnMouseUp; + bool mSendUpdateOnMouseUp; - BOOL mSmoothRotate; - BOOL mCamEdgeOn; + bool mSmoothRotate; + bool mCamEdgeOn; LLVector4 mManipulatorVertices[6]; LLVector4 mManipulatorScales; diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp index 3bace98b15..c4f3f01ea1 100644 --- a/indra/newview/llmanipscale.cpp +++ b/indra/newview/llmanipscale.cpp @@ -101,37 +101,37 @@ F32 get_default_max_prim_scale(bool is_flora) } // static -void LLManipScale::setUniform(BOOL b) +void LLManipScale::setUniform(bool b) { gSavedSettings.setBOOL("ScaleUniform", b); } // static -void LLManipScale::setShowAxes(BOOL b) +void LLManipScale::setShowAxes(bool b) { gSavedSettings.setBOOL("ScaleShowAxes", b); } // static -void LLManipScale::setStretchTextures(BOOL b) +void LLManipScale::setStretchTextures(bool b) { gSavedSettings.setBOOL("ScaleStretchTextures", b); } // static -BOOL LLManipScale::getUniform() +bool LLManipScale::getUniform() { return gSavedSettings.getBOOL("ScaleUniform"); } // static -BOOL LLManipScale::getShowAxes() +bool LLManipScale::getShowAxes() { return gSavedSettings.getBOOL("ScaleShowAxes"); } // static -BOOL LLManipScale::getStretchTextures() +bool LLManipScale::getStretchTextures() { return gSavedSettings.getBOOL("ScaleStretchTextures"); } @@ -183,7 +183,7 @@ LLManipScale::LLManipScale( LLToolComposite* composite ) mScaledBoxHandleSize( 1.f ), mLastMouseX( -1 ), mLastMouseY( -1 ), - mSendUpdateOnMouseUp( FALSE ), + mSendUpdateOnMouseUp( false ), mLastUpdateFlags( 0 ), mScaleSnapUnit1(1.f), mScaleSnapUnit2(1.f), @@ -319,9 +319,9 @@ void LLManipScale::render() } } -BOOL LLManipScale::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLManipScale::handleMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; if(mHighlightedPart != LL_NO_PART) { @@ -332,18 +332,18 @@ BOOL LLManipScale::handleMouseDown(S32 x, S32 y, MASK mask) } // Assumes that one of the arrows on an object was hit. -BOOL LLManipScale::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) +bool LLManipScale::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) { - BOOL can_scale = canAffectSelection(); + bool can_scale = canAffectSelection(); if (!can_scale) { - return FALSE; + return false; } highlightManipulators(x, y); S32 hit_part = mHighlightedPart; - LLSelectMgr::getInstance()->enableSilhouette(FALSE); + LLSelectMgr::getInstance()->enableSilhouette(false); mManipPart = (EManipPart)hit_part; LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection(); @@ -365,15 +365,15 @@ BOOL LLManipScale::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) // we just started a drag, so save initial object positions, orientations, and scales LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_SCALE); // Route future Mouse messages here preemptively. (Release on mouse up.) - setMouseCapture( TRUE ); + setMouseCapture( true ); mHelpTextTimer.reset(); sNumTimesHelpTextShown++; - return TRUE; + return true; } -BOOL LLManipScale::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLManipScale::handleMouseUp(S32 x, S32 y, MASK mask) { // first, perform normal processing in case this was a quick-click handleHover(x, y, mask); @@ -383,19 +383,19 @@ BOOL LLManipScale::handleMouseUp(S32 x, S32 y, MASK mask) if( (LL_FACE_MIN <= (S32)mManipPart) && ((S32)mManipPart <= LL_FACE_MAX) ) { - sendUpdates(TRUE,TRUE,FALSE); + sendUpdates(true,true,false); } else if( (LL_CORNER_MIN <= (S32)mManipPart) && ((S32)mManipPart <= LL_CORNER_MAX) ) { - sendUpdates(TRUE,TRUE,TRUE); + sendUpdates(true,true,true); } //send texture update - LLSelectMgr::getInstance()->adjustTexturesByScale(TRUE, getStretchTextures()); + LLSelectMgr::getInstance()->adjustTexturesByScale(true, getStretchTextures()); - LLSelectMgr::getInstance()->enableSilhouette(TRUE); + LLSelectMgr::getInstance()->enableSilhouette(true); mManipPart = LL_NO_PART; // Might have missed last update due to UPDATE_DELAY timing @@ -408,14 +408,14 @@ BOOL LLManipScale::handleMouseUp(S32 x, S32 y, MASK mask) } -BOOL LLManipScale::handleHover(S32 x, S32 y, MASK mask) +bool LLManipScale::handleHover(S32 x, S32 y, MASK mask) { if( hasMouseCapture() ) { if( mObjectSelection->isEmpty() ) { // Somehow the object got deselected while we were dragging it. - setMouseCapture( FALSE ); + setMouseCapture( false ); } else { @@ -439,10 +439,10 @@ BOOL LLManipScale::handleHover(S32 x, S32 y, MASK mask) } // Patch up textures, if possible. - LLSelectMgr::getInstance()->adjustTexturesByScale(FALSE, getStretchTextures()); + LLSelectMgr::getInstance()->adjustTexturesByScale(false, getStretchTextures()); gViewerWindow->setCursor(UI_CURSOR_TOOLSCALE); - return TRUE; + return true; } void LLManipScale::highlightManipulators(S32 x, S32 y) @@ -865,7 +865,7 @@ void LLManipScale::dragCorner( S32 x, S32 y ) F32 scale_factor = 1.f; F32 max_scale = partToMaxScale(mManipPart, bbox); F32 min_scale = partToMinScale(mManipPart, bbox); - BOOL uniform = LLManipScale::getUniform(); + bool uniform = LLManipScale::getUniform(); // check for snapping LLVector3 mouse_on_plane1; @@ -879,7 +879,7 @@ void LLManipScale::dragCorner( S32 x, S32 y ) LLVector3 projected_drag_pos1 = inverse_projected_vec(mScaleDir, orthogonal_component(mouse_on_plane1, mSnapGuideDir1)); LLVector3 projected_drag_pos2 = inverse_projected_vec(mScaleDir, orthogonal_component(mouse_on_plane2, mSnapGuideDir2)); - BOOL snap_enabled = gSavedSettings.getBOOL("SnapEnabled"); + bool snap_enabled = gSavedSettings.getBOOL("SnapEnabled"); if (snap_enabled && (mouse_on_plane1 - projected_drag_pos1) * mSnapGuideDir1 > mSnapRegimeOffset) { F32 drag_dist = mScaleDir * projected_drag_pos1; // Projecting the drag position allows for negative results, vs using the length which will result in a "reverse scaling" bug. @@ -955,7 +955,7 @@ void LLManipScale::dragCorner( S32 x, S32 y ) LLVector3d drag_global = uniform ? mDragStartCenterGlobal : mDragFarHitGlobal; - // do the root objects i.e. (TRUE == cur->isRootEdit()) + // do the root objects i.e. (true == cur->isRootEdit()) for (LLObjectSelection::iterator iter = mObjectSelection->begin(); iter != mObjectSelection->end(); iter++) { @@ -1006,7 +1006,7 @@ void LLManipScale::dragCorner( S32 x, S32 y ) } } } - // do the child objects i.e. (FALSE == cur->isRootEdit()) + // do the child objects i.e. (false == cur->isRootEdit()) for (LLObjectSelection::iterator iter = mObjectSelection->begin(); iter != mObjectSelection->end(); iter++) { @@ -1018,7 +1018,7 @@ void LLManipScale::dragCorner( S32 x, S32 y ) !cur->isAvatar() && !cur->isRootEdit() ) { const LLVector3& scale = selectNode->mSavedScale; - cur->setScale( scale_factor * scale, FALSE ); + cur->setScale( scale_factor * scale, false ); if (!selectNode->mIndividualSelection) { @@ -1080,7 +1080,7 @@ void LLManipScale::dragFace( S32 x, S32 y ) F32 max_drag_dist = partToMaxScale(mManipPart, bbox); F32 min_drag_dist = partToMinScale(mManipPart, bbox); - BOOL uniform = LLManipScale::getUniform(); + bool uniform = LLManipScale::getUniform(); if( uniform ) { drag_delta *= 2.f; @@ -1090,7 +1090,7 @@ void LLManipScale::dragFace( S32 x, S32 y ) F32 dist_from_scale_line = dist_vec(scale_center_to_mouse, (mouse_on_scale_line - mScaleCenter)); F32 dist_along_scale_line = scale_center_to_mouse * mScaleDir; - BOOL snap_enabled = gSavedSettings.getBOOL("SnapEnabled"); + bool snap_enabled = gSavedSettings.getBOOL("SnapEnabled"); if (snap_enabled && dist_from_scale_line > mSnapRegimeOffset) { @@ -1166,7 +1166,7 @@ void LLManipScale::dragFace( S32 x, S32 y ) mDragPointGlobal = drag_point_global; } -void LLManipScale::sendUpdates( BOOL send_position_update, BOOL send_scale_update, BOOL corner ) +void LLManipScale::sendUpdates( bool send_position_update, bool send_scale_update, bool corner ) { // Throttle updates to 10 per second. static LLTimer update_timer; @@ -1179,7 +1179,7 @@ void LLManipScale::sendUpdates( BOOL send_position_update, BOOL send_scale_updat if (send_position_update) update_flags |= UPD_POSITION; if (send_scale_update) update_flags |= UPD_SCALE; -// BOOL send_type = SEND_INDIVIDUALS; +// bool send_type = SEND_INDIVIDUALS; if (corner) { update_flags |= UPD_UNIFORM; @@ -1192,11 +1192,11 @@ void LLManipScale::sendUpdates( BOOL send_position_update, BOOL send_scale_updat { LLSelectMgr::getInstance()->sendMultipleUpdate( update_flags ); update_timer.reset(); - mSendUpdateOnMouseUp = FALSE; + mSendUpdateOnMouseUp = false; } else { - mSendUpdateOnMouseUp = TRUE; + mSendUpdateOnMouseUp = true; } dialog_refresh_all(); } @@ -1245,7 +1245,7 @@ void LLManipScale::stretchFace( const LLVector3& drag_start_agent, const LLVecto LLVector3 scale = cur->getScale(); scale.mV[axis_index] = desired_scale; - cur->setScale(scale, FALSE); + cur->setScale(scale, false); rebuild(cur); LLVector3 delta_pos; if( !getUniform() ) @@ -2076,11 +2076,11 @@ LLVector3 LLManipScale::nearestAxis( const LLVector3& v ) const } // virtual -BOOL LLManipScale::canAffectSelection() +bool LLManipScale::canAffectSelection() { // An selection is scalable if you are allowed to both edit and move // everything in it, and it does not have any sitting agents - BOOL can_scale = mObjectSelection->getObjectCount() != 0; + bool can_scale = mObjectSelection->getObjectCount() != 0; if (can_scale) { struct f : public LLSelectedObjectFunctor diff --git a/indra/newview/llmanipscale.h b/indra/newview/llmanipscale.h index e8735e673e..8a615cb7e4 100644 --- a/indra/newview/llmanipscale.h +++ b/indra/newview/llmanipscale.h @@ -76,22 +76,22 @@ public: LLManipScale( LLToolComposite* composite ); ~LLManipScale(); - virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ); - virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask ); - virtual BOOL handleHover( S32 x, S32 y, MASK mask ); + virtual bool handleMouseDown( S32 x, S32 y, MASK mask ); + virtual bool handleMouseUp( S32 x, S32 y, MASK mask ); + virtual bool handleHover( S32 x, S32 y, MASK mask ); virtual void render(); virtual void handleSelect(); - virtual BOOL handleMouseDownOnPart(S32 x, S32 y, MASK mask); + virtual bool handleMouseDownOnPart(S32 x, S32 y, MASK mask); virtual void highlightManipulators(S32 x, S32 y); // decided which manipulator, if any, should be highlighted by mouse hover - virtual BOOL canAffectSelection(); + virtual bool canAffectSelection(); - static void setUniform( BOOL b ); - static BOOL getUniform(); - static void setStretchTextures( BOOL b ); - static BOOL getStretchTextures(); - static void setShowAxes( BOOL b ); - static BOOL getShowAxes(); + static void setUniform( bool b ); + static bool getUniform(); + static void setStretchTextures( bool b ); + static bool getStretchTextures(); + static void setShowAxes( bool b ); + static bool getShowAxes(); private: void renderCorners( const LLBBox& local_bbox ); @@ -109,7 +109,7 @@ private: void dragFace( S32 x, S32 y ); void dragCorner( S32 x, S32 y ); - void sendUpdates( BOOL send_position_update, BOOL send_scale_update, BOOL corner = FALSE); + void sendUpdates( bool send_position_update, bool send_scale_update, bool corner = false); LLVector3 faceToUnitVector( S32 part ) const; LLVector3 cornerToUnitVector( S32 part ) const; @@ -148,7 +148,7 @@ private: LLVector3d mDragFarHitGlobal; S32 mLastMouseX; S32 mLastMouseY; - BOOL mSendUpdateOnMouseUp; + bool mSendUpdateOnMouseUp; U32 mLastUpdateFlags; typedef std::set<ManipulatorHandle*, compare_manipulators> manipulator_list_t; manipulator_list_t mProjectedManipulators; diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp index b3ecb6403b..c11a98be50 100644 --- a/indra/newview/llmaniptranslate.cpp +++ b/indra/newview/llmaniptranslate.cpp @@ -1,4 +1,4 @@ -/** +/** * @file llmaniptranslate.cpp * @brief LLManipTranslate class implementation * @@ -111,8 +111,8 @@ LLManipTranslate::LLManipTranslate( LLToolComposite* composite ) : LLManip( std::string("Move"), composite ), mLastHoverMouseX(-1), mLastHoverMouseY(-1), - mMouseOutsideSlop(FALSE), - mCopyMadeThisDrag(FALSE), + mMouseOutsideSlop(false), + mCopyMadeThisDrag(false), mMouseDownX(-1), mMouseDownY(-1), mAxisArrowLength(50), @@ -123,7 +123,7 @@ LLManipTranslate::LLManipTranslate( LLToolComposite* composite ) mUpdateTimer(), mSnapOffsetMeters(0.f), mSubdivisions(10.f), - mInSnapRegime(FALSE), + mInSnapRegime(false), mArrowScales(1.f, 1.f, 1.f), mPlaneScales(1.f, 1.f, 1.f), mPlaneManipPositions(1.f, 1.f, 1.f, 1.f) @@ -290,9 +290,9 @@ void LLManipTranslate::handleSelect() LLManip::handleSelect(); } -BOOL LLManipTranslate::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLManipTranslate::handleMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; // didn't click in any UI object, so must have clicked in the world if( (mHighlightedPart == LL_X_ARROW || @@ -309,12 +309,12 @@ BOOL LLManipTranslate::handleMouseDown(S32 x, S32 y, MASK mask) } // Assumes that one of the arrows on an object was hit. -BOOL LLManipTranslate::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) +bool LLManipTranslate::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) { - BOOL can_move = canAffectSelection(); + bool can_move = canAffectSelection(); if (!can_move) { - return FALSE; + return false; } highlightManipulators(x, y); @@ -327,7 +327,7 @@ BOOL LLManipTranslate::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) (hit_part != LL_XZ_PLANE) && (hit_part != LL_XY_PLANE) ) { - return TRUE; + return true; } mHelpTextTimer.reset(); @@ -335,7 +335,7 @@ BOOL LLManipTranslate::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) LLSelectMgr::getInstance()->getGrid(mGridOrigin, mGridRotation, mGridScale); - LLSelectMgr::getInstance()->enableSilhouette(FALSE); + LLSelectMgr::getInstance()->enableSilhouette(false); // we just started a drag, so save initial object positions LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_MOVE); @@ -343,17 +343,17 @@ BOOL LLManipTranslate::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) mManipPart = (EManipPart)hit_part; mMouseDownX = x; mMouseDownY = y; - mMouseOutsideSlop = FALSE; + mMouseOutsideSlop = false; LLVector3 axis; - LLSelectNode *selectNode = mObjectSelection->getFirstMoveableNode(TRUE); + LLSelectNode *selectNode = mObjectSelection->getFirstMoveableNode(true); if (!selectNode) { // didn't find the object in our selection...oh well LL_WARNS() << "Trying to translate an unselected object" << LL_ENDL; - return TRUE; + return true; } LLViewerObject *selected_object = selectNode->getObject(); @@ -362,11 +362,11 @@ BOOL LLManipTranslate::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) // somehow we lost the object! LL_WARNS() << "Translate manip lost the object, no selected object" << LL_ENDL; gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE); - return TRUE; + return true; } // Compute unit vectors for arrow hit and a plane through that vector - BOOL axis_exists = getManipAxis(selected_object, mManipPart, axis); + bool axis_exists = getManipAxis(selected_object, mManipPart, axis); getManipNormal(selected_object, mManipPart, mManipNormal); //LLVector3 select_center_agent = gAgent.getPosAgentFromGlobal(LLSelectMgr::getInstance()->getSelectionCenterGlobal()); @@ -395,15 +395,15 @@ BOOL LLManipTranslate::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) LLVector3d object_start_global = gAgent.getPosGlobalFromAgent(getPivotPoint()); getMousePointOnPlaneGlobal(mDragCursorStartGlobal, x, y, object_start_global, mManipNormal); mDragSelectionStartGlobal = object_start_global; - mCopyMadeThisDrag = FALSE; + mCopyMadeThisDrag = false; // Route future Mouse messages here preemptively. (Release on mouse up.) - setMouseCapture( TRUE ); + setMouseCapture( true ); - return TRUE; + return true; } -BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) +bool LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) { // Translation tool only works if mouse button is down. // Bail out if mouse not down. @@ -415,7 +415,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE); highlightManipulators(x, y); - return TRUE; + return true; } // Handle auto-rotation if necessary. @@ -423,7 +423,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) const F32 ROTATE_ANGLE_PER_SECOND = 30.f * DEG_TO_RAD; const S32 ROTATE_H_MARGIN = world_rect.getWidth() / 20; const F32 rotate_angle = ROTATE_ANGLE_PER_SECOND / gFPSClamped; - BOOL rotated = FALSE; + bool rotated = false; // ...build mode moves camera about focus point if (mObjectSelection->getSelectType() != SELECT_TYPE_HUD) @@ -431,12 +431,12 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) if (x < ROTATE_H_MARGIN) { gAgentCamera.cameraOrbitAround(rotate_angle); - rotated = TRUE; + rotated = true; } else if (x > world_rect.getWidth() - ROTATE_H_MARGIN) { gAgentCamera.cameraOrbitAround(-rotate_angle); - rotated = TRUE; + rotated = true; } } @@ -447,7 +447,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) { LL_DEBUGS("UserInput") << "hover handled by LLManipTranslate (mouse unmoved)" << LL_ENDL; gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE); - return TRUE; + return true; } mLastHoverMouseX = x; mLastHoverMouseY = y; @@ -460,18 +460,18 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) { LL_DEBUGS("UserInput") << "hover handled by LLManipTranslate (mouse inside slop)" << LL_ENDL; gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE); - return TRUE; + return true; } else { // ...just went outside the slop region - mMouseOutsideSlop = TRUE; + mMouseOutsideSlop = true; // If holding down shift, leave behind a copy. if (mask == MASK_COPY) { // ...we're trying to make a copy - LLSelectMgr::getInstance()->selectDuplicate(LLVector3::zero, FALSE); - mCopyMadeThisDrag = TRUE; + LLSelectMgr::getInstance()->selectDuplicate(LLVector3::zero, false); + mCopyMadeThisDrag = true; // When we make the copy, we don't want to do any other processing. // If so, the object will also be moved, and the copy will be offset. @@ -488,13 +488,13 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) // pick the first object to constrain to grid w/ common origin // this is so we don't screw up groups - LLSelectNode* selectNode = mObjectSelection->getFirstMoveableNode(TRUE); + LLSelectNode* selectNode = mObjectSelection->getFirstMoveableNode(true); if (!selectNode) { // somehow we lost the object! LL_WARNS() << "Translate manip lost the object, no selectNode" << LL_ENDL; gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE); - return TRUE; + return true; } LLViewerObject* object = selectNode->getObject(); @@ -503,11 +503,11 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) // somehow we lost the object! LL_WARNS() << "Translate manip lost the object, no object in selectNode" << LL_ENDL; gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE); - return TRUE; + return true; } // Compute unit vectors for arrow hit and a plane through that vector - BOOL axis_exists = getManipAxis(object, mManipPart, axis_f); // TODO: move this + bool axis_exists = getManipAxis(object, mManipPart, axis_f); // TODO: move this axis_d.setVec(axis_f); @@ -530,7 +530,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) { LL_DEBUGS("UserInput") << "hover handled by LLManipTranslate (too far)" << LL_ENDL; gViewerWindow->setCursor(UI_CURSOR_NOLOCKED); - return TRUE; + return true; } } @@ -546,7 +546,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) { if (off_axis_magnitude > mSnapOffsetMeters) { - mInSnapRegime = TRUE; + mInSnapRegime = true; LLVector3 cursor_snap_agent = gAgent.getPosAgentFromGlobal(cursor_point_snap_line); F32 cursor_grid_dist = (cursor_snap_agent - mGridOrigin) * axis_f; @@ -630,16 +630,16 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) } cursor_point_agent = (cursor_point_grid * mGridRotation) + mGridOrigin; relative_move.setVec(cursor_point_agent - gAgent.getPosAgentFromGlobal(mDragSelectionStartGlobal)); - mInSnapRegime = TRUE; + mInSnapRegime = true; } else { - mInSnapRegime = FALSE; + mInSnapRegime = false; } } else { - mInSnapRegime = FALSE; + mInSnapRegime = false; } // Clamp to arrow direction @@ -712,7 +712,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) if (selectNode->mIndividualSelection) { // counter-translate child objects if we are moving the root as an individual - object->resetChildrenPosition(old_position_local - new_position_local, TRUE); + object->resetChildrenPosition(old_position_local - new_position_local, true); } } else @@ -759,14 +759,14 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) LLViewerObject* root_object = object->getRootEdit(); new_position_agent -= root_object->getPositionAgent(); new_position_agent = new_position_agent * ~root_object->getRotation(); - object->setPositionParent(new_position_agent, FALSE); + object->setPositionParent(new_position_agent, false); rebuild(object); } if (selectNode->mIndividualSelection) { // counter-translate child objects if we are moving the root as an individual - object->resetChildrenPosition(old_position_agent - new_position_agent, TRUE); + object->resetChildrenPosition(old_position_agent - new_position_agent, true); } } selectNode->mLastPositionLocal = object->getPosition(); @@ -781,7 +781,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) LL_DEBUGS("UserInput") << "hover handled by LLManipTranslate (active)" << LL_ENDL; gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE); - return TRUE; + return true; } void LLManipTranslate::highlightManipulators(S32 x, S32 y) @@ -857,9 +857,9 @@ void LLManipTranslate::highlightManipulators(S32 x, S32 y) S32 num_arrow_manips = numManips; // planar manipulators - BOOL planar_manip_yz_visible = FALSE; - BOOL planar_manip_xz_visible = FALSE; - BOOL planar_manip_xy_visible = FALSE; + bool planar_manip_yz_visible = false; + bool planar_manip_xz_visible = false; + bool planar_manip_xy_visible = false; mManipulatorVertices[numManips] = LLVector4(0.f, mPlaneManipOffsetMeters * (1.f - PLANE_TICK_SIZE * 0.5f), mPlaneManipOffsetMeters * (1.f - PLANE_TICK_SIZE * 0.5f), 1.f); mManipulatorVertices[numManips++].scaleVec(mPlaneManipPositions); @@ -867,7 +867,7 @@ void LLManipTranslate::highlightManipulators(S32 x, S32 y) mManipulatorVertices[numManips++].scaleVec(mPlaneManipPositions); if (llabs(relative_camera_dir.mV[VX]) > MIN_PLANE_MANIP_DOT_PRODUCT) { - planar_manip_yz_visible = TRUE; + planar_manip_yz_visible = true; } mManipulatorVertices[numManips] = LLVector4(mPlaneManipOffsetMeters * (1.f - PLANE_TICK_SIZE * 0.5f), 0.f, mPlaneManipOffsetMeters * (1.f - PLANE_TICK_SIZE * 0.5f), 1.f); @@ -876,7 +876,7 @@ void LLManipTranslate::highlightManipulators(S32 x, S32 y) mManipulatorVertices[numManips++].scaleVec(mPlaneManipPositions); if (llabs(relative_camera_dir.mV[VY]) > MIN_PLANE_MANIP_DOT_PRODUCT) { - planar_manip_xz_visible = TRUE; + planar_manip_xz_visible = true; } mManipulatorVertices[numManips] = LLVector4(mPlaneManipOffsetMeters * (1.f - PLANE_TICK_SIZE * 0.5f), mPlaneManipOffsetMeters * (1.f - PLANE_TICK_SIZE * 0.5f), 0.f, 1.f); @@ -885,7 +885,7 @@ void LLManipTranslate::highlightManipulators(S32 x, S32 y) mManipulatorVertices[numManips++].scaleVec(mPlaneManipPositions); if (llabs(relative_camera_dir.mV[VZ]) > MIN_PLANE_MANIP_DOT_PRODUCT) { - planar_manip_xy_visible = TRUE; + planar_manip_xy_visible = true; } // Project up to 9 manipulators to screen space 2*X, 2*Y, 2*Z, 3*planes @@ -1033,7 +1033,7 @@ F32 LLManipTranslate::getMinGridScale() } -BOOL LLManipTranslate::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLManipTranslate::handleMouseUp(S32 x, S32 y, MASK mask) { // first, perform normal processing in case this was a quick-click handleHover(x, y, mask); @@ -1042,12 +1042,12 @@ BOOL LLManipTranslate::handleMouseUp(S32 x, S32 y, MASK mask) { // make sure arrow colors go back to normal mManipPart = LL_NO_PART; - LLSelectMgr::getInstance()->enableSilhouette(TRUE); + LLSelectMgr::getInstance()->enableSilhouette(true); // Might have missed last update due to UPDATE_DELAY timing. LLSelectMgr::getInstance()->sendMultipleUpdate( UPD_POSITION ); - mInSnapRegime = FALSE; + mInSnapRegime = false; LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK); //gAgent.setObjectTracking(gSavedSettings.getBOOL("TrackFocusObject")); } @@ -1099,7 +1099,7 @@ void LLManipTranslate::renderSnapGuides() return; } - LLSelectNode *first_node = mObjectSelection->getFirstMoveableNode(TRUE); + LLSelectNode *first_node = mObjectSelection->getFirstMoveableNode(true); if (!first_node) { return; @@ -1267,24 +1267,24 @@ void LLManipTranslate::renderSnapGuides() LLVector3 line_end = selection_center + (mSnapOffsetMeters * mSnapOffsetAxis) - (translate_axis * (guide_size_meters * 0.5f + offset_nearest_grid_unit)); LLVector3 line_mid = (line_start + line_end) * 0.5f; - gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW] * 0.2f); + gGL.color4f(line_color.mV[VRED], line_color.mV[VGREEN], line_color.mV[VBLUE], line_color.mV[VALPHA] * 0.2f); gGL.vertex3fv(line_start.mV); - gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW]); + gGL.color4f(line_color.mV[VRED], line_color.mV[VGREEN], line_color.mV[VBLUE], line_color.mV[VALPHA]); gGL.vertex3fv(line_mid.mV); gGL.vertex3fv(line_mid.mV); - gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW] * 0.2f); + gGL.color4f(line_color.mV[VRED], line_color.mV[VGREEN], line_color.mV[VBLUE], line_color.mV[VALPHA] * 0.2f); gGL.vertex3fv(line_end.mV); line_start.setVec(selection_center + (mSnapOffsetAxis * -mSnapOffsetMeters) + (translate_axis * guide_size_meters * 0.5f)); line_end.setVec(selection_center + (mSnapOffsetAxis * -mSnapOffsetMeters) - (translate_axis * guide_size_meters * 0.5f)); line_mid = (line_start + line_end) * 0.5f; - gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW] * 0.2f); + gGL.color4f(line_color.mV[VRED], line_color.mV[VGREEN], line_color.mV[VBLUE], line_color.mV[VALPHA] * 0.2f); gGL.vertex3fv(line_start.mV); - gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW]); + gGL.color4f(line_color.mV[VRED], line_color.mV[VGREEN], line_color.mV[VBLUE], line_color.mV[VALPHA]); gGL.vertex3fv(line_mid.mV); gGL.vertex3fv(line_mid.mV); - gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW] * 0.2f); + gGL.color4f(line_color.mV[VRED], line_color.mV[VGREEN], line_color.mV[VBLUE], line_color.mV[VALPHA] * 0.2f); gGL.vertex3fv(line_end.mV); for (S32 i = -num_ticks_per_side; i <= num_ticks_per_side; i++) @@ -1316,7 +1316,7 @@ void LLManipTranslate::renderSnapGuides() tick_end = tick_start + (mSnapOffsetAxis * mSnapOffsetMeters * tick_scale); - gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW]); + gGL.color4f(line_color.mV[VRED], line_color.mV[VGREEN], line_color.mV[VBLUE], line_color.mV[VALPHA]); gGL.vertex3fv(tick_start.mV); gGL.vertex3fv(tick_end.mV); @@ -1337,7 +1337,7 @@ void LLManipTranslate::renderSnapGuides() gGL.begin(LLRender::LINES); { - gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW]); + gGL.color4f(line_color.mV[VRED], line_color.mV[VGREEN], line_color.mV[VBLUE], line_color.mV[VALPHA]); gGL.vertex3fv(line_start.mV); gGL.vertex3fv(line_end.mV); @@ -1347,7 +1347,7 @@ void LLManipTranslate::renderSnapGuides() // draw snap guide arrow gGL.begin(LLRender::TRIANGLES); { - gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW]); + gGL.color4f(line_color.mV[VRED], line_color.mV[VGREEN], line_color.mV[VBLUE], line_color.mV[VALPHA]); LLVector3 arrow_dir; LLVector3 arrow_span = translate_axis; @@ -1573,13 +1573,13 @@ void LLManipTranslate::renderSnapGuides() switch (mManipPart) { case LL_YZ_PLANE: - renderGuidelines(FALSE, TRUE, TRUE); + renderGuidelines(false, true, true); break; case LL_XZ_PLANE: - renderGuidelines(TRUE, FALSE, TRUE); + renderGuidelines(true, false, true); break; case LL_XY_PLANE: - renderGuidelines(TRUE, TRUE, FALSE); + renderGuidelines(true, true, false); break; default: break; @@ -1683,8 +1683,8 @@ void LLManipTranslate::highlightIntersection(LLVector3 normal, static LLStaticHashedString sClipPlane("clip_plane"); gClipProgram.uniform4fv(sClipPlane, 1, plane.v); - BOOL particles = gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_PARTICLES); - BOOL clouds = gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS); + bool particles = gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_PARTICLES); + bool clouds = gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS); if (particles) { @@ -1700,14 +1700,14 @@ void LLManipTranslate::highlightIntersection(LLVector3 normal, glCullFace(GL_FRONT); for (U32 i = 0; i < num_types; i++) { - gPipeline.renderObjects(types[i], LLVertexBuffer::MAP_VERTEX, FALSE); + gPipeline.renderObjects(types[i], LLVertexBuffer::MAP_VERTEX, false); } //glStencilOp(GL_DECR, GL_DECR, GL_DECR); glCullFace(GL_BACK); for (U32 i = 0; i < num_types; i++) { - gPipeline.renderObjects(types[i], LLVertexBuffer::MAP_VERTEX, FALSE); + gPipeline.renderObjects(types[i], LLVertexBuffer::MAP_VERTEX, false); } if (particles) @@ -1738,11 +1738,6 @@ void LLManipTranslate::highlightIntersection(LLVector3 normal, shader->bind(); } - if (shader) - { - shader->bind(); - } - //draw volume/plane intersections { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); @@ -1770,7 +1765,7 @@ void LLManipTranslate::renderText() } else { - const BOOL children_ok = TRUE; + const bool children_ok = true; LLViewerObject* objectp = mObjectSelection->getFirstRootObject(children_ok); if (objectp) { @@ -1824,7 +1819,7 @@ void LLManipTranslate::renderTranslationHandles() mPlaneManipPositions.mV[VZ] = -1.f; } - LLViewerObject *first_object = mObjectSelection->getFirstMoveableObject(TRUE); + LLViewerObject *first_object = mObjectSelection->getFirstMoveableObject(true); if (!first_object) return; LLVector3 selection_center = getPivotPoint(); @@ -2179,7 +2174,7 @@ void LLManipTranslate::renderTranslationHandles() (face >= 3) ? -mConeSize : mConeSize, (face >= 3) ? -mArrowLengthMeters : mArrowLengthMeters, mConeSize, - FALSE); + false); } } } @@ -2187,7 +2182,7 @@ void LLManipTranslate::renderTranslationHandles() } -void LLManipTranslate::renderArrow(S32 which_arrow, S32 selected_arrow, F32 box_size, F32 arrow_size, F32 handle_size, BOOL reverse_direction) +void LLManipTranslate::renderArrow(S32 which_arrow, S32 selected_arrow, F32 box_size, F32 arrow_size, F32 handle_size, bool reverse_direction) { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLEnable gls_blend(GL_BLEND); @@ -2289,9 +2284,9 @@ void LLManipTranslate::renderGridVert(F32 x_trans, F32 y_trans, F32 r, F32 g, F3 } // virtual -BOOL LLManipTranslate::canAffectSelection() +bool LLManipTranslate::canAffectSelection() { - BOOL can_move = mObjectSelection->getObjectCount() != 0; + bool can_move = mObjectSelection->getObjectCount() != 0; if (can_move) { struct f : public LLSelectedObjectFunctor diff --git a/indra/newview/llmaniptranslate.h b/indra/newview/llmaniptranslate.h index 60621c8498..c0109db658 100644 --- a/indra/newview/llmaniptranslate.h +++ b/indra/newview/llmaniptranslate.h @@ -53,15 +53,15 @@ public: static U32 getGridTexName() ; static void destroyGL(); static void restoreGL(); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleHover(S32 x, S32 y, MASK mask); virtual void render(); virtual void handleSelect(); virtual void highlightManipulators(S32 x, S32 y); - virtual BOOL handleMouseDownOnPart(S32 x, S32 y, MASK mask); - virtual BOOL canAffectSelection(); + virtual bool handleMouseDownOnPart(S32 x, S32 y, MASK mask); + virtual bool canAffectSelection(); protected: enum EHandleType { @@ -70,7 +70,7 @@ protected: HANDLE_SPHERE }; - void renderArrow(S32 which_arrow, S32 selected_arrow, F32 box_size, F32 arrow_size, F32 handle_size, BOOL reverse_direction); + void renderArrow(S32 which_arrow, S32 selected_arrow, F32 box_size, F32 arrow_size, F32 handle_size, bool reverse_direction); void renderTranslationHandles(); void renderText(); void renderSnapGuides(); @@ -85,8 +85,8 @@ protected: private: S32 mLastHoverMouseX; S32 mLastHoverMouseY; - BOOL mMouseOutsideSlop; // true after mouse goes outside slop region - BOOL mCopyMadeThisDrag; + bool mMouseOutsideSlop; // true after mouse goes outside slop region + bool mCopyMadeThisDrag; S32 mMouseDownX; S32 mMouseDownY; F32 mAxisArrowLength; // pixels @@ -105,7 +105,7 @@ private: LLVector3 mGridOrigin; LLVector3 mGridScale; F32 mSubdivisions; - BOOL mInSnapRegime; + bool mInSnapRegime; LLVector3 mArrowScales; LLVector3 mPlaneScales; LLVector4 mPlaneManipPositions; diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index c0dd8bf208..7b8211ded8 100644 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -42,8 +42,6 @@ #include "llviewermedia.h" #include "llviewernetwork.h" #include "llviewerregion.h" -#include "json/reader.h" // JSON -#include "json/writer.h" // JSON #include "lleventcoro.h" #include "llcoros.h" #include "llcorehttputil.h" diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index 36a0834845..92f8ed949e 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -104,17 +104,17 @@ LLFloaterComboOptions::~LLFloaterComboOptions() } -BOOL LLFloaterComboOptions::postBuild() +bool LLFloaterComboOptions::postBuild() { - mConfirmButton = getChild<LLButton>("combo_ok", TRUE); - mCancelButton = getChild<LLButton>("combo_cancel", TRUE); - mComboOptions = getChild<LLComboBox>("combo_options", TRUE); - mComboText = getChild<LLTextBox>("combo_text", TRUE); + mConfirmButton = getChild<LLButton>("combo_ok", true); + mCancelButton = getChild<LLButton>("combo_cancel", true); + mComboOptions = getChild<LLComboBox>("combo_options", true); + mComboText = getChild<LLTextBox>("combo_text", true); mConfirmButton->setCommitCallback([this](LLUICtrl* ctrl, const LLSD& param) {onConfirm(); }); mCancelButton->setCommitCallback([this](LLUICtrl* ctrl, const LLSD& param) {onCancel(); }); - return TRUE; + return true; } LLFloaterComboOptions* LLFloaterComboOptions::showUI( @@ -140,7 +140,7 @@ LLFloaterComboOptions* LLFloaterComboOptions::showUI( combo_picker->mComboOptions->selectFirstItem(); combo_picker->openFloater(LLSD(title)); - combo_picker->setFocus(TRUE); + combo_picker->setFocus(true); combo_picker->center(); } return combo_picker; @@ -421,7 +421,7 @@ void LLMaterialEditor::setAuxItem(const LLInventoryItem* item) } } -BOOL LLMaterialEditor::postBuild() +bool LLMaterialEditor::postBuild() { // if this is a 'live editor' instance, it is also // single instance and uses live overrides @@ -482,10 +482,10 @@ BOOL LLMaterialEditor::postBuild() if (mIsOverride) { - childSetVisible("base_color_upload_fee", FALSE); - childSetVisible("metallic_upload_fee", FALSE); - childSetVisible("emissive_upload_fee", FALSE); - childSetVisible("normal_upload_fee", FALSE); + childSetVisible("base_color_upload_fee", false); + childSetVisible("metallic_upload_fee", false); + childSetVisible("emissive_upload_fee", false); + childSetVisible("normal_upload_fee", false); } else { @@ -615,7 +615,7 @@ void LLMaterialEditor::setBaseColorId(const LLUUID& id) { mBaseColorTextureCtrl->setValue(id); mBaseColorTextureCtrl->setDefaultImageAssetID(id); - mBaseColorTextureCtrl->setTentative(FALSE); + mBaseColorTextureCtrl->setTentative(false); } void LLMaterialEditor::setBaseColorUploadId(const LLUUID& id) @@ -691,7 +691,7 @@ void LLMaterialEditor::setMetallicRoughnessId(const LLUUID& id) { mMetallicTextureCtrl->setValue(id); mMetallicTextureCtrl->setDefaultImageAssetID(id); - mMetallicTextureCtrl->setTentative(FALSE); + mMetallicTextureCtrl->setTentative(false); } void LLMaterialEditor::setMetallicRoughnessUploadId(const LLUUID& id) @@ -735,7 +735,7 @@ void LLMaterialEditor::setEmissiveId(const LLUUID& id) { mEmissiveTextureCtrl->setValue(id); mEmissiveTextureCtrl->setDefaultImageAssetID(id); - mEmissiveTextureCtrl->setTentative(FALSE); + mEmissiveTextureCtrl->setTentative(false); } void LLMaterialEditor::setEmissiveUploadId(const LLUUID& id) @@ -769,7 +769,7 @@ void LLMaterialEditor::setNormalId(const LLUUID& id) { mNormalTextureCtrl->setValue(id); mNormalTextureCtrl->setDefaultImageAssetID(id); - mNormalTextureCtrl->setTentative(FALSE); + mNormalTextureCtrl->setTentative(false); } void LLMaterialEditor::setNormalUploadId(const LLUUID& id) @@ -1263,7 +1263,7 @@ bool LLMaterialEditor::decodeAsset(const std::vector<char>& buffer) tinygltf::Model model_in; - if (loader.LoadASCIIFromString(&model_in, &error_msg, &warn_msg, data.c_str(), data.length(), "")) + if (loader.LoadASCIIFromString(&model_in, &error_msg, &warn_msg, data.c_str(), static_cast<unsigned int>(data.length()), "")) { // assets are only supposed to have one item // *NOTE: This duplicates some functionality from @@ -2055,7 +2055,7 @@ void LLMaterialEditor::loadLive() } me->openFloater(); - me->setFocus(TRUE); + me->setFocus(true); } } @@ -2549,7 +2549,7 @@ void LLMaterialEditor::loadMaterial(const tinygltf::Model &model_in, const std:: if (open_floater) { openFloater(getKey()); - setFocus(TRUE); + setFocus(true); setCanSave(true); setCanSaveAs(true); @@ -2674,7 +2674,7 @@ const std::string LLMaterialEditor::getImageNameFromUri(std::string image_uri, c } // uri doesn't include the type at all - if (name_includes_type == false) + if (!name_includes_type) { // uri doesn't include the type and the uri is not empty // so we can include everything @@ -3387,7 +3387,7 @@ void LLMaterialEditor::loadAsset() LLAssetType::AT_MATERIAL, &onLoadComplete, (void*)user_data, - TRUE); + true); } } } @@ -3419,7 +3419,7 @@ void LLMaterialEditor::loadAsset() { /*editor->setText(LLStringUtil::null); editor->makePristine(); - editor->setEnabled(TRUE);*/ + editor->setEnabled(true);*/ // Don't set asset status here; we may not have set the item id yet // (e.g. when this gets called initially) //mAssetStatus = PREVIEW_ASSET_LOADED; @@ -3451,8 +3451,8 @@ void LLMaterialEditor::onLoadComplete(const LLUUID& asset_uuid, editor->decodeAsset(buffer); - BOOL allow_modify = editor->canModify(editor->mObjectUUID, editor->getItem()); - BOOL source_library = editor->mObjectUUID.isNull() && gInventory.isObjectDescendentOf(editor->mItemUUID, gInventory.getLibraryRootFolderID()); + bool allow_modify = editor->canModify(editor->mObjectUUID, editor->getItem()); + bool source_library = editor->mObjectUUID.isNull() && gInventory.isObjectDescendentOf(editor->mItemUUID, gInventory.getLibraryRootFolderID()); editor->setEnableEditing(allow_modify && !source_library); editor->resetUnsavedChanges(); editor->mAssetStatus = PREVIEW_ASSET_LOADED; @@ -3500,6 +3500,8 @@ void LLMaterialEditor::inventoryChanged(LLViewerObject* object, void LLMaterialEditor::saveTexture(LLImageJ2C* img, const std::string& name, const LLUUID& asset_id, upload_callback_f cb) { + LLImageDataSharedLock lock(img); + if (asset_id.isNull() || img == nullptr || img->getDataSize() == 0) diff --git a/indra/newview/llmaterialeditor.h b/indra/newview/llmaterialeditor.h index 11809d26be..232467460e 100644 --- a/indra/newview/llmaterialeditor.h +++ b/indra/newview/llmaterialeditor.h @@ -55,7 +55,7 @@ public: LLFloaterComboOptions(); virtual ~LLFloaterComboOptions(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); static LLFloaterComboOptions* showUI( combo_callback callback, @@ -164,7 +164,7 @@ class LLMaterialEditor : public LLPreview, public LLVOInventoryListener void setAuxItem(const LLInventoryItem* item) override; // llpanel - BOOL postBuild() override; + bool postBuild() override; void onClickCloseBtn(bool app_quitting = false) override; void onClose(bool app_quitting) override; diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index 271a35ba42..ee5e5b438e 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -431,7 +431,7 @@ void LLMaterialMgr::onGetResponse(bool success, const LLSD& content, const LLUUI const LLSD::Binary& content_binary = content[MATERIALS_CAP_ZIP_FIELD].asBinary(); LLSD response_data; - U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), content_binary.size()); + U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), static_cast<S32>(content_binary.size())); if (uzip_result != LLUZipHelper::ZR_OK) { LL_WARNS("Materials") << "Cannot unzip LLSD binary content: " << uzip_result << LL_ENDL; @@ -472,7 +472,7 @@ void LLMaterialMgr::onGetAllResponse(bool success, const LLSD& content, const LL const LLSD::Binary& content_binary = content[MATERIALS_CAP_ZIP_FIELD].asBinary(); LLSD response_data; - U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), content_binary.size()); + U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), static_cast<S32>(content_binary.size())); if (uzip_result != LLUZipHelper::ZR_OK) { LL_WARNS("Materials") << "Cannot unzip LLSD binary content: " << uzip_result << LL_ENDL; @@ -539,7 +539,7 @@ void LLMaterialMgr::onPutResponse(bool success, const LLSD& content) const LLSD::Binary& content_binary = content[MATERIALS_CAP_ZIP_FIELD].asBinary(); LLSD response_data; - U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), content_binary.size()); + U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), static_cast<S32>(content_binary.size())); if (uzip_result != LLUZipHelper::ZR_OK) { LL_WARNS("Materials") << "Cannot unzip LLSD binary content: " << uzip_result << LL_ENDL; @@ -670,7 +670,7 @@ void LLMaterialMgr::processGetQueue() std::string materialString = zip_llsd(materialsData); - S32 materialSize = materialString.size(); + auto materialSize = materialString.size(); if (materialSize <= 0) { LL_ERRS("Materials") << "cannot zip LLSD binary content" << LL_ENDL; @@ -960,7 +960,7 @@ void LLMaterialMgr::processPutQueue() std::string materialString = zip_llsd(materialsData); - S32 materialSize = materialString.size(); + auto materialSize = materialString.size(); if (materialSize > 0) { diff --git a/indra/newview/llmaterialmgr.h b/indra/newview/llmaterialmgr.h index 94cb1c0e15..1279b77ad4 100644 --- a/indra/newview/llmaterialmgr.h +++ b/indra/newview/llmaterialmgr.h @@ -102,7 +102,7 @@ private: const LLMaterialMgr::TEMaterialPair& lhs, const LLMaterialMgr::TEMaterialPair& rhs) { - return (lhs.te < rhs.te) ? TRUE : + return (lhs.te < rhs.te) ? true : (lhs.materialID < rhs.materialID); } diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 72783408b8..b39a976ebd 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -63,7 +63,7 @@ #include "llfloaterwebcontent.h" #include "llwindowshade.h" -extern BOOL gRestoreGL; +extern bool gRestoreGL; static LLDefaultChildRegistry::Register<LLMediaCtrl> r("web_browser"); @@ -166,7 +166,7 @@ LLMediaCtrl::~LLMediaCtrl() //////////////////////////////////////////////////////////////////////////////// // -void LLMediaCtrl::setBorderVisible( BOOL border_visible ) +void LLMediaCtrl::setBorderVisible( bool border_visible ) { if ( mBorder ) { @@ -183,9 +183,9 @@ void LLMediaCtrl::setTakeFocusOnClick( bool take_focus ) //////////////////////////////////////////////////////////////////////////////// // -BOOL LLMediaCtrl::handleHover( S32 x, S32 y, MASK mask ) +bool LLMediaCtrl::handleHover( S32 x, S32 y, MASK mask ) { - if (LLPanel::handleHover(x, y, mask)) return TRUE; + if (LLPanel::handleHover(x, y, mask)) return true; convertInputCoords(x, y); if (mMediaSource) @@ -201,40 +201,40 @@ BOOL LLMediaCtrl::handleHover( S32 x, S32 y, MASK mask ) handleToolTip(x, y, mask); } - return TRUE; + return true; } //////////////////////////////////////////////////////////////////////////////// // -BOOL LLMediaCtrl::handleScrollWheel( S32 x, S32 y, S32 clicks ) +bool LLMediaCtrl::handleScrollWheel( S32 x, S32 y, S32 clicks ) { - if (LLPanel::handleScrollWheel(x, y, clicks)) return TRUE; + if (LLPanel::handleScrollWheel(x, y, clicks)) return true; if (mMediaSource && mMediaSource->hasMedia()) { convertInputCoords(x, y); - mMediaSource->scrollWheel(x, y, 0, clicks, gKeyboard->currentMask(TRUE)); + mMediaSource->scrollWheel(x, y, 0, clicks, gKeyboard->currentMask(true)); } - return TRUE; + return true; } //////////////////////////////////////////////////////////////////////////////// // -BOOL LLMediaCtrl::handleScrollHWheel(S32 x, S32 y, S32 clicks) +bool LLMediaCtrl::handleScrollHWheel(S32 x, S32 y, S32 clicks) { - if (LLPanel::handleScrollHWheel(x, y, clicks)) return TRUE; + if (LLPanel::handleScrollHWheel(x, y, clicks)) return true; if (mMediaSource && mMediaSource->hasMedia()) { convertInputCoords(x, y); - mMediaSource->scrollWheel(x, y, clicks, 0, gKeyboard->currentMask(TRUE)); + mMediaSource->scrollWheel(x, y, clicks, 0, gKeyboard->currentMask(true)); } - return TRUE; + return true; } //////////////////////////////////////////////////////////////////////////////// // virtual -BOOL LLMediaCtrl::handleToolTip(S32 x, S32 y, MASK mask) +bool LLMediaCtrl::handleToolTip(S32 x, S32 y, MASK mask) { std::string hover_text; @@ -243,7 +243,7 @@ BOOL LLMediaCtrl::handleToolTip(S32 x, S32 y, MASK mask) if(hover_text.empty()) { - return FALSE; + return false; } else { @@ -258,14 +258,14 @@ BOOL LLMediaCtrl::handleToolTip(S32 x, S32 y, MASK mask) .sticky_rect(sticky_rect_screen)); } - return TRUE; + return true; } //////////////////////////////////////////////////////////////////////////////// // -BOOL LLMediaCtrl::handleMouseUp( S32 x, S32 y, MASK mask ) +bool LLMediaCtrl::handleMouseUp( S32 x, S32 y, MASK mask ) { - if (LLPanel::handleMouseUp(x, y, mask)) return TRUE; + if (LLPanel::handleMouseUp(x, y, mask)) return true; convertInputCoords(x, y); if (mMediaSource) @@ -275,14 +275,14 @@ BOOL LLMediaCtrl::handleMouseUp( S32 x, S32 y, MASK mask ) gFocusMgr.setMouseCapture( NULL ); - return TRUE; + return true; } //////////////////////////////////////////////////////////////////////////////// // -BOOL LLMediaCtrl::handleMouseDown( S32 x, S32 y, MASK mask ) +bool LLMediaCtrl::handleMouseDown( S32 x, S32 y, MASK mask ) { - if (LLPanel::handleMouseDown(x, y, mask)) return TRUE; + if (LLPanel::handleMouseDown(x, y, mask)) return true; convertInputCoords(x, y); if (mMediaSource) @@ -292,17 +292,17 @@ BOOL LLMediaCtrl::handleMouseDown( S32 x, S32 y, MASK mask ) if (mTakeFocusOnClick) { - setFocus( TRUE ); + setFocus( true ); } - return TRUE; + return true; } //////////////////////////////////////////////////////////////////////////////// // -BOOL LLMediaCtrl::handleRightMouseUp( S32 x, S32 y, MASK mask ) +bool LLMediaCtrl::handleRightMouseUp( S32 x, S32 y, MASK mask ) { - if (LLPanel::handleRightMouseUp(x, y, mask)) return TRUE; + if (LLPanel::handleRightMouseUp(x, y, mask)) return true; convertInputCoords(x, y); if (mMediaSource) @@ -320,14 +320,14 @@ BOOL LLMediaCtrl::handleRightMouseUp( S32 x, S32 y, MASK mask ) gFocusMgr.setMouseCapture( NULL ); - return TRUE; + return true; } //////////////////////////////////////////////////////////////////////////////// // -BOOL LLMediaCtrl::handleRightMouseDown( S32 x, S32 y, MASK mask ) +bool LLMediaCtrl::handleRightMouseDown( S32 x, S32 y, MASK mask ) { - if (LLPanel::handleRightMouseDown(x, y, mask)) return TRUE; + if (LLPanel::handleRightMouseDown(x, y, mask)) return true; S32 media_x = x, media_y = y; convertInputCoords(media_x, media_y); @@ -339,7 +339,7 @@ BOOL LLMediaCtrl::handleRightMouseDown( S32 x, S32 y, MASK mask ) if (mTakeFocusOnClick) { - setFocus( TRUE ); + setFocus( true ); } auto menu = mContextMenuHandle.get(); @@ -371,14 +371,14 @@ BOOL LLMediaCtrl::handleRightMouseDown( S32 x, S32 y, MASK mask ) LLMenuGL::showPopup(this, menu, x, y); } - return TRUE; + return true; } //////////////////////////////////////////////////////////////////////////////// // -BOOL LLMediaCtrl::handleDoubleClick( S32 x, S32 y, MASK mask ) +bool LLMediaCtrl::handleDoubleClick( S32 x, S32 y, MASK mask ) { - if (LLPanel::handleDoubleClick(x, y, mask)) return TRUE; + if (LLPanel::handleDoubleClick(x, y, mask)) return true; convertInputCoords(x, y); if (mMediaSource) @@ -388,10 +388,10 @@ BOOL LLMediaCtrl::handleDoubleClick( S32 x, S32 y, MASK mask ) if (mTakeFocusOnClick) { - setFocus( TRUE ); + setFocus( true ); } - return TRUE; + return true; } //////////////////////////////////////////////////////////////////////////////// @@ -431,11 +431,11 @@ void LLMediaCtrl::onFocusLost() //////////////////////////////////////////////////////////////////////////////// // -BOOL LLMediaCtrl::postBuild () +bool LLMediaCtrl::postBuild () { setVisibleCallback(boost::bind(&LLMediaCtrl::onVisibilityChanged, this, _2)); - return TRUE; + return true; } void LLMediaCtrl::onOpenWebInspector() @@ -446,9 +446,9 @@ void LLMediaCtrl::onOpenWebInspector() //////////////////////////////////////////////////////////////////////////////// // -BOOL LLMediaCtrl::handleKeyHere( KEY key, MASK mask ) +bool LLMediaCtrl::handleKeyHere( KEY key, MASK mask ) { - BOOL result = FALSE; + bool result = false; if (mMediaSource) { @@ -463,9 +463,9 @@ BOOL LLMediaCtrl::handleKeyHere( KEY key, MASK mask ) //////////////////////////////////////////////////////////////////////////////// // -BOOL LLMediaCtrl::handleKeyUpHere(KEY key, MASK mask) +bool LLMediaCtrl::handleKeyUpHere(KEY key, MASK mask) { - BOOL result = FALSE; + bool result = false; if (mMediaSource) { @@ -480,7 +480,7 @@ BOOL LLMediaCtrl::handleKeyUpHere(KEY key, MASK mask) //////////////////////////////////////////////////////////////////////////////// // -void LLMediaCtrl::onVisibilityChange ( BOOL new_visibility ) +void LLMediaCtrl::onVisibilityChange ( bool new_visibility ) { LL_INFOS() << "visibility changed to " << (new_visibility?"true":"false") << LL_ENDL; if(mMediaSource) @@ -491,9 +491,9 @@ void LLMediaCtrl::onVisibilityChange ( BOOL new_visibility ) //////////////////////////////////////////////////////////////////////////////// // -BOOL LLMediaCtrl::handleUnicodeCharHere(llwchar uni_char) +bool LLMediaCtrl::handleUnicodeCharHere(llwchar uni_char) { - BOOL result = FALSE; + bool result = false; if (mMediaSource) { @@ -523,7 +523,7 @@ void LLMediaCtrl::onVisibilityChanged ( const LLSD& new_visibility ) //////////////////////////////////////////////////////////////////////////////// // -void LLMediaCtrl::reshape( S32 width, S32 height, BOOL called_from_parent ) +void LLMediaCtrl::reshape( S32 width, S32 height, bool called_from_parent ) { if(!getDecoupleTextureSize()) { @@ -782,7 +782,7 @@ void LLMediaCtrl::draw() if ( gRestoreGL == 1 || mUpdateScrolls) { LLRect r = getRect(); - reshape( r.getWidth(), r.getHeight(), FALSE ); + reshape( r.getWidth(), r.getHeight(), false ); mUpdateScrolls = false; return; } @@ -990,7 +990,7 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) { LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_SIZE_CHANGED " << LL_ENDL; LLRect r = getRect(); - reshape( r.getWidth(), r.getHeight(), FALSE ); + reshape( r.getWidth(), r.getHeight(), false ); }; break; diff --git a/indra/newview/llmediactrl.h b/indra/newview/llmediactrl.h index 899eab1fea..9f9564af46 100644 --- a/indra/newview/llmediactrl.h +++ b/indra/newview/llmediactrl.h @@ -77,7 +77,7 @@ protected: public: virtual ~LLMediaCtrl(); - void setBorderVisible( BOOL border_visible ); + void setBorderVisible( bool border_visible ); // For the tutorial window, we don't want to take focus on clicks, // as the examples include how to move around with the arrow @@ -86,15 +86,15 @@ public: void setTakeFocusOnClick( bool take_focus ); // handle mouse related methods - virtual BOOL handleHover( S32 x, S32 y, MASK mask ); - virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask ); - virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ); - virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask ); - virtual BOOL handleScrollWheel( S32 x, S32 y, S32 clicks ); - virtual BOOL handleScrollHWheel( S32 x, S32 y, S32 clicks ); - virtual BOOL handleToolTip(S32 x, S32 y, MASK mask); + virtual bool handleHover( S32 x, S32 y, MASK mask ); + virtual bool handleMouseUp( S32 x, S32 y, MASK mask ); + virtual bool handleMouseDown( S32 x, S32 y, MASK mask ); + virtual bool handleRightMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleRightMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleDoubleClick( S32 x, S32 y, MASK mask ); + virtual bool handleScrollWheel( S32 x, S32 y, S32 clicks ); + virtual bool handleScrollHWheel( S32 x, S32 y, S32 clicks ); + virtual bool handleToolTip(S32 x, S32 y, MASK mask); // navigation void navigateTo( std::string url_in, std::string mime_type = "", bool clean_browser = false); @@ -154,13 +154,13 @@ public: void setAllowFileDownload(bool allow) { mAllowFileDownload = allow; } // over-rides - virtual BOOL handleKeyHere( KEY key, MASK mask); - virtual BOOL handleKeyUpHere(KEY key, MASK mask); - virtual void onVisibilityChange ( BOOL new_visibility ); - virtual BOOL handleUnicodeCharHere(llwchar uni_char); - virtual void reshape( S32 width, S32 height, BOOL called_from_parent = TRUE); + virtual bool handleKeyHere( KEY key, MASK mask); + virtual bool handleKeyUpHere(KEY key, MASK mask); + virtual void onVisibilityChange ( bool new_visibility ); + virtual bool handleUnicodeCharHere(llwchar uni_char); + virtual void reshape( S32 width, S32 height, bool called_from_parent = true); virtual void draw(); - virtual BOOL postBuild(); + virtual bool postBuild(); // focus overrides void onFocusLost(); @@ -178,7 +178,7 @@ public: virtual bool wantsKeyUpKeyDown() const; virtual bool wantsReturnKey() const; - virtual BOOL acceptsTextInput() const {return TRUE;} + virtual bool acceptsTextInput() const { return true; } protected: void convertInputCoords(S32& x, S32& y); diff --git a/indra/newview/llmediadataclient.cpp b/indra/newview/llmediadataclient.cpp index 52898d1b86..0f3e0306af 100644 --- a/indra/newview/llmediadataclient.cpp +++ b/indra/newview/llmediadataclient.cpp @@ -418,9 +418,9 @@ LLMediaDataClient::QueueTimer::QueueTimer(F32 time, LLMediaDataClient *mdc) } // virtual -BOOL LLMediaDataClient::QueueTimer::tick() +bool LLMediaDataClient::QueueTimer::tick() { - BOOL result = TRUE; + bool result = true; if (!mMDC.isNull()) { @@ -451,7 +451,7 @@ LLMediaDataClient::RetryTimer::RetryTimer(F32 time, Request::ptr_t request) } // virtual -BOOL LLMediaDataClient::RetryTimer::tick() +bool LLMediaDataClient::RetryTimer::tick() { mRequest->stopTracking(); @@ -469,7 +469,7 @@ BOOL LLMediaDataClient::RetryTimer::tick() mRequest.reset(); // Don't fire again - return TRUE; + return true; } @@ -692,7 +692,7 @@ void LLObjectMediaDataClient::sortQueue() mQueue.sort(compareRequestScores); // ...then cull items over the max - U32 size = mQueue.size(); + U32 size = static_cast<U32>(mQueue.size()); if (size > mMaxSortedQueueSize) { U32 num_to_cull = (size - mMaxSortedQueueSize); diff --git a/indra/newview/llmediadataclient.h b/indra/newview/llmediadataclient.h index ae5e5cd5d4..ca035e79e0 100644 --- a/indra/newview/llmediadataclient.h +++ b/indra/newview/llmediadataclient.h @@ -219,7 +219,7 @@ protected: { public: RetryTimer(F32 time, Request::ptr_t); - virtual BOOL tick(); + virtual bool tick(); private: // back-pointer Request::ptr_t mRequest; @@ -286,7 +286,7 @@ private: { public: QueueTimer(F32 time, LLMediaDataClient *mdc); - virtual BOOL tick(); + virtual bool tick(); private: // back-pointer LLPointer<LLMediaDataClient> mMDC; diff --git a/indra/newview/llmenuoptionpathfindingrebakenavmesh.cpp b/indra/newview/llmenuoptionpathfindingrebakenavmesh.cpp index 1555db6830..54c1b0610e 100644 --- a/indra/newview/llmenuoptionpathfindingrebakenavmesh.cpp +++ b/indra/newview/llmenuoptionpathfindingrebakenavmesh.cpp @@ -161,7 +161,7 @@ void LLMenuOptionPathfindingRebakeNavmesh::setMode(ERebakeNavMeshMode pRebakeNav mRebakeNavMeshMode = pRebakeNavMeshMode; } -void LLMenuOptionPathfindingRebakeNavmesh::handleAgentState(BOOL pCanRebakeRegion) +void LLMenuOptionPathfindingRebakeNavmesh::handleAgentState(bool pCanRebakeRegion) { llassert(mIsInitialized); mCanRebakeRegion = pCanRebakeRegion; @@ -221,7 +221,7 @@ void LLMenuOptionPathfindingRebakeNavmesh::handleRegionBoundaryCrossed() if (mIsInitialized) { createNavMeshStatusListenerForCurrentRegion(); - mCanRebakeRegion = FALSE; + mCanRebakeRegion = false; LLPathfindingManager::getInstance()->requestGetAgentState(); } } diff --git a/indra/newview/llmenuoptionpathfindingrebakenavmesh.h b/indra/newview/llmenuoptionpathfindingrebakenavmesh.h index 22eda5b8f8..5a153f762a 100644 --- a/indra/newview/llmenuoptionpathfindingrebakenavmesh.h +++ b/indra/newview/llmenuoptionpathfindingrebakenavmesh.h @@ -65,7 +65,7 @@ protected: private: void setMode(ERebakeNavMeshMode pRebakeNavMeshMode); - void handleAgentState(BOOL pCanRebakeRegion); + void handleAgentState(bool pCanRebakeRegion); void handleRebakeNavMeshResponse(bool pResponseStatus); void handleNavMeshStatus(const LLPathfindingNavMeshStatus &pNavMeshStatus); void handleRegionBoundaryCrossed(); diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index f6441f8404..01c922df16 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -448,7 +448,7 @@ U32 get_volume_memory_size(const LLVolume* volume) U32 indices = 0; U32 vertices = 0; - for (U32 i = 0; i < volume->getNumVolumeFaces(); ++i) + for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i) { const LLVolumeFace& face = volume->getVolumeFace(i); indices += face.mNumIndices; @@ -916,7 +916,7 @@ void LLMeshRepoThread::run() // Dispatch all HttpHandler notifications mHttpRequest->update(0L); } - sRequestWaterLevel = mHttpRequestSet.size(); // Stats data update + sRequestWaterLevel = static_cast<S32>(mHttpRequestSet.size()); // Stats data update // NOTE: order of queue processing intentionally favors LOD requests over header requests // Todo: we are processing mLODReqQ, mHeaderReqQ, mSkinRequests, mDecompositionRequests and mPhysicsShapeRequests @@ -1355,7 +1355,7 @@ bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id, bool can_retry) { //check cache for mesh skin info LLFileSystem file(mesh_id, LLAssetType::AT_MESH); - if (file.getSize() >= offset+size) + if (file.getSize() >= offset + size) { U8* buffer = new(std::nothrow) U8[size]; if (!buffer) @@ -1372,7 +1372,7 @@ bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id, bool can_retry) bool zero = true; for (S32 i = 0; i < llmin(size, 1024) && zero; ++i) { - zero = buffer[i] > 0 ? false : true; + zero = buffer[i] == 0; } if (!zero) @@ -1486,7 +1486,7 @@ bool LLMeshRepoThread::fetchMeshDecomposition(const LLUUID& mesh_id) bool zero = true; for (S32 i = 0; i < llmin(size, 1024) && zero; ++i) { - zero = buffer[i] > 0 ? false : true; + zero = buffer[i] == 0; } if (!zero) @@ -1584,7 +1584,7 @@ bool LLMeshRepoThread::fetchMeshPhysicsShape(const LLUUID& mesh_id) bool zero = true; for (S32 i = 0; i < llmin(size, 1024) && zero; ++i) { - zero = buffer[i] > 0 ? false : true; + zero = buffer[i] == 0; } if (!zero) @@ -1784,7 +1784,7 @@ bool LLMeshRepoThread::fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod, bool zero = true; for (S32 i = 0; i < llmin(size, 1024) && zero; ++i) { - zero = buffer[i] > 0 ? false : true; + zero = buffer[i] == 0; } if (!zero) @@ -2293,8 +2293,8 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) mUploadSkin, mUploadJoints, mLockScaleIfJointPosition, - FALSE, - FALSE, + false, + false, data.mBaseModel->mSubmodelID); data.mAssetData = ostr.str(); @@ -2360,17 +2360,19 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) std::stringstream texture_str; if (texture != NULL && include_textures && mUploadTextures) { - if(texture->hasSavedRawImage()) + if (texture->hasSavedRawImage()) { + LLImageDataLock lock(texture->getSavedRawImage()); + LLPointer<LLImageJ2C> upload_file = LLViewerTextureList::convertToUploadFile(texture->getSavedRawImage()); if (!upload_file.isNull() && upload_file->getDataSize()) { - texture_str.write((const char*) upload_file->getData(), upload_file->getDataSize()); + texture_str.write((const char*) upload_file->getData(), upload_file->getDataSize()); + } } } - } if (texture != NULL && mUploadTextures && @@ -2448,8 +2450,8 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) mUploadSkin, mUploadJoints, mLockScaleIfJointPosition, - FALSE, - FALSE, + false, + false, data.mBaseModel->mSubmodelID); data.mAssetData = ostr.str(); @@ -2514,17 +2516,19 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) std::stringstream texture_str; if (texture != NULL && include_textures && mUploadTextures) { - if(texture->hasSavedRawImage()) + if (texture->hasSavedRawImage()) { + LLImageDataLock lock(texture->getSavedRawImage()); + LLPointer<LLImageJ2C> upload_file = LLViewerTextureList::convertToUploadFile(texture->getSavedRawImage()); if (!upload_file.isNull() && upload_file->getDataSize()) { - texture_str.write((const char*) upload_file->getData(), upload_file->getDataSize()); + texture_str.write((const char*) upload_file->getData(), upload_file->getDataSize()); + } } } - } if (texture != NULL && mUploadTextures && @@ -3078,7 +3082,7 @@ void LLMeshHandlerBase::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRespo LLCore::BufferArray * body(response->getBody()); S32 body_offset(0); U8 * data(NULL); - S32 data_size(body ? body->size() : 0); + auto data_size(body ? body->size() : 0); if (data_size > 0) { @@ -3139,7 +3143,7 @@ void LLMeshHandlerBase::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRespo if (data) { body->read(body_offset, (char *) data, data_size - body_offset); - LLMeshRepository::sBytesReceived += data_size; + LLMeshRepository::sBytesReceived += static_cast<U32>(data_size); } else { @@ -3148,7 +3152,7 @@ void LLMeshHandlerBase::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRespo } } - processData(body, body_offset, data, data_size - body_offset); + processData(body, body_offset, data, static_cast<S32>(data_size) - body_offset); delete [] data; } @@ -3620,8 +3624,8 @@ S32 LLMeshRepository::update() return 0 ; } - S32 size = mUploadWaitList.size() ; - for (S32 i = 0; i < size; ++i) + auto size = mUploadWaitList.size() ; + for (size_t i = 0; i < size; ++i) { mUploads.push_back(mUploadWaitList[i]); mUploadWaitList[i]->preStart() ; @@ -3629,7 +3633,7 @@ S32 LLMeshRepository::update() } mUploadWaitList.clear() ; - return size ; + return static_cast<S32>(size); } void LLMeshRepository::unregisterMesh(LLVOVolume* vobj) @@ -4378,7 +4382,7 @@ void LLMeshUploadThread::decomposeMeshMatrix(LLMatrix4& transformation, LLVector3& result_scale) { // check for reflection - BOOL reflected = (transformation.determinant() < 0); + bool reflected = (transformation.determinant() < 0); // compute position LLVector3 position = LLVector3(0, 0, 0) * transformation; @@ -4860,7 +4864,7 @@ void LLPhysicsDecomp::setMeshData(LLCDMeshData& mesh, bool vertex_based) { mesh.mVertexBase = mCurRequest->mPositions[0].mV; mesh.mVertexStrideBytes = 12; - mesh.mNumVertices = mCurRequest->mPositions.size(); + mesh.mNumVertices = static_cast<int>(mCurRequest->mPositions.size()); if(!vertex_based) { @@ -4868,7 +4872,7 @@ void LLPhysicsDecomp::setMeshData(LLCDMeshData& mesh, bool vertex_based) mesh.mIndexBase = &(mCurRequest->mIndices[0]); mesh.mIndexStrideBytes = 6; - mesh.mNumTriangles = mCurRequest->mIndices.size()/3; + mesh.mNumTriangles = static_cast<int>(mCurRequest->mIndices.size())/3; } if ((vertex_based || mesh.mNumTriangles > 0) && mesh.mNumVertices > 2) @@ -5199,16 +5203,16 @@ void LLPhysicsDecomp::Request::assignData(LLModel* mdl) { if (!mdl) { - return ; + return; } U16 index_offset = 0; - U16 tri[3] ; + U16 tri[3]{}; mPositions.clear(); mIndices.clear(); - mBBox[1] = LLVector3(F32_MIN, F32_MIN, F32_MIN) ; - mBBox[0] = LLVector3(F32_MAX, F32_MAX, F32_MAX) ; + mBBox[1] = LLVector3(F32_MIN, F32_MIN, F32_MIN); + mBBox[0] = LLVector3(F32_MAX, F32_MAX, F32_MAX); //queue up vertex positions and indices for (S32 i = 0; i < mdl->getNumVolumeFaces(); ++i) @@ -5219,36 +5223,34 @@ void LLPhysicsDecomp::Request::assignData(LLModel* mdl) continue; } - for (U32 j = 0; j < face.mNumVertices; ++j) + for (S32 j = 0; j < face.mNumVertices; ++j) { mPositions.push_back(LLVector3(face.mPositions[j].getF32ptr())); - for(U32 k = 0 ; k < 3 ; k++) + for (U32 k = 0 ; k < 3 ; k++) { - mBBox[0].mV[k] = llmin(mBBox[0].mV[k], mPositions[j].mV[k]) ; - mBBox[1].mV[k] = llmax(mBBox[1].mV[k], mPositions[j].mV[k]) ; + mBBox[0].mV[k] = llmin(mBBox[0].mV[k], mPositions[j].mV[k]); + mBBox[1].mV[k] = llmax(mBBox[1].mV[k], mPositions[j].mV[k]); } } - updateTriangleAreaThreshold() ; + updateTriangleAreaThreshold(); - for (U32 j = 0; j+2 < face.mNumIndices; j += 3) + for (S32 j = 0; j+2 < face.mNumIndices; j += 3) { tri[0] = face.mIndices[j] + index_offset ; - tri[1] = face.mIndices[j + 1] + index_offset ; - tri[2] = face.mIndices[j + 2] + index_offset ; + tri[1] = face.mIndices[j + 1] + index_offset; + tri[2] = face.mIndices[j + 2] + index_offset; - if(isValidTriangle(tri[0], tri[1], tri[2])) + if (isValidTriangle(tri[0], tri[1], tri[2])) { - mIndices.push_back(tri[0]); - mIndices.push_back(tri[1]); - mIndices.push_back(tri[2]); + mIndices.emplace_back(tri[0]); + mIndices.emplace_back(tri[1]); + mIndices.emplace_back(tri[2]); } } index_offset += face.mNumVertices; } - - return ; } void LLPhysicsDecomp::Request::updateTriangleAreaThreshold() @@ -5279,10 +5281,10 @@ void LLMeshRepository::buildPhysicsMesh(LLModel::Decomposition& decomp) { decomp.mMesh.resize(decomp.mHull.size()); - for (U32 i = 0; i < decomp.mHull.size(); ++i) + for (size_t i = 0; i < decomp.mHull.size(); ++i) { LLCDHull hull; - hull.mNumVertices = decomp.mHull[i].size(); + hull.mNumVertices = static_cast<int>(decomp.mHull[i].size()); hull.mVertexBase = decomp.mHull[i][0].mV; hull.mVertexStrideBytes = 12; @@ -5301,7 +5303,7 @@ void LLMeshRepository::buildPhysicsMesh(LLModel::Decomposition& decomp) if (!decomp.mBaseHull.empty() && decomp.mBaseHullMesh.empty()) { //get mesh for base hull LLCDHull hull; - hull.mNumVertices = decomp.mBaseHull.size(); + hull.mNumVertices = static_cast<int>(decomp.mBaseHull.size()); hull.mVertexBase = decomp.mBaseHull[0].mV; hull.mVertexStrideBytes = 12; @@ -5493,7 +5495,7 @@ void on_new_single_inventory_upload_complete( // Show the preview panel for textures and sounds to let // user know that the image (or snapshot) arrived intact. - LLInventoryPanel* panel = LLInventoryPanel::getActiveInventoryPanel(FALSE); + LLInventoryPanel* panel = LLInventoryPanel::getActiveInventoryPanel(false); if (panel) { diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h index b31d726004..b850ade0bb 100644 --- a/indra/newview/llmeshrepository.h +++ b/indra/newview/llmeshrepository.h @@ -533,13 +533,13 @@ public: // Inherited from LLCore::HttpHandler virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response); - LLViewerFetchedTexture* FindViewerTexture(const LLImportMaterial& material); + static LLViewerFetchedTexture* FindViewerTexture(const LLImportMaterial& material); private: LLHandle<LLWholeModelFeeObserver> mFeeObserverHandle; LLHandle<LLWholeModelUploadObserver> mUploadObserverHandle; - bool mDoUpload; // if FALSE only model data will be requested, otherwise the model will be uploaded + bool mDoUpload; // if false only model data will be requested, otherwise the model will be uploaded LLSD mModelData; // llcorehttp library interface objects. diff --git a/indra/newview/llmimetypes.cpp b/indra/newview/llmimetypes.cpp index 33d7ec2fc0..ee10b38a9d 100644 --- a/indra/newview/llmimetypes.cpp +++ b/indra/newview/llmimetypes.cpp @@ -131,15 +131,15 @@ bool LLMIMETypes::parseMIMETypes(const std::string& xml_filename) } if (child->hasName("allow_resize")) { - BOOL allow_resize = FALSE; + bool allow_resize = false; child->getBoolValue( 1, &allow_resize ); - info.mAllowResize = (bool)allow_resize; + info.mAllowResize = allow_resize; } if (child->hasName("allow_looping")) { - BOOL allow_looping = FALSE; + bool allow_looping = false; child->getBoolValue( 1, &allow_looping ); - info.mAllowLooping = (bool)allow_looping; + info.mAllowLooping = allow_looping; } } sWidgetMap[set_name] = info; diff --git a/indra/newview/llmimetypes.h b/indra/newview/llmimetypes.h index c38ed18871..4c30eed98e 100644 --- a/indra/newview/llmimetypes.h +++ b/indra/newview/llmimetypes.h @@ -105,10 +105,10 @@ public: std::string mPlayTip; // custom tool tip to display for Play button - BOOL mAllowResize; + bool mAllowResize; // enable/disable media size edit fields - BOOL mAllowLooping; + bool mAllowLooping; // enable/disable media looping checkbox }; typedef std::map< std::string, LLMIMEInfo > mime_info_map_t; diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index 26f1206c85..9af9f7fd53 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -68,6 +68,8 @@ #include "lltabcontainer.h" #include "lltextbox.h" +#include <filesystem> + #include <boost/algorithm/string.hpp> bool LLModelPreview::sIgnoreLoadedCallback = false; @@ -93,7 +95,7 @@ const F32 SKIN_WEIGHT_CAMERA_DISTANCE = 16.f; LLViewerFetchedTexture* bindMaterialDiffuseTexture(const LLImportMaterial& material) { - LLViewerFetchedTexture *texture = LLViewerTextureManager::getFetchedTexture(material.getDiffuseMap(), FTT_DEFAULT, TRUE, LLGLTexture::BOOST_PREVIEW); + LLViewerFetchedTexture *texture = LLViewerTextureManager::getFetchedTexture(material.getDiffuseMap(), FTT_DEFAULT, true, LLGLTexture::BOOST_PREVIEW); if (texture) { @@ -151,7 +153,7 @@ void FindModel(LLModelLoader::scene& scene, const std::string& name_to_match, LL //----------------------------------------------------------------------------- LLModelPreview::LLModelPreview(S32 width, S32 height, LLFloater* fmp) - : LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE), LLMutex() + : LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, false), LLMutex() , mLodsQuery() , mLodsWithParsingError() , mPelvisZOffset(0.0f) @@ -165,7 +167,7 @@ LLModelPreview::LLModelPreview(S32 width, S32 height, LLFloater* fmp) , mHasDegenerate(false) , mImporterDebug(LLCachedControl<bool>(gSavedSettings, "ImporterDebug", false)) { - mNeedsUpdate = TRUE; + mNeedsUpdate = true; mCameraDistance = 0.f; mCameraYaw = 0.f; mCameraPitch = 0.f; @@ -293,7 +295,7 @@ void LLModelPreview::rebuildUploadData() F32 max_scale = 0.f; - BOOL legacyMatching = gSavedSettings.getBOOL("ImporterLegacyMatching"); + bool legacyMatching = gSavedSettings.getBOOL("ImporterLegacyMatching"); U32 load_state = 0; for (auto iter = mBaseScene.begin(); iter != mBaseScene.end(); ++iter) @@ -536,6 +538,32 @@ void LLModelPreview::rebuildUploadData() } instance.mTransform = mat; mUploadData.push_back(instance); + + // if uploading textures, make sure textures are present + if (mFMP->childGetValue("upload_textures").asBoolean()) // too early to cheack if still loading + { + for (auto& mat_pair : instance.mMaterial) + { + LLImportMaterial& material = mat_pair.second; + + if (material.mDiffuseMapFilename.size()) + { + LLViewerFetchedTexture* texture = LLMeshUploadThread::FindViewerTexture(material); + if (texture && texture->isMissingAsset()) + { + // in case user provided a missing file later + texture->setIsMissingAsset(false); + texture->setLoadedCallback(LLModelPreview::textureLoadedCallback, 0, true, false, this, NULL, false); + texture->forceToSaveRawImage(0, F32_MAX); + texture->updateFetch(); + if (mModelLoader) + { + mModelLoader->mNumOfFetchingTextures++; + } + } + } + } + } } } @@ -662,7 +690,7 @@ void LLModelPreview::saveUploadData(const std::string& filename, save_skinweights, save_joint_positions, lock_scale_if_joint_position, - FALSE, TRUE, instance.mModel->mSubmodelID); + false, true, instance.mModel->mSubmodelID); data["mesh"][instance.mModel->mLocalID] = str.str(); } @@ -1062,6 +1090,29 @@ void LLModelPreview::loadModelCallback(S32 loaded_lod) { //only replace given LoD mModel[loaded_lod] = mModelLoader->mModelList; mScene[loaded_lod] = mModelLoader->mScene; + + // Duplicate the model if it is an internal bounding box model + if (loaded_lod == LLModel::LOD_PHYSICS && + mBaseModel.size() > 1 && // This makes sense for multiple models only + mModelLoader->mModelList.size() == 1 && // Just on the off-chance + mModelLoader->mScene.size() == 1 && // Just on the off-chance + std::filesystem::path(mModelLoader->mFilename).filename() == "cube.dae") + { + // Create a copy of the just loaded model for each model in mBaseModel + const LLModel* origin = mModelLoader->mModelList.front(); + const LLModelInstance& mi = mModelLoader->mScene.begin()->second.front(); + for (U32 i = 1; i < mBaseModel.size(); ++i) + { + LLPointer<LLModel> copy(new LLModel(origin->getParams(), origin->getDetail())); + copy->mLabel = origin->mLabel; + copy->copyVolumeFaces(origin); + copy->mPosition = origin->mPosition; + copy->mMaterialList = origin->mMaterialList; + mModel[loaded_lod].push_back(copy); + mScene[loaded_lod][mi.mTransform].push_back(LLModelInstance(copy, copy->mLabel, mi.mTransform, mi.mMaterial)); + } + } + mVertexBuffer[loaded_lod].clear(); setPreviewLOD(loaded_lod); @@ -1088,18 +1139,18 @@ void LLModelPreview::loadModelCallback(S32 loaded_lod) mDefaultPhysicsShapeP = out_model; mWarnOfUnmatchedPhyicsMeshes = true; } - BOOL legacyMatching = gSavedSettings.getBOOL("ImporterLegacyMatching"); + bool legacyMatching = gSavedSettings.getBOOL("ImporterLegacyMatching"); if (!legacyMatching) { if (!mBaseModel.empty()) { - BOOL name_based = FALSE; - BOOL has_submodels = FALSE; + bool name_based = false; + bool has_submodels = false; for (U32 idx = 0; idx < mBaseModel.size(); ++idx) { if (mBaseModel[idx]->mSubmodelID) { // don't do index-based renaming when the base model has submodels - has_submodels = TRUE; + has_submodels = true; if (mImporterDebug) { std::ostringstream out; @@ -1120,12 +1171,12 @@ void LLModelPreview::loadModelCallback(S32 loaded_lod) FindModel(mBaseScene, loaded_name, found_model, transform); if (found_model) { // don't rename correctly named models (even if they are placed in a wrong order) - name_based = TRUE; + name_based = true; } if (mModel[loaded_lod][idx]->mSubmodelID) { // don't rename the models when loaded LOD model has submodels - has_submodels = TRUE; + has_submodels = true; } } @@ -1159,6 +1210,17 @@ void LLModelPreview::loadModelCallback(S32 loaded_lod) LLFloaterModelPreview::addStringToLog(out, false); } mModel[loaded_lod][idx]->mLabel = name; + // Rename the correspondent instance as well + [&]() + { + for (auto& p : mScene[loaded_lod]) + for (auto& i : p.second) + if (i.mModel == mModel[loaded_lod][idx]) + { + i.mLabel = name; + return; + } + }(); } } } @@ -1323,7 +1385,7 @@ F32 LLModelPreview::genMeshOptimizerPerModel(LLModel *base_model, LLModel *targe S32 size_indices = 0; S32 size_vertices = 0; - for (U32 face_idx = 0; face_idx < base_model->getNumVolumeFaces(); ++face_idx) + for (S32 face_idx = 0; face_idx < base_model->getNumVolumeFaces(); ++face_idx) { const LLVolumeFace &face = base_model->getVolumeFace(face_idx); size_indices += face.mNumIndices; @@ -1349,7 +1411,7 @@ F32 LLModelPreview::genMeshOptimizerPerModel(LLModel *base_model, LLModel *targe S32 combined_positions_shift = 0; S32 indices_idx_shift = 0; S32 combined_indices_shift = 0; - for (U32 face_idx = 0; face_idx < base_model->getNumVolumeFaces(); ++face_idx) + for (S32 face_idx = 0; face_idx < base_model->getNumVolumeFaces(); ++face_idx) { const LLVolumeFace &face = base_model->getVolumeFace(face_idx); @@ -1474,7 +1536,7 @@ F32 LLModelPreview::genMeshOptimizerPerModel(LLModel *base_model, LLModel *targe S32 valid_faces = 0; // Crude method to copy indices back into face - for (U32 face_idx = 0; face_idx < base_model->getNumVolumeFaces(); ++face_idx) + for (S32 face_idx = 0; face_idx < base_model->getNumVolumeFaces(); ++face_idx) { const LLVolumeFace &face = base_model->getVolumeFace(face_idx); @@ -1492,7 +1554,7 @@ F32 LLModelPreview::genMeshOptimizerPerModel(LLModel *base_model, LLModel *targe // Copy relevant indices and vertices for (S32 i = 0; i < size_new_indices; ++i) { - U32 idx = output_indices[i]; + S32 idx = (S32)output_indices[i]; if ((i % 3) == 0) { @@ -1521,7 +1583,7 @@ F32 LLModelPreview::genMeshOptimizerPerModel(LLModel *base_model, LLModel *targe // U16 vertices overflow shouldn't happen, but just in case size_new_indices = 0; valid_faces = 0; - for (U32 face_idx = 0; face_idx < base_model->getNumVolumeFaces(); ++face_idx) + for (S32 face_idx = 0; face_idx < base_model->getNumVolumeFaces(); ++face_idx) { genMeshOptimizerPerFace(base_model, target_model, face_idx, indices_decimator, error_threshold, simplification_mode); const LLVolumeFace &face = target_model->getVolumeFace(face_idx); @@ -1867,7 +1929,7 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, S32 meshopt_mode, U32 d LLModel* target_model = mModel[lod][mdl_idx]; // carry over normalized transform into simplified model - for (int i = 0; i < base->getNumVolumeFaces(); ++i) + for (S32 i = 0; i < base->getNumVolumeFaces(); ++i) { LLVolumeFace& src = base->getVolumeFace(i); LLVolumeFace& dst = target_model->getVolumeFace(i); @@ -1881,7 +1943,7 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, S32 meshopt_mode, U32 d if (model_meshopt_mode == MESH_OPTIMIZER_PRECISE) { // Run meshoptimizer for each face - for (U32 face_idx = 0; face_idx < base->getNumVolumeFaces(); ++face_idx) + for (S32 face_idx = 0; face_idx < base->getNumVolumeFaces(); ++face_idx) { F32 res = genMeshOptimizerPerFace(base, target_model, face_idx, indices_decimator, lod_error_threshold, MESH_OPTIMIZER_FULL); if (res < 0) @@ -1897,7 +1959,7 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, S32 meshopt_mode, U32 d if (model_meshopt_mode == MESH_OPTIMIZER_SLOPPY) { // Run meshoptimizer for each face - for (U32 face_idx = 0; face_idx < base->getNumVolumeFaces(); ++face_idx) + for (S32 face_idx = 0; face_idx < base->getNumVolumeFaces(); ++face_idx) { if (genMeshOptimizerPerFace(base, target_model, face_idx, indices_decimator, lod_error_threshold, MESH_OPTIMIZER_NO_TOPOLOGY) < 0) { @@ -2244,7 +2306,7 @@ void LLModelPreview::updateStatusMessages() mModelNoErrors = true; const U32 lod_high = LLModel::LOD_HIGH; - U32 high_submodel_count = mModel[lod_high].size() - countRootModels(mModel[lod_high]); + U32 high_submodel_count = static_cast<U32>(mModel[lod_high].size()) - countRootModels(mModel[lod_high]); for (S32 lod = 0; lod <= lod_high; ++lod) { @@ -2341,7 +2403,7 @@ void LLModelPreview::updateStatusMessages() //warn if hulls have more than 256 points in them - BOOL physExceededVertexLimit = FALSE; + bool physExceededVertexLimit = false; for (U32 i = 0; mModelNoErrors && i < mModel[LLModel::LOD_PHYSICS].size(); ++i) { LLModel* mdl = mModel[LLModel::LOD_PHYSICS][i]; @@ -2352,7 +2414,7 @@ void LLModelPreview::updateStatusMessages() { if (mdl->mPhysics.mHull[j].size() > 256) { - physExceededVertexLimit = TRUE; + physExceededVertexLimit = true; LL_INFOS() << "Physical model " << mdl->mLabel << " exceeds vertex per hull limitations." << LL_ENDL; break; } @@ -2447,10 +2509,10 @@ void LLModelPreview::updateStatusMessages() if (!decomp.empty()) { - phys_hulls += decomp.size(); + phys_hulls += static_cast<S32>(decomp.size()); for (U32 i = 0; i < decomp.size(); ++i) { - phys_points += decomp[i].size(); + phys_points += static_cast<S32>(decomp[i].size()); } } else @@ -3075,8 +3137,8 @@ U32 LLModelPreview::loadTextures(LLImportMaterial& material, void* opaque) material.mOpaqueData = new LLPointer< LLViewerFetchedTexture >; LLPointer< LLViewerFetchedTexture >& tex = (*reinterpret_cast< LLPointer< LLViewerFetchedTexture > * >(material.mOpaqueData)); - tex = LLViewerTextureManager::getFetchedTextureFromUrl("file://" + LLURI::unescape(material.mDiffuseMapFilename), FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_PREVIEW); - tex->setLoadedCallback(LLModelPreview::textureLoadedCallback, 0, TRUE, FALSE, opaque, NULL, FALSE); + tex = LLViewerTextureManager::getFetchedTextureFromUrl("file://" + LLURI::unescape(material.mDiffuseMapFilename), FTT_LOCAL_FILE, true, LLGLTexture::BOOST_PREVIEW); + tex->setLoadedCallback(LLModelPreview::textureLoadedCallback, 0, true, false, opaque, NULL, false); tex->forceToSaveRawImage(0, F32_MAX); material.setDiffuseMap(tex->getID()); // record tex ID return 1; @@ -3128,12 +3190,12 @@ void LLModelPreview::addEmptyFace(LLModel* pTarget) //----------------------------------------------------------------------------- // Todo: we shouldn't be setting all those UI elements on render. // Note: Render happens each frame with skinned avatars -BOOL LLModelPreview::render() +bool LLModelPreview::render() { assert_main_thread(); LLMutexLock lock(this); - mNeedsUpdate = FALSE; + mNeedsUpdate = false; bool show_edges = mViewOption["show_edges"]; bool show_joint_overrides = mViewOption["show_joint_overrides"]; @@ -3344,7 +3406,7 @@ BOOL LLModelPreview::render() z_near = llclamp(z_far * 0.001f, 0.001f, 0.1f); - LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, width, height, FALSE, z_near, z_far); + LLViewerCamera::getInstance()->setPerspective(false, mOrigin.mX, mOrigin.mY, width, height, false, z_near, z_far); stop_glerror(); @@ -3373,7 +3435,7 @@ BOOL LLModelPreview::render() else { LL_INFOS() << "Vertex Buffer[" << mPreviewLOD << "]" << " is EMPTY!!!" << LL_ENDL; - regen = TRUE; + regen = true; } } @@ -3406,12 +3468,12 @@ BOOL LLModelPreview::render() gGL.multMatrix((GLfloat*)mat.mMatrix); - U32 num_models = mVertexBuffer[mPreviewLOD][model].size(); - for (U32 i = 0; i < num_models; ++i) + auto num_models = mVertexBuffer[mPreviewLOD][model].size(); + for (size_t i = 0; i < num_models; ++i) { if (show_textures) { - int materialCnt = instance.mModel->mMaterialList.size(); + auto materialCnt = instance.mModel->mMaterialList.size(); if (i < materialCnt) { const std::string& binding = instance.mModel->mMaterialList[i]; @@ -3559,10 +3621,9 @@ BOOL LLModelPreview::render() if (render_mesh) { - U32 num_models = mVertexBuffer[LLModel::LOD_PHYSICS][model].size(); - if (pass > 0) - { - for (U32 i = 0; i < num_models; ++i) + auto num_models = mVertexBuffer[LLModel::LOD_PHYSICS][model].size(); + if (pass > 0){ + for (size_t i = 0; i < num_models; ++i) { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.diffuseColor4fv(PREVIEW_PSYH_FILL_COL.mV); @@ -3633,8 +3694,8 @@ BOOL LLModelPreview::render() if (physics.mHull.empty()) { - U32 num_models = mVertexBuffer[LLModel::LOD_PHYSICS][model].size(); - for (U32 v = 0; v < num_models; ++v) + auto num_models = mVertexBuffer[LLModel::LOD_PHYSICS][model].size(); + for (size_t v = 0; v < num_models; ++v) { // Zero this variable for an obligatory buffer initialization // See https://github.com/secondlife/viewer/issues/912 @@ -3704,7 +3765,7 @@ BOOL LLModelPreview::render() const LLMeshSkinInfo *skin = &model->mSkinInfo; LLSkinningUtil::initJointNums(&model->mSkinInfo, getPreviewAvatar());// inits skin->mJointNums if nessesary U32 joint_count = LLSkinningUtil::getMeshJointCount(skin); - U32 bind_count = skin->mAlternateBindMatrix.size(); + auto bind_count = skin->mAlternateBindMatrix.size(); if (show_joint_overrides && bind_count > 0 @@ -3749,8 +3810,7 @@ BOOL LLModelPreview::render() } } - std::size_t size = mVertexBuffer[mPreviewLOD][model].size(); - for (U32 i = 0; i < size; ++i) + for (U32 i = 0, e = static_cast<U32>(mVertexBuffer[mPreviewLOD][model].size()); i < e; ++i) { model->mSkinInfo.updateHash(); LLRenderPass::uploadMatrixPalette(mPreviewAvatar, &model->mSkinInfo); @@ -3759,7 +3819,7 @@ BOOL LLModelPreview::render() if (show_textures) { - int materialCnt = instance.mModel->mMaterialList.size(); + auto materialCnt = instance.mModel->mMaterialList.size(); if (i < materialCnt) { const std::string& binding = instance.mModel->mMaterialList[i]; @@ -3842,7 +3902,7 @@ BOOL LLModelPreview::render() gGL.popMatrix(); - return TRUE; + return true; } void LLModelPreview::renderGroundPlane(float z_offset) @@ -3872,7 +3932,7 @@ void LLModelPreview::renderGroundPlane(float z_offset) //----------------------------------------------------------------------------- void LLModelPreview::refresh() { - mNeedsUpdate = TRUE; + mNeedsUpdate = true; } //----------------------------------------------------------------------------- @@ -3941,12 +4001,12 @@ void LLModelPreview::setPreviewLOD(S32 lod) //static void LLModelPreview::textureLoadedCallback( - BOOL success, + bool success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, - BOOL final, + bool final, void* userdata) { LLModelPreview* preview = (LLModelPreview*)userdata; diff --git a/indra/newview/llmodelpreview.h b/indra/newview/llmodelpreview.h index 4fc72788a9..c615070105 100644 --- a/indra/newview/llmodelpreview.h +++ b/indra/newview/llmodelpreview.h @@ -147,7 +147,7 @@ public: void setTexture(U32 name) { mTextureName = name; } void setPhysicsFromLOD(S32 lod); - BOOL render(); + bool render(); void update(); void genBuffers(S32 lod, bool skinned); void clearBuffers(); @@ -155,7 +155,7 @@ public: void rotate(F32 yaw_radians, F32 pitch_radians); void zoom(F32 zoom_amt); void pan(F32 right, F32 up); - virtual BOOL needsRender() { return mNeedsUpdate; } + virtual bool needsRender() { return mNeedsUpdate; } void setPreviewLOD(S32 lod); void clearModel(S32 lod); void getJointAliases(JointMap& joint_map); @@ -190,7 +190,7 @@ public: U32 getLegacyRigFlags() const { return mLegacyRigFlags; } void setLegacyRigFlags(U32 rigFlags) { mLegacyRigFlags = rigFlags; } - static void textureLoadedCallback(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, BOOL final, void* userdata); + static void textureLoadedCallback(bool success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, bool final, void* userdata); static bool lodQueryCallback(); boost::signals2::connection setDetailsCallback(const details_signal_t::slot_type& cb){ return mDetailsSignal.connect(cb); } @@ -266,7 +266,7 @@ protected: LLFloater* mFMP; - BOOL mNeedsUpdate; + bool mNeedsUpdate; bool mDirty; bool mGenLOD; U32 mTextureName; diff --git a/indra/newview/llmorphview.cpp b/indra/newview/llmorphview.cpp index 95c55f8a0c..a5fc813f2f 100644 --- a/indra/newview/llmorphview.cpp +++ b/indra/newview/llmorphview.cpp @@ -47,7 +47,7 @@ LLMorphView *gMorphView = NULL; -const F32 MORPH_NEAR_CLIP = 0.1f; +constexpr F32 MORPH_NEAR_CLIP = 0.1f; //----------------------------------------------------------------------------- // LLMorphView() @@ -60,7 +60,7 @@ LLMorphView::LLMorphView(const LLMorphView::Params& p) mOldCameraNearClip( 0.f ), mCameraPitch( 0.f ), mCameraYaw( 0.f ), - mCameraDrivenByKeys( FALSE ) + mCameraDrivenByKeys( false ) {} //----------------------------------------------------------------------------- @@ -103,7 +103,7 @@ void LLMorphView::shutdown() //----------------------------------------------------------------------------- // setVisible() //----------------------------------------------------------------------------- -void LLMorphView::setVisible(BOOL visible) +void LLMorphView::setVisible(bool visible) { if( visible != getVisible() ) { @@ -152,7 +152,7 @@ void LLMorphView::updateCamera() gAgentCamera.setCameraPosAndFocusGlobal( camera_pos, target_pos, gAgent.getID() ); } -void LLMorphView::setCameraDrivenByKeys(BOOL b) +void LLMorphView::setCameraDrivenByKeys(bool b) { if( mCameraDrivenByKeys != b ) { diff --git a/indra/newview/llmorphview.h b/indra/newview/llmorphview.h index f3af581a85..87f8c25f65 100644 --- a/indra/newview/llmorphview.h +++ b/indra/newview/llmorphview.h @@ -49,7 +49,7 @@ public: void shutdown(); // inherited methods - /*virtual*/ void setVisible(BOOL visible); + void setVisible(bool visible) override; void setCameraTargetJoint(LLJoint *joint) {mCameraTargetJoint = joint;} LLJoint* getCameraTargetJoint() {return mCameraTargetJoint;} @@ -58,7 +58,7 @@ public: void setCameraTargetOffset(const LLVector3d& camera_target_offset) {mCameraTargetOffset = camera_target_offset;} void updateCamera(); - void setCameraDrivenByKeys( BOOL b ); + void setCameraDrivenByKeys( bool b ); protected: void initialize(); @@ -75,7 +75,7 @@ protected: F32 mCameraPitch; F32 mCameraYaw; - BOOL mCameraDrivenByKeys; + bool mCameraDrivenByKeys; }; // diff --git a/indra/newview/llmoveview.cpp b/indra/newview/llmoveview.cpp index 640c7ef766..a8ceaffde8 100644 --- a/indra/newview/llmoveview.cpp +++ b/indra/newview/llmoveview.cpp @@ -80,7 +80,7 @@ LLFloaterMove::LLFloaterMove(const LLSD& key) LLFloaterMove::~LLFloaterMove() { // Ensure LLPanelStandStopFlying panel is not among floater's children. See EXT-8458. - setVisible(FALSE); + setVisible(false); // Otherwise it can be destroyed and static pointer in LLPanelStandStopFlying::getInstance() will become invalid. // Such situation was possible when LLFloaterReg returns "dead" instance of floater. @@ -88,7 +88,7 @@ LLFloaterMove::~LLFloaterMove() } // virtual -BOOL LLFloaterMove::postBuild() +bool LLFloaterMove::postBuild() { updateTransparency(TT_ACTIVE); // force using active floater transparency (STORM-730) @@ -142,12 +142,12 @@ BOOL LLFloaterMove::postBuild() gAgent.addParcelChangedCallback(LLFloaterMove::sUpdateFlyingStatus); - return TRUE; + return true; } // *NOTE: we assume that setVisible() is called on floater close. // virtual -void LLFloaterMove::setVisible(BOOL visible) +void LLFloaterMove::setVisible(bool visible) { // Do nothing with Stand/Stop Flying panel in excessive calls of this method. if (getVisible() == visible) @@ -190,7 +190,7 @@ F32 LLFloaterMove::getYawRate( F32 time ) // static -void LLFloaterMove::setFlyingMode(BOOL fly) +void LLFloaterMove::setFlyingMode(bool fly) { LLFloaterMove* instance = LLFloaterReg::findTypedInstance<LLFloaterMove>("moveview"); if (instance) @@ -222,7 +222,7 @@ void LLFloaterMove::setAlwaysRunMode(bool run) } } -void LLFloaterMove::setFlyingModeImpl(BOOL fly) +void LLFloaterMove::setFlyingModeImpl(bool fly) { updateButtonsWithMovementMode(fly ? MM_FLY : (gAgent.getAlwaysRun() ? MM_RUN : MM_WALK)); } @@ -236,7 +236,7 @@ void LLFloaterMove::setAlwaysRunModeImpl(bool run) } //static -void LLFloaterMove::setSittingMode(BOOL bSitting) +void LLFloaterMove::setSittingMode(bool bSitting) { if (bSitting) { @@ -310,7 +310,7 @@ void LLFloaterMove::setMovementMode(const EMovementMode mode) } else { - gAgent.setFlying(FALSE); + gAgent.setFlying(false); } // attempts to set avatar flying can not set it real flying in some cases. @@ -451,7 +451,7 @@ void LLFloaterMove::sUpdateFlyingStatus() } -void LLFloaterMove::showModeButtons(BOOL bShow) +void LLFloaterMove::showModeButtons(bool bShow) { if (mModeActionsPanel->getVisible() == bShow) return; @@ -466,7 +466,7 @@ void LLFloaterMove::enableInstance() { if (gAgent.getFlying()) { - instance->showModeButtons(FALSE); + instance->showModeButtons(false); } else { @@ -479,14 +479,14 @@ void LLFloaterMove::onOpen(const LLSD& key) { if (gAgent.getFlying()) { - setFlyingMode(TRUE); - showModeButtons(FALSE); + setFlyingMode(true); + showModeButtons(false); } if (isAgentAvatarValid() && gAgentAvatarp->isSitting()) { - setSittingMode(TRUE); - showModeButtons(FALSE); + setSittingMode(true); + showModeButtons(false); } sUpdateFlyingStatus(); @@ -499,10 +499,10 @@ void LLFloaterMove::setModeButtonToggleState(const EMovementMode mode) mode_control_button_map_t::const_iterator it = mModeControlButtonMap.begin(); for (; it != mModeControlButtonMap.end(); ++it) { - it->second->setToggleState(FALSE); + it->second->setToggleState(false); } - mModeControlButtonMap[mode]->setToggleState(TRUE); + mModeControlButtonMap[mode]->setToggleState(true); } @@ -542,7 +542,7 @@ void LLPanelStandStopFlying::setStandStopFlyingMode(EStandStopFlyingMode mode) panel->mStopFlyingButton->setVisible(SSFM_STOP_FLYING == mode); //visibility of it should be updated after updating visibility of the buttons - panel->setVisible(TRUE); + panel->setVisible(true); } //static @@ -551,10 +551,10 @@ void LLPanelStandStopFlying::clearStandStopFlyingMode(EStandStopFlyingMode mode) LLPanelStandStopFlying* panel = getInstance(); switch(mode) { case SSFM_STAND: - panel->mStandButton->setVisible(FALSE); + panel->mStandButton->setVisible(false); break; case SSFM_STOP_FLYING: - panel->mStopFlyingButton->setVisible(FALSE); + panel->mStopFlyingButton->setVisible(false); break; default: LL_ERRS() << "Unexpected EStandStopFlyingMode is passed: " << mode << LL_ENDL; @@ -562,26 +562,26 @@ void LLPanelStandStopFlying::clearStandStopFlyingMode(EStandStopFlyingMode mode) } -BOOL LLPanelStandStopFlying::postBuild() +bool LLPanelStandStopFlying::postBuild() { mStandButton = getChild<LLButton>("stand_btn"); mStandButton->setCommitCallback(boost::bind(&LLPanelStandStopFlying::onStandButtonClick, this)); mStandButton->setCommitCallback(boost::bind(&LLFloaterMove::enableInstance)); - mStandButton->setVisible(FALSE); + mStandButton->setVisible(false); LLHints::getInstance()->registerHintTarget("stand_btn", mStandButton->getHandle()); mStopFlyingButton = getChild<LLButton>("stop_fly_btn"); - //mStopFlyingButton->setCommitCallback(boost::bind(&LLFloaterMove::setFlyingMode, FALSE)); + //mStopFlyingButton->setCommitCallback(boost::bind(&LLFloaterMove::setFlyingMode, false)); mStopFlyingButton->setCommitCallback(boost::bind(&LLPanelStandStopFlying::onStopFlyingButtonClick, this)); - mStopFlyingButton->setVisible(FALSE); + mStopFlyingButton->setVisible(false); gViewerWindow->setOnWorldViewRectUpdated(boost::bind(&LLPanelStandStopFlying::updatePosition, this)); - return TRUE; + return true; } //virtual -void LLPanelStandStopFlying::setVisible(BOOL visible) +void LLPanelStandStopFlying::setVisible(bool visible) { //we dont need to show the panel if these buttons are not activated if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK) visible = false; @@ -603,7 +603,7 @@ void LLPanelStandStopFlying::setVisible(BOOL visible) LLPanel::setVisible(visible); } -BOOL LLPanelStandStopFlying::handleToolTip(S32 x, S32 y, MASK mask) +bool LLPanelStandStopFlying::handleToolTip(S32 x, S32 y, MASK mask) { LLToolTipMgr::instance().unblockToolTips(); @@ -671,7 +671,7 @@ LLPanelStandStopFlying* LLPanelStandStopFlying::getStandStopFlyingPanel() LLPanelStandStopFlying* panel = new LLPanelStandStopFlying(); panel->buildFromFile("panel_stand_stop_flying.xml"); - panel->setVisible(FALSE); + panel->setVisible(false); //LLUI::getInstance()->getRootView()->addChild(panel); LL_INFOS() << "Build LLPanelStandStopFlying panel" << LL_ENDL; @@ -687,14 +687,14 @@ void LLPanelStandStopFlying::onStandButtonClick() LLSelectMgr::getInstance()->deselectAllForStandingUp(); gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); - setFocus(FALSE); + setFocus(false); } void LLPanelStandStopFlying::onStopFlyingButtonClick() { - gAgent.setFlying(FALSE); + gAgent.setFlying(false); - setFocus(FALSE); // EXT-482 + setFocus(false); // EXT-482 } /** diff --git a/indra/newview/llmoveview.h b/indra/newview/llmoveview.h index 642e6a41be..3690245e1d 100644 --- a/indra/newview/llmoveview.h +++ b/indra/newview/llmoveview.h @@ -48,14 +48,14 @@ private: ~LLFloaterMove(); public: - /*virtual*/ BOOL postBuild(); - /*virtual*/ void setVisible(BOOL visible); + /*virtual*/ bool postBuild(); + /*virtual*/ void setVisible(bool visible); static F32 getYawRate(F32 time); - static void setFlyingMode(BOOL fly); - void setFlyingModeImpl(BOOL fly); + static void setFlyingMode(bool fly); + void setFlyingModeImpl(bool fly); static void setAlwaysRunMode(bool run); void setAlwaysRunModeImpl(bool run); - static void setSittingMode(BOOL bSitting); + static void setSittingMode(bool bSitting); static void enableInstance(); /*virtual*/ void onOpen(const LLSD& key); @@ -86,7 +86,7 @@ private: void initModeButtonMap(); void setModeButtonToggleState(const EMovementMode mode); void updateButtonsWithMovementMode(const EMovementMode newMode); - void showModeButtons(BOOL bShow); + void showModeButtons(bool bShow); public: @@ -141,13 +141,13 @@ public: static LLPanelStandStopFlying* getInstance(); static void setStandStopFlyingMode(EStandStopFlyingMode mode); static void clearStandStopFlyingMode(EStandStopFlyingMode mode); - /*virtual*/ BOOL postBuild(); - /*virtual*/ void setVisible(BOOL visible); + /*virtual*/ bool postBuild(); + /*virtual*/ void setVisible(bool visible); // *HACK: due to hard enough to have this control aligned with "Move" button while resizing // let update its position in each frame /*virtual*/ void draw(){updatePosition(); LLPanel::draw();} - /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleToolTip(S32 x, S32 y, MASK mask); protected: diff --git a/indra/newview/llmutelist.cpp b/indra/newview/llmutelist.cpp index 6c0ba06032..2d51acc063 100644 --- a/indra/newview/llmutelist.cpp +++ b/indra/newview/llmutelist.cpp @@ -154,7 +154,7 @@ std::string LLMute::getDisplayType() const // LLMuteList() //----------------------------------------------------------------------------- LLMuteList::LLMuteList() : - mIsLoaded(FALSE) + mIsLoaded(false) { gGenericDispatcher.addHandler("emptymutelist", &sDispatchEmptyMuteList); @@ -227,7 +227,7 @@ static LLVOAvatar* find_avatar(const LLUUID& id) } } -BOOL LLMuteList::add(const LLMute& mute, U32 flags) +bool LLMuteList::add(const LLMute& mute, U32 flags) { // Can't mute text from Lindens if ((mute.mType == LLMute::AGENT) @@ -235,7 +235,7 @@ BOOL LLMuteList::add(const LLMute& mute, U32 flags) { LL_WARNS() << "Trying to mute a Linden; ignored" << LL_ENDL; LLNotifications::instance().add("MuteLinden", LLSD(), LLSD()); - return FALSE; + return false; } // Can't mute self. @@ -243,7 +243,7 @@ BOOL LLMuteList::add(const LLMute& mute, U32 flags) && mute.mID == gAgent.getID()) { LL_WARNS() << "Trying to self; ignored" << LL_ENDL; - return FALSE; + return false; } static LLCachedControl<S32> mute_list_limit(gSavedSettings, "MuteListLimit", 1000); @@ -253,7 +253,7 @@ BOOL LLMuteList::add(const LLMute& mute, U32 flags) LLSD args; args["MUTE_LIMIT"] = mute_list_limit; LLNotifications::instance().add(LLNotification::Params("MuteLimitReached").substitutions(args)); - return FALSE; + return false; } if (mute.mType == LLMute::BY_NAME) @@ -262,14 +262,14 @@ BOOL LLMuteList::add(const LLMute& mute, U32 flags) if (mute.mName.empty()) { LL_WARNS() << "Trying to mute empty string by-name" << LL_ENDL; - return FALSE; + return false; } // Null mutes must have uuid null if (mute.mID.notNull()) { LL_WARNS() << "Trying to add by-name mute with non-null id" << LL_ENDL; - return FALSE; + return false; } std::pair<string_set_t::iterator, bool> result = mLegacyMutes.insert(mute.mName); @@ -279,13 +279,13 @@ BOOL LLMuteList::add(const LLMute& mute, U32 flags) updateAdd(mute); notifyObservers(); notifyObserversDetailed(mute); - return TRUE; + return true; } else { LL_INFOS() << "duplicate mute ignored" << LL_ENDL; // was duplicate - return FALSE; + return false; } } else @@ -341,13 +341,13 @@ BOOL LLMuteList::add(const LLMute& mute, U32 flags) { LLNotifications::instance().cancelByOwner(localmute.mID); } - return TRUE; + return true; } } } // If we were going to return success, we'd have done it by now. - return FALSE; + return false; } void LLMuteList::updateAdd(const LLMute& mute) @@ -375,13 +375,13 @@ void LLMuteList::updateAdd(const LLMute& mute) { LL_WARNS() << "Added elements to non-initialized block list" << LL_ENDL; } - mIsLoaded = TRUE; // why is this here? -MG + mIsLoaded = true; // why is this here? -MG } -BOOL LLMuteList::remove(const LLMute& mute, U32 flags) +bool LLMuteList::remove(const LLMute& mute, U32 flags) { - BOOL found = FALSE; + bool found = false; // First, remove from main list. mute_set_t::iterator it = mMutes.find(mute); @@ -505,14 +505,14 @@ void notify_automute_callback(const LLUUID& agent_id, const LLAvatarName& full_n } -BOOL LLMuteList::autoRemove(const LLUUID& agent_id, const EAutoReason reason) +bool LLMuteList::autoRemove(const LLUUID& agent_id, const EAutoReason reason) { - BOOL removed = FALSE; + bool removed = false; if (isMuted(agent_id)) { LLMute automute(agent_id, LLStringUtil::null, LLMute::AGENT); - removed = TRUE; + removed = true; remove(automute); LLAvatarName av_name; @@ -559,19 +559,19 @@ std::vector<LLMute> LLMuteList::getMutes() const //----------------------------------------------------------------------------- // loadFromFile() //----------------------------------------------------------------------------- -BOOL LLMuteList::loadFromFile(const std::string& filename) +bool LLMuteList::loadFromFile(const std::string& filename) { if(!filename.size()) { LL_WARNS() << "Mute List Filename is Empty!" << LL_ENDL; - return FALSE; + return false; } LLFILE* fp = LLFile::fopen(filename, "rb"); /*Flawfinder: ignore*/ if (!fp) { LL_WARNS() << "Couldn't open mute list " << filename << LL_ENDL; - return FALSE; + return false; } // *NOTE: Changing the size of these buffers will require changes @@ -616,25 +616,25 @@ BOOL LLMuteList::loadFromFile(const std::string& filename) } mPendingAgentNameUpdates.clear(); - return TRUE; + return true; } //----------------------------------------------------------------------------- // saveToFile() //----------------------------------------------------------------------------- -BOOL LLMuteList::saveToFile(const std::string& filename) +bool LLMuteList::saveToFile(const std::string& filename) { if(!filename.size()) { LL_WARNS() << "Mute List Filename is Empty!" << LL_ENDL; - return FALSE; + return false; } LLFILE* fp = LLFile::fopen(filename, "wb"); /*Flawfinder: ignore*/ if (!fp) { LL_WARNS() << "Couldn't open mute list " << filename << LL_ENDL; - return FALSE; + return false; } // legacy mutes have null uuid std::string id_string; @@ -659,11 +659,11 @@ BOOL LLMuteList::saveToFile(const std::string& filename) } } fclose(fp); - return TRUE; + return true; } -BOOL LLMuteList::isMuted(const LLUUID& id, const std::string& name, U32 flags) const +bool LLMuteList::isMuted(const LLUUID& id, const std::string& name, U32 flags) const { // for objects, check for muting on their parent prim LLViewerObject* mute_object = get_object_to_mute_from_id(id); @@ -677,21 +677,21 @@ BOOL LLMuteList::isMuted(const LLUUID& id, const std::string& name, U32 flags) c // If any of the flags the caller passed are set, this item isn't considered muted for this caller. if(flags & mute_it->mFlags) { - return FALSE; + return false; } - return TRUE; + return true; } // empty names can't be legacy-muted bool avatar = mute_object && mute_object->isAvatar(); - if (name.empty() || avatar) return FALSE; + if (name.empty() || avatar) return false; // Look in legacy pile string_set_t::const_iterator legacy_it = mLegacyMutes.find(name); return legacy_it != mLegacyMutes.end(); } -BOOL LLMuteList::isMuted(const std::string& username, U32 flags) const +bool LLMuteList::isMuted(const std::string& username, U32 flags) const { mute_set_t::const_iterator mute_iter = mMutes.begin(); while(mute_iter != mMutes.end()) @@ -700,11 +700,11 @@ BOOL LLMuteList::isMuted(const std::string& username, U32 flags) const if (mute_iter->mType == LLMute::AGENT && LLCacheName::buildUsername(mute_iter->mName) == username) { - return TRUE; + return true; } mute_iter++; } - return FALSE; + return false; } //----------------------------------------------------------------------------- @@ -739,7 +739,7 @@ void LLMuteList::requestFromServer(const LLUUID& agent_id) } // Double amount of retries due to this request happening during busy stage // Ideally this should be turned into a capability - gMessageSystem->sendReliable(gAgent.getRegionHost(), LL_DEFAULT_RELIABLE_RETRIES * 2, TRUE, LL_PING_BASED_TIMEOUT_DUMMY, NULL, NULL); + gMessageSystem->sendReliable(gAgent.getRegionHost(), LL_DEFAULT_RELIABLE_RETRIES * 2, true, LL_PING_BASED_TIMEOUT_DUMMY, NULL, NULL); } //----------------------------------------------------------------------------- @@ -782,7 +782,7 @@ void LLMuteList::processMuteListUpdate(LLMessageSystem* msg, void**) filename, LL_PATH_CACHE, msg->getSender(), - TRUE, // make the remote file temporary. + true, // make the remote file temporary. onFileMuteList, (void**)local_filename_and_path, LLXferManager::HIGH_PRIORITY); @@ -866,7 +866,7 @@ void LLMuteList::removeObserver(LLMuteListObserver* observer) void LLMuteList::setLoaded() { - mIsLoaded = TRUE; + mIsLoaded = true; notifyObservers(); } diff --git a/indra/newview/llmutelist.h b/indra/newview/llmutelist.h index fc47e507c3..13d579c61f 100644 --- a/indra/newview/llmutelist.h +++ b/indra/newview/llmutelist.h @@ -89,25 +89,25 @@ public: void removeObserver(LLMuteListObserver* observer); // Add either a normal or a BY_NAME mute, for any or all properties. - BOOL add(const LLMute& mute, U32 flags = 0); + bool add(const LLMute& mute, U32 flags = 0); // Remove both normal and legacy mutes, for any or all properties. - BOOL remove(const LLMute& mute, U32 flags = 0); - BOOL autoRemove(const LLUUID& agent_id, const EAutoReason reason); + bool remove(const LLMute& mute, U32 flags = 0); + bool autoRemove(const LLUUID& agent_id, const EAutoReason reason); // Name is required to test against legacy text-only mutes. - BOOL isMuted(const LLUUID& id, const std::string& name = LLStringUtil::null, U32 flags = 0) const; + bool isMuted(const LLUUID& id, const std::string& name = LLStringUtil::null, U32 flags = 0) const; // Workaround for username-based mute search, a lot of string conversions so use cautiously // Expects lower case username - BOOL isMuted(const std::string& username, U32 flags = 0) const; + bool isMuted(const std::string& username, U32 flags = 0) const; // Alternate (convenience) form for places we don't need to pass the name, but do need flags - BOOL isMuted(const LLUUID& id, U32 flags) const { return isMuted(id, LLStringUtil::null, flags); }; + bool isMuted(const LLUUID& id, U32 flags) const { return isMuted(id, LLStringUtil::null, flags); }; static bool isLinden(const std::string& name); - BOOL isLoaded() const { return mIsLoaded; } + bool isLoaded() const { return mIsLoaded; } std::vector<LLMute> getMutes() const; @@ -118,8 +118,8 @@ public: void cache(const LLUUID& agent_id); private: - BOOL loadFromFile(const std::string& filename); - BOOL saveToFile(const std::string& filename); + bool loadFromFile(const std::string& filename); + bool saveToFile(const std::string& filename); void setLoaded(); void notifyObservers(); @@ -167,7 +167,7 @@ private: typedef std::set<LLMuteListObserver*> observer_set_t; observer_set_t mObservers; - BOOL mIsLoaded; + bool mIsLoaded; friend class LLDispatchEmptyMuteList; }; diff --git a/indra/newview/llnamebox.cpp b/indra/newview/llnamebox.cpp index ba4fcbb3cb..0e88fa7461 100644 --- a/indra/newview/llnamebox.cpp +++ b/indra/newview/llnamebox.cpp @@ -59,12 +59,12 @@ LLNameBox::~LLNameBox() LLNameBox::sInstances.erase(this); } -void LLNameBox::setNameID(const LLUUID& name_id, BOOL is_group) +void LLNameBox::setNameID(const LLUUID& name_id, bool is_group) { mNameID = name_id; std::string name; - BOOL got_name = FALSE; + bool got_name = false; if (!is_group) { @@ -105,7 +105,7 @@ void LLNameBox::refreshAll(const LLUUID& id, const std::string& full_name, bool } } -void LLNameBox::setName(const std::string& name, BOOL is_group) +void LLNameBox::setName(const std::string& name, bool is_group) { if (mLink) { diff --git a/indra/newview/llnamebox.h b/indra/newview/llnamebox.h index d98d26d755..336ef8551a 100644 --- a/indra/newview/llnamebox.h +++ b/indra/newview/llnamebox.h @@ -51,7 +51,7 @@ public: virtual ~LLNameBox(); - void setNameID(const LLUUID& name_id, BOOL is_group); + void setNameID(const LLUUID& name_id, bool is_group); void refresh(const LLUUID& id, const std::string& full_name, bool is_group); @@ -62,13 +62,13 @@ protected: friend class LLUICtrlFactory; private: - void setName(const std::string& name, BOOL is_group); + void setName(const std::string& name, bool is_group); static std::set<LLNameBox*> sInstances; private: LLUUID mNameID; - BOOL mLink; + bool mLink; std::string mInitialValue; }; diff --git a/indra/newview/llnameeditor.cpp b/indra/newview/llnameeditor.cpp index b9dcc98a28..4b5e3bd53e 100644 --- a/indra/newview/llnameeditor.cpp +++ b/indra/newview/llnameeditor.cpp @@ -58,7 +58,7 @@ LLNameEditor::~LLNameEditor() LLNameEditor::sInstances.erase(this); } -void LLNameEditor::setNameID(const LLUUID& name_id, BOOL is_group) +void LLNameEditor::setNameID(const LLUUID& name_id, bool is_group) { mNameID = name_id; @@ -100,7 +100,7 @@ void LLNameEditor::refreshAll(const LLUUID& id, const std::string& full_name, bo void LLNameEditor::setValue( const LLSD& value ) { - setNameID(value.asUUID(), FALSE); + setNameID(value.asUUID(), false); } LLSD LLNameEditor::getValue() const diff --git a/indra/newview/llnameeditor.h b/indra/newview/llnameeditor.h index 84dd347008..efa2da9fd8 100644 --- a/indra/newview/llnameeditor.h +++ b/indra/newview/llnameeditor.h @@ -57,7 +57,7 @@ protected: public: virtual ~LLNameEditor(); - void setNameID(const LLUUID& name_id, BOOL is_group); + void setNameID(const LLUUID& name_id, bool is_group); void refresh(const LLUUID& id, const std::string& full_name, bool is_group); diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp index dc0f5f89fd..d7ffcb6e25 100644 --- a/indra/newview/llnamelistctrl.cpp +++ b/indra/newview/llnamelistctrl.cpp @@ -45,7 +45,7 @@ static LLDefaultChildRegistry::Register<LLNameListCtrl> r("name_list"); -static const S32 info_icon_size = 16; +static constexpr S32 info_icon_size = 16; void LLNameListCtrl::NameTypeNames::declareValues() { @@ -74,7 +74,7 @@ LLNameListCtrl::LLNameListCtrl(const LLNameListCtrl::Params& p) // public LLScrollListItem* LLNameListCtrl::addNameItem(const LLUUID& agent_id, EAddPosition pos, - BOOL enabled, const std::string& suffix, const std::string& prefix) + bool enabled, const std::string& suffix, const std::string& prefix) { //LL_INFOS() << "LLNameListCtrl::addNameItem " << agent_id << LL_ENDL; @@ -87,19 +87,19 @@ LLScrollListItem* LLNameListCtrl::addNameItem(const LLUUID& agent_id, EAddPositi } // virtual, public -BOOL LLNameListCtrl::handleDragAndDrop( +bool LLNameListCtrl::handleDragAndDrop( S32 x, S32 y, MASK mask, - BOOL drop, + bool drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg) { if (!mAllowCallingCardDrop) { - return FALSE; + return false; } - BOOL handled = FALSE; + bool handled = false; if (cargo_type == DAD_CALLINGCARD) { @@ -128,7 +128,7 @@ BOOL LLNameListCtrl::handleDragAndDrop( } } - handled = TRUE; + handled = true; LL_DEBUGS("UserInput") << "dragAndDrop handled by LLNameListCtrl " << getName() << LL_ENDL; return handled; @@ -216,9 +216,9 @@ void LLNameListCtrl::mouseOverHighlightNthItem( S32 target_index ) } //virtual -BOOL LLNameListCtrl::handleToolTip(S32 x, S32 y, MASK mask) +bool LLNameListCtrl::handleToolTip(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; S32 column_index = getColumnIndexFromOffset(x); LLNameListItem* hit_item = dynamic_cast<LLNameListItem*>(hitItem(x, y)); LLFloater* floater = gFloaterView->getParentFloater(this); @@ -268,7 +268,7 @@ BOOL LLNameListCtrl::handleToolTip(S32 x, S32 y, MASK mask) params.sticky_rect(sticky_rect); LLToolTipMgr::getInstance()->show(params); - handled = TRUE; + handled = true; } } } @@ -281,7 +281,7 @@ BOOL LLNameListCtrl::handleToolTip(S32 x, S32 y, MASK mask) } // virtual -BOOL LLNameListCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLNameListCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) { LLNameListItem* hit_item = dynamic_cast<LLNameListItem*>(hitItem(x, y)); LLFloater* floater = gFloaterView->getParentFloater(this); @@ -291,7 +291,7 @@ BOOL LLNameListCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) { ContextMenuType prev_menu = getContextMenuType(); setContextMenu(MENU_GROUP); - BOOL handled = LLScrollListCtrl::handleRightMouseDown(x, y, mask); + bool handled = LLScrollListCtrl::handleRightMouseDown(x, y, mask); setContextMenu(prev_menu); return handled; } @@ -301,7 +301,7 @@ BOOL LLNameListCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) // public void LLNameListCtrl::addGroupNameItem(const LLUUID& group_id, EAddPosition pos, - BOOL enabled) + bool enabled) { NameItem item; item.value = group_id; @@ -438,7 +438,7 @@ LLScrollListItem* LLNameListCtrl::addNameItemRow( LLScrollListColumn* columnp = getColumn(mNameColumnIndex); if (columnp && columnp->mHeader) { - columnp->mHeader->setHasResizableElement(TRUE); + columnp->mHeader->setHasResizableElement(true); } return item; @@ -496,7 +496,7 @@ void LLNameListCtrl::selectItemBySpecialId(const LLUUID& special_id) LLNameListItem* item = dynamic_cast<LLNameListItem*>(*it); if (item && item->getSpecialID() == special_id) { - item->setSelected(TRUE); + item->setSelected(true); break; } } @@ -616,7 +616,7 @@ void LLNameListCtrl::updateColumns(bool force_update) } } -void LLNameListCtrl::sortByName(BOOL ascending) +void LLNameListCtrl::sortByName(bool ascending) { sortByColumnIndex(mNameColumnIndex,ascending); } diff --git a/indra/newview/llnamelistctrl.h b/indra/newview/llnamelistctrl.h index 111b8d1077..dde85f4d29 100644 --- a/indra/newview/llnamelistctrl.h +++ b/indra/newview/llnamelistctrl.h @@ -144,7 +144,7 @@ public: // Add a user to the list by name. It will be added, the name // requested from the cache, and updated as necessary. LLScrollListItem* addNameItem(const LLUUID& agent_id, EAddPosition pos = ADD_BOTTOM, - BOOL enabled = TRUE, const std::string& suffix = LLStringUtil::null, const std::string& prefix = LLStringUtil::null); + bool enabled = true, const std::string& suffix = LLStringUtil::null, const std::string& prefix = LLStringUtil::null); LLScrollListItem* addNameItem(NameItem& item, EAddPosition pos = ADD_BOTTOM); /*virtual*/ LLScrollListItem* addElement(const LLSD& element, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL); @@ -154,7 +154,7 @@ public: // Add a user to the list by name. It will be added, the name // requested from the cache, and updated as necessary. void addGroupNameItem(const LLUUID& group_id, EAddPosition pos = ADD_BOTTOM, - BOOL enabled = TRUE); + bool enabled = true); void addGroupNameItem(NameItem& item, EAddPosition pos = ADD_BOTTOM); @@ -166,21 +166,21 @@ public: LLUUID getSelectedSpecialId(); // LLView interface - /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, - BOOL drop, EDragAndDropType cargo_type, void *cargo_data, + /*virtual*/ bool handleDragAndDrop(S32 x, S32 y, MASK mask, + bool drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg); - /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleToolTip(S32 x, S32 y, MASK mask); - void setAllowCallingCardDrop(BOOL b) { mAllowCallingCardDrop = b; } + void setAllowCallingCardDrop(bool b) { mAllowCallingCardDrop = b; } - void sortByName(BOOL ascending); + void sortByName(bool ascending); /*virtual*/ void updateColumns(bool force_update); /*virtual*/ void mouseOverHighlightNthItem( S32 index ); - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleRightMouseDown(S32 x, S32 y, MASK mask); bool isSpecialType() { return (mNameListType == SPECIAL); } @@ -195,7 +195,7 @@ private: private: S32 mNameColumnIndex; std::string mNameColumn; - BOOL mAllowCallingCardDrop; + bool mAllowCallingCardDrop; bool mShortNames; // display name only, no SLID typedef std::map<LLUUID, boost::signals2::connection> avatar_name_cache_connection_map_t; avatar_name_cache_connection_map_t mAvatarNameCacheConnections; diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp index dd496c3bf9..da5bc4b05d 100644 --- a/indra/newview/llnavigationbar.cpp +++ b/indra/newview/llnavigationbar.cpp @@ -170,12 +170,12 @@ void LLTeleportHistoryMenuItem::draw() void LLTeleportHistoryMenuItem::onMouseEnter(S32 x, S32 y, MASK mask) { - mArrowIcon->setVisible(TRUE); + mArrowIcon->setVisible(true); } void LLTeleportHistoryMenuItem::onMouseLeave(S32 x, S32 y, MASK mask) { - mArrowIcon->setVisible(FALSE); + mArrowIcon->setVisible(false); } static LLDefaultChildRegistry::Register<LLPullButton> menu_button("pull_button"); @@ -213,9 +213,9 @@ void LLPullButton::onMouseLeave(S32 x, S32 y, MASK mask) } /*virtual*/ -BOOL LLPullButton::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLPullButton::handleMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = LLButton::handleMouseDown(x, y, mask); + bool handled = LLButton::handleMouseDown(x, y, mask); if (handled) { //if mouse down was handled by button, @@ -226,7 +226,7 @@ BOOL LLPullButton::handleMouseDown(S32 x, S32 y, MASK mask) } /*virtual*/ -BOOL LLPullButton::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLPullButton::handleMouseUp(S32 x, S32 y, MASK mask) { // reset data to get ready for next circle mLastMouseDown.clear(); @@ -286,7 +286,7 @@ LLNavigationBar::~LLNavigationBar() mTeleportFailedConnection.disconnect(); } -BOOL LLNavigationBar::postBuild() +bool LLNavigationBar::postBuild() { mBtnBack = getChild<LLPullButton>("back_btn"); mBtnForward = getChild<LLPullButton>("forward_btn"); @@ -295,12 +295,12 @@ BOOL LLNavigationBar::postBuild() mCmbLocation= getChild<LLLocationInputCtrl>("location_combo"); - mBtnBack->setEnabled(FALSE); + mBtnBack->setEnabled(false); mBtnBack->setClickedCallback(boost::bind(&LLNavigationBar::onBackButtonClicked, this)); mBtnBack->setHeldDownCallback(boost::bind(&LLNavigationBar::onBackOrForwardButtonHeldDown, this,_1, _2)); mBtnBack->setClickDraggingCallback(boost::bind(&LLNavigationBar::showTeleportHistoryMenu, this,_1)); - mBtnForward->setEnabled(FALSE); + mBtnForward->setEnabled(false); mBtnForward->setClickedCallback(boost::bind(&LLNavigationBar::onForwardButtonClicked, this)); mBtnForward->setHeldDownCallback(boost::bind(&LLNavigationBar::onBackOrForwardButtonHeldDown, this, _1, _2)); mBtnForward->setClickDraggingCallback(boost::bind(&LLNavigationBar::showTeleportHistoryMenu, this,_1)); @@ -331,10 +331,10 @@ BOOL LLNavigationBar::postBuild() mNavigationPanel->getResizeBar()->setResizeListener(boost::bind(&LLNavigationBar::onNavbarResized, this)); mFavoritePanel->getResizeBar()->setResizeListener(boost::bind(&LLNavigationBar::onNavbarResized, this)); - return TRUE; + return true; } -void LLNavigationBar::setVisible(BOOL visible) +void LLNavigationBar::setVisible(bool visible) { // change visibility of grandparent layout_panel to animate in and out if (getParent()) @@ -360,9 +360,9 @@ void LLNavigationBar::draw() LLPanel::draw(); } -BOOL LLNavigationBar::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLNavigationBar::handleRightMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = childrenHandleRightMouseDown( x, y, mask) != NULL; + bool handled = childrenHandleRightMouseDown( x, y, mask) != NULL; if(!handled && !gMenuHolder->hasVisibleMenu()) { show_navbar_context_menu(this,x,y); @@ -459,7 +459,7 @@ void LLNavigationBar::onLocationSelection() { LLInventoryModel::item_array_t landmark_items = LLLandmarkActions::fetchLandmarksByName(typed_location, - FALSE); + false); if (!landmark_items.empty()) { gAgent.teleportViaLandmark( landmark_items[0]->getAssetUUID()); diff --git a/indra/newview/llnavigationbar.h b/indra/newview/llnavigationbar.h index 56af1c134f..2bb6af24bc 100755 --- a/indra/newview/llnavigationbar.h +++ b/indra/newview/llnavigationbar.h @@ -60,9 +60,9 @@ public: } }; - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask); /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask); @@ -93,9 +93,9 @@ class LLNavigationBar public: /*virtual*/ void draw() override; - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL postBuild() override; - /*virtual*/ void setVisible(BOOL visible) override; + /*virtual*/ bool handleRightMouseDown(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool postBuild() override; + /*virtual*/ void setVisible(bool visible) override; void handleLoginComplete(); void clearHistoryCache(); @@ -138,7 +138,7 @@ private: { if (LLNavigationBar::instanceExists()) { - LLNavigationBar::getInstance()->setEnabled(FALSE); + LLNavigationBar::getInstance()->setEnabled(false); } } diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index d8ac641e56..1410232a0f 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -69,20 +69,20 @@ static LLDefaultChildRegistry::Register<LLNetMap> r1("net_map"); -const F32 LLNetMap::MAP_SCALE_MIN = 32; -const F32 LLNetMap::MAP_SCALE_FAR = 32; -const F32 LLNetMap::MAP_SCALE_MEDIUM = 128; -const F32 LLNetMap::MAP_SCALE_CLOSE = 256; -const F32 LLNetMap::MAP_SCALE_VERY_CLOSE = 1024; -const F32 LLNetMap::MAP_SCALE_MAX = 4096; +constexpr F32 LLNetMap::MAP_SCALE_MIN = 32; +constexpr F32 LLNetMap::MAP_SCALE_FAR = 32; +constexpr F32 LLNetMap::MAP_SCALE_MEDIUM = 128; +constexpr F32 LLNetMap::MAP_SCALE_CLOSE = 256; +constexpr F32 LLNetMap::MAP_SCALE_VERY_CLOSE = 1024; +constexpr F32 LLNetMap::MAP_SCALE_MAX = 4096; -const F32 MAP_SCALE_ZOOM_FACTOR = 1.04f; // Zoom in factor per click of scroll wheel (4%) -const F32 MIN_DOT_RADIUS = 3.5f; -const F32 DOT_SCALE = 0.75f; -const F32 MIN_PICK_SCALE = 2.f; -const S32 MOUSE_DRAG_SLOP = 2; // How far the mouse needs to move before we think it's a drag +constexpr F32 MAP_SCALE_ZOOM_FACTOR = 1.04f; // Zoom in factor per click of scroll wheel (4%) +constexpr F32 MIN_DOT_RADIUS = 3.5f; +constexpr F32 DOT_SCALE = 0.75f; +constexpr F32 MIN_PICK_SCALE = 2.f; +constexpr S32 MOUSE_DRAG_SLOP = 2; // How far the mouse needs to move before we think it's a drag -const F64 COARSEUPDATE_MAX_Z = 1020.0f; +constexpr F64 COARSEUPDATE_MAX_Z = 1020.0f; LLNetMap::LLNetMap (const Params & p) : LLUICtrl (p), @@ -126,7 +126,7 @@ LLNetMap::~LLNetMap() } } -BOOL LLNetMap::postBuild() +bool LLNetMap::postBuild() { LLUICtrl::CommitCallbackRegistry::ScopedRegistrar commitRegistrar; LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enableRegistrar; @@ -142,7 +142,7 @@ BOOL LLNetMap::postBuild() LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_mini_map.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); mPopupMenuHandle = menu->getHandle(); menu->setItemEnabled("Re-center map", false); - return TRUE; + return true; } void LLNetMap::setScale( F32 scale ) @@ -345,6 +345,7 @@ void LLNetMap::draw() mObjectImageCenterGlobal = viewPosToGlobal(llfloor(new_center.mV[VX]), llfloor(new_center.mV[VY])); // Create the base texture. + LLImageDataLock lock(mObjectRawImagep); U8 *default_texture = mObjectRawImagep->getData(); memset( default_texture, 0, mObjectImagep->getWidth() * mObjectImagep->getHeight() * mObjectImagep->getComponents() ); @@ -543,7 +544,7 @@ void LLNetMap::draw() LLUICtrl::draw(); } -void LLNetMap::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLNetMap::reshape(S32 width, S32 height, bool called_from_parent) { LLUICtrl::reshape(width, height, called_from_parent); createObjectImage(); @@ -576,7 +577,7 @@ LLVector3 LLNetMap::globalPosToView(const LLVector3d& global_pos) } void LLNetMap::drawTracking(const LLVector3d& pos_global, const LLColor4& color, - BOOL draw_arrow ) + bool draw_arrow ) { LLVector3 pos_local = globalPosToView(pos_global); if( (pos_local.mV[VX] < 0) || @@ -687,7 +688,7 @@ LLVector3d LLNetMap::viewPosToGlobal( S32 x, S32 y ) return pos_global; } -BOOL LLNetMap::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLNetMap::handleScrollWheel(S32 x, S32 y, S32 clicks) { // note that clicks are reversed from what you'd think: i.e. > 0 means zoom out, < 0 means zoom in F32 new_scale = mScale * pow(MAP_SCALE_ZOOM_FACTOR, -clicks); @@ -708,7 +709,7 @@ BOOL LLNetMap::handleScrollWheel(S32 x, S32 y, S32 clicks) return true; } -BOOL LLNetMap::handleToolTip(S32 x, S32 y, MASK mask) +bool LLNetMap::handleToolTip(S32 x, S32 y, MASK mask) { if (gDisconnected) { @@ -837,12 +838,12 @@ BOOL LLNetMap::handleToolTip(S32 x, S32 y, MASK mask) return true; } -BOOL LLNetMap::handleToolTipAgent(const LLUUID& avatar_id) +bool LLNetMap::handleToolTipAgent(const LLUUID& avatar_id) { LLAvatarName av_name; if (avatar_id.isNull() || !LLAvatarNameCache::get(avatar_id, &av_name)) { - return FALSE; + return false; } // only show tooltip if same inspector not already open @@ -863,7 +864,7 @@ BOOL LLNetMap::handleToolTipAgent(const LLUUID& avatar_id) LLToolTipMgr::instance().show(p); } - return TRUE; + return true; } // static @@ -915,6 +916,7 @@ void LLNetMap::renderPoint(const LLVector3 &pos_local, const LLColor4U &color, return; } + LLImageDataLock lock(mObjectRawImagep); U8 *datap = mObjectRawImagep->getData(); S32 neg_radius = diameter / 2; @@ -1001,13 +1003,13 @@ void LLNetMap::createObjectImage() mObjectRawImagep = new LLImageRaw(img_size, img_size, 4); U8* data = mObjectRawImagep->getData(); memset( data, 0, img_size * img_size * 4 ); - mObjectImagep = LLViewerTextureManager::getLocalTexture( mObjectRawImagep.get(), FALSE); + mObjectImagep = LLViewerTextureManager::getLocalTexture( mObjectRawImagep.get(), false); } setScale(mScale); mUpdateNow = true; } -BOOL LLNetMap::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLNetMap::handleMouseDown(S32 x, S32 y, MASK mask) { // Start panning gFocusMgr.setMouseCapture(this); @@ -1018,7 +1020,7 @@ BOOL LLNetMap::handleMouseDown(S32 x, S32 y, MASK mask) return true; } -BOOL LLNetMap::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLNetMap::handleMouseUp(S32 x, S32 y, MASK mask) { if (abs(mMouseDown.mX - x) < 3 && abs(mMouseDown.mY - y) < 3) { @@ -1051,7 +1053,7 @@ BOOL LLNetMap::handleMouseUp(S32 x, S32 y, MASK mask) return false; } -BOOL LLNetMap::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLNetMap::handleRightMouseDown(S32 x, S32 y, MASK mask) { auto menu = static_cast<LLMenuGL*>(mPopupMenuHandle.get()); if (menu) @@ -1062,20 +1064,20 @@ BOOL LLNetMap::handleRightMouseDown(S32 x, S32 y, MASK mask) menu->setItemEnabled("Stop Tracking", LLTracker::isTracking(0)); LLMenuGL::showPopup(this, menu, x, y); } - return TRUE; + return true; } -BOOL LLNetMap::handleClick(S32 x, S32 y, MASK mask) +bool LLNetMap::handleClick(S32 x, S32 y, MASK mask) { // TODO: allow clicking an avatar on minimap to select avatar in the nearby avatar list // if(mClosestAgentToCursor.notNull()) // mNearbyList->selectUser(mClosestAgentToCursor); // Needs a registered observer i guess to accomplish this without using // globals to tell the mNearbyList in llpeoplepanel to select the user - return TRUE; + return true; } -BOOL LLNetMap::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLNetMap::handleDoubleClick(S32 x, S32 y, MASK mask) { LLVector3d pos_global = viewPosToGlobal(x, y); @@ -1104,7 +1106,7 @@ BOOL LLNetMap::handleDoubleClick(S32 x, S32 y, MASK mask) { LLFloaterReg::showInstance("world_map"); } - return TRUE; + return true; } F32 LLNetMap::getScaleForName(std::string scale_name) @@ -1137,7 +1139,7 @@ bool LLNetMap::outsideSlop( S32 x, S32 y, S32 start_x, S32 start_y, S32 slop ) return (dx <= -slop || slop <= dx || dy <= -slop || slop <= dy); } -BOOL LLNetMap::handleHover( S32 x, S32 y, MASK mask ) +bool LLNetMap::handleHover( S32 x, S32 y, MASK mask ) { if (hasMouseCapture()) { @@ -1171,7 +1173,7 @@ BOOL LLNetMap::handleHover( S32 x, S32 y, MASK mask ) gViewerWindow->setCursor( UI_CURSOR_CROSS ); } - return TRUE; + return true; } bool LLNetMap::isZoomChecked(const LLSD &userdata) diff --git a/indra/newview/llnetmap.h b/indra/newview/llnetmap.h index 7e8339acf0..7bb13c9f2b 100644 --- a/indra/newview/llnetmap.h +++ b/indra/newview/llnetmap.h @@ -70,17 +70,17 @@ public: static const F32 MAP_SCALE_MAX; /*virtual*/ void draw(); - /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleHover( S32 x, S32 y, MASK mask ); - /*virtual*/ BOOL handleToolTip( S32 x, S32 y, MASK mask); - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); - - /*virtual*/ BOOL postBuild(); - /*virtual*/ BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); - /*virtual*/ BOOL handleClick(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleDoubleClick( S32 x, S32 y, MASK mask ); + /*virtual*/ bool handleScrollWheel(S32 x, S32 y, S32 clicks); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleHover( S32 x, S32 y, MASK mask ); + /*virtual*/ bool handleToolTip( S32 x, S32 y, MASK mask); + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true); + + /*virtual*/ bool postBuild(); + /*virtual*/ bool handleRightMouseDown( S32 x, S32 y, MASK mask ); + /*virtual*/ bool handleClick(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleDoubleClick( S32 x, S32 y, MASK mask ); void setScale(F32 scale); @@ -105,10 +105,10 @@ private: void drawTracking( const LLVector3d& pos_global, const LLColor4& color, - BOOL draw_arrow = TRUE); + bool draw_arrow = true); bool isMouseOnPopupMenu(); void updateAboutLandPopupButton(); - BOOL handleToolTipAgent(const LLUUID& avatar_id); + bool handleToolTipAgent(const LLUUID& avatar_id); static void showAvatarInspector(const LLUUID& avatar_id); void createObjectImage(); diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp index 77ab242d3b..23f1f8fa5a 100644 --- a/indra/newview/llnotificationhandlerutil.cpp +++ b/indra/newview/llnotificationhandlerutil.cpp @@ -60,11 +60,9 @@ bool LLHandlerUtil::isIMFloaterOpened(const LLNotificationPtr& notification) LLUUID from_id = notification->getPayload()["from_id"]; LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, from_id); - LLFloaterIMSession* im_floater = LLFloaterReg::findTypedInstance<LLFloaterIMSession>("impanel", session_id); - - if (im_floater != NULL) + if (LLFloaterIMSession* im_floater = LLFloaterReg::findTypedInstance<LLFloaterIMSession>("impanel", session_id)) { - res = im_floater->getVisible() == TRUE; + res = im_floater->getVisible(); } return res; diff --git a/indra/newview/llnotificationlistitem.cpp b/indra/newview/llnotificationlistitem.cpp index 62349f43b1..5b8b28ebe6 100644 --- a/indra/newview/llnotificationlistitem.cpp +++ b/indra/newview/llnotificationlistitem.cpp @@ -56,9 +56,9 @@ LLNotificationListItem::LLNotificationListItem(const Params& p) : LLPanel(p), mNotificationName = p.notification_name; } -BOOL LLNotificationListItem::postBuild() +bool LLNotificationListItem::postBuild() { - BOOL rv = LLPanel::postBuild(); + bool rv = LLPanel::postBuild(); mTitleBox = getChild<LLTextBox>("notification_title"); mTitleBoxExp = getChild<LLTextBox>("notification_title_exp"); mNoticeTextExp = getChild<LLChatEntry>("notification_text_exp"); @@ -73,7 +73,7 @@ BOOL LLNotificationListItem::postBuild() mTitleBox->setValue(mParams.title); mTitleBoxExp->setValue(mParams.title); mNoticeTextExp->setValue(mParams.title); - mNoticeTextExp->setEnabled(FALSE); + mNoticeTextExp->setEnabled(false); mNoticeTextExp->setTextExpandedCallback(boost::bind(&LLNotificationListItem::reshapeNotification, this)); mTitleBox->setContentTrusted(false); @@ -99,7 +99,7 @@ BOOL LLNotificationListItem::postBuild() mExpandedHeight = (S32)atoi(expanded_height_str.c_str()); mCondensedHeight = (S32)atoi(condensed_height_str.c_str()); - setExpanded(FALSE); + setExpanded(false); return rv; } @@ -151,9 +151,9 @@ void LLNotificationListItem::onClickCloseBtn() close(); } -BOOL LLNotificationListItem::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLNotificationListItem::handleMouseUp(S32 x, S32 y, MASK mask) { - BOOL res = LLPanel::handleMouseUp(x, y, mask); + bool res = LLPanel::handleMouseUp(x, y, mask); mOnItemClick(this); return res; } @@ -208,12 +208,12 @@ std::set<std::string> LLNotificationListItem::getTransactionTypes() void LLNotificationListItem::onClickExpandBtn() { - setExpanded(TRUE); + setExpanded(true); } void LLNotificationListItem::onClickCondenseBtn() { - setExpanded(FALSE); + setExpanded(false); } void LLNotificationListItem::reshapeNotification() @@ -221,11 +221,11 @@ void LLNotificationListItem::reshapeNotification() if(mExpanded) { S32 width = this->getRect().getWidth(); - this->reshape(width, mNoticeTextExp->getRect().getHeight() + mExpandedHeight, FALSE); + this->reshape(width, mNoticeTextExp->getRect().getHeight() + mExpandedHeight, false); } } -void LLNotificationListItem::setExpanded(BOOL value) +void LLNotificationListItem::setExpanded(bool value) { mCondensedViewPanel->setVisible(!value); mExpandedViewPanel->setVisible(value); @@ -233,11 +233,11 @@ void LLNotificationListItem::setExpanded(BOOL value) if (value) { - this->reshape(width, mNoticeTextExp->getRect().getHeight() + mExpandedHeight, FALSE); + this->reshape(width, mNoticeTextExp->getRect().getHeight() + mExpandedHeight, false); } else { - this->reshape(width, mCondensedHeight, FALSE); + this->reshape(width, mCondensedHeight, false); } mExpanded = value; @@ -278,12 +278,12 @@ LLGroupInviteNotificationListItem::LLGroupInviteNotificationListItem(const Param buildFromFile("panel_notification_list_item.xml"); } -BOOL LLGroupInviteNotificationListItem::postBuild() +bool LLGroupInviteNotificationListItem::postBuild() { - BOOL rv = LLGroupNotificationListItem::postBuild(); + bool rv = LLGroupNotificationListItem::postBuild(); setFee(mParams.fee); mInviteButtonPanel = getChild<LLPanel>("button_panel"); - mInviteButtonPanel->setVisible(TRUE); + mInviteButtonPanel->setVisible(true); mJoinBtn = getChild<LLButton>("join_btn"); mDeclineBtn = getChild<LLButton>("decline_btn"); mInfoBtn = getChild<LLButton>("info_btn"); @@ -338,8 +338,8 @@ void LLGroupInviteNotificationListItem::setFee(S32 fee) std::string fee_text = getString("group_fee_text", string_args); mSenderOrFeeBox->setValue(fee_text); mSenderOrFeeBoxExp->setValue(fee_text); - mSenderOrFeeBox->setVisible(TRUE); - mSenderOrFeeBoxExp->setVisible(TRUE); + mSenderOrFeeBox->setVisible(true); + mSenderOrFeeBoxExp->setVisible(true); } LLGroupNoticeNotificationListItem::LLGroupNoticeNotificationListItem(const Params& p) @@ -363,15 +363,15 @@ LLGroupNotificationListItem::~LLGroupNotificationListItem() LLGroupMgr::getInstance()->removeObserver(this); } -BOOL LLGroupNoticeNotificationListItem::postBuild() +bool LLGroupNoticeNotificationListItem::postBuild() { - BOOL rv = LLGroupNotificationListItem::postBuild(); + bool rv = LLGroupNotificationListItem::postBuild(); mAttachmentTextBox = getChild<LLTextBox>("attachment_text"); mAttachmentIcon = getChild<LLIconCtrl>("attachment_icon"); mAttachmentIconExp = getChild<LLIconCtrl>("attachment_icon_exp"); mAttachmentPanel = getChild<LLPanel>("attachment_panel"); - mAttachmentPanel->setVisible(FALSE); + mAttachmentPanel->setVisible(false); mTitleBox->setValue(mParams.subject); @@ -391,13 +391,13 @@ BOOL LLGroupNoticeNotificationListItem::postBuild() if (mInventoryOffer != NULL) { mAttachmentTextBox->setValue(mInventoryOffer->mDesc); - mAttachmentTextBox->setVisible(TRUE); - mAttachmentIcon->setVisible(TRUE); + mAttachmentTextBox->setVisible(true); + mAttachmentIcon->setVisible(true); std::string icon_name = LLInventoryIcon::getIconName(mInventoryOffer->mType, LLInventoryType::IT_TEXTURE); mAttachmentIconExp->setValue(icon_name); - mAttachmentIconExp->setVisible(TRUE); + mAttachmentIconExp->setVisible(true); mAttachmentTextBox->setClickedCallback(boost::bind( &LLGroupNoticeNotificationListItem::onClickAttachment, this)); @@ -405,14 +405,14 @@ BOOL LLGroupNoticeNotificationListItem::postBuild() std::string expanded_height_resize_str = getString("expanded_height_resize_for_attachment"); mExpandedHeightResize = (S32)atoi(expanded_height_resize_str.c_str()); - mAttachmentPanel->setVisible(TRUE); + mAttachmentPanel->setVisible(true); } return rv; } -BOOL LLGroupNotificationListItem::postBuild() +bool LLGroupNotificationListItem::postBuild() { - BOOL rv = LLNotificationListItem::postBuild(); + bool rv = LLNotificationListItem::postBuild(); mGroupIcon = getChild<LLGroupIconCtrl>("group_icon"); mGroupIconExp = getChild<LLGroupIconCtrl>("group_icon_exp"); @@ -421,8 +421,8 @@ BOOL LLGroupNotificationListItem::postBuild() mGroupIcon->setValue(mParams.group_id); mGroupIconExp->setValue(mParams.group_id); - mGroupIcon->setVisible(TRUE); - mGroupIconExp->setVisible(TRUE); + mGroupIcon->setVisible(true); + mGroupIconExp->setVisible(true); mGroupId = mParams.group_id; @@ -479,12 +479,12 @@ void LLGroupNotificationListItem::setGroupName(std::string name) string_args["[GROUP_NAME]"] = llformat("%s", name.c_str()); std::string group_box_str = getString("group_name_text", string_args); mGroupNameBoxExp->setValue(group_box_str); - mGroupNameBoxExp->setVisible(TRUE); + mGroupNameBoxExp->setVisible(true); } else { mGroupNameBoxExp->setValue(LLStringUtil::null); - mGroupNameBoxExp->setVisible(FALSE); + mGroupNameBoxExp->setVisible(false); } } @@ -497,13 +497,13 @@ void LLGroupNoticeNotificationListItem::setSender(std::string sender) std::string sender_text = getString("sender_resident_text", string_args); mSenderOrFeeBox->setValue(sender_text); mSenderOrFeeBoxExp->setValue(sender_text); - mSenderOrFeeBox->setVisible(TRUE); - mSenderOrFeeBoxExp->setVisible(TRUE); + mSenderOrFeeBox->setVisible(true); + mSenderOrFeeBoxExp->setVisible(true); } else { mSenderOrFeeBox->setValue(LLStringUtil::null); mSenderOrFeeBoxExp->setValue(LLStringUtil::null); - mSenderOrFeeBox->setVisible(FALSE); - mSenderOrFeeBoxExp->setVisible(FALSE); + mSenderOrFeeBox->setVisible(false); + mSenderOrFeeBoxExp->setVisible(false); } } void LLGroupNoticeNotificationListItem::close() @@ -524,7 +524,7 @@ void LLGroupNoticeNotificationListItem::onClickAttachment() static const LLUIColor textColor = LLUIColorTable::instance().getColor( "GroupNotifyDimmedTextColor"); mAttachmentTextBox->setColor(textColor); - mAttachmentIconExp->setEnabled(FALSE); + mAttachmentIconExp->setEnabled(false); //if attachment isn't openable - notify about saving if (!isAttachmentOpenable(mInventoryOffer->mType)) { @@ -559,16 +559,16 @@ LLTransactionNotificationListItem::LLTransactionNotificationListItem(const Param buildFromFile("panel_notification_list_item.xml"); } -BOOL LLTransactionNotificationListItem::postBuild() +bool LLTransactionNotificationListItem::postBuild() { - BOOL rv = LLNotificationListItem::postBuild(); + bool rv = LLNotificationListItem::postBuild(); mAvatarIcon = getChild<LLAvatarIconCtrl>("avatar_icon"); mAvatarIconExp = getChild<LLAvatarIconCtrl>("avatar_icon_exp"); mAvatarIcon->setValue("System_Notification"); mAvatarIconExp->setValue("System_Notification"); - mAvatarIcon->setVisible(TRUE); - mAvatarIconExp->setVisible(TRUE); + mAvatarIcon->setVisible(true); + mAvatarIconExp->setVisible(true); if((GOVERNOR_LINDEN_ID == mParams.paid_to_id) || (GOVERNOR_LINDEN_ID == mParams.paid_from_id)) { @@ -606,14 +606,14 @@ LLSystemNotificationListItem::LLSystemNotificationListItem(const Params& p) } } -BOOL LLSystemNotificationListItem::postBuild() +bool LLSystemNotificationListItem::postBuild() { - BOOL rv = LLNotificationListItem::postBuild(); + bool rv = LLNotificationListItem::postBuild(); mSystemNotificationIcon = getChild<LLIconCtrl>("system_notification_icon"); mSystemNotificationIconExp = getChild<LLIconCtrl>("system_notification_icon_exp"); if (mSystemNotificationIcon) - mSystemNotificationIcon->setVisible(TRUE); + mSystemNotificationIcon->setVisible(true); if (mSystemNotificationIconExp) - mSystemNotificationIconExp->setVisible(TRUE); + mSystemNotificationIconExp->setVisible(true); return rv; } diff --git a/indra/newview/llnotificationlistitem.h b/indra/newview/llnotificationlistitem.h index 1c454c5556..2ed90e31b2 100644 --- a/indra/newview/llnotificationlistitem.h +++ b/indra/newview/llnotificationlistitem.h @@ -79,7 +79,7 @@ public: std::string& getNotificationName() { return mNotificationName; } // handlers - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); virtual void onMouseEnter(S32 x, S32 y, MASK mask); virtual void onMouseLeave(S32 x, S32 y, MASK mask); @@ -92,8 +92,8 @@ public: boost::signals2::connection setOnItemClickCallback(item_callback_t cb) { return mOnItemClick.connect(cb); } virtual bool showPopup() { return true; } - void setExpanded(BOOL value); - virtual BOOL postBuild(); + void setExpanded(bool value); + virtual bool postBuild(); void reshapeNotification(); typedef enum e_time_type @@ -138,7 +138,7 @@ class LLGroupNotificationListItem { public: virtual ~LLGroupNotificationListItem(); - virtual BOOL postBuild(); + virtual bool postBuild(); void setGroupId(const LLUUID& value); // LLGroupMgrObserver observer trigger @@ -168,7 +168,7 @@ class LLGroupInviteNotificationListItem { public: static std::set<std::string> getTypes(); - virtual BOOL postBuild(); + virtual bool postBuild(); /*virtual*/ bool showPopup() { return false; } @@ -195,7 +195,7 @@ class LLGroupNoticeNotificationListItem { public: static std::set<std::string> getTypes(); - virtual BOOL postBuild(); + virtual bool postBuild(); /*virtual*/ bool showPopup() { return false; } @@ -222,7 +222,7 @@ class LLTransactionNotificationListItem : public LLNotificationListItem { public: static std::set<std::string> getTypes(); - virtual BOOL postBuild(); + virtual bool postBuild(); private: friend class LLNotificationListItem; LLTransactionNotificationListItem(const Params& p); @@ -235,7 +235,7 @@ private: class LLSystemNotificationListItem : public LLNotificationListItem { public: - virtual BOOL postBuild(); + virtual bool postBuild(); private: friend class LLNotificationListItem; LLSystemNotificationListItem(const Params& p); diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp index fd2fa90b8c..b65da28bda 100644 --- a/indra/newview/llnotificationofferhandler.cpp +++ b/indra/newview/llnotificationofferhandler.cpp @@ -69,20 +69,19 @@ void LLOfferHandler::initChannel() //-------------------------------------------------------------------------- bool LLOfferHandler::processNotification(const LLNotificationPtr& notification, bool should_log) { - if(mChannel.isDead()) + if (mChannel.isDead()) { return false; } // arrange a channel on a screen - if(!mChannel.get()->getVisible()) + if (!mChannel.get()->getVisible()) { initChannel(); } - - if( notification->getPayload().has("give_inventory_notification") - && notification->getPayload()["give_inventory_notification"].asBoolean() == false) + if (notification->getPayload().has("give_inventory_notification") && + !notification->getPayload()["give_inventory_notification"].asBoolean()) { // This is an original inventory offer, so add a script floater LLScriptFloaterManager::instance().onAddNotification(notification->getID()); diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index 0b127b1b93..96be917019 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -105,9 +105,9 @@ const LLOutfitGallery::Params& LLOutfitGallery::getDefaultParams() return LLUICtrlFactory::getDefaultParams<LLOutfitGallery>(); } -BOOL LLOutfitGallery::postBuild() +bool LLOutfitGallery::postBuild() { - BOOL rv = LLOutfitListBase::postBuild(); + bool rv = LLOutfitListBase::postBuild(); mScrollPanel = getChild<LLScrollContainer>("gallery_scroll_panel"); LLPanel::Params params = LLPanel::getDefaultParams(); // Don't parse XML when creating dummy LLPanel mGalleryPanel = LLUICtrlFactory::create<LLPanel>(params); @@ -123,7 +123,7 @@ void LLOutfitGallery::onOpen(const LLSD& info) { uuid_vec_t cats; getCurrentCategories(cats); - int n = cats.size(); + int n = static_cast<int>(cats.size()); buildGalleryPanel(n); mScrollPanel->addChild(mGalleryPanel); for (int i = 0; i < n; i++) @@ -144,9 +144,9 @@ void LLOutfitGallery::draw() } } -BOOL LLOutfitGallery::handleKeyHere(KEY key, MASK mask) +bool LLOutfitGallery::handleKeyHere(KEY key, MASK mask) { - BOOL handled = FALSE; + bool handled = false; switch (key) { case KEY_RETURN: @@ -156,7 +156,7 @@ BOOL LLOutfitGallery::handleKeyHere(KEY key, MASK mask) // Or should it wearSelectedOutfit? getSelectedItem()->openOutfitsContent(); } - handled = TRUE; + handled = true; break; case KEY_DELETE: #if LL_DARWIN @@ -168,12 +168,12 @@ BOOL LLOutfitGallery::handleKeyHere(KEY key, MASK mask) { onRemoveOutfit(mSelectedOutfitUUID); } - handled = TRUE; + handled = true; break; case KEY_F2: LLAppearanceMgr::instance().renameOutfit(mSelectedOutfitUUID); - handled = TRUE; + handled = true; break; case KEY_PAGE_UP: @@ -181,7 +181,7 @@ BOOL LLOutfitGallery::handleKeyHere(KEY key, MASK mask) { mScrollPanel->pageUp(30); } - handled = TRUE; + handled = true; break; case KEY_PAGE_DOWN: @@ -189,7 +189,7 @@ BOOL LLOutfitGallery::handleKeyHere(KEY key, MASK mask) { mScrollPanel->pageDown(30); } - handled = TRUE; + handled = true; break; case KEY_HOME: @@ -197,7 +197,7 @@ BOOL LLOutfitGallery::handleKeyHere(KEY key, MASK mask) { mScrollPanel->goToTop(); } - handled = TRUE; + handled = true; break; case KEY_END: @@ -205,27 +205,27 @@ BOOL LLOutfitGallery::handleKeyHere(KEY key, MASK mask) { mScrollPanel->goToBottom(); } - handled = TRUE; + handled = true; break; case KEY_LEFT: moveLeft(); - handled = TRUE; + handled = true; break; case KEY_RIGHT: moveRight(); - handled = TRUE; + handled = true; break; case KEY_UP: moveUp(); - handled = TRUE; + handled = true; break; case KEY_DOWN: moveDown(); - handled = TRUE; + handled = true; break; default: @@ -254,7 +254,7 @@ void LLOutfitGallery::moveUp() item = mIndexToItemMap[n]; LLUUID item_id = item->getUUID(); ChangeOutfitSelection(nullptr, item_id); - item->setFocus(TRUE); + item->setFocus(true); scrollToShowItem(mSelectedOutfitUUID); } @@ -276,7 +276,7 @@ void LLOutfitGallery::moveDown() item = mIndexToItemMap[n]; LLUUID item_id = item->getUUID(); ChangeOutfitSelection(nullptr, item_id); - item->setFocus(TRUE); + item->setFocus(true); scrollToShowItem(mSelectedOutfitUUID); } @@ -301,7 +301,7 @@ void LLOutfitGallery::moveLeft() item = mIndexToItemMap[n]; LLUUID item_id = item->getUUID(); ChangeOutfitSelection(nullptr, item_id); - item->setFocus(TRUE); + item->setFocus(true); scrollToShowItem(mSelectedOutfitUUID); } @@ -324,7 +324,7 @@ void LLOutfitGallery::moveRight() item = mIndexToItemMap[n]; LLUUID item_id = item->getUUID(); ChangeOutfitSelection(nullptr, item_id); - item->setFocus(TRUE); + item->setFocus(true); scrollToShowItem(mSelectedOutfitUUID); } @@ -601,8 +601,8 @@ void LLOutfitGallery::removeFromGalleryMiddle(LLOutfitGalleryItem* item) removeFromGalleryLast(mItems[i]); } removeFromGalleryLast(mItems[n]); - int saved_count = saved.size(); - for (int i = 0; i < saved_count; i++) + auto saved_count = saved.size(); + for (size_t i = 0; i < saved_count; i++) { addToGallery(saved.back()); saved.pop_back(); @@ -860,11 +860,11 @@ void LLOutfitGallery::onChangeOutfitSelection(LLWearableItemsList* list, const L return; if (mOutfitMap[mSelectedOutfitUUID]) { - mOutfitMap[mSelectedOutfitUUID]->setSelected(FALSE); + mOutfitMap[mSelectedOutfitUUID]->setSelected(false); } if (mOutfitMap[category_id]) { - mOutfitMap[category_id]->setSelected(TRUE); + mOutfitMap[category_id]->setSelected(true); } // mSelectedOutfitUUID will be set in LLOutfitListBase::ChangeOutfitSelection } @@ -897,15 +897,15 @@ void LLOutfitGallery::updateMessageVisibility() { if (mItems.empty()) { - mMessageTextBox->setVisible(TRUE); - mScrollPanel->setVisible(FALSE); + mMessageTextBox->setVisible(true); + mScrollPanel->setVisible(false); std::string message = getString(getFilterSubString().empty() ? "no_outfits_msg" : "no_matched_outfits_msg"); mMessageTextBox->setValue(message); } else { - mScrollPanel->setVisible(TRUE); - mMessageTextBox->setVisible(FALSE); + mScrollPanel->setVisible(true); + mMessageTextBox->setVisible(false); } } @@ -934,7 +934,7 @@ LLOutfitGalleryItem::~LLOutfitGalleryItem() } -BOOL LLOutfitGalleryItem::postBuild() +bool LLOutfitGalleryItem::postBuild() { setDefaultImage(); @@ -943,7 +943,7 @@ BOOL LLOutfitGalleryItem::postBuild() mTextBgPanel = getChild<LLPanel>("text_bg_panel"); setOutfitWorn(false); mHidden = false; - return TRUE; + return true; } void LLOutfitGalleryItem::draw() @@ -954,7 +954,7 @@ void LLOutfitGalleryItem::draw() LLUIColor border_color = LLUIColorTable::instance().getColor(mSelected ? "OutfitGalleryItemSelected" : "OutfitGalleryItemUnselected", LLColor4::white); LLRect border = getChildView("preview_outfit")->getRect(); border.mRight = border.mRight + 1; - gl_rect_2d(border, border_color.get(), FALSE); + gl_rect_2d(border, border_color.get(), false); // If the floater is focused, don't apply its alpha to the texture (STORM-677). const F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency(); @@ -1010,31 +1010,31 @@ void LLOutfitGalleryItem::setSelected(bool value) setOutfitWorn(mWorn); } -BOOL LLOutfitGalleryItem::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLOutfitGalleryItem::handleMouseDown(S32 x, S32 y, MASK mask) { - setFocus(TRUE); + setFocus(true); return LLUICtrl::handleMouseDown(x, y, mask); } -BOOL LLOutfitGalleryItem::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLOutfitGalleryItem::handleRightMouseDown(S32 x, S32 y, MASK mask) { - setFocus(TRUE); + setFocus(true); return LLUICtrl::handleRightMouseDown(x, y, mask); } -BOOL LLOutfitGalleryItem::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLOutfitGalleryItem::handleDoubleClick(S32 x, S32 y, MASK mask) { return openOutfitsContent() || LLPanel::handleDoubleClick(x, y, mask); } -BOOL LLOutfitGalleryItem::handleKeyHere(KEY key, MASK mask) +bool LLOutfitGalleryItem::handleKeyHere(KEY key, MASK mask) { if (!mGallery) { - return FALSE; + return false; } - BOOL handled = FALSE; + bool handled = false; switch (key) { case KEY_LEFT: @@ -1110,7 +1110,7 @@ bool LLOutfitGalleryItem::setImageAssetId(LLUUID image_asset_id) { mImageAssetId = image_asset_id; mTexturep = texture; - getChildView("preview_outfit")->setVisible(FALSE); + getChildView("preview_outfit")->setVisible(false); mDefaultImage = false; mImageUpdatePending = (texture->getDiscardLevel() == -1); return true; @@ -1127,7 +1127,7 @@ void LLOutfitGalleryItem::setDefaultImage() { mTexturep = NULL; mImageAssetId.setNull(); - getChildView("preview_outfit")->setVisible(TRUE); + getChildView("preview_outfit")->setVisible(true); mDefaultImage = true; mImageUpdatePending = false; } @@ -1187,10 +1187,11 @@ void LLOutfitGalleryGearMenu::onUpdateItemsVisibility() { if (!mMenu) return; bool have_selection = getSelectedOutfitID().notNull(); - mMenu->setItemVisible("expand", FALSE); - mMenu->setItemVisible("collapse", FALSE); + mMenu->setItemVisible("expand", false); + mMenu->setItemVisible("collapse", false); mMenu->setItemVisible("thumbnail", have_selection); - mMenu->setItemVisible("sort_folders_by_name", TRUE); + mMenu->setItemVisible("sepatator3", true); + mMenu->setItemVisible("sort_folders_by_name", true); LLOutfitListGearMenuBase::onUpdateItemsVisibility(); } @@ -1278,7 +1279,7 @@ void LLOutfitGallery::refreshOutfit(const LLUUID& category_id) LLFloater* appearance_floater = LLFloaterReg::getInstance("appearance"); if (appearance_floater) { - appearance_floater->setFocus(TRUE); + appearance_floater->setFocus(true); } } if (item_name == LLAppearanceMgr::sExpectedTextureName) diff --git a/indra/newview/lloutfitgallery.h b/indra/newview/lloutfitgallery.h index 97a902ce6a..d921a7fe72 100644 --- a/indra/newview/lloutfitgallery.h +++ b/indra/newview/lloutfitgallery.h @@ -71,10 +71,10 @@ public: LLOutfitGallery(const LLOutfitGallery::Params& params = getDefaultParams()); virtual ~LLOutfitGallery(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void onOpen(const LLSD& info); /*virtual*/ void draw(); - /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); + /*virtual*/ bool handleKeyHere(KEY key, MASK mask); void moveUp(); void moveDown(); void moveLeft(); @@ -100,7 +100,7 @@ public: /*virtual*/ bool hasItemSelected(); /*virtual*/ bool canWearSelected(); - /*virtual*/ bool getHasExpandableFolders() { return FALSE; } + /*virtual*/ bool getHasExpandableFolders() { return false; } void updateMessageVisibility(); bool hasDefaultImage(const LLUUID& outfit_cat_id); @@ -226,12 +226,12 @@ public: LLOutfitGalleryItem(const Params& p); virtual ~LLOutfitGalleryItem(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void draw(); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleRightMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleDoubleClick(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleKeyHere(KEY key, MASK mask); /*virtual*/ void onFocusLost(); /*virtual*/ void onFocusReceived(); diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 84e646a93a..0f5f7aebf8 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -110,7 +110,7 @@ LLOutfitsList::~LLOutfitsList() { } -BOOL LLOutfitsList::postBuild() +bool LLOutfitsList::postBuild() { mAccordion = getChild<LLAccordionCtrl>("outfits_accordion"); mAccordion->setComparator(&OUTFIT_TAB_NAME_COMPARATOR); @@ -279,11 +279,11 @@ void LLOutfitListBase::performAction(std::string action) if ("replaceoutfit" == action) { - LLAppearanceMgr::instance().wearInventoryCategory( cat, FALSE, FALSE ); + LLAppearanceMgr::instance().wearInventoryCategory( cat, false, false ); } else if ("addtooutfit" == action) { - LLAppearanceMgr::instance().wearInventoryCategory( cat, FALSE, TRUE ); + LLAppearanceMgr::instance().wearInventoryCategory( cat, false, true ); } else if ("rename_outfit" == action) { @@ -305,7 +305,7 @@ void LLOutfitsList::onSetSelectedOutfitByUUID(const LLUUID& outfit_uuid) LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView()); if (!list) continue; - tab->setFocus(TRUE); + tab->setFocus(true); ChangeOutfitSelection(list, outfit_uuid); tab->changeOpenClose(false); @@ -376,7 +376,7 @@ void LLOutfitsList::getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const uuid_vec_t uuids; (*iter).second->getSelectedUUIDs(uuids); - S32 prev_size = selected_uuids.size(); + auto prev_size = selected_uuids.size(); selected_uuids.resize(prev_size + uuids.size()); std::copy(uuids.begin(), uuids.end(), selected_uuids.begin() + prev_size); } @@ -443,7 +443,7 @@ void LLOutfitsList::resetItemSelection(LLWearableItemsList* list, const LLUUID& void LLOutfitsList::onChangeOutfitSelection(LLWearableItemsList* list, const LLUUID& category_id) { - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); // Reset selection in all previously selected tabs except for the current // if new selection is started. @@ -536,7 +536,7 @@ void LLOutfitsList::onFilterSubStringChanged(const std::string& new_string, cons } else { - tab->setVisible(TRUE); + tab->setVisible(true); // Restore tab title when filter is empty tab->setTitle(tab->getTitle()); @@ -729,7 +729,7 @@ void LLOutfitsList::onOutfitRightClick(LLUICtrl* ctrl, S32 x, S32 y, const LLUUI LLUICtrl* header = tab->findChild<LLUICtrl>("dd_header"); if (header) { - header->setFocus(TRUE); + header->setFocus(true); } uuid_vec_t selected_uuids; @@ -924,13 +924,13 @@ void LLOutfitListBase::onIdleRefreshList() if (cat) { std::string name = cat->getName(); - updateChangedCategoryName(cat, name); + updateChangedCategoryName(cat, name); + } curent_time = LLTimer::getTotalSeconds(); if (curent_time >= end_time) return; } - } sortOutfits(); highlightBaseOutfit(); @@ -1020,7 +1020,7 @@ void LLOutfitListBase::ChangeOutfitSelection(LLWearableItemsList* list, const LL signalSelectionOutfitUUID(category_id); } -BOOL LLOutfitListBase::postBuild() +bool LLOutfitListBase::postBuild() { mGearMenu = createGearMenu(); @@ -1028,7 +1028,7 @@ BOOL LLOutfitListBase::postBuild() menu_gear_btn->setMouseDownCallback(boost::bind(&LLOutfitListGearMenuBase::updateItemsVisibility, mGearMenu)); menu_gear_btn->setMenu(mGearMenu->getMenu()); - return TRUE; + return true; } void LLOutfitListBase::collapseAllFolders() @@ -1232,7 +1232,7 @@ void LLOutfitListGearMenuBase::onWear() if (selected_outfit) { LLAppearanceMgr::instance().wearInventoryCategory( - selected_outfit, /*copy=*/ FALSE, /*append=*/ FALSE); + selected_outfit, /*copy=*/ false, /*append=*/ false); } } @@ -1338,14 +1338,15 @@ LLOutfitListGearMenu::~LLOutfitListGearMenu() void LLOutfitListGearMenu::onUpdateItemsVisibility() { if (!mMenu) return; - mMenu->setItemVisible("expand", TRUE); - mMenu->setItemVisible("collapse", TRUE); + mMenu->setItemVisible("expand", true); + mMenu->setItemVisible("collapse", true); mMenu->setItemVisible("thumbnail", getSelectedOutfitID().notNull()); - mMenu->setItemVisible("sort_folders_by_name", FALSE); + mMenu->setItemVisible("sepatator3", false); + mMenu->setItemVisible("sort_folders_by_name", false); LLOutfitListGearMenuBase::onUpdateItemsVisibility(); } -BOOL LLOutfitAccordionCtrlTab::handleToolTip(S32 x, S32 y, MASK mask) +bool LLOutfitAccordionCtrlTab::handleToolTip(S32 x, S32 y, MASK mask) { if (y >= getLocalRect().getHeight() - getHeaderHeight()) { @@ -1360,7 +1361,7 @@ BOOL LLOutfitAccordionCtrlTab::handleToolTip(S32 x, S32 y, MASK mask) .delay_time(LLView::getTooltipTimeout()) .create_callback(boost::bind(&LLInspectTextureUtil::createInventoryToolTip, _1)) .create_params(params)); - return TRUE; + return true; } return LLAccordionCtrlTab::handleToolTip(x, y, mask); diff --git a/indra/newview/lloutfitslist.h b/indra/newview/lloutfitslist.h index 11512b6731..f581b419d9 100644 --- a/indra/newview/lloutfitslist.h +++ b/indra/newview/lloutfitslist.h @@ -70,7 +70,7 @@ public: LLOutfitListBase(); virtual ~LLOutfitListBase(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void onOpen(const LLSD& info); void refreshList(const LLUUID& category_id); @@ -221,7 +221,7 @@ public: Params() : cat_id("cat_id") {} }; - virtual BOOL handleToolTip(S32 x, S32 y, MASK mask); + virtual bool handleToolTip(S32 x, S32 y, MASK mask); protected: LLOutfitAccordionCtrlTab(const LLOutfitAccordionCtrlTab::Params &p) @@ -248,7 +248,7 @@ public: LLOutfitsList(); virtual ~LLOutfitsList(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void onOpen(const LLSD& info); @@ -285,7 +285,7 @@ public: */ void onExpandAllFolders(); - /*virtual*/ bool getHasExpandableFolders() { return TRUE; } + /*virtual*/ bool getHasExpandableFolders() { return true; } protected: LLOutfitListGearMenuBase* createGearMenu(); diff --git a/indra/newview/lloutputmonitorctrl.cpp b/indra/newview/lloutputmonitorctrl.cpp index db43c57139..e6421d8a41 100644 --- a/indra/newview/lloutputmonitorctrl.cpp +++ b/indra/newview/lloutputmonitorctrl.cpp @@ -231,7 +231,7 @@ void LLOutputMonitorCtrl::draw() // } // // Draw rectangle filled with the color. - // gl_rect_2d(xpos, recttop, xpos+rectw, rectbtm, rect_color, TRUE); + // gl_rect_2d(xpos, recttop, xpos+rectw, rectbtm, rect_color, true); // xpos += period; //} @@ -239,11 +239,11 @@ void LLOutputMonitorCtrl::draw() // Draw bounding box. // if(mBorder) - gl_rect_2d(0, monh, monw, 0, sColorBound, FALSE); + gl_rect_2d(0, monh, monw, 0, sColorBound, false); } // virtual -BOOL LLOutputMonitorCtrl::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLOutputMonitorCtrl::handleMouseUp(S32 x, S32 y, MASK mask) { if (mSpeakerId != gAgentID) { @@ -254,7 +254,7 @@ BOOL LLOutputMonitorCtrl::handleMouseUp(S32 x, S32 y, MASK mask) LLFloaterReg::showInstance("chat_voice", LLSD()); } - return TRUE; + return true; } void LLOutputMonitorCtrl::setIsActiveChannel(bool val) @@ -267,8 +267,8 @@ void LLOutputMonitorCtrl::setChannelState(EChannelState state) mChannelState = state; if (state == INACTIVE_CHANNEL) { - // switchIndicator will set it to TRUE when channel becomes active - setVisible(FALSE); + // switchIndicator will set it to true when channel becomes active + setVisible(false); } } @@ -325,7 +325,7 @@ void LLOutputMonitorCtrl::onChangeDetailed(const LLMute& mute) // virtual void LLOutputMonitorCtrl::switchIndicator(bool switch_on) { - if ((mChannelState != INACTIVE_CHANNEL) && (getVisible() != (BOOL)switch_on)) + if ((mChannelState != INACTIVE_CHANNEL) && (getVisible() != (bool)switch_on)) { setVisible(switch_on); diff --git a/indra/newview/lloutputmonitorctrl.h b/indra/newview/lloutputmonitorctrl.h index eefe9800aa..f104bab355 100644 --- a/indra/newview/lloutputmonitorctrl.h +++ b/indra/newview/lloutputmonitorctrl.h @@ -68,7 +68,7 @@ public: // llview overrides virtual void draw(); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); void setPower(F32 val); F32 getPower(F32 val) const { return mPower; } diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 3f2dc5a415..0e72771bd8 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -39,12 +39,7 @@ LLProfileDropTarget::LLProfileDropTarget(const LLProfileDropTarget::Params& p) mAgentID(p.agent_id) {} -void LLProfileDropTarget::doDrop(EDragAndDropType cargo_type, void* cargo_data) -{ - LL_INFOS() << "LLProfileDropTarget::doDrop()" << LL_ENDL; -} - -BOOL LLProfileDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +bool LLProfileDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -55,10 +50,10 @@ BOOL LLProfileDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, LLToolDragAndDrop::handleGiveDragAndDrop(mAgentID, LLUUID::null, drop, cargo_type, cargo_data, accept); - return TRUE; + return true; } - return FALSE; + return false; } static LLDefaultChildRegistry::Register<LLProfileDropTarget> r("profile_drop_target"); diff --git a/indra/newview/llpanelavatar.h b/indra/newview/llpanelavatar.h index ec620b39e1..1b89399771 100644 --- a/indra/newview/llpanelavatar.h +++ b/indra/newview/llpanelavatar.h @@ -59,11 +59,9 @@ public: LLProfileDropTarget(const Params&); ~LLProfileDropTarget() {} - void doDrop(EDragAndDropType cargo_type, void* cargo_data); - // // LLView functionality - virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + virtual bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -97,7 +95,7 @@ public: /** * Sends update data request to server. */ - virtual void updateData(){}; + virtual void updateData() {}; /** * Clears panel data if viewing avatar info for first time and sends update data request. diff --git a/indra/newview/llpanelavatartag.cpp b/indra/newview/llpanelavatartag.cpp index 2c11364dcc..124645e3f9 100644 --- a/indra/newview/llpanelavatartag.cpp +++ b/indra/newview/llpanelavatartag.cpp @@ -48,12 +48,12 @@ LLPanelAvatarTag::~LLPanelAvatarTag() // Name callbacks will be automatically disconnected since LLPanel is trackable } -BOOL LLPanelAvatarTag::postBuild() +bool LLPanelAvatarTag::postBuild() { mIcon = getChild<LLAvatarIconCtrl>("avatar_tag_icon"); mName = getChild<LLTextBox>("sender_tag_name"); mTime = getChild<LLTextBox>("tag_time"); - return TRUE; + return true; } void LLPanelAvatarTag::draw() @@ -89,10 +89,10 @@ boost::signals2::connection LLPanelAvatarTag::setLeftButtonClickCallback( return setCommitCallback(cb); } -BOOL LLPanelAvatarTag::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLPanelAvatarTag::handleMouseDown(S32 x, S32 y, MASK mask) { onCommit(); - return TRUE; + return true; } void LLPanelAvatarTag::onClick() diff --git a/indra/newview/llpanelavatartag.h b/indra/newview/llpanelavatartag.h index a14b7e9dd2..fbc50386a6 100644 --- a/indra/newview/llpanelavatartag.h +++ b/indra/newview/llpanelavatartag.h @@ -57,12 +57,12 @@ public: const LLUUID& getAvatarId() const { return mAvatarId; } - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void draw(); virtual boost::signals2::connection setLeftButtonClickCallback( const commit_callback_t& cb); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); void onClick(); private: @@ -75,7 +75,7 @@ private: const LLUUID& id, const std::string& first, const std::string& last, - BOOL is_group); + bool is_group); LLAvatarIconCtrl* mIcon; /// status tracking avatar icon LLTextBox* mName; /// displays avatar name diff --git a/indra/newview/llpanelblockedlist.cpp b/indra/newview/llpanelblockedlist.cpp index 5cc567395c..0de22fce25 100644 --- a/indra/newview/llpanelblockedlist.cpp +++ b/indra/newview/llpanelblockedlist.cpp @@ -74,10 +74,10 @@ void LLPanelBlockedList::removePicker() } } -BOOL LLPanelBlockedList::postBuild() +bool LLPanelBlockedList::postBuild() { mBlockedList = getChild<LLBlockList>("blocked"); - mBlockedList->setCommitOnSelectionChange(TRUE); + mBlockedList->setCommitOnSelectionChange(true); this->setVisibleCallback(boost::bind(&LLPanelBlockedList::removePicker, this)); switch (gSavedSettings.getU32("BlockPeopleSortOrder")) @@ -181,7 +181,7 @@ void LLPanelBlockedList::onCustomAction(const LLSD& userdata) } } -BOOL LLPanelBlockedList::isActionChecked(const LLSD& userdata) +bool LLPanelBlockedList::isActionChecked(const LLSD& userdata) { std::string item = userdata.asString(); U32 sort_order = gSavedSettings.getU32("BlockPeopleSortOrder"); @@ -200,13 +200,13 @@ BOOL LLPanelBlockedList::isActionChecked(const LLSD& userdata) void LLPanelBlockedList::blockResidentByName() { - const BOOL allow_multiple = FALSE; - const BOOL close_on_select = TRUE; + const bool allow_multiple = false; + const bool close_on_select = true; - LLView * button = findChild<LLButton>("plus_btn", TRUE); + LLView * button = findChild<LLButton>("plus_btn", true); LLFloater* root_floater = gFloaterView->getParentFloater(this); LLFloaterAvatarPicker * picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelBlockedList::callbackBlockPicked, this, _1, _2), - allow_multiple, close_on_select, FALSE, root_floater->getName(), button); + allow_multiple, close_on_select, false, root_floater->getName(), button); if (root_floater) { @@ -243,7 +243,7 @@ void LLPanelBlockedList::callbackBlockByName(const std::string& text) if (text.empty()) return; LLMute mute(LLUUID::null, text, LLMute::BY_NAME); - BOOL success = LLMuteList::getInstance()->add(mute); + bool success = LLMuteList::getInstance()->add(mute); if (!success) { LLNotificationsUtil::add("MuteByNameFailed"); @@ -267,7 +267,7 @@ LLFloaterGetBlockedObjectName::~LLFloaterGetBlockedObjectName() gFocusMgr.releaseFocusIfNeeded( this ); } -BOOL LLFloaterGetBlockedObjectName::postBuild() +bool LLFloaterGetBlockedObjectName::postBuild() { getChild<LLButton>("OK")-> setCommitCallback(boost::bind(&LLFloaterGetBlockedObjectName::applyBlocking, this)); getChild<LLButton>("Cancel")-> setCommitCallback(boost::bind(&LLFloaterGetBlockedObjectName::cancelBlocking, this)); @@ -276,17 +276,17 @@ BOOL LLFloaterGetBlockedObjectName::postBuild() return LLFloater::postBuild(); } -BOOL LLFloaterGetBlockedObjectName::handleKeyHere(KEY key, MASK mask) +bool LLFloaterGetBlockedObjectName::handleKeyHere(KEY key, MASK mask) { if (key == KEY_RETURN && mask == MASK_NONE) { applyBlocking(); - return TRUE; + return true; } else if (key == KEY_ESCAPE && mask == MASK_NONE) { cancelBlocking(); - return TRUE; + return true; } return LLFloater::handleKeyHere(key, mask); diff --git a/indra/newview/llpanelblockedlist.h b/indra/newview/llpanelblockedlist.h index 59bdd1b6a6..446f3d4bad 100644 --- a/indra/newview/llpanelblockedlist.h +++ b/indra/newview/llpanelblockedlist.h @@ -40,9 +40,9 @@ public: LLPanelBlockedList(); ~LLPanelBlockedList(){}; - virtual BOOL postBuild(); - virtual void draw(); - virtual void onOpen(const LLSD& key); + bool postBuild() override; + void draw() override; + void onOpen(const LLSD& key) override; void selectBlocked(const LLUUID& id); @@ -72,7 +72,7 @@ private: // List commnads void onCustomAction(const LLSD& userdata); - BOOL isActionChecked(const LLSD& userdata); + bool isActionChecked(const LLSD& userdata); void callbackBlockPicked(const uuid_vec_t& ids, const std::vector<LLAvatarName> names); static void callbackBlockByName(const std::string& text); @@ -92,9 +92,9 @@ class LLFloaterGetBlockedObjectName : public LLFloater public: typedef boost::function<void (const std::string&)> get_object_name_callback_t; - virtual BOOL postBuild(); + bool postBuild() override; - virtual BOOL handleKeyHere(KEY key, MASK mask); + bool handleKeyHere(KEY key, MASK mask) override; static LLFloaterGetBlockedObjectName* show(get_object_name_callback_t callback); diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index 11d1239459..9fe8f39bd6 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -111,7 +111,7 @@ LLPanelClassifiedInfo::~LLPanelClassifiedInfo() } } -BOOL LLPanelClassifiedInfo::postBuild() +bool LLPanelClassifiedInfo::postBuild() { childSetAction("show_on_map_btn", boost::bind(&LLPanelClassifiedInfo::onMapClick, this)); childSetAction("teleport_btn", boost::bind(&LLPanelClassifiedInfo::onTeleportClick, this)); @@ -125,10 +125,10 @@ BOOL LLPanelClassifiedInfo::postBuild() mSnapshotCtrl = getChild<LLTextureCtrl>("classified_snapshot"); mSnapshotRect = getDefaultSnapshotRect(); - return TRUE; + return true; } -void LLPanelClassifiedInfo::reshape(S32 width, S32 height, BOOL called_from_parent /* = TRUE */) +void LLPanelClassifiedInfo::reshape(S32 width, S32 height, bool called_from_parent /* = true */) { LLPanel::reshape(width, height, called_from_parent); @@ -293,8 +293,8 @@ void LLPanelClassifiedInfo::resetData() getChild<LLUICtrl>("auto_renew")->setValue(LLStringUtil::null); getChild<LLUICtrl>("creation_date")->setValue(LLStringUtil::null); getChild<LLUICtrl>("click_through_text")->setValue(LLStringUtil::null); - getChild<LLIconCtrl>("content_type_moderate")->setVisible(FALSE); - getChild<LLIconCtrl>("content_type_general")->setVisible(FALSE); + getChild<LLIconCtrl>("content_type_moderate")->setVisible(false); + getChild<LLIconCtrl>("content_type_general")->setVisible(false); } void LLPanelClassifiedInfo::resetControls() diff --git a/indra/newview/llpanelclassified.h b/indra/newview/llpanelclassified.h index 88346df6c3..266b9d222a 100644 --- a/indra/newview/llpanelclassified.h +++ b/indra/newview/llpanelclassified.h @@ -49,7 +49,7 @@ public: /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void processProperties(void* data, EAvatarProcessorType type); @@ -112,7 +112,7 @@ public: const LLVector3d& global_pos, const std::string& sim_name); - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true); /*virtual*/ void draw(); diff --git a/indra/newview/llpanelcontents.cpp b/indra/newview/llpanelcontents.cpp index 489289e814..7b78ad2934 100644 --- a/indra/newview/llpanelcontents.cpp +++ b/indra/newview/llpanelcontents.cpp @@ -76,16 +76,16 @@ const char* LLPanelContents::PERMS_GROUP_CONTROL_KEY = "perms_group_control"; const char* LLPanelContents::PERMS_ANYONE_INTERACT_KEY = "perms_anyone_interact"; const char* LLPanelContents::PERMS_ANYONE_CONTROL_KEY = "perms_anyone_control"; -BOOL LLPanelContents::postBuild() +bool LLPanelContents::postBuild() { - setMouseOpaque(FALSE); + setMouseOpaque(false); childSetAction("button new script",&LLPanelContents::onClickNewScript, this); childSetAction("button permissions",&LLPanelContents::onClickPermissions, this); mPanelInventoryObject = getChild<LLPanelObjectInventory>("contents_inventory"); - return TRUE; + return true; } LLPanelContents::LLPanelContents() @@ -105,7 +105,7 @@ void LLPanelContents::getState(LLViewerObject *objectp ) { if( !objectp ) { - getChildView("button new script")->setEnabled(FALSE); + getChildView("button new script")->setEnabled(false); return; } @@ -116,7 +116,7 @@ void LLPanelContents::getState(LLViewerObject *objectp ) bool editable = gAgent.isGodlike() || (objectp->permModify() && !objectp->isPermanentEnforced() && ( objectp->permYouOwner() || ( !group_id.isNull() && gAgent.isInGroup(group_id) ))); // solves SL-23488 - BOOL all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ); + bool all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ); // Edit script button - ok if object is editable and there's an unambiguous destination for the object. getChildView("button new script")->setEnabled( @@ -131,7 +131,7 @@ void LLPanelContents::getState(LLViewerObject *objectp ) void LLPanelContents::refresh() { - const BOOL children_ok = TRUE; + const bool children_ok = true; LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(children_ok); getState(object); @@ -157,7 +157,7 @@ void LLPanelContents::clearContents() // static void LLPanelContents::onClickNewScript(void *userdata) { - const BOOL children_ok = TRUE; + const bool children_ok = true; LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(children_ok); if(object) { @@ -186,7 +186,7 @@ void LLPanelContents::onClickNewScript(void *userdata) LLSaleInfo::DEFAULT, LLInventoryItemFlags::II_FLAGS_NONE, time_corrected()); - object->saveScript(new_item, TRUE, true); + object->saveScript(new_item, true, true); std::string name = new_item->getName(); diff --git a/indra/newview/llpanelcontents.h b/indra/newview/llpanelcontents.h index 70e9b092cb..748bb76a82 100644 --- a/indra/newview/llpanelcontents.h +++ b/indra/newview/llpanelcontents.h @@ -43,7 +43,7 @@ class LLSpinCtrl; class LLPanelContents : public LLPanel { public: - virtual BOOL postBuild(); + virtual bool postBuild(); LLPanelContents(); virtual ~LLPanelContents(); diff --git a/indra/newview/llpaneleditsky.cpp b/indra/newview/llpaneleditsky.cpp index 75d1b46e57..5255b3763c 100644 --- a/indra/newview/llpaneleditsky.cpp +++ b/indra/newview/llpaneleditsky.cpp @@ -139,7 +139,7 @@ LLPanelSettingsSkyAtmosTab::LLPanelSettingsSkyAtmosTab() : } -BOOL LLPanelSettingsSkyAtmosTab::postBuild() +bool LLPanelSettingsSkyAtmosTab::postBuild() { getChild<LLUICtrl>(FIELD_SKY_AMBIENT_LIGHT)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onAmbientLightChanged(); }); getChild<LLUICtrl>(FIELD_SKY_BLUE_HORIZON)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onBlueHorizonChanged(); }); @@ -156,11 +156,11 @@ BOOL LLPanelSettingsSkyAtmosTab::postBuild() getChild<LLUICtrl>(FIELD_REFLECTION_PROBE_AMBIANCE)->setCommitCallback([this](LLUICtrl*, const LLSD&) { onReflectionProbeAmbianceChanged(); }); refresh(); - return TRUE; + return true; } //virtual -void LLPanelSettingsSkyAtmosTab::setEnabled(BOOL enabled) +void LLPanelSettingsSkyAtmosTab::setEnabled(bool enabled) { LLPanelSettingsSky::setEnabled(enabled); @@ -184,8 +184,8 @@ void LLPanelSettingsSkyAtmosTab::refresh() { if (!mSkySettings) { - setAllChildrenEnabled(FALSE); - setEnabled(FALSE); + setAllChildrenEnabled(false); + setEnabled(false); return; } @@ -357,7 +357,7 @@ LLPanelSettingsSkyCloudTab::LLPanelSettingsSkyCloudTab() : { } -BOOL LLPanelSettingsSkyCloudTab::postBuild() +bool LLPanelSettingsSkyCloudTab::postBuild() { getChild<LLUICtrl>(FIELD_SKY_CLOUD_COLOR)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudColorChanged(); }); getChild<LLUICtrl>(FIELD_SKY_CLOUD_COVERAGE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudCoverageChanged(); }); @@ -367,7 +367,7 @@ BOOL LLPanelSettingsSkyCloudTab::postBuild() getChild<LLUICtrl>(FIELD_SKY_CLOUD_SCROLL_XY)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudScrollChanged(); }); getChild<LLTextureCtrl>(FIELD_SKY_CLOUD_MAP)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudMapChanged(); }); getChild<LLTextureCtrl>(FIELD_SKY_CLOUD_MAP)->setDefaultImageAssetID(LLSettingsSky::GetDefaultCloudNoiseTextureId()); - getChild<LLTextureCtrl>(FIELD_SKY_CLOUD_MAP)->setAllowNoTexture(TRUE); + getChild<LLTextureCtrl>(FIELD_SKY_CLOUD_MAP)->setAllowNoTexture(true); getChild<LLUICtrl>(FIELD_SKY_CLOUD_DENSITY_X)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudDensityChanged(); }); getChild<LLUICtrl>(FIELD_SKY_CLOUD_DENSITY_Y)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudDensityChanged(); }); @@ -378,11 +378,11 @@ BOOL LLPanelSettingsSkyCloudTab::postBuild() refresh(); - return TRUE; + return true; } //virtual -void LLPanelSettingsSkyCloudTab::setEnabled(BOOL enabled) +void LLPanelSettingsSkyCloudTab::setEnabled(bool enabled) { LLPanelSettingsSky::setEnabled(enabled); @@ -405,8 +405,8 @@ void LLPanelSettingsSkyCloudTab::refresh() { if (!mSkySettings) { - setAllChildrenEnabled(FALSE); - setEnabled(FALSE); + setAllChildrenEnabled(false); + setEnabled(false); return; } @@ -510,7 +510,7 @@ LLPanelSettingsSkySunMoonTab::LLPanelSettingsSkySunMoonTab() : } -BOOL LLPanelSettingsSkySunMoonTab::postBuild() +bool LLPanelSettingsSkySunMoonTab::postBuild() { getChild<LLUICtrl>(FIELD_SKY_SUN_MOON_COLOR)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onSunMoonColorChanged(); }); getChild<LLUICtrl>(FIELD_SKY_GLOW_FOCUS)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onGlowChanged(); }); @@ -523,24 +523,24 @@ BOOL LLPanelSettingsSkySunMoonTab::postBuild() getChild<LLUICtrl>(FIELD_SKY_SUN_SCALE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onSunScaleChanged(); }); getChild<LLTextureCtrl>(FIELD_SKY_SUN_IMAGE)->setBlankImageAssetID(LLSettingsSky::GetBlankSunTextureId()); getChild<LLTextureCtrl>(FIELD_SKY_SUN_IMAGE)->setDefaultImageAssetID(LLSettingsSky::GetBlankSunTextureId()); - getChild<LLTextureCtrl>(FIELD_SKY_SUN_IMAGE)->setAllowNoTexture(TRUE); + getChild<LLTextureCtrl>(FIELD_SKY_SUN_IMAGE)->setAllowNoTexture(true); getChild<LLUICtrl>(FIELD_SKY_MOON_ROTATION)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMoonRotationChanged(); }); getChild<LLUICtrl>(FIELD_SKY_MOON_AZIMUTH)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMoonAzimElevChanged(); }); getChild<LLUICtrl>(FIELD_SKY_MOON_ELEVATION)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMoonAzimElevChanged(); }); getChild<LLUICtrl>(FIELD_SKY_MOON_IMAGE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMoonImageChanged(); }); getChild<LLTextureCtrl>(FIELD_SKY_MOON_IMAGE)->setDefaultImageAssetID(LLSettingsSky::GetDefaultMoonTextureId()); getChild<LLTextureCtrl>(FIELD_SKY_MOON_IMAGE)->setBlankImageAssetID(LLSettingsSky::GetDefaultMoonTextureId()); - getChild<LLTextureCtrl>(FIELD_SKY_MOON_IMAGE)->setAllowNoTexture(TRUE); + getChild<LLTextureCtrl>(FIELD_SKY_MOON_IMAGE)->setAllowNoTexture(true); getChild<LLUICtrl>(FIELD_SKY_MOON_SCALE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMoonScaleChanged(); }); getChild<LLUICtrl>(FIELD_SKY_MOON_BRIGHTNESS)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMoonBrightnessChanged(); }); refresh(); - return TRUE; + return true; } //virtual -void LLPanelSettingsSkySunMoonTab::setEnabled(BOOL enabled) +void LLPanelSettingsSkySunMoonTab::setEnabled(bool enabled) { LLPanelSettingsSky::setEnabled(enabled); @@ -553,8 +553,8 @@ void LLPanelSettingsSkySunMoonTab::setEnabled(BOOL enabled) getChild<LLUICtrl>(FIELD_SKY_SUN_SCALE)->setEnabled(enabled); getChild<LLUICtrl>(FIELD_SKY_MOON_SCALE)->setEnabled(enabled); getChild<LLUICtrl>(FIELD_SKY_MOON_BRIGHTNESS)->setEnabled(enabled); - getChildView(PANEL_SKY_SUN_LAYOUT)->setAllChildrenEnabled(TRUE); - getChildView(PANEL_SKY_MOON_LAYOUT)->setAllChildrenEnabled(TRUE); + getChildView(PANEL_SKY_SUN_LAYOUT)->setAllChildrenEnabled(true); + getChildView(PANEL_SKY_MOON_LAYOUT)->setAllChildrenEnabled(true); } } @@ -562,18 +562,18 @@ void LLPanelSettingsSkySunMoonTab::refresh() { if (!mSkySettings || !getCanChangeSettings()) { - getChildView(PANEL_SKY_SUN_LAYOUT)->setAllChildrenEnabled(FALSE); - getChildView(PANEL_SKY_MOON_LAYOUT)->setAllChildrenEnabled(FALSE); - getChildView(FIELD_SKY_SUN_BEACON)->setEnabled(TRUE); - getChildView(FIELD_SKY_MOON_BEACON)->setEnabled(TRUE); + getChildView(PANEL_SKY_SUN_LAYOUT)->setAllChildrenEnabled(false); + getChildView(PANEL_SKY_MOON_LAYOUT)->setAllChildrenEnabled(false); + getChildView(FIELD_SKY_SUN_BEACON)->setEnabled(true); + getChildView(FIELD_SKY_MOON_BEACON)->setEnabled(true); if (!mSkySettings) return; } else { - setEnabled(TRUE); - setAllChildrenEnabled(TRUE); + setEnabled(true); + setAllChildrenEnabled(true); } getChild<LLColorSwatchCtrl>(FIELD_SKY_SUN_MOON_COLOR)->set(mSkySettings->getSunlightColor() / SLIDER_SCALE_SUN_AMBIENT); @@ -780,7 +780,7 @@ LLPanelSettingsSkyDensityTab::LLPanelSettingsSkyDensityTab() { } -BOOL LLPanelSettingsSkyDensityTab::postBuild() +bool LLPanelSettingsSkyDensityTab::postBuild() { getChild<LLUICtrl>(FIELD_SKY_DENSITY_RAYLEIGH_EXPONENTIAL)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onRayleighExponentialChanged(); }); getChild<LLUICtrl>(FIELD_SKY_DENSITY_RAYLEIGH_EXPONENTIAL_SCALE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onRayleighExponentialScaleChanged(); }); @@ -803,10 +803,10 @@ BOOL LLPanelSettingsSkyDensityTab::postBuild() getChild<LLUICtrl>(FIELD_SKY_DENSITY_ABSORPTION_MAX_ALTITUDE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onAbsorptionMaxAltitudeChanged(); }); refresh(); - return TRUE; + return true; } -void LLPanelSettingsSkyDensityTab::setEnabled(BOOL enabled) +void LLPanelSettingsSkyDensityTab::setEnabled(bool enabled) { LLPanelSettingsSky::setEnabled(enabled); @@ -838,8 +838,8 @@ void LLPanelSettingsSkyDensityTab::refresh() { if (!mSkySettings) { - setAllChildrenEnabled(FALSE); - setEnabled(FALSE); + setAllChildrenEnabled(false); + setEnabled(false); return; } diff --git a/indra/newview/llpaneleditsky.h b/indra/newview/llpaneleditsky.h index 05cd866f28..bab606bc8e 100644 --- a/indra/newview/llpaneleditsky.h +++ b/indra/newview/llpaneleditsky.h @@ -60,8 +60,8 @@ class LLPanelSettingsSkyAtmosTab : public LLPanelSettingsSky public: LLPanelSettingsSkyAtmosTab(); - virtual BOOL postBuild() override; - virtual void setEnabled(BOOL enabled) override; + virtual bool postBuild() override; + virtual void setEnabled(bool enabled) override; protected: virtual void refresh() override; @@ -91,8 +91,8 @@ class LLPanelSettingsSkyCloudTab : public LLPanelSettingsSky public: LLPanelSettingsSkyCloudTab(); - virtual BOOL postBuild() override; - void setEnabled(BOOL enabled) override; + virtual bool postBuild() override; + void setEnabled(bool enabled) override; protected: virtual void refresh() override; @@ -115,8 +115,8 @@ class LLPanelSettingsSkySunMoonTab : public LLPanelSettingsSky public: LLPanelSettingsSkySunMoonTab(); - virtual BOOL postBuild() override; - virtual void setEnabled(BOOL enabled) override; + virtual bool postBuild() override; + virtual void setEnabled(bool enabled) override; protected: virtual void refresh() override; @@ -144,8 +144,8 @@ class LLPanelSettingsSkyDensityTab : public LLPanelSettingsSky public: LLPanelSettingsSkyDensityTab(); - virtual BOOL postBuild() override; - virtual void setEnabled(BOOL enabled) override; + virtual bool postBuild() override; + virtual void setEnabled(bool enabled) override; protected: virtual void refresh() override; diff --git a/indra/newview/llpaneleditwater.cpp b/indra/newview/llpaneleditwater.cpp index cf536dd87e..236cb6b97c 100644 --- a/indra/newview/llpaneleditwater.cpp +++ b/indra/newview/llpaneleditwater.cpp @@ -76,7 +76,7 @@ LLPanelSettingsWaterMainTab::LLPanelSettingsWaterMainTab(): } -BOOL LLPanelSettingsWaterMainTab::postBuild() +bool LLPanelSettingsWaterMainTab::postBuild() { mClrFogColor = getChild<LLColorSwatchCtrl>(FIELD_WATER_FOG_COLOR); mTxtNormalMap = getChild<LLTextureCtrl>(FIELD_WATER_NORMAL_MAP); @@ -106,11 +106,11 @@ BOOL LLPanelSettingsWaterMainTab::postBuild() refresh(); - return TRUE; + return true; } //virtual -void LLPanelSettingsWaterMainTab::setEnabled(BOOL enabled) +void LLPanelSettingsWaterMainTab::setEnabled(bool enabled) { LLPanelSettingsWater::setEnabled(enabled); getChild<LLUICtrl>(FIELD_WATER_FOG_DENSITY)->setEnabled(enabled); @@ -132,8 +132,8 @@ void LLPanelSettingsWaterMainTab::refresh() { if (!mWaterSettings) { - setAllChildrenEnabled(FALSE); - setEnabled(FALSE); + setAllChildrenEnabled(false); + setEnabled(false); return; } diff --git a/indra/newview/llpaneleditwater.h b/indra/newview/llpaneleditwater.h index f35a5ce2c2..69034789c4 100644 --- a/indra/newview/llpaneleditwater.h +++ b/indra/newview/llpaneleditwater.h @@ -65,8 +65,8 @@ class LLPanelSettingsWaterMainTab : public LLPanelSettingsWater public: LLPanelSettingsWaterMainTab(); - virtual BOOL postBuild() override; - virtual void setEnabled(BOOL enabled) override; + virtual bool postBuild() override; + virtual void setEnabled(bool enabled) override; protected: virtual void refresh() override; diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index 0c69e68639..a14f1d54a2 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -350,40 +350,40 @@ LLEditWearableDictionary::ColorSwatchCtrls::ColorSwatchCtrls() LLEditWearableDictionary::TextureCtrls::TextureCtrls() { - addEntry(TEX_HEAD_BODYPAINT, new PickerControlEntry(TEX_HEAD_BODYPAINT, "Head", LLUUID::null, TRUE)); - addEntry(TEX_UPPER_BODYPAINT, new PickerControlEntry(TEX_UPPER_BODYPAINT, "Upper Body", LLUUID::null, TRUE)); - addEntry(TEX_LOWER_BODYPAINT, new PickerControlEntry(TEX_LOWER_BODYPAINT, "Lower Body", LLUUID::null, TRUE)); - addEntry(TEX_HAIR, new PickerControlEntry(TEX_HAIR, "Texture", LLUUID(gSavedSettings.getString("UIImgDefaultHairUUID")), FALSE)); - addEntry(TEX_EYES_IRIS, new PickerControlEntry(TEX_EYES_IRIS, "Iris", LLUUID(gSavedSettings.getString("UIImgDefaultEyesUUID")), FALSE)); - addEntry(TEX_UPPER_SHIRT, new PickerControlEntry(TEX_UPPER_SHIRT, "Fabric", LLUUID(gSavedSettings.getString("UIImgDefaultShirtUUID")), FALSE)); - addEntry(TEX_LOWER_PANTS, new PickerControlEntry(TEX_LOWER_PANTS, "Fabric", LLUUID(gSavedSettings.getString("UIImgDefaultPantsUUID")), FALSE)); - addEntry(TEX_LOWER_SHOES, new PickerControlEntry(TEX_LOWER_SHOES, "Fabric", LLUUID(gSavedSettings.getString("UIImgDefaultShoesUUID")), FALSE)); - addEntry(TEX_LOWER_SOCKS, new PickerControlEntry(TEX_LOWER_SOCKS, "Fabric", LLUUID(gSavedSettings.getString("UIImgDefaultSocksUUID")), FALSE)); - addEntry(TEX_UPPER_JACKET, new PickerControlEntry(TEX_UPPER_JACKET, "Upper Fabric", LLUUID(gSavedSettings.getString("UIImgDefaultJacketUUID")), FALSE)); - addEntry(TEX_LOWER_JACKET, new PickerControlEntry(TEX_LOWER_JACKET, "Lower Fabric", LLUUID(gSavedSettings.getString("UIImgDefaultJacketUUID")), FALSE)); - addEntry(TEX_SKIRT, new PickerControlEntry(TEX_SKIRT, "Fabric", LLUUID(gSavedSettings.getString("UIImgDefaultSkirtUUID")), FALSE)); - addEntry(TEX_UPPER_GLOVES, new PickerControlEntry(TEX_UPPER_GLOVES, "Fabric", LLUUID(gSavedSettings.getString("UIImgDefaultGlovesUUID")), FALSE)); - addEntry(TEX_UPPER_UNDERSHIRT, new PickerControlEntry(TEX_UPPER_UNDERSHIRT, "Fabric", LLUUID(gSavedSettings.getString("UIImgDefaultUnderwearUUID")), FALSE)); - addEntry(TEX_LOWER_UNDERPANTS, new PickerControlEntry(TEX_LOWER_UNDERPANTS, "Fabric", LLUUID(gSavedSettings.getString("UIImgDefaultUnderwearUUID")), FALSE)); - addEntry(TEX_LOWER_ALPHA, new PickerControlEntry(TEX_LOWER_ALPHA, "Lower Alpha", LLUUID(gSavedSettings.getString("UIImgDefaultAlphaUUID")), TRUE)); - addEntry(TEX_UPPER_ALPHA, new PickerControlEntry(TEX_UPPER_ALPHA, "Upper Alpha", LLUUID(gSavedSettings.getString("UIImgDefaultAlphaUUID")), TRUE)); - addEntry(TEX_HEAD_ALPHA, new PickerControlEntry(TEX_HEAD_ALPHA, "Head Alpha", LLUUID(gSavedSettings.getString("UIImgDefaultAlphaUUID")), TRUE)); - addEntry(TEX_EYES_ALPHA, new PickerControlEntry(TEX_EYES_ALPHA, "Eye Alpha", LLUUID(gSavedSettings.getString("UIImgDefaultAlphaUUID")), TRUE)); - addEntry(TEX_HAIR_ALPHA, new PickerControlEntry(TEX_HAIR_ALPHA, "Hair Alpha", LLUUID(gSavedSettings.getString("UIImgDefaultAlphaUUID")), TRUE)); - addEntry(TEX_LOWER_TATTOO, new PickerControlEntry(TEX_LOWER_TATTOO, "Lower Tattoo", LLUUID::null, TRUE)); - addEntry(TEX_UPPER_TATTOO, new PickerControlEntry(TEX_UPPER_TATTOO, "Upper Tattoo", LLUUID::null, TRUE)); - addEntry(TEX_HEAD_TATTOO, new PickerControlEntry(TEX_HEAD_TATTOO, "Head Tattoo", LLUUID::null, TRUE)); - addEntry(TEX_LOWER_UNIVERSAL_TATTOO, new PickerControlEntry(TEX_LOWER_UNIVERSAL_TATTOO, "Lower Universal Tattoo", LLUUID::null, TRUE)); - addEntry(TEX_UPPER_UNIVERSAL_TATTOO, new PickerControlEntry(TEX_UPPER_UNIVERSAL_TATTOO, "Upper Universal Tattoo", LLUUID::null, TRUE)); - addEntry(TEX_HEAD_UNIVERSAL_TATTOO, new PickerControlEntry(TEX_HEAD_UNIVERSAL_TATTOO, "Head Universal Tattoo", LLUUID::null, TRUE)); - addEntry(TEX_SKIRT_TATTOO, new PickerControlEntry(TEX_SKIRT_TATTOO, "Skirt Tattoo", LLUUID::null, TRUE)); - addEntry(TEX_HAIR_TATTOO, new PickerControlEntry(TEX_HAIR_TATTOO, "Hair Tattoo", LLUUID::null, TRUE)); - addEntry(TEX_EYES_TATTOO, new PickerControlEntry(TEX_EYES_TATTOO, "Eyes Tattoo", LLUUID::null, TRUE)); - addEntry(TEX_LEFT_ARM_TATTOO, new PickerControlEntry(TEX_LEFT_ARM_TATTOO, "Left Arm Tattoo", LLUUID::null, TRUE)); - addEntry(TEX_LEFT_LEG_TATTOO, new PickerControlEntry(TEX_LEFT_LEG_TATTOO, "Left Leg Tattoo", LLUUID::null, TRUE)); - addEntry(TEX_AUX1_TATTOO, new PickerControlEntry(TEX_AUX1_TATTOO, "Aux1 Tattoo", LLUUID::null, TRUE)); - addEntry(TEX_AUX2_TATTOO, new PickerControlEntry(TEX_AUX2_TATTOO, "Aux2 Tattoo", LLUUID::null, TRUE)); - addEntry(TEX_AUX3_TATTOO, new PickerControlEntry(TEX_AUX3_TATTOO, "Aux3 Tattoo", LLUUID::null, TRUE)); + addEntry(TEX_HEAD_BODYPAINT, new PickerControlEntry(TEX_HEAD_BODYPAINT, "Head", LLUUID::null, true)); + addEntry(TEX_UPPER_BODYPAINT, new PickerControlEntry(TEX_UPPER_BODYPAINT, "Upper Body", LLUUID::null, true)); + addEntry(TEX_LOWER_BODYPAINT, new PickerControlEntry(TEX_LOWER_BODYPAINT, "Lower Body", LLUUID::null, true)); + addEntry(TEX_HAIR, new PickerControlEntry(TEX_HAIR, "Texture", LLUUID(gSavedSettings.getString("UIImgDefaultHairUUID")), false)); + addEntry(TEX_EYES_IRIS, new PickerControlEntry(TEX_EYES_IRIS, "Iris", LLUUID(gSavedSettings.getString("UIImgDefaultEyesUUID")), false)); + addEntry(TEX_UPPER_SHIRT, new PickerControlEntry(TEX_UPPER_SHIRT, "Fabric", LLUUID(gSavedSettings.getString("UIImgDefaultShirtUUID")), false)); + addEntry(TEX_LOWER_PANTS, new PickerControlEntry(TEX_LOWER_PANTS, "Fabric", LLUUID(gSavedSettings.getString("UIImgDefaultPantsUUID")), false)); + addEntry(TEX_LOWER_SHOES, new PickerControlEntry(TEX_LOWER_SHOES, "Fabric", LLUUID(gSavedSettings.getString("UIImgDefaultShoesUUID")), false)); + addEntry(TEX_LOWER_SOCKS, new PickerControlEntry(TEX_LOWER_SOCKS, "Fabric", LLUUID(gSavedSettings.getString("UIImgDefaultSocksUUID")), false)); + addEntry(TEX_UPPER_JACKET, new PickerControlEntry(TEX_UPPER_JACKET, "Upper Fabric", LLUUID(gSavedSettings.getString("UIImgDefaultJacketUUID")), false)); + addEntry(TEX_LOWER_JACKET, new PickerControlEntry(TEX_LOWER_JACKET, "Lower Fabric", LLUUID(gSavedSettings.getString("UIImgDefaultJacketUUID")), false)); + addEntry(TEX_SKIRT, new PickerControlEntry(TEX_SKIRT, "Fabric", LLUUID(gSavedSettings.getString("UIImgDefaultSkirtUUID")), false)); + addEntry(TEX_UPPER_GLOVES, new PickerControlEntry(TEX_UPPER_GLOVES, "Fabric", LLUUID(gSavedSettings.getString("UIImgDefaultGlovesUUID")), false)); + addEntry(TEX_UPPER_UNDERSHIRT, new PickerControlEntry(TEX_UPPER_UNDERSHIRT, "Fabric", LLUUID(gSavedSettings.getString("UIImgDefaultUnderwearUUID")), false)); + addEntry(TEX_LOWER_UNDERPANTS, new PickerControlEntry(TEX_LOWER_UNDERPANTS, "Fabric", LLUUID(gSavedSettings.getString("UIImgDefaultUnderwearUUID")), false)); + addEntry(TEX_LOWER_ALPHA, new PickerControlEntry(TEX_LOWER_ALPHA, "Lower Alpha", LLUUID(gSavedSettings.getString("UIImgDefaultAlphaUUID")), true)); + addEntry(TEX_UPPER_ALPHA, new PickerControlEntry(TEX_UPPER_ALPHA, "Upper Alpha", LLUUID(gSavedSettings.getString("UIImgDefaultAlphaUUID")), true)); + addEntry(TEX_HEAD_ALPHA, new PickerControlEntry(TEX_HEAD_ALPHA, "Head Alpha", LLUUID(gSavedSettings.getString("UIImgDefaultAlphaUUID")), true)); + addEntry(TEX_EYES_ALPHA, new PickerControlEntry(TEX_EYES_ALPHA, "Eye Alpha", LLUUID(gSavedSettings.getString("UIImgDefaultAlphaUUID")), true)); + addEntry(TEX_HAIR_ALPHA, new PickerControlEntry(TEX_HAIR_ALPHA, "Hair Alpha", LLUUID(gSavedSettings.getString("UIImgDefaultAlphaUUID")), true)); + addEntry(TEX_LOWER_TATTOO, new PickerControlEntry(TEX_LOWER_TATTOO, "Lower Tattoo", LLUUID::null, true)); + addEntry(TEX_UPPER_TATTOO, new PickerControlEntry(TEX_UPPER_TATTOO, "Upper Tattoo", LLUUID::null, true)); + addEntry(TEX_HEAD_TATTOO, new PickerControlEntry(TEX_HEAD_TATTOO, "Head Tattoo", LLUUID::null, true)); + addEntry(TEX_LOWER_UNIVERSAL_TATTOO, new PickerControlEntry(TEX_LOWER_UNIVERSAL_TATTOO, "Lower Universal Tattoo", LLUUID::null, true)); + addEntry(TEX_UPPER_UNIVERSAL_TATTOO, new PickerControlEntry(TEX_UPPER_UNIVERSAL_TATTOO, "Upper Universal Tattoo", LLUUID::null, true)); + addEntry(TEX_HEAD_UNIVERSAL_TATTOO, new PickerControlEntry(TEX_HEAD_UNIVERSAL_TATTOO, "Head Universal Tattoo", LLUUID::null, true)); + addEntry(TEX_SKIRT_TATTOO, new PickerControlEntry(TEX_SKIRT_TATTOO, "Skirt Tattoo", LLUUID::null, true)); + addEntry(TEX_HAIR_TATTOO, new PickerControlEntry(TEX_HAIR_TATTOO, "Hair Tattoo", LLUUID::null, true)); + addEntry(TEX_EYES_TATTOO, new PickerControlEntry(TEX_EYES_TATTOO, "Eyes Tattoo", LLUUID::null, true)); + addEntry(TEX_LEFT_ARM_TATTOO, new PickerControlEntry(TEX_LEFT_ARM_TATTOO, "Left Arm Tattoo", LLUUID::null, true)); + addEntry(TEX_LEFT_LEG_TATTOO, new PickerControlEntry(TEX_LEFT_LEG_TATTOO, "Left Leg Tattoo", LLUUID::null, true)); + addEntry(TEX_AUX1_TATTOO, new PickerControlEntry(TEX_AUX1_TATTOO, "Aux1 Tattoo", LLUUID::null, true)); + addEntry(TEX_AUX2_TATTOO, new PickerControlEntry(TEX_AUX2_TATTOO, "Aux2 Tattoo", LLUUID::null, true)); + addEntry(TEX_AUX3_TATTOO, new PickerControlEntry(TEX_AUX3_TATTOO, "Aux3 Tattoo", LLUUID::null, true)); } LLEditWearableDictionary::PickerControlEntry::PickerControlEntry(ETextureIndex tex_index, @@ -657,7 +657,7 @@ bool LLPanelEditWearable::changeHeightUnits(const LLSD& new_value) return true; } -void LLPanelEditWearable::updateMetricLayout(BOOL new_value) +void LLPanelEditWearable::updateMetricLayout(bool new_value) { LLUIString current_metric, replacment_metric; current_metric = new_value ? mMeters : mFeet; @@ -710,7 +710,7 @@ void LLPanelEditWearable::setWearablePanelVisibilityChangeCallback(LLPanel* body } // virtual -BOOL LLPanelEditWearable::postBuild() +bool LLPanelEditWearable::postBuild() { // buttons mBtnRevert = getChild<LLButton>("revert_button"); @@ -825,20 +825,20 @@ BOOL LLPanelEditWearable::postBuild() gSavedSettings.getControl("HeightUnits")->getSignal()->connect(boost::bind(&LLPanelEditWearable::changeHeightUnits, this, _2)); updateMetricLayout(gSavedSettings.getBOOL("HeightUnits")); - return TRUE; + return true; } // virtual // LLUICtrl -BOOL LLPanelEditWearable::isDirty() const +bool LLPanelEditWearable::isDirty() const { - BOOL isDirty = FALSE; + bool isDirty = false; if (mWearablePtr) { if (mWearablePtr->isDirty() || (mWearableItem && mNameEditor && mWearableItem->getName().compare(mNameEditor->getText()) != 0)) { - isDirty = TRUE; + isDirty = true; } } return isDirty; @@ -864,20 +864,20 @@ void LLPanelEditWearable::onClose() revertChanges(); } -void LLPanelEditWearable::setVisible(BOOL visible) +void LLPanelEditWearable::setVisible(bool visible) { if (!visible) { - showWearable(mWearablePtr, FALSE); + showWearable(mWearablePtr, false); } LLPanel::setVisible(visible); } -void LLPanelEditWearable::setWearable(LLViewerWearable *wearable, BOOL disable_camera_switch) +void LLPanelEditWearable::setWearable(LLViewerWearable *wearable, bool disable_camera_switch) { - showWearable(mWearablePtr, FALSE, disable_camera_switch); + showWearable(mWearablePtr, false, disable_camera_switch); mWearablePtr = wearable; - showWearable(mWearablePtr, TRUE, disable_camera_switch); + showWearable(mWearablePtr, true, disable_camera_switch); } //static @@ -952,7 +952,7 @@ void LLPanelEditWearable::onCommitSexChange() gAgentAvatarp->updateSexDependentLayerSets(); gAgentAvatarp->updateVisualParams(); - showWearable(mWearablePtr, TRUE, TRUE); + showWearable(mWearablePtr, true, true); updateScrollingPanelUI(); } @@ -984,7 +984,7 @@ void LLPanelEditWearable::onTexturePickerCommit(const LLUICtrl* ctrl) U32 index; if (gAgentWearables.getWearableIndex(getWearable(), index)) { - gAgentAvatarp->setLocalTexture(entry->mTextureIndex, image, FALSE, index); + gAgentAvatarp->setLocalTexture(entry->mTextureIndex, image, false, index); LLVisualParamHint::requestHintUpdates(); gAgentAvatarp->wearableUpdated(type); } @@ -1096,7 +1096,7 @@ void LLPanelEditWearable::saveChanges(bool force_save_as) { // the name of the wearable has changed, re-save wearable with new name LLAppearanceMgr::instance().removeCOFItemLinks(mWearablePtr->getItemID(), gAgentAvatarp->mEndCustomizeCallback); - gAgentWearables.saveWearableAs(mWearablePtr->getType(), index, new_name, description, FALSE); + gAgentWearables.saveWearableAs(mWearablePtr->getType(), index, new_name, description, false); mNameEditor->setText(mWearableItem->getName()); } else @@ -1138,7 +1138,7 @@ void LLPanelEditWearable::revertChanges() gAgentAvatarp->wearableUpdated(mWearablePtr->getType()); } -void LLPanelEditWearable::showWearable(LLViewerWearable* wearable, BOOL show, BOOL disable_camera_switch) +void LLPanelEditWearable::showWearable(LLViewerWearable* wearable, bool show, bool disable_camera_switch) { if (!wearable) { @@ -1220,12 +1220,12 @@ void LLPanelEditWearable::showWearable(LLViewerWearable* wearable, BOOL show, BO // Don't show female subparts if you're not female, etc. if (!(gAgentAvatarp->getSex() & subpart_entry->mSex)) { - tab->setVisible(FALSE); + tab->setVisible(false); continue; } else { - tab->setVisible(TRUE); + tab->setVisible(true); } // what edit group do we want to extract params for? @@ -1314,7 +1314,7 @@ void LLPanelEditWearable::changeCamera(U8 subpart) if (gSavedSettings.getBOOL("AppearanceCameraMovement")) { // Unlock focus from avatar but don't stop animation to not interrupt ANIM_AGENT_CUSTOMIZE - gAgentCamera.setFocusOnAvatar(FALSE, gAgentCamera.getCameraAnimating()); + gAgentCamera.setFocusOnAvatar(false, gAgentCamera.getCameraAnimating()); gMorphView->updateCamera(); } } @@ -1344,7 +1344,7 @@ void LLPanelEditWearable::updateTypeSpecificControls(LLWearableType::EType type) { // Update avatar height F32 new_size = gAgentAvatarp->mBodySize.mV[VZ]; - if (gSavedSettings.getBOOL("HeightUnits") == FALSE) + if (!gSavedSettings.getBOOL("HeightUnits")) { // convert meters to feet new_size = new_size / ONE_FOOT; @@ -1402,7 +1402,7 @@ void LLPanelEditWearable::updateScrollingPanelUI() continue; } - panel_list->updatePanels(TRUE); + panel_list->updatePanels(true); } } } @@ -1511,11 +1511,11 @@ void LLPanelEditWearable::buildParamList(LLScrollingPanelList *panel_list, value LLScrollingPanelParamBase *panel_param = NULL; if (wearable && wearable->getType() == LLWearableType::WT_PHYSICS) // Hack to show a different panel for physics. Should generalize this later. { - panel_param = new LLScrollingPanelParamBase( p, NULL, (*it).second, TRUE, this->getWearable(), jointp); + panel_param = new LLScrollingPanelParamBase( p, NULL, (*it).second, true, this->getWearable(), jointp); } else { - panel_param = new LLScrollingPanelParam( p, NULL, (*it).second, TRUE, this->getWearable(), jointp); + panel_param = new LLScrollingPanelParam( p, NULL, (*it).second, true, this->getWearable(), jointp); } panel_list->addPanel( panel_param ); } @@ -1531,7 +1531,7 @@ void LLPanelEditWearable::updateVerbs() can_copy = mWearableItem->getPermissions().allowCopyBy(gAgentID); } - BOOL is_dirty = isDirty(); + bool is_dirty = isDirty(); mBtnRevert->setEnabled(is_dirty); getChildView("save_as_button")->setEnabled(is_dirty && can_copy); @@ -1544,7 +1544,7 @@ void LLPanelEditWearable::updateVerbs() } // update back button and title according to dirty state. - static BOOL was_dirty = FALSE; + static bool was_dirty = false; if (was_dirty != is_dirty) // to avoid redundant changes because this method is called from draw { static S32 label_width = mBtnBack->getFont()->getWidth(mBackBtnLabel); @@ -1598,7 +1598,7 @@ void LLPanelEditWearable::onInvisibilityCommit(LLCheckBoxCtrl* checkbox_ctrl, LL mPreviousAlphaTexture[te] = lto->getID(); LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture( IMG_INVISIBLE ); - gAgentAvatarp->setLocalTexture(te, image, FALSE, index); + gAgentAvatarp->setLocalTexture(te, image, false, index); gAgentAvatarp->wearableUpdated(getWearable()->getType()); } else @@ -1620,7 +1620,7 @@ void LLPanelEditWearable::onInvisibilityCommit(LLCheckBoxCtrl* checkbox_ctrl, LL return; } - gAgentAvatarp->setLocalTexture(te, image, FALSE, index); + gAgentAvatarp->setLocalTexture(te, image, false, index); gAgentAvatarp->wearableUpdated(getWearable()->getType()); } @@ -1667,8 +1667,8 @@ public: bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web) { - // change height units TRUE for meters and FALSE for feet - BOOL new_value = (gSavedSettings.getBOOL("HeightUnits") == FALSE) ? TRUE : FALSE; + // change height units true for meters and false for feet + bool new_value = !gSavedSettings.getBOOL("HeightUnits"); gSavedSettings.setBOOL("HeightUnits", new_value); return true; } diff --git a/indra/newview/llpaneleditwearable.h b/indra/newview/llpaneleditwearable.h index 56bc64cc7d..aa4ac915c7 100644 --- a/indra/newview/llpaneleditwearable.h +++ b/indra/newview/llpaneleditwearable.h @@ -51,8 +51,8 @@ public: LLPanelEditWearable( ); virtual ~LLPanelEditWearable(); - /*virtual*/ BOOL postBuild(); - /*virtual*/ BOOL isDirty() const; // LLUICtrl + /*virtual*/ bool postBuild(); + /*virtual*/ bool isDirty() const; // LLUICtrl /*virtual*/ void draw(); void onClose(); @@ -60,7 +60,7 @@ public: void changeCamera(U8 subpart); LLViewerWearable* getWearable() { return mWearablePtr; } - void setWearable(LLViewerWearable *wearable, BOOL disable_camera_switch = FALSE); + void setWearable(LLViewerWearable *wearable, bool disable_camera_switch = false); void saveChanges(bool force_save_as = false); void revertChanges(); @@ -76,12 +76,12 @@ public: void onSaveAsButtonClicked(); void saveAsCallback(const LLSD& notification, const LLSD& response); - virtual void setVisible(BOOL visible); + virtual void setVisible(bool visible); private: typedef std::map<F32, LLViewerVisualParam*> value_map_t; - void showWearable(LLViewerWearable* wearable, BOOL show, BOOL disable_camera_switch = FALSE); + void showWearable(LLViewerWearable* wearable, bool show, bool disable_camera_switch = false); void updateScrollingPanelUI(); LLPanel* getPanel(LLWearableType::EType type); void getSortedParams(value_map_t &sorted_params, const std::string &edit_group); @@ -106,7 +106,7 @@ private: bool changeHeightUnits(const LLSD& new_value); // updates current metric and replacement metric label text - void updateMetricLayout(BOOL new_value); + void updateMetricLayout(bool new_value); // updates avatar height label void updateAvatarHeightLabel(); diff --git a/indra/newview/llpanelemojicomplete.cpp b/indra/newview/llpanelemojicomplete.cpp index c7c0627009..9814745bc7 100644 --- a/indra/newview/llpanelemojicomplete.cpp +++ b/indra/newview/llpanelemojicomplete.cpp @@ -1,4 +1,4 @@ -/** +/** * @file llpanelemojicomplete.h * @brief Header file for LLPanelEmojiComplete * @@ -97,13 +97,13 @@ void LLPanelEmojiComplete::draw() if (mVertical) { x = mRenderRect.mLeft; - y = mRenderRect.mTop - (mCurSelected - firstVisibleIdx + 1) * mEmojiHeight; + y = mRenderRect.mTop - static_cast<S32>(mCurSelected - firstVisibleIdx + 1) * mEmojiHeight; width = mRenderRect.getWidth(); height = mEmojiHeight; } else { - x = mRenderRect.mLeft + (mCurSelected - firstVisibleIdx) * mEmojiWidth; + x = mRenderRect.mLeft + static_cast<S32>(mCurSelected - firstVisibleIdx) * mEmojiWidth; y = mRenderRect.mBottom; width = mEmojiWidth; height = mRenderRect.getHeight(); @@ -116,7 +116,7 @@ void LLPanelEmojiComplete::draw() F32 textLeft = mVertical ? mRenderRect.mLeft + mEmojiWidth + mPadding : 0; F32 textWidth = mVertical ? getRect().getWidth() - textLeft - mPadding : 0; - for (U32 curIdx = firstVisibleIdx; curIdx < lastVisibleIdx; curIdx++) + for (size_t curIdx = firstVisibleIdx; curIdx < lastVisibleIdx; curIdx++) { LLWString text(1, mEmojis[curIdx].Character); mIconFont->render(text, 0, iconCenterX, iconCenterY, @@ -132,7 +132,7 @@ void LLPanelEmojiComplete::draw() std::string text = shortCode.substr(0, mEmojis[curIdx].Begin); mTextFont->renderUTF8(text, 0, x0, iconCenterY, LLColor4::white, LLFontGL::LEFT, LLFontGL::VCENTER, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, - text.size(), x1); + static_cast<S32>(text.size()), x1); x0 += mTextFont->getWidthF32(text); x1 = textLeft + textWidth - x0; } @@ -141,7 +141,7 @@ void LLPanelEmojiComplete::draw() std::string text = shortCode.substr(mEmojis[curIdx].Begin, mEmojis[curIdx].End - mEmojis[curIdx].Begin); mTextFont->renderUTF8(text, 0, x0, iconCenterY, LLColor4::yellow6, LLFontGL::LEFT, LLFontGL::VCENTER, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, - text.size(), x1); + static_cast<S32>(text.size()), x1); x0 += mTextFont->getWidthF32(text); x1 = textLeft + textWidth - x0; } @@ -150,7 +150,7 @@ void LLPanelEmojiComplete::draw() std::string text = shortCode.substr(mEmojis[curIdx].End); mTextFont->renderUTF8(text, 0, x0, iconCenterY, LLColor4::white, LLFontGL::LEFT, LLFontGL::VCENTER, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, - text.size(), x1); + static_cast<S32>(text.size()), x1); } iconCenterY -= mEmojiHeight; } @@ -161,10 +161,10 @@ void LLPanelEmojiComplete::draw() } } -BOOL LLPanelEmojiComplete::handleHover(S32 x, S32 y, MASK mask) +bool LLPanelEmojiComplete::handleHover(S32 x, S32 y, MASK mask) { if (mScrollbar && mScrollbar->getVisible() && childrenHandleHover(x, y, mask)) - return TRUE; + return true; LLVector2 curHover(x, y); if ((mLastHover - curHover).lengthSquared() > MIN_MOUSE_MOVE_DELTA) @@ -175,10 +175,10 @@ BOOL LLPanelEmojiComplete::handleHover(S32 x, S32 y, MASK mask) mLastHover = curHover; } - return TRUE; + return true; } -BOOL LLPanelEmojiComplete::handleKey(KEY key, MASK mask, BOOL called_from_parent) +bool LLPanelEmojiComplete::handleKey(KEY key, MASK mask, bool called_from_parent) { bool handled = false; if (mTotalEmojis && MASK_NONE == mask) @@ -226,43 +226,43 @@ BOOL LLPanelEmojiComplete::handleKey(KEY key, MASK mask, BOOL called_from_parent if (handled) { - return TRUE; + return true; } return LLUICtrl::handleKey(key, mask, called_from_parent); } -BOOL LLPanelEmojiComplete::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLPanelEmojiComplete::handleMouseDown(S32 x, S32 y, MASK mask) { if (mScrollbar && mScrollbar->getVisible() && childrenHandleMouseDown(x, y, mask)) - return TRUE; + return true; mCurSelected = posToIndex(x, y); mLastHover = LLVector2(x, y); - return TRUE; + return true; } -BOOL LLPanelEmojiComplete::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLPanelEmojiComplete::handleMouseUp(S32 x, S32 y, MASK mask) { if (mScrollbar && mScrollbar->getVisible() && childrenHandleMouseUp(x, y, mask)) - return TRUE; + return true; mCurSelected = posToIndex(x, y); onCommit(); - return TRUE; + return true; } -BOOL LLPanelEmojiComplete::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLPanelEmojiComplete::handleScrollWheel(S32 x, S32 y, S32 clicks) { if (mNoScroll) - return FALSE; + return false; if (mScrollbar && mScrollbar->getVisible() && mScrollbar->handleScrollWheel(x, y, clicks)) { mCurSelected = posToIndex(x, y); - return TRUE; + return true; } if (mTotalEmojis > mVisibleEmojis) @@ -273,10 +273,10 @@ BOOL LLPanelEmojiComplete::handleScrollWheel(S32 x, S32 y, S32 clicks) S32 newScrollPos = llmax(0, (S32)mScrollPos + clicks); mScrollPos = llclamp<size_t>((size_t)newScrollPos, 0, mTotalEmojis - mVisibleEmojis); mCurSelected = posToIndex(x, y); - return TRUE; + return true; } - return FALSE; + return false; } void LLPanelEmojiComplete::onCommit() @@ -289,7 +289,7 @@ void LLPanelEmojiComplete::onCommit() } } -void LLPanelEmojiComplete::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLPanelEmojiComplete::reshape(S32 width, S32 height, bool called_from_parent) { LLUICtrl::reshape(width, height, called_from_parent); if (mAutoSize) @@ -352,7 +352,7 @@ U32 LLPanelEmojiComplete::getMaxShortCodeWidth() const U32 max_width = 0; for (const LLEmojiSearchResult& result : mEmojis) { - S32 width = mTextFont->getWidth(result.String); + U32 width = mTextFont->getWidth(result.String); if (width > max_width) { max_width = width; @@ -376,11 +376,11 @@ void LLPanelEmojiComplete::onEmojisChanged() { width += mScrollbar->getThickness(); } - height = mVisibleEmojis * mEmojiHeight; + height = static_cast<S32>(mVisibleEmojis) * mEmojiHeight; } else { - width = mVisibleEmojis * mEmojiWidth; + width = static_cast<S32>(mVisibleEmojis) * mEmojiWidth; height = getRect().getHeight(); } LLUICtrl::reshape(width, height, false); @@ -448,21 +448,21 @@ void LLPanelEmojiComplete::updateConstraints() if (!mNoScroll && mVisibleEmojis < mTotalEmojis) { mRenderRect.mRight -= mScrollbar->getThickness(); - mScrollbar->setDocSize(mTotalEmojis); - mScrollbar->setPageSize(mVisibleEmojis); + mScrollbar->setDocSize(static_cast<S32>(mTotalEmojis)); + mScrollbar->setPageSize(static_cast<S32>(mVisibleEmojis)); mScrollbar->setOrigin(mRenderRect.mRight, 0); - mScrollbar->reshape(mScrollbar->getThickness(), mRenderRect.mTop, TRUE); - mScrollbar->setVisible(TRUE); + mScrollbar->reshape(mScrollbar->getThickness(), mRenderRect.mTop, true); + mScrollbar->setVisible(true); } else { - mScrollbar->setVisible(FALSE); + mScrollbar->setVisible(false); } } else { mEmojiHeight = mRenderRect.getHeight(); - mRenderRect.stretch((mRenderRect.getWidth() - mVisibleEmojis * mEmojiWidth) / -2, 0); + mRenderRect.stretch((mRenderRect.getWidth() - static_cast<S32>(mVisibleEmojis) * mEmojiWidth) / -2, 0); } updateScrollPos(); @@ -489,7 +489,7 @@ void LLPanelEmojiComplete::updateScrollPos() if (mScrollbar && mScrollbar->getVisible()) { - mScrollbar->setDocPos(mScrollPos); + mScrollbar->setDocPos(static_cast<S32>(mScrollPos)); } } @@ -507,7 +507,7 @@ LLFloaterEmojiComplete::LLFloaterEmojiComplete(const LLSD& sdKey) setIsChrome(true); } -BOOL LLFloaterEmojiComplete::handleKey(KEY key, MASK mask, BOOL called_from_parent) +bool LLFloaterEmojiComplete::handleKey(KEY key, MASK mask, bool called_from_parent) { bool handled = false; if (MASK_NONE == mask) @@ -522,7 +522,7 @@ BOOL LLFloaterEmojiComplete::handleKey(KEY key, MASK mask, BOOL called_from_pare } if (handled) - return TRUE; + return true; return LLFloater::handleKey(key, mask, called_from_parent); } @@ -545,10 +545,10 @@ void LLFloaterEmojiComplete::onOpen(const LLSD& key) setRect(outer_rect); } - gFloaterView->adjustToFitScreen(this, FALSE); + gFloaterView->adjustToFitScreen(this, false); } -BOOL LLFloaterEmojiComplete::postBuild() +bool LLFloaterEmojiComplete::postBuild() { mEmojiCtrl = findChild<LLPanelEmojiComplete>("emoji_complete_ctrl"); mEmojiCtrl->setCommitCallback( @@ -564,7 +564,7 @@ BOOL LLFloaterEmojiComplete::postBuild() return LLFloater::postBuild(); } -void LLFloaterEmojiComplete::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLFloaterEmojiComplete::reshape(S32 width, S32 height, bool called_from_parent) { if (called_from_parent) { diff --git a/indra/newview/llpanelemojicomplete.h b/indra/newview/llpanelemojicomplete.h index 36a965202e..3dfcc98a39 100644 --- a/indra/newview/llpanelemojicomplete.h +++ b/indra/newview/llpanelemojicomplete.h @@ -60,13 +60,13 @@ public: virtual ~LLPanelEmojiComplete(); void draw() override; - BOOL handleHover(S32 x, S32 y, MASK mask) override; - BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent) override; - BOOL handleMouseDown(S32 x, S32 y, MASK mask) override; - BOOL handleMouseUp(S32 x, S32 y, MASK mask) override; - BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) override; + bool handleHover(S32 x, S32 y, MASK mask) override; + bool handleKey(KEY key, MASK mask, bool called_from_parent) override; + bool handleMouseDown(S32 x, S32 y, MASK mask) override; + bool handleMouseUp(S32 x, S32 y, MASK mask) override; + bool handleScrollWheel(S32 x, S32 y, S32 clicks) override; void onCommit() override; - void reshape(S32 width, S32 height, BOOL called_from_parent) override; + void reshape(S32 width, S32 height, bool called_from_parent) override; public: size_t getEmojiCount() const { return mEmojis.size(); } @@ -118,10 +118,10 @@ public: LLFloaterEmojiComplete(const LLSD& sdKey); public: - BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent) override; + bool handleKey(KEY key, MASK mask, bool called_from_parent) override; void onOpen(const LLSD& key) override; - BOOL postBuild() override; - void reshape(S32 width, S32 height, BOOL called_from_parent) override; + bool postBuild() override; + void reshape(S32 width, S32 height, bool called_from_parent) override; protected: LLPanelEmojiComplete* mEmojiCtrl = nullptr; diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 5f9ff2c5ad..43612865fc 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -165,7 +165,7 @@ LLPanelEnvironmentInfo::~LLPanelEnvironmentInfo() mUpdateConnection.disconnect(); } -BOOL LLPanelEnvironmentInfo::postBuild() +bool LLPanelEnvironmentInfo::postBuild() { getChild<LLUICtrl>(BTN_USEDEFAULT)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnDefault(); }); @@ -198,7 +198,7 @@ BOOL LLPanelEnvironmentInfo::postBuild() getChild<LLSettingsDropTarget>("sdt_" + alt_prefixes[3])->setPanel(this, alt_prefixes[3]); getChild<LLSettingsDropTarget>("sdt_" + alt_prefixes[4])->setPanel(this, alt_prefixes[4]); - return TRUE; + return true; } // virtual @@ -208,7 +208,7 @@ void LLPanelEnvironmentInfo::onOpen(const LLSD& key) } // virtual -void LLPanelEnvironmentInfo::onVisibilityChange(BOOL new_visibility) +void LLPanelEnvironmentInfo::onVisibilityChange(bool new_visibility) { if (new_visibility) { @@ -339,7 +339,7 @@ void LLPanelEnvironmentInfo::refreshFromEstate() refresh(); } -std::string LLPanelEnvironmentInfo::getNameForTrackIndex(S32 index) +std::string LLPanelEnvironmentInfo::getNameForTrackIndex(U32 index) { std::string invname; if (!mCurrentEnvironment || index < LLSettingsDay::TRACK_WATER || index >= LLSettingsDay::TRACK_MAX) @@ -871,7 +871,7 @@ void LLPanelEnvironmentInfo::onBtnSelect() picker->setSettingsFilter(LLSettingsType::ST_NONE); picker->setSettingsItemId(item_id); picker->openFloater(); - picker->setFocus(TRUE); + picker->setFocus(true); } } @@ -1133,17 +1133,17 @@ LLSettingsDropTarget::LLSettingsDropTarget(const LLSettingsDropTarget::Params& p : LLView(p), mEnvironmentInfoPanel(NULL), mDndEnabled(false) {} -BOOL LLSettingsDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +bool LLSettingsDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) { - BOOL handled = FALSE; + bool handled = false; if (getParent() && mDndEnabled) { - handled = TRUE; + handled = true; switch (cargo_type) { diff --git a/indra/newview/llpanelenvironment.h b/indra/newview/llpanelenvironment.h index 41c89bdf5a..b478142987 100644 --- a/indra/newview/llpanelenvironment.h +++ b/indra/newview/llpanelenvironment.h @@ -47,11 +47,11 @@ public: LLPanelEnvironmentInfo(); virtual ~LLPanelEnvironmentInfo(); - virtual BOOL postBuild() override; + virtual bool postBuild() override; virtual void onOpen(const LLSD& key) override; - virtual BOOL isDirty() const override { return getIsDirty(); } - virtual void onVisibilityChange(BOOL new_visibility) override; + virtual bool isDirty() const override { return getIsDirty(); } + virtual void onVisibilityChange(bool new_visibility) override; virtual void refresh() override; @@ -136,7 +136,7 @@ protected: virtual bool isLargeEnough() = 0; virtual void refreshFromSource() = 0; - std::string getNameForTrackIndex(S32 index); + std::string getNameForTrackIndex(U32 index); LLFloaterSettingsPicker * getSettingsPicker(bool create = true); LLFloaterEditExtDayCycle * getEditFloater(bool create = true); @@ -206,7 +206,7 @@ public: LLSettingsDropTarget(const Params&); ~LLSettingsDropTarget() {}; - virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + virtual bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, diff --git a/indra/newview/llpanelexperiencelisteditor.cpp b/indra/newview/llpanelexperiencelisteditor.cpp index fd5678e446..01c8e88370 100644 --- a/indra/newview/llpanelexperiencelisteditor.cpp +++ b/indra/newview/llpanelexperiencelisteditor.cpp @@ -54,7 +54,7 @@ LLPanelExperienceListEditor::LLPanelExperienceListEditor() { } -BOOL LLPanelExperienceListEditor::postBuild() +bool LLPanelExperienceListEditor::postBuild() { mItems = getChild<LLNameListCtrl>("experience_list"); mAdd = getChild<LLButton>("btn_add"); @@ -68,7 +68,7 @@ BOOL LLPanelExperienceListEditor::postBuild() mItems->setCommitCallback(boost::bind(&LLPanelExperienceListEditor::checkButtonsEnabled, this)); checkButtonsEnabled(); - return TRUE; + return true; } const uuid_list_t& LLPanelExperienceListEditor::getExperienceIds() const @@ -118,7 +118,7 @@ void LLPanelExperienceListEditor::onAdd() mKey.generateNewID(); - LLFloaterExperiencePicker* picker=LLFloaterExperiencePicker::show(boost::bind(&LLPanelExperienceListEditor::addExperienceIds, this, _1), mKey, FALSE, TRUE, mFilters, mAdd); + LLFloaterExperiencePicker* picker=LLFloaterExperiencePicker::show(boost::bind(&LLPanelExperienceListEditor::addExperienceIds, this, _1), mKey, false, true, mFilters, mAdd); mPicker = picker->getDerivedHandle<LLFloaterExperiencePicker>(); } diff --git a/indra/newview/llpanelexperiencelisteditor.h b/indra/newview/llpanelexperiencelisteditor.h index d2e72e7f19..7ff1ddac5a 100644 --- a/indra/newview/llpanelexperiencelisteditor.h +++ b/indra/newview/llpanelexperiencelisteditor.h @@ -47,7 +47,7 @@ public: typedef LLHandle<LLFloaterExperiencePicker> PickerHandle; LLPanelExperienceListEditor(); ~LLPanelExperienceListEditor(); - BOOL postBuild(); + bool postBuild(); void loading(); diff --git a/indra/newview/llpanelexperiencelog.cpp b/indra/newview/llpanelexperiencelog.cpp index b4ca76c4b1..24c9d7dced 100644 --- a/indra/newview/llpanelexperiencelog.cpp +++ b/indra/newview/llpanelexperiencelog.cpp @@ -54,7 +54,7 @@ LLPanelExperienceLog::LLPanelExperienceLog( ) buildFromFile("panel_experience_log.xml"); } -BOOL LLPanelExperienceLog::postBuild( void ) +bool LLPanelExperienceLog::postBuild() { LLExperienceLog* log = LLExperienceLog::getInstance(); mEventList = getChild<LLScrollListCtrl>("experience_log_list"); @@ -82,7 +82,7 @@ BOOL LLPanelExperienceLog::postBuild( void ) mPageSize = log->getPageSize(); refresh(); mNewEvent = LLExperienceLog::instance().addUpdateSignal(boost::bind(&LLPanelExperienceLog::refresh, this)); - return TRUE; + return true; } LLPanelExperienceLog* LLPanelExperienceLog::create() @@ -102,14 +102,14 @@ void LLPanelExperienceLog::refresh() return; } - setAllChildrenEnabled(FALSE); + setAllChildrenEnabled(false); LLSD item; bool waiting = false; LLUUID waiting_id; - int itemsToSkip = mPageSize*mCurrentPage; - int items = 0; + unsigned int itemsToSkip = mPageSize*mCurrentPage; + unsigned int items = 0; bool moreItems = false; LLSD events_to_save = events; if (events.isMap() && events.size() != 0) @@ -126,7 +126,7 @@ void LLPanelExperienceLog::refresh() events_to_save.erase(day->first); continue; } - int size = dayArray.size(); + unsigned int size = static_cast<unsigned int>(dayArray.size()); if(itemsToSkip > size) { itemsToSkip -= size; @@ -137,7 +137,7 @@ void LLPanelExperienceLog::refresh() moreItems = true; break; } - for(int i = dayArray.size() - itemsToSkip - 1; i >= 0; i--) + for(int i = static_cast<int>(dayArray.size()) - itemsToSkip - 1; i >= 0; i--) { if(items >= mPageSize) { @@ -179,9 +179,9 @@ void LLPanelExperienceLog::refresh() } else { - setAllChildrenEnabled(TRUE); + setAllChildrenEnabled(true); - mEventList->setEnabled(TRUE); + mEventList->setEnabled(true); getChild<LLButton>("btn_next")->setEnabled(moreItems); getChild<LLButton>("btn_prev")->setEnabled(mCurrentPage>0); getChild<LLButton>("btn_clear")->setEnabled(mEventList->getItemCount()>0); diff --git a/indra/newview/llpanelexperiencelog.h b/indra/newview/llpanelexperiencelog.h index f99e424d81..fb84e0475a 100644 --- a/indra/newview/llpanelexperiencelog.h +++ b/indra/newview/llpanelexperiencelog.h @@ -40,7 +40,7 @@ public: static LLPanelExperienceLog* create(); - /*virtual*/ BOOL postBuild(void); + /*virtual*/ bool postBuild(); void refresh(); protected: diff --git a/indra/newview/llpanelexperiencepicker.cpp b/indra/newview/llpanelexperiencepicker.cpp index 396f1341a2..5a176b8b92 100644 --- a/indra/newview/llpanelexperiencepicker.cpp +++ b/indra/newview/llpanelexperiencepicker.cpp @@ -70,28 +70,28 @@ LLPanelExperiencePicker::~LLPanelExperiencePicker() { } -BOOL LLPanelExperiencePicker::postBuild() +bool LLPanelExperiencePicker::postBuild() { getChild<LLLineEditor>(TEXT_EDIT)->setKeystrokeCallback( boost::bind(&LLPanelExperiencePicker::editKeystroke, this, _1, _2),NULL); childSetAction(BTN_FIND, boost::bind(&LLPanelExperiencePicker::onBtnFind, this)); - getChildView(BTN_FIND)->setEnabled(TRUE); + getChildView(BTN_FIND)->setEnabled(true); LLScrollListCtrl* searchresults = getChild<LLScrollListCtrl>(LIST_RESULTS); searchresults->setDoubleClickCallback( boost::bind(&LLPanelExperiencePicker::onBtnSelect, this)); searchresults->setCommitCallback(boost::bind(&LLPanelExperiencePicker::onList, this)); - getChildView(LIST_RESULTS)->setEnabled(FALSE); + getChildView(LIST_RESULTS)->setEnabled(false); getChild<LLScrollListCtrl>(LIST_RESULTS)->setCommentText(getString("no_results")); childSetAction(BTN_OK, boost::bind(&LLPanelExperiencePicker::onBtnSelect, this)); - getChildView(BTN_OK)->setEnabled(FALSE); + getChildView(BTN_OK)->setEnabled(false); childSetAction(BTN_CANCEL, boost::bind(&LLPanelExperiencePicker::onBtnClose, this)); childSetAction(BTN_PROFILE, boost::bind(&LLPanelExperiencePicker::onBtnProfile, this)); - getChildView(BTN_PROFILE)->setEnabled(FALSE); + getChildView(BTN_PROFILE)->setEnabled(false); getChild<LLComboBox>(TEXT_MATURITY)->setCurrentByIndex(gSavedPerAccountSettings.getU32("ExperienceSearchMaturity")); getChild<LLComboBox>(TEXT_MATURITY)->setCommitCallback(boost::bind(&LLPanelExperiencePicker::onMaturity, this)); - getChild<LLUICtrl>(TEXT_EDIT)->setFocus(TRUE); + getChild<LLUICtrl>(TEXT_EDIT)->setFocus(true); childSetAction(BTN_LEFT, boost::bind(&LLPanelExperiencePicker::onPage, this, -1)); childSetAction(BTN_RIGHT, boost::bind(&LLPanelExperiencePicker::onPage, this, 1)); @@ -102,7 +102,7 @@ BOOL LLPanelExperiencePicker::postBuild() // Start searching when Return is pressed in the line editor. search_panel->setDefaultBtn(BTN_FIND); } - return TRUE; + return true; } void LLPanelExperiencePicker::editKeystroke( class LLLineEditor* caller, void* user_data ) @@ -140,11 +140,11 @@ void LLPanelExperiencePicker::onBtnFind() getChild<LLScrollListCtrl>(LIST_RESULTS)->deleteAllItems(); getChild<LLScrollListCtrl>(LIST_RESULTS)->setCommentText(getString("searching")); - getChildView(BTN_OK)->setEnabled(FALSE); - getChildView(BTN_PROFILE)->setEnabled(FALSE); + getChildView(BTN_OK)->setEnabled(false); + getChildView(BTN_PROFILE)->setEnabled(false); - getChildView(BTN_RIGHT)->setEnabled(FALSE); - getChildView(BTN_LEFT)->setEnabled(FALSE); + getChildView(BTN_RIGHT)->setEnabled(false); + getChildView(BTN_LEFT)->setEnabled(false); LLExperienceCache::instance().get(experience_id, boost::bind(&LLPanelExperiencePicker::onBtnFind, this)); return; } @@ -176,11 +176,11 @@ void LLPanelExperiencePicker::find() getChild<LLScrollListCtrl>(LIST_RESULTS)->deleteAllItems(); getChild<LLScrollListCtrl>(LIST_RESULTS)->setCommentText(getString("searching")); - getChildView(BTN_OK)->setEnabled(FALSE); - getChildView(BTN_PROFILE)->setEnabled(FALSE); + getChildView(BTN_OK)->setEnabled(false); + getChildView(BTN_PROFILE)->setEnabled(false); - getChildView(BTN_RIGHT)->setEnabled(FALSE); - getChildView(BTN_LEFT)->setEnabled(FALSE); + getChildView(BTN_RIGHT)->setEnabled(false); + getChildView(BTN_LEFT)->setEnabled(false); } /*static*/ @@ -266,10 +266,10 @@ void LLPanelExperiencePicker::onBtnSelect() getSelectedExperienceIds(results, experience_ids); mSelectionCallback(experience_ids); - getChild<LLScrollListCtrl>(LIST_RESULTS)->deselectAllItems(TRUE); + getChild<LLScrollListCtrl>(LIST_RESULTS)->deselectAllItems(true); if(mCloseOnSelect) { - mCloseOnSelect = FALSE; + mCloseOnSelect = false; onBtnClose(); } } @@ -368,14 +368,14 @@ void LLPanelExperiencePicker::filterContent() { getChildView(BTN_OK)->setEnabled(true); search_results->setEnabled(true); - search_results->sortByColumnIndex(1, TRUE); + search_results->sortByColumnIndex(1, true); std::string text = getChild<LLUICtrl>(TEXT_EDIT)->getValue().asString(); - if (!search_results->selectItemByLabel(text, TRUE, 1)) + if (!search_results->selectItemByLabel(text, true, 1)) { search_results->selectFirstItem(); } onList(); - search_results->setFocus(TRUE); + search_results->setFocus(true); } } diff --git a/indra/newview/llpanelexperiencepicker.h b/indra/newview/llpanelexperiencepicker.h index fc8b1d5418..72c0b1b74d 100644 --- a/indra/newview/llpanelexperiencepicker.h +++ b/indra/newview/llpanelexperiencepicker.h @@ -47,7 +47,7 @@ public: LLPanelExperiencePicker(); virtual ~LLPanelExperiencePicker(); - BOOL postBuild(); + bool postBuild(); void addFilter(filter_function func){mFilters.push_back(func);} template <class IT> diff --git a/indra/newview/llpanelexperiences.cpp b/indra/newview/llpanelexperiences.cpp index 7080aaa3db..6cdeefdbad 100644 --- a/indra/newview/llpanelexperiences.cpp +++ b/indra/newview/llpanelexperiences.cpp @@ -51,7 +51,7 @@ LLPanelExperiences::LLPanelExperiences( ) buildFromFile("panel_experiences.xml"); } -BOOL LLPanelExperiences::postBuild( void ) +bool LLPanelExperiences::postBuild( void ) { mExperiencesList = getChild<LLFlatListView>("experiences_list"); if (hasString("loading_experiences")) @@ -64,7 +64,7 @@ BOOL LLPanelExperiences::postBuild( void ) } mExperiencesList->setComparator(&NAME_COMPARATOR); - return TRUE; + return true; } @@ -212,10 +212,10 @@ LLPanelSearchExperiences* LLPanelSearchExperiences::create( const std::string& n return panel; } -BOOL LLPanelSearchExperiences::postBuild( void ) +bool LLPanelSearchExperiences::postBuild( void ) { childSetAction("search_button", boost::bind(&LLPanelSearchExperiences::doSearch, this)); - return TRUE; + return true; } bool LLExperienceItemComparator::compare(const LLPanel* item1, const LLPanel* item2) const diff --git a/indra/newview/llpanelexperiences.h b/indra/newview/llpanelexperiences.h index 7a50ab7666..9c70593a5c 100644 --- a/indra/newview/llpanelexperiences.h +++ b/indra/newview/llpanelexperiences.h @@ -40,7 +40,7 @@ class LLPanelSearchExperiences public: LLPanelSearchExperiences(){} static LLPanelSearchExperiences* create(const std::string& name); - /*virtual*/ BOOL postBuild(void); + /*virtual*/ bool postBuild(void); void doSearch(); }; @@ -53,8 +53,7 @@ public: static LLPanelExperiences* create(const std::string& name); - /*virtual*/ BOOL postBuild(void); - /*virtual*/ void onClosePanel(); + /*virtual*/ bool postBuild(void); void setExperienceList(const LLSD& experiences); void getExperienceIdsList(std::vector<LLUUID>& result); diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 5e5d5f42d4..8a89c5a1aa 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -263,7 +263,7 @@ F32 LLPanelFace::getCurrentShinyOffsetV() { return getChild<LLUICtrl>( // Methods // -BOOL LLPanelFace::postBuild() +bool LLPanelFace::postBuild() { childSetCommitCallback("combobox shininess",&LLPanelFace::onCommitShiny,this); childSetCommitCallback("combobox bumpiness",&LLPanelFace::onCommitBump,this); @@ -322,7 +322,7 @@ BOOL LLPanelFace::postBuild() LLSpinCtrl* mCtrlGlow; - setMouseOpaque(FALSE); + setMouseOpaque(false); LLTextureCtrl* pbr_ctrl = findChild<LLTextureCtrl>("pbr_control"); if (pbr_ctrl) @@ -404,7 +404,7 @@ BOOL LLPanelFace::postBuild() mColorSwatch->setOnSelectCallback(boost::bind(&LLPanelFace::onSelectColor, this, _2)); mColorSwatch->setFollowsTop(); mColorSwatch->setFollowsLeft(); - mColorSwatch->setCanApplyImmediately(TRUE); + mColorSwatch->setCanApplyImmediately(true); } mShinyColorSwatch = getChild<LLColorSwatchCtrl>("shinycolorswatch"); @@ -415,7 +415,7 @@ BOOL LLPanelFace::postBuild() mShinyColorSwatch->setOnSelectCallback(boost::bind(&LLPanelFace::onSelectShinyColor, this, _2)); mShinyColorSwatch->setFollowsTop(); mShinyColorSwatch->setFollowsLeft(); - mShinyColorSwatch->setCanApplyImmediately(TRUE); + mShinyColorSwatch->setCanApplyImmediately(true); } mLabelColorTransp = getChild<LLTextBox>("color trans"); @@ -482,7 +482,7 @@ BOOL LLPanelFace::postBuild() clearCtrls(); - return TRUE; + return true; } LLPanelFace::LLPanelFace() @@ -503,7 +503,7 @@ LLPanelFace::~LLPanelFace() unloadMedia(); } -void LLPanelFace::onVisibilityChange(BOOL new_visibility) +void LLPanelFace::onVisibilityChange(bool new_visibility) { if (new_visibility) { @@ -655,7 +655,7 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor LLPanelFaceSetTEFunctor(LLPanelFace* panel) : mPanel(panel) {} virtual bool apply(LLViewerObject* object, S32 te) { - BOOL valid; + bool valid; F32 value; std::string prefix; @@ -1021,8 +1021,8 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) && objectp->getPCode() == LL_PCODE_VOLUME && objectp->permModify()) { - BOOL editable = objectp->permModify() && !objectp->isPermanentEnforced(); - BOOL attachment = objectp->isAttachment(); + bool editable = objectp->permModify() && !objectp->isPermanentEnforced(); + bool attachment = objectp->isAttachment(); bool has_pbr_material; bool has_faces_without_pbr; @@ -1237,27 +1237,35 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) // Texture { - mIsAlpha = FALSE; LLGLenum image_format = GL_RGB; bool identical_image_format = false; - LLSelectedTE::getImageFormat(image_format, identical_image_format); + bool missing_asset = false; + LLSelectedTE::getImageFormat(image_format, identical_image_format, missing_asset); - mIsAlpha = FALSE; - switch (image_format) + if (!missing_asset) { + mIsAlpha = false; + switch (image_format) + { case GL_RGBA: case GL_ALPHA: - { - mIsAlpha = TRUE; - } - break; + { + mIsAlpha = true; + } + break; case GL_RGB: break; default: - { - LL_WARNS() << "Unexpected tex format in LLPanelFace...resorting to no alpha" << LL_ENDL; + { + LL_WARNS() << "Unexpected tex format in LLPanelFace...resorting to no alpha" << LL_ENDL; + } + break; } - break; + } + else + { + // Don't know image's properties, use material's mode value + mIsAlpha = true; } if (LLViewerMedia::getInstance()->textureHasMedia(id)) @@ -1300,41 +1308,45 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) { if (identical_diffuse) { - texture_ctrl->setTentative(FALSE); + texture_ctrl->setTentative(false); texture_ctrl->setEnabled(editable && !has_pbr_material); texture_ctrl->setImageAssetID(id); - getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha && transparency <= 0.f && !has_pbr_material); - getChildView("label alphamode")->setEnabled(editable && mIsAlpha && !has_pbr_material); - getChildView("maskcutoff")->setEnabled(editable && mIsAlpha && !has_pbr_material); - getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha && !has_pbr_material); - texture_ctrl->setBakeTextureEnabled(TRUE); + bool can_change_alpha = editable && mIsAlpha && !missing_asset && !has_pbr_material; + getChildView("combobox alphamode")->setEnabled(can_change_alpha && transparency <= 0.f); + getChildView("label alphamode")->setEnabled(can_change_alpha); + getChildView("maskcutoff")->setEnabled(can_change_alpha); + getChildView("label maskcutoff")->setEnabled(can_change_alpha); + + texture_ctrl->setBakeTextureEnabled(true); } else if (id.isNull()) { // None selected - texture_ctrl->setTentative(FALSE); - texture_ctrl->setEnabled(FALSE); + texture_ctrl->setTentative(false); + texture_ctrl->setEnabled(false); texture_ctrl->setImageAssetID(LLUUID::null); - getChildView("combobox alphamode")->setEnabled(FALSE); - getChildView("label alphamode")->setEnabled(FALSE); - getChildView("maskcutoff")->setEnabled(FALSE); - getChildView("label maskcutoff")->setEnabled(FALSE); + getChildView("combobox alphamode")->setEnabled(false); + getChildView("label alphamode")->setEnabled(false); + getChildView("maskcutoff")->setEnabled(false); + getChildView("label maskcutoff")->setEnabled(false); texture_ctrl->setBakeTextureEnabled(false); } else { // Tentative: multiple selected with different textures - texture_ctrl->setTentative(TRUE); + texture_ctrl->setTentative(true); texture_ctrl->setEnabled(editable && !has_pbr_material); texture_ctrl->setImageAssetID(id); - getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha && transparency <= 0.f && !has_pbr_material); - getChildView("label alphamode")->setEnabled(editable && mIsAlpha && !has_pbr_material); - getChildView("maskcutoff")->setEnabled(editable && mIsAlpha && !has_pbr_material); - getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha && !has_pbr_material); - texture_ctrl->setBakeTextureEnabled(TRUE); + bool can_change_alpha = editable && mIsAlpha && !missing_asset && !has_pbr_material; + getChildView("combobox alphamode")->setEnabled(can_change_alpha && transparency <= 0.f); + getChildView("label alphamode")->setEnabled(can_change_alpha); + getChildView("maskcutoff")->setEnabled(can_change_alpha); + getChildView("label maskcutoff")->setEnabled(can_change_alpha); + + texture_ctrl->setBakeTextureEnabled(true); } if (attachment) @@ -1454,9 +1466,9 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) getChildView("shinyScaleU")->setEnabled(editable && has_material && specmap_id.notNull()); getChildView("bumpyScaleU")->setEnabled(editable && has_material && normmap_id.notNull()); - BOOL diff_scale_tentative = !(identical && identical_diff_scale_s); - BOOL norm_scale_tentative = !(identical && identical_norm_scale_s); - BOOL spec_scale_tentative = !(identical && identical_spec_scale_s); + bool diff_scale_tentative = !(identical && identical_diff_scale_s); + bool norm_scale_tentative = !(identical && identical_norm_scale_s); + bool spec_scale_tentative = !(identical && identical_spec_scale_s); getChild<LLUICtrl>("TexScaleU")->setTentative( LLSD(diff_scale_tentative)); getChild<LLUICtrl>("shinyScaleU")->setTentative(LLSD(spec_scale_tentative)); @@ -1485,9 +1497,9 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) spec_scale_t = editable ? spec_scale_t : 1.0f; spec_scale_t *= identical_planar_texgen ? 2.0f : 1.0f; - BOOL diff_scale_tentative = !identical_diff_scale_t; - BOOL norm_scale_tentative = !identical_norm_scale_t; - BOOL spec_scale_tentative = !identical_spec_scale_t; + bool diff_scale_tentative = !identical_diff_scale_t; + bool norm_scale_tentative = !identical_norm_scale_t; + bool spec_scale_tentative = !identical_spec_scale_t; getChildView("TexScaleV")->setEnabled(editable && has_material); getChildView("shinyScaleV")->setEnabled(editable && has_material && specmap_id.notNull()); @@ -1523,9 +1535,9 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) LLSelectedTEMaterial::getNormalOffsetX(norm_offset_s, identical_norm_offset_s); LLSelectedTEMaterial::getSpecularOffsetX(spec_offset_s, identical_spec_offset_s); - BOOL diff_offset_u_tentative = !(align_planar ? identical_planar_aligned : identical_diff_offset_s); - BOOL norm_offset_u_tentative = !(align_planar ? identical_planar_aligned : identical_norm_offset_s); - BOOL spec_offset_u_tentative = !(align_planar ? identical_planar_aligned : identical_spec_offset_s); + bool diff_offset_u_tentative = !(align_planar ? identical_planar_aligned : identical_diff_offset_s); + bool norm_offset_u_tentative = !(align_planar ? identical_planar_aligned : identical_norm_offset_s); + bool spec_offset_u_tentative = !(align_planar ? identical_planar_aligned : identical_spec_offset_s); getChild<LLUICtrl>("TexOffsetU")->setValue( editable ? diff_offset_s : 0.0f); getChild<LLUICtrl>("bumpyOffsetU")->setValue(editable ? norm_offset_s : 0.0f); @@ -1553,9 +1565,9 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) LLSelectedTEMaterial::getNormalOffsetY(norm_offset_t, identical_norm_offset_t); LLSelectedTEMaterial::getSpecularOffsetY(spec_offset_t, identical_spec_offset_t); - BOOL diff_offset_v_tentative = !(align_planar ? identical_planar_aligned : identical_diff_offset_t); - BOOL norm_offset_v_tentative = !(align_planar ? identical_planar_aligned : identical_norm_offset_t); - BOOL spec_offset_v_tentative = !(align_planar ? identical_planar_aligned : identical_spec_offset_t); + bool diff_offset_v_tentative = !(align_planar ? identical_planar_aligned : identical_diff_offset_t); + bool norm_offset_v_tentative = !(align_planar ? identical_planar_aligned : identical_norm_offset_t); + bool spec_offset_v_tentative = !(align_planar ? identical_planar_aligned : identical_spec_offset_t); getChild<LLUICtrl>("TexOffsetV")->setValue( editable ? diff_offset_t : 0.0f); getChild<LLUICtrl>("bumpyOffsetV")->setValue(editable ? norm_offset_t : 0.0f); @@ -1584,9 +1596,9 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) LLSelectedTEMaterial::getSpecularRotation(spec_rotation,identical_spec_rotation); LLSelectedTEMaterial::getNormalRotation(norm_rotation,identical_norm_rotation); - BOOL diff_rot_tentative = !(align_planar ? identical_planar_aligned : identical_diff_rotation); - BOOL norm_rot_tentative = !(align_planar ? identical_planar_aligned : identical_norm_rotation); - BOOL spec_rot_tentative = !(align_planar ? identical_planar_aligned : identical_spec_rotation); + bool diff_rot_tentative = !(align_planar ? identical_planar_aligned : identical_diff_rotation); + bool norm_rot_tentative = !(align_planar ? identical_planar_aligned : identical_norm_rotation); + bool spec_rot_tentative = !(align_planar ? identical_planar_aligned : identical_spec_rotation); F32 diff_rot_deg = diff_rotation * RAD_TO_DEG; F32 norm_rot_deg = norm_rotation * RAD_TO_DEG; @@ -1715,7 +1727,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) break; } - BOOL repeats_tentative = !identical_repeats; + bool repeats_tentative = !identical_repeats; LLSpinCtrl* rpt_ctrl = getChild<LLSpinCtrl>("rptctrl"); if (force_set_values) @@ -1793,7 +1805,6 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) getChild<LLUICtrl>("shinyOffsetV")->setValue(offset_y); getChild<LLUICtrl>("glossiness")->setValue(material->getSpecularLightExponent()); getChild<LLUICtrl>("environment")->setValue(material->getEnvironmentIntensity()); - getChild<LLUICtrl>("mirror")->setValue(material->getEnvironmentIntensity()); updateShinyControls(!material->getSpecularID().isNull(), true); } @@ -1838,7 +1849,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) } } S32 selected_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); - BOOL single_volume = (selected_count == 1); + bool single_volume = (selected_count == 1); mMenuClipboardColor->setEnabled(editable && single_volume); // Set variable values for numeric expressions @@ -1861,36 +1872,36 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) if (pbr_ctrl) { pbr_ctrl->setImageAssetID(LLUUID::null); - pbr_ctrl->setEnabled(FALSE); + pbr_ctrl->setEnabled(false); } LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("texture control"); if (texture_ctrl) { texture_ctrl->setImageAssetID( LLUUID::null ); - texture_ctrl->setEnabled( FALSE ); // this is a LLUICtrl, but we don't want it to have keyboard focus so we add it as a child, not a ctrl. -// texture_ctrl->setValid(FALSE); + texture_ctrl->setEnabled( false ); // this is a LLUICtrl, but we don't want it to have keyboard focus so we add it as a child, not a ctrl. +// texture_ctrl->setValid(false); } LLColorSwatchCtrl* mColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); if (mColorSwatch) { - mColorSwatch->setEnabled( FALSE ); + mColorSwatch->setEnabled( false ); mColorSwatch->setFallbackImage(LLUI::getUIImage("locked_image.j2c") ); - mColorSwatch->setValid(FALSE); + mColorSwatch->setValid(false); } LLRadioGroup* radio_mat_type = getChild<LLRadioGroup>("radio_material_type"); if (radio_mat_type) { radio_mat_type->setSelectedIndex(0); } - getChildView("color trans")->setEnabled(FALSE); - getChildView("rptctrl")->setEnabled(FALSE); - getChildView("tex gen")->setEnabled(FALSE); - getChildView("label shininess")->setEnabled(FALSE); - getChildView("label bumpiness")->setEnabled(FALSE); - getChildView("button align")->setEnabled(FALSE); - getChildView("pbr_from_inventory")->setEnabled(FALSE); - getChildView("edit_selected_pbr")->setEnabled(FALSE); - getChildView("save_selected_pbr")->setEnabled(FALSE); + getChildView("color trans")->setEnabled(false); + getChildView("rptctrl")->setEnabled(false); + getChildView("tex gen")->setEnabled(false); + getChildView("label shininess")->setEnabled(false); + getChildView("label bumpiness")->setEnabled(false); + getChildView("button align")->setEnabled(false); + getChildView("pbr_from_inventory")->setEnabled(false); + getChildView("edit_selected_pbr")->setEnabled(false); + getChildView("save_selected_pbr")->setEnabled(false); updateVisibility(); @@ -2000,7 +2011,7 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, { LLSelectedTE::getPbrMaterialId(pbr_id, identical_pbr, has_pbr_material, has_faces_without_pbr); - pbr_ctrl->setTentative(identical_pbr ? FALSE : TRUE); + pbr_ctrl->setTentative(!identical_pbr); pbr_ctrl->setEnabled(settable); pbr_ctrl->setImageAssetID(pbr_id); @@ -2116,7 +2127,7 @@ void LLPanelFace::refreshMedia() && first_object->permModify() )) { - getChildView("add_media")->setEnabled(FALSE); + getChildView("add_media")->setEnabled(false); mTitleMediaText->clear(); clearMediaSettings(); return; @@ -2127,13 +2138,13 @@ void LLPanelFace::refreshMedia() if (!has_media_capability) { - getChildView("add_media")->setEnabled(FALSE); + getChildView("add_media")->setEnabled(false); LL_WARNS("LLFloaterToolsMedia") << "Media not enabled (no capability) in this region!" << LL_ENDL; clearMediaSettings(); return; } - BOOL is_nonpermanent_enforced = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() + bool is_nonpermanent_enforced = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsNonPermanentEnforced()) || LLSelectMgr::getInstance()->selectGetNonPermanentEnforced(); bool editable = is_nonpermanent_enforced && (first_object->permModify() || selectedMediaEditable()); @@ -2253,7 +2264,7 @@ void LLPanelFace::refreshMedia() } } - getChildView("delete_media")->setEnabled(TRUE); + getChildView("delete_media")->setEnabled(true); } U32 materials_media = mComboMatMedia->getCurrentIndex(); @@ -2497,7 +2508,7 @@ void LLPanelFace::updateMediaSettings() // Auto play //value_bool = default_media_data.getAutoPlay(); - // set default to auto play TRUE -- angela EXT-5172 + // set default to auto play true -- angela EXT-5172 value_bool = true; struct functor_getter_auto_play : public LLSelectedTEGetFunctor< bool > { @@ -2509,7 +2520,7 @@ void LLPanelFace::updateMediaSettings() if (object->getTE(face)) if (object->getTE(face)->getMediaData()) return object->getTE(face)->getMediaData()->getAutoPlay(); - //return mMediaEntry.getAutoPlay(); set default to auto play TRUE -- angela EXT-5172 + //return mMediaEntry.getAutoPlay(); set default to auto play true -- angela EXT-5172 return true; }; @@ -2523,7 +2534,7 @@ void LLPanelFace::updateMediaSettings() // Auto scale - // set default to auto scale TRUE -- angela EXT-5172 + // set default to auto scale true -- angela EXT-5172 //value_bool = default_media_data.getAutoScale(); value_bool = true; struct functor_getter_auto_scale : public LLSelectedTEGetFunctor< bool > @@ -2536,7 +2547,7 @@ void LLPanelFace::updateMediaSettings() if (object->getTE(face)) if (object->getTE(face)->getMediaData()) return object->getTE(face)->getMediaData()->getAutoScale(); - // return mMediaEntry.getAutoScale(); set default to auto scale TRUE -- angela EXT-5172 + // return mMediaEntry.getAutoScale(); set default to auto scale true -- angela EXT-5172 return true; }; @@ -3221,9 +3232,9 @@ void LLPanelFace::onCommitGlow(LLUICtrl* ctrl, void* userdata) } // static -BOOL LLPanelFace::onDragPbr(LLUICtrl*, LLInventoryItem* item) +bool LLPanelFace::onDragPbr(LLUICtrl*, LLInventoryItem* item) { - BOOL accept = TRUE; + bool accept = true; for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin(); iter != LLSelectMgr::getInstance()->getSelection()->root_end(); iter++) { @@ -3231,7 +3242,7 @@ BOOL LLPanelFace::onDragPbr(LLUICtrl*, LLInventoryItem* item) LLViewerObject* obj = node->getObject(); if (!LLToolDragAndDrop::isInventoryDropAcceptable(obj, item)) { - accept = FALSE; + accept = false; break; } } @@ -3287,9 +3298,9 @@ void LLPanelFace::onSelectPbr(const LLSD& data) } // static -BOOL LLPanelFace::onDragTexture(LLUICtrl*, LLInventoryItem* item) +bool LLPanelFace::onDragTexture(LLUICtrl*, LLInventoryItem* item) { - BOOL accept = TRUE; + bool accept = true; for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin(); iter != LLSelectMgr::getInstance()->getSelection()->root_end(); iter++) { @@ -3297,7 +3308,7 @@ BOOL LLPanelFace::onDragTexture(LLUICtrl*, LLInventoryItem* item) LLViewerObject* obj = node->getObject(); if (!LLToolDragAndDrop::isInventoryDropAcceptable(obj, item)) { - accept = FALSE; + accept = false; break; } } @@ -3322,13 +3333,14 @@ void LLPanelFace::onSelectTexture(const LLSD& data) LLGLenum image_format; bool identical_image_format = false; - LLSelectedTE::getImageFormat(image_format, identical_image_format); + bool missing_asset = false; + LLSelectedTE::getImageFormat(image_format, identical_image_format, missing_asset); LLCtrlSelectionInterface* combobox_alphamode = childGetSelectionInterface("combobox alphamode"); U32 alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE; - if (combobox_alphamode) + if (combobox_alphamode && !missing_asset) { switch (image_format) { @@ -4683,7 +4695,7 @@ void LLPanelFace::onPasteTexture(LLViewerObject* objectp, S32 te) else if (full_perm) { // Either library, local or existed as fullperm when user made a copy - LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture(imageid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture(imageid, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); objectp->setTEImage(U8(te), image); } } @@ -5228,19 +5240,51 @@ void LLPanelFace::LLSelectedTE::getFace(LLFace*& face_to_return, bool& identical identical_face = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&get_te_face_func, face_to_return, false, (LLFace*)nullptr); } -void LLPanelFace::LLSelectedTE::getImageFormat(LLGLenum& image_format_to_return, bool& identical_face) +void LLPanelFace::LLSelectedTE::getImageFormat(LLGLenum& image_format_to_return, bool& identical_face, bool& missing_asset) { - LLGLenum image_format{}; - struct LLSelectedTEGetImageFormat : public LLSelectedTEGetFunctor<LLGLenum> + struct LLSelectedTEGetmatId : public LLSelectedTEFunctor { - LLGLenum get(LLViewerObject* object, S32 te_index) + LLSelectedTEGetmatId() + : mImageFormat(GL_RGB) + , mIdentical(true) + , mMissingAsset(false) + , mFirstRun(true) { - LLViewerTexture* image = object->getTEImage(te_index); - return image ? image->getPrimaryFormat() : GL_RGB; } - } get_glenum; - identical_face = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&get_glenum, image_format); - image_format_to_return = image_format; + bool apply(LLViewerObject* object, S32 te_index) override + { + LLViewerTexture* image = object ? object->getTEImage(te_index) : nullptr; + LLGLenum format = GL_RGB; + bool missing = false; + if (image) + { + format = image->getPrimaryFormat(); + missing = image->isMissingAsset(); + } + + if (mFirstRun) + { + mFirstRun = false; + mImageFormat = format; + mMissingAsset = missing; + } + else + { + mIdentical &= (mImageFormat == format); + mIdentical &= (mMissingAsset == missing); + } + return true; + } + LLGLenum mImageFormat; + bool mIdentical; + bool mMissingAsset; + bool mFirstRun; + } func; + LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func); + + image_format_to_return = func.mImageFormat; + identical_face = func.mIdentical; + missing_asset = func.mMissingAsset; } void LLPanelFace::LLSelectedTE::getTexId(LLUUID& id, bool& identical) diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 318c7ccd24..602b05d240 100644 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -100,7 +100,7 @@ public: class LLPanelFace : public LLPanel { public: - virtual BOOL postBuild(); + virtual bool postBuild(); LLPanelFace(); virtual ~LLPanelFace(); @@ -110,7 +110,7 @@ public: static void onMaterialOverrideReceived(const LLUUID& object_id, S32 side); - /*virtual*/ void onVisibilityChange(BOOL new_visibility); + /*virtual*/ void onVisibilityChange(bool new_visibility); /*virtual*/ void draw(); LLMaterialPtr createDefaultMaterial(LLMaterialPtr current_material) @@ -154,10 +154,10 @@ protected: void onCommitPbr(const LLSD& data); void onCancelPbr(const LLSD& data); void onSelectPbr(const LLSD& data); - static BOOL onDragPbr(LLUICtrl* ctrl, LLInventoryItem* item); + static bool onDragPbr(LLUICtrl* ctrl, LLInventoryItem* item); - // this function is to return TRUE if the drag should succeed. - static BOOL onDragTexture(LLUICtrl* ctrl, LLInventoryItem* item); + // this function is to return true if the drag should succeed. + static bool onDragTexture(LLUICtrl* ctrl, LLInventoryItem* item); void onCommitTexture(const LLSD& data); void onCancelTexture(const LLSD& data); @@ -600,7 +600,7 @@ public: { public: static void getFace(class LLFace*& face_to_return, bool& identical_face); - static void getImageFormat(LLGLenum& image_format_to_return, bool& identical_face); + static void getImageFormat(LLGLenum& image_format_to_return, bool& identical_face, bool& missing_asset); static void getTexId(LLUUID& id, bool& identical); static void getPbrMaterialId(LLUUID& id, bool& identical, bool& has_pbr, bool& has_faces_without_pbr); static void getObjectScaleS(F32& scale_s, bool& identical); diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp index 372f1a9d20..519f157973 100644 --- a/indra/newview/llpanelgroup.cpp +++ b/indra/newview/llpanelgroup.cpp @@ -62,8 +62,8 @@ static LLPanelInjector<LLPanelGroup> t_panel_group("panel_group_info_sidetray"); LLPanelGroupTab::LLPanelGroupTab() : LLPanel(), - mAllowEdit(TRUE), - mHasModal(FALSE) + mAllowEdit(true), + mHasModal(false) { mGroupID = LLUUID::null; } @@ -72,21 +72,21 @@ LLPanelGroupTab::~LLPanelGroupTab() { } -BOOL LLPanelGroupTab::isVisibleByAgent(LLAgent* agentp) +bool LLPanelGroupTab::isVisibleByAgent(LLAgent* agentp) { //default to being visible - return TRUE; + return true; } -BOOL LLPanelGroupTab::postBuild() +bool LLPanelGroupTab::postBuild() { - return TRUE; + return true; } LLPanelGroup::LLPanelGroup() : LLPanel(), LLGroupMgrObserver( LLUUID() ), - mSkipRefresh(FALSE), + mSkipRefresh(false), mButtonJoin(NULL) { // Set up the factory callbacks. @@ -146,7 +146,7 @@ void LLPanelGroup::onOpen(const LLSD& key) } -BOOL LLPanelGroup::postBuild() +bool LLPanelGroup::postBuild() { mDefaultNeedsApplyMesg = getString("default_needs_apply_text"); mWantApplyMesg = getString("want_apply_text"); @@ -196,7 +196,7 @@ BOOL LLPanelGroup::postBuild() LLVoiceClient::getInstance()->addObserver(this); - return TRUE; + return true; } void LLPanelGroup::reposButton(const std::string& name) @@ -230,7 +230,7 @@ void LLPanelGroup::reposButtons() reposButton("btn_call"); } -void LLPanelGroup::reshape(S32 width, S32 height, BOOL called_from_parent ) +void LLPanelGroup::reshape(S32 width, S32 height, bool called_from_parent ) { LLPanel::reshape(width, height, called_from_parent ); @@ -507,7 +507,7 @@ bool LLPanelGroup::apply(LLPanelGroupTab* tab) } } - mSkipRefresh = TRUE; + mSkipRefresh = true; return true; } @@ -560,7 +560,7 @@ void LLPanelGroup::refreshData() { if(mSkipRefresh) { - mSkipRefresh = FALSE; + mSkipRefresh = false; return; } LLGroupMgr::getInstance()->clearGroupData(getID()); diff --git a/indra/newview/llpanelgroup.h b/indra/newview/llpanelgroup.h index ddc1613fb6..ede8118720 100644 --- a/indra/newview/llpanelgroup.h +++ b/indra/newview/llpanelgroup.h @@ -49,7 +49,7 @@ public: LLPanelGroup(); virtual ~LLPanelGroup(); - virtual BOOL postBuild(); + virtual bool postBuild(); void setGroupID(const LLUUID& group_id); @@ -77,7 +77,7 @@ public: void callGroup(); void chatGroup(); - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + virtual void reshape(S32 width, S32 height, bool called_from_parent = true); static void showNotice(const std::string& subject, const std::string& message, @@ -107,7 +107,7 @@ protected: LLTimer mRefreshTimer; - BOOL mSkipRefresh; + bool mSkipRefresh; std::string mDefaultNeedsApplyMesg; std::string mWantApplyMesg; @@ -135,7 +135,7 @@ public: virtual bool needsApply(std::string& mesg) { return false; } // Asks if there is currently a modal dialog being shown. - virtual BOOL hasModal() { return mHasModal; } + virtual bool hasModal() { return mHasModal; } // Request to apply current data. // If returning fail, this function should modify the message to the user. @@ -148,9 +148,9 @@ public: virtual void update(LLGroupChange gc) { } // This just connects the help button callback. - virtual BOOL postBuild(); + virtual bool postBuild(); - virtual BOOL isVisibleByAgent(LLAgent* agentp); + virtual bool isVisibleByAgent(LLAgent* agentp); virtual void setGroupID(const LLUUID& id) {mGroupID = id;}; @@ -164,8 +164,8 @@ public: protected: LLUUID mGroupID; - BOOL mAllowEdit; - BOOL mHasModal; + bool mAllowEdit; + bool mHasModal; }; #endif // LL_LLPANELGROUP_H diff --git a/indra/newview/llpanelgroupbulk.cpp b/indra/newview/llpanelgroupbulk.cpp index e2758524f3..f54ec45a3c 100644 --- a/indra/newview/llpanelgroupbulk.cpp +++ b/indra/newview/llpanelgroupbulk.cpp @@ -93,7 +93,7 @@ void LLPanelGroupBulkImpl::callbackClickAdd(void* userdata) LLView* button = panelp->findChild<LLButton>("add_button"); LLFloater* root_floater = gFloaterView->getParentFloater(panelp); LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show( - boost::bind(callbackAddUsers, _1, panelp->mImplementation), TRUE, FALSE, FALSE, root_floater->getName(), button); + boost::bind(callbackAddUsers, _1, panelp->mImplementation), true, false, false, root_floater->getName(), button); if(picker) { root_floater->addDependentFloater(picker); @@ -181,12 +181,12 @@ void LLPanelGroupBulkImpl::handleRemove() } mBulkAgentList->deleteSelectedItems(); - mRemoveButton->setEnabled(FALSE); + mRemoveButton->setEnabled(false); if( mOKButton && mOKButton->getEnabled() && mBulkAgentList->isEmpty()) { - mOKButton->setEnabled(FALSE); + mOKButton->setEnabled(false); } } @@ -194,9 +194,9 @@ void LLPanelGroupBulkImpl::handleSelection() { std::vector<LLScrollListItem*> selection = mBulkAgentList->getAllSelected(); if (selection.empty()) - mRemoveButton->setEnabled(FALSE); + mRemoveButton->setEnabled(false); else - mRemoveButton->setEnabled(TRUE); + mRemoveButton->setEnabled(true); } void LLPanelGroupBulkImpl::addUsers(const std::vector<std::string>& names, const uuid_vec_t& agent_ids) @@ -241,7 +241,7 @@ void LLPanelGroupBulkImpl::addUsers(const std::vector<std::string>& names, const // We've successfully added someone to the list. if(mOKButton && !mOKButton->getEnabled()) - mOKButton->setEnabled(TRUE); + mOKButton->setEnabled(true); } } @@ -273,7 +273,7 @@ void LLPanelGroupBulk::clear() mImplementation->mBulkAgentList->deleteAllItems(); if(mImplementation->mOKButton) - mImplementation->mOKButton->setEnabled(FALSE); + mImplementation->mOKButton->setEnabled(false); } void LLPanelGroupBulk::update() diff --git a/indra/newview/llpanelgroupbulkban.cpp b/indra/newview/llpanelgroupbulkban.cpp index 6a17a6e56d..3c764887a6 100644 --- a/indra/newview/llpanelgroupbulkban.cpp +++ b/indra/newview/llpanelgroupbulkban.cpp @@ -55,16 +55,16 @@ LLPanelGroupBulkBan::LLPanelGroupBulkBan(const LLUUID& group_id) : LLPanelGroupB buildFromFile( "panel_group_bulk_ban.xml"); } -BOOL LLPanelGroupBulkBan::postBuild() +bool LLPanelGroupBulkBan::postBuild() { - BOOL recurse = TRUE; + constexpr bool recurse = true; mImplementation->mLoadingText = getString("loading"); mImplementation->mGroupName = getChild<LLTextBox>("group_name_text", recurse); mImplementation->mBulkAgentList = getChild<LLNameListCtrl>("banned_agent_list", recurse); if ( mImplementation->mBulkAgentList ) { - mImplementation->mBulkAgentList->setCommitOnSelectionChange(TRUE); + mImplementation->mBulkAgentList->setCommitOnSelectionChange(true); mImplementation->mBulkAgentList->setCommitCallback(LLPanelGroupBulkImpl::callbackSelect, mImplementation); } @@ -81,7 +81,7 @@ BOOL LLPanelGroupBulkBan::postBuild() if ( mImplementation->mRemoveButton ) { mImplementation->mRemoveButton->setClickedCallback(LLPanelGroupBulkImpl::callbackClickRemove, mImplementation); - mImplementation->mRemoveButton->setEnabled(FALSE); + mImplementation->mRemoveButton->setEnabled(false); } mImplementation->mOKButton = @@ -89,7 +89,7 @@ BOOL LLPanelGroupBulkBan::postBuild() if ( mImplementation->mOKButton ) { mImplementation->mOKButton->setClickedCallback(LLPanelGroupBulkBan::callbackClickSubmit, this); - mImplementation->mOKButton->setEnabled(FALSE); + mImplementation->mOKButton->setEnabled(false); } button = getChild<LLButton>("cancel_button", recurse); @@ -104,7 +104,7 @@ BOOL LLPanelGroupBulkBan::postBuild() mImplementation->mCannotBanYourself = getString("cant_ban_yourself"); update(); - return TRUE; + return true; } // TODO: Refactor the shitty callback functions with void* -- just use boost::bind to call submit() instead. @@ -161,12 +161,12 @@ void LLPanelGroupBulkBan::submit() // remove already banned users and yourself from request. std::vector<LLAvatarName> banned_avatar_names; std::vector<LLAvatarName> out_of_limit_names; - bool banning_self{ false }; - std::vector<LLUUID>::iterator conflict = std::find(banned_agent_list.begin(), banned_agent_list.end(), gAgentID); + bool banning_self = false; + std::vector<LLUUID>::iterator conflict = std::find(banned_agent_list.begin(), banned_agent_list.end(), gAgent.getID()); if (conflict != banned_agent_list.end()) { banned_agent_list.erase(conflict); - banning_self = TRUE; + banning_self = true; } if (group_datap) { diff --git a/indra/newview/llpanelgroupbulkban.h b/indra/newview/llpanelgroupbulkban.h index d7b2ed6e67..db4af1ccd3 100644 --- a/indra/newview/llpanelgroupbulkban.h +++ b/indra/newview/llpanelgroupbulkban.h @@ -38,7 +38,7 @@ public: LLPanelGroupBulkBan(const LLUUID& group_id); ~LLPanelGroupBulkBan() {} - virtual BOOL postBuild(); + virtual bool postBuild(); static void callbackClickSubmit(void* userdata); virtual void submit(); diff --git a/indra/newview/llpanelgroupcreate.cpp b/indra/newview/llpanelgroupcreate.cpp index 1b8947caee..4a370525ff 100644 --- a/indra/newview/llpanelgroupcreate.cpp +++ b/indra/newview/llpanelgroupcreate.cpp @@ -66,28 +66,28 @@ LLPanelGroupCreate::~LLPanelGroupCreate() { } -BOOL LLPanelGroupCreate::postBuild() +bool LLPanelGroupCreate::postBuild() { childSetCommitCallback("back", boost::bind(&LLPanelGroupCreate::onBackBtnClick, this), NULL); - mComboMature = getChild<LLComboBox>("group_mature_check", TRUE); - mCtrlOpenEnrollment = getChild<LLCheckBoxCtrl>("open_enrollement", TRUE); - mCtrlEnrollmentFee = getChild<LLCheckBoxCtrl>("check_enrollment_fee", TRUE); - mEditCharter = getChild<LLTextEditor>("charter", TRUE); - mSpinEnrollmentFee = getChild<LLSpinCtrl>("spin_enrollment_fee", TRUE); - mMembershipList = getChild<LLScrollListCtrl>("membership_list", TRUE); + mComboMature = getChild<LLComboBox>("group_mature_check", true); + mCtrlOpenEnrollment = getChild<LLCheckBoxCtrl>("open_enrollement", true); + mCtrlEnrollmentFee = getChild<LLCheckBoxCtrl>("check_enrollment_fee", true); + mEditCharter = getChild<LLTextEditor>("charter", true); + mSpinEnrollmentFee = getChild<LLSpinCtrl>("spin_enrollment_fee", true); + mMembershipList = getChild<LLScrollListCtrl>("membership_list", true); - mCreateButton = getChild<LLButton>("btn_create", TRUE); + mCreateButton = getChild<LLButton>("btn_create", true); mCreateButton->setCommitCallback(boost::bind(&LLPanelGroupCreate::onBtnCreate, this)); - mGroupNameEditor = getChild<LLLineEditor>("group_name_editor", TRUE); + mGroupNameEditor = getChild<LLLineEditor>("group_name_editor", true); mGroupNameEditor->setPrevalidate(LLTextValidate::validateASCIINoLeadingSpace); - mInsignia = getChild<LLTextureCtrl>("insignia", TRUE); - mInsignia->setAllowLocalTexture(FALSE); - mInsignia->setCanApplyImmediately(FALSE); + mInsignia = getChild<LLTextureCtrl>("insignia", true); + mInsignia->setAllowLocalTexture(false); + mInsignia->setCanApplyImmediately(false); - return TRUE; + return true; } void LLPanelGroupCreate::onOpen(const LLSD& key) @@ -97,8 +97,8 @@ void LLPanelGroupCreate::onOpen(const LLSD& key) mGroupNameEditor->clear(); mEditCharter->clear(); mSpinEnrollmentFee->set(0.f); - mCtrlEnrollmentFee->set(FALSE); - mCtrlOpenEnrollment->set(FALSE); + mCtrlEnrollmentFee->set(false); + mCtrlOpenEnrollment->set(false); mMembershipList->clearRows(); // populate list @@ -194,7 +194,7 @@ void LLPanelGroupCreate::onBtnCreate() // Validate the group name length. std::string gr_name = mGroupNameEditor->getText(); LLStringUtil::trim(gr_name); - S32 group_name_len = gr_name.size(); + S32 group_name_len = static_cast<S32>(gr_name.size()); if (group_name_len < DB_GROUP_NAME_MIN_LEN || group_name_len > DB_GROUP_NAME_STR_LEN) { diff --git a/indra/newview/llpanelgroupcreate.h b/indra/newview/llpanelgroupcreate.h index 239258f074..116621f58f 100644 --- a/indra/newview/llpanelgroupcreate.h +++ b/indra/newview/llpanelgroupcreate.h @@ -46,9 +46,9 @@ public: LLPanelGroupCreate(); virtual ~LLPanelGroupCreate(); - virtual BOOL postBuild(); + bool postBuild() override; - void onOpen(const LLSD& key); + void onOpen(const LLSD& key) override; static void refreshCreatedGroup(const LLUUID& group_id); diff --git a/indra/newview/llpanelgroupexperiences.cpp b/indra/newview/llpanelgroupexperiences.cpp index 5f564fc870..99c40984a5 100644 --- a/indra/newview/llpanelgroupexperiences.cpp +++ b/indra/newview/llpanelgroupexperiences.cpp @@ -50,7 +50,7 @@ LLPanelGroupExperiences::~LLPanelGroupExperiences() { } -BOOL LLPanelGroupExperiences::postBuild() +bool LLPanelGroupExperiences::postBuild() { mExperiencesList = getChild<LLFlatListView>("experiences_list"); if (hasString("loading_experiences")) diff --git a/indra/newview/llpanelgroupexperiences.h b/indra/newview/llpanelgroupexperiences.h index caf91015ec..77c3750174 100644 --- a/indra/newview/llpanelgroupexperiences.h +++ b/indra/newview/llpanelgroupexperiences.h @@ -40,7 +40,7 @@ public: // LLPanelGroupTab virtual void activate(); - virtual BOOL postBuild(); + virtual bool postBuild(); virtual void setGroupID(const LLUUID& id); diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp index 9c6f16ee9e..ca429ae2f8 100644 --- a/indra/newview/llpanelgroupgeneral.cpp +++ b/indra/newview/llpanelgroupgeneral.cpp @@ -64,8 +64,8 @@ const S32 DECLINE_TO_STATE = 0; LLPanelGroupGeneral::LLPanelGroupGeneral() : LLPanelGroupTab(), - mChanged(FALSE), - mFirstUse(TRUE), + mChanged(false), + mFirstUse(true), mGroupNameEditor(NULL), mFounderName(NULL), mInsignia(NULL), @@ -87,9 +87,9 @@ LLPanelGroupGeneral::~LLPanelGroupGeneral() { } -BOOL LLPanelGroupGeneral::postBuild() +bool LLPanelGroupGeneral::postBuild() { - bool recurse = true; + constexpr bool recurse = true; mEditCharter = getChild<LLTextEditor>("charter", recurse); if(mEditCharter) @@ -115,7 +115,7 @@ BOOL LLPanelGroupGeneral::postBuild() if (gAgent.isTeen()) { // Teens don't get to set mature flag. JC - mComboMature->setVisible(FALSE); + mComboMature->setVisible(false); mComboMature->setCurrentByIndex(NON_MATURE_CONTENT); } } @@ -139,8 +139,8 @@ BOOL LLPanelGroupGeneral::postBuild() mSpinEnrollmentFee->resetDirty(); } - BOOL accept_notices = FALSE; - BOOL list_in_profile = FALSE; + bool accept_notices = false; + bool list_in_profile = false; LLGroupData data; if(gAgent.getGroupData(mGroupID,data)) { @@ -177,13 +177,13 @@ BOOL LLPanelGroupGeneral::postBuild() // If the group_id is null, then we are creating a new group if (mGroupID.isNull()) { - mEditCharter->setEnabled(TRUE); + mEditCharter->setEnabled(true); - mCtrlShowInGroupList->setEnabled(TRUE); - mComboMature->setEnabled(TRUE); - mCtrlOpenEnrollment->setEnabled(TRUE); - mCtrlEnrollmentFee->setEnabled(TRUE); - mSpinEnrollmentFee->setEnabled(TRUE); + mCtrlShowInGroupList->setEnabled(true); + mComboMature->setEnabled(true); + mCtrlOpenEnrollment->setEnabled(true); + mCtrlEnrollmentFee->setEnabled(true); + mSpinEnrollmentFee->setEnabled(true); } @@ -196,7 +196,7 @@ void LLPanelGroupGeneral::setupCtrls(LLPanel* panel_group) if (mInsignia) { mInsignia->setCommitCallback(onCommitAny, this); - mInsignia->setAllowLocalTexture(FALSE); + mInsignia->setAllowLocalTexture(false); } mFounderName = getChild<LLTextBox>("founder_name"); @@ -227,7 +227,7 @@ void LLPanelGroupGeneral::onCommitAny(LLUICtrl* ctrl, void* data) void LLPanelGroupGeneral::onCommitUserOnly(LLUICtrl* ctrl, void* data) { LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)data; - self->mChanged = TRUE; + self->mChanged = true; self->notifyObservers(); } @@ -253,11 +253,11 @@ void LLPanelGroupGeneral::onCommitEnrollment(LLUICtrl* ctrl, void* data) if (self->mCtrlEnrollmentFee->get()) { - self->mSpinEnrollmentFee->setEnabled(TRUE); + self->mSpinEnrollmentFee->setEnabled(true); } else { - self->mSpinEnrollmentFee->setEnabled(FALSE); + self->mSpinEnrollmentFee->setEnabled(false); self->mSpinEnrollmentFee->set(0); } } @@ -291,9 +291,9 @@ void LLPanelGroupGeneral::activate() LLGroupMgr::getInstance()->sendGroupTitlesRequest(mGroupID); LLGroupMgr::getInstance()->sendGroupPropertiesRequest(mGroupID); - mFirstUse = FALSE; + mFirstUse = false; } - mChanged = FALSE; + mChanged = false; update(GC_ALL); } @@ -317,7 +317,7 @@ bool LLPanelGroupGeneral::apply(std::string& mesg) mComboActiveTitle->resetDirty(); } - BOOL has_power_in_group = gAgent.hasPowerInGroup(mGroupID,GP_GROUP_CHANGE_IDENTITY); + bool has_power_in_group = gAgent.hasPowerInGroup(mGroupID,GP_GROUP_CHANGE_IDENTITY); if (has_power_in_group) { @@ -357,7 +357,7 @@ bool LLPanelGroupGeneral::apply(std::string& mesg) } else { - gdatap->mMaturePublish = FALSE; + gdatap->mMaturePublish = false; } } if (mCtrlShowInGroupList) gdatap->mShowInList = mCtrlShowInGroupList->get(); @@ -381,8 +381,8 @@ bool LLPanelGroupGeneral::apply(std::string& mesg) } } - BOOL receive_notices = false; - BOOL list_in_profile = false; + bool receive_notices = false; + bool list_in_profile = false; if (mCtrlReceiveNotices) receive_notices = mCtrlReceiveNotices->get(); if (mCtrlListGroup) @@ -392,14 +392,14 @@ bool LLPanelGroupGeneral::apply(std::string& mesg) resetDirty(); - mChanged = FALSE; + mChanged = false; return true; } void LLPanelGroupGeneral::cancel() { - mChanged = FALSE; + mChanged = false; //cancel out all of the click changes to, although since we are //shifting tabs or closing the floater, this need not be done...yet @@ -469,11 +469,11 @@ void LLPanelGroupGeneral::update(LLGroupChange gc) if (1 == gdatap->mTitles.size()) { // Only the everyone title. Don't bother letting them try changing this. - mComboActiveTitle->setEnabled(FALSE); + mComboActiveTitle->setEnabled(false); } else { - mComboActiveTitle->setEnabled(TRUE); + mComboActiveTitle->setEnabled(true); } std::vector<LLGroupTitle>::const_iterator citer = gdatap->mTitles.begin(); @@ -560,7 +560,7 @@ void LLPanelGroupGeneral::update(LLGroupChange gc) if (mInsignia) mInsignia->setEnabled(mAllowEdit && can_change_ident); if (mEditCharter) mEditCharter->setEnabled(mAllowEdit && can_change_ident); - if (mGroupNameEditor) mGroupNameEditor->setVisible(FALSE); + if (mGroupNameEditor) mGroupNameEditor->setVisible(false); if (mFounderName) mFounderName->setText(LLSLURL("agent", gdatap->mFounderID, "inspect").getSLURLString()); if (mInsignia) { @@ -603,13 +603,13 @@ void LLPanelGroupGeneral::updateChanged() mComboActiveTitle }; - mChanged = FALSE; + mChanged = false; for( size_t i=0; i<LL_ARRAY_SIZE(check_list); i++ ) { if( check_list[i] && check_list[i]->isDirty() ) { - mChanged = TRUE; + mChanged = true; break; } } @@ -630,17 +630,17 @@ void LLPanelGroupGeneral::reset() mCtrlListGroup->setEnabled(false); - mGroupNameEditor->setEnabled(TRUE); - mEditCharter->setEnabled(TRUE); + mGroupNameEditor->setEnabled(true); + mEditCharter->setEnabled(true); mCtrlShowInGroupList->setEnabled(false); - mComboMature->setEnabled(TRUE); + mComboMature->setEnabled(true); - mCtrlOpenEnrollment->setEnabled(TRUE); + mCtrlOpenEnrollment->setEnabled(true); - mCtrlEnrollmentFee->setEnabled(TRUE); + mCtrlEnrollmentFee->setEnabled(true); - mSpinEnrollmentFee->setEnabled(TRUE); + mSpinEnrollmentFee->setEnabled(true); mSpinEnrollmentFee->set((F32)0); mGroupNameEditor->setVisible(true); @@ -708,8 +708,8 @@ void LLPanelGroupGeneral::setGroupID(const LLUUID& id) return; } - BOOL accept_notices = FALSE; - BOOL list_in_profile = FALSE; + bool accept_notices = false; + bool list_in_profile = false; LLGroupData data; if(gAgent.getGroupData(mGroupID,data)) { diff --git a/indra/newview/llpanelgroupgeneral.h b/indra/newview/llpanelgroupgeneral.h index 487d6501a7..e5d766dc40 100644 --- a/indra/newview/llpanelgroupgeneral.h +++ b/indra/newview/llpanelgroupgeneral.h @@ -54,7 +54,7 @@ public: virtual void update(LLGroupChange gc); - virtual BOOL postBuild(); + virtual bool postBuild(); virtual void draw(); @@ -78,8 +78,8 @@ private: void updateChanged(); bool confirmMatureApply(const LLSD& notification, const LLSD& response); - BOOL mChanged; - BOOL mFirstUse; + bool mChanged; + bool mFirstUse; std::string mIncompleteMemberDataStr; // Group information (include any updates in updateChanged) diff --git a/indra/newview/llpanelgroupinvite.cpp b/indra/newview/llpanelgroupinvite.cpp index 5327e21571..8a6876f8fc 100644 --- a/indra/newview/llpanelgroupinvite.cpp +++ b/indra/newview/llpanelgroupinvite.cpp @@ -253,7 +253,7 @@ void LLPanelGroupInvite::impl::addRoleNames(LLGroupMgrGroupData* gdatap) //else if they have the limited add to roles power //we add every role the user is in, //else we just add to everyone - bool is_owner = FALSE; + bool is_owner = false; bool can_assign_any = gAgent.hasPowerInGroup(mGroupID, GP_ROLE_ASSIGN_MEMBER); bool can_assign_limited = gAgent.hasPowerInGroup(mGroupID, @@ -314,7 +314,7 @@ void LLPanelGroupInvite::impl::callbackClickAdd(void* userdata) LLView * button = panelp->findChild<LLButton>("add_button"); LLFloater * root_floater = gFloaterView->getParentFloater(panelp); LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show( - boost::bind(impl::callbackAddUsers, _1, panelp->mImplementation), TRUE, FALSE, FALSE, root_floater->getName(), button); + boost::bind(impl::callbackAddUsers, _1, panelp->mImplementation), true, false, false, root_floater->getName(), button); if (picker) { root_floater->addDependentFloater(picker); @@ -345,7 +345,7 @@ void LLPanelGroupInvite::impl::handleRemove() // Remove all selected invitees. mInvitees->deleteSelectedItems(); - mRemoveButton->setEnabled(FALSE); + mRemoveButton->setEnabled(false); } // static @@ -363,11 +363,11 @@ void LLPanelGroupInvite::impl::handleSelection() mInvitees->getAllSelected(); if (selection.empty()) { - mRemoveButton->setEnabled(FALSE); + mRemoveButton->setEnabled(false); } else { - mRemoveButton->setEnabled(TRUE); + mRemoveButton->setEnabled(true); } } @@ -443,7 +443,7 @@ void LLPanelGroupInvite::impl::onAvatarNameCache(const LLUUID& agent_id, LLPanelGroupInvite::LLPanelGroupInvite(const LLUUID& group_id) : LLPanel(), mImplementation(new impl(group_id)), - mPendingUpdate(FALSE) + mPendingUpdate(false) { // Pass on construction of this panel to the control factory. buildFromFile( "panel_group_invite.xml"); @@ -467,7 +467,7 @@ void LLPanelGroupInvite::clear() mImplementation->mInvitees->deleteAllItems(); mImplementation->mRoleNames->clear(); mImplementation->mRoleNames->removeall(); - mImplementation->mOKButton->setEnabled(FALSE); + mImplementation->mOKButton->setEnabled(false); mImplementation->mInviteeIDs.clear(); } @@ -544,7 +544,7 @@ void LLPanelGroupInvite::draw() void LLPanelGroupInvite::update() { - mPendingUpdate = FALSE; + mPendingUpdate = false; if (mImplementation->mGroupName) { mImplementation->mGroupName->setText(mImplementation->mLoadingText); @@ -630,21 +630,21 @@ void LLPanelGroupInvite::updateLists() LLGroupMgr::getInstance()->sendCapGroupMembersRequest(mImplementation->mGroupID); } } - mPendingUpdate = TRUE; + mPendingUpdate = true; } else { - mPendingUpdate = FALSE; + mPendingUpdate = false; if (mImplementation->mOKButton && mImplementation->mRoleNames->getItemCount()) { - mImplementation->mOKButton->setEnabled(TRUE); + mImplementation->mOKButton->setEnabled(true); } } } -BOOL LLPanelGroupInvite::postBuild() +bool LLPanelGroupInvite::postBuild() { - BOOL recurse = TRUE; + constexpr bool recurse = true; mImplementation->mLoadingText = getString("loading"); mImplementation->mRoleNames = getChild<LLComboBox>("role_name", @@ -654,7 +654,7 @@ BOOL LLPanelGroupInvite::postBuild() getChild<LLNameListCtrl>("invitee_list", recurse); if ( mImplementation->mInvitees ) { - mImplementation->mInvitees->setCommitOnSelectionChange(TRUE); + mImplementation->mInvitees->setCommitOnSelectionChange(true); mImplementation->mInvitees->setCommitCallback(impl::callbackSelect, mImplementation); } @@ -671,7 +671,7 @@ BOOL LLPanelGroupInvite::postBuild() if ( mImplementation->mRemoveButton ) { mImplementation->mRemoveButton->setClickedCallback(impl::callbackClickRemove, mImplementation); - mImplementation->mRemoveButton->setEnabled(FALSE); + mImplementation->mRemoveButton->setEnabled(false); } mImplementation->mOKButton = @@ -679,7 +679,7 @@ BOOL LLPanelGroupInvite::postBuild() if ( mImplementation->mOKButton ) { mImplementation->mOKButton->setClickedCallback(impl::callbackClickOK, mImplementation); - mImplementation->mOKButton->setEnabled(FALSE); + mImplementation->mOKButton->setEnabled(false); } button = getChild<LLButton>("cancel_button", recurse); diff --git a/indra/newview/llpanelgroupinvite.h b/indra/newview/llpanelgroupinvite.h index e79f81226b..08b7996246 100644 --- a/indra/newview/llpanelgroupinvite.h +++ b/indra/newview/llpanelgroupinvite.h @@ -43,18 +43,18 @@ public: * this callback is being used to add a user whose fullname isn't been loaded before invoking of addUsers(). */ void addUserCallback(const LLUUID& id, const LLAvatarName& av_name); - void clear(); + void clear() override; void update(); void setCloseCallback(void (*close_callback)(void*), void* data); - virtual void draw(); - virtual BOOL postBuild(); + void draw() override; + bool postBuild() override; protected: class impl; impl* mImplementation; - BOOL mPendingUpdate; + bool mPendingUpdate; LLUUID mStoreSelected; void updateLists(); }; diff --git a/indra/newview/llpanelgrouplandmoney.cpp b/indra/newview/llpanelgrouplandmoney.cpp index f104eb12c3..987782836b 100644 --- a/indra/newview/llpanelgrouplandmoney.cpp +++ b/indra/newview/llpanelgrouplandmoney.cpp @@ -674,7 +674,7 @@ void LLPanelGroupLandMoney::cancel() } -BOOL LLPanelGroupLandMoney::postBuild() +bool LLPanelGroupLandMoney::postBuild() { /* This power was removed to make group roles simpler bool has_parcel_view = gAgent.hasPowerInGroup(mGroupID, @@ -722,12 +722,12 @@ BOOL LLPanelGroupLandMoney::postBuild() if ( mImplementationp->mGroupOverLimitTextp ) { - mImplementationp->mGroupOverLimitTextp->setVisible(FALSE); + mImplementationp->mGroupOverLimitTextp->setVisible(false); } if ( mImplementationp->mGroupOverLimitIconp ) { - mImplementationp->mGroupOverLimitIconp->setVisible(FALSE); + mImplementationp->mGroupOverLimitIconp->setVisible(false); } if ( !can_view ) @@ -736,7 +736,7 @@ BOOL LLPanelGroupLandMoney::postBuild() { mImplementationp->mGroupParcelsp->setCommentText( mImplementationp->mCantViewParcelsText); - mImplementationp->mGroupParcelsp->setEnabled(FALSE); + mImplementationp->mGroupParcelsp->setEnabled(false); } } @@ -831,7 +831,7 @@ void LLPanelGroupLandMoney::onLandSelectionChanged() mImplementationp->mMapButtonp->setEnabled( mImplementationp->mGroupParcelsp->getItemCount() > 0 ); } -BOOL LLPanelGroupLandMoney::isVisibleByAgent(LLAgent* agentp) +bool LLPanelGroupLandMoney::isVisibleByAgent(LLAgent* agentp) { return mAllowEdit && agentp->isInGroup(mGroupID); } @@ -1557,12 +1557,12 @@ void LLPanelGroupLandMoney::setGroupID(const LLUUID& id) if ( mImplementationp->mGroupOverLimitTextp ) { - mImplementationp->mGroupOverLimitTextp->setVisible(FALSE); + mImplementationp->mGroupOverLimitTextp->setVisible(false); } if ( mImplementationp->mGroupOverLimitIconp ) { - mImplementationp->mGroupOverLimitIconp->setVisible(FALSE); + mImplementationp->mGroupOverLimitIconp->setVisible(false); } if ( mImplementationp->mGroupParcelsp ) @@ -1572,7 +1572,7 @@ void LLPanelGroupLandMoney::setGroupID(const LLUUID& id) if ( !can_view && mImplementationp->mGroupParcelsp ) { - mImplementationp->mGroupParcelsp->setEnabled(FALSE); + mImplementationp->mGroupParcelsp->setEnabled(false); } diff --git a/indra/newview/llpanelgrouplandmoney.h b/indra/newview/llpanelgrouplandmoney.h index 0147acd768..d619e1be0a 100644 --- a/indra/newview/llpanelgrouplandmoney.h +++ b/indra/newview/llpanelgrouplandmoney.h @@ -36,8 +36,8 @@ class LLPanelGroupLandMoney : public LLPanelGroupTab public: LLPanelGroupLandMoney(); virtual ~LLPanelGroupLandMoney(); - virtual BOOL postBuild(); - virtual BOOL isVisibleByAgent(LLAgent* agentp); + virtual bool postBuild(); + virtual bool isVisibleByAgent(LLAgent* agentp); virtual void activate(); virtual bool needsApply(std::string& mesg); diff --git a/indra/newview/llpanelgroupnotices.cpp b/indra/newview/llpanelgroupnotices.cpp index 3b7e4075c6..483c6876ed 100644 --- a/indra/newview/llpanelgroupnotices.cpp +++ b/indra/newview/llpanelgroupnotices.cpp @@ -89,11 +89,9 @@ public: LLGroupDropTarget(const Params&); ~LLGroupDropTarget() {}; - void doDrop(EDragAndDropType cargo_type, void* cargo_data); - // // LLView functionality - virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + virtual bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -114,23 +112,18 @@ LLGroupDropTarget::LLGroupDropTarget(const LLGroupDropTarget::Params& p) mGroupID(p.group_id) {} -void LLGroupDropTarget::doDrop(EDragAndDropType cargo_type, void* cargo_data) -{ - LL_INFOS() << "LLGroupDropTarget::doDrop()" << LL_ENDL; -} - -BOOL LLGroupDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +bool LLGroupDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) { - BOOL handled = FALSE; + bool handled = false; if (!gAgent.hasPowerInGroup(mGroupID,GP_NOTICES_SEND)) { *accept = ACCEPT_NO; - return TRUE; + return true; } if(getParent()) @@ -138,7 +131,7 @@ BOOL LLGroupDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, // check if inside //LLRect parent_rect = mParentView->getRect(); //getRect().set(0, parent_rect.getHeight(), parent_rect.getWidth(), 0); - handled = TRUE; + handled = true; // check the type switch(cargo_type) @@ -237,18 +230,18 @@ LLPanelGroupNotices::~LLPanelGroupNotices() } -BOOL LLPanelGroupNotices::isVisibleByAgent(LLAgent* agentp) +bool LLPanelGroupNotices::isVisibleByAgent(LLAgent* agentp) { return mAllowEdit && agentp->hasPowerInGroup(mGroupID, GP_NOTICES_SEND | GP_NOTICES_RECEIVE); } -BOOL LLPanelGroupNotices::postBuild() +bool LLPanelGroupNotices::postBuild() { - bool recurse = true; + constexpr bool recurse = true; mNoticesList = getChild<LLScrollListCtrl>("notice_list",recurse); - mNoticesList->setCommitOnSelectionChange(TRUE); + mNoticesList->setCommitOnSelectionChange(true); mNoticesList->setCommitCallback(onSelectNotice, this); mNoticesList->sortByColumn("date", false); @@ -264,29 +257,29 @@ BOOL LLPanelGroupNotices::postBuild() mCreateMessage = getChild<LLTextEditor>("create_message",recurse); mCreateInventoryName = getChild<LLLineEditor>("create_inventory_name",recurse); - mCreateInventoryName->setTabStop(FALSE); - mCreateInventoryName->setEnabled(FALSE); + mCreateInventoryName->setTabStop(false); + mCreateInventoryName->setEnabled(false); mCreateInventoryIcon = getChild<LLIconCtrl>("create_inv_icon",recurse); - mCreateInventoryIcon->setVisible(FALSE); + mCreateInventoryIcon->setVisible(false); mBtnSendMessage = getChild<LLButton>("send_notice",recurse); mBtnSendMessage->setClickedCallback(onClickSendMessage, this); mBtnRemoveAttachment = getChild<LLButton>("remove_attachment",recurse); mBtnRemoveAttachment->setClickedCallback(onClickRemoveAttachment, this); - mBtnRemoveAttachment->setEnabled(FALSE); + mBtnRemoveAttachment->setEnabled(false); // View mViewSubject = getChild<LLLineEditor>("view_subject",recurse); mViewMessage = getChild<LLTextEditor>("view_message",recurse); mViewInventoryName = getChild<LLLineEditor>("view_inventory_name",recurse); - mViewInventoryName->setTabStop(FALSE); - mViewInventoryName->setEnabled(FALSE); + mViewInventoryName->setTabStop(false); + mViewInventoryName->setEnabled(false); mViewInventoryIcon = getChild<LLIconCtrl>("view_inv_icon",recurse); - mViewInventoryIcon->setVisible(FALSE); + mViewInventoryIcon->setVisible(false); mBtnOpenAttachment = getChild<LLButton>("open_attachment",recurse); mBtnOpenAttachment->setClickedCallback(onClickOpenAttachment, this); @@ -315,15 +308,15 @@ void LLPanelGroupNotices::activate() mPrevSelectedNotice = LLUUID(); - BOOL can_send = gAgent.hasPowerInGroup(mGroupID,GP_NOTICES_SEND); - BOOL can_receive = gAgent.hasPowerInGroup(mGroupID,GP_NOTICES_RECEIVE); + bool can_send = gAgent.hasPowerInGroup(mGroupID,GP_NOTICES_SEND); + bool can_receive = gAgent.hasPowerInGroup(mGroupID,GP_NOTICES_RECEIVE); mPanelViewNotice->setEnabled(can_receive); mPanelCreateNotice->setEnabled(can_send); // Always disabled to stop direct editing of attachment names - mCreateInventoryName->setEnabled(FALSE); - mViewInventoryName->setEnabled(FALSE); + mCreateInventoryName->setEnabled(false); + mViewInventoryName->setEnabled(false); // If we can receive notices, grab them right away. if (can_receive) @@ -336,10 +329,10 @@ void LLPanelGroupNotices::setItem(LLPointer<LLInventoryItem> inv_item) { mInventoryItem = inv_item; - BOOL item_is_multi = FALSE; + bool item_is_multi = false; if ( inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS ) { - item_is_multi = TRUE; + item_is_multi = true; }; std::string icon_name = LLInventoryIcon::getIconName(inv_item->getType(), @@ -348,13 +341,13 @@ void LLPanelGroupNotices::setItem(LLPointer<LLInventoryItem> inv_item) item_is_multi ); mCreateInventoryIcon->setValue(icon_name); - mCreateInventoryIcon->setVisible(TRUE); + mCreateInventoryIcon->setVisible(true); std::stringstream ss; ss << " " << mInventoryItem->getName(); mCreateInventoryName->setText(ss.str()); - mBtnRemoveAttachment->setEnabled(TRUE); + mBtnRemoveAttachment->setEnabled(true); } void LLPanelGroupNotices::onClickRemoveAttachment(void* data) @@ -362,8 +355,8 @@ void LLPanelGroupNotices::onClickRemoveAttachment(void* data) LLPanelGroupNotices* self = (LLPanelGroupNotices*)data; self->mInventoryItem = NULL; self->mCreateInventoryName->clear(); - self->mCreateInventoryIcon->setVisible(FALSE); - self->mBtnRemoveAttachment->setEnabled(FALSE); + self->mCreateInventoryIcon->setVisible(false); + self->mBtnRemoveAttachment->setEnabled(false); } //static @@ -373,7 +366,7 @@ void LLPanelGroupNotices::onClickOpenAttachment(void* data) self->mInventoryOffer->forceResponse(IOR_ACCEPT); self->mInventoryOffer = NULL; - self->mBtnOpenAttachment->setEnabled(FALSE); + self->mBtnOpenAttachment->setEnabled(false); } void LLPanelGroupNotices::onClickSendMessage(void* data) @@ -443,7 +436,7 @@ void LLPanelGroupNotices::onClickNewMessage(void* data) self->mCreateSubject->clear(); self->mCreateMessage->clear(); if (self->mInventoryItem) onClickRemoveAttachment(self); - self->mNoticesList->deselectAllItems(TRUE); // TRUE == don't commit on chnage + self->mNoticesList->deselectAllItems(true); // true == don't commit on chnage } void LLPanelGroupNotices::refreshNotices() @@ -509,13 +502,13 @@ void LLPanelGroupNotices::processNotices(LLMessageSystem* msg) std::string subj; std::string name; U32 timestamp; - BOOL has_attachment; + bool has_attachment; U8 asset_type; S32 i=0; S32 count = msg->getNumberOfBlocks("Data"); - mNoticesList->setEnabled(TRUE); + mNoticesList->setEnabled(true); //save sort state and set unsorted state to prevent unnecessary //sorting while adding notices @@ -529,7 +522,7 @@ void LLPanelGroupNotices::processNotices(LLMessageSystem* msg) { // Only one entry, the dummy entry. mNoticesList->setCommentText(mNoNoticesStr); - mNoticesList->setEnabled(FALSE); + mNoticesList->setEnabled(false); return; } @@ -635,19 +628,19 @@ void LLPanelGroupNotices::showNotice(const std::string& subject, LLInventoryType::IT_TEXTURE); mViewInventoryIcon->setValue(icon_name); - mViewInventoryIcon->setVisible(TRUE); + mViewInventoryIcon->setVisible(true); std::stringstream ss; ss << " " << inventory_name; mViewInventoryName->setText(ss.str()); - mBtnOpenAttachment->setEnabled(TRUE); + mBtnOpenAttachment->setEnabled(true); } else { mViewInventoryName->clear(); - mViewInventoryIcon->setVisible(FALSE); - mBtnOpenAttachment->setEnabled(FALSE); + mViewInventoryIcon->setVisible(false); + mBtnOpenAttachment->setEnabled(false); } } @@ -655,14 +648,14 @@ void LLPanelGroupNotices::arrangeNoticeView(ENoticeView view_type) { if (CREATE_NEW_NOTICE == view_type) { - mPanelCreateNotice->setVisible(TRUE); - mPanelViewNotice->setVisible(FALSE); + mPanelCreateNotice->setVisible(true); + mPanelViewNotice->setVisible(false); } else { - mPanelCreateNotice->setVisible(FALSE); - mPanelViewNotice->setVisible(TRUE); - mBtnOpenAttachment->setEnabled(FALSE); + mPanelCreateNotice->setVisible(false); + mPanelViewNotice->setVisible(true); + mBtnOpenAttachment->setEnabled(false); } } void LLPanelGroupNotices::setGroupID(const LLUUID& id) diff --git a/indra/newview/llpanelgroupnotices.h b/indra/newview/llpanelgroupnotices.h index 11578eef01..6cb04c0593 100644 --- a/indra/newview/llpanelgroupnotices.h +++ b/indra/newview/llpanelgroupnotices.h @@ -50,8 +50,8 @@ public: //virtual bool apply(std::string& mesg); //virtual void update(); - virtual BOOL postBuild(); - virtual BOOL isVisibleByAgent(LLAgent* agentp); + virtual bool postBuild(); + virtual bool isVisibleByAgent(LLAgent* agentp); void setItem(LLPointer<LLInventoryItem> inv_item); diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp index 89dcd9182e..bc56b49e5d 100644 --- a/indra/newview/llpanelgrouproles.cpp +++ b/indra/newview/llpanelgrouproles.cpp @@ -119,7 +119,7 @@ LLPanelGroupRoles::LLPanelGroupRoles() mCurrentTab(NULL), mRequestedTab( NULL ), mSubTabContainer( NULL ), - mFirstUse( TRUE ) + mFirstUse( true ) { } @@ -127,13 +127,13 @@ LLPanelGroupRoles::~LLPanelGroupRoles() { } -BOOL LLPanelGroupRoles::postBuild() +bool LLPanelGroupRoles::postBuild() { LL_DEBUGS() << "LLPanelGroupRoles::postBuild()" << LL_ENDL; mSubTabContainer = getChild<LLTabContainer>("roles_tab_container"); - if (!mSubTabContainer) return FALSE; + if (!mSubTabContainer) return false; // Hook up each sub-tabs callback and widgets. for (S32 i = 0; i < mSubTabContainer->getTabCount(); ++i) @@ -143,13 +143,13 @@ BOOL LLPanelGroupRoles::postBuild() if (!subtabp) { LL_WARNS() << "Invalid subtab panel: " << panel->getName() << LL_ENDL; - return FALSE; + return false; } // Hand the subtab a pointer to this LLPanelGroupRoles, so that it can // look around for the widgets it is interested in. if (!subtabp->postBuildSubTab(this)) - return FALSE; + return false; //subtabp->addObserver(this); } @@ -165,7 +165,7 @@ BOOL LLPanelGroupRoles::postBuild() mCurrentTab = (LLPanelGroupTab*) mSubTabContainer->getCurrentPanel(); } - if (!mCurrentTab) return FALSE; + if (!mCurrentTab) return false; // Act as though this tab was just activated. mCurrentTab->activate(); @@ -177,7 +177,7 @@ BOOL LLPanelGroupRoles::postBuild() return LLPanelGroupTab::postBuild(); } -BOOL LLPanelGroupRoles::isVisibleByAgent(LLAgent* agentp) +bool LLPanelGroupRoles::isVisibleByAgent(LLAgent* agentp) { /* This power was removed to make group roles simpler return agentp->hasPowerInGroup(mGroupID, @@ -221,9 +221,9 @@ bool LLPanelGroupRoles::handleSubTabSwitch(const LLSD& data) args["WANT_APPLY_MESSAGE"] = mWantApplyMesg; LLNotificationsUtil::add("PanelGroupApply", args, LLSD(), boost::bind(&LLPanelGroupRoles::handleNotifyCallback, this, _1, _2)); - mHasModal = TRUE; + mHasModal = true; - // Returning FALSE will block a close action from finishing until + // Returning false will block a close action from finishing until // we get a response back from the user. return false; } @@ -253,7 +253,7 @@ void LLPanelGroupRoles::transitionToTab() bool LLPanelGroupRoles::handleNotifyCallback(const LLSD& notification, const LLSD& response) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - mHasModal = FALSE; + mHasModal = false; LLPanelGroupTab* transition_tab = mRequestedTab; switch (option) { @@ -266,7 +266,7 @@ bool LLPanelGroupRoles::handleNotifyCallback(const LLSD& notification, const LLS // There was a problem doing the apply. if ( !apply_mesg.empty() ) { - mHasModal = TRUE; + mHasModal = true; LLSD args; args["MESSAGE"] = apply_mesg; LLNotificationsUtil::add("GenericAlert", args, LLSD(), boost::bind(&LLPanelGroupRoles::onModalClose, this, _1, _2)); @@ -296,7 +296,7 @@ bool LLPanelGroupRoles::handleNotifyCallback(const LLSD& notification, const LLS bool LLPanelGroupRoles::onModalClose(const LLSD& notification, const LLSD& response) { - mHasModal = FALSE; + mHasModal = false; return false; } @@ -369,7 +369,7 @@ void LLPanelGroupRoles::activate() LLGroupMgr::getInstance()->sendGroupPropertiesRequest(mGroupID); } - mFirstUse = FALSE; + mFirstUse = false; LLPanelGroupTab* panelp = (LLPanelGroupTab*) mSubTabContainer->getCurrentPanel(); if (panelp) panelp->activate(); @@ -389,12 +389,12 @@ bool LLPanelGroupRoles::needsApply(std::string& mesg) return panelp->needsApply(mesg); } -BOOL LLPanelGroupRoles::hasModal() +bool LLPanelGroupRoles::hasModal() { - if (mHasModal) return TRUE; + if (mHasModal) return true; LLPanelGroupTab* panelp = (LLPanelGroupTab*) mSubTabContainer->getCurrentPanel(); - if (!panelp) return FALSE; + if (!panelp) return false; return panelp->hasModal(); } @@ -419,7 +419,7 @@ void LLPanelGroupRoles::setGroupID(const LLUUID& id) if(mSubTabContainer) mSubTabContainer->selectTab(1); - group_roles_tab->mFirstOpen = TRUE; + group_roles_tab->mFirstOpen = true; activate(); } @@ -437,9 +437,10 @@ LLPanelGroupSubTab::LLPanelGroupSubTab() LLPanelGroupSubTab::~LLPanelGroupSubTab() { + mSearchCommitConnection.disconnect(); } -BOOL LLPanelGroupSubTab::postBuildSubTab(LLView* root) +bool LLPanelGroupSubTab::postBuildSubTab(LLView* root) { // Get icons for later use. mActionIcons.clear(); @@ -458,18 +459,19 @@ BOOL LLPanelGroupSubTab::postBuildSubTab(LLView* root) { mActionIcons["partial"] = getString("power_partial_icon"); } - return TRUE; + return true; } -BOOL LLPanelGroupSubTab::postBuild() +bool LLPanelGroupSubTab::postBuild() { // Hook up the search widgets. - bool recurse = true; + constexpr bool recurse = true; mSearchEditor = findChild<LLFilterEditor>("filter_input", recurse); if (mSearchEditor) // SubTab doesn't implement this, only some of derived classes { - mSearchEditor->setCommitCallback(boost::bind(&LLPanelGroupSubTab::setSearchFilter, this, _2)); + // panel + mSearchCommitConnection = mSearchEditor->setCommitCallback(boost::bind(&LLPanelGroupSubTab::setSearchFilter, this, _2)); } return LLPanelGroupTab::postBuild(); @@ -499,15 +501,15 @@ void LLPanelGroupSubTab::setSearchFilter(const std::string& filter) void LLPanelGroupSubTab::activate() { - setOthersVisible(TRUE); + setOthersVisible(true); } void LLPanelGroupSubTab::deactivate() { - setOthersVisible(FALSE); + setOthersVisible(false); } -void LLPanelGroupSubTab::setOthersVisible(BOOL b) +void LLPanelGroupSubTab::setOthersVisible(bool b) { if (mHeader) { @@ -543,9 +545,9 @@ void LLPanelGroupSubTab::buildActionsList(LLScrollListCtrl* ctrl, U64 allowed_by_some, U64 allowed_by_all, LLUICtrl::commit_callback_t commit_callback, - BOOL show_all, - BOOL filter, - BOOL is_owner_role) + bool show_all, + bool filter, + bool is_owner_role) { if (LLGroupMgr::getInstance()->mRoleActionSets.empty()) { @@ -575,9 +577,9 @@ void LLPanelGroupSubTab::buildActionCategory(LLScrollListCtrl* ctrl, U64 allowed_by_all, LLRoleActionSet* action_set, LLUICtrl::commit_callback_t commit_callback, - BOOL show_all, - BOOL filter, - BOOL is_owner_role) + bool show_all, + bool filter, + bool is_owner_role) { LL_DEBUGS() << "Building role list for: " << action_set->mActionSetData->mName << LL_ENDL; // See if the allow mask matches anything in this category. @@ -613,7 +615,7 @@ void LLPanelGroupSubTab::buildActionCategory(LLScrollListCtrl* ctrl, std::vector<LLRoleAction*>::iterator ra_end = action_set->mActions.end(); bool items_match_filter = false; - BOOL can_change_actions = (!is_owner_role && gAgent.hasPowerInGroup(mGroupID, GP_ROLE_CHANGE_ACTIONS)); + bool can_change_actions = (!is_owner_role && gAgent.hasPowerInGroup(mGroupID, GP_ROLE_CHANGE_ACTIONS)); for ( ; ra_it != ra_end; ++ra_it) { @@ -724,26 +726,26 @@ void LLPanelGroupSubTab::buildActionCategory(LLScrollListCtrl* ctrl, if (show_all) { - check->setTentative(FALSE); + check->setTentative(false); if (allowed_by_some & (*ra_it)->mPowerBit) { - check->set(TRUE); + check->set(true); } else { - check->set(FALSE); + check->set(false); } } else { - check->set(TRUE); + check->set(true); if (show_full_strength) { - check->setTentative(FALSE); + check->setTentative(false); } else { - check->setTentative(TRUE); + check->setTentative(true); } } @@ -766,7 +768,7 @@ void LLPanelGroupSubTab::buildActionCategory(LLScrollListCtrl* ctrl, } } -void LLPanelGroupSubTab::setFooterEnabled(BOOL enable) +void LLPanelGroupSubTab::setFooterEnabled(bool enable) { if (mFooter) { @@ -783,9 +785,9 @@ LLPanelGroupMembersSubTab::LLPanelGroupMembersSubTab() mMembersList(NULL), mAssignedRolesList(NULL), mAllowedActionsList(NULL), - mChanged(FALSE), - mPendingMemberUpdate(FALSE), - mHasMatch(FALSE), + mChanged(false), + mPendingMemberUpdate(false), + mHasMatch(false), mNumOwnerAdditions(0) { } @@ -806,7 +808,7 @@ LLPanelGroupMembersSubTab::~LLPanelGroupMembersSubTab() } } -BOOL LLPanelGroupMembersSubTab::postBuildSubTab(LLView* root) +bool LLPanelGroupMembersSubTab::postBuildSubTab(LLView* root) { LLPanelGroupSubTab::postBuildSubTab(root); @@ -823,13 +825,13 @@ BOOL LLPanelGroupMembersSubTab::postBuildSubTab(LLView* root) mAllowedActionsList = parent->getChild<LLScrollListCtrl>("member_allowed_actions", recurse); mActionDescription = parent->getChild<LLTextEditor>("member_action_description", recurse); - if (!mMembersList || !mAssignedRolesList || !mAllowedActionsList || !mActionDescription) return FALSE; + if (!mMembersList || !mAssignedRolesList || !mAllowedActionsList || !mActionDescription) return false; - mAllowedActionsList->setCommitOnSelectionChange(TRUE); + mAllowedActionsList->setCommitOnSelectionChange(true); mAllowedActionsList->setCommitCallback(boost::bind(&LLPanelGroupMembersSubTab::updateActionDescription, this)); // We want to be notified whenever a member is selected. - mMembersList->setCommitOnSelectionChange(TRUE); + mMembersList->setCommitOnSelectionChange(true); mMembersList->setCommitCallback(onMemberSelect, this); // Show the member's profile on double click. mMembersList->setDoubleClickCallback(onMemberDoubleClick, this); @@ -844,7 +846,7 @@ BOOL LLPanelGroupMembersSubTab::postBuildSubTab(LLView* root) std::string order_by = gSavedSettings.getString("GroupMembersSortOrder"); if(!order_by.empty()) { - mMembersList->sortByColumn(order_by, TRUE); + mMembersList->sortByColumn(order_by, true); } LLButton* button = parent->getChild<LLButton>("member_invite", recurse); @@ -858,17 +860,17 @@ BOOL LLPanelGroupMembersSubTab::postBuildSubTab(LLView* root) if ( mEjectBtn ) { mEjectBtn->setClickedCallback(onEjectMembers, this); - mEjectBtn->setEnabled(FALSE); + mEjectBtn->setEnabled(false); } mBanBtn = parent->getChild<LLButton>("member_ban", recurse); if(mBanBtn) { mBanBtn->setClickedCallback(onBanMember, this); - mBanBtn->setEnabled(FALSE); + mBanBtn->setEnabled(false); } - return TRUE; + return true; } void LLPanelGroupMembersSubTab::setGroupID(const LLUUID& id) @@ -936,9 +938,9 @@ void LLPanelGroupMembersSubTab::handleMemberSelect() allowed_by_some, allowed_by_all, NULL, - FALSE, - FALSE, - FALSE); + false, + false, + false); ////////////////////////////////// // Build the assigned roles list. @@ -947,9 +949,9 @@ void LLPanelGroupMembersSubTab::handleMemberSelect() LLGroupMgrGroupData::role_list_t::iterator iter = gdatap->mRoles.begin(); LLGroupMgrGroupData::role_list_t::iterator end = gdatap->mRoles.end(); - BOOL can_ban_members = gAgent.hasPowerInGroup(mGroupID, GP_GROUP_BAN_ACCESS); - BOOL can_eject_members = gAgent.hasPowerInGroup(mGroupID, GP_MEMBER_EJECT); - BOOL member_is_owner = FALSE; + bool can_ban_members = gAgent.hasPowerInGroup(mGroupID, GP_GROUP_BAN_ACCESS); + bool can_eject_members = gAgent.hasPowerInGroup(mGroupID, GP_MEMBER_EJECT); + bool member_is_owner = false; for( ; iter != end; ++iter) { @@ -959,14 +961,14 @@ void LLPanelGroupMembersSubTab::handleMemberSelect() if (group_role_data) { - const BOOL needs_sort = FALSE; + const bool needs_sort = false; S32 count = group_role_data->getMembersInRole( selected_members, needs_sort); //check if the user has permissions to assign/remove //members to/from the role (but the ability to add/remove //should only be based on the "saved" changes to the role //not in the temp/meta data. -jwolk - BOOL cb_enable = ( (count > 0) ? + bool cb_enable = ( (count > 0) ? agentCanRemoveFromRole(mGroupID, role_id) : agentCanAddToRole(mGroupID, role_id) ); @@ -994,8 +996,8 @@ void LLPanelGroupMembersSubTab::handleMemberSelect() if ( member_data && member_data->isInRole(gdatap->mOwnerRole) ) { // Can't remove other owners. - cb_enable = FALSE; - can_ban_members = FALSE; + cb_enable = false; + can_ban_members = false; break; } } @@ -1017,10 +1019,10 @@ void LLPanelGroupMembersSubTab::handleMemberSelect() // If anyone selected is in any role besides 'Everyone' then they can't be ejected. if (role_id.notNull() && (count > 0)) { - can_eject_members = FALSE; + can_eject_members = false; if (role_id == gdatap->mOwnerRole) { - member_is_owner = TRUE; + member_is_owner = true; } } @@ -1076,12 +1078,12 @@ void LLPanelGroupMembersSubTab::handleMemberSelect() LL_WARNS() << "No group role data for " << iter->second << LL_ENDL; } } - mAssignedRolesList->setEnabled(TRUE); + mAssignedRolesList->setEnabled(true); if (gAgent.isGodlike()) { - can_eject_members = TRUE; - // can_ban_members = TRUE; + can_eject_members = true; + // can_ban_members = true; } if (!can_eject_members && !member_is_owner) @@ -1094,8 +1096,8 @@ void LLPanelGroupMembersSubTab::handleMemberSelect() if ( member_data && member_data->isInRole(gdatap->mOwnerRole) ) { - can_eject_members = TRUE; - //can_ban_members = TRUE; + can_eject_members = true; + //can_ban_members = true; } } @@ -1107,12 +1109,12 @@ void LLPanelGroupMembersSubTab::handleMemberSelect() { if( gAgent.hasPowerInGroup(mGroupID, GP_MEMBER_EJECT)) { - can_eject_members = TRUE; + can_eject_members = true; } if( gAgent.hasPowerInGroup(mGroupID, GP_GROUP_BAN_ACCESS)) { - can_ban_members = TRUE; + can_ban_members = true; } } @@ -1124,8 +1126,8 @@ void LLPanelGroupMembersSubTab::handleMemberSelect() // Don't count the agent. if ((*member_iter) == gAgent.getID()) { - can_eject_members = FALSE; - can_ban_members = FALSE; + can_eject_members = false; + can_ban_members = false; } } @@ -1171,7 +1173,7 @@ void LLPanelGroupMembersSubTab::confirmEjectMembers() std::vector<LLScrollListItem*> selection = mMembersList->getAllSelected(); if (selection.empty()) return; - S32 selection_count = selection.size(); + auto selection_count = selection.size(); if (selection_count == 1) { LLSD args; @@ -1257,7 +1259,7 @@ void LLPanelGroupMembersSubTab::handleRoleCheck(const LLUUID& role_id, U64 powers_all_have = GP_ALL_POWERS; U64 powers_some_have = 0; - BOOL is_owner_role = ( gdatap->mOwnerRole == role_id ); + bool is_owner_role = ( gdatap->mOwnerRole == role_id ); LLUUID member_id; std::vector<LLScrollListItem*> selection = mMembersList->getAllSelected(); @@ -1329,9 +1331,9 @@ void LLPanelGroupMembersSubTab::handleRoleCheck(const LLUUID& role_id, powers_some_have, powers_all_have, NULL, - FALSE, - FALSE, - FALSE); + false, + false, + false); } // static @@ -1414,7 +1416,7 @@ void LLPanelGroupMembersSubTab::cancel() DeletePairedPointer()); mMemberRoleChangeData.clear(); - mChanged = FALSE; + mChanged = false; notifyObservers(); } } @@ -1441,7 +1443,7 @@ bool LLPanelGroupMembersSubTab::apply(std::string& mesg) if ( gdatap->getRoleData(gdatap->mOwnerRole, rd) ) { - mHasModal = TRUE; + mHasModal = true; args["ROLE_NAME"] = rd.mRoleName; LLNotificationsUtil::add("AddGroupOwnerWarning", args, @@ -1469,7 +1471,7 @@ bool LLPanelGroupMembersSubTab::apply(std::string& mesg) bool LLPanelGroupMembersSubTab::addOwnerCB(const LLSD& notification, const LLSD& response) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - mHasModal = FALSE; + mHasModal = false; if (0 == option) { @@ -1512,7 +1514,7 @@ void LLPanelGroupMembersSubTab::applyMemberChanges() //force a UI update handleMemberSelect(); - mChanged = FALSE; + mChanged = false; mNumOwnerAdditions = 0; notifyObservers(); } @@ -1680,8 +1682,8 @@ void LLPanelGroupMembersSubTab::update(LLGroupChange gc) && gdatap->isRoleMemberDataComplete()) { mMemberProgress = gdatap->mMembers.begin(); - mPendingMemberUpdate = TRUE; - mHasMatch = FALSE; + mPendingMemberUpdate = true; + mHasMatch = false; } else { @@ -1710,7 +1712,7 @@ void LLPanelGroupMembersSubTab::update(LLGroupChange gc) // Still busy retreiving role/member mappings. retrieved << "Retrieving role member mappings..."; } - mMembersList->setEnabled(FALSE); + mMembersList->setEnabled(false); mMembersList->setCommentText(retrieved.str()); } } @@ -1736,7 +1738,7 @@ void LLPanelGroupMembersSubTab::addMemberToList(LLGroupMemberData* data) mMembersList->addNameItemRow(item_params); - mHasMatch = TRUE; + mHasMatch = true; } void LLPanelGroupMembersSubTab::onNameCache(const LLUUID& update_id, LLGroupMemberData* member, const LLAvatarName& av_name, const LLUUID& av_id) @@ -1765,7 +1767,7 @@ void LLPanelGroupMembersSubTab::onNameCache(const LLUUID& update_id, LLGroupMemb addMemberToList(member); if(!mMembersList->getEnabled()) { - mMembersList->setEnabled(TRUE); + mMembersList->setEnabled(true); } } @@ -1773,7 +1775,7 @@ void LLPanelGroupMembersSubTab::onNameCache(const LLUUID& update_id, LLGroupMemb void LLPanelGroupMembersSubTab::updateMembers() { - mPendingMemberUpdate = FALSE; + mPendingMemberUpdate = false; // Rebuild the members list. @@ -1838,17 +1840,17 @@ void LLPanelGroupMembersSubTab::updateMembers() { if (mHasMatch) { - mMembersList->setEnabled(TRUE); + mMembersList->setEnabled(true); } else if (gdatap->mMembers.size()) { - mMembersList->setEnabled(FALSE); + mMembersList->setEnabled(false); mMembersList->setCommentText(std::string("No match.")); } } else { - mPendingMemberUpdate = TRUE; + mPendingMemberUpdate = true; } // This should clear the other two lists, since nothing is selected. @@ -1866,7 +1868,7 @@ void LLPanelGroupMembersSubTab::confirmBanMembers() std::vector<LLScrollListItem*> selection = mMembersList->getAllSelected(); if (selection.empty()) return; - S32 selection_count = selection.size(); + auto selection_count = selection.size(); if (selection_count == 1) { LLSD args; @@ -1964,8 +1966,8 @@ LLPanelGroupRolesSubTab::LLPanelGroupRolesSubTab() mDeleteRoleButton(NULL), mCopyRoleButton(NULL), mCreateRoleButton(NULL), - mFirstOpen(TRUE), - mHasRoleChange(FALSE) + mFirstOpen(true), + mHasRoleChange(false) { } @@ -1973,7 +1975,7 @@ LLPanelGroupRolesSubTab::~LLPanelGroupRolesSubTab() { } -BOOL LLPanelGroupRolesSubTab::postBuildSubTab(LLView* root) +bool LLPanelGroupRolesSubTab::postBuildSubTab(LLView* root) { LLPanelGroupSubTab::postBuildSubTab(root); @@ -2001,7 +2003,7 @@ BOOL LLPanelGroupRolesSubTab::postBuildSubTab(LLView* root) || !mRoleName || !mRoleTitle || !mRoleDescription || !mMemberVisibleCheck) { LL_WARNS() << "ARG! element not found." << LL_ENDL; - return FALSE; + return false; } mRemoveEveryoneTxt = getString("cant_delete_role"); @@ -2011,7 +2013,7 @@ BOOL LLPanelGroupRolesSubTab::postBuildSubTab(LLView* root) if ( mCreateRoleButton ) { mCreateRoleButton->setClickedCallback(onCreateRole, this); - mCreateRoleButton->setEnabled(FALSE); + mCreateRoleButton->setEnabled(false); } mCopyRoleButton = @@ -2019,7 +2021,7 @@ BOOL LLPanelGroupRolesSubTab::postBuildSubTab(LLView* root) if ( mCopyRoleButton ) { mCopyRoleButton->setClickedCallback(onCopyRole, this); - mCopyRoleButton->setEnabled(FALSE); + mCopyRoleButton->setEnabled(false); } mDeleteRoleButton = @@ -2027,31 +2029,31 @@ BOOL LLPanelGroupRolesSubTab::postBuildSubTab(LLView* root) if ( mDeleteRoleButton ) { mDeleteRoleButton->setClickedCallback(onDeleteRole, this); - mDeleteRoleButton->setEnabled(FALSE); + mDeleteRoleButton->setEnabled(false); } - mRolesList->setCommitOnSelectionChange(TRUE); + mRolesList->setCommitOnSelectionChange(true); mRolesList->setCommitCallback(onRoleSelect, this); mAssignedMembersList->setContextMenu(LLScrollListCtrl::MENU_AVATAR); mMemberVisibleCheck->setCommitCallback(onMemberVisibilityChange, this); - mAllowedActionsList->setCommitOnSelectionChange(TRUE); + mAllowedActionsList->setCommitOnSelectionChange(true); mAllowedActionsList->setCommitCallback(boost::bind(&LLPanelGroupRolesSubTab::updateActionDescription, this)); - mRoleName->setCommitOnFocusLost(TRUE); + mRoleName->setCommitOnFocusLost(true); mRoleName->setKeystrokeCallback(onPropertiesKey, this); - mRoleTitle->setCommitOnFocusLost(TRUE); + mRoleTitle->setCommitOnFocusLost(true); mRoleTitle->setKeystrokeCallback(onPropertiesKey, this); - mRoleDescription->setCommitOnFocusLost(TRUE); + mRoleDescription->setCommitOnFocusLost(true); mRoleDescription->setKeystrokeCallback(boost::bind(&LLPanelGroupRolesSubTab::onDescriptionKeyStroke, this, _1)); - setFooterEnabled(FALSE); + setFooterEnabled(false); - return TRUE; + return true; } void LLPanelGroupRolesSubTab::activate() @@ -2066,9 +2068,9 @@ void LLPanelGroupRolesSubTab::activate() mRoleDescription->clear(); mRoleTitle->clear(); - setFooterEnabled(FALSE); + setFooterEnabled(false); - mHasRoleChange = FALSE; + mHasRoleChange = false; update(GC_ALL); } @@ -2077,7 +2079,7 @@ void LLPanelGroupRolesSubTab::deactivate() LL_DEBUGS() << "LLPanelGroupRolesSubTab::deactivate()" << LL_ENDL; LLPanelGroupSubTab::deactivate(); - mFirstOpen = FALSE; + mFirstOpen = false; } bool LLPanelGroupRolesSubTab::needsApply(std::string& mesg) @@ -2101,7 +2103,7 @@ bool LLPanelGroupRolesSubTab::apply(std::string& mesg) LL_DEBUGS() << "LLPanelGroupRolesSubTab::apply()" << LL_ENDL; saveRoleChanges(true); - mFirstOpen = FALSE; + mFirstOpen = false; LLGroupMgr::getInstance()->sendGroupRoleChanges(mGroupID); notifyObservers(); @@ -2111,7 +2113,7 @@ bool LLPanelGroupRolesSubTab::apply(std::string& mesg) void LLPanelGroupRolesSubTab::cancel() { - mHasRoleChange = FALSE; + mHasRoleChange = false; LLGroupMgr::getInstance()->cancelGroupRoleChanges(mGroupID); notifyObservers(); @@ -2195,12 +2197,12 @@ void LLPanelGroupRolesSubTab::update(LLGroupChange gc) if (matchesSearchFilter(rd.mRoleName, rd.mRoleTitle)) { // If this is the everyone role, then EVERYONE is in it. - S32 members_in_role = (*rit).first.isNull() ? gdatap->mMembers.size() : (*rit).second->getTotalMembersInRole(); + S32 members_in_role = (*rit).first.isNull() ? static_cast<S32>(gdatap->mMembers.size()) : (*rit).second->getTotalMembersInRole(); LLSD row = createRoleItem((*rit).first,rd.mRoleName, rd.mRoleTitle, members_in_role); item = mRolesList->addElement(row, ((*rit).first.isNull()) ? ADD_TOP : ADD_BOTTOM, this); if (had_selection && ((*rit).first == last_selected)) { - item->setSelected(TRUE); + item->setSelected(true); } } } @@ -2210,16 +2212,16 @@ void LLPanelGroupRolesSubTab::update(LLGroupChange gc) } } - mRolesList->sortByColumn(std::string("name"), TRUE); + mRolesList->sortByColumn(std::string("name"), true); if ( (gdatap->mRoles.size() < (U32)MAX_ROLES) && gAgent.hasPowerInGroup(mGroupID, GP_ROLE_CREATE) ) { - mCreateRoleButton->setEnabled(TRUE); + mCreateRoleButton->setEnabled(true); } else { - mCreateRoleButton->setEnabled(FALSE); + mCreateRoleButton->setEnabled(false); } if (had_selection) @@ -2233,9 +2235,9 @@ void LLPanelGroupRolesSubTab::update(LLGroupChange gc) mRoleName->clear(); mRoleDescription->clear(); mRoleTitle->clear(); - setFooterEnabled(FALSE); - mDeleteRoleButton->setEnabled(FALSE); - mCopyRoleButton->setEnabled(FALSE); + setFooterEnabled(false); + mDeleteRoleButton->setEnabled(false); + mCopyRoleButton->setEnabled(false); } } @@ -2260,7 +2262,7 @@ void LLPanelGroupRolesSubTab::onRoleSelect(LLUICtrl* ctrl, void* user_data) void LLPanelGroupRolesSubTab::handleRoleSelect() { - BOOL can_delete = TRUE; + bool can_delete = true; LL_DEBUGS() << "LLPanelGroupRolesSubTab::handleRoleSelect()" << LL_ENDL; mAssignedMembersList->deleteAllItems(); @@ -2280,16 +2282,16 @@ void LLPanelGroupRolesSubTab::handleRoleSelect() LLScrollListItem* item = mRolesList->getFirstSelected(); if (!item) { - setFooterEnabled(FALSE); + setFooterEnabled(false); return; } - setFooterEnabled(TRUE); + setFooterEnabled(true); LLRoleData rd; if (gdatap->getRoleData(item->getUUID(),rd)) { - BOOL is_owner_role = ( gdatap->mOwnerRole == item->getUUID() ); + bool is_owner_role = ( gdatap->mOwnerRole == item->getUUID() ); mRoleName->setText(rd.mRoleName); mRoleTitle->setText(rd.mRoleTitle); mRoleDescription->setText(rd.mRoleDescription); @@ -2300,8 +2302,8 @@ void LLPanelGroupRolesSubTab::handleRoleSelect() rd.mRolePowers, 0LL, boost::bind(&LLPanelGroupRolesSubTab::handleActionCheck, this, _1, false), - TRUE, - FALSE, + true, + false, is_owner_role); @@ -2314,9 +2316,9 @@ void LLPanelGroupRolesSubTab::handleRoleSelect() if ( is_owner_role ) { // you can't delete the owner role - can_delete = FALSE; + can_delete = false; // ... or hide members with this role - mMemberVisibleCheck->setEnabled(FALSE); + mMemberVisibleCheck->setEnabled(false); } else { @@ -2326,9 +2328,9 @@ void LLPanelGroupRolesSubTab::handleRoleSelect() if (item->getUUID().isNull()) { // Everyone role, can't edit description or name or delete - mRoleDescription->setEnabled(FALSE); - mRoleName->setEnabled(FALSE); - can_delete = FALSE; + mRoleDescription->setEnabled(false); + mRoleName->setEnabled(false); + can_delete = false; } } else @@ -2339,9 +2341,9 @@ void LLPanelGroupRolesSubTab::handleRoleSelect() mRoleName->clear(); mRoleDescription->clear(); mRoleTitle->clear(); - setFooterEnabled(FALSE); + setFooterEnabled(false); - can_delete = FALSE; + can_delete = false; } mSelectedRole = item->getUUID(); buildMembersList(); @@ -2445,7 +2447,7 @@ void LLPanelGroupRolesSubTab::handleActionCheck(LLUICtrl* ctrl, bool force) { // Uncheck the item, for now. It will be // checked if they click 'Yes', below. - check->set(FALSE); + check->set(false); LLRoleData rd; LLSD args; @@ -2454,7 +2456,7 @@ void LLPanelGroupRolesSubTab::handleActionCheck(LLUICtrl* ctrl, bool force) { args["ACTION_NAME"] = rap->mDescription; args["ROLE_NAME"] = rd.mRoleName; - mHasModal = TRUE; + mHasModal = true; std::string warning = "AssignDangerousActionWarning"; if (GP_ROLE_CHANGE_ACTIONS == power) { @@ -2481,7 +2483,7 @@ void LLPanelGroupRolesSubTab::handleActionCheck(LLUICtrl* ctrl, bool force) { args["ACTION_NAME"] = rap->mDescription; args["ROLE_NAME"] = rd.mRoleName; - mHasModal = TRUE; + mHasModal = true; std::vector<LLScrollListItem*> all_data = mAllowedActionsList->getAllData(); std::vector<LLScrollListItem*>::iterator ad_it = all_data.begin(); @@ -2527,9 +2529,9 @@ void LLPanelGroupRolesSubTab::handleActionCheck(LLUICtrl* ctrl, bool force) current_role_powers, current_role_powers, boost::bind(&LLPanelGroupRolesSubTab::handleActionCheck, this, _1, false), - TRUE, - FALSE, - FALSE); + true, + false, + false); } @@ -2545,7 +2547,7 @@ void LLPanelGroupRolesSubTab::handleActionCheck(LLUICtrl* ctrl, bool force) gdatap->removeRolePower(role_id,power); } - mHasRoleChange = TRUE; + mHasRoleChange = true; notifyObservers(); } @@ -2554,13 +2556,13 @@ bool LLPanelGroupRolesSubTab::addActionCB(const LLSD& notification, const LLSD& { if (!check) return false; - mHasModal = FALSE; + mHasModal = false; S32 option = LLNotificationsUtil::getSelectedOption(notification, response); if (0 == option) { // User clicked "Yes" - check->set(TRUE); + check->set(true); const bool force_add = true; handleActionCheck(check, force_add); } @@ -2573,13 +2575,13 @@ void LLPanelGroupRolesSubTab::onPropertiesKey(LLLineEditor* ctrl, void* user_dat LLPanelGroupRolesSubTab* self = static_cast<LLPanelGroupRolesSubTab*>(user_data); if (!self) return; - self->mHasRoleChange = TRUE; + self->mHasRoleChange = true; self->notifyObservers(); } void LLPanelGroupRolesSubTab::onDescriptionKeyStroke(LLTextEditor* caller) { - mHasRoleChange = TRUE; + mHasRoleChange = true; notifyObservers(); } @@ -2589,7 +2591,7 @@ void LLPanelGroupRolesSubTab::onDescriptionCommit(LLUICtrl* ctrl, void* user_dat LLPanelGroupRolesSubTab* self = static_cast<LLPanelGroupRolesSubTab*>(user_data); if (!self) return; - self->mHasRoleChange = TRUE; + self->mHasRoleChange = true; self->notifyObservers(); } @@ -2653,7 +2655,7 @@ void LLPanelGroupRolesSubTab::handleCreateRole() rd.mRoleName = "New Role"; gdatap->createRole(new_role_id,rd); - mRolesList->deselectAllItems(TRUE); + mRolesList->deselectAllItems(true); LLSD row; row["id"] = new_role_id; row["columns"][0]["column"] = "name"; @@ -2664,7 +2666,7 @@ void LLPanelGroupRolesSubTab::handleCreateRole() // put focus on name field and select its contents if(mRoleName) { - mRoleName->setFocus(TRUE); + mRoleName->setFocus(true); mRoleName->onTabInto(); gFocusMgr.triggerFocusFlash(); } @@ -2704,7 +2706,7 @@ void LLPanelGroupRolesSubTab::handleCopyRole() rd.mRoleName += "(Copy)"; gdatap->createRole(new_role_id,rd); - mRolesList->deselectAllItems(TRUE); + mRolesList->deselectAllItems(true); LLSD row; row["id"] = new_role_id; row["columns"][0]["column"] = "name"; @@ -2715,7 +2717,7 @@ void LLPanelGroupRolesSubTab::handleCopyRole() // put focus on name field and select its contents if(mRoleName) { - mRoleName->setFocus(TRUE); + mRoleName->setFocus(true); mRoleName->onTabInto(); gFocusMgr.triggerFocusFlash(); } @@ -2792,7 +2794,7 @@ void LLPanelGroupRolesSubTab::saveRoleChanges(bool select_saved_role) LLScrollListItem* item = mRolesList->addElement(row, ADD_BOTTOM, this); item->setSelected(select_saved_role); - mHasRoleChange = FALSE; + mHasRoleChange = false; } } @@ -2823,9 +2825,9 @@ void LLPanelGroupRolesSubTab::setGroupID(const LLUUID& id) if(mRoleDescription) mRoleDescription->clear(); if(mRoleTitle) mRoleTitle->clear(); - mHasRoleChange = FALSE; + mHasRoleChange = false; - setFooterEnabled(FALSE); + setFooterEnabled(false); LLPanelGroupSubTab::setGroupID(id); } @@ -2843,7 +2845,7 @@ LLPanelGroupActionsSubTab::~LLPanelGroupActionsSubTab() { } -BOOL LLPanelGroupActionsSubTab::postBuildSubTab(LLView* root) +bool LLPanelGroupActionsSubTab::postBuildSubTab(LLView* root) { LLPanelGroupSubTab::postBuildSubTab(root); @@ -2861,15 +2863,15 @@ BOOL LLPanelGroupActionsSubTab::postBuildSubTab(LLView* root) mActionRoles = parent->getChild<LLScrollListCtrl>("action_roles",recurse); mActionMembers = parent->getChild<LLNameListCtrl>("action_members",recurse); - if (!mActionList || !mActionDescription || !mActionRoles || !mActionMembers) return FALSE; + if (!mActionList || !mActionDescription || !mActionRoles || !mActionMembers) return false; - mActionList->setCommitOnSelectionChange(TRUE); + mActionList->setCommitOnSelectionChange(true); mActionList->setCommitCallback(boost::bind(&LLPanelGroupActionsSubTab::handleActionSelect, this)); mActionList->setContextMenu(LLScrollListCtrl::MENU_AVATAR); update(GC_ALL); - return TRUE; + return true; } void LLPanelGroupActionsSubTab::activate() @@ -2884,9 +2886,9 @@ void LLPanelGroupActionsSubTab::activate() GP_ALL_POWERS, GP_ALL_POWERS, NULL, - FALSE, - TRUE, - FALSE); + false, + true, + false); } void LLPanelGroupActionsSubTab::deactivate() @@ -2937,9 +2939,9 @@ void LLPanelGroupActionsSubTab::onFilterChanged() GP_ALL_POWERS, GP_ALL_POWERS, NULL, - FALSE, - TRUE, - FALSE); + false, + true, + false); } void LLPanelGroupActionsSubTab::handleActionSelect() @@ -3050,7 +3052,7 @@ LLPanelGroupBanListSubTab::LLPanelGroupBanListSubTab() mDeleteBanButton(NULL) {} -BOOL LLPanelGroupBanListSubTab::postBuildSubTab(LLView* root) +bool LLPanelGroupBanListSubTab::postBuildSubTab(LLView* root) { LLPanelGroupSubTab::postBuildSubTab(root); @@ -3071,19 +3073,19 @@ BOOL LLPanelGroupBanListSubTab::postBuildSubTab(LLView* root) mBanCountText = parent->getChild<LLTextBase>("ban_count", recurse); if(!mBanList || !mCreateBanButton || !mDeleteBanButton || !mRefreshBanListButton || !mBanCountText) - return FALSE; + return false; - mBanList->setCommitOnSelectionChange(TRUE); + mBanList->setCommitOnSelectionChange(true); mBanList->setCommitCallback(onBanEntrySelect, this); mCreateBanButton->setClickedCallback(onCreateBanEntry, this); - mCreateBanButton->setEnabled(FALSE); + mCreateBanButton->setEnabled(false); mDeleteBanButton->setClickedCallback(onDeleteBanEntry, this); - mDeleteBanButton->setEnabled(FALSE); + mDeleteBanButton->setEnabled(false); mRefreshBanListButton->setClickedCallback(onRefreshBanList, this); - mRefreshBanListButton->setEnabled(FALSE); + mRefreshBanListButton->setEnabled(false); setBanCount(0); @@ -3091,8 +3093,8 @@ BOOL LLPanelGroupBanListSubTab::postBuildSubTab(LLView* root) populateBanList(); - setFooterEnabled(FALSE); - return TRUE; + setFooterEnabled(false); + return true; } void LLPanelGroupBanListSubTab::activate() @@ -3100,18 +3102,18 @@ void LLPanelGroupBanListSubTab::activate() LLPanelGroupSubTab::activate(); mBanList->deselectAllItems(); - mDeleteBanButton->setEnabled(FALSE); + mDeleteBanButton->setEnabled(false); LLGroupMgrGroupData * group_datap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (group_datap) { mCreateBanButton->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_GROUP_BAN_ACCESS) && group_datap->mBanList.size() < GB_MAX_BANNED_AGENTS); - setBanCount(group_datap->mBanList.size()); + setBanCount(static_cast<U32>(group_datap->mBanList.size())); } else { - mCreateBanButton->setEnabled(FALSE); + mCreateBanButton->setEnabled(false); setBanCount(0); } @@ -3122,7 +3124,7 @@ void LLPanelGroupBanListSubTab::activate() // LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_GET, mGroupID); - setFooterEnabled(FALSE); + setFooterEnabled(false); update(GC_ALL); } @@ -3153,7 +3155,7 @@ void LLPanelGroupBanListSubTab::handleBanEntrySelect() { if (gAgent.hasPowerInGroup(mGroupID, GP_GROUP_BAN_ACCESS)) { - mDeleteBanButton->setEnabled(TRUE); + mDeleteBanButton->setEnabled(true); } } @@ -3229,12 +3231,12 @@ void LLPanelGroupBanListSubTab::handleDeleteBanEntry() // Removing an item removes the selection, we shouldn't be able to click // the button anymore until we reselect another entry. - mDeleteBanButton->setEnabled(FALSE); + mDeleteBanButton->setEnabled(false); } // update ban-count related elements - mCreateBanButton->setEnabled(TRUE); - setBanCount(gdatap->mBanList.size()); + mCreateBanButton->setEnabled(true); + setBanCount(static_cast<U32>(gdatap->mBanList.size())); LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_POST, mGroupID, LLGroupMgr::BAN_DELETE, ban_ids); } @@ -3250,7 +3252,7 @@ void LLPanelGroupBanListSubTab::onRefreshBanList(void* user_data) void LLPanelGroupBanListSubTab::handleRefreshBanList() { - mRefreshBanListButton->setEnabled(FALSE); + mRefreshBanListButton->setEnabled(false); LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_GET, mGroupID); } @@ -3258,7 +3260,7 @@ void LLPanelGroupBanListSubTab::onBanListCompleted(bool isComplete) { if(isComplete) { - mRefreshBanListButton->setEnabled(TRUE); + mRefreshBanListButton->setEnabled(true); populateBanList(); } } @@ -3309,10 +3311,10 @@ void LLPanelGroupBanListSubTab::populateBanList() mBanList->addNameItemRow(ban_entry); } - mRefreshBanListButton->setEnabled(TRUE); + mRefreshBanListButton->setEnabled(true); mCreateBanButton->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_GROUP_BAN_ACCESS) && gdatap->mBanList.size() < GB_MAX_BANNED_AGENTS); - setBanCount(gdatap->mBanList.size()); + setBanCount(static_cast<U32>(gdatap->mBanList.size())); } void LLPanelGroupBanListSubTab::setGroupID(const LLUUID& id) @@ -3320,6 +3322,6 @@ void LLPanelGroupBanListSubTab::setGroupID(const LLUUID& id) if(mBanList) mBanList->deleteAllItems(); - setFooterEnabled(FALSE); + setFooterEnabled(false); LLPanelGroupSubTab::setGroupID(id); } diff --git a/indra/newview/llpanelgrouproles.h b/indra/newview/llpanelgrouproles.h index da384032cf..e320efa1c7 100644 --- a/indra/newview/llpanelgrouproles.h +++ b/indra/newview/llpanelgrouproles.h @@ -53,14 +53,14 @@ public: friend class LLPanelGroupRolesSubTab; friend class LLPanelGroupActionsSubTab; - virtual BOOL postBuild(); - virtual BOOL isVisibleByAgent(LLAgent* agentp); + virtual bool postBuild(); + virtual bool isVisibleByAgent(LLAgent* agentp); bool handleSubTabSwitch(const LLSD& data); // Checks if the current tab needs to be applied, and tries to switch to the requested tab. - BOOL attemptTransition(); + bool attemptTransition(); // Switches to the requested tab (will close() if requested is NULL) void transitionToTab(); @@ -73,7 +73,7 @@ public: virtual void activate(); virtual void deactivate(); virtual bool needsApply(std::string& mesg); - virtual BOOL hasModal(); + virtual bool hasModal(); virtual bool apply(std::string& mesg); virtual void cancel(); virtual void update(LLGroupChange gc); @@ -84,7 +84,7 @@ protected: LLPanelGroupTab* mCurrentTab; LLPanelGroupTab* mRequestedTab; LLTabContainer* mSubTabContainer; - BOOL mFirstUse; + bool mFirstUse; std::string mDefaultNeedsApplyMesg; std::string mWantApplyMesg; @@ -97,10 +97,10 @@ public: LLPanelGroupSubTab(); virtual ~LLPanelGroupSubTab(); - virtual BOOL postBuild(); + virtual bool postBuild(); // This allows sub-tabs to collect child widgets from a higher level in the view hierarchy. - virtual BOOL postBuildSubTab(LLView* root); + virtual bool postBuildSubTab(LLView* root); virtual void setSearchFilter( const std::string& filter ); @@ -111,7 +111,7 @@ public: bool matchesActionSearchFilter(std::string action); - void setFooterEnabled(BOOL enable); + void setFooterEnabled(bool enable); virtual void setGroupID(const LLUUID& id); protected: @@ -119,23 +119,24 @@ protected: U64 allowed_by_some, U64 allowed_by_all, LLUICtrl::commit_callback_t commit_callback, - BOOL show_all, - BOOL filter, - BOOL is_owner_role); + bool show_all, + bool filter, + bool is_owner_role); void buildActionCategory(LLScrollListCtrl* ctrl, U64 allowed_by_some, U64 allowed_by_all, LLRoleActionSet* action_set, LLUICtrl::commit_callback_t commit_callback, - BOOL show_all, - BOOL filter, - BOOL is_owner_role); + bool show_all, + bool filter, + bool is_owner_role); protected: LLPanel* mHeader; // Might not be present in xui of derived class (NULL) LLPanel* mFooter; LLFilterEditor* mSearchEditor; + boost::signals2::connection mSearchCommitConnection; std::string mSearchFilter; @@ -146,7 +147,7 @@ protected: bool mHasGroupBanPower; // Used to communicate between action sets due to the dependency between // GP_GROUP_BAN_ACCESS and GP_EJECT_MEMBER and GP_ROLE_REMOVE_MEMBER - void setOthersVisible(BOOL b); + void setOthersVisible(bool b); }; @@ -156,7 +157,7 @@ public: LLPanelGroupMembersSubTab(); virtual ~LLPanelGroupMembersSubTab(); - virtual BOOL postBuildSubTab(LLView* root); + virtual bool postBuildSubTab(LLView* root); static void onMemberSelect(LLUICtrl*, void*); void handleMemberSelect(); @@ -219,9 +220,9 @@ protected: LLButton* mEjectBtn; LLButton* mBanBtn; - BOOL mChanged; - BOOL mPendingMemberUpdate; - BOOL mHasMatch; + bool mChanged; + bool mPendingMemberUpdate; + bool mHasMatch; LLTextEditor* mActionDescription; @@ -240,7 +241,7 @@ public: LLPanelGroupRolesSubTab(); virtual ~LLPanelGroupRolesSubTab(); - virtual BOOL postBuildSubTab(LLView* root); + virtual bool postBuildSubTab(LLView* root); virtual void activate(); virtual void deactivate(); @@ -281,7 +282,7 @@ public: virtual void setGroupID(const LLUUID& id); - BOOL mFirstOpen; + bool mFirstOpen; protected: void handleActionCheck(LLUICtrl* ctrl, bool force); @@ -302,7 +303,7 @@ protected: LLButton* mCopyRoleButton; LLUUID mSelectedRole; - BOOL mHasRoleChange; + bool mHasRoleChange; std::string mRemoveEveryoneTxt; }; @@ -313,7 +314,7 @@ public: LLPanelGroupActionsSubTab(); virtual ~LLPanelGroupActionsSubTab(); - virtual BOOL postBuildSubTab(LLView* root); + virtual bool postBuildSubTab(LLView* root); virtual void activate(); @@ -341,7 +342,7 @@ public: LLPanelGroupBanListSubTab(); virtual ~LLPanelGroupBanListSubTab() {} - virtual BOOL postBuildSubTab(LLView* root); + virtual bool postBuildSubTab(LLView* root); virtual void activate(); virtual void update(LLGroupChange gc); diff --git a/indra/newview/llpanelhome.cpp b/indra/newview/llpanelhome.cpp index bce7ea2c00..a17d101539 100644 --- a/indra/newview/llpanelhome.cpp +++ b/indra/newview/llpanelhome.cpp @@ -52,7 +52,7 @@ void LLPanelHome::onOpen(const LLSD& key) mFirstView = false; } -BOOL LLPanelHome::postBuild() +bool LLPanelHome::postBuild() { mBrowser = getChild<LLMediaCtrl>("browser"); if (mBrowser) @@ -64,7 +64,7 @@ BOOL LLPanelHome::postBuild() mBrowser->setHomePageUrl(url); } - return TRUE; + return true; } void LLPanelHome::handleMediaEvent(LLPluginClassMedia *self, EMediaEvent event) diff --git a/indra/newview/llpanelhome.h b/indra/newview/llpanelhome.h index bdb65eb17b..e4687d1765 100644 --- a/indra/newview/llpanelhome.h +++ b/indra/newview/llpanelhome.h @@ -44,7 +44,7 @@ class LLPanelHome : public: LLPanelHome(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void onOpen(const LLSD& key); private: diff --git a/indra/newview/llpanelland.cpp b/indra/newview/llpanelland.cpp index ea0114afe7..3e22374294 100644 --- a/indra/newview/llpanelland.cpp +++ b/indra/newview/llpanelland.cpp @@ -56,7 +56,7 @@ public: }; -BOOL LLPanelLandInfo::postBuild() +bool LLPanelLandInfo::postBuild() { childSetAction("button buy land",boost::bind(onClickClaim)); childSetAction("button abandon land", boost::bind(onClickRelease)); @@ -67,7 +67,7 @@ BOOL LLPanelLandInfo::postBuild() mCheckShowOwners = getChild<LLCheckBoxCtrl>("checkbox show owners"); getChild<LLUICtrl>("checkbox show owners")->setValue(gSavedSettings.getBOOL("ShowParcelOwners")); - return TRUE; + return true; } // // Methods @@ -125,11 +125,11 @@ void LLPanelLandInfo::refresh() //mTextPrice->setText(LLStringUtil::null); getChild<LLUICtrl>("textbox price")->setValue(LLStringUtil::null); - getChildView("button buy land")->setEnabled(FALSE); - getChildView("button abandon land")->setEnabled(FALSE); - getChildView("button subdivide land")->setEnabled(FALSE); - getChildView("button join land")->setEnabled(FALSE); - getChildView("button about land")->setEnabled(FALSE); + getChildView("button buy land")->setEnabled(false); + getChildView("button abandon land")->setEnabled(false); + getChildView("button subdivide land")->setEnabled(false); + getChildView("button join land")->setEnabled(false); + getChildView("button about land")->setEnabled(false); } else { @@ -137,30 +137,30 @@ void LLPanelLandInfo::refresh() const LLUUID& owner_id = parcel->getOwnerID(); const LLUUID& auth_buyer_id = parcel->getAuthorizedBuyerID(); - BOOL is_public = parcel->isPublic(); - BOOL is_for_sale = parcel->getForSale() + bool is_public = parcel->isPublic(); + bool is_for_sale = parcel->getForSale() && ((parcel->getSalePrice() > 0) || (auth_buyer_id.notNull())); - BOOL can_buy = (is_for_sale + bool can_buy = (is_for_sale && (owner_id != gAgent.getID()) && ((gAgent.getID() == auth_buyer_id) || (auth_buyer_id.isNull()))); if (is_public && !LLViewerParcelMgr::getInstance()->getParcelSelection()->getMultipleOwners()) { - getChildView("button buy land")->setEnabled(TRUE); + getChildView("button buy land")->setEnabled(true); } else { getChildView("button buy land")->setEnabled(can_buy); } - BOOL owner_release = LLViewerParcelMgr::isParcelOwnedByAgent(parcel, GP_LAND_RELEASE); - BOOL owner_divide = LLViewerParcelMgr::isParcelOwnedByAgent(parcel, GP_LAND_DIVIDE_JOIN); + bool owner_release = LLViewerParcelMgr::isParcelOwnedByAgent(parcel, GP_LAND_RELEASE); + bool owner_divide = LLViewerParcelMgr::isParcelOwnedByAgent(parcel, GP_LAND_DIVIDE_JOIN); - BOOL manager_releaseable = ( gAgent.canManageEstate() + bool manager_releaseable = ( gAgent.canManageEstate() && (parcel->getOwnerID() == regionp->getOwner()) ); - BOOL manager_divideable = ( gAgent.canManageEstate() + bool manager_divideable = ( gAgent.canManageEstate() && ((parcel->getOwnerID() == regionp->getOwner()) || owner_divide) ); getChildView("button abandon land")->setEnabled(owner_release || manager_releaseable || gAgent.isGodlike()); @@ -183,21 +183,21 @@ void LLPanelLandInfo::refresh() //&& LLViewerParcelMgr::getInstance()->getSelfCount() > 1 && !LLViewerParcelMgr::getInstance()->getParcelSelection()->getWholeParcelSelected()) { - getChildView("button join land")->setEnabled(TRUE); + getChildView("button join land")->setEnabled(true); } else { LL_DEBUGS() << "Invalid selection for joining land" << LL_ENDL; - getChildView("button join land")->setEnabled(FALSE); + getChildView("button join land")->setEnabled(false); } - getChildView("button about land")->setEnabled(TRUE); + getChildView("button about land")->setEnabled(true); // show pricing information S32 area; S32 claim_price; S32 rent_price; - BOOL for_sale; + bool for_sale; F32 dwell; LLViewerParcelMgr::getInstance()->getDisplayInfo(&area, &claim_price, diff --git a/indra/newview/llpanelland.h b/indra/newview/llpanelland.h index 0beb579cd6..7d0c6936bd 100644 --- a/indra/newview/llpanelland.h +++ b/indra/newview/llpanelland.h @@ -43,7 +43,7 @@ public: LLPanelLandInfo(); virtual ~LLPanelLandInfo(); - void refresh(); + void refresh() override; static void refreshAll(); LLCheckBoxCtrl *mCheckShowOwners; @@ -56,7 +56,7 @@ protected: static void onClickAbout(); protected: - virtual BOOL postBuild(); + bool postBuild() override; static LLPanelLandSelectObserver* sObserver; static LLPanelLandInfo* sInstance; diff --git a/indra/newview/llpanellandaudio.cpp b/indra/newview/llpanellandaudio.cpp index bad9c651a2..143fa5602a 100644 --- a/indra/newview/llpanellandaudio.cpp +++ b/indra/newview/llpanellandaudio.cpp @@ -74,7 +74,7 @@ LLPanelLandAudio::~LLPanelLandAudio() } -BOOL LLPanelLandAudio::postBuild() +bool LLPanelLandAudio::postBuild() { mCheckSoundLocal = getChild<LLCheckBoxCtrl>("check sound local"); childSetCommitCallback("check sound local", onCommitAny, this); @@ -100,7 +100,7 @@ BOOL LLPanelLandAudio::postBuild() mCheckObscureMOAP = getChild<LLCheckBoxCtrl>("obscure_moap"); childSetCommitCallback("obscure_moap", onCommitAny, this); - return TRUE; + return true; } @@ -118,7 +118,7 @@ void LLPanelLandAudio::refresh() // something selected, hooray! // Display options - BOOL can_change_media = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_CHANGE_MEDIA); + bool can_change_media = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_CHANGE_MEDIA); mCheckSoundLocal->set( parcel->getSoundLocal() ); mCheckSoundLocal->setEnabled( can_change_media ); @@ -154,7 +154,7 @@ void LLPanelLandAudio::refresh() mMusicURLEdit->setText(parcel->getMusicURL()); mMusicURLEdit->setEnabled( can_change_media ); - BOOL can_change_av_sounds = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_OPTIONS) && parcel->getHaveNewParcelLimitData(); + bool can_change_av_sounds = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_OPTIONS) && parcel->getHaveNewParcelLimitData(); mCheckAVSoundAny->set(parcel->getAllowAnyAVSounds()); mCheckAVSoundAny->setEnabled(can_change_av_sounds); @@ -177,14 +177,14 @@ void LLPanelLandAudio::onCommitAny(LLUICtrl*, void *userdata) } // Extract data from UI - BOOL sound_local = self->mCheckSoundLocal->get(); + bool sound_local = self->mCheckSoundLocal->get(); std::string music_url = self->mMusicURLEdit->getText(); - BOOL voice_enabled = self->mCheckParcelEnableVoice->get(); - BOOL voice_estate_chan = !self->mCheckParcelVoiceLocal->get(); + bool voice_enabled = self->mCheckParcelEnableVoice->get(); + bool voice_estate_chan = !self->mCheckParcelVoiceLocal->get(); - BOOL any_av_sound = self->mCheckAVSoundAny->get(); - BOOL group_av_sound = TRUE; // If set to "Everyone" then group is checked as well + bool any_av_sound = self->mCheckAVSoundAny->get(); + bool group_av_sound = true; // If set to "Everyone" then group is checked as well if (!any_av_sound) { // If "Everyone" is off, use the value from the checkbox group_av_sound = self->mCheckAVSoundGroup->get(); diff --git a/indra/newview/llpanellandaudio.h b/indra/newview/llpanellandaudio.h index 6a2f6c19fe..9fdcea0f59 100644 --- a/indra/newview/llpanellandaudio.h +++ b/indra/newview/llpanellandaudio.h @@ -39,7 +39,7 @@ class LLPanelLandAudio public: LLPanelLandAudio(LLSafeHandle<LLParcelSelection>& parcelp); /*virtual*/ ~LLPanelLandAudio(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); void refresh(); private: diff --git a/indra/newview/llpanellandmarkinfo.cpp b/indra/newview/llpanellandmarkinfo.cpp index f30be3faf3..41373cd7f5 100644 --- a/indra/newview/llpanellandmarkinfo.cpp +++ b/indra/newview/llpanellandmarkinfo.cpp @@ -69,7 +69,7 @@ LLPanelLandmarkInfo::~LLPanelLandmarkInfo() {} // virtual -BOOL LLPanelLandmarkInfo::postBuild() +bool LLPanelLandmarkInfo::postBuild() { LLPanelPlaceInfo::postBuild(); @@ -86,7 +86,7 @@ BOOL LLPanelLandmarkInfo::postBuild() icon_m = getString("icon_M"); icon_r = getString("icon_R"); - return TRUE; + return true; } // virtual @@ -134,9 +134,9 @@ void LLPanelLandmarkInfo::setInfoType(EInfoType type, const LLUUID &folder_id) { mCurrentTitle = getString("title_create_landmark"); - mLandmarkTitle->setVisible(FALSE); - mLandmarkTitleEditor->setVisible(TRUE); - mNotesEditor->setEnabled(TRUE); + mLandmarkTitle->setVisible(false); + mLandmarkTitleEditor->setVisible(true); + mNotesEditor->setEnabled(true); LLViewerParcelMgr* parcel_mgr = LLViewerParcelMgr::getInstance(); LLParcel* parcel = parcel_mgr->getAgentParcel(); @@ -203,16 +203,16 @@ void LLPanelLandmarkInfo::setInfoType(EInfoType type, const LLUUID &folder_id) default: mCurrentTitle = getString("title_landmark"); - mLandmarkTitle->setVisible(TRUE); - mLandmarkTitleEditor->setVisible(FALSE); - mNotesEditor->setEnabled(FALSE); + mLandmarkTitle->setVisible(true); + mLandmarkTitleEditor->setVisible(false); + mNotesEditor->setEnabled(false); break; } populateFoldersList(); // Prevent the floater from losing focus (if the sidepanel is undocked). - setFocus(TRUE); + setFocus(true); LLPanelPlaceInfo::setInfoType(type); } @@ -338,7 +338,7 @@ void LLPanelLandmarkInfo::displayItemInfo(const LLInventoryItem* pItem) mNotesEditor->setText(pItem->getDescription()); } -void LLPanelLandmarkInfo::toggleLandmarkEditMode(BOOL enabled) +void LLPanelLandmarkInfo::toggleLandmarkEditMode(bool enabled) { // If switching to edit mode while creating landmark // the "Create Landmark" title remains. @@ -353,7 +353,7 @@ void LLPanelLandmarkInfo::toggleLandmarkEditMode(BOOL enabled) mLandmarkTitle->setText(mLandmarkTitleEditor->getText()); } - if (mNotesEditor->getReadOnly() == (enabled == TRUE)) + if (mNotesEditor->getReadOnly() == enabled) { mLandmarkTitle->setVisible(!enabled); mLandmarkTitleEditor->setVisible(enabled); @@ -368,10 +368,10 @@ void LLPanelLandmarkInfo::toggleLandmarkEditMode(BOOL enabled) } // Prevent the floater from losing focus (if the sidepanel is undocked). - setFocus(TRUE); + setFocus(true); } -void LLPanelLandmarkInfo::setCanEdit(BOOL enabled) +void LLPanelLandmarkInfo::setCanEdit(bool enabled) { getChild<LLButton>("edit_btn")->setEnabled(enabled); } @@ -391,7 +391,7 @@ const LLUUID LLPanelLandmarkInfo::getLandmarkFolder() const return mFolderCombo->getValue().asUUID(); } -BOOL LLPanelLandmarkInfo::setLandmarkFolder(const LLUUID& id) +bool LLPanelLandmarkInfo::setLandmarkFolder(const LLUUID& id) { return mFolderCombo->setCurrentByID(id); } @@ -545,7 +545,7 @@ void LLPanelLandmarkInfo::collectLandmarkFolders(LLInventoryModel::cat_array_t& gInventory.accountForUpdate(update); mItem->setParent(mNewParentId); - mItem->updateParentOnServer(FALSE); + mItem->updateParentOnServer(false); gInventory.updateItem(mItem); gInventory.notifyObservers(); diff --git a/indra/newview/llpanellandmarkinfo.h b/indra/newview/llpanellandmarkinfo.h index f849adada3..af47af06ac 100644 --- a/indra/newview/llpanellandmarkinfo.h +++ b/indra/newview/llpanellandmarkinfo.h @@ -40,7 +40,7 @@ public: LLPanelLandmarkInfo(); /*virtual*/ ~LLPanelLandmarkInfo(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void resetLocation(); @@ -55,15 +55,15 @@ public: // Displays landmark owner, creator and creation date info. void displayItemInfo(const LLInventoryItem* pItem); - void toggleLandmarkEditMode(BOOL enabled); - void setCanEdit(BOOL enabled); + void toggleLandmarkEditMode(bool enabled); + void setCanEdit(bool enabled); const std::string& getLandmarkTitle() const; const std::string getLandmarkNotes() const; const LLUUID getLandmarkFolder() const; // Select current landmark folder in combobox. - BOOL setLandmarkFolder(const LLUUID& id); + bool setLandmarkFolder(const LLUUID& id); typedef std::vector<LLPointer<LLViewerInventoryCategory> > cat_array_t; static std::string getFullFolderName(const LLViewerInventoryCategory* cat); diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp index 2a726e3092..99133d1fb3 100644 --- a/indra/newview/llpanellandmarks.cpp +++ b/indra/newview/llpanellandmarks.cpp @@ -66,7 +66,7 @@ static void collapse_all_folders(LLFolderView* root_folder); static void expand_all_folders(LLFolderView* root_folder); static bool has_expanded_folders(LLFolderView* root_folder); static bool has_collapsed_folders(LLFolderView* root_folder); -static void toggle_restore_menu(LLMenuGL* menu, BOOL visible, BOOL enabled); +static void toggle_restore_menu(LLMenuGL* menu, bool visible, bool enabled); /** * Functor counting expanded and collapsed folders in folder view tree to know @@ -136,7 +136,7 @@ void LLOpenFolderByID::doFolder(LLFolderViewFolder* folder) { if (!folder->isOpen()) { - folder->setOpen(TRUE); + folder->setOpen(true); mIsFolderOpen = true; } } @@ -175,16 +175,16 @@ LLLandmarksPanel::~LLLandmarksPanel() { } -BOOL LLLandmarksPanel::postBuild() +bool LLLandmarksPanel::postBuild() { if (!gInventory.isInventoryUsable()) - return FALSE; + return false; // mast be called before any other initXXX methods to init Gear menu initListCommandsHandlers(); initLandmarksInventoryPanel(); - return TRUE; + return true; } // virtual @@ -292,7 +292,7 @@ void LLLandmarksPanel::updateVerbs() } } -void LLLandmarksPanel::setItemSelected(const LLUUID& obj_id, BOOL take_keyboard_focus) +void LLLandmarksPanel::setItemSelected(const LLUUID& obj_id, bool take_keyboard_focus) { if (!mCurrentSelectedList) return; @@ -301,7 +301,7 @@ void LLLandmarksPanel::setItemSelected(const LLUUID& obj_id, BOOL take_keyboard_ LLFolderViewItem* item = mCurrentSelectedList->getItemByID(obj_id); if (!item) return; - root->setSelection(item, FALSE, take_keyboard_focus); + root->setSelection(item, false, take_keyboard_focus); root->scrollToShowSelection(); } @@ -473,18 +473,18 @@ void LLLandmarksPanel::initListCommandsHandlers() { mGearLandmarkMenu->setVisibilityChangeCallback(boost::bind(&LLLandmarksPanel::onMenuVisibilityChange, this, _1, _2)); // show menus even if all items are disabled - mGearLandmarkMenu->setAlwaysShowMenu(TRUE); + mGearLandmarkMenu->setAlwaysShowMenu(true); } // Else corrupted files? if (mGearFolderMenu) { mGearFolderMenu->setVisibilityChangeCallback(boost::bind(&LLLandmarksPanel::onMenuVisibilityChange, this, _1, _2)); - mGearFolderMenu->setAlwaysShowMenu(TRUE); + mGearFolderMenu->setAlwaysShowMenu(true); } if (mAddMenu) { - mAddMenu->setAlwaysShowMenu(TRUE); + mAddMenu->setAlwaysShowMenu(true); } } @@ -887,8 +887,8 @@ void LLLandmarksPanel::onMenuVisibilityChange(LLUICtrl* ctrl, const LLSD& param) // We don't have to update items visibility if the menu is hiding. if (!new_visibility) return; - BOOL are_any_items_in_trash = FALSE; - BOOL are_all_items_in_trash = TRUE; + bool are_any_items_in_trash = false; + bool are_all_items_in_trash = true; LLFolderView* root_folder_view = mCurrentSelectedList ? mCurrentSelectedList->getRootFolder() : NULL; if(root_folder_view) @@ -1004,7 +1004,7 @@ bool LLLandmarksPanel::canItemBeModified(const std::string& command_name, LLFold return can_be_modified; } -bool LLLandmarksPanel::handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, void* cargo_data , EAcceptance* accept) +bool LLLandmarksPanel::handleDragAndDropToTrash(bool drop, EDragAndDropType cargo_type, void* cargo_data , EAcceptance* accept) { *accept = ACCEPT_NO; @@ -1062,7 +1062,7 @@ void LLLandmarksPanel::doShowOnMap(LLLandmark* landmark) if (mGearLandmarkMenu) { - mGearLandmarkMenu->setItemEnabled("show_on_map", TRUE); + mGearLandmarkMenu->setItemEnabled("show_on_map", true); } } @@ -1151,7 +1151,7 @@ static void collapse_all_folders(LLFolderView* root_folder) if (!root_folder) return; - root_folder->setOpenArrangeRecursively(FALSE, LLFolderViewFolder::RECURSE_DOWN); + root_folder->setOpenArrangeRecursively(false, LLFolderViewFolder::RECURSE_DOWN); root_folder->arrangeAll(); } @@ -1160,7 +1160,7 @@ static void expand_all_folders(LLFolderView* root_folder) if (!root_folder) return; - root_folder->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_DOWN); + root_folder->setOpenArrangeRecursively(true, LLFolderViewFolder::RECURSE_DOWN); root_folder->arrangeAll(); } @@ -1195,7 +1195,7 @@ static bool has_collapsed_folders(LLFolderView* root_folder) // Displays "Restore Item" context menu entry while hiding // all other entries or vice versa. // Sets "Restore Item" enabled state. -void toggle_restore_menu(LLMenuGL *menu, BOOL visible, BOOL enabled) +void toggle_restore_menu(LLMenuGL *menu, bool visible, bool enabled) { if (!menu) return; @@ -1225,17 +1225,17 @@ LLFavoritesPanel::LLFavoritesPanel() buildFromFile("panel_favorites.xml"); } -BOOL LLFavoritesPanel::postBuild() +bool LLFavoritesPanel::postBuild() { if (!gInventory.isInventoryUsable()) - return FALSE; + return false; // mast be called before any other initXXX methods to init Gear menu LLLandmarksPanel::initListCommandsHandlers(); initFavoritesInventoryPanel(); - return TRUE; + return true; } void LLFavoritesPanel::initFavoritesInventoryPanel() diff --git a/indra/newview/llpanellandmarks.h b/indra/newview/llpanellandmarks.h index 227451607e..30e9188044 100644 --- a/indra/newview/llpanellandmarks.h +++ b/indra/newview/llpanellandmarks.h @@ -52,7 +52,7 @@ public: LLLandmarksPanel(bool is_landmark_panel); virtual ~LLLandmarksPanel(); - BOOL postBuild() override; + bool postBuild() override; void onSearchEdit(const std::string& string) override; void onShowOnMap() override; void onShowProfile() override; @@ -68,7 +68,7 @@ public: /** * Processes drag-n-drop of the Landmarks and folders into trash button. */ - bool handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept) override; + bool handleDragAndDropToTrash(bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept) override; void setCurrentSelectedList(LLPlacesInventoryPanel* inventory_list) { @@ -78,7 +78,7 @@ public: /** * Selects item with "obj_id" in one of accordion tabs. */ - void setItemSelected(const LLUUID& obj_id, BOOL take_keyboard_focus); + void setItemSelected(const LLUUID& obj_id, bool take_keyboard_focus); void updateMenuVisibility(LLUICtrl* menu); @@ -162,7 +162,7 @@ class LLFavoritesPanel : public LLLandmarksPanel public: LLFavoritesPanel(); - BOOL postBuild() override; + bool postBuild() override; void initFavoritesInventoryPanel(); }; diff --git a/indra/newview/llpanellandmedia.cpp b/indra/newview/llpanellandmedia.cpp index 9aff1661ff..294bd4021d 100644 --- a/indra/newview/llpanellandmedia.cpp +++ b/indra/newview/llpanellandmedia.cpp @@ -78,12 +78,12 @@ LLPanelLandMedia::~LLPanelLandMedia() { } -BOOL LLPanelLandMedia::postBuild() +bool LLPanelLandMedia::postBuild() { mMediaTextureCtrl = getChild<LLTextureCtrl>("media texture"); mMediaTextureCtrl->setCommitCallback( onCommitAny, this ); - mMediaTextureCtrl->setAllowNoTexture ( TRUE ); + mMediaTextureCtrl->setAllowNoTexture ( true ); mMediaTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); mMediaTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); @@ -112,7 +112,7 @@ BOOL LLPanelLandMedia::postBuild() mSetURLButton = getChild<LLButton>("set_media_url"); childSetAction("set_media_url", onSetBtn, this); - return TRUE; + return true; } @@ -130,10 +130,10 @@ void LLPanelLandMedia::refresh() // something selected, hooray! // Display options - BOOL can_change_media = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_CHANGE_MEDIA); + bool can_change_media = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_CHANGE_MEDIA); mMediaURLEdit->setText(parcel->getMediaURL()); - mMediaURLEdit->setEnabled( FALSE ); + mMediaURLEdit->setEnabled( false ); getChild<LLUICtrl>("current_url")->setValue(parcel->getMediaCurrentURL()); @@ -149,14 +149,14 @@ void LLPanelLandMedia::refresh() mMediaTypeCombo->setEnabled( can_change_media ); getChild<LLUICtrl>("mime_type")->setValue(mime_type); - mMediaAutoScaleCheck->set( parcel->getMediaAutoScale () ); + mMediaAutoScaleCheck->set( static_cast<bool>(parcel->getMediaAutoScale()) ); mMediaAutoScaleCheck->setEnabled ( can_change_media ); // Special code to disable looping checkbox for HTML MIME type // (DEV-10042 -- Parcel Media: "Loop Media" should be disabled for static media types) bool allow_looping = LLMIMETypes::findAllowLooping( mime_type ); if ( allow_looping ) - mMediaLoopCheck->set( parcel->getMediaLoop () ); + mMediaLoopCheck->set( static_cast<bool>(parcel->getMediaLoop()) ); else mMediaLoopCheck->set( false ); mMediaLoopCheck->setEnabled ( can_change_media && allow_looping ); @@ -275,8 +275,8 @@ void LLPanelLandMedia::onCommitAny(LLUICtrl*, void *userdata) std::string media_url = self->mMediaURLEdit->getText(); std::string media_desc = self->mMediaDescEdit->getText(); std::string mime_type = self->getChild<LLUICtrl>("mime_type")->getValue().asString(); - U8 media_auto_scale = self->mMediaAutoScaleCheck->get(); - U8 media_loop = self->mMediaLoopCheck->get(); + U8 media_auto_scale = static_cast<U8>(self->mMediaAutoScaleCheck->get()); + U8 media_loop = static_cast<U8>(self->mMediaLoopCheck->get()); S32 media_width = (S32)self->mMediaWidthCtrl->get(); S32 media_height = (S32)self->mMediaHeightCtrl->get(); LLUUID media_id = self->mMediaTextureCtrl->getImageAssetID(); diff --git a/indra/newview/llpanellandmedia.h b/indra/newview/llpanellandmedia.h index 2bcd1fa14d..161784f047 100644 --- a/indra/newview/llpanellandmedia.h +++ b/indra/newview/llpanellandmedia.h @@ -39,7 +39,7 @@ class LLPanelLandMedia public: LLPanelLandMedia(LLSafeHandle<LLParcelSelection>& parcelp); /*virtual*/ ~LLPanelLandMedia(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); void refresh(); void setMediaType(const std::string& media_type); void setMediaURL(const std::string& media_type); diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 86f56f0949..ed80c8b732 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -74,8 +74,8 @@ #include "llsdserialize.h" LLPanelLogin *LLPanelLogin::sInstance = NULL; -BOOL LLPanelLogin::sCapslockDidNotification = FALSE; -BOOL LLPanelLogin::sCredentialSet = FALSE; +bool LLPanelLogin::sCapslockDidNotification = false; +bool LLPanelLogin::sCredentialSet = false; // Helper functions @@ -190,10 +190,10 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, mLocationLength(0), mShowFavorites(false) { - setBackgroundVisible(FALSE); - setBackgroundOpaque(TRUE); + setBackgroundVisible(false); + setBackgroundOpaque(true); - mPasswordModified = FALSE; + mPasswordModified = false; sInstance = this; @@ -321,7 +321,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, // STEAM-14: When user presses Enter with this field in focus, initiate login username_combo->setCommitCallback(boost::bind(&LLPanelLogin::onUserListCommit, this)); username_combo->setReturnCallback(boost::bind(&LLPanelLogin::onClickConnect, this)); - username_combo->setKeystrokeOnEsc(TRUE); + username_combo->setKeystrokeOnEsc(true); LLCheckBoxCtrl* remember_name = getChild<LLCheckBoxCtrl>("remember_name"); @@ -335,7 +335,7 @@ void LLPanelLogin::addFavoritesToStartLocation() { // first login panel has no favorites, just update name length and buttons std::string user_defined_name = getChild<LLComboBox>("username_combo")->getSimple(); - mUsernameLength = user_defined_name.length(); + mUsernameLength = static_cast<unsigned int>(user_defined_name.length()); updateLoginButtons(); return; } @@ -355,7 +355,7 @@ void LLPanelLogin::addFavoritesToStartLocation() LLStringUtil::toLower(user_defined_name); std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites_" + LLGridManager::getInstance()->getGrid() + ".xml"); std::string old_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml"); - mUsernameLength = user_defined_name.length(); + mUsernameLength = static_cast<unsigned int>(user_defined_name.length()); updateLoginButtons(); std::string::size_type index = user_defined_name.find_first_of(" ._"); @@ -428,7 +428,7 @@ void LLPanelLogin::addFavoritesToStartLocation() } if (update_password_setting) { - gSavedSettings.setBOOL("UpdateRememberPasswordSetting", TRUE); + gSavedSettings.setBOOL("UpdateRememberPasswordSetting", true); } break; } @@ -451,7 +451,7 @@ LLPanelLogin::~LLPanelLogin() } // virtual -void LLPanelLogin::setFocus(BOOL b) +void LLPanelLogin::setFocus(bool b) { if(b != hasFocus()) { @@ -475,8 +475,8 @@ void LLPanelLogin::giveFocus() std::string username = sInstance->getChild<LLUICtrl>("username_combo")->getValue().asString(); std::string pass = sInstance->getChild<LLUICtrl>("password_edit")->getValue().asString(); - BOOL have_username = !username.empty(); - BOOL have_pass = !pass.empty(); + bool have_username = !username.empty(); + bool have_pass = !pass.empty(); LLLineEditor* edit = NULL; LLComboBox* combo = NULL; @@ -494,12 +494,12 @@ void LLPanelLogin::giveFocus() if (edit) { - edit->setFocus(TRUE); + edit->setFocus(true); edit->selectAll(); } else if (combo) { - combo->setFocus(TRUE); + combo->setFocus(true); } } } @@ -517,7 +517,7 @@ void LLPanelLogin::show(const LLRect &rect, if( !gFocusMgr.getKeyboardFocus() ) { // Grab focus and move cursor to first enabled control - sInstance->setFocus(TRUE); + sInstance->setFocus(true); } // Make sure that focus always goes here (and use the latest sInstance that was just created) @@ -579,7 +579,7 @@ void LLPanelLogin::setFields(LLPointer<LLCredential> credential) LL_WARNS() << "Attempted fillFields with no login view shown" << LL_ENDL; return; } - sCredentialSet = TRUE; + sCredentialSet = true; LL_INFOS("Credentials") << "Setting login fields to " << *credential << LL_ENDL; LLSD identifier = credential.notNull() ? credential->getIdentifier() : LLSD(); @@ -597,13 +597,13 @@ void LLPanelLogin::setFields(LLPointer<LLCredential> credential) login_id += lastname; } sInstance->getChild<LLComboBox>("username_combo")->setLabel(login_id); - sInstance->mUsernameLength = login_id.length(); + sInstance->mUsernameLength = static_cast<unsigned int>(login_id.length()); } else if(identifier.has("type") && (std::string)identifier["type"] == "account") { std::string login_id = identifier["account_name"].asString(); sInstance->getChild<LLComboBox>("username_combo")->setLabel(login_id); - sInstance->mUsernameLength = login_id.length(); + sInstance->mUsernameLength = static_cast<unsigned int>(login_id.length()); } else { @@ -627,7 +627,7 @@ void LLPanelLogin::setFields(LLPointer<LLCredential> credential) // nice row of asterisks. const std::string filler("123456789!123456"); sInstance->getChild<LLUICtrl>("password_edit")->setValue(filler); - sInstance->mPasswordLength = filler.length(); + sInstance->mPasswordLength = static_cast<unsigned int>(filler.length()); sInstance->updateLoginButtons(); } else @@ -715,7 +715,7 @@ void LLPanelLogin::getFields(LLPointer<LLCredential>& credential, // static -BOOL LLPanelLogin::areCredentialFieldsDirty() +bool LLPanelLogin::areCredentialFieldsDirty() { if (!sInstance) { @@ -743,7 +743,7 @@ void LLPanelLogin::updateLocationSelectorsVisibility() { if (sInstance) { - BOOL show_server = gSavedSettings.getBOOL("ForceShowGrid"); + bool show_server = gSavedSettings.getBOOL("ForceShowGrid"); LLComboBox* server_combo = sInstance->getChild<LLComboBox>("server_combo"); if ( server_combo ) { @@ -793,7 +793,7 @@ void LLPanelLogin::onUpdateStartSLURL(const LLSLURL& new_start_slurl) { location_combo->setLabel(new_start_slurl.getLocationString()); - sInstance->mLocationLength = new_start_slurl.getLocationString().length(); + sInstance->mLocationLength = static_cast<unsigned int>(new_start_slurl.getLocationString().length()); sInstance->updateLoginButtons(); } } @@ -890,7 +890,7 @@ void LLPanelLogin::loadLoginPage() // First Login? if (gSavedSettings.getBOOL("FirstLoginThisInstall")) { - params["firstlogin"] = "TRUE"; // not bool: server expects string TRUE + params["firstlogin"] = "true"; // not bool: server expects string true } // Channel and Version @@ -941,7 +941,7 @@ void LLPanelLogin::onClickConnect(bool commit_fields) if (commit_fields) { // JC - Make sure the fields all get committed. - sInstance->setFocus(FALSE); + sInstance->setFocus(false); } LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo"); @@ -977,7 +977,7 @@ void LLPanelLogin::onClickConnect(bool commit_fields) } else { - sCredentialSet = FALSE; + sCredentialSet = false; LLPointer<LLCredential> cred; bool remember_1, remember_2; getFields(cred, remember_1, remember_2); @@ -1101,7 +1101,7 @@ void LLPanelLogin::onRememberPasswordCheck(void*) { if (sInstance) { - gSavedSettings.setBOOL("UpdateRememberPasswordSetting", TRUE); + gSavedSettings.setBOOL("UpdateRememberPasswordSetting", true); LLPointer<LLCredential> cred; bool remember_user, remember_password; @@ -1116,15 +1116,15 @@ void LLPanelLogin::onRememberPasswordCheck(void*) void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data) { LLPanelLogin *self = (LLPanelLogin *)user_data; - self->mPasswordModified = TRUE; - if (gKeyboard->getKeyDown(KEY_CAPSLOCK) && sCapslockDidNotification == FALSE) + self->mPasswordModified = true; + if (gKeyboard->getKeyDown(KEY_CAPSLOCK) && !sCapslockDidNotification) { // *TODO: use another way to notify user about enabled caps lock, see EXT-6858 - sCapslockDidNotification = TRUE; + sCapslockDidNotification = true; } LLLineEditor* password_edit(self->getChild<LLLineEditor>("password_edit")); - self->mPasswordLength = password_edit->getText().length(); + self->mPasswordLength = static_cast<unsigned int>(password_edit->getText().length()); self->updateLoginButtons(); } @@ -1158,8 +1158,8 @@ void LLPanelLogin::updateServer() // restore creds user_combo->setTextEntry(username); pswd_edit->setValue(password); - sInstance->mUsernameLength = username.length(); - sInstance->mPasswordLength = password.length(); + sInstance->mUsernameLength = static_cast<unsigned int>(username.length()); + sInstance->mPasswordLength = static_cast<unsigned int>(password.length()); } else { @@ -1205,7 +1205,7 @@ void LLPanelLogin::updateLoginButtons() { remember_name->setValue(true); LLCheckBoxCtrl* remember_pass = getChild<LLCheckBoxCtrl>("remember_password"); - remember_pass->setEnabled(TRUE); + remember_pass->setEnabled(true); } // Note: might be good idea to do "else remember_name->setValue(mRememberedState)" but it might behave 'weird' to user } } @@ -1232,7 +1232,7 @@ void LLPanelLogin::populateUserList(LLPointer<LLCredential> credential) if (cr_iter->second.notNull()) // basic safety in case of future changes { // cr_iter->first == user_id , to be able to be find it in case we select it - user_combo->add(LLPanelLogin::getUserName(cr_iter->second), cr_iter->first, ADD_BOTTOM, TRUE); + user_combo->add(LLPanelLogin::getUserName(cr_iter->second), cr_iter->first, ADD_BOTTOM, true); } cr_iter++; } diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h index 7f4c2487bf..00fd17badf 100644 --- a/indra/newview/llpanellogin.h +++ b/indra/newview/llpanellogin.h @@ -49,7 +49,7 @@ public: void *callback_data); ~LLPanelLogin(); - virtual void setFocus( BOOL b ); + virtual void setFocus( bool b ); static void show(const LLRect &rect, void (*callback)(S32 option, void* user_data), @@ -60,9 +60,9 @@ public: static void resetFields(); static void getFields(LLPointer<LLCredential>& credential, bool& remember_user, bool& remember_psswrd); - static BOOL isCredentialSet() { return sCredentialSet; } + static bool isCredentialSet() { return sCredentialSet; } - static BOOL areCredentialFieldsDirty(); + static bool areCredentialFieldsDirty(); static void setLocation(const LLSLURL& slurl); static void autologinToLocation(const LLSLURL& slurl); @@ -71,8 +71,6 @@ public: static void closePanel(); - void setSiteIsAlive( bool alive ); - static void loadLoginPage(); static void giveFocus(); static void setAlwaysRefresh(bool refresh); @@ -93,14 +91,12 @@ public: private: friend class LLPanelLoginListener; void addFavoritesToStartLocation(); - void addUsersWithFavoritesToUsername(); void onSelectServer(); void onLocationSLURL(); static void setFields(LLPointer<LLCredential> credential); static void onClickConnect(bool commit_fields = true); - static void onClickNewAccount(void*); static void onClickVersion(void*); static void onClickForgotPassword(void*); static void onClickSignUp(void*); @@ -109,7 +105,6 @@ private: static void onRememberUserCheck(void*); static void onRememberPasswordCheck(void*); static void onPassKey(LLLineEditor* caller, void* user_data); - static void updateServerCombo(); private: std::unique_ptr<LLPanelLoginListener> mListener; @@ -120,14 +115,14 @@ private: void (*mCallback)(S32 option, void *userdata); void* mCallbackData; - BOOL mPasswordModified; + bool mPasswordModified; bool mShowFavorites; static LLPanelLogin* sInstance; - static BOOL sCapslockDidNotification; + static bool sCapslockDidNotification; bool mFirstLoginThisInstall; - static BOOL sCredentialSet; + static bool sCredentialSet; unsigned int mUsernameLength; unsigned int mPasswordLength; diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 5111241e92..ba52da0760 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -56,6 +56,7 @@ #include "lltrans.h" #include "llviewermenu.h" #include "llviewertexturelist.h" +#include "llviewerinventory.h" #include "llsidepanelinventory.h" #include "llfolderview.h" #include "llradiogroup.h" @@ -79,11 +80,11 @@ class LLFloaterInventoryFinder : public LLFloater public: LLFloaterInventoryFinder( LLPanelMainInventory* inventory_view); virtual void draw(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); void changeFilter(LLInventoryFilter* filter); void updateElementsFromFilter(); - BOOL getCheckShowEmpty(); - BOOL getCheckSinceLogoff(); + bool getCheckShowEmpty(); + bool getCheckSinceLogoff(); U32 getDateSearchDirection(); void onCreatorSelfFilterCommit(); @@ -138,10 +139,10 @@ LLPanelMainInventory::LLPanelMainInventory(const LLPanel::Params& p) mSavedFolderState = new LLSaveFolderState(); - mSavedFolderState->setApply(FALSE); + mSavedFolderState->setApply(false); } -BOOL LLPanelMainInventory::postBuild() +bool LLPanelMainInventory::postBuild() { gInventory.addObserver(this); @@ -167,7 +168,7 @@ BOOL LLPanelMainInventory::postBuild() if (recent_items_panel) { // assign default values until we will be sure that we have setting to restore - recent_items_panel->setSinceLogoff(TRUE); + recent_items_panel->setSinceLogoff(true); recent_items_panel->setSortOrder(LLInventoryFilter::SO_DATE); recent_items_panel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); LLInventoryFilter& recent_filter = recent_items_panel->getFilter(); @@ -289,7 +290,7 @@ BOOL LLPanelMainInventory::postBuild() // Trigger callback for focus received so we can deselect items in inbox/outbox LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLPanelMainInventory::onFocusReceived, this)); - return TRUE; + return true; } // Destroys the object @@ -379,11 +380,11 @@ void LLPanelMainInventory::startSearch() // this forces focus to line editor portion of search editor if (mFilterEditor) { - mFilterEditor->focusFirstItem(TRUE); + mFilterEditor->focusFirstItem(true); } } -BOOL LLPanelMainInventory::handleKeyHere(KEY key, MASK mask) +bool LLPanelMainInventory::handleKeyHere(KEY key, MASK mask) { LLFolderView* root_folder = mActivePanel ? mActivePanel->getRootFolder() : NULL; if (root_folder) @@ -396,9 +397,9 @@ BOOL LLPanelMainInventory::handleKeyHere(KEY key, MASK mask) && mask == MASK_NONE) { // move focus to inventory proper - mActivePanel->setFocus(TRUE); + mActivePanel->setFocus(true); root_folder->scrollToShowSelection(); - return TRUE; + return true; } if (mActivePanel->hasFocus() && key == KEY_UP) @@ -595,7 +596,7 @@ void LLPanelMainInventory::findLinks(const LLUUID& item_id, const std::string& i filter.setFindAllLinksMode(item_name, item_id); mFilterEditor->setText(item_name); - mFilterEditor->setFocus(TRUE); + mFilterEditor->setFocus(true); } void LLPanelMainInventory::setSortBy(const LLSD& userdata) @@ -722,17 +723,17 @@ void LLPanelMainInventory::updateSearchTypeCombo() } // static -BOOL LLPanelMainInventory::filtersVisible(void* user_data) +bool LLPanelMainInventory::filtersVisible(void* user_data) { LLPanelMainInventory* self = (LLPanelMainInventory*)user_data; - if(!self) return FALSE; + if(!self) return false; return self->getFinder() != NULL; } void LLPanelMainInventory::onClearSearch() { - BOOL initially_active = FALSE; + bool initially_active = false; LLFloater *finder = getFinder(); if (mActivePanel && (getActivePanel() != mWornItemsPanel)) { @@ -750,7 +751,7 @@ void LLPanelMainInventory::onClearSearch() // re-open folders that were initially open in case filter was active if (mActivePanel && (mFilterSubString.size() || initially_active) && !mSingleFolderMode) { - mSavedFolderState->setApply(TRUE); + mSavedFolderState->setApply(true); mActivePanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState); LLOpenFoldersWithSelection opener; mActivePanel->getRootFolder()->applyFunctorRecursively(opener); @@ -808,7 +809,7 @@ void LLPanelMainInventory::onFilterEdit(const std::string& search_string ) // save current folder open state if no filter currently applied if (!mActivePanel->getFilter().isNotDefault()) { - mSavedFolderState->setApply(FALSE); + mSavedFolderState->setApply(false); mActivePanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState); } @@ -828,7 +829,7 @@ void LLPanelMainInventory::onFilterEdit(const std::string& search_string ) //static - BOOL LLPanelMainInventory::incrementalFind(LLFolderViewItem* first_item, const char *find_text, BOOL backward) + bool LLPanelMainInventory::incrementalFind(LLFolderViewItem* first_item, const char *find_text, bool backward) { LLPanelMainInventory* active_view = NULL; @@ -848,23 +849,23 @@ void LLPanelMainInventory::onFilterEdit(const std::string& search_string ) if (!active_view) { - return FALSE; + return false; } std::string search_string(find_text); if (search_string.empty()) { - return FALSE; + return false; } if (active_view->getPanel() && active_view->getPanel()->getRootFolder()->search(first_item, search_string, backward)) { - return TRUE; + return true; } - return FALSE; + return false; } void LLPanelMainInventory::onFilterSelected() @@ -911,7 +912,7 @@ void LLPanelMainInventory::setFilterSubString(const std::string& string) mActivePanel->setFilterSubString(string); } -BOOL LLPanelMainInventory::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +bool LLPanelMainInventory::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -919,7 +920,7 @@ BOOL LLPanelMainInventory::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, { // Check to see if we are auto scrolling from the last frame LLInventoryPanel* panel = (LLInventoryPanel*)this->getActivePanel(); - BOOL needsToScroll = panel->getScrollableContainer()->canAutoScroll(x, y); + bool needsToScroll = panel->getScrollableContainer()->canAutoScroll(x, y); if(mFilterTabs) { if(needsToScroll) @@ -928,7 +929,7 @@ BOOL LLPanelMainInventory::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, } } - BOOL handled = LLPanel::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); + bool handled = LLPanel::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); return handled; } @@ -1080,7 +1081,7 @@ void LLPanelMainInventory::setSelectCallback(const LLFolderView::signal_t::slot_ getChild<LLInventoryPanel>(RECENT_ITEMS)->setSelectCallback(cb); } -void LLPanelMainInventory::onSelectionChange(LLInventoryPanel *panel, const std::deque<LLFolderViewItem*>& items, BOOL user_action) +void LLPanelMainInventory::onSelectionChange(LLInventoryPanel *panel, const std::deque<LLFolderViewItem*>& items, bool user_action) { updateListCommands(); panel->onSelectionChange(items, user_action); @@ -1105,7 +1106,7 @@ LLFloaterInventoryFinder::LLFloaterInventoryFinder(LLPanelMainInventory* invento updateElementsFromFilter(); } -BOOL LLFloaterInventoryFinder::postBuild() +bool LLFloaterInventoryFinder::postBuild() { const LLRect& viewrect = mPanelMainInventory->getRect(); setRect(LLRect(viewrect.mLeft - getRect().getWidth(), viewrect.mTop, viewrect.mLeft, viewrect.mTop - getRect().getHeight())); @@ -1127,7 +1128,7 @@ BOOL LLFloaterInventoryFinder::postBuild() childSetAction("Close", onCloseBtn, this); updateElementsFromFilter(); - return TRUE; + return true; } void LLFloaterInventoryFinder::onTimeAgo(LLUICtrl *ctrl, void *user_data) { @@ -1216,31 +1217,31 @@ void LLFloaterInventoryFinder::updateElementsFromFilter() void LLFloaterInventoryFinder::draw() { U64 filter = 0xffffffffffffffffULL; - BOOL filtered_by_all_types = TRUE; + bool filtered_by_all_types = true; if (!getChild<LLUICtrl>("check_animation")->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_ANIMATION); - filtered_by_all_types = FALSE; + filtered_by_all_types = false; } if (!getChild<LLUICtrl>("check_calling_card")->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_CALLINGCARD); - filtered_by_all_types = FALSE; + filtered_by_all_types = false; } if (!getChild<LLUICtrl>("check_clothing")->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_WEARABLE); - filtered_by_all_types = FALSE; + filtered_by_all_types = false; } if (!getChild<LLUICtrl>("check_gesture")->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_GESTURE); - filtered_by_all_types = FALSE; + filtered_by_all_types = false; } if (!getChild<LLUICtrl>("check_landmark")->getValue()) @@ -1248,56 +1249,56 @@ void LLFloaterInventoryFinder::draw() { filter &= ~(0x1 << LLInventoryType::IT_LANDMARK); - filtered_by_all_types = FALSE; + filtered_by_all_types = false; } if (!getChild<LLUICtrl>("check_material")->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_MATERIAL); - filtered_by_all_types = FALSE; + filtered_by_all_types = false; } if (!getChild<LLUICtrl>("check_notecard")->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_NOTECARD); - filtered_by_all_types = FALSE; + filtered_by_all_types = false; } if (!getChild<LLUICtrl>("check_object")->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_OBJECT); filter &= ~(0x1 << LLInventoryType::IT_ATTACHMENT); - filtered_by_all_types = FALSE; + filtered_by_all_types = false; } if (!getChild<LLUICtrl>("check_script")->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_LSL); - filtered_by_all_types = FALSE; + filtered_by_all_types = false; } if (!getChild<LLUICtrl>("check_sound")->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_SOUND); - filtered_by_all_types = FALSE; + filtered_by_all_types = false; } if (!getChild<LLUICtrl>("check_texture")->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_TEXTURE); - filtered_by_all_types = FALSE; + filtered_by_all_types = false; } if (!getChild<LLUICtrl>("check_snapshot")->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_SNAPSHOT); - filtered_by_all_types = FALSE; + filtered_by_all_types = false; } if (!getChild<LLUICtrl>("check_settings")->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_SETTINGS); - filtered_by_all_types = FALSE; + filtered_by_all_types = false; } if (!filtered_by_all_types || (mPanelMainInventory->getPanel()->getFilter().getFilterTypes() & LLInventoryFilter::FILTERTYPE_DATE)) @@ -1388,7 +1389,7 @@ void LLFloaterInventoryFinder::onCreatorSelfFilterCommit() else if(!show_creator_self || !show_creator_other) { mPanelMainInventory->getCurrentFilter().setFilterCreator(LLInventoryFilter::FILTERCREATOR_OTHERS); - mCreatorOthers->set(TRUE); + mCreatorOthers->set(true); } } @@ -1408,16 +1409,16 @@ void LLFloaterInventoryFinder::onCreatorOtherFilterCommit() else if(!show_creator_other || !show_creator_self) { mPanelMainInventory->getCurrentFilter().setFilterCreator(LLInventoryFilter::FILTERCREATOR_SELF); - mCreatorSelf->set(TRUE); + mCreatorSelf->set(true); } } -BOOL LLFloaterInventoryFinder::getCheckShowEmpty() +bool LLFloaterInventoryFinder::getCheckShowEmpty() { return getChild<LLUICtrl>("check_show_empty")->getValue(); } -BOOL LLFloaterInventoryFinder::getCheckSinceLogoff() +bool LLFloaterInventoryFinder::getCheckSinceLogoff() { return getChild<LLUICtrl>("check_since_logoff")->getValue(); } @@ -1439,19 +1440,19 @@ void LLFloaterInventoryFinder::selectAllTypes(void* user_data) LLFloaterInventoryFinder* self = (LLFloaterInventoryFinder*)user_data; if(!self) return; - self->getChild<LLUICtrl>("check_animation")->setValue(TRUE); - self->getChild<LLUICtrl>("check_calling_card")->setValue(TRUE); - self->getChild<LLUICtrl>("check_clothing")->setValue(TRUE); - self->getChild<LLUICtrl>("check_gesture")->setValue(TRUE); - self->getChild<LLUICtrl>("check_landmark")->setValue(TRUE); - self->getChild<LLUICtrl>("check_material")->setValue(TRUE); - self->getChild<LLUICtrl>("check_notecard")->setValue(TRUE); - self->getChild<LLUICtrl>("check_object")->setValue(TRUE); - self->getChild<LLUICtrl>("check_script")->setValue(TRUE); - self->getChild<LLUICtrl>("check_sound")->setValue(TRUE); - self->getChild<LLUICtrl>("check_texture")->setValue(TRUE); - self->getChild<LLUICtrl>("check_snapshot")->setValue(TRUE); - self->getChild<LLUICtrl>("check_settings")->setValue(TRUE); + self->getChild<LLUICtrl>("check_animation")->setValue(true); + self->getChild<LLUICtrl>("check_calling_card")->setValue(true); + self->getChild<LLUICtrl>("check_clothing")->setValue(true); + self->getChild<LLUICtrl>("check_gesture")->setValue(true); + self->getChild<LLUICtrl>("check_landmark")->setValue(true); + self->getChild<LLUICtrl>("check_material")->setValue(true); + self->getChild<LLUICtrl>("check_notecard")->setValue(true); + self->getChild<LLUICtrl>("check_object")->setValue(true); + self->getChild<LLUICtrl>("check_script")->setValue(true); + self->getChild<LLUICtrl>("check_sound")->setValue(true); + self->getChild<LLUICtrl>("check_texture")->setValue(true); + self->getChild<LLUICtrl>("check_snapshot")->setValue(true); + self->getChild<LLUICtrl>("check_settings")->setValue(true); } //static @@ -1460,19 +1461,19 @@ void LLFloaterInventoryFinder::selectNoTypes(void* user_data) LLFloaterInventoryFinder* self = (LLFloaterInventoryFinder*)user_data; if(!self) return; - self->getChild<LLUICtrl>("check_animation")->setValue(FALSE); - self->getChild<LLUICtrl>("check_calling_card")->setValue(FALSE); - self->getChild<LLUICtrl>("check_clothing")->setValue(FALSE); - self->getChild<LLUICtrl>("check_gesture")->setValue(FALSE); - self->getChild<LLUICtrl>("check_landmark")->setValue(FALSE); - self->getChild<LLUICtrl>("check_material")->setValue(FALSE); - self->getChild<LLUICtrl>("check_notecard")->setValue(FALSE); - self->getChild<LLUICtrl>("check_object")->setValue(FALSE); - self->getChild<LLUICtrl>("check_script")->setValue(FALSE); - self->getChild<LLUICtrl>("check_sound")->setValue(FALSE); - self->getChild<LLUICtrl>("check_texture")->setValue(FALSE); - self->getChild<LLUICtrl>("check_snapshot")->setValue(FALSE); - self->getChild<LLUICtrl>("check_settings")->setValue(FALSE); + self->getChild<LLUICtrl>("check_animation")->setValue(false); + self->getChild<LLUICtrl>("check_calling_card")->setValue(false); + self->getChild<LLUICtrl>("check_clothing")->setValue(false); + self->getChild<LLUICtrl>("check_gesture")->setValue(false); + self->getChild<LLUICtrl>("check_landmark")->setValue(false); + self->getChild<LLUICtrl>("check_material")->setValue(false); + self->getChild<LLUICtrl>("check_notecard")->setValue(false); + self->getChild<LLUICtrl>("check_object")->setValue(false); + self->getChild<LLUICtrl>("check_script")->setValue(false); + self->getChild<LLUICtrl>("check_sound")->setValue(false); + self->getChild<LLUICtrl>("check_texture")->setValue(false); + self->getChild<LLUICtrl>("check_snapshot")->setValue(false); + self->getChild<LLUICtrl>("check_settings")->setValue(false); } ////////////////////////////////////////////////////////////////////////////////// @@ -1999,14 +2000,14 @@ void LLPanelMainInventory::onCustomAction(const LLSD& userdata) } } -void LLPanelMainInventory::onVisibilityChange( BOOL new_visibility ) +void LLPanelMainInventory::onVisibilityChange( bool new_visibility ) { if(!new_visibility) { LLMenuGL* menu = (LLMenuGL*)mMenuAddHandle.get(); if (menu) { - menu->setVisible(FALSE); + menu->setVisible(false); } getActivePanel()->getRootFolder()->finishRenamingItem(); } @@ -2037,12 +2038,12 @@ bool LLPanelMainInventory::isSaveTextureEnabled(const LLSD& userdata) return false; } -BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata) +bool LLPanelMainInventory::isActionEnabled(const LLSD& userdata) { const std::string command_name = userdata.asString(); if (command_name == "not_empty") { - BOOL status = FALSE; + bool status = false; LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem(); if (current_item) { @@ -2071,15 +2072,15 @@ BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata) } else{ LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem(); - if (!current_item) return FALSE; + if (!current_item) return false; item_id = static_cast<LLFolderViewModelItemInventory*>(current_item->getViewModelItem())->getUUID(); } const LLViewerInventoryItem *item = gInventory.getItem(item_id); if (item && item->getIsLinkType() && !item->getIsBrokenLink()) { - return TRUE; + return true; } - return FALSE; + return false; } if (command_name == "find_links") @@ -2092,30 +2093,30 @@ BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata) else{ LLFolderView* root = getActivePanel()->getRootFolder(); std::set<LLFolderViewItem*> selection_set = root->getSelectionList(); - if (selection_set.size() != 1) return FALSE; + if (selection_set.size() != 1) return false; LLFolderViewItem* current_item = root->getCurSelectedItem(); - if (!current_item) return FALSE; + if (!current_item) return false; item_id = static_cast<LLFolderViewModelItemInventory*>(current_item->getViewModelItem())->getUUID(); } const LLInventoryObject *obj = gInventory.getObject(item_id); if (obj && !obj->getIsLinkType() && LLAssetType::lookupCanLink(obj->getType())) { - return TRUE; + return true; } - return FALSE; + return false; } // This doesn't currently work, since the viewer can't change an assetID an item. if (command_name == "regenerate_link") { LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem(); - if (!current_item) return FALSE; + if (!current_item) return false; const LLUUID& item_id = static_cast<LLFolderViewModelItemInventory*>(current_item->getViewModelItem())->getUUID(); const LLViewerInventoryItem *item = gInventory.getItem(item_id); if (item && item->getIsBrokenLink()) { - return TRUE; + return true; } - return FALSE; + return false; } if (command_name == "share") @@ -2126,9 +2127,9 @@ BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata) } else{ LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem(); - if (!current_item) return FALSE; + if (!current_item) return false; LLSidepanelInventory* parent = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory"); - return parent ? parent->canShare() : FALSE; + return parent ? parent->canShare() : false; } } if (command_name == "empty_trash") @@ -2144,7 +2145,7 @@ BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata) return children != LLInventoryModel::CHILDREN_NO && gInventory.isCategoryComplete(trash_id); } - return TRUE; + return true; } bool LLPanelMainInventory::isActionVisible(const LLSD& userdata) @@ -2162,7 +2163,7 @@ bool LLPanelMainInventory::isActionVisible(const LLSD& userdata) return true; } -BOOL LLPanelMainInventory::isActionChecked(const LLSD& userdata) +bool LLPanelMainInventory::isActionChecked(const LLSD& userdata) { U32 sort_order_mask = (mSingleFolderMode && isGalleryViewMode()) ? mCombinationGalleryPanel->getSortOrder() : getActivePanel()->getSortOrder(); const std::string command_name = userdata.asString(); @@ -2219,7 +2220,7 @@ BOOL LLPanelMainInventory::isActionChecked(const LLSD& userdata) return isCombinationViewMode(); } - return FALSE; + return false; } void LLPanelMainInventory::setUploadCostIfNeeded() @@ -2338,7 +2339,7 @@ void LLPanelMainInventory::onCombinationGallerySelectionChanged(const LLUUID& ca { } -void LLPanelMainInventory::onCombinationInventorySelectionChanged(const std::deque<LLFolderViewItem*>& items, BOOL user_action) +void LLPanelMainInventory::onCombinationInventorySelectionChanged(const std::deque<LLFolderViewItem*>& items, bool user_action) { onSelectionChange(mCombinationInventoryPanel, items, user_action); } @@ -2470,9 +2471,9 @@ void LLPanelMainInventory::updateCombinationVisibility() && mCombInvUUIDNeedsRename.notNull() && mCombinationInventoryPanel->areViewsInitialized()) { - mCombinationInventoryPanel->setSelectionByID(mCombInvUUIDNeedsRename, TRUE); + mCombinationInventoryPanel->setSelectionByID(mCombInvUUIDNeedsRename, true); mCombinationInventoryPanel->getRootFolder()->scrollToShowSelection(); - mCombinationInventoryPanel->getRootFolder()->setNeedsAutoRename(TRUE); + mCombinationInventoryPanel->getRootFolder()->setNeedsAutoRename(true); mCombInvUUIDNeedsRename.setNull(); } } diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h index 33205fc062..cad2501645 100644 --- a/indra/newview/llpanelmaininventory.h +++ b/indra/newview/llpanelmaininventory.h @@ -65,7 +65,7 @@ public: LLPanelMainInventory(const LLPanel::Params& p = getDefaultParams()); ~LLPanelMainInventory(); - BOOL postBuild(); + bool postBuild(); enum EViewModeType { @@ -74,17 +74,17 @@ public: MODE_COMBINATION }; - virtual BOOL handleKeyHere(KEY key, MASK mask); + virtual bool handleKeyHere(KEY key, MASK mask); // Inherited functionality - /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + /*virtual*/ bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg); /*virtual*/ void changed(U32); /*virtual*/ void draw(); - /*virtual*/ void onVisibilityChange ( BOOL new_visibility ); + /*virtual*/ void onVisibilityChange ( bool new_visibility ); LLInventoryPanel* getPanel() { return mActivePanel; } LLInventoryPanel* getActivePanel() { return mActivePanel; } @@ -144,14 +144,14 @@ protected: void setFilterTextFromFilter(); void startSearch(); - void onSelectionChange(LLInventoryPanel *panel, const std::deque<LLFolderViewItem*>& items, BOOL user_action); + void onSelectionChange(LLInventoryPanel *panel, const std::deque<LLFolderViewItem*>& items, bool user_action); - static BOOL filtersVisible(void* user_data); + static bool filtersVisible(void* user_data); void onClearSearch(); static void onFoldersByName(void *user_data); - static BOOL checkFoldersByName(void *user_data); + static bool checkFoldersByName(void *user_data); - static BOOL incrementalFind(LLFolderViewItem* first_item, const char *find_text, BOOL backward); + static bool incrementalFind(LLFolderViewItem* first_item, const char *find_text, bool backward); void onFilterSelected(); const std::string getFilterSubString(); @@ -224,8 +224,8 @@ protected: void onAddButtonClick(); void showActionMenu(LLMenuGL* menu, std::string spawning_view_name); void onClipboardAction(const LLSD& userdata); - BOOL isActionEnabled(const LLSD& command_name); - BOOL isActionChecked(const LLSD& userdata); + bool isActionEnabled(const LLSD& command_name); + bool isActionChecked(const LLSD& userdata); void onCustomAction(const LLSD& command_name); bool isActionVisible(const LLSD& userdata); static bool hasSettingsInventory(); @@ -235,7 +235,7 @@ protected: void onCombinationRootChanged(bool gallery_clicked); void onCombinationGallerySelectionChanged(const LLUUID& category_id); - void onCombinationInventorySelectionChanged(const std::deque<LLFolderViewItem*>& items, BOOL user_action); + void onCombinationInventorySelectionChanged(const std::deque<LLFolderViewItem*>& items, bool user_action); /** * Set upload cost in "Upload" sub menu. */ diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp index 331bc96275..0925351350 100644 --- a/indra/newview/llpanelmarketplaceinbox.cpp +++ b/indra/newview/llpanelmarketplaceinbox.cpp @@ -54,7 +54,7 @@ LLPanelMarketplaceInbox::LLPanelMarketplaceInbox(const Params& p) , mSavedFolderState(NULL) { mSavedFolderState = new LLSaveFolderState(); - mSavedFolderState->setApply(FALSE); + mSavedFolderState->setApply(false); } LLPanelMarketplaceInbox::~LLPanelMarketplaceInbox() @@ -63,14 +63,14 @@ LLPanelMarketplaceInbox::~LLPanelMarketplaceInbox() } // virtual -BOOL LLPanelMarketplaceInbox::postBuild() +bool LLPanelMarketplaceInbox::postBuild() { LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLPanelMarketplaceInbox::onFocusReceived, this)); mFreshCountCtrl = getChild<LLUICtrl>("inbox_fresh_new_count"); mInboxButton = getChild<LLButton>("inbox_btn"); - return TRUE; + return true; } void LLPanelMarketplaceInbox::onSelectionChange() @@ -106,7 +106,7 @@ LLInventoryPanel * LLPanelMarketplaceInbox::setupInventoryPanel() mInventoryPanel->getFilter().setEmptyLookupMessage("InventoryInboxNoItems"); // Hide the placeholder text - inbox_inventory_placeholder->setVisible(FALSE); + inbox_inventory_placeholder->setVisible(false); return mInventoryPanel; } @@ -122,10 +122,10 @@ void LLPanelMarketplaceInbox::onFocusReceived() gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected()); } -BOOL LLPanelMarketplaceInbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg) +bool LLPanelMarketplaceInbox::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg) { *accept = ACCEPT_NO; - return TRUE; + return true; } U32 LLPanelMarketplaceInbox::getFreshItemCount() const @@ -179,7 +179,7 @@ U32 LLPanelMarketplaceInbox::getFreshItemCount() const U32 LLPanelMarketplaceInbox::getTotalItemCount() const { - U32 item_count = 0; + size_t item_count = 0; if (mInventoryPanel) { @@ -192,7 +192,7 @@ U32 LLPanelMarketplaceInbox::getTotalItemCount() const } } - return item_count; + return static_cast<U32>(item_count); } void LLPanelMarketplaceInbox::onClearSearch() @@ -200,7 +200,7 @@ void LLPanelMarketplaceInbox::onClearSearch() if (mInventoryPanel) { mInventoryPanel->setFilterSubString(LLStringUtil::null); - mSavedFolderState->setApply(TRUE); + mSavedFolderState->setApply(true); mInventoryPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState); LLOpenFoldersWithSelection opener; mInventoryPanel->getRootFolder()->applyFunctorRecursively(opener); @@ -220,7 +220,7 @@ void LLPanelMarketplaceInbox::onFilterEdit(const std::string& search_string) if (!mInventoryPanel->getFilter().isNotDefault()) { - mSavedFolderState->setApply(FALSE); + mSavedFolderState->setApply(false); mInventoryPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState); } mInventoryPanel->setFilterSubString(search_string); @@ -274,7 +274,7 @@ void LLPanelMarketplaceInbox::draw() { mInboxButton->setLabel(getString("InboxLabelNoArg")); - mFreshCountCtrl->setVisible(FALSE); + mFreshCountCtrl->setVisible(false); } LLPanel::draw(); diff --git a/indra/newview/llpanelmarketplaceinbox.h b/indra/newview/llpanelmarketplaceinbox.h index 1393bc1efe..e711bb5e5c 100644 --- a/indra/newview/llpanelmarketplaceinbox.h +++ b/indra/newview/llpanelmarketplaceinbox.h @@ -48,11 +48,11 @@ public: LLPanelMarketplaceInbox(const Params& p = getDefaultParams()); ~LLPanelMarketplaceInbox(); - /*virtual*/ BOOL postBuild(); + bool postBuild() override; - /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg); + bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg) override; - /*virtual*/ void draw(); + void draw() override; LLInventoryPanel * setupInventoryPanel(); @@ -68,7 +68,7 @@ private: void onSelectionChange(); - void onFocusReceived(); + void onFocusReceived() override; private: LLUICtrl * mFreshCountCtrl; diff --git a/indra/newview/llpanelmarketplaceinboxinventory.cpp b/indra/newview/llpanelmarketplaceinboxinventory.cpp index 6fd2b7e964..526462b940 100644 --- a/indra/newview/llpanelmarketplaceinboxinventory.cpp +++ b/indra/newview/llpanelmarketplaceinboxinventory.cpp @@ -176,13 +176,13 @@ void LLInboxFolderViewFolder::draw() } -BOOL LLInboxFolderViewFolder::handleMouseDown( S32 x, S32 y, MASK mask ) +bool LLInboxFolderViewFolder::handleMouseDown( S32 x, S32 y, MASK mask ) { deFreshify(); return LLFolderViewFolder::handleMouseDown(x, y, mask); } -BOOL LLInboxFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask ) +bool LLInboxFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask ) { deFreshify(); return LLFolderViewFolder::handleDoubleClick(x, y, mask); @@ -252,7 +252,7 @@ void LLInboxFolderViewItem::addToFolder(LLFolderViewFolder* folder) } } -BOOL LLInboxFolderViewItem::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLInboxFolderViewItem::handleDoubleClick(S32 x, S32 y, MASK mask) { deFreshify(); diff --git a/indra/newview/llpanelmarketplaceinboxinventory.h b/indra/newview/llpanelmarketplaceinboxinventory.h index eb5d809db1..0516846138 100644 --- a/indra/newview/llpanelmarketplaceinboxinventory.h +++ b/indra/newview/llpanelmarketplaceinboxinventory.h @@ -71,8 +71,8 @@ public: void addItem(LLFolderViewItem* item); void draw(); - BOOL handleMouseDown(S32 x, S32 y, MASK mask); - BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + bool handleMouseDown(S32 x, S32 y, MASK mask); + bool handleDoubleClick(S32 x, S32 y, MASK mask); void selectItem(); void computeFreshness(); @@ -101,7 +101,7 @@ public: LLInboxFolderViewItem(const Params& p); void addToFolder(LLFolderViewFolder* folder); - BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + bool handleDoubleClick(S32 x, S32 y, MASK mask); void draw(); diff --git a/indra/newview/llpanelmediasettingsgeneral.cpp b/indra/newview/llpanelmediasettingsgeneral.cpp index 43012d85f4..380c2827ac 100644 --- a/indra/newview/llpanelmediasettingsgeneral.cpp +++ b/indra/newview/llpanelmediasettingsgeneral.cpp @@ -80,7 +80,7 @@ LLPanelMediaSettingsGeneral::LLPanelMediaSettingsGeneral() : //////////////////////////////////////////////////////////////////////////////// // -BOOL LLPanelMediaSettingsGeneral::postBuild() +bool LLPanelMediaSettingsGeneral::postBuild() { // connect member vars with UI widgets mAutoLoop = getChild< LLCheckBoxCtrl >( LLMediaEntry::AUTO_LOOP_KEY ); @@ -121,7 +121,7 @@ void LLPanelMediaSettingsGeneral::draw() checkHomeUrlPassesWhitelist(); // enable/disable pixel values image entry based on auto scale checkbox - if ( mAutoScale->getValue().asBoolean() == false ) + if (!mAutoScale->getValue().asBoolean()) { getChildView( LLMediaEntry::WIDTH_PIXELS_KEY )->setEnabled( true ); getChildView( LLMediaEntry::HEIGHT_PIXELS_KEY )->setEnabled( true ); @@ -134,10 +134,9 @@ void LLPanelMediaSettingsGeneral::draw() // enable/disable UI based on type of media bool reset_button_is_active = true; - if( mPreviewMedia ) + if (mPreviewMedia) { - LLPluginClassMedia* media_plugin = mPreviewMedia->getMediaPlugin(); - if( media_plugin ) + if (LLPluginClassMedia* media_plugin = mPreviewMedia->getMediaPlugin()) { // turn off volume (if we can) for preview. Note: this really only // works for QuickTime movies right now - no way to control the @@ -147,8 +146,7 @@ void LLPanelMediaSettingsGeneral::draw() // some controls are only appropriate for time or browser type plugins // so we selectively enable/disable them - need to do it in draw // because the information from plugins arrives assynchronously - bool show_time_controls = media_plugin->pluginSupportsMediaTime(); - if ( show_time_controls ) + if (media_plugin->pluginSupportsMediaTime()) { getChildView( LLMediaEntry::CURRENT_URL_KEY )->setEnabled( false ); reset_button_is_active = false; diff --git a/indra/newview/llpanelmediasettingsgeneral.h b/indra/newview/llpanelmediasettingsgeneral.h index 10ce565800..9fe97b9121 100644 --- a/indra/newview/llpanelmediasettingsgeneral.h +++ b/indra/newview/llpanelmediasettingsgeneral.h @@ -53,7 +53,7 @@ public: // Hook that the floater calls after applying changes to the panel void postApply(); - BOOL postBuild(); + bool postBuild(); /*virtual*/ void draw(); /*virtual*/ void onClose(bool app_quitting); diff --git a/indra/newview/llpanelmediasettingspermissions.cpp b/indra/newview/llpanelmediasettingspermissions.cpp index 437bd2816e..868d492083 100644 --- a/indra/newview/llpanelmediasettingspermissions.cpp +++ b/indra/newview/llpanelmediasettingspermissions.cpp @@ -64,7 +64,7 @@ LLPanelMediaSettingsPermissions::LLPanelMediaSettingsPermissions() : //////////////////////////////////////////////////////////////////////////////// // -BOOL LLPanelMediaSettingsPermissions::postBuild() +bool LLPanelMediaSettingsPermissions::postBuild() { // connect member vars with UI widgets mControls = getChild< LLComboBox >( LLMediaEntry::CONTROLS_KEY ); @@ -95,7 +95,7 @@ void LLPanelMediaSettingsPermissions::draw() getChild<LLUICtrl>("perms_group_name")->setValue(LLStringUtil::null); LLUUID group_id; - BOOL groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id); + bool groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id); if (groups_identical) { if(mPermsGroupName) @@ -107,7 +107,7 @@ void LLPanelMediaSettingsPermissions::draw() { if(mPermsGroupName) { - mPermsGroupName->setNameID(LLUUID::null, TRUE); + mPermsGroupName->setNameID(LLUUID::null, true); mPermsGroupName->refresh(LLUUID::null, std::string(), true); } } diff --git a/indra/newview/llpanelmediasettingspermissions.h b/indra/newview/llpanelmediasettingspermissions.h index 707c5af61d..3d920b2c39 100644 --- a/indra/newview/llpanelmediasettingspermissions.h +++ b/indra/newview/llpanelmediasettingspermissions.h @@ -44,7 +44,7 @@ public: LLPanelMediaSettingsPermissions(); ~LLPanelMediaSettingsPermissions(); - BOOL postBuild(); + bool postBuild(); virtual void draw(); // XXX TODO: put these into a common parent class? diff --git a/indra/newview/llpanelmediasettingssecurity.cpp b/indra/newview/llpanelmediasettingssecurity.cpp index 96ec1b17eb..6e4e9f426d 100644 --- a/indra/newview/llpanelmediasettingssecurity.cpp +++ b/indra/newview/llpanelmediasettingssecurity.cpp @@ -58,7 +58,7 @@ LLPanelMediaSettingsSecurity::LLPanelMediaSettingsSecurity() : //////////////////////////////////////////////////////////////////////////////// // -BOOL LLPanelMediaSettingsSecurity::postBuild() +bool LLPanelMediaSettingsSecurity::postBuild() { mEnableWhiteList = getChild< LLCheckBoxCtrl >( LLMediaEntry::WHITELIST_ENABLE_KEY ); mWhiteListList = getChild< LLScrollListCtrl >( LLMediaEntry::WHITELIST_KEY ); diff --git a/indra/newview/llpanelmediasettingssecurity.h b/indra/newview/llpanelmediasettingssecurity.h index ecb4218e01..23c68a8050 100644 --- a/indra/newview/llpanelmediasettingssecurity.h +++ b/indra/newview/llpanelmediasettingssecurity.h @@ -40,7 +40,7 @@ public: LLPanelMediaSettingsSecurity(); ~LLPanelMediaSettingsSecurity(); - BOOL postBuild(); + bool postBuild(); virtual void draw(); // XXX TODO: put these into a common parent class? diff --git a/indra/newview/llpanelnearbymedia.cpp b/indra/newview/llpanelnearbymedia.cpp index a46894988c..2dd4866da3 100644 --- a/indra/newview/llpanelnearbymedia.cpp +++ b/indra/newview/llpanelnearbymedia.cpp @@ -29,7 +29,9 @@ #include "llpanelnearbymedia.h" #include "llaudioengine.h" +#include "llbase64.h" #include "llcheckboxctrl.h" +#include "llclipboard.h" #include "llcombobox.h" #include "llresizebar.h" #include "llresizehandle.h" @@ -53,7 +55,9 @@ #include "llvovolume.h" #include "llstatusbar.h" #include "llsdutil.h" +#include "lltoggleablemenu.h" #include "llvieweraudio.h" +#include "llviewermenu.h" #include "llfloaterreg.h" #include "llfloaterpreference.h" // for the gear icon @@ -74,10 +78,10 @@ static const LLUUID PARCEL_AUDIO_LIST_ITEM_UUID = LLUUID("DF4B020D-8A24-4B95-AB5 LLPanelNearByMedia::LLPanelNearByMedia() : mMediaList(NULL), mEnableAllCtrl(NULL), - mAllMediaDisabled(false), mDebugInfoVisible(false), mParcelMediaItem(NULL), - mParcelAudioItem(NULL) + mParcelAudioItem(NULL), + mMoreLessBtn(NULL) { // This is just an initial value, mParcelAudioAutoStart does not affect ParcelMediaAutoPlayEnable mParcelAudioAutoStart = gSavedSettings.getS32("ParcelMediaAutoPlayEnable") != 0 @@ -97,6 +101,18 @@ LLPanelNearByMedia::LLPanelNearByMedia() mCommitCallbackRegistrar.add("SelectedMediaCtrl.Zoom", boost::bind(&LLPanelNearByMedia::onClickSelectedMediaZoom, this)); mCommitCallbackRegistrar.add("SelectedMediaCtrl.Unzoom", boost::bind(&LLPanelNearByMedia::onClickSelectedMediaUnzoom, this)); + // Context menu handler. + mCommitCallbackRegistrar.add("SelectedMediaCtrl.Action", + [this](LLUICtrl* ctrl, const LLSD& data) + { + onMenuAction(data); + }); + mEnableCallbackRegistrar.add("SelectedMediaCtrl.Visible", + [this](LLUICtrl* ctrl, const LLSD& data) + { + return onMenuVisible(data); + }); + buildFromFile( "panel_nearby_media.xml"); } @@ -104,7 +120,7 @@ LLPanelNearByMedia::~LLPanelNearByMedia() { } -BOOL LLPanelNearByMedia::postBuild() +bool LLPanelNearByMedia::postBuild() { LLPanelPulldown::postBuild(); @@ -147,6 +163,7 @@ BOOL LLPanelNearByMedia::postBuild() mUnzoomCtrl = getChild<LLUICtrl>("unzoom"); mVolumeSlider = getChild<LLSlider>("volume_slider"); mMuteBtn = getChild<LLButton>("mute_btn"); + mMoreLessBtn = getChild<LLButton>("more_btn"); mEmptyNameString = getString("empty_item_text"); mParcelMediaName = getString("parcel_media_name"); @@ -154,8 +171,8 @@ BOOL LLPanelNearByMedia::postBuild() mPlayingString = getString("playing_suffix"); mMediaList->setDoubleClickCallback(onZoomMedia, this); - mMediaList->sortByColumnIndex(PROXIMITY_COLUMN, TRUE); - mMediaList->sortByColumnIndex(VISIBILITY_COLUMN, FALSE); + mMediaList->sortByColumnIndex(PROXIMITY_COLUMN, true); + mMediaList->sortByColumnIndex(VISIBILITY_COLUMN, false); refreshList(); updateControls(); @@ -166,10 +183,15 @@ BOOL LLPanelNearByMedia::postBuild() mLessRect = getRect(); mLessRect.mBottom = minimized_controls->getRect().mBottom; - getChild<LLUICtrl>("more_btn")->setVisible(false); + mMoreLessBtn->setVisible(false); onMoreLess(); - return TRUE; + mContextMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>( + "menu_nearby_media.xml", + gMenuHolder, + LLViewerMenuHolderGL::child_registry_t::instance()); + + return true; } void LLPanelNearByMedia::handleMediaAutoPlayChanged(const LLSD& newvalue) @@ -189,12 +211,11 @@ void LLPanelNearByMedia::handleMediaAutoPlayChanged(const LLSD& newvalue) } /*virtual*/ -void LLPanelNearByMedia::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLPanelNearByMedia::reshape(S32 width, S32 height, bool called_from_parent) { LLPanelPulldown::reshape(width, height, called_from_parent); - LLButton* more_btn = findChild<LLButton>("more_btn"); - if (more_btn && more_btn->getValue().asBoolean()) + if (mMoreLessBtn && mMoreLessBtn->getValue().asBoolean()) { mMoreRect = getRect(); } @@ -220,7 +241,7 @@ void LLPanelNearByMedia::draw() } /*virtual*/ -BOOL LLPanelNearByMedia::handleHover(S32 x, S32 y, MASK mask) +bool LLPanelNearByMedia::handleHover(S32 x, S32 y, MASK mask) { LLPanelPulldown::handleHover(x, y, mask); @@ -234,6 +255,42 @@ BOOL LLPanelNearByMedia::handleHover(S32 x, S32 y, MASK mask) return true; } +bool LLPanelNearByMedia::handleRightMouseDown(S32 x, S32 y, MASK mask) +{ + S32 x_list, y_list; + localPointToOtherView(x, y, &x_list, &y_list, mMediaList); + if (mMoreLessBtn->getToggleState() + && mMediaList->pointInView(x_list, y_list)) + { + LLScrollListItem* hit_item = mMediaList->hitItem(x_list, y_list); + bool selected = hit_item && hit_item->getSelected(); + if (!selected) + { + selected = mMediaList->selectItemAt(x_list, y_list, mask); + } + + if (selected && mContextMenu) + { + mContextMenu->buildDrawLabels(); + mContextMenu->updateParent(LLMenuGL::sMenuContainer); + LLMenuGL::showPopup(this, mContextMenu, x, y); + return true; + } + } + + return LLPanelPulldown::handleRightMouseDown(x, y, mask); +} + + +void LLPanelNearByMedia::onVisibilityChange(bool new_visibility) +{ + if (!new_visibility && mContextMenu->getVisible()) + { + gMenuHolder->hideMenus(); + } + LLPanelPulldown::onVisibilityChange(new_visibility); +} + bool LLPanelNearByMedia::getParcelAudioAutoStart() { return mParcelAudioAutoStart; @@ -923,7 +980,7 @@ void LLPanelNearByMedia::onAdvancedButtonClick() void LLPanelNearByMedia::onMoreLess() { - bool is_more = getChild<LLButton>("more_btn")->getToggleState(); + bool is_more = mMoreLessBtn->getToggleState(); mNearbyMediaPanel->setVisible(is_more); // enable resizing when expanded @@ -934,7 +991,7 @@ void LLPanelNearByMedia::onMoreLess() setShape(new_rect); - getChild<LLUICtrl>("more_btn")->setVisible(true); + mMoreLessBtn->setVisible(true); } void LLPanelNearByMedia::updateControls() @@ -1174,6 +1231,53 @@ void LLPanelNearByMedia::onClickSelectedMediaUnzoom() LLViewerMediaFocus::getInstance()->unZoom(); } +void LLPanelNearByMedia::onMenuAction(const LLSD& userdata) +{ + const std::string command_name = userdata.asString(); + if ("copy_url" == command_name) + { + LLClipboard::instance().reset(); + std::string url = getSelectedUrl(); + + if (!url.empty()) + { + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(url), 0, static_cast<S32>(url.size())); + } + } + else if ("copy_data" == command_name) + { + LLClipboard::instance().reset(); + std::string url = getSelectedUrl(); + static const std::string encoding_specifier = "base64,"; + size_t pos = url.find(encoding_specifier); + if (pos != std::string::npos) + { + pos += encoding_specifier.size(); + std::string res = LLBase64::decodeAsString(url.substr(pos)); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(res), 0, static_cast<S32>(res.size())); + } + else + { + url = LLURI::unescape(url); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(url), 0, static_cast<S32>(url.size())); + } + } +} + +bool LLPanelNearByMedia::onMenuVisible(const LLSD& userdata) +{ + const std::string command_name = userdata.asString(); + if ("copy_data" == command_name) + { + std::string url = getSelectedUrl(); + if (url.rfind("data:", 0) == 0) + { + // might be a a good idea to permit text/html only + return true; + } + } + return false; +} // static void LLPanelNearByMedia::getNameAndUrlHelper(LLViewerMediaImpl* impl, std::string& name, std::string & url, const std::string &defaultName) @@ -1200,3 +1304,27 @@ void LLPanelNearByMedia::getNameAndUrlHelper(LLViewerMediaImpl* impl, std::strin } } +std::string LLPanelNearByMedia::getSelectedUrl() +{ + std::string url; + LLUUID selected_media_id = mMediaList->getValue().asUUID(); + if (selected_media_id == PARCEL_AUDIO_LIST_ITEM_UUID) + { + url = LLViewerMedia::getInstance()->getParcelAudioURL(); + } + else if (selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID) + { + url = LLViewerParcelMedia::getInstance()->getURL(); + } + else + { + LLViewerMediaImpl* impl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(selected_media_id); + if (NULL != impl) + { + std::string name; + getNameAndUrlHelper(impl, name, url, mEmptyNameString); + } + } + return url; +} + diff --git a/indra/newview/llpanelnearbymedia.h b/indra/newview/llpanelnearbymedia.h index 703447d85a..3154812745 100644 --- a/indra/newview/llpanelnearbymedia.h +++ b/indra/newview/llpanelnearbymedia.h @@ -36,6 +36,7 @@ class LLSlider; class LLSliderCtrl; class LLCheckBoxCtrl; class LLTextBox; +class LLToggleableMenu; class LLComboBox; class LLViewerMediaImpl; @@ -43,10 +44,12 @@ class LLPanelNearByMedia : public LLPanelPulldown { public: - /*virtual*/ BOOL postBuild(); - /*virtual*/ void draw(); - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent); - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); + bool postBuild() override; + void draw() override; + void reshape(S32 width, S32 height, bool called_from_parent) override; + bool handleHover(S32 x, S32 y, MASK mask) override; + bool handleRightMouseDown(S32 x, S32 y, MASK mask) override; + void onVisibilityChange(bool new_visibility) override; // this is part of the nearby media *dialog* so we can track whether // the user *implicitly* wants audio on or off via their *explicit* @@ -104,15 +107,12 @@ private: void onClickDisableAll(); void onClickEnableParcelMedia(); void onClickDisableParcelMedia(); - void onClickMuteParcelMedia(); - void onParcelMediaVolumeSlider(); void onClickParcelMediaPlay(); void onClickParcelMediaStop(); void onClickParcelMediaPause(); void onClickParcelAudioPlay(); void onClickParcelAudioStop(); void onClickParcelAudioPause(); - void onCheckAutoPlay(); void onAdvancedButtonClick(); void onMoreLess(); @@ -124,6 +124,7 @@ private: bool setDisabled(const LLUUID &id, bool disabled); static void getNameAndUrlHelper(LLViewerMediaImpl* impl, std::string& name, std::string & url, const std::string &defaultName); + std::string getSelectedUrl(); void updateColumns(); @@ -141,6 +142,8 @@ private: void onCommitSelectedMediaVolume(); void onClickSelectedMediaZoom(); void onClickSelectedMediaUnzoom(); + void onMenuAction(const LLSD& userdata); + bool onMenuVisible(const LLSD& userdata); LLUICtrl* mNearbyMediaPanel; LLScrollListCtrl* mMediaList; @@ -158,8 +161,8 @@ private: LLUICtrl* mUnzoomCtrl; LLSlider* mVolumeSlider; LLButton* mMuteBtn; + LLButton* mMoreLessBtn; - bool mAllMediaDisabled; bool mDebugInfoVisible; bool mParcelAudioAutoStart; std::string mEmptyNameString; @@ -171,6 +174,7 @@ private: LLRect mLessRect; LLScrollListItem* mParcelMediaItem; LLScrollListItem* mParcelAudioItem; + LLToggleableMenu* mContextMenu; }; diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 9267604098..0a3a2e753a 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -97,9 +97,9 @@ const F32 MAX_ATTACHMENT_DIST = 3.5f; // meters //static const std::string LEGACY_FULLBRIGHT_DESC =LLTrans::getString("Fullbright"); -BOOL LLPanelObject::postBuild() +bool LLPanelObject::postBuild() { - setMouseOpaque(FALSE); + setMouseOpaque(false); //-------------------------------------------------------- // Top @@ -255,17 +255,17 @@ BOOL LLPanelObject::postBuild() LLAggregatePermissions texture_perms; if (LLSelectMgr::getInstance()->selectGetAggregateTexturePermissions(texture_perms)) { - BOOL can_copy = + bool can_copy = texture_perms.getValue(PERM_COPY) == LLAggregatePermissions::AP_EMPTY || texture_perms.getValue(PERM_COPY) == LLAggregatePermissions::AP_ALL; - BOOL can_transfer = + bool can_transfer = texture_perms.getValue(PERM_TRANSFER) == LLAggregatePermissions::AP_EMPTY || texture_perms.getValue(PERM_TRANSFER) == LLAggregatePermissions::AP_ALL; mCtrlSculptTexture->setCanApplyImmediately(can_copy && can_transfer); } else { - mCtrlSculptTexture->setCanApplyImmediately(FALSE); + mCtrlSculptTexture->setCanApplyImmediately(false); } } @@ -280,21 +280,21 @@ BOOL LLPanelObject::postBuild() // Start with everyone disabled clearCtrls(); - return TRUE; + return true; } LLPanelObject::LLPanelObject() : LLPanel(), - mIsPhysical(FALSE), - mIsTemporary(FALSE), - mIsPhantom(FALSE), + mIsPhysical(false), + mIsTemporary(false), + mIsPhantom(false), mSelectedType(MI_BOX), mSculptTextureRevert(LLUUID::null), mSculptTypeRevert(0), mHasClipboardPos(false), mHasClipboardSize(false), mHasClipboardRot(false), - mSizeChanged(FALSE) + mSizeChanged(false) { mCommitCallbackRegistrar.add("PanelObject.menuDoToSelected", boost::bind(&LLPanelObject::menuDoToSelected, this, _2)); mEnableCallbackRegistrar.add("PanelObject.menuEnable", boost::bind(&LLPanelObject::menuEnableItem, this, _2)); @@ -352,7 +352,7 @@ void LLPanelObject::getState( ) } S32 selected_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); - BOOL single_volume = (LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME )) + bool single_volume = (LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME )) && (selected_count == 1); bool enable_move; @@ -360,8 +360,8 @@ void LLPanelObject::getState( ) LLSelectMgr::getInstance()->selectGetEditMoveLinksetPermissions(enable_move, enable_modify); - BOOL enable_scale = enable_modify; - BOOL enable_rotate = enable_move; // already accounts for a case of children, which needs permModify() as well + bool enable_scale = enable_modify; + bool enable_rotate = enable_move; // already accounts for a case of children, which needs permModify() as well LLVector3 vec; if (enable_move) @@ -454,20 +454,20 @@ void LLPanelObject::getState( ) // BUG? Check for all objects being editable? S32 roots_selected = LLSelectMgr::getInstance()->getSelection()->getRootObjectCount(); - BOOL editable = root_objectp->permModify(); + bool editable = root_objectp->permModify(); - BOOL is_flexible = volobjp && volobjp->isFlexible(); - BOOL is_permanent = root_objectp->flagObjectPermanent(); - BOOL is_permanent_enforced = root_objectp->isPermanentEnforced(); - BOOL is_character = root_objectp->flagCharacter(); + bool is_flexible = volobjp && volobjp->isFlexible(); + bool is_permanent = root_objectp->flagObjectPermanent(); + bool is_permanent_enforced = root_objectp->isPermanentEnforced(); + bool is_character = root_objectp->flagCharacter(); llassert(!is_permanent || !is_character); // should never have a permanent object that is also a character // Lock checkbox - only modifiable if you own the object. - BOOL self_owned = (gAgent.getID() == owner_id); + bool self_owned = (gAgent.getID() == owner_id); mCheckLock->setEnabled( roots_selected > 0 && self_owned && !is_permanent_enforced); // More lock and debit checkbox - get the values - BOOL valid; + bool valid; U32 owner_mask_on; U32 owner_mask_off; valid = LLSelectMgr::getInstance()->selectGetPerm(PERM_OWNER, &owner_mask_on, &owner_mask_off); @@ -477,20 +477,20 @@ void LLPanelObject::getState( ) if(owner_mask_on & PERM_MOVE) { // owner can move, so not locked - mCheckLock->set(FALSE); - mCheckLock->setTentative(FALSE); + mCheckLock->set(false); + mCheckLock->setTentative(false); } else if(owner_mask_off & PERM_MOVE) { // owner can't move, so locked - mCheckLock->set(TRUE); - mCheckLock->setTentative(FALSE); + mCheckLock->set(true); + mCheckLock->setTentative(false); } else { // some locked, some not locked - mCheckLock->set(FALSE); - mCheckLock->setTentative(TRUE); + mCheckLock->set(false); + mCheckLock->setTentative(true); } } @@ -510,7 +510,7 @@ void LLPanelObject::getState( ) mCheckTemporary->setEnabled( roots_selected>0 && editable && !is_permanent); mIsPhantom = root_objectp->flagPhantom(); - BOOL is_volume_detect = root_objectp->flagVolumeDetect(); + bool is_volume_detect = root_objectp->flagVolumeDetect(); llassert(!is_character || !mIsPhantom); // should never have a character that is also a phantom mCheckPhantom->set( mIsPhantom ); mCheckPhantom->setEnabled( roots_selected>0 && editable && !is_flexible && !is_permanent_enforced && !is_character && !is_volume_detect); @@ -519,10 +519,10 @@ void LLPanelObject::getState( ) S32 selected_item = MI_BOX; S32 selected_hole = MI_HOLE_SAME; - BOOL enabled = FALSE; - BOOL hole_enabled = FALSE; + bool enabled = false; + bool hole_enabled = false; F32 scale_x=1.f, scale_y=1.f; - BOOL isMesh = FALSE; + bool isMesh = false; if( !objectp || !objectp->getVolume() || !editable || !single_volume) { @@ -568,7 +568,7 @@ void LLPanelObject::getState( ) scale_x = volume_params.getRatioX(); scale_y = volume_params.getRatioY(); - BOOL linear_path = (path == LL_PCODE_PATH_LINE) || (path == LL_PCODE_PATH_FLEXIBLE); + bool linear_path = (path == LL_PCODE_PATH_LINE) || (path == LL_PCODE_PATH_FLEXIBLE); if ( linear_path && profile == LL_PCODE_PROFILE_CIRCLE ) { selected_item = MI_CYLINDER; @@ -672,7 +672,7 @@ void LLPanelObject::getState( ) else { mComboHoleType->setCurrentByIndex( MI_HOLE_SAME ); - hole_enabled = FALSE; + hole_enabled = false; } // Cut interpretation varies based on base object type @@ -802,38 +802,38 @@ void LLPanelObject::getState( ) // Compute control visibility, label names, and twist range. // Start with defaults. - BOOL cut_visible = TRUE; - BOOL hollow_visible = TRUE; - BOOL top_size_x_visible = TRUE; - BOOL top_size_y_visible = TRUE; - BOOL top_shear_x_visible = TRUE; - BOOL top_shear_y_visible = TRUE; - BOOL twist_visible = TRUE; - BOOL advanced_cut_visible = FALSE; - BOOL taper_visible = FALSE; - BOOL skew_visible = FALSE; - BOOL radius_offset_visible = FALSE; - BOOL revolutions_visible = FALSE; - BOOL sculpt_texture_visible = FALSE; + bool cut_visible = true; + bool hollow_visible = true; + bool top_size_x_visible = true; + bool top_size_y_visible = true; + bool top_shear_x_visible = true; + bool top_shear_y_visible = true; + bool twist_visible = true; + bool advanced_cut_visible = false; + bool taper_visible = false; + bool skew_visible = false; + bool radius_offset_visible = false; + bool revolutions_visible = false; + bool sculpt_texture_visible = false; F32 twist_min = OBJECT_TWIST_LINEAR_MIN; F32 twist_max = OBJECT_TWIST_LINEAR_MAX; F32 twist_inc = OBJECT_TWIST_LINEAR_INC; - BOOL advanced_is_dimple = FALSE; - BOOL advanced_is_slice = FALSE; - BOOL size_is_hole = FALSE; + bool advanced_is_dimple = false; + bool advanced_is_slice = false; + bool size_is_hole = false; // Tune based on overall volume type switch (selected_item) { case MI_SPHERE: - top_size_x_visible = FALSE; - top_size_y_visible = FALSE; - top_shear_x_visible = FALSE; - top_shear_y_visible = FALSE; - //twist_visible = FALSE; - advanced_cut_visible = TRUE; - advanced_is_dimple = TRUE; + top_size_x_visible = false; + top_size_y_visible = false; + top_shear_x_visible = false; + top_shear_y_visible = false; + //twist_visible = false; + advanced_cut_visible = true; + advanced_is_dimple = true; twist_min = OBJECT_TWIST_MIN; twist_max = OBJECT_TWIST_MAX; twist_inc = OBJECT_TWIST_INC; @@ -842,14 +842,14 @@ void LLPanelObject::getState( ) case MI_TORUS: case MI_TUBE: case MI_RING: - //top_size_x_visible = FALSE; - //top_size_y_visible = FALSE; - size_is_hole = TRUE; - skew_visible = TRUE; - advanced_cut_visible = TRUE; - taper_visible = TRUE; - radius_offset_visible = TRUE; - revolutions_visible = TRUE; + //top_size_x_visible = false; + //top_size_y_visible = false; + size_is_hole = true; + skew_visible = true; + advanced_cut_visible = true; + taper_visible = true; + radius_offset_visible = true; + revolutions_visible = true; twist_min = OBJECT_TWIST_MIN; twist_max = OBJECT_TWIST_MAX; twist_inc = OBJECT_TWIST_INC; @@ -857,35 +857,35 @@ void LLPanelObject::getState( ) break; case MI_SCULPT: - cut_visible = FALSE; - hollow_visible = FALSE; - twist_visible = FALSE; - top_size_x_visible = FALSE; - top_size_y_visible = FALSE; - top_shear_x_visible = FALSE; - top_shear_y_visible = FALSE; - skew_visible = FALSE; - advanced_cut_visible = FALSE; - taper_visible = FALSE; - radius_offset_visible = FALSE; - revolutions_visible = FALSE; - sculpt_texture_visible = TRUE; + cut_visible = false; + hollow_visible = false; + twist_visible = false; + top_size_x_visible = false; + top_size_y_visible = false; + top_shear_x_visible = false; + top_shear_y_visible = false; + skew_visible = false; + advanced_cut_visible = false; + taper_visible = false; + radius_offset_visible = false; + revolutions_visible = false; + sculpt_texture_visible = true; break; case MI_BOX: - advanced_cut_visible = TRUE; - advanced_is_slice = TRUE; + advanced_cut_visible = true; + advanced_is_slice = true; break; case MI_CYLINDER: - advanced_cut_visible = TRUE; - advanced_is_slice = TRUE; + advanced_cut_visible = true; + advanced_is_slice = true; break; case MI_PRISM: - advanced_cut_visible = TRUE; - advanced_is_slice = TRUE; + advanced_cut_visible = true; + advanced_is_slice = true; break; default: @@ -964,18 +964,18 @@ void LLPanelObject::getState( ) mLabelSkew ->setEnabled( enabled ); mSpinSkew ->setEnabled( enabled ); - getChildView("scale_hole")->setVisible( FALSE); - getChildView("scale_taper")->setVisible( FALSE); + getChildView("scale_hole")->setVisible( false); + getChildView("scale_taper")->setVisible( false); if (top_size_x_visible || top_size_y_visible) { if (size_is_hole) { - getChildView("scale_hole")->setVisible( TRUE); + getChildView("scale_hole")->setVisible( true); getChildView("scale_hole")->setEnabled(enabled); } else { - getChildView("scale_taper")->setVisible( TRUE); + getChildView("scale_taper")->setVisible( true); getChildView("scale_taper")->setEnabled(enabled); } } @@ -987,26 +987,26 @@ void LLPanelObject::getState( ) mSpinShearX ->setEnabled( enabled ); mSpinShearY ->setEnabled( enabled ); - getChildView("advanced_cut")->setVisible( FALSE); - getChildView("advanced_dimple")->setVisible( FALSE); - getChildView("advanced_slice")->setVisible( FALSE); + getChildView("advanced_cut")->setVisible( false); + getChildView("advanced_dimple")->setVisible( false); + getChildView("advanced_slice")->setVisible( false); if (advanced_cut_visible) { if (advanced_is_dimple) { - getChildView("advanced_dimple")->setVisible( TRUE); + getChildView("advanced_dimple")->setVisible( true); getChildView("advanced_dimple")->setEnabled(enabled); } else if (advanced_is_slice) { - getChildView("advanced_slice")->setVisible( TRUE); + getChildView("advanced_slice")->setVisible( true); getChildView("advanced_slice")->setEnabled(enabled); } else { - getChildView("advanced_cut")->setVisible( TRUE); + getChildView("advanced_cut")->setVisible( true); getChildView("advanced_cut")->setEnabled(enabled); } } @@ -1091,14 +1091,14 @@ void LLPanelObject::getState( ) U8 sculpt_type = sculpt_params->getSculptType(); U8 sculpt_stitching = sculpt_type & LL_SCULPT_TYPE_MASK; - BOOL sculpt_invert = sculpt_type & LL_SCULPT_FLAG_INVERT; - BOOL sculpt_mirror = sculpt_type & LL_SCULPT_FLAG_MIRROR; + bool sculpt_invert = sculpt_type & LL_SCULPT_FLAG_INVERT; + bool sculpt_mirror = sculpt_type & LL_SCULPT_FLAG_MIRROR; isMesh = (sculpt_stitching == LL_SCULPT_TYPE_MESH); LLTextureCtrl* mTextureCtrl = getChild<LLTextureCtrl>("sculpt texture control"); if(mTextureCtrl) { - mTextureCtrl->setTentative(FALSE); + mTextureCtrl->setTentative(false); mTextureCtrl->setEnabled(editable && !isMesh); if (editable) mTextureCtrl->setImageAssetID(sculpt_params->getSculptTexture()); @@ -1138,7 +1138,7 @@ void LLPanelObject::getState( ) if (mLabelSculptType) { - mLabelSculptType->setEnabled(TRUE); + mLabelSculptType->setEnabled(true); } } @@ -1161,12 +1161,12 @@ void LLPanelObject::getState( ) bool LLPanelObject::precommitValidate( const LLSD& data ) { // TODO: Richard will fill this in later. - return TRUE; // FALSE means that validation failed and new value should not be commited. + return true; // false means that validation failed and new value should not be commited. } void LLPanelObject::sendIsPhysical() { - BOOL value = mCheckPhysics->get(); + bool value = mCheckPhysics->get(); if( mIsPhysical != value ) { LLSelectMgr::getInstance()->selectionUpdatePhysics(value); @@ -1182,7 +1182,7 @@ void LLPanelObject::sendIsPhysical() void LLPanelObject::sendIsTemporary() { - BOOL value = mCheckTemporary->get(); + bool value = mCheckTemporary->get(); if( mIsTemporary != value ) { LLSelectMgr::getInstance()->selectionUpdateTemporary(value); @@ -1199,7 +1199,7 @@ void LLPanelObject::sendIsTemporary() void LLPanelObject::sendIsPhantom() { - BOOL value = mCheckPhantom->get(); + bool value = mCheckPhantom->get(); if( mIsPhantom != value ) { LLSelectMgr::getInstance()->selectionUpdatePhantom(value); @@ -1245,7 +1245,7 @@ void LLPanelObject::onCommitParametric( LLUICtrl* ctrl, void* userdata ) if (selected_type == MI_SCULPT) { - self->mObject->setParameterEntryInUse(LLNetworkData::PARAMS_SCULPT, TRUE, TRUE); + self->mObject->setParameterEntryInUse(LLNetworkData::PARAMS_SCULPT, true, true); LLSculptParams *sculpt_params = (LLSculptParams *)self->mObject->getParameterEntry(LLNetworkData::PARAMS_SCULPT); if (sculpt_params) volume_params.setSculptID(sculpt_params->getSculptTexture(), sculpt_params->getSculptType()); @@ -1254,7 +1254,7 @@ void LLPanelObject::onCommitParametric( LLUICtrl* ctrl, void* userdata ) { LLSculptParams *sculpt_params = (LLSculptParams *)self->mObject->getParameterEntry(LLNetworkData::PARAMS_SCULPT); if (sculpt_params) - self->mObject->setParameterEntryInUse(LLNetworkData::PARAMS_SCULPT, FALSE, TRUE); + self->mObject->setParameterEntryInUse(LLNetworkData::PARAMS_SCULPT, false, true); } // Update the volume, if necessary. @@ -1559,7 +1559,7 @@ void LLPanelObject::getVolumeParams(LLVolumeParams& volume_params) } // BUG: Make work with multiple objects -void LLPanelObject::sendRotation(BOOL btn_down) +void LLPanelObject::sendRotation(bool btn_down) { if (mObject.isNull()) return; @@ -1615,7 +1615,7 @@ void LLPanelObject::sendRotation(BOOL btn_down) // BUG: Make work with multiple objects -void LLPanelObject::sendScale(BOOL btn_down) +void LLPanelObject::sendScale(bool btn_down) { if (mObject.isNull()) return; @@ -1629,20 +1629,20 @@ void LLPanelObject::sendScale(BOOL btn_down) // check to see if we aren't scaling the textures // (in which case the tex coord's need to be recomputed) - BOOL dont_stretch_textures = !LLManipScale::getStretchTextures(); + bool dont_stretch_textures = !LLManipScale::getStretchTextures(); if (dont_stretch_textures) { LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_SCALE); } - mObject->setScale(newscale, TRUE); + mObject->setScale(newscale, true); if(!btn_down) { LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_SCALE | UPD_POSITION); } - LLSelectMgr::getInstance()->adjustTexturesByScale(TRUE, !dont_stretch_textures); + LLSelectMgr::getInstance()->adjustTexturesByScale(true, !dont_stretch_textures); // LL_INFOS() << "scale sent" << LL_ENDL; } else @@ -1652,7 +1652,7 @@ void LLPanelObject::sendScale(BOOL btn_down) } -void LLPanelObject::sendPosition(BOOL btn_down) +void LLPanelObject::sendPosition(bool btn_down) { if (mObject.isNull()) return; @@ -1736,7 +1736,7 @@ void LLPanelObject::sendPosition(BOOL btn_down) if (mObject->isRootEdit()) { // only offset by parent's translation - mObject->resetChildrenPosition(LLVector3(-delta), TRUE, TRUE) ; + mObject->resetChildrenPosition(LLVector3(-delta), true, true) ; } if(!btn_down) @@ -1766,32 +1766,41 @@ void LLPanelObject::sendSculpt() LLUUID sculpt_id = LLUUID::null; if (mCtrlSculptTexture) + { sculpt_id = mCtrlSculptTexture->getImageAssetID(); + } U8 sculpt_type = 0; if (mCtrlSculptType) + { sculpt_type |= mCtrlSculptType->getValue().asInteger(); + } bool enabled = sculpt_type != LL_SCULPT_TYPE_MESH; if (mCtrlSculptMirror) { - mCtrlSculptMirror->setEnabled(enabled ? TRUE : FALSE); + mCtrlSculptMirror->setEnabled(enabled); } + if (mCtrlSculptInvert) { - mCtrlSculptInvert->setEnabled(enabled ? TRUE : FALSE); + mCtrlSculptInvert->setEnabled(enabled); } if ((mCtrlSculptMirror) && (mCtrlSculptMirror->get())) + { sculpt_type |= LL_SCULPT_FLAG_MIRROR; + } if ((mCtrlSculptInvert) && (mCtrlSculptInvert->get())) + { sculpt_type |= LL_SCULPT_FLAG_INVERT; + } sculpt_params.setSculptTexture(sculpt_id, sculpt_type); - mObject->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt_params, TRUE); + mObject->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt_params, true); } void LLPanelObject::refresh() @@ -1890,34 +1899,34 @@ void LLPanelObject::clearCtrls() { LLPanel::clearCtrls(); - mCheckLock ->set(FALSE); - mCheckLock ->setEnabled( FALSE ); - mCheckPhysics ->set(FALSE); - mCheckPhysics ->setEnabled( FALSE ); - mCheckTemporary ->set(FALSE); - mCheckTemporary ->setEnabled( FALSE ); - mCheckPhantom ->set(FALSE); - mCheckPhantom ->setEnabled( FALSE ); + mCheckLock ->set(false); + mCheckLock ->setEnabled( false ); + mCheckPhysics ->set(false); + mCheckPhysics ->setEnabled( false ); + mCheckTemporary ->set(false); + mCheckTemporary ->setEnabled( false ); + mCheckPhantom ->set(false); + mCheckPhantom ->setEnabled( false ); // Disable text labels - mLabelPosition ->setEnabled( FALSE ); - mLabelSize ->setEnabled( FALSE ); - mLabelRotation ->setEnabled( FALSE ); - mLabelCut ->setEnabled( FALSE ); - mLabelHollow ->setEnabled( FALSE ); - mLabelHoleType ->setEnabled( FALSE ); - mLabelTwist ->setEnabled( FALSE ); - mLabelSkew ->setEnabled( FALSE ); - mLabelShear ->setEnabled( FALSE ); - mLabelTaper ->setEnabled( FALSE ); - mLabelRadiusOffset->setEnabled( FALSE ); - mLabelRevolutions->setEnabled( FALSE ); - - getChildView("scale_hole")->setEnabled(FALSE); - getChildView("scale_taper")->setEnabled(FALSE); - getChildView("advanced_cut")->setEnabled(FALSE); - getChildView("advanced_dimple")->setEnabled(FALSE); - getChildView("advanced_slice")->setVisible( FALSE); + mLabelPosition ->setEnabled( false ); + mLabelSize ->setEnabled( false ); + mLabelRotation ->setEnabled( false ); + mLabelCut ->setEnabled( false ); + mLabelHollow ->setEnabled( false ); + mLabelHoleType ->setEnabled( false ); + mLabelTwist ->setEnabled( false ); + mLabelSkew ->setEnabled( false ); + mLabelShear ->setEnabled( false ); + mLabelTaper ->setEnabled( false ); + mLabelRadiusOffset->setEnabled( false ); + mLabelRevolutions->setEnabled( false ); + + getChildView("scale_hole")->setEnabled(false); + getChildView("scale_taper")->setEnabled(false); + getChildView("advanced_cut")->setEnabled(false); + getChildView("advanced_dimple")->setEnabled(false); + getChildView("advanced_slice")->setVisible( false); } // @@ -1932,7 +1941,7 @@ void LLPanelObject::onCommitLock(LLUICtrl *ctrl, void *data) if(self->mRootObject.isNull()) return; - BOOL new_state = self->mCheckLock->get(); + bool new_state = self->mCheckLock->get(); LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_OWNER, !new_state, PERM_MOVE | PERM_MODIFY); } @@ -1941,7 +1950,7 @@ void LLPanelObject::onCommitLock(LLUICtrl *ctrl, void *data) void LLPanelObject::onCommitPosition( LLUICtrl* ctrl, void* userdata ) { LLPanelObject* self = (LLPanelObject*) userdata; - BOOL btn_down = ((LLSpinCtrl*)ctrl)->isMouseHeldDown() ; + bool btn_down = ((LLSpinCtrl*)ctrl)->isMouseHeldDown() ; self->sendPosition(btn_down); } @@ -1949,7 +1958,7 @@ void LLPanelObject::onCommitPosition( LLUICtrl* ctrl, void* userdata ) void LLPanelObject::onCommitScale( LLUICtrl* ctrl, void* userdata ) { LLPanelObject* self = (LLPanelObject*) userdata; - BOOL btn_down = ((LLSpinCtrl*)ctrl)->isMouseHeldDown() ; + bool btn_down = ((LLSpinCtrl*)ctrl)->isMouseHeldDown() ; self->sendScale(btn_down); } @@ -1957,7 +1966,7 @@ void LLPanelObject::onCommitScale( LLUICtrl* ctrl, void* userdata ) void LLPanelObject::onCommitRotation( LLUICtrl* ctrl, void* userdata ) { LLPanelObject* self = (LLPanelObject*) userdata; - BOOL btn_down = ((LLSpinCtrl*)ctrl)->isMouseHeldDown() ; + bool btn_down = ((LLSpinCtrl*)ctrl)->isMouseHeldDown() ; self->sendRotation(btn_down); } @@ -2000,7 +2009,7 @@ void LLPanelObject::onCommitSculpt( const LLSD& data ) sendSculpt(); } -BOOL LLPanelObject::onDropSculpt(LLInventoryItem* item) +bool LLPanelObject::onDropSculpt(LLInventoryItem* item) { LLTextureCtrl* mTextureCtrl = getChild<LLTextureCtrl>("sculpt texture control"); @@ -2012,7 +2021,7 @@ BOOL LLPanelObject::onDropSculpt(LLInventoryItem* item) mSculptTextureRevert = asset; } - return TRUE; + return true; } @@ -2099,7 +2108,7 @@ bool LLPanelObject::menuEnableItem(const LLSD& userdata) if (command == "psr_paste") { S32 selected_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); - BOOL single_volume = (LLSelectMgr::getInstance()->selectionAllPCode(LL_PCODE_VOLUME)) + bool single_volume = (LLSelectMgr::getInstance()->selectionAllPCode(LL_PCODE_VOLUME)) && (selected_count == 1); if (!single_volume) @@ -2135,7 +2144,7 @@ bool LLPanelObject::menuEnableItem(const LLSD& userdata) else if (command == "psr_copy") { S32 selected_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); - BOOL single_volume = (LLSelectMgr::getInstance()->selectionAllPCode(LL_PCODE_VOLUME)) + bool single_volume = (LLSelectMgr::getInstance()->selectionAllPCode(LL_PCODE_VOLUME)) && (selected_count == 1); if (!single_volume) @@ -2210,7 +2219,7 @@ void LLPanelObject::onPastePos() mCtrlPosY->set( mClipboardPos.mV[VY] ); mCtrlPosZ->set( mClipboardPos.mV[VZ] ); - sendPosition(FALSE); + sendPosition(false); } void LLPanelObject::onPasteSize() @@ -2225,7 +2234,7 @@ void LLPanelObject::onPasteSize() mCtrlScaleY->set(mClipboardSize.mV[VY]); mCtrlScaleZ->set(mClipboardSize.mV[VZ]); - sendScale(FALSE); + sendScale(false); } void LLPanelObject::onPasteRot() @@ -2236,7 +2245,7 @@ void LLPanelObject::onPasteRot() mCtrlRotY->set(mClipboardRot.mV[VY]); mCtrlRotZ->set(mClipboardRot.mV[VZ]); - sendRotation(FALSE); + sendRotation(false); } void LLPanelObject::onCopyParams() @@ -2289,14 +2298,14 @@ void LLPanelObject::onPasteParams() LLUUID sculpt_id = mClipboardParams["sculpt"]["id"].asUUID(); U8 sculpt_type = (U8)mClipboardParams["sculpt"]["type"].asInteger(); sculpt_params.setSculptTexture(sculpt_id, sculpt_type); - objectp->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt_params, TRUE); + objectp->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt_params, true); } else { LLSculptParams *sculpt_params = (LLSculptParams *)objectp->getParameterEntry(LLNetworkData::PARAMS_SCULPT); if (sculpt_params) { - objectp->setParameterEntryInUse(LLNetworkData::PARAMS_SCULPT, FALSE, TRUE); + objectp->setParameterEntryInUse(LLNetworkData::PARAMS_SCULPT, false, true); } } diff --git a/indra/newview/llpanelobject.h b/indra/newview/llpanelobject.h index 3754dd3040..bbc069b96f 100644 --- a/indra/newview/llpanelobject.h +++ b/indra/newview/llpanelobject.h @@ -51,7 +51,7 @@ public: LLPanelObject(); virtual ~LLPanelObject(); - virtual BOOL postBuild(); + virtual bool postBuild(); virtual void draw(); virtual void clearCtrls(); @@ -81,7 +81,7 @@ public: void onCommitSculpt(const LLSD& data); void onCancelSculpt(const LLSD& data); void onSelectSculpt(const LLSD& data); - BOOL onDropSculpt(LLInventoryItem* item); + bool onDropSculpt(LLInventoryItem* item); static void onCommitSculptType( LLUICtrl *ctrl, void* userdata); void menuDoToSelected(const LLSD& userdata); @@ -90,9 +90,9 @@ public: protected: void getState(); - void sendRotation(BOOL btn_down); - void sendScale(BOOL btn_down); - void sendPosition(BOOL btn_down); + void sendRotation(bool btn_down); + void sendScale(bool btn_down); + void sendPosition(bool btn_down); void sendIsPhysical(); void sendIsTemporary(); void sendIsPhantom(); @@ -155,7 +155,7 @@ protected: LLSpinCtrl* mCtrlScaleX; LLSpinCtrl* mCtrlScaleY; LLSpinCtrl* mCtrlScaleZ; - BOOL mSizeChanged; + bool mSizeChanged; LLMenuButton* mMenuClipboardRot; LLTextBox* mLabelRotation; @@ -175,9 +175,9 @@ protected: LLCheckBoxCtrl *mCtrlSculptInvert; LLVector3 mCurEulerDegrees; // to avoid sending rotation when not changed - BOOL mIsPhysical; // to avoid sending "physical" when not changed - BOOL mIsTemporary; // to avoid sending "temporary" when not changed - BOOL mIsPhantom; // to avoid sending "phantom" when not changed + bool mIsPhysical; // to avoid sending "physical" when not changed + bool mIsTemporary; // to avoid sending "temporary" when not changed + bool mIsPhantom; // to avoid sending "phantom" when not changed S32 mSelectedType; // So we know what selected type we last were LLUUID mSculptTextureRevert; // so we can revert the sculpt texture on cancel diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index 141a1515d5..d33ccc0216 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -123,27 +123,27 @@ public: virtual LLUIImagePtr getIcon() const; virtual void openItem(); - virtual BOOL canOpenItem() const { return FALSE; } + virtual bool canOpenItem() const { return false; } virtual void closeItem() {} virtual void selectItem() {} virtual void navigateToFolder(bool new_window = false, bool change_mode = false) {} - virtual BOOL isItemRenameable() const; - virtual BOOL renameItem(const std::string& new_name); - virtual BOOL isItemMovable() const; - virtual BOOL isItemRemovable(bool check_worn = true) const; - virtual BOOL removeItem(); + virtual bool isItemRenameable() const; + virtual bool renameItem(const std::string& new_name); + virtual bool isItemMovable() const; + virtual bool isItemRemovable(bool check_worn = true) const; + virtual bool removeItem(); virtual void removeBatch(std::vector<LLFolderViewModelItem*>& batch); virtual void move(LLFolderViewModelItem* parent_listener); virtual bool isItemCopyable(bool can_copy_as_link = true) const; - virtual BOOL copyToClipboard() const; - virtual BOOL cutToClipboard(); - virtual BOOL isClipboardPasteable() const; + virtual bool copyToClipboard() const; + virtual bool cutToClipboard(); + virtual bool isClipboardPasteable() const; virtual void pasteFromClipboard(); virtual void pasteLinkFromClipboard(); virtual void buildContextMenu(LLMenuGL& menu, U32 flags); virtual void performAction(LLInventoryModel* model, std::string action); - virtual BOOL isUpToDate() const { return TRUE; } - virtual bool hasChildren() const { return FALSE; } + virtual bool isUpToDate() const { return true; } + virtual bool hasChildren() const { return false; } virtual LLInventoryType::EType getInventoryType() const { return LLInventoryType::IT_NONE; } virtual LLWearableType::EType getWearableType() const { return LLWearableType::WT_NONE; } virtual LLSettingsType::type_e getSettingsType() const { return LLSettingsType::ST_NONE; } @@ -153,8 +153,8 @@ public: // LLDragAndDropBridge functionality virtual LLToolDragAndDrop::ESource getDragSource() const { return LLToolDragAndDrop::SOURCE_WORLD; } - virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const; - virtual BOOL dragOrDrop(MASK mask, BOOL drop, + virtual bool startDrag(EDragAndDropType* type, LLUUID* id) const; + virtual bool dragOrDrop(MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, std::string& tooltip_msg); @@ -236,9 +236,9 @@ const std::string& LLTaskInvFVBridge::getDisplayName() const } const LLPermissions& perm(item->getPermissions()); - BOOL copy = gAgent.allowOperation(PERM_COPY, perm, GP_OBJECT_MANIPULATE); - BOOL mod = gAgent.allowOperation(PERM_MODIFY, perm, GP_OBJECT_MANIPULATE); - BOOL xfer = gAgent.allowOperation(PERM_TRANSFER, perm, GP_OBJECT_MANIPULATE); + bool copy = gAgent.allowOperation(PERM_COPY, perm, GP_OBJECT_MANIPULATE); + bool mod = gAgent.allowOperation(PERM_MODIFY, perm, GP_OBJECT_MANIPULATE); + bool xfer = gAgent.allowOperation(PERM_TRANSFER, perm, GP_OBJECT_MANIPULATE); if(!copy) { @@ -277,7 +277,7 @@ void LLTaskInvFVBridge::setCreationDate(time_t creation_date_utc) LLUIImagePtr LLTaskInvFVBridge::getIcon() const { - const BOOL item_is_multi = (mFlags & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS); + const bool item_is_multi = (mFlags & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS); return LLInventoryIcon::getIcon(mAssetType, mInventoryType, 0, item_is_multi ); } @@ -288,9 +288,9 @@ void LLTaskInvFVBridge::openItem() LL_DEBUGS() << "LLTaskInvFVBridge::openItem()" << LL_ENDL; } -BOOL LLTaskInvFVBridge::isItemRenameable() const +bool LLTaskInvFVBridge::isItemRenameable() const { - if(gAgent.isGodlike()) return TRUE; + if(gAgent.isGodlike()) return true; LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID()); if(object) { @@ -298,13 +298,13 @@ BOOL LLTaskInvFVBridge::isItemRenameable() const if(item && gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE, GOD_LIKE)) { - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL LLTaskInvFVBridge::renameItem(const std::string& new_name) +bool LLTaskInvFVBridge::renameItem(const std::string& new_name) { LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID()); if(object) @@ -322,29 +322,29 @@ BOOL LLTaskInvFVBridge::renameItem(const std::string& new_name) false); } } - return TRUE; + return true; } -BOOL LLTaskInvFVBridge::isItemMovable() const +bool LLTaskInvFVBridge::isItemMovable() const { //LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID()); //if(object && (object->permModify() || gAgent.isGodlike())) //{ - // return TRUE; + // return true; //} - //return FALSE; - return TRUE; + //return false; + return true; } -BOOL LLTaskInvFVBridge::isItemRemovable(bool check_worn) const +bool LLTaskInvFVBridge::isItemRemovable(bool check_worn) const { const LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID()); if(object && (object->permModify() || object->permYouOwner())) { - return TRUE; + return true; } - return FALSE; + return false; } bool remove_task_inventory_callback(const LLSD& notification, const LLSD& response, LLPanelObjectInventory* panel) @@ -372,7 +372,7 @@ bool remove_task_inventory_callback(const LLSD& notification, const LLSD& respon // ! REFACTOR ! two_uuids_list_t is also defined in llinventorybridge.h, but differently. typedef std::pair<LLUUID, std::list<LLUUID> > panel_two_uuids_list_t; typedef std::pair<LLPanelObjectInventory*, panel_two_uuids_list_t> remove_data_t; -BOOL LLTaskInvFVBridge::removeItem() +bool LLTaskInvFVBridge::removeItem() { if(isItemRemovable() && mPanel) { @@ -383,7 +383,7 @@ BOOL LLTaskInvFVBridge::removeItem() { // just do it. object->removeInventory(mUUID); - return TRUE; + return true; } else { @@ -391,11 +391,11 @@ BOOL LLTaskInvFVBridge::removeItem() payload["task_id"] = mPanel->getTaskUUID(); payload["inventory_ids"].append(mUUID); LLNotificationsUtil::add("RemoveItemWarn", LLSD(), payload, boost::bind(&remove_task_inventory_callback, _1, _2, mPanel)); - return FALSE; + return false; } } } - return FALSE; + return false; } void LLTaskInvFVBridge::removeBatch(std::vector<LLFolderViewModelItem*>& batch) @@ -450,19 +450,19 @@ bool LLTaskInvFVBridge::isItemCopyable(bool can_link) const GP_OBJECT_MANIPULATE); } -BOOL LLTaskInvFVBridge::copyToClipboard() const +bool LLTaskInvFVBridge::copyToClipboard() const { - return FALSE; + return false; } -BOOL LLTaskInvFVBridge::cutToClipboard() +bool LLTaskInvFVBridge::cutToClipboard() { - return FALSE; + return false; } -BOOL LLTaskInvFVBridge::isClipboardPasteable() const +bool LLTaskInvFVBridge::isClipboardPasteable() const { - return FALSE; + return false; } void LLTaskInvFVBridge::pasteFromClipboard() @@ -473,7 +473,7 @@ void LLTaskInvFVBridge::pasteLinkFromClipboard() { } -BOOL LLTaskInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const +bool LLTaskInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const { //LL_INFOS() << "LLTaskInvFVBridge::startDrag()" << LL_ENDL; if(mPanel) @@ -493,7 +493,7 @@ BOOL LLTaskInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const // due to a race condition and possible exploit where // attached objects do not update their inventory items // when their contents are manipulated - return FALSE; + return false; } if((can_copy && perm.allowTransferTo(gAgent.getID())) || object->permYouOwner()) @@ -503,21 +503,21 @@ BOOL LLTaskInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const *type = LLViewerAssetType::lookupDragAndDropType(inv->getType()); *id = inv->getUUID(); - return TRUE; + return true; } } } } - return FALSE; + return false; } -BOOL LLTaskInvFVBridge::dragOrDrop(MASK mask, BOOL drop, +bool LLTaskInvFVBridge::dragOrDrop(MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, std::string& tooltip_msg) { //LL_INFOS() << "LLTaskInvFVBridge::dragOrDrop()" << LL_ENDL; - return FALSE; + return false; } // virtual @@ -585,18 +585,18 @@ public: virtual LLUIImagePtr getIcon() const; virtual const std::string& getDisplayName() const; - virtual BOOL isItemRenameable() const; - // virtual BOOL isItemCopyable() const { return FALSE; } - virtual BOOL renameItem(const std::string& new_name); - virtual BOOL isItemRemovable(bool check_worn = true) const; + virtual bool isItemRenameable() const; + // virtual bool isItemCopyable() const { return false; } + virtual bool renameItem(const std::string& new_name); + virtual bool isItemRemovable(bool check_worn = true) const; virtual void buildContextMenu(LLMenuGL& menu, U32 flags); virtual bool hasChildren() const; - virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const; - virtual BOOL dragOrDrop(MASK mask, BOOL drop, + virtual bool startDrag(EDragAndDropType* type, LLUUID* id) const; + virtual bool dragOrDrop(MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, std::string& tooltip_msg); - virtual BOOL canOpenItem() const { return TRUE; } + virtual bool canOpenItem() const { return true; } virtual void openItem(); virtual EInventorySortGroup getSortGroup() const { return SG_NORMAL_FOLDER; } }; @@ -638,19 +638,19 @@ const std::string& LLTaskCategoryBridge::getDisplayName() const return mDisplayName; } -BOOL LLTaskCategoryBridge::isItemRenameable() const +bool LLTaskCategoryBridge::isItemRenameable() const { - return FALSE; + return false; } -BOOL LLTaskCategoryBridge::renameItem(const std::string& new_name) +bool LLTaskCategoryBridge::renameItem(const std::string& new_name) { - return FALSE; + return false; } -BOOL LLTaskCategoryBridge::isItemRemovable(bool check_worn) const +bool LLTaskCategoryBridge::isItemRemovable(bool check_worn) const { - return FALSE; + return false; } void LLTaskCategoryBridge::buildContextMenu(LLMenuGL& menu, U32 flags) @@ -662,16 +662,16 @@ void LLTaskCategoryBridge::buildContextMenu(LLMenuGL& menu, U32 flags) bool LLTaskCategoryBridge::hasChildren() const { - // return TRUE if we have or do know know if we have children. - // *FIX: For now, return FALSE - we will know for sure soon enough. - return FALSE; + // return true if we have or do know know if we have children. + // *FIX: For now, return false - we will know for sure soon enough. + return false; } void LLTaskCategoryBridge::openItem() { } -BOOL LLTaskCategoryBridge::startDrag(EDragAndDropType* type, LLUUID* id) const +bool LLTaskCategoryBridge::startDrag(EDragAndDropType* type, LLUUID* id) const { //LL_INFOS() << "LLTaskInvFVBridge::startDrag()" << LL_ENDL; if(mPanel && mUUID.notNull()) @@ -680,24 +680,24 @@ BOOL LLTaskCategoryBridge::startDrag(EDragAndDropType* type, LLUUID* id) const if(object) { const LLInventoryObject* cat = object->getInventoryObject(mUUID); - if ( (cat) && (move_inv_category_world_to_agent(mUUID, LLUUID::null, FALSE)) ) + if ( (cat) && (move_inv_category_world_to_agent(mUUID, LLUUID::null, false)) ) { *type = LLViewerAssetType::lookupDragAndDropType(cat->getType()); *id = mUUID; - return TRUE; + return true; } } } - return FALSE; + return false; } -BOOL LLTaskCategoryBridge::dragOrDrop(MASK mask, BOOL drop, +bool LLTaskCategoryBridge::dragOrDrop(MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, std::string& tooltip_msg) { //LL_INFOS() << "LLTaskCategoryBridge::dragOrDrop()" << LL_ENDL; - BOOL accept = FALSE; + bool accept = false; LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID()); if(object) { @@ -739,14 +739,14 @@ BOOL LLTaskCategoryBridge::dragOrDrop(MASK mask, BOOL drop, && (LLToolDragAndDrop::SOURCE_WORLD != LLToolDragAndDrop::getInstance()->getSource()) && (LLToolDragAndDrop::SOURCE_NOTECARD != LLToolDragAndDrop::getInstance()->getSource())) { - accept = TRUE; + accept = true; } if(accept && drop) { LLViewerInventoryItem* item = (LLViewerInventoryItem*)cargo_data; // rez in the script active by default, rez in // inactive if the control key is being held down. - BOOL active = ((mask & MASK_CONTROL) == 0); + bool active = ((mask & MASK_CONTROL) == 0); LLToolDragAndDrop::dropScript(object, item, active, LLToolDragAndDrop::getInstance()->getSource(), LLToolDragAndDrop::getInstance()->getSourceID()); @@ -771,7 +771,7 @@ public: const std::string& name) : LLTaskInvFVBridge(panel, uuid, name) {} - virtual BOOL canOpenItem() const { return TRUE; } + virtual bool canOpenItem() const { return true; } virtual void openItem(); }; @@ -803,7 +803,7 @@ public: const std::string& name) : LLTaskInvFVBridge(panel, uuid, name) {} - virtual BOOL canOpenItem() const { return TRUE; } + virtual bool canOpenItem() const { return true; } virtual void openItem(); virtual void performAction(LLInventoryModel* model, std::string action); virtual void buildContextMenu(LLMenuGL& menu, U32 flags); @@ -905,18 +905,18 @@ public: const std::string& name) : LLTaskInvFVBridge(panel, uuid, name) {} - virtual BOOL isItemRenameable() const; - virtual BOOL renameItem(const std::string& new_name); + virtual bool isItemRenameable() const; + virtual bool renameItem(const std::string& new_name); }; -BOOL LLTaskCallingCardBridge::isItemRenameable() const +bool LLTaskCallingCardBridge::isItemRenameable() const { - return FALSE; + return false; } -BOOL LLTaskCallingCardBridge::renameItem(const std::string& new_name) +bool LLTaskCallingCardBridge::renameItem(const std::string& new_name) { - return FALSE; + return false; } @@ -932,7 +932,7 @@ public: const std::string& name) : LLTaskInvFVBridge(panel, uuid, name) {} - //static BOOL enableIfCopyable( void* userdata ); + //static bool enableIfCopyable( void* userdata ); }; class LLTaskLSLBridge : public LLTaskScriptBridge @@ -943,9 +943,9 @@ public: const std::string& name) : LLTaskScriptBridge(panel, uuid, name) {} - virtual BOOL canOpenItem() const { return TRUE; } + virtual bool canOpenItem() const { return true; } virtual void openItem(); - virtual BOOL removeItem(); + virtual bool removeItem(); //virtual void buildContextMenu(LLMenuGL& menu); //static void copyToInventory(void* userdata); @@ -968,7 +968,7 @@ void LLTaskLSLBridge::openItem() LLLiveLSLEditor* preview = LLFloaterReg::showTypedInstance<LLLiveLSLEditor>("preview_scriptedit", floater_key, TAKE_FOCUS_YES); if (preview) { - LLSelectNode *node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(NULL, TRUE); + LLSelectNode *node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(NULL, true); if (node && node->mValid) { preview->setObjectName(node->mName); @@ -982,7 +982,7 @@ void LLTaskLSLBridge::openItem() } } -BOOL LLTaskLSLBridge::removeItem() +bool LLTaskLSLBridge::removeItem() { LLFloaterReg::hideInstance("preview_scriptedit", LLSD(mUUID)); return LLTaskInvFVBridge::removeItem(); @@ -1014,9 +1014,9 @@ public: const std::string& name) : LLTaskInvFVBridge(panel, uuid, name) {} - virtual BOOL canOpenItem() const { return TRUE; } + virtual bool canOpenItem() const { return true; } virtual void openItem(); - virtual BOOL removeItem(); + virtual bool removeItem(); }; void LLTaskNotecardBridge::openItem() @@ -1029,7 +1029,7 @@ void LLTaskNotecardBridge::openItem() // Note: even if we are not allowed to modify copyable notecard, we should be able to view it LLInventoryItem *item = dynamic_cast<LLInventoryItem*>(object->getInventoryObject(mUUID)); - BOOL item_copy = item && gAgent.allowOperation(PERM_COPY, item->getPermissions(), GP_OBJECT_MANIPULATE); + bool item_copy = item && gAgent.allowOperation(PERM_COPY, item->getPermissions(), GP_OBJECT_MANIPULATE); if( item_copy || object->permModify() || gAgent.isGodlike()) @@ -1045,7 +1045,7 @@ void LLTaskNotecardBridge::openItem() } } -BOOL LLTaskNotecardBridge::removeItem() +bool LLTaskNotecardBridge::removeItem() { LLFloaterReg::hideInstance("preview_notecard", LLSD(mUUID)); return LLTaskInvFVBridge::removeItem(); @@ -1063,9 +1063,9 @@ public: const std::string& name) : LLTaskInvFVBridge(panel, uuid, name) {} - virtual BOOL canOpenItem() const { return TRUE; } + virtual bool canOpenItem() const { return true; } virtual void openItem(); - virtual BOOL removeItem(); + virtual bool removeItem(); }; void LLTaskGestureBridge::openItem() @@ -1078,7 +1078,7 @@ void LLTaskGestureBridge::openItem() LLPreviewGesture::show(mUUID, mPanel->getTaskUUID()); } -BOOL LLTaskGestureBridge::removeItem() +bool LLTaskGestureBridge::removeItem() { // Don't need to deactivate gesture because gestures inside objects can never be active. LLFloaterReg::hideInstance("preview_gesture", LLSD(mUUID)); @@ -1097,9 +1097,9 @@ public: const std::string& name) : LLTaskInvFVBridge(panel, uuid, name) {} - virtual BOOL canOpenItem() const { return TRUE; } + virtual bool canOpenItem() const { return true; } virtual void openItem(); - virtual BOOL removeItem(); + virtual bool removeItem(); }; void LLTaskAnimationBridge::openItem() @@ -1117,7 +1117,7 @@ void LLTaskAnimationBridge::openItem() } } -BOOL LLTaskAnimationBridge::removeItem() +bool LLTaskAnimationBridge::removeItem() { LLFloaterReg::hideInstance("preview_anim", LLSD(mUUID)); return LLTaskInvFVBridge::removeItem(); @@ -1141,7 +1141,7 @@ public: LLUIImagePtr LLTaskWearableBridge::getIcon() const { - return LLInventoryIcon::getIcon(mAssetType, mInventoryType, mFlags, FALSE ); + return LLInventoryIcon::getIcon(mAssetType, mInventoryType, mFlags, false ); } ///---------------------------------------------------------------------------- @@ -1163,7 +1163,7 @@ public: LLUIImagePtr LLTaskSettingsBridge::getIcon() const { - return LLInventoryIcon::getIcon(mAssetType, mInventoryType, mFlags, FALSE); + return LLInventoryIcon::getIcon(mAssetType, mInventoryType, mFlags, false); } LLSettingsType::type_e LLTaskSettingsBridge::getSettingsType() const @@ -1183,9 +1183,9 @@ public: const std::string& name) : LLTaskInvFVBridge(panel, uuid, name) {} - BOOL canOpenItem() const override { return TRUE; } + bool canOpenItem() const override { return true; } void openItem() override; - BOOL removeItem() override; + bool removeItem() override; }; void LLTaskMaterialBridge::openItem() @@ -1198,7 +1198,7 @@ void LLTaskMaterialBridge::openItem() // Note: even if we are not allowed to modify copyable notecard, we should be able to view it LLInventoryItem *item = dynamic_cast<LLInventoryItem*>(object->getInventoryObject(mUUID)); - BOOL item_copy = item && gAgent.allowOperation(PERM_COPY, item->getPermissions(), GP_OBJECT_MANIPULATE); + bool item_copy = item && gAgent.allowOperation(PERM_COPY, item->getPermissions(), GP_OBJECT_MANIPULATE); if( item_copy || object->permModify() || gAgent.isGodlike()) @@ -1211,12 +1211,12 @@ void LLTaskMaterialBridge::openItem() { mat->setObjectID(mPanel->getTaskUUID()); mat->openFloater(floater_key); - mat->setFocus(TRUE); + mat->setFocus(true); } } } -BOOL LLTaskMaterialBridge::removeItem() +bool LLTaskMaterialBridge::removeItem() { LLFloaterReg::hideInstance("material_editor", LLSD(mUUID)); return LLTaskInvFVBridge::removeItem(); @@ -1339,9 +1339,9 @@ LLPanelObjectInventory::LLPanelObjectInventory(const LLPanelObjectInventory::Par LLPanel(p), mScroller(NULL), mFolders(NULL), - mHaveInventory(FALSE), - mIsInventoryEmpty(TRUE), - mInventoryNeedsUpdate(FALSE), + mHaveInventory(false), + mIsInventoryEmpty(true), + mInventoryNeedsUpdate(false), mInventoryViewModel(p.name), mShowRootFolder(p.show_root_folder) { @@ -1365,7 +1365,7 @@ LLPanelObjectInventory::~LLPanelObjectInventory() } } -BOOL LLPanelObjectInventory::postBuild() +bool LLPanelObjectInventory::postBuild() { // clear contents and initialize menus, sets up mFolders reset(); @@ -1373,7 +1373,7 @@ BOOL LLPanelObjectInventory::postBuild() // Register an idle update callback gIdleCallbacks.addFunction(idle, this); - return TRUE; + return true; } void LLPanelObjectInventory::doToSelected(const LLSD& userdata) @@ -1383,8 +1383,8 @@ void LLPanelObjectInventory::doToSelected(const LLSD& userdata) void LLPanelObjectInventory::clearContents() { - mHaveInventory = FALSE; - mIsInventoryEmpty = TRUE; + mHaveInventory = false; + mIsInventoryEmpty = true; if (LLToolDragAndDrop::getInstance() && LLToolDragAndDrop::getInstance()->getSource() == LLToolDragAndDrop::SOURCE_WORLD) { LLToolDragAndDrop::getInstance()->endDrag(); @@ -1463,7 +1463,7 @@ void LLPanelObjectInventory::inventoryChanged(LLViewerObject* object, // << " task UUID: " << object->mID << LL_ENDL; if(mTaskUUID == object->mID) { - mInventoryNeedsUpdate = TRUE; + mInventoryNeedsUpdate = true; } } @@ -1475,7 +1475,7 @@ void LLPanelObjectInventory::updateInventory() // We're still interested in this task's inventory. std::vector<LLUUID> selected_item_ids; std::set<LLFolderViewItem*> selected_items; - BOOL inventory_has_focus = FALSE; + bool inventory_has_focus = false; if (mHaveInventory && mFolders) { selected_items = mFolders->getSelectionList(); @@ -1498,14 +1498,14 @@ void LLPanelObjectInventory::updateInventory() if (inventory_root) { reset(); - mIsInventoryEmpty = FALSE; + mIsInventoryEmpty = false; createFolderViews(inventory_root, contents); - mFolders->setEnabled(TRUE); + mFolders->setEnabled(true); } else { // TODO: create an empty inventory - mIsInventoryEmpty = TRUE; + mIsInventoryEmpty = true; } mHaveInventory = !mIsInventoryEmpty || !objectp->isInventoryDirty(); @@ -1520,8 +1520,8 @@ void LLPanelObjectInventory::updateInventory() else { // TODO: create an empty inventory - mIsInventoryEmpty = TRUE; - mHaveInventory = TRUE; + mIsInventoryEmpty = true; + mHaveInventory = true; } // restore previous selection @@ -1536,12 +1536,12 @@ void LLPanelObjectInventory::updateInventory() //HACK: "set" first item then "change" each other one to get keyboard focus right if (first_item) { - mFolders->setSelection(selected_item, TRUE, inventory_has_focus); - first_item = FALSE; + mFolders->setSelection(selected_item, true, inventory_has_focus); + first_item = false; } else { - mFolders->changeSelection(selected_item, TRUE); + mFolders->changeSelection(selected_item, true); } } } @@ -1550,7 +1550,7 @@ void LLPanelObjectInventory::updateInventory() { mFolders->requestArrange(); } - mInventoryNeedsUpdate = FALSE; + mInventoryNeedsUpdate = false; // Edit menu handler is set in onFocusReceived } @@ -1671,8 +1671,8 @@ void LLPanelObjectInventory::createViewsForCategory(LLInventoryObject::object_li void LLPanelObjectInventory::refresh() { //LL_INFOS() << "LLPanelObjectInventory::refresh()" << LL_ENDL; - BOOL has_inventory = FALSE; - const BOOL non_root_ok = TRUE; + bool has_inventory = false; + const bool non_root_ok = true; LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); LLSelectNode* node = selection->getFirstRootNode(NULL, non_root_ok); if(node && node->mValid) @@ -1683,7 +1683,7 @@ void LLPanelObjectInventory::refresh() { // determine if we need to make a request. Start with a // default based on if we have inventory at all. - BOOL make_request = !mHaveInventory; + bool make_request = !mHaveInventory; // If the task id is different than what we've stored, // then make the request. @@ -1691,7 +1691,7 @@ void LLPanelObjectInventory::refresh() { mTaskUUID = object->mID; mAttachmentUUID = object->getAttachmentItemID(); - make_request = TRUE; + make_request = true; // This is a new object so pre-emptively clear the contents // Otherwise we show the old stuff until the update comes in @@ -1717,7 +1717,7 @@ void LLPanelObjectInventory::refresh() { if(node->mInventorySerial != object->getInventorySerial() || object->isInventoryDirty()) { - make_request = TRUE; + make_request = true; } } @@ -1726,7 +1726,7 @@ void LLPanelObjectInventory::refresh() { requestVOInventory(); } - has_inventory = TRUE; + has_inventory = true; } } if(!has_inventory) @@ -1795,14 +1795,14 @@ void LLPanelObjectInventory::deleteAllChildren() LLView::deleteAllChildren(); } -BOOL LLPanelObjectInventory::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg) +bool LLPanelObjectInventory::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg) { if (mFolders) { LLFolderViewItem* folderp = mFolders->getNextFromChild(NULL); if (!folderp) { - return FALSE; + return false; } // Try to pass on unmodified mouse coordinates S32 local_x = x - mFolders->getRect().mLeft; @@ -1820,7 +1820,7 @@ BOOL LLPanelObjectInventory::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL dro } else { - return FALSE; + return false; } } @@ -1886,9 +1886,9 @@ void LLPanelObjectInventory::clearItemIDs() mItemMap.clear(); } -BOOL LLPanelObjectInventory::handleKeyHere( KEY key, MASK mask ) +bool LLPanelObjectInventory::handleKeyHere( KEY key, MASK mask ) { - BOOL handled = FALSE; + bool handled = false; switch (key) { case KEY_DELETE: @@ -1900,23 +1900,23 @@ BOOL LLPanelObjectInventory::handleKeyHere( KEY key, MASK mask ) if (isSelectionRemovable() && mask == MASK_NONE) { LLInventoryAction::doToSelected(&gInventory, mFolders, "delete"); - handled = TRUE; + handled = true; } break; } return handled; } -BOOL LLPanelObjectInventory::isSelectionRemovable() +bool LLPanelObjectInventory::isSelectionRemovable() { if (!mFolders || !mFolders->getRoot()) { - return FALSE; + return false; } std::set<LLFolderViewItem*> selection_set = mFolders->getRoot()->getSelectionList(); if (selection_set.empty()) { - return FALSE; + return false; } for (std::set<LLFolderViewItem*>::iterator iter = selection_set.begin(); iter != selection_set.end(); @@ -1926,8 +1926,8 @@ BOOL LLPanelObjectInventory::isSelectionRemovable() const LLFolderViewModelItemInventory *listener = dynamic_cast<const LLFolderViewModelItemInventory*>(item->getViewModelItem()); if (!listener || !listener->isItemRemovable() || listener->isItemInTrash()) { - return FALSE; + return false; } } - return TRUE; + return true; } diff --git a/indra/newview/llpanelobjectinventory.h b/indra/newview/llpanelobjectinventory.h index cef1ca90e5..c150a841ae 100644 --- a/indra/newview/llpanelobjectinventory.h +++ b/indra/newview/llpanelobjectinventory.h @@ -60,7 +60,7 @@ public: LLPanelObjectInventory(const Params&); virtual ~LLPanelObjectInventory(); - virtual BOOL postBuild(); + virtual bool postBuild(); LLFolderViewModelInventory& getRootViewModel() { return mInventoryViewModel; } @@ -76,7 +76,7 @@ public: virtual void draw(); virtual void deleteAllChildren(); - virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg); + virtual bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg); /*virtual*/ void onFocusLost(); /*virtual*/ void onFocusReceived(); @@ -101,8 +101,8 @@ protected: void removeItemID(const LLUUID& id); void clearItemIDs(); - BOOL handleKeyHere( KEY key, MASK mask ); - BOOL isSelectionRemovable(); + bool handleKeyHere( KEY key, MASK mask ); + bool isSelectionRemovable(); private: std::map<LLUUID, LLFolderViewItem*> mItemMap; @@ -112,9 +112,9 @@ private: LLUUID mTaskUUID; LLUUID mAttachmentUUID; - BOOL mHaveInventory; // 'Loading' label and used for initial request - BOOL mIsInventoryEmpty; // 'Empty' label - BOOL mInventoryNeedsUpdate; // for idle, set on changed callback + bool mHaveInventory; // 'Loading' label and used for initial request + bool mIsInventoryEmpty; // 'Empty' label + bool mInventoryNeedsUpdate; // for idle, set on changed callback LLFolderViewModelInventory mInventoryViewModel; bool mShowRootFolder; }; diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index 1bfae630a0..ce545ae21d 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -187,8 +187,8 @@ private: // Populate the menu with items like "New Skin", "New Pants", etc. static void populateCreateWearableSubmenus(LLMenuGL* menu) { - LLView* menu_clothes = gMenuHolder->getChildView("COF.Gear.New_Clothes", FALSE); - LLView* menu_bp = gMenuHolder->getChildView("COF.Gear.New_Body_Parts", FALSE); + LLView* menu_clothes = gMenuHolder->getChildView("COF.Gear.New_Clothes", false); + LLView* menu_bp = gMenuHolder->getChildView("COF.Gear.New_Body_Parts", false); LLWearableType * wearable_type_inst = LLWearableType::getInstance(); for (U8 i = LLWearableType::WT_SHAPE; i != (U8) LLWearableType::WT_COUNT; ++i) @@ -407,7 +407,7 @@ LLPanelOutfitEdit::LLPanelOutfitEdit() mGearMenuBtn(NULL) { mSavedFolderState = new LLSaveFolderState(); - mSavedFolderState->setApply(FALSE); + mSavedFolderState->setApply(false); LLOutfitObserver& observer = LLOutfitObserver::instance(); @@ -440,7 +440,7 @@ LLPanelOutfitEdit::~LLPanelOutfitEdit() } } -BOOL LLPanelOutfitEdit::postBuild() +bool LLPanelOutfitEdit::postBuild() { // gInventory.isInventoryUsable() no longer needs to be tested per Richard's fix for race conditions between inventory and panels @@ -568,7 +568,7 @@ BOOL LLPanelOutfitEdit::postBuild() getChild<LLButton>(SAVE_AS_BTN)->setCommitCallback(boost::bind(&LLPanelOutfitEdit::saveOutfit, this, true)); onOutfitChanging(gAgentWearables.isCOFChangeInProgress()); - return TRUE; + return true; } // virtual @@ -595,7 +595,7 @@ void LLPanelOutfitEdit::moveWearable(bool closer_to_body) void LLPanelOutfitEdit::toggleAddWearablesPanel() { - BOOL current_visibility = mAddWearablesPanel->getVisible(); + bool current_visibility = mAddWearablesPanel->getVisible(); showAddWearablesPanel(!current_visibility); } @@ -655,7 +655,7 @@ void LLPanelOutfitEdit::showWearablesFilter() } else { - mSearchFilter->setFocus(TRUE); + mSearchFilter->setFocus(true); } } @@ -667,7 +667,7 @@ void LLPanelOutfitEdit::showWearablesListView() updateFiltersVisibility(); mWearableListManager->populateIfNeeded(); } - mListViewBtn->setToggleState(TRUE); + mListViewBtn->setToggleState(true); } void LLPanelOutfitEdit::showWearablesFolderView() @@ -677,7 +677,7 @@ void LLPanelOutfitEdit::showWearablesFolderView() updateWearablesPanelVerbButtons(); updateFiltersVisibility(); } - mFolderViewBtn->setToggleState(TRUE); + mFolderViewBtn->setToggleState(true); } void LLPanelOutfitEdit::updateFiltersVisibility() @@ -693,7 +693,7 @@ void LLPanelOutfitEdit::onFolderViewFilterCommitted(LLUICtrl* ctrl) mInventoryItemsPanel->setFilterTypes(mFolderViewItemTypes[curr_filter_type].inventoryMask); - mSavedFolderState->setApply(TRUE); + mSavedFolderState->setApply(true); mInventoryItemsPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState); LLOpenFoldersWithSelection opener; @@ -735,7 +735,7 @@ void LLPanelOutfitEdit::onSearchEdit(const std::string& string) mInventoryItemsPanel->setFilterSubString(LLStringUtil::null); mWearableItemsList->setFilterSubString(LLStringUtil::null, true); // re-open folders that were initially open - mSavedFolderState->setApply(TRUE); + mSavedFolderState->setApply(true); mInventoryItemsPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState); LLOpenFoldersWithSelection opener; mInventoryItemsPanel->getRootFolder()->applyFunctorRecursively(opener); @@ -757,7 +757,7 @@ void LLPanelOutfitEdit::onSearchEdit(const std::string& string) // save current folder open state if no filter currently applied if (mInventoryItemsPanel->getFilterSubString().empty()) { - mSavedFolderState->setApply(FALSE); + mSavedFolderState->setApply(false); mInventoryItemsPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState); } @@ -997,10 +997,10 @@ void LLPanelOutfitEdit::updatePlusButton() current_item->getLocalRect().mBottom); mAddToLookBtn->setRect(btn_rect); - mAddToLookBtn->setEnabled(TRUE); + mAddToLookBtn->setEnabled(true); if (!mAddToLookBtn->getVisible()) { - mAddToLookBtn->setVisible(TRUE); + mAddToLookBtn->setVisible(true); } current_item->addChild(mAddToLookBtn); */ @@ -1167,7 +1167,7 @@ void LLPanelOutfitEdit::update() updateVerbs(); } -BOOL LLPanelOutfitEdit::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +bool LLPanelOutfitEdit::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -1176,7 +1176,7 @@ BOOL LLPanelOutfitEdit::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, if (cargo_data == NULL) { LL_WARNS() << "cargo_data is NULL" << LL_ENDL; - return TRUE; + return true; } switch (cargo_type) @@ -1214,14 +1214,14 @@ BOOL LLPanelOutfitEdit::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, } } - return TRUE; + return true; } void LLPanelOutfitEdit::displayCurrentOutfit() { if (!getVisible()) { - setVisible(TRUE); + setVisible(true); } updateCurrentOutfitName(); @@ -1264,8 +1264,8 @@ bool LLPanelOutfitEdit::switchPanels(LLPanel* switch_from_panel, LLPanel* switch { if(switch_from_panel && switch_to_panel && !switch_to_panel->getVisible()) { - switch_from_panel->setVisible(FALSE); - switch_to_panel->setVisible(TRUE); + switch_from_panel->setVisible(false); + switch_to_panel->setVisible(true); return true; } return false; @@ -1383,13 +1383,13 @@ void LLPanelOutfitEdit::updateWearablesPanelVerbButtons() { if(mWearablesListViewPanel->getVisible()) { - mFolderViewBtn->setToggleState(FALSE); + mFolderViewBtn->setToggleState(false); mFolderViewBtn->setImageOverlay(getString("folder_view_off"), mFolderViewBtn->getImageOverlayHAlign()); mListViewBtn->setImageOverlay(getString("list_view_on"), mListViewBtn->getImageOverlayHAlign()); } else if(mInventoryItemsPanel->getVisible()) { - mListViewBtn->setToggleState(FALSE); + mListViewBtn->setToggleState(false); mListViewBtn->setImageOverlay(getString("list_view_off"), mListViewBtn->getImageOverlayHAlign()); mFolderViewBtn->setImageOverlay(getString("folder_view_on"), mFolderViewBtn->getImageOverlayHAlign()); } @@ -1429,9 +1429,9 @@ void LLPanelOutfitEdit::saveListSelection() LLFolderViewFolder* parent = item->getParentFolder(); if(parent) { - parent->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP); + parent->setOpenArrangeRecursively(true, LLFolderViewFolder::RECURSE_UP); } - mInventoryItemsPanel->getRootFolder()->changeSelection(item, TRUE); + mInventoryItemsPanel->getRootFolder()->changeSelection(item, true); } mInventoryItemsPanel->getRootFolder()->scrollToShowSelection(); } diff --git a/indra/newview/llpaneloutfitedit.h b/indra/newview/llpaneloutfitedit.h index ba1b69a5d7..384b7faee4 100644 --- a/indra/newview/llpaneloutfitedit.h +++ b/indra/newview/llpaneloutfitedit.h @@ -124,7 +124,7 @@ public: LLPanelOutfitEdit(); /*virtual*/ ~LLPanelOutfitEdit(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void onOpen(const LLSD& key); void moveWearable(bool closer_to_body); @@ -181,7 +181,7 @@ public: void resetAccordionState(); - virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + virtual bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp index edeeb93560..5b595a48b7 100644 --- a/indra/newview/llpaneloutfitsinventory.cpp +++ b/indra/newview/llpaneloutfitsinventory.cpp @@ -78,7 +78,7 @@ LLPanelOutfitsInventory::~LLPanelOutfitsInventory() } // virtual -BOOL LLPanelOutfitsInventory::postBuild() +bool LLPanelOutfitsInventory::postBuild() { initTabPanels(); initListCommandsHandlers(); @@ -96,7 +96,7 @@ BOOL LLPanelOutfitsInventory::postBuild() getChild<LLButton>(SAVE_BTN)->setCommitCallback(boost::bind(&LLPanelOutfitsInventory::saveOutfit, this, false)); getChild<LLButton>(SAVE_AS_BTN)->setCommitCallback(boost::bind(&LLPanelOutfitsInventory::saveOutfit, this, true)); - return TRUE; + return true; } // virtual @@ -137,7 +137,7 @@ void LLPanelOutfitsInventory::onOpen(const LLSD& key) LLFolderViewFolder* first_outfit = dynamic_cast<LLFolderViewFolder*>(my_outfits_folder->getFirstChild()); if (first_outfit) { - first_outfit->setOpen(TRUE); + first_outfit->setOpen(true); } } } diff --git a/indra/newview/llpaneloutfitsinventory.h b/indra/newview/llpaneloutfitsinventory.h index c858803ede..0c501d5c71 100644 --- a/indra/newview/llpaneloutfitsinventory.h +++ b/indra/newview/llpaneloutfitsinventory.h @@ -46,7 +46,7 @@ public: LLPanelOutfitsInventory(); virtual ~LLPanelOutfitsInventory(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void onOpen(const LLSD& key); void onSearchEdit(const std::string& string); diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index bdf47976d8..28303f3c0d 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -313,9 +313,9 @@ public: mEventTimer.stop(); } - virtual BOOL tick() // from LLEventTimer + virtual bool tick() // from LLEventTimer { - return FALSE; + return false; } }; @@ -367,9 +367,9 @@ public: } - /*virtual*/ BOOL tick() + /*virtual*/ bool tick() { - if (!mIsActive) return FALSE; + if (!mIsActive) return false; if (mMask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE | LLFriendObserver::ONLINE)) { @@ -380,7 +380,7 @@ public: mEventTimer.stop(); mMask = 0; - return FALSE; + return false; } // virtual @@ -508,10 +508,10 @@ public: } } - /*virtual*/ BOOL tick() + /*virtual*/ bool tick() { update(); - return FALSE; + return false; } private: }; @@ -577,6 +577,11 @@ LLPanelPeople::~LLPanelPeople() delete mFriendListUpdater; delete mRecentListUpdater; + mNearbyFilterCommitConnection.disconnect(); + mFriedsFilterCommitConnection.disconnect(); + mGroupsFilterCommitConnection.disconnect(); + mRecentFilterCommitConnection.disconnect(); + if(LLVoiceClient::instanceExists()) { LLVoiceClient::getInstance()->removeObserver(this); @@ -609,14 +614,14 @@ void LLPanelPeople::removePicker() } } -BOOL LLPanelPeople::postBuild() +bool LLPanelPeople::postBuild() { S32 max_premium = LLAgentBenefitsMgr::get("Premium").getGroupMembershipLimit(); - getChild<LLFilterEditor>("nearby_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); - getChild<LLFilterEditor>("friends_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); - getChild<LLFilterEditor>("groups_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); - getChild<LLFilterEditor>("recent_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); + mNearbyFilterCommitConnection = getChild<LLFilterEditor>("nearby_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); + mFriedsFilterCommitConnection = getChild<LLFilterEditor>("friends_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); + mGroupsFilterCommitConnection = getChild<LLFilterEditor>("groups_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); + mRecentFilterCommitConnection = getChild<LLFilterEditor>("recent_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); if(LLAgentBenefitsMgr::current().getGroupMembershipLimit() < max_premium) { @@ -729,7 +734,7 @@ BOOL LLPanelPeople::postBuild() mOnlineFriendList->setRefreshCompleteCallback(boost::bind(&LLPanelPeople::onFriendListRefreshComplete, this, _1, _2)); mAllFriendList->setRefreshCompleteCallback(boost::bind(&LLPanelPeople::onFriendListRefreshComplete, this, _1, _2)); - return TRUE; + return true; } // virtual @@ -831,7 +836,7 @@ void LLPanelPeople::updateNearbyList() mNearbyList->setDirty(); DISTANCE_COMPARATOR.updateAvatarsPositions(positions, mNearbyList->getIDs()); - LLActiveSpeakerMgr::instance().update(TRUE); + LLActiveSpeakerMgr::instance().update(true); } void LLPanelPeople::updateRecentList() @@ -866,8 +871,8 @@ void LLPanelPeople::updateButtons() LLPanel* groups_panel = mTabContainer->getCurrentPanel(); groups_panel->getChildView("minus_btn")->setEnabled(item_selected && selected_id.notNull()); // a real group selected - U32 groups_count = gAgent.mGroups.size(); - S32 max_groups = LLAgentBenefitsMgr::current().getGroupMembershipLimit(); + U32 groups_count = static_cast<U32>(gAgent.mGroups.size()); + U32 max_groups = LLAgentBenefitsMgr::current().getGroupMembershipLimit(); U32 groups_remaining = max_groups > groups_count ? max_groups - groups_count : 0; groups_panel->getChild<LLUICtrl>("groupcount")->setTextArg("[COUNT]", llformat("%d", groups_count)); groups_panel->getChild<LLUICtrl>("groupcount")->setTextArg("[REMAINING]", llformat("%d", groups_remaining)); @@ -887,7 +892,7 @@ void LLPanelPeople::updateButtons() LLPanel* cur_panel = mTabContainer->getCurrentPanel(); if (cur_panel) { - if (cur_panel->hasChild("add_friend_btn", TRUE)) + if (cur_panel->hasChild("add_friend_btn", true)) cur_panel->getChildView("add_friend_btn")->setEnabled(item_selected && !is_friend && !is_self); if (friends_tab_active) @@ -961,25 +966,6 @@ void LLPanelPeople::getCurrentItemIDs(uuid_vec_t& selected_uuids) const } -void LLPanelPeople::showGroupMenu(LLMenuGL* menu) -{ - // Shows the menu at the top of the button bar. - - // Calculate its coordinates. - // (assumes that groups panel is the current tab) - LLPanel* bottom_panel = mTabContainer->getCurrentPanel()->getChild<LLPanel>("bottom_panel"); - LLPanel* parent_panel = mTabContainer->getCurrentPanel(); - menu->arrangeAndClear(); - S32 menu_height = menu->getRect().getHeight(); - S32 menu_x = -2; // *HACK: compensates HPAD in showPopup() - S32 menu_y = bottom_panel->getRect().mTop + menu_height; - - // Actually show the menu. - menu->buildDrawLabels(); - menu->updateParent(LLMenuGL::sMenuContainer); - LLMenuGL::showPopup(parent_panel, menu, menu_x, menu_y); -} - void LLPanelPeople::setSortOrder(LLAvatarList* list, ESortOrder order, bool save) { switch (order) @@ -1184,11 +1170,11 @@ bool LLPanelPeople::isItemsFreeOfFriends(const uuid_vec_t& uuids) void LLPanelPeople::onAddFriendWizButtonClicked() { LLPanel* cur_panel = mTabContainer->getCurrentPanel(); - LLView * button = cur_panel->findChild<LLButton>("friends_add_btn", TRUE); + LLView * button = cur_panel->findChild<LLButton>("friends_add_btn", true); // Show add friend wizard. LLFloater* root_floater = gFloaterView->getParentFloater(this); - LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelPeople::onAvatarPicked, _1, _2), FALSE, TRUE, FALSE, root_floater->getName(), button); + LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelPeople::onAvatarPicked, _1, _2), false, true, false, root_floater->getName(), button); if (!picker) { return; diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h index a00700700c..768ba1ef49 100644 --- a/indra/newview/llpanelpeople.h +++ b/indra/newview/llpanelpeople.h @@ -50,12 +50,12 @@ public: LLPanelPeople(); virtual ~LLPanelPeople(); - /*virtual*/ BOOL postBuild(); - /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ bool notifyChildren(const LLSD& info); + bool postBuild() override; + void onOpen(const LLSD& key) override; + bool notifyChildren(const LLSD& info) override; // Implements LLVoiceClientStatusObserver::onChange() to enable call buttons // when voice is available - /*virtual*/ void onChange(EStatusType status, const LLSD& channelInfo, bool proximal); + void onChange(EStatusType status, const LLSD& channelInfo, bool proximal) override; // internals class Updater; @@ -87,7 +87,6 @@ private: std::string getActiveTabName() const; LLUUID getCurrentItemID() const; void getCurrentItemIDs(uuid_vec_t& selected_uuids) const; - void showGroupMenu(LLMenuGL* menu); void setSortOrder(LLAvatarList* list, ESortOrder order, bool save = true); // UI callbacks @@ -148,6 +147,11 @@ private: Updater* mRecentListUpdater; Updater* mButtonsUpdater; LLHandle< LLFloater > mPicker; + + boost::signals2::connection mNearbyFilterCommitConnection; + boost::signals2::connection mFriedsFilterCommitConnection; + boost::signals2::connection mGroupsFilterCommitConnection; + boost::signals2::connection mRecentFilterCommitConnection; }; #endif //LL_LLPANELPEOPLE_H diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 90cfcc6d8a..2a27a6e143 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -151,10 +151,10 @@ std::string click_action_to_string_value( U8 action) LLPanelPermissions::LLPanelPermissions() : LLPanel() { - setMouseOpaque(FALSE); + setMouseOpaque(false); } -BOOL LLPanelPermissions::postBuild() +bool LLPanelPermissions::postBuild() { childSetCommitCallback("Object Name",LLPanelPermissions::onCommitName,this); getChild<LLLineEditor>("Object Name")->setPrevalidate(LLTextValidate::validateASCIIPrintableNoPipe); @@ -188,7 +188,7 @@ BOOL LLPanelPermissions::postBuild() mLabelOwnerName = getChild<LLTextBox>("Owner Name"); mLabelCreatorName = getChild<LLTextBox>("Creator Name"); - return TRUE; + return true; } @@ -208,85 +208,85 @@ LLPanelPermissions::~LLPanelPermissions() void LLPanelPermissions::disableAll() { - getChildView("perm_modify")->setEnabled(FALSE); + getChildView("perm_modify")->setEnabled(false); getChild<LLUICtrl>("perm_modify")->setValue(LLStringUtil::null); - getChildView("pathfinding_attributes_value")->setEnabled(FALSE); + getChildView("pathfinding_attributes_value")->setEnabled(false); getChild<LLUICtrl>("pathfinding_attributes_value")->setValue(LLStringUtil::null); - getChildView("Creator:")->setEnabled(FALSE); - getChild<LLUICtrl>("Creator Icon")->setVisible(FALSE); + getChildView("Creator:")->setEnabled(false); + getChild<LLUICtrl>("Creator Icon")->setVisible(false); mLabelCreatorName->setValue(LLStringUtil::null); - mLabelCreatorName->setEnabled(FALSE); + mLabelCreatorName->setEnabled(false); - getChildView("Owner:")->setEnabled(FALSE); - getChild<LLUICtrl>("Owner Icon")->setVisible(FALSE); - getChild<LLUICtrl>("Owner Group Icon")->setVisible(FALSE); + getChildView("Owner:")->setEnabled(false); + getChild<LLUICtrl>("Owner Icon")->setVisible(false); + getChild<LLUICtrl>("Owner Group Icon")->setVisible(false); mLabelOwnerName->setValue(LLStringUtil::null); - mLabelOwnerName->setEnabled(FALSE); + mLabelOwnerName->setEnabled(false); - getChildView("Group:")->setEnabled(FALSE); + getChildView("Group:")->setEnabled(false); getChild<LLUICtrl>("Group Name Proxy")->setValue(LLStringUtil::null); - getChildView("Group Name Proxy")->setEnabled(FALSE); - getChildView("button set group")->setEnabled(FALSE); + getChildView("Group Name Proxy")->setEnabled(false); + getChildView("button set group")->setEnabled(false); getChild<LLUICtrl>("Object Name")->setValue(LLStringUtil::null); - getChildView("Object Name")->setEnabled(FALSE); - getChildView("Name:")->setEnabled(FALSE); + getChildView("Object Name")->setEnabled(false); + getChildView("Name:")->setEnabled(false); getChild<LLUICtrl>("Group Name")->setValue(LLStringUtil::null); - getChildView("Group Name")->setEnabled(FALSE); - getChildView("Description:")->setEnabled(FALSE); + getChildView("Group Name")->setEnabled(false); + getChildView("Description:")->setEnabled(false); getChild<LLUICtrl>("Object Description")->setValue(LLStringUtil::null); - getChildView("Object Description")->setEnabled(FALSE); + getChildView("Object Description")->setEnabled(false); - getChild<LLUICtrl>("checkbox share with group")->setValue(FALSE); - getChildView("checkbox share with group")->setEnabled(FALSE); - getChildView("button deed")->setEnabled(FALSE); + getChild<LLUICtrl>("checkbox share with group")->setValue(false); + getChildView("checkbox share with group")->setEnabled(false); + getChildView("button deed")->setEnabled(false); - getChild<LLUICtrl>("checkbox allow everyone move")->setValue(FALSE); - getChildView("checkbox allow everyone move")->setEnabled(FALSE); - getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(FALSE); - getChildView("checkbox allow everyone copy")->setEnabled(FALSE); + getChild<LLUICtrl>("checkbox allow everyone move")->setValue(false); + getChildView("checkbox allow everyone move")->setEnabled(false); + getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(false); + getChildView("checkbox allow everyone copy")->setEnabled(false); //Next owner can: - getChildView("Next owner can:")->setEnabled(FALSE); - getChild<LLUICtrl>("checkbox next owner can modify")->setValue(FALSE); - getChildView("checkbox next owner can modify")->setEnabled(FALSE); - getChild<LLUICtrl>("checkbox next owner can copy")->setValue(FALSE); - getChildView("checkbox next owner can copy")->setEnabled(FALSE); - getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(FALSE); - getChildView("checkbox next owner can transfer")->setEnabled(FALSE); + getChildView("Next owner can:")->setEnabled(false); + getChild<LLUICtrl>("checkbox next owner can modify")->setValue(false); + getChildView("checkbox next owner can modify")->setEnabled(false); + getChild<LLUICtrl>("checkbox next owner can copy")->setValue(false); + getChildView("checkbox next owner can copy")->setEnabled(false); + getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(false); + getChildView("checkbox next owner can transfer")->setEnabled(false); //checkbox for sale - getChild<LLUICtrl>("checkbox for sale")->setValue(FALSE); - getChildView("checkbox for sale")->setEnabled(FALSE); + getChild<LLUICtrl>("checkbox for sale")->setValue(false); + getChildView("checkbox for sale")->setEnabled(false); //checkbox include in search - getChild<LLUICtrl>("search_check")->setValue(FALSE); - getChildView("search_check")->setEnabled(FALSE); + getChild<LLUICtrl>("search_check")->setValue(false); + getChildView("search_check")->setEnabled(false); LLComboBox* combo_sale_type = getChild<LLComboBox>("sale type"); combo_sale_type->setValue(LLSaleInfo::FS_COPY); - combo_sale_type->setEnabled(FALSE); + combo_sale_type->setEnabled(false); - getChildView("Cost")->setEnabled(FALSE); + getChildView("Cost")->setEnabled(false); getChild<LLUICtrl>("Cost")->setValue(getString("Cost Default")); getChild<LLUICtrl>("Edit Cost")->setValue(LLStringUtil::null); - getChildView("Edit Cost")->setEnabled(FALSE); + getChildView("Edit Cost")->setEnabled(false); - getChildView("label click action")->setEnabled(FALSE); + getChildView("label click action")->setEnabled(false); LLComboBox* combo_click_action = getChild<LLComboBox>("clickaction"); if (combo_click_action) { - combo_click_action->setEnabled(FALSE); + combo_click_action->setEnabled(false); combo_click_action->clear(); } - getChildView("B:")->setVisible(FALSE); - getChildView("O:")->setVisible(FALSE); - getChildView("G:")->setVisible(FALSE); - getChildView("E:")->setVisible(FALSE); - getChildView("N:")->setVisible(FALSE); - getChildView("F:")->setVisible(FALSE); + getChildView("B:")->setVisible(false); + getChildView("O:")->setVisible(false); + getChildView("G:")->setVisible(false); + getChildView("E:")->setVisible(false); + getChildView("N:")->setVisible(false); + getChildView("F:")->setVisible(false); } void LLPanelPermissions::refresh() @@ -306,17 +306,17 @@ void LLPanelPermissions::refresh() BtnDeedToGroup->setLabelSelected(deedText); BtnDeedToGroup->setLabelUnselected(deedText); } - BOOL root_selected = TRUE; + bool root_selected = true; LLSelectNode* nodep = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); S32 object_count = LLSelectMgr::getInstance()->getSelection()->getRootObjectCount(); if(!nodep || 0 == object_count) { nodep = LLSelectMgr::getInstance()->getSelection()->getFirstNode(); object_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); - root_selected = FALSE; + root_selected = false; } - //BOOL attachment_selected = LLSelectMgr::getInstance()->getSelection()->isAttachment(); + //bool attachment_selected = LLSelectMgr::getInstance()->getSelection()->isAttachment(); //attachment_selected = false; LLViewerObject* objectp = NULL; if(nodep) objectp = nodep->getObject(); @@ -328,13 +328,13 @@ void LLPanelPermissions::refresh() } // figure out a few variables - const BOOL is_one_object = (object_count == 1); + const bool is_one_object = (object_count == 1); // BUG: fails if a root and non-root are both single-selected. - BOOL is_perm_modify = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() + bool is_perm_modify = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsModify()) || LLSelectMgr::getInstance()->selectGetModify(); - BOOL is_nonpermanent_enforced = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() + bool is_nonpermanent_enforced = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsNonPermanentEnforced()) || LLSelectMgr::getInstance()->selectGetNonPermanentEnforced(); const LLFocusableElement* keyboard_focus_view = gFocusMgr.getKeyboardFocus(); @@ -361,7 +361,7 @@ void LLPanelPermissions::refresh() { ++string_index; } - getChildView("perm_modify")->setEnabled(TRUE); + getChildView("perm_modify")->setEnabled(true); getChild<LLUICtrl>("perm_modify")->setValue(MODIFY_INFO_STRINGS[string_index]); std::string pfAttrName; @@ -389,11 +389,11 @@ void LLPanelPermissions::refresh() pfAttrName = "Pathfinding_Object_Attr_MultiSelect"; } - getChildView("pathfinding_attributes_value")->setEnabled(TRUE); + getChildView("pathfinding_attributes_value")->setEnabled(true); getChild<LLUICtrl>("pathfinding_attributes_value")->setValue(LLTrans::getString(pfAttrName)); // Update creator text field - getChildView("Creator:")->setEnabled(TRUE); + getChildView("Creator:")->setEnabled(true); std::string creator_app_link; LLSelectMgr::getInstance()->selectGetCreator(mCreatorID, creator_app_link); @@ -424,14 +424,14 @@ void LLPanelPermissions::refresh() mCreatorCacheConnection = LLAvatarNameCache::get(mCreatorID, boost::bind(&LLPanelPermissions::updateCreatorName, this, _1, _2, style_params)); } getChild<LLAvatarIconCtrl>("Creator Icon")->setValue(mCreatorID); - getChild<LLAvatarIconCtrl>("Creator Icon")->setVisible(TRUE); - mLabelCreatorName->setEnabled(TRUE); + getChild<LLAvatarIconCtrl>("Creator Icon")->setVisible(true); + mLabelCreatorName->setEnabled(true); // Update owner text field - getChildView("Owner:")->setEnabled(TRUE); + getChildView("Owner:")->setEnabled(true); std::string owner_app_link; - const BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(mOwnerID, owner_app_link); + const bool owners_identical = LLSelectMgr::getInstance()->selectGetOwner(mOwnerID, owner_app_link); if (LLSelectMgr::getInstance()->selectIsGroupOwned()) @@ -443,8 +443,8 @@ void LLPanelPermissions::refresh() style_params.link_href = owner_app_link; mLabelOwnerName->setText(group_data->mName, style_params); getChild<LLGroupIconCtrl>("Owner Group Icon")->setIconId(group_data->mInsigniaID); - getChild<LLGroupIconCtrl>("Owner Group Icon")->setVisible(TRUE); - getChild<LLUICtrl>("Owner Icon")->setVisible(FALSE); + getChild<LLGroupIconCtrl>("Owner Group Icon")->setVisible(true); + getChild<LLUICtrl>("Owner Icon")->setVisible(false); } else { @@ -487,39 +487,39 @@ void LLPanelPermissions::refresh() } getChild<LLAvatarIconCtrl>("Owner Icon")->setValue(owner_id); - getChild<LLAvatarIconCtrl>("Owner Icon")->setVisible(TRUE); - getChild<LLUICtrl>("Owner Group Icon")->setVisible(FALSE); + getChild<LLAvatarIconCtrl>("Owner Icon")->setVisible(true); + getChild<LLUICtrl>("Owner Group Icon")->setVisible(false); } - mLabelOwnerName->setEnabled(TRUE); + mLabelOwnerName->setEnabled(true); // update group text field - getChildView("Group:")->setEnabled(TRUE); + getChildView("Group:")->setEnabled(true); getChild<LLUICtrl>("Group Name")->setValue(LLStringUtil::null); LLUUID group_id; - BOOL groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id); + bool groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id); if (groups_identical) { if (mLabelGroupName) { - mLabelGroupName->setNameID(group_id,TRUE); - mLabelGroupName->setEnabled(TRUE); + mLabelGroupName->setNameID(group_id,true); + mLabelGroupName->setEnabled(true); } } else { if (mLabelGroupName) { - mLabelGroupName->setNameID(LLUUID::null, TRUE); + mLabelGroupName->setNameID(LLUUID::null, true); mLabelGroupName->refresh(LLUUID::null, std::string(), true); - mLabelGroupName->setEnabled(FALSE); + mLabelGroupName->setEnabled(false); } } getChildView("button set group")->setEnabled(root_selected && owners_identical && (mOwnerID == gAgent.getID()) && is_nonpermanent_enforced); - getChildView("Name:")->setEnabled(TRUE); + getChildView("Name:")->setEnabled(true); LLLineEditor* LineEditorObjectName = getChild<LLLineEditor>("Object Name"); - getChildView("Description:")->setEnabled(TRUE); + getChildView("Description:")->setEnabled(true); LLLineEditor* LineEditorObjectDesc = getChild<LLLineEditor>("Object Description"); if (is_one_object) @@ -544,44 +544,44 @@ void LLPanelPermissions::refresh() } // figure out the contents of the name, description, & category - BOOL edit_name_desc = FALSE; + bool edit_name_desc = false; if (is_one_object && objectp->permModify() && !objectp->isPermanentEnforced()) { - edit_name_desc = TRUE; + edit_name_desc = true; } if (edit_name_desc) { - getChildView("Object Name")->setEnabled(TRUE); - getChildView("Object Description")->setEnabled(TRUE); + getChildView("Object Name")->setEnabled(true); + getChildView("Object Description")->setEnabled(true); } else { - getChildView("Object Name")->setEnabled(FALSE); - getChildView("Object Description")->setEnabled(FALSE); + getChildView("Object Name")->setEnabled(false); + getChildView("Object Description")->setEnabled(false); } S32 total_sale_price = 0; S32 individual_sale_price = 0; - BOOL is_for_sale_mixed = FALSE; - BOOL is_sale_price_mixed = FALSE; - U32 num_for_sale = FALSE; + bool is_for_sale_mixed = false; + bool is_sale_price_mixed = false; + U32 num_for_sale = false; LLSelectMgr::getInstance()->selectGetAggregateSaleInfo(num_for_sale, is_for_sale_mixed, is_sale_price_mixed, total_sale_price, individual_sale_price); - const BOOL self_owned = (gAgent.getID() == mOwnerID); - const BOOL group_owned = LLSelectMgr::getInstance()->selectIsGroupOwned() ; - const BOOL public_owned = (mOwnerID.isNull() && !LLSelectMgr::getInstance()->selectIsGroupOwned()); - const BOOL can_transfer = LLSelectMgr::getInstance()->selectGetRootsTransfer(); - const BOOL can_copy = LLSelectMgr::getInstance()->selectGetRootsCopy(); + const bool self_owned = (gAgent.getID() == mOwnerID); + const bool group_owned = LLSelectMgr::getInstance()->selectIsGroupOwned() ; + const bool public_owned = (mOwnerID.isNull() && !LLSelectMgr::getInstance()->selectIsGroupOwned()); + const bool can_transfer = LLSelectMgr::getInstance()->selectGetRootsTransfer(); + const bool can_copy = LLSelectMgr::getInstance()->selectGetRootsCopy(); if (!owners_identical) { - getChildView("Cost")->setEnabled(FALSE); + getChildView("Cost")->setEnabled(false); getChild<LLUICtrl>("Edit Cost")->setValue(LLStringUtil::null); - getChildView("Edit Cost")->setEnabled(FALSE); + getChildView("Edit Cost")->setEnabled(false); } // You own these objects. else if (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id,GP_OBJECT_SET_SALE))) @@ -603,11 +603,11 @@ void LLPanelPermissions::refresh() // set to the actual cost. if ((num_for_sale > 0) && is_for_sale_mixed) { - edit_price->setTentative(TRUE); + edit_price->setTentative(true); } else if ((num_for_sale > 0) && is_sale_price_mixed) { - edit_price->setTentative(TRUE); + edit_price->setTentative(true); } else { @@ -616,15 +616,15 @@ void LLPanelPermissions::refresh() } // The edit fields are only enabled if you can sell this object // and the sale price is not mixed. - BOOL enable_edit = (num_for_sale && can_transfer) ? !is_for_sale_mixed : FALSE; + bool enable_edit = (num_for_sale && can_transfer) ? !is_for_sale_mixed : false; getChildView("Cost")->setEnabled(enable_edit); getChildView("Edit Cost")->setEnabled(enable_edit); } // Someone, not you, owns these objects. else if (!public_owned) { - getChildView("Cost")->setEnabled(FALSE); - getChildView("Edit Cost")->setEnabled(FALSE); + getChildView("Cost")->setEnabled(false); + getChildView("Edit Cost")->setEnabled(false); // Don't show a price if none of the items are for sale. if (num_for_sale) @@ -641,11 +641,11 @@ void LLPanelPermissions::refresh() // This is a public object. else { - getChildView("Cost")->setEnabled(FALSE); + getChildView("Cost")->setEnabled(false); getChild<LLUICtrl>("Cost")->setValue(getString("Cost Default")); getChild<LLUICtrl>("Edit Cost")->setValue(LLStringUtil::null); - getChildView("Edit Cost")->setEnabled(FALSE); + getChildView("Edit Cost")->setEnabled(false); } // Enable and disable the permissions checkboxes @@ -663,22 +663,22 @@ void LLPanelPermissions::refresh() U32 next_owner_mask_on = 0; U32 next_owner_mask_off = 0; - BOOL valid_base_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_BASE, + bool valid_base_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_BASE, &base_mask_on, &base_mask_off); - //BOOL valid_owner_perms =// + //bool valid_owner_perms =// LLSelectMgr::getInstance()->selectGetPerm(PERM_OWNER, &owner_mask_on, &owner_mask_off); - BOOL valid_group_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_GROUP, + bool valid_group_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_GROUP, &group_mask_on, &group_mask_off); - BOOL valid_everyone_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_EVERYONE, + bool valid_everyone_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_EVERYONE, &everyone_mask_on, &everyone_mask_off); - BOOL valid_next_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_NEXT_OWNER, + bool valid_next_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_NEXT_OWNER, &next_owner_mask_on, &next_owner_mask_off); @@ -688,15 +688,15 @@ void LLPanelPermissions::refresh() if (valid_base_perms) { getChild<LLUICtrl>("B:")->setValue("B: " + mask_to_string(base_mask_on)); - getChildView("B:")->setVisible(TRUE); + getChildView("B:")->setVisible(true); getChild<LLUICtrl>("O:")->setValue("O: " + mask_to_string(owner_mask_on)); - getChildView("O:")->setVisible(TRUE); + getChildView("O:")->setVisible(true); getChild<LLUICtrl>("G:")->setValue("G: " + mask_to_string(group_mask_on)); - getChildView("G:")->setVisible(TRUE); + getChildView("G:")->setVisible(true); getChild<LLUICtrl>("E:")->setValue("E: " + mask_to_string(everyone_mask_on)); - getChildView("E:")->setVisible(TRUE); + getChildView("E:")->setVisible(true); getChild<LLUICtrl>("N:")->setValue("N: " + mask_to_string(next_owner_mask_on)); - getChildView("N:")->setVisible(TRUE); + getChildView("N:")->setVisible(true); } else if(!root_selected) { @@ -706,25 +706,25 @@ void LLPanelPermissions::refresh() if (node && node->mValid) { getChild<LLUICtrl>("B:")->setValue("B: " + mask_to_string( node->mPermissions->getMaskBase())); - getChildView("B:")->setVisible(TRUE); + getChildView("B:")->setVisible(true); getChild<LLUICtrl>("O:")->setValue("O: " + mask_to_string(node->mPermissions->getMaskOwner())); - getChildView("O:")->setVisible(TRUE); + getChildView("O:")->setVisible(true); getChild<LLUICtrl>("G:")->setValue("G: " + mask_to_string(node->mPermissions->getMaskGroup())); - getChildView("G:")->setVisible(TRUE); + getChildView("G:")->setVisible(true); getChild<LLUICtrl>("E:")->setValue("E: " + mask_to_string(node->mPermissions->getMaskEveryone())); - getChildView("E:")->setVisible(TRUE); + getChildView("E:")->setVisible(true); getChild<LLUICtrl>("N:")->setValue("N: " + mask_to_string(node->mPermissions->getMaskNextOwner())); - getChildView("N:")->setVisible(TRUE); + getChildView("N:")->setVisible(true); } } } else { - getChildView("B:")->setVisible(FALSE); - getChildView("O:")->setVisible(FALSE); - getChildView("G:")->setVisible(FALSE); - getChildView("E:")->setVisible(FALSE); - getChildView("N:")->setVisible(FALSE); + getChildView("B:")->setVisible(false); + getChildView("O:")->setVisible(false); + getChildView("G:")->setVisible(false); + getChildView("E:")->setVisible(false); + getChildView("N:")->setVisible(false); } U32 flag_mask = 0x0; @@ -734,30 +734,30 @@ void LLPanelPermissions::refresh() if (objectp->permTransfer()) flag_mask |= PERM_TRANSFER; getChild<LLUICtrl>("F:")->setValue("F:" + mask_to_string(flag_mask)); - getChildView("F:")->setVisible( TRUE); + getChildView("F:")->setVisible( true); } else { - getChildView("B:")->setVisible( FALSE); - getChildView("O:")->setVisible( FALSE); - getChildView("G:")->setVisible( FALSE); - getChildView("E:")->setVisible( FALSE); - getChildView("N:")->setVisible( FALSE); - getChildView("F:")->setVisible( FALSE); + getChildView("B:")->setVisible( false); + getChildView("O:")->setVisible( false); + getChildView("G:")->setVisible( false); + getChildView("E:")->setVisible( false); + getChildView("N:")->setVisible( false); + getChildView("F:")->setVisible( false); } - BOOL has_change_perm_ability = FALSE; - BOOL has_change_sale_ability = FALSE; + bool has_change_perm_ability = false; + bool has_change_sale_ability = false; if (valid_base_perms && is_nonpermanent_enforced && (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_MANIPULATE)))) { - has_change_perm_ability = TRUE; + has_change_perm_ability = true; } if (valid_base_perms && is_nonpermanent_enforced && (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_SET_SALE)))) { - has_change_sale_ability = TRUE; + has_change_sale_ability = true; } if (!has_change_perm_ability && !has_change_sale_ability && !root_selected) @@ -768,15 +768,15 @@ void LLPanelPermissions::refresh() if (has_change_perm_ability) { - getChildView("checkbox share with group")->setEnabled(TRUE); + getChildView("checkbox share with group")->setEnabled(true); getChildView("checkbox allow everyone move")->setEnabled(owner_mask_on & PERM_MOVE); getChildView("checkbox allow everyone copy")->setEnabled(owner_mask_on & PERM_COPY && owner_mask_on & PERM_TRANSFER); } else { - getChildView("checkbox share with group")->setEnabled(FALSE); - getChildView("checkbox allow everyone move")->setEnabled(FALSE); - getChildView("checkbox allow everyone copy")->setEnabled(FALSE); + getChildView("checkbox share with group")->setEnabled(false); + getChildView("checkbox allow everyone move")->setEnabled(false); + getChildView("checkbox allow everyone copy")->setEnabled(false); } if (has_change_sale_ability && (owner_mask_on & PERM_TRANSFER)) @@ -787,39 +787,39 @@ void LLPanelPermissions::refresh() getChild<LLUICtrl>("checkbox for sale")->setTentative( is_for_sale_mixed); getChildView("sale type")->setEnabled(num_for_sale && can_transfer && !is_sale_price_mixed); - getChildView("Next owner can:")->setEnabled(TRUE); + getChildView("Next owner can:")->setEnabled(true); getChildView("checkbox next owner can modify")->setEnabled(base_mask_on & PERM_MODIFY); getChildView("checkbox next owner can copy")->setEnabled(base_mask_on & PERM_COPY); getChildView("checkbox next owner can transfer")->setEnabled(next_owner_mask_on & PERM_COPY); } else { - getChildView("checkbox for sale")->setEnabled(FALSE); - getChildView("sale type")->setEnabled(FALSE); + getChildView("checkbox for sale")->setEnabled(false); + getChildView("sale type")->setEnabled(false); - getChildView("Next owner can:")->setEnabled(FALSE); - getChildView("checkbox next owner can modify")->setEnabled(FALSE); - getChildView("checkbox next owner can copy")->setEnabled(FALSE); - getChildView("checkbox next owner can transfer")->setEnabled(FALSE); + getChildView("Next owner can:")->setEnabled(false); + getChildView("checkbox next owner can modify")->setEnabled(false); + getChildView("checkbox next owner can copy")->setEnabled(false); + getChildView("checkbox next owner can transfer")->setEnabled(false); } if (valid_group_perms) { if ((group_mask_on & PERM_COPY) && (group_mask_on & PERM_MODIFY) && (group_mask_on & PERM_MOVE)) { - getChild<LLUICtrl>("checkbox share with group")->setValue(TRUE); - getChild<LLUICtrl>("checkbox share with group")->setTentative( FALSE); + getChild<LLUICtrl>("checkbox share with group")->setValue(true); + getChild<LLUICtrl>("checkbox share with group")->setTentative( false); getChildView("button deed")->setEnabled(gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && (owner_mask_on & PERM_TRANSFER) && !group_owned && can_transfer); } else if ((group_mask_off & PERM_COPY) && (group_mask_off & PERM_MODIFY) && (group_mask_off & PERM_MOVE)) { - getChild<LLUICtrl>("checkbox share with group")->setValue(FALSE); - getChild<LLUICtrl>("checkbox share with group")->setTentative( FALSE); - getChildView("button deed")->setEnabled(FALSE); + getChild<LLUICtrl>("checkbox share with group")->setValue(false); + getChild<LLUICtrl>("checkbox share with group")->setTentative( false); + getChildView("button deed")->setEnabled(false); } else { - getChild<LLUICtrl>("checkbox share with group")->setValue(TRUE); + getChild<LLUICtrl>("checkbox share with group")->setValue(true); getChild<LLUICtrl>("checkbox share with group")->setTentative(!has_change_perm_ability); getChildView("button deed")->setEnabled(gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && (group_mask_on & PERM_MOVE) && (owner_mask_on & PERM_TRANSFER) && !group_owned && can_transfer); } @@ -830,35 +830,35 @@ void LLPanelPermissions::refresh() // Move if (everyone_mask_on & PERM_MOVE) { - getChild<LLUICtrl>("checkbox allow everyone move")->setValue(TRUE); - getChild<LLUICtrl>("checkbox allow everyone move")->setTentative( FALSE); + getChild<LLUICtrl>("checkbox allow everyone move")->setValue(true); + getChild<LLUICtrl>("checkbox allow everyone move")->setTentative( false); } else if (everyone_mask_off & PERM_MOVE) { - getChild<LLUICtrl>("checkbox allow everyone move")->setValue(FALSE); - getChild<LLUICtrl>("checkbox allow everyone move")->setTentative( FALSE); + getChild<LLUICtrl>("checkbox allow everyone move")->setValue(false); + getChild<LLUICtrl>("checkbox allow everyone move")->setTentative( false); } else { - getChild<LLUICtrl>("checkbox allow everyone move")->setValue(TRUE); - getChild<LLUICtrl>("checkbox allow everyone move")->setTentative( TRUE); + getChild<LLUICtrl>("checkbox allow everyone move")->setValue(true); + getChild<LLUICtrl>("checkbox allow everyone move")->setTentative( true); } // Copy == everyone can't copy if (everyone_mask_on & PERM_COPY) { - getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(TRUE); + getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(true); getChild<LLUICtrl>("checkbox allow everyone copy")->setTentative( !can_copy || !can_transfer); } else if (everyone_mask_off & PERM_COPY) { - getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(FALSE); - getChild<LLUICtrl>("checkbox allow everyone copy")->setTentative( FALSE); + getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(false); + getChild<LLUICtrl>("checkbox allow everyone copy")->setTentative( false); } else { - getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(TRUE); - getChild<LLUICtrl>("checkbox allow everyone copy")->setTentative( TRUE); + getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(true); + getChild<LLUICtrl>("checkbox allow everyone copy")->setTentative( true); } } @@ -867,71 +867,71 @@ void LLPanelPermissions::refresh() // Modify == next owner canot modify if (next_owner_mask_on & PERM_MODIFY) { - getChild<LLUICtrl>("checkbox next owner can modify")->setValue(TRUE); - getChild<LLUICtrl>("checkbox next owner can modify")->setTentative( FALSE); + getChild<LLUICtrl>("checkbox next owner can modify")->setValue(true); + getChild<LLUICtrl>("checkbox next owner can modify")->setTentative( false); } else if (next_owner_mask_off & PERM_MODIFY) { - getChild<LLUICtrl>("checkbox next owner can modify")->setValue(FALSE); - getChild<LLUICtrl>("checkbox next owner can modify")->setTentative( FALSE); + getChild<LLUICtrl>("checkbox next owner can modify")->setValue(false); + getChild<LLUICtrl>("checkbox next owner can modify")->setTentative( false); } else { - getChild<LLUICtrl>("checkbox next owner can modify")->setValue(TRUE); - getChild<LLUICtrl>("checkbox next owner can modify")->setTentative( TRUE); + getChild<LLUICtrl>("checkbox next owner can modify")->setValue(true); + getChild<LLUICtrl>("checkbox next owner can modify")->setTentative( true); } // Copy == next owner cannot copy if (next_owner_mask_on & PERM_COPY) { - getChild<LLUICtrl>("checkbox next owner can copy")->setValue(TRUE); + getChild<LLUICtrl>("checkbox next owner can copy")->setValue(true); getChild<LLUICtrl>("checkbox next owner can copy")->setTentative( !can_copy); } else if (next_owner_mask_off & PERM_COPY) { - getChild<LLUICtrl>("checkbox next owner can copy")->setValue(FALSE); - getChild<LLUICtrl>("checkbox next owner can copy")->setTentative( FALSE); + getChild<LLUICtrl>("checkbox next owner can copy")->setValue(false); + getChild<LLUICtrl>("checkbox next owner can copy")->setTentative( false); } else { - getChild<LLUICtrl>("checkbox next owner can copy")->setValue(TRUE); - getChild<LLUICtrl>("checkbox next owner can copy")->setTentative( TRUE); + getChild<LLUICtrl>("checkbox next owner can copy")->setValue(true); + getChild<LLUICtrl>("checkbox next owner can copy")->setTentative( true); } // Transfer == next owner cannot transfer if (next_owner_mask_on & PERM_TRANSFER) { - getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(TRUE); + getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(true); getChild<LLUICtrl>("checkbox next owner can transfer")->setTentative( !can_transfer); } else if (next_owner_mask_off & PERM_TRANSFER) { - getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(FALSE); - getChild<LLUICtrl>("checkbox next owner can transfer")->setTentative( FALSE); + getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(false); + getChild<LLUICtrl>("checkbox next owner can transfer")->setTentative( false); } else { - getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(TRUE); - getChild<LLUICtrl>("checkbox next owner can transfer")->setTentative( TRUE); + getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(true); + getChild<LLUICtrl>("checkbox next owner can transfer")->setTentative( true); } } // reflect sale information LLSaleInfo sale_info; - BOOL valid_sale_info = LLSelectMgr::getInstance()->selectGetSaleInfo(sale_info); + bool valid_sale_info = LLSelectMgr::getInstance()->selectGetSaleInfo(sale_info); LLSaleInfo::EForSale sale_type = sale_info.getSaleType(); LLComboBox* combo_sale_type = getChild<LLComboBox>("sale type"); if (valid_sale_info) { combo_sale_type->setValue( sale_type == LLSaleInfo::FS_NOT ? LLSaleInfo::FS_COPY : sale_type); - combo_sale_type->setTentative( FALSE); // unfortunately this doesn't do anything at the moment. + combo_sale_type->setTentative( false); // unfortunately this doesn't do anything at the moment. } else { // default option is sell copy, determined to be safest combo_sale_type->setValue( LLSaleInfo::FS_COPY); - combo_sale_type->setTentative( TRUE); // unfortunately this doesn't do anything at the moment. + combo_sale_type->setTentative( true); // unfortunately this doesn't do anything at the moment. } getChild<LLUICtrl>("checkbox for sale")->setValue((num_for_sale != 0)); @@ -949,9 +949,9 @@ void LLPanelPermissions::refresh() } // Check search status of objects - const BOOL all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ); + const bool all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ); bool include_in_search; - const BOOL all_include_in_search = LLSelectMgr::getInstance()->selectionGetIncludeInSearch(&include_in_search); + const bool all_include_in_search = LLSelectMgr::getInstance()->selectionGetIncludeInSearch(&include_in_search); getChildView("search_check")->setEnabled(has_change_sale_ability && all_volume); getChild<LLUICtrl>("search_check")->setValue(include_in_search); getChild<LLUICtrl>("search_check")->setTentative( !all_include_in_search); @@ -970,9 +970,9 @@ void LLPanelPermissions::refresh() if (LLSelectMgr::getInstance()->getSelection()->isAttachment()) { - getChildView("checkbox for sale")->setEnabled(FALSE); - getChildView("Edit Cost")->setEnabled(FALSE); - getChild<LLComboBox>("sale type")->setEnabled(FALSE); + getChildView("checkbox for sale")->setEnabled(false); + getChildView("Edit Cost")->setEnabled(false); + getChild<LLComboBox>("sale type")->setEnabled(false); } getChildView("label click action")->setEnabled(is_perm_modify && is_nonpermanent_enforced && all_volume); @@ -986,7 +986,7 @@ void shorten_name(std::string &name, const LLStyle::Params& style_params, S32 ma LLWString wline = utf8str_to_wstring(name); // panel supports two lines long names - S32 segment_length = font->maxDrawableChars(wline.c_str(), max_pixels, wline.length(), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); + S32 segment_length = font->maxDrawableChars(wline.c_str(), max_pixels, static_cast<S32>(wline.length()), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); if (segment_length == wline.length()) { // no work needed @@ -994,7 +994,7 @@ void shorten_name(std::string &name, const LLStyle::Params& style_params, S32 ma } S32 first_line_length = segment_length; - segment_length = font->maxDrawableChars(wline.substr(first_line_length).c_str(), max_pixels, wline.length(), LLFontGL::ANYWHERE); + segment_length = font->maxDrawableChars(wline.substr(first_line_length).c_str(), max_pixels, static_cast<S32>(wline.length()), LLFontGL::ANYWHERE); if (segment_length + first_line_length == wline.length()) { // no work needed @@ -1004,7 +1004,7 @@ void shorten_name(std::string &name, const LLStyle::Params& style_params, S32 ma // name does not fit, cut it, add ... const LLWString dots_pad(utf8str_to_wstring(std::string("...."))); S32 elipses_width = font->getWidthF32(dots_pad.c_str()); - segment_length = font->maxDrawableChars(wline.substr(first_line_length).c_str(), max_pixels - elipses_width, wline.length(), LLFontGL::ANYWHERE); + segment_length = font->maxDrawableChars(wline.substr(first_line_length).c_str(), max_pixels - elipses_width, static_cast<S32>(wline.length()), LLFontGL::ANYWHERE); name = name.substr(0, segment_length + first_line_length) + std::string("..."); } @@ -1049,7 +1049,7 @@ void LLPanelPermissions::onClickGroup() { LLUUID owner_id; std::string name; - BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, name); + bool owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, name); LLFloater* parent_floater = gFloaterView->getParentFloater(this); if(owners_identical && (owner_id == gAgent.getID())) @@ -1073,7 +1073,7 @@ void LLPanelPermissions::cbGroupID(LLUUID group_id) { if(mLabelGroupName) { - mLabelGroupName->setNameID(group_id, TRUE); + mLabelGroupName->setNameID(group_id, true); } LLSelectMgr::getInstance()->sendGroup(group_id); } @@ -1084,10 +1084,10 @@ bool callback_deed_to_group(const LLSD& notification, const LLSD& response) if (0 == option) { LLUUID group_id; - BOOL groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id); + bool groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id); if(group_id.notNull() && groups_identical && (gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED))) { - LLSelectMgr::getInstance()->sendOwner(LLUUID::null, group_id, FALSE); + LLSelectMgr::getInstance()->sendOwner(LLUUID::null, group_id, false); } } return false; @@ -1111,7 +1111,7 @@ void LLPanelPermissions::onCommitPerm(LLUICtrl *ctrl, void *data, U8 field, U32 // Checkbox will have toggled itself // LLPanelPermissions* self = (LLPanelPermissions*)data; LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl; - BOOL new_state = check->get(); + bool new_state = check->get(); LLSelectMgr::getInstance()->selectionSetObjectPermissions(field, new_state, perm); } @@ -1175,7 +1175,7 @@ void LLPanelPermissions::onCommitName(LLUICtrl*, void* data) { LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); new_item->rename(tb->getText()); - new_item->updateServer(FALSE); + new_item->updateServer(false); gInventory.updateItem(new_item); gInventory.notifyObservers(); } @@ -1202,7 +1202,7 @@ void LLPanelPermissions::onCommitDesc(LLUICtrl*, void* data) { LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); new_item->setDescription(le->getText()); - new_item->updateServer(FALSE); + new_item->updateServer(false); gInventory.updateItem(new_item); gInventory.notifyObservers(); } @@ -1252,10 +1252,10 @@ void LLPanelPermissions::setAllSaleInfo() LLSelectMgr::getInstance()->selectionSetObjectSaleInfo(new_sale_info); // Note: won't work right if a root and non-root are both single-selected (here and other places). - BOOL is_perm_modify = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() + bool is_perm_modify = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsModify()) || LLSelectMgr::getInstance()->selectGetModify(); - BOOL is_nonpermanent_enforced = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() + bool is_nonpermanent_enforced = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsNonPermanentEnforced()) || LLSelectMgr::getInstance()->selectGetNonPermanentEnforced(); diff --git a/indra/newview/llpanelpermissions.h b/indra/newview/llpanelpermissions.h index 790ac9920d..77129434ed 100644 --- a/indra/newview/llpanelpermissions.h +++ b/indra/newview/llpanelpermissions.h @@ -48,7 +48,7 @@ public: LLPanelPermissions(); virtual ~LLPanelPermissions(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); void updateOwnerName(const LLUUID& owner_id, const LLAvatarName& owner_name, const LLStyle::Params& style_params); void updateCreatorName(const LLUUID& creator_id, const LLAvatarName& creator_name, const LLStyle::Params& style_params); void refresh(); // refresh all labels as needed diff --git a/indra/newview/llpanelplaceinfo.cpp b/indra/newview/llpanelplaceinfo.cpp index 8a9b2a7ec7..efce55907e 100644 --- a/indra/newview/llpanelplaceinfo.cpp +++ b/indra/newview/llpanelplaceinfo.cpp @@ -72,7 +72,7 @@ LLPanelPlaceInfo::~LLPanelPlaceInfo() } //virtual -BOOL LLPanelPlaceInfo::postBuild() +bool LLPanelPlaceInfo::postBuild() { mTitle = getChild<LLTextBox>("title"); mCurrentTitle = mTitle->getText(); @@ -92,7 +92,7 @@ BOOL LLPanelPlaceInfo::postBuild() mScrollingPanelMinHeight = mScrollContainer->getScrolledViewRect().getHeight(); mScrollingPanelWidth = mScrollingPanel->getRect().getWidth(); - return TRUE; + return true; } //virtual @@ -194,7 +194,7 @@ void LLPanelPlaceInfo::setErrorStatus(S32 status, const std::string& reason) mRegionTitle.clear(); // Enable "Back" button that was disabled when parcel request was sent. - getChild<LLButton>("back_btn")->setEnabled(TRUE); + getChild<LLButton>("back_btn")->setEnabled(true); } // virtual @@ -258,11 +258,11 @@ void LLPanelPlaceInfo::processParcelInfo(const LLParcelData& parcel_data) } // virtual -void LLPanelPlaceInfo::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLPanelPlaceInfo::reshape(S32 width, S32 height, bool called_from_parent) { // This if was added to force collapsing description textbox on Windows at the beginning of reshape - // (the only case when reshape is skipped here is when it's caused by this textbox, so called_from_parent is FALSE) + // (the only case when reshape is skipped here is when it's caused by this textbox, so called_from_parent is false) // This way it is consistent with Linux where topLost collapses textbox at the beginning of reshape. // On windows it collapsed only after reshape which caused EXT-8342. if(called_from_parent) diff --git a/indra/newview/llpanelplaceinfo.h b/indra/newview/llpanelplaceinfo.h index 2dbc06dfc2..6e90603ce5 100644 --- a/indra/newview/llpanelplaceinfo.h +++ b/indra/newview/llpanelplaceinfo.h @@ -62,7 +62,7 @@ public: LLPanelPlaceInfo(); /*virtual*/ ~LLPanelPlaceInfo(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); // Ignore all old location information, useful if you are // recycling an existing dialog and need to clear it. @@ -89,7 +89,7 @@ public: /*virtual*/ void processParcelInfo(const LLParcelData& parcel_data); - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true); // Create a pick for the location specified // by global_pos. diff --git a/indra/newview/llpanelplaceprofile.cpp b/indra/newview/llpanelplaceprofile.cpp index 3cff72d42a..4ceeaa5d51 100644 --- a/indra/newview/llpanelplaceprofile.cpp +++ b/indra/newview/llpanelplaceprofile.cpp @@ -92,7 +92,7 @@ LLPanelPlaceProfile::~LLPanelPlaceProfile() } // virtual -BOOL LLPanelPlaceProfile::postBuild() +bool LLPanelPlaceProfile::postBuild() { LLPanelPlaceInfo::postBuild(); @@ -166,7 +166,7 @@ BOOL LLPanelPlaceProfile::postBuild() mLastSelectedRegionID = LLUUID::null; mNextCovenantUpdateTime = 0; - return TRUE; + return true; } // virtual @@ -177,8 +177,8 @@ void LLPanelPlaceProfile::resetLocation() mLastSelectedRegionID = LLUUID::null; mNextCovenantUpdateTime = 0; - mForSalePanel->setVisible(FALSE); - mYouAreHerePanel->setVisible(FALSE); + mForSalePanel->setVisible(false); + mYouAreHerePanel->setVisible(false); std::string loading = LLTrans::getString("LoadingData"); @@ -222,7 +222,7 @@ void LLPanelPlaceProfile::resetLocation() mResaleText->setValue(loading); mSaleToText->setValue(loading); - getChild<LLAccordionCtrlTab>("sales_tab")->setVisible(TRUE); + getChild<LLAccordionCtrlTab>("sales_tab")->setVisible(true); } // virtual @@ -312,7 +312,7 @@ void LLPanelPlaceProfile::processParcelInfo(const LLParcelData& parcel_data) } // virtual -void LLPanelPlaceProfile::onVisibilityChange(BOOL new_visibility) +void LLPanelPlaceProfile::onVisibilityChange(bool new_visibility) { LLPanel::onVisibilityChange(new_visibility); @@ -540,7 +540,7 @@ void LLPanelPlaceProfile::displaySelectedParcelInfo(LLParcel* parcel, S32 claim_price; S32 rent_price; F32 dwell; - BOOL for_sale; + bool for_sale; vpm->getDisplayInfo(&area, &claim_price, &rent_price, &for_sale, &dwell); mForSalePanel->setVisible(for_sale); if (for_sale) @@ -553,7 +553,7 @@ void LLPanelPlaceProfile::displaySelectedParcelInfo(LLParcel* parcel, // Show sales info to a specific person or a group he belongs to. if (auth_buyer_id != gAgent.getID() && !gAgent.isInGroup(auth_buyer_id)) { - for_sale = FALSE; + for_sale = false; } } else @@ -674,7 +674,7 @@ void LLPanelPlaceProfile::updateYouAreHereBanner(void* userdata) { static F32 radius = gSavedSettings.getF32("YouAreHereDistance"); - BOOL display_banner = gAgent.getRegion()->getRegionID() == self->mLastSelectedRegionID && + bool display_banner = gAgent.getRegion()->getRegionID() == self->mLastSelectedRegionID && LLAgentUI::checkAgentDistance(self->mPosRegion, radius); self->mYouAreHerePanel->setVisible(display_banner); diff --git a/indra/newview/llpanelplaceprofile.h b/indra/newview/llpanelplaceprofile.h index e440ebc2e1..45a20fb86a 100644 --- a/indra/newview/llpanelplaceprofile.h +++ b/indra/newview/llpanelplaceprofile.h @@ -39,7 +39,7 @@ public: LLPanelPlaceProfile(); /*virtual*/ ~LLPanelPlaceProfile(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void resetLocation(); @@ -47,7 +47,7 @@ public: /*virtual*/ void processParcelInfo(const LLParcelData& parcel_data); - /*virtual*/ void onVisibilityChange(BOOL new_visibility); + /*virtual*/ void onVisibilityChange(bool new_visibility); // Displays information about the currently selected parcel // without sending a request to the server. diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp index 67aa51e38a..7deb1d9fd4 100644 --- a/indra/newview/llpanelplaces.cpp +++ b/indra/newview/llpanelplaces.cpp @@ -108,7 +108,7 @@ public: } LLUUID parcel_id; - if (!parcel_id.set(params[0], FALSE)) + if (!parcel_id.set(params[0], false)) { return false; } @@ -275,7 +275,7 @@ LLPanelPlaces::~LLPanelPlaces() } } -BOOL LLPanelPlaces::postBuild() +bool LLPanelPlaces::postBuild() { mTeleportBtn = getChild<LLButton>("teleport_btn"); mTeleportBtn->setClickedCallback(boost::bind(&LLPanelPlaces::onTeleportButtonClicked, this)); @@ -309,7 +309,7 @@ BOOL LLPanelPlaces::postBuild() LLDragAndDropButton* trash_btn = (LLDragAndDropButton*)mRemoveSelectedBtn; trash_btn->setDragAndDropHandler(boost::bind(&LLPanelPlaces::handleDragAndDropToTrash, this - , _4 // BOOL drop + , _4 // bool drop , _5 // EDragAndDropType cargo_type , _6 // void* cargo_data , _7 // EAcceptance* accept @@ -323,7 +323,7 @@ BOOL LLPanelPlaces::postBuild() mPlaceMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_place.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); if (mPlaceMenu) { - mPlaceMenu->setAlwaysShowMenu(TRUE); + mPlaceMenu->setAlwaysShowMenu(true); } else { @@ -343,7 +343,7 @@ BOOL LLPanelPlaces::postBuild() } mButtonsContainer = getChild<LLPanel>("button_layout_panel"); - mButtonsContainer->setVisible(FALSE); + mButtonsContainer->setVisible(false); mFilterContainer = getChild<LLLayoutStack>("top_menu_panel"); mFilterEditor = getChild<LLFilterEditor>("Filter"); @@ -360,7 +360,7 @@ BOOL LLPanelPlaces::postBuild() mPlaceProfile = findChild<LLPanelPlaceProfile>("panel_place_profile"); mLandmarkInfo = findChild<LLPanelLandmarkInfo>("panel_landmark_info"); if (!mPlaceProfile || !mLandmarkInfo) - return FALSE; + return false; mPlaceProfileBackBtn = mPlaceProfile->getChild<LLButton>("back_btn"); mPlaceProfileBackBtn->setClickedCallback(boost::bind(&LLPanelPlaces::onBackButtonClicked, this)); @@ -382,7 +382,7 @@ BOOL LLPanelPlaces::postBuild() createTabs(); updateVerbs(); - return TRUE; + return true; } void LLPanelPlaces::onOpen(const LLSD& key) @@ -403,9 +403,9 @@ void LLPanelPlaces::onOpen(const LLSD& key) // The second toggle forces the list to be set to Landmark. // This avoids extracting and duplicating all the state logic from togglePlaceInfoPanel() // here or some specific private method - togglePlaceInfoPanel(FALSE); + togglePlaceInfoPanel(false); mPlaceInfoType = key_type; - togglePlaceInfoPanel(FALSE); + togglePlaceInfoPanel(false); // Update the active tab onTabSelected(); // Update the buttons at the bottom of the panel @@ -435,7 +435,7 @@ void LLPanelPlaces::onOpen(const LLSD& key) mPosGlobal.setZero(); mItem = NULL; mRegionId.setNull(); - togglePlaceInfoPanel(TRUE); + togglePlaceInfoPanel(true); if (mPlaceInfoType == AGENT_INFO_TYPE) { @@ -463,7 +463,7 @@ void LLPanelPlaces::onOpen(const LLSD& key) mLandmarkInfo->displayParcelInfo(LLUUID(), mPosGlobal); - mSaveBtn->setEnabled(FALSE); + mSaveBtn->setEnabled(false); } else if (mPlaceInfoType == LANDMARK_INFO_TYPE) { @@ -474,7 +474,7 @@ void LLPanelPlaces::onOpen(const LLSD& key) if (!item) return; - BOOL is_editable = gInventory.isObjectDescendentOf(id, gInventory.getRootFolderID()) + bool is_editable = gInventory.isObjectDescendentOf(id, gInventory.getRootFolderID()) && item->getPermissions().allowModifyBy(gAgent.getID()); mLandmarkInfo->setCanEdit(is_editable); @@ -574,7 +574,7 @@ void LLPanelPlaces::setItem(LLInventoryItem* item) } // Check if item is in agent's inventory and he has the permission to modify it. - BOOL is_landmark_editable = gInventory.isObjectDescendentOf(mItem->getUUID(), gInventory.getRootFolderID()) && + bool is_landmark_editable = gInventory.isObjectDescendentOf(mItem->getUUID(), gInventory.getRootFolderID()) && mItem->getPermissions().allowModifyBy(gAgent.getID()); mSaveBtn->setEnabled(is_landmark_editable); @@ -663,7 +663,7 @@ void LLPanelPlaces::onTabSelected() childSetVisible("add_btn_panel", supports_create); // favorites and inventory can remove items, history can clear history - childSetVisible("trash_btn_panel", TRUE); + childSetVisible("trash_btn_panel", true); if (supports_create) { @@ -784,7 +784,7 @@ void LLPanelPlaces::onEditButtonClicked() isLandmarkEditModeOn = true; - mLandmarkInfo->toggleLandmarkEditMode(TRUE); + mLandmarkInfo->toggleLandmarkEditMode(true); updateVerbs(); } @@ -831,7 +831,7 @@ void LLPanelPlaces::onSaveButtonClicked() gInventory.accountForUpdate(update); new_item->setParent(folder_id); - new_item->updateParentOnServer(FALSE); + new_item->updateParentOnServer(false); } gInventory.updateItem(new_item); @@ -851,7 +851,7 @@ void LLPanelPlaces::onCancelButtonClicked() } else { - mLandmarkInfo->toggleLandmarkEditMode(FALSE); + mLandmarkInfo->toggleLandmarkEditMode(false); isLandmarkEditModeOn = false; updateVerbs(); @@ -898,7 +898,7 @@ void LLPanelPlaces::onOverflowButtonClicked() { menu = mLandmarkMenu; - BOOL is_landmark_removable = FALSE; + bool is_landmark_removable = false; if (mItem.notNull()) { const LLUUID& item_id = mItem->getUUID(); @@ -978,7 +978,7 @@ void LLPanelPlaces::onOverflowMenuItemClicked(const LLSD& param) void LLPanelPlaces::onBackButtonClicked() { - togglePlaceInfoPanel(FALSE); + togglePlaceInfoPanel(false); // Resetting mPlaceInfoType when Place Info panel is closed. mPlaceInfoType = LLStringUtil::null; @@ -1023,7 +1023,7 @@ void LLPanelPlaces::onRemoveButtonClicked() } } -bool LLPanelPlaces::handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept) +bool LLPanelPlaces::handleDragAndDropToTrash(bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept) { if (mActivePanel) { @@ -1032,7 +1032,7 @@ bool LLPanelPlaces::handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_t return false; } -void LLPanelPlaces::togglePlaceInfoPanel(BOOL visible) +void LLPanelPlaces::togglePlaceInfoPanel(bool visible) { if (!mPlaceProfile || !mLandmarkInfo) return; @@ -1055,7 +1055,7 @@ void LLPanelPlaces::togglePlaceInfoPanel(BOOL visible) // to avoid text blinking. mResetInfoTimer.setTimerExpirySec(PLACE_INFO_UPDATE_INTERVAL); - mLandmarkInfo->setVisible(FALSE); + mLandmarkInfo->setVisible(false); } else if (mPlaceInfoType == AGENT_INFO_TYPE) { @@ -1071,7 +1071,7 @@ void LLPanelPlaces::togglePlaceInfoPanel(BOOL visible) mPlaceInfoType == LANDMARK_TAB_INFO_TYPE) { mLandmarkInfo->setVisible(visible); - mPlaceProfile->setVisible(FALSE); + mPlaceProfile->setVisible(false); if (visible) { mLandmarkInfo->resetLocation(); @@ -1095,7 +1095,7 @@ void LLPanelPlaces::togglePlaceInfoPanel(BOOL visible) mTabContainer->selectTabPanel(landmarks_panel); if (mItem.notNull()) { - landmarks_panel->setItemSelected(mItem->getUUID(), TRUE); + landmarks_panel->setItemSelected(mItem->getUUID(), true); } else { @@ -1107,7 +1107,7 @@ void LLPanelPlaces::togglePlaceInfoPanel(BOOL visible) } // virtual -void LLPanelPlaces::onVisibilityChange(BOOL new_visibility) +void LLPanelPlaces::onVisibilityChange(bool new_visibility) { LLPanel::onVisibilityChange(new_visibility); @@ -1213,7 +1213,7 @@ void LLPanelPlaces::createTabs() childSetVisible("add_btn_panel", supports_create); // favorites and inventory can remove items, history can clear history - childSetVisible("trash_btn_panel", TRUE); + childSetVisible("trash_btn_panel", true); if (supports_create) { diff --git a/indra/newview/llpanelplaces.h b/indra/newview/llpanelplaces.h index 1e76ad126f..fc04d8d45d 100644 --- a/indra/newview/llpanelplaces.h +++ b/indra/newview/llpanelplaces.h @@ -57,7 +57,7 @@ public: LLPanelPlaces(); virtual ~LLPanelPlaces(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void onOpen(const LLSD& key); // Called on parcel selection change to update place information. @@ -99,11 +99,11 @@ private: void onSortingMenuClick(); void onAddMenuClick(); void onRemoveButtonClicked(); - bool handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept); + bool handleDragAndDropToTrash(bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept); - void togglePlaceInfoPanel(BOOL visible); + void togglePlaceInfoPanel(bool visible); - /*virtual*/ void onVisibilityChange(BOOL new_visibility); + /*virtual*/ void onVisibilityChange(bool new_visibility); void updateVerbs(); diff --git a/indra/newview/llpanelplacestab.h b/indra/newview/llpanelplacestab.h index b58cd2c3e2..90ad83550e 100644 --- a/indra/newview/llpanelplacestab.h +++ b/indra/newview/llpanelplacestab.h @@ -54,7 +54,7 @@ public: /** * Processes drag-n-drop of the Landmarks and folders into trash button. */ - virtual bool handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept) = 0; + virtual bool handleDragAndDropToTrash(bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept) = 0; bool isTabVisible(); // Check if parent TabContainer is visible. diff --git a/indra/newview/llpanelpresetscamerapulldown.cpp b/indra/newview/llpanelpresetscamerapulldown.cpp index 124a38bebb..5b0aa28223 100644 --- a/indra/newview/llpanelpresetscamerapulldown.cpp +++ b/indra/newview/llpanelpresetscamerapulldown.cpp @@ -54,7 +54,7 @@ LLPanelPresetsCameraPulldown::LLPanelPresetsCameraPulldown() buildFromFile( "panel_presets_camera_pulldown.xml"); } -BOOL LLPanelPresetsCameraPulldown::postBuild() +bool LLPanelPresetsCameraPulldown::postBuild() { LLPresetsManager* presetsMgr = LLPresetsManager::getInstance(); if (presetsMgr) @@ -128,9 +128,9 @@ void LLPanelPresetsCameraPulldown::onRowClick(const LLSD& user_data) LLFloaterCamera::switchToPreset(name); // Scroll grabbed focus, drop it to prevent selection of parent menu - setFocus(FALSE); + setFocus(false); - setVisible(FALSE); + setVisible(false); } else { @@ -146,7 +146,7 @@ void LLPanelPresetsCameraPulldown::onRowClick(const LLSD& user_data) void LLPanelPresetsCameraPulldown::onViewButtonClick(const LLSD& user_data) { // close the minicontrol, we're bringing up the big one - setVisible(FALSE); + setVisible(false); LLFloaterReg::toggleInstanceOrBringToFront("camera"); } diff --git a/indra/newview/llpanelpresetscamerapulldown.h b/indra/newview/llpanelpresetscamerapulldown.h index 231a269436..9424a48eaa 100644 --- a/indra/newview/llpanelpresetscamerapulldown.h +++ b/indra/newview/llpanelpresetscamerapulldown.h @@ -35,7 +35,7 @@ class LLPanelPresetsCameraPulldown : public LLPanelPulldown { public: LLPanelPresetsCameraPulldown(); - /*virtual*/ BOOL postBuild(); + bool postBuild() override; void populatePanel(); private: diff --git a/indra/newview/llpanelpresetspulldown.cpp b/indra/newview/llpanelpresetspulldown.cpp index 61331aad95..3b0f1273df 100644 --- a/indra/newview/llpanelpresetspulldown.cpp +++ b/indra/newview/llpanelpresetspulldown.cpp @@ -57,7 +57,7 @@ LLPanelPresetsPulldown::LLPanelPresetsPulldown() buildFromFile( "panel_presets_pulldown.xml"); } -BOOL LLPanelPresetsPulldown::postBuild() +bool LLPanelPresetsPulldown::postBuild() { LLPresetsManager* presetsMgr = LLPresetsManager::getInstance(); presetsMgr->setPresetListChangeCallback(boost::bind(&LLPanelPresetsPulldown::populatePanel, this)); @@ -125,9 +125,9 @@ void LLPanelPresetsPulldown::onRowClick(const LLSD& user_data) LLPresetsManager::getInstance()->loadPreset(PRESETS_GRAPHIC, name); // Scroll grabbed focus, drop it to prevent selection of parent menu - setFocus(FALSE); + setFocus(false); - setVisible(FALSE); + setVisible(false); } else { @@ -143,7 +143,7 @@ void LLPanelPresetsPulldown::onRowClick(const LLSD& user_data) void LLPanelPresetsPulldown::onGraphicsButtonClick(const LLSD& user_data) { // close the minicontrol, we're bringing up the big one - setVisible(FALSE); + setVisible(false); // bring up the prefs floater LLFloater* prefsfloater = LLFloaterReg::showInstance("preferences"); @@ -162,7 +162,7 @@ void LLPanelPresetsPulldown::onGraphicsButtonClick(const LLSD& user_data) void LLPanelPresetsPulldown::onAutofpsButtonClick(const LLSD& user_data) { - setVisible(FALSE); + setVisible(false); LLFloaterPerformance* performance_floater = LLFloaterReg::showTypedInstance<LLFloaterPerformance>("performance"); if (performance_floater) { diff --git a/indra/newview/llpanelpresetspulldown.h b/indra/newview/llpanelpresetspulldown.h index 9ecd5d66f0..b4d001a02e 100644 --- a/indra/newview/llpanelpresetspulldown.h +++ b/indra/newview/llpanelpresetspulldown.h @@ -36,7 +36,7 @@ class LLPanelPresetsPulldown : public LLPanelPulldown { public: LLPanelPresetsPulldown(); - /*virtual*/ BOOL postBuild(); + bool postBuild() override; void populatePanel(); private: diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp index 16cf46529d..1299c8c656 100644 --- a/indra/newview/llpanelprimmediacontrols.cpp +++ b/indra/newview/llpanelprimmediacontrols.cpp @@ -141,7 +141,7 @@ LLPanelPrimMediaControls::~LLPanelPrimMediaControls() { } -BOOL LLPanelPrimMediaControls::postBuild() +bool LLPanelPrimMediaControls::postBuild() { mMediaRegion = getChild<LLView>("media_region"); mBackCtrl = getChild<LLUICtrl>("back"); @@ -223,8 +223,8 @@ BOOL LLPanelPrimMediaControls::postBuild() mCurrentZoom = ZOOM_NONE; // clicks on buttons do not remove keyboard focus from media - setIsChrome(TRUE); - return TRUE; + setIsChrome(true); + return true; } void LLPanelPrimMediaControls::setMediaFace(LLPointer<LLViewerObject> objectp, S32 face, viewer_media_t media_impl, LLVector3 pick_normal) @@ -297,7 +297,7 @@ void LLPanelPrimMediaControls::updateShape() if(!media_impl || gFloaterTools->getVisible()) { - setVisible(FALSE); + setVisible(false); return; } @@ -443,17 +443,17 @@ void LLPanelPrimMediaControls::updateShape() switch(result) { case LLPluginClassMediaOwner::MEDIA_PLAYING: - mPlayCtrl->setEnabled(FALSE); - mPlayCtrl->setVisible(FALSE); - mPauseCtrl->setEnabled(TRUE); + mPlayCtrl->setEnabled(false); + mPlayCtrl->setVisible(false); + mPauseCtrl->setEnabled(true); mPauseCtrl->setVisible(has_focus); break; case LLPluginClassMediaOwner::MEDIA_PAUSED: default: - mPauseCtrl->setEnabled(FALSE); - mPauseCtrl->setVisible(FALSE); - mPlayCtrl->setEnabled(TRUE); + mPauseCtrl->setEnabled(false); + mPauseCtrl->setVisible(false); + mPlayCtrl->setEnabled(true); mPlayCtrl->setVisible(has_focus); break; } @@ -469,17 +469,17 @@ void LLPanelPrimMediaControls::updateShape() mCurrentURL.clear(); } - mPlayCtrl->setVisible(FALSE); - mPauseCtrl->setVisible(FALSE); - mMediaStopCtrl->setVisible(FALSE); + mPlayCtrl->setVisible(false); + mPauseCtrl->setVisible(false); + mMediaStopCtrl->setVisible(false); mMediaAddressCtrl->setVisible(has_focus && !mini_controls); mMediaAddressCtrl->setEnabled(has_focus && !mini_controls); - mMediaPlaySliderPanel->setVisible(FALSE); - mMediaPlaySliderPanel->setEnabled(FALSE); - mSkipFwdCtrl->setVisible(FALSE); - mSkipFwdCtrl->setEnabled(FALSE); - mSkipBackCtrl->setVisible(FALSE); - mSkipBackCtrl->setEnabled(FALSE); + mMediaPlaySliderPanel->setVisible(false); + mMediaPlaySliderPanel->setEnabled(false); + mSkipFwdCtrl->setVisible(false); + mSkipFwdCtrl->setEnabled(false); + mSkipBackCtrl->setVisible(false); + mSkipBackCtrl->setEnabled(false); if(media_impl->getVolume() <= 0.0) { @@ -515,17 +515,17 @@ void LLPanelPrimMediaControls::updateShape() if(result == LLPluginClassMediaOwner::MEDIA_LOADING) { - mReloadCtrl->setEnabled(FALSE); - mReloadCtrl->setVisible(FALSE); - mStopCtrl->setEnabled(TRUE); + mReloadCtrl->setEnabled(false); + mReloadCtrl->setVisible(false); + mStopCtrl->setEnabled(true); mStopCtrl->setVisible(has_focus); } else { - mReloadCtrl->setEnabled(TRUE); + mReloadCtrl->setEnabled(true); mReloadCtrl->setVisible(has_focus); - mStopCtrl->setEnabled(FALSE); - mStopCtrl->setVisible(FALSE); + mStopCtrl->setEnabled(false); + mStopCtrl->setVisible(false); } } @@ -741,7 +741,7 @@ void LLPanelPrimMediaControls::updateShape() else { // I don't think this is correct anymore. This is done in draw() after the fade has completed. - // setVisible(FALSE); + // setVisible(false); } } } @@ -834,10 +834,10 @@ void LLPanelPrimMediaControls::draw() } } -BOOL LLPanelPrimMediaControls::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLPanelPrimMediaControls::handleScrollWheel(S32 x, S32 y, S32 clicks) { mInactivityTimer.start(); - BOOL res = FALSE; + bool res = false; // Unlike other mouse events, we need to handle scroll here otherwise // it will be intercepted by camera and won't reach toolpie @@ -850,10 +850,10 @@ BOOL LLPanelPrimMediaControls::handleScrollWheel(S32 x, S32 y, S32 clicks) return res; } -BOOL LLPanelPrimMediaControls::handleScrollHWheel(S32 x, S32 y, S32 clicks) +bool LLPanelPrimMediaControls::handleScrollHWheel(S32 x, S32 y, S32 clicks) { mInactivityTimer.start(); - BOOL res = FALSE; + bool res = false; if (LLViewerMediaFocus::getInstance()->isHoveringOverFocused()) { @@ -864,19 +864,19 @@ BOOL LLPanelPrimMediaControls::handleScrollHWheel(S32 x, S32 y, S32 clicks) return res; } -BOOL LLPanelPrimMediaControls::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLPanelPrimMediaControls::handleMouseDown(S32 x, S32 y, MASK mask) { mInactivityTimer.start(); return LLPanel::handleMouseDown(x, y, mask); } -BOOL LLPanelPrimMediaControls::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLPanelPrimMediaControls::handleMouseUp(S32 x, S32 y, MASK mask) { mInactivityTimer.start(); return LLPanel::handleMouseUp(x, y, mask); } -BOOL LLPanelPrimMediaControls::handleKeyHere( KEY key, MASK mask ) +bool LLPanelPrimMediaControls::handleKeyHere( KEY key, MASK mask ) { mInactivityTimer.start(); return LLPanel::handleKeyHere(key, mask); @@ -934,7 +934,7 @@ void LLPanelPrimMediaControls::close() { resetZoomLevel(true); LLViewerMediaFocus::getInstance()->clearFocus(); - setVisible(FALSE); + setVisible(false); } @@ -1120,7 +1120,7 @@ void LLPanelPrimMediaControls::updateZoom() { case ZOOM_NONE: { - gAgentCamera.setFocusOnAvatar(TRUE, ANIMATE); + gAgentCamera.setFocusOnAvatar(true, ANIMATE); break; } case ZOOM_FAR: @@ -1140,7 +1140,7 @@ void LLPanelPrimMediaControls::updateZoom() } default: { - gAgentCamera.setFocusOnAvatar(TRUE, ANIMATE); + gAgentCamera.setFocusOnAvatar(true, ANIMATE); break; } } @@ -1420,7 +1420,7 @@ void LLPanelPrimMediaControls::clearFaceOnFade() // Hiding this object makes scroll events go missing after it fades out // (see DEV-41755 for a full description of the train wreck). // Only hide the controls when we're untargeting. - setVisible(FALSE); + setVisible(false); mClearFaceOnFade = false; mVolumeSliderVisible = 0; diff --git a/indra/newview/llpanelprimmediacontrols.h b/indra/newview/llpanelprimmediacontrols.h index fa7cc81873..57c32e3a5f 100644 --- a/indra/newview/llpanelprimmediacontrols.h +++ b/indra/newview/llpanelprimmediacontrols.h @@ -46,14 +46,14 @@ class LLPanelPrimMediaControls : public LLPanel public: LLPanelPrimMediaControls(); virtual ~LLPanelPrimMediaControls(); - /*virtual*/ BOOL postBuild(); - virtual void draw(); - virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); - virtual BOOL handleScrollHWheel(S32 x, S32 y, S32 clicks); - - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleKeyHere(KEY key, MASK mask); + bool postBuild() override; + void draw() override; + bool handleScrollWheel(S32 x, S32 y, S32 clicks) override; + bool handleScrollHWheel(S32 x, S32 y, S32 clicks) override; + + bool handleMouseDown(S32 x, S32 y, MASK mask) override; + bool handleMouseUp(S32 x, S32 y, MASK mask) override; + bool handleKeyHere(KEY key, MASK mask) override; void updateShape(); bool isMouseOver(); diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index b272f2e868..3bec7abdaf 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -46,6 +46,7 @@ #include "lltexteditor.h" #include "lltexturectrl.h" #include "lltoggleablemenu.h" +#include "lltooldraganddrop.h" #include "llgrouplist.h" #include "llurlaction.h" @@ -321,7 +322,7 @@ public: { if (params.size() < 2) return false; LLUUID avatar_id; - if (!avatar_id.set(params[0], FALSE)) + if (!avatar_id.set(params[0], false)) { return false; } @@ -448,7 +449,7 @@ class LLFloaterProfilePermissions public: LLFloaterProfilePermissions(LLView * owner, const LLUUID &avatar_id); ~LLFloaterProfilePermissions(); - BOOL postBuild() override; + bool postBuild() override; void onOpen(const LLSD& key) override; void draw() override; void changed(U32 mask) override; // LLFriendObserver @@ -500,7 +501,7 @@ LLFloaterProfilePermissions::~LLFloaterProfilePermissions() } } -BOOL LLFloaterProfilePermissions::postBuild() +bool LLFloaterProfilePermissions::postBuild() { mDescription = getChild<LLTextBase>("perm_description"); mOnlineStatus = getChild<LLCheckBoxCtrl>("online_check"); @@ -515,7 +516,7 @@ BOOL LLFloaterProfilePermissions::postBuild() mOkBtn->setCommitCallback([this](LLUICtrl*, void*) { onApplyRights(); }, nullptr); mCancelBtn->setCommitCallback([this](LLUICtrl*, void*) { onCancel(); }, nullptr); - return TRUE; + return true; } void LLFloaterProfilePermissions::onOpen(const LLSD& key) @@ -566,11 +567,11 @@ void LLFloaterProfilePermissions::fillRightsData() { S32 rights = relation->getRightsGrantedTo(); - BOOL see_online = LLRelationship::GRANT_ONLINE_STATUS & rights ? TRUE : FALSE; + bool see_online = LLRelationship::GRANT_ONLINE_STATUS & rights; mOnlineStatus->setValue(see_online); mMapRights->setEnabled(see_online); - mMapRights->setValue(LLRelationship::GRANT_MAP_LOCATION & rights ? TRUE : FALSE); - mEditObjectRights->setValue(LLRelationship::GRANT_MODIFY_OBJECTS & rights ? TRUE : FALSE); + mMapRights->setValue(LLRelationship::GRANT_MAP_LOCATION & rights); + mEditObjectRights->setValue(LLRelationship::GRANT_MODIFY_OBJECTS & rights); } else { @@ -585,7 +586,7 @@ void LLFloaterProfilePermissions::rightsConfirmationCallback(const LLSD& notific S32 option = LLNotificationsUtil::getSelectedOption(notification, response); if (option != 0) // canceled { - mEditObjectRights->setValue(mEditObjectRights->getValue().asBoolean() ? FALSE : TRUE); + mEditObjectRights->setValue(!mEditObjectRights->getValue().asBoolean()); } else { @@ -611,7 +612,7 @@ void LLFloaterProfilePermissions::onCommitSeeOnlineRights() if (relation) { S32 rights = relation->getRightsGrantedTo(); - mMapRights->setValue(LLRelationship::GRANT_MAP_LOCATION & rights ? TRUE : FALSE); + mMapRights->setValue(LLRelationship::GRANT_MAP_LOCATION & rights); } else { @@ -621,7 +622,7 @@ void LLFloaterProfilePermissions::onCommitSeeOnlineRights() } else { - mMapRights->setValue(FALSE); + mMapRights->setValue(false); } mHasUnsavedPermChanges = true; } @@ -713,7 +714,7 @@ LLPanelProfileSecondLife::~LLPanelProfileSecondLife() } } -BOOL LLPanelProfileSecondLife::postBuild() +bool LLPanelProfileSecondLife::postBuild() { mGroupList = getChild<LLGroupList>("group_list"); mShowInSearchCombo = getChild<LLComboBox>("show_in_search"); @@ -747,7 +748,7 @@ BOOL LLPanelProfileSecondLife::postBuild() mCantEditObjectsIcon->setMouseUpCallback([this](LLUICtrl*, S32 x, S32 y, MASK mask) { onShowAgentPermissionsDialog(); }); mSecondLifePic->setMouseUpCallback([this](LLUICtrl*, S32 x, S32 y, MASK mask) { onShowAgentProfileTexture(); }); - return TRUE; + return true; } void LLPanelProfileSecondLife::onOpen(const LLSD& key) @@ -758,7 +759,7 @@ void LLPanelProfileSecondLife::onOpen(const LLSD& key) LLUUID avatar_id = getAvatarId(); - BOOL own_profile = getSelfProfile(); + bool own_profile = getSelfProfile(); mGroupList->setShowNone(!own_profile); @@ -795,7 +796,7 @@ void LLPanelProfileSecondLife::onOpen(const LLSD& key) if (!own_profile) { - mVoiceStatus = LLAvatarActions::canCall() && (LLAvatarActions::isFriend(avatar_id) ? LLAvatarTracker::instance().isBuddyOnline(avatar_id) : TRUE); + mVoiceStatus = LLAvatarActions::canCall() && (LLAvatarActions::isFriend(avatar_id) ? LLAvatarTracker::instance().isBuddyOnline(avatar_id) : true); updateOnlineStatus(); fillRightsData(); } @@ -803,6 +804,51 @@ void LLPanelProfileSecondLife::onOpen(const LLSD& key) mAvatarNameCacheConnection = LLAvatarNameCache::get(getAvatarId(), boost::bind(&LLPanelProfileSecondLife::onAvatarNameCache, this, _1, _2)); } + +bool LLPanelProfileSecondLife::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg) +{ + // Try children first + if (LLPanelProfileTab::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg) + && *accept != ACCEPT_NO) + { + return true; + } + + // No point sharing with own profile + if (getSelfProfile()) + { + return false; + } + + // Exclude fields that look like they are editable. + S32 child_x = 0; + S32 child_y = 0; + if (localPointToOtherView(x, y, &child_x, &child_y, mDescriptionEdit) + && mDescriptionEdit->pointInView(child_x, child_y)) + { + return false; + } + + if (localPointToOtherView(x, y, &child_x, &child_y, mGroupList) + && mGroupList->pointInView(child_x, child_y)) + { + return false; + } + + // Share + LLToolDragAndDrop::handleGiveDragAndDrop(getAvatarId(), + LLUUID::null, + drop, + cargo_type, + cargo_data, + accept); + return true; +} + void LLPanelProfileSecondLife::refreshName() { if (!mAvatarNameCacheConnection.connected()) @@ -840,9 +886,9 @@ void LLPanelProfileSecondLife::resetData() mCanEditObjectsIcon->setEnabled(false); mCantEditObjectsIcon->setEnabled(false); - childSetVisible("partner_layout", FALSE); - childSetVisible("badge_layout", FALSE); - childSetVisible("partner_spacer_layout", TRUE); + childSetVisible("partner_layout", false); + childSetVisible("badge_layout", false); + childSetVisible("partner_spacer_layout", true); } void LLPanelProfileSecondLife::processProperties(void* data, EAvatarProcessorType type) @@ -979,7 +1025,7 @@ void LLPanelProfileSecondLife::fillCommonData(const LLAvatarData* avatar_data) if (getSelfProfile()) { mAllowPublish = avatar_data->flags & AVATAR_ALLOW_PUBLISH; - mShowInSearchCombo->setValue(mAllowPublish ? TRUE : FALSE); + mShowInSearchCombo->setValue(mAllowPublish); } } @@ -988,7 +1034,7 @@ void LLPanelProfileSecondLife::fillPartnerData(const LLAvatarData* avatar_data) LLTextBox* partner_text_ctrl = getChild<LLTextBox>("partner_link"); if (avatar_data->partner_id.notNull()) { - childSetVisible("partner_layout", TRUE); + childSetVisible("partner_layout", true); LLStringUtil::format_map_t args; args["[LINK]"] = LLSLURL("agent", avatar_data->partner_id, "inspect").getSLURLString(); std::string partner_text = getString("partner_text", args); @@ -996,7 +1042,7 @@ void LLPanelProfileSecondLife::fillPartnerData(const LLAvatarData* avatar_data) } else { - childSetVisible("partner_layout", FALSE); + childSetVisible("partner_layout", false); } } @@ -1018,48 +1064,48 @@ void LLPanelProfileSecondLife::fillAccountStatus(const LLAvatarData* avatar_data { getChild<LLUICtrl>("badge_icon")->setValue("Profile_Badge_Linden"); getChild<LLUICtrl>("badge_text")->setValue(getString("BadgeLinden")); - childSetVisible("badge_layout", TRUE); - childSetVisible("partner_spacer_layout", FALSE); + childSetVisible("badge_layout", true); + childSetVisible("partner_spacer_layout", false); } else if (avatar_data->born_on < sl_release) { getChild<LLUICtrl>("badge_icon")->setValue("Profile_Badge_Beta"); getChild<LLUICtrl>("badge_text")->setValue(getString("BadgeBeta")); - childSetVisible("badge_layout", TRUE); - childSetVisible("partner_spacer_layout", FALSE); + childSetVisible("badge_layout", true); + childSetVisible("partner_spacer_layout", false); } else if (customer_lower == "beta_lifetime") { getChild<LLUICtrl>("badge_icon")->setValue("Profile_Badge_Beta_Lifetime"); getChild<LLUICtrl>("badge_text")->setValue(getString("BadgeBetaLifetime")); - childSetVisible("badge_layout", TRUE); - childSetVisible("partner_spacer_layout", FALSE); + childSetVisible("badge_layout", true); + childSetVisible("partner_spacer_layout", false); } else if (customer_lower == "lifetime") { getChild<LLUICtrl>("badge_icon")->setValue("Profile_Badge_Lifetime"); getChild<LLUICtrl>("badge_text")->setValue(getString("BadgeLifetime")); - childSetVisible("badge_layout", TRUE); - childSetVisible("partner_spacer_layout", FALSE); + childSetVisible("badge_layout", true); + childSetVisible("partner_spacer_layout", false); } else if (customer_lower == "secondlifetime_premium") { getChild<LLUICtrl>("badge_icon")->setValue("Profile_Badge_Premium_Lifetime"); getChild<LLUICtrl>("badge_text")->setValue(getString("BadgePremiumLifetime")); - childSetVisible("badge_layout", TRUE); - childSetVisible("partner_spacer_layout", FALSE); + childSetVisible("badge_layout", true); + childSetVisible("partner_spacer_layout", false); } else if (customer_lower == "secondlifetime_premium_plus") { getChild<LLUICtrl>("badge_icon")->setValue("Profile_Badge_Pplus_Lifetime"); getChild<LLUICtrl>("badge_text")->setValue(getString("BadgePremiumPlusLifetime")); - childSetVisible("badge_layout", TRUE); - childSetVisible("partner_spacer_layout", FALSE); + childSetVisible("badge_layout", true); + childSetVisible("partner_spacer_layout", false); } else { - childSetVisible("badge_layout", FALSE); - childSetVisible("partner_spacer_layout", TRUE); + childSetVisible("badge_layout", false); + childSetVisible("partner_spacer_layout", true); } } @@ -1118,7 +1164,7 @@ void LLPanelProfileSecondLife::fillAgeData(const LLAvatarData* avatar_data) LLUICtrl* userAgeCtrl = getChild<LLUICtrl>("user_age"); if (hide_age) { - userAgeCtrl->setVisible(FALSE); + userAgeCtrl->setVisible(false); } else { @@ -1129,7 +1175,7 @@ void LLPanelProfileSecondLife::fillAgeData(const LLAvatarData* avatar_data) userAgeCtrl->setValue(register_date); } - BOOL showHideAgeCombo = FALSE; + bool showHideAgeCombo = false; if (getSelfProfile()) { if (LLAvatarPropertiesProcessor::getInstance()->isHideAgeSupportedByServer()) @@ -1139,15 +1185,15 @@ void LLPanelProfileSecondLife::fillAgeData(const LLAvatarData* avatar_data) if (now - birth > 365 * 24 * 60 * 60) { mHideAge = avatar_data->hide_age; - mHideAgeCombo->setValue(mHideAge ? TRUE : FALSE); - showHideAgeCombo = TRUE; + mHideAgeCombo->setValue(mHideAge); + showHideAgeCombo = true; } } } mHideAgeCombo->setVisible(showHideAgeCombo); } -void LLPanelProfileSecondLife::onImageLoaded(BOOL success, LLViewerFetchedTexture *imagep) +void LLPanelProfileSecondLife::onImageLoaded(bool success, LLViewerFetchedTexture *imagep) { LLRect imageRect = mSecondLifePicLayout->getRect(); if (!success || imagep->getFullWidth() == imagep->getFullHeight()) @@ -1179,7 +1225,7 @@ void LLPanelProfileSecondLife::onChange(EStatusType status, const LLSD& channelI return; } - mVoiceStatus = LLAvatarActions::canCall() && (LLAvatarActions::isFriend(getAvatarId()) ? LLAvatarTracker::instance().isBuddyOnline(getAvatarId()) : TRUE); + mVoiceStatus = LLAvatarActions::canCall() && (LLAvatarActions::isFriend(getAvatarId()) ? LLAvatarTracker::instance().isBuddyOnline(getAvatarId()) : true); } void LLPanelProfileSecondLife::setAvatarId(const LLUUID& avatar_id) @@ -1232,12 +1278,12 @@ void LLPanelProfileSecondLife::setLoaded() if (getSelfProfile()) { - mShowInSearchCombo->setEnabled(TRUE); + mShowInSearchCombo->setEnabled(true); if (mHideAgeCombo->getVisible()) { - mHideAgeCombo->setEnabled(TRUE); + mHideAgeCombo->setEnabled(true); } - mDescriptionEdit->setEnabled(TRUE); + mDescriptionEdit->setEnabled(true); } } @@ -1384,7 +1430,7 @@ void LLPanelProfileSecondLife::onCommitMenu(const LLSD& userdata) else if (item_name == "copy_user_id") { LLWString wstr = utf8str_to_wstring(getAvatarId().asString()); - LLClipboard::instance().copyToClipboard(wstr, 0, wstr.size()); + LLClipboard::instance().copyToClipboard(wstr, 0, static_cast<S32>(wstr.size())); } else if (item_name == "copy_profile_link") { @@ -1414,7 +1460,7 @@ void LLPanelProfileSecondLife::onCommitMenu(const LLSD& userdata) { wstr = utf8str_to_wstring(av_name.getUserName()); } - LLClipboard::instance().copyToClipboard(wstr, 0, wstr.size()); + LLClipboard::instance().copyToClipboard(wstr, 0, static_cast<S32>(wstr.size())); } else if (item_name == "edit_display_name") { @@ -1552,8 +1598,8 @@ void LLPanelProfileSecondLife::onAvatarNameCacheSetName(const LLUUID& agent_id, void LLPanelProfileSecondLife::setDescriptionText(const std::string &text) { - mSaveDescriptionChanges->setEnabled(FALSE); - mDiscardDescriptionChanges->setEnabled(FALSE); + mSaveDescriptionChanges->setEnabled(false); + mDiscardDescriptionChanges->setEnabled(false); mHasUnsavedDescriptionChanges = false; mDescriptionText = text; @@ -1562,8 +1608,8 @@ void LLPanelProfileSecondLife::setDescriptionText(const std::string &text) void LLPanelProfileSecondLife::onSetDescriptionDirty() { - mSaveDescriptionChanges->setEnabled(TRUE); - mDiscardDescriptionChanges->setEnabled(TRUE); + mSaveDescriptionChanges->setEnabled(true); + mDiscardDescriptionChanges->setEnabled(true); mHasUnsavedDescriptionChanges = true; } @@ -1592,8 +1638,8 @@ void LLPanelProfileSecondLife::onSaveDescriptionChanges() mDescriptionText = mDescriptionEdit->getValue().asString(); saveAgentUserInfoCoro("sl_about_text", mDescriptionText); - mSaveDescriptionChanges->setEnabled(FALSE); - mDiscardDescriptionChanges->setEnabled(FALSE); + mSaveDescriptionChanges->setEnabled(false); + mDiscardDescriptionChanges->setEnabled(false); mHasUnsavedDescriptionChanges = false; } @@ -1613,15 +1659,15 @@ void LLPanelProfileSecondLife::onShowAgentPermissionsDialog() LLFloaterProfilePermissions * perms = new LLFloaterProfilePermissions(parent_floater, getAvatarId()); mFloaterPermissionsHandle = perms->getHandle(); perms->openFloater(); - perms->setVisibleAndFrontmost(TRUE); + perms->setVisibleAndFrontmost(true); parent_floater->addDependentFloater(mFloaterPermissionsHandle); } } else // already open { - floater->setMinimized(FALSE); - floater->setVisibleAndFrontmost(TRUE); + floater->setMinimized(false); + floater->setVisibleAndFrontmost(true); } } @@ -1649,7 +1695,7 @@ void LLPanelProfileSecondLife::onShowAgentProfileTexture() texture_view->resetAsset(); } texture_view->openFloater(); - texture_view->setVisibleAndFrontmost(TRUE); + texture_view->setVisibleAndFrontmost(true); parent_floater->addDependentFloater(mFloaterProfileTextureHandle); } @@ -1657,8 +1703,8 @@ void LLPanelProfileSecondLife::onShowAgentProfileTexture() else // already open { LLFloaterProfileTexture * texture_view = dynamic_cast<LLFloaterProfileTexture*>(floater); - texture_view->setMinimized(FALSE); - texture_view->setVisibleAndFrontmost(TRUE); + texture_view->setMinimized(false); + texture_view->setVisibleAndFrontmost(true); if (mSecondLifePic->getImageAssetId().notNull()) { texture_view->loadAsset(mSecondLifePic->getImageAssetId()); @@ -1687,12 +1733,12 @@ void LLPanelProfileSecondLife::onShowTexturePicker() mSecondLifePic->getImageAssetId(), LLUUID::null, mSecondLifePic->getImageAssetId(), - FALSE, - FALSE, + false, + false, "SELECT PHOTO", PERM_NONE, PERM_NONE, - FALSE, + false, NULL, PICK_TEXTURE); @@ -1705,20 +1751,20 @@ void LLPanelProfileSecondLife::onShowTexturePicker() onCommitProfileImage(asset_id); } }); - texture_floaterp->setLocalTextureEnabled(FALSE); - texture_floaterp->setBakeTextureEnabled(FALSE); + texture_floaterp->setLocalTextureEnabled(false); + texture_floaterp->setBakeTextureEnabled(false); texture_floaterp->setCanApply(false, true, false); parent_floater->addDependentFloater(mFloaterTexturePickerHandle); texture_floaterp->openFloater(); - texture_floaterp->setFocus(TRUE); + texture_floaterp->setFocus(true); } } else { - floaterp->setMinimized(FALSE); - floaterp->setVisibleAndFrontmost(TRUE); + floaterp->setMinimized(false); + floaterp->setVisibleAndFrontmost(true); } } @@ -1784,13 +1830,13 @@ void LLPanelProfileWeb::onOpen(const LLSD& key) mAvatarNameCacheConnection = LLAvatarNameCache::get(getAvatarId(), boost::bind(&LLPanelProfileWeb::onAvatarNameCache, this, _1, _2)); } -BOOL LLPanelProfileWeb::postBuild() +bool LLPanelProfileWeb::postBuild() { mWebBrowser = getChild<LLMediaCtrl>("profile_html"); mWebBrowser->addObserver(this); mWebBrowser->setHomePageUrl("about:blank"); - return TRUE; + return true; } void LLPanelProfileWeb::resetData() @@ -1805,7 +1851,7 @@ void LLPanelProfileWeb::updateData() { setIsLoading(); - mWebBrowser->setVisible(TRUE); + mWebBrowser->setVisible(true); mPerformanceTimer.start(); mWebBrowser->navigateTo(mURLWebProfile, HTTP_CONTENT_TEXT_HTML); } @@ -1842,7 +1888,7 @@ void LLPanelProfileWeb::onCommitLoad(LLUICtrl* ctrl) LLSD::String valstr = ctrl->getValue().asString(); if (valstr.empty()) { - mWebBrowser->setVisible(TRUE); + mWebBrowser->setVisible(true); mPerformanceTimer.start(); mWebBrowser->navigateTo( mURLHome, HTTP_CONTENT_TEXT_HTML ); } @@ -1911,7 +1957,7 @@ LLPanelProfileFirstLife::~LLPanelProfileFirstLife() { } -BOOL LLPanelProfileFirstLife::postBuild() +bool LLPanelProfileFirstLife::postBuild() { mDescriptionEdit = getChild<LLTextEditor>("fl_description_edit"); mPicture = getChild<LLProfileImageCtrl>("real_world_pic"); @@ -1929,7 +1975,7 @@ BOOL LLPanelProfileFirstLife::postBuild() mDiscardChanges->setCommitCallback([this](LLUICtrl*, void*) { onDiscardDescriptionChanges(); }, nullptr); mDescriptionEdit->setKeystrokeCallback([this](LLTextEditor* caller) { onSetDescriptionDirty(); }); - return TRUE; + return true; } void LLPanelProfileFirstLife::onOpen(const LLSD& key) @@ -1939,7 +1985,7 @@ void LLPanelProfileFirstLife::onOpen(const LLSD& key) if (!getSelfProfile()) { // Otherwise as the only focusable element it will be selected - mDescriptionEdit->setTabStop(FALSE); + mDescriptionEdit->setTabStop(false); } resetData(); @@ -2005,12 +2051,12 @@ void LLPanelProfileFirstLife::onChangePhoto() mPicture->getImageAssetId(), LLUUID::null, mPicture->getImageAssetId(), - FALSE, - FALSE, + false, + false, "SELECT PHOTO", PERM_NONE, PERM_NONE, - FALSE, + false, NULL, PICK_TEXTURE); @@ -2023,19 +2069,19 @@ void LLPanelProfileFirstLife::onChangePhoto() onCommitPhoto(asset_id); } }); - texture_floaterp->setLocalTextureEnabled(FALSE); + texture_floaterp->setLocalTextureEnabled(false); texture_floaterp->setCanApply(false, true, false); parent_floater->addDependentFloater(mFloaterTexturePickerHandle); texture_floaterp->openFloater(); - texture_floaterp->setFocus(TRUE); + texture_floaterp->setFocus(true); } } else { - floaterp->setMinimized(FALSE); - floaterp->setVisibleAndFrontmost(TRUE); + floaterp->setMinimized(false); + floaterp->setVisibleAndFrontmost(true); } } @@ -2065,8 +2111,8 @@ void LLPanelProfileFirstLife::onCommitPhoto(const LLUUID& id) void LLPanelProfileFirstLife::setDescriptionText(const std::string &text) { - mSaveChanges->setEnabled(FALSE); - mDiscardChanges->setEnabled(FALSE); + mSaveChanges->setEnabled(false); + mDiscardChanges->setEnabled(false); mHasUnsavedChanges = false; mCurrentDescription = text; @@ -2075,8 +2121,8 @@ void LLPanelProfileFirstLife::setDescriptionText(const std::string &text) void LLPanelProfileFirstLife::onSetDescriptionDirty() { - mSaveChanges->setEnabled(TRUE); - mDiscardChanges->setEnabled(TRUE); + mSaveChanges->setEnabled(true); + mDiscardChanges->setEnabled(true); mHasUnsavedChanges = true; } @@ -2085,8 +2131,8 @@ void LLPanelProfileFirstLife::onSaveDescriptionChanges() mCurrentDescription = mDescriptionEdit->getValue().asString(); saveAgentUserInfoCoro("fl_about_text", mCurrentDescription); - mSaveChanges->setEnabled(FALSE); - mDiscardChanges->setEnabled(FALSE); + mSaveChanges->setEnabled(false); + mDiscardChanges->setEnabled(false); mHasUnsavedChanges = false; } @@ -2134,8 +2180,8 @@ void LLPanelProfileFirstLife::setLoaded() if (getSelfProfile()) { - mDescriptionEdit->setEnabled(TRUE); - mPicture->setEnabled(TRUE); + mDescriptionEdit->setEnabled(true); + mPicture->setEnabled(true); mRemovePhoto->setEnabled(mPicture->getImageAssetId().notNull()); } } @@ -2163,7 +2209,7 @@ void LLPanelProfileNotes::commitUnsavedChanges() } } -BOOL LLPanelProfileNotes::postBuild() +bool LLPanelProfileNotes::postBuild() { mNotesEditor = getChild<LLTextEditor>("notes_edit"); mSaveChanges = getChild<LLButton>("notes_save_changes"); @@ -2173,7 +2219,7 @@ BOOL LLPanelProfileNotes::postBuild() mDiscardChanges->setCommitCallback([this](LLUICtrl*, void*) { onDiscardNotesChanges(); }, nullptr); mNotesEditor->setKeystrokeCallback([this](LLTextEditor* caller) { onSetNotesDirty(); }); - return TRUE; + return true; } void LLPanelProfileNotes::onOpen(const LLSD& key) @@ -2185,8 +2231,8 @@ void LLPanelProfileNotes::onOpen(const LLSD& key) void LLPanelProfileNotes::setNotesText(const std::string &text) { - mSaveChanges->setEnabled(FALSE); - mDiscardChanges->setEnabled(FALSE); + mSaveChanges->setEnabled(false); + mDiscardChanges->setEnabled(false); mHasUnsavedChanges = false; mCurrentNotes = text; @@ -2195,8 +2241,8 @@ void LLPanelProfileNotes::setNotesText(const std::string &text) void LLPanelProfileNotes::onSetNotesDirty() { - mSaveChanges->setEnabled(TRUE); - mDiscardChanges->setEnabled(TRUE); + mSaveChanges->setEnabled(true); + mDiscardChanges->setEnabled(true); mHasUnsavedChanges = true; } @@ -2205,8 +2251,8 @@ void LLPanelProfileNotes::onSaveNotesChanges() mCurrentNotes = mNotesEditor->getValue().asString(); saveAgentUserInfoCoro("notes", mCurrentNotes); - mSaveChanges->setEnabled(FALSE); - mDiscardChanges->setEnabled(FALSE); + mSaveChanges->setEnabled(false); + mDiscardChanges->setEnabled(false); mHasUnsavedChanges = false; } @@ -2230,7 +2276,7 @@ void LLPanelProfileNotes::processProperties(void* data, EAvatarProcessorType typ void LLPanelProfileNotes::processProperties(const LLAvatarData* avatar_data) { setNotesText(avatar_data->notes); - mNotesEditor->setEnabled(TRUE); + mNotesEditor->setEnabled(true); setLoaded(); } @@ -2253,9 +2299,9 @@ LLPanelProfile::~LLPanelProfile() { } -BOOL LLPanelProfile::postBuild() +bool LLPanelProfile::postBuild() { - return TRUE; + return true; } void LLPanelProfile::onTabChange() diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h index f0c0565628..c207a4162a 100644 --- a/indra/newview/llpanelprofile.h +++ b/indra/newview/llpanelprofile.h @@ -78,6 +78,12 @@ public: void onOpen(const LLSD& key) override; + bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg) override; + /** * LLFriendObserver trigger */ @@ -89,7 +95,7 @@ public: void setAvatarId(const LLUUID& avatar_id) override; - BOOL postBuild() override; + bool postBuild() override; void resetData() override; @@ -136,7 +142,7 @@ protected: */ void fillAgeData(const LLAvatarData* avatar_data); - void onImageLoaded(BOOL success, LLViewerFetchedTexture *imagep); + void onImageLoaded(bool success, LLViewerFetchedTexture *imagep); /** * Displays avatar's online status if possible. @@ -219,7 +225,7 @@ public: void onOpen(const LLSD& key) override; - BOOL postBuild() override; + bool postBuild() override; void resetData() override; @@ -258,7 +264,7 @@ public: void onOpen(const LLSD& key) override; - BOOL postBuild() override; + bool postBuild() override; void processProperties(void* data, EAvatarProcessorType type) override; void processProperties(const LLAvatarData* avatar_data); @@ -309,7 +315,7 @@ public: void onOpen(const LLSD& key) override; - BOOL postBuild() override; + bool postBuild() override; void processProperties(void* data, EAvatarProcessorType type) override; void processProperties(const LLAvatarData* avatar_data); @@ -344,7 +350,7 @@ public: LLPanelProfile(); /*virtual*/ ~LLPanelProfile(); - BOOL postBuild() override; + bool postBuild() override; void updateData() override; void refreshName(); diff --git a/indra/newview/llpanelprofileclassifieds.cpp b/indra/newview/llpanelprofileclassifieds.cpp index 7ec657d069..62829b0745 100644 --- a/indra/newview/llpanelprofileclassifieds.cpp +++ b/indra/newview/llpanelprofileclassifieds.cpp @@ -135,7 +135,7 @@ public: // get the ID for the classified LLUUID classified_id; - if (!classified_id.set(params[0], FALSE)) + if (!classified_id.set(params[0], false)) { return false; } @@ -241,11 +241,11 @@ void LLPanelProfileClassifieds::onOpen(const LLSD& key) bool own_profile = getSelfProfile(); if (own_profile) { - mNewButton->setVisible(TRUE); - mNewButton->setEnabled(FALSE); + mNewButton->setVisible(true); + mNewButton->setEnabled(false); - mDeleteButton->setVisible(TRUE); - mDeleteButton->setEnabled(FALSE); + mDeleteButton->setVisible(true); + mDeleteButton->setEnabled(false); } childSetVisible("buttons_header", own_profile); @@ -266,7 +266,7 @@ void LLPanelProfileClassifieds::selectClassified(const LLUUID& classified_id, bo mTabContainer->selectTabPanel(classified_panel); if (edit) { - classified_panel->setEditMode(TRUE); + classified_panel->setEditMode(true); } break; } @@ -284,7 +284,7 @@ void LLPanelProfileClassifieds::createClassified() { if (getIsLoaded()) { - mNoItemsLabel->setVisible(FALSE); + mNoItemsLabel->setVisible(false); LLPanelProfileClassified* classified_panel = LLPanelProfileClassified::create(); classified_panel->onOpen(LLSD()); mTabContainer->addTabPanel( @@ -300,7 +300,7 @@ void LLPanelProfileClassifieds::createClassified() } } -BOOL LLPanelProfileClassifieds::postBuild() +bool LLPanelProfileClassifieds::postBuild() { mTabContainer = getChild<LLTabContainer>("tab_classifieds"); mNoItemsLabel = getChild<LLUICtrl>("classifieds_panel_text"); @@ -310,12 +310,12 @@ BOOL LLPanelProfileClassifieds::postBuild() mNewButton->setCommitCallback(boost::bind(&LLPanelProfileClassifieds::onClickNewBtn, this)); mDeleteButton->setCommitCallback(boost::bind(&LLPanelProfileClassifieds::onClickDelete, this)); - return TRUE; + return true; } void LLPanelProfileClassifieds::onClickNewBtn() { - mNoItemsLabel->setVisible(FALSE); + mNoItemsLabel->setVisible(false); LLPanelProfileClassified* classified_panel = LLPanelProfileClassified::create(); classified_panel->onOpen(LLSD()); mTabContainer->addTabPanel( @@ -364,7 +364,7 @@ void LLPanelProfileClassifieds::callbackDeleteClassified(const LLSD& notificatio updateButtons(); - BOOL no_data = !mTabContainer->getTabCount(); + bool no_data = !mTabContainer->getTabCount(); mNoItemsLabel->setVisible(no_data); } } @@ -474,7 +474,7 @@ void LLPanelProfileClassifieds::updateData() { setIsLoading(); mNoItemsLabel->setValue(LLTrans::getString("PicksClassifiedsLoadingText")); - mNoItemsLabel->setVisible(TRUE); + mNoItemsLabel->setVisible(true); LLAvatarPropertiesProcessor::getInstance()->sendAvatarClassifiedsRequest(avatar_id); } @@ -605,7 +605,7 @@ LLPanelProfileClassified* LLPanelProfileClassified::create() return panel; } -BOOL LLPanelProfileClassified::postBuild() +bool LLPanelProfileClassified::postBuild() { mScrollContainer = getChild<LLScrollContainer>("profile_scroll"); mInfoPanel = getChild<LLView>("info_panel"); @@ -650,8 +650,8 @@ BOOL LLPanelProfileClassified::postBuild() mSnapshotCtrl->setOnSelectCallback(boost::bind(&LLPanelProfileClassified::onTextureSelected, this)); mSnapshotCtrl->setMouseEnterCallback(boost::bind(&LLPanelProfileClassified::onTexturePickerMouseEnter, this)); mSnapshotCtrl->setMouseLeaveCallback(boost::bind(&LLPanelProfileClassified::onTexturePickerMouseLeave, this)); - mSnapshotCtrl->setAllowLocalTexture(FALSE); - mSnapshotCtrl->setBakeTextureEnabled(FALSE); + mSnapshotCtrl->setAllowLocalTexture(false); + mSnapshotCtrl->setBakeTextureEnabled(false); mEditIcon->setVisible(false); mMapButton->setCommitCallback(boost::bind(&LLPanelProfileClassified::onMapClick, this)); @@ -675,7 +675,7 @@ BOOL LLPanelProfileClassified::postBuild() mContentTypeCombo->setCommitCallback(boost::bind(&LLPanelProfileClassified::onChange, this)); mAutoRenewEdit->setCommitCallback(boost::bind(&LLPanelProfileClassified::onChange, this)); - return TRUE; + return true; } void LLPanelProfileClassified::onOpen(const LLSD& key) @@ -720,7 +720,7 @@ void LLPanelProfileClassified::onOpen(const LLSD& key) mSaveButton->setLabelArg("[LABEL]", getString("publish_label")); - setEditMode(TRUE); + setEditMode(true); enableSave(true); enableEditing(true); resetDirty(); @@ -793,7 +793,7 @@ void LLPanelProfileClassified::processProperties(void* data, EAvatarProcessorTyp if (mIsNewWithErrors) { // We just published it - setEditMode(FALSE); + setEditMode(false); } mIsNewWithErrors = false; mIsNew = false; @@ -841,13 +841,13 @@ void LLPanelProfileClassified::processProperties(void* data, EAvatarProcessorTyp if (mEditOnLoad) { - setEditMode(TRUE); + setEditMode(true); } } } -void LLPanelProfileClassified::setEditMode(BOOL edit_mode) +void LLPanelProfileClassified::setEditMode(bool edit_mode) { mEditMode = edit_mode; @@ -883,7 +883,7 @@ void LLPanelProfileClassified::updateInfoRect() // info_scroll_content_panel contains both info and edit panel // info panel can be very large and scroll bar will carry over. // Resize info panel to prevent scroll carry over when in edit mode. - mInfoScroll->reshape(mInfoScroll->getRect().getWidth(), DEFAULT_EDIT_CLASSIFIED_SCROLL_HEIGHT, FALSE); + mInfoScroll->reshape(mInfoScroll->getRect().getWidth(), DEFAULT_EDIT_CLASSIFIED_SCROLL_HEIGHT, false); } else { @@ -893,7 +893,7 @@ void LLPanelProfileClassified::updateInfoRect() S32 delta_height = new_height - visible_rect.getHeight() + 5; LLRect rect = mInfoScroll->getRect(); - mInfoScroll->reshape(rect.getWidth(), rect.getHeight() + delta_height, FALSE); + mInfoScroll->reshape(rect.getWidth(), rect.getHeight() + delta_height, false); } } @@ -920,7 +920,7 @@ void LLPanelProfileClassified::resetControls() void LLPanelProfileClassified::onEditClick() { - setEditMode(TRUE); + setEditMode(true); } void LLPanelProfileClassified::onCancelClick() @@ -945,7 +945,7 @@ void LLPanelProfileClassified::onCancelClick() setInfoLoaded(false); - setEditMode(FALSE); + setEditMode(false); } void LLPanelProfileClassified::onSaveClick() @@ -1032,8 +1032,8 @@ void LLPanelProfileClassified::resetData() getChild<LLUICtrl>("click_through_text")->setValue(LLStringUtil::null); mEditButton->setValue(LLStringUtil::null); getChild<LLUICtrl>("creation_date")->setValue(LLStringUtil::null); - mContentTypeM->setVisible(FALSE); - mContentTypeG->setVisible(FALSE); + mContentTypeM->setVisible(false); + mContentTypeG->setVisible(false); } void LLPanelProfileClassified::setClassifiedName(const std::string& name) @@ -1242,14 +1242,14 @@ void LLPanelProfileClassified::onTeleportClick() } } -BOOL LLPanelProfileClassified::isDirty() const +bool LLPanelProfileClassified::isDirty() const { if(mIsNew) { - return TRUE; + return true; } - BOOL dirty = false; + bool dirty = false; dirty |= mSnapshotCtrl->isDirty(); dirty |= mClassifiedNameEdit->isDirty(); dirty |= mClassifiedDescEdit->isDirty(); @@ -1429,7 +1429,7 @@ void LLPanelProfileClassified::doSave() if (!isNew() && !isNewWithErrors()) { - setEditMode(FALSE); + setEditMode(false); return; } @@ -1487,12 +1487,12 @@ void LLPanelProfileClassified::notifyInvalidName() void LLPanelProfileClassified::onTexturePickerMouseEnter() { - mEditIcon->setVisible(TRUE); + mEditIcon->setVisible(true); } void LLPanelProfileClassified::onTexturePickerMouseLeave() { - mEditIcon->setVisible(FALSE); + mEditIcon->setVisible(false); } void LLPanelProfileClassified::onTextureSelected() @@ -1525,14 +1525,14 @@ LLPublishClassifiedFloater::~LLPublishClassifiedFloater() { } -BOOL LLPublishClassifiedFloater::postBuild() +bool LLPublishClassifiedFloater::postBuild() { LLFloater::postBuild(); childSetAction("publish_btn", boost::bind(&LLFloater::closeFloater, this, false)); childSetAction("cancel_btn", boost::bind(&LLFloater::closeFloater, this, false)); - return TRUE; + return true; } void LLPublishClassifiedFloater::setPrice(S32 price) diff --git a/indra/newview/llpanelprofileclassifieds.h b/indra/newview/llpanelprofileclassifieds.h index 76e6eb6808..42cd5f8975 100644 --- a/indra/newview/llpanelprofileclassifieds.h +++ b/indra/newview/llpanelprofileclassifieds.h @@ -54,7 +54,7 @@ public: LLPublishClassifiedFloater(const LLSD& key); virtual ~LLPublishClassifiedFloater(); - BOOL postBuild() override; + bool postBuild() override; void setPrice(S32 price); S32 getPrice(); @@ -74,7 +74,7 @@ public: LLPanelProfileClassifieds(); /*virtual*/ ~LLPanelProfileClassifieds(); - BOOL postBuild() override; + bool postBuild() override; void onOpen(const LLSD& key) override; @@ -125,7 +125,7 @@ public: /*virtual*/ ~LLPanelProfileClassified(); - BOOL postBuild() override; + bool postBuild() override; void onOpen(const LLSD& key) override; @@ -171,7 +171,7 @@ public: void setInfoLoaded(bool loaded) { mInfoLoaded = loaded; } - BOOL isDirty() const override; + bool isDirty() const override; void resetDirty() override; @@ -193,7 +193,7 @@ public: S32 getPriceForListing() { return mPriceForListing; } - void setEditMode(BOOL edit_mode); + void setEditMode(bool edit_mode); bool getEditMode() {return mEditMode;} static void setClickThrough( diff --git a/indra/newview/llpanelprofilepicks.cpp b/indra/newview/llpanelprofilepicks.cpp index b097e637a4..08f3d3af5a 100644 --- a/indra/newview/llpanelprofilepicks.cpp +++ b/indra/newview/llpanelprofilepicks.cpp @@ -113,7 +113,7 @@ public: // get the ID for the pick_id LLUUID pick_id; - if (!pick_id.set(params[0], FALSE)) + if (!pick_id.set(params[0], false)) { return false; } @@ -159,11 +159,11 @@ void LLPanelProfilePicks::onOpen(const LLSD& key) bool own_profile = getSelfProfile(); if (own_profile) { - mNewButton->setVisible(TRUE); - mNewButton->setEnabled(FALSE); + mNewButton->setVisible(true); + mNewButton->setEnabled(false); - mDeleteButton->setVisible(TRUE); - mDeleteButton->setEnabled(FALSE); + mDeleteButton->setVisible(true); + mDeleteButton->setEnabled(false); } childSetVisible("buttons_header", own_profile); @@ -175,7 +175,7 @@ void LLPanelProfilePicks::createPick(const LLPickData &data) { if (canAddNewPick()) { - mNoItemsLabel->setVisible(FALSE); + mNoItemsLabel->setVisible(false); LLPanelProfilePick* pick_panel = LLPanelProfilePick::create(); pick_panel->setAvatarId(getAvatarId()); pick_panel->processProperties(&data); @@ -222,7 +222,7 @@ void LLPanelProfilePicks::selectPick(const LLUUID& pick_id) } } -BOOL LLPanelProfilePicks::postBuild() +bool LLPanelProfilePicks::postBuild() { mTabContainer = getChild<LLTabContainer>("tab_picks"); mNoItemsLabel = getChild<LLUICtrl>("picks_panel_text"); @@ -232,12 +232,12 @@ BOOL LLPanelProfilePicks::postBuild() mNewButton->setCommitCallback(boost::bind(&LLPanelProfilePicks::onClickNewBtn, this)); mDeleteButton->setCommitCallback(boost::bind(&LLPanelProfilePicks::onClickDelete, this)); - return TRUE; + return true; } void LLPanelProfilePicks::onClickNewBtn() { - mNoItemsLabel->setVisible(FALSE); + mNoItemsLabel->setVisible(false); LLPanelProfilePick* pick_panel = LLPanelProfilePick::create(); pick_panel->setAvatarId(getAvatarId()); mTabContainer->addTabPanel( @@ -431,7 +431,7 @@ void LLPanelProfilePicks::updateData() if (!getIsLoaded()) { mNoItemsLabel->setValue(LLTrans::getString("PicksClassifiedsLoadingText")); - mNoItemsLabel->setVisible(TRUE); + mNoItemsLabel->setVisible(true); } } @@ -556,29 +556,29 @@ void LLPanelProfilePick::setAvatarId(const LLUUID& avatar_id) setSnapshotId(snapshot_id); setPickLocation(createLocationText(getLocationNotice(), pick_name, region_name, getPosGlobal())); - enableSaveButton(TRUE); + enableSaveButton(true); } else { LLAvatarPropertiesProcessor::getInstance()->sendPickInfoRequest(getAvatarId(), getPickId()); - enableSaveButton(FALSE); + enableSaveButton(false); } resetDirty(); if (getSelfProfile()) { - mPickName->setEnabled(TRUE); - mPickDescription->setEnabled(TRUE); + mPickName->setEnabled(true); + mPickDescription->setEnabled(true); } else { - mSnapshotCtrl->setEnabled(FALSE); + mSnapshotCtrl->setEnabled(false); } } -BOOL LLPanelProfilePick::postBuild() +bool LLPanelProfilePick::postBuild() { mPickName = getChild<LLLineEditor>("pick_name"); mPickDescription = getChild<LLTextEditor>("pick_desc"); @@ -588,8 +588,8 @@ BOOL LLPanelProfilePick::postBuild() mSnapshotCtrl = getChild<LLTextureCtrl>("pick_snapshot"); mSnapshotCtrl->setCommitCallback(boost::bind(&LLPanelProfilePick::onSnapshotChanged, this)); - mSnapshotCtrl->setAllowLocalTexture(FALSE); - mSnapshotCtrl->setBakeTextureEnabled(FALSE); + mSnapshotCtrl->setAllowLocalTexture(false); + mSnapshotCtrl->setBakeTextureEnabled(false); childSetAction("teleport_btn", boost::bind(&LLPanelProfilePick::onClickTeleport, this)); childSetAction("show_on_map_btn", boost::bind(&LLPanelProfilePick::onClickMap, this)); @@ -599,14 +599,14 @@ BOOL LLPanelProfilePick::postBuild() mCancelButton->setCommitCallback(boost::bind(&LLPanelProfilePick::onClickCancel, this)); mPickName->setKeystrokeCallback(boost::bind(&LLPanelProfilePick::onPickChanged, this, _1), NULL); - mPickName->setEnabled(FALSE); + mPickName->setEnabled(false); mPickDescription->setKeystrokeCallback(boost::bind(&LLPanelProfilePick::onPickChanged, this, _1)); mPickDescription->setFocusReceivedCallback(boost::bind(&LLPanelProfilePick::onDescriptionFocusReceived, this)); - getChild<LLUICtrl>("pick_location")->setEnabled(FALSE); + getChild<LLUICtrl>("pick_location")->setEnabled(false); - return TRUE; + return true; } void LLPanelProfilePick::onDescriptionFocusReceived() @@ -644,7 +644,7 @@ void LLPanelProfilePick::processProperties(const LLPickData* pick_info) setSnapshotId(pick_info->snapshot_id); if (!getSelfProfile()) { - mSnapshotCtrl->setEnabled(FALSE); + mSnapshotCtrl->setEnabled(false); } setPickName(pick_info->name); setPickDesc(pick_info->desc); @@ -672,7 +672,7 @@ void LLPanelProfilePick::apply() void LLPanelProfilePick::setSnapshotId(const LLUUID& id) { mSnapshotCtrl->setImageAssetID(id); - mSnapshotCtrl->setValid(TRUE); + mSnapshotCtrl->setValid(true); } void LLPanelProfilePick::setPickName(const std::string& name) @@ -711,7 +711,7 @@ void LLPanelProfilePick::onClickTeleport() } } -void LLPanelProfilePick::enableSaveButton(BOOL enable) +void LLPanelProfilePick::enableSaveButton(bool enable) { childSetVisible("save_changes_lp", enable); @@ -722,7 +722,7 @@ void LLPanelProfilePick::enableSaveButton(BOOL enable) void LLPanelProfilePick::onSnapshotChanged() { - enableSaveButton(TRUE); + enableSaveButton(true); } void LLPanelProfilePick::onPickChanged(LLUICtrl* ctrl) @@ -745,7 +745,7 @@ void LLPanelProfilePick::resetDirty() mLocationChanged = false; } -BOOL LLPanelProfilePick::isDirty() const +bool LLPanelProfilePick::isDirty() const { if (mNewPick || LLPanel::isDirty() @@ -754,9 +754,9 @@ BOOL LLPanelProfilePick::isDirty() const || mPickName->isDirty() || mPickDescription->isDirty()) { - return TRUE; + return true; } - return FALSE; + return false; } void LLPanelProfilePick::onClickSave() @@ -779,7 +779,7 @@ void LLPanelProfilePick::onClickCancel() updateTabLabel(mPickNameStr); LLAvatarPropertiesProcessor::getInstance()->sendPickInfoRequest(getAvatarId(), getPickId()); mLocationChanged = false; - enableSaveButton(FALSE); + enableSaveButton(false); } std::string LLPanelProfilePick::getLocationNotice() @@ -833,14 +833,14 @@ void LLPanelProfilePick::sendUpdate() pick_data.creator_id = gAgentID;; //legacy var need to be deleted - pick_data.top_pick = FALSE; + pick_data.top_pick = false; pick_data.parcel_id = mParcelId; pick_data.name = getPickName(); pick_data.desc = mPickDescription->getValue().asString(); pick_data.snapshot_id = mSnapshotCtrl->getImageAssetID(); pick_data.pos_global = getPosGlobal(); pick_data.sort_order = 0; - pick_data.enabled = TRUE; + pick_data.enabled = true; LLAvatarPropertiesProcessor::getInstance()->sendPickInfoUpdate(&pick_data); diff --git a/indra/newview/llpanelprofilepicks.h b/indra/newview/llpanelprofilepicks.h index 90c527e0f3..e3f50f5576 100644 --- a/indra/newview/llpanelprofilepicks.h +++ b/indra/newview/llpanelprofilepicks.h @@ -50,7 +50,7 @@ public: LLPanelProfilePicks(); /*virtual*/ ~LLPanelProfilePicks(); - BOOL postBuild() override; + bool postBuild() override; void onOpen(const LLSD& key) override; @@ -108,7 +108,7 @@ public: /*virtual*/ ~LLPanelProfilePick(); - BOOL postBuild() override; + bool postBuild() override; void setAvatarId(const LLUUID& avatar_id) override; @@ -124,7 +124,7 @@ public: /** * Returns true if any of Pick properties was changed by user. */ - BOOL isDirty() const override; + bool isDirty() const override; /** * Saves changes. @@ -182,7 +182,7 @@ public: /** * Enables/disables "Save" button */ - void enableSaveButton(BOOL enable); + void enableSaveButton(bool enable); /** * Called when snapshot image changes. diff --git a/indra/newview/llpanelpulldown.cpp b/indra/newview/llpanelpulldown.cpp index 075278f44c..f26a9dc362 100644 --- a/indra/newview/llpanelpulldown.cpp +++ b/indra/newview/llpanelpulldown.cpp @@ -51,35 +51,35 @@ void LLPanelPulldown::onMouseEnter(S32 x, S32 y, MASK mask) /*virtual*/ void LLPanelPulldown::onTopLost() { - setFocus(FALSE); // drop focus to prevent transfer to parent - setVisible(FALSE); + setFocus(false); // drop focus to prevent transfer to parent + setVisible(false); } /*virtual*/ -BOOL LLPanelPulldown::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLPanelPulldown::handleMouseDown(S32 x, S32 y, MASK mask) { LLPanel::handleMouseDown(x, y, mask); - return TRUE; + return true; } /*virtual*/ -BOOL LLPanelPulldown::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLPanelPulldown::handleRightMouseDown(S32 x, S32 y, MASK mask) { LLPanel::handleRightMouseDown(x, y, mask); - return TRUE; + return true; } /*virtual*/ -BOOL LLPanelPulldown::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLPanelPulldown::handleDoubleClick(S32 x, S32 y, MASK mask) { LLPanel::handleDoubleClick(x, y, mask); - return TRUE; + return true; } -BOOL LLPanelPulldown::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLPanelPulldown::handleScrollWheel(S32 x, S32 y, S32 clicks) { LLPanel::handleScrollWheel(x, y, clicks); - return TRUE; //If we got here, then we are in Pulldown's rect, consume the event. + return true; //If we got here, then we are in Pulldown's rect, consume the event. } /*virtual*/ @@ -90,7 +90,7 @@ void LLPanelPulldown::onMouseLeave(S32 x, S32 y, MASK mask) } /*virtual*/ -void LLPanelPulldown::onVisibilityChange(BOOL new_visibility) +void LLPanelPulldown::onVisibilityChange(bool new_visibility) { if (new_visibility) { @@ -114,7 +114,7 @@ void LLPanelPulldown::draw() if (alpha == 0.f) { - setFocus(FALSE); // drop focus to prevent transfer to parent - setVisible(FALSE); + setFocus(false); // drop focus to prevent transfer to parent + setVisible(false); } } diff --git a/indra/newview/llpanelpulldown.h b/indra/newview/llpanelpulldown.h index 1bb13d91f9..850ea09664 100644 --- a/indra/newview/llpanelpulldown.h +++ b/indra/newview/llpanelpulldown.h @@ -37,16 +37,16 @@ class LLPanelPulldown : public LLPanel { public: LLPanelPulldown(); - /*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask); - /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); - /*virtual*/ void onTopLost(); - /*virtual*/ void onVisibilityChange(BOOL new_visibility); - - /*virtual*/ void draw(); + void onMouseEnter(S32 x, S32 y, MASK mask) override; + void onMouseLeave(S32 x, S32 y, MASK mask) override; + bool handleMouseDown(S32 x, S32 y, MASK mask) override; + bool handleRightMouseDown(S32 x, S32 y, MASK mask) override; + bool handleDoubleClick(S32 x, S32 y, MASK mask) override; + bool handleScrollWheel(S32 x, S32 y, S32 clicks) override; + void onTopLost() override; + void onVisibilityChange(bool new_visibility) override; + + void draw() override; protected: LLFrameTimer mHoverTimer; diff --git a/indra/newview/llpanelsnapshot.cpp b/indra/newview/llpanelsnapshot.cpp index bd44a2139f..2536dce606 100644 --- a/indra/newview/llpanelsnapshot.cpp +++ b/indra/newview/llpanelsnapshot.cpp @@ -41,7 +41,7 @@ #include "llagentbenefits.h" -const S32 MAX_TEXTURE_SIZE = 512 ; //max upload texture size 512 * 512 +constexpr S32 MAX_TEXTURE_SIZE = 512 ; //max upload texture size 512 * 512 S32 power_of_two(S32 sz, S32 upper) { @@ -59,7 +59,7 @@ LLPanelSnapshot::LLPanelSnapshot() {} // virtual -BOOL LLPanelSnapshot::postBuild() +bool LLPanelSnapshot::postBuild() { getChild<LLUICtrl>("save_btn")->setLabelArg("[UPLOAD_COST]", std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost())); getChild<LLUICtrl>(getImageSizeComboName())->setCommitCallback(boost::bind(&LLPanelSnapshot::onResolutionComboCommit, this, _1)); @@ -78,7 +78,7 @@ BOOL LLPanelSnapshot::postBuild() updateControls(LLSD()); mSnapshotFloater = getParentByType<LLFloaterSnapshotBase>(); - return TRUE; + return true; } // virtual @@ -104,7 +104,7 @@ LLSnapshotModel::ESnapshotFormat LLPanelSnapshot::getImageFormat() const return LLSnapshotModel::SNAPSHOT_FORMAT_JPEG; } -void LLPanelSnapshot::enableControls(BOOL enable) +void LLPanelSnapshot::enableControls(bool enable) { setCtrlsEnabled(enable); } @@ -133,7 +133,7 @@ S32 LLPanelSnapshot::getTypedPreviewHeight() const return getChild<LLUICtrl>(getHeightSpinnerName())->getValue().asInteger(); } -void LLPanelSnapshot::enableAspectRatioCheckbox(BOOL enable) +void LLPanelSnapshot::enableAspectRatioCheckbox(bool enable) { llassert(!getAspectRatioCBName().empty()); getChild<LLUICtrl>(getAspectRatioCBName())->setEnabled(enable); diff --git a/indra/newview/llpanelsnapshot.h b/indra/newview/llpanelsnapshot.h index a960ee8fe1..3f5ad274b8 100644 --- a/indra/newview/llpanelsnapshot.h +++ b/indra/newview/llpanelsnapshot.h @@ -43,8 +43,8 @@ class LLPanelSnapshot: public LLPanel public: LLPanelSnapshot(); - /*virtual*/ BOOL postBuild(); - /*virtual*/ void onOpen(const LLSD& key); + bool postBuild() override; + void onOpen(const LLSD& key) override; virtual std::string getWidthSpinnerName() const = 0; virtual std::string getHeightSpinnerName() const = 0; @@ -56,11 +56,11 @@ public: virtual S32 getTypedPreviewHeight() const; virtual LLSpinCtrl* getWidthSpinner(); virtual LLSpinCtrl* getHeightSpinner(); - virtual void enableAspectRatioCheckbox(BOOL enable); + virtual void enableAspectRatioCheckbox(bool enable); virtual LLSnapshotModel::ESnapshotFormat getImageFormat() const; virtual LLSnapshotModel::ESnapshotType getSnapshotType(); virtual void updateControls(const LLSD& info) = 0; ///< Update controls from saved settings - void enableControls(BOOL enable); + void enableControls(bool enable); protected: LLSideTrayPanelContainer* getParentContainer(); diff --git a/indra/newview/llpanelsnapshotinventory.cpp b/indra/newview/llpanelsnapshotinventory.cpp index 3092ea3b18..4abb89120b 100644 --- a/indra/newview/llpanelsnapshotinventory.cpp +++ b/indra/newview/llpanelsnapshotinventory.cpp @@ -50,7 +50,7 @@ class LLPanelSnapshotInventoryBase public: LLPanelSnapshotInventoryBase(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); protected: void onSend(); /*virtual*/ LLSnapshotModel::ESnapshotType getSnapshotType(); @@ -63,7 +63,7 @@ class LLPanelSnapshotInventory public: LLPanelSnapshotInventory(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void onOpen(const LLSD& key); void onResolutionCommit(LLUICtrl* ctrl); @@ -85,7 +85,7 @@ class LLPanelOutfitSnapshotInventory public: LLPanelOutfitSnapshotInventory(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void onOpen(const LLSD& key); private: @@ -107,7 +107,7 @@ LLPanelSnapshotInventoryBase::LLPanelSnapshotInventoryBase() { } -BOOL LLPanelSnapshotInventoryBase::postBuild() +bool LLPanelSnapshotInventoryBase::postBuild() { return LLPanelSnapshot::postBuild(); } @@ -124,10 +124,10 @@ LLPanelSnapshotInventory::LLPanelSnapshotInventory() } // virtual -BOOL LLPanelSnapshotInventory::postBuild() +bool LLPanelSnapshotInventory::postBuild() { - getChild<LLSpinCtrl>(getWidthSpinnerName())->setAllowEdit(FALSE); - getChild<LLSpinCtrl>(getHeightSpinnerName())->setAllowEdit(FALSE); + getChild<LLSpinCtrl>(getWidthSpinnerName())->setAllowEdit(false); + getChild<LLSpinCtrl>(getHeightSpinnerName())->setAllowEdit(false); getChild<LLUICtrl>(getImageSizeComboName())->setCommitCallback(boost::bind(&LLPanelSnapshotInventory::onResolutionCommit, this, _1)); return LLPanelSnapshotInventoryBase::postBuild(); @@ -148,7 +148,7 @@ void LLPanelSnapshotInventory::updateControls(const LLSD& info) void LLPanelSnapshotInventory::onResolutionCommit(LLUICtrl* ctrl) { - BOOL current_window_selected = (getChild<LLComboBox>(getImageSizeComboName())->getCurrentIndex() == 3); + bool current_window_selected = (getChild<LLComboBox>(getImageSizeComboName())->getCurrentIndex() == 3); getChild<LLSpinCtrl>(getWidthSpinnerName())->setVisible(!current_window_selected); getChild<LLSpinCtrl>(getHeightSpinnerName())->setVisible(!current_window_selected); } @@ -183,7 +183,7 @@ LLPanelOutfitSnapshotInventory::LLPanelOutfitSnapshotInventory() } // virtual -BOOL LLPanelOutfitSnapshotInventory::postBuild() +bool LLPanelOutfitSnapshotInventory::postBuild() { return LLPanelSnapshotInventoryBase::postBuild(); } diff --git a/indra/newview/llpanelsnapshotlocal.cpp b/indra/newview/llpanelsnapshotlocal.cpp index bcb1022c81..366030c0fa 100644 --- a/indra/newview/llpanelsnapshotlocal.cpp +++ b/indra/newview/llpanelsnapshotlocal.cpp @@ -47,7 +47,7 @@ class LLPanelSnapshotLocal public: LLPanelSnapshotLocal(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void onOpen(const LLSD& key); private: @@ -79,7 +79,7 @@ LLPanelSnapshotLocal::LLPanelSnapshotLocal() } // virtual -BOOL LLPanelSnapshotLocal::postBuild() +bool LLPanelSnapshotLocal::postBuild() { getChild<LLUICtrl>("image_quality_slider")->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onQualitySliderCommit, this, _1)); getChild<LLUICtrl>("local_format_combo")->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onFormatComboCommit, this, _1)); diff --git a/indra/newview/llpanelsnapshotoptions.cpp b/indra/newview/llpanelsnapshotoptions.cpp index 28e1f33b16..776de460a9 100644 --- a/indra/newview/llpanelsnapshotoptions.cpp +++ b/indra/newview/llpanelsnapshotoptions.cpp @@ -46,7 +46,7 @@ class LLPanelSnapshotOptions public: LLPanelSnapshotOptions(); ~LLPanelSnapshotOptions(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void onOpen(const LLSD& key); private: @@ -75,7 +75,7 @@ LLPanelSnapshotOptions::~LLPanelSnapshotOptions() } // virtual -BOOL LLPanelSnapshotOptions::postBuild() +bool LLPanelSnapshotOptions::postBuild() { mSnapshotFloater = getParentByType<LLFloaterSnapshotBase>(); return LLPanel::postBuild(); diff --git a/indra/newview/llpanelsnapshotpostcard.cpp b/indra/newview/llpanelsnapshotpostcard.cpp index 3a25e471bb..23e8789e3f 100644 --- a/indra/newview/llpanelsnapshotpostcard.cpp +++ b/indra/newview/llpanelsnapshotpostcard.cpp @@ -56,7 +56,7 @@ class LLPanelSnapshotPostcard public: LLPanelSnapshotPostcard(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void onOpen(const LLSD& key); private: @@ -92,12 +92,12 @@ LLPanelSnapshotPostcard::LLPanelSnapshotPostcard() } // virtual -BOOL LLPanelSnapshotPostcard::postBuild() +bool LLPanelSnapshotPostcard::postBuild() { // For the first time a user focuses to .the msg box, all text will be selected. getChild<LLUICtrl>("msg_form")->setFocusChangedCallback(boost::bind(&LLPanelSnapshotPostcard::onMsgFormFocusRecieved, this)); - getChild<LLUICtrl>("to_form")->setFocus(TRUE); + getChild<LLUICtrl>("to_form")->setFocus(true); getChild<LLUICtrl>("image_quality_slider")->setCommitCallback(boost::bind(&LLPanelSnapshotPostcard::onQualitySliderCommit, this, _1)); diff --git a/indra/newview/llpanelsnapshotprofile.cpp b/indra/newview/llpanelsnapshotprofile.cpp index 7204235407..aa257dea9e 100644 --- a/indra/newview/llpanelsnapshotprofile.cpp +++ b/indra/newview/llpanelsnapshotprofile.cpp @@ -49,7 +49,7 @@ class LLPanelSnapshotProfile public: LLPanelSnapshotProfile(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void onOpen(const LLSD& key); private: @@ -73,7 +73,7 @@ LLPanelSnapshotProfile::LLPanelSnapshotProfile() } // virtual -BOOL LLPanelSnapshotProfile::postBuild() +bool LLPanelSnapshotProfile::postBuild() { return LLPanelSnapshot::postBuild(); } diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp index 627074efa9..902412d359 100644 --- a/indra/newview/llpanelteleporthistory.cpp +++ b/indra/newview/llpanelteleporthistory.cpp @@ -60,7 +60,7 @@ public: LLDate date, const std::string &hl); virtual ~LLTeleportHistoryFlatItem(); - virtual BOOL postBuild(); + virtual bool postBuild(); /*virtual*/ S32 notify(const LLSD& info); @@ -78,7 +78,7 @@ public: void onMouseEnter(S32 x, S32 y, MASK mask); void onMouseLeave(S32 x, S32 y, MASK mask); - virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleRightMouseDown(S32 x, S32 y, MASK mask); static void showPlaceInfoPanel(S32 index); @@ -148,7 +148,7 @@ LLTeleportHistoryFlatItem::~LLTeleportHistoryFlatItem() } //virtual -BOOL LLTeleportHistoryFlatItem::postBuild() +bool LLTeleportHistoryFlatItem::postBuild() { mTitle = getChild<LLTextBox>("region"); @@ -265,11 +265,11 @@ void LLTeleportHistoryFlatItem::onMouseLeave(S32 x, S32 y, MASK mask) } // virtual -BOOL LLTeleportHistoryFlatItem::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLTeleportHistoryFlatItem::handleRightMouseDown(S32 x, S32 y, MASK mask) { LLPanel::handleRightMouseDown(x, y, mask); showMenu(x, y); - return TRUE; + return true; } void LLTeleportHistoryFlatItem::showPlaceInfoPanel(S32 index) @@ -317,7 +317,7 @@ LLTeleportHistoryFlatItemStorage::getFlatItemForPersistentItem ( item->setRegionName(persistent_item.mTitle); item->setDate(persistent_item.mDate); item->setHighlightedText(hl); - item->setVisible(TRUE); + item->setVisible(true); item->updateTitle(); item->updateTimestamp(); } @@ -400,14 +400,14 @@ LLTeleportHistoryPanel::~LLTeleportHistoryPanel() mTeleportHistoryChangedConnection.disconnect(); } -BOOL LLTeleportHistoryPanel::postBuild() +bool LLTeleportHistoryPanel::postBuild() { mCommitCallbackRegistrar.add("TeleportHistory.GearMenu.Action", boost::bind(&LLTeleportHistoryPanel::onGearMenuAction, this, _2)); mEnableCallbackRegistrar.add("TeleportHistory.GearMenu.Enable", boost::bind(&LLTeleportHistoryPanel::isActionEnabled, this, _2)); // init menus before list, since menus are passed to list mGearItemMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_teleport_history_item.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); - mGearItemMenu->setAlwaysShowMenu(TRUE); // all items can be disabled if nothing is selected, show anyway + mGearItemMenu->setAlwaysShowMenu(true); // all items can be disabled if nothing is selected, show anyway mSortingMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_teleport_history_gear.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); mTeleportHistory = LLTeleportHistoryStorage::getInstance(); @@ -461,7 +461,7 @@ BOOL LLTeleportHistoryPanel::postBuild() } } - return TRUE; + return true; } // virtual @@ -598,7 +598,7 @@ void LLTeleportHistoryPanel::getNextTab(const LLDate& item_date, S32& tab_idx, L { const U32 seconds_in_day = 24 * 60 * 60; - S32 tabs_cnt = mItemContainers.size(); + S32 tabs_cnt = static_cast<S32>(mItemContainers.size()); S32 curr_year = 0, curr_month = 0, curr_day = 0; tab_date = LLDate::now(); @@ -695,7 +695,7 @@ void LLTeleportHistoryPanel::refresh() // tab_boundary_date would be earliest possible date for this tab S32 tab_idx = 0; getNextTab(date, tab_idx, tab_boundary_date); - tab_idx = mItemContainers.size() - 1 - tab_idx; + tab_idx = static_cast<S32>(mItemContainers.size()) - 1 - tab_idx; if (tab_idx >= 0) { LLAccordionCtrlTab* tab = mItemContainers.at(tab_idx); @@ -743,7 +743,7 @@ void LLTeleportHistoryPanel::refresh() break; } - for (S32 n = mItemContainers.size() - 1; n >= 0; --n) + for (S32 n = static_cast<S32>(mItemContainers.size()) - 1; n >= 0; --n) { LLAccordionCtrlTab* tab = mItemContainers.at(n); LLFlatListView* fv = getFlatListViewFromTab(tab); @@ -798,14 +798,14 @@ void LLTeleportHistoryPanel::replaceItem(S32 removed_index) LLTeleportHistoryFlatItem* item = LLTeleportHistoryFlatItemStorage::instance() .getFlatItemForPersistentItem(mGearItemMenu, history_items[history_items.size() - 1], // Most recent item, it was added instead of removed - history_items.size(), // index will be decremented inside loop below + static_cast<S32>(history_items.size()), // index will be decremented inside loop below sFilterSubString); fv->addItem(item, LLUUID::null, ADD_TOP); // Index of each item, from last to removed item should be decremented // to point to the right item in LLTeleportHistoryStorage - for (S32 tab_idx = mItemContainers.size() - 1; tab_idx >= 0; --tab_idx) + for (S32 tab_idx = static_cast<S32>(mItemContainers.size()) - 1; tab_idx >= 0; --tab_idx) { LLAccordionCtrlTab* tab = mItemContainers.at(tab_idx); if (!tab->getVisible()) @@ -821,8 +821,8 @@ void LLTeleportHistoryPanel::replaceItem(S32 removed_index) std::vector<LLPanel*> items; fv->getItems(items); - S32 items_cnt = items.size(); - for (S32 n = 0; n < items_cnt; ++n) + auto items_cnt = items.size(); + for (size_t n = 0; n < items_cnt; ++n) { LLTeleportHistoryFlatItem *item = (LLTeleportHistoryFlatItem*) items[n]; @@ -857,9 +857,9 @@ void LLTeleportHistoryPanel::showTeleportHistory() mTeleportHistory = LLTeleportHistoryStorage::getInstance(); } - mCurrentItem = mTeleportHistory->getItems().size() - 1; + mCurrentItem = static_cast<S32>(mTeleportHistory->getItems().size()) - 1; - for (S32 n = mItemContainers.size() - 1; n >= 0; --n) + for (S32 n = static_cast<S32>(mItemContainers.size()) - 1; n >= 0; --n) { LLAccordionCtrlTab* tab = mItemContainers.at(n); if (tab) @@ -884,9 +884,9 @@ void LLTeleportHistoryPanel::handleItemSelect(LLFlatListView* selected) if (item) mLastSelectedItemIndex = item->getIndex(); - S32 tabs_cnt = mItemContainers.size(); + auto tabs_cnt = mItemContainers.size(); - for (S32 n = 0; n < tabs_cnt; n++) + for (size_t n = 0; n < tabs_cnt; n++) { LLAccordionCtrlTab* tab = mItemContainers.at(n); @@ -949,8 +949,8 @@ void LLTeleportHistoryPanel::onAccordionTabRightClick(LLView *view, S32 x, S32 y mAccordionTabMenu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>( "menu_teleport_history_tab.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance()); - mAccordionTabMenu->setItemVisible("TabOpen", !tab->isExpanded() ? true : false); - mAccordionTabMenu->setItemVisible("TabClose", tab->isExpanded() ? true : false); + mAccordionTabMenu->setItemVisible("TabOpen", !tab->isExpanded()); + mAccordionTabMenu->setItemVisible("TabClose", tab->isExpanded()); mAccordionTabMenu->show(x, y); LLMenuGL::showPopup(tab, mAccordionTabMenu, x, y); @@ -1001,7 +1001,7 @@ LLFlatListView* LLTeleportHistoryPanel::getFlatListViewFromTab(LLAccordionCtrlTa void LLTeleportHistoryPanel::gotSLURLCallback(const std::string& slurl) { - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(slurl), 0, slurl.size()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(slurl), 0, static_cast<S32>(slurl.size())); LLSD args; args["SLURL"] = slurl; @@ -1015,9 +1015,9 @@ void LLTeleportHistoryPanel::onGearMenuAction(const LLSD& userdata) if ("expand_all" == command_name) { - S32 tabs_cnt = mItemContainers.size(); + auto tabs_cnt = mItemContainers.size(); - for (S32 n = 0; n < tabs_cnt; n++) + for (size_t n = 0; n < tabs_cnt; n++) { mItemContainers.at(n)->setDisplayChildren(true); } @@ -1025,9 +1025,9 @@ void LLTeleportHistoryPanel::onGearMenuAction(const LLSD& userdata) } else if ("collapse_all" == command_name) { - S32 tabs_cnt = mItemContainers.size(); + auto tabs_cnt = mItemContainers.size(); - for (S32 n = 0; n < tabs_cnt; n++) + for (size_t n = 0; n < tabs_cnt; n++) { mItemContainers.at(n)->setDisplayChildren(false); } @@ -1082,12 +1082,12 @@ bool LLTeleportHistoryPanel::isActionEnabled(const LLSD& userdata) const if (command_name == "collapse_all" || command_name == "expand_all") { - S32 tabs_cnt = mItemContainers.size(); + auto tabs_cnt = mItemContainers.size(); bool has_expanded_tabs = false; bool has_collapsed_tabs = false; - for (S32 n = 0; n < tabs_cnt; n++) + for (size_t n = 0; n < tabs_cnt; n++) { LLAccordionCtrlTab* tab = mItemContainers.at(n); if (!tab->getVisible()) diff --git a/indra/newview/llpanelteleporthistory.h b/indra/newview/llpanelteleporthistory.h index 20cd96a89c..48b795cc5e 100644 --- a/indra/newview/llpanelteleporthistory.h +++ b/indra/newview/llpanelteleporthistory.h @@ -46,7 +46,7 @@ public: LLTeleportHistoryPanel(); virtual ~LLTeleportHistoryPanel(); - BOOL postBuild() override; + bool postBuild() override; void draw() override; void onSearchEdit(const std::string& string) override; @@ -62,7 +62,7 @@ public: LLToggleableMenu* getSortingMenu() override; LLToggleableMenu* getCreateMenu() override; - bool handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept) override { return false; } + bool handleDragAndDropToTrash(bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept) override { return false; } private: diff --git a/indra/newview/llpaneltiptoast.cpp b/indra/newview/llpaneltiptoast.cpp index 7b512a7737..afed140075 100644 --- a/indra/newview/llpaneltiptoast.cpp +++ b/indra/newview/llpaneltiptoast.cpp @@ -28,7 +28,7 @@ #include "llpaneltiptoast.h" -BOOL LLPanelTipToast::postBuild() +bool LLPanelTipToast::postBuild() { mMessageText= findChild<LLUICtrl>("message"); @@ -40,10 +40,10 @@ BOOL LLPanelTipToast::postBuild() else { llassert(!"Can't find child 'message' text box."); - return FALSE; + return false; } - return TRUE; + return true; } void LLPanelTipToast::onMessageTextClick() diff --git a/indra/newview/llpaneltiptoast.h b/indra/newview/llpaneltiptoast.h index f52772fbfe..85f2a7583a 100644 --- a/indra/newview/llpaneltiptoast.h +++ b/indra/newview/llpaneltiptoast.h @@ -40,7 +40,7 @@ class LLPanelTipToast : public LLToastPanel LOG_CLASS(LLPanelTipToast); public: LLPanelTipToast(const LLNotificationPtr& notification): LLToastPanel(notification) {} - virtual BOOL postBuild(); + bool postBuild() override; private: void onMessageTextClick(); void onPanelClick(S32 x, S32 y, MASK mask); diff --git a/indra/newview/llpaneltopinfobar.cpp b/indra/newview/llpaneltopinfobar.cpp index 499c290c66..e7ac11d570 100644 --- a/indra/newview/llpaneltopinfobar.cpp +++ b/indra/newview/llpaneltopinfobar.cpp @@ -128,7 +128,7 @@ void LLPanelTopInfoBar::handleLoginComplete() update(); } -BOOL LLPanelTopInfoBar::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLPanelTopInfoBar::handleRightMouseDown(S32 x, S32 y, MASK mask) { if(!LLUICtrl::CommitCallbackRegistry::getValue("TopInfoBar.Action")) { @@ -136,10 +136,10 @@ BOOL LLPanelTopInfoBar::handleRightMouseDown(S32 x, S32 y, MASK mask) .add("TopInfoBar.Action", boost::bind(&LLPanelTopInfoBar::onContextMenuItemClicked, this, _2)); } show_topinfobar_context_menu(this, x, y); - return TRUE; + return true; } -BOOL LLPanelTopInfoBar::postBuild() +bool LLPanelTopInfoBar::postBuild() { mInfoBtn = getChild<LLButton>("place_info_btn"); mInfoBtn->setClickedCallback(boost::bind(&LLPanelTopInfoBar::onInfoButtonClicked, this)); @@ -172,7 +172,7 @@ BOOL LLPanelTopInfoBar::postBuild() setVisibleCallback(boost::bind(&LLPanelTopInfoBar::onVisibilityChanged, this, _2)); - return TRUE; + return true; } void LLPanelTopInfoBar::onNavBarShowParcelPropertiesCtrlChanged() @@ -241,7 +241,7 @@ void LLPanelTopInfoBar::setParcelInfoText(const std::string& new_text) LLRect rect = mParcelInfoText->getRect(); rect.setOriginAndSize(rect.mLeft, rect.mBottom, new_text_width, rect.getHeight()); - mParcelInfoText->reshape(rect.getWidth(), rect.getHeight(), TRUE); + mParcelInfoText->reshape(rect.getWidth(), rect.getHeight(), true); mParcelInfoText->setRect(rect); layoutParcelIcons(); diff --git a/indra/newview/llpaneltopinfobar.h b/indra/newview/llpaneltopinfobar.h index 0f072db175..f4238ad5e7 100644 --- a/indra/newview/llpaneltopinfobar.h +++ b/indra/newview/llpaneltopinfobar.h @@ -46,8 +46,8 @@ class LLPanelTopInfoBar : public LLPanel, public LLSingleton<LLPanelTopInfoBar>, public: typedef boost::signals2::signal<void ()> resize_signal_t; - /*virtual*/ BOOL postBuild() override; - /*virtual*/ void draw() override; + bool postBuild() override; + void draw() override; /** * Updates location and parcel icons on login complete @@ -83,7 +83,7 @@ private: */ void initParcelIcons(); - BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) override; + bool handleRightMouseDown(S32 x, S32 y, MASK mask) override; /** * Handles clicks on the parcel icons. @@ -158,7 +158,7 @@ private: { if (LLPanelTopInfoBar::instanceExists()) { - LLPanelTopInfoBar::getInstance()->setEnabled(FALSE); + LLPanelTopInfoBar::getInstance()->setEnabled(false); } } diff --git a/indra/newview/llpanelvoicedevicesettings.cpp b/indra/newview/llpanelvoicedevicesettings.cpp index 1a9c5716dc..60877494e7 100644 --- a/indra/newview/llpanelvoicedevicesettings.cpp +++ b/indra/newview/llpanelvoicedevicesettings.cpp @@ -51,7 +51,7 @@ LLPanelVoiceDeviceSettings::LLPanelVoiceDeviceSettings() mCtrlOutputDevices = NULL; mInputDevice = gSavedSettings.getString("VoiceInputAudioDevice"); mOutputDevice = gSavedSettings.getString("VoiceOutputAudioDevice"); - mDevicesUpdated = FALSE; //obsolete + mDevicesUpdated = false; //obsolete mUseTuningMode = true; // grab "live" mic volume level @@ -63,7 +63,7 @@ LLPanelVoiceDeviceSettings::~LLPanelVoiceDeviceSettings() { } -BOOL LLPanelVoiceDeviceSettings::postBuild() +bool LLPanelVoiceDeviceSettings::postBuild() { LLSlider* volume_slider = getChild<LLSlider>("mic_volume_slider"); // set mic volume tuning slider based on last mic volume setting @@ -88,11 +88,11 @@ BOOL LLPanelVoiceDeviceSettings::postBuild() mCtrlInputDevices->setMouseDownCallback(boost::bind(&LLPanelVoiceDeviceSettings::onInputDevicesClicked, this)); - return TRUE; + return true; } // virtual -void LLPanelVoiceDeviceSettings::onVisibilityChange ( BOOL new_visibility ) +void LLPanelVoiceDeviceSettings::onVisibilityChange ( bool new_visibility ) { if (new_visibility) { @@ -103,7 +103,7 @@ void LLPanelVoiceDeviceSettings::onVisibilityChange ( BOOL new_visibility ) cleanup(); // when closing this window, turn of visiblity control so that // next time preferences is opened we don't suspend voice - gSavedSettings.setBOOL("ShowDeviceSettings", FALSE); + gSavedSettings.setBOOL("ShowDeviceSettings", false); } } void LLPanelVoiceDeviceSettings::draw() @@ -116,12 +116,12 @@ void LLPanelVoiceDeviceSettings::draw() if (voice_enabled) { getChildView("wait_text")->setVisible( !is_in_tuning_mode && mUseTuningMode); - getChildView("disabled_text")->setVisible(FALSE); - mUnmuteBtn->setVisible(FALSE); + getChildView("disabled_text")->setVisible(false); + mUnmuteBtn->setVisible(false); } else { - getChildView("wait_text")->setVisible(FALSE); + getChildView("wait_text")->setVisible(false); static LLCachedControl<bool> chat_enabled(gSavedSettings, "EnableVoiceChat"); // If voice isn't enabled, it is either disabled or muted @@ -144,7 +144,7 @@ void LLPanelVoiceDeviceSettings::draw() LLView* bar_view = getChild<LLView>(view_name); if (bar_view) { - gl_rect_2d(bar_view->getRect(), LLColor4::grey, TRUE); + gl_rect_2d(bar_view->getRect(), LLColor4::grey, true); LLColor4 color; if (power_bar_idx < discrete_power) @@ -158,7 +158,7 @@ void LLPanelVoiceDeviceSettings::draw() LLRect color_rect = bar_view->getRect(); color_rect.stretch(-1); - gl_rect_2d(color_rect, color, TRUE); + gl_rect_2d(color_rect, color, true); } } } @@ -267,7 +267,7 @@ void LLPanelVoiceDeviceSettings::refresh() } // Fix invalid input audio device preference. - if (!mCtrlInputDevices->setSelectedByValue(mInputDevice, TRUE)) + if (!mCtrlInputDevices->setSelectedByValue(mInputDevice, true)) { mCtrlInputDevices->setValue(DEFAULT_DEVICE); gSavedSettings.setString("VoiceInputAudioDevice", DEFAULT_DEVICE); @@ -290,7 +290,7 @@ void LLPanelVoiceDeviceSettings::refresh() } // Fix invalid output audio device preference. - if (!mCtrlOutputDevices->setSelectedByValue(mOutputDevice, TRUE)) + if (!mCtrlOutputDevices->setSelectedByValue(mOutputDevice, true)) { mCtrlOutputDevices->setValue(DEFAULT_DEVICE); gSavedSettings.setString("VoiceOutputAudioDevice", DEFAULT_DEVICE); @@ -371,5 +371,5 @@ void LLPanelVoiceDeviceSettings::onInputDevicesClicked() void LLPanelVoiceDeviceSettings::onCommitUnmute() { - gSavedSettings.setBOOL("EnableVoiceChat", TRUE); + gSavedSettings.setBOOL("EnableVoiceChat", true); } diff --git a/indra/newview/llpanelvoicedevicesettings.h b/indra/newview/llpanelvoicedevicesettings.h index 1c170b135c..815396cbd1 100644 --- a/indra/newview/llpanelvoicedevicesettings.h +++ b/indra/newview/llpanelvoicedevicesettings.h @@ -37,14 +37,14 @@ public: ~LLPanelVoiceDeviceSettings(); /*virtual*/ void draw(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); void apply(); void cancel(); void refresh(); void initialize(); void cleanup(); - /*virtual*/ void onVisibilityChange ( BOOL new_visibility ); + /*virtual*/ void onVisibilityChange ( bool new_visibility ); void setUseTuningMode(bool use) { mUseTuningMode = use; }; @@ -63,7 +63,7 @@ protected: class LLComboBox *mCtrlInputDevices; class LLComboBox *mCtrlOutputDevices; class LLButton *mUnmuteBtn; - BOOL mDevicesUpdated; + bool mDevicesUpdated; bool mUseTuningMode; std::map<std::string, std::string> mLocalizedDeviceNames; }; diff --git a/indra/newview/llpanelvoiceeffect.cpp b/indra/newview/llpanelvoiceeffect.cpp index 681d35dafc..a0129b2cb1 100644 --- a/indra/newview/llpanelvoiceeffect.cpp +++ b/indra/newview/llpanelvoiceeffect.cpp @@ -61,7 +61,7 @@ LLPanelVoiceEffect::~LLPanelVoiceEffect() } // virtual -BOOL LLPanelVoiceEffect::postBuild() +bool LLPanelVoiceEffect::postBuild() { mVoiceEffectCombo = getChild<LLComboBox>("voice_effect"); @@ -78,7 +78,7 @@ BOOL LLPanelVoiceEffect::postBuild() update(true); - return TRUE; + return true; } ////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llpanelvoiceeffect.h b/indra/newview/llpanelvoiceeffect.h index 4acb8abca2..f920e41081 100644 --- a/indra/newview/llpanelvoiceeffect.h +++ b/indra/newview/llpanelvoiceeffect.h @@ -43,14 +43,14 @@ public: LLPanelVoiceEffect(); virtual ~LLPanelVoiceEffect(); - virtual BOOL postBuild(); + bool postBuild() override; private: void onCommitVoiceEffect(); void update(bool list_updated); /// Called by voice effect provider when voice effect list is changed. - virtual void onVoiceEffectChanged(bool effect_list_updated); + void onVoiceEffectChanged(bool effect_list_updated) override; // Fixed entries in the Voice Morph list typedef enum e_voice_effect_combo_items diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp index 701882ac57..16c38bf1f0 100644 --- a/indra/newview/llpanelvolume.cpp +++ b/indra/newview/llpanelvolume.cpp @@ -90,7 +90,7 @@ const F32 DEFAULT_GRAVITY_MULTIPLIER = 1.f; const F32 DEFAULT_DENSITY = 1000.f; // "Features" Tab -BOOL LLPanelVolume::postBuild() +bool LLPanelVolume::postBuild() { // Flexible Objects Parameters { @@ -213,14 +213,14 @@ BOOL LLPanelVolume::postBuild() // Start with everyone disabled clearCtrls(); - return TRUE; + return true; } LLPanelVolume::LLPanelVolume() : LLPanel(), mComboMaterialItemCount(0) { - setMouseOpaque(FALSE); + setMouseOpaque(false); mCommitCallbackRegistrar.add("PanelVolume.menuDoToSelected", boost::bind(&LLPanelVolume::menuDoToSelected, this, _2)); mEnableCallbackRegistrar.add("PanelVolume.menuEnable", boost::bind(&LLPanelVolume::menuEnableItem, this, _2)); @@ -285,10 +285,10 @@ void LLPanelVolume::getState( ) LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); // BUG? Check for all objects being editable? - BOOL editable = root_objectp->permModify() && !root_objectp->isPermanentEnforced(); - BOOL single_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ) + bool editable = root_objectp->permModify() && !root_objectp->isPermanentEnforced(); + bool single_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ) && LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 1; - BOOL single_root_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ) && + bool single_root_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ) && LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() == 1; // Select Single Message @@ -306,26 +306,26 @@ void LLPanelVolume::getState( ) } // Light properties - BOOL is_light = volobjp && volobjp->getIsLight(); + bool is_light = volobjp && volobjp->getIsLight(); getChild<LLUICtrl>("Light Checkbox Ctrl")->setValue(is_light); getChildView("Light Checkbox Ctrl")->setEnabled(editable && single_volume && volobjp); if (is_light && editable && single_volume) { - //mLabelColor ->setEnabled( TRUE ); + //mLabelColor ->setEnabled( true ); LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); if(LightColorSwatch) { - LightColorSwatch->setEnabled( TRUE ); - LightColorSwatch->setValid( TRUE ); + LightColorSwatch->setEnabled( true ); + LightColorSwatch->setValid( true ); LightColorSwatch->set(volobjp->getLightSRGBBaseColor()); } LLTextureCtrl* LightTextureCtrl = getChild<LLTextureCtrl>("light texture control"); if (LightTextureCtrl) { - LightTextureCtrl->setEnabled(TRUE); - LightTextureCtrl->setValid(TRUE); + LightTextureCtrl->setEnabled(true); + LightTextureCtrl->setValid(true); LightTextureCtrl->setImageAssetID(volobjp->getLightTextureID()); } @@ -357,14 +357,14 @@ void LLPanelVolume::getState( ) LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); if(LightColorSwatch) { - LightColorSwatch->setEnabled( FALSE ); - LightColorSwatch->setValid( FALSE ); + LightColorSwatch->setEnabled( false ); + LightColorSwatch->setValid( false ); } LLTextureCtrl* LightTextureCtrl = getChild<LLTextureCtrl>("light texture control"); if (LightTextureCtrl) { - LightTextureCtrl->setEnabled(FALSE); - LightTextureCtrl->setValid(FALSE); + LightTextureCtrl->setEnabled(false); + LightTextureCtrl->setValid(false); if (objectp->isAttachment()) { @@ -386,7 +386,7 @@ void LLPanelVolume::getState( ) } // Reflection Probe - BOOL is_probe = volobjp && volobjp->isReflectionProbe(); + bool is_probe = volobjp && volobjp->isReflectionProbe(); bool is_mirror = volobjp && volobjp->getReflectionProbeIsMirror(); getChild<LLUICtrl>("Reflection Probe")->setValue(is_probe); getChildView("Reflection Probe")->setEnabled(editable && single_volume && volobjp && !volobjp->isMesh()); @@ -442,9 +442,6 @@ void LLPanelVolume::getState( ) update_type = "Dynamic Mirror"; } - getChildView("Probe Ambiance")->setEnabled(!is_mirror); - getChildView("Probe Near Clip")->setEnabled(!is_mirror); - getChild<LLComboBox>("Probe Volume Type", true)->setValue(volume_type); getChild<LLSpinCtrl>("Probe Ambiance", true)->setValue(volobjp->getReflectionProbeAmbiance()); getChild<LLSpinCtrl>("Probe Near Clip", true)->setValue(volobjp->getReflectionProbeNearClip()); @@ -452,9 +449,9 @@ void LLPanelVolume::getState( ) } // Animated Mesh - BOOL is_animated_mesh = single_root_volume && root_volobjp && root_volobjp->isAnimatedObject(); + bool is_animated_mesh = single_root_volume && root_volobjp && root_volobjp->isAnimatedObject(); getChild<LLUICtrl>("Animated Mesh Checkbox Ctrl")->setValue(is_animated_mesh); - BOOL enabled_animated_object_box = FALSE; + bool enabled_animated_object_box = false; if (root_volobjp && root_volobjp == volobjp) { enabled_animated_object_box = single_root_volume && root_volobjp && root_volobjp->canBeAnimatedObject() && editable; @@ -502,7 +499,7 @@ void LLPanelVolume::getState( ) } // Flexible properties - BOOL is_flexible = volobjp && volobjp->isFlexible(); + bool is_flexible = volobjp && volobjp->isFlexible(); getChild<LLUICtrl>("Flexible1D Checkbox Ctrl")->setValue(is_flexible); if (is_flexible || (volobjp && volobjp->canBeFlexible())) { @@ -580,7 +577,7 @@ void LLPanelVolume::getState( ) std::string LEGACY_FULLBRIGHT_DESC = LLTrans::getString("Fullbright"); if (editable && single_volume && material_same) { - mComboMaterial->setEnabled( TRUE ); + mComboMaterial->setEnabled( true ); if (material_code == LL_MCODE_LIGHT) { if (mComboMaterial->getItemCount() == mComboMaterialItemCount) @@ -601,7 +598,7 @@ void LLPanelVolume::getState( ) } else { - mComboMaterial->setEnabled( FALSE ); + mComboMaterial->setEnabled( false ); } // Physics properties @@ -622,7 +619,7 @@ void LLPanelVolume::getState( ) mComboPhysicsShapeType->removeall(); mComboPhysicsShapeType->add(getString("None"), LLSD(1)); - BOOL isMesh = FALSE; + bool isMesh = false; LLSculptParams *sculpt_params = (LLSculptParams *)objectp->getParameterEntry(LLNetworkData::PARAMS_SCULPT); if (sculpt_params) { @@ -663,7 +660,7 @@ void LLPanelVolume::getState( ) bool LLPanelVolume::precommitValidate( const LLSD& data ) { // TODO: Richard will fill this in later. - return TRUE; // FALSE means that validation failed and new value should not be commited. + return true; // false means that validation failed and new value should not be commited. } @@ -719,14 +716,14 @@ void LLPanelVolume::clearCtrls() LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); if(LightColorSwatch) { - LightColorSwatch->setEnabled( FALSE ); - LightColorSwatch->setValid( FALSE ); + LightColorSwatch->setEnabled( false ); + LightColorSwatch->setValid( false ); } LLTextureCtrl* LightTextureCtrl = getChild<LLTextureCtrl>("light texture control"); if(LightTextureCtrl) { - LightTextureCtrl->setEnabled( FALSE ); - LightTextureCtrl->setValid( FALSE ); + LightTextureCtrl->setEnabled( false ); + LightTextureCtrl->setValid( false ); } getChildView("Light Intensity")->setEnabled(false); @@ -749,12 +746,12 @@ void LLPanelVolume::clearCtrls() getChildView("FlexForceY")->setEnabled(false); getChildView("FlexForceZ")->setEnabled(false); - mSpinPhysicsGravity->setEnabled(FALSE); - mSpinPhysicsFriction->setEnabled(FALSE); - mSpinPhysicsDensity->setEnabled(FALSE); - mSpinPhysicsRestitution->setEnabled(FALSE); + mSpinPhysicsGravity->setEnabled(false); + mSpinPhysicsFriction->setEnabled(false); + mSpinPhysicsDensity->setEnabled(false); + mSpinPhysicsRestitution->setEnabled(false); - mComboMaterial->setEnabled( FALSE ); + mComboMaterial->setEnabled( false ); } // @@ -770,7 +767,7 @@ void LLPanelVolume::sendIsLight() } LLVOVolume *volobjp = (LLVOVolume *)objectp; - BOOL value = getChild<LLUICtrl>("Light Checkbox Ctrl")->getValue(); + bool value = getChild<LLUICtrl>("Light Checkbox Ctrl")->getValue(); volobjp->setIsLight(value); LL_INFOS() << "update light sent" << LL_ENDL; } @@ -792,8 +789,8 @@ void LLPanelVolume::sendIsReflectionProbe() } LLVOVolume* volobjp = (LLVOVolume*)objectp; - BOOL value = getChild<LLUICtrl>("Reflection Probe")->getValue(); - BOOL old_value = volobjp->isReflectionProbe(); + bool value = getChild<LLUICtrl>("Reflection Probe")->getValue(); + bool old_value = volobjp->isReflectionProbe(); if (value && value != old_value) { // defer to notification util as to whether or not we *really* make this object a reflection probe @@ -812,7 +809,7 @@ void LLPanelVolume::sendIsReflectionProbe() if (in_linkeset) { // In linkset with a phantom flag - objectp->setFlags(FLAGS_PHANTOM, FALSE); + objectp->setFlags(FLAGS_PHANTOM, false); } } volobjp->setIsReflectionProbe(value); @@ -865,8 +862,8 @@ void LLPanelVolume::sendIsFlexible() } LLVOVolume *volobjp = (LLVOVolume *)objectp; - BOOL is_flexible = getChild<LLUICtrl>("Flexible1D Checkbox Ctrl")->getValue(); - //BOOL is_flexible = mCheckFlexible1D->get(); + bool is_flexible = getChild<LLUICtrl>("Flexible1D Checkbox Ctrl")->getValue(); + //bool is_flexible = mCheckFlexible1D->get(); if (is_flexible) { @@ -1084,10 +1081,10 @@ void LLPanelVolume::onPasteFeatures() bool is_root = objectp->isRoot(); // Not sure if phantom should go under physics, but doesn't fit elsewhere - BOOL is_phantom = clipboard["is_phantom"].asBoolean() && is_root; + bool is_phantom = clipboard["is_phantom"].asBoolean() && is_root; LLSelectMgr::getInstance()->selectionUpdatePhantom(is_phantom); - BOOL is_physical = clipboard["is_physical"].asBoolean() && is_root; + bool is_physical = clipboard["is_physical"].asBoolean() && is_root; LLSelectMgr::getInstance()->selectionUpdatePhysics(is_physical); if (clipboard.has("physics")) @@ -1102,7 +1099,7 @@ void LLPanelVolume::onPasteFeatures() objectp->setPhysicsFriction(clipboard["physics"]["friction"].asReal()); objectp->setPhysicsDensity(clipboard["physics"]["density"].asReal()); objectp->setPhysicsRestitution(clipboard["physics"]["restitution"].asReal()); - objectp->updateFlags(TRUE); + objectp->updateFlags(true); } // Flexible @@ -1110,7 +1107,7 @@ void LLPanelVolume::onPasteFeatures() if (is_flexible && volobjp->canBeFlexible()) { LLVOVolume *volobjp = (LLVOVolume *)objectp; - BOOL update_shape = FALSE; + bool update_shape = false; // do before setParameterEntry or it will think that it is already flexi update_shape = volobjp->setIsFlexible(is_flexible); @@ -1230,7 +1227,7 @@ void LLPanelVolume::onPasteLight() { if (clipboard.has("light")) { - volobjp->setIsLight(TRUE); + volobjp->setIsLight(true); volobjp->setLightIntensity((F32)clipboard["light"]["intensity"].asReal()); volobjp->setLightRadius((F32)clipboard["light"]["radius"].asReal()); volobjp->setLightFalloff((F32)clipboard["light"]["falloff"].asReal()); @@ -1241,7 +1238,7 @@ void LLPanelVolume::onPasteLight() } else { - volobjp->setIsLight(FALSE); + volobjp->setIsLight(false); } if (clipboard.has("spot")) @@ -1256,7 +1253,7 @@ void LLPanelVolume::onPasteLight() if (clipboard.has("reflection_probe")) { - volobjp->setIsReflectionProbe(TRUE); + volobjp->setIsReflectionProbe(true); volobjp->setReflectionProbeIsBox(clipboard["reflection_probe"]["is_box"].asBoolean()); volobjp->setReflectionProbeAmbiance((F32)clipboard["reflection_probe"]["ambiance"].asReal()); volobjp->setReflectionProbeNearClip((F32)clipboard["reflection_probe"]["near_clip"].asReal()); @@ -1272,7 +1269,7 @@ void LLPanelVolume::onPasteLight() if (in_linkeset) { // In linkset with a phantom flag - objectp->setFlags(FLAGS_PHANTOM, FALSE); + objectp->setFlags(FLAGS_PHANTOM, false); } } @@ -1408,9 +1405,9 @@ void LLPanelVolume::onCommitLight( LLUICtrl* ctrl, void* userdata ) else if (volobjp->isLightSpotlight()) { //no longer a spot light setLightTextureID(id, item_id, volobjp); - //self->getChildView("Light FOV")->setEnabled(FALSE); - //self->getChildView("Light Focus")->setEnabled(FALSE); - //self->getChildView("Light Ambiance")->setEnabled(FALSE); + //self->getChildView("Light FOV")->setEnabled(false); + //self->getChildView("Light Focus")->setEnabled(false); + //self->getChildView("Light Ambiance")->setEnabled(false); } } @@ -1464,7 +1461,7 @@ void LLPanelVolume::onCommitProbe(LLUICtrl* ctrl, void* userdata) path = LL_PCODE_PATH_CIRCLE; F32 scale = volobjp->getScale().mV[0]; - volobjp->setScale(LLVector3(scale, scale, scale), FALSE); + volobjp->setScale(LLVector3(scale, scale, scale), false); LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_ROTATION | UPD_POSITION | UPD_SCALE); } else @@ -1498,7 +1495,7 @@ void LLPanelVolume::setLightTextureID(const LLUUID &asset_id, const LLUUID &item if (item && volobjp->isAttachment()) { const LLPermissions& perm = item->getPermissions(); - BOOL unrestricted = ((perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) ? TRUE : FALSE; + bool unrestricted = (perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED; if (!unrestricted) { // Attachments are in world and in inventory simultaneously, @@ -1511,6 +1508,7 @@ void LLPanelVolume::setLightTextureID(const LLUUID &asset_id, const LLUUID &item { LLToolDragAndDrop::handleDropMaterialProtections(volobjp, item, LLToolDragAndDrop::SOURCE_AGENT, LLUUID::null); } + volobjp->setLightTextureID(asset_id); } } @@ -1568,7 +1566,7 @@ void LLPanelVolume::onCommitAnimatedMeshCheckbox(LLUICtrl *, void*) return; } LLVOVolume *volobjp = (LLVOVolume *)objectp; - BOOL animated_mesh = getChild<LLUICtrl>("Animated Mesh Checkbox Ctrl")->getValue(); + bool animated_mesh = getChild<LLUICtrl>("Animated Mesh Checkbox Ctrl")->getValue(); U32 flags = volobjp->getExtendedMeshFlags(); U32 new_flags = flags; if (animated_mesh) @@ -1627,6 +1625,6 @@ void LLPanelVolume::handleResponseChangeToFlexible(const LLSD &pNotification, co } else { - getChild<LLUICtrl>("Flexible1D Checkbox Ctrl")->setValue(FALSE); + getChild<LLUICtrl>("Flexible1D Checkbox Ctrl")->setValue(false); } } diff --git a/indra/newview/llpanelvolume.h b/indra/newview/llpanelvolume.h index 37b7b13d44..7e31a3135b 100644 --- a/indra/newview/llpanelvolume.h +++ b/indra/newview/llpanelvolume.h @@ -52,7 +52,7 @@ public: virtual void draw(); virtual void clearCtrls(); - virtual BOOL postBuild(); + virtual bool postBuild(); void refresh(); diff --git a/indra/newview/llpanelvolumepulldown.cpp b/indra/newview/llpanelvolumepulldown.cpp index 553decca2c..046bcd7f59 100644 --- a/indra/newview/llpanelvolumepulldown.cpp +++ b/indra/newview/llpanelvolumepulldown.cpp @@ -55,7 +55,7 @@ LLPanelVolumePulldown::LLPanelVolumePulldown() buildFromFile( "panel_volume_pulldown.xml"); } -BOOL LLPanelVolumePulldown::postBuild() +bool LLPanelVolumePulldown::postBuild() { return LLPanelPulldown::postBuild(); } @@ -63,7 +63,7 @@ BOOL LLPanelVolumePulldown::postBuild() void LLPanelVolumePulldown::onAdvancedButtonClick(const LLSD& user_data) { // close the global volume minicontrol, we're bringing up the big one - setVisible(FALSE); + setVisible(false); // bring up the prefs floater LLFloaterPreference* prefsfloater = dynamic_cast<LLFloaterPreference*> @@ -87,7 +87,7 @@ void LLPanelVolumePulldown::setControlFalse(const LLSD& user_data) LLControlVariable* control = findControl(control_name); if (control) - control->set(LLSD(FALSE)); + control->set(LLSD(false)); } void LLPanelVolumePulldown::updateCheckbox(LLUICtrl* ctrl, const LLSD& user_data) diff --git a/indra/newview/llpanelvolumepulldown.h b/indra/newview/llpanelvolumepulldown.h index a2816db747..2ebac06972 100644 --- a/indra/newview/llpanelvolumepulldown.h +++ b/indra/newview/llpanelvolumepulldown.h @@ -36,7 +36,7 @@ class LLPanelVolumePulldown : public LLPanelPulldown { public: LLPanelVolumePulldown(); - /*virtual*/ BOOL postBuild(); + bool postBuild() override; private: void setControlFalse(const LLSD& user_data); diff --git a/indra/newview/llpanelwearing.cpp b/indra/newview/llpanelwearing.cpp index 9a7281cda4..c1534c9abd 100644 --- a/indra/newview/llpanelwearing.cpp +++ b/indra/newview/llpanelwearing.cpp @@ -193,15 +193,15 @@ protected: void updateMenuItemsVisibility(LLContextMenu* menu) { - menu->setItemVisible("touch_attach", TRUE); + menu->setItemVisible("touch_attach", true); menu->setItemEnabled("touch_attach", 1 == mUUIDs.size()); - menu->setItemVisible("edit_item", TRUE); + menu->setItemVisible("edit_item", true); menu->setItemEnabled("edit_item", 1 == mUUIDs.size()); - menu->setItemVisible("take_off", FALSE); - menu->setItemVisible("detach", TRUE); - menu->setItemVisible("edit_outfit_separator", FALSE); - menu->setItemVisible("show_original", FALSE); - menu->setItemVisible("edit_outfit", FALSE); + menu->setItemVisible("take_off", false); + menu->setItemVisible("detach", true); + menu->setItemVisible("edit_outfit_separator", false); + menu->setItemVisible("show_original", false); + menu->setItemVisible("edit_outfit", false); } LLPanelWearing* mPanelWearing; @@ -234,7 +234,7 @@ LLPanelWearing::~LLPanelWearing() } } -BOOL LLPanelWearing::postBuild() +bool LLPanelWearing::postBuild() { mAccordionCtrl = getChild<LLAccordionCtrl>("wearables_accordion"); mWearablesTab = getChild<LLAccordionCtrlTab>("tab_wearables"); @@ -253,7 +253,7 @@ BOOL LLPanelWearing::postBuild() menu_gear_btn->setMenu(mGearMenu->getMenu()); - return TRUE; + return true; } //virtual @@ -478,11 +478,11 @@ void LLPanelWearing::getAttachmentLimitsCoro(std::string url) void LLPanelWearing::setAttachmentDetails(LLSD content) { mObjectNames.clear(); - S32 number_attachments = content["attachments"].size(); - for(int i = 0; i < number_attachments; i++) + auto number_attachments = content["attachments"].size(); + for(size_t i = 0; i < number_attachments; i++) { - S32 number_objects = content["attachments"][i]["objects"].size(); - for(int j = 0; j < number_objects; j++) + auto number_objects = content["attachments"][i]["objects"].size(); + for(size_t j = 0; j < number_objects; j++) { LLUUID task_id = content["attachments"][i]["objects"][j]["id"].asUUID(); std::string name = content["attachments"][i]["objects"][j]["name"].asString(); @@ -594,6 +594,6 @@ void LLPanelWearing::copyToClipboard() } } - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(text),0,text.size()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(text), 0, static_cast<S32>(text.size())); } // EOF diff --git a/indra/newview/llpanelwearing.h b/indra/newview/llpanelwearing.h index bc1d0afc1b..ea0787d0ef 100644 --- a/indra/newview/llpanelwearing.h +++ b/indra/newview/llpanelwearing.h @@ -55,7 +55,7 @@ public: LLPanelWearing(); virtual ~LLPanelWearing(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void draw(); diff --git a/indra/newview/llparcelselection.cpp b/indra/newview/llparcelselection.cpp index 12ac947dea..3bfa886bfe 100644 --- a/indra/newview/llparcelselection.cpp +++ b/indra/newview/llparcelselection.cpp @@ -36,8 +36,8 @@ // LLParcelSelection::LLParcelSelection() : mParcel(NULL), - mSelectedMultipleOwners(FALSE), - mWholeParcelSelected(FALSE), + mSelectedMultipleOwners(false), + mWholeParcelSelected(false), mSelectedSelfCount(0), mSelectedOtherCount(0), mSelectedPublicCount(0) @@ -46,8 +46,8 @@ LLParcelSelection::LLParcelSelection() : LLParcelSelection::LLParcelSelection(LLParcel* parcel) : mParcel(parcel), - mSelectedMultipleOwners(FALSE), - mWholeParcelSelected(FALSE), + mSelectedMultipleOwners(false), + mWholeParcelSelected(false), mSelectedSelfCount(0), mSelectedOtherCount(0), mSelectedPublicCount(0) @@ -58,13 +58,13 @@ LLParcelSelection::~LLParcelSelection() { } -BOOL LLParcelSelection::getMultipleOwners() const +bool LLParcelSelection::getMultipleOwners() const { return mSelectedMultipleOwners; } -BOOL LLParcelSelection::getWholeParcelSelected() const +bool LLParcelSelection::getWholeParcelSelected() const { return mWholeParcelSelected; } diff --git a/indra/newview/llparcelselection.h b/indra/newview/llparcelselection.h index ba2241bc40..f1b20572fc 100644 --- a/indra/newview/llparcelselection.h +++ b/indra/newview/llparcelselection.h @@ -57,18 +57,18 @@ public: bool hasOthersSelected() const; // Does the selection have multiple land owners in it? - BOOL getMultipleOwners() const; + bool getMultipleOwners() const; // Is the entire parcel selected, or just a part? - BOOL getWholeParcelSelected() const; + bool getWholeParcelSelected() const; private: void setParcel(LLParcel* parcel) { mParcel = parcel; } private: LLParcel* mParcel; - BOOL mSelectedMultipleOwners; - BOOL mWholeParcelSelected; + bool mSelectedMultipleOwners; + bool mWholeParcelSelected; S32 mSelectedSelfCount; S32 mSelectedOtherCount; S32 mSelectedPublicCount; diff --git a/indra/newview/llpathfindingcharacter.cpp b/indra/newview/llpathfindingcharacter.cpp index a376de10ae..66cc26469e 100644 --- a/indra/newview/llpathfindingcharacter.cpp +++ b/indra/newview/llpathfindingcharacter.cpp @@ -47,7 +47,7 @@ LLPathfindingCharacter::LLPathfindingCharacter(const std::string &pUUID, const LLSD& pCharacterData) : LLPathfindingObject(pUUID, pCharacterData), mCPUTime(0U), - mIsHorizontal(FALSE), + mIsHorizontal(false), mLength(0.0f), mRadius(0.0f) { diff --git a/indra/newview/llpathfindingcharacter.h b/indra/newview/llpathfindingcharacter.h index ac5a113f96..ed621d975a 100644 --- a/indra/newview/llpathfindingcharacter.h +++ b/indra/newview/llpathfindingcharacter.h @@ -44,7 +44,7 @@ public: inline F32 getCPUTime() const {return mCPUTime;}; - inline BOOL isHorizontal() const {return mIsHorizontal;}; + inline bool isHorizontal() const {return mIsHorizontal;}; inline F32 getLength() const {return mLength;}; inline F32 getRadius() const {return mRadius;}; @@ -55,7 +55,7 @@ private: F32 mCPUTime; - BOOL mIsHorizontal; + bool mIsHorizontal; F32 mLength; F32 mRadius; }; diff --git a/indra/newview/llpathfindinglinkset.cpp b/indra/newview/llpathfindinglinkset.cpp index 8de7a57ae4..47400f9570 100644 --- a/indra/newview/llpathfindinglinkset.cpp +++ b/indra/newview/llpathfindinglinkset.cpp @@ -61,10 +61,10 @@ LLPathfindingLinkset::LLPathfindingLinkset(const LLSD& pTerrainData) : LLPathfindingObject(), mIsTerrain(true), mLandImpact(0U), - mIsModifiable(FALSE), - mCanBeVolume(FALSE), - mIsScripted(FALSE), - mHasIsScripted(TRUE), + mIsModifiable(false), + mCanBeVolume(false), + mIsScripted(false), + mHasIsScripted(true), mLinksetUse(kUnknown), mWalkabilityCoefficientA(MIN_WALKABILITY_VALUE), mWalkabilityCoefficientB(MIN_WALKABILITY_VALUE), @@ -78,10 +78,10 @@ LLPathfindingLinkset::LLPathfindingLinkset(const std::string &pUUID, const LLSD& : LLPathfindingObject(pUUID, pLinksetData), mIsTerrain(false), mLandImpact(0U), - mIsModifiable(TRUE), - mCanBeVolume(TRUE), - mIsScripted(FALSE), - mHasIsScripted(FALSE), + mIsModifiable(true), + mCanBeVolume(true), + mIsScripted(false), + mHasIsScripted(false), mLinksetUse(kUnknown), mWalkabilityCoefficientA(MIN_WALKABILITY_VALUE), mWalkabilityCoefficientB(MIN_WALKABILITY_VALUE), @@ -131,14 +131,14 @@ LLPathfindingLinkset& LLPathfindingLinkset::operator =(const LLPathfindingLinkse return *this; } -BOOL LLPathfindingLinkset::isPhantom() const +bool LLPathfindingLinkset::isPhantom() const { return isPhantom(getLinksetUse()); } LLPathfindingLinkset::ELinksetUse LLPathfindingLinkset::getLinksetUseWithToggledPhantom(ELinksetUse pLinksetUse) { - BOOL isPhantom = LLPathfindingLinkset::isPhantom(pLinksetUse); + bool isPhantom = LLPathfindingLinkset::isPhantom(pLinksetUse); ENavMeshGenerationCategory navMeshGenerationCategory = getNavMeshGenerationCategory(pLinksetUse); return getLinksetUse(!isPhantom, navMeshGenerationCategory); @@ -259,9 +259,9 @@ void LLPathfindingLinkset::parsePathfindingData(const LLSD &pLinksetData) llassert(mWalkabilityCoefficientD <= MAX_WALKABILITY_VALUE); } -BOOL LLPathfindingLinkset::isPhantom(ELinksetUse pLinksetUse) +bool LLPathfindingLinkset::isPhantom(ELinksetUse pLinksetUse) { - BOOL retVal; + bool retVal; switch (pLinksetUse) { diff --git a/indra/newview/llpathfindinglinkset.h b/indra/newview/llpathfindinglinkset.h index ef236d5949..0f2268861f 100644 --- a/indra/newview/llpathfindinglinkset.h +++ b/indra/newview/llpathfindinglinkset.h @@ -56,15 +56,15 @@ public: inline bool isTerrain() const {return mIsTerrain;}; inline U32 getLandImpact() const {return mLandImpact;}; - BOOL isModifiable() const {return mIsModifiable;}; - BOOL isPhantom() const; - BOOL canBeVolume() const {return mCanBeVolume;}; + bool isModifiable() const {return mIsModifiable;}; + bool isPhantom() const; + bool canBeVolume() const {return mCanBeVolume;}; static ELinksetUse getLinksetUseWithToggledPhantom(ELinksetUse pLinksetUse); inline ELinksetUse getLinksetUse() const {return mLinksetUse;}; - inline BOOL isScripted() const {return mIsScripted;}; - inline BOOL hasIsScripted() const {return mHasIsScripted;}; + inline bool isScripted() const {return mIsScripted;}; + inline bool hasIsScripted() const {return mHasIsScripted;}; inline S32 getWalkabilityCoefficientA() const {return mWalkabilityCoefficientA;}; inline S32 getWalkabilityCoefficientB() const {return mWalkabilityCoefficientB;}; @@ -92,7 +92,7 @@ private: void parseLinksetData(const LLSD &pLinksetData); void parsePathfindingData(const LLSD &pLinksetData); - static BOOL isPhantom(ELinksetUse pLinksetUse); + static bool isPhantom(ELinksetUse pLinksetUse); static ELinksetUse getLinksetUse(bool pIsPhantom, ENavMeshGenerationCategory pNavMeshGenerationCategory); static ENavMeshGenerationCategory getNavMeshGenerationCategory(ELinksetUse pLinksetUse); static LLSD convertCategoryToLLSD(ENavMeshGenerationCategory pNavMeshGenerationCategory); @@ -100,10 +100,10 @@ private: bool mIsTerrain; U32 mLandImpact; - BOOL mIsModifiable; - BOOL mCanBeVolume; - BOOL mIsScripted; - BOOL mHasIsScripted; + bool mIsModifiable; + bool mCanBeVolume; + bool mIsScripted; + bool mHasIsScripted; ELinksetUse mLinksetUse; S32 mWalkabilityCoefficientA; S32 mWalkabilityCoefficientB; diff --git a/indra/newview/llpathfindinglinksetlist.cpp b/indra/newview/llpathfindinglinksetlist.cpp index ee68db759d..2012d7a094 100644 --- a/indra/newview/llpathfindinglinksetlist.cpp +++ b/indra/newview/llpathfindinglinksetlist.cpp @@ -141,15 +141,15 @@ bool LLPathfindingLinksetList::isShowCannotBeVolumeWarning(LLPathfindingLinkset: return isShowWarning; } -void LLPathfindingLinksetList::determinePossibleStates(BOOL &pCanBeWalkable, BOOL &pCanBeStaticObstacle, BOOL &pCanBeDynamicObstacle, - BOOL &pCanBeMaterialVolume, BOOL &pCanBeExclusionVolume, BOOL &pCanBeDynamicPhantom) const +void LLPathfindingLinksetList::determinePossibleStates(bool &pCanBeWalkable, bool &pCanBeStaticObstacle, bool &pCanBeDynamicObstacle, + bool &pCanBeMaterialVolume, bool &pCanBeExclusionVolume, bool &pCanBeDynamicPhantom) const { - pCanBeWalkable = FALSE; - pCanBeStaticObstacle = FALSE; - pCanBeDynamicObstacle = FALSE; - pCanBeMaterialVolume = FALSE; - pCanBeExclusionVolume = FALSE; - pCanBeDynamicPhantom = FALSE; + pCanBeWalkable = false; + pCanBeStaticObstacle = false; + pCanBeDynamicObstacle = false; + pCanBeMaterialVolume = false; + pCanBeExclusionVolume = false; + pCanBeDynamicPhantom = false; for (const_iterator objectIter = begin(); !(pCanBeWalkable && pCanBeStaticObstacle && pCanBeDynamicObstacle && pCanBeMaterialVolume && pCanBeExclusionVolume && pCanBeDynamicPhantom) && (objectIter != end()); @@ -160,36 +160,36 @@ void LLPathfindingLinksetList::determinePossibleStates(BOOL &pCanBeWalkable, BOO if (linkset->isTerrain()) { - pCanBeWalkable = TRUE; + pCanBeWalkable = true; } else { if (linkset->isModifiable()) { - pCanBeWalkable = TRUE; - pCanBeStaticObstacle = TRUE; - pCanBeDynamicObstacle = TRUE; - pCanBeDynamicPhantom = TRUE; + pCanBeWalkable = true; + pCanBeStaticObstacle = true; + pCanBeDynamicObstacle = true; + pCanBeDynamicPhantom = true; if (linkset->canBeVolume()) { - pCanBeMaterialVolume = TRUE; - pCanBeExclusionVolume = TRUE; + pCanBeMaterialVolume = true; + pCanBeExclusionVolume = true; } } else if (linkset->isPhantom()) { - pCanBeDynamicPhantom = TRUE; + pCanBeDynamicPhantom = true; if (linkset->canBeVolume()) { - pCanBeMaterialVolume = TRUE; - pCanBeExclusionVolume = TRUE; + pCanBeMaterialVolume = true; + pCanBeExclusionVolume = true; } } else { - pCanBeWalkable = TRUE; - pCanBeStaticObstacle = TRUE; - pCanBeDynamicObstacle = TRUE; + pCanBeWalkable = true; + pCanBeStaticObstacle = true; + pCanBeDynamicObstacle = true; } } } diff --git a/indra/newview/llpathfindinglinksetlist.h b/indra/newview/llpathfindinglinksetlist.h index ae68227824..12b418ada0 100644 --- a/indra/newview/llpathfindinglinksetlist.h +++ b/indra/newview/llpathfindinglinksetlist.h @@ -46,8 +46,8 @@ public: bool isShowPhantomToggleWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const; bool isShowCannotBeVolumeWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const; - void determinePossibleStates(BOOL &pCanBeWalkable, BOOL &pCanBeStaticObstacle, BOOL &pCanBeDynamicObstacle, - BOOL &pCanBeMaterialVolume, BOOL &pCanBeExclusionVolume, BOOL &pCanBeDynamicPhantom) const; + void determinePossibleStates(bool &pCanBeWalkable, bool &pCanBeStaticObstacle, bool &pCanBeDynamicObstacle, + bool &pCanBeMaterialVolume, bool &pCanBeExclusionVolume, bool &pCanBeDynamicPhantom) const; protected: diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index 7b7caa5a79..5e7bc4fb3b 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -363,7 +363,7 @@ void LLPathfindingManager::requestGetAgentState() if (currentRegion == NULL) { - mAgentStateSignal(FALSE); + mAgentStateSignal(false); } else { @@ -373,7 +373,7 @@ void LLPathfindingManager::requestGetAgentState() } else if (!isPathfindingEnabledForRegion(currentRegion)) { - mAgentStateSignal(FALSE); + mAgentStateSignal(false); } else { @@ -708,7 +708,7 @@ void LLPathfindingManager::handleNavMeshStatusUpdate(const LLPathfindingNavMeshS } } -void LLPathfindingManager::handleAgentState(BOOL pCanRebakeRegion) +void LLPathfindingManager::handleAgentState(bool pCanRebakeRegion) { mAgentStateSignal(pCanRebakeRegion); } @@ -831,7 +831,7 @@ void LLAgentStateChangeNode::post(ResponsePtr pResponse, const LLSD &pContext, c llassert(pInput.get(SIM_MESSAGE_BODY_FIELD).isMap()); llassert(pInput.get(SIM_MESSAGE_BODY_FIELD).has(AGENT_STATE_CAN_REBAKE_REGION_FIELD)); llassert(pInput.get(SIM_MESSAGE_BODY_FIELD).get(AGENT_STATE_CAN_REBAKE_REGION_FIELD).isBoolean()); - BOOL canRebakeRegion = pInput.get(SIM_MESSAGE_BODY_FIELD).get(AGENT_STATE_CAN_REBAKE_REGION_FIELD).asBoolean(); + bool canRebakeRegion = pInput.get(SIM_MESSAGE_BODY_FIELD).get(AGENT_STATE_CAN_REBAKE_REGION_FIELD).asBoolean(); LLPathfindingManager::getInstance()->handleAgentState(canRebakeRegion); } diff --git a/indra/newview/llpathfindingmanager.h b/indra/newview/llpathfindingmanager.h index be03b161a0..663cb3cf34 100644 --- a/indra/newview/llpathfindingmanager.h +++ b/indra/newview/llpathfindingmanager.h @@ -83,8 +83,8 @@ public: void requestGetCharacters(request_id_t pRequestId, object_request_callback_t pCharactersCallback) const; - typedef boost::function<void (BOOL)> agent_state_callback_t; - typedef boost::signals2::signal<void (BOOL)> agent_state_signal_t; + typedef boost::function<void (bool)> agent_state_callback_t; + typedef boost::signals2::signal<void (bool)> agent_state_signal_t; typedef boost::signals2::connection agent_state_slot_t; agent_state_slot_t registerAgentStateListener(agent_state_callback_t pAgentStateCallback); @@ -114,7 +114,7 @@ private: //void handleNavMeshStatusRequest(const LLPathfindingNavMeshStatus &pNavMeshStatus, LLViewerRegion *pRegion, bool pIsGetStatusOnly); void handleNavMeshStatusUpdate(const LLPathfindingNavMeshStatus &pNavMeshStatus); - void handleAgentState(BOOL pCanRebakeRegion); + void handleAgentState(bool pCanRebakeRegion); LLPathfindingNavMeshPtr getNavMeshForRegion(const LLUUID &pRegionUUID); LLPathfindingNavMeshPtr getNavMeshForRegion(LLViewerRegion *pRegion); diff --git a/indra/newview/llpathfindingnavmesh.cpp b/indra/newview/llpathfindingnavmesh.cpp index 52a7383da6..c9fbeba2f3 100644 --- a/indra/newview/llpathfindingnavmesh.cpp +++ b/indra/newview/llpathfindingnavmesh.cpp @@ -140,12 +140,12 @@ void LLPathfindingNavMesh::handleNavMeshResult(const LLSD &pContent, U32 pNavMes if ( pContent.has(NAVMESH_DATA_FIELD) ) { const LLSD::Binary &value = pContent.get(NAVMESH_DATA_FIELD).asBinary(); - unsigned int binSize = value.size(); + auto binSize = value.size(); std::string newStr(reinterpret_cast<const char *>(&value[0]), binSize); std::istringstream streamdecomp( newStr ); size_t decompBinSize = 0; bool valid = false; - U8* pUncompressedNavMeshContainer = unzip_llsdNavMesh( valid, decompBinSize, streamdecomp, binSize ) ; + U8* pUncompressedNavMeshContainer = unzip_llsdNavMesh(valid, decompBinSize, streamdecomp, static_cast<S32>(binSize)); if ( !valid ) { LL_WARNS() << "Unable to decompress the navmesh llsd." << LL_ENDL; diff --git a/indra/newview/llpathfindingobject.h b/indra/newview/llpathfindingobject.h index 2561e8d66f..17f12efd83 100644 --- a/indra/newview/llpathfindingobject.h +++ b/indra/newview/llpathfindingobject.h @@ -56,10 +56,10 @@ public: inline const LLUUID& getUUID() const {return mUUID;}; inline const std::string& getName() const {return mName;}; inline const std::string& getDescription() const {return mDescription;}; - inline BOOL hasOwner() const {return mOwnerUUID.notNull();}; + inline bool hasOwner() const {return mOwnerUUID.notNull();}; inline bool hasOwnerName() const {return mHasOwnerName;}; std::string getOwnerName() const; - inline BOOL isGroupOwned() const {return mIsGroupOwned;}; + inline bool isGroupOwned() const {return mIsGroupOwned;}; inline const LLVector3& getLocation() const {return mLocation;}; typedef boost::function<void (const LLPathfindingObject *)> name_callback_t; @@ -84,7 +84,7 @@ private: bool mHasOwnerName; LLAvatarName mOwnerName; LLAvatarNameCache::callback_connection_t mAvatarNameCacheConnection; - BOOL mIsGroupOwned; + bool mIsGroupOwned; LLVector3 mLocation; name_signal_t mOwnerNameSignal; }; diff --git a/indra/newview/llpathfindingpathtool.cpp b/indra/newview/llpathfindingpathtool.cpp index a57283d5cd..61791492e7 100644 --- a/indra/newview/llpathfindingpathtool.cpp +++ b/indra/newview/llpathfindingpathtool.cpp @@ -35,9 +35,6 @@ #include "llagent.h" #include "llpathfindingmanager.h" -#include "llpathinglib.h" -#include "llsingleton.h" -#include "lltool.h" #include "llviewercamera.h" #include "llviewerregion.h" #include "llviewerwindow.h" @@ -63,9 +60,9 @@ LLPathfindingPathTool::~LLPathfindingPathTool() { } -BOOL LLPathfindingPathTool::handleMouseDown(S32 pX, S32 pY, MASK pMask) +bool LLPathfindingPathTool::handleMouseDown(S32 pX, S32 pY, MASK pMask) { - BOOL returnVal = FALSE; + bool returnVal = false; if (!mIsLeftMouseButtonHeld && !mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld) { @@ -76,15 +73,15 @@ BOOL LLPathfindingPathTool::handleMouseDown(S32 pX, S32 pY, MASK pMask) : UI_CURSOR_TOOLPATHFINDING_PATH_END_ADD); computeFinalPoints(pX, pY, pMask); mIsLeftMouseButtonHeld = true; - setMouseCapture(TRUE); - returnVal = TRUE; + setMouseCapture(true); + returnVal = true; } else if (!isCameraModKeys(pMask)) { gViewerWindow->setCursor(UI_CURSOR_TOOLNO); mIsLeftMouseButtonHeld = true; - setMouseCapture(TRUE); - returnVal = TRUE; + setMouseCapture(true); + returnVal = true; } } mIsLeftMouseButtonHeld = true; @@ -92,69 +89,69 @@ BOOL LLPathfindingPathTool::handleMouseDown(S32 pX, S32 pY, MASK pMask) return returnVal; } -BOOL LLPathfindingPathTool::handleMouseUp(S32 pX, S32 pY, MASK pMask) +bool LLPathfindingPathTool::handleMouseUp(S32 pX, S32 pY, MASK pMask) { - BOOL returnVal = FALSE; + bool returnVal = false; if (mIsLeftMouseButtonHeld && !mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld) { computeFinalPoints(pX, pY, pMask); - setMouseCapture(FALSE); - returnVal = TRUE; + setMouseCapture(false); + returnVal = true; } mIsLeftMouseButtonHeld = false; return returnVal; } -BOOL LLPathfindingPathTool::handleMiddleMouseDown(S32 pX, S32 pY, MASK pMask) +bool LLPathfindingPathTool::handleMiddleMouseDown(S32 pX, S32 pY, MASK pMask) { - setMouseCapture(TRUE); + setMouseCapture(true); mIsMiddleMouseButtonHeld = true; gViewerWindow->setCursor(UI_CURSOR_TOOLNO); - return TRUE; + return true; } -BOOL LLPathfindingPathTool::handleMiddleMouseUp(S32 pX, S32 pY, MASK pMask) +bool LLPathfindingPathTool::handleMiddleMouseUp(S32 pX, S32 pY, MASK pMask) { if (!mIsLeftMouseButtonHeld && mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld) { - setMouseCapture(FALSE); + setMouseCapture(false); } mIsMiddleMouseButtonHeld = false; - return TRUE; + return true; } -BOOL LLPathfindingPathTool::handleRightMouseDown(S32 pX, S32 pY, MASK pMask) +bool LLPathfindingPathTool::handleRightMouseDown(S32 pX, S32 pY, MASK pMask) { - setMouseCapture(TRUE); + setMouseCapture(true); mIsRightMouseButtonHeld = true; gViewerWindow->setCursor(UI_CURSOR_TOOLNO); - return TRUE; + return true; } -BOOL LLPathfindingPathTool::handleRightMouseUp(S32 pX, S32 pY, MASK pMask) +bool LLPathfindingPathTool::handleRightMouseUp(S32 pX, S32 pY, MASK pMask) { if (!mIsLeftMouseButtonHeld && !mIsMiddleMouseButtonHeld && mIsRightMouseButtonHeld) { - setMouseCapture(FALSE); + setMouseCapture(false); } mIsRightMouseButtonHeld = false; - return TRUE; + return true; } -BOOL LLPathfindingPathTool::handleDoubleClick(S32 pX, S32 pY, MASK pMask) +bool LLPathfindingPathTool::handleDoubleClick(S32 pX, S32 pY, MASK pMask) { - return TRUE; + return true; } -BOOL LLPathfindingPathTool::handleHover(S32 pX, S32 pY, MASK pMask) +bool LLPathfindingPathTool::handleHover(S32 pX, S32 pY, MASK pMask) { - BOOL returnVal = FALSE; + bool returnVal = false; if (!mIsLeftMouseButtonHeld && !mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld && !isAnyPathToolModKeys(pMask)) { @@ -167,7 +164,7 @@ BOOL LLPathfindingPathTool::handleHover(S32 pX, S32 pY, MASK pMask) ? (mIsLeftMouseButtonHeld ? UI_CURSOR_TOOLPATHFINDING_PATH_START_ADD : UI_CURSOR_TOOLPATHFINDING_PATH_START) : (mIsLeftMouseButtonHeld ? UI_CURSOR_TOOLPATHFINDING_PATH_END_ADD : UI_CURSOR_TOOLPATHFINDING_PATH_END)); computeTempPoints(pX, pY, pMask); - returnVal = TRUE; + returnVal = true; } else { @@ -178,7 +175,7 @@ BOOL LLPathfindingPathTool::handleHover(S32 pX, S32 pY, MASK pMask) return returnVal; } -BOOL LLPathfindingPathTool::handleKey(KEY pKey, MASK pMask) +bool LLPathfindingPathTool::handleKey(KEY pKey, MASK pMask) { // Eat the escape key or else the camera tool will pick up and reset to default view. This, // in turn, will cause some other methods to get called. And one of those methods will reset diff --git a/indra/newview/llpathfindingpathtool.h b/indra/newview/llpathfindingpathtool.h index 0713616113..189b9d4954 100644 --- a/indra/newview/llpathfindingpathtool.h +++ b/indra/newview/llpathfindingpathtool.h @@ -66,17 +66,17 @@ public: typedef boost::signals2::signal<void (void)> path_event_signal_t; typedef boost::signals2::connection path_event_slot_t; - virtual BOOL handleMouseDown(S32 pX, S32 pY, MASK pMask) override; - virtual BOOL handleMouseUp(S32 pX, S32 pY, MASK pMask) override; - virtual BOOL handleMiddleMouseDown(S32 pX, S32 pY, MASK pMask) override; - virtual BOOL handleMiddleMouseUp(S32 pX, S32 pY, MASK pMask) override; - virtual BOOL handleRightMouseDown(S32 pX, S32 pY, MASK pMask) override; - virtual BOOL handleRightMouseUp(S32 pX, S32 pY, MASK pMask) override; - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override; + virtual bool handleMouseDown(S32 pX, S32 pY, MASK pMask) override; + virtual bool handleMouseUp(S32 pX, S32 pY, MASK pMask) override; + virtual bool handleMiddleMouseDown(S32 pX, S32 pY, MASK pMask) override; + virtual bool handleMiddleMouseUp(S32 pX, S32 pY, MASK pMask) override; + virtual bool handleRightMouseDown(S32 pX, S32 pY, MASK pMask) override; + virtual bool handleRightMouseUp(S32 pX, S32 pY, MASK pMask) override; + virtual bool handleDoubleClick(S32 x, S32 y, MASK mask) override; - virtual BOOL handleHover(S32 pX, S32 pY, MASK pMask) override; + virtual bool handleHover(S32 pX, S32 pY, MASK pMask) override; - virtual BOOL handleKey(KEY pKey, MASK pMask) override; + virtual bool handleKey(KEY pKey, MASK pMask) override; EPathStatus getPathStatus() const; diff --git a/indra/newview/llpbrterrainfeatures.cpp b/indra/newview/llpbrterrainfeatures.cpp new file mode 100644 index 0000000000..bb771c6963 --- /dev/null +++ b/indra/newview/llpbrterrainfeatures.cpp @@ -0,0 +1,198 @@ +/** + * @file llpbrterrainfeatures.cpp + * + * $LicenseInfo:firstyear=2024&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2024, 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 "llviewerprecompiledheaders.h" + +#include "llpbrterrainfeatures.h" + +#include "llappviewer.h" +#include "llgltfmaterial.h" +#include "llviewerregion.h" +#include "llvlcomposition.h" + +LLPBRTerrainFeatures gPBRTerrainFeatures; + +// static +void LLPBRTerrainFeatures::queueQuery(LLViewerRegion& region, void(*done_callback)(LLUUID, bool, const LLModifyRegion&)) +{ + llassert(on_main_thread()); + llassert(LLCoros::on_main_coro()); + + LLUUID region_id = region.getRegionID(); + + LLCoros::instance().launch("queryRegionCoro", + std::bind(&LLPBRTerrainFeatures::queryRegionCoro, + region.getCapability("ModifyRegion"), + region_id, + done_callback)); +} + +// static +void LLPBRTerrainFeatures::queueModify(LLViewerRegion& region, const LLModifyRegion& composition) +{ + llassert(on_main_thread()); + llassert(LLCoros::on_main_coro()); + + LLSD updates = LLSD::emptyMap(); + + LLSD override_updates = LLSD::emptyArray(); + for (S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i) + { + const LLGLTFMaterial* material_override = composition.getMaterialOverride(i); + LLSD override_update; + if (material_override) + { + LLGLTFMaterial::sDefault.getOverrideLLSD(*material_override, override_update); + } + else + { + override_update = LLSD::emptyMap(); + } + override_updates.append(override_update); + } + updates["overrides"] = override_updates; + + LLCoros::instance().launch("modifyRegionCoro", + std::bind(&LLPBRTerrainFeatures::modifyRegionCoro, + region.getCapability("ModifyRegion"), + updates, + nullptr)); +} + +// static +void LLPBRTerrainFeatures::queryRegionCoro(std::string cap_url, LLUUID region_id, void(*done_callback)(LLUUID, bool, const LLModifyRegion&) ) +{ + LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); + LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t + httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("queryRegionCoro", httpPolicy)); + LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + LLCore::HttpHeaders::ptr_t httpHeaders; + + httpOpts->setFollowRedirects(true); + + LL_DEBUGS("GLTF") << "Querying features via ModifyRegion endpoint" << LL_ENDL; + + LLSD result = httpAdapter->getAndSuspend(httpRequest, cap_url, httpOpts, httpHeaders); + + LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; + LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); + + bool success = true; + if (!status || !result["success"].asBoolean()) + { + if (result["message"].isUndefined()) + { + LL_WARNS("PBRTerrain") << "Failed to query PBR terrain features." << LL_ENDL; + } + else + { + LL_WARNS("PBRTerrain") << "Failed to query PBR terrain features: " << result["message"] << LL_ENDL; + } + success = false; + } + + LLTerrainMaterials* composition = new LLTerrainMaterials(); + + if (success) + { + const LLSD& overrides = result["overrides"]; + if (!overrides.isArray() || overrides.size() < LLTerrainMaterials::ASSET_COUNT) + { + LL_WARNS("PBRTerrain") << "Invalid composition format: Missing/invalid overrides" << LL_ENDL; + success = false; + } + else + { + for (S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i) + { + const LLSD& override_llsd = overrides[i]; + LLPointer<LLGLTFMaterial> material_override = new LLGLTFMaterial(); + material_override->applyOverrideLLSD(override_llsd); + if (*material_override == LLGLTFMaterial::sDefault) + { + material_override = nullptr; + } + composition->setMaterialOverride(i, material_override.get()); + } + } + } + + if (done_callback) + { + LLAppViewer::instance()->postToMainCoro([=]() + { + done_callback(region_id, success, *composition); + delete composition; + }); + } + else + { + delete composition; + } +} + +// static +void LLPBRTerrainFeatures::modifyRegionCoro(std::string cap_url, LLSD updates, void(*done_callback)(bool) ) +{ + LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); + LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t + httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("modifyRegionCoro", httpPolicy)); + LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + LLCore::HttpHeaders::ptr_t httpHeaders; + + httpOpts->setFollowRedirects(true); + + LL_DEBUGS("GLTF") << "Applying features via ModifyRegion endpoint: " << updates << LL_ENDL; + + LLSD result = httpAdapter->postAndSuspend(httpRequest, cap_url, updates, httpOpts, httpHeaders); + + LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; + LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); + + bool success = true; + if (!status || !result["success"].asBoolean()) + { + if (result["message"].isUndefined()) + { + LL_WARNS("PBRTerrain") << "Failed to modify PBR terrain features." << LL_ENDL; + } + else + { + LL_WARNS("PBRTerrain") << "Failed to modify PBR terrain features: " << result["message"] << LL_ENDL; + } + success = false; + } + + if (done_callback) + { + LLAppViewer::instance()->postToMainCoro([=]() + { + done_callback(success); + }); + } +} + diff --git a/indra/newview/llsavedsettingsglue.h b/indra/newview/llpbrterrainfeatures.h index 61967c53d3..f29d4ebf50 100644 --- a/indra/newview/llsavedsettingsglue.h +++ b/indra/newview/llpbrterrainfeatures.h @@ -1,11 +1,9 @@ /** - * @file llsavedsettingsglue.h - * @author James Cook - * @brief LLSavedSettingsGlue class definition + * @file llpbrterrainfeatures.h * - * $LicenseInfo:firstyear=2006&license=viewerlgpl$ + * $LicenseInfo:firstyear=2024&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * Copyright (C) 2024, 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 @@ -25,22 +23,26 @@ * $/LicenseInfo$ */ -#ifndef LL_LLSAVEDSETTINGSGLUE_H -#define LL_LLSAVEDSETTINGSGLUE_H -class LLUICtrl; +#pragma once -// Helper to change gSavedSettings from UI widget commit callbacks. -// Set the widget callback to be one of the setFoo() calls below, -// and assign the control name as a const char* to the userdata. -class LLSavedSettingsGlue +#include <string> + +class LLViewerRegion; +class LLMessageSystem; +class LLModifyRegion; + +// Queries/modifies PBR terrain repeats, possibly other features in the future +class LLPBRTerrainFeatures { public: - static void setBOOL(LLUICtrl* ctrl, const std::string& name); - static void setS32(LLUICtrl* ctrl, const std::string& name); - static void setF32(LLUICtrl* ctrl, const std::string& name); - static void setU32(LLUICtrl* ctrl, const std::string& name); - static void setString(LLUICtrl* ctrl, const std::string& name); + static void queueQuery(LLViewerRegion& region, void(*done_callback)(LLUUID, bool, const LLModifyRegion&)); + static void queueModify(LLViewerRegion& region, const LLModifyRegion& composition); + +private: + static void queryRegionCoro(std::string cap_url, LLUUID region_id, void(*done_callback)(LLUUID, bool, const LLModifyRegion&) ); + static void modifyRegionCoro(std::string cap_url, LLSD updates, void(*done_callback)(bool) ); }; -#endif +extern LLPBRTerrainFeatures gPBRTerrainFeatures; + diff --git a/indra/newview/llperfstats.cpp b/indra/newview/llperfstats.cpp index f8737076b3..64f438976a 100644 --- a/indra/newview/llperfstats.cpp +++ b/indra/newview/llperfstats.cpp @@ -131,14 +131,14 @@ namespace LLPerfStats if(gSavedSettings.getBOOL("AutoTuneLock") && !gSavedSettings.getU32("KeepAutoTuneLock")) { - gSavedSettings.setBOOL("AutoTuneLock", FALSE); + gSavedSettings.setBOOL("AutoTuneLock", false); } LLPerfStats::tunables.userAutoTuneEnabled = LLPerfStats::tunables.userAutoTuneLock; if (LLPerfStats::tunables.userAutoTuneEnabled && !gSavedSettings.getBOOL("AutoTuneFPS")) { - gSavedSettings.setBOOL("AutoTuneFPS", TRUE); + gSavedSettings.setBOOL("AutoTuneFPS", true); } // Note: The Max ART slider is logarithmic and thus we have an intermediate proxy value @@ -302,7 +302,7 @@ namespace LLPerfStats std::vector<LLVector3d> positions; uuid_vec_t avatar_ids; LLWorld::getInstance()->getAvatars(&avatar_ids, &positions, our_pos, distance); - return positions.size(); + return static_cast<int>(positions.size()); } const U32 NUM_PERIODS = 50; @@ -378,7 +378,7 @@ namespace LLPerfStats auto count = countNearbyAvatars(std::min(LLPipeline::RenderFarClip, tunables.userImpostorDistance)); if( count != tunables.nonImpostors ) { - tunables.updateNonImposters( (count < LLVOAvatar::NON_IMPOSTORS_MAX_SLIDER)?count : 0 ); + tunables.updateNonImposters(((U32)count < LLVOAvatar::NON_IMPOSTORS_MAX_SLIDER) ? count : 0); LL_DEBUGS("AutoTune") << "There are " << count << "avatars within " << std::min(LLPipeline::RenderFarClip, tunables.userImpostorDistance) << "m of the camera" << LL_ENDL; } } @@ -411,7 +411,7 @@ namespace LLPerfStats return; } - if(belowTargetFPS == false) + if (!belowTargetFPS) { // this is the first frame under. hold fire to add a little hysteresis belowTargetFPS = true; @@ -488,7 +488,7 @@ namespace LLPerfStats new_render_limit_ns = std::max((U64)new_render_limit_ns, (U64)LLPerfStats::ART_MINIMUM_NANOS); // assign the new value - if(renderAvatarMaxART_ns != new_render_limit_ns) + if (renderAvatarMaxART_ns != new_render_limit_ns) { renderAvatarMaxART_ns = new_render_limit_ns; tunables.updateSettingsFromRenderCostLimit(); @@ -497,10 +497,10 @@ namespace LLPerfStats } // LL_DEBUGS() << "AUTO_TUNE: Target frame time:"<< LLPerfStats::raw_to_us(target_frame_time_raw) << "usecs (non_avatar is " << LLPerfStats::raw_to_us(non_avatar_time_raw) << "usecs) Max cost limited=" << renderAvatarMaxART_ns << LL_ENDL; } - else if(( LLPerfStats::raw_to_ns(target_frame_time_raw) > (LLPerfStats::raw_to_ns(tot_frame_time_raw) + renderAvatarMaxART_ns) ) || + else if ((LLPerfStats::raw_to_ns(target_frame_time_raw) > (LLPerfStats::raw_to_ns(tot_frame_time_raw) + renderAvatarMaxART_ns)) || (tunables.vsyncEnabled && (target_fps == LLPerfStats::vsync_max_fps) && (target_frame_time_raw > getMeanTotalFrameTime()))) { - if(belowTargetFPS == true) + if (belowTargetFPS) { // we reached target, force a pause lastGlobalPrefChange = gFrameCount; @@ -508,15 +508,17 @@ namespace LLPerfStats } // once we're over the FPS target we slow down further - if((gFrameCount - lastGlobalPrefChange) > settingsChangeFrequency*3) + if ((gFrameCount - lastGlobalPrefChange) > settingsChangeFrequency * 3) { - if(!tunables.userAutoTuneLock) + if (!tunables.userAutoTuneLock) { // we've reached the target and stayed long enough to consider stable. // turn off if we are not locked. tunables.updateUserAutoTuneEnabled(false); } - if(renderAvatarMaxART_ns != 0 && LLPerfStats::tunedAvatars > 0 && (tunables.userFPSTuningStrategy != TUNE_SCENE_ONLY) ) + if (renderAvatarMaxART_ns > 0 && + LLPerfStats::tunedAvatars > 0 && + tunables.userFPSTuningStrategy != TUNE_SCENE_ONLY) { // if we have more time to spare let's shift up little in the hope we'll restore an avatar. U64 up_step = LLPerfStats::tunedAvatars > 2 ? LLPerfStats::ART_MIN_ADJUST_UP_NANOS : LLPerfStats::ART_MIN_ADJUST_UP_NANOS * 2; @@ -524,15 +526,15 @@ namespace LLPerfStats tunables.updateSettingsFromRenderCostLimit(); return; } - if(tunables.userFPSTuningStrategy != TUNE_AVATARS_ONLY) + if (tunables.userFPSTuningStrategy != TUNE_AVATARS_ONLY) { - if( LLPipeline::RenderFarClip < tunables.userTargetDrawDistance ) + if (LLPipeline::RenderFarClip < tunables.userTargetDrawDistance) { LLPerfStats::tunables.updateFarClip( std::min(LLPipeline::RenderFarClip + DD_STEP, tunables.userTargetDrawDistance) ); LLPerfStats::lastGlobalPrefChange = gFrameCount; return; } - if( (tot_frame_time_raw * 1.5) < target_frame_time_raw ) + if ((tot_frame_time_raw * 1.5) < target_frame_time_raw) { // if everything else is "max" and we have >50% headroom let's knock the water quality up a notch at a time. # if 0 // RenderReflectionDetail went away diff --git a/indra/newview/llphysicsmotion.cpp b/indra/newview/llphysicsmotion.cpp index 9c6a4a7f10..b6bcd6dd7d 100644 --- a/indra/newview/llphysicsmotion.cpp +++ b/indra/newview/llphysicsmotion.cpp @@ -120,11 +120,11 @@ public: } } - BOOL initialize(); + bool initialize(); ~LLPhysicsMotion() {} - BOOL onUpdate(F32 time); + bool onUpdate(F32 time); LLPointer<LLJointState> getJointState() { @@ -217,20 +217,20 @@ default_controller_map_t initDefaultController() default_controller_map_t LLPhysicsMotion::sDefaultController = initDefaultController(); -BOOL LLPhysicsMotion::initialize() +bool LLPhysicsMotion::initialize() { if (!mJointState->setJoint(mCharacter->getJoint(mJointName.c_str()))) - return FALSE; + return false; mJointState->setUsage(LLJointState::ROT); mParamDriver = (LLViewerVisualParam*)mCharacter->getVisualParam(mParamDriverName.c_str()); if (mParamDriver == NULL) { LL_INFOS() << "Failure reading in [ " << mParamDriverName << " ]" << LL_ENDL; - return FALSE; + return false; } - return TRUE; + return true; } LLPhysicsMotionController::LLPhysicsMotionController(const LLUUID &id) : @@ -250,9 +250,9 @@ LLPhysicsMotionController::~LLPhysicsMotionController() } } -BOOL LLPhysicsMotionController::onActivate() +bool LLPhysicsMotionController::onActivate() { - return TRUE; + return true; } void LLPhysicsMotionController::onDeactivate() @@ -282,7 +282,7 @@ LLMotion::LLMotionInitStatus LLPhysicsMotionController::onInitialize(LLCharacter controller); if (!motion->initialize()) { - llassert_always(FALSE); + llassert_always(false); return STATUS_FAILURE; } addMotion(motion); @@ -305,7 +305,7 @@ LLMotion::LLMotionInitStatus LLPhysicsMotionController::onInitialize(LLCharacter controller); if (!motion->initialize()) { - llassert_always(FALSE); + llassert_always(false); return STATUS_FAILURE; } addMotion(motion); @@ -328,7 +328,7 @@ LLMotion::LLMotionInitStatus LLPhysicsMotionController::onInitialize(LLCharacter controller); if (!motion->initialize()) { - llassert_always(FALSE); + llassert_always(false); return STATUS_FAILURE; } addMotion(motion); @@ -350,7 +350,7 @@ LLMotion::LLMotionInitStatus LLPhysicsMotionController::onInitialize(LLCharacter controller); if (!motion->initialize()) { - llassert_always(FALSE); + llassert_always(false); return STATUS_FAILURE; } addMotion(motion); @@ -373,7 +373,7 @@ LLMotion::LLMotionInitStatus LLPhysicsMotionController::onInitialize(LLCharacter controller); if (!motion->initialize()) { - llassert_always(FALSE); + llassert_always(false); return STATUS_FAILURE; } addMotion(motion); @@ -396,7 +396,7 @@ LLMotion::LLMotionInitStatus LLPhysicsMotionController::onInitialize(LLCharacter controller); if (!motion->initialize()) { - llassert_always(FALSE); + llassert_always(false); return STATUS_FAILURE; } addMotion(motion); @@ -451,16 +451,16 @@ F32 LLPhysicsMotion::calculateAcceleration_local(const F32 velocity_local, const return smoothed_acceleration_local; } -BOOL LLPhysicsMotionController::onUpdate(F32 time, U8* joint_mask) +bool LLPhysicsMotionController::onUpdate(F32 time, U8* joint_mask) { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; // Skip if disabled globally. if (!gSavedSettings.getBOOL("AvatarPhysics")) { - return TRUE; + return true; } - BOOL update_visuals = FALSE; + bool update_visuals = false; for (motion_vec_t::iterator iter = mMotions.begin(); iter != mMotions.end(); ++iter) @@ -472,21 +472,21 @@ BOOL LLPhysicsMotionController::onUpdate(F32 time, U8* joint_mask) if (update_visuals) mCharacter->updateVisualParams(); - return TRUE; + return true; } -// Return TRUE if character has to update visual params. -BOOL LLPhysicsMotion::onUpdate(F32 time) +// Return true if character has to update visual params. +bool LLPhysicsMotion::onUpdate(F32 time) { // static FILE *mFileWrite = fopen("c:\\temp\\avatar_data.txt","w"); if (!mParamDriver) - return FALSE; + return false; if (!mLastTime || mLastTime >= time) { mLastTime = time; - return FALSE; + return false; } //////////////////////////////////////////////////////////////////////////////// @@ -499,7 +499,7 @@ BOOL LLPhysicsMotion::onUpdate(F32 time) if (time_delta > 1.0) { mLastTime = time; - return FALSE; + return false; } // Higher LOD is better. This controls the granularity @@ -507,7 +507,7 @@ BOOL LLPhysicsMotion::onUpdate(F32 time) const F32 lod_factor = LLVOAvatar::sPhysicsLODFactor; if (lod_factor == 0) { - return TRUE; + return true; } LLJoint *joint = mJointState->getJoint(); @@ -520,7 +520,7 @@ BOOL LLPhysicsMotion::onUpdate(F32 time) const F32 behavior_drag = getParamValue(DRAG); F32 behavior_maxeffect = getParamValue(MAX_EFFECT); - const BOOL physics_test = FALSE; // Enable this to simulate bouncing on all parts. + const bool physics_test = false; // Enable this to simulate bouncing on all parts. if (physics_test) behavior_maxeffect = 1.0f; @@ -548,7 +548,7 @@ BOOL LLPhysicsMotion::onUpdate(F32 time) // End velocity and acceleration //////////////////////////////////////////////////////////////////////////////// - BOOL update_visuals = FALSE; + bool update_visuals = false; // Break up the physics into a bunch of iterations so that differing framerates will show // roughly the same behavior. @@ -700,14 +700,14 @@ BOOL LLPhysicsMotion::onUpdate(F32 time) const F32 area_for_this_setting = area_for_max_settings + (area_for_min_settings-area_for_max_settings)*(1.0-lod_factor); const F32 pixel_area = sqrtf(mCharacter->getPixelArea()); - const BOOL is_self = (dynamic_cast<LLVOAvatarSelf *>(mCharacter) != NULL); + const bool is_self = (dynamic_cast<LLVOAvatarSelf *>(mCharacter) != NULL); if ((pixel_area > area_for_this_setting) || is_self) { const F32 position_diff_local = llabs(mPositionLastUpdate_local-position_new_local_clamped); const F32 min_delta = (1.0001f-lod_factor)*0.4f; if (llabs(position_diff_local) > min_delta) { - update_visuals = TRUE; + update_visuals = true; mPositionLastUpdate_local = position_new_local; } } diff --git a/indra/newview/llphysicsmotion.h b/indra/newview/llphysicsmotion.h index e7c31dff52..9f1278d22e 100644 --- a/indra/newview/llphysicsmotion.h +++ b/indra/newview/llphysicsmotion.h @@ -66,7 +66,7 @@ public: //------------------------------------------------------------------------- // motions must specify whether or not they loop - virtual BOOL getLoop() { return TRUE; } + virtual bool getLoop() { return true; } // motions must report their total duration virtual F32 getDuration() { return 0.0; } @@ -91,14 +91,14 @@ public: virtual LLMotionInitStatus onInitialize(LLCharacter *character); // called when a motion is activated - // must return TRUE to indicate success, or else + // must return true to indicate success, or else // it will be deactivated - virtual BOOL onActivate(); + virtual bool onActivate(); // called per time step - // must return TRUE while it is active, and - // must return FALSE when the motion is completed. - virtual BOOL onUpdate(F32 time, U8* joint_mask); + // must return true while it is active, and + // must return false when the motion is completed. + virtual bool onUpdate(F32 time, U8* joint_mask); // called when a motion is deactivated virtual void onDeactivate(); diff --git a/indra/newview/llphysicsshapebuilderutil.h b/indra/newview/llphysicsshapebuilderutil.h index 25b44bbbb5..01c173523b 100644 --- a/indra/newview/llphysicsshapebuilderutil.h +++ b/indra/newview/llphysicsshapebuilderutil.h @@ -73,7 +73,8 @@ public: { return LLVolumeParams::operator<(params); } - return (params.mForceConvex == false) && (mForceConvex == true); + + return !params.mForceConvex && mForceConvex; } bool shouldForceConvex() const { return mForceConvex; } diff --git a/indra/newview/llplacesfolderview.cpp b/indra/newview/llplacesfolderview.cpp index 3661d98c2a..770f927723 100644 --- a/indra/newview/llplacesfolderview.cpp +++ b/indra/newview/llplacesfolderview.cpp @@ -39,10 +39,10 @@ LLPlacesFolderView::LLPlacesFolderView(const LLFolderView::Params& p) // we do not need auto select functionality in places landmarks, so override default behavior. // this disables applying of the LLSelectFirstFilteredItem in LLFolderView::doIdle. // Fixed issues: EXT-1631, EXT-4994. - mAutoSelectOverride = TRUE; + mAutoSelectOverride = true; } -BOOL LLPlacesFolderView::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLPlacesFolderView::handleRightMouseDown(S32 x, S32 y, MASK mask) { // let children to change selection first childrenHandleRightMouseDown(x, y, mask); diff --git a/indra/newview/llplacesfolderview.h b/indra/newview/llplacesfolderview.h index 0a3d9ef21b..4b1cbcd992 100644 --- a/indra/newview/llplacesfolderview.h +++ b/indra/newview/llplacesfolderview.h @@ -49,7 +49,7 @@ public: * Contains workaround for EXT-2786: sets current selected list for landmark * panel using @c mParentLandmarksPanel which is set in @c LLLandmarksPanel::initLandmarksPanel */ - /*virtual*/ BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); + /*virtual*/ bool handleRightMouseDown( S32 x, S32 y, MASK mask ); /*virtual*/ void updateMenu(); diff --git a/indra/newview/llplacesinventorypanel.cpp b/indra/newview/llplacesinventorypanel.cpp index 23e490e124..03be8a4b2c 100644 --- a/indra/newview/llplacesinventorypanel.cpp +++ b/indra/newview/llplacesinventorypanel.cpp @@ -48,7 +48,7 @@ LLPlacesInventoryPanel::LLPlacesInventoryPanel(const Params& p) : { mInvFVBridgeBuilder = &PLACES_INVENTORY_BUILDER; mSavedFolderState = new LLSaveFolderState(); - mSavedFolderState->setApply(FALSE); + mSavedFolderState->setApply(false); } @@ -90,14 +90,14 @@ LLFolderView * LLPlacesInventoryPanel::createFolderRoot(LLUUID root_id ) // save current folder open state void LLPlacesInventoryPanel::saveFolderState() { - mSavedFolderState->setApply(FALSE); + mSavedFolderState->setApply(false); mFolderRoot.get()->applyFunctorRecursively(*mSavedFolderState); } // re-open folders which state was saved void LLPlacesInventoryPanel::restoreFolderState() { - mSavedFolderState->setApply(TRUE); + mSavedFolderState->setApply(true); mFolderRoot.get()->applyFunctorRecursively(*mSavedFolderState); LLOpenFoldersWithSelection opener; mFolderRoot.get()->applyFunctorRecursively(opener); @@ -121,12 +121,12 @@ S32 LLPlacesInventoryPanel::notify(const LLSD& info) return 0; } -BOOL LLPlacesInventoryPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, +bool LLPlacesInventoryPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string &tooltip_msg) { if (mAcceptsDragAndDrop) { return LLInventoryPanel::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); } - return FALSE; + return false; } diff --git a/indra/newview/llplacesinventorypanel.h b/indra/newview/llplacesinventorypanel.h index 755db690dd..9b33369f5f 100644 --- a/indra/newview/llplacesinventorypanel.h +++ b/indra/newview/llplacesinventorypanel.h @@ -53,7 +53,7 @@ public: virtual S32 notify(const LLSD& info) override; - BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, + bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string &tooltip_msg) override; private: diff --git a/indra/newview/llpopupview.cpp b/indra/newview/llpopupview.cpp index 0b13fc37b9..cc55b3c8db 100644 --- a/indra/newview/llpopupview.cpp +++ b/indra/newview/llpopupview.cpp @@ -94,12 +94,12 @@ void LLPopupView::draw() LLPanel::draw(); } -BOOL LLPopupView::handleMouseEvent(boost::function<BOOL(LLView*, S32, S32)> func, +bool LLPopupView::handleMouseEvent(boost::function<bool(LLView*, S32, S32)> func, boost::function<bool(LLView*)> predicate, S32 x, S32 y, bool close_popups) { - BOOL handled = FALSE; + bool handled = false; // make a copy of list of popups, in case list is modified during mouse event handling popup_list_t popups(mPopups); @@ -120,7 +120,7 @@ BOOL LLPopupView::handleMouseEvent(boost::function<BOOL(LLView*, S32, S32)> func { if (func(popup, popup_x, popup_y)) { - handled = TRUE; + handled = true; break; } } @@ -136,9 +136,9 @@ BOOL LLPopupView::handleMouseEvent(boost::function<BOOL(LLView*, S32, S32)> func } -BOOL LLPopupView::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLPopupView::handleMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleMouseDown, _1, _2, _3, mask), view_visible_and_enabled, x, y, true); + bool handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleMouseDown, _1, _2, _3, mask), view_visible_and_enabled, x, y, true); if (!handled) { handled = LLPanel::handleMouseDown(x, y, mask); @@ -146,9 +146,9 @@ BOOL LLPopupView::handleMouseDown(S32 x, S32 y, MASK mask) return handled; } -BOOL LLPopupView::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLPopupView::handleMouseUp(S32 x, S32 y, MASK mask) { - BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleMouseUp, _1, _2, _3, mask), view_visible_and_enabled, x, y, false); + bool handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleMouseUp, _1, _2, _3, mask), view_visible_and_enabled, x, y, false); if (!handled) { handled = LLPanel::handleMouseUp(x, y, mask); @@ -156,9 +156,9 @@ BOOL LLPopupView::handleMouseUp(S32 x, S32 y, MASK mask) return handled; } -BOOL LLPopupView::handleMiddleMouseDown(S32 x, S32 y, MASK mask) +bool LLPopupView::handleMiddleMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleMiddleMouseDown, _1, _2, _3, mask), view_visible_and_enabled, x, y, true); + bool handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleMiddleMouseDown, _1, _2, _3, mask), view_visible_and_enabled, x, y, true); if (!handled) { handled = LLPanel::handleMiddleMouseDown(x, y, mask); @@ -166,9 +166,9 @@ BOOL LLPopupView::handleMiddleMouseDown(S32 x, S32 y, MASK mask) return handled; } -BOOL LLPopupView::handleMiddleMouseUp(S32 x, S32 y, MASK mask) +bool LLPopupView::handleMiddleMouseUp(S32 x, S32 y, MASK mask) { - BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleMiddleMouseUp, _1, _2, _3, mask), view_visible_and_enabled, x, y, false); + bool handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleMiddleMouseUp, _1, _2, _3, mask), view_visible_and_enabled, x, y, false); if (!handled) { handled = LLPanel::handleMiddleMouseUp(x, y, mask); @@ -176,9 +176,9 @@ BOOL LLPopupView::handleMiddleMouseUp(S32 x, S32 y, MASK mask) return handled; } -BOOL LLPopupView::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLPopupView::handleRightMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleRightMouseDown, _1, _2, _3, mask), view_visible_and_enabled, x, y, true); + bool handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleRightMouseDown, _1, _2, _3, mask), view_visible_and_enabled, x, y, true); if (!handled) { handled = LLPanel::handleRightMouseDown(x, y, mask); @@ -186,9 +186,9 @@ BOOL LLPopupView::handleRightMouseDown(S32 x, S32 y, MASK mask) return handled; } -BOOL LLPopupView::handleRightMouseUp(S32 x, S32 y, MASK mask) +bool LLPopupView::handleRightMouseUp(S32 x, S32 y, MASK mask) { - BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleRightMouseUp, _1, _2, _3, mask), view_visible_and_enabled, x, y, false); + bool handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleRightMouseUp, _1, _2, _3, mask), view_visible_and_enabled, x, y, false); if (!handled) { handled = LLPanel::handleRightMouseUp(x, y, mask); @@ -196,9 +196,9 @@ BOOL LLPopupView::handleRightMouseUp(S32 x, S32 y, MASK mask) return handled; } -BOOL LLPopupView::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLPopupView::handleDoubleClick(S32 x, S32 y, MASK mask) { - BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleDoubleClick, _1, _2, _3, mask), view_visible_and_enabled, x, y, false); + bool handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleDoubleClick, _1, _2, _3, mask), view_visible_and_enabled, x, y, false); if (!handled) { handled = LLPanel::handleDoubleClick(x, y, mask); @@ -206,9 +206,9 @@ BOOL LLPopupView::handleDoubleClick(S32 x, S32 y, MASK mask) return handled; } -BOOL LLPopupView::handleHover(S32 x, S32 y, MASK mask) +bool LLPopupView::handleHover(S32 x, S32 y, MASK mask) { - BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleHover, _1, _2, _3, mask), view_visible_and_enabled, x, y, false); + bool handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleHover, _1, _2, _3, mask), view_visible_and_enabled, x, y, false); if (!handled) { handled = LLPanel::handleHover(x, y, mask); @@ -216,9 +216,9 @@ BOOL LLPopupView::handleHover(S32 x, S32 y, MASK mask) return handled; } -BOOL LLPopupView::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLPopupView::handleScrollWheel(S32 x, S32 y, S32 clicks) { - BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleScrollWheel, _1, _2, _3, clicks), view_visible_and_enabled, x, y, false); + bool handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleScrollWheel, _1, _2, _3, clicks), view_visible_and_enabled, x, y, false); if (!handled) { handled = LLPanel::handleScrollWheel(x, y, clicks); @@ -226,9 +226,9 @@ BOOL LLPopupView::handleScrollWheel(S32 x, S32 y, S32 clicks) return handled; } -BOOL LLPopupView::handleToolTip(S32 x, S32 y, MASK mask) +bool LLPopupView::handleToolTip(S32 x, S32 y, MASK mask) { - BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleToolTip, _1, _2, _3, mask), view_visible, x, y, false); + bool handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleToolTip, _1, _2, _3, mask), view_visible, x, y, false); if (!handled) { handled = LLPanel::handleToolTip(x, y, mask); @@ -264,8 +264,8 @@ void LLPopupView::clearPopups() mPopups.erase(popup_it); if (popup) { - popup->onTopLost(); - } + popup->onTopLost(); } } +} diff --git a/indra/newview/llpopupview.h b/indra/newview/llpopupview.h index d42df280bb..4a88866185 100644 --- a/indra/newview/llpopupview.h +++ b/indra/newview/llpopupview.h @@ -36,16 +36,16 @@ public: ~LLPopupView(); /*virtual*/ void draw(); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); - /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMiddleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMiddleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleRightMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleRightMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleDoubleClick(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleScrollWheel(S32 x, S32 y, S32 clicks); + /*virtual*/ bool handleToolTip(S32 x, S32 y, MASK mask); void addPopup(LLView* popup); void removePopup(LLView* popup); @@ -55,7 +55,7 @@ public: popup_list_t getCurrentPopups() { return mPopups; } private: - BOOL handleMouseEvent(boost::function<BOOL(LLView*, S32, S32)>, boost::function<bool(LLView*)>, S32 x, S32 y, bool close_popups); + bool handleMouseEvent(boost::function<bool(LLView*, S32, S32)>, boost::function<bool(LLView*)>, S32 x, S32 y, bool close_popups); popup_list_t mPopups; }; #endif //LL_LLROOTVIEW_H diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index a6722b1c02..afd58af056 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -424,7 +424,7 @@ bool LLPresetsManager::setPresetNamesInComboBox(const std::string& subdirectory, bool sts = true; combo->clearRows(); - combo->setEnabled(TRUE); + combo->setEnabled(true); std::list<std::string> preset_names; loadPresetNamesFromDir(subdirectory, preset_names, default_option); diff --git a/indra/newview/llpreview.cpp b/indra/newview/llpreview.cpp index df1b2be955..3f3e1766b4 100644 --- a/indra/newview/llpreview.cpp +++ b/indra/newview/llpreview.cpp @@ -58,26 +58,26 @@ LLPreview::LLPreview(const LLSD& key) mItemUUID(key.has("itemid") ? key.get("itemid").asUUID() : key.asUUID()), mObjectUUID(), // set later by setObjectID() mCopyToInvBtn( NULL ), - mForceClose(FALSE), - mUserResized(FALSE), - mCloseAfterSave(FALSE), + mForceClose(false), + mUserResized(false), + mCloseAfterSave(false), mAssetStatus(PREVIEW_ASSET_UNLOADED), - mDirty(TRUE), - mSaveDialogShown(FALSE) + mDirty(true), + mSaveDialogShown(false) { mAuxItem = new LLInventoryItem; // don't necessarily steal focus on creation -- sometimes these guys pop up without user action - setAutoFocus(FALSE); + setAutoFocus(false); gInventory.addObserver(this); refreshFromItem(); } -BOOL LLPreview::postBuild() +bool LLPreview::postBuild() { refreshFromItem(); - return TRUE; + return true; } LLPreview::~LLPreview() @@ -142,7 +142,7 @@ void LLPreview::onCommit() if (!item->isFinished()) { // We are attempting to save an item that was never loaded - LL_WARNS() << "LLPreview::onCommit() called with mIsComplete == FALSE" + LL_WARNS() << "LLPreview::onCommit() called with mIsComplete == false" << " Type: " << item->getType() << " ID: " << item->getUUID() << LL_ENDL; @@ -172,7 +172,7 @@ void LLPreview::onCommit() } else if(item->getPermissions().getOwner() == gAgent.getID()) { - new_item->updateServer(FALSE); + new_item->updateServer(false); gInventory.updateItem(new_item); gInventory.notifyObservers(); @@ -186,7 +186,7 @@ void LLPreview::onCommit() if( obj ) { LLSelectMgr::getInstance()->deselectAll(); - LLSelectMgr::getInstance()->addAsIndividual( obj, SELECT_ALL_TES, FALSE ); + LLSelectMgr::getInstance()->addAsIndividual( obj, SELECT_ALL_TES, false ); LLSelectMgr::getInstance()->selectionSetObjectDescription( getChild<LLUICtrl>("desc")->getValue().asString() ); LLSelectMgr::getInstance()->deselectAll(); @@ -199,7 +199,7 @@ void LLPreview::onCommit() void LLPreview::changed(U32 mask) { - mDirty = TRUE; + mDirty = true; } void LLPreview::setNotecardInfo(const LLUUID& notecard_inv_id, @@ -214,7 +214,7 @@ void LLPreview::draw() LLFloater::draw(); if (mDirty) { - mDirty = FALSE; + mDirty = false; refreshFromItem(); } } @@ -239,7 +239,7 @@ void LLPreview::refreshFromItem() } // static -BOOL LLPreview::canModify(const LLUUID taskUUID, const LLInventoryItem* item) +bool LLPreview::canModify(const LLUUID taskUUID, const LLInventoryItem* item) { const LLViewerObject* object = nullptr; if (taskUUID.notNull()) @@ -251,12 +251,12 @@ BOOL LLPreview::canModify(const LLUUID taskUUID, const LLInventoryItem* item) } // static -BOOL LLPreview::canModify(const LLViewerObject* object, const LLInventoryItem* item) +bool LLPreview::canModify(const LLViewerObject* object, const LLInventoryItem* item) { if (object && !object->permModify()) { // No permission to edit in-world inventory - return FALSE; + return false; } return item && gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE); @@ -277,7 +277,7 @@ void LLPreview::onRadio(LLUICtrl*, void* userdata) } // static -void LLPreview::hide(const LLUUID& item_uuid, BOOL no_saving /* = FALSE */ ) +void LLPreview::hide(const LLUUID& item_uuid, bool no_saving /* = false */ ) { LLFloater* floater = LLFloaterReg::findInstance("preview", LLSD(item_uuid)); if (!floater) floater = LLFloaterReg::findInstance("preview_avatar", LLSD(item_uuid)); @@ -287,7 +287,7 @@ void LLPreview::hide(const LLUUID& item_uuid, BOOL no_saving /* = FALSE */ ) { if ( no_saving ) { - preview->mForceClose = TRUE; + preview->mForceClose = true; } preview->closeFloater(); } @@ -302,11 +302,11 @@ void LLPreview::dirty(const LLUUID& item_uuid) LLPreview* preview = dynamic_cast<LLPreview*>(floater); if(preview) { - preview->mDirty = TRUE; + preview->mDirty = true; } } -BOOL LLPreview::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLPreview::handleMouseDown(S32 x, S32 y, MASK mask) { if(mClientRect.pointInRect(x, y)) { @@ -318,22 +318,22 @@ BOOL LLPreview::handleMouseDown(S32 x, S32 y, MASK mask) S32 screen_y; localPointToScreen(x, y, &screen_x, &screen_y ); LLToolDragAndDrop::getInstance()->setDragStart(screen_x, screen_y); - return TRUE; + return true; } return LLFloater::handleMouseDown(x, y, mask); } -BOOL LLPreview::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLPreview::handleMouseUp(S32 x, S32 y, MASK mask) { if(hasMouseCapture()) { gFocusMgr.setMouseCapture(NULL); - return TRUE; + return true; } return LLFloater::handleMouseUp(x, y, mask); } -BOOL LLPreview::handleHover(S32 x, S32 y, MASK mask) +bool LLPreview::handleHover(S32 x, S32 y, MASK mask) { if(hasMouseCapture()) { @@ -442,7 +442,7 @@ void LLPreview::onDiscardBtn(void* data) const LLInventoryItem* item = self->getItem(); if (!item) return; - self->mForceClose = TRUE; + self->mForceClose = true; self->closeFloater(); // Move the item to the trash @@ -460,7 +460,7 @@ void LLPreview::onDiscardBtn(void* data) new_item->setParent(trash_id); // no need to restamp it though it's a move into trash because // it's a brand new item already. - new_item->updateParentOnServer(FALSE); + new_item->updateParentOnServer(false); gInventory.updateItem(new_item); gInventory.notifyObservers(); } @@ -495,7 +495,7 @@ LLMultiPreview::LLMultiPreview() } setTitle(LLTrans::getString("MultiPreviewTitle")); buildTabContainer(); - setCanResize(TRUE); + setCanResize(true); } void LLMultiPreview::onOpen(const LLSD& key) diff --git a/indra/newview/llpreview.h b/indra/newview/llpreview.h index 5b77cc6a25..b8c5477301 100644 --- a/indra/newview/llpreview.h +++ b/indra/newview/llpreview.h @@ -68,7 +68,7 @@ public: LLPreview(const LLSD& key ); virtual ~LLPreview(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); virtual void setObjectID(const LLUUID& object_id); void setItem( LLInventoryItem* item ); @@ -76,30 +76,27 @@ public: void setAssetId(const LLUUID& asset_id); const LLInventoryItem* getItem() const; // searches if not constructed with it - static void hide(const LLUUID& item_uuid, BOOL no_saving = FALSE ); + static void hide(const LLUUID& item_uuid, bool no_saving = false ); static void dirty(const LLUUID& item_uuid); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleHover(S32 x, S32 y, MASK mask); virtual void onOpen(const LLSD& key); virtual void setAuxItem( const LLInventoryItem* item ); static void onBtnCopyToInv(void* userdata); - void addKeepDiscardButtons(); static void onKeepBtn(void* data); static void onDiscardBtn(void* data); /*virtual*/ void handleReshape(const LLRect& new_rect, bool by_user = false); - void userResized() { mUserResized = TRUE; }; + void userResized() { mUserResized = true; }; virtual void loadAsset() { mAssetStatus = PREVIEW_ASSET_LOADED; } virtual EAssetStatus getAssetStatus() { return mAssetStatus;} - static LLPreview* getFirstPreviewForSource(const LLUUID& source_id); - // Why is this at the LLPreview level? JC void setNotecardInfo(const LLUUID& notecard_inv_id, const LLUUID& object_id); @@ -109,21 +106,19 @@ public: // We can't modify Item or description in preview if either in-world Object // or Item itself is unmodifiable - static BOOL canModify(const LLUUID taskUUID, const LLInventoryItem* item); - static BOOL canModify(const LLViewerObject* object, const LLInventoryItem* item); + static bool canModify(const LLUUID taskUUID, const LLInventoryItem* item); + static bool canModify(const LLViewerObject* object, const LLInventoryItem* item); protected: virtual void onCommit(); - void addDescriptionUI(); - static void onText(LLUICtrl*, void* userdata); static void onRadio(LLUICtrl*, void* userdata); // for LLInventoryObserver virtual void changed(U32 mask); - BOOL mDirty; - BOOL mSaveDialogShown; + bool mDirty; + bool mSaveDialogShown; protected: LLUUID mItemUUID; @@ -140,13 +135,13 @@ protected: LLButton* mCopyToInvBtn; // Close without saving changes - BOOL mForceClose; + bool mForceClose; - BOOL mUserResized; + bool mUserResized; // When closing springs a "Want to save?" dialog, we want // to keep the preview open until the save completes. - BOOL mCloseAfterSave; + bool mCloseAfterSave; EAssetStatus mAssetStatus; diff --git a/indra/newview/llpreviewanim.cpp b/indra/newview/llpreviewanim.cpp index dfc41b6700..7d11c09738 100644 --- a/indra/newview/llpreviewanim.cpp +++ b/indra/newview/llpreviewanim.cpp @@ -50,7 +50,7 @@ LLPreviewAnim::LLPreviewAnim(const LLSD& key) } // virtual -BOOL LLPreviewAnim::postBuild() +bool LLPreviewAnim::postBuild() { childSetCommitCallback("desc", LLPreview::onText, this); getChild<LLLineEditor>("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe); @@ -58,9 +58,9 @@ BOOL LLPreviewAnim::postBuild() pAdvancedStatsTextBox = getChild<LLTextBox>("AdvancedStats"); // Assume that advanced stats start visible (for XUI preview tool's purposes) - pAdvancedStatsTextBox->setVisible(FALSE); + pAdvancedStatsTextBox->setVisible(false); LLRect rect = getRect(); - reshape(rect.getWidth(), rect.getHeight() - pAdvancedStatsTextBox->getRect().getHeight() - ADVANCED_VPAD, FALSE); + reshape(rect.getWidth(), rect.getHeight() - pAdvancedStatsTextBox->getRect().getHeight() - ADVANCED_VPAD, false); return LLPreview::postBuild(); } @@ -180,10 +180,10 @@ void LLPreviewAnim::cleanup() { this->mItemID = LLUUID::null; this->mDidStart = false; - getChild<LLUICtrl>("Inworld")->setValue(FALSE); - getChild<LLUICtrl>("Locally")->setValue(FALSE); - getChild<LLUICtrl>("Inworld")->setEnabled(TRUE); - getChild<LLUICtrl>("Locally")->setEnabled(TRUE); + getChild<LLUICtrl>("Inworld")->setValue(false); + getChild<LLUICtrl>("Locally")->setValue(false); + getChild<LLUICtrl>("Inworld")->setEnabled(true); + getChild<LLUICtrl>("Locally")->setEnabled(true); } // virtual @@ -200,19 +200,19 @@ void LLPreviewAnim::onClose(bool app_quitting) void LLPreviewAnim::showAdvanced() { - BOOL was_visible = pAdvancedStatsTextBox->getVisible(); + bool was_visible = pAdvancedStatsTextBox->getVisible(); if (was_visible) { - pAdvancedStatsTextBox->setVisible(FALSE); + pAdvancedStatsTextBox->setVisible(false); LLRect rect = getRect(); - reshape(rect.getWidth(), rect.getHeight() - pAdvancedStatsTextBox->getRect().getHeight() - ADVANCED_VPAD, FALSE); + reshape(rect.getWidth(), rect.getHeight() - pAdvancedStatsTextBox->getRect().getHeight() - ADVANCED_VPAD, false); } else { - pAdvancedStatsTextBox->setVisible(TRUE); + pAdvancedStatsTextBox->setVisible(true); LLRect rect = getRect(); - reshape(rect.getWidth(), rect.getHeight() + pAdvancedStatsTextBox->getRect().getHeight() + ADVANCED_VPAD, FALSE); + reshape(rect.getWidth(), rect.getHeight() + pAdvancedStatsTextBox->getRect().getHeight() + ADVANCED_VPAD, false); LLMotion *motion = NULL; const LLInventoryItem* item = getItem(); diff --git a/indra/newview/llpreviewanim.h b/indra/newview/llpreviewanim.h index ccaca6ff96..34fa0cf5cb 100644 --- a/indra/newview/llpreviewanim.h +++ b/indra/newview/llpreviewanim.h @@ -38,7 +38,7 @@ class LLPreviewAnim : public LLPreview public: LLPreviewAnim(const LLSD& key); - BOOL postBuild() override; + bool postBuild() override; void onClose(bool app_quitting) override; void draw() override; void refreshFromItem() override; diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp index 1d9d69dcfe..7cbbb89313 100644 --- a/indra/newview/llpreviewgesture.cpp +++ b/indra/newview/llpreviewgesture.cpp @@ -137,12 +137,12 @@ void LLPreviewGesture::draw() } // virtual -BOOL LLPreviewGesture::handleKeyHere(KEY key, MASK mask) +bool LLPreviewGesture::handleKeyHere(KEY key, MASK mask) { if(('S' == key) && (MASK_CONTROL == (mask & MASK_CONTROL))) { saveIfNeeded(); - return TRUE; + return true; } return LLPreview::handleKeyHere(key, mask); @@ -150,13 +150,13 @@ BOOL LLPreviewGesture::handleKeyHere(KEY key, MASK mask) // virtual -BOOL LLPreviewGesture::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +bool LLPreviewGesture::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) { - BOOL handled = TRUE; + bool handled = true; switch(cargo_type) { case DAD_ANIMATION: @@ -199,7 +199,7 @@ BOOL LLPreviewGesture::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, sound->mSoundName = item->getName(); } updateLabel(line); - mDirty = TRUE; + mDirty = true; refresh(); } *accept = ACCEPT_YES_COPY_MULTI; @@ -225,23 +225,23 @@ BOOL LLPreviewGesture::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, // virtual -BOOL LLPreviewGesture::canClose() +bool LLPreviewGesture::canClose() { if(!mDirty || mForceClose) { - return TRUE; + return true; } else { if(!mSaveDialogShown) { - mSaveDialogShown = TRUE; + mSaveDialogShown = true; // Bring up view-modal dialog: Save changes? Yes, No, Cancel LLNotificationsUtil::add("SaveChanges", LLSD(), LLSD(), boost::bind(&LLPreviewGesture::handleSaveChangesDialog, this, _1, _2) ); } - return FALSE; + return false; } } @@ -268,19 +268,19 @@ void LLPreviewGesture::onVisibilityChanged ( const LLSD& new_visibility ) bool LLPreviewGesture::handleSaveChangesDialog(const LLSD& notification, const LLSD& response) { - mSaveDialogShown = FALSE; + mSaveDialogShown = false; S32 option = LLNotificationsUtil::getSelectedOption(notification, response); switch(option) { case 0: // "Yes" LLGestureMgr::instance().stopGesture(mPreviewGesture); - mCloseAfterSave = TRUE; + mCloseAfterSave = true; onClickSave(this); break; case 1: // "No" LLGestureMgr::instance().stopGesture(mPreviewGesture); - mDirty = FALSE; // Force the dirty flag because user has clicked NO on confirm save dialog... + mDirty = false; // Force the dirty flag because user has clicked NO on confirm save dialog... closeFloater(); break; @@ -313,7 +313,7 @@ LLPreviewGesture::LLPreviewGesture(const LLSD& key) mSaveBtn(NULL), mPreviewBtn(NULL), mPreviewGesture(NULL), - mDirty(FALSE) + mDirty(false) { NONE_LABEL = LLTrans::getString("---"); SHIFT_LABEL = LLTrans::getString("KBShift"); @@ -336,7 +336,7 @@ LLPreviewGesture::~LLPreviewGesture() } -BOOL LLPreviewGesture::postBuild() +bool LLPreviewGesture::postBuild() { setVisibleCallback(boost::bind(&LLPreviewGesture::onVisibilityChanged, this, _2)); @@ -353,20 +353,20 @@ BOOL LLPreviewGesture::postBuild() edit = getChild<LLLineEditor>("trigger_editor"); edit->setKeystrokeCallback(onKeystrokeCommit, this); edit->setCommitCallback(onCommitSetDirty, this); - edit->setCommitOnFocusLost(TRUE); - edit->setIgnoreTab(TRUE); + edit->setCommitOnFocusLost(true); + edit->setIgnoreTab(true); mTriggerEditor = edit; text = getChild<LLTextBox>("replace_text"); - text->setEnabled(FALSE); + text->setEnabled(false); mReplaceText = text; edit = getChild<LLLineEditor>("replace_editor"); - edit->setEnabled(FALSE); + edit->setEnabled(false); edit->setKeystrokeCallback(onKeystrokeCommit, this); edit->setCommitCallback(onCommitSetDirty, this); - edit->setCommitOnFocusLost(TRUE); - edit->setIgnoreTab(TRUE); + edit->setCommitOnFocusLost(true); + edit->setIgnoreTab(true); mReplaceEditor = edit; combo = getChild<LLComboBox>( "modifier_combo"); @@ -384,22 +384,22 @@ BOOL LLPreviewGesture::postBuild() btn = getChild<LLButton>( "add_btn"); btn->setClickedCallback(onClickAdd, this); - btn->setEnabled(FALSE); + btn->setEnabled(false); mAddBtn = btn; btn = getChild<LLButton>( "up_btn"); btn->setClickedCallback(onClickUp, this); - btn->setEnabled(FALSE); + btn->setEnabled(false); mUpBtn = btn; btn = getChild<LLButton>( "down_btn"); btn->setClickedCallback(onClickDown, this); - btn->setEnabled(FALSE); + btn->setEnabled(false); mDownBtn = btn; btn = getChild<LLButton>( "delete_btn"); btn->setClickedCallback(onClickDelete, this); - btn->setEnabled(FALSE); + btn->setEnabled(false); mDeleteBtn = btn; list = getChild<LLScrollListCtrl>("step_list"); @@ -410,52 +410,52 @@ BOOL LLPreviewGesture::postBuild() mOptionsText = getChild<LLTextBox>("options_text"); combo = getChild<LLComboBox>( "animation_list"); - combo->setVisible(FALSE); + combo->setVisible(false); combo->setCommitCallback(onCommitAnimation, this); mAnimationCombo = combo; LLRadioGroup* group; group = getChild<LLRadioGroup>("animation_trigger_type"); - group->setVisible(FALSE); + group->setVisible(false); group->setCommitCallback(onCommitAnimationTrigger, this); mAnimationRadio = group; combo = getChild<LLComboBox>( "sound_list"); - combo->setVisible(FALSE); + combo->setVisible(false); combo->setCommitCallback(onCommitSound, this); mSoundCombo = combo; edit = getChild<LLLineEditor>("chat_editor"); - edit->setVisible(FALSE); + edit->setVisible(false); edit->setCommitCallback(onCommitChat, this); //edit->setKeystrokeCallback(onKeystrokeCommit, this); - edit->setCommitOnFocusLost(TRUE); - edit->setIgnoreTab(TRUE); + edit->setCommitOnFocusLost(true); + edit->setIgnoreTab(true); mChatEditor = edit; check = getChild<LLCheckBoxCtrl>( "wait_key_release_check"); - check->setVisible(FALSE); + check->setVisible(false); check->setCommitCallback(onCommitWait, this); mWaitKeyReleaseCheck = check; check = getChild<LLCheckBoxCtrl>( "wait_anim_check"); - check->setVisible(FALSE); + check->setVisible(false); check->setCommitCallback(onCommitWait, this); mWaitAnimCheck = check; check = getChild<LLCheckBoxCtrl>( "wait_time_check"); - check->setVisible(FALSE); + check->setVisible(false); check->setCommitCallback(onCommitWait, this); mWaitTimeCheck = check; edit = getChild<LLLineEditor>("wait_time_editor"); - edit->setEnabled(FALSE); - edit->setVisible(FALSE); + edit->setEnabled(false); + edit->setVisible(false); edit->setPrevalidate(LLTextValidate::validateFloat); // edit->setKeystrokeCallback(onKeystrokeCommit, this); - edit->setCommitOnFocusLost(TRUE); + edit->setCommitOnFocusLost(true); edit->setCommitCallback(onCommitWaitTime, this); - edit->setIgnoreTab(TRUE); + edit->setIgnoreTab(true); mWaitTimeEditor = edit; // Buttons at the bottom @@ -549,11 +549,9 @@ void LLPreviewGesture::addAnimations() // Copy into something we can sort std::vector<LLInventoryItem*> animations; - - S32 count = items.size(); - for(i = 0; i < count; ++i) + for (auto& item : items) { - animations.push_back( items.at(i) ); + animations.emplace_back(item); } // Do the sort @@ -594,12 +592,9 @@ void LLPreviewGesture::addSounds() // Copy sounds into something we can sort std::vector<LLInventoryItem*> sounds; - - S32 i; - S32 count = items.size(); - for(i = 0; i < count; ++i) + for (auto& item : items) { - sounds.push_back( items.at(i) ); + sounds.emplace_back(item); } // Do the sort @@ -621,44 +616,44 @@ void LLPreviewGesture::refresh() LLPreview::refresh(); // If previewing or item is incomplete, all controls are disabled LLViewerInventoryItem* item = (LLViewerInventoryItem*)getItem(); - bool is_complete = (item && item->isFinished()) ? true : false; + bool is_complete = item && item->isFinished(); if (mPreviewGesture || !is_complete) { - getChildView("desc")->setEnabled(FALSE); - //mDescEditor->setEnabled(FALSE); - mTriggerEditor->setEnabled(FALSE); - mReplaceText->setEnabled(FALSE); - mReplaceEditor->setEnabled(FALSE); - mModifierCombo->setEnabled(FALSE); - mKeyCombo->setEnabled(FALSE); - mLibraryList->setEnabled(FALSE); - mAddBtn->setEnabled(FALSE); - mUpBtn->setEnabled(FALSE); - mDownBtn->setEnabled(FALSE); - mDeleteBtn->setEnabled(FALSE); - mStepList->setEnabled(FALSE); - mOptionsText->setEnabled(FALSE); - mAnimationCombo->setEnabled(FALSE); - mAnimationRadio->setEnabled(FALSE); - mSoundCombo->setEnabled(FALSE); - mChatEditor->setEnabled(FALSE); - mWaitKeyReleaseCheck->setEnabled(FALSE); - mWaitAnimCheck->setEnabled(FALSE); - mWaitTimeCheck->setEnabled(FALSE); - mWaitTimeEditor->setEnabled(FALSE); - mActiveCheck->setEnabled(FALSE); - mSaveBtn->setEnabled(FALSE); + getChildView("desc")->setEnabled(false); + //mDescEditor->setEnabled(false); + mTriggerEditor->setEnabled(false); + mReplaceText->setEnabled(false); + mReplaceEditor->setEnabled(false); + mModifierCombo->setEnabled(false); + mKeyCombo->setEnabled(false); + mLibraryList->setEnabled(false); + mAddBtn->setEnabled(false); + mUpBtn->setEnabled(false); + mDownBtn->setEnabled(false); + mDeleteBtn->setEnabled(false); + mStepList->setEnabled(false); + mOptionsText->setEnabled(false); + mAnimationCombo->setEnabled(false); + mAnimationRadio->setEnabled(false); + mSoundCombo->setEnabled(false); + mChatEditor->setEnabled(false); + mWaitKeyReleaseCheck->setEnabled(false); + mWaitAnimCheck->setEnabled(false); + mWaitTimeCheck->setEnabled(false); + mWaitTimeEditor->setEnabled(false); + mActiveCheck->setEnabled(false); + mSaveBtn->setEnabled(false); // Make sure preview button is enabled, so we can stop it - mPreviewBtn->setEnabled(TRUE); + mPreviewBtn->setEnabled(true); return; } - BOOL modifiable = item->getPermissions().allowModifyBy(gAgent.getID()); + bool modifiable = item->getPermissions().allowModifyBy(gAgent.getID()); getChildView("desc")->setEnabled(modifiable); - mTriggerEditor->setEnabled(TRUE); + mTriggerEditor->setEnabled(true); mLibraryList->setEnabled(modifiable); mStepList->setEnabled(modifiable); mOptionsText->setEnabled(modifiable); @@ -670,27 +665,27 @@ void LLPreviewGesture::refresh() mWaitAnimCheck->setEnabled(modifiable); mWaitTimeCheck->setEnabled(modifiable); mWaitTimeEditor->setEnabled(modifiable); - mActiveCheck->setEnabled(TRUE); + mActiveCheck->setEnabled(true); const std::string& trigger = mTriggerEditor->getText(); - BOOL have_trigger = !trigger.empty(); + bool have_trigger = !trigger.empty(); const std::string& replace = mReplaceEditor->getText(); - BOOL have_replace = !replace.empty(); + bool have_replace = !replace.empty(); LLScrollListItem* library_item = mLibraryList->getFirstSelected(); - BOOL have_library = (library_item != NULL); + bool have_library = (library_item != NULL); LLScrollListItem* step_item = mStepList->getFirstSelected(); S32 step_index = mStepList->getFirstSelectedIndex(); S32 step_count = mStepList->getItemCount(); - BOOL have_step = (step_item != NULL); + bool have_step = (step_item != NULL); mReplaceText->setEnabled(have_trigger || have_replace); mReplaceEditor->setEnabled(have_trigger || have_replace); - mModifierCombo->setEnabled(TRUE); - mKeyCombo->setEnabled(TRUE); + mModifierCombo->setEnabled(true); + mKeyCombo->setEnabled(true); mAddBtn->setEnabled(modifiable && have_library); mUpBtn->setEnabled(modifiable && have_step && step_index > 0); @@ -698,14 +693,14 @@ void LLPreviewGesture::refresh() mDeleteBtn->setEnabled(modifiable && have_step); // Assume all not visible - mAnimationCombo->setVisible(FALSE); - mAnimationRadio->setVisible(FALSE); - mSoundCombo->setVisible(FALSE); - mChatEditor->setVisible(FALSE); - mWaitKeyReleaseCheck->setVisible(FALSE); - mWaitAnimCheck->setVisible(FALSE); - mWaitTimeCheck->setVisible(FALSE); - mWaitTimeEditor->setVisible(FALSE); + mAnimationCombo->setVisible(false); + mAnimationRadio->setVisible(false); + mSoundCombo->setVisible(false); + mChatEditor->setVisible(false); + mWaitKeyReleaseCheck->setVisible(false); + mWaitAnimCheck->setVisible(false); + mWaitTimeCheck->setVisible(false); + mWaitTimeEditor->setVisible(false); std::string optionstext; @@ -721,8 +716,8 @@ void LLPreviewGesture::refresh() { LLGestureStepAnimation* anim_step = (LLGestureStepAnimation*)step; optionstext = getString("step_anim"); - mAnimationCombo->setVisible(TRUE); - mAnimationRadio->setVisible(TRUE); + mAnimationCombo->setVisible(true); + mAnimationRadio->setVisible(true); mAnimationRadio->setSelectedIndex((anim_step->mFlags & ANIM_FLAG_STOP) ? 1 : 0); mAnimationCombo->setCurrentByID(anim_step->mAnimAssetID); break; @@ -731,7 +726,7 @@ void LLPreviewGesture::refresh() { LLGestureStepSound* sound_step = (LLGestureStepSound*)step; optionstext = getString("step_sound"); - mSoundCombo->setVisible(TRUE); + mSoundCombo->setVisible(true); mSoundCombo->setCurrentByID(sound_step->mSoundAssetID); break; } @@ -739,7 +734,7 @@ void LLPreviewGesture::refresh() { LLGestureStepChat* chat_step = (LLGestureStepChat*)step; optionstext = getString("step_chat"); - mChatEditor->setVisible(TRUE); + mChatEditor->setVisible(true); mChatEditor->setText(chat_step->mChatText); break; } @@ -747,13 +742,13 @@ void LLPreviewGesture::refresh() { LLGestureStepWait* wait_step = (LLGestureStepWait*)step; optionstext = getString("step_wait"); - mWaitKeyReleaseCheck->setVisible(TRUE); + mWaitKeyReleaseCheck->setVisible(true); mWaitKeyReleaseCheck->set(wait_step->mFlags & WAIT_FLAG_KEY_RELEASE); - mWaitAnimCheck->setVisible(TRUE); + mWaitAnimCheck->setVisible(true); mWaitAnimCheck->set(wait_step->mFlags & WAIT_FLAG_ALL_ANIM); - mWaitTimeCheck->setVisible(TRUE); + mWaitTimeCheck->setVisible(true); mWaitTimeCheck->set(wait_step->mFlags & WAIT_FLAG_TIME); - mWaitTimeEditor->setVisible(TRUE); + mWaitTimeEditor->setVisible(true); std::string buffer = llformat("%.1f", (double)wait_step->mWaitSeconds); mWaitTimeEditor->setText(buffer); break; @@ -765,7 +760,7 @@ void LLPreviewGesture::refresh() mOptionsText->setText(optionstext); - BOOL active = LLGestureMgr::instance().isGestureActive(mItemUUID); + bool active = LLGestureMgr::instance().isGestureActive(mItemUUID); mActiveCheck->set(active); // Can only preview if there are steps @@ -801,7 +796,7 @@ void LLPreviewGesture::initDefaultGesture() mStepList->selectFirstItem(); // this is *new* content, so we are dirty - mDirty = TRUE; + mDirty = true; } @@ -834,7 +829,7 @@ void LLPreviewGesture::loadAsset() // window if the download gets stalled. LLUUID* item_idp = new LLUUID(mItemUUID); - const BOOL high_priority = TRUE; + const bool high_priority = true; gAssetStorage->getAssetData(asset_id, LLAssetType::AT_GESTURE, onLoadComplete, @@ -866,7 +861,7 @@ void LLPreviewGesture::onLoadComplete(const LLUUID& asset_uuid, LLMultiGesture* gesture = new LLMultiGesture(); LLDataPackerAsciiBuffer dp(&buffer[0], size+1); - BOOL ok = gesture->deserialize(dp); + bool ok = gesture->deserialize(dp); if (ok) { @@ -875,7 +870,7 @@ void LLPreviewGesture::onLoadComplete(const LLUUID& asset_uuid, self->mStepList->selectFirstItem(); - self->mDirty = FALSE; + self->mDirty = false; self->refresh(); self->refreshFromItem(); // to update description and title } @@ -951,8 +946,8 @@ void LLPreviewGesture::loadUIFromGesture(LLMultiGesture* gesture) mKeyCombo->setEnabledByValue(LLKeyboard::stringFromKey(KEY_F10), gesture->mMask != MASK_CONTROL); // Make UI steps for each gesture step - S32 i; - S32 count = gesture->mSteps.size(); + size_t i; + size_t count = gesture->mSteps.size(); for (i = 0; i < count; ++i) { LLGestureStep* step = gesture->mSteps[i]; @@ -1153,7 +1148,7 @@ void LLPreviewGesture::saveIfNeeded() LLLineEditor* descEditor = getChild<LLLineEditor>("desc"); LLSaveInfo* info = new LLSaveInfo(mItemUUID, mObjectUUID, descEditor->getText(), tid); - gAssetStorage->storeAssetData(tid, LLAssetType::AT_GESTURE, onSaveComplete, info, FALSE); + gAssetStorage->storeAssetData(tid, LLAssetType::AT_GESTURE, onSaveComplete, info, false); } } @@ -1206,7 +1201,7 @@ void LLPreviewGesture::onSaveComplete(const LLUUID& asset_uuid, void* user_data, new_item->setDescription(info->mDesc); new_item->setTransactionID(info->mTransactionID); new_item->setAssetUUID(asset_uuid); - new_item->updateServer(FALSE); + new_item->updateServer(false); gInventory.updateItem(new_item); gInventory.notifyObservers(); } @@ -1352,7 +1347,7 @@ void LLPreviewGesture::onCommitKeyorModifier() mKeyCombo->setEnabledByValue(LLKeyboard::stringFromKey(KEY_F10), mModifierCombo->getSimple() != CTRL_LABEL); mModifierCombo->setEnabledByValue(CTRL_LABEL, mKeyCombo->getSimple() != LLKeyboard::stringFromKey(KEY_F10)); - mDirty = TRUE; + mDirty = true; refresh(); } @@ -1371,7 +1366,7 @@ void LLPreviewGesture::updateLabel(LLScrollListItem* item) void LLPreviewGesture::onCommitSetDirty(LLUICtrl* ctrl, void* data) { LLPreviewGesture* self = (LLPreviewGesture*)data; - self->mDirty = TRUE; + self->mDirty = true; self->refresh(); } @@ -1430,7 +1425,7 @@ void LLPreviewGesture::onCommitAnimation(LLUICtrl* ctrl, void* data) // Update the UI label in the list updateLabel(step_item); - self->mDirty = TRUE; + self->mDirty = true; self->refresh(); } } @@ -1461,7 +1456,7 @@ void LLPreviewGesture::onCommitAnimationTrigger(LLUICtrl* ctrl, void *data) // Update the UI label in the list updateLabel(step_item); - self->mDirty = TRUE; + self->mDirty = true; self->refresh(); } } @@ -1487,7 +1482,7 @@ void LLPreviewGesture::onCommitSound(LLUICtrl* ctrl, void* data) // Update the UI label in the list updateLabel(step_item); - self->mDirty = TRUE; + self->mDirty = true; self->refresh(); } } @@ -1511,7 +1506,7 @@ void LLPreviewGesture::onCommitChat(LLUICtrl* ctrl, void* data) // Update the UI label in the list updateLabel(step_item); - self->mDirty = TRUE; + self->mDirty = true; self->refresh(); } @@ -1548,7 +1543,7 @@ void LLPreviewGesture::onCommitWait(LLUICtrl* ctrl, void* data) // Update the UI label in the list updateLabel(step_item); - self->mDirty = TRUE; + self->mDirty = true; self->refresh(); } @@ -1563,7 +1558,7 @@ void LLPreviewGesture::onCommitWaitTime(LLUICtrl* ctrl, void* data) LLGestureStep* step = (LLGestureStep*)step_item->getUserdata(); if (step->getType() != STEP_WAIT) return; - self->mWaitTimeCheck->set(TRUE); + self->mWaitTimeCheck->set(true); onCommitWait(ctrl, data); } @@ -1596,7 +1591,7 @@ void LLPreviewGesture::onClickAdd(void* data) } self->addStep( (EStepType)library_item_index ); - self->mDirty = TRUE; + self->mDirty = true; self->refresh(); } @@ -1637,7 +1632,7 @@ LLScrollListItem* LLPreviewGesture::addStep( const EStepType step_type ) mLibraryList->deselectAllItems(); mStepList->deselectAllItems(); - step_item->setSelected(TRUE); + step_item->setSelected(true); return step_item; } @@ -1697,7 +1692,7 @@ void LLPreviewGesture::onClickUp(void* data) if (selected_index > 0) { self->mStepList->swapWithPrevious(selected_index); - self->mDirty = TRUE; + self->mDirty = true; self->refresh(); } } @@ -1714,7 +1709,7 @@ void LLPreviewGesture::onClickDown(void* data) if (selected_index < count-1) { self->mStepList->swapWithNext(selected_index); - self->mDirty = TRUE; + self->mDirty = true; self->refresh(); } } @@ -1734,7 +1729,7 @@ void LLPreviewGesture::onClickDelete(void* data) self->mStepList->deleteSingleItem(selected_index); - self->mDirty = TRUE; + self->mDirty = true; self->refresh(); } } diff --git a/indra/newview/llpreviewgesture.h b/indra/newview/llpreviewgesture.h index 1f8017656f..75f22df76f 100644 --- a/indra/newview/llpreviewgesture.h +++ b/indra/newview/llpreviewgesture.h @@ -52,18 +52,18 @@ public: // LLView /*virtual*/ void draw(); - /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); - /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + /*virtual*/ bool handleKeyHere(KEY key, MASK mask); + /*virtual*/ bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg); // LLPanel - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); // LLFloater - /*virtual*/ BOOL canClose(); + /*virtual*/ bool canClose(); /*virtual*/ void onClose(bool app_quitting); /*virtual*/ void onUpdateSucceeded(); /*virtual*/ void refresh(); @@ -164,7 +164,7 @@ private: LLButton* mPreviewBtn; LLMultiGesture* mPreviewGesture; - BOOL mDirty; + bool mDirty; }; #endif // LL_LLPREVIEWGESTURE_H diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp index aa04540536..620b7c8b2d 100644 --- a/indra/newview/llpreviewnotecard.cpp +++ b/indra/newview/llpreviewnotecard.cpp @@ -82,14 +82,14 @@ LLPreviewNotecard::~LLPreviewNotecard() delete mLiveFile; } -BOOL LLPreviewNotecard::postBuild() +bool LLPreviewNotecard::postBuild() { mEditor = getChild<LLViewerTextEditor>("Notecard Editor"); mEditor->setNotecardInfo(mItemUUID, mObjectID, getKey()); mEditor->makePristine(); childSetAction("Save", onClickSave, this); - getChildView("lock")->setVisible( FALSE); + getChildView("lock")->setVisible( false); childSetAction("Delete", onClickDelete, this); getChildView("Delete")->setEnabled(false); @@ -102,7 +102,7 @@ BOOL LLPreviewNotecard::postBuild() if (item) { getChild<LLUICtrl>("desc")->setValue(item->getDescription()); - BOOL source_library = mObjectUUID.isNull() && gInventory.isObjectDescendentOf(item->getUUID(), gInventory.getLibraryRootFolderID()); + bool source_library = mObjectUUID.isNull() && gInventory.isObjectDescendentOf(item->getUUID(), gInventory.getLibraryRootFolderID()); getChildView("Delete")->setEnabled(!source_library); } getChild<LLLineEditor>("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe); @@ -116,7 +116,7 @@ bool LLPreviewNotecard::saveItem() return saveIfNeeded(item); } -void LLPreviewNotecard::setEnabled( BOOL enabled ) +void LLPreviewNotecard::setEnabled(bool enabled) { LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); @@ -131,7 +131,7 @@ void LLPreviewNotecard::setEnabled( BOOL enabled ) void LLPreviewNotecard::draw() { LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); - BOOL changed = !editor->isPristine(); + bool changed = !editor->isPristine(); getChildView("Save")->setEnabled(changed && getEnabled()); @@ -139,35 +139,35 @@ void LLPreviewNotecard::draw() } // virtual -BOOL LLPreviewNotecard::handleKeyHere(KEY key, MASK mask) +bool LLPreviewNotecard::handleKeyHere(KEY key, MASK mask) { if(('S' == key) && (MASK_CONTROL == (mask & MASK_CONTROL))) { saveIfNeeded(); - return TRUE; + return true; } return LLPreview::handleKeyHere(key, mask); } // virtual -BOOL LLPreviewNotecard::canClose() +bool LLPreviewNotecard::canClose() { LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); if(mForceClose || editor->isPristine()) { - return TRUE; + return true; } else { if(!mSaveDialogShown) { - mSaveDialogShown = TRUE; + mSaveDialogShown = true; // Bring up view-modal dialog: Save changes? Yes, No, Cancel LLNotificationsUtil::add("SaveChanges", LLSD(), LLSD(), boost::bind(&LLPreviewNotecard::handleSaveChangesDialog,this, _1, _2)); } - return FALSE; + return false; } } @@ -239,10 +239,10 @@ void LLPreviewNotecard::loadAsset() if(item) { LLPermissions perm(item->getPermissions()); - BOOL is_owner = gAgent.allowOperation(PERM_OWNER, perm, GP_OBJECT_MANIPULATE); - BOOL allow_copy = gAgent.allowOperation(PERM_COPY, perm, GP_OBJECT_MANIPULATE); - BOOL allow_modify = canModify(mObjectUUID, item); - BOOL source_library = mObjectUUID.isNull() && gInventory.isObjectDescendentOf(mItemUUID, gInventory.getLibraryRootFolderID()); + bool is_owner = gAgent.allowOperation(PERM_OWNER, perm, GP_OBJECT_MANIPULATE); + bool allow_copy = gAgent.allowOperation(PERM_COPY, perm, GP_OBJECT_MANIPULATE); + bool allow_modify = canModify(mObjectUUID, item); + bool source_library = mObjectUUID.isNull() && gInventory.isObjectDescendentOf(mItemUUID, gInventory.getLibraryRootFolderID()); if (allow_copy || gAgent.isGodlike()) { @@ -251,7 +251,7 @@ void LLPreviewNotecard::loadAsset() { editor->setText(LLStringUtil::null); editor->makePristine(); - editor->setEnabled(TRUE); + editor->setEnabled(true); mAssetStatus = PREVIEW_ASSET_LOADED; } else @@ -272,7 +272,7 @@ void LLPreviewNotecard::loadAsset() mAssetID.setNull(); editor->setText(getString("no_object")); editor->makePristine(); - editor->setEnabled(FALSE); + editor->setEnabled(false); mAssetStatus = PREVIEW_ASSET_LOADED; return; } @@ -294,7 +294,7 @@ void LLPreviewNotecard::loadAsset() item->getType(), &onLoadComplete, (void*)user_data, - TRUE); + true); mAssetStatus = PREVIEW_ASSET_LOADING; } } @@ -303,20 +303,20 @@ void LLPreviewNotecard::loadAsset() mAssetID.setNull(); editor->setText(getString("not_allowed")); editor->makePristine(); - editor->setEnabled(FALSE); + editor->setEnabled(false); mAssetStatus = PREVIEW_ASSET_LOADED; } if(!allow_modify) { - editor->setEnabled(FALSE); - getChildView("lock")->setVisible( TRUE); - getChildView("Edit")->setEnabled(FALSE); + editor->setEnabled(false); + getChildView("lock")->setVisible( true); + getChildView("Edit")->setEnabled(false); } if((allow_modify || is_owner) && !source_library) { - getChildView("Delete")->setEnabled(TRUE); + getChildView("Delete")->setEnabled(true); } } else if (mObjectUUID.notNull() && mItemUUID.notNull()) @@ -347,7 +347,7 @@ void LLPreviewNotecard::loadAsset() { editor->setText(LLStringUtil::null); editor->makePristine(); - editor->setEnabled(TRUE); + editor->setEnabled(true); // Don't set asset status here; we may not have set the item id yet // (e.g. when this gets called initially) //mAssetStatus = PREVIEW_ASSET_LOADED; @@ -393,7 +393,7 @@ void LLPreviewNotecard::onLoadComplete(const LLUUID& asset_uuid, } previewEditor->makePristine(); - BOOL modifiable = preview->canModify(preview->mObjectID, preview->getItem()); + bool modifiable = preview->canModify(preview->mObjectID, preview->getItem()); preview->setEnabled(modifiable); preview->syncExternal(); preview->mAssetStatus = PREVIEW_ASSET_LOADED; @@ -593,13 +593,13 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem, bool sync) LLSaveNotecardInfo* info = new LLSaveNotecardInfo(this, mItemUUID, mObjectUUID, tid, copyitem); - S32 size = buffer.length() + 1; + S32 size = static_cast<S32>(buffer.length()) + 1; file.write((U8*)buffer.c_str(), size); gAssetStorage->storeAssetData(tid, LLAssetType::AT_NOTECARD, &onSaveComplete, (void*)info, - FALSE); + false); return true; } else // !gAssetStorage @@ -659,7 +659,7 @@ void LLPreviewNotecard::onSaveComplete(const LLUUID& asset_uuid, void* user_data LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); new_item->setAssetUUID(asset_uuid); new_item->setTransactionID(info->mTransactionID); - new_item->updateServer(FALSE); + new_item->updateServer(false); gInventory.updateItem(new_item); gInventory.notifyObservers(); } @@ -725,17 +725,17 @@ void LLPreviewNotecard::onSaveComplete(const LLUUID& asset_uuid, void* user_data bool LLPreviewNotecard::handleSaveChangesDialog(const LLSD& notification, const LLSD& response) { - mSaveDialogShown = FALSE; + mSaveDialogShown = false; S32 option = LLNotificationsUtil::getSelectedOption(notification, response); switch(option) { case 0: // "Yes" - mCloseAfterSave = TRUE; + mCloseAfterSave = true; LLPreviewNotecard::onClickSave((void*)this); break; case 1: // "No" - mForceClose = TRUE; + mForceClose = true; closeFloater(); break; @@ -764,7 +764,7 @@ bool LLPreviewNotecard::handleConfirmDeleteDialog(const LLSD& notification, cons if (item != NULL) { const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); - gInventory.changeItemParent(item, trash_id, FALSE); + gInventory.changeItemParent(item, trash_id, false); } } else @@ -782,7 +782,7 @@ bool LLPreviewNotecard::handleConfirmDeleteDialog(const LLSD& notification, cons } // close floater, ignore unsaved changes - mForceClose = TRUE; + mForceClose = true; closeFloater(); return false; } diff --git a/indra/newview/llpreviewnotecard.h b/indra/newview/llpreviewnotecard.h index a5cd5510a3..db677b1cf9 100644 --- a/indra/newview/llpreviewnotecard.h +++ b/indra/newview/llpreviewnotecard.h @@ -53,14 +53,14 @@ public: // llview void draw() override; - BOOL handleKeyHere(KEY key, MASK mask) override; - void setEnabled( BOOL enabled ) override; + bool handleKeyHere(KEY key, MASK mask) override; + void setEnabled(bool enabled) override; // llfloater - BOOL canClose() override; + bool canClose() override; // llpanel - BOOL postBuild() override; + bool postBuild() override; // reach into the text editor, and grab the drag item const LLInventoryItem* getDragItem(); diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 70458af0e8..c2188ea638 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -156,7 +156,7 @@ public: LLFloaterScriptSearch(LLScriptEdCore* editor_core); ~LLFloaterScriptSearch(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); static void show(LLScriptEdCore* editor_core); static void onBtnSearch(void* userdata); void handleBtnSearch(); @@ -171,7 +171,7 @@ public: static LLFloaterScriptSearch* getInstance() { return sInstance; } virtual bool hasAccelerators() const; - virtual BOOL handleKeyHere(KEY key, MASK mask); + virtual bool handleKeyHere(KEY key, MASK mask); private: @@ -210,19 +210,19 @@ LLFloaterScriptSearch::LLFloaterScriptSearch(LLScriptEdCore* editor_core) } } -BOOL LLFloaterScriptSearch::postBuild() +bool LLFloaterScriptSearch::postBuild() { mReplaceBox = getChild<LLLineEditor>("replace_text"); mSearchBox = getChild<LLLineEditor>("search_text"); mSearchBox->setCommitCallback(boost::bind(&LLFloaterScriptSearch::onSearchBoxCommit, this)); - mSearchBox->setCommitOnFocusLost(FALSE); + mSearchBox->setCommitOnFocusLost(false); childSetAction("search_btn", onBtnSearch,this); childSetAction("replace_btn", onBtnReplace,this); childSetAction("replace_all_btn", onBtnReplaceAll,this); setDefaultBtn("search_btn"); - return TRUE; + return true; } //static @@ -299,21 +299,21 @@ bool LLFloaterScriptSearch::hasAccelerators() const { return mEditorCore->hasAccelerators(); } - return FALSE; + return false; } -BOOL LLFloaterScriptSearch::handleKeyHere(KEY key, MASK mask) +bool LLFloaterScriptSearch::handleKeyHere(KEY key, MASK mask) { if (mEditorCore) { - BOOL handled = mEditorCore->handleKeyHere(key, mask); + bool handled = mEditorCore->handleKeyHere(key, mask); if (!handled) { LLFloater::handleKeyHere(key, mask); } } - return FALSE; + return false; } void LLFloaterScriptSearch::onSearchBoxCommit() @@ -374,7 +374,7 @@ LLScriptEdCore::LLScriptEdCore( const std::string& sample, const LLHandle<LLFloater>& floater_handle, void (*load_callback)(void*), - void (*save_callback)(void*, BOOL), + void (*save_callback)(void*, bool), void (*search_replace_callback) (void* userdata), void* userdata, bool live, @@ -387,19 +387,19 @@ LLScriptEdCore::LLScriptEdCore( mSaveCallback( save_callback ), mSearchReplaceCallback( search_replace_callback ), mUserdata( userdata ), - mForceClose( FALSE ), + mForceClose( false ), mLastHelpToken(NULL), mLiveHelpHistorySize(0), - mEnableSave(FALSE), + mEnableSave(false), mLiveFile(NULL), mLive(live), mContainer(container), - mHasScriptData(FALSE), - mScriptRemoved(FALSE), - mSaveDialogShown(FALSE) + mHasScriptData(false), + mScriptRemoved(false), + mSaveDialogShown(false) { setFollowsAll(); - setBorderVisible(FALSE); + setBorderVisible(false); setXMLFilename("panel_script_ed.xml"); llassert_always(mContainer != NULL); @@ -429,7 +429,7 @@ void LLLiveLSLEditor::experienceChanged() if(mScriptEd->getAssociatedExperience() != mExperiences->getSelectedValue().asUUID()) { mScriptEd->enableSave(getIsModifiable()); - //getChildView("Save_btn")->setEnabled(TRUE); + //getChildView("Save_btn")->setEnabled(true); mScriptEd->setAssociatedExperience(mExperiences->getSelectedValue().asUUID()); updateExperiencePanel(); } @@ -473,7 +473,7 @@ void LLLiveLSLEditor::onToggleExperience( LLUICtrl *ui, void* userdata ) self->updateExperiencePanel(); } -BOOL LLScriptEdCore::postBuild() +bool LLScriptEdCore::postBuild() { mErrorList = getChild<LLScrollListCtrl>("lsl errors"); @@ -484,7 +484,7 @@ BOOL LLScriptEdCore::postBuild() mEditor = getChild<LLScriptEditor>("Script Editor"); childSetCommitCallback("lsl errors", &LLScriptEdCore::onErrorList, this); - childSetAction("Save_btn", boost::bind(&LLScriptEdCore::doSave,this,FALSE)); + childSetAction("Save_btn", boost::bind(&LLScriptEdCore::doSave,this,false)); childSetAction("Edit_btn", boost::bind(&LLScriptEdCore::openInExternalEditor, this)); initMenu(); @@ -502,7 +502,7 @@ BOOL LLScriptEdCore::postBuild() "menu_lsl_font_size.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); getChild<LLMenuButton>("font_btn")->setMenu(context_menu, LLMenuButton::MP_BOTTOM_LEFT, true); - return TRUE; + return true; } void LLScriptEdCore::processKeywords() @@ -546,7 +546,7 @@ void LLScriptEdCore::initMenu() LLMenuItemCallGL* menuItem; menuItem = getChild<LLMenuItemCallGL>("Save"); - menuItem->setClickCallback(boost::bind(&LLScriptEdCore::doSave, this, FALSE)); + menuItem->setClickCallback(boost::bind(&LLScriptEdCore::doSave, this, false)); menuItem->setEnableCallback(boost::bind(&LLScriptEdCore::hasChanged, this)); menuItem = getChild<LLMenuItemCallGL>("Revert All Changes"); @@ -599,7 +599,7 @@ void LLScriptEdCore::initMenu() menuItem->setEnableCallback(boost::bind(&LLScriptEdCore::enableSaveToFileMenu, this)); } -void LLScriptEdCore::setScriptText(const std::string& text, BOOL is_valid) +void LLScriptEdCore::setScriptText(const std::string& text, bool is_valid) { if (mEditor) { @@ -704,14 +704,14 @@ bool LLScriptEdCore::hasChanged() void LLScriptEdCore::draw() { - BOOL script_changed = hasChanged(); + bool script_changed = hasChanged(); getChildView("Save_btn")->setEnabled(script_changed && !mScriptRemoved); if( mEditor->hasFocus() ) { S32 line = 0; S32 column = 0; - mEditor->getCurrentLineAndColumn( &line, &column, FALSE ); // don't include wordwrap + mEditor->getCurrentLineAndColumn( &line, &column, false ); // don't include wordwrap LLStringUtil::format_map_t args; std::string cursor_pos; args["[LINE]"] = llformat ("%d", line); @@ -729,7 +729,7 @@ void LLScriptEdCore::draw() LLPanel::draw(); } -void LLScriptEdCore::updateDynamicHelp(BOOL immediate) +void LLScriptEdCore::updateDynamicHelp(bool immediate) { LLFloater* help_floater = mLiveHelpHandle.get(); if (!help_floater) return; @@ -880,21 +880,21 @@ void LLScriptEdCore::addHelpItemToHistory(const std::string& help_string) mLiveHelpHistorySize++; } -BOOL LLScriptEdCore::canClose() +bool LLScriptEdCore::canClose() { if(mForceClose || !hasChanged() || mScriptRemoved) { - return TRUE; + return true; } else { if(!mSaveDialogShown) { - mSaveDialogShown = TRUE; + mSaveDialogShown = true; // Bring up view-modal dialog: Save changes? Yes, No, Cancel LLNotificationsUtil::add("SaveChanges", LLSD(), LLSD(), boost::bind(&LLScriptEdCore::handleSaveChangesDialog, this, _1, _2)); } - return FALSE; + return false; } } @@ -906,17 +906,17 @@ void LLScriptEdCore::setEnableEditing(bool enable) bool LLScriptEdCore::handleSaveChangesDialog(const LLSD& notification, const LLSD& response ) { - mSaveDialogShown = FALSE; + mSaveDialogShown = false; S32 option = LLNotificationsUtil::getSelectedOption(notification, response); switch( option ) { case 0: // "Yes" // close after saving - doSave( TRUE ); + doSave( true ); break; case 1: // "No" - mForceClose = TRUE; + mForceClose = true; // This will close immediately because mForceClose is true, so we won't // infinite loop with these dialogs. JC ((LLFloater*) getParent())->closeFloater(); @@ -941,7 +941,7 @@ void LLScriptEdCore::onBtnDynamicHelp() LLFloater* parent = dynamic_cast<LLFloater*>(getParent()); llassert(parent); if (parent) - parent->addDependentFloater(live_help_floater, TRUE); + parent->addDependentFloater(live_help_floater, true); live_help_floater->childSetCommitCallback("lock_check", onCheckLock, this); live_help_floater->getChild<LLUICtrl>("lock_check")->setValue(gSavedSettings.getBOOL("ScriptHelpFollowsCursor")); live_help_floater->childSetCommitCallback("history_combo", onHelpComboCommit, this); @@ -949,7 +949,7 @@ void LLScriptEdCore::onBtnDynamicHelp() live_help_floater->childSetAction("fwd_btn", onClickForward, this); LLMediaCtrl* browser = live_help_floater->getChild<LLMediaCtrl>("lsl_guide_html"); - browser->setAlwaysRefresh(TRUE); + browser->setAlwaysRefresh(true); LLComboBox* help_combo = live_help_floater->getChild<LLComboBox>("history_combo"); LLKeywordToken *token; @@ -969,12 +969,12 @@ void LLScriptEdCore::onBtnDynamicHelp() mLiveHelpHistorySize = 0; } - BOOL visible = TRUE; - BOOL take_focus = TRUE; + bool visible = true; + bool take_focus = true; live_help_floater->setVisible(visible); live_help_floater->setFrontmost(take_focus); - updateDynamicHelp(TRUE); + updateDynamicHelp(true); } //static @@ -1058,11 +1058,11 @@ void LLScriptEdCore::onBtnInsertFunction(LLUICtrl *ui, void* userdata) { self->mEditor->insertText(self->mFunctions->getSimple()); } - self->mEditor->setFocus(TRUE); + self->mEditor->setFocus(true); self->setHelpPage(self->mFunctions->getSimple()); } -void LLScriptEdCore::doSave( BOOL close_after_save ) +void LLScriptEdCore::doSave( bool close_after_save ) { add(LLStatViewer::LSL_SAVES, 1); @@ -1158,7 +1158,7 @@ void LLScriptEdCore::onErrorList(LLUICtrl*, void* user_data) //LL_INFOS() << "LLScriptEdCore::onErrorList() - " << row << ", " //<< column << LL_ENDL; self->mEditor->setCursor(row, column); - self->mEditor->setFocus(TRUE); + self->mEditor->setFocus(true); } } @@ -1170,7 +1170,7 @@ bool LLScriptEdCore::handleReloadFromServerDialog(const LLSD& notification, cons case 0: // "Yes" if( mLoadCallback ) { - setScriptText(getString("loading"), FALSE); + setScriptText(getString("loading"), false); mLoadCallback(mUserdata); } break; @@ -1203,9 +1203,9 @@ struct LLEntryAndEdCore void LLScriptEdCore::deleteBridges() { - S32 count = mBridges.size(); + auto count = mBridges.size(); LLEntryAndEdCore* eandc; - for(S32 i = 0; i < count; i++) + for(size_t i = 0; i < count; i++) { eandc = mBridges.at(i); delete eandc; @@ -1215,7 +1215,7 @@ void LLScriptEdCore::deleteBridges() } // virtual -BOOL LLScriptEdCore::handleKeyHere(KEY key, MASK mask) +bool LLScriptEdCore::handleKeyHere(KEY key, MASK mask) { bool just_control = MASK_CONTROL == (mask & MASK_MODIFIERS); @@ -1224,10 +1224,10 @@ BOOL LLScriptEdCore::handleKeyHere(KEY key, MASK mask) if(mSaveCallback) { // don't close after saving - mSaveCallback(mUserdata, FALSE); + mSaveCallback(mUserdata, false); } - return TRUE; + return true; } if(('F' == key) && just_control) @@ -1237,10 +1237,10 @@ BOOL LLScriptEdCore::handleKeyHere(KEY key, MASK mask) mSearchReplaceCallback(mUserdata); } - return TRUE; + return true; } - return FALSE; + return false; } void LLScriptEdCore::onBtnLoadFromFile( void* data ) @@ -1300,7 +1300,7 @@ void LLScriptEdCore::saveScriptToFile(const std::vector<std::string>& filenames, llofstream fout(filename.c_str()); fout << (scriptText); fout.close(); - self->mSaveCallback(self->mUserdata, FALSE); + self->mSaveCallback(self->mUserdata, false); } } @@ -1314,7 +1314,7 @@ bool LLScriptEdCore::canLoadOrSaveToFile( void* userdata ) bool LLScriptEdCore::enableSaveToFileMenu(void* userdata) { LLScriptEdCore* self = (LLScriptEdCore*)userdata; - if (!self || !self->mEditor) return FALSE; + if (!self || !self->mEditor) return false; return self->mEditor->canLoadOrSaveToFile(); } @@ -1322,7 +1322,7 @@ bool LLScriptEdCore::enableSaveToFileMenu(void* userdata) bool LLScriptEdCore::enableLoadFromFileMenu(void* userdata) { LLScriptEdCore* self = (LLScriptEdCore*)userdata; - return (self && self->mEditor) ? self->mEditor->canLoadOrSaveToFile() : FALSE; + return (self && self->mEditor) ? self->mEditor->canLoadOrSaveToFile() : false; } LLUUID LLScriptEdCore::getAssociatedExperience()const @@ -1355,26 +1355,26 @@ void LLLiveLSLEditor::updateExperiencePanel() { if(mScriptEd->getAssociatedExperience().isNull()) { - mExperienceEnabled->set(FALSE); - mExperiences->setVisible(FALSE); + mExperienceEnabled->set(false); + mExperiences->setVisible(false); if(mExperienceIds.size()>0) { - mExperienceEnabled->setEnabled(TRUE); + mExperienceEnabled->setEnabled(true); mExperienceEnabled->setToolTip(getString("add_experiences")); } else { - mExperienceEnabled->setEnabled(FALSE); + mExperienceEnabled->setEnabled(false); mExperienceEnabled->setToolTip(getString("no_experiences")); } - getChild<LLButton>("view_profile")->setVisible(FALSE); + getChild<LLButton>("view_profile")->setVisible(false); } else { mExperienceEnabled->setToolTip(getString("experience_enabled")); mExperienceEnabled->setEnabled(getIsModifiable()); - mExperiences->setVisible(TRUE); - mExperienceEnabled->set(TRUE); + mExperiences->setVisible(true); + mExperienceEnabled->set(true); getChild<LLButton>("view_profile")->setToolTip(getString("show_experience_profile")); buildExperienceList(); } @@ -1431,20 +1431,20 @@ void LLLiveLSLEditor::buildExperienceList() item=mExperiences->add(getString("loading"), associated, ADD_TOP); last = associated; } - item->setEnabled(FALSE); + item->setEnabled(false); } if(last.notNull()) { - mExperiences->setEnabled(FALSE); + mExperiences->setEnabled(false); LLExperienceCache::instance().get(last, boost::bind(&LLLiveLSLEditor::buildExperienceList, this)); } else { - mExperiences->setEnabled(TRUE); - mExperiences->sortByName(TRUE); + mExperiences->setEnabled(true); + mExperiences->sortByName(true); mExperiences->setCurrentByIndex(mExperiences->getCurrentIndex()); - getChild<LLButton>("view_profile")->setVisible(TRUE); + getChild<LLButton>("view_profile")->setVisible(true); } } @@ -1532,21 +1532,22 @@ bool LLScriptEdContainer::onExternalChange(const std::string& filename) return true; } -BOOL LLScriptEdContainer::handleKeyHere(KEY key, MASK mask) +bool LLScriptEdContainer::handleKeyHere(KEY key, MASK mask) { if (('A' == key) && (MASK_CONTROL == (mask & MASK_MODIFIERS))) { mScriptEd->selectAll(); - return TRUE; + return true; } if (!LLPreview::handleKeyHere(key, mask)) { return mScriptEd->handleKeyHere(key, mask); } - return TRUE; + return true; } - /// --------------------------------------------------------------------------- + +/// --------------------------------------------------------------------------- /// LLPreviewLSL /// --------------------------------------------------------------------------- @@ -1598,7 +1599,7 @@ LLPreviewLSL::~LLPreviewLSL() } // virtual -BOOL LLPreviewLSL::postBuild() +bool LLPreviewLSL::postBuild() { const LLInventoryItem* item = getItem(); @@ -1623,7 +1624,7 @@ void LLPreviewLSL::draw() if(!item) { setTitle(LLTrans::getString("ScriptWasDeleted")); - mScriptEd->setItemRemoved(TRUE); + mScriptEd->setItemRemoved(true); } else if (mDirty) { @@ -1668,7 +1669,7 @@ void LLPreviewLSL::loadAsset() // then it might be part of the inventory library. If it's in the // library, then you can see the script, but not modify it. const LLInventoryItem* item = gInventory.getItem(mItemUUID); - BOOL is_library = item + bool is_library = item && !gInventory.isObjectDescendentOf(mItemUUID, gInventory.getRootFolderID()); if(!item) @@ -1678,9 +1679,9 @@ void LLPreviewLSL::loadAsset() } if(item) { - BOOL is_copyable = gAgent.allowOperation(PERM_COPY, + bool is_copyable = gAgent.allowOperation(PERM_COPY, item->getPermissions(), GP_OBJECT_MANIPULATE); - BOOL is_modifiable = gAgent.allowOperation(PERM_MODIFY, + bool is_modifiable = gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE); if (gAgent.isGodlike() || (is_copyable && (is_modifiable || is_library))) { @@ -1695,14 +1696,14 @@ void LLPreviewLSL::loadAsset() item->getType(), &LLPreviewLSL::onLoadComplete, (void*)new_uuid, - TRUE); + true); mAssetStatus = PREVIEW_ASSET_LOADING; } else { - mScriptEd->setScriptText(mScriptEd->getString("can_not_view"), FALSE); + mScriptEd->setScriptText(mScriptEd->getString("can_not_view"), false); mScriptEd->mEditor->makePristine(); - mScriptEd->mFunctions->setEnabled(FALSE); + mScriptEd->mFunctions->setEnabled(false); mAssetStatus = PREVIEW_ASSET_LOADED; } getChildView("lock")->setVisible( !is_modifiable); @@ -1710,14 +1711,14 @@ void LLPreviewLSL::loadAsset() } else { - mScriptEd->setScriptText(std::string(HELLO_LSL), TRUE); - mScriptEd->setEnableEditing(TRUE); + mScriptEd->setScriptText(std::string(HELLO_LSL), true); + mScriptEd->setEnableEditing(true); mAssetStatus = PREVIEW_ASSET_LOADED; } } -BOOL LLPreviewLSL::canClose() +bool LLPreviewLSL::canClose() { return mScriptEd->canClose(); } @@ -1748,7 +1749,7 @@ void LLPreviewLSL::onLoad(void* userdata) } // static -void LLPreviewLSL::onSave(void* userdata, BOOL close_after_save) +void LLPreviewLSL::onSave(void* userdata, bool close_after_save) { LLPreviewLSL* self = (LLPreviewLSL*)userdata; self->mCloseAfterSave = close_after_save; @@ -1865,12 +1866,12 @@ void LLPreviewLSL::onLoadComplete(const LLUUID& asset_uuid, LLAssetType::EType t // put a EOS at the end buffer[file_length] = 0; - preview->mScriptEd->setScriptText(LLStringExplicit(&buffer[0]), TRUE); + preview->mScriptEd->setScriptText(LLStringExplicit(&buffer[0]), true); preview->mScriptEd->mEditor->makePristine(); std::string script_name = DEFAULT_SCRIPT_NAME; LLInventoryItem* item = gInventory.getItem(*item_uuid); - BOOL is_modifiable = FALSE; + bool is_modifiable = false; if (item) { if (!item->getName().empty()) @@ -1879,7 +1880,7 @@ void LLPreviewLSL::onLoadComplete(const LLUUID& asset_uuid, LLAssetType::EType t } if (gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE)) { - is_modifiable = TRUE; + is_modifiable = true; } } preview->mScriptEd->setScriptName(script_name); @@ -1937,32 +1938,32 @@ void* LLLiveLSLEditor::createScriptEdPanel(void* userdata) LLLiveLSLEditor::LLLiveLSLEditor(const LLSD& key) : LLScriptEdContainer(key), - mAskedForRunningInfo(FALSE), - mHaveRunningInfo(FALSE), - mCloseAfterSave(FALSE), + mAskedForRunningInfo(false), + mHaveRunningInfo(false), + mCloseAfterSave(false), mPendingUploads(0), - mIsModifiable(FALSE), + mIsModifiable(false), mIsNew(false), - mIsSaving(FALSE), + mIsSaving(false), mObjectName("") { mFactoryMap["script ed panel"] = LLCallbackMap(LLLiveLSLEditor::createScriptEdPanel, this); } -BOOL LLLiveLSLEditor::postBuild() +bool LLLiveLSLEditor::postBuild() { childSetCommitCallback("running", LLLiveLSLEditor::onRunningCheckboxClicked, this); - getChildView("running")->setEnabled(FALSE); + getChildView("running")->setEnabled(false); childSetAction("Reset",&LLLiveLSLEditor::onReset,this); - getChildView("Reset")->setEnabled(TRUE); + getChildView("Reset")->setEnabled(true); mMonoCheckbox = getChild<LLCheckBoxCtrl>("mono"); childSetCommitCallback("mono", &LLLiveLSLEditor::onMonoCheckboxClicked, this); - getChildView("mono")->setEnabled(FALSE); + getChildView("mono")->setEnabled(true); mScriptEd->mEditor->makePristine(); - mScriptEd->mEditor->setFocus(TRUE); + mScriptEd->mEditor->setFocus(true); mExperiences = getChild<LLComboBox>("Experiences..."); @@ -1986,7 +1987,7 @@ void LLLiveLSLEditor::callbackLSLCompileSucceeded(const LLUUID& task_id, mScriptEd->mErrorList->setCommentText(LLTrans::getString("CompileSuccessful")); mScriptEd->mErrorList->setCommentText(LLTrans::getString("SaveComplete")); getChild<LLCheckBoxCtrl>("running")->set(is_script_running); - mIsSaving = FALSE; + mIsSaving = false; closeIfNeeded(); } @@ -2007,7 +2008,7 @@ void LLLiveLSLEditor::callbackLSLCompileFailed(const LLSD& compile_errors) mScriptEd->mErrorList->addElement(row); } mScriptEd->selectFirstError(); - mIsSaving = FALSE; + mIsSaving = false; closeIfNeeded(); } @@ -2039,9 +2040,9 @@ void LLLiveLSLEditor::loadAsset() if(!isGodlike && (!copyManipulate || !mIsModifiable)) { mItem = new LLViewerInventoryItem(item); - mScriptEd->setScriptText(getString("not_allowed"), FALSE); + mScriptEd->setScriptText(getString("not_allowed"), false); mScriptEd->mEditor->makePristine(); - mScriptEd->enableSave(FALSE); + mScriptEd->enableSave(false); mAssetStatus = PREVIEW_ASSET_LOADED; } else if(copyManipulate || isGodlike) @@ -2060,24 +2061,24 @@ void LLLiveLSLEditor::loadAsset() item->getType(), &LLLiveLSLEditor::onLoadComplete, (void*)user_data, - TRUE); + true); LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_GetScriptRunning); msg->nextBlockFast(_PREHASH_Script); msg->addUUIDFast(_PREHASH_ObjectID, mObjectUUID); msg->addUUIDFast(_PREHASH_ItemID, mItemUUID); msg->sendReliable(object->getRegion()->getHost()); - mAskedForRunningInfo = TRUE; + mAskedForRunningInfo = true; mAssetStatus = PREVIEW_ASSET_LOADING; } } if(mItem.isNull()) { - mScriptEd->setScriptText(LLStringUtil::null, FALSE); + mScriptEd->setScriptText(LLStringUtil::null, false); mScriptEd->mEditor->makePristine(); mAssetStatus = PREVIEW_ASSET_LOADED; - mIsModifiable = FALSE; + mIsModifiable = false; } refreshFromItem(); @@ -2100,8 +2101,8 @@ void LLLiveLSLEditor::loadAsset() } else { - mScriptEd->setScriptText(std::string(HELLO_LSL), TRUE); - mScriptEd->enableSave(FALSE); + mScriptEd->setScriptText(std::string(HELLO_LSL), true); + mScriptEd->enableSave(false); LLPermissions perm; perm.init(gAgent.getID(), gAgent.getID(), LLUUID::null, gAgent.getGroupID()); perm.initMasks(PERM_ALL, PERM_ALL, PERM_NONE, PERM_NONE, PERM_MOVE | PERM_TRANSFER); @@ -2138,7 +2139,7 @@ void LLLiveLSLEditor::onLoadComplete(const LLUUID& asset_id, if( LL_ERR_NOERR == status ) { instance->loadScriptText(asset_id, type); - instance->mScriptEd->setEnableEditing(TRUE); + instance->mScriptEd->setEnableEditing(true); instance->mAssetStatus = PREVIEW_ASSET_LOADED; instance->mScriptEd->setAssetID(asset_id); } @@ -2179,7 +2180,7 @@ void LLLiveLSLEditor::loadScriptText(const LLUUID &uuid, LLAssetType::EType type buffer[file_length] = '\0'; - mScriptEd->setScriptText(LLStringExplicit(&buffer[0]), TRUE); + mScriptEd->setScriptText(LLStringExplicit(&buffer[0]), true); mScriptEd->makeEditorPristine(); std::string script_name = DEFAULT_SCRIPT_NAME; @@ -2198,7 +2199,7 @@ void LLLiveLSLEditor::onRunningCheckboxClicked( LLUICtrl*, void* userdata ) LLLiveLSLEditor* self = (LLLiveLSLEditor*) userdata; LLViewerObject* object = gObjectList.findObject( self->mObjectUUID ); LLCheckBoxCtrl* runningCheckbox = self->getChild<LLCheckBoxCtrl>("running"); - BOOL running = runningCheckbox->get(); + bool running = runningCheckbox->get(); //self->mRunningCheckbox->get(); if( object ) { @@ -2257,14 +2258,14 @@ void LLLiveLSLEditor::draw() else { runningCheckbox->setLabel(getString("public_objects_can_not_run")); - runningCheckbox->setEnabled(FALSE); + runningCheckbox->setEnabled(false); // *FIX: Set it to false so that the ui is correct for // a box that is released to public. It could be // incorrect after a release/claim cycle, but will be // correct after clicking on it. - runningCheckbox->set(FALSE); - mMonoCheckbox->set(FALSE); + runningCheckbox->set(false); + mMonoCheckbox->set(false); } } else if(!object) @@ -2272,10 +2273,10 @@ void LLLiveLSLEditor::draw() // HACK: Display this information in the title bar. // Really ought to put in main window. setTitle(LLTrans::getString("ObjectOutOfRange")); - runningCheckbox->setEnabled(FALSE); - mMonoCheckbox->setEnabled(FALSE); + runningCheckbox->setEnabled(false); + mMonoCheckbox->setEnabled(false); // object may have fallen out of range. - mHaveRunningInfo = FALSE; + mHaveRunningInfo = false; } LLPreview::draw(); @@ -2292,15 +2293,15 @@ void LLLiveLSLEditor::onSearchReplace(void* userdata) struct LLLiveLSLSaveData { - LLLiveLSLSaveData(const LLUUID& id, const LLViewerInventoryItem* item, BOOL active); + LLLiveLSLSaveData(const LLUUID& id, const LLViewerInventoryItem* item, bool active); LLUUID mSaveObjectID; LLPointer<LLViewerInventoryItem> mItem; - BOOL mActive; + bool mActive; }; LLLiveLSLSaveData::LLLiveLSLSaveData(const LLUUID& id, const LLViewerInventoryItem* item, - BOOL active) : + bool active) : mSaveObjectID(id), mActive(active) { @@ -2308,7 +2309,6 @@ LLLiveLSLSaveData::LLLiveLSLSaveData(const LLUUID& id, mItem = new LLViewerInventoryItem(item); } - /*static*/ void LLLiveLSLEditor::finishLSLUpload(LLUUID itemId, LLUUID taskId, LLUUID newAssetId, LLSD response, bool isRunning) { @@ -2332,15 +2332,13 @@ void LLLiveLSLEditor::finishLSLUpload(LLUUID itemId, LLUUID taskId, LLUUID newAs preview->callbackLSLCompileFailed(response["errors"]); } } - } - // virtual void LLLiveLSLEditor::saveIfNeeded(bool sync /*= true*/) { LLViewerObject* object = gObjectList.findObject(mObjectUUID); - if(!object) + if (!object) { LLNotificationsUtil::add("SaveScriptFailObjectNotFound"); return; @@ -2365,7 +2363,7 @@ void LLLiveLSLEditor::saveIfNeeded(bool sync /*= true*/) } // Don't need to save if we're pristine - if(!mScriptEd->hasChanged()) + if (!mScriptEd->hasChanged()) { return; } @@ -2373,7 +2371,7 @@ void LLLiveLSLEditor::saveIfNeeded(bool sync /*= true*/) mPendingUploads = 0; // save the script - mScriptEd->enableSave(FALSE); + mScriptEd->enableSave(false); mScriptEd->mEditor->makePristine(); mScriptEd->mErrorList->deleteAllItems(); mScriptEd->mEditor->makePristine(); @@ -2382,6 +2380,7 @@ void LLLiveLSLEditor::saveIfNeeded(bool sync /*= true*/) { mScriptEd->sync(); } + bool isRunning = getChild<LLCheckBoxCtrl>("running")->get(); getWindow()->incBusyCount(); mPendingUploads++; @@ -2406,16 +2405,16 @@ void LLLiveLSLEditor::saveIfNeeded(bool sync /*= true*/) } } -BOOL LLLiveLSLEditor::canClose() +bool LLLiveLSLEditor::canClose() { - return (mScriptEd->canClose()); + return mScriptEd->canClose(); } void LLLiveLSLEditor::closeIfNeeded() { getWindow()->decBusyCount(); mPendingUploads--; - if (mPendingUploads <= 0 && mCloseAfterSave) + if ((mPendingUploads <= 0) && mCloseAfterSave) { closeFloater(); } @@ -2429,10 +2428,9 @@ void LLLiveLSLEditor::onLoad(void* userdata) } // static -void LLLiveLSLEditor::onSave(void* userdata, BOOL close_after_save) +void LLLiveLSLEditor::onSave(void* userdata, bool close_after_save) { - LLLiveLSLEditor* self = (LLLiveLSLEditor*)userdata; - if(self) + if (LLLiveLSLEditor* self = (LLLiveLSLEditor*)userdata) { self->mCloseAfterSave = close_after_save; self->mScriptEd->mErrorList->setCommentText(""); @@ -2440,7 +2438,6 @@ void LLLiveLSLEditor::onSave(void* userdata, BOOL close_after_save) } } - // static void LLLiveLSLEditor::processScriptRunningReply(LLMessageSystem* msg, void**) { @@ -2452,15 +2449,14 @@ void LLLiveLSLEditor::processScriptRunningReply(LLMessageSystem* msg, void**) LLSD floater_key; floater_key["taskid"] = object_id; floater_key["itemid"] = item_id; - LLLiveLSLEditor* instance = LLFloaterReg::findTypedInstance<LLLiveLSLEditor>("preview_scriptedit", floater_key); - if(instance) + if (LLLiveLSLEditor* instance = LLFloaterReg::findTypedInstance<LLLiveLSLEditor>("preview_scriptedit", floater_key)) { - instance->mHaveRunningInfo = TRUE; - BOOL running; + instance->mHaveRunningInfo = true; + bool running; msg->getBOOLFast(_PREHASH_Script, _PREHASH_Running, running); LLCheckBoxCtrl* runningCheckbox = instance->getChild<LLCheckBoxCtrl>("running"); runningCheckbox->set(running); - BOOL mono; + bool mono; msg->getBOOLFast(_PREHASH_Script, "Mono", mono); LLCheckBoxCtrl* monoCheckbox = instance->getChild<LLCheckBoxCtrl>("mono"); monoCheckbox->setEnabled(instance->getIsModifiable() && have_script_upload_cap(object_id)); @@ -2468,7 +2464,6 @@ void LLLiveLSLEditor::processScriptRunningReply(LLMessageSystem* msg, void**) } } - void LLLiveLSLEditor::onMonoCheckboxClicked(LLUICtrl*, void* userdata) { LLLiveLSLEditor* self = static_cast<LLLiveLSLEditor*>(userdata); @@ -2476,22 +2471,17 @@ void LLLiveLSLEditor::onMonoCheckboxClicked(LLUICtrl*, void* userdata) self->mScriptEd->enableSave(self->getIsModifiable()); } -BOOL LLLiveLSLEditor::monoChecked() const +bool LLLiveLSLEditor::monoChecked() const { - if(NULL != mMonoCheckbox) - { - return mMonoCheckbox->getValue()? TRUE : FALSE; - } - return FALSE; + return mMonoCheckbox && mMonoCheckbox->getValue(); } void LLLiveLSLEditor::setAssociatedExperience( LLHandle<LLLiveLSLEditor> editor, const LLSD& experience ) { - LLLiveLSLEditor* scriptEd = editor.get(); - if(scriptEd) + if (LLLiveLSLEditor* scriptEd = editor.get()) { LLUUID id; - if(experience.has(LLExperienceCache::EXPERIENCE_ID)) + if (experience.has(LLExperienceCache::EXPERIENCE_ID)) { id=experience[LLExperienceCache::EXPERIENCE_ID].asUUID(); } diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index e554f049a5..9a3bc35f12 100644 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -89,7 +89,7 @@ protected: const std::string& sample, const LLHandle<LLFloater>& floater_handle, void (*load_callback)(void* userdata), - void (*save_callback)(void* userdata, BOOL close_after_save), + void (*save_callback)(void* userdata, bool close_after_save), void (*search_replace_callback)(void* userdata), void* userdata, bool live, @@ -97,24 +97,22 @@ protected: public: ~LLScriptEdCore(); - void initializeKeywords(); void initMenu(); void processKeywords(); - void processLoaded(); virtual void draw(); - /*virtual*/ BOOL postBuild(); - BOOL canClose(); + /*virtual*/ bool postBuild(); + bool canClose(); void setEnableEditing(bool enable); bool canLoadOrSaveToFile( void* userdata ); - void setScriptText(const std::string& text, BOOL is_valid); + void setScriptText(const std::string& text, bool is_valid); void makeEditorPristine(); bool loadScriptText(const std::string& filename); bool writeToFile(const std::string& filename); void sync(); - void doSave( BOOL close_after_save ); + void doSave( bool close_after_save ); bool handleSaveChangesDialog(const LLSD& notification, const LLSD& response); bool handleReloadFromServerDialog(const LLSD& notification, const LLSD& response); @@ -150,7 +148,7 @@ public: bool isFontSizeChecked(const LLSD &userdata); void onChangeFontSize(const LLSD &size_name); - virtual BOOL handleKeyHere(KEY key, MASK mask); + virtual bool handleKeyHere(KEY key, MASK mask); void selectAll() { mEditor->selectAll(); } private: @@ -161,12 +159,12 @@ public: void selectFirstError(); - void enableSave(BOOL b) {mEnableSave = b;} + void enableSave(bool b) {mEnableSave = b;} protected: void deleteBridges(); void setHelpPage(const std::string& help_string); - void updateDynamicHelp(BOOL immediate = FALSE); + void updateDynamicHelp(bool immediate = false); bool isKeyword(LLKeywordToken* token); void addHelpItemToHistory(const std::string& help_string); static void onErrorList(LLUICtrl*, void* user_data); @@ -178,11 +176,11 @@ private: std::string mScriptName; LLScriptEditor* mEditor; void (*mLoadCallback)(void* userdata); - void (*mSaveCallback)(void* userdata, BOOL close_after_save); + void (*mSaveCallback)(void* userdata, bool close_after_save); void (*mSearchReplaceCallback) (void* userdata); void* mUserdata; LLComboBox *mFunctions; - BOOL mForceClose; + bool mForceClose; LLPanel* mCodePanel; LLScrollListCtrl* mErrorList; std::vector<LLEntryAndEdCore*> mBridges; @@ -190,12 +188,12 @@ private: LLKeywordToken* mLastHelpToken; LLFrameTimer mLiveHelpTimer; S32 mLiveHelpHistorySize; - BOOL mEnableSave; - BOOL mHasScriptData; + bool mEnableSave; + bool mHasScriptData; LLLiveLSLFile* mLiveFile; LLUUID mAssociatedExperience; - BOOL mScriptRemoved; - BOOL mSaveDialogShown; + bool mScriptRemoved; + bool mSaveDialogShown; LLUUID mAssetID; LLScriptEdContainer* mContainer; // parent view @@ -213,7 +211,7 @@ public: LLScriptEdContainer(const LLSD& key); LLScriptEdContainer(const LLSD& key, const bool live); - BOOL handleKeyHere(KEY key, MASK mask); + bool handleKeyHere(KEY key, MASK mask); protected: std::string getTmpFileName(const std::string& script_name); @@ -237,11 +235,11 @@ public: virtual void callbackLSLCompileSucceeded(); virtual void callbackLSLCompileFailed(const LLSD& compile_errors); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); protected: virtual void draw(); - virtual BOOL canClose(); + virtual bool canClose(); void closeIfNeeded(); virtual void loadAsset(); @@ -249,7 +247,7 @@ protected: static void onSearchReplace(void* userdata); static void onLoad(void* userdata); - static void onSave(void* userdata, BOOL close_after_save); + static void onSave(void* userdata, bool close_after_save); static void onLoadComplete(const LLUUID& uuid, LLAssetType::EType type, @@ -285,9 +283,9 @@ public: bool is_script_running); virtual void callbackLSLCompileFailed(const LLSD& compile_errors); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); - void setIsNew() { mIsNew = TRUE; } + void setIsNew() { mIsNew = true; } static void setAssociatedExperience( LLHandle<LLLiveLSLEditor> editor, const LLSD& experience ); static void onToggleExperience(LLUICtrl *ui, void* userdata); @@ -298,24 +296,22 @@ public: void updateExperiencePanel(); void requestExperiences(); void experienceChanged(); - void addAssociatedExperience(const LLSD& experience); void setObjectName(std::string name) { mObjectName = name; } private: - virtual BOOL canClose(); + virtual bool canClose(); void closeIfNeeded(); virtual void draw(); virtual void loadAsset(); - void loadAsset(BOOL is_new); /*virtual*/ void saveIfNeeded(bool sync = true); - BOOL monoChecked() const; + bool monoChecked() const; static void onSearchReplace(void* userdata); static void onLoad(void* userdata); - static void onSave(void* userdata, BOOL close_after_save); + static void onSave(void* userdata, bool close_after_save); static void onLoadComplete(const LLUUID& asset_uuid, LLAssetType::EType type, @@ -325,8 +321,6 @@ private: void loadScriptText(const LLUUID &uuid, LLAssetType::EType type); - static void onErrorList(LLUICtrl*, void* user_data); - static void* createScriptEdPanel(void* userdata); static void onMonoCheckboxClicked(LLUICtrl*, void* userdata); @@ -337,21 +331,21 @@ private: private: bool mIsNew; //LLUUID mTransmitID; - LLCheckBoxCtrl* mRunningCheckbox; - BOOL mAskedForRunningInfo; - BOOL mHaveRunningInfo; - LLButton* mResetButton; + //LLCheckBoxCtrl* mRunningCheckbox; + bool mAskedForRunningInfo; + bool mHaveRunningInfo; + //LLButton* mResetButton; LLPointer<LLViewerInventoryItem> mItem; - BOOL mCloseAfterSave; + bool mCloseAfterSave; // need to save both text and script, so need to decide when done S32 mPendingUploads; - BOOL mIsSaving; + bool mIsSaving; - BOOL getIsModifiable() const { return mIsModifiable; } // Evaluated on load assert + bool getIsModifiable() const { return mIsModifiable; } // Evaluated on load assert LLCheckBoxCtrl* mMonoCheckbox; - BOOL mIsModifiable; + bool mIsModifiable; LLComboBox* mExperiences; diff --git a/indra/newview/llpreviewsound.cpp b/indra/newview/llpreviewsound.cpp index 3c910171cf..eab40429f9 100644 --- a/indra/newview/llpreviewsound.cpp +++ b/indra/newview/llpreviewsound.cpp @@ -48,7 +48,7 @@ LLPreviewSound::LLPreviewSound(const LLSD& key) } // virtual -BOOL LLPreviewSound::postBuild() +bool LLPreviewSound::postBuild() { const LLInventoryItem* item = getItem(); if (item) diff --git a/indra/newview/llpreviewsound.h b/indra/newview/llpreviewsound.h index e1bca7f4e3..b456a7e854 100644 --- a/indra/newview/llpreviewsound.h +++ b/indra/newview/llpreviewsound.h @@ -38,7 +38,7 @@ public: static void auditionSound( void* userdata ); protected: - /* virtual */ BOOL postBuild(); + bool postBuild() override; }; #endif // LL_LLPREVIEWSOUND_H diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index 5e19d770a6..259332a3ff 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -66,23 +66,24 @@ const F32 PREVIEW_TEXTURE_MIN_ASPECT = 0.005f; LLPreviewTexture::LLPreviewTexture(const LLSD& key) : LLPreview(key), - mLoadingFullImage( FALSE ), - mShowKeepDiscard(FALSE), - mCopyToInv(FALSE), - mIsCopyable(FALSE), - mIsFullPerm(FALSE), - mUpdateDimensions(TRUE), + mLoadingFullImage( false ), + mSavingMultiple(false), + mShowKeepDiscard(false), + mCopyToInv(false), + mIsCopyable(false), + mIsFullPerm(false), + mUpdateDimensions(true), mLastHeight(0), mLastWidth(0), mAspectRatio(0.f), - mPreviewToSave(FALSE), + mPreviewToSave(false), mImage(NULL), mImageOldBoostLevel(LLGLTexture::BOOST_NONE) { updateImageID(); if (key.has("save_as")) { - mPreviewToSave = TRUE; + mPreviewToSave = true; } } @@ -126,7 +127,7 @@ void LLPreviewTexture::populateRatioList() } // virtual -BOOL LLPreviewTexture::postBuild() +bool LLPreviewTexture::postBuild() { if (mCopyToInv) { @@ -158,7 +159,7 @@ BOOL LLPreviewTexture::postBuild() getChild<LLUICtrl>("desc")->setValue(item->getDescription()); getChild<LLLineEditor>("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe); } - BOOL source_library = mObjectUUID.isNull() && gInventory.isObjectDescendentOf(item->getUUID(), gInventory.getLibraryRootFolderID()); + bool source_library = mObjectUUID.isNull() && gInventory.isObjectDescendentOf(item->getUUID(), gInventory.getLibraryRootFolderID()); if (source_library) { getChildView("Discard")->setEnabled(false); @@ -283,7 +284,7 @@ void LLPreviewTexture::draw() // virtual -BOOL LLPreviewTexture::canSaveAs() const +bool LLPreviewTexture::canSaveAs() const { return mIsFullPerm && !mLoadingFullImage && mImage.notNull() && !mImage->isMissingAsset(); } @@ -304,60 +305,44 @@ void LLPreviewTexture::saveTextureToFile(const std::vector<std::string>& filenam const LLInventoryItem* item = getItem(); if (item && mPreviewToSave) { - mPreviewToSave = FALSE; + mPreviewToSave = false; LLFloaterReg::showTypedInstance<LLPreviewTexture>("preview_texture", item->getUUID()); } // remember the user-approved/edited file name. mSaveFileName = filenames[0]; - mLoadingFullImage = TRUE; + mSavingMultiple = false; + mLoadingFullImage = true; getWindow()->incBusyCount(); + LL_DEBUGS("FileSaveAs") << "Scheduling saving file to " << mSaveFileName << LL_ENDL; + mImage->forceToSaveRawImage(0);//re-fetch the raw image if the old one is removed. mImage->setLoadedCallback(LLPreviewTexture::onFileLoadedForSave, - 0, TRUE, FALSE, new LLUUID(mItemUUID), &mCallbackTextureList); + 0, true, false, new LLUUID(mItemUUID), &mCallbackTextureList); } void LLPreviewTexture::saveMultipleToFile(const std::string& file_name) { std::string texture_location(gSavedSettings.getString("TextureSaveLocation")); - std::string texture_name = file_name.empty() ? getItem()->getName() : file_name; - - std::string filepath; - S32 i = 0; - S32 err = 0; - std::string extension(".png"); - do - { - filepath = texture_location; - filepath += gDirUtilp->getDirDelimiter(); - filepath += texture_name; - - if (i != 0) - { - filepath += llformat("_%.3d", i); - } + std::string texture_name = LLDir::getScrubbedFileName(file_name.empty() ? getItem()->getName() : file_name); - filepath += extension; + mSaveFileName = texture_location + gDirUtilp->getDirDelimiter() + texture_name + ".png"; - llstat stat_info; - err = LLFile::stat( filepath, &stat_info ); - i++; - } while (-1 != err); // Search until the file is not found (i.e., stat() gives an error). - - - mSaveFileName = filepath; - mLoadingFullImage = TRUE; + mSavingMultiple = true; + mLoadingFullImage = true; getWindow()->incBusyCount(); + LL_DEBUGS("FileSaveAs") << "Scheduling saving file to " << mSaveFileName << LL_ENDL; + mImage->forceToSaveRawImage(0);//re-fetch the raw image if the old one is removed. mImage->setLoadedCallback(LLPreviewTexture::onFileLoadedForSave, - 0, TRUE, FALSE, new LLUUID(mItemUUID), &mCallbackTextureList); + 0, true, false, new LLUUID(mItemUUID), &mCallbackTextureList); } // virtual -void LLPreviewTexture::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLPreviewTexture::reshape(S32 width, S32 height, bool called_from_parent) { LLPreview::reshape(width, height, called_from_parent); @@ -412,7 +397,7 @@ void LLPreviewTexture::onFocusReceived() void LLPreviewTexture::openToSave() { - mPreviewToSave = TRUE; + mPreviewToSave = true; } void LLPreviewTexture::hideCtrlButtons() @@ -426,12 +411,12 @@ void LLPreviewTexture::hideCtrlButtons() } // static -void LLPreviewTexture::onFileLoadedForSave(BOOL success, +void LLPreviewTexture::onFileLoadedForSave(bool success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, - BOOL final, + bool final, void* userdata) { LLUUID* item_uuid = (LLUUID*) userdata; @@ -445,14 +430,45 @@ void LLPreviewTexture::onFileLoadedForSave(BOOL success, if( self ) { self->getWindow()->decBusyCount(); - self->mLoadingFullImage = FALSE; + self->mLoadingFullImage = false; } } if( self && final && success ) { + LL_DEBUGS("FileSaveAs") << "Saving file to " << self->mSaveFileName << LL_ENDL; const U32 ext_length = 3; std::string extension = self->mSaveFileName.substr( self->mSaveFileName.length() - ext_length); + + std::string filepath; + if (self->mSavingMultiple) + { + std::string part_path = self->mSaveFileName.substr(0, self->mSaveFileName.length() - ext_length - 1); + + S32 i = 0; + S32 err = 0; + do + { + filepath = part_path; + + if (i != 0) + { + filepath += llformat("_%.3d", i); + } + + filepath += "."; + filepath += extension; + + llstat stat_info; + err = LLFile::stat(filepath, &stat_info); + i++; + } while (-1 != err); // Search until the file is not found (i.e., stat() gives an error). + } + else + { + filepath = self->mSaveFileName; + } + LLStringUtil::toLower(extension); // We only support saving in PNG or TGA format LLPointer<LLImageFormatted> image; @@ -468,13 +484,13 @@ void LLPreviewTexture::onFileLoadedForSave(BOOL success, if( image && !image->encode( src, 0 ) ) { LLSD args; - args["FILE"] = self->mSaveFileName; + args["FILE"] = filepath; LLNotificationsUtil::add("CannotEncodeFile", args); } - else if( image && !image->save( self->mSaveFileName ) ) + else if( image && !image->save(filepath) ) { LLSD args; - args["FILE"] = self->mSaveFileName; + args["FILE"] = filepath; LLNotificationsUtil::add("CannotWriteFile", args); } else @@ -482,6 +498,7 @@ void LLPreviewTexture::onFileLoadedForSave(BOOL success, self->mSavedFileTimer.reset(); self->mSavedFileTimer.setTimerExpirySec( SECONDS_TO_SHOW_FILE_SAVED_MSG ); } + LL_DEBUGS("FileSaveAs") << "Done saving file to " << filepath << LL_ENDL; self->mSaveFileName.clear(); } @@ -530,12 +547,12 @@ void LLPreviewTexture::updateDimensions() // Reshape the floater only when required if (mUpdateDimensions) { - mUpdateDimensions = FALSE; + mUpdateDimensions = false; //reshape floater reshape(getRect().getWidth(), getRect().getHeight()); - gFloaterView->adjustToFitScreen(this, FALSE); + gFloaterView->adjustToFitScreen(this, false); LLRect dim_rect(getChildView("dimensions")->getRect()); LLRect aspect_label_rect(getChildView("aspect_ratio")->getRect()); @@ -547,7 +564,7 @@ void LLPreviewTexture::updateDimensions() // Return true if everything went fine, false if we somewhat modified the ratio as we bumped on border values bool LLPreviewTexture::setAspectRatio(const F32 width, const F32 height) { - mUpdateDimensions = TRUE; + mUpdateDimensions = true; // We don't allow negative width or height. Also, if height is positive but too small, we reset to default // A default 0.f value for mAspectRatio means "unconstrained" in the rest of the code @@ -595,7 +612,7 @@ void LLPreviewTexture::loadAsset() mImage->setBoostLevel(LLGLTexture::BOOST_PREVIEW); mImage->forceToSaveRawImage(0) ; mAssetStatus = PREVIEW_ASSET_LOADING; - mUpdateDimensions = TRUE; + mUpdateDimensions = true; updateDimensions(); getChildView("save_tex_btn")->setEnabled(canSaveAs()); if (mObjectUUID.notNull()) @@ -606,7 +623,7 @@ void LLPreviewTexture::loadAsset() else { // check that we can remove item - BOOL source_library = gInventory.isObjectDescendentOf(mItemUUID, gInventory.getLibraryRootFolderID()); + bool source_library = gInventory.isObjectDescendentOf(mItemUUID, gInventory.getLibraryRootFolderID()); if (source_library) { getChildView("Discard")->setEnabled(false); @@ -656,7 +673,7 @@ void LLPreviewTexture::adjustAspectRatio() std::string ratio = std::to_string(num)+":" + std::to_string(denom); mRatiosList.push_back(ratio); combo->add(ratio); - combo->setCurrentByIndex(mRatiosList.size()- 1); + combo->setCurrentByIndex(static_cast<S32>(mRatiosList.size()) - 1); } else { @@ -674,7 +691,7 @@ void LLPreviewTexture::adjustAspectRatio() } } - mUpdateDimensions = TRUE; + mUpdateDimensions = true; } void LLPreviewTexture::updateImageID() @@ -687,9 +704,9 @@ void LLPreviewTexture::updateImageID() // here's the old logic... //mShowKeepDiscard = item->getPermissions().getCreator() != gAgent.getID(); // here's the new logic... 'cos we hate disappearing buttons. - mShowKeepDiscard = TRUE; + mShowKeepDiscard = true; - mCopyToInv = FALSE; + mCopyToInv = false; LLPermissions perm(item->getPermissions()); mIsCopyable = perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID()) && perm.allowTransferTo(gAgent.getID()); mIsFullPerm = item->checkPermissionsSet(PERM_ITEM_UNRESTRICTED); @@ -697,10 +714,10 @@ void LLPreviewTexture::updateImageID() else // not an item, assume it's an asset id { mImageID = mItemUUID; - mShowKeepDiscard = FALSE; - mCopyToInv = TRUE; - mIsCopyable = TRUE; - mIsFullPerm = TRUE; + mShowKeepDiscard = false; + mCopyToInv = true; + mIsCopyable = true; + mIsFullPerm = true; } } diff --git a/indra/newview/llpreviewtexture.h b/indra/newview/llpreviewtexture.h index fda4390993..e55d61ef10 100644 --- a/indra/newview/llpreviewtexture.h +++ b/indra/newview/llpreviewtexture.h @@ -43,22 +43,22 @@ public: virtual void draw(); - virtual BOOL canSaveAs() const; + virtual bool canSaveAs() const; virtual void saveAs(); virtual void loadAsset(); virtual EAssetStatus getAssetStatus(); - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + virtual void reshape(S32 width, S32 height, bool called_from_parent = true); virtual void onFocusReceived(); static void onFileLoadedForSave( - BOOL success, + bool success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, - BOOL final, + bool final, void* userdata ); void openToSave(); @@ -73,7 +73,7 @@ public: protected: void init(); void populateRatioList(); - /* virtual */ BOOL postBuild(); + /* virtual */ bool postBuild(); bool setAspectRatio(const F32 width, const F32 height); static void onAspectRatioCommit(LLUICtrl*,void* userdata); void adjustAspectRatio(); @@ -86,18 +86,19 @@ private: S32 mImageOldBoostLevel; std::string mSaveFileName; LLFrameTimer mSavedFileTimer; - BOOL mLoadingFullImage; - BOOL mShowKeepDiscard; - BOOL mCopyToInv; + bool mSavingMultiple; + bool mLoadingFullImage; + bool mShowKeepDiscard; + bool mCopyToInv; // Save the image once it's loaded. - BOOL mPreviewToSave; + bool mPreviewToSave; // This is stored off in a member variable, because the save-as // button and drag and drop functionality need to know. - BOOL mIsCopyable; - BOOL mIsFullPerm; - BOOL mUpdateDimensions; + bool mIsCopyable; + bool mIsFullPerm; + bool mUpdateDimensions; S32 mLastHeight; S32 mLastWidth; F32 mAspectRatio; diff --git a/indra/newview/llprogressview.cpp b/indra/newview/llprogressview.cpp index ae0face297..9f2d490111 100644 --- a/indra/newview/llprogressview.cpp +++ b/indra/newview/llprogressview.cpp @@ -77,7 +77,7 @@ LLProgressView::LLProgressView() mFadeFromLoginTimer.stop(); } -BOOL LLProgressView::postBuild() +bool LLProgressView::postBuild() { mProgressBar = getChild<LLProgressBar>("login_progress_bar"); @@ -96,12 +96,12 @@ BOOL LLProgressView::postBuild() getChild<LLTextBox>("message_text")->setClickedCallback(onClickMessage, this); // hidden initially, until we need it - setVisible(FALSE); + setVisible(false); LLNotifications::instance().getChannel("AlertModal")->connectChanged(boost::bind(&LLProgressView::onAlertModal, this, _1)); sInstance = this; - return TRUE; + return true; } @@ -115,24 +115,24 @@ LLProgressView::~LLProgressView() sInstance = NULL; } -BOOL LLProgressView::handleHover(S32 x, S32 y, MASK mask) +bool LLProgressView::handleHover(S32 x, S32 y, MASK mask) { if( childrenHandleHover( x, y, mask ) == NULL ) { gViewerWindow->setCursor(UI_CURSOR_WAIT); } - return TRUE; + return true; } -BOOL LLProgressView::handleKeyHere(KEY key, MASK mask) +bool LLProgressView::handleKeyHere(KEY key, MASK mask) { // Suck up all keystokes except CTRL-Q. if( ('Q' == key) && (MASK_CONTROL == mask) ) { LLAppViewer::instance()->userQuit(); } - return TRUE; + return true; } void LLProgressView::revealIntroPanel() @@ -141,20 +141,20 @@ void LLProgressView::revealIntroPanel() std::string intro_url = gSavedSettings.getString("PostFirstLoginIntroURL"); if ( intro_url.length() > 0 && gSavedSettings.getBOOL("BrowserJavascriptEnabled") && - gSavedSettings.getBOOL("PostFirstLoginIntroViewed" ) == FALSE ) + !gSavedSettings.getBOOL("PostFirstLoginIntroViewed")) { // hide the progress bar getChild<LLView>("stack1")->setVisible(false); // navigate to intro URL and reveal widget mMediaCtrl->navigateTo( intro_url ); - mMediaCtrl->setVisible( TRUE ); + mMediaCtrl->setVisible( true ); // flag as having seen the new user post login intro - gSavedSettings.setBOOL("PostFirstLoginIntroViewed", TRUE ); + gSavedSettings.setBOOL("PostFirstLoginIntroViewed", true ); - mMediaCtrl->setFocus(TRUE); + mMediaCtrl->setFocus(true); } mFadeFromLoginTimer.start(); @@ -173,7 +173,7 @@ void LLProgressView::setStartupComplete() } } -void LLProgressView::setVisible(BOOL visible) +void LLProgressView::setVisible(bool visible) { if (!visible && mFadeFromLoginTimer.getStarted()) { @@ -182,14 +182,14 @@ void LLProgressView::setVisible(BOOL visible) // hiding progress view if (getVisible() && !visible) { - LLPanel::setVisible(FALSE); + LLPanel::setVisible(false); } // showing progress view else if (visible && (!getVisible() || mFadeToWorldTimer.getStarted())) { - setFocus(TRUE); + setFocus(true); mFadeToWorldTimer.stop(); - LLPanel::setVisible(TRUE); + LLPanel::setVisible(true); } } @@ -251,7 +251,7 @@ void LLProgressView::drawLogos(F32 alpha) iter->mDrawRect.getHeight(), iter->mTexturep.get(), UI_VERTEX_COLOR % alpha, - FALSE, + false, iter->mClipRect, iter->mOffsetRect); } @@ -298,7 +298,7 @@ void LLProgressView::draw() gFocusMgr.releaseFocusIfNeeded( this ); // turn off panel that hosts intro so we see the world - setVisible(FALSE); + setVisible(false); // stop observing events since we no longer care mMediaCtrl->remObserver( this ); @@ -368,7 +368,7 @@ void LLProgressView::loadLogo(const std::string &path, raw->expandToPowerOfTwo(); TextureData data; - data.mTexturep = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE); + data.mTexturep = LLViewerTextureManager::getLocalTexture(raw.get(), false); data.mDrawRect = pos_rect; data.mClipRect = clip_rect; data.mOffsetRect = offset_rect; @@ -401,21 +401,6 @@ void LLProgressView::initLogos() temp_str += gDirUtilp->getDirDelimiter(); -#ifdef LL_FMODSTUDIO - // original image size is 264x96, it is on longer side but - // with no internal paddings so it gets additional padding - icon_width = 77; - icon_height = 21; - S32 pad_fmod_y = 4; - texture_start_x++; - loadLogo(temp_str + "fmod_logo.png", - image_codec, - LLRect(texture_start_x, texture_start_y + pad_fmod_y + icon_height, texture_start_x + icon_width, texture_start_y + pad_fmod_y), - default_clip, - default_clip); - - texture_start_x += icon_width + default_pad + 1; -#endif //LL_FMODSTUDIO #ifdef LL_HAVOK // original image size is 342x113, central element is on a larger side // plus internal padding, so it gets slightly more height than desired 32 @@ -506,7 +491,7 @@ void LLProgressView::initStartTexture(S32 location_id, bool is_in_production) { // HACK: getLocalTexture allows only power of two dimentions raw->expandToPowerOfTwo(); - gStartTexture = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE); + gStartTexture = LLViewerTextureManager::getLocalTexture(raw.get(), false); } } @@ -523,8 +508,8 @@ void LLProgressView::initTextures(S32 location_id, bool is_in_production) initStartTexture(location_id, is_in_production); initLogos(); - childSetVisible("panel_icons", mLogosList.empty() ? FALSE : TRUE); - childSetVisible("panel_top_spacer", mLogosList.empty() ? TRUE : FALSE); + childSetVisible("panel_icons", !mLogosList.empty()); + childSetVisible("panel_top_spacer", mLogosList.empty()); } void LLProgressView::releaseTextures() @@ -532,14 +517,14 @@ void LLProgressView::releaseTextures() gStartTexture = NULL; mLogosList.clear(); - childSetVisible("panel_top_spacer", TRUE); - childSetVisible("panel_icons", FALSE); + childSetVisible("panel_top_spacer", true); + childSetVisible("panel_icons", false); } -void LLProgressView::setCancelButtonVisible(BOOL b, const std::string& label) +void LLProgressView::setCancelButtonVisible(bool b, const std::string& label) { - mCancelBtn->setVisible( b ); - mCancelBtn->setEnabled( b ); + mCancelBtn->setVisible(b); + mCancelBtn->setEnabled(b); mCancelBtn->setLabelSelected(label); mCancelBtn->setLabelUnselected(label); } @@ -558,8 +543,8 @@ void LLProgressView::onCancelButtonClicked(void*) else { gAgent.teleportCancel(); - sInstance->mCancelBtn->setEnabled(FALSE); - sInstance->setVisible(FALSE); + sInstance->mCancelBtn->setEnabled(false); + sInstance->setVisible(false); } } diff --git a/indra/newview/llprogressview.h b/indra/newview/llprogressview.h index 56756f092a..db3f4a2e32 100644 --- a/indra/newview/llprogressview.h +++ b/indra/newview/llprogressview.h @@ -48,15 +48,15 @@ public: LLProgressView(); virtual ~LLProgressView(); - BOOL postBuild(); + bool postBuild(); /*virtual*/ void draw(); void drawStartTexture(F32 alpha); void drawLogos(F32 alpha); - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); - /*virtual*/ void setVisible(BOOL visible); + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleKeyHere(KEY key, MASK mask); + /*virtual*/ void setVisible(bool visible); // inherited from LLViewerMediaObserver /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event); @@ -76,7 +76,7 @@ public: void initTextures(S32 location_id, bool is_in_production); void releaseTextures(); - void setCancelButtonVisible(BOOL b, const std::string& label); + void setCancelButtonVisible(bool b, const std::string& label); static void onCancelButtonClicked( void* ); static void onClickMessage(void*); diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index 2604c2ba53..31fd6f3f07 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -56,7 +56,7 @@ void LLReflectionMap::update(U32 resolution, U32 face, bool force_dynamic, F32 n llassert(mCubeArray.notNull()); llassert(mCubeIndex != -1); //llassert(LLPipeline::sRenderDeferred); - + // make sure we don't walk off the edge of the render target while (resolution > gPipeline.mRT->deferredScreen.getWidth() || resolution > gPipeline.mRT->deferredScreen.getHeight()) @@ -65,7 +65,7 @@ void LLReflectionMap::update(U32 resolution, U32 face, bool force_dynamic, F32 n } F32 clip = (near_clip > 0) ? near_clip : getNearClip(); - + gViewerWindow->cubeSnapshot(LLVector3(mOrigin), mCubeArray, mCubeIndex, face, clip, getIsDynamic() || force_dynamic, useClipPlane, clipPlane); } @@ -145,7 +145,7 @@ void LLReflectionMap::autoAdjustOrigin() LLVector3 origin(fp); F32 height = LLWorld::instance().resolveLandHeightAgent(origin) + 2.f; fp[2] = llmax(fp[2], height); - + // make sure radius encompasses all objects LLSimdScalar r2 = 0.0; for (int i = 0; i < 8; ++i) @@ -165,7 +165,7 @@ void LLReflectionMap::autoAdjustOrigin() // make sure near clip doesn't poke through ground fp[2] = llmax(fp[2], height+mRadius*0.5f); - + } } else if (mViewerObject && !mViewerObject->isDead()) @@ -237,7 +237,7 @@ F32 LLReflectionMap::getNearClip() bool LLReflectionMap::getIsDynamic() { if (gSavedSettings.getS32("RenderReflectionProbeDetail") > (S32) LLReflectionMapManager::DetailLevel::STATIC_ONLY && - mViewerObject && + mViewerObject && mViewerObject->getVolume()) { return ((LLVOVolume*)mViewerObject)->getReflectionProbeIsDynamic(); @@ -247,36 +247,31 @@ bool LLReflectionMap::getIsDynamic() } bool LLReflectionMap::getBox(LLMatrix4& box) -{ +{ if (mViewerObject) { LLVolume* volume = mViewerObject->getVolume(); - if (volume) + if (volume && mViewerObject->getReflectionProbeIsBox()) { - LLVOVolume* vobjp = (LLVOVolume*)mViewerObject; - - if (vobjp->getReflectionProbeIsBox()) + glh::matrix4f mv(gGLModelView); + glh::matrix4f scale; + LLVector3 s = mViewerObject->getScale().scaledVec(LLVector3(0.5f, 0.5f, 0.5f)); + mRadius = s.magVec(); + scale.set_scale(glh::vec3f(s.mV)); + if (mViewerObject->mDrawable != nullptr) { - glh::matrix4f mv(gGLModelView); - glh::matrix4f scale; - LLVector3 s = vobjp->getScale().scaledVec(LLVector3(0.5f, 0.5f, 0.5f)); - mRadius = s.magVec(); - scale.set_scale(glh::vec3f(s.mV)); - if (vobjp->mDrawable != nullptr) - { - // object to agent space (no scale) - glh::matrix4f rm((F32*)vobjp->mDrawable->getWorldMatrix().mMatrix); + // object to agent space (no scale) + glh::matrix4f rm((F32*)mViewerObject->mDrawable->getWorldMatrix().mMatrix); - // construct object to camera space (with scale) - mv = mv * rm * scale; + // construct object to camera space (with scale) + mv = mv * rm * scale; - // inverse is camera space to object unit cube - mv = mv.inverse(); + // inverse is camera space to object unit cube + mv = mv.inverse(); - box = LLMatrix4(mv.m); + box = LLMatrix4(mv.m); - return true; - } + return true; } } } @@ -337,7 +332,7 @@ void LLReflectionMap::doOcclusion(const LLVector4a& eye) mOccluded = false; return; } - + if (mOcclusionQuery == 0) { // no query was previously issued, allocate one and issue LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("rmdo - glGenQueries"); diff --git a/indra/newview/llreflectionmap.h b/indra/newview/llreflectionmap.h index 9e888f20d0..117ea4cfa6 100644 --- a/indra/newview/llreflectionmap.h +++ b/indra/newview/llreflectionmap.h @@ -36,7 +36,7 @@ class alignas(16) LLReflectionMap : public LLRefCount { LL_ALIGN_NEW public: - + enum class ProbeType { ALL = 0, @@ -44,8 +44,8 @@ public: IRRADIANCE, REFLECTION }; - - // allocate an environment map of the given resolution + + // allocate an environment map of the given resolution LLReflectionMap(); ~LLReflectionMap(); @@ -86,7 +86,7 @@ public: // point at which environment map was last generated from (in agent space) LLVector4a mOrigin; - + // distance from main viewer camera F32 mDistance = -1.f; @@ -106,7 +106,7 @@ public: // cube map used to sample this environment map LLPointer<LLCubeMapArray> mCubeArray; S32 mCubeIndex = -1; // index into cube map array or -1 if not currently stored in cube map array - + // probe has had at least one full update and is ready to render bool mComplete = false; @@ -136,7 +136,7 @@ public: GLuint mOcclusionQuery = 0; bool mOccluded = false; U32 mOcclusionPendingFrames = 0; - + ProbeType mType; }; diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp index ad5928271c..3130fe3bac 100644 --- a/indra/newview/llreflectionmapmanager.cpp +++ b/indra/newview/llreflectionmapmanager.cpp @@ -67,14 +67,14 @@ void load_exr(const std::string& filename) const char* err = NULL; // or nullptr in C++11 int ret = LoadEXRWithLayer(&out, &width, &height, filename.c_str(), /* layername */ nullptr, &err); - if (ret == TINYEXR_SUCCESS) + if (ret == TINYEXR_SUCCESS) { U32 texName = 0; LLImageGL::generateTextures(1, &texName); gEXRImage = new LLImageGL(texName, 4, GL_TEXTURE_2D, GL_RGB16F, GL_RGB16F, GL_FLOAT, LLTexUnit::TAM_CLAMP); - gEXRImage->setHasMipMaps(TRUE); - gEXRImage->setUseMipMaps(TRUE); + gEXRImage->setHasMipMaps(true); + gEXRImage->setUseMipMaps(true); gEXRImage->setFilteringOption(LLTexUnit::TFO_TRILINEAR); gGL.getTexUnit(0)->bind(gEXRImage); @@ -87,12 +87,12 @@ void load_exr(const std::string& filename) gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } - else + else { LLSD notif_args; notif_args["WHAT"] = filename; notif_args["REASON"] = "Unknown"; - if (err) + if (err) { notif_args["REASON"] = std::string(err); FreeEXRErrorMessage(err); // release memory of error message. @@ -119,8 +119,8 @@ void hdri_preview() true); } -extern BOOL gCubeSnapshot; -extern BOOL gTeleportDisplay; +extern bool gCubeSnapshot; +extern bool gTeleportDisplay; static U32 sUpdateCount = 0; @@ -231,9 +231,9 @@ void LLReflectionMapManager::update() { U32 res = mProbeResolution; U32 count = log2((F32)res) + 0.5f; - + mMipChain.resize(count); - for (int i = 0; i < count; ++i) + for (U32 i = 0; i < count; ++i) { mMipChain[i].allocate(res, res, GL_RGB16F); res /= 2; @@ -241,7 +241,7 @@ void LLReflectionMapManager::update() } llassert(mProbes[0] == mDefaultProbe); - + LLVector4a camera_pos; camera_pos.load3(LLViewerCamera::instance().getOrigin().mV); @@ -256,7 +256,7 @@ void LLReflectionMapManager::update() } mKillList.clear(); - + // process create list for (auto& probe : mCreateList) { @@ -272,12 +272,12 @@ void LLReflectionMapManager::update() bool did_update = false; - + static LLCachedControl<S32> sDetail(gSavedSettings, "RenderReflectionProbeDetail", -1); static LLCachedControl<S32> sLevel(gSavedSettings, "RenderReflectionProbeLevel", 3); bool realtime = sDetail >= (S32)LLReflectionMapManager::DetailLevel::REALTIME; - + LLReflectionMap* closestDynamic = nullptr; LLReflectionMap* oldestProbe = nullptr; @@ -316,7 +316,7 @@ void LLReflectionMapManager::update() // next distribute the free indices U32 count = llmin(mReflectionProbeCount, (U32)mProbes.size()); - for (S32 i = 1; i < count && !mCubeFree.empty(); ++i) + for (U32 i = 1; i < count && !mCubeFree.empty(); ++i) { // find the closest probe that needs a cube index LLReflectionMap* probe = mProbes[i]; @@ -330,7 +330,7 @@ void LLReflectionMapManager::update() } } - for (int i = 0; i < mProbes.size(); ++i) + for (unsigned int i = 0; i < mProbes.size(); ++i) { LLReflectionMap* probe = mProbes[i]; if (probe->getNumRefs() == 1) @@ -339,7 +339,7 @@ void LLReflectionMapManager::update() --i; continue; } - + if (probe != mDefaultProbe && (!probe->isRelevant() || mPaused)) { // skip irrelevant probes (or all non-default probes if paused) @@ -442,7 +442,7 @@ void LLReflectionMapManager::update() { LLReflectionMap* probe = oldestProbe; llassert(probe->mCubeIndex != -1); - + probe->autoAdjustOrigin(); sUpdateCount++; @@ -551,17 +551,22 @@ void LLReflectionMapManager::getReflectionMaps(std::vector<LLReflectionMap*>& ma LLReflectionMap* LLReflectionMapManager::registerSpatialGroup(LLSpatialGroup* group) { - if (group->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_VOLUME) + if (!group) { - OctreeNode* node = group->getOctreeNode(); - F32 size = node->getSize().getF32ptr()[0]; - if (size >= 15.f && size <= 17.f) - { - return addProbe(group); - } + return nullptr; } - - return nullptr; + LLSpatialPartition* part = group->getSpatialPartition(); + if (!part || part->mPartitionType != LLViewerRegion::PARTITION_VOLUME) + { + return nullptr; + } + OctreeNode* node = group->getOctreeNode(); + F32 size = node->getSize().getF32ptr()[0]; + if (size < 15.f || size > 17.f) + { + return nullptr; + } + return addProbe(group); } LLReflectionMap* LLReflectionMapManager::registerViewerObject(LLViewerObject* vobj) @@ -631,7 +636,7 @@ void LLReflectionMapManager::doProbeUpdate() llassert(mUpdatingProbe != nullptr); updateProbeFace(mUpdatingProbe, mUpdatingFace); - + bool debug_updates = gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PROBE_UPDATES) && mUpdatingProbe->mViewerObject; if (++mUpdatingFace == 6) @@ -684,11 +689,11 @@ void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face) touch_default_probe(probe); gPipeline.pushRenderTypeMask(); - + //only render sky, water, terrain, and clouds gPipeline.andRenderTypeMask(LLPipeline::RENDER_TYPE_SKY, LLPipeline::RENDER_TYPE_WL_SKY, LLPipeline::RENDER_TYPE_WATER, LLPipeline::RENDER_TYPE_VOIDWATER, LLPipeline::RENDER_TYPE_CLOUDS, LLPipeline::RENDER_TYPE_TERRAIN, LLPipeline::END_RENDER_TYPES); - + probe->update(mRenderTarget.getWidth(), face); gPipeline.popRenderTypeMask(); @@ -697,7 +702,7 @@ void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face) { probe->update(mRenderTarget.getWidth(), face); } - + gPipeline.mRT = &gPipeline.mMainRT; S32 sourceIdx = mReflectionProbeCount; @@ -774,15 +779,15 @@ void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face) gGL.getTexUnit(diffuseChannel)->bind(&(mMipChain[i - 1])); } - + gReflectionMipProgram.uniform1f(resScale, 1.f/(mProbeResolution*2)); - + gPipeline.mScreenTriangleVB->setBuffer(); gPipeline.mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3); - + res /= 2; - S32 mip = i - (mMipChain.size() - mips); + GLint mip = i - (static_cast<GLint>(mMipChain.size()) - mips); if (mip >= 0) { @@ -873,7 +878,7 @@ void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face) gIrradianceGenProgram.uniform1i(sSourceIdx, sourceIdx); gIrradianceGenProgram.uniform1f(LLShaderMgr::REFLECTION_PROBE_MAX_LOD, mMaxProbeLOD); - + mVertexBuffer->setBuffer(); int start_mip = 0; // find the mip target to start with based on irradiance map resolution @@ -952,7 +957,7 @@ void LLReflectionMapManager::updateNeighbors(LLReflectionMap* probe) //remove from existing neighbors { LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("rmmun - clear"); - + for (auto& other : probe->mNeighbors) { auto const & iter = std::find(other->mNeighbors.begin(), other->mNeighbors.end(), probe); @@ -1064,7 +1069,7 @@ void LLReflectionMapManager::updateUniforms() bool is_ambiance_pass = gCubeSnapshot && !isRadiancePass(); F32 ambscale = is_ambiance_pass ? 0.f : 1.f; F32 radscale = is_ambiance_pass ? 0.5f : 1.f; - + for (auto* refmap : mReflectionMaps) { if (refmap == nullptr) @@ -1082,8 +1087,8 @@ void LLReflectionMapManager::updateUniforms() // 4. For each bucket, store the index of the nearest probe that might influence pixels in that bucket // 5. In the shader, lookup the bucket for the pixel depth to get the index of the first probe that could possibly influence // the current pixel. - int depth_min = llclamp(llfloor(refmap->mMinDepth), 0, 255); - int depth_max = llclamp(llfloor(refmap->mMaxDepth), 0, 255); + unsigned int depth_min = llclamp(llfloor(refmap->mMinDepth), 0, 255); + unsigned int depth_max = llclamp(llfloor(refmap->mMaxDepth), 0, 255); for (U32 i = depth_min; i <= depth_max; ++i) { if (refmap->mMinDepth < minDepth[i]) @@ -1195,7 +1200,7 @@ void LLReflectionMapManager::updateUniforms() { // fill in gaps in refBucket S32 probe_idx = mReflectionProbeCount; - + for (int i = 0; i < 256; ++i) { if (i < count) @@ -1267,7 +1272,7 @@ void LLReflectionMapManager::setUniforms() { updateUniforms(); } - glBindBufferBase(GL_UNIFORM_BUFFER, 1, mUBO); + glBindBufferBase(GL_UNIFORM_BUFFER, LLGLSLShader::UB_REFLECTION_PROBES, mUBO); } @@ -1391,7 +1396,7 @@ void LLReflectionMapManager::initReflectionMaps() mTexture->allocate(mProbeResolution, 3, mReflectionProbeCount + 2); mIrradianceMaps = new LLCubeMapArray(); - mIrradianceMaps->allocate(LL_IRRADIANCE_MAP_RESOLUTION, 3, mReflectionProbeCount, FALSE); + mIrradianceMaps->allocate(LL_IRRADIANCE_MAP_RESOLUTION, 3, mReflectionProbeCount, false); } // reset probe state @@ -1442,9 +1447,9 @@ void LLReflectionMapManager::initReflectionMaps() buff->allocateBuffer(4, 0); LLStrider<LLVector3> v; - + buff->getVertexStrider(v); - + v[0] = LLVector3(-1, -1, -1); v[1] = LLVector3(1, -1, -1); v[2] = LLVector3(-1, 1, -1); @@ -1472,7 +1477,7 @@ void LLReflectionMapManager::cleanup() mReflectionMaps.clear(); mUpdatingFace = 0; - + mDefaultProbe = nullptr; mUpdatingProbe = nullptr; diff --git a/indra/newview/llreflectionmapmanager.h b/indra/newview/llreflectionmapmanager.h index 5c0651bc24..f81fb30738 100644 --- a/indra/newview/llreflectionmapmanager.h +++ b/indra/newview/llreflectionmapmanager.h @@ -67,7 +67,7 @@ public: // add a probe for the given spatial group LLReflectionMap* addProbe(LLSpatialGroup* group = nullptr); - + // Populate "maps" with the N most relevant Reflection Maps where N is no more than maps.size() // If less than maps.size() ReflectionMaps are available, will assign trailing elements to nullptr. // maps -- presized array of Reflection Map pointers @@ -160,7 +160,7 @@ private: // update the specified face of the specified probe void updateProbeFace(LLReflectionMap* probe, U32 face); - + // list of active reflection maps std::vector<LLPointer<LLReflectionMap> > mProbes; diff --git a/indra/newview/llregioninfomodel.cpp b/indra/newview/llregioninfomodel.cpp index 383ec60543..c15a5559aa 100644 --- a/indra/newview/llregioninfomodel.cpp +++ b/indra/newview/llregioninfomodel.cpp @@ -92,8 +92,8 @@ void LLRegionInfoModel::sendRegionTerrain(const LLUUID& invoice) const // strings[8] = from estate, float sun_hour // *NOTE: this resets estate sun info. - BOOL estate_global_time = true; - BOOL estate_fixed_sun = false; + bool estate_global_time = true; + bool estate_fixed_sun = false; F32 estate_sun_hour = 0.f; buffer = llformat("%f", mWaterHeight); diff --git a/indra/newview/llregioninfomodel.h b/indra/newview/llregioninfomodel.h index e208899372..08608d6fd8 100644 --- a/indra/newview/llregioninfomodel.h +++ b/indra/newview/llregioninfomodel.h @@ -70,7 +70,7 @@ public: F32 mTerrainLowerLimit; F32 mSunHour; // 6..30 - BOOL mUseEstateSun; + bool mUseEstateSun; std::string mSimName; std::string mSimType; diff --git a/indra/newview/llsavedsettingsglue.cpp b/indra/newview/llsavedsettingsglue.cpp deleted file mode 100644 index 4b0132974a..0000000000 --- a/indra/newview/llsavedsettingsglue.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/** - * @file llsavedsettingsglue.cpp - * @author James Cook - * @brief LLSavedSettingsGlue class implementation - * - * $LicenseInfo:firstyear=2006&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 "llviewerprecompiledheaders.h" - -#include "llsavedsettingsglue.h" - -#include "lluictrl.h" - -#include "llviewercontrol.h" - -void LLSavedSettingsGlue::setBOOL(LLUICtrl* ctrl, const std::string& name) -{ - gSavedSettings.setBOOL(name, ctrl->getValue().asBoolean()); -} - -void LLSavedSettingsGlue::setS32(LLUICtrl* ctrl, const std::string& name) -{ - gSavedSettings.setS32(name, ctrl->getValue().asInteger()); -} - -void LLSavedSettingsGlue::setF32(LLUICtrl* ctrl, const std::string& name) -{ - gSavedSettings.setF32(name, (F32)ctrl->getValue().asReal()); -} - -void LLSavedSettingsGlue::setU32(LLUICtrl* ctrl, const std::string& name) -{ - gSavedSettings.setU32(name, (U32)ctrl->getValue().asInteger()); -} - -void LLSavedSettingsGlue::setString(LLUICtrl* ctrl, const std::string& name) -{ - gSavedSettings.setString(name, ctrl->getValue().asString()); -} diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 62c0b6a0a5..cdccaf44e9 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -154,7 +154,7 @@ void LLSceneMonitor::generateDitheringTexture(S32 width, S32 height) } } - mDitheringTexture = LLViewerTextureManager::getLocalTexture(image_raw.get(), FALSE) ; + mDitheringTexture = LLViewerTextureManager::getLocalTexture(image_raw.get(), false) ; mDitheringTexture->setAddressMode(LLTexUnit::TAM_WRAP); mDitheringTexture->setFilteringOption(LLTexUnit::TFO_POINT); @@ -233,7 +233,7 @@ void LLSceneMonitor::freezeScene() } // freeze everything else - gSavedSettings.setBOOL("FreezeTime", TRUE); + gSavedSettings.setBOOL("FreezeTime", true); //disable sky, water and clouds gPipeline.clearRenderTypeMask(LLPipeline::RENDER_TYPE_SKY, LLPipeline::RENDER_TYPE_WL_SKY, @@ -254,7 +254,7 @@ void LLSceneMonitor::unfreezeScene() } // thaw everything else - gSavedSettings.setBOOL("FreezeTime", FALSE); + gSavedSettings.setBOOL("FreezeTime", false); //enable sky, water and clouds gPipeline.setRenderTypeMask(LLPipeline::RENDER_TYPE_SKY, LLPipeline::RENDER_TYPE_WL_SKY, @@ -527,7 +527,7 @@ void LLSceneMonitor::dumpToFile(const std::string &file_name) os << std::setprecision(10); LLTrace::PeriodicRecording& scene_load_recording = mSceneLoadRecording.getResults(); - const U32 frame_count = scene_load_recording.getNumRecordedPeriods(); + const auto frame_count = scene_load_recording.getNumRecordedPeriods(); F64Seconds frame_time; @@ -673,7 +673,7 @@ LLSceneMonitorView::LLSceneMonitorView(const LLRect& rect) : LLFloater(LLSD()) { setRect(rect); - setVisible(FALSE); + setVisible(false); setCanMinimize(false); setCanClose(true); @@ -704,7 +704,7 @@ void LLSceneMonitorView::onTeleportFinished() } } -void LLSceneMonitorView::onVisibilityChange(BOOL visible) +void LLSceneMonitorView::onVisibilityChange(bool visible) { LLSceneMonitor::getInstance()->setDebugViewerVisible(visible); } diff --git a/indra/newview/llscenemonitor.h b/indra/newview/llscenemonitor.h index ac79543bb9..24260d8970 100644 --- a/indra/newview/llscenemonitor.h +++ b/indra/newview/llscenemonitor.h @@ -114,7 +114,7 @@ public: ~LLSceneMonitorView(); virtual void draw(); - virtual void onVisibilityChange(BOOL visible); + virtual void onVisibilityChange(bool visible); protected: virtual void onClose(bool app_quitting=false); diff --git a/indra/newview/llsceneview.cpp b/indra/newview/llsceneview.cpp index 33af529589..a61474636a 100644 --- a/indra/newview/llsceneview.cpp +++ b/indra/newview/llsceneview.cpp @@ -46,7 +46,7 @@ LLSceneView::LLSceneView(const LLRect& rect) : LLFloater(LLSD()) { setRect(rect); - setVisible(FALSE); + setVisible(false); setCanMinimize(false); setCanClose(true); @@ -102,7 +102,7 @@ void LLSceneView::draw() LLViewerRegion* region = gAgent.getRegion(); if (region) { - for (U32 i = 0; i < gObjectList.getNumObjects(); ++i) + for (S32 i = 0; i < gObjectList.getNumObjects(); ++i) { LLViewerObject* object = gObjectList.getObject(i); @@ -194,13 +194,13 @@ void LLSceneView::draw() F32 size_range = size_domain[1]-size_domain[0]; - U32 count = size[idx].size(); + auto count = size[idx].size(); F32 total = 0.f; gGL.begin(LLRender::LINE_STRIP); - for (U32 i = 0; i < count; ++i) + for (size_t i = 0; i < count; ++i) { F32 rad = size[idx][i]; total += rad; @@ -260,11 +260,11 @@ void LLSceneView::draw() U32 triangle_range = tri_domain[1]-tri_domain[0]; - U32 count = triangles[idx].size(); + auto count = triangles[idx].size(); gGL.begin(LLRender::LINE_STRIP); //plot triangles - for (U32 i = 0; i < count; ++i) + for (size_t i = 0; i < count; ++i) { U32 tri_count = triangles[idx][i]; F32 y = (F32) (tri_count-tri_domain[0])/triangle_range*tri_rect.getHeight()+tri_rect.mBottom; @@ -325,13 +325,13 @@ void LLSceneView::draw() F32 cost_range = streaming_domain[1]-streaming_domain[0]; - U32 count = streaming_cost[idx].size(); + auto count = streaming_cost[idx].size(); F32 total = 0; gGL.begin(LLRender::LINE_STRIP); //plot triangles - for (U32 i = 0; i < count; ++i) + for (size_t i = 0; i < count; ++i) { F32 sc = streaming_cost[idx][i]; total += sc; @@ -391,13 +391,13 @@ void LLSceneView::draw() F32 cost_range = physics_domain[1]-physics_domain[0]; - U32 count = physics_cost[idx].size(); + auto count = physics_cost[idx].size(); F32 total = 0; gGL.begin(LLRender::LINE_STRIP); //plot triangles - for (U32 i = 0; i < count; ++i) + for (size_t i = 0; i < count; ++i) { F32 pc = physics_cost[idx][i]; total += pc; diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp index 07b86a8f6e..89ec2bf72e 100644 --- a/indra/newview/llscreenchannel.cpp +++ b/indra/newview/llscreenchannel.cpp @@ -96,10 +96,10 @@ LLScreenChannelBase::LLScreenChannelBase(const Params& p) mID = p.id; setMouseOpaque( false ); - setVisible(FALSE); + setVisible(false); } -BOOL LLScreenChannelBase::postBuild() +bool LLScreenChannelBase::postBuild() { if (mFloaterSnapRegion == NULL) { @@ -111,10 +111,10 @@ BOOL LLScreenChannelBase::postBuild() mChicletRegion = gViewerWindow->getRootView()->getChildView("chiclet_container"); } - return TRUE; + return true; } -void LLScreenChannelBase::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLScreenChannelBase::reshape(S32 width, S32 height, bool called_from_parent) { if (mChannelAlignment == CA_CENTRE) { @@ -165,7 +165,7 @@ void LLScreenChannelBase::init(S32 channel_left, S32 channel_right) // top and bottom set by updateRect() setRect(LLRect(channel_left, 0, channel_right, 0)); updateRect(); - setVisible(TRUE); + setVisible(true); } void LLScreenChannelBase::updateRect() @@ -691,7 +691,7 @@ void LLScreenChannel::showToastsBottom() { // HACK // EXT-2653: it is necessary to prevent overlapping for secondary showed toasts - toast->setVisible(TRUE); + toast->setVisible(true); } if(!toast->hasFocus()) { @@ -744,7 +744,7 @@ void LLScreenChannel::showToastsCentre() toast_rect.setLeftTopAndSize(getRect().mLeft - toast_rect.getWidth() / 2, bottom + toast_rect.getHeight() / 2 + gSavedSettings.getS32("ToastGap"), toast_rect.getWidth() ,toast_rect.getHeight()); toast->setRect(toast_rect); - toast->setVisible(TRUE); + toast->setVisible(true); } } @@ -838,7 +838,7 @@ void LLScreenChannel::showToastsTop() { // HACK // EXT-2653: it is necessary to prevent overlapping for secondary showed toasts - toast->setVisible(TRUE); + toast->setVisible(true); } if (!toast->hasFocus()) { @@ -898,7 +898,7 @@ void LLScreenChannel::createStartUpToast(S32 notif_num, F32 timer) mStartUpToastPanel->reshape(getRect().getWidth(), toast_rect.getHeight(), true); text_box->setValue(text); - text_box->setVisible(TRUE); + text_box->setVisible(true); text_box->reshapeToFitText(); text_box->setOrigin(text_box->getRect().mLeft, (wrapper_panel->getRect().getHeight() - text_box->getRect().getHeight())/2); @@ -908,7 +908,7 @@ void LLScreenChannel::createStartUpToast(S32 notif_num, F32 timer) addChild(mStartUpToastPanel); - mStartUpToastPanel->setVisible(TRUE); + mStartUpToastPanel->setVisible(true); } // static -------------------------------------------------------------------------- @@ -943,7 +943,7 @@ void LLScreenChannel::closeStartUpToast() { if(mStartUpToastPanel != NULL) { - mStartUpToastPanel->setVisible(FALSE); + mStartUpToastPanel->setVisible(false); mStartUpToastPanel = NULL; } } @@ -975,7 +975,7 @@ void LLScreenChannel::hideToastsFromScreen() LLToast* toast = it->getToast(); if (toast) { - toast->setVisible(FALSE); + toast->setVisible(false); } else { diff --git a/indra/newview/llscreenchannel.h b/indra/newview/llscreenchannel.h index 748d4b507e..22fb41e559 100644 --- a/indra/newview/llscreenchannel.h +++ b/indra/newview/llscreenchannel.h @@ -76,9 +76,9 @@ public: LLScreenChannelBase(const Params&); - BOOL postBuild(); + bool postBuild(); - void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + void reshape(S32 width, S32 height, bool called_from_parent = true); // Channel's outfit-functions // update channel's size and position in the World View diff --git a/indra/newview/llscripteditor.cpp b/indra/newview/llscripteditor.cpp index e03f6302e6..6eb8cf0b37 100644 --- a/indra/newview/llscripteditor.cpp +++ b/indra/newview/llscripteditor.cpp @@ -54,7 +54,7 @@ LLScriptEditor::LLScriptEditor(const Params& p) } } -BOOL LLScriptEditor::postBuild() +bool LLScriptEditor::postBuild() { gSavedSettings.getControl("LSLFontSizeName")->getCommitSignal()->connect(boost::bind(&LLScriptEditor::onFontSizeChange, this)); return LLTextEditor::postBuild(); @@ -120,7 +120,7 @@ void LLScriptEditor::drawLineNumbers() if(line.mLineNum != last_line_num && line.mRect.mTop <= scrolled_view_rect.mTop) { const LLWString ltext = utf8str_to_wstring(llformat("%d", line.mLineNum )); - BOOL is_cur_line = cursor_line == line.mLineNum; + bool is_cur_line = cursor_line == line.mLineNum; const U8 style = is_cur_line ? LLFontGL::BOLD : LLFontGL::NORMAL; const LLColor4 fg_color = is_cur_line ? mCursorColor : mReadOnlyFgColor; getScriptFont()->render( diff --git a/indra/newview/llscripteditor.h b/indra/newview/llscripteditor.h index 19caa277d9..1632ebe834 100644 --- a/indra/newview/llscripteditor.h +++ b/indra/newview/llscripteditor.h @@ -45,7 +45,7 @@ public: // LLView override virtual void draw(); - BOOL postBuild(); + bool postBuild(); void initKeywords(); void loadKeywords(); diff --git a/indra/newview/llscriptfloater.cpp b/indra/newview/llscriptfloater.cpp index 577d7625c7..22a9dd0027 100644 --- a/indra/newview/llscriptfloater.cpp +++ b/indra/newview/llscriptfloater.cpp @@ -87,8 +87,8 @@ bool LLScriptFloater::toggle(const LLUUID& notification_id) } else { - floater->setVisible(TRUE); - floater->setFocus(FALSE); + floater->setVisible(true); + floater->setFocus(false); } } // create and show new floater @@ -113,7 +113,7 @@ LLScriptFloater* LLScriptFloater::show(const LLUUID& notification_id) floater->createForm(notification_id); //LLDialog(LLGiveInventory and LLLoadURL) should no longer steal focus (see EXT-5445) - floater->setAutoFocus(FALSE); + floater->setAutoFocus(false); if(LLScriptFloaterManager::OBJ_SCRIPT == LLScriptFloaterManager::getObjectType(notification_id)) { @@ -126,7 +126,7 @@ LLScriptFloater* LLScriptFloater::show(const LLUUID& notification_id) } //LLDialog(LLGiveInventory and LLLoadURL) should no longer steal focus (see EXT-5445) - LLFloaterReg::showTypedInstance<LLScriptFloater>("script_floater", notification_id, FALSE); + LLFloaterReg::showTypedInstance<LLScriptFloater>("script_floater", notification_id, false); return floater; } @@ -205,7 +205,7 @@ void LLScriptFloater::setDocked(bool docked, bool pop_on_undock /* = true */) hideToastsIfNeeded(); } -void LLScriptFloater::setVisible(BOOL visible) +void LLScriptFloater::setVisible(bool visible) { LLDockableFloater::setVisible(visible); diff --git a/indra/newview/llscriptfloater.h b/indra/newview/llscriptfloater.h index cf413af2cb..8f3b8e99f6 100644 --- a/indra/newview/llscriptfloater.h +++ b/indra/newview/llscriptfloater.h @@ -185,7 +185,7 @@ public: /** * Hide all notification toasts when we show dockable floater */ - /*virtual*/ void setVisible(BOOL visible); + /*virtual*/ void setVisible(bool visible); bool getSavePosition() { return mSaveFloaterPosition; } diff --git a/indra/newview/llscrollingpanelparam.cpp b/indra/newview/llscrollingpanelparam.cpp index 4c8666bdde..8dfe21e4cb 100644 --- a/indra/newview/llscrollingpanelparam.cpp +++ b/indra/newview/llscrollingpanelparam.cpp @@ -50,56 +50,51 @@ const S32 LLScrollingPanelParam::PARAM_HINT_HEIGHT = 128; S32 LLScrollingPanelParam::sUpdateDelayFrames = 0; LLScrollingPanelParam::LLScrollingPanelParam( const LLPanel::Params& panel_params, - LLViewerJointMesh* mesh, LLViewerVisualParam* param, BOOL allow_modify, LLWearable* wearable, LLJoint* jointp, BOOL use_hints ) + LLViewerJointMesh* mesh, LLViewerVisualParam* param, bool allow_modify, LLWearable* wearable, LLJoint* jointp, bool use_hints ) : LLScrollingPanelParamBase( panel_params, mesh, param, allow_modify, wearable, jointp, use_hints) { - // *HACK To avoid hard coding texture position, lets use border's position for texture. - LLViewBorder* left_border = getChild<LLViewBorder>("left_border"); + mLessBtn = getChild<LLButton>("less"); + mMoreBtn = getChild<LLButton>("more"); + mLeftBorder = getChild<LLViewBorder>("left_border"); + mRightBorder = getChild<LLViewBorder>("right_border"); + mMinParamText = getChild<LLUICtrl>("min param text"); + mMaxParamText = getChild<LLUICtrl>("max param text"); + // *HACK To avoid hard coding texture position, lets use border's position for texture. static LLUICachedControl<S32> slider_ctrl_height ("UISliderctrlHeight", 0); - S32 pos_x = left_border->getRect().mLeft + left_border->getBorderWidth(); - S32 pos_y = left_border->getRect().mBottom + left_border->getBorderWidth(); + S32 pos_x = mLeftBorder->getRect().mLeft + mLeftBorder->getBorderWidth(); + S32 pos_y = mLeftBorder->getRect().mBottom + mLeftBorder->getBorderWidth(); F32 min_weight = param->getMinWeight(); F32 max_weight = param->getMaxWeight(); mHintMin = new LLVisualParamHint( pos_x, pos_y, PARAM_HINT_WIDTH, PARAM_HINT_HEIGHT, mesh, (LLViewerVisualParam*) wearable->getVisualParam(param->getID()), wearable, min_weight, jointp); - pos_x = getChild<LLViewBorder>("right_border")->getRect().mLeft + left_border->getBorderWidth(); + pos_x = mRightBorder->getRect().mLeft + mLeftBorder->getBorderWidth(); mHintMax = new LLVisualParamHint( pos_x, pos_y, PARAM_HINT_WIDTH, PARAM_HINT_HEIGHT, mesh, (LLViewerVisualParam*) wearable->getVisualParam(param->getID()), wearable, max_weight, jointp ); - mHintMin->setAllowsUpdates( FALSE ); - mHintMax->setAllowsUpdates( FALSE ); + mHintMin->setAllowsUpdates( false ); + mHintMax->setAllowsUpdates( false ); - std::string min_name = LLTrans::getString(param->getMinDisplayName()); - std::string max_name = LLTrans::getString(param->getMaxDisplayName()); - getChild<LLUICtrl>("min param text")->setValue(min_name); - getChild<LLUICtrl>("max param text")->setValue(max_name); + mMinParamText->setValue(LLTrans::getString(param->getMinDisplayName())); + mMaxParamText->setValue(LLTrans::getString(param->getMaxDisplayName())); - LLButton* less = getChild<LLButton>("less"); - if (less) - { - less->setMouseDownCallback( LLScrollingPanelParam::onHintMinMouseDown, this ); - less->setMouseUpCallback( LLScrollingPanelParam::onHintMinMouseUp, this ); - less->setHeldDownCallback( LLScrollingPanelParam::onHintMinHeldDown, this ); - less->setHeldDownDelay( PARAM_STEP_TIME_THRESHOLD ); - } + mLessBtn->setMouseDownCallback(LLScrollingPanelParam::onHintMinMouseDown, this); + mLessBtn->setMouseUpCallback(LLScrollingPanelParam::onHintMinMouseUp, this); + mLessBtn->setHeldDownCallback(LLScrollingPanelParam::onHintMinHeldDown, this); + mLessBtn->setHeldDownDelay(PARAM_STEP_TIME_THRESHOLD); - LLButton* more = getChild<LLButton>("more"); - if (more) - { - more->setMouseDownCallback( LLScrollingPanelParam::onHintMaxMouseDown, this ); - more->setMouseUpCallback( LLScrollingPanelParam::onHintMaxMouseUp, this ); - more->setHeldDownCallback( LLScrollingPanelParam::onHintMaxHeldDown, this ); - more->setHeldDownDelay( PARAM_STEP_TIME_THRESHOLD ); - } + mMoreBtn->setMouseDownCallback(LLScrollingPanelParam::onHintMaxMouseDown, this); + mMoreBtn->setMouseUpCallback(LLScrollingPanelParam::onHintMaxMouseUp, this); + mMoreBtn->setHeldDownCallback(LLScrollingPanelParam::onHintMaxHeldDown, this); + mMoreBtn->setHeldDownDelay(PARAM_STEP_TIME_THRESHOLD); - setVisible(FALSE); - setBorderVisible( FALSE ); + setVisible(false); + setBorderVisible( false ); } LLScrollingPanelParam::~LLScrollingPanelParam() { } -void LLScrollingPanelParam::updatePanel(BOOL allow_modify) +void LLScrollingPanelParam::updatePanel(bool allow_modify) { if (!mWearable) { @@ -110,11 +105,11 @@ void LLScrollingPanelParam::updatePanel(BOOL allow_modify) mHintMin->requestUpdate( sUpdateDelayFrames++ ); mHintMax->requestUpdate( sUpdateDelayFrames++ ); - getChildView("less")->setEnabled(mAllowModify); - getChildView("more")->setEnabled(mAllowModify); + mLessBtn->setEnabled(mAllowModify); + mMoreBtn->setEnabled(mAllowModify); } -void LLScrollingPanelParam::setVisible( BOOL visible ) +void LLScrollingPanelParam::setVisible( bool visible ) { if( getVisible() != visible ) { @@ -141,16 +136,16 @@ void LLScrollingPanelParam::draw() return; } - getChildView("less")->setVisible( mHintMin->getVisible()); - getChildView("more")->setVisible( mHintMax->getVisible()); + mLessBtn->setVisible( mHintMin->getVisible()); + mMoreBtn->setVisible( mHintMax->getVisible()); // hide borders if texture has been loaded - getChildView("left_border")->setVisible( !mHintMin->getVisible()); - getChildView("right_border")->setVisible( !mHintMax->getVisible()); + mLeftBorder->setVisible( !mHintMin->getVisible()); + mRightBorder->setVisible( !mHintMax->getVisible()); // Draw all the children except for the labels - getChildView("min param text")->setVisible( FALSE ); - getChildView("max param text")->setVisible( FALSE ); + mMinParamText->setVisible( false ); + mMaxParamText->setVisible( false ); LLPanel::draw(); // If we're in a focused floater, don't apply the floater's alpha to visual param hint, @@ -176,11 +171,11 @@ void LLScrollingPanelParam::draw() // Draw labels on top of the buttons - getChildView("min param text")->setVisible( TRUE ); - drawChild(getChild<LLView>("min param text")); + mMinParamText->setVisible( true ); + drawChild(mMinParamText); - getChildView("max param text")->setVisible( TRUE ); - drawChild(getChild<LLView>("max param text")); + mMaxParamText->setVisible( true ); + drawChild(mMaxParamText); } // static diff --git a/indra/newview/llscrollingpanelparam.h b/indra/newview/llscrollingpanelparam.h index e4f3f398fe..3aba4e4e40 100644 --- a/indra/newview/llscrollingpanelparam.h +++ b/indra/newview/llscrollingpanelparam.h @@ -30,6 +30,8 @@ #include "llscrollingpanelparambase.h" +class LLBorder; +class LLButton; class LLViewerJointMesh; class LLViewerVisualParam; class LLWearable; @@ -41,12 +43,12 @@ class LLScrollingPanelParam : public LLScrollingPanelParamBase { public: LLScrollingPanelParam( const LLPanel::Params& panel_params, - LLViewerJointMesh* mesh, LLViewerVisualParam* param, BOOL allow_modify, LLWearable* wearable, LLJoint* jointp, BOOL use_hints = TRUE ); + LLViewerJointMesh* mesh, LLViewerVisualParam* param, bool allow_modify, LLWearable* wearable, LLJoint* jointp, bool use_hints = true ); virtual ~LLScrollingPanelParam(); - virtual void draw(); - virtual void setVisible( BOOL visible ); - virtual void updatePanel(BOOL allow_modify); + void draw() override; + void setVisible(bool visible) override; + void updatePanel(bool allow_modify) override; static void onSliderMouseDown(LLUICtrl* ctrl, void* userdata); static void onSliderMouseUp(LLUICtrl* ctrl, void* userdata); @@ -79,7 +81,14 @@ public: protected: LLTimer mMouseDownTimer; // timer for how long mouse has been held down on a hint. F32 mLastHeldTime; - BOOL mAllowModify; + bool mAllowModify; + + LLButton* mLessBtn; + LLButton* mMoreBtn; + LLViewBorder* mLeftBorder; + LLViewBorder* mRightBorder; + LLUICtrl* mMinParamText; + LLUICtrl* mMaxParamText; }; #endif diff --git a/indra/newview/llscrollingpanelparambase.cpp b/indra/newview/llscrollingpanelparambase.cpp index 13651880dd..247639aa48 100644 --- a/indra/newview/llscrollingpanelparambase.cpp +++ b/indra/newview/llscrollingpanelparambase.cpp @@ -40,7 +40,7 @@ #include "llvoavatarself.h" LLScrollingPanelParamBase::LLScrollingPanelParamBase( const LLPanel::Params& panel_params, - LLViewerJointMesh* mesh, LLViewerVisualParam* param, BOOL allow_modify, LLWearable* wearable, LLJoint* jointp, BOOL use_hints) + LLViewerJointMesh* mesh, LLViewerVisualParam* param, bool allow_modify, LLWearable* wearable, LLJoint* jointp, bool use_hints) : LLScrollingPanel( panel_params ), mParam(param), mAllowModify(allow_modify), @@ -58,15 +58,15 @@ LLScrollingPanelParamBase::LLScrollingPanelParamBase( const LLPanel::Params& pan getChildView("param slider")->setEnabled(mAllowModify); childSetCommitCallback("param slider", LLScrollingPanelParamBase::onSliderMoved, this); - setVisible(FALSE); - setBorderVisible( FALSE ); + setVisible(false); + setBorderVisible( false ); } LLScrollingPanelParamBase::~LLScrollingPanelParamBase() { } -void LLScrollingPanelParamBase::updatePanel(BOOL allow_modify) +void LLScrollingPanelParamBase::updatePanel(bool allow_modify) { LLViewerVisualParam* param = mParam; diff --git a/indra/newview/llscrollingpanelparambase.h b/indra/newview/llscrollingpanelparambase.h index 74682bb71c..9deafcc81a 100644 --- a/indra/newview/llscrollingpanelparambase.h +++ b/indra/newview/llscrollingpanelparambase.h @@ -42,10 +42,10 @@ class LLScrollingPanelParamBase : public LLScrollingPanel { public: LLScrollingPanelParamBase( const LLPanel::Params& panel_params, - LLViewerJointMesh* mesh, LLViewerVisualParam* param, BOOL allow_modify, LLWearable* wearable, LLJoint* jointp, BOOL use_hints = FALSE ); + LLViewerJointMesh* mesh, LLViewerVisualParam* param, bool allow_modify, LLWearable* wearable, LLJoint* jointp, bool use_hints = false ); virtual ~LLScrollingPanelParamBase(); - virtual void updatePanel(BOOL allow_modify); + void updatePanel(bool allow_modify) override; static void onSliderMoved(LLUICtrl* ctrl, void* userdata); @@ -55,7 +55,7 @@ public: public: LLViewerVisualParam* mParam; protected: - BOOL mAllowModify; + bool mAllowModify; LLWearable *mWearable; }; diff --git a/indra/newview/llsearchableui.cpp b/indra/newview/llsearchableui.cpp index 0a3cb803d2..c20f5d4230 100644 --- a/indra/newview/llsearchableui.cpp +++ b/indra/newview/llsearchableui.cpp @@ -134,7 +134,7 @@ void ll::statusbar::SearchableItem::setNotHighlighted( ) if (mWasHiddenBySearch) { - mMenu->setVisible(TRUE); + mMenu->setVisible(true); mWasHiddenBySearch = false; } } @@ -169,7 +169,7 @@ bool ll::statusbar::SearchableItem::hightlightAndHide(LLWString const &aFilter, if (mCtrl && !bVisible && !bHighlighted) { mWasHiddenBySearch = true; - mMenu->setVisible(FALSE); + mMenu->setVisible(false); } return bVisible || bHighlighted; } diff --git a/indra/newview/llsearchcombobox.cpp b/indra/newview/llsearchcombobox.cpp index 5cab2e6f70..10d9ef81eb 100644 --- a/indra/newview/llsearchcombobox.cpp +++ b/indra/newview/llsearchcombobox.cpp @@ -71,7 +71,7 @@ LLSearchComboBox::LLSearchComboBox(const Params&p) button_params.click_callback.function(boost::bind(&LLSearchComboBox::onSelectionCommit, this)); mSearchButton = LLUICtrlFactory::create<LLButton>(button_params); mTextEntry->addChild(mSearchButton); - mTextEntry->setPassDelete(TRUE); + mTextEntry->setPassDelete(true); setButtonVisible(p.dropdown_button_visible); mTextEntry->setCommitCallback(boost::bind(&LLComboBox::onTextCommit, this, _2)); @@ -124,7 +124,7 @@ void LLSearchComboBox::onTextEntry(LLLineEditor* line_editor) void LLSearchComboBox::focusTextEntry() { - // We can't use "mTextEntry->setFocus(TRUE)" instead because + // We can't use "mTextEntry->setFocus(true)" instead because // if the "select_on_focus" parameter is true it places the cursor // at the beginning (after selecting text), thus screwing up updateSelection(). if (mTextEntry) @@ -164,9 +164,9 @@ void LLSearchComboBox::onSelectionCommit() setControlValue(search_query); } -BOOL LLSearchComboBox::remove(const std::string& name) +bool LLSearchComboBox::remove(const std::string& name) { - BOOL found = mList->selectItemByLabel(name, FALSE); + bool found = mList->selectItemByLabel(name, false); if (found) { @@ -186,7 +186,7 @@ void LLSearchComboBox::clearHistory() setTextEntry(LLStringUtil::null); } -BOOL LLSearchComboBox::handleKeyHere(KEY key,MASK mask ) +bool LLSearchComboBox::handleKeyHere(KEY key,MASK mask ) { if(mTextEntry->hasFocus() && MASK_NONE == mask && KEY_DOWN == key) { diff --git a/indra/newview/llsearchcombobox.h b/indra/newview/llsearchcombobox.h index 891237e92e..17787ca5e6 100644 --- a/indra/newview/llsearchcombobox.h +++ b/indra/newview/llsearchcombobox.h @@ -50,14 +50,14 @@ public: /** * Removes an entry from combo box, case insensitive */ - BOOL remove(const std::string& name); + bool remove(const std::string& name); /** * Clears search history */ void clearHistory(); - /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); + /*virtual*/ bool handleKeyHere(KEY key, MASK mask); ~LLSearchComboBox(); diff --git a/indra/newview/llsechandler_basic.cpp b/indra/newview/llsechandler_basic.cpp index da7eff7f54..2d8a5eaf13 100644 --- a/indra/newview/llsechandler_basic.cpp +++ b/indra/newview/llsechandler_basic.cpp @@ -75,7 +75,7 @@ LLBasicCertificate::LLBasicCertificate(const std::string& pem_cert, { // BIO_new_mem_buf returns a read only bio, but takes a void* which isn't const // so we need to cast it. - BIO * pem_bio = BIO_new_mem_buf((void*)pem_cert.c_str(), pem_cert.length()); + BIO * pem_bio = BIO_new_mem_buf((void*)pem_cert.c_str(), static_cast<int>(pem_cert.length())); if(pem_bio == NULL) { LL_WARNS("SECAPI") << "Could not allocate an openssl memory BIO." << LL_ENDL; @@ -747,7 +747,7 @@ bool _cert_subdomain_wildcard_match(const std::string& subdomain, { // split wildcard into the portion before the *, and the portion after - int wildcard_pos = wildcard.find_first_of('*'); + auto wildcard_pos = wildcard.find_first_of('*'); // check the case where there is no wildcard. if(wildcard_pos == wildcard.npos) { @@ -759,7 +759,7 @@ bool _cert_subdomain_wildcard_match(const std::string& subdomain, if(subdomain.substr(0, wildcard_pos) != wildcard.substr(0, wildcard_pos)) { // the first portions of the strings didn't match - return FALSE; + return false; } // as the portion of the wildcard string before the * matched, we need to check the @@ -768,7 +768,7 @@ bool _cert_subdomain_wildcard_match(const std::string& subdomain, if(new_wildcard_string.empty()) { // we had nothing after the *, so it's an automatic match - return TRUE; + return true; } // grab the portion of the remaining wildcard string before the next '*'. We need to find this @@ -779,20 +779,20 @@ bool _cert_subdomain_wildcard_match(const std::string& subdomain, std::string new_subdomain = subdomain.substr(wildcard_pos, subdomain.npos); // iterate through the current subdomain, finding instances of the match string. - int sub_pos = new_subdomain.find_first_of(new_wildcard_match_string); + auto sub_pos = new_subdomain.find_first_of(new_wildcard_match_string); while(sub_pos != std::string::npos) { new_subdomain = new_subdomain.substr(sub_pos, std::string::npos); if(_cert_subdomain_wildcard_match(new_subdomain, new_wildcard_string)) { - return TRUE; + return true; } sub_pos = new_subdomain.find_first_of(new_wildcard_match_string, 1); } // didn't find any instances of the match string that worked in the subdomain, so fail. - return FALSE; + return false; } @@ -811,8 +811,8 @@ bool _cert_hostname_wildcard_match(const std::string& hostname, const std::strin std::string new_cn = common_name; // find the last '.' in the hostname and the match name. - int subdomain_pos = new_hostname.find_last_of('.'); - int subcn_pos = new_cn.find_last_of('.'); + auto subdomain_pos = new_hostname.find_last_of('.'); + auto subcn_pos = new_cn.find_last_of('.'); // if the last char is a '.', strip it if(subdomain_pos == (new_hostname.length()-1)) @@ -837,7 +837,7 @@ bool _cert_hostname_wildcard_match(const std::string& hostname, const std::strin if(!_cert_subdomain_wildcard_match(new_hostname.substr(subdomain_pos+1, std::string::npos), cn_part)) { - return FALSE; + return false; } new_hostname = new_hostname.substr(0, subdomain_pos); new_cn = new_cn.substr(0, subcn_pos); @@ -849,7 +849,7 @@ bool _cert_hostname_wildcard_match(const std::string& hostname, const std::strin if(new_cn == "*") { // if it's just a '*' we support all child domains as well, so '*. - return TRUE; + return true; } return _cert_subdomain_wildcard_match(new_hostname, new_cn); @@ -865,10 +865,10 @@ bool _LLSDArrayIncludesValue(const LLSD& llsd_set, LLSD llsd_value) { if(valueCompareLLSD((*set_value), llsd_value)) { - return TRUE; + return true; } } - return FALSE; + return false; } void _validateCert(int validation_policy, @@ -975,7 +975,7 @@ void _validateCert(int validation_policy, bool _verify_signature(LLPointer<LLCertificate> parent, LLPointer<LLCertificate> child) { - bool verify_result = FALSE; + bool verify_result = false; LLSD cert1, cert2; parent->getLLSD(cert1); child->getLLSD(cert2); @@ -1860,7 +1860,7 @@ std::string LLSecAPIBasicHandler::_legacyLoadPassword() unsigned char unique_id[MAC_ADDRESS_BYTES]; LLMachineID::getUniqueID(unique_id, sizeof(unique_id)); LLXORCipher cipher(unique_id, sizeof(unique_id)); - cipher.decrypt(&buffer[0], buffer.size()); + cipher.decrypt(&buffer[0], static_cast<U32>(buffer.size())); return std::string((const char*)&buffer[0], buffer.size()); } @@ -1913,7 +1913,7 @@ bool valueCompareLLSD(const LLSD& lhs, const LLSD& rhs) { if (lhs.type() != rhs.type()) { - return FALSE; + return false; } if (lhs.isMap()) { @@ -1925,7 +1925,7 @@ bool valueCompareLLSD(const LLSD& lhs, const LLSD& rhs) { if (!rhs.has(litt->first)) { - return FALSE; + return false; } } @@ -1937,14 +1937,14 @@ bool valueCompareLLSD(const LLSD& lhs, const LLSD& rhs) { if (!lhs.has(ritt->first)) { - return FALSE; + return false; } if (!valueCompareLLSD(lhs[ritt->first], ritt->second)) { - return FALSE; + return false; } } - return TRUE; + return true; } else if (lhs.isArray()) { @@ -1956,7 +1956,7 @@ bool valueCompareLLSD(const LLSD& lhs, const LLSD& rhs) { if (!valueCompareLLSD(*ritt, *litt)) { - return FALSE; + return false; } ritt++; } diff --git a/indra/newview/llsechandler_basic.h b/indra/newview/llsechandler_basic.h index b4108d0c0e..1484c6d0e1 100644 --- a/indra/newview/llsechandler_basic.h +++ b/indra/newview/llsechandler_basic.h @@ -138,7 +138,7 @@ public: virtual iterator find(const LLSD& params); // return the number of certs in the store - virtual int size() const { return mCerts.size(); } + virtual int size() const { return static_cast<int>(mCerts.size()); } // insert the cert to the store. if a copy of the cert already exists in the store, it is removed first virtual void add(LLPointer<LLCertificate> cert) { insert(end(), cert); } diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 870cd394ee..aed35939a6 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -112,14 +112,14 @@ const S32 MAX_CHILDREN_PER_TASK = 255; // Globals // -//BOOL gDebugSelectMgr = FALSE; +//bool gDebugSelectMgr = false; -//BOOL gHideSelectedObjects = FALSE; -//BOOL gAllowSelectAvatar = FALSE; +//bool gHideSelectedObjects = false; +//bool gAllowSelectAvatar = false; -BOOL LLSelectMgr::sRectSelectInclusive = TRUE; -BOOL LLSelectMgr::sRenderHiddenSelections = TRUE; -BOOL LLSelectMgr::sRenderLightRadius = FALSE; +bool LLSelectMgr::sRectSelectInclusive = true; +bool LLSelectMgr::sRenderHiddenSelections = true; +bool LLSelectMgr::sRenderLightRadius = false; F32 LLSelectMgr::sHighlightThickness = 0.f; F32 LLSelectMgr::sHighlightUScale = 0.f; F32 LLSelectMgr::sHighlightVScale = 0.f; @@ -213,12 +213,12 @@ void LLSelectMgr::cleanupGlobals() // LLSelectMgr() //----------------------------------------------------------------------------- LLSelectMgr::LLSelectMgr() - : mHideSelectedObjects(LLCachedControl<bool>(gSavedSettings, "HideSelectedObjects", FALSE)), - mRenderHighlightSelections(LLCachedControl<bool>(gSavedSettings, "RenderHighlightSelections", TRUE)), - mAllowSelectAvatar( LLCachedControl<bool>(gSavedSettings, "AllowSelectAvatar", FALSE)), - mDebugSelectMgr(LLCachedControl<bool>(gSavedSettings, "DebugSelectMgr", FALSE)) + : mHideSelectedObjects(LLCachedControl<bool>(gSavedSettings, "HideSelectedObjects", false)), + mRenderHighlightSelections(LLCachedControl<bool>(gSavedSettings, "RenderHighlightSelections", true)), + mAllowSelectAvatar( LLCachedControl<bool>(gSavedSettings, "AllowSelectAvatar", false)), + mDebugSelectMgr(LLCachedControl<bool>(gSavedSettings, "DebugSelectMgr", false)) { - mTEMode = FALSE; + mTEMode = false; mTextureChannel = LLRender::DIFFUSE_MAP; mLastCameraPos.clearVec(); @@ -239,7 +239,7 @@ LLSelectMgr::LLSelectMgr() sRenderLightRadius = gSavedSettings.getBOOL("RenderLightRadius"); - mRenderSilhouettes = TRUE; + mRenderSilhouettes = true; mGridMode = GRID_MODE_WORLD; gSavedSettings.setS32("GridMode", (S32)GRID_MODE_WORLD); @@ -248,8 +248,8 @@ LLSelectMgr::LLSelectMgr() mHoverObjects = new LLObjectSelection(); mHighlightedObjects = new LLObjectSelection(); - mForceSelection = FALSE; - mShowSelection = FALSE; + mForceSelection = false; + mShowSelection = false; } @@ -481,7 +481,7 @@ LLObjectSelectionHandle LLSelectMgr::selectObjectOnly(LLViewerObject* object, S3 // Place it in the list and tag it. // This will refresh dialogs. - addAsIndividual(object, face, TRUE, gltf_node, gltf_primitive); + addAsIndividual(object, face, true, gltf_node, gltf_primitive); // Stop the object from moving (this anticipates changes on the // simulator in LLTask::userSelect) @@ -519,7 +519,7 @@ LLObjectSelectionHandle LLSelectMgr::selectObjectOnly(LLViewerObject* object, S3 //----------------------------------------------------------------------------- // Select the object, parents and children. //----------------------------------------------------------------------------- -LLObjectSelectionHandle LLSelectMgr::selectObjectAndFamily(LLViewerObject* obj, BOOL add_to_end, BOOL ignore_select_owned) +LLObjectSelectionHandle LLSelectMgr::selectObjectAndFamily(LLViewerObject* obj, bool add_to_end, bool ignore_select_owned) { llassert( obj ); @@ -582,7 +582,7 @@ LLObjectSelectionHandle LLSelectMgr::selectObjectAndFamily(LLViewerObject* obj, // leave component mode if (gSavedSettings.getBOOL("EditLinkedParts")) { - gSavedSettings.setBOOL("EditLinkedParts", FALSE); + gSavedSettings.setBOOL("EditLinkedParts", false); promoteSelectionToRoot(); } @@ -600,7 +600,7 @@ LLObjectSelectionHandle LLSelectMgr::selectObjectAndFamily(LLViewerObject* obj, // Select the object, parents and children. //----------------------------------------------------------------------------- LLObjectSelectionHandle LLSelectMgr::selectObjectAndFamily(const std::vector<LLViewerObject*>& object_list, - BOOL send_to_sim) + bool send_to_sim) { // Collect all of the objects, children included std::vector<LLViewerObject*> objects; @@ -652,7 +652,7 @@ LLObjectSelectionHandle LLSelectMgr::selectObjectAndFamily(const std::vector<LLV // leave component mode if (gSavedSettings.getBOOL("EditLinkedParts")) { - gSavedSettings.setBOOL("EditLinkedParts", FALSE); + gSavedSettings.setBOOL("EditLinkedParts", false); promoteSelectionToRoot(); } @@ -670,9 +670,9 @@ LLObjectSelectionHandle LLSelectMgr::selectObjectAndFamily(const std::vector<LLV // handles informing the current tool of the object's deletion. // // Caller needs to call dialog_refresh_all if necessary. -BOOL LLSelectMgr::removeObjectFromSelections(const LLUUID &id) +bool LLSelectMgr::removeObjectFromSelections(const LLUUID &id) { - BOOL object_found = FALSE; + bool object_found = false; LLTool *tool = NULL; tool = LLToolMgr::getInstance()->getCurrentTool(); @@ -682,7 +682,7 @@ BOOL LLSelectMgr::removeObjectFromSelections(const LLUUID &id) if( tool_editing_object && tool_editing_object->mID == id) { tool->stopEditing(); - object_found = TRUE; + object_found = true; } // Iterate through selected objects list and kill the object @@ -701,15 +701,15 @@ BOOL LLSelectMgr::removeObjectFromSelections(const LLUUID &id) } // lose the selection, don't tell simulator, it knows - deselectObjectAndFamily(object, FALSE); - object_found = TRUE; + deselectObjectAndFamily(object, false); + object_found = true; break; // must break here, may have removed multiple objects from list } else if (object->isAvatar() && object->getParent() && ((LLViewerObject*)object->getParent())->mID == id) { // It's possible the item being removed has an avatar sitting on it // So remove the avatar that is sitting on the object. - deselectObjectAndFamily(object, FALSE); + deselectObjectAndFamily(object, false); break; // must break here, may have removed multiple objects from list } } @@ -862,7 +862,7 @@ bool LLSelectMgr::enableUnlinkObjects() return new_value; } -void LLSelectMgr::deselectObjectAndFamily(LLViewerObject* object, BOOL send_to_sim, BOOL include_entire_object) +void LLSelectMgr::deselectObjectAndFamily(LLViewerObject* object, bool send_to_sim, bool include_entire_object) { // bail if nothing selected or if object wasn't selected in the first place if(!object) return; @@ -904,7 +904,7 @@ void LLSelectMgr::deselectObjectAndFamily(LLViewerObject* object, BOOL send_to_s //----------------------------------------------------------- LLViewerRegion* regionp = object->getRegion(); - BOOL start_new_message = TRUE; + bool start_new_message = true; S32 select_count = 0; LLMessageSystem* msg = gMessageSystem; @@ -917,7 +917,7 @@ void LLSelectMgr::deselectObjectAndFamily(LLViewerObject* object, BOOL send_to_s msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); select_count++; - start_new_message = FALSE; + start_new_message = false; } msg->nextBlockFast(_PREHASH_ObjectData); @@ -932,7 +932,7 @@ void LLSelectMgr::deselectObjectAndFamily(LLViewerObject* object, BOOL send_to_s { msg->sendReliable(regionp->getHost() ); select_count = 0; - start_new_message = TRUE; + start_new_message = true; } } @@ -945,7 +945,7 @@ void LLSelectMgr::deselectObjectAndFamily(LLViewerObject* object, BOOL send_to_s updateSelectionCenter(); } -void LLSelectMgr::deselectObjectOnly(LLViewerObject* object, BOOL send_to_sim) +void LLSelectMgr::deselectObjectOnly(LLViewerObject* object, bool send_to_sim) { // bail if nothing selected or if object wasn't selected in the first place if (!object) return; @@ -979,7 +979,7 @@ void LLSelectMgr::deselectObjectOnly(LLViewerObject* object, BOOL send_to_sim) // addAsFamily //----------------------------------------------------------------------------- -void LLSelectMgr::addAsFamily(std::vector<LLViewerObject*>& objects, BOOL add_to_end) +void LLSelectMgr::addAsFamily(std::vector<LLViewerObject*>& objects, bool add_to_end) { for (std::vector<LLViewerObject*>::iterator iter = objects.begin(); iter != objects.end(); ++iter) @@ -995,7 +995,7 @@ void LLSelectMgr::addAsFamily(std::vector<LLViewerObject*>& objects, BOOL add_to if (!objectp->isSelected()) { - LLSelectNode *nodep = new LLSelectNode(objectp, TRUE); + LLSelectNode *nodep = new LLSelectNode(objectp, true); if (add_to_end) { mSelectedObjects->addNodeAtEnd(nodep); @@ -1004,11 +1004,11 @@ void LLSelectMgr::addAsFamily(std::vector<LLViewerObject*>& objects, BOOL add_to { mSelectedObjects->addNode(nodep); } - objectp->setSelected(TRUE); + objectp->setSelected(true); if (objectp->getNumTEs() > 0) { - nodep->selectAllTEs(TRUE); + nodep->selectAllTEs(true); objectp->setAllTESelected(true); } else @@ -1023,7 +1023,7 @@ void LLSelectMgr::addAsFamily(std::vector<LLViewerObject*>& objects, BOOL add_to LLSelectNode* select_node = mSelectedObjects->findNode(objectp); if (select_node) { - select_node->setTransient(FALSE); + select_node->setTransient(false); } } } @@ -1033,7 +1033,7 @@ void LLSelectMgr::addAsFamily(std::vector<LLViewerObject*>& objects, BOOL add_to //----------------------------------------------------------------------------- // addAsIndividual() - a single object, face, etc //----------------------------------------------------------------------------- -void LLSelectMgr::addAsIndividual(LLViewerObject *objectp, S32 face, BOOL undoable, S32 gltf_node, S32 gltf_primitive) +void LLSelectMgr::addAsIndividual(LLViewerObject *objectp, S32 face, bool undoable, S32 gltf_node, S32 gltf_primitive) { // check to see if object is already in list LLSelectNode *nodep = mSelectedObjects->findNode(objectp); @@ -1041,23 +1041,23 @@ void LLSelectMgr::addAsIndividual(LLViewerObject *objectp, S32 face, BOOL undoab // if not in list, add it if (!nodep) { - nodep = new LLSelectNode(objectp, TRUE); + nodep = new LLSelectNode(objectp, true); mSelectedObjects->addNode(nodep); llassert_always(nodep->getObject()); } else { // make this a full-fledged selection - nodep->setTransient(FALSE); + nodep->setTransient(false); // Move it to the front of the list mSelectedObjects->moveNodeToFront(nodep); } // Make sure the object is tagged as selected - objectp->setSelected( TRUE ); + objectp->setSelected( true ); // And make sure we don't consider it as part of a family - nodep->mIndividualSelection = TRUE; + nodep->mIndividualSelection = true; // Handle face selection if (objectp->getNumTEs() <= 0) @@ -1066,12 +1066,12 @@ void LLSelectMgr::addAsIndividual(LLViewerObject *objectp, S32 face, BOOL undoab } else if (face == SELECT_ALL_TES) { - nodep->selectAllTEs(TRUE); + nodep->selectAllTEs(true); objectp->setAllTESelected(true); } else if (0 <= face && face < SELECT_MAX_TES) { - nodep->selectTE(face, TRUE); + nodep->selectTE(face, true); objectp->setTESelected(face, true); } else @@ -1083,7 +1083,7 @@ void LLSelectMgr::addAsIndividual(LLViewerObject *objectp, S32 face, BOOL undoab // Handle glTF node selection if (gltf_node >= 0) { - nodep->selectGLTFNode(gltf_node, gltf_primitive, TRUE); + nodep->selectGLTFNode(gltf_node, gltf_primitive, true); } @@ -1138,8 +1138,8 @@ LLObjectSelectionHandle LLSelectMgr::setHoverObject(LLViewerObject *objectp, S32 { continue; } - LLSelectNode* nodep = new LLSelectNode(cur_objectp, FALSE); - nodep->selectTE(face, TRUE); + LLSelectNode* nodep = new LLSelectNode(cur_objectp, false); + nodep->selectTE(face, true); mHoverObjects->addNodeAtEnd(nodep); } @@ -1302,7 +1302,7 @@ LLObjectSelectionHandle LLSelectMgr::selectHighlightedObjects() mSelectedObjects->addNode(new_nodep); // flag this object as selected - objectp->setSelected(TRUE); + objectp->setSelected(true); objectp->setAllTESelected(true); mSelectedObjects->mSelectType = getSelectTypeForObject(objectp); @@ -1331,7 +1331,7 @@ LLObjectSelectionHandle LLSelectMgr::selectHighlightedObjects() void LLSelectMgr::deselectHighlightedObjects() { - BOOL select_linked_set = !gSavedSettings.getBOOL("EditLinkedParts"); + bool select_linked_set = !gSavedSettings.getBOOL("EditLinkedParts"); for (std::set<LLPointer<LLViewerObject> >::iterator iter = mRectSelectedObjects.begin(); iter != mRectSelectedObjects.end(); iter++) { @@ -1355,7 +1355,7 @@ void LLSelectMgr::deselectHighlightedObjects() void LLSelectMgr::addGridObject(LLViewerObject* objectp) { - LLSelectNode* nodep = new LLSelectNode(objectp, FALSE); + LLSelectNode* nodep = new LLSelectNode(objectp, false); mGridObjects.addNodeAtEnd(nodep); LLViewerObject::const_child_list_t& child_list = objectp->getChildren(); @@ -1363,7 +1363,7 @@ void LLSelectMgr::addGridObject(LLViewerObject* objectp) iter != child_list.end(); iter++) { LLViewerObject* child = *iter; - nodep = new LLSelectNode(child, FALSE); + nodep = new LLSelectNode(child, false); mGridObjects.addNodeAtEnd(nodep); } } @@ -1417,7 +1417,7 @@ void LLSelectMgr::getGrid(LLVector3& origin, LLQuaternion &rotation, LLVector3 & LLVector4a min_extents(F32_MAX); LLVector4a max_extents(-F32_MAX); - BOOL grid_changed = FALSE; + bool grid_changed = false; for (LLObjectSelection::iterator iter = mGridObjects.begin(); iter != mGridObjects.end(); ++iter) { @@ -1428,7 +1428,7 @@ void LLSelectMgr::getGrid(LLVector3& origin, LLQuaternion &rotation, LLVector3 & const LLVector4a* ext = drawable->getSpatialExtents(); update_min_max(min_extents, max_extents, ext[0]); update_min_max(min_extents, max_extents, ext[1]); - grid_changed = TRUE; + grid_changed = true; } } if (grid_changed) @@ -1450,7 +1450,7 @@ void LLSelectMgr::getGrid(LLVector3& origin, LLQuaternion &rotation, LLVector3 & } else // GRID_MODE_WORLD or just plain default { - const BOOL non_root_ok = TRUE; + const bool non_root_ok = true; LLViewerObject* first_object = mSelectedObjects->getFirstRootObject(non_root_ok); mGridOrigin.clearVec(); @@ -1498,7 +1498,7 @@ void LLSelectMgr::remove(std::vector<LLViewerObject*>& objects) LLSelectNode* nodep = mSelectedObjects->findNode(objectp); if (nodep) { - objectp->setSelected(FALSE); + objectp->setSelected(false); mSelectedObjects->removeNode(nodep); nodep = NULL; } @@ -1511,7 +1511,7 @@ void LLSelectMgr::remove(std::vector<LLViewerObject*>& objects) //----------------------------------------------------------------------------- // remove() - a single object //----------------------------------------------------------------------------- -void LLSelectMgr::remove(LLViewerObject *objectp, S32 te, BOOL undoable) +void LLSelectMgr::remove(LLViewerObject *objectp, S32 te, bool undoable) { // get object node (and verify it is in the selected list) LLSelectNode *nodep = mSelectedObjects->findNode(objectp); @@ -1526,14 +1526,14 @@ void LLSelectMgr::remove(LLViewerObject *objectp, S32 te, BOOL undoable) // Remove all faces (or the object doesn't have faces) so remove the node mSelectedObjects->removeNode(nodep); nodep = NULL; - objectp->setSelected( FALSE ); + objectp->setSelected( false ); } else if (0 <= te && te < SELECT_MAX_TES) { // ...valid face, check to see if it was on if (nodep->isTESelected(te)) { - nodep->selectTE(te, FALSE); + nodep->selectTE(te, false); objectp->setTESelected(te, false); } else @@ -1543,7 +1543,7 @@ void LLSelectMgr::remove(LLViewerObject *objectp, S32 te, BOOL undoable) } // ...check to see if this operation turned off all faces - BOOL found = FALSE; + bool found = false; for (S32 i = 0; i < nodep->getObject()->getNumTEs(); i++) { found = found || nodep->isTESelected(i); @@ -1554,7 +1554,7 @@ void LLSelectMgr::remove(LLViewerObject *objectp, S32 te, BOOL undoable) { mSelectedObjects->removeNode(nodep); nodep = NULL; - objectp->setSelected( FALSE ); + objectp->setSelected( false ); // *FIXME: Doesn't update simulator that object is no longer selected } } @@ -1578,7 +1578,7 @@ void LLSelectMgr::removeAll() iter != mSelectedObjects->end(); iter++ ) { LLViewerObject *objectp = (*iter)->getObject(); - objectp->setSelected( FALSE ); + objectp->setSelected( false ); } mSelectedObjects->deleteAllNodes(); @@ -1594,7 +1594,7 @@ void LLSelectMgr::promoteSelectionToRoot() { std::set<LLViewerObject*> selection_set; - BOOL selection_changed = FALSE; + bool selection_changed = false; for (LLObjectSelection::iterator iter = getSelection()->begin(); iter != getSelection()->end(); ) @@ -1605,7 +1605,7 @@ void LLSelectMgr::promoteSelectionToRoot() if (nodep->mIndividualSelection) { - selection_changed = TRUE; + selection_changed = true; } LLViewerObject* parentp = object; @@ -1871,7 +1871,7 @@ bool LLSelectMgr::selectionSetImage(const LLUUID& imageid) if (mItem && objectp->isAttachment()) { const LLPermissions& perm = mItem->getPermissions(); - BOOL unrestricted = ((perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) ? TRUE : FALSE; + bool unrestricted = (perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED; if (!unrestricted) { // Attachments are in world and in inventory simultaneously, @@ -1894,7 +1894,7 @@ bool LLSelectMgr::selectionSetImage(const LLUUID& imageid) // Texture picker defaults aren't inventory items // * Don't need to worry about permissions for them // * Can just apply the texture and be done with it. - objectp->setTEImage(te, LLViewerTextureManager::getFetchedTexture(mImageID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); + objectp->setTEImage(te, LLViewerTextureManager::getFetchedTexture(mImageID, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); } return true; @@ -1922,7 +1922,7 @@ bool LLSelectMgr::selectionSetImage(const LLUUID& imageid) { object->sendTEUpdate(); // 1 particle effect per object - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, true); effectp->setSourceObject(gAgentAvatarp); effectp->setTargetObject(object); effectp->setDuration(LL_HUD_DUR_SHORT); @@ -2036,7 +2036,7 @@ bool LLSelectMgr::selectionSetGLTFMaterial(const LLUUID& mat_id) if (!mItem) { // 1 particle effect per object - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, true); effectp->setSourceObject(gAgentAvatarp); effectp->setTargetObject(object); effectp->setDuration(LL_HUD_DUR_SHORT); @@ -2194,7 +2194,7 @@ void LLSelectMgr::selectionRevertShinyColors() getSelection()->applyToObjects(&sendfunc); } -BOOL LLSelectMgr::selectionRevertTextures() +bool LLSelectMgr::selectionRevertTextures() { struct f : public LLSelectedTEFunctor { @@ -2212,11 +2212,11 @@ BOOL LLSelectMgr::selectionRevertTextures() if (id.isNull()) { // this was probably a no-copy texture, leave image as-is - return FALSE; + return false; } else { - object->setTEImage(te, LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); + object->setTEImage(te, LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); } } @@ -2224,7 +2224,7 @@ BOOL LLSelectMgr::selectionRevertTextures() return true; } } setfunc(mSelectedObjects); - BOOL revert_successful = getSelection()->applyToTEs(&setfunc); + bool revert_successful = getSelection()->applyToTEs(&setfunc); LLSelectMgrSendFunctor sendfunc; getSelection()->applyToObjects(&sendfunc); @@ -2299,6 +2299,7 @@ void LLSelectMgr::selectionSetBumpmap(U8 bumpmap, const LLUUID &image_id) LL_WARNS() << "Attempted to apply no-copy texture to multiple objects" << LL_ENDL; return; } + if (item && !item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID())) { LLViewerObject *object = mSelectedObjects->getFirstRootObject(); @@ -2307,8 +2308,8 @@ void LLSelectMgr::selectionSetBumpmap(U8 bumpmap, const LLUUID &image_id) return; } const LLPermissions& perm = item->getPermissions(); - BOOL unrestricted = ((perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) ? TRUE : FALSE; - BOOL attached = object->isAttachment(); + bool unrestricted = (perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED; + bool attached = object->isAttachment(); if (attached && !unrestricted) { // Attachments are in world and in inventory simultaneously, @@ -2371,6 +2372,7 @@ void LLSelectMgr::selectionSetShiny(U8 shiny, const LLUUID &image_id) LL_WARNS() << "Attempted to apply no-copy texture to multiple objects" << LL_ENDL; return; } + if (item && !item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID())) { LLViewerObject *object = mSelectedObjects->getFirstRootObject(); @@ -2379,8 +2381,8 @@ void LLSelectMgr::selectionSetShiny(U8 shiny, const LLUUID &image_id) return; } const LLPermissions& perm = item->getPermissions(); - BOOL unrestricted = ((perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) ? TRUE : FALSE; - BOOL attached = object->isAttachment(); + bool unrestricted = (perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED; + bool attached = object->isAttachment(); if (attached && !unrestricted) { // Attachments are in world and in inventory simultaneously, @@ -2645,9 +2647,9 @@ LLPermissions* LLSelectMgr::findObjectPermissions(const LLViewerObject* object) //----------------------------------------------------------------------------- // selectionGetGlow() //----------------------------------------------------------------------------- -BOOL LLSelectMgr::selectionGetGlow(F32 *glow) +bool LLSelectMgr::selectionGetGlow(F32 *glow) { - BOOL identical; + bool identical; F32 lglow = 0.f; struct f1 : public LLSelectedTEGetFunctor<F32> { @@ -2674,7 +2676,7 @@ void LLSelectMgr::selectionSetPhysicsType(U8 type) if (object->permModify()) { object->setPhysicsShapeType(mType); - object->updateFlags(TRUE); + object->updateFlags(true); } return true; } @@ -2693,7 +2695,7 @@ void LLSelectMgr::selectionSetFriction(F32 friction) if (object->permModify()) { object->setPhysicsFriction(mFriction); - object->updateFlags(TRUE); + object->updateFlags(true); } return true; } @@ -2712,7 +2714,7 @@ void LLSelectMgr::selectionSetGravity(F32 gravity ) if (object->permModify()) { object->setPhysicsGravity(mGravity); - object->updateFlags(TRUE); + object->updateFlags(true); } return true; } @@ -2731,7 +2733,7 @@ void LLSelectMgr::selectionSetDensity(F32 density ) if (object->permModify()) { object->setPhysicsDensity(mDensity); - object->updateFlags(TRUE); + object->updateFlags(true); } return true; } @@ -2750,7 +2752,7 @@ void LLSelectMgr::selectionSetRestitution(F32 restitution) if (object->permModify()) { object->setPhysicsRestitution(mRestitution); - object->updateFlags(TRUE); + object->updateFlags(true); } return true; } @@ -2783,8 +2785,8 @@ void LLSelectMgr::selectionSetMaterial(U8 material) getSelection()->applyToObjects(&sendfunc); } -// TRUE if all selected objects have this PCode -BOOL LLSelectMgr::selectionAllPCode(LLPCode code) +// true if all selected objects have this PCode +bool LLSelectMgr::selectionAllPCode(LLPCode code) { struct f : public LLSelectedObjectFunctor { @@ -2794,19 +2796,19 @@ BOOL LLSelectMgr::selectionAllPCode(LLPCode code) { if (object->getPCode() != mCode) { - return FALSE; + return false; } return true; } } func(code); - BOOL res = getSelection()->applyToObjects(&func); + bool res = getSelection()->applyToObjects(&func); return res; } bool LLSelectMgr::selectionGetIncludeInSearch(bool* include_in_search_out) { LLViewerObject *object = mSelectedObjects->getFirstRootObject(); - if (!object) return FALSE; + if (!object) return false; bool include_in_search = object->getIncludeInSearch(); @@ -2846,12 +2848,12 @@ void LLSelectMgr::selectionSetIncludeInSearch(bool include_in_search) SEND_ONLY_ROOTS); } -BOOL LLSelectMgr::selectionGetClickAction(U8 *out_action) +bool LLSelectMgr::selectionGetClickAction(U8 *out_action) { LLViewerObject *object = mSelectedObjects->getFirstObject(); if (!object) { - return FALSE; + return false; } U8 action = object->getClickAction(); @@ -2870,7 +2872,7 @@ BOOL LLSelectMgr::selectionGetClickAction(U8 *out_action) return true; } } func(action); - BOOL res = getSelection()->applyToObjects(&func); + bool res = getSelection()->applyToObjects(&func); return res; } @@ -2998,7 +3000,7 @@ void LLSelectMgr::selectionTexScaleAutofit(F32 repeats_per_meter) U32 s_axis, t_axis; if (!LLPrimitive::getTESTAxes(te, &s_axis, &t_axis)) { - return TRUE; + return true; } F32 new_s = object->getScale().mV[s_axis] * mRepeatsPerMeter; @@ -3023,7 +3025,7 @@ void LLSelectMgr::selectionTexScaleAutofit(F32 repeats_per_meter) //----------------------------------------------------------------------------- // adjustTexturesByScale() //----------------------------------------------------------------------------- -void LLSelectMgr::adjustTexturesByScale(BOOL send_to_sim, BOOL stretch) +void LLSelectMgr::adjustTexturesByScale(bool send_to_sim, bool stretch) { for (LLObjectSelection::iterator iter = getSelection()->begin(); iter != getSelection()->end(); iter++) @@ -3046,13 +3048,13 @@ void LLSelectMgr::adjustTexturesByScale(BOOL send_to_sim, BOOL stretch) continue; } - BOOL send = FALSE; + bool send = false; for (U8 te_num = 0; te_num < object->getNumTEs(); te_num++) { const LLTextureEntry* tep = object->getTE(te_num); - BOOL planar = tep->getTexGen() == LLTextureEntry::TEX_GEN_PLANAR; + bool planar = tep->getTexGen() == LLTextureEntry::TEX_GEN_PLANAR; if (planar == stretch) { // Figure out how S,T changed with scale operation @@ -3136,9 +3138,9 @@ void LLSelectMgr::adjustTexturesByScale(BOOL send_to_sim, BOOL stretch) //----------------------------------------------------------------------------- // selectGetAllRootsValid() -// Returns TRUE if the viewer has information on all selected objects +// Returns true if the viewer has information on all selected objects //----------------------------------------------------------------------------- -BOOL LLSelectMgr::selectGetAllRootsValid() +bool LLSelectMgr::selectGetAllRootsValid() { for (LLObjectSelection::root_iterator iter = getSelection()->root_begin(); iter != getSelection()->root_end(); ++iter ) @@ -3146,18 +3148,18 @@ BOOL LLSelectMgr::selectGetAllRootsValid() LLSelectNode* node = *iter; if( !node->mValid ) { - return FALSE; + return false; } } - return TRUE; + return true; } //----------------------------------------------------------------------------- // selectGetAllValid() -// Returns TRUE if the viewer has information on all selected objects +// Returns true if the viewer has information on all selected objects //----------------------------------------------------------------------------- -BOOL LLSelectMgr::selectGetAllValid() +bool LLSelectMgr::selectGetAllValid() { for (LLObjectSelection::iterator iter = getSelection()->begin(); iter != getSelection()->end(); ++iter ) @@ -3165,19 +3167,19 @@ BOOL LLSelectMgr::selectGetAllValid() LLSelectNode* node = *iter; if( !node->mValid ) { - return FALSE; + return false; } } - return TRUE; + return true; } //----------------------------------------------------------------------------- -// selectGetAllValidAndObjectsFound() - return TRUE if selections are +// selectGetAllValidAndObjectsFound() - return true if selections are // valid and objects are found. // // For EXT-3114 - same as selectGetModify() without the modify check. //----------------------------------------------------------------------------- -BOOL LLSelectMgr::selectGetAllValidAndObjectsFound() +bool LLSelectMgr::selectGetAllValidAndObjectsFound() { for (LLObjectSelection::iterator iter = getSelection()->begin(); iter != getSelection()->end(); iter++ ) @@ -3186,17 +3188,17 @@ BOOL LLSelectMgr::selectGetAllValidAndObjectsFound() LLViewerObject* object = node->getObject(); if( !object || !node->mValid ) { - return FALSE; + return false; } } - return TRUE; + return true; } //----------------------------------------------------------------------------- -// selectGetModify() - return TRUE if current agent can modify all +// selectGetModify() - return true if current agent can modify all // selected objects. //----------------------------------------------------------------------------- -BOOL LLSelectMgr::selectGetModify() +bool LLSelectMgr::selectGetModify() { for (LLObjectSelection::iterator iter = getSelection()->begin(); iter != getSelection()->end(); iter++ ) @@ -3205,21 +3207,21 @@ BOOL LLSelectMgr::selectGetModify() LLViewerObject* object = node->getObject(); if( !object || !node->mValid ) { - return FALSE; + return false; } if( !object->permModify() ) { - return FALSE; + return false; } } - return TRUE; + return true; } //----------------------------------------------------------------------------- -// selectGetRootsModify() - return TRUE if current agent can modify all +// selectGetRootsModify() - return true if current agent can modify all // selected root objects. //----------------------------------------------------------------------------- -BOOL LLSelectMgr::selectGetRootsModify() +bool LLSelectMgr::selectGetRootsModify() { for (LLObjectSelection::root_iterator iter = getSelection()->root_begin(); iter != getSelection()->root_end(); iter++ ) @@ -3228,30 +3230,30 @@ BOOL LLSelectMgr::selectGetRootsModify() LLViewerObject* object = node->getObject(); if( !node->mValid ) { - return FALSE; + return false; } if( !object->permModify() ) { - return FALSE; + return false; } } - return TRUE; + return true; } //----------------------------------------------------------------------------- -// selectGetSameRegion() - return TRUE if all objects are in same region +// selectGetSameRegion() - return true if all objects are in same region //----------------------------------------------------------------------------- -BOOL LLSelectMgr::selectGetSameRegion() +bool LLSelectMgr::selectGetSameRegion() { if (getSelection()->isEmpty()) { - return TRUE; + return true; } LLViewerObject* object = getSelection()->getFirstObject(); if (!object) { - return FALSE; + return false; } LLViewerRegion* current_region = object->getRegion(); @@ -3262,18 +3264,18 @@ BOOL LLSelectMgr::selectGetSameRegion() object = node->getObject(); if (!node->mValid || !object || current_region != object->getRegion()) { - return FALSE; + return false; } } - return TRUE; + return true; } //----------------------------------------------------------------------------- -// selectGetNonPermanentEnforced() - return TRUE if all objects are not +// selectGetNonPermanentEnforced() - return true if all objects are not // permanent enforced //----------------------------------------------------------------------------- -BOOL LLSelectMgr::selectGetNonPermanentEnforced() +bool LLSelectMgr::selectGetNonPermanentEnforced() { for (LLObjectSelection::iterator iter = getSelection()->begin(); iter != getSelection()->end(); iter++ ) @@ -3282,21 +3284,21 @@ BOOL LLSelectMgr::selectGetNonPermanentEnforced() LLViewerObject* object = node->getObject(); if( !object || !node->mValid ) { - return FALSE; + return false; } if( object->isPermanentEnforced()) { - return FALSE; + return false; } } - return TRUE; + return true; } //----------------------------------------------------------------------------- -// selectGetRootsNonPermanentEnforced() - return TRUE if all root objects are +// selectGetRootsNonPermanentEnforced() - return true if all root objects are // not permanent enforced //----------------------------------------------------------------------------- -BOOL LLSelectMgr::selectGetRootsNonPermanentEnforced() +bool LLSelectMgr::selectGetRootsNonPermanentEnforced() { for (LLObjectSelection::root_iterator iter = getSelection()->root_begin(); iter != getSelection()->root_end(); iter++ ) @@ -3305,21 +3307,21 @@ BOOL LLSelectMgr::selectGetRootsNonPermanentEnforced() LLViewerObject* object = node->getObject(); if( !node->mValid ) { - return FALSE; + return false; } if( object->isPermanentEnforced()) { - return FALSE; + return false; } } - return TRUE; + return true; } //----------------------------------------------------------------------------- -// selectGetPermanent() - return TRUE if all objects are permanent +// selectGetPermanent() - return true if all objects are permanent //----------------------------------------------------------------------------- -BOOL LLSelectMgr::selectGetPermanent() +bool LLSelectMgr::selectGetPermanent() { for (LLObjectSelection::iterator iter = getSelection()->begin(); iter != getSelection()->end(); iter++ ) @@ -3328,21 +3330,21 @@ BOOL LLSelectMgr::selectGetPermanent() LLViewerObject* object = node->getObject(); if( !object || !node->mValid ) { - return FALSE; + return false; } if( !object->flagObjectPermanent()) { - return FALSE; + return false; } } - return TRUE; + return true; } //----------------------------------------------------------------------------- -// selectGetRootsPermanent() - return TRUE if all root objects are +// selectGetRootsPermanent() - return true if all root objects are // permanent //----------------------------------------------------------------------------- -BOOL LLSelectMgr::selectGetRootsPermanent() +bool LLSelectMgr::selectGetRootsPermanent() { for (LLObjectSelection::root_iterator iter = getSelection()->root_begin(); iter != getSelection()->root_end(); iter++ ) @@ -3351,21 +3353,21 @@ BOOL LLSelectMgr::selectGetRootsPermanent() LLViewerObject* object = node->getObject(); if( !node->mValid ) { - return FALSE; + return false; } if( !object->flagObjectPermanent()) { - return FALSE; + return false; } } - return TRUE; + return true; } //----------------------------------------------------------------------------- -// selectGetCharacter() - return TRUE if all objects are character +// selectGetCharacter() - return true if all objects are character //----------------------------------------------------------------------------- -BOOL LLSelectMgr::selectGetCharacter() +bool LLSelectMgr::selectGetCharacter() { for (LLObjectSelection::iterator iter = getSelection()->begin(); iter != getSelection()->end(); iter++ ) @@ -3374,21 +3376,21 @@ BOOL LLSelectMgr::selectGetCharacter() LLViewerObject* object = node->getObject(); if( !object || !node->mValid ) { - return FALSE; + return false; } if( !object->flagCharacter()) { - return FALSE; + return false; } } - return TRUE; + return true; } //----------------------------------------------------------------------------- -// selectGetRootsCharacter() - return TRUE if all root objects are +// selectGetRootsCharacter() - return true if all root objects are // character //----------------------------------------------------------------------------- -BOOL LLSelectMgr::selectGetRootsCharacter() +bool LLSelectMgr::selectGetRootsCharacter() { for (LLObjectSelection::root_iterator iter = getSelection()->root_begin(); iter != getSelection()->root_end(); iter++ ) @@ -3397,21 +3399,21 @@ BOOL LLSelectMgr::selectGetRootsCharacter() LLViewerObject* object = node->getObject(); if( !node->mValid ) { - return FALSE; + return false; } if( !object->flagCharacter()) { - return FALSE; + return false; } } - return TRUE; + return true; } //----------------------------------------------------------------------------- -// selectGetNonPathfinding() - return TRUE if all objects are not pathfinding +// selectGetNonPathfinding() - return true if all objects are not pathfinding //----------------------------------------------------------------------------- -BOOL LLSelectMgr::selectGetNonPathfinding() +bool LLSelectMgr::selectGetNonPathfinding() { for (LLObjectSelection::iterator iter = getSelection()->begin(); iter != getSelection()->end(); iter++ ) @@ -3420,21 +3422,21 @@ BOOL LLSelectMgr::selectGetNonPathfinding() LLViewerObject* object = node->getObject(); if( !object || !node->mValid ) { - return FALSE; + return false; } if( object->flagObjectPermanent() || object->flagCharacter()) { - return FALSE; + return false; } } - return TRUE; + return true; } //----------------------------------------------------------------------------- -// selectGetRootsNonPathfinding() - return TRUE if all root objects are not +// selectGetRootsNonPathfinding() - return true if all root objects are not // pathfinding //----------------------------------------------------------------------------- -BOOL LLSelectMgr::selectGetRootsNonPathfinding() +bool LLSelectMgr::selectGetRootsNonPathfinding() { for (LLObjectSelection::root_iterator iter = getSelection()->root_begin(); iter != getSelection()->root_end(); iter++ ) @@ -3443,21 +3445,21 @@ BOOL LLSelectMgr::selectGetRootsNonPathfinding() LLViewerObject* object = node->getObject(); if( !node->mValid ) { - return FALSE; + return false; } if( object->flagObjectPermanent() || object->flagCharacter()) { - return FALSE; + return false; } } - return TRUE; + return true; } //----------------------------------------------------------------------------- -// selectGetNonPermanent() - return TRUE if all objects are not permanent +// selectGetNonPermanent() - return true if all objects are not permanent //----------------------------------------------------------------------------- -BOOL LLSelectMgr::selectGetNonPermanent() +bool LLSelectMgr::selectGetNonPermanent() { for (LLObjectSelection::iterator iter = getSelection()->begin(); iter != getSelection()->end(); iter++ ) @@ -3466,21 +3468,21 @@ BOOL LLSelectMgr::selectGetNonPermanent() LLViewerObject* object = node->getObject(); if( !object || !node->mValid ) { - return FALSE; + return false; } if( object->flagObjectPermanent()) { - return FALSE; + return false; } } - return TRUE; + return true; } //----------------------------------------------------------------------------- -// selectGetRootsNonPermanent() - return TRUE if all root objects are not +// selectGetRootsNonPermanent() - return true if all root objects are not // permanent //----------------------------------------------------------------------------- -BOOL LLSelectMgr::selectGetRootsNonPermanent() +bool LLSelectMgr::selectGetRootsNonPermanent() { for (LLObjectSelection::root_iterator iter = getSelection()->root_begin(); iter != getSelection()->root_end(); iter++ ) @@ -3489,21 +3491,21 @@ BOOL LLSelectMgr::selectGetRootsNonPermanent() LLViewerObject* object = node->getObject(); if( !node->mValid ) { - return FALSE; + return false; } if( object->flagObjectPermanent()) { - return FALSE; + return false; } } - return TRUE; + return true; } //----------------------------------------------------------------------------- -// selectGetNonCharacter() - return TRUE if all objects are not character +// selectGetNonCharacter() - return true if all objects are not character //----------------------------------------------------------------------------- -BOOL LLSelectMgr::selectGetNonCharacter() +bool LLSelectMgr::selectGetNonCharacter() { for (LLObjectSelection::iterator iter = getSelection()->begin(); iter != getSelection()->end(); iter++ ) @@ -3512,21 +3514,21 @@ BOOL LLSelectMgr::selectGetNonCharacter() LLViewerObject* object = node->getObject(); if( !object || !node->mValid ) { - return FALSE; + return false; } if( object->flagCharacter()) { - return FALSE; + return false; } } - return TRUE; + return true; } //----------------------------------------------------------------------------- -// selectGetRootsNonCharacter() - return TRUE if all root objects are not +// selectGetRootsNonCharacter() - return true if all root objects are not // character //----------------------------------------------------------------------------- -BOOL LLSelectMgr::selectGetRootsNonCharacter() +bool LLSelectMgr::selectGetRootsNonCharacter() { for (LLObjectSelection::root_iterator iter = getSelection()->root_begin(); iter != getSelection()->root_end(); iter++ ) @@ -3535,23 +3537,23 @@ BOOL LLSelectMgr::selectGetRootsNonCharacter() LLViewerObject* object = node->getObject(); if( !node->mValid ) { - return FALSE; + return false; } if( object->flagCharacter()) { - return FALSE; + return false; } } - return TRUE; + return true; } //----------------------------------------------------------------------------- -// selectGetEditableLinksets() - return TRUE if all objects are editable +// selectGetEditableLinksets() - return true if all objects are editable // pathfinding linksets //----------------------------------------------------------------------------- -BOOL LLSelectMgr::selectGetEditableLinksets() +bool LLSelectMgr::selectGetEditableLinksets() { for (LLObjectSelection::iterator iter = getSelection()->begin(); iter != getSelection()->end(); iter++ ) @@ -3560,7 +3562,7 @@ BOOL LLSelectMgr::selectGetEditableLinksets() LLViewerObject* object = node->getObject(); if( !object || !node->mValid ) { - return FALSE; + return false; } if (object->flagUsePhysics() || object->flagTemporaryOnRez() || @@ -3573,17 +3575,17 @@ BOOL LLSelectMgr::selectGetEditableLinksets() !object->permYouOwner() && !object->permMove())) { - return FALSE; + return false; } } - return TRUE; + return true; } //----------------------------------------------------------------------------- -// selectGetViewableCharacters() - return TRUE if all objects are characters +// selectGetViewableCharacters() - return true if all objects are characters // viewable within the pathfinding characters floater //----------------------------------------------------------------------------- -BOOL LLSelectMgr::selectGetViewableCharacters() +bool LLSelectMgr::selectGetViewableCharacters() { for (LLObjectSelection::iterator iter = getSelection()->begin(); iter != getSelection()->end(); iter++ ) @@ -3592,22 +3594,22 @@ BOOL LLSelectMgr::selectGetViewableCharacters() LLViewerObject* object = node->getObject(); if( !object || !node->mValid ) { - return FALSE; + return false; } if( !object->flagCharacter() || (object->getRegion() != gAgent.getRegion())) { - return FALSE; + return false; } } - return TRUE; + return true; } //----------------------------------------------------------------------------- -// selectGetRootsTransfer() - return TRUE if current agent can transfer all +// selectGetRootsTransfer() - return true if current agent can transfer all // selected root objects. //----------------------------------------------------------------------------- -BOOL LLSelectMgr::selectGetRootsTransfer() +bool LLSelectMgr::selectGetRootsTransfer() { for (LLObjectSelection::root_iterator iter = getSelection()->root_begin(); iter != getSelection()->root_end(); iter++ ) @@ -3616,21 +3618,21 @@ BOOL LLSelectMgr::selectGetRootsTransfer() LLViewerObject* object = node->getObject(); if( !node->mValid ) { - return FALSE; + return false; } if(!object->permTransfer()) { - return FALSE; + return false; } } - return TRUE; + return true; } //----------------------------------------------------------------------------- -// selectGetRootsCopy() - return TRUE if current agent can copy all +// selectGetRootsCopy() - return true if current agent can copy all // selected root objects. //----------------------------------------------------------------------------- -BOOL LLSelectMgr::selectGetRootsCopy() +bool LLSelectMgr::selectGetRootsCopy() { for (LLObjectSelection::root_iterator iter = getSelection()->root_begin(); iter != getSelection()->root_end(); iter++ ) @@ -3639,14 +3641,14 @@ BOOL LLSelectMgr::selectGetRootsCopy() LLViewerObject* object = node->getObject(); if( !node->mValid ) { - return FALSE; + return false; } if(!object->permCopy()) { - return FALSE; + return false; } } - return TRUE; + return true; } struct LLSelectGetFirstTest @@ -3729,7 +3731,7 @@ protected: } }; -BOOL LLSelectMgr::selectGetCreator(LLUUID& result_id, std::string& name) +bool LLSelectMgr::selectGetCreator(LLUUID& result_id, std::string& name) { LLSelectGetFirstCreator test; getFirst(&test); @@ -3737,7 +3739,7 @@ BOOL LLSelectMgr::selectGetCreator(LLUUID& result_id, std::string& name) if (test.mFirstValue.isNull()) { name = LLTrans::getString("AvatarNameNobody"); - return FALSE; + return false; } result_id = test.mFirstValue; @@ -3769,14 +3771,14 @@ protected: } }; -BOOL LLSelectMgr::selectGetOwner(LLUUID& result_id, std::string& name) +bool LLSelectMgr::selectGetOwner(LLUUID& result_id, std::string& name) { LLSelectGetFirstOwner test; getFirst(&test); if (test.mFirstValue.isNull()) { - return FALSE; + return false; } result_id = test.mFirstValue; @@ -3814,14 +3816,14 @@ protected: } }; -BOOL LLSelectMgr::selectGetLastOwner(LLUUID& result_id, std::string& name) +bool LLSelectMgr::selectGetLastOwner(LLUUID& result_id, std::string& name) { LLSelectGetFirstLastOwner test; getFirst(&test); if (test.mFirstValue.isNull()) { - return FALSE; + return false; } result_id = test.mFirstValue; @@ -3851,7 +3853,7 @@ protected: } }; -BOOL LLSelectMgr::selectGetGroup(LLUUID& result_id) +bool LLSelectMgr::selectGetGroup(LLUUID& result_id) { LLSelectGetFirstGroup test; getFirst(&test); @@ -3863,7 +3865,7 @@ BOOL LLSelectMgr::selectGetGroup(LLUUID& result_id) //----------------------------------------------------------------------------- // selectIsGroupOwned() // Only operates on root nodes unless editing linked parts. -// Returns TRUE if the first selected is group owned. +// Returns true if the first selected is group owned. //----------------------------------------------------------------------------- struct LLSelectGetFirstGroupOwner : public LLSelectGetFirstTest { @@ -3878,29 +3880,29 @@ protected: } }; -BOOL LLSelectMgr::selectIsGroupOwned() +bool LLSelectMgr::selectIsGroupOwned() { LLSelectGetFirstGroupOwner test; getFirst(&test); - return test.mFirstValue.notNull() ? TRUE : FALSE; + return test.mFirstValue.notNull(); } //----------------------------------------------------------------------------- // selectGetPerm() // Only operates on root nodes. -// Returns TRUE if all have valid data. -// mask_on has bits set to TRUE where all permissions are TRUE -// mask_off has bits set to TRUE where all permissions are FALSE +// Returns true if all have valid data. +// mask_on has bits set to true where all permissions are true +// mask_off has bits set to true where all permissions are false // if a bit is off both in mask_on and mask_off, the values differ within // the selection. //----------------------------------------------------------------------------- -BOOL LLSelectMgr::selectGetPerm(U8 which_perm, U32* mask_on, U32* mask_off) +bool LLSelectMgr::selectGetPerm(U8 which_perm, U32* mask_on, U32* mask_off) { U32 mask; U32 mask_and = 0xffffffff; U32 mask_or = 0x00000000; - BOOL all_valid = FALSE; + bool all_valid = false; for (LLObjectSelection::root_iterator iter = getSelection()->root_begin(); iter != getSelection()->root_end(); iter++) @@ -3909,11 +3911,11 @@ BOOL LLSelectMgr::selectGetPerm(U8 which_perm, U32* mask_on, U32* mask_off) if (!node->mValid) { - all_valid = FALSE; + all_valid = false; break; } - all_valid = TRUE; + all_valid = true; switch( which_perm ) { @@ -3942,26 +3944,26 @@ BOOL LLSelectMgr::selectGetPerm(U8 which_perm, U32* mask_on, U32* mask_off) if (all_valid) { - // ...TRUE through all ANDs means all TRUE + // ...true through all ANDs means all true *mask_on = mask_and; - // ...FALSE through all ORs means all FALSE + // ...false through all ORs means all false *mask_off = ~mask_or; - return TRUE; + return true; } else { *mask_on = 0; *mask_off = 0; - return FALSE; + return false; } } -BOOL LLSelectMgr::selectGetPermissions(LLPermissions& result_perm) +bool LLSelectMgr::selectGetPermissions(LLPermissions& result_perm) { - BOOL first = TRUE; + bool first = true; LLPermissions perm; for (LLObjectSelection::root_iterator iter = getSelection()->root_begin(); iter != getSelection()->root_end(); iter++ ) @@ -3969,13 +3971,13 @@ BOOL LLSelectMgr::selectGetPermissions(LLPermissions& result_perm) LLSelectNode* node = *iter; if (!node->mValid) { - return FALSE; + return false; } if (first) { perm = *(node->mPermissions); - first = FALSE; + first = false; } else { @@ -3985,7 +3987,7 @@ BOOL LLSelectMgr::selectGetPermissions(LLPermissions& result_perm) result_perm = perm; - return TRUE; + return true; } @@ -3993,9 +3995,9 @@ void LLSelectMgr::selectDelete() { S32 deleteable_count = 0; - BOOL locked_but_deleteable_object = FALSE; - BOOL no_copy_but_deleteable_object = FALSE; - BOOL all_owned_by_you = TRUE; + bool locked_but_deleteable_object = false; + bool no_copy_but_deleteable_object = false; + bool all_owned_by_you = true; for (LLObjectSelection::iterator iter = getSelection()->begin(); iter != getSelection()->end(); iter++) @@ -4012,15 +4014,15 @@ void LLSelectMgr::selectDelete() // Check to see if you can delete objects which are locked. if(!obj->permMove()) { - locked_but_deleteable_object = TRUE; + locked_but_deleteable_object = true; } if(!obj->permCopy()) { - no_copy_but_deleteable_object = TRUE; + no_copy_but_deleteable_object = true; } if(!obj->permYouOwner()) { - all_owned_by_you = FALSE; + all_owned_by_you = false; } } @@ -4115,7 +4117,7 @@ bool LLSelectMgr::confirmDelete(const LLSD& notification, const LLSD& response, // VEFFECT: Delete Object - one effect for all deletes if (LLSelectMgr::getInstance()->mSelectedObjects->mSelectType != SELECT_TYPE_HUD) { - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, true); effectp->setPositionGlobal( LLSelectMgr::getInstance()->getSelectionCenterGlobal() ); effectp->setColor(LLColor4U(gAgent.getEffectColor())); F32 duration = 0.5f; @@ -4144,11 +4146,11 @@ void LLSelectMgr::selectForceDelete() packDeleteHeader, packObjectLocalID, logNoOp, - (void*)TRUE, + (void*)true, SEND_ONLY_ROOTS); } -BOOL LLSelectMgr::selectGetEditMoveLinksetPermissions(bool &move, bool &modify) +bool LLSelectMgr::selectGetEditMoveLinksetPermissions(bool &move, bool &modify) { move = true; modify = true; @@ -4163,7 +4165,7 @@ BOOL LLSelectMgr::selectGetEditMoveLinksetPermissions(bool &move, bool &modify) { move = false; modify = false; - return FALSE; + return false; } LLViewerObject *root_object = object->getRootEdit(); @@ -4178,18 +4180,18 @@ BOOL LLSelectMgr::selectGetEditMoveLinksetPermissions(bool &move, bool &modify) modify = modify && object->permModify(); } - return TRUE; + return true; } void LLSelectMgr::selectGetAggregateSaleInfo(U32 &num_for_sale, - BOOL &is_for_sale_mixed, - BOOL &is_sale_price_mixed, + bool &is_for_sale_mixed, + bool &is_sale_price_mixed, S32 &total_sale_price, S32 &individual_sale_price) { num_for_sale = 0; - is_for_sale_mixed = FALSE; - is_sale_price_mixed = FALSE; + is_for_sale_mixed = false; + is_sale_price_mixed = false; total_sale_price = 0; individual_sale_price = 0; @@ -4199,21 +4201,21 @@ void LLSelectMgr::selectGetAggregateSaleInfo(U32 &num_for_sale, return; LLSelectNode *node = *(getSelection()->root_begin()); - const BOOL first_node_for_sale = node->mSaleInfo.isForSale(); + const bool first_node_for_sale = node->mSaleInfo.isForSale(); const S32 first_node_sale_price = node->mSaleInfo.getSalePrice(); for (LLObjectSelection::root_iterator iter = getSelection()->root_begin(); iter != getSelection()->root_end(); iter++) { LLSelectNode* node = *iter; - const BOOL node_for_sale = node->mSaleInfo.isForSale(); + const bool node_for_sale = node->mSaleInfo.isForSale(); const S32 node_sale_price = node->mSaleInfo.getSalePrice(); // Set mixed if the fields don't match the first node's fields. if (node_for_sale != first_node_for_sale) - is_for_sale_mixed = TRUE; + is_for_sale_mixed = true; if (node_sale_price != first_node_sale_price) - is_sale_price_mixed = TRUE; + is_sale_price_mixed = true; if (node_for_sale) { @@ -4225,16 +4227,16 @@ void LLSelectMgr::selectGetAggregateSaleInfo(U32 &num_for_sale, individual_sale_price = first_node_sale_price; if (is_for_sale_mixed) { - is_sale_price_mixed = TRUE; + is_sale_price_mixed = true; individual_sale_price = 0; } } -// returns TRUE if all nodes are valid. method also stores an +// returns true if all nodes are valid. method also stores an // accumulated sale info. -BOOL LLSelectMgr::selectGetSaleInfo(LLSaleInfo& result_sale_info) +bool LLSelectMgr::selectGetSaleInfo(LLSaleInfo& result_sale_info) { - BOOL first = TRUE; + bool first = true; LLSaleInfo sale_info; for (LLObjectSelection::root_iterator iter = getSelection()->root_begin(); iter != getSelection()->root_end(); iter++ ) @@ -4242,13 +4244,13 @@ BOOL LLSelectMgr::selectGetSaleInfo(LLSaleInfo& result_sale_info) LLSelectNode* node = *iter; if (!node->mValid) { - return FALSE; + return false; } if (first) { sale_info = node->mSaleInfo; - first = FALSE; + first = false; } else { @@ -4258,12 +4260,12 @@ BOOL LLSelectMgr::selectGetSaleInfo(LLSaleInfo& result_sale_info) result_sale_info = sale_info; - return TRUE; + return true; } -BOOL LLSelectMgr::selectGetAggregatePermissions(LLAggregatePermissions& result_perm) +bool LLSelectMgr::selectGetAggregatePermissions(LLAggregatePermissions& result_perm) { - BOOL first = TRUE; + bool first = true; LLAggregatePermissions perm; for (LLObjectSelection::root_iterator iter = getSelection()->root_begin(); iter != getSelection()->root_end(); iter++ ) @@ -4271,13 +4273,13 @@ BOOL LLSelectMgr::selectGetAggregatePermissions(LLAggregatePermissions& result_p LLSelectNode* node = *iter; if (!node->mValid) { - return FALSE; + return false; } if (first) { perm = node->mAggregatePerm; - first = FALSE; + first = false; } else { @@ -4287,12 +4289,12 @@ BOOL LLSelectMgr::selectGetAggregatePermissions(LLAggregatePermissions& result_p result_perm = perm; - return TRUE; + return true; } -BOOL LLSelectMgr::selectGetAggregateTexturePermissions(LLAggregatePermissions& result_perm) +bool LLSelectMgr::selectGetAggregateTexturePermissions(LLAggregatePermissions& result_perm) { - BOOL first = TRUE; + bool first = true; LLAggregatePermissions perm; for (LLObjectSelection::root_iterator iter = getSelection()->root_begin(); iter != getSelection()->root_end(); iter++ ) @@ -4300,14 +4302,14 @@ BOOL LLSelectMgr::selectGetAggregateTexturePermissions(LLAggregatePermissions& r LLSelectNode* node = *iter; if (!node->mValid) { - return FALSE; + return false; } LLAggregatePermissions t_perm = node->getObject()->permYouOwner() ? node->mAggregateTexturePermOwner : node->mAggregateTexturePerm; if (first) { perm = t_perm; - first = FALSE; + first = false; } else { @@ -4317,19 +4319,19 @@ BOOL LLSelectMgr::selectGetAggregateTexturePermissions(LLAggregatePermissions& r result_perm = perm; - return TRUE; + return true; } -BOOL LLSelectMgr::isMovableAvatarSelected() +bool LLSelectMgr::isMovableAvatarSelected() { if (mAllowSelectAvatar && getSelection()->getObjectCount() == 1) { // nothing but avatar should be selected, so check that // there is only one selected object and it is a root LLViewerObject* obj = getSelection()->getFirstRootObject(); - return obj && obj->isAvatar() && getSelection()->getFirstMoveableNode(TRUE); + return obj && obj->isAvatar() && getSelection()->getFirstMoveableNode(true); } - return FALSE; + return false; } //-------------------------------------------------------------------- @@ -4345,7 +4347,7 @@ struct LLDuplicateData U32 flags; }; -void LLSelectMgr::selectDuplicate(const LLVector3& offset, BOOL select_copy) +void LLSelectMgr::selectDuplicate(const LLVector3& offset, bool select_copy) { if (mSelectedObjects->isAttachment()) { @@ -4382,7 +4384,7 @@ void LLSelectMgr::selectDuplicate(const LLVector3& offset, BOOL select_copy) iter != getSelection()->root_end(); iter++ ) { LLSelectNode* node = *iter; - node->mDuplicated = TRUE; + node->mDuplicated = true; node->mDuplicatePos = node->getObject()->getPositionGlobal(); node->mDuplicateRot = node->getObject()->getRotation(); } @@ -4467,22 +4469,22 @@ struct LLDuplicateOnRayData { LLVector3 mRayStartRegion; LLVector3 mRayEndRegion; - BOOL mBypassRaycast; - BOOL mRayEndIsIntersection; + bool mBypassRaycast; + bool mRayEndIsIntersection; LLUUID mRayTargetID; - BOOL mCopyCenters; - BOOL mCopyRotates; + bool mCopyCenters; + bool mCopyRotates; U32 mFlags; }; void LLSelectMgr::selectDuplicateOnRay(const LLVector3 &ray_start_region, const LLVector3 &ray_end_region, - BOOL bypass_raycast, - BOOL ray_end_is_intersection, + bool bypass_raycast, + bool ray_end_is_intersection, const LLUUID &ray_target_id, - BOOL copy_centers, - BOOL copy_rotates, - BOOL select_copy) + bool copy_centers, + bool copy_rotates, + bool select_copy) { if (mSelectedObjects->isAttachment()) { @@ -4604,12 +4606,12 @@ struct LLOwnerData { LLUUID owner_id; LLUUID group_id; - BOOL override; + bool override; }; void LLSelectMgr::sendOwner(const LLUUID& owner_id, const LLUUID& group_id, - BOOL override) + bool override) { LLOwnerData data; @@ -4691,16 +4693,16 @@ void LLSelectMgr::packBuyObjectIDs(LLSelectNode* node, void* data) struct LLPermData { U8 mField; - BOOL mSet; + bool mSet; U32 mMask; - BOOL mOverride; + bool mOverride; }; // TODO: Make this able to fail elegantly. void LLSelectMgr::selectionSetObjectPermissions(U8 field, - BOOL set, + bool set, U32 mask, - BOOL override) + bool override) { LLPermData data; @@ -4809,7 +4811,7 @@ void LLSelectMgr::convertTransient() for (node_it = mSelectedObjects->begin(); node_it != mSelectedObjects->end(); ++node_it) { LLSelectNode *nodep = *node_it; - nodep->setTransient(FALSE); + nodep->setTransient(false); } } @@ -4951,7 +4953,7 @@ void LLSelectMgr::sendAttach(LLObjectSelectionHandle selection_handle, U8 attach return; } - BOOL build_mode = LLToolMgr::getInstance()->inEdit(); + bool build_mode = LLToolMgr::getInstance()->inEdit(); // Special case: Attach to default location for this object. if (0 == attachment_point || get_if_there(gAgentAvatarp->mAttachmentPoints, (S32)attachment_point, (LLViewerJointAttachment*)NULL)) @@ -5185,7 +5187,7 @@ void LLSelectMgr::saveSelectedObjectTextures() { virtual bool apply(LLSelectNode* node) { - node->mValid = FALSE; + node->mValid = false; return true; } } func; @@ -5279,9 +5281,9 @@ void LLSelectMgr::saveSelectedObjectTransform(EActionType action_type) struct LLSelectMgrApplyFlags : public LLSelectedObjectFunctor { - LLSelectMgrApplyFlags(U32 flags, BOOL state) : mFlags(flags), mState(state) {} + LLSelectMgrApplyFlags(U32 flags, bool state) : mFlags(flags), mState(state) {} U32 mFlags; - BOOL mState; + bool mState; virtual bool apply(LLViewerObject* object) { if ( object->permModify()) @@ -5300,19 +5302,19 @@ struct LLSelectMgrApplyFlags : public LLSelectedObjectFunctor } }; -void LLSelectMgr::selectionUpdatePhysics(BOOL physics) +void LLSelectMgr::selectionUpdatePhysics(bool physics) { LLSelectMgrApplyFlags func( FLAGS_USE_PHYSICS, physics); getSelection()->applyToObjects(&func); } -void LLSelectMgr::selectionUpdateTemporary(BOOL is_temporary) +void LLSelectMgr::selectionUpdateTemporary(bool is_temporary) { LLSelectMgrApplyFlags func( FLAGS_TEMPORARY_ON_REZ, is_temporary); getSelection()->applyToObjects(&func); } -void LLSelectMgr::selectionUpdatePhantom(BOOL is_phantom) +void LLSelectMgr::selectionUpdatePhantom(bool is_phantom) { LLSelectMgrApplyFlags func( FLAGS_PHANTOM, is_phantom); getSelection()->applyToObjects(&func); @@ -5383,7 +5385,7 @@ void LLSelectMgr::packDuplicateHeader(void* data) // static void LLSelectMgr::packDeleteHeader(void* userdata) { - BOOL force = (BOOL)(intptr_t)userdata; + bool force = (bool)(intptr_t)userdata; gMessageSystem->nextBlockFast(_PREHASH_AgentData); gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); @@ -5597,7 +5599,7 @@ void LLSelectMgr::sendListToRegions(LLObjectSelectionHandle selected_handle, { if (node->getObject()) { - BOOL is_root = node->getObject()->isRootEdit(); + bool is_root = node->getObject()->isRootEdit(); if ((mRoots && is_root) || (!mRoots && !is_root)) { nodes_to_send.push(node); @@ -5607,8 +5609,8 @@ void LLSelectMgr::sendListToRegions(LLObjectSelectionHandle selected_handle, } }; struct push_all pushall(nodes_to_send); - struct push_some pushroots(nodes_to_send, TRUE); - struct push_some pushnonroots(nodes_to_send, FALSE); + struct push_some pushroots(nodes_to_send, true); + struct push_some pushnonroots(nodes_to_send, false); switch(send_type) { @@ -5865,8 +5867,8 @@ void LLSelectMgr::processObjectProperties(LLMessageSystem* msg, void** user_data if (save_textures) { - BOOL can_copy = FALSE; - BOOL can_transfer = FALSE; + bool can_copy = false; + bool can_transfer = false; LLAggregatePermissions::EValue value = LLAggregatePermissions::AP_NONE; if(node->getObject()->permYouOwner()) @@ -5874,12 +5876,12 @@ void LLSelectMgr::processObjectProperties(LLMessageSystem* msg, void** user_data value = ag_texture_perms_owner.getValue(PERM_COPY); if (value == LLAggregatePermissions::AP_EMPTY || value == LLAggregatePermissions::AP_ALL) { - can_copy = TRUE; + can_copy = true; } value = ag_texture_perms_owner.getValue(PERM_TRANSFER); if (value == LLAggregatePermissions::AP_EMPTY || value == LLAggregatePermissions::AP_ALL) { - can_transfer = TRUE; + can_transfer = true; } } else @@ -5887,12 +5889,12 @@ void LLSelectMgr::processObjectProperties(LLMessageSystem* msg, void** user_data value = ag_texture_perms.getValue(PERM_COPY); if (value == LLAggregatePermissions::AP_EMPTY || value == LLAggregatePermissions::AP_ALL) { - can_copy = TRUE; + can_copy = true; } value = ag_texture_perms.getValue(PERM_TRANSFER); if (value == LLAggregatePermissions::AP_EMPTY || value == LLAggregatePermissions::AP_ALL) { - can_transfer = TRUE; + can_transfer = true; } } @@ -5932,7 +5934,7 @@ void LLSelectMgr::processObjectProperties(LLMessageSystem* msg, void** user_data } } - node->mValid = TRUE; + node->mValid = true; node->mPermissions->init(creator_id, owner_id, last_owner_id, group_id); node->mPermissions->initMasks(base_mask, owner_mask, everyone_mask, group_mask, next_owner_mask); @@ -6026,7 +6028,7 @@ void LLSelectMgr::processObjectPropertiesFamily(LLMessageSystem* msg, void** use if (node) { - node->mValid = TRUE; + node->mValid = true; node->mPermissions->init(LLUUID::null, owner_id, last_owner_id, group_id); node->mPermissions->initMasks(base_mask, owner_mask, everyone_mask, group_mask, next_owner_mask); @@ -6043,7 +6045,7 @@ void LLSelectMgr::processObjectPropertiesFamily(LLMessageSystem* msg, void** use // static void LLSelectMgr::processForceObjectSelect(LLMessageSystem* msg, void**) { - BOOL reset_list; + bool reset_list; msg->getBOOL("Header", "ResetList", reset_list); if (reset_list) @@ -6088,7 +6090,7 @@ void LLSelectMgr::updateSilhouettes() if (!mSilhouetteImagep) { - mSilhouetteImagep = LLViewerTextureManager::getFetchedTextureFromFile("silhouette.j2c", FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_UI); + mSilhouetteImagep = LLViewerTextureManager::getFetchedTextureFromFile("silhouette.j2c", FTT_LOCAL_FILE, true, LLGLTexture::BOOST_UI); } mHighlightedObjects->cleanupNodes(); @@ -6124,7 +6126,7 @@ void LLSelectMgr::updateSilhouettes() // persists from frame to frame to avoid regenerating object silhouettes // mHighlightedObjects includes all siblings of rect selected objects - BOOL select_linked_set = !gSavedSettings.getBOOL("EditLinkedParts"); + bool select_linked_set = !gSavedSettings.getBOOL("EditLinkedParts"); // generate list of roots from current object selection for (std::set<LLPointer<LLViewerObject> >::iterator iter = mRectSelectedObjects.begin(); @@ -6201,12 +6203,12 @@ void LLSelectMgr::updateSilhouettes() continue; } - LLSelectNode* rect_select_root_node = new LLSelectNode(objectp, TRUE); - rect_select_root_node->selectAllTEs(TRUE); + LLSelectNode* rect_select_root_node = new LLSelectNode(objectp, true); + rect_select_root_node->selectAllTEs(true); if (!select_linked_set) { - rect_select_root_node->mIndividualSelection = TRUE; + rect_select_root_node->mIndividualSelection = true; } else { @@ -6221,8 +6223,8 @@ void LLSelectMgr::updateSilhouettes() continue; } - LLSelectNode* rect_select_node = new LLSelectNode(child_objectp, TRUE); - rect_select_node->selectAllTEs(TRUE); + LLSelectNode* rect_select_node = new LLSelectNode(child_objectp, true); + rect_select_node->selectAllTEs(true); mHighlightedObjects->addNodeAtEnd(rect_select_node); } } @@ -6234,7 +6236,7 @@ void LLSelectMgr::updateSilhouettes() num_sils_genned = 0; // render silhouettes for highlighted objects - //BOOL subtracting_from_selection = (gKeyboard->currentMask(TRUE) == MASK_CONTROL); + //bool subtracting_from_selection = (gKeyboard->currentMask(true) == MASK_CONTROL); for (S32 pass = 0; pass < 2; pass++) { for (LLObjectSelection::iterator iter = mHighlightedObjects->begin(); @@ -6246,8 +6248,8 @@ void LLSelectMgr::updateSilhouettes() continue; // do roots first, then children so that root flags are cleared ASAP - BOOL roots_only = (pass == 0); - BOOL is_root = objectp->isRootEdit(); + bool roots_only = (pass == 0); + bool is_root = objectp->isRootEdit(); if (roots_only != is_root) { continue; @@ -6321,8 +6323,8 @@ void LLSelectMgr::updateSelectionSilhouette(LLObjectSelectionHandle object_handl if (!objectp) continue; // do roots first, then children so that root flags are cleared ASAP - BOOL roots_only = (pass == 0); - BOOL is_root = (objectp->isRootEdit()); + bool roots_only = (pass == 0); + bool is_root = (objectp->isRootEdit()); if (roots_only != is_root || objectp->mDrawable.isNull()) { continue; @@ -6352,7 +6354,7 @@ void LLSelectMgr::updateSelectionSilhouette(LLObjectSelectionHandle object_handl } } } -void LLSelectMgr::renderSilhouettes(BOOL for_hud) +void LLSelectMgr::renderSilhouettes(bool for_hud) { if (!mRenderSilhouettes || !mRenderHighlightSelections) { @@ -6405,7 +6407,7 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud) gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); - BOOL is_hud_object = objectp->isHUDAttachment(); + bool is_hud_object = objectp->isHUDAttachment(); if (!is_hud_object) { @@ -6529,8 +6531,8 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud) } else if (node->isTransient()) { - BOOL oldHidden = LLSelectMgr::sRenderHiddenSelections; - LLSelectMgr::sRenderHiddenSelections = FALSE; + bool oldHidden = LLSelectMgr::sRenderHiddenSelections; + LLSelectMgr::sRenderHiddenSelections = false; node->renderOneSilhouette(sContextSilhouetteColor); LLSelectMgr::sRenderHiddenSelections = oldHidden; } @@ -6550,7 +6552,7 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud) if (mHighlightedObjects->getNumNodes()) { // render silhouettes for highlighted objects - BOOL subtracting_from_selection = (gKeyboard->currentMask(TRUE) == MASK_CONTROL); + bool subtracting_from_selection = (gKeyboard->currentMask(true) == MASK_CONTROL); for (S32 pass = 0; pass < 2; pass++) { for (LLObjectSelection::iterator iter = mHighlightedObjects->begin(); @@ -6611,15 +6613,15 @@ void LLSelectMgr::generateSilhouette(LLSelectNode* nodep, const LLVector3& view_ // // Utility classes // -LLSelectNode::LLSelectNode(LLViewerObject* object, BOOL glow) +LLSelectNode::LLSelectNode(LLViewerObject* object, bool glow) : mObject(object), - mIndividualSelection(FALSE), - mTransient(FALSE), - mValid(FALSE), + mIndividualSelection(false), + mTransient(false), + mValid(false), mPermissions(new LLPermissions()), mInventorySerial(0), - mSilhouetteExists(FALSE), - mDuplicated(FALSE), + mSilhouetteExists(false), + mDuplicated(false), mTESelectMask(0), mLastTESelected(0), mName(LLStringUtil::null), @@ -6708,13 +6710,13 @@ LLSelectNode::~LLSelectNode() mPermissions = NULL; } -void LLSelectNode::selectAllTEs(BOOL b) +void LLSelectNode::selectAllTEs(bool b) { mTESelectMask = b ? TE_SELECT_MASK_ALL : 0x0; mLastTESelected = 0; } -void LLSelectNode::selectTE(S32 te_index, BOOL selected) +void LLSelectNode::selectTE(S32 te_index, bool selected) { if (te_index < 0 || te_index >= SELECT_MAX_TES) { @@ -6743,11 +6745,11 @@ void LLSelectNode::selectGLTFNode(S32 node_index, S32 primitive_index, bool sele mSelectedGLTFPrimitive = primitive_index; } -BOOL LLSelectNode::isTESelected(S32 te_index) const +bool LLSelectNode::isTESelected(S32 te_index) const { if (te_index < 0 || te_index >= mObject->getNumTEs()) { - return FALSE; + return false; } return (mTESelectMask & (0x1 << te_index)) != 0; } @@ -6890,17 +6892,17 @@ void LLSelectNode::saveTextureScaleRatios(LLRender::eTexIndex index_to_query) // This implementation should be similar to LLTask::allowOperationOnTask -BOOL LLSelectNode::allowOperationOnNode(PermissionBit op, U64 group_proxy_power) const +bool LLSelectNode::allowOperationOnNode(PermissionBit op, U64 group_proxy_power) const { // Extract ownership. - BOOL object_is_group_owned = FALSE; + bool object_is_group_owned = false; LLUUID object_owner_id; mPermissions->getOwnership(object_owner_id, object_is_group_owned); // Operations on invalid or public objects is not allowed. if (!mObject || (mObject->isDead()) || !mPermissions->isOwned()) { - return FALSE; + return false; } // The transfer permissions can never be given through proxy. @@ -6910,7 +6912,7 @@ BOOL LLSelectNode::allowOperationOnNode(PermissionBit op, U64 group_proxy_power) if ( !object_is_group_owned && (gAgent.getID() == object_owner_id) ) { - return TRUE; + return true; } else { @@ -6926,7 +6928,7 @@ BOOL LLSelectNode::allowOperationOnNode(PermissionBit op, U64 group_proxy_power) // no proxy allowed. if (mObject->isAttachment() && object_owner_id != gAgent.getID()) { - return FALSE; + return false; } } @@ -6939,7 +6941,7 @@ BOOL LLSelectNode::allowOperationOnNode(PermissionBit op, U64 group_proxy_power) // Gods can always operate. if (gAgent.isGodlike()) { - return TRUE; + return true; } // Check if the agent is in the same group as the object. @@ -6974,7 +6976,7 @@ BOOL LLSelectNode::allowOperationOnNode(PermissionBit op, U64 group_proxy_power) if (PERM_OWNER == op) { // This this was just a check for ownership, we can now return the answer. - return (proxy_agent_id == object_owner_id ? TRUE : FALSE); + return proxy_agent_id == object_owner_id; } // check permissions to see if the agent can operate @@ -7011,7 +7013,7 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color) return; } - BOOL is_hud_object = objectp->isHUDAttachment(); + bool is_hud_object = objectp->isHUDAttachment(); if (mSilhouetteVertices.size() == 0 || mSilhouetteNormals.size() != mSilhouetteVertices.size()) { @@ -7248,7 +7250,7 @@ void LLSelectMgr::updateSelectionCenter() // nothing selected, probably grabbing // Ignore by setting to avatar origin. mSelectionCenterGlobal.clearVec(); - mShowSelection = FALSE; + mShowSelection = false; mSelectionBBox = LLBBox(); resetAgentHUDZoom(); } @@ -7262,7 +7264,7 @@ void LLSelectMgr::updateSelectionCenter() resetAgentHUDZoom(); } - mShowSelection = FALSE; + mShowSelection = false; LLBBox bbox; // have stuff selected @@ -7271,7 +7273,7 @@ void LLSelectMgr::updateSelectionCenter() // Initialize the bounding box to the root prim, so the BBox orientation // matches the root prim's (affecting the orientation of the manipulators). - bbox.addBBoxAgent( (mSelectedObjects->getFirstRootObject(TRUE))->getBoundingBoxAgent() ); + bbox.addBBoxAgent( (mSelectedObjects->getFirstRootObject(true))->getBoundingBoxAgent() ); for (LLObjectSelection::iterator iter = mSelectedObjects->begin(); iter != mSelectedObjects->end(); iter++) @@ -7286,7 +7288,7 @@ void LLSelectMgr::updateSelectionCenter() !root->isChild(gAgentAvatarp) && // not the object you're sitting on !object->isAvatar()) // not another avatar { - mShowSelection = TRUE; + mShowSelection = true; } bbox.addBBoxAgent( object->getBoundingBoxAgent() ); @@ -7429,7 +7431,7 @@ LLBBox LLSelectMgr::getBBoxOfSelection() const //----------------------------------------------------------------------------- // canUndo() //----------------------------------------------------------------------------- -BOOL LLSelectMgr::canUndo() const +bool LLSelectMgr::canUndo() const { // Can edit or can move return const_cast<LLSelectMgr*>(this)->mSelectedObjects->getFirstUndoEnabledObject() != NULL; // HACK: casting away constness - MG; @@ -7440,7 +7442,7 @@ BOOL LLSelectMgr::canUndo() const //----------------------------------------------------------------------------- void LLSelectMgr::undo() { - BOOL select_linked_set = !gSavedSettings.getBOOL("EditLinkedParts"); + bool select_linked_set = !gSavedSettings.getBOOL("EditLinkedParts"); LLUUID group_id(gAgent.getGroupID()); sendListToRegions("Undo", packAgentAndSessionAndGroupID, packObjectID, logNoOp, &group_id, select_linked_set ? SEND_ONLY_ROOTS : SEND_CHILDREN_FIRST); } @@ -7448,7 +7450,7 @@ void LLSelectMgr::undo() //----------------------------------------------------------------------------- // canRedo() //----------------------------------------------------------------------------- -BOOL LLSelectMgr::canRedo() const +bool LLSelectMgr::canRedo() const { return const_cast<LLSelectMgr*>(this)->mSelectedObjects->getFirstEditableObject() != NULL; // HACK: casting away constness - MG } @@ -7458,7 +7460,7 @@ BOOL LLSelectMgr::canRedo() const //----------------------------------------------------------------------------- void LLSelectMgr::redo() { - BOOL select_linked_set = !gSavedSettings.getBOOL("EditLinkedParts"); + bool select_linked_set = !gSavedSettings.getBOOL("EditLinkedParts"); LLUUID group_id(gAgent.getGroupID()); sendListToRegions("Redo", packAgentAndSessionAndGroupID, packObjectID, logNoOp, &group_id, select_linked_set ? SEND_ONLY_ROOTS : SEND_CHILDREN_FIRST); } @@ -7466,7 +7468,7 @@ void LLSelectMgr::redo() //----------------------------------------------------------------------------- // canDoDelete() //----------------------------------------------------------------------------- -BOOL LLSelectMgr::canDoDelete() const +bool LLSelectMgr::canDoDelete() const { bool can_delete = false; // This function is "logically const" - it does not change state in @@ -7497,7 +7499,7 @@ void LLSelectMgr::doDelete() //----------------------------------------------------------------------------- // canDeselect() //----------------------------------------------------------------------------- -BOOL LLSelectMgr::canDeselect() const +bool LLSelectMgr::canDeselect() const { return !mSelectedObjects->isEmpty(); } @@ -7512,7 +7514,7 @@ void LLSelectMgr::deselect() //----------------------------------------------------------------------------- // canDuplicate() //----------------------------------------------------------------------------- -BOOL LLSelectMgr::canDuplicate() const +bool LLSelectMgr::canDuplicate() const { return const_cast<LLSelectMgr*>(this)->mSelectedObjects->getFirstCopyableObject() != NULL; // HACK: casting away constness - MG } @@ -7522,7 +7524,7 @@ BOOL LLSelectMgr::canDuplicate() const void LLSelectMgr::duplicate() { LLVector3 offset(0.5f, 0.5f, 0.f); - selectDuplicate(offset, TRUE); + selectDuplicate(offset, true); } ESelectType LLSelectMgr::getSelectTypeForObject(LLViewerObject* object) @@ -7561,17 +7563,17 @@ void LLSelectMgr::validateSelection() getSelection()->applyToObjects(&func); } -BOOL LLSelectMgr::canSelectObject(LLViewerObject* object, BOOL ignore_select_owned) +bool LLSelectMgr::canSelectObject(LLViewerObject* object, bool ignore_select_owned) { // Never select dead objects if (!object || object->isDead()) { - return FALSE; + return false; } if (mForceSelection) { - return TRUE; + return true; } if(!ignore_select_owned) @@ -7580,26 +7582,26 @@ BOOL LLSelectMgr::canSelectObject(LLViewerObject* object, BOOL ignore_select_own (gSavedSettings.getBOOL("SelectMovableOnly") && (!object->permMove() || object->isPermanentEnforced()))) { // only select my own objects - return FALSE; + return false; } } // Can't select orphans - if (object->isOrphaned()) return FALSE; + if (object->isOrphaned()) return false; // Can't select avatars - if (object->isAvatar()) return FALSE; + if (object->isAvatar()) return false; // Can't select land - if (object->getPCode() == LLViewerObject::LL_VO_SURFACE_PATCH) return FALSE; + if (object->getPCode() == LLViewerObject::LL_VO_SURFACE_PATCH) return false; ESelectType selection_type = getSelectTypeForObject(object); - if (mSelectedObjects->getObjectCount() > 0 && mSelectedObjects->mSelectType != selection_type) return FALSE; + if (mSelectedObjects->getObjectCount() > 0 && mSelectedObjects->mSelectType != selection_type) return false; - return TRUE; + return true; } -BOOL LLSelectMgr::setForceSelection(BOOL force) +bool LLSelectMgr::setForceSelection(bool force) { std::swap(mForceSelection,force); return force; @@ -7678,7 +7680,7 @@ void LLObjectSelection::updateEffects() S32 LLObjectSelection::getNumNodes() { - return mList.size(); + return static_cast<S32>(mList.size()); } void LLObjectSelection::addNode(LLSelectNode *nodep) @@ -7733,7 +7735,7 @@ LLSelectNode* LLObjectSelection::findNode(LLViewerObject* objectp) //----------------------------------------------------------------------------- // isEmpty() //----------------------------------------------------------------------------- -BOOL LLObjectSelection::isEmpty() const +bool LLObjectSelection::isEmpty() const { return (mList.size() == 0); } @@ -7745,7 +7747,7 @@ BOOL LLObjectSelection::isEmpty() const S32 LLObjectSelection::getObjectCount() { cleanupNodes(); - S32 count = mList.size(); + S32 count = static_cast<S32>(mList.size()); return count; } @@ -8049,7 +8051,7 @@ bool LLObjectSelection::checkAnimatedObjectLinkable() bool LLObjectSelection::applyToRootObjects(LLSelectedObjectFunctor* func, bool firstonly) { - bool result = firstonly ? false : true; + bool result = !firstonly; for (root_iterator iter = root_begin(); iter != root_end(); ) { root_iterator nextiter = iter++; @@ -8067,7 +8069,7 @@ bool LLObjectSelection::applyToRootObjects(LLSelectedObjectFunctor* func, bool f bool LLObjectSelection::applyToTEs(LLSelectedTEFunctor* func, bool firstonly) { - bool result = firstonly ? false : true; + bool result = !firstonly; for (iterator iter = begin(); iter != end(); ) { iterator nextiter = iter++; @@ -8093,7 +8095,7 @@ bool LLObjectSelection::applyToTEs(LLSelectedTEFunctor* func, bool firstonly) bool LLObjectSelection::applyToNodes(LLSelectedNodeFunctor *func, bool firstonly) { - bool result = firstonly ? false : true; + bool result = !firstonly; for (iterator iter = begin(); iter != end(); ) { iterator nextiter = iter++; @@ -8109,7 +8111,7 @@ bool LLObjectSelection::applyToNodes(LLSelectedNodeFunctor *func, bool firstonly bool LLObjectSelection::applyToRootNodes(LLSelectedNodeFunctor *func, bool firstonly) { - bool result = firstonly ? false : true; + bool result = !firstonly; for (root_iterator iter = root_begin(); iter != root_end(); ) { root_iterator nextiter = iter++; @@ -8123,9 +8125,9 @@ bool LLObjectSelection::applyToRootNodes(LLSelectedNodeFunctor *func, bool first return result; } -BOOL LLObjectSelection::isMultipleTESelected() +bool LLObjectSelection::isMultipleTESelected() { - BOOL te_selected = FALSE; + bool te_selected = false; // ...all faces for (LLObjectSelection::iterator iter = begin(); iter != end(); iter++) @@ -8137,19 +8139,19 @@ BOOL LLObjectSelection::isMultipleTESelected() { if(te_selected) { - return TRUE; + return true; } - te_selected = TRUE; + te_selected = true; } } } - return FALSE; + return false; } //----------------------------------------------------------------------------- // contains() //----------------------------------------------------------------------------- -BOOL LLObjectSelection::contains(LLViewerObject* object) +bool LLObjectSelection::contains(LLViewerObject* object) { return findNode(object) != NULL; } @@ -8158,7 +8160,7 @@ BOOL LLObjectSelection::contains(LLViewerObject* object) //----------------------------------------------------------------------------- // contains() //----------------------------------------------------------------------------- -BOOL LLObjectSelection::contains(LLViewerObject* object, S32 te) +bool LLObjectSelection::contains(LLViewerObject* object, S32 te) { if (te == SELECT_ALL_TES) { @@ -8172,10 +8174,10 @@ BOOL LLObjectSelection::contains(LLViewerObject* object, S32 te) // Optimization if (nodep->getTESelectMask() == TE_SELECT_MASK_ALL) { - return TRUE; + return true; } - BOOL all_selected = TRUE; + bool all_selected = true; for (S32 i = 0; i < object->getNumTEs(); i++) { all_selected = all_selected && nodep->isTESelected(i); @@ -8183,7 +8185,7 @@ BOOL LLObjectSelection::contains(LLViewerObject* object, S32 te) return all_selected; } } - return FALSE; + return false; } else { @@ -8193,15 +8195,15 @@ BOOL LLObjectSelection::contains(LLViewerObject* object, S32 te) LLSelectNode* nodep = *iter; if (nodep->getObject() == object && nodep->isTESelected(te)) { - return TRUE; + return true; } } - return FALSE; + return false; } } -// returns TRUE is any node is currenly worn as an attachment -BOOL LLObjectSelection::isAttachment() +// returns true is any node is currenly worn as an attachment +bool LLObjectSelection::isAttachment() { return (mSelectType == SELECT_TYPE_ATTACHMENT || mSelectType == SELECT_TYPE_HUD); } @@ -8242,7 +8244,7 @@ LLSelectNode* LLObjectSelection::getFirstNode(LLSelectedNodeFunctor* func) return NULL; } -LLSelectNode* LLObjectSelection::getFirstRootNode(LLSelectedNodeFunctor* func, BOOL non_root_ok) +LLSelectNode* LLObjectSelection::getFirstRootNode(LLSelectedNodeFunctor* func, bool non_root_ok) { for (root_iterator iter = root_begin(); iter != root_end(); ++iter) { @@ -8264,7 +8266,7 @@ LLSelectNode* LLObjectSelection::getFirstRootNode(LLSelectedNodeFunctor* func, B //----------------------------------------------------------------------------- // getFirstSelectedObject //----------------------------------------------------------------------------- -LLViewerObject* LLObjectSelection::getFirstSelectedObject(LLSelectedNodeFunctor* func, BOOL get_parent) +LLViewerObject* LLObjectSelection::getFirstSelectedObject(LLSelectedNodeFunctor* func, bool get_parent) { LLSelectNode* res = getFirstNode(func); if (res && get_parent) @@ -8290,7 +8292,7 @@ LLViewerObject* LLObjectSelection::getFirstObject() //----------------------------------------------------------------------------- // getFirstRootObject() //----------------------------------------------------------------------------- -LLViewerObject* LLObjectSelection::getFirstRootObject(BOOL non_root_ok) +LLViewerObject* LLObjectSelection::getFirstRootObject(bool non_root_ok) { LLSelectNode* res = getFirstRootNode(NULL, non_root_ok); return res ? res->getObject() : NULL; @@ -8299,7 +8301,7 @@ LLViewerObject* LLObjectSelection::getFirstRootObject(BOOL non_root_ok) //----------------------------------------------------------------------------- // getFirstMoveableNode() //----------------------------------------------------------------------------- -LLSelectNode* LLObjectSelection::getFirstMoveableNode(BOOL get_root_first) +LLSelectNode* LLObjectSelection::getFirstMoveableNode(bool get_root_first) { struct f : public LLSelectedNodeFunctor { @@ -8309,14 +8311,14 @@ LLSelectNode* LLObjectSelection::getFirstMoveableNode(BOOL get_root_first) return obj && obj->permMove() && !obj->isPermanentEnforced(); } } func; - LLSelectNode* res = get_root_first ? getFirstRootNode(&func, TRUE) : getFirstNode(&func); + LLSelectNode* res = get_root_first ? getFirstRootNode(&func, true) : getFirstNode(&func); return res; } //----------------------------------------------------------------------------- // getFirstCopyableObject() //----------------------------------------------------------------------------- -LLViewerObject* LLObjectSelection::getFirstCopyableObject(BOOL get_parent) +LLViewerObject* LLObjectSelection::getFirstCopyableObject(bool get_parent) { struct f : public LLSelectedNodeFunctor { @@ -8364,7 +8366,7 @@ LLViewerObject* LLObjectSelection::getFirstDeleteableObject() //----------------------------------------------------------------------------- // getFirstEditableObject() //----------------------------------------------------------------------------- -LLViewerObject* LLObjectSelection::getFirstEditableObject(BOOL get_parent) +LLViewerObject* LLObjectSelection::getFirstEditableObject(bool get_parent) { struct f : public LLSelectedNodeFunctor { @@ -8380,7 +8382,7 @@ LLViewerObject* LLObjectSelection::getFirstEditableObject(BOOL get_parent) //----------------------------------------------------------------------------- // getFirstMoveableObject() //----------------------------------------------------------------------------- -LLViewerObject* LLObjectSelection::getFirstMoveableObject(BOOL get_parent) +LLViewerObject* LLObjectSelection::getFirstMoveableObject(bool get_parent) { struct f : public LLSelectedNodeFunctor { @@ -8396,7 +8398,7 @@ LLViewerObject* LLObjectSelection::getFirstMoveableObject(BOOL get_parent) //----------------------------------------------------------------------------- // getFirstUndoEnabledObject() //----------------------------------------------------------------------------- -LLViewerObject* LLObjectSelection::getFirstUndoEnabledObject(BOOL get_parent) +LLViewerObject* LLObjectSelection::getFirstUndoEnabledObject(bool get_parent) { struct f : public LLSelectedNodeFunctor { @@ -8484,7 +8486,7 @@ bool LLSelectMgr::selectionMove(const LLVector3& displ, if (enable_rot) { - int children_count = obj->getChildren().size(); + auto children_count = obj->getChildren().size(); if (obj_count > 1 && children_count > 0) { // for linked sets, rotate around the group center @@ -8530,7 +8532,7 @@ bool LLSelectMgr::selectionMove(const LLVector3& displ, if (enable_pos && enable_rot && obj->mDrawable.notNull()) { - gPipeline.markMoved(obj->mDrawable, TRUE); + gPipeline.markMoved(obj->mDrawable, true); } } diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index 02c74d0ab0..0456b109d7 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -87,7 +87,7 @@ const S32 SELECT_ALL_TES = -1; const S32 SELECT_MAX_TES = 32; // Do something to all objects in the selection manager. -// The BOOL return value can be used to indicate if all +// The bool return value can be used to indicate if all // objects are identical (gathering information) or if // the operation was successful. struct LLSelectedObjectFunctor @@ -97,7 +97,7 @@ struct LLSelectedObjectFunctor }; // Do something to all select nodes in the selection manager. -// The BOOL return value can be used to indicate if all +// The bool return value can be used to indicate if all // objects are identical (gathering information) or if // the operation was successful. struct LLSelectedNodeFunctor @@ -169,21 +169,21 @@ const S32 TE_SELECT_MASK_ALL = 0xFFFFFFFF; class LLSelectNode { public: - LLSelectNode(LLViewerObject* object, BOOL do_glow); + LLSelectNode(LLViewerObject* object, bool do_glow); LLSelectNode(const LLSelectNode& nodep); ~LLSelectNode(); - void selectAllTEs(BOOL b); - void selectTE(S32 te_index, BOOL selected); + void selectAllTEs(bool b); + void selectTE(S32 te_index, bool selected); void selectGLTFNode(S32 node_index, S32 primitive_index, bool selected); - BOOL isTESelected(S32 te_index) const; + bool isTESelected(S32 te_index) const; bool hasSelectedTE() const { return TE_SELECT_MASK_ALL & mTESelectMask; } S32 getLastSelectedTE() const; S32 getLastOperatedTE() const { return mLastTESelected; } S32 getTESelectMask() { return mTESelectMask; } void renderOneSilhouette(const LLColor4 &color); - void setTransient(BOOL transient) { mTransient = transient; } - BOOL isTransient() const { return mTransient; } + void setTransient(bool transient) { mTransient = transient; } + bool isTransient() const { return mTransient; } LLViewerObject* getObject(); void setObject(LLViewerObject* object); // *NOTE: invalidate stored textures and colors when # faces change @@ -200,13 +200,13 @@ public: // overrides get applied in live material editor void saveGLTFMaterials(const uuid_vec_t& materials, const gltf_materials_vec_t& override_materials); - BOOL allowOperationOnNode(PermissionBit op, U64 group_proxy_power) const; + bool allowOperationOnNode(PermissionBit op, U64 group_proxy_power) const; public: - BOOL mIndividualSelection; // For root objects and objects individually selected + bool mIndividualSelection; // For root objects and objects individually selected - BOOL mTransient; - BOOL mValid; // is extra information valid? + bool mTransient; + bool mValid; // is extra information valid? LLPermissions* mPermissions; LLSaleInfo mSaleInfo; LLAggregatePermissions mAggregatePerm; @@ -224,7 +224,7 @@ public: LLVector3 mLastScale; LLQuaternion mSavedRotation; // for interactively modifying object rotation LLQuaternion mLastRotation; - BOOL mDuplicated; + bool mDuplicated; LLVector3d mDuplicatePos; LLQuaternion mDuplicateRot; LLUUID mItemID; @@ -241,7 +241,7 @@ public: std::vector<LLVector3> mTextureScaleRatios; std::vector<LLVector3> mSilhouetteVertices; // array of vertices to render silhouette of object std::vector<LLVector3> mSilhouetteNormals; // array of normals to render silhouette of object - BOOL mSilhouetteExists; // need to generate silhouette? + bool mSilhouetteExists; // need to generate silhouette? S32 mSelectedGLTFNode = -1; S32 mSelectedGLTFPrimitive = -1; @@ -316,21 +316,21 @@ public: void updateEffects(); - BOOL isEmpty() const; + bool isEmpty() const; LLSelectNode* getFirstNode(LLSelectedNodeFunctor* func = NULL); - LLSelectNode* getFirstRootNode(LLSelectedNodeFunctor* func = NULL, BOOL non_root_ok = FALSE); - LLViewerObject* getFirstSelectedObject(LLSelectedNodeFunctor* func, BOOL get_parent = FALSE); + LLSelectNode* getFirstRootNode(LLSelectedNodeFunctor* func = NULL, bool non_root_ok = false); + LLViewerObject* getFirstSelectedObject(LLSelectedNodeFunctor* func, bool get_parent = false); LLViewerObject* getFirstObject(); - LLViewerObject* getFirstRootObject(BOOL non_root_ok = FALSE); + LLViewerObject* getFirstRootObject(bool non_root_ok = false); - LLSelectNode* getFirstMoveableNode(BOOL get_root_first = FALSE); + LLSelectNode* getFirstMoveableNode(bool get_root_first = false); - LLViewerObject* getFirstEditableObject(BOOL get_parent = FALSE); - LLViewerObject* getFirstCopyableObject(BOOL get_parent = FALSE); + LLViewerObject* getFirstEditableObject(bool get_parent = false); + LLViewerObject* getFirstCopyableObject(bool get_parent = false); LLViewerObject* getFirstDeleteableObject(); - LLViewerObject* getFirstMoveableObject(BOOL get_parent = FALSE); - LLViewerObject* getFirstUndoEnabledObject(BOOL get_parent = FALSE); + LLViewerObject* getFirstMoveableObject(bool get_parent = false); + LLViewerObject* getFirstUndoEnabledObject(bool get_parent = false); /// Return the object that lead to this selection, possible a child LLViewerObject* getPrimaryObject() { return mPrimaryObject; } @@ -356,19 +356,19 @@ public: S32 getTECount(); S32 getRootObjectCount(); - BOOL isMultipleTESelected(); - BOOL contains(LLViewerObject* object); - BOOL contains(LLViewerObject* object, S32 te); + bool isMultipleTESelected(); + bool contains(LLViewerObject* object); + bool contains(LLViewerObject* object, S32 te); - // returns TRUE is any node is currenly worn as an attachment - BOOL isAttachment(); + // returns true is any node is currenly worn as an attachment + bool isAttachment(); bool checkAnimatedObjectEstTris(); bool checkAnimatedObjectLinkable(); // Apply functors to various subsets of the selected objects - // If firstonly is FALSE, returns the AND of all apply() calls. - // Else returns TRUE immediately if any apply() call succeeds (i.e. OR with early exit) + // If firstonly is false, returns the AND of all apply() calls. + // Else returns true immediately if any apply() call succeeds (i.e. OR with early exit) bool applyToRootObjects(LLSelectedObjectFunctor* func, bool firstonly = false); bool applyToObjects(LLSelectedObjectFunctor* func); bool applyToTEs(LLSelectedTEFunctor* func, bool firstonly = false); @@ -438,9 +438,9 @@ private: class LLSelectMgr : public LLEditMenuHandler, public LLSimpleton<LLSelectMgr> { public: - static BOOL sRectSelectInclusive; // do we need to surround an object to pick it? - static BOOL sRenderHiddenSelections; // do we show selection silhouettes that are occluded? - static BOOL sRenderLightRadius; // do we show the radius of selected lights? + static bool sRectSelectInclusive; // do we need to surround an object to pick it? + static bool sRenderHiddenSelections; // do we show selection silhouettes that are occluded? + static bool sRenderLightRadius; // do we show the radius of selected lights? static F32 sHighlightThickness; static F32 sHighlightUScale; @@ -468,20 +468,20 @@ public: static void cleanupGlobals(); // LLEditMenuHandler interface - virtual BOOL canUndo() const; + virtual bool canUndo() const; virtual void undo(); - virtual BOOL canRedo() const; + virtual bool canRedo() const; virtual void redo(); - virtual BOOL canDoDelete() const; + virtual bool canDoDelete() const; virtual void doDelete(); virtual void deselect(); - virtual BOOL canDeselect() const; + virtual bool canDeselect() const; virtual void duplicate(); - virtual BOOL canDuplicate() const; + virtual bool canDuplicate() const; void clearSelections(); void update(); @@ -520,7 +520,7 @@ public: // Returns the previous value of mForceSelection - BOOL setForceSelection(BOOL force); + bool setForceSelection(bool force); //////////////////////////////////////////////////////////////// // Selection methods @@ -535,13 +535,13 @@ public: // // *NOTE: You must hold on to the object selection handle, otherwise // the objects will be automatically deselected in 1 frame. - LLObjectSelectionHandle selectObjectAndFamily(LLViewerObject* object, BOOL add_to_end = FALSE, BOOL ignore_select_owned = FALSE); + LLObjectSelectionHandle selectObjectAndFamily(LLViewerObject* object, bool add_to_end = false, bool ignore_select_owned = false); // For when you want just a child object. LLObjectSelectionHandle selectObjectOnly(LLViewerObject* object, S32 face = SELECT_ALL_TES, S32 gltf_node = -1, S32 gltf_primitive = -1); // Same as above, but takes a list of objects. Used by rectangle select. - LLObjectSelectionHandle selectObjectAndFamily(const std::vector<LLViewerObject*>& object_list, BOOL send_to_sim = TRUE); + LLObjectSelectionHandle selectObjectAndFamily(const std::vector<LLViewerObject*>& object_list, bool send_to_sim = true); // converts all objects currently highlighted to a selection, and returns it LLObjectSelectionHandle selectHighlightedObjects(); @@ -558,8 +558,8 @@ public: // Remove //////////////////////////////////////////////////////////////// - void deselectObjectOnly(LLViewerObject* object, BOOL send_to_sim = TRUE); - void deselectObjectAndFamily(LLViewerObject* object, BOOL send_to_sim = TRUE, BOOL include_entire_object = FALSE); + void deselectObjectOnly(LLViewerObject* object, bool send_to_sim = true); + void deselectObjectAndFamily(LLViewerObject* object, bool send_to_sim = true, bool include_entire_object = false); // Send deselect messages to simulator, then clear the list void deselectAll(); @@ -578,7 +578,7 @@ public: void unhighlightObjectAndFamily(LLViewerObject *objectp); void unhighlightAll(); - BOOL removeObjectFromSelections(const LLUUID &id); + bool removeObjectFromSelections(const LLUUID &id); //////////////////////////////////////////////////////////////// // Selection editing @@ -610,10 +610,10 @@ public: EGridMode getGridMode() { return mGridMode; } void getGrid(LLVector3& origin, LLQuaternion& rotation, LLVector3 &scale, bool for_snap_guides = false); - BOOL getTEMode() const { return mTEMode; } - void setTEMode(BOOL b) { mTEMode = b; } + bool getTEMode() const { return mTEMode; } + void setTEMode(bool b) { mTEMode = b; } - BOOL shouldShowSelection() const { return mShowSelection; } + bool shouldShowSelection() const { return mShowSelection; } LLBBox getBBoxOfSelection() const; LLBBox getSavedBBoxOfSelection() const { return mSavedSelectionBBox; } @@ -622,8 +622,8 @@ public: void cleanup(); void updateSilhouettes(); - void renderSilhouettes(BOOL for_hud); - void enableSilhouette(BOOL enable) { mRenderSilhouettes = enable; } + void renderSilhouettes(bool for_hud); + void enableSilhouette(bool enable) { mRenderSilhouettes = enable; } //////////////////////////////////////////////////////////////// // Utility functions that operate on the current selection @@ -633,15 +633,15 @@ public: void saveSelectedShinyColors(); void saveSelectedObjectTextures(); - void selectionUpdatePhysics(BOOL use_physics); - void selectionUpdateTemporary(BOOL is_temporary); - void selectionUpdatePhantom(BOOL is_ghost); + void selectionUpdatePhysics(bool use_physics); + void selectionUpdateTemporary(bool is_temporary); + void selectionUpdatePhantom(bool is_ghost); void selectionDump(); - BOOL selectionAllPCode(LLPCode code); // all objects have this PCode - BOOL selectionGetClickAction(U8 *out_action); + bool selectionAllPCode(LLPCode code); // all objects have this PCode + bool selectionGetClickAction(U8 *out_action); bool selectionGetIncludeInSearch(bool* include_in_search_out); // true if all selected objects have same - BOOL selectionGetGlow(F32 *glow); + bool selectionGetGlow(F32 *glow); void selectionSetPhysicsType(U8 type); void selectionSetGravity(F32 gravity); @@ -656,7 +656,7 @@ public: void selectionSetAlphaOnly(const F32 alpha); // Set only the alpha channel void selectionRevertColors(); void selectionRevertShinyColors(); - BOOL selectionRevertTextures(); + bool selectionRevertTextures(); void selectionRevertGLTFMaterials(); void selectionSetBumpmap( U8 bumpmap, const LLUUID &image_id ); void selectionSetTexGen( U8 texgen ); @@ -669,14 +669,14 @@ public: void selectionSetMaterialParams(LLSelectedTEMaterialFunctor* material_func, int specific_te = -1); void selectionRemoveMaterial(); - void selectionSetObjectPermissions(U8 perm_field, BOOL set, U32 perm_mask, BOOL override = FALSE); + void selectionSetObjectPermissions(U8 perm_field, bool set, U32 perm_mask, bool override = false); void selectionSetObjectName(const std::string& name); void selectionSetObjectDescription(const std::string& desc); void selectionSetObjectCategory(const LLCategory& category); void selectionSetObjectSaleInfo(const LLSaleInfo& sale_info); void selectionTexScaleAutofit(F32 repeats_per_meter); - void adjustTexturesByScale(BOOL send_to_sim, BOOL stretch); + void adjustTexturesByScale(bool send_to_sim, bool stretch); bool selectionMove(const LLVector3& displ, F32 rx, F32 ry, F32 rz, U32 update_type); @@ -688,116 +688,116 @@ public: // will make sure all selected object meet current criteria, or deselect them otherwise void validateSelection(); - // returns TRUE if it is possible to select this object - BOOL canSelectObject(LLViewerObject* object, BOOL ignore_select_owned = FALSE); + // returns true if it is possible to select this object + bool canSelectObject(LLViewerObject* object, bool ignore_select_owned = false); - // Returns TRUE if the viewer has information on all selected objects - BOOL selectGetAllRootsValid(); - BOOL selectGetAllValid(); - BOOL selectGetAllValidAndObjectsFound(); + // Returns true if the viewer has information on all selected objects + bool selectGetAllRootsValid(); + bool selectGetAllValid(); + bool selectGetAllValidAndObjectsFound(); - // returns TRUE if you can modify all selected objects. - BOOL selectGetRootsModify(); - BOOL selectGetModify(); + // returns true if you can modify all selected objects. + bool selectGetRootsModify(); + bool selectGetModify(); - // returns TRUE if all objects are in same region - BOOL selectGetSameRegion(); + // returns true if all objects are in same region + bool selectGetSameRegion(); - // returns TRUE if is all objects are non-permanent-enforced - BOOL selectGetRootsNonPermanentEnforced(); - BOOL selectGetNonPermanentEnforced(); + // returns true if is all objects are non-permanent-enforced + bool selectGetRootsNonPermanentEnforced(); + bool selectGetNonPermanentEnforced(); - // returns TRUE if is all objects are permanent - BOOL selectGetRootsPermanent(); - BOOL selectGetPermanent(); + // returns true if is all objects are permanent + bool selectGetRootsPermanent(); + bool selectGetPermanent(); - // returns TRUE if is all objects are character - BOOL selectGetRootsCharacter(); - BOOL selectGetCharacter(); + // returns true if is all objects are character + bool selectGetRootsCharacter(); + bool selectGetCharacter(); - // returns TRUE if is all objects are not permanent - BOOL selectGetRootsNonPathfinding(); - BOOL selectGetNonPathfinding(); + // returns true if is all objects are not permanent + bool selectGetRootsNonPathfinding(); + bool selectGetNonPathfinding(); - // returns TRUE if is all objects are not permanent - BOOL selectGetRootsNonPermanent(); - BOOL selectGetNonPermanent(); + // returns true if is all objects are not permanent + bool selectGetRootsNonPermanent(); + bool selectGetNonPermanent(); - // returns TRUE if is all objects are not character - BOOL selectGetRootsNonCharacter(); - BOOL selectGetNonCharacter(); + // returns true if is all objects are not character + bool selectGetRootsNonCharacter(); + bool selectGetNonCharacter(); - BOOL selectGetEditableLinksets(); - BOOL selectGetViewableCharacters(); + bool selectGetEditableLinksets(); + bool selectGetViewableCharacters(); - // returns TRUE if selected objects can be transferred. - BOOL selectGetRootsTransfer(); + // returns true if selected objects can be transferred. + bool selectGetRootsTransfer(); - // returns TRUE if selected objects can be copied. - BOOL selectGetRootsCopy(); + // returns true if selected objects can be copied. + bool selectGetRootsCopy(); - BOOL selectGetCreator(LLUUID& id, std::string& name); // TRUE if all have same creator, returns id - BOOL selectGetOwner(LLUUID& id, std::string& name); // TRUE if all objects have same owner, returns id - BOOL selectGetLastOwner(LLUUID& id, std::string& name); // TRUE if all objects have same owner, returns id + bool selectGetCreator(LLUUID& id, std::string& name); // true if all have same creator, returns id + bool selectGetOwner(LLUUID& id, std::string& name); // true if all objects have same owner, returns id + bool selectGetLastOwner(LLUUID& id, std::string& name); // true if all objects have same owner, returns id - // returns TRUE if all are the same. id is stuffed with + // returns true if all are the same. id is stuffed with // the value found if available. - BOOL selectGetGroup(LLUUID& id); - BOOL selectGetPerm( U8 which_perm, U32* mask_on, U32* mask_off); // TRUE if all have data, returns two masks, each indicating which bits are all on and all off + bool selectGetGroup(LLUUID& id); + bool selectGetPerm( U8 which_perm, U32* mask_on, U32* mask_off); // true if all have data, returns two masks, each indicating which bits are all on and all off - BOOL selectIsGroupOwned(); // TRUE if all root objects have valid data and are group owned. + bool selectIsGroupOwned(); // true if all root objects have valid data and are group owned. - // returns TRUE if all the nodes are valid. Accumulates + // returns true if all the nodes are valid. Accumulates // permissions in the parameter. - BOOL selectGetPermissions(LLPermissions& perm); + bool selectGetPermissions(LLPermissions& perm); - // returns TRUE if all the nodes are valid. Depends onto "edit linked" state + // returns true if all the nodes are valid. Depends onto "edit linked" state // Children in linksets are a bit special - they require not only move permission // but also modify if "edit linked" is set, since you move them relative to parent - BOOL selectGetEditMoveLinksetPermissions(bool &move, bool &modify); + bool selectGetEditMoveLinksetPermissions(bool &move, bool &modify); // Get a bunch of useful sale information for the object(s) selected. // "_mixed" is true if not all objects have the same setting. void selectGetAggregateSaleInfo(U32 &num_for_sale, - BOOL &is_for_sale_mixed, - BOOL &is_sale_price_mixed, + bool &is_for_sale_mixed, + bool &is_sale_price_mixed, S32 &total_sale_price, S32 &individual_sale_price); - // returns TRUE if all nodes are valid. - BOOL selectGetCategory(LLCategory& category); + // returns true if all nodes are valid. + bool selectGetCategory(LLCategory& category); - // returns TRUE if all nodes are valid. method also stores an + // returns true if all nodes are valid. method also stores an // accumulated sale info. - BOOL selectGetSaleInfo(LLSaleInfo& sale_info); + bool selectGetSaleInfo(LLSaleInfo& sale_info); - // returns TRUE if all nodes are valid. fills passed in object + // returns true if all nodes are valid. fills passed in object // with the aggregate permissions of the selection. - BOOL selectGetAggregatePermissions(LLAggregatePermissions& ag_perm); + bool selectGetAggregatePermissions(LLAggregatePermissions& ag_perm); - // returns TRUE if all nodes are valid. fills passed in object + // returns true if all nodes are valid. fills passed in object // with the aggregate permissions for texture inventory items of the selection. - BOOL selectGetAggregateTexturePermissions(LLAggregatePermissions& ag_perm); + bool selectGetAggregateTexturePermissions(LLAggregatePermissions& ag_perm); LLPermissions* findObjectPermissions(const LLViewerObject* object); - BOOL isMovableAvatarSelected(); + bool isMovableAvatarSelected(); void selectDelete(); // Delete on simulator void selectForceDelete(); // just delete, no into trash - void selectDuplicate(const LLVector3& offset, BOOL select_copy); // Duplicate on simulator + void selectDuplicate(const LLVector3& offset, bool select_copy); // Duplicate on simulator void repeatDuplicate(); void selectDuplicateOnRay(const LLVector3 &ray_start_region, const LLVector3 &ray_end_region, - BOOL bypass_raycast, - BOOL ray_end_is_intersection, + bool bypass_raycast, + bool ray_end_is_intersection, const LLUUID &ray_target_id, - BOOL copy_centers, - BOOL copy_rotates, - BOOL select_copy); + bool copy_centers, + bool copy_rotates, + bool select_copy); void sendMultipleUpdate(U32 type); // Position, rotation, scale all in one - void sendOwner(const LLUUID& owner_id, const LLUUID& group_id, BOOL override = FALSE); + void sendOwner(const LLUUID& owner_id, const LLUUID& group_id, bool override = false); void sendGroup(const LLUUID& group_id); // Category ID is the UUID of the folder you want to contain the purchase. @@ -836,16 +836,16 @@ public: // Internal list maintenance functions. TODO: Make these private! void remove(std::vector<LLViewerObject*>& objects); - void remove(LLViewerObject* object, S32 te = SELECT_ALL_TES, BOOL undoable = TRUE); + void remove(LLViewerObject* object, S32 te = SELECT_ALL_TES, bool undoable = true); void removeAll(); - void addAsIndividual(LLViewerObject* object, S32 te = SELECT_ALL_TES, BOOL undoable = TRUE, S32 gltf_node = -1, S32 gltf_primitive = -1); + void addAsIndividual(LLViewerObject* object, S32 te = SELECT_ALL_TES, bool undoable = true, S32 gltf_node = -1, S32 gltf_primitive = -1); void promoteSelectionToRoot(); void demoteSelectionToIndividuals(); private: void convertTransient(); // converts temporarily selected objects to full-fledged selections ESelectType getSelectTypeForObject(LLViewerObject* object); - void addAsFamily(std::vector<LLViewerObject*>& objects, BOOL add_to_end = FALSE); + void addAsFamily(std::vector<LLViewerObject*>& objects, bool add_to_end = false); void generateSilhouette(LLSelectNode *nodep, const LLVector3& view_point); void updateSelectionSilhouette(LLObjectSelectionHandle object_handle, S32& num_sils_genned, std::vector<LLViewerObject*>& changed_objects); // Send one message to each region containing an object on selection list. @@ -922,19 +922,19 @@ private: LLVector3 mGridScale; EGridMode mGridMode; - BOOL mTEMode; // render te + bool mTEMode; // render te LLRender::eTexIndex mTextureChannel; // diff, norm, or spec, depending on UI editing mode LLVector3d mSelectionCenterGlobal; LLBBox mSelectionBBox; LLVector3d mLastSentSelectionCenterGlobal; - BOOL mShowSelection; // do we send the selection center name value and do we animate this selection? + bool mShowSelection; // do we send the selection center name value and do we animate this selection? LLVector3d mLastCameraPos; // camera position from last generation of selection silhouette - BOOL mRenderSilhouettes; // do we render the silhouette + bool mRenderSilhouettes; // do we render the silhouette LLBBox mSavedSelectionBBox; LLFrameTimer mEffectsTimer; - BOOL mForceSelection; + bool mForceSelection; std::vector<LLAnimPauseRequest> mPauseRequests; }; @@ -955,7 +955,7 @@ template <typename T> bool LLObjectSelection::getSelectedTEValue(LLSelectedTEGet T selected_value = T(); // Now iterate through all TEs to test for sameness - bool identical = TRUE; + bool identical = true; for (iterator iter = begin(); iter != end(); iter++) { LLSelectNode* node = *iter; @@ -1026,7 +1026,7 @@ template <typename T> bool LLObjectSelection::isMultipleTEValue(LLSelectedTEGetF T selected_value = T(); // Now iterate through all TEs to test for sameness - bool unique = TRUE; + bool unique = true; for (iterator iter = begin(); iter != end(); iter++) { LLSelectNode* node = *iter; diff --git a/indra/newview/llsetkeybinddialog.cpp b/indra/newview/llsetkeybinddialog.cpp index dbab7e53b6..e172e15a0e 100644 --- a/indra/newview/llsetkeybinddialog.cpp +++ b/indra/newview/llsetkeybinddialog.cpp @@ -1,25 +1,25 @@ -/** +/** * @file llsetkeybinddialog.cpp * @brief LLSetKeyBindDialog class implementation. * * $LicenseInfo:firstyear=2019&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2019, 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$ */ @@ -53,11 +53,11 @@ public: virtual ~Updater(){} protected: - BOOL tick() + bool tick() { mCallback(mMask); // Deletes itseft after execution - return TRUE; + return true; } private: @@ -85,19 +85,19 @@ LLSetKeyBindDialog::~LLSetKeyBindDialog() } //virtual -BOOL LLSetKeyBindDialog::postBuild() +bool LLSetKeyBindDialog::postBuild() { childSetAction("SetEmpty", onBlank, this); childSetAction("Default", onDefault, this); childSetAction("Cancel", onCancel, this); - getChild<LLUICtrl>("Cancel")->setFocus(TRUE); + getChild<LLUICtrl>("Cancel")->setFocus(true); pCheckBox = getChild<LLCheckBoxCtrl>("apply_all"); pDescription = getChild<LLTextBase>("description"); - gFocusMgr.setKeystrokesOnly(TRUE); + gFocusMgr.setKeystrokesOnly(true); - return TRUE; + return true; } //virtual @@ -162,7 +162,7 @@ void LLSetKeyBindDialog::setParent(LLKeyBindResponderInterface* parent, LLView* } // static -bool LLSetKeyBindDialog::recordKey(KEY key, MASK mask, BOOL down) +bool LLSetKeyBindDialog::recordKey(KEY key, MASK mask, bool down) { if (sRecordKeys) { @@ -180,7 +180,7 @@ bool LLSetKeyBindDialog::recordKey(KEY key, MASK mask, BOOL down) return false; } -bool LLSetKeyBindDialog::recordAndHandleKey(KEY key, MASK mask, BOOL down) +bool LLSetKeyBindDialog::recordAndHandleKey(KEY key, MASK mask, bool down) { if ((key == 'Q' && mask == MASK_CONTROL) || key == KEY_ESCAPE) @@ -214,7 +214,7 @@ bool LLSetKeyBindDialog::recordAndHandleKey(KEY key, MASK mask, BOOL down) // Masks by themself are not allowed return false; } - if (down == TRUE) + if (down) { // Most keys are handled on 'down' event because menu is handled on 'down' // masks are exceptions to let other keys be handled @@ -269,14 +269,14 @@ bool LLSetKeyBindDialog::recordAndHandleKey(KEY key, MASK mask, BOOL down) return true; } -BOOL LLSetKeyBindDialog::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down) +bool LLSetKeyBindDialog::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, bool down) { - BOOL result = FALSE; + bool result = false; if (!pParent) { // we already processed 'down' event, this is 'up', consume closeFloater(); - result = TRUE; + result = true; } if (!result && clicktype == CLICK_LEFT) { @@ -291,8 +291,8 @@ BOOL LLSetKeyBindDialog::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClic } if (result) { - setFocus(TRUE); - gFocusMgr.setKeystrokesOnly(TRUE); + setFocus(true); + gFocusMgr.setKeystrokesOnly(true); } // ignore selection related combinations else if (down && (mask & (MASK_SHIFT | MASK_CONTROL)) == 0) @@ -302,7 +302,7 @@ BOOL LLSetKeyBindDialog::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClic { // Note: default doubleclick time is 500ms, but can stretch up to 5s pUpdater = new Updater(boost::bind(&onClickTimeout, this, _1), 0.7f, mask); - result = TRUE; + result = true; } } } @@ -314,7 +314,7 @@ BOOL LLSetKeyBindDialog::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClic && ((mKeyFilterMask & ALLOW_MASK_MOUSE) != 0 || mask == 0)) // reserved for selection { setKeyBind(clicktype, KEY_NONE, mask, pCheckBox->getValue().asBoolean()); - result = TRUE; + result = true; if (!down) { // wait for 'up' event before closing diff --git a/indra/newview/llsetkeybinddialog.h b/indra/newview/llsetkeybinddialog.h index b0643e37f9..195b4d77d9 100644 --- a/indra/newview/llsetkeybinddialog.h +++ b/indra/newview/llsetkeybinddialog.h @@ -59,7 +59,7 @@ public: LLSetKeyBindDialog(const LLSD& key); ~LLSetKeyBindDialog(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void onOpen(const LLSD& data); /*virtual*/ void onClose(bool app_quiting); /*virtual*/ void draw(); @@ -68,9 +68,9 @@ public: // Wrapper around recordAndHandleKey // It does not record, it handles, but handleKey function is already in use - static bool recordKey(KEY key, MASK mask, BOOL down); + static bool recordKey(KEY key, MASK mask, bool down); - BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down); + bool handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, bool down); static void onCancel(void* user_data); static void onBlank(void* user_data); static void onDefault(void* user_data); @@ -81,7 +81,7 @@ public: class Updater; private: - bool recordAndHandleKey(KEY key, MASK mask, BOOL down); + bool recordAndHandleKey(KEY key, MASK mask, bool down); void setKeyBind(EMouseClickType click, KEY key, MASK mask, bool all_modes); LLKeyBindResponderInterface *pParent; LLCheckBoxCtrl *pCheckBox; diff --git a/indra/newview/llsettingspicker.cpp b/indra/newview/llsettingspicker.cpp index 648a9503e1..85f0678c4c 100644 --- a/indra/newview/llsettingspicker.cpp +++ b/indra/newview/llsettingspicker.cpp @@ -78,7 +78,7 @@ LLFloaterSettingsPicker::LLFloaterSettingsPicker(LLView * owner, LLUUID initial_ mOwnerHandle = owner->getHandle(); buildFromFile(FLOATER_DEFINITION_XML); - setCanMinimize(FALSE); + setCanMinimize(false); } @@ -88,10 +88,10 @@ LLFloaterSettingsPicker::~LLFloaterSettingsPicker() } //------------------------------------------------------------------------- -BOOL LLFloaterSettingsPicker::postBuild() +bool LLFloaterSettingsPicker::postBuild() { if (!LLFloater::postBuild()) - return FALSE; + return false; std::string prefix = getString(STR_TITLE_PREFIX); std::string label = getString(STR_TITLE_SETTINGS); @@ -115,7 +115,7 @@ BOOL LLFloaterSettingsPicker::postBuild() // Disable auto selecting first filtered item because it takes away // selection from the item set by LLTextureCtrl owning this floater. - mInventoryPanel->getRootFolder()->setAutoSelectOverride(TRUE); + mInventoryPanel->getRootFolder()->setAutoSelectOverride(true); // don't put keyboard focus on selected item, because the selection callback // will assume that this was user input @@ -127,7 +127,7 @@ BOOL LLFloaterSettingsPicker::postBuild() getChild<LLView>(BTN_SELECT)->setEnabled(mSettingItemID.notNull()); } - mNoCopySettingsSelected = FALSE; + mNoCopySettingsSelected = false; childSetAction(BTN_CANCEL, [this](LLUICtrl*, const LLSD& param){ onButtonCancel(); }); childSetAction(BTN_SELECT, [this](LLUICtrl*, const LLSD& param){ onButtonSelect(); }); @@ -135,9 +135,9 @@ BOOL LLFloaterSettingsPicker::postBuild() getChild<LLPanel>(PNL_COMBO)->setVisible(mTrackMode != TRACK_NONE); // update permission filter once UI is fully initialized - mSavedFolderState.setApply(FALSE); + mSavedFolderState.setApply(false); - return TRUE; + return true; } void LLFloaterSettingsPicker::onClose(bool app_quitting) @@ -149,7 +149,7 @@ void LLFloaterSettingsPicker::onClose(bool app_quitting) LLView *owner = mOwnerHandle.get(); if (owner) { - owner->setFocus(TRUE); + owner->setFocus(true); } mSettingItemID.setNull(); mInventoryPanel->getRootFolder()->clearSelection(); @@ -218,7 +218,7 @@ void LLFloaterSettingsPicker::onFilterEdit(const std::string& search_string) return; } - mSavedFolderState.setApply(TRUE); + mSavedFolderState.setApply(true); mInventoryPanel->getRootFolder()->applyFunctorRecursively(mSavedFolderState); // add folder with current item to list of previously opened folders LLOpenFoldersWithSelection opener; @@ -231,7 +231,7 @@ void LLFloaterSettingsPicker::onFilterEdit(const std::string& search_string) // first letter in search term, save existing folder open state if (!mInventoryPanel->getFilter().isNotDefault()) { - mSavedFolderState.setApply(FALSE); + mSavedFolderState.setApply(false); mInventoryPanel->getRootFolder()->applyFunctorRecursively(mSavedFolderState); } } @@ -326,7 +326,7 @@ void LLFloaterSettingsPicker::onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr // track 1 always present track_selection->add(getString(STR_TRACK_GROUND), LLSD::Integer(LLSettingsDay::TRACK_GROUND_LEVEL), ADD_TOP, true); LLUIString formatted_label = getString(STR_TRACK_SKY); - for (int i = 2; i < LLSettingsDay::TRACK_MAX; i++) + for (U32 i = 2; i < LLSettingsDay::TRACK_MAX; i++) { if (!pday->isTrackEmpty(i)) { @@ -359,9 +359,9 @@ void LLFloaterSettingsPicker::onButtonSelect() closeFloater(); } -BOOL LLFloaterSettingsPicker::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLFloaterSettingsPicker::handleDoubleClick(S32 x, S32 y, MASK mask) { - BOOL result = FALSE; + bool result = false; if (mSettingItemID.notNull() && mInventoryPanel) { @@ -387,7 +387,7 @@ BOOL LLFloaterSettingsPicker::handleDoubleClick(S32 x, S32 y, MASK mask) } closeFloater(); // hit inside panel on selected item, double click should do nothing - result = TRUE; + result = true; } } } @@ -400,7 +400,7 @@ BOOL LLFloaterSettingsPicker::handleDoubleClick(S32 x, S32 y, MASK mask) return result; } -BOOL LLFloaterSettingsPicker::handleKeyHere(KEY key, MASK mask) +bool LLFloaterSettingsPicker::handleKeyHere(KEY key, MASK mask) { if ((key == KEY_RETURN) && (mask == MASK_NONE)) { @@ -416,7 +416,7 @@ BOOL LLFloaterSettingsPicker::handleKeyHere(KEY key, MASK mask) (*mCommitSignal)(this, res); } closeFloater(); - return TRUE; + return true; } } diff --git a/indra/newview/llsettingspicker.h b/indra/newview/llsettingspicker.h index 7e370af251..29827dfb94 100644 --- a/indra/newview/llsettingspicker.h +++ b/indra/newview/llsettingspicker.h @@ -60,7 +60,7 @@ public: void setActive(bool active); - virtual BOOL postBuild() override; + virtual bool postBuild() override; virtual void onClose(bool app_quitting) override; virtual void draw() override; @@ -107,8 +107,8 @@ private: void onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings); void onButtonCancel(); void onButtonSelect(); - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override; - BOOL handleKeyHere(KEY key, MASK mask) override; + virtual bool handleDoubleClick(S32 x, S32 y, MASK mask) override; + bool handleKeyHere(KEY key, MASK mask) override; void onFocusLost() override; diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index 76632a83ae..42927769de 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -69,7 +69,7 @@ #undef VERIFY_LEGACY_CONVERSION -extern BOOL gCubeSnapshot; +extern bool gCubeSnapshot; //========================================================================= namespace @@ -181,7 +181,7 @@ void LLSettingsVOBase::onInventoryItemCreated(const LLUUID &inventoryId, LLSetti { perm.setMaskEveryone(PERM_COPY); pitem->setPermissions(perm); - pitem->updateServer(FALSE); + pitem->updateServer(false); } } if (!settings) @@ -227,8 +227,8 @@ void LLSettingsVOBase::updateInventoryItem(const LLSettingsBase::ptr_t &settings if (settings->getFlag(LLSettingsBase::FLAG_NOTRANS) && new_item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) { LLPermissions perm(inv_item->getPermissions()); - perm.setBaseBits(LLUUID::null, FALSE, PERM_TRANSFER); - perm.setOwnerBits(LLUUID::null, FALSE, PERM_TRANSFER); + perm.setBaseBits(LLUUID::null, false, PERM_TRANSFER); + perm.setOwnerBits(LLUUID::null, false, PERM_TRANSFER); new_item->setPermissions(perm); need_update |= true; } @@ -240,7 +240,7 @@ void LLSettingsVOBase::updateInventoryItem(const LLSettingsBase::ptr_t &settings } if (need_update) { - new_item->updateServer(FALSE); + new_item->updateServer(false); gInventory.updateItem(new_item); gInventory.notifyObservers(); } @@ -1404,7 +1404,7 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildDeepCloneAndUncompress() const U32 flags = getFlags(); LLSettingsDay::ptr_t day_clone = std::make_shared<LLSettingsVODay>(settings); - for (S32 i = 0; i < LLSettingsDay::TRACK_MAX; ++i) + for (U32 i = 0; i < LLSettingsDay::TRACK_MAX; ++i) { const LLSettingsDay::CycleTrack_t& track = getCycleTrackConst(i); LLSettingsDay::CycleTrack_t::const_iterator iter = track.begin(); diff --git a/indra/newview/llshareavatarhandler.cpp b/indra/newview/llshareavatarhandler.cpp index 7425aa1a3c..2ec47ed456 100644 --- a/indra/newview/llshareavatarhandler.cpp +++ b/indra/newview/llshareavatarhandler.cpp @@ -54,7 +54,7 @@ public: //Get the ID LLUUID id; - if (!id.set( params[0], FALSE )) + if (!id.set( params[0], false )) { return false; } diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index eb3dbdbd2e..35d07d1ac8 100644 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -92,7 +92,7 @@ LLSidepanelAppearance::~LLSidepanelAppearance() } // virtual -BOOL LLSidepanelAppearance::postBuild() +bool LLSidepanelAppearance::postBuild() { mOpenOutfitBtn = getChild<LLButton>("openoutfit_btn"); mOpenOutfitBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onOpenOutfitButtonClicked, this)); @@ -142,7 +142,7 @@ BOOL LLSidepanelAppearance::postBuild() setWearablesLoading(gAgentWearables.isCOFChangeInProgress()); - return TRUE; + return true; } // virtual @@ -195,8 +195,8 @@ void LLSidepanelAppearance::updateToVisibility(const LLSD &new_visibility) { if (new_visibility["visible"].asBoolean()) { - const BOOL is_outfit_edit_visible = mOutfitEdit && mOutfitEdit->getVisible(); - const BOOL is_wearable_edit_visible = mEditWearable && mEditWearable->getVisible(); + const bool is_outfit_edit_visible = mOutfitEdit && mOutfitEdit->getVisible(); + const bool is_wearable_edit_visible = mEditWearable && mEditWearable->getVisible(); if (is_outfit_edit_visible || is_wearable_edit_visible) { @@ -262,7 +262,7 @@ void LLSidepanelAppearance::onOpenOutfitButtonClicked() LLAccordionCtrlTab* tab_outfits = mPanelOutfitsInventory->findChild<LLAccordionCtrlTab>("tab_outfits"); if (tab_outfits) { - tab_outfits->changeOpenClose(FALSE); + tab_outfits->changeOpenClose(false); LLInventoryPanel *inventory_panel = tab_outfits->findChild<LLInventoryPanel>("outfitslist_tab"); if (inventory_panel) { @@ -271,7 +271,7 @@ void LLSidepanelAppearance::onOpenOutfitButtonClicked() if (outfit_folder) { outfit_folder->setOpen(!outfit_folder->isOpen()); - root->setSelection(outfit_folder,TRUE); + root->setSelection(outfit_folder,true); root->scrollToShowSelection(); } } @@ -289,16 +289,16 @@ void LLSidepanelAppearance::onEditAppearanceButtonClicked() void LLSidepanelAppearance::showOutfitsInventoryPanel() { - toggleWearableEditPanel(FALSE); - toggleOutfitEditPanel(FALSE); - toggleMyOutfitsPanel(TRUE, ""); + toggleWearableEditPanel(false); + toggleOutfitEditPanel(false); + toggleMyOutfitsPanel(true, ""); } void LLSidepanelAppearance::showOutfitsInventoryPanel(const std::string &tab_name) { - toggleWearableEditPanel(FALSE); - toggleOutfitEditPanel(FALSE); - toggleMyOutfitsPanel(TRUE, tab_name); + toggleWearableEditPanel(false); + toggleOutfitEditPanel(false); + toggleMyOutfitsPanel(true, tab_name); } void LLSidepanelAppearance::showOutfitEditPanel() @@ -308,7 +308,7 @@ void LLSidepanelAppearance::showOutfitEditPanel() // Accordion's state must be reset in all cases except the one when user // is returning back to the mOutfitEdit panel from the mEditWearable panel. // The simplest way to control this is to check the visibility state of the mEditWearable - // BEFORE it is changed by the call to the toggleWearableEditPanel(FALSE, NULL, TRUE). + // BEFORE it is changed by the call to the toggleWearableEditPanel(false, NULL, true). if (mEditWearable != NULL && !mEditWearable->getVisible() && mOutfitEdit != NULL) { mOutfitEdit->resetAccordionState(); @@ -323,19 +323,19 @@ void LLSidepanelAppearance::showOutfitEditPanel() return; } - toggleMyOutfitsPanel(FALSE, ""); - toggleWearableEditPanel(FALSE, NULL, TRUE); // don't switch out of edit appearance mode - toggleOutfitEditPanel(TRUE); + toggleMyOutfitsPanel(false, ""); + toggleWearableEditPanel(false, NULL, true); // don't switch out of edit appearance mode + toggleOutfitEditPanel(true); } -void LLSidepanelAppearance::showWearableEditPanel(LLViewerWearable *wearable /* = NULL*/, BOOL disable_camera_switch) +void LLSidepanelAppearance::showWearableEditPanel(LLViewerWearable *wearable /* = NULL*/, bool disable_camera_switch) { - toggleMyOutfitsPanel(FALSE, ""); - toggleOutfitEditPanel(FALSE, TRUE); // don't switch out of edit appearance mode - toggleWearableEditPanel(TRUE, wearable, disable_camera_switch); + toggleMyOutfitsPanel(false, ""); + toggleOutfitEditPanel(false, true); // don't switch out of edit appearance mode + toggleWearableEditPanel(true, wearable, disable_camera_switch); } -void LLSidepanelAppearance::toggleMyOutfitsPanel(BOOL visible, const std::string& tab_name) +void LLSidepanelAppearance::toggleMyOutfitsPanel(bool visible, const std::string& tab_name) { if (!mPanelOutfitsInventory || (mPanelOutfitsInventory->getVisible() == visible && tab_name.empty())) @@ -370,7 +370,7 @@ bool LLSidepanelAppearance::isCOFPanelVisible() return false; } -void LLSidepanelAppearance::toggleOutfitEditPanel(BOOL visible, BOOL disable_camera_switch) +void LLSidepanelAppearance::toggleOutfitEditPanel(bool visible, bool disable_camera_switch) { if (!mOutfitEdit || mOutfitEdit->getVisible() == visible) { @@ -395,7 +395,7 @@ void LLSidepanelAppearance::toggleOutfitEditPanel(BOOL visible, BOOL disable_cam } } -void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLViewerWearable *wearable, BOOL disable_camera_switch) +void LLSidepanelAppearance::toggleWearableEditPanel(bool visible, LLViewerWearable *wearable, bool disable_camera_switch) { if (!mEditWearable) { @@ -411,7 +411,7 @@ void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLViewerWearab // If we're just switching between outfit and wearable editing or updating item, // don't end customization and don't switch camera // Don't end customization and don't switch camera without visibility change - BOOL change_state = !disable_camera_switch && mEditWearable->getVisible() != visible; + bool change_state = !disable_camera_switch && mEditWearable->getVisible() != visible; if (!wearable) { @@ -462,18 +462,18 @@ void LLSidepanelAppearance::refreshCurrentOutfitName(const std::string& name) std::string string_name = gAgentWearables.isCOFChangeInProgress() ? "Changing outfits" : "No Outfit"; mCurrentLookName->setText(getString(string_name)); - mOpenOutfitBtn->setEnabled(FALSE); + mOpenOutfitBtn->setEnabled(false); } else { mCurrentLookName->setText(name); // Can't just call update verbs since the folder link may not have been created yet. - mOpenOutfitBtn->setEnabled(TRUE); + mOpenOutfitBtn->setEnabled(true); } } //static -void LLSidepanelAppearance::editWearable(LLViewerWearable *wearable, LLView *data, BOOL disable_camera_switch) +void LLSidepanelAppearance::editWearable(LLViewerWearable *wearable, LLView *data, bool disable_camera_switch) { LLFloaterSidePanelContainer::showPanel("appearance", LLSD()); LLSidepanelAppearance *panel = dynamic_cast<LLSidepanelAppearance*>(data); diff --git a/indra/newview/llsidepanelappearance.h b/indra/newview/llsidepanelappearance.h index 239cbd4537..f3d34a857c 100644 --- a/indra/newview/llsidepanelappearance.h +++ b/indra/newview/llsidepanelappearance.h @@ -46,12 +46,12 @@ public: LLSidepanelAppearance(); virtual ~LLSidepanelAppearance(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void onOpen(const LLSD& key); void refreshCurrentOutfitName(const std::string& name = ""); - static void editWearable(LLViewerWearable *wearable, LLView *data, BOOL disable_camera_switch = FALSE); + static void editWearable(LLViewerWearable *wearable, LLView *data, bool disable_camera_switch = false); void fetchInventory(); void inventoryFetched(); @@ -59,7 +59,7 @@ public: void showOutfitsInventoryPanel(); // last selected void showOutfitsInventoryPanel(const std::string& tab_name); void showOutfitEditPanel(); - void showWearableEditPanel(LLViewerWearable *wearable = NULL, BOOL disable_camera_switch = FALSE); + void showWearableEditPanel(LLViewerWearable *wearable = NULL, bool disable_camera_switch = false); void setWearablesLoading(bool val); void showDefaultSubpart(); void updateScrollingPanelList(); @@ -75,9 +75,9 @@ private: void onOpenOutfitButtonClicked(); void onEditAppearanceButtonClicked(); - void toggleMyOutfitsPanel(BOOL visible, const std::string& tab_name); - void toggleOutfitEditPanel(BOOL visible, BOOL disable_camera_switch = FALSE); - void toggleWearableEditPanel(BOOL visible, LLViewerWearable* wearable = NULL, BOOL disable_camera_switch = FALSE); + void toggleMyOutfitsPanel(bool visible, const std::string& tab_name); + void toggleOutfitEditPanel(bool visible, bool disable_camera_switch = false); + void toggleWearableEditPanel(bool visible, LLViewerWearable* wearable = nullptr, bool disable_camera_switch = false); LLFilterEditor* mFilterEditor; LLPanelOutfitsInventory* mPanelOutfitsInventory; diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 0bb9e48a89..0d81f2c099 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -153,7 +153,7 @@ void handleInventoryDisplayInboxChanged() } } -BOOL LLSidepanelInventory::postBuild() +bool LLSidepanelInventory::postBuild() { // UI elements from inventory panel { @@ -223,7 +223,7 @@ BOOL LLSidepanelInventory::postBuild() initInventoryViews(); } - return TRUE; + return true; } void LLSidepanelInventory::updateInbox() @@ -428,14 +428,14 @@ void LLSidepanelInventory::onBackButtonClicked() showInventoryPanel(); } -void LLSidepanelInventory::onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action) +void LLSidepanelInventory::onSelectionChange(const std::deque<LLFolderViewItem*> &items, bool user_action) { } void LLSidepanelInventory::showInventoryPanel() { - mInventoryPanel->setVisible(TRUE); + mInventoryPanel->setVisible(true); } void LLSidepanelInventory::initInventoryViews() @@ -505,7 +505,7 @@ LLInventoryItem *LLSidepanelInventory::getSelectedItem() U32 LLSidepanelInventory::getSelectedCount() { - int count = 0; + size_t count = 0; std::set<LLFolderViewItem*> selection_list = mPanelMainInventory->getActivePanel()->getRootFolder()->getSelectionList(); count += selection_list.size(); @@ -517,7 +517,7 @@ U32 LLSidepanelInventory::getSelectedCount() count += selection_list.size(); } - return count; + return static_cast<U32>(count); } LLInventoryPanel *LLSidepanelInventory::getActivePanel() @@ -546,7 +546,7 @@ void LLSidepanelInventory::selectAllItemsPanel() } -BOOL LLSidepanelInventory::isMainInventoryPanelActive() const +bool LLSidepanelInventory::isMainInventoryPanelActive() const { return mInventoryPanel->getVisible(); } diff --git a/indra/newview/llsidepanelinventory.h b/indra/newview/llsidepanelinventory.h index a4df090852..b3b3ce4c50 100644 --- a/indra/newview/llsidepanelinventory.h +++ b/indra/newview/llsidepanelinventory.h @@ -53,7 +53,7 @@ public: void observeInboxCreation(); void observeInboxModifications(const LLUUID& inboxID); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void onOpen(const LLSD& key); LLInventoryPanel* getActivePanel(); // Returns an active inventory panel, if any. @@ -61,7 +61,7 @@ public: LLInventoryPanel* getInboxPanel() const { return mInventoryPanelInbox.get(); } LLPanelMainInventory* getMainInventoryPanel() const { return mPanelMainInventory; } - BOOL isMainInventoryPanelActive() const; + bool isMainInventoryPanelActive() const; void clearSelections(bool clearMain, bool clearInbox); std::set<LLFolderViewItem*> getInboxSelectionList(); @@ -88,7 +88,7 @@ protected: // Tracks highlighted (selected) item in inventory panel. LLInventoryItem *getSelectedItem(); U32 getSelectedCount(); - void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action); + void onSelectionChange(const std::deque<LLFolderViewItem*> &items, bool user_action); // "wear", "teleport", etc. void performActionOnSelection(const std::string &action); diff --git a/indra/newview/llsidepanelinventorysubpanel.cpp b/indra/newview/llsidepanelinventorysubpanel.cpp index 115f06e65f..820ceed296 100644 --- a/indra/newview/llsidepanelinventorysubpanel.cpp +++ b/indra/newview/llsidepanelinventorysubpanel.cpp @@ -48,8 +48,8 @@ // Default constructor LLSidepanelInventorySubpanel::LLSidepanelInventorySubpanel(const LLPanel::Params& p) : LLPanel(p), - mIsDirty(TRUE), - mIsEditing(FALSE), + mIsDirty(true), + mIsEditing(false), mCancelBtn(NULL) { } @@ -60,7 +60,7 @@ LLSidepanelInventorySubpanel::~LLSidepanelInventorySubpanel() } // virtual -BOOL LLSidepanelInventorySubpanel::postBuild() +bool LLSidepanelInventorySubpanel::postBuild() { mCancelBtn = findChild<LLButton>("cancel_btn"); @@ -68,10 +68,10 @@ BOOL LLSidepanelInventorySubpanel::postBuild() { mCancelBtn->setClickedCallback(boost::bind(&LLSidepanelInventorySubpanel::onCancelButtonClicked, this)); } - return TRUE; + return true; } -void LLSidepanelInventorySubpanel::setVisible(BOOL visible) +void LLSidepanelInventorySubpanel::setVisible(bool visible) { if (visible) { @@ -80,22 +80,22 @@ void LLSidepanelInventorySubpanel::setVisible(BOOL visible) LLPanel::setVisible(visible); } -void LLSidepanelInventorySubpanel::setIsEditing(BOOL edit) +void LLSidepanelInventorySubpanel::setIsEditing(bool edit) { mIsEditing = edit; - mIsDirty = TRUE; + mIsDirty = true; } -BOOL LLSidepanelInventorySubpanel::getIsEditing() const +bool LLSidepanelInventorySubpanel::getIsEditing() const { - return TRUE; // Default everything to edit mode since we're not using an edit button anymore. + return true; // Default everything to edit mode since we're not using an edit button anymore. // return mIsEditing; } void LLSidepanelInventorySubpanel::reset() { - mIsDirty = TRUE; + mIsDirty = true; } void LLSidepanelInventorySubpanel::draw() @@ -104,7 +104,7 @@ void LLSidepanelInventorySubpanel::draw() { refresh(); updateVerbs(); - mIsDirty = FALSE; + mIsDirty = false; } LLPanel::draw(); @@ -112,8 +112,8 @@ void LLSidepanelInventorySubpanel::draw() void LLSidepanelInventorySubpanel::dirty() { - mIsDirty = TRUE; - setIsEditing(FALSE); + mIsDirty = true; + setIsEditing(false); } void LLSidepanelInventorySubpanel::updateVerbs() @@ -126,14 +126,14 @@ void LLSidepanelInventorySubpanel::updateVerbs() void LLSidepanelInventorySubpanel::onEditButtonClicked() { - setIsEditing(TRUE); + setIsEditing(true); refresh(); updateVerbs(); } void LLSidepanelInventorySubpanel::onCancelButtonClicked() { - setIsEditing(FALSE); + setIsEditing(false); refresh(); updateVerbs(); } diff --git a/indra/newview/llsidepanelinventorysubpanel.h b/indra/newview/llsidepanelinventorysubpanel.h index 9fa2bbbc00..a11c91561e 100644 --- a/indra/newview/llsidepanelinventorysubpanel.h +++ b/indra/newview/llsidepanelinventorysubpanel.h @@ -43,19 +43,19 @@ public: LLSidepanelInventorySubpanel(const LLPanel::Params& p = getDefaultParams()); virtual ~LLSidepanelInventorySubpanel(); - /*virtual*/ void setVisible(BOOL visible); - virtual BOOL postBuild(); + /*virtual*/ void setVisible(bool visible); + virtual bool postBuild(); virtual void draw(); virtual void reset(); void dirty(); - void setIsEditing(BOOL edit); + void setIsEditing(bool edit); protected: virtual void refresh() = 0; virtual void save() = 0; virtual void updateVerbs(); - BOOL getIsEditing() const; + bool getIsEditing() const; // // UI Elements @@ -66,8 +66,8 @@ protected: LLButton* mCancelBtn; private: - BOOL mIsDirty; // item properties need to be updated - BOOL mIsEditing; // if we're in edit mode + bool mIsDirty; // item properties need to be updated + bool mIsEditing; // if we're in edit mode }; #endif // LL_LLSIDEPANELINVENTORYSUBPANEL_H diff --git a/indra/newview/llsidepaneliteminfo.cpp b/indra/newview/llsidepaneliteminfo.cpp index 4506088fd3..7775e3d9f6 100644 --- a/indra/newview/llsidepaneliteminfo.cpp +++ b/indra/newview/llsidepaneliteminfo.cpp @@ -152,7 +152,7 @@ LLSidepanelItemInfo::~LLSidepanelItemInfo() } // virtual -BOOL LLSidepanelItemInfo::postBuild() +bool LLSidepanelItemInfo::postBuild() { mChangeThumbnailBtn = getChild<LLUICtrl>("change_thumbnail_btn"); mItemTypeIcon = getChild<LLIconCtrl>("item_type_icon"); @@ -182,7 +182,7 @@ BOOL LLSidepanelItemInfo::postBuild() // "Price" label for edit getChild<LLUICtrl>("Edit Cost")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitSaleInfo, this, _1)); refresh(); - return TRUE; + return true; } void LLSidepanelItemInfo::setObjectID(const LLUUID& object_id) @@ -292,16 +292,16 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item) // do not enable the UI for incomplete items. bool is_complete = item->isFinished(); - const BOOL cannot_restrict_permissions = LLInventoryType::cannotRestrictPermissions(item->getInventoryType()); - const BOOL is_calling_card = (item->getInventoryType() == LLInventoryType::IT_CALLINGCARD); - const BOOL is_settings = (item->getInventoryType() == LLInventoryType::IT_SETTINGS); + const bool cannot_restrict_permissions = LLInventoryType::cannotRestrictPermissions(item->getInventoryType()); + const bool is_calling_card = (item->getInventoryType() == LLInventoryType::IT_CALLINGCARD); + const bool is_settings = (item->getInventoryType() == LLInventoryType::IT_SETTINGS); const LLPermissions& perm = item->getPermissions(); - const BOOL can_agent_manipulate = gAgent.allowOperation(PERM_OWNER, perm, + const bool can_agent_manipulate = gAgent.allowOperation(PERM_OWNER, perm, GP_OBJECT_MANIPULATE); - const BOOL can_agent_sell = gAgent.allowOperation(PERM_OWNER, perm, + const bool can_agent_sell = gAgent.allowOperation(PERM_OWNER, perm, GP_OBJECT_SET_SALE) && !cannot_restrict_permissions; - const BOOL is_link = item->getIsLinkType(); + const bool is_link = item->getIsLinkType(); const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); bool not_in_trash = (item->getUUID() != trash_id) && !gInventory.isObjectDescendentOf(item->getUUID(), trash_id); @@ -310,7 +310,7 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item) // item in it. LLViewerObject* object = NULL; if(!mObjectID.isNull()) object = gObjectList.findObject(mObjectID); - BOOL is_obj_modify = TRUE; + bool is_obj_modify = true; if(object) { is_obj_modify = object->permOwnerModify(); @@ -318,10 +318,10 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item) if(item->getInventoryType() == LLInventoryType::IT_LSL) { - getChildView("LabelItemExperienceTitle")->setVisible(TRUE); + getChildView("LabelItemExperienceTitle")->setVisible(true); LLTextBox* tb = getChild<LLTextBox>("LabelItemExperience"); tb->setText(getString("loading_experience")); - tb->setVisible(TRUE); + tb->setVisible(true); std::string url = std::string(); if(object && object->getRegion()) { @@ -334,19 +334,19 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item) ////////////////////// // ITEM NAME & DESC // ////////////////////// - BOOL is_modifiable = gAgent.allowOperation(PERM_MODIFY, perm, + bool is_modifiable = gAgent.allowOperation(PERM_MODIFY, perm, GP_OBJECT_MANIPULATE) && is_obj_modify && is_complete && not_in_trash; - getChildView("LabelItemNameTitle")->setEnabled(TRUE); + getChildView("LabelItemNameTitle")->setEnabled(true); getChildView("LabelItemName")->setEnabled(is_modifiable && !is_calling_card); // for now, don't allow rename of calling cards getChild<LLUICtrl>("LabelItemName")->setValue(item->getName()); - getChildView("LabelItemDescTitle")->setEnabled(TRUE); + getChildView("LabelItemDescTitle")->setEnabled(true); getChildView("LabelItemDesc")->setEnabled(is_modifiable); getChild<LLUICtrl>("LabelItemDesc")->setValue(item->getDescription()); getChild<LLUICtrl>("item_thumbnail")->setValue(item->getThumbnailUUID()); - LLUIImagePtr icon_img = LLInventoryIcon::getIcon(item->getType(), item->getInventoryType(), item->getFlags(), FALSE); + LLUIImagePtr icon_img = LLInventoryIcon::getIcon(item->getType(), item->getInventoryType(), item->getFlags(), false); mItemTypeIcon->setImage(icon_img); // Style for creator and owner links @@ -389,13 +389,13 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item) mCreatorCacheConnection = LLAvatarNameCache::get(creator_id, boost::bind(&LLSidepanelItemInfo::updateCreatorName, this, _1, _2, style_params)); } - getChildView("LabelCreatorTitle")->setEnabled(TRUE); - mLabelCreatorName->setEnabled(TRUE); + getChildView("LabelCreatorTitle")->setEnabled(true); + mLabelCreatorName->setEnabled(true); } else { - getChildView("LabelCreatorTitle")->setEnabled(FALSE); - mLabelCreatorName->setEnabled(FALSE); + getChildView("LabelCreatorTitle")->setEnabled(false); + mLabelCreatorName->setEnabled(false); mLabelCreatorName->setValue(getString("unknown_multiple")); } @@ -446,13 +446,13 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item) mOwnerCacheConnection = LLAvatarNameCache::get(owner_id, boost::bind(&LLSidepanelItemInfo::updateOwnerName, this, _1, _2, style_params)); } } - getChildView("LabelOwnerTitle")->setEnabled(TRUE); - mLabelOwnerName->setEnabled(TRUE); + getChildView("LabelOwnerTitle")->setEnabled(true); + mLabelOwnerName->setEnabled(true); } else { - getChildView("LabelOwnerTitle")->setEnabled(FALSE); - mLabelOwnerName->setEnabled(FALSE); + getChildView("LabelOwnerTitle")->setEnabled(false); + mLabelOwnerName->setEnabled(false); mLabelOwnerName->setValue(getString("public")); } @@ -554,12 +554,12 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item) U32 everyone_mask = perm.getMaskEveryone(); U32 next_owner_mask = perm.getMaskNextOwner(); - getChildView("CheckOwnerModify")->setEnabled(FALSE); - getChild<LLUICtrl>("CheckOwnerModify")->setValue(LLSD((BOOL)(owner_mask & PERM_MODIFY))); - getChildView("CheckOwnerCopy")->setEnabled(FALSE); - getChild<LLUICtrl>("CheckOwnerCopy")->setValue(LLSD((BOOL)(owner_mask & PERM_COPY))); - getChildView("CheckOwnerTransfer")->setEnabled(FALSE); - getChild<LLUICtrl>("CheckOwnerTransfer")->setValue(LLSD((BOOL)(owner_mask & PERM_TRANSFER))); + getChildView("CheckOwnerModify")->setEnabled(false); + getChild<LLUICtrl>("CheckOwnerModify")->setValue(LLSD((bool)(owner_mask & PERM_MODIFY))); + getChildView("CheckOwnerCopy")->setEnabled(false); + getChild<LLUICtrl>("CheckOwnerCopy")->setValue(LLSD((bool)(owner_mask & PERM_COPY))); + getChildView("CheckOwnerTransfer")->setEnabled(false); + getChild<LLUICtrl>("CheckOwnerTransfer")->setValue(LLSD((bool)(owner_mask & PERM_TRANSFER))); /////////////////////// // DEBUG PERMISSIONS // @@ -569,9 +569,9 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item) { childSetVisible("layout_debug_permissions", true); - BOOL slam_perm = FALSE; - BOOL overwrite_group = FALSE; - BOOL overwrite_everyone = FALSE; + bool slam_perm = false; + bool overwrite_group = false; + bool overwrite_everyone = false; if (item->getType() == LLAssetType::AT_OBJECT) { @@ -618,62 +618,58 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item) // Check for ability to change values. if (is_link || cannot_restrict_permissions) { - getChildView("CheckShareWithGroup")->setEnabled(FALSE); - getChildView("CheckEveryoneCopy")->setEnabled(FALSE); + getChildView("CheckShareWithGroup")->setEnabled(false); + getChildView("CheckEveryoneCopy")->setEnabled(false); } else if (is_obj_modify && can_agent_manipulate) { - getChildView("CheckShareWithGroup")->setEnabled(TRUE); + getChildView("CheckShareWithGroup")->setEnabled(true); getChildView("CheckEveryoneCopy")->setEnabled((owner_mask & PERM_COPY) && (owner_mask & PERM_TRANSFER)); } else { - getChildView("CheckShareWithGroup")->setEnabled(FALSE); - getChildView("CheckEveryoneCopy")->setEnabled(FALSE); + getChildView("CheckShareWithGroup")->setEnabled(false); + getChildView("CheckEveryoneCopy")->setEnabled(false); } // Set values. - BOOL is_group_copy = (group_mask & PERM_COPY) ? TRUE : FALSE; - BOOL is_group_modify = (group_mask & PERM_MODIFY) ? TRUE : FALSE; - BOOL is_group_move = (group_mask & PERM_MOVE) ? TRUE : FALSE; + bool is_group_copy = group_mask & PERM_COPY; + bool is_group_modify = group_mask & PERM_MODIFY; + bool is_group_move = group_mask & PERM_MOVE; if (is_group_copy && is_group_modify && is_group_move) { - getChild<LLUICtrl>("CheckShareWithGroup")->setValue(LLSD((BOOL)TRUE)); - - LLCheckBoxCtrl* ctl = getChild<LLCheckBoxCtrl>("CheckShareWithGroup"); - if(ctl) + getChild<LLUICtrl>("CheckShareWithGroup")->setValue(LLSD((bool)true)); + if (LLCheckBoxCtrl* ctl = getChild<LLCheckBoxCtrl>("CheckShareWithGroup")) { - ctl->setTentative(FALSE); + ctl->setTentative(false); } } else if (!is_group_copy && !is_group_modify && !is_group_move) { - getChild<LLUICtrl>("CheckShareWithGroup")->setValue(LLSD((BOOL)FALSE)); - LLCheckBoxCtrl* ctl = getChild<LLCheckBoxCtrl>("CheckShareWithGroup"); - if(ctl) + getChild<LLUICtrl>("CheckShareWithGroup")->setValue(LLSD((bool)false)); + if (LLCheckBoxCtrl* ctl = getChild<LLCheckBoxCtrl>("CheckShareWithGroup")) { - ctl->setTentative(FALSE); + ctl->setTentative(false); } } else { - LLCheckBoxCtrl* ctl = getChild<LLCheckBoxCtrl>("CheckShareWithGroup"); - if(ctl) + if (LLCheckBoxCtrl* ctl = getChild<LLCheckBoxCtrl>("CheckShareWithGroup")) { ctl->setTentative(!ctl->getEnabled()); - ctl->set(TRUE); + ctl->set(true); } } - getChild<LLUICtrl>("CheckEveryoneCopy")->setValue(LLSD((BOOL)(everyone_mask & PERM_COPY))); + getChild<LLUICtrl>("CheckEveryoneCopy")->setValue(LLSD((bool)(everyone_mask & PERM_COPY))); /////////////// // SALE INFO // /////////////// const LLSaleInfo& sale_info = item->getSaleInfo(); - BOOL is_for_sale = sale_info.isForSale(); + bool is_for_sale = sale_info.isForSale(); LLComboBox* combo_sale_type = getChild<LLComboBox>("ComboBoxSaleType"); LLUICtrl* edit_cost = getChild<LLUICtrl>("Edit Cost"); @@ -683,7 +679,7 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item) { getChildView("CheckPurchase")->setEnabled(is_complete); - getChildView("NextOwnerLabel")->setEnabled(TRUE); + getChildView("NextOwnerLabel")->setEnabled(true); getChildView("CheckNextOwnerModify")->setEnabled((base_mask & PERM_MODIFY) && !cannot_restrict_permissions); getChildView("CheckNextOwnerCopy")->setEnabled((base_mask & PERM_COPY) && !cannot_restrict_permissions && !is_settings); getChildView("CheckNextOwnerTransfer")->setEnabled((next_owner_mask & PERM_COPY) && !cannot_restrict_permissions); @@ -693,15 +689,15 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item) } else { - getChildView("CheckPurchase")->setEnabled(FALSE); + getChildView("CheckPurchase")->setEnabled(false); - getChildView("NextOwnerLabel")->setEnabled(FALSE); - getChildView("CheckNextOwnerModify")->setEnabled(FALSE); - getChildView("CheckNextOwnerCopy")->setEnabled(FALSE); - getChildView("CheckNextOwnerTransfer")->setEnabled(FALSE); + getChildView("NextOwnerLabel")->setEnabled(false); + getChildView("CheckNextOwnerModify")->setEnabled(false); + getChildView("CheckNextOwnerCopy")->setEnabled(false); + getChildView("CheckNextOwnerTransfer")->setEnabled(false); - combo_sale_type->setEnabled(FALSE); - edit_cost->setEnabled(FALSE); + combo_sale_type->setEnabled(false); + edit_cost->setEnabled(false); } // Hide any properties that are not relevant to settings @@ -725,9 +721,9 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item) // Set values. getChild<LLUICtrl>("CheckPurchase")->setValue(is_for_sale); - getChild<LLUICtrl>("CheckNextOwnerModify")->setValue(LLSD(BOOL(next_owner_mask & PERM_MODIFY))); - getChild<LLUICtrl>("CheckNextOwnerCopy")->setValue(LLSD(BOOL(next_owner_mask & PERM_COPY))); - getChild<LLUICtrl>("CheckNextOwnerTransfer")->setValue(LLSD(BOOL(next_owner_mask & PERM_TRANSFER))); + getChild<LLUICtrl>("CheckNextOwnerModify")->setValue(LLSD(bool(next_owner_mask & PERM_MODIFY))); + getChild<LLUICtrl>("CheckNextOwnerCopy")->setValue(LLSD(bool(next_owner_mask & PERM_COPY))); + getChild<LLUICtrl>("CheckNextOwnerTransfer")->setValue(LLSD(bool(next_owner_mask & PERM_TRANSFER))); if (is_for_sale) { @@ -957,7 +953,7 @@ void LLSidepanelItemInfo::updatePermissions() LLViewerInventoryItem* item = findItem(); if(!item) return; - BOOL is_group_owned; + bool is_group_owned; LLUUID owner_id; LLUUID group_id; LLPermissions perm(item->getPermissions()); @@ -1066,10 +1062,10 @@ void LLSidepanelItemInfo::updateSaleInfo() LLSaleInfo sale_info(item->getSaleInfo()); if(!gAgent.allowOperation(PERM_TRANSFER, item->getPermissions(), GP_OBJECT_SET_SALE)) { - getChild<LLUICtrl>("CheckPurchase")->setValue(LLSD((BOOL)FALSE)); + getChild<LLUICtrl>("CheckPurchase")->setValue(LLSD((bool)false)); } - if((BOOL)getChild<LLUICtrl>("CheckPurchase")->getValue()) + if((bool)getChild<LLUICtrl>("CheckPurchase")->getValue()) { // turn on sale info LLSaleInfo::EForSale sale_type = LLSaleInfo::FS_COPY; @@ -1144,7 +1140,7 @@ void LLSidepanelItemInfo::onCommitChanges(LLPointer<LLViewerInventoryItem> item) mUpdatePendingId++; LLPointer<LLInventoryCallback> callback = new PropertiesChangedCallback(getHandle(), mItemID, mUpdatePendingId); update_inventory_item(item.get(), callback); - //item->updateServer(FALSE); + //item->updateServer(false); gInventory.updateItem(item); gInventory.notifyObservers(); } diff --git a/indra/newview/llsidepaneliteminfo.h b/indra/newview/llsidepaneliteminfo.h index 45709b82f3..718edc79d6 100644 --- a/indra/newview/llsidepaneliteminfo.h +++ b/indra/newview/llsidepaneliteminfo.h @@ -53,7 +53,7 @@ public: LLSidepanelItemInfo(const LLPanel::Params& p = getDefaultParams()); virtual ~LLSidepanelItemInfo(); - /*virtual*/ BOOL postBuild() override; + /*virtual*/ bool postBuild() override; /*virtual*/ void reset(); void setObjectID(const LLUUID& object_id); diff --git a/indra/newview/llsidepaneltaskinfo.cpp b/indra/newview/llsidepaneltaskinfo.cpp index dbcbc6c725..c619b63ef5 100644 --- a/indra/newview/llsidepaneltaskinfo.cpp +++ b/indra/newview/llsidepaneltaskinfo.cpp @@ -97,14 +97,13 @@ static std::string click_action_to_string_value(U8 click_action) default: return "Touch"; } - return "Touch"; } // Default constructor LLSidepanelTaskInfo::LLSidepanelTaskInfo() : mVisibleDebugPermissions(true) // space was allocated by default { - setMouseOpaque(FALSE); + setMouseOpaque(false); mSelectionUpdateSlot = LLSelectMgr::instance().mUpdateSignal.connect(boost::bind(&LLSidepanelTaskInfo::refreshAll, this)); gIdleCallbacks.addFunction(&LLSidepanelTaskInfo::onIdle, (void*)this); } @@ -123,7 +122,7 @@ LLSidepanelTaskInfo::~LLSidepanelTaskInfo() } // virtual -BOOL LLSidepanelTaskInfo::postBuild() +bool LLSidepanelTaskInfo::postBuild() { mOpenBtn = getChild<LLButton>("open_btn"); mOpenBtn->setClickedCallback(boost::bind(&LLSidepanelTaskInfo::onOpenButtonClicked, this)); @@ -186,10 +185,10 @@ BOOL LLSidepanelTaskInfo::postBuild() mDAN = getChild<LLUICtrl>("N:"); mDAF = getChild<LLUICtrl>("F:"); - return TRUE; + return true; } -/*virtual*/ void LLSidepanelTaskInfo::onVisibilityChange ( BOOL visible ) +/*virtual*/ void LLSidepanelTaskInfo::onVisibilityChange(bool visible) { if (visible) { @@ -208,26 +207,26 @@ BOOL LLSidepanelTaskInfo::postBuild() void LLSidepanelTaskInfo::disableAll() { mDACreatorName->setValue(LLStringUtil::null); - mDACreatorName->setEnabled(FALSE); + mDACreatorName->setEnabled(false); - mDAOwner->setEnabled(FALSE); + mDAOwner->setEnabled(false); mDAOwnerName->setValue(LLStringUtil::null); - mDAOwnerName->setEnabled(FALSE); + mDAOwnerName->setEnabled(false); mDAObjectName->setValue(LLStringUtil::null); - mDAObjectName->setEnabled(FALSE); - mDAName->setEnabled(FALSE); - mDADescription->setEnabled(FALSE); + mDAObjectName->setEnabled(false); + mDAName->setEnabled(false); + mDADescription->setEnabled(false); mDAObjectDescription->setValue(LLStringUtil::null); - mDAObjectDescription->setEnabled(FALSE); + mDAObjectDescription->setEnabled(false); - mDAPathfindingAttributes->setEnabled(FALSE); + mDAPathfindingAttributes->setEnabled(false); mDAPathfindingAttributes->setValue(LLStringUtil::null); - mDAButtonSetGroup->setEnabled(FALSE); - mDAButtonDeed->setEnabled(FALSE); + mDAButtonSetGroup->setEnabled(false); + mDAButtonDeed->setEnabled(false); - mDAPermModify->setEnabled(FALSE); + mDAPermModify->setEnabled(false); mDAPermModify->setValue(LLStringUtil::null); mDAEditCost->setValue(LLStringUtil::null); mDAComboSaleType->setValue(LLSaleInfo::FS_COPY); @@ -236,12 +235,12 @@ void LLSidepanelTaskInfo::disableAll() if (mVisibleDebugPermissions) { - mDAB->setVisible(FALSE); - mDAO->setVisible(FALSE); - mDAG->setVisible(FALSE); - mDAE->setVisible(FALSE); - mDAN->setVisible(FALSE); - mDAF->setVisible(FALSE); + mDAB->setVisible(false); + mDAO->setVisible(false); + mDAG->setVisible(false); + mDAE->setVisible(false); + mDAN->setVisible(false); + mDAF->setVisible(false); LLFloater* parent_floater = gFloaterView->getParentFloater(this); LLRect parent_rect = parent_floater->getRect(); @@ -251,45 +250,45 @@ void LLSidepanelTaskInfo::disableAll() mVisibleDebugPermissions = false; } - mOpenBtn->setEnabled(FALSE); - mPayBtn->setEnabled(FALSE); - mBuyBtn->setEnabled(FALSE); + mOpenBtn->setEnabled(false); + mPayBtn->setEnabled(false); + mBuyBtn->setEnabled(false); } void LLSidepanelTaskInfo::disablePermissions() { - mDACheckboxShareWithGroup->setValue(FALSE); - mDACheckboxShareWithGroup->setEnabled(FALSE); + mDACheckboxShareWithGroup->setValue(false); + mDACheckboxShareWithGroup->setEnabled(false); - mDACheckboxAllowEveryoneMove->setValue(FALSE); - mDACheckboxAllowEveryoneMove->setEnabled(FALSE); - mDACheckboxAllowEveryoneCopy->setValue(FALSE); - mDACheckboxAllowEveryoneCopy->setEnabled(FALSE); + mDACheckboxAllowEveryoneMove->setValue(false); + mDACheckboxAllowEveryoneMove->setEnabled(false); + mDACheckboxAllowEveryoneCopy->setValue(false); + mDACheckboxAllowEveryoneCopy->setEnabled(false); //Next owner can: - mDACheckboxNextOwnerCanModify->setValue(FALSE); - mDACheckboxNextOwnerCanModify->setEnabled(FALSE); - mDACheckboxNextOwnerCanCopy->setValue(FALSE); - mDACheckboxNextOwnerCanCopy->setEnabled(FALSE); - mDACheckboxNextOwnerCanTransfer->setValue(FALSE); - mDACheckboxNextOwnerCanTransfer->setEnabled(FALSE); + mDACheckboxNextOwnerCanModify->setValue(false); + mDACheckboxNextOwnerCanModify->setEnabled(false); + mDACheckboxNextOwnerCanCopy->setValue(false); + mDACheckboxNextOwnerCanCopy->setEnabled(false); + mDACheckboxNextOwnerCanTransfer->setValue(false); + mDACheckboxNextOwnerCanTransfer->setEnabled(false); //checkbox for sale - mDACheckboxForSale->setValue(FALSE); - mDACheckboxForSale->setEnabled(FALSE); + mDACheckboxForSale->setValue(false); + mDACheckboxForSale->setEnabled(false); //checkbox include in search - mDASearchCheck->setValue(FALSE); - mDASearchCheck->setEnabled(FALSE); + mDASearchCheck->setValue(false); + mDASearchCheck->setEnabled(false); - mDAComboSaleType->setEnabled(FALSE); + mDAComboSaleType->setEnabled(false); - mDAEditCost->setEnabled(FALSE); + mDAEditCost->setEnabled(false); - mDALabelClickAction->setEnabled(FALSE); + mDALabelClickAction->setEnabled(false); if (mDAComboClickAction) { - mDAComboClickAction->setEnabled(FALSE); + mDAComboClickAction->setEnabled(false); mDAComboClickAction->clear(); } } @@ -314,14 +313,14 @@ void LLSidepanelTaskInfo::refresh() btn_deed_to_group->setLabelUnselected(deedText); } - BOOL root_selected = TRUE; + bool root_selected = true; LLSelectNode* nodep = mObjectSelection->getFirstRootNode(); S32 object_count = mObjectSelection->getRootObjectCount(); if (!nodep || (object_count == 0)) { nodep = mObjectSelection->getFirstNode(); object_count = mObjectSelection->getObjectCount(); - root_selected = FALSE; + root_selected = false; } LLViewerObject* objectp = NULL; @@ -338,12 +337,12 @@ void LLSidepanelTaskInfo::refresh() } // figure out a few variables - const BOOL is_one_object = (object_count == 1); + const bool is_one_object = (object_count == 1); // BUG: fails if a root and non-root are both single-selected. - const BOOL is_perm_modify = (mObjectSelection->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsModify()) || + const bool is_perm_modify = (mObjectSelection->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsModify()) || LLSelectMgr::getInstance()->selectGetModify(); - const BOOL is_nonpermanent_enforced = (mObjectSelection->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsNonPermanentEnforced()) || + const bool is_nonpermanent_enforced = (mObjectSelection->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsNonPermanentEnforced()) || LLSelectMgr::getInstance()->selectGetNonPermanentEnforced(); S32 string_index = 0; @@ -368,7 +367,7 @@ void LLSidepanelTaskInfo::refresh() { ++string_index; } - getChildView("perm_modify")->setEnabled(TRUE); + getChildView("perm_modify")->setEnabled(true); getChild<LLUICtrl>("perm_modify")->setValue(MODIFY_INFO_STRINGS[string_index]); std::string pfAttrName; @@ -396,11 +395,11 @@ void LLSidepanelTaskInfo::refresh() pfAttrName = "Pathfinding_Object_Attr_MultiSelect"; } - mDAPathfindingAttributes->setEnabled(TRUE); + mDAPathfindingAttributes->setEnabled(true); mDAPathfindingAttributes->setValue(LLTrans::getString(pfAttrName)); // Update creator text field - getChildView("Creator:")->setEnabled(TRUE); + getChildView("Creator:")->setEnabled(true); std::string creator_name; LLUUID creator_id; @@ -415,14 +414,14 @@ void LLSidepanelTaskInfo::refresh() { mDACreatorName->setValue(creator_name); } - mDACreatorName->setEnabled(TRUE); + mDACreatorName->setEnabled(true); // Update owner text field - getChildView("Owner:")->setEnabled(TRUE); + getChildView("Owner:")->setEnabled(true); std::string owner_name; LLUUID owner_id; - const BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); + const bool owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); if (owner_id.isNull()) { if (LLSelectMgr::getInstance()->selectIsGroupOwned()) @@ -455,36 +454,36 @@ void LLSidepanelTaskInfo::refresh() mDAOwnerName->setValue(owner_name); } - getChildView("Owner Name")->setEnabled(TRUE); + getChildView("Owner Name")->setEnabled(true); // update group text field - getChildView("Group:")->setEnabled(TRUE); + getChildView("Group:")->setEnabled(true); getChild<LLUICtrl>("Group Name")->setValue(LLStringUtil::null); LLUUID group_id; - BOOL groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id); + bool groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id); if (groups_identical) { if (mLabelGroupName) { - mLabelGroupName->setNameID(group_id,TRUE); - mLabelGroupName->setEnabled(TRUE); + mLabelGroupName->setNameID(group_id,true); + mLabelGroupName->setEnabled(true); } } else { if (mLabelGroupName) { - mLabelGroupName->setNameID(LLUUID::null, TRUE); + mLabelGroupName->setNameID(LLUUID::null, true); mLabelGroupName->refresh(LLUUID::null, std::string(), true); - mLabelGroupName->setEnabled(FALSE); + mLabelGroupName->setEnabled(false); } } getChildView("button set group")->setEnabled(owners_identical && (mOwnerID == gAgent.getID()) && is_nonpermanent_enforced); - getChildView("Name:")->setEnabled(TRUE); + getChildView("Name:")->setEnabled(true); LLLineEditor* LineEditorObjectName = getChild<LLLineEditor>("Object Name"); - getChildView("Description:")->setEnabled(TRUE); + getChildView("Description:")->setEnabled(true); LLLineEditor* LineEditorObjectDesc = getChild<LLLineEditor>("Object Description"); if (is_one_object) @@ -509,44 +508,44 @@ void LLSidepanelTaskInfo::refresh() } // figure out the contents of the name, description, & category - BOOL edit_name_desc = FALSE; + bool edit_name_desc = false; if (is_one_object && objectp->permModify() && !objectp->isPermanentEnforced()) { - edit_name_desc = TRUE; + edit_name_desc = true; } if (edit_name_desc) { - getChildView("Object Name")->setEnabled(TRUE); - getChildView("Object Description")->setEnabled(TRUE); + getChildView("Object Name")->setEnabled(true); + getChildView("Object Description")->setEnabled(true); } else { - getChildView("Object Name")->setEnabled(FALSE); - getChildView("Object Description")->setEnabled(FALSE); + getChildView("Object Name")->setEnabled(false); + getChildView("Object Description")->setEnabled(false); } S32 total_sale_price = 0; S32 individual_sale_price = 0; - BOOL is_for_sale_mixed = FALSE; - BOOL is_sale_price_mixed = FALSE; - U32 num_for_sale = FALSE; + bool is_for_sale_mixed = false; + bool is_sale_price_mixed = false; + U32 num_for_sale = false; LLSelectMgr::getInstance()->selectGetAggregateSaleInfo(num_for_sale, is_for_sale_mixed, is_sale_price_mixed, total_sale_price, individual_sale_price); - const BOOL self_owned = (gAgent.getID() == mOwnerID); - const BOOL group_owned = LLSelectMgr::getInstance()->selectIsGroupOwned() ; - const BOOL public_owned = (mOwnerID.isNull() && !LLSelectMgr::getInstance()->selectIsGroupOwned()); - const BOOL can_transfer = LLSelectMgr::getInstance()->selectGetRootsTransfer(); - const BOOL can_copy = LLSelectMgr::getInstance()->selectGetRootsCopy(); + const bool self_owned = (gAgent.getID() == mOwnerID); + const bool group_owned = LLSelectMgr::getInstance()->selectIsGroupOwned() ; + const bool public_owned = (mOwnerID.isNull() && !LLSelectMgr::getInstance()->selectIsGroupOwned()); + const bool can_transfer = LLSelectMgr::getInstance()->selectGetRootsTransfer(); + const bool can_copy = LLSelectMgr::getInstance()->selectGetRootsCopy(); if (!owners_identical) { - getChildView("Cost")->setEnabled(FALSE); + getChildView("Cost")->setEnabled(false); getChild<LLUICtrl>("Edit Cost")->setValue(LLStringUtil::null); - getChildView("Edit Cost")->setEnabled(FALSE); + getChildView("Edit Cost")->setEnabled(false); } // You own these objects. else if (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id,GP_OBJECT_SET_SALE))) @@ -570,11 +569,11 @@ void LLSidepanelTaskInfo::refresh() // set to the actual cost. if ((num_for_sale > 0) && is_for_sale_mixed) { - edit_price->setTentative(TRUE); + edit_price->setTentative(true); } else if ((num_for_sale > 0) && is_sale_price_mixed) { - edit_price->setTentative(TRUE); + edit_price->setTentative(true); } else { @@ -583,15 +582,15 @@ void LLSidepanelTaskInfo::refresh() } // The edit fields are only enabled if you can sell this object // and the sale price is not mixed. - BOOL enable_edit = (num_for_sale && can_transfer) ? !is_for_sale_mixed : FALSE; + bool enable_edit = (num_for_sale && can_transfer) ? !is_for_sale_mixed : false; getChildView("Cost")->setEnabled(enable_edit); getChildView("Edit Cost")->setEnabled(enable_edit); } // Someone, not you, owns these objects. else if (!public_owned) { - getChildView("Cost")->setEnabled(FALSE); - getChildView("Edit Cost")->setEnabled(FALSE); + getChildView("Cost")->setEnabled(false); + getChildView("Edit Cost")->setEnabled(false); // Don't show a price if none of the items are for sale. if (num_for_sale) @@ -608,10 +607,10 @@ void LLSidepanelTaskInfo::refresh() // This is a public object. else { - getChildView("Cost")->setEnabled(FALSE); + getChildView("Cost")->setEnabled(false); getChild<LLSpinCtrl>("Edit Cost")->setLabel(getString("Cost Default")); getChild<LLUICtrl>("Edit Cost")->setValue(LLStringUtil::null); - getChildView("Edit Cost")->setEnabled(FALSE); + getChildView("Edit Cost")->setEnabled(false); } // Enable and disable the permissions checkboxes @@ -629,22 +628,22 @@ void LLSidepanelTaskInfo::refresh() U32 next_owner_mask_on = 0; U32 next_owner_mask_off = 0; - BOOL valid_base_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_BASE, + bool valid_base_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_BASE, &base_mask_on, &base_mask_off); - //BOOL valid_owner_perms =// + //bool valid_owner_perms =// LLSelectMgr::getInstance()->selectGetPerm(PERM_OWNER, &owner_mask_on, &owner_mask_off); - BOOL valid_group_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_GROUP, + bool valid_group_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_GROUP, &group_mask_on, &group_mask_off); - BOOL valid_everyone_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_EVERYONE, + bool valid_everyone_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_EVERYONE, &everyone_mask_on, &everyone_mask_off); - BOOL valid_next_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_NEXT_OWNER, + bool valid_next_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_NEXT_OWNER, &next_owner_mask_on, &next_owner_mask_off); @@ -654,19 +653,19 @@ void LLSidepanelTaskInfo::refresh() if (valid_base_perms) { mDAB->setValue("B: " + mask_to_string(base_mask_on)); - mDAB->setVisible( TRUE); + mDAB->setVisible( true); mDAO->setValue("O: " + mask_to_string(owner_mask_on)); - mDAO->setVisible( TRUE); + mDAO->setVisible( true); mDAG->setValue("G: " + mask_to_string(group_mask_on)); - mDAG->setVisible( TRUE); + mDAG->setVisible( true); mDAE->setValue("E: " + mask_to_string(everyone_mask_on)); - mDAE->setVisible( TRUE); + mDAE->setVisible( true); mDAN->setValue("N: " + mask_to_string(next_owner_mask_on)); - mDAN->setVisible( TRUE); + mDAN->setVisible( true); } U32 flag_mask = 0x0; @@ -676,7 +675,7 @@ void LLSidepanelTaskInfo::refresh() if (objectp->permTransfer()) flag_mask |= PERM_TRANSFER; mDAF->setValue("F:" + mask_to_string(flag_mask)); - mDAF->setVisible(TRUE); + mDAF->setVisible(true); if (!mVisibleDebugPermissions) { @@ -690,12 +689,12 @@ void LLSidepanelTaskInfo::refresh() } else if (mVisibleDebugPermissions) { - mDAB->setVisible(FALSE); - mDAO->setVisible(FALSE); - mDAG->setVisible(FALSE); - mDAE->setVisible(FALSE); - mDAN->setVisible(FALSE); - mDAF->setVisible(FALSE); + mDAB->setVisible(false); + mDAO->setVisible(false); + mDAG->setVisible(false); + mDAE->setVisible(false); + mDAN->setVisible(false); + mDAF->setVisible(false); LLFloater* parent_floater = gFloaterView->getParentFloater(this); LLRect parent_rect = parent_floater->getRect(); @@ -705,18 +704,18 @@ void LLSidepanelTaskInfo::refresh() mVisibleDebugPermissions = false; } - BOOL has_change_perm_ability = FALSE; - BOOL has_change_sale_ability = FALSE; + bool has_change_perm_ability = false; + bool has_change_sale_ability = false; if (valid_base_perms && is_nonpermanent_enforced && (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_MANIPULATE)))) { - has_change_perm_ability = TRUE; + has_change_perm_ability = true; } if (valid_base_perms && is_nonpermanent_enforced && (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_SET_SALE)))) { - has_change_sale_ability = TRUE; + has_change_sale_ability = true; } if (!has_change_perm_ability && !has_change_sale_ability && !root_selected) @@ -727,15 +726,15 @@ void LLSidepanelTaskInfo::refresh() if (has_change_perm_ability) { - getChildView("checkbox share with group")->setEnabled(TRUE); + getChildView("checkbox share with group")->setEnabled(true); getChildView("checkbox allow everyone move")->setEnabled(owner_mask_on & PERM_MOVE); getChildView("checkbox allow everyone copy")->setEnabled(owner_mask_on & PERM_COPY && owner_mask_on & PERM_TRANSFER); } else { - getChildView("checkbox share with group")->setEnabled(FALSE); - getChildView("checkbox allow everyone move")->setEnabled(FALSE); - getChildView("checkbox allow everyone copy")->setEnabled(FALSE); + getChildView("checkbox share with group")->setEnabled(false); + getChildView("checkbox allow everyone move")->setEnabled(false); + getChildView("checkbox allow everyone copy")->setEnabled(false); } if (has_change_sale_ability && (owner_mask_on & PERM_TRANSFER)) @@ -752,32 +751,32 @@ void LLSidepanelTaskInfo::refresh() } else { - getChildView("checkbox for sale")->setEnabled(FALSE); - getChildView("sale type")->setEnabled(FALSE); + getChildView("checkbox for sale")->setEnabled(false); + getChildView("sale type")->setEnabled(false); - getChildView("checkbox next owner can modify")->setEnabled(FALSE); - getChildView("checkbox next owner can copy")->setEnabled(FALSE); - getChildView("checkbox next owner can transfer")->setEnabled(FALSE); + getChildView("checkbox next owner can modify")->setEnabled(false); + getChildView("checkbox next owner can copy")->setEnabled(false); + getChildView("checkbox next owner can transfer")->setEnabled(false); } if (valid_group_perms) { if ((group_mask_on & PERM_COPY) && (group_mask_on & PERM_MODIFY) && (group_mask_on & PERM_MOVE)) { - getChild<LLUICtrl>("checkbox share with group")->setValue(TRUE); - getChild<LLUICtrl>("checkbox share with group")->setTentative( FALSE); + getChild<LLUICtrl>("checkbox share with group")->setValue(true); + getChild<LLUICtrl>("checkbox share with group")->setTentative( false); getChildView("button deed")->setEnabled(gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && (owner_mask_on & PERM_TRANSFER) && !group_owned && can_transfer); } else if ((group_mask_off & PERM_COPY) && (group_mask_off & PERM_MODIFY) && (group_mask_off & PERM_MOVE)) { - getChild<LLUICtrl>("checkbox share with group")->setValue(FALSE); - getChild<LLUICtrl>("checkbox share with group")->setTentative( FALSE); - getChildView("button deed")->setEnabled(FALSE); + getChild<LLUICtrl>("checkbox share with group")->setValue(false); + getChild<LLUICtrl>("checkbox share with group")->setTentative( false); + getChildView("button deed")->setEnabled(false); } else { - getChild<LLUICtrl>("checkbox share with group")->setValue(TRUE); - getChild<LLUICtrl>("checkbox share with group")->setTentative( TRUE); + getChild<LLUICtrl>("checkbox share with group")->setValue(true); + getChild<LLUICtrl>("checkbox share with group")->setTentative( true); getChildView("button deed")->setEnabled(gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && (group_mask_on & PERM_MOVE) && (owner_mask_on & PERM_TRANSFER) && !group_owned && can_transfer); } } @@ -787,35 +786,35 @@ void LLSidepanelTaskInfo::refresh() // Move if (everyone_mask_on & PERM_MOVE) { - getChild<LLUICtrl>("checkbox allow everyone move")->setValue(TRUE); - getChild<LLUICtrl>("checkbox allow everyone move")->setTentative( FALSE); + getChild<LLUICtrl>("checkbox allow everyone move")->setValue(true); + getChild<LLUICtrl>("checkbox allow everyone move")->setTentative( false); } else if (everyone_mask_off & PERM_MOVE) { - getChild<LLUICtrl>("checkbox allow everyone move")->setValue(FALSE); - getChild<LLUICtrl>("checkbox allow everyone move")->setTentative( FALSE); + getChild<LLUICtrl>("checkbox allow everyone move")->setValue(false); + getChild<LLUICtrl>("checkbox allow everyone move")->setTentative( false); } else { - getChild<LLUICtrl>("checkbox allow everyone move")->setValue(TRUE); - getChild<LLUICtrl>("checkbox allow everyone move")->setTentative( TRUE); + getChild<LLUICtrl>("checkbox allow everyone move")->setValue(true); + getChild<LLUICtrl>("checkbox allow everyone move")->setTentative( true); } // Copy == everyone can't copy if (everyone_mask_on & PERM_COPY) { - getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(TRUE); + getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(true); getChild<LLUICtrl>("checkbox allow everyone copy")->setTentative( !can_copy || !can_transfer); } else if (everyone_mask_off & PERM_COPY) { - getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(FALSE); - getChild<LLUICtrl>("checkbox allow everyone copy")->setTentative( FALSE); + getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(false); + getChild<LLUICtrl>("checkbox allow everyone copy")->setTentative( false); } else { - getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(TRUE); - getChild<LLUICtrl>("checkbox allow everyone copy")->setTentative( TRUE); + getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(true); + getChild<LLUICtrl>("checkbox allow everyone copy")->setTentative( true); } } @@ -824,71 +823,71 @@ void LLSidepanelTaskInfo::refresh() // Modify == next owner canot modify if (next_owner_mask_on & PERM_MODIFY) { - getChild<LLUICtrl>("checkbox next owner can modify")->setValue(TRUE); - getChild<LLUICtrl>("checkbox next owner can modify")->setTentative( FALSE); + getChild<LLUICtrl>("checkbox next owner can modify")->setValue(true); + getChild<LLUICtrl>("checkbox next owner can modify")->setTentative( false); } else if (next_owner_mask_off & PERM_MODIFY) { - getChild<LLUICtrl>("checkbox next owner can modify")->setValue(FALSE); - getChild<LLUICtrl>("checkbox next owner can modify")->setTentative( FALSE); + getChild<LLUICtrl>("checkbox next owner can modify")->setValue(false); + getChild<LLUICtrl>("checkbox next owner can modify")->setTentative( false); } else { - getChild<LLUICtrl>("checkbox next owner can modify")->setValue(TRUE); - getChild<LLUICtrl>("checkbox next owner can modify")->setTentative( TRUE); + getChild<LLUICtrl>("checkbox next owner can modify")->setValue(true); + getChild<LLUICtrl>("checkbox next owner can modify")->setTentative( true); } // Copy == next owner cannot copy if (next_owner_mask_on & PERM_COPY) { - getChild<LLUICtrl>("checkbox next owner can copy")->setValue(TRUE); + getChild<LLUICtrl>("checkbox next owner can copy")->setValue(true); getChild<LLUICtrl>("checkbox next owner can copy")->setTentative( !can_copy); } else if (next_owner_mask_off & PERM_COPY) { - getChild<LLUICtrl>("checkbox next owner can copy")->setValue(FALSE); - getChild<LLUICtrl>("checkbox next owner can copy")->setTentative( FALSE); + getChild<LLUICtrl>("checkbox next owner can copy")->setValue(false); + getChild<LLUICtrl>("checkbox next owner can copy")->setTentative( false); } else { - getChild<LLUICtrl>("checkbox next owner can copy")->setValue(TRUE); - getChild<LLUICtrl>("checkbox next owner can copy")->setTentative( TRUE); + getChild<LLUICtrl>("checkbox next owner can copy")->setValue(true); + getChild<LLUICtrl>("checkbox next owner can copy")->setTentative( true); } // Transfer == next owner cannot transfer if (next_owner_mask_on & PERM_TRANSFER) { - getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(TRUE); + getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(true); getChild<LLUICtrl>("checkbox next owner can transfer")->setTentative( !can_transfer); } else if (next_owner_mask_off & PERM_TRANSFER) { - getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(FALSE); - getChild<LLUICtrl>("checkbox next owner can transfer")->setTentative( FALSE); + getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(false); + getChild<LLUICtrl>("checkbox next owner can transfer")->setTentative( false); } else { - getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(TRUE); - getChild<LLUICtrl>("checkbox next owner can transfer")->setTentative( TRUE); + getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(true); + getChild<LLUICtrl>("checkbox next owner can transfer")->setTentative( true); } } // reflect sale information LLSaleInfo sale_info; - BOOL valid_sale_info = LLSelectMgr::getInstance()->selectGetSaleInfo(sale_info); + bool valid_sale_info = LLSelectMgr::getInstance()->selectGetSaleInfo(sale_info); LLSaleInfo::EForSale sale_type = sale_info.getSaleType(); LLComboBox* combo_sale_type = getChild<LLComboBox>("sale type"); if (valid_sale_info) { combo_sale_type->setValue( sale_type == LLSaleInfo::FS_NOT ? LLSaleInfo::FS_COPY : sale_type); - combo_sale_type->setTentative( FALSE); // unfortunately this doesn't do anything at the moment. + combo_sale_type->setTentative( false); // unfortunately this doesn't do anything at the moment. } else { // default option is sell copy, determined to be safest combo_sale_type->setValue( LLSaleInfo::FS_COPY); - combo_sale_type->setTentative( TRUE); // unfortunately this doesn't do anything at the moment. + combo_sale_type->setTentative( true); // unfortunately this doesn't do anything at the moment. } getChild<LLUICtrl>("checkbox for sale")->setValue((num_for_sale != 0)); @@ -906,9 +905,9 @@ void LLSidepanelTaskInfo::refresh() } // Check search status of objects - const BOOL all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ); + const bool all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ); bool include_in_search; - const BOOL all_include_in_search = LLSelectMgr::getInstance()->selectionGetIncludeInSearch(&include_in_search); + const bool all_include_in_search = LLSelectMgr::getInstance()->selectionGetIncludeInSearch(&include_in_search); getChildView("search_check")->setEnabled(has_change_sale_ability && all_volume); getChild<LLUICtrl>("search_check")->setValue(include_in_search); getChild<LLUICtrl>("search_check")->setTentative(!all_include_in_search); @@ -944,7 +943,7 @@ void LLSidepanelTaskInfo::onClickGroup() { LLUUID owner_id; std::string name; - BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, name); + bool owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, name); LLFloater* parent_floater = gFloaterView->getParentFloater(this); if (owners_identical && (owner_id == gAgent.getID())) @@ -967,7 +966,7 @@ void LLSidepanelTaskInfo::cbGroupID(LLUUID group_id) { if (mLabelGroupName) { - mLabelGroupName->setNameID(group_id, TRUE); + mLabelGroupName->setNameID(group_id, true); } LLSelectMgr::getInstance()->sendGroup(group_id); } @@ -978,13 +977,13 @@ static bool callback_deed_to_group(const LLSD& notification, const LLSD& respons if (option == 0) { LLUUID group_id; - const BOOL groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id); + const bool groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id); if (group_id.notNull() && groups_identical && (gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED))) { - LLSelectMgr::getInstance()->sendOwner(LLUUID::null, group_id, FALSE); + LLSelectMgr::getInstance()->sendOwner(LLUUID::null, group_id, false); } } - return FALSE; + return false; } void LLSidepanelTaskInfo::onClickDeedToGroup(void *data) @@ -1005,7 +1004,7 @@ void LLSidepanelTaskInfo::onCommitPerm(LLUICtrl *ctrl, void *data, U8 field, U32 // Checkbox will have toggled itself // LLSidepanelTaskInfo* self = (LLSidepanelTaskInfo*)data; LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl; - BOOL new_state = check->get(); + bool new_state = check->get(); LLSelectMgr::getInstance()->selectionSetObjectPermissions(field, new_state, perm); @@ -1237,7 +1236,7 @@ void LLSidepanelTaskInfo::onCommitIncludeInSearch(LLUICtrl* ctrl, void* data) void LLSidepanelTaskInfo::updateVerbs() { LLSafeHandle<LLObjectSelection> object_selection = LLSelectMgr::getInstance()->getSelection(); - const BOOL any_selected = (object_selection->getNumNodes() > 0); + const bool any_selected = (object_selection->getNumNodes() > 0); mOpenBtn->setVisible(true); mPayBtn->setVisible(true); @@ -1299,12 +1298,12 @@ void LLSidepanelTaskInfo::refreshAll() if (hasFocus()) { focus = gFocusMgr.getKeyboardFocus(); - setFocus(FALSE); + setFocus(false); } refresh(); if (focus) { - focus->setFocus(TRUE); + focus->setFocus(true); } } diff --git a/indra/newview/llsidepaneltaskinfo.h b/indra/newview/llsidepaneltaskinfo.h index ea457cebe5..3816bb8381 100644 --- a/indra/newview/llsidepaneltaskinfo.h +++ b/indra/newview/llsidepaneltaskinfo.h @@ -49,8 +49,8 @@ public: LLSidepanelTaskInfo(); virtual ~LLSidepanelTaskInfo(); - BOOL postBuild() override; - void onVisibilityChange ( BOOL new_visibility ) override; + bool postBuild() override; + void onVisibilityChange (bool new_visibility) override; void setObjectSelection(LLObjectSelectionHandle selection); diff --git a/indra/newview/llsidetraypanelcontainer.cpp b/indra/newview/llsidetraypanelcontainer.cpp index bf11b08f64..eb8e05ec27 100644 --- a/indra/newview/llsidetraypanelcontainer.cpp +++ b/indra/newview/llsidetraypanelcontainer.cpp @@ -81,12 +81,12 @@ void LLSideTrayPanelContainer::openPreviousPanel() } } -BOOL LLSideTrayPanelContainer::handleKeyHere(KEY key, MASK mask) +bool LLSideTrayPanelContainer::handleKeyHere(KEY key, MASK mask) { // No key press handling code for Panel Container - this disables // Tab Container's Alt + Left/Right Button tab switching. - // Let default handler process key presses, don't simply return TRUE or FALSE + // Let default handler process key presses, don't simply return true or false // as this may brake some functionality as it did with Copy/Paste for // text_editor (ticket EXT-642). return LLPanel::handleKeyHere(key, mask); diff --git a/indra/newview/llsidetraypanelcontainer.h b/indra/newview/llsidetraypanelcontainer.h index a31a3640d8..5dfd7f2d83 100644 --- a/indra/newview/llsidetraypanelcontainer.h +++ b/indra/newview/llsidetraypanelcontainer.h @@ -31,7 +31,7 @@ /** * LLSideTrayPanelContainer class acts like LLTabContainer with invisible tabs. -* It is designed to make panel switching easier, avoid setVisible(TRUE) setVisible(FALSE) +* It is designed to make panel switching easier, avoid setVisible(true) setVisible(false) * calls and related workarounds. * use onOpen to open sub panel, pass the name of panel to open * in key[PARAM_SUB_PANEL_NAME]. @@ -70,7 +70,7 @@ public: * Overrides LLTabContainer::handleKeyHere to disable panel switch on * Alt + Left/Right button press. */ - BOOL handleKeyHere(KEY key, MASK mask); + bool handleKeyHere(KEY key, MASK mask); /** * Name of parameter that stores panel name to open. diff --git a/indra/newview/llskinningutil.cpp b/indra/newview/llskinningutil.cpp index 438b04ff39..9b4ed4c946 100644 --- a/indra/newview/llskinningutil.cpp +++ b/indra/newview/llskinningutil.cpp @@ -97,6 +97,12 @@ U32 LLSkinningUtil::getMeshJointCount(const LLMeshSkinInfo *skin) return llmin((U32)getMaxJointCount(), (U32)skin->mJointNames.size()); } +S32 LLSkinningUtil::getMaxGLTFJointCount() +{ + // this is the maximum number of 3x4 matrices than can fit in a UBO + return gGLManager.mMaxUniformBlockSize / 48; +} + void LLSkinningUtil::scrubInvalidJoints(LLVOAvatar *avatar, LLMeshSkinInfo* skin) { if (skin->mInvalidJointsScrubbed) @@ -131,7 +137,7 @@ void LLSkinningUtil::initSkinningMatrixPalette( LLMatrix4a world[LL_CHARACTER_MAX_ANIMATED_JOINTS]; - for (U32 j = 0; j < count; ++j) + for (S32 j = 0; j < count; ++j) { S32 joint_num = skin->mJointNums[j]; LLJoint *joint = avatar->getJoint(joint_num); @@ -194,7 +200,7 @@ void LLSkinningUtil::checkSkinWeights(LLVector4a* weights, U32 num_vertices, con void LLSkinningUtil::scrubSkinWeights(LLVector4a* weights, U32 num_vertices, const LLMeshSkinInfo* skin) { - const S32 max_joints = skin->mJointNames.size(); + const S32 max_joints = static_cast<S32>(skin->mJointNames.size()); for (U32 j=0; j<num_vertices; j++) { F32 *w = weights[j].getF32ptr(); @@ -318,7 +324,7 @@ void LLSkinningUtil::updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *a if (vol_face.mJointRiggingInfoTab.needsUpdate()) { S32 num_verts = vol_face.mNumVertices; - S32 num_joints = skin->mJointNames.size(); + S32 num_joints = static_cast<S32>(skin->mJointNames.size()); if (num_verts > 0 && vol_face.mWeights && num_joints > 0) { initJointNums(const_cast<LLMeshSkinInfo*>(skin), avatar); diff --git a/indra/newview/llskinningutil.h b/indra/newview/llskinningutil.h index bd2f8ea04e..aa0c0075af 100644 --- a/indra/newview/llskinningutil.h +++ b/indra/newview/llskinningutil.h @@ -40,6 +40,7 @@ class LLJointRiggingInfoTab; namespace LLSkinningUtil { S32 getMaxJointCount(); + S32 getMaxGLTFJointCount(); U32 getMeshJointCount(const LLMeshSkinInfo *skin); void scrubInvalidJoints(LLVOAvatar *avatar, LLMeshSkinInfo* skin); void initSkinningMatrixPalette(LLMatrix4a* mat, S32 count, const LLMeshSkinInfo* skin, LLVOAvatar *avatar); diff --git a/indra/newview/llsky.cpp b/indra/newview/llsky.cpp index dc784662e9..82caa14433 100644 --- a/indra/newview/llsky.cpp +++ b/indra/newview/llsky.cpp @@ -73,7 +73,7 @@ LLSky::LLSky() mFogColor.mV[VALPHA] = 0.0f; mLightingGeneration = 0; - mUpdatedThisFrame = TRUE; + mUpdatedThisFrame = true; } @@ -207,7 +207,7 @@ void LLSky::init() gSky.setFogRatio(gSavedSettings.getF32("RenderFogRatio")); - mUpdatedThisFrame = TRUE; + mUpdatedThisFrame = true; } diff --git a/indra/newview/llsky.h b/indra/newview/llsky.h index 4ece232156..32599dcee2 100644 --- a/indra/newview/llsky.h +++ b/indra/newview/llsky.h @@ -72,7 +72,7 @@ public: void updateSky(); S32 mLightingGeneration; - BOOL mUpdatedThisFrame; + bool mUpdatedThisFrame; void setFogRatio(const F32 fog_ratio); // Fog distance as fraction of cull distance. F32 getFogRatio() const; diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp index ef0f58ff7a..787dd3b667 100644 --- a/indra/newview/llsnapshotlivepreview.cpp +++ b/indra/newview/llsnapshotlivepreview.cpp @@ -56,16 +56,16 @@ #include "llworld.h" #include <boost/filesystem.hpp> -const F32 AUTO_SNAPSHOT_TIME_DELAY = 1.f; +constexpr F32 AUTO_SNAPSHOT_TIME_DELAY = 1.f; -F32 SHINE_TIME = 0.5f; -F32 SHINE_WIDTH = 0.6f; -F32 SHINE_OPACITY = 0.3f; -F32 FALL_TIME = 0.6f; -S32 BORDER_WIDTH = 6; -S32 TOP_PANEL_HEIGHT = 30; +constexpr F32 SHINE_TIME = 0.5f; +constexpr F32 SHINE_WIDTH = 0.6f; +constexpr F32 SHINE_OPACITY = 0.3f; +constexpr F32 FALL_TIME = 0.6f; +constexpr S32 BORDER_WIDTH = 6; +constexpr S32 TOP_PANEL_HEIGHT = 30; -const S32 MAX_TEXTURE_SIZE = 512 ; //max upload texture size 512 * 512 +constexpr S32 MAX_TEXTURE_SIZE = 512 ; //max upload texture size 512 * 512 std::set<LLSnapshotLivePreview*> LLSnapshotLivePreview::sList; LLPointer<LLImageFormatted> LLSnapshotLivePreview::sSaveLocalImage = NULL; @@ -79,24 +79,24 @@ LLSnapshotLivePreview::LLSnapshotLivePreview (const LLSnapshotLivePreview::Param mBigThumbnailImage(NULL) , mThumbnailWidth(0), mThumbnailHeight(0), - mThumbnailSubsampled(FALSE), + mThumbnailSubsampled(false), mPreviewImageEncoded(NULL), mFormattedImage(NULL), mShineCountdown(0), mFlashAlpha(0.f), - mNeedsFlash(TRUE), + mNeedsFlash(true), mSnapshotQuality(gSavedSettings.getS32("SnapshotQuality")), mDataSize(0), mSnapshotType(LLSnapshotModel::SNAPSHOT_POSTCARD), mSnapshotFormat(LLSnapshotModel::ESnapshotFormat(gSavedSettings.getS32("SnapshotFormat"))), - mSnapshotUpToDate(FALSE), + mSnapshotUpToDate(false), mCameraPos(LLViewerCamera::getInstance()->getOrigin()), mCameraRot(LLViewerCamera::getInstance()->getQuaternion()), - mSnapshotActive(FALSE), + mSnapshotActive(false), mSnapshotBufferType(LLSnapshotModel::SNAPSHOT_TYPE_COLOR), mFilterName(""), - mAllowRenderUI(TRUE), - mAllowFullScreenPreview(TRUE), + mAllowRenderUI(true), + mAllowFullScreenPreview(true), mViewContainer(NULL) { setSnapshotQuality(gSavedSettings.getS32("SnapshotQuality")); @@ -109,16 +109,16 @@ LLSnapshotLivePreview::LLSnapshotLivePreview (const LLSnapshotLivePreview::Param mWidth[1] = gViewerWindow->getWindowWidthRaw(); mHeight[0] = gViewerWindow->getWindowHeightRaw(); mHeight[1] = gViewerWindow->getWindowHeightRaw(); - mImageScaled[0] = FALSE; - mImageScaled[1] = FALSE; + mImageScaled[0] = false; + mImageScaled[1] = false; mMaxImageSize = MAX_SNAPSHOT_IMAGE_SIZE ; mKeepAspectRatio = gSavedSettings.getBOOL("KeepAspectForSnapshot") ; - mThumbnailUpdateLock = FALSE ; - mThumbnailUpToDate = FALSE ; - mBigThumbnailUpToDate = FALSE ; + mThumbnailUpdateLock = false ; + mThumbnailUpToDate = false ; + mBigThumbnailUpToDate = false ; - mForceUpdateSnapshot = FALSE; + mForceUpdateSnapshot = false; } LLSnapshotLivePreview::~LLSnapshotLivePreview() @@ -153,7 +153,7 @@ F32 LLSnapshotLivePreview::getImageAspect() return (mKeepAspectRatio ? ((F32)getRect().getWidth()) / ((F32)getRect().getHeight()) : ((F32)getWidth()) / ((F32)getHeight())); } -void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail, F32 delay) +void LLSnapshotLivePreview::updateSnapshot(bool new_snapshot, bool new_thumbnail, F32 delay) { LL_DEBUGS("Snapshot") << "updateSnapshot: mSnapshotUpToDate = " << getSnapshotUpToDate() << LL_ENDL; @@ -167,7 +167,7 @@ void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail setSize(mWidth[old_image_index], mHeight[old_image_index]); mFallAnimTimer.start(); } - mSnapshotUpToDate = FALSE; + mSnapshotUpToDate = false; // Update snapshot source rect depending on whether we keep the aspect ratio. LLRect& rect = mImageRect[mCurImageIndex]; @@ -212,8 +212,8 @@ void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail // Update thumbnail if requested. if (new_thumbnail) { - mThumbnailUpToDate = FALSE ; - mBigThumbnailUpToDate = FALSE; + mThumbnailUpToDate = false ; + mBigThumbnailUpToDate = false; } } @@ -241,7 +241,7 @@ void LLSnapshotLivePreview::drawPreviewRect(S32 offset_x, S32 offset_y, LLColor4 glLineWidth(2.0f * line_width) ; LLColor4 color(0.0f, 0.0f, 0.0f, 1.0f) ; gl_rect_2d( mPreviewRect.mLeft + offset_x, mPreviewRect.mTop + offset_y, - mPreviewRect.mRight + offset_x, mPreviewRect.mBottom + offset_y, color, FALSE ) ; + mPreviewRect.mRight + offset_x, mPreviewRect.mBottom + offset_y, color, false ) ; glLineWidth(line_width) ; //draw four alpha rectangles to cover areas outside of the snapshot image @@ -254,20 +254,20 @@ void LLSnapshotLivePreview::drawPreviewRect(S32 offset_x, S32 offset_y, LLColor4 dwr = mThumbnailWidth - mPreviewRect.getWidth() - dwl ; gl_rect_2d(mPreviewRect.mLeft + offset_x - dwl, mPreviewRect.mTop + offset_y, - mPreviewRect.mLeft + offset_x, mPreviewRect.mBottom + offset_y, alpha_color, TRUE ) ; + mPreviewRect.mLeft + offset_x, mPreviewRect.mBottom + offset_y, alpha_color, true ) ; gl_rect_2d( mPreviewRect.mRight + offset_x, mPreviewRect.mTop + offset_y, - mPreviewRect.mRight + offset_x + dwr, mPreviewRect.mBottom + offset_y, alpha_color, TRUE ) ; + mPreviewRect.mRight + offset_x + dwr, mPreviewRect.mBottom + offset_y, alpha_color, true ) ; } if(mThumbnailHeight > mPreviewRect.getHeight()) { S32 dh = (mThumbnailHeight - mPreviewRect.getHeight()) >> 1 ; gl_rect_2d(mPreviewRect.mLeft + offset_x - dwl, mPreviewRect.mBottom + offset_y , - mPreviewRect.mRight + offset_x + dwr, mPreviewRect.mBottom + offset_y - dh, alpha_color, TRUE ) ; + mPreviewRect.mRight + offset_x + dwr, mPreviewRect.mBottom + offset_y - dh, alpha_color, true ) ; dh = mThumbnailHeight - mPreviewRect.getHeight() - dh ; gl_rect_2d( mPreviewRect.mLeft + offset_x - dwl, mPreviewRect.mTop + offset_y + dh, - mPreviewRect.mRight + offset_x + dwr, mPreviewRect.mTop + offset_y, alpha_color, TRUE ) ; + mPreviewRect.mRight + offset_x + dwr, mPreviewRect.mTop + offset_y, alpha_color, true ) ; } } } @@ -323,7 +323,7 @@ void LLSnapshotLivePreview::draw() } else { - mNeedsFlash = FALSE; + mNeedsFlash = false; } } else @@ -398,7 +398,7 @@ void LLSnapshotLivePreview::draw() gGL.getTexUnit(0)->bind(mViewerImage[old_image_index]); // calculate UV scale // *FIX get this to work with old image - BOOL rescale = !mImageScaled[old_image_index] && mViewerImage[mCurImageIndex].notNull(); + bool rescale = !mImageScaled[old_image_index] && mViewerImage[mCurImageIndex].notNull(); F32 uv_width = rescale ? llmin((F32)mWidth[old_image_index] / (F32)mViewerImage[mCurImageIndex]->getWidth(), 1.f) : 1.f; F32 uv_height = rescale ? llmin((F32)mHeight[old_image_index] / (F32)mViewerImage[mCurImageIndex]->getHeight(), 1.f) : 1.f; gGL.pushMatrix(); @@ -428,7 +428,7 @@ void LLSnapshotLivePreview::draw() } /*virtual*/ -void LLSnapshotLivePreview::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLSnapshotLivePreview::reshape(S32 width, S32 height, bool called_from_parent) { LLRect old_rect = getRect(); LLView::reshape(width, height, called_from_parent); @@ -439,18 +439,18 @@ void LLSnapshotLivePreview::reshape(S32 width, S32 height, BOOL called_from_pare { // We usually resize only on window reshape, so give it a chance to redraw, assign delay updateSnapshot( - TRUE, // new snapshot is needed - FALSE, // thumbnail will be updated either way. + true, // new snapshot is needed + false, // thumbnail will be updated either way. AUTO_SNAPSHOT_TIME_DELAY); // shutter delay. } } } -BOOL LLSnapshotLivePreview::setThumbnailImageSize() +bool LLSnapshotLivePreview::setThumbnailImageSize() { if (getWidth() < 10 || getHeight() < 10) { - return FALSE ; + return false ; } S32 width = (mThumbnailSubsampled ? mPreviewImage->getWidth() : gViewerWindow->getWindowWidthRaw()); S32 height = (mThumbnailSubsampled ? mPreviewImage->getHeight() : gViewerWindow->getWindowHeightRaw()) ; @@ -476,7 +476,7 @@ BOOL LLSnapshotLivePreview::setThumbnailImageSize() if (mThumbnailWidth > width || mThumbnailHeight > height) { - return FALSE ;//if the window is too small, ignore thumbnail updating. + return false ;//if the window is too small, ignore thumbnail updating. } S32 left = 0 , top = mThumbnailHeight, right = mThumbnailWidth, bottom = 0 ; @@ -500,10 +500,10 @@ BOOL LLSnapshotLivePreview::setThumbnailImageSize() } mPreviewRect.set(left - 1, top + 1, right + 1, bottom - 1) ; - return TRUE ; + return true ; } -void LLSnapshotLivePreview::generateThumbnailImage(BOOL force_update) +void LLSnapshotLivePreview::generateThumbnailImage(bool force_update) { if(mThumbnailUpdateLock) //in the process of updating { @@ -519,17 +519,17 @@ void LLSnapshotLivePreview::generateThumbnailImage(BOOL force_update) } ////lock updating - mThumbnailUpdateLock = TRUE ; + mThumbnailUpdateLock = true ; if(!setThumbnailImageSize()) { - mThumbnailUpdateLock = FALSE ; - mThumbnailUpToDate = TRUE ; + mThumbnailUpdateLock = false ; + mThumbnailUpToDate = true ; return ; } // Invalidate the big thumbnail when we regenerate the small one - mBigThumbnailUpToDate = FALSE; + mBigThumbnailUpToDate = false; if(mThumbnailImage) { @@ -558,7 +558,7 @@ void LLSnapshotLivePreview::generateThumbnailImage(BOOL force_update) mThumbnailWidth, mThumbnailHeight, mAllowRenderUI && gSavedSettings.getBOOL("RenderUIInSnapshot"), gSavedSettings.getBOOL("RenderHUDInSnapshot"), - FALSE, + false, gSavedSettings.getBOOL("RenderSnapshotNoPost"), mSnapshotBufferType) ) { @@ -585,12 +585,12 @@ void LLSnapshotLivePreview::generateThumbnailImage(BOOL force_update) } // Scale to a power of 2 so it can be mapped to a texture raw->expandToPowerOfTwo(); - mThumbnailImage = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE); - mThumbnailUpToDate = TRUE ; + mThumbnailImage = LLViewerTextureManager::getLocalTexture(raw.get(), false); + mThumbnailUpToDate = true ; } //unlock updating - mThumbnailUpdateLock = FALSE ; + mThumbnailUpdateLock = false ; } LLViewerTexture* LLSnapshotLivePreview::getBigThumbnailImage() @@ -633,38 +633,38 @@ LLViewerTexture* LLSnapshotLivePreview::getBigThumbnailImage() } // Scale to a power of 2 so it can be mapped to a texture raw->expandToPowerOfTwo(); - mBigThumbnailImage = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE); - mBigThumbnailUpToDate = TRUE ; + mBigThumbnailImage = LLViewerTextureManager::getLocalTexture(raw.get(), false); + mBigThumbnailUpToDate = true ; } return mBigThumbnailImage ; } // Called often. Checks whether it's time to grab a new snapshot and if so, does it. -// Returns TRUE if new snapshot generated, FALSE otherwise. +// Returns true if new snapshot generated, false otherwise. //static -BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) +bool LLSnapshotLivePreview::onIdle( void* snapshot_preview ) { LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)snapshot_preview; if (previewp->getWidth() == 0 || previewp->getHeight() == 0) { LL_WARNS("Snapshot") << "Incorrect dimensions: " << previewp->getWidth() << "x" << previewp->getHeight() << LL_ENDL; - return FALSE; + return false; } if (previewp->mSnapshotDelayTimer.getStarted()) // Wait for a snapshot delay timer { if (!previewp->mSnapshotDelayTimer.hasExpired()) { - return FALSE; + return false; } previewp->mSnapshotDelayTimer.stop(); } if (LLToolCamera::getInstance()->hasMouseCapture()) // Hide full-screen preview while camming, either don't take snapshots while ALT-zoom active { - previewp->setVisible(FALSE); - return FALSE; + previewp->setVisible(false); + return false; } // If we're in freeze-frame and/or auto update mode and camera has moved, update snapshot. @@ -678,18 +678,18 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) previewp->mCameraPos = new_camera_pos; previewp->mCameraRot = new_camera_rot; // request a new snapshot whenever the camera moves, with a time delay - BOOL new_snapshot = gSavedSettings.getBOOL("AutoSnapshot") || previewp->mForceUpdateSnapshot; + bool new_snapshot = gSavedSettings.getBOOL("AutoSnapshot") || previewp->mForceUpdateSnapshot; LL_DEBUGS("Snapshot") << "camera moved, updating thumbnail" << LL_ENDL; previewp->updateSnapshot( new_snapshot, // whether a new snapshot is needed or merely invalidate the existing one - FALSE, // or if 1st arg is false, whether to produce a new thumbnail image. + false, // or if 1st arg is false, whether to produce a new thumbnail image. new_snapshot ? AUTO_SNAPSHOT_TIME_DELAY : 0.f); // shutter delay if 1st arg is true. - previewp->mForceUpdateSnapshot = FALSE; + previewp->mForceUpdateSnapshot = false; } if (previewp->getSnapshotUpToDate() && previewp->getThumbnailUpToDate()) { - return FALSE; + return false; } // time to produce a snapshot @@ -701,13 +701,13 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) previewp->mPreviewImage = new LLImageRaw; } - previewp->mSnapshotActive = TRUE; + previewp->mSnapshotActive = true; - previewp->setVisible(FALSE); - previewp->setEnabled(FALSE); + previewp->setVisible(false); + previewp->setEnabled(false); previewp->getWindow()->incBusyCount(); - previewp->setImageScaled(FALSE); + previewp->setImageScaled(false); // grab the raw image if (gViewerWindow->rawSnapshot( @@ -718,7 +718,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) previewp->getSnapshotType() == LLSnapshotModel::SNAPSHOT_TEXTURE, previewp->mAllowRenderUI && gSavedSettings.getBOOL("RenderUIInSnapshot"), gSavedSettings.getBOOL("RenderHUDInSnapshot"), - FALSE, + false, gSavedSettings.getBOOL("RenderSnapshotNoPost"), previewp->mSnapshotBufferType, previewp->getMaxImageSize())) @@ -737,15 +737,15 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) } // The snapshot is updated now... - previewp->mSnapshotUpToDate = TRUE; + previewp->mSnapshotUpToDate = true; // We need to update the thumbnail though previewp->setThumbnailImageSize(); - previewp->generateThumbnailImage(TRUE) ; + previewp->generateThumbnailImage(true) ; } previewp->getWindow()->decBusyCount(); previewp->setVisible(gSavedSettings.getBOOL("UseFreezeFrame") && previewp->mAllowFullScreenPreview); // only show fullscreen preview when in freeze frame mode - previewp->mSnapshotActive = FALSE; + previewp->mSnapshotActive = false; LL_DEBUGS("Snapshot") << "done creating snapshot" << LL_ENDL; } @@ -760,7 +760,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) previewp->mViewContainer->notify(LLSD().with("snapshot-updated", true)); } - return TRUE; + return true; } void LLSnapshotLivePreview::prepareFreezeFrame() @@ -768,6 +768,8 @@ void LLSnapshotLivePreview::prepareFreezeFrame() // Get the decoded version of the formatted image getEncodedImage(); + LLImageDataSharedLock lock(mPreviewImageEncoded); + // We need to scale that a bit for display... LLPointer<LLImageRaw> scaled = new LLImageRaw( mPreviewImageEncoded->getData(), @@ -782,15 +784,15 @@ void LLSnapshotLivePreview::prepareFreezeFrame() { // go ahead and shrink image to appropriate power of 2 for display scaled->biasedScaleToPowerOfTwo(1024); - setImageScaled(TRUE); + setImageScaled(true); } else { // expand image but keep original image data intact - scaled->expandToPowerOfTwo(1024, FALSE); + scaled->expandToPowerOfTwo(1024, false); } - mViewerImage[mCurImageIndex] = LLViewerTextureManager::getLocalTexture(scaled.get(), FALSE); + mViewerImage[mCurImageIndex] = LLViewerTextureManager::getLocalTexture(scaled.get(), false); LLPointer<LLViewerTexture> curr_preview_image = mViewerImage[mCurImageIndex]; gGL.getTexUnit(0)->bind(curr_preview_image); curr_preview_image->setFilteringOption(getSnapshotType() == LLSnapshotModel::SNAPSHOT_TEXTURE ? LLTexUnit::TFO_ANISOTROPIC : LLTexUnit::TFO_POINT); @@ -827,6 +829,8 @@ LLPointer<LLImageRaw> LLSnapshotLivePreview::getEncodedImage() { if (!mPreviewImageEncoded) { + LLImageDataSharedLock lock(mPreviewImage); + mPreviewImageEncoded = new LLImageRaw; mPreviewImageEncoded->resize( @@ -847,7 +851,7 @@ LLPointer<LLImageRaw> LLSnapshotLivePreview::getEncodedImage() mPreviewImage->getComponents()); // Scale it as required by J2C scaled->biasedScaleToPowerOfTwo(MAX_TEXTURE_SIZE); - setImageScaled(TRUE); + setImageScaled(true); // Compress to J2C if (formatted->encode(scaled, 0.f)) { @@ -978,8 +982,10 @@ void LLSnapshotLivePreview::getSize(S32& w, S32& h) const h = getHeight(); } -void LLSnapshotLivePreview::saveTexture(BOOL outfit_snapshot, std::string name) +void LLSnapshotLivePreview::saveTexture(bool outfit_snapshot, std::string name) { + LLImageDataSharedLock lock(mPreviewImage); + LL_DEBUGS("Snapshot") << "saving texture: " << mPreviewImage->getWidth() << "x" << mPreviewImage->getHeight() << LL_ENDL; // gen a new uuid for this asset LLTransactionID tid; @@ -1059,5 +1065,5 @@ void LLSnapshotLivePreview::saveLocal(LLPointer<LLImageFormatted> image, const s { sSaveLocalImage = image; - gViewerWindow->saveImageNumbered(sSaveLocalImage, FALSE, success_cb, failure_cb); + gViewerWindow->saveImageNumbered(sSaveLocalImage, false, success_cb, failure_cb); } diff --git a/indra/newview/llsnapshotlivepreview.h b/indra/newview/llsnapshotlivepreview.h index 072e350e34..c41c21c120 100644 --- a/indra/newview/llsnapshotlivepreview.h +++ b/indra/newview/llsnapshotlivepreview.h @@ -59,7 +59,7 @@ public: void setContainer(LLView* container) { mViewContainer = container; } /*virtual*/ void draw(); - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent); + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent); void setSize(S32 w, S32 h); void setWidth(S32 w) { mWidth[mCurImageIndex] = w; } @@ -76,32 +76,32 @@ public: LLSnapshotModel::ESnapshotType getSnapshotType() const { return mSnapshotType; } LLSnapshotModel::ESnapshotFormat getSnapshotFormat() const { return mSnapshotFormat; } - BOOL getSnapshotUpToDate() const { return mSnapshotUpToDate; } - BOOL isSnapshotActive() { return mSnapshotActive; } + bool getSnapshotUpToDate() const { return mSnapshotUpToDate; } + bool isSnapshotActive() { return mSnapshotActive; } LLViewerTexture* getThumbnailImage() const { return mThumbnailImage ; } S32 getThumbnailWidth() const { return mThumbnailWidth ; } S32 getThumbnailHeight() const { return mThumbnailHeight ; } - BOOL getThumbnailLock() const { return mThumbnailUpdateLock ; } - BOOL getThumbnailUpToDate() const { return mThumbnailUpToDate ;} - void setThumbnailSubsampled(BOOL subsampled) { mThumbnailSubsampled = subsampled; } + bool getThumbnailLock() const { return mThumbnailUpdateLock ; } + bool getThumbnailUpToDate() const { return mThumbnailUpToDate ;} + void setThumbnailSubsampled(bool subsampled) { mThumbnailSubsampled = subsampled; } LLViewerTexture* getCurrentImage(); F32 getImageAspect(); const LLRect& getImageRect() const { return mImageRect[mCurImageIndex]; } - BOOL isImageScaled() const { return mImageScaled[mCurImageIndex]; } - void setImageScaled(BOOL scaled) { mImageScaled[mCurImageIndex] = scaled; } + bool isImageScaled() const { return mImageScaled[mCurImageIndex]; } + void setImageScaled(bool scaled) { mImageScaled[mCurImageIndex] = scaled; } const LLVector3d& getPosTakenGlobal() const { return mPosTakenGlobal; } void setSnapshotType(LLSnapshotModel::ESnapshotType type) { mSnapshotType = type; } void setSnapshotFormat(LLSnapshotModel::ESnapshotFormat format); bool setSnapshotQuality(S32 quality, bool set_by_user = true); void setSnapshotBufferType(LLSnapshotModel::ESnapshotLayerType type) { mSnapshotBufferType = type; } - void setAllowRenderUI(BOOL allow) { mAllowRenderUI = allow; } - void setAllowFullScreenPreview(BOOL allow) { mAllowFullScreenPreview = allow; } + void setAllowRenderUI(bool allow) { mAllowRenderUI = allow; } + void setAllowFullScreenPreview(bool allow) { mAllowFullScreenPreview = allow; } void setFilter(std::string filter_name) { mFilterName = filter_name; } std::string getFilter() const { return mFilterName; } - void updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail = FALSE, F32 delay = 0.f); - void saveTexture(BOOL outfit_snapshot = FALSE, std::string name = ""); + void updateSnapshot(bool new_snapshot, bool new_thumbnail = false, F32 delay = 0.f); + void saveTexture(bool outfit_snapshot = false, std::string name = ""); void saveLocal(const snapshot_saved_signal_t::slot_type& success_cb, const snapshot_saved_signal_t::slot_type& failure_cb); LLPointer<LLImageFormatted> getFormattedImage(); @@ -110,8 +110,8 @@ public: /// Sets size of preview thumbnail image and the surrounding rect. void setThumbnailPlaceholderRect(const LLRect& rect) {mThumbnailPlaceholderRect = rect; } - BOOL setThumbnailImageSize() ; - void generateThumbnailImage(BOOL force_update = FALSE) ; + bool setThumbnailImageSize() ; + void generateThumbnailImage(bool force_update = false) ; void resetThumbnailImage() { mThumbnailImage = NULL ; } void drawPreviewRect(S32 offset_x, S32 offset_y, LLColor4 alpha_color = LLColor4(0.5f, 0.5f, 0.5f, 0.8f)); void prepareFreezeFrame(); @@ -120,8 +120,8 @@ public: S32 getBigThumbnailWidth() const { return mBigThumbnailWidth ; } S32 getBigThumbnailHeight() const { return mBigThumbnailHeight ; } - // Returns TRUE when snapshot generated, FALSE otherwise. - static BOOL onIdle( void* snapshot_preview ); + // Returns true when snapshot generated, false otherwise. + static bool onIdle( void* snapshot_preview ); private: LLView* mViewContainer; @@ -131,7 +131,7 @@ private: LLRect mImageRect[2]; S32 mWidth[2]; S32 mHeight[2]; - BOOL mImageScaled[2]; + bool mImageScaled[2]; S32 mMaxImageSize ; //thumbnail image @@ -139,38 +139,38 @@ private: S32 mThumbnailWidth ; S32 mThumbnailHeight ; LLRect mPreviewRect ; - BOOL mThumbnailUpdateLock ; - BOOL mThumbnailUpToDate ; + bool mThumbnailUpdateLock ; + bool mThumbnailUpToDate ; LLRect mThumbnailPlaceholderRect; - BOOL mThumbnailSubsampled; // TRUE if the thumbnail is a subsampled version of the mPreviewImage + bool mThumbnailSubsampled; // true if the thumbnail is a subsampled version of the mPreviewImage LLPointer<LLViewerTexture> mBigThumbnailImage ; S32 mBigThumbnailWidth; S32 mBigThumbnailHeight; - BOOL mBigThumbnailUpToDate; + bool mBigThumbnailUpToDate; S32 mCurImageIndex; // The logic is mPreviewImage (raw frame) -> mFormattedImage (formatted / filtered) -> mPreviewImageEncoded (decoded back, to show artifacts) LLPointer<LLImageRaw> mPreviewImage; LLPointer<LLImageRaw> mPreviewImageEncoded; LLPointer<LLImageFormatted> mFormattedImage; - BOOL mAllowRenderUI; - BOOL mAllowFullScreenPreview; + bool mAllowRenderUI; + bool mAllowFullScreenPreview; LLFrameTimer mSnapshotDelayTimer; S32 mShineCountdown; LLFrameTimer mShineAnimTimer; F32 mFlashAlpha; - BOOL mNeedsFlash; + bool mNeedsFlash; LLVector3d mPosTakenGlobal; S32 mSnapshotQuality; S32 mDataSize; LLSnapshotModel::ESnapshotType mSnapshotType; LLSnapshotModel::ESnapshotFormat mSnapshotFormat; - BOOL mSnapshotUpToDate; + bool mSnapshotUpToDate; LLFrameTimer mFallAnimTimer; LLVector3 mCameraPos; LLQuaternion mCameraRot; - BOOL mSnapshotActive; + bool mSnapshotActive; LLSnapshotModel::ESnapshotLayerType mSnapshotBufferType; std::string mFilterName; @@ -178,8 +178,8 @@ private: public: static std::set<LLSnapshotLivePreview*> sList; - BOOL mKeepAspectRatio ; - BOOL mForceUpdateSnapshot; + bool mKeepAspectRatio ; + bool mForceUpdateSnapshot; }; #endif // LL_LLSNAPSHOTLIVEPREVIEW_H diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 85a73c25cf..c8643a06c0 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -70,7 +70,7 @@ static F32 sCurMaxTexPriority = 1.f; //static counter for frame to switch LOD on -void sg_assert(BOOL expr) +void sg_assert(bool expr) { #if LL_OCTREE_PARANOIA_CHECK if (!expr) @@ -136,7 +136,7 @@ void LLSpatialGroup::clearDrawMap() mDrawMap.clear(); } -BOOL LLSpatialGroup::isHUDGroup() +bool LLSpatialGroup::isHUDGroup() { return getSpatialPartition() && getSpatialPartition()->isHUDPartition() ; } @@ -218,7 +218,7 @@ void LLSpatialGroup::validateDrawMap() #endif } -BOOL LLSpatialGroup::updateInGroup(LLDrawable *drawablep, BOOL immediate) +bool LLSpatialGroup::updateInGroup(LLDrawable *drawablep, bool immediate) { LL_PROFILE_ZONE_SCOPED; drawablep->updateSpatialExtents(); @@ -233,10 +233,10 @@ BOOL LLSpatialGroup::updateInGroup(LLDrawable *drawablep, BOOL immediate) unbound(); setState(OBJECT_DIRTY); //setState(GEOM_DIRTY); - return TRUE; + return true; } - return FALSE; + return false; } void LLSpatialGroup::expandExtents(const LLVector4a* addingExtents, const LLXformMatrix& currentTransform) @@ -293,11 +293,11 @@ void LLSpatialGroup::expandExtents(const LLVector4a* addingExtents, const LLXfor mBounds[1].mul(0.5f); } -BOOL LLSpatialGroup::addObject(LLDrawable *drawablep) +bool LLSpatialGroup::addObject(LLDrawable *drawablep) { if(!drawablep) { - return FALSE; + return false; } { drawablep->setGroup(this); @@ -314,7 +314,7 @@ BOOL LLSpatialGroup::addObject(LLDrawable *drawablep) } } - return TRUE; + return true; } void LLSpatialGroup::rebuildGeom() @@ -407,13 +407,13 @@ LLSpatialGroup* LLSpatialGroup::getParent() return (LLSpatialGroup*)LLViewerOctreeGroup::getParent(); } -BOOL LLSpatialGroup::removeObject(LLDrawable *drawablep, BOOL from_octree) +bool LLSpatialGroup::removeObject(LLDrawable *drawablep, bool from_octree) { LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL if(!drawablep) { - return FALSE; + return false; } unbound(); @@ -444,7 +444,7 @@ BOOL LLSpatialGroup::removeObject(LLDrawable *drawablep, BOOL from_octree) clearDrawMap(); } } - return TRUE; + return true; } void LLSpatialGroup::shift(const LLVector4a &offset) @@ -727,14 +727,14 @@ F32 LLSpatialGroup::getUpdateUrgency() const } } -BOOL LLSpatialGroup::changeLOD() +bool LLSpatialGroup::changeLOD() { LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL if (hasState(ALPHA_DIRTY | OBJECT_DIRTY)) { //a rebuild is going to happen, update distance and LoD - return TRUE; + return true; } if (getSpatialPartition()->mSlopRatio > 0.f) @@ -763,16 +763,16 @@ BOOL LLSpatialGroup::changeLOD() << " fab ratio " << fabsf(ratio) << " slop " << getSpatialPartition()->mSlopRatio << LL_ENDL; - return TRUE; + return true; } } if (needsUpdate()) { - return TRUE; + return true; } - return FALSE; + return false; } void LLSpatialGroup::handleInsertion(const TreeNode* node, LLViewerOctreeEntry* entry) @@ -784,7 +784,7 @@ void LLSpatialGroup::handleInsertion(const TreeNode* node, LLViewerOctreeEntry* void LLSpatialGroup::handleRemoval(const TreeNode* node, LLViewerOctreeEntry* entry) { - removeObject((LLDrawable*)entry->getDrawable(), TRUE); + removeObject((LLDrawable*)entry->getDrawable(), true); LLViewerOctreeGroup::handleRemoval(node, entry); } @@ -911,15 +911,15 @@ void LLSpatialGroup::destroyGLState(bool keep_occlusion) //============================================== -LLSpatialPartition::LLSpatialPartition(U32 data_mask, BOOL render_by_group, LLViewerRegion* regionp) +LLSpatialPartition::LLSpatialPartition(U32 data_mask, bool render_by_group, LLViewerRegion* regionp) : mRenderByGroup(render_by_group), mBridge(NULL) { mRegionp = regionp; mPartitionType = LLViewerRegion::PARTITION_NONE; mVertexDataMask = data_mask; - mDepthMask = FALSE; + mDepthMask = false; mSlopRatio = 0.25f; - mInfiniteFarClip = FALSE; + mInfiniteFarClip = false; new LLSpatialGroup(mOctree, this); } @@ -930,7 +930,7 @@ LLSpatialPartition::~LLSpatialPartition() cleanup(); } -LLSpatialGroup *LLSpatialPartition::put(LLDrawable *drawablep, BOOL was_visible) +LLSpatialGroup *LLSpatialPartition::put(LLDrawable *drawablep, bool was_visible) { LL_PROFILE_ZONE_SCOPED; drawablep->updateSpatialExtents(); @@ -956,7 +956,7 @@ LLSpatialGroup *LLSpatialPartition::put(LLDrawable *drawablep, BOOL was_visible) return group; } -BOOL LLSpatialPartition::remove(LLDrawable *drawablep, LLSpatialGroup *curp) +bool LLSpatialPartition::remove(LLDrawable *drawablep, LLSpatialGroup *curp) { LL_PROFILE_ZONE_SCOPED; if (!curp->removeObject(drawablep)) @@ -970,10 +970,10 @@ BOOL LLSpatialPartition::remove(LLDrawable *drawablep, LLSpatialGroup *curp) assert_octree_valid(mOctree); - return TRUE; + return true; } -void LLSpatialPartition::move(LLDrawable *drawablep, LLSpatialGroup *curp, BOOL immediate) +void LLSpatialPartition::move(LLDrawable *drawablep, LLSpatialGroup *curp, bool immediate) { LL_PROFILE_ZONE_SCOPED; // sanity check submitted by open source user bushing Spatula @@ -984,7 +984,7 @@ void LLSpatialPartition::move(LLDrawable *drawablep, LLSpatialGroup *curp, BOOL return; } - BOOL was_visible = curp ? curp->isVisible() : FALSE; + bool was_visible = curp ? curp->isVisible() : false; if (curp && curp->getSpatialPartition() != this) { @@ -1133,7 +1133,7 @@ class LLOctreeCullVisExtents: public LLOctreeCullShadow { public: LLOctreeCullVisExtents(LLCamera* camera, LLVector4a& min, LLVector4a& max) - : LLOctreeCullShadow(camera), mMin(min), mMax(max), mEmpty(TRUE) { } + : LLOctreeCullShadow(camera), mMin(min), mMax(max), mEmpty(true) { } virtual bool earlyFail(LLViewerOctreeGroup* base_group) { @@ -1186,7 +1186,7 @@ public: { if (AABBInFrustumObjectBounds(group) > 0) { - mEmpty = FALSE; + mEmpty = false; const LLVector4a* exts = group->getObjectExtents(); update_min_max(mMin, mMax, exts[0]); update_min_max(mMin, mMax, exts[1]); @@ -1194,14 +1194,14 @@ public: } else { - mEmpty = FALSE; + mEmpty = false; const LLVector4a* exts = group->getExtents(); update_min_max(mMin, mMax, exts[0]); update_min_max(mMin, mMax, exts[1]); } } - BOOL mEmpty; + bool mEmpty; LLVector4a& mMin; LLVector4a& mMax; }; @@ -1210,7 +1210,7 @@ class LLOctreeCullDetectVisible: public LLOctreeCullShadow { public: LLOctreeCullDetectVisible(LLCamera* camera) - : LLOctreeCullShadow(camera), mResult(FALSE) { } + : LLOctreeCullShadow(camera), mResult(false) { } virtual bool earlyFail(LLViewerOctreeGroup* base_group) { @@ -1231,11 +1231,11 @@ public: { if (base_group->isVisible()) { - mResult = TRUE; + mResult = true; } } - BOOL mResult; + bool mResult; }; class LLOctreeSelect : public LLOctreeCull @@ -1263,7 +1263,7 @@ public: { if (drawable->isSpatialBridge()) { - drawable->setVisible(*mCamera, mResults, TRUE); + drawable->setVisible(*mCamera, mResults, true); } else { @@ -1379,7 +1379,7 @@ void LLSpatialPartition::restoreGL() { } -BOOL LLSpatialPartition::getVisibleExtents(LLCamera& camera, LLVector3& visMin, LLVector3& visMax) +bool LLSpatialPartition::getVisibleExtents(LLCamera& camera, LLVector3& visMin, LLVector3& visMax) { LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL; LLVector4a visMina, visMaxa; @@ -1399,14 +1399,14 @@ BOOL LLSpatialPartition::getVisibleExtents(LLCamera& camera, LLVector3& visMin, return vis.mEmpty; } -BOOL LLSpatialPartition::visibleObjectsInFrustum(LLCamera& camera) +bool LLSpatialPartition::visibleObjectsInFrustum(LLCamera& camera) { LLOctreeCullDetectVisible vis(&camera); vis.traverse(mOctree); return vis.mResult; } -S32 LLSpatialPartition::cull(LLCamera &camera, std::vector<LLDrawable *>* results, BOOL for_select) +S32 LLSpatialPartition::cull(LLCamera &camera, std::vector<LLDrawable *>* results, bool for_select) { LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL; #if LL_OCTREE_PARANOIA_CHECK @@ -1427,7 +1427,7 @@ S32 LLSpatialPartition::cull(LLCamera &camera, std::vector<LLDrawable *>* result return 0; } -extern BOOL gCubeSnapshot; +extern bool gCubeSnapshot; S32 LLSpatialPartition::cull(LLCamera &camera, bool do_occlusion) { @@ -1609,7 +1609,7 @@ bool check_rigged_group(LLDrawable* drawable) { for (auto& face : root->getFaces()) { - if ((S32)face->getDrawOrderIndex() <= last_draw_index) + if ((S32) face->getDrawOrderIndex() <= last_draw_index) { LL_WARNS() << "[(S32)face->getDrawOrderIndex() <= last_draw_index] is true" " (" << (S32)face->getDrawOrderIndex() << " <= " << last_draw_index << ")" << LL_ENDL; @@ -1626,7 +1626,7 @@ bool check_rigged_group(LLDrawable* drawable) { for (auto& face : child->mDrawable->getFaces()) { - if ((S32)face->getDrawOrderIndex() <= last_draw_index) + if ((S32) face->getDrawOrderIndex() <= last_draw_index) { LL_WARNS() << "[(S32)face->getDrawOrderIndex() <= last_draw_index] is true" " (" << (S32)face->getDrawOrderIndex() << " <= " << last_draw_index << ")" << LL_ENDL; @@ -1662,7 +1662,7 @@ void renderOctree(LLSpatialGroup* group) col.setVec(0.1f,0.1f,1,0.1f); { - LLGLDepthTest gl_depth(FALSE, FALSE); + LLGLDepthTest gl_depth(false, false); #if GL_VERSION_1_1 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); #endif @@ -1796,7 +1796,7 @@ std::set<LLSpatialGroup*> visible_selected_groups; void renderXRay(LLSpatialGroup* group, LLCamera* camera) { - BOOL render_objects = (!LLPipeline::sUseOcclusion || !group->isOcclusionState(LLSpatialGroup::OCCLUDED)) && group->isVisible() && + bool render_objects = (!LLPipeline::sUseOcclusion || !group->isOcclusionState(LLSpatialGroup::OCCLUDED)) && group->isVisible() && !group->isEmpty(); if (render_objects) @@ -1888,7 +1888,7 @@ void renderUpdateType(LLDrawable* drawablep) } } -void renderBoundingBox(LLDrawable* drawable, BOOL set_color = TRUE) +void renderBoundingBox(LLDrawable* drawable, bool set_color = true) { if (set_color) { @@ -2368,12 +2368,12 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume, bool wireframe LLCDMeshData mesh; mesh.mIndexBase = &index[0]; mesh.mVertexBase = pos[0].mV; - mesh.mNumVertices = pos.size(); + mesh.mNumVertices = static_cast<int>(pos.size()); mesh.mVertexStrideBytes = 12; mesh.mIndexStrideBytes = 6; mesh.mIndexType = LLCDMeshData::INT_16; - mesh.mNumTriangles = index.size()/3; + mesh.mNumTriangles = static_cast<int>(index.size())/3; LLCDMeshData res; @@ -2773,7 +2773,7 @@ void renderTexelDensity(LLDrawable* drawable) checkerboard_matrix.initScale(LLVector3(texturep->getWidth(discard_level) / 8, texturep->getHeight(discard_level) / 8, 1.f)); - gGL.getTexUnit(0)->bind(LLViewerTexture::sCheckerBoardImagep, TRUE); + gGL.getTexUnit(0)->bind(LLViewerTexture::sCheckerBoardImagep, true); gGL.matrixMode(LLRender::MM_TEXTURE); gGL.loadMatrix((GLfloat*)&checkerboard_matrix.mMatrix); @@ -2826,7 +2826,7 @@ void renderTexelDensity(LLDrawable* drawable) // //gGL.matrixMode(LLRender::MM_TEXTURE); // glLoadMatrixf((GLfloat*) checkboard_matrix.mMatrix); - // gGL.getTexUnit(i)->bind(LLViewerTexture::sCheckerBoardImagep, TRUE); + // gGL.getTexUnit(i)->bind(LLViewerTexture::sCheckerBoardImagep, true); // pushVerts(params, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_NORMAL ); @@ -3467,7 +3467,7 @@ public: { continue; } - renderBoundingBox(drawable, FALSE); + renderBoundingBox(drawable, false); } } }; @@ -3662,14 +3662,14 @@ bool LLSpatialPartition::isHUDPartition() return mPartitionType == LLViewerRegion::PARTITION_HUD ; } -BOOL LLSpatialPartition::isVisible(const LLVector3& v) +bool LLSpatialPartition::isVisible(const LLVector3& v) { if (!LLViewerCamera::getInstance()->sphereInFrustum(v, 4.0f)) { - return FALSE; + return false; } - return TRUE; + return true; } LL_ALIGN_PREFIX(16) @@ -3685,12 +3685,12 @@ public: LLVector4a *mNormal; LLVector4a *mTangent; LLDrawable* mHit; - BOOL mPickTransparent; - BOOL mPickRigged; - BOOL mPickUnselectable; - BOOL mPickReflectionProbe; + bool mPickTransparent; + bool mPickRigged; + bool mPickUnselectable; + bool mPickReflectionProbe; - LLOctreeIntersect(const LLVector4a& start, const LLVector4a& end, BOOL pick_transparent, BOOL pick_rigged, BOOL pick_unselectable, BOOL pick_reflection_probe, + LLOctreeIntersect(const LLVector4a& start, const LLVector4a& end, bool pick_transparent, bool pick_rigged, bool pick_unselectable, bool pick_reflection_probe, S32* face_hit, LLVector4a* intersection, LLVector2* tex_coord, LLVector4a* normal, LLVector4a* tangent) : mStart(start), mEnd(end), @@ -3811,7 +3811,7 @@ public: } if (!skip_check && vobj->lineSegmentIntersect(mStart, mEnd, -1, - (mPickReflectionProbe && vobj->isReflectionProbe()) ? TRUE : mPickTransparent, // always pick transparent when picking selection probe + (mPickReflectionProbe && vobj->isReflectionProbe()) ? true : mPickTransparent, // always pick transparent when picking selection probe mPickRigged, mPickUnselectable, mFaceHit, &intersection, mTexCoord, mNormal, mTangent)) { mEnd = intersection; // shorten ray so we only find CLOSER hits @@ -3830,10 +3830,10 @@ public: } LL_ALIGN_POSTFIX(16); LLDrawable* LLSpatialPartition::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, - BOOL pick_transparent, - BOOL pick_rigged, - BOOL pick_unselectable, - BOOL pick_reflection_probe, + bool pick_transparent, + bool pick_rigged, + bool pick_unselectable, + bool pick_reflection_probe, S32* face_hit, // return the face hit LLVector4a* intersection, // return the intersection point LLVector2* tex_coord, // return the texture coordinates of the intersection point @@ -3849,10 +3849,10 @@ LLDrawable* LLSpatialPartition::lineSegmentIntersect(const LLVector4a& start, co } LLDrawable* LLSpatialGroup::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, - BOOL pick_transparent, - BOOL pick_rigged, - BOOL pick_unselectable, - BOOL pick_reflection_probe, + bool pick_transparent, + bool pick_rigged, + bool pick_unselectable, + bool pick_reflection_probe, S32* face_hit, // return the face hit LLVector4a* intersection, // return the intersection point LLVector2* tex_coord, // return the texture coordinates of the intersection point diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h index a78997cef0..c074d6a89a 100644 --- a/indra/newview/llspatialpartition.h +++ b/indra/newview/llspatialpartition.h @@ -218,7 +218,7 @@ public: } static U32 sNodeCount; - static bool sNoDelete; //deletion of spatial groups and draw info not allowed if TRUE + static bool sNoDelete; //deletion of spatial groups and draw info not allowed if true typedef std::vector<LLPointer<LLSpatialGroup> > sg_vector_t; typedef std::vector<LLPointer<LLSpatialBridge> > bridge_list_t; @@ -280,7 +280,7 @@ public: LLSpatialGroup(OctreeNode* node, LLSpatialPartition* part); - BOOL isHUDGroup() ; + bool isHUDGroup() ; void clearDrawMap(); void validate(); @@ -292,9 +292,9 @@ public: LLSpatialGroup* getParent(); - BOOL addObject(LLDrawable *drawablep); - BOOL removeObject(LLDrawable *drawablep, BOOL from_octree = FALSE); - BOOL updateInGroup(LLDrawable *drawablep, BOOL immediate = FALSE); // Update position if it's in the group + bool addObject(LLDrawable *drawablep); + bool removeObject(LLDrawable *drawablep, bool from_octree = false); + bool updateInGroup(LLDrawable *drawablep, bool immediate = false); // Update position if it's in the group void expandExtents(const LLVector4a* addingExtents, const LLXformMatrix& currentTransform); void shift(const LLVector4a &offset); @@ -303,7 +303,7 @@ public: void updateDistance(LLCamera& camera); F32 getUpdateUrgency() const; - BOOL changeLOD(); + bool changeLOD(); void rebuildGeom(); void rebuildMesh(); @@ -314,10 +314,10 @@ public: void drawObjectBox(LLColor4 col); LLDrawable* lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, - BOOL pick_transparent, - BOOL pick_rigged, - BOOL pick_unselectable, - BOOL pick_reflection_probe, + bool pick_transparent, + bool pick_rigged, + bool pick_unselectable, + bool pick_reflection_probe, S32* face_hit, // return the face hit LLVector4a* intersection = NULL, // return the intersection point LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point @@ -385,17 +385,17 @@ public: class LLSpatialPartition: public LLViewerOctreePartition, public LLGeometryManager { public: - LLSpatialPartition(U32 data_mask, BOOL render_by_group, LLViewerRegion* regionp); + LLSpatialPartition(U32 data_mask, bool render_by_group, LLViewerRegion* regionp); virtual ~LLSpatialPartition(); - LLSpatialGroup *put(LLDrawable *drawablep, BOOL was_visible = FALSE); - BOOL remove(LLDrawable *drawablep, LLSpatialGroup *curp); + LLSpatialGroup *put(LLDrawable *drawablep, bool was_visible = false); + bool remove(LLDrawable *drawablep, LLSpatialGroup *curp); LLDrawable* lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, - BOOL pick_transparent, - BOOL pick_rigged, - BOOL pick_unselectable, - BOOL pick_reflection_probe, + bool pick_transparent, + bool pick_rigged, + bool pick_unselectable, + bool pick_reflection_probe, S32* face_hit, // return the face hit LLVector4a* intersection = NULL, // return the intersection point LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point @@ -405,7 +405,7 @@ public: // If the drawable moves, move it here. - virtual void move(LLDrawable *drawablep, LLSpatialGroup *curp, BOOL immediate = FALSE); + virtual void move(LLDrawable *drawablep, LLSpatialGroup *curp, bool immediate = false); virtual void shift(const LLVector4a &offset); virtual F32 calcDistance(LLSpatialGroup* group, LLCamera& camera); @@ -414,33 +414,33 @@ public: virtual void rebuildGeom(LLSpatialGroup* group); virtual void rebuildMesh(LLSpatialGroup* group); - BOOL visibleObjectsInFrustum(LLCamera& camera); + bool visibleObjectsInFrustum(LLCamera& camera); /*virtual*/ S32 cull(LLCamera &camera, bool do_occlusion=false); // Cull on arbitrary frustum - S32 cull(LLCamera &camera, std::vector<LLDrawable *>* results, BOOL for_select); // Cull on arbitrary frustum + S32 cull(LLCamera &camera, std::vector<LLDrawable *>* results, bool for_select); // Cull on arbitrary frustum - BOOL isVisible(const LLVector3& v); + bool isVisible(const LLVector3& v); bool isHUDPartition() ; LLSpatialBridge* asBridge() { return mBridge; } - BOOL isBridge() { return asBridge() != NULL; } + bool isBridge() { return asBridge() != NULL; } void renderPhysicsShapes(bool depth_only); void renderDebug(); void renderIntersectingBBoxes(LLCamera* camera); void restoreGL(); - BOOL getVisibleExtents(LLCamera& camera, LLVector3& visMin, LLVector3& visMax); + bool getVisibleExtents(LLCamera& camera, LLVector3& visMin, LLVector3& visMax); public: LLSpatialBridge* mBridge; // NULL for non-LLSpatialBridge instances, otherwise, mBridge == this // use a pointer instead of making "isBridge" and "asBridge" virtual so it's safe // to call asBridge() from the destructor - bool mInfiniteFarClip; // if TRUE, frustum culling ignores far clip plane + bool mInfiniteFarClip; // if true, frustum culling ignores far clip plane const bool mRenderByGroup; U32 mVertexDataMask; F32 mSlopRatio; //percentage distance must change before drawables receive LOD update (default is 0.25); - bool mDepthMask; //if TRUE, objects in this partition will be written to depth during alpha rendering + bool mDepthMask; //if true, objects in this partition will be written to depth during alpha rendering }; // class for creating bridges between spatial partitions @@ -452,18 +452,18 @@ protected: public: typedef std::vector<LLPointer<LLSpatialBridge> > bridge_vector_t; - LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 data_mask, LLViewerRegion* regionp); + LLSpatialBridge(LLDrawable* root, bool render_by_group, U32 data_mask, LLViewerRegion* regionp); void destroyTree(); - virtual BOOL isSpatialBridge() const { return TRUE; } + virtual bool isSpatialBridge() const { return true; } virtual void updateSpatialExtents(); virtual void updateBinRadius(); - virtual void setVisible(LLCamera& camera_in, std::vector<LLDrawable*>* results = NULL, BOOL for_select = FALSE); + virtual void setVisible(LLCamera& camera_in, std::vector<LLDrawable*>* results = NULL, bool for_select = false); virtual void updateDistance(LLCamera& camera_in, bool force_update); virtual void makeActive(); - virtual void move(LLDrawable *drawablep, LLSpatialGroup *curp, BOOL immediate = FALSE); - virtual BOOL updateMove(); + virtual void move(LLDrawable *drawablep, LLSpatialGroup *curp, bool immediate = false); + virtual bool updateMove(); virtual void shiftPos(const LLVector4a& vec); virtual void cleanupReferences(); virtual LLSpatialPartition* asPartition() { return this; } @@ -678,7 +678,7 @@ class LLVolumeGeometryManager: public LLGeometryManager virtual void rebuildMesh(LLSpatialGroup* group); virtual void getGeometry(LLSpatialGroup* group); virtual void addGeometryCount(LLSpatialGroup* group, U32& vertex_count, U32& index_count); - U32 genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace** faces, U32 face_count, BOOL distance_sort = FALSE, BOOL batch_textures = FALSE, BOOL rigged = FALSE); + U32 genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace** faces, U32 face_count, bool distance_sort = false, bool batch_textures = false, bool rigged = false); void registerFace(LLSpatialGroup* group, LLFace* facep, U32 type); private: @@ -729,7 +729,6 @@ class LLControlAVBridge : public LLVolumeBridge using super = LLVolumeBridge; public: LLControlAVBridge(LLDrawable* drawablep, LLViewerRegion* regionp); - virtual void updateSpatialExtents(); }; class LLHUDBridge : public LLVolumeBridge diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp index b12e8d15fc..81002139be 100644 --- a/indra/newview/llspeakers.cpp +++ b/indra/newview/llspeakers.cpp @@ -50,16 +50,16 @@ LLSpeaker::LLSpeaker(const LLUUID& id, const std::string& name, const ESpeakerTy mStatus(LLSpeaker::STATUS_TEXT_ONLY), mLastSpokeTime(0.f), mSpeechVolume(0.f), - mHasSpoken(FALSE), - mHasLeftCurrentCall(FALSE), + mHasSpoken(false), + mHasLeftCurrentCall(false), mDotColor(LLColor4::white), mID(id), - mTyping(FALSE), + mTyping(false), mSortIndex(0), mType(type), - mIsModerator(FALSE), - mModeratorMutedVoice(FALSE), - mModeratorMutedText(FALSE) + mIsModerator(false), + mModeratorMutedVoice(false), + mModeratorMutedText(false) { if (name.empty() && type == SPEAKER_AGENT) { @@ -181,13 +181,13 @@ LLSpeakerActionTimer::LLSpeakerActionTimer(action_callback_t action_cb, F32 acti { } -BOOL LLSpeakerActionTimer::tick() +bool LLSpeakerActionTimer::tick() { if (mActionCallback) { - return (BOOL)mActionCallback(mSpeakerId); + return (bool)mActionCallback(mSpeakerId); } - return TRUE; + return true; } void LLSpeakerActionTimer::unset() @@ -361,7 +361,7 @@ void LLSpeakerMgr::initVoiceModerateMode() } } -void LLSpeakerMgr::update(BOOL resort_ok) +void LLSpeakerMgr::update(bool resort_ok) { if (!LLVoiceClient::getInstance()) { @@ -377,7 +377,7 @@ void LLSpeakerMgr::update(BOOL resort_ok) } // update status of all current speakers - BOOL voice_channel_active = (!mVoiceChannel && LLVoiceClient::getInstance()->inProximalChannel()) || (mVoiceChannel && mVoiceChannel->isActive()); + bool voice_channel_active = (!mVoiceChannel && LLVoiceClient::getInstance()->inProximalChannel()) || (mVoiceChannel && mVoiceChannel->isActive()); for (speaker_map_t::iterator speaker_it = mSpeakers.begin(); speaker_it != mSpeakers.end(); speaker_it++) { LLUUID speaker_id = speaker_it->first; @@ -386,7 +386,7 @@ void LLSpeakerMgr::update(BOOL resort_ok) if (voice_channel_active && LLVoiceClient::getInstance()->getVoiceEnabled(speaker_id)) { speakerp->mSpeechVolume = LLVoiceClient::getInstance()->getCurrentPower(speaker_id); - BOOL moderator_muted_voice = LLVoiceClient::getInstance()->getIsModeratorMuted(speaker_id); + bool moderator_muted_voice = LLVoiceClient::getInstance()->getIsModeratorMuted(speaker_id); if (moderator_muted_voice != speakerp->mModeratorMutedVoice) { speakerp->mModeratorMutedVoice = moderator_muted_voice; @@ -404,7 +404,7 @@ void LLSpeakerMgr::update(BOOL resort_ok) if (speakerp->mStatus != LLSpeaker::STATUS_SPEAKING) { speakerp->mLastSpokeTime = mSpeechTimer.getElapsedTimeF32(); - speakerp->mHasSpoken = TRUE; + speakerp->mHasSpoken = true; fireEvent(new LLSpeakerUpdateSpeakerEvent(speakerp), "update_speaker"); } speakerp->mStatus = LLSpeaker::STATUS_SPEAKING; @@ -588,7 +588,7 @@ bool LLSpeakerMgr::removeSpeaker(const LLUUID& speaker_id) LL_DEBUGS("Speakers") << "Removed speaker " << speaker_id << LL_ENDL; fireEvent(new LLSpeakerListChangeEvent(this, speaker_id), "remove"); - update(TRUE); + update(true); return false; } @@ -606,7 +606,7 @@ LLPointer<LLSpeaker> LLSpeakerMgr::findSpeaker(const LLUUID& speaker_id) return found_it->second; } -void LLSpeakerMgr::getSpeakerList(speaker_list_t* speaker_list, BOOL include_text) +void LLSpeakerMgr::getSpeakerList(speaker_list_t* speaker_list, bool include_text) { speaker_list->clear(); for (speaker_map_t::iterator speaker_it = mSpeakers.begin(); speaker_it != mSpeakers.end(); ++speaker_it) @@ -630,7 +630,7 @@ bool LLSpeakerMgr::isSpeakerToBeRemoved(const LLUUID& speaker_id) return mSpeakerDelayRemover && mSpeakerDelayRemover->isTimerStarted(speaker_id); } -void LLSpeakerMgr::setSpeakerTyping(const LLUUID& speaker_id, BOOL typing) +void LLSpeakerMgr::setSpeakerTyping(const LLUUID& speaker_id, bool typing) { LLPointer<LLSpeaker> speakerp = findSpeaker(speaker_id); if (speakerp.notNull()) @@ -646,12 +646,12 @@ void LLSpeakerMgr::speakerChatted(const LLUUID& speaker_id) if (speakerp.notNull()) { speakerp->mLastSpokeTime = mSpeechTimer.getElapsedTimeF32(); - speakerp->mHasSpoken = TRUE; + speakerp->mHasSpoken = true; fireEvent(new LLSpeakerUpdateSpeakerEvent(speakerp), "update_speaker"); } } -BOOL LLSpeakerMgr::isVoiceActive() +bool LLSpeakerMgr::isVoiceActive() { // mVoiceChannel = NULL means current voice channel, whatever it is return LLVoiceClient::getInstance()->voiceEnabled() && mVoiceChannel && mVoiceChannel->isActive(); @@ -696,7 +696,7 @@ void LLIMSpeakerMgr::setSpeakers(const LLSD& speakers) if ( speaker_it->second.isMap() ) { - BOOL is_moderator = speakerp->mIsModerator; + bool is_moderator = speakerp->mIsModerator; speakerp->mIsModerator = speaker_it->second["is_moderator"]; speakerp->mModeratorMutedText = speaker_it->second["mutes"]["text"]; @@ -771,7 +771,7 @@ void LLIMSpeakerMgr::updateSpeakers(const LLSD& update) if (agent_info.has("is_moderator")) { - BOOL is_moderator = speakerp->mIsModerator; + bool is_moderator = speakerp->mIsModerator; speakerp->mIsModerator = agent_info["is_moderator"]; // Fire event only if moderator changed if ( is_moderator != speakerp->mIsModerator ) @@ -842,7 +842,7 @@ void LLIMSpeakerMgr::moderateVoiceParticipant(const LLUUID& avatar_id, bool unmu if (!speakerp || !mVoiceChannel) return; // *NOTE: mantipov: probably this condition will be incorrect when avatar will be blocked for - // text chat via moderation (LLSpeaker::mModeratorMutedText == TRUE) + // text chat via moderation (LLSpeaker::mModeratorMutedText == true) bool is_in_voice = speakerp->mStatus <= LLSpeaker::STATUS_VOICE_ACTIVE || speakerp->mStatus == LLSpeaker::STATUS_MUTED; // do not send voice moderation changes for avatars not in voice channel diff --git a/indra/newview/llspeakers.h b/indra/newview/llspeakers.h index c16da269e4..ad2461f60f 100644 --- a/indra/newview/llspeakers.h +++ b/indra/newview/llspeakers.h @@ -70,16 +70,16 @@ public: F32 mLastSpokeTime; // timestamp when this speaker last spoke F32 mSpeechVolume; // current speech amplitude (timea average rms amplitude?) std::string mDisplayName; // cache user name for this speaker - BOOL mHasSpoken; // has this speaker said anything this session? - BOOL mHasLeftCurrentCall; // has this speaker left the current voice call? + bool mHasSpoken; // has this speaker said anything this session? + bool mHasLeftCurrentCall; // has this speaker left the current voice call? LLColor4 mDotColor; LLUUID mID; - BOOL mTyping; + bool mTyping; S32 mSortIndex; ESpeakerType mType; - BOOL mIsModerator; - BOOL mModeratorMutedVoice; - BOOL mModeratorMutedText; + bool mIsModerator; + bool mModeratorMutedVoice; + bool mModeratorMutedText; }; class LLSpeakerUpdateSpeakerEvent : public LLOldEvents::LLEvent @@ -98,7 +98,7 @@ public: /*virtual*/ LLSD getValue(); private: const LLUUID& mSpeakerID; - BOOL mIsModerator; + bool mIsModerator; }; class LLSpeakerTextModerationEvent : public LLOldEvents::LLEvent @@ -159,7 +159,7 @@ public: * * If action callback is not specified returns true. Instance will be deleted by LLEventTimer::updateClass(). */ - virtual BOOL tick(); + virtual bool tick(); /** * Clears the callback. @@ -228,18 +228,18 @@ public: virtual ~LLSpeakerMgr(); LLPointer<LLSpeaker> findSpeaker(const LLUUID& avatar_id); - void update(BOOL resort_ok); - void setSpeakerTyping(const LLUUID& speaker_id, BOOL typing); + void update(bool resort_ok); + void setSpeakerTyping(const LLUUID& speaker_id, bool typing); void speakerChatted(const LLUUID& speaker_id); LLPointer<LLSpeaker> setSpeaker(const LLUUID& id, const std::string& name = LLStringUtil::null, LLSpeaker::ESpeakerStatus status = LLSpeaker::STATUS_TEXT_ONLY, LLSpeaker::ESpeakerType = LLSpeaker::SPEAKER_AGENT); - BOOL isVoiceActive(); + bool isVoiceActive(); typedef std::vector<LLPointer<LLSpeaker> > speaker_list_t; - void getSpeakerList(speaker_list_t* speaker_list, BOOL include_text); + void getSpeakerList(speaker_list_t* speaker_list, bool include_text); LLVoiceChannel* getVoiceChannel() { return mVoiceChannel; } void setVoiceChannel(LLVoiceChannel *voiceChannel) { mVoiceChannel = voiceChannel; } const LLUUID getSessionID(); diff --git a/indra/newview/llspeakingindicatormanager.cpp b/indra/newview/llspeakingindicatormanager.cpp index f16ab3b25a..ca99d351bb 100644 --- a/indra/newview/llspeakingindicatormanager.cpp +++ b/indra/newview/llspeakingindicatormanager.cpp @@ -109,9 +109,9 @@ private: * Changes state of indicators specified by LLUUIDs * * @param speakers_uuids - avatars' LLUUIDs whose speaking indicators should be switched - * @param switch_on - if TRUE specified indicator will be switched on, off otherwise. + * @param switch_on - if true specified indicator will be switched on, off otherwise. */ - void switchSpeakerIndicators(const speaker_ids_t& speakers_uuids, BOOL switch_on); + void switchSpeakerIndicators(const speaker_ids_t& speakers_uuids, bool switch_on); /** * Ensures that passed instance of Speaking Indicator does not exist among registered ones. @@ -154,7 +154,7 @@ void SpeakingIndicatorManager::registerSpeakingIndicator(const LLUUID& speaker_i mSpeakingIndicators.insert(value_type); speaker_ids_t speakers_uuids; - BOOL is_in_same_voice = LLVoiceClient::getInstance()->isParticipant(speaker_id); + bool is_in_same_voice = LLVoiceClient::getInstance()->isParticipant(speaker_id); speakers_uuids.insert(speaker_id); switchSpeakerIndicators(speakers_uuids, is_in_same_voice); @@ -201,7 +201,7 @@ void SpeakingIndicatorManager::cleanupSingleton() void SpeakingIndicatorManager::sOnCurrentChannelChanged(const LLUUID& /*session_id*/) { - switchSpeakerIndicators(mSwitchedIndicatorsOn, FALSE); + switchSpeakerIndicators(mSwitchedIndicatorsOn, false); mSwitchedIndicatorsOn.clear(); } @@ -214,15 +214,15 @@ void SpeakingIndicatorManager::onParticipantsChanged() LL_DEBUGS("SpeakingIndicator") << "Switching all OFF, count: " << mSwitchedIndicatorsOn.size() << LL_ENDL; // switch all indicators off - switchSpeakerIndicators(mSwitchedIndicatorsOn, FALSE); + switchSpeakerIndicators(mSwitchedIndicatorsOn, false); mSwitchedIndicatorsOn.clear(); LL_DEBUGS("SpeakingIndicator") << "Switching all ON, count: " << speakers_uuids.size() << LL_ENDL; // then switch current voice participants indicators on - switchSpeakerIndicators(speakers_uuids, TRUE); + switchSpeakerIndicators(speakers_uuids, true); } -void SpeakingIndicatorManager::switchSpeakerIndicators(const speaker_ids_t& speakers_uuids, BOOL switch_on) +void SpeakingIndicatorManager::switchSpeakerIndicators(const speaker_ids_t& speakers_uuids, bool switch_on) { LLVoiceChannel* voice_channel = LLVoiceChannel::getCurrentVoiceChannel(); LLUUID session_id; diff --git a/indra/newview/llsplitbutton.cpp b/indra/newview/llsplitbutton.cpp index 5e363b358a..6c252ed31f 100644 --- a/indra/newview/llsplitbutton.cpp +++ b/indra/newview/llsplitbutton.cpp @@ -67,7 +67,7 @@ void LLSplitButton::onFocusLost() LLUICtrl::onFocusLost(); } -void LLSplitButton::setFocus(BOOL b) +void LLSplitButton::setFocus(bool b) { LLUICtrl::setFocus(b); @@ -75,12 +75,12 @@ void LLSplitButton::setFocus(BOOL b) { if (mItemsPanel && mItemsPanel->getVisible()) { - mItemsPanel->setFocus(TRUE); + mItemsPanel->setFocus(true); } } } -void LLSplitButton::setEnabled(BOOL enabled) +void LLSplitButton::setEnabled(bool enabled) { LLView::setEnabled(enabled); mArrowBtn->setEnabled(enabled); @@ -93,7 +93,7 @@ void LLSplitButton::onArrowBtnDown() { showButtons(); - setFocus(TRUE); + setFocus(true); if (mArrowBtn->hasMouseCapture() || mShownItem->hasMouseCapture()) { @@ -126,14 +126,14 @@ void LLSplitButton::onItemSelected(LLUICtrl* ctrl) gFocusMgr.setKeyboardFocus(NULL); } -BOOL LLSplitButton::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLSplitButton::handleMouseUp(S32 x, S32 y, MASK mask) { gFocusMgr.setMouseCapture(NULL); if (mShownItem->parentPointInView(x, y)) { onItemSelected(mShownItem); - return TRUE; + return true; } for (std::list<LLButton*>::const_iterator it = mHidenItems.begin(); it != mHidenItems.end(); ++it) @@ -147,10 +147,10 @@ BOOL LLSplitButton::handleMouseUp(S32 x, S32 y, MASK mask) if (item->parentPointInView(panel_x, panel_y)) { onItemSelected(item); - return TRUE; + return true; } } - return TRUE; + return true; } void LLSplitButton::showButtons() @@ -161,21 +161,21 @@ void LLSplitButton::showButtons() // effectively putting us into a special draw layer gViewerWindow->addPopup(this); - mItemsPanel->setFocus(TRUE); + mItemsPanel->setFocus(true); //push arrow button down and show the item buttons - mArrowBtn->setToggleState(TRUE); - mItemsPanel->setVisible(TRUE); + mArrowBtn->setToggleState(true); + mItemsPanel->setVisible(true); - setUseBoundingRect(TRUE); + setUseBoundingRect(true); } void LLSplitButton::hideButtons() { - mItemsPanel->setVisible(FALSE); - mArrowBtn->setToggleState(FALSE); + mItemsPanel->setVisible(false); + mArrowBtn->setToggleState(false); - setUseBoundingRect(FALSE); + setUseBoundingRect(false); gViewerWindow->removePopup(this); } @@ -216,7 +216,7 @@ LLSplitButton::LLSplitButton(const LLSplitButton::Params& p) //a panel for hidden item buttons LLPanel::Params panel_params = p.items_panel; - mItemsPanel= prepareItemsPanel(panel_params, p.items.numValidElements()); + mItemsPanel= prepareItemsPanel(panel_params, static_cast<S32>(p.items.numValidElements())); addChild(mItemsPanel); diff --git a/indra/newview/llsplitbutton.h b/indra/newview/llsplitbutton.h index 4571a233fe..b6ee47a9c7 100644 --- a/indra/newview/llsplitbutton.h +++ b/indra/newview/llsplitbutton.h @@ -71,8 +71,8 @@ public: //Overridden virtual void onFocusLost(); - virtual void setFocus(BOOL b); - virtual void setEnabled(BOOL enabled); + virtual void setFocus(bool b); + virtual void setEnabled(bool enabled); //Callbacks void onArrowBtnDown(); @@ -80,7 +80,7 @@ public: void onItemSelected(LLUICtrl* ctrl); void setSelectionCallback(commit_callback_t cb) { mSelectionCallback = cb; } - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); virtual void showButtons(); virtual void hideButtons(); diff --git a/indra/newview/llsprite.cpp b/indra/newview/llsprite.cpp index 60cc406742..e51aeb6080 100644 --- a/indra/newview/llsprite.cpp +++ b/indra/newview/llsprite.cpp @@ -60,8 +60,8 @@ LLSprite::LLSprite(const LLUUID &image_uuid) : mPitch(0.f), mYaw(0.f), mPosition(0.0f, 0.0f, 0.0f), - mFollow(TRUE), - mUseCameraUp(TRUE), + mFollow(true), + mUseCameraUp(true), mColor(0.5f, 0.5f, 0.5f, 1.0f), mTexMode(GL_REPLACE) { @@ -266,12 +266,12 @@ void LLSprite::setYaw(F32 yaw) mYaw = yaw; } -void LLSprite::setFollow(const BOOL follow) +void LLSprite::setFollow(const bool follow) { mFollow = follow; } -void LLSprite::setUseCameraUp(const BOOL use_up) +void LLSprite::setUseCameraUp(const bool use_up) { mUseCameraUp = use_up; } diff --git a/indra/newview/llsprite.h b/indra/newview/llsprite.h index 604ece43d2..44439bd30c 100644 --- a/indra/newview/llsprite.h +++ b/indra/newview/llsprite.h @@ -61,8 +61,8 @@ public: void setPitch(const F32 pitch); void setSize(const F32 width, const F32 height); void setYaw(const F32 yaw); - void setFollow(const BOOL follow); - void setUseCameraUp(const BOOL use_up); + void setFollow(const bool follow); + void setUseCameraUp(const bool use_up); void setTexMode(LLGLenum mode); void setColor(const LLColor4 &color); @@ -85,8 +85,8 @@ private: F32 mPitch; F32 mYaw; LLVector3 mPosition; - BOOL mFollow; - BOOL mUseCameraUp; + bool mFollow; + bool mUseCameraUp; LLColor4 mColor; LLGLenum mTexMode; diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 96ff0fceb4..a8fc1451f5 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -40,10 +40,6 @@ #include "llviewermedia_streamingaudio.h" #include "llaudioengine.h" -#ifdef LL_FMODSTUDIO -# include "llaudioengine_fmodstudio.h" -#endif - #ifdef LL_OPENAL #include "llaudioengine_openal.h" #endif @@ -337,10 +333,18 @@ void update_texture_fetch() void set_flags_and_update_appearance() { - LLAppearanceMgr::instance().setAttachmentInvLinkEnable(true); - LLAppearanceMgr::instance().updateAppearanceFromCOF(true, true, no_op); + // this may be called from a coroutine but has many side effects + // in non-thread-safe classes, post to main loop + auto work = []() + { + LLAppearanceMgr::instance().setAttachmentInvLinkEnable(true); + LLAppearanceMgr::instance().updateAppearanceFromCOF(true, true, no_op); + + LLInventoryModelBackgroundFetch::instance().start(); + }; + + LLAppViewer::instance()->postToMainCoro(work); - LLInventoryModelBackgroundFetch::instance().start(); } // Returns false to skip other idle processing. Should only return @@ -385,7 +389,7 @@ bool idle_startup() const std::string delims (" "); std::string system; - int begIdx, endIdx; + size_t begIdx, endIdx; std::string osString = LLOSInfo::instance().getOSStringSimple(); begIdx = osString.find_first_not_of (delims); @@ -544,7 +548,7 @@ bool idle_startup() LLVersionInfo::instance().getMajor(), LLVersionInfo::instance().getMinor(), LLVersionInfo::instance().getPatch(), - FALSE, + false, std::string(), responder, failure_is_fatal, @@ -615,7 +619,7 @@ bool idle_startup() F32 xfer_throttle_bps = gSavedSettings.getF32("XferThrottle"); if (xfer_throttle_bps > 1.f) { - gXferManager->setUseAckThrottling(TRUE); + gXferManager->setUseAckThrottling(true); gXferManager->setAckThrottleBPS(xfer_throttle_bps); } gAssetStorage = new LLViewerAssetStorage(msg, gXferManager); @@ -629,13 +633,13 @@ bool idle_startup() if (inBandwidth != 0.f) { LL_DEBUGS("AppInit") << "Setting packetring incoming bandwidth to " << inBandwidth << LL_ENDL; - msg->mPacketRing.setUseInThrottle(TRUE); + msg->mPacketRing.setUseInThrottle(true); msg->mPacketRing.setInBandwidth(inBandwidth); } if (outBandwidth != 0.f) { LL_DEBUGS("AppInit") << "Setting packetring outgoing bandwidth to " << outBandwidth << LL_ENDL; - msg->mPacketRing.setUseOutThrottle(TRUE); + msg->mPacketRing.setUseOutThrottle(true); msg->mPacketRing.setOutBandwidth(outBandwidth); } } @@ -647,20 +651,11 @@ bool idle_startup() // or audio cues in connection UI. //------------------------------------------------- - if (FALSE == gSavedSettings.getBOOL("NoAudio")) + if (false == gSavedSettings.getBOOL("NoAudio")) { delete gAudiop; gAudiop = NULL; -#ifdef LL_FMODSTUDIO -#if !LL_WINDOWS - if (NULL == getenv("LL_BAD_FMODSTUDIO_DRIVER")) -#endif // !LL_WINDOWS - { - gAudiop = (LLAudioEngine *) new LLAudioEngine_FMODSTUDIO(gSavedSettings.getBOOL("FMODExProfilerEnable")); - } -#endif - #ifdef LL_OPENAL #if !LL_WINDOWS if (NULL == getenv("LL_BAD_OPENAL_DRIVER")) @@ -681,21 +676,10 @@ bool idle_startup() #endif if (gAudiop->init(window_handle, LLAppViewer::instance()->getSecondLifeTitle())) { - if (FALSE == gSavedSettings.getBOOL("UseMediaPluginsForStreamingAudio")) - { - LL_INFOS("AppInit") << "Using default impl to render streaming audio" << LL_ENDL; - gAudiop->setStreamingAudioImpl(gAudiop->createDefaultStreamingAudioImpl()); - } - - // if the audio engine hasn't set up its own preferred handler for streaming audio - // then set up the generic streaming audio implementation which uses media plugins - if (NULL == gAudiop->getStreamingAudioImpl()) - { - LL_INFOS("AppInit") << "Using media plugins to render streaming audio" << LL_ENDL; - gAudiop->setStreamingAudioImpl(new LLStreamingAudio_MediaPlugins()); - } + LL_INFOS("AppInit") << "Using media plugins to render streaming audio" << LL_ENDL; + gAudiop->setStreamingAudioImpl(new LLStreamingAudio_MediaPlugins()); - gAudiop->setMuted(TRUE); + gAudiop->setMuted(true); } else { @@ -723,15 +707,15 @@ bool idle_startup() // Previous initializeLoginInfo may have generated user credentials. Re-check them. if (gUserCredential.isNull()) { - show_connect_box = TRUE; + show_connect_box = true; } else if (gSavedSettings.getBOOL("AutoLogin")) { // Log into last account gRememberPassword = true; gRememberUser = true; - gSavedSettings.setBOOL("RememberPassword", TRUE); - gSavedSettings.setBOOL("RememberUser", TRUE); + gSavedSettings.setBOOL("RememberPassword", true); + gSavedSettings.setBOOL("RememberUser", true); show_connect_box = false; } else if (gSavedSettings.getLLSD("UserLoginInfo").size() == 3) @@ -745,7 +729,7 @@ bool idle_startup() { gRememberPassword = gSavedSettings.getBOOL("RememberPassword"); gRememberUser = gSavedSettings.getBOOL("RememberUser"); - show_connect_box = TRUE; + show_connect_box = true; } //setup map of datetime strings to codes and slt & local time offset from utc @@ -754,7 +738,7 @@ bool idle_startup() // Go to the next startup state LLStartUp::setStartupState( STATE_BROWSER_INIT ); - return FALSE; + return false; } @@ -766,7 +750,7 @@ bool idle_startup() display_startup(); // LLViewerMedia::initBrowser(); LLStartUp::setStartupState( STATE_LOGIN_SHOW ); - return FALSE; + return false; } @@ -808,7 +792,7 @@ bool idle_startup() gUserCredential = gLoginHandler.initializeLoginInfo(); } // Make sure the process dialog doesn't hide things - gViewerWindow->setShowProgress(FALSE); + gViewerWindow->setShowProgress(false); // Show the login dialog login_show(); // connect dialog is already shown, so fill in the names @@ -838,9 +822,9 @@ bool idle_startup() LLStartUp::setStartupState( STATE_LOGIN_CLEANUP ); } - gViewerWindow->setNormalControlsVisible( FALSE ); - gLoginMenuBarView->setVisible( TRUE ); - gLoginMenuBarView->setEnabled( TRUE ); + gViewerWindow->setNormalControlsVisible( false ); + gLoginMenuBarView->setVisible( true ); + gLoginMenuBarView->setEnabled( true ); show_debug_menus(); // Hide the splash screen @@ -861,7 +845,7 @@ bool idle_startup() #endif display_startup(); timeout.reset(); - return FALSE; + return false; } if (STATE_LOGIN_WAIT == LLStartUp::getStartupState()) @@ -877,7 +861,7 @@ bool idle_startup() // display() function will be the one to run display_startup() // Sleep so we don't spin the CPU ms_sleep(1); - return FALSE; + return false; } if (STATE_LOGIN_CLEANUP == LLStartUp::getStartupState()) @@ -893,7 +877,7 @@ bool idle_startup() // could then change the preferences to fix the issue. LLStartUp::setStartupState(STATE_LOGIN_SHOW); - return FALSE; + return false; } // reset the values that could have come in from a slurl @@ -1038,14 +1022,14 @@ bool idle_startup() // Display the startup progress bar. gViewerWindow->initTextures(agent_location_id); - gViewerWindow->setShowProgress(TRUE); - gViewerWindow->setProgressCancelButtonVisible(TRUE, LLTrans::getString("Quit")); + gViewerWindow->setShowProgress(true); + gViewerWindow->setProgressCancelButtonVisible(true, LLTrans::getString("Quit")); gViewerWindow->revealIntroPanel(); LLStartUp::setStartupState( STATE_LOGIN_AUTH_INIT ); - return FALSE; + return false; } if(STATE_LOGIN_AUTH_INIT == LLStartUp::getStartupState()) @@ -1071,7 +1055,7 @@ bool idle_startup() login->connect(gUserCredential); LLStartUp::setStartupState( STATE_LOGIN_CURL_UNSTUCK ); - return FALSE; + return false; } if(STATE_LOGIN_CURL_UNSTUCK == LLStartUp::getStartupState()) @@ -1082,7 +1066,7 @@ bool idle_startup() set_startup_status(progress, auth_desc, auth_message); LLStartUp::setStartupState( STATE_LOGIN_PROCESS_RESPONSE ); - return FALSE; + return false; } if(STATE_LOGIN_PROCESS_RESPONSE == LLStartUp::getStartupState()) @@ -1200,7 +1184,7 @@ bool idle_startup() general_cert_done); reset_login(); - gSavedSettings.setBOOL("AutoLogin", FALSE); + gSavedSettings.setBOOL("AutoLogin", false); show_connect_box = true; } if(certificate) @@ -1227,7 +1211,7 @@ bool idle_startup() general_cert_done); reset_login(); - gSavedSettings.setBOOL("AutoLogin", FALSE); + gSavedSettings.setBOOL("AutoLogin", false); show_connect_box = true; } @@ -1271,10 +1255,10 @@ bool idle_startup() LLNotificationsUtil::add("ErrorMessage", args, LLSD(), login_alert_done); transition_back_to_login_panel(emsg.str()); show_connect_box = true; - return FALSE; + return false; } } - return FALSE; + return false; } //--------------------------------------------------------------------- @@ -1296,7 +1280,7 @@ bool idle_startup() // Since we connected, save off the settings so the user doesn't have to // type the name/password again if we crash. - gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE); + gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), true); LLUIColorTable::instance().saveUserSettings(); display_startup(); @@ -1377,7 +1361,7 @@ bool idle_startup() LLStartUp::setStartupState( STATE_MULTIMEDIA_INIT ); - return FALSE; + return false; } @@ -1390,7 +1374,7 @@ bool idle_startup() LLStartUp::multimediaInit(); LLStartUp::setStartupState( STATE_FONT_INIT ); display_startup(); - return FALSE; + return false; } // Loading fonts takes several seconds @@ -1399,7 +1383,7 @@ bool idle_startup() LLStartUp::fontInit(); LLStartUp::setStartupState( STATE_SEED_GRANTED_WAIT ); display_startup(); - return FALSE; + return false; } //--------------------------------------------------------------------- @@ -1453,7 +1437,7 @@ bool idle_startup() } } display_startup(); - return FALSE; + return false; } @@ -1478,10 +1462,10 @@ bool idle_startup() if ( gViewerWindow != NULL) { // This isn't the first logon attempt, so show the UI - gViewerWindow->setNormalControlsVisible( TRUE ); + gViewerWindow->setNormalControlsVisible( true ); } - gLoginMenuBarView->setVisible( FALSE ); - gLoginMenuBarView->setEnabled( FALSE ); + gLoginMenuBarView->setVisible( false ); + gLoginMenuBarView->setEnabled( false ); display_startup(); // direct logging to the debug console's line buffer @@ -1506,7 +1490,7 @@ bool idle_startup() display_startup(); #ifndef LL_RELEASE_FOR_DOWNLOAD - gMessageSystem->setTimeDecodes( TRUE ); // Time the decode of each msg + gMessageSystem->setTimeDecodes( true ); // Time the decode of each msg gMessageSystem->setTimeDecodesSpamThreshold( 0.05f ); // Spam if a single msg takes over 50ms to decode #endif display_startup(); @@ -1623,7 +1607,7 @@ bool idle_startup() gUseCircuitCallbackCalled = false; - msg->enableCircuit(gFirstSim, TRUE); + msg->enableCircuit(gFirstSim, true); // now, use the circuit info to tell simulator about us! LL_INFOS("AppInit") << "viewer: UserLoginLocationReply() Enabling " << gFirstSim << " with code " << msg->mOurCircuitCode << LL_ENDL; msg->newMessageFast(_PREHASH_UseCircuitCode); @@ -1634,7 +1618,7 @@ bool idle_startup() msg->sendReliable( gFirstSim, gSavedSettings.getS32("UseCircuitCodeMaxRetries"), - FALSE, + false, (F32Seconds)gSavedSettings.getF32("UseCircuitCodeTimeout"), use_circuit_callback, NULL); @@ -1642,7 +1626,7 @@ bool idle_startup() timeout.reset(); display_startup(); - return FALSE; + return false; } //--------------------------------------------------------------------- @@ -1657,7 +1641,7 @@ bool idle_startup() LLStartUp::setStartupState( STATE_AGENT_SEND ); } pump_idle_startup_network(); - return FALSE; + return false; } //--------------------------------------------------------------------- @@ -1687,7 +1671,7 @@ bool idle_startup() // But not on first login, because you can't see your avatar then if (!gAgent.isFirstLogin()) { - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, true); effectp->setPositionGlobal(gAgent.getPositionGlobal()); effectp->setColor(LLColor4U(gAgent.getEffectColor())); LLHUDManager::getInstance()->sendEffects(); @@ -1697,7 +1681,7 @@ bool idle_startup() timeout.reset(); display_startup(); - return FALSE; + return false; } //--------------------------------------------------------------------- @@ -1748,7 +1732,7 @@ bool idle_startup() } reset_login(); } - return FALSE; + return false; } //--------------------------------------------------------------------- @@ -1802,7 +1786,7 @@ bool idle_startup() display_startup(); LLStartUp::setStartupState(STATE_INVENTORY_SKEL); display_startup(); - return FALSE; + return false; } if (STATE_INVENTORY_SKEL == LLStartUp::getStartupState()) @@ -1834,7 +1818,7 @@ bool idle_startup() display_startup(); LLStartUp::setStartupState(STATE_INVENTORY_SEND2); display_startup(); - return FALSE; + return false; } if (STATE_INVENTORY_SEND2 == LLStartUp::getStartupState()) @@ -1914,7 +1898,7 @@ bool idle_startup() // visible. JC if (show_hud || gSavedSettings.getBOOL("ShowTutorial")) { - LLFloaterReg::showInstance("hud", LLSD(), FALSE); + LLFloaterReg::showInstance("hud", LLSD(), false); } display_startup(); @@ -1951,7 +1935,7 @@ bool idle_startup() LLStartUp::setStartupState(STATE_INVENTORY_CALLBACKS ); display_startup(); - return FALSE; + return false; } //--------------------------------------------------------------------- @@ -1962,7 +1946,7 @@ bool idle_startup() if (!LLInventoryModel::isSysFoldersReady()) { display_startup(); - return FALSE; + return false; } LLInventoryModelBackgroundFetch::instance().start(); @@ -2010,7 +1994,7 @@ bool idle_startup() LLStartUp::setStartupState( STATE_MISC ); display_startup(); - return FALSE; + return false; } @@ -2050,12 +2034,12 @@ bool idle_startup() if (gSavedSettings.getBOOL("ShowHelpOnFirstLogin")) { - gSavedSettings.setBOOL("HelpFloaterOpen", TRUE); + gSavedSettings.setBOOL("HelpFloaterOpen", true); } // Set the show start location to true, now that the user has logged // on with this install. - gSavedSettings.setBOOL("ShowStartLocation", TRUE); + gSavedSettings.setBOOL("ShowStartLocation", true); } display_startup(); @@ -2077,7 +2061,7 @@ bool idle_startup() display_startup(); // We're successfully logged in. - gSavedSettings.setBOOL("FirstLoginThisInstall", FALSE); + gSavedSettings.setBOOL("FirstLoginThisInstall", false); LLFloaterReg::showInitialVisibleInstances(); @@ -2111,8 +2095,8 @@ bool idle_startup() if (item_id.notNull() && asset_id.notNull()) { // Could schedule and delay these for later. - const BOOL no_inform_server = FALSE; - const BOOL no_deactivate_similar = FALSE; + const bool no_inform_server = false; + const bool no_deactivate_similar = false; LLGestureMgr::instance().activateGestureWithAsset(item_id, asset_id, no_inform_server, no_deactivate_similar); @@ -2125,7 +2109,7 @@ bool idle_startup() LLGestureMgr::instance().setFetchIDs(item_ids); LLGestureMgr::instance().startFetch(); } - gDisplaySwapBuffers = TRUE; + gDisplaySwapBuffers = true; display_startup(); LLMessageSystem* msg = gMessageSystem; @@ -2168,13 +2152,13 @@ bool idle_startup() && gSavedSettings.getBOOL("RestoreCameraPosOnLogin")) { // restore old camera pos - gAgentCamera.setFocusOnAvatar(FALSE, FALSE); + gAgentCamera.setFocusOnAvatar(false, false); gAgentCamera.setCameraPosAndFocusGlobal(gSavedSettings.getVector3d("CameraPosOnLogout"), gSavedSettings.getVector3d("FocusPosOnLogout"), LLUUID::null); - BOOL limit_hit = FALSE; + bool limit_hit = false; gAgentCamera.calcCameraPositionTargetGlobal(&limit_hit); if (limit_hit) { - gAgentCamera.setFocusOnAvatar(TRUE, FALSE); + gAgentCamera.setFocusOnAvatar(true, false); } gAgentCamera.stopCameraAnimation(); } @@ -2211,7 +2195,7 @@ bool idle_startup() LLStartUp::setStartupState( STATE_PRECACHE ); timeout.reset(); - return FALSE; + return false; } if (STATE_PRECACHE == LLStartUp::getStartupState()) @@ -2237,7 +2221,7 @@ bool idle_startup() if (isAgentAvatarValid() && !gAgent.isFirstLogin() && !gAgent.isOutfitChosen()) { gAgentWearables.notifyLoadingStarted(); - gAgent.setOutfitChosen(TRUE); + gAgent.setOutfitChosen(true); gAgentWearables.sendDummyAgentWearablesUpdate(); callAfterCOFFetch(set_flags_and_update_appearance); } @@ -2270,7 +2254,7 @@ bool idle_startup() display_startup(); } - return TRUE; + return true; } if (STATE_WEARABLES_WAIT == LLStartUp::getStartupState()) @@ -2316,7 +2300,7 @@ bool idle_startup() { LL_DEBUGS("Avatar") << "avatar fully loaded" << LL_ENDL; LLStartUp::setStartupState( STATE_CLEANUP ); - return TRUE; + return true; } } else @@ -2327,7 +2311,7 @@ bool idle_startup() // We have our clothing, proceed. LL_DEBUGS("Avatar") << "wearables loaded" << LL_ENDL; LLStartUp::setStartupState( STATE_CLEANUP ); - return TRUE; + return true; } } //fall through this frame to STATE_CLEANUP @@ -2356,7 +2340,7 @@ bool idle_startup() LL_DEBUGS("AppInit") << "Done releasing bitmap" << LL_ENDL; //gViewerWindow->revealIntroPanel(); gViewerWindow->setStartupComplete(); - gViewerWindow->setProgressCancelButtonVisible(FALSE); + gViewerWindow->setProgressCancelButtonVisible(false); display_startup(); // We're not away from keyboard, even though login might have taken @@ -2424,10 +2408,10 @@ bool idle_startup() LLPerfStats::StatsRecorder::setAutotuneInit(); - return TRUE; + return true; } - return TRUE; + return true; } // @@ -2441,7 +2425,7 @@ void login_show() // Hide the toolbars: may happen to come back here if login fails after login agent but before login in region if (gToolBarView) { - gToolBarView->setVisible(FALSE); + gToolBarView->setVisible(false); } LLPanelLogin::show( gViewerWindow->getWindowRectScaled(), login_callback, NULL ); @@ -2463,7 +2447,7 @@ void login_callback(S32 option, void *userdata) if (!gSavedSettings.getBOOL("RememberPassword")) { // turn off the setting and write out to disk - gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile") , TRUE ); + gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile") , true ); LLUIColorTable::instance().saveUserSettings(); } @@ -2952,7 +2936,7 @@ void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name, LL_DEBUGS() << "initial outfit category id: " << cat_id << LL_ENDL; } - gAgent.setOutfitChosen(TRUE); + gAgent.setOutfitChosen(true); gAgentWearables.sendDummyAgentWearablesUpdate(); } @@ -3001,7 +2985,7 @@ std::string LLStartUp::startupStateToString(EStartupState state) RTNENUM( STATE_AGENT_SEND ); RTNENUM( STATE_AGENT_WAIT ); RTNENUM( STATE_INVENTORY_SEND ); - RTNENUM( STATE_INVENTORY_CALLBACKS ); + RTNENUM(STATE_INVENTORY_CALLBACKS ); RTNENUM( STATE_INVENTORY_SKEL ); RTNENUM( STATE_INVENTORY_SEND2 ); RTNENUM( STATE_MISC ); @@ -3050,13 +3034,18 @@ void reset_login() if ( gViewerWindow ) { // Hide menus and normal buttons - gViewerWindow->setNormalControlsVisible( FALSE ); - gLoginMenuBarView->setVisible( TRUE ); - gLoginMenuBarView->setEnabled( TRUE ); + gViewerWindow->setNormalControlsVisible( false ); + gLoginMenuBarView->setVisible( true ); + gLoginMenuBarView->setEnabled( true ); } // Hide any other stuff LLFloaterReg::hideVisibleInstances(); + + if (LLStartUp::getStartupState() > STATE_WORLD_INIT) + { + gViewerWindow->resetStatusBarContainer(); + } LLStartUp::setStartupState( STATE_BROWSER_INIT ); if (LLVoiceClient::instanceExists()) @@ -3437,7 +3426,7 @@ void trust_cert_done(const LLSD& notification, const LLSD& response) } case OPT_CANCEL_TRUST: reset_login(); - gSavedSettings.setBOOL("AutoLogin", FALSE); + gSavedSettings.setBOOL("AutoLogin", false); LLStartUp::setStartupState( STATE_LOGIN_SHOW ); default: LLPanelLogin::giveFocus(); @@ -3656,7 +3645,7 @@ bool process_login_success_response() gFirstSim.set(sim_ip_str, sim_port); if (gFirstSim.isOk()) { - gMessageSystem->enableCircuit(gFirstSim, TRUE); + gMessageSystem->enableCircuit(gFirstSim, true); } } std::string region_x_str = response["region_x"]; @@ -3672,7 +3661,7 @@ bool process_login_success_response() if (!look_at_str.empty()) { size_t len = look_at_str.size(); - LLMemoryStream mstr((U8*)look_at_str.c_str(), len); + LLMemoryStream mstr((U8*)look_at_str.c_str(), static_cast<S32>(len)); LLSD sd = LLSDSerialize::fromNotation(mstr, len); gAgentStartLookAt = ll_vector3_from_sd(sd); } @@ -3710,7 +3699,7 @@ bool process_login_success_response() if(!home_location.empty()) { size_t len = home_location.size(); - LLMemoryStream mstr((U8*)home_location.c_str(), len); + LLMemoryStream mstr((U8*)home_location.c_str(), static_cast<S32>(len)); LLSD sd = LLSDSerialize::fromNotation(mstr, len); S32 region_x = sd["region_handle"][0].asInteger(); S32 region_y = sd["region_handle"][1].asInteger(); @@ -3755,7 +3744,7 @@ bool process_login_success_response() // outfit is chosen on COF contents, initial outfit // requested and available, etc. - //gAgent.setGenderChosen(TRUE); + //gAgent.setGenderChosen(true); } bool pacific_daylight_time = false; @@ -3901,6 +3890,6 @@ void transition_back_to_login_panel(const std::string& emsg) { // Bounce back to the login screen. reset_login(); // calls LLStartUp::setStartupState( STATE_LOGIN_SHOW ); - gSavedSettings.setBOOL("AutoLogin", FALSE); + gSavedSettings.setBOOL("AutoLogin", false); } diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index eecf9c60b6..1bab602364 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -124,7 +124,7 @@ LLStatusBar::LLStatusBar(const LLRect& rect) setRect(rect); // status bar can possible overlay menus? - setMouseOpaque(FALSE); + setMouseOpaque(false); mBalanceTimer = new LLFrameTimer(); mHealthTimer = new LLFrameTimer(); @@ -155,13 +155,13 @@ void LLStatusBar::draw() LLPanel::draw(); } -BOOL LLStatusBar::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLStatusBar::handleRightMouseDown(S32 x, S32 y, MASK mask) { show_navbar_context_menu(this,x,y); - return TRUE; + return true; } -BOOL LLStatusBar::postBuild() +bool LLStatusBar::postBuild() { gMenuBarView->setRightMouseDownCallback(boost::bind(&show_navbar_context_menu, _1, _2, _3)); @@ -247,22 +247,22 @@ BOOL LLStatusBar::postBuild() mPanelPresetsCameraPulldown = new LLPanelPresetsCameraPulldown(); addChild(mPanelPresetsCameraPulldown); mPanelPresetsCameraPulldown->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); - mPanelPresetsCameraPulldown->setVisible(FALSE); + mPanelPresetsCameraPulldown->setVisible(false); mPanelPresetsPulldown = new LLPanelPresetsPulldown(); addChild(mPanelPresetsPulldown); mPanelPresetsPulldown->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); - mPanelPresetsPulldown->setVisible(FALSE); + mPanelPresetsPulldown->setVisible(false); mPanelVolumePulldown = new LLPanelVolumePulldown(); addChild(mPanelVolumePulldown); mPanelVolumePulldown->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); - mPanelVolumePulldown->setVisible(FALSE); + mPanelVolumePulldown->setVisible(false); mPanelNearByMedia = new LLPanelNearByMedia(); addChild(mPanelNearByMedia); mPanelNearByMedia->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); - mPanelNearByMedia->setVisible(FALSE); + mPanelNearByMedia->setVisible(false); updateBalancePanelPosition(); @@ -270,7 +270,7 @@ BOOL LLStatusBar::postBuild() mFilterEdit = getChild<LLSearchEditor>( "search_menu_edit" ); mSearchPanel = getChild<LLPanel>( "menu_search_panel" ); - BOOL search_panel_visible = gSavedSettings.getBOOL("MenuSearch"); + bool search_panel_visible = gSavedSettings.getBOOL("MenuSearch"); mSearchPanel->setVisible(search_panel_visible); mFilterEdit->setKeystrokeCallback(boost::bind(&LLStatusBar::onUpdateFilterTerm, this)); mFilterEdit->setCommitCallback(boost::bind(&LLStatusBar::onUpdateFilterTerm, this)); @@ -282,7 +282,7 @@ BOOL LLStatusBar::postBuild() updateMenuSearchPosition(); } - return TRUE; + return true; } // Per-frame updates of visibility @@ -451,7 +451,7 @@ void LLStatusBar::sendMoneyBalanceRequest() } // Double amount of retries due to this request initially happening during busy stage // Ideally this should be turned into a capability - gMessageSystem->sendReliable(gAgent.getRegionHost(), LL_DEFAULT_RELIABLE_RETRIES * 2, TRUE, LL_PING_BASED_TIMEOUT_DUMMY, NULL, NULL); + gMessageSystem->sendReliable(gAgent.getRegionHost(), LL_DEFAULT_RELIABLE_RETRIES * 2, true, LL_PING_BASED_TIMEOUT_DUMMY, NULL, NULL); } @@ -502,7 +502,7 @@ void LLStatusBar::setLandCommitted(S32 committed) mSquareMetersCommitted = committed; } -BOOL LLStatusBar::isUserTiered() const +bool LLStatusBar::isUserTiered() const { return (mSquareMetersCredit > 0); } @@ -548,10 +548,10 @@ void LLStatusBar::onMouseEnterPresetsCamera() // show the master presets pull-down LLUI::getInstance()->clearPopups(); LLUI::getInstance()->addPopup(mPanelPresetsCameraPulldown); - mPanelNearByMedia->setVisible(FALSE); - mPanelVolumePulldown->setVisible(FALSE); - mPanelPresetsPulldown->setVisible(FALSE); - mPanelPresetsCameraPulldown->setVisible(TRUE); + mPanelNearByMedia->setVisible(false); + mPanelVolumePulldown->setVisible(false); + mPanelPresetsPulldown->setVisible(false); + mPanelPresetsCameraPulldown->setVisible(true); } void LLStatusBar::onMouseEnterPresets() @@ -572,9 +572,9 @@ void LLStatusBar::onMouseEnterPresets() // show the master presets pull-down LLUI::getInstance()->clearPopups(); LLUI::getInstance()->addPopup(mPanelPresetsPulldown); - mPanelNearByMedia->setVisible(FALSE); - mPanelVolumePulldown->setVisible(FALSE); - mPanelPresetsPulldown->setVisible(TRUE); + mPanelNearByMedia->setVisible(false); + mPanelVolumePulldown->setVisible(false); + mPanelPresetsPulldown->setVisible(true); } void LLStatusBar::onMouseEnterVolume() @@ -596,10 +596,10 @@ void LLStatusBar::onMouseEnterVolume() // show the master volume pull-down LLUI::getInstance()->clearPopups(); LLUI::getInstance()->addPopup(mPanelVolumePulldown); - mPanelPresetsCameraPulldown->setVisible(FALSE); - mPanelPresetsPulldown->setVisible(FALSE); - mPanelNearByMedia->setVisible(FALSE); - mPanelVolumePulldown->setVisible(TRUE); + mPanelPresetsCameraPulldown->setVisible(false); + mPanelPresetsPulldown->setVisible(false); + mPanelNearByMedia->setVisible(false); + mPanelVolumePulldown->setVisible(true); } void LLStatusBar::onMouseEnterNearbyMedia() @@ -621,10 +621,10 @@ void LLStatusBar::onMouseEnterNearbyMedia() LLUI::getInstance()->clearPopups(); LLUI::getInstance()->addPopup(mPanelNearByMedia); - mPanelPresetsCameraPulldown->setVisible(FALSE); - mPanelPresetsPulldown->setVisible(FALSE); - mPanelVolumePulldown->setVisible(FALSE); - mPanelNearByMedia->setVisible(TRUE); + mPanelPresetsCameraPulldown->setVisible(false); + mPanelPresetsPulldown->setVisible(false); + mPanelVolumePulldown->setVisible(false); + mPanelNearByMedia->setVisible(true); } @@ -658,7 +658,7 @@ void LLStatusBar::onClickFps(void* data) LLFloaterReg::toggleInstance("mpv_performance"); } -BOOL can_afford_transaction(S32 cost) +bool can_afford_transaction(S32 cost) { return((cost <= 0)||((gStatusBar) && (gStatusBar->getBalance() >=cost))); } diff --git a/indra/newview/llstatusbar.h b/indra/newview/llstatusbar.h index 650d7d6c40..7e1ecf08ca 100644 --- a/indra/newview/llstatusbar.h +++ b/indra/newview/llstatusbar.h @@ -64,8 +64,8 @@ public: /*virtual*/ void draw(); - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool handleRightMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool postBuild(); // MANIPULATORS void setBalance(S32 balance); @@ -88,7 +88,7 @@ public: S32 getBalance() const; S32 getHealth() const; - BOOL isUserTiered() const; + bool isUserTiered() const; S32 getSquareMetersCredit() const; S32 getSquareMetersCommitted() const; S32 getSquareMetersLeft() const; @@ -149,7 +149,7 @@ private: }; // *HACK: Status bar owns your cached money balance. JC -BOOL can_afford_transaction(S32 cost); +bool can_afford_transaction(S32 cost); extern LLStatusBar *gStatusBar; diff --git a/indra/newview/llsurface.cpp b/indra/newview/llsurface.cpp index 55ecc7ccc5..e6bced5c92 100644 --- a/indra/newview/llsurface.cpp +++ b/indra/newview/llsurface.cpp @@ -90,7 +90,7 @@ LLSurface::LLSurface(U32 type, LLViewerRegion *regionp) : // One of each for each camera mVisiblePatchCount = 0; - mHasZData = FALSE; + mHasZData = false; // "uninitialized" min/max z mMinZ = 10000.f; mMaxZ = -10000.f; @@ -243,7 +243,7 @@ void LLSurface::createSTexture() } } - mSTexturep = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE); + mSTexturep = LLViewerTextureManager::getLocalTexture(raw.get(), false); mSTexturep->dontDiscard(); gGL.getTexUnit(0)->bind(mSTexturep); mSTexturep->setAddressMode(LLTexUnit::TAM_CLAMP); @@ -268,7 +268,7 @@ void LLSurface::createWaterTexture() } } - mWaterTexturep = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE); + mWaterTexturep = LLViewerTextureManager::getLocalTexture(raw.get(), false); mWaterTexturep->dontDiscard(); gGL.getTexUnit(0)->bind(mWaterTexturep); mWaterTexturep->setAddressMode(LLTexUnit::TAM_CLAMP); @@ -695,7 +695,7 @@ bool LLSurface::idleUpdate(F32 max_update_time) template bool LLSurface::idleUpdate</*PBR=*/false>(F32 max_update_time); template bool LLSurface::idleUpdate</*PBR=*/true>(F32 max_update_time); -void LLSurface::decompressDCTPatch(LLBitPack &bitpack, LLGroupHeader *gopp, BOOL b_large_patch) +void LLSurface::decompressDCTPatch(LLBitPack &bitpack, LLGroupHeader *gopp, bool b_large_patch) { LLPatchHeader ph; @@ -762,16 +762,16 @@ void LLSurface::decompressDCTPatch(LLBitPack &bitpack, LLGroupHeader *gopp, BOOL } -// Retrurns TRUE if "position" is within the bounds of surface. +// Retrurns true if "position" is within the bounds of surface. // "position" is region-local -BOOL LLSurface::containsPosition(const LLVector3 &position) +bool LLSurface::containsPosition(const LLVector3 &position) { if (position.mV[VX] < 0.0f || position.mV[VX] > mMetersPerEdge || position.mV[VY] < 0.0f || position.mV[VY] > mMetersPerEdge) { - return FALSE; + return false; } - return TRUE; + return true; } @@ -1034,8 +1034,8 @@ void LLSurface::createPatchData() for (i=0; i<mPatchesPerEdge; i++) { patchp = getPatch(i, j); - patchp->mHasReceivedData = FALSE; - patchp->mSTexUpdate = TRUE; + patchp->mHasReceivedData = false; + patchp->mSTexUpdate = true; S32 data_offset = i * mGridsPerPatchEdge + j * mGridsPerPatchEdge * mGridsPerEdge; @@ -1222,13 +1222,13 @@ F32 LLSurface::getWaterHeight() const } -BOOL LLSurface::generateWaterTexture(const F32 x, const F32 y, +bool LLSurface::generateWaterTexture(const F32 x, const F32 y, const F32 width, const F32 height) { LL_PROFILE_ZONE_SCOPED if (!getWaterTexture()) { - return FALSE; + return false; } S32 tex_width = mWaterTexturep->getWidth(); @@ -1314,5 +1314,5 @@ BOOL LLSurface::generateWaterTexture(const F32 x, const F32 y, } mWaterTexturep->setSubImage(raw, x_begin, y_begin, x_end - x_begin, y_end - y_begin); - return TRUE; + return true; } diff --git a/indra/newview/llsurface.h b/indra/newview/llsurface.h index 093b141271..324296a4d3 100644 --- a/indra/newview/llsurface.h +++ b/indra/newview/llsurface.h @@ -84,7 +84,7 @@ public: void disconnectNeighbor(LLSurface *neighborp); void disconnectAllNeighbors(); - virtual void decompressDCTPatch(LLBitPack &bitpack, LLGroupHeader *gopp, BOOL b_large_patch); + virtual void decompressDCTPatch(LLBitPack &bitpack, LLGroupHeader *gopp, bool b_large_patch); virtual void updatePatchVisibilities(LLAgent &agent); inline F32 getZ(const U32 k) const { return mSurfaceZ[k]; } @@ -115,7 +115,7 @@ public: template<bool PBR> bool idleUpdate(F32 max_update_time); - BOOL containsPosition(const LLVector3 &position); + bool containsPosition(const LLVector3 &position); void moveZ(const S32 x, const S32 y, const F32 delta); @@ -129,7 +129,7 @@ public: LLViewerTexture *getSTexture(); LLViewerTexture *getWaterTexture(); - BOOL hasZData() const { return mHasZData; } + bool hasZData() const { return mHasZData; } void dirtyAllPatches(); // Use this to dirty all patches when changing terrain parameters @@ -179,7 +179,7 @@ protected: void createPatchData(); // Allocates memory for patches. void destroyPatchData(); // Deallocates memory for patches. - BOOL generateWaterTexture(const F32 x, const F32 y, + bool generateWaterTexture(const F32 x, const F32 y, const F32 width, const F32 height); // Generate texture from composition values. //F32 updateTexture(LLSurfacePatch *ppatch); @@ -214,7 +214,7 @@ protected: LLPatchVertexArray mPVArray; - BOOL mHasZData; // We've received any patch data for this surface. + bool mHasZData; // We've received any patch data for this surface. F32 mMinZ; // min z for this region (during the session) F32 mMaxZ; // max z for this region (during the session) diff --git a/indra/newview/llsurfacepatch.cpp b/indra/newview/llsurfacepatch.cpp index b26d48b07f..042d770550 100644 --- a/indra/newview/llsurfacepatch.cpp +++ b/indra/newview/llsurfacepatch.cpp @@ -47,11 +47,11 @@ extern U64MicrosecondsImplicit gFrameTime; extern LLPipeline gPipeline; LLSurfacePatch::LLSurfacePatch() -: mHasReceivedData(FALSE), - mSTexUpdate(FALSE), - mDirty(FALSE), - mDirtyZStats(TRUE), - mHeightsGenerated(FALSE), +: mHasReceivedData(false), + mSTexUpdate(false), + mDirty(false), + mDirtyZStats(true), + mHeightsGenerated(false), mDataOffset(0), mDataZ(NULL), mDataNorm(NULL), @@ -78,7 +78,7 @@ LLSurfacePatch::LLSurfacePatch() } for (i = 0; i < 9; i++) { - mNormalsInvalid[i] = TRUE; + mNormalsInvalid[i] = true; } } @@ -102,12 +102,12 @@ void LLSurfacePatch::dirty() LL_WARNS("Terrain") << "No viewer object for this surface patch!" << LL_ENDL; } - mDirtyZStats = TRUE; - mHeightsGenerated = FALSE; + mDirtyZStats = true; + mHeightsGenerated = false; if (!mDirty) { - mDirty = TRUE; + mDirty = true; mSurfacep->dirtySurfacePatch(this); } } @@ -137,7 +137,7 @@ void LLSurfacePatch::disconnectNeighbor(LLSurface *surfacep) if (getNeighborPatch(i)->mSurfacep == surfacep) { setNeighborPatch(i, NULL); - mNormalsInvalid[i] = TRUE; + mNormalsInvalid[i] = true; } } } @@ -603,14 +603,14 @@ void LLSurfacePatch::updateVerticalStats() mSurfacep->mMaxZ = llmax(mMaxZ, mSurfacep->mMaxZ); mSurfacep->mMinZ = llmin(mMinZ, mSurfacep->mMinZ); - mSurfacep->mHasZData = TRUE; + mSurfacep->mHasZData = true; mSurfacep->getRegion()->calculateCenterGlobal(); if (mVObjp) { mVObjp->dirtyPatch(); } - mDirtyZStats = FALSE; + mDirtyZStats = false; } @@ -624,7 +624,7 @@ void LLSurfacePatch::updateNormals() U32 grids_per_patch_edge = mSurfacep->getGridsPerPatchEdge(); U32 grids_per_edge = mSurfacep->getGridsPerEdge(); - BOOL dirty_patch = FALSE; + bool dirty_patch = false; U32 i, j; // update the east edge @@ -637,7 +637,7 @@ void LLSurfacePatch::updateNormals() calcNormal<PBR>(grids_per_patch_edge - 2, j, 2); } - dirty_patch = TRUE; + dirty_patch = true; } // update the north edge @@ -650,7 +650,7 @@ void LLSurfacePatch::updateNormals() calcNormal<PBR>(i, grids_per_patch_edge - 2, 2); } - dirty_patch = TRUE; + dirty_patch = true; } // update the west edge @@ -661,7 +661,7 @@ void LLSurfacePatch::updateNormals() calcNormal<PBR>(0, j, 2); calcNormal<PBR>(1, j, 2); } - dirty_patch = TRUE; + dirty_patch = true; } // update the south edge @@ -672,7 +672,7 @@ void LLSurfacePatch::updateNormals() calcNormal<PBR>(i, 0, 2); calcNormal<PBR>(i, 1, 2); } - dirty_patch = TRUE; + dirty_patch = true; } // Invalidating the northeast corner is different, because depending on what the adjacent neighbors are, @@ -750,7 +750,7 @@ void LLSurfacePatch::updateNormals() calcNormal<PBR>(grids_per_patch_edge, grids_per_patch_edge - 1, 2); calcNormal<PBR>(grids_per_patch_edge - 1, grids_per_patch_edge, 2); calcNormal<PBR>(grids_per_patch_edge - 1, grids_per_patch_edge - 1, 2); - dirty_patch = TRUE; + dirty_patch = true; } // update the middle normals @@ -763,7 +763,7 @@ void LLSurfacePatch::updateNormals() calcNormal<PBR>(i, j, 2); } } - dirty_patch = TRUE; + dirty_patch = true; } if (dirty_patch) @@ -773,7 +773,7 @@ void LLSurfacePatch::updateNormals() for (i = 0; i < 9; i++) { - mNormalsInvalid[i] = FALSE; + mNormalsInvalid[i] = false; } } @@ -844,7 +844,7 @@ void LLSurfacePatch::updateNorthEdge() } -BOOL LLSurfacePatch::updateTexture() +bool LLSurfacePatch::updateTexture() { if (mSTexUpdate) // Update texture as needed { @@ -867,11 +867,11 @@ BOOL LLSurfacePatch::updateTexture() if (comp->generateHeights((F32)origin_region[VX], (F32)origin_region[VY], patch_size, patch_size)) { - mHeightsGenerated = TRUE; + mHeightsGenerated = true; } else { - return FALSE; + return false; } } @@ -885,11 +885,11 @@ BOOL LLSurfacePatch::updateTexture() } } } - return FALSE; + return false; } else { - return TRUE; + return true; } } @@ -909,7 +909,7 @@ void LLSurfacePatch::updateGL() if (comp->generateMinimapTileLand((F32)origin_region[VX], (F32)origin_region[VY], tex_patch_size, tex_patch_size)) { - mSTexUpdate = FALSE; + mSTexUpdate = false; // Also generate the water texture mSurfacep->generateWaterTexture((F32)origin_region.mdV[VX], (F32)origin_region.mdV[VY], @@ -919,13 +919,13 @@ void LLSurfacePatch::updateGL() void LLSurfacePatch::dirtyZ() { - mSTexUpdate = TRUE; + mSTexUpdate = true; // Invalidate all normals in this patch U32 i; for (i = 0; i < 9; i++) { - mNormalsInvalid[i] = TRUE; + mNormalsInvalid[i] = true; } // Invalidate normals in this and neighboring patches @@ -933,12 +933,12 @@ void LLSurfacePatch::dirtyZ() { if (getNeighborPatch(i)) { - getNeighborPatch(i)->mNormalsInvalid[gDirOpposite[i]] = TRUE; + getNeighborPatch(i)->mNormalsInvalid[gDirOpposite[i]] = true; getNeighborPatch(i)->dirty(); if (i < 4) { - getNeighborPatch(i)->mNormalsInvalid[gDirAdjacent[gDirOpposite[i]][0]] = TRUE; - getNeighborPatch(i)->mNormalsInvalid[gDirAdjacent[gDirOpposite[i]][1]] = TRUE; + getNeighborPatch(i)->mNormalsInvalid[gDirAdjacent[gDirOpposite[i]][0]] = true; + getNeighborPatch(i)->mNormalsInvalid[gDirAdjacent[gDirOpposite[i]][1]] = true; } } } @@ -974,7 +974,7 @@ void LLSurfacePatch::setOriginGlobal(const LLVector3d &origin_global) mCenterRegion.mV[VX] = origin_region.mV[VX] + 0.5f*mSurfacep->getGridsPerPatchEdge()*mSurfacep->getMetersPerGrid(); mCenterRegion.mV[VY] = origin_region.mV[VY] + 0.5f*mSurfacep->getGridsPerPatchEdge()*mSurfacep->getMetersPerGrid(); - mVisInfo.mbIsVisible = FALSE; + mVisInfo.mbIsVisible = false; mVisInfo.mDistance = 512.0f; mVisInfo.mRenderLevel = 0; mVisInfo.mRenderStride = mSurfacep->getGridsPerPatchEdge(); @@ -984,8 +984,8 @@ void LLSurfacePatch::setOriginGlobal(const LLVector3d &origin_global) void LLSurfacePatch::connectNeighbor(LLSurfacePatch *neighbor_patchp, const U32 direction) { llassert(neighbor_patchp); - mNormalsInvalid[direction] = TRUE; - neighbor_patchp->mNormalsInvalid[gDirOpposite[direction]] = TRUE; + mNormalsInvalid[direction] = true; + neighbor_patchp->mNormalsInvalid[gDirOpposite[direction]] = true; setNeighborPatch(direction, neighbor_patchp); neighbor_patchp->setNeighborPatch(gDirOpposite[direction], this); @@ -1076,11 +1076,11 @@ void LLSurfacePatch::updateVisibility() } } } - mVisInfo.mbIsVisible = TRUE; + mVisInfo.mbIsVisible = true; } else { - mVisInfo.mbIsVisible = FALSE; + mVisInfo.mbIsVisible = false; } } @@ -1095,7 +1095,7 @@ LLVector3 LLSurfacePatch::getOriginAgent() const return gAgent.getPosAgentFromGlobal(mOriginGlobal); } -BOOL LLSurfacePatch::getVisible() const +bool LLSurfacePatch::getVisible() const { return mVisInfo.mbIsVisible; } @@ -1112,10 +1112,10 @@ S32 LLSurfacePatch::getRenderLevel() const void LLSurfacePatch::setHasReceivedData() { - mHasReceivedData = TRUE; + mHasReceivedData = true; } -BOOL LLSurfacePatch::getHasReceivedData() const +bool LLSurfacePatch::getHasReceivedData() const { return mHasReceivedData; } @@ -1180,11 +1180,11 @@ F32 LLSurfacePatch::getMaxComposition() const void LLSurfacePatch::setNeighborPatch(const U32 direction, LLSurfacePatch *neighborp) { mNeighborPatches[direction] = neighborp; - mNormalsInvalid[direction] = TRUE; + mNormalsInvalid[direction] = true; if (direction < 4) { - mNormalsInvalid[gDirAdjacent[direction][0]] = TRUE; - mNormalsInvalid[gDirAdjacent[direction][1]] = TRUE; + mNormalsInvalid[gDirAdjacent[direction][0]] = true; + mNormalsInvalid[gDirAdjacent[direction][1]] = true; } } diff --git a/indra/newview/llsurfacepatch.h b/indra/newview/llsurfacepatch.h index 94d471b43d..195250d2c0 100644 --- a/indra/newview/llsurfacepatch.h +++ b/indra/newview/llsurfacepatch.h @@ -44,13 +44,13 @@ class LLPatchVisibilityInfo { public: LLPatchVisibilityInfo() : - mbIsVisible(FALSE), + mbIsVisible(false), mDistance(0.f), mRenderLevel(0), mRenderStride(0) { }; ~LLPatchVisibilityInfo() { }; - BOOL mbIsVisible; + bool mbIsVisible; F32 mDistance; // Distance from camera S32 mRenderLevel; U32 mRenderStride; @@ -73,7 +73,7 @@ public: void colorPatch(const U8 r, const U8 g, const U8 b); - BOOL updateTexture(); + bool updateTexture(); void updateVerticalStats(); void updateCompositionStats(); @@ -89,7 +89,7 @@ public: void dirtyZ(); // Dirty the z values of this patch void setHasReceivedData(); - BOOL getHasReceivedData() const; + bool getHasReceivedData() const; F32 getDistance() const; F32 getMaxZ() const; @@ -134,7 +134,7 @@ public: // +---+---+---+ - BOOL getVisible() const; + bool getVisible() const; U32 getRenderStride() const; S32 getRenderLevel() const; @@ -144,21 +144,21 @@ public: F32 *getDataZ() const { return mDataZ; } void dirty(); // Mark this surface patch as dirty... - void clearDirty() { mDirty = FALSE; } + void clearDirty() { mDirty = false; } void clearVObj(); public: - BOOL mHasReceivedData; // has the patch EVER received height data? - BOOL mSTexUpdate; // Does the surface texture need to be updated? + bool mHasReceivedData; // has the patch EVER received height data? + bool mSTexUpdate; // Does the surface texture need to be updated? protected: LLSurfacePatch *mNeighborPatches[8]; // Adjacent patches - BOOL mNormalsInvalid[9]; // Which normals are invalid + bool mNormalsInvalid[9]; // Which normals are invalid - BOOL mDirty; - BOOL mDirtyZStats; - BOOL mHeightsGenerated; + bool mDirty; + bool mDirtyZStats; + bool mHeightsGenerated; U32 mDataOffset; F32 *mDataZ; diff --git a/indra/newview/llsyswellitem.cpp b/indra/newview/llsyswellitem.cpp index a79146ecc8..6da55b0a0a 100644 --- a/indra/newview/llsyswellitem.cpp +++ b/indra/newview/llsyswellitem.cpp @@ -68,9 +68,9 @@ void LLSysWellItem::onClickCloseBtn() } //--------------------------------------------------------------------------------- -BOOL LLSysWellItem::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLSysWellItem::handleMouseDown(S32 x, S32 y, MASK mask) { - BOOL res = LLPanel::handleMouseDown(x, y, mask); + bool res = LLPanel::handleMouseDown(x, y, mask); if(!mCloseBtn->getRect().pointInRect(x, y)) mOnItemClick(this); diff --git a/indra/newview/llsyswellitem.h b/indra/newview/llsyswellitem.h index 005883460a..0a4e26cb98 100644 --- a/indra/newview/llsyswellitem.h +++ b/indra/newview/llsyswellitem.h @@ -55,7 +55,7 @@ public: LLUUID getID() { return mID; } // handlers - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); virtual void onMouseEnter(S32 x, S32 y, MASK mask); virtual void onMouseLeave(S32 x, S32 y, MASK mask); diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp index 5c31ad4feb..30142ad601 100644 --- a/indra/newview/llsyswellwindow.cpp +++ b/indra/newview/llsyswellwindow.cpp @@ -50,7 +50,7 @@ LLSysWellWindow::LLSysWellWindow(const LLSD& key) : LLTransientDockableFloater(N } //--------------------------------------------------------------------------------- -BOOL LLSysWellWindow::postBuild() +bool LLSysWellWindow::postBuild() { mMessageList = getChild<LLFlatListView>("notification_list"); @@ -61,7 +61,7 @@ BOOL LLSysWellWindow::postBuild() } //--------------------------------------------------------------------------------- -void LLSysWellWindow::setMinimized(BOOL minimize) +void LLSysWellWindow::setMinimized(bool minimize) { LLTransientDockableFloater::setMinimized(minimize); } @@ -77,7 +77,7 @@ void LLSysWellWindow::handleReshape(const LLRect& rect, bool by_user) void LLSysWellWindow::onStartUpToastClick(S32 x, S32 y, MASK mask) { // just set floater visible. Screen channels will be cleared. - setVisible(TRUE); + setVisible(true); } void LLSysWellWindow::setSysWellChiclet(LLSysWellChiclet* chiclet) @@ -114,7 +114,7 @@ void LLSysWellWindow::removeItemByID(const LLUUID& id) // hide chiclet window if there are no items left if(isWindowEmpty()) { - setVisible(FALSE); + setVisible(false); } } @@ -137,7 +137,7 @@ void LLSysWellWindow::initChannel() } //--------------------------------------------------------------------------------- -void LLSysWellWindow::setVisible(BOOL visible) +void LLSysWellWindow::setVisible(bool visible) { if (visible) { @@ -150,7 +150,7 @@ void LLSysWellWindow::setVisible(BOOL visible) } // do not show empty window - if (NULL == mMessageList || isWindowEmpty()) visible = FALSE; + if (NULL == mMessageList || isWindowEmpty()) visible = false; LLTransientDockableFloater::setVisible(visible); @@ -198,7 +198,7 @@ void LLSysWellWindow::reshapeWindow() S32 newWidth = curRect.getWidth() < MIN_WINDOW_WIDTH ? MIN_WINDOW_WIDTH : curRect.getWidth(); curRect.setLeftTopAndSize(curRect.mLeft, curRect.mTop, newWidth, new_window_height); - reshape(curRect.getWidth(), curRect.getHeight(), TRUE); + reshape(curRect.getWidth(), curRect.getHeight(), true); setRect(curRect); } @@ -277,20 +277,20 @@ void LLIMWellWindow::ObjectRowPanel::onMouseLeave(S32 x, S32 y, MASK mask) //--------------------------------------------------------------------------------- // virtual -BOOL LLIMWellWindow::ObjectRowPanel::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLIMWellWindow::ObjectRowPanel::handleMouseDown(S32 x, S32 y, MASK mask) { // Pass the mouse down event to the chiclet (EXT-596). if (!mChiclet->pointInView(x, y) && !mCloseBtn->getRect().pointInRect(x, y)) // prevent double call of LLIMChiclet::onMouseDown() { mChiclet->onMouseDown(); - return TRUE; + return true; } return LLPanel::handleMouseDown(x, y, mask); } // virtual -BOOL LLIMWellWindow::ObjectRowPanel::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLIMWellWindow::ObjectRowPanel::handleRightMouseDown(S32 x, S32 y, MASK mask) { return mChiclet->handleRightMouseDown(x, y, mask); } @@ -323,9 +323,9 @@ LLIMWellWindow* LLIMWellWindow::findInstance(const LLSD& key /*= LLSD()*/) return LLFloaterReg::findTypedInstance<LLIMWellWindow>("im_well_window", key); } -BOOL LLIMWellWindow::postBuild() +bool LLIMWellWindow::postBuild() { - BOOL rv = LLSysWellWindow::postBuild(); + bool rv = LLSysWellWindow::postBuild(); setTitle(getString("title_im_well_window")); LLIMChiclet::sFindChicletsSignal.connect(boost::bind(&LLIMWellWindow::findObjectChiclet, this, _1)); @@ -375,7 +375,7 @@ void LLIMWellWindow::removeObjectRow(const LLUUID& notification_id) // hide chiclet window if there are no items left if(isWindowEmpty()) { - setVisible(FALSE); + setVisible(false); } } diff --git a/indra/newview/llsyswellwindow.h b/indra/newview/llsyswellwindow.h index fb65680414..618a0e6812 100644 --- a/indra/newview/llsyswellwindow.h +++ b/indra/newview/llsyswellwindow.h @@ -48,7 +48,7 @@ public: LLSysWellWindow(const LLSD& key); virtual ~LLSysWellWindow(); - BOOL postBuild(); + bool postBuild(); // other interface functions // check is window empty @@ -59,11 +59,11 @@ public: LLPanel * findItemByID(const LLUUID& id); // Operating with outfit - virtual void setVisible(BOOL visible); + virtual void setVisible(bool visible); void adjustWindowPosition(); /*virtual*/ void setDocked(bool docked, bool pop_on_undock = true); // override LLFloater's minimization according to EXT-1216 - /*virtual*/ void setMinimized(BOOL minimize); + /*virtual*/ void setMinimized(bool minimize); /*virtual*/ void handleReshape(const LLRect& rect, bool by_user); void onStartUpToastClick(S32 x, S32 y, MASK mask); @@ -71,8 +71,8 @@ public: void setSysWellChiclet(LLSysWellChiclet* chiclet); // size constants for the window and for its elements - static const S32 MAX_WINDOW_HEIGHT = 200; - static const S32 MIN_WINDOW_WIDTH = 318; + static constexpr S32 MAX_WINDOW_HEIGHT = 200; + static constexpr S32 MIN_WINDOW_WIDTH = 318; protected: // init Window's channel @@ -111,7 +111,7 @@ public: static LLIMWellWindow* findInstance(const LLSD& key = LLSD()); static void initClass() { getInstance(); } - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); void addObjectRow(const LLUUID& notification_id, bool new_message = false); void removeObjectRow(const LLUUID& notification_id); @@ -133,8 +133,8 @@ private: virtual ~ObjectRowPanel(); /*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask); /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleRightMouseDown(S32 x, S32 y, MASK mask); private: void onClosePanel(); diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index 56f26c953b..843da97089 100644 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -96,7 +96,7 @@ private: public: LLTextureCacheWorker(LLTextureCache* cache, const LLUUID& id, - U8* data, S32 datasize, S32 offset, + const U8* data, S32 datasize, S32 offset, S32 imagesize, // for writes LLTextureCache::Responder* responder) : LLWorkerClass(cache, "LLTextureCacheWorker"), @@ -108,7 +108,7 @@ public: mOffset(offset), mImageSize(imagesize), mImageFormat(IMG_CODEC_J2C), - mImageLocal(FALSE), + mImageLocal(false), mResponder(responder), mFileHandle(LLLFSThread::nullHandle()), mBytesToRead(0), @@ -145,12 +145,12 @@ protected: LLUUID mID; U8* mReadData; - U8* mWriteData; + const U8* mWriteData; S32 mDataSize; S32 mOffset; S32 mImageSize; EImageCodec mImageFormat; - BOOL mImageLocal; + bool mImageLocal; LLPointer<LLTextureCache::Responder> mResponder; LLLFSThread::handle_t mFileHandle; S32 mBytesToRead; @@ -224,7 +224,7 @@ bool LLTextureCacheLocalFileWorker::doRead() else { mImageSize = local_size; - mImageLocal = TRUE; + mImageLocal = true; } return true; } @@ -239,7 +239,7 @@ class LLTextureCacheRemoteWorker : public LLTextureCacheWorker { public: LLTextureCacheRemoteWorker(LLTextureCache* cache, const LLUUID& id, - U8* data, S32 datasize, S32 offset, + const U8* data, S32 datasize, S32 offset, S32 imagesize, // for writes LLPointer<LLImageRaw> raw, S32 discardlevel, LLTextureCache::Responder* responder) @@ -364,7 +364,7 @@ bool LLTextureCacheRemoteWorker::doRead() else { mImageSize = local_size; - mImageLocal = TRUE; + mImageLocal = true; } } else @@ -796,9 +796,9 @@ LLTextureCache::LLTextureCache(bool threaded) mListMutex(), mFastCacheMutex(), mHeaderAPRFile(NULL), - mReadOnly(TRUE), //do not allow to change the texture cache until setReadOnly() is called. + mReadOnly(true), //do not allow to change the texture cache until setReadOnly() is called. mTexturesSizeTotal(0), - mDoPurge(FALSE), + mDoPurge(false), mFastCachep(NULL), mFastCachePoolp(NULL), mFastCachePadBuffer(NULL) @@ -873,7 +873,7 @@ std::string LLTextureCache::getTextureFileName(const LLUUID& id) } //debug -BOOL LLTextureCache::isInCache(const LLUUID& id) +bool LLTextureCache::isInCache(const LLUUID& id) { LLMutexLock lock(&mHeaderMutex); id_map_t::const_iterator iter = mHeaderIDMap.find(id); @@ -882,7 +882,7 @@ BOOL LLTextureCache::isInCache(const LLUUID& id) } //debug -BOOL LLTextureCache::isInLocal(const LLUUID& id) +bool LLTextureCache::isInLocal(const LLUUID& id) { S32 local_size = 0; std::string local_filename; @@ -894,7 +894,7 @@ BOOL LLTextureCache::isInLocal(const LLUUID& id) local_size = LLAPRFile::size(local_filename, getLocalAPRFilePool()); if (local_size > 0) { - return TRUE ; + return true ; } } @@ -904,7 +904,7 @@ BOOL LLTextureCache::isInLocal(const LLUUID& id) local_size = LLAPRFile::size(local_filename, getLocalAPRFilePool()); if (local_size > 0) { - return TRUE ; + return true ; } } @@ -914,11 +914,11 @@ BOOL LLTextureCache::isInLocal(const LLUUID& id) local_size = LLAPRFile::size(local_filename, getLocalAPRFilePool()); if (local_size > 0) { - return TRUE ; + return true ; } } - return FALSE ; + return false ; } ////////////////////////////////////////////////////////////////////////////// @@ -982,14 +982,14 @@ void LLTextureCache::purgeCache(ELLPath location, bool remove_dir) } //is called in the main thread before initCache(...) is called. -void LLTextureCache::setReadOnly(BOOL read_only) +void LLTextureCache::setReadOnly(bool read_only) { mReadOnly = read_only ; } // Called in the main thread. // Returns the unused amount of max_size if any -S64 LLTextureCache::initCache(ELLPath location, S64 max_size, BOOL texture_cache_mismatch) +S64 LLTextureCache::initCache(ELLPath location, S64 max_size, bool texture_cache_mismatch) { llassert_always(getPending() == 0) ; //should not start accessing the texture cache before initialized. @@ -1314,7 +1314,7 @@ bool LLTextureCache::updateEntry(S32& idx, Entry& entry, S32 new_image_size, S32 if (purge) { - mDoPurge = TRUE; + mDoPurge = true; } } @@ -1375,13 +1375,13 @@ U32 LLTextureCache::openAndReadEntries(std::vector<Entry>& entries) void LLTextureCache::writeEntriesAndClose(const std::vector<Entry>& entries) { - S32 num_entries = entries.size(); + auto num_entries = entries.size(); llassert_always(num_entries == mHeaderEntriesInfo.mEntries); if (!mReadOnly) { LLAPRFile* aprfile = openHeaderEntriesFile(false, (S32)sizeof(EntriesInfo)); - for (S32 idx=0; idx<num_entries; idx++) + for (size_t idx=0; idx<num_entries; idx++) { S32 bytes_written = aprfile->write((void*)(&entries[idx]), (S32)sizeof(Entry)); if(bytes_written != sizeof(Entry)) @@ -1961,7 +1961,7 @@ bool LLTextureCache::readComplete(handle_t handle, bool abort) } LLTextureCache::handle_t LLTextureCache::writeToCache(const LLUUID& id, - U8* data, S32 datasize, S32 imagesize, + const U8* data, S32 datasize, S32 imagesize, LLPointer<LLImageRaw> rawimage, S32 discardlevel, WriteResponder* responder) { @@ -2047,6 +2047,9 @@ LLPointer<LLImageRaw> LLTextureCache::readFromFastCache(const LLUUID& id, S32& d bool LLTextureCache::writeToFastCache(LLUUID image_id, S32 id, LLPointer<LLImageRaw> raw, S32 discardlevel) { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; + + LLImageDataSharedLock lock(raw); + //rescale image if needed if (raw.isNull() || raw->isBufferInvalid() || !raw->getData()) { @@ -2282,11 +2285,11 @@ bool LLTextureCache::removeFromCache(const LLUUID& id) LLTextureCache::ReadResponder::ReadResponder() : mImageSize(0), - mImageLocal(FALSE) + mImageLocal(false) { } -void LLTextureCache::ReadResponder::setData(U8* data, S32 datasize, S32 imagesize, S32 imageformat, BOOL imagelocal) +void LLTextureCache::ReadResponder::setData(U8* data, S32 datasize, S32 imagesize, S32 imageformat, bool imagelocal) { if (mFormattedImage.notNull()) { diff --git a/indra/newview/lltexturecache.h b/indra/newview/lltexturecache.h index 6aa3a51e18..faf722dc8f 100644 --- a/indra/newview/lltexturecache.h +++ b/indra/newview/lltexturecache.h @@ -87,24 +87,24 @@ public: class Responder : public LLResponder { public: - virtual void setData(U8* data, S32 datasize, S32 imagesize, S32 imageformat, BOOL imagelocal) = 0; + virtual void setData(U8* data, S32 datasize, S32 imagesize, S32 imageformat, bool imagelocal) = 0; }; class ReadResponder : public Responder { public: ReadResponder(); - void setData(U8* data, S32 datasize, S32 imagesize, S32 imageformat, BOOL imagelocal); + void setData(U8* data, S32 datasize, S32 imagesize, S32 imageformat, bool imagelocal); void setImage(LLImageFormatted* image) { mFormattedImage = image; } protected: LLPointer<LLImageFormatted> mFormattedImage; S32 mImageSize; - BOOL mImageLocal; + bool mImageLocal; }; class WriteResponder : public Responder { - void setData(U8* data, S32 datasize, S32 imagesize, S32 imageformat, BOOL imagelocal) + void setData(U8* data, S32 datasize, S32 imagesize, S32 imageformat, bool imagelocal) { // not used } @@ -116,8 +116,8 @@ public: /*virtual*/ size_t update(F32 max_time_ms); void purgeCache(ELLPath location, bool remove_dir = true); - void setReadOnly(BOOL read_only) ; - S64 initCache(ELLPath location, S64 maxsize, BOOL texture_cache_mismatch); + void setReadOnly(bool read_only) ; + S64 initCache(ELLPath location, S64 maxsize, bool texture_cache_mismatch); handle_t readFromCache(const std::string& local_filename, const LLUUID& id, S32 offset, S32 size, ReadResponder* responder); @@ -125,7 +125,7 @@ public: handle_t readFromCache(const LLUUID& id, S32 offset, S32 size, ReadResponder* responder); bool readComplete(handle_t handle, bool abort); - handle_t writeToCache(const LLUUID& id, U8* data, S32 datasize, S32 imagesize, LLPointer<LLImageRaw> rawimage, S32 discardlevel, + handle_t writeToCache(const LLUUID& id, const U8* data, S32 datasize, S32 imagesize, LLPointer<LLImageRaw> rawimage, S32 discardlevel, WriteResponder* responder); LLPointer<LLImageRaw> readFromFastCache(const LLUUID& id, S32& discardlevel); bool writeComplete(handle_t handle, bool abort = false); @@ -140,14 +140,14 @@ public: void unlockWorkers() { mWorkersMutex.unlock(); } // debug - S32 getNumReads() { return mReaders.size(); } - S32 getNumWrites() { return mWriters.size(); } + S32 getNumReads() { return static_cast<S32>(mReaders.size()); } + S32 getNumWrites() { return static_cast<S32>(mWriters.size()); } S64Bytes getUsage() { return S64Bytes(mTexturesSizeTotal); } S64Bytes getMaxUsage() { return S64Bytes(sCacheMaxTexturesSize); } U32 getEntries() { return mHeaderEntriesInfo.mEntries; } U32 getMaxEntries() { return sCacheMaxEntries; }; - BOOL isInCache(const LLUUID& id) ; - BOOL isInLocal(const LLUUID& id) ; //not thread safe at the moment + bool isInCache(const LLUUID& id) ; + bool isInLocal(const LLUUID& id) ; //not thread safe at the moment protected: // Accessed by LLTextureCacheWorker @@ -214,7 +214,7 @@ private: typedef std::vector<std::pair<LLPointer<Responder>, bool> > responder_list_t; responder_list_t mCompletedList; - BOOL mReadOnly; + bool mReadOnly; // HEADERS (Include first mip) std::string mHeaderEntriesFileName; diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 4744edd5a3..81a70a81cf 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -148,12 +148,12 @@ LLFloaterTexturePicker::LLFloaterTexturePicker( LLUUID image_asset_id, LLUUID default_image_asset_id, LLUUID blank_image_asset_id, - BOOL tentative, - BOOL allow_no_texture, + bool tentative, + bool allow_no_texture, const std::string& label, PermissionMask immediate_filter_perm_mask, PermissionMask dnd_filter_perm_mask, - BOOL can_apply_immediately, + bool can_apply_immediately, LLUIImagePtr fallback_image, EPickInventoryType pick_type) : LLFloater(LLSD()), @@ -168,12 +168,12 @@ LLFloaterTexturePicker::LLFloaterTexturePicker( mLabel(label), mTentativeLabel(NULL), mResolutionLabel(NULL), - mActive( TRUE ), + mActive( true ), mFilterEdit(NULL), mImmediateFilterPermMask(immediate_filter_perm_mask), mDnDFilterPermMask(dnd_filter_perm_mask), mContextConeOpacity(0.f), - mSelectedItemPinned( FALSE ), + mSelectedItemPinned( false ), mCanApply(true), mCanPreview(true), mLimitsSet(false), @@ -184,12 +184,12 @@ LLFloaterTexturePicker::LLFloaterTexturePicker( mOnFloaterCloseCallback(NULL), mSetImageAssetIDCallback(NULL), mOnUpdateImageStatsCallback(NULL), - mBakeTextureEnabled(FALSE), + mBakeTextureEnabled(false), mInventoryPickType(pick_type) { mCanApplyImmediately = can_apply_immediately; buildFromFile("floater_texture_ctrl.xml"); - setCanMinimize(FALSE); + setCanMinimize(false); } LLFloaterTexturePicker::~LLFloaterTexturePicker() @@ -200,7 +200,7 @@ void LLFloaterTexturePicker::setImageID(const LLUUID& image_id, bool set_selecti { if( ((mImageAssetID != image_id) || mTentative) && mActive) { - mNoCopyTextureSelected = FALSE; + mNoCopyTextureSelected = false; mViewModel->setDirty(); // *TODO: shouldn't we be using setValue() here? mImageAssetID = image_id; @@ -242,7 +242,7 @@ void LLFloaterTexturePicker::setImageID(const LLUUID& image_id, bool set_selecti } if (item_id.isNull()) { - item_id = findItemID(mImageAssetID, FALSE); + item_id = findItemID(mImageAssetID, false); } if (item_id.isNull()) { @@ -254,8 +254,8 @@ void LLFloaterTexturePicker::setImageID(const LLUUID& image_id, bool set_selecti if (itemp && !itemp->getPermissions().allowCopyBy(gAgent.getID())) { // no copy texture - getChild<LLUICtrl>("apply_immediate_check")->setValue(FALSE); - mNoCopyTextureSelected = TRUE; + getChild<LLUICtrl>("apply_immediate_check")->setValue(false); + mNoCopyTextureSelected = true; } } @@ -278,7 +278,7 @@ void LLFloaterTexturePicker::setImageIDFromItem(const LLInventoryItem* itemp, bo setImageID(asset_id, set_selection); } -void LLFloaterTexturePicker::setActive( BOOL active ) +void LLFloaterTexturePicker::setActive( bool active ) { if (!active && getChild<LLUICtrl>("Pipette")->getValue().asBoolean()) { @@ -287,7 +287,7 @@ void LLFloaterTexturePicker::setActive( BOOL active ) mActive = active; } -void LLFloaterTexturePicker::setCanApplyImmediately(BOOL b) +void LLFloaterTexturePicker::setCanApplyImmediately(bool b) { mCanApplyImmediately = b; @@ -415,14 +415,14 @@ bool LLFloaterTexturePicker::updateImageStats() } // virtual -BOOL LLFloaterTexturePicker::handleDragAndDrop( +bool LLFloaterTexturePicker::handleDragAndDrop( S32 x, S32 y, MASK mask, - BOOL drop, + bool drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg) { - BOOL handled = FALSE; + bool handled = false; bool is_mesh = cargo_type == DAD_MESH; bool is_texture = cargo_type == DAD_TEXTURE; @@ -446,9 +446,9 @@ BOOL LLFloaterTexturePicker::handleDragAndDrop( { LLInventoryItem *item = (LLInventoryItem *)cargo_data; - BOOL copy = item->getPermissions().allowCopyBy(gAgent.getID()); - BOOL mod = item->getPermissions().allowModifyBy(gAgent.getID()); - BOOL xfer = item->getPermissions().allowOperationBy(PERM_TRANSFER, + bool copy = item->getPermissions().allowCopyBy(gAgent.getID()); + bool mod = item->getPermissions().allowModifyBy(gAgent.getID()); + bool xfer = item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()); PermissionMask item_perm_mask = 0; @@ -477,13 +477,13 @@ BOOL LLFloaterTexturePicker::handleDragAndDrop( *accept = ACCEPT_NO; } - handled = TRUE; + handled = true; LL_DEBUGS("UserInput") << "dragAndDrop handled by LLFloaterTexturePicker " << getName() << LL_ENDL; return handled; } -BOOL LLFloaterTexturePicker::handleKeyHere(KEY key, MASK mask) +bool LLFloaterTexturePicker::handleKeyHere(KEY key, MASK mask) { LLFolderView* root_folder = mInventoryPanel->getRootFolder(); @@ -498,23 +498,23 @@ BOOL LLFloaterTexturePicker::handleKeyHere(KEY key, MASK mask) LLFolderViewItem* itemp = mInventoryPanel->getItemByID(gInventory.getRootFolderID()); if (itemp) { - root_folder->setSelection(itemp, FALSE, FALSE); + root_folder->setSelection(itemp, false, false); } } root_folder->scrollToShowSelection(); // move focus to inventory proper - mInventoryPanel->setFocus(TRUE); + mInventoryPanel->setFocus(true); // treat this as a user selection of the first filtered result commitIfImmediateSet(); - return TRUE; + return true; } if (mInventoryPanel->hasFocus() && key == KEY_UP) { - mFilterEdit->focusFirstItem(TRUE); + mFilterEdit->focusFirstItem(true); } } @@ -543,7 +543,7 @@ void LLFloaterTexturePicker::onClose(bool app_quitting) } // virtual -BOOL LLFloaterTexturePicker::postBuild() +bool LLFloaterTexturePicker::postBuild() { LLFloater::postBuild(); @@ -596,7 +596,7 @@ BOOL LLFloaterTexturePicker::postBuild() // Disable auto selecting first filtered item because it takes away // selection from the item set by LLTextureCtrl owning this floater. - mInventoryPanel->getRootFolder()->setAutoSelectOverride(TRUE); + mInventoryPanel->getRootFolder()->setAutoSelectOverride(true); // Commented out to scroll to currently selected texture. See EXT-5403. // // store this filter as the default one @@ -610,7 +610,7 @@ BOOL LLFloaterTexturePicker::postBuild() if(!mImageAssetID.isNull() || mInventoryPickType == PICK_MATERIAL) { - mInventoryPanel->setSelection(findItemID(mImageAssetID, FALSE), TAKE_FOCUS_NO); + mInventoryPanel->setSelection(findItemID(mImageAssetID, false), TAKE_FOCUS_NO); } } @@ -622,7 +622,7 @@ BOOL LLFloaterTexturePicker::postBuild() mLocalScrollCtrl->setCommitCallback(onLocalScrollCommit, this); refreshLocalList(); - mNoCopyTextureSelected = FALSE; + mNoCopyTextureSelected = false; getChild<LLUICtrl>("apply_immediate_check")->setValue(mCanApplyImmediately && gSavedSettings.getBOOL("TextureLivePreview")); childSetCommitCallback("apply_immediate_check", onApplyImmediateCheck, this); @@ -632,14 +632,14 @@ BOOL LLFloaterTexturePicker::postBuild() childSetAction("Cancel", LLFloaterTexturePicker::onBtnCancel,this); childSetAction("Select", LLFloaterTexturePicker::onBtnSelect,this); - mSavedFolderState.setApply(FALSE); + mSavedFolderState.setApply(false); LLToolPipette::getInstance()->setToolSelectCallback(boost::bind(&LLFloaterTexturePicker::onTextureSelect, this, _1)); getChild<LLComboBox>("l_bake_use_texture_combo_box")->setCommitCallback(onBakeTextureSelect, this); - setBakeTextureEnabled(TRUE); - return TRUE; + setBakeTextureEnabled(mInventoryPickType != PICK_MATERIAL); + return true; } // virtual @@ -658,7 +658,7 @@ void LLFloaterTexturePicker::draw() mPipetteBtn->setEnabled(mActive); mPipetteBtn->setValue(LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance()); - //BOOL allow_copy = FALSE; + //bool allow_copy = false; if( mOwner ) { mTexturep = NULL; @@ -716,7 +716,7 @@ void LLFloaterTexturePicker::draw() if (mTentativeLabel) { - mTentativeLabel->setVisible( FALSE ); + mTentativeLabel->setVisible( false ); } mDefaultBtn->setEnabled(mImageAssetID != mDefaultImageAssetID || mTentative); @@ -732,7 +732,7 @@ void LLFloaterTexturePicker::draw() // Border LLRect border = getChildView("preview_widget")->getRect(); - gl_rect_2d( border, LLColor4::black, FALSE ); + gl_rect_2d( border, LLColor4::black, false ); // Interior @@ -767,7 +767,7 @@ void LLFloaterTexturePicker::draw() } else { - gl_rect_2d( interior, LLColor4::grey % alpha, TRUE ); + gl_rect_2d( interior, LLColor4::grey % alpha, true ); // Draw X gl_draw_x(interior, LLColor4::black ); @@ -776,7 +776,7 @@ void LLFloaterTexturePicker::draw() // Draw Tentative Label over the image if( mTentative && !mViewModel->isDirty() ) { - mTentativeLabel->setVisible( TRUE ); + mTentativeLabel->setVisible( true ); drawChild(mTentativeLabel); } @@ -792,19 +792,19 @@ void LLFloaterTexturePicker::draw() // After inventory panel filter is applied we have to update // constraint rect for the selected item because of folder view - // AutoSelectOverride set to TRUE. We force PinningSelectedItem - // flag to FALSE state and setting filter "dirty" to update + // AutoSelectOverride set to true. We force PinningSelectedItem + // flag to false state and setting filter "dirty" to update // scroll container to show selected item (see LLFolderView::doIdle()). if (!is_filter_active && !mSelectedItemPinned) { folder_view->setPinningSelectedItem(mSelectedItemPinned); folder_view->getViewModelItem()->dirtyFilter(); - mSelectedItemPinned = TRUE; + mSelectedItemPinned = true; } } } -const LLUUID& LLFloaterTexturePicker::findItemID(const LLUUID& asset_id, BOOL copyable_only, BOOL ignore_library) +const LLUUID& LLFloaterTexturePicker::findItemID(const LLUUID& asset_id, bool copyable_only, bool ignore_library) { if (asset_id.isNull()) { @@ -1038,7 +1038,7 @@ void LLFloaterTexturePicker::onBtnSelect(void* userdata) void LLFloaterTexturePicker::onBtnPipette() { - BOOL pipette_active = getChild<LLUICtrl>("Pipette")->getValue().asBoolean(); + bool pipette_active = getChild<LLUICtrl>("Pipette")->getValue().asBoolean(); pipette_active = !pipette_active; if (pipette_active) { @@ -1050,13 +1050,13 @@ void LLFloaterTexturePicker::onBtnPipette() } } -void LLFloaterTexturePicker::onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action) +void LLFloaterTexturePicker::onSelectionChange(const std::deque<LLFolderViewItem*> &items, bool user_action) { if (items.size()) { LLFolderViewItem* first_item = items.front(); LLInventoryItem* itemp = gInventory.getItem(static_cast<LLFolderViewModelItemInventory*>(first_item->getViewModelItem())->getUUID()); - mNoCopyTextureSelected = FALSE; + mNoCopyTextureSelected = false; if (itemp) { if (!mTextureSelectedCallback.empty()) @@ -1065,7 +1065,7 @@ void LLFloaterTexturePicker::onSelectionChange(const std::deque<LLFolderViewItem } if (!itemp->getPermissions().allowCopyBy(gAgent.getID())) { - mNoCopyTextureSelected = TRUE; + mNoCopyTextureSelected = true; } setImageIDFromItem(itemp, false); mViewModel->setDirty(); // *TODO: shouldn't we be using setValue() here? @@ -1129,7 +1129,7 @@ void LLFloaterTexturePicker::onBtnRemove(void* userdata) LLScrollListItem* list_item = *iter; if (list_item) { - LLSD data = self->mLocalScrollCtrl->getFirstSelected()->getValue(); + LLSD data = list_item->getValue(); LLUUID tracking_id = data["id"]; S32 asset_type = data["type"].asInteger(); @@ -1347,7 +1347,7 @@ void LLFloaterTexturePicker::onFilterEdit(const std::string& search_string ) return; } - mSavedFolderState.setApply(TRUE); + mSavedFolderState.setApply(true); mInventoryPanel->getRootFolder()->applyFunctorRecursively(mSavedFolderState); // add folder with current item to list of previously opened folders LLOpenFoldersWithSelection opener; @@ -1360,7 +1360,7 @@ void LLFloaterTexturePicker::onFilterEdit(const std::string& search_string ) // first letter in search term, save existing folder open state if (!mInventoryPanel->getFilter().isNotDefault()) { - mSavedFolderState.setApply(FALSE); + mSavedFolderState.setApply(false); mInventoryPanel->getRootFolder()->applyFunctorRecursively(mSavedFolderState); } } @@ -1372,19 +1372,19 @@ void LLFloaterTexturePicker::changeMode() { int index = mModeSelector->getValue().asInteger(); - mDefaultBtn->setVisible(index == PICKER_INVENTORY ? TRUE : FALSE); - mBlankBtn->setVisible(index == PICKER_INVENTORY ? TRUE : FALSE); - mNoneBtn->setVisible(index == PICKER_INVENTORY ? TRUE : FALSE); - mFilterEdit->setVisible(index == PICKER_INVENTORY ? TRUE : FALSE); - mInventoryPanel->setVisible(index == PICKER_INVENTORY ? TRUE : FALSE); + mDefaultBtn->setVisible(index == PICKER_INVENTORY); + mBlankBtn->setVisible(index == PICKER_INVENTORY); + mNoneBtn->setVisible(index == PICKER_INVENTORY); + mFilterEdit->setVisible(index == PICKER_INVENTORY); + mInventoryPanel->setVisible(index == PICKER_INVENTORY); - getChild<LLButton>("l_add_btn")->setVisible(index == PICKER_LOCAL ? TRUE : FALSE); - getChild<LLButton>("l_rem_btn")->setVisible(index == PICKER_LOCAL ? TRUE : FALSE); - getChild<LLButton>("l_upl_btn")->setVisible(index == PICKER_LOCAL ? TRUE : FALSE); - getChild<LLScrollListCtrl>("l_name_list")->setVisible(index == PICKER_LOCAL ? TRUE : FALSE); + getChild<LLButton>("l_add_btn")->setVisible(index == PICKER_LOCAL); + getChild<LLButton>("l_rem_btn")->setVisible(index == PICKER_LOCAL); + getChild<LLButton>("l_upl_btn")->setVisible(index == PICKER_LOCAL); + getChild<LLScrollListCtrl>("l_name_list")->setVisible(index == PICKER_LOCAL); - getChild<LLComboBox>("l_bake_use_texture_combo_box")->setVisible(index == PICKER_BAKE ? TRUE : FALSE); - getChild<LLCheckBoxCtrl>("hide_base_mesh_region")->setVisible(FALSE);// index == 2 ? TRUE : FALSE); + getChild<LLComboBox>("l_bake_use_texture_combo_box")->setVisible(index == PICKER_BAKE); + getChild<LLCheckBoxCtrl>("hide_base_mesh_region")->setVisible(false);// index == 2); bool pipette_visible = (index == PICKER_INVENTORY) && (mInventoryPickType != PICK_MATERIAL); @@ -1442,7 +1442,7 @@ void LLFloaterTexturePicker::changeMode() val = 10; } - getChild<LLComboBox>("l_bake_use_texture_combo_box")->setSelectedByValue(val, TRUE); + getChild<LLComboBox>("l_bake_use_texture_combo_box")->setSelectedByValue(val, true); } } @@ -1488,14 +1488,14 @@ void LLFloaterTexturePicker::refreshInventoryFilter() mInventoryPanel->setFilterTypes(filter_types); } -void LLFloaterTexturePicker::setLocalTextureEnabled(BOOL enabled) +void LLFloaterTexturePicker::setLocalTextureEnabled(bool enabled) { mModeSelector->setEnabledByValue(1, enabled); } -void LLFloaterTexturePicker::setBakeTextureEnabled(BOOL enabled) +void LLFloaterTexturePicker::setBakeTextureEnabled(bool enabled) { - BOOL changed = (enabled != mBakeTextureEnabled); + bool changed = (enabled != mBakeTextureEnabled); mBakeTextureEnabled = enabled; mModeSelector->setEnabledByValue(2, enabled); @@ -1549,7 +1549,7 @@ void LLFloaterTexturePicker::setInventoryPickType(EPickInventoryType type) // refresh selection if (!mImageAssetID.isNull() || mInventoryPickType == PICK_MATERIAL) { - mInventoryPanel->setSelection(findItemID(mImageAssetID, FALSE), TAKE_FOCUS_NO); + mInventoryPanel->setSelection(findItemID(mImageAssetID, false), TAKE_FOCUS_NO); } } @@ -1603,10 +1603,10 @@ void LLFloaterTexturePicker::onPickerCallback(const std::vector<std::string>& fi void LLFloaterTexturePicker::onTextureSelect( const LLTextureEntry& te ) { - LLUUID inventory_item_id = findItemID(te.getID(), TRUE); + LLUUID inventory_item_id = findItemID(te.getID(), true); if (inventory_item_id.notNull()) { - LLToolPipette::getInstance()->setResult(TRUE, ""); + LLToolPipette::getInstance()->setResult(true, ""); if (mInventoryPickType == PICK_MATERIAL) { // tes have no data about material ids @@ -1619,20 +1619,20 @@ void LLFloaterTexturePicker::onTextureSelect( const LLTextureEntry& te ) setImageID(te.getID()); } - mNoCopyTextureSelected = FALSE; + mNoCopyTextureSelected = false; LLInventoryItem* itemp = gInventory.getItem(inventory_item_id); if (itemp && !itemp->getPermissions().allowCopyBy(gAgent.getID())) { // no copy texture - mNoCopyTextureSelected = TRUE; + mNoCopyTextureSelected = true; } commitIfImmediateSet(); } else { - LLToolPipette::getInstance()->setResult(FALSE, LLTrans::getString("InventoryNoTexture")); + LLToolPipette::getInstance()->setResult(false, LLTrans::getString("InventoryNoTexture")); } } @@ -1650,12 +1650,12 @@ LLTextureCtrl::LLTextureCtrl(const LLTextureCtrl::Params& p) mOnSelectCallback(NULL), mBorderColor( p.border_color() ), mAllowNoTexture( p.allow_no_texture ), - mAllowLocalTexture( TRUE ), + mAllowLocalTexture( true ), mImmediateFilterPermMask( PERM_NONE ), - mCanApplyImmediately( FALSE ), - mNeedsRawImageData( FALSE ), - mValid( TRUE ), - mShowLoadingPlaceholder( TRUE ), + mCanApplyImmediately( false ), + mNeedsRawImageData( false ), + mValid( true ), + mShowLoadingPlaceholder( true ), mOpenTexPreview(false), mBakeTextureEnabled(true), mInventoryPickType(p.pick_type), @@ -1716,7 +1716,7 @@ LLTextureCtrl::~LLTextureCtrl() closeDependentFloater(); } -void LLTextureCtrl::setShowLoadingPlaceholder(BOOL showLoadingPlaceholder) +void LLTextureCtrl::setShowLoadingPlaceholder(bool showLoadingPlaceholder) { mShowLoadingPlaceholder = showLoadingPlaceholder; } @@ -1726,7 +1726,7 @@ void LLTextureCtrl::setCaption(const std::string& caption) mCaption->setText( caption ); } -void LLTextureCtrl::setCanApplyImmediately(BOOL b) +void LLTextureCtrl::setCanApplyImmediately(bool b) { mCanApplyImmediately = b; LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get(); @@ -1762,7 +1762,7 @@ void LLTextureCtrl::setFilterPermissionMasks(PermissionMask mask) setDnDFilterPermMask(mask); } -void LLTextureCtrl::onVisibilityChange(BOOL new_visibility) +void LLTextureCtrl::onVisibilityChange(bool new_visibility) { if (!new_visibility) { @@ -1775,7 +1775,7 @@ void LLTextureCtrl::onVisibilityChange(BOOL new_visibility) } } -void LLTextureCtrl::setVisible( BOOL visible ) +void LLTextureCtrl::setVisible(bool visible ) { if( !visible ) { @@ -1784,7 +1784,7 @@ void LLTextureCtrl::setVisible( BOOL visible ) LLUICtrl::setVisible( visible ); } -void LLTextureCtrl::setEnabled( BOOL enabled ) +void LLTextureCtrl::setEnabled( bool enabled ) { LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get(); if( floaterp ) @@ -1810,7 +1810,7 @@ void LLTextureCtrl::setEnabled( BOOL enabled ) LLView::setEnabled( enabled ); } -void LLTextureCtrl::setValid(BOOL valid ) +void LLTextureCtrl::setValid(bool valid ) { mValid = valid; if (!valid) @@ -1818,7 +1818,7 @@ void LLTextureCtrl::setValid(BOOL valid ) LLFloaterTexturePicker* pickerp = (LLFloaterTexturePicker*)mFloaterHandle.get(); if (pickerp) { - pickerp->setActive(FALSE); + pickerp->setActive(false); } } } @@ -1836,7 +1836,7 @@ void LLTextureCtrl::setLabel(const std::string& label) mCaption->setText(label); } -void LLTextureCtrl::showPicker(BOOL take_focus) +void LLTextureCtrl::showPicker(bool take_focus) { // show hourglass cursor when loading inventory window // because inventory construction is slooow @@ -1882,7 +1882,7 @@ void LLTextureCtrl::showPicker(BOOL take_focus) { texture_floaterp->setSetImageAssetIDCallback(boost::bind(&LLTextureCtrl::setImageAssetID, this, _1)); - texture_floaterp->setBakeTextureEnabled(mBakeTextureEnabled); + texture_floaterp->setBakeTextureEnabled(mBakeTextureEnabled && mInventoryPickType != PICK_MATERIAL); } LLFloater* root_floater = gFloaterView->getParentFloater(this); @@ -1899,7 +1899,7 @@ void LLTextureCtrl::showPicker(BOOL take_focus) if (take_focus) { - floaterp->setFocus(TRUE); + floaterp->setFocus(true); } } @@ -1910,7 +1910,7 @@ void LLTextureCtrl::closeDependentFloater() if( floaterp && floaterp->isInVisibleChain()) { floaterp->setOwner(NULL); - floaterp->setVisible(FALSE); + floaterp->setVisible(false); floaterp->closeFloater(); } } @@ -1929,22 +1929,22 @@ public: } }; -BOOL LLTextureCtrl::handleHover(S32 x, S32 y, MASK mask) +bool LLTextureCtrl::handleHover(S32 x, S32 y, MASK mask) { getWindow()->setCursor(mBorder->parentPointInView(x,y) ? UI_CURSOR_HAND : UI_CURSOR_ARROW); - return TRUE; + return true; } -BOOL LLTextureCtrl::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLTextureCtrl::handleMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = LLUICtrl::handleMouseDown( x, y , mask ); + bool handled = LLUICtrl::handleMouseDown( x, y , mask ); if (!handled && mBorder->parentPointInView(x, y)) { if (!mOpenTexPreview) { - showPicker(FALSE); + showPicker(false); if (mInventoryPickType == PICK_MATERIAL) { //grab materials first... @@ -1960,7 +1960,7 @@ BOOL LLTextureCtrl::handleMouseDown(S32 x, S32 y, MASK mask) { LLInventoryModelBackgroundFetch::instance().start(); } - handled = TRUE; + handled = true; } else { @@ -2015,7 +2015,7 @@ void LLTextureCtrl::onFloaterCommit(ETexturePickOp op, LLPickerSource source, co if(floaterp->isDirty() || asset_id.notNull()) // mModelView->setDirty does not work. { - setTentative( FALSE ); + setTentative( false ); switch(source) { @@ -2036,7 +2036,7 @@ void LLTextureCtrl::onFloaterCommit(ETexturePickOp op, LLPickerSource source, co break; case PICKER_UNKNOWN: default: - mImageItemID = floaterp->findItemID(asset_id, FALSE); + mImageItemID = floaterp->findItemID(asset_id, false); mImageAssetID = asset_id; mLocalTrackingID.setNull(); break; @@ -2112,7 +2112,7 @@ void LLTextureCtrl::setBakeTextureEnabled(bool enabled) LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get(); if (floaterp) { - floaterp->setBakeTextureEnabled(enabled); + floaterp->setBakeTextureEnabled(enabled && mInventoryPickType != PICK_MATERIAL); } } @@ -2126,12 +2126,12 @@ void LLTextureCtrl::setInventoryPickType(EPickInventoryType type) } } -BOOL LLTextureCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, - BOOL drop, EDragAndDropType cargo_type, void *cargo_data, +bool LLTextureCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, + bool drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg) { - BOOL handled = FALSE; + bool handled = false; // this downcast may be invalid - but if the second test below // returns true, then the cast was valid, and we can perform @@ -2167,7 +2167,7 @@ BOOL LLTextureCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, // This removes the 'Multiple' overlay, since // there is now only one texture selected. - setTentative( FALSE ); + setTentative( false ); onCommit(); } } @@ -2179,7 +2179,7 @@ BOOL LLTextureCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, *accept = ACCEPT_NO; } - handled = TRUE; + handled = true; LL_DEBUGS("UserInput") << "dragAndDrop handled by LLTextureCtrl " << getName() << LL_ENDL; return handled; @@ -2243,7 +2243,7 @@ void LLTextureCtrl::draw() } else { - mTexturep = LLViewerTextureManager::getFetchedTexture(mImageAssetID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + mTexturep = LLViewerTextureManager::getFetchedTexture(mImageAssetID, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); mTexturep->setBoostLevel(LLGLTexture::BOOST_PREVIEW); mTexturep->forceToSaveRawImage(0); @@ -2260,7 +2260,7 @@ void LLTextureCtrl::draw() // Border LLRect border( 0, getRect().getHeight(), getRect().getWidth(), BTN_HEIGHT_SMALL ); - gl_rect_2d( border, mBorderColor.get(), FALSE ); + gl_rect_2d( border, mBorderColor.get(), false ); // Interior LLRect interior = border; @@ -2284,7 +2284,7 @@ void LLTextureCtrl::draw() } else { - gl_rect_2d( interior, LLColor4::grey % alpha, TRUE ); + gl_rect_2d( interior, LLColor4::grey % alpha, true ); // Draw X gl_draw_x( interior, LLColor4::black ); @@ -2296,8 +2296,8 @@ void LLTextureCtrl::draw() // Using the discard level, do not show the string if the texture is almost but not // fully loaded. if (mTexturep.notNull() && - (!mTexturep->isFullyLoaded()) && - (mShowLoadingPlaceholder == TRUE)) + !mTexturep->isFullyLoaded() && + mShowLoadingPlaceholder) { U32 v_offset = 25; LLFontGL* font = LLFontGL::getFontSansSerif(); @@ -2343,11 +2343,11 @@ void LLTextureCtrl::draw() LLUICtrl::draw(); } -BOOL LLTextureCtrl::allowDrop(LLInventoryItem* item, EDragAndDropType cargo_type, std::string& tooltip_msg) +bool LLTextureCtrl::allowDrop(LLInventoryItem* item, EDragAndDropType cargo_type, std::string& tooltip_msg) { - BOOL copy = item->getPermissions().allowCopyBy(gAgent.getID()); - BOOL mod = item->getPermissions().allowModifyBy(gAgent.getID()); - BOOL xfer = item->getPermissions().allowOperationBy(PERM_TRANSFER, + bool copy = item->getPermissions().allowCopyBy(gAgent.getID()); + bool mod = item->getPermissions().allowModifyBy(gAgent.getID()); + bool xfer = item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()); PermissionMask item_perm_mask = 0; @@ -2364,7 +2364,7 @@ BOOL LLTextureCtrl::allowDrop(LLInventoryItem* item, EDragAndDropType cargo_type } else { - return TRUE; + return true; } } else @@ -2375,16 +2375,16 @@ BOOL LLTextureCtrl::allowDrop(LLInventoryItem* item, EDragAndDropType cargo_type { tooltip_msg.assign(LLTrans::getString("TooltipTextureRestrictedDrop")); } - return FALSE; + return false; } } -BOOL LLTextureCtrl::doDrop(LLInventoryItem* item) +bool LLTextureCtrl::doDrop(LLInventoryItem* item) { // call the callback if it exists. if(mDropCallback) { - // if it returns TRUE, we return TRUE, and therefore the + // if it returns true, we return true, and therefore the // commit is called above. return mDropCallback(this, item); } @@ -2400,15 +2400,15 @@ BOOL LLTextureCtrl::doDrop(LLInventoryItem* item) setImageAssetID(asset_id); mImageItemID = item->getUUID(); - return TRUE; + return true; } -BOOL LLTextureCtrl::handleUnicodeCharHere(llwchar uni_char) +bool LLTextureCtrl::handleUnicodeCharHere(llwchar uni_char) { if( ' ' == uni_char ) { - showPicker(TRUE); - return TRUE; + showPicker(true); + return true; } return LLUICtrl::handleUnicodeCharHere(uni_char); } diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h index db36ac9cc2..3c6cff4eaa 100644 --- a/indra/newview/lltexturectrl.h +++ b/indra/newview/lltexturectrl.h @@ -50,7 +50,7 @@ class LLViewerFetchedTexture; class LLFetchedGLTFMaterial; // used for setting drag & drop callbacks. -typedef boost::function<BOOL (LLUICtrl*, LLInventoryItem*)> drag_n_drop_callback; +typedef boost::function<bool (LLUICtrl*, LLInventoryItem*)> drag_n_drop_callback; typedef boost::function<void (LLInventoryItem*)> texture_selected_callback; // Helper functions for UI that work with picker @@ -148,21 +148,21 @@ public: // LLView interface - BOOL handleMouseDown(S32 x, S32 y, MASK mask) override; - BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, - BOOL drop, EDragAndDropType cargo_type, void *cargo_data, + bool handleMouseDown(S32 x, S32 y, MASK mask) override; + bool handleDragAndDrop(S32 x, S32 y, MASK mask, + bool drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg) override; - BOOL handleHover(S32 x, S32 y, MASK mask) override; - BOOL handleUnicodeCharHere(llwchar uni_char) override; + bool handleHover(S32 x, S32 y, MASK mask) override; + bool handleUnicodeCharHere(llwchar uni_char) override; void draw() override; - void setVisible( BOOL visible ) override; - void setEnabled( BOOL enabled ) override; + void setVisible( bool visible ) override; + void setEnabled( bool enabled ) override; - void onVisibilityChange(BOOL new_visibility) override; + void onVisibilityChange(bool new_visibility) override; - void setValid(BOOL valid); + void setValid(bool valid); // LLUICtrl interface void clear() override; @@ -172,17 +172,17 @@ public: LLSD getValue() const override; // LLTextureCtrl interface - void showPicker(BOOL take_focus); + void showPicker(bool take_focus); bool isPickerShown() { return !mFloaterHandle.isDead(); } void setLabel(const std::string& label); void setLabelWidth(S32 label_width) {mLabelWidth =label_width;} const std::string& getLabel() const { return mLabel; } - void setAllowNoTexture( BOOL b ) { mAllowNoTexture = b; } + void setAllowNoTexture( bool b ) { mAllowNoTexture = b; } bool getAllowNoTexture() const { return mAllowNoTexture; } - void setAllowLocalTexture(BOOL b) { mAllowLocalTexture = b; } - BOOL getAllowLocalTexture() const { return mAllowLocalTexture; } + void setAllowLocalTexture(bool b) { mAllowLocalTexture = b; } + bool getAllowLocalTexture() const { return mAllowLocalTexture; } const LLUUID& getImageItemID() { return mImageItemID; } @@ -202,7 +202,7 @@ public: void setOpenTexPreview(bool open_preview) { mOpenTexPreview = open_preview; } void setCaption(const std::string& caption); - void setCanApplyImmediately(BOOL b); + void setCanApplyImmediately(bool b); void setCanApply(bool can_preview, bool can_apply); @@ -222,10 +222,10 @@ public: const LLUUID& tracking_id); // This call is returned when a drag is detected. Your callback - // should return TRUE if the drag is acceptable. + // should return true if the drag is acceptable. void setDragCallback(drag_n_drop_callback cb) { mDragCallback = cb; } - // This callback is called when the drop happens. Return TRUE if + // This callback is called when the drop happens. Return true if // the drop happened - resulting in an on commit callback, but not // necessariliy any other change. void setDropCallback(drag_n_drop_callback cb) { mDropCallback = cb; } @@ -239,7 +239,7 @@ public: */ void setOnTextureSelectedCallback(texture_selected_callback cb); - void setShowLoadingPlaceholder(BOOL showLoadingPlaceholder); + void setShowLoadingPlaceholder(bool showLoadingPlaceholder); LLViewerFetchedTexture* getTexture() { return mTexturep; } @@ -253,8 +253,8 @@ public: LLUUID getLocalTrackingID() { return mLocalTrackingID; } private: - BOOL allowDrop(LLInventoryItem* item, EDragAndDropType cargo_type, std::string& tooltip_msg); - BOOL doDrop(LLInventoryItem* item); + bool allowDrop(LLInventoryItem* item, EDragAndDropType cargo_type, std::string& tooltip_msg); + bool doDrop(LLInventoryItem* item); private: drag_n_drop_callback mDragCallback; @@ -278,16 +278,16 @@ private: LLTextBox* mTentativeLabel; LLTextBox* mCaption; std::string mLabel; - BOOL mAllowNoTexture; // If true, the user can select "none" as an option - BOOL mAllowLocalTexture; + bool mAllowNoTexture; // If true, the user can select "none" as an option + bool mAllowLocalTexture; PermissionMask mImmediateFilterPermMask; PermissionMask mDnDFilterPermMask; - BOOL mCanApplyImmediately; - BOOL mCommitOnSelection; - BOOL mNeedsRawImageData; + bool mCanApplyImmediately; + bool mCommitOnSelection; + bool mNeedsRawImageData; LLViewBorder* mBorder; - BOOL mValid; - BOOL mShowLoadingPlaceholder; + bool mValid; + bool mShowLoadingPlaceholder; std::string mLoadingPlaceholderString; S32 mLabelWidth; bool mOpenTexPreview; @@ -310,27 +310,27 @@ public: LLUUID image_asset_id, LLUUID default_image_asset_id, LLUUID blank_image_asset_id, - BOOL tentative, - BOOL allow_no_texture, + bool tentative, + bool allow_no_texture, const std::string& label, PermissionMask immediate_filter_perm_mask, PermissionMask dnd_filter_perm_mask, - BOOL can_apply_immediately, + bool can_apply_immediately, LLUIImagePtr fallback_image_name, EPickInventoryType pick_type); virtual ~LLFloaterTexturePicker(); // LLView overrides - /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, - BOOL drop, EDragAndDropType cargo_type, void *cargo_data, + /*virtual*/ bool handleDragAndDrop(S32 x, S32 y, MASK mask, + bool drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg); /*virtual*/ void draw(); - /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); + /*virtual*/ bool handleKeyHere(KEY key, MASK mask); // LLFloater overrides - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void onClose(bool app_settings); @@ -338,10 +338,10 @@ public: void setImageID(const LLUUID& image_asset_id, bool set_selection = true); bool updateImageStats(); // true if within limits const LLUUID& getAssetID() { return mImageAssetID; } - const LLUUID& findItemID(const LLUUID& asset_id, BOOL copyable_only, BOOL ignore_library = FALSE); - void setCanApplyImmediately(BOOL b); + const LLUUID& findItemID(const LLUUID& asset_id, bool copyable_only, bool ignore_library = false); + void setCanApplyImmediately(bool b); - void setActive(BOOL active); + void setActive(bool active); LLView* getOwner() const { return mOwner; } void setOwner(LLView* owner) { mOwner = owner; } @@ -370,7 +370,7 @@ public: //static void onBtnRevert( void* userdata ); static void onBtnBlank(void* userdata); static void onBtnNone(void* userdata); - void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action); + void onSelectionChange(const std::deque<LLFolderViewItem*> &items, bool user_action); static void onApplyImmediateCheck(LLUICtrl* ctrl, void* userdata); void onTextureSelect(const LLTextureEntry& te); @@ -382,8 +382,8 @@ public: static void onBakeTextureSelect(LLUICtrl* ctrl, void *userdata); - void setLocalTextureEnabled(BOOL enabled); - void setBakeTextureEnabled(BOOL enabled); + void setLocalTextureEnabled(bool enabled); + void setBakeTextureEnabled(bool enabled); void setInventoryPickType(EPickInventoryType type); void setImmediateFilterPermMask(PermissionMask mask); @@ -405,8 +405,8 @@ protected: LLUIImagePtr mFallbackImage; // What to show if currently selected texture is null. LLUUID mDefaultImageAssetID; LLUUID mBlankImageAssetID; - BOOL mTentative; - BOOL mAllowNoTexture; + bool mTentative; + bool mAllowNoTexture; LLUUID mSpecialCurrentImageAssetID; // Used when the asset id has no corresponding texture in the user's inventory. LLUUID mOriginalImageAssetID; @@ -417,17 +417,17 @@ protected: LLTextBox* mResolutionWarning; std::string mPendingName; - BOOL mActive; + bool mActive; LLFilterEditor* mFilterEdit; LLInventoryPanel* mInventoryPanel; PermissionMask mImmediateFilterPermMask; PermissionMask mDnDFilterPermMask; - BOOL mCanApplyImmediately; - BOOL mNoCopyTextureSelected; + bool mCanApplyImmediately; + bool mNoCopyTextureSelected; F32 mContextConeOpacity; LLSaveFolderState mSavedFolderState; - BOOL mSelectedItemPinned; + bool mSelectedItemPinned; LLComboBox* mModeSelector; LLScrollListCtrl* mLocalScrollCtrl; @@ -454,7 +454,7 @@ private: set_image_asset_id_callback mSetImageAssetIDCallback; set_on_update_image_stats_callback mOnUpdateImageStatsCallback; - BOOL mBakeTextureEnabled; + bool mBakeTextureEnabled; static S32 sLastPickerMode; }; diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 77c28bd3f4..ee13baaa18 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -392,7 +392,7 @@ public: // Threads: Ttc void callbackCacheRead(bool success, LLImageFormatted* image, - S32 imagesize, BOOL islocal); + S32 imagesize, bool islocal); // Threads: Ttc void callbackCacheWrite(bool success); @@ -571,13 +571,13 @@ private: mCachedSize; e_request_state mSentRequest; handle_t mDecodeHandle; - BOOL mLoaded; - BOOL mDecoded; - BOOL mWritten; - BOOL mNeedsAux; - BOOL mHaveAllData; - BOOL mInLocalCache; - BOOL mInCache; + bool mLoaded; + bool mDecoded; + bool mWritten; + bool mNeedsAux; + bool mHaveAllData; + bool mInLocalCache; + bool mInCache; bool mCanUseHTTP; S32 mRetryAttempt; S32 mActiveCount; @@ -909,15 +909,15 @@ LLTextureFetchWorker::LLTextureFetchWorker(LLTextureFetch* fetcher, mFileSize(0), mSkippedStatesTime(0), mCachedSize(0), - mLoaded(FALSE), + mLoaded(false), mSentRequest(UNSENT), mDecodeHandle(0), - mDecoded(FALSE), - mWritten(FALSE), - mNeedsAux(FALSE), - mHaveAllData(FALSE), - mInLocalCache(FALSE), - mInCache(FALSE), + mDecoded(false), + mWritten(false), + mNeedsAux(false), + mHaveAllData(false), + mInLocalCache(false), + mInCache(false), mCanUseHTTP(true), mRetryAttempt(0), mActiveCount(0), @@ -1054,7 +1054,7 @@ void LLTextureFetchWorker::resetFormattedData() } mHttpReplySize = 0; mHttpReplyOffset = 0; - mHaveAllData = FALSE; + mHaveAllData = false; } F32 LLTextureFetchWorker::getImagePriority() const @@ -1152,10 +1152,10 @@ bool LLTextureFetchWorker::doWork(S32 param) mRequestedOffset = 0; mFileSize = 0; mCachedSize = 0; - mLoaded = FALSE; + mLoaded = false; mSentRequest = UNSENT; - mDecoded = FALSE; - mWritten = FALSE; + mDecoded = false; + mWritten = false; if (mHttpBufferArray) { mHttpBufferArray->release(); @@ -1163,12 +1163,12 @@ bool LLTextureFetchWorker::doWork(S32 param) } mHttpReplySize = 0; mHttpReplyOffset = 0; - mHaveAllData = FALSE; + mHaveAllData = false; clearPackets(); // TODO: Shouldn't be necessary mCacheReadHandle = LLTextureCache::nullHandle(); mCacheWriteHandle = LLTextureCache::nullHandle(); setState(LOAD_FROM_TEXTURE_CACHE); - mInCache = FALSE; + mInCache = false; mDesiredSize = llmax(mDesiredSize, TEXTURE_CACHE_ENTRY_SIZE); // min desired size is TEXTURE_CACHE_ENTRY_SIZE LL_DEBUGS(LOG_TXT) << mID << ": Priority: " << llformat("%8.0f",mImagePriority) << " Desired Discard: " << mDesiredDiscard << " Desired Size: " << mDesiredSize << LL_ENDL; @@ -1190,7 +1190,7 @@ bool LLTextureFetchWorker::doWork(S32 param) // return false; } mFileSize = 0; - mLoaded = FALSE; + mLoaded = false; add(LLTextureFetch::sCacheAttempt, 1.0); @@ -1264,7 +1264,7 @@ bool LLTextureFetchWorker::doWork(S32 param) << ", should be >=0" << LL_ENDL; } setState(DECODE_IMAGE); - mInCache = TRUE; + mInCache = true; mWriteToCacheState = NOT_WRITE ; LL_DEBUGS(LOG_TXT) << mID << ": Cached. Bytes: " << mFormattedImage->getDataSize() << " Size: " << llformat("%dx%d",mFormattedImage->getWidth(),mFormattedImage->getHeight()) @@ -1476,7 +1476,7 @@ bool LLTextureFetchWorker::doWork(S32 param) } mRequestedDeltaTimer.reset(); - mLoaded = FALSE; + mLoaded = false; mGetStatus = LLCore::HttpStatus(); mGetReason.clear(); LL_DEBUGS(LOG_TXT) << "HTTP GET: " << mID << " Offset: " << mRequestedOffset @@ -1593,7 +1593,7 @@ bool LLTextureFetchWorker::doWork(S32 param) else if (http_not_sat == mGetStatus) { // Allowed, we'll accept whatever data we have as complete. - mHaveAllData = TRUE; + mHaveAllData = true; } else { @@ -1655,7 +1655,7 @@ bool LLTextureFetchWorker::doWork(S32 param) return true; } - S32 append_size(mHttpBufferArray->size()); + S32 append_size(static_cast<S32>(mHttpBufferArray->size())); S32 total_size(cur_size + append_size); S32 src_offset(0); llassert_always(append_size == mRequestedSize); @@ -1664,7 +1664,7 @@ bool LLTextureFetchWorker::doWork(S32 param) // In case of a partial response, our offset may // not be trivially contiguous with the data we have. // Get back into alignment. - if ( (mHttpReplyOffset > cur_size) || (cur_size > mHttpReplyOffset + append_size)) + if ( ((S32)mHttpReplyOffset > cur_size) || (cur_size > (S32)mHttpReplyOffset + append_size)) { LL_WARNS(LOG_TXT) << "Partial HTTP response produces break in image data for texture " << mID << ". Aborting load." << LL_ENDL; @@ -1700,6 +1700,8 @@ bool LLTextureFetchWorker::doWork(S32 param) } } + LLImageDataLock lock(mFormattedImage); + if (mHaveAllData) //the image file is fully loaded. { mFileSize = total_size; @@ -1796,7 +1798,7 @@ bool LLTextureFetchWorker::doWork(S32 param) mAuxImage = NULL; llassert_always(mFormattedImage.notNull()); S32 discard = mHaveAllData ? 0 : mLoadedDiscard; - mDecoded = FALSE; + mDecoded = false; setState(DECODE_IMAGE_UPDATE); LL_DEBUGS(LOG_TXT) << mID << ": Decoding. Bytes: " << mFormattedImage->getDataSize() << " Discard: " << discard << " All Data: " << mHaveAllData << LL_ENDL; @@ -1871,6 +1873,9 @@ bool LLTextureFetchWorker::doWork(S32 param) //return false; return doWork(param); } + + LLImageDataSharedLock lock(mFormattedImage); + S32 datasize = mFormattedImage->getDataSize(); if(mFileSize < datasize)//This could happen when http fetching and sim fetching mixed. { @@ -1884,7 +1889,7 @@ bool LLTextureFetchWorker::doWork(S32 param) } } llassert_always(datasize); - mWritten = FALSE; + mWritten = false; setState(WAIT_ON_WRITE); ++mCacheWriteCount; CacheWriteResponder* responder = new CacheWriteResponder(mFetcher, mID); @@ -2188,7 +2193,7 @@ S32 LLTextureFetchWorker::callbackHttpGet(LLCore::HttpResponse * response, { // get length of stream: LLCore::BufferArray * body(response->getBody()); - data_size = body ? body->size() : 0; + data_size = body ? static_cast<S32>(body->size()) : 0; LL_DEBUGS(LOG_TXT) << "HTTP RECEIVED: " << mID.asString() << " Bytes: " << data_size << LL_ENDL; if (data_size > 0) @@ -2234,19 +2239,19 @@ S32 LLTextureFetchWorker::callbackHttpGet(LLCore::HttpResponse * response, << mFileSize << " datasize: " << mFormattedImage->getDataSize() << LL_ENDL; } - mHaveAllData = TRUE; + mHaveAllData = true; llassert_always(mDecodeHandle == 0); mFormattedImage = NULL; // discard any previous data we had } else if (data_size < mRequestedSize) { - mHaveAllData = TRUE; + mHaveAllData = true; } else if (data_size > mRequestedSize) { // *TODO: This shouldn't be happening any more (REALLY don't expect this anymore) LL_WARNS(LOG_TXT) << "data_size = " << data_size << " > requested: " << mRequestedSize << LL_ENDL; - mHaveAllData = TRUE; + mHaveAllData = true; llassert_always(mDecodeHandle == 0); mFormattedImage = NULL; // discard any previous data we had } @@ -2255,7 +2260,7 @@ S32 LLTextureFetchWorker::callbackHttpGet(LLCore::HttpResponse * response, { // We requested data but received none (and no error), // so presumably we have all of it - mHaveAllData = TRUE; + mHaveAllData = true; } mRequestedSize = data_size; @@ -2271,7 +2276,7 @@ S32 LLTextureFetchWorker::callbackHttpGet(LLCore::HttpResponse * response, mRequestedSize = -1; // error } - mLoaded = TRUE; + mLoaded = true; return data_size ; } @@ -2280,7 +2285,7 @@ S32 LLTextureFetchWorker::callbackHttpGet(LLCore::HttpResponse * response, // Threads: Ttc void LLTextureFetchWorker::callbackCacheRead(bool success, LLImageFormatted* image, - S32 imagesize, BOOL islocal) + S32 imagesize, bool islocal) { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; LLMutexLock lock(&mWorkMutex); // +Mw @@ -2298,10 +2303,10 @@ void LLTextureFetchWorker::callbackCacheRead(bool success, LLImageFormatted* ima mInLocalCache = islocal; if (mFileSize != 0 && mFormattedImage->getDataSize() >= mFileSize) { - mHaveAllData = TRUE; + mHaveAllData = true; } } - mLoaded = TRUE; + mLoaded = true; } // -Mw // Threads: Ttc @@ -2313,7 +2318,7 @@ void LLTextureFetchWorker::callbackCacheWrite(bool success) // LL_WARNS(LOG_TXT) << "Write callback for " << mID << " with state = " << mState << LL_ENDL; return; } - mWritten = TRUE; + mWritten = true; } // -Mw ////////////////////////////////////////////////////////////////////////////// @@ -2358,7 +2363,7 @@ void LLTextureFetchWorker::callbackDecoded(bool success, const std::string &erro removeFromCache(); mDecodedDiscard = -1; // Redundant, here for clarity and paranoia } - mDecoded = TRUE; + mDecoded = true; // LL_INFOS(LOG_TXT) << mID << " : DECODE COMPLETE " << LL_ENDL; } // -Mw @@ -2435,7 +2440,7 @@ std::string LLTextureFetch::getStateString(S32 state) LLTextureFetch::LLTextureFetch(LLTextureCache* cache, bool threaded, bool qa_mode) : LLWorkerThread("TextureFetch", threaded, true), mDebugCount(0), - mDebugPause(FALSE), + mDebugPause(false), mPacketCount(0), mBadPacketCount(0), mQueueMutex(), @@ -3144,9 +3149,9 @@ LLViewerRegion* LLTextureFetchWorker::getRegion() ////////////////////////////////////////////////////////////////////////////// // Threads: T* -BOOL LLTextureFetch::isFromLocalCache(const LLUUID& id) +bool LLTextureFetch::isFromLocalCache(const LLUUID& id) { - BOOL from_cache = FALSE ; + bool from_cache = false ; LLTextureFetchWorker* worker = getWorker(id); if (worker) @@ -3400,7 +3405,7 @@ void LLTextureFetch::cancelHttpWaiters() int LLTextureFetch::getHttpWaitersCount() { mNetworkQueueMutex.lock(); // +Mfnq - int ret(mHttpWaitResource.size()); + int ret(static_cast<int>(mHttpWaitResource.size())); mNetworkQueueMutex.unlock(); // -Mfnq return ret; } diff --git a/indra/newview/lltexturefetch.h b/indra/newview/lltexturefetch.h index b72ecc2a65..aebd2f8f95 100644 --- a/indra/newview/lltexturefetch.h +++ b/indra/newview/lltexturefetch.h @@ -109,7 +109,7 @@ public: F32 getTextureBandwidth() { return mTextureBandwidth; } // Threads: T* - BOOL isFromLocalCache(const LLUUID& id); + bool isFromLocalCache(const LLUUID& id); // get the current fetch state, if any, from the given UUID S32 getFetchState(const LLUUID& id); @@ -292,7 +292,7 @@ private: public: LLUUID mDebugID; S32 mDebugCount; - BOOL mDebugPause; + bool mDebugPause; S32 mPacketCount; S32 mBadPacketCount; diff --git a/indra/newview/lltextureinfo.cpp b/indra/newview/lltextureinfo.cpp index e3c3864025..84ef45c97a 100644 --- a/indra/newview/lltextureinfo.cpp +++ b/indra/newview/lltextureinfo.cpp @@ -80,7 +80,7 @@ void LLTextureInfo::addRequest(const LLUUID& id) U32 LLTextureInfo::getTextureInfoMapSize() { - return mTextures.size(); + return static_cast<U32>(mTextures.size()); } bool LLTextureInfo::has(const LLUUID& id) diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp index ea35a09f05..f521293b96 100644 --- a/indra/newview/lltextureview.cpp +++ b/indra/newview/lltextureview.cpp @@ -107,7 +107,7 @@ public: {} virtual void draw(); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); virtual LLRect getRequiredRect(); // Return the height of this object, given the set options. // Used for sorting @@ -343,12 +343,12 @@ void LLTextureBar::draw() } -BOOL LLTextureBar::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLTextureBar::handleMouseDown(S32 x, S32 y, MASK mask) { if ((mask & (MASK_CONTROL|MASK_SHIFT|MASK_ALT)) == MASK_ALT) { LLAppViewer::getTextureFetch()->mDebugID = mImagep->getID(); - return TRUE; + return true; } return LLView::handleMouseDown(x,y,mask); } @@ -384,7 +384,7 @@ public: {} virtual void draw(); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); virtual LLRect getRequiredRect(); // Return the height of this object, given the set options. private: @@ -438,9 +438,9 @@ void LLAvatarTexBar::draw() header_color, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::BOLD, LLFontGL::DROP_SHADOW_SOFT); } -BOOL LLAvatarTexBar::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLAvatarTexBar::handleMouseDown(S32 x, S32 y, MASK mask) { - return FALSE; + return false; } LLRect LLAvatarTexBar::getRequiredRect() @@ -473,7 +473,7 @@ public: {} virtual void draw(); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); virtual LLRect getRequiredRect(); // Return the height of this object, given the set options. private: @@ -527,8 +527,8 @@ void LLGLTexMemBar::draw() U32 texFetchLatMed = U32(recording.getMean(LLTextureFetch::sTexFetchLatency).value() * 1000.0f); U32 texFetchLatMax = U32(recording.getMax(LLTextureFetch::sTexFetchLatency).value() * 1000.0f); - text = llformat("GL Free: %d MB Sys Free: %d MB FBO: %d MB Bias: %.2f Cache: %.1f/%.1f MB", - gViewerWindow->getWindow()->getAvailableVRAMMegabytes(), + text = llformat("Est. Free: %d MB Sys Free: %d MB FBO: %d MB Bias: %.2f Cache: %.1f/%.1f MB", + (S32)LLViewerTexture::sFreeVRAMMegabytes, LLMemory::getAvailableMemKB()/1024, LLRenderTarget::sBytesAllocated/(1024*1024), discard_bias, @@ -640,9 +640,9 @@ void LLGLTexMemBar::draw() text_color, LLFontGL::LEFT, LLFontGL::TOP); } -BOOL LLGLTexMemBar::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLGLTexMemBar::handleMouseDown(S32 x, S32 y, MASK mask) { - return FALSE; + return false; } LLRect LLGLTexMemBar::getRequiredRect() @@ -671,7 +671,7 @@ public: void setTop(S32 loaded, S32 bound, F32 scale) {mTopLoaded = loaded ; mTopBound = bound; mScale = scale ;} void draw(); - BOOL handleHover(S32 x, S32 y, MASK mask, BOOL set_pick_size) ; + bool handleHover(S32 x, S32 y, MASK mask, bool set_pick_size) ; private: S32 mIndex ; @@ -684,13 +684,13 @@ private: F32 mScale ; }; -BOOL LLGLTexSizeBar::handleHover(S32 x, S32 y, MASK mask, BOOL set_pick_size) +bool LLGLTexSizeBar::handleHover(S32 x, S32 y, MASK mask, bool set_pick_size) { if(y > mBottom && (y < mBottom + (S32)(mTopLoaded * mScale) || y < mBottom + (S32)(mTopBound * mScale))) { LLImageGL::setCurTexSizebar(mIndex, set_pick_size); } - return TRUE ; + return true ; } void LLGLTexSizeBar::draw() { @@ -719,14 +719,14 @@ void LLGLTexSizeBar::draw() LLTextureView::LLTextureView(const LLTextureView::Params& p) : LLContainerView(p), - mFreezeView(FALSE), - mOrderFetch(FALSE), - mPrintList(FALSE), + mFreezeView(false), + mOrderFetch(false), + mPrintList(false), mNumTextureBars(0) { - setVisible(FALSE); + setVisible(false); - setDisplayChildren(TRUE); + setDisplayChildren(true); mGLTexMemBar = 0; mAvatarTexBar = 0; } @@ -898,7 +898,7 @@ void LLTextureView::draw() if (mPrintList) { - mPrintList = FALSE; + mPrintList = false; } static S32 max_count = 50; @@ -947,7 +947,7 @@ void LLTextureView::draw() addChild(mAvatarTexBar); sendChildToFront(mAvatarTexBar); - reshape(getRect().getWidth(), getRect().getHeight(), TRUE); + reshape(getRect().getWidth(), getRect().getHeight(), true); LLUI::popMatrix(); LLUI::pushMatrix(); @@ -959,7 +959,7 @@ void LLTextureView::draw() LLView *viewp = *child_iter; if (viewp->getRect().mBottom < 0) { - viewp->setVisible(FALSE); + viewp->setVisible(false); } } } @@ -968,7 +968,7 @@ void LLTextureView::draw() } -BOOL LLTextureView::addBar(LLViewerFetchedTexture *imagep, S32 hilite) +bool LLTextureView::addBar(LLViewerFetchedTexture *imagep, S32 hilite) { llassert(imagep); @@ -988,42 +988,42 @@ BOOL LLTextureView::addBar(LLViewerFetchedTexture *imagep, S32 hilite) addChild(barp); mTextureBars.push_back(barp); - return TRUE; + return true; } -BOOL LLTextureView::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLTextureView::handleMouseDown(S32 x, S32 y, MASK mask) { if ((mask & (MASK_CONTROL|MASK_SHIFT|MASK_ALT)) == (MASK_ALT|MASK_SHIFT)) { - mPrintList = TRUE; - return TRUE; + mPrintList = true; + return true; } if ((mask & (MASK_CONTROL|MASK_SHIFT|MASK_ALT)) == (MASK_CONTROL|MASK_SHIFT)) { LLAppViewer::getTextureFetch()->mDebugPause = !LLAppViewer::getTextureFetch()->mDebugPause; - return TRUE; + return true; } if (mask & MASK_SHIFT) { mFreezeView = !mFreezeView; - return TRUE; + return true; } if (mask & MASK_CONTROL) { mOrderFetch = !mOrderFetch; - return TRUE; + return true; } return LLView::handleMouseDown(x,y,mask); } -BOOL LLTextureView::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLTextureView::handleMouseUp(S32 x, S32 y, MASK mask) { - return FALSE; + return false; } -BOOL LLTextureView::handleKey(KEY key, MASK mask, BOOL called_from_parent) +bool LLTextureView::handleKey(KEY key, MASK mask, bool called_from_parent) { - return FALSE; + return false; } diff --git a/indra/newview/lltextureview.h b/indra/newview/lltextureview.h index 7e95f0f149..77ffe7d809 100644 --- a/indra/newview/lltextureview.h +++ b/indra/newview/lltextureview.h @@ -45,23 +45,22 @@ protected: public: ~LLTextureView(); - /*virtual*/ void draw(); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); + void draw() override; + bool handleMouseDown(S32 x, S32 y, MASK mask) override; + bool handleMouseUp(S32 x, S32 y, MASK mask) override; + bool handleKey(KEY key, MASK mask, bool called_from_parent) override; static void addDebugImage(LLViewerFetchedTexture* image) { sDebugImages.insert(image); } static void removeDebugImage(LLViewerFetchedTexture* image) { sDebugImages.insert(image); } static void clearDebugImages() { sDebugImages.clear(); } private: - BOOL addBar(LLViewerFetchedTexture *image, BOOL hilight = FALSE); - void removeAllBars(); + bool addBar(LLViewerFetchedTexture *image, S32 hilight = 0); private: - BOOL mFreezeView; - BOOL mOrderFetch; - BOOL mPrintList; + bool mFreezeView; + bool mOrderFetch; + bool mPrintList; LLTextBox *mInfoTextp; diff --git a/indra/newview/llthumbnailctrl.cpp b/indra/newview/llthumbnailctrl.cpp index 8291b0b061..d26ad2f060 100644 --- a/indra/newview/llthumbnailctrl.cpp +++ b/indra/newview/llthumbnailctrl.cpp @@ -95,7 +95,7 @@ void LLThumbnailCtrl::draw() { mBorder->setKeyboardFocusHighlight(hasFocus()); - gl_rect_2d( draw_rect, mBorderColor.get(), FALSE ); + gl_rect_2d( draw_rect, mBorderColor.get(), false ); draw_rect.stretch( -1 ); } @@ -106,7 +106,7 @@ void LLThumbnailCtrl::draw() if( mTexturep->getComponents() == 4 ) { const LLColor4 color(.098f, .098f, .098f); - gl_rect_2d( draw_rect, color, TRUE); + gl_rect_2d( draw_rect, color, true); } gl_draw_scaled_image( draw_rect.mLeft, draw_rect.mBottom, draw_rect.getWidth(), draw_rect.getHeight(), mTexturep, UI_VERTEX_COLOR % alpha); @@ -142,7 +142,7 @@ void LLThumbnailCtrl::draw() } else { - gl_rect_2d( draw_rect, LLColor4::grey % alpha, TRUE ); + gl_rect_2d( draw_rect, LLColor4::grey % alpha, true ); // Draw X gl_draw_x( draw_rect, LLColor4::black ); @@ -176,7 +176,7 @@ void LLThumbnailCtrl::draw() LLUICtrl::draw(); } -void LLThumbnailCtrl::setVisible(BOOL visible) +void LLThumbnailCtrl::setVisible(bool visible) { if (!visible && mInited) { @@ -212,12 +212,12 @@ void LLThumbnailCtrl::setValue(const LLSD& value) } } -BOOL LLThumbnailCtrl::handleHover(S32 x, S32 y, MASK mask) +bool LLThumbnailCtrl::handleHover(S32 x, S32 y, MASK mask) { if (mInteractable && getEnabled()) { getWindow()->setCursor(UI_CURSOR_HAND); - return TRUE; + return true; } return LLUICtrl::handleHover(x, y, mask); } diff --git a/indra/newview/llthumbnailctrl.h b/indra/newview/llthumbnailctrl.h index 45cc6e541e..1927001bfd 100644 --- a/indra/newview/llthumbnailctrl.h +++ b/indra/newview/llthumbnailctrl.h @@ -64,13 +64,13 @@ public: virtual ~LLThumbnailCtrl(); virtual void draw() override; - void setVisible(BOOL visible) override; + void setVisible(bool visible) override; virtual void setValue(const LLSD& value ) override; void setInitImmediately(bool val) { mInitImmediately = val; } void clearTexture(); - virtual BOOL handleHover(S32 x, S32 y, MASK mask) override; + virtual bool handleHover(S32 x, S32 y, MASK mask) override; protected: void initImage(); diff --git a/indra/newview/lltinygltfhelper.cpp b/indra/newview/lltinygltfhelper.cpp index 4e41f9959a..168708ca37 100644 --- a/indra/newview/lltinygltfhelper.cpp +++ b/indra/newview/lltinygltfhelper.cpp @@ -31,7 +31,7 @@ #include "llviewertexture.h" #include "llviewertexturelist.h" -void strip_alpha_channel(LLPointer<LLImageRaw>& img) +static void strip_alpha_channel(LLPointer<LLImageRaw>& img) { if (img->getComponents() == 4) { @@ -45,13 +45,13 @@ void strip_alpha_channel(LLPointer<LLImageRaw>& img) // PRECONDITIONS: // dst_img must be 3 component // src_img and dst_image must have the same dimensions -void copy_red_channel(LLPointer<LLImageRaw>& src_img, LLPointer<LLImageRaw>& dst_img) +static void copy_red_channel(const LLPointer<LLImageRaw>& src_img, LLPointer<LLImageRaw>& dst_img) { llassert(src_img->getWidth() == dst_img->getWidth() && src_img->getHeight() == dst_img->getHeight()); llassert(dst_img->getComponents() == 3); U32 pixel_count = dst_img->getWidth() * dst_img->getHeight(); - U8* src = src_img->getData(); + const U8* src = src_img->getData(); U8* dst = dst_img->getData(); S8 src_components = src_img->getComponents(); @@ -97,6 +97,8 @@ void LLTinyGLTFHelper::initFetchedTextures(tinygltf::Material& material, int mr_idx = material.pbrMetallicRoughness.metallicRoughnessTexture.index; if (occlusion_idx != mr_idx) { + LLImageDataLock lockIn(occlusion_img); + LLImageDataLock lockOut(mr_img); //scale occlusion image to match resolution of mr image occlusion_img->scale(mr_img->getWidth(), mr_img->getHeight()); @@ -114,6 +116,7 @@ void LLTinyGLTFHelper::initFetchedTextures(tinygltf::Material& material, } else if (occlusion_img) { + LLImageDataSharedLock lock(occlusion_img); //no mr but occlusion exists, make a white mr_img and copy occlusion red channel over mr_img = new LLImageRaw(occlusion_img->getWidth(), occlusion_img->getHeight(), 3); mr_img->clear(255, 255, 255); @@ -203,7 +206,7 @@ LLImageRaw * LLTinyGLTFHelper::getTexture(const std::string & folder, const tiny bool LLTinyGLTFHelper::loadModel(const std::string& filename, tinygltf::Model& model_in) { std::string exten = gDirUtilp->getExtension(filename); - + if (exten == "gltf" || exten == "glb") { tinygltf::TinyGLTF loader; @@ -240,7 +243,7 @@ bool LLTinyGLTFHelper::loadModel(const std::string& filename, tinygltf::Model& m LL_WARNS("GLTF") << "Cannot load. File has no materials " << filename << LL_ENDL; return false; } - + return true; } @@ -248,6 +251,43 @@ bool LLTinyGLTFHelper::loadModel(const std::string& filename, tinygltf::Model& m return false; } +bool LLTinyGLTFHelper::saveModel(const std::string& filename, tinygltf::Model& model_in) +{ + std::string exten = gDirUtilp->getExtension(filename); + + bool success = false; + + if (exten == "gltf" || exten == "glb") + { + tinygltf::TinyGLTF writer; + + std::string filename_lc = filename; + LLStringUtil::toLower(filename_lc); + + + bool embed_images = false; + bool embed_buffers = false; + bool pretty_print = true; + bool write_binary = false; + + + if (std::string::npos == filename_lc.rfind(".gltf")) + { // file is binary + embed_images = embed_buffers = write_binary = true; + } + + success = writer.WriteGltfSceneToFile(&model_in, filename, embed_images, embed_buffers, pretty_print, write_binary); + + if (!success) + { + LL_WARNS("GLTF") << "Failed to save" << LL_ENDL; + return false; + } + } + + return success; +} + bool LLTinyGLTFHelper::getMaterialFromModel( const std::string& filename, const tinygltf::Model& model_in, @@ -299,7 +339,7 @@ bool LLTinyGLTFHelper::getMaterialFromModel( if (base_color_tex) { - base_color_tex->addTextureStats(64.f * 64.f, TRUE); + base_color_tex->addTextureStats(64.f * 64.f, true); material->mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_BASE_COLOR] = base_color_tex->getID(); material->mBaseColorTexture = base_color_tex; } @@ -311,7 +351,7 @@ bool LLTinyGLTFHelper::getMaterialFromModel( if (normal_tex) { - normal_tex->addTextureStats(64.f * 64.f, TRUE); + normal_tex->addTextureStats(64.f * 64.f, true); material->mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_NORMAL] = normal_tex->getID(); material->mNormalTexture = normal_tex; } @@ -323,7 +363,7 @@ bool LLTinyGLTFHelper::getMaterialFromModel( if (mr_tex) { - mr_tex->addTextureStats(64.f * 64.f, TRUE); + mr_tex->addTextureStats(64.f * 64.f, true); material->mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_METALLIC_ROUGHNESS] = mr_tex->getID(); material->mMetallicRoughnessTexture = mr_tex; } @@ -335,7 +375,7 @@ bool LLTinyGLTFHelper::getMaterialFromModel( if (emissive_tex) { - emissive_tex->addTextureStats(64.f * 64.f, TRUE); + emissive_tex->addTextureStats(64.f * 64.f, true); material->mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_EMISSIVE] = emissive_tex->getID(); material->mEmissiveTexture = emissive_tex; } diff --git a/indra/newview/lltinygltfhelper.h b/indra/newview/lltinygltfhelper.h index da505b41e9..a259609404 100644 --- a/indra/newview/lltinygltfhelper.h +++ b/indra/newview/lltinygltfhelper.h @@ -42,6 +42,7 @@ namespace LLTinyGLTFHelper LLImageRaw* getTexture(const std::string& folder, const tinygltf::Model& model, S32 texture_index, bool flip = true); bool loadModel(const std::string& filename, tinygltf::Model& model_out); + bool saveModel(const std::string& filename, tinygltf::Model& model_in); bool getMaterialFromModel( const std::string& filename, diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp index 2e00b2c382..638a01a080 100644 --- a/indra/newview/lltoast.cpp +++ b/indra/newview/lltoast.cpp @@ -44,13 +44,13 @@ LLToastLifeTimer::LLToastLifeTimer(LLToast* toast, F32 period) } /*virtual*/ -BOOL LLToastLifeTimer::tick() +bool LLToastLifeTimer::tick() { if (mEventTimer.hasExpired()) { mToast->expire(); } - return FALSE; + return false; } void LLToastLifeTimer::stop() @@ -68,7 +68,7 @@ void LLToastLifeTimer::restart() mEventTimer.reset(); } -BOOL LLToastLifeTimer::getStarted() +bool LLToastLifeTimer::getStarted() { return mEventTimer.getStarted(); } @@ -121,11 +121,11 @@ LLToast::LLToast(const LLToast::Params& p) buildFromFile("panel_toast.xml"); - setCanDrag(FALSE); + setCanDrag(false); mWrapperPanel = getChild<LLPanel>("wrapper_panel"); - setBackgroundOpaque(TRUE); // *TODO: obsolete + setBackgroundOpaque(true); // *TODO: obsolete updateTransparency(); if(p.panel()) @@ -151,7 +151,7 @@ LLToast::LLToast(const LLToast::Params& p) } } -void LLToast::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLToast::reshape(S32 width, S32 height, bool called_from_parent) { // We shouldn't use reshape from LLModalDialog since it changes toasts position. // Toasts position should be controlled only by toast screen channel, see LLScreenChannelBase. @@ -160,14 +160,14 @@ void LLToast::reshape(S32 width, S32 height, BOOL called_from_parent) } //-------------------------------------------------------------------------- -BOOL LLToast::postBuild() +bool LLToast::postBuild() { if(!mCanFade) { mTimer->stop(); } - return TRUE; + return true; } //-------------------------------------------------------------------------- @@ -209,7 +209,7 @@ void LLToast::hide() { if (!mIsHidden) { - setVisible(FALSE); + setVisible(false); setFading(false); mTimer->stop(); mIsHidden = true; @@ -218,7 +218,7 @@ void LLToast::hide() } /*virtual*/ -void LLToast::setFocus(BOOL b) +void LLToast::setFocus(bool b) { if (b && !hasFocus() @@ -226,9 +226,9 @@ void LLToast::setFocus(BOOL b) && mWrapperPanel && !mWrapperPanel->getChildList()->empty()) { - LLModalDialog::setFocus(TRUE); + LLModalDialog::setFocus(true); // mostly for buttons - mPanel->setFocus(TRUE); + mPanel->setFocus(true); } else { @@ -391,7 +391,7 @@ void LLToast::draw() } //-------------------------------------------------------------------------- -void LLToast::setVisible(BOOL show) +void LLToast::setVisible(bool show) { if(mIsHidden) { @@ -495,7 +495,7 @@ void LLToast::updateHoveredState() sendChildToFront(mHideBtn); if(mHideBtn && mHideBtn->getEnabled()) { - mHideBtn->setVisible(TRUE); + mHideBtn->setVisible(true); } mToastMouseEnterSignal(this, getValue()); @@ -518,7 +518,7 @@ void LLToast::updateHoveredState() mHideBtnPressed = false; return; } - mHideBtn->setVisible(FALSE); + mHideBtn->setVisible(false); } mToastMouseLeaveSignal(this, getValue()); @@ -526,7 +526,7 @@ void LLToast::updateHoveredState() } } -void LLToast::setBackgroundOpaque(BOOL b) +void LLToast::setBackgroundOpaque(bool b) { if(mWrapperPanel && !isBackgroundVisible()) { @@ -583,7 +583,7 @@ void LLNotificationsUI::LLToast::startTimer() //-------------------------------------------------------------------------- -BOOL LLToast::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLToast::handleMouseDown(S32 x, S32 y, MASK mask) { if(mHideBtn && mHideBtn->getEnabled()) { diff --git a/indra/newview/lltoast.h b/indra/newview/lltoast.h index a0003dfa70..cf116bfadf 100644 --- a/indra/newview/lltoast.h +++ b/indra/newview/lltoast.h @@ -53,11 +53,11 @@ public: LLToastLifeTimer(LLToast* toast, F32 period); /*virtual*/ - BOOL tick(); + bool tick(); void stop(); void start(); void restart(); - BOOL getStarted(); + bool getStarted(); void setPeriod(F32 period); F32 getRemainingTimeF32(); @@ -109,16 +109,16 @@ public: static void updateClass(); static void cleanupToasts(); - static BOOL isAlertToastShown() { return sModalToastsList.size() > 0; } + static bool isAlertToastShown() { return sModalToastsList.size() > 0; } LLToast(const LLToast::Params& p); virtual ~LLToast(); - BOOL postBuild(); + bool postBuild(); - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true); // Toast handlers - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); //Fading @@ -147,13 +147,13 @@ public: // virtual void draw(); // - virtual void setVisible(BOOL show); + virtual void setVisible(bool show); - /*virtual*/ void setBackgroundOpaque(BOOL b); + /*virtual*/ void setBackgroundOpaque(bool b); // virtual void hide(); - /*virtual*/ void setFocus(BOOL b); + /*virtual*/ void setFocus(bool b); /*virtual*/ void onFocusLost(); @@ -236,7 +236,7 @@ private: bool mCanBeStored; bool mHideBtnEnabled; bool mHideBtnPressed; - bool mIsHidden; // this flag is TRUE when a toast has faded or was hidden with (x) button (EXT-1849) + bool mIsHidden; // this flag is true when a toast has faded or was hidden with (x) button (EXT-1849) bool mIsTip; bool mIsFading; bool mIsHovered; diff --git a/indra/newview/lltoastalertpanel.cpp b/indra/newview/lltoastalertpanel.cpp index a3b2c79015..05ac9dacf3 100644 --- a/indra/newview/lltoastalertpanel.cpp +++ b/indra/newview/lltoastalertpanel.cpp @@ -92,8 +92,8 @@ LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal bool is_password = false; bool allow_emoji = false; - LLToastPanel::setBackgroundVisible(FALSE); - LLToastPanel::setBackgroundOpaque(TRUE); + LLToastPanel::setBackgroundVisible(false); + LLToastPanel::setBackgroundOpaque(true); typedef std::vector<std::pair<std::string, std::string> > options_t; @@ -161,14 +161,14 @@ LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal options = supplied_options; } - S32 num_options = options.size(); + auto num_options = options.size(); // Calc total width of buttons S32 button_width = 0; S32 sp = font->getWidth(std::string("OO")); S32 btn_total_width = 0; S32 default_size_btns = 0; - for( S32 i = 0; i < num_options; i++ ) + for (size_t i = 0; i < num_options; i++) { S32 w = S32(font->getWidth( options[i].second ) + 0.99f) + sp + 2 * LLBUTTON_H_PAD; if (mButtonData[i].mWidth > w) @@ -184,7 +184,7 @@ LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal if( num_options > 1 ) { - btn_total_width = btn_total_width + (button_width * default_size_btns) + ((num_options - 1) * BTN_HPAD); + btn_total_width = btn_total_width + (button_width * default_size_btns) + ((static_cast<S32>(num_options) - 1) * BTN_HPAD); } else { @@ -249,7 +249,7 @@ LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal dialog_width += 32 + HPAD; } - LLToastPanel::reshape( dialog_width, dialog_height, FALSE ); + LLToastPanel::reshape( dialog_width, dialog_height, false ); S32 msg_y = LLToastPanel::getRect().getHeight() - VPAD; S32 msg_x = HPAD; @@ -372,7 +372,7 @@ LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal if( i == mDefaultOption ) { - btn->setFocus(TRUE); + btn->setFocus(true); } } button_left += ((mButtonData[i].mWidth == 0) ? button_width : mButtonData[i].mWidth) + BTN_HPAD; @@ -381,11 +381,11 @@ LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal setCheckBoxes(HPAD, VPAD); // *TODO: check necessity of this code - //gFloaterView->adjustToFitScreen(this, FALSE); + //gFloaterView->adjustToFitScreen(this, false); if (mLineEditor) { mLineEditor->selectAll(); - mLineEditor->setFocus(TRUE); + mLineEditor->setFocus(true); } if(mDefaultOption >= 0) { @@ -398,7 +398,7 @@ LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal LLTransientFloaterMgr::GLOBAL, this); } -void LLToastAlertPanel::setVisible( BOOL visible ) +void LLToastAlertPanel::setVisible( bool visible ) { // only make the "ding" sound if it's newly visible if( visible && !LLToastPanel::getVisible() ) @@ -431,16 +431,16 @@ LLToastAlertPanel::~LLToastAlertPanel() if (current_selection) { // If the focus moved to some other view though, move the focus there - current_selection->setFocus(TRUE); + current_selection->setFocus(true); } else { - mPreviouslyFocusedView.get()->setFocus(TRUE); + mPreviouslyFocusedView.get()->setFocus(true); } } } -BOOL LLToastAlertPanel::hasTitleBar() const +bool LLToastAlertPanel::hasTitleBar() const { // *TODO: check necessity of this code /* @@ -451,7 +451,7 @@ BOOL LLToastAlertPanel::hasTitleBar() const return false; } -BOOL LLToastAlertPanel::handleKeyHere(KEY key, MASK mask ) +bool LLToastAlertPanel::handleKeyHere(KEY key, MASK mask ) { if( KEY_RETURN == key && mask == MASK_NONE ) { @@ -461,31 +461,31 @@ BOOL LLToastAlertPanel::handleKeyHere(KEY key, MASK mask ) // If we have a default button, click it when return is pressed defaultBtn->onCommit(); } - return TRUE; + return true; } else if (KEY_RIGHT == key) { - LLToastPanel::focusNextItem(FALSE); - return TRUE; + LLToastPanel::focusNextItem(false); + return true; } else if (KEY_LEFT == key) { - LLToastPanel::focusPrevItem(FALSE); - return TRUE; + LLToastPanel::focusPrevItem(false); + return true; } else if (KEY_TAB == key && mask == MASK_NONE) { - LLToastPanel::focusNextItem(FALSE); - return TRUE; + LLToastPanel::focusNextItem(false); + return true; } else if (KEY_TAB == key && mask == MASK_SHIFT) { - LLToastPanel::focusPrevItem(FALSE); - return TRUE; + LLToastPanel::focusPrevItem(false); + return true; } else { - return TRUE; + return true; } } diff --git a/indra/newview/lltoastalertpanel.h b/indra/newview/lltoastalertpanel.h index 9721a4b1b6..c2cdd775f1 100644 --- a/indra/newview/lltoastalertpanel.h +++ b/indra/newview/lltoastalertpanel.h @@ -56,14 +56,14 @@ public: // User's responsibility to call show() after creating these. LLToastAlertPanel( LLNotificationPtr notep, bool is_modal ); - virtual BOOL handleKeyHere(KEY key, MASK mask ); + virtual bool handleKeyHere(KEY key, MASK mask ); virtual void draw(); - virtual void setVisible( BOOL visible ); + virtual void setVisible( bool visible ); - void setCaution(BOOL val = TRUE) { mCaution = val; } - // If mUnique==TRUE only one copy of this message should exist - void setUnique(BOOL val = TRUE) { mUnique = val; } + void setCaution(bool val = true) { mCaution = val; } + // If mUnique==true only one copy of this message should exist + void setUnique(bool val = true) { mUnique = val; } void setEditTextArgs(const LLSD& edit_args); void onButtonPressed(const LLSD& data, S32 button); @@ -75,7 +75,7 @@ private: // No you can't kill it. It can only kill itself. // Does it have a readable title label, or minimize or close buttons? - BOOL hasTitleBar() const; + bool hasTitleBar() const; private: static LLControlGroup* sSettings; @@ -90,8 +90,8 @@ private: std::vector<ButtonData> mButtonData; S32 mDefaultOption; - BOOL mCaution; - BOOL mUnique; + bool mCaution; + bool mUnique; LLUIString mLabel; LLFrameTimer mDefaultBtnTimer; // For Dialogs that take a line as text as input: diff --git a/indra/newview/lltoastgroupnotifypanel.cpp b/indra/newview/lltoastgroupnotifypanel.cpp index 2bbf37680b..3c3440d41a 100644 --- a/indra/newview/lltoastgroupnotifypanel.cpp +++ b/indra/newview/lltoastgroupnotifypanel.cpp @@ -64,7 +64,7 @@ LLToastGroupNotifyPanel::LLToastGroupNotifyPanel(const LLNotificationPtr& notifi } //group icon - LLGroupIconCtrl* pGroupIcon = getChild<LLGroupIconCtrl>("group_icon", TRUE); + LLGroupIconCtrl* pGroupIcon = getChild<LLGroupIconCtrl>("group_icon", true); // We should already have this data preloaded, so no sense in setting icon through setValue(group_id) pGroupIcon->setIconId(groupData.mInsigniaID); @@ -106,23 +106,23 @@ LLToastGroupNotifyPanel::LLToastGroupNotifyPanel(const LLNotificationPtr& notifi LLFontGL* subject_font = LLFontGL::getFontByName(getString("subject_font")); if (subject_font) style.font = subject_font; - pMessageText->appendText(subject, FALSE, style); + pMessageText->appendText(subject, false, style); LLFontGL* date_font = LLFontGL::getFontByName(getString("date_font")); if (date_font) style.font = date_font; - pMessageText->appendText(timeStr + "\n", TRUE, style); + pMessageText->appendText(timeStr + "\n", true, style); style.font = pMessageText->getFont(); - pMessageText->appendText(message, TRUE, style); + pMessageText->appendText(message, true, style); //attachment - BOOL hasInventory = payload["inventory_offer"].isDefined(); + bool hasInventory = payload["inventory_offer"].isDefined(); //attachment text LLTextBox * pAttachLink = getChild<LLTextBox>("attachment"); //attachment icon - LLIconCtrl* pAttachIcon = getChild<LLIconCtrl>("attachment_icon", TRUE); + LLIconCtrl* pAttachIcon = getChild<LLIconCtrl>("attachment_icon", true); //If attachment is empty let it be invisible and not take place at the panel pAttachLink->setVisible(hasInventory); @@ -190,8 +190,8 @@ void LLToastGroupNotifyPanel::onClickAttachment() pAttachLink->setColor(textColor); LLIconCtrl* pAttachIcon = - getChild<LLIconCtrl> ("attachment_icon", TRUE); - pAttachIcon->setEnabled(FALSE); + getChild<LLIconCtrl> ("attachment_icon", true); + pAttachIcon->setEnabled(false); //if attachment isn't openable - notify about saving if (!isAttachmentOpenable(mInventoryOffer->mType)) { diff --git a/indra/newview/lltoastimpanel.cpp b/indra/newview/lltoastimpanel.cpp index f7e2d49e13..42ee30409d 100644 --- a/indra/newview/lltoastimpanel.cpp +++ b/indra/newview/lltoastimpanel.cpp @@ -76,10 +76,10 @@ LLToastIMPanel::LLToastIMPanel(LLToastIMPanel::Params &p) : LLToastPanel(p.notif mMessage->clear(); style_params.font.style ="ITALIC"; - mMessage->appendText(p.from, FALSE, style_params); + mMessage->appendText(p.from, false, style_params); style_params.font.style = "ITALIC"; - mMessage->appendText(p.message.substr(3), FALSE, style_params); + mMessage->appendText(p.message.substr(3), false, style_params); } else { @@ -117,18 +117,18 @@ LLToastIMPanel::~LLToastIMPanel() } //virtual -BOOL LLToastIMPanel::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLToastIMPanel::handleMouseUp(S32 x, S32 y, MASK mask) { - if (LLPanel::handleMouseUp(x,y,mask) == FALSE) + if (!LLPanel::handleMouseUp(x, y, mask)) { mNotification->respond(mNotification->getResponseTemplate()); } - return TRUE; + return true; } //virtual -BOOL LLToastIMPanel::handleToolTip(S32 x, S32 y, MASK mask) +bool LLToastIMPanel::handleToolTip(S32 x, S32 y, MASK mask) { // It's not our direct child, so parentPointInView() doesn't work. LLRect ctrl_rect; @@ -137,14 +137,14 @@ BOOL LLToastIMPanel::handleToolTip(S32 x, S32 y, MASK mask) if (ctrl_rect.pointInRect(x, y)) { spawnNameToolTip(); - return TRUE; + return true; } mGroupIcon->localRectToOtherView(mGroupIcon->getLocalRect(), &ctrl_rect, this); if(mGroupIcon->getVisible() && ctrl_rect.pointInRect(x, y)) { spawnGroupIconToolTip(); - return TRUE; + return true; } return LLToastPanel::handleToolTip(x, y, mask); @@ -162,11 +162,11 @@ void LLToastIMPanel::spawnNameToolTip() params.background_visible(false); if(!mIsGroupMsg) { - params.click_callback(boost::bind(&LLFloaterReg::showInstance, "inspect_avatar", LLSD().with("avatar_id", mAvatarID), FALSE)); + params.click_callback(boost::bind(&LLFloaterReg::showInstance, "inspect_avatar", LLSD().with("avatar_id", mAvatarID), false)); } else { - params.click_callback(boost::bind(&LLFloaterReg::showInstance, "inspect_group", LLSD().with("group_id", mSessionID), FALSE)); + params.click_callback(boost::bind(&LLFloaterReg::showInstance, "inspect_group", LLSD().with("group_id", mSessionID), false)); } params.delay_time(0.0f); // spawn instantly on hover params.image(LLUI::getUIImage("Info_Small")); @@ -192,7 +192,7 @@ void LLToastIMPanel::spawnGroupIconToolTip() LLInspector::Params params; params.fillFrom(LLUICtrlFactory::instance().getDefaultParams<LLInspector>()); - params.click_callback(boost::bind(&LLFloaterReg::showInstance, "inspect_group", LLSD().with("group_id", mSessionID), FALSE)); + params.click_callback(boost::bind(&LLFloaterReg::showInstance, "inspect_group", LLSD().with("group_id", mSessionID), false)); params.delay_time(0.100f); params.image(LLUI::getUIImage("Info_Small")); params.message(g_data.mName); @@ -205,9 +205,9 @@ void LLToastIMPanel::spawnGroupIconToolTip() void LLToastIMPanel::initIcon() { - mAvatarIcon->setVisible(FALSE); - mGroupIcon->setVisible(FALSE); - mAdhocIcon->setVisible(FALSE); + mAvatarIcon->setVisible(false); + mGroupIcon->setVisible(false); + mAdhocIcon->setVisible(false); if(mAvatarName->getValue().asString() == SYSTEM_FROM) { @@ -227,15 +227,15 @@ void LLToastIMPanel::initIcon() switch(im_session->mSessionType) { case LLIMModel::LLIMSession::P2P_SESSION: - mAvatarIcon->setVisible(TRUE); + mAvatarIcon->setVisible(true); mAvatarIcon->setValue(mAvatarID); break; case LLIMModel::LLIMSession::GROUP_SESSION: - mGroupIcon->setVisible(TRUE); + mGroupIcon->setVisible(true); mGroupIcon->setValue(mSessionID); break; case LLIMModel::LLIMSession::ADHOC_SESSION: - mAdhocIcon->setVisible(TRUE); + mAdhocIcon->setVisible(true); mAdhocIcon->setValue(im_session->mOtherParticipantID); mAdhocIcon->setToolTip(im_session->mName); break; diff --git a/indra/newview/lltoastimpanel.h b/indra/newview/lltoastimpanel.h index 07985f205e..dfb6eea780 100644 --- a/indra/newview/lltoastimpanel.h +++ b/indra/newview/lltoastimpanel.h @@ -52,8 +52,8 @@ public: LLToastIMPanel(LLToastIMPanel::Params &p); virtual ~LLToastIMPanel(); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleToolTip(S32 x, S32 y, MASK mask); private: void showInspector(); diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index a091370ee8..6c0b3bfa13 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -66,7 +66,7 @@ void LLToastNotifyPanel::addDefaultButton() { LLSD form_element; form_element.with("name", "OK").with("text", LLTrans::getString("ok")).with("default", true); - LLButton* ok_btn = createButton(form_element, FALSE); + LLButton* ok_btn = createButton(form_element, false); LLRect new_btn_rect(ok_btn->getRect()); new_btn_rect.setOriginAndSize(llabs(getRect().getWidth() - BUTTON_WIDTH)/ 2, BOTTOM_PAD, @@ -77,7 +77,7 @@ void LLToastNotifyPanel::addDefaultButton() mNumButtons = 1; mAddedDefaultBtn = true; } -LLButton* LLToastNotifyPanel::createButton(const LLSD& form_element, BOOL is_option) +LLButton* LLToastNotifyPanel::createButton(const LLSD& form_element, bool is_option) { InstanceAndS32* userdata = new InstanceAndS32; userdata->mSelf = this; @@ -224,7 +224,7 @@ void LLToastNotifyPanel::adjustPanelForScriptNotice(S32 button_panel_width, S32 void LLToastNotifyPanel::adjustPanelForTipNotice() { //we don't need display ControlPanel for tips because they doesn't contain any buttons. - mControlPanel->setVisible(FALSE); + mControlPanel->setVisible(false); reshape(getRect().getWidth(), mInfoPanel->getRect().getHeight()); if (mNotification->getPayload().has("respond_on_mousedown") @@ -251,7 +251,7 @@ void LLToastNotifyPanel::onClickButton(void* data) } // disable all buttons - self->mControlPanel->setEnabled(FALSE); + self->mControlPanel->setEnabled(false); // this might repost notification with new form data/enabled buttons self->mNotification->respond(response); @@ -266,7 +266,7 @@ void LLToastNotifyPanel::init( LLRect rect, bool show_images ) setXMLFilename(""); buildFromFile("panel_notification.xml"); - if (rect != LLRect::null) + if(rect != LLRect::null) { this->setShape(rect); } @@ -319,7 +319,7 @@ void LLToastNotifyPanel::init( LLRect rect, bool show_images ) } mTextBox->setMaxTextLength(LLToastPanel::MAX_TEXT_LENGTH); - mTextBox->setVisible(TRUE); + mTextBox->setVisible(true); mTextBox->setPlainText(!show_images); mTextBox->setUseEmoji(!mIsScriptDialog); mTextBox->setContentTrusted(is_content_trusted); @@ -351,7 +351,7 @@ void LLToastNotifyPanel::init( LLRect rect, bool show_images ) // a textbox pretending to be a button. continue; } - LLButton* new_button = createButton(form_element, TRUE); + LLButton* new_button = createButton(form_element, true); buttons_width += new_button->getRect().getWidth(); S32 index = form_element["index"].asInteger(); buttons.push_back(index_button_pair_t(index,new_button)); @@ -484,7 +484,7 @@ LLIMToastNotifyPanel::~LLIMToastNotifyPanel() { } -void LLIMToastNotifyPanel::reshape(S32 width, S32 height, BOOL called_from_parent /* = TRUE */) +void LLIMToastNotifyPanel::reshape(S32 width, S32 height, bool called_from_parent /* = true */) { LLToastPanel::reshape(width, height, called_from_parent); snapToMessageHeight(); diff --git a/indra/newview/lltoastnotifypanel.h b/indra/newview/lltoastnotifypanel.h index 66e9ff238d..d694513aba 100644 --- a/indra/newview/lltoastnotifypanel.h +++ b/indra/newview/lltoastnotifypanel.h @@ -73,7 +73,7 @@ public: bool isControlPanelEnabled() const; protected: - LLButton* createButton(const LLSD& form_element, BOOL is_option); + LLButton* createButton(const LLSD& form_element, bool is_option); // Used for callbacks struct InstanceAndS32 @@ -155,7 +155,7 @@ public: ~LLIMToastNotifyPanel(); - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true); protected: LLTextBase* mParentText; diff --git a/indra/newview/lltoastpanel.cpp b/indra/newview/lltoastpanel.cpp index 2834143dd6..0ac2653021 100644 --- a/indra/newview/lltoastpanel.cpp +++ b/indra/newview/lltoastpanel.cpp @@ -216,10 +216,10 @@ bool LLCheckBoxToastPanel::setCheckBox(const std::string& check_title, S32 dialog_width = max_msg_width + 2 * h_pad; S32 dialog_height = LLToastPanel::getRect().getHeight(); - dialog_height += LINE_HEIGHT * lines.size(); + dialog_height += LINE_HEIGHT * static_cast<S32>(lines.size()); dialog_height += LINE_HEIGHT / 2; - LLToastPanel::reshape(dialog_width, dialog_height, FALSE); + LLToastPanel::reshape(dialog_width, dialog_height, false); S32 msg_x = (LLToastPanel::getRect().getWidth() - max_msg_width) / 2; @@ -227,7 +227,7 @@ bool LLCheckBoxToastPanel::setCheckBox(const std::string& check_title, LLRect check_rect; // if we are part of the toast, we need to leave space for buttons S32 msg_y = v_pad + (parent_view ? 0 : (BTN_HEIGHT + LINE_HEIGHT / 2)); - mCheck->setRect(check_rect.setOriginAndSize(msg_x, msg_y, max_msg_width, LINE_HEIGHT*lines.size())); + mCheck->setRect(check_rect.setOriginAndSize(msg_x, msg_y, max_msg_width, LINE_HEIGHT * static_cast<S32>(lines.size()))); mCheck->setLabel(check_title); mCheck->setCommitCallback(cb); @@ -246,7 +246,7 @@ bool LLCheckBoxToastPanel::setCheckBox(const std::string& check_title, void LLCheckBoxToastPanel::onCommitCheckbox(LLUICtrl* ctrl) { - BOOL check = ctrl->getValue().asBoolean(); + bool check = ctrl->getValue().asBoolean(); if (mNotification->getForm()->getIgnoreType() == LLNotificationForm::IGNORE_SHOW_AGAIN) { // question was "show again" so invert value to get "ignore" diff --git a/indra/newview/lltoastscriptquestion.cpp b/indra/newview/lltoastscriptquestion.cpp index fd1e30345c..25dc0982b8 100644 --- a/indra/newview/lltoastscriptquestion.cpp +++ b/indra/newview/lltoastscriptquestion.cpp @@ -40,7 +40,7 @@ LLToastPanel(notification) buildFromFile("panel_script_question_toast.xml"); } -BOOL LLToastScriptQuestion::postBuild() +bool LLToastScriptQuestion::postBuild() { createButtons(); @@ -52,11 +52,11 @@ BOOL LLToastScriptQuestion::postBuild() snapToMessageHeight(); - return TRUE; + return true; } // virtual -void LLToastScriptQuestion::setFocus(BOOL b) +void LLToastScriptQuestion::setFocus(bool b) { LLToastPanel::setFocus(b); // toast can fade out and disappear with focus ON, so reset to default anyway @@ -134,7 +134,7 @@ void LLToastScriptQuestion::createButtons() if (form_element.has("default") && form_element["default"].asBoolean()) { - button->setFocus(TRUE); + button->setFocus(true); setDefaultBtn(button); } } diff --git a/indra/newview/lltoastscriptquestion.h b/indra/newview/lltoastscriptquestion.h index fc129236db..41680df5c9 100644 --- a/indra/newview/lltoastscriptquestion.h +++ b/indra/newview/lltoastscriptquestion.h @@ -36,10 +36,10 @@ class LLToastScriptQuestion : public LLToastPanel public: LLToastScriptQuestion(const LLNotificationPtr& notification); - virtual BOOL postBuild(); + bool postBuild() override; virtual ~LLToastScriptQuestion(){}; - /*virtual*/ void setFocus(BOOL b); + void setFocus(bool b) override; private: void snapToMessageHeight(); diff --git a/indra/newview/lltoastscripttextbox.cpp b/indra/newview/lltoastscripttextbox.cpp index 72057fe42b..de555ca895 100644 --- a/indra/newview/lltoastscripttextbox.cpp +++ b/indra/newview/lltoastscripttextbox.cpp @@ -58,7 +58,7 @@ LLToastScriptTextbox::LLToastScriptTextbox(const LLNotificationPtr& notification LLStyle::Params style; style.font = pMessageText->getFont(); - pMessageText->appendText(message, TRUE, style); + pMessageText->appendText(message, true, style); //submit button LLButton* pSubmitBtn = getChild<LLButton>("btn_submit"); diff --git a/indra/newview/lltool.cpp b/indra/newview/lltool.cpp index 1746e805ad..c595fc42ca 100644 --- a/indra/newview/lltool.cpp +++ b/indra/newview/lltool.cpp @@ -40,7 +40,7 @@ #include "llagent.h" #include "llviewerjoystick.h" -extern BOOL gDebugClicks; +extern bool gDebugClicks; //static const std::string LLTool::sNameNull("null"); @@ -60,9 +60,9 @@ LLTool::~LLTool() } } -BOOL LLTool::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down) +bool LLTool::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, bool down) { - BOOL result = LLMouseHandler::handleAnyMouseClick(x, y, mask, clicktype, down); + bool result = LLMouseHandler::handleAnyMouseClick(x, y, mask, clicktype, down); // This behavior was moved here from LLViewerWindow::handleAnyMouseClick, so it can be selectively overridden by LLTool subclasses. if(down && result) @@ -76,7 +76,7 @@ BOOL LLTool::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clickt return result; } -BOOL LLTool::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLTool::handleMouseDown(S32 x, S32 y, MASK mask) { if (gDebugClicks) { @@ -85,10 +85,10 @@ BOOL LLTool::handleMouseDown(S32 x, S32 y, MASK mask) // by default, didn't handle it // AGENT_CONTROL_LBUTTON_DOWN is handled by scanMouse() and scanKey() // LL_INFOS() << "LLTool::handleMouseDown" << LL_ENDL; - return FALSE; + return false; } -BOOL LLTool::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLTool::handleMouseUp(S32 x, S32 y, MASK mask) { if (gDebugClicks) { @@ -97,73 +97,73 @@ BOOL LLTool::handleMouseUp(S32 x, S32 y, MASK mask) // by default, didn't handle it // AGENT_CONTROL_LBUTTON_UP is handled by scanMouse() and scanKey() // LL_INFOS() << "LLTool::handleMouseUp" << LL_ENDL; - return TRUE; + return true; } -BOOL LLTool::handleHover(S32 x, S32 y, MASK mask) +bool LLTool::handleHover(S32 x, S32 y, MASK mask) { gViewerWindow->setCursor(UI_CURSOR_ARROW); LL_DEBUGS("UserInput") << "hover handled by a tool" << LL_ENDL; // by default, do nothing, say we handled it - return TRUE; + return true; } -BOOL LLTool::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLTool::handleScrollWheel(S32 x, S32 y, S32 clicks) { // by default, didn't handle it // LL_INFOS() << "LLTool::handleScrollWheel" << LL_ENDL; - return FALSE; + return false; } -BOOL LLTool::handleScrollHWheel(S32 x, S32 y, S32 clicks) +bool LLTool::handleScrollHWheel(S32 x, S32 y, S32 clicks) { // by default, didn't handle it - return FALSE; + return false; } -BOOL LLTool::handleDoubleClick(S32 x,S32 y,MASK mask) +bool LLTool::handleDoubleClick(S32 x,S32 y,MASK mask) { // LL_INFOS() << "LLTool::handleDoubleClick" << LL_ENDL; // by default, pretend it's a left click - return FALSE; + return false; } -BOOL LLTool::handleRightMouseDown(S32 x,S32 y,MASK mask) +bool LLTool::handleRightMouseDown(S32 x,S32 y,MASK mask) { // by default, didn't handle it // LL_INFOS() << "LLTool::handleRightMouseDown" << LL_ENDL; - return FALSE; + return false; } -BOOL LLTool::handleRightMouseUp(S32 x, S32 y, MASK mask) +bool LLTool::handleRightMouseUp(S32 x, S32 y, MASK mask) { // by default, didn't handle it // LL_INFOS() << "LLTool::handleRightMouseDown" << LL_ENDL; - return FALSE; + return false; } -BOOL LLTool::handleMiddleMouseDown(S32 x,S32 y,MASK mask) +bool LLTool::handleMiddleMouseDown(S32 x,S32 y,MASK mask) { // by default, didn't handle it // LL_INFOS() << "LLTool::handleMiddleMouseDown" << LL_ENDL; - return FALSE; + return false; } -BOOL LLTool::handleMiddleMouseUp(S32 x, S32 y, MASK mask) +bool LLTool::handleMiddleMouseUp(S32 x, S32 y, MASK mask) { // by default, didn't handle it // LL_INFOS() << "LLTool::handleMiddleMouseUp" << LL_ENDL; - return FALSE; + return false; } -BOOL LLTool::handleToolTip(S32 x, S32 y, MASK mask) +bool LLTool::handleToolTip(S32 x, S32 y, MASK mask) { // by default, didn't handle it // LL_INFOS() << "LLTool::handleToolTip" << LL_ENDL; - return FALSE; + return false; } -void LLTool::setMouseCapture( BOOL b ) +void LLTool::setMouseCapture( bool b ) { if( b ) { @@ -180,14 +180,14 @@ void LLTool::setMouseCapture( BOOL b ) void LLTool::draw() { } -BOOL LLTool::hasMouseCapture() +bool LLTool::hasMouseCapture() { return gFocusMgr.getMouseCapture() == (mComposite ? mComposite : this); } -BOOL LLTool::handleKey(KEY key, MASK mask) +bool LLTool::handleKey(KEY key, MASK mask) { - return FALSE; + return false; } LLTool* LLTool::getOverrideTool(MASK mask) diff --git a/indra/newview/lltool.h b/indra/newview/lltool.h index ba0a73fc72..10af156395 100644 --- a/indra/newview/lltool.h +++ b/indra/newview/lltool.h @@ -46,24 +46,24 @@ public: virtual ~LLTool(); // Hack to support LLFocusMgr - virtual BOOL isView() const { return FALSE; } + virtual bool isView() const { return false; } // Virtual functions inherited from LLMouseHandler - virtual BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask); - - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); - virtual BOOL handleScrollHWheel(S32 x, S32 y, S32 clicks); - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); - virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleToolTip(S32 x, S32 y, MASK mask); - - // Return FALSE to allow context menu to be shown. + virtual bool handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, bool down); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleMiddleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMiddleMouseUp(S32 x, S32 y, MASK mask); + + virtual bool handleHover(S32 x, S32 y, MASK mask); + virtual bool handleScrollWheel(S32 x, S32 y, S32 clicks); + virtual bool handleScrollHWheel(S32 x, S32 y, S32 clicks); + virtual bool handleDoubleClick(S32 x, S32 y, MASK mask); + virtual bool handleRightMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleRightMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleToolTip(S32 x, S32 y, MASK mask); + + // Return false to allow context menu to be shown. virtual void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const { *local_x = screen_x; *local_y = screen_y; } virtual void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const @@ -74,10 +74,10 @@ public: // New virtual functions virtual LLViewerObject* getEditingObject() { return NULL; } virtual LLVector3d getEditingPointGlobal() { return LLVector3d(); } - virtual BOOL isEditing() { return (getEditingObject() != NULL); } + virtual bool isEditing() { return (getEditingObject() != NULL); } virtual void stopEditing() {} - virtual BOOL clipMouseWhenDown() { return TRUE; } + virtual bool clipMouseWhenDown() { return true; } virtual void handleSelect() { } // do stuff when your tool is selected virtual void handleDeselect() { } // clean up when your tool is deselected @@ -86,16 +86,16 @@ public: // isAlwaysRendered() - return true if this is a tool that should // always be rendered regardless of selection. - virtual BOOL isAlwaysRendered() { return FALSE; } + virtual bool isAlwaysRendered() { return false; } virtual void render() {} // draw tool specific 3D content in world virtual void draw(); // draw tool specific 2D overlay - virtual BOOL handleKey(KEY key, MASK mask); + virtual bool handleKey(KEY key, MASK mask); // Note: NOT virtual. Subclasses should call this version. - void setMouseCapture(BOOL b); - BOOL hasMouseCapture(); + void setMouseCapture(bool b); + bool hasMouseCapture(); virtual void onMouseCaptureLost() {} // override this one as needed. protected: diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp index 6b9125b385..5180b1808c 100644 --- a/indra/newview/lltoolbarview.cpp +++ b/indra/newview/lltoolbarview.cpp @@ -93,7 +93,7 @@ LLToolBarView::~LLToolBarView() saveToolbars(); } -BOOL LLToolBarView::postBuild() +bool LLToolBarView::postBuild() { mToolbars[LLToolBarEnums::TOOLBAR_LEFT] = getChild<LLToolBar>("toolbar_left"); mToolbars[LLToolBarEnums::TOOLBAR_LEFT]->getCenterLayoutPanel()->setLocationId(LLToolBarEnums::TOOLBAR_LEFT); @@ -115,7 +115,7 @@ BOOL LLToolBarView::postBuild() mToolbars[i]->setButtonRemoveCallback(boost::bind(LLToolBarView::onToolBarButtonRemoved,_1)); } - return TRUE; + return true; } S32 LLToolBarView::hasCommand(const LLCommandId& commandId) const @@ -570,7 +570,7 @@ void LLToolBarView::draw() for (S32 i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++) { - gl_rect_2d(toolbar_rects[i], drop_color, TRUE); + gl_rect_2d(toolbar_rects[i], drop_color, true); } } @@ -591,7 +591,7 @@ void LLToolBarView::startDragTool(S32 x, S32 y, LLToolBarButton* toolbarButton) LLToolDragAndDrop::getInstance()->setDragStart( x, y ); } -BOOL LLToolBarView::handleDragTool( S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type) +bool LLToolBarView::handleDragTool( S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type) { if (LLToolDragAndDrop::getInstance()->isOverThreshold( x, y )) { @@ -613,7 +613,7 @@ BOOL LLToolBarView::handleDragTool( S32 x, S32 y, const LLUUID& uuid, LLAssetTyp gToolBarView->stopCommandInProgress(command_id); gToolBarView->mDragStarted = true; - return TRUE; + return true; } else { @@ -621,18 +621,18 @@ BOOL LLToolBarView::handleDragTool( S32 x, S32 y, const LLUUID& uuid, LLAssetTyp return LLToolDragAndDrop::getInstance()->handleHover( x, y, mask ); } } - return FALSE; + return false; } -BOOL LLToolBarView::handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* toolbar) +bool LLToolBarView::handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* toolbar) { - BOOL handled = FALSE; + bool handled = false; LLInventoryObject* inv_item = static_cast<LLInventoryObject*>(cargo_data); LLAssetType::EType type = inv_item->getType(); if (type == LLAssetType::AT_WIDGET) { - handled = TRUE; + handled = true; // Get the command from its uuid LLCommandManager& mgr = LLCommandManager::instance(); LLCommandId command_id(inv_item->getUUID()); diff --git a/indra/newview/lltoolbarview.h b/indra/newview/lltoolbarview.h index 19f72102c1..7cecd81052 100644 --- a/indra/newview/lltoolbarview.h +++ b/indra/newview/lltoolbarview.h @@ -67,8 +67,8 @@ public: // Derived methods virtual ~LLToolBarView(); - virtual BOOL postBuild(); - virtual void draw(); + bool postBuild() override; + void draw() override; // Toolbar view interface with the rest of the world // Checks if the commandId is being used somewhere in one of the toolbars, returns LLToolBarEnums::EToolBarLocation @@ -91,8 +91,8 @@ public: static bool clearAllToolbars(); static void startDragTool(S32 x, S32 y, LLToolBarButton* toolbarButton); - static BOOL handleDragTool(S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type); - static BOOL handleDropTool(void* cargo_data, S32 x, S32 y, LLToolBar* toolbar); + static bool handleDragTool(S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type); + static bool handleDropTool(void* cargo_data, S32 x, S32 y, LLToolBar* toolbar); static void resetDragTool(LLToolBarButton* toolbarButton); LLInventoryObject* getDragItem(); LLView* getBottomToolbar() { return mBottomToolbarPanel; } diff --git a/indra/newview/lltoolbrush.cpp b/indra/newview/lltoolbrush.cpp index 05ec09883d..e2b6924aeb 100644 --- a/indra/newview/lltoolbrush.cpp +++ b/indra/newview/lltoolbrush.cpp @@ -88,8 +88,8 @@ LLToolBrushLand::LLToolBrushLand() mStartingZ( 0.0f ), mMouseX( 0 ), mMouseY(0), - mGotHover(FALSE), - mBrushSelected(FALSE) + mGotHover(false), + mBrushSelected(false) { mBrushSize = gSavedSettings.getF32("LandBrushSize"); } @@ -122,7 +122,7 @@ void LLToolBrushLand::modifyLandAtPointGlobal(const LLVector3d &pos_global, iter != mLastAffectedRegions.end(); ++iter) { LLViewerRegion* regionp = *iter; - //BOOL is_changed = FALSE; + //bool is_changed = false; LLVector3 pos_region = regionp->getPosRegionFromGlobal(pos_global); LLSurface &land = regionp->getLand(); char action = E_LAND_LEVEL; @@ -249,7 +249,7 @@ void LLToolBrushLand::modifyLandInSelectionGlobal() iter != mLastAffectedRegions.end(); ++iter) { LLViewerRegion* regionp = *iter; - //BOOL is_changed = FALSE; + //bool is_changed = false; LLVector3 min_region = regionp->getPosRegionFromGlobal(min); LLVector3 max_region = regionp->getPosRegionFromGlobal(max); @@ -318,7 +318,7 @@ void LLToolBrushLand::modifyLandInSelectionGlobal() msg->addF32Fast(_PREHASH_Seconds, seconds); msg->addF32Fast(_PREHASH_Height, mStartingZ); - BOOL parcel_selected = LLViewerParcelMgr::getInstance()->getParcelSelection()->getWholeParcelSelected(); + bool parcel_selected = LLViewerParcelMgr::getInstance()->getParcelSelection()->getWholeParcelSelected(); LLParcel* selected_parcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(); if (parcel_selected && selected_parcel) @@ -356,13 +356,13 @@ void LLToolBrushLand::brush( void ) spot.mdV[VX] = floor( spot.mdV[VX] + 0.5 ); spot.mdV[VY] = floor( spot.mdV[VY] + 0.5 ); - modifyLandAtPointGlobal(spot, gKeyboard->currentMask(TRUE)); + modifyLandAtPointGlobal(spot, gKeyboard->currentMask(true)); } } -BOOL LLToolBrushLand::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLToolBrushLand::handleMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; // Find the z value of the initial click. LLVector3d spot; @@ -378,7 +378,7 @@ BOOL LLToolBrushLand::handleMouseDown(S32 x, S32 y, MASK mask) if (!canTerraformRegion(regionp)) { alertNoTerraformRegion(regionp); - return TRUE; + return true; } if (!canTerraformParcel(regionp)) @@ -394,23 +394,23 @@ BOOL LLToolBrushLand::handleMouseDown(S32 x, S32 y, MASK mask) mMouseX = x; mMouseY = y; gIdleCallbacks.addFunction( &LLToolBrushLand::onIdle, (void*)this ); - setMouseCapture( TRUE ); + setMouseCapture( true ); - LLViewerParcelMgr::getInstance()->setSelectionVisible(FALSE); - handled = TRUE; + LLViewerParcelMgr::getInstance()->setSelectionVisible(false); + handled = true; } return handled; } -BOOL LLToolBrushLand::handleHover( S32 x, S32 y, MASK mask ) +bool LLToolBrushLand::handleHover( S32 x, S32 y, MASK mask ) { LL_DEBUGS("UserInput") << "hover handled by LLToolBrushLand (" << (hasMouseCapture() ? "active":"inactive") << ")" << LL_ENDL; mMouseX = x; mMouseY = y; - mGotHover = TRUE; + mGotHover = true; gViewerWindow->setCursor(UI_CURSOR_TOOLLAND); LLVector3d spot; @@ -422,22 +422,22 @@ BOOL LLToolBrushLand::handleHover( S32 x, S32 y, MASK mask ) LLViewerParcelMgr::getInstance()->setHoverParcel(spot); } - return TRUE; + return true; } -BOOL LLToolBrushLand::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLToolBrushLand::handleMouseUp(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; mLastAffectedRegions.clear(); if( hasMouseCapture() ) { // Release the mouse - setMouseCapture( FALSE ); + setMouseCapture( false ); - LLViewerParcelMgr::getInstance()->setSelectionVisible(TRUE); + LLViewerParcelMgr::getInstance()->setSelectionVisible(true); gIdleCallbacks.deleteFunction( &LLToolBrushLand::onIdle, (void*)this ); - handled = TRUE; + handled = true; } return handled; @@ -450,7 +450,7 @@ void LLToolBrushLand::handleSelect() gFloaterTools->setStatusText("modifyland"); // if (!mBrushSelected) { - mBrushSelected = TRUE; + mBrushSelected = true; } } @@ -461,8 +461,8 @@ void LLToolBrushLand::handleDeselect() { gEditMenuHandler = NULL; } - LLViewerParcelMgr::getInstance()->setSelectionVisible(TRUE); - mBrushSelected = FALSE; + LLViewerParcelMgr::getInstance()->setSelectionVisible(true); + mBrushSelected = false; } // Draw the area that will be affected. @@ -493,7 +493,7 @@ void LLToolBrushLand::render() pos_world); } } - mGotHover = FALSE; + mGotHover = false; } } @@ -681,7 +681,7 @@ bool LLToolBrushLand::canTerraformParcel(LLViewerRegion* regionp) const bool is_terraform_allowed = false; if (selected_parcel) { - BOOL owner_release = LLViewerParcelMgr::isParcelOwnedByAgent(selected_parcel, GP_LAND_ALLOW_EDIT_LAND); + bool owner_release = LLViewerParcelMgr::isParcelOwnedByAgent(selected_parcel, GP_LAND_ALLOW_EDIT_LAND); is_terraform_allowed = ( gAgent.canManageEstate() || (selected_parcel->getOwnerID() == regionp->getOwner()) || owner_release); } diff --git a/indra/newview/lltoolbrush.h b/indra/newview/lltoolbrush.h index 4dc70d8a5e..28cad912e5 100644 --- a/indra/newview/lltoolbrush.h +++ b/indra/newview/lltoolbrush.h @@ -49,15 +49,15 @@ class LLToolBrushLand : public LLTool, public LLEditMenuHandler, public LLSingle public: // x,y in window coords, 0,0 = left,bot - virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ) override; - virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask ) override; - virtual BOOL handleHover( S32 x, S32 y, MASK mask ) override; + virtual bool handleMouseDown( S32 x, S32 y, MASK mask ) override; + virtual bool handleMouseUp( S32 x, S32 y, MASK mask ) override; + virtual bool handleHover( S32 x, S32 y, MASK mask ) override; virtual void handleSelect() override; virtual void handleDeselect() override; // isAlwaysRendered() - return true if this is a tool that should // always be rendered regardless of selection. - virtual BOOL isAlwaysRendered() override { return TRUE; } + virtual bool isAlwaysRendered() override { return true; } // Draw the area that will be affected. virtual void render() override; @@ -69,7 +69,7 @@ public: void modifyLandInSelectionGlobal(); virtual void undo() override; - virtual BOOL canUndo() const override { return TRUE; } + virtual bool canUndo() const override { return true; } protected: void brush( void ); @@ -95,8 +95,8 @@ protected: S32 mMouseX; S32 mMouseY; F32 mBrushSize; - BOOL mGotHover; - BOOL mBrushSelected; + bool mGotHover; + bool mBrushSelected; // Order doesn't matter and we do check for existance of regions, so use a set region_list_t mLastAffectedRegions; diff --git a/indra/newview/lltoolcomp.cpp b/indra/newview/lltoolcomp.cpp index 1060d79641..c6e59a81c9 100644 --- a/indra/newview/lltoolcomp.cpp +++ b/indra/newview/lltoolcomp.cpp @@ -83,15 +83,15 @@ LLToolComposite::LLToolComposite(const std::string& name) : LLTool(name), mCur(sNullTool), mDefault(sNullTool), - mSelected(FALSE), - mMouseDown(FALSE), mManip(NULL), mSelectRect(NULL) + mSelected(false), + mMouseDown(false), mManip(NULL), mSelectRect(NULL) { } // Returns to the default tool -BOOL LLToolComposite::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLToolComposite::handleMouseUp(S32 x, S32 y, MASK mask) { - BOOL handled = mCur->handleMouseUp( x, y, mask ); + bool handled = mCur->handleMouseUp( x, y, mask ); if( handled ) { setCurrentTool( mDefault ); @@ -105,7 +105,7 @@ void LLToolComposite::onMouseCaptureLost() setCurrentTool( mDefault ); } -BOOL LLToolComposite::isSelecting() +bool LLToolComposite::isSelecting() { return mCur == mSelectRect; } @@ -118,14 +118,14 @@ void LLToolComposite::handleSelect() } mCur = mDefault; mCur->handleSelect(); - mSelected = TRUE; + mSelected = true; } void LLToolComposite::handleDeselect() { mCur->handleDeselect(); mCur = mDefault; - mSelected = FALSE; + mSelected = false; } //---------------------------------------------------------------------------- @@ -134,7 +134,7 @@ void LLToolComposite::handleDeselect() LLToolCompInspect::LLToolCompInspect() : LLToolComposite(std::string("Inspect")), - mIsToolCameraActive(FALSE) + mIsToolCameraActive(false) { mSelectRect = new LLToolSelectRect(this); mDefault = mSelectRect; @@ -147,9 +147,9 @@ LLToolCompInspect::~LLToolCompInspect() mSelectRect = NULL; } -BOOL LLToolCompInspect::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLToolCompInspect::handleMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; if (mCur == LLToolCamera::getInstance()) { @@ -157,17 +157,17 @@ BOOL LLToolCompInspect::handleMouseDown(S32 x, S32 y, MASK mask) } else { - mMouseDown = TRUE; + mMouseDown = true; gViewerWindow->pickAsync(x, y, mask, pickCallback); - handled = TRUE; + handled = true; } return handled; } -BOOL LLToolCompInspect::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLToolCompInspect::handleMouseUp(S32 x, S32 y, MASK mask) { - BOOL handled = LLToolComposite::handleMouseUp(x, y, mask); + bool handled = LLToolComposite::handleMouseUp(x, y, mask); mIsToolCameraActive = getCurrentTool() == LLToolCamera::getInstance(); return handled; } @@ -180,7 +180,7 @@ void LLToolCompInspect::pickCallback(const LLPickInfo& pick_info) if (!tool_inspectp->mMouseDown) { // fast click on object, but mouse is already up...just do select - tool_inspectp->mSelectRect->handleObjectSelection(pick_info, gSavedSettings.getBOOL("EditLinkedParts"), FALSE); + tool_inspectp->mSelectRect->handleObjectSelection(pick_info, gSavedSettings.getBOOL("EditLinkedParts"), false); return; } @@ -190,24 +190,24 @@ void LLToolCompInspect::pickCallback(const LLPickInfo& pick_info) } tool_inspectp->setCurrentTool( tool_inspectp->mSelectRect ); - tool_inspectp->mIsToolCameraActive = FALSE; + tool_inspectp->mIsToolCameraActive = false; tool_inspectp->mSelectRect->handlePick( pick_info ); } -BOOL LLToolCompInspect::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLToolCompInspect::handleDoubleClick(S32 x, S32 y, MASK mask) { - return TRUE; + return true; } -BOOL LLToolCompInspect::handleKey(KEY key, MASK mask) +bool LLToolCompInspect::handleKey(KEY key, MASK mask) { - BOOL handled = FALSE; + bool handled = false; if(KEY_ALT == key) { setCurrentTool(LLToolCamera::getInstance()); - mIsToolCameraActive = TRUE; - handled = TRUE; + mIsToolCameraActive = true; + handled = true; } else { @@ -220,7 +220,7 @@ BOOL LLToolCompInspect::handleKey(KEY key, MASK mask) void LLToolCompInspect::onMouseCaptureLost() { LLToolComposite::onMouseCaptureLost(); - mIsToolCameraActive = FALSE; + mIsToolCameraActive = false; } void LLToolCompInspect::keyUp(KEY key, MASK mask) @@ -228,7 +228,7 @@ void LLToolCompInspect::keyUp(KEY key, MASK mask) if (KEY_ALT == key && mCur == LLToolCamera::getInstance()) { setCurrentTool(mDefault); - mIsToolCameraActive = FALSE; + mIsToolCameraActive = false; } } @@ -255,7 +255,7 @@ LLToolCompTranslate::~LLToolCompTranslate() mSelectRect = NULL; } -BOOL LLToolCompTranslate::handleHover(S32 x, S32 y, MASK mask) +bool LLToolCompTranslate::handleHover(S32 x, S32 y, MASK mask) { if( !mCur->hasMouseCapture() ) { @@ -265,12 +265,12 @@ BOOL LLToolCompTranslate::handleHover(S32 x, S32 y, MASK mask) } -BOOL LLToolCompTranslate::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLToolCompTranslate::handleMouseDown(S32 x, S32 y, MASK mask) { - mMouseDown = TRUE; - gViewerWindow->pickAsync(x, y, mask, pickCallback, /*BOOL pick_transparent*/ FALSE, LLFloaterReg::instanceVisible("build"), FALSE, + mMouseDown = true; + gViewerWindow->pickAsync(x, y, mask, pickCallback, /*bool pick_transparent*/ false, LLFloaterReg::instanceVisible("build"), false, gSavedSettings.getBOOL("SelectReflectionProbes"));; - return TRUE; + return true; } void LLToolCompTranslate::pickCallback(const LLPickInfo& pick_info) @@ -281,7 +281,7 @@ void LLToolCompTranslate::pickCallback(const LLPickInfo& pick_info) if (!LLToolCompTranslate::getInstance()->mMouseDown) { // fast click on object, but mouse is already up...just do select - LLToolCompTranslate::getInstance()->mSelectRect->handleObjectSelection(pick_info, gSavedSettings.getBOOL("EditLinkedParts"), FALSE); + LLToolCompTranslate::getInstance()->mSelectRect->handleObjectSelection(pick_info, gSavedSettings.getBOOL("EditLinkedParts"), false); return; } @@ -292,7 +292,7 @@ void LLToolCompTranslate::pickCallback(const LLPickInfo& pick_info) LLEditMenuHandler::gEditMenuHandler = LLSelectMgr::getInstance(); } - BOOL can_move = LLToolCompTranslate::getInstance()->mManip->canAffectSelection(); + bool can_move = LLToolCompTranslate::getInstance()->mManip->canAffectSelection(); if( LLManip::LL_NO_PART != LLToolCompTranslate::getInstance()->mManip->getHighlightedPart() && can_move) { @@ -315,9 +315,9 @@ void LLToolCompTranslate::pickCallback(const LLPickInfo& pick_info) } } -BOOL LLToolCompTranslate::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLToolCompTranslate::handleMouseUp(S32 x, S32 y, MASK mask) { - mMouseDown = FALSE; + mMouseDown = false; return LLToolComposite::handleMouseUp(x, y, mask); } @@ -334,14 +334,14 @@ LLTool* LLToolCompTranslate::getOverrideTool(MASK mask) return LLToolComposite::getOverrideTool(mask); } -BOOL LLToolCompTranslate::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLToolCompTranslate::handleDoubleClick(S32 x, S32 y, MASK mask) { if (mManip->getSelection()->isEmpty() && mManip->getHighlightedPart() == LLManip::LL_NO_PART) { // You should already have an object selected from the mousedown. // If so, show its properties LLFloaterReg::showInstance("build", "Content"); - return TRUE; + return true; } // Nothing selected means the first mouse click was probably // bad, so try again. @@ -382,7 +382,7 @@ LLToolCompScale::~LLToolCompScale() delete mSelectRect; } -BOOL LLToolCompScale::handleHover(S32 x, S32 y, MASK mask) +bool LLToolCompScale::handleHover(S32 x, S32 y, MASK mask) { if( !mCur->hasMouseCapture() ) { @@ -392,11 +392,11 @@ BOOL LLToolCompScale::handleHover(S32 x, S32 y, MASK mask) } -BOOL LLToolCompScale::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLToolCompScale::handleMouseDown(S32 x, S32 y, MASK mask) { - mMouseDown = TRUE; + mMouseDown = true; gViewerWindow->pickAsync(x, y, mask, pickCallback); - return TRUE; + return true; } void LLToolCompScale::pickCallback(const LLPickInfo& pick_info) @@ -407,7 +407,7 @@ void LLToolCompScale::pickCallback(const LLPickInfo& pick_info) if (!LLToolCompScale::getInstance()->mMouseDown) { // fast click on object, but mouse is already up...just do select - LLToolCompScale::getInstance()->mSelectRect->handleObjectSelection(pick_info, gSavedSettings.getBOOL("EditLinkedParts"), FALSE); + LLToolCompScale::getInstance()->mSelectRect->handleObjectSelection(pick_info, gSavedSettings.getBOOL("EditLinkedParts"), false); return; } @@ -436,9 +436,9 @@ void LLToolCompScale::pickCallback(const LLPickInfo& pick_info) } } -BOOL LLToolCompScale::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLToolCompScale::handleMouseUp(S32 x, S32 y, MASK mask) { - mMouseDown = FALSE; + mMouseDown = false; return LLToolComposite::handleMouseUp(x, y, mask); } @@ -453,14 +453,14 @@ LLTool* LLToolCompScale::getOverrideTool(MASK mask) } -BOOL LLToolCompScale::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLToolCompScale::handleDoubleClick(S32 x, S32 y, MASK mask) { if (!mManip->getSelection()->isEmpty() && mManip->getHighlightedPart() == LLManip::LL_NO_PART) { // You should already have an object selected from the mousedown. // If so, show its properties LLFloaterReg::showInstance("build", "Content"); - return TRUE; + return true; } else { @@ -493,7 +493,7 @@ LLToolCompCreate::LLToolCompCreate() mCur = mPlacer; mDefault = mPlacer; - mObjectPlacedOnMouseDown = FALSE; + mObjectPlacedOnMouseDown = false; } @@ -504,15 +504,15 @@ LLToolCompCreate::~LLToolCompCreate() } -BOOL LLToolCompCreate::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLToolCompCreate::handleMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; - mMouseDown = TRUE; + bool handled = false; + mMouseDown = true; if ( (mask == MASK_SHIFT) || (mask == MASK_CONTROL) ) { gViewerWindow->pickAsync(x, y, mask, pickCallback); - handled = TRUE; + handled = true; } else { @@ -520,7 +520,7 @@ BOOL LLToolCompCreate::handleMouseDown(S32 x, S32 y, MASK mask) handled = mPlacer->placeObject( x, y, mask ); } - mObjectPlacedOnMouseDown = TRUE; + mObjectPlacedOnMouseDown = true; return handled; } @@ -536,14 +536,14 @@ void LLToolCompCreate::pickCallback(const LLPickInfo& pick_info) LLToolCompCreate::getInstance()->mSelectRect->handlePick( pick_info ); } -BOOL LLToolCompCreate::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLToolCompCreate::handleDoubleClick(S32 x, S32 y, MASK mask) { return handleMouseDown(x, y, mask); } -BOOL LLToolCompCreate::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLToolCompCreate::handleMouseUp(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; if ( mMouseDown && !mObjectPlacedOnMouseDown && !(mask == MASK_SHIFT) && !(mask == MASK_CONTROL) ) { @@ -551,8 +551,8 @@ BOOL LLToolCompCreate::handleMouseUp(S32 x, S32 y, MASK mask) handled = mPlacer->placeObject( x, y, mask ); } - mObjectPlacedOnMouseDown = FALSE; - mMouseDown = FALSE; + mObjectPlacedOnMouseDown = false; + mMouseDown = false; if (!handled) { @@ -582,7 +582,7 @@ LLToolCompRotate::~LLToolCompRotate() delete mSelectRect; } -BOOL LLToolCompRotate::handleHover(S32 x, S32 y, MASK mask) +bool LLToolCompRotate::handleHover(S32 x, S32 y, MASK mask) { if( !mCur->hasMouseCapture() ) { @@ -592,11 +592,11 @@ BOOL LLToolCompRotate::handleHover(S32 x, S32 y, MASK mask) } -BOOL LLToolCompRotate::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLToolCompRotate::handleMouseDown(S32 x, S32 y, MASK mask) { - mMouseDown = TRUE; + mMouseDown = true; gViewerWindow->pickAsync(x, y, mask, pickCallback); - return TRUE; + return true; } void LLToolCompRotate::pickCallback(const LLPickInfo& pick_info) @@ -607,7 +607,7 @@ void LLToolCompRotate::pickCallback(const LLPickInfo& pick_info) if (!LLToolCompRotate::getInstance()->mMouseDown) { // fast click on object, but mouse is already up...just do select - LLToolCompRotate::getInstance()->mSelectRect->handleObjectSelection(pick_info, gSavedSettings.getBOOL("EditLinkedParts"), FALSE); + LLToolCompRotate::getInstance()->mSelectRect->handleObjectSelection(pick_info, gSavedSettings.getBOOL("EditLinkedParts"), false); return; } @@ -635,9 +635,9 @@ void LLToolCompRotate::pickCallback(const LLPickInfo& pick_info) } } -BOOL LLToolCompRotate::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLToolCompRotate::handleMouseUp(S32 x, S32 y, MASK mask) { - mMouseDown = FALSE; + mMouseDown = false; return LLToolComposite::handleMouseUp(x, y, mask); } @@ -650,14 +650,14 @@ LLTool* LLToolCompRotate::getOverrideTool(MASK mask) return LLToolComposite::getOverrideTool(mask); } -BOOL LLToolCompRotate::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLToolCompRotate::handleDoubleClick(S32 x, S32 y, MASK mask) { if (!mManip->getSelection()->isEmpty() && mManip->getHighlightedPart() == LLManip::LL_NO_PART) { // You should already have an object selected from the mousedown. // If so, show its properties LLFloaterReg::showInstance("build", "Content"); - return TRUE; + return true; } else { @@ -708,7 +708,7 @@ LLToolCompGun::~LLToolCompGun() mNull = NULL; } -BOOL LLToolCompGun::handleHover(S32 x, S32 y, MASK mask) +bool LLToolCompGun::handleHover(S32 x, S32 y, MASK mask) { // *NOTE: This hack is here to make mouselook kick in again after // item selected from context menu. @@ -736,21 +736,21 @@ BOOL LLToolCompGun::handleHover(S32 x, S32 y, MASK mask) else if ( mCur == mGrab && !(mask & MASK_ALT) ) { setCurrentTool( (LLTool*) mGun ); - setMouseCapture(TRUE); + setMouseCapture(true); } } - return TRUE; + return true; } -BOOL LLToolCompGun::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLToolCompGun::handleMouseDown(S32 x, S32 y, MASK mask) { // if the left button is grabbed, don't put up the pie menu if (gAgent.leftButtonGrabbed() && gViewerInput.isLMouseHandlingDefault(MODE_FIRST_PERSON)) { gAgent.setControlFlags(AGENT_CONTROL_ML_LBUTTON_DOWN); - return FALSE; + return false; } // On mousedown, start grabbing @@ -761,13 +761,13 @@ BOOL LLToolCompGun::handleMouseDown(S32 x, S32 y, MASK mask) } -BOOL LLToolCompGun::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLToolCompGun::handleDoubleClick(S32 x, S32 y, MASK mask) { // if the left button is grabbed, don't put up the pie menu if (gAgent.leftButtonGrabbed() && gViewerInput.isLMouseHandlingDefault(MODE_FIRST_PERSON)) { gAgent.setControlFlags(AGENT_CONTROL_ML_LBUTTON_DOWN); - return FALSE; + return false; } // On mousedown, start grabbing @@ -778,7 +778,7 @@ BOOL LLToolCompGun::handleDoubleClick(S32 x, S32 y, MASK mask) } -BOOL LLToolCompGun::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLToolCompGun::handleRightMouseDown(S32 x, S32 y, MASK mask) { /* JC - suppress context menu 8/29/2002 @@ -786,24 +786,24 @@ BOOL LLToolCompGun::handleRightMouseDown(S32 x, S32 y, MASK mask) // make the build menu appear. setCurrentTool( (LLTool*) mNull ); - // This should return FALSE, meaning the context menu will + // This should return false, meaning the context menu will // be shown. - return FALSE; + return false; */ // Returning true will suppress the context menu - return TRUE; + return true; } -BOOL LLToolCompGun::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLToolCompGun::handleMouseUp(S32 x, S32 y, MASK mask) { if (gViewerInput.isLMouseHandlingDefault(MODE_FIRST_PERSON)) { gAgent.setControlFlags(AGENT_CONTROL_ML_LBUTTON_UP); } setCurrentTool( (LLTool*) mGun ); - return TRUE; + return true; } void LLToolCompGun::onMouseCaptureLost() @@ -819,22 +819,22 @@ void LLToolCompGun::onMouseCaptureLost() void LLToolCompGun::handleSelect() { LLToolComposite::handleSelect(); - setMouseCapture(TRUE); + setMouseCapture(true); } void LLToolCompGun::handleDeselect() { LLToolComposite::handleDeselect(); - setMouseCapture(FALSE); + setMouseCapture(false); } -BOOL LLToolCompGun::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLToolCompGun::handleScrollWheel(S32 x, S32 y, S32 clicks) { if (clicks > 0) { gAgentCamera.changeCameraToDefault(); } - return TRUE; + return true; } diff --git a/indra/newview/lltoolcomp.h b/indra/newview/lltoolcomp.h index 2ed8d73f41..4b945967d1 100644 --- a/indra/newview/lltoolcomp.h +++ b/indra/newview/lltoolcomp.h @@ -45,21 +45,21 @@ class LLToolComposite : public LLTool public: LLToolComposite(const std::string& name); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) = 0; // Sets the current tool - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); // Returns to the default tool - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) = 0; + virtual bool handleMouseDown(S32 x, S32 y, MASK mask) = 0; // Sets the current tool + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); // Returns to the default tool + virtual bool handleDoubleClick(S32 x, S32 y, MASK mask) = 0; // Map virtual functions to the currently active internal tool - virtual BOOL handleHover(S32 x, S32 y, MASK mask) { return mCur->handleHover( x, y, mask ); } - virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) { return mCur->handleScrollWheel( x, y, clicks ); } - virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) { return mCur->handleRightMouseDown( x, y, mask ); } + virtual bool handleHover(S32 x, S32 y, MASK mask) { return mCur->handleHover( x, y, mask ); } + virtual bool handleScrollWheel(S32 x, S32 y, S32 clicks) { return mCur->handleScrollWheel( x, y, clicks ); } + virtual bool handleRightMouseDown(S32 x, S32 y, MASK mask) { return mCur->handleRightMouseDown( x, y, mask ); } virtual LLViewerObject* getEditingObject() { return mCur->getEditingObject(); } virtual LLVector3d getEditingPointGlobal() { return mCur->getEditingPointGlobal(); } - virtual BOOL isEditing() { return mCur->isEditing(); } + virtual bool isEditing() { return mCur->isEditing(); } virtual void stopEditing() { mCur->stopEditing(); mCur = mDefault; } - virtual BOOL clipMouseWhenDown() { return mCur->clipMouseWhenDown(); } + virtual bool clipMouseWhenDown() { return mCur->clipMouseWhenDown(); } virtual void handleSelect(); virtual void handleDeselect(); @@ -67,7 +67,7 @@ public: virtual void render() { mCur->render(); } virtual void draw() { mCur->draw(); } - virtual BOOL handleKey(KEY key, MASK mask) { return mCur->handleKey( key, mask ); } + virtual bool handleKey(KEY key, MASK mask) { return mCur->handleKey( key, mask ); } virtual void onMouseCaptureLost(); @@ -77,7 +77,7 @@ public: virtual void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const { mCur->localPointToScreen(local_x, local_y, screen_x, screen_y); } - BOOL isSelecting(); + bool isSelecting(); LLTool* getCurrentTool() { return mCur; } protected: @@ -88,8 +88,8 @@ protected: protected: LLTool* mCur; // The tool to which we're delegating. LLTool* mDefault; - BOOL mSelected; - BOOL mMouseDown; + bool mSelected; + bool mMouseDown; LLManip* mManip; LLToolSelectRect* mSelectRect; @@ -108,19 +108,19 @@ class LLToolCompInspect : public LLToolComposite, public LLSingleton<LLToolCompI public: // Overridden from LLToolComposite - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override; - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override; - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override; - virtual BOOL handleKey(KEY key, MASK mask) override; + virtual bool handleMouseDown(S32 x, S32 y, MASK mask) override; + virtual bool handleMouseUp(S32 x, S32 y, MASK mask) override; + virtual bool handleDoubleClick(S32 x, S32 y, MASK mask) override; + virtual bool handleKey(KEY key, MASK mask) override; virtual void onMouseCaptureLost() override; void keyUp(KEY key, MASK mask); static void pickCallback(const LLPickInfo& pick_info); - BOOL isToolCameraActive() const { return mIsToolCameraActive; } + bool isToolCameraActive() const { return mIsToolCameraActive; } private: - BOOL mIsToolCameraActive; + bool mIsToolCameraActive; }; //----------------------------------------------------------------------- @@ -133,10 +133,10 @@ class LLToolCompTranslate : public LLToolComposite, public LLSingleton<LLToolCom public: // Overridden from LLToolComposite - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override; - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override; - virtual BOOL handleHover(S32 x, S32 y, MASK mask) override; - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override; // Returns to the default tool + virtual bool handleMouseDown(S32 x, S32 y, MASK mask) override; + virtual bool handleDoubleClick(S32 x, S32 y, MASK mask) override; + virtual bool handleHover(S32 x, S32 y, MASK mask) override; + virtual bool handleMouseUp(S32 x, S32 y, MASK mask) override; // Returns to the default tool virtual void render() override; virtual LLTool* getOverrideTool(MASK mask) override; @@ -154,10 +154,10 @@ class LLToolCompScale : public LLToolComposite, public LLSingleton<LLToolCompSca public: // Overridden from LLToolComposite - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override; - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override; - virtual BOOL handleHover(S32 x, S32 y, MASK mask) override; - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override; // Returns to the default tool + virtual bool handleMouseDown(S32 x, S32 y, MASK mask) override; + virtual bool handleDoubleClick(S32 x, S32 y, MASK mask) override; + virtual bool handleHover(S32 x, S32 y, MASK mask) override; + virtual bool handleMouseUp(S32 x, S32 y, MASK mask) override; // Returns to the default tool virtual void render() override; virtual LLTool* getOverrideTool(MASK mask) override; @@ -176,10 +176,10 @@ class LLToolCompRotate : public LLToolComposite, public LLSingleton<LLToolCompRo public: // Overridden from LLToolComposite - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override; - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override; - virtual BOOL handleHover(S32 x, S32 y, MASK mask) override; - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override; + virtual bool handleMouseDown(S32 x, S32 y, MASK mask) override; + virtual bool handleDoubleClick(S32 x, S32 y, MASK mask) override; + virtual bool handleHover(S32 x, S32 y, MASK mask) override; + virtual bool handleMouseUp(S32 x, S32 y, MASK mask) override; virtual void render() override; virtual LLTool* getOverrideTool(MASK mask) override; @@ -199,14 +199,14 @@ class LLToolCompCreate : public LLToolComposite, public LLSingleton<LLToolCompCr public: // Overridden from LLToolComposite - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override; - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override; - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override; + virtual bool handleMouseDown(S32 x, S32 y, MASK mask) override; + virtual bool handleDoubleClick(S32 x, S32 y, MASK mask) override; + virtual bool handleMouseUp(S32 x, S32 y, MASK mask) override; static void pickCallback(const LLPickInfo& pick_info); protected: LLToolPlacer* mPlacer; - BOOL mObjectPlacedOnMouseDown; + bool mObjectPlacedOnMouseDown; }; @@ -224,12 +224,12 @@ class LLToolCompGun : public LLToolComposite, public LLSingleton<LLToolCompGun> public: // Overridden from LLToolComposite - virtual BOOL handleHover(S32 x, S32 y, MASK mask) override; - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override; - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override; - virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) override; - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override; - virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) override; + virtual bool handleHover(S32 x, S32 y, MASK mask) override; + virtual bool handleMouseDown(S32 x, S32 y, MASK mask) override; + virtual bool handleDoubleClick(S32 x, S32 y, MASK mask) override; + virtual bool handleRightMouseDown(S32 x, S32 y, MASK mask) override; + virtual bool handleMouseUp(S32 x, S32 y, MASK mask) override; + virtual bool handleScrollWheel(S32 x, S32 y, S32 clicks) override; virtual void onMouseCaptureLost() override; virtual void handleSelect() override; virtual void handleDeselect() override; diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index abf9748db3..6d0704a469 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -47,6 +47,7 @@ #include "llinventorybridge.h" #include "llinventorydefines.h" #include "llinventoryfunctions.h" +#include "llinventorymodelbackgroundfetch.h" #include "llpreviewnotecard.h" #include "llrootview.h" #include "llselectmgr.h" @@ -102,7 +103,7 @@ public: class LLDroppableItem : public LLInventoryCollectFunctor { public: - LLDroppableItem(BOOL is_transfer) : + LLDroppableItem(bool is_transfer) : mCountLosing(0), mIsTransfer(is_transfer) {} virtual ~LLDroppableItem() {} virtual bool operator()(LLInventoryCategory* cat, @@ -111,7 +112,7 @@ public: protected: S32 mCountLosing; - BOOL mIsTransfer; + bool mIsTransfer; }; bool LLDroppableItem::operator()(LLInventoryCategory* cat, @@ -287,7 +288,7 @@ LLToolDragAndDrop::LLToolDragAndDrop() mSource(SOURCE_AGENT), mCursor(UI_CURSOR_NO), mLastAccept(ACCEPT_NO), - mDrop(FALSE), + mDrop(false), mCurItemIndex(0) { @@ -299,7 +300,7 @@ void LLToolDragAndDrop::setDragStart(S32 x, S32 y) mDragStartY = y; } -BOOL LLToolDragAndDrop::isOverThreshold(S32 x,S32 y) +bool LLToolDragAndDrop::isOverThreshold(S32 x,S32 y) { S32 mouse_delta_x = x - mDragStartX; S32 mouse_delta_y = y - mDragStartY; @@ -318,6 +319,16 @@ void LLToolDragAndDrop::beginDrag(EDragAndDropType type, LL_WARNS() << "Attempted to start drag without a cargo type" << LL_ENDL; return; } + + if (type != DAD_CATEGORY) + { + LLViewerInventoryItem* item = gInventory.getItem(cargo_id); + if (item && !item->isFinished()) + { + LLInventoryModelBackgroundFetch::instance().start(item->getUUID(), false); + } + } + mCargoTypes.clear(); mCargoTypes.push_back(type); mCargoIDs.clear(); @@ -326,7 +337,7 @@ void LLToolDragAndDrop::beginDrag(EDragAndDropType type, mSourceID = source_id; mObjectID = object_id; - setMouseCapture( TRUE ); + setMouseCapture( true ); LLToolMgr::getInstance()->setTransientTool( this ); mCursor = UI_CURSOR_NO; if ((mCargoTypes[0] == DAD_CATEGORY) @@ -352,16 +363,13 @@ void LLToolDragAndDrop::beginDrag(EDragAndDropType type, items, LLInventoryModel::EXCLUDE_TRASH, is_not_preferred); - S32 count = cats.size(); - S32 i; - for(i = 0; i < count; ++i) + for (auto& cat : cats) { - folder_ids.push_back(cats.at(i)->getUUID()); + folder_ids.emplace_back(cat->getUUID()); } - count = items.size(); - for(i = 0; i < count; ++i) + for (auto& item : items) { - item_ids.push_back(items.at(i)->getUUID()); + item_ids.emplace_back(item->getUUID()); } if (!folder_ids.empty() || !item_ids.empty()) { @@ -396,16 +404,16 @@ void LLToolDragAndDrop::beginMultiDrag( mSource = source; mSourceID = source_id; - setMouseCapture( TRUE ); + setMouseCapture( true ); LLToolMgr::getInstance()->setTransientTool( this ); mCursor = UI_CURSOR_NO; if ((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY)) { // find categories (i.e. inventory folders) in the cargo. LLInventoryCategory* cat = NULL; - S32 count = llmin(cargo_ids.size(), types.size()); - std::set<LLUUID> cat_ids; - for(S32 i = 0; i < count; ++i) + auto count = llmin(cargo_ids.size(), types.size()); + uuid_set_t cat_ids; + for (size_t i = 0; i < count; ++i) { cat = gInventory.getCategory(cargo_ids[i]); if (cat) @@ -423,10 +431,9 @@ void LLToolDragAndDrop::beginMultiDrag( items, LLInventoryModel::EXCLUDE_TRASH, is_not_preferred); - S32 cat_count = cats.size(); - for(S32 i = 0; i < cat_count; ++i) + for (auto& cat : cats) { - cat_ids.insert(cat->getUUID()); + cat_ids.emplace(cat->getUUID()); } } } @@ -445,7 +452,7 @@ void LLToolDragAndDrop::endDrag() { mEndDragSignal(); LLSelectMgr::getInstance()->unhighlightAll(); - setMouseCapture(FALSE); + setMouseCapture(false); } void LLToolDragAndDrop::onMouseCaptureLost() @@ -460,15 +467,15 @@ void LLToolDragAndDrop::onMouseCaptureLost() mCustomMsg.clear(); } -BOOL LLToolDragAndDrop::handleMouseUp( S32 x, S32 y, MASK mask ) +bool LLToolDragAndDrop::handleMouseUp( S32 x, S32 y, MASK mask ) { if (hasMouseCapture()) { EAcceptance acceptance = ACCEPT_NO; - dragOrDrop( x, y, mask, TRUE, &acceptance ); + dragOrDrop( x, y, mask, true, &acceptance ); endDrag(); } - return TRUE; + return true; } ECursorType LLToolDragAndDrop::acceptanceToCursor( EAcceptance acceptance ) @@ -535,48 +542,47 @@ ECursorType LLToolDragAndDrop::acceptanceToCursor( EAcceptance acceptance ) case ACCEPT_POSTPONED: break; default: - llassert( FALSE ); + llassert( false ); } return mCursor; } -BOOL LLToolDragAndDrop::handleHover( S32 x, S32 y, MASK mask ) +bool LLToolDragAndDrop::handleHover( S32 x, S32 y, MASK mask ) { EAcceptance acceptance = ACCEPT_NO; - dragOrDrop( x, y, mask, FALSE, &acceptance ); + dragOrDrop( x, y, mask, false, &acceptance ); ECursorType cursor = acceptanceToCursor(acceptance); gViewerWindow->getWindow()->setCursor( cursor ); LL_DEBUGS("UserInput") << "hover handled by LLToolDragAndDrop" << LL_ENDL; - return TRUE; + return true; } -BOOL LLToolDragAndDrop::handleKey(KEY key, MASK mask) +bool LLToolDragAndDrop::handleKey(KEY key, MASK mask) { if (key == KEY_ESCAPE) { // cancel drag and drop operation endDrag(); - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLToolDragAndDrop::handleToolTip(S32 x, S32 y, MASK mask) +bool LLToolDragAndDrop::handleToolTip(S32 x, S32 y, MASK mask) { - const F32 DRAG_N_DROP_TOOLTIP_DELAY = 0.10000000149f; if (!mToolTipMsg.empty()) { LLToolTipMgr::instance().unblockToolTips(); LLToolTipMgr::instance().show(LLToolTip::Params() .message(mToolTipMsg) - .delay_time(DRAG_N_DROP_TOOLTIP_DELAY)); - return TRUE; + .delay_time(gSavedSettings.getF32( "DragAndDropToolTipDelay" ))); + return true; } - return FALSE; + return false; } void LLToolDragAndDrop::handleDeselect() @@ -588,12 +594,12 @@ void LLToolDragAndDrop::handleDeselect() } // protected -void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop, +void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, bool drop, EAcceptance* acceptance) { *acceptance = ACCEPT_YES_MULTI; - BOOL handled = FALSE; + bool handled = false; LLView* top_view = gFocusMgr.getTopCtrl(); LLViewerInventoryItem* item; @@ -613,7 +619,7 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop, if (top_view) { - handled = TRUE; + handled = true; for (mCurItemIndex = 0; mCurItemIndex < (S32)mCargoIDs.size(); mCurItemIndex++) { @@ -624,7 +630,7 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop, LLInventoryObject* cargo = locateInventory(item, cat); if (cargo) { - handled = handled && top_view->handleDragAndDrop(local_x, local_y, mask, FALSE, + handled = handled && top_view->handleDragAndDrop(local_x, local_y, mask, false, mCargoTypes[mCurItemIndex], (void*)cargo, &item_acceptance, @@ -632,7 +638,7 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop, } else if (is_uuid_dragged) { - handled = handled && top_view->handleDragAndDrop(local_x, local_y, mask, FALSE, + handled = handled && top_view->handleDragAndDrop(local_x, local_y, mask, false, mCargoTypes[mCurItemIndex], (void*)&mCargoIDs[mCurItemIndex], &item_acceptance, @@ -665,7 +671,7 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop, LLInventoryObject* cargo = locateInventory(item, cat); if (cargo) { - handled = handled && top_view->handleDragAndDrop(local_x, local_y, mask, TRUE, + handled = handled && top_view->handleDragAndDrop(local_x, local_y, mask, true, mCargoTypes[mCurItemIndex], (void*)cargo, &item_acceptance, @@ -673,7 +679,7 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop, } else if (is_uuid_dragged) { - handled = handled && top_view->handleDragAndDrop(local_x, local_y, mask, FALSE, + handled = handled && top_view->handleDragAndDrop(local_x, local_y, mask, false, mCargoTypes[mCurItemIndex], (void*)&mCargoIDs[mCurItemIndex], &item_acceptance, @@ -689,7 +695,7 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop, if (!handled) { - handled = TRUE; + handled = true; LLRootView* root_view = gViewerWindow->getRootView(); @@ -702,7 +708,7 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop, // fix for EXT-3191 if (cargo) { - handled = handled && root_view->handleDragAndDrop(x, y, mask, FALSE, + handled = handled && root_view->handleDragAndDrop(x, y, mask, false, mCargoTypes[mCurItemIndex], (void*)cargo, &item_acceptance, @@ -710,7 +716,7 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop, } else if (is_uuid_dragged) { - handled = handled && root_view->handleDragAndDrop(x, y, mask, FALSE, + handled = handled && root_view->handleDragAndDrop(x, y, mask, false, mCargoTypes[mCurItemIndex], (void*)&mCargoIDs[mCurItemIndex], &item_acceptance, @@ -740,7 +746,7 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop, LLInventoryObject* cargo = locateInventory(item, cat); if (cargo) { - handled = handled && root_view->handleDragAndDrop(x, y, mask, TRUE, + handled = handled && root_view->handleDragAndDrop(x, y, mask, true, mCargoTypes[mCurItemIndex], (void*)cargo, &item_acceptance, @@ -748,7 +754,7 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop, } else if (is_uuid_dragged) { - handled = handled && root_view->handleDragAndDrop(x, y, mask, TRUE, + handled = handled && root_view->handleDragAndDrop(x, y, mask, true, mCargoTypes[mCurItemIndex], (void*)&mCargoIDs[mCurItemIndex], &item_acceptance, @@ -784,18 +790,18 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop, } } -void LLToolDragAndDrop::dragOrDrop3D( S32 x, S32 y, MASK mask, BOOL drop, EAcceptance* acceptance ) +void LLToolDragAndDrop::dragOrDrop3D( S32 x, S32 y, MASK mask, bool drop, EAcceptance* acceptance ) { mDrop = drop; if (mDrop) { // don't allow drag and drop onto rigged or transparent objects - pick(gViewerWindow->pickImmediate(x, y, FALSE, FALSE)); + pick(gViewerWindow->pickImmediate(x, y, false, false)); } else { // don't allow drag and drop onto transparent objects - gViewerWindow->pickAsync(x, y, mask, pickCallback, FALSE, FALSE); + gViewerWindow->pickAsync(x, y, mask, pickCallback, false, false); } *acceptance = mLastAccept; @@ -878,7 +884,7 @@ void LLToolDragAndDrop::pick(const LLPickInfo& pick_info) (U32)mLastAccept, (U32)callMemberFunction(*this, LLDragAndDropDictionary::instance().get(dad_type, target)) - (hit_obj, hit_face, pick_info.mKeyMask, FALSE)); + (hit_obj, hit_face, pick_info.mKeyMask, false)); } if (mDrop && ((U32)mLastAccept >= ACCEPT_YES_COPY_SINGLE)) @@ -893,7 +899,7 @@ void LLToolDragAndDrop::pick(const LLPickInfo& pick_info) const EDragAndDropType dad_type = mCargoTypes[item_index]; // Call the right implementation function callMemberFunction(*this, LLDragAndDropDictionary::instance().get(dad_type, target)) - (hit_obj, hit_face, pick_info.mKeyMask, TRUE); + (hit_obj, hit_face, pick_info.mKeyMask, true); } } else @@ -924,12 +930,12 @@ void LLToolDragAndDrop::pick(const LLPickInfo& pick_info) } // static -BOOL LLToolDragAndDrop::handleDropMaterialProtections(LLViewerObject* hit_obj, +bool LLToolDragAndDrop::handleDropMaterialProtections(LLViewerObject* hit_obj, LLInventoryItem* item, LLToolDragAndDrop::ESource source, const LLUUID& src_id) { - if (!item) return FALSE; + if (!item) return false; // Always succeed if.... // material is from the library @@ -937,7 +943,7 @@ BOOL LLToolDragAndDrop::handleDropMaterialProtections(LLViewerObject* hit_obj, if (SOURCE_LIBRARY == source) { // dropping a material from the library always just works. - return TRUE; + return true; } // In case the inventory has not been loaded (e.g. due to some recent operation @@ -958,7 +964,7 @@ BOOL LLToolDragAndDrop::handleDropMaterialProtections(LLViewerObject* hit_obj, args["ERROR_MESSAGE"] = "Unable to add texture.\nPlease wait a few seconds and try again."; } LLNotificationsUtil::add("ErrorMessage", args); - return FALSE; + return false; } // Make sure to verify both id and type since 'null' // is a shared default for some asset types. @@ -968,7 +974,7 @@ BOOL LLToolDragAndDrop::handleDropMaterialProtections(LLViewerObject* hit_obj, // then it can always be added to a side. // This saves some work if the task's inventory is already loaded // and ensures that the asset item is only added once. - return TRUE; + return true; } LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); @@ -977,7 +983,7 @@ BOOL LLToolDragAndDrop::handleDropMaterialProtections(LLViewerObject* hit_obj, // Check that we can add the material as inventory to the object if (willObjectAcceptInventory(hit_obj,item) < ACCEPT_YES_COPY_SINGLE ) { - return FALSE; + return false; } // make sure the object has the material in it's inventory. if (SOURCE_AGENT == source) @@ -1000,7 +1006,7 @@ BOOL LLToolDragAndDrop::handleDropMaterialProtections(LLViewerObject* hit_obj, else { LL_WARNS() << "Unable to find source object." << LL_ENDL; - return FALSE; + return false; } } // Add the asset item to the target object's inventory. @@ -1026,7 +1032,7 @@ BOOL LLToolDragAndDrop::handleDropMaterialProtections(LLViewerObject* hit_obj, // Check that we can add the asset as inventory to the object if (willObjectAcceptInventory(hit_obj,item) < ACCEPT_YES_COPY_SINGLE ) { - return FALSE; + return false; } // *FIX: may want to make sure agent can paint hit_obj. @@ -1053,7 +1059,7 @@ BOOL LLToolDragAndDrop::handleDropMaterialProtections(LLViewerObject* hit_obj, // Check that we can add the material as inventory to the object if (willObjectAcceptInventory(hit_obj,item) < ACCEPT_YES_COPY_SINGLE ) { - return FALSE; + return false; } // *FIX: may want to make sure agent can paint hit_obj. @@ -1067,7 +1073,7 @@ BOOL LLToolDragAndDrop::handleDropMaterialProtections(LLViewerObject* hit_obj, // we should return false here. This will requre a separate listener // since without listener, we have no way to receive update } - return TRUE; + return true; } void set_texture_to_material(LLViewerObject* hit_obj, @@ -1167,7 +1173,7 @@ void LLToolDragAndDrop::dropTextureAllFaces(LLViewerObject* hit_obj, if (has_non_pbr_faces || remove_pbr) { - BOOL res = handleDropMaterialProtections(hit_obj, item, source, src_id); + bool res = handleDropMaterialProtections(hit_obj, item, source, src_id); if (!res) { return; @@ -1272,7 +1278,7 @@ void LLToolDragAndDrop::dropMaterialOneFace(LLViewerObject* hit_obj, // SL-20013 must save asset_id before handleDropMaterialProtections since our item instance // may be deleted if it is moved into task inventory LLUUID asset_id = item->getAssetUUID(); - BOOL success = handleDropMaterialProtections(hit_obj, item, source, src_id); + bool success = handleDropMaterialProtections(hit_obj, item, source, src_id); if (!success) { return; @@ -1307,7 +1313,7 @@ void LLToolDragAndDrop::dropMaterialAllFaces(LLViewerObject* hit_obj, // SL-20013 must save asset_id before handleDropMaterialProtections since our item instance // may be deleted if it is moved into task inventory LLUUID asset_id = item->getAssetUUID(); - BOOL success = handleDropMaterialProtections(hit_obj, item, source, src_id); + bool success = handleDropMaterialProtections(hit_obj, item, source, src_id); if (!success) { @@ -1338,7 +1344,7 @@ void LLToolDragAndDrop::dropMesh(LLViewerObject* hit_obj, return; } LLUUID asset_id = item->getAssetUUID(); - BOOL success = handleDropMaterialProtections(hit_obj, item, source, src_id); + bool success = handleDropMaterialProtections(hit_obj, item, source, src_id); if(!success) { return; @@ -1346,7 +1352,7 @@ void LLToolDragAndDrop::dropMesh(LLViewerObject* hit_obj, LLSculptParams sculpt_params; sculpt_params.setSculptTexture(asset_id, LL_SCULPT_TYPE_MESH); - hit_obj->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt_params, TRUE); + hit_obj->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt_params, true); dialog_refresh_all(); } @@ -1489,7 +1495,7 @@ void LLToolDragAndDrop::dropTextureOneFace(LLViewerObject* hit_obj, } return; } - BOOL success = handleDropMaterialProtections(hit_obj, item, source, src_id); + bool success = handleDropMaterialProtections(hit_obj, item, source, src_id); if (!success) { return; @@ -1559,7 +1565,7 @@ void LLToolDragAndDrop::dropTextureOneFace(LLViewerObject* hit_obj, void LLToolDragAndDrop::dropScript(LLViewerObject* hit_obj, LLInventoryItem* item, - BOOL active, + bool active, ESource source, const LLUUID& src_id) { @@ -1605,7 +1611,7 @@ void LLToolDragAndDrop::dropScript(LLViewerObject* hit_obj, gFloaterTools->dirty(); // VEFFECT: SetScript - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, true); effectp->setSourceObject(gAgentAvatarp); effectp->setTargetObject(hit_obj); effectp->setDuration(LL_HUD_DUR_SHORT); @@ -1614,9 +1620,9 @@ void LLToolDragAndDrop::dropScript(LLViewerObject* hit_obj, } void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target, - BOOL bypass_sim_raycast, - BOOL from_task_inventory, - BOOL remove_from_inventory) + bool bypass_sim_raycast, + bool from_task_inventory, + bool remove_from_inventory) { LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromPosGlobal(mLastHitPos); if (!regionp) @@ -1644,7 +1650,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target, if (!remove_from_inventory && !item->getPermissions().allowCopyBy(gAgent.getID())) { - remove_from_inventory = TRUE; + remove_from_inventory = true; } // Limit raycast to a single object. @@ -1672,7 +1678,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target, LLUUID source_id = from_task_inventory ? mSourceID : LLUUID::null; // Select the object only if we're editing. - BOOL rez_selected = LLToolMgr::getInstance()->inEdit(); + bool rez_selected = LLToolMgr::getInstance()->inEdit(); LLVector3 ray_start = regionp->getPosRegionFromGlobal(mLastCameraPos); @@ -1680,7 +1686,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target, // currently the ray's end point is an approximation, // and is sometimes too short (causing failure.) so we // double the ray's length: - if (bypass_sim_raycast == FALSE) + if (!bypass_sim_raycast) { LLVector3 ray_direction = ray_start - ray_end; ray_end = ray_end - ray_direction; @@ -1715,7 +1721,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target, msg->addVector3Fast(_PREHASH_RayStart, ray_start); msg->addVector3Fast(_PREHASH_RayEnd, ray_end); msg->addUUIDFast(_PREHASH_RayTargetID, ray_target_id ); - msg->addBOOLFast(_PREHASH_RayEndIsIntersection, FALSE); + msg->addBOOLFast(_PREHASH_RayEndIsIntersection, false); msg->addBOOLFast(_PREHASH_RezSelected, rez_selected); msg->addBOOLFast(_PREHASH_RemoveItem, remove_from_inventory); @@ -1767,7 +1773,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target, } // VEFFECT: DropObject - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, true); effectp->setSourceObject(gAgentAvatarp); effectp->setPositionGlobal(mLastHitPos); effectp->setDuration(LL_HUD_DUR_SHORT); @@ -1830,7 +1836,7 @@ void LLToolDragAndDrop::dropInventory(LLViewerObject* hit_obj, } // VEFFECT: AddToInventory - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, true); effectp->setSourceObject(gAgentAvatarp); effectp->setTargetObject(hit_obj); effectp->setDuration(LL_HUD_DUR_SHORT); @@ -1843,7 +1849,9 @@ void LLToolDragAndDrop::dropInventory(LLViewerObject* hit_obj, EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LLInventoryItem* item, EDragAndDropType type) { // check the basics - if (!item || !obj) return ACCEPT_NO; + if (!item || !obj) + return ACCEPT_NO; + // HACK: downcast LLViewerInventoryItem* vitem = (LLViewerInventoryItem*)item; if (!vitem->isFinished() && (type != DAD_CATEGORY)) @@ -1854,36 +1862,37 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL // Library or agent inventory only. return ACCEPT_NO; } - if (vitem->getIsLinkType()) return ACCEPT_NO; // No giving away links + if (vitem->getIsLinkType()) + return ACCEPT_NO; // No giving away links // deny attempts to drop from an object onto itself. This is to // help make sure that drops that are from an object to an object // don't have to worry about order of evaluation. Think of this // like check for self in assignment. - if(obj->getID() == item->getParentUUID()) + if (obj->getID() == item->getParentUUID()) { return ACCEPT_NO; } - //BOOL copy = (perm.allowCopyBy(gAgent.getID(), + //bool copy = (perm.allowCopyBy(gAgent.getID(), // gAgent.getGroupID()) // && (obj->mPermModify || obj->mFlagAllowInventoryAdd)); - BOOL worn = FALSE; + bool worn = false; LLVOAvatarSelf* my_avatar = NULL; - switch(item->getType()) + switch (item->getType()) { case LLAssetType::AT_OBJECT: my_avatar = gAgentAvatarp; if(my_avatar && my_avatar->isWearingAttachment(item->getUUID())) { - worn = TRUE; + worn = true; } break; case LLAssetType::AT_BODYPART: case LLAssetType::AT_CLOTHING: - if(gAgentWearables.isWearingItem(item->getUUID())) + if (gAgentWearables.isWearingItem(item->getUUID())) { - worn = TRUE; + worn = true; } break; case LLAssetType::AT_CALLINGCARD: @@ -1891,33 +1900,37 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL // because of incomplete LSL support. See STORM-1117. return ACCEPT_NO; default: - break; + break; } const LLPermissions& perm = item->getPermissions(); - BOOL modify = (obj->permModify() || obj->flagAllowInventoryAdd()); - BOOL transfer = FALSE; - if((obj->permYouOwner() && (perm.getOwner() == gAgent.getID())) + bool modify = (obj->permModify() || obj->flagAllowInventoryAdd()); + bool transfer = false; + if ((obj->permYouOwner() && (perm.getOwner() == gAgent.getID())) || perm.allowOperationBy(PERM_TRANSFER, gAgent.getID())) { - transfer = TRUE; + transfer = true; } - BOOL volume = (LL_PCODE_VOLUME == obj->getPCode()); - BOOL attached = obj->isAttachment(); - BOOL unrestricted = ((perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) ? TRUE : FALSE; - if(attached && !unrestricted) + bool volume = (LL_PCODE_VOLUME == obj->getPCode()); + bool attached = obj->isAttachment(); + bool unrestricted = (perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED; + + if (attached && !unrestricted) { // Attachments are in world and in inventory simultaneously, // at the moment server doesn't support such a situation. return ACCEPT_NO_LOCKED; } - else if(modify && transfer && volume && !worn) + + if (modify && transfer && volume && !worn) { return ACCEPT_YES_MULTI; } - else if(!modify) + + if (!modify) { return ACCEPT_NO_LOCKED; } + return ACCEPT_NO; } @@ -1938,7 +1951,7 @@ static void give_inventory_cb(const LLSD& notification, const LLSD& response) LLViewerInventoryCategory * inv_cat = gInventory.getCategory(payload["item_id"]); if (NULL == inv_item && NULL == inv_cat) { - llassert( FALSE ); + llassert( false ); return; } bool successfully_shared; @@ -1997,7 +2010,7 @@ static void get_name_cb(const LLUUID& id, // function used as drag-and-drop handler for simple agent give inventory requests //static -bool LLToolDragAndDrop::handleGiveDragAndDrop(LLUUID dest_agent, LLUUID session_id, BOOL drop, +bool LLToolDragAndDrop::handleGiveDragAndDrop(LLUUID dest_agent, LLUUID session_id, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -2075,7 +2088,7 @@ bool LLToolDragAndDrop::handleGiveDragAndDrop(LLUUID dest_agent, LLUUID session_ break; } - return TRUE; + return true; } @@ -2085,14 +2098,14 @@ bool LLToolDragAndDrop::handleGiveDragAndDrop(LLUUID dest_agent, LLUUID session_ /// EAcceptance LLToolDragAndDrop::dad3dNULL( - LLViewerObject*, S32, MASK, BOOL) + LLViewerObject*, S32, MASK, bool) { LL_DEBUGS() << "LLToolDragAndDrop::dad3dNULL()" << LL_ENDL; return ACCEPT_NO; } EAcceptance LLToolDragAndDrop::dad3dRezAttachmentFromInv( - LLViewerObject* obj, S32 face, MASK mask, BOOL drop) + LLViewerObject* obj, S32 face, MASK mask, bool drop) { LL_DEBUGS() << "LLToolDragAndDrop::dad3dRezAttachmentFromInv()" << LL_ENDL; // must be in the user's inventory @@ -2151,7 +2164,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezAttachmentFromInv( EAcceptance LLToolDragAndDrop::dad3dRezObjectOnLand( - LLViewerObject* obj, S32 face, MASK mask, BOOL drop) + LLViewerObject* obj, S32 face, MASK mask, bool drop) { if (mSource == SOURCE_WORLD) { @@ -2171,21 +2184,21 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnLand( } EAcceptance accept; - BOOL remove_inventory; + bool remove_inventory; // Get initial settings based on shift key if (mask & MASK_SHIFT) { // For now, always make copy //accept = ACCEPT_YES_SINGLE; - //remove_inventory = TRUE; + //remove_inventory = true; accept = ACCEPT_YES_COPY_SINGLE; - remove_inventory = FALSE; + remove_inventory = false; } else { accept = ACCEPT_YES_COPY_SINGLE; - remove_inventory = FALSE; + remove_inventory = false; } // check if the item can be copied. If not, send that to the sim @@ -2193,7 +2206,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnLand( if(!item->getPermissions().allowCopyBy(gAgent.getID())) { accept = ACCEPT_YES_SINGLE; - remove_inventory = TRUE; + remove_inventory = true; } // Check if it's in the trash. @@ -2205,14 +2218,14 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnLand( if(drop) { - dropObject(obj, TRUE, FALSE, remove_inventory); + dropObject(obj, true, false, remove_inventory); } return accept; } EAcceptance LLToolDragAndDrop::dad3dRezObjectOnObject( - LLViewerObject* obj, S32 face, MASK mask, BOOL drop) + LLViewerObject* obj, S32 face, MASK mask, bool drop) { // handle objects coming from object inventory if (mSource == SOURCE_WORLD) @@ -2249,20 +2262,20 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnObject( } EAcceptance accept; - BOOL remove_inventory; + bool remove_inventory; if (mask & MASK_SHIFT) { // For now, always make copy //accept = ACCEPT_YES_SINGLE; - //remove_inventory = TRUE; + //remove_inventory = true; accept = ACCEPT_YES_COPY_SINGLE; - remove_inventory = FALSE; + remove_inventory = false; } else { accept = ACCEPT_YES_COPY_SINGLE; - remove_inventory = FALSE; + remove_inventory = false; } // check if the item can be copied. If not, send that to the sim @@ -2270,7 +2283,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnObject( if(!item->getPermissions().allowCopyBy(gAgent.getID())) { accept = ACCEPT_YES_SINGLE; - remove_inventory = TRUE; + remove_inventory = true; } // Check if it's in the trash. @@ -2278,19 +2291,19 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnObject( if(gInventory.isObjectDescendentOf(item->getUUID(), trash_id)) { accept = ACCEPT_YES_SINGLE; - remove_inventory = TRUE; + remove_inventory = true; } if(drop) { - dropObject(obj, FALSE, FALSE, remove_inventory); + dropObject(obj, false, false, remove_inventory); } return accept; } EAcceptance LLToolDragAndDrop::dad3dRezScript( - LLViewerObject* obj, S32 face, MASK mask, BOOL drop) + LLViewerObject* obj, S32 face, MASK mask, bool drop) { LL_DEBUGS() << "LLToolDragAndDrop::dad3dRezScript()" << LL_ENDL; @@ -2310,7 +2323,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezScript( { // rez in the script active by default, rez in inactive if the // control key is being held down. - BOOL active = ((mask & MASK_CONTROL) == 0); + bool active = ((mask & MASK_CONTROL) == 0); LLViewerObject* root_object = obj; if (obj && obj->getParent()) @@ -2328,7 +2341,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezScript( } EAcceptance LLToolDragAndDrop::dad3dApplyToObject( - LLViewerObject* obj, S32 face, MASK mask, BOOL drop, EDragAndDropType cargo_type) + LLViewerObject* obj, S32 face, MASK mask, bool drop, EDragAndDropType cargo_type) { LL_DEBUGS() << "LLToolDragAndDrop::dad3dApplyToObject()" << LL_ENDL; @@ -2447,7 +2460,7 @@ EAcceptance LLToolDragAndDrop::dad3dApplyToObject( } // VEFFECT: SetTexture - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, true); effectp->setSourceObject(gAgentAvatarp); effectp->setTargetObject(obj); effectp->setDuration(LL_HUD_DUR_SHORT); @@ -2460,25 +2473,42 @@ EAcceptance LLToolDragAndDrop::dad3dApplyToObject( EAcceptance LLToolDragAndDrop::dad3dTextureObject( - LLViewerObject* obj, S32 face, MASK mask, BOOL drop) + LLViewerObject* obj, S32 face, MASK mask, bool drop) { return dad3dApplyToObject(obj, face, mask, drop, DAD_TEXTURE); } EAcceptance LLToolDragAndDrop::dad3dMaterialObject( - LLViewerObject* obj, S32 face, MASK mask, BOOL drop) + LLViewerObject* obj, S32 face, MASK mask, bool drop) { return dad3dApplyToObject(obj, face, mask, drop, DAD_MATERIAL); } EAcceptance LLToolDragAndDrop::dad3dMeshObject( - LLViewerObject* obj, S32 face, MASK mask, BOOL drop) + LLViewerObject* obj, S32 face, MASK mask, bool drop) { return dad3dApplyToObject(obj, face, mask, drop, DAD_MESH); } + +/* +EAcceptance LLToolDragAndDrop::dad3dTextureSelf( + LLViewerObject* obj, S32 face, MASK mask, bool drop) +{ + LL_DEBUGS() << "LLToolDragAndDrop::dad3dTextureAvatar()" << LL_ENDL; + if(drop) + { + if( !(mask & MASK_SHIFT) ) + { + dropTextureOneFaceAvatar( (LLVOAvatar*)obj, face, (LLInventoryItem*)mCargoData); + } + } + return (mask & MASK_SHIFT) ? ACCEPT_NO : ACCEPT_YES_SINGLE; +} +*/ + EAcceptance LLToolDragAndDrop::dad3dWearItem( - LLViewerObject* obj, S32 face, MASK mask, BOOL drop) + LLViewerObject* obj, S32 face, MASK mask, bool drop) { LL_DEBUGS() << "LLToolDragAndDrop::dad3dWearItem()" << LL_ENDL; LLViewerInventoryItem* item; @@ -2511,7 +2541,7 @@ EAcceptance LLToolDragAndDrop::dad3dWearItem( } EAcceptance LLToolDragAndDrop::dad3dActivateGesture( - LLViewerObject* obj, S32 face, MASK mask, BOOL drop) + LLViewerObject* obj, S32 face, MASK mask, bool drop) { LL_DEBUGS() << "LLToolDragAndDrop::dad3dActivateGesture()" << LL_ENDL; LLViewerInventoryItem* item; @@ -2560,7 +2590,7 @@ EAcceptance LLToolDragAndDrop::dad3dActivateGesture( } EAcceptance LLToolDragAndDrop::dad3dWearCategory( - LLViewerObject* obj, S32 face, MASK mask, BOOL drop) + LLViewerObject* obj, S32 face, MASK mask, bool drop) { LL_DEBUGS() << "LLToolDragAndDrop::dad3dWearCategory()" << LL_ENDL; LLViewerInventoryItem* item; @@ -2590,46 +2620,46 @@ EAcceptance LLToolDragAndDrop::dad3dWearCategory( return ACCEPT_NO_CUSTOM; } - if(mSource == SOURCE_AGENT) + if (mSource == SOURCE_AGENT) { const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); - if( gInventory.isObjectDescendentOf( category->getUUID(), trash_id ) ) + if (gInventory.isObjectDescendentOf(category->getUUID(), trash_id)) { return ACCEPT_NO; } const LLUUID &outbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX); - if(outbox_id.notNull() && gInventory.isObjectDescendentOf(category->getUUID(), outbox_id)) + if (outbox_id.notNull() && gInventory.isObjectDescendentOf(category->getUUID(), outbox_id)) { // Legacy return ACCEPT_NO; } - if(drop) + if (drop) { - BOOL append = ( (mask & MASK_SHIFT) ? TRUE : FALSE ); - LLAppearanceMgr::instance().wearInventoryCategory(category, false, append); + LLAppearanceMgr::instance().wearInventoryCategory(category, false, mask & MASK_SHIFT); } + return ACCEPT_YES_MULTI; } - else if(mSource == SOURCE_LIBRARY) + + if (mSource == SOURCE_LIBRARY) { - if(drop) + if (drop) { LLAppearanceMgr::instance().wearInventoryCategory(category, true, false); } + return ACCEPT_YES_MULTI; } - else - { - // TODO: copy/move category to avatar's inventory and then wear it. - return ACCEPT_NO; - } + + // TODO: copy/move category to avatar's inventory and then wear it. + return ACCEPT_NO; } EAcceptance LLToolDragAndDrop::dad3dUpdateInventory( - LLViewerObject* obj, S32 face, MASK mask, BOOL drop) + LLViewerObject* obj, S32 face, MASK mask, bool drop) { LL_DEBUGS() << "LLToolDragAndDrop::dadUpdateInventory()" << LL_ENDL; @@ -2643,7 +2673,9 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventory( LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; locateInventory(item, cat); - if (!item || !item->isFinished()) return ACCEPT_NO; + if (!item || !item->isFinished()) + return ACCEPT_NO; + LLViewerObject* root_object = obj; if (obj && obj->getParent()) { @@ -2655,21 +2687,22 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventory( } EAcceptance rv = willObjectAcceptInventory(root_object, item); - if(root_object && drop && (ACCEPT_YES_COPY_SINGLE <= rv)) + if (root_object && drop && (ACCEPT_YES_COPY_SINGLE <= rv)) { dropInventory(root_object, item, mSource, mSourceID); } + return rv; } -BOOL LLToolDragAndDrop::dadUpdateInventory(LLViewerObject* obj, BOOL drop) +bool LLToolDragAndDrop::dadUpdateInventory(LLViewerObject* obj, bool drop) { EAcceptance rv = dad3dUpdateInventory(obj, -1, MASK_NONE, drop); - return (rv >= ACCEPT_YES_COPY_SINGLE); + return rv >= ACCEPT_YES_COPY_SINGLE; } EAcceptance LLToolDragAndDrop::dad3dUpdateInventoryCategory( - LLViewerObject* obj, S32 face, MASK mask, BOOL drop) + LLViewerObject* obj, S32 face, MASK mask, bool drop) { LL_DEBUGS() << "LLToolDragAndDrop::dad3dUpdateInventoryCategory()" << LL_ENDL; if (obj == NULL) @@ -2785,7 +2818,7 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventoryCategory( EAcceptance LLToolDragAndDrop::dad3dRezCategoryOnObject( - LLViewerObject* obj, S32 face, MASK mask, BOOL drop) + LLViewerObject* obj, S32 face, MASK mask, bool drop) { if ((mask & MASK_CONTROL)) { @@ -2798,15 +2831,15 @@ EAcceptance LLToolDragAndDrop::dad3dRezCategoryOnObject( } -BOOL LLToolDragAndDrop::dadUpdateInventoryCategory(LLViewerObject* obj, - BOOL drop) +bool LLToolDragAndDrop::dadUpdateInventoryCategory(LLViewerObject* obj, + bool drop) { EAcceptance rv = dad3dUpdateInventoryCategory(obj, -1, MASK_NONE, drop); return (rv >= ACCEPT_YES_COPY_SINGLE); } EAcceptance LLToolDragAndDrop::dad3dGiveInventoryObject( - LLViewerObject* obj, S32 face, MASK mask, BOOL drop) + LLViewerObject* obj, S32 face, MASK mask, bool drop) { LL_DEBUGS() << "LLToolDragAndDrop::dad3dGiveInventoryObject()" << LL_ENDL; @@ -2844,7 +2877,7 @@ EAcceptance LLToolDragAndDrop::dad3dGiveInventoryObject( EAcceptance LLToolDragAndDrop::dad3dGiveInventory( - LLViewerObject* obj, S32 face, MASK mask, BOOL drop) + LLViewerObject* obj, S32 face, MASK mask, bool drop) { LL_DEBUGS() << "LLToolDragAndDrop::dad3dGiveInventory()" << LL_ENDL; // item has to be in agent inventory. @@ -2867,7 +2900,7 @@ EAcceptance LLToolDragAndDrop::dad3dGiveInventory( } EAcceptance LLToolDragAndDrop::dad3dGiveInventoryCategory( - LLViewerObject* obj, S32 face, MASK mask, BOOL drop) + LLViewerObject* obj, S32 face, MASK mask, bool drop) { LL_DEBUGS() << "LLToolDragAndDrop::dad3dGiveInventoryCategory()" << LL_ENDL; if(drop && obj) @@ -2885,7 +2918,7 @@ EAcceptance LLToolDragAndDrop::dad3dGiveInventoryCategory( EAcceptance LLToolDragAndDrop::dad3dRezFromObjectOnLand( - LLViewerObject* obj, S32 face, MASK mask, BOOL drop) + LLViewerObject* obj, S32 face, MASK mask, bool drop) { LL_DEBUGS() << "LLToolDragAndDrop::dad3dRezFromObjectOnLand()" << LL_ENDL; LLViewerInventoryItem* item = NULL; @@ -2900,13 +2933,13 @@ EAcceptance LLToolDragAndDrop::dad3dRezFromObjectOnLand( } if(drop) { - dropObject(obj, TRUE, TRUE, FALSE); + dropObject(obj, true, true, false); } return ACCEPT_YES_SINGLE; } EAcceptance LLToolDragAndDrop::dad3dRezFromObjectOnObject( - LLViewerObject* obj, S32 face, MASK mask, BOOL drop) + LLViewerObject* obj, S32 face, MASK mask, bool drop) { LL_DEBUGS() << "LLToolDragAndDrop::dad3dRezFromObjectOnObject()" << LL_ENDL; LLViewerInventoryItem* item; @@ -2935,13 +2968,13 @@ EAcceptance LLToolDragAndDrop::dad3dRezFromObjectOnObject( } if(drop) { - dropObject(obj, FALSE, TRUE, FALSE); + dropObject(obj, false, true, false); } return ACCEPT_YES_SINGLE; } EAcceptance LLToolDragAndDrop::dad3dCategoryOnLand( - LLViewerObject *obj, S32 face, MASK mask, BOOL drop) + LLViewerObject *obj, S32 face, MASK mask, bool drop) { return ACCEPT_NO; /* @@ -2979,7 +3012,7 @@ EAcceptance LLToolDragAndDrop::dad3dCategoryOnLand( // This shortcuts alot of steps to make a basic object // w/ an inventory and a special permissions set EAcceptance LLToolDragAndDrop::dad3dAssetOnLand( - LLViewerObject *obj, S32 face, MASK mask, BOOL drop) + LLViewerObject *obj, S32 face, MASK mask, bool drop) { return ACCEPT_NO; /* diff --git a/indra/newview/lltooldraganddrop.h b/indra/newview/lltooldraganddrop.h index 5d10daca4d..ad6402c4ad 100644 --- a/indra/newview/lltooldraganddrop.h +++ b/indra/newview/lltooldraganddrop.h @@ -48,15 +48,15 @@ public: typedef boost::signals2::signal<void ()> enddrag_signal_t; // overridden from LLTool - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override; - virtual BOOL handleHover(S32 x, S32 y, MASK mask) override; - virtual BOOL handleKey(KEY key, MASK mask) override; - virtual BOOL handleToolTip(S32 x, S32 y, MASK mask) override; + virtual bool handleMouseUp(S32 x, S32 y, MASK mask) override; + virtual bool handleHover(S32 x, S32 y, MASK mask) override; + virtual bool handleKey(KEY key, MASK mask) override; + virtual bool handleToolTip(S32 x, S32 y, MASK mask) override; virtual void onMouseCaptureLost() override; virtual void handleDeselect() override; void setDragStart( S32 x, S32 y ); // In screen space - BOOL isOverThreshold( S32 x, S32 y ); // In screen space + bool isOverThreshold( S32 x, S32 y ); // In screen space enum ESource { @@ -87,14 +87,14 @@ public: void setCargoCount(U32 count) { mCargoCount = count; } void resetCargoCount() { mCargoCount = 0; } - U32 getCargoCount() const { return (mCargoCount > 0) ? mCargoCount : mCargoIDs.size(); } + U32 getCargoCount() const { return (mCargoCount > 0) ? mCargoCount : static_cast<S32>(mCargoIDs.size()); } S32 getCargoIndex() const { return mCurItemIndex; } static S32 getOperationId() { return sOperationId; } - // deal with permissions of object, etc. returns TRUE if drop can - // proceed, otherwise FALSE. - static BOOL handleDropMaterialProtections(LLViewerObject* hit_obj, + // deal with permissions of object, etc. returns true if drop can + // proceed, otherwise false. + static bool handleDropMaterialProtections(LLViewerObject* hit_obj, LLInventoryItem* item, LLToolDragAndDrop::ESource source, const LLUUID& src_id); @@ -112,14 +112,14 @@ protected: protected: // dragOrDrop3dImpl points to a member of LLToolDragAndDrop that - // takes parameters (LLViewerObject* obj, S32 face, MASK, BOOL - // drop) and returns a BOOL if drop is ok + // takes parameters (LLViewerObject* obj, S32 face, MASK, bool + // drop) and returns a bool if drop is ok typedef EAcceptance (LLToolDragAndDrop::*dragOrDrop3dImpl) - (LLViewerObject*, S32, MASK, BOOL); + (LLViewerObject*, S32, MASK, bool); - void dragOrDrop(S32 x, S32 y, MASK mask, BOOL drop, + void dragOrDrop(S32 x, S32 y, MASK mask, bool drop, EAcceptance* acceptance); - void dragOrDrop3D(S32 x, S32 y, MASK mask, BOOL drop, + void dragOrDrop3D(S32 x, S32 y, MASK mask, bool drop, EAcceptance* acceptance); static void pickCallback(const LLPickInfo& pick_info); @@ -146,7 +146,7 @@ protected: ECursorType mCursor; EAcceptance mLastAccept; - BOOL mDrop; + bool mDrop; S32 mCurItemIndex; std::string mToolTipMsg; std::string mCustomMsg; @@ -155,57 +155,57 @@ protected: protected: // 3d drop functions. these call down into the static functions - // named drop<ThingToDrop> if drop is TRUE and permissions allow + // named drop<ThingToDrop> if drop is true and permissions allow // that behavior. - EAcceptance dad3dNULL(LLViewerObject*, S32, MASK, BOOL); + EAcceptance dad3dNULL(LLViewerObject*, S32, MASK, bool); EAcceptance dad3dRezObjectOnLand(LLViewerObject* obj, S32 face, - MASK mask, BOOL drop); + MASK mask, bool drop); EAcceptance dad3dRezObjectOnObject(LLViewerObject* obj, S32 face, - MASK mask, BOOL drop); + MASK mask, bool drop); EAcceptance dad3dRezCategoryOnObject(LLViewerObject* obj, S32 face, - MASK mask, BOOL drop); + MASK mask, bool drop); EAcceptance dad3dRezScript(LLViewerObject* obj, S32 face, - MASK mask, BOOL drop); + MASK mask, bool drop); EAcceptance dad3dTextureObject(LLViewerObject* obj, S32 face, - MASK mask, BOOL drop); + MASK mask, bool drop); EAcceptance dad3dMaterialObject(LLViewerObject* obj, S32 face, - MASK mask, BOOL drop); + MASK mask, bool drop); EAcceptance dad3dMeshObject(LLViewerObject* obj, S32 face, - MASK mask, BOOL drop); + MASK mask, bool drop); // EAcceptance dad3dTextureSelf(LLViewerObject* obj, S32 face, -// MASK mask, BOOL drop); +// MASK mask, bool drop); EAcceptance dad3dWearItem(LLViewerObject* obj, S32 face, - MASK mask, BOOL drop); + MASK mask, bool drop); EAcceptance dad3dWearCategory(LLViewerObject* obj, S32 face, - MASK mask, BOOL drop); + MASK mask, bool drop); EAcceptance dad3dUpdateInventory(LLViewerObject* obj, S32 face, - MASK mask, BOOL drop); + MASK mask, bool drop); EAcceptance dad3dUpdateInventoryCategory(LLViewerObject* obj, S32 face, MASK mask, - BOOL drop); + bool drop); EAcceptance dad3dGiveInventoryObject(LLViewerObject* obj, S32 face, - MASK mask, BOOL drop); + MASK mask, bool drop); EAcceptance dad3dGiveInventory(LLViewerObject* obj, S32 face, - MASK mask, BOOL drop); + MASK mask, bool drop); EAcceptance dad3dGiveInventoryCategory(LLViewerObject* obj, S32 face, - MASK mask, BOOL drop); + MASK mask, bool drop); EAcceptance dad3dRezFromObjectOnLand(LLViewerObject* obj, S32 face, - MASK mask, BOOL drop); + MASK mask, bool drop); EAcceptance dad3dRezFromObjectOnObject(LLViewerObject* obj, S32 face, - MASK mask, BOOL drop); + MASK mask, bool drop); EAcceptance dad3dRezAttachmentFromInv(LLViewerObject* obj, S32 face, - MASK mask, BOOL drop); + MASK mask, bool drop); EAcceptance dad3dCategoryOnLand(LLViewerObject *obj, S32 face, - MASK mask, BOOL drop); + MASK mask, bool drop); EAcceptance dad3dAssetOnLand(LLViewerObject *obj, S32 face, - MASK mask, BOOL drop); + MASK mask, bool drop); EAcceptance dad3dActivateGesture(LLViewerObject *obj, S32 face, - MASK mask, BOOL drop); + MASK mask, bool drop); // helper called by methods above to handle "application" of an item // to an object (texture applied to face, mesh applied to shape, etc.) - EAcceptance dad3dApplyToObject(LLViewerObject* obj, S32 face, MASK mask, BOOL drop, EDragAndDropType cargo_type); + EAcceptance dad3dApplyToObject(LLViewerObject* obj, S32 face, MASK mask, bool drop, EDragAndDropType cargo_type); // set the LLToolDragAndDrop's cursor based on the given acceptance @@ -222,9 +222,9 @@ protected: // LLViewerInventoryItem::item_array_t& items); void dropObject(LLViewerObject* raycast_target, - BOOL bypass_sim_raycast, - BOOL from_task_inventory, - BOOL remove_from_inventory); + bool bypass_sim_raycast, + bool from_task_inventory, + bool remove_from_inventory); // accessor that looks at permissions, copyability, and names of // inventory items to determine if a drop would be ok. @@ -232,15 +232,15 @@ protected: public: // helper functions - static BOOL isInventoryDropAcceptable(LLViewerObject* obj, LLInventoryItem* item) { return (ACCEPT_YES_COPY_SINGLE <= willObjectAcceptInventory(obj, item)); } + static bool isInventoryDropAcceptable(LLViewerObject* obj, LLInventoryItem* item) { return (ACCEPT_YES_COPY_SINGLE <= willObjectAcceptInventory(obj, item)); } - BOOL dadUpdateInventory(LLViewerObject* obj, BOOL drop); - BOOL dadUpdateInventoryCategory(LLViewerObject* obj, BOOL drop); + bool dadUpdateInventory(LLViewerObject* obj, bool drop); + bool dadUpdateInventoryCategory(LLViewerObject* obj, bool drop); // methods that act on the simulator state. static void dropScript(LLViewerObject* hit_obj, LLInventoryItem* item, - BOOL active, + bool active, ESource source, const LLUUID& src_id); static void dropTexture(LLViewerObject* hit_obj, @@ -291,7 +291,7 @@ public: ESource source, const LLUUID& src_id); - static bool handleGiveDragAndDrop(LLUUID agent, LLUUID session, BOOL drop, + static bool handleGiveDragAndDrop(LLUUID agent, LLUUID session, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, diff --git a/indra/newview/lltoolface.cpp b/indra/newview/lltoolface.cpp index 3176ba4bd5..426f340be1 100644 --- a/indra/newview/lltoolface.cpp +++ b/indra/newview/lltoolface.cpp @@ -53,28 +53,28 @@ LLToolFace::~LLToolFace() { } -BOOL LLToolFace::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLToolFace::handleDoubleClick(S32 x, S32 y, MASK mask) { if (!LLSelectMgr::getInstance()->getSelection()->isEmpty()) { // You should already have an object selected from the mousedown. // If so, show its properties LLFloaterReg::showInstance("build", "Texture"); - return TRUE; + return true; } else { // Nothing selected means the first mouse click was probably // bad, so try again. - return FALSE; + return false; } } -BOOL LLToolFace::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLToolFace::handleMouseDown(S32 x, S32 y, MASK mask) { gViewerWindow->pickAsync(x, y, mask, pickCallback); - return TRUE; + return true; } void LLToolFace::pickCallback(const LLPickInfo& pick_info) @@ -134,14 +134,14 @@ void LLToolFace::pickCallback(const LLPickInfo& pick_info) void LLToolFace::handleSelect() { // From now on, draw faces - LLSelectMgr::getInstance()->setTEMode(TRUE); + LLSelectMgr::getInstance()->setTEMode(true); } void LLToolFace::handleDeselect() { // Stop drawing faces - LLSelectMgr::getInstance()->setTEMode(FALSE); + LLSelectMgr::getInstance()->setTEMode(false); } diff --git a/indra/newview/lltoolface.h b/indra/newview/lltoolface.h index ff3eead6a6..18d42da1e1 100644 --- a/indra/newview/lltoolface.h +++ b/indra/newview/lltoolface.h @@ -39,8 +39,8 @@ class LLToolFace virtual ~LLToolFace(); public: - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override; - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override; + virtual bool handleMouseDown(S32 x, S32 y, MASK mask) override; + virtual bool handleDoubleClick(S32 x, S32 y, MASK mask) override; virtual void handleSelect() override; virtual void handleDeselect() override; virtual void render() override; // draw face highlights diff --git a/indra/newview/lltoolfocus.cpp b/indra/newview/lltoolfocus.cpp index e34e0cce50..0ba7ae5e84 100644 --- a/indra/newview/lltoolfocus.cpp +++ b/indra/newview/lltoolfocus.cpp @@ -56,9 +56,9 @@ #include "llmenugl.h" // Globals -BOOL gCameraBtnZoom = TRUE; -BOOL gCameraBtnOrbit = FALSE; -BOOL gCameraBtnPan = FALSE; +bool gCameraBtnZoom = true; +bool gCameraBtnOrbit = false; +bool gCameraBtnPan = false; const S32 SLOP_RANGE = 4; @@ -72,12 +72,12 @@ LLToolCamera::LLToolCamera() mAccumY(0), mMouseDownX(0), mMouseDownY(0), - mOutsideSlopX(FALSE), - mOutsideSlopY(FALSE), - mValidClickPoint(FALSE), + mOutsideSlopX(false), + mOutsideSlopY(false), + mValidClickPoint(false), mClickPickPending(false), - mValidSelection(FALSE), - mMouseSteering(FALSE), + mValidSelection(false), + mMouseSteering(false), mMouseUpX(0), mMouseUpY(0), mMouseUpMask(MASK_NONE) @@ -101,10 +101,10 @@ void LLToolCamera::handleSelect() // virtual void LLToolCamera::handleDeselect() { -// gAgent.setLookingAtAvatar(FALSE); +// gAgent.setLookingAtAvatar(false); // Make sure that temporary selection won't pass anywhere except pie tool. - MASK override_mask = gKeyboard ? gKeyboard->currentMask(TRUE) : 0; + MASK override_mask = gKeyboard ? gKeyboard->currentMask(true) : 0; if (!mValidSelection && (override_mask != MASK_NONE || (gFloaterTools && gFloaterTools->getVisible()))) { LLMenuGL::sMenuContainer->hideMenus(); @@ -112,10 +112,10 @@ void LLToolCamera::handleDeselect() } } -BOOL LLToolCamera::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLToolCamera::handleMouseDown(S32 x, S32 y, MASK mask) { // Ensure a mouseup - setMouseCapture(TRUE); + setMouseCapture(true); // call the base class to propogate info to sim LLTool::handleMouseDown(x, y, mask); @@ -123,10 +123,10 @@ BOOL LLToolCamera::handleMouseDown(S32 x, S32 y, MASK mask) mAccumX = 0; mAccumY = 0; - mOutsideSlopX = FALSE; - mOutsideSlopY = FALSE; + mOutsideSlopX = false; + mOutsideSlopY = false; - mValidClickPoint = FALSE; + mValidClickPoint = false; // Sometimes Windows issues down and up events near simultaneously // without giving async pick a chance to trigged @@ -141,9 +141,9 @@ BOOL LLToolCamera::handleMouseDown(S32 x, S32 y, MASK mask) gViewerWindow->hideCursor(); - gViewerWindow->pickAsync(x, y, mask, pickCallback, /*BOOL pick_transparent*/ FALSE, /*BOOL pick_rigged*/ FALSE, /*BOOL pick_unselectable*/ TRUE); + gViewerWindow->pickAsync(x, y, mask, pickCallback, /*bool pick_transparent*/ false, /*bool pick_rigged*/ false, /*bool pick_unselectable*/ true); - return TRUE; + return true; } void LLToolCamera::pickCallback(const LLPickInfo& pick_info) @@ -166,7 +166,7 @@ void LLToolCamera::pickCallback(const LLPickInfo& pick_info) // Check for hit the sky, or some other invalid point if (!hit_obj && pick_info.mPosGlobal.isExactlyZero()) { - camera->mValidClickPoint = FALSE; + camera->mValidClickPoint = false; return; } @@ -176,37 +176,37 @@ void LLToolCamera::pickCallback(const LLPickInfo& pick_info) LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); if (!selection->getObjectCount() || selection->getSelectType() != SELECT_TYPE_HUD) { - camera->mValidClickPoint = FALSE; + camera->mValidClickPoint = false; return; } } if( CAMERA_MODE_CUSTOMIZE_AVATAR == gAgentCamera.getCameraMode() ) { - BOOL good_customize_avatar_hit = FALSE; + bool good_customize_avatar_hit = false; if( hit_obj ) { if (isAgentAvatarValid() && (hit_obj == gAgentAvatarp)) { // It's you - good_customize_avatar_hit = TRUE; + good_customize_avatar_hit = true; } else if (hit_obj->isAttachment() && hit_obj->permYouOwner()) { // It's an attachment that you're wearing - good_customize_avatar_hit = TRUE; + good_customize_avatar_hit = true; } } if( !good_customize_avatar_hit ) { - camera->mValidClickPoint = FALSE; + camera->mValidClickPoint = false; return; } if( gMorphView ) { - gMorphView->setCameraDrivenByKeys( FALSE ); + gMorphView->setCameraDrivenByKeys( false ); } } //RN: check to see if this is mouse-driving as opposed to ALT-zoom or Focus tool @@ -219,18 +219,18 @@ void LLToolCamera::pickCallback(const LLPickInfo& pick_info) // ...clicked on a world object, so focus at its position if (!hit_obj->isHUDAttachment()) { - gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); + gAgentCamera.setFocusOnAvatar(false, ANIMATE); gAgentCamera.setFocusGlobal(pick_info); } } else if (!pick_info.mPosGlobal.isExactlyZero()) { // Hit the ground - gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); + gAgentCamera.setFocusOnAvatar(false, ANIMATE); gAgentCamera.setFocusGlobal(pick_info); } - BOOL zoom_tool = gCameraBtnZoom && (LLToolMgr::getInstance()->getBaseTool() == LLToolCamera::getInstance()); + bool zoom_tool = gCameraBtnZoom && (LLToolMgr::getInstance()->getBaseTool() == LLToolCamera::getInstance()); if (!(pick_info.mKeyMask & MASK_ALT) && !LLFloaterCamera::inFreeCameraMode() && !zoom_tool && @@ -240,16 +240,16 @@ void LLToolCamera::pickCallback(const LLPickInfo& pick_info) (hit_obj == gAgentAvatarp || (hit_obj && hit_obj->isAttachment() && LLVOAvatar::findAvatarFromAttachment(hit_obj)->isSelf()))) { - LLToolCamera::getInstance()->mMouseSteering = TRUE; + LLToolCamera::getInstance()->mMouseSteering = true; } } - camera->mValidClickPoint = TRUE; + camera->mValidClickPoint = true; if( CAMERA_MODE_CUSTOMIZE_AVATAR == gAgentCamera.getCameraMode() ) { - gAgentCamera.setFocusOnAvatar(FALSE, FALSE); + gAgentCamera.setFocusOnAvatar(false, false); LLVector3d cam_pos = gAgentCamera.getCameraPositionGlobal(); @@ -276,14 +276,14 @@ void LLToolCamera::releaseMouse() LLToolMgr::getInstance()->clearTransientTool(); } - mMouseSteering = FALSE; - mValidClickPoint = FALSE; - mOutsideSlopX = FALSE; - mOutsideSlopY = FALSE; + mMouseSteering = false; + mValidClickPoint = false; + mOutsideSlopX = false; + mOutsideSlopY = false; } -BOOL LLToolCamera::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLToolCamera::handleMouseUp(S32 x, S32 y, MASK mask) { // Claim that we're mousing up somewhere mMouseUpX = x; @@ -301,7 +301,7 @@ BOOL LLToolCamera::handleMouseUp(S32 x, S32 y, MASK mask) { LLCoordGL mouse_pos; LLVector3 focus_pos = gAgent.getPosAgentFromGlobal(gAgentCamera.getFocusGlobal()); - BOOL success = LLViewerCamera::getInstance()->projectPosAgentToScreen(focus_pos, mouse_pos); + bool success = LLViewerCamera::getInstance()->projectPosAgentToScreen(focus_pos, mouse_pos); if (success) { LLUI::getInstance()->setMousePositionScreen(mouse_pos.mX, mouse_pos.mY); @@ -324,18 +324,18 @@ BOOL LLToolCamera::handleMouseUp(S32 x, S32 y, MASK mask) } // calls releaseMouse() internally - setMouseCapture(FALSE); + setMouseCapture(false); } else { releaseMouse(); } - return TRUE; + return true; } -BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask) +bool LLToolCamera::handleHover(S32 x, S32 y, MASK mask) { S32 dx = gViewerWindow->getCurrentMouseDX(); S32 dy = gViewerWindow->getCurrentMouseDY(); @@ -347,12 +347,12 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask) if (mAccumX >= SLOP_RANGE) { - mOutsideSlopX = TRUE; + mOutsideSlopX = true; } if (mAccumY >= SLOP_RANGE) { - mOutsideSlopY = TRUE; + mOutsideSlopY = true; } } @@ -363,7 +363,7 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask) LL_DEBUGS("UserInput") << "hover handled by LLToolFocus [invalid point]" << LL_ENDL; gViewerWindow->setCursor(UI_CURSOR_NO); gViewerWindow->showCursor(); - return TRUE; + return true; } if (gCameraBtnOrbit || @@ -468,7 +468,7 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask) gViewerWindow->setCursor(UI_CURSOR_TOOLZOOMIN); } - return TRUE; + return true; } diff --git a/indra/newview/lltoolfocus.h b/indra/newview/lltoolfocus.h index 29a548d635..c2460e7aa4 100644 --- a/indra/newview/lltoolfocus.h +++ b/indra/newview/lltoolfocus.h @@ -38,9 +38,9 @@ class LLToolCamera virtual ~LLToolCamera(); public: - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override; - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override; - virtual BOOL handleHover(S32 x, S32 y, MASK mask) override; + virtual bool handleMouseDown(S32 x, S32 y, MASK mask) override; + virtual bool handleMouseUp(S32 x, S32 y, MASK mask) override; + virtual bool handleHover(S32 x, S32 y, MASK mask) override; virtual void onMouseCaptureLost() override; @@ -51,7 +51,7 @@ public: void setClickPickPending() { mClickPickPending = true; } static void pickCallback(const LLPickInfo& pick_info); - BOOL mouseSteerMode() { return mMouseSteering; } + bool mouseSteerMode() { return mMouseSteering; } protected: // called from handleMouseUp and onMouseCaptureLost to "let go" @@ -63,20 +63,20 @@ protected: S32 mAccumY; S32 mMouseDownX; S32 mMouseDownY; - BOOL mOutsideSlopX; - BOOL mOutsideSlopY; - BOOL mValidClickPoint; + bool mOutsideSlopX; + bool mOutsideSlopY; + bool mValidClickPoint; bool mClickPickPending; - BOOL mValidSelection; - BOOL mMouseSteering; + bool mValidSelection; + bool mMouseSteering; S32 mMouseUpX; // needed for releaseMouse() S32 mMouseUpY; MASK mMouseUpMask; }; -extern BOOL gCameraBtnOrbit; -extern BOOL gCameraBtnPan; -extern BOOL gCameraBtnZoom; +extern bool gCameraBtnOrbit; +extern bool gCameraBtnPan; +extern bool gCameraBtnZoom; #endif diff --git a/indra/newview/lltoolgrab.cpp b/indra/newview/lltoolgrab.cpp index 59bfebafe4..f3ec655f00 100644 --- a/indra/newview/lltoolgrab.cpp +++ b/indra/newview/lltoolgrab.cpp @@ -62,10 +62,10 @@ const S32 SLOP_DIST_SQ = 4; // Override modifier key behavior with these buttons -BOOL gGrabBtnVertical = FALSE; -BOOL gGrabBtnSpin = FALSE; +bool gGrabBtnVertical = false; +bool gGrabBtnSpin = false; LLTool* gGrabTransientTool = NULL; -extern BOOL gDebugClicks; +extern bool gDebugClicks; // // Methods @@ -73,20 +73,20 @@ extern BOOL gDebugClicks; LLToolGrabBase::LLToolGrabBase( LLToolComposite* composite ) : LLTool( std::string("Grab"), composite ), mMode( GRAB_INACTIVE ), - mVerticalDragging( FALSE ), - mHitLand(FALSE), + mVerticalDragging( false ), + mHitLand(false), mLastMouseX(0), mLastMouseY(0), mAccumDeltaX(0), mAccumDeltaY(0), - mHasMoved( FALSE ), - mOutsideSlop(FALSE), - mDeselectedThisClick(FALSE), + mHasMoved( false ), + mOutsideSlop(false), + mDeselectedThisClick(false), mLastFace(0), - mSpinGrabbing( FALSE ), + mSpinGrabbing( false ), mSpinRotation(), - mClickedInMouselook( FALSE ), - mHideBuildHighlight(FALSE) + mClickedInMouselook( false ), + mHideBuildHighlight(false) { } LLToolGrabBase::~LLToolGrabBase() @@ -103,19 +103,19 @@ void LLToolGrabBase::handleSelect() // in case we start from tools floater, we count any selection as valid mValidSelection = gFloaterTools->getVisible(); } - gGrabBtnVertical = FALSE; - gGrabBtnSpin = FALSE; + gGrabBtnVertical = false; + gGrabBtnSpin = false; } void LLToolGrabBase::handleDeselect() { if( hasMouseCapture() ) { - setMouseCapture( FALSE ); + setMouseCapture( false ); } // Make sure that temporary(invalid) selection won't pass anywhere except pie tool. - MASK override_mask = gKeyboard ? gKeyboard->currentMask(TRUE) : 0; + MASK override_mask = gKeyboard ? gKeyboard->currentMask(true) : 0; if (!mValidSelection && (override_mask != MASK_NONE || (gFloaterTools && gFloaterTools->getVisible()))) { LLMenuGL::sMenuContainer->hideMenus(); @@ -124,17 +124,17 @@ void LLToolGrabBase::handleDeselect() } -BOOL LLToolGrabBase::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLToolGrabBase::handleDoubleClick(S32 x, S32 y, MASK mask) { if (gDebugClicks) { LL_INFOS() << "LLToolGrab handleDoubleClick (becoming mouseDown)" << LL_ENDL; } - return FALSE; + return false; } -BOOL LLToolGrabBase::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLToolGrabBase::handleMouseDown(S32 x, S32 y, MASK mask) { if (gDebugClicks) { @@ -147,7 +147,7 @@ BOOL LLToolGrabBase::handleMouseDown(S32 x, S32 y, MASK mask) if (!gAgent.leftButtonGrabbed() || ((mask & DEFAULT_GRAB_MASK) != 0 && !gAgentCamera.cameraMouselook())) { // can grab transparent objects (how touch event propagates, scripters rely on this) - gViewerWindow->pickAsync(x, y, mask, pickCallback, /*BOOL pick_transparent*/ TRUE); + gViewerWindow->pickAsync(x, y, mask, pickCallback, /*bool pick_transparent*/ true); } mClickedInMouselook = gAgentCamera.cameraMouselook(); @@ -163,7 +163,7 @@ BOOL LLToolGrabBase::handleMouseDown(S32 x, S32 y, MASK mask) // Todo: LLToolGrabBase probably shouldn't consume the event if there is nothing // to grab in Mouselook, it intercepts handling in scanMouse } - return TRUE; + return true; } void LLToolGrabBase::pickCallback(const LLPickInfo& pick_info) @@ -171,22 +171,22 @@ void LLToolGrabBase::pickCallback(const LLPickInfo& pick_info) LLToolGrab::getInstance()->mGrabPick = pick_info; LLViewerObject *objectp = pick_info.getObject(); - BOOL extend_select = (pick_info.mKeyMask & MASK_SHIFT); + bool extend_select = (pick_info.mKeyMask & MASK_SHIFT); if (!extend_select && !LLSelectMgr::getInstance()->getSelection()->isEmpty()) { LLSelectMgr::getInstance()->deselectAll(); - LLToolGrab::getInstance()->mDeselectedThisClick = TRUE; + LLToolGrab::getInstance()->mDeselectedThisClick = true; } else { - LLToolGrab::getInstance()->mDeselectedThisClick = FALSE; + LLToolGrab::getInstance()->mDeselectedThisClick = false; } // if not over object, do nothing if (!objectp) { - LLToolGrab::getInstance()->setMouseCapture(TRUE); + LLToolGrab::getInstance()->setMouseCapture(true); LLToolGrab::getInstance()->mMode = GRAB_NOOBJECT; LLToolGrab::getInstance()->mGrabPick.mObjectID.setNull(); } @@ -196,7 +196,7 @@ void LLToolGrabBase::pickCallback(const LLPickInfo& pick_info) } } -BOOL LLToolGrabBase::handleObjectHit(const LLPickInfo& info) +bool LLToolGrabBase::handleObjectHit(const LLPickInfo& info) { mGrabPick = info; LLViewerObject* objectp = mGrabPick.getObject(); @@ -208,8 +208,8 @@ BOOL LLToolGrabBase::handleObjectHit(const LLPickInfo& info) if (NULL == objectp) // unexpected { - LL_WARNS() << "objectp was NULL; returning FALSE" << LL_ENDL; - return FALSE; + LL_WARNS() << "objectp was NULL; returning false" << LL_ENDL; + return false; } if (objectp->isAvatar()) @@ -219,16 +219,16 @@ BOOL LLToolGrabBase::handleObjectHit(const LLPickInfo& info) gBasicToolset->selectTool( gGrabTransientTool ); gGrabTransientTool = NULL; } - return TRUE; + return true; } - setMouseCapture( TRUE ); + setMouseCapture( true ); // Grabs always start from the root // objectp = (LLViewerObject *)objectp->getRoot(); LLViewerObject* parent = objectp->getRootEdit(); - BOOL script_touch = (objectp->flagHandleTouch()) || (parent && parent->flagHandleTouch()); + bool script_touch = (objectp->flagHandleTouch()) || (parent && parent->flagHandleTouch()); // Clicks on scripted or physical objects are temporary grabs, so // not "Build mode" @@ -291,8 +291,8 @@ BOOL LLToolGrabBase::handleObjectHit(const LLPickInfo& info) mLastMouseY = gViewerWindow->getCurrentMouseY(); mAccumDeltaX = 0; mAccumDeltaY = 0; - mHasMoved = FALSE; - mOutsideSlop = FALSE; + mHasMoved = false; + mOutsideSlop = false; mVerticalDragging = (info.mKeyMask == MASK_VERTICAL) || gGrabBtnVertical; @@ -325,7 +325,7 @@ BOOL LLToolGrabBase::handleObjectHit(const LLPickInfo& info) gGrabTransientTool = NULL; } - return TRUE; + return true; } @@ -336,7 +336,7 @@ void LLToolGrabBase::startSpin() { return; } - mSpinGrabbing = TRUE; + mSpinGrabbing = true; // Was saveSelectedObjectTransform() LLViewerObject *root = (LLViewerObject *)objectp->getRoot(); @@ -355,7 +355,7 @@ void LLToolGrabBase::startSpin() void LLToolGrabBase::stopSpin() { - mSpinGrabbing = FALSE; + mSpinGrabbing = false; LLViewerObject* objectp = mGrabPick.getObject(); if (!objectp) @@ -436,13 +436,13 @@ void LLToolGrabBase::startGrab() } -BOOL LLToolGrabBase::handleHover(S32 x, S32 y, MASK mask) +bool LLToolGrabBase::handleHover(S32 x, S32 y, MASK mask) { if (!gViewerWindow->getLeftMouseDown()) { gViewerWindow->setCursor(UI_CURSOR_TOOLGRAB); - setMouseCapture(FALSE); - return TRUE; + setMouseCapture(false); + return true; } // Do the right hover based on mode @@ -470,7 +470,7 @@ BOOL LLToolGrabBase::handleHover(S32 x, S32 y, MASK mask) mLastMouseX = x; mLastMouseY = y; - return TRUE; + return true; } const F32 GRAB_SENSITIVITY_X = 0.0075f; @@ -487,7 +487,7 @@ void LLToolGrabBase::handleHoverActive(S32 x, S32 y, MASK mask) if (objectp->isDead()) { // Bail out of drag because object has been killed - setMouseCapture(FALSE); + setMouseCapture(false); return; } @@ -499,12 +499,12 @@ void LLToolGrabBase::handleHoverActive(S32 x, S32 y, MASK mask) if ((mask == MASK_VERTICAL) || (gGrabBtnVertical && (mask != MASK_SPIN))) { - vertical_dragging = TRUE; + vertical_dragging = true; } else if ((mask == MASK_SPIN) || (gGrabBtnSpin && (mask != MASK_VERTICAL))) { - spin_grabbing = TRUE; + spin_grabbing = true; } //-------------------------------------------------- @@ -552,11 +552,11 @@ void LLToolGrabBase::handleHoverActive(S32 x, S32 y, MASK mask) S32 dist_sq = mAccumDeltaX * mAccumDeltaX + mAccumDeltaY * mAccumDeltaY; if (dist_sq > SLOP_DIST_SQ) { - mOutsideSlop = TRUE; + mOutsideSlop = true; } // mouse has moved outside center - mHasMoved = TRUE; + mHasMoved = true; if (mSpinGrabbing) { @@ -628,7 +628,7 @@ void LLToolGrabBase::handleHoverActive(S32 x, S32 y, MASK mask) /* Snap to grid disabled for grab tool - very confusing // Handle snapping to grid, but only when the tool is formally selected. - BOOL snap_on = gSavedSettings.getBOOL("SnapEnabled"); + bool snap_on = gSavedSettings.getBOOL("SnapEnabled"); if (snap_on && !gGrabTransientTool) { F64 snap_size = gSavedSettings.getF32("GridResolution"); @@ -741,7 +741,7 @@ void LLToolGrabBase::handleHoverActive(S32 x, S32 y, MASK mask) // force focus to point in space where we were looking previously // Example of use: follow cam scripts shouldn't affect you when movng objects arouns gAgentCamera.setFocusGlobal(gAgentCamera.calcFocusPositionTargetGlobal(), LLUUID::null); - gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); + gAgentCamera.setFocusOnAvatar(false, ANIMATE); } } else @@ -764,7 +764,7 @@ void LLToolGrabBase::handleHoverNonPhysical(S32 x, S32 y, MASK mask) if (objectp->isDead()) { // Bail out of drag because object has been killed - setMouseCapture(FALSE); + setMouseCapture(false); return; } @@ -782,7 +782,7 @@ void LLToolGrabBase::handleHoverNonPhysical(S32 x, S32 y, MASK mask) LLVector3 grab_pos_region(0,0,0); - const BOOL SUPPORT_LLDETECTED_GRAB = TRUE; + const bool SUPPORT_LLDETECTED_GRAB = true; if (SUPPORT_LLDETECTED_GRAB) { //-------------------------------------------------- @@ -790,13 +790,13 @@ void LLToolGrabBase::handleHoverNonPhysical(S32 x, S32 y, MASK mask) //-------------------------------------------------- if (!(mask == MASK_VERTICAL) && !gGrabBtnVertical) { - mVerticalDragging = FALSE; + mVerticalDragging = false; } else if ((gGrabBtnVertical && (mask != MASK_SPIN)) || (mask == MASK_VERTICAL)) { - mVerticalDragging = TRUE; + mVerticalDragging = true; } S32 dx = x - mLastMouseX; @@ -810,11 +810,11 @@ void LLToolGrabBase::handleHoverNonPhysical(S32 x, S32 y, MASK mask) S32 dist_sq = mAccumDeltaX * mAccumDeltaX + mAccumDeltaY * mAccumDeltaY; if (dist_sq > SLOP_DIST_SQ) { - mOutsideSlop = TRUE; + mOutsideSlop = true; } // mouse has moved - mHasMoved = TRUE; + mHasMoved = true; //------------------------------------------------------ // Handle grabbing @@ -853,7 +853,7 @@ void LLToolGrabBase::handleHoverNonPhysical(S32 x, S32 y, MASK mask) // only send message if something has changed since last message - BOOL changed_since_last_update = FALSE; + bool changed_since_last_update = false; // test if touch data needs to be updated if ((pick.mObjectFace != mLastFace) || @@ -864,7 +864,7 @@ void LLToolGrabBase::handleHoverNonPhysical(S32 x, S32 y, MASK mask) (pick.mBinormal != mLastBinormal) || (grab_pos_region != mLastGrabPos)) { - changed_since_last_update = TRUE; + changed_since_last_update = true; } if (changed_since_last_update) @@ -935,7 +935,7 @@ void LLToolGrabBase::handleHoverFailed(S32 x, S32 y, MASK mask) S32 dist_sq = (x-mGrabPick.mMousePt.mX) * (x-mGrabPick.mMousePt.mX) + (y-mGrabPick.mMousePt.mY) * (y-mGrabPick.mMousePt.mY); if( mOutsideSlop || dist_sq > SLOP_DIST_SQ ) { - mOutsideSlop = TRUE; + mOutsideSlop = true; switch( mMode ) { @@ -964,7 +964,7 @@ void LLToolGrabBase::handleHoverFailed(S32 x, S32 y, MASK mask) -BOOL LLToolGrabBase::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLToolGrabBase::handleMouseUp(S32 x, S32 y, MASK mask) { LLTool::handleMouseUp(x, y, mask); @@ -980,14 +980,14 @@ BOOL LLToolGrabBase::handleMouseUp(S32 x, S32 y, MASK mask) if( hasMouseCapture() ) { - setMouseCapture( FALSE ); + setMouseCapture( false ); } mMode = GRAB_INACTIVE; if(mClickedInMouselook && !gAgentCamera.cameraMouselook()) { - mClickedInMouselook = FALSE; + mClickedInMouselook = false; } else { @@ -1001,14 +1001,14 @@ BOOL LLToolGrabBase::handleMouseUp(S32 x, S32 y, MASK mask) //gAgent.setObjectTracking(gSavedSettings.getBOOL("TrackFocusObject")); - return TRUE; + return true; } void LLToolGrabBase::stopEditing() { if( hasMouseCapture() ) { - setMouseCapture( FALSE ); + setMouseCapture( false ); } } @@ -1057,7 +1057,7 @@ void LLToolGrabBase::onMouseCaptureLost() mMode = GRAB_INACTIVE; - mHideBuildHighlight = FALSE; + mHideBuildHighlight = false; mGrabPick.mObjectID.setNull(); @@ -1096,7 +1096,7 @@ void LLToolGrabBase::stopGrab() case GRAB_NONPHYSICAL: case GRAB_LOCKED: send_ObjectDeGrab_message(objectp, pick); - mVerticalDragging = FALSE; + mVerticalDragging = false; break; case GRAB_NOOBJECT: @@ -1106,7 +1106,7 @@ void LLToolGrabBase::stopGrab() break; } - mHideBuildHighlight = FALSE; + mHideBuildHighlight = false; } @@ -1116,7 +1116,7 @@ void LLToolGrabBase::draw() void LLToolGrabBase::render() { } -BOOL LLToolGrabBase::isEditing() +bool LLToolGrabBase::isEditing() { return (mGrabPick.getObject().notNull()); } diff --git a/indra/newview/lltoolgrab.h b/indra/newview/lltoolgrab.h index 65a1f3cbdb..7806cbc24f 100644 --- a/indra/newview/lltoolgrab.h +++ b/indra/newview/lltoolgrab.h @@ -58,10 +58,10 @@ public: LLToolGrabBase(LLToolComposite* composite=NULL); ~LLToolGrabBase(); - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleDoubleClick(S32 x, S32 y, MASK mask); /*virtual*/ void render(); // 3D elements /*virtual*/ void draw(); // 2D elements @@ -70,21 +70,21 @@ public: virtual LLViewerObject* getEditingObject(); virtual LLVector3d getEditingPointGlobal(); - virtual BOOL isEditing(); + virtual bool isEditing(); virtual void stopEditing(); virtual void onMouseCaptureLost(); - BOOL hasGrabOffset() { return TRUE; } // HACK + bool hasGrabOffset() { return true; } // HACK LLVector3 getGrabOffset(S32 x, S32 y); // HACK // Capture the mouse and start grabbing. - BOOL handleObjectHit(const LLPickInfo& info); + bool handleObjectHit(const LLPickInfo& info); // Certain grabs should not highlight the "Build" toolbar button - BOOL getHideBuildHighlight() { return mHideBuildHighlight; } + bool getHideBuildHighlight() { return mHideBuildHighlight; } - void setClickedInMouselook(BOOL is_clickedInMouselook) {mClickedInMouselook = is_clickedInMouselook;} + void setClickedInMouselook(bool is_clickedInMouselook) {mClickedInMouselook = is_clickedInMouselook;} static void pickCallback(const LLPickInfo& pick_info); private: @@ -106,9 +106,9 @@ private: EGrabMode mMode; - BOOL mVerticalDragging; + bool mVerticalDragging; - BOOL mHitLand; + bool mHitLand; LLTimer mGrabTimer; // send simulator time between hover movements @@ -124,10 +124,10 @@ private: S32 mLastMouseY; S32 mAccumDeltaX; // since cursor hidden, how far have you moved? S32 mAccumDeltaY; - BOOL mHasMoved; // has mouse moved off center at all? - BOOL mOutsideSlop; // has mouse moved outside center 5 pixels? - BOOL mDeselectedThisClick; - BOOL mValidSelection; + bool mHasMoved; // has mouse moved off center at all? + bool mOutsideSlop; // has mouse moved outside center 5 pixels? + bool mDeselectedThisClick; + bool mValidSelection; S32 mLastFace; LLVector2 mLastUVCoords; @@ -138,12 +138,12 @@ private: LLVector3 mLastGrabPos; - BOOL mSpinGrabbing; + bool mSpinGrabbing; LLQuaternion mSpinRotation; - BOOL mHideBuildHighlight; + bool mHideBuildHighlight; - BOOL mClickedInMouselook; + bool mClickedInMouselook; }; /// This is the LLSingleton instance of LLToolGrab. @@ -152,8 +152,8 @@ class LLToolGrab : public LLToolGrabBase, public LLSingleton<LLToolGrab> LLSINGLETON_EMPTY_CTOR(LLToolGrab); }; -extern BOOL gGrabBtnVertical; -extern BOOL gGrabBtnSpin; +extern bool gGrabBtnVertical; +extern bool gGrabBtnSpin; extern LLTool* gGrabTransientTool; #endif // LL_TOOLGRAB_H diff --git a/indra/newview/lltoolgun.cpp b/indra/newview/lltoolgun.cpp index a79f287503..b60cb96eb5 100644 --- a/indra/newview/lltoolgun.cpp +++ b/indra/newview/lltoolgun.cpp @@ -48,7 +48,7 @@ LLToolGun::LLToolGun( LLToolComposite* composite ) : LLTool( std::string("gun"), composite ), - mIsSelected(FALSE) + mIsSelected(false) { } @@ -56,19 +56,19 @@ void LLToolGun::handleSelect() { gViewerWindow->hideCursor(); gViewerWindow->moveCursorToCenter(); - gViewerWindow->getWindow()->setMouseClipping(TRUE); - mIsSelected = TRUE; + gViewerWindow->getWindow()->setMouseClipping(true); + mIsSelected = true; } void LLToolGun::handleDeselect() { gViewerWindow->moveCursorToCenter(); gViewerWindow->showCursor(); - gViewerWindow->getWindow()->setMouseClipping(FALSE); - mIsSelected = FALSE; + gViewerWindow->getWindow()->setMouseClipping(false); + mIsSelected = false; } -BOOL LLToolGun::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLToolGun::handleMouseDown(S32 x, S32 y, MASK mask) { gGrabTransientTool = this; LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolGrab::getInstance() ); @@ -76,7 +76,7 @@ BOOL LLToolGun::handleMouseDown(S32 x, S32 y, MASK mask) return LLToolGrab::getInstance()->handleMouseDown(x, y, mask); } -BOOL LLToolGun::handleHover(S32 x, S32 y, MASK mask) +bool LLToolGun::handleHover(S32 x, S32 y, MASK mask) { if( gAgentCamera.cameraMouselook() && mIsSelected ) { @@ -133,7 +133,7 @@ BOOL LLToolGun::handleHover(S32 x, S32 y, MASK mask) // 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. gViewerWindow->setCursor(UI_CURSOR_ARROW); - return TRUE; + return true; } void LLToolGun::draw() diff --git a/indra/newview/lltoolgun.h b/indra/newview/lltoolgun.h index 0220d5f327..f9bb9bb39a 100644 --- a/indra/newview/lltoolgun.h +++ b/indra/newview/lltoolgun.h @@ -41,13 +41,13 @@ public: virtual void handleSelect(); virtual void handleDeselect(); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleHover(S32 x, S32 y, MASK mask); virtual LLTool* getOverrideTool(MASK mask) { return NULL; } - virtual BOOL clipMouseWhenDown() { return FALSE; } + virtual bool clipMouseWhenDown() { return false; } private: - BOOL mIsSelected; + bool mIsSelected; }; #endif diff --git a/indra/newview/lltoolindividual.cpp b/indra/newview/lltoolindividual.cpp index 50b4cb0c93..8962c55273 100644 --- a/indra/newview/lltoolindividual.cpp +++ b/indra/newview/lltoolindividual.cpp @@ -66,10 +66,10 @@ LLToolIndividual::~LLToolIndividual() { } -BOOL LLToolIndividual::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLToolIndividual::handleMouseDown(S32 x, S32 y, MASK mask) { gViewerWindow->pickAsync(x, y, mask, pickCallback); - return TRUE; + return true; } void LLToolIndividual::pickCallback(const LLPickInfo& pick_info) @@ -82,26 +82,26 @@ void LLToolIndividual::pickCallback(const LLPickInfo& pick_info) } } -BOOL LLToolIndividual::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLToolIndividual::handleDoubleClick(S32 x, S32 y, MASK mask) { if(!LLSelectMgr::getInstance()->getSelection()->isEmpty()) { // You should already have an object selected from the mousedown. // If so, show its inventory. LLFloaterReg::showInstance("build", "Content"); - return TRUE; + return true; } else { // Nothing selected means the first mouse click was probably // bad, so try again. - return FALSE; + return false; } } void LLToolIndividual::handleSelect() { - const BOOL children_ok = TRUE; + const bool children_ok = true; LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(children_ok); LLSelectMgr::getInstance()->deselectAll(); if(obj) diff --git a/indra/newview/lltoolindividual.h b/indra/newview/lltoolindividual.h index 8373606e32..baf687d183 100644 --- a/indra/newview/lltoolindividual.h +++ b/indra/newview/lltoolindividual.h @@ -43,8 +43,8 @@ class LLToolIndividual : public LLTool, public LLSingleton<LLToolIndividual> virtual ~LLToolIndividual(); public: - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override; - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override; + virtual bool handleMouseDown(S32 x, S32 y, MASK mask) override; + virtual bool handleDoubleClick(S32 x, S32 y, MASK mask) override; virtual void handleSelect() override; static void pickCallback(const LLPickInfo& pick_info); diff --git a/indra/newview/lltoolmgr.cpp b/indra/newview/lltoolmgr.cpp index b1f895317a..07963a7bed 100644 --- a/indra/newview/lltoolmgr.cpp +++ b/indra/newview/lltoolmgr.cpp @@ -102,12 +102,12 @@ LLToolMgr::LLToolMgr() void LLToolMgr::initTools() { - static BOOL initialized = FALSE; + static bool initialized = false; if(initialized) { return; } - initialized = TRUE; + initialized = true; gBasicToolset->addTool( LLToolPie::getInstance() ); gBasicToolset->addTool( LLToolCamera::getInstance() ); gCameraToolset->addTool( LLToolCamera::getInstance() ); @@ -143,14 +143,15 @@ LLToolMgr::~LLToolMgr() gToolNull = NULL; } -BOOL LLToolMgr::usingTransientTool() +bool LLToolMgr::usingTransientTool() { - return mTransientTool ? TRUE : FALSE; + return mTransientTool != nullptr; } void LLToolMgr::setCurrentToolset(LLToolset* current) { - if (!current) return; + if (!current) + return; // switching toolsets? if (current != mCurrentToolset) @@ -164,6 +165,7 @@ void LLToolMgr::setCurrentToolset(LLToolset* current) // select first tool of new toolset only if toolset changed mCurrentToolset->selectFirstTool(); } + // update current tool based on new toolset setCurrentTool( mCurrentToolset->getSelectedTool() ); } @@ -188,7 +190,7 @@ void LLToolMgr::setCurrentTool( LLTool* tool ) LLTool* LLToolMgr::getCurrentTool() { - MASK override_mask = gKeyboard ? gKeyboard->currentMask(TRUE) : 0; + MASK override_mask = gKeyboard ? gKeyboard->currentMask(true) : 0; LLTool* cur_tool = NULL; // always use transient tools if available @@ -301,7 +303,7 @@ void LLToolMgr::toggleBuildMode(const LLSD& sdname) if (gAgentCamera.getFocusOnAvatar()) { // zoom in if we're looking at the avatar - gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); + gAgentCamera.setFocusOnAvatar(false, ANIMATE); gAgentCamera.setFocusGlobal(gAgent.getPositionGlobal() + 2.0 * LLVector3d(gAgent.getAtAxis())); gAgentCamera.cameraZoomIn(0.666f); gAgentCamera.cameraOrbitOver( 30.f * DEG_TO_RAD ); @@ -459,7 +461,7 @@ void LLToolset::selectToolByIndex( S32 index ) } } -BOOL LLToolset::isToolSelected( S32 index ) +bool LLToolset::isToolSelected( S32 index ) { LLTool *tool = (index >= 0 && index < (S32)mToolList.size()) ? mToolList[index] : NULL; return (tool == mSelectedTool); diff --git a/indra/newview/lltoolmgr.h b/indra/newview/lltoolmgr.h index fd7d063740..6cfdbaac06 100644 --- a/indra/newview/lltoolmgr.h +++ b/indra/newview/lltoolmgr.h @@ -64,7 +64,7 @@ public: void setTransientTool(LLTool* tool); void clearTransientTool(); - BOOL usingTransientTool(); + bool usingTransientTool(); void setCurrentToolset(LLToolset* current); LLToolset* getCurrentToolset(); @@ -106,7 +106,7 @@ public: void handleScrollWheel(S32 clicks); - BOOL isToolSelected( S32 index ); + bool isToolSelected( S32 index ); void setShowFloaterTools(bool pShowFloaterTools) {mIsShowFloaterTools = pShowFloaterTools;}; bool isShowFloaterTools() const {return mIsShowFloaterTools;}; diff --git a/indra/newview/lltoolmorph.cpp b/indra/newview/lltoolmorph.cpp index fa55c8ed9a..b3871a6d6c 100644 --- a/indra/newview/lltoolmorph.cpp +++ b/indra/newview/lltoolmorph.cpp @@ -62,7 +62,7 @@ //static LLVisualParamHint::instance_list_t LLVisualParamHint::sInstances; -BOOL LLVisualParamReset::sDirty = FALSE; +bool LLVisualParamReset::sDirty = false; //----------------------------------------------------------------------------- // LLVisualParamHint() @@ -78,14 +78,14 @@ LLVisualParamHint::LLVisualParamHint( F32 param_weight, LLJoint* jointp) : - LLViewerDynamicTexture(width, height, 3, LLViewerDynamicTexture::ORDER_MIDDLE, TRUE ), - mNeedsUpdate( TRUE ), - mIsVisible( FALSE ), + LLViewerDynamicTexture(width, height, 3, LLViewerDynamicTexture::ORDER_MIDDLE, true ), + mNeedsUpdate( true ), + mIsVisible( false ), mJointMesh( mesh ), mVisualParam( param ), mWearablePtr( wearable ), mVisualParamWeight( param_weight ), - mAllowsUpdates( TRUE ), + mAllowsUpdates( true ), mDelayFrames( 0 ), mRect( pos_x, pos_y + height, pos_x + width, pos_y ), mLastParamWeight(0.f), @@ -128,30 +128,30 @@ void LLVisualParamHint::requestHintUpdates( LLVisualParamHint* exception1, LLVis { if( instance->mAllowsUpdates ) { - instance->mNeedsUpdate = TRUE; + instance->mNeedsUpdate = true; instance->mDelayFrames = delay_frames; delay_frames++; } else { - instance->mNeedsUpdate = TRUE; + instance->mNeedsUpdate = true; instance->mDelayFrames = 0; } } } } -BOOL LLVisualParamHint::needsRender() +bool LLVisualParamHint::needsRender() { return mNeedsUpdate && mDelayFrames-- <= 0 && !gAgentAvatarp->getIsAppearanceAnimating() && mAllowsUpdates; } -void LLVisualParamHint::preRender(BOOL clear_depth) +void LLVisualParamHint::preRender(bool clear_depth) { LLViewerWearable* wearable = (LLViewerWearable*)mWearablePtr; if (wearable) { - wearable->setVolatile(TRUE); + wearable->setVolatile(true); } mLastParamWeight = mVisualParam->getWeight(); mWearablePtr->setVisualParamWeight(mVisualParam->getID(), mVisualParamWeight); @@ -179,9 +179,9 @@ void LLVisualParamHint::preRender(BOOL clear_depth) //----------------------------------------------------------------------------- // render() //----------------------------------------------------------------------------- -BOOL LLVisualParamHint::render() +bool LLVisualParamHint::render() { - LLVisualParamReset::sDirty = TRUE; + LLVisualParamReset::sDirty = true; gGL.pushUIMatrix(); gGL.loadUIIdentity(); @@ -198,7 +198,7 @@ BOOL LLVisualParamHint::render() gUIProgram.bind(); LLGLSUIDefault gls_ui; - //LLGLState::verify(TRUE); + //LLGLState::verify(true); mBackgroundp->draw(0, 0, mFullWidth, mFullHeight); gGL.matrixMode(LLRender::MM_PROJECTION); @@ -207,8 +207,8 @@ BOOL LLVisualParamHint::render() gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.popMatrix(); - mNeedsUpdate = FALSE; - mIsVisible = TRUE; + mNeedsUpdate = false; + mIsVisible = true; LLQuaternion avatar_rotation; LLJoint* root_joint = gAgentAvatarp->getRootJoint(); @@ -244,7 +244,7 @@ BOOL LLVisualParamHint::render() LLVector3::z_axis, // up target_pos ); // point of interest - LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, FALSE); + LLViewerCamera::getInstance()->setPerspective(false, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, false); if (gAgentAvatarp->mDrawable.notNull()) { @@ -261,7 +261,7 @@ BOOL LLVisualParamHint::render() LLViewerWearable* wearable = (LLViewerWearable*)mWearablePtr; if (wearable) { - wearable->setVolatile(FALSE); + wearable->setVolatile(false); } gAgentAvatarp->updateVisualParams(); @@ -269,7 +269,7 @@ BOOL LLVisualParamHint::render() mGLTexturep->setGLTextureCreated(true); gGL.popUIMatrix(); - return TRUE; + return true; } @@ -304,7 +304,7 @@ void LLVisualParamHint::draw(F32 alpha) //----------------------------------------------------------------------------- // LLVisualParamReset() //----------------------------------------------------------------------------- -LLVisualParamReset::LLVisualParamReset() : LLViewerDynamicTexture(1, 1, 1, ORDER_RESET, FALSE) +LLVisualParamReset::LLVisualParamReset() : LLViewerDynamicTexture(1, 1, 1, ORDER_RESET, false) { } @@ -317,15 +317,15 @@ S8 LLVisualParamReset::getType() const //----------------------------------------------------------------------------- // render() //----------------------------------------------------------------------------- -BOOL LLVisualParamReset::render() +bool LLVisualParamReset::render() { if (sDirty) { gAgentAvatarp->updateComposites(); gAgentAvatarp->updateVisualParams(); gAgentAvatarp->updateGeometry(gAgentAvatarp->mDrawable); - sDirty = FALSE; + sDirty = false; } - return FALSE; + return false; } diff --git a/indra/newview/lltoolmorph.h b/indra/newview/lltoolmorph.h index 5bfb4e694f..fb62ba9bba 100644 --- a/indra/newview/lltoolmorph.h +++ b/indra/newview/lltoolmorph.h @@ -63,18 +63,18 @@ public: /*virtual*/ S8 getType() const ; - BOOL needsRender(); - void preRender(BOOL clear_depth); - BOOL render(); - void requestUpdate( S32 delay_frames ) {mNeedsUpdate = TRUE; mDelayFrames = delay_frames; } + bool needsRender(); + void preRender(bool clear_depth); + bool render(); + void requestUpdate( S32 delay_frames ) {mNeedsUpdate = true; mDelayFrames = delay_frames; } void setUpdateDelayFrames( S32 delay_frames ) { mDelayFrames = delay_frames; } void draw(F32 alpha); LLViewerVisualParam* getVisualParam() { return mVisualParam; } F32 getVisualParamWeight() { return mVisualParamWeight; } - BOOL getVisible() { return mIsVisible; } + bool getVisible() { return mIsVisible; } - void setAllowsUpdates( BOOL b ) { mAllowsUpdates = b; } + void setAllowsUpdates( bool b ) { mAllowsUpdates = b; } const LLRect& getRect() { return mRect; } @@ -82,13 +82,13 @@ public: static void requestHintUpdates( LLVisualParamHint* exception1 = NULL, LLVisualParamHint* exception2 = NULL ); protected: - BOOL mNeedsUpdate; // does this texture need to be re-rendered? - BOOL mIsVisible; // is this distortion hint visible? + bool mNeedsUpdate; // does this texture need to be re-rendered? + bool mIsVisible; // is this distortion hint visible? LLViewerJointMesh* mJointMesh; // mesh that this distortion applies to LLViewerVisualParam* mVisualParam; // visual param applied by this hint LLWearable* mWearablePtr; // wearable we're editing F32 mVisualParamWeight; // weight for this visual parameter - BOOL mAllowsUpdates; // updates are blocked unless this is true + bool mAllowsUpdates; // updates are blocked unless this is true S32 mDelayFrames; // updates are blocked for this many frames LLRect mRect; F32 mLastParamWeight; @@ -107,10 +107,10 @@ protected: /*virtual */ ~LLVisualParamReset(){} public: LLVisualParamReset(); - /*virtual */ BOOL render(); + /*virtual */ bool render(); /*virtual*/ S8 getType() const ; - static BOOL sDirty; + static bool sDirty; }; #endif diff --git a/indra/newview/lltoolobjpicker.cpp b/indra/newview/lltoolobjpicker.cpp index b91ab03ab9..20089b15a3 100644 --- a/indra/newview/lltoolobjpicker.cpp +++ b/indra/newview/lltoolobjpicker.cpp @@ -47,18 +47,18 @@ LLToolObjPicker::LLToolObjPicker() : LLTool( std::string("ObjPicker"), NULL ), - mPicked( FALSE ), + mPicked( false ), mHitObjectID( LLUUID::null ), mExitCallback( NULL ), mExitCallbackData( NULL ) { } -// returns TRUE if an object was selected -BOOL LLToolObjPicker::handleMouseDown(S32 x, S32 y, MASK mask) +// returns true if an object was selected +bool LLToolObjPicker::handleMouseDown(S32 x, S32 y, MASK mask) { LLRootView* viewp = gViewerWindow->getRootView(); - BOOL handled = viewp->handleMouseDown(x, y, mask); + bool handled = viewp->handleMouseDown(x, y, mask); mHitObjectID.setNull(); @@ -66,13 +66,13 @@ BOOL LLToolObjPicker::handleMouseDown(S32 x, S32 y, MASK mask) { // didn't click in any UI object, so must have clicked in the world gViewerWindow->pickAsync(x, y, mask, pickCallback); - handled = TRUE; + handled = true; } else { if (hasMouseCapture()) { - setMouseCapture(FALSE); + setMouseCapture(false); } else { @@ -93,10 +93,10 @@ void LLToolObjPicker::pickCallback(const LLPickInfo& pick_info) } -BOOL LLToolObjPicker::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLToolObjPicker::handleMouseUp(S32 x, S32 y, MASK mask) { LLView* viewp = gViewerWindow->getRootView(); - BOOL handled = viewp->handleHover(x, y, mask); + bool handled = viewp->handleHover(x, y, mask); if (handled) { // let UI handle this @@ -105,7 +105,7 @@ BOOL LLToolObjPicker::handleMouseUp(S32 x, S32 y, MASK mask) LLTool::handleMouseUp(x, y, mask); if (hasMouseCapture()) { - setMouseCapture(FALSE); + setMouseCapture(false); } else { @@ -115,10 +115,10 @@ BOOL LLToolObjPicker::handleMouseUp(S32 x, S32 y, MASK mask) } -BOOL LLToolObjPicker::handleHover(S32 x, S32 y, MASK mask) +bool LLToolObjPicker::handleHover(S32 x, S32 y, MASK mask) { LLView *viewp = gViewerWindow->getRootView(); - BOOL handled = viewp->handleHover(x, y, mask); + bool handled = viewp->handleHover(x, y, mask); if (!handled) { // Used to do pick on hover. Now we just always display the cursor. @@ -142,7 +142,7 @@ void LLToolObjPicker::onMouseCaptureLost() mExitCallbackData = NULL; } - mPicked = FALSE; + mPicked = false; mHitObjectID.setNull(); } @@ -157,7 +157,7 @@ void LLToolObjPicker::setExitCallback(void (*callback)(void *), void *callback_d void LLToolObjPicker::handleSelect() { LLTool::handleSelect(); - setMouseCapture(TRUE); + setMouseCapture(true); } // virtual @@ -166,7 +166,7 @@ void LLToolObjPicker::handleDeselect() if (hasMouseCapture()) { LLTool::handleDeselect(); - setMouseCapture(FALSE); + setMouseCapture(false); } } diff --git a/indra/newview/lltoolobjpicker.h b/indra/newview/lltoolobjpicker.h index ceeb45c74e..3420541a31 100644 --- a/indra/newview/lltoolobjpicker.h +++ b/indra/newview/lltoolobjpicker.h @@ -38,9 +38,9 @@ class LLToolObjPicker : public LLTool, public LLSingleton<LLToolObjPicker> LLSINGLETON(LLToolObjPicker); public: - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override; - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override; - virtual BOOL handleHover(S32 x, S32 y, MASK mask) override; + virtual bool handleMouseDown(S32 x, S32 y, MASK mask) override; + virtual bool handleMouseUp(S32 x, S32 y, MASK mask) override; + virtual bool handleHover(S32 x, S32 y, MASK mask) override; virtual void handleSelect() override; virtual void handleDeselect() override; @@ -54,7 +54,7 @@ public: static void pickCallback(const LLPickInfo& pick_info); protected: - BOOL mPicked; + bool mPicked; LLUUID mHitObjectID; void (*mExitCallback)(void *callback_data); void *mExitCallbackData; diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index b8cfc5fbe2..531e657a1e 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -73,7 +73,7 @@ #include "pipeline.h" // setHighlightObject #include "lluiusage.h" -extern BOOL gDebugClicks; +extern bool gDebugClicks; static void handle_click_action_play(); static void handle_click_action_open_media(LLPointer<LLViewerObject> objectp); @@ -86,15 +86,15 @@ LLToolPie::LLToolPie() mMouseSteerX(-1), mMouseSteerY(-1), mClickAction(0), - mClickActionBuyEnabled( TRUE ), - mClickActionPayEnabled( TRUE ), + mClickActionBuyEnabled( true ), + mClickActionPayEnabled( true ), mDoubleClickTimer() { } -BOOL LLToolPie::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down) +bool LLToolPie::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, bool down) { - BOOL result = LLMouseHandler::handleAnyMouseClick(x, y, mask, clicktype, down); + bool result = LLMouseHandler::handleAnyMouseClick(x, y, mask, clicktype, down); // This override DISABLES the keyboard focus reset that LLTool::handleAnyMouseClick adds. // LLToolPie will do the right thing in its pick callback. @@ -102,20 +102,20 @@ BOOL LLToolPie::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType cli return result; } -BOOL LLToolPie::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLToolPie::handleMouseDown(S32 x, S32 y, MASK mask) { if (mDoubleClickTimer.getStarted()) { mDoubleClickTimer.stop(); } - mMouseOutsideSlop = FALSE; + mMouseOutsideSlop = false; mMouseDownX = x; mMouseDownY = y; LLTimer pick_timer; - BOOL pick_rigged = false; //gSavedSettings.getBOOL("AnimatedObjectsAllowLeftClick"); - LLPickInfo transparent_pick = gViewerWindow->pickImmediate(x, y, TRUE /*includes transparent*/, pick_rigged, FALSE, TRUE, FALSE); - LLPickInfo visible_pick = gViewerWindow->pickImmediate(x, y, FALSE, pick_rigged); + bool pick_rigged = false; //gSavedSettings.getBOOL("AnimatedObjectsAllowLeftClick"); + LLPickInfo transparent_pick = gViewerWindow->pickImmediate(x, y, true /*includes transparent*/, pick_rigged, false, true, false); + LLPickInfo visible_pick = gViewerWindow->pickImmediate(x, y, false, pick_rigged); LLViewerObject *transp_object = transparent_pick.getObject(); LLViewerObject *visible_object = visible_pick.getObject(); @@ -179,16 +179,16 @@ BOOL LLToolPie::handleMouseDown(S32 x, S32 y, MASK mask) // Spawn context menus on right mouse down so you can drag over and select // an item. -BOOL LLToolPie::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLToolPie::handleRightMouseDown(S32 x, S32 y, MASK mask) { - BOOL pick_reflection_probe = gSavedSettings.getBOOL("SelectReflectionProbes"); + bool pick_reflection_probe = gSavedSettings.getBOOL("SelectReflectionProbes"); // don't pick transparent so users can't "pay" transparent objects mPick = gViewerWindow->pickImmediate(x, y, - /*BOOL pick_transparent*/ FALSE, - /*BOOL pick_rigged*/ TRUE, - /*BOOL pick_particle*/ TRUE, - /*BOOL pick_unselectable*/ TRUE, + /*bool pick_transparent*/ false, + /*bool pick_rigged*/ true, + /*bool pick_particle*/ true, + /*bool pick_unselectable*/ true, pick_reflection_probe); mPick.mKeyMask = mask; @@ -197,18 +197,18 @@ BOOL LLToolPie::handleRightMouseDown(S32 x, S32 y, MASK mask) { handleRightClickPick(); } - return FALSE; + return false; } -BOOL LLToolPie::handleRightMouseUp(S32 x, S32 y, MASK mask) +bool LLToolPie::handleRightMouseUp(S32 x, S32 y, MASK mask) { LLToolMgr::getInstance()->clearTransientTool(); return LLTool::handleRightMouseUp(x, y, mask); } -BOOL LLToolPie::handleScrollWheelAny(S32 x, S32 y, S32 clicks_x, S32 clicks_y) +bool LLToolPie::handleScrollWheelAny(S32 x, S32 y, S32 clicks_x, S32 clicks_y) { - BOOL res = FALSE; + bool res = false; // mHoverPick should have updated on its own and we should have a face // in LLViewerMediaFocus in case of media, so just reuse mHoverPick if (mHoverPick.mUVCoords.mV[VX] >= 0.f && mHoverPick.mUVCoords.mV[VY] >= 0.f) @@ -223,18 +223,18 @@ BOOL LLToolPie::handleScrollWheelAny(S32 x, S32 y, S32 clicks_x, S32 clicks_y) return res; } -BOOL LLToolPie::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLToolPie::handleScrollWheel(S32 x, S32 y, S32 clicks) { return handleScrollWheelAny(x, y, 0, clicks); } -BOOL LLToolPie::handleScrollHWheel(S32 x, S32 y, S32 clicks) +bool LLToolPie::handleScrollHWheel(S32 x, S32 y, S32 clicks) { return handleScrollWheelAny(x, y, clicks, 0); } // True if you selected an object. -BOOL LLToolPie::handleLeftClickPick() +bool LLToolPie::handleLeftClickPick() { S32 x = mPick.mMousePt.mX; S32 y = mPick.mMousePt.mY; @@ -249,7 +249,7 @@ BOOL LLToolPie::handleLeftClickPick() && !LLViewerParcelMgr::getInstance()->isCollisionBanned()) { // if selling passes, just buy one - void* deselect_when_done = (void*)TRUE; + void* deselect_when_done = (void*)true; LLPanelLandGeneral::onClickBuyPass(deselect_when_done); } else @@ -279,7 +279,7 @@ BOOL LLToolPie::handleLeftClickPick() if (handleMediaClick(mPick)) { - return TRUE; + return true; } // If it's a left-click, and we have a special action, do it. @@ -307,7 +307,7 @@ BOOL LLToolPie::handleLeftClickPick() handle_object_sit_or_stand(); // put focus in world when sitting on an object gFocusMgr.setKeyboardFocus(NULL); - return TRUE; + return true; } // else nothing (fall through to touch) } case CLICK_ACTION_PAY: @@ -318,13 +318,13 @@ BOOL LLToolPie::handleLeftClickPick() { // pay event goes to object actually clicked on mClickActionObject = object; - mLeftClickSelection = LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE); + mLeftClickSelection = LLToolSelect::handleObjectSelection(mPick, false, true); if (LLSelectMgr::getInstance()->selectGetAllValid()) { // call this right away, since we have all the info we need to continue the action selectionPropertiesReceived(); } - return TRUE; + return true; } } break; @@ -332,34 +332,34 @@ BOOL LLToolPie::handleLeftClickPick() if ( mClickActionBuyEnabled ) { mClickActionObject = parent; - mLeftClickSelection = LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE, TRUE); + mLeftClickSelection = LLToolSelect::handleObjectSelection(mPick, false, true, true); if (LLSelectMgr::getInstance()->selectGetAllValid()) { // call this right away, since we have all the info we need to continue the action selectionPropertiesReceived(); } - return TRUE; + return true; } break; case CLICK_ACTION_OPEN: if (parent && parent->allowOpen()) { mClickActionObject = parent; - mLeftClickSelection = LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE, TRUE); + mLeftClickSelection = LLToolSelect::handleObjectSelection(mPick, false, true, true); if (LLSelectMgr::getInstance()->selectGetAllValid()) { // call this right away, since we have all the info we need to continue the action selectionPropertiesReceived(); } } - return TRUE; + return true; case CLICK_ACTION_PLAY: handle_click_action_play(); - return TRUE; + return true; case CLICK_ACTION_OPEN_MEDIA: // mClickActionObject = object; handle_click_action_open_media(object); - return TRUE; + return true; case CLICK_ACTION_ZOOM: { const F32 PADDING_FACTOR = 2.f; @@ -367,7 +367,7 @@ BOOL LLToolPie::handleLeftClickPick() if (object) { - gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); + gAgentCamera.setFocusOnAvatar(false, ANIMATE); LLBBox bbox = object->getBoundingBoxAgent() ; F32 angle_of_view = llmax(0.1f, LLViewerCamera::getInstance()->getAspect() > 1.f ? LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect() : LLViewerCamera::getInstance()->getView()); @@ -382,9 +382,9 @@ BOOL LLToolPie::handleLeftClickPick() mPick.mObjectID ); } } - return TRUE; + return true; case CLICK_ACTION_DISABLED: - return TRUE; + return true; default: // nothing break; @@ -444,12 +444,12 @@ BOOL LLToolPie::handleLeftClickPick() mMouseButtonDown = false; LLToolMgr::getInstance()->setTransientTool(LLToolCamera::getInstance()); gViewerWindow->hideCursor(); - LLToolCamera::getInstance()->setMouseCapture(TRUE); + LLToolCamera::getInstance()->setMouseCapture(true); LLToolCamera::getInstance()->setClickPickPending(); LLToolCamera::getInstance()->pickCallback(mPick); - gAgentCamera.setFocusOnAvatar(TRUE, TRUE); + gAgentCamera.setFocusOnAvatar(true, true); - return TRUE; + return true; } ////////// // // Could be first left-click on nothing @@ -459,7 +459,7 @@ BOOL LLToolPie::handleLeftClickPick() return LLTool::handleMouseDown(x, y, mask); } -BOOL LLToolPie::useClickAction(MASK mask, +bool LLToolPie::useClickAction(MASK mask, LLViewerObject* object, LLViewerObject* parent) { @@ -578,9 +578,9 @@ bool LLToolPie::walkToClickedLocation() if (gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK) { mPick = gViewerWindow->pickImmediate(mHoverPick.mMousePt.mX, mHoverPick.mMousePt.mY, - FALSE /* ignore transparent */, - FALSE /* ignore rigged */, - FALSE /* ignore particles */); + false /* ignore transparent */, + false /* ignore rigged */, + false /* ignore particles */); } else { @@ -588,9 +588,9 @@ bool LLToolPie::walkToClickedLocation() // use croshair's position to do a pick mPick = gViewerWindow->pickImmediate(gViewerWindow->getWorldViewRectScaled().getWidth() / 2, gViewerWindow->getWorldViewRectScaled().getHeight() / 2, - FALSE /* ignore transparent */, - FALSE /* ignore rigged */, - FALSE /* ignore particles */); + false /* ignore transparent */, + false /* ignore rigged */, + false /* ignore particles */); } if (mPick.mPickType == LLPickInfo::PICK_OBJECT) @@ -620,17 +620,17 @@ bool LLToolPie::walkToClickedLocation() if ((mPick.mPickType == LLPickInfo::PICK_LAND && !mPick.mPosGlobal.isExactlyZero()) || (mPick.mObjectID.notNull() && !mPick.mPosGlobal.isExactlyZero())) { - gAgentCamera.setFocusOnAvatar(TRUE, TRUE); + gAgentCamera.setFocusOnAvatar(true, true); if (mAutoPilotDestination) { mAutoPilotDestination->markDead(); } - mAutoPilotDestination = (LLHUDEffectBlob *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BLOB, FALSE); + mAutoPilotDestination = (LLHUDEffectBlob *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BLOB, false); mAutoPilotDestination->setPositionGlobal(mPick.mPosGlobal); mAutoPilotDestination->setPixelSize(5); mAutoPilotDestination->setColor(LLColor4U(170, 210, 190)); mAutoPilotDestination->setDuration(3.f); LLVector3d pos = LLToolPie::getInstance()->getPick().mPosGlobal; - gAgent.startAutoPilotGlobal(pos, std::string(), NULL, NULL, NULL, 0.f, 0.03f, FALSE); + gAgent.startAutoPilotGlobal(pos, std::string(), NULL, NULL, NULL, 0.f, 0.03f, false); LLFirstUse::notMoving(false); showVisualContextMenuEffect(); return true; @@ -653,10 +653,10 @@ bool LLToolPie::teleportToClickedLocation() { // We do not handle hover in mouselook as we do in other modes, so // use croshair's position to do a pick - BOOL pick_rigged = false; + bool pick_rigged = false; mHoverPick = gViewerWindow->pickImmediate(gViewerWindow->getWorldViewRectScaled().getWidth() / 2, gViewerWindow->getWorldViewRectScaled().getHeight() / 2, - FALSE, + false, pick_rigged); } LLViewerObject* objp = mHoverPick.getObject(); @@ -736,10 +736,10 @@ void LLToolPie::selectionPropertiesReceived() LLToolPie::getInstance()->resetSelection(); } -BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask) +bool LLToolPie::handleHover(S32 x, S32 y, MASK mask) { - BOOL pick_rigged = false; //gSavedSettings.getBOOL("AnimatedObjectsAllowLeftClick"); - mHoverPick = gViewerWindow->pickImmediate(x, y, FALSE, pick_rigged); + bool pick_rigged = false; //gSavedSettings.getBOOL("AnimatedObjectsAllowLeftClick"); + mHoverPick = gViewerWindow->pickImmediate(x, y, false, pick_rigged); LLViewerObject *parent = NULL; LLViewerObject *object = mHoverPick.getObject(); LLSelectMgr::getInstance()->setHoverObject(object, mHoverPick.mObjectFace); @@ -775,7 +775,7 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask) else { // perform a separate pick that detects transparent objects since they respond to 1-click actions - LLPickInfo click_action_pick = gViewerWindow->pickImmediate(x, y, FALSE, pick_rigged); + LLPickInfo click_action_pick = gViewerWindow->pickImmediate(x, y, false, pick_rigged); LLViewerObject* click_action_object = click_action_pick.getObject(); @@ -811,10 +811,10 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask) LLViewerMediaFocus::getInstance()->clearHover(); } - return TRUE; + return true; } -BOOL LLToolPie::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLToolPie::handleMouseUp(S32 x, S32 y, MASK mask) { if (!mDoubleClickTimer.getStarted()) { @@ -832,7 +832,7 @@ BOOL LLToolPie::handleMouseUp(S32 x, S32 y, MASK mask) gViewerWindow->setCursor(UI_CURSOR_ARROW); if (hasMouseCapture()) { - setMouseCapture(FALSE); + setMouseCapture(false); } LLToolMgr::getInstance()->clearTransientTool(); @@ -851,7 +851,7 @@ void LLToolPie::stopClickToWalk() } } -BOOL LLToolPie::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLToolPie::handleDoubleClick(S32 x, S32 y, MASK mask) { if (gDebugClicks) { @@ -860,17 +860,17 @@ BOOL LLToolPie::handleDoubleClick(S32 x, S32 y, MASK mask) if (handleMediaDblClick(mPick)) { - return TRUE; + return true; } if (!mDoubleClickTimer.getStarted() || (mDoubleClickTimer.getElapsedTimeF32() > 0.3f)) { mDoubleClickTimer.stop(); - return FALSE; + return false; } mDoubleClickTimer.stop(); - return FALSE; + return false; } static bool needs_tooltip(LLSelectNode* nodep) @@ -881,10 +881,10 @@ static bool needs_tooltip(LLSelectNode* nodep) } -BOOL LLToolPie::handleTooltipLand(std::string line, std::string tooltip_msg) +bool LLToolPie::handleTooltipLand(std::string line, std::string tooltip_msg) { // Do not show hover for land unless prefs are set to allow it. - if (!gSavedSettings.getBOOL("ShowLandHoverTip")) return TRUE; + if (!gSavedSettings.getBOOL("ShowLandHoverTip")) return true; LLViewerParcelMgr::getInstance()->setHoverParcel( mHoverPick.mPosGlobal ); @@ -1038,16 +1038,16 @@ BOOL LLToolPie::handleTooltipLand(std::string line, std::string tooltip_msg) LLToolTipMgr::instance().show(tooltip_msg); } - return TRUE; + return true; } -BOOL LLToolPie::handleTooltipObject( LLViewerObject* hover_object, std::string line, std::string tooltip_msg) +bool LLToolPie::handleTooltipObject( LLViewerObject* hover_object, std::string line, std::string tooltip_msg) { if ( hover_object->isHUDAttachment() ) { // no hover tips for HUD elements, since they can obscure // what the HUD is displaying - return TRUE; + return true; } if ( hover_object->isAttachment() ) @@ -1057,13 +1057,13 @@ BOOL LLToolPie::handleTooltipObject( LLViewerObject* hover_object, std::string l if (!root_edit) { // Strange parenting issue, don't show any text - return TRUE; + return true; } hover_object = (LLViewerObject*)root_edit->getParent(); if (!hover_object) { // another strange parenting issue, bail out - return TRUE; + return true; } } @@ -1221,14 +1221,14 @@ BOOL LLToolPie::handleTooltipObject( LLViewerObject* hover_object, std::string l } } - return TRUE; + return true; } -BOOL LLToolPie::handleToolTip(S32 local_x, S32 local_y, MASK mask) +bool LLToolPie::handleToolTip(S32 local_x, S32 local_y, MASK mask) { static LLCachedControl<bool> show_hover_tips(*LLUI::getInstance()->mSettingGroups["config"], "ShowHoverTips", true); - if (!show_hover_tips) return TRUE; - if (!mHoverPick.isValid()) return TRUE; + if (!show_hover_tips) return true; + if (!mHoverPick.isValid()) return true; LLViewerObject* hover_object = mHoverPick.getObject(); @@ -1248,7 +1248,7 @@ BOOL LLToolPie::handleToolTip(S32 local_x, S32 local_y, MASK mask) handleTooltipLand(line, tooltip_msg); } - return TRUE; + return true; } static void show_inspector(const char* inspector, const char* param, const LLUUID& source_id) @@ -1406,14 +1406,14 @@ void LLToolPie::handleDeselect() { if( hasMouseCapture() ) { - setMouseCapture( FALSE ); // Calls onMouseCaptureLost() indirectly + setMouseCapture( false ); // Calls onMouseCaptureLost() indirectly } // remove temporary selection for pie menu LLSelectMgr::getInstance()->setHoverObject(NULL); // Menu may be still up during transfer to different tool. // toolfocus and toolgrab should retain menu, they will clear it if needed - MASK override_mask = gKeyboard ? gKeyboard->currentMask(TRUE) : 0; + MASK override_mask = gKeyboard ? gKeyboard->currentMask(true) : 0; if (gMenuHolder && (!gMenuHolder->getVisible() || (override_mask & (MASK_ALT | MASK_CONTROL)) == 0)) { // in most cases menu is useless without correct selection, so either keep both or discard both @@ -1442,7 +1442,7 @@ void LLToolPie::stopEditing() { if( hasMouseCapture() ) { - setMouseCapture( FALSE ); // Calls onMouseCaptureLost() indirectly + setMouseCapture( false ); // Calls onMouseCaptureLost() indirectly } } @@ -1464,7 +1464,7 @@ bool LLToolPie::inCameraSteerMode() } // true if x,y outside small box around start_x,start_y -BOOL LLToolPie::outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y) +bool LLToolPie::outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y) { S32 dx = x - start_x; S32 dy = y - start_y; @@ -1541,9 +1541,9 @@ bool LLToolPie::handleMediaClick(const LLPickInfo& pick) gFocusMgr.setKeyboardFocus(LLViewerMediaFocus::getInstance()); LLEditMenuHandler::gEditMenuHandler = LLViewerMediaFocus::instance().getFocusedMediaImpl(); - media_impl->mouseDown(pick.mUVCoords, gKeyboard->currentMask(TRUE)); + media_impl->mouseDown(pick.mUVCoords, gKeyboard->currentMask(true)); mMediaMouseCaptureID = mep->getMediaID(); - setMouseCapture(TRUE); // This object will send a mouse-up to the media when it loses capture. + setMouseCapture(true); // This object will send a mouse-up to the media when it loses capture. } return true; @@ -1595,9 +1595,9 @@ bool LLToolPie::handleMediaDblClick(const LLPickInfo& pick) gFocusMgr.setKeyboardFocus(LLViewerMediaFocus::getInstance()); LLEditMenuHandler::gEditMenuHandler = LLViewerMediaFocus::instance().getFocusedMediaImpl(); - media_impl->mouseDoubleClick(pick.mUVCoords, gKeyboard->currentMask(TRUE)); + media_impl->mouseDoubleClick(pick.mUVCoords, gKeyboard->currentMask(true)); mMediaMouseCaptureID = mep->getMediaID(); - setMouseCapture(TRUE); // This object will send a mouse-up to the media when it loses capture. + setMouseCapture(true); // This object will send a mouse-up to the media when it loses capture. } return true; @@ -1648,7 +1648,7 @@ bool LLToolPie::handleMediaHover(const LLPickInfo& pick) // If this is the focused media face, send mouse move events. if (LLViewerMediaFocus::getInstance()->isFocusedOnFace(objectp, pick.mObjectFace)) { - media_impl->mouseMove(pick.mUVCoords, gKeyboard->currentMask(TRUE)); + media_impl->mouseMove(pick.mUVCoords, gKeyboard->currentMask(true)); gViewerWindow->setCursor(media_impl->getLastSetCursor()); } else @@ -1744,7 +1744,7 @@ static ECursorType cursor_from_parcel_media(U8 click_action) // True if we handled the event. -BOOL LLToolPie::handleRightClickPick() +bool LLToolPie::handleRightClickPick() { S32 x = mPick.mMousePt.mX; S32 y = mPick.mMousePt.mY; @@ -1759,7 +1759,7 @@ BOOL LLToolPie::handleRightClickPick() LLViewerObject *object = mPick.getObject(); // Can't ignore children here. - LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE); + LLToolSelect::handleObjectSelection(mPick, false, true); // Spawn pie menu if (mPick.mPickType == LLPickInfo::PICK_LAND) @@ -1777,7 +1777,7 @@ BOOL LLToolPie::handleRightClickPick() { //either at very early startup stage or at late quitting stage, //this event is ignored. - return TRUE ; + return true ; } gMenuAvatarSelf->show(x, y); @@ -1798,7 +1798,7 @@ BOOL LLToolPie::handleRightClickPick() if (!object) { - return TRUE; // unexpected, but escape + return true; // unexpected, but escape } // Object is an avatar, so check for mute by id. @@ -1860,13 +1860,13 @@ BOOL LLToolPie::handleRightClickPick() LLTool::handleRightMouseDown(x, y, mask); // We handled the event. - return TRUE; + return true; } void LLToolPie::showVisualContextMenuEffect() { // VEFFECT: ShowPie - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_SPHERE, TRUE); + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_SPHERE, true); effectp->setPositionGlobal(mPick.mPosGlobal); effectp->setColor(LLColor4U(gAgent.getEffectColor())); effectp->setDuration(0.25f); @@ -1938,7 +1938,7 @@ void LLToolPie::startCameraSteering() LLViewerCamera::instance().getOrigin() + gViewerWindow->mouseDirectionGlobal(mSteerPick.mMousePt.mX, mSteerPick.mMousePt.mY) * 100.f); } - setMouseCapture(TRUE); + setMouseCapture(true); mMouseSteerX = mMouseDownX; mMouseSteerY = mMouseDownY; @@ -1947,7 +1947,7 @@ void LLToolPie::startCameraSteering() mClockwise = camera_to_rotation_center * rotation_center_to_pick < 0.f; if (mMouseSteerGrabPoint) { mMouseSteerGrabPoint->markDead(); } - mMouseSteerGrabPoint = (LLHUDEffectBlob *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BLOB, FALSE); + mMouseSteerGrabPoint = (LLHUDEffectBlob *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BLOB, false); mMouseSteerGrabPoint->setPositionGlobal(mSteerPick.mPosGlobal); mMouseSteerGrabPoint->setColor(LLColor4U(170, 210, 190)); mMouseSteerGrabPoint->setPixelSize(5); diff --git a/indra/newview/lltoolpie.h b/indra/newview/lltoolpie.h index 94f87d5b0f..b3884a6bfc 100644 --- a/indra/newview/lltoolpie.h +++ b/indra/newview/lltoolpie.h @@ -42,17 +42,17 @@ class LLToolPie : public LLTool, public LLSingleton<LLToolPie> public: // Virtual functions inherited from LLMouseHandler - virtual BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down) override; - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override; - virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) override; - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override; - virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask) override; - virtual BOOL handleHover(S32 x, S32 y, MASK mask) override; - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override; - BOOL handleScrollWheelAny(S32 x, S32 y, S32 clicks_x, S32 clicks_y); - virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) override; - virtual BOOL handleScrollHWheel(S32 x, S32 y, S32 clicks) override; - virtual BOOL handleToolTip(S32 x, S32 y, MASK mask) override; + virtual bool handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, bool down) override; + virtual bool handleMouseDown(S32 x, S32 y, MASK mask) override; + virtual bool handleRightMouseDown(S32 x, S32 y, MASK mask) override; + virtual bool handleMouseUp(S32 x, S32 y, MASK mask) override; + virtual bool handleRightMouseUp(S32 x, S32 y, MASK mask) override; + virtual bool handleHover(S32 x, S32 y, MASK mask) override; + virtual bool handleDoubleClick(S32 x, S32 y, MASK mask) override; + bool handleScrollWheelAny(S32 x, S32 y, S32 clicks_x, S32 clicks_y); + virtual bool handleScrollWheel(S32 x, S32 y, S32 clicks) override; + virtual bool handleScrollHWheel(S32 x, S32 y, S32 clicks) override; + virtual bool handleToolTip(S32 x, S32 y, MASK mask) override; virtual void render() override; @@ -81,10 +81,10 @@ public: static void VisitHomePage(const LLPickInfo& info); private: - BOOL outsideSlop (S32 x, S32 y, S32 start_x, S32 start_y); - BOOL handleLeftClickPick(); - BOOL handleRightClickPick(); - BOOL useClickAction (MASK mask, LLViewerObject* object,LLViewerObject* parent); + bool outsideSlop (S32 x, S32 y, S32 start_x, S32 start_y); + bool handleLeftClickPick(); + bool handleRightClickPick(); + bool useClickAction (MASK mask, LLViewerObject* object,LLViewerObject* parent); void showVisualContextMenuEffect(); ECursorType cursorFromObject(LLViewerObject* object); @@ -93,8 +93,8 @@ private: bool handleMediaDblClick(const LLPickInfo& info); bool handleMediaHover(const LLPickInfo& info); bool handleMediaMouseUp(); - BOOL handleTooltipLand(std::string line, std::string tooltip_msg); - BOOL handleTooltipObject( LLViewerObject* hover_object, std::string line, std::string tooltip_msg); + bool handleTooltipLand(std::string line, std::string tooltip_msg); + bool handleTooltipObject( LLViewerObject* hover_object, std::string line, std::string tooltip_msg); void steerCameraWithMouse(S32 x, S32 y); void startCameraSteering(); @@ -118,8 +118,8 @@ private: LLPointer<LLViewerObject> mClickActionObject; U8 mClickAction; LLSafeHandle<LLObjectSelection> mLeftClickSelection; - BOOL mClickActionBuyEnabled; - BOOL mClickActionPayEnabled; + bool mClickActionBuyEnabled; + bool mClickActionPayEnabled; LLFrameTimer mDoubleClickTimer; }; diff --git a/indra/newview/lltoolpipette.cpp b/indra/newview/lltoolpipette.cpp index e1b2352c76..9e3d435688 100644 --- a/indra/newview/lltoolpipette.cpp +++ b/indra/newview/lltoolpipette.cpp @@ -48,7 +48,7 @@ LLToolPipette::LLToolPipette() : LLTool(std::string("Pipette")), - mSuccess(TRUE) + mSuccess(true) { } @@ -57,41 +57,41 @@ LLToolPipette::~LLToolPipette() { } -BOOL LLToolPipette::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLToolPipette::handleMouseDown(S32 x, S32 y, MASK mask) { - mSuccess = TRUE; + mSuccess = true; mTooltipMsg.clear(); - setMouseCapture(TRUE); + setMouseCapture(true); gViewerWindow->pickAsync(x, y, mask, pickCallback); - return TRUE; + return true; } -BOOL LLToolPipette::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLToolPipette::handleMouseUp(S32 x, S32 y, MASK mask) { - mSuccess = TRUE; + mSuccess = true; LLSelectMgr::getInstance()->unhighlightAll(); // *NOTE: This assumes the pipette tool is a transient tool. LLToolMgr::getInstance()->clearTransientTool(); - setMouseCapture(FALSE); - return TRUE; + setMouseCapture(false); + return true; } -BOOL LLToolPipette::handleHover(S32 x, S32 y, MASK mask) +bool LLToolPipette::handleHover(S32 x, S32 y, MASK mask) { gViewerWindow->setCursor(mSuccess ? UI_CURSOR_PIPETTE : UI_CURSOR_NO); if (hasMouseCapture()) // mouse button is down { gViewerWindow->pickAsync(x, y, mask, pickCallback); - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLToolPipette::handleToolTip(S32 x, S32 y, MASK mask) +bool LLToolPipette::handleToolTip(S32 x, S32 y, MASK mask) { if (mTooltipMsg.empty()) { - return FALSE; + return false; } LLRect sticky_rect; @@ -100,7 +100,7 @@ BOOL LLToolPipette::handleToolTip(S32 x, S32 y, MASK mask) .message(mTooltipMsg) .sticky_rect(sticky_rect)); - return TRUE; + return true; } void LLToolPipette::setTextureEntry(const LLTextureEntry* entry) @@ -129,7 +129,7 @@ void LLToolPipette::pickCallback(const LLPickInfo& pick_info) } } -void LLToolPipette::setResult(BOOL success, const std::string& msg) +void LLToolPipette::setResult(bool success, const std::string& msg) { mTooltipMsg = msg; mSuccess = success; diff --git a/indra/newview/lltoolpipette.h b/indra/newview/lltoolpipette.h index 44d06f5383..0f1574f2d5 100644 --- a/indra/newview/lltoolpipette.h +++ b/indra/newview/lltoolpipette.h @@ -47,15 +47,15 @@ class LLToolPipette virtual ~LLToolPipette(); public: - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override; - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override; - virtual BOOL handleHover(S32 x, S32 y, MASK mask) override; - virtual BOOL handleToolTip(S32 x, S32 y, MASK mask) override; + virtual bool handleMouseDown(S32 x, S32 y, MASK mask) override; + virtual bool handleMouseUp(S32 x, S32 y, MASK mask) override; + virtual bool handleHover(S32 x, S32 y, MASK mask) override; + virtual bool handleToolTip(S32 x, S32 y, MASK mask) override; // Note: Don't return connection; use boost::bind + boost::signals2::trackable to disconnect slots typedef boost::signals2::signal<void (const LLTextureEntry& te)> signal_t; void setToolSelectCallback(const signal_t::slot_type& cb) { mSignal.connect(cb); } - void setResult(BOOL success, const std::string& msg); + void setResult(bool success, const std::string& msg); void setTextureEntry(const LLTextureEntry* entry); static void pickCallback(const LLPickInfo& pick_info); @@ -63,7 +63,7 @@ public: protected: LLTextureEntry mTextureEntry; signal_t mSignal; - BOOL mSuccess; + bool mSuccess; std::string mTooltipMsg; }; diff --git a/indra/newview/lltoolplacer.cpp b/indra/newview/lltoolplacer.cpp index 2519c57e86..b15bb5efd5 100644 --- a/indra/newview/lltoolplacer.cpp +++ b/indra/newview/lltoolplacer.cpp @@ -74,14 +74,14 @@ LLToolPlacer::LLToolPlacer() { } -BOOL LLToolPlacer::raycastForNewObjPos( S32 x, S32 y, LLViewerObject** hit_obj, S32* hit_face, - BOOL* b_hit_land, LLVector3* ray_start_region, LLVector3* ray_end_region, LLViewerRegion** region ) +bool LLToolPlacer::raycastForNewObjPos( S32 x, S32 y, LLViewerObject** hit_obj, S32* hit_face, + bool* b_hit_land, LLVector3* ray_start_region, LLVector3* ray_end_region, LLViewerRegion** region ) { F32 max_dist_from_camera = gSavedSettings.getF32( "MaxSelectDistance" ) - 1.f; // Viewer-side pick to find the right sim to create the object on. // First find the surface the object will be created on. - LLPickInfo pick = gViewerWindow->pickImmediate(x, y, FALSE, FALSE); + LLPickInfo pick = gViewerWindow->pickImmediate(x, y, false, false); // Note: use the frontmost non-flora version because (a) plants usually have lots of alpha and (b) pants' Havok // representations (if any) are NOT the same as their viewer representation. @@ -99,12 +99,12 @@ BOOL LLToolPlacer::raycastForNewObjPos( S32 x, S32 y, LLViewerObject** hit_obj, LLVector3d land_pos_global = pick.mPosGlobal; // Make sure there's a surface to place the new object on. - BOOL bypass_sim_raycast = FALSE; + bool bypass_sim_raycast = false; LLVector3d surface_pos_global; if (*b_hit_land) { surface_pos_global = land_pos_global; - bypass_sim_raycast = TRUE; + bypass_sim_raycast = true; } else if (*hit_obj) @@ -113,7 +113,7 @@ BOOL LLToolPlacer::raycastForNewObjPos( S32 x, S32 y, LLViewerObject** hit_obj, } else { - return FALSE; + return false; } // Make sure the surface isn't too far away. @@ -121,7 +121,7 @@ BOOL LLToolPlacer::raycastForNewObjPos( S32 x, S32 y, LLViewerObject** hit_obj, F32 dist_to_surface_sq = (F32)((surface_pos_global - ray_start_global).magVecSquared()); if( dist_to_surface_sq > (max_dist_from_camera * max_dist_from_camera) ) { - return FALSE; + return false; } // Find the sim where the surface lives. @@ -129,7 +129,7 @@ BOOL LLToolPlacer::raycastForNewObjPos( S32 x, S32 y, LLViewerObject** hit_obj, if (!regionp) { LL_WARNS() << "Trying to add object outside of all known regions!" << LL_ENDL; - return FALSE; + return false; } // Find the simulator-side ray that will be used to place the object accurately @@ -152,35 +152,35 @@ BOOL LLToolPlacer::raycastForNewObjPos( S32 x, S32 y, LLViewerObject** hit_obj, *ray_end_region = regionp->getPosRegionFromGlobal( ray_end_global ); } - return TRUE; + return true; } -BOOL LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics ) +bool LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics ) { LLVector3 ray_start_region; LLVector3 ray_end_region; LLViewerRegion* regionp = NULL; - BOOL b_hit_land = FALSE; + bool b_hit_land = false; S32 hit_face = -1; LLViewerObject* hit_obj = NULL; U8 state = 0; - BOOL success = raycastForNewObjPos( x, y, &hit_obj, &hit_face, &b_hit_land, &ray_start_region, &ray_end_region, ®ionp ); + bool success = raycastForNewObjPos( x, y, &hit_obj, &hit_face, &b_hit_land, &ray_start_region, &ray_end_region, ®ionp ); if( !success ) { - return FALSE; + return false; } if( hit_obj && (hit_obj->isAvatar() || hit_obj->isAttachment()) ) { // Can't create objects on avatars or attachments - return FALSE; + return false; } if (NULL == regionp) { LL_WARNS() << "regionp was NULL; aborting function." << LL_ENDL; - return FALSE; + return false; } if (regionp->getRegionFlag(REGION_FLAGS_SANDBOX)) @@ -192,7 +192,7 @@ BOOL LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics ) LLQuaternion rotation; LLVector3 scale = DEFAULT_OBJECT_SCALE; U8 material = LL_MCODE_WOOD; - BOOL create_selected = FALSE; + bool create_selected = false; LLVolumeParams volume_params; switch (pcode) @@ -217,7 +217,7 @@ BOOL LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics ) case LLViewerObject::LL_VO_SQUARE_TORUS: case LLViewerObject::LL_VO_TRIANGLE_TORUS: default: - create_selected = TRUE; + create_selected = true; break; } @@ -401,7 +401,7 @@ BOOL LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics ) gMessageSystem->addVector3Fast(_PREHASH_RayStart, ray_start_region ); gMessageSystem->addVector3Fast(_PREHASH_RayEnd, ray_end_region ); gMessageSystem->addU8Fast(_PREHASH_BypassRaycast, (U8)b_hit_land ); - gMessageSystem->addU8Fast(_PREHASH_RayEndIsIntersection, (U8)FALSE ); + gMessageSystem->addU8Fast(_PREHASH_RayEndIsIntersection, (U8)false ); gMessageSystem->addU8Fast(_PREHASH_State, state); // Limit raycast to a single object. @@ -429,7 +429,7 @@ BOOL LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics ) } // VEFFECT: AddObject - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, true); effectp->setSourceObject((LLViewerObject*)gAgentAvatarp); effectp->setPositionGlobal(regionp->getPosGlobalFromRegion(ray_end_region)); effectp->setDuration(LL_HUD_DUR_SHORT); @@ -437,30 +437,30 @@ BOOL LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics ) add(LLStatViewer::OBJECT_CREATE, 1); - return TRUE; + return true; } // Used by the placer tool to add copies of the current selection. // Inspired by add_object(). JC -BOOL LLToolPlacer::addDuplicate(S32 x, S32 y) +bool LLToolPlacer::addDuplicate(S32 x, S32 y) { LLVector3 ray_start_region; LLVector3 ray_end_region; LLViewerRegion* regionp = NULL; - BOOL b_hit_land = FALSE; + bool b_hit_land = false; S32 hit_face = -1; LLViewerObject* hit_obj = NULL; - BOOL success = raycastForNewObjPos( x, y, &hit_obj, &hit_face, &b_hit_land, &ray_start_region, &ray_end_region, ®ionp ); + bool success = raycastForNewObjPos( x, y, &hit_obj, &hit_face, &b_hit_land, &ray_start_region, &ray_end_region, ®ionp ); if( !success ) { make_ui_sound("UISndInvalidOp"); - return FALSE; + return false; } if( hit_obj && (hit_obj->isAvatar() || hit_obj->isAttachment()) ) { // Can't create objects on avatars or attachments make_ui_sound("UISndInvalidOp"); - return FALSE; + return false; } @@ -480,11 +480,11 @@ BOOL LLToolPlacer::addDuplicate(S32 x, S32 y) LLSelectMgr::getInstance()->selectDuplicateOnRay(ray_start_region, ray_end_region, b_hit_land, // suppress raycast - FALSE, // intersection + false, // intersection ray_target_id, gSavedSettings.getBOOL("CreateToolCopyCenters"), gSavedSettings.getBOOL("CreateToolCopyRotates"), - FALSE); // select copy + false); // select copy if (regionp && (regionp->getRegionFlag(REGION_FLAGS_SANDBOX))) @@ -492,13 +492,13 @@ BOOL LLToolPlacer::addDuplicate(S32 x, S32 y) //LLFirstUse::useSandbox(); } - return TRUE; + return true; } -BOOL LLToolPlacer::placeObject(S32 x, S32 y, MASK mask) +bool LLToolPlacer::placeObject(S32 x, S32 y, MASK mask) { - BOOL added = TRUE; + bool added = true; if (gSavedSettings.getBOOL("CreateToolCopySelection")) { @@ -506,7 +506,7 @@ BOOL LLToolPlacer::placeObject(S32 x, S32 y, MASK mask) } else { - added = addObject( sObjectType, x, y, FALSE ); + added = addObject( sObjectType, x, y, false ); } // ...and go back to the default tool @@ -518,11 +518,11 @@ BOOL LLToolPlacer::placeObject(S32 x, S32 y, MASK mask) return added; } -BOOL LLToolPlacer::handleHover(S32 x, S32 y, MASK mask) +bool LLToolPlacer::handleHover(S32 x, S32 y, MASK mask) { LL_DEBUGS("UserInput") << "hover handled by LLToolPlacer" << LL_ENDL; gViewerWindow->setCursor(UI_CURSOR_TOOLCREATE); - return TRUE; + return true; } void LLToolPlacer::handleSelect() diff --git a/indra/newview/lltoolplacer.h b/indra/newview/lltoolplacer.h index d5e4a587d7..f9501f83b2 100644 --- a/indra/newview/lltoolplacer.h +++ b/indra/newview/lltoolplacer.h @@ -42,8 +42,8 @@ class LLToolPlacer public: LLToolPlacer(); - virtual BOOL placeObject(S32 x, S32 y, MASK mask); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); + virtual bool placeObject(S32 x, S32 y, MASK mask); + virtual bool handleHover(S32 x, S32 y, MASK mask); virtual void handleSelect(); // do stuff when your tool is selected virtual void handleDeselect(); // clean up when your tool is deselected @@ -54,10 +54,10 @@ protected: static LLPCode sObjectType; private: - BOOL addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics ); - BOOL raycastForNewObjPos( S32 x, S32 y, LLViewerObject** hit_obj, S32* hit_face, - BOOL* b_hit_land, LLVector3* ray_start_region, LLVector3* ray_end_region, LLViewerRegion** region ); - BOOL addDuplicate(S32 x, S32 y); + bool addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics ); + bool raycastForNewObjPos( S32 x, S32 y, LLViewerObject** hit_obj, S32* hit_face, + bool* b_hit_land, LLVector3* ray_start_region, LLVector3* ray_end_region, LLViewerRegion** region ); + bool addDuplicate(S32 x, S32 y); }; #endif diff --git a/indra/newview/lltoolselect.cpp b/indra/newview/lltoolselect.cpp index 5960989166..cc04f9e3fc 100644 --- a/indra/newview/lltoolselect.cpp +++ b/indra/newview/lltoolselect.cpp @@ -49,26 +49,26 @@ #include "llworld.h" // Globals -//extern BOOL gAllowSelectAvatar; +//extern bool gAllowSelectAvatar; const F32 SELECTION_ROTATION_TRESHOLD = 0.1f; const F32 SELECTION_SITTING_ROTATION_TRESHOLD = 3.2f; //radian LLToolSelect::LLToolSelect( LLToolComposite* composite ) : LLTool( std::string("Select"), composite ), - mIgnoreGroup( FALSE ) + mIgnoreGroup( false ) { } // True if you selected an object. -BOOL LLToolSelect::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLToolSelect::handleMouseDown(S32 x, S32 y, MASK mask) { // do immediate pick query - BOOL pick_rigged = false; //gSavedSettings.getBOOL("AnimatedObjectsAllowLeftClick"); - BOOL pick_transparent = gSavedSettings.getBOOL("SelectInvisibleObjects"); - BOOL pick_reflection_probe = gSavedSettings.getBOOL("SelectReflectionProbes"); + bool pick_rigged = false; //gSavedSettings.getBOOL("AnimatedObjectsAllowLeftClick"); + bool pick_transparent = gSavedSettings.getBOOL("SelectInvisibleObjects"); + bool pick_reflection_probe = gSavedSettings.getBOOL("SelectReflectionProbes"); - mPick = gViewerWindow->pickImmediate(x, y, pick_transparent, pick_rigged, FALSE, TRUE, pick_reflection_probe); + mPick = gViewerWindow->pickImmediate(x, y, pick_transparent, pick_rigged, false, true, pick_reflection_probe); // Pass mousedown to agent LLTool::handleMouseDown(x, y, mask); @@ -78,25 +78,25 @@ BOOL LLToolSelect::handleMouseDown(S32 x, S32 y, MASK mask) // static -LLObjectSelectionHandle LLToolSelect::handleObjectSelection(const LLPickInfo& pick, BOOL ignore_group, BOOL temp_select, BOOL select_root) +LLObjectSelectionHandle LLToolSelect::handleObjectSelection(const LLPickInfo& pick, bool ignore_group, bool temp_select, bool select_root) { LLViewerObject* object = pick.getObject(); if (select_root) { object = object->getRootEdit(); } - BOOL select_owned = gSavedSettings.getBOOL("SelectOwnedOnly"); - BOOL select_movable = gSavedSettings.getBOOL("SelectMovableOnly"); + bool select_owned = gSavedSettings.getBOOL("SelectOwnedOnly"); + bool select_movable = gSavedSettings.getBOOL("SelectMovableOnly"); // *NOTE: These settings must be cleaned up at bottom of function. if (temp_select || LLSelectMgr::getInstance()->mAllowSelectAvatar) { - gSavedSettings.setBOOL("SelectOwnedOnly", FALSE); - gSavedSettings.setBOOL("SelectMovableOnly", FALSE); - LLSelectMgr::getInstance()->setForceSelection(TRUE); + gSavedSettings.setBOOL("SelectOwnedOnly", false); + gSavedSettings.setBOOL("SelectMovableOnly", false); + LLSelectMgr::getInstance()->setForceSelection(true); } - BOOL extend_select = (pick.mKeyMask == MASK_SHIFT) || (pick.mKeyMask == MASK_CONTROL); + bool extend_select = (pick.mKeyMask == MASK_SHIFT) || (pick.mKeyMask == MASK_CONTROL); // If no object, check for icon, then just deselect if (!object) @@ -114,7 +114,7 @@ LLObjectSelectionHandle LLToolSelect::handleObjectSelection(const LLPickInfo& pi } else { - BOOL already_selected = object->isSelected(); + bool already_selected = object->isSelected(); if (already_selected && object->getNumTEs() > 0 && @@ -141,7 +141,7 @@ LLObjectSelectionHandle LLToolSelect::handleObjectSelection(const LLPickInfo& pi } else { - LLSelectMgr::getInstance()->deselectObjectAndFamily(object, TRUE, TRUE); + LLSelectMgr::getInstance()->deselectObjectAndFamily(object, true, true); } } else @@ -220,7 +220,7 @@ LLObjectSelectionHandle LLToolSelect::handleObjectSelection(const LLPickInfo& pi LLSelectNode* select_node = selection->findNode(root_object); if (select_node) { - select_node->setTransient(TRUE); + select_node->setTransient(true); } LLViewerObject::const_child_list_t& child_list = root_object->getChildren(); @@ -231,7 +231,7 @@ LLObjectSelectionHandle LLToolSelect::handleObjectSelection(const LLPickInfo& pi select_node = selection->findNode(child); if (select_node) { - select_node->setTransient(TRUE); + select_node->setTransient(true); } } @@ -244,17 +244,17 @@ LLObjectSelectionHandle LLToolSelect::handleObjectSelection(const LLPickInfo& pi { gSavedSettings.setBOOL("SelectOwnedOnly", select_owned); gSavedSettings.setBOOL("SelectMovableOnly", select_movable); - LLSelectMgr::getInstance()->setForceSelection(FALSE); + LLSelectMgr::getInstance()->setForceSelection(false); } return LLSelectMgr::getInstance()->getSelection(); } -BOOL LLToolSelect::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLToolSelect::handleMouseUp(S32 x, S32 y, MASK mask) { mIgnoreGroup = gSavedSettings.getBOOL("EditLinkedParts"); - handleObjectSelection(mPick, mIgnoreGroup, FALSE); + handleObjectSelection(mPick, mIgnoreGroup, false); return LLTool::handleMouseUp(x, y, mask); } @@ -263,7 +263,7 @@ void LLToolSelect::handleDeselect() { if( hasMouseCapture() ) { - setMouseCapture( FALSE ); // Calls onMouseCaptureLost() indirectly + setMouseCapture( false ); // Calls onMouseCaptureLost() indirectly } } @@ -272,7 +272,7 @@ void LLToolSelect::stopEditing() { if( hasMouseCapture() ) { - setMouseCapture( FALSE ); // Calls onMouseCaptureLost() indirectly + setMouseCapture( false ); // Calls onMouseCaptureLost() indirectly } } @@ -280,10 +280,10 @@ void LLToolSelect::onMouseCaptureLost() { // Finish drag - LLSelectMgr::getInstance()->enableSilhouette(TRUE); + LLSelectMgr::getInstance()->enableSilhouette(true); // Clean up drag-specific variables - mIgnoreGroup = FALSE; + mIgnoreGroup = false; } diff --git a/indra/newview/lltoolselect.h b/indra/newview/lltoolselect.h index c28e71b199..da2b046641 100644 --- a/indra/newview/lltoolselect.h +++ b/indra/newview/lltoolselect.h @@ -39,18 +39,18 @@ class LLToolSelect : public LLTool public: LLToolSelect( LLToolComposite* composite ); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); virtual void stopEditing(); - static LLSafeHandle<LLObjectSelection> handleObjectSelection(const LLPickInfo& pick, BOOL ignore_group, BOOL temp_select, BOOL select_root = FALSE); + static LLSafeHandle<LLObjectSelection> handleObjectSelection(const LLPickInfo& pick, bool ignore_group, bool temp_select, bool select_root = false); virtual void onMouseCaptureLost(); virtual void handleDeselect(); protected: - BOOL mIgnoreGroup; + bool mIgnoreGroup; LLUUID mSelectObjectID; LLPickInfo mPick; }; diff --git a/indra/newview/lltoolselectland.cpp b/indra/newview/lltoolselectland.cpp index 04fe837d2b..88553c7557 100644 --- a/indra/newview/lltoolselectland.cpp +++ b/indra/newview/lltoolselectland.cpp @@ -47,12 +47,12 @@ LLToolSelectLand::LLToolSelectLand( ) : LLTool( std::string("Parcel") ), mDragStartGlobal(), mDragEndGlobal(), - mDragEndValid(FALSE), + mDragEndValid(false), mDragStartX(0), mDragStartY(0), mDragEndX(0), mDragEndY(0), - mMouseOutsideSlop(FALSE), + mMouseOutsideSlop(false), mWestSouthBottom(), mEastNorthTop() { } @@ -62,19 +62,19 @@ LLToolSelectLand::~LLToolSelectLand() } -BOOL LLToolSelectLand::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLToolSelectLand::handleMouseDown(S32 x, S32 y, MASK mask) { - BOOL hit_land = gViewerWindow->mousePointOnLandGlobal(x, y, &mDragStartGlobal); + bool hit_land = gViewerWindow->mousePointOnLandGlobal(x, y, &mDragStartGlobal); if (hit_land) { - setMouseCapture( TRUE ); + setMouseCapture( true ); mDragStartX = x; mDragStartY = y; mDragEndX = x; mDragEndY = y; - mDragEndValid = TRUE; + mDragEndValid = true; mDragEndGlobal = mDragStartGlobal; sanitize_corners(mDragStartGlobal, mDragEndGlobal, mWestSouthBottom, mEastNorthTop); @@ -85,7 +85,7 @@ BOOL LLToolSelectLand::handleMouseDown(S32 x, S32 y, MASK mask) roundXY(mWestSouthBottom); roundXY(mEastNorthTop); - mMouseOutsideSlop = TRUE; //FALSE; + mMouseOutsideSlop = true; //false; LLViewerParcelMgr::getInstance()->deselectLand(); } @@ -94,25 +94,25 @@ BOOL LLToolSelectLand::handleMouseDown(S32 x, S32 y, MASK mask) } -BOOL LLToolSelectLand::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLToolSelectLand::handleDoubleClick(S32 x, S32 y, MASK mask) { LLVector3d pos_global; - BOOL hit_land = gViewerWindow->mousePointOnLandGlobal(x, y, &pos_global); + bool hit_land = gViewerWindow->mousePointOnLandGlobal(x, y, &pos_global); if (hit_land) { // Auto-select this parcel LLViewerParcelMgr::getInstance()->selectParcelAt( pos_global ); - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLToolSelectLand::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLToolSelectLand::handleMouseUp(S32 x, S32 y, MASK mask) { if( hasMouseCapture() ) { - setMouseCapture( FALSE ); + setMouseCapture( false ); if (mMouseOutsideSlop && mDragEndValid) { @@ -129,35 +129,35 @@ BOOL LLToolSelectLand::handleMouseUp(S32 x, S32 y, MASK mask) roundXY(mEastNorthTop); // Don't auto-select entire parcel. - mSelection = LLViewerParcelMgr::getInstance()->selectLand( mWestSouthBottom, mEastNorthTop, FALSE ); + mSelection = LLViewerParcelMgr::getInstance()->selectLand( mWestSouthBottom, mEastNorthTop, false ); } - mMouseOutsideSlop = FALSE; - mDragEndValid = FALSE; + mMouseOutsideSlop = false; + mDragEndValid = false; - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLToolSelectLand::handleHover(S32 x, S32 y, MASK mask) +bool LLToolSelectLand::handleHover(S32 x, S32 y, MASK mask) { if( hasMouseCapture() ) { if (mMouseOutsideSlop || outsideSlop(x, y, mDragStartX, mDragStartY)) { - mMouseOutsideSlop = TRUE; + mMouseOutsideSlop = true; // Must do this every frame, in case the camera moved or the land moved // since last frame. // If doesn't hit land, doesn't change old value LLVector3d land_global; - BOOL hit_land = gViewerWindow->mousePointOnLandGlobal(x, y, &land_global); + bool hit_land = gViewerWindow->mousePointOnLandGlobal(x, y, &land_global); if (hit_land) { - mDragEndValid = TRUE; + mDragEndValid = true; mDragEndGlobal = land_global; sanitize_corners(mDragStartGlobal, mDragEndGlobal, mWestSouthBottom, mEastNorthTop); @@ -173,7 +173,7 @@ BOOL LLToolSelectLand::handleHover(S32 x, S32 y, MASK mask) } else { - mDragEndValid = FALSE; + mDragEndValid = false; LL_DEBUGS("UserInput") << "hover handled by LLToolSelectLand (active, no land)" << LL_ENDL; gViewerWindow->setCursor(UI_CURSOR_NO); } @@ -193,7 +193,7 @@ BOOL LLToolSelectLand::handleHover(S32 x, S32 y, MASK mask) gViewerWindow->setCursor(UI_CURSOR_ARROW); } - return TRUE; + return true; } @@ -225,7 +225,7 @@ void LLToolSelectLand::roundXY(LLVector3d &vec) // true if x,y outside small box around start_x,start_y -BOOL LLToolSelectLand::outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y) +bool LLToolSelectLand::outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y) { S32 dx = x - start_x; S32 dy = y - start_y; diff --git a/indra/newview/lltoolselectland.h b/indra/newview/lltoolselectland.h index 553211f7a0..15672aa7d4 100644 --- a/indra/newview/lltoolselectland.h +++ b/indra/newview/lltoolselectland.h @@ -39,24 +39,24 @@ class LLToolSelectLand virtual ~LLToolSelectLand(); public: - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleDoubleClick(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask) override; /*virtual*/ void render() override; // draw the select rectangle - /*virtual*/ BOOL isAlwaysRendered() override { return TRUE; } + /*virtual*/ bool isAlwaysRendered() override { return true; } /*virtual*/ void handleSelect() override; /*virtual*/ void handleDeselect() override; protected: - BOOL outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y); + bool outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y); void roundXY(LLVector3d& vec); protected: LLVector3d mDragStartGlobal; // global coords LLVector3d mDragEndGlobal; // global coords - BOOL mDragEndValid; // is drag end a valid point in the world? + bool mDragEndValid; // is drag end a valid point in the world? S32 mDragStartX; // screen coords, from left S32 mDragStartY; // screen coords, from bottom @@ -64,7 +64,7 @@ protected: S32 mDragEndX; S32 mDragEndY; - BOOL mMouseOutsideSlop; // has mouse ever gone outside slop region? + bool mMouseOutsideSlop; // has mouse ever gone outside slop region? LLVector3d mWestSouthBottom; // global coords, from drag LLVector3d mEastNorthTop; // global coords, from drag diff --git a/indra/newview/lltoolselectrect.cpp b/indra/newview/lltoolselectrect.cpp index eceb4e2675..f9bb70b24e 100644 --- a/indra/newview/lltoolselectrect.cpp +++ b/indra/newview/lltoolselectrect.cpp @@ -62,17 +62,17 @@ LLToolSelectRect::LLToolSelectRect( LLToolComposite* composite ) mDragEndY(0), mDragLastWidth(0), mDragLastHeight(0), - mMouseOutsideSlop(FALSE) + mMouseOutsideSlop(false) { } void dialog_refresh_all(void); -BOOL LLToolSelectRect::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLToolSelectRect::handleMouseDown(S32 x, S32 y, MASK mask) { - BOOL pick_rigged = false; //gSavedSettings.getBOOL("AnimatedObjectsAllowLeftClick"); - handlePick(gViewerWindow->pickImmediate(x, y, TRUE /* pick_transparent */, pick_rigged)); + bool pick_rigged = false; //gSavedSettings.getBOOL("AnimatedObjectsAllowLeftClick"); + handlePick(gViewerWindow->pickImmediate(x, y, true /* pick_transparent */, pick_rigged)); LLTool::handleMouseDown(x, y, mask); @@ -84,27 +84,27 @@ void LLToolSelectRect::handlePick(const LLPickInfo& pick) mPick = pick; // start dragging rectangle - setMouseCapture( TRUE ); + setMouseCapture( true ); mDragStartX = pick.mMousePt.mX; mDragStartY = pick.mMousePt.mY; mDragEndX = pick.mMousePt.mX; mDragEndY = pick.mMousePt.mY; - mMouseOutsideSlop = FALSE; + mMouseOutsideSlop = false; } -BOOL LLToolSelectRect::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLToolSelectRect::handleMouseUp(S32 x, S32 y, MASK mask) { - setMouseCapture( FALSE ); + setMouseCapture( false ); if( mMouseOutsideSlop ) { mDragLastWidth = 0; mDragLastHeight = 0; - mMouseOutsideSlop = FALSE; + mMouseOutsideSlop = false; if (mask == MASK_CONTROL) { @@ -114,7 +114,7 @@ BOOL LLToolSelectRect::handleMouseUp(S32 x, S32 y, MASK mask) { LLSelectMgr::getInstance()->selectHighlightedObjects(); } - return TRUE; + return true; } else { @@ -123,7 +123,7 @@ BOOL LLToolSelectRect::handleMouseUp(S32 x, S32 y, MASK mask) } -BOOL LLToolSelectRect::handleHover(S32 x, S32 y, MASK mask) +bool LLToolSelectRect::handleHover(S32 x, S32 y, MASK mask) { if( hasMouseCapture() ) { @@ -134,7 +134,7 @@ BOOL LLToolSelectRect::handleHover(S32 x, S32 y, MASK mask) // just started rect select, and not adding to current selection LLSelectMgr::getInstance()->deselectAll(); } - mMouseOutsideSlop = TRUE; + mMouseOutsideSlop = true; mDragEndX = x; mDragEndY = y; @@ -153,7 +153,7 @@ BOOL LLToolSelectRect::handleHover(S32 x, S32 y, MASK mask) } gViewerWindow->setCursor(UI_CURSOR_ARROW); - return TRUE; + return true; } @@ -161,7 +161,7 @@ void LLToolSelectRect::draw() { if( hasMouseCapture() && mMouseOutsideSlop) { - if (gKeyboard->currentMask(TRUE) == MASK_CONTROL) + if (gKeyboard->currentMask(true) == MASK_CONTROL) { gGL.color4f(1.f, 0.f, 0.f, 1.f); } @@ -175,8 +175,8 @@ void LLToolSelectRect::draw() llmax(mDragStartY, mDragEndY), llmax(mDragStartX, mDragEndX), llmin(mDragStartY, mDragEndY), - FALSE); - if (gKeyboard->currentMask(TRUE) == MASK_CONTROL) + false); + if (gKeyboard->currentMask(true) == MASK_CONTROL) { gGL.color4f(1.f, 0.f, 0.f, 0.1f); } @@ -193,7 +193,7 @@ void LLToolSelectRect::draw() } // true if x,y outside small box around start_x,start_y -BOOL LLToolSelectRect::outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y) +bool LLToolSelectRect::outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y) { S32 dx = x - start_x; S32 dy = y - start_y; diff --git a/indra/newview/lltoolselectrect.h b/indra/newview/lltoolselectrect.h index 8fc4ec0c1b..514e08d252 100644 --- a/indra/newview/lltoolselectrect.h +++ b/indra/newview/lltoolselectrect.h @@ -36,16 +36,16 @@ class LLToolSelectRect public: LLToolSelectRect( LLToolComposite* composite ); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleHover(S32 x, S32 y, MASK mask); virtual void draw(); // draw the select rectangle void handlePick(const LLPickInfo& pick); protected: void handleRectangleSelection(S32 x, S32 y, MASK mask); // true if you selected one - BOOL outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y); + bool outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y); protected: S32 mDragStartX; // screen coords, from left @@ -57,7 +57,7 @@ protected: S32 mDragLastWidth; S32 mDragLastHeight; - BOOL mMouseOutsideSlop; // has mouse ever gone outside slop region? + bool mMouseOutsideSlop; // has mouse ever gone outside slop region? }; diff --git a/indra/newview/lltracker.cpp b/indra/newview/lltracker.cpp index a62116e913..ac93d1693a 100644 --- a/indra/newview/lltracker.cpp +++ b/indra/newview/lltracker.cpp @@ -75,7 +75,7 @@ const S32 HUD_ARROW_SIZE = 32; // static LLTracker *LLTracker::sTrackerp = NULL; -BOOL LLTracker::sCheesyBeacon = FALSE; +bool LLTracker::sCheesyBeacon = false; LLTracker::LLTracker() : mTrackingStatus(TRACKING_NOTHING), @@ -84,12 +84,12 @@ LLTracker::LLTracker() mHUDArrowCenterY(0), mToolTip( "" ), mTrackedLandmarkName(""), - mHasReachedLandmark(FALSE), - mHasLandmarkPosition(FALSE), - mLandmarkHasBeenVisited(FALSE), + mHasReachedLandmark(false), + mHasLandmarkPosition(false), + mLandmarkHasBeenVisited(false), mTrackedLocationName( "" ), - mIsTrackingLocation(FALSE), - mHasReachedLocation(FALSE) + mIsTrackingLocation(false), + mHasReachedLocation(false) { } @@ -182,7 +182,7 @@ void LLTracker::render3D() if (!instance()->mBeaconText) { instance()->mBeaconText = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT); - instance()->mBeaconText->setDoFade(FALSE); + instance()->mBeaconText->setDoFade(false); } LLVector3d pos_global = instance()->mTrackedPositionGlobal; @@ -206,7 +206,7 @@ void LLTracker::render3D() if (!instance()->mBeaconText) { instance()->mBeaconText = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT); - instance()->mBeaconText->setDoFade(FALSE); + instance()->mBeaconText->setDoFade(false); } if (instance()->mHasLandmarkPosition) @@ -235,7 +235,7 @@ void LLTracker::render3D() // disappear when they're created only a few meters // away, yet disappear when the agent wanders away // and back again - instance()->mHasReachedLandmark = FALSE; + instance()->mHasReachedLandmark = false; } renderBeacon( instance()->mTrackedPositionGlobal, map_track_color, map_track_color_under, instance()->mBeaconText, instance()->mTrackedLandmarkName ); @@ -256,7 +256,7 @@ void LLTracker::render3D() if (!instance()->mBeaconText) { instance()->mBeaconText = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT); - instance()->mBeaconText->setDoFade(FALSE); + instance()->mBeaconText->setDoFade(false); } F32 dist = gFloaterWorldMap->getDistanceToDestination(instance()->getTrackedPositionGlobal(), 0.0f); @@ -272,22 +272,22 @@ void LLTracker::render3D() } else { - BOOL stop_tracking = FALSE; + bool stop_tracking = false; const LLUUID& avatar_id = av_tracker.getAvatarID(); if(avatar_id.isNull()) { - stop_tracking = TRUE; + stop_tracking = true; } else { const LLRelationship* buddy = av_tracker.getBuddyInfo(avatar_id); if(buddy && !buddy->isOnline() && !gAgent.isGodlike()) { - stop_tracking = TRUE; + stop_tracking = true; } if(!buddy && !gAgent.isGodlike()) { - stop_tracking = TRUE; + stop_tracking = true; } } if(stop_tracking) @@ -336,7 +336,7 @@ void LLTracker::trackLocation(const LLVector3d& pos_global, const std::string& f instance()->mTrackedPositionGlobal = pos_global; instance()->mTrackedLocationName = full_name; - instance()->mIsTrackingLocation = TRUE; + instance()->mIsTrackingLocation = true; instance()->mTrackingStatus = TRACKING_LOCATION; instance()->mTrackingLocationType = location_type; instance()->mLabel = full_name; @@ -345,9 +345,9 @@ void LLTracker::trackLocation(const LLVector3d& pos_global, const std::string& f // static -BOOL LLTracker::handleMouseDown(S32 x, S32 y) +bool LLTracker::handleMouseDown(S32 x, S32 y) { - BOOL eat_mouse_click = FALSE; + bool eat_mouse_click = false; // fortunately, we can always compute the tracking arrow center S32 dist_sqrd = (x - instance()->mHUDArrowCenterX) * (x - instance()->mHUDArrowCenterX) + (y - instance()->mHUDArrowCenterY) * (y - instance()->mHUDArrowCenterY); @@ -358,14 +358,14 @@ BOOL LLTracker::handleMouseDown(S32 x, S32 y) // turn off tracking if (gAgent.getAutoPilot()) { - gAgent.stopAutoPilot(TRUE); // TRUE because cancelled by user - eat_mouse_click = TRUE; + gAgent.stopAutoPilot(true); // true because cancelled by user + eat_mouse_click = true; } */ if (getTrackingStatus()) { instance()->stopTrackingAll(); - eat_mouse_click = TRUE; + eat_mouse_click = true; } } return eat_mouse_click; @@ -403,7 +403,7 @@ LLVector3d LLTracker::getTrackedPositionGlobal() // static -BOOL LLTracker::hasLandmarkPosition() +bool LLTracker::hasLandmarkPosition() { if (!instance()->mHasLandmarkPosition) { @@ -653,7 +653,7 @@ void LLTracker::renderBeacon(LLVector3d pos_global, str += text; hud_textp->setFont(LLFontGL::getFontSansSerif()); - hud_textp->setZCompare(FALSE); + hud_textp->setZCompare(false); hud_textp->setColor(LLColor4(1.f, 1.f, 1.f, llmax(0.2f, llmin(1.f,(dist-FADE_DIST)/FADE_DIST)))); hud_textp->setString(str); @@ -703,9 +703,9 @@ void LLTracker::stopTrackingLandmark(bool clear_ui) mTrackedLandmarkItemID.setNull(); mTrackedLandmarkName.assign(""); mTrackedPositionGlobal.zeroVec(); - mHasLandmarkPosition = FALSE; - mHasReachedLandmark = FALSE; - mLandmarkHasBeenVisited = TRUE; + mHasLandmarkPosition = false; + mHasReachedLandmark = false; + mLandmarkHasBeenVisited = true; gFloaterWorldMap->clearLandmarkSelection(clear_ui); mTrackingStatus = TRACKING_NOTHING; } @@ -715,7 +715,7 @@ void LLTracker::stopTrackingLocation(bool clear_ui, bool dest_reached) { purgeBeaconText(); mTrackedLocationName.assign(""); - mIsTrackingLocation = FALSE; + mIsTrackingLocation = false; mTrackedPositionGlobal.zeroVec(); gFloaterWorldMap->clearLocationSelection(clear_ui, dest_reached); mTrackingStatus = TRACKING_NOTHING; @@ -736,7 +736,7 @@ void LLTracker::drawMarker(const LLVector3d& pos_global, const LLColor4& color) LLCoordGL screen; S32 x = 0; S32 y = 0; - const BOOL CLAMP = TRUE; + const bool CLAMP = true; if (LLViewerCamera::getInstance()->projectPosAgentToScreen(pos_local, screen, CLAMP) || LLViewerCamera::getInstance()->projectPosAgentToScreenEdge(pos_local, screen) ) @@ -850,13 +850,13 @@ void LLTracker::cacheLandmarkPosition() { // the landmark asset download may have finished, in which case // we'll now be able to figure out where we're trying to go - BOOL found_landmark = FALSE; + bool found_landmark = false; if( mTrackedLandmarkAssetID == LLFloaterWorldMap::getHomeID()) { LLVector3d pos_global; if ( gAgent.getHomePosGlobal( &mTrackedPositionGlobal )) { - found_landmark = TRUE; + found_landmark = true; } else { @@ -870,27 +870,27 @@ void LLTracker::cacheLandmarkPosition() LLLandmark* landmark = gLandmarkList.getAsset(mTrackedLandmarkAssetID); if(landmark && landmark->getGlobalPos(mTrackedPositionGlobal)) { - found_landmark = TRUE; + found_landmark = true; // cache the object's visitation status - mLandmarkHasBeenVisited = FALSE; + mLandmarkHasBeenVisited = false; LLInventoryItem* item = gInventory.getItem(mTrackedLandmarkItemID); if ( item && item->getFlags()&LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED) { - mLandmarkHasBeenVisited = TRUE; + mLandmarkHasBeenVisited = true; } } } if ( found_landmark && gFloaterWorldMap ) { - mHasReachedLandmark = FALSE; + mHasReachedLandmark = false; F32 dist = gFloaterWorldMap->getDistanceToDestination(mTrackedPositionGlobal, 1.0f); if ( dist < DESTINATION_UNVISITED_RADIUS ) { - mHasReachedLandmark = TRUE; + mHasReachedLandmark = true; } - mHasLandmarkPosition = TRUE; + mHasLandmarkPosition = true; } mHasLandmarkPosition = found_landmark; } diff --git a/indra/newview/lltracker.h b/indra/newview/lltracker.h index c22432abb9..bf341216dd 100644 --- a/indra/newview/lltracker.h +++ b/indra/newview/lltracker.h @@ -88,7 +88,7 @@ public: // returns global pos of tracked thing static LLVector3d getTrackedPositionGlobal(); - static BOOL hasLandmarkPosition(); + static bool hasLandmarkPosition(); static const std::string& getTrackedLocationName(); static void drawHUDArrow(); @@ -96,10 +96,10 @@ public: // Draw in-world 3D tracking stuff static void render3D(); - static BOOL handleMouseDown(S32 x, S32 y); + static bool handleMouseDown(S32 x, S32 y); static LLTracker* sTrackerp; - static BOOL sCheesyBeacon; + static bool sCheesyBeacon; static const std::string& getLabel() { return instance()->mLabel; } static const std::string& getToolTip() { return instance()->mToolTip; } @@ -141,13 +141,13 @@ protected: LLUUID mTrackedLandmarkItemID; std::vector<LLUUID> mLandmarkAssetIDList; std::vector<LLUUID> mLandmarkItemIDList; - BOOL mHasReachedLandmark; - BOOL mHasLandmarkPosition; - BOOL mLandmarkHasBeenVisited; + bool mHasReachedLandmark; + bool mHasLandmarkPosition; + bool mLandmarkHasBeenVisited; std::string mTrackedLocationName; - BOOL mIsTrackingLocation; - BOOL mHasReachedLocation; + bool mIsTrackingLocation; + bool mHasReachedLocation; }; diff --git a/indra/newview/lltrackpicker.cpp b/indra/newview/lltrackpicker.cpp index 36ca93a801..bef314f964 100644 --- a/indra/newview/lltrackpicker.cpp +++ b/indra/newview/lltrackpicker.cpp @@ -57,11 +57,11 @@ LLFloaterTrackPicker::~LLFloaterTrackPicker() { } -BOOL LLFloaterTrackPicker::postBuild() +bool LLFloaterTrackPicker::postBuild() { childSetAction(BTN_CANCEL, [this](LLUICtrl*, const LLSD& param){ onButtonCancel(); }); childSetAction(BTN_SELECT, [this](LLUICtrl*, const LLSD& param){ onButtonSelect(); }); - return TRUE; + return true; } void LLFloaterTrackPicker::onClose(bool app_quitting) @@ -72,7 +72,7 @@ void LLFloaterTrackPicker::onClose(bool app_quitting) LLView *owner = mOwnerHandle.get(); if (owner) { - owner->setFocus(TRUE); + owner->setFocus(true); } } @@ -94,12 +94,12 @@ void LLFloaterTrackPicker::showPicker(const LLSD &args) if (can_enable && select_item) { select_item = false; - getChild<LLRadioGroup>(RDO_TRACK_SELECTION, true)->setSelectedByValue(LLSD(track_id), TRUE); + getChild<LLRadioGroup>(RDO_TRACK_SELECTION, true)->setSelectedByValue(LLSD(track_id), true); } } openFloater(getKey()); - setFocus(TRUE); + setFocus(true); } void LLFloaterTrackPicker::draw() diff --git a/indra/newview/lltrackpicker.h b/indra/newview/lltrackpicker.h index a00cc87c51..eda8259d33 100644 --- a/indra/newview/lltrackpicker.h +++ b/indra/newview/lltrackpicker.h @@ -39,7 +39,7 @@ public: LLFloaterTrackPicker(LLView * owner, const LLSD ¶ms = LLSD()); virtual ~LLFloaterTrackPicker() override; - virtual BOOL postBuild() override; + virtual bool postBuild() override; virtual void onClose(bool app_quitting) override; void showPicker(const LLSD &args); diff --git a/indra/newview/lltransientdockablefloater.cpp b/indra/newview/lltransientdockablefloater.cpp index 4fb4edb0e6..a3818d5c01 100644 --- a/indra/newview/lltransientdockablefloater.cpp +++ b/indra/newview/lltransientdockablefloater.cpp @@ -52,7 +52,7 @@ LLTransientDockableFloater::~LLTransientDockableFloater() } } -void LLTransientDockableFloater::setVisible(BOOL visible) +void LLTransientDockableFloater::setVisible(bool visible) { LLView* dock = getDockWidget(); if(visible && isDocked()) diff --git a/indra/newview/lltransientdockablefloater.h b/indra/newview/lltransientdockablefloater.h index 27e74d8880..b3b408f853 100644 --- a/indra/newview/lltransientdockablefloater.h +++ b/indra/newview/lltransientdockablefloater.h @@ -45,9 +45,9 @@ public: const LLSD& key, const Params& params = getDefaultParams()); virtual ~LLTransientDockableFloater(); - /*virtual*/ void setVisible(BOOL visible); - /* virtual */void setDocked(bool docked, bool pop_on_undock = true); - virtual LLTransientFloaterMgr::ETransientGroup getGroup() { return LLTransientFloaterMgr::GLOBAL; } + void setVisible(bool visible) override; + void setDocked(bool docked, bool pop_on_undock = true) override; + virtual LLTransientFloaterMgr::ETransientGroup getGroup() override { return LLTransientFloaterMgr::GLOBAL; } }; #endif /* LL_TRANSIENTDOCKABLEFLOATER_H */ diff --git a/indra/newview/lltransientfloatermgr.cpp b/indra/newview/lltransientfloatermgr.cpp index bb226efb2c..dc777dbb67 100644 --- a/indra/newview/lltransientfloatermgr.cpp +++ b/indra/newview/lltransientfloatermgr.cpp @@ -96,7 +96,7 @@ void LLTransientFloaterMgr::hideTransientFloaters(S32 x, S32 y) bool hide = isControlClicked(group, mGroupControls.find(group)->second, x, y); if (hide) { - floater->setTransientVisible(FALSE); + floater->setTransientVisible(false); } } } diff --git a/indra/newview/lltransientfloatermgr.h b/indra/newview/lltransientfloatermgr.h index 18025cc9da..87a7b9e822 100644 --- a/indra/newview/lltransientfloatermgr.h +++ b/indra/newview/lltransientfloatermgr.h @@ -80,7 +80,7 @@ protected: public: virtual LLTransientFloaterMgr::ETransientGroup getGroup() = 0; bool isTransientDocked() { return mFloater->isDocked(); }; - void setTransientVisible(BOOL visible) {mFloater->setVisible(visible); } + void setTransientVisible(bool visible) {mFloater->setVisible(visible); } private: LLFloater* mFloater; diff --git a/indra/newview/lltranslate.cpp b/indra/newview/lltranslate.cpp index fe83c7314b..b6fbcaa330 100644 --- a/indra/newview/lltranslate.cpp +++ b/indra/newview/lltranslate.cpp @@ -36,11 +36,11 @@ #include "llversioninfo.h" #include "llviewercontrol.h" #include "llcoros.h" -#include "json/reader.h" #include "llcorehttputil.h" #include "llurlregistry.h" #include "stringize.h" +#include <boost/json.hpp> static const std::string AZURE_NOTRANSLATE_OPENING_TAG("<div translate=\"no\">"); static const std::string AZURE_NOTRANSLATE_CLOSING_TAG("</div>"); @@ -344,11 +344,11 @@ public: private: static void parseErrorResponse( - const Json::Value& root, + const boost::json::value& root, int& status, std::string& err_msg); static bool parseTranslation( - const Json::Value& root, + const boost::json::value& root, std::string& translation, std::string& detected_lang); static std::string getAPIKey(); @@ -398,25 +398,22 @@ bool LLGoogleTranslationHandler::parseResponse( { const std::string& text = !body.empty() ? body : http_response["error_body"].asStringRef(); - Json::Value root; - Json::Reader reader; - - if (reader.parse(text, root)) + boost::json::error_code ec; + boost::json::value root = boost::json::parse(text, ec); + if (ec.failed()) { - if (root.isObject()) - { - // Request succeeded, extract translation from the XML body. - if (parseTranslation(root, translation, detected_lang)) - return true; - - // Request failed. Extract error message from the XML body. - parseErrorResponse(root, status, err_msg); - } + err_msg = ec.what(); + return false; } - else + + if (root.is_object()) { - // XML parsing failed. Extract error message from the XML parser. - err_msg = reader.getFormatedErrorMessages(); + // Request succeeded, extract translation from the XML body. + if (parseTranslation(root, translation, detected_lang)) + return true; + + // Request failed. Extract error message from the XML body. + parseErrorResponse(root, status, err_msg); } return false; @@ -430,48 +427,55 @@ bool LLGoogleTranslationHandler::isConfigured() const // static void LLGoogleTranslationHandler::parseErrorResponse( - const Json::Value& root, + const boost::json::value& root, int& status, std::string& err_msg) { - const Json::Value& error = root.get("error", 0); - if (!error.isObject() || !error.isMember("message") || !error.isMember("code")) + boost::json::error_code ec; + auto message = root.find_pointer("/data/message", ec); + auto code = root.find_pointer("/data/code", ec); + if (!message || !code) + { + return; + } + + auto message_val = boost::json::try_value_to<std::string>(*message); + auto code_val = boost::json::try_value_to<int>(*code); + if (!message_val || !code_val) { return; } - err_msg = error["message"].asString(); - status = error["code"].asInt(); + err_msg = message_val.value(); + status = code_val.value(); } // static bool LLGoogleTranslationHandler::parseTranslation( - const Json::Value& root, + const boost::json::value& root, std::string& translation, std::string& detected_lang) { - // JsonCpp is prone to aborting the program on failed assertions, - // so be super-careful and verify the response format. - const Json::Value& data = root.get("data", 0); - if (!data.isObject() || !data.isMember("translations")) - { - return false; - } + boost::json::error_code ec; + auto translated_text = root.find_pointer("/data/translations/0/translatedText", ec); + if (!translated_text) return false; - const Json::Value& translations = data["translations"]; - if (!translations.isArray() || translations.size() == 0) + auto text_val = boost::json::try_value_to<std::string>(*translated_text); + if (!text_val) { + LL_WARNS() << "Failed to parse translation" << text_val.error() << LL_ENDL; return false; } - const Json::Value& first = translations[0U]; - if (!first.isObject() || !first.isMember("translatedText")) + translation = text_val.value(); + + auto language = root.find_pointer("/data/translations/0/detectedSourceLanguage", ec); + if (language) { - return false; + auto lang_val = boost::json::try_value_to<std::string>(*language); + detected_lang = lang_val ? lang_val.value() : ""; } - translation = first["translatedText"].asString(); - detected_lang = first.get("detectedSourceLanguage", "").asString(); return true; } @@ -652,12 +656,11 @@ bool LLAzureTranslationHandler::checkVerificationResponse( // Expected: "{\"error\":{\"code\":400000,\"message\":\"One of the request inputs is not valid.\"}}" // But for now just verify response is a valid json - Json::Value root; - Json::Reader reader; - - if (!reader.parse(response["error_body"].asString(), root)) + boost::json::error_code ec; + boost::json::value root = boost::json::parse(response["error_body"].asString(), ec); + if (ec.failed()) { - LL_DEBUGS("Translate") << "Failed to parse error_body:" << reader.getFormatedErrorMessages() << LL_ENDL; + LL_DEBUGS("Translate") << "Failed to parse error_body:" << ec.what() << LL_ENDL; return false; } @@ -676,57 +679,36 @@ bool LLAzureTranslationHandler::parseResponse( if (status != HTTP_OK) { if (http_response.has("error_body")) - err_msg = parseErrorResponse(http_response["error_body"].asString()); + err_msg = parseErrorResponse(http_response["error_body"].asString()); return false; } //Example: // "[{\"detectedLanguage\":{\"language\":\"en\",\"score\":1.0},\"translations\":[{\"text\":\"Hello, what is your name?\",\"to\":\"en\"}]}]" - Json::Value root; - Json::Reader reader; - - if (!reader.parse(body, root)) + boost::json::error_code ec; + boost::json::value root = boost::json::parse(body, ec); + if (ec.failed()) { - err_msg = reader.getFormatedErrorMessages(); + err_msg = ec.what(); return false; } + auto language = root.find_pointer("/0/detectedLanguage/language", ec); + if (!language) return false; - if (!root.isArray()) // empty response? should not happen - { - return false; - } + auto translated_text = root.find_pointer("/0/translations/0/text", ec); + if (!translated_text) return false; - // Request succeeded, extract translation from the response. - - const Json::Value& data = root[0U]; - if (!data.isObject() - || !data.isMember("detectedLanguage") - || !data.isMember("translations")) - { - return false; - } - - const Json::Value& detectedLanguage = data["detectedLanguage"]; - if (!detectedLanguage.isObject() || !detectedLanguage.isMember("language")) - { - return false; - } - detected_lang = detectedLanguage["language"].asString(); - - const Json::Value& translations = data["translations"]; - if (!translations.isArray() || translations.size() == 0) - { - return false; - } - - const Json::Value& first = translations[0U]; - if (!first.isObject() || !first.isMember("text")) + auto lang_val = boost::json::try_value_to<std::string>(*language); + auto text_val = boost::json::try_value_to<std::string>(*translated_text); + if (!lang_val || !text_val) { + LL_WARNS() << "Failed to parse translation" << lang_val.error() << text_val.error() << LL_ENDL; return false; } - translation = LLURI::unescape(first["text"].asString()); + detected_lang = lang_val.value(); + translation = text_val.value(); return true; } @@ -744,27 +726,25 @@ std::string LLAzureTranslationHandler::parseErrorResponse( // Expected: "{\"error\":{\"code\":400000,\"message\":\"One of the request inputs is not valid.\"}}" // But for now just verify response is a valid json with an error - Json::Value root; - Json::Reader reader; - - if (!reader.parse(body, root)) + boost::json::error_code ec; + boost::json::value root = boost::json::parse(body, ec); + if (ec.failed()) { - return std::string(); + return {}; } - if (!root.isObject() || !root.isMember("error")) + auto err_msg = root.find_pointer("/error/message", ec); + if (!err_msg) { - return std::string(); + return {}; } - const Json::Value& error_map = root["error"]; - - if (!error_map.isObject() || !error_map.isMember("message")) + auto err_msg_val = boost::json::try_value_to<std::string>(*err_msg); + if (!err_msg_val) { - return std::string(); + return {}; } - - return error_map["message"].asString(); + return err_msg_val.value(); } // static @@ -976,39 +956,39 @@ bool LLDeepLTranslationHandler::parseResponse( //Example: // "{\"translations\":[{\"detected_source_language\":\"EN\",\"text\":\"test\"}]}" - Json::Value root; - Json::Reader reader; - - if (!reader.parse(body, root)) + boost::json::error_code ec; + boost::json::value root = boost::json::parse(body, ec); + if (ec.failed()) { - err_msg = reader.getFormatedErrorMessages(); + err_msg = ec.message(); return false; } - if (!root.isObject() - || !root.isMember("translations")) // empty response? should not happen + auto detected_langp = root.find_pointer("/translations/0/detected_source_language", ec); + if (!detected_langp || ec.failed()) // empty response? should not happen { + err_msg = ec.message(); return false; } // Request succeeded, extract translation from the response. - const Json::Value& translations = root["translations"]; - if (!translations.isArray() || translations.size() == 0) + auto text_valp = root.find_pointer("/translations/0/text", ec); + if (!text_valp || ec.failed()) { + err_msg = ec.message(); return false; } - const Json::Value& data= translations[0U]; - if (!data.isObject() - || !data.isMember("detected_source_language") - || !data.isMember("text")) + auto lang_result = boost::json::try_value_to<std::string>(*detected_langp); + auto text_result = boost::json::try_value_to<std::string>(*text_valp); + if (!lang_result || !text_result) { return false; } - detected_lang = data["detected_source_language"].asString(); + detected_lang = lang_result.value(); LLStringUtil::toLower(detected_lang); - translation = data["text"].asString(); + translation = text_result.value(); return true; } @@ -1024,21 +1004,24 @@ std::string LLDeepLTranslationHandler::parseErrorResponse( const std::string& body) { // Example: "{\"message\":\"One of the request inputs is not valid.\"}" - - Json::Value root; - Json::Reader reader; - - if (!reader.parse(body, root)) + boost::json::error_code ec; + boost::json::value root = boost::json::parse(body, ec); + if (ec.failed()) { - return std::string(); + return {}; } - if (!root.isObject() || !root.isMember("message")) + auto message_ptr = root.find_pointer("/message", ec); + if (!message_ptr || ec.failed()) { - return std::string(); + return {}; } - return root["message"].asString(); + auto message_val = boost::json::try_value_to<std::string>(*message_ptr); + if (!message_val) + return {}; + + return message_val.value(); } // static @@ -1165,7 +1148,7 @@ std::string LLTranslate::addNoTranslateTags(std::string mesg) upd_msg.insert(dif + match.getStart(), AZURE_NOTRANSLATE_OPENING_TAG); upd_msg.insert(dif + AZURE_NOTRANSLATE_OPENING_TAG.size() + match.getEnd() + 1, AZURE_NOTRANSLATE_CLOSING_TAG); mesg.erase(match.getStart(), match.getEnd() - match.getStart()); - dif += match.getEnd() - match.getStart() + AZURE_NOTRANSLATE_OPENING_TAG.size() + AZURE_NOTRANSLATE_CLOSING_TAG.size(); + dif += match.getEnd() - match.getStart() + static_cast<S32>(AZURE_NOTRANSLATE_OPENING_TAG.size() + AZURE_NOTRANSLATE_CLOSING_TAG.size()); } return upd_msg; } @@ -1187,9 +1170,9 @@ std::string LLTranslate::removeNoTranslateTags(std::string mesg) { std::string upd_msg(mesg); LLUrlMatch match; - S32 opening_tag_size = AZURE_NOTRANSLATE_OPENING_TAG.size(); - S32 closing_tag_size = AZURE_NOTRANSLATE_CLOSING_TAG.size(); - S32 dif = 0; + auto opening_tag_size = AZURE_NOTRANSLATE_OPENING_TAG.size(); + auto closing_tag_size = AZURE_NOTRANSLATE_CLOSING_TAG.size(); + size_t dif = 0; //remove 'no-translate' tags we added to the links before while (LLUrlRegistry::instance().findUrl(mesg, match)) { diff --git a/indra/newview/lltranslate.h b/indra/newview/lltranslate.h index 67f528c090..0ad769b27f 100644 --- a/indra/newview/lltranslate.h +++ b/indra/newview/lltranslate.h @@ -32,11 +32,6 @@ #include "llsingleton.h" -namespace Json -{ - class Value; -} - class LLTranslationAPIHandler; /** * Entry point for machine translation services. diff --git a/indra/newview/lluiavatar.cpp b/indra/newview/lluiavatar.cpp index 1742126ba3..c687c4f162 100644 --- a/indra/newview/lluiavatar.cpp +++ b/indra/newview/lluiavatar.cpp @@ -37,7 +37,7 @@ LLUIAvatar::LLUIAvatar(const LLUUID& id, const LLPCode pcode, LLViewerRegion* regionp) : LLVOAvatar(id, pcode, regionp) { - mIsDummy = TRUE; + mIsDummy = true; mIsUIAvatar = true; } diff --git a/indra/newview/lluiavatar.h b/indra/newview/lluiavatar.h index c539539306..3df3f5afa2 100644 --- a/indra/newview/lluiavatar.h +++ b/indra/newview/lluiavatar.h @@ -39,6 +39,7 @@ public: LLUIAvatar(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); virtual void initInstance(); // Called after construction to initialize the class. virtual ~LLUIAvatar(); + virtual bool isBuddy() const { return false; } }; #endif //LL_CONTROLAVATAR_H diff --git a/indra/newview/lluploaddialog.cpp b/indra/newview/lluploaddialog.cpp index e019af2fe8..4961d38f8e 100644 --- a/indra/newview/lluploaddialog.cpp +++ b/indra/newview/lluploaddialog.cpp @@ -61,7 +61,7 @@ void LLUploadDialog::modalUploadFinished() LLUploadDialog::LLUploadDialog( const std::string& msg) : LLPanel() { - setBackgroundVisible( TRUE ); + setBackgroundVisible( true ); if( LLUploadDialog::sDialog ) { @@ -102,7 +102,7 @@ void LLUploadDialog::setMessage( const std::string& msg) S32 max_msg_width = 0; std::list<std::string> msg_lines; - S32 size = msg.size() + 1; + auto size = msg.size() + 1; std::vector<char> temp_msg(size); // non-const copy to make strtok happy strcpy( &temp_msg[0], msg.c_str()); char* token = strtok( &temp_msg[0], "\n" ); @@ -117,9 +117,9 @@ void LLUploadDialog::setMessage( const std::string& msg) S32 line_height = font->getLineHeight(); S32 dialog_width = max_msg_width + 2 * HPAD; - S32 dialog_height = line_height * msg_lines.size() + 2 * VPAD; + S32 dialog_height = line_height * static_cast<S32>(msg_lines.size()) + 2 * VPAD; - reshape( dialog_width, dialog_height, FALSE ); + reshape( dialog_width, dialog_height, false ); // Message S32 msg_x = (getRect().getWidth() - max_msg_width) / 2; @@ -127,7 +127,7 @@ void LLUploadDialog::setMessage( const std::string& msg) int line_num; for (line_num=0; line_num<16; ++line_num) { - mLabelBox[line_num]->setVisible(FALSE); + mLabelBox[line_num]->setVisible(false); } line_num = 0; for (std::list<std::string>::iterator iter = msg_lines.begin(); @@ -139,7 +139,7 @@ void LLUploadDialog::setMessage( const std::string& msg) mLabelBox[line_num]->setRect(msg_rect); mLabelBox[line_num]->setText(cur_line); mLabelBox[line_num]->setColor( LLUIColorTable::instance().getColor( "LabelTextColor" ) ); - mLabelBox[line_num]->setVisible(TRUE); + mLabelBox[line_num]->setVisible(true); msg_y -= line_height; ++line_num; } diff --git a/indra/newview/llurl.cpp b/indra/newview/llurl.cpp index 2cb7f1a877..6bff31122e 100644 --- a/indra/newview/llurl.cpp +++ b/indra/newview/llurl.cpp @@ -71,7 +71,7 @@ void LLURL::init(const char * url) char *parse; char *leftover_url = url_copy; - S32 span = 0; + size_t span = 0; // copy and lop off tag if ((parse = strchr(url_copy,'#'))) @@ -161,9 +161,9 @@ bool LLURL::operator==(const LLURL &rhs) const || (strcmp(mTag, rhs.mTag)) ) { - return FALSE; + return false; } - return TRUE; + return true; } bool LLURL::operator!=(const LLURL& rhs) const diff --git a/indra/newview/llurl.h b/indra/newview/llurl.h index 214cf09da1..97b449d55f 100644 --- a/indra/newview/llurl.h +++ b/indra/newview/llurl.h @@ -77,7 +77,7 @@ public: virtual const char *updateRelativePath(const LLURL &url); - virtual BOOL isExtension(const char *compare) {return (!strcmp(mExtension,compare));}; + virtual bool isExtension(const char *compare) {return (!strcmp(mExtension,compare));}; public: diff --git a/indra/newview/llurllineeditorctrl.cpp b/indra/newview/llurllineeditorctrl.cpp index c3b6167a7e..de0ed645eb 100644 --- a/indra/newview/llurllineeditorctrl.cpp +++ b/indra/newview/llurllineeditorctrl.cpp @@ -89,5 +89,5 @@ void LLURLLineEditor::copyEscapedURLToClipboard() else // human-readable location text_to_copy = utf8str_to_wstring(unescaped_text); - LLClipboard::instance().copyToClipboard(text_to_copy, 0, text_to_copy.size()); + LLClipboard::instance().copyToClipboard(text_to_copy, 0, static_cast<S32>(text_to_copy.size())); } diff --git a/indra/newview/llurllineeditorctrl.h b/indra/newview/llurllineeditorctrl.h index 5d2203ae46..f5bf62c7d9 100644 --- a/indra/newview/llurllineeditorctrl.h +++ b/indra/newview/llurllineeditorctrl.h @@ -82,7 +82,7 @@ private: std::string mText; S32 mCursorPos; S32 mScrollHPos; - BOOL mIsSelecting; + bool mIsSelecting; S32 mSelectionStart; S32 mSelectionEnd; }; // end class LLURLLineEditorRollback diff --git a/indra/newview/llurlwhitelist.cpp b/indra/newview/llurlwhitelist.cpp index f5651646a6..e2d2fe00e2 100644 --- a/indra/newview/llurlwhitelist.cpp +++ b/indra/newview/llurlwhitelist.cpp @@ -128,8 +128,8 @@ bool LLUrlWhiteList::clear () std::string url_cleanup(std::string pattern) { LLStringUtil::trim(pattern); - S32 length = pattern.length(); - S32 position = 0; + size_t length = pattern.length(); + size_t position = 0; std::string::reverse_iterator it = pattern.rbegin(); ++it; // skip last char, might be '/' ++position; @@ -139,7 +139,7 @@ std::string url_cleanup(std::string pattern) if (c == '/') { // found second to last '/' - S32 desired_length = length - position; + auto desired_length = length - position; LLStringUtil::truncate(pattern, desired_length); break; } diff --git a/indra/newview/llvectorperfoptions.cpp b/indra/newview/llvectorperfoptions.cpp deleted file mode 100644 index 91ca56fefe..0000000000 --- a/indra/newview/llvectorperfoptions.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/** - * @file llvectorperfoptions.h - * @brief SSE/SSE2 vector math performance options. - * - * $LicenseInfo:firstyear=2007&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 "llviewerprecompiledheaders.h" - -// Deprecated - moved into llviewerjointmesh diff --git a/indra/newview/llvectorperfoptions.h b/indra/newview/llvectorperfoptions.h deleted file mode 100644 index 5bfc48b240..0000000000 --- a/indra/newview/llvectorperfoptions.h +++ /dev/null @@ -1,32 +0,0 @@ -/** - * @file llvectorperfoptions.h - * @brief SSE/SSE2 vector math performance options. - * - * $LicenseInfo:firstyear=2007&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_VECTORPERFOPTIONS_H -#define LL_VECTORPERFOPTIONS_H - -// Deprecated - moved into llviewerjointmesh - -#endif diff --git a/indra/newview/llversioninfo.cpp b/indra/newview/llversioninfo.cpp index 3c5881841f..e598303305 100644 --- a/indra/newview/llversioninfo.cpp +++ b/indra/newview/llversioninfo.cpp @@ -135,7 +135,7 @@ LLVersionInfo::ViewerMaturity LLVersionInfo::getViewerMaturity() std::string channel = getChannel(); static const boost::regex is_test_channel("\\bTest\\b"); - static const boost::regex is_beta_channel("\\bBeta\\b"); + static const boost::regex is_beta_channel("\\b(Beta|Develop)\\b"); // Develop is an alias for Beta static const boost::regex is_project_channel("\\bProject\\b"); static const boost::regex is_release_channel("\\bRelease\\b"); diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index 2fe4018aba..26707f5d9a 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -199,12 +199,12 @@ void LLViewerAssetStorage::storeAssetData( // Read the data from the cache if it'll fit in this packet. if (asset_size + 100 < MTUBYTES) { - BOOL res = vfile.read(buffer, asset_size); /* Flawfinder: ignore */ + bool res = vfile.read(buffer, asset_size); /* Flawfinder: ignore */ S32 bytes_read = res ? vfile.getLastBytesRead() : 0; if( bytes_read == asset_size ) { - req->mDataSentInFirstPacket = TRUE; + req->mDataSentInFirstPacket = true; //LL_INFOS() << "LLViewerAssetStorage::createAsset sending data in first packet" << LL_ENDL; } else @@ -361,8 +361,8 @@ void LLViewerAssetStorage::_queueDataRequest( LLAssetType::EType atype, LLGetAssetCallback callback, void *user_data, - BOOL duplicate, - BOOL is_priority) + bool duplicate, + bool is_priority) { mCountRequests++; queueRequestHttp(uuid, atype, callback, user_data, duplicate, is_priority); @@ -373,8 +373,8 @@ void LLViewerAssetStorage::queueRequestHttp( LLAssetType::EType atype, LLGetAssetCallback callback, void *user_data, - BOOL duplicate, - BOOL is_priority) + bool duplicate, + bool is_priority) { LL_DEBUGS("ViewerAsset") << "Request asset via HTTP " << uuid << " type " << LLAssetType::lookup(atype) << LL_ENDL; @@ -542,7 +542,7 @@ void LLViewerAssetStorage::assetRequestCoro( const LLSD::Binary &raw = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_RAW].asBinary(); - S32 size = raw.size(); + S32 size = static_cast<S32>(raw.size()); if (size > 0) { mTotalBytesFetched += size; diff --git a/indra/newview/llviewerassetstorage.h b/indra/newview/llviewerassetstorage.h index 19eb26e809..fdb8af7457 100644 --- a/indra/newview/llviewerassetstorage.h +++ b/indra/newview/llviewerassetstorage.h @@ -51,7 +51,7 @@ public: bool temp_file = false, bool is_priority = false, bool store_local = false, - bool user_waiting=FALSE, + bool user_waiting=false, F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT) override; void storeAssetData( @@ -62,7 +62,7 @@ public: void* user_data, bool temp_file = false, bool is_priority = false, - bool user_waiting=FALSE, + bool user_waiting=false, F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT) override; protected: @@ -70,15 +70,15 @@ protected: LLAssetType::EType type, LLGetAssetCallback callback, void *user_data, - BOOL duplicate, - BOOL is_priority) override; + bool duplicate, + bool is_priority) override; void queueRequestHttp(const LLUUID& uuid, LLAssetType::EType type, LLGetAssetCallback callback, void *user_data, - BOOL duplicate, - BOOL is_priority); + bool duplicate, + bool is_priority); void capsRecvForRegion(const LLUUID& region_id, std::string pumpname); diff --git a/indra/newview/llviewerassettype.cpp b/indra/newview/llviewerassettype.cpp index 3e3347ff33..f4c618c08d 100644 --- a/indra/newview/llviewerassettype.cpp +++ b/indra/newview/llviewerassettype.cpp @@ -89,6 +89,8 @@ LLViewerAssetDictionary::LLViewerAssetDictionary() addEntry(LLViewerAssetType::AT_NONE, new ViewerAssetEntry(DAD_NONE)); addEntry(LLViewerAssetType::AT_SETTINGS, new ViewerAssetEntry(DAD_SETTINGS)); addEntry(LLViewerAssetType::AT_MATERIAL, new ViewerAssetEntry(DAD_MATERIAL)); + addEntry(LLViewerAssetType::AT_GLTF, new ViewerAssetEntry(DAD_GLTF)); + addEntry(LLViewerAssetType::AT_GLTF_BIN, new ViewerAssetEntry(DAD_GLTF_BIN)); }; EDragAndDropType LLViewerAssetType::lookupDragAndDropType(EType asset_type) diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp index a080e3dd9e..337c18f218 100644 --- a/indra/newview/llviewerassetupload.cpp +++ b/indra/newview/llviewerassetupload.cpp @@ -299,10 +299,18 @@ void LLResourceUploadInfo::assignDefaults() mDescription = "(No Description)"; } + if (mAssetType == LLAssetType::AT_GLTF || + mAssetType == LLAssetType::AT_GLTF_BIN) + { + mFolderId = LLUUID::null; + } + else + { mFolderId = gInventory.findUserDefinedCategoryUUIDForType( (mDestinationFolderType == LLFolderType::FT_NONE) ? (LLFolderType::EType)mAssetType : mDestinationFolderType); } +} std::string LLResourceUploadInfo::getDisplayName() const { @@ -409,7 +417,7 @@ LLSD LLNewFileResourceUploadInfo::exportTempFile() // Unknown extension errorMessage = llformat(LLTrans::getString("UnknownFileExtension").c_str(), exten.c_str()); errorLabel = "ErrorMessage"; - error = TRUE;; + error = true;; } else if (assetType == LLAssetType::AT_TEXTURE) { @@ -508,7 +516,7 @@ LLSD LLNewFileResourceUploadInfo::exportTempFile() // Unknown extension errorMessage = llformat(LLTrans::getString("UnknownFileExtension").c_str(), exten.c_str()); errorLabel = "ErrorMessage"; - error = TRUE;; + error = true;; } if (error) @@ -598,7 +606,7 @@ LLSD LLNewBufferedResourceUploadInfo::exportTempFile() // copy buffer to the cache for upload LLFileSystem file(getAssetId(), getAssetType(), LLFileSystem::APPEND); - file.write((U8*) mBuffer.c_str(), mBuffer.size()); + file.write((U8*) mBuffer.c_str(), static_cast<S32>(mBuffer.size())); return LLSD(); } @@ -654,6 +662,8 @@ LLBufferedAssetUploadInfo::LLBufferedAssetUploadInfo(LLUUID itemId, LLPointer<LL { setItemId(itemId); + LLImageDataSharedLock lock(image); + EImageCodec codec = static_cast<EImageCodec>(image->getCodec()); switch (codec) @@ -698,7 +708,7 @@ LLSD LLBufferedAssetUploadInfo::prepareUpload() LLFileSystem file(getAssetId(), getAssetType(), LLFileSystem::APPEND); - S32 size = mContents.length() + 1; + S32 size = static_cast<S32>(mContents.length()) + 1; file.write((U8*)mContents.c_str(), size); mStoredToCache = true; @@ -930,7 +940,7 @@ void LLViewerAssetUpload::AssetInventoryUploadCoproc(LLCoreHttpUtil::HttpCorouti // Show the preview panel for textures and sounds to let // user know that the image (or snapshot) arrived intact. - LLInventoryPanel* panel = LLInventoryPanel::getActiveInventoryPanel(FALSE); + LLInventoryPanel* panel = LLInventoryPanel::getActiveInventoryPanel(false); LLInventoryPanel::openInventoryPanelAndSetSelection(true, serverInventoryItem, false, false, !panel); // restore keyboard focus diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp index e9163abb4f..b3b4f43e57 100644 --- a/indra/newview/llvieweraudio.cpp +++ b/indra/newview/llvieweraudio.cpp @@ -76,7 +76,7 @@ LLViewerAudio::~LLViewerAudio() void LLViewerAudio::registerIdleListener() { - if(mIdleListnerActive==false) + if (!mIdleListnerActive) { mIdleListnerActive = true; doOnIdleRepeating(boost::bind(boost::bind(&LLViewerAudio::onIdleUpdate, this))); @@ -355,9 +355,9 @@ void init_audio() // load up our initial set of sounds we'll want so they're in memory and ready to be played - BOOL mute_audio = gSavedSettings.getBOOL("MuteAudio"); + bool mute_audio = gSavedSettings.getBOOL("MuteAudio"); - if (!mute_audio && FALSE == gSavedSettings.getBOOL("NoPreload")) + if (!mute_audio && false == gSavedSettings.getBOOL("NoPreload")) { gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndAlert"))); gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndBadKeystroke"))); @@ -398,10 +398,10 @@ void init_audio() void audio_update_volume(bool force_update) { F32 master_volume = gSavedSettings.getF32("AudioLevelMaster"); - BOOL mute_audio = gSavedSettings.getBOOL("MuteAudio"); + bool mute_audio = gSavedSettings.getBOOL("MuteAudio"); LLProgressView* progress = gViewerWindow->getProgressView(); - BOOL progress_view_visible = FALSE; + bool progress_view_visible = false; if (progress) { @@ -410,7 +410,7 @@ void audio_update_volume(bool force_update) if (!gViewerWindow->getActive() && gSavedSettings.getBOOL("MuteWhenMinimized")) { - mute_audio = TRUE; + mute_audio = true; } F32 mute_volume = mute_audio ? 0.0f : 1.0f; @@ -464,7 +464,7 @@ void audio_update_volume(bool force_update) } F32 music_volume = gSavedSettings.getF32("AudioLevelMusic"); - BOOL music_muted = gSavedSettings.getBOOL("MuteMusic"); + bool music_muted = gSavedSettings.getBOOL("MuteMusic"); F32 fade_volume = LLViewerAudio::getInstance()->getFadeVolume(); music_volume = mute_volume * master_volume * music_volume * fade_volume; @@ -473,7 +473,7 @@ void audio_update_volume(bool force_update) // Streaming Media F32 media_volume = gSavedSettings.getF32("AudioLevelMedia"); - BOOL media_muted = gSavedSettings.getBOOL("MuteMedia"); + bool media_muted = gSavedSettings.getBOOL("MuteMedia"); media_volume = mute_volume * master_volume * media_volume; LLViewerMedia::getInstance()->setVolume( media_muted ? 0.0f : media_volume ); @@ -482,7 +482,7 @@ void audio_update_volume(bool force_update) { F32 voice_volume = gSavedSettings.getF32("AudioLevelVoice"); voice_volume = mute_volume * master_volume * voice_volume; - BOOL voice_mute = gSavedSettings.getBOOL("MuteVoice"); + bool voice_mute = gSavedSettings.getBOOL("MuteVoice"); LLVoiceClient *voice_inst = LLVoiceClient::getInstance(); voice_inst->setVoiceVolume(voice_mute ? 0.f : voice_volume); voice_inst->setMicGain(voice_mute ? 0.f : gSavedSettings.getF32("AudioLevelMic")); @@ -554,8 +554,13 @@ void audio_update_wind(bool force_update) // don't use the setter setMaxWindGain() because we don't // want to screw up the fade-in on startup by setting actual source gain // outside the fade-in. - F32 master_volume = gSavedSettings.getBOOL("MuteAudio") ? 0.f : gSavedSettings.getF32("AudioLevelMaster"); - F32 ambient_volume = gSavedSettings.getBOOL("MuteAmbient") ? 0.f : gSavedSettings.getF32("AudioLevelAmbient"); + static LLCachedControl<bool> mute_audio(gSavedSettings, "MuteAudio"); + static LLCachedControl<bool> mute_ambient(gSavedSettings, "MuteAmbient"); + static LLCachedControl<F32> level_master(gSavedSettings, "AudioLevelMaster"); + static LLCachedControl<F32> level_ambient(gSavedSettings, "AudioLevelAmbient"); + + F32 master_volume = mute_audio() ? 0.f : level_master(); + F32 ambient_volume = mute_ambient() ? 0.f : level_ambient(); F32 max_wind_volume = master_volume * ambient_volume; const F32 WIND_SOUND_TRANSITION_TIME = 2.f; diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp index 8487efc8dd..7b9aba96ed 100644 --- a/indra/newview/llviewercamera.cpp +++ b/indra/newview/llviewercamera.cpp @@ -94,7 +94,13 @@ LLViewerCamera::LLViewerCamera() : LLCamera() mZoomSubregion = 1; mAverageSpeed = 0.f; mAverageAngularSpeed = 0.f; - gSavedSettings.getControl("CameraAngle")->getCommitSignal()->connect(boost::bind(&LLViewerCamera::updateCameraAngle, this, _2)); + + mCameraAngleChangedSignal = gSavedSettings.getControl("CameraAngle")->getCommitSignal()->connect(boost::bind(&LLViewerCamera::updateCameraAngle, this, _2)); +} + +LLViewerCamera::~LLViewerCamera() +{ + mCameraAngleChangedSignal.disconnect(); } void LLViewerCamera::updateCameraLocation(const LLVector3 ¢er, const LLVector3 &up_direction, const LLVector3 &point_of_interest) @@ -196,7 +202,7 @@ void LLViewerCamera::calcProjection(const F32 far_distance) const // height. //static -void LLViewerCamera::updateFrustumPlanes(LLCamera& camera, BOOL ortho, BOOL zflip, BOOL no_hacks) +void LLViewerCamera::updateFrustumPlanes(LLCamera& camera, bool ortho, bool zflip, bool no_hacks) { #if GLU_VERSION_1_1 GLint* viewport = (GLint*) gGLViewport; @@ -294,17 +300,17 @@ void LLViewerCamera::updateFrustumPlanes(LLCamera& camera, BOOL ortho, BOOL zfli #endif // GLU_VERSION_1_1 } -void LLViewerCamera::setPerspective(BOOL for_selection, +void LLViewerCamera::setPerspective(bool for_selection, S32 x, S32 y_from_bot, S32 width, S32 height, - BOOL limit_select_distance, + bool limit_select_distance, F32 z_near, F32 z_far) { F32 fov_y, aspect; fov_y = RAD_TO_DEG * getView(); - BOOL z_default_far = FALSE; + bool z_default_far = false; if (z_far <= 0) { - z_default_far = TRUE; + z_default_far = true; z_far = getFar(); } if (z_near <= 0) @@ -446,11 +452,11 @@ void LLViewerCamera::projectScreenToPosAgent(const S32 screen_x, const S32 scree } // Uses the last GL matrices set in set_perspective to project a point from -// the agent's region space to screen coordinates. Returns TRUE if point in within +// the agent's region space to screen coordinates. Returns true if point in within // the current window. -BOOL LLViewerCamera::projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoordGL &out_point, const BOOL clamp) const +bool LLViewerCamera::projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoordGL &out_point, const bool clamp) const { - BOOL in_front = TRUE; + bool in_front = true; GLdouble x, y, z; // object's window coords, GL-style LLVector3 dir_to_point = pos_agent - getOrigin(); @@ -460,11 +466,11 @@ BOOL LLViewerCamera::projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoord { if (clamp) { - return FALSE; + return false; } else { - in_front = FALSE; + in_front = false; } } @@ -500,19 +506,19 @@ BOOL LLViewerCamera::projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoord S32 int_x = lltrunc(x); S32 int_y = lltrunc(y); - BOOL valid = TRUE; + bool valid = true; if (clamp) { if (int_x < world_rect.mLeft) { out_point.mX = world_rect.mLeft; - valid = FALSE; + valid = false; } else if (int_x > world_rect.mRight) { out_point.mX = world_rect.mRight; - valid = FALSE; + valid = false; } else { @@ -522,12 +528,12 @@ BOOL LLViewerCamera::projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoord if (int_y < world_rect.mBottom) { out_point.mY = world_rect.mBottom; - valid = FALSE; + valid = false; } else if (int_y > world_rect.mTop) { out_point.mY = world_rect.mTop; - valid = FALSE; + valid = false; } else { @@ -542,19 +548,19 @@ BOOL LLViewerCamera::projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoord if (int_x < world_rect.mLeft) { - valid = FALSE; + valid = false; } else if (int_x > world_rect.mRight) { - valid = FALSE; + valid = false; } if (int_y < world_rect.mBottom) { - valid = FALSE; + valid = false; } else if (int_y > world_rect.mTop) { - valid = FALSE; + valid = false; } return in_front && valid; @@ -563,24 +569,24 @@ BOOL LLViewerCamera::projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoord else #endif // GLU_VERSION_1_1 { - return FALSE; + return false; } } // Uses the last GL matrices set in set_perspective to project a point from // the agent's region space to the nearest edge in screen coordinates. -// Returns TRUE if projection succeeds. -BOOL LLViewerCamera::projectPosAgentToScreenEdge(const LLVector3 &pos_agent, +// Returns true if projection succeeds. +bool LLViewerCamera::projectPosAgentToScreenEdge(const LLVector3 &pos_agent, LLCoordGL &out_point) const { #if GLU_VERSION_1_1 LLVector3 dir_to_point = pos_agent - getOrigin(); dir_to_point /= dir_to_point.magVec(); - BOOL in_front = TRUE; + bool in_front = true; if (dir_to_point * getAtAxis() < 0.f) { - in_front = FALSE; + in_front = false; } LLRect world_view_rect = gViewerWindow->getWorldViewRectRaw(); @@ -621,7 +627,7 @@ BOOL LLViewerCamera::projectPosAgentToScreenEdge(const LLVector3 &pos_agent, if (x == center_x && y == center_y) { // can't project to edge from exact center - return FALSE; + return false; } // find the line from center to local @@ -718,10 +724,10 @@ BOOL LLViewerCamera::projectPosAgentToScreenEdge(const LLVector3 &pos_agent, out_point.mX = int_x + world_rect.mLeft; out_point.mY = int_y + world_rect.mBottom; - return TRUE; + return true; } #endif // GLU_VERSION_1_1 - return FALSE; + return false; } @@ -746,7 +752,7 @@ LLVector3 LLViewerCamera::roundToPixel(const LLVector3 &pos_agent) F32 dist = (pos_agent - getOrigin()).magVec(); // Convert to screen space and back, preserving the depth. LLCoordGL screen_point; - if (!projectPosAgentToScreen(pos_agent, screen_point, FALSE)) + if (!projectPosAgentToScreen(pos_agent, screen_point, false)) { // Off the screen, just return the original position. return pos_agent; @@ -768,14 +774,14 @@ LLVector3 LLViewerCamera::roundToPixel(const LLVector3 &pos_agent) return pos_agent_rounded; } -BOOL LLViewerCamera::cameraUnderWater() const +bool LLViewerCamera::cameraUnderWater() const { LLViewerRegion* regionp = LLWorld::instance().getRegionFromPosAgent(getOrigin()); if (gPipeline.mHeroProbeManager.isMirrorPass()) { // TODO: figure out how to handle this case - return FALSE; + return false; } if (!regionp) @@ -785,26 +791,26 @@ BOOL LLViewerCamera::cameraUnderWater() const if(!regionp) { - return FALSE ; + return false ; } return getOrigin().mV[VZ] < regionp->getWaterHeight(); } -BOOL LLViewerCamera::areVertsVisible(LLViewerObject* volumep, BOOL all_verts) +bool LLViewerCamera::areVertsVisible(LLViewerObject* volumep, bool all_verts) { S32 i, num_faces; LLDrawable* drawablep = volumep->mDrawable; if (!drawablep) { - return FALSE; + return false; } LLVolume* volume = volumep->getVolume(); if (!volume) { - return FALSE; + return false; } LLVOVolume* vo_volume = (LLVOVolume*) volumep; @@ -824,7 +830,7 @@ BOOL LLViewerCamera::areVertsVisible(LLViewerObject* volumep, BOOL all_verts) { const LLVolumeFace& face = volume->getVolumeFace(i); - for (U32 v = 0; v < face.mNumVertices; v++) + for (S32 v = 0; v < face.mNumVertices; v++) { const LLVector4a& src_vec = face.mPositions[v]; LLVector4a vec; @@ -836,7 +842,7 @@ BOOL LLViewerCamera::areVertsVisible(LLViewerObject* volumep, BOOL all_verts) render_mata.affineTransform(t, vec); } - BOOL in_frustum = pointInFrustum(LLVector3(vec.getF32ptr())) > 0; + bool in_frustum = pointInFrustum(LLVector3(vec.getF32ptr())) > 0; if (( !in_frustum && all_verts) || (in_frustum && !all_verts)) @@ -848,7 +854,7 @@ BOOL LLViewerCamera::areVertsVisible(LLViewerObject* volumep, BOOL all_verts) return all_verts; } -extern BOOL gCubeSnapshot; +extern bool gCubeSnapshot; // changes local camera and broadcasts change /* virtual */ void LLViewerCamera::setView(F32 vertical_fov_rads) @@ -893,20 +899,18 @@ void LLViewerCamera::setDefaultFOV(F32 vertical_fov_rads) mCosHalfCameraFOV = cosf(mCameraFOVDefault * 0.5f); } -BOOL LLViewerCamera::isDefaultFOVChanged() +bool LLViewerCamera::isDefaultFOVChanged() { if(mPrevCameraFOVDefault != mCameraFOVDefault) { mPrevCameraFOVDefault = mCameraFOVDefault; return !gSavedSettings.getBOOL("IgnoreFOVZoomForLODs"); } - return FALSE; + return false; } -// static -void LLViewerCamera::updateCameraAngle( void* user_data, const LLSD& value) +void LLViewerCamera::updateCameraAngle(const LLSD& value) { - LLViewerCamera* self=(LLViewerCamera*)user_data; - self->setDefaultFOV(value.asReal()); + setDefaultFOV(value.asReal()); } diff --git a/indra/newview/llviewercamera.h b/indra/newview/llviewercamera.h index 3bbb33f82c..a204b85d88 100644 --- a/indra/newview/llviewercamera.h +++ b/indra/newview/llviewercamera.h @@ -35,14 +35,15 @@ #include "lltrace.h" class LLViewerObject; -const BOOL FOR_SELECTION = TRUE; -const BOOL NOT_FOR_SELECTION = FALSE; +const bool FOR_SELECTION = true; +const bool NOT_FOR_SELECTION = false; class alignas(16) LLViewerCamera : public LLCamera, public LLSimpleton<LLViewerCamera> { LL_ALIGN_NEW public: LLViewerCamera(); + ~LLViewerCamera(); typedef enum { @@ -64,17 +65,17 @@ public: const LLVector3 &up_direction, const LLVector3 &point_of_interest); - static void updateFrustumPlanes(LLCamera& camera, BOOL ortho = FALSE, BOOL zflip = FALSE, BOOL no_hacks = FALSE); - static void updateCameraAngle(void* user_data, const LLSD& value); - void setPerspective(BOOL for_selection, S32 x, S32 y_from_bot, S32 width, S32 height, BOOL limit_select_distance, F32 z_near = 0, F32 z_far = 0); + static void updateFrustumPlanes(LLCamera& camera, bool ortho = false, bool zflip = false, bool no_hacks = false); + void updateCameraAngle(const LLSD& value); + void setPerspective(bool for_selection, S32 x, S32 y_from_bot, S32 width, S32 height, bool limit_select_distance, F32 z_near = 0, F32 z_far = 0); const LLMatrix4 &getProjection() const; const LLMatrix4 &getModelview() const; // Warning! These assume the current global matrices are correct void projectScreenToPosAgent(const S32 screen_x, const S32 screen_y, LLVector3* pos_agent ) const; - BOOL projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoordGL &out_point, const BOOL clamp = TRUE) const; - BOOL projectPosAgentToScreenEdge(const LLVector3 &pos_agent, LLCoordGL &out_point) const; + bool projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoordGL &out_point, const bool clamp = true) const; + bool projectPosAgentToScreenEdge(const LLVector3 &pos_agent, LLCoordGL &out_point) const; LLVector3 getVelocityDir() const {return mVelocityDir;} static LLTrace::CountStatHandle<>* getVelocityStat() {return &sVelocityStat; } @@ -92,10 +93,10 @@ public: void setDefaultFOV(F32 fov) ; F32 getDefaultFOV() { return mCameraFOVDefault; } - BOOL isDefaultFOVChanged(); + bool isDefaultFOVChanged(); - BOOL cameraUnderWater() const; - BOOL areVertsVisible(LLViewerObject* volumep, BOOL all_verts); + bool cameraUnderWater() const; + bool areVertsVisible(LLViewerObject* volumep, bool all_verts); const LLVector3 &getPointOfInterest() { return mLastPointOfInterest; } F32 getPixelMeterRatio() const { return mPixelMeterRatio; } @@ -125,6 +126,8 @@ protected: F32 mZoomFactor; S16 mZoomSubregion; + boost::signals2::connection mCameraAngleChangedSignal; + public: }; diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 7997bcfbdb..cd6e780aa8 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -81,7 +81,7 @@ #include <boost/algorithm/string.hpp> #ifdef TOGGLE_HACKED_GODLIKE_VIEWER -BOOL gHackGodmode = FALSE; +bool gHackGodmode = false; #endif // Should you contemplate changing the name "Global", please first grep for @@ -94,9 +94,9 @@ LLControlGroup gWarningSettings("Warnings"); // persists ignored dialogs/warning std::string gLastRunVersion; -extern BOOL gResizeScreenTexture; -extern BOOL gResizeShadowTexture; -extern BOOL gDebugGL; +extern bool gResizeScreenTexture; +extern bool gResizeShadowTexture; +extern bool gDebugGL; //////////////////////////////////////////////////////////////////////////// // Listeners @@ -265,7 +265,7 @@ static bool handleVSyncChanged(const LLSD& newvalue) LLPerfStats::tunables.vsyncEnabled = newvalue.asBoolean(); gViewerWindow->getWindow()->toggleVSync(newvalue.asBoolean()); - if(newvalue.asBoolean() == true) + if (newvalue.asBoolean()) { U32 current_target = gSavedSettings.getU32("TargetFPS"); gSavedSettings.setU32("TargetFPS", std::min((U32)gViewerWindow->getWindow()->getRefreshRate(), current_target)); @@ -295,12 +295,12 @@ static bool handleAvatarPhysicsLODChanged(const LLSD& newvalue) static bool handleTerrainLODChanged(const LLSD& newvalue) { - LLVOSurfacePatch::sLODFactor = (F32)newvalue.asReal(); - //sqaure lod factor to get exponential range of [0,4] and keep - //a value of 1 in the middle of the detail slider for consistency - //with other detail sliders (see panel_preferences_graphics1.xml) - LLVOSurfacePatch::sLODFactor *= LLVOSurfacePatch::sLODFactor; - return true; + LLVOSurfacePatch::sLODFactor = (F32)newvalue.asReal(); + //sqaure lod factor to get exponential range of [0,4] and keep + //a value of 1 in the middle of the detail slider for consistency + //with other detail sliders (see panel_preferences_graphics1.xml) + LLVOSurfacePatch::sLODFactor *= LLVOSurfacePatch::sLODFactor; + return true; } static bool handleTreeLODChanged(const LLSD& newvalue) @@ -375,7 +375,7 @@ static void handleAudioVolumeChanged(const LLSD& newvalue) static bool handleJoystickChanged(const LLSD& newvalue) { - LLViewerJoystick::getInstance()->setCameraNeedsUpdate(TRUE); + LLViewerJoystick::getInstance()->setCameraNeedsUpdate(true); return true; } @@ -453,7 +453,7 @@ static bool handleRenderDebugPipelineChanged(const LLSD& newvalue) static bool handleRenderResolutionDivisorChanged(const LLSD&) { - gResizeScreenTexture = TRUE; + gResizeScreenTexture = true; return true; } @@ -468,6 +468,7 @@ static bool handleLogFileChanged(const LLSD& newvalue) std::string log_filename = newvalue.asString(); LLFile::remove(log_filename); LLError::logToFile(log_filename); + LL_INFOS() << "Logging switched to " << log_filename << LL_ENDL; return true; } @@ -488,7 +489,7 @@ bool handleHighResSnapshotChanged(const LLSD& newvalue) // High Res Snapshot active, must uncheck RenderUIInSnapshot if (newvalue.asBoolean()) { - gSavedSettings.setBOOL( "RenderUIInSnapshot", FALSE ); + gSavedSettings.setBOOL( "RenderUIInSnapshot", false); } return true; } @@ -667,8 +668,13 @@ void handlePerformanceStatsEnabledChanged(const LLSD& newValue) } void handleUserImpostorByDistEnabledChanged(const LLSD& newValue) { - const auto newval = gSavedSettings.getBOOL("AutoTuneImpostorByDistEnabled"); - LLPerfStats::tunables.userImpostorDistanceTuningEnabled = newval; + bool auto_tune_newval = false; + S32 mode = gSavedSettings.getS32("RenderAvatarComplexityMode"); + if (mode != LLVOAvatar::AV_RENDER_ONLY_SHOW_FRIENDS) + { + auto_tune_newval = gSavedSettings.getBOOL("AutoTuneImpostorByDistEnabled"); + } + LLPerfStats::tunables.userImpostorDistanceTuningEnabled = auto_tune_newval; } void handleUserImpostorDistanceChanged(const LLSD& newValue) { @@ -688,6 +694,28 @@ void handleLocalTerrainChanged(const LLSD& newValue) const auto setting = gSavedSettings.getString(std::string("LocalTerrainAsset") + std::to_string(i + 1)); const LLUUID materialID(setting); gLocalTerrainMaterials.setDetailAssetID(i, materialID); + + // *NOTE: The GLTF spec allows for different texture infos to have their texture transforms set independently, but as a simplification, this debug setting only updates all the transforms in-sync (i.e. only one texture transform per terrain material). + LLGLTFMaterial::TextureTransform transform; + const std::string prefix = std::string("LocalTerrainTransform") + std::to_string(i + 1); + transform.mScale.mV[VX] = gSavedSettings.getF32(prefix + "ScaleU"); + transform.mScale.mV[VY] = gSavedSettings.getF32(prefix + "ScaleV"); + transform.mRotation = gSavedSettings.getF32(prefix + "Rotation") * DEG_TO_RAD; + transform.mOffset.mV[VX] = gSavedSettings.getF32(prefix + "OffsetU"); + transform.mOffset.mV[VY] = gSavedSettings.getF32(prefix + "OffsetV"); + LLPointer<LLGLTFMaterial> mat_override = new LLGLTFMaterial(); + for (U32 info = 0; info < LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; ++info) + { + mat_override->mTextureTransform[info] = transform; + } + if (*mat_override == LLGLTFMaterial::sDefault) + { + gLocalTerrainMaterials.setMaterialOverride(i, nullptr); + } + else + { + gLocalTerrainMaterials.setMaterialOverride(i, mat_override); + } } } //////////////////////////////////////////////////////////////////////////// @@ -751,6 +779,7 @@ void settings_setup_listeners() setting_setup_signal_listener(gSavedSettings, "RenderGlowNoise", handleSetShaderChanged); setting_setup_signal_listener(gSavedSettings, "RenderGammaFull", handleSetShaderChanged); setting_setup_signal_listener(gSavedSettings, "RenderVolumeLODFactor", handleVolumeLODChanged); + setting_setup_signal_listener(gSavedSettings, "RenderAvatarComplexityMode", handleUserImpostorByDistEnabledChanged); setting_setup_signal_listener(gSavedSettings, "RenderAvatarLODFactor", handleAvatarLODChanged); setting_setup_signal_listener(gSavedSettings, "RenderAvatarPhysicsLODFactor", handleAvatarPhysicsLODChanged); setting_setup_signal_listener(gSavedSettings, "RenderTerrainLODFactor", handleTerrainLODChanged); @@ -875,10 +904,25 @@ void settings_setup_listeners() setting_setup_signal_listener(gSavedSettings, "AutoTuneImpostorFarAwayDistance", handleUserImpostorDistanceChanged); setting_setup_signal_listener(gSavedSettings, "AutoTuneImpostorByDistEnabled", handleUserImpostorByDistEnabledChanged); setting_setup_signal_listener(gSavedSettings, "TuningFPSStrategy", handleFPSTuningStrategyChanged); - setting_setup_signal_listener(gSavedSettings, "LocalTerrainAsset1", handleLocalTerrainChanged); - setting_setup_signal_listener(gSavedSettings, "LocalTerrainAsset2", handleLocalTerrainChanged); - setting_setup_signal_listener(gSavedSettings, "LocalTerrainAsset3", handleLocalTerrainChanged); - setting_setup_signal_listener(gSavedSettings, "LocalTerrainAsset4", handleLocalTerrainChanged); + { + const char* transform_suffixes[] = { + "ScaleU", + "ScaleV", + "Rotation", + "OffsetU", + "OffsetV" + }; + for (U32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i) + { + const auto asset_setting_name = std::string("LocalTerrainAsset") + std::to_string(i + 1); + setting_setup_signal_listener(gSavedSettings, asset_setting_name, handleLocalTerrainChanged); + for (const char* ts : transform_suffixes) + { + const auto transform_setting_name = std::string("LocalTerrainTransform") + std::to_string(i + 1) + ts; + setting_setup_signal_listener(gSavedSettings, transform_setting_name, handleLocalTerrainChanged); + } + } + } setting_setup_signal_listener(gSavedPerAccountSettings, "AvatarHoverOffsetZ", handleAvatarHoverOffsetChanged); } @@ -890,7 +934,7 @@ DECL_LLCC(U32, (U32)666); DECL_LLCC(S32, (S32)-666); DECL_LLCC(F32, (F32)-666.666); DECL_LLCC(bool, true); -DECL_LLCC(BOOL, FALSE); +DECL_LLCC(bool, false); static LLCachedControl<std::string> mySetting_string("TestCachedControlstring", "Default String Value"); DECL_LLCC(LLVector3, LLVector3(1.0f, 2.0f, 3.0f)); DECL_LLCC(LLVector3d, LLVector3d(6.0f, 5.0f, 4.0f)); @@ -909,7 +953,7 @@ void test_cached_control() TEST_LLCC(S32, (S32)-666); TEST_LLCC(F32, (F32)-666.666); TEST_LLCC(bool, true); - TEST_LLCC(BOOL, FALSE); + TEST_LLCC(bool, false); if((std::string)mySetting_string != "Default String Value") LL_ERRS() << "Fail string" << LL_ENDL; TEST_LLCC(LLVector3, LLVector3(1.0f, 2.0f, 3.0f)); TEST_LLCC(LLVector3d, LLVector3d(6.0f, 5.0f, 4.0f)); diff --git a/indra/newview/llviewercontrol.h b/indra/newview/llviewercontrol.h index d1ee932cc6..b69b065d10 100644 --- a/indra/newview/llviewercontrol.h +++ b/indra/newview/llviewercontrol.h @@ -34,7 +34,7 @@ // allows a hacked godmode to be toggled on and off. #define TOGGLE_HACKED_GODLIKE_VIEWER #ifdef TOGGLE_HACKED_GODLIKE_VIEWER -extern BOOL gHackGodmode; +extern bool gHackGodmode; #endif bool toggle_show_navigation_panel(const LLSD& newvalue); diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 9ed1fbf366..3183b39e98 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -87,21 +87,21 @@ extern bool gShiftFrame; LLPointer<LLViewerTexture> gDisconnectedImagep = NULL; // used to toggle renderer back on after teleport -BOOL gTeleportDisplay = FALSE; +bool gTeleportDisplay = false; LLFrameTimer gTeleportDisplayTimer; LLFrameTimer gTeleportArrivalTimer; const F32 RESTORE_GL_TIME = 5.f; // Wait this long while reloading textures before we raise the curtain -BOOL gForceRenderLandFence = FALSE; -BOOL gDisplaySwapBuffers = FALSE; -BOOL gDepthDirty = FALSE; -BOOL gResizeScreenTexture = FALSE; -BOOL gResizeShadowTexture = FALSE; -BOOL gWindowResized = FALSE; -BOOL gSnapshot = FALSE; -BOOL gCubeSnapshot = FALSE; -BOOL gSnapshotNoPost = FALSE; -BOOL gShaderProfileFrame = FALSE; +bool gForceRenderLandFence = false; +bool gDisplaySwapBuffers = false; +bool gDepthDirty = false; +bool gResizeScreenTexture = false; +bool gResizeShadowTexture = false; +bool gWindowResized = false; +bool gSnapshot = false; +bool gCubeSnapshot = false; +bool gSnapshotNoPost = false; +bool gShaderProfileFrame = false; // This is how long the sim will try to teleport you before giving up. const F32 TELEPORT_EXPIRY = 15.0f; @@ -230,7 +230,7 @@ void display_stats() gMemoryAllocated = U64Bytes(LLMemory::getCurrentRSS()); U32Megabytes memory = gMemoryAllocated; LL_INFOS() << "MEMORY: " << memory << LL_ENDL; - LLMemory::logMemoryInfo(TRUE) ; + LLMemory::logMemoryInfo(true) ; gRecentMemoryTime.reset(); } const F32 ASSET_STORAGE_LOG_FREQUENCY = 60.f; @@ -267,7 +267,7 @@ static void update_tp_display(bool minimized) // is minimized *during* a TP. HB if (minimized) { - gViewerWindow->setShowProgress(FALSE); + gViewerWindow->setShowProgress(false); } const std::string& message = gAgent.getTeleportMessage(); @@ -279,7 +279,7 @@ static void update_tp_display(bool minimized) const std::string& msg = LLAgent::sTeleportProgressMessages["pending"]; if (!minimized) { - gViewerWindow->setShowProgress(TRUE); + gViewerWindow->setShowProgress(true); gViewerWindow->setProgressPercent(llmin(teleport_percent, 0.0f)); gViewerWindow->setProgressString(msg); } @@ -298,7 +298,7 @@ static void update_tp_display(bool minimized) gAgent.setTeleportMessage(msg); if (!minimized) { - gViewerWindow->setShowProgress(TRUE); + gViewerWindow->setShowProgress(true); gViewerWindow->setProgressPercent(llmin(teleport_percent, 0.0f)); gViewerWindow->setProgressString(msg); gViewerWindow->setProgressMessage(gAgent.mMOTD); @@ -332,11 +332,11 @@ static void update_tp_display(bool minimized) gAgent.setTeleportState(LLAgent::TELEPORT_ARRIVING); gAgent.setTeleportMessage(LLAgent::sTeleportProgressMessages["arriving"]); gAgent.sheduleTeleportIM(); - gTextureList.mForceResetTextureStats = TRUE; - gAgentCamera.resetView(TRUE, TRUE); + gTextureList.mForceResetTextureStats = true; + gAgentCamera.resetView(true, true); if (!minimized) { - gViewerWindow->setProgressCancelButtonVisible(FALSE, LLTrans::getString("Cancel")); + gViewerWindow->setProgressCancelButtonVisible(false, LLTrans::getString("Cancel")); gViewerWindow->setProgressPercent(75.f); } break; @@ -354,7 +354,7 @@ static void update_tp_display(bool minimized) } if (!minimized) { - gViewerWindow->setProgressCancelButtonVisible(FALSE, LLTrans::getString("Cancel")); + gViewerWindow->setProgressCancelButtonVisible(false, LLTrans::getString("Cancel")); gViewerWindow->setProgressPercent(arrival_fraction * 25.f + 75.f); gViewerWindow->setProgressString(message); } @@ -379,13 +379,13 @@ static void update_tp_display(bool minimized) case LLAgent::TELEPORT_NONE: // No teleport in progress - gViewerWindow->setShowProgress(FALSE); - gTeleportDisplay = FALSE; + gViewerWindow->setShowProgress(false); + gTeleportDisplay = false; } } // Paint the display! -void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) +void display(bool rebuild, F32 zoom_factor, int subfield, bool for_snapshot) { LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("Render"); @@ -400,22 +400,22 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) gViewerWindow->getWindow()->swapBuffers(); LLPipeline::refreshCachedSettings(); gPipeline.resizeScreenTexture(); - gResizeScreenTexture = FALSE; - gWindowResized = FALSE; + gResizeScreenTexture = false; + gWindowResized = false; return; } if (gResizeShadowTexture) { //skip render on frames where window has been resized gPipeline.resizeShadowTexture(); - gResizeShadowTexture = FALSE; + gResizeShadowTexture = false; } gSnapshot = for_snapshot; if (LLPipeline::sRenderDeferred) { //hack to make sky show up in deferred snapshots - for_snapshot = FALSE; + for_snapshot = false; } LLGLSDefault gls_default; @@ -480,7 +480,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) static F32 last_update_time = 0.f; if ((gFrameTimeSeconds - last_update_time) > 1.f) { - InvalidateRect((HWND)gViewerWindow->getPlatformWindow(), NULL, FALSE); + InvalidateRect((HWND)gViewerWindow->getPlatformWindow(), NULL, false); last_update_time = gFrameTimeSeconds; } #elif LL_DARWIN @@ -508,7 +508,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) LLGLSLShader::initProfile(); } - //LLGLState::verify(FALSE); + //LLGLState::verify(false); ///////////////////////////////////////////////// // @@ -523,7 +523,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) LLVOAvatar::sRenderName = gSavedSettings.getS32("AvatarNameTagMode"); LLVOAvatar::sRenderGroupTitles = (gSavedSettings.getBOOL("NameTagShowGroupTitles") && gSavedSettings.getS32("AvatarNameTagMode")); - gPipeline.mBackfaceCull = TRUE; + gPipeline.mBackfaceCull = true; gFrameCount++; gRecentFrameCount++; if (gFocusMgr.getAppHasFocus()) @@ -567,8 +567,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) F32 percent_done = gRestoreGLTimer.getElapsedTimeF32() * 100.f / RESTORE_GL_TIME; if( percent_done > 100.f ) { - gViewerWindow->setShowProgress(FALSE); - gRestoreGL = FALSE; + gViewerWindow->setShowProgress(false); + gRestoreGL = false; } else { @@ -713,7 +713,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) //Increment drawable frame counter LLDrawable::incrementVisible(); - LLSpatialGroup::sNoDelete = TRUE; + LLSpatialGroup::sNoDelete = true; LLTexUnit::sWhiteTexture = LLViewerFetchedTexture::sWhiteImagep->getTexName(); S32 occlusion = LLPipeline::sUseOcclusion; @@ -721,7 +721,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) { //depth buffer is invalid, don't overwrite occlusion state LLPipeline::sUseOcclusion = llmin(occlusion, 1); } - gDepthDirty = FALSE; + gDepthDirty = false; LLGLState::checkStates(); @@ -740,7 +740,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) if (gResizeScreenTexture) { gPipeline.resizeScreenTexture(); - gResizeScreenTexture = FALSE; + gResizeScreenTexture = false; } gGL.setColorMask(true, true); @@ -901,7 +901,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) // gGL.popMatrix(); //} - LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater() ? TRUE : FALSE; + LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater(); LLGLState::checkStates(); @@ -958,7 +958,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) gOcclusionProgram.bind(); for (U32 i = 0; i < num_types; i++) { - gPipeline.renderObjects(types[i], LLVertexBuffer::MAP_VERTEX, FALSE); + gPipeline.renderObjects(types[i], LLVertexBuffer::MAP_VERTEX, false); } gOcclusionProgram.unbind(); @@ -971,7 +971,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) { LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("Texture Unbind"); - for (U32 i = 0; i < gGLManager.mNumTextureImageUnits; i++) + for (S32 i = 0; i < gGLManager.mNumTextureImageUnits; i++) { //dummy cleanup of any currently bound textures if (gGL.getTexUnit(i)->getCurrType() != LLTexUnit::TT_NONE) { @@ -991,7 +991,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) gPipeline.renderDeferredLighting(); } - LLPipeline::sUnderWaterRender = FALSE; + LLPipeline::sUnderWaterRender = false; { //capture the frame buffer. @@ -1006,7 +1006,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) } - LLSpatialGroup::sNoDelete = FALSE; + LLSpatialGroup::sNoDelete = false; gPipeline.clearReferences(); } @@ -1022,7 +1022,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) if (gShaderProfileFrame) { - gShaderProfileFrame = FALSE; + gShaderProfileFrame = false; LLGLSLShader::finishProfile(); } } @@ -1048,7 +1048,7 @@ void display_cube_face() gPipeline.disableLights(); - gPipeline.mBackfaceCull = TRUE; + gPipeline.mBackfaceCull = true; gViewerWindow->setup3DViewport(); @@ -1070,11 +1070,11 @@ void display_cube_face() LLEnvironment::instance().update(LLViewerCamera::getInstance()); } - LLSpatialGroup::sNoDelete = TRUE; + LLSpatialGroup::sNoDelete = true; S32 occlusion = LLPipeline::sUseOcclusion; LLPipeline::sUseOcclusion = 0; // occlusion data is from main camera point of view, don't read or write it during cube snapshots - //gDepthDirty = TRUE; //let "real" render pipe know it can't trust the depth buffer for occlusion data + //gDepthDirty = true; //let "real" render pipe know it can't trust the depth buffer for occlusion data static LLCullResult result; LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD; @@ -1108,7 +1108,7 @@ void display_cube_face() LLAppViewer::instance()->pingMainloopTimeout("Display:RenderStart"); - LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater() ? TRUE : FALSE; + LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater(); gGL.setColorMask(true, true); @@ -1131,12 +1131,12 @@ void display_cube_face() gPipeline.renderDeferredLighting(); - LLPipeline::sUnderWaterRender = FALSE; + LLPipeline::sUnderWaterRender = false; // Finalize scene //gPipeline.renderFinalize(); - LLSpatialGroup::sNoDelete = FALSE; + LLSpatialGroup::sNoDelete = false; gPipeline.clearReferences(); } @@ -1158,11 +1158,11 @@ void render_hud_attachments() if (LLPipeline::sShowHUDAttachments && !gDisconnected && setup_hud_matrices()) { - LLPipeline::sRenderingHUDs = TRUE; + LLPipeline::sRenderingHUDs = true; LLCamera hud_cam = *LLViewerCamera::getInstance(); hud_cam.setOrigin(-1.f,0,0); hud_cam.setAxes(LLVector3(1,0,0), LLVector3(0,1,0), LLVector3(0,0,1)); - LLViewerCamera::updateFrustumPlanes(hud_cam, TRUE); + LLViewerCamera::updateFrustumPlanes(hud_cam, true); bool render_particles = gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_PARTICLES) && gSavedSettings.getBOOL("RenderHUDParticles"); @@ -1194,7 +1194,7 @@ void render_hud_attachments() //cull, sort, and render hud objects static LLCullResult result; - LLSpatialGroup::sNoDelete = TRUE; + LLSpatialGroup::sNoDelete = true; LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD; gPipeline.updateCull(hud_cam, result); @@ -1229,7 +1229,7 @@ void render_hud_attachments() gPipeline.renderGeomPostDeferred(hud_cam); - LLSpatialGroup::sNoDelete = FALSE; + LLSpatialGroup::sNoDelete = false; //gPipeline.clearReferences(); render_hud_elements(); @@ -1242,7 +1242,7 @@ void render_hud_attachments() gPipeline.toggleRenderDebugFeature(LLPipeline::RENDER_DEBUG_FEATURE_UI); } LLPipeline::sUseOcclusion = use_occlusion; - LLPipeline::sRenderingHUDs = FALSE; + LLPipeline::sRenderingHUDs = false; } gGL.matrixMode(LLRender::MM_PROJECTION); gGL.popMatrix(); @@ -1303,11 +1303,11 @@ bool get_hud_matrices(const LLRect& screen_region, glh::matrix4f &proj, glh::mat tmp_model *= mat; model = tmp_model; - return TRUE; + return true; } else { - return FALSE; + return false; } } @@ -1337,7 +1337,7 @@ bool setup_hud_matrices(const LLRect& screen_region) gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.loadMatrix(model.m); set_current_modelview(model); - return TRUE; + return true; } void render_ui(F32 zoom_factor, int subfield) @@ -1429,7 +1429,7 @@ void swap() { gViewerWindow->getWindow()->swapBuffers(); } - gDisplaySwapBuffers = TRUE; + gDisplaySwapBuffers = true; } void renderCoordinateAxes() @@ -1530,7 +1530,7 @@ void render_ui_3d() draw_axes(); } - gViewerWindow->renderSelections(FALSE, FALSE, TRUE); // Non HUD call in render_hud_elements + gViewerWindow->renderSelections(false, false, true); // Non HUD call in render_hud_elements if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI)) { @@ -1586,7 +1586,7 @@ void render_ui_2d() F32 zoom = gAgentCamera.mHUDCurZoom; gGL.scalef(zoom,zoom,1.f); gGL.color4fv(LLColor4::white.mV); - gl_rect_2d(-half_width, half_height, half_width, -half_height, FALSE); + gl_rect_2d(-half_width, half_height, half_width, -half_height, false); gGL.popMatrix(); gUIProgram.unbind(); stop_glerror(); @@ -1706,7 +1706,7 @@ void render_disconnected_background() raw->expandToPowerOfTwo(); - gDisconnectedImagep = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE ); + gDisconnectedImagep = LLViewerTextureManager::getLocalTexture(raw.get(), false ); gStartTexture = gDisconnectedImagep; gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } diff --git a/indra/newview/llviewerdisplay.h b/indra/newview/llviewerdisplay.h index dbbf56200a..673f51600d 100644 --- a/indra/newview/llviewerdisplay.h +++ b/indra/newview/llviewerdisplay.h @@ -32,15 +32,15 @@ class LLPostProcess; void display_startup(); void display_cleanup(); -void display(BOOL rebuild = TRUE, F32 zoom_factor = 1.f, int subfield = 0, BOOL for_snapshot = FALSE); +void display(bool rebuild = true, F32 zoom_factor = 1.f, int subfield = 0, bool for_snapshot = false); -extern BOOL gDisplaySwapBuffers; -extern BOOL gDepthDirty; -extern BOOL gTeleportDisplay; +extern bool gDisplaySwapBuffers; +extern bool gDepthDirty; +extern bool gTeleportDisplay; extern LLFrameTimer gTeleportDisplayTimer; -extern BOOL gForceRenderLandFence; -extern BOOL gResizeScreenTexture; -extern BOOL gResizeShadowTexture; -extern BOOL gWindowResized; +extern bool gForceRenderLandFence; +extern bool gResizeScreenTexture; +extern bool gResizeShadowTexture; +extern bool gWindowResized; #endif // LL_LLVIEWERDISPLAY_H diff --git a/indra/newview/llviewerfoldertype.cpp b/indra/newview/llviewerfoldertype.cpp index 69eb82bb0b..e9c3277721 100644 --- a/indra/newview/llviewerfoldertype.cpp +++ b/indra/newview/llviewerfoldertype.cpp @@ -42,7 +42,7 @@ struct ViewerFolderEntry : public LLDictionaryEntry ViewerFolderEntry(const std::string &new_category_name, // default name when creating a new category of this type const std::string &icon_name_open, // name of the folder icon const std::string &icon_name_closed, - BOOL is_quiet, // folder doesn't need a UI update when changed + bool is_quiet, // folder doesn't need a UI update when changed bool hide_if_empty, // folder not shown if empty const std::string &dictionary_name = empty_string // no reverse lookup needed on non-ensembles, so in most cases just leave this blank ) @@ -71,7 +71,7 @@ struct ViewerFolderEntry : public LLDictionaryEntry */ mIconNameOpen("Inv_FolderOpen"), mIconNameClosed("Inv_FolderClosed"), mNewCategoryName(new_category_name), - mIsQuiet(FALSE), + mIsQuiet(false), mHideIfEmpty(false) { const std::string delims (","); @@ -96,7 +96,7 @@ struct ViewerFolderEntry : public LLDictionaryEntry const std::string mNewCategoryName; typedef std::vector<std::string> name_vec_t; name_vec_t mAllowedNames; - BOOL mIsQuiet; + bool mIsQuiet; bool mHideIfEmpty; }; @@ -112,45 +112,45 @@ LLViewerFolderDictionary::LLViewerFolderDictionary() { // NEW CATEGORY NAME FOLDER OPEN FOLDER CLOSED QUIET? HIDE IF EMPTY? // |-------------------------|-----------------------|----------------------|-----------|--------------| - addEntry(LLFolderType::FT_TEXTURE, new ViewerFolderEntry("Textures", "Inv_SysOpen", "Inv_SysClosed", FALSE, true)); - addEntry(LLFolderType::FT_SOUND, new ViewerFolderEntry("Sounds", "Inv_SysOpen", "Inv_SysClosed", FALSE, true)); - addEntry(LLFolderType::FT_CALLINGCARD, new ViewerFolderEntry("Calling Cards", "Inv_SysOpen", "Inv_SysClosed", FALSE, true)); - addEntry(LLFolderType::FT_LANDMARK, new ViewerFolderEntry("Landmarks", "Inv_SysOpen", "Inv_SysClosed", FALSE, true)); - addEntry(LLFolderType::FT_CLOTHING, new ViewerFolderEntry("Clothing", "Inv_SysOpen", "Inv_SysClosed", FALSE, true)); - addEntry(LLFolderType::FT_OBJECT, new ViewerFolderEntry("Objects", "Inv_SysOpen", "Inv_SysClosed", FALSE, true)); - addEntry(LLFolderType::FT_NOTECARD, new ViewerFolderEntry("Notecards", "Inv_SysOpen", "Inv_SysClosed", FALSE, true)); - addEntry(LLFolderType::FT_ROOT_INVENTORY, new ViewerFolderEntry("My Inventory", "Inv_SysOpen", "Inv_SysClosed", FALSE, false)); - addEntry(LLFolderType::FT_LSL_TEXT, new ViewerFolderEntry("Scripts", "Inv_SysOpen", "Inv_SysClosed", FALSE, true)); - addEntry(LLFolderType::FT_BODYPART, new ViewerFolderEntry("Body Parts", "Inv_SysOpen", "Inv_SysClosed", FALSE, true)); - addEntry(LLFolderType::FT_TRASH, new ViewerFolderEntry("Trash", "Inv_TrashOpen", "Inv_TrashClosed", TRUE, false)); - addEntry(LLFolderType::FT_SNAPSHOT_CATEGORY, new ViewerFolderEntry("Photo Album", "Inv_SysOpen", "Inv_SysClosed", FALSE, true)); - addEntry(LLFolderType::FT_LOST_AND_FOUND, new ViewerFolderEntry("Lost And Found", "Inv_LostOpen", "Inv_LostClosed", TRUE, true)); - addEntry(LLFolderType::FT_ANIMATION, new ViewerFolderEntry("Animations", "Inv_SysOpen", "Inv_SysClosed", FALSE, true)); - addEntry(LLFolderType::FT_GESTURE, new ViewerFolderEntry("Gestures", "Inv_SysOpen", "Inv_SysClosed", FALSE, true)); - addEntry(LLFolderType::FT_FAVORITE, new ViewerFolderEntry("Favorites", "Inv_SysOpen", "Inv_SysClosed", FALSE, true)); - - addEntry(LLFolderType::FT_CURRENT_OUTFIT, new ViewerFolderEntry("Current Outfit", "Inv_SysOpen", "Inv_SysClosed", TRUE, false)); - addEntry(LLFolderType::FT_OUTFIT, new ViewerFolderEntry("New Outfit", "Inv_LookFolderOpen", "Inv_LookFolderClosed", TRUE, false)); - addEntry(LLFolderType::FT_MY_OUTFITS, new ViewerFolderEntry("My Outfits", "Inv_SysOpen", "Inv_SysClosed", TRUE, true)); - addEntry(LLFolderType::FT_MESH, new ViewerFolderEntry("Meshes", "Inv_SysOpen", "Inv_SysClosed", FALSE, true)); - addEntry(LLFolderType::FT_SETTINGS, new ViewerFolderEntry("Settings", "Inv_SysOpen", "Inv_SysClosed", FALSE, true)); - addEntry(LLFolderType::FT_MATERIAL, new ViewerFolderEntry("Materials", "Inv_SysOpen", "Inv_SysClosed", FALSE, true)); + addEntry(LLFolderType::FT_TEXTURE, new ViewerFolderEntry("Textures", "Inv_SysOpen", "Inv_SysClosed", false, true)); + addEntry(LLFolderType::FT_SOUND, new ViewerFolderEntry("Sounds", "Inv_SysOpen", "Inv_SysClosed", false, true)); + addEntry(LLFolderType::FT_CALLINGCARD, new ViewerFolderEntry("Calling Cards", "Inv_SysOpen", "Inv_SysClosed", false, true)); + addEntry(LLFolderType::FT_LANDMARK, new ViewerFolderEntry("Landmarks", "Inv_SysOpen", "Inv_SysClosed", false, true)); + addEntry(LLFolderType::FT_CLOTHING, new ViewerFolderEntry("Clothing", "Inv_SysOpen", "Inv_SysClosed", false, true)); + addEntry(LLFolderType::FT_OBJECT, new ViewerFolderEntry("Objects", "Inv_SysOpen", "Inv_SysClosed", false, true)); + addEntry(LLFolderType::FT_NOTECARD, new ViewerFolderEntry("Notecards", "Inv_SysOpen", "Inv_SysClosed", false, true)); + addEntry(LLFolderType::FT_ROOT_INVENTORY, new ViewerFolderEntry("My Inventory", "Inv_SysOpen", "Inv_SysClosed", false, false)); + addEntry(LLFolderType::FT_LSL_TEXT, new ViewerFolderEntry("Scripts", "Inv_SysOpen", "Inv_SysClosed", false, true)); + addEntry(LLFolderType::FT_BODYPART, new ViewerFolderEntry("Body Parts", "Inv_SysOpen", "Inv_SysClosed", false, true)); + addEntry(LLFolderType::FT_TRASH, new ViewerFolderEntry("Trash", "Inv_TrashOpen", "Inv_TrashClosed", true, false)); + addEntry(LLFolderType::FT_SNAPSHOT_CATEGORY, new ViewerFolderEntry("Photo Album", "Inv_SysOpen", "Inv_SysClosed", false, true)); + addEntry(LLFolderType::FT_LOST_AND_FOUND, new ViewerFolderEntry("Lost And Found", "Inv_LostOpen", "Inv_LostClosed", true, true)); + addEntry(LLFolderType::FT_ANIMATION, new ViewerFolderEntry("Animations", "Inv_SysOpen", "Inv_SysClosed", false, true)); + addEntry(LLFolderType::FT_GESTURE, new ViewerFolderEntry("Gestures", "Inv_SysOpen", "Inv_SysClosed", false, true)); + addEntry(LLFolderType::FT_FAVORITE, new ViewerFolderEntry("Favorites", "Inv_SysOpen", "Inv_SysClosed", false, true)); + + addEntry(LLFolderType::FT_CURRENT_OUTFIT, new ViewerFolderEntry("Current Outfit", "Inv_SysOpen", "Inv_SysClosed", true, false)); + addEntry(LLFolderType::FT_OUTFIT, new ViewerFolderEntry("New Outfit", "Inv_LookFolderOpen", "Inv_LookFolderClosed", true, false)); + addEntry(LLFolderType::FT_MY_OUTFITS, new ViewerFolderEntry("My Outfits", "Inv_SysOpen", "Inv_SysClosed", true, true)); + addEntry(LLFolderType::FT_MESH, new ViewerFolderEntry("Meshes", "Inv_SysOpen", "Inv_SysClosed", false, true)); + addEntry(LLFolderType::FT_SETTINGS, new ViewerFolderEntry("Settings", "Inv_SysOpen", "Inv_SysClosed", false, true)); + addEntry(LLFolderType::FT_MATERIAL, new ViewerFolderEntry("Materials", "Inv_SysOpen", "Inv_SysClosed", false, true)); bool boxes_invisible = !gSavedSettings.getBOOL("InventoryOutboxMakeVisible"); - addEntry(LLFolderType::FT_INBOX, new ViewerFolderEntry("Received Items", "Inv_SysOpen", "Inv_SysClosed", FALSE, boxes_invisible)); - addEntry(LLFolderType::FT_OUTBOX, new ViewerFolderEntry("Merchant Outbox", "Inv_SysOpen", "Inv_SysClosed", FALSE, true)); + addEntry(LLFolderType::FT_INBOX, new ViewerFolderEntry("Received Items", "Inv_SysOpen", "Inv_SysClosed", false, boxes_invisible)); + addEntry(LLFolderType::FT_OUTBOX, new ViewerFolderEntry("Merchant Outbox", "Inv_SysOpen", "Inv_SysClosed", false, true)); - addEntry(LLFolderType::FT_BASIC_ROOT, new ViewerFolderEntry("Basic Root", "Inv_SysOpen", "Inv_SysClosed", FALSE, true)); + addEntry(LLFolderType::FT_BASIC_ROOT, new ViewerFolderEntry("Basic Root", "Inv_SysOpen", "Inv_SysClosed", false, true)); - addEntry(LLFolderType::FT_MARKETPLACE_LISTINGS, new ViewerFolderEntry("Marketplace Listings", "Inv_SysOpen", "Inv_SysClosed", FALSE, boxes_invisible)); - addEntry(LLFolderType::FT_MARKETPLACE_STOCK, new ViewerFolderEntry("New Stock", "Inv_StockFolderOpen", "Inv_StockFolderClosed", FALSE, false, "default")); - addEntry(LLFolderType::FT_MARKETPLACE_VERSION, new ViewerFolderEntry("New Version", "Inv_VersionFolderOpen","Inv_VersionFolderClosed", FALSE, false, "default")); + addEntry(LLFolderType::FT_MARKETPLACE_LISTINGS, new ViewerFolderEntry("Marketplace Listings", "Inv_SysOpen", "Inv_SysClosed", false, boxes_invisible)); + addEntry(LLFolderType::FT_MARKETPLACE_STOCK, new ViewerFolderEntry("New Stock", "Inv_StockFolderOpen", "Inv_StockFolderClosed", false, false, "default")); + addEntry(LLFolderType::FT_MARKETPLACE_VERSION, new ViewerFolderEntry("New Version", "Inv_VersionFolderOpen","Inv_VersionFolderClosed", false, false, "default")); - addEntry(LLFolderType::FT_NONE, new ViewerFolderEntry("New Folder", "Inv_FolderOpen", "Inv_FolderClosed", FALSE, false, "default")); + addEntry(LLFolderType::FT_NONE, new ViewerFolderEntry("New Folder", "Inv_FolderOpen", "Inv_FolderClosed", false, false, "default")); for (U32 type = (U32)LLFolderType::FT_ENSEMBLE_START; type <= (U32)LLFolderType::FT_ENSEMBLE_END; ++type) { - addEntry((LLFolderType::EType)type, new ViewerFolderEntry("New Folder", "Inv_FolderOpen", "Inv_FolderClosed", FALSE, false)); + addEntry((LLFolderType::EType)type, new ViewerFolderEntry("New Folder", "Inv_FolderOpen", "Inv_FolderClosed", false, false)); } } @@ -236,7 +236,7 @@ LLFolderType::EType LLViewerFolderType::lookupTypeFromXUIName(const std::string return LLViewerFolderDictionary::getInstance()->lookup(name); } -const std::string &LLViewerFolderType::lookupIconName(LLFolderType::EType folder_type, BOOL is_open) +const std::string &LLViewerFolderType::lookupIconName(LLFolderType::EType folder_type, bool is_open) { const ViewerFolderEntry *entry = LLViewerFolderDictionary::getInstance()->lookup(folder_type); if (entry) @@ -258,14 +258,14 @@ const std::string &LLViewerFolderType::lookupIconName(LLFolderType::EType folder return badLookup(); } -BOOL LLViewerFolderType::lookupIsQuietType(LLFolderType::EType folder_type) +bool LLViewerFolderType::lookupIsQuietType(LLFolderType::EType folder_type) { const ViewerFolderEntry *entry = LLViewerFolderDictionary::getInstance()->lookup(folder_type); if (entry) { return entry->mIsQuiet; } - return FALSE; + return false; } bool LLViewerFolderType::lookupIsHiddenIfEmpty(LLFolderType::EType folder_type) diff --git a/indra/newview/llviewerfoldertype.h b/indra/newview/llviewerfoldertype.h index 9d65002c86..f25c1113a3 100644 --- a/indra/newview/llviewerfoldertype.h +++ b/indra/newview/llviewerfoldertype.h @@ -38,8 +38,8 @@ public: static const std::string& lookupXUIName(EType folder_type); // name used by the UI static LLFolderType::EType lookupTypeFromXUIName(const std::string& name); - static const std::string& lookupIconName(EType folder_type, BOOL is_open = FALSE); // folder icon name - static BOOL lookupIsQuietType(EType folder_type); // folder doesn't require UI update when changes have occured + static const std::string& lookupIconName(EType folder_type, bool is_open = false); // folder icon name + static bool lookupIsQuietType(EType folder_type); // folder doesn't require UI update when changes have occured static bool lookupIsHiddenIfEmpty(EType folder_type); // folder is not displayed if empty static const std::string& lookupNewCategoryName(EType folder_type); // default name when creating new category static LLFolderType::EType lookupTypeFromNewCategoryName(const std::string& name); // default name when creating new category diff --git a/indra/newview/llviewergesture.cpp b/indra/newview/llviewergesture.cpp index 2f7d4110fb..eacf68dda5 100644 --- a/indra/newview/llviewergesture.cpp +++ b/indra/newview/llviewergesture.cpp @@ -70,37 +70,37 @@ LLViewerGesture::LLViewerGesture(const LLViewerGesture &rhs) { } -BOOL LLViewerGesture::trigger(KEY key, MASK mask) +bool LLViewerGesture::trigger(KEY key, MASK mask) { if (mKey == key && mMask == mask) { - doTrigger( TRUE ); - return TRUE; + doTrigger( true ); + return true; } else { - return FALSE; + return false; } } -BOOL LLViewerGesture::trigger(const std::string &trigger_string) +bool LLViewerGesture::trigger(const std::string &trigger_string) { // Assumes trigger_string is lowercase if (mTriggerLower == trigger_string) { - doTrigger( FALSE ); - return TRUE; + doTrigger( false ); + return true; } else { - return FALSE; + return false; } } // private -void LLViewerGesture::doTrigger( BOOL send_chat ) +void LLViewerGesture::doTrigger( bool send_chat ) { if (mSoundItemID != LLUUID::null) { @@ -132,7 +132,7 @@ void LLViewerGesture::doTrigger( BOOL send_chat ) // Don't play nodding animation, since that might not blend // with the gesture animation. (LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat"))-> - sendChatFromViewer(mOutputString, CHAT_TYPE_NORMAL, FALSE); + sendChatFromViewer(mOutputString, CHAT_TYPE_NORMAL, false); } } @@ -140,7 +140,7 @@ void LLViewerGesture::doTrigger( BOOL send_chat ) LLViewerGestureList::LLViewerGestureList() : LLGestureList() { - mIsLoaded = FALSE; + mIsLoaded = false; } @@ -151,12 +151,12 @@ LLGesture *LLViewerGestureList::create_gesture(U8 **buffer, S32 max_size) } -// See if the prefix matches any gesture. If so, return TRUE +// See if the prefix matches any gesture. If so, return true // and place the full text of the gesture trigger into // output_str -BOOL LLViewerGestureList::matchPrefix(const std::string& in_str, std::string* out_str) +bool LLViewerGestureList::matchPrefix(const std::string& in_str, std::string* out_str) { - S32 in_len = in_str.length(); + S32 in_len = static_cast<S32>(in_str.length()); std::string in_str_lc = in_str; LLStringUtil::toLower(in_str_lc); @@ -177,10 +177,10 @@ BOOL LLViewerGestureList::matchPrefix(const std::string& in_str, std::string* ou if (in_str_lc == trigger_trunc) { *out_str = trigger; - return TRUE; + return true; } } - return FALSE; + return false; } @@ -197,7 +197,7 @@ void LLViewerGestureList::xferCallback(void *data, S32 size, void** /*user_data* LL_ERRS() << "Read off of end of array, error in serialization" << LL_ENDL; } - gGestureList.mIsLoaded = TRUE; + gGestureList.mIsLoaded = true; } else { diff --git a/indra/newview/llviewergesture.h b/indra/newview/llviewergesture.h index 222b0a1327..120a9cdda5 100644 --- a/indra/newview/llviewergesture.h +++ b/indra/newview/llviewergesture.h @@ -46,12 +46,12 @@ public: LLViewerGesture(const LLViewerGesture &gesture); // Triggers if a key/mask matches it - virtual BOOL trigger(KEY key, MASK mask); + virtual bool trigger(KEY key, MASK mask); // Triggers if case-insensitive substring matches (assumes string is lowercase) - virtual BOOL trigger(const std::string &string); + virtual bool trigger(const std::string &string); - void doTrigger( BOOL send_chat ); + void doTrigger( bool send_chat ); protected: static const F32 SOUND_VOLUME; @@ -63,14 +63,14 @@ public: LLViewerGestureList(); //void requestFromServer(); - BOOL getIsLoaded() { return mIsLoaded; } + bool getIsLoaded() { return mIsLoaded; } - //void requestResetFromServer( BOOL is_male ); + //void requestResetFromServer( bool is_male ); - // See if the prefix matches any gesture. If so, return TRUE + // See if the prefix matches any gesture. If so, return true // and place the full text of the gesture trigger into // output_str - BOOL matchPrefix(const std::string& in_str, std::string* out_str); + bool matchPrefix(const std::string& in_str, std::string* out_str); static void xferCallback(void *data, S32 size, void** /*user_data*/, S32 status); @@ -78,7 +78,7 @@ protected: LLGesture *create_gesture(U8 **buffer, S32 max_size); protected: - BOOL mIsLoaded; + bool mIsLoaded; }; extern LLViewerGestureList gGestureList; diff --git a/indra/newview/llviewerinput.cpp b/indra/newview/llviewerinput.cpp index c63f7338ed..ffcbd1b4d8 100644 --- a/indra/newview/llviewerinput.cpp +++ b/indra/newview/llviewerinput.cpp @@ -87,10 +87,10 @@ LLViewerInput gViewerInput; bool agent_jump( EKeystate s ) { - static BOOL first_fly_attempt(TRUE); + static bool first_fly_attempt(true); if (KEYSTATE_UP == s) { - first_fly_attempt = TRUE; + first_fly_attempt = true; return true; } F32 time = gKeyboard->getCurKeyElapsedTime(); @@ -105,8 +105,8 @@ bool agent_jump( EKeystate s ) } else { - gAgent.setFlying(TRUE, first_fly_attempt); - first_fly_attempt = FALSE; + gAgent.setFlying(true, first_fly_attempt); + first_fly_attempt = false; gAgent.moveUp(1); } return true; @@ -570,7 +570,7 @@ bool camera_move_backward_fast( EKeystate s ) bool edit_avatar_spin_ccw( EKeystate s ) { if( KEYSTATE_UP == s ) return true; - gMorphView->setCameraDrivenByKeys( TRUE ); + gMorphView->setCameraDrivenByKeys( true ); gAgentCamera.setOrbitLeftKey( get_orbit_rate() ); //gMorphView->orbitLeft( get_orbit_rate() ); return true; @@ -580,7 +580,7 @@ bool edit_avatar_spin_ccw( EKeystate s ) bool edit_avatar_spin_cw( EKeystate s ) { if( KEYSTATE_UP == s ) return true; - gMorphView->setCameraDrivenByKeys( TRUE ); + gMorphView->setCameraDrivenByKeys( true ); gAgentCamera.setOrbitRightKey( get_orbit_rate() ); //gMorphView->orbitRight( get_orbit_rate() ); return true; @@ -589,7 +589,7 @@ bool edit_avatar_spin_cw( EKeystate s ) bool edit_avatar_spin_over( EKeystate s ) { if( KEYSTATE_UP == s ) return true; - gMorphView->setCameraDrivenByKeys( TRUE ); + gMorphView->setCameraDrivenByKeys( true ); gAgentCamera.setOrbitUpKey( get_orbit_rate() ); //gMorphView->orbitUp( get_orbit_rate() ); return true; @@ -599,7 +599,7 @@ bool edit_avatar_spin_over( EKeystate s ) bool edit_avatar_spin_under( EKeystate s ) { if( KEYSTATE_UP == s ) return true; - gMorphView->setCameraDrivenByKeys( TRUE ); + gMorphView->setCameraDrivenByKeys( true ); gAgentCamera.setOrbitDownKey( get_orbit_rate() ); //gMorphView->orbitDown( get_orbit_rate() ); return true; @@ -608,7 +608,7 @@ bool edit_avatar_spin_under( EKeystate s ) bool edit_avatar_move_forward( EKeystate s ) { if( KEYSTATE_UP == s ) return true; - gMorphView->setCameraDrivenByKeys( TRUE ); + gMorphView->setCameraDrivenByKeys( true ); gAgentCamera.setOrbitInKey( get_orbit_rate() ); //gMorphView->orbitIn(); return true; @@ -618,7 +618,7 @@ bool edit_avatar_move_forward( EKeystate s ) bool edit_avatar_move_backward( EKeystate s ) { if( KEYSTATE_UP == s ) return true; - gMorphView->setCameraDrivenByKeys( TRUE ); + gMorphView->setCameraDrivenByKeys( true ); gAgentCamera.setOrbitOutKey( get_orbit_rate() ); //gMorphView->orbitOut(); return true; @@ -987,7 +987,7 @@ LLViewerInput::LLViewerInput() for (S32 i = 0; i < KEY_COUNT; i++) { - mKeyHandledByUI[i] = FALSE; + mKeyHandledByUI[i] = false; } for (S32 i = 0; i < CLICK_COUNT; i++) { @@ -1047,41 +1047,41 @@ bool LLViewerInput::modeFromString(const std::string& string, S32 *mode) } // static -BOOL LLViewerInput::mouseFromString(const std::string& string, EMouseClickType *mode) +bool LLViewerInput::mouseFromString(const std::string& string, EMouseClickType *mode) { if (string == "LMB") { *mode = CLICK_LEFT; - return TRUE; + return true; } else if (string == "Double LMB") { *mode = CLICK_DOUBLELEFT; - return TRUE; + return true; } else if (string == "MMB") { *mode = CLICK_MIDDLE; - return TRUE; + return true; } else if (string == "MB4") { *mode = CLICK_BUTTON4; - return TRUE; + return true; } else if (string == "MB5") { *mode = CLICK_BUTTON5; - return TRUE; + return true; } else { *mode = CLICK_NONE; - return FALSE; + return false; } } -BOOL LLViewerInput::handleKey(KEY translated_key, MASK translated_mask, BOOL repeated) +bool LLViewerInput::handleKey(KEY translated_key, MASK translated_mask, bool repeated) { // check for re-map EKeyboardMode mode = gViewerInput.getMode(); @@ -1094,17 +1094,17 @@ BOOL LLViewerInput::handleKey(KEY translated_key, MASK translated_mask, BOOL rep } // No repeats of F-keys - BOOL repeatable_key = (translated_key < KEY_F1 || translated_key > KEY_F12); + bool repeatable_key = (translated_key < KEY_F1 || translated_key > KEY_F12); if (!repeatable_key && repeated) { - return FALSE; + return false; } LL_DEBUGS("UserInput") << "keydown -" << translated_key << "-" << LL_ENDL; // skip skipped keys if(mKeysSkippedByUI.find(translated_key) != mKeysSkippedByUI.end()) { - mKeyHandledByUI[translated_key] = FALSE; + mKeyHandledByUI[translated_key] = false; LL_INFOS("KeyboardHandling") << "Key wasn't handled by UI!" << LL_ENDL; } else @@ -1119,7 +1119,7 @@ BOOL LLViewerInput::handleKey(KEY translated_key, MASK translated_mask, BOOL rep return mKeyHandledByUI[translated_key]; } -BOOL LLViewerInput::handleKeyUp(KEY translated_key, MASK translated_mask) +bool LLViewerInput::handleKeyUp(KEY translated_key, MASK translated_mask) { return gViewerWindow->handleKeyUp(translated_key, translated_mask); } @@ -1133,7 +1133,7 @@ bool LLViewerInput::handleGlobalBindsKeyDown(KEY key, MASK mask) return false; } S32 mode = getMode(); - return scanKey(mGlobalKeyBindings[mode], mGlobalKeyBindings[mode].size(), key, mask, TRUE, FALSE, FALSE, FALSE); + return scanKey(mGlobalKeyBindings[mode], static_cast<S32>(mGlobalKeyBindings[mode].size()), key, mask, true, false, false, false); } bool LLViewerInput::handleGlobalBindsKeyUp(KEY key, MASK mask) @@ -1146,7 +1146,7 @@ bool LLViewerInput::handleGlobalBindsKeyUp(KEY key, MASK mask) } S32 mode = getMode(); - return scanKey(mGlobalKeyBindings[mode], mGlobalKeyBindings[mode].size(), key, mask, FALSE, TRUE, FALSE, FALSE); + return scanKey(mGlobalKeyBindings[mode], static_cast<S32>(mGlobalKeyBindings[mode].size()), key, mask, false, true, false, false); } bool LLViewerInput::handleGlobalBindsMouse(EMouseClickType clicktype, MASK mask, bool down) @@ -1162,18 +1162,18 @@ bool LLViewerInput::handleGlobalBindsMouse(EMouseClickType clicktype, MASK mask, S32 mode = getMode(); if (down) { - res = scanMouse(mGlobalMouseBindings[mode], mGlobalMouseBindings[mode].size(), clicktype, mask, MOUSE_STATE_DOWN, true); + res = scanMouse(mGlobalMouseBindings[mode], static_cast<S32>(mGlobalMouseBindings[mode].size()), clicktype, mask, MOUSE_STATE_DOWN, true); } else { - res = scanMouse(mGlobalMouseBindings[mode], mGlobalMouseBindings[mode].size(), clicktype, mask, MOUSE_STATE_UP, true); + res = scanMouse(mGlobalMouseBindings[mode], static_cast<S32>(mGlobalMouseBindings[mode].size()), clicktype, mask, MOUSE_STATE_UP, true); } return res; } -BOOL LLViewerInput::bindKey(const S32 mode, const KEY key, const MASK mask, const std::string& function_name) +bool LLViewerInput::bindKey(const S32 mode, const KEY key, const MASK mask, const std::string& function_name) { - S32 index; + size_t index; typedef boost::function<bool(EKeystate)> function_t; function_t function = NULL; std::string name; @@ -1192,7 +1192,7 @@ BOOL LLViewerInput::bindKey(const S32 mode, const KEY key, const MASK mask, cons { U32 keyidx = ((mask<<16)|key); (mRemapKeys[mode])[keyidx] = ((0<<16)|(KEY_F1+(idx-1))); - return TRUE; + return true; } } } @@ -1208,37 +1208,37 @@ BOOL LLViewerInput::bindKey(const S32 mode, const KEY key, const MASK mask, cons if (!function) { LL_WARNS_ONCE() << "Can't bind key to function " << function_name << ", no function with this name found" << LL_ENDL; - return FALSE; + return false; } if (mode >= MODE_COUNT) { LL_ERRS() << "LLKeyboard::bindKey() - unknown mode passed" << mode << LL_ENDL; - return FALSE; + return false; } // check for duplicate first and overwrite if (result->mIsGlobal) { - S32 size = mGlobalKeyBindings[mode].size(); + auto size = mGlobalKeyBindings[mode].size(); for (index = 0; index < size; index++) { if (key == mGlobalKeyBindings[mode][index].mKey && mask == mGlobalKeyBindings[mode][index].mMask) { mGlobalKeyBindings[mode][index].mFunction = function; - return TRUE; + return true; } } } else { - S32 size = mKeyBindings[mode].size(); + auto size = mKeyBindings[mode].size(); for (index = 0; index < size; index++) { if (key == mKeyBindings[mode][index].mKey && mask == mKeyBindings[mode][index].mMask) { mKeyBindings[mode][index].mFunction = function; - return TRUE; + return true; } } } @@ -1258,12 +1258,12 @@ BOOL LLViewerInput::bindKey(const S32 mode, const KEY key, const MASK mask, cons mKeyBindings[mode].push_back(bind); } - return TRUE; + return true; } -BOOL LLViewerInput::bindMouse(const S32 mode, const EMouseClickType mouse, const MASK mask, const std::string& function_name) +bool LLViewerInput::bindMouse(const S32 mode, const EMouseClickType mouse, const MASK mask, const std::string& function_name) { - S32 index; + size_t index; typedef boost::function<bool(EKeystate)> function_t; function_t function = NULL; @@ -1278,7 +1278,7 @@ BOOL LLViewerInput::bindMouse(const S32 mode, const EMouseClickType mouse, const // priority even over UI and is handled in LLToolCompGun::handleMouseDown // so just mark it as having default handler mLMouseDefaultHandling[mode] = true; - return TRUE; + return true; } LLKeybindFunctionData* result = LLKeyboardActionRegistry::getValue(function_name); @@ -1290,19 +1290,19 @@ BOOL LLViewerInput::bindMouse(const S32 mode, const EMouseClickType mouse, const if (!function) { LL_WARNS_ONCE() << "Can't bind mouse key to function " << function_name << ", no function with this name found" << LL_ENDL; - return FALSE; + return false; } if (mode >= MODE_COUNT) { LL_ERRS() << "LLKeyboard::bindKey() - unknown mode passed" << mode << LL_ENDL; - return FALSE; + return false; } // check for duplicate first and overwrite if (result->mIsGlobal) { - S32 size = mGlobalMouseBindings[mode].size(); + auto size = mGlobalMouseBindings[mode].size(); for (index = 0; index < size; index++) { if (mouse == mGlobalMouseBindings[mode][index].mMouse && mask == mGlobalMouseBindings[mode][index].mMask) @@ -1314,7 +1314,7 @@ BOOL LLViewerInput::bindMouse(const S32 mode, const EMouseClickType mouse, const } else { - S32 size = mMouseBindings[mode].size(); + auto size = mMouseBindings[mode].size(); for (index = 0; index < size; index++) { if (mouse == mMouseBindings[mode][index].mMouse && mask == mMouseBindings[mode][index].mMask) @@ -1340,7 +1340,7 @@ BOOL LLViewerInput::bindMouse(const S32 mode, const EMouseClickType mouse, const mMouseBindings[mode].push_back(bind); } - return TRUE; + return true; } LLViewerInput::KeyBinding::KeyBinding() @@ -1560,9 +1560,9 @@ bool LLViewerInput::scanKey(const std::vector<LLKeyboardBinding> &binding, S32 binding_count, KEY key, MASK mask, - BOOL key_down, - BOOL key_up, - BOOL key_level, + bool key_down, + bool key_up, + bool key_level, bool repeat) const { for (S32 i = 0; i < binding_count; i++) @@ -1598,7 +1598,7 @@ bool LLViewerInput::scanKey(const std::vector<LLKeyboardBinding> &binding, } // Called from scanKeyboard. -bool LLViewerInput::scanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level) const +bool LLViewerInput::scanKey(KEY key, bool key_down, bool key_up, bool key_level) const { if (LLApp::isExiting()) { @@ -1607,7 +1607,7 @@ bool LLViewerInput::scanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level) S32 mode = getMode(); // Consider keyboard scanning as NOT mouse event. JC - MASK mask = gKeyboard->currentMask(FALSE); + MASK mask = gKeyboard->currentMask(false); if (mKeyHandledByUI[key]) { @@ -1615,17 +1615,17 @@ bool LLViewerInput::scanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level) } // don't process key down on repeated keys - BOOL repeat = gKeyboard->getKeyRepeated(key); + bool repeat = gKeyboard->getKeyRepeated(key); - bool res = scanKey(mKeyBindings[mode], mKeyBindings[mode].size(), key, mask, key_down, key_up, key_level, repeat); + bool res = scanKey(mKeyBindings[mode], static_cast<S32>(mKeyBindings[mode].size()), key, mask, key_down, key_up, key_level, repeat); return res; } -BOOL LLViewerInput::handleMouse(LLWindow *window_impl, LLCoordGL pos, MASK mask, EMouseClickType clicktype, BOOL down) +bool LLViewerInput::handleMouse(LLWindow *window_impl, LLCoordGL pos, MASK mask, EMouseClickType clicktype, bool down) { bool is_toolmgr_action = false; - BOOL handled = gViewerWindow->handleAnyMouseClick(window_impl, pos, mask, clicktype, down, is_toolmgr_action); + bool handled = gViewerWindow->handleAnyMouseClick(window_impl, pos, mask, clicktype, down, is_toolmgr_action); if (clicktype != CLICK_NONE) { @@ -1752,8 +1752,8 @@ bool LLViewerInput::scanMouse(EMouseClickType click, EMouseState state) const { bool res = false; S32 mode = getMode(); - MASK mask = gKeyboard->currentMask(TRUE); - res = scanMouse(mMouseBindings[mode], mMouseBindings[mode].size(), click, mask, state, false); + MASK mask = gKeyboard->currentMask(true); + res = scanMouse(mMouseBindings[mode], static_cast<S32>(mMouseBindings[mode].size()), click, mask, state, false); // No user defined actions found or those actions can't handle the key/button, // so handle CONTROL_LBUTTON if nessesary. @@ -1814,14 +1814,14 @@ void LLViewerInput::scanMouse() bool LLViewerInput::isMouseBindUsed(const EMouseClickType mouse, const MASK mask, const S32 mode) const { - S32 size = mMouseBindings[mode].size(); - for (S32 index = 0; index < size; index++) + auto size = mMouseBindings[mode].size(); + for (size_t index = 0; index < size; index++) { if (mouse == mMouseBindings[mode][index].mMouse && mask == mMouseBindings[mode][index].mMask) return true; } size = mGlobalMouseBindings[mode].size(); - for (S32 index = 0; index < size; index++) + for (size_t index = 0; index < size; index++) { if (mouse == mGlobalMouseBindings[mode][index].mMouse && mask == mGlobalMouseBindings[mode][index].mMask) return true; diff --git a/indra/newview/llviewerinput.h b/indra/newview/llviewerinput.h index 29bc5d6886..50b2c4ab9f 100644 --- a/indra/newview/llviewerinput.h +++ b/indra/newview/llviewerinput.h @@ -108,8 +108,8 @@ public: LLViewerInput(); virtual ~LLViewerInput(); - BOOL handleKey(KEY key, MASK mask, BOOL repeated); - BOOL handleKeyUp(KEY key, MASK mask); + bool handleKey(KEY key, MASK mask, bool repeated); + bool handleKeyUp(KEY key, MASK mask); // Handle 'global' keybindings that do not consume event, // yet need to be processed early @@ -122,15 +122,15 @@ public: EKeyboardMode getMode() const; static bool modeFromString(const std::string& string, S32 *mode); // False on failure - static BOOL mouseFromString(const std::string& string, EMouseClickType *mode);// False on failure + static bool mouseFromString(const std::string& string, EMouseClickType *mode);// False on failure bool scanKey(KEY key, - BOOL key_down, - BOOL key_up, - BOOL key_level) const; + bool key_down, + bool key_up, + bool key_level) const; // handleMouse() records state, scanMouse() goes through states, scanMouse(click) processes individual saved states after UI is done with them - BOOL handleMouse(LLWindow *window_impl, LLCoordGL pos, MASK mask, EMouseClickType clicktype, BOOL down); + bool handleMouse(LLWindow *window_impl, LLCoordGL pos, MASK mask, EMouseClickType clicktype, bool down); void scanMouse(); bool isMouseBindUsed(const EMouseClickType mouse, const MASK mask, const S32 mode) const; @@ -144,9 +144,9 @@ private: S32 binding_count, KEY key, MASK mask, - BOOL key_down, - BOOL key_up, - BOOL key_level, + bool key_down, + bool key_up, + bool key_level, bool repeat) const; enum EMouseState @@ -166,8 +166,8 @@ private: bool ignore_additional_masks) const; S32 loadBindingMode(const LLViewerInput::KeyMode& keymode, S32 mode); - BOOL bindKey(const S32 mode, const KEY key, const MASK mask, const std::string& function_name); - BOOL bindMouse(const S32 mode, const EMouseClickType mouse, const MASK mask, const std::string& function_name); + bool bindKey(const S32 mode, const KEY key, const MASK mask, const std::string& function_name); + bool bindMouse(const S32 mode, const EMouseClickType mouse, const MASK mask, const std::string& function_name); void resetBindings(); // Hold all the ugly stuff torn out to make LLKeyboard non-viewer-specific here @@ -186,7 +186,7 @@ private: typedef std::map<U32, U32> key_remap_t; key_remap_t mRemapKeys[MODE_COUNT]; std::set<KEY> mKeysSkippedByUI; - BOOL mKeyHandledByUI[KEY_COUNT]; // key processed successfully by UI + bool mKeyHandledByUI[KEY_COUNT]; // key processed successfully by UI // This is indentical to what llkeyboard does (mKeyRepeated, mKeyLevel, mKeyDown e t c), // just instead of remembering individually as bools, we record state as enum diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 16810efa01..96541b030c 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -298,7 +298,7 @@ public: return false; } LLUUID inventory_id; - if (!inventory_id.set(params[0], FALSE)) + if (!inventory_id.set(params[0], false)) { return false; } @@ -406,7 +406,7 @@ void LLViewerInventoryItem::cloneViewerItem(LLPointer<LLViewerInventoryItem>& ne } } -void LLViewerInventoryItem::updateServer(BOOL is_new) const +void LLViewerInventoryItem::updateServer(bool is_new) const { if(!mIsComplete) { @@ -494,24 +494,24 @@ void LLViewerInventoryItem::fetchFromServer(void) const } // virtual -BOOL LLViewerInventoryItem::unpackMessage(const LLSD& item) +bool LLViewerInventoryItem::unpackMessage(const LLSD& item) { - BOOL rv = LLInventoryItem::fromLLSD(item); + bool rv = LLInventoryItem::fromLLSD(item); LLLocalizedInventoryItemsDictionary::getInstance()->localizeInventoryObjectName(mName); - mIsComplete = TRUE; + mIsComplete = true; return rv; } // virtual -BOOL LLViewerInventoryItem::unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num) +bool LLViewerInventoryItem::unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num) { - BOOL rv = LLInventoryItem::unpackMessage(msg, block, block_num); + bool rv = LLInventoryItem::unpackMessage(msg, block, block_num); LLLocalizedInventoryItemsDictionary::getInstance()->localizeInventoryObjectName(mName); - mIsComplete = TRUE; + mIsComplete = true; return rv; } @@ -540,14 +540,14 @@ void LLViewerInventoryItem::packMessage(LLMessageSystem* msg) const } // virtual -BOOL LLViewerInventoryItem::importLegacyStream(std::istream& input_stream) +bool LLViewerInventoryItem::importLegacyStream(std::istream& input_stream) { - BOOL rv = LLInventoryItem::importLegacyStream(input_stream); - mIsComplete = TRUE; + bool rv = LLInventoryItem::importLegacyStream(input_stream); + mIsComplete = true; return rv; } -void LLViewerInventoryItem::updateParentOnServer(BOOL restamp) const +void LLViewerInventoryItem::updateParentOnServer(bool restamp) const { LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_MoveInventoryItem); @@ -628,7 +628,7 @@ void LLViewerInventoryCategory::packMessage(LLMessageSystem* msg) const msg->addStringFast(_PREHASH_Name, mName); } -void LLViewerInventoryCategory::updateParentOnServer(BOOL restamp) const +void LLViewerInventoryCategory::updateParentOnServer(bool restamp) const { LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_MoveInventoryFolder); @@ -643,7 +643,7 @@ void LLViewerInventoryCategory::updateParentOnServer(BOOL restamp) const gAgent.sendReliableMessage(); } -void LLViewerInventoryCategory::updateServer(BOOL is_new) const +void LLViewerInventoryCategory::updateServer(bool is_new) const { // communicate that change with the server. @@ -746,7 +746,7 @@ S32 LLViewerInventoryCategory::getViewerDescendentCount() const S32 descendents_actual = 0; if(cats && items) { - descendents_actual = cats->size() + items->size(); + descendents_actual = static_cast<S32>(cats->size() + items->size()); } return descendents_actual; } @@ -807,7 +807,7 @@ bool LLViewerInventoryCategory::acceptItem(LLInventoryItem* inv_item) void LLViewerInventoryCategory::determineFolderType() { /* Do NOT uncomment this code. This is for future 2.1 support of ensembles. - llassert(FALSE); + llassert(false); LLFolderType::EType original_type = getPreferredType(); if (LLFolderType::lookupIsProtectedType(original_type)) return; @@ -816,7 +816,7 @@ void LLViewerInventoryCategory::determineFolderType() U64 folder_invalid = 0; LLInventoryModel::cat_array_t category_array; LLInventoryModel::item_array_t item_array; - gInventory.collectDescendents(getUUID(),category_array,item_array,FALSE); + gInventory.collectDescendents(getUUID(),category_array,item_array,false); // For ensembles if (category_array.empty()) @@ -851,7 +851,7 @@ void LLViewerInventoryCategory::determineFolderType() { changeType(LLFolderType::FT_NONE); } - llassert(FALSE); + llassert(false); */ } @@ -882,9 +882,9 @@ void LLViewerInventoryCategory::localizeName() } // virtual -BOOL LLViewerInventoryCategory::unpackMessage(const LLSD& category) +bool LLViewerInventoryCategory::unpackMessage(const LLSD& category) { - BOOL rv = LLInventoryCategory::fromLLSD(category); + bool rv = LLInventoryCategory::fromLLSD(category); localizeName(); return rv; } @@ -1003,7 +1003,7 @@ void set_default_permissions(LLViewerInventoryItem* item, std::string perm_type) item->setPermissions(perm); - item->updateServer(FALSE); + item->updateServer(false); } } @@ -1039,7 +1039,7 @@ void create_gesture_cb(const LLUUID& inv_item) LLPreviewGesture* preview = LLPreviewGesture::show(inv_item, LLUUID::null); // Force to be entirely onscreen. - gFloaterView->adjustToFitScreen(preview, FALSE); + gFloaterView->adjustToFitScreen(preview, false); } } } @@ -1375,7 +1375,7 @@ void move_inventory_item( msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, agent_id); msg->addUUIDFast(_PREHASH_SessionID, session_id); - msg->addBOOLFast(_PREHASH_Stamp, FALSE); + msg->addBOOLFast(_PREHASH_Stamp, false); msg->nextBlockFast(_PREHASH_InventoryData); msg->addUUIDFast(_PREHASH_ItemID, item_id); msg->addUUIDFast(_PREHASH_FolderID, parent_id); @@ -1594,7 +1594,7 @@ void purge_descendents_of(const LLUUID& id, LLPointer<LLInventoryCallback> cb) // Remove items from clipboard or it will remain active even if there is nothing to paste/copy LLInventoryModel::cat_array_t categories; LLInventoryModel::item_array_t items; - gInventory.collectDescendents(id, categories, items, TRUE); + gInventory.collectDescendents(id, categories, items, true); for (LLInventoryModel::cat_array_t::const_iterator it = categories.begin(); it != categories.end(); ++it) { @@ -1837,7 +1837,7 @@ void menu_create_inventory_item(LLInventoryPanel* panel, LLUUID dest_id, const L LLInventoryPanel* panel = static_cast<LLInventoryPanel*>(handle.get()); if (panel) { - panel->setSelectionByID(new_category_id, TRUE); + panel->setSelectionByID(new_category_id, true); } LL_DEBUGS(LOG_INV) << "Done creating inventory: " << new_category_id << LL_ENDL; }; @@ -1934,7 +1934,7 @@ void menu_create_inventory_item(LLInventoryPanel* panel, LLUUID dest_id, const L } if(panel) { - panel->getRootFolder()->setNeedsAutoRename(TRUE); + panel->getRootFolder()->setNeedsAutoRename(true); } } @@ -2146,7 +2146,7 @@ U32 LLViewerInventoryItem::getCRC32() const // *TODO: mantipov: should be removed with LMSortPrefix patch in llinventorymodel.cpp, EXT-3985 static char getSeparator() { return '@'; } -BOOL LLViewerInventoryItem::extractSortFieldAndDisplayName(const std::string& name, S32* sortField, std::string* displayName) +bool LLViewerInventoryItem::extractSortFieldAndDisplayName(const std::string& name, S32* sortField, std::string* displayName) { using std::string; using std::stringstream; @@ -2154,7 +2154,7 @@ BOOL LLViewerInventoryItem::extractSortFieldAndDisplayName(const std::string& na const char separator = getSeparator(); const string::size_type separatorPos = name.find(separator, 0); - BOOL result = FALSE; + bool result = false; if (separatorPos < string::npos) { @@ -2175,7 +2175,7 @@ BOOL LLViewerInventoryItem::extractSortFieldAndDisplayName(const std::string& na *displayName = name.substr(separatorPos + 1, string::npos); } - result = TRUE; + result = true; } return result; @@ -2240,9 +2240,9 @@ PermissionMask LLViewerInventoryItem::getPermissionMask() const { const LLPermissions& permissions = getPermissions(); - BOOL copy = permissions.allowCopyBy(gAgent.getID()); - BOOL mod = permissions.allowModifyBy(gAgent.getID()); - BOOL xfer = permissions.allowOperationBy(PERM_TRANSFER, gAgent.getID()); + bool copy = permissions.allowCopyBy(gAgent.getID()); + bool mod = permissions.allowModifyBy(gAgent.getID()); + bool xfer = permissions.allowOperationBy(PERM_TRANSFER, gAgent.getID()); PermissionMask perm_mask = 0; if (copy) perm_mask |= PERM_COPY; if (mod) perm_mask |= PERM_MODIFY; @@ -2305,11 +2305,11 @@ LLUUID find_possible_item_for_regeneration(const LLViewerInventoryItem *target_i // This currently dosen't work, because the sim does not allow us // to change an item's assetID. -BOOL LLViewerInventoryItem::regenerateLink() +bool LLViewerInventoryItem::regenerateLink() { const LLUUID target_item_id = find_possible_item_for_regeneration(this); if (target_item_id.isNull()) - return FALSE; + return false; LLViewerInventoryCategory::cat_array_t cats; LLViewerInventoryItem::item_array_t items; LLAssetIDMatches asset_id_matches(getAssetUUID()); @@ -2324,9 +2324,9 @@ BOOL LLViewerInventoryItem::regenerateLink() { LLViewerInventoryItem *item = (*item_iter); item->setAssetUUID(target_item_id); - item->updateServer(FALSE); + item->updateServer(false); gInventory.addChangedMask(LLInventoryObserver::REBUILD, item->getUUID()); } gInventory.notifyObservers(); - return TRUE; + return true; } diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index 158965fc88..21a6606253 100644 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -56,7 +56,7 @@ public: protected: ~LLViewerInventoryItem( void ); // ref counted - BOOL extractSortFieldAndDisplayName(S32* sortField, std::string* displayName) const { return extractSortFieldAndDisplayName(mName, sortField, displayName); } + bool extractSortFieldAndDisplayName(S32* sortField, std::string* displayName) const { return extractSortFieldAndDisplayName(mName, sortField, displayName); } mutable std::string mDisplayName; public: @@ -83,7 +83,7 @@ public: virtual time_t getCreationDate() const; virtual U32 getCRC32() const; // really more of a checksum. - static BOOL extractSortFieldAndDisplayName(const std::string& name, S32* sortField, std::string* displayName); + static bool extractSortFieldAndDisplayName(const std::string& name, S32* sortField, std::string* displayName); // construct a complete viewer inventory item LLViewerInventoryItem(const LLUUID& uuid, const LLUUID& parent_uuid, @@ -125,14 +125,14 @@ public: void cloneViewerItem(LLPointer<LLViewerInventoryItem>& newitem) const; // virtual methods - virtual void updateParentOnServer(BOOL restamp) const; - virtual void updateServer(BOOL is_new) const; + virtual void updateParentOnServer(bool restamp) const; + virtual void updateServer(bool is_new) const; void fetchFromServer(void) const; virtual void packMessage(LLMessageSystem* msg) const; - virtual BOOL unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0); - virtual BOOL unpackMessage(const LLSD& item); - virtual BOOL importLegacyStream(std::istream& input_stream); + virtual bool unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0); + virtual bool unpackMessage(const LLSD& item); + virtual bool importLegacyStream(std::istream& input_stream); // new methods bool isFinished() const { return mIsComplete; } @@ -161,7 +161,7 @@ public: void onCallingCardNameLookup(const LLUUID& id, const LLAvatarName& name); // If this is a broken link, try to fix it and any other identical link. - BOOL regenerateLink(); + bool regenerateLink(); public: bool mIsComplete; @@ -197,8 +197,8 @@ public: LLViewerInventoryCategory(const LLViewerInventoryCategory* other); void copyViewerCategory(const LLViewerInventoryCategory* other); - virtual void updateParentOnServer(BOOL restamp_children) const; - virtual void updateServer(BOOL is_new) const; + virtual void updateParentOnServer(bool restamp_children) const; + virtual void updateServer(bool is_new) const; virtual void packMessage(LLMessageSystem* msg) const; @@ -238,7 +238,7 @@ public: void determineFolderType(); void changeType(LLFolderType::EType new_folder_type); virtual void unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0); - virtual BOOL unpackMessage(const LLSD& category); + virtual bool unpackMessage(const LLSD& category); // returns true if the category object will accept the incoming item bool acceptItem(LLInventoryItem* inv_item); diff --git a/indra/newview/llviewerjoint.cpp b/indra/newview/llviewerjoint.cpp index 75dcb8af52..3c5c4752df 100644 --- a/indra/newview/llviewerjoint.cpp +++ b/indra/newview/llviewerjoint.cpp @@ -38,7 +38,7 @@ #include "llvoavatar.h" #include "pipeline.h" -static const S32 MIN_PIXEL_AREA_3PASS_HAIR = 64*64; +static constexpr S32 MIN_PIXEL_AREA_3PASS_HAIR = 64*64; //----------------------------------------------------------------------------- // LLViewerJoint() @@ -67,7 +67,7 @@ LLViewerJoint::~LLViewerJoint() //-------------------------------------------------------------------- // render() //-------------------------------------------------------------------- -U32 LLViewerJoint::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy ) +U32 LLViewerJoint::render( F32 pixelArea, bool first_pass, bool is_dummy ) { stop_glerror(); @@ -107,13 +107,13 @@ U32 LLViewerJoint::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy ) // second pass writes to z buffer only gGL.setColorMask(false, false); { - triangle_count += drawShape( pixelArea, FALSE, is_dummy ); + triangle_count += drawShape( pixelArea, false, is_dummy ); } // third past respects z buffer and writes color gGL.setColorMask(true, false); { LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); - triangle_count += drawShape( pixelArea, FALSE, is_dummy ); + triangle_count += drawShape( pixelArea, false, is_dummy ); } } else @@ -127,7 +127,7 @@ U32 LLViewerJoint::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy ) // Render Outside (write to the Z buffer) glCullFace(GL_BACK); { - triangle_count += drawShape( pixelArea, FALSE, is_dummy ); + triangle_count += drawShape( pixelArea, false, is_dummy ); } } } @@ -149,7 +149,7 @@ U32 LLViewerJoint::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy ) F32 jointLOD = joint->getLOD(); if (pixelArea >= jointLOD || sDisableLOD) { - triangle_count += joint->render( pixelArea, TRUE, is_dummy ); + triangle_count += joint->render( pixelArea, true, is_dummy ); if (jointLOD != DEFAULT_AVATAR_JOINT_LOD) { @@ -164,7 +164,7 @@ U32 LLViewerJoint::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy ) //-------------------------------------------------------------------- // drawShape() //-------------------------------------------------------------------- -U32 LLViewerJoint::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy ) +U32 LLViewerJoint::drawShape( F32 pixelArea, bool first_pass, bool is_dummy ) { return 0; } diff --git a/indra/newview/llviewerjoint.h b/indra/newview/llviewerjoint.h index 67d83908bd..7f52ca9623 100644 --- a/indra/newview/llviewerjoint.h +++ b/indra/newview/llviewerjoint.h @@ -54,11 +54,11 @@ public: // Traverses the entire joint hierarchy, setting up // transforms and calling the drawShape(). // Derived classes may add text/graphic output. - virtual U32 render( F32 pixelArea, BOOL first_pass = TRUE, BOOL is_dummy = FALSE ); // Returns triangle count + virtual U32 render( F32 pixelArea, bool first_pass = true, bool is_dummy = false ); // Returns triangle count // Draws the shape attached to a joint. // Called by render(). - virtual U32 drawShape( F32 pixelArea, BOOL first_pass = TRUE, BOOL is_dummy = FALSE ); + virtual U32 drawShape( F32 pixelArea, bool first_pass = true, bool is_dummy = false ); virtual void drawNormals() {} }; diff --git a/indra/newview/llviewerjointattachment.cpp b/indra/newview/llviewerjointattachment.cpp index d7fe28d77c..e733dafcae 100644 --- a/indra/newview/llviewerjointattachment.cpp +++ b/indra/newview/llviewerjointattachment.cpp @@ -45,19 +45,19 @@ #include "llglheaders.h" extern LLPipeline gPipeline; -const F32 MAX_ATTACHMENT_DIST = 3.5f; // meters +constexpr F32 MAX_ATTACHMENT_DIST = 3.5f; // meters //----------------------------------------------------------------------------- // LLViewerJointAttachment() //----------------------------------------------------------------------------- LLViewerJointAttachment::LLViewerJointAttachment() : - mVisibleInFirst(FALSE), + mVisibleInFirst(false), mGroup(0), - mIsHUDAttachment(FALSE), + mIsHUDAttachment(false), mPieSlice(-1) { - mValid = FALSE; - mUpdateXform = FALSE; + mValid = false; + mUpdateXform = false; mAttachedObjects.clear(); } @@ -71,15 +71,15 @@ LLViewerJointAttachment::~LLViewerJointAttachment() //----------------------------------------------------------------------------- // isTransparent() //----------------------------------------------------------------------------- -BOOL LLViewerJointAttachment::isTransparent() +bool LLViewerJointAttachment::isTransparent() { - return FALSE; + return false; } //----------------------------------------------------------------------------- // drawShape() //----------------------------------------------------------------------------- -U32 LLViewerJointAttachment::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy ) +U32 LLViewerJointAttachment::drawShape( F32 pixelArea, bool first_pass, bool is_dummy ) { if (LLVOAvatar::sShowAttachmentPoints) { @@ -103,7 +103,7 @@ void LLViewerJointAttachment::setupDrawable(LLViewerObject *object) return; if (object->mDrawable->isActive()) { - object->mDrawable->makeStatic(FALSE); + object->mDrawable->makeStatic(false); } object->mDrawable->mXform.setParent(getXform()); // LLViewerJointAttachment::lazyAttach @@ -162,7 +162,7 @@ void LLViewerJointAttachment::setupDrawable(LLViewerObject *object) //----------------------------------------------------------------------------- // addObject() //----------------------------------------------------------------------------- -BOOL LLViewerJointAttachment::addObject(LLViewerObject* object) +bool LLViewerJointAttachment::addObject(LLViewerObject* object) { object->extractAttachmentItemID(); @@ -184,7 +184,7 @@ BOOL LLViewerJointAttachment::addObject(LLViewerObject* object) // If this happens to be attached to self, then detach. LLVOAvatarSelf::detachAttachmentIntoInventory(object->getAttachmentItemID()); - return FALSE; + return false; } mAttachedObjects.push_back(object); @@ -194,7 +194,7 @@ BOOL LLViewerJointAttachment::addObject(LLViewerObject* object) { if (object->mText.notNull()) { - object->mText->setOnHUDAttachment(TRUE); + object->mText->setOnHUDAttachment(true); } LLViewerObject::const_child_list_t& child_list = object->getChildren(); for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); @@ -203,14 +203,14 @@ BOOL LLViewerJointAttachment::addObject(LLViewerObject* object) LLViewerObject* childp = *iter; if (childp && childp->mText.notNull()) { - childp->mText->setOnHUDAttachment(TRUE); + childp->mText->setOnHUDAttachment(true); } } } calcLOD(); - mUpdateXform = TRUE; + mUpdateXform = true; - return TRUE; + return true; } //----------------------------------------------------------------------------- @@ -236,7 +236,7 @@ void LLViewerJointAttachment::removeObject(LLViewerObject *object) } // force object visibile - setAttachmentVisibility(TRUE); + setAttachmentVisibility(true); mAttachedObjects.erase(iter); if (object->mDrawable.notNull()) @@ -244,7 +244,7 @@ void LLViewerJointAttachment::removeObject(LLViewerObject *object) //if object is active, make it static if(object->mDrawable->isActive()) { - object->mDrawable->makeStatic(FALSE); + object->mDrawable->makeStatic(false); } LLVector3 cur_position = object->getRenderPosition(); @@ -252,7 +252,7 @@ void LLViewerJointAttachment::removeObject(LLViewerObject *object) object->mDrawable->mXform.setPosition(cur_position); object->mDrawable->mXform.setRotation(cur_rotation); - gPipeline.markMoved(object->mDrawable, TRUE); + gPipeline.markMoved(object->mDrawable, true); gPipeline.markTextured(object->mDrawable); // face may need to change draw pool to/from POOL_HUD if (mIsHUDAttachment) @@ -294,7 +294,7 @@ void LLViewerJointAttachment::removeObject(LLViewerObject *object) { if (object->mText.notNull()) { - object->mText->setOnHUDAttachment(FALSE); + object->mText->setOnHUDAttachment(false); } LLViewerObject::const_child_list_t& child_list = object->getChildren(); for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); @@ -303,13 +303,13 @@ void LLViewerJointAttachment::removeObject(LLViewerObject *object) LLViewerObject* childp = *iter; if (childp->mText.notNull()) { - childp->mText->setOnHUDAttachment(FALSE); + childp->mText->setOnHUDAttachment(false); } } } if (mAttachedObjects.size() == 0) { - mUpdateXform = FALSE; + mUpdateXform = false; } object->setAttachmentItemID(LLUUID::null); } @@ -317,7 +317,7 @@ void LLViewerJointAttachment::removeObject(LLViewerObject *object) //----------------------------------------------------------------------------- // setAttachmentVisibility() //----------------------------------------------------------------------------- -void LLViewerJointAttachment::setAttachmentVisibility(BOOL visible) +void LLViewerJointAttachment::setAttachmentVisibility(bool visible) { for (attachedobjs_vec_t::const_iterator iter = mAttachedObjects.begin(); iter != mAttachedObjects.end(); @@ -424,18 +424,18 @@ void LLViewerJointAttachment::calcLOD() //----------------------------------------------------------------------------- // updateLOD() //----------------------------------------------------------------------------- -BOOL LLViewerJointAttachment::updateLOD(F32 pixel_area, BOOL activate) +bool LLViewerJointAttachment::updateLOD(F32 pixel_area, bool activate) { - BOOL res = FALSE; + bool res{ false }; if (!mValid) { - setValid(TRUE, TRUE); - res = TRUE; + setValid(true, true); + res = true; } return res; } -BOOL LLViewerJointAttachment::isObjectAttached(const LLViewerObject *viewer_object) const +bool LLViewerJointAttachment::isObjectAttached(const LLViewerObject *viewer_object) const { for (attachedobjs_vec_t::const_iterator iter = mAttachedObjects.begin(); iter != mAttachedObjects.end(); @@ -444,10 +444,10 @@ BOOL LLViewerJointAttachment::isObjectAttached(const LLViewerObject *viewer_obje const LLViewerObject* attached_object = iter->get(); if (attached_object == viewer_object) { - return TRUE; + return true; } } - return FALSE; + return false; } const LLViewerObject *LLViewerJointAttachment::getAttachedObject(const LLUUID &object_id) const @@ -462,7 +462,7 @@ const LLViewerObject *LLViewerJointAttachment::getAttachedObject(const LLUUID &o return attached_object; } } - return NULL; + return nullptr; } LLViewerObject *LLViewerJointAttachment::getAttachedObject(const LLUUID &object_id) @@ -477,5 +477,5 @@ LLViewerObject *LLViewerJointAttachment::getAttachedObject(const LLUUID &object_ return attached_object; } } - return NULL; + return nullptr; } diff --git a/indra/newview/llviewerjointattachment.h b/indra/newview/llviewerjointattachment.h index 3ce790d38d..fe66949f73 100644 --- a/indra/newview/llviewerjointattachment.h +++ b/indra/newview/llviewerjointattachment.h @@ -47,36 +47,34 @@ public: LLViewerJointAttachment(); virtual ~LLViewerJointAttachment(); - //virtual U32 render( F32 pixelArea ); // Returns triangle count - // Returns true if this object is transparent. // This is used to determine in which order to draw objects. - /*virtual*/ BOOL isTransparent(); + bool isTransparent() override; // Draws the shape attached to a joint. // Called by render(). - /*virtual*/ U32 drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy ); + U32 drawShape( F32 pixelArea, bool first_pass, bool is_dummy ) override; - /*virtual*/ BOOL updateLOD(F32 pixel_area, BOOL activate); + bool updateLOD(F32 pixel_area, bool activate) override; // // accessors // void setPieSlice(S32 pie_slice) { mPieSlice = pie_slice; } - void setVisibleInFirstPerson(BOOL visibility) { mVisibleInFirst = visibility; } - BOOL getVisibleInFirstPerson() const { return mVisibleInFirst; } + void setVisibleInFirstPerson(bool visibility) { mVisibleInFirst = visibility; } + bool getVisibleInFirstPerson() const { return mVisibleInFirst; } void setGroup(S32 group) { mGroup = group; } void setOriginalPosition(LLVector3 &position); - void setAttachmentVisibility(BOOL visible); - void setIsHUDAttachment(BOOL is_hud) { mIsHUDAttachment = is_hud; } - BOOL getIsHUDAttachment() const { return mIsHUDAttachment; } + void setAttachmentVisibility(bool visible); + void setIsHUDAttachment(bool is_hud) { mIsHUDAttachment = is_hud; } + bool getIsHUDAttachment() const { return mIsHUDAttachment; } - BOOL isAnimatable() const { return FALSE; } + bool isAnimatable() const override { return false; } S32 getGroup() const { return mGroup; } S32 getPieSlice() const { return mPieSlice; } - S32 getNumObjects() const { return mAttachedObjects.size(); } + S32 getNumObjects() const { return static_cast<S32>(mAttachedObjects.size()); } S32 getNumAnimatedObjects() const; void clampObjectPosition(); @@ -84,13 +82,13 @@ public: // // unique methods // - BOOL addObject(LLViewerObject* object); + bool addObject(LLViewerObject* object); void removeObject(LLViewerObject *object); // // attachments operations // - BOOL isObjectAttached(const LLViewerObject *viewer_object) const; + bool isObjectAttached(const LLViewerObject *viewer_object) const; const LLViewerObject *getAttachedObject(const LLUUID &object_id) const; LLViewerObject *getAttachedObject(const LLUUID &object_id); @@ -103,10 +101,10 @@ protected: void setupDrawable(LLViewerObject *object); private: - BOOL mVisibleInFirst; + bool mVisibleInFirst; LLVector3 mOriginalPos; S32 mGroup; - BOOL mIsHUDAttachment; + bool mIsHUDAttachment; S32 mPieSlice; }; diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index 46f994e15c..3ecf3c39b2 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -108,7 +108,7 @@ void LLViewerJointMesh::uploadJointMatrices() S32 joint_num; LLPolyMesh *reference_mesh = mMesh->getReferenceMesh(); LLDrawPool *poolp = mFace ? mFace->getPool() : NULL; - BOOL hardware_skinning = (poolp && poolp->getShaderLevel() > 0) ? TRUE : FALSE; + bool hardware_skinning = (poolp && poolp->getShaderLevel() > 0); //calculate joint matrices for (joint_num = 0; joint_num < reference_mesh->mJointRenderData.size(); joint_num++) @@ -123,7 +123,7 @@ void LLViewerJointMesh::uploadJointMatrices() gJointRotUnaligned[joint_num] = joint_mat.getMat3(); } - BOOL last_pivot_uploaded = FALSE; + bool last_pivot_uploaded{ false }; S32 j = 0; //upload joint pivots @@ -144,11 +144,11 @@ void LLViewerJointMesh::uploadJointMatrices() gJointPivot[j++] = child_pivot; - last_pivot_uploaded = TRUE; + last_pivot_uploaded = true; } else { - last_pivot_uploaded = FALSE; + last_pivot_uploaded = false; } } @@ -216,7 +216,7 @@ int compare_int(const void *a, const void *b) //-------------------------------------------------------------------- // LLViewerJointMesh::drawShape() //-------------------------------------------------------------------- -U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy) +U32 LLViewerJointMesh::drawShape( F32 pixelArea, bool first_pass, bool is_dummy) { if (!mValid || !mMesh || !mFace || !mVisible || !mFace->getVertexBuffer() || @@ -348,7 +348,7 @@ void LLViewerJointMesh::updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 // updateFaceData() //----------------------------------------------------------------------------- -void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind, bool terse_update) +void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, bool damp_wind, bool terse_update) { //IF THIS FUNCTION BREAKS, SEE LLPOLYMESH CONSTRUCTOR AND CHECK ALIGNMENT OF INPUT ARRAYS @@ -360,7 +360,7 @@ void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_w } LLDrawPool *poolp = mFace->getPool(); - BOOL hardware_skinning = (poolp && poolp->getShaderLevel() > 0) ? TRUE : FALSE; + bool hardware_skinning = (poolp && poolp->getShaderLevel() > 0); if (!hardware_skinning && terse_update) { //no need to do terse updates if we're doing software vertex skinning @@ -431,7 +431,7 @@ void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_w const S32 offset = (S32) mMesh->mFaceVertexOffset; - for (S32 i = 0; i < idx_count; ++i) + for (U32 i = 0; i < idx_count; ++i) { *(idx++) = *(src_idx++)+offset; } @@ -444,10 +444,10 @@ void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_w //----------------------------------------------------------------------------- // updateLOD() //----------------------------------------------------------------------------- -BOOL LLViewerJointMesh::updateLOD(F32 pixel_area, BOOL activate) +bool LLViewerJointMesh::updateLOD(F32 pixel_area, bool activate) { - BOOL valid = mValid; - setValid(activate, TRUE); + bool valid = mValid; + setValid(activate, true); return (valid != activate); } diff --git a/indra/newview/llviewerjointmesh.h b/indra/newview/llviewerjointmesh.h index deeec727a9..cfe8ecdb67 100644 --- a/indra/newview/llviewerjointmesh.h +++ b/indra/newview/llviewerjointmesh.h @@ -54,19 +54,19 @@ public: void uploadJointMatrices(); // overloaded from base class - /*virtual*/ U32 drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy ); + U32 drawShape( F32 pixelArea, bool first_pass, bool is_dummy ) override; // necessary because MS's compiler warns on function inheritance via dominance in the diamond inheritance here. // warns even though LLViewerJoint holds the only non virtual implementation. - /*virtual*/ U32 render( F32 pixelArea, BOOL first_pass = TRUE, BOOL is_dummy = FALSE ) { return LLViewerJoint::render(pixelArea,first_pass,is_dummy);} + U32 render(F32 pixelArea, bool first_pass = true, bool is_dummy = false) override { return LLViewerJoint::render(pixelArea, first_pass, is_dummy); } - /*virtual*/ void updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area); - /*virtual*/ void updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind = FALSE, bool terse_update = false); - /*virtual*/ BOOL updateLOD(F32 pixel_area, BOOL activate); - /*virtual*/ void updateJointGeometry(); - /*virtual*/ void dump(); + void updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area) override; + void updateFaceData(LLFace *face, F32 pixel_area, bool damp_wind = false, bool terse_update = false) override; + bool updateLOD(F32 pixel_area, bool activate) override; + void updateJointGeometry() override; + void dump() override; - /*virtual*/ BOOL isAnimatable() const { return FALSE; } + bool isAnimatable() const override { return false; } private: diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp index 3a3f0b3d95..ce6dfa4ad1 100644 --- a/indra/newview/llviewerjoystick.cpp +++ b/indra/newview/llviewerjoystick.cpp @@ -244,19 +244,19 @@ void LLViewerJoystick::updateEnabled(bool autoenable) { if (mDriverState == JDS_UNINITIALIZED) { - gSavedSettings.setBOOL("JoystickEnabled", FALSE ); + gSavedSettings.setBOOL("JoystickEnabled", false); } else { // autoenable if user specifically chose this device if (autoenable && (isLikeSpaceNavigator() || isDeviceUUIDSet())) { - gSavedSettings.setBOOL("JoystickEnabled", TRUE ); + gSavedSettings.setBOOL("JoystickEnabled", true ); } } if (!gSavedSettings.getBOOL("JoystickEnabled")) { - mOverrideCamera = FALSE; + mOverrideCamera = false; } } @@ -264,7 +264,7 @@ void LLViewerJoystick::setOverrideCamera(bool val) { if (!gSavedSettings.getBOOL("JoystickEnabled")) { - mOverrideCamera = FALSE; + mOverrideCamera = false; } else { @@ -352,7 +352,7 @@ void LLViewerJoystick::init(bool autoenable) loadDeviceIdFromSettings(); - if (libinit == false) + if (!libinit) { // Note: The HotPlug callbacks are not actually getting called on Windows if (ndof_libinit(HotPlugAddCallback, @@ -413,10 +413,10 @@ void LLViewerJoystick::init(bool autoenable) { LL_INFOS("Joystick") << "Failed to gather input devices. Falling back to ndof's init" << LL_ENDL; // Failed to gather devices, init first suitable one - mLastDeviceUUID = LLSD(); - void *preffered_device = NULL; - initDevice(preffered_device); - } + mLastDeviceUUID = LLSD(); + void *preffered_device = NULL; + initDevice(preffered_device); + } } if (mDriverState == JDS_INITIALIZING) @@ -434,7 +434,7 @@ void LLViewerJoystick::init(bool autoenable) // Autoenable the joystick for recognized devices if nothing was connected previously if (!autoenable) { - autoenable = gSavedSettings.getString("JoystickInitialized").empty() ? true : false; + autoenable = gSavedSettings.getString("JoystickInitialized").empty(); } updateEnabled(autoenable); @@ -510,10 +510,10 @@ void LLViewerJoystick::initDevice(LLSD &guid) { LL_INFOS("Joystick") << "Failed to gather input devices. Falling back to ndof's init" << LL_ENDL; // Failed to gather devices from window, init first suitable one - void *preffered_device = NULL; - mLastDeviceUUID = LLSD(); - initDevice(preffered_device); - } + void *preffered_device = NULL; + mLastDeviceUUID = LLSD(); + initDevice(preffered_device); + } } if (mDriverState == JDS_INITIALIZING) @@ -957,7 +957,7 @@ void LLViewerJoystick::moveAvatar(bool reset) else if (!button_held) { button_held = true; - gAgent.setFlying(FALSE); + gAgent.setFlying(false); } } else if (!button_held) @@ -1532,7 +1532,7 @@ void LLViewerJoystick::setSNDefaults() #if LL_DARWIN || LL_LINUX const float platformScale = 20.f; const float platformScaleAvXZ = 1.f; - // The SpaceNavigator doesn't act as a 3D cursor on OS X / Linux. + // The SpaceNavigator doesn't act as a 3D cursor on macOS / Linux. const bool is_3d_cursor = false; #else const float platformScale = 1.f; diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index e86cb7ab39..d3a13ce8b9 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -79,10 +79,10 @@ #include <boost/bind.hpp> // for SkinFolder listener #include <boost/signals2.hpp> -extern BOOL gCubeSnapshot; +extern bool gCubeSnapshot; // *TODO: Consider enabling mipmaps (they have been disabled for a long time). Likely has a significant performance impact for tiled/high texture repeat media. Mip generation in a shader may also be an option if necessary. -constexpr BOOL USE_MIPMAPS = FALSE; +constexpr bool USE_MIPMAPS = false; void init_threaded_picker_load_dialog(LLPluginClassMedia* plugin, LLFilePicker::ELoadFilter filter, bool get_multiple) { @@ -1661,13 +1661,13 @@ void LLViewerMediaImpl::destroyMediaSource() LLViewerMediaTexture* oldImage = LLViewerTextureManager::findMediaTexture( mTextureId ); if (oldImage) { - oldImage->setPlaying(FALSE) ; + oldImage->setPlaying(false) ; } cancelMimeTypeProbe(); { - LLMutexLock lock(&mLock); // Delay tear-down while bg thread is updating + LLCoros::LockType lock(mLock); // Delay tear-down while bg thread is updating if(mMediaSource) { mMediaSource->setDeleteOK(true) ; @@ -2353,7 +2353,7 @@ void LLViewerMediaImpl::onMouseCaptureLost() } ////////////////////////////////////////////////////////////////////////////////////////// -BOOL LLViewerMediaImpl::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLViewerMediaImpl::handleMouseUp(S32 x, S32 y, MASK mask) { // NOTE: this is called when the mouse is released when we have capture. // Due to the way mouse coordinates are mapped to the object, we can't use the x and y coordinates that come in with the event. @@ -2361,10 +2361,10 @@ BOOL LLViewerMediaImpl::handleMouseUp(S32 x, S32 y, MASK mask) if(hasMouseCapture()) { // Release the mouse -- this will also send a mouseup to the media - gFocusMgr.setMouseCapture( FALSE ); + gFocusMgr.setMouseCapture( nullptr ); } - return TRUE; + return true; } ////////////////////////////////////////////////////////////////////////////////////////// @@ -2690,7 +2690,13 @@ void LLViewerMediaImpl::mimeDiscoveryCoro(std::string url) { if (initializeMedia(mimeType)) { - loadURI(); + ref(); + LLAppViewer::instance()->postToMainCoro([this]() + { + loadURI(); + unref(); + }); + } } @@ -2773,7 +2779,7 @@ bool LLViewerMediaImpl::handleUnicodeCharHere(llwchar uni_char) { LLSD native_key_data = gViewerWindow->getWindow()->getNativeKeyData(); - mMediaSource->textInput(wstring_to_utf8str(LLWString(1, uni_char)), gKeyboard->currentMask(FALSE), native_key_data); + mMediaSource->textInput(wstring_to_utf8str(LLWString(1, uni_char)), gKeyboard->currentMask(false), native_key_data); } } @@ -2783,7 +2789,7 @@ bool LLViewerMediaImpl::handleUnicodeCharHere(llwchar uni_char) ////////////////////////////////////////////////////////////////////////////////////////// bool LLViewerMediaImpl::canNavigateForward() { - BOOL result = FALSE; + bool result = false; if (mMediaSource) { result = mMediaSource->getHistoryForwardAvailable(); @@ -2794,7 +2800,7 @@ bool LLViewerMediaImpl::canNavigateForward() ////////////////////////////////////////////////////////////////////////////////////////// bool LLViewerMediaImpl::canNavigateBack() { - BOOL result = FALSE; + bool result = false; if (mMediaSource) { result = mMediaSource->getHistoryBackAvailable(); @@ -2949,7 +2955,7 @@ bool LLViewerMediaImpl::preMediaTexUpdate(LLViewerMediaTexture*& media_tex, U8*& //S32 media_depth = mMediaSource->getTextureDepth(); // Since we're updating this texture, we know it's playing. Tell the texture to do its replacement magic so it gets rendered. - media_tex->setPlaying(TRUE); + media_tex->setPlaying(true); if (mMediaSource->getDirty(&dirty_rect)) { @@ -2984,7 +2990,7 @@ bool LLViewerMediaImpl::preMediaTexUpdate(LLViewerMediaTexture*& media_tex, U8*& void LLViewerMediaImpl::doMediaTexUpdate(LLViewerMediaTexture* media_tex, U8* data, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height, bool sync) { LL_PROFILE_ZONE_SCOPED_CATEGORY_MEDIA; - LLMutexLock lock(&mLock); // don't allow media source tear-down during update + LLCoros::LockType lock(mLock); // don't allow media source tear-down during update // wrap "data" in an LLImageRaw but do NOT make a copy LLPointer<LLImageRaw> raw = new LLImageRaw(data, media_tex->getWidth(), media_tex->getHeight(), media_tex->getComponents(), true); @@ -2996,7 +3002,7 @@ void LLViewerMediaImpl::doMediaTexUpdate(LLViewerMediaTexture* media_tex, U8* da // -Cosmic,2023-04-04 // Allocate GL texture based on LLImageRaw but do NOT copy to GL LLGLuint tex_name = 0; - media_tex->createGLTexture(0, raw, 0, TRUE, LLGLTexture::OTHER, true, &tex_name); + media_tex->createGLTexture(0, raw, 0, true, LLGLTexture::OTHER, true, &tex_name); // copy just the subimage covered by the image raw to GL media_tex->setSubImage(data, data_width, data_height, x_pos, y_pos, width, height, tex_name); @@ -3514,13 +3520,13 @@ LLViewerMediaImpl::cut() //////////////////////////////////////////////////////////////////////////////// // virtual -BOOL +bool LLViewerMediaImpl::canCut() const { if (mMediaSource) return mMediaSource->canCut(); else - return FALSE; + return false; } //////////////////////////////////////////////////////////////////////////////// @@ -3534,13 +3540,13 @@ LLViewerMediaImpl::copy() //////////////////////////////////////////////////////////////////////////////// // virtual -BOOL +bool LLViewerMediaImpl::canCopy() const { if (mMediaSource) return mMediaSource->canCopy(); else - return FALSE; + return false; } //////////////////////////////////////////////////////////////////////////////// @@ -3554,21 +3560,21 @@ LLViewerMediaImpl::paste() //////////////////////////////////////////////////////////////////////////////// // virtual -BOOL +bool LLViewerMediaImpl::canPaste() const { if (mMediaSource) return mMediaSource->canPaste(); else - return FALSE; + return false; } -void LLViewerMediaImpl::setUpdated(BOOL updated) +void LLViewerMediaImpl::setUpdated(bool updated) { mIsUpdated = updated ; } -BOOL LLViewerMediaImpl::isUpdated() +bool LLViewerMediaImpl::isUpdated() { return mIsUpdated ; } diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index 33092f1435..5753615a43 100644 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -182,7 +182,7 @@ private: // Implementation functions not exported into header file class LLViewerMediaImpl - : public LLMouseHandler, public LLRefCount, public LLPluginClassMediaOwner, public LLViewerMediaEventEmitter, public LLEditMenuHandler + : public LLMouseHandler, public LLThreadSafeRefCount, public LLPluginClassMediaOwner, public LLViewerMediaEventEmitter, public LLEditMenuHandler { LOG_CLASS(LLViewerMediaImpl); public: @@ -317,45 +317,45 @@ public: // need these to handle mouseup... /*virtual*/ void onMouseCaptureLost(); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask); // Grr... the only thing I want as an LLMouseHandler are the onMouseCaptureLost and handleMouseUp calls. // Sadly, these are all pure virtual, so I have to supply implementations here: - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask) { return FALSE; }; - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask) { return FALSE; }; - /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) { return FALSE; }; - /*virtual*/ BOOL handleScrollHWheel(S32 x, S32 y, S32 clicks) { return FALSE; }; - /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask) { return FALSE; }; - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) { return FALSE; }; - /*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask) { return FALSE; }; - /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask) { return FALSE; }; - /*virtual*/ BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask) { return FALSE; }; - /*virtual*/ BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask) {return FALSE; }; + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask) { return false; }; + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask) { return false; }; + /*virtual*/ bool handleScrollWheel(S32 x, S32 y, S32 clicks) { return false; }; + /*virtual*/ bool handleScrollHWheel(S32 x, S32 y, S32 clicks) { return false; }; + /*virtual*/ bool handleDoubleClick(S32 x, S32 y, MASK mask) { return false; }; + /*virtual*/ bool handleRightMouseDown(S32 x, S32 y, MASK mask) { return false; }; + /*virtual*/ bool handleRightMouseUp(S32 x, S32 y, MASK mask) { return false; }; + /*virtual*/ bool handleToolTip(S32 x, S32 y, MASK mask) { return false; }; + /*virtual*/ bool handleMiddleMouseDown(S32 x, S32 y, MASK mask) { return false; }; + /*virtual*/ bool handleMiddleMouseUp(S32 x, S32 y, MASK mask) {return false; }; /*virtual*/ const std::string& getName() const; /*virtual*/ void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const {}; /*virtual*/ void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const {}; - /*virtual*/ BOOL hasMouseCapture() { return gFocusMgr.getMouseCapture() == this; }; + /*virtual*/ bool hasMouseCapture() { return gFocusMgr.getMouseCapture() == this; }; // Inherited from LLPluginClassMediaOwner /*virtual*/ void handleMediaEvent(LLPluginClassMedia* plugin, LLPluginClassMediaOwner::EMediaEvent); // LLEditMenuHandler overrides /*virtual*/ void cut(); - /*virtual*/ BOOL canCut() const; + /*virtual*/ bool canCut() const; /*virtual*/ void copy(); - /*virtual*/ BOOL canCopy() const; + /*virtual*/ bool canCopy() const; /*virtual*/ void paste(); - /*virtual*/ BOOL canPaste() const; + /*virtual*/ bool canPaste() const; void addObject(LLVOVolume* obj) ; void removeObject(LLVOVolume* obj) ; const std::list< LLVOVolume* >* getObjectList() const ; LLVOVolume *getSomeObject(); - void setUpdated(BOOL updated) ; - BOOL isUpdated() ; + void setUpdated(bool updated) ; + bool isUpdated() ; // updates the javascript object in the embedded browser with viewer values void updateJavascriptObject(); @@ -432,7 +432,7 @@ private: private: // a single media url with some data and an impl. std::shared_ptr<LLPluginClassMedia> mMediaSource; - LLMutex mLock; + LLCoros::Mutex mLock; F64 mZoomFactor; LLUUID mTextureId; bool mMovieImageHasMips; @@ -488,7 +488,7 @@ private: static std::vector<std::string> sMimeTypesFailed; LLPointer<LLImageRaw> mRawImage; //backing buffer for texture updates private: - BOOL mIsUpdated ; + bool mIsUpdated ; std::list< LLVOVolume* > mObjectList ; void mimeDiscoveryCoro(std::string url); diff --git a/indra/newview/llviewermediafocus.cpp b/indra/newview/llviewermediafocus.cpp index 978a9bc6de..c8d25180b9 100644 --- a/indra/newview/llviewermediafocus.cpp +++ b/indra/newview/llviewermediafocus.cpp @@ -125,7 +125,7 @@ void LLViewerMediaFocus::setFocusFace(LLPointer<LLViewerObject> objectp, S32 fac if(mMediaControls.get()) { - if(face_auto_zoom && ! parcel->getMediaPreventCameraZoom()) + if(face_auto_zoom && !static_cast<bool>(parcel->getMediaPreventCameraZoom())) { // Zoom in on this face mMediaControls.get()->resetZoomLevel(false); @@ -211,7 +211,7 @@ LLVector3d LLViewerMediaFocus::setCameraZoom(LLViewerObject* object, LLVector3 n LLVector3d camera_pos; if (object) { - gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); + gAgentCamera.setFocusOnAvatar(false, ANIMATE); LLBBox bbox = object->getBoundingBoxAgent(); LLVector3d center = gAgent.getPosGlobalFromAgent(bbox.getCenterAgent()); @@ -298,7 +298,7 @@ LLVector3d LLViewerMediaFocus::setCameraZoom(LLViewerObject* object, LLVector3 n else { // If we have no object, focus back on the avatar. - gAgentCamera.setFocusOnAvatar(TRUE, ANIMATE); + gAgentCamera.setFocusOnAvatar(true, ANIMATE); } return camera_pos; } @@ -321,7 +321,7 @@ void LLViewerMediaFocus::onFocusLost() LLFocusableElement::onFocusLost(); } -BOOL LLViewerMediaFocus::handleKey(KEY key, MASK mask, BOOL called_from_parent) +bool LLViewerMediaFocus::handleKey(KEY key, MASK mask, bool called_from_parent) { LLViewerMediaImpl* media_impl = getFocusedMediaImpl(); if(media_impl) @@ -346,7 +346,7 @@ BOOL LLViewerMediaFocus::handleKey(KEY key, MASK mask, BOOL called_from_parent) return true; } -BOOL LLViewerMediaFocus::handleKeyUp(KEY key, MASK mask, BOOL called_from_parent) +bool LLViewerMediaFocus::handleKeyUp(KEY key, MASK mask, bool called_from_parent) { LLViewerMediaImpl* media_impl = getFocusedMediaImpl(); if (media_impl) @@ -358,7 +358,7 @@ BOOL LLViewerMediaFocus::handleKeyUp(KEY key, MASK mask, BOOL called_from_parent -BOOL LLViewerMediaFocus::handleUnicodeChar(llwchar uni_char, BOOL called_from_parent) +bool LLViewerMediaFocus::handleUnicodeChar(llwchar uni_char, bool called_from_parent) { LLViewerMediaImpl* media_impl = getFocusedMediaImpl(); if(media_impl) @@ -366,26 +366,26 @@ BOOL LLViewerMediaFocus::handleUnicodeChar(llwchar uni_char, BOOL called_from_pa return true; } -BOOL LLViewerMediaFocus::handleScrollWheel(const LLVector2& texture_coords, S32 clicks_x, S32 clicks_y) +bool LLViewerMediaFocus::handleScrollWheel(const LLVector2& texture_coords, S32 clicks_x, S32 clicks_y) { - BOOL retval = FALSE; + bool retval = false; LLViewerMediaImpl* media_impl = getFocusedMediaImpl(); if (media_impl && media_impl->hasMedia()) { - media_impl->scrollWheel(texture_coords, clicks_x, clicks_y, gKeyboard->currentMask(TRUE)); - retval = TRUE; + media_impl->scrollWheel(texture_coords, clicks_x, clicks_y, gKeyboard->currentMask(true)); + retval = true; } return retval; } -BOOL LLViewerMediaFocus::handleScrollWheel(S32 x, S32 y, S32 clicks_x, S32 clicks_y) +bool LLViewerMediaFocus::handleScrollWheel(S32 x, S32 y, S32 clicks_x, S32 clicks_y) { - BOOL retval = FALSE; + bool retval = false; LLViewerMediaImpl* media_impl = getFocusedMediaImpl(); if(media_impl && media_impl->hasMedia()) { - media_impl->scrollWheel(x, y, clicks_x, clicks_y, gKeyboard->currentMask(TRUE)); - retval = TRUE; + media_impl->scrollWheel(x, y, clicks_x, clicks_y, gKeyboard->currentMask(true)); + retval = true; } return retval; } diff --git a/indra/newview/llviewermediafocus.h b/indra/newview/llviewermediafocus.h index 855be265fc..9a9fc72e70 100644 --- a/indra/newview/llviewermediafocus.h +++ b/indra/newview/llviewermediafocus.h @@ -55,11 +55,11 @@ public: void clearHover(); bool getFocus(); - /*virtual*/ BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent) override; - /*virtual*/ BOOL handleKeyUp(KEY key, MASK mask, BOOL called_from_parent) override; - /*virtual*/ BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent) override; - BOOL handleScrollWheel(const LLVector2& texture_coords, S32 clicks_x, S32 clicks_y); - BOOL handleScrollWheel(S32 x, S32 y, S32 clicks_x, S32 clicks_y); + /*virtual*/ bool handleKey(KEY key, MASK mask, bool called_from_parent) override; + /*virtual*/ bool handleKeyUp(KEY key, MASK mask, bool called_from_parent) override; + /*virtual*/ bool handleUnicodeChar(llwchar uni_char, bool called_from_parent) override; + bool handleScrollWheel(const LLVector2& texture_coords, S32 clicks_x, S32 clicks_y); + bool handleScrollWheel(S32 x, S32 y, S32 clicks_x, S32 clicks_y); void update(); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 7f6c6e2571..75bef846fe 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -140,9 +140,11 @@ #include "boost/unordered_map.hpp" #include <boost/regex.hpp> #include <boost/algorithm/string.hpp> +#include <boost/json.hpp> #include "llcleanup.h" #include "llviewershadermgr.h" #include "gltfscenemanager.h" +#include "gltf/asset.h" using namespace LLAvatarAppearanceDefines; @@ -150,8 +152,8 @@ typedef LLPointer<LLViewerObject> LLViewerObjectPtr; static boost::unordered_map<std::string, LLStringExplicit> sDefaultItemLabels; -BOOL enable_land_build(void*); -BOOL enable_object_build(void*); +bool enable_land_build(void*); +bool enable_object_build(void*); LLVOAvatar* find_avatar_from_object( LLViewerObject* object ); LLVOAvatar* find_avatar_from_object( const LLUUID& object_id ); @@ -161,15 +163,15 @@ void handle_test_load_url(void*); // // Evil hackish imported globals -//extern BOOL gHideSelectedObjects; -//extern BOOL gAllowSelectAvatar; -//extern BOOL gDebugAvatarRotation; -extern BOOL gDebugClicks; -extern BOOL gDebugWindowProc; -extern BOOL gShaderProfileFrame; +//extern bool gHideSelectedObjects; +//extern bool gAllowSelectAvatar; +//extern bool gDebugAvatarRotation; +extern bool gDebugClicks; +extern bool gDebugWindowProc; +extern bool gShaderProfileFrame; -//extern BOOL gDebugTextEditorTips; -//extern BOOL gDebugSelectMgr; +//extern bool gDebugTextEditorTips; +//extern bool gDebugSelectMgr; // // Globals @@ -224,24 +226,25 @@ void handle_region_dump_temp_asset_data(void*); void handle_region_clear_temp_asset_data(void*); // Object pie menu -BOOL sitting_on_selection(); +bool sitting_on_selection(); void near_sit_object(); //void label_sit_or_stand(std::string& label, void*); // buy and take alias into the same UI positions, so these // declarations handle this mess. -BOOL is_selection_buy_not_take(); +bool is_selection_buy_not_take(); S32 selection_price(); -BOOL enable_take(); +bool enable_take(); void handle_object_show_inspector(); void handle_avatar_show_inspector(); bool confirm_take(const LLSD& notification, const LLSD& response, LLObjectSelectionHandle selection_handle); +bool confirm_take_separate(const LLSD ¬ification, const LLSD &response, LLObjectSelectionHandle selection_handle); void handle_buy_object(LLSaleInfo sale_info); void handle_buy_contents(LLSaleInfo sale_info); // Land pie menu -void near_sit_down_point(BOOL success, void *); +void near_sit_down_point(bool success, void *); // Avatar pie menu @@ -251,16 +254,16 @@ void near_sit_down_point(BOOL success, void *); void velocity_interpolate( void* ); void handle_visual_leak_detector_toggle(void*); void handle_rebake_textures(void*); -BOOL check_admin_override(void*); +bool check_admin_override(void*); void handle_admin_override_toggle(void*); #ifdef TOGGLE_HACKED_GODLIKE_VIEWER void handle_toggle_hacked_godmode(void*); -BOOL check_toggle_hacked_godmode(void*); +bool check_toggle_hacked_godmode(void*); bool enable_toggle_hacked_godmode(void*); #endif void toggle_show_xui_names(void *); -BOOL check_show_xui_names(void *); +bool check_show_xui_names(void *); // Debug UI @@ -310,7 +313,7 @@ void dump_select_mgr(void*); void dump_inventory(void*); void toggle_visibility(void*); -BOOL get_visibility(void*); +bool get_visibility(void*); // Avatar Pie menu void request_friendship(const LLUUID& agent_id); @@ -323,7 +326,7 @@ void handle_dump_followcam(void*); void handle_viewer_enable_message_log(void*); void handle_viewer_disable_message_log(void*); -BOOL enable_buy_land(void*); +bool enable_buy_land(void*); // Help menu @@ -333,13 +336,13 @@ void handle_dump_attachments(void *); void handle_dump_avatar_local_textures(void*); void handle_debug_avatar_textures(void*); void handle_grab_baked_texture(void*); -BOOL enable_grab_baked_texture(void*); +bool enable_grab_baked_texture(void*); void handle_dump_region_object_cache(void*); void handle_reset_interest_lists(void *); -BOOL enable_save_into_task_inventory(void*); +bool enable_save_into_task_inventory(void*); -BOOL enable_detach(const LLSD& = LLSD()); +bool enable_detach(const LLSD& = LLSD()); void menu_toggle_attached_lights(void* user_data); void menu_toggle_attached_particles(void* user_data); @@ -379,7 +382,7 @@ void LLMenuParcelObserver::changed() child = gMenuLand->findChild<LLView>("Land Buy"); if (child) { - BOOL buyable = enable_buy_land(NULL); + bool buyable = enable_buy_land(NULL); child->setEnabled(buyable); } } @@ -403,7 +406,7 @@ void initialize_menus(); void set_merchant_SLM_menu() { // All other cases (new merchant, not merchant, migrated merchant): show the new Marketplace Listings menu and enable the tool - gMenuHolder->getChild<LLView>("MarketplaceListings")->setVisible(TRUE); + gMenuHolder->getChild<LLView>("MarketplaceListings")->setVisible(true); LLCommand* command = LLCommandManager::instance().getCommand("marketplacelistings"); gToolBarView->enableCommand(command->id(), true); @@ -428,7 +431,7 @@ void check_merchant_status(bool force) LLMarketplaceData::instance().setSLMStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED); } // Hide SLM related menu item - gMenuHolder->getChild<LLView>("MarketplaceListings")->setVisible(FALSE); + gMenuHolder->getChild<LLView>("MarketplaceListings")->setVisible(false); // Also disable the toolbar button for Marketplace Listings LLCommand* command = LLCommandManager::instance().getCommand("marketplacelistings"); @@ -535,17 +538,17 @@ void init_menus() gMenuHolder->childSetLabelArg("Upload Sound", "[COST]", sound_upload_cost_str); gMenuHolder->childSetLabelArg("Upload Animation", "[COST]", animation_upload_cost_str); - gAttachSubMenu = gMenuBarView->findChildMenuByName("Attach Object", TRUE); - gDetachSubMenu = gMenuBarView->findChildMenuByName("Detach Object", TRUE); + gAttachSubMenu = gMenuBarView->findChildMenuByName("Attach Object", true); + gDetachSubMenu = gMenuBarView->findChildMenuByName("Detach Object", true); gDetachAvatarMenu = gMenuHolder->getChild<LLMenuGL>("Avatar Detach", true); gDetachHUDAvatarMenu = gMenuHolder->getChild<LLMenuGL>("Avatar Detach HUD", true); // Don't display the Memory console menu if the feature is turned off - LLMenuItemCheckGL *memoryMenu = gMenuBarView->getChild<LLMenuItemCheckGL>("Memory", TRUE); + LLMenuItemCheckGL *memoryMenu = gMenuBarView->getChild<LLMenuItemCheckGL>("Memory", true); if (memoryMenu) { - memoryMenu->setVisible(FALSE); + memoryMenu->setVisible(false); } gMenuBarView->createJumpKeys(); @@ -640,7 +643,7 @@ class LLAdvancedDumpInfoToConsole : public view_listener_t { bool handleEvent(const LLSD& userdata) { - gDebugView->mDebugConsolep->setVisible(TRUE); + gDebugView->mDebugConsolep->setVisible(true); std::string info_type = userdata.asString(); if ("region" == info_type) { @@ -957,7 +960,7 @@ class LLAdvancedSetDisplayTextureDensity : public view_listener_t std::string mode = userdata.asString(); if (mode == "none") { - if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY) == TRUE) + if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY)) { gPipeline.toggleRenderDebug(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY); } @@ -965,7 +968,7 @@ class LLAdvancedSetDisplayTextureDensity : public view_listener_t } else if (mode == "current") { - if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY) == FALSE) + if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY)) { gPipeline.toggleRenderDebug(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY); } @@ -973,7 +976,7 @@ class LLAdvancedSetDisplayTextureDensity : public view_listener_t } else if (mode == "desired") { - if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY) == FALSE) + if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY)) { gPipeline.toggleRenderDebug(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY); } @@ -982,7 +985,7 @@ class LLAdvancedSetDisplayTextureDensity : public view_listener_t } else if (mode == "full") { - if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY) == FALSE) + if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY)) { gPipeline.toggleRenderDebug(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY); } @@ -1288,13 +1291,13 @@ public: bool handleEvent(const LLSD &userdata) { // Toggle the mode - regions will get updated - if (gAgent.getInterestListMode() == LLViewerRegion::IL_MODE_360) + if (gAgent.getInterestListMode() == IL_MODE_360) { - gAgent.changeInterestListMode(LLViewerRegion::IL_MODE_DEFAULT); + gAgent.changeInterestListMode(IL_MODE_DEFAULT); } else { - gAgent.changeInterestListMode(LLViewerRegion::IL_MODE_360); + gAgent.changeInterestListMode(IL_MODE_360); } return true; } @@ -1304,7 +1307,7 @@ class LLAdvancedCheckInterestList360Mode : public view_listener_t { bool handleEvent(const LLSD& userdata) { - return (gAgent.getInterestListMode() == LLViewerRegion::IL_MODE_360); + return (gAgent.getInterestListMode() == IL_MODE_360); } }; @@ -3021,7 +3024,7 @@ class LLObjectBuild : public view_listener_t if (gAgentCamera.getFocusOnAvatar() && !LLToolMgr::getInstance()->inEdit() && gSavedSettings.getBOOL("EditCameraMovement") ) { // zoom in if we're looking at the avatar - gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); + gAgentCamera.setFocusOnAvatar(false, ANIMATE); gAgentCamera.setFocusGlobal(LLToolPie::getInstance()->getPick()); gAgentCamera.cameraZoomIn(0.666f); gAgentCamera.cameraOrbitOver( 30.f * DEG_TO_RAD ); @@ -3056,11 +3059,11 @@ void update_camera() // always freeze camera in space, even if camera doesn't move // so, for example, follow cam scripts can't affect you when in build mode gAgentCamera.setFocusGlobal(gAgentCamera.calcFocusPositionTargetGlobal(), LLUUID::null); - gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); + gAgentCamera.setFocusOnAvatar(false, ANIMATE); } else { - gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); + gAgentCamera.setFocusOnAvatar(false, ANIMATE); LLViewerObject* selected_objectp = selection->getFirstRootObject(); if (selected_objectp) { @@ -3137,7 +3140,7 @@ void handle_attachment_touch(const LLUUID& inv_item_id) { bool apply(LLSelectNode* node) { - node->setTransient(TRUE); + node->setTransient(true); return true; } } f; @@ -3186,7 +3189,7 @@ class LLLandBuild : public view_listener_t if (gAgentCamera.getFocusOnAvatar() && !LLToolMgr::getInstance()->inEdit() && gSavedSettings.getBOOL("EditCameraMovement") ) { // zoom in if we're looking at the avatar - gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); + gAgentCamera.setFocusOnAvatar(false, ANIMATE); gAgentCamera.setFocusGlobal(LLToolPie::getInstance()->getPick()); gAgentCamera.cameraZoomIn(0.666f); gAgentCamera.cameraOrbitOver( 30.f * DEG_TO_RAD ); @@ -3213,7 +3216,7 @@ class LLLandBuyPass : public view_listener_t { bool handleEvent(const LLSD& userdata) { - LLPanelLandGeneral::onClickBuyPass((void *)FALSE); + LLPanelLandGeneral::onClickBuyPass((void *)false); return true; } }; @@ -3228,12 +3231,12 @@ class LLLandEnableBuyPass : public view_listener_t }; // BUG: Should really check if CLICK POINT is in a parcel where you can build. -BOOL enable_land_build(void*) +bool enable_land_build(void*) { - if (gAgent.isGodlike()) return TRUE; - if (gAgent.inPrelude()) return FALSE; + if (gAgent.isGodlike()) return true; + if (gAgent.inPrelude()) return false; - BOOL can_build = FALSE; + bool can_build = false; LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (agent_parcel) { @@ -3243,12 +3246,12 @@ BOOL enable_land_build(void*) } // BUG: Should really check if OBJECT is in a parcel where you can build. -BOOL enable_object_build(void*) +bool enable_object_build(void*) { - if (gAgent.isGodlike()) return TRUE; - if (gAgent.inPrelude()) return FALSE; + if (gAgent.isGodlike()) return true; + if (gAgent.inPrelude()) return false; - BOOL can_build = FALSE; + bool can_build = false; LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (agent_parcel) { @@ -3317,6 +3320,40 @@ bool enable_os_exception() #endif } + +bool enable_gltf() +{ + static LLCachedControl<bool> enablegltf(gSavedSettings, "GLTFEnabled", false); + return enablegltf; +} + +bool enable_gltf_save_as() +{ + if (enable_gltf()) + { + LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(); + if (obj) + { + if (obj->mGLTFAsset && obj->mGLTFAsset->isLocalPreview()) + { + return true; + } + + LLPermissions* permissions = LLSelectMgr::getInstance()->findObjectPermissions(obj); + if (permissions) + { + return permissions->allowExportBy(gAgent.getID()); + } + } + } + return false; +} + +bool enable_gltf_upload() +{ + return enable_gltf_save_as(); +} + class LLSelfRemoveAllAttachments : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -3349,10 +3386,10 @@ class LLSelfEnableRemoveAllAttachments : public view_listener_t } }; -BOOL enable_has_attachments(void*) +bool enable_has_attachments(void*) { - return FALSE; + return false; } //--------------------------------------------------------------------------- @@ -3489,7 +3526,7 @@ class LLObjectMute : public view_listener_t LLVOAvatar* avatar = find_avatar_from_object(object); if (avatar) { - avatar->mNeedsImpostorUpdate = TRUE; + avatar->mNeedsImpostorUpdate = true; avatar->mLastImpostorUpdateReason = 9; id = avatar->getID(); @@ -3556,7 +3593,7 @@ bool handle_go_to() else { // Snap camera back to behind avatar - gAgentCamera.setFocusOnAvatar(TRUE, ANIMATE); + gAgentCamera.setFocusOnAvatar(true, ANIMATE); } // Could be first use @@ -3931,7 +3968,7 @@ void handle_buy_object(LLSaleInfo sale_info) LLUUID owner_id; std::string owner_name; - BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); + bool owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); if (!owners_identical) { LLNotificationsUtil::add("CannotBuyObjectsFromDifferentOwners"); @@ -3939,7 +3976,7 @@ void handle_buy_object(LLSaleInfo sale_info) } LLPermissions perm; - BOOL valid = LLSelectMgr::getInstance()->selectGetPermissions(perm); + bool valid = LLSelectMgr::getInstance()->selectGetPermissions(perm); LLAggregatePermissions ag_perm; valid &= LLSelectMgr::getInstance()->selectGetAggregatePermissions(ag_perm); if(!valid || !sale_info.isForSale() || !perm.allowTransferTo(gAgent.getID())) @@ -4155,7 +4192,7 @@ class LLTogglePanelPeopleTab : public view_listener_t } }; -BOOL check_admin_override(void*) +bool check_admin_override(void*) { return gAgent.getAdminOverride(); } @@ -4255,7 +4292,7 @@ void handle_toggle_hacked_godmode(void*) set_god_level(gHackGodmode ? GOD_MAINTENANCE : GOD_NOT); } -BOOL check_toggle_hacked_godmode(void*) +bool check_toggle_hacked_godmode(void*) { return gHackGodmode; } @@ -4292,15 +4329,15 @@ public: virtual ~LLHaveCallingcard() {} virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item); - BOOL isThere() const { return mIsThere;} + bool isThere() const { return mIsThere;} protected: LLUUID mID; - BOOL mIsThere; + bool mIsThere; }; LLHaveCallingcard::LLHaveCallingcard(const LLUUID& agent_id) : mID(agent_id), - mIsThere(FALSE) + mIsThere(false) { } @@ -4312,14 +4349,14 @@ bool LLHaveCallingcard::operator()(LLInventoryCategory* cat, if((item->getType() == LLAssetType::AT_CALLINGCARD) && (item->getCreatorUUID() == mID)) { - mIsThere = TRUE; + mIsThere = true; } } - return FALSE; + return false; } */ -BOOL is_agent_mappable(const LLUUID& agent_id) +bool is_agent_mappable(const LLUUID& agent_id) { const LLRelationship* buddy_info = NULL; bool is_friend = LLAvatarActions::isFriend(agent_id); @@ -4400,7 +4437,7 @@ class LLEnableEditPhysics : public view_listener_t bool handleEvent(const LLSD& userdata) { //return gAgentWearables.isWearableModifiable(LLWearableType::WT_SHAPE, 0); - return TRUE; + return true; } }; @@ -4468,11 +4505,11 @@ void handle_object_sit(const LLUUID& object_id) handle_object_sit(obj, offset); } -void near_sit_down_point(BOOL success, void *) +void near_sit_down_point(bool success, void *) { if (success) { - gAgent.setFlying(FALSE); + gAgent.setFlying(false); gAgent.clearControlFlags(AGENT_CONTROL_STAND_UP); // might have been set by autopilot gAgent.setControlFlags(AGENT_CONTROL_SIT_ON_GROUND); } @@ -4518,7 +4555,7 @@ class LLLandCanSit : public view_listener_t // // Major mode switching // -void reset_view_final( BOOL proceed ); +void reset_view_final( bool proceed ); void handle_reset_view() { @@ -4527,8 +4564,8 @@ void handle_reset_view() // switching to outfit selector should automagically save any currently edited wearable LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "my_outfits")); } - gAgentCamera.setFocusOnAvatar(TRUE, FALSE, FALSE); - reset_view_final( TRUE ); + gAgentCamera.setFocusOnAvatar(true, false, false); + reset_view_final( true ); LLFloaterCamera::resetCameraMode(); } @@ -4542,14 +4579,14 @@ class LLViewResetView : public view_listener_t }; // Note: extra parameters allow this function to be called from dialog. -void reset_view_final( BOOL proceed ) +void reset_view_final( bool proceed ) { if( !proceed ) { return; } - gAgentCamera.resetView(TRUE, TRUE); + gAgentCamera.resetView(true, true); gAgentCamera.setLookAt(LOOKAT_TARGET_CLEAR); } @@ -4583,7 +4620,7 @@ class LLViewDefaultUISize : public view_listener_t bool handleEvent(const LLSD& userdata) { gSavedSettings.setF32("UIScaleFactor", 1.0f); - gSavedSettings.setBOOL("UIAutoScale", FALSE); + gSavedSettings.setBOOL("UIAutoScale", false); gViewerWindow->reshape(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw()); return true; } @@ -4635,7 +4672,7 @@ void handle_duplicate_in_place(void*) LL_INFOS() << "handle_duplicate_in_place" << LL_ENDL; LLVector3 offset(0.f, 0.f, 0.f); - LLSelectMgr::getInstance()->selectDuplicate(offset, TRUE); + LLSelectMgr::getInstance()->selectDuplicate(offset, true); } @@ -4683,8 +4720,8 @@ void handle_object_owner_permissive(void*) if(gAgent.isGodlike()) { // do the objects. - LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_BASE, TRUE, PERM_ALL, TRUE); - LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_OWNER, TRUE, PERM_ALL, TRUE); + LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_BASE, true, PERM_ALL, true); + LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_OWNER, true, PERM_ALL, true); } } @@ -4693,14 +4730,14 @@ void handle_object_owner_self(void*) // only send this if they're a god. if(gAgent.isGodlike()) { - LLSelectMgr::getInstance()->sendOwner(gAgent.getID(), gAgent.getGroupID(), TRUE); + LLSelectMgr::getInstance()->sendOwner(gAgent.getID(), gAgent.getGroupID(), true); } } // Shortcut to set owner permissions to not editable. void handle_object_lock(void*) { - LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_OWNER, FALSE, PERM_MODIFY); + LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_OWNER, false, PERM_MODIFY); } void handle_object_asset_ids(void*) @@ -4825,11 +4862,11 @@ static bool get_derezzable_objects( LL_WARNS() << "Attempt to derez deprecated AssetContainer object type not supported." << LL_ENDL; /* object->requestInventory(container_inventory_arrived, - (void *)(BOOL)(DRD_TAKE_INTO_AGENT_INVENTORY == dest)); + (void *)(bool)(DRD_TAKE_INTO_AGENT_INVENTORY == dest)); */ continue; } - BOOL can_derez_current = FALSE; + bool can_derez_current = false; switch(dest) { case DRD_TAKE_INTO_AGENT_INVENTORY: @@ -4838,14 +4875,14 @@ static bool get_derezzable_objects( ((node->mPermissions->allowTransferTo(gAgent.getID()) && object->permModify()) || (node->allowOperationOnNode(PERM_OWNER, GP_OBJECT_MANIPULATE)))) { - can_derez_current = TRUE; + can_derez_current = true; } break; case DRD_RETURN_TO_OWNER: if(!object->isAttachment()) { - can_derez_current = TRUE; + can_derez_current = true; } break; @@ -4854,7 +4891,7 @@ static bool get_derezzable_objects( && object->permCopy()) || gAgent.isGodlike()) { - can_derez_current = TRUE; + can_derez_current = true; } break; } @@ -4955,7 +4992,7 @@ static void derez_objects( msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_ObjectLocalID, object->getLocalID()); // VEFFECT: DerezObject - LLHUDEffectSpiral* effectp = (LLHUDEffectSpiral*)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); + LLHUDEffectSpiral* effectp = (LLHUDEffectSpiral*)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, true); effectp->setPositionGlobal(object->getPositionGlobal()); effectp->setColor(LLColor4U(gAgent.getEffectColor())); } @@ -4983,6 +5020,24 @@ static void derez_objects(EDeRezDestination dest, const LLUUID& dest_id) derez_objects(dest, dest_id, first_region, error, NULL); } +static void derez_objects_separate(EDeRezDestination dest, const LLUUID &dest_id) +{ + std::vector<LLViewerObjectPtr> derez_object_list; + std::string error; + LLViewerRegion* first_region = NULL; + if (!get_derezzable_objects(dest, error, first_region, &derez_object_list, false)) + { + LL_WARNS() << "No objects to derez" << LL_ENDL; + return; + } + for (LLViewerObject *opjectp : derez_object_list) + { + std::vector<LLViewerObjectPtr> buf_list; + buf_list.push_back(opjectp); + derez_objects(dest, dest_id, first_region, error, &buf_list); + } +} + void handle_take_copy() { if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return; @@ -4991,6 +5046,15 @@ void handle_take_copy() derez_objects(DRD_ACQUIRE_TO_AGENT_INVENTORY, category_id); } +void handle_take_separate_copy() +{ + if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) + return; + + const LLUUID category_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OBJECT); + derez_objects_separate(DRD_ACQUIRE_TO_AGENT_INVENTORY, category_id); +} + void handle_link_objects() { if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) @@ -5084,7 +5148,7 @@ void force_take_copy(void*) derez_objects(DRD_FORCE_TO_GOD_INVENTORY, category_id); } -void handle_take() +void handle_take(bool take_separate) { // we want to use the folder this was derezzed from if it's // available. Otherwise, derez to the normal place. @@ -5093,8 +5157,8 @@ void handle_take() return; } - BOOL you_own_everything = TRUE; - BOOL locked_but_takeable_object = FALSE; + bool you_own_everything = true; + bool locked_but_takeable_object = false; LLUUID category_id; for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin(); @@ -5106,12 +5170,12 @@ void handle_take() { if(!object->permYouOwner()) { - you_own_everything = FALSE; + you_own_everything = false; } if(!object->permMove()) { - locked_but_takeable_object = TRUE; + locked_but_takeable_object = true; } } if(node->mFolderID.notNull()) @@ -5173,7 +5237,17 @@ void handle_take() // MAINT-290 // Reason: Showing the confirmation dialog resets object selection, thus there is nothing to derez. // Fix: pass selection to the confirm_take, so that selection doesn't "die" after confirmation dialog is opened - params.functor.function(boost::bind(confirm_take, _1, _2, LLSelectMgr::instance().getSelection())); + params.functor.function([take_separate](const LLSD ¬ification, const LLSD &response) + { + if (take_separate) + { + confirm_take_separate(notification, response, LLSelectMgr::instance().getSelection()); + } + else + { + confirm_take(notification, response, LLSelectMgr::instance().getSelection()); + } + }); if(locked_but_takeable_object || !you_own_everything) @@ -5202,7 +5276,7 @@ void handle_take() void handle_object_show_inspector() { LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); - LLViewerObject* objectp = selection->getFirstRootObject(TRUE); + LLViewerObject* objectp = selection->getFirstRootObject(true); if (!objectp) { return; @@ -5236,14 +5310,24 @@ bool confirm_take(const LLSD& notification, const LLSD& response, LLObjectSelect return false; } +bool confirm_take_separate(const LLSD ¬ification, const LLSD &response, LLObjectSelectionHandle selection_handle) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (enable_take() && (option == 0)) + { + derez_objects_separate(DRD_TAKE_INTO_AGENT_INVENTORY, notification["payload"]["folder_id"].asUUID()); + } + return false; +} + // You can take an item when it is public and transferrable, or when // you own it. We err on the side of enabling the item when at least // one item selected can be copied to inventory. -BOOL enable_take() +bool enable_take() { if (sitting_on_selection()) { - return FALSE; + return false; } for (LLObjectSelection::valid_root_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_root_begin(); @@ -5258,13 +5342,13 @@ BOOL enable_take() } #ifdef HACKED_GODLIKE_VIEWER - return TRUE; + return true; #else # ifdef TOGGLE_HACKED_GODLIKE_VIEWER if (!LLGridManager::getInstance()->isInProductionGrid() && gAgent.isGodlike()) { - return TRUE; + return true; } # endif if(!object->isPermanentEnforced() && @@ -5276,7 +5360,7 @@ BOOL enable_take() } #endif } - return FALSE; + return false; } @@ -5318,6 +5402,21 @@ bool visible_take_object() return !is_selection_buy_not_take() && enable_take(); } +bool is_multiple_selection() +{ + return (LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() > 1); +} + +bool is_single_selection() +{ + return !is_multiple_selection(); +} + +bool enable_take_objects() +{ + return visible_take_object() && is_multiple_selection(); +} + bool tools_visible_buy_object() { return is_selection_buy_not_take(); @@ -5352,9 +5451,9 @@ class LLToolsEnableBuyOrTake : public view_listener_t // exception is if you own everything in the selection that is for // sale, in this case, you can't buy stuff from yourself, so you can // take it. -// return value = TRUE if selection is a 'buy'. -// FALSE if selection is a 'take' -BOOL is_selection_buy_not_take() +// return value = true if selection is a 'buy'. +// false if selection is a 'take' +bool is_selection_buy_not_take() { for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin(); iter != LLSelectMgr::getInstance()->getSelection()->root_end(); iter++) @@ -5365,10 +5464,10 @@ BOOL is_selection_buy_not_take() { // you do not own the object and it is for sale, thus, // it's a buy - return TRUE; + return true; } } - return FALSE; + return false; } S32 selection_price() @@ -5426,7 +5525,7 @@ void handle_buy() if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return; LLSaleInfo sale_info; - BOOL valid = LLSelectMgr::getInstance()->selectGetSaleInfo(sale_info); + bool valid = LLSelectMgr::getInstance()->selectGetSaleInfo(sale_info); if (!valid) return; S32 price = sale_info.getSalePrice(); @@ -5464,27 +5563,27 @@ bool for_sale_selection(LLSelectNode* nodep) || nodep->mSaleInfo.getSaleType() != LLSaleInfo::FS_COPY); } -BOOL sitting_on_selection() +bool sitting_on_selection() { LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); if (!node) { - return FALSE; + return false; } if (!node->mValid) { - return FALSE; + return false; } LLViewerObject* root_object = node->getObject(); if (!root_object) { - return FALSE; + return false; } // Need to determine if avatar is sitting on this object - if (!isAgentAvatarValid()) return FALSE; + if (!isAgentAvatarValid()) return false; return (gAgentAvatarp->isSitting() && gAgentAvatarp->getRoot() == root_object); } @@ -5587,7 +5686,7 @@ class LLToolsSnapObjectXY : public view_listener_t pos_global.mdV[VY] += snap_size; } - obj->setPositionGlobal(pos_global, FALSE); + obj->setPositionGlobal(pos_global, false); } } LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_POSITION); @@ -5968,7 +6067,7 @@ bool enable_object_delete() { bool new_value = #ifdef HACKED_GODLIKE_VIEWER - TRUE; + true; #else # ifdef TOGGLE_HACKED_GODLIKE_VIEWER (!LLGridManager::getInstance()->isInProductionGrid() @@ -6180,8 +6279,8 @@ void show_debug_menus() // this might get called at login screen where there is no menu so only toggle it if one exists if ( gMenuBarView ) { - BOOL debug = gSavedSettings.getBOOL("UseDebugMenus"); - BOOL qamode = gSavedSettings.getBOOL("QAMode"); + bool debug = gSavedSettings.getBOOL("UseDebugMenus"); + bool qamode = gSavedSettings.getBOOL("QAMode"); gMenuBarView->setItemVisible("Advanced", debug); // gMenuBarView->setItemEnabled("Advanced", debug); // Don't disable Advanced keyboard shortcuts when hidden @@ -6199,7 +6298,7 @@ void show_debug_menus() } if (gLoginMenuBarView) { - BOOL debug = gSavedSettings.getBOOL("UseDebugMenus"); + bool debug = gSavedSettings.getBOOL("UseDebugMenus"); gLoginMenuBarView->setItemVisible("Debug", debug); gLoginMenuBarView->setItemEnabled("Debug", debug); } @@ -6207,7 +6306,7 @@ void show_debug_menus() void toggle_debug_menus(void*) { - BOOL visible = ! gSavedSettings.getBOOL("UseDebugMenus"); + bool visible = ! gSavedSettings.getBOOL("UseDebugMenus"); gSavedSettings.setBOOL("UseDebugMenus", visible); show_debug_menus(); } @@ -6394,10 +6493,10 @@ class LLWorldPlaceProfile : public view_listener_t void handle_look_at_selection(const LLSD& param) { const F32 PADDING_FACTOR = 1.75f; - BOOL zoom = (param.asString() == "zoom"); + bool zoom = (param.asString() == "zoom"); if (!LLSelectMgr::getInstance()->getSelection()->isEmpty()) { - gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); + gAgentCamera.setFocusOnAvatar(false, ANIMATE); LLBBox selection_bbox = LLSelectMgr::getInstance()->getBBoxOfSelection(); F32 angle_of_view = llmax(0.1f, LLViewerCamera::getInstance()->getAspect() > 1.f ? LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect() : LLViewerCamera::getInstance()->getView()); @@ -6437,7 +6536,7 @@ void handle_zoom_to_object(LLUUID object_id) if (object) { - gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); + gAgentCamera.setFocusOnAvatar(false, ANIMATE); LLBBox bbox = object->getBoundingBoxAgent() ; F32 angle_of_view = llmax(0.1f, LLViewerCamera::getInstance()->getAspect() > 1.f ? LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect() : LLViewerCamera::getInstance()->getView()); @@ -6509,8 +6608,8 @@ class LLAvatarToggleMyProfile : public view_listener_t LLFloater* instance = LLAvatarActions::getProfileFloater(gAgent.getID()); if (LLFloater::isMinimized(instance)) { - instance->setMinimized(FALSE); - instance->setFocus(TRUE); + instance->setMinimized(false); + instance->setFocus(true); } else if (!LLFloater::isShown(instance)) { @@ -6518,7 +6617,7 @@ class LLAvatarToggleMyProfile : public view_listener_t } else if (!instance->hasFocus() && !instance->getIsChrome()) { - instance->setFocus(TRUE); + instance->setFocus(true); } else { @@ -6535,8 +6634,8 @@ class LLAvatarTogglePicks : public view_listener_t LLFloater * instance = LLAvatarActions::getProfileFloater(gAgent.getID()); if (LLFloater::isMinimized(instance) || (instance && !instance->hasFocus() && !instance->getIsChrome())) { - instance->setMinimized(FALSE); - instance->setFocus(TRUE); + instance->setMinimized(false); + instance->setFocus(true); LLAvatarActions::showPicks(gAgent.getID()); } else if (picks_tab_visible()) @@ -6558,8 +6657,8 @@ class LLAvatarToggleSearch : public view_listener_t LLFloater* instance = LLFloaterReg::findInstance("search"); if (LLFloater::isMinimized(instance)) { - instance->setMinimized(FALSE); - instance->setFocus(TRUE); + instance->setMinimized(false); + instance->setFocus(true); } else if (!LLFloater::isShown(instance)) { @@ -6567,7 +6666,7 @@ class LLAvatarToggleSearch : public view_listener_t } else if (!instance->hasFocus() && !instance->getIsChrome()) { - instance->setFocus(TRUE); + instance->setFocus(true); } else { @@ -7080,7 +7179,7 @@ class LLLandEdit : public view_listener_t if (gAgentCamera.getFocusOnAvatar() && gSavedSettings.getBOOL("EditCameraMovement") ) { // zoom in if we're looking at the avatar - gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); + gAgentCamera.setFocusOnAvatar(false, ANIMATE); gAgentCamera.setFocusGlobal(LLToolPie::getInstance()->getPick()); gAgentCamera.cameraOrbitOver( F_PI * 0.25f ); @@ -7143,7 +7242,7 @@ class LLWorldEnableBuyLand : public view_listener_t } }; -BOOL enable_buy_land(void*) +bool enable_buy_land(void*) { return LLViewerParcelMgr::getInstance()->canAgentBuyParcel( LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(), false); @@ -7181,7 +7280,7 @@ private: return true; } - static void onNearAttachObject(BOOL success, void *user_data); + static void onNearAttachObject(bool success, void *user_data); void confirmReplaceAttachment(S32 option, LLViewerJointAttachment* attachment_point); class CallbackData : public LLSelectionCallbackData { @@ -7200,7 +7299,7 @@ protected: LLObjectSelectionHandle LLObjectAttachToAvatar::sObjectSelection; // static -void LLObjectAttachToAvatar::onNearAttachObject(BOOL success, void *user_data) +void LLObjectAttachToAvatar::onNearAttachObject(bool success, void *user_data) { if (!user_data) return; CallbackData* cb_data = static_cast<CallbackData*>(user_data); @@ -7425,21 +7524,21 @@ class LLAttachmentDetach : public view_listener_t } LLViewerObject* parent = (LLViewerObject*)objectp->getParent(); - while (parent) - { - if (parent->isAvatar()) - { - break; - } + while (parent) + { + if(parent->isAvatar()) + { + break; + } objectp = parent; - parent = (LLViewerObject*)parent->getParent(); - } + parent = (LLViewerObject*)parent->getParent(); + } // std::set to avoid dupplicate 'roots' from linksets mRemoveSet.insert(objectp->getAttachmentItemID()); - return true; - } + return true; + } bool mAvatarsInSelection; uuid_set_t mRemoveSet; } func; @@ -7493,7 +7592,7 @@ class LLAttachmentEnableDrop : public view_listener_t { bool handleEvent(const LLSD& userdata) { - BOOL can_build = gAgent.isGodlike() || (LLViewerParcelMgr::getInstance()->allowAgentBuild()); + bool can_build = gAgent.isGodlike() || (LLViewerParcelMgr::getInstance()->allowAgentBuild()); //Add an inventory observer to only allow dropping the newly attached item //once it exists in your inventory. Look at Jira 2422. @@ -7545,7 +7644,7 @@ class LLAttachmentEnableDrop : public view_listener_t } }; -BOOL enable_detach(const LLSD&) +bool enable_detach(const LLSD&) { LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); @@ -7554,7 +7653,7 @@ BOOL enable_detach(const LLSD&) !object->isAttachment() || !LLSelectMgr::getInstance()->getSelection()->contains(object,SELECT_ALL_TES )) { - return FALSE; + return false; } // Find the avatar who owns this attachment @@ -7564,13 +7663,13 @@ BOOL enable_detach(const LLSD&) // ...if it's you, good to detach if (avatar->getID() == gAgent.getID()) { - return TRUE; + return true; } avatar = (LLViewerObject*)avatar->getParent(); } - return FALSE; + return false; } class LLAttachmentEnableDetach : public view_listener_t @@ -7583,7 +7682,7 @@ class LLAttachmentEnableDetach : public view_listener_t }; // Used to tell if the selected object can be attached to your avatar. -BOOL object_selected_and_point_valid() +bool object_selected_and_point_valid() { LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); for (LLObjectSelection::root_iterator iter = selection->root_begin(); @@ -7598,7 +7697,7 @@ BOOL object_selected_and_point_valid() LLViewerObject* child = *iter; if (child->isAvatar()) { - return FALSE; + return false; } } } @@ -7613,23 +7712,23 @@ BOOL object_selected_and_point_valid() } -BOOL object_is_wearable() +bool object_is_wearable() { if (!isAgentAvatarValid()) { - return FALSE; + return false; } if (!object_selected_and_point_valid()) { - return FALSE; + return false; } if (sitting_on_selection()) { - return FALSE; + return false; } if (!gAgentAvatarp->canAttachMoreObjects()) { - return FALSE; + return false; } LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); for (LLObjectSelection::valid_root_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_root_begin(); @@ -7638,10 +7737,10 @@ BOOL object_is_wearable() LLSelectNode* node = *iter; if (node->mPermissions->getOwner() == gAgent.getID()) { - return TRUE; + return true; } } - return FALSE; + return false; } @@ -7689,10 +7788,10 @@ namespace { struct QueueObjects : public LLSelectedNodeFunctor { - BOOL scripted; - BOOL modifiable; + bool scripted; + bool modifiable; LLFloaterScriptQueue* mQueue; - QueueObjects(LLFloaterScriptQueue* q) : mQueue(q), scripted(FALSE), modifiable(FALSE) {} + QueueObjects(LLFloaterScriptQueue* q) : mQueue(q), scripted(false), modifiable(false) {} virtual bool apply(LLSelectNode* node) { LLViewerObject* obj = node->getObject(); @@ -7899,13 +7998,13 @@ void handle_selected_material_info() void handle_test_male(void*) { LLAppearanceMgr::instance().wearOutfitByName("Male Shape & Outfit"); - //gGestureList.requestResetFromServer( TRUE ); + //gGestureList.requestResetFromServer( true ); } void handle_test_female(void*) { LLAppearanceMgr::instance().wearOutfitByName("Female Shape & Outfit"); - //gGestureList.requestResetFromServer( FALSE ); + //gGestureList.requestResetFromServer( false ); } void handle_dump_attachments(void*) @@ -7923,7 +8022,7 @@ void handle_dump_attachments(void*) ++attachment_iter) { LLViewerObject *attached_object = attachment_iter->get(); - BOOL visible = (attached_object != NULL && + bool visible = (attached_object != NULL && attached_object->mDrawable.notNull() && !attached_object->mDrawable->isRenderType(0)); LLVector3 pos; @@ -7947,7 +8046,7 @@ protected: bool handleEvent(const LLSD& userdata) { std::string control_name = userdata.asString(); - BOOL checked = gSavedSettings.getBOOL( control_name ); + bool checked = gSavedSettings.getBOOL( control_name ); gSavedSettings.setBOOL( control_name, !checked ); return true; } @@ -8004,7 +8103,7 @@ class LLAdvancedClickRenderProfile: public view_listener_t { bool handleEvent(const LLSD& userdata) { - gShaderProfileFrame = TRUE; + gShaderProfileFrame = true; return true; } }; @@ -8034,23 +8133,59 @@ class LLAdvancedClickHDRIPreview: public view_listener_t }; -class LLAdvancedClickGLTFScenePreview : public view_listener_t +class LLAdvancedClickGLTFOpen: public view_listener_t { bool handleEvent(const LLSD& userdata) { - // open personal lighting floater when previewing an HDRI (keeps HDRI from implicitly unloading when opening build tools) LL::GLTFSceneManager::instance().load(); return true; } }; +class LLAdvancedClickGLTFSaveAs : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LL::GLTFSceneManager::instance().saveAs(); + return true; + } +}; + +class LLAdvancedClickGLTFUpload: public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LL::GLTFSceneManager::instance().uploadSelection(); + return true; + } +}; + +class LLAdvancedClickResizeWindow : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + S32 w = 0; + S32 h = 0; + + sscanf(userdata.asString().c_str(), "%dx%d", &w, &h); + + if (w > 0 && h > 0) + { + gViewerWindow->getWindow()->setSize(LLCoordWindow(w, h)); + } + + return true; + } +}; + + // these are used in the gl menus to set control values that require shader recompilation class LLToggleShaderControl : public view_listener_t { bool handleEvent(const LLSD& userdata) { std::string control_name = userdata.asString(); - BOOL checked = gSavedSettings.getBOOL( control_name ); + bool checked = gSavedSettings.getBOOL( control_name ); gSavedSettings.setBOOL( control_name, !checked ); LLPipeline::refreshCachedSettings(); LLViewerShaderMgr::instance()->setShaders(); @@ -8170,19 +8305,23 @@ bool enable_object_take_copy() return all_valid; } +bool enable_take_copy_objects() +{ + return enable_object_take_copy() && is_multiple_selection(); +} class LLHasAsset : public LLInventoryCollectFunctor { public: - LLHasAsset(const LLUUID& id) : mAssetID(id), mHasAsset(FALSE) {} + LLHasAsset(const LLUUID& id) : mAssetID(id), mHasAsset(false) {} virtual ~LLHasAsset() {} virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item); - BOOL hasAsset() const { return mHasAsset; } + bool hasAsset() const { return mHasAsset; } protected: LLUUID mAssetID; - BOOL mHasAsset; + bool mHasAsset; }; bool LLHasAsset::operator()(LLInventoryCategory* cat, @@ -8190,13 +8329,13 @@ bool LLHasAsset::operator()(LLInventoryCategory* cat, { if(item && item->getAssetUUID() == mAssetID) { - mHasAsset = TRUE; + mHasAsset = true; } - return FALSE; + return false; } -BOOL enable_save_into_task_inventory(void*) +bool enable_save_into_task_inventory(void*) { LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); if(node && (node->mValid) && (!node->mFromTaskID.isNull())) @@ -8205,10 +8344,10 @@ BOOL enable_save_into_task_inventory(void*) LLViewerObject* obj = node->getObject(); if( obj && !obj->isAttachment() ) { - return TRUE; + return true; } } - return FALSE; + return false; } class LLToolsEnableSaveToObjectInventory : public view_listener_t @@ -8278,12 +8417,12 @@ class LLWorldEnableTeleportHome : public view_listener_t } }; -BOOL enable_god_full(void*) +bool enable_god_full(void*) { return gAgent.getGodLevel() >= GOD_FULL; } -BOOL enable_god_liaison(void*) +bool enable_god_liaison(void*) { return gAgent.getGodLevel() >= GOD_LIAISON; } @@ -8293,7 +8432,7 @@ bool is_god_customer_service() return gAgent.getGodLevel() >= GOD_CUSTOMER_SERVICE; } -BOOL enable_god_basic(void*) +bool enable_god_basic(void*) { return gAgent.getGodLevel() > GOD_NOT; } @@ -8304,7 +8443,7 @@ void toggle_show_xui_names(void *) gSavedSettings.setBOOL("DebugShowXUINames", !gSavedSettings.getBOOL("DebugShowXUINames")); } -BOOL check_show_xui_names(void *) +bool check_show_xui_names(void *) { return gSavedSettings.getBOOL("DebugShowXUINames"); } @@ -8313,7 +8452,7 @@ class LLToolsSelectOnlyMyObjects : public view_listener_t { bool handleEvent(const LLSD& userdata) { - BOOL cur_val = gSavedSettings.getBOOL("SelectOwnedOnly"); + bool cur_val = gSavedSettings.getBOOL("SelectOwnedOnly"); gSavedSettings.setBOOL("SelectOwnedOnly", ! cur_val ); @@ -8325,7 +8464,7 @@ class LLToolsSelectOnlyMovableObjects : public view_listener_t { bool handleEvent(const LLSD& userdata) { - BOOL cur_val = gSavedSettings.getBOOL("SelectMovableOnly"); + bool cur_val = gSavedSettings.getBOOL("SelectMovableOnly"); gSavedSettings.setBOOL("SelectMovableOnly", ! cur_val ); @@ -8337,7 +8476,7 @@ class LLToolsSelectInvisibleObjects : public view_listener_t { bool handleEvent(const LLSD& userdata) { - BOOL cur_val = gSavedSettings.getBOOL("SelectInvisibleObjects"); + bool cur_val = gSavedSettings.getBOOL("SelectInvisibleObjects"); gSavedSettings.setBOOL("SelectInvisibleObjects", !cur_val); @@ -8349,7 +8488,7 @@ class LLToolsSelectReflectionProbes: public view_listener_t { bool handleEvent(const LLSD& userdata) { - BOOL cur_val = gSavedSettings.getBOOL("SelectReflectionProbes"); + bool cur_val = gSavedSettings.getBOOL("SelectReflectionProbes"); gSavedSettings.setBOOL("SelectReflectionProbes", !cur_val); @@ -8396,7 +8535,7 @@ class LLToolsEditLinkedParts : public view_listener_t { bool handleEvent(const LLSD& userdata) { - BOOL select_individuals = !gSavedSettings.getBOOL("EditLinkedParts"); + bool select_individuals = !gSavedSettings.getBOOL("EditLinkedParts"); gSavedSettings.setBOOL( "EditLinkedParts", select_individuals ); if (select_individuals) { @@ -8476,7 +8615,7 @@ void handle_grab_baked_texture(void* data) LLInventoryItemFlags::II_FLAGS_NONE, creation_date_now); - item->updateServer(TRUE); + item->updateServer(true); gInventory.updateItem(item); gInventory.notifyObservers(); @@ -8500,14 +8639,14 @@ void handle_grab_baked_texture(void* data) } } -BOOL enable_grab_baked_texture(void* data) +bool enable_grab_baked_texture(void* data) { EBakedTextureIndex index = (EBakedTextureIndex)((intptr_t)data); if (isAgentAvatarValid()) { return gAgentAvatarp->canGrabBakedTexture(index); } - return FALSE; + return false; } // Returns a pointer to the avatar give the UUID of the avatar OR of an attachment the avatar is wearing. @@ -8634,18 +8773,18 @@ LLViewerMenuHolderGL::LLViewerMenuHolderGL(const LLViewerMenuHolderGL::Params& p : LLMenuHolderGL(p) {} -BOOL LLViewerMenuHolderGL::hideMenus() +bool LLViewerMenuHolderGL::hideMenus() { - BOOL handled = FALSE; + bool handled = false; if (LLMenuHolderGL::hideMenus()) { - handled = TRUE; + handled = true; } // drop pie menu selection - mParcelSelection = NULL; - mObjectSelection = NULL; + mParcelSelection = nullptr; + mObjectSelection = nullptr; if (gMenuBarView) { @@ -8761,7 +8900,7 @@ void toggle_visibility(void* user_data) viewp->setVisible(!viewp->getVisible()); } -BOOL get_visibility(void* user_data) +bool get_visibility(void* user_data) { LLView* viewp = (LLView*)user_data; return viewp->getVisible(); @@ -9093,9 +9232,9 @@ class LLToolsSelectTool : public view_listener_t // attempt to open it, but it won't bring it to front or de-minimize. if (gFloaterTools && (gFloaterTools->isMinimized() || !gFloaterTools->isShown() || !gFloaterTools->isFrontmost())) { - gFloaterTools->setMinimized(FALSE); + gFloaterTools->setMinimized(false); gFloaterTools->openFloater(); - gFloaterTools->setVisibleAndFrontmost(TRUE); + gFloaterTools->setVisibleAndFrontmost(true); } return true; } @@ -9113,7 +9252,7 @@ class LLWorldEnvSettings : public view_listener_t LLFloater* env_floater = LLFloaterReg::findTypedInstance<LLFloater>(*it); if (env_floater) { - env_floater->setFocus(FALSE); + env_floater->setFocus(false); } } } @@ -9618,6 +9757,7 @@ void initialize_menus() enable.add("Tools.EnableUnlink", boost::bind(&LLSelectMgr::enableUnlinkObjects, LLSelectMgr::getInstance())); view_listener_t::addMenu(new LLToolsEnableBuyOrTake(), "Tools.EnableBuyOrTake"); enable.add("Tools.EnableTakeCopy", boost::bind(&enable_object_take_copy)); + enable.add("Tools.EnableCopySeparate", boost::bind(&enable_take_copy_objects)); enable.add("Tools.VisibleBuyObject", boost::bind(&tools_visible_buy_object)); enable.add("Tools.VisibleTakeObject", boost::bind(&tools_visible_take_object)); view_listener_t::addMenu(new LLToolsEnableSaveToObjectInventory(), "Tools.EnableSaveToObjectInventory"); @@ -9672,7 +9812,10 @@ void initialize_menus() view_listener_t::addMenu(new LLAdvancedClickRenderProfile(), "Advanced.ClickRenderProfile"); view_listener_t::addMenu(new LLAdvancedClickRenderBenchmark(), "Advanced.ClickRenderBenchmark"); view_listener_t::addMenu(new LLAdvancedClickHDRIPreview(), "Advanced.ClickHDRIPreview"); - view_listener_t::addMenu(new LLAdvancedClickGLTFScenePreview(), "Advanced.ClickGLTFScenePreview"); + view_listener_t::addMenu(new LLAdvancedClickGLTFOpen(), "Advanced.ClickGLTFOpen"); + view_listener_t::addMenu(new LLAdvancedClickGLTFSaveAs(), "Advanced.ClickGLTFSaveAs"); + view_listener_t::addMenu(new LLAdvancedClickGLTFUpload(), "Advanced.ClickGLTFUpload"); + view_listener_t::addMenu(new LLAdvancedClickResizeWindow(), "Advanced.ClickResizeWindow"); view_listener_t::addMenu(new LLAdvancedPurgeShaderCache(), "Advanced.ClearShaderCache"); view_listener_t::addMenu(new LLAdvancedRebuildTerrain(), "Advanced.RebuildTerrain"); @@ -9891,6 +10034,9 @@ void initialize_menus() view_listener_t::addMenu(new LLObjectMute(), "Object.Mute"); enable.add("Object.VisibleTake", boost::bind(&visible_take_object)); + enable.add("Object.VisibleTakeMultiple", boost::bind(&is_multiple_selection)); + enable.add("Object.VisibleTakeSingle", boost::bind(&is_single_selection)); + enable.add("Object.EnableTakeMultiple", boost::bind(&enable_take_objects)); enable.add("Object.VisibleBuy", boost::bind(&visible_buy_object)); commit.add("Object.Buy", boost::bind(&handle_buy)); @@ -9899,7 +10045,9 @@ void initialize_menus() commit.add("Object.EditGLTFMaterial", boost::bind(&handle_object_edit_gltf_material)); commit.add("Object.Inspect", boost::bind(&handle_object_inspect)); commit.add("Object.Open", boost::bind(&handle_object_open)); - commit.add("Object.Take", boost::bind(&handle_take)); + commit.add("Object.Take", boost::bind(&handle_take, false)); + commit.add("Object.TakeSeparate", boost::bind(&handle_take, true)); + commit.add("Object.TakeSeparateCopy", boost::bind(&handle_take_separate_copy)); commit.add("Object.ShowInspector", boost::bind(&handle_object_show_inspector)); enable.add("Object.EnableInspect", boost::bind(&enable_object_inspect)); enable.add("Object.EnableEditGLTFMaterial", boost::bind(&enable_object_edit_gltf_material)); @@ -9972,6 +10120,9 @@ void initialize_menus() commit.add("Pathfinding.Characters.Select", boost::bind(&LLFloaterPathfindingCharacters::openCharactersWithSelectedObjects)); enable.add("EnableSelectInPathfindingCharacters", boost::bind(&enable_object_select_in_pathfinding_characters)); enable.add("Advanced.EnableErrorOSException", boost::bind(&enable_os_exception)); + enable.add("EnableGLTF", boost::bind(&enable_gltf)); + enable.add("EnableGLTFSaveAs", boost::bind(&enable_gltf_save_as)); + enable.add("EnableGLTFUpload", boost::bind(&enable_gltf_upload)); view_listener_t::addMenu(new LLFloaterVisible(), "FloaterVisible"); view_listener_t::addMenu(new LLShowSidetrayPanel(), "ShowSidetrayPanel"); diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h index f4f48d88c0..49c2b6272c 100644 --- a/indra/newview/llviewermenu.h +++ b/indra/newview/llviewermenu.h @@ -61,27 +61,27 @@ void handle_deselect(void*); void handle_delete_object(); void handle_duplicate(void*); void handle_duplicate_in_place(void*); -BOOL enable_not_have_card(void *userdata); +bool enable_not_have_card(void *userdata); void process_grant_godlike_powers(LLMessageSystem* msg, void**); -BOOL enable_cut(void*); -BOOL enable_copy(void*); -BOOL enable_paste(void*); -BOOL enable_select_all(void*); -BOOL enable_deselect(void*); -BOOL enable_undo(void*); -BOOL enable_redo(void*); +bool enable_cut(void*); +bool enable_copy(void*); +bool enable_paste(void*); +bool enable_select_all(void*); +bool enable_deselect(void*); +bool enable_undo(void*); +bool enable_redo(void*); -BOOL is_agent_mappable(const LLUUID& agent_id); +bool is_agent_mappable(const LLUUID& agent_id); void confirm_replace_attachment(S32 option, void* user_data); void handle_detach_from_avatar(const LLSD& user_data); void attach_label(std::string& label, const LLSD&); void detach_label(std::string& label, const LLSD&); void handle_detach(void*); -BOOL enable_god_full(void* user_data); -BOOL enable_god_liaison(void* user_data); -BOOL enable_god_basic(void* user_data); +bool enable_god_full(void* user_data); +bool enable_god_liaison(void* user_data); +bool enable_god_basic(void* user_data); void check_merchant_status(bool force = false); void exchange_callingcard(const LLUUID& dest_id); @@ -103,7 +103,7 @@ bool enable_object_delete(); // Buy either contents or object itself void handle_buy(); -void handle_take(); +void handle_take(bool take_separate = false); void handle_take_copy(); void handle_look_at_selection(const LLSD& param); void handle_zoom_to_object(LLUUID object_id); @@ -161,7 +161,7 @@ public: LLViewerMenuHolderGL(const Params& p); - virtual BOOL hideMenus(); + virtual bool hideMenus(); void setParcelSelection(LLSafeHandle<LLParcelSelection> selection); void setObjectSelection(LLSafeHandle<LLObjectSelection> selection); diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 192ebd1f39..e3da52fc78 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -188,7 +188,7 @@ void LLFilePickerThread::run() void LLFilePickerThread::runModeless() { - BOOL result = FALSE; + bool result = false; LLFilePicker picker; if (mIsSaveDialog) @@ -440,7 +440,7 @@ const bool check_file_extension(const std::string& filename, LLFilePicker::ELoad //now grab the set of valid file extensions std::string valid_extensions = build_extensions_string(type); - BOOL ext_valid = FALSE; + bool ext_valid = false; typedef boost::tokenizer<boost::char_separator<char> > tokenizer; boost::char_separator<char> sep(" "); @@ -451,7 +451,7 @@ const bool check_file_extension(const std::string& filename, LLFilePicker::ELoad //and compare them to the extension of the file //to be uploaded for (token_iter = tokens.begin(); - token_iter != tokens.end() && ext_valid != TRUE; + token_iter != tokens.end() && !ext_valid; ++token_iter) { const std::string& cur_token = *token_iter; @@ -460,11 +460,11 @@ const bool check_file_extension(const std::string& filename, LLFilePicker::ELoad { //valid extension //or the acceptable extension is any - ext_valid = TRUE; + ext_valid = true; } }//end for (loop over all tokens) - if (ext_valid == FALSE) + if (!ext_valid) { //should only get here if the extension exists //but is invalid @@ -587,7 +587,7 @@ void do_bulk_upload(std::vector<std::string> filenames, const LLSD& notification tinygltf::Model model; if (LLTinyGLTFHelper::loadModel(filename, model)) { - S32 materials_in_file = model.materials.size(); + S32 materials_in_file = static_cast<S32>(model.materials.size()); for (S32 i = 0; i < materials_in_file; i++) { @@ -644,7 +644,7 @@ bool get_bulk_upload_expected_cost(const std::vector<std::string>& filenames, S3 if (LLTinyGLTFHelper::loadModel(filename, model)) { - S32 materials_in_file = model.materials.size(); + S32 materials_in_file = static_cast<S32>(model.materials.size()); for (S32 i = 0; i < materials_in_file; i++) { @@ -756,7 +756,7 @@ class LLFileUploadModel : public view_listener_t bool handleEvent(const LLSD& userdata) { LLFloaterModelPreview::showModelPreview(); - return TRUE; + return true; } }; @@ -765,7 +765,7 @@ class LLFileUploadMaterial : public view_listener_t bool handleEvent(const LLSD& userdata) { LLMaterialEditor::importMaterial(); - return TRUE; + return true; } }; @@ -888,11 +888,11 @@ class LLFileTakeSnapshotToDisk : public view_listener_t S32 width = gViewerWindow->getWindowWidthRaw(); S32 height = gViewerWindow->getWindowHeightRaw(); - BOOL render_ui = gSavedSettings.getBOOL("RenderUIInSnapshot"); - BOOL render_hud = gSavedSettings.getBOOL("RenderHUDInSnapshot"); - BOOL render_no_post = gSavedSettings.getBOOL("RenderSnapshotNoPost"); + bool render_ui = gSavedSettings.getBOOL("RenderUIInSnapshot"); + bool render_hud = gSavedSettings.getBOOL("RenderHUDInSnapshot"); + bool render_no_post = gSavedSettings.getBOOL("RenderSnapshotNoPost"); - BOOL high_res = gSavedSettings.getBOOL("HighResSnapshot"); + bool high_res = gSavedSettings.getBOOL("HighResSnapshot"); if (high_res) { width *= 2; @@ -905,11 +905,11 @@ class LLFileTakeSnapshotToDisk : public view_listener_t if (gViewerWindow->rawSnapshot(raw, width, height, - TRUE, - FALSE, + true, + false, render_ui, render_hud, - FALSE, + false, render_no_post, LLSnapshotModel::SNAPSHOT_TYPE_COLOR, high_res ? S32_MAX : MAX_SNAPSHOT_IMAGE_SIZE)) //per side @@ -962,7 +962,7 @@ void handle_compress_image(void*) LL_INFOS() << "Input: " << infile << LL_ENDL; LL_INFOS() << "Output: " << outfile << LL_ENDL; - BOOL success; + bool success; success = LLViewerTextureList::createUploadFile(infile, outfile, IMG_CODEC_TGA); @@ -1012,7 +1012,7 @@ void handle_compress_file_test(void*) S64Bytes initial_size = S64Bytes(get_file_size(infile)); - BOOL success; + bool success; F64 total_seconds = LLTimer::getTotalSeconds(); success = gzip_file(infile, packfile); @@ -1106,7 +1106,7 @@ void upload_done_callback( LLResourceData* data = (LLResourceData*)user_data; S32 expected_upload_cost = data ? data->mExpectedUploadCost : 0; //LLAssetType::EType pref_loc = data->mPreferredLocation; - BOOL is_balance_sufficient = TRUE; + bool is_balance_sufficient = true; if(data) { @@ -1124,7 +1124,7 @@ void upload_done_callback( if(!(can_afford_transaction(expected_upload_cost))) { LLBuyCurrencyHTML::openCurrencyFloater( "", expected_upload_cost ); - is_balance_sufficient = FALSE; + is_balance_sufficient = false; } else if(region) { @@ -1285,7 +1285,7 @@ void upload_new_resource( data->mAssetInfo.mType, asset_callback, (void*)data, - FALSE); + false); } } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 52bc2d9654..5a32f9654d 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -127,7 +127,7 @@ extern void on_new_message(const LLSD& msg); -extern BOOL gCubeSnapshot; +extern bool gCubeSnapshot; // // Constants @@ -139,7 +139,7 @@ const F32 CAMERA_POSITION_THRESHOLD_SQUARED = 0.001f * 0.001f; static const U32 LLREQUEST_PERMISSION_THROTTLE_LIMIT = 5; // requests static const F32 LLREQUEST_PERMISSION_THROTTLE_INTERVAL = 10.0f; // seconds -extern BOOL gDebugClicks; +extern bool gDebugClicks; extern bool gShiftFrame; // function prototypes @@ -187,7 +187,7 @@ void accept_friendship_coro(std::string url, LLSD notification) } else { - if (!result.has("success") || result["success"].asBoolean() == false) + if (!result.has("success") || !result["success"].asBoolean()) { LL_WARNS("Friendship") << "Server failed to process accepted friendship. " << httpResults << LL_ENDL; } @@ -230,7 +230,7 @@ void decline_friendship_coro(std::string url, LLSD notification, S32 option) } else { - if (!result.has("success") || result["success"].asBoolean() == false) + if (!result.has("success") || !result["success"].asBoolean()) { LL_WARNS("Friendship") << "Server failed to process declined friendship. " << httpResults << LL_ENDL; } @@ -274,7 +274,7 @@ bool friendship_offer_callback(const LLSD& notification, const LLSD& response) // This will also trigger an onlinenotification if the user is online std::string url = gAgent.getRegionCapability("AcceptFriendship"); LL_DEBUGS("Friendship") << "Cap string: " << url << LL_ENDL; - if (!url.empty() && payload.has("online") && payload["online"].asBoolean() == false) + if (!url.empty() && payload.has("online") && !payload["online"].asBoolean()) { LL_DEBUGS("Friendship") << "Accepting friendship via capability" << LL_ENDL; LLCoros::instance().launch("LLMessageSystem::acceptFriendshipOffer", @@ -314,7 +314,7 @@ bool friendship_offer_callback(const LLSD& notification, const LLSD& response) // the rejection to the simulator to delete the pending userop. std::string url = gAgent.getRegionCapability("DeclineFriendship"); LL_DEBUGS("Friendship") << "Cap string: " << url << LL_ENDL; - if (!url.empty() && payload.has("online") && payload["online"].asBoolean() == false) + if (!url.empty() && payload.has("online") && !payload["online"].asBoolean()) { LL_DEBUGS("Friendship") << "Declining friendship via capability" << LL_ENDL; LLCoros::instance().launch("LLMessageSystem::declineFriendshipOffer", @@ -371,7 +371,7 @@ static LLNotificationFunctorRegistration friendship_offer_callback_reg_nm("Offer // Functions // -void give_money(const LLUUID& uuid, LLViewerRegion* region, S32 amount, BOOL is_group, +void give_money(const LLUUID& uuid, LLViewerRegion* region, S32 amount, bool is_group, S32 trx_type, const std::string& desc) { if(0 == amount || !region) return; @@ -393,7 +393,7 @@ void give_money(const LLUUID& uuid, LLViewerRegion* region, S32 amount, BOOL is_ msg->nextBlockFast(_PREHASH_MoneyData); msg->addUUIDFast(_PREHASH_SourceID, gAgent.getID() ); msg->addUUIDFast(_PREHASH_DestID, uuid); - msg->addU8Fast(_PREHASH_Flags, pack_transaction_flags(FALSE, is_group)); + msg->addU8Fast(_PREHASH_Flags, pack_transaction_flags(false, is_group)); msg->addS32Fast(_PREHASH_Amount, amount); msg->addU8Fast(_PREHASH_AggregatePermNextOwner, (U8)LLAggregatePermissions::AP_EMPTY); msg->addU8Fast(_PREHASH_AggregatePermInventory, (U8)LLAggregatePermissions::AP_EMPTY); @@ -507,192 +507,6 @@ void process_layer_data(LLMessageSystem *mesgsys, void **user_data) } } -// S32 exported_object_count = 0; -// S32 exported_image_count = 0; -// S32 current_object_count = 0; -// S32 current_image_count = 0; - -// extern LLNotifyBox *gExporterNotify; -// extern LLUUID gExporterRequestID; -// extern std::string gExportDirectory; - -// extern LLUploadDialog *gExportDialog; - -// std::string gExportedFile; - -// std::map<LLUUID, std::string> gImageChecksums; - -// void export_complete() -// { -// LLUploadDialog::modalUploadFinished(); -// gExporterRequestID.setNull(); -// gExportDirectory = ""; - -// LLFILE* fXML = LLFile::fopen(gExportedFile, "rb"); /* Flawfinder: ignore */ -// fseek(fXML, 0, SEEK_END); -// long length = ftell(fXML); -// fseek(fXML, 0, SEEK_SET); -// U8 *buffer = new U8[length + 1]; -// size_t nread = fread(buffer, 1, length, fXML); -// if (nread < (size_t) length) -// { -// LL_WARNS("Messaging") << "Short read" << LL_ENDL; -// } -// buffer[nread] = '\0'; -// fclose(fXML); - -// char *pos = (char *)buffer; -// while ((pos = strstr(pos+1, "<sl:image ")) != 0) -// { -// char *pos_check = strstr(pos, "checksum=\""); - -// if (pos_check) -// { -// char *pos_uuid = strstr(pos_check, "\">"); - -// if (pos_uuid) -// { -// char image_uuid_str[UUID_STR_SIZE]; /* Flawfinder: ignore */ -// memcpy(image_uuid_str, pos_uuid+2, UUID_STR_SIZE-1); /* Flawfinder: ignore */ -// image_uuid_str[UUID_STR_SIZE-1] = 0; - -// LLUUID image_uuid(image_uuid_str); - -// LL_INFOS("Messaging") << "Found UUID: " << image_uuid << LL_ENDL; - -// std::map<LLUUID, std::string>::iterator itor = gImageChecksums.find(image_uuid); -// if (itor != gImageChecksums.end()) -// { -// LL_INFOS("Messaging") << "Replacing with checksum: " << itor->second << LL_ENDL; -// if (!itor->second.empty()) -// { -// memcpy(&pos_check[10], itor->second.c_str(), 32); /* Flawfinder: ignore */ -// } -// } -// } -// } -// } - -// LLFILE* fXMLOut = LLFile::fopen(gExportedFile, "wb"); /* Flawfinder: ignore */ -// if (fwrite(buffer, 1, length, fXMLOut) != length) -// { -// LL_WARNS("Messaging") << "Short write" << LL_ENDL; -// } -// fclose(fXMLOut); - -// delete [] buffer; -// } - - -// void exported_item_complete(const LLTSCode status, void *user_data) -// { -// //std::string *filename = (std::string *)user_data; - -// if (status < LLTS_OK) -// { -// LL_WARNS("Messaging") << "Export failed!" << LL_ENDL; -// } -// else -// { -// ++current_object_count; -// if (current_image_count == exported_image_count && current_object_count == exported_object_count) -// { -// LL_INFOS("Messaging") << "*** Export complete ***" << LL_ENDL; - -// export_complete(); -// } -// else -// { -// gExportDialog->setMessage(llformat("Exported %d/%d object files, %d/%d textures.", current_object_count, exported_object_count, current_image_count, exported_image_count)); -// } -// } -// } - -// struct exported_image_info -// { -// LLUUID image_id; -// std::string filename; -// U32 image_num; -// }; - -// void exported_j2c_complete(const LLTSCode status, void *user_data) -// { -// exported_image_info *info = (exported_image_info *)user_data; -// LLUUID image_id = info->image_id; -// U32 image_num = info->image_num; -// std::string filename = info->filename; -// delete info; - -// if (status < LLTS_OK) -// { -// LL_WARNS("Messaging") << "Image download failed!" << LL_ENDL; -// } -// else -// { -// LLFILE* fIn = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */ -// if (fIn) -// { -// LLPointer<LLImageJ2C> ImageUtility = new LLImageJ2C; -// LLPointer<LLImageTGA> TargaUtility = new LLImageTGA; - -// fseek(fIn, 0, SEEK_END); -// S32 length = ftell(fIn); -// fseek(fIn, 0, SEEK_SET); -// U8 *buffer = ImageUtility->allocateData(length); -// if (fread(buffer, 1, length, fIn) != length) -// { -// LL_WARNS("Messaging") << "Short read" << LL_ENDL; -// } -// fclose(fIn); -// LLFile::remove(filename); - -// // Convert to TGA -// LLPointer<LLImageRaw> image = new LLImageRaw(); - -// ImageUtility->updateData(); -// ImageUtility->decode(image, 100000.0f); - -// TargaUtility->encode(image); -// U8 *data = TargaUtility->getData(); -// S32 data_size = TargaUtility->getDataSize(); - -// std::string file_path = gDirUtilp->getDirName(filename); - -// std::string output_file = llformat("%s/image-%03d.tga", file_path.c_str(), image_num);//filename; -// //S32 name_len = output_file.length(); -// //strcpy(&output_file[name_len-3], "tga"); -// LLFILE* fOut = LLFile::fopen(output_file, "wb"); /* Flawfinder: ignore */ -// char md5_hash_string[33]; /* Flawfinder: ignore */ -// strcpy(md5_hash_string, "00000000000000000000000000000000"); /* Flawfinder: ignore */ -// if (fOut) -// { -// if (fwrite(data, 1, data_size, fOut) != data_size) -// { -// LL_WARNS("Messaging") << "Short write" << LL_ENDL; -// } -// fseek(fOut, 0, SEEK_SET); -// fclose(fOut); -// fOut = LLFile::fopen(output_file, "rb"); /* Flawfinder: ignore */ -// LLMD5 my_md5_hash(fOut); -// my_md5_hash.hex_digest(md5_hash_string); -// } - -// gImageChecksums.insert(std::pair<LLUUID, std::string>(image_id, md5_hash_string)); -// } -// } - -// ++current_image_count; -// if (current_image_count == exported_image_count && current_object_count == exported_object_count) -// { -// LL_INFOS("Messaging") << "*** Export textures complete ***" << LL_ENDL; -// export_complete(); -// } -// else -// { -// gExportDialog->setMessage(llformat("Exported %d/%d object files, %d/%d textures.", current_object_count, exported_object_count, current_image_count, exported_image_count)); -// } -//} - void process_derez_ack(LLMessageSystem*, void**) { if(gViewerWindow) gViewerWindow->getWindow()->decBusyCount(); @@ -774,7 +588,7 @@ void response_group_invitation_coro(std::string url, LLUUID group_id, bool notif } else { - if (!result.has("success") || result["success"].asBoolean() == false) + if (!result.has("success") || !result["success"].asBoolean()) { LL_WARNS("GroupInvite") << "Server failed to process group " << group_id << " invitation response. " << httpResults << LL_ENDL; } @@ -974,13 +788,13 @@ static void highlight_inventory_objects_in_panel(const std::vector<LLUUID>& item // Parent folders can be different in case of 2 consecutive drag and drop // operations when the second one is started before the first one completes. LL_DEBUGS("Inventory_Move") << "Open folder: " << fv_folder->getName() << LL_ENDL; - fv_folder->setOpen(TRUE); + fv_folder->setOpen(true); if (fv_folder->isSelected()) { - fv->changeSelection(fv_folder, FALSE); + fv->changeSelection(fv_folder, false); } } - fv->changeSelection(fv_item, TRUE); + fv->changeSelection(fv_item, true); } } } @@ -1344,7 +1158,7 @@ protected: }; -//Returns TRUE if we are OK, FALSE if we are throttled +//Returns true if we are OK, false if we are throttled //Set check_only true if you want to know the throttle status //without registering a hit bool check_offer_throttle(const std::string& from_name, bool check_only) @@ -1465,7 +1279,7 @@ void open_inventory_offer(const uuid_vec_t& objects, const std::string& from_nam { LL_DEBUGS("Messaging") << "Highlighting inventory item: " << item->getUUID() << LL_ENDL; // If we opened this ourselves, focus it - const BOOL take_focus = from_name.empty() ? TAKE_FOCUS_YES : TAKE_FOCUS_NO; + const bool take_focus = from_name.empty() ? TAKE_FOCUS_YES : TAKE_FOCUS_NO; switch(asset_type) { case LLAssetType::AT_NOTECARD: @@ -1564,7 +1378,7 @@ void open_inventory_offer(const uuid_vec_t& objects, const std::string& from_nam // Highlight item bool show_in_inventory = gSavedSettings.get<bool>("ShowInInventory"); bool auto_open = - show_in_inventory && // don't open if ShowInInventory is FALSE + show_in_inventory && // don't open if ShowInInventory is false !from_name.empty(); // don't open if it's not from anyone // SL-20419 : Don't change active tab if floater is visible @@ -1646,7 +1460,7 @@ void inventory_offer_mute_callback(const LLUUID& blocked_id, { return (notification->getPayload()["from_id"].asUUID() == blocked_id); } - return FALSE; + return false; } private: const LLUUID& blocked_id; @@ -1669,8 +1483,8 @@ std::string LLOfferInfo::mResponderType = "offer_info"; LLOfferInfo::LLOfferInfo() : LLNotificationResponderInterface() - , mFromGroup(FALSE) - , mFromObject(FALSE) + , mFromGroup(false) + , mFromObject(false) , mIM(IM_NOTHING_SPECIAL) , mType(LLAssetType::AT_NONE) , mPersist(false) @@ -1753,7 +1567,7 @@ void LLOfferInfo::sendReceiveResponse(bool accept, const LLUUID &destination_fol msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_MessageBlock); - msg->addBOOLFast(_PREHASH_FromGroup, FALSE); + msg->addBOOLFast(_PREHASH_FromGroup, false); msg->addUUIDFast(_PREHASH_ToAgentID, mFromID); msg->addU8Fast(_PREHASH_Offline, IM_ONLINE); msg->addUUIDFast(_PREHASH_ID, mTransactionID); @@ -1947,7 +1761,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& chat.mText = log_message; if( LLMuteList::getInstance()->isMuted(mFromID ) && ! LLMuteList::isLinden(mFromName) ) // muting for SL-42269 { - chat.mMuted = TRUE; + chat.mMuted = true; accept_to_trash = false; // will send decline message } @@ -2042,25 +1856,29 @@ bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const std::string from_string; // Used in the pop-up. std::string chatHistory_string; // Used in chat history. - if (mFromObject == TRUE) + if (mFromObject) { + std::string quot = LLTrans::getString("'"); if (mFromGroup) { std::string group_name; if (gCacheName->getGroupName(mFromID, group_name)) { - from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+"'" - + mFromName + LLTrans::getString("'") +" " + LLTrans::getString("InvOfferOwnedByGroup") - + " "+ "'" + group_name + "'"; - - chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedByGroup") - + " " + group_name + "'"; + from_string = LLTrans::getString("InvOfferAnObjectNamed") + " " + + quot + mFromName + quot + " " + + LLTrans::getString("InvOfferOwnedByGroup") + " " + + quot + group_name + quot; + chatHistory_string = mFromName + " " + + LLTrans::getString("InvOfferOwnedByGroup") + " " + + quot + group_name + quot; } else { - from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+"'" - + mFromName +"'"+ " " + LLTrans::getString("InvOfferOwnedByUnknownGroup"); - chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedByUnknownGroup"); + from_string = LLTrans::getString("InvOfferAnObjectNamed") + " " + + quot + mFromName + quot + " " + + LLTrans::getString("InvOfferOwnedByUnknownGroup"); + chatHistory_string = mFromName + " " + + LLTrans::getString("InvOfferOwnedByUnknownGroup"); } } else @@ -2068,15 +1886,19 @@ bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const LLAvatarName av_name; if (LLAvatarNameCache::get(mFromID, &av_name)) { - from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+ LLTrans::getString("'") + mFromName - + LLTrans::getString("'")+" " + LLTrans::getString("InvOfferOwnedBy") + av_name.getUserName(); - chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedBy") + " " + av_name.getUserName(); + from_string = LLTrans::getString("InvOfferAnObjectNamed") + " " + + quot + mFromName + quot + " " + + LLTrans::getString("InvOfferOwnedBy") + " " + av_name.getUserName(); + chatHistory_string = mFromName + " " + + LLTrans::getString("InvOfferOwnedBy") + " " + av_name.getUserName(); } else { - from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+LLTrans::getString("'") - + mFromName + LLTrans::getString("'")+" " + LLTrans::getString("InvOfferOwnedByUnknownUser"); - chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedByUnknownUser"); + from_string = LLTrans::getString("InvOfferAnObjectNamed") + " " + + quot + mFromName + quot + " " + + LLTrans::getString("InvOfferOwnedByUnknownUser"); + chatHistory_string = mFromName + " " + + LLTrans::getString("InvOfferOwnedByUnknownUser"); } } } @@ -2168,7 +1990,7 @@ bool lure_callback(const LLSD& notification, const LLSD& response) LLUUID from_id = notification["payload"]["from_id"].asUUID(); LLUUID lure_id = notification["payload"]["lure_id"].asUUID(); - BOOL godlike = notification["payload"]["godlike"].asBoolean(); + bool godlike = notification["payload"]["godlike"].asBoolean(); switch(option) { @@ -2217,7 +2039,7 @@ bool mature_lure_callback(const LLSD& notification, const LLSD& response) LLUUID from_id = notification["payload"]["from_id"].asUUID(); LLUUID lure_id = notification["payload"]["lure_id"].asUUID(); - BOOL godlike = notification["payload"]["godlike"].asBoolean(); + bool godlike = notification["payload"]["godlike"].asBoolean(); U8 region_access = static_cast<U8>(notification["payload"]["region_maturity"].asInteger()); switch(option) @@ -2282,7 +2104,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) LL_PROFILE_ZONE_SCOPED; LLUUID from_id; - BOOL from_group; + bool from_group; LLUUID to_id; U8 offline; U8 d = 0; @@ -2342,7 +2164,7 @@ void send_do_not_disturb_message (LLMessageSystem* msg, const LLUUID& from_id, c pack_instant_message( msg, gAgent.getID(), - FALSE, + false, gAgent.getSessionID(), from_id, my_name, @@ -2542,10 +2364,10 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) chat.mFromName = from_name; } - BOOL is_do_not_disturb = gAgent.isDoNotDisturb(); + bool is_do_not_disturb = gAgent.isDoNotDisturb(); - BOOL is_muted = FALSE; - BOOL is_linden = FALSE; + bool is_muted = false; + bool is_linden = false; is_muted = LLMuteList::getInstance()->isMuted( from_id, from_name, @@ -2559,7 +2381,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) return; } - BOOL is_audible = (CHAT_AUDIBLE_FULLY == chat.mAudible); + bool is_audible = (CHAT_AUDIBLE_FULLY == chat.mAudible); chatter = gObjectList.findObject(from_id); if (chatter) { @@ -2593,25 +2415,25 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) if (is_audible) { - //BOOL visible_in_chat_bubble = FALSE; + //bool visible_in_chat_bubble = false; color.setVec(1.f,1.f,1.f,1.f); msg->getStringFast(_PREHASH_ChatData, _PREHASH_Message, mesg); - BOOL ircstyle = FALSE; + bool ircstyle = false; // Look for IRC-style emotes here so chatbubbles work std::string prefix = mesg.substr(0, 4); if (prefix == "/me " || prefix == "/me'") { - ircstyle = TRUE; + ircstyle = true; } chat.mText = mesg; // Look for the start of typing so we can put "..." in the bubbles. if (CHAT_TYPE_START == chat.mChatType) { - LLLocalSpeakerMgr::getInstance()->setSpeakerTyping(from_id, TRUE); + LLLocalSpeakerMgr::getInstance()->setSpeakerTyping(from_id, true); // Might not have the avatar constructed yet, eg on login. if (chatter && chatter->isAvatar()) @@ -2622,7 +2444,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) } else if (CHAT_TYPE_STOP == chat.mChatType) { - LLLocalSpeakerMgr::getInstance()->setSpeakerTyping(from_id, FALSE); + LLLocalSpeakerMgr::getInstance()->setSpeakerTyping(from_id, false); // Might not have the avatar constructed yet, eg on login. if (chatter && chatter->isAvatar()) @@ -2671,7 +2493,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) // We have a real utterance now, so can stop showing "..." and proceed. if (chatter && chatter->isAvatar()) { - LLLocalSpeakerMgr::getInstance()->setSpeakerTyping(from_id, FALSE); + LLLocalSpeakerMgr::getInstance()->setSpeakerTyping(from_id, false); ((LLVOAvatar*)chatter)->stopTyping(); if (!is_muted && !is_do_not_disturb) @@ -2778,11 +2600,11 @@ void process_teleport_start(LLMessageSystem *msg, void**) if (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL) { - gViewerWindow->setProgressCancelButtonVisible(FALSE); + gViewerWindow->setProgressCancelButtonVisible(false); } else { - gViewerWindow->setProgressCancelButtonVisible(TRUE, LLTrans::getString("Cancel")); + gViewerWindow->setProgressCancelButtonVisible(true, LLTrans::getString("Cancel")); } // Freeze the UI and show progress bar @@ -2790,7 +2612,7 @@ void process_teleport_start(LLMessageSystem *msg, void**) if( gAgent.getTeleportState() == LLAgent::TELEPORT_NONE ) { - gTeleportDisplay = TRUE; + gTeleportDisplay = true; gAgent.setTeleportState( LLAgent::TELEPORT_START ); make_ui_sound("UISndTeleportOut"); @@ -2820,11 +2642,11 @@ void process_teleport_progress(LLMessageSystem* msg, void**) msg->getU32("Info", "TeleportFlags", teleport_flags); if (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL) { - gViewerWindow->setProgressCancelButtonVisible(FALSE); + gViewerWindow->setProgressCancelButtonVisible(false); } else { - gViewerWindow->setProgressCancelButtonVisible(TRUE, LLTrans::getString("Cancel")); + gViewerWindow->setProgressCancelButtonVisible(true, LLTrans::getString("Cancel")); } std::string buffer; msg->getString("Info", "Message", buffer); @@ -2891,7 +2713,7 @@ public: virtual ~LLPostTeleportNotifiers(); //function to be called at the supplied frequency - virtual BOOL tick(); + virtual bool tick(); }; LLPostTeleportNotifiers::LLPostTeleportNotifiers() : LLEventTimer( 2.0 ) @@ -2902,9 +2724,9 @@ LLPostTeleportNotifiers::~LLPostTeleportNotifiers() { } -BOOL LLPostTeleportNotifiers::tick() +bool LLPostTeleportNotifiers::tick() { - BOOL all_done = FALSE; + bool all_done = false; if ( gAgent.getTeleportState() == LLAgent::TELEPORT_NONE ) { // get callingcards and landmarks available to the user arriving. @@ -2928,7 +2750,7 @@ BOOL LLPostTeleportNotifiers::tick() gInventory.addObserver(fetcher); } } - all_done = TRUE; + all_done = true; } return all_done; @@ -2962,7 +2784,7 @@ void process_teleport_finish(LLMessageSystem* msg, void**) { // Race condition? Make sure all variables are set correctly for teleport to work LL_WARNS("Teleport","Messaging") << "Teleport 'finish' message without 'start'. Setting state to TELEPORT_REQUESTED" << LL_ENDL; - gTeleportDisplay = TRUE; + gTeleportDisplay = true; LLViewerMessage::getInstance()->mTeleportStartedSignal(); gAgent.setTeleportState(LLAgent::TELEPORT_REQUESTED); make_ui_sound("UISndTeleportOut"); @@ -2974,11 +2796,11 @@ void process_teleport_finish(LLMessageSystem* msg, void**) } // Teleport is finished; it can't be cancelled now. - gViewerWindow->setProgressCancelButtonVisible(FALSE); + gViewerWindow->setProgressCancelButtonVisible(false); // Do teleport effect for where you're leaving // VEFFECT: TeleportStart - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, true); effectp->setPositionGlobal(gAgent.getPositionGlobal()); effectp->setColor(LLColor4U(gAgent.getEffectColor())); LLHUDManager::getInstance()->sendEffects(); @@ -3022,7 +2844,7 @@ void process_teleport_finish(LLMessageSystem* msg, void**) LLHost sim_host(sim_ip, sim_port); // Viewer trusts the simulator. - gMessageSystem->enableCircuit(sim_host, TRUE); + gMessageSystem->enableCircuit(sim_host, true); LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host); /* @@ -3030,7 +2852,7 @@ void process_teleport_finish(LLMessageSystem* msg, void**) gAgentCamera.updateCamera(); // likewise make sure the camera is behind the avatar - gAgentCamera.resetView(TRUE); + gAgentCamera.resetView(true); LLVector3 shift_vector = regionp->getPosRegionFromGlobal(gAgent.getRegion()->getOriginGlobal()); gAgent.setRegion(regionp); gObjectList.shiftObjects(shift_vector); @@ -3073,15 +2895,15 @@ void process_teleport_finish(LLMessageSystem* msg, void**) // Now do teleport effect for where you're going. // VEFFECT: TeleportEnd - effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); + effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, true); effectp->setPositionGlobal(gAgent.getPositionGlobal()); effectp->setColor(LLColor4U(gAgent.getEffectColor())); LLHUDManager::getInstance()->sendEffects(); -// gTeleportDisplay = TRUE; +// gTeleportDisplay = true; // gTeleportDisplayTimer.reset(); -// gViewerWindow->setShowProgress(TRUE); +// gViewerWindow->setShowProgress(true); } // stuff we have to do every time we get an AvatarInitComplete from a sim @@ -3178,7 +3000,7 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**) look_at = LLViewerCamera::getInstance()->getAtAxis(); } // Force the camera back onto the agent, don't animate. - gAgentCamera.setFocusOnAvatar(TRUE, FALSE); + gAgentCamera.setFocusOnAvatar(true, false); gAgentCamera.slamLookAt(look_at); gAgentCamera.updateCamera(); @@ -3238,15 +3060,15 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**) /* if (teleport_flags & TELEPORT_FLAGS_IS_FLYING) { - gAgent.setFlying(TRUE); + gAgent.setFlying(true); } else { - gAgent.setFlying(FALSE); + gAgent.setFlying(false); } */ - send_agent_update(TRUE, TRUE); + send_agent_update(true, true); if (gAgent.getRegion()->getBlockFly()) { @@ -3325,7 +3147,7 @@ const F32 THRESHOLD_HEAD_ROT_QDOT = 0.9997f; // ~= 2.5 degrees -- if its less const F32 MAX_HEAD_ROT_QDOT = 0.99999f; // ~= 0.5 degrees -- if its greater than this then no need to update head_rot // between these values we delay the updates (but no more than one second) -void send_agent_update(BOOL force_send, BOOL send_reliable) +void send_agent_update(bool force_send, bool send_reliable) { LL_PROFILE_ZONE_SCOPED; llassert(!gCubeSnapshot); @@ -3396,7 +3218,7 @@ void send_agent_update(BOOL force_send, BOOL send_reliable) // trigger a control event. U32 control_flags = gAgent.getControlFlags(); - MASK key_mask = gKeyboard->currentMask(TRUE); + MASK key_mask = gKeyboard->currentMask(true); if (key_mask & MASK_ALT || key_mask & MASK_CONTROL) { @@ -3970,7 +3792,7 @@ void process_preload_sound(LLMessageSystem *msg, void **user_data) if (gAgent.canAccessMaturityAtGlobal(pos_global)) { // Add audioData starts a transfer internally. - sourcep->addAudioData(datap, FALSE); + sourcep->addAudioData(datap, false); } } @@ -4085,7 +3907,7 @@ void process_sim_stats(LLMessageSystem *msg, void **user_data) LLViewerRegion* regionp = gAgent.getRegion(); if (regionp) { - BOOL was_flying = gAgent.getFlying(); + bool was_flying = gAgent.getFlying(); regionp->setRegionFlags(region_flags); regionp->setMaxTasks(max_tasks_per_region); // HACK: This makes agents drop from the sky if the region is @@ -4148,7 +3970,7 @@ void process_avatar_animation(LLMessageSystem *mesgsys, void **user_data) // See EXT-2781. if (animation_id == ANIM_AGENT_STANDUP && gAgent.getFlying()) { - gAgent.setFlying(FALSE); + gAgent.setFlying(false); } if (i < num_source_blocks) @@ -4158,9 +3980,9 @@ void process_avatar_animation(LLMessageSystem *mesgsys, void **user_data) LLViewerObject* object = gObjectList.findObject(object_id); if (object) { - object->setFlagsWithoutUpdate(FLAGS_ANIM_SOURCE, TRUE); + object->setFlagsWithoutUpdate(FLAGS_ANIM_SOURCE, true); - BOOL anim_found = FALSE; + bool anim_found = false; LLVOAvatar::AnimSourceIterator anim_it = avatarp->mAnimationSources.find(object_id); for (;anim_it != avatarp->mAnimationSources.end(); ++anim_it) { @@ -4172,7 +3994,7 @@ void process_avatar_animation(LLMessageSystem *mesgsys, void **user_data) } if (anim_it->second == animation_id) { - anim_found = TRUE; + anim_found = true; break; } } @@ -4299,7 +4121,7 @@ void process_camera_constraint(LLMessageSystem *mesgsys, void **user_data) gAgentCamera.setCameraCollidePlane(cameraCollidePlane); } -void near_sit_object(BOOL success, void *data) +void near_sit_object(bool success, void *data) { if (success) { @@ -4317,7 +4139,7 @@ void process_avatar_sit_response(LLMessageSystem *mesgsys, void **user_data) LLVector3 sitPosition; LLQuaternion sitRotation; LLUUID sitObjectID; - BOOL use_autopilot; + bool use_autopilot; mesgsys->getUUIDFast(_PREHASH_SitObject, _PREHASH_ID, sitObjectID); mesgsys->getBOOLFast(_PREHASH_SitTransform, _PREHASH_AutoPilot, use_autopilot); mesgsys->getVector3Fast(_PREHASH_SitTransform, _PREHASH_SitPosition, sitPosition); @@ -4326,7 +4148,7 @@ void process_avatar_sit_response(LLMessageSystem *mesgsys, void **user_data) mesgsys->getVector3Fast(_PREHASH_SitTransform, _PREHASH_CameraEyeOffset, camera_eye); LLVector3 camera_at; mesgsys->getVector3Fast(_PREHASH_SitTransform, _PREHASH_CameraAtOffset, camera_at); - BOOL force_mouselook; + bool force_mouselook; mesgsys->getBOOLFast(_PREHASH_SitTransform, _PREHASH_ForceMouselook, force_mouselook); if (isAgentAvatarValid() && dist_vec_squared(camera_eye, camera_at) > CAMERA_POSITION_THRESHOLD_SQUARED) @@ -4337,7 +4159,7 @@ void process_avatar_sit_response(LLMessageSystem *mesgsys, void **user_data) gAgentCamera.setForceMouselook(force_mouselook); // Forcing turning off flying here to prevent flying after pressing "Stand" // to stand up from an object. See EXT-1655. - gAgent.setFlying(FALSE); + gAgent.setFlying(false); LLViewerObject* object = gObjectList.findObject(sitObjectID); if (object) @@ -4385,7 +4207,7 @@ void process_set_follow_cam_properties(LLMessageSystem *mesgsys, void **user_dat LLViewerObject* objectp = gObjectList.findObject(source_id); if (objectp) { - objectp->setFlagsWithoutUpdate(FLAGS_CAMERA_SOURCE, TRUE); + objectp->setFlagsWithoutUpdate(FLAGS_CAMERA_SOURCE, true); } S32 num_objects = mesgsys->getNumberOfBlocks("CameraProperty"); @@ -4570,11 +4392,11 @@ void process_user_list_reply(LLMessageSystem *msg, void **user_data) if (status & 0x01) { - dialog_friends_add_friend(buffer, TRUE); + dialog_friends_add_friend(buffer, true); } else { - dialog_friends_add_friend(buffer, FALSE); + dialog_friends_add_friend(buffer, false); } } @@ -4751,12 +4573,12 @@ static void process_money_balance_reply_extended(LLMessageSystem* msg) // and agent ids for name lookup. S32 transaction_type = 0; LLUUID source_id; - BOOL is_source_group = FALSE; + bool is_source_group = false; LLUUID dest_id; - BOOL is_dest_group = FALSE; + bool is_dest_group = false; S32 amount = 0; std::string item_description; - BOOL success = FALSE; + bool success = false; msg->getS32("TransactionInfo", "TransactionType", transaction_type); msg->getUUID("TransactionInfo", "SourceID", source_id); @@ -5218,9 +5040,9 @@ bool attempt_standard_notification(LLMessageSystem* msgsystem) gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw(), - FALSE, //UI + false, //UI gSavedSettings.getBOOL("RenderHUDInSnapshot"), - FALSE, + false, LLSnapshotModel::SNAPSHOT_TYPE_COLOR, LLSnapshotModel::SNAPSHOT_FORMAT_PNG); } @@ -5323,9 +5145,9 @@ static void process_special_alert_messages(const std::string & message) gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw(), - FALSE, + false, gSavedSettings.getBOOL("RenderHUDInSnapshot"), - FALSE, + false, LLSnapshotModel::SNAPSHOT_TYPE_COLOR, LLSnapshotModel::SNAPSHOT_FORMAT_PNG); } @@ -5346,7 +5168,7 @@ void process_agent_alert_message(LLMessageSystem* msgsystem, void** user_data) if (!attempt_standard_notification(msgsystem)) { - BOOL modal = FALSE; + bool modal = false; msgsystem->getBOOL("AlertData", "Modal", modal); process_alert_core(message, modal); } @@ -5369,7 +5191,7 @@ void process_alert_message(LLMessageSystem *msgsystem, void **user_data) if (!attempt_standard_notification(msgsystem)) { - BOOL modal = FALSE; + bool modal = false; process_alert_core(message, modal); static LLCachedControl<S32> ban_lines_mode(gSavedSettings , "ShowBanLines" , LLViewerParcelMgr::PARCEL_BAN_LINES_ON_COLLISION); @@ -5404,7 +5226,7 @@ bool handle_special_alerts(const std::string &pAlertName) return isHandled; } -void process_alert_core(const std::string& message, BOOL modal) +void process_alert_core(const std::string& message, bool modal) { const std::string ALERT_PREFIX("ALERT: "); const std::string NOTIFY_PREFIX("NOTIFY: "); @@ -5528,7 +5350,7 @@ void process_mean_collision_alert_message(LLMessageSystem *msgsystem, void **use type = (EMeanCollisionType)u8type; - BOOL b_found = FALSE; + bool b_found = false; for (mean_collision_list_t::iterator iter = gMeanCollisionList.begin(); iter != gMeanCollisionList.end(); ++iter) @@ -5538,7 +5360,7 @@ void process_mean_collision_alert_message(LLMessageSystem *msgsystem, void **use { mcd->mTime = time; mcd->mMag = mag; - b_found = TRUE; + b_found = true; break; } } @@ -5562,7 +5384,7 @@ void process_frozen_message(LLMessageSystem *msgsystem, void **user_data) // make sure the cursor is back to the usual default since the // alert is probably due to some kind of error. gViewerWindow->getWindow()->resetBusyCount(); - BOOL b_frozen; + bool b_frozen; msgsystem->getBOOL("FrozenData", "Data", b_frozen); @@ -5581,7 +5403,7 @@ void process_economy_data(LLMessageSystem *msg, void** /*user_data*/) LL_DEBUGS("Benefits") << "Received economy data, not currently used" << LL_ENDL; } -void notify_cautioned_script_question(const LLSD& notification, const LLSD& response, S32 orig_questions, BOOL granted) +void notify_cautioned_script_question(const LLSD& notification, const LLSD& response, S32 orig_questions, bool granted) { // only continue if at least some permissions were requested if (orig_questions) @@ -5600,7 +5422,7 @@ void notify_cautioned_script_question(const LLSD& notification, const LLSD& resp // try to lookup viewerobject that corresponds to the object that // requested permissions (here, taskid->requesting object id) - BOOL foundpos = FALSE; + bool foundpos = false; LLViewerObject* viewobj = gObjectList.findObject(notification["payload"]["task_id"].asUUID()); if (viewobj) { @@ -5616,7 +5438,7 @@ void notify_cautioned_script_question(const LLSD& notification, const LLSD& resp std::string formatpos = llformat("%.1f, %.1f,%.1f", objpos[VX], objpos[VY], objpos[VZ]); notice.setArg("[REGIONPOS]", formatpos); - foundpos = TRUE; + foundpos = true; } } @@ -5629,7 +5451,7 @@ void notify_cautioned_script_question(const LLSD& notification, const LLSD& resp // check each permission that was requested, and list each // permission that has been flagged as a caution permission - BOOL caution = FALSE; + bool caution = false; S32 count = 0; std::string perms; for (const script_perm_t& script_perm : SCRIPT_PERMISSIONS) @@ -5638,7 +5460,7 @@ void notify_cautioned_script_question(const LLSD& notification, const LLSD& resp && script_perm.caution) { count++; - caution = TRUE; + caution = true; // add a comma before the permission description if it is not the first permission // added to the list or the last permission to check @@ -5658,7 +5480,7 @@ void notify_cautioned_script_question(const LLSD& notification, const LLSD& resp if (caution) { LLChat chat(notice.getString()); - // LLFloaterChat::addChat(chat, FALSE, FALSE); + // LLFloaterChat::addChat(chat, false, false); } } } @@ -5699,13 +5521,13 @@ bool script_question_cb(const LLSD& notification, const LLSD& response) } // check whether permissions were granted or denied - BOOL allowed = TRUE; + bool allowed = true; // the "yes/accept" button is the first button in the template, making it button 0 // if any other button was clicked, the permissions were denied if (option != 0) { new_questions = 0; - allowed = FALSE; + allowed = false; } else if(experience.notNull()) { @@ -5991,7 +5813,7 @@ void container_inventory_arrived(LLViewerObject* object, LLSaleInfo::DEFAULT, item->getFlags(), creation_date_utc); - new_item->updateServer(TRUE); + new_item->updateServer(true); gInventory.updateItem(new_item); } } @@ -6032,7 +5854,7 @@ void container_inventory_arrived(LLViewerObject* object, LLSaleInfo::DEFAULT, item->getFlags(), creation_date_utc); - new_item->updateServer(TRUE); + new_item->updateServer(true); gInventory.updateItem(new_item); gInventory.notifyObservers(); if(active_panel) @@ -6042,7 +5864,7 @@ void container_inventory_arrived(LLViewerObject* object, } // we've got the inventory, now delete this object if this was a take - BOOL delete_object = (BOOL)(intptr_t)data; + bool delete_object = (bool)(intptr_t)data; LLViewerRegion *region = gAgent.getRegion(); if (delete_object && region) { @@ -6192,7 +6014,7 @@ void process_teleport_local(LLMessageSystem *msg,void**) // after tp, keep the teleport state and let progress screen clear it after a short delay // (progress screen is active but not visible) *TODO: remove when SVC-5290 is fixed gTeleportDisplayTimer.reset(); - gTeleportDisplay = TRUE; + gTeleportDisplay = true; } else { @@ -6205,11 +6027,11 @@ void process_teleport_local(LLMessageSystem *msg,void**) // Sim tells us whether the new position is off the ground if (teleport_flags & TELEPORT_FLAGS_IS_FLYING) { - gAgent.setFlying(TRUE); + gAgent.setFlying(true); } else { - gAgent.setFlying(FALSE); + gAgent.setFlying(false); } gAgent.setPositionAgent(pos); @@ -6217,13 +6039,13 @@ void process_teleport_local(LLMessageSystem *msg,void**) if ( !(gAgent.getTeleportKeepsLookAt() && LLViewerJoystick::getInstance()->getOverrideCamera()) ) { - gAgentCamera.resetView(TRUE, TRUE); + gAgentCamera.resetView(true, true); } // send camera update to new region gAgentCamera.updateCamera(); - send_agent_update(TRUE, TRUE); + send_agent_update(true, true); // Let the interested parties know we've teleported. // Vadim *HACK: Agent position seems to get reset (to render position?) @@ -6278,8 +6100,8 @@ void send_group_notice(const LLUUID& group_id, item_def["owner_id"] = item->getPermissions().getOwner(); std::ostringstream ostr; LLSDSerialize::serialize(item_def, ostr, LLSDSerialize::LLSD_XML); - bin_bucket_size = ostr.str().copy( - (char*)bin_bucket, ostr.str().size()); + bin_bucket_size = static_cast<S32>(ostr.str().copy( + (char*)bin_bucket, ostr.str().size())); bin_bucket[bin_bucket_size] = '\0'; } else @@ -6469,7 +6291,7 @@ void send_improved_im(const LLUUID& to_id, pack_instant_message( gMessageSystem, gAgent.getID(), - FALSE, + false, gAgent.getSessionID(), to_id, name, @@ -6740,7 +6562,7 @@ void process_load_url(LLMessageSystem* msg, void**) { LLUUID object_id; LLUUID owner_id; - BOOL owner_is_group; + bool owner_is_group; char object_name[256]; /* Flawfinder: ignore */ char message[256]; /* Flawfinder: ignore */ char url[256]; /* Flawfinder: ignore */ @@ -6818,7 +6640,7 @@ void process_initiate_download(LLMessageSystem* msg, void**) sim_filename, LL_PATH_NONE, msg->getSender(), - FALSE, // don't delete remote + false, // don't delete remote callback_download_complete, (void**)new std::string(viewer_filename)); } @@ -6852,7 +6674,7 @@ void process_script_teleport_request(LLMessageSystem* msg, void**) // remove above two lines and replace with below line // to re-enable parcel browser for llMapDestination() - // LLURLDispatcher::dispatch(LLSLURL::buildSLURL(sim_name, (S32)pos.mV[VX], (S32)pos.mV[VY], (S32)pos.mV[VZ]), FALSE); + // LLURLDispatcher::dispatch(LLSLURL::buildSLURL(sim_name, (S32)pos.mV[VX], (S32)pos.mV[VY], (S32)pos.mV[VZ]), false); } @@ -6911,7 +6733,7 @@ void process_covenant_reply(LLMessageSystem* msg, void**) LLFloaterBuyLand::updateLastModified(last_modified); // load the actual covenant asset data - const BOOL high_priority = TRUE; + const bool high_priority = true; if (covenant_id.notNull()) { gAssetStorage->getEstateAsset(gAgent.getRegionHost(), diff --git a/indra/newview/llviewermessage.h b/indra/newview/llviewermessage.h index 2403e3de97..52f383faa9 100644 --- a/indra/newview/llviewermessage.h +++ b/indra/newview/llviewermessage.h @@ -62,8 +62,8 @@ enum InventoryOfferResponse IOR_SHOW }; -BOOL can_afford_transaction(S32 cost); -void give_money(const LLUUID& uuid, LLViewerRegion* region, S32 amount, BOOL is_group = FALSE, +bool can_afford_transaction(S32 cost); +void give_money(const LLUUID& uuid, LLViewerRegion* region, S32 amount, bool is_group = false, S32 trx_type = TRANS_GIFT, const std::string& desc = LLStringUtil::null); void send_join_group_response(LLUUID group_id, LLUUID transaction_id, @@ -81,7 +81,7 @@ void process_script_question(LLMessageSystem *msg, void **user_data); void process_chat_from_simulator(LLMessageSystem *mesgsys, void **user_data); //void process_agent_to_new_region(LLMessageSystem *mesgsys, void **user_data); -void send_agent_update(BOOL force_send, BOOL send_reliable = FALSE); +void send_agent_update(bool force_send, bool send_reliable = false); void process_object_update(LLMessageSystem *mesgsys, void **user_data); void process_compressed_object_update(LLMessageSystem *mesgsys, void **user_data); void process_cached_object_update(LLMessageSystem *mesgsys, void **user_data); @@ -117,7 +117,7 @@ void process_adjust_balance(LLMessageSystem* msg_system, void**); bool attempt_standard_notification(LLMessageSystem* msg); void process_alert_message(LLMessageSystem* msg, void**); void process_agent_alert_message(LLMessageSystem* msgsystem, void** user_data); -void process_alert_core(const std::string& message, BOOL modal); +void process_alert_core(const std::string& message, bool modal); // "Mean" or player-vs-player abuse typedef std::list<LLMeanCollisionData*> mean_collision_list_t; @@ -236,8 +236,8 @@ public: static std::string mResponderType; EInstantMessage mIM; LLUUID mFromID; - BOOL mFromGroup; - BOOL mFromObject; + bool mFromGroup; + bool mFromObject; LLUUID mTransactionID; LLUUID mFolderID; LLUUID mObjectID; diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 26c8483223..99a77c5551 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -107,22 +107,23 @@ #include "llmeshrepository.h" #include "llgltfmateriallist.h" #include "llgl.h" +#include "gltf/asset.h" //#define DEBUG_UPDATE_TYPE -BOOL LLViewerObject::sVelocityInterpolate = TRUE; -BOOL LLViewerObject::sPingInterpolate = TRUE; +bool LLViewerObject::sVelocityInterpolate = true; +bool LLViewerObject::sPingInterpolate = true; U32 LLViewerObject::sNumZombieObjects = 0; S32 LLViewerObject::sNumObjects = 0; -BOOL LLViewerObject::sMapDebug = TRUE; +bool LLViewerObject::sMapDebug = true; LLColor4 LLViewerObject::sEditSelectColor( 1.0f, 1.f, 0.f, 0.3f); // Edit OK LLColor4 LLViewerObject::sNoEditSelectColor( 1.0f, 0.f, 0.f, 0.3f); // Can't edit S32 LLViewerObject::sAxisArrowLength(50); -BOOL LLViewerObject::sPulseEnabled(FALSE); -BOOL LLViewerObject::sUseSharedDrawables(FALSE); // TRUE +bool LLViewerObject::sPulseEnabled(false); +bool LLViewerObject::sUseSharedDrawables(false); // true // sMaxUpdateInterpolationTime must be greater than sPhaseOutUpdateInterpolationTime F64Seconds LLViewerObject::sMaxUpdateInterpolationTime(3.0); // For motion interpolation: after X seconds with no updates, don't predict object motion @@ -246,7 +247,7 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco return res; } -LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp, BOOL is_global) +LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp, bool is_global) : LLPrimitive(), mChildList(), mID(id), @@ -256,7 +257,7 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe mTEImages(NULL), mTENormalMaps(NULL), mTESpecularMaps(NULL), - mbCanSelect(TRUE), + mbCanSelect(true), mFlags(0), mPhysicsShapeType(0), mPhysicsGravity(0), @@ -264,8 +265,8 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe mPhysicsDensity(0), mPhysicsRestitution(0), mDrawable(), - mCreateSelected(FALSE), - mRenderMedia(FALSE), + mCreateSelected(false), + mRenderMedia(false), mBestUpdatePrecision(0), mText(), mHudText(""), @@ -286,14 +287,14 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe mExpectedInventorySerialNum(0), mInvRequestState(INVENTORY_REQUEST_STOPPED), mInvRequestXFerId(0), - mInventoryDirty(FALSE), + mInventoryDirty(false), mRegionp(regionp), - mDead(FALSE), - mOrphaned(FALSE), - mUserSelected(FALSE), - mOnActiveList(FALSE), - mOnMap(FALSE), - mStatic(FALSE), + mDead(false), + mOrphaned(false), + mUserSelected(false), + mOnActiveList(false), + mOnMap(false), + mStatic(false), mSeatCount(0), mNumFaces(0), mRotTime(0.f), @@ -310,7 +311,7 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe mPhysicsShapeUnknown(true), mAttachmentItemID(LLUUID::null), mLastUpdateType(OUT_UNKNOWN), - mLastUpdateCached(FALSE), + mLastUpdateCached(false), mCachedMuteListUpdateTime(0), mCachedOwnerInMuteList(false), mRiggedAttachedWarned(false) @@ -447,7 +448,7 @@ void LLViewerObject::markDead() } // Mark itself as dead - mDead = TRUE; + mDead = true; if(mRegionp) { mRegionp->removeFromCreatedList(getLocalID()); @@ -751,7 +752,7 @@ void LLViewerObject::setNameValueList(const std::string& name_value_list) } } -BOOL LLViewerObject::isAnySelected() const +bool LLViewerObject::isAnySelected() const { bool any_selected = isSelected(); for (child_list_t::const_iterator iter = mChildList.begin(); @@ -763,7 +764,7 @@ BOOL LLViewerObject::isAnySelected() const return any_selected; } -void LLViewerObject::setSelected(BOOL sel) +void LLViewerObject::setSelected(bool sel) { mUserSelected = sel; resetRot(); @@ -900,12 +901,12 @@ bool LLViewerObject::crossesParcelBounds() return mRegionp && mRegionp->objectsCrossParcel(boxes); } -BOOL LLViewerObject::setParent(LLViewerObject* parent) +bool LLViewerObject::setParent(LLViewerObject* parent) { if(mParent != parent) { LLViewerObject* old_parent = (LLViewerObject*)mParent ; - BOOL ret = LLPrimitive::setParent(parent); + bool ret = LLPrimitive::setParent(parent); if(ret && old_parent && parent) { old_parent->removeChild(this) ; @@ -913,7 +914,7 @@ BOOL LLViewerObject::setParent(LLViewerObject* parent) return ret ; } - return FALSE ; + return false ; } void LLViewerObject::addChild(LLViewerObject *childp) @@ -981,7 +982,7 @@ void LLViewerObject::removeChild(LLViewerObject *childp) if (childp->isSelected()) { LLSelectMgr::getInstance()->deselectObjectAndFamily(childp); - BOOL add_to_end = TRUE; + bool add_to_end = true; LLSelectMgr::getInstance()->selectObjectAndFamily(childp, add_to_end); } } @@ -1019,35 +1020,35 @@ void LLViewerObject::addThisAndNonJointChildren(std::vector<LLViewerObject*>& ob } } -BOOL LLViewerObject::isChild(LLViewerObject *childp) const +bool LLViewerObject::isChild(LLViewerObject *childp) const { for (child_list_t::const_iterator iter = mChildList.begin(); iter != mChildList.end(); iter++) { LLViewerObject* testchild = *iter; if (testchild == childp) - return TRUE; + return true; } - return FALSE; + return false; } -// returns TRUE if at least one avatar is sitting on this object -BOOL LLViewerObject::isSeat() const +// returns true if at least one avatar is sitting on this object +bool LLViewerObject::isSeat() const { return mSeatCount > 0; } -BOOL LLViewerObject::setDrawableParent(LLDrawable* parentp) +bool LLViewerObject::setDrawableParent(LLDrawable* parentp) { if (mDrawable.isNull()) { - return FALSE; + return false; } - BOOL ret = mDrawable->mXform.setParent(parentp ? &parentp->mXform : NULL); + bool ret = mDrawable->mXform.setParent(parentp ? &parentp->mXform : NULL); if(!ret) { - return FALSE ; + return false ; } LLDrawable* old_parent = mDrawable->mParent; mDrawable->mParent = parentp; @@ -1063,11 +1064,11 @@ BOOL LLViewerObject::setDrawableParent(LLDrawable* parentp) || (parentp && parentp->isActive())) { // *TODO we should not be relying on setDrawable parent to call markMoved - gPipeline.markMoved(mDrawable, FALSE); + gPipeline.markMoved(mDrawable, false); } else if (!mDrawable->isAvatar()) { - mDrawable->updateXform(TRUE); + mDrawable->updateXform(true); /*if (!mDrawable->getSpatialGroup()) { mDrawable->movePartition(); @@ -1078,7 +1079,7 @@ BOOL LLViewerObject::setDrawableParent(LLDrawable* parentp) } // Show or hide particles, icon and HUD -void LLViewerObject::hideExtraDisplayItems( BOOL hidden ) +void LLViewerObject::hideExtraDisplayItems( bool hidden ) { if( mPartSourcep.notNull() ) { @@ -1108,7 +1109,7 @@ U32 LLViewerObject::checkMediaURL(const std::string &media_url) mMedia = new LLViewerObjectMedia; mMedia->mMediaURL = media_url; mMedia->mMediaType = LLViewerObject::MEDIA_SET; - mMedia->mPassedWhitelist = FALSE; + mMedia->mPassedWhitelist = false; } else if (mMedia) { @@ -1130,7 +1131,7 @@ U32 LLViewerObject::checkMediaURL(const std::string &media_url) retval |= MEDIA_URL_UPDATED; } mMedia->mMediaURL = media_url; - mMedia->mPassedWhitelist = FALSE; + mMedia->mPassedWhitelist = false; } } return retval; @@ -1166,6 +1167,20 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, LL_DEBUGS("ObjectUpdate") << " mesgsys " << mesgsys << " dp " << dp << " id " << getID() << " update_type " << (S32) update_type << LL_ENDL; dumpStack("ObjectUpdateStack"); + // The new OBJECTDATA_FIELD_SIZE_124, OBJECTDATA_FIELD_SIZE_140, OBJECTDATA_FIELD_SIZE_80 + // and OBJECTDATA_FIELD_SIZE_64 lengths should be supported in the existing cases below. + // Each case should start at the beginning of the buffer and extract all known + // values, and ignore any unknown data at the end of the buffer. + // This allows new data in the future without breaking current viewers. + const S32 OBJECTDATA_FIELD_SIZE_140 = 140; // Full precision avatar update for future extended data + const S32 OBJECTDATA_FIELD_SIZE_124 = 124; // Full precision object update for future extended data + const S32 OBJECTDATA_FIELD_SIZE_76 = 76; // Full precision avatar update + const S32 OBJECTDATA_FIELD_SIZE_60 = 60; // Full precision object update + const S32 OBJECTDATA_FIELD_SIZE_80 = 80; // Terse avatar update, 16 bit precision for future extended data + const S32 OBJECTDATA_FIELD_SIZE_64 = 64; // Terse object update, 16 bit precision for future extended data + const S32 OBJECTDATA_FIELD_SIZE_48 = 48; // Terse avatar update, 16 bit precision + const S32 OBJECTDATA_FIELD_SIZE_32 = 32; // Terse object update, 16 bit precision + U32 retval = 0x0; // If region is removed from the list it is also deleted. @@ -1213,7 +1228,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, U32 x, y; from_region_handle(region_handle, &x, &y); - LL_ERRS() << "Object has invalid region " << x << ":" << y << "!" << LL_ENDL; + LL_WARNS("UpdateFail") << "Object has invalid region " << x << ":" << y << "!" << LL_ENDL; return retval; } @@ -1240,8 +1255,8 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, const F32 size = LLWorld::getInstance()->getRegionWidthInMeters(); const F32 MAX_HEIGHT = LLWorld::getInstance()->getRegionMaxHeight(); const F32 MIN_HEIGHT = LLWorld::getInstance()->getRegionMinHeight(); - S32 length; - S32 count; + S32 length = 0; + S32 count = 0; S32 this_update_precision = 32; // in bits // Temporaries, because we need to compare w/ previous to set dirty flags... @@ -1302,6 +1317,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, mesgsys->getVector3Fast(_PREHASH_ObjectData, _PREHASH_Scale, new_scale, block_num ); length = mesgsys->getSizeFast(_PREHASH_ObjectData, block_num, _PREHASH_ObjectData); mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_ObjectData, data, length, block_num, MAX_OBJECT_BINARY_DATA_SIZE); + length = llmin(length, MAX_OBJECT_BINARY_DATA_SIZE); // getBinaryDataFast() safely fills the buffer to max_size mTotalCRC = crc; // Might need to update mSourceMuted here to properly pick up new radius @@ -1316,7 +1332,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, setMaterial(material); if (mDrawable.notNull()) { - gPipeline.markMoved(mDrawable, FALSE); // undamped + gPipeline.markMoved(mDrawable, false); // undamped } } setClickAction(click_action); @@ -1326,15 +1342,17 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, switch(length) { - case (60 + 16): + case OBJECTDATA_FIELD_SIZE_140: + case OBJECTDATA_FIELD_SIZE_76: // pull out collision normal for avatar htolememcpy(collision_plane.mV, &data[count], MVT_LLVector4, sizeof(LLVector4)); ((LLVOAvatar*)this)->setFootPlane(collision_plane); count += sizeof(LLVector4); - // fall through - case 60: + + case OBJECTDATA_FIELD_SIZE_124: + case OBJECTDATA_FIELD_SIZE_60: this_update_precision = 32; - // this is a terse update + // this is a full precision update // pos htolememcpy(new_pos_parent.mV, &data[count], MVT_LLVector3, sizeof(LLVector3)); count += sizeof(LLVector3); @@ -1359,117 +1377,21 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, resetRot(); } setAngularVelocity(new_angv); + count += sizeof(LLVector3); #if LL_DARWIN - if (length == 76) + if (length == OBJECTDATA_FIELD_SIZE_76 || + length == OBJECTDATA_FIELD_SIZE_140) { setAngularVelocity(LLVector3::zero); } #endif break; - case(32 + 16): - // pull out collision normal for avatar - htolememcpy(collision_plane.mV, &data[count], MVT_LLVector4, sizeof(LLVector4)); - ((LLVOAvatar*)this)->setFootPlane(collision_plane); - count += sizeof(LLVector4); - // fall through - case 32: - this_update_precision = 16; - test_pos_parent.quantize16(-0.5f*size, 1.5f*size, MIN_HEIGHT, MAX_HEIGHT); - - // This is a terse 16 update, so treat data as an array of U16's. -#ifdef LL_BIG_ENDIAN - htolememcpy(valswizzle, &data[count], MVT_U16Vec3, 6); - val = valswizzle; -#else - val = (U16 *) &data[count]; -#endif - count += sizeof(U16)*3; - new_pos_parent.mV[VX] = U16_to_F32(val[VX], -0.5f*size, 1.5f*size); - new_pos_parent.mV[VY] = U16_to_F32(val[VY], -0.5f*size, 1.5f*size); - new_pos_parent.mV[VZ] = U16_to_F32(val[VZ], MIN_HEIGHT, MAX_HEIGHT); - -#ifdef LL_BIG_ENDIAN - htolememcpy(valswizzle, &data[count], MVT_U16Vec3, 6); - val = valswizzle; -#else - val = (U16 *) &data[count]; -#endif - count += sizeof(U16)*3; - setVelocity(LLVector3(U16_to_F32(val[VX], -size, size), - U16_to_F32(val[VY], -size, size), - U16_to_F32(val[VZ], -size, size))); - -#ifdef LL_BIG_ENDIAN - htolememcpy(valswizzle, &data[count], MVT_U16Vec3, 6); - val = valswizzle; -#else - val = (U16 *) &data[count]; -#endif - count += sizeof(U16)*3; - setAcceleration(LLVector3(U16_to_F32(val[VX], -size, size), - U16_to_F32(val[VY], -size, size), - U16_to_F32(val[VZ], -size, size))); - -#ifdef LL_BIG_ENDIAN - htolememcpy(valswizzle, &data[count], MVT_U16Quat, 4); - val = valswizzle; -#else - val = (U16 *) &data[count]; -#endif - count += sizeof(U16)*4; - new_rot.mQ[VX] = U16_to_F32(val[VX], -1.f, 1.f); - new_rot.mQ[VY] = U16_to_F32(val[VY], -1.f, 1.f); - new_rot.mQ[VZ] = U16_to_F32(val[VZ], -1.f, 1.f); - new_rot.mQ[VW] = U16_to_F32(val[VW], -1.f, 1.f); - -#ifdef LL_BIG_ENDIAN - htolememcpy(valswizzle, &data[count], MVT_U16Vec3, 6); - val = valswizzle; -#else - val = (U16 *) &data[count]; -#endif - new_angv.setVec(U16_to_F32(val[VX], -size, size), - U16_to_F32(val[VY], -size, size), - U16_to_F32(val[VZ], -size, size)); - if (new_angv.isExactlyZero()) - { - // reset rotation time - resetRot(); - } - setAngularVelocity(new_angv); - break; - case 16: - this_update_precision = 8; - test_pos_parent.quantize8(-0.5f*size, 1.5f*size, MIN_HEIGHT, MAX_HEIGHT); - // this is a terse 8 update - new_pos_parent.mV[VX] = U8_to_F32(data[0], -0.5f*size, 1.5f*size); - new_pos_parent.mV[VY] = U8_to_F32(data[1], -0.5f*size, 1.5f*size); - new_pos_parent.mV[VZ] = U8_to_F32(data[2], MIN_HEIGHT, MAX_HEIGHT); - - setVelocity(U8_to_F32(data[3], -size, size), - U8_to_F32(data[4], -size, size), - U8_to_F32(data[5], -size, size) ); - - setAcceleration(U8_to_F32(data[6], -size, size), - U8_to_F32(data[7], -size, size), - U8_to_F32(data[8], -size, size) ); - - new_rot.mQ[VX] = U8_to_F32(data[9], -1.f, 1.f); - new_rot.mQ[VY] = U8_to_F32(data[10], -1.f, 1.f); - new_rot.mQ[VZ] = U8_to_F32(data[11], -1.f, 1.f); - new_rot.mQ[VW] = U8_to_F32(data[12], -1.f, 1.f); - - new_angv.setVec(U8_to_F32(data[13], -size, size), - U8_to_F32(data[14], -size, size), - U8_to_F32(data[15], -size, size) ); - if (new_angv.isExactlyZero()) - { - // reset rotation time - resetRot(); - } - setAngularVelocity(new_angv); - break; + // length values 48, 32 and 16 were once in viewer code but + // are never sent by the SL simulator + default: + LL_WARNS("UpdateFail") << "Unexpected ObjectData buffer size " << length + << " for " << getID() << " with OUT_FULL message" << LL_ENDL; } //////////////////////////////////////////////////// @@ -1503,19 +1425,44 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, if (mData) { delete [] mData; + mData = NULL; } + // Dec 2023 new generic data: + // Trees work as before, this field contains genome data + // Not a tree: root objects send 1 byte with the number of + // total prims in the linkset + // If the generic data size is zero, then number of prims is 1 + // + // Viewers should not check for specific data sizes exactly, but if + // the field has data, process it from the start and ignore the remainder. + // Check for appended generic data + const S32 GENERIC_DATA_BUFFER_SIZE = 16; S32 data_size = mesgsys->getSizeFast(_PREHASH_ObjectData, block_num, _PREHASH_Data); - if (data_size <= 0) - { - mData = NULL; - } - else - { - // ...has generic data - mData = new U8[data_size]; - mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_Data, mData, data_size, block_num); + if (data_size > 0) + { // has generic data + if (getPCode() == LL_PCODE_LEGACY_TREE || getPCode() == LL_PCODE_TREE_NEW) + { + mData = new U8[data_size]; + mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_Data, mData, data_size, block_num); + LL_DEBUGS("NewObjectData") << "Read " << data_size << " bytes tree genome data for " << getID() << ", pcode " + << getPCodeString() << ", value " << (S32) mData[0] << LL_ENDL; + } + else + { // Extract number of prims + U8 generic_data[GENERIC_DATA_BUFFER_SIZE]; + mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_Data, + &generic_data[0], llmin(data_size, GENERIC_DATA_BUFFER_SIZE), block_num); + // This is sample code to extract the number of prims + // Future viewers should use it for their own purposes + if (!isAvatar()) + { + S32 num_prims = (S32) generic_data[0]; + LL_DEBUGS("NewObjectData") << "Root prim " << getID() << " has " + << num_prims << " prims in linkset" << LL_ENDL; + } + } } S32 text_size = mesgsys->getSizeFast(_PREHASH_ObjectData, block_num, _PREHASH_Text); @@ -1567,7 +1514,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, std::unordered_map<U16, ExtraParameter*>::iterator iter; for (iter = mExtraParameterList.begin(); iter != mExtraParameterList.end(); ++iter) { - iter->second->in_use = FALSE; + iter->second->in_use = false; } // Unpack extra parameters @@ -1599,7 +1546,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, if (!iter->second->in_use) { // Send an update message in case it was formerly in use - parameterChanged(iter->first, iter->second->data, FALSE, false); + parameterChanged(iter->first, iter->second->data, false, false); } } @@ -1613,59 +1560,22 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, #endif length = mesgsys->getSizeFast(_PREHASH_ObjectData, block_num, _PREHASH_ObjectData); mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_ObjectData, data, length, block_num, MAX_OBJECT_BINARY_DATA_SIZE); - count = 0; + length = llmin(length, MAX_OBJECT_BINARY_DATA_SIZE); // getBinaryDataFast() safely fills the buffer to max_size + count = 0; LLVector4 collision_plane; switch(length) { - case(60 + 16): + case OBJECTDATA_FIELD_SIZE_80: + case OBJECTDATA_FIELD_SIZE_48: // pull out collision normal for avatar htolememcpy(collision_plane.mV, &data[count], MVT_LLVector4, sizeof(LLVector4)); ((LLVOAvatar*)this)->setFootPlane(collision_plane); count += sizeof(LLVector4); - // fall through - case 60: - // this is a terse 32 update - // pos - this_update_precision = 32; - htolememcpy(new_pos_parent.mV, &data[count], MVT_LLVector3, sizeof(LLVector3)); - count += sizeof(LLVector3); - // vel - htolememcpy((void*)getVelocity().mV, &data[count], MVT_LLVector3, sizeof(LLVector3)); - count += sizeof(LLVector3); - // acc - htolememcpy((void*)getAcceleration().mV, &data[count], MVT_LLVector3, sizeof(LLVector3)); - count += sizeof(LLVector3); - // theta - { - LLVector3 vec; - htolememcpy(vec.mV, &data[count], MVT_LLVector3, sizeof(LLVector3)); - new_rot.unpackFromVector3(vec); - } - count += sizeof(LLVector3); - // omega - htolememcpy((void*)new_angv.mV, &data[count], MVT_LLVector3, sizeof(LLVector3)); - if (new_angv.isExactlyZero()) - { - // reset rotation time - resetRot(); - } - setAngularVelocity(new_angv); -#if LL_DARWIN - if (length == 76) - { - setAngularVelocity(LLVector3::zero); - } -#endif - break; - case(32 + 16): - // pull out collision normal for avatar - htolememcpy(collision_plane.mV, &data[count], MVT_LLVector4, sizeof(LLVector4)); - ((LLVOAvatar*)this)->setFootPlane(collision_plane); - count += sizeof(LLVector4); - // fall through - case 32: - // this is a terse 16 update + + case OBJECTDATA_FIELD_SIZE_64: + case OBJECTDATA_FIELD_SIZE_32: + // this is a terse 16 bit quantized update this_update_precision = 16; test_pos_parent.quantize16(-0.5f*size, 1.5f*size, MIN_HEIGHT, MAX_HEIGHT); @@ -1726,32 +1636,13 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, setAngularVelocity(new_angv); break; - case 16: - // this is a terse 8 update - this_update_precision = 8; - test_pos_parent.quantize8(-0.5f*size, 1.5f*size, MIN_HEIGHT, MAX_HEIGHT); - new_pos_parent.mV[VX] = U8_to_F32(data[0], -0.5f*size, 1.5f*size); - new_pos_parent.mV[VY] = U8_to_F32(data[1], -0.5f*size, 1.5f*size); - new_pos_parent.mV[VZ] = U8_to_F32(data[2], MIN_HEIGHT, MAX_HEIGHT); - - setVelocity(U8_to_F32(data[3], -size, size), - U8_to_F32(data[4], -size, size), - U8_to_F32(data[5], -size, size) ); - - setAcceleration(U8_to_F32(data[6], -size, size), - U8_to_F32(data[7], -size, size), - U8_to_F32(data[8], -size, size) ); - - new_rot.mQ[VX] = U8_to_F32(data[9], -1.f, 1.f); - new_rot.mQ[VY] = U8_to_F32(data[10], -1.f, 1.f); - new_rot.mQ[VZ] = U8_to_F32(data[11], -1.f, 1.f); - new_rot.mQ[VW] = U8_to_F32(data[12], -1.f, 1.f); - - new_angv.set(U8_to_F32(data[13], -size, size), - U8_to_F32(data[14], -size, size), - U8_to_F32(data[15], -size, size) ); - setAngularVelocity(new_angv); - break; + // Previous viewers had code for length 76, 60 or 16 byte length + // with full precision or 8 bit quanitzation, but the + // SL servers will never send those data formats. If you ever see this + // warning in Second Life, please file a bug report + default: + LL_WARNS("UpdateFail") << "Unexpected ObjectData buffer size " << length << " for " << getID() + << " with OUT_FULL message" << LL_ENDL; } U8 state; @@ -1761,13 +1652,13 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, } default: + LL_WARNS("UpdateFail") << "Unknown uncompressed update type " << update_type << " for " << getID() << LL_ENDL; break; - } } else { - // handle the compressed case + // handle the compressed case - have dp datapacker LLUUID sound_uuid; LLUUID owner_id; F32 gain = 0; @@ -1850,7 +1741,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, setMaterial(material); if (mDrawable.notNull()) { - gPipeline.markMoved(mDrawable, FALSE); // undamped + gPipeline.markMoved(mDrawable, false); // undamped } } dp->unpackU8(click_action, "ClickAction"); @@ -1960,7 +1851,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, std::unordered_map<U16, ExtraParameter*>::iterator iter; for (iter = mExtraParameterList.begin(); iter != mExtraParameterList.end(); ++iter) { - iter->second->in_use = FALSE; + iter->second->in_use = false; } // Unpack extra params @@ -1983,7 +1874,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, if (!iter->second->in_use) { // Send an update message in case it was formerly in use - parameterChanged(iter->first, iter->second->data, FALSE, false); + parameterChanged(iter->first, iter->second->data, false, false); } } @@ -2022,6 +1913,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, break; default: + LL_WARNS("UpdateFail") << "Unknown compressed update type " << update_type << " for " << getID() << LL_ENDL; break; } } @@ -2029,7 +1921,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // // Fix object parenting. // - BOOL b_changed_status = FALSE; + bool b_changed_status = false; if (OUT_TERSE_IMPROVED != update_type) { @@ -2069,7 +1961,8 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, if (sent_parentp && sent_parentp->getParent() == this) { // Try to recover if we attempt to attach a parent to its child - LL_WARNS() << "Attempt to attach a parent to it's child: " << this->getID() << " to " << sent_parentp->getID() << LL_ENDL; + LL_WARNS("UpdateFail") << "Attempt to attach a parent to it's child: " << this->getID() << " to " + << sent_parentp->getID() << LL_ENDL; this->removeChild(sent_parentp); sent_parentp->setDrawableParent(NULL); } @@ -2087,13 +1980,13 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // // new parent is valid - b_changed_status = TRUE; + b_changed_status = true; // ...no current parent, so don't try to remove child if (mDrawable.notNull()) { if (mDrawable->isDead() || !mDrawable->getVObj()) { - LL_WARNS() << "Drawable is dead or no VObj!" << LL_ENDL; + LL_WARNS("UpdateFail") << "Drawable is dead or no VObj!" << LL_ENDL; sent_parentp->addChild(this); } else @@ -2103,9 +1996,9 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // Bad, we got a cycle somehow. // Kill both the parent and the child, and // set cache misses for both of them. - LL_WARNS() << "Attempting to recover from parenting cycle!" << LL_ENDL; - LL_WARNS() << "Killing " << sent_parentp->getID() << " and " << getID() << LL_ENDL; - LL_WARNS() << "Adding to cache miss list" << LL_ENDL; + LL_WARNS("UpdateFail") << "Attempting to recover from parenting cycle! " + << "Killing " << sent_parentp->getID() << " and " << getID() + << ", Adding to cache miss list" << LL_ENDL; setParent(NULL); sent_parentp->setParent(NULL); getRegion()->addCacheMissFull(getLocalID()); @@ -2118,7 +2011,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // make sure this object gets a non-damped update if (sent_parentp->mDrawable.notNull()) { - gPipeline.markMoved(sent_parentp->mDrawable, FALSE); // undamped + gPipeline.markMoved(sent_parentp->mDrawable, false); // undamped } } } @@ -2128,7 +2021,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, } // Show particles, icon and HUD - hideExtraDisplayItems( FALSE ); + hideExtraDisplayItems( false ); setChanged(MOVED | SILHOUETTE); } @@ -2155,7 +2048,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, gObjectList.orphanize(this, parent_id, ip, port); // Hide particles, icon and HUD - hideExtraDisplayItems( TRUE ); + hideExtraDisplayItems( true ); } } } @@ -2246,7 +2139,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, if (sent_parentp && sent_parentp != cur_parentp && sent_parentp != this) { // New parent is valid, detach and reattach - b_changed_status = TRUE; + b_changed_status = true; if (mDrawable.notNull()) { if (!setDrawableParent(sent_parentp->mDrawable)) // LLViewerObject::processUpdateMessage 2 @@ -2273,7 +2166,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, sent_parentp->setChanged(MOVED | SILHOUETTE); if (sent_parentp->mDrawable.notNull()) { - gPipeline.markMoved(sent_parentp->mDrawable, FALSE); // undamped + gPipeline.markMoved(sent_parentp->mDrawable, false); // undamped } } else if (!sent_parentp) @@ -2295,7 +2188,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, if (remove_parent) { - b_changed_status = TRUE; + b_changed_status = true; if (mDrawable.notNull()) { // clear parent to removeChild can put the drawable on the damped list @@ -2309,7 +2202,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, if (mDrawable.notNull()) { // make sure this object gets a non-damped update - gPipeline.markMoved(mDrawable, FALSE); // undamped + gPipeline.markMoved(mDrawable, false); // undamped } } } @@ -2458,11 +2351,11 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, (MAG_CUTOFF >= accel_mag_sq) && (MAG_CUTOFF >= getAngularVelocity().magVecSquared())) { - mStatic = TRUE; // This object doesn't move! + mStatic = true; // This object doesn't move! } else { - mStatic = FALSE; + mStatic = false; } // BUG: This code leads to problems during group rotate and any scale operation. @@ -2477,7 +2370,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // // Additionally, if any child is selected, need to update the dialogs and selection // center. - BOOL needs_refresh = mUserSelected; + bool needs_refresh = mUserSelected; for (child_list_t::iterator iter = mChildList.begin(); iter != mChildList.end(); iter++) { @@ -2485,7 +2378,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, needs_refresh = needs_refresh || child->mUserSelected; } - static LLCachedControl<bool> allow_select_avatar(gSavedSettings, "AllowSelectAvatar", FALSE); + static LLCachedControl<bool> allow_select_avatar(gSavedSettings, "AllowSelectAvatar", false); if (needs_refresh) { LLSelectMgr::getInstance()->updateSelectionCenter(); @@ -2529,9 +2422,9 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, return retval; } -BOOL LLViewerObject::isActive() const +bool LLViewerObject::isActive() const { - return TRUE; + return true; } //load flags from cache or from message @@ -2574,7 +2467,7 @@ void LLViewerObject::idleUpdate(LLAgent &agent, const F64 &frame_time) } } - updateDrawable(FALSE); + updateDrawable(false); } } @@ -2760,22 +2653,6 @@ void LLViewerObject::interpolateLinearMotion(const F64SecondsImplicit& frame_tim -BOOL LLViewerObject::setData(const U8 *datap, const U32 data_size) -{ - delete [] mData; - - if (datap) - { - mData = new U8[data_size]; - if (!mData) - { - return FALSE; - } - memcpy(mData, datap, data_size); /* Flawfinder: ignore */ - } - return TRUE; -} - // delete an item in the inventory, but don't tell the server. This is // used internally by remove, update, and savescript. // This will only delete the first item with an item_id in the list @@ -2815,7 +2692,7 @@ void LLViewerObject::doUpdateInventory( LLUUID item_id; LLUUID new_owner; LLUUID new_group; - BOOL group_owned = FALSE; + bool group_owned = false; if(old_item) { item_id = old_item->getUUID(); @@ -2837,7 +2714,7 @@ void LLViewerObject::doUpdateInventory( deleteInventoryItem(item_id); LLPermissions perm(item->getPermissions()); LLPermissions* obj_perm = LLSelectMgr::getInstance()->findObjectPermissions(this); - bool is_atomic = ((S32)LLAssetType::AT_OBJECT == item->getType()) ? false : true; + bool is_atomic = (S32)LLAssetType::AT_OBJECT != item->getType(); if(obj_perm) { perm.setOwnerAndGroup(LLUUID::null, obj_perm->getOwner(), obj_perm->getGroup(), is_atomic); @@ -2887,7 +2764,7 @@ void LLViewerObject::doUpdateInventory( // of the new and old script AFTER the bytecode has been saved. void LLViewerObject::saveScript( const LLViewerInventoryItem* item, - BOOL active, + bool active, bool is_new) { /* @@ -2961,7 +2838,7 @@ void LLViewerObject::dirtyInventory() delete mInventory; mInventory = NULL; } - mInventoryDirty = TRUE; + mInventoryDirty = true; } void LLViewerObject::registerInventoryListener(LLVOInventoryListener* listener, void* user_data) @@ -2990,7 +2867,7 @@ void LLViewerObject::removeInventoryListener(LLVOInventoryListener* listener) } } -BOOL LLViewerObject::isInventoryPending() +bool LLViewerObject::isInventoryPending() { return mInvRequestState != INVENTORY_REQUEST_STOPPED; } @@ -3024,7 +2901,7 @@ void LLViewerObject::requestInventory() else { // since we are going to request it now - mInventoryDirty = FALSE; + mInventoryDirty = false; // Note: throws away duplicate requests fetchInventoryFromServer(); @@ -3419,7 +3296,7 @@ void LLViewerObject::processTaskInv(LLMessageSystem* msg, void** user_data) U64 new_id = gXferManager->requestFile(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ft->mFilename), ft->mFilename, LL_PATH_CACHE, object->mRegionp->getHost(), - TRUE, + true, &LLViewerObject::processTaskInvFile, (void**)ft, // This takes ownership of ft LLXferManager::HIGH_PRIORITY); @@ -3496,7 +3373,7 @@ void LLViewerObject::processTaskInvFile(void** user_data, S32 error_code, LLExtS delete ft; } -BOOL LLViewerObject::loadTaskInvFile(const std::string& filename) +bool LLViewerObject::loadTaskInvFile(const std::string& filename) { std::string filename_and_local_path = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, filename); llifstream ifs(filename_and_local_path.c_str()); @@ -3558,11 +3435,11 @@ BOOL LLViewerObject::loadTaskInvFile(const std::string& filename) { LL_WARNS() << "unable to load task inventory: " << filename_and_local_path << LL_ENDL; - return FALSE; + return false; } doInventoryCallback(); - return TRUE; + return true; } void LLViewerObject::loadTaskInvLLSD(const LLSD& inv_result) @@ -3930,14 +3807,14 @@ void LLViewerObject::setPixelAreaAndAngle(LLAgent &agent) } } -BOOL LLViewerObject::updateLOD() +bool LLViewerObject::updateLOD() { - return FALSE; + return false; } -BOOL LLViewerObject::updateGeometry(LLDrawable *drawable) +bool LLViewerObject::updateGeometry(LLDrawable *drawable) { - return TRUE; + return true; } void LLViewerObject::updateGL() @@ -3955,7 +3832,7 @@ LLDrawable* LLViewerObject::createDrawable(LLPipeline *pipeline) return NULL; } -void LLViewerObject::setScale(const LLVector3 &scale, BOOL damped) +void LLViewerObject::setScale(const LLVector3 &scale, bool damped) { LLPrimitive::setScale(scale); if (mDrawable.notNull()) @@ -3975,7 +3852,7 @@ void LLViewerObject::setScale(const LLVector3 &scale, BOOL damped) llassert_always(LLWorld::getInstance()->getRegionFromHandle(getRegion()->getHandle())); gObjectList.addToMap(this); - mOnMap = TRUE; + mOnMap = true; } } else @@ -3983,7 +3860,7 @@ void LLViewerObject::setScale(const LLVector3 &scale, BOOL damped) if (mOnMap) { gObjectList.removeFromMap(this); - mOnMap = FALSE; + mOnMap = false; } } } @@ -4015,7 +3892,7 @@ void LLViewerObject::setLinksetCost(F32 cost) mLinksetCost = cost; mCostStale = false; - BOOL needs_refresh = isSelected(); + bool needs_refresh = isSelected(); child_list_t::iterator iter = mChildList.begin(); while(iter != mChildList.end() && !needs_refresh) { @@ -4111,15 +3988,15 @@ F32 LLViewerObject::recursiveGetEstTrianglesMax() const S32 LLViewerObject::getAnimatedObjectMaxTris() const { S32 max_tris = 0; - if (gAgent.getRegion()) - { - LLSD features; - gAgent.getRegion()->getSimulatorFeatures(features); - if (features.has("AnimatedObjects")) + if (gAgent.getRegion()) { - max_tris = features["AnimatedObjects"]["AnimatedObjectMaxTris"].asInteger(); + LLSD features; + gAgent.getRegion()->getSimulatorFeatures(features); + if (features.has("AnimatedObjects")) + { + max_tris = features["AnimatedObjects"]["AnimatedObjectMaxTris"].asInteger(); + } } - } return max_tris; } @@ -4280,7 +4157,7 @@ void LLViewerObject::updateTextures() { } -void LLViewerObject::boostTexturePriority(BOOL boost_children /* = TRUE */) +void LLViewerObject::boostTexturePriority(bool boost_children /* = true */) { if (isDead() || !getVolume()) { @@ -4298,7 +4175,7 @@ void LLViewerObject::boostTexturePriority(BOOL boost_children /* = TRUE */) { LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT); LLUUID sculpt_id = sculpt_params->getSculptTexture(); - LLViewerTextureManager::getFetchedTexture(sculpt_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)->setBoostLevel(LLGLTexture::BOOST_SELECTED); + LLViewerTextureManager::getFetchedTexture(sculpt_id, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)->setBoostLevel(LLGLTexture::BOOST_SELECTED); } if (boost_children) @@ -4391,7 +4268,7 @@ void LLViewerObject::addNVPair(const std::string& data) mNameValuePairs[nv->mName] = nv; } -BOOL LLViewerObject::removeNVPair(const std::string& name) +bool LLViewerObject::removeNVPair(const std::string& name) { char* canonical_name = gNVNameTable.addString(name); @@ -4417,14 +4294,14 @@ BOOL LLViewerObject::removeNVPair(const std::string& name) // Remove the NV pair from the local list. delete nv; mNameValuePairs.erase(iter); - return TRUE; + return true; } else { LL_DEBUGS() << "removeNVPair - No region for object" << LL_ENDL; } } - return FALSE; + return false; } @@ -4510,7 +4387,7 @@ LLMatrix4a LLViewerObject::getGLTFAssetToAgentTransform() const LLMatrix4 root; root.initScale(getScale()); root.rotate(getRenderRotation()); - root.translate(getPositionAgent()); + root.translate(getRenderPosition()); LLMatrix4a mat; mat.loadu((F32*)root.mMatrix); @@ -4534,7 +4411,7 @@ LLMatrix4a LLViewerObject::getAgentToGLTFAssetTransform() const scale.mV[1] = 1.f / scale.mV[1]; scale.mV[2] = 1.f / scale.mV[2]; - root.translate(-getPositionAgent()); + root.translate(-getRenderPosition()); root.rotate(~getRenderRotation()); LLMatrix4 scale_mat; @@ -4551,13 +4428,15 @@ LLMatrix4a LLViewerObject::getGLTFNodeTransformAgent(S32 node_index) const { LLMatrix4a mat; - if (mGLTFAsset.notNull() && node_index >= 0 && node_index < mGLTFAsset->mNodes.size()) + if (mGLTFAsset && node_index >= 0 && node_index < mGLTFAsset->mNodes.size()) { auto& node = mGLTFAsset->mNodes[node_index]; LLMatrix4a asset_to_agent = getGLTFAssetToAgentTransform(); LLMatrix4a node_to_agent; - matMul(node.mAssetMatrix, asset_to_agent, node_to_agent); + LLMatrix4a am; + am.loadu(glm::value_ptr(node.mAssetMatrix)); + matMul(am, asset_to_agent, node_to_agent); mat = node_to_agent; } @@ -4568,6 +4447,7 @@ LLMatrix4a LLViewerObject::getGLTFNodeTransformAgent(S32 node_index) const return mat; } + void LLViewerObject::getGLTFNodeTransformAgent(S32 node_index, LLVector3* position, LLQuaternion* rotation, LLVector3* scale) const { LLMatrix4a node_to_agent = getGLTFNodeTransformAgent(node_index); @@ -4605,7 +4485,7 @@ void decomposeMatrix(const LLMatrix4a& mat, LLVector3& position, LLQuaternion& r void LLViewerObject::setGLTFNodeRotationAgent(S32 node_index, const LLQuaternion& rotation) { - if (mGLTFAsset.notNull() && node_index >= 0 && node_index < mGLTFAsset->mNodes.size()) + if (mGLTFAsset && node_index >= 0 && node_index < mGLTFAsset->mNodes.size()) { auto& node = mGLTFAsset->mNodes[node_index]; @@ -4615,7 +4495,9 @@ void LLViewerObject::setGLTFNodeRotationAgent(S32 node_index, const LLQuaternion if (node.mParent != -1) { auto& parent = mGLTFAsset->mNodes[node.mParent]; - matMul(agent_to_asset, parent.mAssetMatrixInv, agent_to_node); + LLMatrix4a ami; + ami.loadu(glm::value_ptr(parent.mAssetMatrixInv)); + matMul(agent_to_asset, ami, agent_to_node); } LLQuaternion agent_to_node_rot(agent_to_node.asMatrix4()); @@ -4627,9 +4509,13 @@ void LLViewerObject::setGLTFNodeRotationAgent(S32 node_index, const LLQuaternion LLVector3 pos; LLQuaternion rot; LLVector3 scale; - decomposeMatrix(node.mMatrix, pos, rot, scale); + LLMatrix4a mat; + mat.loadu(glm::value_ptr(node.mMatrix)); + decomposeMatrix(mat, pos, rot, scale); + + mat.asMatrix4().initAll(scale, new_rot, pos); - node.mMatrix.asMatrix4().initAll(scale, new_rot, pos); + node.mMatrix = glm::make_mat4(mat.getF32ptr()); mGLTFAsset->updateTransforms(); } @@ -4637,13 +4523,15 @@ void LLViewerObject::setGLTFNodeRotationAgent(S32 node_index, const LLQuaternion void LLViewerObject::moveGLTFNode(S32 node_index, const LLVector3& offset) { - if (mGLTFAsset.notNull() && node_index >= 0 && node_index < mGLTFAsset->mNodes.size()) + if (mGLTFAsset && node_index >= 0 && node_index < mGLTFAsset->mNodes.size()) { auto& node = mGLTFAsset->mNodes[node_index]; LLMatrix4a agent_to_asset = getAgentToGLTFAssetTransform(); LLMatrix4a agent_to_node; - matMul(agent_to_asset, node.mAssetMatrixInv, agent_to_node); + LLMatrix4a ami; + ami.loadu(glm::value_ptr(node.mAssetMatrixInv)); + matMul(agent_to_asset, ami, agent_to_node); LLVector4a origin = LLVector4a::getZero(); LLVector4a offset_v; @@ -4660,7 +4548,12 @@ void LLViewerObject::moveGLTFNode(S32 node_index, const LLVector3& offset) trans.setIdentity(); trans.mMatrix[3] = offset_v; - matMul(trans, node.mMatrix, node.mMatrix); + LLMatrix4a mat; + mat.loadu(glm::value_ptr(node.mMatrix)); + + matMul(trans, mat, mat); + + node.mMatrix = glm::make_mat4(mat.getF32ptr()); // TODO -- only update transforms for this node and its children (or use a dirty flag) mGLTFAsset->updateTransforms(); @@ -4786,7 +4679,7 @@ const LLQuaternion LLViewerObject::getRotationEdit() const return global_rotation; } -void LLViewerObject::setPositionAbsoluteGlobal( const LLVector3d &pos_global, BOOL damped ) +void LLViewerObject::setPositionAbsoluteGlobal( const LLVector3d &pos_global, bool damped ) { if (isAttachment()) { @@ -4835,7 +4728,7 @@ void LLViewerObject::setPositionAbsoluteGlobal( const LLVector3d &pos_global, BO gPipeline.updateMoveNormalAsync(mDrawable); } -void LLViewerObject::setPosition(const LLVector3 &pos, BOOL damped) +void LLViewerObject::setPosition(const LLVector3 &pos, bool damped) { if (getPosition() != pos) { @@ -4851,7 +4744,7 @@ void LLViewerObject::setPosition(const LLVector3 &pos, BOOL damped) } } -void LLViewerObject::setPositionGlobal(const LLVector3d &pos_global, BOOL damped) +void LLViewerObject::setPositionGlobal(const LLVector3d &pos_global, bool damped) { if (isAttachment()) { @@ -4911,7 +4804,7 @@ void LLViewerObject::setPositionGlobal(const LLVector3d &pos_global, BOOL damped } -void LLViewerObject::setPositionParent(const LLVector3 &pos_parent, BOOL damped) +void LLViewerObject::setPositionParent(const LLVector3 &pos_parent, bool damped) { // Set position relative to parent, if no parent, relative to region if (!isRoot()) @@ -4925,7 +4818,7 @@ void LLViewerObject::setPositionParent(const LLVector3 &pos_parent, BOOL damped) } } -void LLViewerObject::setPositionRegion(const LLVector3 &pos_region, BOOL damped) +void LLViewerObject::setPositionRegion(const LLVector3 &pos_region, bool damped) { if (!isRootEdit()) { @@ -4940,7 +4833,7 @@ void LLViewerObject::setPositionRegion(const LLVector3 &pos_region, BOOL damped) } } -void LLViewerObject::setPositionAgent(const LLVector3 &pos_agent, BOOL damped) +void LLViewerObject::setPositionAgent(const LLVector3 &pos_agent, bool damped) { LLVector3 pos_region = getRegion()->getPosRegionFromAgent(pos_agent); setPositionRegion(pos_region, damped); @@ -4950,7 +4843,7 @@ void LLViewerObject::setPositionAgent(const LLVector3 &pos_agent, BOOL damped) // and doesn't also move the joint-parent // TODO -- implement similar intelligence for joint-parents toward // their joint-children -void LLViewerObject::setPositionEdit(const LLVector3 &pos_edit, BOOL damped) +void LLViewerObject::setPositionEdit(const LLVector3 &pos_edit, bool damped) { if (!isRootEdit()) { @@ -4981,11 +4874,11 @@ LLViewerObject* LLViewerObject::getRootEdit() const } -BOOL LLViewerObject::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, +bool LLViewerObject::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, S32 face, - BOOL pick_transparent, - BOOL pick_rigged, - BOOL pick_unselectable, + bool pick_transparent, + bool pick_rigged, + bool pick_unselectable, S32* face_hit, LLVector4a* intersection, LLVector2* tex_coord, @@ -4995,11 +4888,11 @@ BOOL LLViewerObject::lineSegmentIntersect(const LLVector4a& start, const LLVecto return false; } -BOOL LLViewerObject::lineSegmentBoundingBox(const LLVector4a& start, const LLVector4a& end) +bool LLViewerObject::lineSegmentBoundingBox(const LLVector4a& start, const LLVector4a& end) { if (mDrawable.isNull() || mDrawable->isDead()) { - return FALSE; + return false; } const LLVector4a* ext = mDrawable->getSpatialExtents(); @@ -5059,20 +4952,20 @@ void LLViewerObject::setMediaURL(const std::string& media_url) { mMedia = new LLViewerObjectMedia; mMedia->mMediaURL = media_url; - mMedia->mPassedWhitelist = FALSE; + mMedia->mPassedWhitelist = false; // TODO: update materials with new image } else if (mMedia->mMediaURL != media_url) { mMedia->mMediaURL = media_url; - mMedia->mPassedWhitelist = FALSE; + mMedia->mPassedWhitelist = false; // TODO: update materials with new image } } -BOOL LLViewerObject::getMediaPassedWhitelist() const +bool LLViewerObject::getMediaPassedWhitelist() const { if (mMedia) { @@ -5080,11 +4973,11 @@ BOOL LLViewerObject::getMediaPassedWhitelist() const } else { - return FALSE; + return false; } } -void LLViewerObject::setMediaPassedWhitelist(BOOL passed) +void LLViewerObject::setMediaPassedWhitelist(bool passed) { if (mMedia) { @@ -5092,9 +4985,9 @@ void LLViewerObject::setMediaPassedWhitelist(BOOL passed) } } -BOOL LLViewerObject::setMaterial(const U8 material) +bool LLViewerObject::setMaterial(const U8 material) { - BOOL res = LLPrimitive::setMaterial(material); + bool res = LLPrimitive::setMaterial(material); if (res) { setChanged(TEXTURE); @@ -5258,7 +5151,7 @@ LLViewerTexture* LLViewerObject::getBakedTextureForMagicId(const LLUUID& id) LLViewerObject *root = getRootEdit(); if (root && root->isAnimatedObject()) { - return LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + return LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); } LLVOAvatar* avatar = getAvatar(); @@ -5268,7 +5161,7 @@ LLViewerTexture* LLViewerObject::getBakedTextureForMagicId(const LLUUID& id) LLViewerTexture* bakedTexture = avatar->getBakedTexture(texIndex); if (bakedTexture == NULL || bakedTexture->isMissingAsset()) { - return LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + return LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); } else { @@ -5277,7 +5170,7 @@ LLViewerTexture* LLViewerObject::getBakedTextureForMagicId(const LLUUID& id) } else { - return LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + return LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); } } @@ -5314,7 +5207,7 @@ void LLViewerObject::setTE(const U8 te, const LLTextureEntry& texture_entry) const LLUUID& image_id = getTE(te)->getID(); LLViewerTexture* bakedTexture = getBakedTextureForMagicId(image_id); - mTEImages[te] = bakedTexture ? bakedTexture : LLViewerTextureManager::getFetchedTexture(image_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + mTEImages[te] = bakedTexture ? bakedTexture : LLViewerTextureManager::getFetchedTexture(image_id, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); updateAvatarMeshVisibility(image_id, old_image_id); @@ -5326,10 +5219,10 @@ void LLViewerObject::updateTEMaterialTextures(U8 te) if (getTE(te)->getMaterialParams().notNull()) { const LLUUID& norm_id = getTE(te)->getMaterialParams()->getNormalID(); - mTENormalMaps[te] = LLViewerTextureManager::getFetchedTexture(norm_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + mTENormalMaps[te] = LLViewerTextureManager::getFetchedTexture(norm_id, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); const LLUUID& spec_id = getTE(te)->getMaterialParams()->getSpecularID(); - mTESpecularMaps[te] = LLViewerTextureManager::getFetchedTexture(spec_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + mTESpecularMaps[te] = LLViewerTextureManager::getFetchedTexture(spec_id, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); } LLFetchedGLTFMaterial* mat = (LLFetchedGLTFMaterial*) getTE(te)->getGLTFRenderMaterial(); @@ -5371,8 +5264,8 @@ void LLViewerObject::updateTEMaterialTextures(U8 te) } else { - img = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); - img->addTextureStats(64.f * 64.f, TRUE); + img = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + img->addTextureStats(64.f * 64.f, true); } } @@ -5522,21 +5415,21 @@ S32 LLViewerObject::setTETexture(const U8 te, const LLUUID& uuid) { // Invalid host == get from the agent's sim LLViewerFetchedTexture *image = LLViewerTextureManager::getFetchedTexture( - uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost()); + uuid, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost()); return setTETextureCore(te, image); } S32 LLViewerObject::setTENormalMap(const U8 te, const LLUUID& uuid) { LLViewerFetchedTexture *image = (uuid == LLUUID::null) ? NULL : LLViewerTextureManager::getFetchedTexture( - uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost()); + uuid, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost()); return setTENormalMapCore(te, image); } S32 LLViewerObject::setTESpecularMap(const U8 te, const LLUUID& uuid) { LLViewerFetchedTexture *image = (uuid == LLUUID::null) ? NULL : LLViewerTextureManager::getFetchedTexture( - uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost()); + uuid, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost()); return setTESpecularMapCore(te, image); } @@ -6075,8 +5968,8 @@ void LLViewerObject::setDebugText(const std::string &utf8text, const LLColor4& c } mText->setColor(color); mText->setString(utf8text); - mText->setZCompare(FALSE); - mText->setDoFade(FALSE); + mText->setZCompare(false); + mText->setDoFade(false); updateText(); } @@ -6092,8 +5985,8 @@ void LLViewerObject::appendDebugText(const std::string &utf8text) initHudText(); } mText->addLine(utf8text, LLColor4::white); - mText->setZCompare(FALSE); - mText->setDoFade(FALSE); + mText->setZCompare(false); + mText->setDoFade(false); updateText(); } @@ -6126,8 +6019,8 @@ void LLViewerObject::restoreHudText() else { // Restore default values - mText->setZCompare(TRUE); - mText->setDoFade(TRUE); + mText->setZCompare(true); + mText->setDoFade(true); } mText->setColor(mHudTextColor); mText->setString(mHudText); @@ -6168,7 +6061,7 @@ const LLViewerObject* LLViewerObject::getSubParent() const return (const LLViewerObject*) getParent(); } -BOOL LLViewerObject::isOnMap() +bool LLViewerObject::isOnMap() { return mOnMap; } @@ -6252,7 +6145,7 @@ LLVOAvatar* LLViewerObject::getAvatarAncestor() return NULL; } -BOOL LLViewerObject::isParticleSource() const +bool LLViewerObject::isParticleSource() const { return !mPartSourcep.isNull() && !mPartSourcep->isDead(); } @@ -6393,7 +6286,7 @@ void LLViewerObject::deleteParticleSource() } // virtual -void LLViewerObject::updateDrawable(BOOL force_damped) +void LLViewerObject::updateDrawable(bool force_damped) { if (!isChanged(MOVED)) { //most common case, having an empty if case here makes for better branch prediction @@ -6401,7 +6294,7 @@ void LLViewerObject::updateDrawable(BOOL force_damped) else if (mDrawable.notNull() && !mDrawable->isState(LLDrawable::ON_MOVE_LIST)) { - BOOL damped_motion = + bool damped_motion = !isChanged(SHIFTED) && // not shifted between regions this frame and... ( force_damped || // ...forced into damped motion by application logic or... ( !isSelected() && // ...not selected and... @@ -6480,7 +6373,7 @@ void LLViewerObject::setAttachedSound(const LLUUID &audio_uuid, const LLUUID& ow if (mAudioSourcep) { - BOOL queue = flags & LL_SOUND_FLAG_QUEUE; + bool queue = flags & LL_SOUND_FLAG_QUEUE; mAudioGain = gain; mAudioSourcep->setGain(gain); mAudioSourcep->setLoop(flags & LL_SOUND_FLAG_LOOP); @@ -6542,8 +6435,8 @@ bool LLViewerObject::unpackParameterEntry(U16 param_type, LLDataPacker *dp) if (param) { param->data->unpack(*dp); - param->in_use = TRUE; - parameterChanged(param_type, param->data, TRUE, false); + param->in_use = true; + parameterChanged(param_type, param->data, true, false); return true; } else @@ -6645,7 +6538,7 @@ LLNetworkData* LLViewerObject::getParameterEntry(U16 param_type) const } } -BOOL LLViewerObject::getParameterEntryInUse(U16 param_type) const +bool LLViewerObject::getParameterEntryInUse(U16 param_type) const { ExtraParameter* param = getExtraParameterEntry(param_type); if (param) @@ -6654,7 +6547,7 @@ BOOL LLViewerObject::getParameterEntryInUse(U16 param_type) const } else { - return FALSE; + return false; } } @@ -6669,7 +6562,7 @@ bool LLViewerObject::setParameterEntry(U16 param_type, const LLNetworkData& new_ } param->in_use = true; param->data->copy(new_value); - parameterChanged(param_type, param->data, TRUE, local_origin); + parameterChanged(param_type, param->data, true, local_origin); return true; } else @@ -6679,9 +6572,9 @@ bool LLViewerObject::setParameterEntry(U16 param_type, const LLNetworkData& new_ } // Assumed to be called locally -// If in_use is TRUE, will crate a new extra parameter if none exists. +// If in_use is true, will crate a new extra parameter if none exists. // Should always return true. -bool LLViewerObject::setParameterEntryInUse(U16 param_type, BOOL in_use, bool local_origin) +bool LLViewerObject::setParameterEntryInUse(U16 param_type, bool in_use, bool local_origin) { ExtraParameter* param = getExtraParameterEntryCreate(param_type); if (param && param->in_use != in_use) @@ -6702,7 +6595,7 @@ void LLViewerObject::parameterChanged(U16 param_type, bool local_origin) } } -void LLViewerObject::parameterChanged(U16 param_type, LLNetworkData* data, BOOL in_use, bool local_origin) +void LLViewerObject::parameterChanged(U16 param_type, LLNetworkData* data, bool in_use, bool local_origin) { if (local_origin) { @@ -6752,7 +6645,7 @@ void LLViewerObject::parameterChanged(U16 param_type, LLNetworkData* data, BOOL } } -void LLViewerObject::setDrawableState(U32 state, BOOL recursive) +void LLViewerObject::setDrawableState(U32 state, bool recursive) { if (mDrawable) { @@ -6769,7 +6662,7 @@ void LLViewerObject::setDrawableState(U32 state, BOOL recursive) } } -void LLViewerObject::clearDrawableState(U32 state, BOOL recursive) +void LLViewerObject::clearDrawableState(U32 state, bool recursive) { if (mDrawable) { @@ -6786,9 +6679,9 @@ void LLViewerObject::clearDrawableState(U32 state, BOOL recursive) } } -BOOL LLViewerObject::isDrawableState(U32 state, BOOL recursive) const +bool LLViewerObject::isDrawableState(U32 state, bool recursive) const { - BOOL matches = FALSE; + bool matches = false; if (mDrawable) { matches = mDrawable->isState(state); @@ -6813,7 +6706,7 @@ BOOL LLViewerObject::isDrawableState(U32 state, BOOL recursive) const //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // Owned by anyone? -BOOL LLViewerObject::permAnyOwner() const +bool LLViewerObject::permAnyOwner() const { if (isRootEdit()) { @@ -6825,18 +6718,18 @@ BOOL LLViewerObject::permAnyOwner() const } } // Owned by this viewer? -BOOL LLViewerObject::permYouOwner() const +bool LLViewerObject::permYouOwner() const { if (isRootEdit()) { #ifdef HACKED_GODLIKE_VIEWER - return TRUE; + return true; #else # ifdef TOGGLE_HACKED_GODLIKE_VIEWER if (!LLGridManager::getInstance()->isInProductionGrid() && (gAgent.getGodLevel() >= GOD_MAINTENANCE)) { - return TRUE; + return true; } # endif return flagObjectYouOwner(); @@ -6849,7 +6742,7 @@ BOOL LLViewerObject::permYouOwner() const } // Owned by a group? -BOOL LLViewerObject::permGroupOwner() const +bool LLViewerObject::permGroupOwner() const { if (isRootEdit()) { @@ -6862,18 +6755,18 @@ BOOL LLViewerObject::permGroupOwner() const } // Can the owner edit -BOOL LLViewerObject::permOwnerModify() const +bool LLViewerObject::permOwnerModify() const { if (isRootEdit()) { #ifdef HACKED_GODLIKE_VIEWER - return TRUE; + return true; #else # ifdef TOGGLE_HACKED_GODLIKE_VIEWER if (!LLGridManager::getInstance()->isInProductionGrid() && (gAgent.getGodLevel() >= GOD_MAINTENANCE)) { - return TRUE; + return true; } # endif return flagObjectOwnerModify(); @@ -6886,18 +6779,18 @@ BOOL LLViewerObject::permOwnerModify() const } // Can edit -BOOL LLViewerObject::permModify() const +bool LLViewerObject::permModify() const { if (isRootEdit()) { #ifdef HACKED_GODLIKE_VIEWER - return TRUE; + return true; #else # ifdef TOGGLE_HACKED_GODLIKE_VIEWER if (!LLGridManager::getInstance()->isInProductionGrid() && (gAgent.getGodLevel() >= GOD_MAINTENANCE)) { - return TRUE; + return true; } # endif return flagObjectModify(); @@ -6910,18 +6803,18 @@ BOOL LLViewerObject::permModify() const } // Can copy -BOOL LLViewerObject::permCopy() const +bool LLViewerObject::permCopy() const { if (isRootEdit()) { #ifdef HACKED_GODLIKE_VIEWER - return TRUE; + return true; #else # ifdef TOGGLE_HACKED_GODLIKE_VIEWER if (!LLGridManager::getInstance()->isInProductionGrid() && (gAgent.getGodLevel() >= GOD_MAINTENANCE)) { - return TRUE; + return true; } # endif return flagObjectCopy(); @@ -6934,18 +6827,18 @@ BOOL LLViewerObject::permCopy() const } // Can move -BOOL LLViewerObject::permMove() const +bool LLViewerObject::permMove() const { if (isRootEdit()) { #ifdef HACKED_GODLIKE_VIEWER - return TRUE; + return true; #else # ifdef TOGGLE_HACKED_GODLIKE_VIEWER if (!LLGridManager::getInstance()->isInProductionGrid() && (gAgent.getGodLevel() >= GOD_MAINTENANCE)) { - return TRUE; + return true; } # endif return flagObjectMove(); @@ -6958,18 +6851,18 @@ BOOL LLViewerObject::permMove() const } // Can be transferred -BOOL LLViewerObject::permTransfer() const +bool LLViewerObject::permTransfer() const { if (isRootEdit()) { #ifdef HACKED_GODLIKE_VIEWER - return TRUE; + return true; #else # ifdef TOGGLE_HACKED_GODLIKE_VIEWER if (!LLGridManager::getInstance()->isInProductionGrid() && (gAgent.getGodLevel() >= GOD_MAINTENANCE)) { - return TRUE; + return true; } # endif return flagObjectTransfer(); @@ -6983,7 +6876,7 @@ BOOL LLViewerObject::permTransfer() const // Can only open objects that you own, or that someone has // given you modify rights to. JC -BOOL LLViewerObject::allowOpen() const +bool LLViewerObject::allowOpen() const { return !flagInventoryEmpty() && (permYouOwner() || permModify()); } @@ -7074,7 +6967,7 @@ void LLViewerObject::setRegion(LLViewerRegion *regionp) } setChanged(MOVED | SILHOUETTE); - updateDrawable(FALSE); + updateDrawable(false); } // virtual @@ -7098,7 +6991,7 @@ bool LLViewerObject::specialHoverCursor() const || (mClickAction != 0); } -void LLViewerObject::updateFlags(BOOL physics_changed) +void LLViewerObject::updateFlags(bool physics_changed) { LLViewerRegion* regionp = getRegion(); if(!regionp) return; @@ -7111,10 +7004,10 @@ void LLViewerObject::updateFlags(BOOL physics_changed) gMessageSystem->addBOOL("IsTemporary", flagTemporaryOnRez() ); gMessageSystem->addBOOL("IsPhantom", flagPhantom() ); - // stinson 02/28/2012 : This CastsShadows BOOL is no longer used in either the viewer or the simulator + // stinson 02/28/2012 : This CastsShadows bool is no longer used in either the viewer or the simulator // The simulator code does not even unpack this value when the message is received. // This could be potentially hijacked in the future for another use should the urgent need arise. - gMessageSystem->addBOOL("CastsShadows", FALSE ); + gMessageSystem->addBOOL("CastsShadows", false ); if (physics_changed) { @@ -7128,9 +7021,9 @@ void LLViewerObject::updateFlags(BOOL physics_changed) gMessageSystem->sendReliable( regionp->getHost() ); } -BOOL LLViewerObject::setFlags(U32 flags, BOOL state) +bool LLViewerObject::setFlags(U32 flags, bool state) { - BOOL setit = setFlagsWithoutUpdate(flags, state); + bool setit = setFlagsWithoutUpdate(flags, state); // BUG: Sometimes viewer physics and simulator physics get // out of sync. To fix this, always send update to simulator. @@ -7141,15 +7034,15 @@ BOOL LLViewerObject::setFlags(U32 flags, BOOL state) return setit; } -BOOL LLViewerObject::setFlagsWithoutUpdate(U32 flags, BOOL state) +bool LLViewerObject::setFlagsWithoutUpdate(U32 flags, bool state) { - BOOL setit = FALSE; + bool setit = false; if (state) { if ((mFlags & flags) != flags) { mFlags |= flags; - setit = TRUE; + setit = true; } } else @@ -7157,7 +7050,7 @@ BOOL LLViewerObject::setFlagsWithoutUpdate(U32 flags, BOOL state) if ((mFlags & flags) != 0) { mFlags &= ~flags; - setit = TRUE; + setit = true; } } return setit; @@ -7280,12 +7173,12 @@ void LLAlphaObject::getBlendFunc(S32 face, LLRender::eBlendFactor& src, LLRender } // virtual -void LLStaticViewerObject::updateDrawable(BOOL force_damped) +void LLStaticViewerObject::updateDrawable(bool force_damped) { // Force an immediate rebuild on any update if (mDrawable.notNull()) { - mDrawable->updateXform(TRUE); + mDrawable->updateXform(true); gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL); } clearChanged(SHIFTED); @@ -7363,8 +7256,8 @@ void LLViewerObject::resetChildrenRotationAndPosition(const std::vector<LLQuater ((LLVOAvatar*)childp)->mDrawable->mXform.setPosition(reset_pos); ((LLVOAvatar*)childp)->mDrawable->mXform.setRotation(reset_rot) ; - ((LLVOAvatar*)childp)->mDrawable->getVObj()->setPosition(reset_pos, TRUE); - ((LLVOAvatar*)childp)->mDrawable->getVObj()->setRotation(reset_rot, TRUE) ; + ((LLVOAvatar*)childp)->mDrawable->getVObj()->setPosition(reset_pos, true); + ((LLVOAvatar*)childp)->mDrawable->getVObj()->setRotation(reset_rot, true) ; LLManip::rebuild(childp); } @@ -7376,7 +7269,7 @@ void LLViewerObject::resetChildrenRotationAndPosition(const std::vector<LLQuater } //counter-translation -void LLViewerObject::resetChildrenPosition(const LLVector3& offset, BOOL simplified, BOOL skip_avatar_child) +void LLViewerObject::resetChildrenPosition(const LLVector3& offset, bool simplified, bool skip_avatar_child) { if(mChildList.empty()) { @@ -7432,18 +7325,18 @@ void LLViewerObject::resetChildrenPosition(const LLVector3& offset, BOOL simplif } // virtual -BOOL LLViewerObject::isTempAttachment() const +bool LLViewerObject::isTempAttachment() const { return (mID.notNull() && (mID == mAttachmentItemID)); } -BOOL LLViewerObject::isHiglightedOrBeacon() const +bool LLViewerObject::isHiglightedOrBeacon() const { if (LLFloaterReg::instanceVisible("beacons") && (gPipeline.getRenderBeacons() || gPipeline.getRenderHighlights())) { - BOOL has_media = (getMediaType() == LLViewerObject::MEDIA_SET); - BOOL is_scripted = !isAvatar() && !getParent() && flagScripted(); - BOOL is_physical = !isAvatar() && flagUsePhysics(); + bool has_media = (getMediaType() == LLViewerObject::MEDIA_SET); + bool is_scripted = !isAvatar() && !getParent() && flagScripted(); + bool is_physical = !isAvatar() && flagUsePhysics(); return (isParticleSource() && gPipeline.getRenderParticleBeacons()) || (isAudioSource() && gPipeline.getRenderSoundBeacons()) @@ -7452,7 +7345,7 @@ BOOL LLViewerObject::isHiglightedOrBeacon() const || (is_scripted && flagHandleTouch() && gPipeline.getRenderScriptedTouchBeacons()) || (is_physical && gPipeline.getRenderPhysicalBeacons()); } - return FALSE; + return false; } @@ -7476,12 +7369,12 @@ void LLViewerObject::setLastUpdateType(EObjectUpdateType last_update_type) mLastUpdateType = last_update_type; } -BOOL LLViewerObject::getLastUpdateCached() const +bool LLViewerObject::getLastUpdateCached() const { return mLastUpdateCached; } -void LLViewerObject::setLastUpdateCached(BOOL last_update_cached) +void LLViewerObject::setLastUpdateCached(bool last_update_cached) { mLastUpdateCached = last_update_cached; } @@ -7548,11 +7441,11 @@ void LLViewerObject::setHasRenderMaterialParams(bool has_materials) { if (has_materials) { - setParameterEntryInUse(LLNetworkData::PARAMS_RENDER_MATERIAL, TRUE, true); + setParameterEntryInUse(LLNetworkData::PARAMS_RENDER_MATERIAL, true, true); } else { - setParameterEntryInUse(LLNetworkData::PARAMS_RENDER_MATERIAL, FALSE, true); + setParameterEntryInUse(LLNetworkData::PARAMS_RENDER_MATERIAL, false, true); } } } @@ -7751,6 +7644,23 @@ void LLViewerObject::shrinkWrap() } } +void LLViewerObject::setGLTFAsset(const LLUUID& id) +{ + //get the sculpt params and set the sculpt type and id + auto* param = getExtraParameterEntryCreate(LLNetworkData::PARAMS_SCULPT); + + LLSculptParams* sculpt_params = (LLSculptParams*)param->data; + sculpt_params->setSculptTexture(id, LL_SCULPT_TYPE_GLTF); + + setParameterEntryInUse(LLNetworkData::PARAMS_SCULPT, true, true); + + // Update the volume + LLVolumeParams volume_params; + volume_params.setSculptID(id, LL_SCULPT_TYPE_GLTF); + updateVolume(volume_params); +} + + class ObjectPhysicsProperties : public LLHTTPNode { public: @@ -7760,7 +7670,7 @@ public: const LLSD& input) const { LLSD object_data = input["body"]["ObjectData"]; - S32 num_entries = object_data.size(); + S32 num_entries = static_cast<S32>(object_data.size()); for ( S32 i = 0; i < num_entries; i++ ) { diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index ad7b3072c8..08c81c4b6c 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -1,3 +1,4 @@ + /** * @file llviewerobject.h * @brief Description of LLViewerObject class, which is the base class for most objects in the viewer. @@ -45,7 +46,14 @@ #include "llbbox.h" #include "llrigginginfo.h" #include "llreflectionmap.h" -#include "gltf/asset.h" + +namespace LL +{ + namespace GLTF + { + class Asset; + } +} class LLAgent; // TODO: Get rid of this. class LLAudioSource; @@ -121,7 +129,7 @@ protected: // TomY: Provide for a list of extra parameter structures, mapped by structure name struct ExtraParameter { - BOOL in_use; + bool in_use; LLNetworkData *data; }; std::unordered_map<U16, ExtraParameter*> mExtraParameterList; @@ -132,12 +140,12 @@ public: typedef const child_list_t const_child_list_t; - LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp, BOOL is_global = FALSE); + LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp, bool is_global = false); virtual void markDead(); // Mark this object as dead, and clean up its references - BOOL isDead() const {return mDead;} - BOOL isOrphaned() const { return mOrphaned; } - BOOL isParticleSource() const; + bool isDead() const {return mDead;} + bool isOrphaned() const { return mOrphaned; } + bool isParticleSource() const; virtual LLVOAvatar* asAvatar(); @@ -147,7 +155,7 @@ public: static void cleanupVOClasses(); void addNVPair(const std::string& data); - BOOL removeNVPair(const std::string& name); + bool removeNVPair(const std::string& name); LLNameValue* getNVPair(const std::string& name) const; // null if no name value pair by that name // Object create and update functions @@ -173,11 +181,11 @@ public: LLDataPacker *dp); - virtual BOOL isActive() const; // Whether this object needs to do an idleUpdate. - BOOL onActiveList() const {return mOnActiveList;} - void setOnActiveList(BOOL on_active) { mOnActiveList = on_active; } + virtual bool isActive() const; // Whether this object needs to do an idleUpdate. + bool onActiveList() const {return mOnActiveList;} + void setOnActiveList(bool on_active) { mOnActiveList = on_active; } - virtual BOOL isAttachment() const { return FALSE; } + virtual bool isAttachment() const { return false; } const std::string& getAttachmentItemName() const; virtual LLVOAvatar* getAvatar() const; //get the avatar this object is attached to, or NULL if object is not an attachment @@ -194,10 +202,10 @@ public: void setRenderMaterialID(S32 te, const LLUUID& id, bool update_server = true, bool local_origin = true); void setRenderMaterialIDs(const LLUUID& id); - virtual BOOL isHUDAttachment() const { return FALSE; } - virtual BOOL isTempAttachment() const; + virtual bool isHUDAttachment() const { return false; } + virtual bool isTempAttachment() const; - virtual BOOL isHiglightedOrBeacon() const; + virtual bool isHiglightedOrBeacon() const; virtual void updateRadius() {}; virtual F32 getVObjRadius() const; // default implemenation is mDrawable->getRadius() @@ -216,14 +224,14 @@ public: // Graphical stuff for objects - maybe broken out into render class later? virtual void updateTextures(); virtual void faceMappingChanged() {} - virtual void boostTexturePriority(BOOL boost_children = TRUE); // When you just want to boost priority of this object + virtual void boostTexturePriority(bool boost_children = true); // When you just want to boost priority of this object virtual LLDrawable* createDrawable(LLPipeline *pipeline); - virtual BOOL updateGeometry(LLDrawable *drawable); + virtual bool updateGeometry(LLDrawable *drawable); virtual void updateGL(); virtual void updateFaceSize(S32 idx); - virtual BOOL updateLOD(); - virtual BOOL setDrawableParent(LLDrawable* parentp); + virtual bool updateLOD(); + virtual bool setDrawableParent(LLDrawable* parentp); F32 getRotTime() { return mRotTime; } private: void resetRotTime(); @@ -241,10 +249,10 @@ public: // Accessor functions LLViewerRegion* getRegion() const { return mRegionp; } - BOOL isSelected() const { return mUserSelected; } + bool isSelected() const { return mUserSelected; } // Check whole linkset - BOOL isAnySelected() const; - virtual void setSelected(BOOL sel); + bool isAnySelected() const; + virtual void setSelected(bool sel); const LLUUID &getID() const { return mID; } U32 getLocalID() const { return mLocalID; } @@ -252,12 +260,13 @@ public: S32 getListIndex() const { return mListIndex; } void setListIndex(S32 idx) { mListIndex = idx; } - virtual BOOL isFlexible() const { return FALSE; } - virtual BOOL isSculpted() const { return FALSE; } - virtual BOOL isMesh() const { return FALSE; } - virtual BOOL isRiggedMesh() const { return FALSE; } - virtual BOOL hasLightTexture() const { return FALSE; } - virtual BOOL isReflectionProbe() const { return FALSE; } + virtual bool isFlexible() const { return false; } + virtual bool isSculpted() const { return false; } + virtual bool isMesh() const { return false; } + virtual bool isRiggedMesh() const { return false; } + virtual bool hasLightTexture() const { return false; } + virtual bool isReflectionProbe() const { return false; } + virtual bool getReflectionProbeIsBox() const { return false; } // This method returns true if the object is over land owned by // the agent, one of its groups, or it encroaches and @@ -277,29 +286,29 @@ public: // ability to modify the object. Since this calls into the // selection manager, you should avoid calling this method from // there. - BOOL isProbablyModifiable() const; + bool isProbablyModifiable() const; */ - virtual BOOL setParent(LLViewerObject* parent); + virtual bool setParent(LLViewerObject* parent); virtual void onReparent(LLViewerObject *old_parent, LLViewerObject *new_parent); virtual void afterReparent(); virtual void addChild(LLViewerObject *childp); virtual void removeChild(LLViewerObject *childp); const_child_list_t& getChildren() const { return mChildList; } - S32 numChildren() const { return mChildList.size(); } + S32 numChildren() const { return static_cast<S32>(mChildList.size()); } void addThisAndAllChildren(std::vector<LLViewerObject*>& objects); void addThisAndNonJointChildren(std::vector<LLViewerObject*>& objects); - BOOL isChild(LLViewerObject *childp) const; - BOOL isSeat() const; + bool isChild(LLViewerObject *childp) const; + bool isSeat() const; //detect if given line segment (in agent space) intersects with this viewer object. - //returns TRUE if intersection detected and returns information about intersection - virtual BOOL lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, + //returns true if intersection detected and returns information about intersection + virtual bool lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, S32 face = -1, // which face to check, -1 = ALL_SIDES - BOOL pick_transparent = FALSE, - BOOL pick_rigged = FALSE, - BOOL pick_unselectable = TRUE, + bool pick_transparent = false, + bool pick_rigged = false, + bool pick_unselectable = true, S32* face_hit = NULL, // which face was hit LLVector4a* intersection = NULL, // return the intersection point LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point @@ -307,7 +316,7 @@ public: LLVector4a* tangent = NULL // return the surface tangent at the intersection point ); - virtual BOOL lineSegmentBoundingBox(const LLVector4a& start, const LLVector4a& end); + virtual bool lineSegmentBoundingBox(const LLVector4a& start, const LLVector4a& end); virtual const LLVector3d getPositionGlobal() const; virtual const LLVector3 &getPositionRegion() const; @@ -336,18 +345,18 @@ public: const LLQuaternion getRenderRotation() const; virtual const LLMatrix4 getRenderMatrix() const; - void setPosition(const LLVector3 &pos, BOOL damped = FALSE); - void setPositionGlobal(const LLVector3d &position, BOOL damped = FALSE); - void setPositionRegion(const LLVector3 &position, BOOL damped = FALSE); - void setPositionEdit(const LLVector3 &position, BOOL damped = FALSE); - void setPositionAgent(const LLVector3 &pos_agent, BOOL damped = FALSE); - void setPositionParent(const LLVector3 &pos_parent, BOOL damped = FALSE); - void setPositionAbsoluteGlobal( const LLVector3d &pos_global, BOOL damped = FALSE ); + void setPosition(const LLVector3 &pos, bool damped = false); + void setPositionGlobal(const LLVector3d &position, bool damped = false); + void setPositionRegion(const LLVector3 &position, bool damped = false); + void setPositionEdit(const LLVector3 &position, bool damped = false); + void setPositionAgent(const LLVector3 &pos_agent, bool damped = false); + void setPositionParent(const LLVector3 &pos_parent, bool damped = false); + void setPositionAbsoluteGlobal( const LLVector3d &pos_global, bool damped = false ); virtual const LLMatrix4& getWorldMatrix(LLXformMatrix* xform) const { return xform->getWorldMatrix(); } - inline void setRotation(const F32 x, const F32 y, const F32 z, BOOL damped = FALSE); - inline void setRotation(const LLQuaternion& quat, BOOL damped = FALSE); + inline void setRotation(const F32 x, const F32 y, const F32 z, bool damped = false); + inline void setRotation(const LLQuaternion& quat, bool damped = false); /*virtual*/ void setNumTEs(const U8 num_tes); /*virtual*/ void setTE(const U8 te, const LLTextureEntry &texture_entry); @@ -383,7 +392,7 @@ public: // void refreshMaterials(); - /*virtual*/ BOOL setMaterial(const U8 material); + /*virtual*/ bool setMaterial(const U8 material); virtual void setTEImage(const U8 te, LLViewerTexture *imagep); // Not derived from LLPrimitive virtual void changeTEImage(S32 index, LLViewerTexture* new_image) ; virtual void changeTENormalMap(S32 index, LLViewerTexture* new_image) ; @@ -397,7 +406,7 @@ public: void fitFaceTexture(const U8 face); void sendTEUpdate() const; // Sends packed representation of all texture entry information - virtual void setScale(const LLVector3 &scale, BOOL damped = FALSE); + virtual void setScale(const LLVector3 &scale, bool damped = false); S32 getAnimatedObjectMaxTris() const; F32 recursiveGetEstTrianglesMax() const; @@ -442,7 +451,7 @@ public: // Create if necessary LLAudioSource *getAudioSource(const LLUUID& owner_id); - BOOL isAudioSource() const {return mAudioSourcep != NULL;} + bool isAudioSource() const {return mAudioSourcep != NULL;} U8 getMediaType() const; void setMediaType(U8 media_type); @@ -450,8 +459,8 @@ public: std::string getMediaURL() const; void setMediaURL(const std::string& media_url); - BOOL getMediaPassedWhitelist() const; - void setMediaPassedWhitelist(BOOL passed); + bool getMediaPassedWhitelist() const; + void setMediaPassedWhitelist(bool passed); void sendMaterialUpdate() const; @@ -472,13 +481,13 @@ public: void updatePositionCaches() const; // Update the global and region position caches from the object (and parent's) xform. void updateText(); // update text label position - virtual void updateDrawable(BOOL force_damped); // force updates on static objects + virtual void updateDrawable(bool force_damped); // force updates on static objects bool isOwnerInMuteList(LLUUID item_id = LLUUID()); - void setDrawableState(U32 state, BOOL recursive = TRUE); - void clearDrawableState(U32 state, BOOL recursive = TRUE); - BOOL isDrawableState(U32 state, BOOL recursive = TRUE) const; + void setDrawableState(U32 state, bool recursive = true); + void clearDrawableState(U32 state, bool recursive = true); + bool isDrawableState(U32 state, bool recursive = true) const; // Called when the drawable shifts virtual void onShift(const LLVector4a &shift_vector) { } @@ -493,7 +502,7 @@ public: // viewer object has the inventory stored locally. void registerInventoryListener(LLVOInventoryListener* listener, void* user_data); void removeInventoryListener(LLVOInventoryListener* listener); - BOOL isInventoryPending(); + bool isInventoryPending(); void clearInventoryListeners(); bool hasInventoryListeners(); void requestInventory(); @@ -523,12 +532,12 @@ public: // This function will make sure that we refresh the inventory. void dirtyInventory(); - BOOL isInventoryDirty() { return mInventoryDirty; } + bool isInventoryDirty() { return mInventoryDirty; } // save a script, which involves removing the old one, and rezzing // in the new one. This method should be called with the asset id // of the new and old script AFTER the bytecode has been saved. - void saveScript(const LLViewerInventoryItem* item, BOOL active, bool is_new); + void saveScript(const LLViewerInventoryItem* item, bool active, bool is_new); // move an inventory item out of the task and into agent // inventory. This operation is based on messaging. No permissions @@ -538,37 +547,37 @@ public: // Find the number of instances of this object's inventory that are of the given type S32 countInventoryContents( LLAssetType::EType type ); - BOOL permAnyOwner() const; - BOOL permYouOwner() const; - BOOL permGroupOwner() const; - BOOL permOwnerModify() const; - BOOL permModify() const; - BOOL permCopy() const; - BOOL permMove() const; - BOOL permTransfer() const; - inline BOOL flagUsePhysics() const { return ((mFlags & FLAGS_USE_PHYSICS) != 0); } - inline BOOL flagObjectAnyOwner() const { return ((mFlags & FLAGS_OBJECT_ANY_OWNER) != 0); } - inline BOOL flagObjectYouOwner() const { return ((mFlags & FLAGS_OBJECT_YOU_OWNER) != 0); } - inline BOOL flagObjectGroupOwned() const { return ((mFlags & FLAGS_OBJECT_GROUP_OWNED) != 0); } - inline BOOL flagObjectOwnerModify() const { return ((mFlags & FLAGS_OBJECT_OWNER_MODIFY) != 0); } - inline BOOL flagObjectModify() const { return ((mFlags & FLAGS_OBJECT_MODIFY) != 0); } - inline BOOL flagObjectCopy() const { return ((mFlags & FLAGS_OBJECT_COPY) != 0); } - inline BOOL flagObjectMove() const { return ((mFlags & FLAGS_OBJECT_MOVE) != 0); } - inline BOOL flagObjectTransfer() const { return ((mFlags & FLAGS_OBJECT_TRANSFER) != 0); } - inline BOOL flagObjectPermanent() const { return ((mFlags & FLAGS_AFFECTS_NAVMESH) != 0); } - inline BOOL flagCharacter() const { return ((mFlags & FLAGS_CHARACTER) != 0); } - inline BOOL flagVolumeDetect() const { return ((mFlags & FLAGS_VOLUME_DETECT) != 0); } - inline BOOL flagIncludeInSearch() const { return ((mFlags & FLAGS_INCLUDE_IN_SEARCH) != 0); } - inline BOOL flagScripted() const { return ((mFlags & FLAGS_SCRIPTED) != 0); } - inline BOOL flagHandleTouch() const { return ((mFlags & FLAGS_HANDLE_TOUCH) != 0); } - inline BOOL flagTakesMoney() const { return ((mFlags & FLAGS_TAKES_MONEY) != 0); } - inline BOOL flagPhantom() const { return ((mFlags & FLAGS_PHANTOM) != 0); } - inline BOOL flagInventoryEmpty() const { return ((mFlags & FLAGS_INVENTORY_EMPTY) != 0); } - inline BOOL flagAllowInventoryAdd() const { return ((mFlags & FLAGS_ALLOW_INVENTORY_DROP) != 0); } - inline BOOL flagTemporaryOnRez() const { return ((mFlags & FLAGS_TEMPORARY_ON_REZ) != 0); } - inline BOOL flagAnimSource() const { return ((mFlags & FLAGS_ANIM_SOURCE) != 0); } - inline BOOL flagCameraSource() const { return ((mFlags & FLAGS_CAMERA_SOURCE) != 0); } - inline BOOL flagCameraDecoupled() const { return ((mFlags & FLAGS_CAMERA_DECOUPLED) != 0); } + bool permAnyOwner() const; + bool permYouOwner() const; + bool permGroupOwner() const; + bool permOwnerModify() const; + bool permModify() const; + bool permCopy() const; + bool permMove() const; + bool permTransfer() const; + inline bool flagUsePhysics() const { return ((mFlags & FLAGS_USE_PHYSICS) != 0); } + inline bool flagObjectAnyOwner() const { return ((mFlags & FLAGS_OBJECT_ANY_OWNER) != 0); } + inline bool flagObjectYouOwner() const { return ((mFlags & FLAGS_OBJECT_YOU_OWNER) != 0); } + inline bool flagObjectGroupOwned() const { return ((mFlags & FLAGS_OBJECT_GROUP_OWNED) != 0); } + inline bool flagObjectOwnerModify() const { return ((mFlags & FLAGS_OBJECT_OWNER_MODIFY) != 0); } + inline bool flagObjectModify() const { return ((mFlags & FLAGS_OBJECT_MODIFY) != 0); } + inline bool flagObjectCopy() const { return ((mFlags & FLAGS_OBJECT_COPY) != 0); } + inline bool flagObjectMove() const { return ((mFlags & FLAGS_OBJECT_MOVE) != 0); } + inline bool flagObjectTransfer() const { return ((mFlags & FLAGS_OBJECT_TRANSFER) != 0); } + inline bool flagObjectPermanent() const { return ((mFlags & FLAGS_AFFECTS_NAVMESH) != 0); } + inline bool flagCharacter() const { return ((mFlags & FLAGS_CHARACTER) != 0); } + inline bool flagVolumeDetect() const { return ((mFlags & FLAGS_VOLUME_DETECT) != 0); } + inline bool flagIncludeInSearch() const { return ((mFlags & FLAGS_INCLUDE_IN_SEARCH) != 0); } + inline bool flagScripted() const { return ((mFlags & FLAGS_SCRIPTED) != 0); } + inline bool flagHandleTouch() const { return ((mFlags & FLAGS_HANDLE_TOUCH) != 0); } + inline bool flagTakesMoney() const { return ((mFlags & FLAGS_TAKES_MONEY) != 0); } + inline bool flagPhantom() const { return ((mFlags & FLAGS_PHANTOM) != 0); } + inline bool flagInventoryEmpty() const { return ((mFlags & FLAGS_INVENTORY_EMPTY) != 0); } + inline bool flagAllowInventoryAdd() const { return ((mFlags & FLAGS_ALLOW_INVENTORY_DROP) != 0); } + inline bool flagTemporaryOnRez() const { return ((mFlags & FLAGS_TEMPORARY_ON_REZ) != 0); } + inline bool flagAnimSource() const { return ((mFlags & FLAGS_ANIM_SOURCE) != 0); } + inline bool flagCameraSource() const { return ((mFlags & FLAGS_CAMERA_SOURCE) != 0); } + inline bool flagCameraDecoupled() const { return ((mFlags & FLAGS_CAMERA_DECOUPLED) != 0); } U8 getPhysicsShapeType() const; inline F32 getPhysicsGravity() const { return mPhysicsGravity; } @@ -582,7 +591,7 @@ public: void setIncludeInSearch(bool include_in_search); // Does "open" object menu item apply? - BOOL allowOpen() const; + bool allowOpen() const; void setClickAction(U8 action) { mClickAction = action; } U8 getClickAction() const { return mClickAction; } @@ -591,10 +600,10 @@ public: void setRegion(LLViewerRegion *regionp); virtual void updateRegion(LLViewerRegion *regionp); - void updateFlags(BOOL physics_changed = FALSE); + void updateFlags(bool physics_changed = false); void loadFlags(U32 flags); //load flags from cache or from message - BOOL setFlags(U32 flag, BOOL state); - BOOL setFlagsWithoutUpdate(U32 flag, BOOL state); + bool setFlags(U32 flag, bool state); + bool setFlagsWithoutUpdate(U32 flag, bool state); void setPhysicsShapeType(U8 type); void setPhysicsGravity(F32 gravity); void setPhysicsFriction(F32 friction); @@ -613,11 +622,11 @@ public: virtual LLNetworkData* getParameterEntry(U16 param_type) const; virtual bool setParameterEntry(U16 param_type, const LLNetworkData& new_value, bool local_origin); - virtual BOOL getParameterEntryInUse(U16 param_type) const; - virtual bool setParameterEntryInUse(U16 param_type, BOOL in_use, bool local_origin); + virtual bool getParameterEntryInUse(U16 param_type) const; + virtual bool setParameterEntryInUse(U16 param_type, bool in_use, bool local_origin); // Called when a parameter is changed virtual void parameterChanged(U16 param_type, bool local_origin); - virtual void parameterChanged(U16 param_type, LLNetworkData* data, BOOL in_use, bool local_origin); + virtual void parameterChanged(U16 param_type, LLNetworkData* data, bool in_use, bool local_origin); bool isShrinkWrapped() const { return mShouldShrinkWrap; } @@ -643,7 +652,7 @@ public: public: //counter-translation - void resetChildrenPosition(const LLVector3& offset, BOOL simplified = FALSE, BOOL skip_avatar_child = FALSE) ; + void resetChildrenPosition(const LLVector3& offset, bool simplified = false, bool skip_avatar_child = false) ; //counter-rotation void resetChildrenRotationAndPosition(const std::vector<LLQuaternion>& rotations, const std::vector<LLVector3>& positions) ; @@ -721,7 +730,7 @@ public: // true if user can select this object by clicking under any circumstances (even if pick_unselectable is true) // can likely be factored out - BOOL mbCanSelect; + bool mbCanSelect; private: // Grabbed from UPDATE_FLAGS @@ -736,17 +745,22 @@ public: F32 mPhysicsDensity; F32 mPhysicsRestitution; + // set the GLTF asset for this LLViewerObject to the specified asset id + // id MUST be for a GLTF asset (LLAssetType::AT_GLTF) + // will relesae any currently held references to a GLTF asset on id change + void setGLTFAsset(const LLUUID& id); + // Associated GLTF Asset - LLPointer<LL::GLTF::Asset> mGLTFAsset; + std::shared_ptr<LL::GLTF::Asset> mGLTFAsset; // Pipeline classes LLPointer<LLDrawable> mDrawable; // Band-aid to select object after all creation initialization is done - BOOL mCreateSelected; + bool mCreateSelected; // Replace textures with web pages on this object while drawing - BOOL mRenderMedia; + bool mRenderMedia; bool mRiggedAttachedWarned; @@ -760,7 +774,7 @@ public: std::string mHudText; LLColor4 mHudTextColor; - static BOOL sUseSharedDrawables; + static bool sUseSharedDrawables; public: // Returns mControlAvatar for the edit root prim of this linkset @@ -795,10 +809,8 @@ protected: static LLViewerObject *createObject(const LLUUID &id, LLPCode pcode, LLViewerRegion *regionp, S32 flags = 0); - BOOL setData(const U8 *datap, const U32 data_size); - // Hide or show HUD, icon and particles - void hideExtraDisplayItems( BOOL hidden ); + void hideExtraDisplayItems( bool hidden ); ////////////////////////// // @@ -806,11 +818,11 @@ protected: // static void processTaskInvFile(void** user_data, S32 error_code, LLExtStat ext_status); - BOOL loadTaskInvFile(const std::string& filename); + bool loadTaskInvFile(const std::string& filename); void loadTaskInvLLSD(const LLSD &inv_result); void doInventoryCallback(); - BOOL isOnMap(); + bool isOnMap(); void unpackParticleSource(const S32 block_num, const LLUUID& owner_id); void unpackParticleSource(LLDataPacker &dp, const LLUUID& owner_id, bool legacy); @@ -871,15 +883,15 @@ protected: }; EInventoryRequestState mInvRequestState; U64 mInvRequestXFerId; - BOOL mInventoryDirty; + bool mInventoryDirty; LLViewerRegion *mRegionp; // Region that this object belongs to. - BOOL mDead; - BOOL mOrphaned; // This is an orphaned child - BOOL mUserSelected; // Cached user select information - BOOL mOnActiveList; - BOOL mOnMap; // On the map. - BOOL mStatic; // Object doesn't move. + bool mDead; + bool mOrphaned; // This is an orphaned child + bool mUserSelected; // Cached user select information + bool mOnActiveList; + bool mOnMap; // On the map. + bool mStatic; // Object doesn't move. S32 mSeatCount; S32 mNumFaces; @@ -903,11 +915,11 @@ protected: static U32 sNumZombieObjects; // Objects which are dead, but not deleted - static BOOL sMapDebug; // Map render mode + static bool sMapDebug; // Map render mode static LLColor4 sEditSelectColor; static LLColor4 sNoEditSelectColor; static F32 sCurrentPulse; - static BOOL sPulseEnabled; + static bool sPulseEnabled; static S32 sAxisArrowLength; @@ -920,8 +932,8 @@ protected: static void setMaxUpdateInterpolationTime(F32 value) { sMaxUpdateInterpolationTime = (F64Seconds) value; } static void setMaxRegionCrossingInterpolationTime(F32 value) { sMaxRegionCrossingInterpolationTime = (F64Seconds) value; } - static void setVelocityInterpolate(BOOL value) { sVelocityInterpolate = value; } - static void setPingInterpolate(BOOL value) { sPingInterpolate = value; } + static void setVelocityInterpolate(bool value) { sVelocityInterpolate = value; } + static void setPingInterpolate(bool value) { sPingInterpolate = value; } private: static S32 sNumObjects; @@ -930,8 +942,8 @@ private: static F64Seconds sMaxUpdateInterpolationTime; // For motion interpolation static F64Seconds sMaxRegionCrossingInterpolationTime; // For motion interpolation - static BOOL sVelocityInterpolate; - static BOOL sPingInterpolate; + static bool sVelocityInterpolate; + static bool sPingInterpolate; bool mCachedOwnerInMuteList; F64 mCachedMuteListUpdateTime; @@ -945,8 +957,8 @@ public: const LLUUID &extractAttachmentItemID(); // find&set the inventory item ID of the attached object EObjectUpdateType getLastUpdateType() const; void setLastUpdateType(EObjectUpdateType last_update_type); - BOOL getLastUpdateCached() const; - void setLastUpdateCached(BOOL last_update_cached); + bool getLastUpdateCached() const; + void setLastUpdateCached(bool last_update_cached); virtual void updateRiggingInfo() {} @@ -955,7 +967,7 @@ public: private: LLUUID mAttachmentItemID; // ItemID of the associated object is in user inventory. EObjectUpdateType mLastUpdateType; - BOOL mLastUpdateCached; + bool mLastUpdateCached; public: // reflection probe state @@ -974,14 +986,14 @@ public: // // -inline void LLViewerObject::setRotation(const LLQuaternion& quat, BOOL damped) +inline void LLViewerObject::setRotation(const LLQuaternion& quat, bool damped) { LLPrimitive::setRotation(quat); setChanged(ROTATED | SILHOUETTE); updateDrawable(damped); } -inline void LLViewerObject::setRotation(const F32 x, const F32 y, const F32 z, BOOL damped) +inline void LLViewerObject::setRotation(const F32 x, const F32 y, const F32 z, bool damped) { LLPrimitive::setRotation(x, y, z); setChanged(ROTATED | SILHOUETTE); @@ -991,10 +1003,10 @@ inline void LLViewerObject::setRotation(const F32 x, const F32 y, const F32 z, B class LLViewerObjectMedia { public: - LLViewerObjectMedia() : mMediaURL(), mPassedWhitelist(FALSE), mMediaType(0) { } + LLViewerObjectMedia() : mMediaURL(), mPassedWhitelist(false), mMediaType(0) { } std::string mMediaURL; // for web pages on surfaces, one per prim - BOOL mPassedWhitelist; // user has OK'd display + bool mPassedWhitelist; // user has OK'd display U8 mMediaType; // see LLTextureEntry::WEB_PAGE, etc. }; @@ -1023,11 +1035,11 @@ public: class LLStaticViewerObject : public LLViewerObject { public: - LLStaticViewerObject(const LLUUID& id, const LLPCode pcode, LLViewerRegion* regionp, BOOL is_global = FALSE) + LLStaticViewerObject(const LLUUID& id, const LLPCode pcode, LLViewerRegion* regionp, bool is_global = false) : LLViewerObject(id,pcode,regionp, is_global) { } - virtual void updateDrawable(BOOL force_damped); + virtual void updateDrawable(bool force_damped); }; diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 49bd5007c4..08a1ba0f9b 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -86,7 +86,7 @@ #include <iterator> extern F32 gMinObjectDistance; -extern BOOL gAnimateTextures; +extern bool gAnimateTextures; #define MAX_CONCURRENT_PHYSICS_REQUESTS 256 @@ -109,7 +109,7 @@ LLViewerObjectList::LLViewerObjectList() mNumDeadObjects = 0; mNumOrphans = 0; mNumNewObjects = 0; - mWasPaused = FALSE; + mWasPaused = false; mNumDeadObjectUpdates = 0; mNumUnknownUpdates = 0; } @@ -167,7 +167,7 @@ U64 LLViewerObjectList::getIndex(const U32 local_id, return (((U64)index) << 32) | (U64)local_id; } -BOOL LLViewerObjectList::removeFromLocalIDTable(const LLViewerObject* objectp) +bool LLViewerObjectList::removeFromLocalIDTable(const LLViewerObject* objectp) { LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; @@ -186,21 +186,21 @@ BOOL LLViewerObjectList::removeFromLocalIDTable(const LLViewerObject* objectp) std::map<U64, LLUUID>::iterator iter = sIndexAndLocalIDToUUID.find(indexid); if (iter == sIndexAndLocalIDToUUID.end()) { - return FALSE; + return false; } // Found existing entry if (iter->second == objectp->getID()) { // Full UUIDs match, so remove the entry sIndexAndLocalIDToUUID.erase(iter); - return TRUE; + return true; } // UUIDs did not match - this would zap a valid entry, so don't erase it //LL_INFOS() << "Tried to erase entry where id in table (" // << iter->second << ") did not match object " << object.getID() << LL_ENDL; } - return FALSE ; + return false ; } void LLViewerObjectList::setUUIDAndLocal(const LLUUID &id, @@ -391,7 +391,7 @@ LLViewerObject* LLViewerObjectList::processObjectUpdateFromCache(LLVOCacheEntry* else { objectp->setLastUpdateType(OUT_FULL_COMPRESSED); //newly cached - objectp->setLastUpdateCached(TRUE); + objectp->setLastUpdateCached(true); } LLVOAvatar::cullAvatarsByPixelArea(); @@ -471,7 +471,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, for (i = 0; i < num_objects; i++) { - BOOL justCreated = FALSE; + bool justCreated = false; bool update_cache = false; //update object cache if it is a full-update or terse update if (compressed) @@ -646,7 +646,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, continue; } - justCreated = TRUE; + justCreated = true; mNumNewObjects++; } @@ -1318,7 +1318,7 @@ void LLViewerObjectList::cleanupReferences(LLViewerObject *objectp) if (objectp->onActiveList()) { //LL_INFOS() << "Removing " << objectp->mID << " " << objectp->getPCodeString() << " from active list in cleanupReferences." << LL_ENDL; - objectp->setOnActiveList(FALSE); + objectp->setOnActiveList(false); removeFromActiveList(objectp); } @@ -1335,7 +1335,7 @@ void LLViewerObjectList::cleanupReferences(LLViewerObject *objectp) } } -BOOL LLViewerObjectList::killObject(LLViewerObject *objectp) +bool LLViewerObjectList::killObject(LLViewerObject *objectp) { LL_PROFILE_ZONE_SCOPED; // Don't ever kill gAgentAvatarp, just force it to the agent's region @@ -1343,7 +1343,7 @@ BOOL LLViewerObjectList::killObject(LLViewerObject *objectp) if ((objectp == gAgentAvatarp) && gAgent.getRegion()) { objectp->setRegion(gAgent.getRegion()); - return FALSE; + return false; } // When we're killing objects, all we do is mark them as dead. @@ -1356,10 +1356,10 @@ BOOL LLViewerObjectList::killObject(LLViewerObject *objectp) // so create a pointer to make sure object will stay alive untill markDead() finishes LLPointer<LLViewerObject> sp(objectp); sp->markDead(); // does the right thing if object already dead - return TRUE; + return true; } - return FALSE; + return false; } void LLViewerObjectList::killObjects(LLViewerRegion *regionp) @@ -1379,7 +1379,7 @@ void LLViewerObjectList::killObjects(LLViewerRegion *regionp) } // Have to clean right away because the region is becoming invalid. - cleanDeadObjects(FALSE); + cleanDeadObjects(false); } void LLViewerObjectList::killAllObjects() @@ -1395,7 +1395,7 @@ void LLViewerObjectList::killAllObjects() llassert((objectp == gAgentAvatarp) || objectp->isDead()); } - cleanDeadObjects(FALSE); + cleanDeadObjects(false); if(!mObjects.empty()) { @@ -1416,7 +1416,7 @@ void LLViewerObjectList::killAllObjects() } } -void LLViewerObjectList::cleanDeadObjects(BOOL use_timer) +void LLViewerObjectList::cleanDeadObjects(bool use_timer) { if (!mNumDeadObjects) { @@ -1480,7 +1480,7 @@ void LLViewerObjectList::removeFromActiveList(LLViewerObject* objectp) objectp->setListIndex(-1); - S32 last_index = mActiveObjects.size()-1; + S32 last_index = static_cast<S32>(mActiveObjects.size()) - 1; if (idx != last_index) { @@ -1501,7 +1501,7 @@ void LLViewerObjectList::updateActive(LLViewerObject *objectp) return; // We don't update dead objects! } - BOOL active = objectp->isActive(); + bool active = objectp->isActive(); if (active != objectp->onActiveList()) { if (active) @@ -1511,8 +1511,8 @@ void LLViewerObjectList::updateActive(LLViewerObject *objectp) if (idx <= -1) { mActiveObjects.push_back(objectp); - objectp->setListIndex(mActiveObjects.size()-1); - objectp->setOnActiveList(TRUE); + objectp->setListIndex(static_cast<S32>(mActiveObjects.size()) - 1); + objectp->setOnActiveList(true); } else { @@ -1530,7 +1530,7 @@ void LLViewerObjectList::updateActive(LLViewerObject *objectp) { //LL_INFOS() << "Removing " << objectp->mID << " " << objectp->getPCodeString() << " from active list." << LL_ENDL; removeFromActiveList(objectp); - objectp->setOnActiveList(FALSE); + objectp->setOnActiveList(false); } } @@ -1804,7 +1804,7 @@ void LLViewerObjectList::renderObjectBounds(const LLVector3 ¢er) { } -extern BOOL gCubeSnapshot; +extern bool gCubeSnapshot; void LLViewerObjectList::addDebugBeacon(const LLVector3 &pos_agent, const std::string &string, @@ -1953,7 +1953,7 @@ void LLViewerObjectList::orphanize(LLViewerObject *childp, U32 parent_id, U32 ip LL_DEBUGS("ORPHANS") << "Orphaning object " << childp->getID() << " with parent " << parent_id << LL_ENDL; // We're an orphan, flag things appropriately. - childp->mOrphaned = TRUE; + childp->mOrphaned = true; if (childp->mDrawable.notNull()) { bool make_invisible = true; @@ -2026,7 +2026,7 @@ void LLViewerObjectList::findOrphans(LLViewerObject* objectp, U32 ip, U32 port) } U64 parent_info = getIndex(objectp->mLocalID, ip, port); - BOOL orphans_found = FALSE; + bool orphans_found = false; // Iterate through the orphan list, and set parents of matching children. for (std::vector<OrphanInfo>::iterator iter = mOrphanChildren.begin(); iter != mOrphanChildren.end(); ) @@ -2058,7 +2058,7 @@ void LLViewerObjectList::findOrphans(LLViewerObject* objectp, U32 ip, U32 port) objectp->setChanged(LLXform::MOVED | LLXform::SILHOUETTE); // Flag the object as no longer orphaned - childp->mOrphaned = FALSE; + childp->mOrphaned = false; if (childp->mDrawable.notNull()) { // Make the drawable visible again and set the drawable parent @@ -2068,10 +2068,10 @@ void LLViewerObjectList::findOrphans(LLViewerObject* objectp, U32 ip, U32 port) } // Make certain particles, icon and HUD aren't hidden - childp->hideExtraDisplayItems( FALSE ); + childp->hideExtraDisplayItems( false ); objectp->addChild(childp); - orphans_found = TRUE; + orphans_found = true; ++iter; } else diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h index fcf4d7ff98..f0f236d6ae 100644 --- a/indra/newview/llviewerobjectlist.h +++ b/indra/newview/llviewerobjectlist.h @@ -74,11 +74,11 @@ public: LLViewerObject *replaceObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); // TomY: hack to switch VO instances on the fly - BOOL killObject(LLViewerObject *objectp); + bool killObject(LLViewerObject *objectp); void killObjects(LLViewerRegion *regionp); // Kill all objects owned by a particular region. void killAllObjects(); - void cleanDeadObjects(const BOOL use_timer = TRUE); // Clean up the dead object list. + void cleanDeadObjects(const bool use_timer = true); // Clean up the dead object list. // Simulator and viewer side object updates... void processUpdateCore(LLViewerObject* objectp, void** data, U32 block, const EObjectUpdateType update_type, @@ -169,7 +169,7 @@ public: // if we paused in the last frame // used to discount stats from this frame - BOOL mWasPaused; + bool mWasPaused; static void getUUIDFromLocal(LLUUID &id, const U32 local_id, @@ -180,7 +180,7 @@ public: const U32 ip, const U32 port); // Requires knowledge of message system info! - static BOOL removeFromLocalIDTable(const LLViewerObject* objectp); + static bool removeFromLocalIDTable(const LLViewerObject* objectp); // Used ONLY by the orphaned object code. static U64 getIndex(const U32 local_id, const U32 ip, const U32 port); diff --git a/indra/newview/llvieweroctree.cpp b/indra/newview/llvieweroctree.cpp index 3763af7aa8..a1c2e0f9ff 100644 --- a/indra/newview/llvieweroctree.cpp +++ b/indra/newview/llvieweroctree.cpp @@ -38,7 +38,7 @@ //static variables definitions //----------------------------------------------------------------------------------- U32 LLViewerOctreeEntryData::sCurVisible = 10; //reserve the low numbers for special use. -BOOL LLViewerOctreeDebug::sInDebug = FALSE; +bool LLViewerOctreeDebug::sInDebug = false; static LLTrace::CountStatHandle<S32> sOcclusionQueries("occlusion_queries", "Number of occlusion queries executed"), sNumObjectsOccluded("occluded_objects", "Count of objects being occluded by a query"), @@ -566,7 +566,7 @@ void LLViewerOctreeGroup::rebound() } else if (mOctreeNode->getChildCount() == 0) { //copy object bounding box if this is a leaf - boundObjects(TRUE, mExtents[0], mExtents[1]); + boundObjects(true, mExtents[0], mExtents[1]); mBounds[0] = mObjectBounds[0]; mBounds[1] = mObjectBounds[1]; } @@ -594,7 +594,7 @@ void LLViewerOctreeGroup::rebound() newMin.setMin(newMin, min); } - boundObjects(FALSE, newMin, newMax); + boundObjects(false, newMin, newMax); mBounds[0].setAdd(newMin, newMax); mBounds[0].mul(0.5f); @@ -700,7 +700,7 @@ LLViewerOctreeGroup* LLViewerOctreeGroup::getParent() } //virtual -bool LLViewerOctreeGroup::boundObjects(BOOL empty, LLVector4a& minOut, LLVector4a& maxOut) +bool LLViewerOctreeGroup::boundObjects(bool empty, LLVector4a& minOut, LLVector4a& maxOut) { const OctreeNode* node = mOctreeNode; @@ -754,19 +754,19 @@ bool LLViewerOctreeGroup::boundObjects(BOOL empty, LLVector4a& minOut, LLVector4 maxOut.setMax(maxOut, newMax); } - return TRUE; + return true; } //virtual -BOOL LLViewerOctreeGroup::isVisible() const +bool LLViewerOctreeGroup::isVisible() const { - return mVisible[LLViewerCamera::sCurCameraID] >= LLViewerOctreeEntryData::getCurrentFrame() ? TRUE : FALSE; + return mVisible[LLViewerCamera::sCurCameraID] >= LLViewerOctreeEntryData::getCurrentFrame(); } //virtual -BOOL LLViewerOctreeGroup::isRecentlyVisible() const +bool LLViewerOctreeGroup::isRecentlyVisible() const { - return FALSE; + return false; } void LLViewerOctreeGroup::setVisible() @@ -886,18 +886,18 @@ LLOcclusionCullingGroup::~LLOcclusionCullingGroup() releaseOcclusionQueryObjectNames(); } -BOOL LLOcclusionCullingGroup::needsUpdate() +bool LLOcclusionCullingGroup::needsUpdate() { - return (LLDrawable::getCurrentFrame() % mSpatialPartition->mLODPeriod == mLODHash) ? TRUE : FALSE; + return LLDrawable::getCurrentFrame() % mSpatialPartition->mLODPeriod == mLODHash; } -BOOL LLOcclusionCullingGroup::isRecentlyVisible() const +bool LLOcclusionCullingGroup::isRecentlyVisible() const { const S32 MIN_VIS_FRAME_RANGE = 2; return (LLDrawable::getCurrentFrame() - mVisible[LLViewerCamera::sCurCameraID]) < MIN_VIS_FRAME_RANGE ; } -BOOL LLOcclusionCullingGroup::isAnyRecentlyVisible() const +bool LLOcclusionCullingGroup::isAnyRecentlyVisible() const { const S32 MIN_VIS_FRAME_RANGE = 2; return (LLDrawable::getCurrentFrame() - mAnyVisible) < MIN_VIS_FRAME_RANGE ; @@ -906,7 +906,7 @@ BOOL LLOcclusionCullingGroup::isAnyRecentlyVisible() const //virtual void LLOcclusionCullingGroup::handleChildAddition(const OctreeNode* parent, OctreeNode* child) { - if (child->getListenerCount() == 0) + if (!child->hasListeners()) { new LLOcclusionCullingGroup(child, mSpatialPartition); } @@ -1055,12 +1055,12 @@ void LLOcclusionCullingGroup::clearOcclusionState(U32 state, S32 mode /* = STATE } } -BOOL LLOcclusionCullingGroup::earlyFail(LLCamera* camera, const LLVector4a* bounds) +bool LLOcclusionCullingGroup::earlyFail(LLCamera* camera, const LLVector4a* bounds) { LL_PROFILE_ZONE_SCOPED_CATEGORY_OCTREE; if (camera->getOrigin().isExactlyZero()) { - return FALSE; + return false; } const F32 vel = SG_OCCLUSION_FUDGE*2.f; @@ -1073,7 +1073,7 @@ BOOL LLOcclusionCullingGroup::earlyFail(LLCamera* camera, const LLVector4a* boun /*if (r.magVecSquared() > 1024.0*1024.0) { - return TRUE; + return true; }*/ LLVector4a e; @@ -1087,16 +1087,16 @@ BOOL LLOcclusionCullingGroup::earlyFail(LLCamera* camera, const LLVector4a* boun S32 lt = e.lessThan(min).getGatheredBits() & 0x7; if (lt) { - return FALSE; + return false; } S32 gt = e.greaterThan(max).getGatheredBits() & 0x7; if (gt) { - return FALSE; + return false; } - return TRUE; + return true; } U32 LLOcclusionCullingGroup::getLastOcclusionIssuedTime() @@ -1135,7 +1135,7 @@ void LLOcclusionCullingGroup::checkOcclusion() mOcclusionCheckCount[LLViewerCamera::sCurCameraID]++; } - static LLCachedControl<S32> occlusion_timeout(gSavedSettings, "RenderOcclusionTimeout", 4); + static LLCachedControl<U32> occlusion_timeout(gSavedSettings, "RenderOcclusionTimeout", 4); if (available || mOcclusionCheckCount[LLViewerCamera::sCurCameraID] > occlusion_timeout) { @@ -1309,7 +1309,7 @@ void LLOcclusionCullingGroup::doOcclusion(LLCamera* camera, const LLVector4a* sh //----------------------------------------------------------------------------------- LLViewerOctreePartition::LLViewerOctreePartition() : mRegionp(NULL), - mOcclusionEnabled(TRUE), + mOcclusionEnabled(true), mDrawableType(0), mLODSeed(0), mLODPeriod(1) @@ -1332,7 +1332,7 @@ void LLViewerOctreePartition::cleanup() mOctree = nullptr; } -BOOL LLViewerOctreePartition::isOcclusionEnabled() +bool LLViewerOctreePartition::isOcclusionEnabled() { return mOcclusionEnabled || LLPipeline::sUseOcclusion > 2; } diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index 2a072056df..60e17a6f58 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -213,11 +213,11 @@ public: virtual void unbound(); virtual void rebound(); - BOOL isDead() { return hasState(DEAD); } + bool isDead() { return hasState(DEAD); } void setVisible(); - BOOL isVisible() const; - virtual BOOL isRecentlyVisible() const; + bool isVisible() const; + virtual bool isRecentlyVisible() const; S32 getVisible(LLViewerCamera::eCameraID id) const {return mVisible[id];} S32 getAnyVisible() const {return mAnyVisible;} bool isEmpty() const { return mOctreeNode->isEmpty(); } @@ -253,7 +253,7 @@ public: protected: void checkStates(); private: - virtual bool boundObjects(BOOL empty, LLVector4a& minOut, LLVector4a& maxOut); + virtual bool boundObjects(bool empty, LLVector4a& minOut, LLVector4a& maxOut); protected: U32 mState; @@ -305,19 +305,19 @@ public: void clearOcclusionState(U32 state, S32 mode = STATE_MODE_SINGLE); void checkOcclusion(); //read back last occlusion query (if any) void doOcclusion(LLCamera* camera, const LLVector4a* shift = NULL); //issue occlusion query - BOOL isOcclusionState(U32 state) const { return mOcclusionState[LLViewerCamera::sCurCameraID] & state ? TRUE : FALSE; } - U32 getOcclusionState() const { return mOcclusionState[LLViewerCamera::sCurCameraID];} + bool isOcclusionState(U32 state) const { return mOcclusionState[LLViewerCamera::sCurCameraID] & state; } + U32 getOcclusionState() const { return mOcclusionState[LLViewerCamera::sCurCameraID];} - BOOL needsUpdate(); + bool needsUpdate(); U32 getLastOcclusionIssuedTime(); //virtual void handleChildAddition(const OctreeNode* parent, OctreeNode* child); //virtual - BOOL isRecentlyVisible() const; + bool isRecentlyVisible() const; LLViewerOctreePartition* getSpatialPartition()const {return mSpatialPartition;} - BOOL isAnyRecentlyVisible() const; + bool isAnyRecentlyVisible() const; static U32 getNewOcclusionQueryObjectName(); static void releaseOcclusionQueryObjectName(U32 name); @@ -326,7 +326,7 @@ protected: void releaseOcclusionQueryObjectNames(); private: - BOOL earlyFail(LLCamera* camera, const LLVector4a* bounds); + bool earlyFail(LLCamera* camera, const LLVector4a* bounds); protected: U32 mOcclusionState[LLViewerCamera::NUM_CAMERAS]; @@ -350,7 +350,7 @@ public: // Cull on arbitrary frustum virtual S32 cull(LLCamera &camera, bool do_occlusion) = 0; - BOOL isOcclusionEnabled(); + bool isOcclusionEnabled(); protected: // MUST call from destructor of any derived classes (SL-17276) @@ -361,7 +361,7 @@ public: U32 mDrawableType; OctreeNode* mOctree; LLViewerRegion* mRegionp; // the region this partition belongs to. - BOOL mOcclusionEnabled; // if TRUE, occlusion culling is performed + bool mOcclusionEnabled; // if true, occlusion culling is performed U32 mLODSeed; U32 mLODPeriod; //number of frames between LOD updates for a given spatial group (staggered by mLODSeed) }; @@ -419,7 +419,7 @@ public: virtual void visit(const OctreeNode* branch); public: - static BOOL sInDebug; + static bool sInDebug; }; #endif diff --git a/indra/newview/llviewerparcelmedia.cpp b/indra/newview/llviewerparcelmedia.cpp index bc9c2c7128..9af0062f1e 100644 --- a/indra/newview/llviewerparcelmedia.cpp +++ b/indra/newview/llviewerparcelmedia.cpp @@ -400,8 +400,8 @@ void LLViewerParcelMedia::processParcelMediaUpdate( LLMessageSystem *msg) std::string media_type; S32 media_width = 0; S32 media_height = 0; - U8 media_auto_scale = FALSE; - U8 media_loop = FALSE; + U8 media_auto_scale = 0; + U8 media_loop = 0; msg->getUUID( "DataBlock", "MediaID", media_id ); char media_url_buffer[257]; @@ -420,16 +420,15 @@ void LLViewerParcelMedia::processParcelMediaUpdate( LLMessageSystem *msg) } LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); - BOOL same = FALSE; if (parcel) { - same = ((parcel->getMediaURL() == media_url) && - (parcel->getMediaType() == media_type) && - (parcel->getMediaID() == media_id) && - (parcel->getMediaWidth() == media_width) && - (parcel->getMediaHeight() == media_height) && - (parcel->getMediaAutoScale() == media_auto_scale) && - (parcel->getMediaLoop() == media_loop)); + bool same = ((parcel->getMediaURL() == media_url) && + (parcel->getMediaType() == media_type) && + (parcel->getMediaID() == media_id) && + (parcel->getMediaWidth() == media_width) && + (parcel->getMediaHeight() == media_height) && + (parcel->getMediaAutoScale() == media_auto_scale) && + (parcel->getMediaLoop() == media_loop)); if (!same) { diff --git a/indra/newview/llviewerparcelmediaautoplay.cpp b/indra/newview/llviewerparcelmediaautoplay.cpp index 6e0db94985..41bc5c8cfa 100644 --- a/indra/newview/llviewerparcelmediaautoplay.cpp +++ b/indra/newview/llviewerparcelmediaautoplay.cpp @@ -49,7 +49,7 @@ LLViewerParcelMediaAutoPlay::LLViewerParcelMediaAutoPlay() : LLEventTimer(1), mLastParcelID(-1), - mPlayed(FALSE), + mPlayed(false), mTimeInParcel(0) { } @@ -57,10 +57,10 @@ LLViewerParcelMediaAutoPlay::LLViewerParcelMediaAutoPlay() : // static void LLViewerParcelMediaAutoPlay::playStarted() { - LLSingleton<LLViewerParcelMediaAutoPlay>::getInstance()->mPlayed = TRUE; + LLSingleton<LLViewerParcelMediaAutoPlay>::getInstance()->mPlayed = true; } -BOOL LLViewerParcelMediaAutoPlay::tick() +bool LLViewerParcelMediaAutoPlay::tick() { LLParcel *this_parcel = NULL; LLViewerRegion *this_region = NULL; @@ -94,7 +94,7 @@ BOOL LLViewerParcelMediaAutoPlay::tick() this_region_id != mLastRegionID) { // we've entered a new parcel - mPlayed = FALSE; // we haven't autoplayed yet + mPlayed = false; // we haven't autoplayed yet mTimeInParcel = 0; // reset our timer mLastParcelID = this_parcel_id; mLastRegionID = this_region_id; @@ -110,7 +110,7 @@ BOOL LLViewerParcelMediaAutoPlay::tick() { if (this_media_texture_id.notNull()) // and if the media texture is good { - LLViewerMediaTexture *image = LLViewerTextureManager::getMediaTexture(this_media_texture_id, FALSE) ; + LLViewerMediaTexture *image = LLViewerTextureManager::getMediaTexture(this_media_texture_id, false) ; F32 image_size = 0; @@ -149,14 +149,14 @@ BOOL LLViewerParcelMediaAutoPlay::tick() } } - mPlayed = TRUE; + mPlayed = true; } } } } - return FALSE; // continue ticking forever please. + return false; // continue ticking forever please. } //static diff --git a/indra/newview/llviewerparcelmediaautoplay.h b/indra/newview/llviewerparcelmediaautoplay.h index ee228e8425..96b569f126 100644 --- a/indra/newview/llviewerparcelmediaautoplay.h +++ b/indra/newview/llviewerparcelmediaautoplay.h @@ -35,7 +35,7 @@ class LLViewerParcelMediaAutoPlay : LLEventTimer, public LLSingleton<LLViewerPar { LLSINGLETON(LLViewerParcelMediaAutoPlay); public: - virtual BOOL tick() override; + virtual bool tick() override; static void playStarted(); private: @@ -45,7 +45,7 @@ public: private: S32 mLastParcelID; LLUUID mLastRegionID; - BOOL mPlayed; + bool mPlayed; F32 mTimeInParcel; }; diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index 17c0d00e79..8c24b2438b 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -116,7 +116,7 @@ struct LLGodForceOwnerData // Methods // LLViewerParcelMgr::LLViewerParcelMgr() -: mSelected(FALSE), +: mSelected(false), mRequestResult(0), mWestSouth(), mEastNorth(), @@ -126,8 +126,8 @@ LLViewerParcelMgr::LLViewerParcelMgr() mHoverWestSouth(), mHoverEastNorth(), mTeleportInProgressPosition(), - mRenderCollision(FALSE), - mRenderSelection(TRUE), + mRenderCollision(false), + mRenderSelection(true), mCollisionBanned(0), mCollisionTimer(), mMediaParcelId(0), @@ -151,8 +151,8 @@ LLViewerParcelMgr::LLViewerParcelMgr() // JC: Resolved a merge conflict here, eliminated // mBlockedImage->setAddressMode(LLTexUnit::TAM_WRAP); // because it is done in llviewertexturelist.cpp - mBlockedImage = LLViewerTextureManager::getFetchedTextureFromFile("world/NoEntryLines.png", FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_UI); - mPassImage = LLViewerTextureManager::getFetchedTextureFromFile("world/NoEntryPassLines.png", FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_UI); + mBlockedImage = LLViewerTextureManager::getFetchedTextureFromFile("world/NoEntryLines.png", FTT_LOCAL_FILE, true, LLGLTexture::BOOST_UI); + mPassImage = LLViewerTextureManager::getFetchedTextureFromFile("world/NoEntryPassLines.png", FTT_LOCAL_FILE, true, LLGLTexture::BOOST_UI); S32 overlay_size = mParcelsPerEdge * mParcelsPerEdge / PARCEL_OVERLAY_CHUNKS; sPackedOverlay = new U8[overlay_size]; @@ -164,7 +164,7 @@ LLViewerParcelMgr::LLViewerParcelMgr() mAgentParcelOverlay[i] = 0; } - mTeleportInProgress = TRUE; // the initial parcel update is treated like teleport + mTeleportInProgress = true; // the initial parcel update is treated like teleport } @@ -234,13 +234,13 @@ LLViewerRegion* LLViewerParcelMgr::getSelectionRegion() void LLViewerParcelMgr::getDisplayInfo(S32* area_out, S32* claim_out, S32* rent_out, - BOOL* for_sale_out, + bool* for_sale_out, F32* dwell_out) { S32 area = 0; S32 price = 0; S32 rent = 0; - BOOL for_sale = FALSE; + bool for_sale = false; F32 dwell = DWELL_NAN; if (mSelected) @@ -257,12 +257,12 @@ void LLViewerParcelMgr::getDisplayInfo(S32* area_out, S32* claim_out, if (mCurrentParcel->getForSale()) { price = mCurrentParcel->getSalePrice(); - for_sale = TRUE; + for_sale = true; } else { price = area * mCurrentParcel->getClaimPricePerMeter(); - for_sale = FALSE; + for_sale = false; } rent = mCurrentParcel->getTotalRent(); @@ -432,14 +432,14 @@ LLParcelSelectionHandle LLViewerParcelMgr::selectParcelAt(const LLVector3d& pos_ northeast.mdV[VY] = ll_round( northeast.mdV[VY], (F64)PARCEL_GRID_STEP_METERS ); // Snap to parcel - return selectLand( southwest, northeast, TRUE ); + return selectLand( southwest, northeast, true ); } // Tries to select the parcel inside the rectangle LLParcelSelectionHandle LLViewerParcelMgr::selectParcelInRectangle() { - return selectLand(mWestSouth, mEastNorth, TRUE); + return selectLand(mWestSouth, mEastNorth, true); } @@ -476,8 +476,8 @@ void LLViewerParcelMgr::selectCollisionParcel() mCurrentParcelSelection->setParcel(NULL); mCurrentParcelSelection = new LLParcelSelection(mCurrentParcel); - mSelected = TRUE; - mCurrentParcelSelection->mWholeParcelSelected = TRUE; + mSelected = true; + mCurrentParcelSelection->mWholeParcelSelected = true; notifyObservers(); return; } @@ -485,7 +485,7 @@ void LLViewerParcelMgr::selectCollisionParcel() // snap_selection = auto-select the hit parcel, if there is exactly one LLParcelSelectionHandle LLViewerParcelMgr::selectLand(const LLVector3d &corner1, const LLVector3d &corner2, - BOOL snap_selection) + bool snap_selection) { sanitize_corners( corner1, corner2, mWestSouth, mEastNorth ); @@ -493,7 +493,7 @@ LLParcelSelectionHandle LLViewerParcelMgr::selectLand(const LLVector3d &corner1, F32 delta_x = getSelectionWidth(); if (delta_x * delta_x <= 1.f * 1.f) { - mSelected = FALSE; + mSelected = false; notifyObservers(); return NULL; } @@ -502,7 +502,7 @@ LLParcelSelectionHandle LLViewerParcelMgr::selectLand(const LLVector3d &corner1, F32 delta_y = getSelectionHeight(); if (delta_y * delta_y <= 1.f * 1.f) { - mSelected = FALSE; + mSelected = false; notifyObservers(); return NULL; } @@ -520,14 +520,14 @@ LLParcelSelectionHandle LLViewerParcelMgr::selectLand(const LLVector3d &corner1, if(!region) { // just in case they somehow selected no land. - mSelected = FALSE; + mSelected = false; return NULL; } if (region != region_other) { LLNotificationsUtil::add("CantSelectLandFromMultipleRegions"); - mSelected = FALSE; + mSelected = false; notifyObservers(); return NULL; } @@ -557,7 +557,7 @@ LLParcelSelectionHandle LLViewerParcelMgr::selectLand(const LLVector3d &corner1, mCurrentParcelSelection->setParcel(NULL); mCurrentParcelSelection = new LLParcelSelection(mCurrentParcel); - mSelected = TRUE; + mSelected = true; mCurrentParcelSelection->mWholeParcelSelected = snap_selection; notifyObservers(); return mCurrentParcelSelection; @@ -576,7 +576,7 @@ void LLViewerParcelMgr::deselectLand() { if (mSelected) { - mSelected = FALSE; + mSelected = false; // Invalidate the selected parcel mCurrentParcel->setLocalID(-1); @@ -615,15 +615,13 @@ void LLViewerParcelMgr::removeObserver(LLParcelObserver* observer) void LLViewerParcelMgr::notifyObservers() { std::vector<LLParcelObserver*> observers; - S32 count = mObservers.size(); - S32 i; - for(i = 0; i < count; ++i) + for (auto observer : mObservers) { - observers.push_back(mObservers.at(i)); + observers.emplace_back(observer); } - for(i = 0; i < count; ++i) + for (auto observer : observers) { - observers.at(i)->changed(); + observer->changed(); } } @@ -631,7 +629,7 @@ void LLViewerParcelMgr::notifyObservers() // // ACCESSORS // -BOOL LLViewerParcelMgr::selectionEmpty() const +bool LLViewerParcelMgr::selectionEmpty() const { return !mSelected; } @@ -741,99 +739,99 @@ bool LLViewerParcelMgr::allowAgentDamage(const LLViewerRegion* region, const LLP || (parcel && parcel->getAllowDamage()); } -BOOL LLViewerParcelMgr::isOwnedAt(const LLVector3d& pos_global) const +bool LLViewerParcelMgr::isOwnedAt(const LLVector3d& pos_global) const { LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( pos_global ); - if (!region) return FALSE; + if (!region) return false; LLViewerParcelOverlay* overlay = region->getParcelOverlay(); - if (!overlay) return FALSE; + if (!overlay) return false; LLVector3 pos_region = region->getPosRegionFromGlobal( pos_global ); return overlay->isOwned( pos_region ); } -BOOL LLViewerParcelMgr::isOwnedSelfAt(const LLVector3d& pos_global) const +bool LLViewerParcelMgr::isOwnedSelfAt(const LLVector3d& pos_global) const { LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( pos_global ); - if (!region) return FALSE; + if (!region) return false; LLViewerParcelOverlay* overlay = region->getParcelOverlay(); - if (!overlay) return FALSE; + if (!overlay) return false; LLVector3 pos_region = region->getPosRegionFromGlobal( pos_global ); return overlay->isOwnedSelf( pos_region ); } -BOOL LLViewerParcelMgr::isOwnedOtherAt(const LLVector3d& pos_global) const +bool LLViewerParcelMgr::isOwnedOtherAt(const LLVector3d& pos_global) const { LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( pos_global ); - if (!region) return FALSE; + if (!region) return false; LLViewerParcelOverlay* overlay = region->getParcelOverlay(); - if (!overlay) return FALSE; + if (!overlay) return false; LLVector3 pos_region = region->getPosRegionFromGlobal( pos_global ); return overlay->isOwnedOther( pos_region ); } -BOOL LLViewerParcelMgr::isSoundLocal(const LLVector3d& pos_global) const +bool LLViewerParcelMgr::isSoundLocal(const LLVector3d& pos_global) const { LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( pos_global ); - if (!region) return FALSE; + if (!region) return false; LLViewerParcelOverlay* overlay = region->getParcelOverlay(); - if (!overlay) return FALSE; + if (!overlay) return false; LLVector3 pos_region = region->getPosRegionFromGlobal( pos_global ); return overlay->isSoundLocal( pos_region ); } -BOOL LLViewerParcelMgr::canHearSound(const LLVector3d &pos_global) const +bool LLViewerParcelMgr::canHearSound(const LLVector3d &pos_global) const { - BOOL in_agent_parcel = inAgentParcel(pos_global); + bool in_agent_parcel = inAgentParcel(pos_global); if (in_agent_parcel) { // In same parcel as the agent - return TRUE; + return true; } else { if (LLViewerParcelMgr::getInstance()->getAgentParcel()->getSoundLocal()) { // Not in same parcel, and agent parcel only has local sound - return FALSE; + return false; } else if (LLViewerParcelMgr::getInstance()->isSoundLocal(pos_global)) { // Not in same parcel, and target parcel only has local sound - return FALSE; + return false; } else { // Not in same parcel, but neither are local sound - return TRUE; + return true; } } } -BOOL LLViewerParcelMgr::inAgentParcel(const LLVector3d &pos_global) const +bool LLViewerParcelMgr::inAgentParcel(const LLVector3d &pos_global) const { LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal(pos_global); LLViewerRegion* agent_region = gAgent.getRegion(); if (!region || !agent_region) - return FALSE; + return false; if (region != agent_region) { // Can't be in the agent parcel if you're not in the same region. - return FALSE; + return false; } LLVector3 pos_region = agent_region->getPosRegionFromGlobal(pos_global); @@ -842,11 +840,11 @@ BOOL LLViewerParcelMgr::inAgentParcel(const LLVector3d &pos_global) const if (mAgentParcelOverlay[row*mParcelsPerEdge + column]) { - return TRUE; + return true; } else { - return FALSE; + return false; } } @@ -912,7 +910,7 @@ void LLViewerParcelMgr::renderParcelCollision() LLViewerRegion* regionp = gAgent.getRegion(); if (regionp) { - BOOL use_pass = mCollisionParcel->getParcelFlag(PF_USE_PASS_LIST); + bool use_pass = mCollisionParcel->getParcelFlag(PF_USE_PASS_LIST); renderCollisionSegments(mCollisionSegments, use_pass, regionp); } } @@ -1117,9 +1115,9 @@ public: LLUUID mAgent; LLUUID mSession; LLUUID mGroup; - BOOL mIsGroupOwned; - BOOL mRemoveContribution; - BOOL mIsClaim; + bool mIsGroupOwned; + bool mRemoveContribution; + bool mIsClaim; LLHost mHost; // for parcel buys @@ -1138,9 +1136,9 @@ LLViewerParcelMgr::ParcelBuyInfo* LLViewerParcelMgr::setupParcelBuy( const LLUUID& agent_id, const LLUUID& session_id, const LLUUID& group_id, - BOOL is_group_owned, - BOOL is_claim, - BOOL remove_contribution) + bool is_group_owned, + bool is_claim, + bool remove_contribution) { if (!mSelected || !mCurrentParcel) { @@ -1222,7 +1220,7 @@ void LLViewerParcelMgr::sendParcelBuy(ParcelBuyInfo* info) msg->addBOOL("RemoveContribution", info->mRemoveContribution); msg->addS32("LocalID", info->mParcelID); } - msg->addBOOL("Final", TRUE); // don't allow escrow buys + msg->addBOOL("Final", true); // don't allow escrow buys if (info->mIsClaim) { msg->nextBlock("ParcelData"); @@ -1478,7 +1476,7 @@ void LLViewerParcelMgr::setHoverParcel(const LLVector3d& pos) msg->addF32Fast(_PREHASH_South, south); msg->addF32Fast(_PREHASH_East, east); msg->addF32Fast(_PREHASH_North, north); - msg->addBOOL("SnapSelection", FALSE); + msg->addBOOL("SnapSelection", false); msg->sendReliable(region->getHost()); mHoverRequestResult = PARCEL_RESULT_NO_DATA; @@ -1534,13 +1532,13 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use S32 request_result; S32 sequence_id; - BOOL snap_selection = FALSE; + bool snap_selection = false; S32 self_count = 0; S32 other_count = 0; S32 public_count = 0; S32 local_id; LLUUID owner_id; - BOOL is_group_owned; + bool is_group_owned; U32 auction_id = 0; S32 claim_price_per_meter = 0; S32 rent_price_per_meter = 0; @@ -1559,15 +1557,15 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use S32 other_prims = 0; S32 selected_prims = 0; F32 parcel_prim_bonus = 1.f; - BOOL region_push_override = false; - BOOL region_deny_anonymous_override = false; - BOOL region_deny_identified_override = false; // Deprecated - BOOL region_deny_transacted_override = false; // Deprecated - BOOL region_deny_age_unverified_override = false; - BOOL region_allow_access_override = true; - BOOL region_allow_environment_override = true; + bool region_push_override = false; + bool region_deny_anonymous_override = false; + bool region_deny_identified_override = false; // Deprecated + bool region_deny_transacted_override = false; // Deprecated + bool region_deny_age_unverified_override = false; + bool region_allow_access_override = true; + bool region_allow_environment_override = true; S32 parcel_environment_version = 0; - BOOL agent_parcel_update = false; // updating previous(existing) agent parcel + bool agent_parcel_update = false; // updating previous(existing) agent parcel U32 extended_flags = 0; //obscure MOAP S32 other_clean_time = 0; @@ -1694,7 +1692,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use bool environment_changed = (cur_parcel_environment_version != parcel_environment_version); parcel->init(owner_id, - FALSE, FALSE, FALSE, + false, false, false, claim_date, claim_price_per_meter, rent_price_per_meter, area, other_prims, parcel_prim_bonus, is_group_owned); parcel->setLocalID(local_id); @@ -1742,7 +1740,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use if (instance->mTeleportInProgress) { - instance->mTeleportInProgress = FALSE; + instance->mTeleportInProgress = false; if(instance->mTeleportInProgressPosition.isNull()) { //initial update @@ -1758,7 +1756,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use // Notify anything that wants to know when the agent changes parcels gAgent.changeParcels(); - instance->mTeleportInProgress = FALSE; + instance->mTeleportInProgress = false; } else if (agent_parcel_update) { @@ -1801,7 +1799,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use west_south.mV[VY], east_north.mV[VX], east_north.mV[VY] ); - parcel_mgr.mCurrentParcelSelection->mWholeParcelSelected = FALSE; + parcel_mgr.mCurrentParcelSelection->mWholeParcelSelected = false; } else if (0 == local_id) { @@ -1815,7 +1813,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use aabb_min.mV[VY], aabb_max.mV[VX], aabb_max.mV[VY] ); - parcel_mgr.mCurrentParcelSelection->mWholeParcelSelected = TRUE; + parcel_mgr.mCurrentParcelSelection->mWholeParcelSelected = true; } else { @@ -1835,7 +1833,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use delete[] bitmap; bitmap = NULL; - parcel_mgr.mCurrentParcelSelection->mWholeParcelSelected = TRUE; + parcel_mgr.mCurrentParcelSelection->mWholeParcelSelected = true; } // Request access list information for this land @@ -1848,7 +1846,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use parcel_mgr.sendParcelDwellRequest(); } - parcel_mgr.mSelected = TRUE; + parcel_mgr.mSelected = true; parcel_mgr.notifyObservers(); } } @@ -2149,11 +2147,11 @@ void LLViewerParcelMgr::sendParcelAccessListUpdate(U32 which) void LLViewerParcelMgr::sendParcelAccessListUpdate(U32 flags, const LLAccessEntry::map& entries, LLViewerRegion* region, S32 parcel_local_id) { - S32 count = entries.size(); + S32 count = static_cast<S32>(entries.size()); S32 num_sections = (S32) ceil(count/PARCEL_MAX_ENTRIES_PER_PACKET); S32 sequence_id = 1; - BOOL start_message = TRUE; - BOOL initial = TRUE; + bool start_message = true; + bool initial = true; LLUUID transactionUUID; transactionUUID.generate(); @@ -2177,7 +2175,7 @@ void LLViewerParcelMgr::sendParcelAccessListUpdate(U32 flags, const LLAccessEntr msg->addUUIDFast(_PREHASH_TransactionID, transactionUUID); msg->addS32Fast(_PREHASH_SequenceID, sequence_id); msg->addS32Fast(_PREHASH_Sections, num_sections); - start_message = FALSE; + start_message = false; if (initial && (cit == end)) { @@ -2188,7 +2186,7 @@ void LLViewerParcelMgr::sendParcelAccessListUpdate(U32 flags, const LLAccessEntr msg->addU32Fast(_PREHASH_Flags, 0 ); } - initial = FALSE; + initial = false; sequence_id++; } @@ -2204,7 +2202,7 @@ void LLViewerParcelMgr::sendParcelAccessListUpdate(U32 flags, const LLAccessEntr ++cit; } - start_message = TRUE; + start_message = true; msg->sendReliable( region->getHost() ); } } @@ -2350,7 +2348,7 @@ bool LLViewerParcelMgr::canAgentBuyParcel(LLParcel* parcel, bool forGroup) const && ((parcel->getSalePrice() > 0) || (authorizeBuyer.notNull())); bool isEmpowered - = forGroup ? gAgent.hasPowerInActiveGroup(GP_LAND_DEED) == TRUE : true; + = forGroup ? gAgent.hasPowerInActiveGroup(GP_LAND_DEED) : true; bool isOwner = parcelOwner == (forGroup ? gAgent.getGroupID() : gAgent.getID()); @@ -2365,9 +2363,9 @@ bool LLViewerParcelMgr::canAgentBuyParcel(LLParcel* parcel, bool forGroup) const } -void LLViewerParcelMgr::startBuyLand(BOOL is_for_group) +void LLViewerParcelMgr::startBuyLand(bool is_for_group) { - LLFloaterBuyLand::buyLand(getSelectionRegion(), mCurrentParcelSelection, is_for_group == TRUE); + LLFloaterBuyLand::buyLand(getSelectionRegion(), mCurrentParcelSelection, is_for_group); } void LLViewerParcelMgr::startSellLand() @@ -2589,39 +2587,39 @@ void LLViewerParcelMgr::buyPass() } //Tells whether we are allowed to buy a pass or not -BOOL LLViewerParcelMgr::isCollisionBanned() +bool LLViewerParcelMgr::isCollisionBanned() { if ((mCollisionBanned == BA_ALLOWED) || (mCollisionBanned == BA_NOT_ON_LIST) || (mCollisionBanned == BA_NOT_IN_GROUP)) - return FALSE; + return false; else - return TRUE; + return true; } // This implementation should mirror LLSimParcelMgr::isParcelOwnedBy // static -BOOL LLViewerParcelMgr::isParcelOwnedByAgent(const LLParcel* parcelp, U64 group_proxy_power) +bool LLViewerParcelMgr::isParcelOwnedByAgent(const LLParcel* parcelp, U64 group_proxy_power) { if (!parcelp) { - return FALSE; + return false; } // Gods can always assume ownership. if (gAgent.isGodlike()) { - return TRUE; + return true; } // The owner of a parcel automatically gets all powersr. if (parcelp->getOwnerID() == gAgent.getID()) { - return TRUE; + return true; } // Only gods can assume 'ownership' of public land. if (parcelp->isPublic()) { - return FALSE; + return false; } // Return whether or not the agent has group_proxy_power powers in the @@ -2631,10 +2629,10 @@ BOOL LLViewerParcelMgr::isParcelOwnedByAgent(const LLParcel* parcelp, U64 group_ // This implementation should mirror llSimParcelMgr::isParcelModifiableBy // static -BOOL LLViewerParcelMgr::isParcelModifiableByAgent(const LLParcel* parcelp, U64 group_proxy_power) +bool LLViewerParcelMgr::isParcelModifiableByAgent(const LLParcel* parcelp, U64 group_proxy_power) { // If the agent can assume ownership, it is probably modifiable. - BOOL rv = FALSE; + bool rv = false; if (parcelp) { // *NOTE: This should only work for leased parcels, but group owned @@ -2646,7 +2644,7 @@ BOOL LLViewerParcelMgr::isParcelModifiableByAgent(const LLParcel* parcelp, U64 g && !gAgent.isGodlike() && (parcelp->getOwnershipStatus() != LLParcel::OS_LEASED) ) { - rv = FALSE; + rv = false; } } return rv; @@ -2718,7 +2716,7 @@ void LLViewerParcelMgr::onTeleportFinished(bool local, const LLVector3d& new_pos // The agent parcel data has not been updated yet. // Let's wait for the update and then emit the signal. mTeleportInProgressPosition = new_pos; - mTeleportInProgress = TRUE; + mTeleportInProgress = true; } } diff --git a/indra/newview/llviewerparcelmgr.h b/indra/newview/llviewerparcelmgr.h index 0394004b38..974ea39359 100644 --- a/indra/newview/llviewerparcelmgr.h +++ b/indra/newview/llviewerparcelmgr.h @@ -86,14 +86,14 @@ public: static void cleanupGlobals(); - BOOL selectionEmpty() const; + bool selectionEmpty() const; F32 getSelectionWidth() const { return F32(mEastNorth.mdV[VX] - mWestSouth.mdV[VX]); } F32 getSelectionHeight() const { return F32(mEastNorth.mdV[VY] - mWestSouth.mdV[VY]); } - BOOL getSelection(LLVector3d &min, LLVector3d &max) { min = mWestSouth; max = mEastNorth; return !selectionEmpty();} + bool getSelection(LLVector3d &min, LLVector3d &max) { min = mWestSouth; max = mEastNorth; return !selectionEmpty();} LLViewerRegion* getSelectionRegion(); F32 getDwelling() const { return mSelectedDwell;} - void getDisplayInfo(S32* area, S32* claim, S32* rent, BOOL* for_sale, F32* dwell); + void getDisplayInfo(S32* area, S32* claim, S32* rent, bool* for_sale, F32* dwell); // Returns selected area S32 getSelectedArea() const; @@ -121,7 +121,7 @@ public: // Select a piece of land LLParcelSelectionHandle selectLand(const LLVector3d &corner1, const LLVector3d &corner2, - BOOL snap_to_parcel); + bool snap_to_parcel); // Clear the selection, and stop drawing the highlight. void deselectLand(); @@ -131,14 +131,14 @@ public: void removeObserver(LLParcelObserver* observer); void notifyObservers(); - void setSelectionVisible(BOOL visible) { mRenderSelection = visible; } + void setSelectionVisible(bool visible) { mRenderSelection = visible; } - BOOL isOwnedAt(const LLVector3d& pos_global) const; - BOOL isOwnedSelfAt(const LLVector3d& pos_global) const; - BOOL isOwnedOtherAt(const LLVector3d& pos_global) const; - BOOL isSoundLocal(const LLVector3d &pos_global) const; + bool isOwnedAt(const LLVector3d& pos_global) const; + bool isOwnedSelfAt(const LLVector3d& pos_global) const; + bool isOwnedOtherAt(const LLVector3d& pos_global) const; + bool isSoundLocal(const LLVector3d &pos_global) const; - BOOL canHearSound(const LLVector3d &pos_global) const; + bool canHearSound(const LLVector3d &pos_global) const; // Returns a reference counted pointer to current parcel selection. // Selection does not change to reflect new selections made by user @@ -156,7 +156,7 @@ public: LLParcel *getAgentParcel() const; LLParcel *getAgentOrSelectedParcel() const; - BOOL inAgentParcel(const LLVector3d &pos_global) const; + bool inAgentParcel(const LLVector3d &pos_global) const; // Returns a pointer only when it has valid data. LLParcel* getHoverParcel() const; @@ -203,7 +203,7 @@ public: const LLVector3d &east_north_top ); void renderOneSegment(F32 x1, F32 y1, F32 x2, F32 y2, F32 height, U8 direction, LLViewerRegion* regionp); void renderHighlightSegments(const U8* segments, LLViewerRegion* regionp); - void renderCollisionSegments(U8* segments, BOOL use_pass, LLViewerRegion* regionp); + void renderCollisionSegments(U8* segments, bool use_pass, LLViewerRegion* regionp); static S32 PARCEL_BAN_LINES_HIDE; static S32 PARCEL_BAN_LINES_ON_COLLISION; @@ -237,8 +237,8 @@ public: bool canAgentBuyParcel(LLParcel*, bool forGroup) const; -// void startClaimLand(BOOL is_for_group = FALSE); - void startBuyLand(BOOL is_for_group = FALSE); +// void startClaimLand(bool is_for_group = false); + void startBuyLand(bool is_for_group = false); void startSellLand(); void startReleaseLand(); void startDivideLand(); @@ -254,9 +254,9 @@ public: ParcelBuyInfo* setupParcelBuy(const LLUUID& agent_id, const LLUUID& session_id, const LLUUID& group_id, - BOOL is_group_owned, - BOOL is_claim, - BOOL remove_contribution); + bool is_group_owned, + bool is_claim, + bool remove_contribution); // callers responsibility to call deleteParcelBuy() on return value void sendParcelBuy(ParcelBuyInfo*); void deleteParcelBuy(ParcelBuyInfo* *info); @@ -287,7 +287,7 @@ public: // Whether or not the collision border around the parcel is there because // the agent is banned or not in the allowed group - BOOL isCollisionBanned(); + bool isCollisionBanned(); boost::signals2::connection setTeleportFinishedCallback(teleport_finished_callback_t cb); boost::signals2::connection setTeleportFailedCallback(teleport_failed_callback_t cb); @@ -295,8 +295,8 @@ public: void onTeleportFailed(); bool getTeleportInProgress(); - static BOOL isParcelOwnedByAgent(const LLParcel* parcelp, U64 group_proxy_power); - static BOOL isParcelModifiableByAgent(const LLParcel* parcelp, U64 group_proxy_power); + static bool isParcelOwnedByAgent(const LLParcel* parcelp, U64 group_proxy_power); + static bool isParcelModifiableByAgent(const LLParcel* parcelp, U64 group_proxy_power); private: static void sendParcelAccessListUpdate(U32 flags, const std::map<LLUUID, class LLAccessEntry>& entries, LLViewerRegion* region, S32 parcel_local_id); @@ -319,12 +319,12 @@ private: static bool callbackDivideLand(const LLSD& notification, const LLSD& response); static bool callbackJoinLand(const LLSD& notification, const LLSD& response); - //void finishClaim(BOOL user_to_user_sale, U32 join); + //void finishClaim(bool user_to_user_sale, U32 join); LLViewerTexture* getBlockedImage() const; LLViewerTexture* getPassImage() const; private: - BOOL mSelected; + bool mSelected; LLParcel* mCurrentParcel; // selected parcel info LLParcelSelectionHandle mCurrentParcelSelection; @@ -344,7 +344,7 @@ private: std::vector<LLParcelObserver*> mObservers; - BOOL mTeleportInProgress; + bool mTeleportInProgress; LLVector3d mTeleportInProgressPosition; teleport_finished_signal_t mTeleportFinishedSignal; teleport_failed_signal_t mTeleportFailedSignal; @@ -367,7 +367,7 @@ private: LLParcel* mCollisionParcel; U8* mCollisionSegments; bool mRenderCollision; - BOOL mRenderSelection; + bool mRenderSelection; S32 mCollisionBanned; LLFrameTimer mCollisionTimer; LLViewerTexture* mBlockedImage; diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp index 5c9dbcea76..1f14aa4afc 100755 --- a/indra/newview/llviewerparceloverlay.cpp +++ b/indra/newview/llviewerparceloverlay.cpp @@ -56,15 +56,15 @@ static const F32 LINE_WIDTH = 0.0625f; LLViewerParcelOverlay::LLViewerParcelOverlay(LLViewerRegion* region, F32 region_width_meters) : mRegion( region ), mParcelGridsPerEdge( S32( region_width_meters / PARCEL_GRID_STEP_METERS ) ), - mDirty( FALSE ), + mDirty( false ), mTimeSinceLastUpdate(), mOverlayTextureIdx(-1) { // Create a texture to hold color information. // 4 components - // Use mipmaps = FALSE, clamped, NEAREST filter, for sharp edges + // Use mipmaps = false, clamped, NEAREST filter, for sharp edges mImageRaw = new LLImageRaw(mParcelGridsPerEdge, mParcelGridsPerEdge, OVERLAY_IMG_COMPONENTS); - mTexture = LLViewerTextureManager::getLocalTexture(mImageRaw.get(), FALSE); + mTexture = LLViewerTextureManager::getLocalTexture(mImageRaw.get(), false); mTexture->setAddressMode(LLTexUnit::TAM_CLAMP); mTexture->setFilteringOption(LLTexUnit::TFO_POINT); @@ -102,28 +102,28 @@ LLViewerParcelOverlay::~LLViewerParcelOverlay() //--------------------------------------------------------------------------- // ACCESSORS //--------------------------------------------------------------------------- -BOOL LLViewerParcelOverlay::isOwned(const LLVector3& pos) const +bool LLViewerParcelOverlay::isOwned(const LLVector3& pos) const { S32 row = S32(pos.mV[VY] / PARCEL_GRID_STEP_METERS); S32 column = S32(pos.mV[VX] / PARCEL_GRID_STEP_METERS); return (PARCEL_PUBLIC != ownership(row, column)); } -BOOL LLViewerParcelOverlay::isOwnedSelf(const LLVector3& pos) const +bool LLViewerParcelOverlay::isOwnedSelf(const LLVector3& pos) const { S32 row = S32(pos.mV[VY] / PARCEL_GRID_STEP_METERS); S32 column = S32(pos.mV[VX] / PARCEL_GRID_STEP_METERS); return (PARCEL_SELF == ownership(row, column)); } -BOOL LLViewerParcelOverlay::isOwnedGroup(const LLVector3& pos) const +bool LLViewerParcelOverlay::isOwnedGroup(const LLVector3& pos) const { S32 row = S32(pos.mV[VY] / PARCEL_GRID_STEP_METERS); S32 column = S32(pos.mV[VX] / PARCEL_GRID_STEP_METERS); return (PARCEL_GROUP == ownership(row, column)); } -BOOL LLViewerParcelOverlay::isOwnedOther(const LLVector3& pos) const +bool LLViewerParcelOverlay::isOwnedOther(const LLVector3& pos) const { S32 row = S32(pos.mV[VY] / PARCEL_GRID_STEP_METERS); S32 column = S32(pos.mV[VX] / PARCEL_GRID_STEP_METERS); @@ -246,7 +246,7 @@ bool LLViewerParcelOverlay::encroachesOnNearbyParcel(const std::vector<LLBBox>& return false; } -BOOL LLViewerParcelOverlay::isSoundLocal(const LLVector3& pos) const +bool LLViewerParcelOverlay::isSoundLocal(const LLVector3& pos) const { S32 row = S32(pos.mV[VY] / PARCEL_GRID_STEP_METERS); S32 column = S32(pos.mV[VX] / PARCEL_GRID_STEP_METERS); @@ -497,7 +497,7 @@ void LLViewerParcelOverlay::updatePropertyLines() } // Everything's clean now - mDirty = FALSE; + mDirty = false; } void LLViewerParcelOverlay::addPropertyLine(F32 start_x, F32 start_y, F32 dx, F32 dy, F32 tick_dx, F32 tick_dy, const LLColor4U& color) @@ -606,7 +606,7 @@ void LLViewerParcelOverlay::addPropertyLine(F32 start_x, F32 start_y, F32 dx, F3 void LLViewerParcelOverlay::setDirty() { - mDirty = TRUE; + mDirty = true; } void LLViewerParcelOverlay::updateGL() diff --git a/indra/newview/llviewerparceloverlay.h b/indra/newview/llviewerparceloverlay.h index 7587dbb826..d78005e376 100644 --- a/indra/newview/llviewerparceloverlay.h +++ b/indra/newview/llviewerparceloverlay.h @@ -50,10 +50,10 @@ public: // ACCESS LLViewerTexture* getTexture() const { return mTexture; } - BOOL isOwned(const LLVector3& pos) const; - BOOL isOwnedSelf(const LLVector3& pos) const; - BOOL isOwnedGroup(const LLVector3& pos) const; - BOOL isOwnedOther(const LLVector3& pos) const; + bool isOwned(const LLVector3& pos) const; + bool isOwnedSelf(const LLVector3& pos) const; + bool isOwnedGroup(const LLVector3& pos) const; + bool isOwnedOther(const LLVector3& pos) const; // "encroaches" means the prim hangs over the parcel, but its center // might be in another parcel. for now, we simply test axis aligned @@ -62,9 +62,9 @@ public: bool encroachesOnUnowned(const std::vector<LLBBox>& boxes) const; bool encroachesOnNearbyParcel(const std::vector<LLBBox>& boxes) const; - BOOL isSoundLocal(const LLVector3& pos) const; + bool isSoundLocal(const LLVector3& pos) const; - BOOL isBuildCameraAllowed(const LLVector3& pos) const; + bool isBuildCameraAllowed(const LLVector3& pos) const; F32 getOwnedRatio() const; // Returns the number of vertices drawn @@ -112,7 +112,7 @@ private: U8 *mOwnership; // Update propery lines and overlay texture - BOOL mDirty; + bool mDirty; LLFrameTimer mTimeSinceLastUpdate; S32 mOverlayTextureIdx; diff --git a/indra/newview/llviewerpartsim.cpp b/indra/newview/llviewerpartsim.cpp index b5505a42c4..b556aef768 100644 --- a/indra/newview/llviewerpartsim.cpp +++ b/indra/newview/llviewerpartsim.cpp @@ -137,7 +137,7 @@ LLViewerPartGroup::LLViewerPartGroup(const LLVector3 ¢er_agent, const F32 bo : mHud(hud) { mVOPartGroupp = NULL; - mUniformParticles = TRUE; + mUniformParticles = true; mRegionp = LLWorld::getInstance()->getRegionFromPosAgent(center_agent); llassert_always(center_agent.isFinite()); @@ -220,48 +220,48 @@ void LLViewerPartGroup::cleanup() } } -BOOL LLViewerPartGroup::posInGroup(const LLVector3 &pos, const F32 desired_size) +bool LLViewerPartGroup::posInGroup(const LLVector3 &pos, const F32 desired_size) { if ((pos.mV[VX] < mMinObjPos.mV[VX]) || (pos.mV[VY] < mMinObjPos.mV[VY]) || (pos.mV[VZ] < mMinObjPos.mV[VZ])) { - return FALSE; + return false; } if ((pos.mV[VX] > mMaxObjPos.mV[VX]) || (pos.mV[VY] > mMaxObjPos.mV[VY]) || (pos.mV[VZ] > mMaxObjPos.mV[VZ])) { - return FALSE; + return false; } if (desired_size > 0 && (desired_size < mBoxRadius*0.5f || desired_size > mBoxRadius*2.f)) { - return FALSE; + return false; } - return TRUE; + return true; } -BOOL LLViewerPartGroup::addPart(LLViewerPart* part, F32 desired_size) +bool LLViewerPartGroup::addPart(LLViewerPart* part, F32 desired_size) { if (part->mFlags & LLPartData::LL_PART_HUD && !mHud) { - return FALSE; + return false; } - BOOL uniform_part = part->mScale.mV[0] == part->mScale.mV[1] && + bool uniform_part = part->mScale.mV[0] == part->mScale.mV[1] && !(part->mFlags & LLPartData::LL_PART_FOLLOW_VELOCITY_MASK); if (!posInGroup(part->mPosAgent, desired_size) || (mUniformParticles && !uniform_part) || (!mUniformParticles && uniform_part)) { - return FALSE; + return false; } gPipeline.markRebuild(mVOPartGroupp->mDrawable, LLDrawable::REBUILD_ALL); @@ -269,7 +269,7 @@ BOOL LLViewerPartGroup::addPart(LLViewerPart* part, F32 desired_size) mParticles.push_back(part); part->mSkipOffset=mSkippedTime; LLViewerPartSim::incPartCount(1); - return TRUE; + return true; } @@ -279,7 +279,7 @@ void LLViewerPartGroup::updateParticles(const F32 lastdt) LLVector3 gravity(0.f, 0.f, GRAVITY); - LLViewerPartSim::checkParticleCount(mParticles.size()); + LLViewerPartSim::checkParticleCount(static_cast<U32>(mParticles.size())); LLViewerCamera* camera = LLViewerCamera::getInstance(); LLViewerRegion *regionp = getRegion(); @@ -525,11 +525,11 @@ void LLViewerPartSim::destroyClass() } //static -BOOL LLViewerPartSim::shouldAddPart() +bool LLViewerPartSim::shouldAddPart() { if (sParticleCount >= MAX_PART_COUNT) { - return FALSE; + return false; } if (sParticleCount > PART_THROTTLE_THRESHOLD*sMaxParticleCount) @@ -540,7 +540,7 @@ BOOL LLViewerPartSim::shouldAddPart() if (ll_frand() < frac) { // Skip... - return FALSE; + return false; } } @@ -548,10 +548,10 @@ BOOL LLViewerPartSim::shouldAddPart() const F32 MIN_FRAME_RATE_FOR_NEW_PARTICLES = 4.f; if (gFPSClamped < MIN_FRAME_RATE_FOR_NEW_PARTICLES) { - return FALSE; + return false; } - return TRUE; + return true; } void LLViewerPartSim::addPart(LLViewerPart* part) @@ -701,30 +701,30 @@ void LLViewerPartSim::updateSimulation() if (!mViewerPartSources[i]->isDead()) { - BOOL upd = TRUE; + bool upd = true; LLViewerObject* vobj = mViewerPartSources[i]->mSourceObjectp; if (vobj && vobj->isAvatar() && ((LLVOAvatar*)vobj)->isInMuteList()) { - upd = FALSE; + upd = false; } if(vobj && vobj->isOwnerInMuteList(mViewerPartSources[i]->getOwnerUUID())) { - upd = FALSE; + upd = false; } if (upd && vobj && (vobj->getPCode() == LL_PCODE_VOLUME)) { if(vobj->getAvatar() && vobj->getAvatar()->isTooComplex() && vobj->getAvatar()->isTooSlow()) { - upd = FALSE; + upd = false; } LLVOVolume* vvo = (LLVOVolume *)vobj; if (!LLPipeline::sRenderAttachedParticles && vvo && vvo->isAttachment()) { - upd = FALSE; + upd = false; } } diff --git a/indra/newview/llviewerpartsim.h b/indra/newview/llviewerpartsim.h index 4de962ac4f..cf3843bd66 100644 --- a/indra/newview/llviewerpartsim.h +++ b/indra/newview/llviewerpartsim.h @@ -95,11 +95,11 @@ public: void cleanup(); - BOOL addPart(LLViewerPart* part, const F32 desired_size = -1.f); + bool addPart(LLViewerPart* part, const F32 desired_size = -1.f); void updateParticles(const F32 lastdt); - BOOL posInGroup(const LLVector3 &pos, const F32 desired_size = -1.f); + bool posInGroup(const LLVector3 &pos, const F32 desired_size = -1.f); void shift(const LLVector3 &offset); @@ -117,7 +117,7 @@ public: LLPointer<LLVOPartGroup> mVOPartGroupp; - BOOL mUniformParticles; + bool mUniformParticles; U32 mID; F32 mSkippedTime; @@ -152,7 +152,7 @@ public: void cleanupRegion(LLViewerRegion *regionp); - static BOOL shouldAddPart(); // Just decides whether this particle should be added or not (for particle count capping) + static bool shouldAddPart(); // Just decides whether this particle should be added or not (for particle count capping) F32 maxRate() // Return maximum particle generation rate { if (sParticleCount >= MAX_PART_COUNT) @@ -177,7 +177,7 @@ public: friend class LLViewerPartGroup; - BOOL aboveParticleLimit() const { return sParticleCount > sMaxParticleCount; } + bool aboveParticleLimit() const { return sParticleCount > sMaxParticleCount; } static void setMaxPartCount(const S32 max_parts) { sMaxParticleCount = max_parts; } static S32 getMaxPartCount() { return sMaxParticleCount; } diff --git a/indra/newview/llviewerpartsource.cpp b/indra/newview/llviewerpartsource.cpp index f803b000db..dd6a404836 100644 --- a/indra/newview/llviewerpartsource.cpp +++ b/indra/newview/llviewerpartsource.cpp @@ -66,8 +66,8 @@ LLViewerPartSource::LLViewerPartSource(const U32 type) : { mLastUpdateTime = 0.f; mLastPartTime = 0.f; - mIsDead = FALSE; - mIsSuspended = FALSE; + mIsDead = false; + mIsSuspended = false; static U32 id_seed = 0; mID = ++id_seed; @@ -78,7 +78,7 @@ LLViewerPartSource::LLViewerPartSource(const U32 type) : void LLViewerPartSource::setDead() { - mIsDead = TRUE; + mIsDead = true; } @@ -122,7 +122,7 @@ LLViewerPartSourceScript::LLViewerPartSourceScript(LLViewerObject *source_objp) void LLViewerPartSourceScript::setDead() { - mIsDead = TRUE; + mIsDead = true; mSourceObjectp = NULL; mTargetObjectp = NULL; } @@ -207,17 +207,17 @@ void LLViewerPartSourceScript::update(const F32 dt) } } - BOOL first_run = FALSE; + bool first_run = false; if (old_update_time <= 0.f) { - first_run = TRUE; + first_run = true; } F32 max_time = llmax(1.f, 10.f*mPartSysData.mBurstRate); dt_update = llmin(max_time, dt_update); while ((dt_update > mPartSysData.mBurstRate) || first_run) { - first_run = FALSE; + first_run = false; // Update the rotation of the particle source by the angular velocity // First check to see if there is still an angular velocity. @@ -586,7 +586,7 @@ LLViewerPartSourceSpiral::LLViewerPartSourceSpiral(const LLVector3 &pos) : void LLViewerPartSourceSpiral::setDead() { - mIsDead = TRUE; + mIsDead = true; mSourceObjectp = NULL; } @@ -690,7 +690,7 @@ LLViewerPartSourceBeam::~LLViewerPartSourceBeam() void LLViewerPartSourceBeam::setDead() { - mIsDead = TRUE; + mIsDead = true; mSourceObjectp = NULL; mTargetObjectp = NULL; } @@ -843,7 +843,7 @@ LLViewerPartSourceChat::LLViewerPartSourceChat(const LLVector3 &pos) : void LLViewerPartSourceChat::setDead() { - mIsDead = TRUE; + mIsDead = true; mSourceObjectp = NULL; } diff --git a/indra/newview/llviewerpartsource.h b/indra/newview/llviewerpartsource.h index 1f4304d421..dcf945dd43 100644 --- a/indra/newview/llviewerpartsource.h +++ b/indra/newview/llviewerpartsource.h @@ -58,12 +58,12 @@ public: LLViewerPartSource(const U32 type); - virtual void update(const F32 dt); // Return FALSE if this source is dead... + virtual void update(const F32 dt); // Return false if this source is dead... virtual void setDead(); - BOOL isDead() const { return mIsDead; } - void setSuspended( BOOL state ) { mIsSuspended = state; } - BOOL isSuspended() const { return mIsSuspended; } + bool isDead() const { return mIsDead; } + void setSuspended( bool state ) { mIsSuspended = state; } + bool isSuspended() const { return mIsSuspended; } U32 getType() const { return mType; } static void updatePart(LLViewerPart &part, const F32 dt); void setOwnerUUID(const LLUUID& owner_id) { mOwnerUUID = owner_id; } @@ -81,8 +81,8 @@ public: protected: U32 mType; - BOOL mIsDead; - BOOL mIsSuspended; + bool mIsDead; + bool mIsSuspended; F32 mLastUpdateTime; F32 mLastPartTime; LLUUID mOwnerUUID; @@ -112,7 +112,7 @@ public: /*virtual*/ void setDead(); - BOOL updateFromMesg(); + bool updateFromMesg(); // Returns a new particle source to attach to an object... static LLPointer<LLViewerPartSourceScript> unpackPSS(LLViewerObject *source_objp, LLPointer<LLViewerPartSourceScript> pssp, const S32 block_num); diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 4c6c76bdd8..052c222d9a 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -55,6 +55,7 @@ #include "llfloaterregioninfo.h" #include "llgltfmateriallist.h" #include "llhttpnode.h" +#include "llpbrterrainfeatures.h" #include "llregioninfomodel.h" #include "llsdutil.h" #include "llstartup.h" @@ -100,14 +101,11 @@ const S32 MAX_CAP_REQUEST_ATTEMPTS = 30; const U32 DEFAULT_MAX_REGION_WIDE_PRIM_COUNT = 15000; -BOOL LLViewerRegion::sVOCacheCullingEnabled = FALSE; +bool LLViewerRegion::sVOCacheCullingEnabled = false; S32 LLViewerRegion::sLastCameraUpdated = 0; S32 LLViewerRegion::sNewObjectCreationThrottle = -1; LLViewerRegion::vocache_entry_map_t LLViewerRegion::sRegionCacheCleanup; -const std::string LLViewerRegion::IL_MODE_DEFAULT = "default"; -const std::string LLViewerRegion::IL_MODE_360 = "360"; - typedef std::map<std::string, std::string> CapabilityMap; static void log_capabilities(const CapabilityMap &capmap); @@ -139,7 +137,7 @@ public: bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web) { // make sure that we at least have a region name - int num_params = params.size(); + auto num_params = params.size(); if (num_params < 1) { return false; @@ -153,7 +151,7 @@ public: } boost::regex name_rx("[A-Za-z0-9()_%]+"); boost::regex coord_rx("[0-9]+"); - for (int i = 0; i < num_params; i++) + for (size_t i = 0; i < num_params; i++) { if (i > 0) { @@ -626,7 +624,7 @@ LLViewerRegion::LLViewerRegion(const U64 &handle, mTimeDilation(1.0f), mName(""), mZoning(""), - mIsEstateManager(FALSE), + mIsEstateManager(false), mRegionFlags( REGION_FLAGS_DEFAULT ), mRegionProtocols( 0 ), mSimAccess( SIM_ACCESS_MIN ), @@ -639,17 +637,17 @@ LLViewerRegion::LLViewerRegion(const U64 &handle, mProductSKU("unknown"), mProductName("unknown"), mViewerAssetUrl(""), - mCacheLoaded(FALSE), - mCacheDirty(FALSE), - mReleaseNotesRequested(FALSE), + mCacheLoaded(false), + mCacheDirty(false), + mReleaseNotesRequested(false), mCapabilitiesState(CAPABILITIES_STATE_INIT), mSimulatorFeaturesReceived(false), mBitsReceived(0.f), mPacketsReceived(0.f), - mDead(FALSE), + mDead(false), mLastVisitedEntry(NULL), mInvisibilityCheckHistory(-1), - mPaused(FALSE), + mPaused(false), mRegionCacheHitCount(0), mRegionCacheMissCount(0), mInterestListMode(IL_MODE_DEFAULT) @@ -725,7 +723,7 @@ static LLTrace::BlockTimerStatHandle FTM_SAVE_REGION_CACHE("Save Region Cache"); LLViewerRegion::~LLViewerRegion() { LL_PROFILE_ZONE_SCOPED; - mDead = TRUE; + mDead = true; mImpl->mActiveSet.clear(); mImpl->mVisibleEntries.clear(); mImpl->mVisibleGroups.clear(); @@ -789,7 +787,7 @@ void LLViewerRegion::loadObjectCache() } // Presume success. If it fails, we don't want to try again. - mCacheLoaded = TRUE; + mCacheLoaded = true; if(LLVOCache::instanceExists()) { @@ -800,7 +798,7 @@ void LLViewerRegion::loadObjectCache() if (mImpl->mCacheMap.empty()) { - mCacheDirty = TRUE; + mCacheDirty = true; } } } @@ -827,7 +825,7 @@ void LLViewerRegion::saveObjectCache() instance.writeToCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap, mCacheDirty, removal_enabled); instance.writeGenericExtrasToCache(mHandle, mImpl->mCacheID, mImpl->mGLTFOverridesLLSD, mCacheDirty, removal_enabled); - mCacheDirty = FALSE; + mCacheDirty = false; } if (LLAppViewer::instance()->isQuitting()) @@ -863,7 +861,7 @@ F32 LLViewerRegion::getWaterHeight() const return mImpl->mLandp->getWaterHeight(); } -BOOL LLViewerRegion::isVoiceEnabled() const +bool LLViewerRegion::isVoiceEnabled() const { return getRegionFlag(REGION_FLAGS_ALLOW_VOICE); } @@ -926,7 +924,7 @@ const LLUUID& LLViewerRegion::getOwner() const void LLViewerRegion::setRegionNameAndZone (const std::string& name_zone) { std::string::size_type pipe_pos = name_zone.find('|'); - S32 length = name_zone.size(); + auto length = name_zone.size(); if (pipe_pos != std::string::npos) { mName = name_zone.substr(0, pipe_pos); @@ -942,7 +940,7 @@ void LLViewerRegion::setRegionNameAndZone (const std::string& name_zone) LLStringUtil::stripNonprintable(mZoning); } -BOOL LLViewerRegion::canManageEstate() const +bool LLViewerRegion::canManageEstate() const { return gAgent.isGodlike() || isEstateManager() @@ -1169,7 +1167,7 @@ void LLViewerRegion::killCacheEntry(LLVOCacheEntry* entry, bool for_rendering) //will remove it from the object cache, real deletion entry->setState(LLVOCacheEntry::INACTIVE); entry->removeOctreeEntry(); - entry->setValid(FALSE); + entry->setValid(false); } @@ -1181,7 +1179,7 @@ void LLViewerRegion::killCacheEntry(U32 local_id) U32 LLViewerRegion::getNumOfActiveCachedObjects() const { - return mImpl->mActiveSet.size(); + return static_cast<U32>(mImpl->mActiveSet.size()); } void LLViewerRegion::addActiveCacheEntry(LLVOCacheEntry* entry) @@ -1268,7 +1266,7 @@ bool LLViewerRegion::addVisibleGroup(LLViewerOctreeGroup* group) U32 LLViewerRegion::getNumOfVisibleGroups() const { - return mImpl ? mImpl->mVisibleGroups.size() : 0; + return mImpl ? static_cast<U32>(mImpl->mVisibleGroups.size()) : 0; } void LLViewerRegion::updateReflectionProbes() @@ -1497,12 +1495,12 @@ void LLViewerRegion::createVisibleObjects(F32 max_time) } if(mImpl->mWaitingList.empty()) { - mImpl->mVOCachePartition->setCullHistory(FALSE); + mImpl->mVOCachePartition->setCullHistory(false); return; } S32 throttle = sNewObjectCreationThrottle; - BOOL has_new_obj = FALSE; + bool has_new_obj = false; LLTimer update_timer; for(LLVOCacheEntry::vocache_entry_priority_list_t::iterator iter = mImpl->mWaitingList.begin(); iter != mImpl->mWaitingList.end(); ++iter) @@ -1512,7 +1510,7 @@ void LLViewerRegion::createVisibleObjects(F32 max_time) if(vo_entry->getState() < LLVOCacheEntry::WAITING) { addNewObject(vo_entry); - has_new_obj = TRUE; + has_new_obj = true; if(throttle > 0 && !(--throttle) && update_timer.getElapsedTimeF32() > max_time) { break; @@ -1532,7 +1530,7 @@ void LLViewerRegion::clearCachedVisibleObjects() //reset all occluders mImpl->mVOCachePartition->resetOccluders(); - mPaused = TRUE; + mPaused = true; //clean visible entries for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mVisibleEntries.begin(); iter != mImpl->mVisibleEntries.end();) @@ -1644,7 +1642,7 @@ void LLViewerRegion::idleUpdate(F32 max_update_time) } if(mPaused) { - mPaused = FALSE; //unpause. + mPaused = false; //unpause. } LLViewerCamera::eCameraID old_camera_id = LLViewerCamera::sCurCameraID; @@ -1717,7 +1715,7 @@ void LLViewerRegion::calcNewObjectCreationThrottle() LLVOCacheEntry::updateDebugSettings(); } -BOOL LLViewerRegion::isViewerCameraStatic() +bool LLViewerRegion::isViewerCameraStatic() { return sLastCameraUpdated < LLViewerOctreeEntryData::getCurrentFrame(); } @@ -1756,7 +1754,7 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time) } std::vector<LLDrawable*> delete_list; - S32 update_counter = llmin(max_update, mImpl->mActiveSet.size()); + auto update_counter = llmin(max_update, mImpl->mActiveSet.size()); LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.upper_bound(mLastVisitedEntry); for(; update_counter > 0; --update_counter, ++iter) @@ -1795,10 +1793,9 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time) if(!delete_list.empty()) { mInvisibilityCheckHistory |= 1; - S32 count = delete_list.size(); - for(S32 i = 0; i < count; i++) + for (auto drawable : delete_list) { - gObjectList.killObject(delete_list[i]->getVObj()); + gObjectList.killObject(drawable->getVObj()); } delete_list.clear(); } @@ -2138,27 +2135,27 @@ S32 LLViewerRegion::getHttpResponderID() const return mImpl->mHttpResponderID; } -BOOL LLViewerRegion::pointInRegionGlobal(const LLVector3d &point_global) const +bool LLViewerRegion::pointInRegionGlobal(const LLVector3d &point_global) const { LLVector3 pos_region = getPosRegionFromGlobal(point_global); if (pos_region.mV[VX] < 0) { - return FALSE; + return false; } if (pos_region.mV[VX] >= mWidth) { - return FALSE; + return false; } if (pos_region.mV[VY] < 0) { - return FALSE; + return false; } if (pos_region.mV[VY] >= mWidth) { - return FALSE; + return false; } - return TRUE; + return true; } LLVector3 LLViewerRegion::getPosRegionFromGlobal(const LLVector3d &point_global) const @@ -2197,24 +2194,24 @@ bool LLViewerRegion::isAlive() return mAlive; } -BOOL LLViewerRegion::isOwnedSelf(const LLVector3& pos) +bool LLViewerRegion::isOwnedSelf(const LLVector3& pos) { if (mParcelOverlay) { return mParcelOverlay->isOwnedSelf(pos); } else { - return FALSE; + return false; } } // Owned by a group you belong to? (officer or member) -BOOL LLViewerRegion::isOwnedGroup(const LLVector3& pos) +bool LLViewerRegion::isOwnedGroup(const LLVector3& pos) { if (mParcelOverlay) { return mParcelOverlay->isOwnedGroup(pos); } else { - return FALSE; + return false; } } @@ -2259,7 +2256,7 @@ public: LLSD::array_iterator locs_it = locs.beginArray(), agents_it = agents.beginArray(); - BOOL has_agent_data = input["body"].has("AgentData"); + bool has_agent_data = input["body"].has("AgentData"); for(int i=0; locs_it != locs.endArray(); @@ -2327,7 +2324,7 @@ void LLViewerRegion::updateCoarseLocations(LLMessageSystem* msg) msg->getS16Fast(_PREHASH_Index, _PREHASH_You, agent_index); msg->getS16Fast(_PREHASH_Index, _PREHASH_Prey, target_index); - BOOL has_agent_data = msg->has(_PREHASH_AgentData); + bool has_agent_data = msg->has(_PREHASH_AgentData); S32 count = msg->getNumberOfBlocksFast(_PREHASH_Location); for(S32 i = 0; i < count; i++) { @@ -2484,13 +2481,30 @@ void LLViewerRegion::setSimulatorFeatures(const LLSD& sim_features) { gSavedSettings.setBOOL("UIPreviewMaterial", false); } + + if (features.has("GLTFEnabled")) + { + bool enabled = features["GLTFEnabled"]; + gSavedSettings.setBOOL("GLTFEnabled", enabled); + } + else + { + gSavedSettings.setBOOL("GLTFEnabled", false); + } + + if (features.has("PBRTerrainTransformsEnabled")) + { + bool enabled = features["PBRTerrainTransformsEnabled"]; + gSavedSettings.setBOOL("RenderTerrainPBRTransformsEnabled", enabled); + } + else + { + gSavedSettings.setBOOL("RenderTerrainPBRTransformsEnabled", false); + } }; - auto workqueue = LL::WorkQueue::getInstance("mainloop"); - if (workqueue) - { - LL::WorkQueue::postMaybe(workqueue, work); - } + + LLAppViewer::instance()->postToMainCoro(work); } //this is called when the parent is not cacheable. @@ -2659,10 +2673,9 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) if(iter != mOrphanMap.end()) { std::vector<U32>* orphans = &mOrphanMap[entry->getLocalID()]; - S32 size = orphans->size(); - for(S32 i = 0; i < size; i++) + for (U32 orphan : *orphans) { - LLVOCacheEntry* child = getCacheEntry((*orphans)[i]); + LLVOCacheEntry* child = getCacheEntry(orphan); if(child) { entry->addChild(child); @@ -2841,7 +2854,11 @@ bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss if(entry->isState(LLVOCacheEntry::ACTIVE)) { - ((LLDrawable*)entry->getEntry()->getDrawable())->getVObj()->loadFlags(flags); + LLDrawable* drawable = (LLDrawable*)entry->getEntry()->getDrawable(); + if (drawable && drawable->getVObj()) + { + drawable->getVObj()->loadFlags(flags); + } return true; } @@ -2888,7 +2905,7 @@ void LLViewerRegion::requestCacheMisses() } LLMessageSystem* msg = gMessageSystem; - BOOL start_new_message = TRUE; + bool start_new_message = true; S32 blocks = 0; //send requests for all cache-missed objects @@ -2900,7 +2917,7 @@ void LLViewerRegion::requestCacheMisses() msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - start_new_message = FALSE; + start_new_message = false; } msg->nextBlockFast(_PREHASH_ObjectData); @@ -2914,7 +2931,7 @@ void LLViewerRegion::requestCacheMisses() if (blocks >= 255) { sendReliableMessage(); - start_new_message = TRUE; + start_new_message = true; blocks = 0; } } @@ -2925,9 +2942,9 @@ void LLViewerRegion::requestCacheMisses() sendReliableMessage(); } - mCacheDirty = TRUE ; + mCacheDirty = true ; // LL_INFOS() << "KILLDEBUG Sent cache miss full " << full_count << " crc " << crc_count << LL_ENDL; - LLViewerStatsRecorder::instance().requestCacheMissesEvent(mCacheMissList.size()); + LLViewerStatsRecorder::instance().requestCacheMissesEvent(static_cast<S32>(mCacheMissList.size())); mCacheMissList.clear(); } @@ -2986,7 +3003,7 @@ void LLViewerRegion::unpackRegionHandshake() U8 sim_access; std::string sim_name; LLUUID sim_owner; - BOOL is_estate_manager; + bool is_estate_manager; F32 water_height; F32 billable_factor; LLUUID cache_id; @@ -3125,6 +3142,17 @@ void LLViewerRegion::unpackRegionHandshake() { compp->setParamsReady(); } + + LLPBRTerrainFeatures::queueQuery(*this, [](LLUUID region_id, bool success, const LLModifyRegion& composition_changes) + { + if (!success) { return; } + LLViewerRegion* region = LLWorld::getInstance()->getRegionFromID(region_id); + if (!region) { return; } + LLVLComposition* compp = region->getComposition(); + if (!compp) { return; } + compp->apply(composition_changes); + LLFloaterRegionInfo::sRefreshFromRegion(region); + }); } @@ -3223,6 +3251,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) capabilityNames.append("MapLayerGod"); capabilityNames.append("MeshUploadFlag"); capabilityNames.append("ModifyMaterialParams"); + capabilityNames.append("ModifyRegion"); capabilityNames.append("NavMeshGenerationStatus"); capabilityNames.append("NewFileAgentInventory"); capabilityNames.append("ObjectAnimation"); @@ -3536,7 +3565,7 @@ void LLViewerRegion::setInterestListMode(const std::string &new_mode) { mInterestListMode = new_mode; - if (mInterestListMode != std::string(IL_MODE_DEFAULT) && mInterestListMode != std::string(IL_MODE_360)) + if (mInterestListMode != IL_MODE_DEFAULT && mInterestListMode != IL_MODE_360) { LL_WARNS("360Capture") << "Region " << getRegionID() << " setInterestListMode() invalid interest list mode: " << mInterestListMode << ", setting to default" << LL_ENDL; @@ -3644,12 +3673,12 @@ void LLViewerRegion::showReleaseNotes() if (url.empty()) { // HACK haven't received the capability yet, we'll wait until // it arives. - mReleaseNotesRequested = TRUE; + mReleaseNotesRequested = true; return; } LLWeb::loadURL(url); - mReleaseNotesRequested = FALSE; + mReleaseNotesRequested = false; } std::string LLViewerRegion::getDescription() const diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index d598406952..68247dc18e 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -53,6 +53,11 @@ const U32 MAX_OBJECT_CACHE_ENTRIES = 50000; // Region handshake flags const U32 REGION_HANDSHAKE_SUPPORTS_SELF_APPEARANCE = 1U << 2; +// Interest list mode, +// in use by agent and region classes so must exist before region classes +const std::string IL_MODE_DEFAULT = "default"; +const std::string IL_MODE_360 = "360"; + class LLEventPoll; class LLVLComposition; class LLViewerObject; @@ -118,34 +123,34 @@ public: //void setAgentOffset(const LLVector3d &offset); void updateRenderMatrix(); - void setAllowDamage(BOOL b) { setRegionFlag(REGION_FLAGS_ALLOW_DAMAGE, b); } - void setAllowLandmark(BOOL b) { setRegionFlag(REGION_FLAGS_ALLOW_LANDMARK, b); } - void setAllowSetHome(BOOL b) { setRegionFlag(REGION_FLAGS_ALLOW_SET_HOME, b); } - void setResetHomeOnTeleport(BOOL b) { setRegionFlag(REGION_FLAGS_RESET_HOME_ON_TELEPORT, b); } - void setSunFixed(BOOL b) { setRegionFlag(REGION_FLAGS_SUN_FIXED, b); } - //void setBlockFly(BOOL b) { setRegionFlag(REGION_FLAGS_BLOCK_FLY, b); } Never used - void setAllowDirectTeleport(BOOL b) { setRegionFlag(REGION_FLAGS_ALLOW_DIRECT_TELEPORT, b); } - - - inline BOOL getAllowDamage() const; - inline BOOL getAllowLandmark() const; - inline BOOL getAllowSetHome() const; - inline BOOL getResetHomeOnTeleport() const; - inline BOOL getSunFixed() const; - inline BOOL getBlockFly() const; - inline BOOL getAllowDirectTeleport() const; - inline BOOL isPrelude() const; - inline BOOL getAllowTerraform() const; - inline BOOL getRestrictPushObject() const; - inline BOOL getAllowEnvironmentOverride() const; - inline BOOL getReleaseNotesRequested() const; + void setAllowDamage(bool b) { setRegionFlag(REGION_FLAGS_ALLOW_DAMAGE, b); } + void setAllowLandmark(bool b) { setRegionFlag(REGION_FLAGS_ALLOW_LANDMARK, b); } + void setAllowSetHome(bool b) { setRegionFlag(REGION_FLAGS_ALLOW_SET_HOME, b); } + void setResetHomeOnTeleport(bool b) { setRegionFlag(REGION_FLAGS_RESET_HOME_ON_TELEPORT, b); } + void setSunFixed(bool b) { setRegionFlag(REGION_FLAGS_SUN_FIXED, b); } + //void setBlockFly(bool b) { setRegionFlag(REGION_FLAGS_BLOCK_FLY, b); } Never used + void setAllowDirectTeleport(bool b) { setRegionFlag(REGION_FLAGS_ALLOW_DIRECT_TELEPORT, b); } + + + inline bool getAllowDamage() const; + inline bool getAllowLandmark() const; + inline bool getAllowSetHome() const; + inline bool getResetHomeOnTeleport() const; + inline bool getSunFixed() const; + inline bool getBlockFly() const; + inline bool getAllowDirectTeleport() const; + inline bool isPrelude() const; + inline bool getAllowTerraform() const; + inline bool getRestrictPushObject() const; + inline bool getAllowEnvironmentOverride() const; + inline bool getReleaseNotesRequested() const; bool isAlive(); // can become false if circuit disconnects void setWaterHeight(F32 water_level); F32 getWaterHeight() const; - BOOL isVoiceEnabled() const; + bool isVoiceEnabled() const; void setBillableFactor(F32 billable_factor) { mBillableFactor = billable_factor; } F32 getBillableFactor() const { return mBillableFactor; } @@ -171,13 +176,13 @@ public: LLViewerParcelOverlay *getParcelOverlay() const { return mParcelOverlay; } - inline void setRegionFlag(U64 flag, BOOL on); - inline BOOL getRegionFlag(U64 flag) const; + inline void setRegionFlag(U64 flag, bool on); + inline bool getRegionFlag(U64 flag) const; void setRegionFlags(U64 flags); U64 getRegionFlags() const { return mRegionFlags; } - inline void setRegionProtocol(U64 protocol, BOOL on); - BOOL getRegionProtocol(U64 protocol) const; + inline void setRegionProtocol(U64 protocol, bool on); + bool getRegionProtocol(U64 protocol) const; void setRegionProtocols(U64 protocols) { mRegionProtocols = protocols; } U64 getRegionProtocols() const { return mRegionProtocols; } @@ -200,9 +205,9 @@ public: const LLUUID& getOwner() const; // Is the current agent on the estate manager list for this region? - void setIsEstateManager(BOOL b) { mIsEstateManager = b; } - BOOL isEstateManager() const { return mIsEstateManager; } - BOOL canManageEstate() const; + void setIsEstateManager(bool b) { mIsEstateManager = b; } + bool isEstateManager() const { return mIsEstateManager; } + bool canManageEstate() const; void setSimAccess(U8 sim_access) { mSimAccess = sim_access; } U8 getSimAccess() const { return mSimAccess; } @@ -234,7 +239,7 @@ public: static void processRegionInfo(LLMessageSystem* msg, void**); //check if the viewer camera is static - static BOOL isViewerCameraStatic(); + static bool isViewerCameraStatic(); static void calcNewObjectCreationThrottle(); void setCacheID(const LLUUID& id); @@ -305,7 +310,7 @@ public: const LLUUID& getRegionID() const; void setRegionID(const LLUUID& region_id); - BOOL pointInRegionGlobal(const LLVector3d &point_global) const; + bool pointInRegionGlobal(const LLVector3d &point_global) const; LLVector3 getPosRegionFromGlobal(const LLVector3d &point_global) const; LLVector3 getPosRegionFromAgent(const LLVector3 &agent_pos) const; LLVector3 getPosAgentFromRegion(const LLVector3 ®ion_pos) const; @@ -314,10 +319,10 @@ public: LLVLComposition *getComposition() const; F32 getCompositionXY(const S32 x, const S32 y) const; - BOOL isOwnedSelf(const LLVector3& pos); + bool isOwnedSelf(const LLVector3& pos); // Owned by a group you belong to? (officer OR member) - BOOL isOwnedGroup(const LLVector3& pos); + bool isOwnedGroup(const LLVector3& pos); // deal with map object updates in the world. void updateCoarseLocations(LLMessageSystem* msg); @@ -415,12 +420,12 @@ public: void removeFromCreatedList(U32 local_id); void addToCreatedList(U32 local_id); - BOOL isPaused() const {return mPaused;} + bool isPaused() const {return mPaused;} S32 getLastUpdate() const {return mLastUpdate;} std::string getSimHostName(); - static BOOL isNewObjectCreationThrottleDisabled() {return sNewObjectCreationThrottle < 0;} + static bool isNewObjectCreationThrottleDisabled() {return sNewObjectCreationThrottle < 0;} // rebuild reflection probe list void updateReflectionProbes(); @@ -473,7 +478,7 @@ public: std::vector<U32> mMapAvatars; std::vector<LLUUID> mMapAvatarIDs; - static BOOL sVOCacheCullingEnabled; //vo cache culling enabled or not. + static bool sVOCacheCullingEnabled; //vo cache culling enabled or not. static S32 sLastCameraUpdated; LLFrameTimer & getRenderInfoRequestTimer() { return mRenderInfoRequestTimer; }; @@ -508,9 +513,6 @@ public: void resetInterestList(); - static const std::string IL_MODE_DEFAULT; - static const std::string IL_MODE_360; - private: static S32 sNewObjectCreationThrottle; LLViewerRegionImpl * mImpl; @@ -526,7 +528,7 @@ public: std::string mZoning; // Is this agent on the estate managers list for this region? - BOOL mIsEstateManager; + bool mIsEstateManager; U32 mPacketsIn; U32Bits mBitsIn, @@ -562,13 +564,13 @@ public: // Maps local ids to cache entries. // Regions can have order 10,000 objects, so assume // a structure of size 2^14 = 16,000 - BOOL mCacheLoaded; - BOOL mCacheDirty; - BOOL mAlive; // can become false if circuit disconnects - BOOL mSimulatorFeaturesReceived; - BOOL mReleaseNotesRequested; - BOOL mDead; //if true, this region is in the process of deleting. - BOOL mPaused; //pause processing the objects in the region + bool mCacheLoaded; + bool mCacheDirty; + bool mAlive; // can become false if circuit disconnects + bool mSimulatorFeaturesReceived; + bool mReleaseNotesRequested; + bool mDead; //if true, this region is in the process of deleting. + bool mPaused; //pause processing the objects in the region typedef enum { @@ -617,12 +619,12 @@ public: }; -inline BOOL LLViewerRegion::getRegionProtocol(U64 protocol) const +inline bool LLViewerRegion::getRegionProtocol(U64 protocol) const { return ((mRegionProtocols & protocol) != 0); } -inline void LLViewerRegion::setRegionProtocol(U64 protocol, BOOL on) +inline void LLViewerRegion::setRegionProtocol(U64 protocol, bool on) { if (on) { @@ -634,12 +636,12 @@ inline void LLViewerRegion::setRegionProtocol(U64 protocol, BOOL on) } } -inline BOOL LLViewerRegion::getRegionFlag(U64 flag) const +inline bool LLViewerRegion::getRegionFlag(U64 flag) const { return ((mRegionFlags & flag) != 0); } -inline void LLViewerRegion::setRegionFlag(U64 flag, BOOL on) +inline void LLViewerRegion::setRegionFlag(U64 flag, bool on) { if (on) { @@ -651,62 +653,62 @@ inline void LLViewerRegion::setRegionFlag(U64 flag, BOOL on) } } -inline BOOL LLViewerRegion::getAllowDamage() const +inline bool LLViewerRegion::getAllowDamage() const { return ((mRegionFlags & REGION_FLAGS_ALLOW_DAMAGE) !=0); } -inline BOOL LLViewerRegion::getAllowLandmark() const +inline bool LLViewerRegion::getAllowLandmark() const { return ((mRegionFlags & REGION_FLAGS_ALLOW_LANDMARK) !=0); } -inline BOOL LLViewerRegion::getAllowSetHome() const +inline bool LLViewerRegion::getAllowSetHome() const { return ((mRegionFlags & REGION_FLAGS_ALLOW_SET_HOME) != 0); } -inline BOOL LLViewerRegion::getResetHomeOnTeleport() const +inline bool LLViewerRegion::getResetHomeOnTeleport() const { return ((mRegionFlags & REGION_FLAGS_RESET_HOME_ON_TELEPORT) !=0); } -inline BOOL LLViewerRegion::getSunFixed() const +inline bool LLViewerRegion::getSunFixed() const { return ((mRegionFlags & REGION_FLAGS_SUN_FIXED) !=0); } -inline BOOL LLViewerRegion::getBlockFly() const +inline bool LLViewerRegion::getBlockFly() const { return ((mRegionFlags & REGION_FLAGS_BLOCK_FLY) !=0); } -inline BOOL LLViewerRegion::getAllowDirectTeleport() const +inline bool LLViewerRegion::getAllowDirectTeleport() const { return ((mRegionFlags & REGION_FLAGS_ALLOW_DIRECT_TELEPORT) !=0); } -inline BOOL LLViewerRegion::isPrelude() const +inline bool LLViewerRegion::isPrelude() const { return is_prelude( mRegionFlags ); } -inline BOOL LLViewerRegion::getAllowTerraform() const +inline bool LLViewerRegion::getAllowTerraform() const { return ((mRegionFlags & REGION_FLAGS_BLOCK_TERRAFORM) == 0); } -inline BOOL LLViewerRegion::getRestrictPushObject() const +inline bool LLViewerRegion::getRestrictPushObject() const { return ((mRegionFlags & REGION_FLAGS_RESTRICT_PUSHOBJECT) != 0); } -inline BOOL LLViewerRegion::getAllowEnvironmentOverride() const +inline bool LLViewerRegion::getAllowEnvironmentOverride() const { return ((mRegionFlags & REGION_FLAGS_ALLOW_ENVIRONMENT_OVERRIDE) != 0); } -inline BOOL LLViewerRegion::getReleaseNotesRequested() const +inline bool LLViewerRegion::getReleaseNotesRequested() const { return mReleaseNotesRequested; } diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index d0846e3017..12d0aa4f8e 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -64,7 +64,7 @@ using std::pair; using std::make_pair; using std::string; -BOOL LLViewerShaderMgr::sInitialized = FALSE; +bool LLViewerShaderMgr::sInitialized = false; bool LLViewerShaderMgr::sSkipReload = false; LLVector4 gShinyOrigin; @@ -228,6 +228,9 @@ LLGLSLShader gDeferredPBRAlphaProgram; LLGLSLShader gDeferredSkinnedPBRAlphaProgram; LLGLSLShader gDeferredPBRTerrainProgram; +LLGLSLShader gGLTFPBRMetallicRoughnessProgram; + + //helper for making a rigged variant of a given shader static bool make_rigged_variant(LLGLSLShader& shader, LLGLSLShader& riggedShader) { @@ -235,13 +238,110 @@ static bool make_rigged_variant(LLGLSLShader& shader, LLGLSLShader& riggedShader riggedShader.mFeatures = shader.mFeatures; riggedShader.mFeatures.hasObjectSkinning = true; riggedShader.mDefines = shader.mDefines; // NOTE: Must come before addPermutation + riggedShader.addPermutation("HAS_SKIN", "1"); riggedShader.mShaderFiles = shader.mShaderFiles; riggedShader.mShaderLevel = shader.mShaderLevel; riggedShader.mShaderGroup = shader.mShaderGroup; shader.mRiggedVariant = &riggedShader; - return riggedShader.createShader(NULL, NULL); + return riggedShader.createShader(); +} + + +static bool make_gltf_variant(LLGLSLShader& shader, LLGLSLShader& variant, bool alpha_blend, bool rigged, bool unlit, bool multi_uv, bool use_sun_shadow) +{ + variant.mName = shader.mName.c_str(); + variant.mFeatures = shader.mFeatures; + variant.mShaderFiles = shader.mShaderFiles; + variant.mShaderLevel = shader.mShaderLevel; + variant.mShaderGroup = shader.mShaderGroup; + + variant.mDefines = shader.mDefines; // NOTE: Must come before addPermutation + + U32 node_size = 16 * 3; + U32 max_nodes = gGLManager.mMaxUniformBlockSize / node_size; + variant.addPermutation("MAX_NODES_PER_GLTF_OBJECT", std::to_string(max_nodes)); + + U32 material_size = 16 * 12; + U32 max_materials = gGLManager.mMaxUniformBlockSize / material_size; + LLGLSLShader::sMaxGLTFMaterials = max_materials; + + variant.addPermutation("MAX_MATERIALS_PER_GLTF_OBJECT", std::to_string(max_materials)); + + U32 max_vec4s = gGLManager.mMaxUniformBlockSize / 16; + variant.addPermutation("MAX_UBO_VEC4S", std::to_string(max_vec4s)); + + if (rigged) + { + variant.addPermutation("HAS_SKIN", "1"); + } + + if (unlit) + { + variant.addPermutation("UNLIT", "1"); + } + + if (multi_uv) + { + variant.addPermutation("MULTI_UV", "1"); + } + + if (alpha_blend) + { + variant.addPermutation("ALPHA_BLEND", "1"); + + variant.mFeatures.calculatesLighting = false; + variant.mFeatures.hasLighting = false; + variant.mFeatures.isAlphaLighting = true; + variant.mFeatures.hasSrgb = true; + variant.mFeatures.calculatesAtmospherics = true; + variant.mFeatures.hasAtmospherics = true; + variant.mFeatures.hasGamma = true; + variant.mFeatures.hasShadows = use_sun_shadow; + variant.mFeatures.isDeferred = true; // include deferredUtils + variant.mFeatures.hasReflectionProbes = true; + + if (use_sun_shadow) + { + variant.addPermutation("HAS_SUN_SHADOW", "1"); + } + + bool success = variant.createShader(); + llassert(success); + + // Alpha Shader Hack + // See: LLRender::syncMatrices() + variant.mFeatures.calculatesLighting = true; + variant.mFeatures.hasLighting = true; + + return success; + } + else + { + return variant.createShader(); + } +} + +static bool make_gltf_variants(LLGLSLShader& shader, bool use_sun_shadow) +{ + shader.mFeatures.mGLTF = true; + shader.mGLTFVariants.resize(LLGLSLShader::NUM_GLTF_VARIANTS); + + for (U32 i = 0; i < LLGLSLShader::NUM_GLTF_VARIANTS; ++i) + { + bool alpha_blend = i & LLGLSLShader::GLTFVariant::ALPHA_BLEND; + bool rigged = i & LLGLSLShader::GLTFVariant::RIGGED; + bool unlit = i & LLGLSLShader::GLTFVariant::UNLIT; + bool multi_uv = i & LLGLSLShader::GLTFVariant::MULTI_UV; + + if (!make_gltf_variant(shader, shader.mGLTFVariants[i], alpha_blend, rigged, unlit, multi_uv, use_sun_shadow)) + { + return false; + } + } + + return true; } #ifdef SHOW_ASSERT @@ -329,6 +429,7 @@ void LLViewerShaderMgr::finalizeShaderList() mShaderList.push_back(&gDeferredDiffuseProgram); mShaderList.push_back(&gDeferredBumpProgram); mShaderList.push_back(&gDeferredPBROpaqueProgram); + mShaderList.push_back(&gGLTFPBRMetallicRoughnessProgram); mShaderList.push_back(&gDeferredAvatarProgram); mShaderList.push_back(&gDeferredTerrainProgram); mShaderList.push_back(&gDeferredPBRTerrainProgram); @@ -425,8 +526,8 @@ void LLViewerShaderMgr::setShaders() // when using indexed texture rendering, leave some texture units available for shadow and reflection maps static LLCachedControl<S32> reserved_texture_units(gSavedSettings, "RenderReservedTextureIndices", 14); - LLGLSLShader::sIndexedTextureChannels = - llclamp<S32>(max_texture_index, 1, gGLManager.mNumTextureImageUnits-reserved_texture_units); + LLGLSLShader::sIndexedTextureChannels = 4; + //llclamp<S32>(max_texture_index, 1, gGLManager.mNumTextureImageUnits-reserved_texture_units); reentrance = true; @@ -505,7 +606,7 @@ void LLViewerShaderMgr::setShaders() gPipeline.mShadersLoaded = true; - BOOL loaded = loadShadersWater(); + bool loaded = loadShadersWater(); if (loaded) { @@ -652,7 +753,7 @@ std::string LLViewerShaderMgr::loadBasicShaders() attribs["MAX_JOINTS_PER_MESH_OBJECT"] = std::to_string(LLSkinningUtil::getMaxJointCount()); - BOOL ssr = gSavedSettings.getBOOL("RenderScreenSpaceReflections"); + bool ssr = gSavedSettings.getBOOL("RenderScreenSpaceReflections"); bool has_reflection_probes = gSavedSettings.getBOOL("RenderReflectionsEnabled") && gGLManager.mGLVersion > 3.99f; @@ -749,11 +850,11 @@ std::string LLViewerShaderMgr::loadBasicShaders() return std::string(); } -BOOL LLViewerShaderMgr::loadShadersWater() +bool LLViewerShaderMgr::loadShadersWater() { LL_PROFILE_ZONE_SCOPED; - BOOL success = TRUE; - BOOL terrainWaterSuccess = TRUE; + bool success = true; + bool terrainWaterSuccess = true; bool use_sun_shadow = mShaderLevel[SHADER_DEFERRED] > 1 && gSavedSettings.getS32("RenderShadowDetail") > 0; @@ -763,7 +864,7 @@ BOOL LLViewerShaderMgr::loadShadersWater() gWaterProgram.unload(); gWaterEdgeProgram.unload(); gUnderWaterProgram.unload(); - return TRUE; + return true; } if (success) @@ -792,7 +893,7 @@ BOOL LLViewerShaderMgr::loadShadersWater() gWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; gWaterProgram.mShaderLevel = mShaderLevel[SHADER_WATER]; - success = gWaterProgram.createShader(NULL, NULL); + success = gWaterProgram.createShader(); llassert(success); } @@ -822,7 +923,7 @@ BOOL LLViewerShaderMgr::loadShadersWater() } gWaterEdgeProgram.mShaderGroup = LLGLSLShader::SG_WATER; gWaterEdgeProgram.mShaderLevel = mShaderLevel[SHADER_WATER]; - success = gWaterEdgeProgram.createShader(NULL, NULL); + success = gWaterEdgeProgram.createShader(); llassert(success); } @@ -842,7 +943,7 @@ BOOL LLViewerShaderMgr::loadShadersWater() { gUnderWaterProgram.addPermutation("TRANSPARENT_WATER", "1"); } - success = gUnderWaterProgram.createShader(NULL, NULL); + success = gUnderWaterProgram.createShader(); llassert(success); } @@ -856,7 +957,7 @@ BOOL LLViewerShaderMgr::loadShadersWater() if (!success) { mShaderLevel[SHADER_WATER] = 0; - return FALSE; + return false; } // if we failed to load the terrain water shaders and we need them (using class2 water), @@ -869,19 +970,19 @@ BOOL LLViewerShaderMgr::loadShadersWater() LLWorld::getInstance()->updateWaterObjects(); - return TRUE; + return true; } -BOOL LLViewerShaderMgr::loadShadersEffects() +bool LLViewerShaderMgr::loadShadersEffects() { LL_PROFILE_ZONE_SCOPED; - BOOL success = TRUE; + bool success = true; if (mShaderLevel[SHADER_EFFECT] == 0) { gGlowProgram.unload(); gGlowExtractProgram.unload(); - return TRUE; + return true; } if (success) @@ -891,10 +992,10 @@ BOOL LLViewerShaderMgr::loadShadersEffects() gGlowProgram.mShaderFiles.push_back(make_pair("effects/glowV.glsl", GL_VERTEX_SHADER)); gGlowProgram.mShaderFiles.push_back(make_pair("effects/glowF.glsl", GL_FRAGMENT_SHADER)); gGlowProgram.mShaderLevel = mShaderLevel[SHADER_EFFECT]; - success = gGlowProgram.createShader(NULL, NULL); + success = gGlowProgram.createShader(); if (!success) { - LLPipeline::sRenderGlow = FALSE; + LLPipeline::sRenderGlow = false; } } @@ -914,10 +1015,10 @@ BOOL LLViewerShaderMgr::loadShadersEffects() gGlowExtractProgram.addPermutation("HAS_NOISE", "1"); } - success = gGlowExtractProgram.createShader(NULL, NULL); + success = gGlowExtractProgram.createShader(); if (!success) { - LLPipeline::sRenderGlow = FALSE; + LLPipeline::sRenderGlow = false; } } @@ -925,7 +1026,7 @@ BOOL LLViewerShaderMgr::loadShadersEffects() } -BOOL LLViewerShaderMgr::loadShadersDeferred() +bool LLViewerShaderMgr::loadShadersDeferred() { LL_PROFILE_ZONE_SCOPED; bool use_sun_shadow = mShaderLevel[SHADER_DEFERRED] > 1 && @@ -1019,15 +1120,16 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gHUDPBROpaqueProgram.unload(); gPBRGlowProgram.unload(); gDeferredPBROpaqueProgram.unload(); + gGLTFPBRMetallicRoughnessProgram.unload(); gDeferredSkinnedPBROpaqueProgram.unload(); gDeferredPBRAlphaProgram.unload(); gDeferredSkinnedPBRAlphaProgram.unload(); gDeferredPBRTerrainProgram.unload(); - return TRUE; + return true; } - BOOL success = TRUE; + bool success = true; if (success) { @@ -1036,7 +1138,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredHighlightProgram.mShaderFiles.push_back(make_pair("interface/highlightV.glsl", GL_VERTEX_SHADER)); gDeferredHighlightProgram.mShaderFiles.push_back(make_pair("deferred/highlightF.glsl", GL_FRAGMENT_SHADER)); gDeferredHighlightProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; - success = gDeferredHighlightProgram.createShader(NULL, NULL); + success = gDeferredHighlightProgram.createShader(); } if (success) @@ -1049,7 +1151,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredDiffuseProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels; gDeferredDiffuseProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; success = make_rigged_variant(gDeferredDiffuseProgram, gDeferredSkinnedDiffuseProgram); - success = success && gDeferredDiffuseProgram.createShader(NULL, NULL); + success = success && gDeferredDiffuseProgram.createShader(); } if (success) @@ -1061,7 +1163,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredDiffuseAlphaMaskProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels; gDeferredDiffuseAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; success = make_rigged_variant(gDeferredDiffuseAlphaMaskProgram, gDeferredSkinnedDiffuseAlphaMaskProgram); - success = success && gDeferredDiffuseAlphaMaskProgram.createShader(NULL, NULL); + success = success && gDeferredDiffuseAlphaMaskProgram.createShader(); } if (success) @@ -1071,7 +1173,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredNonIndexedDiffuseAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/diffuseV.glsl", GL_VERTEX_SHADER)); gDeferredNonIndexedDiffuseAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/diffuseAlphaMaskF.glsl", GL_FRAGMENT_SHADER)); gDeferredNonIndexedDiffuseAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gDeferredNonIndexedDiffuseAlphaMaskProgram.createShader(NULL, NULL); + success = gDeferredNonIndexedDiffuseAlphaMaskProgram.createShader(); llassert(success); } @@ -1082,7 +1184,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("deferred/diffuseNoColorV.glsl", GL_VERTEX_SHADER)); gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("deferred/diffuseAlphaMaskNoColorF.glsl", GL_FRAGMENT_SHADER)); gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.createShader(NULL, NULL); + success = gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.createShader(); llassert(success); } @@ -1094,7 +1196,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredBumpProgram.mShaderFiles.push_back(make_pair("deferred/bumpF.glsl", GL_FRAGMENT_SHADER)); gDeferredBumpProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; success = make_rigged_variant(gDeferredBumpProgram, gDeferredSkinnedBumpProgram); - success = success && gDeferredBumpProgram.createShader(NULL, NULL); + success = success && gDeferredBumpProgram.createShader(); llassert(success); } @@ -1176,7 +1278,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredMaterialProgram[i].mRiggedVariant = &gDeferredMaterialProgram[i + 0x10]; } - success = gDeferredMaterialProgram[i].createShader(NULL, NULL); + success = gDeferredMaterialProgram[i].createShader(); llassert(success); } } @@ -1204,13 +1306,29 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() success = make_rigged_variant(gDeferredPBROpaqueProgram, gDeferredSkinnedPBROpaqueProgram); if (success) { - success = gDeferredPBROpaqueProgram.createShader(NULL, NULL); + success = gDeferredPBROpaqueProgram.createShader(); } llassert(success); } if (success) { + gGLTFPBRMetallicRoughnessProgram.mName = "GLTF PBR Metallic Roughness Shader"; + gGLTFPBRMetallicRoughnessProgram.mFeatures.hasSrgb = true; + + gGLTFPBRMetallicRoughnessProgram.mShaderFiles.clear(); + gGLTFPBRMetallicRoughnessProgram.mShaderFiles.push_back(make_pair("gltf/pbrmetallicroughnessV.glsl", GL_VERTEX_SHADER)); + gGLTFPBRMetallicRoughnessProgram.mShaderFiles.push_back(make_pair("gltf/pbrmetallicroughnessF.glsl", GL_FRAGMENT_SHADER)); + gGLTFPBRMetallicRoughnessProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + gGLTFPBRMetallicRoughnessProgram.clearPermutations(); + + success = make_gltf_variants(gGLTFPBRMetallicRoughnessProgram, use_sun_shadow); + + llassert(success); + } + + if (success) + { gPBRGlowProgram.mName = " PBR Glow Shader"; gPBRGlowProgram.mFeatures.hasSrgb = true; gPBRGlowProgram.mShaderFiles.clear(); @@ -1221,7 +1339,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() success = make_rigged_variant(gPBRGlowProgram, gPBRGlowSkinnedProgram); if (success) { - success = gPBRGlowProgram.createShader(NULL, NULL); + success = gPBRGlowProgram.createShader(); } llassert(success); } @@ -1237,7 +1355,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gHUDPBROpaqueProgram.clearPermutations(); gHUDPBROpaqueProgram.addPermutation("IS_HUD", "1"); - success = gHUDPBROpaqueProgram.createShader(NULL, NULL); + success = gHUDPBROpaqueProgram.createShader(); llassert(success); } @@ -1282,7 +1400,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() success = make_rigged_variant(*shader, gDeferredSkinnedPBRAlphaProgram); if (success) { - success = shader->createShader(NULL, NULL); + success = shader->createShader(); } llassert(success); @@ -1311,7 +1429,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() shader->addPermutation("IS_HUD", "1"); shader->mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = shader->createShader(NULL, NULL); + success = shader->createShader(); llassert(success); } @@ -1325,7 +1443,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() (mapping == 1 ? "flat" : "triplanar")); gDeferredPBRTerrainProgram.mFeatures.hasSrgb = true; gDeferredPBRTerrainProgram.mFeatures.isAlphaLighting = true; - gDeferredPBRTerrainProgram.mFeatures.disableTextureIndex = true; //hack to disable auto-setup of texture channels gDeferredPBRTerrainProgram.mFeatures.calculatesAtmospherics = true; gDeferredPBRTerrainProgram.mFeatures.hasAtmospherics = true; gDeferredPBRTerrainProgram.mFeatures.hasGamma = true; @@ -1338,7 +1455,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredPBRTerrainProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; gDeferredPBRTerrainProgram.addPermutation("TERRAIN_PBR_DETAIL", llformat("%d", detail)); gDeferredPBRTerrainProgram.addPermutation("TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT", llformat("%d", mapping)); - success = gDeferredPBRTerrainProgram.createShader(NULL, NULL); + success = gDeferredPBRTerrainProgram.createShader(); llassert(success); } @@ -1349,7 +1466,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredTreeProgram.mShaderFiles.push_back(make_pair("deferred/treeV.glsl", GL_VERTEX_SHADER)); gDeferredTreeProgram.mShaderFiles.push_back(make_pair("deferred/treeF.glsl", GL_FRAGMENT_SHADER)); gDeferredTreeProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gDeferredTreeProgram.createShader(NULL, NULL); + success = gDeferredTreeProgram.createShader(); } if (success) @@ -1360,7 +1477,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredTreeShadowProgram.mShaderFiles.push_back(make_pair("deferred/treeShadowF.glsl", GL_FRAGMENT_SHADER)); gDeferredTreeShadowProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; gDeferredTreeShadowProgram.mRiggedVariant = &gDeferredSkinnedTreeShadowProgram; - success = gDeferredTreeShadowProgram.createShader(NULL, NULL); + success = gDeferredTreeShadowProgram.createShader(); llassert(success); } @@ -1372,7 +1489,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredSkinnedTreeShadowProgram.mShaderFiles.push_back(make_pair("deferred/treeShadowSkinnedV.glsl", GL_VERTEX_SHADER)); gDeferredSkinnedTreeShadowProgram.mShaderFiles.push_back(make_pair("deferred/treeShadowF.glsl", GL_FRAGMENT_SHADER)); gDeferredSkinnedTreeShadowProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gDeferredSkinnedTreeShadowProgram.createShader(NULL, NULL); + success = gDeferredSkinnedTreeShadowProgram.createShader(); llassert(success); } @@ -1384,7 +1501,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredImpostorProgram.mShaderFiles.push_back(make_pair("deferred/impostorV.glsl", GL_VERTEX_SHADER)); gDeferredImpostorProgram.mShaderFiles.push_back(make_pair("deferred/impostorF.glsl", GL_FRAGMENT_SHADER)); gDeferredImpostorProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gDeferredImpostorProgram.createShader(NULL, NULL); + success = gDeferredImpostorProgram.createShader(); llassert(success); } @@ -1402,7 +1519,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredLightProgram.clearPermutations(); - success = gDeferredLightProgram.createShader(NULL, NULL); + success = gDeferredLightProgram.createShader(); llassert(success); } @@ -1422,7 +1539,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredMultiLightProgram[i].mShaderLevel = mShaderLevel[SHADER_DEFERRED]; gDeferredMultiLightProgram[i].addPermutation("LIGHT_COUNT", llformat("%d", i+1)); - success = gDeferredMultiLightProgram[i].createShader(NULL, NULL); + success = gDeferredMultiLightProgram[i].createShader(); llassert(success); } } @@ -1440,7 +1557,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/spotLightF.glsl", GL_FRAGMENT_SHADER)); gDeferredSpotLightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gDeferredSpotLightProgram.createShader(NULL, NULL); + success = gDeferredSpotLightProgram.createShader(); llassert(success); } @@ -1458,7 +1575,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredMultiSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/spotLightF.glsl", GL_FRAGMENT_SHADER)); gDeferredMultiSpotLightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gDeferredMultiSpotLightProgram.createShader(NULL, NULL); + success = gDeferredMultiSpotLightProgram.createShader(); llassert(success); } @@ -1492,7 +1609,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredSunProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER)); gDeferredSunProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gDeferredSunProgram.createShader(NULL, NULL); + success = gDeferredSunProgram.createShader(); llassert(success); } @@ -1506,7 +1623,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredBlurLightProgram.mShaderFiles.push_back(make_pair("deferred/blurLightF.glsl", GL_FRAGMENT_SHADER)); gDeferredBlurLightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gDeferredBlurLightProgram.createShader(NULL, NULL); + success = gDeferredBlurLightProgram.createShader(); llassert(success); } @@ -1539,7 +1656,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() shader->mFeatures.calculatesLighting = false; shader->mFeatures.hasLighting = false; shader->mFeatures.isAlphaLighting = true; - shader->mFeatures.disableTextureIndex = true; //hack to disable auto-setup of texture channels shader->mFeatures.hasSrgb = true; shader->mFeatures.calculatesAtmospherics = true; shader->mFeatures.hasAtmospherics = true; @@ -1573,7 +1689,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() shader->mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = shader->createShader(NULL, NULL); + success = shader->createShader(); llassert(success); // Hack @@ -1632,7 +1748,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() { shader->mRiggedVariant = shaders[1]; } - success = shader->createShader(NULL, NULL); + success = shader->createShader(); llassert(success); // End Hack @@ -1647,7 +1763,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredAvatarEyesProgram.mFeatures.calculatesAtmospherics = true; gDeferredAvatarEyesProgram.mFeatures.hasGamma = true; gDeferredAvatarEyesProgram.mFeatures.hasAtmospherics = true; - gDeferredAvatarEyesProgram.mFeatures.disableTextureIndex = true; gDeferredAvatarEyesProgram.mFeatures.hasSrgb = true; gDeferredAvatarEyesProgram.mFeatures.hasShadows = true; @@ -1655,7 +1770,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredAvatarEyesProgram.mShaderFiles.push_back(make_pair("deferred/avatarEyesV.glsl", GL_VERTEX_SHADER)); gDeferredAvatarEyesProgram.mShaderFiles.push_back(make_pair("deferred/diffuseF.glsl", GL_FRAGMENT_SHADER)); gDeferredAvatarEyesProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gDeferredAvatarEyesProgram.createShader(NULL, NULL); + success = gDeferredAvatarEyesProgram.createShader(); llassert(success); } @@ -1672,7 +1787,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredFullbrightProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightF.glsl", GL_FRAGMENT_SHADER)); gDeferredFullbrightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; success = make_rigged_variant(gDeferredFullbrightProgram, gDeferredSkinnedFullbrightProgram); - success = gDeferredFullbrightProgram.createShader(NULL, NULL); + success = gDeferredFullbrightProgram.createShader(); llassert(success); } @@ -1690,7 +1805,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gHUDFullbrightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; gHUDFullbrightProgram.clearPermutations(); gHUDFullbrightProgram.addPermutation("IS_HUD", "1"); - success = gHUDFullbrightProgram.createShader(NULL, NULL); + success = gHUDFullbrightProgram.createShader(); llassert(success); } @@ -1709,7 +1824,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredFullbrightAlphaMaskProgram.addPermutation("HAS_ALPHA_MASK","1"); gDeferredFullbrightAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; success = make_rigged_variant(gDeferredFullbrightAlphaMaskProgram, gDeferredSkinnedFullbrightAlphaMaskProgram); - success = success && gDeferredFullbrightAlphaMaskProgram.createShader(NULL, NULL); + success = success && gDeferredFullbrightAlphaMaskProgram.createShader(); llassert(success); } @@ -1728,7 +1843,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gHUDFullbrightAlphaMaskProgram.addPermutation("HAS_ALPHA_MASK", "1"); gHUDFullbrightAlphaMaskProgram.addPermutation("IS_HUD", "1"); gHUDFullbrightAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gHUDFullbrightAlphaMaskProgram.createShader(NULL, NULL); + success = gHUDFullbrightAlphaMaskProgram.createShader(); llassert(success); } @@ -1749,7 +1864,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredFullbrightAlphaMaskAlphaProgram.addPermutation("IS_ALPHA", "1"); gDeferredFullbrightAlphaMaskAlphaProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; success = make_rigged_variant(gDeferredFullbrightAlphaMaskAlphaProgram, gDeferredSkinnedFullbrightAlphaMaskAlphaProgram); - success = success && gDeferredFullbrightAlphaMaskAlphaProgram.createShader(NULL, NULL); + success = success && gDeferredFullbrightAlphaMaskAlphaProgram.createShader(); llassert(success); } @@ -1770,7 +1885,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gHUDFullbrightAlphaMaskAlphaProgram.addPermutation("IS_ALPHA", "1"); gHUDFullbrightAlphaMaskAlphaProgram.addPermutation("IS_HUD", "1"); gHUDFullbrightAlphaMaskAlphaProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = success && gHUDFullbrightAlphaMaskAlphaProgram.createShader(NULL, NULL); + success = success && gHUDFullbrightAlphaMaskAlphaProgram.createShader(); llassert(success); } @@ -1788,7 +1903,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredFullbrightShinyProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; gDeferredFullbrightShinyProgram.mFeatures.hasReflectionProbes = true; success = make_rigged_variant(gDeferredFullbrightShinyProgram, gDeferredSkinnedFullbrightShinyProgram); - success = success && gDeferredFullbrightShinyProgram.createShader(NULL, NULL); + success = success && gDeferredFullbrightShinyProgram.createShader(); llassert(success); } @@ -1807,7 +1922,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gHUDFullbrightShinyProgram.mFeatures.hasReflectionProbes = true; gHUDFullbrightShinyProgram.clearPermutations(); gHUDFullbrightShinyProgram.addPermutation("IS_HUD", "1"); - success = gHUDFullbrightShinyProgram.createShader(NULL, NULL); + success = gHUDFullbrightShinyProgram.createShader(); llassert(success); } @@ -1823,7 +1938,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredEmissiveProgram.mShaderFiles.push_back(make_pair("deferred/emissiveF.glsl", GL_FRAGMENT_SHADER)); gDeferredEmissiveProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; success = make_rigged_variant(gDeferredEmissiveProgram, gDeferredSkinnedEmissiveProgram); - success = success && gDeferredEmissiveProgram.createShader(NULL, NULL); + success = success && gDeferredEmissiveProgram.createShader(); llassert(success); } @@ -1856,7 +1971,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredSoftenProgram.addPermutation("HAS_SSAO", "1"); } - success = gDeferredSoftenProgram.createShader(NULL, NULL); + success = gDeferredSoftenProgram.createShader(); llassert(success); } @@ -1878,7 +1993,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gHazeProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gHazeProgram.createShader(NULL, NULL); + success = gHazeProgram.createShader(); llassert(success); } @@ -1902,7 +2017,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gHazeWaterProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gHazeWaterProgram.createShader(NULL, NULL); + success = gHazeWaterProgram.createShader(); llassert(success); } @@ -1915,7 +2030,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredShadowProgram.mShaderFiles.push_back(make_pair("deferred/shadowF.glsl", GL_FRAGMENT_SHADER)); gDeferredShadowProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; gDeferredShadowProgram.mRiggedVariant = &gDeferredSkinnedShadowProgram; - success = gDeferredShadowProgram.createShader(NULL, NULL); + success = gDeferredShadowProgram.createShader(); llassert(success); } @@ -1930,7 +2045,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredSkinnedShadowProgram.mShaderFiles.push_back(make_pair("deferred/shadowF.glsl", GL_FRAGMENT_SHADER)); gDeferredSkinnedShadowProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; // gDeferredSkinnedShadowProgram.addPermutation("DEPTH_CLAMP", "1"); // disable depth clamp for now - success = gDeferredSkinnedShadowProgram.createShader(NULL, NULL); + success = gDeferredSkinnedShadowProgram.createShader(); llassert(success); } @@ -1944,7 +2059,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredShadowCubeProgram.mShaderFiles.push_back(make_pair("deferred/shadowF.glsl", GL_FRAGMENT_SHADER)); // gDeferredShadowCubeProgram.addPermutation("DEPTH_CLAMP", "1"); gDeferredShadowCubeProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gDeferredShadowCubeProgram.createShader(NULL, NULL); + success = gDeferredShadowCubeProgram.createShader(); llassert(success); } @@ -1962,7 +2077,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredShadowFullbrightAlphaMaskProgram.addPermutation("IS_FULLBRIGHT", "1"); gDeferredShadowFullbrightAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; success = make_rigged_variant(gDeferredShadowFullbrightAlphaMaskProgram, gDeferredSkinnedShadowFullbrightAlphaMaskProgram); - success = success && gDeferredShadowFullbrightAlphaMaskProgram.createShader(NULL, NULL); + success = success && gDeferredShadowFullbrightAlphaMaskProgram.createShader(); llassert(success); } @@ -1976,7 +2091,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredShadowAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/shadowAlphaMaskF.glsl", GL_FRAGMENT_SHADER)); gDeferredShadowAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; success = make_rigged_variant(gDeferredShadowAlphaMaskProgram, gDeferredSkinnedShadowAlphaMaskProgram); - success = success && gDeferredShadowAlphaMaskProgram.createShader(NULL, NULL); + success = success && gDeferredShadowAlphaMaskProgram.createShader(); llassert(success); } @@ -1990,7 +2105,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredShadowGLTFAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; gDeferredShadowGLTFAlphaMaskProgram.clearPermutations(); success = make_rigged_variant(gDeferredShadowGLTFAlphaMaskProgram, gDeferredSkinnedShadowGLTFAlphaMaskProgram); - success = success && gDeferredShadowGLTFAlphaMaskProgram.createShader(NULL, NULL); + success = success && gDeferredShadowGLTFAlphaMaskProgram.createShader(); llassert(success); } @@ -2003,7 +2118,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredShadowGLTFAlphaBlendProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; gDeferredShadowGLTFAlphaBlendProgram.clearPermutations(); success = make_rigged_variant(gDeferredShadowGLTFAlphaBlendProgram, gDeferredSkinnedShadowGLTFAlphaBlendProgram); - success = success && gDeferredShadowGLTFAlphaBlendProgram.createShader(NULL, NULL); + success = success && gDeferredShadowGLTFAlphaBlendProgram.createShader(); llassert(success); } @@ -2016,7 +2131,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredAvatarShadowProgram.mShaderFiles.push_back(make_pair("deferred/avatarShadowV.glsl", GL_VERTEX_SHADER)); gDeferredAvatarShadowProgram.mShaderFiles.push_back(make_pair("deferred/avatarShadowF.glsl", GL_FRAGMENT_SHADER)); gDeferredAvatarShadowProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gDeferredAvatarShadowProgram.createShader(NULL, NULL); + success = gDeferredAvatarShadowProgram.createShader(); llassert(success); } @@ -2028,7 +2143,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredAvatarAlphaShadowProgram.mShaderFiles.push_back(make_pair("deferred/avatarAlphaShadowV.glsl", GL_VERTEX_SHADER)); gDeferredAvatarAlphaShadowProgram.mShaderFiles.push_back(make_pair("deferred/avatarAlphaShadowF.glsl", GL_FRAGMENT_SHADER)); gDeferredAvatarAlphaShadowProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gDeferredAvatarAlphaShadowProgram.createShader(NULL, NULL); + success = gDeferredAvatarAlphaShadowProgram.createShader(); llassert(success); } if (success) @@ -2039,7 +2154,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredAvatarAlphaMaskShadowProgram.mShaderFiles.push_back(make_pair("deferred/avatarAlphaShadowV.glsl", GL_VERTEX_SHADER)); gDeferredAvatarAlphaMaskShadowProgram.mShaderFiles.push_back(make_pair("deferred/avatarAlphaMaskShadowF.glsl", GL_FRAGMENT_SHADER)); gDeferredAvatarAlphaMaskShadowProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gDeferredAvatarAlphaMaskShadowProgram.createShader(NULL, NULL); + success = gDeferredAvatarAlphaMaskShadowProgram.createShader(); llassert(success); } @@ -2048,7 +2163,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredTerrainProgram.mName = "Deferred Terrain Shader"; gDeferredTerrainProgram.mFeatures.hasSrgb = true; gDeferredTerrainProgram.mFeatures.isAlphaLighting = true; - gDeferredTerrainProgram.mFeatures.disableTextureIndex = true; //hack to disable auto-setup of texture channels gDeferredTerrainProgram.mFeatures.calculatesAtmospherics = true; gDeferredTerrainProgram.mFeatures.hasAtmospherics = true; gDeferredTerrainProgram.mFeatures.hasGamma = true; @@ -2057,7 +2171,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredTerrainProgram.mShaderFiles.push_back(make_pair("deferred/terrainV.glsl", GL_VERTEX_SHADER)); gDeferredTerrainProgram.mShaderFiles.push_back(make_pair("deferred/terrainF.glsl", GL_FRAGMENT_SHADER)); gDeferredTerrainProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gDeferredTerrainProgram.createShader(NULL, NULL); + success = gDeferredTerrainProgram.createShader(); llassert(success); } @@ -2069,7 +2183,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredAvatarProgram.mShaderFiles.push_back(make_pair("deferred/avatarV.glsl", GL_VERTEX_SHADER)); gDeferredAvatarProgram.mShaderFiles.push_back(make_pair("deferred/avatarF.glsl", GL_FRAGMENT_SHADER)); gDeferredAvatarProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gDeferredAvatarProgram.createShader(NULL, NULL); + success = gDeferredAvatarProgram.createShader(); llassert(success); } @@ -2080,7 +2194,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredAvatarAlphaProgram.mFeatures.calculatesLighting = false; gDeferredAvatarAlphaProgram.mFeatures.hasLighting = false; gDeferredAvatarAlphaProgram.mFeatures.isAlphaLighting = true; - gDeferredAvatarAlphaProgram.mFeatures.disableTextureIndex = true; gDeferredAvatarAlphaProgram.mFeatures.hasSrgb = true; gDeferredAvatarAlphaProgram.mFeatures.calculatesAtmospherics = true; gDeferredAvatarAlphaProgram.mFeatures.hasAtmospherics = true; @@ -2103,7 +2216,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredAvatarAlphaProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gDeferredAvatarAlphaProgram.createShader(NULL, NULL); + success = gDeferredAvatarAlphaProgram.createShader(); llassert(success); gDeferredAvatarAlphaProgram.mFeatures.calculatesLighting = true; @@ -2121,7 +2234,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gExposureProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER)); gExposureProgram.mShaderFiles.push_back(make_pair("deferred/exposureF.glsl", GL_FRAGMENT_SHADER)); gExposureProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gExposureProgram.createShader(NULL, NULL); + success = gExposureProgram.createShader(); llassert(success); } @@ -2135,7 +2248,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gExposureProgramNoFade.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER)); gExposureProgramNoFade.mShaderFiles.push_back(make_pair("deferred/exposureF.glsl", GL_FRAGMENT_SHADER)); gExposureProgramNoFade.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gExposureProgramNoFade.createShader(NULL, NULL); + success = gExposureProgramNoFade.createShader(); llassert(success); } @@ -2147,7 +2260,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gLuminanceProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER)); gLuminanceProgram.mShaderFiles.push_back(make_pair("deferred/luminanceF.glsl", GL_FRAGMENT_SHADER)); gLuminanceProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gLuminanceProgram.createShader(NULL, NULL); + success = gLuminanceProgram.createShader(); llassert(success); } @@ -2161,7 +2274,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredPostGammaCorrectProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER)); gDeferredPostGammaCorrectProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredGammaCorrect.glsl", GL_FRAGMENT_SHADER)); gDeferredPostGammaCorrectProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gDeferredPostGammaCorrectProgram.createShader(NULL, NULL); + success = gDeferredPostGammaCorrectProgram.createShader(); llassert(success); } @@ -2176,7 +2289,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gNoPostGammaCorrectProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER)); gNoPostGammaCorrectProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredGammaCorrect.glsl", GL_FRAGMENT_SHADER)); gNoPostGammaCorrectProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gNoPostGammaCorrectProgram.createShader(NULL, NULL); + success = gNoPostGammaCorrectProgram.createShader(); llassert(success); } @@ -2191,7 +2304,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gLegacyPostGammaCorrectProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER)); gLegacyPostGammaCorrectProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredGammaCorrect.glsl", GL_FRAGMENT_SHADER)); gLegacyPostGammaCorrectProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gLegacyPostGammaCorrectProgram.createShader(NULL, NULL); + success = gLegacyPostGammaCorrectProgram.createShader(); llassert(success); } @@ -2204,7 +2317,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gFXAAProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredV.glsl", GL_VERTEX_SHADER)); gFXAAProgram.mShaderFiles.push_back(make_pair("deferred/fxaaF.glsl", GL_FRAGMENT_SHADER)); gFXAAProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gFXAAProgram.createShader(NULL, NULL); + success = gFXAAProgram.createShader(); llassert(success); } @@ -2216,7 +2329,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredPostProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER)); gDeferredPostProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredF.glsl", GL_FRAGMENT_SHADER)); gDeferredPostProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gDeferredPostProgram.createShader(NULL, NULL); + success = gDeferredPostProgram.createShader(); llassert(success); } @@ -2228,7 +2341,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredCoFProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER)); gDeferredCoFProgram.mShaderFiles.push_back(make_pair("deferred/cofF.glsl", GL_FRAGMENT_SHADER)); gDeferredCoFProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gDeferredCoFProgram.createShader(NULL, NULL); + success = gDeferredCoFProgram.createShader(); llassert(success); } @@ -2240,7 +2353,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredDoFCombineProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER)); gDeferredDoFCombineProgram.mShaderFiles.push_back(make_pair("deferred/dofCombineF.glsl", GL_FRAGMENT_SHADER)); gDeferredDoFCombineProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gDeferredDoFCombineProgram.createShader(NULL, NULL); + success = gDeferredDoFCombineProgram.createShader(); llassert(success); } @@ -2252,7 +2365,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredPostNoDoFProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER)); gDeferredPostNoDoFProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoDoFF.glsl", GL_FRAGMENT_SHADER)); gDeferredPostNoDoFProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gDeferredPostNoDoFProgram.createShader(NULL, NULL); + success = gDeferredPostNoDoFProgram.createShader(); llassert(success); } @@ -2272,7 +2385,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gEnvironmentMapProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; gEnvironmentMapProgram.mShaderGroup = LLGLSLShader::SG_SKY; - success = gEnvironmentMapProgram.createShader(NULL, NULL); + success = gEnvironmentMapProgram.createShader(); llassert(success); } @@ -2290,7 +2403,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredWLSkyProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; gDeferredWLSkyProgram.mShaderGroup = LLGLSLShader::SG_SKY; - success = gDeferredWLSkyProgram.createShader(NULL, NULL); + success = gDeferredWLSkyProgram.createShader(); llassert(success); } @@ -2308,7 +2421,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredWLCloudProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; gDeferredWLCloudProgram.mShaderGroup = LLGLSLShader::SG_SKY; gDeferredWLCloudProgram.addConstant( LLGLSLShader::SHADER_CONST_CLOUD_MOON_DEPTH ); // SL-14113 - success = gDeferredWLCloudProgram.createShader(NULL, NULL); + success = gDeferredWLCloudProgram.createShader(); llassert(success); } @@ -2319,14 +2432,13 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredWLSunProgram.mFeatures.hasAtmospherics = true; gDeferredWLSunProgram.mFeatures.hasGamma = true; gDeferredWLSunProgram.mFeatures.hasAtmospherics = true; - gDeferredWLSunProgram.mFeatures.disableTextureIndex = true; gDeferredWLSunProgram.mFeatures.hasSrgb = true; gDeferredWLSunProgram.mShaderFiles.clear(); gDeferredWLSunProgram.mShaderFiles.push_back(make_pair("deferred/sunDiscV.glsl", GL_VERTEX_SHADER)); gDeferredWLSunProgram.mShaderFiles.push_back(make_pair("deferred/sunDiscF.glsl", GL_FRAGMENT_SHADER)); gDeferredWLSunProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; gDeferredWLSunProgram.mShaderGroup = LLGLSLShader::SG_SKY; - success = gDeferredWLSunProgram.createShader(NULL, NULL); + success = gDeferredWLSunProgram.createShader(); llassert(success); } @@ -2338,7 +2450,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredWLMoonProgram.mFeatures.hasGamma = true; gDeferredWLMoonProgram.mFeatures.hasAtmospherics = true; gDeferredWLMoonProgram.mFeatures.hasSrgb = true; - gDeferredWLMoonProgram.mFeatures.disableTextureIndex = true; gDeferredWLMoonProgram.mShaderFiles.clear(); gDeferredWLMoonProgram.mShaderFiles.push_back(make_pair("deferred/moonV.glsl", GL_VERTEX_SHADER)); @@ -2346,7 +2457,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredWLMoonProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; gDeferredWLMoonProgram.mShaderGroup = LLGLSLShader::SG_SKY; gDeferredWLMoonProgram.addConstant( LLGLSLShader::SHADER_CONST_CLOUD_MOON_DEPTH ); // SL-14113 - success = gDeferredWLMoonProgram.createShader(NULL, NULL); + success = gDeferredWLMoonProgram.createShader(); llassert(success); } @@ -2359,7 +2470,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredStarProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; gDeferredStarProgram.mShaderGroup = LLGLSLShader::SG_SKY; gDeferredStarProgram.addConstant( LLGLSLShader::SHADER_CONST_STAR_DEPTH ); // SL-14113 - success = gDeferredStarProgram.createShader(NULL, NULL); + success = gDeferredStarProgram.createShader(); llassert(success); } @@ -2371,7 +2482,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gNormalMapGenProgram.mShaderFiles.push_back(make_pair("deferred/normgenF.glsl", GL_FRAGMENT_SHADER)); gNormalMapGenProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; gNormalMapGenProgram.mShaderGroup = LLGLSLShader::SG_SKY; - success = gNormalMapGenProgram.createShader(NULL, NULL); + success = gNormalMapGenProgram.createShader(); } if (success) @@ -2381,7 +2492,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredGenBrdfLutProgram.mShaderFiles.push_back(make_pair("deferred/genbrdflutV.glsl", GL_VERTEX_SHADER)); gDeferredGenBrdfLutProgram.mShaderFiles.push_back(make_pair("deferred/genbrdflutF.glsl", GL_FRAGMENT_SHADER)); gDeferredGenBrdfLutProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gDeferredGenBrdfLutProgram.createShader(NULL, NULL); + success = gDeferredGenBrdfLutProgram.createShader(); } if (success) { @@ -2392,7 +2503,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gPostScreenSpaceReflectionProgram.mFeatures.hasScreenSpaceReflections = true; gPostScreenSpaceReflectionProgram.mFeatures.isDeferred = true; gPostScreenSpaceReflectionProgram.mShaderLevel = 3; - success = gPostScreenSpaceReflectionProgram.createShader(NULL, NULL); + success = gPostScreenSpaceReflectionProgram.createShader(); } if (success) { @@ -2401,16 +2512,16 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredBufferVisualProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER)); gDeferredBufferVisualProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredVisualizeBuffers.glsl", GL_FRAGMENT_SHADER)); gDeferredBufferVisualProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gDeferredBufferVisualProgram.createShader(NULL, NULL); + success = gDeferredBufferVisualProgram.createShader(); } return success; } -BOOL LLViewerShaderMgr::loadShadersObject() +bool LLViewerShaderMgr::loadShadersObject() { LL_PROFILE_ZONE_SCOPED; - BOOL success = TRUE; + bool success = true; if (success) { @@ -2420,7 +2531,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectBumpProgram.mShaderFiles.push_back(make_pair("objects/bumpF.glsl", GL_FRAGMENT_SHADER)); gObjectBumpProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT]; success = make_rigged_variant(gObjectBumpProgram, gSkinnedObjectBumpProgram); - success = success && gObjectBumpProgram.createShader(NULL, NULL); + success = success && gObjectBumpProgram.createShader(); if (success) { //lldrawpoolbump assumes "texture0" has channel 0 and "texture1" has channel 1 LLGLSLShader* shader[] = { &gObjectBumpProgram, &gSkinnedObjectBumpProgram }; @@ -2442,37 +2553,34 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectAlphaMaskNoColorProgram.mFeatures.hasGamma = true; gObjectAlphaMaskNoColorProgram.mFeatures.hasAtmospherics = true; gObjectAlphaMaskNoColorProgram.mFeatures.hasLighting = true; - gObjectAlphaMaskNoColorProgram.mFeatures.disableTextureIndex = true; gObjectAlphaMaskNoColorProgram.mFeatures.hasAlphaMask = true; gObjectAlphaMaskNoColorProgram.mShaderFiles.clear(); gObjectAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("objects/simpleNoColorV.glsl", GL_VERTEX_SHADER)); gObjectAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER)); gObjectAlphaMaskNoColorProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT]; - success = gObjectAlphaMaskNoColorProgram.createShader(NULL, NULL); + success = gObjectAlphaMaskNoColorProgram.createShader(); } if (success) { gImpostorProgram.mName = "Impostor Shader"; - gImpostorProgram.mFeatures.disableTextureIndex = true; gImpostorProgram.mFeatures.hasSrgb = true; gImpostorProgram.mShaderFiles.clear(); gImpostorProgram.mShaderFiles.push_back(make_pair("objects/impostorV.glsl", GL_VERTEX_SHADER)); gImpostorProgram.mShaderFiles.push_back(make_pair("objects/impostorF.glsl", GL_FRAGMENT_SHADER)); gImpostorProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT]; - success = gImpostorProgram.createShader(NULL, NULL); + success = gImpostorProgram.createShader(); } if (success) { gObjectPreviewProgram.mName = "Object Preview Shader"; - gObjectPreviewProgram.mFeatures.disableTextureIndex = true; gObjectPreviewProgram.mShaderFiles.clear(); gObjectPreviewProgram.mShaderFiles.push_back(make_pair("objects/previewV.glsl", GL_VERTEX_SHADER)); gObjectPreviewProgram.mShaderFiles.push_back(make_pair("objects/previewF.glsl", GL_FRAGMENT_SHADER)); gObjectPreviewProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT]; success = make_rigged_variant(gObjectPreviewProgram, gSkinnedObjectPreviewProgram); - success = gObjectPreviewProgram.createShader(NULL, NULL); + success = gObjectPreviewProgram.createShader(); gObjectPreviewProgram.mFeatures.hasLighting = true; gSkinnedObjectPreviewProgram.mFeatures.hasLighting = true; } @@ -2485,36 +2593,34 @@ BOOL LLViewerShaderMgr::loadShadersObject() gPhysicsPreviewProgram.mFeatures.hasGamma = false; gPhysicsPreviewProgram.mFeatures.hasAtmospherics = false; gPhysicsPreviewProgram.mFeatures.hasLighting = false; - gPhysicsPreviewProgram.mFeatures.mIndexedTextureChannels = 0; - gPhysicsPreviewProgram.mFeatures.disableTextureIndex = true; gPhysicsPreviewProgram.mShaderFiles.clear(); gPhysicsPreviewProgram.mShaderFiles.push_back(make_pair("objects/previewPhysicsV.glsl", GL_VERTEX_SHADER)); gPhysicsPreviewProgram.mShaderFiles.push_back(make_pair("objects/previewPhysicsF.glsl", GL_FRAGMENT_SHADER)); gPhysicsPreviewProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT]; - success = gPhysicsPreviewProgram.createShader(NULL, NULL); + success = gPhysicsPreviewProgram.createShader(); gPhysicsPreviewProgram.mFeatures.hasLighting = false; } if (!success) { mShaderLevel[SHADER_OBJECT] = 0; - return FALSE; + return false; } - return TRUE; + return true; } -BOOL LLViewerShaderMgr::loadShadersAvatar() +bool LLViewerShaderMgr::loadShadersAvatar() { LL_PROFILE_ZONE_SCOPED; #if 1 // DEPRECATED -- forward rendering is deprecated - BOOL success = TRUE; + bool success = true; if (mShaderLevel[SHADER_AVATAR] == 0) { gAvatarProgram.unload(); gAvatarEyeballProgram.unload(); - return TRUE; + return true; } if (success) @@ -2527,12 +2633,11 @@ BOOL LLViewerShaderMgr::loadShadersAvatar() gAvatarProgram.mFeatures.hasAtmospherics = true; gAvatarProgram.mFeatures.hasLighting = true; gAvatarProgram.mFeatures.hasAlphaMask = true; - gAvatarProgram.mFeatures.disableTextureIndex = true; gAvatarProgram.mShaderFiles.clear(); gAvatarProgram.mShaderFiles.push_back(make_pair("avatar/avatarV.glsl", GL_VERTEX_SHADER)); gAvatarProgram.mShaderFiles.push_back(make_pair("avatar/avatarF.glsl", GL_FRAGMENT_SHADER)); gAvatarProgram.mShaderLevel = mShaderLevel[SHADER_AVATAR]; - success = gAvatarProgram.createShader(NULL, NULL); + success = gAvatarProgram.createShader(); /// Keep track of avatar levels if (gAvatarProgram.mShaderLevel != mShaderLevel[SHADER_AVATAR]) @@ -2551,28 +2656,27 @@ BOOL LLViewerShaderMgr::loadShadersAvatar() gAvatarEyeballProgram.mFeatures.hasAtmospherics = true; gAvatarEyeballProgram.mFeatures.hasLighting = true; gAvatarEyeballProgram.mFeatures.hasAlphaMask = true; - gAvatarEyeballProgram.mFeatures.disableTextureIndex = true; gAvatarEyeballProgram.mShaderFiles.clear(); gAvatarEyeballProgram.mShaderFiles.push_back(make_pair("avatar/eyeballV.glsl", GL_VERTEX_SHADER)); gAvatarEyeballProgram.mShaderFiles.push_back(make_pair("avatar/eyeballF.glsl", GL_FRAGMENT_SHADER)); gAvatarEyeballProgram.mShaderLevel = mShaderLevel[SHADER_AVATAR]; - success = gAvatarEyeballProgram.createShader(NULL, NULL); + success = gAvatarEyeballProgram.createShader(); } if( !success ) { mShaderLevel[SHADER_AVATAR] = 0; mMaxAvatarShaderLevel = 0; - return FALSE; + return false; } #endif - return TRUE; + return true; } -BOOL LLViewerShaderMgr::loadShadersInterface() +bool LLViewerShaderMgr::loadShadersInterface() { LL_PROFILE_ZONE_SCOPED; - BOOL success = TRUE; + bool success = true; if (success) { @@ -2582,7 +2686,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface() gHighlightProgram.mShaderFiles.push_back(make_pair("interface/highlightF.glsl", GL_FRAGMENT_SHADER)); gHighlightProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; success = make_rigged_variant(gHighlightProgram, gSkinnedHighlightProgram); - success = success && gHighlightProgram.createShader(NULL, NULL); + success = success && gHighlightProgram.createShader(); } if (success) @@ -2592,7 +2696,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface() gHighlightNormalProgram.mShaderFiles.push_back(make_pair("interface/highlightNormV.glsl", GL_VERTEX_SHADER)); gHighlightNormalProgram.mShaderFiles.push_back(make_pair("interface/highlightF.glsl", GL_FRAGMENT_SHADER)); gHighlightNormalProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; - success = gHighlightNormalProgram.createShader(NULL, NULL); + success = gHighlightNormalProgram.createShader(); } if (success) @@ -2602,7 +2706,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface() gHighlightSpecularProgram.mShaderFiles.push_back(make_pair("interface/highlightSpecV.glsl", GL_VERTEX_SHADER)); gHighlightSpecularProgram.mShaderFiles.push_back(make_pair("interface/highlightF.glsl", GL_FRAGMENT_SHADER)); gHighlightSpecularProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; - success = gHighlightSpecularProgram.createShader(NULL, NULL); + success = gHighlightSpecularProgram.createShader(); } if (success) @@ -2612,7 +2716,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface() gUIProgram.mShaderFiles.push_back(make_pair("interface/uiV.glsl", GL_VERTEX_SHADER)); gUIProgram.mShaderFiles.push_back(make_pair("interface/uiF.glsl", GL_FRAGMENT_SHADER)); gUIProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; - success = gUIProgram.createShader(NULL, NULL); + success = gUIProgram.createShader(); } if (success) @@ -2622,7 +2726,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface() gPathfindingProgram.mShaderFiles.push_back(make_pair("interface/pathfindingV.glsl", GL_VERTEX_SHADER)); gPathfindingProgram.mShaderFiles.push_back(make_pair("interface/pathfindingF.glsl", GL_FRAGMENT_SHADER)); gPathfindingProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; - success = gPathfindingProgram.createShader(NULL, NULL); + success = gPathfindingProgram.createShader(); } if (success) @@ -2632,7 +2736,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface() gPathfindingNoNormalsProgram.mShaderFiles.push_back(make_pair("interface/pathfindingNoNormalV.glsl", GL_VERTEX_SHADER)); gPathfindingNoNormalsProgram.mShaderFiles.push_back(make_pair("interface/pathfindingF.glsl", GL_FRAGMENT_SHADER)); gPathfindingNoNormalsProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; - success = gPathfindingNoNormalsProgram.createShader(NULL, NULL); + success = gPathfindingNoNormalsProgram.createShader(); } if (success) @@ -2642,7 +2746,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface() gGlowCombineProgram.mShaderFiles.push_back(make_pair("interface/glowcombineV.glsl", GL_VERTEX_SHADER)); gGlowCombineProgram.mShaderFiles.push_back(make_pair("interface/glowcombineF.glsl", GL_FRAGMENT_SHADER)); gGlowCombineProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; - success = gGlowCombineProgram.createShader(NULL, NULL); + success = gGlowCombineProgram.createShader(); if (success) { gGlowCombineProgram.bind(); @@ -2659,7 +2763,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface() gGlowCombineFXAAProgram.mShaderFiles.push_back(make_pair("interface/glowcombineFXAAV.glsl", GL_VERTEX_SHADER)); gGlowCombineFXAAProgram.mShaderFiles.push_back(make_pair("interface/glowcombineFXAAF.glsl", GL_FRAGMENT_SHADER)); gGlowCombineFXAAProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; - success = gGlowCombineFXAAProgram.createShader(NULL, NULL); + success = gGlowCombineFXAAProgram.createShader(); if (success) { gGlowCombineFXAAProgram.bind(); @@ -2677,7 +2781,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface() gTwoTextureCompareProgram.mShaderFiles.push_back(make_pair("interface/twotexturecompareV.glsl", GL_VERTEX_SHADER)); gTwoTextureCompareProgram.mShaderFiles.push_back(make_pair("interface/twotexturecompareF.glsl", GL_FRAGMENT_SHADER)); gTwoTextureCompareProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; - success = gTwoTextureCompareProgram.createShader(NULL, NULL); + success = gTwoTextureCompareProgram.createShader(); if (success) { gTwoTextureCompareProgram.bind(); @@ -2694,7 +2798,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface() gOneTextureFilterProgram.mShaderFiles.push_back(make_pair("interface/onetexturefilterV.glsl", GL_VERTEX_SHADER)); gOneTextureFilterProgram.mShaderFiles.push_back(make_pair("interface/onetexturefilterF.glsl", GL_FRAGMENT_SHADER)); gOneTextureFilterProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; - success = gOneTextureFilterProgram.createShader(NULL, NULL); + success = gOneTextureFilterProgram.createShader(); if (success) { gOneTextureFilterProgram.bind(); @@ -2710,7 +2814,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface() gSolidColorProgram.mShaderFiles.push_back(make_pair("interface/solidcolorV.glsl", GL_VERTEX_SHADER)); gSolidColorProgram.mShaderFiles.push_back(make_pair("interface/solidcolorF.glsl", GL_FRAGMENT_SHADER)); gSolidColorProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; - success = gSolidColorProgram.createShader(NULL, NULL); + success = gSolidColorProgram.createShader(); if (success) { gSolidColorProgram.bind(); @@ -2727,7 +2831,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface() gOcclusionProgram.mShaderFiles.push_back(make_pair("interface/occlusionF.glsl", GL_FRAGMENT_SHADER)); gOcclusionProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; gOcclusionProgram.mRiggedVariant = &gSkinnedOcclusionProgram; - success = gOcclusionProgram.createShader(NULL, NULL); + success = gOcclusionProgram.createShader(); } if (success) @@ -2738,7 +2842,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface() gSkinnedOcclusionProgram.mShaderFiles.push_back(make_pair("interface/occlusionSkinnedV.glsl", GL_VERTEX_SHADER)); gSkinnedOcclusionProgram.mShaderFiles.push_back(make_pair("interface/occlusionF.glsl", GL_FRAGMENT_SHADER)); gSkinnedOcclusionProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; - success = gSkinnedOcclusionProgram.createShader(NULL, NULL); + success = gSkinnedOcclusionProgram.createShader(); } if (success) @@ -2748,7 +2852,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface() gOcclusionCubeProgram.mShaderFiles.push_back(make_pair("interface/occlusionCubeV.glsl", GL_VERTEX_SHADER)); gOcclusionCubeProgram.mShaderFiles.push_back(make_pair("interface/occlusionF.glsl", GL_FRAGMENT_SHADER)); gOcclusionCubeProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; - success = gOcclusionCubeProgram.createShader(NULL, NULL); + success = gOcclusionCubeProgram.createShader(); } if (success) @@ -2760,7 +2864,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface() gDebugProgram.mRiggedVariant = &gSkinnedDebugProgram; gDebugProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; success = make_rigged_variant(gDebugProgram, gSkinnedDebugProgram); - success = success && gDebugProgram.createShader(NULL, NULL); + success = success && gDebugProgram.createShader(); } if (success) @@ -2786,7 +2890,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface() shader.addPermutation("HAS_ATTRIBUTE_TANGENT", "1"); } success = make_rigged_variant(shader, skinned_shader); - success = success && shader.createShader(NULL, NULL); + success = success && shader.createShader(); } } @@ -2797,7 +2901,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface() gClipProgram.mShaderFiles.push_back(make_pair("interface/clipV.glsl", GL_VERTEX_SHADER)); gClipProgram.mShaderFiles.push_back(make_pair("interface/clipF.glsl", GL_FRAGMENT_SHADER)); gClipProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; - success = gClipProgram.createShader(NULL, NULL); + success = gClipProgram.createShader(); } if (success) @@ -2807,7 +2911,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface() gBenchmarkProgram.mShaderFiles.push_back(make_pair("interface/benchmarkV.glsl", GL_VERTEX_SHADER)); gBenchmarkProgram.mShaderFiles.push_back(make_pair("interface/benchmarkF.glsl", GL_FRAGMENT_SHADER)); gBenchmarkProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; - success = gBenchmarkProgram.createShader(NULL, NULL); + success = gBenchmarkProgram.createShader(); } if (success) @@ -2823,7 +2927,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface() gReflectionProbeDisplayProgram.mShaderFiles.push_back(make_pair("interface/reflectionprobeV.glsl", GL_VERTEX_SHADER)); gReflectionProbeDisplayProgram.mShaderFiles.push_back(make_pair("interface/reflectionprobeF.glsl", GL_FRAGMENT_SHADER)); gReflectionProbeDisplayProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; - success = gReflectionProbeDisplayProgram.createShader(NULL, NULL); + success = gReflectionProbeDisplayProgram.createShader(); } if (success) @@ -2833,7 +2937,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface() gCopyProgram.mShaderFiles.push_back(make_pair("interface/copyV.glsl", GL_VERTEX_SHADER)); gCopyProgram.mShaderFiles.push_back(make_pair("interface/copyF.glsl", GL_FRAGMENT_SHADER)); gCopyProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; - success = gCopyProgram.createShader(NULL, NULL); + success = gCopyProgram.createShader(); } if (success) @@ -2845,7 +2949,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface() gCopyDepthProgram.clearPermutations(); gCopyDepthProgram.addPermutation("COPY_DEPTH", "1"); gCopyDepthProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; - success = gCopyDepthProgram.createShader(NULL, NULL); + success = gCopyDepthProgram.createShader(); } if (success) @@ -2855,7 +2959,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface() gAlphaMaskProgram.mShaderFiles.push_back(make_pair("interface/alphamaskV.glsl", GL_VERTEX_SHADER)); gAlphaMaskProgram.mShaderFiles.push_back(make_pair("interface/alphamaskF.glsl", GL_FRAGMENT_SHADER)); gAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; - success = gAlphaMaskProgram.createShader(NULL, NULL); + success = gAlphaMaskProgram.createShader(); } if (success) @@ -2869,7 +2973,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface() gReflectionMipProgram.mShaderFiles.push_back(make_pair("interface/splattexturerectV.glsl", GL_VERTEX_SHADER)); gReflectionMipProgram.mShaderFiles.push_back(make_pair("interface/reflectionmipF.glsl", GL_FRAGMENT_SHADER)); gReflectionMipProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; - success = gReflectionMipProgram.createShader(NULL, NULL); + success = gReflectionMipProgram.createShader(); } if (success) @@ -2883,7 +2987,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface() gGaussianProgram.mShaderFiles.push_back(make_pair("interface/splattexturerectV.glsl", GL_VERTEX_SHADER)); gGaussianProgram.mShaderFiles.push_back(make_pair("interface/gaussianF.glsl", GL_FRAGMENT_SHADER)); gGaussianProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; - success = gGaussianProgram.createShader(NULL, NULL); + success = gGaussianProgram.createShader(); } if (success && gGLManager.mHasCubeMapArray) @@ -2894,7 +2998,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface() gRadianceGenProgram.mShaderFiles.push_back(make_pair("interface/radianceGenF.glsl", GL_FRAGMENT_SHADER)); gRadianceGenProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; gRadianceGenProgram.addPermutation("PROBE_FILTER_SAMPLES", "32"); - success = gRadianceGenProgram.createShader(NULL, NULL); + success = gRadianceGenProgram.createShader(); } if (success && gGLManager.mHasCubeMapArray) @@ -2906,7 +3010,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface() gHeroRadianceGenProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; gHeroRadianceGenProgram.addPermutation("HERO_PROBES", "1"); gHeroRadianceGenProgram.addPermutation("PROBE_FILTER_SAMPLES", "4"); - success = gHeroRadianceGenProgram.createShader(NULL, NULL); + success = gHeroRadianceGenProgram.createShader(); } if (success && gGLManager.mHasCubeMapArray) @@ -2916,16 +3020,16 @@ BOOL LLViewerShaderMgr::loadShadersInterface() gIrradianceGenProgram.mShaderFiles.push_back(make_pair("interface/irradianceGenV.glsl", GL_VERTEX_SHADER)); gIrradianceGenProgram.mShaderFiles.push_back(make_pair("interface/irradianceGenF.glsl", GL_FRAGMENT_SHADER)); gIrradianceGenProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; - success = gIrradianceGenProgram.createShader(NULL, NULL); + success = gIrradianceGenProgram.createShader(); } if( !success ) { mShaderLevel[SHADER_INTERFACE] = 0; - return FALSE; + return false; } - return TRUE; + return true; } diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h index dbac352b92..60ce8c430b 100644 --- a/indra/newview/llviewershadermgr.h +++ b/indra/newview/llviewershadermgr.h @@ -35,7 +35,7 @@ class LLViewerShaderMgr: public LLShaderMgr { public: - static BOOL sInitialized; + static bool sInitialized; static bool sSkipReload; LLViewerShaderMgr(); @@ -58,12 +58,12 @@ public: // name of a file error happened at, otherwise // returns an empty string std::string loadBasicShaders(); - BOOL loadShadersEffects(); - BOOL loadShadersDeferred(); - BOOL loadShadersObject(); - BOOL loadShadersAvatar(); - BOOL loadShadersWater(); - BOOL loadShadersInterface(); + bool loadShadersEffects(); + bool loadShadersDeferred(); + bool loadShadersObject(); + bool loadShadersAvatar(); + bool loadShadersWater(); + bool loadShadersInterface(); std::vector<S32> mShaderLevel; S32 mMaxAvatarShaderLevel; @@ -287,6 +287,9 @@ extern LLGLSLShader gDeferredPBROpaqueProgram; extern LLGLSLShader gDeferredPBRAlphaProgram; extern LLGLSLShader gHUDPBRAlphaProgram; +// GLTF shaders +extern LLGLSLShader gGLTFPBRMetallicRoughnessProgram; + // Encodes detail level for dropping textures, in accordance with the GLTF spec where possible // 0 is highest detail, -1 drops emissive, etc // Dropping metallic roughness is off-spec - Reserve for potato machines as needed diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index b6935aa16a..fb874f9d7f 100644 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -337,7 +337,7 @@ void LLViewerStats::addToMessage(LLSD &body) { LLSD &misc = body["misc"]; - misc["Version"] = TRUE; + misc["Version"] = true; //TODO RN: get last value, not mean misc["Vertex Buffers Enabled"] = getRecording().getMean(LLStatViewer::ENABLE_VBO); diff --git a/indra/newview/llviewertexlayer.cpp b/indra/newview/llviewertexlayer.cpp index e57fec45e6..10380fecee 100644 --- a/indra/newview/llviewertexlayer.cpp +++ b/indra/newview/llviewertexlayer.cpp @@ -52,11 +52,11 @@ LLViewerTexLayerSetBuffer::LLViewerTexLayerSetBuffer(LLTexLayerSet* const owner, S32 width, S32 height) : // ORDER_LAST => must render these after the hints are created. LLTexLayerSetBuffer(owner), - LLViewerDynamicTexture(width, height, 4, LLViewerDynamicTexture::ORDER_LAST, FALSE), - mNeedsUpdate(TRUE), + LLViewerDynamicTexture(width, height, 4, LLViewerDynamicTexture::ORDER_LAST, false), + mNeedsUpdate(true), mNumLowresUpdates(0) { - mGLTexturep->setNeedsAlphaAndPickMask(FALSE); + mGLTexturep->setNeedsAlphaAndPickMask(false); LLViewerTexLayerSetBuffer::sGLByteCount += getSize(); mNeedsUpdateTimer.start(); @@ -99,7 +99,7 @@ void LLViewerTexLayerSetBuffer::dumpTotalByteCount() void LLViewerTexLayerSetBuffer::requestUpdate() { restartUpdateTimer(); - mNeedsUpdate = TRUE; + mNeedsUpdate = true; mNumLowresUpdates = 0; } @@ -110,30 +110,30 @@ void LLViewerTexLayerSetBuffer::restartUpdateTimer() } // virtual -BOOL LLViewerTexLayerSetBuffer::needsRender() +bool LLViewerTexLayerSetBuffer::needsRender() { llassert(mTexLayerSet->getAvatarAppearance() == gAgentAvatarp); - if (!isAgentAvatarValid()) return FALSE; + if (!isAgentAvatarValid()) return false; - const BOOL update_now = mNeedsUpdate && isReadyToUpdate(); + const bool update_now = mNeedsUpdate && isReadyToUpdate(); // Don't render if we don't want to (or aren't ready to) update. if (!update_now) { - return FALSE; + return false; } // Don't render if we're animating our appearance. if (gAgentAvatarp->getIsAppearanceAnimating()) { - return FALSE; + return false; } // Don't render if we are trying to create a skirt texture but aren't wearing a skirt. if (gAgentAvatarp->getBakedTE(getViewerTexLayerSet()) == LLAvatarAppearanceDefines::TEX_SKIRT_BAKED && !gAgentAvatarp->isWearingWearableType(LLWearableType::WT_SKIRT)) { - return FALSE; + return false; } // Render if we have at least minimal level of detail for each local texture. @@ -146,11 +146,11 @@ void LLViewerTexLayerSetBuffer::preRenderTexLayerSet() LLTexLayerSetBuffer::preRenderTexLayerSet(); // keep depth buffer, we don't need to clear it - LLViewerDynamicTexture::preRender(FALSE); + LLViewerDynamicTexture::preRender(false); } // virtual -void LLViewerTexLayerSetBuffer::postRenderTexLayerSet(BOOL success) +void LLViewerTexLayerSetBuffer::postRenderTexLayerSet(bool success) { LLTexLayerSetBuffer::postRenderTexLayerSet(success); @@ -158,9 +158,9 @@ void LLViewerTexLayerSetBuffer::postRenderTexLayerSet(BOOL success) } // virtual -void LLViewerTexLayerSetBuffer::midRenderTexLayerSet(BOOL success) +void LLViewerTexLayerSetBuffer::midRenderTexLayerSet(bool success) { - const BOOL update_now = mNeedsUpdate && isReadyToUpdate(); + const bool update_now = mNeedsUpdate && isReadyToUpdate(); if (update_now) { doUpdate(); @@ -171,18 +171,18 @@ void LLViewerTexLayerSetBuffer::midRenderTexLayerSet(BOOL success) mGLTexturep->setGLTextureCreated(true); } -BOOL LLViewerTexLayerSetBuffer::isInitialized(void) const +bool LLViewerTexLayerSetBuffer::isInitialized(void) const { return mGLTexturep.notNull() && mGLTexturep->isGLTextureCreated(); } -BOOL LLViewerTexLayerSetBuffer::isReadyToUpdate() const +bool LLViewerTexLayerSetBuffer::isReadyToUpdate() const { // If we requested an update and have the final LOD ready, then update. - if (getViewerTexLayerSet()->isLocalTextureDataFinal()) return TRUE; + if (getViewerTexLayerSet()->isLocalTextureDataFinal()) return true; // If we haven't done an update yet, then just do one now regardless of state of textures. - if (mNumLowresUpdates == 0) return TRUE; + if (mNumLowresUpdates == 0) return true; // Update if we've hit a timeout. Unlike for uploads, we can make this timeout fairly small // since render unnecessarily doesn't cost much. @@ -190,22 +190,22 @@ BOOL LLViewerTexLayerSetBuffer::isReadyToUpdate() const if (TEXTURE_TIMEOUT != 0) { // If we hit our timeout and have textures available at even lower resolution, then update. - const BOOL is_update_textures_timeout = mNeedsUpdateTimer.getElapsedTimeF32() >= TEXTURE_TIMEOUT; - const BOOL has_lower_lod = getViewerTexLayerSet()->isLocalTextureDataAvailable(); - if (has_lower_lod && is_update_textures_timeout) return TRUE; + const bool is_update_textures_timeout = mNeedsUpdateTimer.getElapsedTimeF32() >= TEXTURE_TIMEOUT; + const bool has_lower_lod = getViewerTexLayerSet()->isLocalTextureDataAvailable(); + if (has_lower_lod && is_update_textures_timeout) return true; } - return FALSE; + return false; } -BOOL LLViewerTexLayerSetBuffer::requestUpdateImmediate() +bool LLViewerTexLayerSetBuffer::requestUpdateImmediate() { - mNeedsUpdate = TRUE; - BOOL result = FALSE; + mNeedsUpdate = true; + bool result = false; if (needsRender()) { - preRender(FALSE); + preRender(false); result = render(); postRender(result); } @@ -218,10 +218,10 @@ BOOL LLViewerTexLayerSetBuffer::requestUpdateImmediate() void LLViewerTexLayerSetBuffer::doUpdate() { LLViewerTexLayerSet* layer_set = getViewerTexLayerSet(); - const BOOL highest_lod = layer_set->isLocalTextureDataFinal(); + const bool highest_lod = layer_set->isLocalTextureDataFinal(); if (highest_lod) { - mNeedsUpdate = FALSE; + mNeedsUpdate = false; } else { @@ -237,7 +237,7 @@ void LLViewerTexLayerSetBuffer::doUpdate() // Print out notification that we updated this texture. if (gSavedSettings.getBOOL("DebugAvatarRezTime")) { - const BOOL highest_lod = layer_set->isLocalTextureDataFinal(); + const bool highest_lod = layer_set->isLocalTextureDataFinal(); const std::string lod_str = highest_lod ? "HighRes" : "LowRes"; LLSD args; args["EXISTENCE"] = llformat("%d",(U32)layer_set->getAvatar()->debugGetExistenceTimeElapsedF32()); @@ -256,7 +256,7 @@ void LLViewerTexLayerSetBuffer::doUpdate() LLViewerTexLayerSet::LLViewerTexLayerSet(LLAvatarAppearance* const appearance) : LLTexLayerSet(appearance), - mUpdatesEnabled( FALSE ) + mUpdatesEnabled( false ) { } @@ -265,18 +265,18 @@ LLViewerTexLayerSet::~LLViewerTexLayerSet() { } -// Returns TRUE if at least one packet of data has been received for each of the textures that this layerset depends on. -BOOL LLViewerTexLayerSet::isLocalTextureDataAvailable() const +// Returns true if at least one packet of data has been received for each of the textures that this layerset depends on. +bool LLViewerTexLayerSet::isLocalTextureDataAvailable() const { - if (!mAvatarAppearance->isSelf()) return FALSE; + if (!mAvatarAppearance->isSelf()) return false; return getAvatar()->isLocalTextureDataAvailable(this); } -// Returns TRUE if all of the data for the textures that this layerset depends on have arrived. -BOOL LLViewerTexLayerSet::isLocalTextureDataFinal() const +// Returns true if all of the data for the textures that this layerset depends on have arrived. +bool LLViewerTexLayerSet::isLocalTextureDataFinal() const { - if (!mAvatarAppearance->isSelf()) return FALSE; + if (!mAvatarAppearance->isSelf()) return false; return getAvatar()->isLocalTextureDataFinal(this); } @@ -312,7 +312,7 @@ void LLViewerTexLayerSet::createComposite() } } -void LLViewerTexLayerSet::setUpdatesEnabled( BOOL b ) +void LLViewerTexLayerSet::setUpdatesEnabled( bool b ) { mUpdatesEnabled = b; } @@ -342,7 +342,7 @@ const std::string LLViewerTexLayerSetBuffer::dumpTextureInfo() const { if (!isAgentAvatarValid()) return ""; - const BOOL is_high_res = TRUE; + const bool is_high_res = true; const U32 num_low_res = 0; const std::string local_texture_info = gAgentAvatarp->debugDumpLocalTextureDataInfo(getViewerTexLayerSet()); diff --git a/indra/newview/llviewertexlayer.h b/indra/newview/llviewertexlayer.h index 0ced450299..6f95fcac6f 100644 --- a/indra/newview/llviewertexlayer.h +++ b/indra/newview/llviewertexlayer.h @@ -47,12 +47,12 @@ public: virtual ~LLViewerTexLayerSet(); /*virtual*/void requestUpdate(); - BOOL isLocalTextureDataAvailable() const; - BOOL isLocalTextureDataFinal() const; + bool isLocalTextureDataAvailable() const; + bool isLocalTextureDataFinal() const; void updateComposite(); /*virtual*/void createComposite(); - void setUpdatesEnabled(BOOL b); - BOOL getUpdatesEnabled() const { return mUpdatesEnabled; } + void setUpdatesEnabled(bool b); + bool getUpdatesEnabled() const { return mUpdatesEnabled; } LLVOAvatarSelf* getAvatar(); const LLVOAvatarSelf* getAvatar() const; @@ -60,7 +60,7 @@ public: const LLViewerTexLayerSetBuffer* getViewerComposite() const; private: - BOOL mUpdatesEnabled; + bool mUpdatesEnabled; }; @@ -79,7 +79,7 @@ public: public: /*virtual*/ S8 getType() const; - BOOL isInitialized(void) const; + bool isInitialized(void) const; static void dumpTotalByteCount(); const std::string dumpTextureInfo() const; virtual void restoreGLTexture(); @@ -95,8 +95,8 @@ private: // Tex Layer Render //-------------------------------------------------------------------- virtual void preRenderTexLayerSet(); - virtual void midRenderTexLayerSet(BOOL success); - virtual void postRenderTexLayerSet(BOOL success); + virtual void midRenderTexLayerSet(bool success); + virtual void postRenderTexLayerSet(bool success); virtual S32 getCompositeOriginX() const { return getOriginX(); } virtual S32 getCompositeOriginY() const { return getOriginY(); } virtual S32 getCompositeWidth() const { return getFullWidth(); } @@ -106,25 +106,25 @@ private: // Dynamic Texture Interface //-------------------------------------------------------------------- public: - /*virtual*/ BOOL needsRender(); + /*virtual*/ bool needsRender(); protected: // Pass these along for tex layer rendering. - virtual void preRender(BOOL clear_depth) { preRenderTexLayerSet(); } - virtual void postRender(BOOL success) { postRenderTexLayerSet(success); } - virtual BOOL render() { return renderTexLayerSet(mBoundTarget); } + virtual void preRender(bool clear_depth) { preRenderTexLayerSet(); } + virtual void postRender(bool success) { postRenderTexLayerSet(success); } + virtual bool render() { return renderTexLayerSet(mBoundTarget); } //-------------------------------------------------------------------- // Updates //-------------------------------------------------------------------- public: void requestUpdate(); - BOOL requestUpdateImmediate(); + bool requestUpdateImmediate(); protected: - BOOL isReadyToUpdate() const; + bool isReadyToUpdate() const; void doUpdate(); void restartUpdateTimer(); private: - BOOL mNeedsUpdate; // Whether we need to locally update our baked textures + bool mNeedsUpdate; // Whether we need to locally update our baked textures U32 mNumLowresUpdates; // Number of times we've locally updated with lowres version of our baked textures LLFrameTimer mNeedsUpdateTimer; // Tracks time since update was requested and performed. }; diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index bb025fbcd2..0ab0265586 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -233,19 +233,19 @@ public: } F32 right_x; - mStyle->getFont()->render(mLabel, 0, image_rect.mRight + EMBEDDED_ITEM_LABEL_PADDING, draw_rect.mTop, color, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::UNDERLINE, LLFontGL::NO_SHADOW, mLabel.length(), S32_MAX, &right_x); + mStyle->getFont()->render(mLabel, 0, image_rect.mRight + EMBEDDED_ITEM_LABEL_PADDING, draw_rect.mTop, color, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::UNDERLINE, LLFontGL::NO_SHADOW, static_cast<S32>(mLabel.length()), S32_MAX, &right_x); return right_x; } /*virtual*/ bool canEdit() const { return false; } - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask) + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask) { LLUI::getInstance()->getWindow()->setCursor(UI_CURSOR_HAND); - return TRUE; + return true; } - virtual BOOL handleToolTip(S32 x, S32 y, MASK mask ) + virtual bool handleToolTip(S32 x, S32 y, MASK mask ) { if (mItem->getThumbnailUUID().notNull()) { @@ -259,15 +259,15 @@ public: .create_callback(boost::bind(&LLInspectTextureUtil::createInventoryToolTip, _1)) .create_params(params)); - return TRUE; + return true; } if (!mToolTip.empty()) { LLToolTipMgr::instance().show(mToolTip); - return TRUE; + return true; } - return FALSE; + return false; } /*virtual*/ LLStyleConstSP getStyle() const { return mStyle; } @@ -305,10 +305,10 @@ public: // return true if there are no embedded items. bool empty(); - BOOL insertEmbeddedItem(LLInventoryItem* item, llwchar* value, bool is_new); - BOOL removeEmbeddedItem( llwchar ext_char ); + bool insertEmbeddedItem(LLInventoryItem* item, llwchar* value, bool is_new); + bool removeEmbeddedItem( llwchar ext_char ); - BOOL hasEmbeddedItem(llwchar ext_char); // returns TRUE if /this/ editor has an entry for this item + bool hasEmbeddedItem(llwchar ext_char); // returns true if /this/ editor has an entry for this item LLUIImagePtr getItemImage(llwchar ext_char) const; void getEmbeddedItemList( std::vector<LLPointer<LLInventoryItem> >& items ); @@ -323,14 +323,14 @@ public: void markSaved(); static LLPointer<LLInventoryItem> getEmbeddedItemPtr(llwchar ext_char); // returns pointer to item from static list - static BOOL getEmbeddedItemSaved(llwchar ext_char); // returns whether item from static list is saved + static bool getEmbeddedItemSaved(llwchar ext_char); // returns whether item from static list is saved private: struct embedded_info_t { LLPointer<LLInventoryItem> mItemPtr; - BOOL mSaved; + bool mSaved; }; typedef std::map<llwchar, embedded_info_t > item_map_t; static item_map_t sEntries; @@ -375,7 +375,7 @@ bool LLEmbeddedItems::empty() } // Inserts a new unique entry -BOOL LLEmbeddedItems::insertEmbeddedItem( LLInventoryItem* item, llwchar* ext_char, bool is_new) +bool LLEmbeddedItems::insertEmbeddedItem( LLInventoryItem* item, llwchar* ext_char, bool is_new) { // Now insert a new one llwchar wc_emb; @@ -395,20 +395,20 @@ BOOL LLEmbeddedItems::insertEmbeddedItem( LLInventoryItem* item, llwchar* ext_ch wc_emb = last->first; if (wc_emb >= LLTextEditor::LAST_EMBEDDED_CHAR) { - return FALSE; + return false; } ++wc_emb; } sEntries[wc_emb].mItemPtr = item; - sEntries[wc_emb].mSaved = is_new ? FALSE : TRUE; + sEntries[wc_emb].mSaved = !is_new; *ext_char = wc_emb; mEmbeddedUsedChars.insert(wc_emb); - return TRUE; + return true; } // Removes an entry (all entries are unique) -BOOL LLEmbeddedItems::removeEmbeddedItem( llwchar ext_char ) +bool LLEmbeddedItems::removeEmbeddedItem( llwchar ext_char ) { mEmbeddedUsedChars.erase(ext_char); item_map_t::iterator iter = sEntries.find(ext_char); @@ -416,9 +416,9 @@ BOOL LLEmbeddedItems::removeEmbeddedItem( llwchar ext_char ) { sEntries.erase(ext_char); sFreeEntries.push(ext_char); - return TRUE; + return true; } - return FALSE; + return false; } // static @@ -436,7 +436,7 @@ LLPointer<LLInventoryItem> LLEmbeddedItems::getEmbeddedItemPtr(llwchar ext_char) } // static -BOOL LLEmbeddedItems::getEmbeddedItemSaved(llwchar ext_char) +bool LLEmbeddedItems::getEmbeddedItemSaved(llwchar ext_char) { if( ext_char >= LLTextEditor::FIRST_EMBEDDED_CHAR && ext_char <= LLTextEditor::LAST_EMBEDDED_CHAR ) { @@ -446,7 +446,7 @@ BOOL LLEmbeddedItems::getEmbeddedItemSaved(llwchar ext_char) return iter->second.mSaved; } } - return FALSE; + return false; } llwchar LLEmbeddedItems::getEmbeddedCharFromIndex(S32 index) @@ -514,14 +514,14 @@ S32 LLEmbeddedItems::getIndexFromEmbeddedChar(llwchar wch) } } -BOOL LLEmbeddedItems::hasEmbeddedItem(llwchar ext_char) +bool LLEmbeddedItems::hasEmbeddedItem(llwchar ext_char) { std::set<llwchar>::iterator iter = mEmbeddedUsedChars.find(ext_char); if (iter != mEmbeddedUsedChars.end()) { - return TRUE; + return true; } - return FALSE; + return false; } @@ -606,7 +606,7 @@ void LLEmbeddedItems::markSaved() for (std::set<llwchar>::iterator iter = mEmbeddedUsedChars.begin(); iter != mEmbeddedUsedChars.end(); ++iter) { llwchar wc = *iter; - sEntries[wc].mSaved = TRUE; + sEntries[wc].mSaved = true; } } @@ -616,13 +616,13 @@ class LLViewerTextEditor::TextCmdInsertEmbeddedItem : public LLTextBase::TextCmd { public: TextCmdInsertEmbeddedItem( S32 pos, LLInventoryItem* item ) - : TextCmd(pos, FALSE), + : TextCmd(pos, false), mExtCharValue(0) { mItem = item; } - virtual BOOL execute( LLTextBase* editor, S32* delta ) + virtual bool execute( LLTextBase* editor, S32* delta ) { LLViewerTextEditor* viewer_editor = (LLViewerTextEditor*)editor; // Take this opportunity to remove any unused embedded items from this editor @@ -634,7 +634,7 @@ public: *delta = insert(editor, getPosition(), ws ); return (*delta != 0); } - return FALSE; + return false; } virtual S32 undo( LLTextBase* editor ) @@ -650,7 +650,7 @@ public: insert(editor, getPosition(), ws ); return getPosition() + 1; } - virtual BOOL hasExtCharValue( llwchar value ) const + virtual bool hasExtCharValue( llwchar value ) const { return (value == mExtCharValue); } @@ -682,7 +682,7 @@ struct LLNotecardCopyInfo LLViewerTextEditor::LLViewerTextEditor(const LLViewerTextEditor::Params& p) : LLTextEditor(p), mDragItemChar(0), - mDragItemSaved(FALSE), + mDragItemSaved(false), mInventoryCallback(new LLEmbeddedNotecardOpener) { mEmbeddedItemList = new LLEmbeddedItems(this); @@ -707,14 +707,14 @@ void LLViewerTextEditor::makePristine() LLTextEditor::makePristine(); } -void LLViewerTextEditor::onVisibilityChange( BOOL new_visibility ) +void LLViewerTextEditor::onVisibilityChange( bool new_visibility ) { LLUICtrl::onVisibilityChange(new_visibility); } -BOOL LLViewerTextEditor::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLViewerTextEditor::handleMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; // Let scrollbar have first dibs handled = LLView::childrenHandleMouseDown(x, y, mask) != NULL; @@ -723,7 +723,7 @@ BOOL LLViewerTextEditor::handleMouseDown(S32 x, S32 y, MASK mask) { if( allowsEmbeddedItems() ) { - setCursorAtLocalPos( x, y, FALSE ); + setCursorAtLocalPos( x, y, false ); llwchar wc = 0; if (mCursorPos < getLength()) { @@ -745,10 +745,10 @@ BOOL LLViewerTextEditor::handleMouseDown(S32 x, S32 y, MASK mask) if (hasTabStop()) { - setFocus( TRUE ); + setFocus( true ); } - handled = TRUE; + handled = true; } else { @@ -766,9 +766,9 @@ BOOL LLViewerTextEditor::handleMouseDown(S32 x, S32 y, MASK mask) } -BOOL LLViewerTextEditor::handleHover(S32 x, S32 y, MASK mask) +bool LLViewerTextEditor::handleHover(S32 x, S32 y, MASK mask) { - BOOL handled = LLTextEditor::handleHover(x, y, mask); + bool handled = LLTextEditor::handleHover(x, y, mask); if(hasMouseCapture() && mDragItem) { @@ -788,16 +788,16 @@ BOOL LLViewerTextEditor::handleHover(S32 x, S32 y, MASK mask) return LLToolDragAndDrop::getInstance()->handleHover( x, y, mask ); } getWindow()->setCursor(UI_CURSOR_HAND); - handled = TRUE; + handled = true; } return handled; } -BOOL LLViewerTextEditor::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLViewerTextEditor::handleMouseUp(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; if( hasMouseCapture() ) { @@ -826,9 +826,9 @@ BOOL LLViewerTextEditor::handleMouseUp(S32 x, S32 y, MASK mask) return handled; } -BOOL LLViewerTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLViewerTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; // let scrollbar have first dibs handled = LLView::childrenHandleDoubleClick(x, y, mask) != NULL; @@ -837,15 +837,15 @@ BOOL LLViewerTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask) { if( allowsEmbeddedItems() ) { - S32 doc_index = getDocIndexFromLocalCoord(x, y, FALSE); + S32 doc_index = getDocIndexFromLocalCoord(x, y, false); llwchar doc_char = getWText()[doc_index]; if (mEmbeddedItemList->hasEmbeddedItem(doc_char)) { if( openEmbeddedItemAtPos( doc_index )) { deselect(); - setFocus( FALSE ); - return TRUE; + setFocus( false ); + return true; } } } @@ -856,19 +856,19 @@ BOOL LLViewerTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask) // virtual -BOOL LLViewerTextEditor::handleDragAndDrop(S32 x, S32 y, MASK mask, - BOOL drop, EDragAndDropType cargo_type, void *cargo_data, +bool LLViewerTextEditor::handleDragAndDrop(S32 x, S32 y, MASK mask, + bool drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg) { - BOOL handled = FALSE; + bool handled = false; LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource(); if (LLToolDragAndDrop::SOURCE_NOTECARD == source) { // We currently do not handle dragging items from one notecard to another // since items in a notecard must be in Inventory to be verified. See DEV-2891. - return FALSE; + return false; } if (getEnabled() && acceptsTextInput()) @@ -918,10 +918,10 @@ BOOL LLViewerTextEditor::handleDragAndDrop(S32 x, S32 y, MASK mask, { deselect(); S32 old_cursor = mCursorPos; - setCursorAtLocalPos( x, y, TRUE ); + setCursorAtLocalPos( x, y, true ); S32 insert_pos = mCursorPos; setCursorPos(old_cursor); - BOOL inserted = insertEmbeddedItem( insert_pos, item ); + bool inserted = insertEmbeddedItem( insert_pos, item ); if( inserted && (old_cursor > mCursorPos) ) { setCursorPos(mCursorPos + 1); @@ -951,7 +951,7 @@ BOOL LLViewerTextEditor::handleDragAndDrop(S32 x, S32 y, MASK mask, *accept = ACCEPT_NO; } - handled = TRUE; + handled = true; LL_DEBUGS("UserInput") << "dragAndDrop handled by LLViewerTextEditor " << getName() << LL_ENDL; return handled; @@ -1099,7 +1099,7 @@ void LLViewerTextEditor::findEmbeddedItemSegments(S32 start, S32 end) } } -BOOL LLViewerTextEditor::openEmbeddedItemAtPos(S32 pos) +bool LLViewerTextEditor::openEmbeddedItemAtPos(S32 pos) { if( pos < getLength()) { @@ -1107,7 +1107,7 @@ BOOL LLViewerTextEditor::openEmbeddedItemAtPos(S32 pos) LLPointer<LLInventoryItem> item = LLEmbeddedItems::getEmbeddedItemPtr( wc ); if( item ) { - BOOL saved = LLEmbeddedItems::getEmbeddedItemSaved( wc ); + bool saved = LLEmbeddedItems::getEmbeddedItemSaved( wc ); if (saved) { return openEmbeddedItem(item, wc); @@ -1118,36 +1118,36 @@ BOOL LLViewerTextEditor::openEmbeddedItemAtPos(S32 pos) } } } - return FALSE; + return false; } -BOOL LLViewerTextEditor::openEmbeddedItem(LLPointer<LLInventoryItem> item, llwchar wc) +bool LLViewerTextEditor::openEmbeddedItem(LLPointer<LLInventoryItem> item, llwchar wc) { switch( item->getType() ) { case LLAssetType::AT_TEXTURE: openEmbeddedTexture( item, wc ); - return TRUE; + return true; case LLAssetType::AT_SOUND: openEmbeddedSound( item, wc ); - return TRUE; + return true; case LLAssetType::AT_LANDMARK: openEmbeddedLandmark( item, wc ); - return TRUE; + return true; case LLAssetType::AT_CALLINGCARD: openEmbeddedCallingcard( item, wc ); - return TRUE; + return true; case LLAssetType::AT_SETTINGS: openEmbeddedSetting(item, wc); - return TRUE; + return true; case LLAssetType::AT_MATERIAL: openEmbeddedGLTFMaterial(item, wc); - return TRUE; + return true; case LLAssetType::AT_NOTECARD: case LLAssetType::AT_LSL_TEXT: case LLAssetType::AT_CLOTHING: @@ -1156,9 +1156,9 @@ BOOL LLViewerTextEditor::openEmbeddedItem(LLPointer<LLInventoryItem> item, llwch case LLAssetType::AT_ANIMATION: case LLAssetType::AT_GESTURE: showCopyToInvDialog( item, wc ); - return TRUE; + return true; default: - return FALSE; + return false; } } @@ -1254,7 +1254,7 @@ void LLViewerTextEditor::openEmbeddedGLTFMaterial(LLInventoryItem* item, llwchar preview->setAuxItem(item); preview->setNotecardInfo(mNotecardInventoryID, mObjectID); preview->openFloater(floater_key); - preview->setFocus(TRUE); + preview->setFocus(true); } } @@ -1355,13 +1355,13 @@ bool LLViewerTextEditor::hasEmbeddedInventory() //////////////////////////////////////////////////////////////////////////// -BOOL LLViewerTextEditor::importBuffer( const char* buffer, S32 length ) +bool LLViewerTextEditor::importBuffer( const char* buffer, S32 length ) { LLMemoryStream str((U8*)buffer, length); return importStream(str); } -BOOL LLViewerTextEditor::exportBuffer( std::string& buffer ) +bool LLViewerTextEditor::exportBuffer( std::string& buffer ) { LLNotecard nc(LLNotecard::MAX_SIZE); @@ -1378,6 +1378,6 @@ BOOL LLViewerTextEditor::exportBuffer( std::string& buffer ) buffer = out_stream.str(); - return TRUE; + return true; } diff --git a/indra/newview/llviewertexteditor.h b/indra/newview/llviewertexteditor.h index c3967d3a1c..42f69dccf3 100644 --- a/indra/newview/llviewertexteditor.h +++ b/indra/newview/llviewertexteditor.h @@ -47,22 +47,22 @@ public: virtual void makePristine(); - /*virtual*/ void onVisibilityChange( BOOL new_visibility ); + /*virtual*/ void onVisibilityChange( bool new_visibility ); // mousehandler overrides - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask ); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleHover(S32 x, S32 y, MASK mask); + virtual bool handleDoubleClick(S32 x, S32 y, MASK mask ); - virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, - BOOL drop, EDragAndDropType cargo_type, + virtual bool handleDragAndDrop(S32 x, S32 y, MASK mask, + bool drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg); const class LLInventoryItem* getDragItem() const { return mDragItem; } - virtual BOOL importBuffer(const char* buffer, S32 length); + virtual bool importBuffer(const char* buffer, S32 length); virtual bool importStream(std::istream& str); - virtual BOOL exportBuffer(std::string& buffer); + virtual bool exportBuffer(std::string& buffer); virtual void onValueChange(S32 start, S32 end); void setNotecardInfo(const LLUUID& notecard_item_id, const LLUUID& object_id, const LLUUID& preview_id) @@ -95,8 +95,8 @@ private: void findEmbeddedItemSegments(S32 start, S32 end); virtual llwchar pasteEmbeddedItem(llwchar ext_char); - BOOL openEmbeddedItemAtPos( S32 pos ); - BOOL openEmbeddedItem(LLPointer<LLInventoryItem> item, llwchar wc); + bool openEmbeddedItemAtPos( S32 pos ); + bool openEmbeddedItem(LLPointer<LLInventoryItem> item, llwchar wc); S32 insertEmbeddedItem(S32 pos, LLInventoryItem* item); @@ -118,7 +118,7 @@ private: LLPointer<LLInventoryItem> mDragItem; LLTextSegment* mDragSegment; llwchar mDragItemChar; - BOOL mDragItemSaved; + bool mDragItemSaved; class LLEmbeddedItems* mEmbeddedItemList; LLUUID mObjectID; diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 9aee1c0caf..c1062b9a01 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1,3 +1,4 @@ + /** * @file llviewertexture.cpp * @brief Object which handles a received image (and associated texture(s)) @@ -100,6 +101,9 @@ U32 LLViewerTexture::sMaxSmallImageSize = MAX_CACHED_RAW_IMAGE_AREA; bool LLViewerTexture::sFreezeImageUpdates = false; F32 LLViewerTexture::sCurrentTime = 0.0f; +constexpr F32 MIN_VRAM_BUDGET = 768.f; +F32 LLViewerTexture::sFreeVRAMMegabytes = MIN_VRAM_BUDGET; + LLViewerTexture::EDebugTexels LLViewerTexture::sDebugTexelsMode = LLViewerTexture::DEBUG_TEXELS_OFF; const F64 log_2 = log(2.0); @@ -116,11 +120,11 @@ const U32 DESIRED_NORMAL_TEXTURE_SIZE = (U32)LLViewerFetchedTexture::MAX_IMAGE_S LLLoadedCallbackEntry::LLLoadedCallbackEntry(loaded_callback_func cb, S32 discard_level, - BOOL need_imageraw, // Needs image raw for the callback + bool need_imageraw, // Needs image raw for the callback void* userdata, LLLoadedCallbackEntry::source_callback_list_t* src_callback_list, LLViewerFetchedTexture* target, - BOOL pause) + bool pause) : mCallback(cb), mLastUsedDiscard(MAX_DISCARD_LEVEL+1), mDesiredDiscard(discard_level), @@ -141,7 +145,7 @@ LLLoadedCallbackEntry::~LLLoadedCallbackEntry() void LLLoadedCallbackEntry::removeTexture(LLViewerFetchedTexture* tex) { - if(mSourceCallbackList) + if (mSourceCallbackList && tex) { mSourceCallbackList->erase(LLTextureKey(tex->getID(), (ETexListType)tex->getTextureListType())); } @@ -166,7 +170,7 @@ void LLLoadedCallbackEntry::cleanUpCallbackList(LLLoadedCallbackEntry::source_ca } } -LLViewerMediaTexture* LLViewerTextureManager::createMediaTexture(const LLUUID &media_id, BOOL usemipmaps, LLImageGL* gl_image) +LLViewerMediaTexture* LLViewerTextureManager::createMediaTexture(const LLUUID &media_id, bool usemipmaps, LLImageGL* gl_image) { return new LLViewerMediaTexture(media_id, usemipmaps, gl_image); } @@ -212,7 +216,7 @@ LLViewerMediaTexture* LLViewerTextureManager::findMediaTexture(const LLUUID &med return LLViewerMediaTexture::findMediaTexture(media_id); } -LLViewerMediaTexture* LLViewerTextureManager::getMediaTexture(const LLUUID& id, BOOL usemipmaps, LLImageGL* gl_image) +LLViewerMediaTexture* LLViewerTextureManager::getMediaTexture(const LLUUID& id, bool usemipmaps, LLImageGL* gl_image) { LLViewerMediaTexture* tex = LLViewerMediaTexture::findMediaTexture(id); if(!tex) @@ -225,7 +229,7 @@ LLViewerMediaTexture* LLViewerTextureManager::getMediaTexture(const LLUUID& id, return tex; } -LLViewerFetchedTexture* LLViewerTextureManager::staticCastToFetchedTexture(LLTexture* tex, BOOL report_error) +LLViewerFetchedTexture* LLViewerTextureManager::staticCastToFetchedTexture(LLTexture* tex, bool report_error) { if(!tex) { @@ -246,7 +250,7 @@ LLViewerFetchedTexture* LLViewerTextureManager::staticCastToFetchedTexture(LLTex return NULL; } -LLPointer<LLViewerTexture> LLViewerTextureManager::getLocalTexture(BOOL usemipmaps, BOOL generate_gl_tex) +LLPointer<LLViewerTexture> LLViewerTextureManager::getLocalTexture(bool usemipmaps, bool generate_gl_tex) { LLPointer<LLViewerTexture> tex = new LLViewerTexture(usemipmaps); if(generate_gl_tex) @@ -256,7 +260,7 @@ LLPointer<LLViewerTexture> LLViewerTextureManager::getLocalTexture(BOOL usemipma } return tex; } -LLPointer<LLViewerTexture> LLViewerTextureManager::getLocalTexture(const LLUUID& id, BOOL usemipmaps, BOOL generate_gl_tex) +LLPointer<LLViewerTexture> LLViewerTextureManager::getLocalTexture(const LLUUID& id, bool usemipmaps, bool generate_gl_tex) { LLPointer<LLViewerTexture> tex = new LLViewerTexture(id, usemipmaps); if(generate_gl_tex) @@ -266,13 +270,13 @@ LLPointer<LLViewerTexture> LLViewerTextureManager::getLocalTexture(const LLUUID& } return tex; } -LLPointer<LLViewerTexture> LLViewerTextureManager::getLocalTexture(const LLImageRaw* raw, BOOL usemipmaps) +LLPointer<LLViewerTexture> LLViewerTextureManager::getLocalTexture(const LLImageRaw* raw, bool usemipmaps) { LLPointer<LLViewerTexture> tex = new LLViewerTexture(raw, usemipmaps); tex->setCategory(LLGLTexture::LOCAL); return tex; } -LLPointer<LLViewerTexture> LLViewerTextureManager::getLocalTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps, BOOL generate_gl_tex) +LLPointer<LLViewerTexture> LLViewerTextureManager::getLocalTexture(const U32 width, const U32 height, const U8 components, bool usemipmaps, bool generate_gl_tex) { LLPointer<LLViewerTexture> tex = new LLViewerTexture(width, height, components, usemipmaps); if(generate_gl_tex) @@ -285,6 +289,7 @@ LLPointer<LLViewerTexture> LLViewerTextureManager::getLocalTexture(const U32 wid LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture(const LLImageRaw* raw, FTType type, bool usemipmaps) { + LLImageDataSharedLock lock(raw); LLViewerFetchedTexture* ret = new LLViewerFetchedTexture(raw, type, usemipmaps); gTextureList.addImage(ret, TEX_LIST_STANDARD); return ret; @@ -293,7 +298,7 @@ LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture(const LLImageR LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture( const LLUUID &image_id, FTType f_type, - BOOL usemipmaps, + bool usemipmaps, LLViewerTexture::EBoostLevel boost_priority, S8 texture_type, LLGLint internal_format, @@ -306,7 +311,7 @@ LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture( LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromFile( const std::string& filename, FTType f_type, - BOOL usemipmaps, + bool usemipmaps, LLViewerTexture::EBoostLevel boost_priority, S8 texture_type, LLGLint internal_format, @@ -319,7 +324,7 @@ LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromFile( //static LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const std::string& url, FTType f_type, - BOOL usemipmaps, + bool usemipmaps, LLViewerTexture::EBoostLevel boost_priority, S8 texture_type, LLGLint internal_format, @@ -330,6 +335,18 @@ LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const s return gTextureList.getImageFromUrl(url, f_type, usemipmaps, boost_priority, texture_type, internal_format, primary_format, force_id); } +//static +LLImageRaw* LLViewerTextureManager::getRawImageFromMemory(const U8* data, U32 size, std::string_view mimetype) +{ + return gTextureList.getRawImageFromMemory(data, size, mimetype); +} + +//static +LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromMemory(const U8* data, U32 size, std::string_view mimetype) +{ + return gTextureList.getImageFromMemory(data, size, mimetype); +} + LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromHost(const LLUUID& image_id, FTType f_type, LLHost host) { return gTextureList.getImageFromHost(image_id, f_type, host); @@ -338,12 +355,12 @@ LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromHost(const // Create a bridge to the viewer texture manager. class LLViewerTextureManagerBridge : public LLTextureManagerBridge { - /*virtual*/ LLPointer<LLGLTexture> getLocalTexture(BOOL usemipmaps = TRUE, BOOL generate_gl_tex = TRUE) + /*virtual*/ LLPointer<LLGLTexture> getLocalTexture(bool usemipmaps = true, bool generate_gl_tex = true) { return LLViewerTextureManager::getLocalTexture(usemipmaps, generate_gl_tex); } - /*virtual*/ LLPointer<LLGLTexture> getLocalTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps, BOOL generate_gl_tex = TRUE) + /*virtual*/ LLPointer<LLGLTexture> getLocalTexture(const U32 width, const U32 height, const U8 components, bool usemipmaps, bool generate_gl_tex = true) { return LLViewerTextureManager::getLocalTexture(width, height, components, usemipmaps, generate_gl_tex); } @@ -360,7 +377,7 @@ void LLViewerTextureManager::init() { LLPointer<LLImageRaw> raw = new LLImageRaw(1,1,3); raw->clear(0x77, 0x77, 0x77, 0xFF); - LLViewerTexture::sNullImagep = LLViewerTextureManager::getLocalTexture(raw.get(), TRUE); + LLViewerTexture::sNullImagep = LLViewerTextureManager::getLocalTexture(raw.get(), true); } const S32 dim = 128; @@ -368,7 +385,7 @@ void LLViewerTextureManager::init() U8* data = image_raw->getData(); memset(data, 0, dim * dim * 3); - LLViewerTexture::sBlackImagep = LLViewerTextureManager::getLocalTexture(image_raw.get(), TRUE); + LLViewerTexture::sBlackImagep = LLViewerTextureManager::getLocalTexture(image_raw.get(), true); #if 1 LLPointer<LLViewerFetchedTexture> imagep = LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT); @@ -400,7 +417,7 @@ void LLViewerTextureManager::init() imagep->setCachedRawImage(0, image_raw); image_raw = NULL; #else - LLViewerFetchedTexture::sDefaultImagep = LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, TRUE, LLGLTexture::BOOST_UI); + LLViewerFetchedTexture::sDefaultImagep = LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, true, LLGLTexture::BOOST_UI); #endif LLViewerFetchedTexture::sDefaultImagep->dontDiscard(); LLViewerFetchedTexture::sDefaultImagep->setCategory(LLGLTexture::OTHER); @@ -418,7 +435,7 @@ void LLViewerTextureManager::init() data[i+2] = color; } - LLViewerTexture::sCheckerBoardImagep = LLViewerTextureManager::getLocalTexture(image_raw.get(), TRUE); + LLViewerTexture::sCheckerBoardImagep = LLViewerTextureManager::getLocalTexture(image_raw.get(), true); LLViewerTexture::initClass(); @@ -467,59 +484,11 @@ void LLViewerTexture::initClass() LLImageGL::sDefaultGLTexture = LLViewerFetchedTexture::sDefaultImagep->getGLTexture(); } -// tuning params -const F32 GPU_MEMORY_CHECK_WAIT_TIME = 1.0f; // non-const (used externally F32 texmem_lower_bound_scale = 0.85f; F32 texmem_middle_bound_scale = 0.925f; //static -bool LLViewerTexture::isMemoryForTextureLow() -{ - LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; - // Note: we need to figure out a better source for 'min' values, - // what is free for low end at minimal settings is 'nothing left' - // for higher end gpus at high settings. - const S32Megabytes MIN_FREE_TEXTURE_MEMORY(20); - const S32Megabytes MIN_FREE_MAIN_MEMORY(100); - - S32Megabytes gpu; - S32Megabytes physical; - getGPUMemoryForTextures(gpu, physical); - - return (gpu < MIN_FREE_TEXTURE_MEMORY); // || (physical < MIN_FREE_MAIN_MEMORY); -} - -//static -void LLViewerTexture::getGPUMemoryForTextures(S32Megabytes &gpu, S32Megabytes &physical) -{ - LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; - static LLFrameTimer timer; - - static S32Megabytes gpu_res = S32Megabytes(S32_MAX); - static S32Megabytes physical_res = S32Megabytes(S32_MAX); - - if (timer.getElapsedTimeF32() < GPU_MEMORY_CHECK_WAIT_TIME) //call this once per second. - { - gpu = gpu_res; - physical = physical_res; - return; - } - timer.reset(); - - { - gpu_res = (S32Megabytes)gViewerWindow->getWindow()->getAvailableVRAMMegabytes(); - - //check main memory, only works for windows and macos. - LLMemory::updateMemoryInfo(); - physical_res = LLMemory::getAvailableMemKB(); - - gpu = gpu_res; - physical = physical_res; - } -} - -//static void LLViewerTexture::updateClass() { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; @@ -537,15 +506,17 @@ void LLViewerTexture::updateClass() F64 texture_bytes_alloc = LLImageGL::getTextureBytesAllocated() / 1024.0 / 512.0; F64 vertex_bytes_alloc = LLVertexBuffer::getBytesAllocated() / 1024.0 / 512.0; + F64 render_bytes_alloc = LLRenderTarget::sBytesAllocated / 1024.0 / 512.0; // get an estimate of how much video memory we're using // NOTE: our metrics miss about half the vram we use, so this biases high but turns out to typically be within 5% of the real number - F32 used = (F32)ll_round(texture_bytes_alloc + vertex_bytes_alloc); + F32 used = (F32)ll_round(texture_bytes_alloc + vertex_bytes_alloc + render_bytes_alloc); F32 budget = max_vram_budget == 0 ? gGLManager.mVRAM : max_vram_budget; // try to leave half a GB for everyone else, but keep at least 768MB for ourselves - F32 target = llmax(budget - 512.f, 768.f); + F32 target = llmax(budget - 512.f, MIN_VRAM_BUDGET); + sFreeVRAMMegabytes = target - used; F32 over_pct = llmax((used-target) / target, 0.f); sDesiredDiscardBias = llmax(sDesiredDiscardBias, 1.f + over_pct); @@ -562,7 +533,7 @@ void LLViewerTexture::updateClass() //------------------------------------------------------------------------------------------- const U32 LLViewerTexture::sCurrentFileVersion = 1; -LLViewerTexture::LLViewerTexture(BOOL usemipmaps) : +LLViewerTexture::LLViewerTexture(bool usemipmaps) : LLGLTexture(usemipmaps) { init(true); @@ -571,7 +542,7 @@ LLViewerTexture::LLViewerTexture(BOOL usemipmaps) : sImageCount++; } -LLViewerTexture::LLViewerTexture(const LLUUID& id, BOOL usemipmaps) : +LLViewerTexture::LLViewerTexture(const LLUUID& id, bool usemipmaps) : LLGLTexture(usemipmaps), mID(id) { @@ -580,7 +551,7 @@ LLViewerTexture::LLViewerTexture(const LLUUID& id, BOOL usemipmaps) : sImageCount++; } -LLViewerTexture::LLViewerTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps) : +LLViewerTexture::LLViewerTexture(const U32 width, const U32 height, const U8 components, bool usemipmaps) : LLGLTexture(width, height, components, usemipmaps) { init(true); @@ -589,7 +560,7 @@ LLViewerTexture::LLViewerTexture(const U32 width, const U32 height, const U8 com sImageCount++; } -LLViewerTexture::LLViewerTexture(const LLImageRaw* raw, BOOL usemipmaps) : +LLViewerTexture::LLViewerTexture(const LLImageRaw* raw, bool usemipmaps) : LLGLTexture(raw, usemipmaps) { init(true); @@ -737,9 +708,9 @@ bool LLViewerTexture::bindDefaultImage(S32 stage) } //virtual -BOOL LLViewerTexture::isMissingAsset()const +bool LLViewerTexture::isMissingAsset()const { - return FALSE; + return false; } //virtual @@ -747,12 +718,12 @@ void LLViewerTexture::forceImmediateUpdate() { } -void LLViewerTexture::addTextureStats(F32 virtual_size, BOOL needs_gltexture) const +void LLViewerTexture::addTextureStats(F32 virtual_size, bool needs_gltexture) const { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; if(needs_gltexture) { - mNeedsGLTexture = TRUE; + mNeedsGLTexture = true; } virtual_size = llmin(virtual_size, LLViewerFetchedTexture::sMaxVirtualSize); @@ -806,8 +777,8 @@ void LLViewerTexture::removeFace(U32 ch, LLFace* facep) if(mNumFaces[ch] > 1) { S32 index = facep->getIndexInTex(ch); - llassert(index < mFaceList[ch].size()); - llassert(index < mNumFaces[ch]); + llassert(index < (S32)mFaceList[ch].size()); + llassert(index < (S32)mNumFaces[ch]); mFaceList[ch][index] = mFaceList[ch][--mNumFaces[ch]]; mFaceList[ch][index]->setIndexInTex(ch, index); } @@ -859,8 +830,8 @@ void LLViewerTexture::removeVolume(U32 ch, LLVOVolume* volumep) if (mNumVolumes[ch] > 1) { S32 index = volumep->getIndexInTex(ch); - llassert(index < mVolumeList[ch].size()); - llassert(index < mNumVolumes[ch]); + llassert(index < (S32)mVolumeList[ch].size()); + llassert(index < (S32)mNumVolumes[ch]); mVolumeList[ch][index] = mVolumeList[ch][--mNumVolumes[ch]]; mVolumeList[ch][index]->setIndexInTex(ch, index); } @@ -940,7 +911,7 @@ void LLViewerTexture::setCachedRawImage(S32 discard_level, LLImageRaw* imageraw) //nothing here. } -BOOL LLViewerTexture::isLargeImage() +bool LLViewerTexture::isLargeImage() { return (S32)mTexelsPerImage > LLViewerTexture::sMinLargeImageSize; } @@ -997,11 +968,11 @@ LLViewerFetchedTexture* LLViewerFetchedTexture::getSmokeImage() return sSmokeImagep; } -LLViewerFetchedTexture::LLViewerFetchedTexture(const LLUUID& id, FTType f_type, const LLHost& host, BOOL usemipmaps) +LLViewerFetchedTexture::LLViewerFetchedTexture(const LLUUID& id, FTType f_type, const LLHost& host, bool usemipmaps) : LLViewerTexture(id, usemipmaps), mTargetHost(host) { - init(TRUE); + init(true); mFTType = f_type; if (mFTType == FTT_HOST_BAKE) { @@ -1010,18 +981,18 @@ LLViewerFetchedTexture::LLViewerFetchedTexture(const LLUUID& id, FTType f_type, generateGLTexture(); } -LLViewerFetchedTexture::LLViewerFetchedTexture(const LLImageRaw* raw, FTType f_type, BOOL usemipmaps) +LLViewerFetchedTexture::LLViewerFetchedTexture(const LLImageRaw* raw, FTType f_type, bool usemipmaps) : LLViewerTexture(raw, usemipmaps) { - init(TRUE); + init(true); mFTType = f_type; } -LLViewerFetchedTexture::LLViewerFetchedTexture(const std::string& url, FTType f_type, const LLUUID& id, BOOL usemipmaps) +LLViewerFetchedTexture::LLViewerFetchedTexture(const std::string& url, FTType f_type, const LLUUID& id, bool usemipmaps) : LLViewerTexture(id, usemipmaps), mUrl(url) { - init(TRUE); + init(true); mFTType = f_type; generateGLTexture(); } @@ -1030,20 +1001,20 @@ void LLViewerFetchedTexture::init(bool firstinit) { mOrigWidth = 0; mOrigHeight = 0; - mHasAux = FALSE; - mNeedsAux = FALSE; + mHasAux = false; + mNeedsAux = false; mRequestedDiscardLevel = -1; mRequestedDownloadPriority = 0.f; - mFullyLoaded = FALSE; + mFullyLoaded = false; mCanUseHTTP = true; mDesiredDiscardLevel = MAX_DISCARD_LEVEL + 1; mMinDesiredDiscardLevel = MAX_DISCARD_LEVEL + 1; - mDecodingAux = FALSE; + mDecodingAux = false; mKnownDrawWidth = 0; mKnownDrawHeight = 0; - mKnownDrawSizeChanged = FALSE; + mKnownDrawSizeChanged = false; if (firstinit) { @@ -1052,43 +1023,43 @@ void LLViewerFetchedTexture::init(bool firstinit) // Only set mIsMissingAsset true when we know for certain that the database // does not contain this image. - mIsMissingAsset = FALSE; + mIsMissingAsset = false; mLoadedCallbackDesiredDiscardLevel = S8_MAX; - mPauseLoadedCallBacks = FALSE; + mPauseLoadedCallBacks = false; mNeedsCreateTexture = false; - mIsRawImageValid = FALSE; + mIsRawImageValid = false; mRawDiscardLevel = INVALID_DISCARD_LEVEL; mMinDiscardLevel = 0; - mHasFetcher = FALSE; - mIsFetching = FALSE; + mHasFetcher = false; + mIsFetching = false; mFetchState = 0; mFetchPriority = 0; mDownloadProgress = 0.f; mFetchDeltaTime = 999999.f; mRequestDeltaTime = 0.f; - mForSculpt = FALSE; - mIsFetched = FALSE; - mInFastCacheList = FALSE; + mForSculpt = false; + mIsFetched = false; + mInFastCacheList = false; mCachedRawImage = NULL; mCachedRawDiscardLevel = -1; - mCachedRawImageReady = FALSE; + mCachedRawImageReady = false; mSavedRawImage = NULL; - mForceToSaveRawImage = FALSE; - mSaveRawImage = FALSE; + mForceToSaveRawImage = false; + mSaveRawImage = false; mSavedRawDiscardLevel = -1; mDesiredSavedRawDiscardLevel = -1; mLastReferencedSavedRawImageTime = 0.0f; mKeptSavedRawImageTime = 0.f; mLastCallBackActiveTime = 0.f; - mForceCallbackFetch = FALSE; - mInDebug = FALSE; - mUnremovable = FALSE; + mForceCallbackFetch = false; + mInDebug = false; + mUnremovable = false; mFTType = FTT_UNKNOWN; } @@ -1126,18 +1097,18 @@ void LLViewerFetchedTexture::cleanup() LLLoadedCallbackEntry *entryp = *iter++; // We never finished loading the image. Indicate failure. // Note: this allows mLoadedCallbackUserData to be cleaned up. - entryp->mCallback( FALSE, this, NULL, NULL, 0, TRUE, entryp->mUserData ); + entryp->mCallback( false, this, NULL, NULL, 0, true, entryp->mUserData ); entryp->removeTexture(this); delete entryp; } mLoadedCallbackList.clear(); - mNeedsAux = FALSE; + mNeedsAux = false; // Clean up image data destroyRawImage(); mCachedRawImage = NULL; mCachedRawDiscardLevel = -1; - mCachedRawImageReady = FALSE; + mCachedRawImageReady = false; mSavedRawImage = NULL; mSavedRawDiscardLevel = -1; } @@ -1150,7 +1121,7 @@ void LLViewerFetchedTexture::loadFromFastCache() { return; //no need to access the fast cache. } - mInFastCacheList = FALSE; + mInFastCacheList = false; add(LLTextureFetch::sCacheAttempt, 1.0); @@ -1203,7 +1174,7 @@ void LLViewerFetchedTexture::loadFromFastCache() } mRequestedDiscardLevel = mDesiredDiscardLevel + 1; - mIsRawImageValid = TRUE; + mIsRawImageValid = true; addToCreateTexture(); } } @@ -1217,7 +1188,7 @@ void LLViewerFetchedTexture::setForSculpt() { static const S32 MAX_INTERVAL = 8; //frames - mForSculpt = TRUE; + mForSculpt = true; if(isForSculptOnly() && hasGLTexture() && !getBoundRecently()) { destroyGLTexture(); //sculpt image does not need gl texture. @@ -1227,22 +1198,22 @@ void LLViewerFetchedTexture::setForSculpt() setMaxVirtualSizeResetInterval(MAX_INTERVAL); } -BOOL LLViewerFetchedTexture::isForSculptOnly() const +bool LLViewerFetchedTexture::isForSculptOnly() const { return mForSculpt && !mNeedsGLTexture; } -BOOL LLViewerFetchedTexture::isDeleted() +bool LLViewerFetchedTexture::isDeleted() { return mTextureState == DELETED; } -BOOL LLViewerFetchedTexture::isInactive() +bool LLViewerFetchedTexture::isInactive() { return mTextureState == INACTIVE; } -BOOL LLViewerFetchedTexture::isDeletionCandidate() +bool LLViewerFetchedTexture::isDeletionCandidate() { return mTextureState == DELETION_CANDIDATE; } @@ -1264,7 +1235,7 @@ void LLViewerFetchedTexture::setInactive() } } -BOOL LLViewerFetchedTexture::isFullyLoaded() const +bool LLViewerFetchedTexture::isFullyLoaded() const { // Unfortunately, the boolean "mFullyLoaded" is never updated correctly so we use that logic // to check if the texture is there and completely downloaded @@ -1311,7 +1282,7 @@ void LLViewerFetchedTexture::destroyTexture() //LL_DEBUGS("Avatar") << mID << LL_ENDL; destroyGLTexture(); - mFullyLoaded = FALSE; + mFullyLoaded = false; } void LLViewerFetchedTexture::addToCreateTexture() @@ -1337,7 +1308,7 @@ void LLViewerFetchedTexture::addToCreateTexture() } //discard the cached raw image and the saved raw image - mCachedRawImageReady = FALSE; + mCachedRawImageReady = false; mCachedRawDiscardLevel = -1; mCachedRawImage = NULL; mSavedRawDiscardLevel = -1; @@ -1347,7 +1318,7 @@ void LLViewerFetchedTexture::addToCreateTexture() if(isForSculptOnly()) { //just update some variables, not to create a real GL texture. - createGLTexture(mRawDiscardLevel, mRawImage, 0, FALSE); + createGLTexture(mRawDiscardLevel, mRawImage, 0, false); mNeedsCreateTexture = false; destroyRawImage(); } @@ -1367,8 +1338,8 @@ void LLViewerFetchedTexture::addToCreateTexture() // if(mRequestedDiscardLevel <= mDesiredDiscardLevel && !mForceToSaveRawImage) { - S32 w = mFullWidth >> mRawDiscardLevel; - S32 h = mFullHeight >> mRawDiscardLevel; + U32 w = mFullWidth >> mRawDiscardLevel; + U32 h = mFullHeight >> mRawDiscardLevel; //if big image, do not load extra data //scale it down to size >= LLViewerTexture::sMinLargeImageSize @@ -1409,7 +1380,7 @@ void LLViewerFetchedTexture::addToCreateTexture() } // ONLY called from LLViewerTextureList -BOOL LLViewerFetchedTexture::preCreateTexture(S32 usename/*= 0*/) +bool LLViewerFetchedTexture::preCreateTexture(S32 usename/*= 0*/) { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; #if LL_IMAGEGL_THREAD_CHECK @@ -1419,7 +1390,7 @@ BOOL LLViewerFetchedTexture::preCreateTexture(S32 usename/*= 0*/) if (!mNeedsCreateTexture) { destroyRawImage(); - return FALSE; + return false; } mNeedsCreateTexture = false; @@ -1431,13 +1402,13 @@ BOOL LLViewerFetchedTexture::preCreateTexture(S32 usename/*= 0*/) { LL_WARNS() << "Can't create a texture: invalid image data" << LL_ENDL; destroyRawImage(); - return FALSE; + return false; } // LL_INFOS() << llformat("IMAGE Creating (%d) [%d x %d] Bytes: %d ", // mRawDiscardLevel, // mRawImage->getWidth(), mRawImage->getHeight(),mRawImage->getDataSize()) // << mID.getString() << LL_ENDL; - BOOL res = TRUE; + bool res = true; // store original size only for locally-sourced images if (mUrl.compare(0, 7, "file://") == 0) @@ -1453,7 +1424,7 @@ BOOL LLViewerFetchedTexture::preCreateTexture(S32 usename/*= 0*/) } else { // leave black border, do not scale image content - mRawImage->expandToPowerOfTwo(MAX_IMAGE_SIZE, FALSE); + mRawImage->expandToPowerOfTwo(MAX_IMAGE_SIZE, false); } mFullWidth = mRawImage->getWidth(); @@ -1499,7 +1470,7 @@ BOOL LLViewerFetchedTexture::preCreateTexture(S32 usename/*= 0*/) LL_WARNS() << "!size_ok, setting as missing" << LL_ENDL; setIsMissingAsset(); destroyRawImage(); - return FALSE; + return false; } if (mGLTexturep->getHasExplicitFormat()) @@ -1518,21 +1489,21 @@ BOOL LLViewerFetchedTexture::preCreateTexture(S32 usename/*= 0*/) setIsMissingAsset(); destroyRawImage(); LLAppViewer::getTextureCache()->removeFromCache(mID); - return FALSE; + return false; } } return res; } -BOOL LLViewerFetchedTexture::createTexture(S32 usename/*= 0*/) +bool LLViewerFetchedTexture::createTexture(S32 usename/*= 0*/) { if (!mNeedsCreateTexture) { - return FALSE; + return false; } - BOOL res = mGLTexturep->createGLTexture(mRawDiscardLevel, mRawImage, usename, TRUE, mBoostLevel); + bool res = mGLTexturep->createGLTexture(mRawDiscardLevel, mRawImage, usename, true, mBoostLevel); return res; } @@ -1552,7 +1523,7 @@ void LLViewerFetchedTexture::postCreateTexture() if (!needsToSaveRawImage()) { - mNeedsAux = FALSE; + mNeedsAux = false; destroyRawImage(); } @@ -1645,8 +1616,8 @@ void LLViewerFetchedTexture::setKnownDrawSize(S32 width, S32 height) mKnownDrawWidth = llmax(mKnownDrawWidth, width); mKnownDrawHeight = llmax(mKnownDrawHeight, height); - mKnownDrawSizeChanged = TRUE; - mFullyLoaded = FALSE; + mKnownDrawSizeChanged = true; + mFullyLoaded = false; } addTextureStats((F32)(mKnownDrawWidth * mKnownDrawHeight)); } @@ -1681,7 +1652,7 @@ void LLViewerFetchedTexture::processTextureStats() if(mDesiredDiscardLevel > mMinDesiredDiscardLevel)//need to load more { mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, mMinDesiredDiscardLevel); - mFullyLoaded = FALSE; + mFullyLoaded = false; } //setDebugText("fully loaded"); } @@ -1713,7 +1684,7 @@ void LLViewerFetchedTexture::processTextureStats() else { U32 desired_size = MAX_IMAGE_SIZE_DEFAULT; // MAX_IMAGE_SIZE_DEFAULT = 2048 and max size ever is 4096 - if(!mKnownDrawWidth || !mKnownDrawHeight || mFullWidth <= mKnownDrawWidth || mFullHeight <= mKnownDrawHeight) + if(!mKnownDrawWidth || !mKnownDrawHeight || (S32)mFullWidth <= mKnownDrawWidth || (S32)mFullHeight <= mKnownDrawHeight) { if (mFullWidth > desired_size || mFullHeight > desired_size) { @@ -1731,11 +1702,11 @@ void LLViewerFetchedTexture::processTextureStats() mDesiredDiscardLevel = llclamp(mDesiredDiscardLevel, (S8)0, (S8)getMaxDiscardLevel()); mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, mMinDesiredDiscardLevel); } - mKnownDrawSizeChanged = FALSE; + mKnownDrawSizeChanged = false; if(getDiscardLevel() >= 0 && (getDiscardLevel() <= mDesiredDiscardLevel)) { - mFullyLoaded = TRUE; + mFullyLoaded = true; } } } @@ -1745,7 +1716,7 @@ void LLViewerFetchedTexture::processTextureStats() mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, (S8)mDesiredSavedRawDiscardLevel); if(getDiscardLevel() < 0 || getDiscardLevel() > mDesiredDiscardLevel) { - mFullyLoaded = FALSE; + mFullyLoaded = false; } } } @@ -1781,10 +1752,10 @@ bool LLViewerFetchedTexture::setDebugFetching(S32 debug_level) { if(debug_level < 0) { - mInDebug = FALSE; + mInDebug = false; return false; } - mInDebug = TRUE; + mInDebug = true; mDesiredDiscardLevel = debug_level; @@ -1877,12 +1848,12 @@ bool LLViewerFetchedTexture::updateFetch() if (mRawImage.notNull()) sRawCount++; if (mAuxRawImage.notNull()) { - mHasAux = TRUE; + mHasAux = true; sAuxCount++; } if (finished) { - mIsFetching = FALSE; + mIsFetching = false; mLastFetchState = -1; mLastPacketTimer.reset(); } @@ -1899,7 +1870,7 @@ bool LLViewerFetchedTexture::updateFetch() LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName); if (tester) { - mIsFetched = TRUE; + mIsFetched = true; tester->updateTextureLoadingStats(this, mRawImage, LLAppViewer::getTextureFetch()->isFromLocalCache(mID)); } mRawDiscardLevel = fetch_discard; @@ -1918,12 +1889,12 @@ bool LLViewerFetchedTexture::updateFetch() LL_WARNS() << "oversize, setting as missing" << LL_ENDL; setIsMissingAsset(); mRawDiscardLevel = INVALID_DISCARD_LEVEL; - mIsFetching = FALSE; + mIsFetching = false; mLastPacketTimer.reset(); } else { - mIsRawImageValid = TRUE; + mIsRawImageValid = true; addToCreateTexture(); } @@ -1951,7 +1922,7 @@ bool LLViewerFetchedTexture::updateFetch() } } - return TRUE; + return true; } else { @@ -2095,8 +2066,8 @@ bool LLViewerFetchedTexture::updateFetch() if (fetch_request_discard >= 0) { LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("vftuf - request created"); - mHasFetcher = TRUE; - mIsFetching = TRUE; + mHasFetcher = true; + mIsFetching = true; // in some cases createRequest can modify discard, as an example // bake textures are always at discard 0 mRequestedDiscardLevel = llmin(desired_discard, fetch_request_discard); @@ -2120,11 +2091,11 @@ bool LLViewerFetchedTexture::updateFetch() { LL_DEBUGS("Texture") << "exceeded idle time " << FETCH_IDLE_TIME << ", deleting request: " << getID() << LL_ENDL; LLAppViewer::getTextureFetch()->deleteRequest(getID(), true); - mHasFetcher = FALSE; + mHasFetcher = false; } } - return mIsFetching ? true : false; + return mIsFetching; } void LLViewerFetchedTexture::clearFetchedResults() @@ -2147,8 +2118,8 @@ void LLViewerFetchedTexture::forceToDeleteRequest() { if (mHasFetcher) { - mHasFetcher = FALSE; - mIsFetching = FALSE; + mHasFetcher = false; + mIsFetching = false; } resetTextureStats(); @@ -2156,7 +2127,7 @@ void LLViewerFetchedTexture::forceToDeleteRequest() mDesiredDiscardLevel = getMaxDiscardLevel() + 1; } -void LLViewerFetchedTexture::setIsMissingAsset(BOOL is_missing) +void LLViewerFetchedTexture::setIsMissingAsset(bool is_missing) { if (is_missing == mIsMissingAsset) { @@ -2181,8 +2152,8 @@ void LLViewerFetchedTexture::setIsMissingAsset(BOOL is_missing) if (mHasFetcher) { LLAppViewer::getTextureFetch()->deleteRequest(getID(), true); - mHasFetcher = FALSE; - mIsFetching = FALSE; + mHasFetcher = false; + mIsFetching = false; mLastPacketTimer.reset(); mFetchState = 0; mFetchPriority = 0; @@ -2196,8 +2167,8 @@ void LLViewerFetchedTexture::setIsMissingAsset(BOOL is_missing) } void LLViewerFetchedTexture::setLoadedCallback( loaded_callback_func loaded_callback, - S32 discard_level, BOOL keep_imageraw, BOOL needs_aux, void* userdata, - LLLoadedCallbackEntry::source_callback_list_t* src_callback_list, BOOL pause) + S32 discard_level, bool keep_imageraw, bool needs_aux, void* userdata, + LLLoadedCallbackEntry::source_callback_list_t* src_callback_list, bool pause) { // // Don't do ANYTHING here, just add it to the global callback list @@ -2231,7 +2202,7 @@ void LLViewerFetchedTexture::setLoadedCallback( loaded_callback_func loaded_call mNeedsAux |= needs_aux; if(keep_imageraw) { - mSaveRawImage = TRUE; + mSaveRawImage = true; } if (mNeedsAux && mAuxRawImage.isNull() && getDiscardLevel() >= 0) { @@ -2264,7 +2235,7 @@ void LLViewerFetchedTexture::clearCallbackEntryList() // We never finished loading the image. Indicate failure. // Note: this allows mLoadedCallbackUserData to be cleaned up. - entryp->mCallback(FALSE, this, NULL, NULL, 0, TRUE, entryp->mUserData); + entryp->mCallback(false, this, NULL, NULL, 0, true, entryp->mUserData); iter = mLoadedCallbackList.erase(iter); delete entryp; } @@ -2296,7 +2267,7 @@ void LLViewerFetchedTexture::deleteCallbackEntry(const LLLoadedCallbackEntry::so { // We never finished loading the image. Indicate failure. // Note: this allows mLoadedCallbackUserData to be cleaned up. - entryp->mCallback(FALSE, this, NULL, NULL, 0, TRUE, entryp->mUserData); + entryp->mCallback(false, this, NULL, NULL, 0, true, entryp->mUserData); iter = mLoadedCallbackList.erase(iter); delete entryp; } @@ -2340,30 +2311,30 @@ void LLViewerFetchedTexture::unpauseLoadedCallbacks(const LLLoadedCallbackEntry: { if(!callback_list) { - mPauseLoadedCallBacks = FALSE; + mPauseLoadedCallBacks = false; return; } - BOOL need_raw = FALSE; + bool need_raw = false; for(callback_list_t::iterator iter = mLoadedCallbackList.begin(); iter != mLoadedCallbackList.end(); ) { LLLoadedCallbackEntry *entryp = *iter++; if(entryp->mSourceCallbackList == callback_list) { - entryp->mPaused = FALSE; + entryp->mPaused = false; if(entryp->mNeedsImageRaw) { - need_raw = TRUE; + need_raw = true; } } } - mPauseLoadedCallBacks = FALSE ; + mPauseLoadedCallBacks = false ; mLastCallBackActiveTime = sCurrentTime ; - mForceCallbackFetch = TRUE; + mForceCallbackFetch = true; if(need_raw) { - mSaveRawImage = TRUE; + mSaveRawImage = true; } } @@ -2382,7 +2353,7 @@ void LLViewerFetchedTexture::pauseLoadedCallbacks(const LLLoadedCallbackEntry::s LLLoadedCallbackEntry *entryp = *iter++; if(entryp->mSourceCallbackList == callback_list) { - entryp->mPaused = TRUE; + entryp->mPaused = true; } else if(!entryp->mPaused) { @@ -2392,9 +2363,9 @@ void LLViewerFetchedTexture::pauseLoadedCallbacks(const LLLoadedCallbackEntry::s if(paused) { - mPauseLoadedCallBacks = TRUE;//when set, loaded callback is paused. + mPauseLoadedCallBacks = true;//when set, loaded callback is paused. resetTextureStats(); - mSaveRawImage = FALSE; + mSaveRawImage = false; } } @@ -2445,7 +2416,7 @@ bool LLViewerFetchedTexture::doLoadedCallbacks() LLLoadedCallbackEntry *entryp = *iter++; // We never finished loading the image. Indicate failure. // Note: this allows mLoadedCallbackUserData to be cleaned up. - entryp->mCallback(FALSE, this, NULL, NULL, 0, TRUE, entryp->mUserData); + entryp->mCallback(false, this, NULL, NULL, 0, true, entryp->mUserData); delete entryp; } mLoadedCallbackList.clear(); @@ -2578,11 +2549,11 @@ bool LLViewerFetchedTexture::doLoadedCallbacks() { LL_WARNS() << "Raw Image with no Aux Data for callback" << LL_ENDL; } - BOOL final = mRawDiscardLevel <= entryp->mDesiredDiscard ? TRUE : FALSE; + bool final = mRawDiscardLevel <= entryp->mDesiredDiscard; //LL_INFOS() << "Running callback for " << getID() << LL_ENDL; //LL_INFOS() << mRawImage->getWidth() << "x" << mRawImage->getHeight() << LL_ENDL; entryp->mLastUsedDiscard = mRawDiscardLevel; - entryp->mCallback(TRUE, this, mRawImage, mAuxRawImage, mRawDiscardLevel, final, entryp->mUserData); + entryp->mCallback(true, this, mRawImage, mAuxRawImage, mRawDiscardLevel, final, entryp->mUserData); if (final) { iter = mLoadedCallbackList.erase(curiter); @@ -2609,9 +2580,9 @@ bool LLViewerFetchedTexture::doLoadedCallbacks() if (!entryp->mNeedsImageRaw && (entryp->mLastUsedDiscard > gl_discard)) { mLastCallBackActiveTime = sCurrentTime; - BOOL final = gl_discard <= entryp->mDesiredDiscard ? TRUE : FALSE; + bool final = gl_discard <= entryp->mDesiredDiscard; entryp->mLastUsedDiscard = gl_discard; - entryp->mCallback(TRUE, this, NULL, NULL, gl_discard, final, entryp->mUserData); + entryp->mCallback(true, this, NULL, NULL, gl_discard, final, entryp->mUserData); if (final) { iter = mLoadedCallbackList.erase(curiter); @@ -2636,7 +2607,7 @@ bool LLViewerFetchedTexture::doLoadedCallbacks() { //wait for long enough but no fetching request issued, force one. forceToRefetchTexture(mLoadedCallbackDesiredDiscardLevel, 5.f); - mForceCallbackFetch = FALSE; //fire once. + mForceCallbackFetch = false; //fire once. } return res; @@ -2709,7 +2680,7 @@ LLImageRaw* LLViewerFetchedTexture::reloadRawImage(S8 discard_level) mRawDiscardLevel = discard_level; } } - mIsRawImageValid = TRUE; + mIsRawImageValid = true; sRawCount++; return mRawImage; @@ -2744,7 +2715,7 @@ void LLViewerFetchedTexture::destroyRawImage() mRawImage = NULL; - mIsRawImageValid = FALSE; + mIsRawImageValid = false; mRawDiscardLevel = INVALID_DISCARD_LEVEL; } } @@ -2768,7 +2739,7 @@ void LLViewerFetchedTexture::switchToCachedImage() gTextureList.dirtyImage(this); } - mIsRawImageValid = TRUE; + mIsRawImageValid = true; mRawDiscardLevel = mCachedRawDiscardLevel; scheduleCreateTexture(); @@ -2814,7 +2785,7 @@ void LLViewerFetchedTexture::setCachedRawImage(S32 discard_level, LLImageRaw* im mCachedRawImage = imageraw; } mCachedRawDiscardLevel = discard_level; - mCachedRawImageReady = TRUE; + mCachedRawImageReady = true; } } @@ -2885,7 +2856,7 @@ void LLViewerFetchedTexture::checkCachedRawSculptImage() { if(getDiscardLevel() != 0) { - mCachedRawImageReady = FALSE; + mCachedRawImageReady = false; } else if(isForSculptOnly()) { @@ -2902,6 +2873,8 @@ void LLViewerFetchedTexture::saveRawImage() return; } + LLImageDataSharedLock lock(mRawImage); + mSavedRawDiscardLevel = mRawDiscardLevel; if (mBoostLevel == LLGLTexture::BOOST_ICON) { @@ -2938,7 +2911,7 @@ void LLViewerFetchedTexture::saveRawImage() if(mForceToSaveRawImage && mSavedRawDiscardLevel <= mDesiredSavedRawDiscardLevel) { - mForceToSaveRawImage = FALSE; + mForceToSaveRawImage = false; } mLastReferencedSavedRawImageTime = sCurrentTime; @@ -2954,7 +2927,7 @@ void LLViewerFetchedTexture::forceToRefetchTexture(S32 desired_discard, F32 kept } //trigger a new fetch. - mForceToSaveRawImage = TRUE ; + mForceToSaveRawImage = true ; mDesiredSavedRawDiscardLevel = desired_discard ; mKeptSavedRawImageTime = kept_time ; mLastReferencedSavedRawImageTime = sCurrentTime ; @@ -2974,7 +2947,7 @@ void LLViewerFetchedTexture::forceToSaveRawImage(S32 desired_discard, F32 kept_t if(!mForceToSaveRawImage || mDesiredSavedRawDiscardLevel < 0 || mDesiredSavedRawDiscardLevel > desired_discard) { - mForceToSaveRawImage = TRUE; + mForceToSaveRawImage = true; mDesiredSavedRawDiscardLevel = desired_discard; //copy from the cached raw image if exists. @@ -2997,14 +2970,14 @@ void LLViewerFetchedTexture::destroySavedRawImage() return; //keep the saved raw image. } - mForceToSaveRawImage = FALSE; - mSaveRawImage = FALSE; + mForceToSaveRawImage = false; + mSaveRawImage = false; clearCallbackEntryList(); mSavedRawImage = NULL ; - mForceToSaveRawImage = FALSE ; - mSaveRawImage = FALSE ; + mForceToSaveRawImage = false ; + mSaveRawImage = false ; mSavedRawDiscardLevel = -1 ; mDesiredSavedRawDiscardLevel = -1 ; mLastReferencedSavedRawImageTime = 0.0f ; @@ -3024,7 +2997,7 @@ LLImageRaw* LLViewerFetchedTexture::getSavedRawImage() return mSavedRawImage; } -BOOL LLViewerFetchedTexture::hasSavedRawImage() const +bool LLViewerFetchedTexture::hasSavedRawImage() const { return mSavedRawImage.notNull(); } @@ -3041,16 +3014,16 @@ F32 LLViewerFetchedTexture::getElapsedLastReferencedSavedRawImageTime() const //---------------------------------------------------------------------------------------------- //start of LLViewerLODTexture //---------------------------------------------------------------------------------------------- -LLViewerLODTexture::LLViewerLODTexture(const LLUUID& id, FTType f_type, const LLHost& host, BOOL usemipmaps) +LLViewerLODTexture::LLViewerLODTexture(const LLUUID& id, FTType f_type, const LLHost& host, bool usemipmaps) : LLViewerFetchedTexture(id, f_type, host, usemipmaps) { - init(TRUE); + init(true); } -LLViewerLODTexture::LLViewerLODTexture(const std::string& url, FTType f_type, const LLUUID& id, BOOL usemipmaps) +LLViewerLODTexture::LLViewerLODTexture(const std::string& url, FTType f_type, const LLUUID& id, bool usemipmaps) : LLViewerFetchedTexture(url, f_type, id, usemipmaps) { - init(TRUE); + init(true); } void LLViewerLODTexture::init(bool firstinit) @@ -3284,7 +3257,7 @@ LLViewerMediaTexture* LLViewerMediaTexture::findMediaTexture(const LLUUID& media return media_tex; } -LLViewerMediaTexture::LLViewerMediaTexture(const LLUUID& id, BOOL usemipmaps, LLImageGL* gl_image) +LLViewerMediaTexture::LLViewerMediaTexture(const LLUUID& id, bool usemipmaps, LLImageGL* gl_image) : LLViewerTexture(id, usemipmaps), mMediaImplp(NULL), mUpdateVirtualSizeTime(0) @@ -3300,9 +3273,9 @@ LLViewerMediaTexture::LLViewerMediaTexture(const LLUUID& id, BOOL usemipmaps, LL mGLTexturep->setAllowCompression(false); - mGLTexturep->setNeedsAlphaAndPickMask(FALSE); + mGLTexturep->setNeedsAlphaAndPickMask(false); - mIsPlaying = FALSE; + mIsPlaying = false; setMediaImpl(); @@ -3325,17 +3298,17 @@ LLViewerMediaTexture::~LLViewerMediaTexture() } } -void LLViewerMediaTexture::reinit(BOOL usemipmaps /* = TRUE */) +void LLViewerMediaTexture::reinit(bool usemipmaps /* = true */) { llassert(mGLTexturep.notNull()); mUseMipMaps = usemipmaps; getLastReferencedTimer()->reset(); mGLTexturep->setUseMipMaps(mUseMipMaps); - mGLTexturep->setNeedsAlphaAndPickMask(FALSE); + mGLTexturep->setNeedsAlphaAndPickMask(false); } -void LLViewerMediaTexture::setUseMipMaps(BOOL mipmap) +void LLViewerMediaTexture::setUseMipMaps(bool mipmap) { mUseMipMaps = mipmap; @@ -3367,11 +3340,11 @@ void LLViewerMediaTexture::setMediaImpl() //return true if all faces to reference to this media texture are found //Note: mMediaFaceList is valid only for the current instant // because it does not check the face validity after the current frame. -BOOL LLViewerMediaTexture::findFaces() +bool LLViewerMediaTexture::findFaces() { mMediaFaceList.clear(); - BOOL ret = TRUE; + bool ret = true; LLViewerTexture* tex = gTextureList.findImage(mID, TEX_LIST_STANDARD); if(tex) //this media is a parcel media for tex. @@ -3392,7 +3365,7 @@ BOOL LLViewerMediaTexture::findFaces() if(!mMediaImplp) { - return TRUE; + return true; } //for media on a face. @@ -3408,13 +3381,13 @@ BOOL LLViewerMediaTexture::findFaces() // If this happens, viewer is likely to crash llassert(0); LL_WARNS() << "Dead object in mMediaImplp's object list" << LL_ENDL; - ret = FALSE; + ret = false; continue; } if (obj->mDrawable.isNull() || obj->mDrawable->isDead()) { - ret = FALSE; + ret = false; continue; } @@ -3429,7 +3402,7 @@ BOOL LLViewerMediaTexture::findFaces() } else { - ret = FALSE; + ret = false; } } } @@ -3478,9 +3451,9 @@ void LLViewerMediaTexture::removeMediaFromFace(LLFace* facep) return; //no need to remove the face because the media is not in playing. } - mIsPlaying = FALSE; //set to remove the media from the face. + mIsPlaying = false; //set to remove the media from the face. switchTexture(LLRender::DIFFUSE_MAP, facep); - mIsPlaying = TRUE; //set the flag back. + mIsPlaying = true; //set the flag back. if(getTotalNumFaces() < 1) //no face referencing to this media { @@ -3563,12 +3536,12 @@ void LLViewerMediaTexture::removeFace(U32 ch, LLFace* facep) return; } - S32 end = te_list.size(); + auto end = te_list.size(); for(std::list< LLPointer<LLViewerTexture> >::iterator iter = mTextureList.begin(); iter != mTextureList.end(); ++iter) { - S32 i = 0; + size_t i = 0; for(i = 0; i < end; i++) { @@ -3611,7 +3584,7 @@ void LLViewerMediaTexture::stopPlaying() // { // mMediaImplp->stop(); // } - mIsPlaying = FALSE; + mIsPlaying = false; } void LLViewerMediaTexture::switchTexture(U32 ch, LLFace* facep) @@ -3652,7 +3625,7 @@ void LLViewerMediaTexture::switchTexture(U32 ch, LLFace* facep) } } -void LLViewerMediaTexture::setPlaying(BOOL playing) +void LLViewerMediaTexture::setPlaying(bool playing) { if(!mMediaImplp) { @@ -3674,7 +3647,7 @@ void LLViewerMediaTexture::setPlaying(BOOL playing) if(findFaces()) { //about to update all faces. - mMediaImplp->setUpdated(FALSE); + mMediaImplp->setUpdated(false); } if(mMediaFaceList.empty())//no face pointing to this media @@ -3712,7 +3685,7 @@ F32 LLViewerMediaTexture::getMaxVirtualSize() if(!mMaxVirtualSizeResetCounter) { - addTextureStats(0.f, FALSE);//reset + addTextureStats(0.f, false);//reset } if(mIsPlaying) //media is playing @@ -3807,13 +3780,13 @@ void LLTexturePipelineTester::update() //start a new fetching session reset(); mStartFetchingTime = LLImageGL::sLastFrameTime; - mPause = FALSE; + mPause = false; } //update total gray time if(mUsingDefaultTexture) { - mUsingDefaultTexture = FALSE; + mUsingDefaultTexture = false; mTotalGrayTime = LLImageGL::sLastFrameTime - mStartFetchingTime; } @@ -3825,7 +3798,7 @@ void LLTexturePipelineTester::update() else if(!mPause) { //stop the current fetching session - mPause = TRUE; + mPause = true; outputTestResults(); reset(); } @@ -3833,9 +3806,9 @@ void LLTexturePipelineTester::update() void LLTexturePipelineTester::reset() { - mPause = TRUE; + mPause = true; - mUsingDefaultTexture = FALSE; + mUsingDefaultTexture = false; mStartStablizingTime = 0.0f; mEndStablizingTime = 0.0f; @@ -3886,7 +3859,7 @@ void LLTexturePipelineTester::updateTextureBindingStats(const LLViewerTexture* i } } -void LLTexturePipelineTester::updateTextureLoadingStats(const LLViewerFetchedTexture* imagep, const LLImageRaw* raw_imagep, BOOL from_cache) +void LLTexturePipelineTester::updateTextureLoadingStats(const LLViewerFetchedTexture* imagep, const LLImageRaw* raw_imagep, bool from_cache) { U32Bytes data_size = (U32Bytes)raw_imagep->getDataSize(); mTotalBytesLoaded += data_size; @@ -3915,7 +3888,7 @@ void LLTexturePipelineTester::updateTextureLoadingStats(const LLViewerFetchedTex void LLTexturePipelineTester::updateGrayTextureBinding() { - mUsingDefaultTexture = TRUE; + mUsingDefaultTexture = true; } void LLTexturePipelineTester::setStablizingTime() @@ -4042,7 +4015,7 @@ LLMetricPerformanceTesterWithSession::LLTestSession* LLTexturePipelineTester::lo //load a session std::string currentLabel = getCurrentLabelName(); - BOOL in_log = (*log).has(currentLabel); + bool in_log = (*log).has(currentLabel); while (in_log) { LLSD::String label = currentLabel; diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index b1983445a6..dc9182bf1b 100644 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -54,7 +54,7 @@ class LLViewerMediaTexture ; class LLTexturePipelineTester ; -typedef void (*loaded_callback_func)( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, BOOL final, void* userdata ); +typedef void (*loaded_callback_func)( bool success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, bool final, void* userdata ); class LLFileSystem; class LLMessageSystem; @@ -70,19 +70,19 @@ public: public: LLLoadedCallbackEntry(loaded_callback_func cb, S32 discard_level, - BOOL need_imageraw, // Needs image raw for the callback + bool need_imageraw, // Needs image raw for the callback void* userdata, source_callback_list_t* src_callback_list, LLViewerFetchedTexture* target, - BOOL pause); + bool pause); ~LLLoadedCallbackEntry(); void removeTexture(LLViewerFetchedTexture* tex) ; loaded_callback_func mCallback; S32 mLastUsedDiscard; S32 mDesiredDiscard; - BOOL mNeedsImageRaw; - BOOL mPaused; + bool mNeedsImageRaw; + bool mPaused; void* mUserData; source_callback_list_t* mSourceCallbackList; @@ -118,13 +118,13 @@ public: static void initClass(); static void updateClass(); - LLViewerTexture(BOOL usemipmaps = TRUE); - LLViewerTexture(const LLUUID& id, BOOL usemipmaps) ; - LLViewerTexture(const LLImageRaw* raw, BOOL usemipmaps) ; - LLViewerTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps) ; + LLViewerTexture(bool usemipmaps = true); + LLViewerTexture(const LLUUID& id, bool usemipmaps) ; + LLViewerTexture(const LLImageRaw* raw, bool usemipmaps) ; + LLViewerTexture(const U32 width, const U32 height, const U8 components, bool usemipmaps) ; virtual S8 getType() const; - virtual BOOL isMissingAsset() const ; + virtual bool isMissingAsset() const ; virtual void dump(); // debug info to LL_INFOS() virtual bool isViewerMediaTexture() const { return false; } @@ -140,7 +140,7 @@ public: void setTextureListType(S32 tex_type) { mTextureListType = tex_type; } S32 getTextureListType() { return mTextureListType; } - void addTextureStats(F32 virtual_size, BOOL needs_gltexture = TRUE) const; + void addTextureStats(F32 virtual_size, bool needs_gltexture = true) const; void resetTextureStats(); void setMaxVirtualSizeResetInterval(S32 interval)const {mMaxVirtualSizeResetInterval = interval;} void resetMaxVirtualSizeResetCounter()const {mMaxVirtualSizeResetCounter = mMaxVirtualSizeResetInterval;} @@ -167,10 +167,10 @@ public: virtual void setCachedRawImage(S32 discard_level, LLImageRaw* imageraw) ; - BOOL isLargeImage() ; + bool isLargeImage() ; void setParcelMedia(LLViewerMediaTexture* media) {mParcelMedia = media;} - BOOL hasParcelMedia() const { return mParcelMedia != NULL;} + bool hasParcelMedia() const { return mParcelMedia != NULL;} LLViewerMediaTexture* getParcelMedia() const { return mParcelMedia;} /*virtual*/ void updateBindStatsForTester() ; @@ -186,10 +186,6 @@ private: virtual void switchToCachedImage(); - static void getGPUMemoryForTextures(S32Megabytes &gpu, S32Megabytes &physical); - -public: - static bool isMemoryForTextureLow(); protected: friend class LLViewerTextureList; LLUUID mID; @@ -228,6 +224,9 @@ public: static bool sFreezeImageUpdates; static F32 sCurrentTime ; + // estimated free memory for textures, by bias calculation + static F32 sFreeVRAMMegabytes; + enum EDebugTexels { DEBUG_TEXELS_OFF, @@ -269,9 +268,9 @@ class LLViewerFetchedTexture : public LLViewerTexture protected: /*virtual*/ ~LLViewerFetchedTexture(); public: - LLViewerFetchedTexture(const LLUUID& id, FTType f_type, const LLHost& host = LLHost(), BOOL usemipmaps = TRUE); - LLViewerFetchedTexture(const LLImageRaw* raw, FTType f_type, BOOL usemipmaps); - LLViewerFetchedTexture(const std::string& url, FTType f_type, const LLUUID& id, BOOL usemipmaps = TRUE); + LLViewerFetchedTexture(const LLUUID& id, FTType f_type, const LLHost& host = LLHost(), bool usemipmaps = true); + LLViewerFetchedTexture(const LLImageRaw* raw, FTType f_type, bool usemipmaps); + LLViewerFetchedTexture(const std::string& url, FTType f_type, const LLUUID& id, bool usemipmaps = true); public: @@ -303,9 +302,9 @@ public: // Set callbacks to get called when the image gets updated with higher // resolution versions. void setLoadedCallback(loaded_callback_func cb, - S32 discard_level, BOOL keep_imageraw, BOOL needs_aux, - void* userdata, LLLoadedCallbackEntry::source_callback_list_t* src_callback_list, BOOL pause = FALSE); - bool hasCallbacks() { return mLoadedCallbackList.empty() ? false : true; } + S32 discard_level, bool keep_imageraw, bool needs_aux, + void* userdata, LLLoadedCallbackEntry::source_callback_list_t* src_callback_list, bool pause = false); + bool hasCallbacks() { return !mLoadedCallbackList.empty(); } void pauseLoadedCallbacks(const LLLoadedCallbackEntry::source_callback_list_t* callback_list); void unpauseLoadedCallbacks(const LLLoadedCallbackEntry::source_callback_list_t* callback_list); bool doLoadedCallbacks(); @@ -315,9 +314,9 @@ public: void addToCreateTexture(); //call to determine if createTexture is necessary - BOOL preCreateTexture(S32 usename = 0); + bool preCreateTexture(S32 usename = 0); // ONLY call from LLViewerTextureList or ImageGL background thread - BOOL createTexture(S32 usename = 0); + bool createTexture(S32 usename = 0); void postCreateTexture(); void scheduleCreateTexture(); @@ -325,7 +324,7 @@ public: virtual void processTextureStats() ; - BOOL needsAux() const { return mNeedsAux; } + bool needsAux() const { return mNeedsAux; } // Host we think might have this image, used for baked av textures. void setTargetHost(LLHost host) { mTargetHost = host; } @@ -341,7 +340,7 @@ public: bool setDebugFetching(S32 debug_level); bool isInDebug() const { return mInDebug; } - void setUnremovable(BOOL value) { mUnremovable = value; } + void setUnremovable(bool value) { mUnremovable = value; } bool isUnremovable() const { return mUnremovable; } void clearFetchedResults(); //clear all fetched results, for debug use. @@ -355,16 +354,16 @@ public: // to the specified text void setDebugText(const std::string& text); - void setIsMissingAsset(BOOL is_missing = true); - /*virtual*/ BOOL isMissingAsset() const override { return mIsMissingAsset; } + void setIsMissingAsset(bool is_missing = true); + /*virtual*/ bool isMissingAsset() const override { return mIsMissingAsset; } // returns dimensions of original image for local files (before power of two scaling) // and returns 0 for all asset system images S32 getOriginalWidth() { return mOrigWidth; } S32 getOriginalHeight() { return mOrigHeight; } - BOOL isInImageList() const {return mInImageList ;} - void setInImageList(BOOL flag) {mInImageList = flag ;} + bool isInImageList() const {return mInImageList ;} + void setInImageList(bool flag) {mInImageList = flag ;} LLFrameTimer* getLastPacketTimer() {return &mLastPacketTimer;} @@ -377,17 +376,17 @@ public: const std::string& getUrl() const {return mUrl;} //--------------- - BOOL isDeleted() ; - BOOL isInactive() ; - BOOL isDeletionCandidate(); + bool isDeleted() ; + bool isInactive() ; + bool isDeletionCandidate(); void setDeletionCandidate() ; void setInactive() ; - BOOL getUseDiscard() const { return mUseMipMaps && !mDontDiscard; } + bool getUseDiscard() const { return mUseMipMaps && !mDontDiscard; } //--------------- void setForSculpt(); - BOOL forSculpt() const {return mForSculpt;} - BOOL isForSculptOnly() const; + bool forSculpt() const {return mForSculpt;} + bool isForSculptOnly() const; //raw image management void checkCachedRawSculptImage() ; @@ -395,17 +394,17 @@ public: S32 getRawImageLevel() const {return mRawDiscardLevel;} LLImageRaw* getCachedRawImage() const { return mCachedRawImage ;} S32 getCachedRawImageLevel() const {return mCachedRawDiscardLevel;} - BOOL isCachedRawImageReady() const {return mCachedRawImageReady ;} - BOOL isRawImageValid()const { return mIsRawImageValid ; } + bool isCachedRawImageReady() const {return mCachedRawImageReady ;} + bool isRawImageValid()const { return mIsRawImageValid ; } void forceToSaveRawImage(S32 desired_discard = 0, F32 kept_time = 0.f) ; /*virtual*/ void setCachedRawImage(S32 discard_level, LLImageRaw* imageraw) override; void destroySavedRawImage() ; LLImageRaw* getSavedRawImage() ; - BOOL hasSavedRawImage() const ; + bool hasSavedRawImage() const ; F32 getElapsedLastReferencedSavedRawImageTime() const ; - BOOL isFullyLoaded() const; + bool isFullyLoaded() const; - BOOL hasFetcher() const { return mHasFetcher;} + bool hasFetcher() const { return mHasFetcher;} bool isFetching() const { return mIsFetching;} void setCanUseHTTP(bool can_use_http) {mCanUseHTTP = can_use_http;} @@ -430,19 +429,17 @@ private: //for atlas void resetFaceAtlas() ; - void invalidateAtlas(BOOL rebuild_geom) ; - BOOL insertToAtlas() ; + void invalidateAtlas(bool rebuild_geom) ; + bool insertToAtlas() ; private: - BOOL mFullyLoaded; - BOOL mInDebug; - BOOL mUnremovable; - BOOL mInFastCacheList; - BOOL mForceCallbackFetch; + bool mFullyLoaded; + bool mInDebug; + bool mUnremovable; + bool mInFastCacheList; + bool mForceCallbackFetch; protected: - std::string mLocalFileName; - S32 mOrigWidth; S32 mOrigHeight; @@ -450,7 +447,7 @@ protected: // Used for UI textures to not decode, even if we have more data. S32 mKnownDrawWidth; S32 mKnownDrawHeight; - BOOL mKnownDrawSizeChanged ; + bool mKnownDrawSizeChanged ; std::string mUrl; S32 mRequestedDiscardLevel; @@ -465,21 +462,21 @@ protected: S8 mDesiredDiscardLevel; // The discard level we'd LIKE to have - if we have it and there's space S8 mMinDesiredDiscardLevel; // The minimum discard level we'd like to have - S8 mNeedsAux; // We need to decode the auxiliary channels - S8 mHasAux; // We have aux channels - S8 mDecodingAux; // Are we decoding high components - S8 mIsRawImageValid; - S8 mHasFetcher; // We've made a fecth request - S8 mIsFetching; // Fetch request is active + bool mNeedsAux; // We need to decode the auxiliary channels + bool mHasAux; // We have aux channels + bool mDecodingAux; // Are we decoding high components + bool mIsRawImageValid; + bool mHasFetcher; // We've made a fecth request + bool mIsFetching; // Fetch request is active bool mCanUseHTTP; //This texture can be fetched through http if true. LLCore::HttpStatus mLastHttpGetStatus; // Result of the most recently completed http request for this texture. FTType mFTType; // What category of image is this - map tile, server bake, etc? - mutable S8 mIsMissingAsset; // True if we know that there is no image asset with this image id in the database. + mutable bool mIsMissingAsset; // True if we know that there is no image asset with this image id in the database. typedef std::list<LLLoadedCallbackEntry*> callback_list_t; S8 mLoadedCallbackDesiredDiscardLevel; - BOOL mPauseLoadedCallBacks; + bool mPauseLoadedCallBacks; callback_list_t mLoadedCallbackList; F32 mLastCallBackActiveTime; @@ -492,8 +489,8 @@ protected: //keep a copy of mRawImage for some special purposes //when mForceToSaveRawImage is set. - BOOL mForceToSaveRawImage ; - BOOL mSaveRawImage; + bool mForceToSaveRawImage ; + bool mSaveRawImage; LLPointer<LLImageRaw> mSavedRawImage; S32 mSavedRawDiscardLevel; S32 mDesiredSavedRawDiscardLevel; @@ -503,7 +500,7 @@ protected: //a small version of the copy of the raw image (<= 64 * 64) LLPointer<LLImageRaw> mCachedRawImage; S32 mCachedRawDiscardLevel; - BOOL mCachedRawImageReady; //the rez of the mCachedRawImage reaches the upper limit. + bool mCachedRawImageReady; //the rez of the mCachedRawImage reaches the upper limit. LLHost mTargetHost; // if invalid, just request from agent's simulator @@ -511,13 +508,13 @@ protected: LLFrameTimer mLastPacketTimer; // Time since last packet. LLFrameTimer mStopFetchingTimer; // Time since mDecodePriority == 0.f. - BOOL mInImageList; // TRUE if image is in list (in which case don't reset priority!) + bool mInImageList; // true if image is in list (in which case don't reset priority!) // This needs to be atomic, since it is written both in the main thread // and in the GL image worker thread... HB LLAtomicBool mNeedsCreateTexture; - BOOL mForSculpt ; //a flag if the texture is used as sculpt data. - BOOL mIsFetched ; //is loaded from remote or from cache, not generated locally. + bool mForSculpt ; //a flag if the texture is used as sculpt data. + bool mIsFetched ; //is loaded from remote or from cache, not generated locally. public: static F32 sMaxVirtualSize; //maximum possible value of mMaxVirtualSize @@ -542,8 +539,8 @@ protected: /*virtual*/ ~LLViewerLODTexture(){} public: - LLViewerLODTexture(const LLUUID& id, FTType f_type, const LLHost& host = LLHost(), BOOL usemipmaps = TRUE); - LLViewerLODTexture(const std::string& url, FTType f_type, const LLUUID& id, BOOL usemipmaps = TRUE); + LLViewerLODTexture(const LLUUID& id, FTType f_type, const LLHost& host = LLHost(), bool usemipmaps = true); + LLViewerLODTexture(const std::string& url, FTType f_type, const LLUUID& id, bool usemipmaps = true); /*virtual*/ S8 getType() const; // Process image stats to determine priority/quality requirements. @@ -569,16 +566,16 @@ protected: /*virtual*/ ~LLViewerMediaTexture() ; public: - LLViewerMediaTexture(const LLUUID& id, BOOL usemipmaps = TRUE, LLImageGL* gl_image = NULL) ; + LLViewerMediaTexture(const LLUUID& id, bool usemipmaps = true, LLImageGL* gl_image = NULL) ; /*virtual*/ S8 getType() const; - void reinit(BOOL usemipmaps = TRUE); + void reinit(bool usemipmaps = true); - BOOL getUseMipMaps() {return mUseMipMaps ; } - void setUseMipMaps(BOOL mipmap) ; + bool getUseMipMaps() {return mUseMipMaps ; } + void setUseMipMaps(bool mipmap) ; - void setPlaying(BOOL playing) ; - BOOL isPlaying() const {return mIsPlaying;} + void setPlaying(bool playing) ; + bool isPlaying() const {return mIsPlaying;} void setMediaImpl() ; virtual bool isViewerMediaTexture() const { return true; } @@ -595,7 +592,7 @@ public: /*virtual*/ F32 getMaxVirtualSize() ; private: void switchTexture(U32 ch, LLFace* facep) ; - BOOL findFaces() ; + bool findFaces() ; void stopPlaying() ; private: @@ -610,7 +607,7 @@ private: std::list< LLPointer<LLViewerTexture> > mTextureList ; LLViewerMediaImpl* mMediaImplp ; - BOOL mIsPlaying ; + bool mIsPlaying ; U32 mUpdateVirtualSizeTime ; public: @@ -637,7 +634,7 @@ public: static LLTexturePipelineTester* sTesterp ; //returns NULL if tex is not a LLViewerFetchedTexture nor derived from LLViewerFetchedTexture. - static LLViewerFetchedTexture* staticCastToFetchedTexture(LLTexture* tex, BOOL report_error = FALSE) ; + static LLViewerFetchedTexture* staticCastToFetchedTexture(LLTexture* tex, bool report_error = false) ; // //"find-texture" just check if the texture exists, if yes, return it, otherwise return null. @@ -647,23 +644,23 @@ public: static LLViewerFetchedTexture* findFetchedTexture(const LLUUID& id, S32 tex_type); static LLViewerMediaTexture* findMediaTexture(const LLUUID& id) ; - static LLViewerMediaTexture* createMediaTexture(const LLUUID& id, BOOL usemipmaps = TRUE, LLImageGL* gl_image = NULL) ; + static LLViewerMediaTexture* createMediaTexture(const LLUUID& id, bool usemipmaps = true, LLImageGL* gl_image = NULL) ; // //"get-texture" will create a new texture if the texture does not exist. // - static LLViewerMediaTexture* getMediaTexture(const LLUUID& id, BOOL usemipmaps = TRUE, LLImageGL* gl_image = NULL) ; + static LLViewerMediaTexture* getMediaTexture(const LLUUID& id, bool usemipmaps = true, LLImageGL* gl_image = NULL) ; - static LLPointer<LLViewerTexture> getLocalTexture(BOOL usemipmaps = TRUE, BOOL generate_gl_tex = TRUE); - static LLPointer<LLViewerTexture> getLocalTexture(const LLUUID& id, BOOL usemipmaps, BOOL generate_gl_tex = TRUE) ; - static LLPointer<LLViewerTexture> getLocalTexture(const LLImageRaw* raw, BOOL usemipmaps) ; - static LLPointer<LLViewerTexture> getLocalTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps, BOOL generate_gl_tex = TRUE) ; + static LLPointer<LLViewerTexture> getLocalTexture(bool usemipmaps = true, bool generate_gl_tex = true); + static LLPointer<LLViewerTexture> getLocalTexture(const LLUUID& id, bool usemipmaps, bool generate_gl_tex = true) ; + static LLPointer<LLViewerTexture> getLocalTexture(const LLImageRaw* raw, bool usemipmaps) ; + static LLPointer<LLViewerTexture> getLocalTexture(const U32 width, const U32 height, const U8 components, bool usemipmaps, bool generate_gl_tex = true) ; static LLViewerFetchedTexture* getFetchedTexture(const LLImageRaw* raw, FTType type, bool usemipmaps); static LLViewerFetchedTexture* getFetchedTexture(const LLUUID &image_id, FTType f_type = FTT_DEFAULT, - BOOL usemipmap = TRUE, + bool usemipmap = true, LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, // Get the requested level immediately upon creation. S8 texture_type = LLViewerTexture::FETCHED_TEXTURE, LLGLint internal_format = 0, @@ -673,7 +670,7 @@ public: static LLViewerFetchedTexture* getFetchedTextureFromFile(const std::string& filename, FTType f_type = FTT_LOCAL_FILE, - BOOL usemipmap = TRUE, + bool usemipmap = true, LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, S8 texture_type = LLViewerTexture::FETCHED_TEXTURE, LLGLint internal_format = 0, @@ -683,7 +680,7 @@ public: static LLViewerFetchedTexture* getFetchedTextureFromUrl(const std::string& url, FTType f_type, - BOOL usemipmap = TRUE, + bool usemipmap = true, LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, S8 texture_type = LLViewerTexture::FETCHED_TEXTURE, LLGLint internal_format = 0, @@ -693,6 +690,14 @@ public: static LLViewerFetchedTexture* getFetchedTextureFromHost(const LLUUID& image_id, FTType f_type, LLHost host) ; + // decode a given image data according to given mime type + // WARNING: caller is responsible for deleting the returned raw image + static LLImageRaw* getRawImageFromMemory(const U8* data, U32 size, std::string_view mimetype); + + // decode given image data according to given mime type + // WARNING: caller is responsible for deleting the returned image + static LLViewerFetchedTexture* getFetchedTextureFromMemory(const U8* data, U32 size, std::string_view mimetype); + static void init() ; static void cleanup() ; }; @@ -713,7 +718,7 @@ public: void update(); void updateTextureBindingStats(const LLViewerTexture* imagep) ; - void updateTextureLoadingStats(const LLViewerFetchedTexture* imagep, const LLImageRaw* raw_imagep, BOOL from_cache) ; + void updateTextureLoadingStats(const LLViewerFetchedTexture* imagep, const LLImageRaw* raw_imagep, bool from_cache) ; void updateGrayTextureBinding() ; void setStablizingTime() ; @@ -724,9 +729,9 @@ private: /*virtual*/ void outputTestRecord(LLSD* sd) ; private: - BOOL mPause ; + bool mPause ; private: - BOOL mUsingDefaultTexture; //if set, some textures are still gray. + bool mUsingDefaultTexture; //if set, some textures are still gray. U32Bytes mTotalBytesUsed ; //total bytes of textures bound/used for the current frame. U32Bytes mTotalBytesUsedForLargeImage ; //total bytes of textures bound/used for the current frame for images larger than 256 * 256. diff --git a/indra/newview/llviewertextureanim.cpp b/indra/newview/llviewertextureanim.cpp index 9342eb2865..238e6830ea 100644 --- a/indra/newview/llviewertextureanim.cpp +++ b/indra/newview/llviewertextureanim.cpp @@ -43,13 +43,13 @@ LLViewerTextureAnim::LLViewerTextureAnim(LLVOVolume* vobj) : LLTextureAnim() mScaleS = mScaleT = 1; mRot = 0; - mInstanceIndex = sInstanceList.size(); + mInstanceIndex = static_cast<S32>(sInstanceList.size()); sInstanceList.push_back(this); } LLViewerTextureAnim::~LLViewerTextureAnim() { - S32 end_idx = sInstanceList.size()-1; + S32 end_idx = static_cast<S32>(sInstanceList.size()) - 1; if (end_idx != mInstanceIndex) { diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index f8825fe7e1..c812504f9b 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -91,14 +91,14 @@ LLTextureKey::LLTextureKey(LLUUID id, ETexListType tex_type) /////////////////////////////////////////////////////////////////////////////// LLViewerTextureList::LLViewerTextureList() - : mForceResetTextureStats(FALSE), - mInitialized(FALSE) + : mForceResetTextureStats(false), + mInitialized(false) { } void LLViewerTextureList::init() { - mInitialized = TRUE ; + mInitialized = true ; sNumImages = 0; doPreloadImages(); } @@ -139,12 +139,12 @@ void LLViewerTextureList::doPreloadImages() image_list->initFromFile(); // turn off clamping and bilinear filtering for uv picking images - //LLViewerFetchedTexture* uv_test = preloadUIImage("uv_test1.tga", LLUUID::null, FALSE); - //uv_test->setClamp(FALSE, FALSE); - //uv_test->setMipFilterNearest(TRUE, TRUE); - //uv_test = preloadUIImage("uv_test2.tga", LLUUID::null, FALSE); - //uv_test->setClamp(FALSE, FALSE); - //uv_test->setMipFilterNearest(TRUE, TRUE); + //LLViewerFetchedTexture* uv_test = preloadUIImage("uv_test1.tga", LLUUID::null, false); + //uv_test->setClamp(false, false); + //uv_test->setMipFilterNearest(true, true); + //uv_test = preloadUIImage("uv_test2.tga", LLUUID::null, false); + //uv_test->setClamp(false, false); + //uv_test->setMipFilterNearest(true, true); LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTextureFromFile("silhouette.j2c", FTT_LOCAL_FILE, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI); if (image) @@ -198,9 +198,9 @@ void LLViewerTextureList::doPreloadImages() LLPointer<LLImageRaw> img_blak_square_tex(new LLImageRaw(2, 2, 3)); memset(img_blak_square_tex->getData(), 0, img_blak_square_tex->getDataSize()); - LLPointer<LLViewerFetchedTexture> img_blak_square(new LLViewerFetchedTexture(img_blak_square_tex, FTT_DEFAULT, FALSE)); + LLPointer<LLViewerFetchedTexture> img_blak_square(new LLViewerFetchedTexture(img_blak_square_tex, FTT_DEFAULT, false)); gBlackSquareID = img_blak_square->getID(); - img_blak_square->setUnremovable(TRUE); + img_blak_square->setUnremovable(true); addImage(img_blak_square, TEX_LIST_STANDARD); } @@ -241,7 +241,7 @@ void LLViewerTextureList::doPrefetchImages() LLViewerTextureManager::getFetchedTexture(IMG_SHOT); LLViewerTextureManager::getFetchedTexture(IMG_SMOKE_POOF); - LLViewerFetchedTexture::sSmokeImagep = LLViewerTextureManager::getFetchedTexture(IMG_SMOKE, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); + LLViewerFetchedTexture::sSmokeImagep = LLViewerTextureManager::getFetchedTexture(IMG_SMOKE, FTT_DEFAULT, true, LLGLTexture::BOOST_UI); LLViewerFetchedTexture::sSmokeImagep->setNoDelete(); LLStandardBumpmap::addstandard(); @@ -370,7 +370,7 @@ void LLViewerTextureList::shutdown() mImageList.clear(); - mInitialized = FALSE ; //prevent loading textures again. + mInitialized = false ; //prevent loading textures again. } void LLViewerTextureList::dump() @@ -391,7 +391,7 @@ void LLViewerTextureList::dump() } } -void LLViewerTextureList::destroyGL(BOOL save_state) +void LLViewerTextureList::destroyGL(bool save_state) { LLImageGL::destroyGL(save_state); } @@ -413,7 +413,7 @@ void LLViewerTextureList::restoreGL() LLViewerFetchedTexture* LLViewerTextureList::getImageFromFile(const std::string& filename, FTType f_type, - BOOL usemipmaps, + bool usemipmaps, LLViewerTexture::EBoostLevel boost_priority, S8 texture_type, LLGLint internal_format, @@ -431,7 +431,7 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromFile(const std::string& { LL_WARNS() << "Failed to find local image file: " << filename << LL_ENDL; LLViewerTexture::EBoostLevel priority = LLGLTexture::BOOST_UI; - return LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, FTT_DEFAULT, TRUE, priority); + return LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, FTT_DEFAULT, true, priority); } std::string url = "file://" + full_path; @@ -441,7 +441,7 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromFile(const std::string& LLViewerFetchedTexture* LLViewerTextureList::getImageFromUrl(const std::string& url, FTType f_type, - BOOL usemipmaps, + bool usemipmaps, LLViewerTexture::EBoostLevel boost_priority, S8 texture_type, LLGLint internal_format, @@ -528,10 +528,43 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromUrl(const std::string& return imagep; } +LLImageRaw* LLViewerTextureList::getRawImageFromMemory(const U8* data, U32 size, std::string_view mimetype) +{ + LLPointer<LLImageFormatted> image = LLImageFormatted::loadFromMemory(data, size, mimetype); + + if (image) + { + LLImageRaw* raw_image = new LLImageRaw(); + image->decode(raw_image, 0.f); + return raw_image; + } + else + { + return nullptr; + } +} + +LLViewerFetchedTexture* LLViewerTextureList::getImageFromMemory(const U8* data, U32 size, std::string_view mimetype) +{ + LLPointer<LLImageRaw> raw_image = getRawImageFromMemory(data, size, mimetype); + if (raw_image.notNull()) + { + LLViewerFetchedTexture* imagep = new LLViewerFetchedTexture(raw_image, FTT_LOCAL_FILE, true); + addImage(imagep, TEX_LIST_STANDARD); + + imagep->dontDiscard(); + imagep->setBoostLevel(LLViewerFetchedTexture::BOOST_PREVIEW); + return imagep; + } + else + { + return nullptr; + } +} LLViewerFetchedTexture* LLViewerTextureList::getImage(const LLUUID &image_id, FTType f_type, - BOOL usemipmaps, + bool usemipmaps, LLViewerTexture::EBoostLevel boost_priority, S8 texture_type, LLGLint internal_format, @@ -550,7 +583,7 @@ LLViewerFetchedTexture* LLViewerTextureList::getImage(const LLUUID &image_id, if (image_id.isNull()) { - return (LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI)); + return (LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, FTT_DEFAULT, true, LLGLTexture::BOOST_UI)); } LLPointer<LLViewerFetchedTexture> imagep = findImage(image_id, get_element_type(boost_priority)); @@ -588,7 +621,7 @@ LLViewerFetchedTexture* LLViewerTextureList::getImage(const LLUUID &image_id, //when this function is called, there is no such texture in the gTextureList with image_id. LLViewerFetchedTexture* LLViewerTextureList::createImage(const LLUUID &image_id, FTType f_type, - BOOL usemipmaps, + bool usemipmaps, LLViewerTexture::EBoostLevel boost_priority, S8 texture_type, LLGLint internal_format, @@ -641,8 +674,8 @@ LLViewerFetchedTexture* LLViewerTextureList::createImage(const LLUUID &image_id, imagep->forceActive() ; } - mFastCacheList.insert(imagep); - imagep->setInFastCacheList(true); + mFastCacheList.insert(imagep); + imagep->setInFastCacheList(true); return imagep ; } @@ -685,12 +718,12 @@ void LLViewerTextureList::addImageToList(LLViewerFetchedTexture *image) } else { - if((mImageList.insert(image)).second != true) - { + if (!(mImageList.insert(image)).second) + { LL_WARNS() << "Error happens when insert image " << image->getID() << " into mImageList!" << LL_ENDL ; + } + image->setInImageList(true); } - image->setInImageList(TRUE) ; -} } void LLViewerTextureList::removeImageFromList(LLViewerFetchedTexture *image) @@ -700,7 +733,7 @@ void LLViewerTextureList::removeImageFromList(LLViewerFetchedTexture *image) llassert_always(mInitialized) ; llassert(image); - S32 count = 0; + size_t count = 0; if (image->isInImageList()) { count = mImageList.erase(image) ; @@ -740,7 +773,7 @@ void LLViewerTextureList::removeImageFromList(LLViewerFetchedTexture *image) } } - image->setInImageList(FALSE) ; + image->setInImageList(false) ; } void LLViewerTextureList::addImage(LLViewerFetchedTexture *new_image, ETexListType tex_type) @@ -798,18 +831,18 @@ void LLViewerTextureList::dirtyImage(LLViewerFetchedTexture *image) void LLViewerTextureList::updateImages(F32 max_time) { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; - static BOOL cleared = FALSE; + static bool cleared = false; if(gTeleportDisplay) { if(!cleared) { clearFetchingRequests(); gPipeline.clearRebuildGroups(); - cleared = TRUE; + cleared = true; } return; } - cleared = FALSE; + cleared = false; LLAppViewer::getTextureFetch()->setTextureBandwidth(LLTrace::get_frame_recording().getPeriodMeanPerSec(LLStatViewer::TEXTURE_NETWORK_DATA_RECEIVED).value()); @@ -888,7 +921,7 @@ static void touch_texture(LLViewerFetchedTexture* tex, F32 vsize) } } -extern BOOL gCubeSnapshot; +extern bool gCubeSnapshot; void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imagep) { @@ -901,12 +934,14 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag llassert(!gCubeSnapshot); static LLCachedControl<F32> bias_distance_scale(gSavedSettings, "TextureBiasDistanceScale", 1.f); + static LLCachedControl<F32> texture_scale_min(gSavedSettings, "TextureScaleMinAreaFactor", 0.04f); + static LLCachedControl<F32> texture_scale_max(gSavedSettings, "TextureScaleMaxAreaFactor", 25.f); LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE { for (U32 i = 0; i < LLRender::NUM_TEXTURE_CHANNELS; ++i) { - for (U32 fi = 0; fi < imagep->getNumFaces(i); ++fi) + for (S32 fi = 0; fi < imagep->getNumFaces(i); ++fi) { LLFace* face = (*(imagep->getFaceList(i)))[fi]; @@ -914,27 +949,27 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag { F32 vsize = face->getPixelArea(); - // scale desired texture resolution higher or lower depending on texture scale + // Scale desired texture resolution higher or lower depending on texture scale + // + // Minimum usage examples: a 1024x1024 texture with aplhabet, runing string + // shows one letter at a time + // + // Maximum usage examples: huge chunk of terrain repeats texture const LLTextureEntry* te = face->getTextureEntry(); F32 min_scale = te ? llmin(fabsf(te->getScaleS()), fabsf(te->getScaleT())) : 1.f; - min_scale = llmax(min_scale*min_scale, 0.1f); + min_scale = llclamp(min_scale*min_scale, texture_scale_min(), texture_scale_max()); vsize /= min_scale; - -//#if LL_DARWIN -// vsize /= 1.f + LLViewerTexture::sDesiredDiscardBias*(1.f+face->getDrawable()->mDistanceWRTCamera*bias_distance_scale); -//#else vsize /= LLViewerTexture::sDesiredDiscardBias; vsize /= llmax(1.f, (LLViewerTexture::sDesiredDiscardBias-1.f) * (1.f + face->getDrawable()->mDistanceWRTCamera * bias_distance_scale)); F32 radius; F32 cos_angle_to_view_dir; - BOOL in_frustum = face->calcPixelArea(cos_angle_to_view_dir, radius); + bool in_frustum = face->calcPixelArea(cos_angle_to_view_dir, radius); if (!in_frustum || !face->getDrawable()->isVisible()) { // further reduce by discard bias when off screen or occluded vsize /= LLViewerTexture::sDesiredDiscardBias; } -//#endif // if a GLTF material is present, ignore that face // as far as this texture stats go, but update the GLTF material // stats @@ -1189,7 +1224,7 @@ void LLViewerTextureList::updateImagesUpdateStats() LLViewerFetchedTexture* imagep = *iter++; imagep->resetTextureStats(); } - mForceResetTextureStats = FALSE; + mForceResetTextureStats = false; } } @@ -1208,7 +1243,7 @@ void LLViewerTextureList::decodeAllImages(F32 max_time) { LLViewerFetchedTexture* imagep = *iter++; image_list.push_back(imagep); - imagep->setInImageList(FALSE) ; + imagep->setInImageList(false) ; } llassert_always(image_list.size() == mImageList.size()) ; @@ -1231,7 +1266,7 @@ void LLViewerTextureList::decodeAllImages(F32 max_time) } std::shared_ptr<LL::WorkQueue> main_queue = LLImageGLThread::sEnabledTextures ? LL::WorkQueue::getInstance("mainloop") : NULL; // Run threads - S32 fetch_pending = 0; + size_t fetch_pending = 0; while (1) { LLAppViewer::instance()->getTextureCache()->update(1); // unpauses the texture cache thread @@ -1273,6 +1308,8 @@ bool LLViewerTextureList::createUploadFile(LLPointer<LLImageRaw> raw_image, { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; + LLImageDataSharedLock lock(raw_image); + // make a copy, since convertToUploadFile scales raw image LLPointer<LLImageRaw> scale_image = new LLImageRaw( raw_image->getData(), @@ -1316,63 +1353,63 @@ bool LLViewerTextureList::createUploadFile(const std::string& filename, LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; try { - // Load the image - LLPointer<LLImageFormatted> image = LLImageFormatted::createFromType(codec); - if (image.isNull()) - { - LL_WARNS() << "Couldn't open the image to be uploaded." << LL_ENDL; - return false; - } - if (!image->load(filename)) - { - image->setLastError("Couldn't load the image to be uploaded."); - return false; - } - // Decompress or expand it in a raw image structure - LLPointer<LLImageRaw> raw_image = new LLImageRaw; - if (!image->decode(raw_image, 0.0f)) - { - image->setLastError("Couldn't decode the image to be uploaded."); - return false; - } - // Check the image constraints - if ((image->getComponents() != 3) && (image->getComponents() != 4)) - { - image->setLastError("Image files with less than 3 or more than 4 components are not supported."); - return false; - } - if (image->getWidth() < min_image_dimentions || image->getHeight() < min_image_dimentions) - { - std::string reason = llformat("Images below %d x %d pixels are not allowed. Actual size: %d x %dpx", - min_image_dimentions, - min_image_dimentions, - image->getWidth(), - image->getHeight()); - image->setLastError(reason); - return false; - } - // Convert to j2c (JPEG2000) and save the file locally - LLPointer<LLImageJ2C> compressedImage = convertToUploadFile(raw_image, max_image_dimentions, force_square); - if (compressedImage.isNull()) - { - image->setLastError("Couldn't convert the image to jpeg2000."); - LL_INFOS() << "Couldn't convert to j2c, file : " << filename << LL_ENDL; - return false; - } - if (!compressedImage->save(out_filename)) - { - image->setLastError("Couldn't create the jpeg2000 image for upload."); - LL_INFOS() << "Couldn't create output file : " << out_filename << LL_ENDL; - return false; - } - // Test to see if the encode and save worked - LLPointer<LLImageJ2C> integrity_test = new LLImageJ2C; - if (!integrity_test->loadAndValidate(out_filename)) - { - image->setLastError("The created jpeg2000 image is corrupt."); - LL_INFOS() << "Image file : " << out_filename << " is corrupt" << LL_ENDL; - return false; - } + // Load the image + LLPointer<LLImageFormatted> image = LLImageFormatted::createFromType(codec); + if (image.isNull()) + { + LL_WARNS() << "Couldn't open the image to be uploaded." << LL_ENDL; + return false; + } + if (!image->load(filename)) + { + image->setLastError("Couldn't load the image to be uploaded."); + return false; + } + // Decompress or expand it in a raw image structure + LLPointer<LLImageRaw> raw_image = new LLImageRaw; + if (!image->decode(raw_image, 0.0f)) + { + image->setLastError("Couldn't decode the image to be uploaded."); + return false; + } + // Check the image constraints + if ((image->getComponents() != 3) && (image->getComponents() != 4)) + { + image->setLastError("Image files with less than 3 or more than 4 components are not supported."); + return false; + } + if (image->getWidth() < min_image_dimentions || image->getHeight() < min_image_dimentions) + { + std::string reason = llformat("Images below %d x %d pixels are not allowed. Actual size: %d x %dpx", + min_image_dimentions, + min_image_dimentions, + image->getWidth(), + image->getHeight()); + image->setLastError(reason); + return false; + } + // Convert to j2c (JPEG2000) and save the file locally + LLPointer<LLImageJ2C> compressedImage = convertToUploadFile(raw_image, max_image_dimentions, force_square); + if (compressedImage.isNull()) + { + image->setLastError("Couldn't convert the image to jpeg2000."); + LL_INFOS() << "Couldn't convert to j2c, file : " << filename << LL_ENDL; + return false; + } + if (!compressedImage->save(out_filename)) + { + image->setLastError("Couldn't create the jpeg2000 image for upload."); + LL_INFOS() << "Couldn't create output file : " << out_filename << LL_ENDL; + return false; + } + // Test to see if the encode and save worked + LLPointer<LLImageJ2C> integrity_test = new LLImageJ2C; + if (!integrity_test->loadAndValidate( out_filename )) + { + image->setLastError("The created jpeg2000 image is corrupt."); + LL_INFOS() << "Image file : " << out_filename << " is corrupt" << LL_ENDL; + return false; + } } catch (...) { @@ -1386,6 +1423,8 @@ bool LLViewerTextureList::createUploadFile(const std::string& filename, LLPointer<LLImageJ2C> LLViewerTextureList::convertToUploadFile(LLPointer<LLImageRaw> raw_image, const S32 max_image_dimentions, bool force_square, bool force_lossless) { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; + LLImageDataLock lock(raw_image); + if (force_square) { S32 biggest_side = llmax(raw_image->getWidth(), raw_image->getHeight()); @@ -1403,7 +1442,7 @@ LLPointer<LLImageJ2C> LLViewerTextureList::convertToUploadFile(LLPointer<LLImage (gSavedSettings.getBOOL("LosslessJ2CUpload") && (raw_image->getWidth() * raw_image->getHeight() <= LL_IMAGE_REZ_LOSSLESS_CUTOFF * LL_IMAGE_REZ_LOSSLESS_CUTOFF))) { - compressedImage->setReversible(TRUE); + compressedImage->setReversible(true); } @@ -1479,7 +1518,7 @@ LLUIImagePtr LLUIImageList::getUIImageByID(const LLUUID& image_id, S32 priority) return found_it->second; } - const BOOL use_mips = FALSE; + const bool use_mips = false; const LLRect scale_rect = LLRect::null; const LLRect clip_rect = LLRect::null; return loadUIImageByID(image_id, use_mips, scale_rect, clip_rect, (LLViewerTexture::EBoostLevel)priority); @@ -1495,14 +1534,14 @@ LLUIImagePtr LLUIImageList::getUIImage(const std::string& image_name, S32 priori return found_it->second; } - const BOOL use_mips = FALSE; + const bool use_mips = false; const LLRect scale_rect = LLRect::null; const LLRect clip_rect = LLRect::null; return loadUIImageByName(image_name, image_name, use_mips, scale_rect, clip_rect, (LLViewerTexture::EBoostLevel)priority); } LLUIImagePtr LLUIImageList::loadUIImageByName(const std::string& name, const std::string& filename, - BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLViewerTexture::EBoostLevel boost_priority, + bool use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLViewerTexture::EBoostLevel boost_priority, LLUIImage::EScaleStyle scale_style) { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; @@ -1515,7 +1554,7 @@ LLUIImagePtr LLUIImageList::loadUIImageByName(const std::string& name, const std } LLUIImagePtr LLUIImageList::loadUIImageByID(const LLUUID& id, - BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLViewerTexture::EBoostLevel boost_priority, + bool use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLViewerTexture::EBoostLevel boost_priority, LLUIImage::EScaleStyle scale_style) { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; @@ -1527,7 +1566,7 @@ LLUIImagePtr LLUIImageList::loadUIImageByID(const LLUUID& id, return loadUIImage(imagep, id.asString(), use_mips, scale_rect, clip_rect, scale_style); } -LLUIImagePtr LLUIImageList::loadUIImage(LLViewerFetchedTexture* imagep, const std::string& name, BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, +LLUIImagePtr LLUIImageList::loadUIImage(LLViewerFetchedTexture* imagep, const std::string& name, bool use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLUIImage::EScaleStyle scale_style) { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; @@ -1562,12 +1601,12 @@ LLUIImagePtr LLUIImageList::loadUIImage(LLViewerFetchedTexture* imagep, const st datap->mImageScaleRegion = scale_rect; datap->mImageClipRegion = clip_rect; - imagep->setLoadedCallback(onUIImageLoaded, 0, FALSE, FALSE, datap, NULL); + imagep->setLoadedCallback(onUIImageLoaded, 0, false, false, datap, NULL); } return new_imagep; } -LLUIImagePtr LLUIImageList::preloadUIImage(const std::string& name, const std::string& filename, BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLUIImage::EScaleStyle scale_style) +LLUIImagePtr LLUIImageList::preloadUIImage(const std::string& name, const std::string& filename, bool use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLUIImage::EScaleStyle scale_style) { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; // look for existing image @@ -1582,7 +1621,7 @@ LLUIImagePtr LLUIImageList::preloadUIImage(const std::string& name, const std::s } //static -void LLUIImageList::onUIImageLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, BOOL final, void* user_data ) +void LLUIImageList::onUIImageLoaded( bool success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, bool final, void* user_data ) { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; if(!success || !user_data) diff --git a/indra/newview/llviewertexturelist.h b/indra/newview/llviewertexturelist.h index 5a38eddfd3..e4ebb7b0e8 100644 --- a/indra/newview/llviewertexturelist.h +++ b/indra/newview/llviewertexturelist.h @@ -38,25 +38,25 @@ const U32 LL_IMAGE_REZ_LOSSLESS_CUTOFF = 128; -const BOOL MIPMAP_YES = TRUE; -const BOOL MIPMAP_NO = FALSE; +const bool MIPMAP_YES = true; +const bool MIPMAP_NO = false; -const BOOL GL_TEXTURE_YES = TRUE; -const BOOL GL_TEXTURE_NO = FALSE; +const bool GL_TEXTURE_YES = true; +const bool GL_TEXTURE_NO = false; -const BOOL IMMEDIATE_YES = TRUE; -const BOOL IMMEDIATE_NO = FALSE; +const bool IMMEDIATE_YES = true; +const bool IMMEDIATE_NO = false; class LLImageJ2C; class LLMessageSystem; class LLTextureView; -typedef void (*LLImageCallback)(BOOL success, +typedef void (*LLImageCallback)(bool success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, - BOOL final, + bool final, void* userdata); enum ETexListType @@ -115,9 +115,9 @@ public: void init(); void shutdown(); void dump(); - void destroyGL(BOOL save_state = TRUE); + void destroyGL(bool save_state = true); void restoreGL(); - BOOL isInitialized() const {return mInitialized;} + bool isInitialized() const {return mInitialized;} void findTexturesByID(const LLUUID &image_id, std::vector<LLViewerFetchedTexture*> &output); LLViewerFetchedTexture *findImage(const LLUUID &image_id, ETexListType tex_type); @@ -134,7 +134,7 @@ public: void handleIRCallback(void **data, const S32 number); - S32 getNumImages() { return mImageList.size(); } + S32 getNumImages() { return static_cast<S32>(mImageList.size()); } // Local UI images // Local UI images @@ -164,7 +164,7 @@ private: LLViewerFetchedTexture * getImage(const LLUUID &image_id, FTType f_type = FTT_DEFAULT, - BOOL usemipmap = TRUE, + bool usemipmap = true, LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, // Get the requested level immediately upon creation. S8 texture_type = LLViewerTexture::FETCHED_TEXTURE, LLGLint internal_format = 0, @@ -174,7 +174,7 @@ private: LLViewerFetchedTexture * getImageFromFile(const std::string& filename, FTType f_type = FTT_LOCAL_FILE, - BOOL usemipmap = TRUE, + bool usemipmap = true, LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, // Get the requested level immediately upon creation. S8 texture_type = LLViewerTexture::FETCHED_TEXTURE, LLGLint internal_format = 0, @@ -184,7 +184,7 @@ private: LLViewerFetchedTexture* getImageFromUrl(const std::string& url, FTType f_type, - BOOL usemipmap = TRUE, + bool usemipmap = true, LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, // Get the requested level immediately upon creation. S8 texture_type = LLViewerTexture::FETCHED_TEXTURE, LLGLint internal_format = 0, @@ -192,9 +192,12 @@ private: const LLUUID& force_id = LLUUID::null ); + LLImageRaw* getRawImageFromMemory(const U8* data, U32 size, std::string_view mimetype); + LLViewerFetchedTexture* getImageFromMemory(const U8* data, U32 size, std::string_view mimetype); + LLViewerFetchedTexture* createImage(const LLUUID &image_id, FTType f_type, - BOOL usemipmap = TRUE, + bool usemipmap = true, LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, // Get the requested level immediately upon creation. S8 texture_type = LLViewerTexture::FETCHED_TEXTURE, LLGLint internal_format = 0, @@ -205,7 +208,7 @@ private: // Request image from a specific host, used for baked avatar textures. // Implemented in header in case someone changes default params above. JC LLViewerFetchedTexture* getImageFromHost(const LLUUID& image_id, FTType f_type, LLHost host) - { return getImage(image_id, f_type, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); } + { return getImage(image_id, f_type, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); } public: typedef std::set<LLPointer<LLViewerFetchedTexture> > image_list_t; @@ -217,7 +220,7 @@ public: // Note: just raw pointers because they are never referenced, just compared against std::set<LLViewerFetchedTexture*> mDirtyTextureList; - BOOL mForceResetTextureStats; + bool mForceResetTextureStats; private: typedef std::map< LLTextureKey, LLPointer<LLViewerFetchedTexture> > uuid_map_t; @@ -230,7 +233,7 @@ private: // simply holds on to LLViewerFetchedTexture references to stop them from being purged too soon std::set<LLPointer<LLViewerFetchedTexture> > mImagePreloads; - BOOL mInitialized ; + bool mInitialized ; LLFrameTimer mForceDecodeTimer; private: @@ -250,22 +253,22 @@ public: bool initFromFile(); - LLPointer<LLUIImage> preloadUIImage(const std::string& name, const std::string& filename, BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLUIImage::EScaleStyle stype); + LLPointer<LLUIImage> preloadUIImage(const std::string& name, const std::string& filename, bool use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLUIImage::EScaleStyle stype); - static void onUIImageLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, BOOL final, void* userdata ); + static void onUIImageLoaded( bool success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, bool final, void* userdata ); private: LLPointer<LLUIImage> loadUIImageByName(const std::string& name, const std::string& filename, - BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null, + bool use_mips = false, const LLRect& scale_rect = LLRect::null, const LLRect& clip_rect = LLRect::null, LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_UI, LLUIImage::EScaleStyle = LLUIImage::SCALE_INNER); LLPointer<LLUIImage> loadUIImageByID(const LLUUID& id, - BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null, + bool use_mips = false, const LLRect& scale_rect = LLRect::null, const LLRect& clip_rect = LLRect::null, LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_UI, LLUIImage::EScaleStyle = LLUIImage::SCALE_INNER); - LLPointer<LLUIImage> loadUIImage(LLViewerFetchedTexture* imagep, const std::string& name, BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null, const LLRect& clip_rect = LLRect::null, LLUIImage::EScaleStyle = LLUIImage::SCALE_INNER); + LLPointer<LLUIImage> loadUIImage(LLViewerFetchedTexture* imagep, const std::string& name, bool use_mips = false, const LLRect& scale_rect = LLRect::null, const LLRect& clip_rect = LLRect::null, LLUIImage::EScaleStyle = LLUIImage::SCALE_INNER); struct LLUIImageLoadData @@ -284,10 +287,10 @@ private: std::list< LLPointer<LLViewerFetchedTexture> > mUITextureList ; }; -const BOOL GLTEXTURE_TRUE = TRUE; -const BOOL GLTEXTURE_FALSE = FALSE; -const BOOL MIPMAP_TRUE = TRUE; -const BOOL MIPMAP_FALSE = FALSE; +const bool GLTEXTURE_TRUE = true; +const bool GLTEXTURE_FALSE = false; +const bool MIPMAP_TRUE = true; +const bool MIPMAP_FALSE = false; extern LLViewerTextureList gTextureList; diff --git a/indra/newview/llviewerthrottle.cpp b/indra/newview/llviewerthrottle.cpp index 8482bc603b..b0a00c29a4 100644 --- a/indra/newview/llviewerthrottle.cpp +++ b/indra/newview/llviewerthrottle.cpp @@ -207,7 +207,7 @@ LLViewerThrottle::LLViewerThrottle() : } -void LLViewerThrottle::setMaxBandwidth(F32 kbits_per_second, BOOL from_event) +void LLViewerThrottle::setMaxBandwidth(F32 kbits_per_second, bool from_event) { if (!from_event) { @@ -246,9 +246,9 @@ LLViewerThrottleGroup LLViewerThrottle::getThrottleGroup(const F32 bandwidth_kbp //Clamp the bandwidth users can set. F32 set_bandwidth = llclamp(bandwidth_kbps, MIN_BANDWIDTH, MAX_BANDWIDTH); - S32 count = mPresets.size(); + auto count = mPresets.size(); - S32 i; + size_t i; for (i = 0; i < count; i++) { if (mPresets[i].getTotal() > set_bandwidth) diff --git a/indra/newview/llviewerthrottle.h b/indra/newview/llviewerthrottle.h index 5a690139e9..28a24d04fc 100644 --- a/indra/newview/llviewerthrottle.h +++ b/indra/newview/llviewerthrottle.h @@ -58,7 +58,7 @@ class LLViewerThrottle public: LLViewerThrottle(); - void setMaxBandwidth(F32 kbits_per_second, BOOL from_event = FALSE); + void setMaxBandwidth(F32 kbits_per_second, bool from_event = false); void load(); void save() const; diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp index bf87d52d19..583fb25330 100644 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -74,7 +74,7 @@ static std::string asset_id_to_filename(const LLUUID &asset_id, const ELLPath di LLViewerWearable::LLViewerWearable(const LLTransactionID& transaction_id) : LLWearable(), - mVolatile(FALSE) + mVolatile(false) { mTransactionID = transaction_id; mAssetID = mTransactionID.makeAssetID(gAgent.getSecureSessionID()); @@ -82,7 +82,7 @@ LLViewerWearable::LLViewerWearable(const LLTransactionID& transaction_id) : LLViewerWearable::LLViewerWearable(const LLAssetID& asset_id) : LLWearable(), - mVolatile(FALSE) + mVolatile(false) { mAssetID = asset_id; mTransactionID.setNull(); @@ -128,7 +128,7 @@ LLWearable::EImportResult LLViewerWearable::importStream( std::istream& input_st LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture( textureid ); if(gSavedSettings.getBOOL("DebugAvatarLocalTexLoadedTime")) { - image->setLoadedCallback(LLVOAvatarSelf::debugOnTimingLocalTexLoaded,0,TRUE,FALSE, new LLVOAvatarSelf::LLAvatarTexData(textureid, (LLAvatarAppearanceDefines::ETextureIndex)te), NULL); + image->setLoadedCallback(LLVOAvatarSelf::debugOnTimingLocalTexLoaded,0,true,false, new LLVOAvatarSelf::LLAvatarTexData(textureid, (LLAvatarAppearanceDefines::ETextureIndex)te), NULL); } } @@ -139,9 +139,9 @@ LLWearable::EImportResult LLViewerWearable::importStream( std::istream& input_st // Avatar parameter and texture definitions can change over time. // This function returns true if parameters or textures have been added or removed // since this wearable was created. -BOOL LLViewerWearable::isOldVersion() const +bool LLViewerWearable::isOldVersion() const { - if (!isAgentAvatarValid()) return FALSE; + if (!isAgentAvatarValid()) return false; if( LLWearable::sCurrentDefinitionVersion < mDefinitionVersion ) { @@ -151,7 +151,7 @@ BOOL LLViewerWearable::isOldVersion() const if( LLWearable::sCurrentDefinitionVersion != mDefinitionVersion ) { - return TRUE; + return true; } S32 param_count = 0; @@ -164,13 +164,13 @@ BOOL LLViewerWearable::isOldVersion() const param_count++; if( !is_in_map(mVisualParamIndexMap, param->getID() ) ) { - return TRUE; + return true; } } } if( param_count != mVisualParamIndexMap.size() ) { - return TRUE; + return true; } @@ -182,16 +182,16 @@ BOOL LLViewerWearable::isOldVersion() const te_count++; if( !is_in_map(mTEMap, te ) ) { - return TRUE; + return true; } } } if( te_count != mTEMap.size() ) { - return TRUE; + return true; } - return FALSE; + return false; } // Avatar parameter and texture definitions can change over time. @@ -201,9 +201,9 @@ BOOL LLViewerWearable::isOldVersion() const // * If parameters or textures have been ADDED since the wearable was created, // they are taken to have default values, so we consider the wearable clean // only if those values are the same as the defaults. -BOOL LLViewerWearable::isDirty() const +bool LLViewerWearable::isDirty() const { - if (!isAgentAvatarValid()) return FALSE; + if (!isAgentAvatarValid()) return false; for( LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); param; @@ -222,7 +222,7 @@ BOOL LLViewerWearable::isDirty() const U8 b = F32_to_U8( current_weight, param->getMinWeight(), param->getMaxWeight() ); if( a != b ) { - return TRUE; + return true; } } } @@ -242,19 +242,19 @@ BOOL LLViewerWearable::isDirty() const if (saved_image_id != current_image_id) { // saved vs current images are different, wearable is dirty - return TRUE; + return true; } } else { // image found in current image list but not saved image list - return TRUE; + return true; } } } } - return FALSE; + return false; } @@ -342,7 +342,7 @@ void LLViewerWearable::writeToAvatar(LLAvatarAppearance *avatarp) { image_id = getDefaultTextureImageID((ETextureIndex) te); } - LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture( image_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE ); + LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture( image_id, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE ); // MULTI-WEARABLE: assume index 0 will be used when writing to avatar. TODO: eliminate the need for this. viewer_avatar->setLocalTextureTE(te, image, 0); } diff --git a/indra/newview/llviewerwearable.h b/indra/newview/llviewerwearable.h index 15feab0a57..233c65aefb 100644 --- a/indra/newview/llviewerwearable.h +++ b/indra/newview/llviewerwearable.h @@ -58,8 +58,8 @@ public: public: - BOOL isDirty() const; - BOOL isOldVersion() const; + bool isDirty() const; + bool isOldVersion() const; /*virtual*/ void writeToAvatar(LLAvatarAppearance *avatarp); void removeFromAvatar() { LLViewerWearable::removeFromAvatar( mType); } @@ -69,8 +69,8 @@ public: void setParamsToDefaults(); void setTexturesToDefaults(); - void setVolatile(BOOL is_volatile) { mVolatile = is_volatile; } // TRUE when doing preview renders, some updates will be suppressed. - BOOL getVolatile() { return mVolatile; } + void setVolatile(bool is_volatile) { mVolatile = is_volatile; } // true when doing preview renders, some updates will be suppressed. + bool getVolatile() { return mVolatile; } /*virtual*/ LLUUID getDefaultTextureImageID(LLAvatarAppearanceDefines::ETextureIndex index) const; @@ -98,7 +98,7 @@ protected: LLAssetID mAssetID; LLTransactionID mTransactionID; - BOOL mVolatile; // True when rendering preview images. Can suppress some updates. + bool mVolatile; // True when rendering preview images. Can suppress some updates. LLUUID mItemID; // ID of the inventory item in the agent's inventory }; diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index e7caf777f5..f842e1f74c 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -224,19 +224,19 @@ void render_ui(F32 zoom_factor = 1.f, int subfield = 0); void swap(); -extern BOOL gDebugClicks; -extern BOOL gDisplaySwapBuffers; -extern BOOL gDepthDirty; -extern BOOL gResizeScreenTexture; -extern BOOL gCubeSnapshot; -extern BOOL gSnapshotNoPost; +extern bool gDebugClicks; +extern bool gDisplaySwapBuffers; +extern bool gDepthDirty; +extern bool gResizeScreenTexture; +extern bool gCubeSnapshot; +extern bool gSnapshotNoPost; LLViewerWindow *gViewerWindow = NULL; LLFrameTimer gAwayTimer; LLFrameTimer gAwayTriggerTimer; -BOOL gShowOverlayTitle = FALSE; +bool gShowOverlayTitle = false; LLViewerObject* gDebugRaycastObject = NULL; LLVOPartGroup* gDebugRaycastParticle = NULL; @@ -252,13 +252,13 @@ LLVector4a gDebugRaycastStart; LLVector4a gDebugRaycastEnd; // HUD display lines in lower right -BOOL gDisplayWindInfo = FALSE; -BOOL gDisplayCameraPos = FALSE; -BOOL gDisplayFOV = FALSE; -BOOL gDisplayBadge = FALSE; +bool gDisplayWindInfo = false; +bool gDisplayCameraPos = false; +bool gDisplayFOV = false; +bool gDisplayBadge = false; static const U8 NO_FACE = 255; -BOOL gQuietSnapshot = FALSE; +bool gQuietSnapshot = false; // Minimum value for UIScaleFactor, also defined in preferences, ui_scale_slider static const F32 MIN_UI_SCALE = 0.75f; @@ -293,7 +293,7 @@ public: // chat.mText = message; // chat.mSourceType = CHAT_SOURCE_SYSTEM; - // chat_floater->addChat(chat, FALSE, FALSE); + // chat_floater->addChat(chat, false, false); //} //} } @@ -618,7 +618,7 @@ public: LLViewerRegion* region = gAgent.getRegion(); if (region) { - for (U32 i = 0; i < gObjectList.getNumObjects(); ++i) + for (S32 i = 0; i < gObjectList.getNumObjects(); ++i) { LLViewerObject* object = gObjectList.getObject(i); if (object && @@ -998,7 +998,7 @@ void LLViewerWindow::handlePieMenu(S32 x, S32 y, MASK mask) } } -BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mask, EMouseClickType clicktype, BOOL down, bool& is_toolmgr_action) +bool LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mask, EMouseClickType clicktype, bool down, bool& is_toolmgr_action) { const char* buttonname = ""; const char* buttonstatestr = ""; @@ -1090,7 +1090,7 @@ BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK m LL_INFOS() << buttonname << " Mouse " << buttonstatestr << " handled by captor " << mouse_captor->getName() << LL_ENDL; } - BOOL r = mouse_captor->handleAnyMouseClick(local_x, local_y, mask, clicktype, down); + bool r = mouse_captor->handleAnyMouseClick(local_x, local_y, mask, clicktype, down); if (r) { LL_DEBUGS() << "LLViewerWindow::handleAnyMouseClick viewer with mousecaptor calling updatemouseeventinfo - local_x|global x "<< local_x << " " << x << "local/global y " << local_y << " " << y << LL_ENDL; @@ -1102,7 +1102,7 @@ BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK m else if (down && clicktype == CLICK_RIGHT) { handlePieMenu(x, y, mask); - r = TRUE; + r = true; } return r; } @@ -1110,11 +1110,11 @@ BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK m // Mark the click as handled and return if we aren't within the root view to avoid spurious bugs if( !mRootView->pointInView(x, y) ) { - return TRUE; + return true; } // Give the UI views a chance to process the click - BOOL r= mRootView->handleAnyMouseClick(x, y, mask, clicktype, down) ; + bool r= mRootView->handleAnyMouseClick(x, y, mask, clicktype, down) ; if (r) { @@ -1136,7 +1136,7 @@ BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK m { LL_INFOS() << buttonname << " Mouse " << buttonstatestr << " " << LLViewerEventRecorder::instance().get_xui() << LL_ENDL; } - return TRUE; + return true; } else if (LLView::sDebugMouseHandling) { LL_INFOS() << buttonname << " Mouse " << buttonstatestr << " not handled by view" << LL_ENDL; @@ -1148,24 +1148,24 @@ BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK m { LLViewerEventRecorder::instance().clear_xui(); is_toolmgr_action = true; - return TRUE; + return true; } if (down && clicktype == CLICK_RIGHT) { handlePieMenu(x, y, mask); - return TRUE; + return true; } // If we got this far on a down-click, it wasn't handled. // Up-clicks, though, are always handled as far as the OS is concerned. - BOOL default_rtn = !down; + bool default_rtn = !down; return default_rtn; } -BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask) +bool LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask) { - mAllowMouseDragging = FALSE; + mAllowMouseDragging = false; if (!mMouseDownTimer.getStarted()) { mMouseDownTimer.start(); @@ -1174,51 +1174,51 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask { mMouseDownTimer.reset(); } - BOOL down = TRUE; + bool down = true; //handleMouse() loops back to LLViewerWindow::handleAnyMouseClick return gViewerInput.handleMouse(window, pos, mask, CLICK_LEFT, down); } -BOOL LLViewerWindow::handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK mask) +bool LLViewerWindow::handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK mask) { // try handling as a double-click first, then a single-click if that // wasn't handled. - BOOL down = TRUE; + bool down = true; if (gViewerInput.handleMouse(window, pos, mask, CLICK_DOUBLELEFT, down)) { - return TRUE; + return true; } return handleMouseDown(window, pos, mask); } -BOOL LLViewerWindow::handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) +bool LLViewerWindow::handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) { if (mMouseDownTimer.getStarted()) { mMouseDownTimer.stop(); } - BOOL down = FALSE; + bool down = false; return gViewerInput.handleMouse(window, pos, mask, CLICK_LEFT, down); } -BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK mask) +bool LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK mask) { - BOOL down = TRUE; + bool down = true; return gViewerInput.handleMouse(window, pos, mask, CLICK_RIGHT, down); } -BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) +bool LLViewerWindow::handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) { - BOOL down = FALSE; + bool down = false; return gViewerInput.handleMouse(window, pos, mask, CLICK_RIGHT, down); } -BOOL LLViewerWindow::handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask) +bool LLViewerWindow::handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask) { - BOOL down = TRUE; + bool down = true; gViewerInput.handleMouse(window, pos, mask, CLICK_MIDDLE, down); // Always handled as far as the OS is concerned. - return TRUE; + return true; } LLWindowCallbacks::DragNDropResult LLViewerWindow::handleDragNDrop( LLWindow *window, LLCoordGL pos, MASK mask, LLWindowCallbacks::DragNDropAction action, std::string data) @@ -1256,8 +1256,8 @@ LLWindowCallbacks::DragNDropResult LLViewerWindow::handleDragNDrop( LLWindow *wi if (prim_media_dnd_enabled) { LLPickInfo pick_info = pickImmediate( pos.mX, pos.mY, - TRUE /* pick_transparent */, - FALSE /* pick_rigged */); + true /* pick_transparent */, + false /* pick_rigged */); S32 object_face = pick_info.mObjectFace; std::string url = data; @@ -1366,16 +1366,16 @@ LLWindowCallbacks::DragNDropResult LLViewerWindow::handleDragNDrop( LLWindow *wi return result; } -BOOL LLViewerWindow::handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) +bool LLViewerWindow::handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) { - BOOL down = FALSE; + bool down = false; gViewerInput.handleMouse(window, pos, mask, CLICK_MIDDLE, down); // Always handled as far as the OS is concerned. - return TRUE; + return true; } -BOOL LLViewerWindow::handleOtherMouse(LLWindow *window, LLCoordGL pos, MASK mask, S32 button, bool down) +bool LLViewerWindow::handleOtherMouse(LLWindow *window, LLCoordGL pos, MASK mask, S32 button, bool down) { switch (button) { @@ -1390,17 +1390,17 @@ BOOL LLViewerWindow::handleOtherMouse(LLWindow *window, LLCoordGL pos, MASK mask } // Always handled as far as the OS is concerned. - return TRUE; + return true; } -BOOL LLViewerWindow::handleOtherMouseDown(LLWindow *window, LLCoordGL pos, MASK mask, S32 button) +bool LLViewerWindow::handleOtherMouseDown(LLWindow *window, LLCoordGL pos, MASK mask, S32 button) { - return handleOtherMouse(window, pos, mask, button, TRUE); + return handleOtherMouse(window, pos, mask, button, true); } -BOOL LLViewerWindow::handleOtherMouseUp(LLWindow *window, LLCoordGL pos, MASK mask, S32 button) +bool LLViewerWindow::handleOtherMouseUp(LLWindow *window, LLCoordGL pos, MASK mask, S32 button) { - return handleOtherMouse(window, pos, mask, button, FALSE); + return handleOtherMouse(window, pos, mask, button, false); } // WARNING: this is potentially called multiple times per frame @@ -1412,7 +1412,7 @@ void LLViewerWindow::handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask x = ll_round((F32)x / mDisplayScale.mV[VX]); y = ll_round((F32)y / mDisplayScale.mV[VY]); - mMouseInWindow = TRUE; + mMouseInWindow = true; // Save mouse point for access during idle() and display() @@ -1440,7 +1440,7 @@ void LLViewerWindow::handleMouseDragged(LLWindow *window, LLCoordGL pos, MASK m { if (mMouseDownTimer.getElapsedTimeF32() > 0.1) { - mAllowMouseDragging = TRUE; + mAllowMouseDragging = true; mMouseDownTimer.stop(); } } @@ -1454,17 +1454,17 @@ void LLViewerWindow::handleMouseLeave(LLWindow *window) { // Note: we won't get this if we have captured the mouse. llassert( gFocusMgr.getMouseCapture() == NULL ); - mMouseInWindow = FALSE; + mMouseInWindow = false; LLToolTipMgr::instance().blockToolTips(); } -BOOL LLViewerWindow::handleCloseRequest(LLWindow *window) +bool LLViewerWindow::handleCloseRequest(LLWindow *window) { // User has indicated they want to close, but we may need to ask // about modified documents. LLAppViewer::instance()->userQuit(); // Don't quit immediately - return FALSE; + return false; } void LLViewerWindow::handleQuit(LLWindow *window) @@ -1489,7 +1489,7 @@ void LLViewerWindow::handleResize(LLWindow *window, S32 width, S32 height) // The top-level window has gained focus (e.g. via ALT-TAB) void LLViewerWindow::handleFocus(LLWindow *window) { - gFocusMgr.setAppHasFocus(TRUE); + gFocusMgr.setAppHasFocus(true); LLModalDialog::onAppFocusGained(); gAgent.onAppFocusGained(); @@ -1509,7 +1509,7 @@ void LLViewerWindow::handleFocus(LLWindow *window) // The top-level window has lost focus (e.g. via ALT-TAB) void LLViewerWindow::handleFocusLost(LLWindow *window) { - gFocusMgr.setAppHasFocus(FALSE); + gFocusMgr.setAppHasFocus(false); //LLModalDialog::onAppFocusLost(); LLToolMgr::getInstance()->onAppFocusLost(); gFocusMgr.setMouseCapture( NULL ); @@ -1522,7 +1522,7 @@ void LLViewerWindow::handleFocusLost(LLWindow *window) // restore mouse cursor showCursor(); - getWindow()->setMouseClipping(FALSE); + getWindow()->setMouseClipping(false); // If losing focus while keys are down, handle them as // an 'up' to correctly release states, then reset states @@ -1537,7 +1537,7 @@ void LLViewerWindow::handleFocusLost(LLWindow *window) } -BOOL LLViewerWindow::handleTranslatedKeyDown(KEY key, MASK mask, BOOL repeated) +bool LLViewerWindow::handleTranslatedKeyDown(KEY key, MASK mask, bool repeated) { // Handle non-consuming global keybindings, like voice // Never affects event processing. @@ -1558,14 +1558,14 @@ BOOL LLViewerWindow::handleTranslatedKeyDown(KEY key, MASK mask, BOOL repeated) // would like to know about the KEYDOWN for an enter key... so ask and pass it along. LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus(); if (keyboard_focus && !keyboard_focus->wantsReturnKey()) - return FALSE; + return false; } // remaps, handles ignored cases and returns back to viewer window. return gViewerInput.handleKey(key, mask, repeated); } -BOOL LLViewerWindow::handleTranslatedKeyUp(KEY key, MASK mask) +bool LLViewerWindow::handleTranslatedKeyUp(KEY key, MASK mask) { // Handle non-consuming global keybindings, like voice // Never affects event processing. @@ -1581,7 +1581,7 @@ BOOL LLViewerWindow::handleTranslatedKeyUp(KEY key, MASK mask) return gViewerInput.handleKeyUp(key, mask); } -void LLViewerWindow::handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level) +void LLViewerWindow::handleScanKey(KEY key, bool key_down, bool key_up, bool key_level) { LLViewerJoystick::getInstance()->setCameraNeedsUpdate(true); gViewerInput.scanKey(key, key_down, key_up, key_level); @@ -1591,7 +1591,7 @@ void LLViewerWindow::handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key -BOOL LLViewerWindow::handleActivate(LLWindow *window, BOOL activated) +bool LLViewerWindow::handleActivate(LLWindow *window, bool activated) { if (activated) { @@ -1623,15 +1623,15 @@ BOOL LLViewerWindow::handleActivate(LLWindow *window, BOOL activated) // Mute audio audio_update_volume(); } - return TRUE; + return true; } -BOOL LLViewerWindow::handleActivateApp(LLWindow *window, BOOL activating) +bool LLViewerWindow::handleActivateApp(LLWindow *window, bool activating) { //if (!activating) gAgentCamera.changeCameraToDefault(); LLViewerJoystick::getInstance()->setNeedsReset(true); - return FALSE; + return false; } @@ -1640,7 +1640,7 @@ void LLViewerWindow::handleMenuSelect(LLWindow *window, S32 menu_item) } -BOOL LLViewerWindow::handlePaint(LLWindow *window, S32 x, S32 y, S32 width, S32 height) +bool LLViewerWindow::handlePaint(LLWindow *window, S32 x, S32 y, S32 width, S32 height) { // *TODO: Enable similar information output for other platforms? DK 2011-02-18 #if LL_WINDOWS @@ -1666,21 +1666,21 @@ BOOL LLViewerWindow::handlePaint(LLWindow *window, S32 x, S32 y, S32 width, S recording.getPerSec(LLStatViewer::FPS), //mFPSStat.getMeanPerSec(), recording.getLastValue(LLStatViewer::SIM_PHYSICS_FPS), recording.getLastValue(LLStatViewer::SIM_TIME_DILATION)); - S32 len = temp_str.length(); + int len = static_cast<int>(temp_str.length()); TextOutA(hdc, 0, 0, temp_str.c_str(), len); LLVector3d pos_global = gAgent.getPositionGlobal(); temp_str = llformat( "Avatar pos %6.1lf %6.1lf %6.1lf", pos_global.mdV[0], pos_global.mdV[1], pos_global.mdV[2]); - len = temp_str.length(); + len = static_cast<S32>(temp_str.length()); TextOutA(hdc, 0, 25, temp_str.c_str(), len); TextOutA(hdc, 0, 50, "Set \"HeadlessClient FALSE\" in settings.ini file to reenable", 61); EndPaint(window_handle, &ps); - return TRUE; + return true; } #endif - return FALSE; + return false; } @@ -1724,49 +1724,49 @@ void LLViewerWindow::handleDataCopy(LLWindow *window, S32 data_type, void *data) } } -BOOL LLViewerWindow::handleTimerEvent(LLWindow *window) +bool LLViewerWindow::handleTimerEvent(LLWindow *window) { //TODO: just call this every frame from gatherInput instead of using a convoluted 30fps timer callback if (LLViewerJoystick::getInstance()->getOverrideCamera()) { LLViewerJoystick::getInstance()->updateStatus(); - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLViewerWindow::handleDeviceChange(LLWindow *window) +bool LLViewerWindow::handleDeviceChange(LLWindow *window) { // give a chance to use a joystick after startup (hot-plugging) if (!LLViewerJoystick::getInstance()->isJoystickInitialized() ) { LLViewerJoystick::getInstance()->init(true); - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLViewerWindow::handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32 window_width, S32 window_height) +bool LLViewerWindow::handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32 window_width, S32 window_height) { if (ui_scale_factor >= MIN_UI_SCALE && ui_scale_factor <= MAX_UI_SCALE) { LLViewerWindow::reshape(window_width, window_height); mResDirty = true; - return TRUE; + return true; } else { LL_WARNS() << "DPI change caused UI scale to go out of bounds: " << ui_scale_factor << LL_ENDL; - return FALSE; + return false; } } -BOOL LLViewerWindow::handleWindowDidChangeScreen(LLWindow *window) +bool LLViewerWindow::handleWindowDidChangeScreen(LLWindow *window) { LLCoordScreen window_rect; mWindow->getSize(&window_rect); reshape(window_rect.mX, window_rect.mY); - return TRUE; + return true; } void LLViewerWindow::handlePingWatchdog(LLWindow *window, const char * msg) @@ -1817,17 +1817,17 @@ LLViewerWindow::LLViewerWindow(const Params& p) mWindowRectRaw(0, p.height, p.width, 0), mWindowRectScaled(0, p.height, p.width, 0), mWorldViewRectRaw(0, p.height, p.width, 0), - mLeftMouseDown(FALSE), - mMiddleMouseDown(FALSE), - mRightMouseDown(FALSE), - mMouseInWindow( FALSE ), - mAllowMouseDragging(TRUE), + mLeftMouseDown(false), + mMiddleMouseDown(false), + mRightMouseDown(false), + mMouseInWindow( false ), + mAllowMouseDragging(true), mMouseDownTimer(), mLastMask( MASK_NONE ), mToolStored( NULL ), - mHideCursorPermanent( FALSE ), - mCursorHidden(FALSE), - mIgnoreActivate( FALSE ), + mHideCursorPermanent( false ), + mCursorHidden(false), + mIgnoreActivate( false ), mResDirty(false), mStatesDirty(false), mCurrResolutionIndex(0), @@ -1856,16 +1856,15 @@ LLViewerWindow::LLViewerWindow(const Params& p) /* LLWindowCallbacks* callbacks, const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, U32 flags, - BOOL fullscreen, - BOOL clearBg, - BOOL disable_vsync, - BOOL ignore_pixel_depth, + bool fullscreen, + bool clearBg, + bool disable_vsync, + bool ignore_pixel_depth, U32 fsaa_samples) */ // create window U32 max_core_count = gSavedSettings.getU32("EmulateCoreCount"); - U32 max_vram = gSavedSettings.getU32("RenderMaxVRAMBudget"); F32 max_gl_version = gSavedSettings.getF32("RenderMaxOpenGLVersion"); mWindow = LLWindowManager::createWindow(this, @@ -1877,7 +1876,6 @@ LLViewerWindow::LLViewerWindow(const Params& p) p.ignore_pixel_depth, 0, max_core_count, - max_vram, max_gl_version); //don't use window level anti-aliasing if (NULL == mWindow) @@ -1901,7 +1899,7 @@ LLViewerWindow::LLViewerWindow(const Params& p) else if (!LLViewerShaderMgr::sInitialized) { //immediately initialize shaders - LLViewerShaderMgr::sInitialized = TRUE; + LLViewerShaderMgr::sInitialized = true; LLViewerShaderMgr::instance()->setShaders(); } @@ -1923,7 +1921,7 @@ LLViewerWindow::LLViewerWindow(const Params& p) { gSavedSettings.setF32("UIScaleFactor", 1.f); } - gSavedSettings.setBOOL("ResetUIScaleOnFirstRun", FALSE); + gSavedSettings.setBOOL("ResetUIScaleOnFirstRun", false); } // Get the real window rect the window was created with (since there are various OS-dependent reasons why @@ -1971,7 +1969,7 @@ LLViewerWindow::LLViewerWindow(const Params& p) || (gSavedSettings.getBOOL("ProbeHardwareOnStartup"))) { LLFeatureManager::getInstance()->applyRecommendedSettings(); - gSavedSettings.setBOOL("ProbeHardwareOnStartup", FALSE); + gSavedSettings.setBOOL("ProbeHardwareOnStartup", false); } // If we crashed while initializng GL stuff last time, disable certain features @@ -2085,7 +2083,7 @@ void LLViewerWindow::initBase() } gToolBarView->setShape(panel_holder->getLocalRect()); // Hide the toolbars for the moment: we'll make them visible after logging in world (see LLViewerWindow::initWorldUI()) - gToolBarView->setVisible(FALSE); + gToolBarView->setVisible(false); // Constrain floaters to inside the menu and status bar regions. gFloaterView = main_view->getChild<LLFloaterView>("Floater View"); @@ -2134,8 +2132,8 @@ void LLViewerWindow::initBase() // Add the progress bar view (startup view), which overrides everything mProgressView = getRootView()->findChild<LLProgressView>("progress_view"); - setShowProgress(FALSE); - setProgressCancelButtonVisible(FALSE); + setShowProgress(false); + setProgressCancelButtonVisible(false); gMenuHolder = getRootView()->getChild<LLViewerMenuHolderGL>("Menu Holder"); LLMenuGL::sMenuContainer = gMenuHolder; @@ -2147,7 +2145,7 @@ void LLViewerWindow::initWorldUI() { gIMMgr = LLIMMgr::getInstance(); LLNavigationBar::getInstance(); - gFloaterView->pushVisibleAll(FALSE); + gFloaterView->pushVisibleAll(false); return; } @@ -2168,7 +2166,7 @@ void LLViewerWindow::initWorldUI() chiclet_bar->setShape(chiclet_container->getLocalRect()); chiclet_bar->setFollowsAll(); chiclet_container->addChild(chiclet_bar); - chiclet_container->setVisible(TRUE); + chiclet_container->setVisible(true); } LLRect morph_view_rect = full_window; @@ -2189,30 +2187,39 @@ void LLViewerWindow::initWorldUI() // Force gFloaterTools to initialize LLFloaterReg::getInstance("build"); - // Status bar - LLPanel* status_bar_container = getRootView()->getChild<LLPanel>("status_bar_container"); - gStatusBar = new LLStatusBar(status_bar_container->getLocalRect()); - gStatusBar->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP | FOLLOWS_RIGHT); - gStatusBar->setShape(status_bar_container->getLocalRect()); - // sync bg color with menu bar - gStatusBar->setBackgroundColor( gMenuBarView->getBackgroundColor().get() ); - // add InBack so that gStatusBar won't be drawn over menu - status_bar_container->addChildInBack(gStatusBar, 2/*tab order, after menu*/); - status_bar_container->setVisible(TRUE); - - // Navigation bar - LLView* nav_bar_container = getRootView()->getChild<LLView>("nav_bar_container"); - LLNavigationBar* navbar = LLNavigationBar::getInstance(); - navbar->setShape(nav_bar_container->getLocalRect()); - navbar->setBackgroundColor(gMenuBarView->getBackgroundColor().get()); - nav_bar_container->addChild(navbar); - nav_bar_container->setVisible(TRUE); - + if (!gStatusBar) + { + // Status bar + LLPanel* status_bar_container = getRootView()->getChild<LLPanel>("status_bar_container"); + gStatusBar = new LLStatusBar(status_bar_container->getLocalRect()); + gStatusBar->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP | FOLLOWS_RIGHT); + gStatusBar->setShape(status_bar_container->getLocalRect()); + // sync bg color with menu bar + gStatusBar->setBackgroundColor(gMenuBarView->getBackgroundColor().get()); + // add InBack so that gStatusBar won't be drawn over menu + status_bar_container->addChildInBack(gStatusBar, 2/*tab order, after menu*/); + status_bar_container->setVisible(true); + + // Navigation bar + LLView* nav_bar_container = getRootView()->getChild<LLView>("nav_bar_container"); + + navbar->setShape(nav_bar_container->getLocalRect()); + navbar->setBackgroundColor(gMenuBarView->getBackgroundColor().get()); + nav_bar_container->addChild(navbar); + nav_bar_container->setVisible(true); + } + else + { + LLPanel* status_bar_container = getRootView()->getChild<LLPanel>("status_bar_container"); + LLView* nav_bar_container = getRootView()->getChild<LLView>("nav_bar_container"); + status_bar_container->setVisible(true); + nav_bar_container->setVisible(true); + } if (!gSavedSettings.getBOOL("ShowNavbarNavigationPanel")) { - navbar->setVisible(FALSE); + navbar->setVisible(false); } else { @@ -2227,11 +2234,11 @@ void LLViewerWindow::initWorldUI() topinfo_bar->setShape(topinfo_bar_container->getLocalRect()); topinfo_bar_container->addChild(topinfo_bar); - topinfo_bar_container->setVisible(TRUE); + topinfo_bar_container->setVisible(true); if (!gSavedSettings.getBOOL("ShowMiniLocationPanel")) { - topinfo_bar->setVisible(FALSE); + topinfo_bar->setVisible(false); } if ( gHUDView == NULL ) @@ -2255,7 +2262,7 @@ void LLViewerWindow::initWorldUI() LLPanelHideBeacon* panel_hide_beacon = LLPanelHideBeacon::getInstance(); panel_ssf_container->addChild(panel_hide_beacon); - panel_ssf_container->setVisible(TRUE); + panel_ssf_container->setVisible(true); LLMenuOptionPathfindingRebakeNavmesh::getInstance()->initialize(); @@ -2264,7 +2271,7 @@ void LLViewerWindow::initWorldUI() if (gToolBarView) { gToolBarView->loadToolbars(); - gToolBarView->setVisible(TRUE); + gToolBarView->setVisible(true); } if (!gNonInteractive) @@ -2301,7 +2308,7 @@ void LLViewerWindow::shutdownViews() gFocusMgr.setTopCtrl(NULL); if (mWindow) { - mWindow->allowLanguageTextInput(NULL, FALSE); + mWindow->allowLanguageTextInput(NULL, false); } delete mDebugText; @@ -2312,7 +2319,7 @@ void LLViewerWindow::shutdownViews() // Cleanup global views if (gMorphView) { - gMorphView->setVisible(FALSE); + gMorphView->setVisible(false); } LL_INFOS() << "Global views cleaned." << LL_ENDL ; @@ -2397,7 +2404,7 @@ void LLViewerWindow::shutdownGL() LLSelectMgr::getInstance()->cleanup(); LL_INFOS() << "Stopping GL during shutdown" << LL_ENDL; - stopGL(FALSE); + stopGL(false); stop_glerror(); gGL.shutdown(); @@ -2419,7 +2426,7 @@ LLViewerWindow::~LLViewerWindow() if (LLViewerShaderMgr::sInitialized) { LLViewerShaderMgr::releaseInstance(); - LLViewerShaderMgr::sInitialized = FALSE; + LLViewerShaderMgr::sInitialized = false; } } @@ -2433,7 +2440,7 @@ void LLViewerWindow::showCursor() { mWindow->showCursor(); - mCursorHidden = FALSE; + mCursorHidden = false; } void LLViewerWindow::hideCursor() @@ -2441,7 +2448,7 @@ void LLViewerWindow::hideCursor() // And hide the cursor mWindow->hideCursor(); - mCursorHidden = TRUE; + mCursorHidden = true; } void LLViewerWindow::sendShapeToSim() @@ -2472,7 +2479,7 @@ void LLViewerWindow::reshape(S32 width, S32 height) // may have been destructed. if (!LLApp::isExiting()) { - gWindowResized = TRUE; + gWindowResized = true; // update our window rectangle mWindowRectRaw.mRight = mWindowRectRaw.mLeft + width; @@ -2489,7 +2496,7 @@ void LLViewerWindow::reshape(S32 width, S32 height) calcDisplayScale(); - BOOL display_scale_changed = mDisplayScale != LLUI::getScaleFactor(); + bool display_scale_changed = mDisplayScale != LLUI::getScaleFactor(); LLUI::setScaleFactor(mDisplayScale); // update our window rectangle @@ -2507,7 +2514,7 @@ void LLViewerWindow::reshape(S32 width, S32 height) // Needs only a 'scale change' update, everything else gets handled by LLLayoutStack::updateClass() LLPanelLogin::reshapePanel(); } - LLView::sForceReshape = FALSE; + LLView::sForceReshape = false; // clear font width caches if (display_scale_changed) @@ -2518,7 +2525,7 @@ void LLViewerWindow::reshape(S32 width, S32 height) sendShapeToSim(); // store new settings for the mode we are in, regardless - BOOL maximized = mWindow->getMaximized(); + bool maximized = mWindow->getMaximized(); gSavedSettings.setBOOL("WindowMaximized", maximized); if (!maximized) @@ -2546,7 +2553,7 @@ void LLViewerWindow::reshape(S32 width, S32 height) // Hide normal UI when a logon fails -void LLViewerWindow::setNormalControlsVisible( BOOL visible ) +void LLViewerWindow::setNormalControlsVisible( bool visible ) { if(LLChicletBar::instanceExists()) { @@ -2658,7 +2665,7 @@ void LLViewerWindow::draw() { //#if LL_DEBUG - LLView::sIsDrawing = TRUE; + LLView::sIsDrawing = true; //#endif stop_glerror(); @@ -2776,17 +2783,17 @@ void LLViewerWindow::draw() gUIProgram.unbind(); - LLView::sIsDrawing = FALSE; + LLView::sIsDrawing = false; } // Takes a single keyup event, usually when UI is visible -BOOL LLViewerWindow::handleKeyUp(KEY key, MASK mask) +bool LLViewerWindow::handleKeyUp(KEY key, MASK mask) { - if (LLSetKeyBindDialog::recordKey(key, mask, FALSE)) + if (LLSetKeyBindDialog::recordKey(key, mask, false)) { LL_DEBUGS() << "KeyUp handled by LLSetKeyBindDialog" << LL_ENDL; LLViewerEventRecorder::instance().logKeyEvent(key, mask); - return TRUE; + return true; } LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus(); @@ -2798,7 +2805,7 @@ BOOL LLViewerWindow::handleKeyUp(KEY key, MASK mask) // We have keyboard focus, and it's not an accelerator if (keyboard_focus && keyboard_focus->wantsKeyUpKeyDown()) { - return keyboard_focus->handleKeyUp(key, mask, FALSE); + return keyboard_focus->handleKeyUp(key, mask, false); } else if (key < 0x80) { @@ -2809,14 +2816,14 @@ BOOL LLViewerWindow::handleKeyUp(KEY key, MASK mask) if (keyboard_focus) { - if (keyboard_focus->handleKeyUp(key, mask, FALSE)) + if (keyboard_focus->handleKeyUp(key, mask, false)) { LL_DEBUGS() << "LLviewerWindow::handleKeyUp - in 'traverse up' - no loops seen... just called keyboard_focus->handleKeyUp an it returned true" << LL_ENDL; LLViewerEventRecorder::instance().logKeyEvent(key, mask); - return TRUE; + return true; } else { - LL_DEBUGS() << "LLviewerWindow::handleKeyUp - in 'traverse up' - no loops seen... just called keyboard_focus->handleKeyUp an it returned FALSE" << LL_ENDL; + LL_DEBUGS() << "LLviewerWindow::handleKeyUp - in 'traverse up' - no loops seen... just called keyboard_focus->handleKeyUp an it returned false" << LL_ENDL; } } @@ -2825,7 +2832,7 @@ BOOL LLViewerWindow::handleKeyUp(KEY key, MASK mask) { LL_DEBUGS() << "LLviewerWindow::handleKey new gesture release feature" << LL_ENDL; LLViewerEventRecorder::instance().logKeyEvent(key,mask); - return TRUE; + return true; } //Old format gestures do not support this, so no need to implement it. @@ -2836,18 +2843,18 @@ BOOL LLViewerWindow::handleKeyUp(KEY key, MASK mask) } // Takes a single keydown event, usually when UI is visible -BOOL LLViewerWindow::handleKey(KEY key, MASK mask) +bool LLViewerWindow::handleKey(KEY key, MASK mask) { // hide tooltips on keypress LLToolTipMgr::instance().blockToolTips(); // Menus get handled on key down instead of key up // so keybindings have to be recorded before that - if (LLSetKeyBindDialog::recordKey(key, mask, TRUE)) + if (LLSetKeyBindDialog::recordKey(key, mask, true)) { LL_DEBUGS() << "Key handled by LLSetKeyBindDialog" << LL_ENDL; LLViewerEventRecorder::instance().logKeyEvent(key,mask); - return TRUE; + return true; } LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus(); @@ -2859,7 +2866,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) //don't switch to mouselook if any floater has focus if ((key == KEY_MOUSELOOK) && !(mask & (MASK_CONTROL | MASK_ALT))) { - return TRUE; + return true; } LLUICtrl* cur_focus = dynamic_cast<LLUICtrl*>(keyboard_focus); @@ -2902,7 +2909,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) if (res == 1 && chars[0] >= 0x20) { // Let it fall through to character handler and get a WM_CHAR. - return TRUE; + return true; } } } @@ -2913,25 +2920,25 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) // We have keyboard focus, and it's not an accelerator if (keyboard_focus && keyboard_focus->wantsKeyUpKeyDown()) { - return keyboard_focus->handleKey(key, mask, FALSE); + return keyboard_focus->handleKey(key, mask, false); } else if (key < 0x80) { // Not a special key, so likely (we hope) to generate a character. Let it fall through to character handler first. - return TRUE; + return true; } } } } // let menus handle navigation keys for navigation - if ((gMenuBarView && gMenuBarView->handleKey(key, mask, TRUE)) - ||(gLoginMenuBarView && gLoginMenuBarView->handleKey(key, mask, TRUE)) - ||(gMenuHolder && gMenuHolder->handleKey(key, mask, TRUE))) + if ((gMenuBarView && gMenuBarView->handleKey(key, mask, true)) + ||(gLoginMenuBarView && gLoginMenuBarView->handleKey(key, mask, true)) + ||(gMenuHolder && gMenuHolder->handleKey(key, mask, true))) { LL_DEBUGS() << "LLviewerWindow::handleKey handle nav keys for nav" << LL_ENDL; LLViewerEventRecorder::instance().logKeyEvent(key,mask); - return TRUE; + return true; } @@ -2942,10 +2949,10 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) // Check the current floater's menu first, if it has one. if (gFocusMgr.keyboardFocusHasAccelerators() && keyboard_focus - && keyboard_focus->handleKey(key,mask,FALSE)) + && keyboard_focus->handleKey(key,mask,false)) { LLViewerEventRecorder::instance().logKeyEvent(key,mask); - return TRUE; + return true; } if (gAgent.isInitialized() @@ -2954,13 +2961,13 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) && gMenuBarView->handleAcceleratorKey(key, mask)) { LLViewerEventRecorder::instance().logKeyEvent(key, mask); - return TRUE; + return true; } if (gLoginMenuBarView && gLoginMenuBarView->handleAcceleratorKey(key, mask)) { LLViewerEventRecorder::instance().logKeyEvent(key,mask); - return TRUE; + return true; } } @@ -2985,13 +2992,13 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) mRootView->focusNextRoot(); } LLViewerEventRecorder::instance().logKeyEvent(key,mask); - return TRUE; + return true; } // hidden edit menu for cut/copy/paste if (gEditMenu && gEditMenu->handleAcceleratorKey(key, mask)) { LLViewerEventRecorder::instance().logKeyEvent(key,mask); - return TRUE; + return true; } LLFloater* focused_floaterp = gFloaterView->getFocusedFloater(); @@ -3021,7 +3028,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) case KEY_END: // when chatbar is empty or ArrowKeysAlwaysMove set, // pass arrow keys on to avatar... - return FALSE; + return false; default: break; } @@ -3029,14 +3036,14 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) } } - if (keyboard_focus->handleKey(key, mask, FALSE)) + if (keyboard_focus->handleKey(key, mask, false)) { LL_DEBUGS() << "LLviewerWindow::handleKey - in 'traverse up' - no loops seen... just called keyboard_focus->handleKey an it returned true" << LL_ENDL; LLViewerEventRecorder::instance().logKeyEvent(key,mask); - return TRUE; + return true; } else { - LL_DEBUGS() << "LLviewerWindow::handleKey - in 'traverse up' - no loops seen... just called keyboard_focus->handleKey an it returned FALSE" << LL_ENDL; + LL_DEBUGS() << "LLviewerWindow::handleKey - in 'traverse up' - no loops seen... just called keyboard_focus->handleKey an it returned false" << LL_ENDL; } } @@ -3044,7 +3051,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) { LL_DEBUGS() << "LLviewerWindow::handleKey toolbar handling?" << LL_ENDL; LLViewerEventRecorder::instance().logKeyEvent(key,mask); - return TRUE; + return true; } // Try for a new-format gesture @@ -3052,7 +3059,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) { LL_DEBUGS() << "LLviewerWindow::handleKey new gesture feature" << LL_ENDL; LLViewerEventRecorder::instance().logKeyEvent(key,mask); - return TRUE; + return true; } // See if this is a gesture trigger. If so, eat the key and @@ -3061,7 +3068,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) { LL_DEBUGS() << "LLviewerWindow::handleKey check gesture trigger" << LL_ENDL; LLViewerEventRecorder::instance().logKeyEvent(key,mask); - return TRUE; + return true; } // If "Pressing letter keys starts local chat" option is selected, we are not in mouselook, @@ -3084,7 +3091,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) { // passing NULL here, character will be added later when it is handled by character handler. nearby_chat->startChat(NULL); - return TRUE; + return true; } } @@ -3095,12 +3102,12 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) && gMenuBarView->handleAcceleratorKey(key, mask)) { LLViewerEventRecorder::instance().logKeyEvent(key, mask); - return TRUE; + return true; } if (gLoginMenuBarView && gLoginMenuBarView->handleAcceleratorKey(key, mask)) { - return TRUE; + return true; } // don't pass keys on to world when something in ui has focus @@ -3110,7 +3117,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) } -BOOL LLViewerWindow::handleUnicodeChar(llwchar uni_char, MASK mask) +bool LLViewerWindow::handleUnicodeChar(llwchar uni_char, MASK mask) { // HACK: We delay processing of return keys until they arrive as a Unicode char, // so that if you're typing chat text at low frame rate, we don't send the chat @@ -3128,27 +3135,27 @@ BOOL LLViewerWindow::handleUnicodeChar(llwchar uni_char, MASK mask) } // let menus handle navigation (jump) keys - if (gMenuBarView && gMenuBarView->handleUnicodeChar(uni_char, TRUE)) + if (gMenuBarView && gMenuBarView->handleUnicodeChar(uni_char, true)) { - return TRUE; + return true; } // Traverses up the hierarchy LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus(); if( keyboard_focus ) { - if (keyboard_focus->handleUnicodeChar(uni_char, FALSE)) + if (keyboard_focus->handleUnicodeChar(uni_char, false)) { - return TRUE; + return true; } - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLViewerWindow::handleUnicodeString(char *uni_str, bool editing) +bool LLViewerWindow::handleUnicodeString(char *uni_str, bool editing) { auto keyboard_focus = gFocusMgr.getKeyboardFocus(); if (keyboard_focus) @@ -3369,12 +3376,12 @@ void LLViewerWindow::updateUI() S32 x = mCurrentMousePoint.mX; S32 y = mCurrentMousePoint.mY; - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_RAYCAST)) { gDebugRaycastFaceHit = gDebugRaycastGLTFNodeHit = gDebugRaycastGLTFPrimitiveHit = -1; - gDebugRaycastObject = cursorIntersect(-1, -1, 512.f, NULL, -1, FALSE, FALSE, TRUE, FALSE, + gDebugRaycastObject = cursorIntersect(-1, -1, 512.f, NULL, -1, false, false, true, false, &gDebugRaycastFaceHit, &gDebugRaycastGLTFNodeHit, &gDebugRaycastGLTFPrimitiveHit, @@ -3391,7 +3398,7 @@ void LLViewerWindow::updateUI() updateMouseDelta(); updateKeyboardFocus(); - BOOL handled = FALSE; + bool handled = false; LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); @@ -3643,7 +3650,7 @@ void LLViewerWindow::updateUI() last_handle_msg = LLView::sMouseHandlerMessage; LL_INFOS() << "Hover" << LLView::sMouseHandlerMessage << LL_ENDL; } - handled = TRUE; + handled = true; } else if (LLView::sDebugMouseHandling) { @@ -3667,7 +3674,7 @@ void LLViewerWindow::updateUI() } // Show a new tool tip (or update one that is already shown) - BOOL tool_tip_handled = FALSE; + bool tool_tip_handled = false; std::string tool_tip_msg; if( handled && !mWindow->isCursorHidden()) @@ -3819,12 +3826,12 @@ void LLViewerWindow::updateLayout() } // Update the location of the blue box tool popup LLCoordGL select_center_screen; - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); gFloaterTools->updatePopup( select_center_screen, mask ); } else { - gFloaterTools->setVisible(FALSE); + gFloaterTools->setVisible(false); } //gMenuBarView->setItemVisible("BuildTools", gFloaterTools->getVisible()); } @@ -3858,11 +3865,11 @@ void LLViewerWindow::updateMouseDelta() mouse_pos.mX > mWindowRectRaw.getWidth() || mouse_pos.mY > mWindowRectRaw.getHeight()) { - mMouseInWindow = FALSE; + mMouseInWindow = false; } else { - mMouseInWindow = TRUE; + mMouseInWindow = true; } LLVector2 mouse_vel; @@ -3918,7 +3925,7 @@ void LLViewerWindow::updateKeyboardFocus() { if (!parent->focusFirstItem()) { - parent->setFocus(TRUE); + parent->setFocus(true); } new_focus_found = true; break; @@ -3931,7 +3938,7 @@ void LLViewerWindow::updateKeyboardFocus() // are only moving focus higher in the hierarchy if (!new_focus_found) { - cur_focus->setFocus(FALSE); + cur_focus->setFocus(false); } } else if (cur_focus->isFocusRoot()) @@ -3953,11 +3960,11 @@ void LLViewerWindow::updateKeyboardFocus() // sync all floaters with their focus state gFloaterView->highlightFocusedFloater(); gSnapshotFloaterView->highlightFocusedFloater(); - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); if ((mask & MASK_CONTROL) == 0) { // control key no longer held down, finish cycle mode - gFloaterView->setCycleMode(FALSE); + gFloaterView->setCycleMode(false); gFloaterView->syncFloaterTabOrder(); } @@ -3984,7 +3991,7 @@ void LLViewerWindow::updateWorldViewRect(bool use_full_window) // start off using whole window to render world LLRect new_world_rect = mWindowRectRaw; - if (use_full_window == false && mWorldViewPlaceholder.get()) + if (!use_full_window && mWorldViewPlaceholder.get()) { new_world_rect = mWorldViewPlaceholder.get()->calcScreenRect(); // clamp to at least a 1x1 rect so we don't try to allocate zero width gl buffers @@ -4000,7 +4007,7 @@ void LLViewerWindow::updateWorldViewRect(bool use_full_window) if (mWorldViewRectRaw != new_world_rect) { mWorldViewRectRaw = new_world_rect; - gResizeScreenTexture = TRUE; + gResizeScreenTexture = true; LLViewerCamera::getInstance()->setViewHeightInPixels( mWorldViewRectRaw.getHeight() ); LLViewerCamera::getInstance()->setAspect( getWorldViewAspectRatio() ); @@ -4048,9 +4055,9 @@ void LLViewerWindow::saveLastMouse(const LLCoordGL &point) // Draws the selection outlines for the currently selected objects // Must be called after displayObjects is called, which sets the mGLName parameter // NOTE: This function gets called 3 times: -// render_ui_3d: FALSE, FALSE, TRUE -// render_hud_elements: FALSE, FALSE, FALSE -void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, BOOL for_hud ) +// render_ui_3d: false, false, true +// render_hud_elements: false, false, false +void LLViewerWindow::renderSelections( bool for_gl_pick, bool pick_parcel_walls, bool for_hud ) { LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); @@ -4169,21 +4176,21 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, // make whole viewer benefit. LLSelectMgr::getInstance()->selectGetEditMoveLinksetPermissions(all_selected_objects_move, all_selected_objects_modify); - BOOL draw_handles = TRUE; + bool draw_handles = true; if (tool == LLToolCompTranslate::getInstance() && !all_selected_objects_move && !LLSelectMgr::getInstance()->isMovableAvatarSelected()) { - draw_handles = FALSE; + draw_handles = false; } if (tool == LLToolCompRotate::getInstance() && !all_selected_objects_move && !LLSelectMgr::getInstance()->isMovableAvatarSelected()) { - draw_handles = FALSE; + draw_handles = false; } if ( !all_selected_objects_modify && tool == LLToolCompScale::getInstance() ) { - draw_handles = FALSE; + draw_handles = false; } if( draw_handles ) @@ -4227,9 +4234,9 @@ LLVector3d LLViewerWindow::clickPointInWorldGlobal(S32 x, S32 y_from_bot, LLView } -BOOL LLViewerWindow::clickPointOnSurfaceGlobal(const S32 x, const S32 y, LLViewerObject *objectp, LLVector3d &point_global) const +bool LLViewerWindow::clickPointOnSurfaceGlobal(const S32 x, const S32 y, LLViewerObject *objectp, LLVector3d &point_global) const { - BOOL intersect = FALSE; + bool intersect = false; // U8 shape = objectp->mPrimitiveCode & LL_PCODE_BASE_MASK; if (!intersect) @@ -4249,20 +4256,20 @@ void LLViewerWindow::pickAsync( S32 x, S32 y_from_bot, MASK mask, void (*callback)(const LLPickInfo& info), - BOOL pick_transparent, - BOOL pick_rigged, - BOOL pick_unselectable, - BOOL pick_reflection_probes) + bool pick_transparent, + bool pick_rigged, + bool pick_unselectable, + bool pick_reflection_probes) { // "Show Debug Alpha" means no object actually transparent - BOOL in_build_mode = LLFloaterReg::instanceVisible("build"); + bool in_build_mode = LLFloaterReg::instanceVisible("build"); if (LLDrawPoolAlpha::sShowDebugAlpha || (in_build_mode && gSavedSettings.getBOOL("SelectInvisibleObjects"))) { - pick_transparent = TRUE; + pick_transparent = true; } - LLPickInfo pick_info(LLCoordGL(x, y_from_bot), mask, pick_transparent, pick_rigged, FALSE, pick_reflection_probes, pick_unselectable, TRUE, callback); + LLPickInfo pick_info(LLCoordGL(x, y_from_bot), mask, pick_transparent, pick_rigged, false, pick_reflection_probes, pick_unselectable, true, callback); schedulePick(pick_info); } @@ -4318,19 +4325,19 @@ void LLViewerWindow::returnEmptyPicks() } // Performs the GL object/land pick. -LLPickInfo LLViewerWindow::pickImmediate(S32 x, S32 y_from_bot, BOOL pick_transparent, BOOL pick_rigged, BOOL pick_particle, BOOL pick_unselectable, BOOL pick_reflection_probe) +LLPickInfo LLViewerWindow::pickImmediate(S32 x, S32 y_from_bot, bool pick_transparent, bool pick_rigged, bool pick_particle, bool pick_unselectable, bool pick_reflection_probe) { - BOOL in_build_mode = LLFloaterReg::instanceVisible("build"); + bool in_build_mode = LLFloaterReg::instanceVisible("build"); if ((in_build_mode && gSavedSettings.getBOOL("SelectInvisibleObjects")) || LLDrawPoolAlpha::sShowDebugAlpha) { // build mode allows interaction with all transparent objects // "Show Debug Alpha" means no object actually transparent - pick_transparent = TRUE; + pick_transparent = true; } // shortcut queueing in mPicks and just update mLastPick in place - MASK key_mask = gKeyboard->currentMask(TRUE); - mLastPick = LLPickInfo(LLCoordGL(x, y_from_bot), key_mask, pick_transparent, pick_rigged, pick_particle, pick_reflection_probe, TRUE, FALSE, NULL); + MASK key_mask = gKeyboard->currentMask(true); + mLastPick = LLPickInfo(LLCoordGL(x, y_from_bot), key_mask, pick_transparent, pick_rigged, pick_particle, pick_reflection_probe, true, false, NULL); mLastPick.fetchResults(); return mLastPick; @@ -4365,10 +4372,10 @@ LLHUDIcon* LLViewerWindow::cursorIntersectIcon(S32 mouse_x, S32 mouse_y, F32 dep LLViewerObject* LLViewerWindow::cursorIntersect(S32 mouse_x, S32 mouse_y, F32 depth, LLViewerObject *this_object, S32 this_face, - BOOL pick_transparent, - BOOL pick_rigged, - BOOL pick_unselectable, - BOOL pick_reflection_probe, + bool pick_transparent, + bool pick_rigged, + bool pick_unselectable, + bool pick_reflection_probe, S32* face_hit, S32* gltf_node_hit, S32* gltf_primitive_hit, @@ -4554,7 +4561,7 @@ LLVector3 LLViewerWindow::mouseDirectionCamera(const S32 x, const S32 y) const -BOOL LLViewerWindow::mousePointOnPlaneGlobal(LLVector3d& point, const S32 x, const S32 y, +bool LLViewerWindow::mousePointOnPlaneGlobal(LLVector3d& point, const S32 x, const S32 y, const LLVector3d &plane_point_global, const LLVector3 &plane_normal_global) { @@ -4585,11 +4592,11 @@ BOOL LLViewerWindow::mousePointOnPlaneGlobal(LLVector3d& point, const S32 x, con // Returns global position -BOOL LLViewerWindow::mousePointOnLandGlobal(const S32 x, const S32 y, LLVector3d *land_position_global, BOOL ignore_distance) +bool LLViewerWindow::mousePointOnLandGlobal(const S32 x, const S32 y, LLVector3d *land_position_global, bool ignore_distance) { LLVector3 mouse_direction_global = mouseDirectionGlobal(x,y); F32 mouse_dir_scale; - BOOL hit_land = FALSE; + bool hit_land = false; LLViewerRegion *regionp; F32 land_z; const F32 FIRST_PASS_STEP = 1.0f; // meters @@ -4635,7 +4642,7 @@ BOOL LLViewerWindow::mousePointOnLandGlobal(const S32 x, const S32 y, LLVector3d // cout << "under land at " << probe_point << " scale " << mouse_vec_scale << endl; - hit_land = TRUE; + hit_land = true; break; } } @@ -4683,16 +4690,16 @@ BOOL LLViewerWindow::mousePointOnLandGlobal(const S32 x, const S32 y, LLVector3d // ...just went under land again *land_position_global = probe_point_global; - return TRUE; + return true; } } } - return FALSE; + return false; } // Saves an image to the harddrive as "SnapshotX" where X >= 1. -void LLViewerWindow::saveImageNumbered(LLImageFormatted *image, BOOL force_picker, const snapshot_saved_signal_t::slot_type& success_cb, const snapshot_saved_signal_t::slot_type& failure_cb) +void LLViewerWindow::saveImageNumbered(LLImageFormatted *image, bool force_picker, const snapshot_saved_signal_t::slot_type& success_cb, const snapshot_saved_signal_t::slot_type& failure_cb) { if (!image) { @@ -4791,7 +4798,7 @@ void LLViewerWindow::saveImageLocal(LLImageFormatted *image, const snapshot_save } // Look for an unused file name - BOOL is_snapshot_name_loc_set = isSnapshotLocSet(); + bool is_snapshot_name_loc_set = isSnapshotLocSet(); std::string filepath; S32 i = 1; S32 err = 0; @@ -4845,12 +4852,12 @@ void LLViewerWindow::movieSize(S32 new_width, S32 new_height) } } -BOOL LLViewerWindow::saveSnapshot(const std::string& filepath, S32 image_width, S32 image_height, BOOL show_ui, BOOL show_hud, BOOL do_rebuild, LLSnapshotModel::ESnapshotLayerType type, LLSnapshotModel::ESnapshotFormat format) +bool LLViewerWindow::saveSnapshot(const std::string& filepath, S32 image_width, S32 image_height, bool show_ui, bool show_hud, bool do_rebuild, LLSnapshotModel::ESnapshotLayerType type, LLSnapshotModel::ESnapshotFormat format) { LL_INFOS() << "Saving snapshot to: " << filepath << LL_ENDL; LLPointer<LLImageRaw> raw = new LLImageRaw; - BOOL success = rawSnapshot(raw, image_width, image_height, TRUE, FALSE, show_ui, show_hud, do_rebuild); + bool success = rawSnapshot(raw, image_width, image_height, true, false, show_ui, show_hud, do_rebuild); if (success) { @@ -4898,7 +4905,7 @@ void LLViewerWindow::playSnapshotAnimAndSound() send_sound_trigger(LLUUID(gSavedSettings.getString("UISndSnapshot")), 1.0f); } -BOOL LLViewerWindow::isSnapshotLocSet() const +bool LLViewerWindow::isSnapshotLocSet() const { std::string snapshot_dir = sSnapshotDir; return !snapshot_dir.empty(); @@ -4909,50 +4916,51 @@ void LLViewerWindow::resetSnapshotLoc() const gSavedPerAccountSettings.setString("SnapshotBaseDir", std::string()); } -BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL show_hud, BOOL do_rebuild, BOOL no_post, LLSnapshotModel::ESnapshotLayerType type) +bool LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, bool show_ui, bool show_hud, bool do_rebuild, bool no_post, LLSnapshotModel::ESnapshotLayerType type) { - return rawSnapshot(raw, preview_width, preview_height, FALSE, FALSE, show_ui, show_hud, do_rebuild, no_post, type); + return rawSnapshot(raw, preview_width, preview_height, false, false, show_ui, show_hud, do_rebuild, no_post, type); } // Saves the image from the screen to a raw image // Since the required size might be bigger than the available screen, this method rerenders the scene in parts (called subimages) and copy // the results over to the final raw image. -BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height, - BOOL keep_window_aspect, BOOL is_texture, BOOL show_ui, BOOL show_hud, BOOL do_rebuild, BOOL no_post, LLSnapshotModel::ESnapshotLayerType type, S32 max_size) +bool LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height, + bool keep_window_aspect, bool is_texture, bool show_ui, bool show_hud, bool do_rebuild, bool no_post, LLSnapshotModel::ESnapshotLayerType type, S32 max_size) { if (!raw) { - return FALSE; + return false; } + //check if there is enough memory for the snapshot image if(image_width * image_height > (1 << 22)) //if snapshot image is larger than 2K by 2K { if(!LLMemory::tryToAlloc(NULL, image_width * image_height * 3)) { LL_WARNS() << "No enough memory to take the snapshot with size (w : h): " << image_width << " : " << image_height << LL_ENDL ; - return FALSE ; //there is no enough memory for taking this snapshot. + return false ; //there is no enough memory for taking this snapshot. } } // PRE SNAPSHOT gSnapshotNoPost = no_post; - gDisplaySwapBuffers = FALSE; + gDisplaySwapBuffers = false; glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); // stencil buffer is deprecated | GL_STENCIL_BUFFER_BIT); setCursor(UI_CURSOR_WAIT); // Hide all the UI widgets first and draw a frame - BOOL prev_draw_ui = gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI) ? TRUE : FALSE; + bool prev_draw_ui = gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI); if ( prev_draw_ui != show_ui) { LLPipeline::toggleRenderDebugFeature(LLPipeline::RENDER_DEBUG_FEATURE_UI); } - BOOL hide_hud = !show_hud && LLPipeline::sShowHUDAttachments; + bool hide_hud = !show_hud && LLPipeline::sShowHUDAttachments; if (hide_hud) { - LLPipeline::sShowHUDAttachments = FALSE; + LLPipeline::sShowHUDAttachments = false; } // if not showing ui, use full window to render world view @@ -5043,20 +5051,24 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei image_buffer_x = llfloor(snapshot_width * scale_factor) ; image_buffer_y = llfloor(snapshot_height * scale_factor) ; } + + LLImageDataLock lock(raw); + if ((image_buffer_x > 0) && (image_buffer_y > 0)) { raw->resize(image_buffer_x, image_buffer_y, 3); } else { - return FALSE ; + return false; } + if (raw->isBufferInvalid()) { - return FALSE ; + return false; } - BOOL high_res = scale_factor >= 2.f; // Font scaling is slow, only do so if rez is much higher + bool high_res = scale_factor >= 2.f; // Font scaling is slow, only do so if rez is much higher if (high_res && show_ui) { // Note: we should never get there... @@ -5084,8 +5096,8 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei S32 output_buffer_offset_x = 0; for (int subimage_x = 0; subimage_x < scale_factor; ++subimage_x) { - gDisplaySwapBuffers = FALSE; - gDepthDirty = TRUE; + gDisplaySwapBuffers = false; + gDepthDirty = true; S32 subimage_x_offset = llclamp(buffer_x_offset - (subimage_x * window_width), 0, window_width); // handle fractional rows @@ -5096,12 +5108,12 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei if (read_width && read_height) { const U32 subfield = subimage_x+(subimage_y*llceil(scale_factor)); - display(do_rebuild, scale_factor, subfield, TRUE); + display(do_rebuild, scale_factor, subfield, true); if (!LLPipeline::sRenderDeferred) { // Required for showing the GUI in snapshots and performing bloom composite overlay - // Call even if show_ui is FALSE + // Call even if show_ui is false render_ui(scale_factor, subfield); swap(); } @@ -5165,9 +5177,9 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei output_buffer_offset_y += subimage_y_offset; } - gDisplaySwapBuffers = FALSE; - gSnapshotNoPost = FALSE; - gDepthDirty = TRUE; + gDisplaySwapBuffers = false; + gSnapshotNoPost = false; + gDepthDirty = true; // POST SNAPSHOT if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI)) @@ -5177,7 +5189,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei if (hide_hud) { - LLPipeline::sShowHUDAttachments = TRUE; + LLPipeline::sShowHUDAttachments = true; } /*if (high_res) @@ -5190,7 +5202,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei // Note: this formula depends on the number of components being 3. Not obvious, but it's correct. image_width += (image_width * 3) % 4; - BOOL ret = TRUE ; + bool ret = true ; // Resize image if(llabs(image_width - image_buffer_x) > 4 || llabs(image_height - image_buffer_y) > 4) { @@ -5198,10 +5210,9 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei } else if(image_width != image_buffer_x || image_height != image_buffer_y) { - ret = raw->scale( image_width, image_height, FALSE ); + ret = raw->scale( image_width, image_height, false ); } - setCursor(UI_CURSOR_ARROW); if (do_rebuild) @@ -5233,24 +5244,24 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei return ret; } -BOOL LLViewerWindow::simpleSnapshot(LLImageRaw* raw, S32 image_width, S32 image_height, const int num_render_passes) +bool LLViewerWindow::simpleSnapshot(LLImageRaw* raw, S32 image_width, S32 image_height, const int num_render_passes) { LL_PROFILE_ZONE_SCOPED_CATEGORY_APP; - gDisplaySwapBuffers = FALSE; + gDisplaySwapBuffers = false; glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); // stencil buffer is deprecated | GL_STENCIL_BUFFER_BIT); setCursor(UI_CURSOR_WAIT); - BOOL prev_draw_ui = gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI) ? TRUE : FALSE; - if (prev_draw_ui != false) + bool prev_draw_ui = gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI); + if (prev_draw_ui) { LLPipeline::toggleRenderDebugFeature(LLPipeline::RENDER_DEBUG_FEATURE_UI); } - BOOL hide_hud = LLPipeline::sShowHUDAttachments; + bool hide_hud = LLPipeline::sShowHUDAttachments; if (hide_hud) { - LLPipeline::sShowHUDAttachments = FALSE; + LLPipeline::sShowHUDAttachments = false; } LLRect window_rect = getWorldViewRectRaw(); @@ -5291,17 +5302,19 @@ BOOL LLViewerWindow::simpleSnapshot(LLImageRaw* raw, S32 image_width, S32 image_ // the black flash in between captures when the number // of render passes is more than 1. We need to also // set it here because code in LLViewerDisplay resets - // it to TRUE each time. - gDisplaySwapBuffers = FALSE; + // it to true each time. + gDisplaySwapBuffers = false; // actually render the scene const U32 subfield = 0; const bool do_rebuild = true; const F32 zoom = 1.0; - const bool for_snapshot = TRUE; + const bool for_snapshot = true; display(do_rebuild, zoom, subfield, for_snapshot); } + LLImageDataSharedLock lock(raw); + glReadPixels( 0, 0, image_width, @@ -5311,12 +5324,12 @@ BOOL LLViewerWindow::simpleSnapshot(LLImageRaw* raw, S32 image_width, S32 image_ ); stop_glerror(); - gDisplaySwapBuffers = FALSE; - gDepthDirty = TRUE; + gDisplaySwapBuffers = false; + gDepthDirty = true; if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI)) { - if (prev_draw_ui != false) + if (prev_draw_ui) { LLPipeline::toggleRenderDebugFeature(LLPipeline::RENDER_DEBUG_FEATURE_UI); } @@ -5324,7 +5337,7 @@ BOOL LLViewerWindow::simpleSnapshot(LLImageRaw* raw, S32 image_width, S32 image_ if (hide_hud) { - LLPipeline::sShowHUDAttachments = TRUE; + LLPipeline::sShowHUDAttachments = true; } setCursor(UI_CURSOR_ARROW); @@ -5340,7 +5353,7 @@ BOOL LLViewerWindow::simpleSnapshot(LLImageRaw* raw, S32 image_width, S32 image_ void display_cube_face(); -BOOL LLViewerWindow::cubeSnapshot(const LLVector3& origin, LLCubeMapArray* cubearray, S32 cubeIndex, S32 face, F32 near_clip, bool dynamic_render, bool useCustomClipPlane, LLPlane clipPlane) +bool LLViewerWindow::cubeSnapshot(const LLVector3& origin, LLCubeMapArray* cubearray, S32 cubeIndex, S32 face, F32 near_clip, bool dynamic_render, bool useCustomClipPlane, LLPlane clipPlane) { // NOTE: implementation derived from LLFloater360Capture::capture360Images() and simpleSnapshot LL_PROFILE_ZONE_SCOPED_CATEGORY_APP; @@ -5402,16 +5415,16 @@ BOOL LLViewerWindow::cubeSnapshot(const LLVector3& origin, LLCubeMapArray* cubea } } - BOOL prev_draw_ui = gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI) ? TRUE : FALSE; - if (prev_draw_ui != false) + bool prev_draw_ui = gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI); + if (prev_draw_ui) { LLPipeline::toggleRenderDebugFeature(LLPipeline::RENDER_DEBUG_FEATURE_UI); } - BOOL hide_hud = LLPipeline::sShowHUDAttachments; + bool hide_hud = LLPipeline::sShowHUDAttachments; if (hide_hud) { - LLPipeline::sShowHUDAttachments = FALSE; + LLPipeline::sShowHUDAttachments = false; } LLRect window_rect = getWorldViewRectRaw(); @@ -5448,20 +5461,20 @@ BOOL LLViewerWindow::cubeSnapshot(const LLVector3& origin, LLCubeMapArray* cubea // the black flash in between captures when the number // of render passes is more than 1. We need to also // set it here because code in LLViewerDisplay resets - // it to TRUE each time. - gDisplaySwapBuffers = FALSE; + // it to true each time. + gDisplaySwapBuffers = false; // actually render the scene - gCubeSnapshot = TRUE; + gCubeSnapshot = true; display_cube_face(); - gCubeSnapshot = FALSE; + gCubeSnapshot = false; } - gDisplaySwapBuffers = TRUE; + gDisplaySwapBuffers = true; if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI)) { - if (prev_draw_ui != false) + if (prev_draw_ui) { LLPipeline::toggleRenderDebugFeature(LLPipeline::RENDER_DEBUG_FEATURE_UI); } @@ -5480,7 +5493,7 @@ BOOL LLViewerWindow::cubeSnapshot(const LLVector3& origin, LLCubeMapArray* cubea if (hide_hud) { - LLPipeline::sShowHUDAttachments = TRUE; + LLPipeline::sShowHUDAttachments = true; } gPipeline.resetDrawOrders(); @@ -5616,7 +5629,7 @@ void LLViewerWindow::setup2DViewport(S32 x_offset, S32 y_offset) void LLViewerWindow::setup3DRender() { // setup perspective camera - LLViewerCamera::getInstance()->setPerspective(NOT_FOR_SELECTION, mWorldViewRectRaw.mLeft, mWorldViewRectRaw.mBottom, mWorldViewRectRaw.getWidth(), mWorldViewRectRaw.getHeight(), FALSE, LLViewerCamera::getInstance()->getNear(), MAX_FAR_CLIP*2.f); + LLViewerCamera::getInstance()->setPerspective(NOT_FOR_SELECTION, mWorldViewRectRaw.mLeft, mWorldViewRectRaw.mBottom, mWorldViewRectRaw.getWidth(), mWorldViewRectRaw.getHeight(), false, LLViewerCamera::getInstance()->getNear(), MAX_FAR_CLIP*2.f); setup3DViewport(); } @@ -5646,7 +5659,7 @@ void LLViewerWindow::initTextures(S32 location_id) } } -void LLViewerWindow::setShowProgress(const BOOL show) +void LLViewerWindow::setShowProgress(const bool show) { if (mProgressView) { @@ -5662,7 +5675,7 @@ void LLViewerWindow::setStartupComplete() } } -BOOL LLViewerWindow::getShowProgress() const +bool LLViewerWindow::getShowProgress() const { return (mProgressView && mProgressView->getVisible()); } @@ -5691,7 +5704,7 @@ void LLViewerWindow::setProgressPercent(const F32 percent) } } -void LLViewerWindow::setProgressCancelButtonVisible( BOOL b, const std::string& label ) +void LLViewerWindow::setProgressCancelButtonVisible( bool b, const std::string& label ) { if (mProgressView) { @@ -5712,7 +5725,7 @@ void LLViewerWindow::dumpState() << LL_ENDL; } -void LLViewerWindow::stopGL(BOOL save_state) +void LLViewerWindow::stopGL(bool save_state) { //Note: --bao //if not necessary, do not change the order of the function calls in this function. @@ -5761,7 +5774,7 @@ void LLViewerWindow::stopGL(BOOL save_state) gTextureList.destroyGL(save_state); stop_glerror(); - gGLManager.mIsDisabled = TRUE; + gGLManager.mIsDisabled = true; stop_glerror(); //unload shader's @@ -5782,7 +5795,7 @@ void LLViewerWindow::restoreGL(const std::string& progress_message) if (gGLManager.mIsDisabled) { LL_INFOS() << "Restoring GL..." << LL_ENDL; - gGLManager.mIsDisabled = FALSE; + gGLManager.mIsDisabled = false; initGLDefaults(); LLGLState::restoreGL(); @@ -5802,8 +5815,8 @@ void LLViewerWindow::restoreGL(const std::string& progress_message) LLVOAvatar::restoreGL(); LLVOPartGroup::restoreGL(); - gResizeScreenTexture = TRUE; - gWindowResized = TRUE; + gResizeScreenTexture = true; + gWindowResized = true; if (isAgentAvatarValid() && gAgentAvatarp->isEditingAppearance()) { @@ -5813,8 +5826,8 @@ void LLViewerWindow::restoreGL(const std::string& progress_message) if (!progress_message.empty()) { gRestoreGLTimer.reset(); - gRestoreGL = TRUE; - setShowProgress(TRUE); + gRestoreGL = true; + setShowProgress(true); setProgressString(progress_message); } LL_INFOS() << "...Restoring GL done" << LL_ENDL; @@ -5864,7 +5877,7 @@ void LLViewerWindow::checkSettings() } } -void LLViewerWindow::restartDisplay(BOOL show_progress_bar) +void LLViewerWindow::restartDisplay(bool show_progress_bar) { LL_INFOS() << "Restaring GL" << LL_ENDL; stopGL(); @@ -5878,11 +5891,11 @@ void LLViewerWindow::restartDisplay(BOOL show_progress_bar) } } -BOOL LLViewerWindow::changeDisplaySettings(LLCoordScreen size, BOOL enable_vsync, BOOL show_progress_bar) +bool LLViewerWindow::changeDisplaySettings(LLCoordScreen size, bool enable_vsync, bool show_progress_bar) { - //BOOL was_maximized = gSavedSettings.getBOOL("WindowMaximized"); + //bool was_maximized = gSavedSettings.getBOOL("WindowMaximized"); - //gResizeScreenTexture = TRUE; + //gResizeScreenTexture = true; //U32 fsaa = gSavedSettings.getU32("RenderFSAASamples"); @@ -5896,7 +5909,7 @@ BOOL LLViewerWindow::changeDisplaySettings(LLCoordScreen size, BOOL enable_vsync //if (fsaa == old_fsaa) { - return TRUE; + return true; } /* @@ -5904,14 +5917,14 @@ BOOL LLViewerWindow::changeDisplaySettings(LLCoordScreen size, BOOL enable_vsync // Close floaters that don't handle settings change LLFloaterReg::hideInstance("snapshot"); - BOOL result_first_try = FALSE; - BOOL result_second_try = FALSE; + bool result_first_try = false; + bool result_second_try = false; LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus(); send_agent_pause(); LL_INFOS() << "Stopping GL during changeDisplaySettings" << LL_ENDL; stopGL(); - mIgnoreActivate = TRUE; + mIgnoreActivate = true; LLCoordScreen old_size; LLCoordScreen old_pos; mWindow->getSize(&old_size); @@ -5929,8 +5942,8 @@ BOOL LLViewerWindow::changeDisplaySettings(LLCoordScreen size, BOOL enable_vsync { // we are stuck...try once again with a minimal resolution? send_agent_resume(); - mIgnoreActivate = FALSE; - return FALSE; + mIgnoreActivate = false; + return false; } } send_agent_resume(); @@ -5954,7 +5967,7 @@ BOOL LLViewerWindow::changeDisplaySettings(LLCoordScreen size, BOOL enable_vsync size = old_size; // for reshape below } - BOOL success = result_first_try || result_second_try; + bool success = result_first_try || result_second_try; if (success) { @@ -5972,7 +5985,7 @@ BOOL LLViewerWindow::changeDisplaySettings(LLCoordScreen size, BOOL enable_vsync } } - mIgnoreActivate = FALSE; + mIgnoreActivate = false; gFocusMgr.setKeyboardFocus(keyboard_focus); return success; @@ -6045,7 +6058,7 @@ LLRect LLViewerWindow::getChatConsoleRect() console_rect.mLeft += CONSOLE_PADDING_LEFT; - static const BOOL CHAT_FULL_WIDTH = gSavedSettings.getBOOL("ChatFullWidth"); + static const bool CHAT_FULL_WIDTH = gSavedSettings.getBOOL("ChatFullWidth"); if (CHAT_FULL_WIDTH) { @@ -6079,7 +6092,22 @@ void LLViewerWindow::reshapeStatusBarContainer() // collapse status_bar_container new_height -= nav_bar_container->getRect().getHeight(); } - status_bar_container->reshape(new_width, new_height, TRUE); + status_bar_container->reshape(new_width, new_height, true); +} + +void LLViewerWindow::resetStatusBarContainer() +{ + LLNavigationBar* navbar = LLNavigationBar::getInstance(); + if (gSavedSettings.getBOOL("ShowNavbarNavigationPanel") || navbar->getVisible()) + { + // was previously showing navigation bar + LLView* nav_bar_container = getRootView()->getChild<LLView>("nav_bar_container"); + LLPanel* status_bar_container = getRootView()->getChild<LLPanel>("status_bar_container"); + S32 new_height = status_bar_container->getRect().getHeight(); + S32 new_width = status_bar_container->getRect().getWidth(); + new_height -= nav_bar_container->getRect().getHeight(); + status_bar_container->reshape(new_width, new_height, true); + } } //---------------------------------------------------------------------------- @@ -6090,7 +6118,7 @@ void LLViewerWindow::setUIVisibility(bool visible) if (!visible) { - gAgentCamera.changeCameraToThirdPerson(FALSE); + gAgentCamera.changeCameraToThirdPerson(false); gFloaterView->hideAllFloaters(); } else @@ -6103,8 +6131,8 @@ void LLViewerWindow::setUIVisibility(bool visible) gToolBarView->setToolBarsVisible(visible); } - LLNavigationBar::getInstance()->setVisible(visible ? gSavedSettings.getBOOL("ShowNavbarNavigationPanel") : FALSE); - LLPanelTopInfoBar::getInstance()->setVisible(visible? gSavedSettings.getBOOL("ShowMiniLocationPanel") : FALSE); + LLNavigationBar::getInstance()->setVisible(visible ? gSavedSettings.getBOOL("ShowNavbarNavigationPanel") : false); + LLPanelTopInfoBar::getInstance()->setVisible(visible? gSavedSettings.getBOOL("ShowMiniLocationPanel") : false); mRootView->getChildView("status_bar_container")->setVisible(visible); } @@ -6121,7 +6149,7 @@ LLPickInfo::LLPickInfo() : mKeyMask(MASK_NONE), mPickCallback(NULL), mPickType(PICK_INVALID), - mWantSurfaceInfo(FALSE), + mWantSurfaceInfo(false), mObjectFace(-1), mUVCoords(-1.f, -1.f), mSTCoords(-1.f, -1.f), @@ -6131,20 +6159,20 @@ LLPickInfo::LLPickInfo() mTangent(), mBinormal(), mHUDIcon(NULL), - mPickTransparent(FALSE), - mPickRigged(FALSE), - mPickParticle(FALSE) + mPickTransparent(false), + mPickRigged(false), + mPickParticle(false) { } LLPickInfo::LLPickInfo(const LLCoordGL& mouse_pos, MASK keyboard_mask, - BOOL pick_transparent, - BOOL pick_rigged, - BOOL pick_particle, - BOOL pick_reflection_probe, - BOOL pick_uv_coords, - BOOL pick_unselectable, + bool pick_transparent, + bool pick_rigged, + bool pick_particle, + bool pick_reflection_probe, + bool pick_uv_coords, + bool pick_unselectable, void (*pick_callback)(const LLPickInfo& pick_info)) : mMousePt(mouse_pos), mKeyMask(keyboard_mask), diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index 93c78cbacc..1f34495f23 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -91,12 +91,12 @@ public: LLPickInfo(); LLPickInfo(const LLCoordGL& mouse_pos, MASK keyboard_mask, - BOOL pick_transparent, - BOOL pick_rigged, - BOOL pick_particle, - BOOL pick_reflection_probe, - BOOL pick_surface_info, - BOOL pick_unselectable, + bool pick_transparent, + bool pick_rigged, + bool pick_particle, + bool pick_reflection_probe, + bool pick_surface_info, + bool pick_unselectable, void (*pick_callback)(const LLPickInfo& pick_info)); void fetchResults(); @@ -129,17 +129,17 @@ public: LLVector3 mNormal; LLVector4 mTangent; LLVector3 mBinormal; - BOOL mPickTransparent; - BOOL mPickRigged; - BOOL mPickParticle; - BOOL mPickUnselectable; - BOOL mPickReflectionProbe = FALSE; + bool mPickTransparent; + bool mPickRigged; + bool mPickParticle; + bool mPickUnselectable; + bool mPickReflectionProbe = false; void getSurfaceInfo(); private: void updateXYCoords(); - BOOL mWantSurfaceInfo; // do we populate mUVCoord, mNormal, mBinormal? + bool mWantSurfaceInfo; // do we populate mUVCoord, mNormal, mBinormal? }; @@ -184,28 +184,29 @@ public: void handlePieMenu(S32 x, S32 y, MASK mask); void reshapeStatusBarContainer(); + void resetStatusBarContainer(); // undo changes done by resetStatusBarContainer on initWorldUI() - BOOL handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mask, EMouseClickType clicktype, BOOL down, bool &is_toolmgr_action); + bool handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mask, EMouseClickType clicktype, bool down, bool &is_toolmgr_action); // // LLWindowCallback interface implementation // - /*virtual*/ BOOL handleTranslatedKeyDown(KEY key, MASK mask, BOOL repeated); - /*virtual*/ BOOL handleTranslatedKeyUp(KEY key, MASK mask); - /*virtual*/ void handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level); - /*virtual*/ BOOL handleUnicodeChar(llwchar uni_char, MASK mask); // NOT going to handle extended - /*virtual*/ BOOL handleUnicodeString(char *uni_str, bool editing); - /*virtual*/ BOOL handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask); - /*virtual*/ BOOL handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask); - /*virtual*/ BOOL handleCloseRequest(LLWindow *window); + /*virtual*/ bool handleTranslatedKeyDown(KEY key, MASK mask, bool repeated); + /*virtual*/ bool handleTranslatedKeyUp(KEY key, MASK mask); + /*virtual*/ void handleScanKey(KEY key, bool key_down, bool key_up, bool key_level); + /*virtual*/ bool handleUnicodeChar(llwchar uni_char, MASK mask); // NOT going to handle extended + /*virtual*/ bool handleUnicodeString(char *uni_str, bool editing); + /*virtual*/ bool handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask); + /*virtual*/ bool handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask); + /*virtual*/ bool handleCloseRequest(LLWindow *window); /*virtual*/ void handleQuit(LLWindow *window); - /*virtual*/ BOOL handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK mask); - /*virtual*/ BOOL handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask); - /*virtual*/ BOOL handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask); - /*virtual*/ BOOL handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask); - /*virtual*/ BOOL handleOtherMouseDown(LLWindow *window, LLCoordGL pos, MASK mask, S32 button); - /*virtual*/ BOOL handleOtherMouseUp(LLWindow *window, LLCoordGL pos, MASK mask, S32 button); - BOOL handleOtherMouse(LLWindow *window, LLCoordGL pos, MASK mask, S32 button, bool down); + /*virtual*/ bool handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK mask); + /*virtual*/ bool handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask); + /*virtual*/ bool handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask); + /*virtual*/ bool handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask); + /*virtual*/ bool handleOtherMouseDown(LLWindow *window, LLCoordGL pos, MASK mask, S32 button); + /*virtual*/ bool handleOtherMouseUp(LLWindow *window, LLCoordGL pos, MASK mask, S32 button); + bool handleOtherMouse(LLWindow *window, LLCoordGL pos, MASK mask, S32 button, bool down); /*virtual*/ LLWindowCallbacks::DragNDropResult handleDragNDrop(LLWindow *window, LLCoordGL pos, MASK mask, LLWindowCallbacks::DragNDropAction action, std::string data); void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask); void handleMouseDragged(LLWindow *window, LLCoordGL pos, MASK mask); @@ -213,20 +214,20 @@ public: /*virtual*/ void handleResize(LLWindow *window, S32 x, S32 y); /*virtual*/ void handleFocus(LLWindow *window); /*virtual*/ void handleFocusLost(LLWindow *window); - /*virtual*/ BOOL handleActivate(LLWindow *window, BOOL activated); - /*virtual*/ BOOL handleActivateApp(LLWindow *window, BOOL activating); + /*virtual*/ bool handleActivate(LLWindow *window, bool activated); + /*virtual*/ bool handleActivateApp(LLWindow *window, bool activating); /*virtual*/ void handleMenuSelect(LLWindow *window, S32 menu_item); - /*virtual*/ BOOL handlePaint(LLWindow *window, S32 x, S32 y, S32 width, S32 height); + /*virtual*/ bool handlePaint(LLWindow *window, S32 x, S32 y, S32 width, S32 height); /*virtual*/ void handleScrollWheel(LLWindow *window, S32 clicks); /*virtual*/ void handleScrollHWheel(LLWindow *window, S32 clicks); - /*virtual*/ BOOL handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK mask); + /*virtual*/ bool handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK mask); /*virtual*/ void handleWindowBlock(LLWindow *window); /*virtual*/ void handleWindowUnblock(LLWindow *window); /*virtual*/ void handleDataCopy(LLWindow *window, S32 data_type, void *data); - /*virtual*/ BOOL handleTimerEvent(LLWindow *window); - /*virtual*/ BOOL handleDeviceChange(LLWindow *window); - /*virtual*/ BOOL handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32 window_width, S32 window_height); - /*virtual*/ BOOL handleWindowDidChangeScreen(LLWindow *window); + /*virtual*/ bool handleTimerEvent(LLWindow *window); + /*virtual*/ bool handleDeviceChange(LLWindow *window); + /*virtual*/ bool handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32 window_width, S32 window_height); + /*virtual*/ bool handleWindowDidChangeScreen(LLWindow *window); /*virtual*/ void handlePingWatchdog(LLWindow *window, const char * msg); /*virtual*/ void handlePauseWatchdog(LLWindow *window); @@ -281,9 +282,9 @@ public: S32 getCurrentMouseDY() const { return mCurrentMouseDelta.mY; } LLCoordGL getCurrentMouseDelta() const { return mCurrentMouseDelta; } static LLTrace::SampleStatHandle<>* getMouseVelocityStat() { return &sMouseVelocityStat; } - BOOL getLeftMouseDown() const { return mLeftMouseDown; } - BOOL getMiddleMouseDown() const { return mMiddleMouseDown; } - BOOL getRightMouseDown() const { return mRightMouseDown; } + bool getLeftMouseDown() const { return mLeftMouseDown; } + bool getMiddleMouseDown() const { return mMiddleMouseDown; } + bool getRightMouseDown() const { return mRightMouseDown; } const LLPickInfo& getLastPick() const { return mLastPick; } @@ -298,7 +299,7 @@ public: // Is window of our application frontmost? - BOOL getActive() const { return mActive; } + bool getActive() const { return mActive; } const std::string& getInitAlert() { return mInitAlert; } @@ -310,16 +311,16 @@ public: void setCursor( ECursorType c ); void showCursor(); void hideCursor(); - BOOL getCursorHidden() { return mCursorHidden; } + bool getCursorHidden() { return mCursorHidden; } void moveCursorToCenter(); // move to center of window void initTextures(S32 location_id); - void setShowProgress(const BOOL show); - BOOL getShowProgress() const; + void setShowProgress(const bool show); + bool getShowProgress() const; void setProgressString(const std::string& string); void setProgressPercent(const F32 percent); void setProgressMessage(const std::string& msg); - void setProgressCancelButtonVisible( BOOL b, const std::string& label = LLStringUtil::null ); + void setProgressCancelButtonVisible( bool b, const std::string& label = LLStringUtil::null ); LLProgressView *getProgressView() const; void revealIntroPanel(); void setStartupComplete(); @@ -335,8 +336,8 @@ public: LLView* getToolBarHolder() { return mToolBarHolder.get(); } LLView* getHintHolder() { return mHintHolder.get(); } LLView* getLoginPanelHolder() { return mLoginPanelHolder.get(); } - BOOL handleKey(KEY key, MASK mask); - BOOL handleKeyUp(KEY key, MASK mask); + bool handleKey(KEY key, MASK mask); + bool handleKeyUp(KEY key, MASK mask); void handleScrollWheel (S32 clicks); void handleScrollHWheel (S32 clicks); @@ -346,7 +347,7 @@ public: void clearPopups(); // Hide normal UI when a logon fails, re-show everything when logon is attempted again - void setNormalControlsVisible( BOOL visible ); + void setNormalControlsVisible( bool visible ); void setMenuBackgroundColor(bool god_mode = false, bool dev_grid = false); void reshape(S32 width, S32 height); @@ -363,11 +364,11 @@ public: // snapshot functionality. // perhaps some of this should move to llfloatershapshot? -MG - BOOL saveSnapshot(const std::string& filename, S32 image_width, S32 image_height, BOOL show_ui = TRUE, BOOL show_hud = TRUE, BOOL do_rebuild = FALSE, LLSnapshotModel::ESnapshotLayerType type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR, LLSnapshotModel::ESnapshotFormat format = LLSnapshotModel::SNAPSHOT_FORMAT_BMP); - BOOL rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height, BOOL keep_window_aspect = TRUE, BOOL is_texture = FALSE, - BOOL show_ui = TRUE, BOOL show_hud = TRUE, BOOL do_rebuild = FALSE, BOOL no_post = FALSE, LLSnapshotModel::ESnapshotLayerType type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR, S32 max_size = MAX_SNAPSHOT_IMAGE_SIZE); + bool saveSnapshot(const std::string& filename, S32 image_width, S32 image_height, bool show_ui = true, bool show_hud = true, bool do_rebuild = false, LLSnapshotModel::ESnapshotLayerType type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR, LLSnapshotModel::ESnapshotFormat format = LLSnapshotModel::SNAPSHOT_FORMAT_BMP); + bool rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height, bool keep_window_aspect = true, bool is_texture = false, + bool show_ui = true, bool show_hud = true, bool do_rebuild = false, bool no_post = false, LLSnapshotModel::ESnapshotLayerType type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR, S32 max_size = MAX_SNAPSHOT_IMAGE_SIZE); - BOOL simpleSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height, const int num_render_passes); + bool simpleSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height, const int num_render_passes); @@ -377,20 +378,20 @@ public: // index - cube index in the array to use (cube index, not face-layer) // face - which cube face to update // near_clip - near clip setting to use - BOOL cubeSnapshot(const LLVector3 &origin, LLCubeMapArray *cubearray, S32 index, S32 face, F32 near_clip, bool render_avatars, + bool cubeSnapshot(const LLVector3 &origin, LLCubeMapArray *cubearray, S32 index, S32 face, F32 near_clip, bool render_avatars, bool customCullingPlane = false, LLPlane cullingPlane = LLPlane(LLVector3(0, 0, 0), LLVector3(0, 0, 1))); // special implementation of simpleSnapshot for reflection maps - BOOL reflectionSnapshot(LLImageRaw* raw, S32 image_width, S32 image_height, const int num_render_passes); + bool reflectionSnapshot(LLImageRaw* raw, S32 image_width, S32 image_height, const int num_render_passes); - BOOL thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL show_hud, BOOL do_rebuild, BOOL no_post, LLSnapshotModel::ESnapshotLayerType type); - BOOL isSnapshotLocSet() const; + bool thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, bool show_ui, bool show_hud, bool do_rebuild, bool no_post, LLSnapshotModel::ESnapshotLayerType type); + bool isSnapshotLocSet() const; void resetSnapshotLoc() const; typedef boost::signals2::signal<void(void)> snapshot_saved_signal_t; - void saveImageNumbered(LLImageFormatted *image, BOOL force_picker, const snapshot_saved_signal_t::slot_type& success_cb, const snapshot_saved_signal_t::slot_type& failure_cb); + void saveImageNumbered(LLImageFormatted *image, bool force_picker, const snapshot_saved_signal_t::slot_type& success_cb, const snapshot_saved_signal_t::slot_type& failure_cb); void onDirectorySelected(const std::vector<std::string>& filenames, LLImageFormatted *image, const snapshot_saved_signal_t::slot_type& success_cb, const snapshot_saved_signal_t::slot_type& failure_cb); void saveImageLocal(LLImageFormatted *image, const snapshot_saved_signal_t::slot_type& success_cb, const snapshot_saved_signal_t::slot_type& failure_cb); void onSelectionFailure(const snapshot_saved_signal_t::slot_type& failure_cb); @@ -402,7 +403,7 @@ public: void playSnapshotAnimAndSound(); // draws selection boxes around selected objects, must call displayObjects first - void renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, BOOL for_hud ); + void renderSelections( bool for_gl_pick, bool pick_parcel_walls, bool for_hud ); void performPick(); void returnEmptyPicks(); @@ -410,21 +411,21 @@ public: S32 y_from_bot, MASK mask, void (*callback)(const LLPickInfo& pick_info), - BOOL pick_transparent = FALSE, - BOOL pick_rigged = FALSE, - BOOL pick_unselectable = FALSE, - BOOL pick_reflection_probes = FALSE); - LLPickInfo pickImmediate(S32 x, S32 y, BOOL pick_transparent, BOOL pick_rigged = FALSE, BOOL pick_particle = FALSE, BOOL pick_unselectable = TRUE, BOOL pick_reflection_probe = FALSE); + bool pick_transparent = false, + bool pick_rigged = false, + bool pick_unselectable = false, + bool pick_reflection_probes = false); + LLPickInfo pickImmediate(S32 x, S32 y, bool pick_transparent, bool pick_rigged = false, bool pick_particle = false, bool pick_unselectable = true, bool pick_reflection_probe = false); LLHUDIcon* cursorIntersectIcon(S32 mouse_x, S32 mouse_y, F32 depth, LLVector4a* intersection); LLViewerObject* cursorIntersect(S32 mouse_x = -1, S32 mouse_y = -1, F32 depth = 512.f, LLViewerObject *this_object = NULL, S32 this_face = -1, - BOOL pick_transparent = FALSE, - BOOL pick_rigged = FALSE, - BOOL pick_unselectable = TRUE, - BOOL pick_reflection_probe = TRUE, + bool pick_transparent = false, + bool pick_rigged = false, + bool pick_unselectable = true, + bool pick_reflection_probe = true, S32* face_hit = NULL, S32* gltf_node_hit = nullptr, S32* gltf_primitive_hit = nullptr, @@ -444,10 +445,10 @@ public: //const LLVector3d& lastNonFloraObjectHitOffset(); // mousePointOnLand() returns true if found point - BOOL mousePointOnLandGlobal(const S32 x, const S32 y, LLVector3d *land_pos_global, BOOL ignore_distance = FALSE); - BOOL mousePointOnPlaneGlobal(LLVector3d& point, const S32 x, const S32 y, const LLVector3d &plane_point, const LLVector3 &plane_normal); + bool mousePointOnLandGlobal(const S32 x, const S32 y, LLVector3d *land_pos_global, bool ignore_distance = false); + bool mousePointOnPlaneGlobal(LLVector3d& point, const S32 x, const S32 y, const LLVector3d &plane_point, const LLVector3 &plane_normal); LLVector3d clickPointInWorldGlobal(const S32 x, const S32 y_from_bot, LLViewerObject* clicked_object) const; - BOOL clickPointOnSurfaceGlobal(const S32 x, const S32 y, LLViewerObject *objectp, LLVector3d &point_global) const; + bool clickPointOnSurfaceGlobal(const S32 x, const S32 y, LLViewerObject *objectp, LLVector3d &point_global) const; // Prints window implementation details void dumpState(); @@ -455,9 +456,9 @@ public: // handle shutting down GL and bringing it back up void requestResolutionUpdate(); void checkSettings(); - void restartDisplay(BOOL show_progress_bar); - BOOL changeDisplaySettings(LLCoordScreen size, BOOL enable_vsync, BOOL show_progress_bar); - BOOL getIgnoreDestroyWindow() { return mIgnoreActivate; } + void restartDisplay(bool show_progress_bar); + bool changeDisplaySettings(LLCoordScreen size, bool enable_vsync, bool show_progress_bar); + bool getIgnoreDestroyWindow() { return mIgnoreActivate; } F32 getWorldViewAspectRatio() const; const LLVector2& getDisplayScale() const { return mDisplayScale; } void calcDisplayScale(); @@ -471,7 +472,7 @@ private: void switchToolByMask(MASK mask); void destroyWindow(); void drawMouselookInstructions(); - void stopGL(BOOL save_state = TRUE); + void stopGL(bool save_state = true); void restoreGL(const std::string& progress_message = LLStringUtil::null); void initFonts(F32 zoom_factor = 1.f); void schedulePick(LLPickInfo& pick_info); @@ -498,9 +499,9 @@ private: LLCoordGL mCurrentMousePoint; // last mouse position in GL coords LLCoordGL mLastMousePoint; // Mouse point at last frame. LLCoordGL mCurrentMouseDelta; //amount mouse moved this frame - BOOL mLeftMouseDown; - BOOL mMiddleMouseDown; - BOOL mRightMouseDown; + bool mLeftMouseDown; + bool mMiddleMouseDown; + bool mRightMouseDown; LLProgressView *mProgressView; @@ -509,9 +510,9 @@ private: std::string mLastToolTipMessage; LLRect mToolTipStickyRect; // Once a tool tip is shown, it will stay visible until the mouse leaves this rect. - BOOL mMouseInWindow; // True if the mouse is over our window or if we have captured the mouse. - BOOL mFocusCycleMode; - BOOL mAllowMouseDragging; + bool mMouseInWindow; // True if the mouse is over our window or if we have captured the mouse. + bool mFocusCycleMode; + bool mAllowMouseDragging; LLFrameTimer mMouseDownTimer; typedef std::set<LLHandle<LLView> > view_handle_set_t; view_handle_set_t mMouseHoverViews; @@ -519,8 +520,8 @@ private: // Variables used for tool override switching based on modifier keys. JC MASK mLastMask; // used to detect changes in modifier mask LLTool* mToolStored; // the tool we're overriding - BOOL mHideCursorPermanent; // true during drags, mouselook - BOOL mCursorHidden; + bool mHideCursorPermanent; // true during drags, mouselook + bool mCursorHidden; LLPickInfo mLastPick; std::vector<LLPickInfo> mPicks; LLRect mPickScreenRegion; // area of frame buffer for rendering pick frames (generally follows mouse to avoid going offscreen) @@ -528,7 +529,7 @@ private: std::string mOverlayTitle; // Used for special titles such as "Second Life - Special E3 2003 Beta" - BOOL mIgnoreActivate; + bool mIgnoreActivate; std::string mInitAlert; // Window / GL initialization requires an alert @@ -573,9 +574,9 @@ extern S32 gDebugRaycastFaceHit; extern LLVector4a gDebugRaycastStart; extern LLVector4a gDebugRaycastEnd; -extern BOOL gDisplayCameraPos; -extern BOOL gDisplayWindInfo; -extern BOOL gDisplayFOV; -extern BOOL gDisplayBadge; +extern bool gDisplayCameraPos; +extern bool gDisplayWindInfo; +extern bool gDisplayFOV; +extern bool gDisplayBadge; #endif diff --git a/indra/newview/llvlcomposition.cpp b/indra/newview/llvlcomposition.cpp index 1ffbf20410..ba255f2b24 100644 --- a/indra/newview/llvlcomposition.cpp +++ b/indra/newview/llvlcomposition.cpp @@ -115,19 +115,29 @@ LLTerrainMaterials::~LLTerrainMaterials() unboost(); } -BOOL LLTerrainMaterials::generateMaterials() +void LLTerrainMaterials::apply(const LLModifyRegion& other) { - if (texturesReady(true, true)) + for (S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i) { - return TRUE; + const LLGLTFMaterial* other_override = other.getMaterialOverride(i); + LLGLTFMaterial* material_override = other_override ? new LLGLTFMaterial(*other_override) : nullptr; + setMaterialOverride(i, material_override); + } +} + +bool LLTerrainMaterials::generateMaterials() +{ + if (makeTexturesReady(true, true)) + { + return true; } - if (materialsReady(true, true)) + if (makeMaterialsReady(true, true)) { - return TRUE; + return true; } - return FALSE; + return false; } void LLTerrainMaterials::boost() @@ -188,24 +198,39 @@ void LLTerrainMaterials::setDetailAssetID(S32 asset, const LLUUID& id) mDetailTextures[asset] = fetch_terrain_texture(id); LLPointer<LLFetchedGLTFMaterial>& mat = mDetailMaterials[asset]; mat = id.isNull() ? nullptr : gGLTFMaterialList.getMaterial(id); + mDetailRenderMaterials[asset] = nullptr; mMaterialTexturesSet[asset] = false; } +const LLGLTFMaterial* LLTerrainMaterials::getMaterialOverride(S32 asset) const +{ + return mDetailMaterialOverrides[asset]; +} + +void LLTerrainMaterials::setMaterialOverride(S32 asset, LLGLTFMaterial* mat_override) +{ + // Non-null overrides must be nontrivial. Otherwise, please set the override to null instead. + llassert(!mat_override || *mat_override != LLGLTFMaterial::sDefault); + + mDetailMaterialOverrides[asset] = mat_override; + mDetailRenderMaterials[asset] = nullptr; +} + LLTerrainMaterials::Type LLTerrainMaterials::getMaterialType() { LL_PROFILE_ZONE_SCOPED; - const BOOL use_textures = texturesReady(false, false) || !materialsReady(false, false); + const bool use_textures = makeTexturesReady(false, false) || !makeMaterialsReady(false, false); return use_textures ? Type::TEXTURE : Type::PBR; } -bool LLTerrainMaterials::texturesReady(bool boost, bool strict) +bool LLTerrainMaterials::makeTexturesReady(bool boost, bool strict) { bool ready[ASSET_COUNT]; - // *NOTE: Calls to textureReady may boost textures. Do not early-return. + // *NOTE: Calls to makeTextureReady may boost textures. Do not early-return. for (S32 i = 0; i < ASSET_COUNT; i++) { - ready[i] = mDetailTextures[i].notNull() && textureReady(mDetailTextures[i], boost); + ready[i] = mDetailTextures[i].notNull() && makeTextureReady(mDetailTextures[i], boost); } bool one_ready = false; @@ -221,13 +246,36 @@ bool LLTerrainMaterials::texturesReady(bool boost, bool strict) return one_ready; } -bool LLTerrainMaterials::materialsReady(bool boost, bool strict) +namespace +{ + bool material_asset_ready(LLFetchedGLTFMaterial* mat) { return mat && mat->isLoaded(); } +}; + +bool LLTerrainMaterials::makeMaterialsReady(bool boost, bool strict) { bool ready[ASSET_COUNT]; - // *NOTE: Calls to materialReady may boost materials/textures. Do not early-return. + // *NOTE: This section may boost materials/textures. Do not early-return if ready[i] is false. for (S32 i = 0; i < ASSET_COUNT; i++) { - ready[i] = materialReady(mDetailMaterials[i], mMaterialTexturesSet[i], boost, strict); + ready[i] = false; + LLPointer<LLFetchedGLTFMaterial>& mat = mDetailMaterials[i]; + if (!material_asset_ready(mat)) { continue; } + + LLPointer<LLFetchedGLTFMaterial>& render_mat = mDetailRenderMaterials[i]; + if (!render_mat) + { + render_mat = new LLFetchedGLTFMaterial(); + *render_mat = *mat; + // This render_mat is effectively already loaded, because it gets its data from mat. + + LLPointer<LLGLTFMaterial>& override_mat = mDetailMaterialOverrides[i]; + if (override_mat) + { + render_mat->applyOverride(*override_mat); + } + } + + ready[i] = materialTexturesReady(render_mat, mMaterialTexturesSet[i], boost, strict); } #if 1 @@ -267,7 +315,7 @@ bool LLTerrainMaterials::materialsReady(bool boost, bool strict) // Boost the texture loading priority // Return true when ready to use (i.e. texture is sufficiently loaded) // static -bool LLTerrainMaterials::textureReady(LLPointer<LLViewerFetchedTexture>& tex, bool boost) +bool LLTerrainMaterials::makeTextureReady(LLPointer<LLViewerFetchedTexture>& tex, bool boost) { llassert(tex); if (!tex) { return false; } @@ -308,15 +356,13 @@ bool LLTerrainMaterials::textureReady(LLPointer<LLViewerFetchedTexture>& tex, bo return true; } -// Boost the loading priority of every known texture in the material -// Return true when ready to use +// Make sure to call material_asset_ready first +// strict = true -> all materials must be sufficiently loaded +// strict = false -> at least one material must be loaded // static -bool LLTerrainMaterials::materialReady(LLPointer<LLFetchedGLTFMaterial> &mat, bool &textures_set, bool boost, bool strict) +bool LLTerrainMaterials::materialTexturesReady(LLPointer<LLFetchedGLTFMaterial>& mat, bool& textures_set, bool boost, bool strict) { - if (!mat || !mat->isLoaded()) - { - return false; - } + llassert(mat); // Material is loaded, but textures may not be if (!textures_set) @@ -331,17 +377,17 @@ bool LLTerrainMaterials::materialReady(LLPointer<LLFetchedGLTFMaterial> &mat, bo mat->mEmissiveTexture = fetch_terrain_texture(mat->mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_EMISSIVE]); } - // *NOTE: Calls to textureReady may boost textures. Do not early-return. + // *NOTE: Calls to makeTextureReady may boost textures. Do not early-return. bool ready[LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT]; ready[LLGLTFMaterial::GLTF_TEXTURE_INFO_BASE_COLOR] = - mat->mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_BASE_COLOR].isNull() || textureReady(mat->mBaseColorTexture, boost); + mat->mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_BASE_COLOR].isNull() || makeTextureReady(mat->mBaseColorTexture, boost); ready[LLGLTFMaterial::GLTF_TEXTURE_INFO_NORMAL] = - mat->mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_NORMAL].isNull() || textureReady(mat->mNormalTexture, boost); + mat->mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_NORMAL].isNull() || makeTextureReady(mat->mNormalTexture, boost); ready[LLGLTFMaterial::GLTF_TEXTURE_INFO_METALLIC_ROUGHNESS] = mat->mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_METALLIC_ROUGHNESS].isNull() || - textureReady(mat->mMetallicRoughnessTexture, boost); + makeTextureReady(mat->mMetallicRoughnessTexture, boost); ready[LLGLTFMaterial::GLTF_TEXTURE_INFO_EMISSIVE] = - mat->mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_EMISSIVE].isNull() || textureReady(mat->mEmissiveTexture, boost); + mat->mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_EMISSIVE].isNull() || makeTextureReady(mat->mEmissiveTexture, boost); if (strict) { @@ -357,6 +403,16 @@ bool LLTerrainMaterials::materialReady(LLPointer<LLFetchedGLTFMaterial> &mat, bo return true; } +// Boost the loading priority of every known texture in the material +// Return true when ready to use +// static +bool LLTerrainMaterials::makeMaterialReady(LLPointer<LLFetchedGLTFMaterial> &mat, bool &textures_set, bool boost, bool strict) +{ + if (!material_asset_ready(mat)) { return false; } + + return materialTexturesReady(mat, textures_set, boost, strict); +} + // static const LLUUID (&LLVLComposition::getDefaultTextures())[ASSET_COUNT] { @@ -403,13 +459,13 @@ void LLVLComposition::setSurface(LLSurface *surfacep) mSurfacep = surfacep; } -BOOL LLVLComposition::generateHeights(const F32 x, const F32 y, +bool LLVLComposition::generateHeights(const F32 x, const F32 y, const F32 width, const F32 height) { if (!mParamsReady) { // All the parameters haven't been set yet (we haven't gotten the message from the sim) - return FALSE; + return false; } llassert(mSurfacep); @@ -417,7 +473,7 @@ BOOL LLVLComposition::generateHeights(const F32 x, const F32 y, if (!mSurfacep || !mSurfacep->getRegion()) { // We don't always have the region yet here.... - return FALSE; + return false; } S32 x_begin, y_begin, x_end, y_end; @@ -499,17 +555,17 @@ BOOL LLVLComposition::generateHeights(const F32 x, const F32 y, *(mDatap + i + j*mWidth) = scaled_noisy_height; } } - return TRUE; + return true; } LLTerrainMaterials gLocalTerrainMaterials; -BOOL LLVLComposition::generateComposition() +bool LLVLComposition::generateComposition() { if (!mParamsReady) { // All the parameters haven't been set yet (we haven't gotten the message from the sim) - return FALSE; + return false; } return LLTerrainMaterials::generateMaterials(); @@ -586,7 +642,7 @@ namespace }; PendingImage* pending_image = new PendingImage(raw_image, ddiscard, tex->getID()); - loaded_callback_func cb = [](BOOL success, LLViewerFetchedTexture * src_vi, LLImageRaw * src, LLImageRaw * src_aux, S32 discard_level, BOOL is_final, void* userdata) { + loaded_callback_func cb = [](bool success, LLViewerFetchedTexture * src_vi, LLImageRaw * src, LLImageRaw * src_aux, S32 discard_level, bool is_final, void* userdata) { PendingImage* pending = (PendingImage*)userdata; // Owning LLVLComposition still exists @@ -617,7 +673,7 @@ namespace } }; -BOOL LLVLComposition::generateMinimapTileLand(const F32 x, const F32 y, +bool LLVLComposition::generateMinimapTileLand(const F32 x, const F32 y, const F32 width, const F32 height) { LL_PROFILE_ZONE_SCOPED @@ -638,11 +694,11 @@ BOOL LLVLComposition::generateMinimapTileLand(const F32 x, const F32 y, const bool use_textures = getMaterialType() != LLTerrainMaterials::Type::PBR; if (use_textures) { - if (!texturesReady(true, true)) { return FALSE; } + if (!makeTexturesReady(true, true)) { return false; } } else { - if (!materialsReady(true, true)) { return FALSE; } + if (!makeMaterialsReady(true, true)) { return false; } } for (S32 i = 0; i < ASSET_COUNT; i++) @@ -668,27 +724,28 @@ BOOL LLVLComposition::generateMinimapTileLand(const F32 x, const F32 y, } else { - tex = mDetailMaterials[i]->mBaseColorTexture; - tex_emissive = mDetailMaterials[i]->mEmissiveTexture; - base_color_factor = LLColor3(mDetailMaterials[i]->mBaseColor); + LLPointer<LLFetchedGLTFMaterial>& mat = mDetailRenderMaterials[i]; + tex = mat->mBaseColorTexture; + tex_emissive = mat->mEmissiveTexture; + base_color_factor = LLColor3(mat->mBaseColor); // *HACK: Treat alpha as black - base_color_factor *= (mDetailMaterials[i]->mBaseColor.mV[VW]); - emissive_factor = mDetailMaterials[i]->mEmissiveColor; + base_color_factor *= (mat->mBaseColor.mV[VW]); + emissive_factor = mat->mEmissiveColor; has_base_color_factor = (base_color_factor.mV[VX] != 1.f || base_color_factor.mV[VY] != 1.f || base_color_factor.mV[VZ] != 1.f); has_emissive_factor = (emissive_factor.mV[VX] != 1.f || emissive_factor.mV[VY] != 1.f || emissive_factor.mV[VZ] != 1.f); - has_alpha = mDetailMaterials[i]->mAlphaMode != LLGLTFMaterial::ALPHA_MODE_OPAQUE; + has_alpha = mat->mAlphaMode != LLGLTFMaterial::ALPHA_MODE_OPAQUE; } if (!tex) { tex = LLViewerFetchedTexture::sWhiteImagep; } bool delete_raw_post = false; bool delete_raw_post_emissive = false; - if (!prepare_raw_image(mRawImagesBaseColor[i], false, tex, delete_raw_post)) { return FALSE; } - if (tex_emissive && !prepare_raw_image(mRawImagesEmissive[i], true, tex_emissive, delete_raw_post_emissive)) { return FALSE; } + if (!prepare_raw_image(mRawImagesBaseColor[i], false, tex, delete_raw_post)) { return false; } + if (tex_emissive && !prepare_raw_image(mRawImagesEmissive[i], true, tex_emissive, delete_raw_post_emissive)) { return false; } // tex_emissive can be null, and then will be ignored // In the simplest case, the minimap image is just the base color. @@ -819,7 +876,7 @@ BOOL LLVLComposition::generateMinimapTileLand(const F32 x, const F32 y, if (tex_comps != st_comps) { llassert(false); - return FALSE; + return false; } tex_x_scalef = (F32)tex_width / (F32)mWidth; @@ -921,7 +978,7 @@ BOOL LLVLComposition::generateMinimapTileLand(const F32 x, const F32 y, unboost_minimap_material(mDetailMaterials[i]); } - return TRUE; + return true; } F32 LLVLComposition::getStartHeight(S32 corner) diff --git a/indra/newview/llvlcomposition.h b/indra/newview/llvlcomposition.h index e0b08a3aca..61c35ade28 100644 --- a/indra/newview/llvlcomposition.h +++ b/indra/newview/llvlcomposition.h @@ -35,9 +35,16 @@ class LLSurface; class LLViewerFetchedTexture; +class LLGLTFMaterial; class LLFetchedGLTFMaterial; -class LLTerrainMaterials +class LLModifyRegion +{ +public: + virtual const LLGLTFMaterial* getMaterialOverride(S32 asset) const = 0; +}; + +class LLTerrainMaterials : public LLModifyRegion { public: friend class LLDrawPoolTerrain; @@ -45,6 +52,8 @@ public: LLTerrainMaterials(); virtual ~LLTerrainMaterials(); + void apply(const LLModifyRegion& other); + // Heights map into textures (or materials) as 0-1 = first, 1-2 = second, etc. // So we need to compress heights into this range. static const S32 ASSET_COUNT = 4; @@ -56,26 +65,33 @@ public: COUNT }; - BOOL generateMaterials(); + bool generateMaterials(); void boost(); virtual LLUUID getDetailAssetID(S32 asset); virtual void setDetailAssetID(S32 asset, const LLUUID& id); + const LLGLTFMaterial* getMaterialOverride(S32 asset) const override; + virtual void setMaterialOverride(S32 asset, LLGLTFMaterial* mat_override); Type getMaterialType(); - bool texturesReady(bool boost, bool strict); + bool makeTexturesReady(bool boost, bool strict); // strict = true -> all materials must be sufficiently loaded // strict = false -> at least one material must be loaded - bool materialsReady(bool boost, bool strict); + bool makeMaterialsReady(bool boost, bool strict); protected: void unboost(); - static bool textureReady(LLPointer<LLViewerFetchedTexture>& tex, bool boost); + static bool makeTextureReady(LLPointer<LLViewerFetchedTexture>& tex, bool boost); // strict = true -> all materials must be sufficiently loaded // strict = false -> at least one material must be loaded - static bool materialReady(LLPointer<LLFetchedGLTFMaterial>& mat, bool& textures_set, bool boost, bool strict); + static bool makeMaterialReady(LLPointer<LLFetchedGLTFMaterial>& mat, bool& textures_set, bool boost, bool strict); + // *NOTE: Prefer calling makeMaterialReady if mat is known to be LLFetchedGLTFMaterial + static bool materialTexturesReady(LLPointer<LLFetchedGLTFMaterial>& mat, bool& textures_set, bool boost, bool strict); + LLPointer<LLViewerFetchedTexture> mDetailTextures[ASSET_COUNT]; LLPointer<LLFetchedGLTFMaterial> mDetailMaterials[ASSET_COUNT]; + LLPointer<LLGLTFMaterial> mDetailMaterialOverrides[ASSET_COUNT]; + LLPointer<LLFetchedGLTFMaterial> mDetailRenderMaterials[ASSET_COUNT]; bool mMaterialTexturesSet[ASSET_COUNT]; }; @@ -96,10 +112,10 @@ public: void setSurface(LLSurface *surfacep); // Viewer side hack to generate composition values - BOOL generateHeights(const F32 x, const F32 y, const F32 width, const F32 height); - BOOL generateComposition(); + bool generateHeights(const F32 x, const F32 y, const F32 width, const F32 height); + bool generateComposition(); // Generate texture from composition values. - BOOL generateMinimapTileLand(const F32 x, const F32 y, const F32 width, const F32 height); + bool generateMinimapTileLand(const F32 x, const F32 y, const F32 width, const F32 height); // Use these as indeces ito the get/setters below that use 'corner' enum ECorner @@ -120,14 +136,11 @@ public: friend class LLVOSurfacePatch; friend class LLDrawPoolTerrain; - void setParamsReady() { mParamsReady = TRUE; } - BOOL getParamsReady() const { return mParamsReady; } + void setParamsReady() { mParamsReady = true; } + bool getParamsReady() const { return mParamsReady; } protected: - static bool textureReady(LLPointer<LLViewerFetchedTexture>& tex, bool boost = false); - static bool materialReady(LLPointer<LLFetchedGLTFMaterial>& mat, bool& textures_set, bool boost = false); - - BOOL mParamsReady = FALSE; + bool mParamsReady = false; LLSurface *mSurfacep; // Final minimap raw images diff --git a/indra/newview/llvlmanager.cpp b/indra/newview/llvlmanager.cpp index 901516f832..c2bcd32921 100644 --- a/indra/newview/llvlmanager.cpp +++ b/indra/newview/llvlmanager.cpp @@ -89,7 +89,7 @@ void LLVLManager::unpackData(const S32 num_packets) decode_patch_group_header(bit_pack, &goph); if (LAND_LAYER_CODE == datap->mType) { - datap->mRegionp->getLand().decompressDCTPatch(bit_pack, &goph, FALSE); + datap->mRegionp->getLand().decompressDCTPatch(bit_pack, &goph, false); } else if (WIND_LAYER_CODE == datap->mType) { diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 258ab80ea4..65fcded257 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -133,7 +133,8 @@ const F32 DEFAULT_MAX_ATTACHMENT_COMPLEXITY = 1.0e6f; // expected attachments so viewer has to wait to see if anything // else will arrive const F32 FIRST_APPEARANCE_CLOUD_MIN_DELAY = 3.f; // seconds -const F32 FIRST_APPEARANCE_CLOUD_MAX_DELAY = 45.f; +const F32 FIRST_APPEARANCE_CLOUD_MAX_DELAY = 15.f; +const F32 FIRST_APPEARANCE_CLOUD_IMPOSTOR_MODIFIER = 1.25f; using namespace LLAvatarAppearanceDefines; @@ -206,6 +207,7 @@ const U32 LLVOAvatar::VISUAL_COMPLEXITY_UNKNOWN = 0; const F64 HUD_OVERSIZED_TEXTURE_DATA_SIZE = 1024 * 1024; const F32 MAX_TEXTURE_WAIT_TIME_SEC = 60; +const F32 MAX_ATTACHMENT_WAIT_TIME_SEC = 60; const S32 MIN_NONTUNED_AVS = 5; @@ -292,7 +294,7 @@ public: //------------------------------------------------------------------------- // motions must specify whether or not they loop - virtual BOOL getLoop() { return TRUE; } + virtual bool getLoop() { return true; } // motions must report their total duration virtual F32 getDuration() { return 0.0; } @@ -328,14 +330,14 @@ public: } // called when a motion is activated - // must return TRUE to indicate success, or else + // must return true to indicate success, or else // it will be deactivated - virtual BOOL onActivate() { return TRUE; } + virtual bool onActivate() { return true; } // called per time step - // must return TRUE while it is active, and - // must return FALSE when the motion is completed. - virtual BOOL onUpdate(F32 time, U8* joint_mask) + // must return true while it is active, and + // must return false when the motion is completed. + virtual bool onUpdate(F32 time, U8* joint_mask) { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; F32 nx[2]; @@ -353,7 +355,7 @@ public: tQn.setQuat( rx, ry, 0.0f ); mTorsoState->setRotation( tQn ); - return TRUE; + return true; } // called when a motion is deactivated @@ -400,7 +402,7 @@ public: //------------------------------------------------------------------------- // motions must specify whether or not they loop - virtual BOOL getLoop() { return TRUE; } + virtual bool getLoop() { return true; } // motions must report their total duration virtual F32 getDuration() { return 0.0; } @@ -425,7 +427,7 @@ public: virtual LLMotionInitStatus onInitialize(LLCharacter *character) { mCharacter = character; - BOOL success = true; + bool success = true; if ( !mChestState->setJoint( character->getJoint( "mChest" ) ) ) { @@ -449,14 +451,14 @@ public: } // called when a motion is activated - // must return TRUE to indicate success, or else + // must return true to indicate success, or else // it will be deactivated - virtual BOOL onActivate() { return TRUE; } + virtual bool onActivate() { return true; } // called per time step - // must return TRUE while it is active, and - // must return FALSE when the motion is completed. - virtual BOOL onUpdate(F32 time, U8* joint_mask) + // must return true while it is active, and + // must return false when the motion is completed. + virtual bool onUpdate(F32 time, U8* joint_mask) { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; mBreatheRate = 1.f; @@ -465,7 +467,7 @@ public: mChestState->setRotation(LLQuaternion(breathe_amt, LLVector3(0.f, 1.f, 0.f))); - return TRUE; + return true; } // called when a motion is deactivated @@ -513,7 +515,7 @@ public: //------------------------------------------------------------------------- // motions must specify whether or not they loop - virtual BOOL getLoop() { return TRUE; } + virtual bool getLoop() { return true; } // motions must report their total duration virtual F32 getDuration() { return 0.0; } @@ -551,19 +553,19 @@ public: } // called when a motion is activated - // must return TRUE to indicate success, or else + // must return true to indicate success, or else // it will be deactivated - virtual BOOL onActivate() { return TRUE; } + virtual bool onActivate() { return true; } // called per time step - // must return TRUE while it is active, and - // must return FALSE when the motion is completed. - virtual BOOL onUpdate(F32 time, U8* joint_mask) + // must return true while it is active, and + // must return false when the motion is completed. + virtual bool onUpdate(F32 time, U8* joint_mask) { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; mPelvisState->setPosition(LLVector3::zero); - return TRUE; + return true; } // called when a motion is deactivated @@ -606,16 +608,16 @@ const LLUUID LLVOAvatar::sStepSounds[LL_MCODE_END] = }; S32 LLVOAvatar::sRenderName = RENDER_NAME_ALWAYS; -BOOL LLVOAvatar::sRenderGroupTitles = TRUE; +bool LLVOAvatar::sRenderGroupTitles = true; S32 LLVOAvatar::sNumVisibleChatBubbles = 0; -BOOL LLVOAvatar::sDebugInvisible = FALSE; -BOOL LLVOAvatar::sShowAttachmentPoints = FALSE; -BOOL LLVOAvatar::sShowAnimationDebug = FALSE; -BOOL LLVOAvatar::sVisibleInFirstPerson = FALSE; +bool LLVOAvatar::sDebugInvisible = false; +bool LLVOAvatar::sShowAttachmentPoints = false; +bool LLVOAvatar::sShowAnimationDebug = false; +bool LLVOAvatar::sVisibleInFirstPerson = false; F32 LLVOAvatar::sLODFactor = 1.f; F32 LLVOAvatar::sPhysicsLODFactor = 1.f; -BOOL LLVOAvatar::sJointDebug = FALSE; -BOOL LLVOAvatar::sLipSyncEnabled = FALSE; +bool LLVOAvatar::sJointDebug = false; +bool LLVOAvatar::sLipSyncEnabled = false; F32 LLVOAvatar::sUnbakedTime = 0.f; F32 LLVOAvatar::sUnbakedUpdateTime = 0.f; F32 LLVOAvatar::sGreyTime = 0.f; @@ -642,20 +644,20 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mAttachmentVisibleTriangleCount(0), mAttachmentEstTriangleCount(0.f), mReportedVisualComplexity(VISUAL_COMPLEXITY_UNKNOWN), - mTurning(FALSE), + mTurning(false), mLastSkeletonSerialNum( 0 ), - mIsSitting(FALSE), + mIsSitting(false), mTimeVisible(), - mTyping(FALSE), - mMeshValid(FALSE), - mVisible(FALSE), + mTyping(false), + mMeshValid(false), + mVisible(false), mLastImpostorUpdateFrameTime(0.f), mLastImpostorUpdateReason(0), mWindFreq(0.f), mRipplePhase( 0.f ), - mBelowWater(FALSE), + mBelowWater(false), mLastAppearanceBlendTime(0.f), - mAppearanceAnimating(FALSE), + mAppearanceAnimating(false), mNameIsSet(false), mTitle(), mNameAway(false), @@ -666,29 +668,30 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mNameAlpha(0.f), mRenderGroupTitles(sRenderGroupTitles), mNameCloud(false), - mFirstTEMessageReceived( FALSE ), - mFirstAppearanceMessageReceived( FALSE ), - mCulled( FALSE ), + mFirstTEMessageReceived( false ), + mFirstAppearanceMessageReceived( false ), + mCulled( false ), mVisibilityRank(0), - mNeedsSkin(FALSE), + mNeedsSkin(false), mLastSkinTime(0.f), mUpdatePeriod(1), mOverallAppearance(AOA_INVISIBLE), mVisualComplexityStale(true), mVisuallyMuteSetting(AV_RENDER_NORMALLY), mMutedAVColor(LLColor4::white /* used for "uninitialize" */), - mFirstFullyVisible(TRUE), - mFirstUseDelaySeconds(FIRST_APPEARANCE_CLOUD_MIN_DELAY), - mFullyLoaded(FALSE), - mPreviousFullyLoaded(FALSE), - mFullyLoadedInitialized(FALSE), + mFirstFullyVisible(true), + mFirstDecloudTime(-1.f), + mFullyLoaded(false), + mPreviousFullyLoaded(false), + mFullyLoadedInitialized(false), + mLastCloudAttachmentCount(0), mVisualComplexity(VISUAL_COMPLEXITY_UNKNOWN), - mLoadedCallbacksPaused(FALSE), + mLoadedCallbacksPaused(false), mLoadedCallbackTextures(0), mRenderUnloadedAvatar(LLCachedControl<bool>(gSavedSettings, "RenderUnloadedAvatar", false)), mLastRezzedStatus(-1), - mIsEditingAppearance(FALSE), - mUseLocalAppearance(FALSE), + mIsEditingAppearance(false), + mUseLocalAppearance(false), mLastUpdateRequestCOFVersion(-1), mLastUpdateReceivedCOFVersion(-1), mCachedMuteListUpdateTime(0), @@ -703,14 +706,14 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, 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 + const bool needsSendToSim = false; // currently, this HUD effect doesn't need to pack and unpack data to do its job mVoiceVisualizer = ( LLVoiceVisualizer *)LLHUDManager::getInstance()->createViewerEffect( LLHUDObject::LL_HUD_EFFECT_VOICE_VISUALIZER, needsSendToSim ); LL_DEBUGS("Avatar","Message") << "LLVOAvatar Constructor (0x" << this << ") id:" << mID << LL_ENDL; mPelvisp = NULL; mDirtyMesh = 2; // Dirty geometry, need to regenerate. - mMeshTexturesDirty = FALSE; + mMeshTexturesDirty = false; mHeadp = NULL; @@ -718,9 +721,9 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mSpeed = 0.f; setAnimationData("Speed", &mSpeed); - mNeedsImpostorUpdate = TRUE; + mNeedsImpostorUpdate = true; mLastImpostorUpdateReason = 0; - mNeedsAnimUpdate = TRUE; + mNeedsAnimUpdate = true; mNeedsExtentUpdate = true; @@ -729,22 +732,22 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, setNumTEs(TEX_NUM_INDICES); - mbCanSelect = TRUE; + mbCanSelect = true; mSignaledAnimations.clear(); mPlayingAnimations.clear(); - mWasOnGroundLeft = FALSE; - mWasOnGroundRight = FALSE; + mWasOnGroundLeft = false; + mWasOnGroundRight = false; mTimeLast = 0.0f; mSpeedAccum = 0.0f; mRippleTimeLast = 0.f; - mInAir = FALSE; + mInAir = false; - mStepOnLand = TRUE; + mStepOnLand = true; mStepMaterial = 0; mLipSyncActive = false; @@ -771,7 +774,7 @@ std::string LLVOAvatar::avString() const { if (isControlAvatar()) { - return getFullname(); + return " " + getFullname() + " "; } else { @@ -836,7 +839,7 @@ LLVOAvatar::~LLVOAvatar() std::for_each(mAttachmentPoints.begin(), mAttachmentPoints.end(), DeletePairedPointer()); mAttachmentPoints.clear(); - mDead = TRUE; + mDead = true; mAnimationSources.clear(); LLLoadedCallbackEntry::cleanUpCallbackList(&mCallbackTextureList) ; @@ -860,10 +863,10 @@ void LLVOAvatar::markDead() } -BOOL LLVOAvatar::isFullyBaked() +bool LLVOAvatar::isFullyBaked() { - if (mIsDummy) return TRUE; - if (getNumTEs() == 0) return FALSE; + if (mIsDummy) return true; + if (getNumTEs() == 0) return false; for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { @@ -871,13 +874,13 @@ BOOL LLVOAvatar::isFullyBaked() && ((i != BAKED_SKIRT) || isWearingWearableType(LLWearableType::WT_SKIRT)) && (i != BAKED_LEFT_ARM) && (i != BAKED_LEFT_LEG) && (i != BAKED_AUX1) && (i != BAKED_AUX2) && (i != BAKED_AUX3)) { - return FALSE; + return false; } } - return TRUE; + return true; } -BOOL LLVOAvatar::isFullyTextured() const +bool LLVOAvatar::isFullyTextured() const { for (S32 i = 0; i < mMeshLOD.size(); i++) { @@ -907,13 +910,13 @@ BOOL LLVOAvatar::isFullyTextured() const continue; // Mesh exists and has a composite texture. } // Fail - return FALSE; + return false; } } - return TRUE; + return true; } -BOOL LLVOAvatar::hasGray() const +bool LLVOAvatar::hasGray() const { return !getIsCloud() && !isFullyTextured(); } @@ -922,7 +925,9 @@ S32 LLVOAvatar::getRezzedStatus() const { if (getIsCloud()) return 0; bool textured = isFullyTextured(); - if (textured && allBakedTexturesCompletelyDownloaded()) return 3; + bool all_baked_loaded = allBakedTexturesCompletelyDownloaded(); + if (textured && all_baked_loaded && getAttachmentCount() == mSimAttachments.size()) return 4; + if (textured && all_baked_loaded) return 3; if (textured) return 2; llassert(hasGray()); return 1; // gray @@ -950,9 +955,9 @@ void LLVOAvatar::deleteLayerSetCaches(bool clearAll) } // static -BOOL LLVOAvatar::areAllNearbyInstancesBaked(S32& grey_avatars) +bool LLVOAvatar::areAllNearbyInstancesBaked(S32& grey_avatars) { - BOOL res = TRUE; + bool res = true; grey_avatars = 0; for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin(); iter != LLCharacter::sInstances.end(); ++iter) @@ -964,7 +969,7 @@ BOOL LLVOAvatar::areAllNearbyInstancesBaked(S32& grey_avatars) } else if( !inst->isFullyBaked() ) { - res = FALSE; + res = false; if (inst->mHasGrey) { ++grey_avatars; @@ -975,10 +980,13 @@ BOOL LLVOAvatar::areAllNearbyInstancesBaked(S32& grey_avatars) } // static -void LLVOAvatar::getNearbyRezzedStats(std::vector<S32>& counts) +void LLVOAvatar::getNearbyRezzedStats(std::vector<S32>& counts, F32& avg_cloud_time, S32& cloud_avatars) { counts.clear(); - counts.resize(4); + counts.resize(5); + avg_cloud_time = 0; + cloud_avatars = 0; + S32 count_avg = 0; for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin(); iter != LLCharacter::sInstances.end(); ++iter) { @@ -987,8 +995,23 @@ void LLVOAvatar::getNearbyRezzedStats(std::vector<S32>& counts) { S32 rez_status = inst->getRezzedStatus(); counts[rez_status]++; + F32 time = inst->getFirstDecloudTime(); + if (time >= 0) + { + avg_cloud_time+=time; + count_avg++; + } + if (!inst->isFullyLoaded() || time < 0) + { + // still renders as cloud + cloud_avatars++; + } } } + if (count_avg > 0) + { + avg_cloud_time /= count_avg; + } } // static @@ -996,8 +1019,9 @@ std::string LLVOAvatar::rezStatusToString(S32 rez_status) { if (rez_status==0) return "cloud"; if (rez_status==1) return "gray"; - if (rez_status==2) return "downloading"; - if (rez_status==3) return "full"; + if (rez_status==2) return "downloading baked"; + if (rez_status==3) return "loading attachments"; + if (rez_status==4) return "full"; return "unknown"; } @@ -1085,7 +1109,7 @@ void LLVOAvatar::restoreGL() { if (!isAgentAvatarValid()) return; - gAgentAvatarp->setCompositeUpdatesEnabled(TRUE); + gAgentAvatarp->setCompositeUpdatesEnabled(true); for (U32 i = 0; i < gAgentAvatarp->mBakedTextureDatas.size(); i++) { gAgentAvatarp->invalidateComposite(gAgentAvatarp->getTexLayerSet(i)); @@ -1109,7 +1133,7 @@ void LLVOAvatar::resetImpostors() { LLVOAvatar* avatar = (LLVOAvatar*) *iter; avatar->mImpostor.release(); - avatar->mNeedsImpostorUpdate = TRUE; + avatar->mNeedsImpostorUpdate = true; avatar->mLastImpostorUpdateReason = 1; } } @@ -1125,7 +1149,7 @@ void LLVOAvatar::deleteCachedImages(bool clearAll) LLVOAvatar* inst = (LLVOAvatar*) *iter; inst->deleteLayerSetCaches(clearAll); } - LLViewerTexLayerSet::sHasCaches = FALSE; + LLViewerTexLayerSet::sHasCaches = false; } LLVOAvatarSelf::deleteScratchTextures(); LLTexLayerStaticImageList::getInstance()->deleteCachedImages(); @@ -1297,7 +1321,7 @@ const LLVector3 LLVOAvatar::getRenderPosition() const } } -void LLVOAvatar::updateDrawable(BOOL force_damped) +void LLVOAvatar::updateDrawable(bool force_damped) { clearChanged(SHIFTED); } @@ -1628,7 +1652,7 @@ void LLVOAvatar::renderCollisionVolumes() { LLVector4a unused; - mNameText->lineSegmentIntersect(unused, unused, unused, TRUE); + mNameText->lineSegmentIntersect(unused, unused, unused, true); } } @@ -1798,11 +1822,11 @@ void LLVOAvatar::renderJoints() addDebugText(nullstr.str()); } -BOOL LLVOAvatar::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, +bool LLVOAvatar::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, S32 face, - BOOL pick_transparent, - BOOL pick_rigged, - BOOL pick_unselectable, + bool pick_transparent, + bool pick_rigged, + bool pick_unselectable, S32* face_hit, LLVector4a* intersection, LLVector2* tex_coord, @@ -1811,12 +1835,12 @@ BOOL LLVOAvatar::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& { if ((isSelf() && !gAgent.needsRenderAvatar()) || !LLPipeline::sPickAvatar) { - return FALSE; + return false; } if (isControlAvatar()) { - return FALSE; + return false; } if (lineSegmentBoundingBox(start, end)) @@ -1857,7 +1881,7 @@ BOOL LLVOAvatar::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& normal->load3(res_norm.v); } - return TRUE; + return true; } } @@ -1898,18 +1922,18 @@ BOOL LLVOAvatar::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& *intersection = position; } - return TRUE; + return true; } - return FALSE; + return false; } // virtual LLViewerObject* LLVOAvatar::lineSegmentIntersectRiggedAttachments(const LLVector4a& start, const LLVector4a& end, S32 face, - BOOL pick_transparent, - BOOL pick_rigged, - BOOL pick_unselectable, + bool pick_transparent, + bool pick_rigged, + bool pick_unselectable, S32* face_hit, LLVector4a* intersection, LLVector2* tex_coord, @@ -1995,7 +2019,7 @@ void LLVOAvatar::buildCharacter() LLAvatarAppearance::buildCharacter(); // Not done building yet; more to do. - mIsBuilt = FALSE; + mIsBuilt = false; //------------------------------------------------------------------------- // set head offset from pelvis @@ -2033,10 +2057,10 @@ void LLVOAvatar::buildCharacter() //------------------------------------------------------------------------- processAnimationStateChanges(); - mIsBuilt = TRUE; + mIsBuilt = true; stop_glerror(); - mMeshValid = TRUE; + mMeshValid = true; } //----------------------------------------------------------------------------- @@ -2120,7 +2144,7 @@ void LLVOAvatar::resetSkeleton(bool reset_animations) LL_DEBUGS("Avatar") << avString() << " reset starts" << LL_ENDL; if (!isControlAvatar() && !mLastProcessedAppearance) { - LL_WARNS() << "Can't reset avatar; no appearance message has been received yet." << LL_ENDL; + LL_WARNS() << "Can't reset avatar " << getID() << "; no appearance message has been received yet." << LL_ENDL; return; } @@ -2187,10 +2211,10 @@ void LLVOAvatar::resetSkeleton(bool reset_animations) // Stripped down approximation of // applyParsedAppearanceMessage, but with alternative default // (jellydoll) params - setCompositeUpdatesEnabled( FALSE ); + setCompositeUpdatesEnabled( false ); gPipeline.markGLRebuild(this); applyDefaultParams(); - setCompositeUpdatesEnabled( TRUE ); + setCompositeUpdatesEnabled( true ); updateMeshTextures(); updateMeshVisibility(); } @@ -2235,7 +2259,7 @@ void LLVOAvatar::releaseMeshData() ++iter) { LLAvatarJoint* joint = (*iter); - joint->setValid(FALSE, TRUE); + joint->setValid(false, true); } //cleanup data @@ -2263,10 +2287,10 @@ void LLVOAvatar::releaseMeshData() LLViewerJointAttachment* attachment = iter->second; if (!attachment->getIsHUDAttachment()) { - attachment->setAttachmentVisibility(FALSE); + attachment->setAttachmentVisibility(false); } } - mMeshValid = FALSE; + mMeshValid = false; } //----------------------------------------------------------------------------- @@ -2282,7 +2306,7 @@ void LLVOAvatar::restoreMeshData() } //LL_INFOS() << "Restoring" << LL_ENDL; - mMeshValid = TRUE; + mMeshValid = true; updateJointLODs(); for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); @@ -2292,7 +2316,7 @@ void LLVOAvatar::restoreMeshData() LLViewerJointAttachment* attachment = iter->second; if (!attachment->getIsHUDAttachment()) { - attachment->setAttachmentVisibility(TRUE); + attachment->setAttachmentVisibility(true); } } @@ -2311,7 +2335,7 @@ void LLVOAvatar::updateMeshData() S32 f_num = 0 ; const U32 VERTEX_NUMBER_THRESHOLD = 128 ;//small number of this means each part of an avatar has its own vertex buffer. - const S32 num_parts = mMeshLOD.size(); + const auto num_parts = mMeshLOD.size(); // this order is determined by number of LODS // if a mesh earlier in this list changed LODs while a later mesh doesn't, @@ -2460,19 +2484,20 @@ U32 LLVOAvatar::processUpdateMessage(LLMessageSystem *mesgsys, U32 block_num, const EObjectUpdateType update_type, LLDataPacker *dp) { - const BOOL has_name = !getNVPair("FirstName"); + const bool had_no_name = !getNVPair("FirstName"); // Do base class updates... U32 retval = LLViewerObject::processUpdateMessage(mesgsys, user_data, block_num, update_type, dp); // Print out arrival information once we have name of avatar. - if (has_name && getNVPair("FirstName")) + const bool has_name = getNVPair("FirstName"); + if (had_no_name && has_name) { mDebugExistenceTimer.reset(); - debugAvatarRezTime("AvatarRezArrivedNotification","avatar arrived"); + debugAvatarRezTime("AvatarRezArrivedNotification", "avatar arrived"); } - if(retval & LLViewerObject::INVALID_UPDATE) + if (retval & LLViewerObject::INVALID_UPDATE) { if (isSelf()) { @@ -2506,7 +2531,7 @@ LLViewerFetchedTexture *LLVOAvatar::getBakedTextureImage(const U8 te, const LLUU } LL_DEBUGS("Avatar") << avString() << "get server-bake image from URL " << url << LL_ENDL; result = LLViewerTextureManager::getFetchedTextureFromUrl( - url, FTT_SERVER_BAKE, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid); + url, FTT_SERVER_BAKE, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid); if (result->isMissingAsset()) { result->setIsMissingAsset(false); @@ -2569,6 +2594,27 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time) LL_INFOS() << "Warning! Idle on dead avatar" << LL_ENDL; return; } + + static LLCachedControl<bool> friends_only(gSavedSettings, "RenderAvatarFriendsOnly", false); + if (friends_only() + && !isUIAvatar() + && !isControlAvatar() + && !isSelf() + && !isBuddy()) + { + if (mNameText) + { + mNameIsSet = false; + mNameText->markDead(); + mNameText = NULL; + sNumVisibleChatBubbles--; + } + deleteParticleSource(); + mVoiceVisualizer->setVoiceEnabled(false); + + return; + } + // record time and refresh "tooSlow" status updateTooSlow(); @@ -2656,7 +2702,7 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time) // animate the character // store off last frame's root position to be consistent with camera position mLastRootPos = mRoot->getWorldPosition(); - BOOL detailed_update = updateCharacter(agent); + bool detailed_update = updateCharacter(agent); static LLUICachedControl<bool> visualizers_in_calls("ShowVoiceVisualizersInCalls", false); bool voice_enabled = (visualizers_in_calls || LLVoiceClient::getInstance()->inProximalChannel()) && @@ -2827,7 +2873,7 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update) LLJoint::sNumUpdates = 0; LLJoint::sNumTouches = 0; - BOOL visible = isVisible() || mNeedsAnimUpdate; + bool visible = isVisible() || mNeedsAnimUpdate; // update attachments positions if (detailed_update) @@ -2916,7 +2962,7 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update) } } - mNeedsAnimUpdate = FALSE; + mNeedsAnimUpdate = false; if (isImpostor() && !mNeedsImpostorUpdate) { @@ -2934,7 +2980,7 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update) if (angle_diff > F_PI/512.f*distance*mUpdatePeriod) { - mNeedsImpostorUpdate = TRUE; + mNeedsImpostorUpdate = true; mLastImpostorUpdateReason = 2; } } @@ -2946,7 +2992,7 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update) F32 dist_diff = fabsf(distance-mImpostorDistance); if (dist_diff/mImpostorDistance > 0.1f) { - mNeedsImpostorUpdate = TRUE; + mNeedsImpostorUpdate = true; mLastImpostorUpdateReason = 3; } else @@ -2959,7 +3005,7 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update) diff.setSub(ext[1], mImpostorExtents[1]); if (diff.getLength3().getF32() > 0.05f) { - mNeedsImpostorUpdate = TRUE; + mNeedsImpostorUpdate = true; mLastImpostorUpdateReason = 4; } else @@ -2967,7 +3013,7 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update) diff.setSub(ext[0], mImpostorExtents[0]); if (diff.getLength3().getF32() > 0.05f) { - mNeedsImpostorUpdate = TRUE; + mNeedsImpostorUpdate = true; mLastImpostorUpdateReason = 5; } } @@ -2982,7 +3028,7 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update) //force a move if sitting on an active object if (getParent() && ((LLViewerObject*) getParent())->mDrawable->isActive()) { - gPipeline.markMoved(mDrawable, TRUE); + gPipeline.markMoved(mDrawable, true); } } } @@ -2996,7 +3042,7 @@ void LLVOAvatar::idleUpdateAppearanceAnimation() F32 appearance_anim_time = mAppearanceMorphTimer.getElapsedTimeF32(); if (appearance_anim_time >= APPEARANCE_MORPH_TIME) { - mAppearanceAnimating = FALSE; + mAppearanceAnimating = false; for (LLVisualParam *param = getFirstVisualParam(); param; param = getNextVisualParam()) @@ -3104,15 +3150,16 @@ void LLVOAvatar::idleUpdateLoadingEffect() { if (mFirstFullyVisible) { - mFirstFullyVisible = FALSE; + mFirstFullyVisible = false; + mFirstDecloudTime = mFirstAppearanceMessageTimer.getElapsedTimeF32(); if (isSelf()) { - LL_INFOS("Avatar") << avString() << "self isFullyLoaded, mFirstFullyVisible" << LL_ENDL; + LL_INFOS("Avatar") << avString() << "self isFullyLoaded, mFirstFullyVisible after " << mFirstDecloudTime << LL_ENDL; LLAppearanceMgr::instance().onFirstFullyVisible(); } else { - LL_INFOS("Avatar") << avString() << "other isFullyLoaded, mFirstFullyVisible" << LL_ENDL; + LL_INFOS("Avatar") << avString() << "other isFullyLoaded, mFirstFullyVisible after " << mFirstDecloudTime << LL_ENDL; } } @@ -3260,17 +3307,17 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) return; } - bool new_name = FALSE; + bool new_name = false; if (visible_chat != mVisibleChat) { mVisibleChat = visible_chat; - new_name = TRUE; + new_name = true; } if (sRenderGroupTitles != mRenderGroupTitles) { mRenderGroupTitles = sRenderGroupTitles; - new_name = TRUE; + new_name = true; } // First Calculate Alpha @@ -3313,11 +3360,11 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) //mNameText->setMass(10.f); mNameText->setSourceObject(this); mNameText->setVertAlignment(LLHUDNameTag::ALIGN_VERT_TOP); - mNameText->setVisibleOffScreen(TRUE); + mNameText->setVisibleOffScreen(true); mNameText->setMaxLines(11); mNameText->setFadeDistance(CHAT_NORMAL_RADIUS, 5.f); sNumVisibleChatBubbles++; - new_name = TRUE; + new_name = true; } mNameText->setPositionAgent(root_pos_last); @@ -3423,6 +3470,7 @@ void LLVOAvatar::idleUpdateNameTagText(bool new_name) static LLUICachedControl<bool> show_display_names("NameTagShowDisplayNames", true); static LLUICachedControl<bool> show_usernames("NameTagShowUsernames", true); + static LLUICachedControl<bool> show_rez_status("NameTagDebugAVRezState", false); if (LLAvatarName::useDisplayNames()) { @@ -3456,6 +3504,12 @@ void LLVOAvatar::idleUpdateNameTagText(bool new_name) addNameTagLine(full_name, name_tag_color, LLFontGL::NORMAL, font, true); } + if (show_rez_status) + { + std::string av_string = LLVOAvatar::rezStatusToString(mLastRezzedStatus); + addNameTagLine(av_string, name_tag_color, LLFontGL::NORMAL, LLFontGL::getFontSansSerifSmall(), true); + } + mNameAway = is_away; mNameDoNotDisturb = is_do_not_disturb; mNameMute = is_muted; @@ -3464,7 +3518,7 @@ void LLVOAvatar::idleUpdateNameTagText(bool new_name) mNameCloud = is_cloud; mTitle = title ? title->getString() : ""; LLStringFn::replace_ascii_controlchars(mTitle,LL_UNKNOWN_CHAR); - new_name = TRUE; + new_name = true; } if (mVisibleChat) @@ -3516,7 +3570,7 @@ void LLVOAvatar::idleUpdateNameTagText(bool new_name) mNameText->addLine(chat_iter->mText, old_chat, style); } } - mNameText->setVisibleOffScreen(TRUE); + mNameText->setVisibleOffScreen(true); if (mTyping) { @@ -3541,7 +3595,7 @@ void LLVOAvatar::idleUpdateNameTagText(bool new_name) // ...not using chat bubbles, just names mNameText->setTextAlignment(LLHUDNameTag::ALIGN_TEXT_CENTER); mNameText->setFadeDistance(CHAT_NORMAL_RADIUS, 5.f); - mNameText->setVisibleOffScreen(FALSE); + mNameText->setVisibleOffScreen(false); } } @@ -4092,24 +4146,24 @@ void LLVOAvatar::updateFootstepSounds() if ( gAudiop && isAnyAnimationSignaled(AGENT_FOOTSTEP_ANIMS, NUM_AGENT_FOOTSTEP_ANIMS) ) { - BOOL playSound = FALSE; + bool playSound = false; LLVector3 foot_pos_agent; - BOOL onGroundLeft = (leftElev <= 0.05f); - BOOL onGroundRight = (rightElev <= 0.05f); + bool onGroundLeft = (leftElev <= 0.05f); + bool onGroundRight = (rightElev <= 0.05f); // did left foot hit the ground? if ( onGroundLeft && !mWasOnGroundLeft ) { foot_pos_agent = ankle_left_pos_agent; - playSound = TRUE; + playSound = true; } // did right foot hit the ground? if ( onGroundRight && !mWasOnGroundRight ) { foot_pos_agent = ankle_right_pos_agent; - playSound = TRUE; + playSound = true; } mWasOnGroundLeft = onGroundLeft; @@ -4266,7 +4320,7 @@ void LLVOAvatar::updateOrientation(LLAgent& agent, F32 speed, F32 delta_time) // When moving very slow, the pelvis is allowed to deviate from the // forward direction to allow it to hold its position while the torso // and head turn. Once in motion, it must conform however. - BOOL self_in_mouselook = isSelf() && gAgentCamera.cameraMouselook(); + bool self_in_mouselook = isSelf() && gAgentCamera.cameraMouselook(); LLVector3 pelvisDir( mRoot->getWorldMatrix().getFwdRow4().mV ); @@ -4292,7 +4346,7 @@ void LLVOAvatar::updateOrientation(LLAgent& agent, F32 speed, F32 delta_time) // smaller correction vector means pelvis follows prim direction more closely if (!mTurning && angle > pelvis_rot_threshold*0.75f) { - mTurning = TRUE; + mTurning = true; } // use tighter threshold when turning @@ -4313,7 +4367,7 @@ void LLVOAvatar::updateOrientation(LLAgent& agent, F32 speed, F32 delta_time) // am I done turning? if (angle < pelvis_rot_threshold) { - mTurning = FALSE; + mTurning = false; } LLVector3 correction_vector = (pelvisDir - fwdDir) * clamp_rescale(angle, pelvis_rot_threshold*0.75f, pelvis_rot_threshold, 1.0f, 0.0f); @@ -4321,7 +4375,7 @@ void LLVOAvatar::updateOrientation(LLAgent& agent, F32 speed, F32 delta_time) } else { - mTurning = FALSE; + mTurning = false; } // Now compute the full world space rotation for the whole body (wQv) @@ -4453,7 +4507,7 @@ void LLVOAvatar::updateRootPositionAndRotation(LLAgent& agent, F32 speed, bool w LLVector3 normal; resolveHeightGlobal(root_pos, ground_under_pelvis, normal); F32 foot_to_ground = (F32) (root_pos.mdV[VZ] - mPelvisToFoot - ground_under_pelvis.mdV[VZ]); - BOOL in_air = ((!LLWorld::getInstance()->getRegionFromPosGlobal(ground_under_pelvis)) || + bool in_air = ((!LLWorld::getInstance()->getRegionFromPosGlobal(ground_under_pelvis)) || foot_to_ground > FOOT_GROUND_COLLISION_TOLERANCE); if (in_air && !mInAir) @@ -4569,12 +4623,12 @@ bool LLVOAvatar::computeNeedsUpdate() { if (needs_update_by_max_time) { - mNeedsImpostorUpdate = TRUE; + mNeedsImpostorUpdate = true; mLastImpostorUpdateReason = 11; } else { - //mNeedsImpostorUpdate = TRUE; + //mNeedsImpostorUpdate = true; //mLastImpostorUpdateReason = 10; } } @@ -4609,10 +4663,10 @@ bool LLVOAvatar::updateCharacter(LLAgent &agent) if (!mIsBuilt) { - return FALSE; + return false; } - BOOL visible = isVisible(); + bool visible = isVisible(); bool is_control_avatar = isControlAvatar(); // capture state to simplify tracing bool is_attachment = false; @@ -4649,7 +4703,7 @@ bool LLVOAvatar::updateCharacter(LLAgent &agent) if (!needs_update && !isSelf()) { updateMotions(LLCharacter::HIDDEN_UPDATE); - return FALSE; + return false; } //-------------------------------------------------------------------- @@ -4747,7 +4801,7 @@ bool LLVOAvatar::updateCharacter(LLAgent &agent) if (visible) { // System avatar mesh vertices need to be reskinned. - mNeedsSkin = TRUE; + mNeedsSkin = true; } return visible; @@ -4859,37 +4913,37 @@ void LLVOAvatar::postPelvisSetRecalc() //------------------------------------------------------------------------ void LLVOAvatar::updateVisibility() { - BOOL visible = FALSE; + bool visible = false; if (mIsDummy) { - visible = FALSE; + visible = false; } else if (mDrawable.isNull()) { - visible = FALSE; + visible = false; } else { if (!mDrawable->getSpatialGroup() || mDrawable->getSpatialGroup()->isVisible()) { - visible = TRUE; + visible = true; } else { - visible = FALSE; + visible = false; } if(isSelf()) { if (!gAgentWearables.areWearablesLoaded()) { - visible = FALSE; + visible = false; } } else if( !mFirstAppearanceMessageReceived ) { - visible = FALSE; + visible = false; } if (sDebugInvisible) @@ -5030,7 +5084,7 @@ U32 LLVOAvatar::renderSkinned() { updateMeshData(); mDirtyMesh = 0; - mNeedsSkin = TRUE; + mNeedsSkin = true; mDrawable->clearState(LLDrawable::REBUILD_GEOMETRY); } } @@ -5079,7 +5133,7 @@ U32 LLVOAvatar::renderSkinned() hair_mesh->updateJointGeometry(); } } - mNeedsSkin = FALSE; + mNeedsSkin = false; mLastSkinTime = gFrameTimeSeconds; LLFace * face = mDrawable->getFace(0); @@ -5095,7 +5149,7 @@ U32 LLVOAvatar::renderSkinned() } else { - mNeedsSkin = FALSE; + mNeedsSkin = false; } if (sDebugInvisible) @@ -5137,7 +5191,7 @@ U32 LLVOAvatar::renderSkinned() // render all geometry attached to the skeleton //-------------------------------------------------------------------- - BOOL first_pass = TRUE; + bool first_pass = true; if (!LLDrawPoolAvatar::sSkipOpaque) { if (isUIAvatar() && mIsDummy) @@ -5147,7 +5201,7 @@ U32 LLVOAvatar::renderSkinned() { num_indices += hair_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy); } - first_pass = FALSE; + first_pass = false; } if (!isSelf() || gAgent.needsRenderHead() || LLPipeline::sShadowRender) { @@ -5159,7 +5213,7 @@ U32 LLVOAvatar::renderSkinned() { num_indices += head_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy); } - first_pass = FALSE; + first_pass = false; } } if (isTextureVisible(TEX_UPPER_BAKED) || (getOverallAppearance() == AOA_JELLYDOLL && !isControlAvatar()) || isUIAvatar()) @@ -5169,7 +5223,7 @@ U32 LLVOAvatar::renderSkinned() { num_indices += upper_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy); } - first_pass = FALSE; + first_pass = false; } if (isTextureVisible(TEX_LOWER_BAKED) || (getOverallAppearance() == AOA_JELLYDOLL && !isControlAvatar()) || isUIAvatar()) @@ -5179,7 +5233,7 @@ U32 LLVOAvatar::renderSkinned() { num_indices += lower_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy); } - first_pass = FALSE; + first_pass = false; } } @@ -5192,7 +5246,7 @@ U32 LLVOAvatar::renderSkinned() return num_indices; } -U32 LLVOAvatar::renderTransparent(BOOL first_pass) +U32 LLVOAvatar::renderTransparent(bool first_pass) { U32 num_indices = 0; if( isWearingWearableType( LLWearableType::WT_SKIRT ) && (isUIAvatar() || isTextureVisible(TEX_SKIRT_BAKED)) ) @@ -5201,9 +5255,9 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) LLViewerJoint* skirt_mesh = getViewerJoint(MESH_ID_SKIRT); if (skirt_mesh) { - num_indices += skirt_mesh->render(mAdjustedPixelArea, FALSE); + num_indices += skirt_mesh->render(mAdjustedPixelArea, false); } - first_pass = FALSE; + first_pass = false; gGL.flush(); } @@ -5221,7 +5275,7 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) { num_indices += eyelash_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy); } - first_pass = FALSE; + first_pass = false; } if (isTextureVisible(TEX_HAIR_BAKED) && (getOverallAppearance() != AOA_JELLYDOLL)) { @@ -5230,7 +5284,7 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) { num_indices += hair_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy); } - first_pass = FALSE; + first_pass = false; } if (LLPipeline::sImpostorRender) { @@ -5264,11 +5318,11 @@ U32 LLVOAvatar::renderRigid() LLViewerJoint* eyeball_right = getViewerJoint(MESH_ID_EYEBALL_RIGHT); if (eyeball_left) { - num_indices += eyeball_left->render(mAdjustedPixelArea, TRUE, mIsDummy); + num_indices += eyeball_left->render(mAdjustedPixelArea, true, mIsDummy); } if(eyeball_right) { - num_indices += eyeball_right->render(mAdjustedPixelArea, TRUE, mIsDummy); + num_indices += eyeball_right->render(mAdjustedPixelArea, true, mIsDummy); } } @@ -5378,7 +5432,7 @@ std::string LLVOAvatar::bakedTextureOriginInfo() { ETextureIndex texture_index = mBakedTextureDatas[i].mTextureIndex; LLViewerFetchedTexture *imagep = - LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index,0), TRUE); + LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index,0), true); if (!imagep || imagep->getID() == IMG_DEFAULT || imagep->getID() == IMG_DEFAULT_AVATAR) @@ -5436,7 +5490,7 @@ void LLVOAvatar::collectLocalTextureUUIDs(std::set<LLUUID>& ids) const LLViewerFetchedTexture *imagep = NULL; for (U32 wearable_index = 0; wearable_index < num_wearables; wearable_index++) { - imagep = LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index, wearable_index), TRUE); + imagep = LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index, wearable_index), true); if (imagep) { const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearance::getDictionary()->getTexture((ETextureIndex)texture_index); @@ -5459,7 +5513,7 @@ void LLVOAvatar::collectBakedTextureUUIDs(std::set<LLUUID>& ids) const LLViewerFetchedTexture *imagep = NULL; if (isIndexBakedTexture((ETextureIndex) texture_index)) { - imagep = LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index,0), TRUE); + imagep = LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index,0), true); if (imagep) { ids.insert(imagep->getID()); @@ -5531,7 +5585,7 @@ void LLVOAvatar::updateTextures() { releaseOldTextures(); - BOOL render_avatar = TRUE; + bool render_avatar = true; if (mIsDummy) { @@ -5540,7 +5594,7 @@ void LLVOAvatar::updateTextures() if( isSelf() ) { - render_avatar = TRUE; + render_avatar = true; } else { @@ -5552,7 +5606,7 @@ void LLVOAvatar::updateTextures() render_avatar = !mCulled; //visible and not culled. } - std::vector<BOOL> layer_baked; + std::vector<bool> layer_baked; // GL NOT ACTIVE HERE - *TODO for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { @@ -5570,7 +5624,7 @@ void LLVOAvatar::updateTextures() mMaxPixelArea = 0.f; mMinPixelArea = 99999999.f; - mHasGrey = FALSE; // debug + mHasGrey = false; // debug for (U32 texture_index = 0; texture_index < getNumTEs(); texture_index++) { LLWearableType::EType wearable_type = LLAvatarAppearance::getDictionary()->getTEWearableType((ETextureIndex)texture_index); @@ -5593,7 +5647,7 @@ void LLVOAvatar::updateTextures() LLViewerFetchedTexture *imagep = NULL; for (U32 wearable_index = 0; wearable_index < num_wearables; wearable_index++) { - imagep = LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index, wearable_index), TRUE); + imagep = LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index, wearable_index), true); if (imagep) { const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearance::getDictionary()->getTexture((ETextureIndex)texture_index); @@ -5607,7 +5661,7 @@ void LLVOAvatar::updateTextures() if (isIndexBakedTexture((ETextureIndex) texture_index) && render_avatar) { const S32 boost_level = getAvatarBakedBoostLevel(); - imagep = LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index,0), TRUE); + imagep = LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index,0), true); addBakedTextureStats( imagep, mPixelArea, texel_area_ratio, boost_level ); } } @@ -5620,7 +5674,7 @@ void LLVOAvatar::updateTextures() void LLVOAvatar::addLocalTextureStats( ETextureIndex idx, LLViewerFetchedTexture* imagep, - F32 texel_area_ratio, BOOL render_avatar, BOOL covered_by_baked) + F32 texel_area_ratio, bool render_avatar, bool covered_by_baked) { // No local texture stats for non-self avatars return; @@ -5632,7 +5686,7 @@ void LLVOAvatar::checkTextureLoading() { static const F32 MAX_INVISIBLE_WAITING_TIME = 15.f ; //seconds - BOOL pause = !isVisible() ; + bool pause = !isVisible() ; if(!pause) { mInvisibleTimer.reset() ; @@ -5669,7 +5723,7 @@ void LLVOAvatar::checkTextureLoading() return ; //have not been invisible for enough time. } - mLoadedCallbackTextures = pause ? mCallbackTextureList.size() : 0; + mLoadedCallbackTextures = pause ? static_cast<S32>(mCallbackTextureList.size()) : 0; for(LLLoadedCallbackEntry::source_callback_list_t::iterator iter = mCallbackTextureList.begin(); iter != mCallbackTextureList.end(); ++iter) @@ -5799,13 +5853,13 @@ void LLVOAvatar::resolveHeightGlobal(const LLVector3d &inPos, LLVector3d &outPos LLWorld::getInstance()->resolveStepHeightGlobal(this, p0, p1, outPos, outNorm, &obj); if (!obj) { - mStepOnLand = TRUE; + mStepOnLand = true; mStepMaterial = 0; mStepObjectVelocity.setVec(0.0f, 0.0f, 0.0f); } else { - mStepOnLand = FALSE; + mStepOnLand = false; mStepMaterial = obj->getMaterial(); // We want the primitive velocity, not our velocity... (which actually subtracts the @@ -5884,7 +5938,7 @@ void LLVOAvatar::processAnimationStateChanges() // playing, but not signaled, so stop if (found_anim == mSignaledAnimations.end()) { - processSingleAnimationStateChange(anim_it->first, FALSE); + processSingleAnimationStateChange(anim_it->first, false); mPlayingAnimations.erase(anim_it++); continue; } @@ -5908,7 +5962,7 @@ void LLVOAvatar::processAnimationStateChanges() // signaled but not playing, or different sequence id, start motion if (found_anim == mPlayingAnimations.end() || found_anim->second != anim_it->second) { - if (processSingleAnimationStateChange(anim_it->first, TRUE)) + if (processSingleAnimationStateChange(anim_it->first, true)) { mPlayingAnimations[anim_it->first] = anim_it->second; ++anim_it; @@ -5945,7 +5999,7 @@ void LLVOAvatar::processAnimationStateChanges() //----------------------------------------------------------------------------- // processSingleAnimationStateChange(); //----------------------------------------------------------------------------- -BOOL LLVOAvatar::processSingleAnimationStateChange( const LLUUID& anim_id, BOOL start ) +bool LLVOAvatar::processSingleAnimationStateChange( const LLUUID& anim_id, bool start ) { // SL-402, SL-427 - we need to update body size often enough to // keep appearances in sync, but not so often that animations @@ -5953,7 +6007,7 @@ BOOL LLVOAvatar::processSingleAnimationStateChange( const LLUUID& anim_id, BOOL // compromise is to do it on animation changes: computeBodySize(); - BOOL result = FALSE; + bool result = false; if ( start ) // start animation { @@ -5982,13 +6036,13 @@ BOOL LLVOAvatar::processSingleAnimationStateChange( const LLUUID& anim_id, BOOL } else if (anim_id == ANIM_AGENT_SIT_GROUND_CONSTRAINED) { - sitDown(TRUE); + sitDown(true); } if (startMotion(anim_id)) { - result = TRUE; + result = true; } else { @@ -5999,7 +6053,7 @@ BOOL LLVOAvatar::processSingleAnimationStateChange( const LLUUID& anim_id, BOOL { if (anim_id == ANIM_AGENT_SIT_GROUND_CONSTRAINED) { - sitDown(FALSE); + sitDown(false); } if ((anim_id == ANIM_AGENT_DO_NOT_DISTURB) && gAgent.isDoNotDisturb()) { @@ -6008,7 +6062,7 @@ BOOL LLVOAvatar::processSingleAnimationStateChange( const LLUUID& anim_id, BOOL return result; } stopMotion(anim_id); - result = TRUE; + result = true; } return result; @@ -6017,16 +6071,16 @@ BOOL LLVOAvatar::processSingleAnimationStateChange( const LLUUID& anim_id, BOOL //----------------------------------------------------------------------------- // isAnyAnimationSignaled() //----------------------------------------------------------------------------- -BOOL LLVOAvatar::isAnyAnimationSignaled(const LLUUID *anim_array, const S32 num_anims) const +bool LLVOAvatar::isAnyAnimationSignaled(const LLUUID *anim_array, const S32 num_anims) const { for (S32 i = 0; i < num_anims; i++) { if(mSignaledAnimations.find(anim_array[i]) != mSignaledAnimations.end()) { - return TRUE; + return true; } } - return FALSE; + return false; } //----------------------------------------------------------------------------- @@ -6097,7 +6151,7 @@ LLUUID LLVOAvatar::remapMotionID(const LLUUID& id) // id is the asset if of the animation to start // time_offset is the offset into the animation at which to start playing //----------------------------------------------------------------------------- -BOOL LLVOAvatar::startMotion(const LLUUID& id, F32 time_offset) +bool LLVOAvatar::startMotion(const LLUUID& id, F32 time_offset) { LL_DEBUGS("Motion") << "motion requested " << id.asString() << " " << gAnimLibrary.animationName(id) << LL_ENDL; @@ -6119,7 +6173,7 @@ BOOL LLVOAvatar::startMotion(const LLUUID& id, F32 time_offset) //----------------------------------------------------------------------------- // stopMotion() //----------------------------------------------------------------------------- -BOOL LLVOAvatar::stopMotion(const LLUUID& id, BOOL stop_immediate) +bool LLVOAvatar::stopMotion(const LLUUID& id, bool stop_immediate) { LL_DEBUGS("Motion") << "Motion requested " << id.asString() << " " << gAnimLibrary.animationName(id) << LL_ENDL; @@ -6548,8 +6602,8 @@ void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo, std::set<LL if ( vobj && vobj->isMesh() && pSkinData ) { - const int bindCnt = pSkinData->mAlternateBindMatrix.size(); - const int jointCnt = pSkinData->mJointNames.size(); + const unsigned int bindCnt = static_cast<unsigned int>(pSkinData->mAlternateBindMatrix.size()); + const unsigned int jointCnt = static_cast<unsigned int>(pSkinData->mJointNames.size()); if ((bindCnt > 0) && (bindCnt != jointCnt)) { LL_WARNS_ONCE() << "invalid mesh, bindCnt " << bindCnt << "!= jointCnt " << jointCnt << ", joint overrides will be ignored." << LL_ENDL; @@ -6576,10 +6630,10 @@ void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo, std::set<LL LL_DEBUGS("AnimatedObjects") << "adding attachment overrides for " << mesh_id << " to root object " << root_object->getID() << LL_ENDL; } - bool fullRig = (jointCnt>=JOINT_COUNT_REQUIRED_FOR_FULLRIG) ? true : false; + bool fullRig = jointCnt >= JOINT_COUNT_REQUIRED_FOR_FULLRIG; if ( fullRig && !mesh_overrides_loaded ) { - for ( int i=0; i<jointCnt; ++i ) + for (unsigned int i = 0; i < jointCnt; ++i) { std::string lookingForJoint = pSkinData->mJointNames[i].c_str(); LLJoint* pJoint = getJoint( lookingForJoint ); @@ -6608,6 +6662,7 @@ void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo, std::set<LL } } } + if (pelvisZOffset != 0.0F) { F32 pelvis_fixup_before; @@ -6674,7 +6729,6 @@ void LLVOAvatar::getAttachmentOverrideNames(std::set<std::string>& pos_names, st } // Attachment points don't have scales. } - } //----------------------------------------------------------------------------- @@ -6694,6 +6748,7 @@ void LLVOAvatar::showAttachmentOverrides(bool verbose) const { LL_DEBUGS("Avatar") << getFullname() << " no attachment positions defined for any joints" << "\n" << LL_ENDL; } + if (scale_names.size()) { std::stringstream ss; @@ -6789,17 +6844,17 @@ void LLVOAvatar::removeAttachmentOverridesForObject(const LLUUID& mesh_id) for (S32 joint_num = 0; joint_num < LL_CHARACTER_MAX_ANIMATED_JOINTS; joint_num++) { LLJoint *pJoint = getJoint(joint_num); - if ( pJoint ) + if (pJoint) { bool dummy; // unused pJoint->removeAttachmentPosOverride(mesh_id, av_string, dummy); pJoint->removeAttachmentScaleOverride(mesh_id, av_string); } - if ( pJoint && pJoint == pJointPelvis) + if (pJoint && pJoint == pJointPelvis) { - removePelvisFixup( mesh_id ); + removePelvisFixup(mesh_id); // SL-315 - pJoint->setPosition( LLVector3( 0.0f, 0.0f, 0.0f) ); + pJoint->setPosition(LLVector3( 0.0f, 0.0f, 0.0f)); } } @@ -6808,6 +6863,7 @@ void LLVOAvatar::removeAttachmentOverridesForObject(const LLUUID& mesh_id) mActiveOverrideMeshes.erase(mesh_id); onActiveOverrideMeshesChanged(); } + //----------------------------------------------------------------------------- // getCharacterPosition() //----------------------------------------------------------------------------- @@ -6823,7 +6879,6 @@ LLVector3 LLVOAvatar::getCharacterPosition() } } - //----------------------------------------------------------------------------- // LLVOAvatar::getCharacterRotation() //----------------------------------------------------------------------------- @@ -6832,7 +6887,6 @@ LLQuaternion LLVOAvatar::getCharacterRotation() return getRotation(); } - //----------------------------------------------------------------------------- // LLVOAvatar::getCharacterVelocity() //----------------------------------------------------------------------------- @@ -6841,7 +6895,6 @@ LLVector3 LLVOAvatar::getCharacterVelocity() return getVelocity() - mStepObjectVelocity; } - //----------------------------------------------------------------------------- // LLVOAvatar::getCharacterAngularVelocity() //----------------------------------------------------------------------------- @@ -6881,7 +6934,6 @@ F32 LLVOAvatar::getTimeDilation() return mRegionp ? mRegionp->getTimeDilation() : 1.f; } - //----------------------------------------------------------------------------- // LLVOAvatar::getPixelArea() //----------------------------------------------------------------------------- @@ -6894,8 +6946,6 @@ F32 LLVOAvatar::getPixelArea() const return mPixelArea; } - - //----------------------------------------------------------------------------- // LLVOAvatar::getPosGlobalFromAgent() //----------------------------------------------------------------------------- @@ -6912,7 +6962,6 @@ LLVector3 LLVOAvatar::getPosAgentFromGlobal(const LLVector3d &position) return gAgent.getPosAgentFromGlobal(position); } - //----------------------------------------------------------------------------- // requestStopMotion() //----------------------------------------------------------------------------- @@ -6926,17 +6975,17 @@ void LLVOAvatar::requestStopMotion( LLMotion* motion ) // loadSkeletonNode(): loads <skeleton> node from XML tree //----------------------------------------------------------------------------- //virtual -BOOL LLVOAvatar::loadSkeletonNode () +bool LLVOAvatar::loadSkeletonNode () { if (!LLAvatarAppearance::loadSkeletonNode()) { - return FALSE; + return false; } bool ignore_hud_joints = false; initAttachmentPoints(ignore_hud_joints); - return TRUE; + return true; } //----------------------------------------------------------------------------- @@ -7069,9 +7118,9 @@ void LLVOAvatar::updateVisualParams() //----------------------------------------------------------------------------- // isActive() //----------------------------------------------------------------------------- -BOOL LLVOAvatar::isActive() const +bool LLVOAvatar::isActive() const { - return TRUE; + return true; } //----------------------------------------------------------------------------- @@ -7117,7 +7166,7 @@ void LLVOAvatar::setPixelAreaAndAngle(LLAgent &agent) //----------------------------------------------------------------------------- // updateJointLODs() //----------------------------------------------------------------------------- -BOOL LLVOAvatar::updateJointLODs() +bool LLVOAvatar::updateJointLODs() { const F32 MAX_PIXEL_AREA = 100000000.f; F32 lod_factor = (sLODFactor * AVATAR_LOD_TWEAK_RANGE + (1.f - AVATAR_LOD_TWEAK_RANGE)); @@ -7148,19 +7197,19 @@ BOOL LLVOAvatar::updateJointLODs() // now select meshes to render based on adjusted pixel area LLViewerJoint* root = dynamic_cast<LLViewerJoint*>(mRoot); - BOOL res = FALSE; + bool res = false; if (root) { - res = root->updateLOD(mAdjustedPixelArea, TRUE); + res = root->updateLOD(mAdjustedPixelArea, true); } if (res) { sNumLODChangesThisFrame++; dirtyMesh(2); - return TRUE; + return true; } - return FALSE; + return false; } //----------------------------------------------------------------------------- @@ -7169,7 +7218,7 @@ BOOL LLVOAvatar::updateJointLODs() LLDrawable *LLVOAvatar::createDrawable(LLPipeline *pipeline) { pipeline->allocDrawable(this); - mDrawable->setLit(FALSE); + mDrawable->setLit(false); LLDrawPoolAvatar *poolp = (LLDrawPoolAvatar*)gPipeline.getPool(mIsControlAvatar ? LLDrawPool::POOL_CONTROL_AV : LLDrawPool::POOL_AVATAR); @@ -7192,24 +7241,24 @@ void LLVOAvatar::updateGL() { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR updateMeshTextures(); - mMeshTexturesDirty = FALSE; + mMeshTexturesDirty = false; } } //----------------------------------------------------------------------------- // updateGeometry() //----------------------------------------------------------------------------- -BOOL LLVOAvatar::updateGeometry(LLDrawable *drawable) +bool LLVOAvatar::updateGeometry(LLDrawable *drawable) { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; if (!(gPipeline.hasRenderType(mIsControlAvatar ? LLPipeline::RENDER_TYPE_CONTROL_AV : LLPipeline::RENDER_TYPE_AVATAR))) { - return TRUE; + return true; } if (!mMeshValid) { - return TRUE; + return true; } if (!drawable) @@ -7217,7 +7266,7 @@ BOOL LLVOAvatar::updateGeometry(LLDrawable *drawable) LL_ERRS() << "LLVOAvatar::updateGeometry() called with NULL drawable" << LL_ENDL; } - return TRUE; + return true; } //----------------------------------------------------------------------------- @@ -7255,7 +7304,7 @@ LLViewerJoint* LLVOAvatar::getViewerJoint(S32 idx) //----------------------------------------------------------------------------- void LLVOAvatar::hideHair() { - mMeshLOD[MESH_ID_HAIR]->setVisible(FALSE, TRUE); + mMeshLOD[MESH_ID_HAIR]->setVisible(false, true); } //----------------------------------------------------------------------------- @@ -7263,12 +7312,12 @@ void LLVOAvatar::hideHair() //----------------------------------------------------------------------------- void LLVOAvatar::hideSkirt() { - mMeshLOD[MESH_ID_SKIRT]->setVisible(FALSE, TRUE); + mMeshLOD[MESH_ID_SKIRT]->setVisible(false, true); } -BOOL LLVOAvatar::setParent(LLViewerObject* parent) +bool LLVOAvatar::setParent(LLViewerObject* parent) { - BOOL ret ; + bool ret ; if (parent == NULL) { getOffObject(); @@ -7453,9 +7502,9 @@ S32 LLVOAvatar::getMaxAttachments() const // canAttachMoreObjects() // Returns true if we can attach <n> more objects. //----------------------------------------------------------------------------- -BOOL LLVOAvatar::canAttachMoreObjects(U32 n) const +bool LLVOAvatar::canAttachMoreObjects(U32 n) const { - return (getNumAttachments() + n) <= getMaxAttachments(); + return (getNumAttachments() + n) <= (U32)getMaxAttachments(); } //----------------------------------------------------------------------------- @@ -7487,9 +7536,9 @@ S32 LLVOAvatar::getMaxAnimatedObjectAttachments() const // canAttachMoreAnimatedObjects() // Returns true if we can attach <n> more animated objects. //----------------------------------------------------------------------------- -BOOL LLVOAvatar::canAttachMoreAnimatedObjects(U32 n) const +bool LLVOAvatar::canAttachMoreAnimatedObjects(U32 n) const { - return (getNumAnimatedObjectAttachments() + n) <= getMaxAnimatedObjectAttachments(); + return (getNumAnimatedObjectAttachments() + n) <= (U32)getMaxAnimatedObjectAttachments(); } //----------------------------------------------------------------------------- @@ -7676,7 +7725,7 @@ bool LLVOAvatar::hasPendingAttachedMeshes() //----------------------------------------------------------------------------- // detachObject() //----------------------------------------------------------------------------- -BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object) +bool LLVOAvatar::detachObject(LLViewerObject *viewer_object) { for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); @@ -7711,7 +7760,7 @@ BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object) updateMeshVisibility(); LL_DEBUGS() << "Detaching object " << viewer_object->mID << " from " << attachment->getName() << LL_ENDL; - return TRUE; + return true; } } @@ -7719,16 +7768,16 @@ BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object) if (iter != mPendingAttachment.end()) { mPendingAttachment.erase(iter); - return TRUE; + return true; } - return FALSE; + return false; } //----------------------------------------------------------------------------- // sitDown() //----------------------------------------------------------------------------- -void LLVOAvatar::sitDown(BOOL bSitting) +void LLVOAvatar::sitDown(bool bSitting) { mIsSitting = bSitting; if (isSelf()) @@ -7748,7 +7797,7 @@ void LLVOAvatar::sitOnObject(LLViewerObject *sit_object) // Might be first sit //LLFirstUse::useSit(); - gAgent.setFlying(FALSE); + gAgent.setFlying(false); gAgentCamera.setThirdPersonHeadOffset(LLVector3::zero); //interpolate to new camera position gAgentCamera.startCameraAnimation(); @@ -7787,10 +7836,10 @@ void LLVOAvatar::sitOnObject(LLViewerObject *sit_object) mDrawable->mXform.setPosition(rel_pos); mDrawable->mXform.setRotation(mDrawable->getWorldRotation() * inv_obj_rot); - gPipeline.markMoved(mDrawable, TRUE); + gPipeline.markMoved(mDrawable, true); // Notice that removing sitDown() from here causes avatars sitting on // objects to be not rendered for new arrivals. See EXT-6835 and EXT-1655. - sitDown(TRUE); + sitDown(true); mRoot->getXform()->setParent(&sit_object->mDrawable->mXform); // LLVOAvatar::sitOnObject // SL-315 mRoot->setPosition(getPosition()); @@ -7816,7 +7865,7 @@ void LLVOAvatar::getOffObject() if (sit_object) { stopMotionFromSource(sit_object->getID()); - LLFollowCamMgr::getInstance()->setCameraActive(sit_object->getID(), FALSE); + LLFollowCamMgr::getInstance()->setCameraActive(sit_object->getID(), false); LLViewerObject::const_child_list_t& child_list = sit_object->getChildren(); for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); @@ -7825,7 +7874,7 @@ void LLVOAvatar::getOffObject() LLViewerObject* child_objectp = *iter; stopMotionFromSource(child_objectp->getID()); - LLFollowCamMgr::getInstance()->setCameraActive(child_objectp->getID(), FALSE); + LLFollowCamMgr::getInstance()->setCameraActive(child_objectp->getID(), false); } } @@ -7847,9 +7896,9 @@ void LLVOAvatar::getOffObject() mDrawable->mXform.setPosition(cur_position_world); mDrawable->mXform.setRotation(cur_rotation_world); - gPipeline.markMoved(mDrawable, TRUE); + gPipeline.markMoved(mDrawable, true); - sitDown(FALSE); + sitDown(false); mRoot->getXform()->setParent(NULL); // LLVOAvatar::getOffObject // SL-315 @@ -7899,15 +7948,22 @@ LLVOAvatar* LLVOAvatar::findAvatarFromAttachment( LLViewerObject* obj ) return NULL; } -S32 LLVOAvatar::getAttachmentCount() +S32 LLVOAvatar::getAttachmentCount() const { - S32 count = mAttachmentPoints.size(); - return count; + size_t count = 0; + + for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); ++iter) + { + LLViewerJointAttachment* pAttachment = iter->second; + count += pAttachment->mAttachedObjects.size(); + } + + return static_cast<S32>(count); } -BOOL LLVOAvatar::isWearingWearableType(LLWearableType::EType type) const +bool LLVOAvatar::isWearingWearableType(LLWearableType::EType type) const { - if (mIsDummy) return TRUE; + if (mIsDummy) return true; if (isSelf()) { @@ -7920,7 +7976,7 @@ BOOL LLVOAvatar::isWearingWearableType(LLWearableType::EType type) const case LLWearableType::WT_SKIN: case LLWearableType::WT_HAIR: case LLWearableType::WT_EYES: - return TRUE; // everyone has all bodyparts + return true; // everyone has all bodyparts default: break; // Do nothing } @@ -7941,10 +7997,10 @@ BOOL LLVOAvatar::isWearingWearableType(LLWearableType::EType type) const const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; return isTextureDefined(LLAvatarAppearance::getDictionary()->getBakedTexture(baked_index)->mTextureIndex); } - return FALSE; + return false; } } - return FALSE; + return false; } LLViewerObject * LLVOAvatar::findAttachmentByID( const LLUUID & target_id ) const @@ -8038,11 +8094,13 @@ bool LLVOAvatar::shouldRenderRigged() const // related to whether the actual avatar mesh is shown, and isVisible() // to whether anything about the avatar is displayed in the scene. // Maybe better naming could make this clearer? -BOOL LLVOAvatar::isVisible() const +bool LLVOAvatar::isVisible() const { + static LLCachedControl<bool> friends_only(gSavedSettings, "RenderAvatarFriendsOnly", false); return mDrawable.notNull() && (!mOrphaned || isSelf()) - && (mDrawable->isVisible() || mIsDummy); + && (mDrawable->isVisible() || mIsDummy) + && (!friends_only() || isUIAvatar() || isSelf() || isControlAvatar() || isBuddy()); } // Determine if we have enough avatar data to render @@ -8064,7 +8122,7 @@ bool LLVOAvatar::getIsCloud() const void LLVOAvatar::updateRezzedStatusTimers(S32 rez_status) { // State machine for rezzed status. Statuses are -1 on startup, 0 - // = cloud, 1 = gray, 2 = downloading, 3 = full. + // = cloud, 1 = gray, 2 = downloading, 3 = waiting for attachments, 4 = full. // Purpose is to collect time data for each it takes avatar to reach // various loading landmarks: gray, textured (partial), textured fully. @@ -8097,7 +8155,7 @@ void LLVOAvatar::updateRezzedStatusTimers(S32 rez_status) stopPhase("load_" + LLVOAvatar::rezStatusToString(i)); stopPhase("first_load_" + LLVOAvatar::rezStatusToString(i), false); } - if (rez_status == 3) + if (rez_status == 4) { // "fully loaded", mark any pending appearance change complete. selfStopPhase("update_appearance_from_cof"); @@ -8108,6 +8166,12 @@ void LLVOAvatar::updateRezzedStatusTimers(S32 rez_status) } } mLastRezzedStatus = rez_status; + + static LLUICachedControl<bool> show_rez_status("NameTagDebugAVRezState", false); + if (show_rez_status) + { + mNameIsSet = false; + } } } @@ -8235,10 +8299,10 @@ void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapse // call periodically to keep isFullyLoaded up to date. // returns true if the value has changed. -BOOL LLVOAvatar::updateIsFullyLoaded() +bool LLVOAvatar::updateIsFullyLoaded() { S32 rez_status = getRezzedStatus(); - bool loading = getIsCloud(); + bool loading = rez_status == 0; if (mFirstFullyVisible && !mIsControlAvatar) { loading = ((rez_status < 2) @@ -8251,6 +8315,27 @@ BOOL LLVOAvatar::updateIsFullyLoaded() || (rez_status < 3 && !isFullyBaked()) || hasPendingAttachedMeshes() ); + + // compare amount of attachments to one reported by simulator + if (!loading && !isSelf() && rez_status < 4 && mLastCloudAttachmentCount < mSimAttachments.size()) + { + S32 attachment_count = getAttachmentCount(); + if (mLastCloudAttachmentCount != attachment_count) + { + mLastCloudAttachmentCount = attachment_count; + if (attachment_count != mSimAttachments.size()) + { + // attachment count changed, but still below desired, wait for more updates + mLastCloudAttachmentChangeTime.reset(); + loading = true; + } + } + else if (mLastCloudAttachmentChangeTime.getElapsedTimeF32() < MAX_ATTACHMENT_WAIT_TIME_SEC) + { + // waiting + loading = true; + } + } } updateRezzedStatusTimers(rez_status); updateRuthTimer(loading); @@ -8286,12 +8371,11 @@ void LLVOAvatar::updateRuthTimer(bool loading) } } -BOOL LLVOAvatar::processFullyLoadedChange(bool loading) +bool LLVOAvatar::processFullyLoadedChange(bool loading) { // We wait a little bit before giving the 'all clear', to let things to - // settle down (models to snap into place, textures to get first packets). - // And if viewer isn't aware of some parts yet, this gives them a chance - // to arrive. + // settle down: models to snap into place, textures to get first packets, + // LODs to load. const F32 LOADED_DELAY = 1.f; if (loading) @@ -8301,11 +8385,12 @@ BOOL LLVOAvatar::processFullyLoadedChange(bool loading) if (mFirstFullyVisible) { + F32 first_use_delay = FIRST_APPEARANCE_CLOUD_MIN_DELAY; if (!isSelf() && loading) { // Note that textures can causes 60s delay on thier own // so this delay might end up on top of textures' delay - mFirstUseDelaySeconds = llclamp( + first_use_delay = llclamp( mFirstAppearanceMessageTimer.getElapsedTimeF32(), FIRST_APPEARANCE_CLOUD_MIN_DELAY, FIRST_APPEARANCE_CLOUD_MAX_DELAY); @@ -8314,10 +8399,10 @@ BOOL LLVOAvatar::processFullyLoadedChange(bool loading) { // Impostors are less of a priority, // let them stay cloud longer - mFirstUseDelaySeconds *= 1.25; + first_use_delay *= FIRST_APPEARANCE_CLOUD_IMPOSTOR_MODIFIER; } } - mFullyLoaded = (mFullyLoadedTimer.getElapsedTimeF32() > mFirstUseDelaySeconds); + mFullyLoaded = (mFullyLoadedTimer.getElapsedTimeF32() > first_use_delay); } else { @@ -8326,21 +8411,21 @@ BOOL LLVOAvatar::processFullyLoadedChange(bool loading) if (!mPreviousFullyLoaded && !loading && mFullyLoaded) { - debugAvatarRezTime("AvatarRezNotification","fully loaded"); + debugAvatarRezTime("AvatarRezNotification", "fully loaded"); } // did our loading state "change" from last call? // FIXME runway - why are we updating every 30 calls even if nothing has changed? // This causes updateLOD() to run every 30 frames, among other things. const S32 UPDATE_RATE = 30; - BOOL changed = + bool changed = ((mFullyLoaded != mPreviousFullyLoaded) || // if the value is different from the previous call (!mFullyLoadedInitialized) || // if we've never been called before (mFullyLoadedFrameCounter % UPDATE_RATE == 0)); // every now and then issue a change - BOOL fully_loaded_changed = (mFullyLoaded != mPreviousFullyLoaded); + bool fully_loaded_changed = (mFullyLoaded != mPreviousFullyLoaded); mPreviousFullyLoaded = mFullyLoaded; - mFullyLoadedInitialized = TRUE; + mFullyLoadedInitialized = true; mFullyLoadedFrameCounter++; if (changed && isSelf()) @@ -8352,13 +8437,13 @@ BOOL LLVOAvatar::processFullyLoadedChange(bool loading) if (fully_loaded_changed && !isSelf() && mFullyLoaded && isImpostor()) { // Fix for jellydoll initially invisible - mNeedsImpostorUpdate = TRUE; + mNeedsImpostorUpdate = true; mLastImpostorUpdateReason = 6; } return changed; } -BOOL LLVOAvatar::isFullyLoaded() const +bool LLVOAvatar::isFullyLoaded() const { return (mRenderUnloadedAvatar || mFullyLoaded); } @@ -8366,13 +8451,17 @@ BOOL LLVOAvatar::isFullyLoaded() const bool LLVOAvatar::isTooComplex() const { bool too_complex; - static LLCachedControl<bool> always_render_friends(gSavedSettings, "AlwaysRenderFriends"); - bool render_friend = (LLAvatarTracker::instance().isBuddy(getID()) && always_render_friends); + static LLCachedControl<S32> compelxity_render_mode(gSavedSettings, "RenderAvatarComplexityMode"); + bool render_friend = (LLAvatarTracker::instance().isBuddy(getID()) && compelxity_render_mode > AV_RENDER_LIMIT_BY_COMPLEXITY); if (isSelf() || render_friend || mVisuallyMuteSetting == AV_ALWAYS_RENDER) { too_complex = false; } + else if (compelxity_render_mode == AV_RENDER_ONLY_SHOW_FRIENDS && !mIsControlAvatar) + { + too_complex = true; + } else { // Determine if visually muted or not @@ -8392,13 +8481,29 @@ bool LLVOAvatar::isTooComplex() const bool LLVOAvatar::isTooSlow() const { - static LLCachedControl<bool> always_render_friends(gSavedSettings, "AlwaysRenderFriends"); - bool render_friend = (LLAvatarTracker::instance().isBuddy(getID()) && always_render_friends); + if (mIsControlAvatar) + { + return mTooSlow; + } + + static LLCachedControl<S32> compelxity_render_mode(gSavedSettings, "RenderAvatarComplexityMode"); + static LLCachedControl<bool> friends_only(gSavedSettings, "RenderAvatarFriendsOnly", false); + bool is_friend = LLAvatarTracker::instance().isBuddy(getID()); + bool render_friend = is_friend && compelxity_render_mode > AV_RENDER_LIMIT_BY_COMPLEXITY; if (render_friend || mVisuallyMuteSetting == AV_ALWAYS_RENDER) { return false; } + else if (compelxity_render_mode == AV_RENDER_ONLY_SHOW_FRIENDS) + { + return true; + } + else if (!is_friend && friends_only()) + { + return true; + } + return mTooSlow; } @@ -8406,7 +8511,7 @@ bool LLVOAvatar::isTooSlow() const void LLVOAvatar::updateTooSlow() { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; - static LLCachedControl<bool> alwaysRenderFriends(gSavedSettings, "AlwaysRenderFriends"); + static LLCachedControl<S32> compelxity_render_mode(gSavedSettings, "RenderAvatarComplexityMode"); static LLCachedControl<bool> allowSelfImpostor(gSavedSettings, "AllowSelfImpostor"); const auto id = getID(); @@ -8439,12 +8544,14 @@ void LLVOAvatar::updateTooSlow() if(!mTooSlowWithoutShadows) // if we were not previously above the full impostor cap { - bool render_friend_or_exception = ( alwaysRenderFriends && LLAvatarTracker::instance().isBuddy( id ) ) || + bool always_render_friends = compelxity_render_mode > AV_RENDER_LIMIT_BY_COMPLEXITY; + bool render_friend_or_exception = (always_render_friends && LLAvatarTracker::instance().isBuddy( id ) ) || ( getVisualMuteSettings() == LLVOAvatar::AV_ALWAYS_RENDER ); - if( (!isSelf() || allowSelfImpostor) && !render_friend_or_exception ) + if( (!isSelf() || allowSelfImpostor) && !render_friend_or_exception) { // Note: slow rendering Friends still get their shadows zapped. - mTooSlowWithoutShadows = getGPURenderTime()*2.f >= max_art_ms; // NOTE: assumes shadow rendering doubles render time + mTooSlowWithoutShadows = (getGPURenderTime()*2.f >= max_art_ms) // NOTE: assumes shadow rendering doubles render time + || (compelxity_render_mode == AV_RENDER_ONLY_SHOW_FRIENDS && !mIsControlAvatar); } } } @@ -8576,35 +8683,35 @@ void LLVOAvatar::updateMeshVisibility() LLAvatarJoint* joint = mMeshLOD[i]; if (i == MESH_ID_HAIR) { - joint->setVisible(!bake_flag[BAKED_HAIR], TRUE); + joint->setVisible(!bake_flag[BAKED_HAIR], true); } else if (i == MESH_ID_HEAD) { - joint->setVisible(!bake_flag[BAKED_HEAD], TRUE); + joint->setVisible(!bake_flag[BAKED_HEAD], true); } else if (i == MESH_ID_SKIRT) { - joint->setVisible(!bake_flag[BAKED_SKIRT], TRUE); + joint->setVisible(!bake_flag[BAKED_SKIRT], true); } else if (i == MESH_ID_UPPER_BODY) { - joint->setVisible(!bake_flag[BAKED_UPPER], TRUE); + joint->setVisible(!bake_flag[BAKED_UPPER], true); } else if (i == MESH_ID_LOWER_BODY) { - joint->setVisible(!bake_flag[BAKED_LOWER], TRUE); + joint->setVisible(!bake_flag[BAKED_LOWER], true); } else if (i == MESH_ID_EYEBALL_LEFT) { - joint->setVisible(!bake_flag[BAKED_EYES], TRUE); + joint->setVisible(!bake_flag[BAKED_EYES], true); } else if (i == MESH_ID_EYEBALL_RIGHT) { - joint->setVisible(!bake_flag[BAKED_EYES], TRUE); + joint->setVisible(!bake_flag[BAKED_EYES], true); } else if (i == MESH_ID_EYELASH) { - joint->setVisible(!bake_flag[BAKED_HEAD], TRUE); + joint->setVisible(!bake_flag[BAKED_HEAD], true); } } } @@ -8632,19 +8739,19 @@ void LLVOAvatar::updateMeshTextures() } } - const BOOL other_culled = !isSelf() && mCulled; + const bool other_culled = !isSelf() && mCulled; LLLoadedCallbackEntry::source_callback_list_t* src_callback_list = NULL ; - BOOL paused = FALSE; + bool paused = false; if(!isSelf()) { src_callback_list = &mCallbackTextureList ; paused = !isVisible(); } - std::vector<BOOL> is_layer_baked; + std::vector<bool> is_layer_baked; is_layer_baked.resize(mBakedTextureDatas.size(), false); - std::vector<BOOL> use_lkg_baked_layer; // lkg = "last known good" + std::vector<bool> use_lkg_baked_layer; // lkg = "last known good" use_lkg_baked_layer.resize(mBakedTextureDatas.size(), false); mBakedTextureDebugText += llformat("%06d\n",update_counter++); @@ -8667,7 +8774,7 @@ void LLVOAvatar::updateMeshTextures() && layerset_invalid); if (use_lkg_baked_layer[i]) { - layerset->setUpdatesEnabled(TRUE); + layerset->setUpdatesEnabled(true); } } else @@ -8707,7 +8814,7 @@ void LLVOAvatar::updateMeshTextures() { // use last known good layer (no new one) LLViewerFetchedTexture* baked_img = LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[i].mLastTextureID); - mBakedTextureDatas[i].mIsUsed = TRUE; + mBakedTextureDatas[i].mIsUsed = true; debugColorizeSubMeshes(i,LLColor4::red); @@ -8727,7 +8834,7 @@ void LLVOAvatar::updateMeshTextures() // use new layer LLViewerFetchedTexture* baked_img = LLViewerTextureManager::staticCastToFetchedTexture( - getImage( mBakedTextureDatas[i].mTextureIndex, 0 ), TRUE) ; + getImage( mBakedTextureDatas[i].mTextureIndex, 0 ), true) ; if( baked_img->getID() == mBakedTextureDatas[i].mLastTextureID ) { // Even though the file may not be finished loading, @@ -8739,14 +8846,14 @@ void LLVOAvatar::updateMeshTextures() } else { - mBakedTextureDatas[i].mIsLoaded = FALSE; + mBakedTextureDatas[i].mIsLoaded = false; if ( (baked_img->getID() != IMG_INVISIBLE) && ((i == BAKED_HEAD) || (i == BAKED_UPPER) || (i == BAKED_LOWER)) ) { - baked_img->setLoadedCallback(onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID ), + baked_img->setLoadedCallback(onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, true, true, new LLTextureMaskData( mID ), src_callback_list, paused); } - baked_img->setLoadedCallback(onBakedTextureLoaded, SWITCH_TO_BAKED_DISCARD, FALSE, FALSE, new LLUUID( mID ), + baked_img->setLoadedCallback(onBakedTextureLoaded, SWITCH_TO_BAKED_DISCARD, false, false, new LLUUID( mID ), src_callback_list, paused ); if (baked_img->getDiscardLevel() < 0 && !paused) { @@ -8764,8 +8871,8 @@ void LLVOAvatar::updateMeshTextures() debugColorizeSubMeshes(i,LLColor4::yellow ); layerset->createComposite(); - layerset->setUpdatesEnabled( TRUE ); - mBakedTextureDatas[i].mIsUsed = FALSE; + layerset->setUpdatesEnabled( true ); + mBakedTextureDatas[i].mIsUsed = false; avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin(); avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end(); @@ -8818,7 +8925,7 @@ void LLVOAvatar::updateMeshTextures() ++local_tex_iter) { const ETextureIndex texture_index = *local_tex_iter; - const BOOL is_baked_ready = (is_layer_baked[baked_index] && mBakedTextureDatas[baked_index].mIsLoaded) || other_culled; + const bool is_baked_ready = (is_layer_baked[baked_index] && mBakedTextureDatas[baked_index].mIsLoaded) || other_culled; if (isSelf()) { setBakedReady(texture_index, is_baked_ready); @@ -8873,14 +8980,14 @@ void LLVOAvatar::updateMeshTextures() //----------------------------------------------------------------------------- // setLocalTexture() //----------------------------------------------------------------------------- -void LLVOAvatar::setLocalTexture( ETextureIndex type, LLViewerTexture* in_tex, BOOL baked_version_ready, U32 index ) +void LLVOAvatar::setLocalTexture( ETextureIndex type, LLViewerTexture* in_tex, bool baked_version_ready, U32 index ) { // invalid for anyone but self llassert(0); } //virtual -void LLVOAvatar::setBakedReady(LLAvatarAppearanceDefines::ETextureIndex type, BOOL baked_version_exists, U32 index) +void LLVOAvatar::setBakedReady(LLAvatarAppearanceDefines::ETextureIndex type, bool baked_version_exists, U32 index) { // invalid for anyone but self llassert(0); @@ -8892,7 +8999,7 @@ void LLVOAvatar::addChat(const LLChat& chat) mChats.push_back(chat); - S32 chat_length = 0; + size_t chat_length = 0; for( chat_iter = mChats.begin(); chat_iter != mChats.end(); ++chat_iter) { chat_length += chat_iter->mText.size(); @@ -8916,7 +9023,7 @@ void LLVOAvatar::clearChat() } -void LLVOAvatar::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLAvatarAppearanceDefines::EBakedTextureIndex index) +void LLVOAvatar::applyMorphMask(const U8* tex_data, S32 width, S32 height, S32 num_components, LLAvatarAppearanceDefines::EBakedTextureIndex index) { if (index >= BAKED_NUM_INDICES) { @@ -8936,12 +9043,12 @@ void LLVOAvatar::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_com } } -// returns TRUE if morph masks are present and not valid for a given baked texture, FALSE otherwise -BOOL LLVOAvatar::morphMaskNeedsUpdate(LLAvatarAppearanceDefines::EBakedTextureIndex index) +// returns true if morph masks are present and not valid for a given baked texture, false otherwise +bool LLVOAvatar::morphMaskNeedsUpdate(LLAvatarAppearanceDefines::EBakedTextureIndex index) { if (index >= BAKED_NUM_INDICES) { - return FALSE; + return false; } if (!mBakedTextureDatas[index].mMaskedMorphs.empty()) @@ -8956,11 +9063,11 @@ BOOL LLVOAvatar::morphMaskNeedsUpdate(LLAvatarAppearanceDefines::EBakedTextureIn } else { - return FALSE; + return false; } } - return FALSE; + return false; } //----------------------------------------------------------------------------- @@ -9055,7 +9162,7 @@ void LLVOAvatar::clampAttachmentPositions() } } -BOOL LLVOAvatar::hasHUDAttachment() const +bool LLVOAvatar::hasHUDAttachment() const { for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); @@ -9064,10 +9171,10 @@ BOOL LLVOAvatar::hasHUDAttachment() const LLViewerJointAttachment* attachment = iter->second; if (attachment->getIsHUDAttachment() && attachment->getNumObjects() > 0) { - return TRUE; + return true; } } - return FALSE; + return false; } LLBBox LLVOAvatar::getHUDBBox() const @@ -9117,10 +9224,10 @@ void LLVOAvatar::onFirstTEMessageReceived() LL_DEBUGS("Avatar") << avString() << LL_ENDL; if( !mFirstTEMessageReceived ) { - mFirstTEMessageReceived = TRUE; + mFirstTEMessageReceived = true; LLLoadedCallbackEntry::source_callback_list_t* src_callback_list = NULL ; - BOOL paused = FALSE ; + bool paused = false ; if(!isSelf()) { src_callback_list = &mCallbackTextureList ; @@ -9129,22 +9236,22 @@ void LLVOAvatar::onFirstTEMessageReceived() for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - const BOOL layer_baked = isTextureDefined(mBakedTextureDatas[i].mTextureIndex); + const bool layer_baked = isTextureDefined(mBakedTextureDatas[i].mTextureIndex); // Use any baked textures that we have even if they haven't downloaded yet. // (That is, don't do a transition from unbaked to baked.) if (layer_baked) { - LLViewerFetchedTexture* image = LLViewerTextureManager::staticCastToFetchedTexture(getImage( mBakedTextureDatas[i].mTextureIndex, 0 ), TRUE) ; + LLViewerFetchedTexture* image = LLViewerTextureManager::staticCastToFetchedTexture(getImage( mBakedTextureDatas[i].mTextureIndex, 0 ), true) ; mBakedTextureDatas[i].mLastTextureID = image->getID(); // If we have more than one texture for the other baked layers, we'll want to call this for them too. if ( (image->getID() != IMG_INVISIBLE) && ((i == BAKED_HEAD) || (i == BAKED_UPPER) || (i == BAKED_LOWER)) ) { - image->setLoadedCallback( onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID ), + image->setLoadedCallback( onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, true, true, new LLTextureMaskData( mID ), src_callback_list, paused); } LL_DEBUGS("Avatar") << avString() << "layer_baked, setting onInitialBakedTextureLoaded as callback" << LL_ENDL; - image->setLoadedCallback( onInitialBakedTextureLoaded, MAX_DISCARD_LEVEL, FALSE, FALSE, new LLUUID( mID ), + image->setLoadedCallback( onInitialBakedTextureLoaded, MAX_DISCARD_LEVEL, false, false, new LLUUID( mID ), src_callback_list, paused ); if (image->getDiscardLevel() < 0 && !paused) { @@ -9155,7 +9262,7 @@ void LLVOAvatar::onFirstTEMessageReceived() } } - mMeshTexturesDirty = TRUE; + mMeshTexturesDirty = true; gPipeline.markGLRebuild(this); mFirstAppearanceMessageTimer.reset(); @@ -9291,7 +9398,7 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe //mesgsys->getU32Fast(_PREHASH_AppearanceData, _PREHASH_Flags, appearance_flags, 0); } - // Parse the AppearanceData field, if any. + // Parse the AppearanceHover field, if any. contents.mHoverOffsetWasSet = false; if (mesgsys->has(_PREHASH_AppearanceHover)) { @@ -9302,6 +9409,46 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe contents.mHoverOffsetWasSet = true; } + // Get attachment info, if sent + LLUUID attachment_id; + U8 attach_point; + S32 attach_count = mesgsys->getNumberOfBlocksFast(_PREHASH_AttachmentBlock); + LL_DEBUGS("AVAppearanceAttachments") << "Agent " << getID() << " has " + << attach_count << " attachments" << LL_ENDL; + size_t old_size = mSimAttachments.size(); + mSimAttachments.clear(); + for (S32 attach_i = 0; attach_i < attach_count; attach_i++) + { + mesgsys->getUUIDFast(_PREHASH_AttachmentBlock, _PREHASH_ID, attachment_id, attach_i); + mesgsys->getU8Fast(_PREHASH_AttachmentBlock, _PREHASH_AttachmentPoint, attach_point, attach_i); + LL_DEBUGS("AVAppearanceAttachments") << "AV " << getID() << " has attachment " << attach_i << " " + << (attachment_id.isNull() ? "pending" : attachment_id.asString()) + << " on point " << (S32)attach_point << LL_ENDL; + + if (attachment_id.notNull()) + { + mSimAttachments[attachment_id] = attach_point; + } + else + { + // at the moment viewer is only interested in non-null attachments + LL_DEBUGS("AVAppearanceAttachments") << "AV " << getID() + << " has null attachment on point " << (S32)attach_point + << ", discarding" << LL_ENDL; + } + } + + // todo? Doesn't detect if attachments were switched + if (old_size != mSimAttachments.size()) + { + mLastCloudAttachmentCount = 0; + mLastCloudAttachmentChangeTime.reset(); + if (!isFullyLoaded()) + { + mFullyLoadedTimer.reset(); + } + } + // Parse visual params, if any. S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_VisualParam); if( num_blocks > 1) @@ -9464,7 +9611,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } // SUNSHINE CLEANUP - is this case OK now? - S32 num_params = contents->mParamWeights.size(); + auto num_params = contents->mParamWeights.size(); if (num_params <= 1) { // In this case, we have no reliable basis for knowing @@ -9508,7 +9655,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) void LLVOAvatar::applyParsedAppearanceMessage(LLAppearanceMessageContents& contents, bool slam_params) { - S32 num_params = contents.mParamWeights.size(); + auto num_params = contents.mParamWeights.size(); ESex old_sex = getSex(); if (applyParsedTEMessage(contents.mTEContents) > 0 && isChanged(TEXTURE)) @@ -9525,7 +9672,7 @@ void LLVOAvatar::applyParsedAppearanceMessage(LLAppearanceMessageContents& conte { LL_DEBUGS("Avatar") << avString() << " baked_index " << (S32) baked_index << " using mLastTextureID " << mBakedTextureDatas[baked_index].mLastTextureID << LL_ENDL; setTEImage(mBakedTextureDatas[baked_index].mTextureIndex, - LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[baked_index].mLastTextureID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); + LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[baked_index].mLastTextureID, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); } else { @@ -9537,8 +9684,8 @@ void LLVOAvatar::applyParsedAppearanceMessage(LLAppearanceMessageContents& conte // runway - was // if (!is_first_appearance_message ) // which means it would be called on second appearance message - probably wrong. - BOOL is_first_appearance_message = !mFirstAppearanceMessageReceived; - mFirstAppearanceMessageReceived = TRUE; + bool is_first_appearance_message = !mFirstAppearanceMessageReceived; + mFirstAppearanceMessageReceived = true; //LL_DEBUGS("Avatar") << avString() << "processAvatarAppearance start " << mID // << " first? " << is_first_appearance_message << " self? " << isSelf() << LL_ENDL; @@ -9548,25 +9695,25 @@ void LLVOAvatar::applyParsedAppearanceMessage(LLAppearanceMessageContents& conte onFirstTEMessageReceived(); } - setCompositeUpdatesEnabled( FALSE ); + setCompositeUpdatesEnabled( false ); gPipeline.markGLRebuild(this); // Apply visual params if( num_params > 1) { //LL_DEBUGS("Avatar") << avString() << " handle visual params, num_params " << num_params << LL_ENDL; - BOOL params_changed = FALSE; - BOOL interp_params = FALSE; + bool params_changed = false; + bool interp_params = false; S32 params_changed_count = 0; - for( S32 i = 0; i < num_params; i++ ) + for( size_t i = 0; i < num_params; i++ ) { LLVisualParam* param = contents.mParams[i]; F32 newWeight = contents.mParamWeights[i]; if (slam_params || is_first_appearance_message || (param->getWeight() != newWeight)) { - params_changed = TRUE; + params_changed = true; params_changed_count++; if(is_first_appearance_message || slam_params) @@ -9576,7 +9723,7 @@ void LLVOAvatar::applyParsedAppearanceMessage(LLAppearanceMessageContents& conte } else { - interp_params = TRUE; + interp_params = true; param->setAnimationTarget(newWeight); } } @@ -9643,7 +9790,7 @@ void LLVOAvatar::applyParsedAppearanceMessage(LLAppearanceMessageContents& conte setHoverOffset(LLVector3(0.0, 0.0, 0.0)); } - setCompositeUpdatesEnabled( TRUE ); + setCompositeUpdatesEnabled( true ); // If all of the avatars are completely baked, release the global image caches to conserve memory. LLVOAvatar::cullAvatarsByPixelArea(); @@ -9665,7 +9812,7 @@ LLViewerTexture* LLVOAvatar::getBakedTexture(const U8 te) return NULL; } - BOOL is_layer_baked = isTextureDefined(mBakedTextureDatas[te].mTextureIndex); + bool is_layer_baked = isTextureDefined(mBakedTextureDatas[te].mTextureIndex); LLViewerTexLayerSet* layerset = NULL; layerset = getTexLayerSet(te); @@ -9673,13 +9820,13 @@ LLViewerTexture* LLVOAvatar::getBakedTexture(const U8 te) if (!isEditingAppearance() && is_layer_baked) { - LLViewerFetchedTexture* baked_img = LLViewerTextureManager::staticCastToFetchedTexture(getImage(mBakedTextureDatas[te].mTextureIndex, 0), TRUE); + LLViewerFetchedTexture* baked_img = LLViewerTextureManager::staticCastToFetchedTexture(getImage(mBakedTextureDatas[te].mTextureIndex, 0), true); return baked_img; } else if (layerset && isEditingAppearance()) { layerset->createComposite(); - layerset->setUpdatesEnabled(TRUE); + layerset->setUpdatesEnabled(true); return layerset->getViewerComposite(); } @@ -9767,7 +9914,7 @@ void LLVOAvatar::getAnimNames( std::vector<std::string>* names ) } // static -void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ) +void LLVOAvatar::onBakedTextureMasksLoaded( bool success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, bool final, void* userdata ) { if (!userdata) return; @@ -9783,6 +9930,8 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerFetchedTexture { if(aux_src && aux_src->getComponents() == 1) { + LLImageDataSharedLock lock(aux_src); + if (!aux_src->getData()) { LL_ERRS() << "No auxiliary source (morph mask) data for image id " << id << LL_ENDL; @@ -9809,7 +9958,7 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerFetchedTexture //LL_INFOS() << "onBakedTextureMasksLoaded for head " << id << " discard = " << discard_level << LL_ENDL; self->mBakedTextureDatas[BAKED_HEAD].mTexLayerSet->applyMorphMask(aux_src->getData(), aux_src->getWidth(), aux_src->getHeight(), 1); maskData->mLastDiscardLevel = discard_level; */ - BOOL found_texture_id = false; + bool found_texture_id = false; for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearance::getDictionary()->getTextures().begin(); iter != LLAvatarAppearance::getDictionary()->getTextures().end(); ++iter) @@ -9856,7 +10005,7 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerFetchedTexture } // static -void LLVOAvatar::onInitialBakedTextureLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ) +void LLVOAvatar::onInitialBakedTextureLoaded( bool success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, bool final, void* userdata ) { LLUUID *avatar_idp = (LLUUID *)userdata; LLVOAvatar *selfp = (LLVOAvatar *)gObjectList.findObject(*avatar_idp); @@ -9877,9 +10026,9 @@ void LLVOAvatar::onInitialBakedTextureLoaded( BOOL success, LLViewerFetchedTextu } // Static -void LLVOAvatar::onBakedTextureLoaded(BOOL success, +void LLVOAvatar::onBakedTextureLoaded(bool success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, - S32 discard_level, BOOL final, void* userdata) + S32 discard_level, bool final, void* userdata) { //LL_DEBUGS("Avatar") << "onBakedTextureLoaded: " << src_vi->getID() << LL_ENDL; @@ -9947,7 +10096,7 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) local_tex_iter != baked_dict->mLocalTextures.end(); ++local_tex_iter) { - if (isSelf()) setBakedReady(*local_tex_iter, TRUE); + if (isSelf()) setBakedReady(*local_tex_iter, true); } // ! BACKWARDS COMPATIBILITY ! @@ -10308,7 +10457,7 @@ S32 LLVOAvatar::getUnbakedPixelAreaRank() struct CompareScreenAreaGreater { - BOOL operator()(const LLCharacter* const& lhs, const LLCharacter* const& rhs) + bool operator()(const LLCharacter* const& lhs, const LLCharacter* const& rhs) { return lhs->getPixelArea() > rhs->getPixelArea(); } @@ -10325,14 +10474,14 @@ void LLVOAvatar::cullAvatarsByPixelArea() iter != LLCharacter::sInstances.end(); ++iter) { LLVOAvatar* inst = (LLVOAvatar*) *iter; - BOOL culled; + bool culled; if (inst->isSelf() || inst->isFullyBaked()) { - culled = FALSE; + culled = false; } else { - culled = TRUE; + culled = true; } if (inst->mCulled != culled) @@ -10376,7 +10525,7 @@ void LLVOAvatar::startAppearanceAnimation() { if(!mAppearanceAnimating) { - mAppearanceAnimating = TRUE; + mAppearanceAnimating = true; mAppearanceMorphTimer.reset(); mLastAppearanceBlendTime = 0.f; } @@ -10421,19 +10570,19 @@ LLHost LLVOAvatar::getObjectHost() const } } -BOOL LLVOAvatar::updateLOD() +bool LLVOAvatar::updateLOD() { if (mDrawable.isNull()) { - return FALSE; + return false; } if (!LLPipeline::sImpostorRender && isImpostor() && 0 != mDrawable->getNumFaces() && mDrawable->getFace(0)->hasGeometry()) { - return TRUE; + return true; } - BOOL res = updateJointLODs(); + bool res = updateJointLODs(); LLFace* facep = mDrawable->getFace(0); if (!facep || !facep->getVertexBuffer()) @@ -10445,7 +10594,7 @@ BOOL LLVOAvatar::updateLOD() { //LOD changed or new mesh created, allocate new vertex buffer if needed updateMeshData(); mDirtyMesh = 0; - mNeedsSkin = TRUE; + mNeedsSkin = true; mDrawable->clearState(LLDrawable::REBUILD_GEOMETRY); } updateVisibility(); @@ -10622,16 +10771,16 @@ void LLVOAvatar::updateImpostors() } } - LLCharacter::sAllowInstancesChange = TRUE; + LLCharacter::sAllowInstancesChange = true; } // virtual -BOOL LLVOAvatar::isImpostor() +bool LLVOAvatar::isImpostor() { return isVisuallyMuted() || (sLimitNonImpostors && (mUpdatePeriod > 1)); } -BOOL LLVOAvatar::shouldImpostor(const F32 rank_factor) +bool LLVOAvatar::shouldImpostor(const F32 rank_factor) { if (isSelf()) { @@ -10644,7 +10793,7 @@ BOOL LLVOAvatar::shouldImpostor(const F32 rank_factor) return sLimitNonImpostors && (mVisibilityRank > sMaxNonImpostors * rank_factor); } -BOOL LLVOAvatar::needsImpostorUpdate() const +bool LLVOAvatar::needsImpostorUpdate() const { return mNeedsImpostorUpdate; } @@ -10970,7 +11119,7 @@ void LLVOAvatar::accountRenderComplexityForObject( const LLVOVolume* volume = attached_object->mDrawable->getVOVolume(); if (volume) { - BOOL is_rigged_mesh = volume->isRiggedMeshFast(); + bool is_rigged_mesh = volume->isRiggedMeshFast(); LLHUDComplexity hud_object_complexity; hud_object_complexity.objectName = attached_object->getAttachmentItemName(); hud_object_complexity.objectId = attached_object->getAttachmentItemID(); @@ -11006,7 +11155,7 @@ void LLVOAvatar::accountRenderComplexityForObject( attached_object->mRiggedAttachedWarned = true; } - hud_object_complexity.texturesCount += textures.size(); + hud_object_complexity.texturesCount += static_cast<U32>(textures.size()); for (LLVOVolume::texture_cost_t::iterator volume_texture = textures.begin(); volume_texture != textures.end(); @@ -11167,7 +11316,7 @@ void LLVOAvatar::calculateUpdateRenderComplexity() void LLVOAvatar::setVisualMuteSettings(VisualMuteSettings set) { mVisuallyMuteSetting = set; - mNeedsImpostorUpdate = TRUE; + mNeedsImpostorUpdate = true; mLastImpostorUpdateReason = 7; LLRenderMuteList::getInstance()->saveVisualMuteSetting(getID(), S32(set)); @@ -11180,7 +11329,10 @@ void LLVOAvatar::setOverallAppearanceNormal() return; LLVector3 pelvis_pos = getJoint("mPelvis")->getPosition(); - resetSkeleton(false); + if (isControlAvatar() || mLastProcessedAppearance) + { + resetSkeleton(false); + } getJoint("mPelvis")->setPosition(pelvis_pos); for (auto it = mJellyAnims.begin(); it != mJellyAnims.end(); ++it) @@ -11210,7 +11362,7 @@ void LLVOAvatar::setOverallAppearanceJellyDoll() ++anim_it) { { - stopMotion(anim_it->first, TRUE); + stopMotion(anim_it->first, true); } } } @@ -11249,7 +11401,7 @@ void LLVOAvatar::updateOverallAppearance() mOverallAppearance = new_overall; if (!isSelf()) { - mNeedsImpostorUpdate = TRUE; + mNeedsImpostorUpdate = true; mLastImpostorUpdateReason = 8; } updateMeshVisibility(); @@ -11289,7 +11441,7 @@ void LLVOAvatar::updateOverallAppearanceAnimations() if (!is_playing) { // Anim was not requested for this av by sim, but may be playing locally - stopMotion(*it, TRUE); + stopMotion(*it, true); } } mJellyAnims.clear(); @@ -11400,7 +11552,7 @@ void LLVOAvatar::calcMutedAVColor() } // static -BOOL LLVOAvatar::isIndexLocalTexture(ETextureIndex index) +bool LLVOAvatar::isIndexLocalTexture(ETextureIndex index) { return (index < 0 || index >= TEX_NUM_INDICES) ? false @@ -11408,7 +11560,7 @@ BOOL LLVOAvatar::isIndexLocalTexture(ETextureIndex index) } // static -BOOL LLVOAvatar::isIndexBakedTexture(ETextureIndex index) +bool LLVOAvatar::isIndexBakedTexture(ETextureIndex index) { return (index < 0 || index >= TEX_NUM_INDICES) ? false @@ -11456,44 +11608,42 @@ F32 calc_bouncy_animation(F32 x) } //virtual -BOOL LLVOAvatar::isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex te, U32 index ) const +bool LLVOAvatar::isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex te, U32 index ) const { if (isIndexLocalTexture(te)) { - return FALSE; + return false; } - if( !getImage( te, index ) ) + LLViewerTexture* tex = getImage(te, index); + if (!tex) { LL_WARNS() << "getImage( " << te << ", " << index << " ) returned 0" << LL_ENDL; - return FALSE; + return false; } - return (getImage(te, index)->getID() != IMG_DEFAULT_AVATAR && - getImage(te, index)->getID() != IMG_DEFAULT); + return (tex->getID() != IMG_DEFAULT_AVATAR && + tex->getID() != IMG_DEFAULT); } //virtual -BOOL LLVOAvatar::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const +bool LLVOAvatar::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const { if (isIndexLocalTexture(type)) { return isTextureDefined(type, index); } - else - { - // baked textures can use TE images directly - return ((isTextureDefined(type) || isSelf()) - && (getTEImage(type)->getID() != IMG_INVISIBLE - || LLDrawPoolAlpha::sShowDebugAlpha)); - } + + // baked textures can use TE images directly + return ((isTextureDefined(type) || isSelf()) && + (getTEImage(type)->getID() != IMG_INVISIBLE || LLDrawPoolAlpha::sShowDebugAlpha)); } //virtual -BOOL LLVOAvatar::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerWearable *wearable) const +bool LLVOAvatar::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerWearable *wearable) const { // non-self avatars don't have wearables - return FALSE; + return false; } void LLVOAvatar::placeProfileQuery() @@ -11617,5 +11767,8 @@ F32 LLVOAvatar::getAverageGPURenderTime() return ret; } - +bool LLVOAvatar::isBuddy() const +{ + return LLAvatarTracker::instance().isBuddy(getID()); +} diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 1ccefa9c1e..1ca8b81553 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -133,10 +133,10 @@ public: const EObjectUpdateType update_type, LLDataPacker *dp); virtual void idleUpdate(LLAgent &agent, const F64 &time); - /*virtual*/ BOOL updateLOD(); - BOOL updateJointLODs(); + /*virtual*/ bool updateLOD(); + bool updateJointLODs(); void updateLODRiggedAttachments( void ); - /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate. + /*virtual*/ bool isActive() const; // Whether this object needs to do an idleUpdate. S32Bytes totalTextureMemForUUIDS(std::set<LLUUID>& ids); bool allTexturesCompletelyDownloaded(std::set<LLUUID>& ids) const; bool allLocalTexturesCompletelyDownloaded() const; @@ -154,18 +154,18 @@ public: /*virtual*/ void onShift(const LLVector4a& shift_vector); /*virtual*/ U32 getPartitionType() const; /*virtual*/ const LLVector3 getRenderPosition() const; - /*virtual*/ void updateDrawable(BOOL force_damped); + /*virtual*/ void updateDrawable(bool force_damped); /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); - /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); + /*virtual*/ bool updateGeometry(LLDrawable *drawable); /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); /*virtual*/ void updateRegion(LLViewerRegion *regionp); /*virtual*/ void updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax); void calculateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax); - /*virtual*/ BOOL lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, + /*virtual*/ bool lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, S32 face = -1, // which face to check, -1 = ALL_SIDES - BOOL pick_transparent = FALSE, - BOOL pick_rigged = FALSE, - BOOL pick_unselectable = TRUE, + bool pick_transparent = false, + bool pick_rigged = false, + bool pick_unselectable = true, S32* face_hit = NULL, // which face was hit LLVector4a* intersection = NULL, // return the intersection point LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point @@ -174,9 +174,9 @@ public: virtual LLViewerObject* lineSegmentIntersectRiggedAttachments( const LLVector4a& start, const LLVector4a& end, S32 face = -1, // which face to check, -1 = ALL_SIDES - BOOL pick_transparent = FALSE, - BOOL pick_rigged = FALSE, - BOOL pick_unselectable = TRUE, + bool pick_transparent = false, + bool pick_rigged = false, + bool pick_unselectable = true, S32* face_hit = NULL, // which face was hit LLVector4a* intersection = NULL, // return the intersection point LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point @@ -193,8 +193,8 @@ public: /*virtual*/ LLVector3 getCharacterAngularVelocity(); /*virtual*/ LLUUID remapMotionID(const LLUUID& id); - /*virtual*/ BOOL startMotion(const LLUUID& id, F32 time_offset = 0.f); - /*virtual*/ BOOL stopMotion(const LLUUID& id, BOOL stop_immediate = FALSE); + /*virtual*/ bool startMotion(const LLUUID& id, F32 time_offset = 0.f); + /*virtual*/ bool stopMotion(const LLUUID& id, bool stop_immediate = false); virtual bool hasMotionFromSource(const LLUUID& source_id); virtual void stopMotionFromSource(const LLUUID& source_id); virtual void requestStopMotion(LLMotion* motion); @@ -254,6 +254,7 @@ public: virtual bool isControlAvatar() const { return mIsControlAvatar; } // True if this avatar is a control av (no associated user) virtual bool isUIAvatar() const { return mIsUIAvatar; } // True if this avatar is a supplemental av used in some UI views (no associated user) + virtual bool isBuddy() const; // If this is an attachment, return the avatar it is attached to. Otherwise NULL. virtual const LLVOAvatar *getAttachedAvatar() const { return NULL; } @@ -351,23 +352,23 @@ public: //-------------------------------------------------------------------- public: static S32 sRenderName; - static BOOL sRenderGroupTitles; + static bool sRenderGroupTitles; static const U32 NON_IMPOSTORS_MAX_SLIDER; /* Must equal the maximum allowed the RenderAvatarMaxNonImpostors * slider in panel_preferences_graphics1.xml */ static U32 sMaxNonImpostors; // affected by control "RenderAvatarMaxNonImpostors" static bool sLimitNonImpostors; // use impostors for far away avatars static F32 sRenderDistance; // distance at which avatars will render. - static BOOL sShowAnimationDebug; // show animation debug info - static BOOL sShowCollisionVolumes; // show skeletal collision volumes - static BOOL sVisibleInFirstPerson; + static bool sShowAnimationDebug; // show animation debug info + static bool sShowCollisionVolumes; // show skeletal collision volumes + static bool sVisibleInFirstPerson; static S32 sNumLODChangesThisFrame; static S32 sNumVisibleChatBubbles; - static BOOL sDebugInvisible; - static BOOL sShowAttachmentPoints; + static bool sDebugInvisible; + static bool sShowAttachmentPoints; static F32 sLODFactor; // user-settable LOD factor static F32 sPhysicsLODFactor; // user-settable physics LOD factor - static BOOL sJointDebug; // output total number of joints being touched for each avatar - static BOOL sLipSyncEnabled; + static bool sJointDebug; // output total number of joints being touched for each avatar + static bool sLipSyncEnabled; static LLPointer<LLViewerTexture> sCloudTexture; @@ -384,7 +385,8 @@ public: // Loading state //-------------------------------------------------------------------- public: - BOOL isFullyLoaded() const; + bool isFullyLoaded() const; + F32 getFirstDecloudTime() const {return mFirstDecloudTime;} // check and return current state relative to limits // default will test only the geometry (combined=false). @@ -398,8 +400,8 @@ public: bool isTooComplex() const; bool visualParamWeightsAreDefault(); virtual bool getIsCloud() const; - BOOL isFullyTextured() const; - BOOL hasGray() const; + bool isFullyTextured() const; + bool hasGray() const; S32 getRezzedStatus() const; // 0 = cloud, 1 = gray, 2 = textured, 3 = textured and fully downloaded. void updateRezzedStatusTimers(S32 status); @@ -417,19 +419,19 @@ public: protected: LLViewerStats::PhaseMap& getPhases() { return mPhases; } - BOOL updateIsFullyLoaded(); - BOOL processFullyLoadedChange(bool loading); + bool updateIsFullyLoaded(); + bool processFullyLoadedChange(bool loading); void updateRuthTimer(bool loading); F32 calcMorphAmount(); private: - BOOL mFirstFullyVisible; - F32 mFirstUseDelaySeconds; + bool mFirstFullyVisible; + F32 mFirstDecloudTime; LLFrameTimer mFirstAppearanceMessageTimer; - BOOL mFullyLoaded; - BOOL mPreviousFullyLoaded; - BOOL mFullyLoadedInitialized; + bool mFullyLoaded; + bool mPreviousFullyLoaded; + bool mFullyLoadedInitialized; S32 mFullyLoadedFrameCounter; LLColor4 mMutedAVColor; LLFrameTimer mFullyLoadedTimer; @@ -464,7 +466,7 @@ public: void debugBodySize() const; void postPelvisSetRecalc( void ); - /*virtual*/ BOOL loadSkeletonNode(); + /*virtual*/ bool loadSkeletonNode(); void initAttachmentPoints(bool ignore_hud_joints = false); /*virtual*/ void buildCharacter(); void resetVisualParams(); @@ -490,7 +492,14 @@ public: U32 renderImpostor(LLColor4U color = LLColor4U(255,255,255,255), S32 diffuse_channel = 0); bool isVisuallyMuted(); bool isInMuteList() const; - void forceUpdateVisualMuteSettings(); + + // states for RenderAvatarComplexityMode + enum ERenderComplexityMode + { + AV_RENDER_LIMIT_BY_COMPLEXITY = 0, + AV_RENDER_ALWAYS_SHOW_FRIENDS = 1, + AV_RENDER_ONLY_SHOW_FRIENDS = 2 + }; // Visual Mute Setting is an input. Does not necessarily determine // what the avatar looks like, because it interacts with other @@ -535,7 +544,7 @@ public: U32 renderRigid(); U32 renderSkinned(); F32 getLastSkinTime() { return mLastSkinTime; } - U32 renderTransparent(BOOL first_pass); + U32 renderTransparent(bool first_pass); void renderCollisionVolumes(); void renderBones(const std::string &selected_joint = std::string()); void renderJoints(); @@ -552,7 +561,7 @@ private: F32 mAttachmentEstTriangleCount; bool shouldAlphaMask(); - BOOL mNeedsSkin; // avatar has been animated and verts have not been updated + bool mNeedsSkin; // avatar has been animated and verts have not been updated F32 mLastSkinTime; //value of gFrameTimeSeconds at last skin update S32 mUpdatePeriod; @@ -593,8 +602,8 @@ public: // Morph masks //-------------------------------------------------------------------- public: - /*virtual*/ void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLAvatarAppearanceDefines::EBakedTextureIndex index = LLAvatarAppearanceDefines::BAKED_NUM_INDICES); - BOOL morphMaskNeedsUpdate(LLAvatarAppearanceDefines::EBakedTextureIndex index = LLAvatarAppearanceDefines::BAKED_NUM_INDICES); + /*virtual*/ void applyMorphMask(const U8* tex_data, S32 width, S32 height, S32 num_components, LLAvatarAppearanceDefines::EBakedTextureIndex index = LLAvatarAppearanceDefines::BAKED_NUM_INDICES); + bool morphMaskNeedsUpdate(LLAvatarAppearanceDefines::EBakedTextureIndex index = LLAvatarAppearanceDefines::BAKED_NUM_INDICES); //-------------------------------------------------------------------- @@ -610,7 +619,7 @@ protected: void updateVisibility(); private: U32 mVisibilityRank; - BOOL mVisible; + bool mVisible; //-------------------------------------------------------------------- // Shadowing @@ -627,9 +636,9 @@ private: // Impostors //-------------------------------------------------------------------- public: - virtual BOOL isImpostor(); - BOOL shouldImpostor(const F32 rank_factor = 1.0); - BOOL needsImpostorUpdate() const; + virtual bool isImpostor(); + bool shouldImpostor(const F32 rank_factor = 1.0); + bool needsImpostorUpdate() const; const LLVector3& getImpostorOffset() const; const LLVector2& getImpostorDim() const; void getImpostorValues(LLVector4a* extents, LLVector3& angle, F32& distance) const; @@ -638,7 +647,7 @@ public: static void resetImpostors(); static void updateImpostors(); LLRenderTarget mImpostor; - BOOL mNeedsImpostorUpdate; + bool mNeedsImpostorUpdate; S32 mLastImpostorUpdateReason; F32SecondsImplicit mLastImpostorUpdateFrameTime; const LLVector3* getLastAnimExtents() const { return mLastAnimExtents; } @@ -649,7 +658,7 @@ private: LLVector2 mImpostorDim; // This becomes true in the constructor and false after the first // idleUpdateMisc(). Not clear it serves any purpose. - BOOL mNeedsAnimUpdate; + bool mNeedsAnimUpdate; bool mNeedsExtentUpdate; LLVector3 mImpostorAngle; F32 mImpostorDistance; @@ -665,7 +674,7 @@ private: public: LLVector4 mWindVec; F32 mRipplePhase; - BOOL mBelowWater; + bool mBelowWater; private: F32 mWindFreq; LLFrameTimer mRippleTimer; @@ -678,9 +687,9 @@ private: //-------------------------------------------------------------------- public: static void cullAvatarsByPixelArea(); - BOOL isCulled() const { return mCulled; } + bool isCulled() const { return mCulled; } private: - BOOL mCulled; + bool mCulled; //-------------------------------------------------------------------- // Constants @@ -704,13 +713,13 @@ public: // Loading status //-------------------------------------------------------------------- public: - virtual BOOL isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex type, U32 index = 0) const; - virtual BOOL isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, U32 index = 0) const; - virtual BOOL isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerWearable *wearable) const; + virtual bool isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex type, U32 index = 0) const; + virtual bool isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, U32 index = 0) const; + virtual bool isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerWearable *wearable) const; - BOOL isFullyBaked(); - static BOOL areAllNearbyInstancesBaked(S32& grey_avatars); - static void getNearbyRezzedStats(std::vector<S32>& counts); + bool isFullyBaked(); + static bool areAllNearbyInstancesBaked(S32& grey_avatars); + static void getNearbyRezzedStats(std::vector<S32>& counts, F32& avg_cloud_time, S32& cloud_avatars); static std::string rezStatusToString(S32 status); //-------------------------------------------------------------------- @@ -721,16 +730,16 @@ public: void releaseComponentTextures(); // ! BACKWARDS COMPATIBILITY ! protected: - static void onBakedTextureMasksLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); - static void onInitialBakedTextureLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); - static void onBakedTextureLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); + static void onBakedTextureMasksLoaded(bool success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, bool final, void* userdata); + static void onInitialBakedTextureLoaded(bool success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, bool final, void* userdata); + static void onBakedTextureLoaded(bool success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, bool final, void* userdata); virtual void removeMissingBakedTextures(); void useBakedTexture(const LLUUID& id); LLViewerTexLayerSet* getTexLayerSet(const U32 index) const { return dynamic_cast<LLViewerTexLayerSet*>(mBakedTextureDatas[index].mTexLayerSet); } LLLoadedCallbackEntry::source_callback_list_t mCallbackTextureList ; - BOOL mLoadedCallbacksPaused; + bool mLoadedCallbacksPaused; S32 mLoadedCallbackTextures; // count of 'loaded' baked textures, filled from mCallbackTextureList LLFrameTimer mLastTexCallbackAddedTime; std::set<LLUUID> mTextureIDs; @@ -738,10 +747,10 @@ protected: // Local Textures //-------------------------------------------------------------------- protected: - virtual void setLocalTexture(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerTexture* tex, BOOL baked_version_exits, U32 index = 0); - virtual void addLocalTextureStats(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerFetchedTexture* imagep, F32 texel_area_ratio, BOOL rendered, BOOL covered_by_baked); + virtual void setLocalTexture(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerTexture* tex, bool baked_version_exits, U32 index = 0); + virtual void addLocalTextureStats(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerFetchedTexture* imagep, F32 texel_area_ratio, bool rendered, bool covered_by_baked); // MULTI-WEARABLE: make self-only? - virtual void setBakedReady(LLAvatarAppearanceDefines::ETextureIndex type, BOOL baked_version_exists, U32 index = 0); + virtual void setBakedReady(LLAvatarAppearanceDefines::ETextureIndex type, bool baked_version_exists, U32 index = 0); //-------------------------------------------------------------------- // Texture accessors @@ -776,8 +785,8 @@ public: // Static texture/mesh/baked dictionary //-------------------------------------------------------------------- public: - static BOOL isIndexLocalTexture(LLAvatarAppearanceDefines::ETextureIndex i); - static BOOL isIndexBakedTexture(LLAvatarAppearanceDefines::ETextureIndex i); + static bool isIndexLocalTexture(LLAvatarAppearanceDefines::ETextureIndex i); + static bool isIndexBakedTexture(LLAvatarAppearanceDefines::ETextureIndex i); //-------------------------------------------------------------------- // Messaging @@ -785,8 +794,8 @@ public: public: void onFirstTEMessageReceived(); private: - BOOL mFirstTEMessageReceived; - BOOL mFirstAppearanceMessageReceived; + bool mFirstTEMessageReceived; + bool mFirstAppearanceMessageReceived; /** Textures ** ** @@ -841,13 +850,13 @@ private: virtual void dirtyMesh(S32 priority); // Dirty the avatar mesh, with priority LLViewerJoint* getViewerJoint(S32 idx); S32 mDirtyMesh; // 0 -- not dirty, 1 -- morphed, 2 -- LOD - BOOL mMeshTexturesDirty; + bool mMeshTexturesDirty; //-------------------------------------------------------------------- // Destroy invisible mesh //-------------------------------------------------------------------- protected: - BOOL mMeshValid; + bool mMeshValid; LLFrameTimer mMeshInvisibleTime; /** Meshes @@ -873,31 +882,31 @@ public: // Appearance morphing //-------------------------------------------------------------------- public: - BOOL getIsAppearanceAnimating() const { return mAppearanceAnimating; } + bool getIsAppearanceAnimating() const { return mAppearanceAnimating; } // True if we are computing our appearance via local compositing // instead of baked textures, as for example during wearable // editing or when waiting for a subsequent server rebake. - /*virtual*/ BOOL isUsingLocalAppearance() const { return mUseLocalAppearance; } + /*virtual*/ bool isUsingLocalAppearance() const { return mUseLocalAppearance; } // True if we are currently in appearance editing mode. Often but // not always the same as isUsingLocalAppearance(). - /*virtual*/ BOOL isEditingAppearance() const { return mIsEditingAppearance; } + /*virtual*/ bool isEditingAppearance() const { return mIsEditingAppearance; } // FIXME review isUsingLocalAppearance uses, some should be isEditing instead. private: - BOOL mAppearanceAnimating; + bool mAppearanceAnimating; LLFrameTimer mAppearanceMorphTimer; F32 mLastAppearanceBlendTime; - BOOL mIsEditingAppearance; // flag for if we're actively in appearance editing mode - BOOL mUseLocalAppearance; // flag for if we're using a local composite + bool mIsEditingAppearance; // flag for if we're actively in appearance editing mode + bool mUseLocalAppearance; // flag for if we're using a local composite //-------------------------------------------------------------------- // Visibility //-------------------------------------------------------------------- public: - BOOL isVisible() const; + bool isVisible() const; virtual bool shouldRenderRigged() const; void setVisibilityRank(U32 rank); U32 getVisibilityRank() const { return mVisibilityRank; } @@ -917,12 +926,12 @@ public: public: void clampAttachmentPositions(); virtual const LLViewerJointAttachment* attachObject(LLViewerObject *viewer_object); - virtual BOOL detachObject(LLViewerObject *viewer_object); + virtual bool detachObject(LLViewerObject *viewer_object); static bool getRiggedMeshID( LLViewerObject* pVO, LLUUID& mesh_id ); void cleanupAttachedMesh( LLViewerObject* pVO ); bool hasPendingAttachedMeshes(); static LLVOAvatar* findAvatarFromAttachment(LLViewerObject* obj); - /*virtual*/ BOOL isWearingWearableType(LLWearableType::EType type ) const; + /*virtual*/ bool isWearingWearableType(LLWearableType::EType type ) const; LLViewerObject * findAttachmentByID( const LLUUID & target_id ) const; LLViewerJointAttachment* getTargetAttachmentPoint(LLViewerObject* viewer_object); @@ -934,22 +943,28 @@ protected: // Map of attachment points, by ID //-------------------------------------------------------------------- public: - S32 getAttachmentCount(); // Warning: order(N) not order(1) // currently used only by -self + S32 getAttachmentCount() const; // Warning: order(N) not order(1) typedef std::map<S32, LLViewerJointAttachment*> attachment_map_t; attachment_map_t mAttachmentPoints; std::vector<LLPointer<LLViewerObject> > mPendingAttachment; + // List of attachments' ids with attach points from simulator. + // we need this info to know when all attachments are present. + std::map<LLUUID, S32> mSimAttachments; + S32 mLastCloudAttachmentCount; + LLFrameTimer mLastCloudAttachmentChangeTime; + //-------------------------------------------------------------------- // HUD functions //-------------------------------------------------------------------- public: - BOOL hasHUDAttachment() const; + bool hasHUDAttachment() const; LLBBox getHUDBBox() const; void resetHUDAttachments(); S32 getMaxAttachments() const; - BOOL canAttachMoreObjects(U32 n=1) const; + bool canAttachMoreObjects(U32 n=1) const; S32 getMaxAnimatedObjectAttachments() const; - BOOL canAttachMoreAnimatedObjects(U32 n=1) const; + bool canAttachMoreAnimatedObjects(U32 n=1) const; protected: U32 getNumAttachments() const; // O(N), not O(1) U32 getNumAnimatedObjectAttachments() const; // O(N), not O(1) @@ -967,10 +982,10 @@ protected: // Animations //-------------------------------------------------------------------- public: - BOOL isAnyAnimationSignaled(const LLUUID *anim_array, const S32 num_anims) const; + bool isAnyAnimationSignaled(const LLUUID *anim_array, const S32 num_anims) const; void processAnimationStateChanges(); protected: - BOOL processSingleAnimationStateChange(const LLUUID &anim_id, BOOL start); + bool processSingleAnimationStateChange(const LLUUID &anim_id, bool start); void resetAnimations(); private: LLTimer mAnimTimer; @@ -994,8 +1009,8 @@ public: public: void addChat(const LLChat& chat); void clearChat(); - void startTyping() { mTyping = TRUE; mTypingTimer.reset(); } - void stopTyping() { mTyping = FALSE; } + void startTyping() { mTyping = true; mTypingTimer.reset(); } + void stopTyping() { mTyping = false; } private: bool mVisibleChat; @@ -1011,7 +1026,7 @@ private: // Flight //-------------------------------------------------------------------- public: - BOOL mInAir; + bool mInAir; LLFrameTimer mTimeInAir; /** Actions @@ -1025,7 +1040,7 @@ public: private: F32 mSpeedAccum; // measures speed (for diagnostics mostly). - BOOL mTurning; // controls hysteresis on avatar rotation + bool mTurning; // controls hysteresis on avatar rotation F32 mSpeed; // misc. animation repeated state //-------------------------------------------------------------------- @@ -1043,7 +1058,7 @@ protected: // Material being stepped on //-------------------------------------------------------------------- private: - BOOL mStepOnLand; + bool mStepOnLand; U8 mStepMaterial; LLVector3 mStepObjectVelocity; @@ -1057,7 +1072,7 @@ private: **/ public: - /*virtual*/ BOOL setParent(LLViewerObject* parent); + /*virtual*/ bool setParent(LLViewerObject* parent); /*virtual*/ void addChild(LLViewerObject *childp); /*virtual*/ void removeChild(LLViewerObject *childp); @@ -1065,13 +1080,13 @@ public: // Sitting //-------------------------------------------------------------------- public: - void sitDown(BOOL bSitting); - BOOL isSitting(){return mIsSitting;} + void sitDown(bool bSitting); + bool isSitting(){return mIsSitting;} void sitOnObject(LLViewerObject *sit_object); void getOffObject(); private: // set this property only with LLVOAvatar::sitDown method - BOOL mIsSitting; + bool mIsSitting; // position backup in case of missing data LLVector3 mLastRootPos; @@ -1100,7 +1115,7 @@ private: bool mNameFriend; bool mNameCloud; F32 mNameAlpha; - BOOL mRenderGroupTitles; + bool mRenderGroupTitles; //-------------------------------------------------------------------- // Display the name (then optionally fade it out) @@ -1111,7 +1126,7 @@ public: private: LLFrameTimer mTimeVisible; std::deque<LLChat> mChats; - BOOL mTyping; + bool mTyping; LLFrameTimer mTypingTimer; /** Name @@ -1149,8 +1164,8 @@ public: void setFootPlane(const LLVector4 &plane) { mFootPlane = plane; } LLVector4 mFootPlane; private: - BOOL mWasOnGroundLeft; - BOOL mWasOnGroundRight; + bool mWasOnGroundLeft; + bool mWasOnGroundRight; /** Sounds ** ** @@ -1179,7 +1194,7 @@ public: static F32 sGreyUpdateTime; // Last time stats were updated (to prevent multiple updates per frame) protected: S32 getUnbakedPixelAreaRank(); - BOOL mHasGrey; + bool mHasGrey; private: F32 mMinPixelArea; F32 mMaxPixelArea; diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 0a13b7d309..e4a7b53d9f 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -78,7 +78,7 @@ LLPointer<LLVOAvatarSelf> gAgentAvatarp = NULL; -BOOL isAgentAvatarValid() +bool isAgentAvatarValid() { return (gAgentAvatarp.notNull() && gAgentAvatarp->isValid()); } @@ -172,7 +172,7 @@ LLVOAvatarSelf::LLVOAvatarSelf(const LLUUID& id, mInitialMetric(true), mMetricSequence(0) { - mMotionController.mIsSelf = TRUE; + mMotionController.mIsSelf = true; LL_DEBUGS() << "Marking avatar as self " << id << LL_ENDL; } @@ -200,7 +200,7 @@ bool update_avatar_rez_metrics() void LLVOAvatarSelf::initInstance() { - BOOL status = TRUE; + bool status = true; // creates hud joint(mScreen) among other things status &= loadAvatarSelf(); @@ -300,12 +300,12 @@ void LLVOAvatarSelf::markDead() LLVOAvatar::markDead(); } -/*virtual*/ BOOL LLVOAvatarSelf::loadAvatar() +/*virtual*/ bool LLVOAvatarSelf::loadAvatar() { - BOOL success = LLVOAvatar::loadAvatar(); + bool success = LLVOAvatar::loadAvatar(); // set all parameters stored directly in the avatar to have - // the isSelfParam to be TRUE - this is used to prevent + // the isSelfParam to be true - this is used to prevent // them from being animated or trigger accidental rebakes // when we copy params from the wearable to the base avatar. for (LLViewerVisualParam* param = (LLViewerVisualParam*) getFirstVisualParam(); @@ -314,7 +314,7 @@ void LLVOAvatarSelf::markDead() { if (param->getWearableType() != LLWearableType::WT_INVALID) { - param->setIsDummy(TRUE); + param->setIsDummy(true); } } @@ -322,20 +322,20 @@ void LLVOAvatarSelf::markDead() } -BOOL LLVOAvatarSelf::loadAvatarSelf() +bool LLVOAvatarSelf::loadAvatarSelf() { - BOOL success = TRUE; + bool success = true; // avatar_skeleton.xml if (!buildSkeletonSelf(sAvatarSkeletonInfo)) { LL_WARNS() << "avatar file: buildSkeleton() failed" << LL_ENDL; - return FALSE; + return false; } return success; } -BOOL LLVOAvatarSelf::buildSkeletonSelf(const LLAvatarSkeletonInfo *info) +bool LLVOAvatarSelf::buildSkeletonSelf(const LLAvatarSkeletonInfo *info) { // add special-purpose "screen" joint mScreenp = new LLViewerJoint("mScreen", NULL); @@ -347,11 +347,11 @@ BOOL LLVOAvatarSelf::buildSkeletonSelf(const LLAvatarSkeletonInfo *info) // SL-315 mScreenp->setWorldPosition(LLVector3::zero); // need to update screen agressively when sidebar opens/closes, for example - mScreenp->mUpdateXform = TRUE; - return TRUE; + mScreenp->mUpdateXform = true; + return true; } -BOOL LLVOAvatarSelf::buildMenus() +bool LLVOAvatarSelf::buildMenus() { //------------------------------------------------------------------------- // build the attach and detach menus @@ -652,7 +652,7 @@ BOOL LLVOAvatarSelf::buildMenus() } } } - return TRUE; + return true; } void LLVOAvatarSelf::cleanup() @@ -691,7 +691,7 @@ bool LLVOAvatarSelf::updateCharacter(LLAgent &agent) } // virtual -BOOL LLVOAvatarSelf::isValid() const +bool LLVOAvatarSelf::isValid() const { return ((getRegion() != NULL) && !isDead()); } @@ -727,39 +727,39 @@ LLJoint *LLVOAvatarSelf::getJoint(const std::string &name) } // virtual -BOOL LLVOAvatarSelf::setVisualParamWeight(const LLVisualParam *which_param, F32 weight) +bool LLVOAvatarSelf::setVisualParamWeight(const LLVisualParam *which_param, F32 weight) { if (!which_param) { - return FALSE; + return false; } LLViewerVisualParam *param = (LLViewerVisualParam*) LLCharacter::getVisualParam(which_param->getID()); return setParamWeight(param,weight); } // virtual -BOOL LLVOAvatarSelf::setVisualParamWeight(const char* param_name, F32 weight) +bool LLVOAvatarSelf::setVisualParamWeight(const char* param_name, F32 weight) { if (!param_name) { - return FALSE; + return false; } LLViewerVisualParam *param = (LLViewerVisualParam*) LLCharacter::getVisualParam(param_name); return setParamWeight(param,weight); } // virtual -BOOL LLVOAvatarSelf::setVisualParamWeight(S32 index, F32 weight) +bool LLVOAvatarSelf::setVisualParamWeight(S32 index, F32 weight) { LLViewerVisualParam *param = (LLViewerVisualParam*) LLCharacter::getVisualParam(index); return setParamWeight(param,weight); } -BOOL LLVOAvatarSelf::setParamWeight(const LLViewerVisualParam *param, F32 weight) +bool LLVOAvatarSelf::setParamWeight(const LLViewerVisualParam *param, F32 weight) { if (!param) { - return FALSE; + return false; } if (param->getCrossWearable()) @@ -845,7 +845,7 @@ void LLVOAvatarSelf::stopMotionFromSource(const LLUUID& source_id) LLViewerObject* object = gObjectList.findObject(source_id); if (object) { - object->setFlagsWithoutUpdate(FLAGS_ANIM_SOURCE, FALSE); + object->setFlagsWithoutUpdate(FLAGS_ANIM_SOURCE, false); } } @@ -874,7 +874,7 @@ void LLVOAvatarSelf::setLocalTextureTE(U8 te, LLViewerTexture* image, U32 index) //virtual void LLVOAvatarSelf::removeMissingBakedTextures() { - BOOL removed = FALSE; + bool removed = false; for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { const S32 te = mBakedTextureDatas[i].mTextureIndex; @@ -889,7 +889,7 @@ void LLVOAvatarSelf::removeMissingBakedTextures() if (imagep && imagep != tex) { setTEImage(te, imagep); - removed = TRUE; + removed = true; } } } @@ -899,7 +899,7 @@ void LLVOAvatarSelf::removeMissingBakedTextures() for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { LLViewerTexLayerSet *layerset = getTexLayerSet(i); - layerset->setUpdatesEnabled(TRUE); + layerset->setUpdatesEnabled(true); invalidateComposite(layerset); } updateMeshTextures(); @@ -1024,7 +1024,7 @@ void LLVOAvatarSelf::idleUpdateTractorBeam() if (mBeamTimer.getElapsedTimeF32() > 0.25f) { mBeam->setColor(LLColor4U(gAgent.getEffectColor())); - mBeam->setNeedsSendToSim(TRUE); + mBeam->setNeedsSendToSim(true); mBeamTimer.reset(); } } @@ -1037,7 +1037,7 @@ void LLVOAvatarSelf::idleUpdateTractorBeam() void LLVOAvatarSelf::restoreMeshData() { //LL_INFOS() << "Restoring" << LL_ENDL; - mMeshValid = TRUE; + mMeshValid = true; updateJointLODs(); updateAttachmentVisibility(gAgentCamera.getCameraMode()); @@ -1059,7 +1059,7 @@ void LLVOAvatarSelf::updateAttachmentVisibility(U32 camera_mode) LLViewerJointAttachment* attachment = iter->second; if (attachment->getIsHUDAttachment()) { - attachment->setAttachmentVisibility(TRUE); + attachment->setAttachmentVisibility(true); } else { @@ -1068,15 +1068,15 @@ void LLVOAvatarSelf::updateAttachmentVisibility(U32 camera_mode) case CAMERA_MODE_MOUSELOOK: if ((LLVOAvatar::sVisibleInFirstPerson && attachment->getVisibleInFirstPerson()) || gPipeline.mHeroProbeManager.isMirrorPass()) { - attachment->setAttachmentVisibility(TRUE); + attachment->setAttachmentVisibility(true); } else { - attachment->setAttachmentVisibility(FALSE); + attachment->setAttachmentVisibility(false); } break; default: - attachment->setAttachmentVisibility(TRUE); + attachment->setAttachmentVisibility(true); break; } } @@ -1086,7 +1086,7 @@ void LLVOAvatarSelf::updateAttachmentVisibility(U32 camera_mode) //----------------------------------------------------------------------------- // updatedWearable( LLWearableType::EType type ) // forces an update to any baked textures relevant to type. -// will force an upload of the resulting bake if the second parameter is TRUE +// will force an upload of the resulting bake if the second parameter is true //----------------------------------------------------------------------------- void LLVOAvatarSelf::wearableUpdated(LLWearableType::EType type) { @@ -1122,7 +1122,7 @@ void LLVOAvatarSelf::wearableUpdated(LLWearableType::EType type) //----------------------------------------------------------------------------- // isWearingAttachment() //----------------------------------------------------------------------------- -BOOL LLVOAvatarSelf::isWearingAttachment(const LLUUID& inv_item_id) const +bool LLVOAvatarSelf::isWearingAttachment(const LLUUID& inv_item_id) const { const LLUUID& base_inv_item_id = gInventory.getLinkedItemID(inv_item_id); for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin(); @@ -1132,10 +1132,10 @@ BOOL LLVOAvatarSelf::isWearingAttachment(const LLUUID& inv_item_id) const const LLViewerJointAttachment* attachment = iter->second; if (attachment->getAttachedObject(base_inv_item_id)) { - return TRUE; + return true; } } - return FALSE; + return false; } //----------------------------------------------------------------------------- @@ -1212,7 +1212,7 @@ const LLViewerJointAttachment *LLVOAvatarSelf::attachObject(LLViewerObject *view } //virtual -BOOL LLVOAvatarSelf::detachObject(LLViewerObject *viewer_object) +bool LLVOAvatarSelf::detachObject(LLViewerObject *viewer_object) { const LLUUID attachment_id = viewer_object->getAttachmentItemID(); if ( LLVOAvatar::detachObject(viewer_object) ) @@ -1220,7 +1220,7 @@ BOOL LLVOAvatarSelf::detachObject(LLViewerObject *viewer_object) // the simulator should automatically handle permission revocation stopMotionFromSource(attachment_id); - LLFollowCamMgr::getInstance()->setCameraActive(viewer_object->getID(), FALSE); + LLFollowCamMgr::getInstance()->setCameraActive(viewer_object->getID(), false); LLViewerObject::const_child_list_t& child_list = viewer_object->getChildren(); for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); @@ -1232,7 +1232,7 @@ BOOL LLVOAvatarSelf::detachObject(LLViewerObject *viewer_object) // permissions revocation stopMotionFromSource(child_objectp->getID()); - LLFollowCamMgr::getInstance()->setCameraActive(child_objectp->getID(), FALSE); + LLFollowCamMgr::getInstance()->setCameraActive(child_objectp->getID(), false); } // Make sure the inventory is in sync with the avatar. @@ -1247,9 +1247,9 @@ BOOL LLVOAvatarSelf::detachObject(LLViewerObject *viewer_object) LLAppearanceMgr::instance().unregisterAttachment(attachment_id); } - return TRUE; + return true; } - return FALSE; + return false; } bool LLVOAvatarSelf::hasAttachmentsInTrash() @@ -1274,7 +1274,7 @@ bool LLVOAvatarSelf::hasAttachmentsInTrash() } // static -BOOL LLVOAvatarSelf::detachAttachmentIntoInventory(const LLUUID &item_id) +bool LLVOAvatarSelf::detachAttachmentIntoInventory(const LLUUID &item_id) { LLInventoryItem* item = gInventory.getItem(item_id); if (item) @@ -1303,9 +1303,9 @@ BOOL LLVOAvatarSelf::detachAttachmentIntoInventory(const LLUUID &item_id) LLAppearanceMgr::instance().removeCOFItemLinks(item_id); } } - return TRUE; + return true; } - return FALSE; + return false; } U32 LLVOAvatarSelf::getNumWearables(LLAvatarAppearanceDefines::ETextureIndex i) const @@ -1315,7 +1315,7 @@ U32 LLVOAvatarSelf::getNumWearables(LLAvatarAppearanceDefines::ETextureIndex i) } // virtual -void LLVOAvatarSelf::localTextureLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src_raw, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata) +void LLVOAvatarSelf::localTextureLoaded(bool success, LLViewerFetchedTexture *src_vi, LLImageRaw* src_raw, LLImageRaw* aux_src, S32 discard_level, bool final, void* userdata) { const LLUUID& src_id = src_vi->getID(); @@ -1364,20 +1364,20 @@ void LLVOAvatarSelf::localTextureLoaded(BOOL success, LLViewerFetchedTexture *sr } // virtual -BOOL LLVOAvatarSelf::getLocalTextureGL(ETextureIndex type, LLViewerTexture** tex_pp, U32 index) const +bool LLVOAvatarSelf::getLocalTextureGL(ETextureIndex type, LLViewerTexture** tex_pp, U32 index) const { *tex_pp = NULL; - if (!isIndexLocalTexture(type)) return FALSE; - if (getLocalTextureID(type, index) == IMG_DEFAULT_AVATAR) return TRUE; + if (!isIndexLocalTexture(type)) return false; + if (getLocalTextureID(type, index) == IMG_DEFAULT_AVATAR) return true; const LLLocalTextureObject *local_tex_obj = getLocalTextureObject(type, index); if (!local_tex_obj) { - return FALSE; + return false; } *tex_pp = dynamic_cast<LLViewerTexture*> (local_tex_obj->getImage()); - return TRUE; + return true; } LLViewerFetchedTexture* LLVOAvatarSelf::getLocalTextureGL(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const @@ -1417,7 +1417,7 @@ const LLUUID& LLVOAvatarSelf::getLocalTextureID(ETextureIndex type, U32 index) c // Returns true if at least the lowest quality discard level exists for every texture // in the layerset. //----------------------------------------------------------------------------- -BOOL LLVOAvatarSelf::isLocalTextureDataAvailable(const LLViewerTexLayerSet* layerset) const +bool LLVOAvatarSelf::isLocalTextureDataAvailable(const LLViewerTexLayerSet* layerset) const { /* if (layerset == mBakedTextureDatas[BAKED_HEAD].mTexLayerSet) return getLocalDiscardLevel(TEX_HEAD_BODYPAINT) >= 0; */ @@ -1428,7 +1428,7 @@ BOOL LLVOAvatarSelf::isLocalTextureDataAvailable(const LLViewerTexLayerSet* laye const EBakedTextureIndex baked_index = baked_iter->first; if (layerset == mBakedTextureDatas[baked_index].mTexLayerSet) { - BOOL ret = true; + bool ret = true; const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second; for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); local_tex_iter != baked_dict->mLocalTextures.end(); @@ -1439,7 +1439,7 @@ BOOL LLVOAvatarSelf::isLocalTextureDataAvailable(const LLViewerTexLayerSet* laye const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type); for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++) { - BOOL tex_avail = (getLocalDiscardLevel(tex_index, wearable_index) >= 0); + bool tex_avail = (getLocalDiscardLevel(tex_index, wearable_index) >= 0); ret &= tex_avail; } } @@ -1447,7 +1447,7 @@ BOOL LLVOAvatarSelf::isLocalTextureDataAvailable(const LLViewerTexLayerSet* laye } } llassert(0); - return FALSE; + return false; } //----------------------------------------------------------------------------- @@ -1456,7 +1456,7 @@ BOOL LLVOAvatarSelf::isLocalTextureDataAvailable(const LLViewerTexLayerSet* laye // Returns true if the highest quality discard level exists for every texture // in the layerset. //----------------------------------------------------------------------------- -BOOL LLVOAvatarSelf::isLocalTextureDataFinal(const LLViewerTexLayerSet* layerset) const +bool LLVOAvatarSelf::isLocalTextureDataFinal(const LLViewerTexLayerSet* layerset) const { const U32 desired_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel"); // const U32 desired_tex_discard_level = 0; // hack to not bake textures on lower discard levels. @@ -1479,19 +1479,19 @@ BOOL LLVOAvatarSelf::isLocalTextureDataFinal(const LLViewerTexLayerSet* layerset if ((local_discard_level > (S32)(desired_tex_discard_level)) || (local_discard_level < 0 )) { - return FALSE; + return false; } } } - return TRUE; + return true; } } llassert(0); - return FALSE; + return false; } -BOOL LLVOAvatarSelf::isAllLocalTextureDataFinal() const +bool LLVOAvatarSelf::isAllLocalTextureDataFinal() const { const U32 desired_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel"); // const U32 desired_tex_discard_level = 0; // hack to not bake textures on lower discard levels @@ -1512,18 +1512,18 @@ BOOL LLVOAvatarSelf::isAllLocalTextureDataFinal() const if ((local_discard_level > (S32)(desired_tex_discard_level)) || (local_discard_level < 0 )) { - return FALSE; + return false; } } } } - return TRUE; + return true; } -BOOL LLVOAvatarSelf::isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const +bool LLVOAvatarSelf::isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const { LLUUID id; - BOOL isDefined = TRUE; + bool isDefined = true; if (isIndexLocalTexture(type)) { const LLWearableType::EType wearable_type = sAvatarDictionary->getTEWearableType(type); @@ -1553,7 +1553,7 @@ BOOL LLVOAvatarSelf::isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex t } //virtual -BOOL LLVOAvatarSelf::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const +bool LLVOAvatarSelf::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const { if (isIndexBakedTexture(type)) { @@ -1566,7 +1566,7 @@ BOOL LLVOAvatarSelf::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex t } //virtual -BOOL LLVOAvatarSelf::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerWearable *wearable) const +bool LLVOAvatarSelf::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerWearable *wearable) const { if (isIndexBakedTexture(type)) { @@ -1581,7 +1581,7 @@ BOOL LLVOAvatarSelf::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex t else { LL_WARNS() << "Wearable not found" << LL_ENDL; - return FALSE; + return false; } } @@ -1648,7 +1648,7 @@ void LLVOAvatarSelf::setupComposites() for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { ETextureIndex tex_index = mBakedTextureDatas[i].mTextureIndex; - BOOL layer_baked = isTextureDefined(tex_index, gAgentWearables.getWearableCount(tex_index)); + bool layer_baked = isTextureDefined(tex_index, gAgentWearables.getWearableCount(tex_index)); LLViewerTexLayerSet *layerset = getTexLayerSet(i); if (layerset) { @@ -1673,7 +1673,7 @@ void LLVOAvatarSelf::updateComposites() // virtual S32 LLVOAvatarSelf::getLocalDiscardLevel(ETextureIndex type, U32 wearable_index) const { - if (!isIndexLocalTexture(type)) return FALSE; + if (!isIndexLocalTexture(type)) return false; const LLLocalTextureObject *local_tex_obj = getLocalTextureObject(type, wearable_index); if (local_tex_obj) @@ -1724,11 +1724,11 @@ void LLVOAvatarSelf::getLocalTextureByteCount(S32* gl_bytes) const } // virtual -void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_tex, BOOL baked_version_ready, U32 index) +void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_tex, bool baked_version_ready, U32 index) { if (!isIndexLocalTexture(type)) return; - LLViewerFetchedTexture* tex = LLViewerTextureManager::staticCastToFetchedTexture(src_tex, TRUE) ; + LLViewerFetchedTexture* tex = LLViewerTextureManager::staticCastToFetchedTexture(src_tex, true) ; if(!tex) { return ; @@ -1789,7 +1789,7 @@ void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_te } else { - tex->setLoadedCallback(onLocalTextureLoaded, desired_discard, TRUE, FALSE, new LLAvatarTexData(getID(), type), NULL); + tex->setLoadedCallback(onLocalTextureLoaded, desired_discard, true, false, new LLAvatarTexData(getID(), type), NULL); } } tex->setMinDiscardLevel(desired_discard); @@ -1801,7 +1801,7 @@ void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_te } //virtual -void LLVOAvatarSelf::setBakedReady(LLAvatarAppearanceDefines::ETextureIndex type, BOOL baked_version_exists, U32 index) +void LLVOAvatarSelf::setBakedReady(LLAvatarAppearanceDefines::ETextureIndex type, bool baked_version_exists, U32 index) { if (!isIndexLocalTexture(type)) return; LLLocalTextureObject *local_tex_obj = getLocalTextureObject(type,index); @@ -1878,7 +1878,7 @@ void LLVOAvatarSelf::dumpLocalTextures() const // onLocalTextureLoaded() //----------------------------------------------------------------------------- -void LLVOAvatarSelf::onLocalTextureLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src_raw, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata) +void LLVOAvatarSelf::onLocalTextureLoaded(bool success, LLViewerFetchedTexture *src_vi, LLImageRaw* src_raw, LLImageRaw* aux_src, S32 discard_level, bool final, void* userdata) { LLAvatarTexData *data = (LLAvatarTexData *)userdata; LLVOAvatarSelf *self = (LLVOAvatarSelf *)gObjectList.findObject(data->mAvatarID); @@ -1898,7 +1898,7 @@ void LLVOAvatarSelf::onLocalTextureLoaded(BOOL success, LLViewerFetchedTexture * { if (isIndexLocalTexture((ETextureIndex)te)) { - setLocalTexture((ETextureIndex)te, imagep, FALSE ,index); + setLocalTexture((ETextureIndex)te, imagep, false ,index); } else { @@ -2017,7 +2017,7 @@ bool LLVOAvatarSelf::getIsCloud() const } /*static*/ -void LLVOAvatarSelf::debugOnTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata) +void LLVOAvatarSelf::debugOnTimingLocalTexLoaded(bool success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, bool final, void* userdata) { if (gAgentAvatarp.notNull()) { @@ -2025,7 +2025,7 @@ void LLVOAvatarSelf::debugOnTimingLocalTexLoaded(BOOL success, LLViewerFetchedTe } } -void LLVOAvatarSelf::debugTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata) +void LLVOAvatarSelf::debugTimingLocalTexLoaded(bool success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, bool final, void* userdata) { LLAvatarTexData *data = (LLAvatarTexData *)userdata; if (!data) @@ -2050,7 +2050,7 @@ void LLVOAvatarSelf::debugTimingLocalTexLoaded(BOOL success, LLViewerFetchedText } } -void LLVOAvatarSelf::debugBakedTextureUpload(EBakedTextureIndex index, BOOL finished) +void LLVOAvatarSelf::debugBakedTextureUpload(EBakedTextureIndex index, bool finished) { U32 done = 0; if (finished) @@ -2189,7 +2189,7 @@ const std::string LLVOAvatarSelf::debugDumpAllLocalTextureDataInfo() const for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = sAvatarDictionary->getBakedTexture((EBakedTextureIndex)i); - BOOL is_texture_final = TRUE; + bool is_texture_final = true; for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); local_tex_iter != baked_dict->mLocalTextures.end(); ++local_tex_iter) @@ -2230,16 +2230,21 @@ void LLVOAvatarSelf::appearanceChangeMetricsCoro(std::string url) // Status of our own rezzing. msg["rez_status"] = LLVOAvatar::rezStatusToString(getRezzedStatus()); + msg["first_decloud_time"] = getFirstDecloudTime(); // Status of all nearby avs including ourself. msg["nearby"] = LLSD::emptyArray(); std::vector<S32> rez_counts; - LLVOAvatar::getNearbyRezzedStats(rez_counts); + F32 avg_time; + S32 total_cloud_avatars; + LLVOAvatar::getNearbyRezzedStats(rez_counts, avg_time, total_cloud_avatars); for (S32 rez_stat = 0; rez_stat < rez_counts.size(); ++rez_stat) { std::string rez_status_name = LLVOAvatar::rezStatusToString(rez_stat); msg["nearby"][rez_status_name] = rez_counts[rez_stat]; } + msg["nearby"]["avg_decloud_time"] = avg_time; + msg["nearby"]["cloud_total"] = total_cloud_avatars; // std::vector<std::string> bucket_fields("timer_name","is_self","grid_x","grid_y","is_using_server_bake"); std::vector<std::string> by_fields; @@ -2385,22 +2390,22 @@ const LLUUID& LLVOAvatarSelf::grabBakedTexture(EBakedTextureIndex baked_index) c return LLUUID::null; } -BOOL LLVOAvatarSelf::canGrabBakedTexture(EBakedTextureIndex baked_index) const +bool LLVOAvatarSelf::canGrabBakedTexture(EBakedTextureIndex baked_index) const { ETextureIndex tex_index = sAvatarDictionary->bakedToLocalTextureIndex(baked_index); if (tex_index == TEX_NUM_INDICES) { - return FALSE; + return false; } // Check if the texture hasn't been baked yet. if (!isTextureDefined(tex_index, 0)) { LL_DEBUGS() << "getTEImage( " << (U32) tex_index << " )->getID() == IMG_DEFAULT_AVATAR" << LL_ENDL; - return FALSE; + return false; } if (gAgent.isGodlikeWithoutAdminMenuFakery()) - return TRUE; + return true; // Check permissions of textures that show up in the // baked texture. We don't want people copying people's @@ -2435,7 +2440,7 @@ BOOL LLVOAvatarSelf::canGrabBakedTexture(EBakedTextureIndex baked_index) const LLInventoryModel::INCLUDE_TRASH, asset_id_matches); - BOOL can_grab = FALSE; + bool can_grab = false; LL_DEBUGS() << "item count for asset " << texture_id << ": " << items.size() << LL_ENDL; if (items.size()) { @@ -2445,22 +2450,22 @@ BOOL LLVOAvatarSelf::canGrabBakedTexture(EBakedTextureIndex baked_index) const LLViewerInventoryItem* itemp = items[i]; if (itemp->getIsFullPerm()) { - can_grab = TRUE; + can_grab = true; break; } } } - if (!can_grab) return FALSE; + if (!can_grab) return false; } } } } - return TRUE; + return true; } void LLVOAvatarSelf::addLocalTextureStats( ETextureIndex type, LLViewerFetchedTexture* imagep, - F32 texel_area_ratio, BOOL render_avatar, BOOL covered_by_baked) + F32 texel_area_ratio, bool render_avatar, bool covered_by_baked) { if (!isIndexLocalTexture(type)) return; @@ -2485,14 +2490,14 @@ void LLVOAvatarSelf::addLocalTextureStats( ETextureIndex type, LLViewerFetchedTe imagep->forceUpdateBindStats() ; if (imagep->getDiscardLevel() < 0) { - mHasGrey = TRUE; // for statistics gathering + mHasGrey = true; // for statistics gathering } } } else { // texture asset is missing - mHasGrey = TRUE; // for statistics gathering + mHasGrey = true; // for statistics gathering } } } @@ -2614,7 +2619,7 @@ void LLVOAvatarSelf::forceBakeAllTextures(bool slam_for_debug) { if (slam_for_debug) { - layer_set->setUpdatesEnabled(TRUE); + layer_set->setUpdatesEnabled(true); } invalidateComposite(layer_set); @@ -2819,18 +2824,18 @@ void LLVOAvatarSelf::setHoverOffset(const LLVector3& hover_offset, bool send_upd //------------------------------------------------------------------------ // needsRenderBeam() //------------------------------------------------------------------------ -BOOL LLVOAvatarSelf::needsRenderBeam() +bool LLVOAvatarSelf::needsRenderBeam() { LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); - BOOL is_touching_or_grabbing = (tool == LLToolGrab::getInstance() && LLToolGrab::getInstance()->isEditing()); + bool is_touching_or_grabbing = (tool == LLToolGrab::getInstance() && LLToolGrab::getInstance()->isEditing()); LLViewerObject* objp = LLToolGrab::getInstance()->getEditingObject(); if (objp // might need to be "!objp ||" instead of "objp &&". && (objp->isAttachment() || objp->isAvatar())) { // don't render grab tool's selection beam on hud objects, // attachments or avatars - is_touching_or_grabbing = FALSE; + is_touching_or_grabbing = false; } return is_touching_or_grabbing || (getAttachmentState() & AGENT_STATE_EDITING && LLSelectMgr::getInstance()->shouldShowSelection()); } diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 736bc11a4c..77556c8412 100644 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -59,10 +59,10 @@ public: virtual void initInstance(); // Called after construction to initialize the class. void cleanup(); protected: - /*virtual*/ BOOL loadAvatar(); - BOOL loadAvatarSelf(); - BOOL buildSkeletonSelf(const LLAvatarSkeletonInfo *info); - BOOL buildMenus(); + /*virtual*/ bool loadAvatar(); + bool loadAvatarSelf(); + bool buildSkeletonSelf(const LLAvatarSkeletonInfo *info); + bool buildMenus(); /** Initialization ** ** @@ -92,16 +92,16 @@ public: /*virtual*/ void requestStopMotion(LLMotion* motion); /*virtual*/ LLJoint* getJoint(const std::string &name); - /*virtual*/ BOOL setVisualParamWeight(const LLVisualParam *which_param, F32 weight); - /*virtual*/ BOOL setVisualParamWeight(const char* param_name, F32 weight); - /*virtual*/ BOOL setVisualParamWeight(S32 index, F32 weight); + /*virtual*/ bool setVisualParamWeight(const LLVisualParam *which_param, F32 weight); + /*virtual*/ bool setVisualParamWeight(const char* param_name, F32 weight); + /*virtual*/ bool setVisualParamWeight(S32 index, F32 weight); /*virtual*/ void updateVisualParams(); void writeWearablesToAvatar(); /*virtual*/ void idleUpdateAppearanceAnimation(); private: // helper function. Passed in param is assumed to be in avatar's parameter list. - BOOL setParamWeight(const LLViewerVisualParam *param, F32 weight); + bool setParamWeight(const LLViewerVisualParam *param, F32 weight); /******************************************************************************** ** ** @@ -110,7 +110,8 @@ private: public: /*virtual*/ bool isSelf() const { return true; } - /*virtual*/ BOOL isValid() const; + virtual bool isBuddy() const { return false; } + /*virtual*/ bool isValid() const; //-------------------------------------------------------------------- // Updates @@ -149,7 +150,7 @@ private: // Render beam //-------------------------------------------------------------------- protected: - BOOL needsRenderBeam(); + bool needsRenderBeam(); private: LLPointer<LLHUDEffectSpiral> mBeam; LLFrameTimer mBeamTimer; @@ -177,32 +178,32 @@ public: public: S32 getLocalDiscardLevel(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const; bool areTexturesCurrent() const; - BOOL isLocalTextureDataAvailable(const LLViewerTexLayerSet* layerset) const; - BOOL isLocalTextureDataFinal(const LLViewerTexLayerSet* layerset) const; + bool isLocalTextureDataAvailable(const LLViewerTexLayerSet* layerset) const; + bool isLocalTextureDataFinal(const LLViewerTexLayerSet* layerset) const; // If you want to check all textures of a given type, pass gAgentWearables.getWearableCount() for index - /*virtual*/ BOOL isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const; - /*virtual*/ BOOL isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, U32 index = 0) const; - /*virtual*/ BOOL isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerWearable *wearable) const; + /*virtual*/ bool isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const; + /*virtual*/ bool isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, U32 index = 0) const; + /*virtual*/ bool isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerWearable *wearable) const; //-------------------------------------------------------------------- // Local Textures //-------------------------------------------------------------------- public: - BOOL getLocalTextureGL(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerTexture** image_gl_pp, U32 index) const; + bool getLocalTextureGL(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerTexture** image_gl_pp, U32 index) const; LLViewerFetchedTexture* getLocalTextureGL(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const; const LLUUID& getLocalTextureID(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const; void setLocalTextureTE(U8 te, LLViewerTexture* image, U32 index); - /*virtual*/ void setLocalTexture(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerTexture* tex, BOOL baked_version_exits, U32 index); + /*virtual*/ void setLocalTexture(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerTexture* tex, bool baked_version_exits, U32 index); protected: - /*virtual*/ void setBakedReady(LLAvatarAppearanceDefines::ETextureIndex type, BOOL baked_version_exists, U32 index); - void localTextureLoaded(BOOL succcess, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); + /*virtual*/ void setBakedReady(LLAvatarAppearanceDefines::ETextureIndex type, bool baked_version_exists, U32 index); + void localTextureLoaded(bool succcess, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, bool final, void* userdata); void getLocalTextureByteCount(S32* gl_byte_count) const; - /*virtual*/ void addLocalTextureStats(LLAvatarAppearanceDefines::ETextureIndex i, LLViewerFetchedTexture* imagep, F32 texel_area_ratio, BOOL rendered, BOOL covered_by_baked); + /*virtual*/ void addLocalTextureStats(LLAvatarAppearanceDefines::ETextureIndex i, LLViewerFetchedTexture* imagep, F32 texel_area_ratio, bool rendered, bool covered_by_baked); LLLocalTextureObject* getLocalTextureObject(LLAvatarAppearanceDefines::ETextureIndex i, U32 index) const; private: - static void onLocalTextureLoaded(BOOL succcess, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); + static void onLocalTextureLoaded(bool succcess, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, bool final, void* userdata); /*virtual*/ void setImage(const U8 te, LLViewerTexture *imagep, const U32 index); /*virtual*/ LLViewerTexture* getImage(const U8 te, const U32 index) const; @@ -240,7 +241,7 @@ public: void updateComposites(); const LLUUID& grabBakedTexture(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index) const; - BOOL canGrabBakedTexture(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index) const; + bool canGrabBakedTexture(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index) const; //-------------------------------------------------------------------- @@ -282,12 +283,12 @@ protected: //-------------------------------------------------------------------- public: void updateAttachmentVisibility(U32 camera_mode); - BOOL isWearingAttachment(const LLUUID& inv_item_id) const; + bool isWearingAttachment(const LLUUID& inv_item_id) const; LLViewerObject* getWornAttachment(const LLUUID& inv_item_id); bool getAttachedPointName(const LLUUID& inv_item_id, std::string& name) const; /*virtual*/ const LLViewerJointAttachment *attachObject(LLViewerObject *viewer_object); - /*virtual*/ BOOL detachObject(LLViewerObject *viewer_object); - static BOOL detachAttachmentIntoInventory(const LLUUID& item_id); + /*virtual*/ bool detachObject(LLViewerObject *viewer_object); + static bool detachAttachmentIntoInventory(const LLUUID& item_id); bool hasAttachmentsInTrash(); @@ -371,10 +372,10 @@ public: void outputRezDiagnostics() const; void outputRezTiming(const std::string& msg) const; void reportAvatarRezTime() const; - void debugBakedTextureUpload(LLAvatarAppearanceDefines::EBakedTextureIndex index, BOOL finished); - static void debugOnTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); + void debugBakedTextureUpload(LLAvatarAppearanceDefines::EBakedTextureIndex index, bool finished); + static void debugOnTimingLocalTexLoaded(bool success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, bool final, void* userdata); - BOOL isAllLocalTextureDataFinal() const; + bool isAllLocalTextureDataFinal() const; const LLViewerTexLayerSet* debugGetLayerSet(LLAvatarAppearanceDefines::EBakedTextureIndex index) const { return (LLViewerTexLayerSet*)(mBakedTextureDatas[index].mTexLayerSet); } const std::string verboseDebugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const; // Lists out state of this particular baked texture layer @@ -388,7 +389,7 @@ private: F32 mDebugTimeAvatarVisible; F32 mDebugTextureLoadTimes[LLAvatarAppearanceDefines::TEX_NUM_INDICES][MAX_DISCARD_LEVEL+1]; // load time for each texture at each discard level F32 mDebugBakedTextureTimes[LLAvatarAppearanceDefines::BAKED_NUM_INDICES][2]; // time to start upload and finish upload of each baked texture - void debugTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); + void debugTimingLocalTexLoaded(bool success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, bool final, void* userdata); void appearanceChangeMetricsCoro(std::string url); bool mInitialMetric; @@ -401,7 +402,7 @@ private: extern LLPointer<LLVOAvatarSelf> gAgentAvatarp; -BOOL isAgentAvatarValid(); +bool isAgentAvatarValid(); void selfStartPhase(const std::string& phase_name); void selfStopPhase(const std::string& phase_name, bool err_check = true); diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index a65e49a724..0fe2a3e714 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -40,17 +40,17 @@ F32 LLVOCacheEntry::sNearRadius = 1.0f; F32 LLVOCacheEntry::sRearFarRadius = 1.0f; F32 LLVOCacheEntry::sFrontPixelThreshold = 1.0f; F32 LLVOCacheEntry::sRearPixelThreshold = 1.0f; -BOOL LLVOCachePartition::sNeedsOcclusionCheck = FALSE; +bool LLVOCachePartition::sNeedsOcclusionCheck = false; const S32 ENTRY_HEADER_SIZE = 6 * sizeof(S32); const S32 MAX_ENTRY_BODY_SIZE = 10000; -BOOL check_read(LLAPRFile* apr_file, void* src, S32 n_bytes) +bool check_read(LLAPRFile* apr_file, void* src, S32 n_bytes) { return apr_file->read(src, n_bytes) == n_bytes ; } -BOOL check_write(LLAPRFile* apr_file, void* src, S32 n_bytes) +bool check_write(LLAPRFile* apr_file, void* src, S32 n_bytes) { return apr_file->write(src, n_bytes) == n_bytes ; } @@ -165,7 +165,7 @@ LLVOCacheEntry::LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer & mCRCChangeCount(0), mState(INACTIVE), mSceneContrib(0.f), - mValid(TRUE), + mValid(true), mParentID(0), mBSphereRadius(-1.0f) { @@ -185,7 +185,7 @@ LLVOCacheEntry::LLVOCacheEntry() mBuffer(NULL), mState(INACTIVE), mSceneContrib(0.f), - mValid(TRUE), + mValid(true), mParentID(0), mBSphereRadius(-1.0f) { @@ -198,12 +198,12 @@ LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file) mUpdateFlags(-1), mState(INACTIVE), mSceneContrib(0.f), - mValid(FALSE), + mValid(false), mParentID(0), mBSphereRadius(-1.0f) { S32 size = -1; - BOOL success; + bool success; static U8 data_buffer[ENTRY_HEADER_SIZE]; mDP.assignBuffer(mBuffer, 0); @@ -225,7 +225,7 @@ LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file) // We won't bother seeking, because the rest of this file // is likely bogus, and will be tossed anyway. LL_WARNS() << "Bogus cache entry, size " << size << ", aborting!" << LL_ENDL; - success = FALSE; + success = false; } } if(success && size > 0) @@ -339,7 +339,7 @@ void LLVOCacheEntry::setState(U32 state) if(getState() == ACTIVE) { - const S32 MIN_INTERVAL = 64 + sMinFrameRange; + const U32 MIN_INTERVAL = 64U + sMinFrameRange; U32 last_visible = getVisible(); setVisible(); @@ -527,6 +527,8 @@ F32 LLVOCacheEntry::getSquaredPixelThreshold(bool is_front) return projection_threshold; } +extern bool gCubeSnapshot; + bool LLVOCacheEntry::isAnyVisible(const LLVector4a& camera_origin, const LLVector4a& local_camera_origin, F32 dist_threshold) { #if 0 @@ -552,7 +554,7 @@ bool LLVOCacheEntry::isAnyVisible(const LLVector4a& camera_origin, const LLVecto if(!vis) { S32 cur_vis = llmax(group->getAnyVisible(), (S32)getVisible()); - vis = (cur_vis + sMinFrameRange > LLViewerOctreeEntryData::getCurrentFrame()); + vis = (cur_vis + (S32)sMinFrameRange > LLViewerOctreeEntryData::getCurrentFrame()); } //within the back sphere @@ -1028,7 +1030,7 @@ S32 LLVOCachePartition::cull(LLCamera &camera, bool do_occlusion) } if(LLViewerOctreeEntryData::getCurrentFrame() % seed != mIdleHash) { - mFrontCull = FALSE; + mFrontCull = false; //process back objects selection selectBackObjects(camera, LLVOCacheEntry::getSquaredPixelThreshold(mFrontCull), @@ -1045,7 +1047,7 @@ S32 LLVOCachePartition::cull(LLCamera &camera, bool do_occlusion) LLVector3 region_agent = mRegionp->getOriginAgent(); camera.calcRegionFrustumPlanes(region_agent, gAgentCamera.mDrawDistance); - mFrontCull = TRUE; + mFrontCull = true; LLVOCacheOctreeCull culler(&camera, mRegionp, region_agent, do_occlusion && use_object_cache_occlusion, LLVOCacheEntry::getSquaredPixelThreshold(mFrontCull), this); culler.traverse(mOctree); @@ -1058,10 +1060,10 @@ S32 LLVOCachePartition::cull(LLCamera &camera, bool do_occlusion) } #endif // LL_TEST -void LLVOCachePartition::setCullHistory(BOOL has_new_object) +void LLVOCachePartition::setCullHistory(bool has_new_object) { mCullHistory <<= 1; - mCullHistory |= has_new_object; + mCullHistory |= static_cast<U32>(has_new_object); } void LLVOCachePartition::addOccluders(LLViewerOctreeGroup* gp) @@ -1100,7 +1102,7 @@ void LLVOCachePartition::processOccluders(LLCamera* camera) //safe to clear mOccludedGroups here because only the world camera accesses it. mOccludedGroups.clear(); - sNeedsOcclusionCheck = FALSE; + sNeedsOcclusionCheck = false; } void LLVOCachePartition::resetOccluders() @@ -1116,7 +1118,7 @@ void LLVOCachePartition::resetOccluders() group->clearOcclusionState(LLOcclusionCullingGroup::ACTIVE_OCCLUSION); } mOccludedGroups.clear(); - sNeedsOcclusionCheck = FALSE; + sNeedsOcclusionCheck = false; } void LLVOCachePartition::removeOccluder(LLVOCacheGroup* group) @@ -1300,7 +1302,7 @@ void LLVOCache::removeEntry(HeaderEntryInfo* entry) removeFromCache(entry); delete entry; - mNumEntries = mHandleEntryMap.size() ; + mNumEntries = static_cast<U32>(mHandleEntryMap.size()); } } @@ -1485,7 +1487,7 @@ void LLVOCache::writeCacheHeader() success = check_write(&apr_file, (void*)*iter, sizeof(HeaderEntryInfo)); } - mNumEntries = mHeaderEntryQueue.size() ; + mNumEntries = static_cast<U32>(mHeaderEntryQueue.size()); if(success && mNumEntries < MAX_NUM_OBJECT_ENTRIES) { HeaderEntryInfo* entry = new HeaderEntryInfo() ; @@ -1503,12 +1505,12 @@ void LLVOCache::writeCacheHeader() if(!success) { clearCacheInMemory() ; - mReadOnly = TRUE ; //disable the cache. + mReadOnly = true ; //disable the cache. } return ; } -BOOL LLVOCache::updateEntry(const HeaderEntryInfo* entry) +bool LLVOCache::updateEntry(const HeaderEntryInfo* entry) { LLAPRFile apr_file(mHeaderFileName, APR_WRITE|APR_BINARY, mLocalAPRFilePoolp); apr_file.seek(APR_SET, entry->mIndex * sizeof(HeaderEntryInfo) + sizeof(HeaderMetaInfo)) ; @@ -1729,10 +1731,10 @@ void LLVOCache::purgeEntries(U32 size) removeFromCache(entry) ; // This now handles removing extras cache where appropriate. delete entry; } - mNumEntries = mHandleEntryMap.size() ; + mNumEntries = static_cast<U32>(mHandleEntryMap.size()); } -void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, BOOL dirty_cache, bool removal_enabled) +void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, bool dirty_cache, bool removal_enabled) { std::string filename; getObjectCacheFilename(handle, filename); @@ -1801,7 +1803,7 @@ void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry: if(success) { - S32 num_entries = cache_entry_map.size(); // if removal is enabled num_entries might be wrong + S32 num_entries = static_cast<S32>(cache_entry_map.size()); // if removal is enabled num_entries might be wrong success = check_write(&apr_file, &num_entries, sizeof(S32)); if (success) { @@ -1876,17 +1878,17 @@ void LLVOCache::removeGenericExtrasForHandle(U64 handle) auto* entry = mHandleEntryMap[handle]; if (entry) { + LL_WARNS("GLTF", "VOCache") << "Removing generic extras for handle " << entry->mHandle << "Filename: " << getObjectCacheExtrasFilename(handle) << LL_ENDL; removeEntry(entry); } else { //shouldn't happen, but if it does, we should remove the extras file since it's orphaned - LL_WARNS("GLTF", "VOCache") << "Removing generic extras for handle " << entry->mHandle << "Filename: " << getObjectCacheExtrasFilename(handle) << LL_ENDL; - LLFile::remove(getObjectCacheExtrasFilename(entry->mHandle)); + LLFile::remove(getObjectCacheExtrasFilename(handle)); } } -void LLVOCache::writeGenericExtrasToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_gltf_overrides_map_t& cache_extras_entry_map, BOOL dirty_cache, bool removal_enabled) +void LLVOCache::writeGenericExtrasToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_gltf_overrides_map_t& cache_extras_entry_map, bool dirty_cache, bool removal_enabled) { if(!mEnabled) { @@ -1901,9 +1903,7 @@ void LLVOCache::writeGenericExtrasToCache(U64 handle, const LLUUID& id, const LL return; } - // <FS:Beq> FIRE-33808 - Material Override Cache causes long delays std::string filename = getObjectCacheExtrasFilename(handle); - // </FS:Beq> llofstream out(filename, std::ios::out | std::ios::binary); if(!out.good()) { @@ -1936,9 +1936,8 @@ void LLVOCache::writeGenericExtrasToCache(U64 handle, const LLUUID& id, const LL LLViewerRegion* pRegion = LLWorld::getInstance()->getRegionFromHandle(handle); U32 num_entries = 0; - U32 inmem_entries = 0; U32 skipped = 0; - inmem_entries = cache_extras_entry_map.size(); + size_t inmem_entries = cache_extras_entry_map.size(); for (auto [local_id, entry] : cache_extras_entry_map) { // Only write out GLTFOverrides that we can actually apply again on import. diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index b2578085d8..9679a20ae0 100644 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -140,14 +140,14 @@ public: void removeChild(LLVOCacheEntry* entry); void removeAllChildren(); LLVOCacheEntry* getChild(); //remove the first child, and return it. - S32 getNumOfChildren() const {return mChildrenList.size();} + S32 getNumOfChildren() const { return static_cast<S32>(mChildrenList.size()); } void setBoundingInfo(const LLVector3& pos, const LLVector3& scale); //called from processing object update message void updateParentBoundingInfo(); void saveBoundingSphere(); - void setValid(BOOL valid = TRUE) {mValid = valid;} - BOOL isValid() const {return mValid;} + void setValid(bool valid = true) {mValid = valid;} + bool isValid() const {return mValid;} void setUpdateFlags(U32 flags) {mUpdateFlags = flags;} U32 getUpdateFlags() const {return mUpdateFlags;} @@ -181,7 +181,7 @@ protected: U32 mState; //high 16 bits reserved for special use. vocache_entry_set_t mChildrenList; //children entries in a linked set. - BOOL mValid; //if set, this entry is valid, otherwise it is invalid and will be removed. + bool mValid; //if set, this entry is valid, otherwise it is invalid and will be removed. LLVector4a mBSphereCenter; //bounding sphere center F32 mBSphereRadius; //bounding sphere radius @@ -220,7 +220,7 @@ public: void processOccluders(LLCamera* camera); void removeOccluder(LLVOCacheGroup* group); - void setCullHistory(BOOL has_new_object); + void setCullHistory(bool has_new_object); bool isFrontCull() const {return mFrontCull;} @@ -228,10 +228,10 @@ private: void selectBackObjects(LLCamera &camera, F32 projection_area_cutoff, bool use_occlusion); //select objects behind camera. public: - static BOOL sNeedsOcclusionCheck; + static bool sNeedsOcclusionCheck; private: - BOOL mFrontCull; //the view frustum cull if set, otherwise is back sphere cull. + bool mFrontCull; //the view frustum cull if set, otherwise is back sphere cull. U32 mCullHistory; U32 mCulledTime[LLViewerCamera::NUM_CAMERAS]; std::set<LLVOCacheGroup*> mOccludedGroups; @@ -288,8 +288,8 @@ public: bool readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::vocache_entry_map_t& cache_entry_map) ; void readGenericExtrasFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::vocache_gltf_overrides_map_t& cache_extras_entry_map, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map); - void writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, BOOL dirty_cache, bool removal_enabled); - void writeGenericExtrasToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_gltf_overrides_map_t& cache_extras_entry_map, BOOL dirty_cache, bool removal_enabled); + void writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, bool dirty_cache, bool removal_enabled); + void writeGenericExtrasToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_gltf_overrides_map_t& cache_extras_entry_map, bool dirty_cache, bool removal_enabled); void removeEntry(U64 handle) ; void removeGenericExtrasForHandle(U64 handle); @@ -308,7 +308,7 @@ private: void removeCache() ; void removeEntry(HeaderEntryInfo* entry) ; void purgeEntries(U32 size); - BOOL updateEntry(const HeaderEntryInfo* entry); + bool updateEntry(const HeaderEntryInfo* entry); private: bool mEnabled; diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp index a92244b7da..e04bdbf1d9 100644 --- a/indra/newview/llvograss.cpp +++ b/indra/newview/llvograss.cpp @@ -73,7 +73,7 @@ LLVOGrass::LLVOGrass(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regi mLastPatchUpdateTime = 0; mGrassVel.clearVec(); mGrassBend.clearVec(); - mbCanSelect = TRUE; + mbCanSelect = true; mBladeWindAngle = 35.f; mBWAOverlap = 2.f; @@ -99,7 +99,7 @@ void LLVOGrass::updateSpecies() SpeciesMap::const_iterator it = sSpeciesTable.begin(); mSpecies = (*it).first; } - setTEImage(0, LLViewerTextureManager::getFetchedTexture(sSpeciesTable[mSpecies]->mTextureID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); + setTEImage(0, LLViewerTextureManager::getFetchedTexture(sSpeciesTable[mSpecies]->mTextureID, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); } @@ -135,7 +135,7 @@ void LLVOGrass::initClass() F32 F32_val; LLUUID id; - BOOL success = TRUE; + bool success{ true }; S32 species; static LLStdStringHandle species_id_string = LLXmlTree::addAttributeString("species_id"); @@ -188,7 +188,7 @@ void LLVOGrass::initClass() } } - BOOL have_all_grass = TRUE; + bool have_all_grass{ true }; std::string err; for (S32 i=0;i<sMaxGrassSpecies;++i) @@ -196,7 +196,7 @@ void LLVOGrass::initClass() if (!sSpeciesTable.count(i)) { err.append(llformat(" %d",i)); - have_all_grass = FALSE; + have_all_grass = false; } } @@ -270,9 +270,9 @@ U32 LLVOGrass::processUpdateMessage(LLMessageSystem *mesgsys, return retval; } -BOOL LLVOGrass::isActive() const +bool LLVOGrass::isActive() const { - return TRUE; + return true; } void LLVOGrass::idleUpdate(LLAgent &agent, const F64 &time) @@ -333,11 +333,11 @@ void LLVOGrass::updateTextures() } } -BOOL LLVOGrass::updateLOD() +bool LLVOGrass::updateLOD() { if (mDrawable->getNumFaces() <= 0) { - return FALSE; + return false; } LLFace* face = mDrawable->getFace(0); @@ -350,7 +350,7 @@ BOOL LLVOGrass::updateLOD() face->setSize(0, 0); gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL); } - return TRUE ; + return true ; } if(!mNumBlades) { @@ -387,10 +387,10 @@ BOOL LLVOGrass::updateLOD() face->setSize(mNumBlades*8, mNumBlades*12); } gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL); - return TRUE; + return true; } - return FALSE; + return false; } LLDrawable* LLVOGrass::createDrawable(LLPipeline *pipeline) @@ -403,7 +403,7 @@ LLDrawable* LLVOGrass::createDrawable(LLPipeline *pipeline) static LLTrace::BlockTimerStatHandle FTM_UPDATE_GRASS("Update Grass"); -BOOL LLVOGrass::updateGeometry(LLDrawable *drawable) +bool LLVOGrass::updateGeometry(LLDrawable *drawable) { LL_RECORD_BLOCK_TIME(FTM_UPDATE_GRASS); @@ -424,7 +424,7 @@ BOOL LLVOGrass::updateGeometry(LLDrawable *drawable) { plantBlades(); } - return TRUE; + return true; } void LLVOGrass::plantBlades() @@ -593,12 +593,12 @@ U32 LLVOGrass::getPartitionType() const } LLGrassPartition::LLGrassPartition(LLViewerRegion* regionp) -: LLSpatialPartition(LLDrawPoolAlpha::VERTEX_DATA_MASK | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, regionp) +: LLSpatialPartition(LLDrawPoolAlpha::VERTEX_DATA_MASK | LLVertexBuffer::MAP_TEXTURE_INDEX, true, regionp) { mDrawableType = LLPipeline::RENDER_TYPE_GRASS; mPartitionType = LLViewerRegion::PARTITION_GRASS; mLODPeriod = 16; - mDepthMask = TRUE; + mDepthMask = true; mSlopRatio = 0.1f; mRenderPass = LLRenderPass::PASS_GRASS; } @@ -696,7 +696,7 @@ void LLGrassPartition::getGeometry(LLSpatialGroup* group) vertex_count += facep->getGeomCount(); index_count += facep->getIndicesCount(); - S32 idx = draw_vec.size()-1; + S32 idx = static_cast<S32>(draw_vec.size()) - 1; bool fullbright = facep->isState(LLFace::FULLBRIGHT); @@ -731,28 +731,28 @@ void LLGrassPartition::getGeometry(LLSpatialGroup* group) } // virtual -void LLVOGrass::updateDrawable(BOOL force_damped) +void LLVOGrass::updateDrawable(bool force_damped) { // Force an immediate rebuild on any update if (mDrawable.notNull()) { - mDrawable->updateXform(TRUE); + mDrawable->updateXform(true); gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL); } clearChanged(SHIFTED); } // virtual -BOOL LLVOGrass::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, S32 face, BOOL pick_transparent, BOOL pick_rigged, BOOL pick_unselectable, S32 *face_hitp, +bool LLVOGrass::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, S32 face, bool pick_transparent, bool pick_rigged, bool pick_unselectable, S32 *face_hitp, LLVector4a* intersection,LLVector2* tex_coord, LLVector4a* normal, LLVector4a* tangent) { - BOOL ret = FALSE; + bool ret = false; if (!mbCanSelect || mDrawable->isDead() || !gPipeline.hasRenderType(mDrawable->getRenderType())) { - return FALSE; + return false; } LLVector4a dir; @@ -819,7 +819,7 @@ BOOL LLVOGrass::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& F32 a,b,t; - BOOL hit = FALSE; + bool hit = false; U32 idx0 = 0,idx1 = 0,idx2 = 0; @@ -834,24 +834,24 @@ BOOL LLVOGrass::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& if (LLTriangleRayIntersect(v0a, v1a, v2a, start, dir, a, b, t)) { - hit = TRUE; + hit = true; idx0 = 0; idx1 = 1; idx2 = 2; } else if (LLTriangleRayIntersect(v1a, v3a, v2a, start, dir, a, b, t)) { - hit = TRUE; + hit = true; idx0 = 1; idx1 = 3; idx2 = 2; } else if (LLTriangleRayIntersect(v2a, v1a, v0a, start, dir, a, b, t)) { normal1 = -normal1; - hit = TRUE; + hit = true; idx0 = 2; idx1 = 1; idx2 = 0; } else if (LLTriangleRayIntersect(v2a, v3a, v1a, start, dir, a, b, t)) { normal1 = -normal1; - hit = TRUE; + hit = true; idx0 = 2; idx1 = 3; idx2 = 1; } @@ -884,7 +884,7 @@ BOOL LLVOGrass::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& { normal->load3(normal1.mV); } - ret = TRUE; + ret = true; } } } diff --git a/indra/newview/llvograss.h b/indra/newview/llvograss.h index 0d52d4b99c..f34883fa59 100644 --- a/indra/newview/llvograss.h +++ b/indra/newview/llvograss.h @@ -53,10 +53,10 @@ public: static void import(LLFILE *file, LLMessageSystem *mesgsys, const LLVector3 &pos); /*virtual*/ void exportFile(LLFILE *file, const LLVector3 &position); - void updateDrawable(BOOL force_damped); + void updateDrawable(bool force_damped); /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); - /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); + /*virtual*/ bool updateGeometry(LLDrawable *drawable); /*virtual*/ void getGeometry(S32 idx, LLStrider<LLVector4a>& verticesp, LLStrider<LLVector3>& normalsp, @@ -67,19 +67,19 @@ public: void updateFaceSize(S32 idx) { } /*virtual*/ void updateTextures(); - /*virtual*/ BOOL updateLOD(); + /*virtual*/ bool updateLOD(); /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); // generate accurate apparent angle and area void plantBlades(); - /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate. + /*virtual*/ bool isActive() const; // Whether this object needs to do an idleUpdate. /*virtual*/ void idleUpdate(LLAgent &agent, const F64 &time); - /*virtual*/ BOOL lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, + /*virtual*/ bool lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, S32 face = -1, // which face to check, -1 = ALL_SIDES - BOOL pick_transparent = FALSE, - BOOL pick_rigged = FALSE, - BOOL pick_unselectable = TRUE, + bool pick_transparent = false, + bool pick_rigged = false, + bool pick_unselectable = true, S32* face_hit = NULL, // which face was hit LLVector4a* intersection = NULL, // return the intersection point LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point diff --git a/indra/newview/llvoicecallhandler.cpp b/indra/newview/llvoicecallhandler.cpp index 82a8d48f30..25b0e69436 100644 --- a/indra/newview/llvoicecallhandler.cpp +++ b/indra/newview/llvoicecallhandler.cpp @@ -48,7 +48,7 @@ public: //Get the ID LLUUID id; - if (!id.set( params[0], FALSE )) + if (!id.set( params[0], false )) { return false; } diff --git a/indra/newview/llvoicechannel.cpp b/indra/newview/llvoicechannel.cpp index 8681411a98..b95e43da8d 100644 --- a/indra/newview/llvoicechannel.cpp +++ b/indra/newview/llvoicechannel.cpp @@ -43,7 +43,7 @@ LLVoiceChannel* LLVoiceChannel::sCurrentVoiceChannel = NULL; LLVoiceChannel* LLVoiceChannel::sSuspendedVoiceChannel = NULL; LLVoiceChannel::channel_changed_signal_t LLVoiceChannel::sCurrentVoiceChannelChangedSignal; -BOOL LLVoiceChannel::sSuspended = FALSE; +bool LLVoiceChannel::sSuspended = false; // // Constants @@ -58,7 +58,7 @@ LLVoiceChannel::LLVoiceChannel(const LLUUID& session_id, const std::string& sess mState(STATE_NO_CHANNEL_INFO), mSessionName(session_name), mCallDirection(OUTGOING_CALL), - mIgnoreNextSessionLeave(FALSE), + mIgnoreNextSessionLeave(false), mCallEndedByAgent(false) { mNotifyArgs["VOICE_CHANNEL_NAME"] = mSessionName; @@ -187,13 +187,13 @@ void LLVoiceChannel::handleError(EStatusType type) setState(STATE_ERROR); } -BOOL LLVoiceChannel::isActive() +bool LLVoiceChannel::isActive() { // only considered active when currently bound channel matches what our channel return callStarted() && LLVoiceClient::getInstance()->isCurrentChannel(mChannelInfo); } -BOOL LLVoiceChannel::callStarted() +bool LLVoiceChannel::callStarted() { return mState >= STATE_CALL_STARTED; } @@ -203,7 +203,7 @@ void LLVoiceChannel::deactivate() if (mState >= STATE_RINGING) { // ignore session leave event - mIgnoreNextSessionLeave = TRUE; + mIgnoreNextSessionLeave = true; } if (callStarted()) @@ -344,7 +344,7 @@ void LLVoiceChannel::suspend() if (!sSuspended) { sSuspendedVoiceChannel = sCurrentVoiceChannel; - sSuspended = TRUE; + sSuspended = true; } } @@ -364,7 +364,7 @@ void LLVoiceChannel::resume() LLVoiceChannelProximal::getInstance()->activate(); } } - sSuspended = FALSE; + sSuspended = false; } } @@ -391,7 +391,7 @@ LLVoiceChannelGroup::LLVoiceChannelGroup(const LLUUID &session_id, mIsP2P(is_p2p) { mRetries = DEFAULT_RETRIES_COUNT; - mIsRetrying = FALSE; + mIsRetrying = false; } void LLVoiceChannelGroup::deactivate() @@ -513,7 +513,7 @@ void LLVoiceChannelGroup::handleStatusChange(EStatusType type) { case STATUS_JOINED: mRetries = 3; - mIsRetrying = FALSE; + mIsRetrying = false; default: break; } @@ -537,8 +537,8 @@ void LLVoiceChannelGroup::handleError(EStatusType status) if ( mRetries > 0 ) { mRetries--; - mIsRetrying = TRUE; - mIgnoreNextSessionLeave = TRUE; + mIsRetrying = true; + mIgnoreNextSessionLeave = true; requestChannelInfo(); return; @@ -547,7 +547,7 @@ void LLVoiceChannelGroup::handleError(EStatusType status) { notify = "VoiceChannelJoinFailed"; mRetries = DEFAULT_RETRIES_COUNT; - mIsRetrying = FALSE; + mIsRetrying = false; } break; @@ -662,7 +662,7 @@ LLVoiceChannelProximal::LLVoiceChannelProximal() : { } -BOOL LLVoiceChannelProximal::isActive() +bool LLVoiceChannelProximal::isActive() { return callStarted() && LLVoiceClient::getInstance()->inProximalChannel(); } @@ -765,7 +765,7 @@ LLVoiceChannelP2P::LLVoiceChannelP2P(const LLUUID &session_id, LLVoiceP2POutgoingCallInterface* outgoing_call_interface) : LLVoiceChannelGroup(session_id, session_name, true), mOtherUserID(other_user_id), - mReceivedCall(FALSE), + mReceivedCall(false), mOutgoingCallInterface(outgoing_call_interface) { } @@ -793,12 +793,12 @@ void LLVoiceChannelP2P::handleStatusChange(EStatusType type) } deactivate(); } - mIgnoreNextSessionLeave = FALSE; + mIgnoreNextSessionLeave = false; return; case STATUS_JOINING: // because we join session we expect to process session leave event in the future. EXT-7371 // may be this should be done in the LLVoiceChannel::handleStatusChange. - mIgnoreNextSessionLeave = FALSE; + mIgnoreNextSessionLeave = false; break; default: @@ -836,7 +836,7 @@ void LLVoiceChannelP2P::activate() // no session handle yet, we're starting the call if (mIncomingCallInterface == nullptr) { - mReceivedCall = FALSE; + mReceivedCall = false; mOutgoingCallInterface->callUser(mOtherUserID); } // otherwise answering the call @@ -887,7 +887,7 @@ void LLVoiceChannelP2P::requestChannelInfo() void LLVoiceChannelP2P::setChannelInfo(const LLSD& channel_info) { mChannelInfo = channel_info; - BOOL needs_activate = FALSE; + bool needs_activate = false; if (callStarted()) { // defer to lower agent id when already active @@ -895,7 +895,7 @@ void LLVoiceChannelP2P::setChannelInfo(const LLSD& channel_info) { // pretend we haven't started the call yet, so we can connect to this session instead deactivate(); - needs_activate = TRUE; + needs_activate = true; } else { @@ -906,7 +906,7 @@ void LLVoiceChannelP2P::setChannelInfo(const LLSD& channel_info) } } - mReceivedCall = TRUE; + mReceivedCall = true; if (channel_info.isDefined() && channel_info.isMap()) { mIncomingCallInterface = LLVoiceClient::getInstance()->getIncomingCallInterface(channel_info); diff --git a/indra/newview/llvoicechannel.h b/indra/newview/llvoicechannel.h index eb16cc22ba..6af1bd57a3 100644 --- a/indra/newview/llvoicechannel.h +++ b/indra/newview/llvoicechannel.h @@ -74,8 +74,8 @@ public: virtual void activate(); virtual void setChannelInfo(const LLSD &channelInfo); virtual void requestChannelInfo(); - virtual BOOL isActive(); - virtual BOOL callStarted(); + virtual bool isActive(); + virtual bool callStarted(); // Session name is a UI label used for feedback about which person, // group, or phone number you are talking to @@ -120,7 +120,7 @@ public: LLSD mChannelInfo; // true if call was ended by agent bool mCallEndedByAgent; - bool mIgnoreNextSessionLeave; + bool mIgnoreNextSessionLeave; LLHandle<LLPanel> mLoginNotificationHandle; typedef std::map<LLUUID, LLVoiceChannel*> voice_channel_map_t; @@ -129,7 +129,7 @@ public: static LLVoiceChannel* sProximalVoiceChannel; static LLVoiceChannel* sCurrentVoiceChannel; static LLVoiceChannel* sSuspendedVoiceChannel; - static BOOL sSuspended; + static bool sSuspended; private: state_changed_signal_t mStateChangedCallback; @@ -158,19 +158,19 @@ private: void voiceCallCapCoro(std::string url); U32 mRetries; - BOOL mIsRetrying; + bool mIsRetrying; bool mIsP2P; }; class LLVoiceChannelProximal : public LLVoiceChannel, public LLSingleton<LLVoiceChannelProximal> { - LLSINGLETON_C11(LLVoiceChannelProximal); + LLSINGLETON(LLVoiceChannelProximal); public: void onChange(EStatusType status, const LLSD &channelInfo, bool proximal) override; void handleStatusChange(EStatusType status) override; void handleError(EStatusType status) override; - BOOL isActive() override; + bool isActive() override; void activate() override; void deactivate() override; }; @@ -201,7 +201,7 @@ private: **/ void addToTheRecentPeopleList(); LLUUID mOtherUserID; - BOOL mReceivedCall; + bool mReceivedCall; LLVoiceP2POutgoingCallInterface *mOutgoingCallInterface; LLVoiceP2PIncomingCallInterfacePtr mIncomingCallInterface; }; diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 490c7174c5..4b299a51f5 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -37,6 +37,7 @@ #include "llui.h" #include "llkeyboard.h" #include "llagent.h" +#include "lltrans.h" #include "lluiusage.h" const F32 LLVoiceClient::OVERDRIVEN_POWER_LEVEL = 0.7f; @@ -423,16 +424,16 @@ bool LLVoiceClient::isParticipant(const LLUUID &speaker_id) //-------------------------------------------------- // text chat -BOOL LLVoiceClient::isSessionTextIMPossible(const LLUUID& id) +bool LLVoiceClient::isSessionTextIMPossible(const LLUUID& id) { // all sessions can do TextIM, as we no longer support PSTN - return TRUE; + return true; } -BOOL LLVoiceClient::isSessionCallBackPossible(const LLUUID& id) +bool LLVoiceClient::isSessionCallBackPossible(const LLUUID& id) { // we don't support PSTN calls anymore. (did we ever?) - return TRUE; + return true; } //---------------------------------------------- @@ -597,7 +598,11 @@ bool LLVoiceClient::voiceEnabled() bool enabled = enable_voice_chat && !cmd_line_disable_voice && !gNonInteractive; if (enabled && !mVoiceEffectSupportNotified && getVoiceEffectEnabled() && !getVoiceEffectDefault().isNull()) { - LLNotificationsUtil::add("VoiceEffectsNotSupported", LLSD(), LLSD(), &LLVoiceClient::onVoiceEffectsNotSupported); + static const LLSD args = llsd::map( + "FAQ_URL", LLTrans::getString("no_voice_morphing_faq_url") + ); + + LLNotificationsUtil::add("VoiceEffectsNotSupported", args, LLSD(), &LLVoiceClient::onVoiceEffectsNotSupported); mVoiceEffectSupportNotified = true; } return enabled; @@ -713,9 +718,9 @@ void LLVoiceClient::toggleUserPTTState(void) //------------------------------------------- // nearby speaker accessors -BOOL LLVoiceClient::getVoiceEnabled(const LLUUID& id) +bool LLVoiceClient::getVoiceEnabled(const LLUUID& id) { - return isParticipant(id) ? TRUE : FALSE; + return isParticipant(id); } std::string LLVoiceClient::getDisplayName(const LLUUID& id) @@ -734,23 +739,23 @@ bool LLVoiceClient::isVoiceWorking() const LLWebRTCVoiceClient::getInstance()->isVoiceWorking(); } -BOOL LLVoiceClient::isParticipantAvatar(const LLUUID& id) +bool LLVoiceClient::isParticipantAvatar(const LLUUID& id) { - return TRUE; + return true; } -BOOL LLVoiceClient::isOnlineSIP(const LLUUID& id) +bool LLVoiceClient::isOnlineSIP(const LLUUID& id) { - return FALSE; + return false; } -BOOL LLVoiceClient::getIsSpeaking(const LLUUID& id) +bool LLVoiceClient::getIsSpeaking(const LLUUID& id) { return LLWebRTCVoiceClient::getInstance()->getIsSpeaking(id) || LLVivoxVoiceClient::getInstance()->getIsSpeaking(id); } -BOOL LLVoiceClient::getIsModeratorMuted(const LLUUID& id) +bool LLVoiceClient::getIsModeratorMuted(const LLUUID& id) { // don't bother worrying about p2p calls, as // p2p calls don't have mute. @@ -764,7 +769,7 @@ F32 LLVoiceClient::getCurrentPower(const LLUUID& id) LLWebRTCVoiceClient::getInstance()->getCurrentPower(id)); } -BOOL LLVoiceClient::getOnMuteList(const LLUUID& id) +bool LLVoiceClient::getOnMuteList(const LLUUID& id) { // don't bother worrying about p2p calls, as // p2p calls don't have mute. diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h index d603125759..9ae18b315c 100644 --- a/indra/newview/llvoiceclient.h +++ b/indra/newview/llvoiceclient.h @@ -250,9 +250,9 @@ public: /// @name nearby speaker accessors //@{ virtual std::string getDisplayName(const LLUUID& id)=0; - virtual BOOL isParticipantAvatar(const LLUUID &id)=0; - virtual BOOL getIsSpeaking(const LLUUID& id)=0; - virtual BOOL getIsModeratorMuted(const LLUUID& id)=0; + virtual bool isParticipantAvatar(const LLUUID &id)=0; + virtual bool getIsSpeaking(const LLUUID& id)=0; + virtual bool getIsModeratorMuted(const LLUUID& id)=0; virtual F32 getCurrentPower(const LLUUID& id)=0; // "power" is related to "amplitude" in a defined way. I'm just not sure what the formula is... virtual F32 getUserVolume(const LLUUID& id)=0; virtual void setUserVolume(const LLUUID& id, F32 volume)=0; // set's volume for specified agent, from 0-1 (where .5 is nominal) @@ -261,9 +261,9 @@ public: ////////////////////////// /// @name text chat //@{ - virtual BOOL isSessionTextIMPossible(const LLUUID& id)=0; - virtual BOOL isSessionCallBackPossible(const LLUUID& id)=0; - //virtual BOOL sendTextMessage(const LLUUID& participant_id, const std::string& message)=0; + virtual bool isSessionTextIMPossible(const LLUUID& id)=0; + virtual bool isSessionCallBackPossible(const LLUUID& id)=0; + //virtual bool sendTextMessage(const LLUUID& participant_id, const std::string& message)=0; //@} // authorize the user @@ -451,14 +451,14 @@ public: ///////////////////////////// // Accessors for data related to nearby speakers - BOOL getVoiceEnabled(const LLUUID& id); // true if we've received data for this avatar + bool getVoiceEnabled(const LLUUID& id); // true if we've received data for this avatar std::string getDisplayName(const LLUUID& id); - BOOL isOnlineSIP(const LLUUID &id); - BOOL isParticipantAvatar(const LLUUID &id); - BOOL getIsSpeaking(const LLUUID& id); - BOOL getIsModeratorMuted(const LLUUID& id); + bool isOnlineSIP(const LLUUID &id); + bool isParticipantAvatar(const LLUUID &id); + bool getIsSpeaking(const LLUUID& id); + bool getIsModeratorMuted(const LLUUID& id); F32 getCurrentPower(const LLUUID& id); // "power" is related to "amplitude" in a defined way. I'm just not sure what the formula is... - BOOL getOnMuteList(const LLUUID& id); + bool getOnMuteList(const LLUUID& id); F32 getUserVolume(const LLUUID& id); ///////////////////////////// @@ -468,9 +468,9 @@ public: ////////////////////////// /// @name text chat //@{ - BOOL isSessionTextIMPossible(const LLUUID& id); - BOOL isSessionCallBackPossible(const LLUUID& id); - //BOOL sendTextMessage(const LLUUID& participant_id, const std::string& message) const {return true;} ; + bool isSessionTextIMPossible(const LLUUID& id); + bool isSessionCallBackPossible(const LLUUID& id); + //bool sendTextMessage(const LLUUID& participant_id, const std::string& message) const {return true;} ; //@} void setSpatialVoiceModule(const std::string& voice_server_type); @@ -540,7 +540,7 @@ protected: **/ class LLSpeakerVolumeStorage : public LLSingleton<LLSpeakerVolumeStorage> { - LLSINGLETON_C11(LLSpeakerVolumeStorage); + LLSINGLETON(LLSpeakerVolumeStorage); ~LLSpeakerVolumeStorage(); LOG_CLASS(LLSpeakerVolumeStorage); diff --git a/indra/newview/llvoicevisualizer.cpp b/indra/newview/llvoicevisualizer.cpp index 0374111972..305fd77126 100644 --- a/indra/newview/llvoicevisualizer.cpp +++ b/indra/newview/llvoicevisualizer.cpp @@ -77,7 +77,7 @@ const LLVector3 WORLD_UPWARD_DIRECTION = LLVector3( 0.0f, 0.0f, 1.0f ); // Z is // Initialize the statics //------------------------------------------------------------------ bool LLVoiceVisualizer::sPrefsInitialized = false; -BOOL LLVoiceVisualizer::sLipSyncEnabled = FALSE; +bool LLVoiceVisualizer::sLipSyncEnabled = false; F32* LLVoiceVisualizer::sOoh = NULL; F32* LLVoiceVisualizer::sAah = NULL; U32 LLVoiceVisualizer::sOohs = 0; @@ -125,7 +125,7 @@ LLVoiceVisualizer::LLVoiceVisualizer( const U8 type ) for (int i=0; i<NUM_VOICE_SYMBOL_WAVES; i++) { mSoundSymbol.mWaveFadeOutStartTime [i] = mCurrentTime; - mSoundSymbol.mTexture [i] = LLViewerTextureManager::getFetchedTextureFromFile(sound_level_img[i], FTT_LOCAL_FILE, FALSE, LLGLTexture::BOOST_UI); + mSoundSymbol.mTexture [i] = LLViewerTextureManager::getFetchedTextureFromFile(sound_level_img[i], FTT_LOCAL_FILE, false, LLGLTexture::BOOST_UI); mSoundSymbol.mWaveActive [i] = false; mSoundSymbol.mWaveOpacity [i] = 1.0f; mSoundSymbol.mWaveExpansion [i] = 1.0f; @@ -248,7 +248,7 @@ void LLVoiceVisualizer::lipStringToF32s ( std::string& in_string, F32*& out_F32s { delete[] out_F32s; // get rid of the current array - count_F32s = in_string.length(); + count_F32s = static_cast<U32>(in_string.length()); if (count_F32s == 0) { // we don't like zero length arrays @@ -284,7 +284,7 @@ void LLVoiceVisualizer::lipStringToF32s ( std::string& in_string, F32*& out_F32s //-------------------------------------------------------------------------- void LLVoiceVisualizer::lipSyncOohAah( F32& ooh, F32& aah ) { - if( ( sLipSyncEnabled == TRUE ) && mCurrentlySpeaking ) + if (sLipSyncEnabled && mCurrentlySpeaking) { U32 transfer_index = (U32) (sOohPowerTransfersf * mSpeakingAmplitude); if (transfer_index >= sOohPowerTransfers) diff --git a/indra/newview/llvoicevisualizer.h b/indra/newview/llvoicevisualizer.h index 403b3a8819..a44f60bd16 100644 --- a/indra/newview/llvoicevisualizer.h +++ b/indra/newview/llvoicevisualizer.h @@ -135,7 +135,7 @@ class LLVoiceVisualizer : public LLHUDEffect // private static members //--------------------------------------------------- - static BOOL sLipSyncEnabled; // 0 disabled, 1 babble loop + static bool sLipSyncEnabled; // 0 disabled, 1 babble loop static bool sPrefsInitialized; // the first instance will initialize the static members static F32* sOoh; // the babble loop of amplitudes for the ooh morph static F32* sAah; // the babble loop of amplitudes for the ooh morph diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 673a760a81..ab1a3056fa 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -282,6 +282,8 @@ bool LLVivoxVoiceClient::sConnected = false; LLPumpIO *LLVivoxVoiceClient::sPump = nullptr; LLVivoxVoiceClient::LLVivoxVoiceClient() : + mWriteOffset(0), + mHidden(true), mSessionTerminateRequested(false), mRelogRequested(false), mTerminateDaemon(false), @@ -1932,7 +1934,7 @@ bool LLVivoxVoiceClient::terminateAudioSession(bool wait) << " VoiceEnabled " << mVoiceEnabled << " IsInitialized " << mIsInitialized << " RelogRequested " << mRelogRequested - << " ShuttingDown " << (sShuttingDown ? "TRUE" : "FALSE") + << " ShuttingDown " << (sShuttingDown ? "True" : "False") << " returning " << status << LL_ENDL; return status; @@ -5030,16 +5032,16 @@ bool LLVivoxVoiceClient::isVoiceWorking() const // Returns true if the indicated participant in the current audio session is really an SL avatar. // Currently this will be false only for PSTN callers into group chats, and PSTN p2p calls. -BOOL LLVivoxVoiceClient::isParticipantAvatar(const LLUUID &id) +bool LLVivoxVoiceClient::isParticipantAvatar(const LLUUID &id) { - BOOL result = TRUE; + bool result = true; sessionStatePtr_t session(findSession(id)); if(session) { // this is a p2p session with the indicated caller, or the session with the specified UUID. if(session->mSynthesizedCallerID) - result = FALSE; + result = false; } else { @@ -5059,9 +5061,9 @@ BOOL LLVivoxVoiceClient::isParticipantAvatar(const LLUUID &id) // Returns true if calling back the session URI after the session has closed is possible. // Currently this will be false only for PSTN P2P calls. -BOOL LLVivoxVoiceClient::isSessionCallBackPossible(const LLUUID &session_id) +bool LLVivoxVoiceClient::isSessionCallBackPossible(const LLUUID &session_id) { - BOOL result = TRUE; + bool result = true; sessionStatePtr_t session(findSession(session_id)); if(session != NULL) @@ -5074,9 +5076,9 @@ BOOL LLVivoxVoiceClient::isSessionCallBackPossible(const LLUUID &session_id) // Returns true if the session can accept text IM's. // Currently this will be false only for PSTN P2P calls. -BOOL LLVivoxVoiceClient::isSessionTextIMPossible(const LLUUID &session_id) +bool LLVivoxVoiceClient::isSessionTextIMPossible(const LLUUID &session_id) { - bool result = TRUE; + bool result = true; sessionStatePtr_t session(findSession(session_id)); if(session != NULL) @@ -5197,7 +5199,7 @@ std::string LLVivoxVoiceClient::nameFromID(const LLUUID &uuid) LLStringUtil::replaceChar(result, '+', '-'); LLStringUtil::replaceChar(result, '/', '_'); - // If you need to transform a GUID to this form on the Mac OS X command line, this will do so: + // If you need to transform a GUID to this form on the macOS command line, this will do so: // echo -n x && (echo e669132a-6c43-4ee1-a78d-6c82fff59f32 |xxd -r -p |openssl base64|tr '/+' '_-') // The reverse transform can be done with: @@ -5563,9 +5565,9 @@ std::string LLVivoxVoiceClient::getDisplayName(const LLUUID& id) -BOOL LLVivoxVoiceClient::getIsSpeaking(const LLUUID& id) +bool LLVivoxVoiceClient::getIsSpeaking(const LLUUID& id) { - BOOL result = FALSE; + bool result = false; if (mProcessChannels) { participantStatePtr_t participant(findParticipantByID(id)); @@ -5573,7 +5575,7 @@ BOOL LLVivoxVoiceClient::getIsSpeaking(const LLUUID& id) { if (participant->mSpeakingTimeout.getElapsedTimeF32() > SPEAKING_TIMEOUT) { - participant->mIsSpeaking = FALSE; + participant->mIsSpeaking = false; } result = participant->mIsSpeaking; } @@ -5582,12 +5584,12 @@ BOOL LLVivoxVoiceClient::getIsSpeaking(const LLUUID& id) return result; } -BOOL LLVivoxVoiceClient::getIsModeratorMuted(const LLUUID& id) +bool LLVivoxVoiceClient::getIsModeratorMuted(const LLUUID& id) { - BOOL result = FALSE; + bool result = false; if (!mProcessChannels) { - return FALSE; + return false; } participantStatePtr_t participant(findParticipantByID(id)); if(participant) @@ -5612,9 +5614,9 @@ F32 LLVivoxVoiceClient::getCurrentPower(const LLUUID& id) -BOOL LLVivoxVoiceClient::getUsingPTT(const LLUUID& id) +bool LLVivoxVoiceClient::getUsingPTT(const LLUUID& id) { - BOOL result = FALSE; + bool result = false; participantStatePtr_t participant(findParticipantByID(id)); if(participant) @@ -6300,7 +6302,7 @@ void LLVivoxVoiceClient::notifyStatusObservers(LLVoiceClientStatusObserver::ESta if (voice_status) { - LLFirstUse::speak(true); + LLAppViewer::instance()->postToMainCoro([=]() { LLFirstUse::speak(true); }); } } } @@ -6930,7 +6932,7 @@ void LLVivoxVoiceClient::updateVoiceMorphingMenu() const voice_effect_list_t& effect_list = effect_interfacep->getVoiceEffectList(); if (!effect_list.empty()) { - LLMenuGL * voice_morphing_menup = gMenuBarView->findChildMenuByName("VoiceMorphing", TRUE); + LLMenuGL * voice_morphing_menup = gMenuBarView->findChildMenuByName("VoiceMorphing", true); if (NULL != voice_morphing_menup) { @@ -7221,8 +7223,8 @@ LLIOPipe::EStatus LLVivoxProtocolParser::process_impl( } // Look for input delimiter(s) in the input buffer. If one is found, send the message to the xml parser. - int start = 0; - int delim; + size_t start = 0; + size_t delim; while((delim = mInput.find("\n\n\n", start)) != std::string::npos) { @@ -7233,7 +7235,8 @@ LLIOPipe::EStatus LLVivoxProtocolParser::process_impl( XML_SetElementHandler(parser, ExpatStartTag, ExpatEndTag); XML_SetCharacterDataHandler(parser, ExpatCharHandler); XML_SetUserData(parser, this); - XML_Parse(parser, mInput.data() + start, delim - start, false); + XML_Parse(parser, mInput.data() + start, static_cast<int>(delim - start), false); + LL_DEBUGS("VivoxProtocolParser") << "parsing: " << mInput.substr(start, delim - start) << LL_ENDL; start = delim + 3; diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h index 55c1fb50d0..420e0aa869 100644 --- a/indra/newview/llvoicevivox.h +++ b/indra/newview/llvoicevivox.h @@ -71,7 +71,7 @@ class LLVivoxVoiceClient : public LLSingleton<LLVivoxVoiceClient>, virtual public LLVoiceEffectInterface, virtual public LLVoiceP2POutgoingCallInterface { - LLSINGLETON_C11(LLVivoxVoiceClient); + LLSINGLETON(LLVivoxVoiceClient); LOG_CLASS(LLVivoxVoiceClient); virtual ~LLVivoxVoiceClient(); @@ -127,17 +127,17 @@ public: bool isParticipant(const LLUUID& speaker_id) override; // Send a text message to the specified user, initiating the session if necessary. - // virtual BOOL sendTextMessage(const LLUUID& participant_id, const std::string& message) const {return false;}; + // virtual bool sendTextMessage(const LLUUID& participant_id, const std::string& message) const {return false;}; // Returns true if calling back the session URI after the session has closed is possible. // Currently this will be false only for PSTN P2P calls. // NOTE: this will return true if the session can't be found. - BOOL isSessionCallBackPossible(const LLUUID &session_id) override; + bool isSessionCallBackPossible(const LLUUID &session_id) override; // Returns true if the session can accepte text IM's. // Currently this will be false only for PSTN P2P calls. // NOTE: this will return true if the session can't be found. - BOOL isSessionTextIMPossible(const LLUUID &session_id) override; + bool isSessionTextIMPossible(const LLUUID &session_id) override; //////////////////////////// /// @name Channel stuff @@ -198,9 +198,9 @@ public: /// @name nearby speaker accessors //@{ std::string getDisplayName(const LLUUID& id) override; - BOOL isParticipantAvatar(const LLUUID &id) override; - BOOL getIsSpeaking(const LLUUID& id) override; - BOOL getIsModeratorMuted(const LLUUID& id) override; + bool isParticipantAvatar(const LLUUID &id) override; + bool getIsSpeaking(const LLUUID& id) override; + bool getIsModeratorMuted(const LLUUID& id) override; F32 getCurrentPower(const LLUUID& id) override; // "power" is related to "amplitude" in a defined way. I'm just not sure what the formula is... F32 getUserVolume(const LLUUID& id) override; void setUserVolume(const LLUUID& id, F32 volume) override; // set's volume for specified agent, from 0-1 (where .5 is nominal) @@ -508,7 +508,7 @@ protected: // Accessors for data related to nearby speakers // MBW -- XXX -- Not sure how to get this data out of the TVC - BOOL getUsingPTT(const LLUUID& id); + bool getUsingPTT(const LLUUID& id); std::string getGroupID(const LLUUID& id); // group ID if the user is in group chat (empty string if not applicable) ///////////////////////////// diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index f3ab52736e..1d729dcd35 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -78,8 +78,7 @@ // for base64 decoding #include "apr_base64.h" -#include "json/reader.h" -#include "json/writer.h" +#include "boost/json.hpp" const std::string WEBRTC_VOICE_SERVER_TYPE = "webrtc"; @@ -323,7 +322,7 @@ void LLWebRTCVoiceClient::updateSettings() config.mNoiseSuppressionLevel = (llwebrtc::LLWebRTCDeviceInterface::AudioConfig::ENoiseSuppressionLevel) (U32)sNoiseSuppressionLevel; mWebRTCDeviceInterface->setAudioConfig(config); - + } // Observers @@ -391,7 +390,7 @@ void LLWebRTCVoiceClient::notifyStatusObservers(LLVoiceClientStatusObserver::ESt if (voice_status) { - LLFirstUse::speak(true); + LLAppViewer::instance()->postToMainCoro([=]() { LLFirstUse::speak(true); }); } } } @@ -623,10 +622,10 @@ void LLWebRTCVoiceClient::setDevicesListUpdated(bool state) void LLWebRTCVoiceClient::OnDevicesChanged(const llwebrtc::LLWebRTCVoiceDeviceList& render_devices, const llwebrtc::LLWebRTCVoiceDeviceList& capture_devices) { - + LL::WorkQueue::postMaybe(mMainQueue, - [=] - { + [=] + { OnDevicesChangedImpl(render_devices, capture_devices); }); } @@ -650,7 +649,7 @@ void LLWebRTCVoiceClient::OnDevicesChangedImpl(const llwebrtc::LLWebRTCVoiceDevi for (auto &device : capture_devices) { LL_DEBUGS("Voice") << "Checking capture device:'" << device.mID << "'" << LL_ENDL; - + addCaptureDevice(LLVoiceDevice(device.mDisplayName, device.mID)); } setCaptureDevice(inputDevice); @@ -1016,35 +1015,38 @@ void LLWebRTCVoiceClient::sendPositionUpdate(bool force) { LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE - Json::FastWriter writer; std::string spatial_data; if (mSpatialCoordsDirty || force) { - Json::Value spatial = Json::objectValue; - - spatial["sp"] = Json::objectValue; - spatial["sp"]["x"] = (int) (mAvatarPosition[0] * 100); - spatial["sp"]["y"] = (int) (mAvatarPosition[1] * 100); - spatial["sp"]["z"] = (int) (mAvatarPosition[2] * 100); - spatial["sh"] = Json::objectValue; - spatial["sh"]["x"] = (int) (mAvatarRot[0] * 100); - spatial["sh"]["y"] = (int) (mAvatarRot[1] * 100); - spatial["sh"]["z"] = (int) (mAvatarRot[2] * 100); - spatial["sh"]["w"] = (int) (mAvatarRot[3] * 100); - - spatial["lp"] = Json::objectValue; - spatial["lp"]["x"] = (int) (mListenerPosition[0] * 100); - spatial["lp"]["y"] = (int) (mListenerPosition[1] * 100); - spatial["lp"]["z"] = (int) (mListenerPosition[2] * 100); - spatial["lh"] = Json::objectValue; - spatial["lh"]["x"] = (int) (mListenerRot[0] * 100); - spatial["lh"]["y"] = (int) (mListenerRot[1] * 100); - spatial["lh"]["z"] = (int) (mListenerRot[2] * 100); - spatial["lh"]["w"] = (int) (mListenerRot[3] * 100); + boost::json::object spatial; + + spatial["sp"] = { + {"x", (int) (mAvatarPosition[0] * 100)}, + {"y", (int) (mAvatarPosition[1] * 100)}, + {"z", (int) (mAvatarPosition[2] * 100)} + }; + spatial["sh"] = { + {"x", (int) (mAvatarRot[0] * 100)}, + {"y", (int) (mAvatarRot[1] * 100)}, + {"z", (int) (mAvatarRot[2] * 100)}, + {"w", (int) (mAvatarRot[3] * 100)} + }; + + spatial["lp"] = { + {"x", (int) (mListenerPosition[0] * 100)}, + {"y", (int) (mListenerPosition[1] * 100)}, + {"z", (int) (mListenerPosition[2] * 100)} + }; + + spatial["lh"] = { + {"x", (int) (mListenerRot[0] * 100)}, + {"y", (int) (mListenerRot[1] * 100)}, + {"z", (int) (mListenerRot[2] * 100)}, + {"w", (int) (mListenerRot[3] * 100)}}; mSpatialCoordsDirty = false; - spatial_data = writer.write(spatial); + spatial_data = boost::json::serialize(spatial); sessionState::for_each(boost::bind(predSendData, _1, spatial_data)); } @@ -1068,10 +1070,10 @@ void LLWebRTCVoiceClient::updateOwnVolume() { // Provider-level participant management -BOOL LLWebRTCVoiceClient::isParticipantAvatar(const LLUUID &id) +bool LLWebRTCVoiceClient::isParticipantAvatar(const LLUUID &id) { // WebRTC participants are always SL avatars. - return TRUE; + return true; } void LLWebRTCVoiceClient::getParticipantList(std::set<LLUUID> &participants) @@ -1291,10 +1293,10 @@ bool LLWebRTCVoiceClient::isVoiceWorking() const // Returns true if calling back the session URI after the session has closed is possible. // Currently this will be false only for PSTN P2P calls. -BOOL LLWebRTCVoiceClient::isSessionCallBackPossible(const LLUUID &session_id) +bool LLWebRTCVoiceClient::isSessionCallBackPossible(const LLUUID &session_id) { sessionStatePtr_t session(findP2PSession(session_id)); - return session && session->isCallbackPossible() ? TRUE : FALSE; + return session && session->isCallbackPossible(); } // Channel Management @@ -1560,9 +1562,9 @@ std::string LLWebRTCVoiceClient::getDisplayName(const LLUUID& id) return result; } -BOOL LLWebRTCVoiceClient::getIsSpeaking(const LLUUID& id) +bool LLWebRTCVoiceClient::getIsSpeaking(const LLUUID& id) { - BOOL result = FALSE; + bool result = false; if (mProcessChannels && mSession) { participantStatePtr_t participant(mSession->findParticipantByID(id)); @@ -1575,9 +1577,9 @@ BOOL LLWebRTCVoiceClient::getIsSpeaking(const LLUUID& id) } // TODO: Need to pull muted status from the webrtc server -BOOL LLWebRTCVoiceClient::getIsModeratorMuted(const LLUUID& id) +bool LLWebRTCVoiceClient::getIsModeratorMuted(const LLUUID& id) { - BOOL result = FALSE; + bool result = false; if (mProcessChannels && mSession) { participantStatePtr_t participant(mSession->findParticipantByID(id)); @@ -2270,7 +2272,7 @@ void LLVoiceWebRTCConnection::processIceUpdatesCoro() void LLVoiceWebRTCConnection::OnOfferAvailable(const std::string &sdp) { LL::WorkQueue::postMaybe(mMainQueue, - [=] { + [=] { if (mShutDown) { return; @@ -2319,7 +2321,7 @@ void LLVoiceWebRTCConnection::OnAudioEstablished(llwebrtc::LLWebRTCAudioInterfac void LLVoiceWebRTCConnection::OnRenegotiationNeeded() { LL::WorkQueue::postMaybe(mMainQueue, - [=] { + [=] { LL_DEBUGS("Voice") << "Voice channel requires renegotiation." << LL_ENDL; if (!mShutDown) { @@ -2363,12 +2365,8 @@ void LLVoiceWebRTCConnection::setSpeakerVolume(F32 volume) void LLVoiceWebRTCConnection::setUserVolume(const LLUUID& id, F32 volume) { - Json::Value root = Json::objectValue; - Json::Value user_gain = Json::objectValue; - user_gain[id.asString()] = (uint32_t)(volume*200); // give it two decimal places with a range from 0-200, where 100 is normal - root["ug"] = user_gain; - Json::FastWriter writer; - std::string json_data = writer.write(root); + boost::json::object root = {{"ug", {id.asString(), (uint32_t) (volume * 200)}}}; + std::string json_data = boost::json::serialize(root); if (mWebRTCDataInterface) { mWebRTCDataInterface->sendData(json_data, false); @@ -2377,12 +2375,8 @@ void LLVoiceWebRTCConnection::setUserVolume(const LLUUID& id, F32 volume) void LLVoiceWebRTCConnection::setUserMute(const LLUUID& id, bool mute) { - Json::Value root = Json::objectValue; - Json::Value muted = Json::objectValue; - muted[id.asString()] = mute; - root["m"] = muted; - Json::FastWriter writer; - std::string json_data = writer.write(root); + boost::json::object root = {{"m", {id.asString(), mute}}}; + std::string json_data = boost::json::serialize(root); if (mWebRTCDataInterface) { mWebRTCDataInterface->sendData(json_data, false); @@ -2434,7 +2428,7 @@ void LLVoiceWebRTCConnection::breakVoiceConnectionCoro() LLVoiceWebRTCStats::getInstance()->provisionAttemptStart(); LLSD body; - body["logout"] = TRUE; + body["logout"] = true; body["viewer_session"] = mViewerSession; body["voice_server_type"] = WEBRTC_VOICE_SERVER_TYPE; @@ -2607,7 +2601,7 @@ bool LLVoiceWebRTCConnection::connectionStateMachine() } mIceCompleted = false; setVoiceConnectionState(VOICE_STATE_WAIT_FOR_SESSION_START); - + // tell the webrtc library that we want a connection. The library will // respond with an offer on a separate thread, which will cause // the session state to change. @@ -2780,7 +2774,7 @@ void LLVoiceWebRTCConnection::OnDataReceived(const std::string& data, bool binar // // The LLWebRTCVoiceConnection object will not be deleted -// before the webrtc connection itself is shut down, so +// before the webrtc connection itself is shut down, so // we shouldn't be getting this callback on a nonexistant // this pointer. void LLVoiceWebRTCConnection::OnDataReceivedImpl(const std::string &data, bool binary) @@ -2798,27 +2792,36 @@ void LLVoiceWebRTCConnection::OnDataReceivedImpl(const std::string &data, bool b return; } - Json::Reader reader; - Json::Value voice_data; - if (reader.parse(data, voice_data, false)) // don't collect comments + boost::json::error_code ec; + boost::json::value voice_data_parsed = boost::json::parse(data, ec); + if (!ec) // don't collect comments { - if (!voice_data.isObject()) + if (!voice_data_parsed.is_object()) { LL_WARNS("Voice") << "Expected object from data channel:" << data << LL_ENDL; return; } + boost::json::object voice_data = voice_data_parsed.as_object(); bool new_participant = false; - Json::Value mute = Json::objectValue; - Json::Value user_gain = Json::objectValue; - for (auto &participant_id : voice_data.getMemberNames()) + boost::json::object mute; + boost::json::object user_gain; + for (auto &participant_elem : voice_data) { - LLUUID agent_id(participant_id); + boost::json::string participant_id(participant_elem.key()); + LLUUID agent_id(participant_id.c_str()); if (agent_id.isNull()) { // probably a test client. continue; } + if (!participant_elem.value().is_object()) + { + continue; + } + + boost::json::object participant_obj = participant_elem.value().as_object(); + LLWebRTCVoiceClient::participantStatePtr_t participant = LLWebRTCVoiceClient::getInstance()->findParticipantByID(mChannelID, agent_id); bool joined = false; @@ -2828,11 +2831,16 @@ void LLVoiceWebRTCConnection::OnDataReceivedImpl(const std::string &data, bool b // where a participant on a neighboring region may be // connected to multiple servers. We don't want to // add new identical participants from all of those servers. - if (voice_data[participant_id].isMember("j")) + if (participant_obj.contains("j") && + participant_obj["j"].is_object()) { // a new participant has announced that they're joining. joined = true; - primary = voice_data[participant_id]["j"].get("p", Json::Value(false)).asBool(); + if (participant_elem.value().as_object()["j"].as_object().contains("p") && + participant_elem.value().as_object()["j"].as_object()["p"].is_bool()) + { + primary = participant_elem.value().as_object()["j"].as_object()["p"].as_bool(); + } // track incoming participants that are muted so we can mute their connections (or set their volume) bool isMuted = LLMuteList::getInstance()->isMuted(agent_id, LLMute::flagVoiceChat); @@ -2855,7 +2863,7 @@ void LLVoiceWebRTCConnection::OnDataReceivedImpl(const std::string &data, bool b if (participant) { - if (voice_data[participant_id].get("l", Json::Value(false)).asBool()) + if (participant_obj.contains("l") && participant_obj["l"].is_bool() && participant_obj["l"].as_bool()) { // an existing participant is leaving. if (agent_id != gAgentID) @@ -2866,18 +2874,20 @@ void LLVoiceWebRTCConnection::OnDataReceivedImpl(const std::string &data, bool b else { // we got a 'power' update. - F32 level = (F32) (voice_data[participant_id].get("p", Json::Value(participant->mLevel)).asInt()) / 128; - // convert to decibles - participant->mLevel = level; + if (participant_obj.contains("p") && participant_obj["p"].is_number()) + { + participant->mLevel = (F32)participant_obj["p"].as_int64(); + } - if (voice_data[participant_id].isMember("v")) + if (participant_obj.contains("v") && participant_obj["v"].is_bool()) { - participant->mIsSpeaking = voice_data[participant_id].get("v", Json::Value(false)).asBool(); + participant->mIsSpeaking = participant_obj["v"].as_bool(); } - if (voice_data[participant_id].isMember("m")) + if (participant_obj.contains("v") && participant_obj["m"].is_bool()) { - participant->mIsModeratorMuted = voice_data[participant_id].get("m", Json::Value(false)).asBool(); + participant->mIsModeratorMuted = participant_obj["m"].as_bool(); + ; } } } @@ -2885,8 +2895,7 @@ void LLVoiceWebRTCConnection::OnDataReceivedImpl(const std::string &data, bool b // tell the simulator to set the mute and volume data for this // participant, if there are any updates. - Json::FastWriter writer; - Json::Value root = Json::objectValue; + boost::json::object root; if (mute.size() > 0) { root["m"] = mute; @@ -2897,7 +2906,7 @@ void LLVoiceWebRTCConnection::OnDataReceivedImpl(const std::string &data, bool b } if (root.size() > 0) { - std::string json_data = writer.write(root); + std::string json_data = boost::json::serialize(root); mWebRTCDataInterface->sendData(json_data, false); } } @@ -2939,16 +2948,16 @@ void LLVoiceWebRTCConnection::sendJoin() { LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE - Json::FastWriter writer; - Json::Value root = Json::objectValue; - Json::Value join_obj = Json::objectValue; + + boost::json::object root; + boost::json::object join_obj; LLUUID regionID = gAgent.getRegion()->getRegionID(); if ((regionID == mRegionID) || !isSpatial()) { join_obj["p"] = true; } root["j"] = join_obj; - std::string json_data = writer.write(root); + std::string json_data = boost::json::serialize(root); mWebRTCDataInterface->sendData(json_data, false); } diff --git a/indra/newview/llvoicewebrtc.h b/indra/newview/llvoicewebrtc.h index 7042bbae00..480a7897cd 100644 --- a/indra/newview/llvoicewebrtc.h +++ b/indra/newview/llvoicewebrtc.h @@ -41,7 +41,7 @@ class LLWebRTCProtocolParser; #include "llparcel.h" #include "llmutelist.h" #include <queue> -#include "json/reader.h" +#include "boost/json.hpp" #ifdef LL_USESYSTEMLIBS # include "expat.h" @@ -64,7 +64,7 @@ class LLWebRTCVoiceClient : public LLSingleton<LLWebRTCVoiceClient>, public llwebrtc::LLWebRTCDevicesObserver, public LLMuteListObserver { - LLSINGLETON_C11(LLWebRTCVoiceClient); + LLSINGLETON(LLWebRTCVoiceClient); LOG_CLASS(LLWebRTCVoiceClient); virtual ~LLWebRTCVoiceClient(); @@ -122,15 +122,15 @@ public: bool isParticipant(const LLUUID& speaker_id) override; // Send a text message to the specified user, initiating the session if necessary. - // virtual BOOL sendTextMessage(const LLUUID& participant_id, const std::string& message) const {return false;}; + // virtual bool sendTextMessage(const LLUUID& participant_id, const std::string& message) const {return false;}; // Returns true if calling back the session URI after the session has closed is possible. // Currently this will be false only for PSTN P2P calls. // NOTE: this will return true if the session can't be found. - BOOL isSessionCallBackPossible(const LLUUID &session_id) override; + bool isSessionCallBackPossible(const LLUUID &session_id) override; // WebRTC doesn't preclude text im - BOOL isSessionTextIMPossible(const LLUUID &session_id) override { return TRUE; } + bool isSessionTextIMPossible(const LLUUID &session_id) override { return true; } //////////////////////////// /// @name Channel stuff @@ -177,9 +177,9 @@ public: ////////////////////////// /// @name nearby speaker accessors std::string getDisplayName(const LLUUID& id) override; - BOOL isParticipantAvatar(const LLUUID &id) override; - BOOL getIsSpeaking(const LLUUID& id) override; - BOOL getIsModeratorMuted(const LLUUID& id) override; + bool isParticipantAvatar(const LLUUID &id) override; + bool getIsSpeaking(const LLUUID& id) override; + bool getIsModeratorMuted(const LLUUID& id) override; F32 getCurrentPower(const LLUUID& id) override; // "power" is related to "amplitude" in a defined way. I'm just not sure what the formula is... F32 getUserVolume(const LLUUID& id) override; void setUserVolume(const LLUUID& id, F32 volume) override; // set's volume for specified agent, from 0-1 (where .5 is nominal) diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index d8d7cab6eb..81f16cf8cb 100644 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -139,7 +139,7 @@ LLVOPartGroup::LLVOPartGroup(const LLUUID &id, const LLPCode pcode, LLViewerRegi { setNumTEs(1); setTETexture(0, LLUUID::null); - mbCanSelect = FALSE; // users can't select particle systems + mbCanSelect = false; // users can't select particle systems } @@ -147,9 +147,9 @@ LLVOPartGroup::~LLVOPartGroup() { } -BOOL LLVOPartGroup::isActive() const +bool LLVOPartGroup::isActive() const { - return FALSE; + return false; } F32 LLVOPartGroup::getBinRadius() @@ -207,7 +207,7 @@ void LLVOPartGroup::updateTextures() LLDrawable* LLVOPartGroup::createDrawable(LLPipeline *pipeline) { pipeline->allocDrawable(this); - mDrawable->setLit(FALSE); + mDrawable->setLit(false); mDrawable->setRenderType(LLPipeline::RENDER_TYPE_PARTICLES); return mDrawable; } @@ -270,7 +270,7 @@ LLVector3 LLVOPartGroup::getCameraPosition() const return gAgentCamera.getCameraPositionAgent(); } -BOOL LLVOPartGroup::updateGeometry(LLDrawable *drawable) +bool LLVOPartGroup::updateGeometry(LLDrawable *drawable) { LL_PROFILE_ZONE_SCOPED; @@ -298,12 +298,12 @@ BOOL LLVOPartGroup::updateGeometry(LLDrawable *drawable) } drawable->setNumFaces(0, NULL, getTEImage(0)); LLPipeline::sCompiles++; - return TRUE; + return true; } if (!(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_PARTICLES))) { - return TRUE; + return true; } if (num_parts > drawable->getNumFaces()) @@ -317,7 +317,7 @@ BOOL LLVOPartGroup::updateGeometry(LLDrawable *drawable) F32 pixel_meter_ratio = LLViewerCamera::getInstance()->getPixelMeterRatio(); pixel_meter_ratio *= pixel_meter_ratio; - LLViewerPartSim::checkParticleCount(mViewerPartGroupp->mParticles.size()) ; + LLViewerPartSim::checkParticleCount(static_cast<U32>(mViewerPartGroupp->mParticles.size())); S32 count=0; mDepth = 0.f; @@ -441,15 +441,15 @@ BOOL LLVOPartGroup::updateGeometry(LLDrawable *drawable) mDrawable->movePartition(); LLPipeline::sCompiles++; - return TRUE; + return true; } -BOOL LLVOPartGroup::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, +bool LLVOPartGroup::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, S32 face, - BOOL pick_transparent, - BOOL pick_rigged, - BOOL pick_unselectable, + bool pick_transparent, + bool pick_rigged, + bool pick_unselectable, S32* face_hit, LLVector4a* intersection, LLVector2* tex_coord, @@ -460,7 +460,7 @@ BOOL LLVOPartGroup::lineSegmentIntersect(const LLVector4a& start, const LLVector dir.setSub(end, start); F32 closest_t = 2.f; - BOOL ret = FALSE; + bool ret = false; for (U32 idx = 0; idx < mViewerPartGroupp->mParticles.size(); ++idx) { @@ -480,7 +480,7 @@ BOOL LLVOPartGroup::lineSegmentIntersect(const LLVector4a& start, const LLVector t <= 1.f && t < closest_t) { - ret = TRUE; + ret = true; closest_t = t; if (face_hit) { @@ -702,7 +702,7 @@ U32 LLVOPartGroup::getPartitionType() const } LLParticlePartition::LLParticlePartition(LLViewerRegion* regionp) -: LLSpatialPartition(LLDrawPoolAlpha::VERTEX_DATA_MASK | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, regionp) +: LLSpatialPartition(LLDrawPoolAlpha::VERTEX_DATA_MASK | LLVertexBuffer::MAP_TEXTURE_INDEX, true, regionp) { mRenderPass = LLRenderPass::PASS_ALPHA; mDrawableType = LLPipeline::RENDER_TYPE_PARTICLES; @@ -889,7 +889,7 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group) object->getGeometry(facep->getTEOffset(), cur_vert, cur_norm, cur_tc, cur_col, cur_glow, cur_idx); - bool has_glow = FALSE; + bool has_glow = false; if (cur_glow.get() != start_glow) { @@ -899,7 +899,7 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group) llassert(facep->getGeomCount() == 4); llassert(facep->getIndicesCount() == 6); - S32 idx = draw_vec.size()-1; + S32 idx = static_cast<S32>(draw_vec.size()) - 1; bool fullbright = facep->isState(LLFace::FULLBRIGHT); @@ -972,7 +972,7 @@ U32 LLVOHUDPartGroup::getPartitionType() const LLDrawable* LLVOHUDPartGroup::createDrawable(LLPipeline *pipeline) { pipeline->allocDrawable(this); - mDrawable->setLit(FALSE); + mDrawable->setLit(false); mDrawable->setRenderType(LLPipeline::RENDER_TYPE_HUD_PARTICLES); return mDrawable; } diff --git a/indra/newview/llvopartgroup.h b/indra/newview/llvopartgroup.h index b93f8924e6..20b4561374 100644 --- a/indra/newview/llvopartgroup.h +++ b/indra/newview/llvopartgroup.h @@ -56,18 +56,18 @@ public: LLVOPartGroup(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); - /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate. + /*virtual*/ bool isActive() const; // Whether this object needs to do an idleUpdate. void idleUpdate(LLAgent &agent, const F64 &time); virtual F32 getBinRadius(); virtual void updateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax); virtual U32 getPartitionType() const; - /*virtual*/ BOOL lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, + /*virtual*/ bool lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, S32 face, - BOOL pick_transparent, - BOOL pick_rigged, - BOOL pick_unselectable, + bool pick_transparent, + bool pick_rigged, + bool pick_unselectable, S32* face_hit, LLVector4a* intersection, LLVector2* tex_coord, @@ -78,7 +78,7 @@ public: /*virtual*/ void updateTextures(); /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); - /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); + /*virtual*/ bool updateGeometry(LLDrawable *drawable); void getGeometry(const LLViewerPart& part, LLStrider<LLVector4a>& verticesp); diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 5e5c887be6..2b8ed74b0f 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -105,7 +105,7 @@ void LLSkyTex::init(bool isShiny) for (S32 i = 0; i < 2; ++i) { - mTexture[i] = LLViewerTextureManager::getLocalTexture(FALSE); + mTexture[i] = LLViewerTextureManager::getLocalTexture(false); mTexture[i]->setAddressMode(LLTexUnit::TAM_CLAMP); mImageRaw[i] = new LLImageRaw(SKYTEX_RESOLUTION, SKYTEX_RESOLUTION, SKYTEX_COMPONENTS); @@ -123,7 +123,7 @@ void LLSkyTex::restoreGL() { for (S32 i = 0; i < 2; i++) { - mTexture[i] = LLViewerTextureManager::getLocalTexture(FALSE); + mTexture[i] = LLViewerTextureManager::getLocalTexture(false); mTexture[i]->setAddressMode(LLTexUnit::TAM_CLAMP); } } @@ -158,7 +158,7 @@ S32 LLSkyTex::getNext() return ((sCurrent+1) & 1); } -S32 LLSkyTex::getWhich(const BOOL curr) +S32 LLSkyTex::getWhich(const bool curr) { int tex = curr ? sCurrent : getNext(); return tex; @@ -166,6 +166,7 @@ S32 LLSkyTex::getWhich(const BOOL curr) void LLSkyTex::initEmpty(const S32 tex) { + LLImageDataLock lock(mImageRaw[tex]); U8* data = mImageRaw[tex]->getData(); for (S32 i = 0; i < SKYTEX_RESOLUTION; ++i) { @@ -187,7 +188,8 @@ void LLSkyTex::initEmpty(const S32 tex) void LLSkyTex::create() { - U8* data = mImageRaw[sCurrent]->getData(); + LLImageDataSharedLock lock(mImageRaw[sCurrent]); + const U8* data = mImageRaw[sCurrent]->getData(); for (S32 i = 0; i < SKYTEX_RESOLUTION; ++i) { for (S32 j = 0; j < SKYTEX_RESOLUTION; ++j) @@ -205,17 +207,17 @@ void LLSkyTex::create() void LLSkyTex::createGLImage(S32 which) { mTexture[which]->setExplicitFormat(GL_RGBA8, GL_RGBA); - mTexture[which]->createGLTexture(0, mImageRaw[which], 0, TRUE, LLGLTexture::LOCAL); + mTexture[which]->createGLTexture(0, mImageRaw[which], 0, true, LLGLTexture::LOCAL); mTexture[which]->setAddressMode(LLTexUnit::TAM_CLAMP); } -void LLSkyTex::bindTexture(BOOL curr) +void LLSkyTex::bindTexture(bool curr) { int tex = getWhich(curr); gGL.getTexUnit(0)->bind(mTexture[tex], true); } -LLImageRaw* LLSkyTex::getImageRaw(BOOL curr) +LLImageRaw* LLSkyTex::getImageRaw(bool curr) { int tex = getWhich(curr); return mImageRaw[tex]; @@ -232,10 +234,10 @@ LLHeavenBody::LLHeavenBody(const F32 rad) mDirection(LLVector3(0,0,0)), mIntensity(0.f), mDiskRadius(rad), - mDraw(FALSE), + mDraw(false), mHorizonVisibility(1.f), mVisibility(1.f), - mVisible(FALSE) + mVisible(false) { mColor.setToBlack(); mColorCached.setToBlack(); @@ -394,24 +396,24 @@ const S32 SKYTEX_TILE_RES_X = SKYTEX_RESOLUTION / NUM_TILES_X; const S32 SKYTEX_TILE_RES_Y = SKYTEX_RESOLUTION / NUM_TILES_Y; LLVOSky::LLVOSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) -: LLStaticViewerObject(id, pcode, regionp, TRUE), +: LLStaticViewerObject(id, pcode, regionp, true), mSun(SUN_DISK_RADIUS), mMoon(MOON_DISK_RADIUS), mBrightnessScale(1.f), mBrightnessScaleNew(0.f), mBrightnessScaleGuess(1.f), - mWeatherChange(FALSE), + mWeatherChange(false), mCloudDensity(0.2f), mWind(0.f), - mForceUpdate(FALSE), - mNeedUpdate(TRUE), + mForceUpdate(false), + mNeedUpdate(true), mCubeMapUpdateStage(-1), mWorldScale(1.f), mBumpSunDir(0.f, 0.f, 1.f) { /// WL PARAMS - mInitialized = FALSE; - mbCanSelect = FALSE; + mInitialized = false; + mbCanSelect = false; mUpdateTimer.reset(); mForceUpdateThrottle.setTimerExpirySec(UPDATE_EXPRY); @@ -434,7 +436,7 @@ LLVOSky::LLVOSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) mSun.setIntensity(SUN_INTENSITY); mMoon.setIntensity(0.1f * SUN_INTENSITY); - mHeavenlyBodyUpdated = FALSE ; + mHeavenlyBodyUpdated = false ; mDrawRefl = 0; mInterpVal = 0.f; @@ -477,10 +479,10 @@ void LLVOSky::init() mInitialized = true; - mHeavenlyBodyUpdated = FALSE ; + mHeavenlyBodyUpdated = false ; - mRainbowMap = LLViewerTextureManager::getFetchedTexture(psky->getRainbowTextureId(), FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); - mHaloMap = LLViewerTextureManager::getFetchedTexture(psky->getHaloTextureId(), FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); + mRainbowMap = LLViewerTextureManager::getFetchedTexture(psky->getRainbowTextureId(), FTT_DEFAULT, true, LLGLTexture::BOOST_UI); + mHaloMap = LLViewerTextureManager::getFetchedTexture(psky->getHaloTextureId(), FTT_DEFAULT, true, LLGLTexture::BOOST_UI); } @@ -659,7 +661,7 @@ void LLVOSky::idleUpdate(LLAgent &agent, const F64 &time) void LLVOSky::forceSkyUpdate() { - mForceUpdate = TRUE; + mForceUpdate = true; m_lastAtmosphericsVars = {}; mCubeMapUpdateStage = -1; } @@ -671,12 +673,12 @@ bool LLVOSky::updateSky() if (mDead || !(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SKY))) { // It's dead. Don't update it. - return TRUE; + return true; } if (gGLManager.mIsDisabled) { - return TRUE; + return true; } LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT; @@ -695,8 +697,8 @@ bool LLVOSky::updateSky() if (!mCubeMap || LLPipeline::sReflectionProbesEnabled) { mCubeMapUpdateStage = NUM_CUBEMAP_FACES; - mForceUpdate = FALSE; - return TRUE; + mForceUpdate = false; + return true; } if (mCubeMapUpdateStage < 0) @@ -712,7 +714,7 @@ bool LLVOSky::updateSky() // start updating cube map sides updateFog(LLViewerCamera::getInstance()->getFar()); mCubeMapUpdateStage = 0; - mForceUpdate = FALSE; + mForceUpdate = false; } } else if (mCubeMapUpdateStage == NUM_CUBEMAP_FACES && !LLPipeline::sReflectionProbesEnabled) @@ -722,7 +724,7 @@ bool LLVOSky::updateSky() bool is_alm_wl_sky = gPipeline.canUseWindLightShaders(); - int tex = mSkyTex[0].getWhich(TRUE); + int tex = mSkyTex[0].getWhich(true); for (int side = 0; side < NUM_CUBEMAP_FACES; side++) { @@ -731,14 +733,14 @@ bool LLVOSky::updateSky() if (!is_alm_wl_sky) { - raw1 = mSkyTex[side].getImageRaw(TRUE); - raw2 = mSkyTex[side].getImageRaw(FALSE); + raw1 = mSkyTex[side].getImageRaw(true); + raw2 = mSkyTex[side].getImageRaw(false); raw2->copy(raw1); mSkyTex[side].createGLImage(tex); } - raw1 = mShinyTex[side].getImageRaw(TRUE); - raw2 = mShinyTex[side].getImageRaw(FALSE); + raw1 = mShinyTex[side].getImageRaw(true); + raw2 = mShinyTex[side].getImageRaw(false); raw2->copy(raw1); mShinyTex[side].createGLImage(tex); } @@ -763,8 +765,8 @@ bool LLVOSky::updateSky() m_lastAtmosphericsVars = m_atmosphericsVars; - mNeedUpdate = FALSE; - mForceUpdate = FALSE; + mNeedUpdate = false; + mForceUpdate = false; mForceUpdateThrottle.setTimerExpirySec(UPDATE_EXPRY); @@ -791,7 +793,7 @@ bool LLVOSky::updateSky() mCubeMapUpdateStage++; } - return TRUE; + return true; } void LLVOSky::updateTextures() @@ -830,7 +832,7 @@ void LLVOSky::updateTextures() LLDrawable *LLVOSky::createDrawable(LLPipeline *pipeline) { pipeline->allocDrawable(this); - mDrawable->setLit(FALSE); + mDrawable->setLit(false); LLDrawPoolSky *poolp = (LLDrawPoolSky*) gPipeline.getPool(LLDrawPool::POOL_SKY); poolp->setSkyTex(mSkyTex); @@ -865,8 +867,8 @@ void LLVOSky::setMoonScale(F32 moon_scale) void LLVOSky::setSunTextures(const LLUUID& sun_texture, const LLUUID& sun_texture_next) { // We test the UUIDs here because we explicitly do not want the default image returned by getFetchedTexture in that case... - mSunTexturep[0] = sun_texture.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(sun_texture, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); - mSunTexturep[1] = sun_texture_next.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(sun_texture_next, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); + mSunTexturep[0] = sun_texture.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(sun_texture, FTT_DEFAULT, true, LLGLTexture::BOOST_UI); + mSunTexturep[1] = sun_texture_next.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(sun_texture_next, FTT_DEFAULT, true, LLGLTexture::BOOST_UI); bool can_use_wl = gPipeline.canUseWindLightShaders(); @@ -909,8 +911,8 @@ void LLVOSky::setMoonTextures(const LLUUID& moon_texture, const LLUUID& moon_tex bool can_use_wl = gPipeline.canUseWindLightShaders(); - mMoonTexturep[0] = moon_texture.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(moon_texture, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); - mMoonTexturep[1] = moon_texture_next.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(moon_texture_next, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); + mMoonTexturep[0] = moon_texture.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(moon_texture, FTT_DEFAULT, true, LLGLTexture::BOOST_UI); + mMoonTexturep[1] = moon_texture_next.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(moon_texture_next, FTT_DEFAULT, true, LLGLTexture::BOOST_UI); if (mFace[FACE_MOON]) { @@ -932,8 +934,8 @@ void LLVOSky::setCloudNoiseTextures(const LLUUID& cloud_noise_texture, const LLU { LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); - mCloudNoiseTexturep[0] = cloud_noise_texture.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(cloud_noise_texture, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); - mCloudNoiseTexturep[1] = cloud_noise_texture_next.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(cloud_noise_texture_next, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); + mCloudNoiseTexturep[0] = cloud_noise_texture.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(cloud_noise_texture, FTT_DEFAULT, true, LLGLTexture::BOOST_UI); + mCloudNoiseTexturep[1] = cloud_noise_texture_next.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(cloud_noise_texture_next, FTT_DEFAULT, true, LLGLTexture::BOOST_UI); if (mCloudNoiseTexturep[0]) { @@ -953,8 +955,8 @@ void LLVOSky::setBloomTextures(const LLUUID& bloom_texture, const LLUUID& bloom_ LLUUID bloom_tex = bloom_texture.isNull() ? psky->GetDefaultBloomTextureId() : bloom_texture; LLUUID bloom_tex_next = bloom_texture_next.isNull() ? (bloom_texture.isNull() ? psky->GetDefaultBloomTextureId() : bloom_texture) : bloom_texture_next; - mBloomTexturep[0] = bloom_tex.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(bloom_tex, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); - mBloomTexturep[1] = bloom_tex_next.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(bloom_tex_next, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); + mBloomTexturep[0] = bloom_tex.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(bloom_tex, FTT_DEFAULT, true, LLGLTexture::BOOST_UI); + mBloomTexturep[1] = bloom_tex_next.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(bloom_tex_next, FTT_DEFAULT, true, LLGLTexture::BOOST_UI); if (mBloomTexturep[0]) { @@ -967,7 +969,7 @@ void LLVOSky::setBloomTextures(const LLUUID& bloom_texture, const LLUUID& bloom_ } } -BOOL LLVOSky::updateGeometry(LLDrawable *drawable) +bool LLVOSky::updateGeometry(LLDrawable *drawable) { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE; if (mFace[FACE_REFLECTION] == NULL) @@ -1069,7 +1071,7 @@ BOOL LLVOSky::updateGeometry(LLDrawable *drawable) const F32 camera_height = mCameraPosAgent.mV[2]; const F32 height_above_water = camera_height - water_height; - bool sun_flag = FALSE; + bool sun_flag = false; if (mSun.isVisible()) { sun_flag = !mMoon.isVisible() || ((look_at * mSun.getDirection()) > 0); @@ -1084,12 +1086,12 @@ BOOL LLVOSky::updateGeometry(LLDrawable *drawable) } LLPipeline::sCompiles++; - return TRUE; + return true; } bool LLVOSky::updateHeavenlyBodyGeometry(LLDrawable *drawable, F32 scale, const S32 f, LLHeavenBody& hb, const LLVector3 &up, const LLVector3 &right) { - mHeavenlyBodyUpdated = TRUE ; + mHeavenlyBodyUpdated = true ; LLStrider<LLVector3> verticesp; LLStrider<LLVector3> normalsp; @@ -1131,7 +1133,7 @@ bool LLVOSky::updateHeavenlyBodyGeometry(LLDrawable *drawable, F32 scale, const v_clipped[2] = draw_pos + scaled_right + scaled_up; v_clipped[3] = draw_pos + scaled_right - scaled_up; - hb.setVisible(TRUE); + hb.setVisible(true); facep = mFace[f]; @@ -1156,7 +1158,7 @@ bool LLVOSky::updateHeavenlyBodyGeometry(LLDrawable *drawable, F32 scale, const if (-1 == index_offset) { - return TRUE; + return true; } for (S32 vtx = 0; vtx < 4; ++vtx) @@ -1180,7 +1182,7 @@ bool LLVOSky::updateHeavenlyBodyGeometry(LLDrawable *drawable, F32 scale, const facep->getVertexBuffer()->unmapBuffer(); - return TRUE; + return true; } F32 dtReflection(const LLVector3& p, F32 cos_dir_from_top, F32 sin_dir_from_top, F32 diff_angl_dir) diff --git a/indra/newview/llvosky.h b/indra/newview/llvosky.h index 87f801862c..ad7570105e 100644 --- a/indra/newview/llvosky.h +++ b/indra/newview/llvosky.h @@ -60,7 +60,7 @@ private: static S32 sCurrent; public: - void bindTexture(BOOL curr = TRUE); + void bindTexture(bool curr = true); protected: LLSkyTex(); @@ -75,7 +75,7 @@ protected: static S32 getCurrent(); static S32 stepCurrent(); static S32 getNext(); - static S32 getWhich(const BOOL curr); + static S32 getWhich(const bool curr); void initEmpty(const S32 tex); @@ -101,6 +101,7 @@ protected: void setPixel(const LLColor4U &col, const S32 i, const S32 j) { + LLImageDataSharedLock lock(mImageRaw[sCurrent]); S32 offset = (i * SKYTEX_RESOLUTION + j) * SKYTEX_COMPONENTS; U32* pix = (U32*) &(mImageRaw[sCurrent]->getData()[offset]); *pix = col.asRGBA(); @@ -109,14 +110,15 @@ protected: LLColor4U getPixel(const S32 i, const S32 j) { LLColor4U col; + LLImageDataSharedLock lock(mImageRaw[sCurrent]); S32 offset = (i * SKYTEX_RESOLUTION + j) * SKYTEX_COMPONENTS; U32* pix = (U32*) &(mImageRaw[sCurrent]->getData()[offset]); col.fromRGBA( *pix ); return col; } - LLImageRaw* getImageRaw(BOOL curr=TRUE); - void createGLImage(BOOL curr=TRUE); + LLImageRaw* getImageRaw(bool curr=true); + void createGLImage(S32 which); bool mIsShiny; }; @@ -135,7 +137,7 @@ protected: LLVector3 mAngularVelocity; // velocity of the local heavenly body F32 mDiskRadius; - bool mDraw; // FALSE - do not draw. + bool mDraw; // false - do not draw. F32 mHorizonVisibility; // number [0, 1] due to how horizon F32 mVisibility; // same but due to other objects being in throng. bool mVisible; @@ -229,7 +231,7 @@ public: // later? /*virtual*/ void updateTextures(); /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); - /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); + /*virtual*/ bool updateGeometry(LLDrawable *drawable); const LLHeavenBody& getSun() const { return mSun; } const LLHeavenBody& getMoon() const { return mMoon; } diff --git a/indra/newview/llvosurfacepatch.cpp b/indra/newview/llvosurfacepatch.cpp index 405d0e59ce..56742751e8 100644 --- a/indra/newview/llvosurfacepatch.cpp +++ b/indra/newview/llvosurfacepatch.cpp @@ -48,19 +48,19 @@ F32 LLVOSurfacePatch::sLODFactor = 1.f; LLVOSurfacePatch::LLVOSurfacePatch(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) : LLStaticViewerObject(id, pcode, regionp), - mDirtiedPatch(FALSE), + mDirtiedPatch(false), mPool(NULL), mBaseComp(0), mPatchp(NULL), - mDirtyTexture(FALSE), - mDirtyTerrain(FALSE), + mDirtyTexture(false), + mDirtyTerrain(false), mLastNorthStride(0), mLastEastStride(0), mLastStride(0), mLastLength(0) { // Terrain must draw during selection passes so it can block objects behind it. - mbCanSelect = TRUE; + mbCanSelect = true; setScale(LLVector3(16.f, 16.f, 16.f)); // Hack for setting scale for bounding boxes/visibility. } @@ -82,9 +82,9 @@ void LLVOSurfacePatch::markDead() } -BOOL LLVOSurfacePatch::isActive() const +bool LLVOSurfacePatch::isActive() const { - return FALSE; + return false; } @@ -147,7 +147,7 @@ void LLVOSurfacePatch::updateGL() } } -BOOL LLVOSurfacePatch::updateGeometry(LLDrawable *drawable) +bool LLVOSurfacePatch::updateGeometry(LLDrawable *drawable) { LL_PROFILE_ZONE_SCOPED; @@ -209,7 +209,7 @@ BOOL LLVOSurfacePatch::updateGeometry(LLDrawable *drawable) mLastNorthStride = north_stride; mLastEastStride = east_stride; - return TRUE; + return true; } void LLVOSurfacePatch::updateFaceSize(S32 idx) @@ -238,9 +238,9 @@ void LLVOSurfacePatch::updateFaceSize(S32 idx) } } -BOOL LLVOSurfacePatch::updateLOD() +bool LLVOSurfacePatch::updateLOD() { - return TRUE; + return true; } void LLVOSurfacePatch::getTerrainGeometry(LLStrider<LLVector3> &verticesp, @@ -766,9 +766,9 @@ void LLVOSurfacePatch::setPatch(LLSurfacePatch *patchp) void LLVOSurfacePatch::dirtyPatch() { - mDirtiedPatch = TRUE; + mDirtiedPatch = true; dirtyGeom(); - mDirtyTerrain = TRUE; + mDirtyTerrain = true; LLVector3 center = mPatchp->getCenterRegion(); LLSurface *surfacep = mPatchp->getSurface(); @@ -857,14 +857,14 @@ void LLVOSurfacePatch::getGeomSizesEast(const S32 stride, const S32 east_stride, } } -BOOL LLVOSurfacePatch::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, S32 face, BOOL pick_transparent, BOOL pick_rigged, BOOL pick_unselectable, S32 *face_hitp, +bool LLVOSurfacePatch::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, S32 face, bool pick_transparent, bool pick_rigged, bool pick_unselectable, S32 *face_hitp, LLVector4a* intersection,LLVector2* tex_coord, LLVector4a* normal, LLVector4a* tangent) { if (!lineSegmentBoundingBox(start, end)) { - return FALSE; + return false; } LLVector4a da; @@ -885,7 +885,7 @@ BOOL LLVOSurfacePatch::lineSegmentIntersect(const LLVector4a& start, const LLVec if (mRegionp->getLandHeightRegion(origin) > origin.mV[2]) { //origin is under ground, treat as no intersection - return FALSE; + return false; } //step one meter at a time until intersection point found @@ -943,7 +943,7 @@ BOOL LLVOSurfacePatch::lineSegmentIntersect(const LLVector4a& start, const LLVec normal->load3((mRegionp->getLand().resolveNormalGlobal(mRegionp->getPosGlobalFromRegion(sample))).mV); } - return TRUE; + return true; } } @@ -955,7 +955,7 @@ BOOL LLVOSurfacePatch::lineSegmentIntersect(const LLVector4a& start, const LLVec } - return FALSE; + return false; } void LLVOSurfacePatch::updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax) @@ -978,10 +978,10 @@ U32 LLVOSurfacePatch::getPartitionType() const } LLTerrainPartition::LLTerrainPartition(LLViewerRegion* regionp) -: LLSpatialPartition(LLDrawPoolTerrain::VERTEX_DATA_MASK, FALSE, regionp) +: LLSpatialPartition(LLDrawPoolTerrain::VERTEX_DATA_MASK, false, regionp) { - mOcclusionEnabled = FALSE; - mInfiniteFarClip = TRUE; + mOcclusionEnabled = false; + mInfiniteFarClip = true; mDrawableType = LLPipeline::RENDER_TYPE_TERRAIN; mPartitionType = LLViewerRegion::PARTITION_TERRAIN; } diff --git a/indra/newview/llvosurfacepatch.h b/indra/newview/llvosurfacepatch.h index a38a5e011f..2780b97a97 100644 --- a/indra/newview/llvosurfacepatch.h +++ b/indra/newview/llvosurfacepatch.h @@ -60,8 +60,8 @@ public: /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); /*virtual*/ void updateGL(); - /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); - /*virtual*/ BOOL updateLOD(); + /*virtual*/ bool updateGeometry(LLDrawable *drawable); + /*virtual*/ bool updateLOD(); /*virtual*/ void updateFaceSize(S32 idx); void getTerrainGeometry(LLStrider<LLVector3> &verticesp, LLStrider<LLVector3> &normalsp, @@ -73,7 +73,7 @@ public: /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); // generate accurate apparent angle and area /*virtual*/ void updateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax); - /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate. + /*virtual*/ bool isActive() const; // Whether this object needs to do an idleUpdate. void setPatch(LLSurfacePatch *patchp); LLSurfacePatch *getPatch() const { return mPatchp; } @@ -81,11 +81,11 @@ public: void dirtyPatch(); void dirtyGeom(); - /*virtual*/ BOOL lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, + /*virtual*/ bool lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, S32 face = -1, // which face to check, -1 = ALL_SIDES - BOOL pick_transparent = FALSE, - BOOL pick_rigged = FALSE, - BOOL pick_unselectable = TRUE, + bool pick_transparent = false, + bool pick_rigged = false, + bool pick_unselectable = true, S32* face_hit = NULL, // which face was hit LLVector4a* intersection = NULL, // return the intersection point LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point @@ -93,7 +93,7 @@ public: LLVector4a* tangent = NULL // return the surface tangent at the intersection point ); - BOOL mDirtiedPatch; + bool mDirtiedPatch; protected: ~LLVOSurfacePatch(); @@ -101,8 +101,8 @@ protected: LLFacePool *getPool(); S32 mBaseComp; LLSurfacePatch *mPatchp; - BOOL mDirtyTexture; - BOOL mDirtyTerrain; + bool mDirtyTexture; + bool mDirtyTerrain; S32 mLastNorthStride; S32 mLastEastStride; diff --git a/indra/newview/llvotree.cpp b/indra/newview/llvotree.cpp index 8b229ec98b..a981c60ef2 100644 --- a/indra/newview/llvotree.cpp +++ b/indra/newview/llvotree.cpp @@ -135,10 +135,7 @@ void LLVOTree::initClass() LLUUID id; S32 S32_val; - BOOL success = TRUE; - - - + bool success{ true }; S32 species; static LLStdStringHandle species_id_string = LLXmlTree::addAttributeString("species_id"); if (!tree_def->getFastAttributeS32(species_id_string, species)) @@ -250,7 +247,7 @@ void LLVOTree::initClass() } } - BOOL have_all_trees = TRUE; + bool have_all_trees {true}; std::string err; for (S32 i=0;i<sMaxTreeSpecies;++i) @@ -258,7 +255,7 @@ void LLVOTree::initClass() if (!sSpeciesTable.count(i)) { err.append(llformat(" %d",i)); - have_all_trees = FALSE; + have_all_trees = false; } } @@ -322,7 +319,7 @@ U32 LLVOTree::processUpdateMessage(LLMessageSystem *mesgsys, // Load Species-Specific data // static const S32 MAX_TREE_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL = 32 ; //frames. - mTreeImagep = LLViewerTextureManager::getFetchedTexture(sSpeciesTable[mSpecies]->mTextureID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + mTreeImagep = LLViewerTextureManager::getFetchedTexture(sSpeciesTable[mSpecies]->mTextureID, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); mTreeImagep->setMaxVirtualSizeResetInterval(MAX_TREE_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL); //allow to wait for at most 16 frames to reset virtual size. mBranchLength = sSpeciesTable[mSpecies]->mBranchLength; @@ -473,7 +470,7 @@ void LLVOTree::updateTextures() LLDrawable* LLVOTree::createDrawable(LLPipeline *pipeline) { pipeline->allocDrawable(this); - mDrawable->setLit(FALSE); + mDrawable->setLit(false); mDrawable->setRenderType(LLPipeline::RENDER_TYPE_TREE); @@ -493,7 +490,7 @@ LLDrawable* LLVOTree::createDrawable(LLPipeline *pipeline) const S32 LEAF_INDICES = 24; const S32 LEAF_VERTICES = 16; -BOOL LLVOTree::updateGeometry(LLDrawable *drawable) +bool LLVOTree::updateGeometry(LLDrawable *drawable) { LL_PROFILE_ZONE_SCOPED; @@ -505,7 +502,7 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable) { facep->setVertexBuffer(NULL); } - return TRUE ; + return true ; } if (mDrawable->getFace(0) && @@ -522,7 +519,7 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable) S32 lod; LLFace *face = drawable->getFace(0); - if (!face) return TRUE; + if (!face) return true; face->mCenterAgent = getPositionAgent(); face->mCenterLocal = face->mCenterAgent; @@ -545,7 +542,7 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable) << max_vertices << " vertices and " << max_indices << " indices" << LL_ENDL; mReferenceBuffer = NULL; //unref - return TRUE; + return true; } LLStrider<LLVector3> vertices; @@ -874,7 +871,7 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable) //generate tree mesh updateMesh(); - return TRUE; + return true; } void LLVOTree::updateMesh() @@ -1174,14 +1171,14 @@ void LLVOTree::updateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax) mDrawable->setPositionGroup(pos); } -BOOL LLVOTree::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, S32 face, BOOL pick_transparent, BOOL pick_rigged, BOOL pick_unselectable, S32 *face_hitp, +bool LLVOTree::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, S32 face, bool pick_transparent, bool pick_rigged, bool pick_unselectable, S32 *face_hitp, LLVector4a* intersection,LLVector2* tex_coord, LLVector4a* normal, LLVector4a* tangent) { if (!lineSegmentBoundingBox(start, end)) { - return FALSE; + return false; } const LLVector4a* exta = mDrawable->getSpatialExtents(); @@ -1218,10 +1215,10 @@ BOOL LLVOTree::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& e { normal->load3(norm.mV); } - return TRUE; + return true; } - return FALSE; + return false; } U32 LLVOTree::getPartitionType() const @@ -1230,7 +1227,7 @@ U32 LLVOTree::getPartitionType() const } LLTreePartition::LLTreePartition(LLViewerRegion* regionp) -: LLSpatialPartition(0, FALSE, regionp) +: LLSpatialPartition(0, false, regionp) { mDrawableType = LLPipeline::RENDER_TYPE_TREE; mPartitionType = LLViewerRegion::PARTITION_TREE; diff --git a/indra/newview/llvotree.h b/indra/newview/llvotree.h index 0facb466dd..b2fc16bd17 100644 --- a/indra/newview/llvotree.h +++ b/indra/newview/llvotree.h @@ -66,7 +66,7 @@ public: /*virtual*/ void updateTextures(); /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); - /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); + /*virtual*/ bool updateGeometry(LLDrawable *drawable); /*virtual*/ void updateSpatialExtents(LLVector4a &min, LLVector4a &max); virtual U32 getPartitionType() const; @@ -107,11 +107,11 @@ public: F32 branches, F32 alpha); - /*virtual*/ BOOL lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, + /*virtual*/ bool lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, S32 face = -1, // which face to check, -1 = ALL_SIDES - BOOL pick_transparent = FALSE, - BOOL pick_rigged = FALSE, - BOOL pick_unselectable = TRUE, + bool pick_transparent = false, + bool pick_rigged = false, + bool pick_unselectable = true, S32* face_hit = NULL, // which face was hit LLVector4a* intersection = NULL, // return the intersection point LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index fe95aa80e3..29c510e7b3 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -89,12 +89,13 @@ #include "llsculptidsize.h" #include "llavatarappearancedefines.h" #include "llgltfmateriallist.h" +#include "gltfscenemanager.h" const F32 FORCE_SIMPLE_RENDER_AREA = 512.f; const F32 FORCE_CULL_AREA = 8.f; U32 JOINT_COUNT_REQUIRED_FOR_FULLRIG = 1; -BOOL gAnimateTextures = TRUE; +bool gAnimateTextures = true; F32 LLVOVolume::sLODFactor = 1.f; F32 LLVOVolume::sLODSlopDistanceFactor = 0.5f; //Changing this to zero, effectively disables the LOD transition slop @@ -105,7 +106,7 @@ S32 LLVOVolume::mRenderComplexity_current = 0; LLPointer<LLObjectMediaDataClient> LLVOVolume::sObjectMediaClient = NULL; LLPointer<LLObjectMediaNavigateClient> LLVOVolume::sObjectMediaNavigateClient = NULL; -extern BOOL gCubeSnapshot; +extern bool gCubeSnapshot; // Implementation class of LLMediaDataClientObject. See llmediadataclient.h class LLMediaDataClientObjectImpl : public LLMediaDataClientObject @@ -216,18 +217,18 @@ LLVOVolume::LLVOVolume(const LLUUID &id, const LLPCode pcode, LLViewerRegion *re mRelativeXform.setIdentity(); mRelativeXformInvTrans.setIdentity(); - mFaceMappingChanged = FALSE; + mFaceMappingChanged = false; mLOD = MIN_LOD; mLODDistance = 0.0f; mLODAdjustedDistance = 0.0f; mLODRadius = 0.0f; mTextureAnimp = NULL; - mVolumeChanged = FALSE; + mVolumeChanged = false; mVObjRadius = LLVector3(1,1,0.5f).length(); mNumFaces = 0; - mLODChanged = FALSE; - mSculptChanged = FALSE; - mColorChanged = FALSE; + mLODChanged = false; + mSculptChanged = false; + mColorChanged = false; mSpotLightPriority = 0.f; mSkinInfoUnavaliable = false; @@ -405,7 +406,7 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys, } gPipeline.markTextured(mDrawable); - mFaceMappingChanged = TRUE; + mFaceMappingChanged = true; mTexAnimMode = 0; } } @@ -439,7 +440,7 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys, if (update_type != OUT_TERSE_IMPROVED) { LLVolumeParams volume_params; - BOOL res = LLVolumeMessage::unpackVolumeParams(&volume_params, *dp); + bool res = LLVolumeMessage::unpackVolumeParams(&volume_params, *dp); if (!res) { LL_WARNS() << "Bogus volume parameters in object " << getID() << LL_ENDL; @@ -509,7 +510,7 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys, } gPipeline.markTextured(mDrawable); - mFaceMappingChanged = TRUE; + mFaceMappingChanged = true; mTexAnimMode = 0; } @@ -600,7 +601,7 @@ void LLVOVolume::animateTextures() { if (!mTexAnimMode) { - mFaceMappingChanged = TRUE; + mFaceMappingChanged = true; gPipeline.markTextured(mDrawable); } mTexAnimMode = result | mTextureAnimp->mMode; @@ -696,7 +697,7 @@ void LLVOVolume::animateTextures() } gPipeline.markTextured(mDrawable); - mFaceMappingChanged = TRUE; + mFaceMappingChanged = true; mTexAnimMode = 0; } } @@ -709,11 +710,11 @@ void LLVOVolume::updateTextures() updateTextureVirtualSize(); } -BOOL LLVOVolume::isVisible() const +bool LLVOVolume::isVisible() const { if(mDrawable.notNull() && mDrawable->isVisible()) { - return TRUE ; + return true ; } if(isAttachment()) @@ -727,7 +728,7 @@ BOOL LLVOVolume::isVisible() const return objp && objp->mDrawable.notNull() && objp->mDrawable->isVisible() ; } - return FALSE ; + return false ; } void LLVOVolume::updateTextureVirtualSize(bool forced) @@ -859,7 +860,7 @@ void LLVOVolume::updateTextureVirtualSize(bool forced) S32 lod = llmin(mLOD, 3); F32 lodf = ((F32)(lod + 1.0f)/4.f); F32 tex_size = lodf * LLViewerTexture::sMaxSculptRez ; - mSculptTexture->addTextureStats(2.f * tex_size * tex_size, FALSE); + mSculptTexture->addTextureStats(2.f * tex_size * tex_size, false); } S32 texture_discard = mSculptTexture->getCachedRawImageLevel(); //try to match the texture @@ -870,7 +871,7 @@ void LLVOVolume::updateTextureVirtualSize(bool forced) current_discard < 0)) //no previous rebuild { gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME); - mSculptChanged = TRUE; + mSculptChanged = true; } if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SCULPTED)) @@ -887,7 +888,7 @@ void LLVOVolume::updateTextureVirtualSize(bool forced) { LLLightImageParams* params = (LLLightImageParams*) getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE); LLUUID id = params->getLightTexture(); - mLightTexture = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE); + mLightTexture = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE); if (mLightTexture.notNull()) { F32 rad = getLightRadius(); @@ -917,14 +918,14 @@ void LLVOVolume::updateTextureVirtualSize(bool forced) } } -BOOL LLVOVolume::isActive() const +bool LLVOVolume::isActive() const { return !mStatic; } -BOOL LLVOVolume::setMaterial(const U8 material) +bool LLVOVolume::setMaterial(const U8 material) { - BOOL res = LLViewerObject::setMaterial(material); + bool res = LLViewerObject::setMaterial(material); return res; } @@ -935,7 +936,7 @@ void LLVOVolume::setTexture(const S32 face) gGL.getTexUnit(0)->bind(getTEImage(face)); } -void LLVOVolume::setScale(const LLVector3 &scale, BOOL damped) +void LLVOVolume::setScale(const LLVector3 &scale, bool damped) { if (scale != getScale()) { @@ -994,7 +995,7 @@ LLDrawable *LLVOVolume::createDrawable(LLPipeline *pipeline) if (getIsLight()) { // Add it to the pipeline mLightSet - gPipeline.setLight(mDrawable, TRUE); + gPipeline.setLight(mDrawable, true); } if (isReflectionProbe()) @@ -1009,7 +1010,7 @@ LLDrawable *LLVOVolume::createDrawable(LLPipeline *pipeline) return mDrawable; } -BOOL LLVOVolume::setVolume(const LLVolumeParams ¶ms_in, const S32 detail, bool unique_volume) +bool LLVOVolume::setVolume(const LLVolumeParams ¶ms_in, const S32 detail, bool unique_volume) { LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME; LLVolumeParams volume_params = params_in; @@ -1017,7 +1018,7 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams ¶ms_in, const S32 detail, bo S32 last_lod = mVolumep.notNull() ? LLVolumeLODGroup::getVolumeDetailFromScale(mVolumep->getDetail()) : -1; S32 lod = mLOD; - BOOL is404 = FALSE; + bool is404 = false; if (isSculpted()) { @@ -1029,7 +1030,7 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams ¶ms_in, const S32 detail, bo lod = gMeshRepo.getActualMeshLOD(volume_params, lod); if (lod == -1) { - is404 = TRUE; + is404 = true; lod = 0; } } @@ -1040,7 +1041,7 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams ¶ms_in, const S32 detail, bo bool is_flexible = (volume_params.getPathParams().getCurveType() == LL_PCODE_PATH_FLEXIBLE); if (is_flexible) { - setParameterEntryInUse(LLNetworkData::PARAMS_FLEXIBLE, TRUE, false); + setParameterEntryInUse(LLNetworkData::PARAMS_FLEXIBLE, true, false); if (!mVolumeImpl) { LLFlexibleObjectData* data = (LLFlexibleObjectData*)getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE); @@ -1050,7 +1051,7 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams ¶ms_in, const S32 detail, bo else { // Mark the parameter not in use - setParameterEntryInUse(LLNetworkData::PARAMS_FLEXIBLE, FALSE, false); + setParameterEntryInUse(LLNetworkData::PARAMS_FLEXIBLE, false, false); if (mVolumeImpl) { delete mVolumeImpl; @@ -1058,14 +1059,14 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams ¶ms_in, const S32 detail, bo if (mDrawable.notNull()) { // Undo the damage we did to this matrix - mDrawable->updateXform(FALSE); + mDrawable->updateXform(false); } } } if (is404) { - setIcon(LLViewerTextureManager::getFetchedTextureFromFile("icons/Inv_Mesh.png", FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_UI)); + setIcon(LLViewerTextureManager::getFetchedTextureFromFile("icons/Inv_Mesh.png", FTT_LOCAL_FILE, true, LLGLTexture::BOOST_UI)); //render prim proxy when mesh loading attempts give up volume_params.setSculptID(LLUUID::null, LL_SCULPT_TYPE_NONE); @@ -1073,7 +1074,7 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams ¶ms_in, const S32 detail, bo if ((LLPrimitive::setVolume(volume_params, lod, (mVolumeImpl && mVolumeImpl->isVolumeUnique()))) || mSculptChanged) { - mFaceMappingChanged = TRUE; + mFaceMappingChanged = true; if (mVolumeImpl) { @@ -1133,14 +1134,19 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams ¶ms_in, const S32 detail, bo } } - return TRUE; + if ((volume_params.getSculptType() & LL_SCULPT_TYPE_MASK) == LL_SCULPT_TYPE_GLTF) + { // notify GLTFSceneManager about new GLTF object + LL::GLTFSceneManager::instance().addGLTFObject(this, volume_params.getSculptID()); + } + + return true; } else if (NO_LOD == lod) { LLSculptIDSize::instance().resetSizeSum(volume_params.getSculptID()); } - return FALSE; + return false; } void LLVOVolume::updateSculptTexture() @@ -1153,7 +1159,7 @@ void LLVOVolume::updateSculptTexture() LLUUID id = sculpt_params->getSculptTexture(); if (id.notNull()) { - mSculptTexture = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + mSculptTexture = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); } mSkinInfoUnavaliable = false; @@ -1194,7 +1200,7 @@ void LLVOVolume::updateVisualComplexity() void LLVOVolume::notifyMeshLoaded() { - mSculptChanged = TRUE; + mSculptChanged = true; gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_GEOMETRY); if (!mSkinInfo && !mSkinInfoUnavaliable) @@ -1317,6 +1323,8 @@ void LLVOVolume::sculpt() } else { + LLImageDataSharedLock lock(raw_image); + sculpt_height = raw_image->getHeight(); sculpt_width = raw_image->getWidth(); sculpt_components = raw_image->getComponents(); @@ -1398,11 +1406,17 @@ std::string get_debug_object_lod_text(LLVOVolume *rootp) return result; } -BOOL LLVOVolume::calcLOD() +bool LLVOVolume::calcLOD() { if (mDrawable.isNull()) { - return FALSE; + return false; + } + + if (mGLTFAsset != nullptr) + { + // do not calculate LOD for GLTF objects + return false; } S32 cur_detail = 0; @@ -1418,7 +1432,7 @@ BOOL LLVOVolume::calcLOD() // Not sure how this can really happen, but alas it does. Better exit here than crashing. if( !avatar || !avatar->mDrawable ) { - return FALSE; + return false; } distance = avatar->mDrawable->mDistanceWRTCamera; @@ -1446,7 +1460,7 @@ BOOL LLVOVolume::calcLOD() if (distance <= 0.f || radius <= 0.f) { LL_DEBUGS("DynamicBox","CalcLOD") << "avatar distance/radius uninitialized, skipping" << LL_ENDL; - return FALSE; + return false; } } else @@ -1456,7 +1470,7 @@ BOOL LLVOVolume::calcLOD() if (distance <= 0.f || radius <= 0.f) { LL_DEBUGS("DynamicBox","CalcLOD") << "non-avatar distance/radius uninitialized, skipping" << LL_ENDL; - return FALSE; + return false; } } @@ -1546,22 +1560,22 @@ BOOL LLVOVolume::calcLOD() mAppAngle = ll_round((F32) atan2( mDrawable->getRadius(), mDrawable->mDistanceWRTCamera) * RAD_TO_DEG, 0.01f); mLOD = cur_detail; - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLVOVolume::updateLOD() +bool LLVOVolume::updateLOD() { if (mDrawable.isNull()) { - return FALSE; + return false; } LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME; - BOOL lod_changed = FALSE; + bool lod_changed = false; if (!LLSculptIDSize::instance().isUnloaded(getVolume()->getParams().getSculptID())) { @@ -1569,13 +1583,13 @@ BOOL LLVOVolume::updateLOD() } else { - return FALSE; + return false; } if (lod_changed) { gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME); - mLODChanged = TRUE; + mLODChanged = true; } else { @@ -1592,12 +1606,12 @@ BOOL LLVOVolume::updateLOD() return lod_changed; } -BOOL LLVOVolume::setDrawableParent(LLDrawable* parentp) +bool LLVOVolume::setDrawableParent(LLDrawable* parentp) { if (!LLViewerObject::setDrawableParent(parentp)) { // no change in drawable parent - return FALSE; + return false; } if (!mDrawable->isRoot()) @@ -1615,7 +1629,7 @@ BOOL LLVOVolume::setDrawableParent(LLDrawable* parentp) } } - return TRUE; + return true; } void LLVOVolume::updateFaceFlags() @@ -1626,7 +1640,7 @@ void LLVOVolume::updateFaceFlags() LLFace *face = mDrawable->getFace(i); if (face) { - BOOL fullbright = getTE(i)->getFullbright(); + bool fullbright = getTE(i)->getFullbright(); face->clearState(LLFace::FULLBRIGHT | LLFace::HUD_RENDER | LLFace::LIGHT); if (fullbright || (mMaterial == LL_MCODE_LIGHT)) @@ -1645,9 +1659,9 @@ void LLVOVolume::updateFaceFlags() } } -BOOL LLVOVolume::setParent(LLViewerObject* parent) +bool LLVOVolume::setParent(LLViewerObject* parent) { - BOOL ret = FALSE ; + bool ret = false ; LLViewerObject *old_parent = (LLViewerObject*) getParent(); if (parent != old_parent) { @@ -1668,7 +1682,7 @@ void LLVOVolume::regenFaces() { LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME; // remove existing faces - BOOL count_changed = mNumFaces != getNumTEs(); + bool count_changed = mNumFaces != getNumTEs(); if (count_changed) { @@ -1712,17 +1726,17 @@ void LLVOVolume::regenFaces() } } -BOOL LLVOVolume::genBBoxes(BOOL force_global, BOOL should_update_octree_bounds) +bool LLVOVolume::genBBoxes(bool force_global, bool should_update_octree_bounds) { LL_PROFILE_ZONE_SCOPED; - BOOL res = TRUE; + bool res = true; LLVector4a min, max; min.clear(); max.clear(); - BOOL rebuild = mDrawable->isState(LLDrawable::REBUILD_VOLUME | LLDrawable::REBUILD_POSITION | LLDrawable::REBUILD_RIGGED); + bool rebuild = mDrawable->isState(LLDrawable::REBUILD_VOLUME | LLDrawable::REBUILD_POSITION | LLDrawable::REBUILD_RIGGED); if (getRiggedVolume()) { @@ -1758,7 +1772,7 @@ BOOL LLVOVolume::genBBoxes(BOOL force_global, BOOL should_update_octree_bounds) continue; } - BOOL face_res = face->genVolumeBBoxes(*volume, i, + bool face_res = face->genVolumeBBoxes(*volume, i, mRelativeXform, (mVolumeImpl && mVolumeImpl->isVolumeGlobal()) || force_global); res &= face_res; // note that this result is never used @@ -1952,7 +1966,7 @@ void LLVOVolume::updateRelativeXform(bool force_identity) } } -bool LLVOVolume::lodOrSculptChanged(LLDrawable *drawable, BOOL &compiled, BOOL &should_update_octree_bounds) +bool LLVOVolume::lodOrSculptChanged(LLDrawable *drawable, bool &compiled, bool &should_update_octree_bounds) { LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME; bool regen_faces = false; @@ -1983,7 +1997,7 @@ bool LLVOVolume::lodOrSculptChanged(LLDrawable *drawable, BOOL &compiled, BOOL & updateVisualComplexity(); } - compiled = TRUE; + compiled = true; // new_lod > old_lod breaks a feedback loop between LOD updates and // bounding box updates. should_update_octree_bounds = should_update_octree_bounds || mSculptChanged || new_lod > old_lod; @@ -2019,20 +2033,21 @@ bool LLVOVolume::lodOrSculptChanged(LLDrawable *drawable, BOOL &compiled, BOOL & return regen_faces; } -BOOL LLVOVolume::updateGeometry(LLDrawable *drawable) +bool LLVOVolume::updateGeometry(LLDrawable *drawable) { LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME; if (mDrawable->isState(LLDrawable::REBUILD_RIGGED)) { + LL_PROFILE_ZONE_NAMED_CATEGORY_VOLUME("rebuild rigged"); updateRiggedVolume(false); - genBBoxes(FALSE); + genBBoxes(false); mDrawable->clearState(LLDrawable::REBUILD_RIGGED); } if (mVolumeImpl != NULL) { - BOOL res; + bool res; { res = mVolumeImpl->doUpdateGeometry(drawable); } @@ -2050,13 +2065,13 @@ BOOL LLVOVolume::updateGeometry(LLDrawable *drawable) if (mDrawable.isNull()) // Not sure why this is happening, but it is... { - return TRUE; // No update to complete + return true; // No update to complete } - BOOL compiled = FALSE; + bool compiled = false; // This should be true in most cases, unless we're sure no octree update is // needed. - BOOL should_update_octree_bounds = bool(getRiggedVolume()) || mDrawable->isState(LLDrawable::REBUILD_POSITION) || !mDrawable->getSpatialExtents()->isFinite3(); + bool should_update_octree_bounds = bool(getRiggedVolume()) || mDrawable->isState(LLDrawable::REBUILD_POSITION) || !mDrawable->getSpatialExtents()->isFinite3(); if (mVolumeChanged || mFaceMappingChanged) { @@ -2072,7 +2087,7 @@ BOOL LLVOVolume::updateGeometry(LLDrawable *drawable) } else if (mSculptChanged || mLODChanged || mColorChanged) { - compiled = TRUE; + compiled = true; was_regen_faces = lodOrSculptChanged(drawable, compiled, should_update_octree_bounds); } @@ -2083,7 +2098,7 @@ BOOL LLVOVolume::updateGeometry(LLDrawable *drawable) else if (mLODChanged || mSculptChanged || mColorChanged) { dirtySpatialGroup(); - compiled = TRUE; + compiled = true; lodOrSculptChanged(drawable, compiled, should_update_octree_bounds); if(drawable->isState(LLDrawable::REBUILD_RIGGED | LLDrawable::RIGGED)) @@ -2094,13 +2109,13 @@ BOOL LLVOVolume::updateGeometry(LLDrawable *drawable) // it has its own drawable (it's moved) or it has changed UVs or it has changed xforms from global<->local else { - compiled = TRUE; + compiled = true; // All it did was move or we changed the texture coordinate offset } // Generate bounding boxes if needed, and update the object's size in the // octree - genBBoxes(FALSE, should_update_octree_bounds); + genBBoxes(false, should_update_octree_bounds); // Update face flags updateFaceFlags(); @@ -2110,11 +2125,11 @@ BOOL LLVOVolume::updateGeometry(LLDrawable *drawable) LLPipeline::sCompiles++; } - mVolumeChanged = FALSE; - mLODChanged = FALSE; - mSculptChanged = FALSE; - mFaceMappingChanged = FALSE; - mColorChanged = FALSE; + mVolumeChanged = false; + mLODChanged = false; + mSculptChanged = false; + mFaceMappingChanged = false; + mColorChanged = false; return LLViewerObject::updateGeometry(drawable); } @@ -2143,13 +2158,13 @@ void LLVOVolume::updateFaceSize(S32 idx) } } -BOOL LLVOVolume::isRootEdit() const +bool LLVOVolume::isRootEdit() const { if (mParent && !((LLViewerObject*)mParent)->isAvatar()) { - return FALSE; + return false; } - return TRUE; + return true; } //virtual @@ -2170,7 +2185,7 @@ void LLVOVolume::setNumTEs(const U8 num_tes) setTE(i, *te) ; mMediaImplList[i] = mMediaImplList[old_num_tes -1] ; } - mMediaImplList[old_num_tes -1]->setUpdated(TRUE) ; + mMediaImplList[old_num_tes -1]->setUpdated(true) ; } } else if(old_num_tes > num_tes && mMediaImplList.size() > num_tes) //old faces removed @@ -2196,23 +2211,23 @@ void LLVOVolume::setNumTEs(const U8 num_tes) //virtual void LLVOVolume::changeTEImage(S32 index, LLViewerTexture* imagep) { - BOOL changed = (mTEImages[index] != imagep); + bool changed = (mTEImages[index] != imagep); LLViewerObject::changeTEImage(index, imagep); if (changed) { gPipeline.markTextured(mDrawable); - mFaceMappingChanged = TRUE; + mFaceMappingChanged = true; } } void LLVOVolume::setTEImage(const U8 te, LLViewerTexture *imagep) { - BOOL changed = (mTEImages[te] != imagep); + bool changed = (mTEImages[te] != imagep); LLViewerObject::setTEImage(te, imagep); if (changed) { gPipeline.markTextured(mDrawable); - mFaceMappingChanged = TRUE; + mFaceMappingChanged = true; } } @@ -2227,7 +2242,7 @@ S32 LLVOVolume::setTETexture(const U8 te, const LLUUID &uuid) shrinkWrap(); gPipeline.markTextured(mDrawable); } - mFaceMappingChanged = TRUE; + mFaceMappingChanged = true; } return res; } @@ -2252,14 +2267,14 @@ S32 LLVOVolume::setTEColor(const U8 te, const LLColor4& color) { gPipeline.markTextured(mDrawable); //treat this alpha change as an LoD update since render batches may need to get rebuilt - mLODChanged = TRUE; + mLODChanged = true; gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME); } retval = LLPrimitive::setTEColor(te, color); if (mDrawable.notNull() && retval) { // These should only happen on updates which are not the initial update. - mColorChanged = TRUE; + mColorChanged = true; mDrawable->setState(LLDrawable::REBUILD_COLOR); shrinkWrap(); dirtyMesh(); @@ -2275,7 +2290,7 @@ S32 LLVOVolume::setTEBumpmap(const U8 te, const U8 bumpmap) if (res) { gPipeline.markTextured(mDrawable); - mFaceMappingChanged = TRUE; + mFaceMappingChanged = true; } return res; } @@ -2286,7 +2301,7 @@ S32 LLVOVolume::setTETexGen(const U8 te, const U8 texgen) if (res) { gPipeline.markTextured(mDrawable); - mFaceMappingChanged = TRUE; + mFaceMappingChanged = true; } return res; } @@ -2297,7 +2312,7 @@ S32 LLVOVolume::setTEMediaTexGen(const U8 te, const U8 media) if (res) { gPipeline.markTextured(mDrawable); - mFaceMappingChanged = TRUE; + mFaceMappingChanged = true; } return res; } @@ -2308,7 +2323,7 @@ S32 LLVOVolume::setTEShiny(const U8 te, const U8 shiny) if (res) { gPipeline.markTextured(mDrawable); - mFaceMappingChanged = TRUE; + mFaceMappingChanged = true; } return res; } @@ -2319,7 +2334,7 @@ S32 LLVOVolume::setTEFullbright(const U8 te, const U8 fullbright) if (res) { gPipeline.markTextured(mDrawable); - mFaceMappingChanged = TRUE; + mFaceMappingChanged = true; } return res; } @@ -2330,7 +2345,7 @@ S32 LLVOVolume::setTEBumpShinyFullbright(const U8 te, const U8 bump) if (res) { gPipeline.markTextured(mDrawable); - mFaceMappingChanged = TRUE; + mFaceMappingChanged = true; } return res; } @@ -2341,7 +2356,7 @@ S32 LLVOVolume::setTEMediaFlags(const U8 te, const U8 media_flags) if (res) { gPipeline.markTextured(mDrawable); - mFaceMappingChanged = TRUE; + mFaceMappingChanged = true; } return res; } @@ -2356,7 +2371,7 @@ S32 LLVOVolume::setTEGlow(const U8 te, const F32 glow) gPipeline.markTextured(mDrawable); shrinkWrap(); } - mFaceMappingChanged = TRUE; + mFaceMappingChanged = true; } return res; } @@ -2396,7 +2411,7 @@ S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) gPipeline.markTextured(mDrawable); gPipeline.markRebuild(mDrawable,LLDrawable::REBUILD_ALL); } - mFaceMappingChanged = TRUE; + mFaceMappingChanged = true; } return res; } @@ -2414,7 +2429,7 @@ S32 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialPa gPipeline.markTextured(mDrawable); gPipeline.markRebuild(mDrawable,LLDrawable::REBUILD_ALL); } - mFaceMappingChanged = TRUE; + mFaceMappingChanged = true; return TEM_CHANGE_TEXTURE; } @@ -2429,7 +2444,7 @@ S32 LLVOVolume::setTEGLTFMaterialOverride(U8 te, LLGLTFMaterial* mat) gPipeline.markTextured(mDrawable); gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL); } - mFaceMappingChanged = TRUE; + mFaceMappingChanged = true; } return retval; @@ -2442,7 +2457,7 @@ S32 LLVOVolume::setTEScale(const U8 te, const F32 s, const F32 t) if (res) { gPipeline.markTextured(mDrawable); - mFaceMappingChanged = TRUE; + mFaceMappingChanged = true; } return res; } @@ -2453,7 +2468,7 @@ S32 LLVOVolume::setTEScaleS(const U8 te, const F32 s) if (res) { gPipeline.markTextured(mDrawable); - mFaceMappingChanged = TRUE; + mFaceMappingChanged = true; } return res; } @@ -2464,7 +2479,7 @@ S32 LLVOVolume::setTEScaleT(const U8 te, const F32 t) if (res) { gPipeline.markTextured(mDrawable); - mFaceMappingChanged = TRUE; + mFaceMappingChanged = true; } return res; } @@ -2923,7 +2938,7 @@ void LLVOVolume::addMediaImpl(LLViewerMediaImpl* media_impl, S32 texture_index) } else //the face is not available now, start media on this face later. { - media_impl->setUpdated(TRUE) ; + media_impl->setUpdated(true) ; } } return ; @@ -2988,7 +3003,7 @@ void LLVOVolume::setLightTextureID(LLUUID id) { if (!hasLightTexture()) { - setParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE, TRUE, true); + setParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE, true, true); } else if (old_texturep) { @@ -3016,7 +3031,7 @@ void LLVOVolume::setLightTextureID(LLUUID id) { old_texturep->removeVolume(LLRender::LIGHT_TEX, this); } - setParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE, FALSE, true); + setParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE, false, true); parameterChanged(LLNetworkData::PARAMS_LIGHT_IMAGE, true); mLightTexture = NULL; } @@ -3032,29 +3047,29 @@ void LLVOVolume::setSpotLightParams(LLVector3 params) } } -void LLVOVolume::setIsLight(BOOL is_light) +void LLVOVolume::setIsLight(bool is_light) { - BOOL was_light = getIsLight(); + bool was_light = getIsLight(); if (is_light != was_light) { if (is_light) { - setParameterEntryInUse(LLNetworkData::PARAMS_LIGHT, TRUE, true); + setParameterEntryInUse(LLNetworkData::PARAMS_LIGHT, true, true); } else { - setParameterEntryInUse(LLNetworkData::PARAMS_LIGHT, FALSE, true); + setParameterEntryInUse(LLNetworkData::PARAMS_LIGHT, false, true); } if (is_light) { // Add it to the pipeline mLightSet - gPipeline.setLight(mDrawable, TRUE); + gPipeline.setLight(mDrawable, true); } else { // Not a light. Remove it from the pipeline's light set. - gPipeline.setLight(mDrawable, FALSE); + gPipeline.setLight(mDrawable, false); } } } @@ -3074,7 +3089,7 @@ void LLVOVolume::setLightLinearColor(const LLColor3& color) param_block->setLinearColor(LLColor4(color, param_block->getLinearColor().mV[3])); parameterChanged(LLNetworkData::PARAMS_LIGHT, true); gPipeline.markTextured(mDrawable); - mFaceMappingChanged = TRUE; + mFaceMappingChanged = true; } } } @@ -3133,7 +3148,7 @@ void LLVOVolume::setLightCutoff(F32 cutoff) //---------------------------------------------------------------------------- -BOOL LLVOVolume::getIsLight() const +bool LLVOVolume::getIsLight() const { mIsLight = getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT); return mIsLight; @@ -3261,7 +3276,7 @@ LLViewerTexture* LLVOVolume::getLightTexture() { if (mLightTexture.isNull() || id != mLightTexture->getID()) { - mLightTexture = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE); + mLightTexture = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE); } } else @@ -3324,23 +3339,23 @@ F32 LLVOVolume::getLightCutoff() const } } -BOOL LLVOVolume::isReflectionProbe() const +bool LLVOVolume::isReflectionProbe() const { return getParameterEntryInUse(LLNetworkData::PARAMS_REFLECTION_PROBE); } -bool LLVOVolume::setIsReflectionProbe(BOOL is_probe) +bool LLVOVolume::setIsReflectionProbe(bool is_probe) { - BOOL was_probe = isReflectionProbe(); + bool was_probe = isReflectionProbe(); if (is_probe != was_probe) { if (is_probe) { - setParameterEntryInUse(LLNetworkData::PARAMS_REFLECTION_PROBE, TRUE, true); + setParameterEntryInUse(LLNetworkData::PARAMS_REFLECTION_PROBE, true, true); } else { - setParameterEntryInUse(LLNetworkData::PARAMS_REFLECTION_PROBE, FALSE, true); + setParameterEntryInUse(LLNetworkData::PARAMS_REFLECTION_PROBE, false, true); } } @@ -3506,7 +3521,7 @@ U32 LLVOVolume::getVolumeInterfaceID() const return 0; } -BOOL LLVOVolume::isFlexible() const +bool LLVOVolume::isFlexible() const { if (getParameterEntryInUse(LLNetworkData::PARAMS_FLEXIBLE)) { @@ -3517,25 +3532,25 @@ BOOL LLVOVolume::isFlexible() const U8 profile_and_hole = volume_params.getProfileParams().getCurveType(); volume_params.setType(profile_and_hole, LL_PCODE_PATH_FLEXIBLE); } - return TRUE; + return true; } else { - return FALSE; + return false; } } -BOOL LLVOVolume::isSculpted() const +bool LLVOVolume::isSculpted() const { if (getParameterEntryInUse(LLNetworkData::PARAMS_SCULPT)) { - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLVOVolume::isMesh() const +bool LLVOVolume::isMesh() const { if (isSculpted()) { @@ -3545,21 +3560,21 @@ BOOL LLVOVolume::isMesh() const if ((sculpt_type & LL_SCULPT_TYPE_MASK) == LL_SCULPT_TYPE_MESH) // mesh is a mesh { - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL LLVOVolume::hasLightTexture() const +bool LLVOVolume::hasLightTexture() const { if (getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE)) { - return TRUE; + return true; } - return FALSE; + return false; } bool LLVOVolume::isFlexibleFast() const @@ -3587,30 +3602,31 @@ bool LLVOVolume::isAnimatedObjectFast() const return mIsAnimatedObject; } -BOOL LLVOVolume::isVolumeGlobal() const +bool LLVOVolume::isVolumeGlobal() const { if (mVolumeImpl) { - return mVolumeImpl->isVolumeGlobal() ? TRUE : FALSE; + return mVolumeImpl->isVolumeGlobal(); } - else if (mRiggedVolume.notNull()) + + if (mRiggedVolume.notNull()) { - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLVOVolume::canBeFlexible() const +bool LLVOVolume::canBeFlexible() const { U8 path = getVolume()->getParams().getPathParams().getCurveType(); return (path == LL_PCODE_PATH_FLEXIBLE || path == LL_PCODE_PATH_LINE); } -BOOL LLVOVolume::setIsFlexible(BOOL is_flexible) +bool LLVOVolume::setIsFlexible(bool is_flexible) { - BOOL res = FALSE; - BOOL was_flexible = isFlexible(); + bool res = false; + bool was_flexible = isFlexible(); LLVolumeParams volume_params; if (is_flexible) { @@ -3619,10 +3635,10 @@ BOOL LLVOVolume::setIsFlexible(BOOL is_flexible) volume_params = getVolume()->getParams(); U8 profile_and_hole = volume_params.getProfileParams().getCurveType(); volume_params.setType(profile_and_hole, LL_PCODE_PATH_FLEXIBLE); - res = TRUE; - setFlags(FLAGS_USE_PHYSICS, FALSE); - setFlags(FLAGS_PHANTOM, TRUE); - setParameterEntryInUse(LLNetworkData::PARAMS_FLEXIBLE, TRUE, true); + res = true; + setFlags(FLAGS_USE_PHYSICS, false); + setFlags(FLAGS_PHANTOM, true); + setParameterEntryInUse(LLNetworkData::PARAMS_FLEXIBLE, true, true); if (mDrawable) { mDrawable->makeActive(); @@ -3636,9 +3652,9 @@ BOOL LLVOVolume::setIsFlexible(BOOL is_flexible) volume_params = getVolume()->getParams(); U8 profile_and_hole = volume_params.getProfileParams().getCurveType(); volume_params.setType(profile_and_hole, LL_PCODE_PATH_LINE); - res = TRUE; - setFlags(FLAGS_PHANTOM, FALSE); - setParameterEntryInUse(LLNetworkData::PARAMS_FLEXIBLE, FALSE, true); + res = true; + setFlags(FLAGS_PHANTOM, false); + setParameterEntryInUse(LLNetworkData::PARAMS_FLEXIBLE, false, true); } } if (res) @@ -3665,7 +3681,7 @@ const LLMeshSkinInfo* LLVOVolume::getSkinInfo() const } // virtual -BOOL LLVOVolume::isRiggedMesh() const +bool LLVOVolume::isRiggedMesh() const { return isMesh() && getSkinInfo(); } @@ -3884,7 +3900,7 @@ void LLVOVolume::generateSilhouette(LLSelectNode* nodep, const LLVector3& view_p volume->generateSilhouetteVertices(nodep->mSilhouetteVertices, nodep->mSilhouetteNormals, view_vector, trans_mat, mRelativeXformInvTrans, nodep->getTESelectMask()); - nodep->mSilhouetteExists = TRUE; + nodep->mSilhouetteExists = true; } } @@ -3911,12 +3927,12 @@ void LLVOVolume::updateRadius() } -BOOL LLVOVolume::isAttachment() const +bool LLVOVolume::isAttachment() const { return mAttachmentState != 0 ; } -BOOL LLVOVolume::isHUDAttachment() const +bool LLVOVolume::isHUDAttachment() const { // *NOTE: we assume hud attachment points are in defined range // since this range is constant for backwards compatibility @@ -4021,7 +4037,7 @@ U32 LLVOVolume::getRenderCost(texture_cost_t &textures) const U32 media_faces = 0; const LLDrawable* drawablep = mDrawable; - U32 num_faces = drawablep->getNumFaces(); + S32 num_faces = drawablep->getNumFaces(); const LLVolumeParams& volume_params = getVolume()->getParams(); @@ -4377,7 +4393,7 @@ void LLVOVolume::parameterChanged(U16 param_type, bool local_origin) LLViewerObject::parameterChanged(param_type, local_origin); } -void LLVOVolume::parameterChanged(U16 param_type, LLNetworkData* data, BOOL in_use, bool local_origin) +void LLVOVolume::parameterChanged(U16 param_type, LLNetworkData* data, bool in_use, bool local_origin) { LLViewerObject::parameterChanged(param_type, data, in_use, local_origin); if (mVolumeImpl) @@ -4401,7 +4417,7 @@ void LLVOVolume::parameterChanged(U16 param_type, LLNetworkData* data, BOOL in_u } if (mDrawable.notNull()) { - BOOL is_light = getIsLight(); + bool is_light = getIsLight(); if (is_light != mDrawable->isState(LLDrawable::LIGHT)) { gPipeline.setLight(mDrawable, is_light); @@ -4442,7 +4458,7 @@ void LLVOVolume::updateReflectionProbePtr() } } -void LLVOVolume::setSelected(BOOL sel) +void LLVOVolume::setSelected(bool sel) { LLViewerObject::setSelected(sel); if (isAnimatedObject()) @@ -4478,7 +4494,7 @@ F32 LLVOVolume::getBinRadius() //const LLVector4a* ext = mDrawable->getSpatialExtents(); bool shrink_wrap = mShouldShrinkWrap || mDrawable->isAnimating(); - bool alpha_wrap = FALSE; + bool alpha_wrap = false; if (!isHUDAttachment() && mDrawable->mDistanceWRTCamera < alpha_distance_factor[2]) { @@ -4489,14 +4505,14 @@ F32 LLVOVolume::getBinRadius() if (face->isInAlphaPool() && !face->canRenderAsMask()) { - alpha_wrap = TRUE; + alpha_wrap = true; break; } } } else { - shrink_wrap = FALSE; + shrink_wrap = false; } if (alpha_wrap) @@ -4558,7 +4574,7 @@ void LLVOVolume::markForUpdate() } LLViewerObject::markForUpdate(); - mVolumeChanged = TRUE; + mVolumeChanged = true; } LLVector3 LLVOVolume::agentPositionToVolume(const LLVector3& pos) const @@ -4612,31 +4628,31 @@ LLVector3 LLVOVolume::volumeDirectionToAgent(const LLVector3& dir) const } -BOOL LLVOVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, S32 face, BOOL pick_transparent, BOOL pick_rigged, BOOL pick_unselectable, S32 *face_hitp, - LLVector4a* intersection,LLVector2* tex_coord, LLVector4a* normal, LLVector4a* tangent) +bool LLVOVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, S32 face, bool pick_transparent, bool pick_rigged, bool pick_unselectable, S32 *face_hitp, + LLVector4a* intersection,LLVector2* tex_coord, LLVector4a* normal, LLVector4a* tangent) { if (!mbCanSelect || mDrawable->isDead() || !gPipeline.hasRenderType(mDrawable->getRenderType())) { - return FALSE; + return false; } if (!pick_unselectable) { - if (!LLSelectMgr::instance().canSelectObject(this, TRUE)) + if (!LLSelectMgr::instance().canSelectObject(this, true)) { - return FALSE; + return false; } } if (getClickAction() == CLICK_ACTION_IGNORE && !LLFloater::isVisible(gFloaterTools)) { - return FALSE; + return false; } - BOOL ret = FALSE; + bool ret = false; LLVolume* volume = getVolume(); @@ -4652,7 +4668,7 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& } else { //cannot pick rigged attachments on other avatars or when not in build mode - return FALSE; + return false; } } @@ -4755,8 +4771,8 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& } } - BOOL no_texture = !face->getTexture() || !face->getTexture()->hasGLTexture(); - BOOL mask = no_texture ? FALSE : face->getTexture()->getMask(face->surfaceToTexture(tc, p, n)); + bool no_texture = !face->getTexture() || !face->getTexture()->hasGLTexture(); + bool mask = no_texture ? false : face->getTexture()->getMask(face->surfaceToTexture(tc, p, n)); if (face && (ignore_alpha || pick_transparent || no_texture || mask)) { @@ -4821,7 +4837,7 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& *tex_coord = tc; } - ret = TRUE; + ret = true; } } } @@ -5006,7 +5022,7 @@ void LLRiggedVolume::update( else #endif { - for (U32 j = 0; j < dst_face.mNumVertices; ++j) + for (S32 j = 0; j < dst_face.mNumVertices; ++j) { LLMatrix4a final_mat; LLSkinningUtil::getPerVertexSkinMatrix(weight[j].getF32ptr(), mat, false, final_mat, max_joints); @@ -5033,7 +5049,7 @@ void LLRiggedVolume::update( box_max = max; } - for (U32 j = 1; j < dst_face.mNumVertices; ++j) + for (S32 j = 1; j < dst_face.mNumVertices; ++j) { min.setMin(min, pos[j]); max.setMax(max, pos[j]); @@ -5079,21 +5095,21 @@ U32 LLVOVolume::getPartitionType() const } LLVolumePartition::LLVolumePartition(LLViewerRegion* regionp) -: LLSpatialPartition(LLVOVolume::VERTEX_DATA_MASK, TRUE, regionp), +: LLSpatialPartition(LLVOVolume::VERTEX_DATA_MASK, true, regionp), LLVolumeGeometryManager() { mLODPeriod = 32; - mDepthMask = FALSE; + mDepthMask = false; mDrawableType = LLPipeline::RENDER_TYPE_VOLUME; mPartitionType = LLViewerRegion::PARTITION_VOLUME; mSlopRatio = 0.25f; } LLVolumeBridge::LLVolumeBridge(LLDrawable* drawablep, LLViewerRegion* regionp) -: LLSpatialBridge(drawablep, TRUE, LLVOVolume::VERTEX_DATA_MASK, regionp), +: LLSpatialBridge(drawablep, true, LLVOVolume::VERTEX_DATA_MASK, regionp), LLVolumeGeometryManager() { - mDepthMask = FALSE; + mDepthMask = false; mLODPeriod = 32; mDrawableType = LLPipeline::RENDER_TYPE_VOLUME; mPartitionType = LLViewerRegion::PARTITION_BRIDGE; @@ -5115,30 +5131,6 @@ LLControlAVBridge::LLControlAVBridge(LLDrawable* drawablep, LLViewerRegion* regi mPartitionType = LLViewerRegion::PARTITION_CONTROL_AV; } -void LLControlAVBridge::updateSpatialExtents() -{ - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE - - LLSpatialGroup* root = (LLSpatialGroup*)mOctree->getListener(0); - - bool rootWasDirty = root->isDirty(); - - super::updateSpatialExtents(); // root becomes non-dirty here - - // SL-18251 "On-screen animesh characters using pelvis offset animations - // disappear when root goes off-screen" - // - // Expand extents to include Control Avatar placed outside of the bounds - LLControlAvatar* controlAvatar = getVObj() ? getVObj()->getControlAvatar() : NULL; - if (controlAvatar - && controlAvatar->mDrawable - && controlAvatar->mDrawable->getEntry() - && (rootWasDirty || controlAvatar->mPlaying)) - { - root->expandExtents(controlAvatar->mDrawable->getSpatialExtents(), *mDrawable->getXform()); - } -} - bool can_batch_texture(LLFace* facep) { if (facep->getTextureEntry()->getBumpmap()) @@ -5276,7 +5268,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, //add face to drawmap LLSpatialGroup::drawmap_elem_t& draw_vec = group->mDrawMap[passType]; - S32 idx = draw_vec.size()-1; + S32 idx = static_cast<S32>(draw_vec.size()) - 1; bool fullbright = (type == LLRenderPass::PASS_FULLBRIGHT) || (type == LLRenderPass::PASS_INVISIBLE) || @@ -5360,7 +5352,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, if (mat) { - BOOL is_alpha = (facep->getPoolType() == LLDrawPool::POOL_ALPHA) || (te->getColor().mV[3] < 0.999f) ? TRUE : FALSE; + bool is_alpha = (facep->getPoolType() == LLDrawPool::POOL_ALPHA) || (te->getColor().mV[3] < 0.999f); if (type == LLRenderPass::PASS_ALPHA) { shader_mask = mat->getShaderMask(LLMaterial::DIFFUSE_ALPHA_MODE_BLEND, is_alpha); @@ -5644,7 +5636,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) LLVOVolume* vobj = drawablep->getVOVolume(); - if (!vobj || vobj->isDead()) + if (!vobj || vobj->isDead() || vobj->mGLTFAsset) { continue; } @@ -5825,7 +5817,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) } } - BOOL force_simple = (facep->getPixelArea() < FORCE_SIMPLE_RENDER_AREA); + bool force_simple = (facep->getPixelArea() < FORCE_SIMPLE_RENDER_AREA); U32 type = gPipeline.getPoolTypeFromTE(te, tex); if (is_pbr && gltf_mat && gltf_mat->mAlphaMode != LLGLTFMaterial::ALPHA_MODE_BLEND) { @@ -6010,7 +6002,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) pbr_mask = pbr_mask | LLVertexBuffer::MAP_EMISSIVE; } - BOOL batch_textures = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 1; + bool batch_textures = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 1; // add extra vertex data for deferred rendering (not necessarily for batching textures) if (batch_textures) @@ -6027,22 +6019,22 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) // generate render batches for static geometry U32 extra_mask = LLVertexBuffer::MAP_TEXTURE_INDEX; - BOOL alpha_sort = TRUE; - BOOL rigged = FALSE; + bool alpha_sort = true; + bool rigged = false; for (int i = 0; i < 2; ++i) //two sets, static and rigged) { - geometryBytes += genDrawInfo(group, simple_mask | extra_mask, sSimpleFaces[i], simple_count[i], FALSE, batch_textures, rigged); - geometryBytes += genDrawInfo(group, fullbright_mask | extra_mask, sFullbrightFaces[i], fullbright_count[i], FALSE, batch_textures, rigged); + geometryBytes += genDrawInfo(group, simple_mask | extra_mask, sSimpleFaces[i], simple_count[i], false, batch_textures, rigged); + geometryBytes += genDrawInfo(group, fullbright_mask | extra_mask, sFullbrightFaces[i], fullbright_count[i], false, batch_textures, rigged); geometryBytes += genDrawInfo(group, alpha_mask | extra_mask, sAlphaFaces[i], alpha_count[i], alpha_sort, batch_textures, rigged); - geometryBytes += genDrawInfo(group, bump_mask | extra_mask, sBumpFaces[i], bump_count[i], FALSE, FALSE, rigged); - geometryBytes += genDrawInfo(group, norm_mask | extra_mask, sNormFaces[i], norm_count[i], FALSE, FALSE, rigged); - geometryBytes += genDrawInfo(group, spec_mask | extra_mask, sSpecFaces[i], spec_count[i], FALSE, FALSE, rigged); - geometryBytes += genDrawInfo(group, normspec_mask | extra_mask, sNormSpecFaces[i], normspec_count[i], FALSE, FALSE, rigged); - geometryBytes += genDrawInfo(group, pbr_mask | extra_mask, sPbrFaces[i], pbr_count[i], FALSE, FALSE, rigged); + geometryBytes += genDrawInfo(group, bump_mask | extra_mask, sBumpFaces[i], bump_count[i], false, false, rigged); + geometryBytes += genDrawInfo(group, norm_mask | extra_mask, sNormFaces[i], norm_count[i], false, false, rigged); + geometryBytes += genDrawInfo(group, spec_mask | extra_mask, sSpecFaces[i], spec_count[i], false, false, rigged); + geometryBytes += genDrawInfo(group, normspec_mask | extra_mask, sNormSpecFaces[i], normspec_count[i], false, false, rigged); + geometryBytes += genDrawInfo(group, pbr_mask | extra_mask, sPbrFaces[i], pbr_count[i], false, false, rigged); // for rigged set, add weights and disable alpha sorting (rigged items use depth buffer) extra_mask |= LLVertexBuffer::MAP_WEIGHT4; - rigged = TRUE; + rigged = true; } group->mGeometryBytes = geometryBytes; @@ -6212,7 +6204,7 @@ struct CompareBatchBreakerRigged } }; -U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace** faces, U32 face_count, BOOL distance_sort, BOOL batch_textures, BOOL rigged) +U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace** faces, U32 face_count, bool distance_sort, bool batch_textures, bool rigged) { LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME; @@ -6492,11 +6484,11 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace //append face to appropriate render batch - BOOL force_simple = facep->getPixelArea() < FORCE_SIMPLE_RENDER_AREA; - BOOL fullbright = facep->isState(LLFace::FULLBRIGHT); + bool force_simple = facep->getPixelArea() < FORCE_SIMPLE_RENDER_AREA; + bool fullbright = facep->isState(LLFace::FULLBRIGHT); if ((mask & LLVertexBuffer::MAP_NORMAL) == 0) { //paranoia check to make sure GL doesn't try to read non-existant normals - fullbright = TRUE; + fullbright = true; } const LLTextureEntry* te = facep->getTextureEntry(); @@ -6504,12 +6496,12 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace if (hud_group && gltf_mat == nullptr) { //all hud attachments are fullbright - fullbright = TRUE; + fullbright = true; } tex = facep->getTexture(); - BOOL is_alpha = (facep->getPoolType() == LLDrawPool::POOL_ALPHA) ? TRUE : FALSE; + bool is_alpha = facep->getPoolType() == LLDrawPool::POOL_ALPHA; LLMaterial* mat = nullptr; bool can_be_shiny = false; @@ -6535,7 +6527,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace if (!gltf_mat) { - is_alpha = (is_alpha || blinn_phong_transparent) ? TRUE : FALSE; + is_alpha |= blinn_phong_transparent; } if (gltf_mat || (mat && !hud_group)) diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index 44a964a363..07e02e042c 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -85,11 +85,11 @@ public: virtual ~LLVolumeInterface() { } virtual LLVolumeInterfaceType getInterfaceType() const = 0; virtual void doIdleUpdate() = 0; - virtual BOOL doUpdateGeometry(LLDrawable *drawable) = 0; + virtual bool doUpdateGeometry(LLDrawable *drawable) = 0; virtual LLVector3 getPivotPosition() const = 0; virtual void onSetVolume(const LLVolumeParams &volume_params, const S32 detail) = 0; - virtual void onSetScale(const LLVector3 &scale, BOOL damped) = 0; - virtual void onParameterChanged(U16 param_type, LLNetworkData *data, BOOL in_use, bool local_origin) = 0; + virtual void onSetScale(const LLVector3 &scale, bool damped) = 0; + virtual void onParameterChanged(U16 param_type, LLNetworkData *data, bool in_use, bool local_origin) = 0; virtual void onShift(const LLVector4a &shift_vector) = 0; virtual bool isVolumeUnique() const = 0; // Do we need a unique LLVolume instance? virtual bool isVolumeGlobal() const = 0; // Are we in global space? @@ -131,16 +131,16 @@ public: void animateTextures(); - BOOL isVisible() const ; - BOOL isActive() const override; - BOOL isAttachment() const override; - BOOL isRootEdit() const override; // overridden for sake of attachments treating themselves as a root object - BOOL isHUDAttachment() const override; + bool isVisible() const ; + bool isActive() const override; + bool isAttachment() const override; + bool isRootEdit() const override; // overridden for sake of attachments treating themselves as a root object + bool isHUDAttachment() const override; void generateSilhouette(LLSelectNode* nodep, const LLVector3& view_point); - /*virtual*/ BOOL setParent(LLViewerObject* parent) override; + /*virtual*/ bool setParent(LLViewerObject* parent) override; S32 getLOD() const override { return mLOD; } - void setNoLOD() { mLOD = NO_LOD; mLODChanged = TRUE; } + void setNoLOD() { mLOD = NO_LOD; mLODChanged = true; } bool isNoLOD() const { return NO_LOD == mLOD; } const LLVector3 getPivotPositionAgent() const override; const LLMatrix4& getRelativeXform() const { return mRelativeXform; } @@ -156,11 +156,11 @@ public: /*virtual*/ U32 getTriangleCount(S32* vcount = NULL) const override; /*virtual*/ U32 getHighLODTriangleCount() override; - /*virtual*/ BOOL lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, + /*virtual*/ bool lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, S32 face = -1, // which face to check, -1 = ALL_SIDES - BOOL pick_transparent = FALSE, - BOOL pick_rigged = FALSE, - BOOL pick_unselectable = TRUE, + bool pick_transparent = false, + bool pick_rigged = false, + bool pick_unselectable = true, S32* face_hit = NULL, // which face was hit LLVector4a* intersection = NULL, // return the intersection point LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point @@ -174,18 +174,18 @@ public: LLVector3 volumeDirectionToAgent(const LLVector3& dir) const; - BOOL getVolumeChanged() const { return mVolumeChanged; } + bool getVolumeChanged() const { return mVolumeChanged; } F32 getVObjRadius() const override { return mVObjRadius; }; const LLMatrix4& getWorldMatrix(LLXformMatrix* xform) const override; void markForUpdate() override; - void faceMappingChanged() override { mFaceMappingChanged=TRUE; } + void faceMappingChanged() override { mFaceMappingChanged=true; } /*virtual*/ void onShift(const LLVector4a &shift_vector) override; // Called when the drawable shifts /*virtual*/ void parameterChanged(U16 param_type, bool local_origin) override; - /*virtual*/ void parameterChanged(U16 param_type, LLNetworkData* data, BOOL in_use, bool local_origin) override; + /*virtual*/ void parameterChanged(U16 param_type, LLNetworkData* data, bool in_use, bool local_origin) override; // update mReflectionProbe based on isReflectionProbe() void updateReflectionProbePtr(); @@ -195,10 +195,10 @@ public: U32 block_num, const EObjectUpdateType update_type, LLDataPacker *dp) override; - /*virtual*/ void setSelected(BOOL sel) override; - /*virtual*/ BOOL setDrawableParent(LLDrawable* parentp) override; + /*virtual*/ void setSelected(bool sel) override; + /*virtual*/ bool setDrawableParent(LLDrawable* parentp) override; - /*virtual*/ void setScale(const LLVector3 &scale, BOOL damped) override; + /*virtual*/ void setScale(const LLVector3 &scale, bool damped) override; /*virtual*/ void changeTEImage(S32 index, LLViewerTexture* new_image) override; /*virtual*/ void setNumTEs(const U8 num_tes) override; @@ -223,11 +223,11 @@ public: /*virtual*/ S32 setTEScaleT(const U8 te, const F32 t) override; /*virtual*/ S32 setTETexGen(const U8 te, const U8 texgen) override; /*virtual*/ S32 setTEMediaTexGen(const U8 te, const U8 media) override; - /*virtual*/ BOOL setMaterial(const U8 material) override; + /*virtual*/ bool setMaterial(const U8 material) override; void setTexture(const S32 face); S32 getIndexInTex(U32 ch) const {return mIndexInTex[ch];} - /*virtual*/ BOOL setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume = false) override; + /*virtual*/ bool setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume = false) override; void updateSculptTexture(); void setIndexInTex(U32 ch, S32 index) { mIndexInTex[ch] = index ;} void sculpt(); @@ -236,16 +236,16 @@ public: void* user_data, S32 status, LLExtStat ext_status); void updateRelativeXform(bool force_identity = false); - /*virtual*/ BOOL updateGeometry(LLDrawable *drawable) override; + /*virtual*/ bool updateGeometry(LLDrawable *drawable) override; /*virtual*/ void updateFaceSize(S32 idx) override; - /*virtual*/ BOOL updateLOD() override; + /*virtual*/ bool updateLOD() override; void updateRadius() override; /*virtual*/ void updateTextures() override; void updateTextureVirtualSize(bool forced = false); void updateFaceFlags(); void regenFaces(); - BOOL genBBoxes(BOOL force_global, BOOL should_update_octree_bounds = TRUE); + bool genBBoxes(bool force_global, bool should_update_octree_bounds = true); void preRebuild(); virtual void updateSpatialExtents(LLVector4a& min, LLVector4a& max) override; virtual F32 getBinRadius() override; @@ -253,7 +253,7 @@ public: virtual U32 getPartitionType() const override; // For Lights - void setIsLight(BOOL is_light); + void setIsLight(bool is_light); //set the gamma-corrected (sRGB) color of this light void setLightSRGBColor(const LLColor3& color); //set the linear color of this light @@ -266,7 +266,7 @@ public: void setLightTextureID(LLUUID id); void setSpotLightParams(LLVector3 params); - BOOL getIsLight() const; + bool getIsLight() const; bool getIsLightFast() const; @@ -296,27 +296,27 @@ public: F32 getLightCutoff() const; // Reflection Probes - bool setIsReflectionProbe(BOOL is_probe); + bool setIsReflectionProbe(bool is_probe); bool setReflectionProbeAmbiance(F32 ambiance); bool setReflectionProbeNearClip(F32 near_clip); bool setReflectionProbeIsBox(bool is_box); bool setReflectionProbeIsDynamic(bool is_dynamic); bool setReflectionProbeIsMirror(bool is_mirror); - BOOL isReflectionProbe() const override; + bool isReflectionProbe() const override; F32 getReflectionProbeAmbiance() const; F32 getReflectionProbeNearClip() const; - bool getReflectionProbeIsBox() const; + bool getReflectionProbeIsBox() const override; bool getReflectionProbeIsDynamic() const; bool getReflectionProbeIsMirror() const; // Flexible Objects U32 getVolumeInterfaceID() const; - virtual BOOL isFlexible() const override; - virtual BOOL isSculpted() const override; - virtual BOOL isMesh() const override; - virtual BOOL isRiggedMesh() const override; - virtual BOOL hasLightTexture() const override; + virtual bool isFlexible() const override; + virtual bool isSculpted() const override; + virtual bool isMesh() const override; + virtual bool isRiggedMesh() const override; + virtual bool hasLightTexture() const override; // fast variants above that use state that is filled in later // not reliable early in the life of an object, but should be used after @@ -327,9 +327,9 @@ public: bool isRiggedMeshFast() const; bool isAnimatedObjectFast() const; - BOOL isVolumeGlobal() const; - BOOL canBeFlexible() const; - BOOL setIsFlexible(BOOL is_flexible); + bool isVolumeGlobal() const; + bool canBeFlexible() const; + bool setIsFlexible(bool is_flexible); const LLMeshSkinInfo* getSkinInfo() const; const bool isSkinInfoUnavaliable() const { return mSkinInfoUnavaliable; } @@ -422,7 +422,7 @@ public: protected: S32 computeLODDetail(F32 distance, F32 radius, F32 lod_factor); - BOOL calcLOD(); + bool calcLOD(); LLFace* addFace(S32 face_index); // stats tracking for render complexity @@ -436,7 +436,7 @@ protected: void removeMediaImpl(S32 texture_index) ; private: - bool lodOrSculptChanged(LLDrawable *drawable, BOOL &compiled, BOOL &shouldUpdateOctreeBounds); + bool lodOrSculptChanged(LLDrawable *drawable, bool &compiled, bool &shouldUpdateOctreeBounds); public: @@ -452,16 +452,16 @@ private: friend class LLDrawable; friend class LLFace; - BOOL mFaceMappingChanged; + bool mFaceMappingChanged; LLFrameTimer mTextureUpdateTimer; S32 mLOD; - BOOL mLODChanged; - BOOL mSculptChanged; - BOOL mColorChanged; + bool mLODChanged; + bool mSculptChanged; + bool mColorChanged; F32 mSpotLightPriority; LLMatrix4 mRelativeXform; LLMatrix3 mRelativeXformInvTrans; - BOOL mVolumeChanged; + bool mVolumeChanged; F32 mVObjRadius; LLVolumeInterface *mVolumeImpl; LLPointer<LLViewerFetchedTexture> mSculptTexture; diff --git a/indra/newview/llvowater.cpp b/indra/newview/llvowater.cpp index b2af6c70d3..34040e1aca 100644 --- a/indra/newview/llvowater.cpp +++ b/indra/newview/llvowater.cpp @@ -56,11 +56,11 @@ LLVOWater::LLVOWater(const LLUUID &id, mRenderType(LLPipeline::RENDER_TYPE_WATER) { // Terrain must draw during selection passes so it can block objects behind it. - mbCanSelect = FALSE; + mbCanSelect = false; setScale(LLVector3(256.f, 256.f, 0.f)); // Hack for setting scale for bounding boxes/visibility. - mUseTexture = TRUE; - mIsEdgePatch = FALSE; + mUseTexture = true; + mIsEdgePatch = false; } @@ -70,9 +70,9 @@ void LLVOWater::markDead() } -BOOL LLVOWater::isActive() const +bool LLVOWater::isActive() const { - return FALSE; + return false; } @@ -96,7 +96,7 @@ void LLVOWater::idleUpdate(LLAgent &agent, const F64 &time) LLDrawable *LLVOWater::createDrawable(LLPipeline *pipeline) { pipeline->allocDrawable(this); - mDrawable->setLit(FALSE); + mDrawable->setLit(false); mDrawable->setRenderType(mRenderType); LLDrawPoolWater *pool = (LLDrawPoolWater*) gPipeline.getPool(LLDrawPool::POOL_WATER); @@ -113,7 +113,7 @@ LLDrawable *LLVOWater::createDrawable(LLPipeline *pipeline) return mDrawable; } -BOOL LLVOWater::updateGeometry(LLDrawable *drawable) +bool LLVOWater::updateGeometry(LLDrawable *drawable) { LL_PROFILE_ZONE_SCOPED; LLFace *face; @@ -126,7 +126,7 @@ BOOL LLVOWater::updateGeometry(LLDrawable *drawable) face = drawable->getFace(0); if (!face) { - return TRUE; + return true; } // LLVector2 uvs[4]; @@ -231,7 +231,7 @@ BOOL LLVOWater::updateGeometry(LLDrawable *drawable) mDrawable->movePartition(); LLPipeline::sCompiles++; - return TRUE; + return true; } void LLVOWater::initClass() @@ -249,12 +249,12 @@ void setVecZ(LLVector3& v) v.mV[VZ] = 1; } -void LLVOWater::setUseTexture(const BOOL use_texture) +void LLVOWater::setUseTexture(const bool use_texture) { mUseTexture = use_texture; } -void LLVOWater::setIsEdgePatch(const BOOL edge_patch) +void LLVOWater::setIsEdgePatch(const bool edge_patch) { mIsEdgePatch = edge_patch; } @@ -292,16 +292,16 @@ U32 LLVOVoidWater::getPartitionType() const } LLWaterPartition::LLWaterPartition(LLViewerRegion* regionp) -: LLSpatialPartition(0, FALSE, regionp) +: LLSpatialPartition(0, false, regionp) { - mInfiniteFarClip = TRUE; + mInfiniteFarClip = true; mDrawableType = LLPipeline::RENDER_TYPE_WATER; mPartitionType = LLViewerRegion::PARTITION_WATER; } LLVoidWaterPartition::LLVoidWaterPartition(LLViewerRegion* regionp) : LLWaterPartition(regionp) { - mOcclusionEnabled = FALSE; + mOcclusionEnabled = false; mDrawableType = LLPipeline::RENDER_TYPE_VOIDWATER; mPartitionType = LLViewerRegion::PARTITION_VOIDWATER; } diff --git a/indra/newview/llvowater.h b/indra/newview/llvowater.h index 157a7f4891..adae86691a 100644 --- a/indra/newview/llvowater.h +++ b/indra/newview/llvowater.h @@ -60,7 +60,7 @@ public: /*virtual*/ void idleUpdate(LLAgent &agent, const F64 &time); /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); - /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); + /*virtual*/ bool updateGeometry(LLDrawable *drawable); /*virtual*/ void updateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax); /*virtual*/ void updateTextures(); @@ -68,16 +68,16 @@ public: virtual U32 getPartitionType() const; - /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate. + /*virtual*/ bool isActive() const; // Whether this object needs to do an idleUpdate. - void setUseTexture(const BOOL use_texture); - void setIsEdgePatch(const BOOL edge_patch); - BOOL getUseTexture() const { return mUseTexture; } - BOOL getIsEdgePatch() const { return mIsEdgePatch; } + void setUseTexture(const bool use_texture); + void setIsEdgePatch(const bool edge_patch); + bool getUseTexture() const { return mUseTexture; } + bool getIsEdgePatch() const { return mIsEdgePatch; } protected: - BOOL mUseTexture; - BOOL mIsEdgePatch; + bool mUseTexture; + bool mIsEdgePatch; S32 mRenderType; }; diff --git a/indra/newview/llvowlsky.cpp b/indra/newview/llvowlsky.cpp index 776d65487c..b5ee42f36c 100644 --- a/indra/newview/llvowlsky.cpp +++ b/indra/newview/llvowlsky.cpp @@ -70,7 +70,7 @@ inline U32 LLVOWLSky::getStarsNumIndices(void) } LLVOWLSky::LLVOWLSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) - : LLStaticViewerObject(id, pcode, regionp, TRUE) + : LLStaticViewerObject(id, pcode, regionp, true) { initStars(); } @@ -80,9 +80,9 @@ void LLVOWLSky::idleUpdate(LLAgent &agent, const F64 &time) } -BOOL LLVOWLSky::isActive(void) const +bool LLVOWLSky::isActive(void) const { - return FALSE; + return false; } LLDrawable * LLVOWLSky::createDrawable(LLPipeline * pipeline) @@ -142,7 +142,7 @@ void LLVOWLSky::restoreGL() gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL); } -BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable) +bool LLVOWLSky::updateGeometry(LLDrawable * drawable) { LL_PROFILE_ZONE_SCOPED; LLStrider<LLVector3> vertices; @@ -158,7 +158,7 @@ BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable) LL_WARNS() << "Failed to allocate Vertex Buffer on full screen sky update" << LL_ENDL; } - BOOL success = mFsSkyVerts->getVertexStrider(vertices) + bool success = mFsSkyVerts->getVertexStrider(vertices) && mFsSkyVerts->getTexCoord0Strider(texCoords) && mFsSkyVerts->getIndexStrider(indices); @@ -250,7 +250,7 @@ BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable) #endif // lock the buffer - BOOL success = segment->getVertexStrider(vertices) + bool success = segment->getVertexStrider(vertices) && segment->getTexCoord0Strider(texCoords) && segment->getIndexStrider(indices); @@ -280,7 +280,7 @@ BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable) LLPipeline::sCompiles++; - return TRUE; + return true; } void LLVOWLSky::drawStars(void) @@ -510,7 +510,7 @@ void LLVOWLSky::updateStarColors() } } -BOOL LLVOWLSky::updateStarGeometry(LLDrawable *drawable) +bool LLVOWLSky::updateStarGeometry(LLDrawable *drawable) { LLStrider<LLVector3> verticesp; LLStrider<LLColor4U> colorsp; @@ -525,7 +525,7 @@ BOOL LLVOWLSky::updateStarGeometry(LLDrawable *drawable) } } - BOOL success = mStarsVerts->getVertexStrider(verticesp) + bool success = mStarsVerts->getVertexStrider(verticesp) && mStarsVerts->getColorStrider(colorsp) && mStarsVerts->getTexCoord0Strider(texcoordsp); @@ -577,5 +577,5 @@ BOOL LLVOWLSky::updateStarGeometry(LLDrawable *drawable) } mStarsVerts->unmapBuffer(); - return TRUE; + return true; } diff --git a/indra/newview/llvowlsky.h b/indra/newview/llvowlsky.h index 36093e8b32..13105c4b0d 100644 --- a/indra/newview/llvowlsky.h +++ b/indra/newview/llvowlsky.h @@ -42,9 +42,9 @@ public: LLVOWLSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); /*virtual*/ void idleUpdate(LLAgent &agent, const F64 &time); - /*virtual*/ BOOL isActive(void) const; + /*virtual*/ bool isActive(void) const; /*virtual*/ LLDrawable * createDrawable(LLPipeline *pipeline); - /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); + /*virtual*/ bool updateGeometry(LLDrawable *drawable); void drawStars(void); void drawDome(void); @@ -75,7 +75,7 @@ private: void updateStarColors(); // helper function for updating the stars geometry. - BOOL updateStarGeometry(LLDrawable *drawable); + bool updateStarGeometry(LLDrawable *drawable); private: LLPointer<LLVertexBuffer> mFsSkyVerts; diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp index 187c4ed638..5ee6aec9f9 100644 --- a/indra/newview/llwearableitemslist.cpp +++ b/indra/newview/llwearableitemslist.cpp @@ -60,10 +60,10 @@ bool LLFindOutfitItems::operator()(LLInventoryCategory* cat, || (item->getType() == LLAssetType::AT_OBJECT) || (item->getType() == LLAssetType::AT_GESTURE)) { - return TRUE; + return true; } } - return FALSE; + return false; } ////////////////////////////////////////////////////////////////////////// @@ -100,7 +100,7 @@ LLPanelWearableOutfitItem::Params::Params() { } -BOOL LLPanelWearableOutfitItem::postBuild() +bool LLPanelWearableOutfitItem::postBuild() { LLPanelWearableListItem::postBuild(); @@ -115,10 +115,10 @@ BOOL LLPanelWearableOutfitItem::postBuild() setWidgetsVisible(false); reshapeWidgets(); } - return TRUE; + return true; } -BOOL LLPanelWearableOutfitItem::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLPanelWearableOutfitItem::handleDoubleClick(S32 x, S32 y, MASK mask) { if(!mShowWidgets) { @@ -133,7 +133,7 @@ BOOL LLPanelWearableOutfitItem::handleDoubleClick(S32 x, S32 y, MASK mask) { onAddWearable(); } - return TRUE; + return true; } void LLPanelWearableOutfitItem::onAddWearable() @@ -293,7 +293,7 @@ LLPanelClothingListItem::~LLPanelClothingListItem() { } -BOOL LLPanelClothingListItem::postBuild() +bool LLPanelClothingListItem::postBuild() { LLPanelDeletableWearableListItem::postBuild(); @@ -305,7 +305,7 @@ BOOL LLPanelClothingListItem::postBuild() setWidgetsVisible(false); reshapeWidgets(); - return TRUE; + return true; } ////////////////////////////////////////////////////////////////////////// @@ -370,7 +370,7 @@ LLPanelBodyPartsListItem::~LLPanelBodyPartsListItem() { } -BOOL LLPanelBodyPartsListItem::postBuild() +bool LLPanelBodyPartsListItem::postBuild() { LLPanelInventoryListItemBase::postBuild(); @@ -380,7 +380,7 @@ BOOL LLPanelBodyPartsListItem::postBuild() setWidgetsVisible(false); reshapeWidgets(); - return TRUE; + return true; } static LLWidgetNameRegistry::StaticRegistrar sRegisterPanelDeletableWearableListItem(&typeid(LLPanelDeletableWearableListItem::Params), "deletable_wearable_list_item"); @@ -413,7 +413,7 @@ LLPanelDeletableWearableListItem::LLPanelDeletableWearableListItem(LLViewerInven setSeparatorVisible(true); } -BOOL LLPanelDeletableWearableListItem::postBuild() +bool LLPanelDeletableWearableListItem::postBuild() { LLPanelWearableListItem::postBuild(); @@ -426,7 +426,7 @@ BOOL LLPanelDeletableWearableListItem::postBuild() setWidgetsVisible(false); reshapeWidgets(); - return TRUE; + return true; } @@ -486,11 +486,11 @@ LLPanelDummyClothingListItem* LLPanelDummyClothingListItem::create(LLWearableTyp return list_item; } -BOOL LLPanelDummyClothingListItem::postBuild() +bool LLPanelDummyClothingListItem::postBuild() { addWidgetToRightSide("btn_add_panel"); - setIconImage(LLInventoryIcon::getIcon(LLAssetType::AT_CLOTHING, LLInventoryType::IT_NONE, mWearableType, FALSE)); + setIconImage(LLInventoryIcon::getIcon(LLAssetType::AT_CLOTHING, LLInventoryType::IT_NONE, mWearableType, false)); updateItem(wearableTypeToString(mWearableType)); // Make it look loke clothing item - reserve space for 'delete' button @@ -499,7 +499,7 @@ BOOL LLPanelDummyClothingListItem::postBuild() setWidgetsVisible(false); reshapeWidgets(); - return TRUE; + return true; } LLWearableType::EType LLPanelDummyClothingListItem::getWearableType() const @@ -959,14 +959,14 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu return; } - const uuid_vec_t& ids = mUUIDs; // selected items IDs - U32 mask = 0; // mask of selected items' types - U32 n_items = ids.size(); // number of selected items - U32 n_worn = 0; // number of worn items among the selected ones - U32 n_already_worn = 0; // number of items worn of same type as selected items - U32 n_links = 0; // number of links among the selected items - U32 n_editable = 0; // number of editable items among the selected ones - U32 n_touchable = 0; // number of touchable items among the selected ones + const uuid_vec_t& ids = mUUIDs; // selected items IDs + U32 mask = 0; // mask of selected items' types + U32 n_items = static_cast<U32>(ids.size()); // number of selected items + U32 n_worn = 0; // number of worn items among the selected ones + U32 n_already_worn = 0; // number of items worn of same type as selected items + U32 n_links = 0; // number of links among the selected items + U32 n_editable = 0; // number of editable items among the selected ones + U32 n_touchable = 0; // number of touchable items among the selected ones bool can_be_worn = true; @@ -1041,8 +1041,8 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu setMenuItemEnabled(menu, "take_off_or_detach", n_worn == n_items); setMenuItemVisible(menu, "object_profile", !standalone); setMenuItemEnabled(menu, "object_profile", n_items == 1); - setMenuItemVisible(menu, "--no options--", FALSE); - setMenuItemEnabled(menu, "--no options--", FALSE); + setMenuItemVisible(menu, "--no options--", false); + setMenuItemEnabled(menu, "--no options--", false); // Populate or hide the "Attach to..." / "Attach to HUD..." submenus. if (mask == MASK_ATTACHMENT && n_worn == 0) @@ -1071,7 +1071,7 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu } if (num_visible_items == 0) { - setMenuItemVisible(menu, "--no options--", TRUE); + setMenuItemVisible(menu, "--no options--", true); } } @@ -1091,8 +1091,8 @@ void LLWearableItemsList::ContextMenu::updateItemsLabels(LLContextMenu* menu) menu_item->setLabel(new_label); } -// We need this method to convert non-zero BOOL values to exactly 1 (TRUE). -// Otherwise code relying on a BOOL value being TRUE may fail +// We need this method to convert non-zero bool values to exactly 1 (true). +// Otherwise code relying on a bool value being true may fail // (I experienced a weird assert in LLView::drawChildren() because of that. // static void LLWearableItemsList::ContextMenu::setMenuItemVisible(LLContextMenu* menu, const std::string& name, bool val) diff --git a/indra/newview/llwearableitemslist.h b/indra/newview/llwearableitemslist.h index 80e211ad6b..7b69711154 100644 --- a/indra/newview/llwearableitemslist.h +++ b/indra/newview/llwearableitemslist.h @@ -83,8 +83,8 @@ public: Params(); }; - BOOL postBuild(); - BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + bool postBuild(); + bool handleDoubleClick(S32 x, S32 y, MASK mask); static LLPanelWearableOutfitItem* create(LLViewerInventoryItem* item, bool worn_indication_enabled, @@ -124,7 +124,7 @@ public: virtual ~LLPanelDeletableWearableListItem() {}; - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /** * Make button visible during mouse over event. @@ -177,7 +177,7 @@ public: virtual ~LLPanelClothingListItem(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /** * Make button visible during mouse over event. @@ -212,7 +212,7 @@ public: virtual ~LLPanelBodyPartsListItem(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /** * Make button visible during mouse over event. @@ -241,7 +241,7 @@ public: }; static LLPanelDummyClothingListItem* create(LLWearableType::EType w_type); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); LLWearableType::EType getWearableType() const; protected: diff --git a/indra/newview/llwearablelist.cpp b/indra/newview/llwearablelist.cpp index 5cbc158f8d..76348d4ea1 100644 --- a/indra/newview/llwearablelist.cpp +++ b/indra/newview/llwearablelist.cpp @@ -90,14 +90,14 @@ void LLWearableList::getAsset(const LLAssetID& assetID, const std::string& weara asset_type, LLWearableList::processGetAssetReply, (void*)new LLWearableArrivedData( asset_type, wearable_name, avatarp, asset_arrived_callback, userdata ), - TRUE); + true); } } // static void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID& uuid, void* userdata, S32 status, LLExtStat ext_status ) { - BOOL isNewWearable = FALSE; + bool isNewWearable = false; LLWearableArrivedData* data = (LLWearableArrivedData*) userdata; LLViewerWearable* wearable = NULL; // NULL indicates failure LLAvatarAppearance *avatarp = data->mAvatarp; @@ -127,7 +127,7 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID { if (wearable->getType() == LLWearableType::WT_COUNT) { - isNewWearable = TRUE; + isNewWearable = true; } delete wearable; wearable = NULL; diff --git a/indra/newview/llwearablelist.h b/indra/newview/llwearablelist.h index be00c058a2..680b958b46 100644 --- a/indra/newview/llwearablelist.h +++ b/indra/newview/llwearablelist.h @@ -46,7 +46,7 @@ class LLWearableList : public LLSingleton<LLWearableList> public: void cleanup() ; - S32 getLength() const { return mList.size(); } + S32 getLength() const { return static_cast<S32>(mList.size()); } void getAsset(const LLAssetID& assetID, const std::string& wearable_name, diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp index 6c5313a3ac..d8852de954 100644 --- a/indra/newview/llweb.cpp +++ b/indra/newview/llweb.cpp @@ -131,8 +131,8 @@ std::string LLWeb::escapeURL(const std::string& url) // The CURL curl_escape() function escapes colons, slashes, // and all characters but A-Z and 0-9. Do a cheesy mini-escape. std::string escaped_url; - S32 len = url.length(); - for (S32 i = 0; i < len; i++) + auto len = url.length(); + for (size_t i = 0; i < len; i++) { char c = url[i]; if (c == ' ') diff --git a/indra/newview/llwebprofile.cpp b/indra/newview/llwebprofile.cpp index 02abf1d4e3..83e417633a 100644 --- a/indra/newview/llwebprofile.cpp +++ b/indra/newview/llwebprofile.cpp @@ -42,7 +42,7 @@ #include "llcorehttputil.h" // third-party -#include "json/reader.h" // JSON + /* * Workflow: @@ -239,10 +239,12 @@ LLCore::BufferArray::ptr_t LLWebProfile::buildPostData(const LLSD &data, LLPoint << "Content-Disposition: form-data; name=\"file\"; filename=\"snapshot.png\"\r\n" << "Content-Type: image/png\r\n\r\n"; + LLImageDataSharedLock lock(image); + // Insert the image data. //char *datap = (char *)(image->getData()); //bas.write(datap, image->getDataSize()); - U8* image_data = image->getData(); + const U8* image_data = image->getData(); for (S32 i = 0; i < image->getDataSize(); ++i) { bas << image_data[i]; diff --git a/indra/newview/llwindebug.cpp b/indra/newview/llwindebug.cpp index 8a66fca349..5cd75f7a02 100644 --- a/indra/newview/llwindebug.cpp +++ b/indra/newview/llwindebug.cpp @@ -30,7 +30,7 @@ // based on dbghelp.h -typedef BOOL (WINAPI *MINIDUMPWRITEDUMP)(HANDLE hProcess, DWORD dwPid, HANDLE hFile, MINIDUMP_TYPE DumpType, +typedef bool (WINAPI *MINIDUMPWRITEDUMP)(HANDLE hProcess, DWORD dwPid, HANDLE hFile, MINIDUMP_TYPE DumpType, CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam diff --git a/indra/newview/llwindowlistener.cpp b/indra/newview/llwindowlistener.cpp index 87d18cfc00..6221d67b26 100644 --- a/indra/newview/llwindowlistener.cpp +++ b/indra/newview/llwindowlistener.cpp @@ -330,7 +330,7 @@ void LLWindowListener::keyUp(LLSD const & evt) } // for WhichButton -typedef BOOL (LLWindowCallbacks::*MouseMethod)(LLWindow *, LLCoordGL, MASK); +typedef bool (LLWindowCallbacks::*MouseMethod)(LLWindow *, LLCoordGL, MASK); struct Actions { Actions(const MouseMethod& d, const MouseMethod& u): down(d), up(u), valid(true) {} diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 249dd10f46..2eadea20ef 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -107,7 +107,7 @@ LLWorld::LLWorld() : *(default_texture++) = MAX_WATER_COLOR.mV[2]; *(default_texture++) = MAX_WATER_COLOR.mV[3]; - mDefaultWaterTexturep = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE); + mDefaultWaterTexturep = LLViewerTextureManager::getLocalTexture(raw.get(), false); gGL.getTexUnit(0)->bind(mDefaultWaterTexturep); mDefaultWaterTexturep->setAddressMode(LLTexUnit::TAM_CLAMP); @@ -450,7 +450,7 @@ void LLWorld::updateAgentOffset(const LLVector3d &offset_global) } -BOOL LLWorld::positionRegionValidGlobal(const LLVector3d &pos_global) +bool LLWorld::positionRegionValidGlobal(const LLVector3d &pos_global) { for (region_list_t::iterator iter = mRegionList.begin(); iter != mRegionList.end(); ++iter) @@ -458,10 +458,10 @@ BOOL LLWorld::positionRegionValidGlobal(const LLVector3d &pos_global) LLViewerRegion* regionp = *iter; if (regionp->pointInRegionGlobal(pos_global)) { - return TRUE; + return true; } } - return FALSE; + return false; } @@ -961,7 +961,7 @@ void LLWorld::updateWaterObjects() if (!getRegionFromHandle(region_handle)) { // No region at that area, so make water LLVOWater* waterp = (LLVOWater *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_WATER, gAgent.getRegion()); - waterp->setUseTexture(FALSE); + waterp->setUseTexture(false); waterp->setPositionGlobal(LLVector3d(x + rwidth/2, y + rwidth/2, 256.f + water_height)); @@ -1015,8 +1015,8 @@ void LLWorld::updateWaterObjects() mEdgeWaterObjects[dir] = (LLVOWater *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_VOID_WATER, gAgent.getRegion()); waterp = mEdgeWaterObjects[dir]; - waterp->setUseTexture(FALSE); - waterp->setIsEdgePatch(TRUE); + waterp->setUseTexture(false); + waterp->setIsEdgePatch(true); gPipeline.createObject(waterp); } @@ -1129,7 +1129,7 @@ void process_enable_simulator(LLMessageSystem *msg, void **user_data) LLHost sim(ip_u32, port); // Viewer trusts the simulator. - msg->enableCircuit(sim, TRUE); + msg->enableCircuit(sim, true); LLWorld::getInstance()->addRegion(handle, sim); // give the simulator a message it can use to get ip and port @@ -1259,7 +1259,7 @@ void send_agent_pause() gMessageSystem->sendReliable(regionp->getHost()); } - gObjectList.mWasPaused = TRUE; + gObjectList.mWasPaused = true; LLViewerStats::instance().getRecording().stop(); } @@ -1352,8 +1352,8 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector<LLVector3d>* positi { LLViewerRegion* regionp = *iter; const LLVector3d& origin_global = regionp->getOriginGlobal(); - S32 count = regionp->mMapAvatars.size(); - for (S32 i = 0; i < count; i++) + auto count = regionp->mMapAvatars.size(); + for (size_t i = 0; i < count; i++) { LLVector3d pos_global = unpackLocalToGlobalPosition(regionp->mMapAvatars.at(i), origin_global); if(dist_vec_squared(pos_global, relative_to) <= radius_squared) diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h index fae7f58b66..01f666d19a 100644 --- a/indra/newview/llworld.h +++ b/indra/newview/llworld.h @@ -81,7 +81,7 @@ public: LLViewerRegion* getRegionFromPosAgent(const LLVector3 &pos); LLViewerRegion* getRegionFromHandle(const U64 &handle); LLViewerRegion* getRegionFromID(const LLUUID& region_id); - BOOL positionRegionValidGlobal(const LLVector3d& pos); // true if position is in valid region + bool positionRegionValidGlobal(const LLVector3d& pos); // true if position is in valid region LLVector3d clipToVisibleRegions(const LLVector3d &start_pos, const LLVector3d &end_pos); void updateAgentOffset(const LLVector3d &offset); diff --git a/indra/newview/llworldmapmessage.cpp b/indra/newview/llworldmapmessage.cpp index d4c5c04fec..c60d075e0c 100644 --- a/indra/newview/llworldmapmessage.cpp +++ b/indra/newview/llworldmapmessage.cpp @@ -63,7 +63,7 @@ void LLWorldMapMessage::sendItemRequest(U32 type, U64 handle) msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->addU32Fast(_PREHASH_Flags, LAYER_FLAG); msg->addU32Fast(_PREHASH_EstateID, 0); // Filled in on sim - msg->addBOOLFast(_PREHASH_Godlike, FALSE); // Filled in on sim + msg->addBOOLFast(_PREHASH_Godlike, false); // Filled in on sim msg->nextBlockFast(_PREHASH_RequestData); msg->addU32Fast(_PREHASH_ItemType, type); @@ -84,7 +84,7 @@ void LLWorldMapMessage::sendNamedRegionRequest(std::string region_name) msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->addU32Fast(_PREHASH_Flags, LAYER_FLAG); msg->addU32Fast(_PREHASH_EstateID, 0); // Filled in on sim - msg->addBOOLFast(_PREHASH_Godlike, FALSE); // Filled in on sim + msg->addBOOLFast(_PREHASH_Godlike, false); // Filled in on sim msg->nextBlockFast(_PREHASH_NameData); msg->addStringFast(_PREHASH_Name, region_name); gAgent.sendReliableMessage(); @@ -138,7 +138,7 @@ void LLWorldMapMessage::sendMapBlockRequest(U16 min_x, U16 min_y, U16 max_x, U16 flags |= (return_nonexistent ? 0x10000 : 0); msg->addU32Fast(_PREHASH_Flags, flags); msg->addU32Fast(_PREHASH_EstateID, 0); // Filled in on sim - msg->addBOOLFast(_PREHASH_Godlike, FALSE); // Filled in on sim + msg->addBOOLFast(_PREHASH_Godlike, false); // Filled in on sim msg->nextBlockFast(_PREHASH_PositionData); msg->addU16Fast(_PREHASH_MinX, min_x); msg->addU16Fast(_PREHASH_MinY, min_y); diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index 886f5663e4..09a18a9825 100755 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -60,22 +60,22 @@ #include "llglheaders.h" // # Constants -static const F32 MAP_DEFAULT_SCALE = 128.f; -static const F32 MAP_ITERP_TIME_CONSTANT = 0.75f; -static const F32 MAP_ZOOM_ACCELERATION_TIME = 0.3f; -static const F32 MAP_ZOOM_MAX_INTERP = 0.5f; -static const F32 MAP_SCALE_SNAP_THRESHOLD = 0.005f; +static constexpr F32 MAP_DEFAULT_SCALE = 128.f; +static constexpr F32 MAP_ITERP_TIME_CONSTANT = 0.75f; +static constexpr F32 MAP_ZOOM_ACCELERATION_TIME = 0.3f; +static constexpr F32 MAP_ZOOM_MAX_INTERP = 0.5f; +static constexpr F32 MAP_SCALE_SNAP_THRESHOLD = 0.005f; // Basically a C++ implementation of the OCEAN_COLOR defined in mapstitcher.py // Please ensure consistency between those 2 files (TODO: would be better to get that color from an asset source...) // OCEAN_COLOR = "#1D475F" -const F32 OCEAN_RED = (F32)(0x1D)/255.f; -const F32 OCEAN_GREEN = (F32)(0x47)/255.f; -const F32 OCEAN_BLUE = (F32)(0x5F)/255.f; +constexpr F32 OCEAN_RED = (F32)(0x1D)/255.f; +constexpr F32 OCEAN_GREEN = (F32)(0x47)/255.f; +constexpr F32 OCEAN_BLUE = (F32)(0x5F)/255.f; -const F32 GODLY_TELEPORT_HEIGHT = 200.f; -const F32 BIG_DOT_RADIUS = 5.f; -BOOL LLWorldMapView::sHandledLastClick = FALSE; +constexpr F32 GODLY_TELEPORT_HEIGHT = 200.f; +constexpr F32 BIG_DOT_RADIUS = 5.f; +bool LLWorldMapView::sHandledLastClick = false; LLUIImagePtr LLWorldMapView::sAvatarSmallImage = NULL; LLUIImagePtr LLWorldMapView::sAvatarYouImage = NULL; @@ -174,12 +174,12 @@ void LLWorldMapView::cleanupClass() LLWorldMapView::LLWorldMapView() : LLPanel(), mBackgroundColor(LLColor4(OCEAN_RED, OCEAN_GREEN, OCEAN_BLUE, 1.f)), - mItemPicked(FALSE), + mItemPicked(false), mPanX(0.f), mPanY(0.f), mTargetPanX(0.f), mTargetPanY(0.f), - mPanning(FALSE), + mPanning(false), mMouseDownPanX(0), mMouseDownPanY(0), mMouseDownX(0), @@ -194,7 +194,7 @@ LLWorldMapView::LLWorldMapView() : clearLastClick(); } -BOOL LLWorldMapView::postBuild() +bool LLWorldMapView::postBuild() { mTextBoxNorth = getChild<LLTextBox> ("floater_map_north"); mTextBoxEast = getChild<LLTextBox> ("floater_map_east"); @@ -325,7 +325,7 @@ void LLWorldMapView::translatePan(S32 delta_x, S32 delta_y) // static -void LLWorldMapView::setPan(S32 x, S32 y, BOOL snap) +void LLWorldMapView::setPan(S32 x, S32 y, bool snap) { mMapIterpTime = MAP_ITERP_TIME_CONSTANT; mTargetPanX = (F32) x; @@ -339,18 +339,18 @@ void LLWorldMapView::setPan(S32 x, S32 y, BOOL snap) } // static -void LLWorldMapView::setPanWithInterpTime(S32 x, S32 y, BOOL snap, F32 interp_time) +void LLWorldMapView::setPanWithInterpTime(S32 x, S32 y, bool snap, F32 interp_time) { setPan(x, y, snap); mMapIterpTime = interp_time; } -bool LLWorldMapView::showRegionInfo() { return (LLWorldMipmap::scaleToLevel(mMapScale) <= DRAW_SIMINFO_THRESHOLD ? true : false); } +bool LLWorldMapView::showRegionInfo() { return LLWorldMipmap::scaleToLevel(mMapScale) <= DRAW_SIMINFO_THRESHOLD; } /////////////////////////////////////////////////////////////////////////////////// // HELPERS -BOOL is_agent_in_region(LLViewerRegion* region, LLSimInfo* info) +bool is_agent_in_region(LLViewerRegion* region, LLSimInfo* info) { return (region && info && info->isName(region->getName())); } @@ -520,7 +520,7 @@ void LLWorldMapView::draw() S32_MAX, //max_chars mMapScale, //max_pixels NULL, - /*use_ellipses*/TRUE); + /*use_ellipses*/true); } } } @@ -552,7 +552,7 @@ void LLWorldMapView::draw() { drawTracking(pos_global, lerp(LLColor4::yellow, LLColor4::orange, 0.4f), - TRUE, + true, "You are here", "", LLFontGL::getFontSansSerifSmall()->getLineHeight()); // offset vertically by one line, to avoid overlap with target tracking @@ -572,7 +572,7 @@ void LLWorldMapView::draw() LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus(); if ( LLTracker::TRACKING_AVATAR == tracking_status ) { - drawTracking( LLAvatarTracker::instance().getGlobalPos(), map_track_color, TRUE, LLTracker::getLabel(), "" ); + drawTracking( LLAvatarTracker::instance().getGlobalPos(), map_track_color, true, LLTracker::getLabel(), "" ); } else if ( LLTracker::TRACKING_LANDMARK == tracking_status || LLTracker::TRACKING_LOCATION == tracking_status ) @@ -582,7 +582,7 @@ void LLWorldMapView::draw() LLVector3d pos_global = LLTracker::getTrackedPositionGlobal(); if (!pos_global.isExactlyZero()) { - drawTracking( pos_global, map_track_color, TRUE, LLTracker::getLabel(), LLTracker::getToolTip() ); + drawTracking( pos_global, map_track_color, true, LLTracker::getLabel(), LLTracker::getToolTip() ); } } else if (LLWorldMap::getInstance()->isTracking()) @@ -591,7 +591,7 @@ void LLWorldMapView::draw() { // We know this location to be invalid, draw a blue circle LLColor4 loading_color(0.0, 0.5, 1.0, 1.0); - drawTracking( LLWorldMap::getInstance()->getTrackedPositionGlobal(), loading_color, TRUE, getString("InvalidLocation"), ""); + drawTracking( LLWorldMap::getInstance()->getTrackedPositionGlobal(), loading_color, true, getString("InvalidLocation"), ""); } else { @@ -599,7 +599,7 @@ void LLWorldMapView::draw() double value = fmod(current_time, 2); value = 0.5 + 0.5*cos(value * F_PI); LLColor4 loading_color(0.0, F32(value/2), F32(value), 1.0); - drawTracking( LLWorldMap::getInstance()->getTrackedPositionGlobal(), loading_color, TRUE, getString("Loading"), ""); + drawTracking( LLWorldMap::getInstance()->getTrackedPositionGlobal(), loading_color, true, getString("Loading"), ""); } } @@ -617,7 +617,7 @@ void LLWorldMapView::draw() //virtual -void LLWorldMapView::setVisible(BOOL visible) +void LLWorldMapView::setVisible(bool visible) { LLPanel::setVisible(visible); if (!visible) @@ -831,8 +831,8 @@ void LLWorldMapView::drawItems() bool mature_enabled = gAgent.canAccessMature(); bool adult_enabled = gAgent.canAccessAdult(); - BOOL show_mature = mature_enabled && gSavedSettings.getBOOL("ShowMatureEvents"); - BOOL show_adult = adult_enabled && gSavedSettings.getBOOL("ShowAdultEvents"); + bool show_mature = mature_enabled && gSavedSettings.getBOOL("ShowMatureEvents"); + bool show_adult = adult_enabled && gSavedSettings.getBOOL("ShowAdultEvents"); for (handle_list_t::iterator iter = mVisibleRegions.begin(); iter != mVisibleRegions.end(); ++iter) { @@ -990,7 +990,7 @@ LLVector3 LLWorldMapView::globalPosToView( const LLVector3d& global_pos ) } -void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4& color, BOOL draw_arrow, +void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4& color, bool draw_arrow, const std::string& label, const std::string& tooltip, S32 vert_offset ) { LLVector3 pos_local = globalPosToView( pos_global ); @@ -1078,7 +1078,7 @@ LLVector3d LLWorldMapView::viewPosToGlobal( S32 x, S32 y ) } -BOOL LLWorldMapView::handleToolTip( S32 x, S32 y, MASK mask ) +bool LLWorldMapView::handleToolTip( S32 x, S32 y, MASK mask ) { LLVector3d pos_global = viewPosToGlobal(x, y); U64 handle = to_region_handle(pos_global); @@ -1131,7 +1131,7 @@ BOOL LLWorldMapView::handleToolTip( S32 x, S32 y, MASK mask ) .message(tooltip_msg) .sticky_rect(sticky_rect_screen)); } - return TRUE; + return true; } // Pass relative Z of 0 to draw at same level. @@ -1461,7 +1461,7 @@ void LLWorldMapView::updateDirections() } -void LLWorldMapView::reshape( S32 width, S32 height, BOOL called_from_parent ) +void LLWorldMapView::reshape( S32 width, S32 height, bool called_from_parent ) { LLView::reshape( width, height, called_from_parent ); } @@ -1546,7 +1546,7 @@ void LLWorldMapView::handleClick(S32 x, S32 y, MASK mask, if (checkItemHit(x, y, event, id, false)) { *hit_type = MAP_ITEM_PG_EVENT; - mItemPicked = TRUE; + mItemPicked = true; gFloaterWorldMap->trackEvent(event); return; } @@ -1562,7 +1562,7 @@ void LLWorldMapView::handleClick(S32 x, S32 y, MASK mask, if (checkItemHit(x, y, event, id, false)) { *hit_type = MAP_ITEM_MATURE_EVENT; - mItemPicked = TRUE; + mItemPicked = true; gFloaterWorldMap->trackEvent(event); return; } @@ -1578,7 +1578,7 @@ void LLWorldMapView::handleClick(S32 x, S32 y, MASK mask, if (checkItemHit(x, y, event, id, false)) { *hit_type = MAP_ITEM_ADULT_EVENT; - mItemPicked = TRUE; + mItemPicked = true; gFloaterWorldMap->trackEvent(event); return; } @@ -1594,7 +1594,7 @@ void LLWorldMapView::handleClick(S32 x, S32 y, MASK mask, if (checkItemHit(x, y, event, id, true)) { *hit_type = MAP_ITEM_LAND_FOR_SALE; - mItemPicked = TRUE; + mItemPicked = true; return; } ++it; @@ -1611,7 +1611,7 @@ void LLWorldMapView::handleClick(S32 x, S32 y, MASK mask, if (checkItemHit(x, y, event, id, true)) { *hit_type = MAP_ITEM_LAND_FOR_SALE_ADULT; - mItemPicked = TRUE; + mItemPicked = true; return; } ++it; @@ -1624,13 +1624,13 @@ void LLWorldMapView::handleClick(S32 x, S32 y, MASK mask, // If we get here, we haven't clicked on anything gFloaterWorldMap->trackLocation(pos_global); - mItemPicked = FALSE; + mItemPicked = false; *id = LLUUID::null; return; } -BOOL LLWorldMapView::handleMouseDown( S32 x, S32 y, MASK mask ) +bool LLWorldMapView::handleMouseDown( S32 x, S32 y, MASK mask ) { gFocusMgr.setMouseCapture( this ); @@ -1638,11 +1638,11 @@ BOOL LLWorldMapView::handleMouseDown( S32 x, S32 y, MASK mask ) mMouseDownPanY = ll_round(mPanY); mMouseDownX = x; mMouseDownY = y; - sHandledLastClick = TRUE; - return TRUE; + sHandledLastClick = true; + return true; } -BOOL LLWorldMapView::handleMouseUp( S32 x, S32 y, MASK mask ) +bool LLWorldMapView::handleMouseUp( S32 x, S32 y, MASK mask ) { if (hasMouseCapture()) { @@ -1658,7 +1658,7 @@ BOOL LLWorldMapView::handleMouseUp( S32 x, S32 y, MASK mask ) LLUI::getInstance()->setMousePositionLocal(this, local_x, local_y); // finish the pan - mPanning = FALSE; + mPanning = false; mMouseDownX = 0; mMouseDownY = 0; @@ -1672,9 +1672,9 @@ BOOL LLWorldMapView::handleMouseUp( S32 x, S32 y, MASK mask ) } gViewerWindow->showCursor(); gFocusMgr.setMouseCapture( NULL ); - return TRUE; + return true; } - return FALSE; + return false; } void LLWorldMapView::updateVisibleBlocks() @@ -1708,7 +1708,7 @@ void LLWorldMapView::updateVisibleBlocks() LLWorldMap::getInstance()->updateRegions(world_left, world_bottom, world_right, world_top); } -BOOL LLWorldMapView::handleHover( S32 x, S32 y, MASK mask ) +bool LLWorldMapView::handleHover( S32 x, S32 y, MASK mask ) { if (hasMouseCapture()) { @@ -1717,7 +1717,7 @@ BOOL LLWorldMapView::handleHover( S32 x, S32 y, MASK mask ) // just started panning, so hide cursor if (!mPanning) { - mPanning = TRUE; + mPanning = true; gViewerWindow->hideCursor(); } @@ -1735,7 +1735,7 @@ BOOL LLWorldMapView::handleHover( S32 x, S32 y, MASK mask ) // doesn't matter, cursor should be hidden gViewerWindow->setCursor(UI_CURSOR_CROSS ); - return TRUE; + return true; } else { @@ -1751,12 +1751,12 @@ BOOL LLWorldMapView::handleHover( S32 x, S32 y, MASK mask ) gViewerWindow->setCursor( UI_CURSOR_CROSS ); } LL_DEBUGS("UserInput") << "hover handled by LLWorldMapView" << LL_ENDL; - return TRUE; + return true; } } -BOOL LLWorldMapView::handleDoubleClick( S32 x, S32 y, MASK mask ) +bool LLWorldMapView::handleDoubleClick( S32 x, S32 y, MASK mask ) { if( sHandledLastClick ) { @@ -1820,9 +1820,9 @@ BOOL LLWorldMapView::handleDoubleClick( S32 x, S32 y, MASK mask ) } }; - return TRUE; + return true; } - return FALSE; + return false; } // static diff --git a/indra/newview/llworldmapview.h b/indra/newview/llworldmapview.h index fdc944d7d1..ebc9c6d738 100644 --- a/indra/newview/llworldmapview.h +++ b/indra/newview/llworldmapview.h @@ -53,16 +53,16 @@ public: LLWorldMapView(); virtual ~LLWorldMapView(); - virtual BOOL postBuild(); + virtual bool postBuild(); - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE ); - virtual void setVisible(BOOL visible); + virtual void reshape(S32 width, S32 height, bool called_from_parent = true ); + virtual void setVisible(bool visible); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask ); - virtual BOOL handleHover( S32 x, S32 y, MASK mask ); - virtual BOOL handleToolTip( S32 x, S32 y, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleDoubleClick( S32 x, S32 y, MASK mask ); + virtual bool handleHover( S32 x, S32 y, MASK mask ); + virtual bool handleToolTip( S32 x, S32 y, MASK mask); bool checkItemHit(S32 x, S32 y, LLItemInfo& item, LLUUID* id, bool track); void handleClick(S32 x, S32 y, MASK mask, S32* hit_type, LLUUID* id); @@ -79,8 +79,8 @@ public: static F32 getScaleSetting(); // Pan is in pixels relative to the center of the map. void translatePan( S32 delta_x, S32 delta_y ); - void setPan( S32 x, S32 y, BOOL snap = TRUE ); - void setPanWithInterpTime(S32 x, S32 y, BOOL snap, F32 interp_time); + void setPan( S32 x, S32 y, bool snap = true ); + void setPanWithInterpTime(S32 x, S32 y, bool snap, F32 interp_time); // Return true if the current scale level is above the threshold for accessing region info bool showRegionInfo(); @@ -102,7 +102,7 @@ public: // Draw the tracking indicator, doing the right thing if it's outside // the view area. - void drawTracking( const LLVector3d& pos_global, const LLColor4& color, BOOL draw_arrow = TRUE, + void drawTracking( const LLVector3d& pos_global, const LLColor4& color, bool draw_arrow = true, const std::string& label = std::string(), const std::string& tooltip = std::string(), S32 vert_offset = 0); static void drawTrackingArrow(const LLRect& view_rect, S32 x, S32 y, @@ -131,7 +131,7 @@ public: const std::string& second_line); // Prevents accidental double clicks - static void clearLastClick() { sHandledLastClick = FALSE; } + static void clearLastClick() { sHandledLastClick = false; } // if the view changes, download additional sim info as needed void updateVisibleBlocks(); @@ -163,7 +163,7 @@ public: static LLUIImagePtr sForSaleImage; static LLUIImagePtr sForSaleAdultImage; - BOOL mItemPicked; + bool mItemPicked; F32 mPanX; // in pixels F32 mPanY; // in pixels @@ -174,7 +174,7 @@ public: static bool sVisibleTilesLoaded; // Are we mid-pan from a user drag? - BOOL mPanning; + bool mPanning; S32 mMouseDownPanX; // value at start of drag S32 mMouseDownPanY; // value at start of drag S32 mMouseDownX; @@ -191,7 +191,7 @@ public: LLTextBox* mTextBoxSouthWest; LLTextBox* mTextBoxScrollHint; - static BOOL sHandledLastClick; + static bool sHandledLastClick; S32 mSelectIDStart; // Keep the list of regions that are displayed on screen. Avoids iterating through the whole region map after draw(). diff --git a/indra/newview/llworldmipmap.cpp b/indra/newview/llworldmipmap.cpp index 31b0b9f75f..5555072e10 100644 --- a/indra/newview/llworldmipmap.cpp +++ b/indra/newview/llworldmipmap.cpp @@ -200,7 +200,7 @@ LLPointer<LLViewerFetchedTexture> LLWorldMipmap::loadObjectsTile(U32 grid_x, U32 // END DEBUG //LL_INFOS("WorldMap") << "LLWorldMipmap::loadObjectsTile(), URL = " << imageurl << LL_ENDL; - LLPointer<LLViewerFetchedTexture> img = LLViewerTextureManager::getFetchedTextureFromUrl(imageurl, FTT_MAP_TILE, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + LLPointer<LLViewerFetchedTexture> img = LLViewerTextureManager::getFetchedTextureFromUrl(imageurl, FTT_MAP_TILE, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); if(img == nullptr) { diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp index 5dc2df7bed..1d8253830b 100644 --- a/indra/newview/llxmlrpctransaction.cpp +++ b/indra/newview/llxmlrpctransaction.cpp @@ -282,7 +282,7 @@ void LLXMLRPCTransaction::Handler::onCompleted(LLCore::HttpHandle handle, body->read(0, bodydata, body->size()); - mImpl->mResponse = XMLRPC_REQUEST_FromXML(bodydata, body->size(), 0); + mImpl->mResponse = XMLRPC_REQUEST_FromXML(bodydata, static_cast<int>(body->size()), 0); delete[] bodydata; diff --git a/indra/newview/macmain.h b/indra/newview/macmain.h deleted file mode 100644 index 866dda6a2f..0000000000 --- a/indra/newview/macmain.h +++ /dev/null @@ -1,44 +0,0 @@ -/** - * @file macmain.h - * @brief Main Mac viewer defines - * - * $LicenseInfo:firstyear=2003&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$ - */ - -/* main.h */ - -#define rMenuBar 128 /* menu bar */ - -#define mApple 128 /* Apple menu */ -#define iAbout 1 - -#define mFile 129 /* File menu */ -#define iNew 1 -#define iClose 4 -#define iQuitSeparator 10 -#define iQuit 11 - -#define mEdit 130 /* Edit menu */ - -#define kAboutBox 200 /* Dialog resource for About box */ - -#define kSleepTime 32767 diff --git a/indra/newview/macview.r b/indra/newview/macview.r deleted file mode 100755 index 8124232cf1..0000000000 --- a/indra/newview/macview.r +++ /dev/null @@ -1,123 +0,0 @@ -/* main.r */ - -#include <Carbon/Carbon.r> -#include "macmain.h" - -resource 'MBAR' (rMenuBar, preload) { - { /* array MenuArray: 3 elements */ - /* [1] */ - 128, - /* [2] */ - 129, - /* [3] */ - 130 - } -}; - -resource 'MENU' (mApple, preload) { - 128, - textMenuProc, - 0x7FFFFFFD, - enabled, - apple, - { /* array: 2 elements */ - /* [1] */ - "About Second Life", noIcon, noKey, noMark, plain, - /* [2] */ - "-", noIcon, noKey, noMark, plain - } -}; - -resource 'MENU' (mFile, preload) { - 129, - textMenuProc, - 0x1400, - enabled, - "File", - { /* array: 11 elements */ - /* [1] */ - "New", noIcon, "N", noMark, plain, - /* [2] */ - "Open", noIcon, "O", noMark, plain, - /* [3] */ - "-", noIcon, noKey, noMark, plain, - /* [4] */ - "Close", noIcon, "W", noMark, plain, - /* [5] */ - "Save", noIcon, "S", noMark, plain, - /* [6] */ - "Save AsÉ", noIcon, noKey, noMark, plain, - /* [7] */ - "-", noIcon, noKey, noMark, plain, - /* [8] */ - "Page SetupÉ", noIcon, noKey, noMark, plain, - /* [9] */ - "PrintÉ", noIcon, noKey, noMark, plain, - /* [10] */ - "-", noIcon, noKey, noMark, plain, - /* [11] */ - "Quit", noIcon, "Q", noMark, plain - } -}; - -resource 'MENU' (mEdit, preload) { - 130, - textMenuProc, - 0x0, - enabled, - "Edit", - { /* array: 6 elements */ - /* [1] */ - "Undo", noIcon, "Z", noMark, plain, - /* [2] */ - "-", noIcon, noKey, noMark, plain, - /* [3] */ - "Cut", noIcon, "X", noMark, plain, - /* [4] */ - "Copy", noIcon, "C", noMark, plain, - /* [5] */ - "Paste", noIcon, "V", noMark, plain, - /* [6] */ - "Clear", noIcon, noKey, noMark, plain - } -}; - -resource 'DITL' (kAboutBox) { - { /* array DITLarray: 3 elements */ - /* [1] */ - {16, 21, 38, 208}, - StaticText { - disabled, - "Hello hello hello..." - }, - /* [2] */ - {116, 287, 136, 345}, - Button { - enabled, - "OK" - }, - /* [3] */ - {54, 139, 74, 197}, - Button { - enabled, - "OK" - } - } -}; - -resource 'ALRT' (kAboutBox) { - {40, 40, 139, 280}, - 200, - { /* array: 4 elements */ - /* [1] */ - OK, visible, sound1, - /* [2] */ - OK, visible, sound1, - /* [3] */ - OK, visible, sound1, - /* [4] */ - OK, visible, sound1 - }, - noAutoCenter -}; - diff --git a/indra/newview/mpfloatertuning.cpp b/indra/newview/mpfloatertuning.cpp index 66336a6c47..bfa96a8764 100644 --- a/indra/newview/mpfloatertuning.cpp +++ b/indra/newview/mpfloatertuning.cpp @@ -62,7 +62,7 @@ void MPFloaterTuning::syncFromPreferenceSetting(void *user_data) LL_INFOS() << "syncFromPreferenceSetting optBuf=" << optBuf << LL_ENDL; } -BOOL MPFloaterTuning::postBuild() +bool MPFloaterTuning::postBuild() { LLSliderCtrl* fpsSliderCtrl = getChild<LLSliderCtrl>("fpsSlider"); fpsSliderCtrl->setMinValue(0); @@ -94,4 +94,4 @@ void MPFloaterTuning::onFinalCommit() void MPFloaterTuning::onClose(bool app_quitting) { -}
\ No newline at end of file +} diff --git a/indra/newview/mpfloatertuning.h b/indra/newview/mpfloatertuning.h index 8812395ef3..9e9c7f174f 100644 --- a/indra/newview/mpfloatertuning.h +++ b/indra/newview/mpfloatertuning.h @@ -34,7 +34,7 @@ class MPFloaterTuning: public LLFloater public: MPFloaterTuning(const LLSD& key); - BOOL postBuild(); + bool postBuild(); void onFinalCommit(); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 8e880a2ceb..5b0a73269f 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -117,7 +117,7 @@ #include "llenvironment.h" #include "llsettingsvo.h" -extern BOOL gSnapshot; +extern bool gSnapshot; bool gShiftFrame = false; //cached settings @@ -213,11 +213,11 @@ const F32 DEFERRED_LIGHT_FALLOFF = 0.5f; const U32 DEFERRED_VB_MASK = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD1; extern S32 gBoxFrame; -//extern BOOL gHideSelectedObjects; -extern BOOL gDisplaySwapBuffers; -extern BOOL gDebugGL; -extern BOOL gCubeSnapshot; -extern BOOL gSnapshotNoPost; +//extern bool gHideSelectedObjects; +extern bool gDisplaySwapBuffers; +extern bool gDebugGL; +extern bool gCubeSnapshot; +extern bool gSnapshotNoPost; bool gAvatarBacklight = false; @@ -439,8 +439,8 @@ void LLPipeline::init() // disables non-object rendering (UI, sky, water, etc) if (gSavedSettings.getBOOL("RenderPerformanceTest")) { - gSavedSettings.setBOOL("RenderPerformanceTest", FALSE); - gSavedSettings.setBOOL("RenderPerformanceTest", TRUE); + gSavedSettings.setBOOL("RenderPerformanceTest", false); + gSavedSettings.setBOOL("RenderPerformanceTest", true); } mOldRenderDebugMask = mRenderDebugMask; @@ -671,12 +671,12 @@ void LLPipeline::destroyGL() void LLPipeline::requestResizeScreenTexture() { - gResizeScreenTexture = TRUE; + gResizeScreenTexture = true; } void LLPipeline::requestResizeShadowTexture() { - gResizeShadowTexture = TRUE; + gResizeShadowTexture = true; } void LLPipeline::resizeShadowTexture() @@ -684,7 +684,7 @@ void LLPipeline::resizeShadowTexture() releaseSunShadowTargets(); releaseSpotShadowTargets(); allocateShadowBuffer(mRT->width, mRT->height); - gResizeShadowTexture = FALSE; + gResizeShadowTexture = false; } void LLPipeline::resizeScreenTexture() @@ -700,7 +700,7 @@ void LLPipeline::resizeScreenTexture() releaseSunShadowTargets(); releaseSpotShadowTargets(); allocateScreenBuffer(resX,resY); - gResizeScreenTexture = FALSE; + gResizeScreenTexture = false; } } } @@ -776,14 +776,9 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY; if (mRT == &mMainRT) { // hacky -- allocate auxillary buffer - - gCubeSnapshot = TRUE; - mReflectionMapManager.initReflectionMaps(); - mHeroProbeManager.initReflectionMaps(); - if (sReflectionProbesEnabled) { - gCubeSnapshot = TRUE; + gCubeSnapshot = true; mReflectionMapManager.initReflectionMaps(); } @@ -800,7 +795,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) } mRT = &mMainRT; - gCubeSnapshot = FALSE; + gCubeSnapshot = false; } // remember these dimensions @@ -943,7 +938,7 @@ bool LLPipeline::allocateShadowBuffer(U32 resX, U32 resY) LLRenderTarget* shadow_target = getSunShadowTarget(i); if (shadow_target) { - gGL.getTexUnit(0)->bind(getSunShadowTarget(i), TRUE); + gGL.getTexUnit(0)->bind(getSunShadowTarget(i), true); gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_ANISOTROPIC); gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); @@ -960,7 +955,7 @@ bool LLPipeline::allocateShadowBuffer(U32 resX, U32 resY) LLRenderTarget* shadow_target = getSpotShadowTarget(i); if (shadow_target) { - gGL.getTexUnit(0)->bind(shadow_target, TRUE); + gGL.getTexUnit(0)->bind(shadow_target, true); gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_ANISOTROPIC); gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); @@ -994,8 +989,8 @@ void LLPipeline::refreshCachedSettings() && LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion") && gSavedSettings.getBOOL("UseOcclusion")) ? 2 : 0; - WindLightUseAtmosShaders = TRUE; // DEPRECATED -- gSavedSettings.getBOOL("WindLightUseAtmosShaders"); - RenderDeferred = TRUE; // DEPRECATED -- gSavedSettings.getBOOL("RenderDeferred"); + WindLightUseAtmosShaders = true; // DEPRECATED -- gSavedSettings.getBOOL("WindLightUseAtmosShaders"); + RenderDeferred = true; // DEPRECATED -- gSavedSettings.getBOOL("RenderDeferred"); RenderDeferredSunWash = gSavedSettings.getF32("RenderDeferredSunWash"); RenderFSAASamples = LLFeatureManager::getInstance()->isFeatureAvailable("RenderFSAASamples") ? gSavedSettings.getU32("RenderFSAASamples") : 0; RenderResolutionDivisor = gSavedSettings.getU32("RenderResolutionDivisor"); @@ -1071,7 +1066,7 @@ void LLPipeline::refreshCachedSettings() RenderScreenSpaceReflectionAdaptiveStepMultiplier = gSavedSettings.getF32("RenderScreenSpaceReflectionAdaptiveStepMultiplier"); RenderScreenSpaceReflectionGlossySamples = gSavedSettings.getS32("RenderScreenSpaceReflectionGlossySamples"); RenderBufferVisualization = gSavedSettings.getS32("RenderBufferVisualization"); - if (gSavedSettings.getBOOL("RenderMirrors") != (BOOL)RenderMirrors) + if (gSavedSettings.getBOOL("RenderMirrors") != RenderMirrors) { RenderMirrors = gSavedSettings.getBOOL("RenderMirrors"); LLViewerShaderMgr::instance()->clearShaderCache(); @@ -1641,7 +1636,7 @@ void LLPipeline::allocDrawable(LLViewerObject *vobj) { drawable->setState(LLDrawable::FORCE_INVISIBLE); } - drawable->updateXform(TRUE); + drawable->updateXform(true); } @@ -1792,7 +1787,7 @@ void LLPipeline::createObject(LLViewerObject* vobj) if (drawablep->getVOVolume() && RenderAnimateRes) { // fun animated res - drawablep->updateXform(TRUE); + drawablep->updateXform(true); drawablep->clearState(LLDrawable::MOVE_UNDAMPED); drawablep->setScale(LLVector3(0,0,0)); drawablep->makeActive(); @@ -1886,6 +1881,11 @@ void LLPipeline::updateMovedList(LLDrawable::drawable_vector_t& moved_list) { LLDrawable::drawable_vector_t::iterator curiter = iter++; LLDrawable *drawablep = *curiter; + if (!drawablep) + { + iter = moved_list.erase(curiter); + continue; + } bool done = true; if (!drawablep->isDead() && (!drawablep->isState(LLDrawable::EARLY_MOVE))) { @@ -2436,6 +2436,7 @@ void LLPipeline::doOcclusion(LLCamera& camera) mCubeVB->setBuffer(); mReflectionMapManager.doOcclusion(); + mHeroProbeManager.doOcclusion(); gOcclusionCubeProgram.unbind(); gGL.setColorMask(true, true); @@ -2525,7 +2526,7 @@ void LLPipeline::updateGL() { LLGLUpdate* glu = LLGLUpdate::sGLQ.front(); glu->updateGL(); - glu->mInQ = FALSE; + glu->mInQ = false; LLGLUpdate::sGLQ.pop_front(); } } @@ -2842,7 +2843,7 @@ void LLPipeline::markGLRebuild(LLGLUpdate* glu) if (glu && !glu->mInQ) { LLGLUpdate::sGLQ.push_back(glu); - glu->mInQ = TRUE; + glu->mInQ = true; } } @@ -2961,7 +2962,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result) if (LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD && !gCubeSnapshot) { LLSpatialGroup* last_group = NULL; - BOOL fov_changed = LLViewerCamera::getInstance()->isDefaultFOVChanged(); + bool fov_changed = LLViewerCamera::getInstance()->isDefaultFOVChanged(); for (LLCullResult::bridge_iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i) { LLCullResult::bridge_iterator cur_iter = i; @@ -3050,7 +3051,7 @@ void LLPipeline::stateSort(LLSpatialGroup* group, LLCamera& camera) } } -void LLPipeline::stateSort(LLSpatialBridge* bridge, LLCamera& camera, BOOL fov_changed) +void LLPipeline::stateSort(LLSpatialBridge* bridge, LLCamera& camera, bool fov_changed) { LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; if (bridge->getSpatialGroup()->changeLOD() || fov_changed) @@ -3108,7 +3109,7 @@ void LLPipeline::stateSort(LLDrawable* drawablep, LLCamera& camera) { if (!drawablep->isState(LLDrawable::INVISIBLE|LLDrawable::FORCE_INVISIBLE)) { - drawablep->setVisible(camera, NULL, FALSE); + drawablep->setVisible(camera, NULL, false); } } @@ -3603,7 +3604,7 @@ void LLPipeline::postSort(LLCamera &camera) } } - // LLSpatialGroup::sNoDelete = FALSE; + // LLSpatialGroup::sNoDelete = false; LL_PUSH_CALLSTACKS(); } @@ -3626,7 +3627,7 @@ void render_hud_elements() if (!LLPipeline::sReflectionRender && gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI)) { - gViewerWindow->renderSelections(FALSE, FALSE, FALSE); // For HUD version in render_ui_3d() + gViewerWindow->renderSelections(false, false, false); // For HUD version in render_ui_3d() // Draw the tracking overlays LLTracker::render3D(); @@ -3678,10 +3679,8 @@ void LLPipeline::renderHighlights() // Make sure the selection image gets downloaded and decoded mFaceSelectImagep->addTextureStats((F32)MAX_IMAGE_AREA); - U32 count = mSelectedFaces.size(); - for (U32 i = 0; i < count; i++) + for (auto facep : mSelectedFaces) { - LLFace *facep = mSelectedFaces[i]; if (!facep || facep->getDrawable()->isDead()) { LL_ERRS() << "Bad face on selection" << LL_ENDL; @@ -3697,10 +3696,8 @@ void LLPipeline::renderHighlights() // Paint 'em red! color.setVec(1.f, 0.f, 0.f, 0.5f); - int count = mHighlightFaces.size(); - for (S32 i = 0; i < count; i++) + for (auto facep : mHighlightFaces) { - LLFace* facep = mHighlightFaces[i]; facep->renderSelected(LLViewerTexture::sNullImagep, color); } } @@ -3726,10 +3723,8 @@ void LLPipeline::renderHighlights() mFaceSelectImagep->addTextureStats((F32)MAX_IMAGE_AREA); - U32 count = mSelectedFaces.size(); - for (U32 i = 0; i < count; i++) + for (auto facep : mSelectedFaces) { - LLFace *facep = mSelectedFaces[i]; if (!facep || facep->getDrawable()->isDead()) { LL_ERRS() << "Bad face on selection" << LL_ENDL; @@ -3756,10 +3751,8 @@ void LLPipeline::renderHighlights() mFaceSelectImagep->addTextureStats((F32)MAX_IMAGE_AREA); - U32 count = mSelectedFaces.size(); - for (U32 i = 0; i < count; i++) + for (auto facep : mSelectedFaces) { - LLFace *facep = mSelectedFaces[i]; if (!facep || facep->getDrawable()->isDead()) { LL_ERRS() << "Bad face on selection" << LL_ENDL; @@ -4662,7 +4655,7 @@ void LLPipeline::renderDebug() LLVertexBuffer::unbind(); LLGLEnable blend(GL_BLEND); - LLGLDepthTest depth(TRUE, FALSE); + LLGLDepthTest depth(true, false); LLGLDisable cull(GL_CULL_FACE); gGL.color4f(1,1,1,1); @@ -4842,7 +4835,7 @@ void LLPipeline::rebuildPools() assertInitialized(); - S32 max_count = mPools.size(); + auto max_count = mPools.size(); pool_set_t::iterator iter1 = mPools.upper_bound(mLastRebuildPool); while(max_count > 0 && mPools.size() > 0) // && num_rebuilds < MAX_REBUILDS) { @@ -5801,7 +5794,7 @@ void LLPipeline::enableLightsDynamic() void LLPipeline::enableLightsAvatar() { U32 mask = 0xff; // All lights - setupAvatarLights(FALSE); + setupAvatarLights(false); enableLights(mask); } @@ -5865,7 +5858,7 @@ void LLPipeline::enableLightsPreview() void LLPipeline::enableLightsAvatarEdit(const LLColor4& color) { U32 mask = 0x2002; // Avatar backlight only, set ambient - setupAvatarLights(TRUE); + setupAvatarLights(true); enableLights(mask); gGL.setAmbientLightColor(color); @@ -6321,7 +6314,7 @@ LLVOPartGroup* LLPipeline::lineSegmentIntersectParticle(const LLVector4a& start, LLSpatialPartition* part = region->getSpatialPartition(LLViewerRegion::PARTITION_PARTICLE); if (part && hasRenderType(part->mDrawableType)) { - LLDrawable* hit = part->lineSegmentIntersect(start, local_end, TRUE, FALSE, TRUE, FALSE, face_hit, &position, NULL, NULL, NULL); + LLDrawable* hit = part->lineSegmentIntersect(start, local_end, true, false, true, false, face_hit, &position, NULL, NULL, NULL); if (hit) { drawable = hit; @@ -6550,7 +6543,7 @@ LLViewerObject* LLPipeline::lineSegmentIntersectInHUD(const LLVector4a& start, c LLSpatialPartition* part = region->getSpatialPartition(LLViewerRegion::PARTITION_HUD); if (part) { - LLDrawable* hit = part->lineSegmentIntersect(start, end, pick_transparent, FALSE, TRUE, FALSE, face_hit, intersection, tex_coord, normal, tangent); + LLDrawable* hit = part->lineSegmentIntersect(start, end, pick_transparent, false, true, false, face_hit, intersection, tex_coord, normal, tangent); if (hit) { drawable = hit; @@ -6863,7 +6856,7 @@ void LLPipeline::generateLuminance(LLRenderTarget* src, LLRenderTarget* dst) mGlow[1].bindTexture(0, channel); } - channel = gLuminanceProgram.enableTexture(LLShaderMgr::DEFERRED_NORMAL); + channel = gLuminanceProgram.enableTexture(LLShaderMgr::NORMAL_MAP); if (channel > -1) { // bind the normal map to get the environment mask @@ -7328,7 +7321,7 @@ void LLPipeline::renderDoF(LLRenderTarget* src, LLRenderTarget* dst) LLVector4a result; result.clear(); - gViewerWindow->cursorIntersect(-1, -1, 512.f, NULL, -1, FALSE, FALSE, TRUE, TRUE, nullptr, nullptr, nullptr, &result); + gViewerWindow->cursorIntersect(-1, -1, 512.f, nullptr, -1, false, false, true, true, nullptr, nullptr, nullptr, &result); focus_point.set(result.getF32ptr()); } @@ -7613,7 +7606,7 @@ void LLPipeline::bindShadowMaps(LLGLSLShader& shader) S32 channel = shader.enableTexture(LLShaderMgr::DEFERRED_SHADOW0 + i, LLTexUnit::TT_TEXTURE); if (channel > -1) { - gGL.getTexUnit(channel)->bind(getSunShadowTarget(i), TRUE); + gGL.getTexUnit(channel)->bind(getSunShadowTarget(i), true); } } } @@ -7626,7 +7619,7 @@ void LLPipeline::bindShadowMaps(LLGLSLShader& shader) LLRenderTarget* shadow_target = getSpotShadowTarget(i - 4); if (shadow_target) { - gGL.getTexUnit(channel)->bind(shadow_target, TRUE); + gGL.getTexUnit(channel)->bind(shadow_target, true); } } } @@ -7670,7 +7663,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ gGL.getTexUnit(channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); } - channel = shader.enableTexture(LLShaderMgr::DEFERRED_NORMAL, deferred_target->getUsage()); + channel = shader.enableTexture(LLShaderMgr::NORMAL_MAP, deferred_target->getUsage()); if (channel > -1) { deferred_target->bindTexture(2, channel, LLTexUnit::TFO_POINT); // frag_data[2] @@ -7689,11 +7682,11 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ { if (depth_target) { - gGL.getTexUnit(channel)->bind(depth_target, TRUE); + gGL.getTexUnit(channel)->bind(depth_target, true); } else { - gGL.getTexUnit(channel)->bind(deferred_target, TRUE); + gGL.getTexUnit(channel)->bind(deferred_target, true); } stop_glerror(); } @@ -7714,7 +7707,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ if (sReflectionRender && !shader.getUniformLocation(LLShaderMgr::MODELVIEW_MATRIX)) { - shader.uniformMatrix4fv(LLShaderMgr::MODELVIEW_MATRIX, 1, FALSE, mReflectionModelView.m); + shader.uniformMatrix4fv(LLShaderMgr::MODELVIEW_MATRIX, 1, false, mReflectionModelView.m); } channel = shader.enableTexture(LLShaderMgr::DEFERRED_NOISE); @@ -7759,7 +7752,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ mat[i+80] = mSunShadowMatrix[5].m[i]; } - shader.uniformMatrix4fv(LLShaderMgr::DEFERRED_SHADOW_MATRIX, 6, FALSE, mat); + shader.uniformMatrix4fv(LLShaderMgr::DEFERRED_SHADOW_MATRIX, 6, false, mat); stop_glerror(); @@ -7781,7 +7774,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ m[4], m[5], m[6], m[8], m[9], m[10] }; - shader.uniformMatrix3fv(LLShaderMgr::DEFERRED_ENV_MAT, 1, TRUE, mat); + shader.uniformMatrix3fv(LLShaderMgr::DEFERRED_ENV_MAT, 1, true, mat); } } @@ -7870,7 +7863,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ if (shader.getUniformLocation(LLShaderMgr::DEFERRED_NORM_MATRIX) >= 0) { glh::matrix4f norm_mat = get_current_modelview().inverse().transpose(); - shader.uniformMatrix4fv(LLShaderMgr::DEFERRED_NORM_MATRIX, 1, FALSE, norm_mat.m); + shader.uniformMatrix4fv(LLShaderMgr::DEFERRED_NORM_MATRIX, 1, false, norm_mat.m); } // auto adjust legacy sun color if needed @@ -8615,7 +8608,7 @@ void LLPipeline::setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep) F32 proj_range = far_clip - near_clip; glh::matrix4f light_proj = gl_perspective(fovy, aspect, near_clip, far_clip); screen_to_light = trans * light_proj * screen_to_light; - shader.uniformMatrix4fv(LLShaderMgr::PROJECTOR_MATRIX, 1, FALSE, screen_to_light.m); + shader.uniformMatrix4fv(LLShaderMgr::PROJECTOR_MATRIX, 1, false, screen_to_light.m); shader.uniform1f(LLShaderMgr::PROJECTOR_NEAR, near_clip); shader.uniform3fv(LLShaderMgr::PROJECTOR_P, 1, p1.v); shader.uniform3fv(LLShaderMgr::PROJECTOR_N, 1, n.v); @@ -8705,7 +8698,7 @@ void LLPipeline::unbindDeferredShader(LLGLSLShader &shader) LLRenderTarget* deferred_light_target = &mRT->deferredLight; stop_glerror(); - shader.disableTexture(LLShaderMgr::DEFERRED_NORMAL, deferred_target->getUsage()); + shader.disableTexture(LLShaderMgr::NORMAL_MAP, deferred_target->getUsage()); shader.disableTexture(LLShaderMgr::DEFERRED_DIFFUSE, deferred_target->getUsage()); shader.disableTexture(LLShaderMgr::DEFERRED_SPECULAR, deferred_target->getUsage()); shader.disableTexture(LLShaderMgr::DEFERRED_EMISSIVE, deferred_target->getUsage()); @@ -8763,7 +8756,7 @@ void LLPipeline::setEnvMat(LLGLSLShader& shader) m[4], m[5], m[6], m[8], m[9], m[10] }; - shader.uniformMatrix3fv(LLShaderMgr::DEFERRED_ENV_MAT, 1, TRUE, mat); + shader.uniformMatrix3fv(LLShaderMgr::DEFERRED_ENV_MAT, 1, true, mat); } void LLPipeline::bindReflectionProbes(LLGLSLShader& shader) @@ -9630,7 +9623,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) shadow_cam = camera; shadow_cam.setFar(16.f); - LLViewerCamera::updateFrustumPlanes(shadow_cam, FALSE, FALSE, TRUE); + LLViewerCamera::updateFrustumPlanes(shadow_cam, false, false, true); LLVector3* frust = shadow_cam.mAgentFrustum; @@ -9937,7 +9930,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) set_current_modelview(view[j]); set_current_projection(proj[j]); - LLViewerCamera::updateFrustumPlanes(shadow_cam, FALSE, FALSE, TRUE); + LLViewerCamera::updateFrustumPlanes(shadow_cam, false, false, true); //shadow_cam.ignoreAgentFrustumPlane(LLCamera::AGENT_PLANE_NEAR); shadow_cam.getAgentPlane(LLCamera::AGENT_PLANE_NEAR).set(shadow_near_clip); @@ -10111,7 +10104,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) shadow_cam.setFar(far_clip); shadow_cam.setOrigin(origin); - LLViewerCamera::updateFrustumPlanes(shadow_cam, FALSE, FALSE, TRUE); + LLViewerCamera::updateFrustumPlanes(shadow_cam, false, false, true); // @@ -10279,7 +10272,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar, bool preview_avatar, bool result.clear(); grabReferences(result); - if (!avatar || !avatar->mDrawable) + if (!avatar || avatar->isDead() || !avatar->mDrawable) { LL_WARNS_ONCE("AvatarRenderPipeline") << "Avatar is " << (avatar ? "not drawable" : "null") << LL_ENDL; return; @@ -10626,7 +10619,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar, bool preview_avatar, bool if (!preview_avatar && !for_profile) { - avatar->mNeedsImpostorUpdate = FALSE; + avatar->mNeedsImpostorUpdate = false; avatar->cacheImpostorValues(); avatar->mLastImpostorUpdateFrameTime = gFrameTimeSeconds; } diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 62eba72e81..1d2033b4f0 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -277,7 +277,7 @@ public: void stateSort(LLCamera& camera, LLCullResult& result); void stateSort(LLSpatialGroup* group, LLCamera& camera); - void stateSort(LLSpatialBridge* bridge, LLCamera& camera, BOOL fov_changed = FALSE); + void stateSort(LLSpatialBridge* bridge, LLCamera& camera, bool fov_changed = false); void stateSort(LLDrawable* drawablep, LLCamera& camera); void postSort(LLCamera& camera); @@ -351,7 +351,7 @@ public: void findReferences(LLDrawable *drawablep); // Find the lists which have references to this object bool verify(); // Verify that all data in the pipeline is "correct" - S32 getLightCount() const { return mLights.size(); } + S32 getLightCount() const { return static_cast<S32>(mLights.size()); } void calcNearbyLights(LLCamera& camera); void setupHWLights(); diff --git a/indra/newview/skins/default/textures/icons/AddItem_Disabled.png b/indra/newview/skins/default/textures/icons/AddItem_Disabled.png Binary files differindex cf88c89ae5..d21b72b973 100644 --- a/indra/newview/skins/default/textures/icons/AddItem_Disabled.png +++ b/indra/newview/skins/default/textures/icons/AddItem_Disabled.png diff --git a/indra/newview/skins/default/textures/icons/AddItem_Off.png b/indra/newview/skins/default/textures/icons/AddItem_Off.png Binary files differindex 52d4f9bc80..64108d133a 100644 --- a/indra/newview/skins/default/textures/icons/AddItem_Off.png +++ b/indra/newview/skins/default/textures/icons/AddItem_Off.png diff --git a/indra/newview/skins/default/textures/icons/AddItem_Press.png b/indra/newview/skins/default/textures/icons/AddItem_Press.png Binary files differindex acc898e5f4..3168f51757 100644 --- a/indra/newview/skins/default/textures/icons/AddItem_Press.png +++ b/indra/newview/skins/default/textures/icons/AddItem_Press.png diff --git a/indra/newview/skins/default/textures/icons/AudioMute_Off.png b/indra/newview/skins/default/textures/icons/AudioMute_Off.png Binary files differindex 938aaef491..dd89920fae 100644 --- a/indra/newview/skins/default/textures/icons/AudioMute_Off.png +++ b/indra/newview/skins/default/textures/icons/AudioMute_Off.png diff --git a/indra/newview/skins/default/textures/icons/AudioMute_Over.png b/indra/newview/skins/default/textures/icons/AudioMute_Over.png Binary files differindex 7bd1b12aae..a4fbec4144 100644 --- a/indra/newview/skins/default/textures/icons/AudioMute_Over.png +++ b/indra/newview/skins/default/textures/icons/AudioMute_Over.png diff --git a/indra/newview/skins/default/textures/icons/Audio_Off.png b/indra/newview/skins/default/textures/icons/Audio_Off.png Binary files differindex ef746aab92..4f6f5512c8 100644 --- a/indra/newview/skins/default/textures/icons/Audio_Off.png +++ b/indra/newview/skins/default/textures/icons/Audio_Off.png diff --git a/indra/newview/skins/default/textures/icons/Audio_Press.png b/indra/newview/skins/default/textures/icons/Audio_Press.png Binary files differindex 25a669224a..0268a0f9fb 100644 --- a/indra/newview/skins/default/textures/icons/Audio_Press.png +++ b/indra/newview/skins/default/textures/icons/Audio_Press.png diff --git a/indra/newview/skins/default/textures/icons/BackArrow_Off.png b/indra/newview/skins/default/textures/icons/BackArrow_Off.png Binary files differindex ff32192856..3775690531 100644 --- a/indra/newview/skins/default/textures/icons/BackArrow_Off.png +++ b/indra/newview/skins/default/textures/icons/BackArrow_Off.png diff --git a/indra/newview/skins/default/textures/icons/ClipboardMenu_Disabled.png b/indra/newview/skins/default/textures/icons/ClipboardMenu_Disabled.png Binary files differindex 9a81c5f94b..c219ac4446 100644 --- a/indra/newview/skins/default/textures/icons/ClipboardMenu_Disabled.png +++ b/indra/newview/skins/default/textures/icons/ClipboardMenu_Disabled.png diff --git a/indra/newview/skins/default/textures/icons/ClipboardMenu_Off.png b/indra/newview/skins/default/textures/icons/ClipboardMenu_Off.png Binary files differindex 88012cf8d1..586f577181 100644 --- a/indra/newview/skins/default/textures/icons/ClipboardMenu_Off.png +++ b/indra/newview/skins/default/textures/icons/ClipboardMenu_Off.png diff --git a/indra/newview/skins/default/textures/icons/ClipboardMenu_Press.png b/indra/newview/skins/default/textures/icons/ClipboardMenu_Press.png Binary files differindex ab02e7d42d..697bee3bbd 100644 --- a/indra/newview/skins/default/textures/icons/ClipboardMenu_Press.png +++ b/indra/newview/skins/default/textures/icons/ClipboardMenu_Press.png diff --git a/indra/newview/skins/default/textures/icons/ClipboardSmallMenu_Disabled.png b/indra/newview/skins/default/textures/icons/ClipboardSmallMenu_Disabled.png Binary files differindex 63b4bd2127..12cc1857d4 100644 --- a/indra/newview/skins/default/textures/icons/ClipboardSmallMenu_Disabled.png +++ b/indra/newview/skins/default/textures/icons/ClipboardSmallMenu_Disabled.png diff --git a/indra/newview/skins/default/textures/icons/ClipboardSmallMenu_Off.png b/indra/newview/skins/default/textures/icons/ClipboardSmallMenu_Off.png Binary files differindex 4200182b0c..7b40e33e11 100644 --- a/indra/newview/skins/default/textures/icons/ClipboardSmallMenu_Off.png +++ b/indra/newview/skins/default/textures/icons/ClipboardSmallMenu_Off.png diff --git a/indra/newview/skins/default/textures/icons/ClipboardSmallMenu_Press.png b/indra/newview/skins/default/textures/icons/ClipboardSmallMenu_Press.png Binary files differindex e12887f489..e030c44f01 100644 --- a/indra/newview/skins/default/textures/icons/ClipboardSmallMenu_Press.png +++ b/indra/newview/skins/default/textures/icons/ClipboardSmallMenu_Press.png diff --git a/indra/newview/skins/default/textures/icons/Conv_log_inbox.png b/indra/newview/skins/default/textures/icons/Conv_log_inbox.png Binary files differindex bb6ca28147..f4bbdc059d 100644 --- a/indra/newview/skins/default/textures/icons/Conv_log_inbox.png +++ b/indra/newview/skins/default/textures/icons/Conv_log_inbox.png diff --git a/indra/newview/skins/default/textures/icons/Conv_toolbar_add_person.png b/indra/newview/skins/default/textures/icons/Conv_toolbar_add_person.png Binary files differindex 0631f16f3b..acb3904e32 100644 --- a/indra/newview/skins/default/textures/icons/Conv_toolbar_add_person.png +++ b/indra/newview/skins/default/textures/icons/Conv_toolbar_add_person.png diff --git a/indra/newview/skins/default/textures/icons/Conv_toolbar_arrow_ne.png b/indra/newview/skins/default/textures/icons/Conv_toolbar_arrow_ne.png Binary files differindex 578482f5ed..70dec7cad1 100644 --- a/indra/newview/skins/default/textures/icons/Conv_toolbar_arrow_ne.png +++ b/indra/newview/skins/default/textures/icons/Conv_toolbar_arrow_ne.png diff --git a/indra/newview/skins/default/textures/icons/Conv_toolbar_arrow_sw.png b/indra/newview/skins/default/textures/icons/Conv_toolbar_arrow_sw.png Binary files differindex 7676131790..13d424832b 100644 --- a/indra/newview/skins/default/textures/icons/Conv_toolbar_arrow_sw.png +++ b/indra/newview/skins/default/textures/icons/Conv_toolbar_arrow_sw.png diff --git a/indra/newview/skins/default/textures/icons/Conv_toolbar_call_log.png b/indra/newview/skins/default/textures/icons/Conv_toolbar_call_log.png Binary files differindex 2880eb766a..1866dd965c 100644 --- a/indra/newview/skins/default/textures/icons/Conv_toolbar_call_log.png +++ b/indra/newview/skins/default/textures/icons/Conv_toolbar_call_log.png diff --git a/indra/newview/skins/default/textures/icons/Conv_toolbar_close.png b/indra/newview/skins/default/textures/icons/Conv_toolbar_close.png Binary files differindex d009c8f446..f4f2e2fd37 100644 --- a/indra/newview/skins/default/textures/icons/Conv_toolbar_close.png +++ b/indra/newview/skins/default/textures/icons/Conv_toolbar_close.png diff --git a/indra/newview/skins/default/textures/icons/Conv_toolbar_collapse.png b/indra/newview/skins/default/textures/icons/Conv_toolbar_collapse.png Binary files differindex 8d82960e28..3c427a3cc5 100644 --- a/indra/newview/skins/default/textures/icons/Conv_toolbar_collapse.png +++ b/indra/newview/skins/default/textures/icons/Conv_toolbar_collapse.png diff --git a/indra/newview/skins/default/textures/icons/Conv_toolbar_expand.png b/indra/newview/skins/default/textures/icons/Conv_toolbar_expand.png Binary files differindex f718d3fc60..6e8031b42c 100644 --- a/indra/newview/skins/default/textures/icons/Conv_toolbar_expand.png +++ b/indra/newview/skins/default/textures/icons/Conv_toolbar_expand.png diff --git a/indra/newview/skins/default/textures/icons/Conv_toolbar_hang_up.png b/indra/newview/skins/default/textures/icons/Conv_toolbar_hang_up.png Binary files differindex 315e2c581a..887a3b8335 100644 --- a/indra/newview/skins/default/textures/icons/Conv_toolbar_hang_up.png +++ b/indra/newview/skins/default/textures/icons/Conv_toolbar_hang_up.png diff --git a/indra/newview/skins/default/textures/icons/Conv_toolbar_open_call.png b/indra/newview/skins/default/textures/icons/Conv_toolbar_open_call.png Binary files differindex 732ab02a20..fc0da5a810 100644 --- a/indra/newview/skins/default/textures/icons/Conv_toolbar_open_call.png +++ b/indra/newview/skins/default/textures/icons/Conv_toolbar_open_call.png diff --git a/indra/newview/skins/default/textures/icons/Conv_toolbar_plus.png b/indra/newview/skins/default/textures/icons/Conv_toolbar_plus.png Binary files differindex 25a32cb2ba..6d45dbbff6 100644 --- a/indra/newview/skins/default/textures/icons/Conv_toolbar_plus.png +++ b/indra/newview/skins/default/textures/icons/Conv_toolbar_plus.png diff --git a/indra/newview/skins/default/textures/icons/Conv_toolbar_sort.png b/indra/newview/skins/default/textures/icons/Conv_toolbar_sort.png Binary files differindex 08debeb91f..e3e5f49741 100644 --- a/indra/newview/skins/default/textures/icons/Conv_toolbar_sort.png +++ b/indra/newview/skins/default/textures/icons/Conv_toolbar_sort.png diff --git a/indra/newview/skins/default/textures/icons/Copy.png b/indra/newview/skins/default/textures/icons/Copy.png Binary files differindex d45134e9dd..8448e70385 100644 --- a/indra/newview/skins/default/textures/icons/Copy.png +++ b/indra/newview/skins/default/textures/icons/Copy.png diff --git a/indra/newview/skins/default/textures/icons/CopyBright.png b/indra/newview/skins/default/textures/icons/CopyBright.png Binary files differindex 8d21c47295..ac65d68e0b 100644 --- a/indra/newview/skins/default/textures/icons/CopyBright.png +++ b/indra/newview/skins/default/textures/icons/CopyBright.png diff --git a/indra/newview/skins/default/textures/icons/Default_Outfit_Photo.png b/indra/newview/skins/default/textures/icons/Default_Outfit_Photo.png Binary files differindex bacddcbb68..1113b4effe 100644 --- a/indra/newview/skins/default/textures/icons/Default_Outfit_Photo.png +++ b/indra/newview/skins/default/textures/icons/Default_Outfit_Photo.png diff --git a/indra/newview/skins/default/textures/icons/DownArrow_Off.png b/indra/newview/skins/default/textures/icons/DownArrow_Off.png Binary files differindex 60f62eed4a..2e1e2964a0 100644 --- a/indra/newview/skins/default/textures/icons/DownArrow_Off.png +++ b/indra/newview/skins/default/textures/icons/DownArrow_Off.png diff --git a/indra/newview/skins/default/textures/icons/Edit_Wrench.png b/indra/newview/skins/default/textures/icons/Edit_Wrench.png Binary files differindex 42f8466969..2b9ba9dc10 100644 --- a/indra/newview/skins/default/textures/icons/Edit_Wrench.png +++ b/indra/newview/skins/default/textures/icons/Edit_Wrench.png diff --git a/indra/newview/skins/default/textures/icons/ExternalBrowser_Off.png b/indra/newview/skins/default/textures/icons/ExternalBrowser_Off.png Binary files differindex 69646ce473..dc4532b5a1 100644 --- a/indra/newview/skins/default/textures/icons/ExternalBrowser_Off.png +++ b/indra/newview/skins/default/textures/icons/ExternalBrowser_Off.png diff --git a/indra/newview/skins/default/textures/icons/Facebook.png b/indra/newview/skins/default/textures/icons/Facebook.png Binary files differindex 8287d56f88..9e51e3ac7f 100644 --- a/indra/newview/skins/default/textures/icons/Facebook.png +++ b/indra/newview/skins/default/textures/icons/Facebook.png diff --git a/indra/newview/skins/default/textures/icons/Female.png b/indra/newview/skins/default/textures/icons/Female.png Binary files differindex 67b5653a94..c9fef87b6e 100644 --- a/indra/newview/skins/default/textures/icons/Female.png +++ b/indra/newview/skins/default/textures/icons/Female.png diff --git a/indra/newview/skins/default/textures/icons/ForSale_Badge.png b/indra/newview/skins/default/textures/icons/ForSale_Badge.png Binary files differindex 5bee570cee..3b3a41c7c1 100644 --- a/indra/newview/skins/default/textures/icons/ForSale_Badge.png +++ b/indra/newview/skins/default/textures/icons/ForSale_Badge.png diff --git a/indra/newview/skins/default/textures/icons/ForwardArrow_Off.png b/indra/newview/skins/default/textures/icons/ForwardArrow_Off.png Binary files differindex e9b72b0401..c33320cf6e 100644 --- a/indra/newview/skins/default/textures/icons/ForwardArrow_Off.png +++ b/indra/newview/skins/default/textures/icons/ForwardArrow_Off.png diff --git a/indra/newview/skins/default/textures/icons/ForwardArrow_Press.png b/indra/newview/skins/default/textures/icons/ForwardArrow_Press.png Binary files differindex c7b2c769ae..86eb39c43a 100644 --- a/indra/newview/skins/default/textures/icons/ForwardArrow_Press.png +++ b/indra/newview/skins/default/textures/icons/ForwardArrow_Press.png diff --git a/indra/newview/skins/default/textures/icons/Generic_Group.png b/indra/newview/skins/default/textures/icons/Generic_Group.png Binary files differindex 9d76f75d0f..e96b7fc992 100644 --- a/indra/newview/skins/default/textures/icons/Generic_Group.png +++ b/indra/newview/skins/default/textures/icons/Generic_Group.png diff --git a/indra/newview/skins/default/textures/icons/Generic_Group_Large.png b/indra/newview/skins/default/textures/icons/Generic_Group_Large.png Binary files differindex 46ee6dfe2c..9396819bfb 100644 --- a/indra/newview/skins/default/textures/icons/Generic_Group_Large.png +++ b/indra/newview/skins/default/textures/icons/Generic_Group_Large.png diff --git a/indra/newview/skins/default/textures/icons/Generic_Object_Small.png b/indra/newview/skins/default/textures/icons/Generic_Object_Small.png Binary files differindex 223874e631..142390e3f3 100644 --- a/indra/newview/skins/default/textures/icons/Generic_Object_Small.png +++ b/indra/newview/skins/default/textures/icons/Generic_Object_Small.png diff --git a/indra/newview/skins/default/textures/icons/Generic_Person.png b/indra/newview/skins/default/textures/icons/Generic_Person.png Binary files differindex e1411354af..162735d979 100644 --- a/indra/newview/skins/default/textures/icons/Generic_Person.png +++ b/indra/newview/skins/default/textures/icons/Generic_Person.png diff --git a/indra/newview/skins/default/textures/icons/Generic_Person_Large.png b/indra/newview/skins/default/textures/icons/Generic_Person_Large.png Binary files differindex 532288b430..5be82418c1 100644 --- a/indra/newview/skins/default/textures/icons/Generic_Person_Large.png +++ b/indra/newview/skins/default/textures/icons/Generic_Person_Large.png diff --git a/indra/newview/skins/default/textures/icons/Hierarchy_View_Disabled.png b/indra/newview/skins/default/textures/icons/Hierarchy_View_Disabled.png Binary files differindex fb370f98d5..6d8ea5fd93 100644 --- a/indra/newview/skins/default/textures/icons/Hierarchy_View_Disabled.png +++ b/indra/newview/skins/default/textures/icons/Hierarchy_View_Disabled.png diff --git a/indra/newview/skins/default/textures/icons/Hierarchy_View_On.png b/indra/newview/skins/default/textures/icons/Hierarchy_View_On.png Binary files differindex ae8c8b4c1a..24f5210286 100644 --- a/indra/newview/skins/default/textures/icons/Hierarchy_View_On.png +++ b/indra/newview/skins/default/textures/icons/Hierarchy_View_On.png diff --git a/indra/newview/skins/default/textures/icons/Icon_For_Sale.png b/indra/newview/skins/default/textures/icons/Icon_For_Sale.png Binary files differindex 3dec6b989c..57a376f1bf 100644 --- a/indra/newview/skins/default/textures/icons/Icon_For_Sale.png +++ b/indra/newview/skins/default/textures/icons/Icon_For_Sale.png diff --git a/indra/newview/skins/default/textures/icons/Icon_Notification_Condense.png b/indra/newview/skins/default/textures/icons/Icon_Notification_Condense.png Binary files differindex 4d245eb57a..3a19e79f82 100644 --- a/indra/newview/skins/default/textures/icons/Icon_Notification_Condense.png +++ b/indra/newview/skins/default/textures/icons/Icon_Notification_Condense.png diff --git a/indra/newview/skins/default/textures/icons/Icon_Notification_Expand.png b/indra/newview/skins/default/textures/icons/Icon_Notification_Expand.png Binary files differindex 186822da43..f5331feb02 100644 --- a/indra/newview/skins/default/textures/icons/Icon_Notification_Expand.png +++ b/indra/newview/skins/default/textures/icons/Icon_Notification_Expand.png diff --git a/indra/newview/skins/default/textures/icons/Info.png b/indra/newview/skins/default/textures/icons/Info.png Binary files differindex e52560281b..e05a585f0b 100644 --- a/indra/newview/skins/default/textures/icons/Info.png +++ b/indra/newview/skins/default/textures/icons/Info.png diff --git a/indra/newview/skins/default/textures/icons/Info_Small.png b/indra/newview/skins/default/textures/icons/Info_Small.png Binary files differindex 81078c32dc..c4ce13e132 100644 --- a/indra/newview/skins/default/textures/icons/Info_Small.png +++ b/indra/newview/skins/default/textures/icons/Info_Small.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Alpha.png b/indra/newview/skins/default/textures/icons/Inv_Alpha.png Binary files differindex b65dc1929d..fdad36e2d3 100644 --- a/indra/newview/skins/default/textures/icons/Inv_Alpha.png +++ b/indra/newview/skins/default/textures/icons/Inv_Alpha.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Animation.png b/indra/newview/skins/default/textures/icons/Inv_Animation.png Binary files differindex ab42c61a92..6715c736e7 100644 --- a/indra/newview/skins/default/textures/icons/Inv_Animation.png +++ b/indra/newview/skins/default/textures/icons/Inv_Animation.png diff --git a/indra/newview/skins/default/textures/icons/Inv_BodyShape.png b/indra/newview/skins/default/textures/icons/Inv_BodyShape.png Binary files differindex 97e874d70d..cb908a39fb 100644 --- a/indra/newview/skins/default/textures/icons/Inv_BodyShape.png +++ b/indra/newview/skins/default/textures/icons/Inv_BodyShape.png diff --git a/indra/newview/skins/default/textures/icons/Inv_CallingCard.png b/indra/newview/skins/default/textures/icons/Inv_CallingCard.png Binary files differindex 1de96475f7..ee87f8e595 100644 --- a/indra/newview/skins/default/textures/icons/Inv_CallingCard.png +++ b/indra/newview/skins/default/textures/icons/Inv_CallingCard.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Clothing.png b/indra/newview/skins/default/textures/icons/Inv_Clothing.png Binary files differindex e8d246c6fa..430dca6b5e 100644 --- a/indra/newview/skins/default/textures/icons/Inv_Clothing.png +++ b/indra/newview/skins/default/textures/icons/Inv_Clothing.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Eye.png b/indra/newview/skins/default/textures/icons/Inv_Eye.png Binary files differindex e619f56c2b..d715f135d3 100644 --- a/indra/newview/skins/default/textures/icons/Inv_Eye.png +++ b/indra/newview/skins/default/textures/icons/Inv_Eye.png diff --git a/indra/newview/skins/default/textures/icons/Inv_FolderClosed.png b/indra/newview/skins/default/textures/icons/Inv_FolderClosed.png Binary files differindex 342a973d00..ec99eaee9e 100644 --- a/indra/newview/skins/default/textures/icons/Inv_FolderClosed.png +++ b/indra/newview/skins/default/textures/icons/Inv_FolderClosed.png diff --git a/indra/newview/skins/default/textures/icons/Inv_FolderOpen.png b/indra/newview/skins/default/textures/icons/Inv_FolderOpen.png Binary files differindex 0507c2cbaf..615a6ec11b 100644 --- a/indra/newview/skins/default/textures/icons/Inv_FolderOpen.png +++ b/indra/newview/skins/default/textures/icons/Inv_FolderOpen.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Gesture.png b/indra/newview/skins/default/textures/icons/Inv_Gesture.png Binary files differindex 52695ec19b..9fee34915e 100644 --- a/indra/newview/skins/default/textures/icons/Inv_Gesture.png +++ b/indra/newview/skins/default/textures/icons/Inv_Gesture.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Gloves.png b/indra/newview/skins/default/textures/icons/Inv_Gloves.png Binary files differindex d6a2113aaf..aa151d5404 100644 --- a/indra/newview/skins/default/textures/icons/Inv_Gloves.png +++ b/indra/newview/skins/default/textures/icons/Inv_Gloves.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Hair.png b/indra/newview/skins/default/textures/icons/Inv_Hair.png Binary files differindex ae941b0dd5..62b3ae81c2 100644 --- a/indra/newview/skins/default/textures/icons/Inv_Hair.png +++ b/indra/newview/skins/default/textures/icons/Inv_Hair.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Invalid.png b/indra/newview/skins/default/textures/icons/Inv_Invalid.png Binary files differindex 328be104ee..6ab5ba5217 100644 --- a/indra/newview/skins/default/textures/icons/Inv_Invalid.png +++ b/indra/newview/skins/default/textures/icons/Inv_Invalid.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Jacket.png b/indra/newview/skins/default/textures/icons/Inv_Jacket.png Binary files differindex 3859666f7c..26514f1c0f 100644 --- a/indra/newview/skins/default/textures/icons/Inv_Jacket.png +++ b/indra/newview/skins/default/textures/icons/Inv_Jacket.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Landmark.png b/indra/newview/skins/default/textures/icons/Inv_Landmark.png Binary files differindex 76df984596..338323fcee 100644 --- a/indra/newview/skins/default/textures/icons/Inv_Landmark.png +++ b/indra/newview/skins/default/textures/icons/Inv_Landmark.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Link.png b/indra/newview/skins/default/textures/icons/Inv_Link.png Binary files differindex 26bf4086fb..28c5f3635a 100644 --- a/indra/newview/skins/default/textures/icons/Inv_Link.png +++ b/indra/newview/skins/default/textures/icons/Inv_Link.png diff --git a/indra/newview/skins/default/textures/icons/Inv_LinkFolder.png b/indra/newview/skins/default/textures/icons/Inv_LinkFolder.png Binary files differindex 73a708782c..7c43ed3a43 100644 --- a/indra/newview/skins/default/textures/icons/Inv_LinkFolder.png +++ b/indra/newview/skins/default/textures/icons/Inv_LinkFolder.png diff --git a/indra/newview/skins/default/textures/icons/Inv_LinkItem.png b/indra/newview/skins/default/textures/icons/Inv_LinkItem.png Binary files differindex 73a708782c..7c43ed3a43 100644 --- a/indra/newview/skins/default/textures/icons/Inv_LinkItem.png +++ b/indra/newview/skins/default/textures/icons/Inv_LinkItem.png diff --git a/indra/newview/skins/default/textures/icons/Inv_LookFolderClosed.png b/indra/newview/skins/default/textures/icons/Inv_LookFolderClosed.png Binary files differindex f2ae828efc..46f2038279 100644 --- a/indra/newview/skins/default/textures/icons/Inv_LookFolderClosed.png +++ b/indra/newview/skins/default/textures/icons/Inv_LookFolderClosed.png diff --git a/indra/newview/skins/default/textures/icons/Inv_LookFolderOpen.png b/indra/newview/skins/default/textures/icons/Inv_LookFolderOpen.png Binary files differindex d454d4cd48..06a1b05983 100644 --- a/indra/newview/skins/default/textures/icons/Inv_LookFolderOpen.png +++ b/indra/newview/skins/default/textures/icons/Inv_LookFolderOpen.png diff --git a/indra/newview/skins/default/textures/icons/Inv_LostClosed.png b/indra/newview/skins/default/textures/icons/Inv_LostClosed.png Binary files differindex 42b5c88fdd..fc9a2a2156 100644 --- a/indra/newview/skins/default/textures/icons/Inv_LostClosed.png +++ b/indra/newview/skins/default/textures/icons/Inv_LostClosed.png diff --git a/indra/newview/skins/default/textures/icons/Inv_LostOpen.png b/indra/newview/skins/default/textures/icons/Inv_LostOpen.png Binary files differindex a52168d6c7..b15dc3cfa3 100644 --- a/indra/newview/skins/default/textures/icons/Inv_LostOpen.png +++ b/indra/newview/skins/default/textures/icons/Inv_LostOpen.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Material.png b/indra/newview/skins/default/textures/icons/Inv_Material.png Binary files differindex f5918ceaed..5cbb4fc5c9 100644 --- a/indra/newview/skins/default/textures/icons/Inv_Material.png +++ b/indra/newview/skins/default/textures/icons/Inv_Material.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Mesh.png b/indra/newview/skins/default/textures/icons/Inv_Mesh.png Binary files differindex 77e52264c3..69217d1cdc 100644 --- a/indra/newview/skins/default/textures/icons/Inv_Mesh.png +++ b/indra/newview/skins/default/textures/icons/Inv_Mesh.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Notecard.png b/indra/newview/skins/default/textures/icons/Inv_Notecard.png Binary files differindex 4645ab8e91..96f45bc55e 100644 --- a/indra/newview/skins/default/textures/icons/Inv_Notecard.png +++ b/indra/newview/skins/default/textures/icons/Inv_Notecard.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Object.png b/indra/newview/skins/default/textures/icons/Inv_Object.png Binary files differindex f883696a82..fe6b201570 100644 --- a/indra/newview/skins/default/textures/icons/Inv_Object.png +++ b/indra/newview/skins/default/textures/icons/Inv_Object.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Object_Multi.png b/indra/newview/skins/default/textures/icons/Inv_Object_Multi.png Binary files differindex 11f4871ad8..3793594059 100644 --- a/indra/newview/skins/default/textures/icons/Inv_Object_Multi.png +++ b/indra/newview/skins/default/textures/icons/Inv_Object_Multi.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Pants.png b/indra/newview/skins/default/textures/icons/Inv_Pants.png Binary files differindex fe2389f074..5673bc29ed 100644 --- a/indra/newview/skins/default/textures/icons/Inv_Pants.png +++ b/indra/newview/skins/default/textures/icons/Inv_Pants.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Physics.png b/indra/newview/skins/default/textures/icons/Inv_Physics.png Binary files differindex 360baec46d..43bd082d8a 100644 --- a/indra/newview/skins/default/textures/icons/Inv_Physics.png +++ b/indra/newview/skins/default/textures/icons/Inv_Physics.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Script.png b/indra/newview/skins/default/textures/icons/Inv_Script.png Binary files differindex 0fba27a7aa..68d2ac425f 100644 --- a/indra/newview/skins/default/textures/icons/Inv_Script.png +++ b/indra/newview/skins/default/textures/icons/Inv_Script.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Settings.png b/indra/newview/skins/default/textures/icons/Inv_Settings.png Binary files differindex c43ba349c4..ca6cf10314 100644 --- a/indra/newview/skins/default/textures/icons/Inv_Settings.png +++ b/indra/newview/skins/default/textures/icons/Inv_Settings.png diff --git a/indra/newview/skins/default/textures/icons/Inv_SettingsDay.png b/indra/newview/skins/default/textures/icons/Inv_SettingsDay.png Binary files differindex 258ade1327..d0c4b2cdcd 100644 --- a/indra/newview/skins/default/textures/icons/Inv_SettingsDay.png +++ b/indra/newview/skins/default/textures/icons/Inv_SettingsDay.png diff --git a/indra/newview/skins/default/textures/icons/Inv_SettingsSky.png b/indra/newview/skins/default/textures/icons/Inv_SettingsSky.png Binary files differindex 77858b23c3..5332404d37 100644 --- a/indra/newview/skins/default/textures/icons/Inv_SettingsSky.png +++ b/indra/newview/skins/default/textures/icons/Inv_SettingsSky.png diff --git a/indra/newview/skins/default/textures/icons/Inv_SettingsWater.png b/indra/newview/skins/default/textures/icons/Inv_SettingsWater.png Binary files differindex 46fb58c3f2..88ff803756 100644 --- a/indra/newview/skins/default/textures/icons/Inv_SettingsWater.png +++ b/indra/newview/skins/default/textures/icons/Inv_SettingsWater.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Shirt.png b/indra/newview/skins/default/textures/icons/Inv_Shirt.png Binary files differindex 81c1538dd2..ffabff9c6c 100644 --- a/indra/newview/skins/default/textures/icons/Inv_Shirt.png +++ b/indra/newview/skins/default/textures/icons/Inv_Shirt.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Shoe.png b/indra/newview/skins/default/textures/icons/Inv_Shoe.png Binary files differindex 1f52b0a6b6..784d1d23a3 100644 --- a/indra/newview/skins/default/textures/icons/Inv_Shoe.png +++ b/indra/newview/skins/default/textures/icons/Inv_Shoe.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Skin.png b/indra/newview/skins/default/textures/icons/Inv_Skin.png Binary files differindex b7da922046..a232c5ac67 100644 --- a/indra/newview/skins/default/textures/icons/Inv_Skin.png +++ b/indra/newview/skins/default/textures/icons/Inv_Skin.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Skirt.png b/indra/newview/skins/default/textures/icons/Inv_Skirt.png Binary files differindex 246e9a87aa..5970f39b1b 100644 --- a/indra/newview/skins/default/textures/icons/Inv_Skirt.png +++ b/indra/newview/skins/default/textures/icons/Inv_Skirt.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Snapshot.png b/indra/newview/skins/default/textures/icons/Inv_Snapshot.png Binary files differindex 39efd2be1b..9eaca9e7ef 100644 --- a/indra/newview/skins/default/textures/icons/Inv_Snapshot.png +++ b/indra/newview/skins/default/textures/icons/Inv_Snapshot.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Socks.png b/indra/newview/skins/default/textures/icons/Inv_Socks.png Binary files differindex 30d7d7c239..95a3a68de6 100644 --- a/indra/newview/skins/default/textures/icons/Inv_Socks.png +++ b/indra/newview/skins/default/textures/icons/Inv_Socks.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Sound.png b/indra/newview/skins/default/textures/icons/Inv_Sound.png Binary files differindex 44c271c868..138d4c5c36 100644 --- a/indra/newview/skins/default/textures/icons/Inv_Sound.png +++ b/indra/newview/skins/default/textures/icons/Inv_Sound.png diff --git a/indra/newview/skins/default/textures/icons/Inv_StockFolderClosed.png b/indra/newview/skins/default/textures/icons/Inv_StockFolderClosed.png Binary files differindex 4dc484dc22..c3aae7c736 100644 --- a/indra/newview/skins/default/textures/icons/Inv_StockFolderClosed.png +++ b/indra/newview/skins/default/textures/icons/Inv_StockFolderClosed.png diff --git a/indra/newview/skins/default/textures/icons/Inv_StockFolderOpen.png b/indra/newview/skins/default/textures/icons/Inv_StockFolderOpen.png Binary files differindex 0d140b56a7..15fd8225fc 100644 --- a/indra/newview/skins/default/textures/icons/Inv_StockFolderOpen.png +++ b/indra/newview/skins/default/textures/icons/Inv_StockFolderOpen.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Tattoo.png b/indra/newview/skins/default/textures/icons/Inv_Tattoo.png Binary files differindex a632197eb5..af5a780685 100644 --- a/indra/newview/skins/default/textures/icons/Inv_Tattoo.png +++ b/indra/newview/skins/default/textures/icons/Inv_Tattoo.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Texture.png b/indra/newview/skins/default/textures/icons/Inv_Texture.png Binary files differindex dbc41c5e99..168a97515a 100644 --- a/indra/newview/skins/default/textures/icons/Inv_Texture.png +++ b/indra/newview/skins/default/textures/icons/Inv_Texture.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Toolbar_SearchVisibility.png b/indra/newview/skins/default/textures/icons/Inv_Toolbar_SearchVisibility.png Binary files differindex 048da25c92..c4b186c3de 100644 --- a/indra/newview/skins/default/textures/icons/Inv_Toolbar_SearchVisibility.png +++ b/indra/newview/skins/default/textures/icons/Inv_Toolbar_SearchVisibility.png diff --git a/indra/newview/skins/default/textures/icons/Inv_TrashClosed.png b/indra/newview/skins/default/textures/icons/Inv_TrashClosed.png Binary files differindex 7a958c1ec0..89f0caa5a2 100644 --- a/indra/newview/skins/default/textures/icons/Inv_TrashClosed.png +++ b/indra/newview/skins/default/textures/icons/Inv_TrashClosed.png diff --git a/indra/newview/skins/default/textures/icons/Inv_TrashOpen.png b/indra/newview/skins/default/textures/icons/Inv_TrashOpen.png Binary files differindex 11e6bf33bc..d1f1eeaf42 100644 --- a/indra/newview/skins/default/textures/icons/Inv_TrashOpen.png +++ b/indra/newview/skins/default/textures/icons/Inv_TrashOpen.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Underpants.png b/indra/newview/skins/default/textures/icons/Inv_Underpants.png Binary files differindex b1e7c2a55f..77f8e55270 100644 --- a/indra/newview/skins/default/textures/icons/Inv_Underpants.png +++ b/indra/newview/skins/default/textures/icons/Inv_Underpants.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Undershirt.png b/indra/newview/skins/default/textures/icons/Inv_Undershirt.png Binary files differindex 9340dbb975..477d76cf11 100644 --- a/indra/newview/skins/default/textures/icons/Inv_Undershirt.png +++ b/indra/newview/skins/default/textures/icons/Inv_Undershirt.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Universal.png b/indra/newview/skins/default/textures/icons/Inv_Universal.png Binary files differindex 470febb9b5..65b2f88f02 100644 --- a/indra/newview/skins/default/textures/icons/Inv_Universal.png +++ b/indra/newview/skins/default/textures/icons/Inv_Universal.png diff --git a/indra/newview/skins/default/textures/icons/Inv_UnknownObject.png b/indra/newview/skins/default/textures/icons/Inv_UnknownObject.png Binary files differindex 10f2b31cb5..603a6d7aaa 100644 --- a/indra/newview/skins/default/textures/icons/Inv_UnknownObject.png +++ b/indra/newview/skins/default/textures/icons/Inv_UnknownObject.png diff --git a/indra/newview/skins/default/textures/icons/Inv_VersionFolderClosed.png b/indra/newview/skins/default/textures/icons/Inv_VersionFolderClosed.png Binary files differindex e89a4d7f31..cd561d24ba 100644 --- a/indra/newview/skins/default/textures/icons/Inv_VersionFolderClosed.png +++ b/indra/newview/skins/default/textures/icons/Inv_VersionFolderClosed.png diff --git a/indra/newview/skins/default/textures/icons/Inv_VersionFolderOpen.png b/indra/newview/skins/default/textures/icons/Inv_VersionFolderOpen.png Binary files differindex 659d7d392f..6dc9d451cc 100644 --- a/indra/newview/skins/default/textures/icons/Inv_VersionFolderOpen.png +++ b/indra/newview/skins/default/textures/icons/Inv_VersionFolderOpen.png diff --git a/indra/newview/skins/default/textures/icons/List_View_Disabled.png b/indra/newview/skins/default/textures/icons/List_View_Disabled.png Binary files differindex 155dee5047..125034b0cb 100644 --- a/indra/newview/skins/default/textures/icons/List_View_Disabled.png +++ b/indra/newview/skins/default/textures/icons/List_View_Disabled.png diff --git a/indra/newview/skins/default/textures/icons/List_View_On.png b/indra/newview/skins/default/textures/icons/List_View_On.png Binary files differindex 9127c92c3b..fcf77f004f 100644 --- a/indra/newview/skins/default/textures/icons/List_View_On.png +++ b/indra/newview/skins/default/textures/icons/List_View_On.png diff --git a/indra/newview/skins/default/textures/icons/Lock.png b/indra/newview/skins/default/textures/icons/Lock.png Binary files differindex eb5b5ae7a9..2db6ed0213 100644 --- a/indra/newview/skins/default/textures/icons/Lock.png +++ b/indra/newview/skins/default/textures/icons/Lock.png diff --git a/indra/newview/skins/default/textures/icons/Locked_Icon.png b/indra/newview/skins/default/textures/icons/Locked_Icon.png Binary files differindex 8ead280794..4985af1be1 100644 --- a/indra/newview/skins/default/textures/icons/Locked_Icon.png +++ b/indra/newview/skins/default/textures/icons/Locked_Icon.png diff --git a/indra/newview/skins/default/textures/icons/Male.png b/indra/newview/skins/default/textures/icons/Male.png Binary files differindex f3fad77fd0..803171f5c6 100644 --- a/indra/newview/skins/default/textures/icons/Male.png +++ b/indra/newview/skins/default/textures/icons/Male.png diff --git a/indra/newview/skins/default/textures/icons/Microphone_On.png b/indra/newview/skins/default/textures/icons/Microphone_On.png Binary files differindex c96b500fa1..7a7d39d982 100644 --- a/indra/newview/skins/default/textures/icons/Microphone_On.png +++ b/indra/newview/skins/default/textures/icons/Microphone_On.png diff --git a/indra/newview/skins/default/textures/icons/MinusItem_Disabled.png b/indra/newview/skins/default/textures/icons/MinusItem_Disabled.png Binary files differindex 75bd73cef1..b62ed35182 100644 --- a/indra/newview/skins/default/textures/icons/MinusItem_Disabled.png +++ b/indra/newview/skins/default/textures/icons/MinusItem_Disabled.png diff --git a/indra/newview/skins/default/textures/icons/MinusItem_Off.png b/indra/newview/skins/default/textures/icons/MinusItem_Off.png Binary files differindex 6f285f3546..eb7b8838f7 100644 --- a/indra/newview/skins/default/textures/icons/MinusItem_Off.png +++ b/indra/newview/skins/default/textures/icons/MinusItem_Off.png diff --git a/indra/newview/skins/default/textures/icons/MinusItem_Press.png b/indra/newview/skins/default/textures/icons/MinusItem_Press.png Binary files differindex 50f65765d5..2dc6081cb0 100644 --- a/indra/newview/skins/default/textures/icons/MinusItem_Press.png +++ b/indra/newview/skins/default/textures/icons/MinusItem_Press.png diff --git a/indra/newview/skins/default/textures/icons/OptionsMenu_Disabled.png b/indra/newview/skins/default/textures/icons/OptionsMenu_Disabled.png Binary files differindex fb341e9c83..5755315e23 100644 --- a/indra/newview/skins/default/textures/icons/OptionsMenu_Disabled.png +++ b/indra/newview/skins/default/textures/icons/OptionsMenu_Disabled.png diff --git a/indra/newview/skins/default/textures/icons/OptionsMenu_Off.png b/indra/newview/skins/default/textures/icons/OptionsMenu_Off.png Binary files differindex 25b055bfc0..2e9a5faa21 100644 --- a/indra/newview/skins/default/textures/icons/OptionsMenu_Off.png +++ b/indra/newview/skins/default/textures/icons/OptionsMenu_Off.png diff --git a/indra/newview/skins/default/textures/icons/OptionsMenu_Press.png b/indra/newview/skins/default/textures/icons/OptionsMenu_Press.png Binary files differindex 6e91dd7159..1b08648b51 100644 --- a/indra/newview/skins/default/textures/icons/OptionsMenu_Press.png +++ b/indra/newview/skins/default/textures/icons/OptionsMenu_Press.png diff --git a/indra/newview/skins/default/textures/icons/Parcel_BuildNo_Dark.png b/indra/newview/skins/default/textures/icons/Parcel_BuildNo_Dark.png Binary files differindex fb1f7d3a6d..dd12d94ad2 100644 --- a/indra/newview/skins/default/textures/icons/Parcel_BuildNo_Dark.png +++ b/indra/newview/skins/default/textures/icons/Parcel_BuildNo_Dark.png diff --git a/indra/newview/skins/default/textures/icons/Parcel_BuildNo_Light.png b/indra/newview/skins/default/textures/icons/Parcel_BuildNo_Light.png Binary files differindex e6f614b844..4739c501ad 100644 --- a/indra/newview/skins/default/textures/icons/Parcel_BuildNo_Light.png +++ b/indra/newview/skins/default/textures/icons/Parcel_BuildNo_Light.png diff --git a/indra/newview/skins/default/textures/icons/Parcel_Build_Dark.png b/indra/newview/skins/default/textures/icons/Parcel_Build_Dark.png Binary files differindex 84a96a60cb..9826491efd 100644 --- a/indra/newview/skins/default/textures/icons/Parcel_Build_Dark.png +++ b/indra/newview/skins/default/textures/icons/Parcel_Build_Dark.png diff --git a/indra/newview/skins/default/textures/icons/Parcel_DamageNo_Dark.png b/indra/newview/skins/default/textures/icons/Parcel_DamageNo_Dark.png Binary files differindex d55ebd7c67..7634e5fab0 100644 --- a/indra/newview/skins/default/textures/icons/Parcel_DamageNo_Dark.png +++ b/indra/newview/skins/default/textures/icons/Parcel_DamageNo_Dark.png diff --git a/indra/newview/skins/default/textures/icons/Parcel_Damage_Dark.png b/indra/newview/skins/default/textures/icons/Parcel_Damage_Dark.png Binary files differindex ae4077488b..7ecd645df2 100644 --- a/indra/newview/skins/default/textures/icons/Parcel_Damage_Dark.png +++ b/indra/newview/skins/default/textures/icons/Parcel_Damage_Dark.png diff --git a/indra/newview/skins/default/textures/icons/Parcel_Exp_Color.png b/indra/newview/skins/default/textures/icons/Parcel_Exp_Color.png Binary files differindex 4813d37198..a1b0faa008 100644 --- a/indra/newview/skins/default/textures/icons/Parcel_Exp_Color.png +++ b/indra/newview/skins/default/textures/icons/Parcel_Exp_Color.png diff --git a/indra/newview/skins/default/textures/icons/Parcel_FlyNo_Dark.png b/indra/newview/skins/default/textures/icons/Parcel_FlyNo_Dark.png Binary files differindex af65873cb6..831c25a34b 100644 --- a/indra/newview/skins/default/textures/icons/Parcel_FlyNo_Dark.png +++ b/indra/newview/skins/default/textures/icons/Parcel_FlyNo_Dark.png diff --git a/indra/newview/skins/default/textures/icons/Parcel_FlyNo_Light.png b/indra/newview/skins/default/textures/icons/Parcel_FlyNo_Light.png Binary files differindex 6ceb9d3d8f..be829fb5ef 100644 --- a/indra/newview/skins/default/textures/icons/Parcel_FlyNo_Light.png +++ b/indra/newview/skins/default/textures/icons/Parcel_FlyNo_Light.png diff --git a/indra/newview/skins/default/textures/icons/Parcel_Fly_Dark.png b/indra/newview/skins/default/textures/icons/Parcel_Fly_Dark.png Binary files differindex 7084e2f591..579bfe58f8 100644 --- a/indra/newview/skins/default/textures/icons/Parcel_Fly_Dark.png +++ b/indra/newview/skins/default/textures/icons/Parcel_Fly_Dark.png diff --git a/indra/newview/skins/default/textures/icons/Parcel_ForSale_Light.png b/indra/newview/skins/default/textures/icons/Parcel_ForSale_Light.png Binary files differindex d28e5357df..3f4ee0b482 100644 --- a/indra/newview/skins/default/textures/icons/Parcel_ForSale_Light.png +++ b/indra/newview/skins/default/textures/icons/Parcel_ForSale_Light.png diff --git a/indra/newview/skins/default/textures/icons/Parcel_Health_Dark.png b/indra/newview/skins/default/textures/icons/Parcel_Health_Dark.png Binary files differindex d72f02f708..98618de927 100644 --- a/indra/newview/skins/default/textures/icons/Parcel_Health_Dark.png +++ b/indra/newview/skins/default/textures/icons/Parcel_Health_Dark.png diff --git a/indra/newview/skins/default/textures/icons/Parcel_M_Dark.png b/indra/newview/skins/default/textures/icons/Parcel_M_Dark.png Binary files differindex 60e6a00a25..ab5a1680a7 100644 --- a/indra/newview/skins/default/textures/icons/Parcel_M_Dark.png +++ b/indra/newview/skins/default/textures/icons/Parcel_M_Dark.png diff --git a/indra/newview/skins/default/textures/icons/Parcel_M_Light.png b/indra/newview/skins/default/textures/icons/Parcel_M_Light.png Binary files differindex 55f97f3b4e..2db94e37c9 100644 --- a/indra/newview/skins/default/textures/icons/Parcel_M_Light.png +++ b/indra/newview/skins/default/textures/icons/Parcel_M_Light.png diff --git a/indra/newview/skins/default/textures/icons/Parcel_PG_Dark.png b/indra/newview/skins/default/textures/icons/Parcel_PG_Dark.png Binary files differindex 11ab1f1e60..e1f7613d04 100644 --- a/indra/newview/skins/default/textures/icons/Parcel_PG_Dark.png +++ b/indra/newview/skins/default/textures/icons/Parcel_PG_Dark.png diff --git a/indra/newview/skins/default/textures/icons/Parcel_PG_Light.png b/indra/newview/skins/default/textures/icons/Parcel_PG_Light.png Binary files differindex b536762ddc..04d13027d2 100644 --- a/indra/newview/skins/default/textures/icons/Parcel_PG_Light.png +++ b/indra/newview/skins/default/textures/icons/Parcel_PG_Light.png diff --git a/indra/newview/skins/default/textures/icons/Parcel_PushNo_Dark.png b/indra/newview/skins/default/textures/icons/Parcel_PushNo_Dark.png Binary files differindex 8f0fe6a04d..2867004014 100644 --- a/indra/newview/skins/default/textures/icons/Parcel_PushNo_Dark.png +++ b/indra/newview/skins/default/textures/icons/Parcel_PushNo_Dark.png diff --git a/indra/newview/skins/default/textures/icons/Parcel_PushNo_Light.png b/indra/newview/skins/default/textures/icons/Parcel_PushNo_Light.png Binary files differindex eba7070b4d..a3a51973af 100644 --- a/indra/newview/skins/default/textures/icons/Parcel_PushNo_Light.png +++ b/indra/newview/skins/default/textures/icons/Parcel_PushNo_Light.png diff --git a/indra/newview/skins/default/textures/icons/Parcel_Push_Dark.png b/indra/newview/skins/default/textures/icons/Parcel_Push_Dark.png Binary files differindex 08c2a18ac3..e8487ca092 100644 --- a/indra/newview/skins/default/textures/icons/Parcel_Push_Dark.png +++ b/indra/newview/skins/default/textures/icons/Parcel_Push_Dark.png diff --git a/indra/newview/skins/default/textures/icons/Parcel_R_Dark.png b/indra/newview/skins/default/textures/icons/Parcel_R_Dark.png Binary files differindex bf618752f6..5c165c2fac 100644 --- a/indra/newview/skins/default/textures/icons/Parcel_R_Dark.png +++ b/indra/newview/skins/default/textures/icons/Parcel_R_Dark.png diff --git a/indra/newview/skins/default/textures/icons/Parcel_R_Light.png b/indra/newview/skins/default/textures/icons/Parcel_R_Light.png Binary files differindex a67bbd0cc5..dbf43152b3 100644 --- a/indra/newview/skins/default/textures/icons/Parcel_R_Light.png +++ b/indra/newview/skins/default/textures/icons/Parcel_R_Light.png diff --git a/indra/newview/skins/default/textures/icons/Parcel_ScriptsNo_Dark.png b/indra/newview/skins/default/textures/icons/Parcel_ScriptsNo_Dark.png Binary files differindex 8f9f37a1bf..bfc55fc403 100644 --- a/indra/newview/skins/default/textures/icons/Parcel_ScriptsNo_Dark.png +++ b/indra/newview/skins/default/textures/icons/Parcel_ScriptsNo_Dark.png diff --git a/indra/newview/skins/default/textures/icons/Parcel_Scripts_Dark.png b/indra/newview/skins/default/textures/icons/Parcel_Scripts_Dark.png Binary files differindex 8b1d6c5e14..3477e0654c 100644 --- a/indra/newview/skins/default/textures/icons/Parcel_Scripts_Dark.png +++ b/indra/newview/skins/default/textures/icons/Parcel_Scripts_Dark.png diff --git a/indra/newview/skins/default/textures/icons/Parcel_SeeAVsOff_Dark.png b/indra/newview/skins/default/textures/icons/Parcel_SeeAVsOff_Dark.png Binary files differindex 60d056b573..eff089487e 100644 --- a/indra/newview/skins/default/textures/icons/Parcel_SeeAVsOff_Dark.png +++ b/indra/newview/skins/default/textures/icons/Parcel_SeeAVsOff_Dark.png diff --git a/indra/newview/skins/default/textures/icons/Parcel_SeeAVsOff_Light.png b/indra/newview/skins/default/textures/icons/Parcel_SeeAVsOff_Light.png Binary files differindex d004b0f750..68f0b14d44 100644 --- a/indra/newview/skins/default/textures/icons/Parcel_SeeAVsOff_Light.png +++ b/indra/newview/skins/default/textures/icons/Parcel_SeeAVsOff_Light.png diff --git a/indra/newview/skins/default/textures/icons/Parcel_SeeAVsOn_Dark.png b/indra/newview/skins/default/textures/icons/Parcel_SeeAVsOn_Dark.png Binary files differindex eed28765f7..200e04a59f 100644 --- a/indra/newview/skins/default/textures/icons/Parcel_SeeAVsOn_Dark.png +++ b/indra/newview/skins/default/textures/icons/Parcel_SeeAVsOn_Dark.png diff --git a/indra/newview/skins/default/textures/icons/Parcel_SeeAVsOn_Light.png b/indra/newview/skins/default/textures/icons/Parcel_SeeAVsOn_Light.png Binary files differindex e35de3c2fa..14cafc5bd2 100644 --- a/indra/newview/skins/default/textures/icons/Parcel_SeeAVsOn_Light.png +++ b/indra/newview/skins/default/textures/icons/Parcel_SeeAVsOn_Light.png diff --git a/indra/newview/skins/default/textures/icons/Parcel_VoiceNo_Dark.png b/indra/newview/skins/default/textures/icons/Parcel_VoiceNo_Dark.png Binary files differindex eace54ae79..ec316e822e 100644 --- a/indra/newview/skins/default/textures/icons/Parcel_VoiceNo_Dark.png +++ b/indra/newview/skins/default/textures/icons/Parcel_VoiceNo_Dark.png diff --git a/indra/newview/skins/default/textures/icons/Parcel_VoiceNo_Light.png b/indra/newview/skins/default/textures/icons/Parcel_VoiceNo_Light.png Binary files differindex 0d07e552b1..de3532a70b 100644 --- a/indra/newview/skins/default/textures/icons/Parcel_VoiceNo_Light.png +++ b/indra/newview/skins/default/textures/icons/Parcel_VoiceNo_Light.png diff --git a/indra/newview/skins/default/textures/icons/Parcel_Voice_Dark.png b/indra/newview/skins/default/textures/icons/Parcel_Voice_Dark.png Binary files differindex b36a9bd2f0..329620fa69 100644 --- a/indra/newview/skins/default/textures/icons/Parcel_Voice_Dark.png +++ b/indra/newview/skins/default/textures/icons/Parcel_Voice_Dark.png diff --git a/indra/newview/skins/default/textures/icons/Parcel_Voice_Light.png b/indra/newview/skins/default/textures/icons/Parcel_Voice_Light.png Binary files differindex 86ce19474a..81e0fa7bc4 100644 --- a/indra/newview/skins/default/textures/icons/Parcel_Voice_Light.png +++ b/indra/newview/skins/default/textures/icons/Parcel_Voice_Light.png diff --git a/indra/newview/skins/default/textures/icons/Pathfinding_Dirty.png b/indra/newview/skins/default/textures/icons/Pathfinding_Dirty.png Binary files differindex cfa12cb7cc..d8fee0fef7 100644 --- a/indra/newview/skins/default/textures/icons/Pathfinding_Dirty.png +++ b/indra/newview/skins/default/textures/icons/Pathfinding_Dirty.png diff --git a/indra/newview/skins/default/textures/icons/Pathfinding_Disabled.png b/indra/newview/skins/default/textures/icons/Pathfinding_Disabled.png Binary files differindex 0622141848..ea2ad79611 100644 --- a/indra/newview/skins/default/textures/icons/Pathfinding_Disabled.png +++ b/indra/newview/skins/default/textures/icons/Pathfinding_Disabled.png diff --git a/indra/newview/skins/default/textures/icons/Pause_Off.png b/indra/newview/skins/default/textures/icons/Pause_Off.png Binary files differindex 77f6be569d..5d44412783 100644 --- a/indra/newview/skins/default/textures/icons/Pause_Off.png +++ b/indra/newview/skins/default/textures/icons/Pause_Off.png diff --git a/indra/newview/skins/default/textures/icons/Pause_Over.png b/indra/newview/skins/default/textures/icons/Pause_Over.png Binary files differindex 580808bf7e..d1609a144b 100644 --- a/indra/newview/skins/default/textures/icons/Pause_Over.png +++ b/indra/newview/skins/default/textures/icons/Pause_Over.png diff --git a/indra/newview/skins/default/textures/icons/Pause_Press.png b/indra/newview/skins/default/textures/icons/Pause_Press.png Binary files differindex 859db34cae..6b918d1ae6 100644 --- a/indra/newview/skins/default/textures/icons/Pause_Press.png +++ b/indra/newview/skins/default/textures/icons/Pause_Press.png diff --git a/indra/newview/skins/default/textures/icons/Person_Check.png b/indra/newview/skins/default/textures/icons/Person_Check.png Binary files differindex d40eafe793..39a63a70cf 100644 --- a/indra/newview/skins/default/textures/icons/Person_Check.png +++ b/indra/newview/skins/default/textures/icons/Person_Check.png diff --git a/indra/newview/skins/default/textures/icons/Person_Star.png b/indra/newview/skins/default/textures/icons/Person_Star.png Binary files differindex e02935672f..c4e625b3c1 100644 --- a/indra/newview/skins/default/textures/icons/Person_Star.png +++ b/indra/newview/skins/default/textures/icons/Person_Star.png diff --git a/indra/newview/skins/default/textures/icons/Play_Off.png b/indra/newview/skins/default/textures/icons/Play_Off.png Binary files differindex e594c1a4cb..dac2f2d6db 100644 --- a/indra/newview/skins/default/textures/icons/Play_Off.png +++ b/indra/newview/skins/default/textures/icons/Play_Off.png diff --git a/indra/newview/skins/default/textures/icons/Play_Over.png b/indra/newview/skins/default/textures/icons/Play_Over.png Binary files differindex 70ab94e8c2..1d261efcda 100644 --- a/indra/newview/skins/default/textures/icons/Play_Over.png +++ b/indra/newview/skins/default/textures/icons/Play_Over.png diff --git a/indra/newview/skins/default/textures/icons/Play_Press.png b/indra/newview/skins/default/textures/icons/Play_Press.png Binary files differindex b52742c6da..f7251ce549 100644 --- a/indra/newview/skins/default/textures/icons/Play_Press.png +++ b/indra/newview/skins/default/textures/icons/Play_Press.png diff --git a/indra/newview/skins/default/textures/icons/Presets_Icon.png b/indra/newview/skins/default/textures/icons/Presets_Icon.png Binary files differindex 503ee892a5..13642e88d1 100644 --- a/indra/newview/skins/default/textures/icons/Presets_Icon.png +++ b/indra/newview/skins/default/textures/icons/Presets_Icon.png diff --git a/indra/newview/skins/default/textures/icons/Presets_Icon_Graphic.png b/indra/newview/skins/default/textures/icons/Presets_Icon_Graphic.png Binary files differindex 5a6628816b..96d1021f81 100644 --- a/indra/newview/skins/default/textures/icons/Presets_Icon_Graphic.png +++ b/indra/newview/skins/default/textures/icons/Presets_Icon_Graphic.png diff --git a/indra/newview/skins/default/textures/icons/Profile_Friend_Offline.png b/indra/newview/skins/default/textures/icons/Profile_Friend_Offline.png Binary files differindex aeba6b70f7..55d922cda7 100644 --- a/indra/newview/skins/default/textures/icons/Profile_Friend_Offline.png +++ b/indra/newview/skins/default/textures/icons/Profile_Friend_Offline.png diff --git a/indra/newview/skins/default/textures/icons/Profile_Friend_Online.png b/indra/newview/skins/default/textures/icons/Profile_Friend_Online.png Binary files differindex d668fd8dfa..febe8e78fa 100644 --- a/indra/newview/skins/default/textures/icons/Profile_Friend_Online.png +++ b/indra/newview/skins/default/textures/icons/Profile_Friend_Online.png diff --git a/indra/newview/skins/default/textures/icons/Profile_Perm_Find_Disabled.png b/indra/newview/skins/default/textures/icons/Profile_Perm_Find_Disabled.png Binary files differindex 8f8caa10d8..2632eb173b 100644 --- a/indra/newview/skins/default/textures/icons/Profile_Perm_Find_Disabled.png +++ b/indra/newview/skins/default/textures/icons/Profile_Perm_Find_Disabled.png diff --git a/indra/newview/skins/default/textures/icons/Profile_Perm_Find_Enabled.png b/indra/newview/skins/default/textures/icons/Profile_Perm_Find_Enabled.png Binary files differindex 42a209dda5..fd8b152c12 100644 --- a/indra/newview/skins/default/textures/icons/Profile_Perm_Find_Enabled.png +++ b/indra/newview/skins/default/textures/icons/Profile_Perm_Find_Enabled.png diff --git a/indra/newview/skins/default/textures/icons/Profile_Perm_Objects_Disabled.png b/indra/newview/skins/default/textures/icons/Profile_Perm_Objects_Disabled.png Binary files differindex 644edf0ef6..cef3ec4e5a 100644 --- a/indra/newview/skins/default/textures/icons/Profile_Perm_Objects_Disabled.png +++ b/indra/newview/skins/default/textures/icons/Profile_Perm_Objects_Disabled.png diff --git a/indra/newview/skins/default/textures/icons/Profile_Perm_Objects_Enabled.png b/indra/newview/skins/default/textures/icons/Profile_Perm_Objects_Enabled.png Binary files differindex 629c05ecb8..5821566703 100644 --- a/indra/newview/skins/default/textures/icons/Profile_Perm_Objects_Enabled.png +++ b/indra/newview/skins/default/textures/icons/Profile_Perm_Objects_Enabled.png diff --git a/indra/newview/skins/default/textures/icons/Profile_Perm_Online_Disabled.png b/indra/newview/skins/default/textures/icons/Profile_Perm_Online_Disabled.png Binary files differindex ecf66c0ee1..ea1b55eca0 100644 --- a/indra/newview/skins/default/textures/icons/Profile_Perm_Online_Disabled.png +++ b/indra/newview/skins/default/textures/icons/Profile_Perm_Online_Disabled.png diff --git a/indra/newview/skins/default/textures/icons/Profile_Perm_Online_Enabled.png b/indra/newview/skins/default/textures/icons/Profile_Perm_Online_Enabled.png Binary files differindex 26123938fa..eb3fc9e713 100644 --- a/indra/newview/skins/default/textures/icons/Profile_Perm_Online_Enabled.png +++ b/indra/newview/skins/default/textures/icons/Profile_Perm_Online_Enabled.png diff --git a/indra/newview/skins/default/textures/icons/Progress_1.png b/indra/newview/skins/default/textures/icons/Progress_1.png Binary files differindex 5d6efbfa2a..bc7a1e7e96 100644 --- a/indra/newview/skins/default/textures/icons/Progress_1.png +++ b/indra/newview/skins/default/textures/icons/Progress_1.png diff --git a/indra/newview/skins/default/textures/icons/Progress_10.png b/indra/newview/skins/default/textures/icons/Progress_10.png Binary files differindex 28203324f1..acf4d21aba 100644 --- a/indra/newview/skins/default/textures/icons/Progress_10.png +++ b/indra/newview/skins/default/textures/icons/Progress_10.png diff --git a/indra/newview/skins/default/textures/icons/Progress_11.png b/indra/newview/skins/default/textures/icons/Progress_11.png Binary files differindex 6b87be0c3f..1842cd09d0 100644 --- a/indra/newview/skins/default/textures/icons/Progress_11.png +++ b/indra/newview/skins/default/textures/icons/Progress_11.png diff --git a/indra/newview/skins/default/textures/icons/Progress_12.png b/indra/newview/skins/default/textures/icons/Progress_12.png Binary files differindex 089d58b090..0ea9dda83e 100644 --- a/indra/newview/skins/default/textures/icons/Progress_12.png +++ b/indra/newview/skins/default/textures/icons/Progress_12.png diff --git a/indra/newview/skins/default/textures/icons/Progress_2.png b/indra/newview/skins/default/textures/icons/Progress_2.png Binary files differindex 94cb73b1f7..29d6bbcbcb 100644 --- a/indra/newview/skins/default/textures/icons/Progress_2.png +++ b/indra/newview/skins/default/textures/icons/Progress_2.png diff --git a/indra/newview/skins/default/textures/icons/Progress_3.png b/indra/newview/skins/default/textures/icons/Progress_3.png Binary files differindex a04a5b5263..52a03125e9 100644 --- a/indra/newview/skins/default/textures/icons/Progress_3.png +++ b/indra/newview/skins/default/textures/icons/Progress_3.png diff --git a/indra/newview/skins/default/textures/icons/Progress_4.png b/indra/newview/skins/default/textures/icons/Progress_4.png Binary files differindex a467098d82..4b2798519f 100644 --- a/indra/newview/skins/default/textures/icons/Progress_4.png +++ b/indra/newview/skins/default/textures/icons/Progress_4.png diff --git a/indra/newview/skins/default/textures/icons/Progress_5.png b/indra/newview/skins/default/textures/icons/Progress_5.png Binary files differindex ea64f1d907..3f02b8f31a 100644 --- a/indra/newview/skins/default/textures/icons/Progress_5.png +++ b/indra/newview/skins/default/textures/icons/Progress_5.png diff --git a/indra/newview/skins/default/textures/icons/Progress_6.png b/indra/newview/skins/default/textures/icons/Progress_6.png Binary files differindex fe4447935f..04c8f716d4 100644 --- a/indra/newview/skins/default/textures/icons/Progress_6.png +++ b/indra/newview/skins/default/textures/icons/Progress_6.png diff --git a/indra/newview/skins/default/textures/icons/Progress_7.png b/indra/newview/skins/default/textures/icons/Progress_7.png Binary files differindex 64fa294771..c96b4c08d6 100644 --- a/indra/newview/skins/default/textures/icons/Progress_7.png +++ b/indra/newview/skins/default/textures/icons/Progress_7.png diff --git a/indra/newview/skins/default/textures/icons/Progress_8.png b/indra/newview/skins/default/textures/icons/Progress_8.png Binary files differindex a1c9a7f2eb..9463f50707 100644 --- a/indra/newview/skins/default/textures/icons/Progress_8.png +++ b/indra/newview/skins/default/textures/icons/Progress_8.png diff --git a/indra/newview/skins/default/textures/icons/Progress_9.png b/indra/newview/skins/default/textures/icons/Progress_9.png Binary files differindex f3e9723184..928a3e934e 100644 --- a/indra/newview/skins/default/textures/icons/Progress_9.png +++ b/indra/newview/skins/default/textures/icons/Progress_9.png diff --git a/indra/newview/skins/default/textures/icons/Refresh_Off.png b/indra/newview/skins/default/textures/icons/Refresh_Off.png Binary files differindex a8acfda741..e645a8159f 100644 --- a/indra/newview/skins/default/textures/icons/Refresh_Off.png +++ b/indra/newview/skins/default/textures/icons/Refresh_Off.png diff --git a/indra/newview/skins/default/textures/icons/Search_Icon.png b/indra/newview/skins/default/textures/icons/Search_Icon.png Binary files differindex 541aa8f52a..0ea7b14f81 100644 --- a/indra/newview/skins/default/textures/icons/Search_Icon.png +++ b/indra/newview/skins/default/textures/icons/Search_Icon.png diff --git a/indra/newview/skins/default/textures/icons/Shirt_Large.png b/indra/newview/skins/default/textures/icons/Shirt_Large.png Binary files differindex 0f3846bccc..06fce6bbaa 100644 --- a/indra/newview/skins/default/textures/icons/Shirt_Large.png +++ b/indra/newview/skins/default/textures/icons/Shirt_Large.png diff --git a/indra/newview/skins/default/textures/icons/Shop.png b/indra/newview/skins/default/textures/icons/Shop.png Binary files differindex 8977c49195..93353cf2fe 100644 --- a/indra/newview/skins/default/textures/icons/Shop.png +++ b/indra/newview/skins/default/textures/icons/Shop.png diff --git a/indra/newview/skins/default/textures/icons/SkipBackward_Off.png b/indra/newview/skins/default/textures/icons/SkipBackward_Off.png Binary files differindex 8fc10e6583..20fd2b8e22 100644 --- a/indra/newview/skins/default/textures/icons/SkipBackward_Off.png +++ b/indra/newview/skins/default/textures/icons/SkipBackward_Off.png diff --git a/indra/newview/skins/default/textures/icons/SkipForward_Off.png b/indra/newview/skins/default/textures/icons/SkipForward_Off.png Binary files differindex 2892e3cfa9..30e28d3d31 100644 --- a/indra/newview/skins/default/textures/icons/SkipForward_Off.png +++ b/indra/newview/skins/default/textures/icons/SkipForward_Off.png diff --git a/indra/newview/skins/default/textures/icons/StopReload_Off.png b/indra/newview/skins/default/textures/icons/StopReload_Off.png Binary files differindex 698569a540..500a81d715 100644 --- a/indra/newview/skins/default/textures/icons/StopReload_Off.png +++ b/indra/newview/skins/default/textures/icons/StopReload_Off.png diff --git a/indra/newview/skins/default/textures/icons/StopReload_Over.png b/indra/newview/skins/default/textures/icons/StopReload_Over.png Binary files differindex 251b38630a..a065a37d14 100644 --- a/indra/newview/skins/default/textures/icons/StopReload_Over.png +++ b/indra/newview/skins/default/textures/icons/StopReload_Over.png diff --git a/indra/newview/skins/default/textures/icons/Stop_Off.png b/indra/newview/skins/default/textures/icons/Stop_Off.png Binary files differindex 3ee215d36f..2d00083e2e 100644 --- a/indra/newview/skins/default/textures/icons/Stop_Off.png +++ b/indra/newview/skins/default/textures/icons/Stop_Off.png diff --git a/indra/newview/skins/default/textures/icons/Sync_Disabled.png b/indra/newview/skins/default/textures/icons/Sync_Disabled.png Binary files differindex ca2e8def97..7b39e7cd6f 100644 --- a/indra/newview/skins/default/textures/icons/Sync_Disabled.png +++ b/indra/newview/skins/default/textures/icons/Sync_Disabled.png diff --git a/indra/newview/skins/default/textures/icons/Sync_Progress_1.png b/indra/newview/skins/default/textures/icons/Sync_Progress_1.png Binary files differindex 624e556376..218edaa986 100644 --- a/indra/newview/skins/default/textures/icons/Sync_Progress_1.png +++ b/indra/newview/skins/default/textures/icons/Sync_Progress_1.png diff --git a/indra/newview/skins/default/textures/icons/Sync_Progress_2.png b/indra/newview/skins/default/textures/icons/Sync_Progress_2.png Binary files differindex 5769803b3f..23cb9d63c0 100644 --- a/indra/newview/skins/default/textures/icons/Sync_Progress_2.png +++ b/indra/newview/skins/default/textures/icons/Sync_Progress_2.png diff --git a/indra/newview/skins/default/textures/icons/Sync_Progress_3.png b/indra/newview/skins/default/textures/icons/Sync_Progress_3.png Binary files differindex 92d4bfb020..490826011a 100644 --- a/indra/newview/skins/default/textures/icons/Sync_Progress_3.png +++ b/indra/newview/skins/default/textures/icons/Sync_Progress_3.png diff --git a/indra/newview/skins/default/textures/icons/Sync_Progress_4.png b/indra/newview/skins/default/textures/icons/Sync_Progress_4.png Binary files differindex 6d43eb3a9f..de1c815e90 100644 --- a/indra/newview/skins/default/textures/icons/Sync_Progress_4.png +++ b/indra/newview/skins/default/textures/icons/Sync_Progress_4.png diff --git a/indra/newview/skins/default/textures/icons/Sync_Progress_5.png b/indra/newview/skins/default/textures/icons/Sync_Progress_5.png Binary files differindex 766d063c99..2897b37382 100644 --- a/indra/newview/skins/default/textures/icons/Sync_Progress_5.png +++ b/indra/newview/skins/default/textures/icons/Sync_Progress_5.png diff --git a/indra/newview/skins/default/textures/icons/Sync_Progress_6.png b/indra/newview/skins/default/textures/icons/Sync_Progress_6.png Binary files differindex dfe7f68b72..862410e9e4 100644 --- a/indra/newview/skins/default/textures/icons/Sync_Progress_6.png +++ b/indra/newview/skins/default/textures/icons/Sync_Progress_6.png diff --git a/indra/newview/skins/default/textures/icons/System_Notification_Large.png b/indra/newview/skins/default/textures/icons/System_Notification_Large.png Binary files differindex 434ce3e8b6..01c6e31f41 100644 --- a/indra/newview/skins/default/textures/icons/System_Notification_Large.png +++ b/indra/newview/skins/default/textures/icons/System_Notification_Large.png diff --git a/indra/newview/skins/default/textures/icons/System_Notification_Small.png b/indra/newview/skins/default/textures/icons/System_Notification_Small.png Binary files differindex 027a8446d8..69b823d852 100644 --- a/indra/newview/skins/default/textures/icons/System_Notification_Small.png +++ b/indra/newview/skins/default/textures/icons/System_Notification_Small.png diff --git a/indra/newview/skins/default/textures/icons/TrashItem_Disabled.png b/indra/newview/skins/default/textures/icons/TrashItem_Disabled.png Binary files differindex caaf45a99f..800d9434d2 100644 --- a/indra/newview/skins/default/textures/icons/TrashItem_Disabled.png +++ b/indra/newview/skins/default/textures/icons/TrashItem_Disabled.png diff --git a/indra/newview/skins/default/textures/icons/TrashItem_Off.png b/indra/newview/skins/default/textures/icons/TrashItem_Off.png Binary files differindex bb64920ec4..0cbff4f1d7 100644 --- a/indra/newview/skins/default/textures/icons/TrashItem_Off.png +++ b/indra/newview/skins/default/textures/icons/TrashItem_Off.png diff --git a/indra/newview/skins/default/textures/icons/TrashItem_Press.png b/indra/newview/skins/default/textures/icons/TrashItem_Press.png Binary files differindex c62f833d86..fac13226e7 100644 --- a/indra/newview/skins/default/textures/icons/TrashItem_Press.png +++ b/indra/newview/skins/default/textures/icons/TrashItem_Press.png diff --git a/indra/newview/skins/default/textures/icons/UnZoom_Off.png b/indra/newview/skins/default/textures/icons/UnZoom_Off.png Binary files differindex c794113755..34ec3f5de8 100644 --- a/indra/newview/skins/default/textures/icons/UnZoom_Off.png +++ b/indra/newview/skins/default/textures/icons/UnZoom_Off.png diff --git a/indra/newview/skins/default/textures/icons/UpArrow_Off.png b/indra/newview/skins/default/textures/icons/UpArrow_Off.png Binary files differindex 00015bce20..d5ddc353e7 100644 --- a/indra/newview/skins/default/textures/icons/UpArrow_Off.png +++ b/indra/newview/skins/default/textures/icons/UpArrow_Off.png diff --git a/indra/newview/skins/default/textures/icons/Video_URL_Off.png b/indra/newview/skins/default/textures/icons/Video_URL_Off.png Binary files differindex 40e5df7d81..d37a189645 100644 --- a/indra/newview/skins/default/textures/icons/Video_URL_Off.png +++ b/indra/newview/skins/default/textures/icons/Video_URL_Off.png diff --git a/indra/newview/skins/default/textures/icons/VoicePTT_Lvl3.png b/indra/newview/skins/default/textures/icons/VoicePTT_Lvl3.png Binary files differindex 14ec77b99a..a4a171bd81 100644 --- a/indra/newview/skins/default/textures/icons/VoicePTT_Lvl3.png +++ b/indra/newview/skins/default/textures/icons/VoicePTT_Lvl3.png diff --git a/indra/newview/skins/default/textures/icons/VoicePTT_Off.png b/indra/newview/skins/default/textures/icons/VoicePTT_Off.png Binary files differindex 48be51e9af..533663a4fa 100644 --- a/indra/newview/skins/default/textures/icons/VoicePTT_Off.png +++ b/indra/newview/skins/default/textures/icons/VoicePTT_Off.png diff --git a/indra/newview/skins/default/textures/icons/Web_Profile_Off.png b/indra/newview/skins/default/textures/icons/Web_Profile_Off.png Binary files differindex 5716dd6d22..cf8f9c8f94 100644 --- a/indra/newview/skins/default/textures/icons/Web_Profile_Off.png +++ b/indra/newview/skins/default/textures/icons/Web_Profile_Off.png diff --git a/indra/newview/skins/default/textures/icons/YouAreHere_Badge.png b/indra/newview/skins/default/textures/icons/YouAreHere_Badge.png Binary files differindex c057e9743d..ed1805c096 100644 --- a/indra/newview/skins/default/textures/icons/YouAreHere_Badge.png +++ b/indra/newview/skins/default/textures/icons/YouAreHere_Badge.png diff --git a/indra/newview/skins/default/textures/icons/Zoom_Off.png b/indra/newview/skins/default/textures/icons/Zoom_Off.png Binary files differindex d096720c9c..833e608201 100644 --- a/indra/newview/skins/default/textures/icons/Zoom_Off.png +++ b/indra/newview/skins/default/textures/icons/Zoom_Off.png diff --git a/indra/newview/skins/default/textures/icons/collapse_to_one_line.png b/indra/newview/skins/default/textures/icons/collapse_to_one_line.png Binary files differindex d57144a645..3730924ad8 100644 --- a/indra/newview/skins/default/textures/icons/collapse_to_one_line.png +++ b/indra/newview/skins/default/textures/icons/collapse_to_one_line.png diff --git a/indra/newview/skins/default/textures/icons/edit_mine.png b/indra/newview/skins/default/textures/icons/edit_mine.png Binary files differindex a0bc7efd25..2fb10deba2 100644 --- a/indra/newview/skins/default/textures/icons/edit_mine.png +++ b/indra/newview/skins/default/textures/icons/edit_mine.png diff --git a/indra/newview/skins/default/textures/icons/edit_theirs.png b/indra/newview/skins/default/textures/icons/edit_theirs.png Binary files differindex ed36ad7cfc..586c08c181 100644 --- a/indra/newview/skins/default/textures/icons/edit_theirs.png +++ b/indra/newview/skins/default/textures/icons/edit_theirs.png diff --git a/indra/newview/skins/default/textures/icons/emoji_picker_icon.png b/indra/newview/skins/default/textures/icons/emoji_picker_icon.png Binary files differindex ad4f3fa63c..6c1a1a3c62 100644 --- a/indra/newview/skins/default/textures/icons/emoji_picker_icon.png +++ b/indra/newview/skins/default/textures/icons/emoji_picker_icon.png diff --git a/indra/newview/skins/default/textures/icons/expand_one_liner.png b/indra/newview/skins/default/textures/icons/expand_one_liner.png Binary files differindex 58b7d90131..0d1a60547a 100644 --- a/indra/newview/skins/default/textures/icons/expand_one_liner.png +++ b/indra/newview/skins/default/textures/icons/expand_one_liner.png diff --git a/indra/newview/skins/default/textures/icons/map_placeholder.png b/indra/newview/skins/default/textures/icons/map_placeholder.png Binary files differindex 31e457aa75..80e5deac7e 100644 --- a/indra/newview/skins/default/textures/icons/map_placeholder.png +++ b/indra/newview/skins/default/textures/icons/map_placeholder.png diff --git a/indra/newview/skins/default/textures/icons/nearby_chat_icon.png b/indra/newview/skins/default/textures/icons/nearby_chat_icon.png Binary files differindex 5ac4258b9d..c5f52f010e 100644 --- a/indra/newview/skins/default/textures/icons/nearby_chat_icon.png +++ b/indra/newview/skins/default/textures/icons/nearby_chat_icon.png diff --git a/indra/newview/skins/default/textures/icons/object_icon.png b/indra/newview/skins/default/textures/icons/object_icon.png Binary files differindex 223874e631..51bf0b0649 100644 --- a/indra/newview/skins/default/textures/icons/object_icon.png +++ b/indra/newview/skins/default/textures/icons/object_icon.png diff --git a/indra/newview/skins/default/textures/icons/pop_up_caution.png b/indra/newview/skins/default/textures/icons/pop_up_caution.png Binary files differindex 8364bcc328..63b5cdfe83 100644 --- a/indra/newview/skins/default/textures/icons/pop_up_caution.png +++ b/indra/newview/skins/default/textures/icons/pop_up_caution.png diff --git a/indra/newview/skins/default/textures/icons/profile_group_visibility_eye_off.png b/indra/newview/skins/default/textures/icons/profile_group_visibility_eye_off.png Binary files differindex 3a2ed399b2..331553492c 100644 --- a/indra/newview/skins/default/textures/icons/profile_group_visibility_eye_off.png +++ b/indra/newview/skins/default/textures/icons/profile_group_visibility_eye_off.png diff --git a/indra/newview/skins/default/textures/icons/profile_group_visibility_eye_off_pressed.png b/indra/newview/skins/default/textures/icons/profile_group_visibility_eye_off_pressed.png Binary files differindex 789f59a491..e9e9c1b626 100644 --- a/indra/newview/skins/default/textures/icons/profile_group_visibility_eye_off_pressed.png +++ b/indra/newview/skins/default/textures/icons/profile_group_visibility_eye_off_pressed.png diff --git a/indra/newview/skins/default/textures/icons/profile_group_visibility_eye_on.png b/indra/newview/skins/default/textures/icons/profile_group_visibility_eye_on.png Binary files differindex 4fb56c389c..4f5374d614 100644 --- a/indra/newview/skins/default/textures/icons/profile_group_visibility_eye_on.png +++ b/indra/newview/skins/default/textures/icons/profile_group_visibility_eye_on.png diff --git a/indra/newview/skins/default/textures/icons/profile_group_visibility_eye_on_pressed.png b/indra/newview/skins/default/textures/icons/profile_group_visibility_eye_on_pressed.png Binary files differindex ae04a256a4..e8a64541ee 100644 --- a/indra/newview/skins/default/textures/icons/profile_group_visibility_eye_on_pressed.png +++ b/indra/newview/skins/default/textures/icons/profile_group_visibility_eye_on_pressed.png diff --git a/indra/newview/skins/default/textures/icons/unknown_icon.png b/indra/newview/skins/default/textures/icons/unknown_icon.png Binary files differindex 8441d86596..9a4e7f8616 100644 --- a/indra/newview/skins/default/textures/icons/unknown_icon.png +++ b/indra/newview/skins/default/textures/icons/unknown_icon.png diff --git a/indra/newview/skins/default/textures/widgets/Arrow_Down.png b/indra/newview/skins/default/textures/widgets/Arrow_Down.png Binary files differindex cb4eea953c..8b592ed840 100644 --- a/indra/newview/skins/default/textures/widgets/Arrow_Down.png +++ b/indra/newview/skins/default/textures/widgets/Arrow_Down.png diff --git a/indra/newview/skins/default/textures/widgets/Arrow_Left.png b/indra/newview/skins/default/textures/widgets/Arrow_Left.png Binary files differindex a424282839..04416541b9 100644 --- a/indra/newview/skins/default/textures/widgets/Arrow_Left.png +++ b/indra/newview/skins/default/textures/widgets/Arrow_Left.png diff --git a/indra/newview/skins/default/textures/widgets/Arrow_Right.png b/indra/newview/skins/default/textures/widgets/Arrow_Right.png Binary files differindex e32bee8f34..e57452a558 100644 --- a/indra/newview/skins/default/textures/widgets/Arrow_Right.png +++ b/indra/newview/skins/default/textures/widgets/Arrow_Right.png diff --git a/indra/newview/skins/default/textures/widgets/Arrow_Small_Left.png b/indra/newview/skins/default/textures/widgets/Arrow_Small_Left.png Binary files differindex 2d624c3779..a1b82d5101 100644 --- a/indra/newview/skins/default/textures/widgets/Arrow_Small_Left.png +++ b/indra/newview/skins/default/textures/widgets/Arrow_Small_Left.png diff --git a/indra/newview/skins/default/textures/widgets/Arrow_Small_Right.png b/indra/newview/skins/default/textures/widgets/Arrow_Small_Right.png Binary files differindex 91c03c426e..0e05d76852 100644 --- a/indra/newview/skins/default/textures/widgets/Arrow_Small_Right.png +++ b/indra/newview/skins/default/textures/widgets/Arrow_Small_Right.png diff --git a/indra/newview/skins/default/textures/widgets/Arrow_Small_Up.png b/indra/newview/skins/default/textures/widgets/Arrow_Small_Up.png Binary files differindex 38aac0e5ca..348bc4c019 100644 --- a/indra/newview/skins/default/textures/widgets/Arrow_Small_Up.png +++ b/indra/newview/skins/default/textures/widgets/Arrow_Small_Up.png diff --git a/indra/newview/skins/default/textures/widgets/Arrow_Up.png b/indra/newview/skins/default/textures/widgets/Arrow_Up.png Binary files differindex 48df69d82e..8b3da09d79 100644 --- a/indra/newview/skins/default/textures/widgets/Arrow_Up.png +++ b/indra/newview/skins/default/textures/widgets/Arrow_Up.png diff --git a/indra/newview/skins/default/textures/widgets/Badge_Background.png b/indra/newview/skins/default/textures/widgets/Badge_Background.png Binary files differindex 5089c30312..5abc1bf489 100644 --- a/indra/newview/skins/default/textures/widgets/Badge_Background.png +++ b/indra/newview/skins/default/textures/widgets/Badge_Background.png diff --git a/indra/newview/skins/default/textures/widgets/Badge_Border.png b/indra/newview/skins/default/textures/widgets/Badge_Border.png Binary files differindex 4b086a63fb..57d3be2320 100644 --- a/indra/newview/skins/default/textures/widgets/Badge_Border.png +++ b/indra/newview/skins/default/textures/widgets/Badge_Border.png diff --git a/indra/newview/skins/default/textures/widgets/BreadCrumbBtn_Left_Disabled.png b/indra/newview/skins/default/textures/widgets/BreadCrumbBtn_Left_Disabled.png Binary files differindex 3897e16801..139d71ae2e 100644 --- a/indra/newview/skins/default/textures/widgets/BreadCrumbBtn_Left_Disabled.png +++ b/indra/newview/skins/default/textures/widgets/BreadCrumbBtn_Left_Disabled.png diff --git a/indra/newview/skins/default/textures/widgets/BreadCrumbBtn_Middle_Disabled.png b/indra/newview/skins/default/textures/widgets/BreadCrumbBtn_Middle_Disabled.png Binary files differindex d570f77f6d..2cf3de24c0 100644 --- a/indra/newview/skins/default/textures/widgets/BreadCrumbBtn_Middle_Disabled.png +++ b/indra/newview/skins/default/textures/widgets/BreadCrumbBtn_Middle_Disabled.png diff --git a/indra/newview/skins/default/textures/widgets/BreadCrumbBtn_Right_Disabled.png b/indra/newview/skins/default/textures/widgets/BreadCrumbBtn_Right_Disabled.png Binary files differindex 2ffbc4a16f..d9c9692114 100644 --- a/indra/newview/skins/default/textures/widgets/BreadCrumbBtn_Right_Disabled.png +++ b/indra/newview/skins/default/textures/widgets/BreadCrumbBtn_Right_Disabled.png diff --git a/indra/newview/skins/default/textures/widgets/Checkbox_Disabled.png b/indra/newview/skins/default/textures/widgets/Checkbox_Disabled.png Binary files differindex c1ee210099..8439f82e29 100644 --- a/indra/newview/skins/default/textures/widgets/Checkbox_Disabled.png +++ b/indra/newview/skins/default/textures/widgets/Checkbox_Disabled.png diff --git a/indra/newview/skins/default/textures/widgets/Checkbox_Off.png b/indra/newview/skins/default/textures/widgets/Checkbox_Off.png Binary files differindex 2525405f37..cb9a04d84f 100644 --- a/indra/newview/skins/default/textures/widgets/Checkbox_Off.png +++ b/indra/newview/skins/default/textures/widgets/Checkbox_Off.png diff --git a/indra/newview/skins/default/textures/widgets/Checkbox_On.png b/indra/newview/skins/default/textures/widgets/Checkbox_On.png Binary files differindex 2d9dba1592..0ec090504a 100644 --- a/indra/newview/skins/default/textures/widgets/Checkbox_On.png +++ b/indra/newview/skins/default/textures/widgets/Checkbox_On.png diff --git a/indra/newview/skins/default/textures/widgets/Checkbox_On_Disabled.png b/indra/newview/skins/default/textures/widgets/Checkbox_On_Disabled.png Binary files differindex beaa7bcbf6..5759f7de69 100644 --- a/indra/newview/skins/default/textures/widgets/Checkbox_On_Disabled.png +++ b/indra/newview/skins/default/textures/widgets/Checkbox_On_Disabled.png diff --git a/indra/newview/skins/default/textures/widgets/Checkbox_On_Press.png b/indra/newview/skins/default/textures/widgets/Checkbox_On_Press.png Binary files differindex 5bced95a89..ba46e91c55 100644 --- a/indra/newview/skins/default/textures/widgets/Checkbox_On_Press.png +++ b/indra/newview/skins/default/textures/widgets/Checkbox_On_Press.png diff --git a/indra/newview/skins/default/textures/widgets/Checkbox_Press.png b/indra/newview/skins/default/textures/widgets/Checkbox_Press.png Binary files differindex 44be193678..5f5a33d878 100644 --- a/indra/newview/skins/default/textures/widgets/Checkbox_Press.png +++ b/indra/newview/skins/default/textures/widgets/Checkbox_Press.png diff --git a/indra/newview/skins/default/textures/widgets/ComboButton_Disabled.png b/indra/newview/skins/default/textures/widgets/ComboButton_Disabled.png Binary files differindex d0fff1b3c3..ebeb813349 100644 --- a/indra/newview/skins/default/textures/widgets/ComboButton_Disabled.png +++ b/indra/newview/skins/default/textures/widgets/ComboButton_Disabled.png diff --git a/indra/newview/skins/default/textures/widgets/ComboButton_Hover.png b/indra/newview/skins/default/textures/widgets/ComboButton_Hover.png Binary files differindex d492b30b40..1377d35e1a 100644 --- a/indra/newview/skins/default/textures/widgets/ComboButton_Hover.png +++ b/indra/newview/skins/default/textures/widgets/ComboButton_Hover.png diff --git a/indra/newview/skins/default/textures/widgets/ComboButton_Off.png b/indra/newview/skins/default/textures/widgets/ComboButton_Off.png Binary files differindex 80402458b7..4f573cf6fa 100644 --- a/indra/newview/skins/default/textures/widgets/ComboButton_Off.png +++ b/indra/newview/skins/default/textures/widgets/ComboButton_Off.png diff --git a/indra/newview/skins/default/textures/widgets/ComboButton_UpOff.png b/indra/newview/skins/default/textures/widgets/ComboButton_UpOff.png Binary files differindex 2330cb420b..5a067aca7c 100644 --- a/indra/newview/skins/default/textures/widgets/ComboButton_UpOff.png +++ b/indra/newview/skins/default/textures/widgets/ComboButton_UpOff.png diff --git a/indra/newview/skins/default/textures/widgets/DisclosureArrow_Opened_Off.png b/indra/newview/skins/default/textures/widgets/DisclosureArrow_Opened_Off.png Binary files differindex 75057938d2..115ec7a11f 100644 --- a/indra/newview/skins/default/textures/widgets/DisclosureArrow_Opened_Off.png +++ b/indra/newview/skins/default/textures/widgets/DisclosureArrow_Opened_Off.png diff --git a/indra/newview/skins/default/textures/widgets/DropDown_Disabled.png b/indra/newview/skins/default/textures/widgets/DropDown_Disabled.png Binary files differindex b295752ea9..9a69f7e0d9 100644 --- a/indra/newview/skins/default/textures/widgets/DropDown_Disabled.png +++ b/indra/newview/skins/default/textures/widgets/DropDown_Disabled.png diff --git a/indra/newview/skins/default/textures/widgets/DropDown_Off.png b/indra/newview/skins/default/textures/widgets/DropDown_Off.png Binary files differindex 4764ed4ee2..b118e7a7d4 100644 --- a/indra/newview/skins/default/textures/widgets/DropDown_Off.png +++ b/indra/newview/skins/default/textures/widgets/DropDown_Off.png diff --git a/indra/newview/skins/default/textures/widgets/DropTarget.png b/indra/newview/skins/default/textures/widgets/DropTarget.png Binary files differindex 3740c98cbc..01e7a88861 100644 --- a/indra/newview/skins/default/textures/widgets/DropTarget.png +++ b/indra/newview/skins/default/textures/widgets/DropTarget.png diff --git a/indra/newview/skins/default/textures/widgets/Error_Tag_Background.png b/indra/newview/skins/default/textures/widgets/Error_Tag_Background.png Binary files differindex c8dbc8e87a..439fce3dd3 100644 --- a/indra/newview/skins/default/textures/widgets/Error_Tag_Background.png +++ b/indra/newview/skins/default/textures/widgets/Error_Tag_Background.png diff --git a/indra/newview/skins/default/textures/widgets/Linden_Dollar_Alert.png b/indra/newview/skins/default/textures/widgets/Linden_Dollar_Alert.png Binary files differindex a1f21e8194..3b3f276e6d 100644 --- a/indra/newview/skins/default/textures/widgets/Linden_Dollar_Alert.png +++ b/indra/newview/skins/default/textures/widgets/Linden_Dollar_Alert.png diff --git a/indra/newview/skins/default/textures/widgets/MarketplaceBtn_Off.png b/indra/newview/skins/default/textures/widgets/MarketplaceBtn_Off.png Binary files differindex e603c44384..de71f763d3 100644 --- a/indra/newview/skins/default/textures/widgets/MarketplaceBtn_Off.png +++ b/indra/newview/skins/default/textures/widgets/MarketplaceBtn_Off.png diff --git a/indra/newview/skins/default/textures/widgets/Marketplace_Dropzone_Background.png b/indra/newview/skins/default/textures/widgets/Marketplace_Dropzone_Background.png Binary files differindex 9478f7b813..9eb4a5c55d 100644 --- a/indra/newview/skins/default/textures/widgets/Marketplace_Dropzone_Background.png +++ b/indra/newview/skins/default/textures/widgets/Marketplace_Dropzone_Background.png diff --git a/indra/newview/skins/default/textures/widgets/New_Tag_Background.png b/indra/newview/skins/default/textures/widgets/New_Tag_Background.png Binary files differindex cd639dd80f..3631d90825 100644 --- a/indra/newview/skins/default/textures/widgets/New_Tag_Background.png +++ b/indra/newview/skins/default/textures/widgets/New_Tag_Background.png diff --git a/indra/newview/skins/default/textures/widgets/New_Tag_Border.png b/indra/newview/skins/default/textures/widgets/New_Tag_Border.png Binary files differindex 56df0d0127..d9b78eeea4 100644 --- a/indra/newview/skins/default/textures/widgets/New_Tag_Border.png +++ b/indra/newview/skins/default/textures/widgets/New_Tag_Border.png diff --git a/indra/newview/skins/default/textures/widgets/ProgressBarSolid.png b/indra/newview/skins/default/textures/widgets/ProgressBarSolid.png Binary files differindex ec0926bfa1..59a798464d 100644 --- a/indra/newview/skins/default/textures/widgets/ProgressBarSolid.png +++ b/indra/newview/skins/default/textures/widgets/ProgressBarSolid.png diff --git a/indra/newview/skins/default/textures/widgets/ProgressTrack.png b/indra/newview/skins/default/textures/widgets/ProgressTrack.png Binary files differindex bb6d9f4144..f4be9f5ccd 100644 --- a/indra/newview/skins/default/textures/widgets/ProgressTrack.png +++ b/indra/newview/skins/default/textures/widgets/ProgressTrack.png diff --git a/indra/newview/skins/default/textures/widgets/PushButton_Disabled.png b/indra/newview/skins/default/textures/widgets/PushButton_Disabled.png Binary files differindex 04e91bdaab..e99ec4b14b 100644 --- a/indra/newview/skins/default/textures/widgets/PushButton_Disabled.png +++ b/indra/newview/skins/default/textures/widgets/PushButton_Disabled.png diff --git a/indra/newview/skins/default/textures/widgets/PushButton_Login.png b/indra/newview/skins/default/textures/widgets/PushButton_Login.png Binary files differindex 6f8b5a0770..8e7d932ab1 100644 --- a/indra/newview/skins/default/textures/widgets/PushButton_Login.png +++ b/indra/newview/skins/default/textures/widgets/PushButton_Login.png diff --git a/indra/newview/skins/default/textures/widgets/PushButton_Login_Over.png b/indra/newview/skins/default/textures/widgets/PushButton_Login_Over.png Binary files differindex e9e8af13d4..038ba23be2 100644 --- a/indra/newview/skins/default/textures/widgets/PushButton_Login_Over.png +++ b/indra/newview/skins/default/textures/widgets/PushButton_Login_Over.png diff --git a/indra/newview/skins/default/textures/widgets/PushButton_Login_Pressed.png b/indra/newview/skins/default/textures/widgets/PushButton_Login_Pressed.png Binary files differindex 4a9f1052b3..828aa1a139 100644 --- a/indra/newview/skins/default/textures/widgets/PushButton_Login_Pressed.png +++ b/indra/newview/skins/default/textures/widgets/PushButton_Login_Pressed.png diff --git a/indra/newview/skins/default/textures/widgets/RadioButton_Disabled.png b/indra/newview/skins/default/textures/widgets/RadioButton_Disabled.png Binary files differindex a1052684b9..32ec25fe0e 100644 --- a/indra/newview/skins/default/textures/widgets/RadioButton_Disabled.png +++ b/indra/newview/skins/default/textures/widgets/RadioButton_Disabled.png diff --git a/indra/newview/skins/default/textures/widgets/RadioButton_Off.png b/indra/newview/skins/default/textures/widgets/RadioButton_Off.png Binary files differindex c58e0305ef..5d267af5dc 100644 --- a/indra/newview/skins/default/textures/widgets/RadioButton_Off.png +++ b/indra/newview/skins/default/textures/widgets/RadioButton_Off.png diff --git a/indra/newview/skins/default/textures/widgets/RadioButton_On.png b/indra/newview/skins/default/textures/widgets/RadioButton_On.png Binary files differindex c09a2197c7..e6bf0db157 100644 --- a/indra/newview/skins/default/textures/widgets/RadioButton_On.png +++ b/indra/newview/skins/default/textures/widgets/RadioButton_On.png diff --git a/indra/newview/skins/default/textures/widgets/RadioButton_On_Disabled.png b/indra/newview/skins/default/textures/widgets/RadioButton_On_Disabled.png Binary files differindex d7d444fd0c..72aae43618 100644 --- a/indra/newview/skins/default/textures/widgets/RadioButton_On_Disabled.png +++ b/indra/newview/skins/default/textures/widgets/RadioButton_On_Disabled.png diff --git a/indra/newview/skins/default/textures/widgets/RadioButton_On_Press.png b/indra/newview/skins/default/textures/widgets/RadioButton_On_Press.png Binary files differindex a707e8ceb8..f3883b82b3 100644 --- a/indra/newview/skins/default/textures/widgets/RadioButton_On_Press.png +++ b/indra/newview/skins/default/textures/widgets/RadioButton_On_Press.png diff --git a/indra/newview/skins/default/textures/widgets/RadioButton_Press.png b/indra/newview/skins/default/textures/widgets/RadioButton_Press.png Binary files differindex 33eaa14030..0025256045 100644 --- a/indra/newview/skins/default/textures/widgets/RadioButton_Press.png +++ b/indra/newview/skins/default/textures/widgets/RadioButton_Press.png diff --git a/indra/newview/skins/default/textures/widgets/ScrollArrow_Down.png b/indra/newview/skins/default/textures/widgets/ScrollArrow_Down.png Binary files differindex 186822da43..768909d447 100644 --- a/indra/newview/skins/default/textures/widgets/ScrollArrow_Down.png +++ b/indra/newview/skins/default/textures/widgets/ScrollArrow_Down.png diff --git a/indra/newview/skins/default/textures/widgets/ScrollArrow_Down_Opaque.png b/indra/newview/skins/default/textures/widgets/ScrollArrow_Down_Opaque.png Binary files differindex a396380fb2..1c57521e9e 100644 --- a/indra/newview/skins/default/textures/widgets/ScrollArrow_Down_Opaque.png +++ b/indra/newview/skins/default/textures/widgets/ScrollArrow_Down_Opaque.png diff --git a/indra/newview/skins/default/textures/widgets/ScrollArrow_Down_Over_Opaque.png b/indra/newview/skins/default/textures/widgets/ScrollArrow_Down_Over_Opaque.png Binary files differindex 9568dea78a..3db7be9ffa 100644 --- a/indra/newview/skins/default/textures/widgets/ScrollArrow_Down_Over_Opaque.png +++ b/indra/newview/skins/default/textures/widgets/ScrollArrow_Down_Over_Opaque.png diff --git a/indra/newview/skins/default/textures/widgets/ScrollArrow_Left.png b/indra/newview/skins/default/textures/widgets/ScrollArrow_Left.png Binary files differindex 42f999a451..9ef73f48a5 100644 --- a/indra/newview/skins/default/textures/widgets/ScrollArrow_Left.png +++ b/indra/newview/skins/default/textures/widgets/ScrollArrow_Left.png diff --git a/indra/newview/skins/default/textures/widgets/ScrollArrow_Left_Opaque.png b/indra/newview/skins/default/textures/widgets/ScrollArrow_Left_Opaque.png Binary files differindex 549b3980f6..0fb0671036 100644 --- a/indra/newview/skins/default/textures/widgets/ScrollArrow_Left_Opaque.png +++ b/indra/newview/skins/default/textures/widgets/ScrollArrow_Left_Opaque.png diff --git a/indra/newview/skins/default/textures/widgets/ScrollArrow_Left_Over_Opaque.png b/indra/newview/skins/default/textures/widgets/ScrollArrow_Left_Over_Opaque.png Binary files differindex a74abd5d8a..464130c359 100644 --- a/indra/newview/skins/default/textures/widgets/ScrollArrow_Left_Over_Opaque.png +++ b/indra/newview/skins/default/textures/widgets/ScrollArrow_Left_Over_Opaque.png diff --git a/indra/newview/skins/default/textures/widgets/ScrollArrow_Right.png b/indra/newview/skins/default/textures/widgets/ScrollArrow_Right.png Binary files differindex 176ffcdbb9..8a59274b8a 100644 --- a/indra/newview/skins/default/textures/widgets/ScrollArrow_Right.png +++ b/indra/newview/skins/default/textures/widgets/ScrollArrow_Right.png diff --git a/indra/newview/skins/default/textures/widgets/ScrollArrow_Right_Opaque.png b/indra/newview/skins/default/textures/widgets/ScrollArrow_Right_Opaque.png Binary files differindex 36056d0ad9..ab1f1ac90b 100644 --- a/indra/newview/skins/default/textures/widgets/ScrollArrow_Right_Opaque.png +++ b/indra/newview/skins/default/textures/widgets/ScrollArrow_Right_Opaque.png diff --git a/indra/newview/skins/default/textures/widgets/ScrollArrow_Right_Over_Opaque.png b/indra/newview/skins/default/textures/widgets/ScrollArrow_Right_Over_Opaque.png Binary files differindex 0c1fd6956b..e5a94429a3 100644 --- a/indra/newview/skins/default/textures/widgets/ScrollArrow_Right_Over_Opaque.png +++ b/indra/newview/skins/default/textures/widgets/ScrollArrow_Right_Over_Opaque.png diff --git a/indra/newview/skins/default/textures/widgets/ScrollArrow_Up.png b/indra/newview/skins/default/textures/widgets/ScrollArrow_Up.png Binary files differindex 4d245eb57a..064580f0c8 100644 --- a/indra/newview/skins/default/textures/widgets/ScrollArrow_Up.png +++ b/indra/newview/skins/default/textures/widgets/ScrollArrow_Up.png diff --git a/indra/newview/skins/default/textures/widgets/ScrollArrow_Up_Opaque.png b/indra/newview/skins/default/textures/widgets/ScrollArrow_Up_Opaque.png Binary files differindex 67a7a5568b..2cc4857d27 100644 --- a/indra/newview/skins/default/textures/widgets/ScrollArrow_Up_Opaque.png +++ b/indra/newview/skins/default/textures/widgets/ScrollArrow_Up_Opaque.png diff --git a/indra/newview/skins/default/textures/widgets/ScrollArrow_Up_Over_Opaque.png b/indra/newview/skins/default/textures/widgets/ScrollArrow_Up_Over_Opaque.png Binary files differindex 0cc8c4404b..2018b53af9 100644 --- a/indra/newview/skins/default/textures/widgets/ScrollArrow_Up_Over_Opaque.png +++ b/indra/newview/skins/default/textures/widgets/ScrollArrow_Up_Over_Opaque.png diff --git a/indra/newview/skins/default/textures/widgets/ScrollThumb_Horiz.png b/indra/newview/skins/default/textures/widgets/ScrollThumb_Horiz.png Binary files differindex 8a085aa966..9afc907c1c 100644 --- a/indra/newview/skins/default/textures/widgets/ScrollThumb_Horiz.png +++ b/indra/newview/skins/default/textures/widgets/ScrollThumb_Horiz.png diff --git a/indra/newview/skins/default/textures/widgets/ScrollThumb_Vert.png b/indra/newview/skins/default/textures/widgets/ScrollThumb_Vert.png Binary files differindex fc7fd93e7a..ede643e528 100644 --- a/indra/newview/skins/default/textures/widgets/ScrollThumb_Vert.png +++ b/indra/newview/skins/default/textures/widgets/ScrollThumb_Vert.png diff --git a/indra/newview/skins/default/textures/widgets/ScrollTrack_Horiz.png b/indra/newview/skins/default/textures/widgets/ScrollTrack_Horiz.png Binary files differindex 4f31c48c02..35da770073 100644 --- a/indra/newview/skins/default/textures/widgets/ScrollTrack_Horiz.png +++ b/indra/newview/skins/default/textures/widgets/ScrollTrack_Horiz.png diff --git a/indra/newview/skins/default/textures/widgets/ScrollTrack_Vert.png b/indra/newview/skins/default/textures/widgets/ScrollTrack_Vert.png Binary files differindex f89ee3f68f..cf67c23133 100644 --- a/indra/newview/skins/default/textures/widgets/ScrollTrack_Vert.png +++ b/indra/newview/skins/default/textures/widgets/ScrollTrack_Vert.png diff --git a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_Disabled.png b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_Disabled.png Binary files differindex 3b39c51a77..ba63751690 100644 --- a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_Disabled.png +++ b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_Disabled.png diff --git a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_Off.png b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_Off.png Binary files differindex 57ed79d733..1a9f7e9d71 100644 --- a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_Off.png +++ b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_Off.png diff --git a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_Over.png b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_Over.png Binary files differindex 5b8878e0cb..e4fcf491ba 100644 --- a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_Over.png +++ b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_Over.png diff --git a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_Press.png b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_Press.png Binary files differindex 379953216b..dbe6651dc8 100644 --- a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_Press.png +++ b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_Press.png diff --git a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_Selected.png b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_Selected.png Binary files differindex 379953216b..dbe6651dc8 100644 --- a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_Selected.png +++ b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_Selected.png diff --git a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Middle_Disabled.png b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Middle_Disabled.png Binary files differindex deb87c8489..d9f05d33ec 100644 --- a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Middle_Disabled.png +++ b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Middle_Disabled.png diff --git a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Middle_Selected.png b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Middle_Selected.png Binary files differindex ca7027da91..d2342f6538 100644 --- a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Middle_Selected.png +++ b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Middle_Selected.png diff --git a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_Disabled.png b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_Disabled.png Binary files differindex 8e6b9c8c6f..ecd2144d6d 100644 --- a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_Disabled.png +++ b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_Disabled.png diff --git a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_Off.png b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_Off.png Binary files differindex b1521199ff..1901d5e843 100644 --- a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_Off.png +++ b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_Off.png diff --git a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_Over.png b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_Over.png Binary files differindex 2717e7d7b0..534c30cddc 100644 --- a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_Over.png +++ b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_Over.png diff --git a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_Press.png b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_Press.png Binary files differindex 3883518033..a97612ce2f 100644 --- a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_Press.png +++ b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_Press.png diff --git a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_Selected.png b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_Selected.png Binary files differindex 3883518033..a97612ce2f 100644 --- a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_Selected.png +++ b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_Selected.png diff --git a/indra/newview/skins/default/textures/widgets/SliderThumb_Disabled.png b/indra/newview/skins/default/textures/widgets/SliderThumb_Disabled.png Binary files differindex 8888e134d1..5cfa3ae4e1 100644 --- a/indra/newview/skins/default/textures/widgets/SliderThumb_Disabled.png +++ b/indra/newview/skins/default/textures/widgets/SliderThumb_Disabled.png diff --git a/indra/newview/skins/default/textures/widgets/SliderThumb_Off.png b/indra/newview/skins/default/textures/widgets/SliderThumb_Off.png Binary files differindex b627232012..66cdcbeb94 100644 --- a/indra/newview/skins/default/textures/widgets/SliderThumb_Off.png +++ b/indra/newview/skins/default/textures/widgets/SliderThumb_Off.png diff --git a/indra/newview/skins/default/textures/widgets/SliderThumb_Press.png b/indra/newview/skins/default/textures/widgets/SliderThumb_Press.png Binary files differindex 7081f9cfe0..0bf8e43e81 100644 --- a/indra/newview/skins/default/textures/widgets/SliderThumb_Press.png +++ b/indra/newview/skins/default/textures/widgets/SliderThumb_Press.png diff --git a/indra/newview/skins/default/textures/widgets/SliderTrack_Horiz.png b/indra/newview/skins/default/textures/widgets/SliderTrack_Horiz.png Binary files differindex 232006ee5a..720830f83f 100644 --- a/indra/newview/skins/default/textures/widgets/SliderTrack_Horiz.png +++ b/indra/newview/skins/default/textures/widgets/SliderTrack_Horiz.png diff --git a/indra/newview/skins/default/textures/widgets/SliderTrack_Vert.png b/indra/newview/skins/default/textures/widgets/SliderTrack_Vert.png Binary files differindex cd002b3973..c01db44707 100644 --- a/indra/newview/skins/default/textures/widgets/SliderTrack_Vert.png +++ b/indra/newview/skins/default/textures/widgets/SliderTrack_Vert.png diff --git a/indra/newview/skins/default/textures/widgets/TextField_Search_Active.png b/indra/newview/skins/default/textures/widgets/TextField_Search_Active.png Binary files differindex fa79cb6260..572535f1ab 100644 --- a/indra/newview/skins/default/textures/widgets/TextField_Search_Active.png +++ b/indra/newview/skins/default/textures/widgets/TextField_Search_Active.png diff --git a/indra/newview/skins/default/textures/widgets/TextField_Search_Disabled.png b/indra/newview/skins/default/textures/widgets/TextField_Search_Disabled.png Binary files differindex 8b504af101..94b4b158f7 100644 --- a/indra/newview/skins/default/textures/widgets/TextField_Search_Disabled.png +++ b/indra/newview/skins/default/textures/widgets/TextField_Search_Disabled.png diff --git a/indra/newview/skins/default/textures/widgets/TextField_Search_Highlight.png b/indra/newview/skins/default/textures/widgets/TextField_Search_Highlight.png Binary files differindex e3944289c6..7768da04e8 100644 --- a/indra/newview/skins/default/textures/widgets/TextField_Search_Highlight.png +++ b/indra/newview/skins/default/textures/widgets/TextField_Search_Highlight.png diff --git a/indra/newview/skins/default/textures/widgets/TextField_Search_Off.png b/indra/newview/skins/default/textures/widgets/TextField_Search_Off.png Binary files differindex 862b13d219..fccd38c807 100644 --- a/indra/newview/skins/default/textures/widgets/TextField_Search_Off.png +++ b/indra/newview/skins/default/textures/widgets/TextField_Search_Off.png diff --git a/indra/newview/skins/default/textures/widgets/Tooltip.png b/indra/newview/skins/default/textures/widgets/Tooltip.png Binary files differindex 3c4d6a965d..1be53bdaa2 100644 --- a/indra/newview/skins/default/textures/widgets/Tooltip.png +++ b/indra/newview/skins/default/textures/widgets/Tooltip.png diff --git a/indra/newview/skins/default/textures/widgets/bevel_background.png b/indra/newview/skins/default/textures/widgets/bevel_background.png Binary files differindex fb5067503d..6304124aec 100644 --- a/indra/newview/skins/default/textures/widgets/bevel_background.png +++ b/indra/newview/skins/default/textures/widgets/bevel_background.png diff --git a/indra/newview/skins/default/textures/widgets/horizontal_drag_handle.png b/indra/newview/skins/default/textures/widgets/horizontal_drag_handle.png Binary files differindex 5f5a33be42..631d653968 100644 --- a/indra/newview/skins/default/textures/widgets/horizontal_drag_handle.png +++ b/indra/newview/skins/default/textures/widgets/horizontal_drag_handle.png diff --git a/indra/newview/skins/default/textures/widgets/jump_left_in.png b/indra/newview/skins/default/textures/widgets/jump_left_in.png Binary files differindex a1425ccfa0..073606628c 100644 --- a/indra/newview/skins/default/textures/widgets/jump_left_in.png +++ b/indra/newview/skins/default/textures/widgets/jump_left_in.png diff --git a/indra/newview/skins/default/textures/widgets/jump_left_out.png b/indra/newview/skins/default/textures/widgets/jump_left_out.png Binary files differindex 38edf47d19..71d5c5c36a 100644 --- a/indra/newview/skins/default/textures/widgets/jump_left_out.png +++ b/indra/newview/skins/default/textures/widgets/jump_left_out.png diff --git a/indra/newview/skins/default/textures/widgets/jump_right_in.png b/indra/newview/skins/default/textures/widgets/jump_right_in.png Binary files differindex 39359ab2e2..96f8501932 100644 --- a/indra/newview/skins/default/textures/widgets/jump_right_in.png +++ b/indra/newview/skins/default/textures/widgets/jump_right_in.png diff --git a/indra/newview/skins/default/textures/widgets/jump_right_out.png b/indra/newview/skins/default/textures/widgets/jump_right_out.png Binary files differindex 3f76bbffac..9c02f5f649 100644 --- a/indra/newview/skins/default/textures/widgets/jump_right_out.png +++ b/indra/newview/skins/default/textures/widgets/jump_right_out.png diff --git a/indra/newview/skins/default/textures/widgets/track_control_moon_back.png b/indra/newview/skins/default/textures/widgets/track_control_moon_back.png Binary files differindex 30f538d35b..03d1e805e1 100644 --- a/indra/newview/skins/default/textures/widgets/track_control_moon_back.png +++ b/indra/newview/skins/default/textures/widgets/track_control_moon_back.png diff --git a/indra/newview/skins/default/textures/widgets/track_control_moon_front.png b/indra/newview/skins/default/textures/widgets/track_control_moon_front.png Binary files differindex d3882c5e4c..cdc52fe08a 100644 --- a/indra/newview/skins/default/textures/widgets/track_control_moon_front.png +++ b/indra/newview/skins/default/textures/widgets/track_control_moon_front.png diff --git a/indra/newview/skins/default/textures/widgets/track_control_rotate_bottom.png b/indra/newview/skins/default/textures/widgets/track_control_rotate_bottom.png Binary files differindex 232c812aae..c08b54c269 100644 --- a/indra/newview/skins/default/textures/widgets/track_control_rotate_bottom.png +++ b/indra/newview/skins/default/textures/widgets/track_control_rotate_bottom.png diff --git a/indra/newview/skins/default/textures/widgets/track_control_rotate_bottom_active.png b/indra/newview/skins/default/textures/widgets/track_control_rotate_bottom_active.png Binary files differindex 911618b08e..a2b37d1b43 100644 --- a/indra/newview/skins/default/textures/widgets/track_control_rotate_bottom_active.png +++ b/indra/newview/skins/default/textures/widgets/track_control_rotate_bottom_active.png diff --git a/indra/newview/skins/default/textures/widgets/track_control_rotate_left_side.png b/indra/newview/skins/default/textures/widgets/track_control_rotate_left_side.png Binary files differindex bcc78fc5e4..3439e8717f 100644 --- a/indra/newview/skins/default/textures/widgets/track_control_rotate_left_side.png +++ b/indra/newview/skins/default/textures/widgets/track_control_rotate_left_side.png diff --git a/indra/newview/skins/default/textures/widgets/track_control_rotate_left_side_active.png b/indra/newview/skins/default/textures/widgets/track_control_rotate_left_side_active.png Binary files differindex 2fe04b93f1..fa745175be 100644 --- a/indra/newview/skins/default/textures/widgets/track_control_rotate_left_side_active.png +++ b/indra/newview/skins/default/textures/widgets/track_control_rotate_left_side_active.png diff --git a/indra/newview/skins/default/textures/widgets/track_control_rotate_right_side.png b/indra/newview/skins/default/textures/widgets/track_control_rotate_right_side.png Binary files differindex d0827abf28..f92fdb3d92 100644 --- a/indra/newview/skins/default/textures/widgets/track_control_rotate_right_side.png +++ b/indra/newview/skins/default/textures/widgets/track_control_rotate_right_side.png diff --git a/indra/newview/skins/default/textures/widgets/track_control_rotate_right_side_active.png b/indra/newview/skins/default/textures/widgets/track_control_rotate_right_side_active.png Binary files differindex 824051562f..23571d6473 100644 --- a/indra/newview/skins/default/textures/widgets/track_control_rotate_right_side_active.png +++ b/indra/newview/skins/default/textures/widgets/track_control_rotate_right_side_active.png diff --git a/indra/newview/skins/default/textures/widgets/track_control_rotate_top.png b/indra/newview/skins/default/textures/widgets/track_control_rotate_top.png Binary files differindex 13a5e9c2e8..ae67084a7d 100644 --- a/indra/newview/skins/default/textures/widgets/track_control_rotate_top.png +++ b/indra/newview/skins/default/textures/widgets/track_control_rotate_top.png diff --git a/indra/newview/skins/default/textures/widgets/track_control_rotate_top_active.png b/indra/newview/skins/default/textures/widgets/track_control_rotate_top_active.png Binary files differindex 9a7493703b..4e1d0ad096 100644 --- a/indra/newview/skins/default/textures/widgets/track_control_rotate_top_active.png +++ b/indra/newview/skins/default/textures/widgets/track_control_rotate_top_active.png diff --git a/indra/newview/skins/default/textures/widgets/track_control_sun_back.png b/indra/newview/skins/default/textures/widgets/track_control_sun_back.png Binary files differindex 23c89068f8..b3191ccc5d 100644 --- a/indra/newview/skins/default/textures/widgets/track_control_sun_back.png +++ b/indra/newview/skins/default/textures/widgets/track_control_sun_back.png diff --git a/indra/newview/skins/default/textures/widgets/track_control_sun_front.png b/indra/newview/skins/default/textures/widgets/track_control_sun_front.png Binary files differindex 6dfdc04423..1cdcbf7861 100644 --- a/indra/newview/skins/default/textures/widgets/track_control_sun_front.png +++ b/indra/newview/skins/default/textures/widgets/track_control_sun_front.png diff --git a/indra/newview/skins/default/textures/widgets/vertical_drag_handle.png b/indra/newview/skins/default/textures/widgets/vertical_drag_handle.png Binary files differindex 2ce5208c21..d78e898a9c 100644 --- a/indra/newview/skins/default/textures/widgets/vertical_drag_handle.png +++ b/indra/newview/skins/default/textures/widgets/vertical_drag_handle.png diff --git a/indra/newview/skins/default/textures/windows/Dragbar.png b/indra/newview/skins/default/textures/windows/Dragbar.png Binary files differindex d94dda1aae..3a998abdc3 100644 --- a/indra/newview/skins/default/textures/windows/Dragbar.png +++ b/indra/newview/skins/default/textures/windows/Dragbar.png diff --git a/indra/newview/skins/default/textures/windows/Flyout_Left.png b/indra/newview/skins/default/textures/windows/Flyout_Left.png Binary files differindex 6ac9fe2efd..3110d7f6b5 100644 --- a/indra/newview/skins/default/textures/windows/Flyout_Left.png +++ b/indra/newview/skins/default/textures/windows/Flyout_Left.png diff --git a/indra/newview/skins/default/textures/windows/Flyout_Pointer.png b/indra/newview/skins/default/textures/windows/Flyout_Pointer.png Binary files differindex 69fc08ceaa..4076bb393e 100644 --- a/indra/newview/skins/default/textures/windows/Flyout_Pointer.png +++ b/indra/newview/skins/default/textures/windows/Flyout_Pointer.png diff --git a/indra/newview/skins/default/textures/windows/Flyout_Right.png b/indra/newview/skins/default/textures/windows/Flyout_Right.png Binary files differindex aa1f0625aa..4c55cd6287 100644 --- a/indra/newview/skins/default/textures/windows/Flyout_Right.png +++ b/indra/newview/skins/default/textures/windows/Flyout_Right.png diff --git a/indra/newview/skins/default/textures/windows/Icon_Close_Foreground.png b/indra/newview/skins/default/textures/windows/Icon_Close_Foreground.png Binary files differindex 3534b716fd..cb516886a2 100644 --- a/indra/newview/skins/default/textures/windows/Icon_Close_Foreground.png +++ b/indra/newview/skins/default/textures/windows/Icon_Close_Foreground.png diff --git a/indra/newview/skins/default/textures/windows/Icon_Close_Press.png b/indra/newview/skins/default/textures/windows/Icon_Close_Press.png Binary files differindex ea547fca6f..283981f6ea 100644 --- a/indra/newview/skins/default/textures/windows/Icon_Close_Press.png +++ b/indra/newview/skins/default/textures/windows/Icon_Close_Press.png diff --git a/indra/newview/skins/default/textures/windows/Icon_Close_Toast.png b/indra/newview/skins/default/textures/windows/Icon_Close_Toast.png Binary files differindex ecf01c617a..b08ffbc742 100644 --- a/indra/newview/skins/default/textures/windows/Icon_Close_Toast.png +++ b/indra/newview/skins/default/textures/windows/Icon_Close_Toast.png diff --git a/indra/newview/skins/default/textures/windows/Icon_Dock_Foreground.png b/indra/newview/skins/default/textures/windows/Icon_Dock_Foreground.png Binary files differindex 4207ba68e5..7508fcb25e 100644 --- a/indra/newview/skins/default/textures/windows/Icon_Dock_Foreground.png +++ b/indra/newview/skins/default/textures/windows/Icon_Dock_Foreground.png diff --git a/indra/newview/skins/default/textures/windows/Icon_Dock_Press.png b/indra/newview/skins/default/textures/windows/Icon_Dock_Press.png Binary files differindex 2d09475783..3f2c560398 100644 --- a/indra/newview/skins/default/textures/windows/Icon_Dock_Press.png +++ b/indra/newview/skins/default/textures/windows/Icon_Dock_Press.png diff --git a/indra/newview/skins/default/textures/windows/Icon_Gear.png b/indra/newview/skins/default/textures/windows/Icon_Gear.png Binary files differindex e1e89b8f32..7cf85bece4 100644 --- a/indra/newview/skins/default/textures/windows/Icon_Gear.png +++ b/indra/newview/skins/default/textures/windows/Icon_Gear.png diff --git a/indra/newview/skins/default/textures/windows/Icon_Gear_Background.png b/indra/newview/skins/default/textures/windows/Icon_Gear_Background.png Binary files differindex 93d62a8d4f..09d83e62e4 100644 --- a/indra/newview/skins/default/textures/windows/Icon_Gear_Background.png +++ b/indra/newview/skins/default/textures/windows/Icon_Gear_Background.png diff --git a/indra/newview/skins/default/textures/windows/Icon_Gear_Foreground.png b/indra/newview/skins/default/textures/windows/Icon_Gear_Foreground.png Binary files differindex b2b2a77a88..fa998eee5d 100644 --- a/indra/newview/skins/default/textures/windows/Icon_Gear_Foreground.png +++ b/indra/newview/skins/default/textures/windows/Icon_Gear_Foreground.png diff --git a/indra/newview/skins/default/textures/windows/Icon_Gear_Press.png b/indra/newview/skins/default/textures/windows/Icon_Gear_Press.png Binary files differindex 6fc3744d6b..603fa2f388 100644 --- a/indra/newview/skins/default/textures/windows/Icon_Gear_Press.png +++ b/indra/newview/skins/default/textures/windows/Icon_Gear_Press.png diff --git a/indra/newview/skins/default/textures/windows/Icon_Help_Foreground.png b/indra/newview/skins/default/textures/windows/Icon_Help_Foreground.png Binary files differindex 177c0675bb..1bde4c040a 100644 --- a/indra/newview/skins/default/textures/windows/Icon_Help_Foreground.png +++ b/indra/newview/skins/default/textures/windows/Icon_Help_Foreground.png diff --git a/indra/newview/skins/default/textures/windows/Icon_Help_Press.png b/indra/newview/skins/default/textures/windows/Icon_Help_Press.png Binary files differindex aa21a1c789..f3b885283f 100644 --- a/indra/newview/skins/default/textures/windows/Icon_Help_Press.png +++ b/indra/newview/skins/default/textures/windows/Icon_Help_Press.png diff --git a/indra/newview/skins/default/textures/windows/Icon_Minimize_Foreground.png b/indra/newview/skins/default/textures/windows/Icon_Minimize_Foreground.png Binary files differindex a98a3a98c2..942efb40f7 100644 --- a/indra/newview/skins/default/textures/windows/Icon_Minimize_Foreground.png +++ b/indra/newview/skins/default/textures/windows/Icon_Minimize_Foreground.png diff --git a/indra/newview/skins/default/textures/windows/Icon_Minimize_Press.png b/indra/newview/skins/default/textures/windows/Icon_Minimize_Press.png Binary files differindex 5df0e7691c..1fe37b7a2e 100644 --- a/indra/newview/skins/default/textures/windows/Icon_Minimize_Press.png +++ b/indra/newview/skins/default/textures/windows/Icon_Minimize_Press.png diff --git a/indra/newview/skins/default/textures/windows/Icon_Restore_Foreground.png b/indra/newview/skins/default/textures/windows/Icon_Restore_Foreground.png Binary files differindex b4d4ef01fc..7840deccb8 100644 --- a/indra/newview/skins/default/textures/windows/Icon_Restore_Foreground.png +++ b/indra/newview/skins/default/textures/windows/Icon_Restore_Foreground.png diff --git a/indra/newview/skins/default/textures/windows/Icon_Restore_Press.png b/indra/newview/skins/default/textures/windows/Icon_Restore_Press.png Binary files differindex 0d0238dc32..33258a0bc5 100644 --- a/indra/newview/skins/default/textures/windows/Icon_Restore_Press.png +++ b/indra/newview/skins/default/textures/windows/Icon_Restore_Press.png diff --git a/indra/newview/skins/default/textures/windows/Icon_Undock_Foreground.png b/indra/newview/skins/default/textures/windows/Icon_Undock_Foreground.png Binary files differindex 9a71d16a3f..df826226e6 100644 --- a/indra/newview/skins/default/textures/windows/Icon_Undock_Foreground.png +++ b/indra/newview/skins/default/textures/windows/Icon_Undock_Foreground.png diff --git a/indra/newview/skins/default/textures/windows/Inspector_Background.png b/indra/newview/skins/default/textures/windows/Inspector_Background.png Binary files differindex 4c2a728ac5..3053269b84 100644 --- a/indra/newview/skins/default/textures/windows/Inspector_Background.png +++ b/indra/newview/skins/default/textures/windows/Inspector_Background.png diff --git a/indra/newview/skins/default/textures/windows/Inspector_Hover.png b/indra/newview/skins/default/textures/windows/Inspector_Hover.png Binary files differindex feeee78033..0cb846eba0 100644 --- a/indra/newview/skins/default/textures/windows/Inspector_Hover.png +++ b/indra/newview/skins/default/textures/windows/Inspector_Hover.png diff --git a/indra/newview/skins/default/textures/windows/Toast_Background.png b/indra/newview/skins/default/textures/windows/Toast_Background.png Binary files differindex f27d1a12ec..00676350ca 100644 --- a/indra/newview/skins/default/textures/windows/Toast_Background.png +++ b/indra/newview/skins/default/textures/windows/Toast_Background.png diff --git a/indra/newview/skins/default/textures/windows/Toast_CloseBtn.png b/indra/newview/skins/default/textures/windows/Toast_CloseBtn.png Binary files differindex 78b137cdaf..f37d8d085d 100644 --- a/indra/newview/skins/default/textures/windows/Toast_CloseBtn.png +++ b/indra/newview/skins/default/textures/windows/Toast_CloseBtn.png diff --git a/indra/newview/skins/default/textures/windows/Toast_Over.png b/indra/newview/skins/default/textures/windows/Toast_Over.png Binary files differindex 807e8e553c..5191e0858d 100644 --- a/indra/newview/skins/default/textures/windows/Toast_Over.png +++ b/indra/newview/skins/default/textures/windows/Toast_Over.png diff --git a/indra/newview/skins/default/textures/windows/Volume_Background.png b/indra/newview/skins/default/textures/windows/Volume_Background.png Binary files differindex 43aaa441f5..9f8680d079 100644 --- a/indra/newview/skins/default/textures/windows/Volume_Background.png +++ b/indra/newview/skins/default/textures/windows/Volume_Background.png diff --git a/indra/newview/skins/default/textures/windows/Wearables_Divider.png b/indra/newview/skins/default/textures/windows/Wearables_Divider.png Binary files differindex 9dce7bf45c..8795ccd661 100644 --- a/indra/newview/skins/default/textures/windows/Wearables_Divider.png +++ b/indra/newview/skins/default/textures/windows/Wearables_Divider.png diff --git a/indra/newview/skins/default/textures/windows/Window_NoTitle_Background.png b/indra/newview/skins/default/textures/windows/Window_NoTitle_Background.png Binary files differnew file mode 100644 index 0000000000..d01f82a310 --- /dev/null +++ b/indra/newview/skins/default/textures/windows/Window_NoTitle_Background.png diff --git a/indra/newview/skins/default/textures/windows/Window_NoTitle_Foreground.png b/indra/newview/skins/default/textures/windows/Window_NoTitle_Foreground.png Binary files differnew file mode 100644 index 0000000000..1966400641 --- /dev/null +++ b/indra/newview/skins/default/textures/windows/Window_NoTitle_Foreground.png diff --git a/indra/newview/skins/default/textures/windows/hint_arrow_down.png b/indra/newview/skins/default/textures/windows/hint_arrow_down.png Binary files differindex 0cb5a819ec..b449d3be7c 100644 --- a/indra/newview/skins/default/textures/windows/hint_arrow_down.png +++ b/indra/newview/skins/default/textures/windows/hint_arrow_down.png diff --git a/indra/newview/skins/default/textures/windows/hint_arrow_left.png b/indra/newview/skins/default/textures/windows/hint_arrow_left.png Binary files differindex 45204d9132..d93d621067 100644 --- a/indra/newview/skins/default/textures/windows/hint_arrow_left.png +++ b/indra/newview/skins/default/textures/windows/hint_arrow_left.png diff --git a/indra/newview/skins/default/textures/windows/hint_arrow_lower_left.png b/indra/newview/skins/default/textures/windows/hint_arrow_lower_left.png Binary files differindex 3e3ae9f42d..5e8def5a5b 100644 --- a/indra/newview/skins/default/textures/windows/hint_arrow_lower_left.png +++ b/indra/newview/skins/default/textures/windows/hint_arrow_lower_left.png diff --git a/indra/newview/skins/default/textures/windows/hint_arrow_right.png b/indra/newview/skins/default/textures/windows/hint_arrow_right.png Binary files differindex 3fe7a773c3..3524487fb3 100644 --- a/indra/newview/skins/default/textures/windows/hint_arrow_right.png +++ b/indra/newview/skins/default/textures/windows/hint_arrow_right.png diff --git a/indra/newview/skins/default/textures/windows/hint_arrow_up.png b/indra/newview/skins/default/textures/windows/hint_arrow_up.png Binary files differindex 44f003dc63..aca440d712 100644 --- a/indra/newview/skins/default/textures/windows/hint_arrow_up.png +++ b/indra/newview/skins/default/textures/windows/hint_arrow_up.png diff --git a/indra/newview/skins/default/textures/windows/hint_background.png b/indra/newview/skins/default/textures/windows/hint_background.png Binary files differindex e25f354347..d045bc5e29 100644 --- a/indra/newview/skins/default/textures/windows/hint_background.png +++ b/indra/newview/skins/default/textures/windows/hint_background.png diff --git a/indra/newview/skins/default/textures/windows/login_sl_logo.png b/indra/newview/skins/default/textures/windows/login_sl_logo.png Binary files differindex 1eede80c83..e4d4eb3ebf 100644 --- a/indra/newview/skins/default/textures/windows/login_sl_logo.png +++ b/indra/newview/skins/default/textures/windows/login_sl_logo.png diff --git a/indra/newview/skins/default/textures/windows/login_sl_logo_small.png b/indra/newview/skins/default/textures/windows/login_sl_logo_small.png Binary files differindex c5933001f0..36fb15de08 100644 --- a/indra/newview/skins/default/textures/windows/login_sl_logo_small.png +++ b/indra/newview/skins/default/textures/windows/login_sl_logo_small.png diff --git a/indra/newview/skins/default/textures/windows/startup_logo.png b/indra/newview/skins/default/textures/windows/startup_logo.png Binary files differindex b89449692b..6a81a6451d 100644 --- a/indra/newview/skins/default/textures/windows/startup_logo.png +++ b/indra/newview/skins/default/textures/windows/startup_logo.png diff --git a/indra/newview/skins/default/textures/windows/yellow_gradient.png b/indra/newview/skins/default/textures/windows/yellow_gradient.png Binary files differindex 5bd21b4297..4a07282ecb 100644 --- a/indra/newview/skins/default/textures/windows/yellow_gradient.png +++ b/indra/newview/skins/default/textures/windows/yellow_gradient.png diff --git a/indra/newview/skins/default/xui/de/floater_texture_fetch_debugger.xml b/indra/newview/skins/default/xui/de/floater_texture_fetch_debugger.xml deleted file mode 100644 index 97b0364832..0000000000 --- a/indra/newview/skins/default/xui/de/floater_texture_fetch_debugger.xml +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<floater name="TexFetchDebugger" title="Debugger für Texturabruffehler"> - <text name="total_num_fetched_label"> - 1, Gesamtzahl abgerufener Texturen: [NUM] - </text> - <text name="total_num_fetching_requests_label"> - 2, Gesamtzahl von Abrufanforderungen: [NUM] - </text> - <text name="total_num_cache_hits_label"> - 3, Gesamtzahl von Cachetreffern: [NUM] - </text> - <text name="total_num_visible_tex_label"> - 4, Gesamtzahl sichtbarer Texturen: [NUM] - </text> - <text name="total_num_visible_tex_fetch_req_label"> - 5, Gesamtzahl von Abrufanforderungen für sichtbare Texturen: [NUM] - </text> - <text name="total_fetched_data_label"> - 6, Gesamtmenge abgerufener Daten: [SIZE1] KB, decodierte Daten: [SIZE2] KB, [PIXEL] MPixel - </text> - <text name="total_fetched_vis_data_label"> - 7, Gesamtmenge sichtbarer Daten: [SIZE1] KB, decodierte Daten: [SIZE2] KB - </text> - <text name="total_fetched_rendered_data_label"> - 8, Gesamtmenge dargestellter Daten: [SIZE1] KB, decodierte Daten: [SIZE2] KB, [PIXEL] MPixel - </text> - <text name="total_time_cache_read_label"> - 9, Gesamtzeit Cache-Lesezugriffe: [TIME] s - </text> - <text name="total_time_cache_write_label"> - 10, Gesamtzeit Cache-Schreibzugriffe: [TIME] s - </text> - <text name="total_time_decode_label"> - 11, Gesamtzeit Decodierung: [TIME] s - </text> - <text name="total_time_gl_label"> - 12, Gesamtzeit GL-Texturerstellung: [TIME] s - </text> - <text name="total_time_http_label"> - 13, Gesamtzeit HTTP-Abrufe: [TIME] s - </text> - <text name="total_time_fetch_label"> - 14, Gesamtzeit für alle Abrufe: [TIME] s - </text> - <text name="total_time_refetch_vis_cache_label"> - 15, Neuabruf sichtbarer Texturen aus Cache, Zeit: [TIME] s, Abrufmenge: [SIZE2] KB, [PIXEL] MPixel - </text> - <text name="total_time_refetch_all_cache_label"> - 16, Neuabruf aller Texturen aus Cache, Zeit: [TIME] s, Abrufmenge: [SIZE2] KB, [PIXEL] MPixel - </text> - <text name="total_time_refetch_vis_http_label"> - 17, Neuabruf sichtbarer Texturen von HTTP, Zeit: [TIME] s, Abrufmenge: [SIZE2] KB, [PIXEL] MPixel - </text> - <text name="total_time_refetch_all_http_label"> - 18, Neuabruf aller Texturen von HTTP, Zeit: [TIME] s, Abrufmenge: [SIZE2] KB, [PIXEL] MPixel - </text> - <spinner label="19, Verhältnis Texel/Pixel:" name="texel_pixel_ratio"/> - <text name="texture_source_label"> - 20, Texturquelle: - </text> - <radio_group name="texture_source"> - <radio_item label="Cache + HTTP" name="0"/> - <radio_item label="Nur HTTP" name="1"/> - </radio_group> - <button label="Starten" name="start_btn"/> - <button label="Zurücksetzen" name="clear_btn"/> - <button label="Schließen" name="close_btn"/> - <button label="Cache-Lesezugriff" name="cacheread_btn"/> - <button label="Cache-Schreibzugriff" name="cachewrite_btn"/> - <button label="HTTP" name="http_btn"/> - <button label="Decodieren" name="decode_btn"/> - <button label="GL-Textur" name="gl_btn"/> - <button label="Neuabruf sichtbarer Texturen (Cache)" name="refetchviscache_btn"/> - <button label="Neuabruf des gesamten Cache" name="refetchallcache_btn"/> - <button label="Neuabruf sichtbarer Texturen (HTTP)" name="refetchvishttp_btn"/> - <button label="Neuabruf des gesamten HTTP" name="refetchallhttp_btn"/> -</floater> diff --git a/indra/newview/skins/default/xui/en/floater_adjust_environment.xml b/indra/newview/skins/default/xui/en/floater_adjust_environment.xml index 91a1dffcb5..889eeb5369 100644 --- a/indra/newview/skins/default/xui/en/floater_adjust_environment.xml +++ b/indra/newview/skins/default/xui/en/floater_adjust_environment.xml @@ -12,7 +12,7 @@ can_resize="false"> <string name="hdr_string">HDR Scale:</string> <string name="brightness_string">Brightness:</string> - <string name="hdr_tooltip">Intensity of lightning effects such as realistically bright skies and dynamic exposure. 1.0 is the default, 0 is off, values between 0 and 1 are mixing Ambient with HDR.</string> + <string name="hdr_tooltip">Intensity of lighting effects such as realistically bright skies and dynamic exposure. 1.0 is the default, 0 is off, values between 0 and 1 are mixing Ambient with HDR.</string> <layout_stack name="outer_stack" width="845" height="275" diff --git a/indra/newview/skins/default/xui/en/floater_change_item_thumbnail.xml b/indra/newview/skins/default/xui/en/floater_change_item_thumbnail.xml index 223069ed0c..465580301e 100644 --- a/indra/newview/skins/default/xui/en/floater_change_item_thumbnail.xml +++ b/indra/newview/skins/default/xui/en/floater_change_item_thumbnail.xml @@ -9,6 +9,10 @@ width="319"> <floater.string + name="multiple_item_names"> + Multiple items selected + </floater.string> + <floater.string name="title_item_thumbnail"> CHANGE ITEM IMAGE </floater.string> @@ -72,6 +76,22 @@ height="256" width="256" /> + <text + name="multiple_lbl" + font="SansSerifBig" + text_color="White" + halign="center" + valign="center" + use_ellipses="true" + follows="top|left" + layout="topleft" + height="256" + width="256" + top_delta="0" + left_delta="0" + visible =" false"> + Multiple thumbnails + </text> <button follows="right|bottom" diff --git a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml index b9259256a6..8c4019a668 100644 --- a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <floater - height="400" + height="411" layout="topleft" name="prefs_graphics_advanced" help_topic="Preferences_Graphics_Advanced" @@ -102,6 +102,22 @@ width="65"> Low </text> + <slider + control_name="RenderLocalLightCount" + decimal_digits="0" + follows="left|top" + height="16" + increment="1" + initial_value="256" + label="Max. nearby lights:" + label_width="185" + layout="topleft" + left="30" + min_val="0" + max_val="8192" + name="MaxLights" + top_delta="16" + width="336" /> <check_box control_name="RenderVSyncEnable" @@ -128,6 +144,42 @@ Avatar </text> + <text + type="string" + length="1" + follows="left|top" + height="16" + layout="topleft" + left="30" + top_delta="16" + width="128" + name="AvatarComplexityModeLabel" + text_readonly_color="LabelDisabledColor"> + Avatar display: + </text> + + <combo_box + control_name="RenderAvatarComplexityMode" + height="18" + layout="topleft" + left_delta="130" + top_delta="0" + name="AvatarComplexityMode" + width="150"> + <combo_box.item + label="Limit by complexity" + name="0" + value="0"/> + <combo_box.item + label="Always show friends" + name="1" + value="1"/> + <combo_box.item + label="Only show friends" + name="2" + value="2"/> + </combo_box> + <slider control_name="IndirectMaxComplexity" tool_tip="Controls at what point a visually complex avatar is drawn as a JellyDoll" @@ -493,7 +545,7 @@ </text> <view_border bevel_style="in" - height="322" + height="357" layout="topleft" left="385" name="vert_border" @@ -812,21 +864,21 @@ name="HeroProbeUpdateRate" width="150"> <combo_box.item - label="Every Frame" - name="0" - value="1"/> + label="Low" + name="6" + value="6"/> <combo_box.item - label="Every 2nd Frame" + label="Medium" + name="3" + value="3"/> + <combo_box.item + label="High" name="1" value="2"/> <combo_box.item - label="Every 3rd Frame" - name="2" - value="3"/> - <combo_box.item - label="Every 4th Frame" - name="3" - value="4"/> + label="Ultra" + name="0" + value="1"/> </combo_box> <!-- End of mirror settings --> @@ -837,7 +889,7 @@ layout="topleft" left="13" name="horiz_border" - top="338" + top="373" top_delta="5" width="774"/> <button @@ -847,7 +899,7 @@ layout="topleft" left="20" name="Defaults" - top_delta="20" + top_delta="7" width="210"> <button.commit_callback function="Pref.HardwareDefaults" /> diff --git a/indra/newview/skins/default/xui/en/menu_gallery_inventory.xml b/indra/newview/skins/default/xui/en/menu_gallery_inventory.xml index c11f1c88cb..16907d3577 100644 --- a/indra/newview/skins/default/xui/en/menu_gallery_inventory.xml +++ b/indra/newview/skins/default/xui/en/menu_gallery_inventory.xml @@ -426,6 +426,234 @@ <menu_item_separator layout="topleft" name="Subfolder Separator" /> + <menu + label="Create new" + layout="topleft" + name="create_new"> + <menu_item_call + label="New Folder" + layout="topleft" + name="New Folder"> + <menu_item_call.on_click + function="Inventory.DoCreate" + parameter="category" /> + </menu_item_call> + <menu_item_call + label="New Script" + layout="topleft" + name="New Script"> + <menu_item_call.on_click + function="Inventory.DoCreate" + parameter="lsl" /> + </menu_item_call> + <menu_item_call + label="New Notecard" + layout="topleft" + name="New Note"> + <menu_item_call.on_click + function="Inventory.DoCreate" + parameter="notecard" /> + </menu_item_call> + <menu_item_call + label="New Gesture" + layout="topleft" + name="New Gesture"> + <menu_item_call.on_click + function="Inventory.DoCreate" + parameter="gesture" /> + </menu_item_call> + <menu_item_call + label="New Material" + layout="topleft" + name="New Material"> + <menu_item_call.on_click + function="Inventory.DoCreate" + parameter="material" /> + <menu_item_call.on_enable + function="Inventory.MaterialsEnabled" /> + </menu_item_call> + <menu + label="New Clothes" + layout="topleft" + name="New Clothes"> + <menu_item_call + label="New Shirt" + layout="topleft" + name="New Shirt"> + <menu_item_call.on_click + function="Inventory.DoCreate" + parameter="shirt" /> + </menu_item_call> + <menu_item_call + label="New Pants" + layout="topleft" + name="New Pants"> + <menu_item_call.on_click + function="Inventory.DoCreate" + parameter="pants" /> + </menu_item_call> + <menu_item_call + label="New Shoes" + layout="topleft" + name="New Shoes"> + <menu_item_call.on_click + function="Inventory.DoCreate" + parameter="shoes" /> + </menu_item_call> + <menu_item_call + label="New Socks" + layout="topleft" + name="New Socks"> + <menu_item_call.on_click + function="Inventory.DoCreate" + parameter="socks" /> + </menu_item_call> + <menu_item_call + label="New Jacket" + layout="topleft" + name="New Jacket"> + <menu_item_call.on_click + function="Inventory.DoCreate" + parameter="jacket" /> + </menu_item_call> + <menu_item_call + label="New Skirt" + layout="topleft" + name="New Skirt"> + <menu_item_call.on_click + function="Inventory.DoCreate" + parameter="skirt" /> + </menu_item_call> + <menu_item_call + label="New Gloves" + layout="topleft" + name="New Gloves"> + <menu_item_call.on_click + function="Inventory.DoCreate" + parameter="gloves" /> + </menu_item_call> + <menu_item_call + label="New Undershirt" + layout="topleft" + name="New Undershirt"> + <menu_item_call.on_click + function="Inventory.DoCreate" + parameter="undershirt" /> + </menu_item_call> + <menu_item_call + label="New Underpants" + layout="topleft" + name="New Underpants"> + <menu_item_call.on_click + function="Inventory.DoCreate" + parameter="underpants" /> + </menu_item_call> + <menu_item_call + label="New Alpha Mask" + layout="topleft" + name="New Alpha Mask"> + <menu_item_call.on_click + function="Inventory.DoCreate" + parameter="alpha" /> + </menu_item_call> + <menu_item_call + label="New Tattoo" + layout="topleft" + name="New Tattoo"> + <menu_item_call.on_click + function="Inventory.DoCreate" + parameter="tattoo" /> + </menu_item_call> + <menu_item_call + label="New Universal" + layout="topleft" + name="New Universal"> + <menu_item_call.on_click + function="Inventory.DoCreate" + parameter="universal" /> + </menu_item_call> + <menu_item_call + label="New Physics" + layout="topleft" + name="New Physics"> + <menu_item_call.on_click + function="Inventory.DoCreate" + parameter="physics" /> + </menu_item_call> + </menu> + <menu + label="New Body Parts" + layout="topleft" + name="New Body Parts"> + <menu_item_call + label="New Shape" + layout="topleft" + name="New Shape"> + <menu_item_call.on_click + function="Inventory.DoCreate" + parameter="shape" /> + </menu_item_call> + <menu_item_call + label="New Skin" + layout="topleft" + name="New Skin"> + <menu_item_call.on_click + function="Inventory.DoCreate" + parameter="skin" /> + </menu_item_call> + <menu_item_call + label="New Hair" + layout="topleft" + name="New Hair"> + <menu_item_call.on_click + function="Inventory.DoCreate" + parameter="hair" /> + </menu_item_call> + <menu_item_call + label="New Eyes" + layout="topleft" + name="New Eyes"> + <menu_item_call.on_click + function="Inventory.DoCreate" + parameter="eyes" /> + </menu_item_call> + </menu> + <menu + label="New Settings" + layout="topleft" + name="New Settings"> + <menu_item_call + label="New Sky" + layout="topleft" + name="New Sky"> + <menu_item_call.on_click + function="Inventory.DoCreate" + parameter="sky"/> + <menu_item_call.on_enable + function="Inventory.EnvironmentEnabled" /> + </menu_item_call> + <menu_item_call + label="New Water" + layout="topleft" + name="New Water"> + <menu_item_call.on_click + function="Inventory.DoCreate" + parameter="water"/> + <menu_item_call.on_enable + function="Inventory.EnvironmentEnabled" /> + </menu_item_call> + <menu_item_call + label="New Day Cycle" + layout="topleft" + name="New Day Cycle"> + <menu_item_call.on_click + function="Inventory.DoCreate" + parameter="daycycle"/> + <menu_item_call.on_enable + function="Inventory.EnvironmentEnabled" /> + </menu_item_call> + </menu> + </menu> <menu_item_call label="Create folder from selected" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/menu_nearby_media.xml b/indra/newview/skins/default/xui/en/menu_nearby_media.xml new file mode 100644 index 0000000000..7c91241a19 --- /dev/null +++ b/indra/newview/skins/default/xui/en/menu_nearby_media.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<toggleable_menu + name="menu_nearby_media" + left="0" + bottom="0" + visible="false" + mouse_opaque="false"> + <menu_item_call + label="Copy Url" + name="copy_url"> + <menu_item_call.on_click + function="SelectedMediaCtrl.Action" + parameter="copy_url" /> + </menu_item_call> + <menu_item_call + label="Copy Data" + name="copy_data"> + <menu_item_call.on_click + function="SelectedMediaCtrl.Action" + parameter="copy_data" /> + <menu_item_call.on_visible + function="SelectedMediaCtrl.Visible" + parameter="copy_data" /> + </menu_item_call> +</toggleable_menu> diff --git a/indra/newview/skins/default/xui/en/menu_object.xml b/indra/newview/skins/default/xui/en/menu_object.xml index cbd38b1db8..2df581fa2c 100644 --- a/indra/newview/skins/default/xui/en/menu_object.xml +++ b/indra/newview/skins/default/xui/en/menu_object.xml @@ -173,6 +173,8 @@ function="Object.Take"/> <menu_item_call.on_enable function="Object.VisibleTake"/> + <menu_item_call.on_visible + function="Object.VisibleTakeSingle"/> </menu_item_call> <menu_item_call enabled="false" @@ -182,6 +184,52 @@ function="Tools.TakeCopy" /> <menu_item_call.on_enable function="Tools.EnableTakeCopy" /> + <menu_item_call.on_visible + function="Object.VisibleTakeSingle"/> + </menu_item_call> + <menu_item_call + label="Take as combined item" + layout="topleft" + name="Take combined"> + <menu_item_call.on_click + function="Object.Take"/> + <menu_item_call.on_enable + function="Object.VisibleTake"/> + <menu_item_call.on_visible + function="Object.VisibleTakeMultiple"/> + </menu_item_call> + <menu_item_call + enabled="false" + label="Take copy as combined item" + name="Take Copy combined"> + <menu_item_call.on_click + function="Tools.TakeCopy" /> + <menu_item_call.on_enable + function="Tools.EnableTakeCopy" /> + <menu_item_call.on_visible + function="Object.VisibleTakeMultiple"/> + </menu_item_call> + <menu_item_call + label="Take as separate items" + layout="topleft" + name="Take Separate"> + <menu_item_call.on_click + function="Object.TakeSeparate"/> + <menu_item_call.on_enable + function="Object.EnableTakeMultiple"/> + <menu_item_call.on_visible + function="Object.VisibleTakeMultiple"/> + </menu_item_call> + <menu_item_call + label="Take copies as separate items" + layout="topleft" + name="Take Copy Separate"> + <menu_item_call.on_click + function="Object.TakeSeparateCopy"/> + <menu_item_call.on_enable + function="Tools.EnableCopySeparate"/> + <menu_item_call.on_visible + function="Object.VisibleTakeMultiple"/> </menu_item_call> <menu_item_call enabled="false" diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 145c82a614..46056e884d 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -2823,6 +2823,70 @@ function="World.EnvPreset" parameter="mem_leaking" /> </menu_item_call> </menu> + <menu + create_jump_keys="true" + label="GLTF" + name="GLTF" + tear_off="true"> + <menu_item_call + label="Open..." + name="Open..."> + <!--<menu_item_call.on_enable + function="EnableGLTF"/>--> + <menu_item_call.on_click + function="Advanced.ClickGLTFOpen" /> + </menu_item_call> + <menu_item_call + label="Save As..." + name="Save As..."> + <menu_item_call.on_enable + function="EnableGLTFSaveAs"/> + <menu_item_call.on_click + function="Advanced.ClickGLTFSaveAs" /> + </menu_item_call> + <menu_item_call + label="Upload..." + name="Upload..."> + <menu_item_call.on_enable + function="EnableGLTFUpload"/> + <menu_item_call.on_click + function="Advanced.ClickGLTFUpload" /> + </menu_item_call> + </menu> + <menu + create_jump_keys="true" + label="Video" + name="Video" + tear_off="true"> + <menu_item_call + label="1080x1920" + name="1080x1920"> + <menu_item_call.on_click + function="Advanced.ClickResizeWindow" + parameter="1080x1920"/> + </menu_item_call> + <menu_item_call + label="1920x1080" + name="1920x1080"> + <menu_item_call.on_click + function="Advanced.ClickResizeWindow" + parameter="1920x1080"/> + </menu_item_call> + <menu_item_call + label="1280x720" + name="1280x720"> + <menu_item_call.on_click + function="Advanced.ClickResizeWindow" + parameter="1280x720"/> + </menu_item_call> + <menu_item_call + label="720x1280" + name="720x1280"> + <menu_item_call.on_click + function="Advanced.ClickResizeWindow" + parameter="720x1280"/> + </menu_item_call> + </menu> <menu create_jump_keys="true" label="Render Tests" @@ -2875,12 +2939,6 @@ function="World.EnvPreset" <menu_item_call.on_click function="Advanced.ClickHDRIPreview" /> </menu_item_call> - <menu_item_call - label="GLTF Scene Preview" - name="GLTF Scene Preview"> - <menu_item_call.on_click - function="Advanced.ClickGLTFScenePreview" /> - </menu_item_call> </menu> <menu create_jump_keys="true" @@ -3901,6 +3959,16 @@ function="World.EnvPreset" function="ToggleControl" parameter="AllowSelectAvatar" /> </menu_item_check> + <menu_item_check + label="Render Only Friends" + name="Render Only Friends"> + <menu_item_check.on_check + function="CheckControl" + parameter="RenderAvatarFriendsOnly" /> + <menu_item_check.on_click + function="ToggleControl" + parameter="RenderAvatarFriendsOnly" /> + </menu_item_check> </menu> <menu create_jump_keys="true" @@ -3998,6 +4066,16 @@ function="World.EnvPreset" function="Advanced.ToggleDebugCharacterVis" /> </menu_item_check> <menu_item_check + label="Debug Character Rez State" + name="Debug Character Rez State"> + <menu_item_check.on_check + function="CheckControl" + parameter="NameTagDebugAVRezState" /> + <menu_item_check.on_click + function="ToggleControl" + parameter="NameTagDebugAVRezState" /> + </menu_item_check> + <menu_item_check label="Show Collision Skeleton" name="Show Collision Skeleton"> <menu_item_check.on_check diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 0ccb980803..73b001a526 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -6267,7 +6267,7 @@ Are you sure you want to delete them? notext="Cancel" yestext="OK"/> </notification> - + <notification icon="alertmodal.tga" name="DeleteWornItems" @@ -6342,6 +6342,17 @@ You must replace those layers before deleting them. yestext="OK"/> </notification> + <notification + icon="alertmodal.tga" + name="ThumbnailSelectionTooLarge" + type="alertmodal"> + <unique/> + You can only modify up to 50 thumbnails at a time. + <usetemplate + name="okbutton" + yestext="OK"/> + </notification> + <notification icon="alertmodal.tga" name="ConfirmUnlink" @@ -8837,10 +8848,10 @@ New Voice Morphs are available! persist="true" type="alertmodal"> Voice Morphs are not supported by this viewer. +For more information about other voice morph tools, see [[FAQ_URL] this article]. <usetemplate - notext="Cancel" - name="okcancelbuttons" - yestext="Disable Voice Morphing"/> + name="okignore" + yestext="OK"/> <tag>voice</tag> </notification> @@ -12464,7 +12475,7 @@ are wearing now. <notification icon="alertmodal.tga" - name="GLTFPreviewSelection" + name="GLTFOpenSelection" type="alert"> You must select an object to act as a handle to the GLTF asset you are previewing. <tag>fail</tag> @@ -12473,4 +12484,59 @@ are wearing now. yestext="OK"/> </notification> + <notification + icon="alertmodal.tga" + name="GLTFLoadFailed" + type="alert"> + Failed to load GLTF file. See log for details. + <tag>fail</tag> + <usetemplate + name="okbutton" + yestext="OK"/> + </notification> + + <notification + icon="alertmodal.tga" + name="GLTFSaveFailed" + type="alert"> + Failed to save GLTF file. See log for details. + <tag>fail</tag> + <usetemplate + name="okbutton" + yestext="OK"/> + </notification> + + <notification + icon="alertmodal.tga" + name="GLTFSaveSelection" + type="alert"> + You must select an object that has a GLTF asset associated with it. + <tag>fail</tag> + <usetemplate + name="okbutton" + yestext="OK"/> + </notification> + + <notification + icon="alertmodal.tga" + name="GLTFUploadSelection" + type="alert"> + You must select an object that has local-only GLTF asset associated with it. + <tag>fail</tag> + <usetemplate + name="okbutton" + yestext="OK"/> + </notification> + + <notification + icon="alertmodal.tga" + name="GLTFUploadInProgress" + type="alert"> + Upload is currently in progress. Please try again later. + <tag>fail</tag> + <usetemplate + name="okbutton" + yestext="OK"/> + </notification> + </notifications> diff --git a/indra/newview/skins/default/xui/en/panel_performance_nearby.xml b/indra/newview/skins/default/xui/en/panel_performance_nearby.xml index ca961747c4..4409feb23a 100644 --- a/indra/newview/skins/default/xui/en/panel_performance_nearby.xml +++ b/indra/newview/skins/default/xui/en/panel_performance_nearby.xml @@ -135,18 +135,41 @@ name="exceptions_btn" width="100"> </button> - <check_box - control_name="AlwaysRenderFriends" + + <text + type="string" + length="1" + follows="left|top" height="16" - initial_value="true" - label="Always display friends in full detail" - label_text.text_color="White" layout="topleft" - name="display_friends" - top_pad="3" left="18" - width="256"> - </check_box> + top_pad="3" + name="AvatarComplexityModeLabel" + text_readonly_color="LabelDisabledColor" + width="128"> + Avatar display: + </text> + <combo_box + control_name="RenderAvatarComplexityMode" + height="23" + layout="topleft" + left_delta="130" + top_delta="-4" + name="AvatarComplexityMode" + width="150"> + <combo_box.item + label="Limit by complexity" + name="0" + value="0"/> + <combo_box.item + label="Always show friends" + name="1" + value="1"/> + <combo_box.item + label="Only show friends" + name="2" + value="2"/> + </combo_box> <view_border bevel_style="in" height="0" diff --git a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml index a19c9dd288..cb3e0e4b6a 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml @@ -276,6 +276,41 @@ <button.commit_callback function="Pref.AutoAdjustments"/> </button> + + <text + type="string" + length="1" + follows="left|top" + height="16" + layout="topleft" + left="30" + top_delta="42" + width="128" + name="AvatarComplexityModeLabel" + text_readonly_color="LabelDisabledColor"> + Avatar display: + </text> + <combo_box + control_name="RenderAvatarComplexityMode" + height="23" + layout="topleft" + left_delta="130" + top_delta="-4" + name="AvatarComplexityMode" + width="150"> + <combo_box.item + label="Limit by complexity" + name="0" + value="0"/> + <combo_box.item + label="Always show friends" + name="1" + value="1"/> + <combo_box.item + label="Only show friends" + name="2" + value="2"/> + </combo_box> <slider control_name="IndirectMaxComplexity" @@ -284,7 +319,7 @@ height="16" initial_value="101" increment="1" - label="Avatar Maximum Complexity:" + label="Avatar maximum complexity:" label_width="165" layout="topleft" left="30" @@ -292,7 +327,7 @@ max_val="101" name="IndirectMaxComplexity" show_text="false" - top_delta="40" + top_delta="28" width="300"> <slider.commit_callback function="Pref.UpdateIndirectMaxComplexity" @@ -311,32 +346,7 @@ width="65"> 0 </text> -<text -type="string" -length="1" -follows="left|top" -height="16" -layout="topleft" -left_delta="68" -name="IndirectMaxComplexityLink" -mouse_opaque="false" -top_delta="0" -width="120"> -[https://community.secondlife.com/t5/Featured-News/Why-are-all-these-people-made-of-colored-jelly/ba-p/3031255 What's this?] -</text> - - <check_box - control_name="AlwaysRenderFriends" - height="16" - initial_value="true" - label="Always Render Friends" - layout="topleft" - left="30" - name="AlwaysRenderFriends" - top_delta="24" - width="256"> - </check_box> <button height="23" label="Exceptions..." diff --git a/indra/newview/skins/default/xui/en/panel_region_terrain_texture_transform.xml b/indra/newview/skins/default/xui/en/panel_region_terrain_texture_transform.xml new file mode 100644 index 0000000000..9a90700056 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_region_terrain_texture_transform.xml @@ -0,0 +1,260 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<panel + border="true" + follows="top|left" + height="460" + label="Terrain" + layout="topleft" + left="0" + name="Terrain" + top="320" + width="480"> + <text + follows="left|top" + font="SansSerif" + height="20" + layout="topleft" + left="10" + name="region_text_lbl" + top="10" + width="100"> + Region: + </text> + <text + follows="left|top" + font="SansSerif" + height="20" + layout="topleft" + left_delta="50" + name="region_text" + top_delta="0" + width="400"> + unknown + </text> + <text + type="string" + length="1" + halign="left" + valign="center" + follows="left|top" + height="20" + layout="topleft" + name="detail_texture_text" + left="10" + top="35" + width="170"> + Terrain Textures + </text> + <text + type="string" + length="1" + halign="left" + valign="center" + follows="left|top" + height="20" + layout="topleft" + name="detail_material_text" + left="10" + top="35" + width="170"> + Terrain Materials + </text> + <check_box + height="20" + halign="left" + valign="center" + follows="left|top" + layout="topleft" + top_delta="1" + left_delta="180" + label="PBR Metallic Roughness" + name="terrain_material_type" + tool_tip="If checked, use PBR Metallic Roughness materials for terrain. Otherwise, use textures." + left_pad="2" + width="200" /> + <texture_picker + follows="left|top" + height="121" + layout="topleft" + left="10" + name="texture_detail_0" + default_image_id="0bc58228-74a0-7e83-89bc-5c23464bcec5" + top_delta="30" + width="100" /> + <texture_picker + follows="top" + height="121" + layout="topleft" + left_pad="10" + name="texture_detail_1" + default_image_id="63338ede-0037-c4fd-855b-015d77112fc8" + top_delta="0" + width="100" /> + <texture_picker + follows="left|top" + height="121" + layout="topleft" + left_pad="10" + name="texture_detail_2" + default_image_id="303cd381-8560-7579-23f1-f0a880799740" + top_delta="0" + width="100" /> + <texture_picker + follows="left|top" + height="121" + layout="topleft" + left_pad="10" + name="texture_detail_3" + default_image_id="53a2f406-4895-1d13-d541-d2e3b86bc19c" + top_delta="0" + width="100" /> + <texture_picker + visible="false" + follows="left|top" + height="121" + layout="topleft" + left="10" + name="material_detail_0" + pick_type="material" + default_image_id="968cbad0-4dad-d64e-71b5-72bf13ad051a" + top_delta="0" + width="100" /> + <texture_picker + visible="false" + follows="left|top" + height="121" + layout="topleft" + left_pad="10" + name="material_detail_1" + pick_type="material" + default_image_id="968cbad0-4dad-d64e-71b5-72bf13ad051a" + top_delta="0" + width="100" /> + <texture_picker + visible="false" + follows="left|top" + height="121" + layout="topleft" + left_pad="10" + name="material_detail_2" + pick_type="material" + default_image_id="968cbad0-4dad-d64e-71b5-72bf13ad051a" + top_delta="0" + width="100" /> + <texture_picker + visible="false" + follows="left|top" + height="121" + layout="topleft" + left_pad="10" + name="material_detail_3" + pick_type="material" + default_image_id="968cbad0-4dad-d64e-71b5-72bf13ad051a" + top_delta="0" + width="100" /> + <text + type="string" + length="1" + follows="left|top" + height="20" + layout="topleft" + left="10" + name="height_text_lbl" + top_delta="104" + width="65"> + 1 (Low) + </text> + <text + type="string" + length="1" + follows="left|top" + height="20" + layout="topleft" + left_pad="45" + name="height_text_lbl2" + top_delta="0" + width="100"> + 2 + </text> + <text + type="string" + length="1" + follows="left|top" + height="20" + layout="topleft" + left_pad="10" + name="height_text_lbl3" + top_delta="0" + width="100"> + 3 + </text> + <text + type="string" + length="1" + follows="left|top" + height="20" + layout="topleft" + left_pad="10" + name="height_text_lbl4" + top_delta="0" + width="100"> + 4 (High) + </text> + <layout_stack name="terrain_features_stack" + width="477" + height="230" + follows="all" + animate="false" + left="0" + top_delta="22" + orientation="vertical"> + <layout_panel name="frame_settings_terrain" + auto_resize="true" + user_resize="false" + height="230" + width="467" + min_height="0" + visible="true"> + <tab_container + follows="all" + halign="left" + height="230" + visible="true" + layout="topleft" + left="0" + name="terrain_tabs" + tab_position="top" + tab_width="110" + tab_padding_right="3" + top_pad="0" + width="700"> + <panel + border="true" + filename="panel_settings_terrain_elevation.xml" + label="Elevation" + layout="topleft" + left_delta="0" + top_pad="5" + name="terrain_elevation_panel" /> + <panel + border="true" + filename="panel_settings_terrain_transform.xml" + label="Transforms" + layout="topleft" + left_delta="0" + top_pad="5" + name="terrain_transform_panel" /> + </tab_container> + </layout_panel> + </layout_stack> + <button + enabled="true" + follows="left|top" + height="20" + label="Apply" + layout="topleft" + left="351" + name="apply_btn" + top_delta="310" + width="100" /> +</panel> diff --git a/indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml b/indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml index 59ee0c6ad5..a29cdb5b41 100644 --- a/indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml +++ b/indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml @@ -9,7 +9,7 @@ top="0"> <string name="hdr_string">HDR Scale:</string> <string name="brightness_string">Brightness:</string> - <string name="hdr_tooltip">Intensity of lightning effects such as realistically bright skies and dynamic exposure. 1.0 is the default, 0 is off, values between 0 and 1 are mixing Ambient with HDR.</string> + <string name="hdr_tooltip">Intensity of lighting effects such as realistically bright skies and dynamic exposure. 1.0 is the default, 0 is off, values between 0 and 1 are mixing Ambient with HDR.</string> <layout_stack name="main_ls" follows="all" @@ -318,7 +318,7 @@ layout="topleft" left_delta="-5" top_delta="25" - tooltip="Irradiance control. When not zero, enables HDR lighting model." + tool_tip="Irradiance control. When not zero, enables HDR lighting model." width="200"> Reflection Probe Ambiance (HDR): </text> diff --git a/indra/newview/skins/default/xui/en/panel_settings_terrain_elevation.xml b/indra/newview/skins/default/xui/en/panel_settings_terrain_elevation.xml new file mode 100644 index 0000000000..89443290ce --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_settings_terrain_elevation.xml @@ -0,0 +1,307 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<panel + border="true" + follows="all" + label="Elevation" + layout="topleft" + left="0" + name="panel_settings_terrain_elevation" + top="0"> + <spinner + follows="left|top" + height="20" + label="Water Height" + label_width="120" + layout="topleft" + left="15" + max_val="100" + name="water_height_spin" + top_delta="18" + width="180" /> + <spinner + follows="left|top" + height="20" + increment="0.2" + label="Terrain Raise Limit" + label_width="120" + layout="topleft" + left="240" + max_val="100" + name="terrain_raise_spin" + top_delta="0" + width="180" /> + <spinner + follows="left|top" + height="20" + increment="0.2" + label="Terrain Lower Limit" + label_width="120" + layout="topleft" + left="240" + max_val="0" + min_val="-100" + name="terrain_lower_spin" + top_delta="20" + width="180" /> + <view_border + bevel_style="none" + follows="top|left" + height="60" + layout="topleft" + left="8" + top_delta="-30" + width="460" /> + <text + type="string" + length="1" + follows="left|top" + height="20" + layout="topleft" + left="10" + name="height_text_lbl5" + top_delta="74" + width="300"> + Texture Elevation Ranges + </text> + <text + visible="false" + type="string" + length="1" + follows="left|top" + height="20" + layout="topleft" + left="10" + name="height_text_lbl5_material" + top_delta="0" + width="300"> + Material Elevation Ranges + </text> + <text + follows="left|top" + height="20" + layout="topleft" + left="10" + name="height_text_lbl10" + top_delta="30" + width="200" + word_wrap="true"> + These values represent the blend range for the textures above. + </text> + <text + visible="false" + follows="left|top" + height="20" + layout="topleft" + left="10" + name="height_text_lbl10_material" + top_delta="0" + width="200" + word_wrap="true"> + These values represent the blend range for the materials above. + </text> + <text + follows="left|top" + height="60" + layout="topleft" + left_delta="0" + name="height_text_lbl11" + top_delta="32" + width="200" + word_wrap="true"> + Measured in meters, the LOW value is the MAXIMUM height of Texture #1, and the HIGH value is the MINIMUM height of Texture #4. + </text> + <text + visible="false" + follows="left|top" + height="60" + layout="topleft" + left_delta="0" + name="height_text_lbl11_material" + top_delta="0" + width="200" + word_wrap="true"> + Measured in meters, the LOW value is the MAXIMUM height of Material #1, and the HIGH value is the MINIMUM height of Material #4. + </text> + <text + follows="left|top" + height="20" + layout="topleft" + left="270" + name="height_text_lbl6" + top_delta="-62" + width="100"> + Northwest + </text> + <text + follows="left|top" + height="20" + layout="topleft" + left_pad="10" + name="height_text_lbl7" + top_delta="0" + width="100"> + Northeast + </text> +<!-- northwest low--> + <spinner + follows="left|top" + height="20" + increment="0.5" + label="Low" + label_width="37" + layout="topleft" + left="230" + max_val="500" + min_val="-500" + name="height_start_spin_1" + top_delta="15" + width="100" /> +<!-- northeast low--> + <spinner + follows="left|top" + height="20" + increment="0.5" + label="Low" + label_width="37" + layout="topleft" + left_pad="10" + max_val="500" + min_val="-500" + name="height_start_spin_3" + top_delta="0" + width="100" /> +<!-- northwest high--> + <spinner + follows="left|top" + height="20" + increment="0.5" + label="High" + label_width="37" + layout="topleft" + left="230" + max_val="500" + min_val="-500" + name="height_range_spin_1" + top_delta="20" + width="100" /> +<!-- northeast high--> + <spinner + follows="left|top" + height="20" + increment="0.5" + label="High" + label_width="37" + layout="topleft" + left_pad="10" + max_val="500" + min_val="-500" + name="height_range_spin_3" + top_delta="0" + width="100" /> + <text + follows="left|top" + height="20" + layout="topleft" + left="270" + name="height_text_lbl8" + top_pad="10" + width="100"> + Southwest + </text> + <text + follows="left|top" + height="20" + layout="topleft" + left_pad="10" + name="height_text_lbl9" + top_delta="0" + width="100"> + Southeast + </text> +<!-- southwest low--> + <spinner + follows="left|top" + height="20" + increment="0.5" + label="Low" + label_width="37" + layout="topleft" + left="230" + max_val="500" + min_val="-500" + name="height_start_spin_0" + top_delta="15" + width="100" /> +<!-- southeast low--> + <spinner + follows="left|top" + height="20" + increment="0.5" + label="Low" + label_width="37" + layout="topleft" + left_pad="10" + max_val="500" + min_val="-500" + name="height_start_spin_2" + top_delta="0" + width="100" /> +<!--southwest high--> + <spinner + follows="left|top" + height="20" + increment="0.5" + label="High" + label_width="37" + layout="topleft" + left="230" + max_val="500" + min_val="-500" + name="height_range_spin_0" + top_delta="20" + width="100" /> +<!-- southeast high--> + <spinner + follows="left|top" + height="20" + increment="0.5" + label="High" + label_width="37" + layout="topleft" + left_pad="10" + max_val="500" + min_val="-500" + name="height_range_spin_2" + top_delta="0" + width="100" /> +<!-- Terrain Download/Upload/Bake buttons --> + <button + follows="left|top" + height="20" + label="Download RAW terrain..." + layout="topleft" + left="10" + name="download_raw_btn" + tool_tip="Available only to estate owners, not managers" + top_delta="40" + width="160" /> + <button + follows="left|top" + height="20" + label="Upload RAW terrain..." + layout="topleft" + left_pad="10" + top_delta="0" + name="upload_raw_btn" + tool_tip="Available only to estate owners, not managers" + width="160" /> + <button + follows="left|top" + height="20" + label="Bake Terrain" + layout="topleft" + left_pad="10" + name="bake_terrain_btn" + tool_tip="Set current terrain as mid-point for raise/lower limits" + width="100" /> +</panel> diff --git a/indra/newview/skins/default/xui/en/panel_settings_terrain_transform.xml b/indra/newview/skins/default/xui/en/panel_settings_terrain_transform.xml new file mode 100644 index 0000000000..0bf0d8cffc --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_settings_terrain_transform.xml @@ -0,0 +1,421 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<panel + border="true" + follows="all" + label="Samping" + layout="topleft" + left="0" + name="panel_settings_terrain_transform" + top="0"> + <text + type="string" + length="1" + halign="center" + valign="center" + follows="left|top" + height="20" + layout="topleft" + name="terrain0_label" + left="48" + top_delta="0" + width="62"> + 1 + </text> + <text + type="string" + length="1" + halign="center" + valign="center" + follows="left|top" + height="20" + layout="topleft" + name="terrain1_label" + left_delta="110" + top_delta="0" + width="62"> + 2 + </text> + <text + type="string" + length="1" + halign="center" + valign="center" + follows="left|top" + height="20" + layout="topleft" + name="terrain2_label" + left_delta="110" + top_delta="0" + width="62"> + 3 + </text> + <text + type="string" + length="1" + halign="center" + valign="center" + follows="left|top" + height="20" + layout="topleft" + name="terrain3_label" + left_delta="110" + top_delta="0" + width="62"> + 4 + </text> + <text + type="string" + length="1" + halign="left" + valign="center" + follows="left|top" + height="20" + layout="topleft" + name="terrain0ScaleU_label" + left="10" + top_pad="0" + width="170"> + Scale u + </text> + <spinner + follows="left|top" + height="19" + initial_value="1" + label="Scale u" + label_width="0" + layout="topleft" + left="46" + min_val="-100" + max_val="100" + name="terrain0ScaleU" + width="64" /> + <spinner + follows="left|top" + height="19" + initial_value="1" + label="Scale u" + label_width="0" + layout="topleft" + left_delta="110" + min_val="-100" + max_val="100" + name="terrain1ScaleU" + width="64" /> + <spinner + follows="left|top" + height="19" + initial_value="1" + label="Scale u" + label_width="0" + layout="topleft" + left_delta="110" + min_val="-100" + max_val="100" + name="terrain2ScaleU" + width="64" /> + <spinner + follows="left|top" + height="19" + initial_value="1" + label="Scale u" + label_width="0" + layout="topleft" + left_delta="110" + min_val="-100" + max_val="100" + name="terrain3ScaleU" + width="64" /> + <view_border + bevel_style="none" + follows="top|left" + height="0" + layout="topleft" + left="8" + top_pad="8" + name="terrainScaleU_horizontal" + width="432" /> + <text + type="string" + length="1" + halign="left" + valign="center" + follows="left|top" + height="20" + layout="topleft" + name="terrain0ScaleV_label" + left="10" + top_pad="0" + width="170"> + Scale v + </text> + <spinner + follows="left|top" + height="19" + initial_value="1" + label="Scale v" + label_width="0" + layout="topleft" + left="46" + min_val="-100" + max_val="100" + name="terrain0ScaleV" + width="64" /> + <spinner + follows="left|top" + height="19" + initial_value="1" + label="Scale u" + label_width="0" + layout="topleft" + left_delta="110" + min_val="-100" + max_val="100" + name="terrain1ScaleV" + width="64" /> + <spinner + follows="left|top" + height="19" + initial_value="1" + label="Scale u" + label_width="0" + layout="topleft" + left_delta="110" + min_val="-100" + max_val="100" + name="terrain2ScaleV" + width="64" /> + <spinner + follows="left|top" + height="19" + initial_value="1" + label="Scale u" + label_width="0" + layout="topleft" + left_delta="110" + min_val="-100" + max_val="100" + name="terrain3ScaleV" + width="64" /> + <view_border + bevel_style="none" + follows="top|left" + height="0" + layout="topleft" + left="8" + top_pad="8" + name="terrainScaleV_horizontal" + width="432" /> + <text + type="string" + length="1" + halign="left" + valign="center" + follows="left|top" + height="20" + layout="topleft" + name="terrain0Rotation_label" + left="10" + top_pad="0" + width="170"> + Rotation + </text> + <spinner + follows="left|top" + height="19" + initial_value="0" + label="Rotation" + label_width="0" + layout="topleft" + left="46" + min_val="-360" + max_val="360" + name="terrain0Rotation" + width="64" /> + <spinner + follows="left|top" + height="19" + initial_value="0" + label="Scale u" + label_width="0" + layout="topleft" + left_delta="110" + min_val="-360" + max_val="360" + name="terrain1Rotation" + width="64" /> + <spinner + follows="left|top" + height="19" + initial_value="0" + label="Scale u" + label_width="0" + layout="topleft" + left_delta="110" + min_val="-360" + max_val="360" + name="terrain2Rotation" + width="64" /> + <spinner + follows="left|top" + height="19" + initial_value="0" + label="Scale u" + label_width="0" + layout="topleft" + left_delta="110" + min_val="-360" + max_val="360" + name="terrain3Rotation" + width="64" /> + <view_border + bevel_style="none" + follows="top|left" + height="0" + layout="topleft" + left="8" + top_pad="8" + name="terrainRotation_horizontal" + width="432" /> + <text + type="string" + length="1" + halign="left" + valign="center" + follows="left|top" + height="20" + layout="topleft" + name="terrain0OffsetU_label" + left="10" + top_pad="0" + width="170"> + Offset y + </text> + <spinner + follows="left|top" + height="19" + initial_value="0" + label="Offset u" + label_width="0" + layout="topleft" + left="46" + min_val="-999" + max_val="999" + name="terrain0OffsetU" + width="64" /> + <spinner + follows="left|top" + height="19" + initial_value="0" + label="Scale u" + label_width="0" + layout="topleft" + left_delta="110" + min_val="-999" + max_val="999" + name="terrain1OffsetU" + width="64" /> + <spinner + follows="left|top" + height="19" + initial_value="0" + label="Scale u" + label_width="0" + layout="topleft" + left_delta="110" + min_val="-999" + max_val="999" + name="terrain2OffsetU" + width="64" /> + <spinner + follows="left|top" + height="19" + initial_value="0" + label="Scale u" + label_width="0" + layout="topleft" + left_delta="110" + min_val="-999" + max_val="999" + name="terrain3OffsetU" + width="64" /> + <view_border + bevel_style="none" + follows="top|left" + height="0" + layout="topleft" + left="8" + top_pad="8" + name="terrainOffsetU_horizontal" + width="432" /> + <text + type="string" + length="1" + halign="left" + valign="center" + follows="left|top" + height="20" + layout="topleft" + name="terrain0OffsetV_label" + left="10" + top_pad="0" + width="170"> + Offset v + </text> + <spinner + follows="left|top" + height="19" + initial_value="0" + label="Offset v" + label_width="0" + layout="topleft" + left="46" + min_val="-999" + max_val="999" + name="terrain0OffsetV" + width="64" /> + <spinner + follows="left|top" + height="19" + initial_value="0" + label="Scale u" + label_width="0" + layout="topleft" + left_delta="110" + min_val="-999" + max_val="999" + name="terrain1OffsetV" + width="64" /> + <spinner + follows="left|top" + height="19" + initial_value="0" + label="Scale u" + label_width="0" + layout="topleft" + left_delta="110" + min_val="-999" + max_val="999" + name="terrain2OffsetV" + width="64" /> + <spinner + follows="left|top" + height="19" + initial_value="0" + label="Scale u" + label_width="0" + layout="topleft" + left_delta="110" + min_val="-999" + max_val="999" + name="terrain3OffsetV" + width="64" /> + <view_border + bevel_style="none" + follows="top|left" + height="0" + layout="topleft" + left="8" + top_pad="8" + name="terrainOffsetV_horizontal" + width="432" /> +</panel> diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index daa49eaa2c..232586636b 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -3820,6 +3820,7 @@ Please reinstall viewer from https://secondlife.com/support/downloads/ and cont <string name="voice_morphing_url">https://secondlife.com/destination/voice-island</string> <string name="premium_voice_morphing_url">https://secondlife.com/destination/voice-morphing-premium</string> + <string name="no_voice_morphing_faq_url">https://lindenlab.freshdesk.com/support/solutions/articles/31000173560-webrtc-update-for-voice-chat-faq/</string> <string name="lindenhomes_get_home_url">https://secondlife.com/land/lindenhomes/member.php</string> <string name="lindenhomes_my_home_url">https://land.secondlife.com/en-Us/lindenhomes/my-home.php</string> diff --git a/indra/newview/skins/default/xui/es/floater_texture_fetch_debugger.xml b/indra/newview/skins/default/xui/es/floater_texture_fetch_debugger.xml deleted file mode 100644 index 59aaf7f74a..0000000000 --- a/indra/newview/skins/default/xui/es/floater_texture_fetch_debugger.xml +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<floater name="TexFetchDebugger" title="Depurador de obtención de texturas"> - <text name="total_num_fetched_label"> - 1, Número total de texturas obtenidas: [NUM] - </text> - <text name="total_num_fetching_requests_label"> - 2, Número total de solicitudes de obtención: [NUM] - </text> - <text name="total_num_cache_hits_label"> - 3, Número total de aciertos de caché: [NUM] - </text> - <text name="total_num_visible_tex_label"> - 4, Número total de texturas visibles: [NUM] - </text> - <text name="total_num_visible_tex_fetch_req_label"> - 5, Número total de solicitudes de obtención de texturas visibles: [NUM] - </text> - <text name="total_fetched_data_label"> - 6, Número total de datos obtenidos: [SIZE1] KB, Datos descodificados: [SIZE2] KB, [PIXEL] MPÃxeles - </text> - <text name="total_fetched_vis_data_label"> - 7, Número total de datos visibles: [SIZE1] KB, Datos descodificados: [SIZE2] KB - </text> - <text name="total_fetched_rendered_data_label"> - 8, Número total de datos representados: [SIZE1] KB, Datos descodificados: [SIZE2] KB, [PIXEL] MPÃxeles - </text> - <text name="total_time_cache_read_label"> - 9, Tiempo total en lecturas de caché: [TIME] segundos - </text> - <text name="total_time_cache_write_label"> - 10, Tiempo total en escrituras de caché: [TIME] segundos - </text> - <text name="total_time_decode_label"> - 11, Tiempo total en descodificaciones: [TIME] segundos - </text> - <text name="total_time_gl_label"> - 12, Tiempo total en la creación de texturas gl: [TIME] segundos - </text> - <text name="total_time_http_label"> - 13, Tiempo total en obtención de HTTP: [TIME] segundos - </text> - <text name="total_time_fetch_label"> - 14, Tiempo total en obtención completa: [TIME] segundos - </text> - <text name="total_time_refetch_vis_cache_label"> - 15, Volviendo a obtener visibles de la caché, Tiempo: [TIME] segundos, Obtenidos: [SIZE] KB, [PIXEL] MPÃxeles - </text> - <text name="total_time_refetch_all_cache_label"> - 16, Volviendo a obtener todas las texturas de caché, Tiempo: [TIME] segundos, Obtenidos: [SIZE] KB, [PIXEL] MPÃxeles - </text> - <text name="total_time_refetch_vis_http_label"> - 17, Volviendo a obtener visibles de HTTP, Tiempo: [TIME] segundos, Obtenidos: [SIZE] KB, [PIXEL] MPÃxeles - </text> - <text name="total_time_refetch_all_http_label"> - 18, Volviendo a obtener todas las texturas de HTTP, Tiempo: [TIME] segundos, Obtenidos: [SIZE] KB, [PIXEL] MPÃxeles - </text> - <spinner label="19, Proporción de texeles/pÃxeles:" name="texel_pixel_ratio"/> - <text name="texture_source_label"> - 20, Fuente de texturas: - </text> - <radio_group name="texture_source"> - <radio_item label="Caché + HTTP" name="0"/> - <radio_item label="Solo HTTP" name="1"/> - </radio_group> - <button label="Iniciar" name="start_btn"/> - <button label="Restablecer" name="clear_btn"/> - <button label="Cerrar" name="close_btn"/> - <button label="Lectura de caché" name="cacheread_btn"/> - <button label="Escritura de caché" name="cachewrite_btn"/> - <button label="HTTP" name="http_btn"/> - <button label="Descodificar" name="decode_btn"/> - <button label="Textura GL" name="gl_btn"/> - <button label="Volver a obtener caché de vis." name="refetchviscache_btn"/> - <button label="Volver a obtener toda la caché" name="refetchallcache_btn"/> - <button label="Volver a obtener HTTP de vis." name="refetchvishttp_btn"/> - <button label="Volver a obtener todo el HTTP" name="refetchallhttp_btn"/> -</floater> diff --git a/indra/newview/skins/default/xui/fr/floater_texture_fetch_debugger.xml b/indra/newview/skins/default/xui/fr/floater_texture_fetch_debugger.xml deleted file mode 100644 index caae15ea17..0000000000 --- a/indra/newview/skins/default/xui/fr/floater_texture_fetch_debugger.xml +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<floater name="TexFetchDebugger" title="Outil de débogage de la récupération des textures"> - <text name="total_num_fetched_label"> - 1, nombre total de textures récupérées : [NUM] - </text> - <text name="total_num_fetching_requests_label"> - 2, nombre total de demandes de récupération : [NUM] - </text> - <text name="total_num_cache_hits_label"> - 3, nombre total de présences dans le cache : [NUM] - </text> - <text name="total_num_visible_tex_label"> - 4, nombre total de textures visibles : [NUM] - </text> - <text name="total_num_visible_tex_fetch_req_label"> - 5, nombre total de demandes de récupération de textures visibles : [NUM] - </text> - <text name="total_fetched_data_label"> - 6, nombre total de données récupérées : [SIZE1] Ko, données décodées : [SIZE2] Ko, [PIXEL] Mpixels - </text> - <text name="total_fetched_vis_data_label"> - 7, nombre total de données visibles : [SIZE1] Ko, données décodées : [SIZE2] Ko - </text> - <text name="total_fetched_rendered_data_label"> - 8, nombre total de données rendues : [SIZE1] Ko, données décodées : [SIZE2] Ko, [PIXEL] Mpixels - </text> - <text name="total_time_cache_read_label"> - 9, durée totale des lectures du cache : [TIME] secondes - </text> - <text name="total_time_cache_write_label"> - 10, durée totale des écritures du cache : [TIME] secondes - </text> - <text name="total_time_decode_label"> - 11, durée totale des décodages : [TIME] secondes - </text> - <text name="total_time_gl_label"> - 12, durée totale de la création de textures GL : [TIME] secondes - </text> - <text name="total_time_http_label"> - 13, durée totale de la récupération HTTP : [TIME] secondes - </text> - <text name="total_time_fetch_label"> - 14, durée totale de la récupération intégrale : [TIME] secondes - </text> - <text name="total_time_refetch_vis_cache_label"> - 15, nouvelle récupération des données visibles du cache, Durée : [TIME] secondes, Récupéré : [SIZE] Ko, [PIXEL] Mpixels - </text> - <text name="total_time_refetch_all_cache_label"> - 16, nouvelle récupération de toutes les textures du cache, Durée : [TIME] secondes, Récupéré : [SIZE] Ko, [PIXEL] Mpixels - </text> - <text name="total_time_refetch_vis_http_label"> - 17, nouvelle récupération des données visibles de la requête HTTP, Durée : [TIME] secondes, Récupéré : [SIZE] Ko, [PIXEL] Mpixels - </text> - <text name="total_time_refetch_all_http_label"> - 18, nouvelle récupération de toutes les textures de la requête HTTP, Durée : [TIME] secondes, Récupéré : [SIZE] Ko, [PIXEL] Mpixels - </text> - <spinner label="19, taux de texels/pixels :" name="texel_pixel_ratio"/> - <text name="texture_source_label"> - 20, source des textures : - </text> - <radio_group name="texture_source"> - <radio_item label="Cache + HTTP" name="0"/> - <radio_item label="HTTP uniquement" name="1"/> - </radio_group> - <button label="Démarrer" name="start_btn"/> - <button label="Réinitialiser" name="clear_btn"/> - <button label="Fermer" name="close_btn"/> - <button label="Lecture du cache" name="cacheread_btn"/> - <button label="Écriture du cache" name="cachewrite_btn"/> - <button label="HTTP" name="http_btn"/> - <button label="Décoder" name="decode_btn"/> - <button label="Texture GL" name="gl_btn"/> - <button label="Récupérer à nouveau les données visibles du cache" name="refetchviscache_btn"/> - <button label="Récupérer cache" name="refetchallcache_btn"/> - <button label="Récupérer à nouveau les données visibles de la requête HTTP" name="refetchvishttp_btn"/> - <button label="Récupérer HTTP" name="refetchallhttp_btn"/> -</floater> diff --git a/indra/newview/skins/default/xui/it/floater_texture_fetch_debugger.xml b/indra/newview/skins/default/xui/it/floater_texture_fetch_debugger.xml deleted file mode 100644 index 49b6453319..0000000000 --- a/indra/newview/skins/default/xui/it/floater_texture_fetch_debugger.xml +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<floater name="TexFetchDebugger" title="Debugger recupero texture"> - <text name="total_num_fetched_label"> - 1, Numero totale di texture recuperate: [NUM] - </text> - <text name="total_num_fetching_requests_label"> - 2, Numero totale di richieste di recupero: [NUM] - </text> - <text name="total_num_cache_hits_label"> - 3, Numero totale di recuperi dalla cache: [NUM] - </text> - <text name="total_num_visible_tex_label"> - 4, Numero totale di texture visibili: [NUM] - </text> - <text name="total_num_visible_tex_fetch_req_label"> - 5, Numero totale di richieste di fetching texture visibili: [NUM] - </text> - <text name="total_fetched_data_label"> - 6, Numero totale di fetching dati: [SIZE1] KB, Dati decodificati: [SIZE2] KB, [PIXEL] MPixel - </text> - <text name="total_fetched_vis_data_label"> - 7, Numero totale di dati visibili: [SIZE1] KB, Dati decodificati: [SIZE2] KB - </text> - <text name="total_fetched_rendered_data_label"> - 8, Numero totale di rendering dei dati: [SIZE1] KB, Dati decodificati: [SIZE2] KB, [PIXEL] MPixel - </text> - <text name="total_time_cache_read_label"> - 9, Tempo totale letture cache: [TIME] secondi - </text> - <text name="total_time_cache_write_label"> - 10, Tempo totale scrittura cache: [TIME] secondi - </text> - <text name="total_time_decode_label"> - 11, Tempo totale decodifica: [TIME] secondi - </text> - <text name="total_time_gl_label"> - 12, Tempo totale creazione texture gl: [TIME] secondi - </text> - <text name="total_time_http_label"> - 13, Tempo totale fetching HTTP: [TIME] secondi - </text> - <text name="total_time_fetch_label"> - 14, Tempo totale complessivo fetching: [TIME] secondi - </text> - <text name="total_time_refetch_vis_cache_label"> - 15, Nuovo fetching elementi visibili dalla cache, Tempo: [TIME] secondi, fetching: [SIZE] KB, [PIXEL] MPixels - </text> - <text name="total_time_refetch_all_cache_label"> - 16, Nuovo fetching di tutte le texture dalla cache, Tempo: [TIME] secondi, fetching: [SIZE] KB, [PIXEL] MPixels - </text> - <text name="total_time_refetch_vis_http_label"> - 17, Nuovo fetching elementi visibili da HTTP, Tempo: [TIME] secondi, fetching: [SIZE] KB, [PIXEL] MPixels - </text> - <text name="total_time_refetch_all_http_label"> - 18, Nuovo fetching di tutte le texture da HTTP, Tempo: [TIME] secondi, fetching: [SIZE] KB, [PIXEL] MPixels - </text> - <spinner label="19, Rapporto Texel/Pixel:" name="texel_pixel_ratio"/> - <text name="texture_source_label"> - 20, Fonte texture: - </text> - <radio_group name="texture_source"> - <radio_item label="Cache + HTTP" name="0"/> - <radio_item label="Solo HTTP" name="1"/> - </radio_group> - <button label="Attiva" name="start_btn"/> - <button label="Reimposta" name="clear_btn"/> - <button label="Chiudi" name="close_btn"/> - <button label="Lettura cache" name="cacheread_btn"/> - <button label="Scrittura cache" name="cachewrite_btn"/> - <button label="HTTP" name="http_btn"/> - <button label="Decodifica" name="decode_btn"/> - <button label="Texture GL" name="gl_btn"/> - <button label="Nuovo fetch visibili cache" name="refetchviscache_btn"/> - <button label="Nuovo fetching di tutta la cache" name="refetchallcache_btn"/> - <button label="Nuovo fetch visibili HTTP" name="refetchvishttp_btn"/> - <button label="Nuovo fetching di tutto il contenuto HTTP" name="refetchallhttp_btn"/> -</floater> diff --git a/indra/newview/skins/default/xui/ja/floater_outfit_photo_preview.xml b/indra/newview/skins/default/xui/ja/floater_outfit_photo_preview.xml deleted file mode 100644 index 96809924c1..0000000000 --- a/indra/newview/skins/default/xui/ja/floater_outfit_photo_preview.xml +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<floater name="outfit_photo_preview"> - <floater.string name="Title"> - テスクãƒãƒ£ï¼š[NAME] - </floater.string> - <floater.string name="exceed_limits"> - アウトフィット画åƒã®æœ€å¤§ã‚µã‚¤ã‚ºã¯[MAX_WIDTH]✕[MAX_HEIGHT]ã§ã™ã€‚ä»–ã®ãƒ†ã‚¹ã‚¯ãƒãƒ£ã‚’é¸æŠžã—ã¦ãã ã•ã„。 - </floater.string> - <floater.string name="photo_confirmation"> - ã“ã®ç”»åƒã‚’[OUTFIT]ã®ã‚¢ã‚¦ãƒˆãƒ•ィット画åƒã«ã—ã¾ã™ã‹ï¼Ÿ - </floater.string> - <text name="dimensions"> - [WIDTH]px✕[HEIGHT]px - </text> - <text name="notification"/> - <button label="OK" name="ok_btn"/> - <button label="ã‚ャンセル" name="cancel_btn"/> -</floater> diff --git a/indra/newview/skins/default/xui/ja/floater_simple_outfit_snapshot.xml b/indra/newview/skins/default/xui/ja/floater_simple_outfit_snapshot.xml deleted file mode 100644 index 0b8030048d..0000000000 --- a/indra/newview/skins/default/xui/ja/floater_simple_outfit_snapshot.xml +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<floater name="simple_outfit_snapshot" title="アウトフィットã®ã‚¹ãƒŠãƒƒãƒ—ショット"> - <ui_ctrl name="thumbnail_placeholder"/> - <button label="ç”»åƒã‚’撮影" name="new_snapshot_btn"/> - <button label="ä¿å˜ï¼ˆL$ [UPLOAD_COST])" name="save_btn"/> - <button label="ã‚ャンセル" name="cancel_btn"/> -</floater> diff --git a/indra/newview/skins/default/xui/ja/floater_texture_fetch_debugger.xml b/indra/newview/skins/default/xui/ja/floater_texture_fetch_debugger.xml deleted file mode 100644 index c22cbba0d5..0000000000 --- a/indra/newview/skins/default/xui/ja/floater_texture_fetch_debugger.xml +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<floater name="TexFetchDebugger" title="テクスãƒãƒ£å–得デãƒãƒƒã‚¬"> - <text name="total_num_fetched_label"> - 1,å–å¾—ã—ãŸãƒ†ã‚¯ã‚¹ãƒãƒ£ã®åˆè¨ˆæ•°ï¼š[NUM] - </text> - <text name="total_num_fetching_requests_label"> - 2,å–得リクエストã®åˆè¨ˆæ•°ï¼š[NUM] - </text> - <text name="total_num_cache_hits_label"> - 3,ã‚ャッシュヒットã®åˆè¨ˆæ•°ï¼š[NUM] - </text> - <text name="total_num_visible_tex_label"> - 4,表示テクスãƒãƒ£ã®åˆè¨ˆæ•°ï¼š[NUM] - </text> - <text name="total_num_visible_tex_fetch_req_label"> - 5,表示テクスãƒãƒ£å–得リクエストã®åˆè¨ˆæ•°ï¼š[NUM] - </text> - <text name="total_fetched_data_label"> - 6,å–å¾—ã—ãŸãƒ‡ãƒ¼ã‚¿ã®åˆè¨ˆæ•°ï¼š[SIZE1]㎅ã€ãƒ‡ã‚³ãƒ¼ãƒ‰ã•れãŸãƒ‡ãƒ¼ã‚¿ï¼š[SIZE2]㎅ã€[PIXEL]メガピクセル - </text> - <text name="total_fetched_vis_data_label"> - 7,表示データã®åˆè¨ˆæ•°ï¼š[SIZE1]㎅ã€ãƒ‡ã‚³ãƒ¼ãƒ‰ã•れãŸãƒ‡ãƒ¼ã‚¿ï¼š[SIZE2]㎅ - </text> - <text name="total_fetched_rendered_data_label"> - 8,レンダリングã•れãŸãƒ‡ãƒ¼ã‚¿ã®åˆè¨ˆæ•°ï¼š[SIZE1]㎅ã€ãƒ‡ã‚³ãƒ¼ãƒ‰ã•れãŸãƒ‡ãƒ¼ã‚¿ï¼š[SIZE2]㎅ã€[PIXEL]メガピクセル - </text> - <text name="total_time_cache_read_label"> - 9,ã‚ャッシュèªã¿å–りã®åˆè¨ˆæ™‚間:[TIME]ç§’ - </text> - <text name="total_time_cache_write_label"> - 1ï¼ï¼Œã‚ャッシュ書ãè¾¼ã¿ã®åˆè¨ˆæ™‚間:[TIME]ç§’ - </text> - <text name="total_time_decode_label"> - 11,デコードã®åˆè¨ˆæ™‚間:[TIME]ç§’ - </text> - <text name="total_time_gl_label"> - 12,glテクスãƒãƒ£ä½œæˆã®åˆè¨ˆæ™‚間:[TIME]ç§’ - </text> - <text name="total_time_http_label"> - 13,HTTPå–å¾—ã®åˆè¨ˆæ™‚間:[TIME]ç§’ - </text> - <text name="total_time_fetch_label"> - 14,å–得全体ã®åˆè¨ˆæ™‚間:[TIME]ç§’ - </text> - <text name="total_time_refetch_vis_cache_label"> - 15,ã‚ャッシュã‹ã‚‰è¡¨ç¤ºãƒ†ã‚¯ã‚¹ãƒãƒ£ã‚’å†å–å¾—ã€æ™‚間:[TIME]ç§’ã€å–得:[SIZE]㎅ã€[PIXEL]メガピクセル - </text> - <text name="total_time_refetch_all_cache_label"> - 16,ã‚ャッシュã‹ã‚‰ã™ã¹ã¦ã®ãƒ†ã‚¯ã‚¹ãƒãƒ£ã‚’å†ãƒ•ェッãƒä¸ã€æ™‚間:[TIME]ç§’ã€ãƒ•ã‚§ãƒƒãƒæ¸ˆã¿ï¼š[SIZE]㎅ã€[PIXEL]メガピクセル - </text> - <text name="total_time_refetch_vis_http_label"> - 17,HTTPã‹ã‚‰å¯è¦–ファイルをå†ãƒ•ェッãƒä¸ã€æ™‚間:[TIME]ç§’ã€ãƒ•ã‚§ãƒƒãƒæ¸ˆã¿ï¼š[SIZE]㎅ã€[PIXEL]メガピクセル - </text> - <text name="total_time_refetch_all_http_label"> - 18,HTTPã‹ã‚‰ã™ã¹ã¦ã®ãƒ†ã‚¯ã‚¹ãƒãƒ£ã‚’å†ãƒ•ェッãƒä¸ã€æ™‚間:[TIME]ç§’ã€ãƒ•ã‚§ãƒƒãƒæ¸ˆã¿ï¼š[SIZE]㎅ã€[PIXEL]メガピクセル - </text> - <spinner label="19ã€ãƒ†ã‚»ãƒ«ï¼ãƒ”クセル比:" name="texel_pixel_ratio"/> - <text name="texture_source_label"> - 20ã€ãƒ†ã‚¯ã‚¹ãƒãƒ£ ソース: - </text> - <radio_group name="texture_source"> - <radio_item label="ã‚ャッシュ + HTTP" name="0"/> - <radio_item label="HTTP ã®ã¿" name="1"/> - </radio_group> - <button label="é–‹å§‹" name="start_btn"/> - <button label="リセット" name="clear_btn"/> - <button label="é–‰ã˜ã‚‹" name="close_btn"/> - <button label="ã‚ャッシュèªã¿å–り" name="cacheread_btn"/> - <button label="ã‚ャッシュ書ãè¾¼ã¿" name="cachewrite_btn"/> - <button label="HTTP" name="http_btn"/> - <button label="デコード" name="decode_btn"/> - <button label="GLテクスãƒãƒ£" name="gl_btn"/> - <button label="ã‚ャッシュ表示テクスãƒãƒ£å†å–å¾—" name="refetchviscache_btn"/> - <button label="ã™ã¹ã¦ã®ã‚ャッシュをå†ãƒ•ェッãƒ" name="refetchallcache_btn"/> - <button label="HTTP表示テクスãƒãƒ£å†å–å¾—" name="refetchvishttp_btn"/> - <button label="ã™ã¹ã¦ã® HTTP ã‚’å†ãƒ•ェッãƒ" name="refetchallhttp_btn"/> -</floater> diff --git a/indra/newview/skins/default/xui/ja/panel_preferences_grids.xml b/indra/newview/skins/default/xui/ja/panel_preferences_grids.xml deleted file mode 100644 index 18aca0dafc..0000000000 --- a/indra/newview/skins/default/xui/ja/panel_preferences_grids.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<panel label="グリッド" name="grids"> - <text name="add_grid_text"> - æ–°ã—ã„ã‚°ãƒªãƒƒãƒ‰ã‚’è¿½åŠ ï¼š - </text> - <line_editor name="add_grid" label="ãƒã‚°ã‚¤ãƒ³URIを入力"/> - <button label="è¿½åŠ " name="add_grid_commit"/> - <text name="manage_grid_text"> - グリッド管ç†ï¼š - </text> - <scroll_list name="grid_list"> - <scroll_list.columns label="グリッドå" name="grid_label"/> - <scroll_list.columns label="ãƒã‚°ã‚¤ãƒ³URI" name="login_uri"/> - <scroll_list.commit_callback function="Pref.SelectGrid"/> - </scroll_list> - <button label="有効化" name="activate_grid"/> - <button label="リフレッシュ" name="refresh_grid"/> - <button label="削除" name="remove_grid"/> - <button label="デãƒãƒƒã‚°" name="debug_grid"/> - <check_box label="ãƒã‚°ã‚¤ãƒ³æ™‚ã«ã‚°ãƒªãƒƒãƒ‰é¸æŠžã‚’表示" name="show_grid_selection_check" tool_tip="ãƒã‚°ã‚¤ãƒ³ç”»é¢ã«ã‚°ãƒªãƒƒãƒ‰é¸æŠžã‚’表示ã—ã¦ã€ä»–ã®ãƒ¯ãƒ¼ãƒ«ãƒ‰ã«ãƒã‚°ã‚¤ãƒ³ã—ã¾ã™ã€‚"/> -</panel> diff --git a/indra/newview/skins/default/xui/pl/floater_outfit_photo_preview.xml b/indra/newview/skins/default/xui/pl/floater_outfit_photo_preview.xml deleted file mode 100644 index 8c7de8e34e..0000000000 --- a/indra/newview/skins/default/xui/pl/floater_outfit_photo_preview.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes" ?> -<floater name="outfit_photo_preview"> - <floater.string name="Title"> - Tekstura: [NAME] - </floater.string> - <floater.string name="exceed_limits"> - Maks. rozmiar zdjÄ™cia stroju to [MAX_WIDTH]*[MAX_HEIGHT]. Wybierz innÄ… teksturÄ™. - </floater.string> - <floater.string name="photo_confirmation"> - Ustawić to zdjÄ™cie dla stroju [OUTFIT]? - </floater.string> - <button label="Anuluj" name="cancel_btn" /> -</floater> diff --git a/indra/newview/skins/default/xui/pl/floater_simple_outfit_snapshot.xml b/indra/newview/skins/default/xui/pl/floater_simple_outfit_snapshot.xml deleted file mode 100644 index 1a60b557b2..0000000000 --- a/indra/newview/skins/default/xui/pl/floater_simple_outfit_snapshot.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes" ?> -<floater name="simple_outfit_snapshot" title="ZDJĘCIE STROJU"> - <button label="Zrób zdjÄ™cie" name="new_snapshot_btn" /> - <button label="Zapisz ([UPLOAD_COST]L$)" name="save_btn" /> - <button label="Anuluj" name="cancel_btn" /> -</floater> diff --git a/indra/newview/skins/default/xui/pl/floater_texture_fetch_debugger.xml b/indra/newview/skins/default/xui/pl/floater_texture_fetch_debugger.xml deleted file mode 100644 index fc0687f333..0000000000 --- a/indra/newview/skins/default/xui/pl/floater_texture_fetch_debugger.xml +++ /dev/null @@ -1,73 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes" ?> -<floater name="TexFetchDebugger" title="Debuger Å‚adowania tekstur"> - <text name="total_num_fetched_label"> - 1, Pobranych tekstur: [NUM] - </text> - <text name="total_num_fetching_requests_label"> - 2, Próśb o pobranie: [NUM] - </text> - <text name="total_num_cache_hits_label"> - 3, TrafieÅ„ w cache: [NUM] - </text> - <text name="total_num_visible_tex_label"> - 4, Widocznych tekstur: [NUM] - </text> - <text name="total_num_visible_tex_fetch_req_label"> - 5, Próśb o pobranie widocznych tekstur: [NUM] - </text> - <text name="total_fetched_data_label"> - 6, Pobrane: [SIZE1]KB, zdekodowane: [SIZE2]KB, [PIXEL]MPikseli - </text> - <text name="total_fetched_vis_data_label"> - 7, Widoczne: [SIZE1]KB, zdekodowane: [SIZE2]KB - </text> - <text name="total_fetched_rendered_data_label"> - 8, Zrenderowane: [SIZE1]KB, zdekodowane: [SIZE2]KB, [PIXEL]MPikseli - </text> - <text name="total_time_cache_read_label"> - 9, Odczyty cache: [TIME] sekund - </text> - <text name="total_time_cache_write_label"> - 10, Zapisy cache: [TIME] sekund - </text> - <text name="total_time_decode_label"> - 11, Zdekodowania: [TIME] sekund - </text> - <text name="total_time_gl_label"> - 12, Tworzenie tekstur GL: [TIME] sekund - </text> - <text name="total_time_http_label"> - 13, Pobieranie przez HTTP: [TIME] sekund - </text> - <text name="total_time_fetch_label"> - 14, Pobieranie w sumie: [TIME] sekund - </text> - <text name="total_time_refetch_vis_cache_label"> - 15, Ponowne pobier. widocznych z cache, czas: [TIME] sekund, pobrano: [SIZE]KB, [PIXEL]MPikseli - </text> - <text name="total_time_refetch_all_cache_label"> - 16, Ponowne pobier. wszystkich z cache, czas: [TIME] sekund, pobrano: [SIZE]KB, [PIXEL]MPikseli - </text> - <text name="total_time_refetch_vis_http_label"> - 17, Ponowne pobier. widocznych z HTTP, czas: [TIME] sekund, pobrano: [SIZE]KB, [PIXEL]MPikseli - </text> - <text name="total_time_refetch_all_http_label"> - 18, Ponowne pobier. wszystkich z HTTP, czas: [TIME] sekund, pobrano: [SIZE]KB, [PIXEL]MPikseli - </text> - <spinner label="19, WspÅ‚. Teksel/Piksel:" name="texel_pixel_ratio" /> - <text name="texture_source_label"> - 20, ŹródÅ‚o tekstur: - </text> - <radio_group name="texture_source"> - <radio_item label="Tylko HTTP" name="1" /> - </radio_group> - <button label="Zamknij" name="close_btn" /> - <button label="Odcz. cache" name="cacheread_btn" /> - <button label="Zapis cache" name="cachewrite_btn" /> - <button label="Dekoduj" name="decode_btn" /> - <button label="Tekstura GL" name="gl_btn" /> - <button label="OdÅ›w. przez cache" name="refetchviscache_btn" /> - <button label="OdÅ›w. caÅ‚e cache" name="refetchallcache_btn" /> - <button label="OdÅ›w. przez HTTP" name="refetchvishttp_btn" /> - <button label="OdÅ›w. caÅ‚e HTTP" name="refetchallhttp_btn" /> -</floater> diff --git a/indra/newview/skins/default/xui/pt/floater_texture_fetch_debugger.xml b/indra/newview/skins/default/xui/pt/floater_texture_fetch_debugger.xml deleted file mode 100644 index 0e897aea09..0000000000 --- a/indra/newview/skins/default/xui/pt/floater_texture_fetch_debugger.xml +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<floater name="TexFetchDebugger" title="Depurador de obtenção de textura"> - <text name="total_num_fetched_label"> - 1, Número total de texturas obtidas: [NUM] - </text> - <text name="total_num_fetching_requests_label"> - 2, Número total de solicitações de obtenção: [NUM] - </text> - <text name="total_num_cache_hits_label"> - 3, Número total de acertos de cache: [NUM] - </text> - <text name="total_num_visible_tex_label"> - 4, Número total de texturas visÃveis: [NUM] - </text> - <text name="total_num_visible_tex_fetch_req_label"> - 5, Número total de solicitações de obtenção de texturas visÃveis: [NUM] - </text> - <text name="total_fetched_data_label"> - 6, Número total de dados obtidos: [SIZE1]KB, Dados decodificados: [SIZE2]KB, [PIXEL]MPixels - </text> - <text name="total_fetched_vis_data_label"> - 7, Número total de dados visÃveis: [SIZE1]KB, Dados decodificados: [SIZE2]KB - </text> - <text name="total_fetched_rendered_data_label"> - 8, Número total de dados renderizados: [SIZE1]KB, Dados decodificados: [SIZE2]KB, [PIXEL]MPixels - </text> - <text name="total_time_cache_read_label"> - 9, Tempo total de leituras de cache: [TIME] segundos - </text> - <text name="total_time_cache_write_label"> - 10, Tempo total de gravações em cache: [TIME] segundos - </text> - <text name="total_time_decode_label"> - 11, Tempo total das decodificações: [TIME] segundos - </text> - <text name="total_time_gl_label"> - 12, Tempo total de criação de texturas gl: [TIME] segundos - </text> - <text name="total_time_http_label"> - 13, Tempo total de obtenção de HTTP: [TIME] segundos - </text> - <text name="total_time_fetch_label"> - 14, Tempo total de obtenção completa: [TIME] segundos - </text> - <text name="total_time_refetch_vis_cache_label"> - 15, Obtendo novamente visÃveis do cache, Tempo: [TIME] segundos, Obtidos: [SIZE]KB, [PIXEL]MPixels - </text> - <text name="total_time_refetch_all_cache_label"> - 16, Obtendo novamente todas as texturas do cache, Tempo: [TIME] segundos, Obtidos: [SIZE]KB, [PIXEL]MPixels - </text> - <text name="total_time_refetch_vis_http_label"> - 17, Obtendo novamente visÃveis do HTTP, Tempo: [TIME] segundos, Obtidos: [SIZE]KB, [PIXEL]MPixels - </text> - <text name="total_time_refetch_all_http_label"> - 18, Obtendo novamente todas as texturas do HTTP, Tempo: [TIME] segundos, Obtidos: [SIZE]KB, [PIXEL]MPixels - </text> - <spinner label="19, Proporção de texel/pixel:" name="texel_pixel_ratio"/> - <text name="texture_source_label"> - 20, Origem da textura: - </text> - <radio_group name="texture_source"> - <radio_item label="Cache + HTTP" name="0"/> - <radio_item label="Apenas HTTP" name="1"/> - </radio_group> - <button label="Iniciar" name="start_btn"/> - <button label="Redefinir" name="clear_btn"/> - <button label="Fechar" name="close_btn"/> - <button label="Leitura do cache" name="cacheread_btn"/> - <button label="Gravação em cache" name="cachewrite_btn"/> - <button label="HTTP" name="http_btn"/> - <button label="Decodificar" name="decode_btn"/> - <button label="Textura GL" name="gl_btn"/> - <button label="Obter novamente cache visÃvel" name="refetchviscache_btn"/> - <button label="Obter todo o cache novamente" name="refetchallcache_btn"/> - <button label="Obter novamente HTTP visÃvel" name="refetchvishttp_btn"/> - <button label="Obter todo o HTTP novamente" name="refetchallhttp_btn"/> -</floater> diff --git a/indra/newview/skins/default/xui/ru/floater_texture_fetch_debugger.xml b/indra/newview/skins/default/xui/ru/floater_texture_fetch_debugger.xml deleted file mode 100644 index 628e6c5c87..0000000000 --- a/indra/newview/skins/default/xui/ru/floater_texture_fetch_debugger.xml +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<floater name="TexFetchDebugger" title="Отладчик Ð¸Ð·Ð²Ð»ÐµÑ‡ÐµÐ½Ð¸Ñ Ñ‚ÐµÐºÑтур"> - <text name="total_num_fetched_label"> - 1, Общее количеÑтво извлеченных текÑтур: [NUM] - </text> - <text name="total_num_fetching_requests_label"> - 2, Общее количеÑтво запроÑов на извлечение: [NUM] - </text> - <text name="total_num_cache_hits_label"> - 3, Общее количеÑтво попаданий в кÑш: [NUM] - </text> - <text name="total_num_visible_tex_label"> - 4, Общее количеÑтво видимых текÑтур: [NUM] - </text> - <text name="total_num_visible_tex_fetch_req_label"> - 5, Общее количеÑтво запроÑов на извлечение видимых текÑтур: [NUM] - </text> - <text name="total_fetched_data_label"> - 6, Общий объем извлеченных данных: [SIZE1] КБ, декодированные данные: [SIZE2] КБ, [PIXEL] МпикÑелов - </text> - <text name="total_fetched_vis_data_label"> - 7, Общий объем видимых данных: [SIZE1] КБ, декодированные данные: [SIZE2] КБ - </text> - <text name="total_fetched_rendered_data_label"> - 8, Общий объем визуализированных данных: [SIZE1] КБ, декодированные данные: [SIZE2] КБ, [PIXEL] МпикÑелов - </text> - <text name="total_time_cache_read_label"> - 9, Общее Ð²Ñ€ÐµÐ¼Ñ Ñ‡Ñ‚ÐµÐ½Ð¸Ñ Ð¸Ð· кÑша: [TIME] Ñ - </text> - <text name="total_time_cache_write_label"> - 10, Общее Ð²Ñ€ÐµÐ¼Ñ Ð·Ð°Ð¿Ð¸Ñи в кÑш: [TIME] Ñ - </text> - <text name="total_time_decode_label"> - 11, Общее Ð²Ñ€ÐµÐ¼Ñ Ð´ÐµÐºÐ¾Ð´Ð¸Ñ€Ð¾Ð²Ð°Ð½Ð¸Ñ: [TIME] Ñ - </text> - <text name="total_time_gl_label"> - 12, Общее Ð²Ñ€ÐµÐ¼Ñ ÑÐ¾Ð·Ð´Ð°Ð½Ð¸Ñ Ñ‚ÐµÐºÑтур: [TIME] Ñ - </text> - <text name="total_time_http_label"> - 13, Общее Ð²Ñ€ÐµÐ¼Ñ HTTP-извлечениÑ: [TIME] Ñ - </text> - <text name="total_time_fetch_label"> - 14, Общее Ð²Ñ€ÐµÐ¼Ñ Ð¿Ð¾Ð»Ð½Ð¾Ð³Ð¾ извлечениÑ: [TIME] Ñ - </text> - <text name="total_time_refetch_vis_cache_label"> - 15, Повторное извлечение из кÑша, времÑ: [TIME] Ñ, извлечено: [SIZE] КБ, [PIXEL] МпикÑелов - </text> - <text name="total_time_refetch_all_cache_label"> - 16, Повторное извлечение вÑех текÑтур из кÑша, времÑ: [TIME] Ñ, извлечено: [SIZE] КБ, [PIXEL] МпикÑелов - </text> - <text name="total_time_refetch_vis_http_label"> - 17, Повторное извлечение из HTTP, времÑ: [TIME] Ñ, извлечено: [SIZE] КБ, [PIXEL] МпикÑелов - </text> - <text name="total_time_refetch_all_http_label"> - 18, Повторное извлечение вÑех текÑтур из HTTP, времÑ: [TIME] Ñ, извлечено: [SIZE] КБ, [PIXEL] МпикÑелов - </text> - <spinner label="19, Отношение текÑелы/пикÑелы:" name="texel_pixel_ratio"/> - <text name="texture_source_label"> - 20, ИÑтоÑник текÑтур: - </text> - <radio_group name="texture_source"> - <radio_item label="КÑш + HTTP" name="0"/> - <radio_item label="Только HTTP" name="1"/> - </radio_group> - <button label="ПуÑк" name="start_btn"/> - <button label="СброÑ" name="clear_btn"/> - <button label="Закрыть" name="close_btn"/> - <button label="Чтение кÑша" name="cacheread_btn"/> - <button label="ЗапиÑÑŒ в кÑш" name="cachewrite_btn"/> - <button label="HTTP" name="http_btn"/> - <button label="Декодировать" name="decode_btn"/> - <button label="ТекÑтура GL" name="gl_btn"/> - <button label="Повторно извлечь из кÑша" name="refetchviscache_btn"/> - <button label="Повторно извлечь вÑе из кÑша" name="refetchallcache_btn"/> - <button label="Повторно извлечь из HTTP" name="refetchvishttp_btn"/> - <button label="Повторно извлечь вÑе из HTTP" name="refetchallhttp_btn"/> -</floater> diff --git a/indra/newview/skins/default/xui/tr/floater_texture_fetch_debugger.xml b/indra/newview/skins/default/xui/tr/floater_texture_fetch_debugger.xml deleted file mode 100644 index 42426225c7..0000000000 --- a/indra/newview/skins/default/xui/tr/floater_texture_fetch_debugger.xml +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<floater name="TexFetchDebugger" title="Doku Alımı Hata Ayıklayıcı"> - <text name="total_num_fetched_label"> - 1, Alınan dokuların toplam sayısı: [NUM] - </text> - <text name="total_num_fetching_requests_label"> - 2, Toplam alım talebi sayısı: [NUM] - </text> - <text name="total_num_cache_hits_label"> - 3, Toplam önbellek isabet sayısı: [NUM] - </text> - <text name="total_num_visible_tex_label"> - 4, Görünür dokuların toplam sayısı: [NUM] - </text> - <text name="total_num_visible_tex_fetch_req_label"> - 5, Görünür dokuların alınması için toplam talep sayısı: [NUM] - </text> - <text name="total_fetched_data_label"> - 6, Alınan verilerin toplam sayısı: [SIZE1]KB, Åžifresi Çözülen Veri: [SIZE2]KB, [PIXEL]MPiksel - </text> - <text name="total_fetched_vis_data_label"> - 7, Görünür verilerin toplam sayısı: [SIZE1]KB, Åžifresi Çözülen Veri: [SIZE2]KB - </text> - <text name="total_fetched_rendered_data_label"> - 8, İşlenen verilerin toplam sayısı: [SIZE1]KB, Åžifresi Çözülen Veri: [SIZE2]KB, [PIXEL]MPiksel - </text> - <text name="total_time_cache_read_label"> - 9, Önbellek okunması için toplam süre: [TIME] saniye - </text> - <text name="total_time_cache_write_label"> - 10, Önbellek yazılması için toplam süre: [TIME] saniye - </text> - <text name="total_time_decode_label"> - 11, Åžifre çözülmesi için toplam süre: [TIME] saniye - </text> - <text name="total_time_gl_label"> - 12, GL doku oluÅŸturma için toplam süre: [TIME] saniye - </text> - <text name="total_time_http_label"> - 13, HTTP alımı için toplam süre: [TIME] saniye - </text> - <text name="total_time_fetch_label"> - 14, Tüm alımlar için toplam süre: [TIME] saniye - </text> - <text name="total_time_refetch_vis_cache_label"> - 15, Görünür dokuların önbellekten tekrar alınması, Süre: [TIME] saniye, Alınan: [SIZE]KB, [PIXEL]MPiksel - </text> - <text name="total_time_refetch_all_cache_label"> - 16, Tüm dokuların önbellekten tekrar alınması, Süre: [TIME] saniye, Alınan: [SIZE]KB, [PIXEL]MPiksel - </text> - <text name="total_time_refetch_vis_http_label"> - 17, Görünür dokuların HTTP'den tekrar alınması, Süre: [TIME] saniye, Alınan: [SIZE]KB, [PIXEL]MPiksel - </text> - <text name="total_time_refetch_all_http_label"> - 18, Tüm dokuların HTTP'den tekrar alınması, Süre: [TIME] saniye, Alınan: [SIZE]KB, [PIXEL]MPiksel - </text> - <spinner label="19, Teksel/Piksel Oranı:" name="texel_pixel_ratio"/> - <text name="texture_source_label"> - 20, Doku Kaynağı: - </text> - <radio_group name="texture_source"> - <radio_item label="Önbellek + HTTP" name="0"/> - <radio_item label="Sadece HTTP" name="1"/> - </radio_group> - <button label="BaÅŸla" name="start_btn"/> - <button label="Sıfırla" name="clear_btn"/> - <button label="Kapat" name="close_btn"/> - <button label="Önbellek Okunması" name="cacheread_btn"/> - <button label="Önbellek Yazılması" name="cachewrite_btn"/> - <button label="HTTP" name="http_btn"/> - <button label="Åžifre Çöz" name="decode_btn"/> - <button label="GL Dokusu" name="gl_btn"/> - <button label="Görünür Dokuları Önbellekten Tekrar Al" name="refetchviscache_btn"/> - <button label="Tüm ÖnbelleÄŸi Tekrar Al" name="refetchallcache_btn"/> - <button label="Görünür Dokuları HTTP'den Tekrar Al" name="refetchvishttp_btn"/> - <button label="Tüm HTTP'yi Tekrar Al" name="refetchallhttp_btn"/> -</floater> diff --git a/indra/newview/skins/default/xui/zh/floater_texture_fetch_debugger.xml b/indra/newview/skins/default/xui/zh/floater_texture_fetch_debugger.xml deleted file mode 100644 index 0dcac17a75..0000000000 --- a/indra/newview/skins/default/xui/zh/floater_texture_fetch_debugger.xml +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<floater name="TexFetchDebugger" title="æè³ªæ“·å–除錯器"> - <text name="total_num_fetched_label"> - 1. å·²æ“·å–æè³ªç¸½æ•¸ï¼š[NUM] - </text> - <text name="total_num_fetching_requests_label"> - 2. 總擷å–請求數:[NUM] - </text> - <text name="total_num_cache_hits_label"> - 3. å¿«å–ç¸½è®€å–æ•¸ï¼š[NUM] - </text> - <text name="total_num_visible_tex_label"> - 4. å¯è¦‹æè³ªç¸½æ•¸ï¼š[NUM] - </text> - <text name="total_num_visible_tex_fetch_req_label"> - 5. å¯è¦‹æè³ªæ“·å–總請求數:[NUM] - </text> - <text name="total_fetched_data_label"> - 6. 總擷å–資料é‡ï¼š[SIZE1] KB,解碼資料é‡ï¼š[SIZE2] KB,[PIXEL] 百è¬åƒç´ - </text> - <text name="total_fetched_vis_data_label"> - 7. å¯è¦‹è³‡æ–™ç¸½é‡ï¼š[SIZE1] KB,解碼資料é‡ï¼š[SIZE2] KB - </text> - <text name="total_fetched_rendered_data_label"> - 8. 總呈åƒè³‡æ–™é‡ï¼š[SIZE1] KB,解碼資料é‡ï¼š[SIZE2] KB,[PIXEL] 百è¬åƒç´ - </text> - <text name="total_time_cache_read_label"> - 9. å¿«å–讀å–總時間:[TIME] ç§’ - </text> - <text name="total_time_cache_write_label"> - 10. å¿«å–寫入總時間:[TIME] ç§’ - </text> - <text name="total_time_decode_label"> - 11. 解碼總時間:[TIME] ç§’ - </text> - <text name="total_time_gl_label"> - 12. 建立 gl æè³ªç¸½æ™‚間:[TIME] ç§’ - </text> - <text name="total_time_http_label"> - 13. HTTP æ“·å–總時間:[TIME] ç§’ - </text> - <text name="total_time_fetch_label"> - 14. 所有擷å–動作總時間:[TIME] ç§’ - </text> - <text name="total_time_refetch_vis_cache_label"> - 15. 自快å–釿–°æ“·å–å¯è¦‹æè³ªï¼Œæ™‚間:[TIME] 秒,擷å–é‡ï¼š[SIZE] KB,[PIXEL] 百è¬åƒç´ - </text> - <text name="total_time_refetch_all_cache_label"> - 16. 從快å–釿–°æ“·å–所有æè³ªï¼Œæ™‚間:[TIME] 秒,擷å–é‡ï¼š[SIZE] KB,[PIXEL] 百è¬åƒç´ - </text> - <text name="total_time_refetch_vis_http_label"> - 17. 自 HTTP 釿–°æ“·å–å¯è¦‹æè³ªï¼Œæ™‚間:[TIME] 秒,擷å–é‡ï¼š[SIZE] KB,[PIXEL] 百è¬åƒç´ - </text> - <text name="total_time_refetch_all_http_label"> - 18. 自 HTTP 釿–°æ“·å–所有æè³ªï¼Œæ™‚間:[TIME] 秒,擷å–é‡ï¼š[SIZE] KB,[PIXEL] 百è¬åƒç´ - </text> - <spinner label="19. æè³ª/åƒç´ 比率:" name="texel_pixel_ratio"/> - <text name="texture_source_label"> - 20. æè³ªä¾†æºï¼š - </text> - <radio_group name="texture_source"> - <radio_item label="å¿«å– + HTTP" name="0"/> - <radio_item label="åƒ…é™ HTTP" name="1"/> - </radio_group> - <button label="é–‹å§‹" name="start_btn"/> - <button label="é‡è¨" name="clear_btn"/> - <button label="關閉" name="close_btn"/> - <button label="å¿«å–讀å–" name="cacheread_btn"/> - <button label="å¿«å–寫入" name="cachewrite_btn"/> - <button label="HTTP" name="http_btn"/> - <button label="解碼" name="decode_btn"/> - <button label="GL æè³ª" name="gl_btn"/> - <button label="å¿«å–é‡å–å¯è¦‹æè³ª" name="refetchviscache_btn"/> - <button label="釿–°æ“·å–所有快å–" name="refetchallcache_btn"/> - <button label="HTTP é‡å–å¯è¦‹æè³ª" name="refetchvishttp_btn"/> - <button label="釿–°æ“·å–所有 HTTP" name="refetchallhttp_btn"/> -</floater> diff --git a/indra/newview/tests/llagentaccess_test.cpp b/indra/newview/tests/llagentaccess_test.cpp index 6739096baa..6f5b3a9721 100644 --- a/indra/newview/tests/llagentaccess_test.cpp +++ b/indra/newview/tests/llagentaccess_test.cpp @@ -55,12 +55,12 @@ LLControlVariable* LLControlGroup::declareU32(const std::string& name, U32 initi return NULL; } -void LLControlGroup::setU32(const std::string& name, U32 val) +void LLControlGroup::setU32(std::string_view name, U32 val) { test_preferred_maturity = val; } -U32 LLControlGroup::getU32(const std::string& name) +U32 LLControlGroup::getU32(std::string_view name) { return test_preferred_maturity; } diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp index 62250cbbfd..df0f006d02 100644 --- a/indra/newview/tests/lllogininstance_test.cpp +++ b/indra/newview/tests/lllogininstance_test.cpp @@ -74,7 +74,7 @@ static LLSD gLoginCreds; static bool gDisconnectCalled = false; #include "../llviewerwindow.h" -void LLViewerWindow::setShowProgress(BOOL show) {} +void LLViewerWindow::setShowProgress(bool show) {} LLProgressView * LLViewerWindow::getProgressView(void) const { return 0; } LLViewerWindow* gViewerWindow; @@ -198,13 +198,13 @@ LLControlGroup gSavedSettings("Global"); LLControlGroup::LLControlGroup(const std::string& name) : LLInstanceTracker<LLControlGroup, std::string>(name){} LLControlGroup::~LLControlGroup() {} -void LLControlGroup::setBOOL(const std::string& name, BOOL val) {} -BOOL LLControlGroup::getBOOL(const std::string& name) { return FALSE; } -F32 LLControlGroup::getF32(const std::string& name) { return 0.0f; } -U32 LLControlGroup::saveToFile(const std::string& filename, BOOL nondefault_only) { return 1; } -void LLControlGroup::setString(const std::string& name, const std::string& val) {} -std::string LLControlGroup::getString(const std::string& name) { return "test_string"; } -LLControlVariable* LLControlGroup::declareBOOL(const std::string& name, BOOL initial_val, const std::string& comment, LLControlVariable::ePersist persist) { return NULL; } +void LLControlGroup::setBOOL(std::string_view name, bool val) {} +bool LLControlGroup::getBOOL(std::string_view name) { return false; } +F32 LLControlGroup::getF32(std::string_view name) { return 0.0f; } +U32 LLControlGroup::saveToFile(const std::string& filename, bool nondefault_only) { return 1; } +void LLControlGroup::setString(std::string_view name, const std::string& val) {} +std::string LLControlGroup::getString(std::string_view name) { return "test_string"; } +LLControlVariable* LLControlGroup::declareBOOL(const std::string& name, bool initial_val, const std::string& comment, LLControlVariable::ePersist persist) { return NULL; } LLControlVariable* LLControlGroup::declareString(const std::string& name, const std::string &initial_val, const std::string& comment, LLControlVariable::ePersist persist) { return NULL; } #include "lluicolortable.h" @@ -235,7 +235,7 @@ static LLEventPump * gTOSReplyPump = NULL; LLPointer<LLSecAPIHandler> gSecAPIHandler; //static -LLFloater* LLFloaterReg::showInstance(const std::string& name, const LLSD& key, BOOL focus) +LLFloater* LLFloaterReg::showInstance(const std::string& name, const LLSD& key, bool focus) { gTOSType = name; gTOSReplyPump = &LLEventPumps::instance().obtain(key["reply_pump"]); @@ -345,13 +345,13 @@ namespace tut gTOSReplyPump = 0; // clear the callback. - gSavedSettings.declareBOOL("NoInventoryLibrary", FALSE, "", LLControlVariable::PERSIST_NO); - gSavedSettings.declareBOOL("ConnectAsGod", FALSE, "", LLControlVariable::PERSIST_NO); - gSavedSettings.declareBOOL("UseDebugMenus", FALSE, "", LLControlVariable::PERSIST_NO); + gSavedSettings.declareBOOL("NoInventoryLibrary", false, "", LLControlVariable::PERSIST_NO); + gSavedSettings.declareBOOL("ConnectAsGod", false, "", LLControlVariable::PERSIST_NO); + gSavedSettings.declareBOOL("UseDebugMenus", false, "", LLControlVariable::PERSIST_NO); gSavedSettings.declareString("ClientSettingsFile", "test_settings.xml", "", LLControlVariable::PERSIST_NO); gSavedSettings.declareString("NextLoginLocation", "", "", LLControlVariable::PERSIST_NO); - gSavedSettings.declareBOOL("LoginLastLocation", FALSE, "", LLControlVariable::PERSIST_NO); - gSavedSettings.declareBOOL("CmdLineSkipUpdater", TRUE, "", LLControlVariable::PERSIST_NO); + gSavedSettings.declareBOOL("LoginLastLocation", false, "", LLControlVariable::PERSIST_NO); + gSavedSettings.declareBOOL("CmdLineSkipUpdater", true, "", LLControlVariable::PERSIST_NO); LLSD authenticator = LLSD::emptyMap(); LLSD identifier = LLSD::emptyMap(); diff --git a/indra/newview/tests/llsecapi_test.cpp b/indra/newview/tests/llsecapi_test.cpp index ef3da40397..1a2fa7d8f6 100644 --- a/indra/newview/tests/llsecapi_test.cpp +++ b/indra/newview/tests/llsecapi_test.cpp @@ -43,8 +43,8 @@ LLControlVariable* LLControlGroup::declareString(const std::string& name, const std::string& initial_val, const std::string& comment, LLControlVariable::ePersist persist) {return NULL;} -void LLControlGroup::setString(const std::string& name, const std::string& val){} -std::string LLControlGroup::getString(const std::string& name) +void LLControlGroup::setString(std::string_view name, const std::string& val){} +std::string LLControlGroup::getString(std::string_view name) { return ""; } @@ -109,10 +109,10 @@ namespace tut { // retrieve an unknown handler - ensure("'Unknown' handler should be NULL", !(BOOL)getSecHandler("unknown")); + ensure("'Unknown' handler should be NULL", getSecHandler("unknown") == nullptr); LLPointer<LLSecAPIHandler> test1_handler = new LLSecAPIBasicHandler(); registerSecHandler("sectest1", test1_handler); - ensure("'Unknown' handler should be NULL", !(BOOL)getSecHandler("unknown")); + ensure("'Unknown' handler should be NULL", getSecHandler("unknown") == nullptr); LLPointer<LLSecAPIHandler> retrieved_test1_handler = getSecHandler("sectest1"); ensure("Retrieved sectest1 handler should be the same", retrieved_test1_handler == test1_handler); @@ -120,7 +120,7 @@ namespace tut // insert a second handler LLPointer<LLSecAPIHandler> test2_handler = new LLSecAPIBasicHandler(); registerSecHandler("sectest2", test2_handler); - ensure("'Unknown' handler should be NULL", !(BOOL)getSecHandler("unknown")); + ensure("'Unknown' handler should be NULL", getSecHandler("unknown") == nullptr); retrieved_test1_handler = getSecHandler("sectest1"); ensure("Retrieved sectest1 handler should be the same", retrieved_test1_handler == test1_handler); diff --git a/indra/newview/tests/llsechandler_basic_test.cpp b/indra/newview/tests/llsechandler_basic_test.cpp index bfe32406cb..f4ee15319e 100644 --- a/indra/newview/tests/llsechandler_basic_test.cpp +++ b/indra/newview/tests/llsechandler_basic_test.cpp @@ -78,8 +78,8 @@ LLControlVariable* LLControlGroup::declareString(const std::string& name, const std::string& initial_val, const std::string& comment, LLControlVariable::ePersist persist) {return NULL;} -void LLControlGroup::setString(const std::string& name, const std::string& val){} -std::string LLControlGroup::getString(const std::string& name) +void LLControlGroup::setString(std::string_view name, const std::string& val){} +std::string LLControlGroup::getString(std::string_view name) { if (name == "FirstName") @@ -90,7 +90,7 @@ std::string LLControlGroup::getString(const std::string& name) } // Stub for --no-verify-ssl-cert -BOOL LLControlGroup::getBOOL(const std::string& name) { return FALSE; } +bool LLControlGroup::getBOOL(std::string_view name) { return false; } LLSD LLCredential::getLoginParams() { @@ -232,381 +232,402 @@ namespace tut "Certificate:\n" " Data:\n" " Version: 3 (0x2)\n" - " Serial Number:\n" - " 82:2f:8f:eb:8d:06:24:b0\n" + " Serial Number: ef:54:d8:f7:da:18:e8:19\n" " Signature Algorithm: sha256WithRSAEncryption\n" " Issuer: C=US, ST=California, L=San Francisco, O=Linden Lab, OU=Second Life Engineering, CN=Integration Test Root CA/emailAddress=noreply@lindenlab.com\n" " Validity\n" - " Not Before: May 22 22:19:45 2018 GMT\n" - " Not After : May 17 22:19:45 2038 GMT\n" + " Not Before: Jul 23 11:46:26 2024 GMT\n" + " Not After : Jul 21 11:46:26 2034 GMT\n" " Subject: C=US, ST=California, L=San Francisco, O=Linden Lab, OU=Second Life Engineering, CN=Integration Test Root CA/emailAddress=noreply@lindenlab.com\n" " Subject Public Key Info:\n" " Public Key Algorithm: rsaEncryption\n" " Public-Key: (4096 bit)\n" " Modulus:\n" - " 00:bd:e0:79:dd:3b:a6:ac:87:d0:39:f0:58:c7:a4:\n" - " 42:42:f6:5f:93:b0:36:04:b5:e2:d5:f7:2a:c0:6c:\n" - " a0:13:d2:1e:02:81:57:02:50:4c:57:b7:ef:27:9e:\n" - " f6:f1:f1:30:30:72:1e:57:34:e5:3f:82:3c:21:c4:\n" - " 66:d2:73:63:6c:91:e6:dd:49:9e:9c:b1:34:6a:81:\n" - " 45:a1:6e:c4:50:28:f2:d8:e3:fe:80:2f:83:aa:28:\n" - " 91:b4:8c:57:c9:f1:16:d9:0c:87:3c:25:80:a0:81:\n" - " 8d:71:f2:96:e2:16:f1:97:c4:b0:d8:53:bb:13:6c:\n" - " 73:54:2f:29:94:85:cf:86:6e:75:71:ad:39:e3:fc:\n" - " 39:12:53:93:1c:ce:39:e0:33:da:49:b7:3d:af:b0:\n" - " 37:ce:77:09:03:27:32:70:c0:9c:7f:9c:89:ce:90:\n" - " 45:b0:7d:94:8b:ff:13:27:ba:88:7f:ae:c4:aa:73:\n" - " d5:47:b8:87:69:89:80:0c:c1:22:18:78:c2:0d:47:\n" - " d9:10:ff:80:79:0d:46:71:ec:d9:ba:c9:f3:77:fd:\n" - " 92:6d:1f:0f:d9:54:18:6d:f6:72:24:5c:5c:3d:43:\n" - " 49:35:3e:1c:28:de:7e:44:dc:29:c3:9f:62:04:46:\n" - " aa:c4:e6:69:6a:15:f8:e3:74:1c:14:e9:f4:97:7c:\n" - " 30:6c:d4:28:fc:2a:0e:1d:6d:39:2e:1d:f9:17:43:\n" - " 35:5d:23:e7:ba:e3:a8:e9:97:6b:3c:3e:23:ef:d8:\n" - " bc:fb:7a:57:37:39:93:59:03:fc:78:ca:b1:31:ef:\n" - " 26:19:ed:56:e1:63:c3:ad:99:80:5b:47:b5:03:35:\n" - " 5f:fe:6a:a6:21:63:ec:50:fb:4e:c9:f9:ae:a5:66:\n" - " d0:55:33:8d:e6:c5:50:5a:c6:8f:5c:34:45:a7:72:\n" - " da:50:f6:66:4c:19:f5:d1:e4:fb:11:8b:a1:b5:4e:\n" - " 09:43:81:3d:39:28:86:3b:fe:07:28:97:02:b5:3a:\n" - " 07:5f:4a:20:80:1a:7d:a4:8c:f7:6c:f6:c5:9b:f6:\n" - " 61:e5:c7:b0:c3:d5:58:38:7b:bb:47:1e:34:d6:16:\n" - " 55:c5:d2:6c:b0:93:77:b1:90:69:06:b1:53:cb:1b:\n" - " 84:71:cf:b8:87:1b:1e:44:35:b4:2b:bb:04:59:58:\n" - " 0b:e8:93:d8:ae:21:9b:b1:1c:89:30:ae:11:80:77:\n" - " cc:16:f3:d6:35:ed:a1:b3:70:b3:4f:cd:a1:56:99:\n" - " ee:0e:c0:00:a4:09:70:c3:5b:0b:be:a1:07:18:dd:\n" - " c6:f4:6d:8b:58:bc:f9:bb:4b:01:2c:f6:cc:2c:9b:\n" - " 87:0e:b1:4f:9c:10:be:fc:45:e2:a4:ec:7e:fc:ff:\n" - " 45:b8:53\n" + " 00:c6:cc:07:f4:0b:17:06:4d:a6:30:b4:c7:02:6b:\n" + " 9d:a4:47:a6:09:0e:60:1a:32:d4:6b:42:88:ee:c5:\n" + " b9:e9:fb:b5:0b:60:dc:a2:45:92:a5:bb:88:12:fc:\n" + " 42:1a:80:32:79:16:62:7a:97:af:84:28:53:3c:c1:\n" + " f2:68:c0:4e:45:e4:0a:63:f9:34:1d:a2:8b:cc:70:\n" + " df:c6:65:c0:ba:31:32:d2:9d:0c:c8:ce:dc:11:12:\n" + " a4:11:fa:d3:c8:56:e2:31:8a:e3:fb:91:40:da:25:\n" + " 55:d1:f2:75:9b:4d:fa:b8:1f:b5:6d:9b:e1:fe:5d:\n" + " e8:c4:02:79:14:ef:7d:5a:b3:3a:1e:b6:d0:60:2c:\n" + " 90:dc:22:e2:c5:ae:85:1f:b4:9d:7a:20:f8:af:63:\n" + " 56:25:1a:64:f3:9c:3f:9a:cf:68:08:0a:37:db:d0:\n" + " a3:65:26:db:80:82:ff:e0:1b:51:c8:ee:f6:ad:c2:\n" + " b4:f2:ab:d2:e8:85:86:77:28:d0:63:4a:71:78:41:\n" + " e3:8c:7f:71:51:31:af:24:3f:fa:8d:d0:d8:0b:e2:\n" + " 7e:79:33:8a:bb:d2:00:9e:2e:c8:cd:d5:50:92:b8:\n" + " 5c:5a:0b:99:ef:05:39:67:da:be:70:36:51:37:37:\n" + " 20:6f:84:ab:29:11:00:7b:38:32:ba:0b:bc:34:a6:\n" + " b5:c6:a7:f0:c0:25:2d:38:0b:72:40:ab:cf:e6:ff:\n" + " 97:75:ff:e2:a9:3c:2a:57:ce:e4:52:20:8c:de:fe:\n" + " 68:ce:54:85:37:ba:b3:7f:2e:53:58:ea:9b:ac:79:\n" + " 6b:16:65:b8:11:88:5a:46:eb:9e:9e:80:3c:89:91:\n" + " 35:e0:c5:33:45:c8:86:4d:25:51:39:b1:72:97:2b:\n" + " b3:c8:c9:e8:11:cd:32:41:c8:c1:56:22:7e:33:81:\n" + " 85:61:ab:da:9e:6e:5f:24:1c:0f:9b:fa:da:9d:86:\n" + " 1a:66:f6:32:2a:10:80:ea:72:7a:4a:ef:c0:f2:7c:\n" + " 43:02:e6:70:19:6a:e1:02:0a:00:80:51:1c:a3:03:\n" + " 8b:6d:89:9f:91:37:90:d6:d8:9c:73:77:06:9e:bc:\n" + " 95:89:66:ee:43:40:a3:ee:43:a3:f6:2d:43:dd:7b:\n" + " f0:2f:0b:12:37:49:b7:81:5a:e2:54:6d:71:88:ff:\n" + " fe:7e:41:25:35:4c:b4:b9:62:65:dd:9f:1f:7a:06:\n" + " 6e:2b:20:58:78:da:08:66:a8:f1:89:de:8f:7f:5c:\n" + " 5e:c2:72:33:7f:b6:8e:41:4c:26:f6:4c:d4:0e:11:\n" + " 44:da:c7:14:f7:8b:79:4e:53:29:87:15:b1:12:e9:\n" + " 19:2b:54:33:d6:2e:7f:bd:42:20:be:fc:d7:9c:b4:\n" + " 7a:0a:db\n" " Exponent: 65537 (0x10001)\n" " X509v3 extensions:\n" - " X509v3 Subject Key Identifier: \n" - " 8A:22:C6:9C:2E:11:F3:40:0C:CE:82:0C:22:59:FF:F8:7F:D0:B9:13\n" - " X509v3 Authority Key Identifier: \n" - " keyid:8A:22:C6:9C:2E:11:F3:40:0C:CE:82:0C:22:59:FF:F8:7F:D0:B9:13\n" + " X509v3 Subject Key Identifier:\n" + " 4D:7D:AE:0D:A5:5E:22:5A:6A:8F:19:61:54:B3:58:CB:7B:C0:BD:DA\n" + " X509v3 Authority Key Identifier:\n" + " keyid:4D:7D:AE:0D:A5:5E:22:5A:6A:8F:19:61:54:B3:58:CB:7B:C0:BD:DA\n" "\n" - " X509v3 Basic Constraints: critical\n" + " X509v3 Basic Constraints:\n" " CA:TRUE\n" - " X509v3 Key Usage: critical\n" - " Digital Signature, Certificate Sign, CRL Sign\n" " Signature Algorithm: sha256WithRSAEncryption\n" - " b3:cb:33:eb:0e:02:64:f4:55:9a:3d:03:9a:cf:6a:4c:18:43:\n" - " f7:42:cb:65:dc:61:52:e5:9f:2f:42:97:3c:93:16:22:d4:af:\n" - " ae:b2:0f:c3:9b:ef:e0:cc:ee:b6:b1:69:a3:d8:da:26:c3:ad:\n" - " 3b:c5:64:dc:9f:d4:c2:53:4b:91:6d:c4:92:09:0b:ac:f0:99:\n" - " be:6f:b9:3c:03:4a:6d:9f:01:5d:ec:5a:9a:f3:a7:e5:3b:2c:\n" - " 99:57:7d:7e:25:15:68:20:12:30:96:16:86:f5:db:74:90:60:\n" - " fe:8b:df:99:f6:f7:62:49:9f:bc:8d:45:23:0a:c8:73:b8:79:\n" - " 80:3c:b9:e5:72:85:4b:b3:81:66:74:a2:72:92:4c:44:fd:7b:\n" - " 46:2e:21:a2:a9:81:a2:f3:26:4d:e3:89:7d:78:b0:c6:6f:b5:\n" - " 87:cb:ee:25:ed:27:1f:75:13:fa:6d:e9:37:73:ad:07:bb:af:\n" - " d3:6c:87:ea:02:01:70:bd:53:aa:ce:39:2c:d4:66:39:33:aa:\n" - " d1:9c:ee:67:e3:a9:45:d2:7b:2e:54:09:af:70:5f:3f:5a:67:\n" - " 2e:6c:72:ef:e0:9d:92:28:4a:df:ba:0b:b7:23:ca:5b:04:11:\n" - " 45:d1:51:e9:ea:c9:ec:54:fa:34:46:ae:fc:dc:6c:f8:1e:2c:\n" - " 9e:f4:71:51:8d:b5:a1:26:9a:13:30:be:1e:41:25:59:58:05:\n" - " 2c:64:c8:f9:5e:38:ae:dc:93:b0:8a:d6:38:74:02:cb:ce:ce:\n" - " 95:31:76:f6:7c:bf:a4:a1:8e:27:fd:ca:74:82:d1:e1:4d:b6:\n" - " 48:51:fa:c5:17:59:22:a3:84:be:82:c8:83:ec:61:a0:f4:ee:\n" - " 2c:e3:a3:ea:e5:51:c9:d3:4f:db:85:bd:ba:7a:52:14:b6:03:\n" - " ed:43:17:d8:d7:1c:22:5e:c9:56:d9:d6:81:96:11:e3:5e:01:\n" - " 40:91:30:09:da:a3:5f:d3:27:60:e5:9d:6c:da:d0:f0:39:01:\n" - " 23:4a:a6:15:7a:4a:82:eb:ec:72:4a:1d:36:dc:6f:83:c4:85:\n" - " 84:b5:8d:cd:09:e5:12:63:f3:21:56:c8:64:6b:db:b8:cf:d4:\n" - " df:ca:a8:24:8e:df:8d:63:a5:96:84:bf:ff:8b:7e:46:7a:f0:\n" - " c7:73:7c:70:8a:f5:17:d0:ac:c8:89:1e:d7:89:42:0f:4d:66:\n" - " c4:d8:bb:36:a8:ae:ca:e1:cf:e2:88:f6:cf:b0:44:4a:5f:81:\n" - " 50:4b:d6:28:81:cd:6c:f0:ec:e6:09:08:f2:59:91:a2:69:ac:\n" - " c7:81:fa:ab:61:3e:db:6f:f6:7f:db:1a:9e:b9:5d:cc:cc:33:\n" - " fa:95:c6:f7:8d:4b:30:f3\n" + " 5b:40:71:96:c8:d1:57:3f:fc:f2:3c:75:fb:c9:a6:a7:63:8a:\n" + " 22:23:96:0f:40:77:77:e2:7f:76:fc:5f:7b:1c:bd:ea:ca:f0:\n" + " be:1a:fd:59:e6:0e:00:d1:78:44:01:28:f4:01:68:67:78:cf:\n" + " 78:43:36:ac:b2:5c:13:0e:2a:94:59:88:9e:64:46:42:0a:9b:\n" + " be:7d:2d:10:11:fe:8b:64:01:fb:00:c5:2e:47:63:c0:93:3a:\n" + " 4a:f8:6c:fc:a9:16:58:ab:bc:7b:6b:20:31:9d:d7:d8:84:01:\n" + " cc:ce:52:7f:a1:18:2f:5c:c9:59:58:9a:98:b9:ef:54:d7:a0:\n" + " 56:79:28:ba:ad:f5:e5:fd:7e:d8:d6:be:dd:25:76:6f:fa:8a:\n" + " 07:f6:8e:0f:83:43:19:ee:96:c4:c9:54:df:19:5a:4c:ae:25:\n" + " 57:a2:5d:d5:e8:0a:66:d8:19:e9:c4:44:ba:6a:3b:b3:86:ae:\n" + " 44:c0:7c:6e:e5:a0:6c:45:bb:7f:34:94:e9:d3:d4:f4:04:0b:\n" + " eb:fc:9a:fa:67:d4:e5:83:5e:08:09:9c:70:a9:d3:0d:8a:08:\n" + " ed:3c:04:33:4f:ac:02:d9:5c:99:62:12:fc:0e:8d:55:8a:ce:\n" + " ca:28:5a:1a:9e:c9:59:8e:f0:f5:19:c7:30:1e:59:1f:3c:77:\n" + " 6d:fc:a2:31:ec:bf:83:fd:14:26:91:68:88:05:4c:87:82:e0:\n" + " 33:f4:ee:d8:56:97:23:3a:00:9b:e7:a2:10:c2:83:28:c6:c0:\n" + " c1:92:49:95:c1:d3:e1:43:e8:8f:0c:d0:ae:e3:50:17:1a:8d:\n" + " 0f:4a:60:71:76:8e:9e:fb:15:76:cd:cd:69:2c:59:24:69:d2:\n" + " 0f:f2:d5:0e:96:95:2b:2e:d7:81:ed:b3:7b:6f:ce:60:32:b5:\n" + " f0:f6:74:ea:27:3a:ee:2c:96:7b:e0:06:6c:33:25:c4:60:da:\n" + " 76:de:c4:a1:22:b6:b1:63:57:10:3c:62:60:98:47:39:9e:38:\n" + " ce:c7:ef:75:75:19:d3:26:2a:cf:46:e3:b0:72:38:49:ee:c3:\n" + " 4e:52:97:e5:e5:b8:bc:b1:45:56:98:54:0a:63:c8:87:ff:a0:\n" + " cb:28:12:5c:8f:a2:6e:a7:f9:50:98:2d:a5:26:08:df:16:29:\n" + " 19:63:7f:6c:b4:41:20:f7:5d:ef:6a:90:fd:1a:08:1c:c2:4c:\n" + " 3e:77:ea:e0:df:c0:dd:aa:a2:36:e7:e8:be:98:39:0a:68:59:\n" + " 8e:a0:71:2f:7c:92:ab:e0:c4:c1:c2:eb:89:b6:34:ce:44:ab:\n" + " f9:f6:a4:c8:7b:ad:a8:bc:c9:04:7c:d5:4c:a4:d2:8b:54:23:\n" + " 89:68:86:4e:07:36:d9:bc\n" "-----BEGIN CERTIFICATE-----\n" - "MIIGXDCCBESgAwIBAgIJAIIvj+uNBiSwMA0GCSqGSIb3DQEBCwUAMIG6MQswCQYD\n" + "MIIGSTCCBDGgAwIBAgIJAO9U2PfaGOgZMA0GCSqGSIb3DQEBCwUAMIG6MQswCQYD\n" "VQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5j\n" "aXNjbzETMBEGA1UECgwKTGluZGVuIExhYjEgMB4GA1UECwwXU2Vjb25kIExpZmUg\n" "RW5naW5lZXJpbmcxITAfBgNVBAMMGEludGVncmF0aW9uIFRlc3QgUm9vdCBDQTEk\n" - "MCIGCSqGSIb3DQEJARYVbm9yZXBseUBsaW5kZW5sYWIuY29tMB4XDTE4MDUyMjIy\n" - "MTk0NVoXDTM4MDUxNzIyMTk0NVowgboxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApD\n" + "MCIGCSqGSIb3DQEJARYVbm9yZXBseUBsaW5kZW5sYWIuY29tMB4XDTI0MDcyMzEx\n" + "NDYyNloXDTM0MDcyMTExNDYyNlowgboxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApD\n" "YWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNpc2NvMRMwEQYDVQQKDApMaW5k\n" "ZW4gTGFiMSAwHgYDVQQLDBdTZWNvbmQgTGlmZSBFbmdpbmVlcmluZzEhMB8GA1UE\n" "AwwYSW50ZWdyYXRpb24gVGVzdCBSb290IENBMSQwIgYJKoZIhvcNAQkBFhVub3Jl\n" "cGx5QGxpbmRlbmxhYi5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC\n" - "AQC94HndO6ash9A58FjHpEJC9l+TsDYEteLV9yrAbKAT0h4CgVcCUExXt+8nnvbx\n" - "8TAwch5XNOU/gjwhxGbSc2NskebdSZ6csTRqgUWhbsRQKPLY4/6AL4OqKJG0jFfJ\n" - "8RbZDIc8JYCggY1x8pbiFvGXxLDYU7sTbHNULymUhc+GbnVxrTnj/DkSU5Mczjng\n" - "M9pJtz2vsDfOdwkDJzJwwJx/nInOkEWwfZSL/xMnuoh/rsSqc9VHuIdpiYAMwSIY\n" - "eMINR9kQ/4B5DUZx7Nm6yfN3/ZJtHw/ZVBht9nIkXFw9Q0k1Phwo3n5E3CnDn2IE\n" - "RqrE5mlqFfjjdBwU6fSXfDBs1Cj8Kg4dbTkuHfkXQzVdI+e646jpl2s8PiPv2Lz7\n" - "elc3OZNZA/x4yrEx7yYZ7VbhY8OtmYBbR7UDNV/+aqYhY+xQ+07J+a6lZtBVM43m\n" - "xVBaxo9cNEWnctpQ9mZMGfXR5PsRi6G1TglDgT05KIY7/gcolwK1OgdfSiCAGn2k\n" - "jPds9sWb9mHlx7DD1Vg4e7tHHjTWFlXF0mywk3exkGkGsVPLG4Rxz7iHGx5ENbQr\n" - "uwRZWAvok9iuIZuxHIkwrhGAd8wW89Y17aGzcLNPzaFWme4OwACkCXDDWwu+oQcY\n" - "3cb0bYtYvPm7SwEs9swsm4cOsU+cEL78ReKk7H78/0W4UwIDAQABo2MwYTAdBgNV\n" - "HQ4EFgQUiiLGnC4R80AMzoIMIln/+H/QuRMwHwYDVR0jBBgwFoAUiiLGnC4R80AM\n" - "zoIMIln/+H/QuRMwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJ\n" - "KoZIhvcNAQELBQADggIBALPLM+sOAmT0VZo9A5rPakwYQ/dCy2XcYVLlny9ClzyT\n" - "FiLUr66yD8Ob7+DM7raxaaPY2ibDrTvFZNyf1MJTS5FtxJIJC6zwmb5vuTwDSm2f\n" - "AV3sWprzp+U7LJlXfX4lFWggEjCWFob123SQYP6L35n292JJn7yNRSMKyHO4eYA8\n" - "ueVyhUuzgWZ0onKSTET9e0YuIaKpgaLzJk3jiX14sMZvtYfL7iXtJx91E/pt6Tdz\n" - "rQe7r9Nsh+oCAXC9U6rOOSzUZjkzqtGc7mfjqUXSey5UCa9wXz9aZy5scu/gnZIo\n" - "St+6C7cjylsEEUXRUenqyexU+jRGrvzcbPgeLJ70cVGNtaEmmhMwvh5BJVlYBSxk\n" - "yPleOK7ck7CK1jh0AsvOzpUxdvZ8v6Shjif9ynSC0eFNtkhR+sUXWSKjhL6CyIPs\n" - "YaD07izjo+rlUcnTT9uFvbp6UhS2A+1DF9jXHCJeyVbZ1oGWEeNeAUCRMAnao1/T\n" - "J2DlnWza0PA5ASNKphV6SoLr7HJKHTbcb4PEhYS1jc0J5RJj8yFWyGRr27jP1N/K\n" - "qCSO341jpZaEv/+LfkZ68MdzfHCK9RfQrMiJHteJQg9NZsTYuzaorsrhz+KI9s+w\n" - "REpfgVBL1iiBzWzw7OYJCPJZkaJprMeB+qthPttv9n/bGp65XczMM/qVxveNSzDz\n" + "AQDGzAf0CxcGTaYwtMcCa52kR6YJDmAaMtRrQojuxbnp+7ULYNyiRZKlu4gS/EIa\n" + "gDJ5FmJ6l6+EKFM8wfJowE5F5Apj+TQdoovMcN/GZcC6MTLSnQzIztwREqQR+tPI\n" + "VuIxiuP7kUDaJVXR8nWbTfq4H7Vtm+H+XejEAnkU731aszoettBgLJDcIuLFroUf\n" + "tJ16IPivY1YlGmTznD+az2gICjfb0KNlJtuAgv/gG1HI7vatwrTyq9LohYZ3KNBj\n" + "SnF4QeOMf3FRMa8kP/qN0NgL4n55M4q70gCeLsjN1VCSuFxaC5nvBTln2r5wNlE3\n" + "NyBvhKspEQB7ODK6C7w0prXGp/DAJS04C3JAq8/m/5d1/+KpPCpXzuRSIIze/mjO\n" + "VIU3urN/LlNY6puseWsWZbgRiFpG656egDyJkTXgxTNFyIZNJVE5sXKXK7PIyegR\n" + "zTJByMFWIn4zgYVhq9qebl8kHA+b+tqdhhpm9jIqEIDqcnpK78DyfEMC5nAZauEC\n" + "CgCAURyjA4ttiZ+RN5DW2JxzdwaevJWJZu5DQKPuQ6P2LUPde/AvCxI3SbeBWuJU\n" + "bXGI//5+QSU1TLS5YmXdnx96Bm4rIFh42ghmqPGJ3o9/XF7CcjN/to5BTCb2TNQO\n" + "EUTaxxT3i3lOUymHFbES6RkrVDPWLn+9QiC+/NectHoK2wIDAQABo1AwTjAdBgNV\n" + "HQ4EFgQUTX2uDaVeIlpqjxlhVLNYy3vAvdowHwYDVR0jBBgwFoAUTX2uDaVeIlpq\n" + "jxlhVLNYy3vAvdowDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAW0Bx\n" + "lsjRVz/88jx1+8mmp2OKIiOWD0B3d+J/dvxfexy96srwvhr9WeYOANF4RAEo9AFo\n" + "Z3jPeEM2rLJcEw4qlFmInmRGQgqbvn0tEBH+i2QB+wDFLkdjwJM6Svhs/KkWWKu8\n" + "e2sgMZ3X2IQBzM5Sf6EYL1zJWViamLnvVNegVnkouq315f1+2Na+3SV2b/qKB/aO\n" + "D4NDGe6WxMlU3xlaTK4lV6Jd1egKZtgZ6cREumo7s4auRMB8buWgbEW7fzSU6dPU\n" + "9AQL6/ya+mfU5YNeCAmccKnTDYoI7TwEM0+sAtlcmWIS/A6NVYrOyihaGp7JWY7w\n" + "9RnHMB5ZHzx3bfyiMey/g/0UJpFoiAVMh4LgM/Tu2FaXIzoAm+eiEMKDKMbAwZJJ\n" + "lcHT4UPojwzQruNQFxqND0pgcXaOnvsVds3NaSxZJGnSD/LVDpaVKy7Xge2ze2/O\n" + "YDK18PZ06ic67iyWe+AGbDMlxGDadt7EoSK2sWNXEDxiYJhHOZ44zsfvdXUZ0yYq\n" + "z0bjsHI4Se7DTlKX5eW4vLFFVphUCmPIh/+gyygSXI+ibqf5UJgtpSYI3xYpGWN/\n" + "bLRBIPdd72qQ/RoIHMJMPnfq4N/A3aqiNufovpg5CmhZjqBxL3ySq+DEwcLribY0\n" + "zkSr+fakyHutqLzJBHzVTKTSi1QjiWiGTgc22bw=\n" "-----END CERTIFICATE-----\n" - ); + ); + const std::string mPemIntermediateCert( "Certificate:\n" " Data:\n" " Version: 3 (0x2)\n" - " Serial Number: 4096 (0x1000)\n" + " Serial Number: 85:bb:4b:66:26:db:9a:c6\n" " Signature Algorithm: sha256WithRSAEncryption\n" " Issuer: C=US, ST=California, L=San Francisco, O=Linden Lab, OU=Second Life Engineering, CN=Integration Test Root CA/emailAddress=noreply@lindenlab.com\n" " Validity\n" - " Not Before: May 22 22:39:08 2018 GMT\n" - " Not After : May 19 22:39:08 2028 GMT\n" - " Subject: C=US, ST=California, O=Linden Lab, OU=Second Life Engineering, CN=Integration Test Intermediate CA/emailAddress=noreply@lindenlab.com\n" + " Not Before: Jul 23 11:46:33 2024 GMT\n" + " Not After : Jul 21 11:46:33 2034 GMT\n" + " Subject: C=US, ST=California, L=San Francisco, O=Linden Lab, OU=Second Life Engineering, CN=Integration Test Intermediate CA/emailAddress=noreply@lindenlab.com\n" " Subject Public Key Info:\n" " Public Key Algorithm: rsaEncryption\n" " Public-Key: (4096 bit)\n" " Modulus:\n" - " 00:ce:a3:70:e2:c4:fb:4b:97:90:a1:30:bb:c1:1b:\n" - " 13:b9:aa:7e:46:17:a3:26:8d:69:3f:5e:73:95:e8:\n" - " 6a:b1:0a:b4:8f:50:65:e3:c6:5c:39:24:34:df:0b:\n" - " b7:cc:ce:62:0c:36:5a:12:2c:fe:35:4c:e9:1c:ac:\n" - " 80:5e:24:99:d7:aa:bd:be:48:c0:62:64:77:36:88:\n" - " 66:ce:f4:a8:dd:d2:76:24:62:90:55:41:fc:1d:13:\n" - " 4e:a7:4e:57:bc:a8:a4:59:4b:2c:5a:1c:d8:cc:16:\n" - " de:e8:88:30:c9:95:df:2f:a6:14:28:0f:eb:34:46:\n" - " 12:58:ba:da:0e:e6:de:9c:15:f6:f4:e3:9f:74:aa:\n" - " 70:89:79:8b:e9:5a:7b:18:54:15:94:3a:23:0a:65:\n" - " 78:05:d9:33:90:2a:ce:15:18:0d:52:fc:5c:31:65:\n" - " 20:d0:12:37:8c:11:80:ba:d4:b0:82:73:00:4b:49:\n" - " be:cb:d6:bc:e7:cd:61:f3:00:98:99:74:5a:37:81:\n" - " 49:96:7e:14:01:1b:86:d2:d0:06:94:40:63:63:46:\n" - " 11:fc:33:5c:bd:3a:5e:d4:e5:44:47:64:50:bd:a6:\n" - " 97:55:70:64:9b:26:cc:de:20:82:90:6a:83:41:9c:\n" - " 6f:71:47:14:be:cb:68:7c:85:be:ef:2e:76:12:19:\n" - " d3:c9:87:32:b4:ac:60:20:16:28:2d:af:bc:e8:01:\n" - " c6:7f:fb:d8:11:d5:f4:b7:14:bd:27:08:5b:72:be:\n" - " 09:e0:91:c8:9c:7b:b4:b3:12:ef:32:36:be:b1:b9:\n" - " a2:b7:e3:69:47:30:76:ba:9c:9b:19:99:4d:53:dd:\n" - " 5c:e8:2c:f1:b2:64:69:cf:15:bd:f8:bb:58:95:73:\n" - " 58:38:95:b4:7a:cf:84:29:a6:c2:db:f0:bd:ef:97:\n" - " 26:d4:99:ac:d7:c7:be:b0:0d:11:f4:26:86:2d:77:\n" - " 42:52:25:d7:56:c7:e3:97:b1:36:5c:97:71:d0:9b:\n" - " f5:b5:50:8d:f9:ff:fb:10:77:3c:b5:53:6d:a1:43:\n" - " 35:a9:03:32:05:ab:d7:f5:d1:19:bd:5f:92:a3:00:\n" - " 2a:79:37:a4:76:4f:e9:32:0d:e4:86:bb:ea:c3:1a:\n" - " c5:33:e8:16:d4:a5:d8:e0:e8:bb:c2:f0:22:15:e2:\n" - " d9:8c:ae:ac:7d:2b:bf:eb:a3:4c:3b:29:1d:94:ac:\n" - " a3:bb:6d:ba:6d:03:91:03:cf:46:12:c4:66:21:c5:\n" - " c6:67:d8:11:19:79:01:0e:6e:84:1c:76:6f:11:3d:\n" - " eb:94:89:c5:6a:26:1f:cd:e0:11:8b:51:ee:99:35:\n" - " 69:e5:7f:0b:77:2a:94:e4:4b:64:b9:83:04:30:05:\n" - " e4:a2:e3\n" + " 00:be:f7:d2:cb:e4:5c:46:7b:e2:11:22:89:72:da:\n" + " 77:72:ec:05:87:19:f7:77:07:fd:67:d7:af:13:d5:\n" + " 76:12:92:dd:69:4d:22:47:b0:3d:94:8a:6a:95:85:\n" + " 34:b8:78:c3:9d:63:32:b1:4b:0a:b6:0e:05:7b:ab:\n" + " 06:23:fc:0d:21:b5:fc:c6:6a:5a:36:be:6e:fc:c7:\n" + " 47:97:a3:18:2e:33:cd:0e:8a:75:2b:b7:29:e9:68:\n" + " 4a:90:53:45:db:73:ff:b3:e5:c1:d4:6b:dd:3a:b1:\n" + " ef:53:9f:23:e9:c6:87:ce:67:b9:fb:a4:d5:76:21:\n" + " 03:cb:c5:72:6b:c5:a6:07:55:fb:47:90:e8:92:38:\n" + " 73:14:11:8e:ff:21:b9:35:64:5a:61:c7:fc:1f:e4:\n" + " 4d:47:e5:03:cc:0b:c3:69:66:71:84:0c:18:2f:61:\n" + " 7f:34:dd:f2:91:e3:b7:9d:a8:b8:db:3f:6e:6f:96:\n" + " fa:34:06:82:04:c8:18:cc:de:8b:7f:26:b5:48:53:\n" + " fb:fb:15:7b:0e:38:60:fe:da:21:98:8d:73:07:b2:\n" + " 6b:fd:ad:21:59:e7:84:66:e1:04:16:1c:be:13:34:\n" + " 28:43:2c:09:3d:e4:77:2a:a4:ad:6d:f9:26:04:f7:\n" + " 43:73:9b:d9:ea:1a:43:6a:b4:db:88:f8:f9:bd:34:\n" + " f8:a6:e8:7a:ab:b4:b2:e1:29:47:a6:ba:b8:65:9c:\n" + " c6:b3:af:13:43:38:ef:2a:05:77:9f:8f:f0:0c:56:\n" + " 21:c2:92:d2:2c:c3:32:50:d1:62:ae:51:fc:99:e6:\n" + " b8:38:f8:83:1d:8d:40:11:e0:1d:51:5d:3f:fa:55:\n" + " 61:b6:18:09:1e:71:af:95:64:9c:ea:c6:11:64:f0:\n" + " a8:02:7d:bb:c8:54:2e:57:48:32:7c:51:66:0d:d6:\n" + " 3e:0e:ed:5e:30:a8:a6:47:03:64:5c:89:21:45:90:\n" + " e1:4c:91:bc:bd:81:6e:73:a9:14:27:e6:0d:6d:38:\n" + " dc:50:9d:b2:56:66:60:6c:66:b9:5d:bb:8c:96:2d:\n" + " 89:5e:0d:2b:ed:b8:03:31:ce:0a:ff:82:03:f5:b2:\n" + " 3b:e5:27:de:61:d8:8f:bf:a2:6a:64:b0:4a:87:23:\n" + " 40:28:a3:f1:ec:96:50:cd:83:50:2d:78:71:92:f2:\n" + " 88:75:b0:9d:cd:0b:e4:62:a6:a5:63:11:fc:b4:ba:\n" + " 9f:c6:67:40:2c:ad:a4:ef:94:f0:f9:a0:ba:e1:52:\n" + " 2e:27:d9:6b:1d:82:23:ed:3c:0b:0b:d2:bc:14:be:\n" + " 6d:b1:69:ad:3e:25:3a:66:d2:d1:af:9f:88:45:25:\n" + " 6b:6e:be:1f:a0:e7:b2:9f:6d:24:94:0d:f4:c2:75:\n" + " f9:1f:5d\n" " Exponent: 65537 (0x10001)\n" " X509v3 extensions:\n" - " X509v3 Subject Key Identifier: \n" - " 83:21:DE:EC:C0:79:03:6D:1E:83:F3:E5:97:29:D5:5A:C0:96:40:FA\n" - " X509v3 Authority Key Identifier: \n" - " keyid:8A:22:C6:9C:2E:11:F3:40:0C:CE:82:0C:22:59:FF:F8:7F:D0:B9:13\n" - "\n" - " X509v3 Basic Constraints: critical\n" + " X509v3 Basic Constraints:\n" " CA:TRUE, pathlen:0\n" - " X509v3 Key Usage: critical\n" + " X509v3 Key Usage:\n" " Digital Signature, Certificate Sign, CRL Sign\n" + " X509v3 Subject Key Identifier:\n" + " 56:98:DC:45:25:11:E2:8C:2B:EA:D6:C6:E2:C8:BE:2C:C8:69:FF:FF\n" + " X509v3 Authority Key Identifier:\n" + " keyid:4D:7D:AE:0D:A5:5E:22:5A:6A:8F:19:61:54:B3:58:CB:7B:C0:BD:DA\n" + " DirName:/C=US/ST=California/L=San Francisco/O=Linden Lab/OU=Second Life Engineering/CN=Integration Test Root CA/emailAddress=noreply@lindenlab.com\n" + " serial:EF:54:D8:F7:DA:18:E8:19\n" " Signature Algorithm: sha256WithRSAEncryption\n" - " a3:6c:85:9a:2e:4e:7e:5d:83:63:0f:f5:4f:a9:7d:ec:0e:6f:\n" - " ae:d7:ba:df:64:e0:46:0e:3d:da:18:15:2c:f3:73:ca:81:b1:\n" - " 10:d9:53:14:21:7d:72:5c:94:88:a5:9d:ad:ab:45:42:c6:64:\n" - " a9:d9:2e:4e:29:47:2c:b1:95:07:b7:62:48:68:1f:68:13:1c:\n" - " d2:a0:fb:5e:38:24:4a:82:0a:87:c9:93:20:43:7e:e9:f9:79:\n" - " ef:03:a2:bd:9e:24:6b:0a:01:5e:4a:36:c5:7d:7a:fe:d6:aa:\n" - " 2f:c2:8c:38:8a:99:3c:b0:6a:e5:60:be:56:d6:eb:60:03:55:\n" - " 24:42:a0:1a:fa:91:24:a3:53:15:75:5d:c8:eb:7c:1e:68:5a:\n" - " 7e:13:34:e3:85:37:1c:76:3f:77:67:1b:ed:1b:52:17:fc:4a:\n" - " a3:e2:74:84:80:2c:69:fc:dd:7d:26:97:c4:2a:69:7d:9c:dc:\n" - " 61:97:70:29:a7:3f:2b:5b:2b:22:51:fd:fe:6a:5d:f9:e7:14:\n" - " 48:b7:2d:c8:33:58:fc:f2:5f:27:f7:26:16:be:be:b5:aa:a2:\n" - " 64:53:3c:69:e8:b5:61:eb:ab:91:a5:b4:09:9b:f6:98:b8:5c:\n" - " 5b:24:2f:93:f5:2b:9c:8c:58:fb:26:3f:67:53:d7:42:64:e8:\n" - " 79:77:73:41:4e:e3:02:39:0b:b6:68:97:8b:84:e8:1d:83:a8:\n" - " 15:f1:06:46:47:80:42:5e:14:e2:61:8a:76:84:d5:d4:71:7f:\n" - " 4e:ff:d9:74:87:ff:32:c5:87:20:0a:d4:59:40:3e:d8:17:ef:\n" - " da:65:e9:0a:51:fe:1e:c3:46:91:d2:ee:e4:23:57:97:87:d4:\n" - " a6:a5:eb:ef:81:6a:d8:8c:d6:1f:8e:b1:18:4c:6b:89:32:55:\n" - " 53:68:26:9e:bb:03:be:2c:e9:8b:ff:97:9c:1c:ac:28:c3:9f:\n" - " 0b:b7:93:23:24:31:63:e4:19:13:f2:bb:08:71:b7:c5:c5:c4:\n" - " 10:ff:dc:fc:33:54:a4:5e:ec:a3:fe:0a:80:ca:9c:bc:95:6f:\n" - " 5f:39:91:3b:61:69:16:94:0f:57:4b:fc:4b:b1:be:72:98:5d:\n" - " 10:f9:08:a7:d6:e0:e8:3d:5d:54:7d:fa:4b:6a:dd:98:41:ed:\n" - " 84:a1:39:67:5c:6c:7f:0c:b0:e1:98:c1:14:ed:fe:1e:e8:05:\n" - " 8d:7f:6a:24:cb:1b:05:42:0d:7f:13:ba:ca:b5:91:db:a5:f0:\n" - " 40:2b:70:7a:2a:a5:5d:ed:56:0c:f0:c2:72:ee:63:dd:cb:5d:\n" - " 76:f6:08:e6:e6:30:ef:3a:b2:16:34:41:a4:e1:30:14:bc:c7:\n" - " f9:23:3a:1a:70:df:b8:cc\n" + " ae:d0:30:ac:31:49:20:86:0b:34:01:58:08:94:68:cc:38:9c:\n" + " f7:13:5c:46:19:33:ed:54:5e:e4:43:f3:59:33:5c:50:d9:89:\n" + " 8b:ee:75:67:a8:c7:0e:d1:30:c2:4e:a3:2e:a8:64:2d:6a:a8:\n" + " f4:bd:b1:32:dc:bc:46:48:5d:1a:18:d8:e8:0b:8c:fe:7b:51:\n" + " d9:dd:b9:e3:4b:d1:f9:e0:22:46:dd:37:5b:b2:cb:72:8e:9c:\n" + " 4b:da:67:df:fd:ce:86:49:21:31:4e:99:b6:d4:38:0b:14:5d:\n" + " ad:97:ba:8f:e2:08:15:85:73:eb:4a:7d:01:49:af:63:ae:2d:\n" + " e3:9d:0a:d7:11:c2:03:d3:15:21:97:be:3d:d2:ea:ab:cc:93:\n" + " 16:98:64:80:72:eb:c2:78:0a:09:69:c4:2b:5d:df:30:7b:be:\n" + " 9b:02:34:73:62:9f:95:b1:cf:08:e8:9e:57:a8:37:31:cf:2c:\n" + " 8c:18:b1:d5:7a:25:90:d6:b6:76:28:1b:e2:b1:cf:1b:f1:ef:\n" + " dd:2f:d3:07:af:81:e3:5f:fc:5a:e7:3c:a9:37:0d:9c:78:5b:\n" + " 58:dc:89:54:70:a4:5b:ff:9f:64:30:a3:85:12:32:69:a5:02:\n" + " 73:d9:1d:ff:69:1f:d4:97:8f:d0:a8:90:8c:dd:2e:45:a1:b1:\n" + " e3:8a:82:fc:fc:08:41:01:51:92:87:9a:09:7b:35:c3:cc:48:\n" + " 81:39:30:a9:f4:41:3b:06:a3:06:21:cc:4b:bc:1b:76:58:94:\n" + " d1:e4:22:70:7f:20:7e:7a:b4:fa:7f:e8:79:c1:8c:89:9e:e9:\n" + " e3:72:2a:43:72:47:9e:bb:26:ed:64:2c:c8:54:f7:b4:95:c2:\n" + " c4:e9:8b:df:d5:10:a7:ed:a5:7a:94:97:c4:76:45:e3:6c:c0:\n" + " 0e:a6:2a:76:d5:1d:2f:ad:99:32:c6:7b:f6:41:e0:65:37:0f:\n" + " c0:1f:c5:99:4a:75:fd:6c:e0:f1:f0:58:49:2d:81:10:ca:d8:\n" + " eb:2b:c3:9b:a9:d9:a9:f5:6c:6d:26:fd:b8:32:92:58:f4:65:\n" + " 0b:d1:8e:03:1e:d5:6a:95:d4:46:9e:65:dd:e5:85:36:e6:31:\n" + " 77:3a:1a:20:2b:07:b7:f1:9a:4e:8d:54:22:5a:54:1c:72:5c:\n" + " 1f:b4:1a:5b:21:ed:06:5a:9a:e5:3c:01:c9:9b:af:50:61:f2:\n" + " 29:6b:ec:6d:19:bb:2e:02:94:ca:36:71:ef:45:39:f1:a5:25:\n" + " 10:0e:90:bc:a7:b3:5b:ab:af:f1:19:88:6a:09:2f:1f:d0:24:\n" + " a8:62:ed:d9:1a:65:89:65:16:a5:55:de:33:e8:7a:81:66:72:\n" + " 91:17:5e:1d:22:72:f7:b8\n" "-----BEGIN CERTIFICATE-----\n" - "MIIGSDCCBDCgAwIBAgICEAAwDQYJKoZIhvcNAQELBQAwgboxCzAJBgNVBAYTAlVT\n" - "MRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNpc2NvMRMw\n" - "EQYDVQQKDApMaW5kZW4gTGFiMSAwHgYDVQQLDBdTZWNvbmQgTGlmZSBFbmdpbmVl\n" - "cmluZzEhMB8GA1UEAwwYSW50ZWdyYXRpb24gVGVzdCBSb290IENBMSQwIgYJKoZI\n" - "hvcNAQkBFhVub3JlcGx5QGxpbmRlbmxhYi5jb20wHhcNMTgwNTIyMjIzOTA4WhcN\n" - "MjgwNTE5MjIzOTA4WjCBqjELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3Ju\n" - "aWExEzARBgNVBAoMCkxpbmRlbiBMYWIxIDAeBgNVBAsMF1NlY29uZCBMaWZlIEVu\n" - "Z2luZWVyaW5nMSkwJwYDVQQDDCBJbnRlZ3JhdGlvbiBUZXN0IEludGVybWVkaWF0\n" - "ZSBDQTEkMCIGCSqGSIb3DQEJARYVbm9yZXBseUBsaW5kZW5sYWIuY29tMIICIjAN\n" - "BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAzqNw4sT7S5eQoTC7wRsTuap+Rhej\n" - "Jo1pP15zlehqsQq0j1Bl48ZcOSQ03wu3zM5iDDZaEiz+NUzpHKyAXiSZ16q9vkjA\n" - "YmR3NohmzvSo3dJ2JGKQVUH8HRNOp05XvKikWUssWhzYzBbe6IgwyZXfL6YUKA/r\n" - "NEYSWLraDubenBX29OOfdKpwiXmL6Vp7GFQVlDojCmV4BdkzkCrOFRgNUvxcMWUg\n" - "0BI3jBGAutSwgnMAS0m+y9a8581h8wCYmXRaN4FJln4UARuG0tAGlEBjY0YR/DNc\n" - "vTpe1OVER2RQvaaXVXBkmybM3iCCkGqDQZxvcUcUvstofIW+7y52EhnTyYcytKxg\n" - "IBYoLa+86AHGf/vYEdX0txS9Jwhbcr4J4JHInHu0sxLvMja+sbmit+NpRzB2upyb\n" - "GZlNU91c6CzxsmRpzxW9+LtYlXNYOJW0es+EKabC2/C975cm1Jms18e+sA0R9CaG\n" - "LXdCUiXXVsfjl7E2XJdx0Jv1tVCN+f/7EHc8tVNtoUM1qQMyBavX9dEZvV+SowAq\n" - "eTekdk/pMg3khrvqwxrFM+gW1KXY4Oi7wvAiFeLZjK6sfSu/66NMOykdlKyju226\n" - "bQORA89GEsRmIcXGZ9gRGXkBDm6EHHZvET3rlInFaiYfzeARi1HumTVp5X8LdyqU\n" - "5EtkuYMEMAXkouMCAwEAAaNmMGQwHQYDVR0OBBYEFIMh3uzAeQNtHoPz5Zcp1VrA\n" - "lkD6MB8GA1UdIwQYMBaAFIoixpwuEfNADM6CDCJZ//h/0LkTMBIGA1UdEwEB/wQI\n" - "MAYBAf8CAQAwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQCjbIWa\n" - "Lk5+XYNjD/VPqX3sDm+u17rfZOBGDj3aGBUs83PKgbEQ2VMUIX1yXJSIpZ2tq0VC\n" - "xmSp2S5OKUcssZUHt2JIaB9oExzSoPteOCRKggqHyZMgQ37p+XnvA6K9niRrCgFe\n" - "SjbFfXr+1qovwow4ipk8sGrlYL5W1utgA1UkQqAa+pEko1MVdV3I63weaFp+EzTj\n" - "hTccdj93ZxvtG1IX/Eqj4nSEgCxp/N19JpfEKml9nNxhl3Appz8rWysiUf3+al35\n" - "5xRIty3IM1j88l8n9yYWvr61qqJkUzxp6LVh66uRpbQJm/aYuFxbJC+T9SucjFj7\n" - "Jj9nU9dCZOh5d3NBTuMCOQu2aJeLhOgdg6gV8QZGR4BCXhTiYYp2hNXUcX9O/9l0\n" - "h/8yxYcgCtRZQD7YF+/aZekKUf4ew0aR0u7kI1eXh9SmpevvgWrYjNYfjrEYTGuJ\n" - "MlVTaCaeuwO+LOmL/5ecHKwow58Lt5MjJDFj5BkT8rsIcbfFxcQQ/9z8M1SkXuyj\n" - "/gqAypy8lW9fOZE7YWkWlA9XS/xLsb5ymF0Q+Qin1uDoPV1UffpLat2YQe2EoTln\n" - "XGx/DLDhmMEU7f4e6AWNf2okyxsFQg1/E7rKtZHbpfBAK3B6KqVd7VYM8MJy7mPd\n" - "y1129gjm5jDvOrIWNEGk4TAUvMf5IzoacN+4zA==\n" + "MIIHNjCCBR6gAwIBAgIJAIW7S2Ym25rGMA0GCSqGSIb3DQEBCwUAMIG6MQswCQYD\n" + "VQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5j\n" + "aXNjbzETMBEGA1UECgwKTGluZGVuIExhYjEgMB4GA1UECwwXU2Vjb25kIExpZmUg\n" + "RW5naW5lZXJpbmcxITAfBgNVBAMMGEludGVncmF0aW9uIFRlc3QgUm9vdCBDQTEk\n" + "MCIGCSqGSIb3DQEJARYVbm9yZXBseUBsaW5kZW5sYWIuY29tMB4XDTI0MDcyMzEx\n" + "NDYzM1oXDTM0MDcyMTExNDYzM1owgcIxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApD\n" + "YWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNpc2NvMRMwEQYDVQQKDApMaW5k\n" + "ZW4gTGFiMSAwHgYDVQQLDBdTZWNvbmQgTGlmZSBFbmdpbmVlcmluZzEpMCcGA1UE\n" + "AwwgSW50ZWdyYXRpb24gVGVzdCBJbnRlcm1lZGlhdGUgQ0ExJDAiBgkqhkiG9w0B\n" + "CQEWFW5vcmVwbHlAbGluZGVubGFiLmNvbTCCAiIwDQYJKoZIhvcNAQEBBQADggIP\n" + "ADCCAgoCggIBAL730svkXEZ74hEiiXLad3LsBYcZ93cH/WfXrxPVdhKS3WlNIkew\n" + "PZSKapWFNLh4w51jMrFLCrYOBXurBiP8DSG1/MZqWja+bvzHR5ejGC4zzQ6KdSu3\n" + "KeloSpBTRdtz/7PlwdRr3Tqx71OfI+nGh85nufuk1XYhA8vFcmvFpgdV+0eQ6JI4\n" + "cxQRjv8huTVkWmHH/B/kTUflA8wLw2lmcYQMGC9hfzTd8pHjt52ouNs/bm+W+jQG\n" + "ggTIGMzei38mtUhT+/sVew44YP7aIZiNcweya/2tIVnnhGbhBBYcvhM0KEMsCT3k\n" + "dyqkrW35JgT3Q3Ob2eoaQ2q024j4+b00+Kboequ0suEpR6a6uGWcxrOvE0M47yoF\n" + "d5+P8AxWIcKS0izDMlDRYq5R/JnmuDj4gx2NQBHgHVFdP/pVYbYYCR5xr5VknOrG\n" + "EWTwqAJ9u8hULldIMnxRZg3WPg7tXjCopkcDZFyJIUWQ4UyRvL2BbnOpFCfmDW04\n" + "3FCdslZmYGxmuV27jJYtiV4NK+24AzHOCv+CA/WyO+Un3mHYj7+iamSwSocjQCij\n" + "8eyWUM2DUC14cZLyiHWwnc0L5GKmpWMR/LS6n8ZnQCytpO+U8PmguuFSLifZax2C\n" + "I+08CwvSvBS+bbFprT4lOmbS0a+fiEUla26+H6Dnsp9tJJQN9MJ1+R9dAgMBAAGj\n" + "ggEzMIIBLzAPBgNVHRMECDAGAQH/AgEAMAsGA1UdDwQEAwIBhjAdBgNVHQ4EFgQU\n" + "VpjcRSUR4owr6tbG4si+LMhp//8wge8GA1UdIwSB5zCB5IAUTX2uDaVeIlpqjxlh\n" + "VLNYy3vAvdqhgcCkgb0wgboxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9y\n" + "bmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNpc2NvMRMwEQYDVQQKDApMaW5kZW4gTGFi\n" + "MSAwHgYDVQQLDBdTZWNvbmQgTGlmZSBFbmdpbmVlcmluZzEhMB8GA1UEAwwYSW50\n" + "ZWdyYXRpb24gVGVzdCBSb290IENBMSQwIgYJKoZIhvcNAQkBFhVub3JlcGx5QGxp\n" + "bmRlbmxhYi5jb22CCQDvVNj32hjoGTANBgkqhkiG9w0BAQsFAAOCAgEArtAwrDFJ\n" + "IIYLNAFYCJRozDic9xNcRhkz7VRe5EPzWTNcUNmJi+51Z6jHDtEwwk6jLqhkLWqo\n" + "9L2xMty8RkhdGhjY6AuM/ntR2d2540vR+eAiRt03W7LLco6cS9pn3/3OhkkhMU6Z\n" + "ttQ4CxRdrZe6j+IIFYVz60p9AUmvY64t450K1xHCA9MVIZe+PdLqq8yTFphkgHLr\n" + "wngKCWnEK13fMHu+mwI0c2KflbHPCOieV6g3Mc8sjBix1XolkNa2digb4rHPG/Hv\n" + "3S/TB6+B41/8Wuc8qTcNnHhbWNyJVHCkW/+fZDCjhRIyaaUCc9kd/2kf1JeP0KiQ\n" + "jN0uRaGx44qC/PwIQQFRkoeaCXs1w8xIgTkwqfRBOwajBiHMS7wbdliU0eQicH8g\n" + "fnq0+n/oecGMiZ7p43IqQ3JHnrsm7WQsyFT3tJXCxOmL39UQp+2lepSXxHZF42zA\n" + "DqYqdtUdL62ZMsZ79kHgZTcPwB/FmUp1/Wzg8fBYSS2BEMrY6yvDm6nZqfVsbSb9\n" + "uDKSWPRlC9GOAx7VapXURp5l3eWFNuYxdzoaICsHt/GaTo1UIlpUHHJcH7QaWyHt\n" + "Blqa5TwByZuvUGHyKWvsbRm7LgKUyjZx70U58aUlEA6QvKezW6uv8RmIagkvH9Ak\n" + "qGLt2RpliWUWpVXeM+h6gWZykRdeHSJy97g=\n" "-----END CERTIFICATE-----\n" - ); + ); const std::string mPemChildCert( "Certificate:\n" " Data:\n" " Version: 3 (0x2)\n" - " Serial Number: 4096 (0x1000)\n" + " Serial Number: 9e:8d:34:13:e7:9b:f9:31\n" " Signature Algorithm: sha256WithRSAEncryption\n" - " Issuer: C=US, ST=California, O=Linden Lab, OU=Second Life Engineering, CN=Integration Test Intermediate CA/emailAddress=noreply@lindenlab.com\n" + " Issuer: C=US, ST=California, L=San Francisco, O=Linden Lab, OU=Second Life Engineering, CN=Integration Test Intermediate CA/emailAddress=noreply@lindenlab.com\n" " Validity\n" - " Not Before: May 22 22:58:15 2018 GMT\n" - " Not After : Jul 19 22:58:15 2024 GMT\n" + " Not Before: Jul 23 11:46:39 2024 GMT\n" + " Not After : Jul 21 11:46:39 2034 GMT\n" " Subject: C=US, ST=California, L=San Francisco, O=Linden Lab, OU=Second Life Engineering, CN=Integration Test Server Cert/emailAddress=noreply@lindenlab.com\n" " Subject Public Key Info:\n" " Public Key Algorithm: rsaEncryption\n" - " Public-Key: (2048 bit)\n" + " Public-Key: (4096 bit)\n" " Modulus:\n" - " 00:bf:a1:1c:76:82:4a:10:1d:25:0e:02:e2:7a:64:\n" - " 54:c7:94:c5:c0:98:d5:35:f3:cb:cb:30:ba:31:9c:\n" - " bd:4c:2f:4a:4e:24:03:4b:87:5c:c1:5c:fe:d9:89:\n" - " 3b:cb:01:bc:eb:a5:b7:78:dc:b3:58:e5:78:a7:15:\n" - " 34:50:30:aa:16:3a:b2:94:17:6d:1e:7f:b2:70:1e:\n" - " 96:41:bb:1d:e3:22:80:fa:dc:00:6a:fb:34:3e:67:\n" - " e7:c2:21:2f:1b:d3:af:04:49:91:eb:bb:60:e0:26:\n" - " 52:75:28:8a:08:5b:91:56:4e:51:50:40:51:70:af:\n" - " cb:80:66:c8:59:e9:e2:48:a8:62:d0:26:67:80:0a:\n" - " 12:16:d1:f6:15:9e:1f:f5:92:37:f3:c9:2f:03:9e:\n" - " 22:f6:60:5a:76:45:8c:01:2c:99:54:72:19:db:b7:\n" - " 72:e6:5a:69:f3:e9:31:65:5d:0f:c7:5c:9c:17:29:\n" - " 71:14:7f:db:47:c9:1e:65:a2:41:b0:2f:14:17:ec:\n" - " 4b:25:f2:43:8f:b4:a3:8d:37:1a:07:34:b3:29:bb:\n" - " 8a:44:8e:84:08:a2:1b:76:7a:cb:c2:39:2f:6e:e3:\n" - " fc:d6:91:b5:1f:ce:58:91:57:70:35:6e:25:a9:48:\n" - " 0e:07:cf:4e:dd:16:42:65:cf:8a:42:b3:27:e6:fe:\n" - " 6a:e3\n" + " 00:d8:ac:0c:27:8f:ea:c0:4d:21:e4:75:55:31:57:\n" + " 83:46:47:14:1e:f5:67:ae:98:60:c4:97:6d:e8:53:\n" + " f2:4d:3b:ec:6f:08:bc:1e:c0:e2:a6:75:b5:90:1d:\n" + " 30:a2:59:68:32:10:2b:29:67:fc:99:f1:24:6a:36:\n" + " 73:60:31:6b:c7:a0:b8:b0:38:60:b1:59:23:2c:ab:\n" + " 25:a2:c8:b0:bc:2c:c6:d7:4c:87:37:1b:5e:51:a4:\n" + " 63:3e:c4:6d:ed:da:5e:d3:ad:8a:6d:52:e4:87:38:\n" + " 33:76:cf:f2:86:58:b3:10:a4:91:8d:3d:4f:27:9a:\n" + " 8b:b4:d7:67:90:31:1c:f5:7f:78:af:6f:f2:dd:39:\n" + " d0:16:16:7b:46:ad:88:1b:3b:74:6b:10:29:8b:64:\n" + " ba:ed:9f:a7:69:99:55:8f:73:0d:18:a3:7f:40:20:\n" + " 3a:41:4a:94:39:62:8b:fe:c6:9d:79:d0:cd:1c:e2:\n" + " d4:74:bb:43:75:eb:86:8b:30:c1:8d:cc:14:ab:75:\n" + " 2e:f5:3e:0c:05:cb:e4:c3:92:d8:81:8c:df:a5:4e:\n" + " 2e:0b:ae:17:15:9b:e6:dd:9e:16:46:42:27:92:8a:\n" + " 0e:3a:74:1e:d1:3f:ee:7e:a5:d7:ec:1c:63:d4:96:\n" + " 5b:36:f9:15:ee:da:66:ac:5e:de:91:d9:08:24:fb:\n" + " 5d:fc:9b:77:dd:ff:20:a6:67:6f:48:41:5e:5a:ac:\n" + " 13:a4:2c:2a:f2:a3:15:86:e2:84:33:34:e3:91:27:\n" + " 8b:37:ba:b0:c7:5e:1a:0d:b9:f2:4e:0c:55:e6:bb:\n" + " d9:63:f5:05:7b:aa:19:e5:57:ce:a5:b1:46:4b:b3:\n" + " 04:f6:a0:97:26:ed:48:ed:97:93:a6:75:b1:a3:42:\n" + " fc:cc:57:89:da:44:e9:16:a6:30:2c:01:8e:f2:ed:\n" + " be:45:05:08:8a:af:1e:07:51:89:cf:51:4c:aa:f3:\n" + " b3:f0:6f:db:21:80:11:32:0a:23:e2:ff:cc:59:15:\n" + " eb:ff:d2:b8:d6:a1:c1:b4:96:12:82:bf:3f:68:ad:\n" + " c8:61:50:f8:88:4f:d0:be:8e:29:64:1a:16:a5:d9:\n" + " 29:76:16:cd:70:37:c4:f2:1f:4e:c6:57:36:dd:c1:\n" + " 27:19:72:ef:98:7e:34:25:3f:76:b1:ea:15:b2:38:\n" + " 6e:d3:43:03:7a:2b:78:91:9a:19:26:2a:31:b7:5e:\n" + " b7:22:c4:fd:bf:93:10:a4:23:3f:d7:79:53:28:5d:\n" + " 2e:ba:0c:b0:5e:0a:b4:c4:a1:71:75:88:1b:b2:0e:\n" + " 2c:67:08:7b:f0:f6:37:d3:aa:39:50:03:a3:7c:17:\n" + " 1d:52:52:2a:6b:d0:a2:54:2e:ba:11:bc:26:a9:16:\n" + " a6:1b:79\n" " Exponent: 65537 (0x10001)\n" " X509v3 extensions:\n" - " X509v3 Basic Constraints: \n" + " X509v3 Basic Constraints:\n" " CA:FALSE\n" - " Netscape Cert Type: \n" - " SSL Server\n" - " Netscape Comment: \n" - " OpenSSL Generated Server Certificate\n" - " X509v3 Subject Key Identifier: \n" - " BB:59:9F:DE:6B:51:A7:6C:B3:6D:5B:8B:42:F7:B1:65:77:17:A4:E4\n" - " X509v3 Authority Key Identifier: \n" - " keyid:83:21:DE:EC:C0:79:03:6D:1E:83:F3:E5:97:29:D5:5A:C0:96:40:FA\n" - " DirName:/C=US/ST=California/L=San Francisco/O=Linden Lab/OU=Second Life Engineering/CN=Integration Test Root CA/emailAddress=noreply@lindenlab.com\n" - " serial:10:00\n" - "\n" - " X509v3 Key Usage: critical\n" + " X509v3 Key Usage:\n" " Digital Signature, Key Encipherment\n" - " X509v3 Extended Key Usage: \n" + " X509v3 Extended Key Usage:\n" " TLS Web Server Authentication\n" + " X509v3 Subject Key Identifier:\n" + " 7B:1A:F9:2B:C4:B2:F6:AE:D6:F2:8E:B1:73:FB:DD:11:CA:DB:F8:87\n" + " X509v3 Authority Key Identifier:\n" + " keyid:56:98:DC:45:25:11:E2:8C:2B:EA:D6:C6:E2:C8:BE:2C:C8:69:FF:FF\n" + " DirName:/C=US/ST=California/L=San Francisco/O=Linden Lab/OU=Second Life Engineering/CN=Integration Test Root CA/emailAddress=noreply@lindenlab.com\n" + " serial:85:BB:4B:66:26:DB:9A:C6\n" " Signature Algorithm: sha256WithRSAEncryption\n" - " 18:a6:58:55:9b:d4:af:7d:8a:27:d3:28:3a:4c:4b:42:4e:f0:\n" - " 30:d6:d9:95:11:48:12:0a:96:40:d9:2b:21:39:c5:d4:8d:e5:\n" - " 10:bc:68:78:69:0b:9f:15:4a:0b:f1:ab:99:45:0c:20:5f:27:\n" - " df:e7:14:2d:4a:30:f2:c2:8d:37:73:36:1a:27:55:5a:08:5f:\n" - " 71:a1:5e:05:83:b2:59:fe:02:5e:d7:4a:30:15:23:58:04:cf:\n" - " 48:cc:b0:71:88:9c:6b:57:f0:04:0a:d3:a0:64:6b:ee:f3:5f:\n" - " ea:ac:e1:2b:b9:7f:79:b8:db:ce:72:48:72:db:c8:5c:38:72:\n" - " 31:55:d0:ff:6b:bd:73:23:a7:30:18:5d:ed:47:18:0a:67:8e:\n" - " 53:32:0e:99:9b:96:72:45:7f:c6:00:2c:5d:1a:97:53:75:3a:\n" - " 0b:49:3d:3a:00:37:14:67:0c:28:97:34:87:aa:c5:32:e4:ae:\n" - " 34:83:12:4a:10:f7:0e:74:d4:5f:73:bd:ef:0c:b7:d8:0a:7d:\n" - " 8e:8d:5a:48:bd:f4:8e:7b:f9:4a:15:3b:61:c9:5e:40:59:6e:\n" - " c7:a8:a4:02:28:72:c5:54:8c:77:f4:55:a7:86:c0:38:a0:68:\n" - " 19:da:0f:72:5a:a9:7e:69:9f:9c:3a:d6:66:aa:e1:f4:fd:f9:\n" - " b8:4b:6c:71:9e:f0:38:02:c7:6a:9e:dc:e6:fb:ef:23:59:4f:\n" - " 5c:84:0a:df:ea:86:1f:fd:0e:5c:fa:c4:e5:50:1c:10:cf:89:\n" - " 4e:08:0e:4c:4b:61:1a:49:12:f7:e9:4b:17:71:43:7b:6d:b6:\n" - " b5:9f:d4:3b:c7:88:53:48:63:b6:00:80:8f:49:0a:c5:7e:58:\n" - " ac:78:d8:b9:06:b0:bc:86:e2:2e:48:5b:c3:24:fa:aa:72:d8:\n" - " ec:f6:c7:91:9f:0f:c8:b5:fd:2b:b2:a7:bc:2f:40:20:2b:47:\n" - " e0:d1:1d:94:52:6f:6b:be:12:b6:8c:dc:11:db:71:e6:19:ef:\n" - " a8:71:8b:ad:d3:32:c0:1c:a4:3f:b3:0f:af:e5:50:e1:ff:41:\n" - " a4:b7:6f:57:71:af:fd:16:4c:e8:24:b3:99:1b:cf:12:8f:43:\n" - " 05:80:ba:18:19:0a:a5:ec:49:81:41:4c:7e:28:b2:21:f2:59:\n" - " 6e:4a:ed:de:f9:fa:99:85:60:1f:e6:c2:42:5c:08:00:3c:84:\n" - " 06:a9:24:d4:cf:7b:6e:1b:59:1d:f4:70:16:03:a1:e0:0b:00:\n" - " 95:5c:39:03:fc:9d:1c:8e:f7:59:0c:61:47:f6:7f:07:22:48:\n" - " 83:40:ac:e1:98:5f:c7:be:05:d5:29:2b:bf:0d:03:0e:e9:5e:\n" - " 2b:dd:09:18:fe:5e:30:61\n" + " ad:7c:50:12:24:62:62:83:e9:dd:81:1a:12:1c:6d:ae:1e:a6:\n" + " 01:cc:93:8b:ac:83:7c:3d:57:d7:7f:d2:13:40:82:c7:27:07:\n" + " 31:d8:c4:01:04:64:9c:dc:ae:7b:52:bd:f5:62:7a:d0:7c:13:\n" + " 1a:19:86:6a:ce:9a:ba:69:07:77:75:b6:67:56:d0:c3:8d:6f:\n" + " 59:5f:ac:31:83:32:2c:4f:8c:85:8c:f3:56:5b:e0:83:16:19:\n" + " c9:55:4d:56:2c:e0:06:f8:71:85:4b:7e:c6:20:b3:f6:5b:85:\n" + " 6a:b7:0f:0e:0c:75:38:6a:aa:53:cc:b0:bf:c1:fd:a1:01:8a:\n" + " 7e:5a:0b:4d:51:fc:1b:14:b0:8d:62:17:b7:5d:6a:64:30:80:\n" + " aa:50:9a:23:9e:19:46:11:9d:49:d1:35:81:87:80:8c:9c:71:\n" + " 61:26:07:23:5d:a7:ea:4e:0c:53:77:bd:eb:18:6d:63:8b:2c:\n" + " e1:83:bb:bb:f8:3e:7c:e8:0d:19:1e:be:35:aa:99:0f:c7:25:\n" + " 0c:a8:f9:74:02:c8:4c:8e:bb:13:18:fd:aa:21:34:bc:2d:9f:\n" + " 10:96:e2:99:e3:9a:d7:91:0e:1e:77:20:70:e9:b4:63:25:f8:\n" + " ea:14:1f:24:b0:6a:8b:2a:f4:61:b1:0d:7d:18:bc:1d:6d:04:\n" + " 11:b2:9f:a2:a7:55:be:2b:2c:2f:c1:d8:95:13:73:af:1c:96:\n" + " 49:30:9c:9c:94:81:6c:9b:a7:87:5c:cf:46:95:95:4a:6f:bf:\n" + " df:c9:3d:74:3e:24:6e:44:1e:14:8b:68:23:e4:00:b5:a5:b7:\n" + " 5b:a9:ea:16:5f:fa:b1:d3:1a:b1:9b:36:ef:a4:7a:6f:a3:b0:\n" + " 97:35:ac:70:c0:cc:8e:a2:d3:40:0e:c1:70:0b:d5:ce:cd:51:\n" + " 82:8a:40:72:04:8d:62:af:ba:a8:e7:a8:e9:b9:99:b7:5c:5d:\n" + " 27:96:b2:3d:f9:0d:26:8c:3f:db:ac:86:97:be:f1:2c:0b:ca:\n" + " 90:07:93:96:f4:75:c3:e8:4c:f6:a8:a2:3f:da:11:21:e7:b1:\n" + " 8c:62:36:ae:91:a9:2a:73:ba:67:f5:24:16:c3:ee:b7:b1:b4:\n" + " e3:8a:28:23:84:cf:38:c6:f0:8e:21:f6:b8:76:9a:6d:d1:e3:\n" + " 74:81:7a:22:20:a0:82:2a:31:8a:ba:44:0b:61:5a:aa:ba:c6:\n" + " 07:99:36:0a:24:06:2f:8e:c1:1c:4b:f0:65:72:fb:e9:b5:31:\n" + " 59:13:2c:c6:f8:5b:91:e2:d8:96:f3:1a:06:0b:2a:62:12:4d:\n" + " 5e:65:c9:e9:e4:00:99:a6:d3:60:1f:c3:d6:cc:a6:9b:a5:14:\n" + " 1b:4d:db:e7:3d:52:7e:2c\n" "-----BEGIN CERTIFICATE-----\n" - "MIIGbjCCBFagAwIBAgICEAAwDQYJKoZIhvcNAQELBQAwgaoxCzAJBgNVBAYTAlVT\n" - "MRMwEQYDVQQIDApDYWxpZm9ybmlhMRMwEQYDVQQKDApMaW5kZW4gTGFiMSAwHgYD\n" - "VQQLDBdTZWNvbmQgTGlmZSBFbmdpbmVlcmluZzEpMCcGA1UEAwwgSW50ZWdyYXRp\n" - "b24gVGVzdCBJbnRlcm1lZGlhdGUgQ0ExJDAiBgkqhkiG9w0BCQEWFW5vcmVwbHlA\n" - "bGluZGVubGFiLmNvbTAeFw0xODA1MjIyMjU4MTVaFw0yNDA3MTkyMjU4MTVaMIG+\n" - "MQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2Fu\n" - "IEZyYW5jaXNjbzETMBEGA1UECgwKTGluZGVuIExhYjEgMB4GA1UECwwXU2Vjb25k\n" - "IExpZmUgRW5naW5lZXJpbmcxJTAjBgNVBAMMHEludGVncmF0aW9uIFRlc3QgU2Vy\n" - "dmVyIENlcnQxJDAiBgkqhkiG9w0BCQEWFW5vcmVwbHlAbGluZGVubGFiLmNvbTCC\n" - "ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL+hHHaCShAdJQ4C4npkVMeU\n" - "xcCY1TXzy8swujGcvUwvSk4kA0uHXMFc/tmJO8sBvOult3jcs1jleKcVNFAwqhY6\n" - "spQXbR5/snAelkG7HeMigPrcAGr7ND5n58IhLxvTrwRJkeu7YOAmUnUoighbkVZO\n" - "UVBAUXCvy4BmyFnp4kioYtAmZ4AKEhbR9hWeH/WSN/PJLwOeIvZgWnZFjAEsmVRy\n" - "Gdu3cuZaafPpMWVdD8dcnBcpcRR/20fJHmWiQbAvFBfsSyXyQ4+0o403Ggc0sym7\n" - "ikSOhAiiG3Z6y8I5L27j/NaRtR/OWJFXcDVuJalIDgfPTt0WQmXPikKzJ+b+auMC\n" - "AwEAAaOCAYYwggGCMAkGA1UdEwQCMAAwEQYJYIZIAYb4QgEBBAQDAgZAMDMGCWCG\n" - "SAGG+EIBDQQmFiRPcGVuU1NMIEdlbmVyYXRlZCBTZXJ2ZXIgQ2VydGlmaWNhdGUw\n" - "HQYDVR0OBBYEFLtZn95rUadss21bi0L3sWV3F6TkMIHoBgNVHSMEgeAwgd2AFIMh\n" - "3uzAeQNtHoPz5Zcp1VrAlkD6oYHApIG9MIG6MQswCQYDVQQGEwJVUzETMBEGA1UE\n" - "CAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzETMBEGA1UECgwK\n" - "TGluZGVuIExhYjEgMB4GA1UECwwXU2Vjb25kIExpZmUgRW5naW5lZXJpbmcxITAf\n" - "BgNVBAMMGEludGVncmF0aW9uIFRlc3QgUm9vdCBDQTEkMCIGCSqGSIb3DQEJARYV\n" - "bm9yZXBseUBsaW5kZW5sYWIuY29tggIQADAOBgNVHQ8BAf8EBAMCBaAwEwYDVR0l\n" - "BAwwCgYIKwYBBQUHAwEwDQYJKoZIhvcNAQELBQADggIBABimWFWb1K99iifTKDpM\n" - "S0JO8DDW2ZURSBIKlkDZKyE5xdSN5RC8aHhpC58VSgvxq5lFDCBfJ9/nFC1KMPLC\n" - "jTdzNhonVVoIX3GhXgWDsln+Al7XSjAVI1gEz0jMsHGInGtX8AQK06Bka+7zX+qs\n" - "4Su5f3m4285ySHLbyFw4cjFV0P9rvXMjpzAYXe1HGApnjlMyDpmblnJFf8YALF0a\n" - "l1N1OgtJPToANxRnDCiXNIeqxTLkrjSDEkoQ9w501F9zve8Mt9gKfY6NWki99I57\n" - "+UoVO2HJXkBZbseopAIocsVUjHf0VaeGwDigaBnaD3JaqX5pn5w61maq4fT9+bhL\n" - "bHGe8DgCx2qe3Ob77yNZT1yECt/qhh/9Dlz6xOVQHBDPiU4IDkxLYRpJEvfpSxdx\n" - "Q3tttrWf1DvHiFNIY7YAgI9JCsV+WKx42LkGsLyG4i5IW8Mk+qpy2Oz2x5GfD8i1\n" - "/Suyp7wvQCArR+DRHZRSb2u+EraM3BHbceYZ76hxi63TMsAcpD+zD6/lUOH/QaS3\n" - "b1dxr/0WTOgks5kbzxKPQwWAuhgZCqXsSYFBTH4osiHyWW5K7d75+pmFYB/mwkJc\n" - "CAA8hAapJNTPe24bWR30cBYDoeALAJVcOQP8nRyO91kMYUf2fwciSINArOGYX8e+\n" - "BdUpK78NAw7pXivdCRj+XjBh\n" + "MIIHSTCCBTGgAwIBAgIJAJ6NNBPnm/kxMA0GCSqGSIb3DQEBCwUAMIHCMQswCQYD\n" + "VQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5j\n" + "aXNjbzETMBEGA1UECgwKTGluZGVuIExhYjEgMB4GA1UECwwXU2Vjb25kIExpZmUg\n" + "RW5naW5lZXJpbmcxKTAnBgNVBAMMIEludGVncmF0aW9uIFRlc3QgSW50ZXJtZWRp\n" + "YXRlIENBMSQwIgYJKoZIhvcNAQkBFhVub3JlcGx5QGxpbmRlbmxhYi5jb20wHhcN\n" + "MjQwNzIzMTE0NjM5WhcNMzQwNzIxMTE0NjM5WjCBvjELMAkGA1UEBhMCVVMxEzAR\n" + "BgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDVNhbiBGcmFuY2lzY28xEzARBgNV\n" + "BAoMCkxpbmRlbiBMYWIxIDAeBgNVBAsMF1NlY29uZCBMaWZlIEVuZ2luZWVyaW5n\n" + "MSUwIwYDVQQDDBxJbnRlZ3JhdGlvbiBUZXN0IFNlcnZlciBDZXJ0MSQwIgYJKoZI\n" + "hvcNAQkBFhVub3JlcGx5QGxpbmRlbmxhYi5jb20wggIiMA0GCSqGSIb3DQEBAQUA\n" + "A4ICDwAwggIKAoICAQDYrAwnj+rATSHkdVUxV4NGRxQe9WeumGDEl23oU/JNO+xv\n" + "CLwewOKmdbWQHTCiWWgyECspZ/yZ8SRqNnNgMWvHoLiwOGCxWSMsqyWiyLC8LMbX\n" + "TIc3G15RpGM+xG3t2l7TrYptUuSHODN2z/KGWLMQpJGNPU8nmou012eQMRz1f3iv\n" + "b/LdOdAWFntGrYgbO3RrECmLZLrtn6dpmVWPcw0Yo39AIDpBSpQ5Yov+xp150M0c\n" + "4tR0u0N164aLMMGNzBSrdS71PgwFy+TDktiBjN+lTi4LrhcVm+bdnhZGQieSig46\n" + "dB7RP+5+pdfsHGPUlls2+RXu2masXt6R2Qgk+138m3fd/yCmZ29IQV5arBOkLCry\n" + "oxWG4oQzNOORJ4s3urDHXhoNufJODFXmu9lj9QV7qhnlV86lsUZLswT2oJcm7Ujt\n" + "l5OmdbGjQvzMV4naROkWpjAsAY7y7b5FBQiKrx4HUYnPUUyq87Pwb9shgBEyCiPi\n" + "/8xZFev/0rjWocG0lhKCvz9orchhUPiIT9C+jilkGhal2Sl2Fs1wN8TyH07GVzbd\n" + "wScZcu+YfjQlP3ax6hWyOG7TQwN6K3iRmhkmKjG3XrcixP2/kxCkIz/XeVMoXS66\n" + "DLBeCrTEoXF1iBuyDixnCHvw9jfTqjlQA6N8Fx1SUipr0KJULroRvCapFqYbeQID\n" + "AQABo4IBQjCCAT4wCQYDVR0TBAIwADALBgNVHQ8EBAMCBaAwEwYDVR0lBAwwCgYI\n" + "KwYBBQUHAwEwHQYDVR0OBBYEFHsa+SvEsvau1vKOsXP73RHK2/iHMIHvBgNVHSME\n" + "gecwgeSAFFaY3EUlEeKMK+rWxuLIvizIaf//oYHApIG9MIG6MQswCQYDVQQGEwJV\n" + "UzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzET\n" + "MBEGA1UECgwKTGluZGVuIExhYjEgMB4GA1UECwwXU2Vjb25kIExpZmUgRW5naW5l\n" + "ZXJpbmcxITAfBgNVBAMMGEludGVncmF0aW9uIFRlc3QgUm9vdCBDQTEkMCIGCSqG\n" + "SIb3DQEJARYVbm9yZXBseUBsaW5kZW5sYWIuY29tggkAhbtLZibbmsYwDQYJKoZI\n" + "hvcNAQELBQADggIBAK18UBIkYmKD6d2BGhIcba4epgHMk4usg3w9V9d/0hNAgscn\n" + "BzHYxAEEZJzcrntSvfVietB8ExoZhmrOmrppB3d1tmdW0MONb1lfrDGDMixPjIWM\n" + "81Zb4IMWGclVTVYs4Ab4cYVLfsYgs/ZbhWq3Dw4MdThqqlPMsL/B/aEBin5aC01R\n" + "/BsUsI1iF7ddamQwgKpQmiOeGUYRnUnRNYGHgIyccWEmByNdp+pODFN3vesYbWOL\n" + "LOGDu7v4PnzoDRkevjWqmQ/HJQyo+XQCyEyOuxMY/aohNLwtnxCW4pnjmteRDh53\n" + "IHDptGMl+OoUHySwaosq9GGxDX0YvB1tBBGyn6KnVb4rLC/B2JUTc68clkkwnJyU\n" + "gWybp4dcz0aVlUpvv9/JPXQ+JG5EHhSLaCPkALWlt1up6hZf+rHTGrGbNu+kem+j\n" + "sJc1rHDAzI6i00AOwXAL1c7NUYKKQHIEjWKvuqjnqOm5mbdcXSeWsj35DSaMP9us\n" + "hpe+8SwLypAHk5b0dcPoTPaooj/aESHnsYxiNq6RqSpzumf1JBbD7rextOOKKCOE\n" + "zzjG8I4h9rh2mm3R43SBeiIgoIIqMYq6RAthWqq6xgeZNgokBi+OwRxL8GVy++m1\n" + "MVkTLMb4W5Hi2JbzGgYLKmISTV5lyenkAJmm02Afw9bMppulFBtN2+c9Un4s\n" "-----END CERTIFICATE-----\n" - ); + ); + // Test wrapper declaration : wrapping nothing for the moment struct sechandler_basic_test @@ -634,19 +655,19 @@ namespace tut // Read each of the 4 Pem certs and store in mX509*Cert pointers BIO * validation_bio; - validation_bio = BIO_new_mem_buf((void*)mPemTestCert.c_str(), mPemTestCert.length()); + validation_bio = BIO_new_mem_buf((void*)mPemTestCert.c_str(), static_cast<S32>(mPemTestCert.length())); PEM_read_bio_X509(validation_bio, &mX509TestCert, 0, NULL); BIO_free(validation_bio); - validation_bio = BIO_new_mem_buf((void*)mPemRootCert.c_str(), mPemRootCert.length()); + validation_bio = BIO_new_mem_buf((void*)mPemRootCert.c_str(), static_cast<S32>(mPemRootCert.length())); PEM_read_bio_X509(validation_bio, &mX509RootCert, 0, NULL); BIO_free(validation_bio); - validation_bio = BIO_new_mem_buf((void*)mPemIntermediateCert.c_str(), mPemIntermediateCert.length()); + validation_bio = BIO_new_mem_buf((void*)mPemIntermediateCert.c_str(), static_cast<S32>(mPemIntermediateCert.length())); PEM_read_bio_X509(validation_bio, &mX509IntermediateCert, 0, NULL); BIO_free(validation_bio); - validation_bio = BIO_new_mem_buf((void*)mPemChildCert.c_str(), mPemChildCert.length()); + validation_bio = BIO_new_mem_buf((void*)mPemChildCert.c_str(), static_cast<S32>(mPemChildCert.length())); PEM_read_bio_X509(validation_bio, &mX509ChildCert, 0, NULL); BIO_free(validation_bio); } @@ -701,14 +722,13 @@ namespace tut //std::ostringstream llsd_value; //llsd_value << LLSDOStreamer<LLSDNotationFormatter>(llsd_cert) << std::endl; LL_DEBUGS() << "test 1 cert " << llsd_cert << LL_ENDL; - ensure_equals("Issuer Name/commonName", (std::string)llsd_cert["issuer_name"]["commonName"], "Integration Test Intermediate CA"); ensure_equals("Issuer Name/countryName", (std::string)llsd_cert["issuer_name"]["countryName"], "US"); ensure_equals("Issuer Name/state", (std::string)llsd_cert["issuer_name"]["stateOrProvinceName"], "California"); ensure_equals("Issuer Name/org name", (std::string)llsd_cert["issuer_name"]["organizationName"], "Linden Lab"); ensure_equals("Issuer Name/org unit", (std::string)llsd_cert["issuer_name"]["organizationalUnitName"], "Second Life Engineering"); ensure_equals("Issuer name string", (std::string)llsd_cert["issuer_name_string"], - "emailAddress=noreply@lindenlab.com,CN=Integration Test Intermediate CA,OU=Second Life Engineering,O=Linden Lab,ST=California,C=US"); + "emailAddress=noreply@lindenlab.com,CN=Integration Test Intermediate CA,OU=Second Life Engineering,O=Linden Lab,L=San Francisco,ST=California,C=US"); ensure_equals("subject Name/commonName", (std::string)llsd_cert["subject_name"]["commonName"], "Integration Test Server Cert"); ensure_equals("subject Name/countryName", (std::string)llsd_cert["subject_name"]["countryName"], "US"); @@ -721,9 +741,9 @@ namespace tut ensure_equals("subject name string", (std::string)llsd_cert["subject_name_string"], "emailAddress=noreply@lindenlab.com,CN=Integration Test Server Cert,OU=Second Life Engineering,O=Linden Lab,L=San Francisco,ST=California,C=US"); - ensure_equals("serial number", (std::string)llsd_cert["serial_number"], "1000"); - ensure_equals("valid from", (std::string)llsd_cert["valid_from"], "2018-05-22T22:58:15Z"); - ensure_equals("valid to", (std::string)llsd_cert["valid_to"], "2024-07-19T22:58:15Z"); + ensure_equals("serial number", (std::string)llsd_cert["serial_number"], "9E8D3413E79BF931"); + ensure_equals("valid from", (std::string)llsd_cert["valid_from"], "2024-07-23T11:46:39Z"); + ensure_equals("valid to", (std::string)llsd_cert["valid_to"], "2034-07-21T11:46:39Z"); LLSD expectedKeyUsage = LLSD::emptyArray(); expectedKeyUsage.append(LLSD((std::string)"digitalSignature")); expectedKeyUsage.append(LLSD((std::string)"keyEncipherment")); @@ -964,7 +984,7 @@ namespace tut // test creation of credentials my_cred = handler->createCredential("mysavedgrid", my_id, my_authenticator); // test save without saving authenticator. - handler->saveCredential(my_cred, FALSE); + handler->saveCredential(my_cred, false); my_new_cred = handler->loadCredential("mysavedgrid"); ensure_equals("saved credential without auth", (const std::string)my_new_cred->getIdentifier()["type"], "test_type"); @@ -1042,7 +1062,7 @@ namespace tut //validate find LLSD find_info = LLSD::emptyMap(); - find_info["subjectKeyIdentifier"] = "bb:59:9f:de:6b:51:a7:6c:b3:6d:5b:8b:42:f7:b1:65:77:17:a4:e4"; + find_info["subjectKeyIdentifier"] = "7b:1a:f9:2b:c4:b2:f6:ae:d6:f2:8e:b1:73:fb:dd:11:ca:db:f8:87"; LLBasicCertificateVector::iterator found_cert = test_vector->find(find_info); ensure("found some cert", found_cert != test_vector->end()); X509* found_x509 = (*found_cert).get()->getOpenSSLX509(); @@ -1225,7 +1245,7 @@ namespace tut X509_STORE_CTX_set0_untrusted(test_store, NULL); test_chain = new LLBasicCertificateChain(test_store); X509_STORE_CTX_free(test_store); - ensure_equals("two elements in store", test_chain->size(), 1); + ensure_equals("two elements in store [1]", test_chain->size(), 1); X509* test_cert = (*test_chain)[0]->getOpenSSLX509(); ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert)); X509_free(test_cert); @@ -1238,7 +1258,7 @@ namespace tut sk_X509_push(X509_STORE_CTX_get0_untrusted(test_store), mX509IntermediateCert); test_chain = new LLBasicCertificateChain(test_store); X509_STORE_CTX_free(test_store); - ensure_equals("two elements in store", test_chain->size(), 2); + ensure_equals("two elements in store [2]", test_chain->size(), 2); test_cert = (*test_chain)[0]->getOpenSSLX509(); ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert)); X509_free(test_cert); @@ -1254,7 +1274,7 @@ namespace tut sk_X509_push(X509_STORE_CTX_get0_untrusted(test_store), mX509TestCert); test_chain = new LLBasicCertificateChain(test_store); X509_STORE_CTX_free(test_store); - ensure_equals("two elements in store", test_chain->size(), 1); + ensure_equals("two elements in store [3]", test_chain->size(), 1); test_cert = (*test_chain)[0]->getOpenSSLX509(); ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert)); X509_free(test_cert); @@ -1267,7 +1287,7 @@ namespace tut sk_X509_push(X509_STORE_CTX_get0_untrusted(test_store), mX509TestCert); test_chain = new LLBasicCertificateChain(test_store); X509_STORE_CTX_free(test_store); - ensure_equals("two elements in store", test_chain->size(), 2); + ensure_equals("two elements in store [4]", test_chain->size(), 2); test_cert = (*test_chain)[0]->getOpenSSLX509(); ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert)); X509_free(test_cert); diff --git a/indra/newview/tests/llslurl_test.cpp b/indra/newview/tests/llslurl_test.cpp index 92ba68a073..3be44a9bd5 100644 --- a/indra/newview/tests/llslurl_test.cpp +++ b/indra/newview/tests/llslurl_test.cpp @@ -64,14 +64,14 @@ LLControlVariable* LLControlGroup::declareString(const std::string& name, const std::string& initial_val, const std::string& comment, LLControlVariable::ePersist persist) {return NULL;} -void LLControlGroup::setString(const std::string& name, const std::string& val){} +void LLControlGroup::setString(std::string_view name, const std::string& val){} std::string gCmdLineLoginURI; std::string gCmdLineGridChoice; std::string gCmdLineHelperURI; std::string gLoginPage; std::string gCurrentGrid; -std::string LLControlGroup::getString(const std::string& name) +std::string LLControlGroup::getString(std::string_view name) { if (name == "CmdLineGridChoice") return gCmdLineGridChoice; @@ -84,7 +84,7 @@ std::string LLControlGroup::getString(const std::string& name) return ""; } -LLSD LLControlGroup::getLLSD(const std::string& name) +LLSD LLControlGroup::getLLSD(std::string_view name) { if (name == "CmdLineLoginURI") { @@ -96,9 +96,9 @@ LLSD LLControlGroup::getLLSD(const std::string& name) return LLSD(); } -LLPointer<LLControlVariable> LLControlGroup::getControl(const std::string& name) +LLPointer<LLControlVariable> LLControlGroup::getControl(std::string_view name) { - ctrl_name_table_t::iterator iter = mNameTable.find(name); + ctrl_name_table_t::iterator iter = mNameTable.find(name.data()); return iter == mNameTable.end() ? LLPointer<LLControlVariable>() : iter->second; } diff --git a/indra/newview/tests/llviewerassetstats_test.cpp b/indra/newview/tests/llviewerassetstats_test.cpp index 278de5f31c..d5e281bba8 100644 --- a/indra/newview/tests/llviewerassetstats_test.cpp +++ b/indra/newview/tests/llviewerassetstats_test.cpp @@ -43,7 +43,7 @@ namespace LLStatViewer LLTrace::SampleStatHandle<> FPS_SAMPLE("fpssample"); } -void LLVOAvatar::getNearbyRezzedStats(std::vector<S32>& counts) +void LLVOAvatar::getNearbyRezzedStats(std::vector<S32>& counts, F32& avg_cloud_time, S32& cloud_avatars) { counts.resize(3); counts[0] = 0; diff --git a/indra/newview/tests/llviewercontrollistener_test.cpp b/indra/newview/tests/llviewercontrollistener_test.cpp index a5eeae8e5b..f261a04544 100644 --- a/indra/newview/tests/llviewercontrollistener_test.cpp +++ b/indra/newview/tests/llviewercontrollistener_test.cpp @@ -40,7 +40,7 @@ namespace tut { Global.declareString("strvar", "woof", "string variable"); // together we will stroll the boolvar, ma cherie - Global.declareBOOL("boolvar", TRUE, "bool variable"); + Global.declareBOOL("boolvar", true, "bool variable"); } }; typedef test_group<llviewercontrollistener_data> llviewercontrollistener_group; @@ -167,7 +167,7 @@ namespace tut "boolvar", llsd::map("name", "boolvar", "type", "Boolean", - "value", TRUE, + "value", true, "comment", "bool variable"))); } } // namespace tut diff --git a/indra/newview/tests/llviewerhelputil_test.cpp b/indra/newview/tests/llviewerhelputil_test.cpp index 7890e9330c..9ee6625bf1 100644 --- a/indra/newview/tests/llviewerhelputil_test.cpp +++ b/indra/newview/tests/llviewerhelputil_test.cpp @@ -53,8 +53,8 @@ LLControlVariable* LLControlGroup::declareString(const std::string& name, const std::string& initial_val, const std::string& comment, LLControlVariable::ePersist persist) {return NULL;} -void LLControlGroup::setString(const std::string& name, const std::string& val){} -std::string LLControlGroup::getString(const std::string& name) +void LLControlGroup::setString(std::string_view name, const std::string& val){} +std::string LLControlGroup::getString(std::string_view name) { if (name == "HelpURLFormat") return gHelpURL; @@ -75,7 +75,7 @@ static void substitute_string(std::string &input, const std::string &search, con #include "../llagent.h" LLAgent::LLAgent() : mAgentAccess(NULL) { } LLAgent::~LLAgent() { } -bool LLAgent::isGodlike() const { return FALSE; } +bool LLAgent::isGodlike() const { return false; } LLAgent gAgent; diff --git a/indra/newview/tests/llviewernetwork_test.cpp b/indra/newview/tests/llviewernetwork_test.cpp index cd5e20f6dd..40c2059d27 100644 --- a/indra/newview/tests/llviewernetwork_test.cpp +++ b/indra/newview/tests/llviewernetwork_test.cpp @@ -73,14 +73,14 @@ LLControlVariable* LLControlGroup::declareString(const std::string& name, const std::string& initial_val, const std::string& comment, LLControlVariable::ePersist persist) {return NULL;} -void LLControlGroup::setString(const std::string& name, const std::string& val){} +void LLControlGroup::setString(std::string_view name, const std::string& val){} std::string gCmdLineLoginURI; std::string gCmdLineGridChoice; std::string gCmdLineHelperURI; std::string gLoginPage; std::string gCurrentGrid; -std::string LLControlGroup::getString(const std::string& name) +std::string LLControlGroup::getString(std::string_view name) { if (name == "CmdLineGridChoice") return gCmdLineGridChoice; @@ -93,7 +93,7 @@ std::string LLControlGroup::getString(const std::string& name) return ""; } -LLSD LLControlGroup::getLLSD(const std::string& name) +LLSD LLControlGroup::getLLSD(std::string_view name) { if (name == "CmdLineLoginURI") { @@ -105,9 +105,9 @@ LLSD LLControlGroup::getLLSD(const std::string& name) return LLSD(); } -LLPointer<LLControlVariable> LLControlGroup::getControl(const std::string& name) +LLPointer<LLControlVariable> LLControlGroup::getControl(std::string_view name) { - ctrl_name_table_t::iterator iter = mNameTable.find(name); + ctrl_name_table_t::iterator iter = mNameTable.find(name.data()); return iter == mNameTable.end() ? LLPointer<LLControlVariable>() : iter->second; } diff --git a/indra/newview/tests/llworldmap_test.cpp b/indra/newview/tests/llworldmap_test.cpp index 03ab9de96c..8564dbeeb6 100644 --- a/indra/newview/tests/llworldmap_test.cpp +++ b/indra/newview/tests/llworldmap_test.cpp @@ -49,7 +49,7 @@ // Stub image calls void LLGLTexture::setBoostLevel(S32 ) { } void LLGLTexture::setAddressMode(LLTexUnit::eTextureAddressMode ) { } -LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture(const LLUUID&, FTType, BOOL, LLGLTexture::EBoostLevel, S8, +LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture(const LLUUID&, FTType, bool, LLGLTexture::EBoostLevel, S8, LLGLint, LLGLenum, LLHost ) { return NULL; } // Stub related map calls diff --git a/indra/newview/tests/llworldmipmap_test.cpp b/indra/newview/tests/llworldmipmap_test.cpp index dcbee79536..0a5de18e0f 100644 --- a/indra/newview/tests/llworldmipmap_test.cpp +++ b/indra/newview/tests/llworldmipmap_test.cpp @@ -43,12 +43,12 @@ // * A simulator for a class can be implemented here. Please comment and document thoroughly. void LLGLTexture::setBoostLevel(S32 ) { } -LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const std::string&, FTType, BOOL, LLGLTexture::EBoostLevel, S8, +LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const std::string&, FTType, bool, LLGLTexture::EBoostLevel, S8, LLGLint, LLGLenum, const LLUUID& ) { return NULL; } LLControlGroup::LLControlGroup(const std::string& name) : LLInstanceTracker<LLControlGroup, std::string>(name) { } LLControlGroup::~LLControlGroup() { } -std::string LLControlGroup::getString(const std::string& ) { return std::string("test_url"); } +std::string LLControlGroup::getString(std::string_view) { return std::string("test_url"); } LLControlGroup gSavedSettings("test_settings"); // End Stubbing diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index f69d690cea..4888b70f0a 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -555,13 +555,6 @@ class Windows_x86_64_Manifest(ViewerManifest): ): self.path(libfile) - # Get fmodstudio dll if needed - if self.args['fmodstudio'] == 'ON': - if(self.args['buildtype'].lower() == 'debug'): - self.path("fmodL.dll") - else: - self.path("fmod.dll") - if self.args['openal'] == 'ON': # Get openal dll self.path("OpenAL32.dll") @@ -1041,18 +1034,13 @@ class Darwin_x86_64_Manifest(ViewerManifest): ): self.path2basename(relpkgdir, libfile) - # Fmod studio dylibs (vary based on configuration) - if self.args['fmodstudio'] == 'ON': - if self.args['buildtype'].lower() == 'debug': - for libfile in ( - "libfmodL.dylib", - ): - dylibs += path_optional(os.path.join(debpkgdir, libfile), libfile) - else: - for libfile in ( - "libfmod.dylib", - ): - dylibs += path_optional(os.path.join(relpkgdir, libfile), libfile) + # OpenAL dylibs + if self.args['openal'] == 'ON': + for libfile in ( + "libopenal.dylib", + "libalut.dylib", + ): + dylibs += path_optional(os.path.join(relpkgdir, libfile), libfile) # our apps executable_path = {} @@ -1820,15 +1808,34 @@ class Linux_x86_64_Manifest(LinuxManifest): self.path_optional("libalut.so*") self.path_optional("libopenal.so*") self.path_optional("libopenal.so", "libvivoxoal.so.1") # vivox's sdk expects this soname - if self.args['fmodstudio'] == 'ON': - try: - self.path("libfmod.so.11.7") - self.path("libfmod.so.11") - self.path("libfmod.so") - pass - except: - print("Skipping libfmod.so - not found") - pass + # KLUDGE: As of 2012-04-11, the 'fontconfig' package installs + # libfontconfig.so.1.4.4, along with symlinks libfontconfig.so.1 + # and libfontconfig.so. Before we added support for library-file + # wildcards, though, this self.path() call specifically named + # libfontconfig.so.1.4.4 WITHOUT also copying the symlinks. When I + # (nat) changed the call to self.path("libfontconfig.so.*"), we + # ended up with the libfontconfig.so.1 symlink in the target + # directory as well. But guess what! At least on Ubuntu 10.04, + # certain viewer fonts look terrible with libfontconfig.so.1 + # present in the target directory. Removing that symlink suffices + # to improve them. I suspect that means we actually do better when + # the viewer fails to find our packaged libfontconfig.so*, falling + # back on the system one instead -- but diagnosing and fixing that + # is a bit out of scope for the present project. Meanwhile, this + # particular wildcard specification gets us exactly what the + # previous call did, without having to explicitly state the + # version number. + self.path("libfontconfig.so.*.*") + + # Include libfreetype.so. but have it work as libfontconfig does. + self.path("libfreetype.so.*.*") + + try: + self.path("libtcmalloc.so*") #formerly called google perf tools + pass + except: + print("tcmalloc files not found, skipping") + pass # Vivox runtimes with self.prefix(src=relpkgdir, dst="bin"): @@ -1848,11 +1855,9 @@ if __name__ == "__main__": print(('%s \\\n%s' % (sys.executable, ' '.join((("'%s'" % arg) if ' ' in arg else arg) for arg in sys.argv)))) - # fmodstudio and openal can be used simultaneously and controled by environment extra_arguments = [ dict(name='bugsplat', description="""BugSplat database to which to post crashes, if BugSplat crash reporting is desired""", default=''), - dict(name='fmodstudio', description="""Indication if fmod studio libraries are needed""", default='OFF'), dict(name='openal', description="""Indication openal libraries are needed""", default='OFF'), ] try: diff --git a/indra/test/io.cpp b/indra/test/io.cpp index 412f9ca1d2..3bb549a98a 100644 --- a/indra/test/io.cpp +++ b/indra/test/io.cpp @@ -155,7 +155,7 @@ namespace tut void buffer_object::test<1>() { const char HELLO_WORLD[] = "hello world"; - const S32 str_len = strlen(HELLO_WORLD); + const S32 str_len = static_cast<S32>(strlen(HELLO_WORLD)); LLChannelDescriptors ch = mBuffer.nextChannel(); mBuffer.append(ch.in(), (U8*)HELLO_WORLD, str_len); S32 count = mBuffer.countAfter(ch.in(), NULL); @@ -170,7 +170,7 @@ namespace tut void buffer_object::test<2>() { const char HELLO_WORLD[] = "hello world"; - const S32 str_len = strlen(HELLO_WORLD); /* Flawfinder: ignore */ + const S32 str_len = static_cast<S32>(strlen(HELLO_WORLD)); /* Flawfinder: ignore */ LLChannelDescriptors ch = mBuffer.nextChannel(); mBuffer.append(ch.in(), (U8*)HELLO_WORLD, str_len); mBuffer.append(ch.in(), (U8*)HELLO_WORLD, str_len); @@ -249,15 +249,15 @@ namespace tut expected << "ContentLength: " << response.length() << "\r\n\r\n" << response; LLChannelDescriptors ch = mBuffer.nextChannel(); - mBuffer.append(ch.in(), (U8*)request.c_str(), request.length()); - mBuffer.append(ch.out(), (U8*)response.c_str(), response.length()); + mBuffer.append(ch.in(), (U8*)request.c_str(), static_cast<S32>(request.length())); + mBuffer.append(ch.out(), (U8*)response.c_str(), static_cast<S32>(response.length())); S32 count = mBuffer.countAfter(ch.out(), NULL); std::ostringstream header; header << "ContentLength: " << count << "\r\n\r\n"; std::string head(header.str()); - mBuffer.prepend(ch.out(), (U8*)head.c_str(), head.length()); + mBuffer.prepend(ch.out(), (U8*)head.c_str(), static_cast<S32>(head.length())); char buffer[1024]; /* Flawfinder: ignore */ - S32 len = response.size() + head.length(); + S32 len = static_cast<S32>(response.size() + head.length()); ensure_equals("same length", len, (S32)expected.str().length()); mBuffer.readAfter(ch.out(), NULL, (U8*)buffer, len); buffer[len] = '\0'; @@ -282,7 +282,7 @@ namespace tut text.append(lines[i]); } LLChannelDescriptors ch = mBuffer.nextChannel(); - mBuffer.append(ch.in(), (U8*)text.c_str(), text.length()); + mBuffer.append(ch.in(), (U8*)text.c_str(), static_cast<S32>(text.length())); const S32 BUFFER_LEN = 1024; char buf[BUFFER_LEN]; S32 len; @@ -411,7 +411,7 @@ namespace tut void bas_object::test<1>() { const char HELLO_WORLD[] = "hello world"; - const S32 str_len = strlen(HELLO_WORLD); /* Flawfinder: ignore */ + const S32 str_len = static_cast<S32>(strlen(HELLO_WORLD)); /* Flawfinder: ignore */ LLChannelDescriptors ch = mBuffer.nextChannel(); LLBufferStream str(ch, &mBuffer); mBuffer.append(ch.in(), (U8*)HELLO_WORLD, str_len); @@ -431,10 +431,10 @@ namespace tut std::string ignore("ignore me"); LLChannelDescriptors ch = mBuffer.nextChannel(); LLBufferStream str(ch, &mBuffer); - mBuffer.append(ch.in(), (U8*)part1.c_str(), part1.length()); - mBuffer.append(ch.in(), (U8*)part2.c_str(), part2.length()); - mBuffer.append(ch.out(), (U8*)ignore.c_str(), ignore.length()); - mBuffer.append(ch.in(), (U8*)part3.c_str(), part3.length()); + mBuffer.append(ch.in(), (U8*)part1.c_str(), static_cast<S32>(part1.length())); + mBuffer.append(ch.in(), (U8*)part2.c_str(), static_cast<S32>(part2.length())); + mBuffer.append(ch.out(), (U8*)ignore.c_str(), static_cast<S32>(ignore.length())); + mBuffer.append(ch.in(), (U8*)part3.c_str(), static_cast<S32>(part3.length())); std::string eat; std::string my; std::string shorts; @@ -452,8 +452,8 @@ namespace tut std::string part1("junk in "); std::string part2("the trunk"); const S32 CHANNEL = 0; - mBuffer.append(CHANNEL, (U8*)part1.c_str(), part1.length()); - mBuffer.append(CHANNEL, (U8*)part2.c_str(), part2.length()); + mBuffer.append(CHANNEL, (U8*)part1.c_str(), static_cast<S32>(part1.length())); + mBuffer.append(CHANNEL, (U8*)part2.c_str(), static_cast<S32>(part2.length())); U8* last = 0; const S32 BUF_LEN = 128; char buf[BUF_LEN]; @@ -475,7 +475,7 @@ namespace tut { std::string phrase("zippity do da!"); const S32 CHANNEL = 0; - mBuffer.append(CHANNEL, (U8*)phrase.c_str(), phrase.length()); + mBuffer.append(CHANNEL, (U8*)phrase.c_str(), static_cast<S32>(phrase.length())); const S32 BUF_LEN = 128; char buf[BUF_LEN]; S32 len = 7; @@ -506,7 +506,7 @@ namespace tut const S32 BUF_LEN = 128; char buf[BUF_LEN]; S32 actual_len = BUF_LEN; - S32 expected_len = h1.size() + h2.size(); + S32 expected_len = static_cast<S32>(h1.size() + h2.size()); (void) mBuffer.readAfter(ch.out(), NULL, (U8*)buf, actual_len); ensure_equals("streamed size", actual_len, expected_len); buf[actual_len] = '\0'; @@ -728,7 +728,7 @@ namespace tut "'circuit_code': i124,'group_id': '8615c885-9cf0-bf0a-6e40-0c11462aa652','limited_to_estate': i1,'look_at': [ i0, i0, i0]," "'agent_id': '0e346d8b-4433-4d66-a6b0-fd37083abc4c','first_name': 'Kelly','start': 'url'}]}"; LLChannelDescriptors ch = mBuffer.nextChannel(); - mBuffer.append(ch.out(), (U8*)LOGIN_STREAM, strlen(LOGIN_STREAM)); /* Flawfinder: ignore */ + mBuffer.append(ch.out(), (U8*)LOGIN_STREAM, static_cast<S32>(strlen(LOGIN_STREAM))); /* Flawfinder: ignore */ ch = mBuffer.nextChannel(); LLBufferStream istr(ch, &mBuffer); LLSD data; @@ -1130,7 +1130,7 @@ namespace tut mPump->addChain(chain, NEVER_CHAIN_EXPIRY_SECS); // We need to tickle the pump a little to set up the listen() pump_loop(mPump, 0.1f); - U32 count = mPump->runningChains(); + auto count = mPump->runningChains(); ensure_equals("server chain onboard", count, 1); LL_DEBUGS() << "** Server is up." << LL_ENDL; diff --git a/indra/test/llbuffer_tut.cpp b/indra/test/llbuffer_tut.cpp index a31870241c..330a4f288f 100644 --- a/indra/test/llbuffer_tut.cpp +++ b/indra/test/llbuffer_tut.cpp @@ -62,7 +62,7 @@ namespace tut ensure("LLSegment get functions failed", (0 == segment.getChannel() && NULL == segment.data() && 0 == segment.size())); segment.setChannel(50); ensure_equals("LLSegment setChannel() function failed", segment.getChannel(), 50); - ensure("LLSegment isOnChannel() function failed", (TRUE == segment.isOnChannel(50))); + ensure("LLSegment isOnChannel() function failed", (true == segment.isOnChannel(50))); } template<> template<> @@ -74,7 +74,7 @@ namespace tut LLSegment segment(channel, (U8*)str, len); ensure("LLSegment get functions failed", (30 == segment.getChannel() && len == segment.size() && (U8*)str == segment.data())); ensure_memory_matches("LLSegment::data() failed", segment.data(), segment.size(), (U8*)str, len); - ensure("LLSegment isOnChannel() function failed", (TRUE == segment.isOnChannel(channel))); + ensure("LLSegment isOnChannel() function failed", (true == segment.isOnChannel(channel))); } template<> template<> @@ -91,27 +91,27 @@ namespace tut S32 requestSize; requestSize = 16384-1; - ensure("1. LLHeapBuffer createSegment failed", (TRUE == buf.createSegment(channel, requestSize, segment)) && segment.size() == requestSize); + ensure("1. LLHeapBuffer createSegment failed", (true == buf.createSegment(channel, requestSize, segment)) && segment.size() == requestSize); // second request for remainign 1 byte requestSize = 1; - ensure("2. LLHeapBuffer createSegment failed", (TRUE == buf.createSegment(channel, requestSize, segment)) && segment.size() == requestSize); + ensure("2. LLHeapBuffer createSegment failed", (true == buf.createSegment(channel, requestSize, segment)) && segment.size() == requestSize); // it should fail now. requestSize = 1; - ensure("3. LLHeapBuffer createSegment failed", (FALSE == buf.createSegment(channel, requestSize, segment))); + ensure("3. LLHeapBuffer createSegment failed", (false == buf.createSegment(channel, requestSize, segment))); LLHeapBuffer buf1(bigSize); // requst for more than default size but less than total sizeit should fail now. requestSize = 16384 + 1; - ensure("4. LLHeapBuffer createSegment failed", (TRUE == buf1.createSegment(channel, requestSize, segment)) && segment.size() == requestSize); + ensure("4. LLHeapBuffer createSegment failed", (true == buf1.createSegment(channel, requestSize, segment)) && segment.size() == requestSize); LLHeapBuffer buf2((U8*) str, smallSize); requestSize = smallSize; - ensure("5. LLHeapBuffer createSegment failed", (TRUE == buf2.createSegment(channel, requestSize, segment)) && segment.size() == requestSize && memcmp(segment.data(), (U8*) str, requestSize) == 0); + ensure("5. LLHeapBuffer createSegment failed", (true == buf2.createSegment(channel, requestSize, segment)) && segment.size() == requestSize && memcmp(segment.data(), (U8*) str, requestSize) == 0); requestSize = smallSize+1; - ensure("6. LLHeapBuffer createSegment failed", (FALSE == buf2.createSegment(channel, requestSize, segment))); + ensure("6. LLHeapBuffer createSegment failed", (false == buf2.createSegment(channel, requestSize, segment))); } //makeChannelConsumer() @@ -128,7 +128,7 @@ namespace tut { LLBufferArray bufferArray; const char array[] = "SecondLife"; - S32 len = strlen(array); + S32 len = static_cast<S32>(strlen(array)); LLChannelDescriptors channelDescriptors = bufferArray.nextChannel(); bufferArray.append(channelDescriptors.in(), (U8*)array, len); S32 count = bufferArray.countAfter(channelDescriptors.in(), NULL); @@ -141,9 +141,9 @@ namespace tut { LLBufferArray bufferArray; const char array[] = "SecondLife"; - S32 len = strlen(array); + S32 len = static_cast<S32>(strlen(array)); const char array1[] = "LindenLabs"; - S32 len1 = strlen(array1); + S32 len1 = static_cast<S32>(strlen(array1)); std::string str(array1); str.append(array); @@ -166,9 +166,9 @@ namespace tut { LLBufferArray bufferArray; const char array[] = "SecondLife"; - S32 len = strlen(array); + S32 len = static_cast<S32>(strlen(array)); const char array1[] = "LindenLabs"; - S32 len1 = strlen(array1); + S32 len1 = static_cast<S32>(strlen(array1)); std::string str(array); str.append(array1); @@ -190,7 +190,7 @@ namespace tut { LLBufferArray bufferArray; const char array[] = "SecondLife"; - S32 len = strlen(array) + 1; + S32 len = static_cast<S32>(strlen(array)) + 1; std::string str(array); LLChannelDescriptors channelDescriptors = bufferArray.nextChannel(); bufferArray.append(channelDescriptors.in(), (U8*)array, len); @@ -208,7 +208,7 @@ namespace tut void buffer_object_t::test<10>() { const char array[] = "SecondLife is a Virtual World"; - S32 len = strlen(array); + S32 len = static_cast<S32>(strlen(array)); LLBufferArray bufferArray; bufferArray.append(0, (U8*)array, len); @@ -229,7 +229,7 @@ namespace tut void buffer_object_t::test<11>() { const char array[] = "SecondLife is a Virtual World"; - S32 len = strlen(array); + S32 len = static_cast<S32>(strlen(array)); LLBufferArray bufferArray; bufferArray.append(0, (U8*)array, len); diff --git a/indra/test/llpermissions_tut.cpp b/indra/test/llpermissions_tut.cpp index ebee89f9fa..1328939004 100644 --- a/indra/test/llpermissions_tut.cpp +++ b/indra/test/llpermissions_tut.cpp @@ -199,7 +199,7 @@ namespace tut { LLPermissions perm1; LLUUID uuid; - BOOL is_group_owned = FALSE; + bool is_group_owned = false; ensure("1:getOwnership:failed ", ! perm1.getOwnership(uuid,is_group_owned)); LLPermissions perm; @@ -262,7 +262,7 @@ namespace tut { LLPermissions perm; LLUUID agent; - BOOL set = 1; + bool set = true; U32 bits = PERM_TRANSFER | PERM_MODIFY; ensure("setBaseBits():failed ", perm.setBaseBits(agent, set, bits)); ensure("setOwnerBits():failed ", perm.setOwnerBits(agent, set, bits)); @@ -278,7 +278,7 @@ namespace tut LLPermissions perm; LLUUID agent; LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8"); - BOOL set = 1; + bool set = true; U32 bits = 10; ensure("setGroupBits():failed ", perm.setGroupBits(agent,group, set, bits)); ensure("setEveryoneBits():failed ", perm.setEveryoneBits(agent,group, set, bits)); diff --git a/indra/test/llpipeutil.cpp b/indra/test/llpipeutil.cpp index c64cf21326..1dd4bdfa3c 100644 --- a/indra/test/llpipeutil.cpp +++ b/indra/test/llpipeutil.cpp @@ -60,7 +60,7 @@ LLIOPipe::EStatus LLPipeStringInjector::process_impl( LLSD& context, LLPumpIO* pump) { - buffer->append(channels.out(), (U8*) mString.data(), mString.size()); + buffer->append(channels.out(), (U8*) mString.data(), static_cast<S32>(mString.size())); eos = true; return STATUS_DONE; } diff --git a/indra/test/llsaleinfo_tut.cpp b/indra/test/llsaleinfo_tut.cpp index 1a4ead00b6..1da7101aa3 100644 --- a/indra/test/llsaleinfo_tut.cpp +++ b/indra/test/llsaleinfo_tut.cpp @@ -54,7 +54,7 @@ namespace tut LLSaleInfo saleinfo1 = ll_sale_info_from_sd(llsd_obj1); ensure("1. The getSaleType() fn failed", LLSaleInfo::FS_COPY == llsaleinfo.getSaleType()); - ensure("2. LLSaleInfo::isForSale() fn failed", TRUE == llsaleinfo.isForSale()); + ensure("2. LLSaleInfo::isForSale() fn failed", true == llsaleinfo.isForSale()); ensure("3. The getSalePrice() fn failed", sale_price == llsaleinfo.getSalePrice()); ensure("4. The getCRC32() fn failed", 235833404 == llsaleinfo.getCRC32()); ensure("5. LLSaleInfo::lookup(const char* name) fn failed", LLSaleInfo::FS_COPY == llsaleinfo.lookup(sale)); @@ -68,7 +68,7 @@ namespace tut saleinfo1 = ll_sale_info_from_sd(llsd_obj1); ensure("8. The getSaleType() and setSaleType() fn failed", LLSaleInfo::FS_ORIGINAL == llsaleinfo.getSaleType()); - ensure("9. LLSaleInfo::isForSale() fn failed", TRUE == llsaleinfo.isForSale()); + ensure("9. LLSaleInfo::isForSale() fn failed", true == llsaleinfo.isForSale()); ensure("10. The getSalePrice() fn failed", 10000000 == llsaleinfo.getSalePrice()); ensure("11. The getCRC32() fn failed", 127911702 == llsaleinfo.getCRC32()); ensure("12. LLSaleInfo::lookup(const char* name) fn failed", LLSaleInfo::FS_CONTENTS == llsaleinfo.lookup(sale)); @@ -82,7 +82,7 @@ namespace tut saleinfo1 = ll_sale_info_from_sd(llsd_obj1); ensure("15. The getSaleType() and setSaleType() fn failed", LLSaleInfo::FS_CONTENTS == llsaleinfo.getSaleType()); - ensure("16. LLSaleInfo::isForSale() fn failed", TRUE == llsaleinfo.isForSale()); + ensure("16. LLSaleInfo::isForSale() fn failed", true == llsaleinfo.isForSale()); ensure("17. The getSalePrice() fn failed", 55000550 == llsaleinfo.getSalePrice()); ensure("18. The getCRC32() fn failed", 408735656 == llsaleinfo.getCRC32()); ensure("19. LLSaleInfo::lookup(const char* name) fn failed", LLSaleInfo::FS_ORIGINAL == llsaleinfo.lookup(sale)); @@ -96,7 +96,7 @@ namespace tut saleinfo1 = ll_sale_info_from_sd(llsd_obj1); ensure("22. The getSaleType() and setSaleType() fn failed", LLSaleInfo::FS_NOT == llsaleinfo.getSaleType()); - ensure("23. LLSaleInfo::isForSale() fn failed", FALSE == llsaleinfo.isForSale()); + ensure("23. LLSaleInfo::isForSale() fn failed", false == llsaleinfo.isForSale()); ensure("24. The getSalePrice() fn failed", 0 == llsaleinfo.getSalePrice()); ensure("25. The getCRC32() fn failed", 0 == llsaleinfo.getCRC32()); ensure("26. LLSaleInfo::lookup(const char* name) fn failed", LLSaleInfo::FS_NOT == llsaleinfo.lookup(sale)); @@ -116,7 +116,7 @@ namespace tut std::istringstream istream(ostream.str()); LLSaleInfo llsaleinfo1; U32 perm_mask = 0; - BOOL has_perm_mask = FALSE; + bool has_perm_mask = false; llsaleinfo1.importLegacyStream(istream, has_perm_mask, perm_mask); ensure("importStream() fn failed ", @@ -133,7 +133,7 @@ namespace tut LLSD sd_result = saleinfo.asLLSD(); U32 perm_mask = 0 ; - BOOL has_perm_mask = FALSE; + bool has_perm_mask = false; LLSaleInfo saleinfo1; saleinfo1.fromLLSD( sd_result, has_perm_mask, perm_mask); diff --git a/indra/test/llsdmessagebuilder_tut.cpp b/indra/test/llsdmessagebuilder_tut.cpp index d85d460198..6804c3e29e 100644 --- a/indra/test/llsdmessagebuilder_tut.cpp +++ b/indra/test/llsdmessagebuilder_tut.cpp @@ -126,14 +126,14 @@ namespace tut template<> template<> void LLSDMessageBuilderTestObject::test<2>() - // BOOL + // bool { - BOOL outValue, inValue = TRUE; + bool outValue, inValue = true; LLSDMessageBuilder builder = defaultBuilder(); builder.addBOOL("var", inValue); LLSDMessageReader reader = setReader(builder); reader.getBOOL("block", "var", outValue); - ensure_equals("Ensure BOOL", inValue, outValue); + ensure_equals("Ensure bool", inValue, outValue); } template<> template<> @@ -688,13 +688,13 @@ namespace tut template<> template<> void LLSDMessageBuilderTestObject::test<39>() { - BOOL valueTrue = true; - BOOL valueFalse = false; + bool valueTrue = true; + bool valueFalse = false; LLMsgData* md = new LLMsgData("testMessage"); LLMsgBlkData* mbd = new LLMsgBlkData("testBlock", 0); - addValue(mbd, (char *)"testBoolFalse", &valueFalse, MVT_BOOL, sizeof(BOOL)); - addValue(mbd, (char *)"testBoolTrue", &valueTrue, MVT_BOOL, sizeof(BOOL)); + addValue(mbd, (char *)"testBoolFalse", &valueFalse, MVT_BOOL, sizeof(bool)); + addValue(mbd, (char *)"testBoolTrue", &valueTrue, MVT_BOOL, sizeof(bool)); md->addBlock(mbd); LLSDMessageBuilder builder = defaultBuilder(); diff --git a/indra/test/llsdmessagereader_tut.cpp b/indra/test/llsdmessagereader_tut.cpp index 1d39fed0cb..dd6520ea33 100644 --- a/indra/test/llsdmessagereader_tut.cpp +++ b/indra/test/llsdmessagereader_tut.cpp @@ -73,11 +73,11 @@ namespace tut const std::string& block, const std::string& var, S32 blocknum, - BOOL expected) + bool expected) { LLSDMessageReader msg; msg.setMessage("fakename", msg_data); - BOOL test_data; + bool test_data; msg.getBOOL(block.c_str(), var.c_str(), test_data, blocknum); ensure_equals( "Ensure bool field", test_data, expected); } @@ -118,8 +118,8 @@ namespace tut { LLSD message = LLSD::emptyMap(); message["block1"] = LLSD::emptyArray(); - BOOL bool_true = TRUE; - BOOL bool_false = FALSE; + bool bool_true = true; + bool bool_false = false; message["block1"][0] = LLSD::emptyMap(); message["block1"][0]["BoolField1"] = bool_true; message["block1"][1] = LLSD::emptyMap(); @@ -127,9 +127,9 @@ namespace tut message["block1"][1]["BoolField2"] = bool_true; ensureMessageName("name3", message, "name3"); - ensureBool(message, "block1", "BoolField1", 0, TRUE); - ensureBool(message, "block1", "BoolField1", 1, FALSE); - ensureBool(message, "block1", "BoolField2", 1, TRUE); + ensureBool(message, "block1", "BoolField1", 0, true); + ensureBool(message, "block1", "BoolField1", 1, false); + ensureBool(message, "block1", "BoolField2", 1, true); ensureNumberOfBlocks(message, "block1", 2); ensureMessageSize(message, 0); } @@ -318,7 +318,7 @@ namespace tut inValue[1] = 1; LLSDMessageReader msg = testType(inValue); - msg.getBinaryData("block", "var", &(outValue[0]), inValue.size()); + msg.getBinaryData("block", "var", &(outValue[0]), static_cast<S32>(inValue.size())); ensure_equals("Ensure Binary", outValue, inValue); } } diff --git a/indra/test/llstreamtools_tut.cpp b/indra/test/llstreamtools_tut.cpp index 68bd5e0ec9..970afb3b02 100644 --- a/indra/test/llstreamtools_tut.cpp +++ b/indra/test/llstreamtools_tut.cpp @@ -846,7 +846,7 @@ namespace tut char buf[255] = {0}; fullread(is, buf, 255); - ensure_memory_matches("fullread: read with newlines", (void*) buf, str.size()-1, (void*) str.c_str(), str.size()-1); + ensure_memory_matches("fullread: read with newlines", (void*) buf, static_cast<U32>(str.size())-1, (void*) str.c_str(), static_cast<U32>(str.size())-1); is.clear(); is.str(str = "First Line.\nSecond Line\n"); diff --git a/indra/test/lltemplatemessagebuilder_tut.cpp b/indra/test/lltemplatemessagebuilder_tut.cpp index 67bdbb09b3..ddf1c3dbcc 100644 --- a/indra/test/lltemplatemessagebuilder_tut.cpp +++ b/indra/test/lltemplatemessagebuilder_tut.cpp @@ -61,7 +61,7 @@ namespace tut 1, 0, 0, - FALSE, + false, "notasharedsecret", NULL, false, @@ -135,16 +135,16 @@ namespace tut template<> template<> void LLTemplateMessageBuilderTestObject::test<2>() - // BOOL + // bool { LLMessageTemplate messageTemplate = defaultTemplate(); messageTemplate.addBlock(defaultBlock(MVT_BOOL, 1)); - BOOL outValue, inValue = TRUE; + bool outValue, inValue = true; LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); builder->addBOOL(_PREHASH_Test0, inValue); LLTemplateMessageReader* reader = setReader(messageTemplate, builder); reader->getBOOL(_PREHASH_Test0, _PREHASH_Test0, outValue); - ensure_equals("Ensure BOOL", inValue, outValue); + ensure_equals("Ensure bool", inValue, outValue); delete reader; } @@ -591,17 +591,17 @@ namespace tut template<> template<> void LLTemplateMessageBuilderTestObject::test<26>() - // non-zero offset with BOOL + // non-zero offset with bool { LLMessageTemplate messageTemplate = defaultTemplate(); messageTemplate.addBlock(defaultBlock(MVT_BOOL, 1)); - BOOL outValue, inValue = TRUE; + bool outValue, inValue = true; LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); builder->addBOOL(_PREHASH_Test0, inValue); LLTemplateMessageReader* reader = setReader( messageTemplate, builder, 1); reader->getBOOL(_PREHASH_Test0, _PREHASH_Test0, outValue); - ensure_equals("Ensure BOOL", inValue, outValue); + ensure_equals("Ensure bool", inValue, outValue); delete reader; } diff --git a/indra/test/message_tut.cpp b/indra/test/message_tut.cpp index 96308b54af..11cd710ef6 100644 --- a/indra/test/message_tut.cpp +++ b/indra/test/message_tut.cpp @@ -75,7 +75,7 @@ namespace tut 1, 0, 0, - FALSE, + false, "notasharedsecret", NULL, false, |