summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim ProductEngine <vsavchuk@productengine.com>2011-03-03 20:49:42 +0200
committerVadim ProductEngine <vsavchuk@productengine.com>2011-03-03 20:49:42 +0200
commit0247cd6aebd85d578b14778f20866616ef3ab05f (patch)
tree3479e53b3bf21b03ae619e475312d71a95e2e6c6
parentaa72b0df03c1dfea7571eae4abed30ce9f269158 (diff)
STORM-236 FIXED Allow the "Speak" button to be removed, like other buttons.
Cumulative diff of changes made by Wolfpup, Richard and me. Description: * Ability to hide the Speak button with the bottom tray context menu. * Made the chat input resize handle visible, so that the feature is easily discoverable. * Applied Richard's fix to layout panel resizing logic.
-rw-r--r--doc/contributions.txt1
-rw-r--r--indra/llui/lllayoutstack.cpp10
-rw-r--r--indra/newview/llbottomtray.cpp58
-rw-r--r--indra/newview/llbottomtray.h8
-rw-r--r--indra/newview/skins/default/textures/bottomtray/ChatBarHandle.pngbin0 -> 2808 bytes
-rw-r--r--indra/newview/skins/default/textures/textures.xml1
-rw-r--r--indra/newview/skins/default/xui/en/menu_bottomtray.xml12
-rw-r--r--indra/newview/skins/default/xui/en/panel_bottomtray.xml35
8 files changed, 103 insertions, 22 deletions
diff --git a/doc/contributions.txt b/doc/contributions.txt
index 26d9b98b95..161f6c5454 100644
--- a/doc/contributions.txt
+++ b/doc/contributions.txt
@@ -831,6 +831,7 @@ WolfPup Lowenhar
STORM-102
STORM-103
STORM-143
+ STORM-236
STORM-255
STORM-256
STORM-288
diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp
index 19ac4c58a8..9b6830a816 100644
--- a/indra/llui/lllayoutstack.cpp
+++ b/indra/llui/lllayoutstack.cpp
@@ -563,7 +563,7 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
}
// update resize bars with new limits
- LLResizeBar* last_resize_bar = NULL;
+ LLLayoutPanel* last_resizeable_panel = NULL;
for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
{
LLPanel* panelp = (*panel_it);
@@ -585,17 +585,17 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
BOOL resize_bar_enabled = panelp->getVisible() && (*panel_it)->mUserResize;
(*panel_it)->mResizeBar->setVisible(resize_bar_enabled);
- if (resize_bar_enabled)
+ if ((*panel_it)->mUserResize || (*panel_it)->mAutoResize)
{
- last_resize_bar = (*panel_it)->mResizeBar;
+ last_resizeable_panel = (*panel_it);
}
}
// hide last resize bar as there is nothing past it
// resize bars need to be in between two resizable panels
- if (last_resize_bar)
+ if (last_resizeable_panel)
{
- last_resize_bar->setVisible(FALSE);
+ last_resizeable_panel->mResizeBar->setVisible(FALSE);
}
// not enough room to fit existing contents
diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp
index 35e4548483..4bafe70705 100644
--- a/indra/newview/llbottomtray.cpp
+++ b/indra/newview/llbottomtray.cpp
@@ -67,10 +67,14 @@ BOOL LLBottomtrayButton::handleHover(S32 x, S32 y, MASK mask)
{
if (mCanDrag)
{
- S32 screenX, screenY;
- localPointToScreen(x, y, &screenX, &screenY);
- // pass hover to bottomtray
- LLBottomTray::getInstance()->onDraggableButtonHover(screenX, screenY);
+ // pass hover to bottomtray
+ S32 screenX, screenY;
+ localPointToScreen(x, y, &screenX, &screenY);
+ LLBottomTray::getInstance()->onDraggableButtonHover(screenX, screenY);
+
+ // Reset cursor in case you move your mouse from the drag handle to a button.
+ getWindow()->setCursor(UI_CURSOR_ARROW);
+
return TRUE;
}
else
@@ -505,6 +509,22 @@ void LLBottomTray::showSnapshotButton(BOOL visible)
setTrayButtonVisibleIfPossible(RS_BUTTON_SNAPSHOT, visible);
}
+void LLBottomTray::showSpeakButton(bool visible)
+{
+ setTrayButtonVisible(RS_BUTTON_SPEAK, visible);
+
+ // Adjust other panels.
+ const S32 panel_width = mSpeakPanel->getRect().getWidth();
+ if (visible)
+ {
+ processWidthDecreased(-panel_width);
+ }
+ else
+ {
+ processWidthIncreased(panel_width);
+ }
+}
+
void LLBottomTray::toggleMovementControls()
{
if (mMovementButton)
@@ -698,6 +718,7 @@ void LLBottomTray::updateButtonsOrdersAfterDnD()
if (!landing_state_found) landing_state = RS_BUTTON_SPEAK;
mButtonsOrder.insert(std::find(mButtonsOrder.begin(), mButtonsOrder.end(), landing_state), dragged_state);
}
+
// Synchronize button process order with their order
resize_state_vec_t::const_iterator it1 = mButtonsOrder.begin();
const resize_state_vec_t::const_iterator it_end1 = mButtonsOrder.end();
@@ -774,11 +795,12 @@ void LLBottomTray::loadButtonsOrder()
// placing panels in layout stack according to button order which we loaded in previous for
for (resize_state_vec_t::const_reverse_iterator it = mButtonsOrder.rbegin(); it != it_end; ++it, ++i)
{
- LLPanel* panel_to_move = *it == RS_BUTTON_SPEAK ? mSpeakPanel : mStateProcessedObjectMap[*it];
+ LLPanel* panel_to_move = getButtonPanel(*it);
mToolbarStack->movePanel(panel_to_move, NULL, true); // prepend
}
// Nearbychat is not stored in order settings file, but it must be the first of the panels, so moving it
// manually here
+ mToolbarStack->movePanel(getChild<LLLayoutPanel>("chat_bar_resize_handle_panel"), NULL, true);
mToolbarStack->movePanel(mChatBarContainer, NULL, true);
}
@@ -1273,7 +1295,6 @@ void LLBottomTray::processShrinkButtons(S32& required_width, S32& buttons_freed_
// then shrink Speak button
if (required_width < 0)
{
-
S32 panel_min_width = 0;
std::string panel_name = mSpeakPanel->getName();
bool success = mToolbarStack->getPanelMinSize(panel_name, &panel_min_width);
@@ -1521,13 +1542,13 @@ void LLBottomTray::initResizeStateContainers()
// ... and add Speak button because it also can be shrunk.
mObjectDefaultWidthMap[RS_BUTTON_SPEAK] = mSpeakPanel->getRect().getWidth();
-
}
// this method must be called before restoring of the chat entry field on startup
// because it resets chatbar's width according to resize logic.
void LLBottomTray::initButtonsVisibility()
{
+ setVisibleAndFitWidths(RS_BUTTON_SPEAK, gSavedSettings.getBOOL("EnableVoiceChat"));
setVisibleAndFitWidths(RS_BUTTON_GESTURES, gSavedSettings.getBOOL("ShowGestureButton"));
setVisibleAndFitWidths(RS_BUTTON_MOVEMENT, gSavedSettings.getBOOL("ShowMoveButton"));
setVisibleAndFitWidths(RS_BUTTON_CAMERA, gSavedSettings.getBOOL("ShowCameraButton"));
@@ -1540,6 +1561,7 @@ void LLBottomTray::initButtonsVisibility()
void LLBottomTray::setButtonsControlsAndListeners()
{
+ gSavedSettings.getControl("EnableVoiceChat")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_SPEAK, _2));
gSavedSettings.getControl("ShowGestureButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_GESTURES, _2));
gSavedSettings.getControl("ShowMoveButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_MOVEMENT, _2));
gSavedSettings.getControl("ShowCameraButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_CAMERA, _2));
@@ -1568,8 +1590,7 @@ bool LLBottomTray::toggleShowButton(LLBottomTray::EResizeState button_type, cons
void LLBottomTray::setTrayButtonVisible(EResizeState shown_object_type, bool visible)
{
- llassert(mStateProcessedObjectMap[shown_object_type] != NULL);
- LLPanel* panel = mStateProcessedObjectMap[shown_object_type];
+ LLPanel* panel = getButtonPanel(shown_object_type);
if (NULL == panel)
{
lldebugs << "There is no object to show for state: " << shown_object_type << llendl;
@@ -1592,6 +1613,14 @@ void LLBottomTray::setTrayButtonVisibleIfPossible(EResizeState shown_object_type
bool LLBottomTray::setVisibleAndFitWidths(EResizeState object_type, bool visible)
{
+ // The Speak button is treated specially: if voice is enabled,
+ // the button should be displayed no matter how much space we've got.
+ if (object_type == RS_BUTTON_SPEAK)
+ {
+ showSpeakButton(visible);
+ return true;
+ }
+
LLPanel* cur_panel = mStateProcessedObjectMap[object_type];
if (NULL == cur_panel)
{
@@ -1695,6 +1724,17 @@ bool LLBottomTray::setVisibleAndFitWidths(EResizeState object_type, bool visible
return is_set;
}
+LLPanel* LLBottomTray::getButtonPanel(EResizeState button_type)
+{
+ if (button_type == RS_BUTTON_SPEAK)
+ {
+ return mSpeakPanel;
+ }
+
+ llassert(mStateProcessedObjectMap[button_type] != NULL);
+ return mStateProcessedObjectMap[button_type];
+}
+
void LLBottomTray::showWellButton(EResizeState object_type, bool visible)
{
llassert( ((RS_NOTIFICATION_WELL | RS_IM_WELL) & object_type) == object_type );
diff --git a/indra/newview/llbottomtray.h b/indra/newview/llbottomtray.h
index dc98170049..32d4968521 100644
--- a/indra/newview/llbottomtray.h
+++ b/indra/newview/llbottomtray.h
@@ -116,6 +116,7 @@ public:
void showMoveButton(BOOL visible);
void showCameraButton(BOOL visible);
void showSnapshotButton(BOOL visible);
+ void showSpeakButton(bool visible);
void toggleMovementControls();
void toggleCameraControls();
@@ -391,6 +392,11 @@ private:
bool setVisibleAndFitWidths(EResizeState object_type, bool visible);
/**
+ * Get panel containing the given button.
+ */
+ LLPanel* getButtonPanel(EResizeState button_type);
+
+ /**
* Shows/hides panel with specified well button (IM or Notification)
*
* @param[in] object_type - type of well button to be processed.
@@ -410,6 +416,7 @@ private:
void processChatbarCustomization(S32 new_width);
+ /// Buttons automatically hidden due to lack of space.
MASK mResizeState;
typedef std::map<EResizeState, LLPanel*> state_object_map_t;
@@ -424,6 +431,7 @@ private:
* Contains order in which child buttons should be processed in show/hide, extend/shrink methods.
*/
resize_state_vec_t mButtonsProcessOrder;
+
/**
* Contains order in which child buttons are shown.
* It traces order of all bottomtray buttons that may change place via drag'n'drop and should
diff --git a/indra/newview/skins/default/textures/bottomtray/ChatBarHandle.png b/indra/newview/skins/default/textures/bottomtray/ChatBarHandle.png
new file mode 100644
index 0000000000..8b58db0cba
--- /dev/null
+++ b/indra/newview/skins/default/textures/bottomtray/ChatBarHandle.png
Binary files differ
diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml
index 7b3cc7bdfa..cec2942b35 100644
--- a/indra/newview/skins/default/textures/textures.xml
+++ b/indra/newview/skins/default/textures/textures.xml
@@ -115,6 +115,7 @@ with the same filename but different name
<texture name="DisclosureArrow_Opened_Off" file_name="widgets/DisclosureArrow_Opened_Off.png" preload="true" />
+ <texture name="ChatBarHandle" file_name="bottomtray/ChatBarHandle.png" preload="false" />
<texture name="DownArrow" file_name="bottomtray/DownArrow.png" preload="false" />
<texture name="DownArrow_Off" file_name="icons/DownArrow_Off.png" preload="false" />
<texture name="Dragbar" file_name="windows/Dragbar.png" preload="false" scale.left="35" scale.top="5" scale.right="29" scale.bottom="5" />
diff --git a/indra/newview/skins/default/xui/en/menu_bottomtray.xml b/indra/newview/skins/default/xui/en/menu_bottomtray.xml
index 5beafef4e4..1b55fa4fd3 100644
--- a/indra/newview/skins/default/xui/en/menu_bottomtray.xml
+++ b/indra/newview/skins/default/xui/en/menu_bottomtray.xml
@@ -9,6 +9,18 @@
visible="false"
width="128">
<menu_item_check
+ label="Voice Enabled"
+ layout="topleft"
+ name="EnableVoiceChat">
+ <menu_item_check.on_click
+ function="ToggleControl"
+ parameter="EnableVoiceChat" />
+ <menu_item_check.on_check
+ function="CheckControl"
+ parameter="EnableVoiceChat" />
+ </menu_item_check>
+ <menu_item_separator/>
+ <menu_item_check
label="Gesture button"
layout="topleft"
name="ShowGestureButton">
diff --git a/indra/newview/skins/default/xui/en/panel_bottomtray.xml b/indra/newview/skins/default/xui/en/panel_bottomtray.xml
index 013a8090f7..a92cc886e7 100644
--- a/indra/newview/skins/default/xui/en/panel_bottomtray.xml
+++ b/indra/newview/skins/default/xui/en/panel_bottomtray.xml
@@ -45,11 +45,11 @@
min_width="214"
height="28"
mouse_opaque="false"
- name="chat_bar_layout_panel"
+ name="chat_bar_layout_panel"
user_resize="true"
- width="308" >
+ width="310" >
<panel
- name="chat_bar"
+ name="chat_bar"
filename="panel_nearby_chat_bar.xml"
left="0"
height="28"
@@ -60,11 +60,30 @@
/>
</layout_panel>
<!--
- There is resize bar between chatbar and Speak button. It has 2px width (is is set as 2*UIResizeBarOverlap)
+ This 5px Panel is an indicator of where the resize handle is.
+ The panel provides a gap between the resize handle icon and a button to the right.
-->
<layout_panel
auto_resize="false"
- follows="right"
+ layout="topleft"
+ max_width="5"
+ min_width="5"
+ name="chat_bar_resize_handle_panel"
+ user_resize="false"
+ width="5">
+ <icon
+ follows="top|right"
+ height="25"
+ image_name="ChatBarHandle"
+ layout="topleft"
+ left="-7"
+ name="resize_handle"
+ top="4"
+ width="5" />
+ </layout_panel>
+ <layout_panel
+ auto_resize="false"
+ follows="left|right"
height="28"
layout="topleft"
min_height="28"
@@ -72,13 +91,13 @@
mouse_opaque="false"
name="speak_panel"
top_delta="0"
- user_resize="true"
- width="110">
+ user_resize="false"
+ width="108">
<talk_button
follows="left|right"
height="23"
layout="topleft"
- left="2"
+ left="0"
name="talk"
top="5"
width="105">