llfloatergodtools.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. /**
  2. * @file llfloatergodtools.h
  3. * @brief The on-screen rectangle with tool options.
  4. *
  5. * $LicenseInfo:firstyear=2002&license=viewergpl$
  6. *
  7. * Copyright (c) 2002-2009, Linden Research, Inc.
  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_LLFLOATERGODTOOLS_H
  33. #define LL_LLFLOATERGODTOOLS_H
  34. #include "llfloater.h"
  35. #include "llframetimer.h"
  36. #include "llhost.h"
  37. class LLLineEditor;
  38. class LLMessageSystem;
  39. class LLPanelGridTools;
  40. class LLPanelObjectTools;
  41. class LLPanelRegionTools;
  42. class LLPanelRequestTools;
  43. class LLFloaterGodTools final : public LLFloater,
  44. public LLFloaterSingleton<LLFloaterGodTools>
  45. {
  46. friend class LLUISingleton<LLFloaterGodTools,
  47. VisibilityPolicy<LLFloater> >;
  48. friend class LLPanelGridTools;
  49. friend class LLPanelObjectTools;
  50. friend class LLPanelRegionTools;
  51. friend class LLPanelRequestTools;
  52. public:
  53. bool postBuild() override;
  54. void onOpen() override;
  55. void draw() override;
  56. // Processes received region info when the floater exists.
  57. static void updateFromRegionInfo();
  58. private:
  59. // Open only via LLFloaterSingleton interface, i.e. showInstance() or
  60. // toggleInstance().
  61. LLFloaterGodTools(const LLSD&);
  62. static void* createPanelGrid(void* userdata);
  63. static void* createPanelRegion(void* userdata);
  64. static void* createPanelObjects(void* userdata);
  65. static void* createPanelRequest(void* userdata);
  66. static void onTabChanged(void* userdata, bool from_click);
  67. protected:
  68. // Send possibly changed values to simulator.
  69. void sendGodUpdateRegionInfo();
  70. // Get data to populate UI.
  71. void sendRegionInfoRequest();
  72. U64 computeRegionFlags() const;
  73. // When the floater is going away, reset any options that need to be
  74. // cleared.
  75. void resetToolState();
  76. protected:
  77. LLPanelRegionTools* mPanelRegionTools;
  78. LLPanelObjectTools* mPanelObjectTools;
  79. LLHost mCurrentHost;
  80. LLFrameTimer mUpdateTimer;
  81. };
  82. //-----------------------------------------------------------------------------
  83. // LLPanelRegionTools
  84. //-----------------------------------------------------------------------------
  85. class LLPanelRegionTools final : public LLPanel
  86. {
  87. public:
  88. LLPanelRegionTools(const std::string& name);
  89. bool postBuild() override;
  90. // Set internal checkboxes/spinners/combos
  91. const std::string getSimName() const;
  92. U32 getEstateID() const;
  93. U32 getParentEstateID() const;
  94. U64 getRegionFlags() const;
  95. U64 getRegionFlagsMask() const;
  96. F32 getBillableFactor() const;
  97. S32 getPricePerMeter() const;
  98. S32 getGridPosX() const;
  99. S32 getGridPosY() const;
  100. S32 getRedirectGridX() const;
  101. S32 getRedirectGridY() const;
  102. // set internal checkboxes/spinners/combos
  103. void setSimName(const std::string& name);
  104. void setEstateID(U32 id);
  105. void setParentEstateID(U32 id);
  106. void setCheckFlags(U64 flags);
  107. void setBillableFactor(F32 billable_factor);
  108. void setPricePerMeter(S32 price);
  109. void setGridPosX(S32 pos);
  110. void setGridPosY(S32 pos);
  111. void setRedirectGridX(S32 pos);
  112. void setRedirectGridY(S32 pos);
  113. U64 computeRegionFlags(U64 initial_flags) const;
  114. void clearAllWidgets();
  115. void enableAllWidgets();
  116. // Used as a menu callback in llviewermenu.cpp
  117. static void onSaveState(void* userdata);
  118. private:
  119. // Gets from internal checkboxes/spinners/combos
  120. void updateCurrentRegion() const;
  121. static void onChangeAnything(LLUICtrl*, void* userdata);
  122. static void onChangePrelude(LLUICtrl* ctrl, void* userdata);
  123. static void onChangeSimName(LLLineEditor* caller, void* userdata);
  124. static void onApplyChanges(void* userdata);
  125. static void onBakeTerrain(void* userdata);
  126. static void onRevertTerrain(void* userdata);
  127. static void onSwapTerrain(void* userdata);
  128. static void onSelectRegion(void* userdata);
  129. static void onRefresh(void* userdata);
  130. };
  131. //-----------------------------------------------------------------------------
  132. // LLPanelGridTools
  133. //-----------------------------------------------------------------------------
  134. class LLPanelGridTools final : public LLPanel
  135. {
  136. public:
  137. LLPanelGridTools(const std::string& name);
  138. bool postBuild() override;
  139. private:
  140. static void onClickKickAll(void* userdata);
  141. static bool confirmKick(const LLSD& notification, const LLSD& response);
  142. static bool finishKick(const LLSD& notification, const LLSD& response);
  143. static void onDragSunPhase(LLUICtrl* ctrl, void* userdata);
  144. static void onClickFlushMapVisibilityCaches(void* userdata);
  145. static bool flushMapVisibilityCachesConfirm(const LLSD& notification,
  146. const LLSD& response);
  147. };
  148. //-----------------------------------------------------------------------------
  149. // LLPanelObjectTools
  150. //-----------------------------------------------------------------------------
  151. class LLPanelObjectTools final : public LLPanel
  152. {
  153. public:
  154. LLPanelObjectTools(const std::string& name);
  155. bool postBuild() override;
  156. void refresh() override;
  157. void setTargetAvatar(const LLUUID& target_id);
  158. U64 computeRegionFlags(U64 initial_flags) const;
  159. void clearAllWidgets();
  160. void enableAllWidgets();
  161. void setCheckFlags(U64 flags);
  162. private:
  163. static void onChangeAnything(LLUICtrl* ctrl, void* userdata);
  164. static void onApplyChanges(void* userdata);
  165. static void onClickSet(void* userdata);
  166. static void callbackAvatarID(const std::vector<std::string>& names,
  167. const uuid_vec_t& ids, void* userdata);
  168. static void onClickDeletePublicOwnedBy(void* userdata);
  169. static void onClickDeleteAllScriptedOwnedBy(void* userdata);
  170. static void onClickDeleteAllOwnedBy(void* userdata);
  171. static bool callbackSimWideDeletes(const LLSD& notification,
  172. const LLSD& response);
  173. static void onGetTopColliders(void* userdata);
  174. static void onGetTopScripts(void* userdata);
  175. static void onGetScriptDigest(void* userdata);
  176. static void onClickSetBySelection(void* userdata);
  177. private:
  178. LLUUID mTargetAvatar;
  179. // For all delete dialogs, store flags here for message.
  180. U32 mSimWideDeletesFlags;
  181. };
  182. //-----------------------------------------------------------------------------
  183. // LLPanelRequestTools
  184. //-----------------------------------------------------------------------------
  185. class LLPanelRequestTools final : public LLPanel
  186. {
  187. public:
  188. LLPanelRequestTools(const std::string& name);
  189. bool postBuild() override;
  190. void refresh() override;
  191. static void sendRequest(const std::string& request,
  192. const std::string& parameter,
  193. const LLHost& host);
  194. private:
  195. static void onClickRequest(void* userdata);
  196. void sendRequest(const LLHost& host);
  197. };
  198. // Also used by llfloaterregioninfo.cpp
  199. void send_sim_wide_deletes(const LLUUID& owner_id, U32 flags);
  200. #endif