summaryrefslogtreecommitdiff
path: root/indra/newview/lltoolbarview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lltoolbarview.cpp')
-rwxr-xr-x[-rw-r--r--]indra/newview/lltoolbarview.cpp127
1 files changed, 57 insertions, 70 deletions
diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp
index b2318f9158..fd950864aa 100644..100755
--- a/indra/newview/lltoolbarview.cpp
+++ b/indra/newview/lltoolbarview.cpp
@@ -51,8 +51,6 @@ LLToolBarView* gToolBarView = NULL;
static LLDefaultChildRegistry::Register<LLToolBarView> r("toolbar_view");
-void handleLoginToolbarSetup();
-
bool isToolDragged()
{
return (LLToolDragAndDrop::getInstance()->getSource() == LLToolDragAndDrop::SOURCE_VIEWER);
@@ -79,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;
}
@@ -98,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));
@@ -111,17 +115,15 @@ BOOL LLToolBarView::postBuild()
mToolbars[i]->setButtonAddCallback(boost::bind(LLToolBarView::onToolBarButtonAdded,_1));
mToolbars[i]->setButtonRemoveCallback(boost::bind(LLToolBarView::onToolBarButtonRemoved,_1));
}
-
- LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&handleLoginToolbarSetup));
return TRUE;
}
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))
{
@@ -133,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);
@@ -148,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);
}
@@ -160,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);
}
@@ -172,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,13 +182,13 @@ S32 LLToolBarView::stopCommandInProgress(const LLCommandId& commandId)
return command_location;
}
-S32 LLToolBarView::flashCommand(const LLCommandId& commandId, bool flash)
+S32 LLToolBarView::flashCommand(const LLCommandId& commandId, bool flash, bool force_flashing/* = false */)
{
S32 command_location = hasCommand(commandId);
- if (command_location != TOOLBAR_NONE)
+ if (command_location != LLToolBarEnums::TOOLBAR_NONE)
{
- mToolbars[command_location]->flashCommand(commandId, flash);
+ mToolbars[command_location]->flashCommand(commandId, flash, force_flashing);
}
return command_location;
@@ -201,7 +203,7 @@ bool LLToolBarView::addCommandInternal(const LLCommandId& command, LLToolBar* to
}
else
{
- llwarns << "Toolbars creation : the command with id " << command.uuid().asString() << " cannot be found in the command manager" << llendl;
+ LL_WARNS() << "Toolbars creation : the command with id " << command.uuid().asString() << " cannot be found in the command manager" << LL_ENDL;
return false;
}
return true;
@@ -220,20 +222,20 @@ bool LLToolBarView::loadToolbars(bool force_default)
}
else if (!gDirUtilp->fileExists(toolbar_file))
{
- llwarns << "User toolbars def not found -> use default" << llendl;
+ LL_WARNS() << "User toolbars def not found -> use default" << LL_ENDL;
toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "toolbars.xml");
}
LLXMLNodePtr root;
if(!LLXMLNode::parseFile(toolbar_file, root, NULL))
{
- llwarns << "Unable to load toolbars from file: " << toolbar_file << llendl;
+ LL_WARNS() << "Unable to load toolbars from file: " << toolbar_file << LL_ENDL;
err = true;
}
if (!err && !root->hasName("toolbars"))
{
- llwarns << toolbar_file << " is not a valid toolbars definition file" << llendl;
+ LL_WARNS() << toolbar_file << " is not a valid toolbars definition file" << LL_ENDL;
err = true;
}
@@ -246,7 +248,7 @@ bool LLToolBarView::loadToolbars(bool force_default)
if (!err && !toolbar_set.validateBlock())
{
- llwarns << "Unable to validate toolbars from file: " << toolbar_file << llendl;
+ LL_WARNS() << "Unable to validate toolbars from file: " << toolbar_file << LL_ENDL;
err = true;
}
@@ -254,7 +256,7 @@ bool LLToolBarView::loadToolbars(bool force_default)
{
if (force_default)
{
- llerrs << "Unable to load toolbars from default file : " << toolbar_file << llendl;
+ LL_ERRS() << "Unable to load toolbars from default file : " << toolbar_file << LL_ENDL;
return false;
}
@@ -263,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])
{
@@ -272,48 +274,48 @@ 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;
+ LL_WARNS() << "Error adding command '" << command_params.name() << "' to left toolbar." << LL_ENDL;
}
}
}
- 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;
+ LL_WARNS() << "Error adding command '" << command_params.name() << "' to right toolbar." << LL_ENDL;
}
}
}
- 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;
+ LL_WARNS() << "Error adding command '" << command_params.name() << "' to bottom toolbar." << LL_ENDL;
}
}
}
@@ -323,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])
{
@@ -375,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
@@ -515,13 +517,13 @@ 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])
{
- LLLayoutStack::ELayoutOrientation orientation = LLToolBarEnums::getOrientation(mToolbars[i]->getSideType());
+ LLView::EOrientation orientation = LLToolBarEnums::getOrientation(mToolbars[i]->getSideType());
if (orientation == LLLayoutStack::HORIZONTAL)
{
@@ -536,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()
@@ -548,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);
}
@@ -624,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>();
@@ -651,7 +653,7 @@ BOOL LLToolBarView::handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* t
}
else
{
- llwarns << "Command couldn't be found in command manager" << llendl;
+ LL_WARNS() << "Command couldn't be found in command manager" << LL_ENDL;
}
}
@@ -687,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();
}
@@ -696,18 +698,3 @@ bool LLToolBarView::isModified() const
}
-//
-// HACK to bring up destinations guide at startup
-//
-
-void handleLoginToolbarSetup()
-{
- // Open the destinations guide by default on first login, per Rhett
- if (gSavedPerAccountSettings.getBOOL("DisplayDestinationsOnInitialRun") || gAgent.isFirstLogin())
- {
- LLFloaterReg::showInstance("destinations");
-
- gSavedPerAccountSettings.setBOOL("DisplayDestinationsOnInitialRun", FALSE);
- }
-}
-