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.cpp81
1 files changed, 43 insertions, 38 deletions
diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp
index 9320c3305f..9c8482c35d 100644
--- a/indra/newview/llbottomtray.cpp
+++ b/indra/newview/llbottomtray.cpp
@@ -41,6 +41,7 @@
#include "llagentcamera.h"
#include "llchiclet.h"
#include "llfloatercamera.h"
+#include "llhints.h"
#include "llimfloater.h" // for LLIMFloater
#include "llnearbychatbar.h"
#include "llspeakbutton.h"
@@ -104,10 +105,6 @@ template class LLBottomTray* LLSingleton<class LLBottomTray>::getInstance();
namespace
{
const std::string& PANEL_CHICLET_NAME = "chiclet_list_panel";
- const std::string& PANEL_CHATBAR_NAME = "chat_bar";
- const std::string& PANEL_MOVEMENT_NAME = "movement_panel";
- const std::string& PANEL_CAMERA_NAME = "cam_panel";
- const std::string& PANEL_GESTURE_NAME = "gesture_panel";
S32 get_panel_min_width(LLLayoutStack* stack, LLView* panel)
{
@@ -115,7 +112,7 @@ namespace
llassert(stack);
if ( stack && panel && panel->getVisible() )
{
- stack->getPanelMinSize(panel->getName(), &minimal_width, NULL);
+ stack->getPanelMinSize(panel->getName(), &minimal_width);
}
return minimal_width;
}
@@ -126,7 +123,7 @@ namespace
llassert(stack);
if ( stack && panel && panel->getVisible() )
{
- stack->getPanelMaxSize(panel->getName(), &max_width, NULL);
+ stack->getPanelMaxSize(panel->getName(), &max_width);
}
return max_width;
}
@@ -148,17 +145,19 @@ class LLBottomTrayLite
public:
LLBottomTrayLite()
: mNearbyChatBar(NULL),
+ mChatBarContainer(NULL),
mGesturePanel(NULL)
{
mFactoryMap["chat_bar"] = LLCallbackMap(LLBottomTray::createNearbyChatBar, NULL);
- LLUICtrlFactory::getInstance()->buildPanel(this, "panel_bottomtray_lite.xml");
+ buildFromFile("panel_bottomtray_lite.xml");
// Necessary for focus movement among child controls
setFocusRoot(TRUE);
}
BOOL postBuild()
{
- mNearbyChatBar = getChild<LLNearbyChatBar>("chat_bar");
+ mNearbyChatBar = findChild<LLNearbyChatBar>("chat_bar");
+ mChatBarContainer = getChild<LLLayoutPanel>("chat_bar_layout_panel");
mGesturePanel = getChild<LLPanel>("gesture_panel");
// Hide "show_nearby_chat" button
@@ -180,6 +179,7 @@ public:
}
LLNearbyChatBar* mNearbyChatBar;
+ LLLayoutPanel* mChatBarContainer;
LLPanel* mGesturePanel;
};
@@ -188,17 +188,18 @@ LLBottomTray::LLBottomTray(const LLSD&)
mSpeakPanel(NULL),
mSpeakBtn(NULL),
mNearbyChatBar(NULL),
- mToolbarStack(NULL)
-, mMovementButton(NULL)
-, mResizeState(RS_NORESIZE)
-, mBottomTrayContextMenu(NULL)
-, mCamButton(NULL)
-, mBottomTrayLite(NULL)
-, mIsInLiteMode(false)
-, mDragStarted(false)
-, mDraggedItem(NULL)
-, mLandingTab(NULL)
-, mCheckForDrag(false)
+ mChatBarContainer(NULL),
+ mToolbarStack(NULL),
+ mMovementButton(NULL),
+ mResizeState(RS_NORESIZE),
+ mBottomTrayContextMenu(NULL),
+ mCamButton(NULL),
+ mBottomTrayLite(NULL),
+ mIsInLiteMode(false),
+ mDragStarted(false),
+ mDraggedItem(NULL),
+ mLandingTab(NULL),
+ mCheckForDrag(false)
{
// Firstly add ourself to IMSession observers, so we catch session events
// before chiclets do that.
@@ -206,7 +207,7 @@ LLBottomTray::LLBottomTray(const LLSD&)
mFactoryMap["chat_bar"] = LLCallbackMap(LLBottomTray::createNearbyChatBar, NULL);
- LLUICtrlFactory::getInstance()->buildPanel(this,"panel_bottomtray.xml");
+ buildFromFile("panel_bottomtray.xml");
LLUICtrl::CommitCallbackRegistry::defaultRegistrar().add("CameraPresets.ChangeView", boost::bind(&LLFloaterCamera::onClickCameraItem, _2));
@@ -238,7 +239,7 @@ LLBottomTray::~LLBottomTray()
if (mNearbyChatBar)
{
// store custom width of chatbar panel.
- S32 custom_width = mNearbyChatBar->getRect().getWidth();
+ S32 custom_width = mChatBarContainer->getRect().getWidth();
gSavedSettings.setS32("ChatBarCustomWidth", custom_width);
}
@@ -433,7 +434,7 @@ S32 LLBottomTray::notifyParent(const LLSD& info)
const std::string& name = info["view_name"];
// expected only resize of nearby chatbar
- if (mNearbyChatBar->getName() != name) return LLPanel::notifyParent(info);
+ if (mChatBarContainer->getName() != name) return LLPanel::notifyParent(info);
const S32 new_width = info["new_width"];
@@ -463,8 +464,8 @@ void LLBottomTray::updateContextMenu(S32 x, S32 y, MASK mask)
{
LLUICtrl* edit_box = mNearbyChatBar->getChild<LLUICtrl>("chat_box");
- S32 local_x = x - mNearbyChatBar->getRect().mLeft - edit_box->getRect().mLeft;
- S32 local_y = y - mNearbyChatBar->getRect().mBottom - edit_box->getRect().mBottom;
+ S32 local_x = x - mChatBarContainer->getRect().mLeft - edit_box->getRect().mLeft;
+ S32 local_y = y - mChatBarContainer->getRect().mBottom - edit_box->getRect().mBottom;
bool in_edit_box = edit_box->pointInView(local_x, local_y);
@@ -517,10 +518,14 @@ BOOL LLBottomTray::postBuild()
mBottomTrayContextMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_bottomtray.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
gMenuHolder->addChild(mBottomTrayContextMenu);
+ mNearbyChatBar = findChild<LLNearbyChatBar>("chat_bar");
+ LLHints::registerHintTarget("chat_bar", mNearbyChatBar->LLView::getHandle());
+
+ mChatBarContainer = getChild<LLLayoutPanel>("chat_bar_layout_panel");
- mNearbyChatBar = getChild<LLNearbyChatBar>("chat_bar");
mToolbarStack = getChild<LLLayoutStack>("toolbar_stack");
mMovementButton = getChild<LLButton>("movement_btn");
+ LLHints::registerHintTarget("move_btn", mMovementButton->getHandle());
mCamButton = getChild<LLButton>("camera_btn");
setRightMouseDownCallback(boost::bind(&LLBottomTray::showBottomTrayContextMenu,this, _2, _3,_4));
@@ -962,7 +967,7 @@ void LLBottomTray::reshape(S32 width, S32 height, BOOL called_from_parent)
// we can not to do this from postBuild because reshape is called from parent view on startup
// creation after it and reset width according to resize logic.
static bool needs_restore_custom_state = true;
- if (mNearbyChatBar && needs_restore_custom_state)
+ if (mChatBarContainer && needs_restore_custom_state)
{
// restore custom width of chatbar panel.
S32 new_width = gSavedSettings.getS32("ChatBarCustomWidth");
@@ -970,7 +975,7 @@ void LLBottomTray::reshape(S32 width, S32 height, BOOL called_from_parent)
{
mDesiredNearbyChatWidth = new_width;
processChatbarCustomization(new_width);
- mNearbyChatBar->reshape(new_width, mNearbyChatBar->getRect().getHeight());
+ mChatBarContainer->reshape(new_width, mChatBarContainer->getRect().getHeight());
}
needs_restore_custom_state = false;
}
@@ -1020,7 +1025,7 @@ S32 LLBottomTray::processWidthDecreased(S32 delta_width)
}
// 3. Decreasing width of nearby chat.
const S32 chatbar_panel_min_width = get_panel_min_width(mToolbarStack, mNearbyChatBar);
- const S32 chatbar_panel_width = mNearbyChatBar->getRect().getWidth();
+ 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
@@ -1036,7 +1041,7 @@ S32 LLBottomTray::processWidthDecreased(S32 delta_width)
// chatbar should only be shrunk here, not stretched
if(delta_panel > 0)
{
- mNearbyChatBar->reshape(mNearbyChatBar->getRect().getWidth() - delta_panel, mNearbyChatBar->getRect().getHeight());
+ mChatBarContainer->reshape(mNearbyChatBar->getRect().getWidth() - delta_panel, mChatBarContainer->getRect().getHeight());
}
log(mNearbyChatBar, "after processing panel decreasing via nearby chatbar panel");
@@ -1067,7 +1072,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");
- mNearbyChatBar->reshape(mNearbyChatBar->getRect().getWidth() + compensative_width, mNearbyChatBar->getRect().getHeight() );
+ mChatBarContainer->reshape(mChatBarContainer->getRect().getWidth() + compensative_width, mChatBarContainer->getRect().getHeight() );
log(mNearbyChatBar, "after applying compensative width");
lldebugs << buttons_freed_width << llendl;
}
@@ -1123,7 +1128,7 @@ void LLBottomTray::processWidthIncreased(S32 delta_width)
// how many space can nearby chatbar take?
- S32 chatbar_panel_width_ = mNearbyChatBar->getRect().getWidth();
+ S32 chatbar_panel_width_ = mChatBarContainer->getRect().getWidth();
if (delta_width > 0 && chatbar_panel_width_ < mDesiredNearbyChatWidth)
{
S32 delta_panel_max = mDesiredNearbyChatWidth - chatbar_panel_width_;
@@ -1134,7 +1139,7 @@ void LLBottomTray::processWidthIncreased(S32 delta_width)
<< llendl;
delta_width -= delta_panel_max;
- mNearbyChatBar->reshape(chatbar_panel_width_ + delta_panel, mNearbyChatBar->getRect().getHeight());
+ mChatBarContainer->reshape(chatbar_panel_width_ + delta_panel, mChatBarContainer->getRect().getHeight());
log(mNearbyChatBar, "applied unprocessed delta width");
}
if (delta_width > 0)
@@ -1260,7 +1265,7 @@ void LLBottomTray::processShrinkButtons(S32& required_width, S32& buttons_freed_
S32 panel_min_width = 0;
std::string panel_name = mSpeakPanel->getName();
- bool success = mToolbarStack->getPanelMinSize(panel_name, &panel_min_width, NULL);
+ bool success = mToolbarStack->getPanelMinSize(panel_name, &panel_min_width);
if (!success)
{
lldebugs << "Panel was not found to get its min width: " << panel_name << llendl;
@@ -1306,7 +1311,7 @@ void LLBottomTray::processShrinkButton(EResizeState processed_object_type, S32&
S32 panel_width = panel->getRect().getWidth();
S32 panel_min_width = 0;
std::string panel_name = panel->getName();
- bool success = mToolbarStack->getPanelMinSize(panel_name, &panel_min_width, NULL);
+ bool success = mToolbarStack->getPanelMinSize(panel_name, &panel_min_width);
S32 possible_shrink_width = panel_width - panel_min_width;
if (!success)
@@ -1598,7 +1603,7 @@ bool LLBottomTray::setVisibleAndFitWidths(EResizeState object_type, bool visible
{
// Calculate the possible shrunk width as difference between current and minimal widths
const S32 chatbar_shrunk_width =
- mNearbyChatBar->getRect().getWidth() - get_panel_min_width(mToolbarStack, mNearbyChatBar);
+ mChatBarContainer->getRect().getWidth() - get_panel_min_width(mToolbarStack, mChatBarContainer);
S32 sum_of_min_widths = get_panel_min_width(mToolbarStack, mSpeakPanel);
S32 sum_of_curr_widths = get_curr_width(mSpeakPanel);
@@ -1618,7 +1623,7 @@ bool LLBottomTray::setVisibleAndFitWidths(EResizeState object_type, bool visible
// Minimal width of current panel
S32 minimal_width = 0;
- mToolbarStack->getPanelMinSize(cur_panel->getName(), &minimal_width, NULL);
+ mToolbarStack->getPanelMinSize(cur_panel->getName(), &minimal_width);
if ( (available_width + possible_shrunk_width) >= minimal_width)
{
@@ -1695,10 +1700,10 @@ void LLBottomTray::processChatbarCustomization(S32 new_width)
{
if (NULL == mNearbyChatBar) return;
- const S32 delta_width = mNearbyChatBar->getRect().getWidth() - new_width;
+ const S32 delta_width = mChatBarContainer->getRect().getWidth() - new_width;
if (delta_width == 0) return;
-
+
mDesiredNearbyChatWidth = new_width;
LLView * chiclet_layout_panel = mChicletPanel->getParent();