summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerwindow.cpp
diff options
context:
space:
mode:
authorRick Pasetto <rick@lindenlab.com>2009-12-03 11:55:43 -0800
committerRick Pasetto <rick@lindenlab.com>2009-12-03 11:55:43 -0800
commit0a2a52c3b1f60668110381ef782cfa6d1088fa4e (patch)
tree1cecce5cb15dfa74cc83bbdf8ca9779335458ce6 /indra/newview/llviewerwindow.cpp
parent18901432e93ab887726b58354ae45ddb43e8ed27 (diff)
parent57195ccd74d5873f4b861afe4bf56ccee78a87a2 (diff)
Automated merge with ssh://rick@hg.lindenlab.com/viewer/viewer-2-0/
Diffstat (limited to 'indra/newview/llviewerwindow.cpp')
-rw-r--r--indra/newview/llviewerwindow.cpp80
1 files changed, 80 insertions, 0 deletions
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 8529a93527..e80a2ae11c 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -50,6 +50,7 @@
#include "llviewquery.h"
#include "llxmltree.h"
+#include "llslurl.h"
//#include "llviewercamera.h"
#include "llrender.h"
@@ -79,6 +80,8 @@
#include "timing.h"
#include "llviewermenu.h"
#include "lltooltip.h"
+#include "llmediaentry.h"
+#include "llurldispatcher.h"
// newview includes
#include "llagent.h"
@@ -819,6 +822,83 @@ BOOL LLViewerWindow::handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MAS
// Always handled as far as the OS is concerned.
return TRUE;
}
+
+LLWindowCallbacks::DragNDropResult LLViewerWindow::handleDragNDrop( LLWindow *window, LLCoordGL pos, MASK mask, BOOL drop, std::string data)
+{
+ LLWindowCallbacks::DragNDropResult result = LLWindowCallbacks::DND_NONE;
+ if (gSavedSettings.getBOOL("PrimMediaDragNDrop"))
+ {
+ // special case SLURLs
+ if ( drop && std::string::npos != data.find("slurl.com") )
+ {
+ LLURLDispatcher::dispatch( data, NULL, true );
+ LLURLSimString::setString( LLSLURL::stripProtocol( data ) );
+ LLPanelLogin::refreshLocation( true );
+ LLPanelLogin::updateLocationUI();
+ return LLWindowCallbacks::DND_MOVE;
+ };
+
+ LLPickInfo pick_info = pickImmediate( pos.mX, pos.mY, TRUE /*BOOL pick_transparent*/ );
+
+ LLUUID object_id = pick_info.getObjectID();
+ S32 object_face = pick_info.mObjectFace;
+ std::string url = data;
+
+ llinfos << "### Object: picked at " << pos.mX << ", " << pos.mY << " - face = " << object_face << " - URL = " << url << llendl;
+
+ LLVOVolume *obj = dynamic_cast<LLVOVolume*>(static_cast<LLViewerObject*>(pick_info.getObject()));
+
+ if (obj && obj->permModify())
+ {
+ LLTextureEntry *te = obj->getTE(object_face);
+ if (te)
+ {
+ if (drop)
+ {
+ if (! te->hasMedia())
+ {
+ // Create new media entry
+ LLSD media_data;
+ // XXX Should we really do Home URL too?
+ media_data[LLMediaEntry::HOME_URL_KEY] = url;
+ media_data[LLMediaEntry::CURRENT_URL_KEY] = url;
+ media_data[LLMediaEntry::AUTO_PLAY_KEY] = true;
+ obj->syncMediaData(object_face, media_data, true, true);
+ // XXX This shouldn't be necessary, should it ?!?
+ obj->getMediaImpl(object_face)->navigateReload();
+ obj->sendMediaDataUpdate();
+
+ result = LLWindowCallbacks::DND_COPY;
+ }
+ else {
+ // just navigate to the URL
+ obj->getMediaImpl(object_face)->navigateTo(url);
+
+ result = LLWindowCallbacks::DND_LINK;
+ }
+ LLSelectMgr::getInstance()->unhighlightObjectOnly(mDragHoveredObject);
+ mDragHoveredObject = NULL;
+
+ }
+ else {
+ mDragHoveredObject = obj;
+ // Highlight the dragged object
+ LLSelectMgr::getInstance()->highlightObjectOnly(mDragHoveredObject);
+
+ result = (! te->hasMedia()) ? LLWindowCallbacks::DND_COPY : LLWindowCallbacks::DND_LINK;
+ }
+ }
+ }
+
+ if (result == LLWindowCallbacks::DND_NONE && !mDragHoveredObject.isNull())
+ {
+ LLSelectMgr::getInstance()->unhighlightObjectOnly(mDragHoveredObject);
+ mDragHoveredObject = NULL;
+ }
+ }
+
+ return result;
+}
BOOL LLViewerWindow::handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask)
{