aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llcameraview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llcameraview.cpp')
-rw-r--r--linden/indra/newview/llcameraview.cpp259
1 files changed, 0 insertions, 259 deletions
diff --git a/linden/indra/newview/llcameraview.cpp b/linden/indra/newview/llcameraview.cpp
deleted file mode 100644
index 80e64f3..0000000
--- a/linden/indra/newview/llcameraview.cpp
+++ /dev/null
@@ -1,259 +0,0 @@
1/**
2 * @file llcameraview.cpp
3 * @brief Container for movement buttons like forward, left, fly
4 *
5 * $LicenseInfo:firstyear=2001&license=viewergpl$
6 *
7 * Copyright (c) 2001-2008, 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 http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 *
22 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above,
24 * and agree to abide by those obligations.
25 *
26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
28 * COMPLETENESS OR PERFORMANCE.
29 * $/LicenseInfo$
30 */
31
32#include "llviewerprecompiledheaders.h"
33
34#include "llcameraview.h"
35#include "llvieweruictrlfactory.h"
36
37// Library includes
38#include "llfontgl.h"
39
40// Viewer includes
41#include "llagent.h"
42#include "lljoystickbutton.h"
43#include "llviewercontrol.h"
44#include "llviewerwindow.h"
45#include "llappviewer.h"
46
47// Constants
48const char *CAMERA_TITLE = "";
49const F32 CAMERA_BUTTON_DELAY = 0.0f;
50
51// Globals
52LLFloaterCamera* gFloaterCamera = NULL;
53
54
55//
56// Member functions
57//
58
59LLFloaterCamera::LLFloaterCamera(const std::string& name)
60: LLFloater(name, "FloaterCameraRect", CAMERA_TITLE, FALSE, 100, 100, DRAG_ON_TOP,
61 MINIMIZE_NO)
62{
63 setIsChrome(TRUE);
64
65 S32 top = getRect().getHeight();
66 S32 bottom = 0;
67 S32 left = 16;
68
69 const S32 ROTATE_WIDTH = 64;
70 mRotate = new LLJoystickCameraRotate("cam rotate stick",
71 LLRect( left, top, left + ROTATE_WIDTH, bottom ),
72 "cam_rotate_out.tga",
73 "cam_rotate_in.tga" );
74 mRotate->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT);
75 mRotate->setHeldDownDelay(CAMERA_BUTTON_DELAY);
76 mRotate->setToolTip( LLString("Rotate Camera Around Focus" )); // *TODO: Translate
77 mRotate->setSoundFlags(MOUSE_DOWN | MOUSE_UP);
78 addChild(mRotate);
79
80 left += ROTATE_WIDTH;
81
82 const S32 ZOOM_WIDTH = 16;
83 mZoom = new LLJoystickCameraZoom(
84 "zoom",
85 LLRect( left, top, left + ZOOM_WIDTH, bottom ),
86 "cam_zoom_out.tga",
87 "cam_zoom_plus_in.tga",
88 "cam_zoom_minus_in.tga");
89 mZoom->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT);
90 mZoom->setHeldDownDelay(CAMERA_BUTTON_DELAY);
91 mZoom->setToolTip( LLString("Zoom Camera Towards Focus" )); // *TODO: Translate
92 mZoom->setSoundFlags(MOUSE_DOWN | MOUSE_UP);
93 addChild(mZoom);
94
95 left += ZOOM_WIDTH;
96
97 const S32 TRACK_WIDTH = 64;
98 mTrack = new LLJoystickCameraTrack("cam track stick",
99 LLRect( left, top, left + TRACK_WIDTH, bottom ),
100 "cam_tracking_out.tga",
101 "cam_tracking_in.tga");
102 mTrack->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT);
103 mTrack->setHeldDownDelay(CAMERA_BUTTON_DELAY);
104 mTrack->setToolTip( LLString("Move Camera Up and Down, Left and Right" )); // *TODO: Translate
105 mTrack->setSoundFlags(MOUSE_DOWN | MOUSE_UP);
106 addChild(mTrack);
107}
108
109
110LLFloaterCamera::~LLFloaterCamera()
111{
112 // children all deleted by LLView destructor
113 gFloaterCamera = NULL;
114}
115
116// virtual
117void LLFloaterCamera::onClose(bool app_quitting)
118{
119 LLFloater::onClose(app_quitting);
120
121 if (!app_quitting)
122 {
123 gSavedSettings.setBOOL("ShowCameraControls", FALSE);
124 }
125}
126
127//
128// Static member functions
129//
130
131// static
132void LLFloaterCamera::show(void*)
133{
134 if(!gFloaterCamera)
135 {
136 gFloaterCamera = new LLFloaterCamera("camera floater");
137 }
138 gFloaterCamera->open(); /* Flawfinder: ignore */
139 gSavedSettings.setBOOL("ShowCameraControls", TRUE);
140}
141
142// static
143void LLFloaterCamera::toggle(void*)
144{
145 if (gFloaterCamera)
146 {
147 gFloaterCamera->close();
148 }
149 else
150 {
151 show(NULL);
152 }
153}
154
155// static
156BOOL LLFloaterCamera::visible(void*)
157{
158 if (gFloaterCamera)
159 {
160 return gFloaterCamera->getVisible();
161 }
162 else
163 {
164 return FALSE;
165 }
166}
167
168LLFloaterJoystick *LLFloaterJoystick::sInstance = NULL;
169
170
171LLFloaterJoystick::LLFloaterJoystick( )
172: LLFloater("Joystick floater")
173{
174 sInstance = this;
175}
176
177LLFloaterJoystick::~LLFloaterJoystick()
178{
179 sInstance = NULL;
180}
181
182void LLFloaterJoystick::draw()
183{
184 for (U32 i = 0; i < 8; i++)
185 {
186 F32 value = gViewerWindow->getWindow()->getJoystickAxis(i);
187 mAxis[i]->addValue(value*gFrameIntervalSeconds);
188
189 if (mAxisBar[i]->mMinBar > value)
190 {
191 mAxisBar[i]->mMinBar = value;
192 }
193 if (mAxisBar[i]->mMaxBar < value)
194 {
195 mAxisBar[i]->mMaxBar = value;
196 }
197 }
198
199 LLFloater::draw();
200}
201
202// static
203void LLFloaterJoystick::show(void*)
204{
205 if (sInstance)
206 {
207 sInstance->open(); /*Flawfinder: ignore*/
208 }
209 else
210 {
211 LLFloaterJoystick* floater = new LLFloaterJoystick();
212
213 gUICtrlFactory->buildFloater(floater, "floater_joystick.xml");
214 F32 range = gSavedSettings.getBOOL("FlycamAbsolute") ? 1024.f : 2.f;
215 LLUIString axis = floater->getUIString("Axis");
216 LLUIString joystick = floater->getUIString("JoystickMonitor");
217
218 LLView* child = floater->getChild<LLView>("ZoomLabel");
219 LLRect rect;
220
221 if (child)
222 {
223 LLRect r = child->getRect();
224 LLRect f = floater->getRect();
225 rect = LLRect(150, r.mTop, r.mRight, 0);
226 }
227
228 floater->mAxisStats = new LLStatView("axis values", joystick, "", rect);
229 floater->mAxisStats->setDisplayChildren(TRUE);
230
231 for (U32 i = 0; i < 8; i++)
232 {
233 axis.setArg("[NUM]", llformat("%d", i));
234 floater->mAxis[i] = new LLStat(4);
235 floater->mAxisBar[i] = floater->mAxisStats->addStat(axis, floater->mAxis[i]);
236 floater->mAxisBar[i]->mMinBar = -range;
237 floater->mAxisBar[i]->mMaxBar = range;
238 floater->mAxisBar[i]->mLabelSpacing = range * 0.5f;
239 floater->mAxisBar[i]->mTickSpacing = range * 0.25f;
240 }
241
242
243
244 floater->addChild(floater->mAxisStats);
245 floater->open(); /*Flawfinder: ignore*/
246 }
247}
248
249//static
250LLFloaterJoystick* LLFloaterJoystick::getInstance()
251{
252 return sInstance;
253}
254
255// static
256BOOL LLFloaterJoystick::visible(void*)
257{
258 return (sInstance != NULL);
259}