aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpanelinput.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2009-04-30 13:04:20 -0500
committerJacek Antonelli2009-04-30 13:07:16 -0500
commitca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch)
tree8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/newview/llpanelinput.cpp
parentSecond Life viewer sources 1.22.11 (diff)
downloadmeta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz
Second Life viewer sources 1.23.0-RC
Diffstat (limited to 'linden/indra/newview/llpanelinput.cpp')
-rw-r--r--linden/indra/newview/llpanelinput.cpp36
1 files changed, 29 insertions, 7 deletions
diff --git a/linden/indra/newview/llpanelinput.cpp b/linden/indra/newview/llpanelinput.cpp
index 7ab261b..63d22b2 100644
--- a/linden/indra/newview/llpanelinput.cpp
+++ b/linden/indra/newview/llpanelinput.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 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 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 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -32,8 +33,11 @@
32#include "llviewerprecompiledheaders.h" 33#include "llviewerprecompiledheaders.h"
33#include "llpanelinput.h" 34#include "llpanelinput.h"
34#include "lluictrlfactory.h" 35#include "lluictrlfactory.h"
36#include "llviewercamera.h"
35#include "llviewercontrol.h" 37#include "llviewercontrol.h"
36#include "llfloaterjoystick.h" 38#include "llfloaterjoystick.h"
39#include "llsliderctrl.h"
40#include "llfloaterjoystick.h"
37 41
38 42
39LLPanelInput::LLPanelInput() 43LLPanelInput::LLPanelInput()
@@ -41,20 +45,33 @@ LLPanelInput::LLPanelInput()
41 LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_input.xml"); 45 LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_input.xml");
42} 46}
43 47
48static void onFOVAdjust(LLUICtrl* source, void* data)
49{
50 LLSliderCtrl* slider = dynamic_cast<LLSliderCtrl*>(source);
51 LLViewerCamera::getInstance()->setDefaultFOV(slider->getValueF32());
52}
53
44BOOL LLPanelInput::postBuild() 54BOOL LLPanelInput::postBuild()
45{ 55{
46 childSetAction("joystick_setup_button", onClickJoystickSetup, (void*)this); 56 childSetAction("joystick_setup_button", onClickJoystickSetup, (void*)this);
47 57
58 // cache values in case user cancels
59 mPreAdjustFOV = gSavedSettings.getF32("CameraAngle");
60 mPreAdjustCameraOffsetScale = gSavedSettings.getF32("CameraOffsetScale");
61
48 childSetValue("mouse_sensitivity", gSavedSettings.getF32("MouseSensitivity")); 62 childSetValue("mouse_sensitivity", gSavedSettings.getF32("MouseSensitivity"));
49 childSetValue("automatic_fly", gSavedSettings.getBOOL("AutomaticFly")); 63 childSetValue("automatic_fly", gSavedSettings.getBOOL("AutomaticFly"));
50 childSetValue("invert_mouse", gSavedSettings.getBOOL("InvertMouse")); 64 childSetValue("invert_mouse", gSavedSettings.getBOOL("InvertMouse"));
51 childSetValue("edit_camera_movement", gSavedSettings.getBOOL("EditCameraMovement")); 65 childSetValue("edit_camera_movement", gSavedSettings.getBOOL("EditCameraMovement"));
52 childSetValue("appearance_camera_movement", gSavedSettings.getBOOL("AppearanceCameraMovement")); 66 childSetValue("appearance_camera_movement", gSavedSettings.getBOOL("AppearanceCameraMovement"));
53 childSetValue("dynamic_camera_strength", gSavedSettings.getF32("DynamicCameraStrength"));
54 childSetValue("zoom_time", gSavedSettings.getF32("ZoomTime"));
55 childSetValue("camera_position_smoothing", gSavedSettings.getF32("CameraPositionSmoothing"));
56 childSetValue("first_person_avatar_visible", gSavedSettings.getBOOL("FirstPersonAvatarVisible")); 67 childSetValue("first_person_avatar_visible", gSavedSettings.getBOOL("FirstPersonAvatarVisible"));
57 68
69 LLSliderCtrl* fov_slider = getChild<LLSliderCtrl>("camera_fov");
70 fov_slider->setCommitCallback(&onFOVAdjust);
71 fov_slider->setMinValue(LLViewerCamera::getInstance()->getMinView());
72 fov_slider->setMaxValue(LLViewerCamera::getInstance()->getMaxView());
73 fov_slider->setValue(LLViewerCamera::getInstance()->getView());
74
58 return TRUE; 75 return TRUE;
59} 76}
60 77
@@ -65,19 +82,24 @@ LLPanelInput::~LLPanelInput()
65 82
66void LLPanelInput::apply() 83void LLPanelInput::apply()
67{ 84{
85 // any cancel after this point will use these new values
86 mPreAdjustFOV = childGetValue("camera_fov").asReal();
87 mPreAdjustCameraOffsetScale = childGetValue("camera_offset_scale").asReal();
88
68 gSavedSettings.setF32("MouseSensitivity", childGetValue("mouse_sensitivity").asReal()); 89 gSavedSettings.setF32("MouseSensitivity", childGetValue("mouse_sensitivity").asReal());
69 gSavedSettings.setBOOL("AutomaticFly", childGetValue("automatic_fly")); 90 gSavedSettings.setBOOL("AutomaticFly", childGetValue("automatic_fly"));
70 gSavedSettings.setBOOL("InvertMouse", childGetValue("invert_mouse")); 91 gSavedSettings.setBOOL("InvertMouse", childGetValue("invert_mouse"));
71 gSavedSettings.setBOOL("EditCameraMovement", childGetValue("edit_camera_movement")); 92 gSavedSettings.setBOOL("EditCameraMovement", childGetValue("edit_camera_movement"));
72 gSavedSettings.setBOOL("AppearanceCameraMovement", childGetValue("appearance_camera_movement")); 93 gSavedSettings.setBOOL("AppearanceCameraMovement", childGetValue("appearance_camera_movement"));
73 gSavedSettings.setF32("DynamicCameraStrength", childGetValue("dynamic_camera_strength").asReal()); 94 gSavedSettings.setF32("CameraAngle", mPreAdjustFOV);
74 gSavedSettings.setF32("ZoomTime", childGetValue("zoom_time").asReal());
75 gSavedSettings.setF32("CameraPositionSmoothing", childGetValue("camera_position_smoothing").asReal());
76 gSavedSettings.setBOOL("FirstPersonAvatarVisible", childGetValue("first_person_avatar_visible")); 95 gSavedSettings.setBOOL("FirstPersonAvatarVisible", childGetValue("first_person_avatar_visible"));
77} 96}
78 97
79void LLPanelInput::cancel() 98void LLPanelInput::cancel()
80{ 99{
100 LLViewerCamera::getInstance()->setView(mPreAdjustFOV);
101 gSavedSettings.setF32("CameraAngle", LLViewerCamera::getInstance()->getView());
102 gSavedSettings.setF32("CameraOffsetScale", mPreAdjustCameraOffsetScale);
81} 103}
82 104
83//static 105//static