FIRE-983, Fixed bottom bar button move crashes, made all buttons hideable and remember their positions.

meow-7.2.2
ziree 2011-05-09 00:04:57 +02:00
parent 5ff2518f9c
commit dbbd4f9abd
4 changed files with 114 additions and 9 deletions

View File

@ -9571,6 +9571,39 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key>
<integer>1</integer>
</map>
<key>ShowPeopleButton</key>
<map>
<key>Comment</key>
<string>Shows/Hides People button in the bottom tray.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>ShowAppearanceButton</key>
<map>
<key>Comment</key>
<string>Shows/Hides Appearance button in the bottom tray.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>ShowInventoryButton</key>
<map>
<key>Comment</key>
<string>Shows/Hides Inventory button in the bottom tray.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>ShowBetaGrids</key>
<map>
<key>Comment</key>

View File

@ -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<LLPanel>(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<LLPanel>("bottom_sbplaces")));
mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_AO, getChild<LLPanel>("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<LLPanel>("bottom_sbpeople")));
mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_APPEARANCE, getChild<LLPanel>("bottom_sbappearance")));
mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_INVENTORY, getChild<LLPanel>("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<LLButton>("build_btn");

View File

@ -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

View File

@ -153,6 +153,40 @@
parameter="ShowAOButton" />
</menu_item_check>
<!-- ## Zi: Animation Overrider -->
<menu_item_check
label="People button"
layout="topleft"
name="ShowPeopleButton">
<menu_item_check.on_click
function="ToggleControl"
parameter="ShowPeopleButton" />
<menu_item_check.on_check
function="CheckControl"
parameter="ShowPeopleButton" />
</menu_item_check>
<menu_item_check
label="Appearance button"
layout="topleft"
name="ShowAppearanceButton">
<menu_item_check.on_click
function="ToggleControl"
parameter="ShowAppearanceButton" />
<menu_item_check.on_check
function="CheckControl"
parameter="ShowAppearanceButton" />
</menu_item_check>
<menu_item_check
label="Inventory button"
layout="topleft"
name="ShowInventoryButton">
<menu_item_check.on_click
function="ToggleControl"
parameter="ShowInventoryButton" />
<menu_item_check.on_check
function="CheckControl"
parameter="ShowInventoryButton" />
</menu_item_check>
<menu_item_separator
name="Separator" />
<menu_item_call