summaryrefslogtreecommitdiff
path: root/indra/newview/llbottomtray.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llbottomtray.cpp')
-rw-r--r--indra/newview/llbottomtray.cpp117
1 files changed, 95 insertions, 22 deletions
diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp
index 7985ccc2a1..c4f0fa53a7 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<LLPanel>("snapshot_panel");
setRightMouseDownCallback(boost::bind(&LLBottomTray::showBottomTrayContextMenu,this, _2, _3,_4));
+ mSpeakPanel = getChild<LLPanel>("speak_panel");
mSpeakBtn = getChild<LLSpeakButton>("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,38 +535,43 @@ 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 buttons_required_width = 0; //How many room will take shown buttons
+ S32 total_available_width = delta_width + chatbar_available_shrink_width + available_width_chiclet;
+ 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;
- 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);
}
- // 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 +601,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,13 +610,21 @@ 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");
}
}
-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)
{
@@ -625,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;
}
@@ -640,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)
{
@@ -666,7 +682,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 +694,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 +780,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 +793,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)