From dbbd4f9abd500efb458d2641fa113173dd8d3a07 Mon Sep 17 00:00:00 2001 From: ziree Date: Mon, 9 May 2011 00:04:57 +0200 Subject: [PATCH] FIRE-983, Fixed bottom bar button move crashes, made all buttons hideable and remember their positions. --- indra/newview/app_settings/settings.xml | 33 ++++++++++++ indra/newview/llbottomtray.cpp | 51 +++++++++++++++---- indra/newview/llbottomtray.h | 5 ++ .../skins/default/xui/en/menu_bottomtray.xml | 34 +++++++++++++ 4 files changed, 114 insertions(+), 9 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 07d8fa80d5..15c53491cd 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -9571,6 +9571,39 @@ Change of this parameter will affect the layout of buttons in notification toast Value 1 + ShowPeopleButton + + Comment + Shows/Hides People button in the bottom tray. + Persist + 1 + Type + Boolean + Value + 1 + + ShowAppearanceButton + + Comment + Shows/Hides Appearance button in the bottom tray. + Persist + 1 + Type + Boolean + Value + 1 + + ShowInventoryButton + + Comment + Shows/Hides Inventory button in the bottom tray. + Persist + 1 + Type + Boolean + Value + 1 + ShowBetaGrids Comment diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 1e11d3ecc1..9446479562 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -738,7 +738,14 @@ void LLBottomTray::updateButtonsOrdersAfterDnD() } // Update order of buttons according to drag'n'drop - mButtonsOrder.erase(std::find(mButtonsOrder.begin(), mButtonsOrder.end(), dragged_state)); + // Make sure to check if the button we want to move is actually known to the system -Zi + resize_state_vec_t::iterator position=std::find(mButtonsOrder.begin(), mButtonsOrder.end(), dragged_state); + if(position==mButtonsOrder.end()) + { + llwarns << "Could not find " << dragged_state << " in mButtonsOrder!" << llendl; + return; + } + mButtonsOrder.erase(position); if (!landing_state_found && mLandingTab == getChild(PANEL_CHICLET_NAME)) { mButtonsOrder.push_back(dragged_state); @@ -801,8 +808,7 @@ void LLBottomTray::loadButtonsOrder() LLSDSerialize::fromXML(settings_llsd, file); - - mButtonsOrder.clear(); + // clear out one of the two internal lists, the second will be used to compare the buttons later -Zi mButtonsProcessOrder.clear(); int i = 0; // getting button order from file @@ -811,17 +817,26 @@ void LLBottomTray::loadButtonsOrder() { std::string str = llformat("%d", i); EResizeState state = (EResizeState)settings_llsd[str].asInteger(); - mButtonsOrder.push_back(state); // [SL:KB] - Patch: UI-BottomTray | Checked: 2010-12-02 (Catznip-2.4.0g) | Added: Catznip-2.4.0g mButtonsProcessOrder.push_back(state); // [/SL:KB] -// // RS_BUTTON_SPEAK is skipped, because it shouldn't be in mButtonsProcessOrder (it does not hide or shrink). -// if (state != RS_BUTTON_SPEAK) -// { -// mButtonsProcessOrder.push_back(state); -// } + + // remove button from internal list to remember we found the button in the XML file -Zi + resize_state_vec_t::iterator position=std::find(mButtonsOrder.begin(), mButtonsOrder.end(), state); + if(position!=mButtonsOrder.end()) + mButtonsOrder.erase(position); } + // add buttons that are missing in the XML file to the second internal list -Zi + while(mButtonsOrder.size()) + { + mButtonsProcessOrder.push_back(*(mButtonsOrder.end()-1)); + mButtonsOrder.pop_back(); + } + + // copy the second internal list to the first -Zi + mButtonsOrder=mButtonsProcessOrder; + // There are other panels in layout stack order of which is not saved. Also, panels order of which is saved, // are already in layout stack but in wrong order. The most convenient way to place them is moving them // to front one by one (because in this case we don't have to pass the panel before which we want to insert our @@ -1664,6 +1679,11 @@ void LLBottomTray::initResizeStateContainers() mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_PLACES, getChild("bottom_sbplaces"))); mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_AO, getChild("ao_btn_panel"))); // ## Zi: Animation Overrider + // since we added the sidebar buttons to the bottom bar, wen also need to make them reorderable. -Zi + mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_PEOPLE, getChild("bottom_sbpeople"))); + mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_APPEARANCE, getChild("bottom_sbappearance"))); + mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_INVENTORY, getChild("bottom_sbinv"))); + // init an order of processed buttons // [SL:KB] - Patch: UI-BottomTray | Checked: 2010-09-07 (Catznip-2.1.2b) | Added: Catznip-2.1.2b mButtonsProcessOrder.push_back(RS_BUTTON_SPEAK); @@ -1681,6 +1701,11 @@ void LLBottomTray::initResizeStateContainers() mButtonsProcessOrder.push_back(RS_BUTTON_PLACES); mButtonsProcessOrder.push_back(RS_BUTTON_AO); // ## Zi: Animation Overrider + // since we added the sidebar buttons to the bottom bar, wen also need to make them reorderable. -Zi + mButtonsProcessOrder.push_back(RS_BUTTON_PEOPLE); + mButtonsProcessOrder.push_back(RS_BUTTON_APPEARANCE); + mButtonsProcessOrder.push_back(RS_BUTTON_INVENTORY); + // mButtonsOrder.push_back(RS_BUTTON_SPEAK); // mButtonsOrder.insert(mButtonsOrder.end(), mButtonsProcessOrder.begin(), mButtonsProcessOrder.end()); // [SL:KB] - Patch: UI-BottomTray | Checked: 2010-12-02 (Catznip-2.4.0g) | Added: Catznip-2.4.0g @@ -1728,6 +1753,10 @@ void LLBottomTray::initButtonsVisibility() setVisibleAndFitWidths(RS_BUTTON_ME, gSavedSettings.getBOOL("ShowMeButton")); setVisibleAndFitWidths(RS_BUTTON_PLACES, gSavedSettings.getBOOL("ShowPlacesButton")); setVisibleAndFitWidths(RS_BUTTON_AO, gSavedSettings.getBOOL("ShowAOButton")); // ## Zi: Animation Overrider + // take care of additional sidebar button visibility -Zi + setVisibleAndFitWidths(RS_BUTTON_PEOPLE, gSavedSettings.getBOOL("ShowPeopleButton")); + setVisibleAndFitWidths(RS_BUTTON_APPEARANCE, gSavedSettings.getBOOL("ShowAppearanceButton")); + setVisibleAndFitWidths(RS_BUTTON_INVENTORY, gSavedSettings.getBOOL("ShowInventoryButton")); } void LLBottomTray::setButtonsControlsAndListeners() @@ -1747,6 +1776,10 @@ void LLBottomTray::setButtonsControlsAndListeners() gSavedSettings.getControl("ShowMeButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_ME, _2)); gSavedSettings.getControl("ShowPlacesButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_PLACES, _2)); gSavedSettings.getControl("ShowAOButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_AO, _2)); // ## Zi: Animation Overrider + // take care of additional sidebar button visibility -Zi + gSavedSettings.getControl("ShowPeopleButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_PEOPLE, _2)); + gSavedSettings.getControl("ShowAppearanceButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_APPEARANCE, _2)); + gSavedSettings.getControl("ShowInventoryButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_INVENTORY, _2)); LLButton* build_btn = getChild("build_btn"); diff --git a/indra/newview/llbottomtray.h b/indra/newview/llbottomtray.h index 40735fb824..a6efddd41b 100644 --- a/indra/newview/llbottomtray.h +++ b/indra/newview/llbottomtray.h @@ -169,6 +169,10 @@ private: , RS_BUTTON_ME = 0x4000 , RS_BUTTON_PLACES = 0x8000 , RS_BUTTON_AO = 0x10000 // ## Zi: Animation Overrider + // sidebar buttons -Zi + , RS_BUTTON_PEOPLE = 0x20000 + , RS_BUTTON_APPEARANCE = 0x40000 + , RS_BUTTON_INVENTORY = 0x80000 /* Once new button that can be hidden on resize is added don't forget to update related places: @@ -184,6 +188,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_HOME | RS_BUTTON_ME | RS_BUTTON_PLACES | RS_BUTTON_AO // ## Zi: Animation Overrider + | RS_BUTTON_PEOPLE | RS_BUTTON_APPEARANCE | RS_BUTTON_INVENTORY // more sidebar buttons -Zi }EResizeState; // Below are three methods that were introduced to handle drag'n'drop diff --git a/indra/newview/skins/default/xui/en/menu_bottomtray.xml b/indra/newview/skins/default/xui/en/menu_bottomtray.xml index aef890fee7..1cecc212db 100644 --- a/indra/newview/skins/default/xui/en/menu_bottomtray.xml +++ b/indra/newview/skins/default/xui/en/menu_bottomtray.xml @@ -153,6 +153,40 @@ parameter="ShowAOButton" /> + + + + + + + + + + + + +