diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index d3ad55faeebfafbd05dcc7974db9016c58662da0..d91cb74a99e3cbaf06e5364ef225b7cb74138b4b 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -112,6 +112,7 @@ include_directories(SYSTEM set(viewer_SOURCE_FILES alavataractions.cpp alchatcommand.cpp + alcontrolcache.cpp alfloaterparticleeditor.cpp alfloaterregiontracker.cpp alunzip.cpp @@ -752,6 +753,7 @@ set(viewer_HEADER_FILES ViewerInstall.cmake alavataractions.h alchatcommand.h + alcontrolcache.h alfloaterparticleeditor.h alfloaterregiontracker.h alunzip.h diff --git a/indra/newview/alcontrolcache.cpp b/indra/newview/alcontrolcache.cpp new file mode 100644 index 0000000000000000000000000000000000000000..eaf05a3bfdea7a93040fae5becaf2fb428798900 --- /dev/null +++ b/indra/newview/alcontrolcache.cpp @@ -0,0 +1,63 @@ +#include "llviewerprecompiledheaders.h" + +#include "alcontrolcache.h" +#include "llviewercontrol.h" + +bool ALControlCache::EditLinkedParts = false; +F32 ALControlCache::GridDrawSize; +F32 ALControlCache::GridOpacity; +F32 ALControlCache::GridResolution; +bool ALControlCache::LimitSelectDistance = true; +bool ALControlCache::MapShowInfohubs; +bool ALControlCache::MapShowEvents; +bool ALControlCache::MapShowLandForSale; +bool ALControlCache::MapShowPeople; +bool ALControlCache::MapShowTelehubs; +bool ALControlCache::NavBarShowParcelProperties = true; +U32 ALControlCache::PreferredMaturity; +bool ALControlCache::SnapEnabled; +S32 ALControlCache::ToastGap; + + +#define DECLARE_CTRL(ctrl, type, ctrl_type) \ + { \ + LLControlVariable* cntrl_ptr = gSavedSettings.getControl(#ctrl); \ + if (!cntrl_ptr) \ + { \ + LL_WARNS() << "Global setting name not found:" << #ctrl << LL_ENDL; \ + } \ + else \ + { \ + cntrl_ptr->getSignal()->connect(0, [&](LLControlVariable* control, const LLSD& new_val, const LLSD&) \ + { \ + ctrl = convert_from_llsd<type>(new_val, ctrl_type, #ctrl); \ + }); \ + ctrl = convert_from_llsd<type>(cntrl_ptr->getValue(), ctrl_type, #ctrl); \ + LL_INFOS() << "Global cached setting: " << #ctrl << " initialized with value: " << ctrl << LL_ENDL; \ + } \ + } \ + +#define DECLARE_CTRL_BOOL(ctrl) DECLARE_CTRL(ctrl, bool, TYPE_BOOLEAN); +#define DECLARE_CTRL_F32(ctrl) DECLARE_CTRL(ctrl, F32, TYPE_F32); +#define DECLARE_CTRL_U32(ctrl) DECLARE_CTRL(ctrl, U32, TYPE_U32); +#define DECLARE_CTRL_S32(ctrl) DECLARE_CTRL(ctrl, S32, TYPE_S32); + +// static +void ALControlCache::initControls() +{ + // Keep this list alphabatized. + DECLARE_CTRL_BOOL(EditLinkedParts); + DECLARE_CTRL_F32(GridDrawSize); + DECLARE_CTRL_F32(GridOpacity); + DECLARE_CTRL_F32(GridResolution); + DECLARE_CTRL_BOOL(LimitSelectDistance); + DECLARE_CTRL_BOOL(MapShowInfohubs); + DECLARE_CTRL_BOOL(MapShowEvents); + DECLARE_CTRL_BOOL(MapShowLandForSale); + DECLARE_CTRL_BOOL(MapShowPeople); + DECLARE_CTRL_BOOL(MapShowTelehubs); + DECLARE_CTRL_BOOL(NavBarShowParcelProperties); + DECLARE_CTRL_U32(PreferredMaturity); + DECLARE_CTRL_BOOL(SnapEnabled); + DECLARE_CTRL_S32(ToastGap); +} diff --git a/indra/newview/alcontrolcache.h b/indra/newview/alcontrolcache.h new file mode 100644 index 0000000000000000000000000000000000000000..596ca5b1b4ee339c7784275d0ee75f21d190f967 --- /dev/null +++ b/indra/newview/alcontrolcache.h @@ -0,0 +1,24 @@ +#ifndef AL_ALCONTROLCACHE_H +#define AL_ALCONTROLCACHE_H + +struct ALControlCache +{ + static void initControls(); + + static bool EditLinkedParts; + static F32 GridDrawSize; + static F32 GridOpacity; + static F32 GridResolution; + static bool LimitSelectDistance; + static bool MapShowInfohubs; + static bool MapShowEvents; + static bool MapShowLandForSale; + static bool MapShowPeople; + static bool MapShowTelehubs; + static bool NavBarShowParcelProperties; + static U32 PreferredMaturity; + static bool SnapEnabled; + static S32 ToastGap; +}; + +#endif \ No newline at end of file diff --git a/indra/newview/llviewercontrol.h b/indra/newview/llviewercontrol.h index d7191f5c8d5d8703ec7d76b80fdb8ab9a2c49259..1f05130ccfd6eb2fa802f53d2a25820ee6148efb 100644 --- a/indra/newview/llviewercontrol.h +++ b/indra/newview/llviewercontrol.h @@ -29,6 +29,7 @@ #include <map> #include "llcontrol.h" +#include "alcontrolcache.h" // Enabled this definition to compile a 'hacked' viewer that // allows a hacked godmode to be toggled on and off.