From 91fdbd92c8e93e1676ba501bbc91ee56d38255c3 Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Fri, 20 Nov 2009 14:39:27 +0200 Subject: Fixed normal bug EXT-2616 ("Speak" button isn't narrowed and has title when width of window is 800px) - updated resize behavior to shrink Snapshot button: only speaker is shown in this case. - updated LLSpeakButton to hide/show its labels - updated talk_button widget (talk_button.xml) to have correct follows attributes - also fixed bug with calculating necessary updates for children while extending bottom tray --HG-- branch : product-engine --- indra/newview/llbottomtray.cpp | 93 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 84 insertions(+), 9 deletions(-) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 7985ccc2a1..c53a5152de 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -48,6 +48,7 @@ LLBottomTray::LLBottomTray(const LLSD&) : mChicletPanel(NULL), mSysWell(NULL), + mSpeakPanel(NULL), mSpeakBtn(NULL), mNearbyChatBar(NULL), mToolbarStack(NULL) @@ -304,6 +305,7 @@ BOOL LLBottomTray::postBuild() mSnapshotPanel = getChild("snapshot_panel"); setRightMouseDownCallback(boost::bind(&LLBottomTray::showBottomTrayContextMenu,this, _2, _3,_4)); + mSpeakPanel = getChild("speak_panel"); mSpeakBtn = getChild("talk"); // Speak button should be initially disabled because @@ -320,6 +322,7 @@ BOOL LLBottomTray::postBuild() 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(); return TRUE; } @@ -476,7 +479,7 @@ S32 LLBottomTray::processWidthDecreased(S32 delta_width) S32 buttons_freed_width = 0; if (still_should_be_processed) { - processShrinkButtons(&delta_width); + processShrinkButtons(&delta_width, &buttons_freed_width); if (delta_width < 0) { @@ -532,9 +535,16 @@ void LLBottomTray::processWidthIncreased(S32 delta_width) const S32 available_width_chiclet = chiclet_panel_width - chiclet_panel_min_width; // how many room we have to show hidden buttons - S32 available_width = delta_width + chatbar_available_shrink_width + available_width_chiclet; + S32 total_available_width = delta_width + chatbar_available_shrink_width + available_width_chiclet; S32 buttons_required_width = 0; //How many room will take shown buttons + lldebugs << "Processing extending, available width:" + << ", chatbar - " << chatbar_available_shrink_width + << ", chiclets - " << available_width_chiclet + << ", total - " << total_available_width + << llendl; + + S32 available_width = total_available_width; if (available_width > 0) { lldebugs << "Trying to process: RS_BUTTON_GESTURES" << llendl; @@ -559,11 +569,14 @@ void LLBottomTray::processWidthIncreased(S32 delta_width) processShowButton(RS_BUTTON_SNAPSHOT, &available_width, &buttons_required_width); } - // if we have to show some buttons but width increasing is not enough... - if (buttons_required_width > 0 && delta_width < buttons_required_width) + processExtendButtons(&available_width); + + // 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 = buttons_required_width; + S32 required_to_process_width = processed_width; // 1. use delta width of resizing required_to_process_width -= delta_width; @@ -593,9 +606,8 @@ void LLBottomTray::processWidthIncreased(S32 delta_width) } // shown buttons take some space, rest should be processed by nearby chatbar & chiclet panels - delta_width -= buttons_required_width; + delta_width -= processed_width; - processExtendButtons(&delta_width); // how many space can nearby chatbar take? S32 chatbar_panel_width_ = mNearbyChatBar->getRect().getWidth(); @@ -603,8 +615,14 @@ void LLBottomTray::processWidthIncreased(S32 delta_width) { S32 delta_panel_max = chatbar_panel_max_width - 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 + << ", will be applied: " << delta_panel + << llendl; + delta_width -= delta_panel_max; mNearbyChatBar->reshape(chatbar_panel_width_ + delta_panel, mNearbyChatBar->getRect().getHeight()); + log(mNearbyChatBar, "applied unprocessed delta width"); } } @@ -666,7 +684,7 @@ void LLBottomTray::processHideButton(EResizeState processed_object_type, S32* re } } -void LLBottomTray::processShrinkButtons(S32* required_width) +void LLBottomTray::processShrinkButtons(S32* required_width, S32* buttons_freed_width) { processShrinkButton(RS_BUTTON_CAMERA, required_width); @@ -678,9 +696,44 @@ void LLBottomTray::processShrinkButtons(S32* required_width) { processShrinkButton(RS_BUTTON_GESTURES, required_width); } + if (*required_width < 0) + { + + S32 panel_min_width = 0; + std::string panel_name = mSpeakPanel->getName(); + bool success = mToolbarStack->getPanelMinSize(panel_name, &panel_min_width, NULL); + if (!success) + { + lldebugs << "Panel was not found to get its min width: " << panel_name << llendl; + } + else + { + // + mSpeakBtn->setLabelVisible(false); + S32 panel_width = mSpeakPanel->getRect().getWidth(); + S32 possible_shrink_width = panel_width - panel_min_width; + + if (possible_shrink_width > 0) + { + mSpeakPanel->reshape(panel_width - possible_shrink_width, mSpeakPanel->getRect().getHeight()); + + *required_width += possible_shrink_width; + + if (*required_width > 0) + { + *buttons_freed_width += *required_width; + } + + lldebugs << "Shrunk panel: " << panel_name + << ", shrunk width: " << possible_shrink_width + << ", rest width to process: " << *required_width + << llendl; + } + } + } } -void LLBottomTray::processShrinkButton(EResizeState processed_object_type, /*const std::string& panel_name, */S32* required_width) +void LLBottomTray::processShrinkButton(EResizeState processed_object_type, S32* required_width) { LLPanel* panel = mStateProcessedObjectMap[processed_object_type]; if (NULL == panel) @@ -729,6 +782,9 @@ void LLBottomTray::processShrinkButton(EResizeState processed_object_type, /*con void LLBottomTray::processExtendButtons(S32* available_width) { + // do not allow extending any buttons if we have some buttons hidden + if (mResizeState & RS_BUTTONS_CAN_BE_HIDDEN) return; + processExtendButton(RS_BUTTON_GESTURES, available_width); if (*available_width > 0) @@ -739,6 +795,25 @@ void LLBottomTray::processExtendButtons(S32* available_width) { processExtendButton(RS_BUTTON_MOVEMENT, 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; + if (possible_extend_width > 0 && possible_extend_width <= *available_width) + { + mSpeakBtn->setLabelVisible(true); + mSpeakPanel->reshape(panel_max_width, mSpeakPanel->getRect().getHeight()); + log(mSpeakBtn, "speak button is extended"); + + *available_width -= possible_extend_width; + + lldebugs << "Extending panel: " << mSpeakPanel->getName() + << ", extended width: " << possible_extend_width + << ", rest width to process: " << *available_width + << llendl; + } + } } void LLBottomTray::processExtendButton(EResizeState processed_object_type, S32* available_width) -- cgit v1.2.3 From 0876df6eef35a88bc0804e1d8eb0f4471eeda9f2 Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Fri, 20 Nov 2009 14:55:30 +0200 Subject: No ticket. Code to resize bottom tray is refuctored after the latest fix for EXT-2616: - Removed unused param while extending bottom tray - Moved some debug messages --HG-- branch : product-engine --- indra/newview/llbottomtray.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index c53a5152de..c4f0fa53a7 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -536,7 +536,6 @@ void LLBottomTray::processWidthIncreased(S32 delta_width) // how many room we have to show hidden buttons S32 total_available_width = delta_width + chatbar_available_shrink_width + available_width_chiclet; - S32 buttons_required_width = 0; //How many room will take shown buttons lldebugs << "Processing extending, available width:" << ", chatbar - " << chatbar_available_shrink_width @@ -547,26 +546,22 @@ void LLBottomTray::processWidthIncreased(S32 delta_width) S32 available_width = total_available_width; if (available_width > 0) { - lldebugs << "Trying to process: RS_BUTTON_GESTURES" << llendl; - processShowButton(RS_BUTTON_GESTURES, &available_width, &buttons_required_width); + processShowButton(RS_BUTTON_GESTURES, &available_width); } if (available_width > 0) { - lldebugs << "Trying to process: RS_BUTTON_MOVEMENT" << llendl; - processShowButton(RS_BUTTON_MOVEMENT, &available_width, &buttons_required_width); + processShowButton(RS_BUTTON_MOVEMENT, &available_width); } if (available_width > 0) { - lldebugs << "Trying to process: RS_BUTTON_CAMERA" << llendl; - processShowButton(RS_BUTTON_CAMERA, &available_width, &buttons_required_width); + processShowButton(RS_BUTTON_CAMERA, &available_width); } if (available_width > 0) { - lldebugs << "Trying to process: RS_BUTTON_SNAPSHOT" << llendl; - processShowButton(RS_BUTTON_SNAPSHOT, &available_width, &buttons_required_width); + processShowButton(RS_BUTTON_SNAPSHOT, &available_width); } processExtendButtons(&available_width); @@ -626,8 +621,10 @@ void LLBottomTray::processWidthIncreased(S32 delta_width) } } -bool LLBottomTray::processShowButton(EResizeState shown_object_type, S32* available_width, S32* buttons_required_width) +bool LLBottomTray::processShowButton(EResizeState shown_object_type, S32* available_width) { + lldebugs << "Trying to show object type: " << shown_object_type << llendl; + LLPanel* panel = mStateProcessedObjectMap[shown_object_type]; if (NULL == panel) { @@ -643,12 +640,11 @@ bool LLBottomTray::processShowButton(EResizeState shown_object_type, S32* availa if (can_be_shown) { *available_width -= required_width; - *buttons_required_width += required_width; setTrayButtonVisible(shown_object_type, true); - lldebugs << "processing object type: " << shown_object_type - << ", buttons_required_width: " << *buttons_required_width + lldebugs << "processed object type: " << shown_object_type + << ", rest available width: " << *available_width << llendl; mResizeState &= ~shown_object_type; } @@ -658,6 +654,8 @@ bool LLBottomTray::processShowButton(EResizeState shown_object_type, S32* availa void LLBottomTray::processHideButton(EResizeState processed_object_type, S32* required_width, S32* buttons_freed_width) { + lldebugs << "Trying to hide object type: " << processed_object_type << llendl; + LLPanel* panel = mStateProcessedObjectMap[processed_object_type]; if (NULL == panel) { -- cgit v1.2.3