diff options
Diffstat (limited to 'linden/indra/newview/aoremotectrl.cpp')
-rw-r--r-- | linden/indra/newview/aoremotectrl.cpp | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/linden/indra/newview/aoremotectrl.cpp b/linden/indra/newview/aoremotectrl.cpp new file mode 100644 index 0000000..8cafdd9 --- /dev/null +++ b/linden/indra/newview/aoremotectrl.cpp | |||
@@ -0,0 +1,122 @@ | |||
1 | /** | ||
2 | * @file aoremotectrl.cpp | ||
3 | * @brief toolbar remote for toggling the viewer AO | ||
4 | * | ||
5 | * $LicenseInfo:firstyear=2009&license=viewergpl$ | ||
6 | * | ||
7 | * Copyright (c) 2010, McCabe Maxsted | ||
8 | * | ||
9 | * Imprudence Viewer Source Code | ||
10 | * The source code in this file ("Source Code") is provided to you | ||
11 | * under the terms of the GNU General Public License, version 2.0 | ||
12 | * ("GPL"). Terms of the GPL can be found in doc/GPL-license.txt in | ||
13 | * this distribution, or online at | ||
14 | * http://secondlifegrid.net/programs/open_source/licensing/gplv2 | ||
15 | * | ||
16 | * There are special exceptions to the terms and conditions of the GPL as | ||
17 | * it is applied to this Source Code. View the full text of the exception | ||
18 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
19 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
20 | * | ||
21 | * By copying, modifying or distributing this software, you acknowledge | ||
22 | * that you have read and understood your obligations described above, | ||
23 | * and agree to abide by those obligations. | ||
24 | * | ||
25 | * ALL SOURCE CODE IS PROVIDED "AS IS." THE AUTHOR MAKES NO | ||
26 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
27 | * COMPLETENESS OR PERFORMANCE. | ||
28 | * $/LicenseInfo$ | ||
29 | */ | ||
30 | |||
31 | #include "llviewerprecompiledheaders.h" | ||
32 | |||
33 | #include "aoremotectrl.h" | ||
34 | |||
35 | #include "floaterao.h" | ||
36 | #include "llbutton.h" | ||
37 | #include "lloverlaybar.h" | ||
38 | #include "lluictrlfactory.h" | ||
39 | #include "llviewercontrol.h" | ||
40 | |||
41 | |||
42 | AORemoteCtrl::AORemoteCtrl() | ||
43 | { | ||
44 | setIsChrome(TRUE); | ||
45 | build(); | ||
46 | setFocusRoot(TRUE); | ||
47 | } | ||
48 | |||
49 | AORemoteCtrl::~AORemoteCtrl() | ||
50 | { | ||
51 | } | ||
52 | |||
53 | void AORemoteCtrl::draw() | ||
54 | { | ||
55 | LLButton* expand_button = getChild<LLButton>("popup_btn"); | ||
56 | if (expand_button) | ||
57 | { | ||
58 | if (expand_button->getToggleState()) | ||
59 | { | ||
60 | expand_button->setImageOverlay("arrow_down.tga"); | ||
61 | } | ||
62 | else | ||
63 | { | ||
64 | expand_button->setImageOverlay("arrow_up.tga"); | ||
65 | } | ||
66 | } | ||
67 | |||
68 | LLPanel::draw(); | ||
69 | } | ||
70 | |||
71 | void AORemoteCtrl::build() | ||
72 | { | ||
73 | if (gSavedSettings.getBOOL("ShowAOSitPopup")) | ||
74 | { | ||
75 | LLUICtrlFactory::getInstance()->buildPanel(this, "panel_ao_remote_expanded.xml"); | ||
76 | } | ||
77 | else | ||
78 | { | ||
79 | LLUICtrlFactory::getInstance()->buildPanel(this, "panel_ao_remote.xml"); | ||
80 | } | ||
81 | } | ||
82 | |||
83 | BOOL AORemoteCtrl::postBuild() | ||
84 | { | ||
85 | |||
86 | childSetAction("ao_btn", onClickToggleAO, this); | ||
87 | childSetAction("ao_sit_btn", onClickToggleAOSit, this); | ||
88 | childSetAction("ao_show_btn", onClickShowAO, this); | ||
89 | childSetAction("popup_btn", onClickPopupBtn, this); | ||
90 | |||
91 | return TRUE; | ||
92 | } | ||
93 | |||
94 | // static | ||
95 | void AORemoteCtrl::onClickToggleAO(void* data) | ||
96 | { | ||
97 | BOOL ao_enable = gSavedSettings.getBOOL("AOEnabled"); | ||
98 | gSavedSettings.setBOOL("AOEnabled", !ao_enable); | ||
99 | } | ||
100 | |||
101 | //static | ||
102 | void AORemoteCtrl::onClickToggleAOSit(void* data) | ||
103 | { | ||
104 | BOOL sit_enable = gSavedSettings.getBOOL("AOSitsEnabled"); | ||
105 | gSavedSettings.setBOOL("AOSitsEnabled", !sit_enable); | ||
106 | } | ||
107 | |||
108 | //static | ||
109 | void AORemoteCtrl::onClickShowAO(void* data) | ||
110 | { | ||
111 | LLFloaterAO::show(NULL); | ||
112 | } | ||
113 | |||
114 | //static | ||
115 | void AORemoteCtrl::onClickPopupBtn(void* data) | ||
116 | { | ||
117 | AORemoteCtrl* remotep = (AORemoteCtrl*)data; | ||
118 | |||
119 | remotep->deleteAllChildren(); | ||
120 | remotep->build(); | ||
121 | gOverlayBar->layoutButtons(); | ||
122 | } | ||