aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfloatercamera.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llfloatercamera.cpp119
1 files changed, 119 insertions, 0 deletions
diff --git a/linden/indra/newview/llfloatercamera.cpp b/linden/indra/newview/llfloatercamera.cpp
new file mode 100644
index 0000000..b77b556
--- /dev/null
+++ b/linden/indra/newview/llfloatercamera.cpp
@@ -0,0 +1,119 @@
1/**
2 * @file llfloatercamera.cpp
3 * @brief Container for camera control buttons (zoom, pan, orbit)
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 "llfloatercamera.h"
35
36// Library includes
37#include "lluictrlfactory.h"
38
39// Viewer includes
40#include "lljoystickbutton.h"
41#include "llviewercontrol.h"
42
43// Constants
44const F32 CAMERA_BUTTON_DELAY = 0.0f;
45
46//
47// Member functions
48//
49
50LLFloaterCamera::LLFloaterCamera(const LLSD& val)
51: LLFloater("camera floater") // uses "FloaterCameraRect3"
52{
53 setIsChrome(TRUE);
54
55 const BOOL DONT_OPEN = FALSE;
56 LLUICtrlFactory::getInstance()->buildFloater(this, "floater_camera.xml", NULL, DONT_OPEN);
57
58 S32 top = getRect().getHeight();
59 S32 bottom = 0;
60 S32 left = 16;
61
62 const S32 ROTATE_WIDTH = 64;
63 mRotate = new LLJoystickCameraRotate("cam rotate stick",
64 LLRect( left, top, left + ROTATE_WIDTH, bottom ),
65 "cam_rotate_out.tga",
66 "cam_rotate_in.tga" );
67 mRotate->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT);
68 mRotate->setHeldDownDelay(CAMERA_BUTTON_DELAY);
69 mRotate->setToolTip( getString("rotate_tooltip") );
70 mRotate->setSoundFlags(MOUSE_DOWN | MOUSE_UP);
71 addChild(mRotate);
72
73 left += ROTATE_WIDTH;
74
75 const S32 ZOOM_WIDTH = 16;
76 mZoom = new LLJoystickCameraZoom(
77 "zoom",
78 LLRect( left, top, left + ZOOM_WIDTH, bottom ),
79 "cam_zoom_out.tga",
80 "cam_zoom_plus_in.tga",
81 "cam_zoom_minus_in.tga");
82 mZoom->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT);
83 mZoom->setHeldDownDelay(CAMERA_BUTTON_DELAY);
84 mZoom->setToolTip( getString("zoom_tooltip") );
85 mZoom->setSoundFlags(MOUSE_DOWN | MOUSE_UP);
86 addChild(mZoom);
87
88 left += ZOOM_WIDTH;
89
90 const S32 TRACK_WIDTH = 64;
91 mTrack = new LLJoystickCameraTrack("cam track stick",
92 LLRect( left, top, left + TRACK_WIDTH, bottom ),
93 "cam_tracking_out.tga",
94 "cam_tracking_in.tga");
95 mTrack->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT);
96 mTrack->setHeldDownDelay(CAMERA_BUTTON_DELAY);
97 mTrack->setToolTip( getString("move_tooltip") );
98 mTrack->setSoundFlags(MOUSE_DOWN | MOUSE_UP);
99 addChild(mTrack);
100}
101
102// virtual
103void LLFloaterCamera::onOpen()
104{
105 LLFloater::onOpen();
106
107 gSavedSettings.setBOOL("ShowCameraControls", TRUE);
108}
109
110// virtual
111void LLFloaterCamera::onClose(bool app_quitting)
112{
113 LLFloater::onClose(app_quitting);
114
115 if (!app_quitting)
116 {
117 gSavedSettings.setBOOL("ShowCameraControls", FALSE);
118 }
119} \ No newline at end of file