diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llcameraview.cpp | |
parent | README.txt (diff) | |
download | meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2 meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz |
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/newview/llcameraview.cpp')
-rw-r--r-- | linden/indra/newview/llcameraview.cpp | 167 |
1 files changed, 167 insertions, 0 deletions
diff --git a/linden/indra/newview/llcameraview.cpp b/linden/indra/newview/llcameraview.cpp new file mode 100644 index 0000000..c510823 --- /dev/null +++ b/linden/indra/newview/llcameraview.cpp | |||
@@ -0,0 +1,167 @@ | |||
1 | /** | ||
2 | * @file llcameraview.cpp | ||
3 | * @brief Container for movement buttons like forward, left, fly | ||
4 | * | ||
5 | * Copyright (c) 2001-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
8 | * to you under the terms of the GNU General Public License, version 2.0 | ||
9 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
10 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
11 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
12 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
13 | * | ||
14 | * There are special exceptions to the terms and conditions of the GPL as | ||
15 | * it is applied to this Source Code. View the full text of the exception | ||
16 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
17 | * online at http://secondlife.com/developers/opensource/flossexception | ||
18 | * | ||
19 | * By copying, modifying or distributing this software, you acknowledge | ||
20 | * that you have read and understood your obligations described above, | ||
21 | * and agree to abide by those obligations. | ||
22 | * | ||
23 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
24 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
25 | * COMPLETENESS OR PERFORMANCE. | ||
26 | */ | ||
27 | |||
28 | #include "llviewerprecompiledheaders.h" | ||
29 | |||
30 | #include "llcameraview.h" | ||
31 | |||
32 | // Library includes | ||
33 | #include "llfontgl.h" | ||
34 | |||
35 | // Viewer includes | ||
36 | #include "llagent.h" | ||
37 | #include "lljoystickbutton.h" | ||
38 | #include "llviewercontrol.h" | ||
39 | |||
40 | // Constants | ||
41 | const char *CAMERA_TITLE = ""; | ||
42 | const F32 CAMERA_BUTTON_DELAY = 0.0f; | ||
43 | |||
44 | // Globals | ||
45 | LLFloaterCamera* gFloaterCamera = NULL; | ||
46 | |||
47 | |||
48 | // | ||
49 | // Member functions | ||
50 | // | ||
51 | |||
52 | LLFloaterCamera::LLFloaterCamera(const std::string& name) | ||
53 | : LLFloater(name, "FloaterCameraRect", CAMERA_TITLE, FALSE, 100, 100, DRAG_ON_TOP, | ||
54 | MINIMIZE_NO) | ||
55 | { | ||
56 | setIsChrome(TRUE); | ||
57 | |||
58 | S32 top = mRect.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( "Rotate Camera Around Focus" ); | ||
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( "Zoom Camera Towards Focus" ); | ||
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( "Move Camera Up and Down, Left and Right" ); | ||
98 | mTrack->setSoundFlags(MOUSE_DOWN | MOUSE_UP); | ||
99 | addChild(mTrack); | ||
100 | } | ||
101 | |||
102 | |||
103 | LLFloaterCamera::~LLFloaterCamera() | ||
104 | { | ||
105 | // children all deleted by LLView destructor | ||
106 | gFloaterCamera = NULL; | ||
107 | } | ||
108 | |||
109 | // virtual | ||
110 | void LLFloaterCamera::onClose(bool app_quitting) | ||
111 | { | ||
112 | LLFloater::onClose(app_quitting); | ||
113 | |||
114 | if (!app_quitting) | ||
115 | { | ||
116 | gSavedSettings.setBOOL("ShowCameraControls", FALSE); | ||
117 | } | ||
118 | } | ||
119 | |||
120 | // | ||
121 | // Static member functions | ||
122 | // | ||
123 | |||
124 | // static | ||
125 | void LLFloaterCamera::show(void*) | ||
126 | { | ||
127 | if (gFloaterCamera) | ||
128 | { | ||
129 | gFloaterCamera->open(); | ||
130 | } | ||
131 | else | ||
132 | { | ||
133 | gFloaterCamera = new LLFloaterCamera("camera floater"); | ||
134 | |||
135 | gFloaterCamera->open(); | ||
136 | } | ||
137 | |||
138 | gSavedSettings.setBOOL("ShowCameraControls", TRUE); | ||
139 | } | ||
140 | |||
141 | // static | ||
142 | void LLFloaterCamera::toggle(void*) | ||
143 | { | ||
144 | if (gFloaterCamera) | ||
145 | { | ||
146 | gFloaterCamera->close(); | ||
147 | } | ||
148 | else | ||
149 | { | ||
150 | show(NULL); | ||
151 | } | ||
152 | } | ||
153 | |||
154 | // static | ||
155 | BOOL LLFloaterCamera::visible(void*) | ||
156 | { | ||
157 | if (gFloaterCamera) | ||
158 | { | ||
159 | return gFloaterCamera->getVisible(); | ||
160 | } | ||
161 | else | ||
162 | { | ||
163 | return FALSE; | ||
164 | } | ||
165 | } | ||
166 | |||
167 | // EOF | ||