summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormaksymsproductengine <maksymsproductengine@lindenlab.com>2013-09-26 00:34:00 +0300
committermaksymsproductengine <maksymsproductengine@lindenlab.com>2013-09-26 00:34:00 +0300
commit01a70022280c12173f12352b145670e06efb3d71 (patch)
treede6ef7d858ab66431dbd40cd901e9f45a71406c8
parent2e5e03b73a5bc581097c9b5828537796568aa2e3 (diff)
MAINT-3163 FIXED Since CHUI, floaters can be moved totally underneath bottom toolbar buttons and "lost".
-rwxr-xr-xindra/llui/llfloater.cpp31
-rwxr-xr-xindra/llui/llfloater.h6
-rwxr-xr-xindra/llui/lltoolbar.cpp26
-rwxr-xr-xindra/llui/lltoolbar.h39
-rwxr-xr-xindra/newview/llfloatertoybox.cpp8
-rwxr-xr-xindra/newview/llimview.cpp4
-rwxr-xr-xindra/newview/llmoveview.cpp4
-rwxr-xr-xindra/newview/lltoolbarview.cpp82
-rwxr-xr-xindra/newview/lltoolbarview.h21
-rwxr-xr-xindra/newview/llviewerwindow.cpp8
10 files changed, 158 insertions, 71 deletions
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 6e6bcd6ab5..c1f8a077b5 100755
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -2742,8 +2742,6 @@ void LLFloaterView::refresh()
}
}
-const S32 FLOATER_MIN_VISIBLE_PIXELS = 16;
-
void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_outside, BOOL snap_in_toolbars/* = false*/)
{
if (floater->getParent() != this)
@@ -2796,11 +2794,32 @@ void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_out
}
}
+ const LLRect& left_toolbar_rect = mToolbarRects[LLToolBarEnums::TOOLBAR_LEFT];
+ const LLRect& bottom_toolbar_rect = mToolbarRects[LLToolBarEnums::TOOLBAR_BOTTOM];
+ const LLRect& right_toolbar_rect = mToolbarRects[LLToolBarEnums::TOOLBAR_RIGHT];
+ const LLRect& floater_rect = floater->getRect();
+
+ S32 delta_left = left_toolbar_rect.notEmpty() ? left_toolbar_rect.mRight - floater_rect.mRight : 0;
+ S32 delta_bottom = bottom_toolbar_rect.notEmpty() ? bottom_toolbar_rect.mTop - floater_rect.mTop : 0;
+ S32 delta_right = right_toolbar_rect.notEmpty() ? right_toolbar_rect.mLeft - floater_rect.mLeft : 0;
+
// move window fully onscreen
if (floater->translateIntoRect( snap_in_toolbars ? getSnapRect() : gFloaterView->getRect(), allow_partial_outside ? FLOATER_MIN_VISIBLE_PIXELS : S32_MAX ))
{
floater->clearSnapTarget();
}
+ else if (delta_left > 0 && floater_rect.mTop < left_toolbar_rect.mTop && floater_rect.mBottom > left_toolbar_rect.mBottom)
+ {
+ floater->translate(delta_left, 0);
+ }
+ else if (delta_bottom > 0 && floater_rect.mLeft > bottom_toolbar_rect.mLeft && floater_rect.mRight < bottom_toolbar_rect.mRight)
+ {
+ floater->translate(0, delta_bottom);
+ }
+ else if (delta_right < 0 && floater_rect.mTop < right_toolbar_rect.mTop && floater_rect.mBottom > right_toolbar_rect.mBottom)
+ {
+ floater->translate(delta_right, 0);
+ }
}
void LLFloaterView::draw()
@@ -3000,6 +3019,14 @@ void LLFloaterView::popVisibleAll(const skip_list_t& skip_list)
LLFloaterReg::blockShowFloaters(false);
}
+void LLFloaterView::setToolbarRect(LLToolBarEnums::EToolBarLocation tb, const LLRect& toolbar_rect)
+{
+ if (tb < LLToolBarEnums::TOOLBAR_COUNT)
+ {
+ mToolbarRects[tb] = toolbar_rect;
+ }
+}
+
void LLFloater::setInstanceName(const std::string& name)
{
if (name != mInstanceName)
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index 75715ef296..ccaae1d02b 100755
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -32,6 +32,7 @@
#define LL_FLOATER_H
#include "llpanel.h"
+#include "lltoolbar.h"
#include "lluuid.h"
//#include "llnotificationsutil.h"
#include <set>
@@ -514,6 +515,8 @@ private:
// LLFloaterView
// Parent of all floating panels
+const S32 FLOATER_MIN_VISIBLE_PIXELS = 16;
+
class LLFloaterView : public LLUICtrl
{
public:
@@ -572,10 +575,13 @@ public:
void setFloaterSnapView(LLHandle<LLView> snap_view) {mSnapView = snap_view; }
LLFloater* getFrontmostClosableFloater();
+ void setToolbarRect(LLToolBarEnums::EToolBarLocation tb, const LLRect& toolbar_rect);
+
private:
void hiddenFloaterClosed(LLFloater* floater);
LLRect mLastSnapRect;
+ LLRect mToolbarRects[LLToolBarEnums::TOOLBAR_COUNT];
LLHandle<LLView> mSnapView;
BOOL mFocusCycleMode;
S32 mSnapOffsetBottom;
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index 6bfe113933..e692d9847a 100755
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -118,7 +118,8 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p)
mButtonLeaveSignal(NULL),
mButtonRemoveSignal(NULL),
mDragAndDropTarget(false),
- mCaretIcon(NULL)
+ mCaretIcon(NULL),
+ mCenterPanel(NULL)
{
mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_WITH_TEXT] = p.button_icon_and_text;
mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_ONLY] = p.button_icon;
@@ -200,14 +201,15 @@ void LLToolBar::initFromParams(const LLToolBar::Params& p)
center_panel_p.auto_resize = false;
center_panel_p.user_resize = false;
center_panel_p.mouse_opaque = false;
- LLLayoutPanel* center_panel = LLUICtrlFactory::create<LLLayoutPanel>(center_panel_p);
- mCenteringStack->addChild(center_panel);
+ mCenterPanel = LLUICtrlFactory::create<LLCenterLayoutPanel>(center_panel_p);
+ mCenteringStack->addChild(mCenterPanel);
LLPanel::Params button_panel_p(p.button_panel);
- button_panel_p.rect = center_panel->getLocalRect();
- button_panel_p.follows.flags = FOLLOWS_BOTTOM|FOLLOWS_LEFT;
+ button_panel_p.rect = mCenterPanel->getLocalRect();
+ button_panel_p.follows.flags = FOLLOWS_BOTTOM|FOLLOWS_LEFT;
mButtonPanel = LLUICtrlFactory::create<LLPanel>(button_panel_p);
- center_panel->addChild(mButtonPanel);
+ mCenterPanel->setButtonPanel(mButtonPanel);
+ mCenterPanel->addChild(mButtonPanel);
mCenteringStack->addChild(LLUICtrlFactory::create<LLLayoutPanel>(border_panel_p));
@@ -1244,3 +1246,15 @@ const std::string LLToolBarButton::getToolTip() const
return tooltip;
}
+void LLToolBar::LLCenterLayoutPanel::handleReshape(const LLRect& rect, bool by_user)
+{
+ LLLayoutPanel::handleReshape(rect, by_user);
+
+ if (!mReshapeCallback.empty())
+ {
+ LLRect r;
+ localRectToOtherView(mButtonPanel->getRect(), &r, gFloaterView);
+ r.stretch(FLOATER_MIN_VISIBLE_PIXELS);
+ mReshapeCallback(mLocationId, r);
+ }
+}
diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h
index 743951a41f..9e17eaed8b 100755
--- a/indra/llui/lltoolbar.h
+++ b/indra/llui/lltoolbar.h
@@ -125,6 +125,19 @@ namespace LLToolBarEnums
SIDE_TOP,
};
+ enum EToolBarLocation
+ {
+ TOOLBAR_NONE = 0,
+ TOOLBAR_LEFT,
+ TOOLBAR_RIGHT,
+ TOOLBAR_BOTTOM,
+
+ TOOLBAR_COUNT,
+
+ TOOLBAR_FIRST = TOOLBAR_LEFT,
+ TOOLBAR_LAST = TOOLBAR_BOTTOM,
+ };
+
LLLayoutStack::ELayoutOrientation getOrientation(SideType sideType);
}
@@ -150,6 +163,30 @@ class LLToolBar
{
friend class LLToolBarButton;
public:
+
+ class LLCenterLayoutPanel : public LLLayoutPanel
+ {
+ public:
+ typedef struct LLLayoutPanel::Params Params;
+ typedef boost::function<void(LLToolBarEnums::EToolBarLocation tb, const LLRect& rect)> reshape_callback_t;
+
+ virtual ~LLCenterLayoutPanel() {}
+ /*virtual*/ void handleReshape(const LLRect& rect, bool by_user);
+
+ void setLocationId(LLToolBarEnums::EToolBarLocation id) { mLocationId = id; }
+ void setReshapeCallback(reshape_callback_t cb) { mReshapeCallback = cb; }
+ void setButtonPanel(LLPanel * panel) { mButtonPanel = panel; }
+
+ protected:
+ friend class LLUICtrlFactory;
+ LLCenterLayoutPanel(const Params& params) : LLLayoutPanel(params), mButtonPanel(NULL) {}
+
+ private:
+ reshape_callback_t mReshapeCallback;
+ LLToolBarEnums::EToolBarLocation mLocationId;
+ LLPanel * mButtonPanel;
+ };
+
struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
{
Mandatory<LLToolBarEnums::ButtonType> button_display_mode;
@@ -198,6 +235,7 @@ public:
void setHandleDragCallback(tool_handledrag_callback_t cb) { mHandleDragItemCallback = cb; }
void setHandleDropCallback(tool_handledrop_callback_t cb) { mHandleDropCallback = cb; }
bool isReadOnly() const { return mReadOnly; }
+ LLCenterLayoutPanel * getCenterLayoutPanel() const { return mCenterPanel; }
LLToolBarButton* createButton(const LLCommandId& id);
@@ -270,6 +308,7 @@ private:
// related widgets
LLLayoutStack* mCenteringStack;
+ LLCenterLayoutPanel* mCenterPanel;
LLPanel* mButtonPanel;
LLHandle<class LLContextMenu> mPopupMenuHandle;
LLHandle<class LLView> mRemoveButtonHandle;
diff --git a/indra/newview/llfloatertoybox.cpp b/indra/newview/llfloatertoybox.cpp
index 324afe661f..a025a859e7 100755
--- a/indra/newview/llfloatertoybox.cpp
+++ b/indra/newview/llfloatertoybox.cpp
@@ -107,7 +107,7 @@ void LLFloaterToybox::draw()
{
const LLCommandId& id = *it;
- const bool command_not_present = (gToolBarView->hasCommand(id) == LLToolBarView::TOOLBAR_NONE);
+ const bool command_not_present = (gToolBarView->hasCommand(id) == LLToolBarEnums::TOOLBAR_NONE);
mToolBar->enableCommand(id, command_not_present);
}
@@ -175,9 +175,9 @@ void LLFloaterToybox::onToolBarButtonEnter(LLView* button)
switch(command_loc)
{
- case LLToolBarView::TOOLBAR_BOTTOM: suffix = LLTrans::getString("Toolbar_Bottom_Tooltip"); break;
- case LLToolBarView::TOOLBAR_LEFT: suffix = LLTrans::getString("Toolbar_Left_Tooltip"); break;
- case LLToolBarView::TOOLBAR_RIGHT: suffix = LLTrans::getString("Toolbar_Right_Tooltip"); break;
+ case LLToolBarEnums::TOOLBAR_BOTTOM: suffix = LLTrans::getString("Toolbar_Bottom_Tooltip"); break;
+ case LLToolBarEnums::TOOLBAR_LEFT: suffix = LLTrans::getString("Toolbar_Left_Tooltip"); break;
+ case LLToolBarEnums::TOOLBAR_RIGHT: suffix = LLTrans::getString("Toolbar_Right_Tooltip"); break;
default:
break;
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 9ffbd1a675..70ffdc14ff 100755
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -1959,11 +1959,11 @@ LLDockControl::DocAt LLCallDialog::getDockControlPos(const std::string& toolbarB
switch (toolbar_loc)
{
- case LLToolBarView::TOOLBAR_LEFT:
+ case LLToolBarEnums::TOOLBAR_LEFT:
doc_at = LLDockControl::RIGHT;
break;
- case LLToolBarView::TOOLBAR_RIGHT:
+ case LLToolBarEnums::TOOLBAR_RIGHT:
doc_at = LLDockControl::LEFT;
break;
}
diff --git a/indra/newview/llmoveview.cpp b/indra/newview/llmoveview.cpp
index eb6591eb39..055ec241c5 100755
--- a/indra/newview/llmoveview.cpp
+++ b/indra/newview/llmoveview.cpp
@@ -698,14 +698,14 @@ void LLPanelStandStopFlying::updatePosition()
S32 y_pos = 0;
S32 bottom_tb_center = 0;
- if (LLToolBar* toolbar_bottom = gToolBarView->getToolbar(LLToolBarView::TOOLBAR_BOTTOM))
+ if (LLToolBar* toolbar_bottom = gToolBarView->getToolbar(LLToolBarEnums::TOOLBAR_BOTTOM))
{
y_pos = toolbar_bottom->getRect().getHeight();
bottom_tb_center = toolbar_bottom->getRect().getCenterX();
}
S32 left_tb_width = 0;
- if (LLToolBar* toolbar_left = gToolBarView->getToolbar(LLToolBarView::TOOLBAR_LEFT))
+ if (LLToolBar* toolbar_left = gToolBarView->getToolbar(LLToolBarEnums::TOOLBAR_LEFT))
{
left_tb_width = toolbar_left->getRect().getWidth();
}
diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp
index 78a555d67d..36d4654393 100755
--- a/indra/newview/lltoolbarview.cpp
+++ b/indra/newview/lltoolbarview.cpp
@@ -77,7 +77,7 @@ LLToolBarView::LLToolBarView(const LLToolBarView::Params& p)
mToolbarsLoaded(false),
mBottomToolbarPanel(NULL)
{
- for (S32 i = 0; i < TOOLBAR_COUNT; i++)
+ for (S32 i = 0; i < LLToolBarEnums::TOOLBAR_COUNT; i++)
{
mToolbars[i] = NULL;
}
@@ -96,12 +96,18 @@ LLToolBarView::~LLToolBarView()
BOOL LLToolBarView::postBuild()
{
- mToolbars[TOOLBAR_LEFT] = getChild<LLToolBar>("toolbar_left");
- mToolbars[TOOLBAR_RIGHT] = getChild<LLToolBar>("toolbar_right");
- mToolbars[TOOLBAR_BOTTOM] = getChild<LLToolBar>("toolbar_bottom");
+ mToolbars[LLToolBarEnums::TOOLBAR_LEFT] = getChild<LLToolBar>("toolbar_left");
+ mToolbars[LLToolBarEnums::TOOLBAR_LEFT]->getCenterLayoutPanel()->setLocationId(LLToolBarEnums::TOOLBAR_LEFT);
+
+ mToolbars[LLToolBarEnums::TOOLBAR_RIGHT] = getChild<LLToolBar>("toolbar_right");
+ mToolbars[LLToolBarEnums::TOOLBAR_RIGHT]->getCenterLayoutPanel()->setLocationId(LLToolBarEnums::TOOLBAR_RIGHT);
+
+ mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM] = getChild<LLToolBar>("toolbar_bottom");
+ mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM]->getCenterLayoutPanel()->setLocationId(LLToolBarEnums::TOOLBAR_BOTTOM);
+
mBottomToolbarPanel = getChild<LLView>("bottom_toolbar_panel");
- for (int i = TOOLBAR_FIRST; i <= TOOLBAR_LAST; i++)
+ for (int i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++)
{
mToolbars[i]->setStartDragCallback(boost::bind(LLToolBarView::startDragTool,_1,_2,_3));
mToolbars[i]->setHandleDragCallback(boost::bind(LLToolBarView::handleDragTool,_1,_2,_3,_4));
@@ -115,9 +121,9 @@ BOOL LLToolBarView::postBuild()
S32 LLToolBarView::hasCommand(const LLCommandId& commandId) const
{
- S32 command_location = TOOLBAR_NONE;
+ S32 command_location = LLToolBarEnums::TOOLBAR_NONE;
- for (S32 loc = TOOLBAR_FIRST; loc <= TOOLBAR_LAST; loc++)
+ for (S32 loc = LLToolBarEnums::TOOLBAR_FIRST; loc <= LLToolBarEnums::TOOLBAR_LAST; loc++)
{
if (mToolbars[loc]->hasCommand(commandId))
{
@@ -129,7 +135,7 @@ S32 LLToolBarView::hasCommand(const LLCommandId& commandId) const
return command_location;
}
-S32 LLToolBarView::addCommand(const LLCommandId& commandId, EToolBarLocation toolbar, int rank)
+S32 LLToolBarView::addCommand(const LLCommandId& commandId, LLToolBarEnums::EToolBarLocation toolbar, int rank)
{
int old_rank;
removeCommand(commandId, old_rank);
@@ -144,7 +150,7 @@ S32 LLToolBarView::removeCommand(const LLCommandId& commandId, int& rank)
S32 command_location = hasCommand(commandId);
rank = LLToolBar::RANK_NONE;
- if (command_location != TOOLBAR_NONE)
+ if (command_location != LLToolBarEnums::TOOLBAR_NONE)
{
rank = mToolbars[command_location]->removeCommand(commandId);
}
@@ -156,7 +162,7 @@ S32 LLToolBarView::enableCommand(const LLCommandId& commandId, bool enabled)
{
S32 command_location = hasCommand(commandId);
- if (command_location != TOOLBAR_NONE)
+ if (command_location != LLToolBarEnums::TOOLBAR_NONE)
{
mToolbars[command_location]->enableCommand(commandId, enabled);
}
@@ -168,7 +174,7 @@ S32 LLToolBarView::stopCommandInProgress(const LLCommandId& commandId)
{
S32 command_location = hasCommand(commandId);
- if (command_location != TOOLBAR_NONE)
+ if (command_location != LLToolBarEnums::TOOLBAR_NONE)
{
mToolbars[command_location]->stopCommandInProgress(commandId);
}
@@ -180,7 +186,7 @@ S32 LLToolBarView::flashCommand(const LLCommandId& commandId, bool flash, bool f
{
S32 command_location = hasCommand(commandId);
- if (command_location != TOOLBAR_NONE)
+ if (command_location != LLToolBarEnums::TOOLBAR_NONE)
{
mToolbars[command_location]->flashCommand(commandId, flash, force_flashing);
}
@@ -259,7 +265,7 @@ bool LLToolBarView::loadToolbars(bool force_default)
}
// Clear the toolbars now before adding the loaded commands and settings
- for (S32 i = TOOLBAR_FIRST; i <= TOOLBAR_LAST; i++)
+ for (S32 i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++)
{
if (mToolbars[i])
{
@@ -268,46 +274,46 @@ bool LLToolBarView::loadToolbars(bool force_default)
}
// Add commands to each toolbar
- if (toolbar_set.left_toolbar.isProvided() && mToolbars[TOOLBAR_LEFT])
+ if (toolbar_set.left_toolbar.isProvided() && mToolbars[LLToolBarEnums::TOOLBAR_LEFT])
{
if (toolbar_set.left_toolbar.button_display_mode.isProvided())
{
LLToolBarEnums::ButtonType button_type = toolbar_set.left_toolbar.button_display_mode;
- mToolbars[TOOLBAR_LEFT]->setButtonType(button_type);
+ mToolbars[LLToolBarEnums::TOOLBAR_LEFT]->setButtonType(button_type);
}
BOOST_FOREACH(const LLCommandId::Params& command_params, toolbar_set.left_toolbar.commands)
{
- if (addCommandInternal(LLCommandId(command_params), mToolbars[TOOLBAR_LEFT]))
+ if (addCommandInternal(LLCommandId(command_params), mToolbars[LLToolBarEnums::TOOLBAR_LEFT]))
{
llwarns << "Error adding command '" << command_params.name() << "' to left toolbar." << llendl;
}
}
}
- if (toolbar_set.right_toolbar.isProvided() && mToolbars[TOOLBAR_RIGHT])
+ if (toolbar_set.right_toolbar.isProvided() && mToolbars[LLToolBarEnums::TOOLBAR_RIGHT])
{
if (toolbar_set.right_toolbar.button_display_mode.isProvided())
{
LLToolBarEnums::ButtonType button_type = toolbar_set.right_toolbar.button_display_mode;
- mToolbars[TOOLBAR_RIGHT]->setButtonType(button_type);
+ mToolbars[LLToolBarEnums::TOOLBAR_RIGHT]->setButtonType(button_type);
}
BOOST_FOREACH(const LLCommandId::Params& command_params, toolbar_set.right_toolbar.commands)
{
- if (addCommandInternal(LLCommandId(command_params), mToolbars[TOOLBAR_RIGHT]))
+ if (addCommandInternal(LLCommandId(command_params), mToolbars[LLToolBarEnums::TOOLBAR_RIGHT]))
{
llwarns << "Error adding command '" << command_params.name() << "' to right toolbar." << llendl;
}
}
}
- if (toolbar_set.bottom_toolbar.isProvided() && mToolbars[TOOLBAR_BOTTOM])
+ if (toolbar_set.bottom_toolbar.isProvided() && mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM])
{
if (toolbar_set.bottom_toolbar.button_display_mode.isProvided())
{
LLToolBarEnums::ButtonType button_type = toolbar_set.bottom_toolbar.button_display_mode;
- mToolbars[TOOLBAR_BOTTOM]->setButtonType(button_type);
+ mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM]->setButtonType(button_type);
}
BOOST_FOREACH(const LLCommandId::Params& command_params, toolbar_set.bottom_toolbar.commands)
{
- if (addCommandInternal(LLCommandId(command_params), mToolbars[TOOLBAR_BOTTOM]))
+ if (addCommandInternal(LLCommandId(command_params), mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM]))
{
llwarns << "Error adding command '" << command_params.name() << "' to bottom toolbar." << llendl;
}
@@ -319,7 +325,7 @@ bool LLToolBarView::loadToolbars(bool force_default)
bool LLToolBarView::clearToolbars()
{
- for (S32 i = TOOLBAR_FIRST; i <= TOOLBAR_LAST; i++)
+ for (S32 i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++)
{
if (mToolbars[i])
{
@@ -371,20 +377,20 @@ void LLToolBarView::saveToolbars() const
// Build the parameter tree from the toolbar data
LLToolBarView::ToolbarSet toolbar_set;
- if (mToolbars[TOOLBAR_LEFT])
+ if (mToolbars[LLToolBarEnums::TOOLBAR_LEFT])
{
- toolbar_set.left_toolbar.button_display_mode = mToolbars[TOOLBAR_LEFT]->getButtonType();
- addToToolset(mToolbars[TOOLBAR_LEFT]->getCommandsList(), toolbar_set.left_toolbar);
+ toolbar_set.left_toolbar.button_display_mode = mToolbars[LLToolBarEnums::TOOLBAR_LEFT]->getButtonType();
+ addToToolset(mToolbars[LLToolBarEnums::TOOLBAR_LEFT]->getCommandsList(), toolbar_set.left_toolbar);
}
- if (mToolbars[TOOLBAR_RIGHT])
+ if (mToolbars[LLToolBarEnums::TOOLBAR_RIGHT])
{
- toolbar_set.right_toolbar.button_display_mode = mToolbars[TOOLBAR_RIGHT]->getButtonType();
- addToToolset(mToolbars[TOOLBAR_RIGHT]->getCommandsList(), toolbar_set.right_toolbar);
+ toolbar_set.right_toolbar.button_display_mode = mToolbars[LLToolBarEnums::TOOLBAR_RIGHT]->getButtonType();
+ addToToolset(mToolbars[LLToolBarEnums::TOOLBAR_RIGHT]->getCommandsList(), toolbar_set.right_toolbar);
}
- if (mToolbars[TOOLBAR_BOTTOM])
+ if (mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM])
{
- toolbar_set.bottom_toolbar.button_display_mode = mToolbars[TOOLBAR_BOTTOM]->getButtonType();
- addToToolset(mToolbars[TOOLBAR_BOTTOM]->getCommandsList(), toolbar_set.bottom_toolbar);
+ toolbar_set.bottom_toolbar.button_display_mode = mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM]->getButtonType();
+ addToToolset(mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM]->getCommandsList(), toolbar_set.bottom_toolbar);
}
// Serialize the parameter tree
@@ -511,9 +517,9 @@ void LLToolBarView::onToolBarButtonRemoved(LLView* button)
void LLToolBarView::draw()
{
- LLRect toolbar_rects[TOOLBAR_COUNT];
+ LLRect toolbar_rects[LLToolBarEnums::TOOLBAR_COUNT];
- for (S32 i = TOOLBAR_FIRST; i <= TOOLBAR_LAST; i++)
+ for (S32 i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++)
{
if (mToolbars[i])
{
@@ -532,7 +538,7 @@ void LLToolBarView::draw()
}
}
- for (S32 i = TOOLBAR_FIRST; i <= TOOLBAR_LAST; i++)
+ for (S32 i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++)
{
mToolbars[i]->getParent()->setVisible(mShowToolbars
&& (mToolbars[i]->hasButtons()
@@ -544,7 +550,7 @@ void LLToolBarView::draw()
{
LLColor4 drop_color = LLUIColorTable::instance().getColor( "ToolbarDropZoneColor" );
- for (S32 i = TOOLBAR_FIRST; i <= TOOLBAR_LAST; i++)
+ for (S32 i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++)
{
gl_rect_2d(toolbar_rects[i], drop_color, TRUE);
}
@@ -620,7 +626,7 @@ BOOL LLToolBarView::handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* t
S32 old_toolbar_loc = gToolBarView->hasCommand(command_id);
LLToolBar* old_toolbar = NULL;
- if (old_toolbar_loc != TOOLBAR_NONE)
+ if (old_toolbar_loc != LLToolBarEnums::TOOLBAR_NONE)
{
llassert(gToolBarView->mDragToolbarButton);
old_toolbar = gToolBarView->mDragToolbarButton->getParentByType<LLToolBar>();
@@ -683,7 +689,7 @@ bool LLToolBarView::isModified() const
{
bool modified = false;
- for (S32 i = TOOLBAR_FIRST; i <= TOOLBAR_LAST; i++)
+ for (S32 i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++)
{
modified |= mToolbars[i]->isModified();
}
diff --git a/indra/newview/lltoolbarview.h b/indra/newview/lltoolbarview.h
index dcc3862074..a230c2fdee 100755
--- a/indra/newview/lltoolbarview.h
+++ b/indra/newview/lltoolbarview.h
@@ -40,19 +40,6 @@ class LLUICtrlFactory;
class LLToolBarView : public LLUICtrl
{
public:
- typedef enum
- {
- TOOLBAR_NONE = 0,
- TOOLBAR_LEFT,
- TOOLBAR_RIGHT,
- TOOLBAR_BOTTOM,
-
- TOOLBAR_COUNT,
-
- TOOLBAR_FIRST = TOOLBAR_LEFT,
- TOOLBAR_LAST = TOOLBAR_BOTTOM,
- } EToolBarLocation;
-
// Xui structure of the toolbar panel
struct Params : public LLInitParam::Block<Params, LLUICtrl::Params> {};
@@ -84,9 +71,9 @@ public:
virtual void draw();
// Toolbar view interface with the rest of the world
- // Checks if the commandId is being used somewhere in one of the toolbars, returns EToolBarLocation
+ // Checks if the commandId is being used somewhere in one of the toolbars, returns LLToolBarEnums::EToolBarLocation
S32 hasCommand(const LLCommandId& commandId) const;
- S32 addCommand(const LLCommandId& commandId, EToolBarLocation toolbar, int rank = LLToolBar::RANK_NONE);
+ S32 addCommand(const LLCommandId& commandId, LLToolBarEnums::EToolBarLocation toolbar, int rank = LLToolBar::RANK_NONE);
S32 removeCommand(const LLCommandId& commandId, int& rank); // Sets the rank the removed command was at, RANK_NONE if not found
S32 enableCommand(const LLCommandId& commandId, bool enabled);
S32 stopCommandInProgress(const LLCommandId& commandId);
@@ -109,7 +96,7 @@ public:
static void resetDragTool(LLToolBarButton* toolbarButton);
LLInventoryObject* getDragItem();
LLView* getBottomToolbar() { return mBottomToolbarPanel; }
- LLToolBar* getToolbar(EToolBarLocation toolbar) { return mToolbars[toolbar]; }
+ LLToolBar* getToolbar(LLToolBarEnums::EToolBarLocation toolbar) { return mToolbars[toolbar]; }
bool isModified() const;
protected:
@@ -127,7 +114,7 @@ private:
static void onToolBarButtonRemoved(LLView* button);
// Pointers to the toolbars handled by the toolbar view
- LLToolBar* mToolbars[TOOLBAR_COUNT];
+ LLToolBar* mToolbars[LLToolBarEnums::TOOLBAR_COUNT];
bool mToolbarsLoaded;
bool mDragStarted;
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index cb7536edce..ef5021816e 100755
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -1860,6 +1860,14 @@ void LLViewerWindow::initBase()
// Constrain floaters to inside the menu and status bar regions.
gFloaterView = main_view->getChild<LLFloaterView>("Floater View");
+ for (S32 i = 0; i < LLToolBarEnums::TOOLBAR_COUNT; ++i)
+ {
+ LLToolBar * toolbarp = gToolBarView->getToolbar((LLToolBarEnums::EToolBarLocation)i);
+ if (toolbarp)
+ {
+ toolbarp->getCenterLayoutPanel()->setReshapeCallback(boost::bind(&LLFloaterView::setToolbarRect, gFloaterView, _1, _2));
+ }
+ }
gFloaterView->setFloaterSnapView(main_view->getChild<LLView>("floater_snap_region")->getHandle());
gSnapshotFloaterView = main_view->getChild<LLSnapshotFloaterView>("Snapshot Floater View");