diff --git a/.hgpatchinfo/.RLVa.dep b/.hgpatchinfo/.RLVa.dep index 90a41514f9..3960ca6cc7 100644 --- a/.hgpatchinfo/.RLVa.dep +++ b/.hgpatchinfo/.RLVa.dep @@ -1,3 +1,2 @@ -66fb72119f033ed886d5712631343f88e1ead934 -1ff5ef68e9f33642e755b7e3840bdae7b7284597 -9ce13e5a6cacb30d5e01bdaf774a48b19823bcd6 \ No newline at end of file +20fb0c21c1d212361e2dce85a55dedd2e74bce5b +ca307c3bf9d3bb7dfb64420a018ae77374c9e5d8 \ No newline at end of file diff --git a/.hgpatchinfo/Appearance-Misc.dep b/.hgpatchinfo/Appearance-Misc.dep index d3d89ec95e..9c6dad306c 100644 --- a/.hgpatchinfo/Appearance-Misc.dep +++ b/.hgpatchinfo/Appearance-Misc.dep @@ -1 +1 @@ -1ff5ef68e9f33642e755b7e3840bdae7b7284597 \ No newline at end of file +7765c3aa3a23513f1e43d63ce4131e37c7d8ddfb \ No newline at end of file diff --git a/.hgpatchinfo/Appearance-Misc.desc b/.hgpatchinfo/Appearance-Misc.desc index 49491dd1f4..3ef1fb03d7 100644 --- a/.hgpatchinfo/Appearance-Misc.desc +++ b/.hgpatchinfo/Appearance-Misc.desc @@ -13,6 +13,9 @@ -> normal-drop : replace wear -> Ctrl-drop : add wear - fixed : LLAppearanceMgr::registerAttachment() fails to (re)add a link for worn attachments that aren't linked to in COF at log-on +- fixed : LLViewerObject::getAttachmentItemID() sometimes returns the NULL UUID for the avatar's own attachments +- fixed : LLAppearanceMgr::updateAppearanceFromCOF() doesn't properly filter items collected from folder links + -> create an outfit with a folder link + "Replace Outfit" == wearables that exist in both COF and the linked folder will end up worn multiple times - changed : deprecated removeItemFromAvatar() in favour of having LLAppearanceMgr::removeItemFromAvatar() handle it directly/correctly -> wearables can't be worn/removed in 2.X without the viewer already having an LLWearable instance for it anyway - changed : enable "Replace Current Outfit" on the base outfit if it's marked dirty diff --git a/.hgpatchinfo/Appearance-MixedViewers.dep b/.hgpatchinfo/Appearance-MixedViewers.dep index d3d89ec95e..9c6dad306c 100644 --- a/.hgpatchinfo/Appearance-MixedViewers.dep +++ b/.hgpatchinfo/Appearance-MixedViewers.dep @@ -1 +1 @@ -1ff5ef68e9f33642e755b7e3840bdae7b7284597 \ No newline at end of file +7765c3aa3a23513f1e43d63ce4131e37c7d8ddfb \ No newline at end of file diff --git a/.hgpatchinfo/RLVa.dep b/.hgpatchinfo/RLVa.dep index c4c0fa6e36..a4fc2f2bee 100644 --- a/.hgpatchinfo/RLVa.dep +++ b/.hgpatchinfo/RLVa.dep @@ -1 +1 @@ -1b5d993cfdc83ef8799518045bfbb8c00ac93579 \ No newline at end of file +9904ec98044702d4e26d11b4a78e1e294b57d2e8 \ No newline at end of file diff --git a/.hgpatchinfo/Viewer-Build.dep b/.hgpatchinfo/Viewer-Build.dep index 34ef8f4686..a9b6578d14 100644 --- a/.hgpatchinfo/Viewer-Build.dep +++ b/.hgpatchinfo/Viewer-Build.dep @@ -1 +1 @@ -78d1d228709c1e2c27a5278603d12c8b1d922bb9 \ No newline at end of file +ddfc2ed6aee12d68f8c6baebfec54f69a965a1d2 \ No newline at end of file diff --git a/.hgpatchinfo/Viewer-Build.desc b/.hgpatchinfo/Viewer-Build.desc index f784e6d741..2c7af81f1d 100644 --- a/.hgpatchinfo/Viewer-Build.desc +++ b/.hgpatchinfo/Viewer-Build.desc @@ -1,7 +1,6 @@ [Viewer/Build] - changed : compiler options for "Release with Debug" builds - changed : compiler and linker options for "Release" builds -- added : imported SNOW-788 - Fix boost lib detection with Visual Studio to allow multiple VS versions - changed : removed LL's changeset tags and added new (consistent) SL-2.X.Y tags for releases - changed : break into the debugger rather than forcing the process into an unrecoverable state for "llerrs" on non-release builds -> Windows only diff --git a/.hgtags b/.hgtags index dc03e0d25f..62faa9897d 100644 --- a/.hgtags +++ b/.hgtags @@ -117,3 +117,20 @@ bb1075286b3b147b1dae2e3d6b2d56f04ff03f35 DRTVWR-52_2.6.6-beta1 bb1075286b3b147b1dae2e3d6b2d56f04ff03f35 2.6.6-beta1 e67da2c6e3125966dd49eef98b36317afac1fcfe 2.6.9-start 07f65b6181edcc2edddd4e084e7aa0e5c67fcb84 FSmerge-2.6.9 +4f777ffb99fefdc6497c61385c22688ff149c659 SL-2.0.0 +668851b2ef0f8cf8df07a0fba429e4a6c1e70abb SL-2.0.1 +b03065d018b8a2e28b7de85b293a4c992cb4c12d SL-2.1.0 +bb38ff1a763738609e1b3cada6d15fa61e5e84b9 SL-2.1.1 +1415e6538d54fd5d568ee88343424d57c6803c2c SL-2.2.0 +6ad3d6fa35a4e320e9ce442fce2bf9c7fc852556 SL-2.3.0 +1ed382c6a08ba3850b6ce9061bc551ddece0ea07 SL-2.4.0 +b723921b5c711bd24dbe77dc76ef488b544dac78 SL-2.5.0 +4dede9ae1ec74d41f6887719f6f1de7340d8578d SL-2.5.1 +b53a0576eec80614d7767ed72b40ed67aeff27c9 SL-2.5.2 +42f32494bac475d0737799346f6831558ae8bf5d SL-2.6.0 +c9182ed77d427c759cfacf49a7b71a2e20d522aa SL-2.6.1 +214180ad5714ce8392b82bbebcc92f4babd98300 SL-2.6.2 +425f96b1e81e01644bf5e951961e7d1023bffb89 RLVa-1.2.0 +fc0cbb86f5bd6e7737159e35aea2c4cf9f619b62 RLVa-1.2.1 +43cb7dc1804de1a25c0b2b3f0715584af1f8b470 RLVa-1.2.2 +89532c8dfd5b6c29f1cb032665b44a74a52452e1 RLVa-1.3.0 diff --git a/README_BUILD_FIRESTORM_LINUX.txt b/README_BUILD_FIRESTORM_LINUX.txt index d6f93e6dc2..38806c5ccd 100755 --- a/README_BUILD_FIRESTORM_LINUX.txt +++ b/README_BUILD_FIRESTORM_LINUX.txt @@ -31,6 +31,7 @@ Other examples: autobuild build -c ReleaseFS --no-configure # default quick rebuild autobuild build -c ReleaseFS --no-configure -- --clean # Clean rebuild + autobuild build -c ReleaseFS -- --package # Complete a build and package it into a tarball for sharing Any of the configure options can also be used (and do the same thing) with the build options. diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 306b7fa4c2..efb749ad64 100755 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -46,10 +46,10 @@ if (WINDOWS) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Od /Zi /MDd /MP -D_SCL_SECURE_NO_WARNINGS=1" CACHE STRING "C++ compiler debug options" FORCE) set(CMAKE_CXX_FLAGS_RELWITHDEBINFO - "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od /Zi /MD /MP /Ob2 -D_SECURE_STL=0" + "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od /Zi /MD /Ob2 /Gm -D_SECURE_STL=0" CACHE STRING "C++ compiler release-with-debug options" FORCE) set(CMAKE_CXX_FLAGS_RELEASE - "${CMAKE_CXX_FLAGS_RELEASE} ${LL_CXX_FLAGS} /O2 /Zi /MD /MP /Ob2 -D_SECURE_STL=0 -D_HAS_ITERATOR_DEBUGGING=0 /arch:SSE2" + "${CMAKE_CXX_FLAGS_RELEASE} ${LL_CXX_FLAGS} /O2 /Zi /MD /MP /Ob2 /Oi /Ot /GF /Gy /arch:SSE2 -D_SECURE_STL=0 -D_HAS_ITERATOR_DEBUGGING=0" CACHE STRING "C++ compiler release options" FORCE) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE /INCREMENTAL") diff --git a/indra/cmake/FMOD.cmake b/indra/cmake/FMOD.cmake old mode 100755 new mode 100644 diff --git a/indra/cmake/run_build_test.py b/indra/cmake/run_build_test.py old mode 100755 new mode 100644 diff --git a/indra/copy_win_scripts/start-client.py b/indra/copy_win_scripts/start-client.py index 5699f5273f..2027ee6106 100644 --- a/indra/copy_win_scripts/start-client.py +++ b/indra/copy_win_scripts/start-client.py @@ -56,7 +56,7 @@ def start_client(grid, slurl, build_config, my_args): f = open("start-client.log", "w") print >>f, "Viewer startup arguments:" llstart.start("viewer", "../../newview", - "%s/newview/%s/secondlife-bin.exe" % (build_path, build_config), + "%s/newview/%s/firestorm-bin.exe" % (build_path, build_config), viewer_args, f) f.close() diff --git a/indra/llcommon/llversionserver.h b/indra/llcommon/llversionserver.h index e9ef6b2e4e..b0a2273240 100644 --- a/indra/llcommon/llversionserver.h +++ b/indra/llcommon/llversionserver.h @@ -29,8 +29,8 @@ const S32 LL_VERSION_MAJOR = 2; const S32 LL_VERSION_MINOR = 6; -const S32 LL_VERSION_PATCH = 9; -const S32 LL_VERSION_BUILD = 18380; +const S32 LL_VERSION_PATCH = 1; +const S32 LL_VERSION_BUILD = 18382; const char * const LL_CHANNEL = "Second Life Server"; diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h index 5fdf7a3224..549b9926ce 100644 --- a/indra/llcommon/llversionviewer.h +++ b/indra/llcommon/llversionviewer.h @@ -29,10 +29,10 @@ const S32 LL_VERSION_MAJOR = 2; const S32 LL_VERSION_MINOR = 6; -const S32 LL_VERSION_PATCH = 9; -const S32 LL_VERSION_BUILD = 18380; +const S32 LL_VERSION_PATCH = 1; +const S32 LL_VERSION_BUILD = 18382; -const char * const LL_CHANNEL = "Firestorm-private-Romana"; +const char * const LL_CHANNEL = "Firestorm-private-ubuntu"; #if LL_DARWIN const char * const LL_VERSION_BUNDLE_ID = "com.phoenixviewer.firestorm.viewer"; diff --git a/indra/llcommon/res/llcommon.rc b/indra/llcommon/res/llcommon.rc index 6a14a9d23a..81cff2c3bb 100644 --- a/indra/llcommon/res/llcommon.rc +++ b/indra/llcommon/res/llcommon.rc @@ -24,8 +24,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,6,9,18380 - PRODUCTVERSION 2,6,9,18380 + FILEVERSION 2,6,1,18382 + PRODUCTVERSION 2,6,1,18382 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -42,12 +42,12 @@ BEGIN BEGIN VALUE "CompanyName", "Phoenix Viewer" VALUE "FileDescription", "Phoenix Firestorm Viewer Common Library" - VALUE "FileVersion", "2.6.9.18380" + VALUE "FileVersion", "2.6.1.18382" VALUE "InternalName", "llcommon.dll" VALUE "LegalCopyright", "Copyright © 2010 Phoenix Viewer" VALUE "OriginalFilename", "llcommon.dll" VALUE "ProductName", "Phoenix Firestorm Viewer" - VALUE "ProductVersion", "2.6.9.18380" + VALUE "ProductVersion", "2.6.1.18382" END END BLOCK "VarFileInfo" diff --git a/indra/llmessage/llavatarnamecache.h b/indra/llmessage/llavatarnamecache.h index 41eb64a066..3846463f1c 100644 --- a/indra/llmessage/llavatarnamecache.h +++ b/indra/llmessage/llavatarnamecache.h @@ -80,7 +80,7 @@ namespace LLAvatarNameCache void setUseDisplayNames(bool use); bool useDisplayNames(); -// [RLVa:KB] - Checked: 2010-12-08 (RLVa-1.2.2c) | Added: RLVa-1.2.2c +// [RLVa:KB] - Checked: 2010-12-08 (RLVa-1.4.0a) | Added: RLVa-1.2.2c bool getForceDisplayNames(); void setForceDisplayNames(bool force); // [/RLVa:KB] diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index eb6a5b2f27..86ff58a3ff 100644 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp @@ -46,7 +46,7 @@ std::set LLFloaterReg::sAlwaysShowableList; static LLFloaterRegListener sFloaterRegListener; -// [RLVa:KB] - Checked: 2010-02-28 (RLVa-1.2.0a) | Modified: RLVa-1.2.0a +// [RLVa:KB] - Checked: 2010-02-28 (RLVa-1.4.0a) | Modified: RLVa-1.2.0a LLFloaterReg::validate_signal_t LLFloaterReg::mValidateSignal; // [/RLVa:KB] @@ -235,7 +235,7 @@ LLFloater* LLFloaterReg::showInstance(const std::string& name, const LLSD& key, // if( sBlockShowFloaters // // see EXT-7090 // && sAlwaysShowableList.find(name) == sAlwaysShowableList.end()) -// [RLVa:KB] - Checked: 2010-02-28 (RLVa-1.2.0a) | Modified: RLVa-1.2.0a +// [RLVa:KB] - Checked: 2010-02-28 (RLVa-1.4.0a) | Modified: RLVa-1.2.0a if ( (sBlockShowFloaters && sAlwaysShowableList.find(name) == sAlwaysShowableList.end()) || (!mValidateSignal(name, key)) ) // [/RLVa:KB] return 0;// diff --git a/indra/llui/llfloaterreg.h b/indra/llui/llfloaterreg.h index 699ed47504..c98b74e342 100644 --- a/indra/llui/llfloaterreg.h +++ b/indra/llui/llfloaterreg.h @@ -75,7 +75,7 @@ private: */ static std::set sAlwaysShowableList; -// [RLVa:KB] - Checked: 2010-02-28 (RLVa-1.2.0a) | Modified: RLVa-1.2.0a +// [RLVa:KB] - Checked: 2010-02-28 (RLVa-1.4.0a) | Modified: RLVa-1.2.0a // Used to determine whether a floater can be shown public: typedef boost::signals2::signal validate_signal_t; diff --git a/indra/newview/Info-SecondLife.plist b/indra/newview/Info-SecondLife.plist index 2c8a6f7b7a..44fdacf3f6 100644 --- a/indra/newview/Info-SecondLife.plist +++ b/indra/newview/Info-SecondLife.plist @@ -60,7 +60,7 @@ CFBundleVersion - 2.6.9.18380 + 2.6.1.18382 CSResourcesFileMapped diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 9eddd1c15e..738682cd98 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -14929,6 +14929,17 @@ Change of this parameter will affect the layout of buttons in notification toast Value 1 + NearbyListShowMap + + Comment + Show/hide map above nearby people list (unused by firestorm) + Persist + 1 + Type + Boolean + Value + 1 + diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 9fc5d00599..069ea91280 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -743,7 +743,10 @@ void LLAgent::setRegion(LLViewerRegion *regionp) LLSelectMgr::getInstance()->updateSelectionCenter(); - LLFloaterMove::sUpdateFlyingStatus(); +// LLFloaterMove::sUpdateFlyingStatus(); +// [RLVa:KB] - Checked: 2011-05-27 (RLVa-1.4.0a) | Added: RLVa-1.4.0a + LLFloaterMove::sUpdateMovementStatus(); +// [/RLVa:KB] } diff --git a/indra/newview/llagentlistener.cpp b/indra/newview/llagentlistener.cpp index a8cca5630d..84c610011a 100644 --- a/indra/newview/llagentlistener.cpp +++ b/indra/newview/llagentlistener.cpp @@ -43,6 +43,10 @@ // [/RLVa:KB] #include "llsdutil.h" #include "llsdutil_math.h" +// [RLVa:KB] - Checked: 2011-05-22 (RLVa-1.3.1a) +#include "rlvhandler.h" +#include "llvoavatarself.h" +// [/RLVa:KB] LLAgentListener::LLAgentListener(LLAgent &agent) : LLEventAPI("LLAgent", diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h index 151394123b..4d406149f0 100644 --- a/indra/newview/llagentwearables.h +++ b/indra/newview/llagentwearables.h @@ -76,7 +76,7 @@ public: BOOL isWearableCopyable(LLWearableType::EType type, U32 index /*= 0*/) const; BOOL areWearablesLoaded() const; -// [SL:KB] - Patch: Appearance-InitialWearablesLoadedCallback | Checked: 2010-08-14 (Catznip-2.5.0a) | Added: Catznip-2.1.1d +// [SL:KB] - Patch: Appearance-InitialWearablesLoadedCallback | Checked: 2010-08-14 (Catznip-2.6.0a) | Added: Catznip-2.1.1d bool areInitalWearablesLoaded() const { return mInitialWearablesLoaded; } // [/SL:KB] bool isCOFChangeInProgress() const { return mCOFChangeInProgress; } @@ -223,7 +223,7 @@ public: typedef std::vector llvo_vec_t; // static void userUpdateAttachments(LLInventoryModel::item_array_t& obj_item_array); -// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-09-22 (Catznip-2.5.0a) | Added: Catznip-2.2.0a +// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-09-22 (Catznip-2.6.0a) | Added: Catznip-2.2.0a // Not the best way to go about this but other attempts changed far too much LL code to be a viable solution static void userUpdateAttachments(LLInventoryModel::item_array_t& obj_item_array, bool fAttachOnly = false); // [/SL:KB] @@ -245,7 +245,7 @@ public: typedef boost::function loaded_callback_t; typedef boost::signals2::signal loaded_signal_t; boost::signals2::connection addLoadedCallback(loaded_callback_t cb); -// [SL:KB] - Patch: Appearance-InitialWearablesLoadedCallback | Checked: 2010-08-14 (Catznip-2.5.0a) | Added: Catznip-2.1.1d +// [SL:KB] - Patch: Appearance-InitialWearablesLoadedCallback | Checked: 2010-08-14 (Catznip-2.6.0a) | Added: Catznip-2.1.1d boost::signals2::connection addInitialWearablesLoadedCallback(loaded_callback_t cb); // [/SL:KB] @@ -255,7 +255,7 @@ public: private: loading_started_signal_t mLoadingStartedSignal; // should be called before wearables are changed loaded_signal_t mLoadedSignal; // emitted when all agent wearables get loaded -// [SL:KB] - Patch: Appearance-InitialWearablesLoadedCallback | Checked: 2010-08-14 (Catznip-2.5.0a) | Added: Catznip-2.1.1d +// [SL:KB] - Patch: Appearance-InitialWearablesLoadedCallback | Checked: 2010-08-14 (Catznip-2.6.0a) | Added: Catznip-2.1.1d loaded_signal_t mInitialWearablesLoadedSignal; // emitted once when the initial wearables are loaded // [/SL:KB] @@ -268,7 +268,7 @@ private: wearableentry_map_t mWearableDatas; static BOOL mInitialWearablesUpdateReceived; -// [SL:KB] - Patch: Appearance-InitialWearablesLoadedCallback | Checked: 2010-08-14 (Catznip-2.5.0a) | Added: Catznip-2.2.0a +// [SL:KB] - Patch: Appearance-InitialWearablesLoadedCallback | Checked: 2010-08-14 (Catznip-2.6.0a) | Added: Catznip-2.2.0a static bool mInitialWearablesLoaded; // [/SL:KB] BOOL mWearablesLoaded; diff --git a/indra/newview/llagentwearablesfetch.cpp b/indra/newview/llagentwearablesfetch.cpp index 5f9465f4b4..113233bc7b 100644 --- a/indra/newview/llagentwearablesfetch.cpp +++ b/indra/newview/llagentwearablesfetch.cpp @@ -128,7 +128,7 @@ void LLInitialWearablesFetch::processContents() gInventory.collectDescendentsIf(mComplete.front(), cat_array, wearable_array, LLInventoryModel::EXCLUDE_TRASH, is_wearable); -// [SL:KB] - Patch: Appearance-MixedViewers | Checked: 2010-05-18 (Catznip-2.5.0a) | Modified: Catznip-2.0.0h +// [SL:KB] - Patch: Appearance-MixedViewers | Checked: 2010-05-18 (Catznip-2.6.0a) | Modified: Catznip-2.0.0h // NOTE: don't use the current COF contents if 'wearable_array' is empty (ie first logon with 2.0 or some other problem) bool fUpdateFromCOF = !wearable_array.empty(); if (fUpdateFromCOF) @@ -142,8 +142,6 @@ void LLInitialWearablesFetch::processContents() (itWearableData != mAgentInitialWearables.end()) && (fUpdateFromCOF); ++itWearableData) { const LLUUID& idItem = itWearableData->mItemID; bool fFound = false; - - // TODO-Catznip: [SL-2.2.0] Bit of a hack until LL supports changing the descriptions of links for (S32 idxItem = 0, cntItem = items_by_type[itWearableData->mType].size(); idxItem < cntItem; idxItem++) { const LLViewerInventoryItem* pCOFItem = items_by_type[itWearableData->mType].get(idxItem); @@ -161,7 +159,7 @@ void LLInitialWearablesFetch::processContents() LLAppearanceMgr::instance().setAttachmentInvLinkEnable(true); // if (wearable_array.count() > 0) -// [SL:KB] - Patch: Appearance-MixedViewers | Checked: 2010-04-28 (Catznip-2.5.0a) | Modified: Catznip-2.0.0e +// [SL:KB] - Patch: Appearance-MixedViewers | Checked: 2010-04-28 (Catznip-2.6.0a) | Modified: Catznip-2.0.0e if (fUpdateFromCOF) // [/SL:KB] { @@ -214,12 +212,12 @@ public: link_waiter); } */ -// [SL:KB] - Patch: Appearance-MixedViewers | Checked: 2010-08-14 (Catznip-2.5.0a) | Added: Catznip-2.1.1d +// [SL:KB] - Patch: Appearance-MixedViewers | Checked: 2010-08-14 (Catznip-2.6.0a) | Added: Catznip-2.1.1d doOnIdleOneTime(boost::bind(&LLFetchAndLinkObserver::doneIdle, this)); // [/SL:KB] } -// [SL:KB] - Patch: Appearance-MixedViewers | Checked: 2010-04-02 (Catznip-2.5.0a) | Added: Catznip-2.0.0a +// [SL:KB] - Patch: Appearance-MixedViewers | Checked: 2010-04-02 (Catznip-2.6.0a) | Added: Catznip-2.0.0a void doneIdle() { // NOTE: the code above makes the assumption that COF is empty which won't be the case the way it's used now @@ -252,7 +250,7 @@ void LLInitialWearablesFetch::processWearablesMessage() { // Populate the current outfit folder with links to the wearables passed in the message // InitialWearableData *wearable_data = new InitialWearableData(mAgentInitialWearables[i]); // This will be deleted in the callback. -// [SL:KB] - Patch: Appearance-MixedViewers | Checked: 2010-05-02 (Catznip-2.5.0a) | Added: Catznip-2.0.0f +// [SL:KB] - Patch: Appearance-MixedViewers | Checked: 2010-05-02 (Catznip-2.6.0a) | Added: Catznip-2.0.0f // Fixes minor leak: since COF is used onInitialWearableAssetArrived() will never get called and "wearable_data" leaks InitialWearableData* wearable_data = &mAgentInitialWearables[i]; // [/SL:KB] diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index e8f09c1996..31ebb33e16 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -2916,12 +2916,12 @@ void LLAppearanceMgr::removeItemFromAvatar(const LLUUID& id_to_remove) // //*TODO move here the exact removing code from LLWearableBridge::removeItemFromAvatar in the future // LLWearableBridge::removeItemFromAvatar(item_to_remove); // } -// [SL:KB] - Patch: Appearance-RemoveretoWearableFromAvatar | Checked: 2010-08-13 (Catznip-2.6.0a) | Added: Catznip-2.1.1d +// [SL:KB] - Patch: Appearance-RemoveWearableFromAvatar | Checked: 2010-08-13 (Catznip-2.6.0a) | Added: Catznip-2.1.1d // [RLVa:KB] - Checked: 2010-09-04 (RLVa-1.2.1c) | Added: RLVa-1.2.1c if ( (!rlv_handler_t::isEnabled()) || (gRlvWearableLocks.canRemove(item_to_remove)) ) // [/RLVa:KB] { - /*const*/ LLWearable* pWearable = gAgentWearables.getWearableFromItemID(item_to_remove->getLinkedUUID()); + const LLWearable* pWearable = gAgentWearables.getWearableFromItemID(item_to_remove->getLinkedUUID()); if ( (pWearable) && (LLAssetType::AT_BODYPART != pWearable->getAssetType()) ) { U32 idxWearable = gAgentWearables.getWearableIndex(pWearable); diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 2c5c3a3c79..b951c06f14 100644 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -51,7 +51,7 @@ public: typedef std::vector wearables_by_type_t; void updateAppearanceFromCOF(bool update_base_outfit_ordering = false); -// [SL:KB] - Patch: Appearance-MixedViewers | Checked: 2010-04-02 (Catznip-2.5.0a) | Added: Catznip-2.0.0a +// [SL:KB] - Patch: Appearance-MixedViewers | Checked: 2010-04-02 (Catznip-2.6.0a) | Added: Catznip-2.0.0a void updateAppearanceFromInitialWearables(LLInventoryModel::item_array_t& initial_items); // [/SL:KB] bool needToSaveCOF(); @@ -238,7 +238,7 @@ private: std::auto_ptr mUnlockOutfitTimer; -// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-09-18 (Catznip-2.5.0a) | Modified: Catznip-2.1.2e +// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-09-18 (Catznip-2.6.0a) | Modified: Catznip-2.1.2e public: void linkPendingAttachments(); void onRegisterAttachmentComplete(const LLUUID& idItem); @@ -272,7 +272,7 @@ private: bool mUpdateBaseOrder; }; -// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-08-31 (Catznip-2.5.0a) | Added: Catznip-2.1.2a +// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-08-31 (Catznip-2.6.0a) | Added: Catznip-2.1.2a class LLRegisterAttachmentCallback : public LLInventoryCallback { public: diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index dcf44cbec7..b1ab4edc3e 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -88,6 +88,7 @@ // [RLVa:KB] - Checked: 2010-05-03 (RLVa-1.2.0g) #include "rlvhandler.h" // [/RLVa:KB] + #include "llweb.h" #include "llsecondlifeurls.h" #include "llupdaterservice.h" diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 0da2de90a0..973149932a 100755 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -1,2270 +1,2270 @@ -/** - * @file llbottomtray.cpp - * @brief LLBottomTray class implementation - * - * $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" // must be first include - -#define LLBOTTOMTRAY_CPP -#include "llbottomtray.h" - -// library includes -#include "llfloaterreg.h" -#include "llflyoutbutton.h" -#include "lllayoutstack.h" -#include "llnotifications.h" -#include "llnotificationsutil.h" -#include "lltexteditor.h" - -// newview includes -#include "llagent.h" -#include "aoengine.h" // ## Zi: Animation Overrider -#include "llagentcamera.h" -#include "llavataractions.h" -#include "llchiclet.h" -#include "llfloatercamera.h" -#include "llhints.h" -#include "llimfloater.h" // for LLIMFloater -#include "llnearbychatbar.h" -#include "llsidetray.h" -#include "llspeakbutton.h" -#include "llsplitbutton.h" -#include "llsyswellwindow.h" -#include "lltoolmgr.h" -#include "llviewerparcelmgr.h" -#include "llsidetray.h" -#include "llviewerwindow.h" -#include "llsdserialize.h" -#include "llfirstuse.h" - -// [RLVa:KB] - Checked: 2010-09-11 (RLVa-1.2.1d) -#include "rlvhandler.h" -#include "rlvui.h" -// [/RLVa:KB] -//-TT Toggle sidebar panels and floaters -#include "llsidetraytab.h" -//-TT - -// Distance from mouse down on which drag'n'drop should be started. -#define DRAG_START_DISTANCE 3 - -static const std::string SORTING_DATA_FILE_NAME = "bottomtray_buttons_order.xml"; - -LLDefaultChildRegistry::Register bottomtray_button("bottomtray_button"); - -// LLBottomtrayButton methods - -// virtual -BOOL LLBottomtrayButton::handleHover(S32 x, S32 y, MASK mask) -{ - if (mCanDrag) - { - // pass hover to bottomtray - S32 screenX, screenY; - localPointToScreen(x, y, &screenX, &screenY); - LLBottomTray::getInstance()->onDraggableButtonHover(screenX, screenY); - - return TRUE; - } - else - { - return LLButton::handleHover(x, y, mask); - } -} -//virtual -BOOL LLBottomtrayButton::handleMouseUp(S32 x, S32 y, MASK mask) -{ - if (mCanDrag) - { - S32 screenX, screenY; - localPointToScreen(x, y, &screenX, &screenY); - // pass mouse up to bottomtray - LLBottomTray::getInstance()->onDraggableButtonMouseUp(this, screenX, screenY); - } - return LLButton::handleMouseUp(x, y, mask); -} -//virtual -BOOL LLBottomtrayButton::handleMouseDown(S32 x, S32 y, MASK mask) -{ - if (mCanDrag) - { - S32 screenX, screenY; - localPointToScreen(x, y, &screenX, &screenY); - // pass mouse up to bottomtray - LLBottomTray::getInstance()->onDraggableButtonMouseDown(this, screenX, screenY); - } - return LLButton::handleMouseDown(x, y, mask); -} - -static void update_build_button_enable_state() -{ -// bool can_edit = LLToolMgr::getInstance()->canEdit(); -// [RLVa:KB] - Checked: 2010-09-11 (RLVa-1.2.1d) | Added: RLVa-1.2.1d - bool can_edit = RlvUIEnabler::isBuildEnabled(); -// [/RLVa:KB] - - LLBottomTray::getInstance()->getChildView("build_btn")->setEnabled(can_edit); -} - -// Build time optimization, generate extern template once in .cpp file -template class LLBottomTray* LLSingleton::getInstance(); - -namespace -{ - const std::string& PANEL_CHICLET_NAME = "chiclet_list_panel"; - - S32 get_panel_min_width(LLLayoutStack* stack, LLView* panel) - { - S32 minimal_width = 0; - llassert(stack); - if ( stack && panel && panel->getVisible() ) - { - stack->getPanelMinSize(panel->getName(), &minimal_width); - } - return minimal_width; - } - - S32 get_panel_max_width(LLLayoutStack* stack, LLPanel* panel) - { - S32 max_width = 0; - llassert(stack); - if ( stack && panel && panel->getVisible() ) - { - stack->getPanelMaxSize(panel->getName(), &max_width); - } - return max_width; - } - - S32 get_curr_width(LLUICtrl* ctrl) - { - S32 cur_width = 0; - if ( ctrl && ctrl->getVisible() ) - { - cur_width = ctrl->getRect().getWidth(); - } - return cur_width; - } -} - -class LLBottomTrayLite - : public LLPanel -{ -public: - LLBottomTrayLite() - : mNearbyChatBar(NULL), - mChatBarContainer(NULL), - mGesturePanel(NULL) - { - mFactoryMap["chat_bar"] = LLCallbackMap(LLBottomTray::createNearbyChatBar, NULL); - buildFromFile("panel_bottomtray_lite.xml"); - } - - BOOL postBuild() - { - mNearbyChatBar = findChild("chat_bar"); - mChatBarContainer = getChild("chat_bar_layout_panel"); - mGesturePanel = getChild("gesture_panel"); - - // Hide "show_nearby_chat" button - if (mNearbyChatBar) - { - LLLineEditor* chat_box = mNearbyChatBar->getChatBox(); - LLUICtrl* show_btn = mNearbyChatBar->getChild("show_nearby_chat"); - S32 delta_width = show_btn->getRect().getWidth(); - show_btn->setVisible(FALSE); - chat_box->reshape(chat_box->getRect().getWidth() + delta_width, chat_box->getRect().getHeight()); - } - return TRUE; - } - - void onFocusLost() - { - if (gAgentCamera.cameraMouselook()) - { - LLBottomTray::getInstance()->setVisible(FALSE); - } - } - - LLNearbyChatBar* mNearbyChatBar; - LLLayoutPanel* mChatBarContainer; - LLPanel* mGesturePanel; -}; - -LLBottomTray::LLBottomTray(const LLSD&) -: mChicletPanel(NULL), - mSpeakPanel(NULL), - mSpeakBtn(NULL), - mNearbyChatBar(NULL), - mChatBarContainer(NULL), - mNearbyCharResizeHandlePanel(NULL), - mToolbarStack(NULL), - mMovementButton(NULL), - mResizeState(RS_NORESIZE), - mBottomTrayContextMenu(NULL), - mCamButton(NULL), - mBottomTrayLite(NULL), - mIsInLiteMode(false), - mDragStarted(false), - mDraggedItem(NULL), - mLandingTab(NULL), - mCheckForDrag(false) -{ - // Firstly add our self to IMSession observers, so we catch session events - // before chiclets do that. - LLIMMgr::getInstance()->addSessionObserver(this); - - mFactoryMap["chat_bar"] = LLCallbackMap(LLBottomTray::createNearbyChatBar, NULL); - - buildFromFile("panel_bottomtray.xml"); - - LLUICtrl::CommitCallbackRegistry::defaultRegistrar().add("CameraPresets.ChangeView", boost::bind(&LLFloaterCamera::onClickCameraItem, _2)); - - //this is to fix a crash that occurs because LLBottomTray is a singleton - //and thus is deleted at the end of the viewers lifetime, but to be cleanly - //destroyed LLBottomTray requires some subsystems that are long gone - //LLUI::getRootView()->addChild(this); - - { - mBottomTrayLite = new LLBottomTrayLite(); - mBottomTrayLite->setFollowsAll(); - mBottomTrayLite->setVisible(FALSE); - } - - mImageDragIndication = LLUI::getUIImage(getString("DragIndicationImageName")); - mDesiredNearbyChatWidth = mNearbyChatBar ? mNearbyChatBar->getRect().getWidth() : 0; -} - -LLBottomTray::~LLBottomTray() -{ - if (!LLSingleton::destroyed()) - { - LLIMMgr::getInstance()->removeSessionObserver(this); - } - - if (mNearbyChatBar) - { - // store custom width of chatbar panel. - S32 custom_width = mChatBarContainer->getRect().getWidth(); - gSavedSettings.setS32("ChatBarCustomWidth", custom_width); - } - - // emulate previous floater behavior to be hidden on startup. - // override effect of save_visibility=true. - // this attribute is necessary to button.initial_callback=Button.SetFloaterToggle works properly: - // i.g when floater changes its visibility - button changes its toggle state. - getChild("build_btn")->setControlValue(false); - getChild("search_btn")->setControlValue(false); - getChild("world_map_btn")->setControlValue(false); -} - -// *TODO Vadim: why void* ? -void* LLBottomTray::createNearbyChatBar(void* userdata) -{ - return new LLNearbyChatBar(); -} - -LLNearbyChatBar* LLBottomTray::getNearbyChatBar() -{ - return mIsInLiteMode ? mBottomTrayLite->mNearbyChatBar : mNearbyChatBar; -} - -LLIMChiclet* LLBottomTray::createIMChiclet(const LLUUID& session_id) -{ - LLIMChiclet::EType im_chiclet_type = LLIMChiclet::getIMSessionType(session_id); - - switch (im_chiclet_type) - { - case LLIMChiclet::TYPE_IM: - return getChicletPanel()->createChiclet(session_id); - case LLIMChiclet::TYPE_GROUP: - return getChicletPanel()->createChiclet(session_id); - case LLIMChiclet::TYPE_AD_HOC: - return getChicletPanel()->createChiclet(session_id); - case LLIMChiclet::TYPE_UNKNOWN: - break; - } - - return NULL; -} - -//virtual -void LLBottomTray::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) -{ - if (!getChicletPanel()) return; - - LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(session_id); - if (!session) return; - - // no need to spawn chiclets for participants in P2P calls called through Avaline - if (session->isP2P() && session->isOtherParticipantAvaline()) return; - - if (getChicletPanel()->findChiclet(session_id)) return; - - LLIMChiclet* chiclet = createIMChiclet(session_id); - if(chiclet) - { - chiclet->setIMSessionName(name); - chiclet->setOtherParticipantId(other_participant_id); - - LLIMFloater::onIMChicletCreated(session_id); - - } - else - { - llerrs << "Could not create chiclet" << llendl; - } -} - -//virtual -void LLBottomTray::sessionRemoved(const LLUUID& session_id) -{ - if(getChicletPanel()) - { - // IM floater should be closed when session removed and associated chiclet closed - LLIMFloater* iMfloater = LLFloaterReg::findTypedInstance( - "impanel", session_id); - if (iMfloater != NULL) - { - iMfloater->closeFloater(); - } - - getChicletPanel()->removeChiclet(session_id); - } -} - -void LLBottomTray::sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id) -{ - //this is only needed in case of outgoing ad-hoc/group chat sessions - LLChicletPanel* chiclet_panel = getChicletPanel(); - if (chiclet_panel) - { - //it should be ad-hoc im chiclet or group im chiclet - LLChiclet* chiclet = chiclet_panel->findChiclet(old_session_id); - if (chiclet) chiclet->setSessionId(new_session_id); - } -} - -S32 LLBottomTray::getTotalUnreadIMCount() -{ - return getChicletPanel()->getTotalUnreadIMCount(); -} - -// virtual -void LLBottomTray::onChange(EStatusType status, const std::string &channelURI, bool proximal) -{ - // Time it takes to connect to voice channel might be pretty long, - // so don't expect user login or STATUS_VOICE_ENABLED to be followed by STATUS_JOINED. - BOOL enable = FALSE; - - switch (status) - { - // Do not add STATUS_VOICE_ENABLED because voice chat is - // inactive until STATUS_JOINED - case STATUS_JOINED: - enable = TRUE; - break; - default: - enable = FALSE; - break; - } - - // We have to enable/disable right and left parts of speak button separately (EXT-4648) - getChild("speak_btn")->setEnabled(enable); - - // skipped to avoid button blinking - if (status != STATUS_JOINING && status!= STATUS_LEFT_CHANNEL) - { - bool voice_status = LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking(); - getChild("speak_flyout_btn")->setEnabled(voice_status); - if (voice_status) - { - LLFirstUse::speak(true); - } - } -} - -// [SL:KB] - Patch: UI-BottomTray | Checked: 2010-11-26 (Catznip-2.4.0f) | Modified: Catznip-2.4.0f -bool LLBottomTray::handleVoiceEnabledToggle(const LLSD& newvalue) -{ - //-TT 2.6.9 - voice enabled toggle vs. just hiding the button. needs care - gSavedSettings.setBOOL("EnableVoiceChat", newvalue.asBoolean()); - return true; -} -// [/SL:KB] - -void LLBottomTray::onMouselookModeOut() -{ - mIsInLiteMode = false; - mBottomTrayLite->setVisible(FALSE); - mNearbyChatBar->getChatBox()->setText(mBottomTrayLite->mNearbyChatBar->getChatBox()->getText()); - setVisible(TRUE); -} - -void LLBottomTray::onMouselookModeIn() -{ - setVisible(FALSE); - - // Attach the lite bottom tray - if (getParent() && mBottomTrayLite->getParent() != getParent()) - getParent()->addChild(mBottomTrayLite); - - mBottomTrayLite->setShape(getLocalRect()); - mBottomTrayLite->mNearbyChatBar->getChatBox()->setText(mNearbyChatBar->getChatBox()->getText()); - mBottomTrayLite->mGesturePanel->setVisible(gSavedSettings.getBOOL("ShowGestureButton")); - - mIsInLiteMode = true; -} - -//virtual -// setVisible used instead of onVisibilityChange, since LLAgent calls it on entering/leaving mouselook mode. -// If bottom tray is already visible in mouselook mode, then onVisibilityChange will not be called from setVisible(true), -void LLBottomTray::setVisible(BOOL visible) -{ - if (mIsInLiteMode) - { - mBottomTrayLite->setVisible(visible); - } - else - { - LLPanel::setVisible(visible); - } - //-TT 2.6.9 - removed? - //if(visible) - // gFloaterView->setSnapOffsetBottom(getRect().getHeight()); - //else - // gFloaterView->setSnapOffsetBottom(0); -} - -S32 LLBottomTray::notifyParent(const LLSD& info) -{ - if(info.has("well_empty")) // implementation of EXT-3397 - { - const std::string chiclet_name = info["well_name"]; - - // only "im_well" or "notification_well" names are expected. - // They are set in panel_bottomtray.xml in & - llassert("im_well" == chiclet_name || "notification_well" == chiclet_name); - - BOOL should_be_visible = !info["well_empty"]; - showWellButton("im_well" == chiclet_name ? RS_IM_WELL : RS_NOTIFICATION_WELL, should_be_visible); - return 1; - } - - if (info.has("action") && info["action"] == "resize") - { - const std::string& name = info["view_name"]; - - // expected only resize of nearby chatbar - if (mChatBarContainer->getName() != name) return LLPanel::notifyParent(info); - - const S32 new_width = info["new_width"]; - - processChatbarCustomization(new_width); - - return 2; - } - return LLPanel::notifyParent(info); -} - -void LLBottomTray::showBottomTrayContextMenu(S32 x, S32 y, MASK mask) -{ - // We should show BottomTrayContextMenu in last turn - if (mBottomTrayContextMenu && !LLMenuGL::sMenuContainer->getVisibleMenu()) - { - //there are no other context menu (IM chiclet etc ), so we can show BottomTrayContextMenu - - updateContextMenu(x, y, mask); - mBottomTrayContextMenu->buildDrawLabels(); - mBottomTrayContextMenu->updateParent(LLMenuGL::sMenuContainer); - LLMenuGL::showPopup(this, mBottomTrayContextMenu, x, y); - - } -} - -void LLBottomTray::updateContextMenu(S32 x, S32 y, MASK mask) -{ - LLUICtrl* edit_box = mNearbyChatBar->getChild("chat_box"); - - S32 local_x = x - mChatBarContainer->getRect().mLeft - edit_box->getRect().mLeft; - S32 local_y = y - mChatBarContainer->getRect().mBottom - edit_box->getRect().mBottom; - - bool in_edit_box = edit_box->pointInView(local_x, local_y); - - mBottomTrayContextMenu->setItemVisible("Separator", in_edit_box); - mBottomTrayContextMenu->setItemVisible("NearbyChatBar_Cut", in_edit_box); - mBottomTrayContextMenu->setItemVisible("NearbyChatBar_Copy", in_edit_box); - mBottomTrayContextMenu->setItemVisible("NearbyChatBar_Paste", in_edit_box); - mBottomTrayContextMenu->setItemVisible("NearbyChatBar_Delete", in_edit_box); - mBottomTrayContextMenu->setItemVisible("NearbyChatBar_Select_All", in_edit_box); -} -//void LLBottomTray::showVoiceButton(BOOL visible) -//{ -// setTrayButtonVisibleIfPossible(RS_BUTTON_SPEAK, visible); -//} - -void LLBottomTray::showSpeakButton(bool visible) -{ - // Show/hide the button - setTrayButtonVisible(RS_BUTTON_SPEAK, visible); - - // and adjust other panels according to the occupied/freed space. - const S32 panel_width = mSpeakPanel->getRect().getWidth(); - if (visible) - { - processWidthDecreased(-panel_width); - } - else - { - processWidthIncreased(panel_width); - } -} - -void LLBottomTray::toggleMovementControls() -{ - if (mMovementButton) - mMovementButton->onCommit(); -} - -void LLBottomTray::toggleCameraControls() -{ - if (mCamButton) - mCamButton->onCommit(); -} - -// ## Zi: Animation Overrider -void LLBottomTray::toggleAO() -{ - BOOL yes=mAOToggleButton->getToggleState(); - AOEngine::getInstance()->enable(yes); - gSavedPerAccountSettings.setBOOL("UseAO",yes); -} -// ## Zi: Animation Overrider - -BOOL LLBottomTray::postBuild() -{ - LLHints::registerHintTarget("bottom_tray", LLView::getHandle()); - LLHints::registerHintTarget("dest_guide_btn", getChild("destination_btn")->getHandle()); - LLHints::registerHintTarget("avatar_picker_btn", getChild("avatar_btn")->getHandle()); - - LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("NearbyChatBar.Action", boost::bind(&LLBottomTray::onContextMenuItemClicked, this, _2)); - LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("NearbyChatBar.EnableMenuItem", boost::bind(&LLBottomTray::onContextMenuItemEnabled, this, _2)); - - mBottomTrayContextMenu = LLUICtrlFactory::getInstance()->createFromFile("menu_bottomtray.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); - gMenuHolder->addChild(mBottomTrayContextMenu); - - mNearbyChatBar = findChild("chat_bar"); - LLHints::registerHintTarget("chat_bar", mNearbyChatBar->LLView::getHandle()); - - mChatBarContainer = getChild("chat_bar_layout_panel"); - mNearbyCharResizeHandlePanel = getChild("chat_bar_resize_handle_panel"); - - mToolbarStack = getChild("toolbar_stack"); - mMovementButton = getChild("movement_btn"); - LLHints::registerHintTarget("move_btn", mMovementButton->getHandle()); - mCamButton = getChild("camera_btn"); - setRightMouseDownCallback(boost::bind(&LLBottomTray::showBottomTrayContextMenu,this, _2, _3,_4)); - - mSpeakPanel = getChild("speak_panel"); - mSpeakBtn = findChild("talk"); - if (mSpeakBtn) - { - LLHints::registerHintTarget("speak_btn", mSpeakBtn->getHandle()); - - // Localization tool doesn't understand custom buttons like - mSpeakBtn->setSpeakToolTip( getString("SpeakBtnToolTip") ); - mSpeakBtn->setShowToolTip( getString("VoiceControlBtnToolTip") ); - } - else - { - LLTransientFloaterMgr::getInstance()->addControlView(getChild("speak_btn")); - LLTransientFloaterMgr::getInstance()->addControlView(getChild("flyout_btn")); - } - - - // Both parts of speak button should be initially disabled because - // it takes some time between logging in to world and connecting to voice channel. - getChild("speak_btn")->setEnabled(false); - getChild("speak_flyout_btn")->setEnabled(false); - - - // Registering Chat Bar to receive Voice client status change notifications. - LLVoiceClient::getInstance()->addObserver(this); -// [SL:KB] - Patch: UI-BottomTray | Checked: 2010-09-07 (Catznip-2.1.2b) | Added: Catznip-2.1.2b - gSavedSettings.getControl("ShowSpeakButton")->getSignal()->connect(boost::bind(&LLBottomTray::handleVoiceEnabledToggle, _2)); -// [/SL:KB] - - mNearbyChatBar->getChatBox()->setContextMenu(NULL); - - mChicletPanel = getChild("chiclet_list"); - - initResizeStateContainers(); - - setButtonsControlsAndListeners(); - - initButtonsVisibility(); - - // update wells visibility: - showWellButton(RS_IM_WELL, !LLIMWellWindow::getInstance()->isWindowEmpty()); - showWellButton(RS_NOTIFICATION_WELL, !LLNotificationWellWindow::getInstance()->isWindowEmpty()); - - loadButtonsOrder(); - - LLViewerParcelMgr::getInstance()->addAgentParcelChangedCallback(boost::bind(&update_build_button_enable_state)); - - // Explicitly wire up buttons for sidebar callbacks - getChild("sidebar_home_btn")->setCommitCallback(boost::bind(&LLBottomTray::showSidebarPanel, this, "panel_home")); - getChild("sidebar_me_btn")->setCommitCallback(boost::bind(&LLBottomTray::showSidebarPanel, this, "panel_me")); - getChild("sidebar_people_btn")->setCommitCallback(boost::bind(&LLBottomTray::showSidebarPanel, this, "panel_people")); - getChild("sidebar_places_btn")->setCommitCallback(boost::bind(&LLBottomTray::showSidebarPanel, this, "panel_places")); - getChild("sidebar_appearance_btn")->setCommitCallback(boost::bind(&LLBottomTray::showSidebarPanel, this, "sidepanel_appearance")); - getChild("sidebar_inv_btn")->setCommitCallback(boost::bind(&LLBottomTray::showSidebarPanel, this, "sidepanel_inventory")); - // ## Zi: Animation Overrider - mAOToggleButton=getChild("ao_toggle_btn"); - mAOToggleButton->setCommitCallback(boost::bind(&LLBottomTray::toggleAO,this)); - mAOToggleButton->setToggleState(gSavedPerAccountSettings.getBOOL("UseAO")); - // ## Zi: Animation Overrider - return TRUE; -} - -//Drag-n-drop - -void LLBottomTray::onDraggableButtonMouseDown(LLUICtrl* ctrl, S32 x, S32 y) -{ - if (ctrl == NULL) return; - LLView* parent_view = ctrl->getParent(); - if(parent_view != NULL) - { - // we actually drag'n'drop panel (not button) in code, so have to find a parent - // of button which called this method on mouse down. - LLPanel* parent = dynamic_cast(parent_view); - // It may happen that we clicked not usual button, but button inside widget(speak, gesture) - // so we'll need to get a level higher to reach layout panel as a parent. - if(parent == NULL) parent = dynamic_cast(parent_view->getParent()); - if (parent && parent->getVisible()) - { - mDraggedItem = parent; - mCheckForDrag = true; - mStartX = x; - mStartY = y; - } - } -} - -LLPanel* LLBottomTray::findChildPanelByLocalCoords(S32 x, S32 y) -{ - LLPanel* ctrl = 0; - S32 screenX, screenY; - const child_list_t* list = mToolbarStack->getChildList(); - - localPointToScreen(x, y, &screenX, &screenY); - - // look for a child panel which contains the point (screenX, screenY) in it's rectangle - for (child_list_const_iter_t i = list->begin(); i != list->end(); ++i) - { - LLRect rect; - localRectToScreen((*i)->getRect(), &rect); - - if (rect.pointInRect(screenX, screenY)) - { - ctrl = dynamic_cast(*i); - break; - } - } - - return ctrl; -} - -void LLBottomTray::onDraggableButtonHover(S32 x, S32 y) -{ - // if mouse down on draggable item was done, check whether we should start DnD - if (mCheckForDrag) - { - // Start drag'n'drop if mouse cursor was dragged away frome mouse down location enough - if(sqrt((float)((mStartX-x)*(mStartX-x)+(mStartY-y)*(mStartY-y))) > DRAG_START_DISTANCE) - { - mDragStarted = true; - mCheckForDrag = false; - } - } - if (mDragStarted) - { - // Check whether the cursor is over draggable area, find which panel it is and set is as - // landing tab for drag'n'drop - if(isCursorOverDraggableArea(x, y)) - { - LLPanel* panel = findChildPanelByLocalCoords(x,y); - if (panel && panel != mDraggedItem) mLandingTab = panel; - gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROWDRAG); - } - else - { - gViewerWindow->getWindow()->setCursor(UI_CURSOR_NO); - } - } - else - { - // Reset cursor in case you move your mouse from the drag handle to a button. - getWindow()->setCursor(UI_CURSOR_ARROW); - - } -} - -bool LLBottomTray::isCursorOverDraggableArea(S32 x, S32 y) -{ - // Draggable area lasts from the nearby chat input resize handle - // to the chiclet area (exlusively). - bool result = getRect().pointInRect(x, y); - result = result && mNearbyCharResizeHandlePanel->calcScreenRect().mRight < x; - result = result && mChicletPanel->calcScreenRect().mRight > x; - return result; -} - -void LLBottomTray::updateButtonsOrdersAfterDnD() -{ - // *TODO: change implementation of this method to support simplify it - // (and according to future possible changes in the way button order is saved between sessions). - state_object_map_t::const_iterator it = mStateProcessedObjectMap.begin(); - state_object_map_t::const_iterator it_end = mStateProcessedObjectMap.end(); - // Speak button is currently the only draggable button not in mStateProcessedObjectMap, - // so if dragged_state is not found in that map, it should be RS_BUTTON_SPEAK. Change this code if any other - // exclusions from mStateProcessedObjectMap will become draggable. -// EResizeState dragged_state = RS_BUTTON_SPEAK; -// [SL:KB] - Patch: UI-BottomTray | Checked: 2010-12-02 (Catznip-2.4.0g) | Added: Catznip-2.4.0g - EResizeState dragged_state = RS_NORESIZE; -// [/SL:KB] - EResizeState landing_state = RS_NORESIZE; - bool landing_state_found = false; - // Find states for dragged item and landing tab - for (; it != it_end; ++it) - { - if (it->second == mDraggedItem) - { - dragged_state = it->first; - } - else if (it->second == mLandingTab) - { - landing_state = it->first; - landing_state_found = true; - } - } - - if (dragged_state == RS_NORESIZE) - { - llwarns << "Cannot determine what button is being dragged" << llendl; - llassert(dragged_state != RS_NORESIZE); - return; - } - - lldebugs << "Will place " << resizeStateToString(dragged_state) - << " before " << resizeStateToString(landing_state) << llendl; - - // Update order of buttons according to drag'n'drop - // Make sure to check if the button we want to move is actually known to the system -Zi - resize_state_vec_t::iterator position=std::find(mButtonsOrder.begin(), mButtonsOrder.end(), dragged_state); - if(position==mButtonsOrder.end()) - { - llwarns << "Could not find " << dragged_state << " in mButtonsOrder!" << llendl; - return; - } - mButtonsOrder.erase(position); - if (!landing_state_found && mLandingTab == getChild(PANEL_CHICLET_NAME)) - { - mButtonsOrder.push_back(dragged_state); - } - else - { -//-TT 2.6.9- why is commented out? -// if (!landing_state_found) landing_state = RS_BUTTON_SPEAK; - mButtonsOrder.insert(std::find(mButtonsOrder.begin(), mButtonsOrder.end(), landing_state), dragged_state); - } - - // Synchronize button process order with their order -// resize_state_vec_t::const_iterator it1 = mButtonsOrder.begin(); -// const resize_state_vec_t::const_iterator it_end1 = mButtonsOrder.end(); -// resize_state_vec_t::iterator it2 = mButtonsProcessOrder.begin(); -// for (; it1 != it_end1; ++it1) -// { -// // Skip Speak because it is not in mButtonsProcessOrder(it's the reason why mButtonsOrder was introduced). -// // If any other draggable items will be added to bottomtray later, they should also be skipped here. -// if (*it1 != RS_BUTTON_SPEAK) -// { -// *it2 = *it1; -// ++it2; -// } -// } -// [SL:KB] - Patch: UI-BottomTray | Checked: 2010-12-02 (Catznip-2.4.0g) | Added: Catznip-2.4.0g - mButtonsProcessOrder = mButtonsOrder; -// [/SL:KB] - - saveButtonsOrder(); -} - -void LLBottomTray::saveButtonsOrder() -{ - if (!gSavedSettings.getBOOL("AllowBottomTrayButtonReordering")) return; - - std::string user_dir = gDirUtilp->getLindenUserDir(); - if (user_dir.empty()) return; - - std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, SORTING_DATA_FILE_NAME); - LLSD settings_llsd; - int i = 0; - const resize_state_vec_t::const_iterator it_end = mButtonsOrder.end(); - // we use numbers as keys for map which is saved in file and contains resize states as its values - for (resize_state_vec_t::const_iterator it = mButtonsOrder.begin(); it != it_end; ++it, i++) - { - std::string str = llformat("%d", i); - settings_llsd[str] = *it; - } - llofstream file; - file.open(filename); - LLSDSerialize::toPrettyXML(settings_llsd, file); -} - -void LLBottomTray::loadButtonsOrder() -{ - if (!gSavedSettings.getBOOL("AllowBottomTrayButtonReordering")) return; - - // load per-resident sorting information - std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, SORTING_DATA_FILE_NAME); - - LLSD settings_llsd; - llifstream file; - file.open(filename); - if (!file.is_open()) return; - - LLSDSerialize::fromXML(settings_llsd, file); - - // clear out one of the two internal lists, the second will be used to compare the buttons later -Zi - mButtonsProcessOrder.clear(); - int i = 0; - // getting button order from file - for (LLSD::map_const_iterator iter = settings_llsd.beginMap(); - iter != settings_llsd.endMap(); ++iter, ++i) - { - std::string str = llformat("%d", i); - EResizeState state = (EResizeState)settings_llsd[str].asInteger(); -// [SL:KB] - Patch: UI-BottomTray | Checked: 2010-12-02 (Catznip-2.4.0g) | Added: Catznip-2.4.0g - mButtonsProcessOrder.push_back(state); -// [/SL:KB] - - // remove button from internal list to remember we found the button in the XML file -Zi - resize_state_vec_t::iterator position=std::find(mButtonsOrder.begin(), mButtonsOrder.end(), state); - if(position!=mButtonsOrder.end()) - mButtonsOrder.erase(position); - } - - // add buttons that are missing in the XML file to the second internal list -Zi - while(mButtonsOrder.size()) - { - mButtonsProcessOrder.push_back(*(mButtonsOrder.end()-1)); - mButtonsOrder.pop_back(); - } - - // copy the second internal list to the first -Zi - mButtonsOrder=mButtonsProcessOrder; - - // There are other panels in layout stack order of which is not saved. Also, panels order of which is saved, - // are already in layout stack but in wrong order. The most convenient way to place them is moving them - // to front one by one (because in this case we don't have to pass the panel before which we want to insert our - // panel to movePanel()). So panels are moved in order from the end of mButtonsOrder vector(reverse iterator is used). - const resize_state_vec_t::const_reverse_iterator it_end = mButtonsOrder.rend(); - // placing panels in layout stack according to button order which we loaded in previous for - for (resize_state_vec_t::const_reverse_iterator it = mButtonsOrder.rbegin(); it != it_end; ++it, ++i) - { - LLPanel* panel_to_move = getButtonPanel(*it); - mToolbarStack->movePanel(panel_to_move, NULL, true); // prepend - } - // Nearbychat is not stored in order settings file, but it must be the first of the panels, so moving it - // (along with its drag handle) manually here. - mToolbarStack->movePanel(getChild("chat_bar_resize_handle_panel"), NULL, true); - mToolbarStack->movePanel(mChatBarContainer, NULL, true); -} - -void LLBottomTray::onDraggableButtonMouseUp(LLUICtrl* ctrl, S32 x, S32 y) -{ - //if mouse up happened over area where drop is possible, change order of buttons - if (mLandingTab != NULL && mDraggedItem != NULL && mDragStarted) - { - if(isCursorOverDraggableArea(x, y)) - { - // change order of panels in layout stack - mToolbarStack->movePanel(mDraggedItem, (LLPanel*)mLandingTab); - // change order of buttons in order vectors - updateButtonsOrdersAfterDnD(); - } - } - gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW); - mDragStarted = false; - mDraggedItem = NULL; - mLandingTab = NULL; - mCheckForDrag = false; -} - -void LLBottomTray::draw() -{ - LLPanel::draw(); - if (mLandingTab) - { - static S32 w = mImageDragIndication->getWidth(); - static S32 h = mImageDragIndication->getHeight(); - LLRect rect = mLandingTab->calcScreenRect(); - mImageDragIndication->draw(rect.mLeft - w/2, rect.getHeight(), w, h); - } - getChild("show_profile_btn")->setToggleState(LLAvatarActions::profileVisible(gAgent.getID())); - - LLPanel* panel = LLSideTray::getInstance()->getPanel("panel_people"); - if (panel && panel->isInVisibleChain()) - { - getChild("show_people_button")->setToggleState(true); - } - else - { - getChild("show_people_button")->setToggleState(false); - } - - LLFloater* help_browser = (LLFloaterReg::findInstance("help_browser")); - bool help_floater_visible = (help_browser && help_browser->isInVisibleChain()); - - getChild("show_help_btn")->setToggleState(help_floater_visible); - - bool openmic = LLVoiceClient::getInstance()->getUserPTTState(); - bool voiceenabled = LLVoiceClient::getInstance()->voiceEnabled(); - getChild("speak_btn")->setToggleState(openmic && voiceenabled); - getChild("chat_zone_indicator")->setIsMuted(!voiceenabled); - -} - -bool LLBottomTray::onContextMenuItemEnabled(const LLSD& userdata) -{ - std::string item = userdata.asString(); - LLLineEditor* edit_box = mNearbyChatBar->findChild("chat_box"); - - if (item == "can_cut") - { - return edit_box->canCut(); - } - else if (item == "can_copy") - { - return edit_box->canCopy(); - } - else if (item == "can_paste") - { - return edit_box->canPaste(); - } - else if (item == "can_delete") - { - return edit_box->canDoDelete(); - } - else if (item == "can_select_all") - { - return edit_box->canSelectAll() && (edit_box->getLength()>0); - } - return true; -} - - -// used to manage the bottom bar icons specific to sidebar panels. -// AO: A bit hacky and might be better in another place. -void LLBottomTray::showSidebarPanel(const LLSD& panel_name) -{ - LLSD param; - LLSideTray* sb = LLSideTray::getInstance(); - LLButton* btn = NULL; - std::string tab_name = ""; - std::string master_panel_name = panel_name; - - - // map buttons to specific values that are useful for detection & comparisons - if (master_panel_name == "panel_people") - { - param["people_panel_tab_name"] = "nearby_panel"; - tab_name = "sidebar_people"; - btn = getChild("sidebar_people_btn"); - master_panel_name = "panel_container_people"; - } - else if (master_panel_name == "panel_me") - { - tab_name = "sidebar_me"; - btn = getChild("sidebar_me_btn"); - master_panel_name = "panel_container_me"; - } - else if (master_panel_name == "panel_home") - { - tab_name = "sidebar_home"; - btn = getChild("sidebar_home_btn"); - } - else if (master_panel_name == "panel_places") - { - tab_name = "sidebar_places"; - btn = getChild("sidebar_places_btn"); - } - else if (master_panel_name == "sidepanel_appearance") - { - tab_name = "sidebar_appearance"; - btn = getChild("sidebar_appearance_btn"); - } - else if (master_panel_name == "sidepanel_inventory") - { - tab_name = "sidebar_inventory"; - btn = getChild("sidebar_inv_btn"); - } - - // toggle minimization undocked - LLFloater* floater_tab = LLFloaterReg::getInstance("side_bar_tab", tab_name); - if (LLFloater::isShown(floater_tab)) - { -//-TT Toggle sidebar panels and floaters - added state toggle and combined the cases - bool isMinimized = floater_tab->isMinimized(); - if (btn) - { - //btn->setToggleState(isMinimized); - btn->setForcePressedState(isMinimized); - //const LLSD& sdName(tab_name); - //// Set the clicked callback to toggle the floater - //btn->setClickedCallback(boost::bind(&LLFloaterReg::toggleFloaterInstance, sdName)); - } - floater_tab->setMinimized(!isMinimized); - } - // toggle collapsing sidebar if active & docked - else - { - if (sb->isPanelActive(master_panel_name)) - { - sb->collapseSideBar(); - //btn->setToggleState(false); - } - else - { - sb->showPanel(panel_name, param); - //btn->setToggleState(true); - } -//-TT Toggle sidebar panels with buttons - if (btn) - { - // Set the clicked callback to toggle the sidebar - //btn->setClickedCallback(boost::bind(&LLSideTrayTab::toggleSidebarTabInstance, sdName)); - } - } - - //const LLSD& sdName(panel_name); - //std::string vis_control_name = LLSideTrayTab::declareVisibilityControl(sdname.asString()); - // Set the button control value (toggle state) to the floater visibility control (Sets the value as well) - //btn->setControlVariable(LLSideTray::getInstance()->getPanel(sdName)); - // Set the clicked callback to toggle the floater - //btn->setClickedCallback(boost::bind(&LLSideTrayTab::toggleSidebarTabInstance, sdName)); - //btn->toggleState(); -//-TT -} - -void LLBottomTray::onContextMenuItemClicked(const LLSD& userdata) -{ - std::string item = userdata.asString(); - LLLineEditor* edit_box = mNearbyChatBar->findChild("chat_box"); - - if (item == "cut") - { - edit_box->cut(); - } - else if (item == "copy") - { - edit_box->copy(); - } - else if (item == "paste") - { - edit_box->paste(); - edit_box->setFocus(TRUE); - } - else if (item == "delete") - { - edit_box->doDelete(); - } - else if (item == "select_all") - { - edit_box->selectAll(); - } -} - -void LLBottomTray::log(LLView* panel, const std::string& descr) -{ - if (NULL == panel) return; - LLView* layout = panel->getParent(); - LL_DEBUGS("Bottom Tray Rects") << descr << ": " - << "panel: " << panel->getName() - << ", rect: " << panel->getRect() - - - << " layout: " << layout->getName() - << ", rect: " << layout->getRect() - << LL_ENDL; -} - -void LLBottomTray::reshape(S32 width, S32 height, BOOL called_from_parent) -{ - static S32 debug_calling_number = 0; - lldebugs << "**************************************** " << ++debug_calling_number << llendl; - - S32 current_width = getRect().getWidth(); - S32 delta_width = width - current_width; - lldebugs << "Reshaping: " - << ", width: " << width - << ", cur width: " << current_width - << ", delta_width: " << delta_width - << ", called_from_parent: " << called_from_parent - << llendl; - - if (mNearbyChatBar) log(mNearbyChatBar, "before"); - if (mChicletPanel) log(mChicletPanel, "before"); - - // Difference between bottom tray width required to fit its children and the actual width. (see EXT-991) - // Positive value means that bottom tray is not wide enough. - // Negative value means that there is free space. - static S32 extra_shrink_width = 0; - bool should_be_reshaped = true; - - if (mChicletPanel && mToolbarStack && mNearbyChatBar) - { - // Firstly, update layout stack to ensure we deal with correct panel sizes. - { - BOOL saved_anim = mToolbarStack->getAnimate(); - // Set chiclet panel to be autoresized by default. - mToolbarStack->updatePanelAutoResize(PANEL_CHICLET_NAME, TRUE); - // Disable animation to prevent layout updating in several frames. - mToolbarStack->setAnimate(FALSE); - // Force the updating of layout to reset panels collapse factor. - mToolbarStack->updateLayout(); - // Restore animate state. - mToolbarStack->setAnimate(saved_anim); - } - - // bottom tray is narrowed - if (delta_width < 0) - { - if (extra_shrink_width > 0) // not enough space - { - extra_shrink_width += llabs(delta_width); - should_be_reshaped = false; - } - else - { - extra_shrink_width = processWidthDecreased(delta_width); - - // increase new width to extra_shrink_width value to not reshape less than bottom tray minimum - width += extra_shrink_width; - } - } - // bottom tray is widened - else - { - if (extra_shrink_width > delta_width) - { - // Still not enough space. - // Only subtract the delta from the required delta and don't reshape. - extra_shrink_width -= delta_width; - should_be_reshaped = false; - } - else - { - if (extra_shrink_width > 0) - { - // If we have some extra shrink width let's reduce delta_width & width - delta_width -= extra_shrink_width; - width -= extra_shrink_width; - extra_shrink_width = 0; - } - processWidthIncreased(delta_width); - } - } - } - - if (should_be_reshaped) - { - lldebugs << "Reshape all children with width: " << width << llendl; - LLPanel::reshape(width, height, called_from_parent); - } - - if (mNearbyChatBar) log(mNearbyChatBar, "after"); - if (mChicletPanel) log(mChicletPanel, "after"); - - - // Restore width of the chatbar on first reshape. - // we can not to do this from postBuild because reshape is called from parent view on startup - // creation after it and reset width according to resize logic. - static bool needs_restore_custom_state = true; - if (mChatBarContainer && needs_restore_custom_state) - { - // restore custom width of chatbar panel. - S32 new_width = gSavedSettings.getS32("ChatBarCustomWidth"); - if (new_width > 0) - { - mDesiredNearbyChatWidth = new_width; - processChatbarCustomization(new_width); - lldebugs << "Setting nearby chat bar width to " << new_width << " px" << llendl; - mChatBarContainer->reshape(new_width, mChatBarContainer->getRect().getHeight()); - } - needs_restore_custom_state = false; - } - -} - -S32 LLBottomTray::processWidthDecreased(S32 delta_width) -{ - bool still_should_be_processed = true; - - const S32 chiclet_panel_shrink_headroom = getChicletPanelShrinkHeadroom(); - - // There are four steps of processing width decrease. If in one of them required width was reached, - // further are not needed. - // 1. Decreasing width of chiclet panel. - if (chiclet_panel_shrink_headroom > 0) - { - // we have some space to decrease chiclet panel - S32 shrink_by = llmin(-delta_width, chiclet_panel_shrink_headroom); - - lldebugs << "delta_width: " << delta_width - << ", panel_delta_min: " << chiclet_panel_shrink_headroom - << ", shrink_by: " << shrink_by - << llendl; - - // is chiclet panel wide enough to process resizing? - delta_width += chiclet_panel_shrink_headroom; - - still_should_be_processed = delta_width < 0; - - lldebugs << "Shrinking chiclet panel by " << shrink_by << " px" << llendl; - mChicletPanel->getParent()->reshape(mChicletPanel->getParent()->getRect().getWidth() - shrink_by, mChicletPanel->getParent()->getRect().getHeight()); - log(mChicletPanel, "after processing panel decreasing via chiclet panel"); - - lldebugs << "RS_CHICLET_PANEL" - << ", delta_width: " << delta_width - << llendl; - } - - S32 buttons_freed_width = 0; - // 2. Decreasing width of buttons. - if (still_should_be_processed) - { - processShrinkButtons(delta_width, buttons_freed_width); - } - // 3. Decreasing width of nearby chat. - const S32 chatbar_panel_min_width = get_panel_min_width(mToolbarStack, mChatBarContainer); - const S32 chatbar_panel_width = mChatBarContainer->getRect().getWidth(); - if (still_should_be_processed && chatbar_panel_width > chatbar_panel_min_width) - { - // we have some space to decrease chatbar panel - S32 panel_delta_min = chatbar_panel_width - chatbar_panel_min_width; - - S32 delta_panel = llmin(-delta_width, panel_delta_min); - - // is chatbar panel wide enough to process resizing? - delta_width += panel_delta_min; - - still_should_be_processed = delta_width < 0; - - // chatbar should only be shrunk here, not stretched - if(delta_panel > 0) - { - lldebugs << "Shrinking nearby chat bar by " << delta_panel << " px " << llendl; - mChatBarContainer->reshape(mNearbyChatBar->getRect().getWidth() - delta_panel, mChatBarContainer->getRect().getHeight()); - } - - log(mNearbyChatBar, "after processing panel decreasing via nearby chatbar panel"); - - lldebugs << "RS_CHATBAR_INPUT" - << ", delta_panel: " << delta_panel - << ", delta_width: " << delta_width - << llendl; - } - - S32 extra_shrink_width = 0; - // 4. Hiding buttons if needed. - if (still_should_be_processed) - { - processHideButtons(delta_width, buttons_freed_width); - - if (delta_width < 0) - { - extra_shrink_width = -delta_width; - llwarns << "There is no enough width to reshape all children: " - << extra_shrink_width << llendl; - } - - if (buttons_freed_width > 0) - { - S32 nearby_needed_width = mDesiredNearbyChatWidth - mNearbyChatBar->getRect().getWidth(); - if (nearby_needed_width > 0) - { - S32 compensative_width = nearby_needed_width > buttons_freed_width ? buttons_freed_width : nearby_needed_width; - log(mNearbyChatBar, "before applying compensative width"); - lldebugs << "Extending nearby chat bar by " << compensative_width << " px" << llendl; - mChatBarContainer->reshape(mChatBarContainer->getRect().getWidth() + compensative_width, mChatBarContainer->getRect().getHeight() ); - log(mNearbyChatBar, "after applying compensative width"); - lldebugs << buttons_freed_width << llendl; - } - } - } - - return extra_shrink_width; -} - -void LLBottomTray::processWidthIncreased(S32 delta_width) -{ - if (delta_width <= 0) return; - - // how much room we have to show hidden buttons - S32 available_width = delta_width + getChicletPanelShrinkHeadroom(); - - lldebugs << "Distributing (" << getChicletPanelShrinkHeadroom() - << " + " << delta_width << ") = " << available_width << " px" << llendl; - - // 1. Try showing buttons that have been auto-hidden. - S32 processed_width = processShowButtons(available_width); - lldebugs << "processed_width = " << processed_width << ", delta_width = " << delta_width << llendl; - - lldebugs << "Available_width after showing buttons: " << available_width << llendl; - - // If the newly shown buttons have consumed more than delta_width pixels, - // shrink the chiclet panel. - if (processed_width > delta_width) - { - // 1. use delta width of resizing - S32 shrink_by = processed_width - delta_width; - - // 2. use width available via decreasing of chiclet panel - if (shrink_by > 0) - { - lldebugs << "Shrinking chiclet panel by " << shrink_by << " px" << llendl; - mChicletPanel->getParent()->reshape(mChicletPanel->getParent()->getRect().getWidth() - shrink_by, mChicletPanel->getParent()->getRect().getHeight()); - log(mChicletPanel, "after applying compensative width for chiclets: "); - lldebugs << shrink_by << llendl; - } - - // shown buttons take some space, rest should be processed by nearby chatbar & chiclet panels - delta_width -= processed_width; - } - - // 2. Expand the nearby chat bar if needed. - S32 chatbar_panel_width = mChatBarContainer->getRect().getWidth(); - lldebugs << "delta_width = " << delta_width - << ", chatbar_panel_width = " << chatbar_panel_width - << ", mDesiredNearbyChatWidth = " << mDesiredNearbyChatWidth << llendl; - if (delta_width > 0 && chatbar_panel_width < mDesiredNearbyChatWidth) - { - S32 delta_panel_max = mDesiredNearbyChatWidth - chatbar_panel_width; - S32 delta_panel = llmin(delta_width, delta_panel_max); - lldebugs << "Unprocesed delta width: " << delta_width - << ", can be applied to chatbar: " << delta_panel_max - << ", will be applied: " << delta_panel - << llendl; - - delta_width -= delta_panel_max; - lldebugs << "Extending nearby chat bar by " << delta_panel << " px " << llendl; - mChatBarContainer->reshape(chatbar_panel_width + delta_panel, mChatBarContainer->getRect().getHeight()); - log(mNearbyChatBar, "applied unprocessed delta width"); - } - - // 3. Expand buttons that have been auto-shrunk, - // if we haven't yet consumed all the available headroom. - if (delta_width > 0) - { - S32 available_width = delta_width + getChicletPanelShrinkHeadroom(); - processExtendButtons(available_width); - } -} - -S32 LLBottomTray::processShowButtons(S32& available_width) -{ - lldebugs << "Distributing " << available_width << " px" << llendl; - S32 original_available_width = available_width; - - // process buttons from left to right - resize_state_vec_t::const_iterator it = mButtonsProcessOrder.begin(); - const resize_state_vec_t::const_iterator it_end = mButtonsProcessOrder.end(); - - for (; it != it_end; ++it) - { - // is there available space? - if (available_width <= 0) break; - - // try to show next button - processShowButton(*it, available_width); - } - - return original_available_width - available_width; -} - -bool LLBottomTray::processShowButton(EResizeState shown_object_type, S32& available_width) -{ - // Check if the button was previously auto-hidden (due to lack of space). - if (!isAutoHidden(shown_object_type)) - { - return false; - } - - // Ok. Try showing the button. - return showButton(shown_object_type, available_width); -} - -void LLBottomTray::processHideButtons(S32& required_width, S32& buttons_freed_width) -{ - // process buttons from right to left - resize_state_vec_t::const_reverse_iterator it = mButtonsProcessOrder.rbegin(); - const resize_state_vec_t::const_reverse_iterator it_end = mButtonsProcessOrder.rend(); - - for (; it != it_end; ++it) - { - // is it still necessary to hide a button? - if (required_width >= 0) break; - - // try to hide next button - processHideButton(*it, required_width, buttons_freed_width); - } -} - -void LLBottomTray::processHideButton(EResizeState processed_object_type, S32& required_width, S32& buttons_freed_width) -{ - lldebugs << "Trying to hide object type: " << processed_object_type << llendl; - LLPanel* panel = getButtonPanel(processed_object_type); - if (NULL == panel) - { - return; - } - - if (panel->getVisible()) - { - required_width += panel->getRect().getWidth(); - - if (required_width > 0) - { - buttons_freed_width += required_width; - } - - setTrayButtonVisible(processed_object_type, false); - - setAutoHidden(processed_object_type, true); - - lldebugs << "processing object type: " << processed_object_type - << ", buttons_freed_width: " << buttons_freed_width - << llendl; - } -} - -void LLBottomTray::processShrinkButtons(S32& required_width, S32& buttons_freed_width) -{ - // process buttons from right to left - resize_state_vec_t::const_reverse_iterator it = mButtonsProcessOrder.rbegin(); - const resize_state_vec_t::const_reverse_iterator it_end = mButtonsProcessOrder.rend(); - - // iterate through buttons in the mButtonsProcessOrder first - for (; it != it_end; ++it) - { - // is it still necessary to hide a button? - if (required_width >= 0) break; - - // try to shrink next button - processShrinkButton(*it, required_width); - } - - // then shrink Speak button -// [SL:KB] - Patch: UI-BottomTray | Checked: 2010-09-07 (Catznip-2.1.2b) | Added: Catznip-2.1.2b - if ( (mSpeakPanel->getVisible()) && (mObjectDefaultWidthMap[RS_BUTTON_SPEAK] > mSpeakPanel->getRect().getWidth()) ) - { - mSpeakBtn->setLabelVisible(false); - } -// [/SL:KB] -/* - if (required_width < 0) - { - S32 panel_min_width = 0; - std::string panel_name = mSpeakPanel->getName(); - bool success = mToolbarStack->getPanelMinSize(panel_name, &panel_min_width); - if (!success) - { - lldebugs << "Panel was not found to get its min width: " << panel_name << llendl; - } - else - { - S32 panel_width = mSpeakPanel->getRect().getWidth(); - S32 possible_shrink_width = panel_width - panel_min_width; - - if (possible_shrink_width > 0) - { - if (mSpeakBtn) - { - mSpeakBtn->setLabelVisible(false); - } - - mSpeakPanel->reshape(panel_width - possible_shrink_width, mSpeakPanel->getRect().getHeight()); - - required_width += possible_shrink_width; - - if (required_width > 0) - { - buttons_freed_width += required_width; - } - - lldebugs << "Shrunk Speak button panel: " << panel_name - << ", shrunk width: " << possible_shrink_width - << ", rest width to process: " << required_width - << llendl; - } - } - } -*/ -} - -void LLBottomTray::processShrinkButton(EResizeState processed_object_type, S32& required_width) -{ - LLPanel* panel = getButtonPanel(processed_object_type); - if (NULL == panel) - { - return; - } - - if (panel->getVisible()) - { - S32 panel_width = panel->getRect().getWidth(); - S32 panel_min_width = 0; - std::string panel_name = panel->getName(); - bool success = mToolbarStack->getPanelMinSize(panel_name, &panel_min_width); - S32 possible_shrink_width = panel_width - panel_min_width; - - if (!success) - { - lldebugs << "Panel was not found to get its min width: " << panel_name << llendl; - } - // we have some space to free by shrinking the button - else if (possible_shrink_width > 0) - { - // let calculate real width to shrink - - // 1. apply all possible width - required_width += possible_shrink_width; - - // 2. it it is too much... - if (required_width > 0) - { - // reduce applied shrunk width to the excessive value. - possible_shrink_width -= required_width; - required_width = 0; - } - panel->reshape(panel_width - possible_shrink_width, panel->getRect().getHeight()); - - lldebugs << "Shrunk panel: " << panel_name - << ", shrunk width: " << possible_shrink_width - << ", rest width to process: " << required_width - << llendl; - } - } -} - - -void LLBottomTray::processExtendButtons(S32& available_width) -{ - // do not allow extending any buttons if we have some buttons hidden via resize - if (mResizeState && isAutoHidden(RS_BUTTONS_CAN_BE_HIDDEN)) return; - - lldebugs << "Distributing " << available_width << " px" << llendl; - - // First try extending the Speak button. - if (available_width > 0) - { - if (!processExtendSpeakButton(available_width)) - { - // The Speak button needs extension but lacks some space. - // Don't extend other buttons in this case: the Speak button - // should consume the available headroom first. - return; - } - } - -// const S32 chiclet_panel_width = mChicletPanel->getParent()->getRect().getWidth(); -// static const S32 chiclet_panel_min_width = mChicletPanel->getMinWidth(); -// const S32 available_width_chiclet = chiclet_panel_width - chiclet_panel_min_width; - // Then process the other buttons from left to right. - if (available_width > 0) - { - resize_state_vec_t::const_iterator it = mButtonsProcessOrder.begin(); - const resize_state_vec_t::const_iterator it_end = mButtonsProcessOrder.end(); - } - - //-TT 2.6.9 - keeping this along with the section above to try for decoupling voice-on from button display - //this will mean just disabling button when voice is off, not hiding it. -TT - - // then try to extend Speak button -// [SL:KB] - Patch: UI-BottomTray | Checked: 2010-09-07 (Catznip-2.1.2b) | Added: Catznip-2.1.2b - if ( (mSpeakPanel->getVisible()) && (mObjectDefaultWidthMap[RS_BUTTON_SPEAK] <= mSpeakPanel->getRect().getWidth()) ) - { - mSpeakBtn->setLabelVisible(true); - } -// [/SL:KB] -/* - if (available_width > 0 || available_width_chiclet > 0) - { - S32 panel_max_width = mObjectDefaultWidthMap[RS_BUTTON_SPEAK]; - S32 panel_width = mSpeakPanel->getRect().getWidth(); - S32 possible_extend_width = panel_max_width - panel_width; - - // iterate through buttons in the mButtonsProcessOrder first - for (; it != it_end; ++it) - { - // is there available space? - if (available_width <= 0) break; - - // try to extend next button - processExtendButton(*it, available_width); - } - } -*/ -} - -bool LLBottomTray::processExtendSpeakButton(S32& available_width) -{ - if (available_width <= 0) - { - llassert(available_width > 0); - return true; - } - - const S32 panel_max_width = mObjectDefaultWidthMap[RS_BUTTON_SPEAK]; - const S32 panel_width = mSpeakPanel->getRect().getWidth(); - const S32 required_headroom = panel_max_width - panel_width; - - if (panel_width < panel_max_width) // if the button isn't extended already - { - if (available_width < required_headroom) // not enough space - { - lldebugs << "Need (" << required_headroom << " - " << available_width << ") = " - << (required_headroom - available_width) << " more px" - << " to extend the Speak button"<< llendl; - - return false; // Don't extend other buttons until we extend Speak. - //-TT 2.6.9 - this needs looking into for FS merge - } - - // Reshape the Speak button to its maximum width. - if (mSpeakBtn) mSpeakBtn->setLabelVisible(true); - mSpeakPanel->reshape(panel_max_width, mSpeakPanel->getRect().getHeight()); - - available_width -= required_headroom; - llassert(available_width >= 0); - - lldebugs << "Extending Speak button panel: " << mSpeakPanel->getName() - << ", extended width: " << required_headroom - << ", rest width to process: " << available_width - << llendl; - } - - return true; -} - -void LLBottomTray::processExtendButton(EResizeState processed_object_type, S32& available_width) -{ - llassert(available_width >= 0); - - LLPanel* panel = getButtonPanel(processed_object_type); - if (NULL == panel) - { - return; - } - - if (!panel->getVisible()) return; - - // Widen the button up to its maximum width, but by not more than px. - S32 panel_max_width = mObjectDefaultWidthMap[processed_object_type]; - S32 panel_width = panel->getRect().getWidth(); - S32 required_headroom = panel_max_width - panel_width; - - S32 extend_by = llmin(available_width, required_headroom); - if (extend_by > 0) - { - panel->reshape(panel_width + extend_by, panel->getRect().getHeight()); - - // Decrease amount of headroom available for other panels. - available_width -= extend_by; - - lldebugs << "Extending " << panel->getName() - << " by " << extend_by - << " px; remaining available width: " << available_width - << llendl; - } -} - -bool LLBottomTray::canButtonBeShown(EResizeState processed_object_type) const -{ - // Check that all buttons (that can be hidden on resize) - // to the left of the given one are already shown. - - // process buttons in direct order (from left to right) - resize_state_vec_t::const_iterator it = mButtonsProcessOrder.begin(); - const resize_state_vec_t::const_iterator it_end = mButtonsProcessOrder.end(); - - MASK buttons_before_mask = RS_NORESIZE; - for (; it != it_end; ++it) - { - const EResizeState button_type = *it; - if (button_type == processed_object_type) break; - - buttons_before_mask |= button_type; - } - - return !isAutoHidden(buttons_before_mask); -} - -void LLBottomTray::initResizeStateContainers() -{ - // init map with objects should be processed for each type -// [SL:KB] - Patch: UI-BottomTray | Checked: 2010-09-07 (Catznip-2.1.2b) | Added: Catznip-2.1.2b - mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_SPEAK, getChild("speak_panel"))); -// [/SL:KB] - - mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_GESTURES, getChild("gesture_panel"))); - mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_MOVEMENT, getChild("movement_panel"))); - mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_CAMERA, getChild("cam_panel"))); - mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_DESTINATIONS, getChild("destinations_panel"))); - mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_AVATARS, getChild("avatar_panel"))); - mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_SNAPSHOT, getChild("snapshot_panel"))); - mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_PEOPLE, getChild("bottom_sbpeople"))); - mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_BUILD, getChild("build_btn_panel"))); - mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_SEARCH, getChild("search_btn_panel"))); - mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_WORLD_MAP, getChild("world_map_btn_panel"))); - mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_MINI_MAP, getChild("mini_map_btn_panel"))); -// AO mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_HOME, getChild("bottom_sbhome"))); -// AO mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_ME, getChild("bottom_sbme"))); -// AO mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_PLACES, getChild("bottom_sbplaces"))); - mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_APPEARANCE, getChild("bottom_sbappearance"))); - mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_INVENTORY, getChild("bottom_sbinv"))); - mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_AO, getChild("ao_btn_panel"))); // ## Zi: Animation Overrider - mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_QUICKPREFS, getChild("quickprefs_btn_panel"))); // Quick Preferences panel -WoLf - //-TT 2.6.9 - there's also splitter_panel_2, in case we want it - mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_SPLITTER_1, getChild("splitter_panel_1"))); - mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_HOWTO, getChild("howto_panel"))); - - // init an order of processed buttons - -// [SL:KB] - Patch: UI-BottomTray | Checked: 2010-09-07 (Catznip-2.1.2b) | Added: Catznip-2.1.2b - mButtonsProcessOrder.push_back(RS_BUTTON_SPEAK); -// [/SL:KB] - mButtonsProcessOrder.push_back(RS_BUTTON_GESTURES); - mButtonsProcessOrder.push_back(RS_BUTTON_MOVEMENT); - mButtonsProcessOrder.push_back(RS_BUTTON_CAMERA); -// mButtonsProcessOrder.push_back(RS_BUTTON_AVATARS); - mButtonsProcessOrder.push_back(RS_BUTTON_SNAPSHOT); - mButtonsProcessOrder.push_back(RS_BUTTON_PEOPLE); - mButtonsProcessOrder.push_back(RS_BUTTON_BUILD); - mButtonsProcessOrder.push_back(RS_BUTTON_SEARCH); - mButtonsProcessOrder.push_back(RS_BUTTON_WORLD_MAP); - mButtonsProcessOrder.push_back(RS_BUTTON_MINI_MAP); -//AO mButtonsProcessOrder.push_back(RS_BUTTON_HOME); -//AO mButtonsProcessOrder.push_back(RS_BUTTON_ME); -//AO mButtonsProcessOrder.push_back(RS_BUTTON_PLACES); - mButtonsProcessOrder.push_back(RS_BUTTON_APPEARANCE); - mButtonsProcessOrder.push_back(RS_BUTTON_INVENTORY); - mButtonsProcessOrder.push_back(RS_BUTTON_AO); // ## Zi: Animation Overrider - mButtonsProcessOrder.push_back(RS_BUTTON_QUICKPREFS); // Quick Preferences panel -WoLf - - mButtonsProcessOrder.push_back(RS_BUTTON_SPLITTER_1); - mButtonsProcessOrder.push_back(RS_BUTTON_HOWTO); - - - //-TT 2.6.9 - this needs untangling from the order, keeping the following section with the old patch - -// mButtonsOrder.push_back(RS_BUTTON_SPEAK); -// mButtonsOrder.insert(mButtonsOrder.end(), mButtonsProcessOrder.begin(), mButtonsProcessOrder.end()); -// [SL:KB] - Patch: UI-BottomTray | Checked: 2010-12-02 (Catznip-2.4.0g) | Added: Catznip-2.4.0g - mButtonsOrder = mButtonsProcessOrder; -// [/SL:KB] - - // init default widths - - // process buttons that can be hidden on resize... - resize_state_vec_t::const_iterator it = mButtonsProcessOrder.begin(); - const resize_state_vec_t::const_iterator it_end = mButtonsProcessOrder.end(); - - for (; it != it_end; ++it) - { - const EResizeState button_type = *it; - // is there an appropriate object? - LLPanel* button_panel = getButtonPanel(button_type); - if (!button_panel) continue; - - // set default width for it. - mObjectDefaultWidthMap[button_type] = button_panel->getRect().getWidth(); - } - - // ... and add Speak button because it also can be shrunk. -// mObjectDefaultWidthMap[RS_BUTTON_SPEAK] = mSpeakPanel->getRect().getWidth(); -} - -// this method must be called before restoring of the chat entry field on startup -// because it resets chatbar's width according to resize logic. -void LLBottomTray::initButtonsVisibility() -{ -// [SL:KB] - Patch: UI-BottomTray | Checked: 2010-09-07 (Catznip-2.1.2b) | Added: Catznip-2.1.2b - setVisibleAndFitWidths(RS_BUTTON_SPEAK, gSavedSettings.getBOOL("ShowSpeakButton") || !mSpeakBtn ); -// [/SL:KB] - - setVisibleAndFitWidths(RS_BUTTON_GESTURES, gSavedSettings.getBOOL("ShowGestureButton")); - setVisibleAndFitWidths(RS_BUTTON_MOVEMENT, gSavedSettings.getBOOL("ShowMoveButton")); - setVisibleAndFitWidths(RS_BUTTON_CAMERA, gSavedSettings.getBOOL("ShowCameraButton")); - setVisibleAndFitWidths(RS_BUTTON_SNAPSHOT, gSavedSettings.getBOOL("ShowSnapshotButton")); - setVisibleAndFitWidths(RS_BUTTON_BUILD, gSavedSettings.getBOOL("ShowBuildButton")); - setVisibleAndFitWidths(RS_BUTTON_SEARCH, gSavedSettings.getBOOL("ShowSearchButton")); - setVisibleAndFitWidths(RS_BUTTON_WORLD_MAP, gSavedSettings.getBOOL("ShowWorldMapButton")); - setVisibleAndFitWidths(RS_BUTTON_MINI_MAP, gSavedSettings.getBOOL("ShowMiniMapButton")); - -//AO setVisibleAndFitWidths(RS_BUTTON_HOME, gSavedSettings.getBOOL("ShowHomeButton")); -//AO setVisibleAndFitWidths(RS_BUTTON_ME, gSavedSettings.getBOOL("ShowMeButton")); -//AO setVisibleAndFitWidths(RS_BUTTON_PLACES, gSavedSettings.getBOOL("ShowPlacesButton")); - setVisibleAndFitWidths(RS_BUTTON_AO, gSavedSettings.getBOOL("ShowAOButton")); // ## Zi: Animation Overrider - setVisibleAndFitWidths(RS_BUTTON_QUICKPREFS, gSavedSettings.getBOOL("ShowQuickPrefsButton")); // Quick Preferences panel -WoLf - // take care of additional sidebar button visibility -Zi - setVisibleAndFitWidths(RS_BUTTON_PEOPLE, gSavedSettings.getBOOL("ShowPeopleButton")); - setVisibleAndFitWidths(RS_BUTTON_APPEARANCE, gSavedSettings.getBOOL("ShowAppearanceButton")); - setVisibleAndFitWidths(RS_BUTTON_INVENTORY, gSavedSettings.getBOOL("ShowInventoryButton")); - - lldebugs << "mResizeState = " << resizeStateMaskToString(mResizeState) << llendl; - -} - -void LLBottomTray::setButtonsControlsAndListeners() -{ - if (mSpeakBtn) - { -// [SL:KB] - Patch: UI-BottomTray | Checked: 2010-09-07 (Catznip-2.1.2b) | Added: Catznip-2.1.2b - gSavedSettings.getControl("ShowSpeakButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_SPEAK, _2)); -// [/SL:KB] - } - - gSavedSettings.getControl("ShowGestureButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_GESTURES, _2)); - gSavedSettings.getControl("ShowMoveButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_MOVEMENT, _2)); - gSavedSettings.getControl("ShowCameraButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_CAMERA, _2)); - gSavedSettings.getControl("ShowSnapshotButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_SNAPSHOT, _2)); - gSavedSettings.getControl("ShowBuildButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_BUILD, _2)); - gSavedSettings.getControl("ShowSearchButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_SEARCH, _2)); - gSavedSettings.getControl("ShowWorldMapButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_WORLD_MAP, _2)); - gSavedSettings.getControl("ShowMiniMapButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_MINI_MAP, _2)); -// gSavedSettings.getControl("ShowHomeButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_HOME, _2)); -// gSavedSettings.getControl("ShowMeButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_ME, _2)); -// gSavedSettings.getControl("ShowPlacesButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_PLACES, _2)); - gSavedSettings.getControl("ShowAOButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_AO, _2)); // ## Zi: Animation Overrider - gSavedSettings.getControl("ShowQuickPrefsButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_QUICKPREFS, _2)); // Quick Preferences panel -WoLf - // take care of additional sidebar button visibility -Zi - gSavedSettings.getControl("ShowPeopleButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_PEOPLE, _2)); - gSavedSettings.getControl("ShowAppearanceButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_APPEARANCE, _2)); - gSavedSettings.getControl("ShowInventoryButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_INVENTORY, _2)); - - LLButton* build_btn = getChild("build_btn"); - // set control name for Build button. It is not enough to link it with Button.SetFloaterToggle in xml - std::string vis_control_name = LLFloaterReg::declareVisibilityControl("build"); - // Set the button control value (toggle state) to the floater visibility control (Sets the value as well) - build_btn->setControlVariable(LLFloater::getControlGroup()->getControl(vis_control_name)); -} - -bool LLBottomTray::toggleShowButton(LLBottomTray::EResizeState button_type, const LLSD& new_visibility) -{ - if (LLBottomTray::instanceExists()) - { - LLBottomTray::getInstance()->setTrayButtonVisibleIfPossible(button_type, new_visibility.asBoolean()); - } - return true; -} - -bool LLBottomTray::showButton(EResizeState button_type, S32& available_width) -{ - LLPanel* panel = getButtonPanel(button_type); - if (NULL == panel) - { - return false; - } - - if (panel->getVisible()) - { - return false; - } - - // Check if none of the buttons to the left of the given one was auto-hidden. - // (we auto-show the buttons left to right). - if (!canButtonBeShown(button_type)) - { - return false; - } - - // Make sure we have enough room to show this button. - const S32 required_width = panel->getRect().getWidth(); - if (available_width < required_width) - { - lldebugs << "Need " << (required_width - available_width) << " more px to show " << resizeStateToString(button_type) << llendl; - return false; - } - - // All good. Show the button. - setTrayButtonVisible(button_type, true); - - // Let the caller know that there is now less available space. - available_width -= required_width; - - lldebugs << "Showing button " << resizeStateToString(button_type) - << ", remaining available width: " << available_width - << llendl; - setAutoHidden(button_type, false); - - return true; -} - -void LLBottomTray::setTrayButtonVisible(EResizeState shown_object_type, bool visible) -{ - LLPanel* panel = getButtonPanel(shown_object_type); - if (NULL == panel) - { - return; - } - - panel->setVisible(visible); - -// [SL:KB] - Patch: UI-BottomTray | Checked: 2010-09-07 (Catznip-2.1.2b) | Added: Catznip-2.1.2b - S32 posChatBarEnd = mNearbyChatBar->getRect().mRight; - S32 posBtnStart = -1; std::string strBtnName; - - for (state_object_map_t::iterator it = mStateProcessedObjectMap.begin(); it != mStateProcessedObjectMap.end(); ++it) - { - LLPanel* pBtnPanel = it->second; - if ( (pBtnPanel) && (pBtnPanel->getVisible()) ) - { - S32 dist = pBtnPanel->getRect().mLeft - posChatBarEnd; - if ( (dist > 0) && ((-1 == posBtnStart) || (posBtnStart > dist)) ) - { - posBtnStart = dist; - strBtnName = pBtnPanel->getName(); - } - mToolbarStack->setPanelUserResize(pBtnPanel->getName(), FALSE); - } - } - - if (!strBtnName.empty()) - mToolbarStack->setPanelUserResize(strBtnName, TRUE); -// [/SL:KB] -} - -void LLBottomTray::setTrayButtonVisibleIfPossible(EResizeState shown_object_type, bool visible, bool raise_notification) -{ - if (!setVisibleAndFitWidths(shown_object_type, visible) && visible && raise_notification) - { - LLNotificationsUtil::add("BottomTrayButtonCanNotBeShown", - LLSD(), - LLSD(), - LLNotificationFunctorRegistry::instance().DONOTHING); - } -} - -bool LLBottomTray::setVisibleAndFitWidths(EResizeState object_type, bool visible) -{ - // The Speak button is treated specially: if voice is enabled, - // the button should be displayed no matter how much space we've got. - if (object_type == RS_BUTTON_SPEAK) - { - showSpeakButton(visible); - return true; - } - - LLPanel* cur_panel = getButtonPanel(object_type); - if (NULL == cur_panel) - { - return false; - } - - bool is_set = true; - - if (visible) - { - // Assume that only chiclet panel can be auto-resized - const S32 available_width = getChicletPanelShrinkHeadroom(); - - S32 preferred_width = mObjectDefaultWidthMap[object_type]; - S32 current_width = cur_panel->getRect().getWidth(); - S32 result_width = 0; - bool decrease_width = false; - - if (preferred_width > 0 && available_width >= preferred_width) - { - result_width = preferred_width; - } - else if (available_width >= current_width) - { - result_width = current_width; - } - else - { - // Calculate the possible shrunk width as difference between current and minimal widths - const S32 chatbar_shrunk_width = - mChatBarContainer->getRect().getWidth() - get_panel_min_width(mToolbarStack, mChatBarContainer); - -// S32 sum_of_min_widths = get_panel_min_width(mToolbarStack, mSpeakPanel); -// S32 sum_of_curr_widths = get_curr_width(mSpeakPanel); -// [SL:KB] - Patch: UI-BottomTray | Checked: 2010-09-07 (Catznip-2.1.2b) | Added: Catznip-2.1.2b - S32 sum_of_min_widths = 0; - S32 sum_of_curr_widths = 0; -// [/SL:KB] - - resize_state_vec_t::const_iterator it = mButtonsProcessOrder.begin(); - const resize_state_vec_t::const_iterator it_end = mButtonsProcessOrder.end(); - - for (; it != it_end; ++it) - { - LLPanel* cur_panel = getButtonPanel(*it); - sum_of_min_widths += get_panel_min_width(mToolbarStack, cur_panel); - sum_of_curr_widths += get_curr_width(cur_panel); - } - - const S32 possible_shrunk_width = - chatbar_shrunk_width + (sum_of_curr_widths - sum_of_min_widths); - - // Minimal width of current panel - S32 minimal_width = 0; - mToolbarStack->getPanelMinSize(cur_panel->getName(), &minimal_width); - - if ( (available_width + possible_shrunk_width) >= minimal_width) - { - // There is enough space for minimal width, but set the result_width - // to preferred_width so buttons widths decreasing will be done in predefined order - result_width = (preferred_width > 0) ? preferred_width : current_width; - decrease_width = true; - } - else - { - lldebugs << "Need " << (minimal_width - available_width - possible_shrunk_width) - << " more px to show " << resizeStateToString(object_type) << llendl; - - // Make the button uppear when we have more available space. - setAutoHidden(object_type, true); - return false; - } - } - - if (result_width != current_width) - { - cur_panel->reshape(result_width, cur_panel->getRect().getHeight()); - current_width = result_width; - } - - is_set = showButton(object_type, current_width); - - // Shrink buttons if needed - if (is_set && decrease_width) - { - processWidthDecreased( -result_width); - } - } - else - { - const S32 delta_width = get_curr_width(cur_panel); - - setTrayButtonVisible(object_type, false); - - // Mark button NOT to show while future bottom tray extending - lldebugs << "Removing " << resizeStateToString(object_type) << " from mResizeState" << llendl; - setAutoHidden(object_type, false); - - // Extend other buttons if need - if (delta_width) - { - processWidthIncreased(delta_width); - } - } - return is_set; -} - -LLPanel* LLBottomTray::getButtonPanel(EResizeState button_type) -{ - // Don't use the operator[] because it inserts a NULL value if the key is not found. - if (mStateProcessedObjectMap.count(button_type) == 0) - { - llwarns << "Cannot find a panel for " << resizeStateToString(button_type) << llendl; - llassert(mStateProcessedObjectMap.count(button_type) == 1); - return NULL; - } - - return mStateProcessedObjectMap[button_type]; -} - -void LLBottomTray::showWellButton(EResizeState object_type, bool visible) -{ - llassert( ((RS_NOTIFICATION_WELL | RS_IM_WELL) & object_type) == object_type ); - - const std::string panel_name = RS_IM_WELL == object_type ? "im_well_panel" : "notification_well_panel"; - - LLView * panel = getChild(panel_name); - - // if necessary visibility is set nothing to do here - if (panel->getVisible() == (BOOL)visible) return; - - S32 panel_width = panel->getRect().getWidth(); - panel->setVisible(visible); - - if (visible) - { - // method assumes that input param is a negative value - processWidthDecreased(-panel_width); - } - else - { - processWidthIncreased(panel_width); - } -} - -void LLBottomTray::processChatbarCustomization(S32 new_width) -{ - if (NULL == mNearbyChatBar) return; - - const S32 delta_width = mChatBarContainer->getRect().getWidth() - new_width; - - if (delta_width == 0) return; - - { - static unsigned dbg_cnt = 0; - lldebugs << llformat("*** (%03d) ************************************* %d", delta_width, ++dbg_cnt) << llendl; - } - - mDesiredNearbyChatWidth = new_width; - - const S32 available_chiclet_shrink_width = getChicletPanelShrinkHeadroom(); - llassert(available_chiclet_shrink_width >= 0); - - if (delta_width > 0) // panel gets narrowly - { - S32 total_possible_width = delta_width + available_chiclet_shrink_width; - processShowButtons(total_possible_width); - processExtendButtons(total_possible_width); - } - // here (delta_width < 0) // panel gets wider - else //if (-delta_width > available_chiclet_shrink_width) - { - S32 required_width = delta_width + available_chiclet_shrink_width; - S32 buttons_freed_width = 0; - processShrinkButtons(required_width, buttons_freed_width); - processHideButtons(required_width, buttons_freed_width); - } -} - -S32 LLBottomTray::getChicletPanelShrinkHeadroom() const -{ - static const S32 min_width = mChicletPanel->getMinWidth(); - const S32 cur_width = mChicletPanel->getParent()->getRect().getWidth(); - - S32 shrink_headroom = cur_width - min_width; - llassert(shrink_headroom >= 0); // the panel cannot get narrower than the minimum - return shrink_headroom; -} - -// static -std::string LLBottomTray::resizeStateToString(EResizeState state) -{ - const char *rs_string = "UNKNOWN_BUTTON"; - - switch (state) - { - case RS_NORESIZE: rs_string = "RS_NORESIZE"; break; - case RS_CHICLET_PANEL: rs_string = "RS_CHICLET_PANEL"; break; - case RS_CHATBAR_INPUT: rs_string = "RS_CHATBAR_INPUT"; break; - case RS_BUTTON_SNAPSHOT: rs_string = "RS_BUTTON_SNAPSHOT"; break; - case RS_BUTTON_CAMERA: rs_string = "RS_BUTTON_CAMERA"; break; - case RS_BUTTON_MOVEMENT: rs_string = "RS_BUTTON_MOVEMENT"; break; - case RS_BUTTON_GESTURES: rs_string = "RS_BUTTON_GESTURES"; break; - case RS_BUTTON_SPEAK: rs_string = "RS_BUTTON_SPEAK"; break; - case RS_IM_WELL: rs_string = "RS_IM_WELL"; break; - case RS_NOTIFICATION_WELL: rs_string = "RS_NOTIFICATION_WELL"; break; - case RS_BUTTON_BUILD: rs_string = "RS_BUTTON_BUILD"; break; - case RS_BUTTON_SEARCH: rs_string = "RS_BUTTON_SEARCH"; break; - case RS_BUTTON_WORLD_MAP: rs_string = "RS_BUTTON_WORLD_MAP"; break; - case RS_BUTTON_MINI_MAP: rs_string = "RS_BUTTON_MINI_MAP"; break; - case RS_BUTTON_DESTINATIONS: rs_string = "RS_BUTTON_DESTINATIONS"; break; - case RS_BUTTON_AVATARS: rs_string = "RS_BUTTON_AVATARS"; break; - case RS_BUTTON_PEOPLE: rs_string = "RS_BUTTON_PEOPLE"; break; - case RS_BUTTON_PROFILE: rs_string = "RS_BUTTON_PROFILE"; break; - case RS_BUTTON_HOWTO: rs_string = "RS_BUTTON_HOWTO"; break; - case RS_BUTTON_SPLITTER_1: rs_string = "RS_BUTTON_SPLITTER_1"; break; -// - case RS_BUTTON_APPEARANCE: rs_string = "RS_BUTTON_APPEARANCE"; break; - case RS_BUTTON_INVENTORY: rs_string = "RS_BUTTON_INVENTORY"; break; - case RS_BUTTON_QUICKPREFS: rs_string = "RS_BUTTON_QUICKPREFS"; break; -// - case RS_BUTTON_SPLITTER_2: rs_string = "RS_BUTTON_SPLITTER_2"; break; - case RS_BUTTONS_CAN_BE_HIDDEN: rs_string = "RS_BUTTONS_CAN_BE_HIDDEN"; break; - // No default to track additions. - } - - return rs_string; -} - -// static -std::string LLBottomTray::resizeStateMaskToString(MASK mask) -{ - std::string res; - - bool add_delimiter = false; - for (U32 i = 0; i < 16; i++) - { - EResizeState state = (EResizeState) (1 << i); - if (mask & state) - { - if (!add_delimiter) - { - add_delimiter = true; - } - else - { - res += ", "; - } - - res += resizeStateToString(state); - } - } - - if (res.empty()) - { - res = resizeStateToString(RS_NORESIZE); - } - - res += llformat(" (0x%X)", mask); - return res; -} - -bool LLBottomTray::isAutoHidden(MASK button_types) const -{ - return (mResizeState & button_types) != 0; -} - -void LLBottomTray::setAutoHidden(MASK button_types, bool hide) -{ - if (hide) - { - mResizeState |= button_types; - } - else - { - mResizeState &= ~button_types; - } -} - -//EOF +/** + * @file llbottomtray.cpp + * @brief LLBottomTray class implementation + * + * $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" // must be first include + +#define LLBOTTOMTRAY_CPP +#include "llbottomtray.h" + +// library includes +#include "llfloaterreg.h" +#include "llflyoutbutton.h" +#include "lllayoutstack.h" +#include "llnotifications.h" +#include "llnotificationsutil.h" +#include "lltexteditor.h" + +// newview includes +#include "llagent.h" +#include "aoengine.h" // ## Zi: Animation Overrider +#include "llagentcamera.h" +#include "llavataractions.h" +#include "llchiclet.h" +#include "llfloatercamera.h" +#include "llhints.h" +#include "llimfloater.h" // for LLIMFloater +#include "llnearbychatbar.h" +#include "llsidetray.h" +#include "llspeakbutton.h" +#include "llsplitbutton.h" +#include "llsyswellwindow.h" +#include "lltoolmgr.h" +#include "llviewerparcelmgr.h" +#include "llsidetray.h" +#include "llviewerwindow.h" +#include "llsdserialize.h" +#include "llfirstuse.h" + +// [RLVa:KB] - Checked: 2010-09-11 (RLVa-1.2.1d) +#include "rlvhandler.h" +#include "rlvui.h" +// [/RLVa:KB] +//-TT Toggle sidebar panels and floaters +#include "llsidetraytab.h" +//-TT + +// Distance from mouse down on which drag'n'drop should be started. +#define DRAG_START_DISTANCE 3 + +static const std::string SORTING_DATA_FILE_NAME = "bottomtray_buttons_order.xml"; + +LLDefaultChildRegistry::Register bottomtray_button("bottomtray_button"); + +// LLBottomtrayButton methods + +// virtual +BOOL LLBottomtrayButton::handleHover(S32 x, S32 y, MASK mask) +{ + if (mCanDrag) + { + // pass hover to bottomtray + S32 screenX, screenY; + localPointToScreen(x, y, &screenX, &screenY); + LLBottomTray::getInstance()->onDraggableButtonHover(screenX, screenY); + + return TRUE; + } + else + { + return LLButton::handleHover(x, y, mask); + } +} +//virtual +BOOL LLBottomtrayButton::handleMouseUp(S32 x, S32 y, MASK mask) +{ + if (mCanDrag) + { + S32 screenX, screenY; + localPointToScreen(x, y, &screenX, &screenY); + // pass mouse up to bottomtray + LLBottomTray::getInstance()->onDraggableButtonMouseUp(this, screenX, screenY); + } + return LLButton::handleMouseUp(x, y, mask); +} +//virtual +BOOL LLBottomtrayButton::handleMouseDown(S32 x, S32 y, MASK mask) +{ + if (mCanDrag) + { + S32 screenX, screenY; + localPointToScreen(x, y, &screenX, &screenY); + // pass mouse up to bottomtray + LLBottomTray::getInstance()->onDraggableButtonMouseDown(this, screenX, screenY); + } + return LLButton::handleMouseDown(x, y, mask); +} + +static void update_build_button_enable_state() +{ +// bool can_edit = LLToolMgr::getInstance()->canEdit(); +// [RLVa:KB] - Checked: 2010-09-11 (RLVa-1.2.1d) | Added: RLVa-1.2.1d + bool can_edit = RlvUIEnabler::isBuildEnabled(); +// [/RLVa:KB] + + LLBottomTray::getInstance()->getChildView("build_btn")->setEnabled(can_edit); +} + +// Build time optimization, generate extern template once in .cpp file +template class LLBottomTray* LLSingleton::getInstance(); + +namespace +{ + const std::string& PANEL_CHICLET_NAME = "chiclet_list_panel"; + + S32 get_panel_min_width(LLLayoutStack* stack, LLView* panel) + { + S32 minimal_width = 0; + llassert(stack); + if ( stack && panel && panel->getVisible() ) + { + stack->getPanelMinSize(panel->getName(), &minimal_width); + } + return minimal_width; + } + + S32 get_panel_max_width(LLLayoutStack* stack, LLPanel* panel) + { + S32 max_width = 0; + llassert(stack); + if ( stack && panel && panel->getVisible() ) + { + stack->getPanelMaxSize(panel->getName(), &max_width); + } + return max_width; + } + + S32 get_curr_width(LLUICtrl* ctrl) + { + S32 cur_width = 0; + if ( ctrl && ctrl->getVisible() ) + { + cur_width = ctrl->getRect().getWidth(); + } + return cur_width; + } +} + +class LLBottomTrayLite + : public LLPanel +{ +public: + LLBottomTrayLite() + : mNearbyChatBar(NULL), + mChatBarContainer(NULL), + mGesturePanel(NULL) + { + mFactoryMap["chat_bar"] = LLCallbackMap(LLBottomTray::createNearbyChatBar, NULL); + buildFromFile("panel_bottomtray_lite.xml"); + } + + BOOL postBuild() + { + mNearbyChatBar = findChild("chat_bar"); + mChatBarContainer = getChild("chat_bar_layout_panel"); + mGesturePanel = getChild("gesture_panel"); + + // Hide "show_nearby_chat" button + if (mNearbyChatBar) + { + LLLineEditor* chat_box = mNearbyChatBar->getChatBox(); + LLUICtrl* show_btn = mNearbyChatBar->getChild("show_nearby_chat"); + S32 delta_width = show_btn->getRect().getWidth(); + show_btn->setVisible(FALSE); + chat_box->reshape(chat_box->getRect().getWidth() + delta_width, chat_box->getRect().getHeight()); + } + return TRUE; + } + + void onFocusLost() + { + if (gAgentCamera.cameraMouselook()) + { + LLBottomTray::getInstance()->setVisible(FALSE); + } + } + + LLNearbyChatBar* mNearbyChatBar; + LLLayoutPanel* mChatBarContainer; + LLPanel* mGesturePanel; +}; + +LLBottomTray::LLBottomTray(const LLSD&) +: mChicletPanel(NULL), + mSpeakPanel(NULL), + mSpeakBtn(NULL), + mNearbyChatBar(NULL), + mChatBarContainer(NULL), + mNearbyCharResizeHandlePanel(NULL), + mToolbarStack(NULL), + mMovementButton(NULL), + mResizeState(RS_NORESIZE), + mBottomTrayContextMenu(NULL), + mCamButton(NULL), + mBottomTrayLite(NULL), + mIsInLiteMode(false), + mDragStarted(false), + mDraggedItem(NULL), + mLandingTab(NULL), + mCheckForDrag(false) +{ + // Firstly add our self to IMSession observers, so we catch session events + // before chiclets do that. + LLIMMgr::getInstance()->addSessionObserver(this); + + mFactoryMap["chat_bar"] = LLCallbackMap(LLBottomTray::createNearbyChatBar, NULL); + + buildFromFile("panel_bottomtray.xml"); + + LLUICtrl::CommitCallbackRegistry::defaultRegistrar().add("CameraPresets.ChangeView", boost::bind(&LLFloaterCamera::onClickCameraItem, _2)); + + //this is to fix a crash that occurs because LLBottomTray is a singleton + //and thus is deleted at the end of the viewers lifetime, but to be cleanly + //destroyed LLBottomTray requires some subsystems that are long gone + //LLUI::getRootView()->addChild(this); + + { + mBottomTrayLite = new LLBottomTrayLite(); + mBottomTrayLite->setFollowsAll(); + mBottomTrayLite->setVisible(FALSE); + } + + mImageDragIndication = LLUI::getUIImage(getString("DragIndicationImageName")); + mDesiredNearbyChatWidth = mNearbyChatBar ? mNearbyChatBar->getRect().getWidth() : 0; +} + +LLBottomTray::~LLBottomTray() +{ + if (!LLSingleton::destroyed()) + { + LLIMMgr::getInstance()->removeSessionObserver(this); + } + + if (mNearbyChatBar) + { + // store custom width of chatbar panel. + S32 custom_width = mChatBarContainer->getRect().getWidth(); + gSavedSettings.setS32("ChatBarCustomWidth", custom_width); + } + + // emulate previous floater behavior to be hidden on startup. + // override effect of save_visibility=true. + // this attribute is necessary to button.initial_callback=Button.SetFloaterToggle works properly: + // i.g when floater changes its visibility - button changes its toggle state. + getChild("build_btn")->setControlValue(false); + getChild("search_btn")->setControlValue(false); + getChild("world_map_btn")->setControlValue(false); +} + +// *TODO Vadim: why void* ? +void* LLBottomTray::createNearbyChatBar(void* userdata) +{ + return new LLNearbyChatBar(); +} + +LLNearbyChatBar* LLBottomTray::getNearbyChatBar() +{ + return mIsInLiteMode ? mBottomTrayLite->mNearbyChatBar : mNearbyChatBar; +} + +LLIMChiclet* LLBottomTray::createIMChiclet(const LLUUID& session_id) +{ + LLIMChiclet::EType im_chiclet_type = LLIMChiclet::getIMSessionType(session_id); + + switch (im_chiclet_type) + { + case LLIMChiclet::TYPE_IM: + return getChicletPanel()->createChiclet(session_id); + case LLIMChiclet::TYPE_GROUP: + return getChicletPanel()->createChiclet(session_id); + case LLIMChiclet::TYPE_AD_HOC: + return getChicletPanel()->createChiclet(session_id); + case LLIMChiclet::TYPE_UNKNOWN: + break; + } + + return NULL; +} + +//virtual +void LLBottomTray::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) +{ + if (!getChicletPanel()) return; + + LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(session_id); + if (!session) return; + + // no need to spawn chiclets for participants in P2P calls called through Avaline + if (session->isP2P() && session->isOtherParticipantAvaline()) return; + + if (getChicletPanel()->findChiclet(session_id)) return; + + LLIMChiclet* chiclet = createIMChiclet(session_id); + if(chiclet) + { + chiclet->setIMSessionName(name); + chiclet->setOtherParticipantId(other_participant_id); + + LLIMFloater::onIMChicletCreated(session_id); + + } + else + { + llerrs << "Could not create chiclet" << llendl; + } +} + +//virtual +void LLBottomTray::sessionRemoved(const LLUUID& session_id) +{ + if(getChicletPanel()) + { + // IM floater should be closed when session removed and associated chiclet closed + LLIMFloater* iMfloater = LLFloaterReg::findTypedInstance( + "impanel", session_id); + if (iMfloater != NULL) + { + iMfloater->closeFloater(); + } + + getChicletPanel()->removeChiclet(session_id); + } +} + +void LLBottomTray::sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id) +{ + //this is only needed in case of outgoing ad-hoc/group chat sessions + LLChicletPanel* chiclet_panel = getChicletPanel(); + if (chiclet_panel) + { + //it should be ad-hoc im chiclet or group im chiclet + LLChiclet* chiclet = chiclet_panel->findChiclet(old_session_id); + if (chiclet) chiclet->setSessionId(new_session_id); + } +} + +S32 LLBottomTray::getTotalUnreadIMCount() +{ + return getChicletPanel()->getTotalUnreadIMCount(); +} + +// virtual +void LLBottomTray::onChange(EStatusType status, const std::string &channelURI, bool proximal) +{ + // Time it takes to connect to voice channel might be pretty long, + // so don't expect user login or STATUS_VOICE_ENABLED to be followed by STATUS_JOINED. + BOOL enable = FALSE; + + switch (status) + { + // Do not add STATUS_VOICE_ENABLED because voice chat is + // inactive until STATUS_JOINED + case STATUS_JOINED: + enable = TRUE; + break; + default: + enable = FALSE; + break; + } + + // We have to enable/disable right and left parts of speak button separately (EXT-4648) + getChild("speak_btn")->setEnabled(enable); + + // skipped to avoid button blinking + if (status != STATUS_JOINING && status!= STATUS_LEFT_CHANNEL) + { + bool voice_status = LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking(); + getChild("speak_flyout_btn")->setEnabled(voice_status); + if (voice_status) + { + LLFirstUse::speak(true); + } + } +} + +// [SL:KB] - Patch: UI-BottomTray | Checked: 2010-11-26 (Catznip-2.4.0f) | Modified: Catznip-2.4.0f +bool LLBottomTray::handleVoiceEnabledToggle(const LLSD& newvalue) +{ + //-TT 2.6.9 - voice enabled toggle vs. just hiding the button. needs care + gSavedSettings.setBOOL("EnableVoiceChat", newvalue.asBoolean()); + return true; +} +// [/SL:KB] + +void LLBottomTray::onMouselookModeOut() +{ + mIsInLiteMode = false; + mBottomTrayLite->setVisible(FALSE); + mNearbyChatBar->getChatBox()->setText(mBottomTrayLite->mNearbyChatBar->getChatBox()->getText()); + setVisible(TRUE); +} + +void LLBottomTray::onMouselookModeIn() +{ + setVisible(FALSE); + + // Attach the lite bottom tray + if (getParent() && mBottomTrayLite->getParent() != getParent()) + getParent()->addChild(mBottomTrayLite); + + mBottomTrayLite->setShape(getLocalRect()); + mBottomTrayLite->mNearbyChatBar->getChatBox()->setText(mNearbyChatBar->getChatBox()->getText()); + mBottomTrayLite->mGesturePanel->setVisible(gSavedSettings.getBOOL("ShowGestureButton")); + + mIsInLiteMode = true; +} + +//virtual +// setVisible used instead of onVisibilityChange, since LLAgent calls it on entering/leaving mouselook mode. +// If bottom tray is already visible in mouselook mode, then onVisibilityChange will not be called from setVisible(true), +void LLBottomTray::setVisible(BOOL visible) +{ + if (mIsInLiteMode) + { + mBottomTrayLite->setVisible(visible); + } + else + { + LLPanel::setVisible(visible); + } + //-TT 2.6.9 - removed? + //if(visible) + // gFloaterView->setSnapOffsetBottom(getRect().getHeight()); + //else + // gFloaterView->setSnapOffsetBottom(0); +} + +S32 LLBottomTray::notifyParent(const LLSD& info) +{ + if(info.has("well_empty")) // implementation of EXT-3397 + { + const std::string chiclet_name = info["well_name"]; + + // only "im_well" or "notification_well" names are expected. + // They are set in panel_bottomtray.xml in & + llassert("im_well" == chiclet_name || "notification_well" == chiclet_name); + + BOOL should_be_visible = !info["well_empty"]; + showWellButton("im_well" == chiclet_name ? RS_IM_WELL : RS_NOTIFICATION_WELL, should_be_visible); + return 1; + } + + if (info.has("action") && info["action"] == "resize") + { + const std::string& name = info["view_name"]; + + // expected only resize of nearby chatbar + if (mChatBarContainer->getName() != name) return LLPanel::notifyParent(info); + + const S32 new_width = info["new_width"]; + + processChatbarCustomization(new_width); + + return 2; + } + return LLPanel::notifyParent(info); +} + +void LLBottomTray::showBottomTrayContextMenu(S32 x, S32 y, MASK mask) +{ + // We should show BottomTrayContextMenu in last turn + if (mBottomTrayContextMenu && !LLMenuGL::sMenuContainer->getVisibleMenu()) + { + //there are no other context menu (IM chiclet etc ), so we can show BottomTrayContextMenu + + updateContextMenu(x, y, mask); + mBottomTrayContextMenu->buildDrawLabels(); + mBottomTrayContextMenu->updateParent(LLMenuGL::sMenuContainer); + LLMenuGL::showPopup(this, mBottomTrayContextMenu, x, y); + + } +} + +void LLBottomTray::updateContextMenu(S32 x, S32 y, MASK mask) +{ + LLUICtrl* edit_box = mNearbyChatBar->getChild("chat_box"); + + S32 local_x = x - mChatBarContainer->getRect().mLeft - edit_box->getRect().mLeft; + S32 local_y = y - mChatBarContainer->getRect().mBottom - edit_box->getRect().mBottom; + + bool in_edit_box = edit_box->pointInView(local_x, local_y); + + mBottomTrayContextMenu->setItemVisible("Separator", in_edit_box); + mBottomTrayContextMenu->setItemVisible("NearbyChatBar_Cut", in_edit_box); + mBottomTrayContextMenu->setItemVisible("NearbyChatBar_Copy", in_edit_box); + mBottomTrayContextMenu->setItemVisible("NearbyChatBar_Paste", in_edit_box); + mBottomTrayContextMenu->setItemVisible("NearbyChatBar_Delete", in_edit_box); + mBottomTrayContextMenu->setItemVisible("NearbyChatBar_Select_All", in_edit_box); +} +//void LLBottomTray::showVoiceButton(BOOL visible) +//{ +// setTrayButtonVisibleIfPossible(RS_BUTTON_SPEAK, visible); +//} + +void LLBottomTray::showSpeakButton(bool visible) +{ + // Show/hide the button + setTrayButtonVisible(RS_BUTTON_SPEAK, visible); + + // and adjust other panels according to the occupied/freed space. + const S32 panel_width = mSpeakPanel->getRect().getWidth(); + if (visible) + { + processWidthDecreased(-panel_width); + } + else + { + processWidthIncreased(panel_width); + } +} + +void LLBottomTray::toggleMovementControls() +{ + if (mMovementButton) + mMovementButton->onCommit(); +} + +void LLBottomTray::toggleCameraControls() +{ + if (mCamButton) + mCamButton->onCommit(); +} + +// ## Zi: Animation Overrider +void LLBottomTray::toggleAO() +{ + BOOL yes=mAOToggleButton->getToggleState(); + AOEngine::getInstance()->enable(yes); + gSavedPerAccountSettings.setBOOL("UseAO",yes); +} +// ## Zi: Animation Overrider + +BOOL LLBottomTray::postBuild() +{ + LLHints::registerHintTarget("bottom_tray", LLView::getHandle()); + LLHints::registerHintTarget("dest_guide_btn", getChild("destination_btn")->getHandle()); + LLHints::registerHintTarget("avatar_picker_btn", getChild("avatar_btn")->getHandle()); + + LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("NearbyChatBar.Action", boost::bind(&LLBottomTray::onContextMenuItemClicked, this, _2)); + LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("NearbyChatBar.EnableMenuItem", boost::bind(&LLBottomTray::onContextMenuItemEnabled, this, _2)); + + mBottomTrayContextMenu = LLUICtrlFactory::getInstance()->createFromFile("menu_bottomtray.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); + gMenuHolder->addChild(mBottomTrayContextMenu); + + mNearbyChatBar = findChild("chat_bar"); + LLHints::registerHintTarget("chat_bar", mNearbyChatBar->LLView::getHandle()); + + mChatBarContainer = getChild("chat_bar_layout_panel"); + mNearbyCharResizeHandlePanel = getChild("chat_bar_resize_handle_panel"); + + mToolbarStack = getChild("toolbar_stack"); + mMovementButton = getChild("movement_btn"); + LLHints::registerHintTarget("move_btn", mMovementButton->getHandle()); + mCamButton = getChild("camera_btn"); + setRightMouseDownCallback(boost::bind(&LLBottomTray::showBottomTrayContextMenu,this, _2, _3,_4)); + + mSpeakPanel = getChild("speak_panel"); + mSpeakBtn = findChild("talk"); + if (mSpeakBtn) + { + LLHints::registerHintTarget("speak_btn", mSpeakBtn->getHandle()); + + // Localization tool doesn't understand custom buttons like + mSpeakBtn->setSpeakToolTip( getString("SpeakBtnToolTip") ); + mSpeakBtn->setShowToolTip( getString("VoiceControlBtnToolTip") ); + } + else + { + LLTransientFloaterMgr::getInstance()->addControlView(getChild("speak_btn")); + LLTransientFloaterMgr::getInstance()->addControlView(getChild("flyout_btn")); + } + + + // Both parts of speak button should be initially disabled because + // it takes some time between logging in to world and connecting to voice channel. + getChild("speak_btn")->setEnabled(false); + getChild("speak_flyout_btn")->setEnabled(false); + + + // Registering Chat Bar to receive Voice client status change notifications. + LLVoiceClient::getInstance()->addObserver(this); +// [SL:KB] - Patch: UI-BottomTray | Checked: 2010-09-07 (Catznip-2.1.2b) | Added: Catznip-2.1.2b + gSavedSettings.getControl("ShowSpeakButton")->getSignal()->connect(boost::bind(&LLBottomTray::handleVoiceEnabledToggle, _2)); +// [/SL:KB] + + mNearbyChatBar->getChatBox()->setContextMenu(NULL); + + mChicletPanel = getChild("chiclet_list"); + + initResizeStateContainers(); + + setButtonsControlsAndListeners(); + + initButtonsVisibility(); + + // update wells visibility: + showWellButton(RS_IM_WELL, !LLIMWellWindow::getInstance()->isWindowEmpty()); + showWellButton(RS_NOTIFICATION_WELL, !LLNotificationWellWindow::getInstance()->isWindowEmpty()); + + loadButtonsOrder(); + + LLViewerParcelMgr::getInstance()->addAgentParcelChangedCallback(boost::bind(&update_build_button_enable_state)); + + // Explicitly wire up buttons for sidebar callbacks + getChild("sidebar_home_btn")->setCommitCallback(boost::bind(&LLBottomTray::showSidebarPanel, this, "panel_home")); + getChild("sidebar_me_btn")->setCommitCallback(boost::bind(&LLBottomTray::showSidebarPanel, this, "panel_me")); + getChild("sidebar_people_btn")->setCommitCallback(boost::bind(&LLBottomTray::showSidebarPanel, this, "panel_people")); + getChild("sidebar_places_btn")->setCommitCallback(boost::bind(&LLBottomTray::showSidebarPanel, this, "panel_places")); + getChild("sidebar_appearance_btn")->setCommitCallback(boost::bind(&LLBottomTray::showSidebarPanel, this, "sidepanel_appearance")); + getChild("sidebar_inv_btn")->setCommitCallback(boost::bind(&LLBottomTray::showSidebarPanel, this, "sidepanel_inventory")); + // ## Zi: Animation Overrider + mAOToggleButton=getChild("ao_toggle_btn"); + mAOToggleButton->setCommitCallback(boost::bind(&LLBottomTray::toggleAO,this)); + mAOToggleButton->setToggleState(gSavedPerAccountSettings.getBOOL("UseAO")); + // ## Zi: Animation Overrider + return TRUE; +} + +//Drag-n-drop + +void LLBottomTray::onDraggableButtonMouseDown(LLUICtrl* ctrl, S32 x, S32 y) +{ + if (ctrl == NULL) return; + LLView* parent_view = ctrl->getParent(); + if(parent_view != NULL) + { + // we actually drag'n'drop panel (not button) in code, so have to find a parent + // of button which called this method on mouse down. + LLPanel* parent = dynamic_cast(parent_view); + // It may happen that we clicked not usual button, but button inside widget(speak, gesture) + // so we'll need to get a level higher to reach layout panel as a parent. + if(parent == NULL) parent = dynamic_cast(parent_view->getParent()); + if (parent && parent->getVisible()) + { + mDraggedItem = parent; + mCheckForDrag = true; + mStartX = x; + mStartY = y; + } + } +} + +LLPanel* LLBottomTray::findChildPanelByLocalCoords(S32 x, S32 y) +{ + LLPanel* ctrl = 0; + S32 screenX, screenY; + const child_list_t* list = mToolbarStack->getChildList(); + + localPointToScreen(x, y, &screenX, &screenY); + + // look for a child panel which contains the point (screenX, screenY) in it's rectangle + for (child_list_const_iter_t i = list->begin(); i != list->end(); ++i) + { + LLRect rect; + localRectToScreen((*i)->getRect(), &rect); + + if (rect.pointInRect(screenX, screenY)) + { + ctrl = dynamic_cast(*i); + break; + } + } + + return ctrl; +} + +void LLBottomTray::onDraggableButtonHover(S32 x, S32 y) +{ + // if mouse down on draggable item was done, check whether we should start DnD + if (mCheckForDrag) + { + // Start drag'n'drop if mouse cursor was dragged away frome mouse down location enough + if(sqrt((float)((mStartX-x)*(mStartX-x)+(mStartY-y)*(mStartY-y))) > DRAG_START_DISTANCE) + { + mDragStarted = true; + mCheckForDrag = false; + } + } + if (mDragStarted) + { + // Check whether the cursor is over draggable area, find which panel it is and set is as + // landing tab for drag'n'drop + if(isCursorOverDraggableArea(x, y)) + { + LLPanel* panel = findChildPanelByLocalCoords(x,y); + if (panel && panel != mDraggedItem) mLandingTab = panel; + gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROWDRAG); + } + else + { + gViewerWindow->getWindow()->setCursor(UI_CURSOR_NO); + } + } + else + { + // Reset cursor in case you move your mouse from the drag handle to a button. + getWindow()->setCursor(UI_CURSOR_ARROW); + + } +} + +bool LLBottomTray::isCursorOverDraggableArea(S32 x, S32 y) +{ + // Draggable area lasts from the nearby chat input resize handle + // to the chiclet area (exlusively). + bool result = getRect().pointInRect(x, y); + result = result && mNearbyCharResizeHandlePanel->calcScreenRect().mRight < x; + result = result && mChicletPanel->calcScreenRect().mRight > x; + return result; +} + +void LLBottomTray::updateButtonsOrdersAfterDnD() +{ + // *TODO: change implementation of this method to support simplify it + // (and according to future possible changes in the way button order is saved between sessions). + state_object_map_t::const_iterator it = mStateProcessedObjectMap.begin(); + state_object_map_t::const_iterator it_end = mStateProcessedObjectMap.end(); + // Speak button is currently the only draggable button not in mStateProcessedObjectMap, + // so if dragged_state is not found in that map, it should be RS_BUTTON_SPEAK. Change this code if any other + // exclusions from mStateProcessedObjectMap will become draggable. +// EResizeState dragged_state = RS_BUTTON_SPEAK; +// [SL:KB] - Patch: UI-BottomTray | Checked: 2010-12-02 (Catznip-2.4.0g) | Added: Catznip-2.4.0g + EResizeState dragged_state = RS_NORESIZE; +// [/SL:KB] + EResizeState landing_state = RS_NORESIZE; + bool landing_state_found = false; + // Find states for dragged item and landing tab + for (; it != it_end; ++it) + { + if (it->second == mDraggedItem) + { + dragged_state = it->first; + } + else if (it->second == mLandingTab) + { + landing_state = it->first; + landing_state_found = true; + } + } + + if (dragged_state == RS_NORESIZE) + { + llwarns << "Cannot determine what button is being dragged" << llendl; + llassert(dragged_state != RS_NORESIZE); + return; + } + + lldebugs << "Will place " << resizeStateToString(dragged_state) + << " before " << resizeStateToString(landing_state) << llendl; + + // Update order of buttons according to drag'n'drop + // Make sure to check if the button we want to move is actually known to the system -Zi + resize_state_vec_t::iterator position=std::find(mButtonsOrder.begin(), mButtonsOrder.end(), dragged_state); + if(position==mButtonsOrder.end()) + { + llwarns << "Could not find " << dragged_state << " in mButtonsOrder!" << llendl; + return; + } + mButtonsOrder.erase(position); + if (!landing_state_found && mLandingTab == getChild(PANEL_CHICLET_NAME)) + { + mButtonsOrder.push_back(dragged_state); + } + else + { +//-TT 2.6.9- why is commented out? +// if (!landing_state_found) landing_state = RS_BUTTON_SPEAK; + mButtonsOrder.insert(std::find(mButtonsOrder.begin(), mButtonsOrder.end(), landing_state), dragged_state); + } + + // Synchronize button process order with their order +// resize_state_vec_t::const_iterator it1 = mButtonsOrder.begin(); +// const resize_state_vec_t::const_iterator it_end1 = mButtonsOrder.end(); +// resize_state_vec_t::iterator it2 = mButtonsProcessOrder.begin(); +// for (; it1 != it_end1; ++it1) +// { +// // Skip Speak because it is not in mButtonsProcessOrder(it's the reason why mButtonsOrder was introduced). +// // If any other draggable items will be added to bottomtray later, they should also be skipped here. +// if (*it1 != RS_BUTTON_SPEAK) +// { +// *it2 = *it1; +// ++it2; +// } +// } +// [SL:KB] - Patch: UI-BottomTray | Checked: 2010-12-02 (Catznip-2.4.0g) | Added: Catznip-2.4.0g + mButtonsProcessOrder = mButtonsOrder; +// [/SL:KB] + + saveButtonsOrder(); +} + +void LLBottomTray::saveButtonsOrder() +{ + if (!gSavedSettings.getBOOL("AllowBottomTrayButtonReordering")) return; + + std::string user_dir = gDirUtilp->getLindenUserDir(); + if (user_dir.empty()) return; + + std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, SORTING_DATA_FILE_NAME); + LLSD settings_llsd; + int i = 0; + const resize_state_vec_t::const_iterator it_end = mButtonsOrder.end(); + // we use numbers as keys for map which is saved in file and contains resize states as its values + for (resize_state_vec_t::const_iterator it = mButtonsOrder.begin(); it != it_end; ++it, i++) + { + std::string str = llformat("%d", i); + settings_llsd[str] = *it; + } + llofstream file; + file.open(filename); + LLSDSerialize::toPrettyXML(settings_llsd, file); +} + +void LLBottomTray::loadButtonsOrder() +{ + if (!gSavedSettings.getBOOL("AllowBottomTrayButtonReordering")) return; + + // load per-resident sorting information + std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, SORTING_DATA_FILE_NAME); + + LLSD settings_llsd; + llifstream file; + file.open(filename); + if (!file.is_open()) return; + + LLSDSerialize::fromXML(settings_llsd, file); + + // clear out one of the two internal lists, the second will be used to compare the buttons later -Zi + mButtonsProcessOrder.clear(); + int i = 0; + // getting button order from file + for (LLSD::map_const_iterator iter = settings_llsd.beginMap(); + iter != settings_llsd.endMap(); ++iter, ++i) + { + std::string str = llformat("%d", i); + EResizeState state = (EResizeState)settings_llsd[str].asInteger(); +// [SL:KB] - Patch: UI-BottomTray | Checked: 2010-12-02 (Catznip-2.4.0g) | Added: Catznip-2.4.0g + mButtonsProcessOrder.push_back(state); +// [/SL:KB] + + // remove button from internal list to remember we found the button in the XML file -Zi + resize_state_vec_t::iterator position=std::find(mButtonsOrder.begin(), mButtonsOrder.end(), state); + if(position!=mButtonsOrder.end()) + mButtonsOrder.erase(position); + } + + // add buttons that are missing in the XML file to the second internal list -Zi + while(mButtonsOrder.size()) + { + mButtonsProcessOrder.push_back(*(mButtonsOrder.end()-1)); + mButtonsOrder.pop_back(); + } + + // copy the second internal list to the first -Zi + mButtonsOrder=mButtonsProcessOrder; + + // There are other panels in layout stack order of which is not saved. Also, panels order of which is saved, + // are already in layout stack but in wrong order. The most convenient way to place them is moving them + // to front one by one (because in this case we don't have to pass the panel before which we want to insert our + // panel to movePanel()). So panels are moved in order from the end of mButtonsOrder vector(reverse iterator is used). + const resize_state_vec_t::const_reverse_iterator it_end = mButtonsOrder.rend(); + // placing panels in layout stack according to button order which we loaded in previous for + for (resize_state_vec_t::const_reverse_iterator it = mButtonsOrder.rbegin(); it != it_end; ++it, ++i) + { + LLPanel* panel_to_move = getButtonPanel(*it); + mToolbarStack->movePanel(panel_to_move, NULL, true); // prepend + } + // Nearbychat is not stored in order settings file, but it must be the first of the panels, so moving it + // (along with its drag handle) manually here. + mToolbarStack->movePanel(getChild("chat_bar_resize_handle_panel"), NULL, true); + mToolbarStack->movePanel(mChatBarContainer, NULL, true); +} + +void LLBottomTray::onDraggableButtonMouseUp(LLUICtrl* ctrl, S32 x, S32 y) +{ + //if mouse up happened over area where drop is possible, change order of buttons + if (mLandingTab != NULL && mDraggedItem != NULL && mDragStarted) + { + if(isCursorOverDraggableArea(x, y)) + { + // change order of panels in layout stack + mToolbarStack->movePanel(mDraggedItem, (LLPanel*)mLandingTab); + // change order of buttons in order vectors + updateButtonsOrdersAfterDnD(); + } + } + gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW); + mDragStarted = false; + mDraggedItem = NULL; + mLandingTab = NULL; + mCheckForDrag = false; +} + +void LLBottomTray::draw() +{ + LLPanel::draw(); + if (mLandingTab) + { + static S32 w = mImageDragIndication->getWidth(); + static S32 h = mImageDragIndication->getHeight(); + LLRect rect = mLandingTab->calcScreenRect(); + mImageDragIndication->draw(rect.mLeft - w/2, rect.getHeight(), w, h); + } + getChild("show_profile_btn")->setToggleState(LLAvatarActions::profileVisible(gAgent.getID())); + + LLPanel* panel = LLSideTray::getInstance()->getPanel("panel_people"); + if (panel && panel->isInVisibleChain()) + { + getChild("show_people_button")->setToggleState(true); + } + else + { + getChild("show_people_button")->setToggleState(false); + } + + LLFloater* help_browser = (LLFloaterReg::findInstance("help_browser")); + bool help_floater_visible = (help_browser && help_browser->isInVisibleChain()); + + getChild("show_help_btn")->setToggleState(help_floater_visible); + + bool openmic = LLVoiceClient::getInstance()->getUserPTTState(); + bool voiceenabled = LLVoiceClient::getInstance()->voiceEnabled(); + getChild("speak_btn")->setToggleState(openmic && voiceenabled); + getChild("chat_zone_indicator")->setIsMuted(!voiceenabled); + +} + +bool LLBottomTray::onContextMenuItemEnabled(const LLSD& userdata) +{ + std::string item = userdata.asString(); + LLLineEditor* edit_box = mNearbyChatBar->findChild("chat_box"); + + if (item == "can_cut") + { + return edit_box->canCut(); + } + else if (item == "can_copy") + { + return edit_box->canCopy(); + } + else if (item == "can_paste") + { + return edit_box->canPaste(); + } + else if (item == "can_delete") + { + return edit_box->canDoDelete(); + } + else if (item == "can_select_all") + { + return edit_box->canSelectAll() && (edit_box->getLength()>0); + } + return true; +} + + +// used to manage the bottom bar icons specific to sidebar panels. +// AO: A bit hacky and might be better in another place. +void LLBottomTray::showSidebarPanel(const LLSD& panel_name) +{ + LLSD param; + LLSideTray* sb = LLSideTray::getInstance(); + LLButton* btn = NULL; + std::string tab_name = ""; + std::string master_panel_name = panel_name; + + + // map buttons to specific values that are useful for detection & comparisons + if (master_panel_name == "panel_people") + { + param["people_panel_tab_name"] = "nearby_panel"; + tab_name = "sidebar_people"; + btn = getChild("sidebar_people_btn"); + master_panel_name = "panel_container_people"; + } + else if (master_panel_name == "panel_me") + { + tab_name = "sidebar_me"; + btn = getChild("sidebar_me_btn"); + master_panel_name = "panel_container_me"; + } + else if (master_panel_name == "panel_home") + { + tab_name = "sidebar_home"; + btn = getChild("sidebar_home_btn"); + } + else if (master_panel_name == "panel_places") + { + tab_name = "sidebar_places"; + btn = getChild("sidebar_places_btn"); + } + else if (master_panel_name == "sidepanel_appearance") + { + tab_name = "sidebar_appearance"; + btn = getChild("sidebar_appearance_btn"); + } + else if (master_panel_name == "sidepanel_inventory") + { + tab_name = "sidebar_inventory"; + btn = getChild("sidebar_inv_btn"); + } + + // toggle minimization undocked + LLFloater* floater_tab = LLFloaterReg::getInstance("side_bar_tab", tab_name); + if (LLFloater::isShown(floater_tab)) + { +//-TT Toggle sidebar panels and floaters - added state toggle and combined the cases + bool isMinimized = floater_tab->isMinimized(); + if (btn) + { + //btn->setToggleState(isMinimized); + btn->setForcePressedState(isMinimized); + //const LLSD& sdName(tab_name); + //// Set the clicked callback to toggle the floater + //btn->setClickedCallback(boost::bind(&LLFloaterReg::toggleFloaterInstance, sdName)); + } + floater_tab->setMinimized(!isMinimized); + } + // toggle collapsing sidebar if active & docked + else + { + if (sb->isPanelActive(master_panel_name)) + { + sb->collapseSideBar(); + //btn->setToggleState(false); + } + else + { + sb->showPanel(panel_name, param); + //btn->setToggleState(true); + } +//-TT Toggle sidebar panels with buttons + if (btn) + { + // Set the clicked callback to toggle the sidebar + //btn->setClickedCallback(boost::bind(&LLSideTrayTab::toggleSidebarTabInstance, sdName)); + } + } + + //const LLSD& sdName(panel_name); + //std::string vis_control_name = LLSideTrayTab::declareVisibilityControl(sdname.asString()); + // Set the button control value (toggle state) to the floater visibility control (Sets the value as well) + //btn->setControlVariable(LLSideTray::getInstance()->getPanel(sdName)); + // Set the clicked callback to toggle the floater + //btn->setClickedCallback(boost::bind(&LLSideTrayTab::toggleSidebarTabInstance, sdName)); + //btn->toggleState(); +//-TT +} + +void LLBottomTray::onContextMenuItemClicked(const LLSD& userdata) +{ + std::string item = userdata.asString(); + LLLineEditor* edit_box = mNearbyChatBar->findChild("chat_box"); + + if (item == "cut") + { + edit_box->cut(); + } + else if (item == "copy") + { + edit_box->copy(); + } + else if (item == "paste") + { + edit_box->paste(); + edit_box->setFocus(TRUE); + } + else if (item == "delete") + { + edit_box->doDelete(); + } + else if (item == "select_all") + { + edit_box->selectAll(); + } +} + +void LLBottomTray::log(LLView* panel, const std::string& descr) +{ + if (NULL == panel) return; + LLView* layout = panel->getParent(); + LL_DEBUGS("Bottom Tray Rects") << descr << ": " + << "panel: " << panel->getName() + << ", rect: " << panel->getRect() + + + << " layout: " << layout->getName() + << ", rect: " << layout->getRect() + << LL_ENDL; +} + +void LLBottomTray::reshape(S32 width, S32 height, BOOL called_from_parent) +{ + static S32 debug_calling_number = 0; + lldebugs << "**************************************** " << ++debug_calling_number << llendl; + + S32 current_width = getRect().getWidth(); + S32 delta_width = width - current_width; + lldebugs << "Reshaping: " + << ", width: " << width + << ", cur width: " << current_width + << ", delta_width: " << delta_width + << ", called_from_parent: " << called_from_parent + << llendl; + + if (mNearbyChatBar) log(mNearbyChatBar, "before"); + if (mChicletPanel) log(mChicletPanel, "before"); + + // Difference between bottom tray width required to fit its children and the actual width. (see EXT-991) + // Positive value means that bottom tray is not wide enough. + // Negative value means that there is free space. + static S32 extra_shrink_width = 0; + bool should_be_reshaped = true; + + if (mChicletPanel && mToolbarStack && mNearbyChatBar) + { + // Firstly, update layout stack to ensure we deal with correct panel sizes. + { + BOOL saved_anim = mToolbarStack->getAnimate(); + // Set chiclet panel to be autoresized by default. + mToolbarStack->updatePanelAutoResize(PANEL_CHICLET_NAME, TRUE); + // Disable animation to prevent layout updating in several frames. + mToolbarStack->setAnimate(FALSE); + // Force the updating of layout to reset panels collapse factor. + mToolbarStack->updateLayout(); + // Restore animate state. + mToolbarStack->setAnimate(saved_anim); + } + + // bottom tray is narrowed + if (delta_width < 0) + { + if (extra_shrink_width > 0) // not enough space + { + extra_shrink_width += llabs(delta_width); + should_be_reshaped = false; + } + else + { + extra_shrink_width = processWidthDecreased(delta_width); + + // increase new width to extra_shrink_width value to not reshape less than bottom tray minimum + width += extra_shrink_width; + } + } + // bottom tray is widened + else + { + if (extra_shrink_width > delta_width) + { + // Still not enough space. + // Only subtract the delta from the required delta and don't reshape. + extra_shrink_width -= delta_width; + should_be_reshaped = false; + } + else + { + if (extra_shrink_width > 0) + { + // If we have some extra shrink width let's reduce delta_width & width + delta_width -= extra_shrink_width; + width -= extra_shrink_width; + extra_shrink_width = 0; + } + processWidthIncreased(delta_width); + } + } + } + + if (should_be_reshaped) + { + lldebugs << "Reshape all children with width: " << width << llendl; + LLPanel::reshape(width, height, called_from_parent); + } + + if (mNearbyChatBar) log(mNearbyChatBar, "after"); + if (mChicletPanel) log(mChicletPanel, "after"); + + + // Restore width of the chatbar on first reshape. + // we can not to do this from postBuild because reshape is called from parent view on startup + // creation after it and reset width according to resize logic. + static bool needs_restore_custom_state = true; + if (mChatBarContainer && needs_restore_custom_state) + { + // restore custom width of chatbar panel. + S32 new_width = gSavedSettings.getS32("ChatBarCustomWidth"); + if (new_width > 0) + { + mDesiredNearbyChatWidth = new_width; + processChatbarCustomization(new_width); + lldebugs << "Setting nearby chat bar width to " << new_width << " px" << llendl; + mChatBarContainer->reshape(new_width, mChatBarContainer->getRect().getHeight()); + } + needs_restore_custom_state = false; + } + +} + +S32 LLBottomTray::processWidthDecreased(S32 delta_width) +{ + bool still_should_be_processed = true; + + const S32 chiclet_panel_shrink_headroom = getChicletPanelShrinkHeadroom(); + + // There are four steps of processing width decrease. If in one of them required width was reached, + // further are not needed. + // 1. Decreasing width of chiclet panel. + if (chiclet_panel_shrink_headroom > 0) + { + // we have some space to decrease chiclet panel + S32 shrink_by = llmin(-delta_width, chiclet_panel_shrink_headroom); + + lldebugs << "delta_width: " << delta_width + << ", panel_delta_min: " << chiclet_panel_shrink_headroom + << ", shrink_by: " << shrink_by + << llendl; + + // is chiclet panel wide enough to process resizing? + delta_width += chiclet_panel_shrink_headroom; + + still_should_be_processed = delta_width < 0; + + lldebugs << "Shrinking chiclet panel by " << shrink_by << " px" << llendl; + mChicletPanel->getParent()->reshape(mChicletPanel->getParent()->getRect().getWidth() - shrink_by, mChicletPanel->getParent()->getRect().getHeight()); + log(mChicletPanel, "after processing panel decreasing via chiclet panel"); + + lldebugs << "RS_CHICLET_PANEL" + << ", delta_width: " << delta_width + << llendl; + } + + S32 buttons_freed_width = 0; + // 2. Decreasing width of buttons. + if (still_should_be_processed) + { + processShrinkButtons(delta_width, buttons_freed_width); + } + // 3. Decreasing width of nearby chat. + const S32 chatbar_panel_min_width = get_panel_min_width(mToolbarStack, mChatBarContainer); + const S32 chatbar_panel_width = mChatBarContainer->getRect().getWidth(); + if (still_should_be_processed && chatbar_panel_width > chatbar_panel_min_width) + { + // we have some space to decrease chatbar panel + S32 panel_delta_min = chatbar_panel_width - chatbar_panel_min_width; + + S32 delta_panel = llmin(-delta_width, panel_delta_min); + + // is chatbar panel wide enough to process resizing? + delta_width += panel_delta_min; + + still_should_be_processed = delta_width < 0; + + // chatbar should only be shrunk here, not stretched + if(delta_panel > 0) + { + lldebugs << "Shrinking nearby chat bar by " << delta_panel << " px " << llendl; + mChatBarContainer->reshape(mNearbyChatBar->getRect().getWidth() - delta_panel, mChatBarContainer->getRect().getHeight()); + } + + log(mNearbyChatBar, "after processing panel decreasing via nearby chatbar panel"); + + lldebugs << "RS_CHATBAR_INPUT" + << ", delta_panel: " << delta_panel + << ", delta_width: " << delta_width + << llendl; + } + + S32 extra_shrink_width = 0; + // 4. Hiding buttons if needed. + if (still_should_be_processed) + { + processHideButtons(delta_width, buttons_freed_width); + + if (delta_width < 0) + { + extra_shrink_width = -delta_width; + llwarns << "There is no enough width to reshape all children: " + << extra_shrink_width << llendl; + } + + if (buttons_freed_width > 0) + { + S32 nearby_needed_width = mDesiredNearbyChatWidth - mNearbyChatBar->getRect().getWidth(); + if (nearby_needed_width > 0) + { + S32 compensative_width = nearby_needed_width > buttons_freed_width ? buttons_freed_width : nearby_needed_width; + log(mNearbyChatBar, "before applying compensative width"); + lldebugs << "Extending nearby chat bar by " << compensative_width << " px" << llendl; + mChatBarContainer->reshape(mChatBarContainer->getRect().getWidth() + compensative_width, mChatBarContainer->getRect().getHeight() ); + log(mNearbyChatBar, "after applying compensative width"); + lldebugs << buttons_freed_width << llendl; + } + } + } + + return extra_shrink_width; +} + +void LLBottomTray::processWidthIncreased(S32 delta_width) +{ + if (delta_width <= 0) return; + + // how much room we have to show hidden buttons + S32 available_width = delta_width + getChicletPanelShrinkHeadroom(); + + lldebugs << "Distributing (" << getChicletPanelShrinkHeadroom() + << " + " << delta_width << ") = " << available_width << " px" << llendl; + + // 1. Try showing buttons that have been auto-hidden. + S32 processed_width = processShowButtons(available_width); + lldebugs << "processed_width = " << processed_width << ", delta_width = " << delta_width << llendl; + + lldebugs << "Available_width after showing buttons: " << available_width << llendl; + + // If the newly shown buttons have consumed more than delta_width pixels, + // shrink the chiclet panel. + if (processed_width > delta_width) + { + // 1. use delta width of resizing + S32 shrink_by = processed_width - delta_width; + + // 2. use width available via decreasing of chiclet panel + if (shrink_by > 0) + { + lldebugs << "Shrinking chiclet panel by " << shrink_by << " px" << llendl; + mChicletPanel->getParent()->reshape(mChicletPanel->getParent()->getRect().getWidth() - shrink_by, mChicletPanel->getParent()->getRect().getHeight()); + log(mChicletPanel, "after applying compensative width for chiclets: "); + lldebugs << shrink_by << llendl; + } + + // shown buttons take some space, rest should be processed by nearby chatbar & chiclet panels + delta_width -= processed_width; + } + + // 2. Expand the nearby chat bar if needed. + S32 chatbar_panel_width = mChatBarContainer->getRect().getWidth(); + lldebugs << "delta_width = " << delta_width + << ", chatbar_panel_width = " << chatbar_panel_width + << ", mDesiredNearbyChatWidth = " << mDesiredNearbyChatWidth << llendl; + if (delta_width > 0 && chatbar_panel_width < mDesiredNearbyChatWidth) + { + S32 delta_panel_max = mDesiredNearbyChatWidth - chatbar_panel_width; + S32 delta_panel = llmin(delta_width, delta_panel_max); + lldebugs << "Unprocesed delta width: " << delta_width + << ", can be applied to chatbar: " << delta_panel_max + << ", will be applied: " << delta_panel + << llendl; + + delta_width -= delta_panel_max; + lldebugs << "Extending nearby chat bar by " << delta_panel << " px " << llendl; + mChatBarContainer->reshape(chatbar_panel_width + delta_panel, mChatBarContainer->getRect().getHeight()); + log(mNearbyChatBar, "applied unprocessed delta width"); + } + + // 3. Expand buttons that have been auto-shrunk, + // if we haven't yet consumed all the available headroom. + if (delta_width > 0) + { + S32 available_width = delta_width + getChicletPanelShrinkHeadroom(); + processExtendButtons(available_width); + } +} + +S32 LLBottomTray::processShowButtons(S32& available_width) +{ + lldebugs << "Distributing " << available_width << " px" << llendl; + S32 original_available_width = available_width; + + // process buttons from left to right + resize_state_vec_t::const_iterator it = mButtonsProcessOrder.begin(); + const resize_state_vec_t::const_iterator it_end = mButtonsProcessOrder.end(); + + for (; it != it_end; ++it) + { + // is there available space? + if (available_width <= 0) break; + + // try to show next button + processShowButton(*it, available_width); + } + + return original_available_width - available_width; +} + +bool LLBottomTray::processShowButton(EResizeState shown_object_type, S32& available_width) +{ + // Check if the button was previously auto-hidden (due to lack of space). + if (!isAutoHidden(shown_object_type)) + { + return false; + } + + // Ok. Try showing the button. + return showButton(shown_object_type, available_width); +} + +void LLBottomTray::processHideButtons(S32& required_width, S32& buttons_freed_width) +{ + // process buttons from right to left + resize_state_vec_t::const_reverse_iterator it = mButtonsProcessOrder.rbegin(); + const resize_state_vec_t::const_reverse_iterator it_end = mButtonsProcessOrder.rend(); + + for (; it != it_end; ++it) + { + // is it still necessary to hide a button? + if (required_width >= 0) break; + + // try to hide next button + processHideButton(*it, required_width, buttons_freed_width); + } +} + +void LLBottomTray::processHideButton(EResizeState processed_object_type, S32& required_width, S32& buttons_freed_width) +{ + lldebugs << "Trying to hide object type: " << processed_object_type << llendl; + LLPanel* panel = getButtonPanel(processed_object_type); + if (NULL == panel) + { + return; + } + + if (panel->getVisible()) + { + required_width += panel->getRect().getWidth(); + + if (required_width > 0) + { + buttons_freed_width += required_width; + } + + setTrayButtonVisible(processed_object_type, false); + + setAutoHidden(processed_object_type, true); + + lldebugs << "processing object type: " << processed_object_type + << ", buttons_freed_width: " << buttons_freed_width + << llendl; + } +} + +void LLBottomTray::processShrinkButtons(S32& required_width, S32& buttons_freed_width) +{ + // process buttons from right to left + resize_state_vec_t::const_reverse_iterator it = mButtonsProcessOrder.rbegin(); + const resize_state_vec_t::const_reverse_iterator it_end = mButtonsProcessOrder.rend(); + + // iterate through buttons in the mButtonsProcessOrder first + for (; it != it_end; ++it) + { + // is it still necessary to hide a button? + if (required_width >= 0) break; + + // try to shrink next button + processShrinkButton(*it, required_width); + } + + // then shrink Speak button +// [SL:KB] - Patch: UI-BottomTray | Checked: 2010-09-07 (Catznip-2.1.2b) | Added: Catznip-2.1.2b + if ( (mSpeakPanel->getVisible()) && (mObjectDefaultWidthMap[RS_BUTTON_SPEAK] > mSpeakPanel->getRect().getWidth()) ) + { + mSpeakBtn->setLabelVisible(false); + } +// [/SL:KB] +/* + if (required_width < 0) + { + S32 panel_min_width = 0; + std::string panel_name = mSpeakPanel->getName(); + bool success = mToolbarStack->getPanelMinSize(panel_name, &panel_min_width); + if (!success) + { + lldebugs << "Panel was not found to get its min width: " << panel_name << llendl; + } + else + { + S32 panel_width = mSpeakPanel->getRect().getWidth(); + S32 possible_shrink_width = panel_width - panel_min_width; + + if (possible_shrink_width > 0) + { + if (mSpeakBtn) + { + mSpeakBtn->setLabelVisible(false); + } + + mSpeakPanel->reshape(panel_width - possible_shrink_width, mSpeakPanel->getRect().getHeight()); + + required_width += possible_shrink_width; + + if (required_width > 0) + { + buttons_freed_width += required_width; + } + + lldebugs << "Shrunk Speak button panel: " << panel_name + << ", shrunk width: " << possible_shrink_width + << ", rest width to process: " << required_width + << llendl; + } + } + } +*/ +} + +void LLBottomTray::processShrinkButton(EResizeState processed_object_type, S32& required_width) +{ + LLPanel* panel = getButtonPanel(processed_object_type); + if (NULL == panel) + { + return; + } + + if (panel->getVisible()) + { + S32 panel_width = panel->getRect().getWidth(); + S32 panel_min_width = 0; + std::string panel_name = panel->getName(); + bool success = mToolbarStack->getPanelMinSize(panel_name, &panel_min_width); + S32 possible_shrink_width = panel_width - panel_min_width; + + if (!success) + { + lldebugs << "Panel was not found to get its min width: " << panel_name << llendl; + } + // we have some space to free by shrinking the button + else if (possible_shrink_width > 0) + { + // let calculate real width to shrink + + // 1. apply all possible width + required_width += possible_shrink_width; + + // 2. it it is too much... + if (required_width > 0) + { + // reduce applied shrunk width to the excessive value. + possible_shrink_width -= required_width; + required_width = 0; + } + panel->reshape(panel_width - possible_shrink_width, panel->getRect().getHeight()); + + lldebugs << "Shrunk panel: " << panel_name + << ", shrunk width: " << possible_shrink_width + << ", rest width to process: " << required_width + << llendl; + } + } +} + + +void LLBottomTray::processExtendButtons(S32& available_width) +{ + // do not allow extending any buttons if we have some buttons hidden via resize + if (mResizeState && isAutoHidden(RS_BUTTONS_CAN_BE_HIDDEN)) return; + + lldebugs << "Distributing " << available_width << " px" << llendl; + + // First try extending the Speak button. + if (available_width > 0) + { + if (!processExtendSpeakButton(available_width)) + { + // The Speak button needs extension but lacks some space. + // Don't extend other buttons in this case: the Speak button + // should consume the available headroom first. + return; + } + } + +// const S32 chiclet_panel_width = mChicletPanel->getParent()->getRect().getWidth(); +// static const S32 chiclet_panel_min_width = mChicletPanel->getMinWidth(); +// const S32 available_width_chiclet = chiclet_panel_width - chiclet_panel_min_width; + // Then process the other buttons from left to right. + if (available_width > 0) + { + resize_state_vec_t::const_iterator it = mButtonsProcessOrder.begin(); + const resize_state_vec_t::const_iterator it_end = mButtonsProcessOrder.end(); + } + + //-TT 2.6.9 - keeping this along with the section above to try for decoupling voice-on from button display + //this will mean just disabling button when voice is off, not hiding it. -TT + + // then try to extend Speak button +// [SL:KB] - Patch: UI-BottomTray | Checked: 2010-09-07 (Catznip-2.1.2b) | Added: Catznip-2.1.2b + if ( (mSpeakPanel->getVisible()) && (mObjectDefaultWidthMap[RS_BUTTON_SPEAK] <= mSpeakPanel->getRect().getWidth()) ) + { + mSpeakBtn->setLabelVisible(true); + } +// [/SL:KB] +/* + if (available_width > 0 || available_width_chiclet > 0) + { + S32 panel_max_width = mObjectDefaultWidthMap[RS_BUTTON_SPEAK]; + S32 panel_width = mSpeakPanel->getRect().getWidth(); + S32 possible_extend_width = panel_max_width - panel_width; + + // iterate through buttons in the mButtonsProcessOrder first + for (; it != it_end; ++it) + { + // is there available space? + if (available_width <= 0) break; + + // try to extend next button + processExtendButton(*it, available_width); + } + } +*/ +} + +bool LLBottomTray::processExtendSpeakButton(S32& available_width) +{ + if (available_width <= 0) + { + llassert(available_width > 0); + return true; + } + + const S32 panel_max_width = mObjectDefaultWidthMap[RS_BUTTON_SPEAK]; + const S32 panel_width = mSpeakPanel->getRect().getWidth(); + const S32 required_headroom = panel_max_width - panel_width; + + if (panel_width < panel_max_width) // if the button isn't extended already + { + if (available_width < required_headroom) // not enough space + { + lldebugs << "Need (" << required_headroom << " - " << available_width << ") = " + << (required_headroom - available_width) << " more px" + << " to extend the Speak button"<< llendl; + + return false; // Don't extend other buttons until we extend Speak. + //-TT 2.6.9 - this needs looking into for FS merge + } + + // Reshape the Speak button to its maximum width. + if (mSpeakBtn) mSpeakBtn->setLabelVisible(true); + mSpeakPanel->reshape(panel_max_width, mSpeakPanel->getRect().getHeight()); + + available_width -= required_headroom; + llassert(available_width >= 0); + + lldebugs << "Extending Speak button panel: " << mSpeakPanel->getName() + << ", extended width: " << required_headroom + << ", rest width to process: " << available_width + << llendl; + } + + return true; +} + +void LLBottomTray::processExtendButton(EResizeState processed_object_type, S32& available_width) +{ + llassert(available_width >= 0); + + LLPanel* panel = getButtonPanel(processed_object_type); + if (NULL == panel) + { + return; + } + + if (!panel->getVisible()) return; + + // Widen the button up to its maximum width, but by not more than px. + S32 panel_max_width = mObjectDefaultWidthMap[processed_object_type]; + S32 panel_width = panel->getRect().getWidth(); + S32 required_headroom = panel_max_width - panel_width; + + S32 extend_by = llmin(available_width, required_headroom); + if (extend_by > 0) + { + panel->reshape(panel_width + extend_by, panel->getRect().getHeight()); + + // Decrease amount of headroom available for other panels. + available_width -= extend_by; + + lldebugs << "Extending " << panel->getName() + << " by " << extend_by + << " px; remaining available width: " << available_width + << llendl; + } +} + +bool LLBottomTray::canButtonBeShown(EResizeState processed_object_type) const +{ + // Check that all buttons (that can be hidden on resize) + // to the left of the given one are already shown. + + // process buttons in direct order (from left to right) + resize_state_vec_t::const_iterator it = mButtonsProcessOrder.begin(); + const resize_state_vec_t::const_iterator it_end = mButtonsProcessOrder.end(); + + MASK buttons_before_mask = RS_NORESIZE; + for (; it != it_end; ++it) + { + const EResizeState button_type = *it; + if (button_type == processed_object_type) break; + + buttons_before_mask |= button_type; + } + + return !isAutoHidden(buttons_before_mask); +} + +void LLBottomTray::initResizeStateContainers() +{ + // init map with objects should be processed for each type +// [SL:KB] - Patch: UI-BottomTray | Checked: 2010-09-07 (Catznip-2.1.2b) | Added: Catznip-2.1.2b + mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_SPEAK, getChild("speak_panel"))); +// [/SL:KB] + + mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_GESTURES, getChild("gesture_panel"))); + mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_MOVEMENT, getChild("movement_panel"))); + mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_CAMERA, getChild("cam_panel"))); + mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_DESTINATIONS, getChild("destinations_panel"))); + mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_AVATARS, getChild("avatar_panel"))); + mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_SNAPSHOT, getChild("snapshot_panel"))); + mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_PEOPLE, getChild("bottom_sbpeople"))); + mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_BUILD, getChild("build_btn_panel"))); + mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_SEARCH, getChild("search_btn_panel"))); + mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_WORLD_MAP, getChild("world_map_btn_panel"))); + mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_MINI_MAP, getChild("mini_map_btn_panel"))); +// AO mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_HOME, getChild("bottom_sbhome"))); +// AO mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_ME, getChild("bottom_sbme"))); +// AO mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_PLACES, getChild("bottom_sbplaces"))); + mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_APPEARANCE, getChild("bottom_sbappearance"))); + mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_INVENTORY, getChild("bottom_sbinv"))); + mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_AO, getChild("ao_btn_panel"))); // ## Zi: Animation Overrider + mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_QUICKPREFS, getChild("quickprefs_btn_panel"))); // Quick Preferences panel -WoLf + //-TT 2.6.9 - there's also splitter_panel_2, in case we want it + mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_SPLITTER_1, getChild("splitter_panel_1"))); + mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_HOWTO, getChild("howto_panel"))); + + // init an order of processed buttons + +// [SL:KB] - Patch: UI-BottomTray | Checked: 2010-09-07 (Catznip-2.1.2b) | Added: Catznip-2.1.2b + mButtonsProcessOrder.push_back(RS_BUTTON_SPEAK); +// [/SL:KB] + mButtonsProcessOrder.push_back(RS_BUTTON_GESTURES); + mButtonsProcessOrder.push_back(RS_BUTTON_MOVEMENT); + mButtonsProcessOrder.push_back(RS_BUTTON_CAMERA); +// mButtonsProcessOrder.push_back(RS_BUTTON_AVATARS); + mButtonsProcessOrder.push_back(RS_BUTTON_SNAPSHOT); + mButtonsProcessOrder.push_back(RS_BUTTON_PEOPLE); + mButtonsProcessOrder.push_back(RS_BUTTON_BUILD); + mButtonsProcessOrder.push_back(RS_BUTTON_SEARCH); + mButtonsProcessOrder.push_back(RS_BUTTON_WORLD_MAP); + mButtonsProcessOrder.push_back(RS_BUTTON_MINI_MAP); +//AO mButtonsProcessOrder.push_back(RS_BUTTON_HOME); +//AO mButtonsProcessOrder.push_back(RS_BUTTON_ME); +//AO mButtonsProcessOrder.push_back(RS_BUTTON_PLACES); + mButtonsProcessOrder.push_back(RS_BUTTON_APPEARANCE); + mButtonsProcessOrder.push_back(RS_BUTTON_INVENTORY); + mButtonsProcessOrder.push_back(RS_BUTTON_AO); // ## Zi: Animation Overrider + mButtonsProcessOrder.push_back(RS_BUTTON_QUICKPREFS); // Quick Preferences panel -WoLf + + mButtonsProcessOrder.push_back(RS_BUTTON_SPLITTER_1); + mButtonsProcessOrder.push_back(RS_BUTTON_HOWTO); + + + //-TT 2.6.9 - this needs untangling from the order, keeping the following section with the old patch + +// mButtonsOrder.push_back(RS_BUTTON_SPEAK); +// mButtonsOrder.insert(mButtonsOrder.end(), mButtonsProcessOrder.begin(), mButtonsProcessOrder.end()); +// [SL:KB] - Patch: UI-BottomTray | Checked: 2010-12-02 (Catznip-2.4.0g) | Added: Catznip-2.4.0g + mButtonsOrder = mButtonsProcessOrder; +// [/SL:KB] + + // init default widths + + // process buttons that can be hidden on resize... + resize_state_vec_t::const_iterator it = mButtonsProcessOrder.begin(); + const resize_state_vec_t::const_iterator it_end = mButtonsProcessOrder.end(); + + for (; it != it_end; ++it) + { + const EResizeState button_type = *it; + // is there an appropriate object? + LLPanel* button_panel = getButtonPanel(button_type); + if (!button_panel) continue; + + // set default width for it. + mObjectDefaultWidthMap[button_type] = button_panel->getRect().getWidth(); + } + + // ... and add Speak button because it also can be shrunk. +// mObjectDefaultWidthMap[RS_BUTTON_SPEAK] = mSpeakPanel->getRect().getWidth(); +} + +// this method must be called before restoring of the chat entry field on startup +// because it resets chatbar's width according to resize logic. +void LLBottomTray::initButtonsVisibility() +{ +// [SL:KB] - Patch: UI-BottomTray | Checked: 2010-09-07 (Catznip-2.1.2b) | Added: Catznip-2.1.2b + setVisibleAndFitWidths(RS_BUTTON_SPEAK, gSavedSettings.getBOOL("ShowSpeakButton") || !mSpeakBtn ); +// [/SL:KB] + + setVisibleAndFitWidths(RS_BUTTON_GESTURES, gSavedSettings.getBOOL("ShowGestureButton")); + setVisibleAndFitWidths(RS_BUTTON_MOVEMENT, gSavedSettings.getBOOL("ShowMoveButton")); + setVisibleAndFitWidths(RS_BUTTON_CAMERA, gSavedSettings.getBOOL("ShowCameraButton")); + setVisibleAndFitWidths(RS_BUTTON_SNAPSHOT, gSavedSettings.getBOOL("ShowSnapshotButton")); + setVisibleAndFitWidths(RS_BUTTON_BUILD, gSavedSettings.getBOOL("ShowBuildButton")); + setVisibleAndFitWidths(RS_BUTTON_SEARCH, gSavedSettings.getBOOL("ShowSearchButton")); + setVisibleAndFitWidths(RS_BUTTON_WORLD_MAP, gSavedSettings.getBOOL("ShowWorldMapButton")); + setVisibleAndFitWidths(RS_BUTTON_MINI_MAP, gSavedSettings.getBOOL("ShowMiniMapButton")); + +//AO setVisibleAndFitWidths(RS_BUTTON_HOME, gSavedSettings.getBOOL("ShowHomeButton")); +//AO setVisibleAndFitWidths(RS_BUTTON_ME, gSavedSettings.getBOOL("ShowMeButton")); +//AO setVisibleAndFitWidths(RS_BUTTON_PLACES, gSavedSettings.getBOOL("ShowPlacesButton")); + setVisibleAndFitWidths(RS_BUTTON_AO, gSavedSettings.getBOOL("ShowAOButton")); // ## Zi: Animation Overrider + setVisibleAndFitWidths(RS_BUTTON_QUICKPREFS, gSavedSettings.getBOOL("ShowQuickPrefsButton")); // Quick Preferences panel -WoLf + // take care of additional sidebar button visibility -Zi + setVisibleAndFitWidths(RS_BUTTON_PEOPLE, gSavedSettings.getBOOL("ShowPeopleButton")); + setVisibleAndFitWidths(RS_BUTTON_APPEARANCE, gSavedSettings.getBOOL("ShowAppearanceButton")); + setVisibleAndFitWidths(RS_BUTTON_INVENTORY, gSavedSettings.getBOOL("ShowInventoryButton")); + + lldebugs << "mResizeState = " << resizeStateMaskToString(mResizeState) << llendl; + +} + +void LLBottomTray::setButtonsControlsAndListeners() +{ + if (mSpeakBtn) + { +// [SL:KB] - Patch: UI-BottomTray | Checked: 2010-09-07 (Catznip-2.1.2b) | Added: Catznip-2.1.2b + gSavedSettings.getControl("ShowSpeakButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_SPEAK, _2)); +// [/SL:KB] + } + + gSavedSettings.getControl("ShowGestureButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_GESTURES, _2)); + gSavedSettings.getControl("ShowMoveButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_MOVEMENT, _2)); + gSavedSettings.getControl("ShowCameraButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_CAMERA, _2)); + gSavedSettings.getControl("ShowSnapshotButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_SNAPSHOT, _2)); + gSavedSettings.getControl("ShowBuildButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_BUILD, _2)); + gSavedSettings.getControl("ShowSearchButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_SEARCH, _2)); + gSavedSettings.getControl("ShowWorldMapButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_WORLD_MAP, _2)); + gSavedSettings.getControl("ShowMiniMapButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_MINI_MAP, _2)); +// gSavedSettings.getControl("ShowHomeButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_HOME, _2)); +// gSavedSettings.getControl("ShowMeButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_ME, _2)); +// gSavedSettings.getControl("ShowPlacesButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_PLACES, _2)); + gSavedSettings.getControl("ShowAOButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_AO, _2)); // ## Zi: Animation Overrider + gSavedSettings.getControl("ShowQuickPrefsButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_QUICKPREFS, _2)); // Quick Preferences panel -WoLf + // take care of additional sidebar button visibility -Zi + gSavedSettings.getControl("ShowPeopleButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_PEOPLE, _2)); + gSavedSettings.getControl("ShowAppearanceButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_APPEARANCE, _2)); + gSavedSettings.getControl("ShowInventoryButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_INVENTORY, _2)); + + LLButton* build_btn = getChild("build_btn"); + // set control name for Build button. It is not enough to link it with Button.SetFloaterToggle in xml + std::string vis_control_name = LLFloaterReg::declareVisibilityControl("build"); + // Set the button control value (toggle state) to the floater visibility control (Sets the value as well) + build_btn->setControlVariable(LLFloater::getControlGroup()->getControl(vis_control_name)); +} + +bool LLBottomTray::toggleShowButton(LLBottomTray::EResizeState button_type, const LLSD& new_visibility) +{ + if (LLBottomTray::instanceExists()) + { + LLBottomTray::getInstance()->setTrayButtonVisibleIfPossible(button_type, new_visibility.asBoolean()); + } + return true; +} + +bool LLBottomTray::showButton(EResizeState button_type, S32& available_width) +{ + LLPanel* panel = getButtonPanel(button_type); + if (NULL == panel) + { + return false; + } + + if (panel->getVisible()) + { + return false; + } + + // Check if none of the buttons to the left of the given one was auto-hidden. + // (we auto-show the buttons left to right). + if (!canButtonBeShown(button_type)) + { + return false; + } + + // Make sure we have enough room to show this button. + const S32 required_width = panel->getRect().getWidth(); + if (available_width < required_width) + { + lldebugs << "Need " << (required_width - available_width) << " more px to show " << resizeStateToString(button_type) << llendl; + return false; + } + + // All good. Show the button. + setTrayButtonVisible(button_type, true); + + // Let the caller know that there is now less available space. + available_width -= required_width; + + lldebugs << "Showing button " << resizeStateToString(button_type) + << ", remaining available width: " << available_width + << llendl; + setAutoHidden(button_type, false); + + return true; +} + +void LLBottomTray::setTrayButtonVisible(EResizeState shown_object_type, bool visible) +{ + LLPanel* panel = getButtonPanel(shown_object_type); + if (NULL == panel) + { + return; + } + + panel->setVisible(visible); + +// [SL:KB] - Patch: UI-BottomTray | Checked: 2010-09-07 (Catznip-2.1.2b) | Added: Catznip-2.1.2b + S32 posChatBarEnd = mNearbyChatBar->getRect().mRight; + S32 posBtnStart = -1; std::string strBtnName; + + for (state_object_map_t::iterator it = mStateProcessedObjectMap.begin(); it != mStateProcessedObjectMap.end(); ++it) + { + LLPanel* pBtnPanel = it->second; + if ( (pBtnPanel) && (pBtnPanel->getVisible()) ) + { + S32 dist = pBtnPanel->getRect().mLeft - posChatBarEnd; + if ( (dist > 0) && ((-1 == posBtnStart) || (posBtnStart > dist)) ) + { + posBtnStart = dist; + strBtnName = pBtnPanel->getName(); + } + mToolbarStack->setPanelUserResize(pBtnPanel->getName(), FALSE); + } + } + + if (!strBtnName.empty()) + mToolbarStack->setPanelUserResize(strBtnName, TRUE); +// [/SL:KB] +} + +void LLBottomTray::setTrayButtonVisibleIfPossible(EResizeState shown_object_type, bool visible, bool raise_notification) +{ + if (!setVisibleAndFitWidths(shown_object_type, visible) && visible && raise_notification) + { + LLNotificationsUtil::add("BottomTrayButtonCanNotBeShown", + LLSD(), + LLSD(), + LLNotificationFunctorRegistry::instance().DONOTHING); + } +} + +bool LLBottomTray::setVisibleAndFitWidths(EResizeState object_type, bool visible) +{ + // The Speak button is treated specially: if voice is enabled, + // the button should be displayed no matter how much space we've got. + if (object_type == RS_BUTTON_SPEAK) + { + showSpeakButton(visible); + return true; + } + + LLPanel* cur_panel = getButtonPanel(object_type); + if (NULL == cur_panel) + { + return false; + } + + bool is_set = true; + + if (visible) + { + // Assume that only chiclet panel can be auto-resized + const S32 available_width = getChicletPanelShrinkHeadroom(); + + S32 preferred_width = mObjectDefaultWidthMap[object_type]; + S32 current_width = cur_panel->getRect().getWidth(); + S32 result_width = 0; + bool decrease_width = false; + + if (preferred_width > 0 && available_width >= preferred_width) + { + result_width = preferred_width; + } + else if (available_width >= current_width) + { + result_width = current_width; + } + else + { + // Calculate the possible shrunk width as difference between current and minimal widths + const S32 chatbar_shrunk_width = + mChatBarContainer->getRect().getWidth() - get_panel_min_width(mToolbarStack, mChatBarContainer); + +// S32 sum_of_min_widths = get_panel_min_width(mToolbarStack, mSpeakPanel); +// S32 sum_of_curr_widths = get_curr_width(mSpeakPanel); +// [SL:KB] - Patch: UI-BottomTray | Checked: 2010-09-07 (Catznip-2.1.2b) | Added: Catznip-2.1.2b + S32 sum_of_min_widths = 0; + S32 sum_of_curr_widths = 0; +// [/SL:KB] + + resize_state_vec_t::const_iterator it = mButtonsProcessOrder.begin(); + const resize_state_vec_t::const_iterator it_end = mButtonsProcessOrder.end(); + + for (; it != it_end; ++it) + { + LLPanel* cur_panel = getButtonPanel(*it); + sum_of_min_widths += get_panel_min_width(mToolbarStack, cur_panel); + sum_of_curr_widths += get_curr_width(cur_panel); + } + + const S32 possible_shrunk_width = + chatbar_shrunk_width + (sum_of_curr_widths - sum_of_min_widths); + + // Minimal width of current panel + S32 minimal_width = 0; + mToolbarStack->getPanelMinSize(cur_panel->getName(), &minimal_width); + + if ( (available_width + possible_shrunk_width) >= minimal_width) + { + // There is enough space for minimal width, but set the result_width + // to preferred_width so buttons widths decreasing will be done in predefined order + result_width = (preferred_width > 0) ? preferred_width : current_width; + decrease_width = true; + } + else + { + lldebugs << "Need " << (minimal_width - available_width - possible_shrunk_width) + << " more px to show " << resizeStateToString(object_type) << llendl; + + // Make the button uppear when we have more available space. + setAutoHidden(object_type, true); + return false; + } + } + + if (result_width != current_width) + { + cur_panel->reshape(result_width, cur_panel->getRect().getHeight()); + current_width = result_width; + } + + is_set = showButton(object_type, current_width); + + // Shrink buttons if needed + if (is_set && decrease_width) + { + processWidthDecreased( -result_width); + } + } + else + { + const S32 delta_width = get_curr_width(cur_panel); + + setTrayButtonVisible(object_type, false); + + // Mark button NOT to show while future bottom tray extending + lldebugs << "Removing " << resizeStateToString(object_type) << " from mResizeState" << llendl; + setAutoHidden(object_type, false); + + // Extend other buttons if need + if (delta_width) + { + processWidthIncreased(delta_width); + } + } + return is_set; +} + +LLPanel* LLBottomTray::getButtonPanel(EResizeState button_type) +{ + // Don't use the operator[] because it inserts a NULL value if the key is not found. + if (mStateProcessedObjectMap.count(button_type) == 0) + { + llwarns << "Cannot find a panel for " << resizeStateToString(button_type) << llendl; + llassert(mStateProcessedObjectMap.count(button_type) == 1); + return NULL; + } + + return mStateProcessedObjectMap[button_type]; +} + +void LLBottomTray::showWellButton(EResizeState object_type, bool visible) +{ + llassert( ((RS_NOTIFICATION_WELL | RS_IM_WELL) & object_type) == object_type ); + + const std::string panel_name = RS_IM_WELL == object_type ? "im_well_panel" : "notification_well_panel"; + + LLView * panel = getChild(panel_name); + + // if necessary visibility is set nothing to do here + if (panel->getVisible() == (BOOL)visible) return; + + S32 panel_width = panel->getRect().getWidth(); + panel->setVisible(visible); + + if (visible) + { + // method assumes that input param is a negative value + processWidthDecreased(-panel_width); + } + else + { + processWidthIncreased(panel_width); + } +} + +void LLBottomTray::processChatbarCustomization(S32 new_width) +{ + if (NULL == mNearbyChatBar) return; + + const S32 delta_width = mChatBarContainer->getRect().getWidth() - new_width; + + if (delta_width == 0) return; + + { + static unsigned dbg_cnt = 0; + lldebugs << llformat("*** (%03d) ************************************* %d", delta_width, ++dbg_cnt) << llendl; + } + + mDesiredNearbyChatWidth = new_width; + + const S32 available_chiclet_shrink_width = getChicletPanelShrinkHeadroom(); + llassert(available_chiclet_shrink_width >= 0); + + if (delta_width > 0) // panel gets narrowly + { + S32 total_possible_width = delta_width + available_chiclet_shrink_width; + processShowButtons(total_possible_width); + processExtendButtons(total_possible_width); + } + // here (delta_width < 0) // panel gets wider + else //if (-delta_width > available_chiclet_shrink_width) + { + S32 required_width = delta_width + available_chiclet_shrink_width; + S32 buttons_freed_width = 0; + processShrinkButtons(required_width, buttons_freed_width); + processHideButtons(required_width, buttons_freed_width); + } +} + +S32 LLBottomTray::getChicletPanelShrinkHeadroom() const +{ + static const S32 min_width = mChicletPanel->getMinWidth(); + const S32 cur_width = mChicletPanel->getParent()->getRect().getWidth(); + + S32 shrink_headroom = cur_width - min_width; + llassert(shrink_headroom >= 0); // the panel cannot get narrower than the minimum + return shrink_headroom; +} + +// static +std::string LLBottomTray::resizeStateToString(EResizeState state) +{ + const char *rs_string = "UNKNOWN_BUTTON"; + + switch (state) + { + case RS_NORESIZE: rs_string = "RS_NORESIZE"; break; + case RS_CHICLET_PANEL: rs_string = "RS_CHICLET_PANEL"; break; + case RS_CHATBAR_INPUT: rs_string = "RS_CHATBAR_INPUT"; break; + case RS_BUTTON_SNAPSHOT: rs_string = "RS_BUTTON_SNAPSHOT"; break; + case RS_BUTTON_CAMERA: rs_string = "RS_BUTTON_CAMERA"; break; + case RS_BUTTON_MOVEMENT: rs_string = "RS_BUTTON_MOVEMENT"; break; + case RS_BUTTON_GESTURES: rs_string = "RS_BUTTON_GESTURES"; break; + case RS_BUTTON_SPEAK: rs_string = "RS_BUTTON_SPEAK"; break; + case RS_IM_WELL: rs_string = "RS_IM_WELL"; break; + case RS_NOTIFICATION_WELL: rs_string = "RS_NOTIFICATION_WELL"; break; + case RS_BUTTON_BUILD: rs_string = "RS_BUTTON_BUILD"; break; + case RS_BUTTON_SEARCH: rs_string = "RS_BUTTON_SEARCH"; break; + case RS_BUTTON_WORLD_MAP: rs_string = "RS_BUTTON_WORLD_MAP"; break; + case RS_BUTTON_MINI_MAP: rs_string = "RS_BUTTON_MINI_MAP"; break; + case RS_BUTTON_DESTINATIONS: rs_string = "RS_BUTTON_DESTINATIONS"; break; + case RS_BUTTON_AVATARS: rs_string = "RS_BUTTON_AVATARS"; break; + case RS_BUTTON_PEOPLE: rs_string = "RS_BUTTON_PEOPLE"; break; + case RS_BUTTON_PROFILE: rs_string = "RS_BUTTON_PROFILE"; break; + case RS_BUTTON_HOWTO: rs_string = "RS_BUTTON_HOWTO"; break; + case RS_BUTTON_SPLITTER_1: rs_string = "RS_BUTTON_SPLITTER_1"; break; +// + case RS_BUTTON_APPEARANCE: rs_string = "RS_BUTTON_APPEARANCE"; break; + case RS_BUTTON_INVENTORY: rs_string = "RS_BUTTON_INVENTORY"; break; + case RS_BUTTON_QUICKPREFS: rs_string = "RS_BUTTON_QUICKPREFS"; break; +// + case RS_BUTTON_SPLITTER_2: rs_string = "RS_BUTTON_SPLITTER_2"; break; + case RS_BUTTONS_CAN_BE_HIDDEN: rs_string = "RS_BUTTONS_CAN_BE_HIDDEN"; break; + // No default to track additions. + } + + return rs_string; +} + +// static +std::string LLBottomTray::resizeStateMaskToString(MASK mask) +{ + std::string res; + + bool add_delimiter = false; + for (U32 i = 0; i < 16; i++) + { + EResizeState state = (EResizeState) (1 << i); + if (mask & state) + { + if (!add_delimiter) + { + add_delimiter = true; + } + else + { + res += ", "; + } + + res += resizeStateToString(state); + } + } + + if (res.empty()) + { + res = resizeStateToString(RS_NORESIZE); + } + + res += llformat(" (0x%X)", mask); + return res; +} + +bool LLBottomTray::isAutoHidden(MASK button_types) const +{ + return (mResizeState & button_types) != 0; +} + +void LLBottomTray::setAutoHidden(MASK button_types, bool hide) +{ + if (hide) + { + mResizeState |= button_types; + } + else + { + mResizeState &= ~button_types; + } +} + +//EOF diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index c987847c66..fe636dcc56 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -853,9 +853,9 @@ void LLBumpImageList::destroyGL() void LLBumpImageList::restoreGL() { - if(!gTextureList.isInitialized()) - { - return ; + if(!gTextureList.isInitialized()) + { + return ; } LLStandardBumpmap::restoreGL(); diff --git a/indra/newview/llfloaterinspect.cpp b/indra/newview/llfloaterinspect.cpp index 7c68036dc5..bbd07f7909 100644 --- a/indra/newview/llfloaterinspect.cpp +++ b/indra/newview/llfloaterinspect.cpp @@ -44,7 +44,6 @@ #include "rlvhandler.h" #include "llagent.h" // [/RLVa:KB] - #include "llavatarname.h" #include "lltrans.h" diff --git a/indra/newview/llfloatersettingsdebug.cpp b/indra/newview/llfloatersettingsdebug.cpp index 354c90a0ce..357b06adc8 100644 --- a/indra/newview/llfloatersettingsdebug.cpp +++ b/indra/newview/llfloatersettingsdebug.cpp @@ -213,31 +213,18 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) if (controlp) { -// [RLVa:KB] - Checked: 2010-03-18 (RLVa-1.2.0e) | Modified: RLVa-0.2.1d - // TODO-RLVa: [RLVa-1.2.1] Look into rewriting the whole debug setting blocking code - if (rlv_handler_t::isEnabled()) - { - // Don't allow changing DBG_WRITE debug settings under @setdebug=n - bool fEnable = !( (gRlvHandler.hasBehaviour(RLV_BHVR_SETDEBUG)) && - (RlvExtGetSet::getDebugSettingFlags(controlp->getName()) & RlvExtGetSet::DBG_WRITE) ); - // Don't allow toggling "Basic Shaders" and/or "Atmopsheric Shaders" through the debug settings under @setenv=n - fEnable &= !((gRlvHandler.hasBehaviour(RLV_BHVR_SETENV)) && - (("VertexShaderEnable" == controlp->getName()) || ("WindLightUseAtmosShaders" == controlp->getName()))); -#ifdef RLV_EXTENSION_STARTLOCATION - // Don't allow toggling RestrainedLoveLoginLastLocation - fEnable &= !(RLV_SETTING_LOGINLASTLOCATION == controlp->getName()); -#endif // RLV_EXTENSION_STARTLOCATION - - // NOTE: this runs per-frame so there's no need to explictly handle onCommitSettings() or onClickDefault() - spinner1->setEnabled(fEnable); - spinner2->setEnabled(fEnable); - spinner3->setEnabled(fEnable); - spinner4->setEnabled(fEnable); - color_swatch->setEnabled(fEnable); - childSetEnabled("val_text", fEnable); - childSetEnabled("boolean_combo", fEnable); - childSetEnabled("default_btn", fEnable); - } +// [RLVa:KB] - Checked: 2011-05-28 (RLVa-1.4.0a) | Modified: RLVa-1.4.0a + // If "HideFromEditor" was toggled while the floater is open then we need to manually disable access to the control + // NOTE: this runs per-frame so there's no need to explictly handle onCommitSettings() or onClickDefault() + bool fEnable = !controlp->isHiddenFromSettingsEditor(); + spinner1->setEnabled(fEnable); + spinner2->setEnabled(fEnable); + spinner3->setEnabled(fEnable); + spinner4->setEnabled(fEnable); + color_swatch->setEnabled(fEnable); + childSetEnabled("val_text", fEnable); + childSetEnabled("boolean_combo", fEnable); + childSetEnabled("default_btn", fEnable); // [/RLVa:KB] eControlType type = controlp->type(); diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp index bd20fdb7bd..0122d2493c 100644 --- a/indra/newview/llgroupactions.cpp +++ b/indra/newview/llgroupactions.cpp @@ -32,7 +32,6 @@ #include "message.h" #include "llagent.h" -#include "llslurl.h" #include "llcommandhandler.h" #include "llfloaterreg.h" #include "llgroupmgr.h" @@ -45,6 +44,7 @@ #include "llpanelgroup.h" //-TT // [RLVa:KB] - Checked: 2011-03-28 (RLVa-1.3.0f) | Added: RLVa-1.3.0f +#include "llslurl.h" #include "rlvhandler.h" // [/RLVa:KB] diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp index 524fd3294d..98f22c3c5c 100644 --- a/indra/newview/llhudtext.cpp +++ b/indra/newview/llhudtext.cpp @@ -46,7 +46,7 @@ #include "llstatusbar.h" #include "llmenugl.h" #include "pipeline.h" -// [RLVa:KB] - Checked: 2010-03-27 (RLVa-1.2.2a) +// [RLVa:KB] - Checked: 2010-03-27 (RLVa-1.4.0a) #include "rlvhandler.h" // [/RLVa:KB] #include @@ -258,7 +258,7 @@ void LLHUDText::setString(const std::string &text_utf8) { mTextSegments.clear(); // addLine(text_utf8, mColor); -// [RLVa:KB] - Checked: 2010-03-02 (RLVa-1.2.2a) | Modified: RLVa-1.0.0f +// [RLVa:KB] - Checked: 2010-03-02 (RLVa-1.4.0a) | Modified: RLVa-1.0.0f // NOTE: setString() is called for debug and map beacons as well if (rlv_handler_t::isEnabled()) { @@ -663,17 +663,14 @@ F32 LLHUDText::LLHUDTextSegment::getWidth(const LLFontGL* font) } } -// [RLVa:KB] - Checked: 2010-03-27 (RLVa-1.2.2a) | Added: RLVa-1.0.0f +// [RLVa:KB] - Checked: 2010-03-27 (RLVa-1.4.0a) | Added: RLVa-1.0.0f void LLHUDText::refreshAllObjectText() { - for (TextObjectIterator itText = sTextObjects.begin(); itText != sTextObjects.end(); itText++) + for (TextObjectIterator itText = sTextObjects.begin(); itText != sTextObjects.end(); ++itText) { LLHUDText* pText = *itText; - if ( (pText) && (!pText->mObjText.empty() && ("" != pText->mObjText) ) && - (pText->mSourceObject) && (LL_PCODE_VOLUME == pText->mSourceObject->getPCode()) ) - { + if ( (pText) && (!pText->mObjText.empty()) && (pText->mSourceObject) && (LL_PCODE_VOLUME == pText->mSourceObject->getPCode()) ) pText->setString(pText->mObjText); - } } } // [/RLVa:KB] diff --git a/indra/newview/llhudtext.h b/indra/newview/llhudtext.h index 83e537e17a..d5d81e1336 100644 --- a/indra/newview/llhudtext.h +++ b/indra/newview/llhudtext.h @@ -124,7 +124,7 @@ public: static void reshape(); static void setDisplayText(BOOL flag) { sDisplayText = flag ; } -// [RLVa:KB] - Checked: 2010-03-27 (RLVa-1.2.2a) | Added: RLVa-1.0.0f +// [RLVa:KB] - Checked: 2010-03-27 (RLVa-1.4.0a) | Added: RLVa-1.0.0f const std::string& getObjectText() const { return mObjText; } void setObjectText(const std::string &utf8string) { mObjText = utf8string; } static void refreshAllObjectText(); @@ -166,7 +166,7 @@ private: ETextAlignment mTextAlignment; EVertAlignment mVertAlignment; BOOL mHidden; -// [RLVa:KB] - Checked: 2010-03-27 (RLVa-1.2.2a) | Added: RLVa-1.0.0f +// [RLVa:KB] - Checked: 2010-03-27 (RLVa-1.4.0a) | Added: RLVa-1.0.0f std::string mObjText; // [/RLVa:KB] diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 08548e3a62..fdaab5be21 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -2665,7 +2665,7 @@ void LLFolderBridge::folderOptionsMenu() // BAP change once we're no longer treating regular categories as ensembles. const bool is_ensemble = (type == LLFolderType::FT_NONE || LLFolderType::lookupIsEnsembleType(type)); -// [SL:KB] - Patch: Appearance-Misc | Checked: 2010-11-24 (Catznip-2.5.0a) | Added: Catznip-2.4.0e +// [SL:KB] - Patch: Appearance-Misc | Checked: 2010-11-24 (Catznip-2.6.0a) | Added: Catznip-2.4.0e const bool is_outfit = (type == LLFolderType::FT_OUTFIT); // [/SL:KB] @@ -2724,7 +2724,7 @@ void LLFolderBridge::folderOptionsMenu() disabled_items.push_back(std::string("Remove From Outfit")); } // if (!LLAppearanceMgr::instance().getCanReplaceCOF(mUUID)) -// [SL:KB] - Patch: Appearance-Misc | Checked: 2010-11-24 (Catznip-2.5.0a) | Added: Catznip-2.4.0e +// [SL:KB] - Patch: Appearance-Misc | Checked: 2010-11-24 (Catznip-2.6.0a) | Added: Catznip-2.4.0e if ( ((is_outfit) && (!LLAppearanceMgr::instance().getCanReplaceCOF(mUUID))) || ((!is_outfit) && (gAgentWearables.isCOFChangeInProgress())) ) // [/SL:KB] @@ -3284,7 +3284,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, } if (is_movable) { - is_movable = (!RlvFolderLocks::instance().hasLockedFolder(RLV_LOCK_ANY)) || + is_movable = (RlvFolderLocks::instance().hasLockedFolder(RLV_LOCK_ANY)) && (RlvFolderLocks::instance().canMoveItem(inv_item->getUUID(), mUUID)); } } @@ -4789,18 +4789,12 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, LLUUID category_ continue; if (get_is_item_worn(item->getUUID())) { -/* -// [RLVa:KB] - Checked: 2010-04-04 (RLVa-1.2.0c) | Modified: RLVa-0.2.2a - if ( (rlv_handler_t::isEnabled()) && (!gRlvWearableLocks.canRemove(item)) ) - continue; -// [/RLVa:KB] - LLWearableList::instance().getAsset(item->getAssetUUID(), - item->getName(), - item->getType(), - LLWearableBridge::onRemoveFromAvatarArrived, - new OnRemoveStruct(item->getLinkedUUID())); -*/ -// [SL:KB] - Patch: Appearance-RemoveWearableFromAvatar | Checked: 2010-08-13 (Catznip-2.5.0a) | Added: Catznip-2.1.1d +// LLWearableList::instance().getAsset(item->getAssetUUID(), +// item->getName(), +// item->getType(), +// LLWearableBridge::onRemoveFromAvatarArrived, +// new OnRemoveStruct(item->getLinkedUUID())); +// [SL:KB] - Patch: Appearance-RemoveWearableFromAvatar | Checked: 2010-08-13 (Catznip-2.6.0a) | Added: Catznip-2.1.1d LLAppearanceMgr::instance().removeItemFromAvatar(item->getUUID()); // [/SL:KB] } @@ -5057,60 +5051,56 @@ void LLWearableBridge::wearAddOnAvatar() } // static -/* -void LLWearableBridge::onWearOnAvatarArrived( LLWearable* wearable, void* userdata ) -{ - LLUUID* item_id = (LLUUID*) userdata; - if(wearable) - { - LLViewerInventoryItem* item = NULL; - item = (LLViewerInventoryItem*)gInventory.getItem(*item_id); - if(item) - { - if(item->getAssetUUID() == wearable->getAssetID()) - { - gAgentWearables.setWearableItem(item, wearable); - gInventory.notifyObservers(); - //self->getFolderItem()->refreshFromRoot(); - } - else - { - llinfos << "By the time wearable asset arrived, its inv item already pointed to a different asset." << llendl; - } - } - } - delete item_id; -} -*/ +//void LLWearableBridge::onWearOnAvatarArrived( LLWearable* wearable, void* userdata ) +//{ +// LLUUID* item_id = (LLUUID*) userdata; +// if(wearable) +// { +// LLViewerInventoryItem* item = NULL; +// item = (LLViewerInventoryItem*)gInventory.getItem(*item_id); +// if(item) +// { +// if(item->getAssetUUID() == wearable->getAssetID()) +// { +// gAgentWearables.setWearableItem(item, wearable); +// gInventory.notifyObservers(); +// //self->getFolderItem()->refreshFromRoot(); +// } +// else +// { +// llinfos << "By the time wearable asset arrived, its inv item already pointed to a different asset." << llendl; +// } +// } +// } +// delete item_id; +//} // static // BAP remove the "add" code path once everything is fully COF-ified. -/* -void LLWearableBridge::onWearAddOnAvatarArrived( LLWearable* wearable, void* userdata ) -{ - LLUUID* item_id = (LLUUID*) userdata; - if(wearable) - { - LLViewerInventoryItem* item = NULL; - item = (LLViewerInventoryItem*)gInventory.getItem(*item_id); - if(item) - { - if(item->getAssetUUID() == wearable->getAssetID()) - { - bool do_append = true; - gAgentWearables.setWearableItem(item, wearable, do_append); - gInventory.notifyObservers(); - //self->getFolderItem()->refreshFromRoot(); - } - else - { - llinfos << "By the time wearable asset arrived, its inv item already pointed to a different asset." << llendl; - } - } - } - delete item_id; -} -*/ +//void LLWearableBridge::onWearAddOnAvatarArrived( LLWearable* wearable, void* userdata ) +//{ +// LLUUID* item_id = (LLUUID*) userdata; +// if(wearable) +// { +// LLViewerInventoryItem* item = NULL; +// item = (LLViewerInventoryItem*)gInventory.getItem(*item_id); +// if(item) +// { +// if(item->getAssetUUID() == wearable->getAssetID()) +// { +// bool do_append = true; +// gAgentWearables.setWearableItem(item, wearable, do_append); +// gInventory.notifyObservers(); +// //self->getFolderItem()->refreshFromRoot(); +// } +// else +// { +// llinfos << "By the time wearable asset arrived, its inv item already pointed to a different asset." << llendl; +// } +// } +// } +// delete item_id; +//} // static BOOL LLWearableBridge::canEditOnAvatar(void* user_data) @@ -5148,66 +5138,48 @@ BOOL LLWearableBridge::canRemoveFromAvatar(void* user_data) } // static -/* -void LLWearableBridge::onRemoveFromAvatar(void* user_data) -{ - LLWearableBridge* self = (LLWearableBridge*)user_data; - if(!self) return; - if(get_is_item_worn(self->mUUID)) - { - LLViewerInventoryItem* item = self->getItem(); - if (item) - { - LLUUID parent_id = item->getParentUUID(); - LLWearableList::instance().getAsset(item->getAssetUUID(), - item->getName(), - item->getType(), - onRemoveFromAvatarArrived, - new OnRemoveStruct(LLUUID(self->mUUID))); - } - } -} -*/ +//void LLWearableBridge::onRemoveFromAvatar(void* user_data) +//{ +// LLWearableBridge* self = (LLWearableBridge*)user_data; +// if(!self) return; +// if(get_is_item_worn(self->mUUID)) +// { +// LLViewerInventoryItem* item = self->getItem(); +// if (item) +// { +// LLUUID parent_id = item->getParentUUID(); +// LLWearableList::instance().getAsset(item->getAssetUUID(), +// item->getName(), +// item->getType(), +// onRemoveFromAvatarArrived, +// new OnRemoveStruct(LLUUID(self->mUUID))); +// } +// } +//} // static -/* -void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable, - void* userdata) -{ - OnRemoveStruct *on_remove_struct = (OnRemoveStruct*) userdata; - const LLUUID &item_id = gInventory.getLinkedItemID(on_remove_struct->mUUID); - -// [RLVa:KB] - Checked: 2010-03-20 (RLVa-1.2.0c) | Modified: RLVa-1.2.0a - if ( (rlv_handler_t::isEnabled()) && ((!wearable) || (!gRlvWearableLocks.canRemove(gInventory.getItem(item_id)))) ) - { - delete on_remove_struct; - return; - } -// [/RLVa:KB] - - if(wearable) - { - if( get_is_item_worn( item_id ) ) - { - LLWearableType::EType type = wearable->getType(); - - if( !(type==LLWearableType::WT_SHAPE || type==LLWearableType::WT_SKIN || type==LLWearableType::WT_HAIR || type==LLWearableType::WT_EYES ) ) //&& - //!((!gAgent.isTeen()) && ( type==LLWearableType::WT_UNDERPANTS || type==LLWearableType::WT_UNDERSHIRT )) ) - { - bool do_remove_all = false; - U32 index = gAgentWearables.getWearableIndex(wearable); - gAgentWearables.removeWearable( type, do_remove_all, index ); - } - } - } - - // Find and remove this item from the COF. - LLAppearanceMgr::instance().removeCOFItemLinks(item_id,false); - gInventory.notifyObservers(); - - delete on_remove_struct; -} -*/ +// if(wearable) +// { +// if( get_is_item_worn( item_id ) ) +// { +// LLWearableType::EType type = wearable->getType(); +// +// if( !(type==LLWearableType::WT_SHAPE || type==LLWearableType::WT_SKIN || type==LLWearableType::WT_HAIR || type==LLWearableType::WT_EYES ) ) //&& +// //!((!gAgent.isTeen()) && ( type==LLWearableType::WT_UNDERPANTS || type==LLWearableType::WT_UNDERSHIRT )) ) +// { +// bool do_remove_all = false; +// U32 index = gAgentWearables.getWearableIndex(wearable); +// gAgentWearables.removeWearable( type, do_remove_all, index ); +// } +// } +// } +// +// // Find and remove this item from the COF. +// LLAppearanceMgr::instance().removeCOFItemLinks(item_id,false); +// gInventory.notifyObservers(); +// +// delete on_remove_struct; +//} // static void LLWearableBridge::removeAllClothesFromAvatar() @@ -5219,7 +5191,7 @@ void LLWearableBridge::removeAllClothesFromAvatar() continue; // for (S32 index = gAgentWearables.getWearableCount(itype)-1; index >= 0 ; --index) -// [SL:KB] - Patch: Appearance-Misc | Checked: 2010-09-04 (Catznip-2.5.0a) | Added: Catznip-2.1.2a +// [SL:KB] - Patch: Appearance-Misc | Checked: 2010-09-04 (Catznip-2.6.0a) | Added: Catznip-2.1.2a for (S32 index = gAgentWearables.getWearableCount((LLWearableType::EType)itype)-1; index >= 0 ; --index) // [/SL:KB] { @@ -5255,14 +5227,12 @@ void LLWearableBridge::removeItemFromAvatar(LLViewerInventoryItem *item) { if (item) { -/* - LLWearableList::instance().getAsset(item->getAssetUUID(), - item->getName(), - item->getType(), - LLWearableBridge::onRemoveFromAvatarArrived, - new OnRemoveStruct(item->getUUID())); -*/ -// [SL:KB] - Patch: Appearance-RemoveWearableFromAvatar | Checked: 2010-08-13 (Catznip-2.5.0a) | Added: Catznip-2.1.1d +// LLWearableList::instance().getAsset(item->getAssetUUID(), +// item->getName(), +// item->getType(), +// LLWearableBridge::onRemoveFromAvatarArrived, +// new OnRemoveStruct(item->getUUID())); +// [SL:KB] - Patch: Appearance-RemoveWearableFromAvatar | Checked: 2010-08-13 (Catznip-2.6.0a) | Added: Catznip-2.1.1d LLAppearanceMgr::instance().removeItemFromAvatar(item->getUUID()); // [/SL:KB] } diff --git a/indra/newview/llmoveview.cpp b/indra/newview/llmoveview.cpp index 5fb20fe6f5..fb8c35256c 100644 --- a/indra/newview/llmoveview.cpp +++ b/indra/newview/llmoveview.cpp @@ -148,7 +148,10 @@ BOOL LLFloaterMove::postBuild() initMovementMode(); - LLViewerParcelMgr::getInstance()->addAgentParcelChangedCallback(LLFloaterMove::sUpdateFlyingStatus); +// LLViewerParcelMgr::getInstance()->addAgentParcelChangedCallback(LLFloaterMove::sUpdateFlyingStatus); +// [RLVa:KB] - Checked: 2011-05-27 (RLVa-1.4.0a) | Added: RLVa-1.4.0a + LLViewerParcelMgr::getInstance()->addAgentParcelChangedCallback(LLFloaterMove::sUpdateMovementStatus); +// [/RLVa:KB] return TRUE; } @@ -477,12 +480,23 @@ void LLFloaterMove::updatePosition() } //static -void LLFloaterMove::sUpdateFlyingStatus() +//void LLFloaterMove::sUpdateFlyingStatus() +//{ +// LLFloaterMove *floater = LLFloaterReg::findTypedInstance("moveview"); +// if (floater) floater->mModeControlButtonMap[MM_FLY]->setEnabled(gAgent.canFly()); +// +//} +// [RLVa:KB] - Checked: 2011-05-27 (RLVa-1.4.0a) | Added: RLVa-1.4.0a +void LLFloaterMove::sUpdateMovementStatus() { - LLFloaterMove *floater = LLFloaterReg::findTypedInstance("moveview"); - if (floater) floater->mModeControlButtonMap[MM_FLY]->setEnabled(gAgent.canFly()); - + LLFloaterMove* pFloater = LLFloaterReg::findTypedInstance("moveview"); + if (pFloater) + { + pFloater->mModeControlButtonMap[MM_RUN]->setEnabled(gRlvHandler.hasBehaviour(RLV_BHVR_ALWAYSRUN)); + pFloater->mModeControlButtonMap[MM_FLY]->setEnabled(gAgent.canFly()); + } } +// [/RLVa:KB] void LLFloaterMove::showModeButtons(BOOL bShow) { @@ -528,7 +542,10 @@ void LLFloaterMove::onOpen(const LLSD& key) // anchor_panel, this, // getDockTongue(), LLDockControl::TOP)); - sUpdateFlyingStatus(); +// sUpdateFlyingStatus(); +// [RLVa:KB] - Checked: 2011-05-27 (RLVa-1.4.0a) | Added: RLVa-1.4.0a + sUpdateMovementStatus(); +// [/RLVa:KB] } //virtual diff --git a/indra/newview/llmoveview.h b/indra/newview/llmoveview.h index 1b87864651..94804adf65 100644 --- a/indra/newview/llmoveview.h +++ b/indra/newview/llmoveview.h @@ -60,7 +60,10 @@ public: /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void setDocked(bool docked, bool pop_on_undock = true); - static void sUpdateFlyingStatus(); +// static void sUpdateFlyingStatus(); +// [RLVa:KB] - Checked: 2011-05-27 (RLVa-1.4.0a) | Added: RLVa-1.4.0a + static void sUpdateMovementStatus(); +// [/RLVa:KB] protected: void turnLeft(); diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp index e99d207382..5da822abef 100644 --- a/indra/newview/llnearbychatbar.cpp +++ b/indra/newview/llnearbychatbar.cpp @@ -52,6 +52,9 @@ // [/RLVa:KB] #include "chatbar_as_cmdline.h" #include "llviewerchat.h" +// [RLVa:KB] - Checked: 2010-02-27 (RLVa-1.2.0b) +#include "rlvhandler.h" +// [/RLVa:KB] S32 LLNearbyChatBar::sLastSpecialChatChannel = 0; diff --git a/indra/newview/llpaneloutfitsinventory.h b/indra/newview/llpaneloutfitsinventory.h index a6443c4dca..02a464191f 100644 --- a/indra/newview/llpaneloutfitsinventory.h +++ b/indra/newview/llpaneloutfitsinventory.h @@ -56,7 +56,7 @@ public: static LLSidepanelAppearance* getAppearanceSP(); -// [RLVa:KB] - Checked: 2010-08-24 (RLVa-1.2.1a) | Added: RLVa-1.2.1a +// [RLVa:KB] - Checked: 2010-08-24 (RLVa-1.4.0a) | Added: RLVa-1.2.1a LLTabContainer* getAppearanceTabs() { return mAppearanceTabs; } LLOutfitsList* getMyOutfitsPanel() { return mMyOutfitsPanel; } LLPanelWearing* getCurrentOutfitPanel() { return mCurrentOutfitPanel; } diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 06683f26ee..812a55b7b8 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -63,8 +63,8 @@ #include "roles_constants.h" #include "llgroupactions.h" // [RLVa:KB] - Checked: 2010-08-25 (RLVa-1.2.2a) -#include "rlvhandler.h" #include "llslurl.h" +#include "rlvhandler.h" // [/RLVa:KB] U8 string_value_to_click_action(std::string p_value); diff --git a/indra/newview/llsidepaneltaskinfo.cpp b/indra/newview/llsidepaneltaskinfo.cpp index 289c353e92..6e6ce5c724 100644 --- a/indra/newview/llsidepaneltaskinfo.cpp +++ b/indra/newview/llsidepaneltaskinfo.cpp @@ -62,8 +62,8 @@ #include "roles_constants.h" #include "llgroupactions.h" // [RLVa:KB] - Checked: 2010-08-25 (RLVa-1.2.2a) -#include "rlvhandler.h" #include "llslurl.h" +#include "rlvhandler.h" // [/RLVa:KB] ///---------------------------------------------------------------------------- diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp index 4bf04baa7f..f2e3081447 100644 --- a/indra/newview/llsidetray.cpp +++ b/indra/newview/llsidetray.cpp @@ -106,7 +106,8 @@ LLSideTrayTab::LLSideTrayTab(const Params& p) LLSideTrayTab::~LLSideTrayTab() { -// [RLVa:KB] - Checked: 2010-12-13 (RLVa-1.2.2c) | Added: RLVa-1.2.2c +// [RLVa:KB] - Checked: 2010-12-13 (RLVa-1.4.0a) | Added: RLVa-1.2.2c + // NOTE-RLVa: [RLVa-1.4.0a] This isn't really needed anymore with LLFloaterSideTrayTab since onClose will redock the tab anyway if (LLSideTray::instanceCreated()) LLSideTray::getInstance()->onTabDestroy(this); // [/RLVa:KB] @@ -215,6 +216,10 @@ void LLSideTrayTab::toggleTabDocked(bool toggle_floater /* = true */) LLFloater* floater_tab = LLFloaterReg::getInstance("side_bar_tab", tab_name); if (!floater_tab) return; +// [RLVa:KB] - Checked: 2010-12-14 (RLVa-1.4.0a) | Added: RLVa-1.2.2c + if (floater_tab->isMinimized()) + floater_tab->setMinimized(FALSE); +// [/RLVa:KB] // bool docking = LLFloater::isShown(floater_tab); // [RLVa:KB] - Checked: 2010-12-14 (RLVa-1.2.2c) | Added: RLVa-1.2.2c @@ -760,10 +765,14 @@ LLPanel* LLSideTray::openChildPanel(LLSideTrayTab* tab, const std::string& panel std::string tab_name = tab->getName(); +// [RLVa:KB] - Checked: 2011-05-26 (RLVa-1.4.0a) | Modified: RLVa-1.4.0a + // Don't open a child panel if the tab it belongs to has its tab button disabled + const LLButton* pTabBtn = getButtonFromName(tab->getName()); + if ( (pTabBtn) && (!pTabBtn->getEnabled()) ) + return NULL; -// [RLVa:KB] - Checked: 2010-09-07 (RLVa-1.2.1a) | Modified: RLVa-1.2.1a - // NOTE: - "panel_name" is a name of a panel *inside* of the tab, not the name of the tab that's being switched to - if ( (mValidateSignal) && (!(*mValidateSignal)(tab, LLSD(tab_name))) ) + // NOTE: "panel_name" is a name of a panel *inside* of the tab, not the name of the tab that's being switched to + if ( (mValidateSignal) && (!(*mValidateSignal)(tab, LLSD(panel_name))) ) return NULL; // [/RLVa:KB] @@ -836,11 +845,15 @@ bool LLSideTray::selectTabByName(const std::string& name, bool keep_prev_visible if (new_tab == mActiveTab) return false; -// [RLVa:KB] - Checked: 2010-12-14 (RLVa-1.2.2c) | Added: RLVa-1.2.2c +// [RLVa:KB] - Checked: 2011-05-26 (RLVa-1.4.0a) | Modified: RLVa-1.4.0a // Don't switch to a tab if its tab button is disabled const LLButton* pTabBtn = getButtonFromName(new_tab->getName()); if ( (pTabBtn) && (!pTabBtn->getEnabled()) ) return false; + + // Fire the validation signal to see if anyone objects to this tab being selected + if ( (mValidateSignal) && (!(*mValidateSignal)(new_tab, LLSD())) ) + return false; // [/RLVa:KB] //deselect old tab @@ -975,7 +988,7 @@ bool LLSideTray::removeTab(LLSideTrayTab* tab) while ((*next_tab_it)->getName() == "sidebar_openclose"); // selectTabByName((*next_tab_it)->getName(), true); // Don't hide the tab being removed. -// [RLVa:KB] - Checked: 2010-12-14 (RLVa-1.2.2c) | Added: RLVa-1.2.2c +// [RLVa:KB] - Checked: 2010-12-14 (RLVa-1.4.0a) | Added: RLVa-1.2.2c // If there are no tabs that can be switched to then mActiveTab should be NULL rather than point to a now undocked tab if (!selectTabByName((*next_tab_it)->getName(), true)) mActiveTab = NULL; @@ -1133,7 +1146,7 @@ void LLSideTray::onToggleCollapse() collapseSideBar(); } -// [RLVa:KB] - Checked: 2010-12-13 (RLVa-1.2.2c) | Added: RLVa-1.2.2c +// [RLVa:KB] - Checked: 2010-12-13 (RLVa-1.4.0a) | Added: RLVa-1.2.2c bool LLSideTray::onTabDestroy(const LLSideTrayTab* tab) { child_vector_iter_t itDetachedTab = std::find(mDetachedTabs.begin(), mDetachedTabs.end(), tab); @@ -1268,7 +1281,7 @@ void LLSideTray::collapseSideBar() void LLSideTray::expandSideBar(bool open_active) { -// [RLVa:KB] - Checked: 2010-12-14 (RLVa-1.2.2c) | Added: RLVa-1.2.2c +// [RLVa:KB] - Checked: 2010-12-14 (RLVa-1.4.0a) | Added: RLVa-1.2.2c // Don't expand the sidebar unless the currently active tab's button is enabled, or we have another tab we can switch to const LLPanel* pActiveTab = getActiveTab(); const LLButton* pTabBtn = (pActiveTab) ? getButtonFromName(pActiveTab->getName()) : NULL; @@ -1619,7 +1632,7 @@ bool LLSideTray::isFloaterPanelVisible(const std::string& panel_name) } //-TT -// [RLVa:KB] - Checked: 2010-03-01 (RLVa-1.2.0a) | Added: RLVa-1.2.0a +// [RLVa:KB] - Checked: 2010-03-01 (RLVa-1.4.0a) | Added: RLVa-1.2.0a const LLPanel* LLSideTray::getActiveTab() const { return mActiveTab; diff --git a/indra/newview/llsidetray.h b/indra/newview/llsidetray.h index 59a16f80ab..a932a0a6f1 100644 --- a/indra/newview/llsidetray.h +++ b/indra/newview/llsidetray.h @@ -142,7 +142,7 @@ public: /* * get currently active tab */ -// [RLVa:KB] - Checked: 2010-03-01 (RLVa-1.2.0a) | Added: RLVa-1.2.0a +// [RLVa:KB] - Checked: 2010-03-01 (RLVa-1.4.0a) | Added: RLVa-1.2.0a // *sighs* LLSideTrayTab is defined in llsidetray.cpp... we can make do with an LLPanel* though const LLPanel* getActiveTab() const; // [/RLVa:KB] @@ -172,10 +172,10 @@ public: } LLPanel* getButtonsPanel() { return mButtonsPanel; } -// [RLVa:KB] - Checked: 2010-02-28 (RLVa-1.2.0a) | Added: RLVa-1.2.0a +// [RLVa:KB] - Checked: 2010-02-28 (RLVa-1.4.0a) | Added: RLVa-1.2.0a LLButton* getButtonFromName(const std::string& strName) { - std::map::const_iterator itBtn = mTabButtons.find(strName); + button_map_t::const_iterator itBtn = mTabButtons.find(strName); return (mTabButtons.end() != itBtn) ? itBtn->second : NULL; } // [/RLVa:KB] @@ -247,7 +247,7 @@ protected: LLPanel* openChildPanel (LLSideTrayTab* tab, const std::string& panel_name, const LLSD& params); void onTabButtonClick(std::string name); -// [RLVa:KB] - Checked: 2010-12-13 (RLVa-1.2.2c) | Added: RLVa-1.2.2c +// [RLVa:KB] - Checked: 2010-12-13 (RLVa-1.4.0a) | Added: RLVa-1.2.2c bool onTabDestroy (const LLSideTrayTab* tab); // [/RLVa:KB] void onToggleCollapse(); diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index 72c2dd1c27..1d9b1f8125 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -1680,7 +1680,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezAttachmentFromInv( if (mSource == SOURCE_LIBRARY) { // LLPointer cb = new RezAttachmentCallback(0); -// [SL:KB] - Patch: Appearance-Misc | Checked: 2010-09-28 (Catznip-2.5.0a) | Added: Catznip-2.2.0a +// [SL:KB] - Patch: Appearance-Misc | Checked: 2010-09-28 (Catznip-2.6.0a) | Added: Catznip-2.2.0a // Make this behave consistent with dad3dWearItem LLPointer cb = new RezAttachmentCallback(0, !(mask & MASK_CONTROL)); // [/SL:KB] @@ -1695,7 +1695,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezAttachmentFromInv( else { // rez_attachment(item, 0); -// [SL:KB] - Patch: Appearance-Misc | Checked: 2010-09-28 (Catznip-2.5.0a) | Added: Catznip-2.2.0a +// [SL:KB] - Patch: Appearance-Misc | Checked: 2010-09-28 (Catznip-2.6.0a) | Added: Catznip-2.2.0a // Make this behave consistent with dad3dWearItem rez_attachment(item, 0, !(mask & MASK_CONTROL)); // [/SL:KB] diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index d953e564d1..d014c6643e 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -570,6 +570,7 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask) return TRUE; } // [/RLVa:KB] + if (object) { parent = object->getRootEdit(); @@ -630,7 +631,13 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask) gViewerWindow->setCursor(cursor); lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPie (inactive)" << llendl; } - +// [RLVa:KB] - Checked: 2010-03-11 (RLVa-1.2.0e) | Added: RLVa-1.1.0l + else if ( (object) && (rlv_handler_t::isEnabled()) && (!gRlvHandler.canTouch(object)) ) + { + // Block showing the "grab" or "touch" cursor if we can't touch the object (@fartouch=n is handled above) + gViewerWindow->setCursor(UI_CURSOR_ARROW); + } +// [/RLVa:KB] else if ((object && !object->isAvatar() && object->usePhysics()) || (parent && !parent->isAvatar() && parent->usePhysics())) { @@ -1070,7 +1077,6 @@ BOOL LLToolPie::handleTooltipObject( LLViewerObject* hover_object, std::string l p.click_callback(boost::bind(showAvatarInspector, hover_object->getID())); p.visible_time_near(6.f); p.visible_time_far(3.f); - //p.delay_time(0.35f); p.delay_time(gSavedSettings.getF32("AvatarInspectorTooltipDelay")); p.wrap(false); @@ -1201,7 +1207,6 @@ BOOL LLToolPie::handleTooltipObject( LLViewerObject* hover_object, std::string l p.click_homepage_callback(boost::bind(VisitHomePage, mHoverPick)); p.visible_time_near(6.f); p.visible_time_far(3.f); - //p.delay_time(0.35f); p.delay_time(gSavedSettings.getF32("ObjectInspectorTooltipDelay")); p.wrap(false); @@ -1213,7 +1218,6 @@ BOOL LLToolPie::handleTooltipObject( LLViewerObject* hover_object, std::string l LLToolTipMgr::instance().show(tooltip_msg); } // [/RLVa:KB] - } } } diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 26f0a7ec0d..0071eb9405 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -957,7 +957,7 @@ void ModifiedCOFCallback::fire(const LLUUID& inv_item) } //RezAttachmentCallback::RezAttachmentCallback(LLViewerJointAttachment *attachmentp) -// [SL:KB] - Patch: Appearance-Misc | Checked: 2010-09-28 (Catznip-2.5.0a) | Added: Catznip-2.2.0a +// [SL:KB] - Patch: Appearance-Misc | Checked: 2010-09-28 (Catznip-2.6.0a) | Added: Catznip-2.2.0a RezAttachmentCallback::RezAttachmentCallback(LLViewerJointAttachment *attachmentp, bool replace) : mAttach(attachmentp), mReplace(replace) // [/SL:KB] @@ -977,7 +977,7 @@ void RezAttachmentCallback::fire(const LLUUID& inv_item) if (item) { // rez_attachment(item, mAttach); -// [SL:KB] - Patch: Appearance-Misc | Checked: 2010-09-28 (Catznip-2.5.0a) | Added: Catznip-2.2.0a +// [SL:KB] - Patch: Appearance-Misc | Checked: 2010-09-28 (Catznip-2.6.0a) | Added: Catznip-2.2.0a rez_attachment(item, mAttach, mReplace); // [/SL:KB] } diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index 24f1935e60..071cdb557c 100644 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -264,7 +264,7 @@ class RezAttachmentCallback : public LLInventoryCallback { public: // RezAttachmentCallback(LLViewerJointAttachment *attachmentp); -// [SL:KB] - Patch: Appearance-Misc | Checked: 2010-09-28 (Catznip-2.5.0a) | Added: Catznip-2.2.0a +// [SL:KB] - Patch: Appearance-Misc | Checked: 2010-09-28 (Catznip-2.6.0a) | Added: Catznip-2.2.0a RezAttachmentCallback(LLViewerJointAttachment *attachmentp, bool replace = false); // [/SL:KB] void fire(const LLUUID& inv_item); @@ -274,7 +274,7 @@ protected: private: LLViewerJointAttachment* mAttach; -// [SL:KB] - Patch: Appearance-Misc | Checked: 2010-09-28 (Catznip-2.5.0a) | Added: Catznip-2.2.0a +// [SL:KB] - Patch: Appearance-Misc | Checked: 2010-09-28 (Catznip-2.6.0a) | Added: Catznip-2.2.0a bool mReplace; // [/SL:KB] }; diff --git a/indra/newview/llviewerjointattachment.cpp b/indra/newview/llviewerjointattachment.cpp index f0fcb7eeae..852a525caf 100644 --- a/indra/newview/llviewerjointattachment.cpp +++ b/indra/newview/llviewerjointattachment.cpp @@ -169,7 +169,7 @@ BOOL LLViewerJointAttachment::addObject(LLViewerObject* object) // re-connect object to the joint correctly } -// [SL:KB] - Patch: Appearance-Misc | Checked: Catznip-2.4.0h (2011-01-13) | Added: Catznip-2.4.0h +// [SL:KB] - Patch: Appearance-Misc | Checked: Catznip-2.6.0a (2011-01-13) | Added: Catznip-2.4.0h // LLViewerJointAttachment::removeObject() sets the object's item to the NULL UUID so we need to extract it *after* the block above object->extractAttachmentItemID(); // [/SL:KB] diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index da8c3169e9..65feb4d030 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -8967,4 +8967,13 @@ void initialize_menus() // [/RLVa:KB] commit.add("Destination.show", boost::bind(&toggle_destination_and_avatar_picker, 0)); commit.add("Avatar.show", boost::bind(&toggle_destination_and_avatar_picker, 1)); + +// [RLVa:KB] - Checked: 2010-04-23 (RLVa-1.2.0g) | Added: RLVa-1.2.0 + commit.add("RLV.ToggleEnabled", boost::bind(&rlvMenuToggleEnabled)); + enable.add("RLV.CheckEnabled", boost::bind(&rlvMenuCheckEnabled)); + if (rlv_handler_t::isEnabled()) + { + enable.add("RLV.EnableIfNot", boost::bind(&rlvMenuEnableIfNot, _2)); + } +// [/RLVa:KB] } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 3ec64f2c8a..b11a047352 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1503,6 +1503,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& gInventory.addObserver(pOfferObserver); } // [/RLVa:KB] + if (gSavedSettings.getBOOL("ShowOfferedInventory")) { LLOpenAgentOffer* open_agent_offer = new LLOpenAgentOffer(mObjectID, from_string); @@ -1828,6 +1829,7 @@ bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const log_message_args["NAME"] = mFromName; log_message = LLTrans::getString("InvOfferDecline", log_message_args); + LLSD args; args["MESSAGE"] = log_message; LLNotificationsUtil::add("SystemMessage", args); @@ -5903,10 +5905,10 @@ bool attempt_standard_notification(LLMessageSystem* msgsystem) { // notification was specified using the new mechanism, so we can just handle it here std::string notificationID; - msgsystem->getStringFast(_PREHASH_AlertInfo, _PREHASH_Message, notificationID); - if (!LLNotifications::getInstance()->templateExists(notificationID)) - { - return false; + msgsystem->getStringFast(_PREHASH_AlertInfo, _PREHASH_Message, notificationID); + if (!LLNotifications::getInstance()->templateExists(notificationID)) + { + return false; } std::string llsdRaw; diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 8dae977869..6a0b496f8f 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -1104,7 +1104,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, coloru.mV[3] = 255 - coloru.mV[3]; mText->setColor(LLColor4(coloru)); mText->setString(temp_string); -// [RLVa:KB] - Checked: 2010-03-27 (RLVa-1.2.0b) | Added: RLVa-1.0.0f +// [RLVa:KB] - Checked: 2010-03-27 (RLVa-1.4.0a) | Added: RLVa-1.0.0f if (rlv_handler_t::isEnabled()) { mText->setObjectText(temp_string); @@ -1502,7 +1502,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, coloru.mV[3] = 255 - coloru.mV[3]; mText->setColor(LLColor4(coloru)); mText->setString(temp_string); -// [RLVa:KB] - Checked: 2010-03-27 (RLVa-1.2.0b) | Added: RLVa-1.0.0f +// [RLVa:KB] - Checked: 2010-03-27 (RLVa-1.4.0a) | Added: RLVa-1.0.0f if (rlv_handler_t::isEnabled()) { mText->setObjectText(temp_string); diff --git a/indra/newview/llviewerprecompiledheaders.h b/indra/newview/llviewerprecompiledheaders.h index 45c9b3e91f..faa86d43dd 100644 --- a/indra/newview/llviewerprecompiledheaders.h +++ b/indra/newview/llviewerprecompiledheaders.h @@ -118,8 +118,8 @@ // Library includes from llvfs #include "lldir.h" - -// Library includes from llmessage project + +// Library includes from llmessage project #include "llcachename.h" #endif diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 3e2c38ae38..9b64413183 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -110,8 +110,8 @@ void LLViewerTextureList::doPreloadImages() { LL_DEBUGS("ViewerImages") << "Preloading images..." << LL_ENDL; - llassert_always(mInitialized) ; - llassert_always(mImageList.empty()) ; + llassert_always(mInitialized) ; + llassert_always(mImageList.empty()) ; llassert_always(mUUIDMap.empty()) ; // Set the "missing asset" image diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index d100b34e4f..6a912b9c0b 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5799,7 +5799,7 @@ LLViewerJointAttachment* LLVOAvatar::getTargetAttachmentPoint(LLViewerObject* vi llwarns << "Object attachment point invalid: " << attachmentID << llendl; } // attachment = get_if_there(mAttachmentPoints, 1, (LLViewerJointAttachment*)NULL); // Arbitrary using 1 (chest) -// [SL:KB] - Patch: Appearance-LegacyMultiAttachment | Checked: 2010-08-28 (Catznip-2.5.0a) | Added: Catznip-2.1.2a +// [SL:KB] - Patch: Appearance-LegacyMultiAttachment | Checked: 2010-08-28 (Catznip-2.6.0a) | Added: Catznip-2.1.2a S32 idxAttachPt = 1; if ( (!isSelf()) && (gSavedSettings.getBOOL("LegacyMultiAttachmentSupport")) && (attachmentID > 38) && (attachmentID <= 68) ) idxAttachPt = attachmentID - 38; @@ -6305,7 +6305,7 @@ BOOL LLVOAvatar::isFullyLoaded() const // return TRUE; // else // return mFullyLoaded; -// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-09-22 (Catznip-2.5.0a) | Added: Catznip-2.2.0a +// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-09-22 (Catznip-2.6.0a) | Added: Catznip-2.2.0a // Changes to LLAppearanceMgr::updateAppearanceFromCOF() expect this function to actually return mFullyLoaded for gAgentAvatarp if ( (!isSelf()) && (gSavedSettings.getBOOL("RenderUnloadedAvatar")) ) return TRUE; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 80a52546bd..aa8aef5568 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -69,6 +69,10 @@ // [/RLVa:KB] #include "lldatapacker.h" #include "llvocache.h" +// [RLVa:KB] - Checked: 2011-05-22 (RLVa-1.3.1a) +#include "rlvhandler.h" +#include "rlvlocks.h" +// [/RLVa:KB] const S32 MIN_QUIET_FRAMES_COALESCE = 30; const F32 FORCE_SIMPLE_RENDER_AREA = 512.f; diff --git a/indra/newview/llwearablelist.cpp b/indra/newview/llwearablelist.cpp index 0f655969fc..b2c7687f33 100644 --- a/indra/newview/llwearablelist.cpp +++ b/indra/newview/llwearablelist.cpp @@ -96,7 +96,7 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID BOOL isNewWearable = FALSE; LLWearableArrivedData* data = (LLWearableArrivedData*) userdata; // LLWearable* wearable = NULL; // NULL indicates failure -// [SL:KB] - Patch: Appearance-Misc | Checked: 2010-08-13 (Catznip-2.5.0a) | Added: Catznip-2.1.1d +// [SL:KB] - Patch: Appearance-Misc | Checked: 2010-08-13 (Catznip-2.6.0a) | Added: Catznip-2.1.1d LLWearable* wearable = get_if_there(LLWearableList::instance().mList, uuid, (LLWearable*)NULL); if (wearable) { diff --git a/indra/newview/rlvdefines.h b/indra/newview/rlvdefines.h index 14206d67b6..1cb6e5afbc 100644 --- a/indra/newview/rlvdefines.h +++ b/indra/newview/rlvdefines.h @@ -63,9 +63,9 @@ const S32 RLV_VERSION_BUILD = 0; // Implementation version const S32 RLVa_VERSION_MAJOR = 1; -const S32 RLVa_VERSION_MINOR = 3; -const S32 RLVa_VERSION_PATCH = 1; -const S32 RLVa_VERSION_BUILD = 1; +const S32 RLVa_VERSION_MINOR = 4; +const S32 RLVa_VERSION_PATCH = 0; +const S32 RLVa_VERSION_BUILD = 0; // Uncomment before a final release //#define RLV_RELEASE diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index 549026e13a..90903317b0 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -1268,22 +1268,6 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd) pObj->mText->setString( (RLV_TYPE_ADD == eType) ? "" : pObj->mText->getObjectText()); } break; - case RLV_BHVR_ALWAYSRUN: // @alwaysrun=n|y - Checked: 2011-05-11 (RLVa-1.3.0i) | Added: RLVa-1.3.0i - { - VERIFY_OPTION_REF(strOption.empty()); - - if (RLV_TYPE_ADD == eType) - gAgent.clearAlwaysRun(); - } - break; - case RLV_BHVR_TEMPRUN: // @temprun=n|y - Checked: 2011-05-11 (RLVa-1.3.0i) | Added: RLVa-1.3.0i - { - VERIFY_OPTION_REF(strOption.empty()); - - if (RLV_TYPE_ADD == eType) - gAgent.clearTempRun(); - } - break; // The following block is only valid if there's no option case RLV_BHVR_SHOWLOC: // @showloc=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h case RLV_BHVR_SHOWNAMES: // @shownames=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h @@ -1319,6 +1303,8 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd) case RLV_BHVR_TOUCHALL: // @touchall=n|y - Checked: 2011-01-21 (RLVa-1.3.0e) | Added: RLVa-1.3.0e case RLV_BHVR_TOUCHME: // @touchme=n|y - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h case RLV_BHVR_FLY: // @fly=n|y - Checked: 2010-03-02 (RLVa-1.2.0a) + case RLV_BHVR_ALWAYSRUN: // @alwaysrun=n|y - Checked: 2011-05-11 (RLVa-1.3.0i) | Added: RLVa-1.3.0i + case RLV_BHVR_TEMPRUN: // @temprun=n|y - Checked: 2011-05-11 (RLVa-1.3.0i) | Added: RLVa-1.3.0i case RLV_BHVR_UNSIT: // @unsit=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h case RLV_BHVR_SIT: // @sit=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h case RLV_BHVR_SITTP: // @sittp=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h diff --git a/indra/newview/rlvhandler.h b/indra/newview/rlvhandler.h index 337012132a..ee35cc5978 100644 --- a/indra/newview/rlvhandler.h +++ b/indra/newview/rlvhandler.h @@ -268,7 +268,7 @@ inline bool RlvHandler::canSendIM(const LLUUID& idRecipient) const ( (!hasBehaviour(RLV_BHVR_SENDIMTO)) || (!isException(RLV_BHVR_SENDIMTO, idRecipient)) ); } -// Checked: 2010-03-27 (RLVa-1.2.0b) | Modified: RLVa-1.0.0f +// Checked: 2010-03-27 (RLVa-1.4.0a) | Modified: RLVa-1.0.0f inline bool RlvHandler::canShowHoverText(const LLViewerObject *pObj) const { return ( (!pObj) || (LL_PCODE_VOLUME != pObj->getPCode()) || diff --git a/indra/newview/rlvui.cpp b/indra/newview/rlvui.cpp index 4b24cc9d49..cb5a8aa05e 100644 --- a/indra/newview/rlvui.cpp +++ b/indra/newview/rlvui.cpp @@ -46,10 +46,11 @@ #include "rlvui.h" #include "rlvhandler.h" +#include "rlvextensions.h" // ============================================================================ -// Checked: 2010-02-28 (RLVa-1.2.0a) | Added: RLVa-1.2.0a +// Checked: 2010-02-28 (RLVa-1.4.0a) | Added: RLVa-1.2.0a RlvUIEnabler::RlvUIEnabler() { // Connect us to the behaviour toggle signal @@ -62,6 +63,11 @@ RlvUIEnabler::RlvUIEnabler() m_Handlers.insert(std::pair(RLV_BHVR_SHOWHOVERTEXTWORLD, boost::bind(&RlvUIEnabler::onRefreshHoverText, this))); m_Handlers.insert(std::pair(RLV_BHVR_SHOWHOVERTEXTHUD, boost::bind(&RlvUIEnabler::onRefreshHoverText, this))); + // onToggleMovement + m_Handlers.insert(std::pair(RLV_BHVR_FLY, boost::bind(&RlvUIEnabler::onToggleMovement, this))); + m_Handlers.insert(std::pair(RLV_BHVR_ALWAYSRUN, boost::bind(&RlvUIEnabler::onToggleMovement, this))); + m_Handlers.insert(std::pair(RLV_BHVR_TEMPRUN, boost::bind(&RlvUIEnabler::onToggleMovement, this))); + // onToggleViewXXX m_Handlers.insert(std::pair(RLV_BHVR_VIEWNOTE, boost::bind(&RlvUIEnabler::onToggleViewXXX, this))); m_Handlers.insert(std::pair(RLV_BHVR_VIEWSCRIPT, boost::bind(&RlvUIEnabler::onToggleViewXXX, this))); @@ -69,8 +75,8 @@ RlvUIEnabler::RlvUIEnabler() // onToggleXXX m_Handlers.insert(std::pair(RLV_BHVR_EDIT, boost::bind(&RlvUIEnabler::onToggleEdit, this))); - m_Handlers.insert(std::pair(RLV_BHVR_FLY, boost::bind(&RlvUIEnabler::onToggleFly, this))); m_Handlers.insert(std::pair(RLV_BHVR_REZ, boost::bind(&RlvUIEnabler::onToggleRez, this))); + m_Handlers.insert(std::pair(RLV_BHVR_SETDEBUG, boost::bind(&RlvUIEnabler::onToggleSetDebug, this))); m_Handlers.insert(std::pair(RLV_BHVR_SETENV, boost::bind(&RlvUIEnabler::onToggleSetEnv, this))); m_Handlers.insert(std::pair(RLV_BHVR_SHOWINV, boost::bind(&RlvUIEnabler::onToggleShowInv, this, _1))); m_Handlers.insert(std::pair(RLV_BHVR_SHOWLOC, boost::bind(&RlvUIEnabler::onToggleShowLoc, this))); @@ -90,7 +96,7 @@ RlvUIEnabler::RlvUIEnabler() #endif // RLV_EXTENSION_STARTLOCATION } -// Checked: 2010-02-28 (RLVa-1.2.0b) | Added: RLVa-1.2.0a +// Checked: 2010-02-28 (RLVa-1.4.0a) | Added: RLVa-1.2.0a void RlvUIEnabler::onBehaviourToggle(ERlvBehaviour eBhvr, ERlvParamType eType) { bool fQuitting = LLApp::isQuitting(); @@ -103,7 +109,7 @@ void RlvUIEnabler::onBehaviourToggle(ERlvBehaviour eBhvr, ERlvParamType eType) // ============================================================================ -// Checked: 2010-03-02 (RLVa-1.2.0b) | Added: RLVa-1.2.0a +// Checked: 2010-03-02 (RLVa-1.4.0a) | Added: RLVa-1.2.0a void RlvUIEnabler::onRefreshHoverText() { // Refresh all hover text each time any of the monitored behaviours get set or unset @@ -139,26 +145,38 @@ void RlvUIEnabler::onToggleEdit() removeGenericFloaterFilter("beacons"); } -// Checked: 2010-03-02 (RLVa-1.2.0d) | Added: RLVa-1.2.0a -void RlvUIEnabler::onToggleFly() +// Checked: 2010-03-02 (RLVa-1.4.0a) | Modified: RLVa-1.4.0a +void RlvUIEnabler::onToggleMovement() { - bool fEnable = !gRlvHandler.hasBehaviour(RLV_BHVR_FLY); - - // Drop the avie out of the sky if currently flying and restricted - if ( (!fEnable) && (gAgent.getFlying()) ) + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_FLY)) && (gAgent.getFlying()) ) gAgent.setFlying(FALSE); + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_ALWAYSRUN)) && (gAgent.getAlwaysRun()) ) + gAgent.clearAlwaysRun(); + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_TEMPRUN)) && (gAgent.getTempRun()) ) + gAgent.clearTempRun(); // Force an update since the status only updates when the current parcel changes [see LLFloaterMove::postBuild()] - LLFloaterMove::sUpdateFlyingStatus(); + LLFloaterMove::sUpdateMovementStatus(); } -// Checked: 2010-09-11 (RLVa-1.2.1d) | Added: RLVa-1.2.1d +// Checked: 2010-09-11 (RLVa-1.4.0a) | Added: RLVa-1.2.1d void RlvUIEnabler::onToggleRez() { // Enable/disable the "Build" bottom tray button LLBottomTray::getInstance()->getChild("build_btn")->setEnabled(isBuildEnabled()); } +// Checked: 2011-05-28 (RLVa-1.4.0a) | Added: RLVa-1.4.0a +void RlvUIEnabler::onToggleSetDebug() +{ + //bool fEnable = !gRlvHandler.hasBehaviour(RLV_BHVR_SETDEBUG); + //for (auto itSetting = RlvExtGetSet::m_DbgAllowed.cbegin(); itSetting != RlvExtGetSet::m_DbgAllowed.cend(); ++itSetting) + //{ + // if (itSetting->second & RlvExtGetSet::DBG_WRITE) + // gSavedSettings.getControl(itSetting->first)->setHiddenFromSettingsEditor(!fEnable); + //} +} + // Checked: 2010-03-17 (RLVa-1.2.0a) | Added: RLVa-1.2.0a void RlvUIEnabler::onToggleSetEnv() { @@ -180,9 +198,13 @@ void RlvUIEnabler::onToggleSetEnv() removeGenericFloaterFilter(strEnvFloaters[idxFloater]); } } + + // Don't allow toggling "Basic Shaders" and/or "Atmopsheric Shaders" through the debug settings under @setenv=n + gSavedSettings.getControl("VertexShaderEnable")->setHiddenFromSettingsEditor(!fEnable); + gSavedSettings.getControl("WindLightUseAtmosShaders")->setHiddenFromSettingsEditor(!fEnable); } -// Checked: 2010-09-07 (RLVa-1.2.1a) | Modified: RLVa-1.2.1a +// Checked: 2010-09-07 (RLVa-1.4.0a) | Modified: RLVa-1.2.1a void RlvUIEnabler::onToggleShowInv(bool fQuitting) { if (fQuitting) @@ -203,7 +225,7 @@ void RlvUIEnabler::onToggleShowInv(bool fQuitting) bool fCollapsed = pSideTray->getCollapsed(); const LLPanel* pActiveTab = pSideTray->getActiveTab(); - pSideTray->toggleTabDocked("sidebar_inventory"); + pSideTray->setTabDocked("sidebar_inventory", true, false); if (pActiveTab) pSideTray->selectTabByName(pActiveTab->getName()); @@ -267,17 +289,20 @@ void RlvUIEnabler::onToggleShowInv(bool fQuitting) (*itFloater)->closeFloater(); } - // Enable/disable the "Inventory" bottom tray button - const LLBottomTray* pTray = LLBottomTray::getInstance(); - LLView* pBtnView = (pTray) ? pTray->getChildView("sidebar_inv_btn") : NULL; - if (pBtnView) - pBtnView->setEnabled(fEnable); - - // Filter out (or stop filtering) newly spawned old style inventory floaters + // + // Filter (or stop filtering) opening the inventory sidebar tab and spawning old style inventory floaters + // + RLV_ASSERT_DBG( (fEnable) || (!m_ConnSidePanelInventory.connected()) ); if (!fEnable) + { + m_ConnSidePanelInventory = pSideTray->setValidateCallback(boost::bind(&RlvUIEnabler::canOpenSidebarTab, this, RLV_BHVR_SHOWINV, "sidebar_inventory", _1, _2)); addGenericFloaterFilter("inventory"); + } else + { + m_ConnSidePanelInventory.disconnect(); removeGenericFloaterFilter("inventory"); + } } // Checked: 2010-04-22 (RLVa-1.2.0f) | Modified: RLVa-1.2.0f @@ -340,7 +365,7 @@ void RlvUIEnabler::onToggleShowLoc() m_ConnFloaterShowLoc.disconnect(); } -// Checked: 2011-05-22 (RLVa-1.3.1b) | Modified: RLVa-1.3.1b +// Checked: 2010-02-28 (RLVa-1.4.0a) | Added: RLVa-1.2.0a void RlvUIEnabler::onToggleShowMinimap() { bool fEnable = !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWMINIMAP); @@ -361,6 +386,7 @@ void RlvUIEnabler::onToggleShowMinimap() // Enable/disable the "Mini-Map" bottom tray button const LLBottomTray* pTray = LLBottomTray::getInstance(); LLView* pBtnView = (pTray) ? pTray->getChildView("mini_map_btn") : NULL; + RLV_ASSERT(pBtnView); if (pBtnView) pBtnView->setEnabled(fEnable); @@ -377,7 +403,7 @@ void RlvUIEnabler::onToggleShowMinimap() } } -// Checked: 2010-12-08 (RLVa-1.2.2c) | Modified: RLVa-1.2.2c +// Checked: 2010-12-08 (RLVa-1.4.0a) | Modified: RLVa-1.2.2c void RlvUIEnabler::onToggleShowNames(bool fQuitting) { if (fQuitting) @@ -409,7 +435,7 @@ void RlvUIEnabler::onToggleShowNames(bool fQuitting) LLVOAvatar::invalidateNameTags(); // See handleDisplayNamesOptionChanged() } -// Checked: 2010-02-28 (RLVa-1.2.0b) | Added: RLVa-1.2.0a +// Checked: 2010-02-28 (RLVa-1.4.0a) | Added: RLVa-1.2.0a void RlvUIEnabler::onToggleShowWorldMap() { bool fEnable = !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWWORLDMAP); @@ -421,6 +447,7 @@ void RlvUIEnabler::onToggleShowWorldMap() // Enable/disable the "Map" bottom tray button const LLBottomTray* pTray = LLBottomTray::getInstance(); LLView* pBtnView = (pTray) ? pTray->getChildView("world_map_btn") : NULL; + RLV_ASSERT(pBtnView); if (pBtnView) pBtnView->setEnabled(fEnable); @@ -479,8 +506,8 @@ void RlvUIEnabler::onUpdateLoginLastLocation() // ============================================================================ -// Checked: 2010-02-28 (RLVa-1.2.0b) | Added: RLVa-1.2.0a -inline void RlvUIEnabler::addGenericFloaterFilter(const std::string& strFloaterName) +// Checked: 2010-02-28 (RLVa-1.4.0a) | Added: RLVa-1.2.0a +void RlvUIEnabler::addGenericFloaterFilter(const std::string& strFloaterName) { m_FilteredFloaters.insert(strFloaterName); @@ -488,8 +515,8 @@ inline void RlvUIEnabler::addGenericFloaterFilter(const std::string& strFloaterN m_ConnFloaterGeneric = LLFloaterReg::setValidateCallback(boost::bind(&RlvUIEnabler::filterFloaterGeneric, this, _1, _2)); } -// Checked: 2010-02-28 (RLVa-1.2.0b) | Added: RLVa-1.2.0a -inline void RlvUIEnabler::removeGenericFloaterFilter(const std::string& strFloaterName) +// Checked: 2010-02-28 (RLVa-1.4.0a) | Added: RLVa-1.2.0a +void RlvUIEnabler::removeGenericFloaterFilter(const std::string& strFloaterName) { std::multiset::iterator itFloater = m_FilteredFloaters.find(strFloaterName); RLV_ASSERT_DBG(itFloater != m_FilteredFloaters.end()); @@ -500,10 +527,10 @@ inline void RlvUIEnabler::removeGenericFloaterFilter(const std::string& strFloat m_ConnFloaterGeneric.disconnect(); } -// Checked: 2010-02-28 (RLVa-1.2.0b) | Added: RLVa-1.2.0a +// Checked: 2010-02-28 (RLVa-1.4.0a) | Added: RLVa-1.2.0a bool RlvUIEnabler::filterFloaterGeneric(const std::string& strName, const LLSD&) { - return m_FilteredFloaters.find(strName) == m_FilteredFloaters.end(); + return m_FilteredFloaters.end() == m_FilteredFloaters.find(strName); } // Checked: 2010-04-22 (RLVa-1.2.0f) | Added: RLVa-1.2.0f @@ -539,6 +566,13 @@ bool RlvUIEnabler::filterFloaterViewXXX(const std::string& strName, const LLSD&) return true; } +// Checked: 2010-03-01 (RLVa-1.4.0a) | Added: RLVa-1.2.0a +bool RlvUIEnabler::canOpenSidebarTab(ERlvBehaviour eBhvrFilter, const std::string& strNameFilter, LLUICtrl* pCtrl, const LLSD& sdParam) +{ + // NOTE: pCtrl->getName() is the name of the sidebar tab and sdParam is the name of the child panel being activated (can be omitted) + return (!gRlvHandler.hasBehaviour(eBhvrFilter)) || (strNameFilter != pCtrl->getName()); +} + // ============================================================================ // Checked: 2010-04-20 (RLVa-1.2.0f) | Modified: RLVa-1.2.0f diff --git a/indra/newview/rlvui.h b/indra/newview/rlvui.h index d0e69095d3..166d3f7524 100644 --- a/indra/newview/rlvui.h +++ b/indra/newview/rlvui.h @@ -37,8 +37,6 @@ protected: * Signal callbacks */ public: - typedef boost::function behaviour_handler_t; - void addBehaviourToggleCallback(ERlvBehaviour eBhvr, behaviour_handler_t cb); void onBehaviourToggle(ERlvBehaviour eBhvr, ERlvParamType eType); // RlvHandler::rlv_behaviour_signal_t /* @@ -47,8 +45,9 @@ public: protected: void onRefreshHoverText(); // showloc, shownames, showhovertext(all|world|hud) void onToggleEdit(); // edit - void onToggleFly(); // fly + void onToggleMovement(); // fly, alwaysrun and temprun void onToggleRez(); // rez + void onToggleSetDebug(); // setdebug void onToggleSetEnv(); // setenv void onToggleShowInv(bool fQuitting); // showinv void onToggleShowLoc(); // showloc @@ -60,20 +59,23 @@ protected: void onToggleViewXXX(); // viewnote, viewscript, viewtexture void onUpdateLoginLastLocation(); // tploc and unsit - /* - * Floater validation callbacks + /* + * Floater and sidebar validation callbacks */ protected: void addGenericFloaterFilter(const std::string& strFloaterName); void removeGenericFloaterFilter(const std::string& strFloaterName); + bool filterFloaterGeneric(const std::string&, const LLSD&); boost::signals2::connection m_ConnFloaterGeneric; - bool filterFloaterShowLoc(const std::string&, const LLSD& ); boost::signals2::connection m_ConnFloaterShowLoc; // showloc bool filterFloaterViewXXX(const std::string&, const LLSD&); boost::signals2::connection m_ConnFloaterViewXXX; // viewnote, viewscript, viewtexture + bool canOpenSidebarTab(ERlvBehaviour, const std::string&, LLUICtrl*, const LLSD&); + boost::signals2::connection m_ConnSidePanelInventory; // showinv + /* * Helper functions */ @@ -88,21 +90,13 @@ public: * Member variables */ protected: + typedef boost::function behaviour_handler_t; typedef std::multimap behaviour_handler_map_t; behaviour_handler_map_t m_Handlers; std::multiset m_FilteredFloaters; }; -// ============================================================================ -// Inlined member functions - -// Checked: 2010-11-02 (RLVa-1.2.2a) | Added: RLVa-1.2.2a -inline void RlvUIEnabler::addBehaviourToggleCallback(ERlvBehaviour eBhvr, behaviour_handler_t cb) -{ - m_Handlers.insert(std::pair(eBhvr, cb)); -} - // ============================================================================ #endif // RLV_UI_H