From e4e33cac29556cc0399380cdadb8f71814cc2e17 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 6 Apr 2011 01:48:07 +0300 Subject: STORM-1028 WIP Fixing bottom bar buttons reshaping, tier 1 Fixed bottom tray buttons not showing under some circumstances. (the fix was made weeks ago, so I don't remember what the circumstances are) --- indra/newview/llbottomtray.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index d8ec4b605c..9e069d63bb 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -1652,8 +1652,11 @@ bool LLBottomTray::setVisibleAndFitWidths(EResizeState object_type, bool visible S32 result_width = 0; bool decrease_width = false; +#if 0 // Mark this button to be shown + lldebugs << "Adding " << resizeStateToString(object_type) << " to mResizeState" << llendl; mResizeState |= object_type; +#endif if (preferred_width > 0 && available_width >= preferred_width) { -- cgit v1.2.3 From 318752fe3df9ef86d3735fc0ef935d27ac3d5f7d Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 6 Apr 2011 01:48:07 +0300 Subject: STORM-1028 WIP Fixing bottom bar buttons reshaping, tier 2 * When there is some free space and all auto-hidden buttons have been already shown, first extend the Speak button, then the others (was: vice versa). * Made the Speak button always have fixed width. --- indra/newview/llbottomtray.cpp | 148 ++++++++++++++++++++++++++++++----------- 1 file changed, 108 insertions(+), 40 deletions(-) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 9e069d63bb..838b072fd3 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -1392,53 +1392,80 @@ void LLBottomTray::processExtendButtons(S32& available_width) // do not allow extending any buttons if we have some buttons hidden via resize if (mResizeState & RS_BUTTONS_CAN_BE_HIDDEN) return; - // process buttons from left to right - resize_state_vec_t::const_iterator it = mButtonsProcessOrder.begin(); - const resize_state_vec_t::const_iterator it_end = mButtonsProcessOrder.end(); + lldebugs << "Distributing " << available_width << " px" << llendl; - // iterate through buttons in the mButtonsProcessOrder first - for (; it != it_end; ++it) + // First try extending the Speak button. + if (available_width > 0) { - // is there available space? - if (available_width <= 0) break; - - // try to extend next button - processExtendButton(*it, available_width); + if (!processExtendSpeakButton(available_width)) + { + // The Speak button needs extension but lacks some space. + // Don't extend other buttons in this case: the Speak button + // should consume the available headroom first. + return; + } } - const S32 chiclet_panel_width = mChicletPanel->getParent()->getRect().getWidth(); - static const S32 chiclet_panel_min_width = mChicletPanel->getMinWidth(); - const S32 available_width_chiclet = chiclet_panel_width - chiclet_panel_min_width; + // Then process the other buttons from left to right. + if (available_width > 0) + { + resize_state_vec_t::const_iterator it = mButtonsProcessOrder.begin(); + const resize_state_vec_t::const_iterator it_end = mButtonsProcessOrder.end(); - // then try to extend Speak button - if (available_width > 0 || available_width_chiclet > 0) + // iterate through buttons in the mButtonsProcessOrder first + for (; it != it_end; ++it) + { + // is there available space? + if (available_width <= 0) break; + + // try to extend next button + processExtendButton(*it, available_width); + } + } +} + +bool LLBottomTray::processExtendSpeakButton(S32& available_width) +{ + if (available_width <= 0) { - S32 panel_max_width = mObjectDefaultWidthMap[RS_BUTTON_SPEAK]; - S32 panel_width = mSpeakPanel->getRect().getWidth(); - S32 possible_extend_width = panel_max_width - panel_width; + llassert(available_width > 0); + return true; + } - if (possible_extend_width >= 0 && possible_extend_width <= available_width + available_width_chiclet) // HACK: this button doesn't change size so possible_extend_width will be 0 + const S32 panel_max_width = mObjectDefaultWidthMap[RS_BUTTON_SPEAK]; + const S32 panel_width = mSpeakPanel->getRect().getWidth(); + const S32 required_headroom = panel_max_width - panel_width; + +#if 0 + lldebugs << "required_extend_width = (panel_max_width - panel_width) = " + << "(" << panel_max_width << " - " << panel_width << ") = " << required_headroom << llendl; +#endif + + if (panel_width < panel_max_width) // if the button isn't extended already + { + if (available_width < required_headroom) // not enough space { - mSpeakBtn->setLabelVisible(true); - mSpeakPanel->reshape(panel_max_width, mSpeakPanel->getRect().getHeight()); - log(mSpeakBtn, "speak button is extended"); + lldebugs << "Need (" << required_headroom << " - " << available_width << ") = " + << (required_headroom - available_width) << " more px" + << " to extend the Speak button"<< llendl; - if( available_width > possible_extend_width) - { - available_width -= possible_extend_width; - } - else - { - S32 required_width = possible_extend_width - available_width; - available_width = 0; - mChicletPanel->getParent()->reshape(mChicletPanel->getParent()->getRect().getWidth() - required_width, mChicletPanel->getParent()->getRect().getHeight()); - } - lldebugs << "Extending Speak button panel: " << mSpeakPanel->getName() - << ", extended width: " << possible_extend_width - << ", rest width to process: " << available_width - << llendl; + return false; // Don't extend other buttons until we extend Speak. } + + // Reshape the Speak button to its maximum width. + mSpeakBtn->setLabelVisible(true); + mSpeakPanel->reshape(panel_max_width, mSpeakPanel->getRect().getHeight()); + + available_width -= required_headroom; + llassert(available_width >= 0); + + lldebugs << "Extending Speak button panel: " << mSpeakPanel->getName() + << ", extended width: " << required_headroom + << ", rest width to process: " << available_width + << llendl; } + + return true; } void LLBottomTray::processExtendButton(EResizeState processed_object_type, S32& available_width) @@ -1727,6 +1754,7 @@ bool LLBottomTray::setVisibleAndFitWidths(EResizeState object_type, bool visible setTrayButtonVisible(object_type, false); // Mark button NOT to show while future bottom tray extending + lldebugs << "Removing " << resizeStateToString(object_type) << " from mResizeState" << llendl; mResizeState &= ~object_type; // Extend other buttons if need @@ -1786,10 +1814,7 @@ void LLBottomTray::processChatbarCustomization(S32 new_width) mDesiredNearbyChatWidth = new_width; - LLView * chiclet_layout_panel = mChicletPanel->getParent(); - const S32 chiclet_min_width = get_panel_min_width(mToolbarStack, chiclet_layout_panel); - const S32 chiclet_panel_width = chiclet_layout_panel->getRect().getWidth(); - const S32 available_chiclet_shrink_width = chiclet_panel_width - chiclet_min_width; + const S32 available_chiclet_shrink_width = getChicletPanelShrinkHeadroom(); llassert(available_chiclet_shrink_width >= 0); if (delta_width > 0) // panel gets narrowly @@ -1808,6 +1833,16 @@ void LLBottomTray::processChatbarCustomization(S32 new_width) } } +S32 LLBottomTray::getChicletPanelShrinkHeadroom() const +{ + static const S32 min_width = mChicletPanel->getMinWidth(); + const S32 cur_width = mChicletPanel->getParent()->getRect().getWidth(); + + S32 shrink_headroom = cur_width - min_width; + llassert(shrink_headroom >= 0); // the panel cannot get narrower than the minimum + return shrink_headroom; +} + // static std::string LLBottomTray::resizeStateToString(EResizeState state) { @@ -1833,4 +1868,37 @@ std::string LLBottomTray::resizeStateToString(EResizeState state) return "UNKNOWN_BUTTON"; } +// static +std::string LLBottomTray::resizeStateMaskToString(MASK mask) +{ + std::string res; + + bool add_delimiter = false; + for (U32 i = 0; i < 16; i++) + { + EResizeState state = (EResizeState) (1 << i); + if (mask & state) + { + if (!add_delimiter) + { + add_delimiter = true; + } + else + { + res += ", "; + } + + res += resizeStateToString(state); + } + } + + if (res.empty()) + { + res = resizeStateToString(RS_NORESIZE); + } + + res += llformat(" (0x%X)", mask); + return res; +} + //EOF -- cgit v1.2.3 From 1218ffb000289954cbbbf7fc5c62e494c85f1ede Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 6 Apr 2011 01:48:07 +0300 Subject: STORM-1028 WIP Fixing bottom bar buttons reshaping, tier 3 * Rewritten some code for better readability. Behavior should not be affected. * Debug prints and other minor changes. --- indra/newview/llbottomtray.cpp | 157 +++++++++++++++++++++++------------------ 1 file changed, 90 insertions(+), 67 deletions(-) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 838b072fd3..a206724cd0 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -917,7 +917,7 @@ void LLBottomTray::log(LLView* panel, const std::string& descr) << ", rect: " << panel->getRect() - << "layout: " << layout->getName() + << " layout: " << layout->getName() << ", rect: " << layout->getRect() << llendl ; @@ -1023,6 +1023,7 @@ void LLBottomTray::reshape(S32 width, S32 height, BOOL called_from_parent) { mDesiredNearbyChatWidth = new_width; processChatbarCustomization(new_width); + lldebugs << "Setting nearby chat bar width to " << new_width << " px" << llendl; mChatBarContainer->reshape(new_width, mChatBarContainer->getRect().getHeight()); } needs_restore_custom_state = false; @@ -1034,29 +1035,27 @@ S32 LLBottomTray::processWidthDecreased(S32 delta_width) { bool still_should_be_processed = true; - const S32 chiclet_panel_width = mChicletPanel->getParent()->getRect().getWidth(); - const S32 chiclet_panel_min_width = mChicletPanel->getMinWidth(); + const S32 chiclet_panel_shrink_headrom = getChicletPanelShrinkHeadroom(); // There are four steps of processing width decrease. If in one of them required width was reached, // further are not needed. // 1. Decreasing width of chiclet panel. - if (chiclet_panel_width > chiclet_panel_min_width) + if (chiclet_panel_shrink_headrom > 0) { // we have some space to decrease chiclet panel - S32 panel_delta_min = chiclet_panel_width - chiclet_panel_min_width; - - S32 delta_panel = llmin(-delta_width, panel_delta_min); + S32 delta_panel = llmin(-delta_width, chiclet_panel_shrink_headrom); lldebugs << "delta_width: " << delta_width - << ", panel_delta_min: " << panel_delta_min + << ", panel_delta_min: " << chiclet_panel_shrink_headrom << ", delta_panel: " << delta_panel << llendl; // is chiclet panel width enough to process resizing? - delta_width += panel_delta_min; + delta_width += chiclet_panel_shrink_headrom; still_should_be_processed = delta_width < 0; + lldebugs << "Shrinking chiclet panel by " << delta_panel << " px" << llendl; mChicletPanel->getParent()->reshape(mChicletPanel->getParent()->getRect().getWidth() - delta_panel, mChicletPanel->getParent()->getRect().getHeight()); log(mChicletPanel, "after processing panel decreasing via chiclet panel"); @@ -1089,6 +1088,7 @@ S32 LLBottomTray::processWidthDecreased(S32 delta_width) // chatbar should only be shrunk here, not stretched if(delta_panel > 0) { + lldebugs << "Shrinking nearby chat bar by " << delta_panel << " px " << llendl; mChatBarContainer->reshape(mNearbyChatBar->getRect().getWidth() - delta_panel, mChatBarContainer->getRect().getHeight()); } @@ -1120,6 +1120,7 @@ S32 LLBottomTray::processWidthDecreased(S32 delta_width) { S32 compensative_width = nearby_needed_width > buttons_freed_width ? buttons_freed_width : nearby_needed_width; log(mNearbyChatBar, "before applying compensative width"); + lldebugs << "Extending nearby chat bar by " << compensative_width << " px" << llendl; mChatBarContainer->reshape(mChatBarContainer->getRect().getWidth() + compensative_width, mChatBarContainer->getRect().getHeight() ); log(mNearbyChatBar, "after applying compensative width"); lldebugs << buttons_freed_width << llendl; @@ -1134,52 +1135,45 @@ void LLBottomTray::processWidthIncreased(S32 delta_width) { if (delta_width <= 0) return; - const S32 chiclet_panel_width = mChicletPanel->getParent()->getRect().getWidth(); - static const S32 chiclet_panel_min_width = mChicletPanel->getMinWidth(); - - const S32 available_width_chiclet = chiclet_panel_width - chiclet_panel_min_width; - - // how many room we have to show hidden buttons - S32 total_available_width = delta_width + available_width_chiclet; + // how much room we have to show hidden buttons + S32 available_width = delta_width + getChicletPanelShrinkHeadroom(); - lldebugs << "Processing extending, available width:" - << ", chiclets - " << available_width_chiclet - << ", total - " << total_available_width - << llendl; + lldebugs << "Distributing (" << getChicletPanelShrinkHeadroom() + << " + " << delta_width << ") = " << available_width << " px" << llendl; - S32 available_width = total_available_width; + S32 processed_width = processShowButtons(available_width); + lldebugs << "processed_width = " << processed_width << ", delta_width = " << delta_width << llendl; - processShowButtons(available_width); + lldebugs << "Available_width after showing buttons: " << available_width << llendl; // if we have to show/extend some buttons but resized delta width is not enough... - S32 processed_width = total_available_width - available_width; if (processed_width > delta_width) { // ... let's shrink nearby chat & chiclet panels - S32 required_to_process_width = processed_width; - // 1. use delta width of resizing - required_to_process_width -= delta_width; + S32 shrink_by = processed_width - delta_width; // 2. use width available via decreasing of chiclet panel - if (required_to_process_width > 0) + if (shrink_by > 0) { - mChicletPanel->getParent()->reshape(mChicletPanel->getParent()->getRect().getWidth() - required_to_process_width, mChicletPanel->getParent()->getRect().getHeight()); + lldebugs << "Shrinking chiclet panel by " << shrink_by << " px" << llendl; + mChicletPanel->getParent()->reshape(mChicletPanel->getParent()->getRect().getWidth() - shrink_by, mChicletPanel->getParent()->getRect().getHeight()); log(mChicletPanel, "after applying compensative width for chiclets: "); - lldebugs << required_to_process_width << llendl; + lldebugs << shrink_by << llendl; } - } // shown buttons take some space, rest should be processed by nearby chatbar & chiclet panels delta_width -= processed_width; - - // how many space can nearby chatbar take? - S32 chatbar_panel_width_ = mChatBarContainer->getRect().getWidth(); - if (delta_width > 0 && chatbar_panel_width_ < mDesiredNearbyChatWidth) + // how much space can nearby chatbar take? + S32 chatbar_panel_width = mChatBarContainer->getRect().getWidth(); + lldebugs << "delta_width = " << delta_width + << ", chatbar_panel_width = " << chatbar_panel_width + << ", mDesiredNearbyChatWidth = " << mDesiredNearbyChatWidth << llendl; + if (delta_width > 0 && chatbar_panel_width < mDesiredNearbyChatWidth) { - S32 delta_panel_max = mDesiredNearbyChatWidth - chatbar_panel_width_; + S32 delta_panel_max = mDesiredNearbyChatWidth - chatbar_panel_width; S32 delta_panel = llmin(delta_width, delta_panel_max); lldebugs << "Unprocesed delta width: " << delta_width << ", can be applied to chatbar: " << delta_panel_max @@ -1187,17 +1181,22 @@ void LLBottomTray::processWidthIncreased(S32 delta_width) << llendl; delta_width -= delta_panel_max; - mChatBarContainer->reshape(chatbar_panel_width_ + delta_panel, mChatBarContainer->getRect().getHeight()); + lldebugs << "Extending nearby chat bar by " << delta_panel << " px " << llendl; + mChatBarContainer->reshape(chatbar_panel_width + delta_panel, mChatBarContainer->getRect().getHeight()); log(mNearbyChatBar, "applied unprocessed delta width"); } + if (delta_width > 0) { processExtendButtons(delta_width); } } -void LLBottomTray::processShowButtons(S32& available_width) +S32 LLBottomTray::processShowButtons(S32& available_width) { + lldebugs << "Distributing " << available_width << " px" << llendl; + S32 original_available_width = available_width; + // process buttons from left to right resize_state_vec_t::const_iterator it = mButtonsProcessOrder.begin(); const resize_state_vec_t::const_iterator it_end = mButtonsProcessOrder.end(); @@ -1210,22 +1209,30 @@ void LLBottomTray::processShowButtons(S32& available_width) // try to show next button processShowButton(*it, available_width); } + + return original_available_width - available_width; } bool LLBottomTray::processShowButton(EResizeState shown_object_type, S32& available_width) { - lldebugs << "Trying to show object type: " << shown_object_type << llendl; - LLPanel* panel = getButtonPanel(shown_object_type); if (NULL == panel) { - lldebugs << "There is no object to process for state: " << shown_object_type << llendl; return false; } + + if (panel->getVisible()) + { + return false; + } + + // We can only show a button if it was previously hidden due to lack of space + // and all buttons to the left of it are not auto-hidden + // (we auto-show the buttons left to right). bool can_be_shown = canButtonBeShown(shown_object_type); if (can_be_shown) { - //validate if we have enough room to show this button + // Make sure we have enough room to show this button. const S32 required_width = panel->getRect().getWidth(); can_be_shown = available_width >= required_width; if (can_be_shown) @@ -1234,11 +1241,16 @@ bool LLBottomTray::processShowButton(EResizeState shown_object_type, S32& availa setTrayButtonVisible(shown_object_type, true); - lldebugs << "processed object type: " << shown_object_type - << ", rest available width: " << available_width + lldebugs << "Showing button " << resizeStateToString(shown_object_type) + << ", remaining available width: " << available_width << llendl; mResizeState &= ~shown_object_type; } + else + { + lldebugs << "Need " << (required_width - available_width) << " more px to show " + << resizeStateToString(shown_object_type) << llendl; + } } return can_be_shown; } @@ -1265,7 +1277,6 @@ void LLBottomTray::processHideButton(EResizeState processed_object_type, S32& re LLPanel* panel = getButtonPanel(processed_object_type); if (NULL == panel) { - lldebugs << "There is no object to process for state: " << processed_object_type << llendl; return; } @@ -1345,7 +1356,6 @@ void LLBottomTray::processShrinkButton(EResizeState processed_object_type, S32& LLPanel* panel = getButtonPanel(processed_object_type); if (NULL == panel) { - lldebugs << "There is no object to process for type: " << processed_object_type << llendl; return; } @@ -1470,38 +1480,32 @@ bool LLBottomTray::processExtendSpeakButton(S32& available_width) void LLBottomTray::processExtendButton(EResizeState processed_object_type, S32& available_width) { + llassert(available_width >= 0); + LLPanel* panel = getButtonPanel(processed_object_type); if (NULL == panel) { - lldebugs << "There is no object to process for type: " << processed_object_type << llendl; return; } if (!panel->getVisible()) return; + // Widen the button up to its maximum width, but by not more than px. S32 panel_max_width = mObjectDefaultWidthMap[processed_object_type]; S32 panel_width = panel->getRect().getWidth(); - S32 possible_extend_width = panel_max_width - panel_width; + S32 required_headroom = panel_max_width - panel_width; - if (possible_extend_width > 0) + S32 extend_by = llmin(available_width, required_headroom); + if (extend_by > 0) { - // let calculate real width to extend - - // 1. apply all possible width - available_width -= possible_extend_width; + panel->reshape(panel_width + extend_by, panel->getRect().getHeight()); - // 2. it it is too much... - if (available_width < 0) - { - // reduce applied extended width to the excessive value. - possible_extend_width += available_width; - available_width = 0; - } - panel->reshape(panel_width + possible_extend_width, panel->getRect().getHeight()); + // Decrease amount of headroom available for other panels. + available_width -= extend_by; - lldebugs << "Extending panel: " << panel->getName() - << ", extended width: " << possible_extend_width - << ", rest width to process: " << available_width + lldebugs << "Extending " << panel->getName() + << " by " << extend_by + << " px; remaining available width: " << available_width << llendl; } } @@ -1510,6 +1514,13 @@ 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 0 + if (!can_be_shown) + { + lldebugs << "Button " << resizeStateToString(processed_object_type) << " was not auto-hidden" << llendl; + } +#endif + if (can_be_shown) { // Yes, it was. Lets now check that all buttons before it (that can be hidden on resize) @@ -1531,6 +1542,15 @@ bool LLBottomTray::canButtonBeShown(EResizeState processed_object_type) const // 2. Check if some previous buttons are still hidden on resize can_be_shown = !(buttons_before_mask & mResizeState); +#if 0 + if (!can_be_shown) + { + lldebugs << llformat("mResizeState = 0x%4x, buttons_before_mask = 0x%4x", mResizeState, buttons_before_mask) << llendl; + lldebugs << "Auto-hidden: " << resizeStateMaskToString(mResizeState) << llendl; + lldebugs << "Must show the following buttons to the left of " << resizeStateToString(processed_object_type) << " first:" << llendl; + lldebugs << resizeStateMaskToString(buttons_before_mask & mResizeState) << llendl; + } +#endif } return can_be_shown; } @@ -1595,6 +1615,7 @@ void LLBottomTray::initButtonsVisibility() setVisibleAndFitWidths(RS_BUTTON_SEARCH, gSavedSettings.getBOOL("ShowSearchButton")); setVisibleAndFitWidths(RS_BUTTON_WORLD_MAP, gSavedSettings.getBOOL("ShowWorldMapButton")); setVisibleAndFitWidths(RS_BUTTON_MINI_MAP, gSavedSettings.getBOOL("ShowMiniMapButton")); + lldebugs << "mResizeState = " << resizeStateMaskToString(mResizeState) << llendl; } void LLBottomTray::setButtonsControlsAndListeners() @@ -1631,7 +1652,6 @@ void LLBottomTray::setTrayButtonVisible(EResizeState shown_object_type, bool vis LLPanel* panel = getButtonPanel(shown_object_type); if (NULL == panel) { - lldebugs << "There is no object to show for state: " << shown_object_type << llendl; return; } @@ -1662,7 +1682,6 @@ bool LLBottomTray::setVisibleAndFitWidths(EResizeState object_type, bool visible LLPanel* cur_panel = getButtonPanel(object_type); if (NULL == cur_panel) { - lldebugs << "There is no object to process for state: " << object_type << llendl; return false; } @@ -1671,8 +1690,7 @@ bool LLBottomTray::setVisibleAndFitWidths(EResizeState object_type, bool visible if (visible) { // Assume that only chiclet panel can be auto-resized - const S32 available_width = - mChicletPanel->getParent()->getRect().getWidth() - mChicletPanel->getMinWidth(); + const S32 available_width = getChicletPanelShrinkHeadroom(); S32 preferred_width = mObjectDefaultWidthMap[object_type]; S32 current_width = cur_panel->getRect().getWidth(); @@ -1812,6 +1830,11 @@ void LLBottomTray::processChatbarCustomization(S32 new_width) if (delta_width == 0) return; + { + static unsigned dbg_cnt = 0; + lldebugs << llformat("*** (%03d) ************************************* %d", delta_width, ++dbg_cnt) << llendl; + } + mDesiredNearbyChatWidth = new_width; const S32 available_chiclet_shrink_width = getChicletPanelShrinkHeadroom(); -- cgit v1.2.3 From dfb17cf204b9fbf97129569398efe3d7bc88fe6a Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 6 Apr 2011 01:48:07 +0300 Subject: STORM-1028 WIP Fixing bottom bar buttons reshaping, tier 4 When user manually toggles a button (via context menu), show it regardless of whether it has been auto-hidden. Tech note: Added showButton() method which does the same as processShowButton() did but the check for the button being auto-hidden. --- indra/newview/llbottomtray.cpp | 137 ++++++++++++++++++++--------------------- 1 file changed, 68 insertions(+), 69 deletions(-) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index a206724cd0..0d18321f1c 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -1215,44 +1215,14 @@ S32 LLBottomTray::processShowButtons(S32& available_width) bool LLBottomTray::processShowButton(EResizeState shown_object_type, S32& available_width) { - LLPanel* panel = getButtonPanel(shown_object_type); - if (NULL == panel) + // Check if the button was previously auto-hidden (due to lack of space). + if ((mResizeState & shown_object_type) == 0) { return false; } - if (panel->getVisible()) - { - return false; - } - - // We can only show a button if it was previously hidden due to lack of space - // and all buttons to the left of it are not auto-hidden - // (we auto-show the buttons left to right). - bool can_be_shown = canButtonBeShown(shown_object_type); - if (can_be_shown) - { - // Make sure we have enough room to show this button. - const S32 required_width = panel->getRect().getWidth(); - can_be_shown = available_width >= required_width; - if (can_be_shown) - { - available_width -= required_width; - - setTrayButtonVisible(shown_object_type, true); - - lldebugs << "Showing button " << resizeStateToString(shown_object_type) - << ", remaining available width: " << available_width - << llendl; - mResizeState &= ~shown_object_type; - } - else - { - lldebugs << "Need " << (required_width - available_width) << " more px to show " - << resizeStateToString(shown_object_type) << llendl; - } - } - return can_be_shown; + // Ok. Try showing the button. + return showButton(shown_object_type, available_width); } void LLBottomTray::processHideButtons(S32& required_width, S32& buttons_freed_width) @@ -1512,46 +1482,33 @@ 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 0 - if (!can_be_shown) - { - lldebugs << "Button " << resizeStateToString(processed_object_type) << " was not auto-hidden" << llendl; - } -#endif - - if (can_be_shown) - { - // Yes, it was. Lets now check that all buttons before it (that can be hidden on resize) - // are already shown + // 1. Let's check that all buttons (that can be hidden on resize) before the given one 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(); + // 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(); - // 1. Find and accumulate all buttons types before one passed into the method. - MASK buttons_before_mask = RS_NORESIZE; - for (; it != it_end; ++it) - { - const EResizeState button_type = *it; - if (button_type == processed_object_type) break; + // 1. Find and accumulate all buttons types before one passed into the method. + MASK buttons_before_mask = RS_NORESIZE; + for (; it != it_end; ++it) + { + const EResizeState button_type = *it; + if (button_type == processed_object_type) break; - buttons_before_mask |= button_type; - } + buttons_before_mask |= button_type; + } - // 2. Check if some previous buttons are still hidden on resize - can_be_shown = !(buttons_before_mask & mResizeState); + // 2. Check if some previous buttons are still hidden on resize + bool can_be_shown = !(buttons_before_mask & mResizeState); #if 0 - if (!can_be_shown) - { - lldebugs << llformat("mResizeState = 0x%4x, buttons_before_mask = 0x%4x", mResizeState, buttons_before_mask) << llendl; - lldebugs << "Auto-hidden: " << resizeStateMaskToString(mResizeState) << llendl; - lldebugs << "Must show the following buttons to the left of " << resizeStateToString(processed_object_type) << " first:" << llendl; - lldebugs << resizeStateMaskToString(buttons_before_mask & mResizeState) << llendl; - } -#endif + if (!can_be_shown) + { + lldebugs << llformat("mResizeState = 0x%4x, buttons_before_mask = 0x%4x", mResizeState, buttons_before_mask) << llendl; + lldebugs << "Auto-hidden: " << resizeStateMaskToString(mResizeState) << llendl; + lldebugs << "Must show the following buttons to the left of " << resizeStateToString(processed_object_type) << " first:" << llendl; + lldebugs << resizeStateMaskToString(buttons_before_mask & mResizeState) << llendl; } +#endif return can_be_shown; } @@ -1647,6 +1604,48 @@ bool LLBottomTray::toggleShowButton(LLBottomTray::EResizeState button_type, cons return true; } +bool LLBottomTray::showButton(EResizeState button_type, S32& available_width) +{ + LLPanel* panel = getButtonPanel(button_type); + if (NULL == panel) + { + return false; + } + + if (panel->getVisible()) + { + return false; + } + + // Check if none of the buttons to the left of the given one was auto-hidden. + // (we auto-show the buttons left to right). + if (!canButtonBeShown(button_type)) + { + return false; + } + + // Make sure we have enough room to show this button. + const S32 required_width = panel->getRect().getWidth(); + if (available_width < required_width) + { + lldebugs << "Need " << (required_width - available_width) << " more px to show " << resizeStateToString(button_type) << llendl; + return false; + } + + // All good. Show the button. + setTrayButtonVisible(button_type, true); + + // Let the caller know that there is now less available space. + available_width -= required_width; + + lldebugs << "Showing button " << resizeStateToString(button_type) + << ", remaining available width: " << available_width + << llendl; + mResizeState &= ~button_type; + + return true; +} + void LLBottomTray::setTrayButtonVisible(EResizeState shown_object_type, bool visible) { LLPanel* panel = getButtonPanel(shown_object_type); @@ -1757,7 +1756,7 @@ bool LLBottomTray::setVisibleAndFitWidths(EResizeState object_type, bool visible current_width = result_width; } - is_set = processShowButton(object_type, current_width); + is_set = showButton(object_type, current_width); // Shrink buttons if needed if (is_set && decrease_width) -- cgit v1.2.3 From 4f09c204781d20e1b491b2aa22eed7c797685102 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 6 Apr 2011 01:48:07 +0300 Subject: STORM-1028 WIP Fixing bottom bar buttons reshaping, tier 5 Changes to improve readability. --- indra/newview/llbottomtray.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 0d18321f1c..0f69c7e474 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -940,7 +940,9 @@ void LLBottomTray::reshape(S32 width, S32 height, BOOL called_from_parent) if (mNearbyChatBar) log(mNearbyChatBar, "before"); if (mChicletPanel) log(mChicletPanel, "before"); - // stores width size on which bottom tray is less than width required by its children. EXT-991 + // Difference between bottom tray width required to fit its children and the actual width. (see EXT-991) + // Positive value means that bottom tray is not wide enough. + // Negative value means that there is free space. static S32 extra_shrink_width = 0; bool should_be_reshaped = true; @@ -962,11 +964,9 @@ void LLBottomTray::reshape(S32 width, S32 height, BOOL called_from_parent) // bottom tray is narrowed if (delta_width < 0) { - if (extra_shrink_width > 0) + if (extra_shrink_width > 0) // not enough space { - // is world rect was extra shrunk and decreasing again only update this value - // to delta_width negative - extra_shrink_width -= delta_width; // use "-=" because delta_width is negative + extra_shrink_width += llabs(delta_width); should_be_reshaped = false; } else @@ -977,13 +977,13 @@ void LLBottomTray::reshape(S32 width, S32 height, BOOL called_from_parent) width += extra_shrink_width; } } - // bottom tray is widen + // bottom tray is widened else { if (extra_shrink_width > delta_width) { - // Less than minimum width is more than increasing (delta_width) - // only reduce it value and make no reshape + // Still not enough space. + // Only subtract the delta from the required delta and don't reshape. extra_shrink_width -= delta_width; should_be_reshaped = false; } @@ -1043,20 +1043,20 @@ S32 LLBottomTray::processWidthDecreased(S32 delta_width) if (chiclet_panel_shrink_headrom > 0) { // we have some space to decrease chiclet panel - S32 delta_panel = llmin(-delta_width, chiclet_panel_shrink_headrom); + S32 shrink_by = llmin(-delta_width, chiclet_panel_shrink_headrom); lldebugs << "delta_width: " << delta_width << ", panel_delta_min: " << chiclet_panel_shrink_headrom - << ", delta_panel: " << delta_panel + << ", shrink_by: " << shrink_by << llendl; - // is chiclet panel width enough to process resizing? + // is chiclet panel wide enough to process resizing? delta_width += chiclet_panel_shrink_headrom; still_should_be_processed = delta_width < 0; - lldebugs << "Shrinking chiclet panel by " << delta_panel << " px" << llendl; - mChicletPanel->getParent()->reshape(mChicletPanel->getParent()->getRect().getWidth() - delta_panel, mChicletPanel->getParent()->getRect().getHeight()); + lldebugs << "Shrinking chiclet panel by " << shrink_by << " px" << llendl; + mChicletPanel->getParent()->reshape(mChicletPanel->getParent()->getRect().getWidth() - shrink_by, mChicletPanel->getParent()->getRect().getHeight()); log(mChicletPanel, "after processing panel decreasing via chiclet panel"); lldebugs << "RS_CHICLET_PANEL" @@ -1080,7 +1080,7 @@ S32 LLBottomTray::processWidthDecreased(S32 delta_width) S32 delta_panel = llmin(-delta_width, panel_delta_min); - // whether chatbar panel width is enough to process resizing? + // is chatbar panel wide enough to process resizing? delta_width += panel_delta_min; still_should_be_processed = delta_width < 0; -- cgit v1.2.3 From e710d740dcb14d696d3533071b030fd30e9cf198 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 6 Apr 2011 01:48:07 +0300 Subject: STORM-1028 WIP Fixing bottom bar buttons reshaping, tier 6 Fixed: if you slowly increase the viewer window width, the Speak button fails to expand. --- indra/newview/llbottomtray.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 0f69c7e474..0a6dd7beff 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -912,15 +912,14 @@ void LLBottomTray::log(LLView* panel, const std::string& descr) { if (NULL == panel) return; LLView* layout = panel->getParent(); - lldebugs << descr << ": " + LL_DEBUGS("Bottom Tray Rects") << descr << ": " << "panel: " << panel->getName() << ", rect: " << panel->getRect() << " layout: " << layout->getName() << ", rect: " << layout->getRect() - << llendl - ; + << LL_ENDL; } void LLBottomTray::reshape(S32 width, S32 height, BOOL called_from_parent) @@ -1141,15 +1140,16 @@ void LLBottomTray::processWidthIncreased(S32 delta_width) lldebugs << "Distributing (" << getChicletPanelShrinkHeadroom() << " + " << delta_width << ") = " << available_width << " px" << llendl; + // 1. Try showing buttons that have been auto-hidden. S32 processed_width = processShowButtons(available_width); lldebugs << "processed_width = " << processed_width << ", delta_width = " << delta_width << llendl; lldebugs << "Available_width after showing buttons: " << available_width << llendl; - // if we have to show/extend some buttons but resized delta width is not enough... + // If the newly shown buttons have consumed more than delta_width pixels, + // shrink the chiclet panel. if (processed_width > delta_width) { - // ... let's shrink nearby chat & chiclet panels // 1. use delta width of resizing S32 shrink_by = processed_width - delta_width; @@ -1161,12 +1161,12 @@ void LLBottomTray::processWidthIncreased(S32 delta_width) log(mChicletPanel, "after applying compensative width for chiclets: "); lldebugs << shrink_by << llendl; } - } - // shown buttons take some space, rest should be processed by nearby chatbar & chiclet panels - delta_width -= processed_width; + // shown buttons take some space, rest should be processed by nearby chatbar & chiclet panels + delta_width -= processed_width; + } - // how much space can nearby chatbar take? + // 2. Expand the nearby chat bar if needed. S32 chatbar_panel_width = mChatBarContainer->getRect().getWidth(); lldebugs << "delta_width = " << delta_width << ", chatbar_panel_width = " << chatbar_panel_width @@ -1186,9 +1186,12 @@ void LLBottomTray::processWidthIncreased(S32 delta_width) log(mNearbyChatBar, "applied unprocessed delta width"); } + // 3. Expand buttons that have been auto-shrunk, + // if we haven't yet consumed all the available headroom. if (delta_width > 0) { - processExtendButtons(delta_width); + S32 available_width = delta_width + getChicletPanelShrinkHeadroom(); + processExtendButtons(available_width); } } -- cgit v1.2.3 From 00a3e47e74a6a0e7843fb9de5b042a7694a9fcb5 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 6 Apr 2011 02:17:07 +0300 Subject: STORM-1028 WIP Fixing bottom bar buttons reshaping, tier 7 * Removed dead code. * Minor comment changes. --- indra/newview/llbottomtray.cpp | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 0a6dd7beff..aacdf4845a 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -1419,11 +1419,6 @@ bool LLBottomTray::processExtendSpeakButton(S32& available_width) const S32 panel_width = mSpeakPanel->getRect().getWidth(); const S32 required_headroom = panel_max_width - panel_width; -#if 0 - lldebugs << "required_extend_width = (panel_max_width - panel_width) = " - << "(" << panel_max_width << " - " << panel_width << ") = " << required_headroom << llendl; -#endif - if (panel_width < panel_max_width) // if the button isn't extended already { if (available_width < required_headroom) // not enough space @@ -1485,13 +1480,13 @@ void LLBottomTray::processExtendButton(EResizeState processed_object_type, S32& bool LLBottomTray::canButtonBeShown(EResizeState processed_object_type) const { - // 1. Let's check that all buttons (that can be hidden on resize) before the given one are already shown. + // Check that all buttons (that can be hidden on resize) + // to the left of the given one 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(); - // 1. Find and accumulate all buttons types before one passed into the method. MASK buttons_before_mask = RS_NORESIZE; for (; it != it_end; ++it) { @@ -1501,18 +1496,7 @@ bool LLBottomTray::canButtonBeShown(EResizeState processed_object_type) const buttons_before_mask |= button_type; } - // 2. Check if some previous buttons are still hidden on resize - bool can_be_shown = !(buttons_before_mask & mResizeState); -#if 0 - if (!can_be_shown) - { - lldebugs << llformat("mResizeState = 0x%4x, buttons_before_mask = 0x%4x", mResizeState, buttons_before_mask) << llendl; - lldebugs << "Auto-hidden: " << resizeStateMaskToString(mResizeState) << llendl; - lldebugs << "Must show the following buttons to the left of " << resizeStateToString(processed_object_type) << " first:" << llendl; - lldebugs << resizeStateMaskToString(buttons_before_mask & mResizeState) << llendl; - } -#endif - return can_be_shown; + return !(buttons_before_mask & mResizeState); } void LLBottomTray::initResizeStateContainers() @@ -1699,12 +1683,6 @@ bool LLBottomTray::setVisibleAndFitWidths(EResizeState object_type, bool visible S32 result_width = 0; bool decrease_width = false; -#if 0 - // Mark this button to be shown - lldebugs << "Adding " << resizeStateToString(object_type) << " to mResizeState" << llendl; - mResizeState |= object_type; -#endif - if (preferred_width > 0 && available_width >= preferred_width) { result_width = preferred_width; -- cgit v1.2.3 From f9698c264442bb0db068e4dc9d4d1ab0ba5c210a Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Mon, 11 Apr 2011 23:33:06 +0300 Subject: STORM-1028 WIP Fixing bottom bar buttons reshaping, tier 9 Removed unused methods. --- indra/newview/llbottomtray.cpp | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 9932dd5365..ca901766d7 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -492,26 +492,6 @@ void LLBottomTray::updateContextMenu(S32 x, S32 y, MASK mask) mBottomTrayContextMenu->setItemVisible("NearbyChatBar_Select_All", in_edit_box); } -void LLBottomTray::showGestureButton(BOOL visible) -{ - setTrayButtonVisibleIfPossible(RS_BUTTON_GESTURES, visible); -} - -void LLBottomTray::showMoveButton(BOOL visible) -{ - setTrayButtonVisibleIfPossible(RS_BUTTON_MOVEMENT, visible); -} - -void LLBottomTray::showCameraButton(BOOL visible) -{ - setTrayButtonVisibleIfPossible(RS_BUTTON_CAMERA, visible); -} - -void LLBottomTray::showSnapshotButton(BOOL visible) -{ - setTrayButtonVisibleIfPossible(RS_BUTTON_SNAPSHOT, visible); -} - void LLBottomTray::showSpeakButton(bool visible) { // Show/hide the button -- cgit v1.2.3 From e5aaf90bffa7005c0aa872c2084b6d57659d0fee Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 12 Apr 2011 00:20:18 +0300 Subject: STORM-1028 WIP Fixing bottom bar buttons reshaping, tier 10 Fixing a regression introduced in tier 1: not displaying the bottom tray buttons added when bottom tray was not wide enough display them, even after increasing the width to show all visible buttons. The fix is to mark such buttons as auto-hidden so that they appear as soon as we have enough free space. --- indra/newview/llbottomtray.cpp | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index ca901766d7..d5d8a27d85 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -1223,7 +1223,7 @@ S32 LLBottomTray::processShowButtons(S32& available_width) bool LLBottomTray::processShowButton(EResizeState shown_object_type, S32& available_width) { // Check if the button was previously auto-hidden (due to lack of space). - if ((mResizeState & shown_object_type) == 0) + if (!isAutoHidden(shown_object_type)) { return false; } @@ -1268,7 +1268,7 @@ void LLBottomTray::processHideButton(EResizeState processed_object_type, S32& re setTrayButtonVisible(processed_object_type, false); - mResizeState |= processed_object_type; + setAutoHidden(processed_object_type, true); lldebugs << "processing object type: " << processed_object_type << ", buttons_freed_width: " << buttons_freed_width @@ -1377,7 +1377,7 @@ void LLBottomTray::processShrinkButton(EResizeState processed_object_type, S32& void LLBottomTray::processExtendButtons(S32& available_width) { // do not allow extending any buttons if we have some buttons hidden via resize - if (mResizeState & RS_BUTTONS_CAN_BE_HIDDEN) return; + if (isAutoHidden(RS_BUTTONS_CAN_BE_HIDDEN)) return; lldebugs << "Distributing " << available_width << " px" << llendl; @@ -1500,7 +1500,7 @@ bool LLBottomTray::canButtonBeShown(EResizeState processed_object_type) const buttons_before_mask |= button_type; } - return !(buttons_before_mask & mResizeState); + return !isAutoHidden(buttons_before_mask); } void LLBottomTray::initResizeStateContainers() @@ -1632,7 +1632,7 @@ bool LLBottomTray::showButton(EResizeState button_type, S32& available_width) lldebugs << "Showing button " << resizeStateToString(button_type) << ", remaining available width: " << available_width << llendl; - mResizeState &= ~button_type; + setAutoHidden(button_type, false); return true; } @@ -1730,7 +1730,11 @@ bool LLBottomTray::setVisibleAndFitWidths(EResizeState object_type, bool visible } else { - // Nothing can be done, give up... + lldebugs << "Need " << (minimal_width - available_width - possible_shrunk_width) + << " more px to show " << resizeStateToString(object_type) << llendl; + + // Make the button uppear when we have more available space. + setAutoHidden(object_type, true); return false; } } @@ -1757,7 +1761,7 @@ bool LLBottomTray::setVisibleAndFitWidths(EResizeState object_type, bool visible // Mark button NOT to show while future bottom tray extending lldebugs << "Removing " << resizeStateToString(object_type) << " from mResizeState" << llendl; - mResizeState &= ~object_type; + setAutoHidden(object_type, false); // Extend other buttons if need if (delta_width) @@ -1908,4 +1912,21 @@ std::string LLBottomTray::resizeStateMaskToString(MASK mask) return res; } +bool LLBottomTray::isAutoHidden(MASK button_types) const +{ + return (mResizeState & button_types) != 0; +} + +void LLBottomTray::setAutoHidden(MASK button_types, bool hide) +{ + if (hide) + { + mResizeState |= button_types; + } + else + { + mResizeState &= ~button_types; + } +} + //EOF -- cgit v1.2.3 From 4a7f69f82008594d5f8d15887917e4b4a85ef587 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 12 Apr 2011 00:32:24 +0300 Subject: STORM-1028 WIP Fixing bottom bar buttons reshaping, tier 11 Typo. --- indra/newview/llbottomtray.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index d5d8a27d85..b6482e0ec4 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -1038,23 +1038,23 @@ S32 LLBottomTray::processWidthDecreased(S32 delta_width) { bool still_should_be_processed = true; - const S32 chiclet_panel_shrink_headrom = getChicletPanelShrinkHeadroom(); + const S32 chiclet_panel_shrink_headroom = getChicletPanelShrinkHeadroom(); // There are four steps of processing width decrease. If in one of them required width was reached, // further are not needed. // 1. Decreasing width of chiclet panel. - if (chiclet_panel_shrink_headrom > 0) + if (chiclet_panel_shrink_headroom > 0) { // we have some space to decrease chiclet panel - S32 shrink_by = llmin(-delta_width, chiclet_panel_shrink_headrom); + S32 shrink_by = llmin(-delta_width, chiclet_panel_shrink_headroom); lldebugs << "delta_width: " << delta_width - << ", panel_delta_min: " << chiclet_panel_shrink_headrom + << ", panel_delta_min: " << chiclet_panel_shrink_headroom << ", shrink_by: " << shrink_by << llendl; // is chiclet panel wide enough to process resizing? - delta_width += chiclet_panel_shrink_headrom; + delta_width += chiclet_panel_shrink_headroom; still_should_be_processed = delta_width < 0; -- cgit v1.2.3 From 5fe3675564f1c7d8cf13e94f43d32be5ea45940b Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Fri, 29 Apr 2011 15:53:14 -0700 Subject: EXP-761, EXP-758 --- indra/newview/llbottomtray.cpp | 42 +++++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 13 deletions(-) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 0371b7be71..6d40786b08 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -378,12 +378,13 @@ void LLBottomTray::onChange(EStatusType status, const std::string &channelURI, b } // We have to enable/disable right and left parts of speak button separately (EXT-4648) - mSpeakBtn->setSpeakBtnEnabled(enable); + getChild("speak_btn")->setEnabled(enable); + // skipped to avoid button blinking if (status != STATUS_JOINING && status!= STATUS_LEFT_CHANNEL) { bool voice_status = LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking(); - mSpeakBtn->setFlyoutBtnEnabled(voice_status); + getChild("speak_flyout_btn")->setEnabled(voice_status); if (voice_status) { LLFirstUse::speak(true); @@ -566,17 +567,21 @@ BOOL LLBottomTray::postBuild() setRightMouseDownCallback(boost::bind(&LLBottomTray::showBottomTrayContextMenu,this, _2, _3,_4)); mSpeakPanel = getChild("speak_panel"); - mSpeakBtn = getChild("talk"); - LLHints::registerHintTarget("speak_btn", mSpeakBtn->getHandle()); + mSpeakBtn = findChild("talk"); + if (mSpeakBtn) + { + LLHints::registerHintTarget("speak_btn", mSpeakBtn->getHandle()); + + // Localization tool doesn't understand custom buttons like + mSpeakBtn->setSpeakToolTip( getString("SpeakBtnToolTip") ); + mSpeakBtn->setShowToolTip( getString("VoiceControlBtnToolTip") ); + } // Both parts of speak button should be initially disabled because // it takes some time between logging in to world and connecting to voice channel. - mSpeakBtn->setSpeakBtnEnabled(false); - mSpeakBtn->setFlyoutBtnEnabled(false); + getChild("speak_btn")->setEnabled(false); + getChild("speak_flyout_btn")->setEnabled(false); - // Localization tool doesn't understand custom buttons like - mSpeakBtn->setSpeakToolTip( getString("SpeakBtnToolTip") ); - mSpeakBtn->setShowToolTip( getString("VoiceControlBtnToolTip") ); // Registering Chat Bar to receive Voice client status change notifications. LLVoiceClient::getInstance()->addObserver(this); @@ -872,6 +877,10 @@ void LLBottomTray::draw() getChild("show_help_btn")->setToggleState(help_floater_visible); + bool openmic = LLVoiceClient::getInstance()->getUserPTTState(); + bool voiceenabled = LLVoiceClient::getInstance()->voiceEnabled(); + getChild("speak_btn")->setToggleState(openmic && voiceenabled); + getChild("chat_zone_indicator")->setIsMuted(!voiceenabled); } @@ -1345,7 +1354,11 @@ void LLBottomTray::processShrinkButtons(S32& required_width, S32& buttons_freed_ if (possible_shrink_width > 0) { - mSpeakBtn->setLabelVisible(false); + if (mSpeakBtn) + { + mSpeakBtn->setLabelVisible(false); + } + mSpeakPanel->reshape(panel_width - possible_shrink_width, mSpeakPanel->getRect().getHeight()); required_width += possible_shrink_width; @@ -1442,10 +1455,13 @@ void LLBottomTray::processExtendButtons(S32& available_width) S32 possible_extend_width = panel_max_width - panel_width; if (possible_extend_width >= 0 && possible_extend_width <= available_width + available_width_chiclet) // HACK: this button doesn't change size so possible_extend_width will be 0 - { - mSpeakBtn->setLabelVisible(true); + { + if (mSpeakBtn) + { + mSpeakBtn->setLabelVisible(true); + } + mSpeakPanel->reshape(panel_max_width, mSpeakPanel->getRect().getHeight()); - log(mSpeakBtn, "speak button is extended"); if( available_width > possible_extend_width) { -- cgit v1.2.3 From efca808b0c95aa2406960cb60a25ab90b14bde90 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 4 May 2011 18:04:09 -0700 Subject: EXP-584 FIXED View button on bottom bar is hidden when launching Basic Viewer with Voice options added back in corrected order in which buttons are collapsed so that they collapse right to left --- indra/newview/llbottomtray.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 0371b7be71..0c34261f74 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -218,7 +218,7 @@ LLBottomTray::LLBottomTray(const LLSD&) mLandingTab(NULL), mCheckForDrag(false) { - // Firstly add ourself to IMSession observers, so we catch session events + // Firstly add our self to IMSession observers, so we catch session events // before chiclets do that. LLIMMgr::getInstance()->addSessionObserver(this); @@ -1539,21 +1539,35 @@ void LLBottomTray::initResizeStateContainers() mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_GESTURES, getChild("gesture_panel"))); mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_MOVEMENT, getChild("movement_panel"))); mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_CAMERA, getChild("cam_panel"))); + mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_DESTINATIONS, getChild("destinations_panel"))); + mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_AVATARS, getChild("avatar_panel"))); mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_SNAPSHOT, getChild("snapshot_panel"))); mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_BUILD, getChild("build_btn_panel"))); mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_SEARCH, getChild("search_btn_panel"))); mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_WORLD_MAP, getChild("world_map_btn_panel"))); mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_MINI_MAP, getChild("mini_map_btn_panel"))); + mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_SPLITTER_1, getChild("splitter_panel_1"))); + mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_PEOPLE, getChild("people_panel"))); + mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_PROFILE, getChild("profile_panel"))); + mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_SPLITTER_2, getChild("splitter_panel_2"))); + mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_HOWTO, getChild("howto_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_DESTINATIONS); + mButtonsProcessOrder.push_back(RS_BUTTON_AVATARS); 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); + mButtonsProcessOrder.push_back(RS_BUTTON_SPLITTER_1); + mButtonsProcessOrder.push_back(RS_BUTTON_PEOPLE); + mButtonsProcessOrder.push_back(RS_BUTTON_PROFILE); + mButtonsProcessOrder.push_back(RS_BUTTON_SPLITTER_2); + mButtonsProcessOrder.push_back(RS_BUTTON_HOWTO); mButtonsOrder.push_back(RS_BUTTON_SPEAK); mButtonsOrder.insert(mButtonsOrder.end(), mButtonsProcessOrder.begin(), mButtonsProcessOrder.end()); -- cgit v1.2.3 From 8a1fabd5a604244bca2910cdb54fb9df22b1bba7 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Thu, 5 May 2011 11:11:20 -0700 Subject: Build fix. Added missing cases to a switch statement for bottom tray buttons. Reviewed by Richard. --- indra/newview/llbottomtray.cpp | 46 +++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 18 deletions(-) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index b17f7de57a..189175566e 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -1884,26 +1884,36 @@ S32 LLBottomTray::getChicletPanelShrinkHeadroom() const // static std::string LLBottomTray::resizeStateToString(EResizeState state) { + const char *rs_string = "UNKNOWN_BUTTON"; + switch (state) { - case RS_NORESIZE: return "RS_NORESIZE"; - case RS_CHICLET_PANEL: return "RS_CHICLET_PANEL"; - case RS_CHATBAR_INPUT: return "RS_CHATBAR_INPUT"; - case RS_BUTTON_SNAPSHOT: return "RS_BUTTON_SNAPSHOT"; - case RS_BUTTON_CAMERA: return "RS_BUTTON_CAMERA"; - case RS_BUTTON_MOVEMENT: return "RS_BUTTON_MOVEMENT"; - case RS_BUTTON_GESTURES: return "RS_BUTTON_GESTURES"; - case RS_BUTTON_SPEAK: return "RS_BUTTON_SPEAK"; - case RS_IM_WELL: return "RS_IM_WELL"; - case RS_NOTIFICATION_WELL: return "RS_NOTIFICATION_WELL"; - case RS_BUTTON_BUILD: return "RS_BUTTON_BUILD"; - case RS_BUTTON_SEARCH: return "RS_BUTTON_SEARCH"; - case RS_BUTTON_WORLD_MAP: return "RS_BUTTON_WORLD_MAP"; - case RS_BUTTON_MINI_MAP: return "RS_BUTTON_MINI_MAP"; - case RS_BUTTONS_CAN_BE_HIDDEN: return "RS_BUTTONS_CAN_BE_HIDDEN"; - // No default to track additions. - } - return "UNKNOWN_BUTTON"; + case RS_NORESIZE: rs_string = "RS_NORESIZE"; break; + case RS_CHICLET_PANEL: rs_string = "RS_CHICLET_PANEL"; break; + case RS_CHATBAR_INPUT: rs_string = "RS_CHATBAR_INPUT"; break; + case RS_BUTTON_SNAPSHOT: rs_string = "RS_BUTTON_SNAPSHOT"; break; + case RS_BUTTON_CAMERA: rs_string = "RS_BUTTON_CAMERA"; break; + case RS_BUTTON_MOVEMENT: rs_string = "RS_BUTTON_MOVEMENT"; break; + case RS_BUTTON_GESTURES: rs_string = "RS_BUTTON_GESTURES"; break; + case RS_BUTTON_SPEAK: rs_string = "RS_BUTTON_SPEAK"; break; + case RS_IM_WELL: rs_string = "RS_IM_WELL"; break; + case RS_NOTIFICATION_WELL: rs_string = "RS_NOTIFICATION_WELL"; break; + case RS_BUTTON_BUILD: rs_string = "RS_BUTTON_BUILD"; break; + case RS_BUTTON_SEARCH: rs_string = "RS_BUTTON_SEARCH"; break; + case RS_BUTTON_WORLD_MAP: rs_string = "RS_BUTTON_WORLD_MAP"; break; + case RS_BUTTON_MINI_MAP: rs_string = "RS_BUTTON_MINI_MAP"; break; + case RS_BUTTON_DESTINATIONS: rs_string = "RS_BUTTON_DESTINATIONS"; break; + case RS_BUTTON_AVATARS: rs_string = "RS_BUTTON_AVATARS"; break; + case RS_BUTTON_PEOPLE: rs_string = "RS_BUTTON_PEOPLE"; break; + case RS_BUTTON_PROFILE: rs_string = "RS_BUTTON_PROFILE"; break; + case RS_BUTTON_HOWTO: rs_string = "RS_BUTTON_HOWTO"; break; + case RS_BUTTON_SPLITTER_1: rs_string = "RS_BUTTON_SPLITTER_1"; break; + case RS_BUTTON_SPLITTER_2: rs_string = "RS_BUTTON_SPLITTER_2"; break; + case RS_BUTTONS_CAN_BE_HIDDEN: rs_string = "RS_BUTTONS_CAN_BE_HIDDEN"; break; + // No default to track additions. + } + + return rs_string; } // static -- cgit v1.2.3 From f0d095086ff5bf2c231bee06064a89a8b6ef4a9b Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 5 May 2011 19:09:06 -0700 Subject: EXP-501 FIX View button on bottom bar is hidden when launching Basic Viewer... ignore button reordering in basic mode use preferred button collapse order --- indra/newview/llbottomtray.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 189175566e..cad00eed14 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -745,6 +745,8 @@ void LLBottomTray::updateButtonsOrdersAfterDnD() void LLBottomTray::saveButtonsOrder() { + if (!gSavedSettings.getBOOL("AllowBottomTrayButtonReordering")) return; + std::string user_dir = gDirUtilp->getLindenUserDir(); if (user_dir.empty()) return; @@ -765,6 +767,8 @@ void LLBottomTray::saveButtonsOrder() void LLBottomTray::loadButtonsOrder() { + if (!gSavedSettings.getBOOL("AllowBottomTrayButtonReordering")) return; + // load per-resident sorting information std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, SORTING_DATA_FILE_NAME); @@ -1537,9 +1541,6 @@ void LLBottomTray::initResizeStateContainers() mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_HOWTO, getChild("howto_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_DESTINATIONS); mButtonsProcessOrder.push_back(RS_BUTTON_AVATARS); mButtonsProcessOrder.push_back(RS_BUTTON_SNAPSHOT); @@ -1552,6 +1553,9 @@ void LLBottomTray::initResizeStateContainers() mButtonsProcessOrder.push_back(RS_BUTTON_PROFILE); mButtonsProcessOrder.push_back(RS_BUTTON_SPLITTER_2); mButtonsProcessOrder.push_back(RS_BUTTON_HOWTO); + mButtonsProcessOrder.push_back(RS_BUTTON_MOVEMENT); + mButtonsProcessOrder.push_back(RS_BUTTON_CAMERA); + mButtonsProcessOrder.push_back(RS_BUTTON_GESTURES); mButtonsOrder.push_back(RS_BUTTON_SPEAK); mButtonsOrder.insert(mButtonsOrder.end(), mButtonsProcessOrder.begin(), mButtonsProcessOrder.end()); -- cgit v1.2.3 From 51a72247f5ef430c9b315b9249300e6cbf7af914 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Fri, 6 May 2011 11:03:09 -0700 Subject: EXP-782 Toggling speak button while in call minimizes IM window --- indra/newview/llbottomtray.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index cad00eed14..5b38286cf5 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -555,8 +555,14 @@ BOOL LLBottomTray::postBuild() // Localization tool doesn't understand custom buttons like mSpeakBtn->setSpeakToolTip( getString("SpeakBtnToolTip") ); mSpeakBtn->setShowToolTip( getString("VoiceControlBtnToolTip") ); + } + else + { + LLTransientFloaterMgr::getInstance()->addControlView(getChild("speak_btn")); + LLTransientFloaterMgr::getInstance()->addControlView(getChild("flyout_btn")); } + // Both parts of speak button should be initially disabled because // it takes some time between logging in to world and connecting to voice channel. getChild("speak_btn")->setEnabled(false); -- cgit v1.2.3 From 4015e6b3c7b4ff34bd679618f2231b2f53258db4 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Fri, 6 May 2011 11:39:22 -0700 Subject: fixing flyoutbtn name --- indra/newview/llbottomtray.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 5b38286cf5..c72cdfd1dc 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -559,7 +559,7 @@ BOOL LLBottomTray::postBuild() else { LLTransientFloaterMgr::getInstance()->addControlView(getChild("speak_btn")); - LLTransientFloaterMgr::getInstance()->addControlView(getChild("flyout_btn")); + LLTransientFloaterMgr::getInstance()->addControlView(getChild("speak_flyout_btn")); } -- cgit v1.2.3