hbpanellandenvironment.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /**
  2. * @file hbpanellandenvironment.h
  3. * @brief Configuration of environmemt settings for land (parcel or region).
  4. *
  5. * $LicenseInfo:firstyear=2019&license=viewergpl$
  6. *
  7. * Copyright (c) 2019-2023 Henri Beauchamp
  8. *
  9. * Second Life Viewer Source Code
  10. * The source code in this file ("Source Code") is provided by Linden Lab
  11. * to you under the terms of the GNU General Public License, version 2.0
  12. * ("GPL"), unless you have obtained a separate licensing agreement
  13. * ("Other License"), formally executed by you and Linden Lab. Terms of
  14. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  15. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  16. *
  17. * There are special exceptions to the terms and conditions of the GPL as
  18. * it is applied to this Source Code. View the full text of the exception
  19. * in the file doc/FLOSS-exception.txt in this software distribution, or
  20. * online at
  21. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  22. *
  23. * By copying, modifying or distributing this software, you acknowledge
  24. * that you have read and understood your obligations described above,
  25. * and agree to abide by those obligations.
  26. *
  27. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  28. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  29. * COMPLETENESS OR PERFORMANCE.
  30. * $/LicenseInfo$
  31. */
  32. #ifndef LL_HBPANELLANDENVIRONMENT_H
  33. #define LL_HBPANELLANDENVIRONMENT_H
  34. #include "llpanel.h"
  35. #include "llenvironment.h"
  36. #include "llparcelselection.h"
  37. class LLButton;
  38. class LLCheckBoxCtrl;
  39. class LLFloaterEditEnvSettings;
  40. class LLMultiSliderCtrl;
  41. class HBSettingsDropTarget;
  42. class LLSliderCtrl;
  43. class LLTextBox;
  44. class LLViewerInventoryItem;
  45. class LLViewerRegion;
  46. class HBPanelLandEnvironment final : public LLPanel
  47. {
  48. friend class HBSettingsDropTarget;
  49. friend class LLPanelEstateInfo;
  50. protected:
  51. LOG_CLASS(HBPanelLandEnvironment);
  52. bool postBuild() override;
  53. void draw() override;
  54. public:
  55. HBPanelLandEnvironment(LLSafeHandle<LLParcelSelection>& parcelp);
  56. HBPanelLandEnvironment(U64 region_handle);
  57. ~HBPanelLandEnvironment() override;
  58. void refresh() override;
  59. void setEnabled(bool enabled) override;
  60. void setRegionHandle(U64 handle);
  61. LLViewerRegion* getRegion();
  62. LLParcel* getParcel();
  63. S32 getParcelId();
  64. protected:
  65. void onChoosenItem(LLViewerInventoryItem* itemp, S32 track);
  66. void resetOverride();
  67. private:
  68. bool isAgentRegion();
  69. void refreshFromRegion();
  70. void refreshFromParcel();
  71. void onEnvironmentChanged(LLEnvironment::EEnvSelection env, S32 version);
  72. void onEnvironmentReceived(S32 parcel_id,
  73. LLEnvironment::envinfo_ptr_t info);
  74. void commitDayParametersChanges();
  75. void applyDayCycle(LLSettingsDay::ptr_t dayp, bool edited = false);
  76. void updateApparentTimeOfDay();
  77. void updateAltitudeLabels();
  78. void updateTrackNames();
  79. std::string getNameForTrack(S32 track);
  80. void loadInventoryItem(LLUUID inv_item_id);
  81. void onAssetLoaded(const std::string& name, const LLUUID& asset_id,
  82. LLSettingsBase::ptr_t settings, S32 status);
  83. bool closeEditFloater(bool force = false);
  84. static void invPickerCallback(const std::vector<std::string>&,
  85. const uuid_vec_t& ids, void* userdata, bool);
  86. static void onBtnDefault(void* userdata);
  87. static void onBtnInventory(void* userdata);
  88. static void onBtnCustom(void* userdata);
  89. static void onBtnReset(void* userdata);
  90. static void onAllowOverride(LLUICtrl* ctrl, void* userdata);
  91. static void onDayParametersChanged(LLUICtrl*, void* userdata);
  92. static void onAltSliderCommit(LLUICtrl* ctrl, void* userdata);
  93. static void onAltSliderMouseUp(S32, S32, void* userdata);
  94. protected:
  95. LLEnvironment::envinfo_ptr_t mCurrentEnvironment;
  96. private:
  97. LLButton* mUseDefaultBtn;
  98. LLButton* mUseInventoryBtn;
  99. LLButton* mUseCustomBtn;
  100. LLButton* mResetAltitudesBtn;
  101. LLSliderCtrl* mDayLengthSlider;
  102. LLSliderCtrl* mDayOffsetSlider;
  103. LLCheckBoxCtrl* mAllowOverrideCheck;
  104. LLMultiSliderCtrl* mAltitudesSlider;
  105. LLTextBox* mApparentDayLengthText;
  106. LLTextBox* mAltitude2ValueText;
  107. LLTextBox* mAltitude3ValueText;
  108. LLTextBox* mAltitude4ValueText;
  109. std::vector<HBSettingsDropTarget*> mDropTargets;
  110. LLHandle<LLFloater> mEditFloaterHandle;
  111. typedef boost::signals2::connection connection_t;
  112. connection_t mChangeConnection;
  113. connection_t mCommitConnection;
  114. LLSafeHandle<LLParcelSelection>& mParcel;
  115. U64 mRegionHandle;
  116. F32 mLastParametersChange;
  117. F32 mLastTimeOfDayUpdate;
  118. S32 mCurEnvVersion;
  119. S32 mLastParcelId;
  120. bool mIsRegion;
  121. bool mDayParametersDirty;
  122. bool mEnvOverrideCheck;
  123. bool mLastEnabledState;
  124. };
  125. #endif // LL_HBPANELLANDENVIRONMENT_H