From 097f9711f22df449c11b3dcd960186a206bcd3ac Mon Sep 17 00:00:00 2001 From: Andrew Dyukov Date: Thu, 27 May 2010 18:36:07 +0300 Subject: EXT-2260 FIXED Changed camera floater according to new style - Implemented new widget- panel_camera_item, to use in camera floater. They are used inside of two panels. Their order is configurable via XML. Mouse down callbacks and images which are used for selected and and unselected items are also set in XML. - Now there are only 3 buttons instead of four at the bottom of the floater- pan and orbit are now shown simultaneously. - Implemented correct work of object view after moving from camera modes to presets list (and back). It wasn't workin completely correct in old version of floater. - Integrated new art. Reviewed by Igor Borovkov at https://codereview.productengine.com/secondlife/r/436/ --HG-- branch : product-engine --- indra/newview/llfloatercamera.h | 68 +++++++++++++++++++++++++++++++++++------ 1 file changed, 58 insertions(+), 10 deletions(-) (limited to 'indra/newview/llfloatercamera.h') diff --git a/indra/newview/llfloatercamera.h b/indra/newview/llfloatercamera.h index b268839165..8fa7a53996 100644 --- a/indra/newview/llfloatercamera.h +++ b/indra/newview/llfloatercamera.h @@ -34,6 +34,9 @@ #define LLFLOATERCAMERA_H #include "lltransientdockablefloater.h" +#include "lliconctrl.h" +#include "lltextbox.h" +#include "llflatlistview.h" class LLJoystickCameraRotate; class LLJoystickCameraZoom; @@ -43,10 +46,10 @@ class LLPanelCameraZoom; enum ECameraControlMode { - CAMERA_CTRL_MODE_ORBIT, + CAMERA_CTRL_MODE_MODES, CAMERA_CTRL_MODE_PAN, CAMERA_CTRL_MODE_FREE_CAMERA, - CAMERA_CTRL_MODE_AVATAR_VIEW + CAMERA_CTRL_MODE_PRESETS }; class LLFloaterCamera @@ -58,8 +61,8 @@ public: /* whether in free camera mode */ static bool inFreeCameraMode(); - /* callback for camera presets changing */ - static void onClickCameraPresets(const LLSD& param); + /* callback for camera items selection changing */ + static void onClickCameraItem(const LLSD& param); static void onLeavingMouseLook(); @@ -68,7 +71,14 @@ public: /* determines actual mode and updates ui */ void update(); - + + /*switch to one of the camera presets (front, rear, side)*/ + static void switchToPreset(const std::string& name); + + /* move to CAMERA_CTRL_MODE_PRESETS from CAMERA_CTRL_MODE_FREE_CAMERA if we are on presets panel and + are not in free camera mode*/ + void fromFreeToPresets(); + virtual void onOpen(const LLSD& key); virtual void onClose(bool app_quitting); @@ -88,9 +98,6 @@ private: ECameraControlMode determineMode(); - /* whether in avatar view (first person) mode */ - bool inAvatarViewMode(); - /* resets to the previous mode */ void toPrevMode(); @@ -106,18 +113,59 @@ private: /* updates the state (UI) according to the current mode */ void updateState(); - /* update camera preset buttons toggle state according to the currently selected preset */ - void updateCameraPresetButtons(); + /* update camera modes items selection and camera preset items selection according to the currently selected preset */ + void updateItemsSelection(); void onClickBtn(ECameraControlMode mode); void assignButton2Mode(ECameraControlMode mode, const std::string& button_name); + // fills flatlist with items from given panel + void fillFlatlistFromPanel (LLFlatListView* list, LLPanel* panel); + // set to true when free camera mode is selected in modes list + // remains true until preset camera mode is chosen, or pan button is clicked, or escape pressed + static bool sFreeCamera; BOOL mClosed; ECameraControlMode mPrevMode; ECameraControlMode mCurrMode; std::map mMode2Button; +}; +/** + * Class used to represent widgets from panel_camera_item.xml- + * panels that contain pictures and text. Pictures are different + * for selected and unselected state (this state is nor stored- icons + * are changed in setValue()). This class doesn't implement selection logic- + * it's items are used inside of flatlist. + */ +class LLPanelCameraItem + : public LLPanel +{ +public: + struct Params : public LLInitParam::Block + { + Optional icon_over; + Optional icon_selected; + Optional picture; + Optional selected_picture; + + Optional text; + Optional mousedown_callback; + Params(); + }; + /*virtual*/ BOOL postBuild(); + /** setting on/off background icon to indicate selected state */ + /*virtual*/ void setValue(const LLSD& value); + // sends commit signal + void onAnyMouseClick(); +protected: + friend class LLUICtrlFactory; + LLPanelCameraItem(const Params&); + LLIconCtrl* mIconOver; + LLIconCtrl* mIconSelected; + LLIconCtrl* mPicture; + LLIconCtrl* mPictureSelected; + LLTextBox* mText; }; #endif -- cgit v1.2.3