summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2011-10-11 16:20:02 -0700
committerMerov Linden <merov@lindenlab.com>2011-10-11 16:20:02 -0700
commitdacfe7b2bdc845640f18db33992924033494e470 (patch)
treef2104c7ceb428cf73b6b03621b2272b079fed2ce /indra/newview
parent682609d254fb973cfa267923b69c5e06b7efd7e1 (diff)
EXP-1300 : Fix caret position in bottom bar, fix misplacement when moving within same toolbar, suppress visible caret in some situations, no caret if toolbar empty
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/lltoolbarview.cpp27
1 files changed, 21 insertions, 6 deletions
diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp
index 8ae9328f6d..86f6477710 100644
--- a/indra/newview/lltoolbarview.cpp
+++ b/indra/newview/lltoolbarview.cpp
@@ -406,20 +406,35 @@ BOOL LLToolBarView::handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* t
if (command)
{
// Convert the (x,y) position in rank in toolbar
- int rank = 0;
+ int new_rank = LLToolBar::RANK_NONE;
if (!toolbar->isReadOnly())
{
- rank = toolbar->getRankFromPosition(x,y);
+ new_rank = toolbar->getRankFromPosition(x,y);
}
// Suppress the command from the toolbars (including the one it's dropped in,
// this will handle move position).
- gToolBarView->mToolbarLeft->removeCommand(command_id);
- gToolBarView->mToolbarRight->removeCommand(command_id);
- gToolBarView->mToolbarBottom->removeCommand(command_id);
+ int old_rank = LLToolBar::RANK_NONE;
+ int rank;
+ if ((rank = gToolBarView->mToolbarLeft->removeCommand(command_id)) != LLToolBar::RANK_NONE)
+ {
+ old_rank = rank;
+ }
+ if ((rank = gToolBarView->mToolbarRight->removeCommand(command_id)) != LLToolBar::RANK_NONE)
+ {
+ old_rank = rank;
+ }
+ if ((rank = gToolBarView->mToolbarBottom->removeCommand(command_id)) != LLToolBar::RANK_NONE)
+ {
+ old_rank = rank;
+ }
// Now insert it in the toolbar at the detected rank
if (!toolbar->isReadOnly())
{
- toolbar->addCommand(command->id(),rank);
+ if ((old_rank != LLToolBar::RANK_NONE) && (old_rank < new_rank))
+ {
+ new_rank -= 1;
+ }
+ toolbar->addCommand(command->id(),new_rank);
}
}
else