diff options
author | Mike Antipov <mantipov@productengine.com> | 2010-05-19 15:23:51 +0300 |
---|---|---|
committer | Mike Antipov <mantipov@productengine.com> | 2010-05-19 15:23:51 +0300 |
commit | 12d9aef217707ed866c0076107b0b935bd9f7fc7 (patch) | |
tree | aba21a13977dbe1df1276434020f59ad42fa972d /indra | |
parent | 5d4b48bbb4c20ad4fcbba31d92ebcf23ef5496a6 (diff) |
EXT-7104 WIP Added "Sidebar" button (disabled until callback is set)
* Added widgets into xml, added setting and listener for context menu
* added menu item to show/hide the button
* button is made as may be hidden on resize
Additional improvements:
* Updated method to process buttons width when it is necessary to show any button via context menu
* Updated LLBottomTray::initButtonsVisibility to not show warning messages if it is impossible to show a button due to bottom tray width on startup.
Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/403/
--HG--
branch : product-engine
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llbottomtray.cpp | 52 | ||||
-rw-r--r-- | indra/newview/llbottomtray.h | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_bottomtray.xml | 11 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_bottomtray.xml | 35 |
4 files changed, 76 insertions, 24 deletions
diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 2c82fc5118..0595bedd31 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -1169,6 +1169,7 @@ void LLBottomTray::initResizeStateContainers() mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_MOVEMENT, mMovementPanel)); mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_CAMERA, mCamPanel)); mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_SNAPSHOT, mSnapshotPanel)); + mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_SIDEBAR, getChild<LLPanel>("sidebar_btn_panel"))); mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_BUILD, getChild<LLPanel>("build_btn_panel"))); mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_SEARCH, getChild<LLPanel>("search_btn_panel"))); mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_WORLD_MAP, getChild<LLPanel>("world_map_btn_panel"))); @@ -1179,6 +1180,7 @@ void LLBottomTray::initResizeStateContainers() mButtonsProcessOrder.push_back(RS_BUTTON_MOVEMENT); mButtonsProcessOrder.push_back(RS_BUTTON_CAMERA); mButtonsProcessOrder.push_back(RS_BUTTON_SNAPSHOT); + mButtonsProcessOrder.push_back(RS_BUTTON_SIDEBAR); mButtonsProcessOrder.push_back(RS_BUTTON_BUILD); mButtonsProcessOrder.push_back(RS_BUTTON_SEARCH); mButtonsProcessOrder.push_back(RS_BUTTON_WORLD_MAP); @@ -1194,6 +1196,7 @@ void LLBottomTray::initResizeStateContainers() { const EResizeState button_type = *it; // is there an appropriate object? + llassert(mStateProcessedObjectMap.count(button_type) > 0); if (0 == mStateProcessedObjectMap.count(button_type)) continue; // set default width for it. @@ -1205,17 +1208,19 @@ void LLBottomTray::initResizeStateContainers() } +// this method must be called before restoring of the chat entry field on startup +// because it resets chatbar's width according to resize logic. void LLBottomTray::initButtonsVisibility() { - setTrayButtonVisibleIfPossible(RS_BUTTON_GESTURES, gSavedSettings.getBOOL("ShowGestureButton")); - setTrayButtonVisibleIfPossible(RS_BUTTON_MOVEMENT, gSavedSettings.getBOOL("ShowMoveButton")); - setTrayButtonVisibleIfPossible(RS_BUTTON_CAMERA, gSavedSettings.getBOOL("ShowCameraButton")); - setTrayButtonVisibleIfPossible(RS_BUTTON_SNAPSHOT, gSavedSettings.getBOOL("ShowSnapshotButton")); - - setTrayButtonVisibleIfPossible(RS_BUTTON_BUILD, gSavedSettings.getBOOL("ShowBuildButton")); - setTrayButtonVisibleIfPossible(RS_BUTTON_SEARCH, gSavedSettings.getBOOL("ShowSearchButton")); - setTrayButtonVisibleIfPossible(RS_BUTTON_WORLD_MAP, gSavedSettings.getBOOL("ShowWorldMapButton")); - setTrayButtonVisibleIfPossible(RS_BUTTON_MINI_MAP, gSavedSettings.getBOOL("ShowMiniMapButton")); + setVisibleAndFitWidths(RS_BUTTON_GESTURES, gSavedSettings.getBOOL("ShowGestureButton")); + setVisibleAndFitWidths(RS_BUTTON_MOVEMENT, gSavedSettings.getBOOL("ShowMoveButton")); + setVisibleAndFitWidths(RS_BUTTON_CAMERA, gSavedSettings.getBOOL("ShowCameraButton")); + setVisibleAndFitWidths(RS_BUTTON_SNAPSHOT, gSavedSettings.getBOOL("ShowSnapshotButton")); + setVisibleAndFitWidths(RS_BUTTON_SIDEBAR, gSavedSettings.getBOOL("ShowSidebarButton")); + setVisibleAndFitWidths(RS_BUTTON_BUILD, gSavedSettings.getBOOL("ShowBuildButton")); + setVisibleAndFitWidths(RS_BUTTON_SEARCH, gSavedSettings.getBOOL("ShowSearchButton")); + setVisibleAndFitWidths(RS_BUTTON_WORLD_MAP, gSavedSettings.getBOOL("ShowWorldMapButton")); + setVisibleAndFitWidths(RS_BUTTON_MINI_MAP, gSavedSettings.getBOOL("ShowMiniMapButton")); } void LLBottomTray::setButtonsControlsAndListeners() @@ -1224,20 +1229,19 @@ void LLBottomTray::setButtonsControlsAndListeners() gSavedSettings.declareBOOL("ShowMoveButton", TRUE, "Shows/Hides Move button in the bottom tray. (Declared in code)"); gSavedSettings.declareBOOL("ShowSnapshotButton", TRUE, "Shows/Hides Snapshot button button in the bottom tray. (Declared in code)"); gSavedSettings.declareBOOL("ShowCameraButton", TRUE, "Show/Hide View button in the bottom tray. (Declared in code)"); + gSavedSettings.declareBOOL("ShowSidebarButton", TRUE, "Shows/hides Sidebar button in the bottom tray. (Declared in code)"); gSavedSettings.declareBOOL("ShowBuildButton", TRUE, "Shows/Hides Build button in the bottom tray. (Declared in code)"); gSavedSettings.declareBOOL("ShowSearchButton", TRUE, "Shows/Hides Search button in the bottom tray. (Declared in code)"); gSavedSettings.declareBOOL("ShowWorldMapButton", TRUE, "Shows/Hides Map button in the bottom tray. (Declared in code)"); gSavedSettings.declareBOOL("ShowMiniMapButton", TRUE, "Shows/Hides Mini-Map button in the bottom tray. (Declared in code)"); - gSavedSettings.declareS32("ChatBarCustomWidth", 0, "Stores customized width of chat bar. (Declared in code)"); - gSavedSettings.getControl("ShowGestureButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_GESTURES, _2)); gSavedSettings.getControl("ShowMoveButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_MOVEMENT, _2)); gSavedSettings.getControl("ShowCameraButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_CAMERA, _2)); gSavedSettings.getControl("ShowSnapshotButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_SNAPSHOT, _2)); - + gSavedSettings.getControl("ShowSidebarButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_SIDEBAR, _2)); gSavedSettings.getControl("ShowBuildButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_BUILD, _2)); gSavedSettings.getControl("ShowSearchButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_SEARCH, _2)); gSavedSettings.getControl("ShowWorldMapButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_WORLD_MAP, _2)); @@ -1316,18 +1320,18 @@ bool LLBottomTray::setVisibleAndFitWidths(EResizeState object_type, bool visible const S32 chatbar_shrunk_width = mNearbyChatBar->getRect().getWidth() - get_panel_min_width(mToolbarStack, mNearbyChatBar); - // *TODO: update list of processed buttons to use new buttons; - const S32 sum_of_min_widths = - get_panel_min_width(mToolbarStack, mStateProcessedObjectMap[RS_BUTTON_CAMERA]) + - get_panel_min_width(mToolbarStack, mStateProcessedObjectMap[RS_BUTTON_MOVEMENT]) + - get_panel_min_width(mToolbarStack, mStateProcessedObjectMap[RS_BUTTON_GESTURES]) + - get_panel_min_width(mToolbarStack, mSpeakPanel); - - const S32 sum_of_curr_widths = - get_curr_width(mStateProcessedObjectMap[RS_BUTTON_CAMERA]) + - get_curr_width(mStateProcessedObjectMap[RS_BUTTON_MOVEMENT]) + - get_curr_width(mStateProcessedObjectMap[RS_BUTTON_GESTURES]) + - get_curr_width(mSpeakPanel); + S32 sum_of_min_widths = get_panel_min_width(mToolbarStack, mSpeakPanel); + S32 sum_of_curr_widths = get_curr_width(mSpeakPanel); + + resize_state_vec_t::const_iterator it = mButtonsProcessOrder.begin(); + const resize_state_vec_t::const_iterator it_end = mButtonsProcessOrder.end(); + + for (; it != it_end; ++it) + { + LLPanel * cur_panel = mStateProcessedObjectMap[*it]; + sum_of_min_widths += get_panel_min_width(mToolbarStack, cur_panel); + sum_of_curr_widths += get_curr_width(cur_panel); + } const S32 possible_shrunk_width = chatbar_shrunk_width + (sum_of_curr_widths - sum_of_min_widths); diff --git a/indra/newview/llbottomtray.h b/indra/newview/llbottomtray.h index 74b8ed0d87..889dc42097 100644 --- a/indra/newview/llbottomtray.h +++ b/indra/newview/llbottomtray.h @@ -124,6 +124,7 @@ private: , RS_BUTTON_SEARCH = 0x0400 , RS_BUTTON_WORLD_MAP = 0x0800 , RS_BUTTON_MINI_MAP = 0x1000 + , RS_BUTTON_SIDEBAR = 0x2000 /* Once new button that can be hidden on resize is added don't forget to update related places: @@ -138,6 +139,7 @@ private: */ , RS_BUTTONS_CAN_BE_HIDDEN = RS_BUTTON_SNAPSHOT | RS_BUTTON_CAMERA | RS_BUTTON_MOVEMENT | RS_BUTTON_GESTURES | RS_BUTTON_BUILD | RS_BUTTON_SEARCH | RS_BUTTON_WORLD_MAP | RS_BUTTON_MINI_MAP + | RS_BUTTON_SIDEBAR }EResizeState; /** diff --git a/indra/newview/skins/default/xui/en/menu_bottomtray.xml b/indra/newview/skins/default/xui/en/menu_bottomtray.xml index 5beafef4e4..ccd5388621 100644 --- a/indra/newview/skins/default/xui/en/menu_bottomtray.xml +++ b/indra/newview/skins/default/xui/en/menu_bottomtray.xml @@ -53,6 +53,17 @@ parameter="ShowSnapshotButton" /> </menu_item_check> <menu_item_check + label="Sidebar button" + layout="topleft" + name="ShowSidebarButton"> + <menu_item_check.on_click + function="ToggleControl" + parameter="ShowSidebarButton" /> + <menu_item_check.on_check + function="CheckControl" + parameter="ShowSidebarButton" /> + </menu_item_check> + <menu_item_check label="Build button" layout="topleft" name="ShowBuildButton"> diff --git a/indra/newview/skins/default/xui/en/panel_bottomtray.xml b/indra/newview/skins/default/xui/en/panel_bottomtray.xml index 0840812826..dd813f5813 100644 --- a/indra/newview/skins/default/xui/en/panel_bottomtray.xml +++ b/indra/newview/skins/default/xui/en/panel_bottomtray.xml @@ -221,6 +221,41 @@ min_height="28" min_width="52" mouse_opaque="false" + name="sidebar_btn_panel" + user_resize="false" + width="83"> +<!--*TODO: Implement toggle of sidebar with buttons +Disabled for now. +--> + <button +enabled="false" + follows="left|right" + height="23" + image_pressed="PushButton_Press" + image_pressed_selected="PushButton_Selected_Press" + image_selected="PushButton_Selected_Press" + is_toggle="true" + label="Sidebar" + layout="topleft" + left="0" + name="sidebar_btn" + tool_tip="Shows/hides Sidebar" + top="5" + use_ellipses="true" + width="80"> + <init_callback + function="" + parameter="" /> + </button> + </layout_panel> + <layout_panel + auto_resize="false" + follows="left|right" + height="28" + layout="topleft" + min_height="28" + min_width="52" + mouse_opaque="false" name="build_btn_panel" user_resize="false" width="83"> |