diff options
-rw-r--r-- | indra/llui/lllayoutstack.h | 2 | ||||
-rw-r--r-- | indra/newview/llagent.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llbottomtray.cpp | 88 | ||||
-rw-r--r-- | indra/newview/llbottomtray.h | 17 |
4 files changed, 85 insertions, 24 deletions
diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index aba35773ee..c4f10038f8 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -93,6 +93,8 @@ public: void updateLayout(BOOL force_resize = FALSE); S32 getPanelSpacing() const { return mPanelSpacing; } + BOOL getAnimate () const { return mAnimate; } + void setAnimate (BOOL animate) { mAnimate = animate; } static void updateClass(); diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 5ea253709c..749296d8a5 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -2806,6 +2806,7 @@ void LLAgent::endAnimationUpdateUI() gStatusBar->setVisibleForMouselook(true); LLBottomTray::getInstance()->setVisible(TRUE); + LLBottomTray::getInstance()->onMouselookModeOut(); LLSideTray::getInstance()->getButtonsPanel()->setVisible(TRUE); LLSideTray::getInstance()->updateSidetrayVisibility(); @@ -2904,6 +2905,7 @@ void LLAgent::endAnimationUpdateUI() LLNavigationBar::getInstance()->setVisible(FALSE); gStatusBar->setVisibleForMouselook(false); + LLBottomTray::getInstance()->onMouselookModeIn(); LLBottomTray::getInstance()->setVisible(FALSE); LLSideTray::getInstance()->getButtonsPanel()->setVisible(FALSE); diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index beccefa430..8a7ed23b59 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -52,6 +52,15 @@ // Build time optimization, generate extern template once in .cpp file template class LLBottomTray* LLSingleton<class LLBottomTray>::getInstance(); +namespace +{ + const std::string& PANEL_CHICLET_NAME = "chiclet_list_panel"; + const std::string& PANEL_CHATBAR_NAME = "chat_bar"; + const std::string& PANEL_MOVEMENT_NAME = "movement_panel"; + const std::string& PANEL_CAMERA_NAME = "cam_panel"; + const std::string& PANEL_GESTURE_NAME = "gesture_panel"; +} + LLBottomTray::LLBottomTray(const LLSD&) : mChicletPanel(NULL), mSpeakPanel(NULL), @@ -236,6 +245,57 @@ void LLBottomTray::onFocusLost() } } +void LLBottomTray::savePanelsShape() +{ + mSavedShapeList.clear(); + for (child_list_const_iter_t + child_it = mToolbarStack->beginChild(), + child_it_end = mToolbarStack->endChild(); + child_it != child_it_end; ++child_it) + { + mSavedShapeList.push_back( (*child_it)->getRect() ); + } +} + +void LLBottomTray::restorePanelsShape() +{ + if (mSavedShapeList.size() != mToolbarStack->getChildCount()) + return; + int i = 0; + for (child_list_const_iter_t + child_it = mToolbarStack->beginChild(), + child_it_end = mToolbarStack->endChild(); + child_it != child_it_end; ++child_it) + { + (*child_it)->setShape(mSavedShapeList[i++]); + } +} + +void LLBottomTray::onMouselookModeOut() +{ + // Apply the saved settings when we are not in mouselook mode, see EXT-3988. + { + setTrayButtonVisibleIfPossible (RS_BUTTON_GESTURES, gSavedSettings.getBOOL("ShowGestureButton"), false); + setTrayButtonVisibleIfPossible (RS_BUTTON_MOVEMENT, gSavedSettings.getBOOL("ShowMoveButton"), false); + setTrayButtonVisibleIfPossible (RS_BUTTON_CAMERA, gSavedSettings.getBOOL("ShowCameraButton"), false); + setTrayButtonVisibleIfPossible (RS_BUTTON_SNAPSHOT, gSavedSettings.getBOOL("ShowSnapshotButton"),false); + } + // HACK: To avoid usage the LLLayoutStack logic of resizing, we force the updateLayout + // and then restore children saved shapes. See EXT-4309. + BOOL saved_anim = mToolbarStack->getAnimate(); + mToolbarStack->updatePanelAutoResize(PANEL_CHATBAR_NAME, FALSE); + mToolbarStack->setAnimate(FALSE); + mToolbarStack->updateLayout(); + mToolbarStack->setAnimate(saved_anim); + restorePanelsShape(); +} + +void LLBottomTray::onMouselookModeIn() +{ + savePanelsShape(); + mToolbarStack->updatePanelAutoResize(PANEL_CHATBAR_NAME, TRUE); +} + //virtual // setVisible used instead of onVisibilityChange, since LLAgent calls it on entering/leaving mouselook mode. // If bottom tray is already visible in mouselook mode, then onVisibilityChange will not be called from setVisible(true), @@ -255,23 +315,15 @@ void LLBottomTray::setVisible(BOOL visible) LLView* viewp = *child_it; std::string name = viewp->getName(); - // Chat bar and gesture button are shown even in mouselook mode. But the move, camera and snapshot buttons shouldn't be displayed. See EXT-3988. - if ("chat_bar" == name || "gesture_panel" == name || (visibility && ("movement_panel" == name || "cam_panel" == name || "snapshot_panel" == name))) + // Chat bar and gesture button are shown even in mouselook mode. + // But the move, camera and snapshot buttons shouldn't be displayed. See EXT-3988. + if ("chat_bar" == name || "gesture_panel" == name) continue; else { viewp->setVisible(visibility); } } - - // Apply the saved settings when we are not in mouselook mode, see EXT-3988. - if (visibility) - { - showCameraButton(gSavedSettings.getBOOL("ShowCameraButton")); - showSnapshotButton(gSavedSettings.getBOOL("ShowSnapshotButton")); - showMoveButton(gSavedSettings.getBOOL("ShowMoveButton")); - showGestureButton(gSavedSettings.getBOOL("ShowGestureButton")); - } } } @@ -337,15 +389,6 @@ void LLBottomTray::showSnapshotButton(BOOL visible) setTrayButtonVisibleIfPossible(RS_BUTTON_SNAPSHOT, visible); } -namespace -{ - const std::string& PANEL_CHICLET_NAME = "chiclet_list_panel"; - const std::string& PANEL_CHATBAR_NAME = "chat_bar"; - const std::string& PANEL_MOVEMENT_NAME = "movement_panel"; - const std::string& PANEL_CAMERA_NAME = "cam_panel"; - const std::string& PANEL_GESTURE_NAME = "gesture_panel"; -} - BOOL LLBottomTray::postBuild() { @@ -1018,7 +1061,7 @@ void LLBottomTray::setTrayButtonVisible(EResizeState shown_object_type, bool vis panel->setVisible(visible); } -void LLBottomTray::setTrayButtonVisibleIfPossible(EResizeState shown_object_type, bool visible) +void LLBottomTray::setTrayButtonVisibleIfPossible(EResizeState shown_object_type, bool visible, bool raise_notification) { bool can_be_set = true; @@ -1058,7 +1101,8 @@ void LLBottomTray::setTrayButtonVisibleIfPossible(EResizeState shown_object_type { // mark this button to show it while future bottom tray extending mResizeState |= shown_object_type; - LLNotificationsUtil::add("BottomTrayButtonCanNotBeShown"); + if ( raise_notification ) + LLNotificationsUtil::add("BottomTrayButtonCanNotBeShown"); } } diff --git a/indra/newview/llbottomtray.h b/indra/newview/llbottomtray.h index 9be0e5810f..562ee56912 100644 --- a/indra/newview/llbottomtray.h +++ b/indra/newview/llbottomtray.h @@ -92,7 +92,10 @@ public: void showMoveButton(BOOL visible); void showCameraButton(BOOL visible); void showSnapshotButton(BOOL visible); - + + void onMouselookModeIn(); + void onMouselookModeOut(); + /** * Creates IM Chiclet based on session type (IM chat or Group chat) */ @@ -167,7 +170,14 @@ private: * - if hidden via context menu button should be shown but there is no enough room for now * it will be shown while extending. */ - void setTrayButtonVisibleIfPossible(EResizeState shown_object_type, bool visible); + void setTrayButtonVisibleIfPossible(EResizeState shown_object_type, bool visible, bool raise_notification = true); + + /** + * Save and restore children shapes. + * Used to avoid the LLLayoutStack resizing logic between mouse look mode switching. + */ + void savePanelsShape(); + void restorePanelsShape(); MASK mResizeState; @@ -177,6 +187,9 @@ private: typedef std::map<EResizeState, S32> state_object_width_map_t; state_object_width_map_t mObjectDefaultWidthMap; + typedef std::vector<LLRect> shape_list_t; + shape_list_t mSavedShapeList; + protected: LLBottomTray(const LLSD& key = LLSD()); |