summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/lltoolbarview.cpp64
-rw-r--r--indra/newview/lltoolbarview.h10
-rw-r--r--indra/newview/skins/default/textures/textures.xml3
-rw-r--r--indra/newview/skins/default/textures/toolbar_icons/caret_bottom.pngbin0 -> 139 bytes
-rw-r--r--indra/newview/skins/default/textures/toolbar_icons/caret_left.pngbin0 -> 893 bytes
-rw-r--r--indra/newview/skins/default/textures/toolbar_icons/caret_right.pngbin0 -> 892 bytes
-rw-r--r--indra/newview/skins/default/xui/en/panel_toolbar_view.xml30
7 files changed, 93 insertions, 14 deletions
diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp
index a0e080b783..318bede6f0 100644
--- a/indra/newview/lltoolbarview.cpp
+++ b/indra/newview/lltoolbarview.cpp
@@ -41,7 +41,6 @@
LLToolBarView* gToolBarView = NULL;
static LLDefaultChildRegistry::Register<LLToolBarView> r("toolbar_view");
-bool LLToolBarView::sDragStarted = false;
bool isToolDragged()
{
@@ -331,18 +330,25 @@ void LLToolBarView::draw()
void LLToolBarView::startDragTool( S32 x, S32 y, const LLUUID& uuid)
{
- //llinfos << "Merov debug: startDragTool() : x = " << x << ", y = " << y << llendl;
+ 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;
+ gToolBarView->mDragRank = LLToolBar::RANK_NONE;
+ gToolBarView->mDragToolbar = NULL;
LLToolDragAndDrop::getInstance()->setDragStart( x, y );
- sDragStarted = false;
}
BOOL LLToolBarView::handleDragTool( S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type)
{
-// llinfos << "Merov debug: handleDragTool() : x = " << x << ", y = " << y << ", uuid = " << uuid << llendl;
if (LLToolDragAndDrop::getInstance()->isOverThreshold( x, y ))
{
- if (!sDragStarted)
+ 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
std::vector<EDragAndDropType> types;
uuid_vec_t cargo_ids;
types.push_back(DAD_WIDGET);
@@ -350,9 +356,35 @@ BOOL LLToolBarView::handleDragTool( S32 x, S32 y, const LLUUID& uuid, LLAssetTyp
gClipboard.setSourceObject(uuid,LLAssetType::AT_WIDGET);
LLToolDragAndDrop::ESource src = LLToolDragAndDrop::SOURCE_VIEWER;
LLUUID srcID;
- //llinfos << "Merov debug: handleDragTool() : beginMultiDrag()" << llendl;
LLToolDragAndDrop::getInstance()->beginMultiDrag(types, cargo_ids, src, srcID);
- sDragStarted = true;
+ 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
+ // set a callback on end drag so that we reinsert the command if no drop happened
+ /*
+ gToolBarView->mDragCommand = LLCommandId(uuid);
+ if ((gToolBarView->mDragRank = gToolBarView->mToolbarLeft->removeCommand(gToolBarView->mDragCommand)) != LLToolBar::RANK_NONE)
+ {
+ gToolBarView->mDragToolbar = gToolBarView->mToolbarLeft;
+ }
+ else if ((gToolBarView->mDragRank = gToolBarView->mToolbarRight->removeCommand(gToolBarView->mDragCommand)) != LLToolBar::RANK_NONE)
+ {
+ gToolBarView->mDragToolbar = gToolBarView->mToolbarRight;
+ }
+ else if ((gToolBarView->mDragRank = gToolBarView->mToolbarBottom->removeCommand(gToolBarView->mDragCommand)) != LLToolBar::RANK_NONE)
+ {
+ gToolBarView->mDragToolbar = gToolBarView->mToolbarBottom;
+ }
+ if (gToolBarView->mDragRank != LLToolBar::RANK_NONE)
+ {
+ llinfos << "Merov debug: rank of dragged tool = " << gToolBarView->mDragRank << llendl;
+ LLToolDragAndDrop::getInstance()->setEndDragCallback(boost::bind(&LLToolBarView::onEndDrag, gToolBarView));
+ }
+ */
+
+ llinfos << "Merov debug: Drag started cleanly" << llendl;
+ gToolBarView->mDragStarted = true;
return TRUE;
}
else
@@ -375,7 +407,7 @@ BOOL LLToolBarView::handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* t
//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());
+ LLCommandId command_id(inv_item->getUUID());
LLCommand* command = mgr.getCommand(command_id);
if (command)
{
@@ -408,5 +440,19 @@ BOOL LLToolBarView::handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* t
void LLToolBarView::stopDragTool()
{
- sDragStarted = false;
+ // Clear the saved command, toolbar and rank
+ gToolBarView->mDragStarted = false;
+ gToolBarView->mDragCommand = LLCommandId::null;
+ gToolBarView->mDragRank = LLToolBar::RANK_NONE;
+ gToolBarView->mDragToolbar = NULL;
}
+
+void LLToolBarView::onEndDrag()
+{
+ // If there's a saved command, reinsert it in the saved toolbar
+ if (gToolBarView->mDragRank != LLToolBar::RANK_NONE)
+ {
+ gToolBarView->mDragToolbar->addCommand(gToolBarView->mDragCommand,gToolBarView->mDragRank);
+ }
+ stopDragTool();
+} \ No newline at end of file
diff --git a/indra/newview/lltoolbarview.h b/indra/newview/lltoolbarview.h
index a0c526ac54..6623e63f8a 100644
--- a/indra/newview/lltoolbarview.h
+++ b/indra/newview/lltoolbarview.h
@@ -78,6 +78,7 @@ public:
static BOOL handleDragTool( S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type);
static BOOL handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* toolbar);
static void stopDragTool();
+ void onEndDrag();
protected:
friend class LLUICtrlFactory;
@@ -94,12 +95,11 @@ private:
LLToolBar* mToolbarLeft;
LLToolBar* mToolbarRight;
LLToolBar* mToolbarBottom;
- bool mDragging;
- LLToolBarButton* mDragButton;
- S32 mMouseX;
- S32 mMouseY;
- static bool sDragStarted;
+ LLCommandId mDragCommand;
+ int mDragRank;
+ LLToolBar* mDragToolbar;
+ bool mDragStarted;
};
extern LLToolBarView* gToolBarView;
diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml
index e7fb836f45..27577d42ea 100644
--- a/indra/newview/skins/default/textures/textures.xml
+++ b/indra/newview/skins/default/textures/textures.xml
@@ -149,6 +149,9 @@ with the same filename but different name
<texture name="Command_Speak_Icon" file_name="toolbar_icons/speak.png" preload="true" />
<texture name="Command_View_Icon" file_name="toolbar_icons/view.png" preload="true" />
<texture name="Command_Voice_Icon" file_name="toolbar_icons/nearbyvoice.png" preload="true" />
+ <texture name="Caret_Bottom_Icon" file_name="toolbar_icons/caret_bottom.png" preload="true" />
+ <texture name="Caret_Right_Icon" file_name="toolbar_icons/caret_right.png" preload="true" />
+ <texture name="Caret_Left_Icon" file_name="toolbar_icons/caret_left.png" preload="true" />
<texture name="ComboButton_Disabled" file_name="widgets/ComboButton_Disabled.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" />
<texture name="ComboButton_Selected" file_name="widgets/ComboButton_Selected.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" />
diff --git a/indra/newview/skins/default/textures/toolbar_icons/caret_bottom.png b/indra/newview/skins/default/textures/toolbar_icons/caret_bottom.png
new file mode 100644
index 0000000000..82f58b22b9
--- /dev/null
+++ 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
new file mode 100644
index 0000000000..75eecc84ed
--- /dev/null
+++ 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
new file mode 100644
index 0000000000..677459ae1c
--- /dev/null
+++ 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 bc96bfbab5..5d6967ed32 100644
--- a/indra/newview/skins/default/xui/en/panel_toolbar_view.xml
+++ b/indra/newview/skins/default/xui/en/panel_toolbar_view.xml
@@ -47,6 +47,16 @@
bottom="-10"
side="left"
button_display_mode="icons_only">
+ <icon layout="topleft"
+ height="7"
+ width="5"
+ follows="left|top"
+ top="20"
+ left="10"
+ tab_stop="false"
+ visible="false"
+ image_name="Caret_Left_Icon"
+ name="caret" />
</toolbar>
</layout_panel>
<layout_panel name="non_toolbar_panel"
@@ -88,6 +98,16 @@
bottom="-10"
side="right"
button_display_mode="icons_only">
+ <icon layout="topleft"
+ height="7"
+ width="5"
+ follows="left|top"
+ top="20"
+ left="10"
+ tab_stop="false"
+ visible="false"
+ image_name="Caret_Right_Icon"
+ name="caret" />
</toolbar>
</layout_panel>
</layout_stack>
@@ -109,6 +129,16 @@
follows="left|right|bottom"
button_display_mode="icons_with_text"
visible="true">
+ <icon layout="topleft"
+ height="5"
+ width="7"
+ follows="left|top"
+ top="20"
+ left="10"
+ tab_stop="false"
+ visible="false"
+ image_name="Caret_Bottom_Icon"
+ name="caret" />
</toolbar>
</layout_panel>
</layout_stack>