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.cpp87
1 files changed, 46 insertions, 41 deletions
diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp
index e7c2a3ccf8..33d006578d 100644
--- a/indra/newview/llbottomtray.cpp
+++ b/indra/newview/llbottomtray.cpp
@@ -161,12 +161,14 @@ public:
mGesturePanel = getChild<LLPanel>("gesture_panel");
// Hide "show_nearby_chat" button
- LLLineEditor* chat_box = mNearbyChatBar->getChatBox();
- LLUICtrl* show_btn = mNearbyChatBar->getChild<LLUICtrl>("show_nearby_chat");
- S32 delta_width = show_btn->getRect().getWidth();
- show_btn->setVisible(FALSE);
- chat_box->reshape(chat_box->getRect().getWidth() + delta_width, chat_box->getRect().getHeight());
-
+ if (mNearbyChatBar)
+ {
+ LLLineEditor* chat_box = mNearbyChatBar->getChatBox();
+ LLUICtrl* show_btn = mNearbyChatBar->getChild<LLUICtrl>("show_nearby_chat");
+ S32 delta_width = show_btn->getRect().getWidth();
+ show_btn->setVisible(FALSE);
+ chat_box->reshape(chat_box->getRect().getWidth() + delta_width, chat_box->getRect().getHeight());
+ }
return TRUE;
}
@@ -226,6 +228,7 @@ LLBottomTray::LLBottomTray(const LLSD&)
}
mImageDragIndication = LLUI::getUIImage(getString("DragIndicationImageName"));
+ mDesiredNearbyChatWidth = mNearbyChatBar ? mNearbyChatBar->getRect().getWidth() : 0;
}
LLBottomTray::~LLBottomTray()
@@ -972,6 +975,7 @@ void LLBottomTray::reshape(S32 width, S32 height, BOOL called_from_parent)
S32 new_width = gSavedSettings.getS32("ChatBarCustomWidth");
if (new_width > 0)
{
+ mDesiredNearbyChatWidth = new_width;
processChatbarCustomization(new_width);
mChatBarContainer->reshape(new_width, mChatBarContainer->getRect().getHeight());
}
@@ -987,6 +991,9 @@ S32 LLBottomTray::processWidthDecreased(S32 delta_width)
const S32 chiclet_panel_width = mChicletPanel->getParent()->getRect().getWidth();
const S32 chiclet_panel_min_width = mChicletPanel->getMinWidth();
+ // 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)
{
// we have some space to decrease chiclet panel
@@ -1012,8 +1019,15 @@ S32 LLBottomTray::processWidthDecreased(S32 delta_width)
<< llendl;
}
- const S32 chatbar_panel_width = mChatBarContainer->getRect().getWidth();
+ S32 buttons_freed_width = 0;
+ // 2. Decreasing width of buttons.
+ if (still_should_be_processed)
+ {
+ processShrinkButtons(delta_width, buttons_freed_width);
+ }
+ // 3. Decreasing width of nearby chat.
const S32 chatbar_panel_min_width = get_panel_min_width(mToolbarStack, mNearbyChatBar);
+ const S32 chatbar_panel_width = mChatBarContainer->getRect().getWidth();
if (still_should_be_processed && chatbar_panel_width > chatbar_panel_min_width)
{
// we have some space to decrease chatbar panel
@@ -1026,7 +1040,11 @@ S32 LLBottomTray::processWidthDecreased(S32 delta_width)
still_should_be_processed = delta_width < 0;
- mChatBarContainer->reshape(mChatBarContainer->getRect().getWidth() - delta_panel, mChatBarContainer->getRect().getHeight());
+ // chatbar should only be shrunk here, not stretched
+ if(delta_panel > 0)
+ {
+ mChatBarContainer->reshape(mNearbyChatBar->getRect().getWidth() - delta_panel, mChatBarContainer->getRect().getHeight());
+ }
log(mNearbyChatBar, "after processing panel decreasing via nearby chatbar panel");
@@ -1037,11 +1055,9 @@ S32 LLBottomTray::processWidthDecreased(S32 delta_width)
}
S32 extra_shrink_width = 0;
- S32 buttons_freed_width = 0;
+ // 4. Hiding buttons if needed.
if (still_should_be_processed)
{
- processShrinkButtons(delta_width, buttons_freed_width);
-
processHideButtons(delta_width, buttons_freed_width);
if (delta_width < 0)
@@ -1053,10 +1069,15 @@ S32 LLBottomTray::processWidthDecreased(S32 delta_width)
if (buttons_freed_width > 0)
{
- log(mNearbyChatBar, "before applying compensative width");
- mChatBarContainer->reshape(mChatBarContainer->getRect().getWidth() + buttons_freed_width, mChatBarContainer->getRect().getHeight() );
- log(mNearbyChatBar, "after applying compensative width");
- lldebugs << buttons_freed_width << llendl;
+ S32 nearby_needed_width = mDesiredNearbyChatWidth - mNearbyChatBar->getRect().getWidth();
+ if (nearby_needed_width > 0)
+ {
+ S32 compensative_width = nearby_needed_width > buttons_freed_width ? buttons_freed_width : nearby_needed_width;
+ log(mNearbyChatBar, "before applying compensative width");
+ mChatBarContainer->reshape(mChatBarContainer->getRect().getWidth() + compensative_width, mChatBarContainer->getRect().getHeight() );
+ log(mNearbyChatBar, "after applying compensative width");
+ lldebugs << buttons_freed_width << llendl;
+ }
}
}
@@ -1070,18 +1091,12 @@ void LLBottomTray::processWidthIncreased(S32 delta_width)
const S32 chiclet_panel_width = mChicletPanel->getParent()->getRect().getWidth();
static const S32 chiclet_panel_min_width = mChicletPanel->getMinWidth();
- const S32 chatbar_panel_width = mChatBarContainer->getRect().getWidth();
- static const S32 chatbar_panel_min_width = get_panel_min_width(mToolbarStack, mChatBarContainer);
- static const S32 chatbar_panel_max_width = get_panel_max_width(mToolbarStack, mChatBarContainer);
-
- const S32 chatbar_available_shrink_width = chatbar_panel_width - chatbar_panel_min_width;
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 + chatbar_available_shrink_width + available_width_chiclet;
+ S32 total_available_width = delta_width + available_width_chiclet;
lldebugs << "Processing extending, available width:"
- << ", chatbar - " << chatbar_available_shrink_width
<< ", chiclets - " << available_width_chiclet
<< ", total - " << total_available_width
<< llendl;
@@ -1090,8 +1105,6 @@ void LLBottomTray::processWidthIncreased(S32 delta_width)
processShowButtons(available_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)
@@ -1102,21 +1115,7 @@ void LLBottomTray::processWidthIncreased(S32 delta_width)
// 1. use delta width of resizing
required_to_process_width -= delta_width;
- // 2. use width available via decreasing of nearby chat panel
- S32 chatbar_shrink_width = required_to_process_width;
- if (chatbar_available_shrink_width < chatbar_shrink_width)
- {
- chatbar_shrink_width = chatbar_available_shrink_width;
- }
-
- log(mNearbyChatBar, "increase width: before applying compensative width");
- mChatBarContainer->reshape(mChatBarContainer->getRect().getWidth() - chatbar_shrink_width, mChatBarContainer->getRect().getHeight() );
- if (mNearbyChatBar) log(mNearbyChatBar, "after applying compensative width");
- lldebugs << chatbar_shrink_width << llendl;
-
- // 3. use width available via decreasing of chiclet panel
- required_to_process_width -= chatbar_shrink_width;
-
+ // 2. use width available via decreasing of chiclet panel
if (required_to_process_width > 0)
{
mChicletPanel->getParent()->reshape(mChicletPanel->getParent()->getRect().getWidth() - required_to_process_width, mChicletPanel->getParent()->getRect().getHeight());
@@ -1132,9 +1131,9 @@ void LLBottomTray::processWidthIncreased(S32 delta_width)
// how many space can nearby chatbar take?
S32 chatbar_panel_width_ = mChatBarContainer->getRect().getWidth();
- if (delta_width > 0 && chatbar_panel_width_ < chatbar_panel_max_width)
+ if (delta_width > 0 && chatbar_panel_width_ < mDesiredNearbyChatWidth)
{
- S32 delta_panel_max = chatbar_panel_max_width - 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
@@ -1145,6 +1144,10 @@ void LLBottomTray::processWidthIncreased(S32 delta_width)
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)
@@ -1703,6 +1706,8 @@ void LLBottomTray::processChatbarCustomization(S32 new_width)
if (delta_width == 0) return;
+ 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();