summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llagent.cpp4
-rw-r--r--indra/newview/llfloatercamera.cpp92
-rw-r--r--indra/newview/llfloatercamera.h3
-rw-r--r--indra/newview/skins/default/xui/en/floater_camera.xml69
-rw-r--r--indra/newview/skins/default/xui/en/floater_test_slider.xml8
-rw-r--r--indra/newview/skins/default/xui/en/widgets/slider_bar.xml8
6 files changed, 158 insertions, 26 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index d2c8558f0b..ca1688ad1f 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -3080,10 +3080,6 @@ void LLAgent::updateCamera()
mOrbitLeftKey > 0.f, // right
mOrbitDownKey > 0.f); // bottom
- camera_floater->mZoom->setToggleState(
- mOrbitInKey > 0.f, // top
- mOrbitOutKey > 0.f); // bottom
-
camera_floater->mTrack->setToggleState(
mPanLeftKey > 0.f, // left
mPanUpKey > 0.f, // top
diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp
index d1317f7c36..92e958b32d 100644
--- a/indra/newview/llfloatercamera.cpp
+++ b/indra/newview/llfloatercamera.cpp
@@ -40,10 +40,12 @@
// Viewer includes
#include "lljoystickbutton.h"
#include "llviewercontrol.h"
+#include "llviewercamera.h"
#include "llbottomtray.h"
#include "llagent.h"
#include "lltoolmgr.h"
#include "lltoolfocus.h"
+#include "llslider.h"
// Constants
const F32 CAMERA_BUTTON_DELAY = 0.0f;
@@ -54,6 +56,93 @@ const F32 CAMERA_BUTTON_DELAY = 0.0f;
#define PRESETS "camera_presets"
#define CONTROLS "controls"
+// Zoom the camera in and out
+class LLPanelCameraZoom
+: public LLPanel
+{
+ LOG_CLASS(LLPanelCameraZoom);
+public:
+ LLPanelCameraZoom();
+
+ /* virtual */ BOOL postBuild();
+ /* virtual */ void onOpen(const LLSD& key);
+
+protected:
+ void onZoomPlusHeldDown();
+ void onZoomMinusHeldDown();
+ void onSliderValueChanged();
+
+private:
+ F32 mSavedSliderVal;
+ LLButton* mPlusBtn;
+ LLButton* mMinusBtn;
+ LLSlider* mSlider;
+};
+
+static LLRegisterPanelClassWrapper<LLPanelCameraZoom> t_camera_zoom_panel("camera_zoom_panel");
+
+//-------------------------------------------------------------------------------
+// LLPanelCameraZoom
+//-------------------------------------------------------------------------------
+
+LLPanelCameraZoom::LLPanelCameraZoom()
+: mPlusBtn( NULL ),
+ mMinusBtn( NULL ),
+ mSlider( NULL ),
+ mSavedSliderVal(0.f)
+{
+ mCommitCallbackRegistrar.add("Zoom.minus", boost::bind(&LLPanelCameraZoom::onZoomPlusHeldDown, this));
+ mCommitCallbackRegistrar.add("Zoom.plus", boost::bind(&LLPanelCameraZoom::onZoomMinusHeldDown, this));
+ mCommitCallbackRegistrar.add("Slider.value_changed", boost::bind(&LLPanelCameraZoom::onSliderValueChanged, this));
+}
+
+BOOL LLPanelCameraZoom::postBuild()
+{
+ mPlusBtn = getChild <LLButton> ("zoom_plus_btn");
+ mMinusBtn = getChild <LLButton> ("zoom_minus_btn");
+ mSlider = getChild <LLSlider> ("zoom_slider");
+ mSlider->setMinValue(.0f);
+ mSlider->setMaxValue(8.f);
+ return LLPanel::postBuild();
+}
+
+void LLPanelCameraZoom::onOpen(const LLSD& key)
+{
+ LLVector3d to_focus = gAgent.getPosGlobalFromAgent(LLViewerCamera::getInstance()->getOrigin()) - gAgent.calcFocusPositionTargetGlobal();
+ mSavedSliderVal = 8.f - (F32)to_focus.magVec(); // maximum minus current
+ mSlider->setValue( mSavedSliderVal );
+}
+
+void LLPanelCameraZoom::onZoomPlusHeldDown()
+{
+ F32 val = mSlider->getValueF32();
+ F32 inc = mSlider->getIncrement();
+ mSlider->setValue(val - inc);
+ // commit only if value changed
+ if (val != mSlider->getValueF32())
+ mSlider->onCommit();
+}
+
+void LLPanelCameraZoom::onZoomMinusHeldDown()
+{
+ F32 val = mSlider->getValueF32();
+ F32 inc = mSlider->getIncrement();
+ mSlider->setValue(val + inc);
+ // commit only if value changed
+ if (val != mSlider->getValueF32())
+ mSlider->onCommit();
+}
+
+void LLPanelCameraZoom::onSliderValueChanged()
+{
+ F32 val = mSlider->getValueF32();
+ F32 rate = val - mSavedSliderVal;
+
+ gAgent.unlockView();
+ gAgent.cameraOrbitIn(rate);
+
+ mSavedSliderVal = val;
+}
//
// Member functions
@@ -125,6 +214,7 @@ void LLFloaterCamera::onOpen(const LLSD& key)
anchor_panel, this,
getDockTongue(), LLDockControl::TOP));
+ mZoom->onOpen(key);
}
void LLFloaterCamera::onClose(bool app_quitting)
@@ -147,7 +237,7 @@ BOOL LLFloaterCamera::postBuild()
setIsChrome(TRUE);
mRotate = getChild<LLJoystickCameraRotate>(ORBIT);
- mZoom = getChild<LLJoystickCameraZoom>(ZOOM);
+ mZoom = getChild<LLPanelCameraZoom>(ZOOM);
mTrack = getChild<LLJoystickCameraTrack>(PAN);
assignButton2Mode(CAMERA_CTRL_MODE_ORBIT, "orbit_btn");
diff --git a/indra/newview/llfloatercamera.h b/indra/newview/llfloatercamera.h
index 583f279e62..4873a34e00 100644
--- a/indra/newview/llfloatercamera.h
+++ b/indra/newview/llfloatercamera.h
@@ -39,6 +39,7 @@ class LLJoystickCameraRotate;
class LLJoystickCameraZoom;
class LLJoystickCameraTrack;
class LLFloaterReg;
+class LLPanelCameraZoom;
enum ECameraControlMode
{
@@ -74,7 +75,7 @@ public:
virtual void onClose(bool app_quitting);
LLJoystickCameraRotate* mRotate;
- LLJoystickCameraZoom* mZoom;
+ LLPanelCameraZoom* mZoom;
LLJoystickCameraTrack* mTrack;
private:
diff --git a/indra/newview/skins/default/xui/en/floater_camera.xml b/indra/newview/skins/default/xui/en/floater_camera.xml
index 5c09bc3a02..2af451400e 100644
--- a/indra/newview/skins/default/xui/en/floater_camera.xml
+++ b/indra/newview/skins/default/xui/en/floater_camera.xml
@@ -49,22 +49,57 @@
top="22"
visible="false"
width="78" />
- <!--TODO: replace with slider, + - images -->
- <joystick_zoom
- follows="top|left"
- height="78"
- image_unselected="ScrollThumb_Vert"
- layout="topleft"
- left="7"
- minus_image="ScrollThumb_Vert"
- name="zoom"
- plus_image="ScrollThumb_Vert"
- quadrant="left"
- scale_image="false"
- sound_flags="3"
- tool_tip="Zoom camera toward focus"
- top="22"
- width="20" />
+ <!--TODO: replace + - images -->
+ <panel
+ border="false"
+ class="camera_zoom_panel"
+ height="94"
+ layout="topleft"
+ left="7"
+ mouse_opaque="false"
+ name="zoom"
+ top="22"
+ width="18">
+ <button
+ follows="top|left"
+ height="18"
+ image_disabled="AddItem_Disabled"
+ image_selected="AddItem_Press"
+ image_unselected="AddItem_Off"
+ layout="topleft"
+ name="zoom_plus_btn"
+ width="18">
+ <commit_callback
+ function="Zoom.plus" />
+ <mouse_held_callback
+ function="Zoom.plus" />
+ </button>
+ <slider_bar
+ height="48"
+ layout="topleft"
+ name="zoom_slider"
+ orientation="vertical"
+ tool_tip="Zoom camera toward focus"
+ top_pad="0"
+ width="18">
+ <commit_callback function="Slider.value_changed"/>
+ </slider_bar>
+ <button
+ follows="top|left"
+ height="18"
+ image_disabled="AddItem_Disabled"
+ image_selected="AddItem_Press"
+ image_unselected="AddItem_Off"
+ layout="topleft"
+ name="zoom_minus_btn"
+ top_pad="0"
+ width="18">
+ <commit_callback
+ function="Zoom.minus" />
+ <mouse_held_callback
+ function="Zoom.minus" />
+ </button>
+ </panel>
<joystick_rotate
follows="top|left"
height="78"
@@ -80,7 +115,7 @@
tool_tip="Orbit camera around focus"
top="22"
width="78" />
- <panel
+ <panel
height="78"
layout="topleft"
left="36"
diff --git a/indra/newview/skins/default/xui/en/floater_test_slider.xml b/indra/newview/skins/default/xui/en/floater_test_slider.xml
index 57d8e686ce..86ff82e01f 100644
--- a/indra/newview/skins/default/xui/en/floater_test_slider.xml
+++ b/indra/newview/skins/default/xui/en/floater_test_slider.xml
@@ -57,6 +57,13 @@
width="200" />
<slider_bar
bottom="320"
+ height="100"
+ left="20"
+ name="slider_bar_vertical"
+ orientation="vertical"
+ width="20" />
+ <slider_bar
+ bottom="300"
height="20"
increment="1"
initial_value="2.0"
@@ -64,6 +71,7 @@
layout="topleft"
max_val="5"
min_val="1"
+ left_pad="20"
name="slider_bar"
width="300" />
<slider
diff --git a/indra/newview/skins/default/xui/en/widgets/slider_bar.xml b/indra/newview/skins/default/xui/en/widgets/slider_bar.xml
index bc1ca339a2..706c89f5ed 100644
--- a/indra/newview/skins/default/xui/en/widgets/slider_bar.xml
+++ b/indra/newview/skins/default/xui/en/widgets/slider_bar.xml
@@ -4,6 +4,8 @@
thumb_center_color="SliderThumbCenterColor"
thumb_image="SliderThumb_Off"
thumb_image_pressed="SliderThumb_Press"
- thumb_image_disabled="SliderThumb_Disabled"
- track_image="SliderTrack_Horiz"
- track_highlight_image="SliderTrack_Horiz" />
+ thumb_image_disabled="SliderThumb_Disabled"
+ track_image_horizontal="SliderTrack_Horiz"
+ track_image_vertical="SliderTrack_Vert"
+ track_highlight_horizontal_image="SliderTrack_Horiz"
+ track_highlight_vertical_image="SliderTrack_Vert" />