summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/llui/lltoolbar.cpp86
-rw-r--r--indra/llui/lltoolbar.h7
-rw-r--r--indra/newview/lltoolbarview.cpp7
-rw-r--r--indra/newview/skins/default/textures/toolbar_icons/caret_bottom.pngbin139 -> 169 bytes
-rw-r--r--indra/newview/skins/default/textures/toolbar_icons/caret_left.pngbin893 -> 913 bytes
-rw-r--r--indra/newview/skins/default/textures/toolbar_icons/caret_right.pngbin892 -> 911 bytes
-rw-r--r--indra/newview/skins/default/xui/en/panel_toolbar_view.xml13
7 files changed, 75 insertions, 38 deletions
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index 89184f781f..7c1e2017c0 100644
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -34,6 +34,7 @@
#include "llmenugl.h"
#include "lltrans.h"
#include "llinventory.h"
+#include "lliconctrl.h"
// uncomment this and remove the one in llui.cpp when there is an external reference to this translation unit
// thanks, MSVC!
@@ -204,7 +205,6 @@ bool LLToolBar::addCommand(const LLCommandId& commandId, int rank)
{
LLCommand * command = LLCommandManager::instance().getCommand(commandId);
if (!command) return false;
- llinfos << "Merov debug : addCommand, " << commandId.name() << ", " << commandId.uuid() << llendl;
// Create the button and do the things that don't need ordering
LLToolBarButton* button = createButton(commandId);
@@ -248,7 +248,6 @@ int LLToolBar::removeCommand(const LLCommandId& commandId)
{
if (!hasCommand(commandId)) return RANK_NONE;
- llinfos << "Merov debug : removeCommand, " << commandId.name() << ", " << commandId.uuid() << llendl;
// First erase the map record
command_id_map::iterator it = mButtonMap.find(commandId.uuid());
mButtonMap.erase(it);
@@ -398,7 +397,7 @@ void LLToolBar::resizeButtonsInRow(std::vector<LLToolBarButton*>& buttons_in_row
// The rank is the position a tool dropped in (x,y) would assume in the button list.
// The value returned is between 0 and mButtons.size(), 0 being the first element to the left
// (or top) and mButtons.size() the last one to the right (or bottom).
-int LLToolBar::getRankFromPosition(S32 x, S32 y)
+int LLToolBar::getRankFromPosition(S32& x, S32& y)
{
int rank = 0;
@@ -406,16 +405,16 @@ int LLToolBar::getRankFromPosition(S32 x, S32 y)
S32 button_panel_x = 0;
S32 button_panel_y = 0;
localPointToOtherView(x, y, &button_panel_x, &button_panel_y, mButtonPanel);
+ S32 dx = x - button_panel_x;
+ S32 dy = y - button_panel_y;
- //llinfos << "Merov debug : rank compute: orientation = " << orientation << ", x = " << button_panel_x << ", y = " << button_panel_y << llendl;
-
// Simply compare the passed coord with the buttons outbound box
std::list<LLToolBarButton*>::iterator it_button = mButtons.begin();
std::list<LLToolBarButton*>::iterator end_button = mButtons.end();
+ LLRect button_rect;
while (it_button != end_button)
{
- LLRect button_rect = (*it_button)->getRect();
- //llinfos << "Merov debug : rank compute: rect = " << button_rect.mLeft << ", " << button_rect.mTop << ", " << button_rect.mRight << ", " << button_rect.mBottom << llendl;
+ button_rect = (*it_button)->getRect();
if (((orientation == LLLayoutStack::HORIZONTAL) && (button_rect.mRight > button_panel_x)) ||
((orientation == LLLayoutStack::VERTICAL) && (button_rect.mBottom < button_panel_y)) )
{
@@ -424,7 +423,16 @@ int LLToolBar::getRankFromPosition(S32 x, S32 y)
rank++;
++it_button;
}
- //llinfos << "Merov debug : rank = " << rank << llendl;
+ if (it_button != end_button)
+ {
+ x = button_rect.mRight + dx;
+ y = button_rect.mTop + dy;
+ }
+ else
+ {
+ x = button_rect.mLeft + dx;
+ y = button_rect.mBottom + dy;
+ }
return rank;
}
@@ -613,7 +621,40 @@ void LLToolBar::draw()
LLUI::pushMatrix();
LLUI::translate((F32)getRect().mLeft, (F32)getRect().mBottom, 0.f);
+ // Position the caret
+ LLIconCtrl* caret = getChild<LLIconCtrl>("caret");
+ caret->setVisible(FALSE);
+ if (mDragAndDropTarget && !mButtonCommands.empty())
+ {
+ LLRect caret_rect = caret->getRect();
+ LLRect toolbar_rect = getRect();
+ if (mSideType == SIDE_BOTTOM)
+ {
+ caret->setRect(LLRect(mDragx-caret_rect.getWidth()/2+1,
+ toolbar_rect.getHeight()+3,
+ mDragx+caret_rect.getWidth()/2+1,
+ toolbar_rect.getHeight()-caret_rect.getHeight()+3));
+ }
+ else if (mSideType == SIDE_LEFT)
+ {
+
+ caret->setRect(LLRect(toolbar_rect.getWidth()-caret_rect.getWidth()+3,
+ mDragy+caret_rect.getHeight()/2,
+ toolbar_rect.getWidth()+3,
+ mDragy-caret_rect.getHeight()/2));
+ }
+ else
+ {
+ caret->setRect(LLRect(-3,
+ mDragy+caret_rect.getHeight()/2,
+ caret_rect.getWidth()-3,
+ mDragy-caret_rect.getHeight()/2));
+ }
+ caret->setVisible(TRUE);
+ }
+
LLUICtrl::draw();
+ caret->setVisible(FALSE);
}
void LLToolBar::reshape(S32 width, S32 height, BOOL called_from_parent)
@@ -713,7 +754,6 @@ BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
EAcceptance* accept,
std::string& tooltip_msg)
{
- llinfos << "Merov debug : handleDragAndDrop. drop = " << drop << ", x = " << x << ", y = " << y << llendl;
// If we have a drop callback, that means that we can handle the drop
BOOL handled = (mHandleDropCallback ? TRUE : FALSE);
@@ -729,21 +769,22 @@ BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
// We'll use that flag to change the visual aspect of the toolbar target on draw()
mDragAndDropTarget = false;
- // HACK!!!
- if (!isReadOnly() && handled)
+ // Convert drag position into insert position and rank
+ if (!isReadOnly() && handled && !drop)
{
- if (!drop)
+ LLInventoryItem* inv_item = (LLInventoryItem*)cargo_data;
+ LLAssetType::EType type = inv_item->getType();
+ if (type == LLAssetType::AT_WIDGET)
{
- LLInventoryItem* inv_item = (LLInventoryItem*)cargo_data;
- LLAssetType::EType type = inv_item->getType();
- if (type == LLAssetType::AT_WIDGET)
- {
- LLCommandId dragged_command(inv_item->getUUID());
- int rank = getRankFromPosition(x, y);
- removeCommand(dragged_command);
- addCommand(dragged_command,rank);
- mDragAndDropTarget = true;
- }
+ mDragx = x;
+ mDragy = y;
+ mDragRank = getRankFromPosition(mDragx, mDragy);
+ mDragAndDropTarget = true;
+ /* Do the following if you want to animate the button itself
+ LLCommandId dragged_command(inv_item->getUUID());
+ removeCommand(dragged_command);
+ addCommand(dragged_command,rank);
+ */
}
}
@@ -784,7 +825,6 @@ BOOL LLToolBarButton::handleMouseDown(S32 x, S32 y, MASK mask)
BOOL LLToolBarButton::handleHover(S32 x, S32 y, MASK mask)
{
-// llinfos << "Merov debug: handleHover, x = " << x << ", y = " << y << ", mouse = " << hasMouseCapture() << llendl;
BOOL handled = FALSE;
S32 mouse_distance_squared = (x - mMouseDownX) * (x - mMouseDownX) + (y - mMouseDownY) * (y - mMouseDownY);
diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h
index ca04a0e5d5..f3457028e7 100644
--- a/indra/llui/lltoolbar.h
+++ b/indra/llui/lltoolbar.h
@@ -156,7 +156,7 @@ public:
// virtuals
void draw();
void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
- int getRankFromPosition(S32 x, S32 y);
+ int getRankFromPosition(S32& x, S32& y);
BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
EDragAndDropType cargo_type,
@@ -188,6 +188,9 @@ protected:
tool_handledrag_callback_t mHandleDragItemCallback;
tool_handledrop_callback_t mHandleDropCallback;
bool mDragAndDropTarget;
+ int mDragRank;
+ S32 mDragx,
+ mDragy;
public:
// Methods used in loading and saving toolbar settings
@@ -217,7 +220,7 @@ private:
LLLayoutStack* mWrapStack;
LLPanel* mButtonPanel;
LLToolBarEnums::SideType mSideType;
-
+
bool mWrap;
bool mNeedsLayout;
S32 mPadLeft,
diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp
index 318bede6f0..164a1c0ca6 100644
--- a/indra/newview/lltoolbarview.cpp
+++ b/indra/newview/lltoolbarview.cpp
@@ -330,7 +330,6 @@ void LLToolBarView::draw()
void LLToolBarView::startDragTool( S32 x, S32 y, const LLUUID& uuid)
{
- llinfos << "Merov debug: startDragTool() : x = " << x << ", y = " << y << ", uuid = " << uuid << llendl;
// Flag the tool dragging but don't start it yet
gToolBarView->mDragStarted = false;
gToolBarView->mDragCommand = LLCommandId::null;
@@ -345,7 +344,6 @@ BOOL LLToolBarView::handleDragTool( S32 x, S32 y, const LLUUID& uuid, LLAssetTyp
{
if (!gToolBarView->mDragStarted)
{
- llinfos << "Merov debug: handleDragTool() : x = " << x << ", y = " << y << ", uuid = " << uuid << llendl;
// Start the tool dragging:
// First, create the global drag and drop object
@@ -357,7 +355,6 @@ BOOL LLToolBarView::handleDragTool( S32 x, S32 y, const LLUUID& uuid, LLAssetTyp
LLToolDragAndDrop::ESource src = LLToolDragAndDrop::SOURCE_VIEWER;
LLUUID srcID;
LLToolDragAndDrop::getInstance()->beginMultiDrag(types, cargo_ids, src, srcID);
- llinfos << "Merov debug: beginMultiDrag() launched" << llendl;
// Second, check if the command is present in one of the 3 toolbars
// If it is, store the command, the toolbar and the rank in the toolbar and
@@ -383,7 +380,6 @@ BOOL LLToolBarView::handleDragTool( S32 x, S32 y, const LLUUID& uuid, LLAssetTyp
}
*/
- llinfos << "Merov debug: Drag started cleanly" << llendl;
gToolBarView->mDragStarted = true;
return TRUE;
}
@@ -399,12 +395,10 @@ BOOL LLToolBarView::handleDragTool( S32 x, S32 y, const LLUUID& uuid, LLAssetTyp
BOOL LLToolBarView::handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* toolbar)
{
LLInventoryItem* inv_item = (LLInventoryItem*)cargo_data;
- //llinfos << "Merov debug : handleDropTool. Drop " << inv_item->getUUID() << " named " << inv_item->getName() << " of type " << inv_item->getType() << llendl;
LLAssetType::EType type = inv_item->getType();
if (type == LLAssetType::AT_WIDGET)
{
- //llinfos << "Merov debug : handleDropTool. Drop source is a widget -> drop it in place..." << llendl;
// Get the command from its uuid
LLCommandManager& mgr = LLCommandManager::instance();
LLCommandId command_id(inv_item->getUUID());
@@ -419,7 +413,6 @@ BOOL LLToolBarView::handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* t
}
// Suppress the command from the toolbars (including the one it's dropped in,
// this will handle move position).
- llinfos << "Merov debug : handleDropTool, " << command_id.name() << ", " << command_id.uuid() << llendl;
gToolBarView->mToolbarLeft->removeCommand(command_id);
gToolBarView->mToolbarRight->removeCommand(command_id);
gToolBarView->mToolbarBottom->removeCommand(command_id);
diff --git a/indra/newview/skins/default/textures/toolbar_icons/caret_bottom.png b/indra/newview/skins/default/textures/toolbar_icons/caret_bottom.png
index 82f58b22b9..d506cda5c9 100644
--- a/indra/newview/skins/default/textures/toolbar_icons/caret_bottom.png
+++ b/indra/newview/skins/default/textures/toolbar_icons/caret_bottom.png
Binary files differ
diff --git a/indra/newview/skins/default/textures/toolbar_icons/caret_left.png b/indra/newview/skins/default/textures/toolbar_icons/caret_left.png
index 75eecc84ed..b1284aaf79 100644
--- a/indra/newview/skins/default/textures/toolbar_icons/caret_left.png
+++ b/indra/newview/skins/default/textures/toolbar_icons/caret_left.png
Binary files differ
diff --git a/indra/newview/skins/default/textures/toolbar_icons/caret_right.png b/indra/newview/skins/default/textures/toolbar_icons/caret_right.png
index 677459ae1c..bf6a4ed66c 100644
--- a/indra/newview/skins/default/textures/toolbar_icons/caret_right.png
+++ b/indra/newview/skins/default/textures/toolbar_icons/caret_right.png
Binary files differ
diff --git a/indra/newview/skins/default/xui/en/panel_toolbar_view.xml b/indra/newview/skins/default/xui/en/panel_toolbar_view.xml
index 5d6967ed32..9ffd62f7a9 100644
--- a/indra/newview/skins/default/xui/en/panel_toolbar_view.xml
+++ b/indra/newview/skins/default/xui/en/panel_toolbar_view.xml
@@ -48,8 +48,8 @@
side="left"
button_display_mode="icons_only">
<icon layout="topleft"
- height="7"
- width="5"
+ height="10"
+ width="10"
follows="left|top"
top="20"
left="10"
@@ -99,8 +99,8 @@
side="right"
button_display_mode="icons_only">
<icon layout="topleft"
- height="7"
- width="5"
+ height="10"
+ width="10"
follows="left|top"
top="20"
left="10"
@@ -130,13 +130,14 @@
button_display_mode="icons_with_text"
visible="true">
<icon layout="topleft"
- height="5"
- width="7"
+ height="10"
+ width="10"
follows="left|top"
top="20"
left="10"
tab_stop="false"
visible="false"
+ use_draw_context_alpha="false"
image_name="Caret_Bottom_Icon"
name="caret" />
</toolbar>