summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorRick Pasetto <rick@lindenlab.com>2009-12-10 09:28:47 -0800
committerRick Pasetto <rick@lindenlab.com>2009-12-10 09:28:47 -0800
commit4a92f49e7b129461010559f3c298620e9a589aab (patch)
treeab1de981f6c035c666c7d0a383deaddf2bd2afcf /indra/newview
parent9b4d09471cca6922257a27ba9cb70498ab81fd94 (diff)
parent4c33c54ce03bffd3ad75be3dccaed2d26a68e157 (diff)
Automated merge with ssh://rick@hg.lindenlab.com/viewer/viewer-2-0
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/CMakeLists.txt1
-rw-r--r--indra/newview/app_settings/settings.xml11
-rw-r--r--indra/newview/llpanellogin.cpp15
-rw-r--r--indra/newview/llpanellogin.h3
-rw-r--r--indra/newview/llviewerwindow.cpp100
-rw-r--r--indra/newview/llviewerwindow.h7
6 files changed, 135 insertions, 2 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index be6bce8054..fcd29d76ef 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -7,6 +7,7 @@ include(Boost)
include(BuildVersion)
include(DBusGlib)
include(DirectX)
+include(DragDrop)
include(ELFIO)
include(FMOD)
include(OPENAL)
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 80a3977d02..5b760566f0 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -5471,6 +5471,17 @@
<key>Value</key>
<integer>0</integer>
</map>
+ <key>PrimMediaDragNDrop</key>
+ <map>
+ <key>Comment</key>
+ <string>Enable drag and drop</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>1</integer>
+ </map>
<key>PrimMediaMaxRetries</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index a729b8c06f..66322de50d 100644
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -682,6 +682,21 @@ void LLPanelLogin::refreshLocation( bool force_visible )
}
// static
+void LLPanelLogin::updateLocationUI()
+{
+ std::string sim_string = LLURLSimString::sInstance.mSimString;
+ if (!sim_string.empty())
+ {
+ // Replace "<Type region name>" with this region name
+ LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
+ combo->remove(2);
+ combo->add( sim_string );
+ combo->setTextEntry(sim_string);
+ combo->setCurrentByIndex( 2 );
+ }
+}
+
+// static
void LLPanelLogin::closePanel()
{
if (sInstance)
diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h
index e3d30d7d0c..b341affd2e 100644
--- a/indra/newview/llpanellogin.h
+++ b/indra/newview/llpanellogin.h
@@ -70,6 +70,7 @@ public:
static void addServer(const std::string& server, S32 domain_name);
static void refreshLocation( bool force_visible );
+ static void updateLocationUI();
static void getFields(std::string *firstname, std::string *lastname,
std::string *password);
@@ -100,7 +101,7 @@ private:
static void onPassKey(LLLineEditor* caller, void* user_data);
static void onSelectServer(LLUICtrl*, void*);
static void onServerComboLostFocus(LLFocusableElement*);
-
+
private:
LLPointer<LLUIImage> mLogoImage;
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 8529a93527..fed676775c 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,103 @@ 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, LLWindowCallbacks::DragNDropAction action, std::string data)
+{
+ LLWindowCallbacks::DragNDropResult result = LLWindowCallbacks::DND_NONE;
+ if (gSavedSettings.getBOOL("PrimMediaDragNDrop"))
+ {
+
+ switch(action)
+ {
+ // Much of the handling for these two cases is the same.
+ case LLWindowCallbacks::DNDA_TRACK:
+ case LLWindowCallbacks::DNDA_DROPPED:
+ {
+ bool drop = (LLWindowCallbacks::DNDA_DROPPED == action);
+
+ // 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;
+ }
+ }
+ }
+ }
+ break;
+
+ case LLWindowCallbacks::DNDA_START_TRACKING:
+ // No special handling here yet -- we'll actually start tracking on the first DNDA_TRACK event.
+ break;
+
+ case LLWindowCallbacks::DNDA_STOP_TRACKING:
+ // The cleanup case below will make sure things are unhilighted if necessary.
+ break;
+ }
+
+ if (result == LLWindowCallbacks::DND_NONE && !mDragHoveredObject.isNull())
+ {
+ LLSelectMgr::getInstance()->unhighlightObjectOnly(mDragHoveredObject);
+ mDragHoveredObject = NULL;
+ }
+ }
+
+ return result;
+}
BOOL LLViewerWindow::handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask)
{
diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h
index 1d564a1338..e209ff1ad9 100644
--- a/indra/newview/llviewerwindow.h
+++ b/indra/newview/llviewerwindow.h
@@ -170,7 +170,8 @@ public:
/*virtual*/ BOOL handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
/*virtual*/ BOOL handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
/*virtual*/ BOOL handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
- /*virtual*/ void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask);
+ /*virtual*/ LLWindowCallbacks::DragNDropResult handleDragNDrop(LLWindow *window, LLCoordGL pos, MASK mask, LLWindowCallbacks::DragNDropAction action, std::string data);
+ void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask);
/*virtual*/ void handleMouseLeave(LLWindow *window);
/*virtual*/ void handleResize(LLWindow *window, S32 x, S32 y);
/*virtual*/ void handleFocus(LLWindow *window);
@@ -477,6 +478,10 @@ protected:
static std::string sSnapshotDir;
static std::string sMovieBaseName;
+
+private:
+ // Object temporarily hovered over while dragging
+ LLPointer<LLViewerObject> mDragHoveredObject;
};
void toggle_flying(void*);