diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llbottomtray.cpp | 106 | ||||
-rw-r--r-- | indra/newview/llbottomtray.h | 34 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_bottomtray.xml | 44 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_bottomtray.xml | 132 |
4 files changed, 291 insertions, 25 deletions
diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 226d5593c9..7f528c88b2 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -479,6 +479,10 @@ BOOL LLBottomTray::postBuild() initResizeStateContainers(); + setButtonsControlsAndListeners(); + + initButtonsVisibility(); + // update wells visibility: showWellButton(RS_IM_WELL, !LLIMWellWindow::getInstance()->isWindowEmpty()); showWellButton(RS_NOTIFICATION_WELL, !LLNotificationWellWindow::getInstance()->isWindowEmpty()); @@ -1091,52 +1095,108 @@ void LLBottomTray::processExtendButton(EResizeState processed_object_type, S32& bool LLBottomTray::canButtonBeShown(EResizeState processed_object_type) const { + // 0. Check if passed button was previously hidden on resize bool can_be_shown = mResizeState & processed_object_type; if (can_be_shown) { - static MASK MOVEMENT_PREVIOUS_BUTTONS_MASK = RS_BUTTON_GESTURES; - static MASK CAMERA_PREVIOUS_BUTTONS_MASK = RS_BUTTON_GESTURES | RS_BUTTON_MOVEMENT; - static MASK SNAPSHOT_PREVIOUS_BUTTONS_MASK = RS_BUTTON_GESTURES | RS_BUTTON_MOVEMENT | RS_BUTTON_CAMERA; + // Yes, it was. Lets now check that all buttons before it (that can be hidden on resize) + // are already shown + + // process buttons in direct order (from left to right) + resize_state_vec_t::const_iterator it = mButtonsProcessOrder.begin(); + const resize_state_vec_t::const_iterator it_end = mButtonsProcessOrder.end(); - switch(processed_object_type) + // 1. Find and accumulate all buttons types before one passed into the method. + MASK buttons_before_mask = RS_NORESIZE; + for (; it != it_end; ++it) { - case RS_BUTTON_GESTURES: // Gestures should be shown first - break; - case RS_BUTTON_MOVEMENT: // Move only if gesture is shown - can_be_shown = !(MOVEMENT_PREVIOUS_BUTTONS_MASK & mResizeState); - break; - case RS_BUTTON_CAMERA: - can_be_shown = !(CAMERA_PREVIOUS_BUTTONS_MASK & mResizeState); - break; - case RS_BUTTON_SNAPSHOT: - can_be_shown = !(SNAPSHOT_PREVIOUS_BUTTONS_MASK & mResizeState); - break; - default: // nothing to do here - break; + const EResizeState button_type = *it; + if (button_type == processed_object_type) break; + + buttons_before_mask |= button_type; } + + // 2. Check if some previous buttons are still hidden on resize + can_be_shown = !(buttons_before_mask & mResizeState); } return can_be_shown; } void LLBottomTray::initResizeStateContainers() { + // *TODO: get rid of mGesturePanel, mMovementPanel, mCamPanel, mSnapshotPanel instance members // init map with objects should be processed for each type mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_GESTURES, mGesturePanel)); 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)); - - // init default widths - mObjectDefaultWidthMap[RS_BUTTON_GESTURES] = mGesturePanel->getRect().getWidth(); - mObjectDefaultWidthMap[RS_BUTTON_MOVEMENT] = mMovementPanel->getRect().getWidth(); - mObjectDefaultWidthMap[RS_BUTTON_CAMERA] = mCamPanel->getRect().getWidth(); - mObjectDefaultWidthMap[RS_BUTTON_SPEAK] = mSpeakPanel->getRect().getWidth(); + 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"))); + mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_MINI_MAP, getChild<LLPanel>("mini_map_btn_panel"))); // init an order of processed buttons mButtonsProcessOrder.push_back(RS_BUTTON_GESTURES); mButtonsProcessOrder.push_back(RS_BUTTON_MOVEMENT); mButtonsProcessOrder.push_back(RS_BUTTON_CAMERA); mButtonsProcessOrder.push_back(RS_BUTTON_SNAPSHOT); + mButtonsProcessOrder.push_back(RS_BUTTON_BUILD); + mButtonsProcessOrder.push_back(RS_BUTTON_SEARCH); + mButtonsProcessOrder.push_back(RS_BUTTON_WORLD_MAP); + mButtonsProcessOrder.push_back(RS_BUTTON_MINI_MAP); + + // init default widths + + // process buttons that can be hidden on resize... + 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) + { + const EResizeState button_type = *it; + // is there an appropriate object? + if (0 == mStateProcessedObjectMap.count(button_type)) continue; + + // set default width for it. + mObjectDefaultWidthMap[button_type] = mStateProcessedObjectMap[button_type]->getRect().getWidth(); + } + + // ... and add Speak button because it also can be shrunk. + mObjectDefaultWidthMap[RS_BUTTON_SPEAK] = mSpeakPanel->getRect().getWidth(); + +} + +void LLBottomTray::initButtonsVisibility() +{ + // *TODO: move control settings of other buttons here + 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")); +} + +void LLBottomTray::setButtonsControlsAndListeners() +{ + // *TODO: move control settings of other buttons here + 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.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)); + gSavedSettings.getControl("ShowMiniMapButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_MINI_MAP, _2)); +} + +bool LLBottomTray::toggleShowButton(LLBottomTray::EResizeState button_type, const LLSD& new_visibility) +{ + if (LLBottomTray::instanceExists()) + { + LLBottomTray::getInstance()->setTrayButtonVisibleIfPossible(button_type, new_visibility.asBoolean()); + } + return true; } void LLBottomTray::setTrayButtonVisible(EResizeState shown_object_type, bool visible) diff --git a/indra/newview/llbottomtray.h b/indra/newview/llbottomtray.h index e9d59e82ba..5588aefb42 100644 --- a/indra/newview/llbottomtray.h +++ b/indra/newview/llbottomtray.h @@ -120,12 +120,24 @@ private: , RS_BUTTON_SPEAK = 0x0040 , RS_IM_WELL = 0x0080 , RS_NOTIFICATION_WELL = 0x0100 + , RS_BUTTON_BUILD = 0x0200 + , RS_BUTTON_SEARCH = 0x0400 + , RS_BUTTON_WORLD_MAP = 0x0800 + , RS_BUTTON_MINI_MAP = 0x1000 + + /* + Once new button that can be hidden on resize is added don't forget to update related places: + - RS_BUTTONS_CAN_BE_HIDDEN enum value below. + - initResizeStateContainers(): mStateProcessedObjectMap and mButtonsProcessOrder + */ /** * Specifies buttons which can be hidden when bottom tray is shrunk. * They are: Gestures, Movement (Move), Camera (View), Snapshot + * new: Build, Search, Map, World Map, Mini-Map. */ , 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 }EResizeState; /** @@ -272,6 +284,28 @@ private: void initResizeStateContainers(); /** + * Initializes buttons' visibility depend on stored Control Settings. + */ + void initButtonsVisibility(); + + /** + * Initializes listeners of Control Settings to toggle appropriate buttons' visibility. + * + * @see toggleShowButton() + */ + void setButtonsControlsAndListeners(); + + /** + * Toggles visibility of specified button depend on passed value. + * + * @param button_type - type of button to be toggled + * @param new_visibility - new visibility of the button + * + * @see setButtonsControlsAndListeners() + */ + static bool toggleShowButton(EResizeState button_type, const LLSD& new_visibility); + + /** * Sets passed visibility to object specified by resize type. */ void setTrayButtonVisible(EResizeState shown_object_type, bool visible); diff --git a/indra/newview/skins/default/xui/en/menu_bottomtray.xml b/indra/newview/skins/default/xui/en/menu_bottomtray.xml index 7ef91a1d85..5beafef4e4 100644 --- a/indra/newview/skins/default/xui/en/menu_bottomtray.xml +++ b/indra/newview/skins/default/xui/en/menu_bottomtray.xml @@ -52,6 +52,50 @@ function="CheckControl" parameter="ShowSnapshotButton" /> </menu_item_check> + <menu_item_check + label="Build button" + layout="topleft" + name="ShowBuildButton"> + <menu_item_check.on_click + function="ToggleControl" + parameter="ShowBuildButton" /> + <menu_item_check.on_check + function="CheckControl" + parameter="ShowBuildButton" /> + </menu_item_check> + <menu_item_check + label="Search button" + layout="topleft" + name="ShowSearchButton"> + <menu_item_check.on_click + function="ToggleControl" + parameter="ShowSearchButton" /> + <menu_item_check.on_check + function="CheckControl" + parameter="ShowSearchButton" /> + </menu_item_check> + <menu_item_check + label="Map button" + layout="topleft" + name="ShowWorldMapButton"> + <menu_item_check.on_click + function="ToggleControl" + parameter="ShowWorldMapButton" /> + <menu_item_check.on_check + function="CheckControl" + parameter="ShowWorldMapButton" /> + </menu_item_check> + <menu_item_check + label="Mini-Map button" + layout="topleft" + name="ShowMiniMapButton"> + <menu_item_check.on_click + function="ToggleControl" + parameter="ShowMiniMapButton" /> + <menu_item_check.on_check + function="CheckControl" + parameter="ShowMiniMapButton" /> + </menu_item_check> <menu_item_separator name="Separator" /> <menu_item_call diff --git a/indra/newview/skins/default/xui/en/panel_bottomtray.xml b/indra/newview/skins/default/xui/en/panel_bottomtray.xml index 7b11538ccc..620aabeeb8 100644 --- a/indra/newview/skins/default/xui/en/panel_bottomtray.xml +++ b/indra/newview/skins/default/xui/en/panel_bottomtray.xml @@ -10,7 +10,7 @@ left="0" name="bottom_tray" top="28" - width="1000"> + width="1310"> <string name="SpeakBtnToolTip" value="Turns microphone on/off" /> @@ -28,7 +28,7 @@ name="toolbar_stack" orientation="horizontal" top="0" - width="1000"> + width="1310"> <icon auto_resize="false" follows="left|right" @@ -211,6 +211,134 @@ </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"> +<!--*FIX: Build Floater is not opened with default registration. Will be fixed soon. +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="Build" + layout="topleft" + left="0" + name="build_btn" + tool_tip="Shows/hides Build Tools" + top="5" + use_ellipses="true" + width="80"> + <init_callback + function="Button.SetFloaterToggle" + parameter="build" /> + </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="search_btn_panel" + user_resize="false" + width="83"> + <button + follows="left|right" + height="23" + image_pressed="PushButton_Press" + image_pressed_selected="PushButton_Selected_Press" + image_selected="PushButton_Selected_Press" + is_toggle="true" + label="Search" + layout="topleft" + left="0" + name="search_btn" + tool_tip="Shows/hides Search" + top="5" + use_ellipses="true" + width="80"> + <init_callback + function="Button.SetFloaterToggle" + parameter="search" /> + </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="world_map_btn_panel" + user_resize="false" + width="83"> + <button + follows="left|right" + height="23" + image_pressed="PushButton_Press" + image_pressed_selected="PushButton_Selected_Press" + image_selected="PushButton_Selected_Press" + is_toggle="true" + label="Map" + layout="topleft" + left="0" + name="world_map_btn" + tool_tip="Shows/hides World Map" + top="5" + use_ellipses="true" + width="80"> + <init_callback + function="Button.SetFloaterToggle" + parameter="world_map" /> + </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="mini_map_btn_panel" + user_resize="false" + width="83"> + <button + follows="left|right" + height="23" + image_pressed="PushButton_Press" + image_pressed_selected="PushButton_Selected_Press" + image_selected="PushButton_Selected_Press" + is_toggle="true" + label="Mini-Map" + layout="topleft" + left="0" + name="mini_map_btn" + tool_tip="Shows/hides Mini-Map" + top="5" + use_ellipses="true" + width="80"> + <init_callback + function="Button.SetFloaterToggle" + parameter="mini_map" /> + </button> + </layout_panel> + <layout_panel follows="left|right" height="30" layout="topleft" |