aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfloaterbeacons.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-12-01 17:39:58 -0600
committerJacek Antonelli2008-12-01 17:40:06 -0600
commit7abecb48babe6a6f09bf6692ba55076546cfced9 (patch)
tree8d18a88513fb97adf32c10aae78f4be1984942db /linden/indra/newview/llfloaterbeacons.cpp
parentSecond Life viewer sources 1.21.6 (diff)
downloadmeta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.zip
meta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.tar.gz
meta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.tar.bz2
meta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.tar.xz
Second Life viewer sources 1.22.0-RC
Diffstat (limited to 'linden/indra/newview/llfloaterbeacons.cpp')
-rw-r--r--linden/indra/newview/llfloaterbeacons.cpp150
1 files changed, 150 insertions, 0 deletions
diff --git a/linden/indra/newview/llfloaterbeacons.cpp b/linden/indra/newview/llfloaterbeacons.cpp
new file mode 100644
index 0000000..0b73186
--- /dev/null
+++ b/linden/indra/newview/llfloaterbeacons.cpp
@@ -0,0 +1,150 @@
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-2008, 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 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
33#include "llviewerprecompiledheaders.h"
34#include "llfloaterbeacons.h"
35#include "llviewercontrol.h"
36#include "lluictrlfactory.h"
37#include "llcheckboxctrl.h"
38#include "pipeline.h"
39
40
41LLFloaterBeacons::LLFloaterBeacons(const LLSD& seed)
42{
43 LLUICtrlFactory::getInstance()->buildFloater(this, "floater_beacons.xml");
44
45 // Initialize pipeline states from saved settings.
46 // OK to do at floater constructor time because beacons do not display unless the floater is open
47 // therefore it is OK to not initialize the pipeline state before needed.
48 // Note also that we should replace those pipeline statics with direct lookup of the saved settings
49 // eliminating the need to keep these states in sync.
50 LLPipeline::setRenderScriptedTouchBeacons(gSavedSettings.getBOOL("scripttouchbeacon"));
51 LLPipeline::setRenderScriptedBeacons( gSavedSettings.getBOOL("scriptsbeacon"));
52 LLPipeline::setRenderPhysicalBeacons( gSavedSettings.getBOOL("physicalbeacon"));
53 LLPipeline::setRenderSoundBeacons( gSavedSettings.getBOOL("soundsbeacon"));
54 LLPipeline::setRenderParticleBeacons( gSavedSettings.getBOOL("particlesbeacon"));
55 LLPipeline::setRenderHighlights( gSavedSettings.getBOOL("renderhighlights"));
56 LLPipeline::setRenderBeacons( gSavedSettings.getBOOL("renderbeacons"));
57}
58
59BOOL LLFloaterBeacons::postBuild()
60{
61 childSetCommitCallback("touch_only", onClickUICheck, this);
62 childSetCommitCallback("scripted", onClickUICheck, this);
63 childSetCommitCallback("physical", onClickUICheck, this);
64 childSetCommitCallback("sounds", onClickUICheck, this);
65 childSetCommitCallback("particles", onClickUICheck, this);
66 childSetCommitCallback("highlights", onClickUICheck, this);
67 childSetCommitCallback("beacons", onClickUICheck, this);
68 return TRUE;
69}
70
71// Needed to make the floater visibility toggle the beacons.
72// Too bad we can't just add control_name="BeaconAlwaysOn" to the XML.
73void LLFloaterBeacons::open()
74{
75 LLFloater::open();
76 gSavedSettings.setBOOL( "BeaconAlwaysOn", TRUE);
77}
78void LLFloaterBeacons::close(bool app_quitting)
79{
80 LLFloater::close(app_quitting);
81 if(!app_quitting)
82 {
83 gSavedSettings.setBOOL( "BeaconAlwaysOn", FALSE);
84 }
85}
86
87// Callback attached to each check box control to both affect their main purpose
88// and to implement the couple screwy interdependency rules that some have.
89//static
90void LLFloaterBeacons::onClickUICheck(LLUICtrl *ctrl, void* data)
91{
92 LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl;
93 std::string name = check->getName();
94 LLFloaterBeacons* view = (LLFloaterBeacons*)data;
95 if( name == "touch_only")
96 {
97 LLPipeline::toggleRenderScriptedTouchBeacons(NULL);
98 // Don't allow both to be ON at the same time. Toggle the other one off if both now on.
99 if (
100 LLPipeline::getRenderScriptedTouchBeacons(NULL) &&
101 LLPipeline::getRenderScriptedBeacons(NULL) )
102 {
103 LLPipeline::setRenderScriptedBeacons(FALSE);
104 view->getChild<LLCheckBoxCtrl>("scripted")->setControlValue(LLSD(FALSE));
105 view->getChild<LLCheckBoxCtrl>("touch_only")->setControlValue(LLSD(TRUE)); // just to be sure it's in sync with llpipeline
106 }
107 }
108 else if(name == "scripted")
109 {
110 LLPipeline::toggleRenderScriptedBeacons(NULL);
111 // Don't allow both to be ON at the same time. Toggle the other one off if both now on.
112 if (
113 LLPipeline::getRenderScriptedTouchBeacons(NULL) &&
114 LLPipeline::getRenderScriptedBeacons(NULL) )
115 {
116 LLPipeline::setRenderScriptedTouchBeacons(FALSE);
117 view->getChild<LLCheckBoxCtrl>("touch_only")->setControlValue(LLSD(FALSE));
118 view->getChild<LLCheckBoxCtrl>("scripted")->setControlValue(LLSD(TRUE)); // just to be sure it's in sync with llpipeline
119 }
120 }
121 else if(name == "physical") LLPipeline::setRenderPhysicalBeacons(check->get());
122 else if(name == "sounds") LLPipeline::setRenderSoundBeacons(check->get());
123 else if(name == "particles") LLPipeline::setRenderParticleBeacons(check->get());
124 else if(name == "highlights")
125 {
126 LLPipeline::toggleRenderHighlights(NULL);
127 // Don't allow both to be OFF at the same time. Toggle the other one on if both now off.
128 if (
129 !LLPipeline::getRenderBeacons(NULL) &&
130 !LLPipeline::getRenderHighlights(NULL) )
131 {
132 LLPipeline::setRenderBeacons(TRUE);
133 view->getChild<LLCheckBoxCtrl>("beacons")->setControlValue(LLSD(TRUE));
134 view->getChild<LLCheckBoxCtrl>("highlights")->setControlValue(LLSD(FALSE)); // just to be sure it's in sync with llpipeline
135 }
136 }
137 else if(name == "beacons")
138 {
139 LLPipeline::toggleRenderBeacons(NULL);
140 // Don't allow both to be OFF at the same time. Toggle the other one on if both now off.
141 if (
142 !LLPipeline::getRenderBeacons(NULL) &&
143 !LLPipeline::getRenderHighlights(NULL) )
144 {
145 LLPipeline::setRenderHighlights(TRUE);
146 view->getChild<LLCheckBoxCtrl>("highlights")->setControlValue(LLSD(TRUE));
147 view->getChild<LLCheckBoxCtrl>("beacons")->setControlValue(LLSD(FALSE)); // just to be sure it's in sync with llpipeline
148 }
149 }
150}