From 1abea33b7012b6b00502620dab92cc39eacb1d50 Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Wed, 18 Jul 2018 14:13:29 +0300 Subject: MAINT-8334 EEP UI control: Virtual Trackball --- indra/llui/llvirtualtrackball.h | 149 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 indra/llui/llvirtualtrackball.h (limited to 'indra/llui/llvirtualtrackball.h') diff --git a/indra/llui/llvirtualtrackball.h b/indra/llui/llvirtualtrackball.h new file mode 100644 index 0000000000..c1b66550bb --- /dev/null +++ b/indra/llui/llvirtualtrackball.h @@ -0,0 +1,149 @@ +/** +* @file virtualtrackball.h +* @author Andrey Lihatskiy +* @brief Header file for LLVirtualTrackball +* +* $LicenseInfo:firstyear=2001&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2018, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +// A control for positioning the sun and the moon in the celestial sphere. + +#ifndef LL_LLVIRTUALTRACKBALL_H +#define LL_LLVIRTUALTRACKBALL_H + +#include "lluictrl.h" +#include "llpanel.h" +#include "lltextbox.h" +#include "llbutton.h" + +class LLVirtualTrackball + : public LLUICtrl +{ +public: + enum ThumbMode + { + SUN, + MOON + }; + + struct Params + : public LLInitParam::Block + { + Optional border; + Optional image_moon_back, + image_moon_front, + image_sphere, + image_sun_back, + image_sun_front; + + Optional thumb_mode; + Optional increment_angle_mouse, + increment_angle_btn; + + Optional lbl_N, + lbl_S, + lbl_W, + lbl_E; + + Optional btn_rotate_top, + btn_rotate_bottom, + btn_rotate_left, + btn_rotate_right; + + Params(); + }; + + + virtual ~LLVirtualTrackball(); + /*virtual*/ BOOL postBuild(); + + virtual BOOL handleHover(S32 x, S32 y, MASK mask); + virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); + virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); + virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); + virtual BOOL handleKeyHere(KEY key, MASK mask); + + virtual void draw(); + + virtual void setValue(const LLSD& value); + void setValue(F32 x, F32 y, F32 z, F32 w); + virtual LLSD getValue() const; + + void setRotation(const LLQuaternion &value); + LLQuaternion getRotation() const; + +protected: + friend class LLUICtrlFactory; + LLVirtualTrackball(const Params&); + void onEditChange(); + +protected: + LLTextBox* mNLabel; + LLTextBox* mELabel; + LLTextBox* mSLabel; + LLTextBox* mWLabel; + + LLButton* mBtnRotateTop; + LLButton* mBtnRotateBottom; + LLButton* mBtnRotateLeft; + LLButton* mBtnRotateRight; + + LLTextBox* mLabelN; + LLTextBox* mLabelS; + LLTextBox* mLabelW; + LLTextBox* mLabelE; + + LLPanel* mTouchArea; + LLViewBorder* mBorder; + +private: + void setValueAndCommit(const LLQuaternion &value); + void drawThumb(S32 x, S32 y, ThumbMode mode, bool upperHemi = true); + bool pointInTouchCircle(S32 x, S32 y) const; + + void onRotateTopClick(); + void onRotateBottomClick(); + void onRotateLeftClick(); + void onRotateRightClick(); + + S32 mPrevX; + S32 mPrevY; + + LLUIImage* mImgMoonBack; + LLUIImage* mImgMoonFront; + LLUIImage* mImgSunBack; + LLUIImage* mImgSunFront; + LLUIImage* mImgBtnRotTop; + LLUIImage* mImgBtnRotLeft; + LLUIImage* mImgBtnRotRight; + LLUIImage* mImgBtnRotBottom; + LLUIImage* mImgSphere; + + LLQuaternion mValue; + ThumbMode mThumbMode; + + F32 mIncrementMouse; + F32 mIncrementBtn; +}; + +#endif + -- cgit v1.2.3 From 3dfd3be98e19c239949eb7d59ef3fb84274322d1 Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Thu, 9 Aug 2018 13:09:22 +0300 Subject: MAINT-8900 LLVirtualTrackball improvements: buttons behavior and mode select --- indra/llui/llvirtualtrackball.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/llui/llvirtualtrackball.h') diff --git a/indra/llui/llvirtualtrackball.h b/indra/llui/llvirtualtrackball.h index c1b66550bb..48ddb7f4d9 100644 --- a/indra/llui/llvirtualtrackball.h +++ b/indra/llui/llvirtualtrackball.h @@ -44,6 +44,11 @@ public: SUN, MOON }; + enum DragMode + { + DRAG_SET, + DRAG_SCROLL + }; struct Params : public LLInitParam::Block @@ -140,6 +145,7 @@ private: LLQuaternion mValue; ThumbMode mThumbMode; + DragMode mDragMode; F32 mIncrementMouse; F32 mIncrementBtn; -- cgit v1.2.3 From d965af2b0cbf62e2e1601f504e0d548da40aa742 Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Fri, 24 Aug 2018 02:40:12 +0300 Subject: MAINT-9032 Virtual Track Ball improvements --- indra/llui/llvirtualtrackball.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/llui/llvirtualtrackball.h') diff --git a/indra/llui/llvirtualtrackball.h b/indra/llui/llvirtualtrackball.h index 48ddb7f4d9..2d4b1ece17 100644 --- a/indra/llui/llvirtualtrackball.h +++ b/indra/llui/llvirtualtrackball.h @@ -130,6 +130,11 @@ private: void onRotateLeftClick(); void onRotateRightClick(); + void onRotateTopMouseEnter(); + void onRotateBottomMouseEnter(); + void onRotateLeftMouseEnter(); + void onRotateRightMouseEnter(); + S32 mPrevX; S32 mPrevY; -- cgit v1.2.3