From 8e0552402701370847a87615370e3e8f342633ec Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Thu, 14 May 2015 11:22:36 -0400 Subject: [PATCH] Add TP and Look options to area search (happy now?) --- indra/newview/jcfloaterareasearch.cpp | 37 +++++++++++++------ indra/newview/jcfloaterareasearch.h | 5 ++- .../default/xui/en-us/floater_area_search.xml | 8 ++-- 3 files changed, 34 insertions(+), 16 deletions(-) diff --git a/indra/newview/jcfloaterareasearch.cpp b/indra/newview/jcfloaterareasearch.cpp index 3beacdf3d..c447f00c6 100644 --- a/indra/newview/jcfloaterareasearch.cpp +++ b/indra/newview/jcfloaterareasearch.cpp @@ -41,6 +41,7 @@ #include "lluictrlfactory.h" #include "llagent.h" +#include "llagentcamera.h" #include "lltracker.h" #include "llviewerobjectlist.h" @@ -84,6 +85,8 @@ BOOL JCFloaterAreaSearch::postBuild() getChild("Refresh")->setClickedCallback(boost::bind(&JCFloaterAreaSearch::onRefresh,this)); getChild("Stop")->setClickedCallback(boost::bind(&JCFloaterAreaSearch::onStop,this)); + getChild("TP")->setClickedCallback(boost::bind(&JCFloaterAreaSearch::teleportToSelected, this)); + getChild("Look")->setClickedCallback(boost::bind(&JCFloaterAreaSearch::lookAtSelected, this)); getChild("Name query chunk")->setCommitCallback(boost::bind(&JCFloaterAreaSearch::onCommitLine,this,_1,_2,LIST_OBJECT_NAME)); getChild("Description query chunk")->setCommitCallback(boost::bind(&JCFloaterAreaSearch::onCommitLine,this,_1,_2,LIST_OBJECT_DESC)); @@ -113,22 +116,32 @@ void JCFloaterAreaSearch::checkRegion(bool force_clear) } } +LLViewerObject* JCFloaterAreaSearch::getSelectedObject() +{ + if (LLScrollListItem* item = mResultList->getFirstSelected()) + return gObjectList.findObject(item->getUUID()); + return NULL; +} + void JCFloaterAreaSearch::onDoubleClick() { - LLScrollListItem *item = mResultList->getFirstSelected(); - if (!item) return; - LLUUID object_id = item->getUUID(); - std::map::iterator it = mCachedObjects.find(object_id); - if(it != mCachedObjects.end()) - { - LLViewerObject* objectp = gObjectList.findObject(object_id); - if (objectp) - { - LLTracker::trackLocation(objectp->getPositionGlobal(), it->second.name, "", LLTracker::LOCATION_ITEM); - } - } + if (LLViewerObject* objectp = getSelectedObject()) + LLTracker::trackLocation(objectp->getPositionGlobal(), mCachedObjects[objectp->getID()].name, "", LLTracker::LOCATION_ITEM); } +void JCFloaterAreaSearch::teleportToSelected() +{ + if (LLViewerObject* objectp = getSelectedObject()) + gAgent.teleportViaLocation(objectp->getPositionGlobal()); +} + +void JCFloaterAreaSearch::lookAtSelected() +{ + if (LLScrollListItem* item = mResultList->getFirstSelected()) + gAgentCamera.lookAtObject(item->getUUID(), false); +} + + void JCFloaterAreaSearch::onStop() { mStopped = true; diff --git a/indra/newview/jcfloaterareasearch.h b/indra/newview/jcfloaterareasearch.h index 71cd1c7af..413dbab99 100644 --- a/indra/newview/jcfloaterareasearch.h +++ b/indra/newview/jcfloaterareasearch.h @@ -72,7 +72,10 @@ private: void onRefresh(); void onCommitLine(LLUICtrl* caller, const LLSD& value, OBJECT_COLUMN_ORDER type); bool requestIfNeeded(LLUUID object_id); + class LLViewerObject* getSelectedObject(); void onDoubleClick(); + void teleportToSelected(); + void lookAtSelected(); LLTextBox* mCounterText; LLScrollListCtrl* mResultList; @@ -94,4 +97,4 @@ private: std::string mFilterStrings[LIST_OBJECT_COUNT]; }; -#endif \ No newline at end of file +#endif diff --git a/indra/newview/skins/default/xui/en-us/floater_area_search.xml b/indra/newview/skins/default/xui/en-us/floater_area_search.xml index 16b2bc1c6..cbaa02624 100644 --- a/indra/newview/skins/default/xui/en-us/floater_area_search.xml +++ b/indra/newview/skins/default/xui/en-us/floater_area_search.xml @@ -39,12 +39,14 @@ +