llfloaterbeacons.cpp 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. /**
  2. * @file llfloaterbeacons.cpp
  3. * @brief Front-end to LLPipeline controls for highlighting various kinds of objects.
  4. * @author Coco
  5. *
  6. * $LicenseInfo:firstyear=2001&license=viewergpl$
  7. *
  8. * Copyright (c) 2001-2009, Linden Research, Inc.
  9. *
  10. * Second Life Viewer Source Code
  11. * The source code in this file ("Source Code") is provided by Linden Lab
  12. * to you under the terms of the GNU General Public License, version 2.0
  13. * ("GPL"), unless you have obtained a separate licensing agreement
  14. * ("Other License"), formally executed by you and Linden Lab. Terms of
  15. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  16. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  17. *
  18. * There are special exceptions to the terms and conditions of the GPL as
  19. * it is applied to this Source Code. View the full text of the exception
  20. * in the file doc/FLOSS-exception.txt in this software distribution, or
  21. * online at
  22. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  23. *
  24. * By copying, modifying or distributing this software, you acknowledge
  25. * that you have read and understood your obligations described above,
  26. * and agree to abide by those obligations.
  27. *
  28. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  29. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  30. * COMPLETENESS OR PERFORMANCE.
  31. * $/LicenseInfo$
  32. */
  33. #include "llviewerprecompiledheaders.h"
  34. #include "llfloaterbeacons.h"
  35. #include "llcheckboxctrl.h"
  36. #include "lluictrlfactory.h"
  37. #include "llpipeline.h"
  38. //MK
  39. #include "mkrlinterface.h"
  40. //mk
  41. #include "llviewercontrol.h"
  42. LLFloaterBeacons::LLFloaterBeacons(const LLSD&)
  43. {
  44. LLUICtrlFactory::getInstance()->buildFloater(this, "floater_beacons.xml");
  45. }
  46. bool LLFloaterBeacons::postBuild()
  47. {
  48. childSetCommitCallback("touch_only", onClickUICheck, this);
  49. childSetCommitCallback("scripted", onClickUICheck, this);
  50. childSetCommitCallback("physical", onClickUICheck, this);
  51. childSetCommitCallback("permanent", onClickUICheck, this);
  52. childSetCommitCallback("character", onClickUICheck, this);
  53. childSetCommitCallback("sounds", onClickUICheck, this);
  54. childSetCommitCallback("particles", onClickUICheck, this);
  55. childSetCommitCallback("moap", onClickUICheck, this);
  56. childSetCommitCallback("highlights", onClickUICheck, this);
  57. childSetCommitCallback("beacons", onClickUICheck, this);
  58. childSetCommitCallback("invisiblesounds", onClickUICheck, this);
  59. childSetCommitCallback("attachments", onClickUICheck, this);
  60. childSetCommitCallback("owner", onClickUICheck, this);
  61. return true;
  62. }
  63. // Needed to make the floater visibility toggle the beacons.
  64. //virtual
  65. void LLFloaterBeacons::open()
  66. {
  67. //MK
  68. if (gRLenabled &&
  69. (gRLInterface.mContainsEdit || gRLInterface.mVisionRestricted))
  70. {
  71. return;
  72. }
  73. //mk
  74. LLFloater::open();
  75. LLPipeline::sRenderBeaconsFloaterOpen = true;
  76. // Sort out any possible conflict
  77. if (!LLPipeline::sRenderBeacons && !LLPipeline::sRenderHighlight)
  78. {
  79. gSavedSettings.setBool("renderhighlights", true);
  80. }
  81. if (LLPipeline::sRenderInvisibleSoundBeacons &&
  82. (!LLPipeline::sRenderBeacons || !LLPipeline::sRenderSoundBeacons))
  83. {
  84. gSavedSettings.setBool("invisiblesoundsbeacon", false);
  85. }
  86. if (LLPipeline::sRenderScriptedTouchBeacons &&
  87. LLPipeline::sRenderScriptedBeacons)
  88. {
  89. gSavedSettings.setBool("scripttouchbeacon", false);
  90. }
  91. }
  92. //MK
  93. //virtual
  94. void LLFloaterBeacons::draw()
  95. {
  96. // Fast enough that it can be kept here
  97. if (gRLenabled &&
  98. (gRLInterface.mContainsEdit || gRLInterface.mVisionRestricted))
  99. {
  100. gSavedSettings.setBool("BeaconAlwaysOn", false);
  101. close();
  102. return;
  103. }
  104. LLFloater::draw();
  105. }
  106. //mk
  107. //virtual
  108. void LLFloaterBeacons::close(bool app_quitting)
  109. {
  110. LLFloater::close(app_quitting);
  111. if (!app_quitting)
  112. {
  113. LLPipeline::sRenderBeaconsFloaterOpen = false;
  114. }
  115. }
  116. // Callback attached to each check box control to both affect their main purpose
  117. // and to implement the couple screwy interdependency rules that some have.
  118. //static
  119. void LLFloaterBeacons::onClickUICheck(LLUICtrl* ctrl, void* data)
  120. {
  121. LLCheckBoxCtrl* check = (LLCheckBoxCtrl*)ctrl;
  122. if (!check) return;
  123. std::string name = check->getName();
  124. if (name == "touch_only")
  125. {
  126. // Don't allow both to be ON at the same time. Toggle the other one off
  127. // if both now on.
  128. if (LLPipeline::sRenderScriptedTouchBeacons &&
  129. LLPipeline::sRenderScriptedBeacons)
  130. {
  131. gSavedSettings.setBool("scriptsbeacon", false);
  132. }
  133. }
  134. else if (name == "scripted")
  135. {
  136. if (LLPipeline::sRenderScriptedTouchBeacons &&
  137. LLPipeline::sRenderScriptedBeacons)
  138. {
  139. gSavedSettings.setBool("scripttouchbeacon", false);
  140. }
  141. }
  142. else if (name == "sounds")
  143. {
  144. if (!LLPipeline::sRenderSoundBeacons &&
  145. LLPipeline::sRenderInvisibleSoundBeacons)
  146. {
  147. gSavedSettings.setBool("invisiblesoundsbeacon", false);
  148. }
  149. }
  150. else if (name == "invisiblesounds")
  151. {
  152. if (LLPipeline::sRenderInvisibleSoundBeacons)
  153. {
  154. if (!LLPipeline::sRenderSoundBeacons)
  155. {
  156. gSavedSettings.setBool("soundsbeacon", true);
  157. }
  158. if (!LLPipeline::sRenderBeacons)
  159. {
  160. gSavedSettings.setBool("renderbeacons", true);
  161. }
  162. }
  163. }
  164. else if (name == "highlights")
  165. {
  166. // Don't allow both to be OFF at the same time. Toggle the other one on
  167. // if both now off.
  168. if (!LLPipeline::sRenderBeacons && !LLPipeline::sRenderHighlight)
  169. {
  170. gSavedSettings.setBool("renderbeacons", true);
  171. }
  172. }
  173. else if (name == "beacons")
  174. {
  175. if (!LLPipeline::sRenderBeacons)
  176. {
  177. // Don't allow both to be OFF at the same time. Toggle the other
  178. // one on if both now off.
  179. if (!LLPipeline::sRenderHighlight)
  180. {
  181. gSavedSettings.setBool("renderhighlights", true);
  182. }
  183. if (LLPipeline::sRenderInvisibleSoundBeacons)
  184. {
  185. gSavedSettings.setBool("invisiblesoundsbeacon", false);
  186. }
  187. }
  188. }
  189. }