summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterpathfindingcharacters.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloaterpathfindingcharacters.cpp')
-rw-r--r--indra/newview/llfloaterpathfindingcharacters.cpp96
1 files changed, 74 insertions, 22 deletions
diff --git a/indra/newview/llfloaterpathfindingcharacters.cpp b/indra/newview/llfloaterpathfindingcharacters.cpp
index de431bbf89..561ad9535b 100644
--- a/indra/newview/llfloaterpathfindingcharacters.cpp
+++ b/indra/newview/llfloaterpathfindingcharacters.cpp
@@ -45,6 +45,7 @@
#include "lluuid.h"
#include "llviewerobject.h"
#include "llviewerobjectlist.h"
+#include "llviewermenu.h"
#include "llselectmgr.h"
//---------------------------------------------------------------------------
@@ -81,7 +82,6 @@ BOOL LLFloaterPathfindingCharacters::postBuild()
mCharactersScrollList = findChild<LLScrollListCtrl>("pathfinding_characters");
llassert(mCharactersScrollList != NULL);
mCharactersScrollList->setCommitCallback(boost::bind(&LLFloaterPathfindingCharacters::onCharactersSelectionChange, this));
- mCharactersScrollList->setCommitOnSelectionChange(true);
mCharactersScrollList->sortByColumnIndex(0, true);
mCharactersStatus = findChild<LLTextBase>("characters_status");
@@ -92,7 +92,6 @@ BOOL LLFloaterPathfindingCharacters::postBuild()
mShowBeaconCheckBox = findChild<LLCheckBoxCtrl>("show_beacon");
llassert(mShowBeaconCheckBox != NULL);
- mShowBeaconCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingCharacters::onShowBeaconToggled, this));
mTakeBtn = findChild<LLButton>("take_characters");
llassert(mTakeBtn != NULL)
@@ -123,6 +122,35 @@ BOOL LLFloaterPathfindingCharacters::postBuild()
void LLFloaterPathfindingCharacters::onOpen(const LLSD& pKey)
{
sendCharactersDataGetRequest();
+ selectNoneCharacters();
+ mCharactersScrollList->setCommitOnSelectionChange(true);
+}
+
+void LLFloaterPathfindingCharacters::onClose(bool app_quitting)
+{
+ mCharactersScrollList->setCommitOnSelectionChange(false);
+ selectNoneCharacters();
+ if (mCharacterSelection.notNull())
+ {
+ std::vector<LLViewerObject *> selectedObjects;
+
+ LLObjectSelection *charactersSelected = mCharacterSelection.get();
+ for (LLObjectSelection::valid_iterator characterIter = charactersSelected->valid_begin();
+ characterIter != charactersSelected->valid_end(); ++characterIter)
+ {
+ LLSelectNode *characterNode = *characterIter;
+ selectedObjects.push_back(characterNode->getObject());
+ }
+
+ for (std::vector<LLViewerObject *>::const_iterator selectedObjectIter = selectedObjects.begin();
+ selectedObjectIter != selectedObjects.end(); ++selectedObjectIter)
+ {
+ LLViewerObject *selectedObject = *selectedObjectIter;
+ LLSelectMgr::getInstance()->deselectObjectAndFamily(selectedObject);
+ }
+
+ mCharacterSelection.clear();
+ }
}
LLFloaterPathfindingCharacters::EMessagingState LLFloaterPathfindingCharacters::getMessagingState() const
@@ -163,7 +191,7 @@ LLFloaterPathfindingCharacters::LLFloaterPathfindingCharacters(const LLSD& pSeed
mReturnBtn(NULL),
mDeleteBtn(NULL),
mTeleportBtn(NULL),
- mSelection()
+ mCharacterSelection()
{
mSelfHandle.bind(this);
}
@@ -171,7 +199,7 @@ LLFloaterPathfindingCharacters::LLFloaterPathfindingCharacters(const LLSD& pSeed
LLFloaterPathfindingCharacters::~LLFloaterPathfindingCharacters()
{
mPathfindingCharacters.clear();
- mSelection.clear();
+ mCharacterSelection.clear();
}
void LLFloaterPathfindingCharacters::sendCharactersDataGetRequest()
@@ -268,10 +296,10 @@ void LLFloaterPathfindingCharacters::setMessagingState(EMessagingState pMessagin
void LLFloaterPathfindingCharacters::onCharactersSelectionChange()
{
-#if 0
- std::vector<LLScrollListItem*> selectedItems = mCharactersScrollList->getAllSelected();
-
+ mCharacterSelection.clear();
LLSelectMgr::getInstance()->deselectAll();
+
+ std::vector<LLScrollListItem*> selectedItems = mCharactersScrollList->getAllSelected();
if (!selectedItems.empty())
{
int numSelectedItems = selectedItems.size();
@@ -287,17 +315,15 @@ void LLFloaterPathfindingCharacters::onCharactersSelectionChange()
LLViewerObject *viewerObject = gObjectList.findObject(selectedItem->getUUID());
if (viewerObject != NULL)
{
- viewerObject->setSelected(true);
viewerObjects.push_back(viewerObject);
}
}
if (!viewerObjects.empty())
{
- mSelection = LLSelectMgr::getInstance()->selectObjectAndFamily(viewerObjects);
+ mCharacterSelection = LLSelectMgr::getInstance()->selectObjectAndFamily(viewerObjects);
}
}
-#endif
updateCharactersStatusMessage();
updateActionFields();
@@ -318,19 +344,14 @@ void LLFloaterPathfindingCharacters::onSelectNoneCharactersClicked()
selectNoneCharacters();
}
-void LLFloaterPathfindingCharacters::onShowBeaconToggled()
-{
- llwarns << "functionality has not yet been implemented to toggle show beacon" << llendl;
-}
-
void LLFloaterPathfindingCharacters::onTakeCharactersClicked()
{
- llwarns << "functionality has not yet been implemented to take characters" << llendl;
+ handle_take();
}
void LLFloaterPathfindingCharacters::onTakeCopyCharactersClicked()
{
- llwarns << "functionality has not yet been implemented to take a copy of characters" << llendl;
+ handle_take_copy();
}
void LLFloaterPathfindingCharacters::onReturnCharactersClicked()
@@ -340,7 +361,7 @@ void LLFloaterPathfindingCharacters::onReturnCharactersClicked()
void LLFloaterPathfindingCharacters::onDeleteCharactersClicked()
{
- llwarns << "functionality has not yet been implemented to delete characters" << llendl;
+ handle_object_delete();
}
void LLFloaterPathfindingCharacters::onTeleportCharacterToMeClicked()
@@ -504,14 +525,45 @@ void LLFloaterPathfindingCharacters::updateActionFields()
void LLFloaterPathfindingCharacters::setEnableActionFields(BOOL pEnabled)
{
mLabelActions->setEnabled(pEnabled);
- mShowBeaconCheckBox->setEnabled(false && pEnabled);
- mTakeBtn->setEnabled(false && pEnabled);
- mTakeCopyBtn->setEnabled(false && pEnabled);
+ mShowBeaconCheckBox->setEnabled(pEnabled);
+ mTakeBtn->setEnabled(pEnabled && tools_visible_take_object());
+ mTakeCopyBtn->setEnabled(pEnabled && enable_object_take_copy());
mReturnBtn->setEnabled(false && pEnabled);
- mDeleteBtn->setEnabled(false && pEnabled);
+ mDeleteBtn->setEnabled(pEnabled && enable_object_delete());
mTeleportBtn->setEnabled(pEnabled && (mCharactersScrollList->getNumSelected() == 1));
}
+void LLFloaterPathfindingCharacters::draw()
+{
+ if (mShowBeaconCheckBox->get())
+ {
+ std::vector<LLScrollListItem*> selectedItems = mCharactersScrollList->getAllSelected();
+ if (!selectedItems.empty())
+ {
+ int numSelectedItems = selectedItems.size();
+
+ std::vector<LLViewerObject *> viewerObjects;
+ viewerObjects.reserve(numSelectedItems);
+
+ for (std::vector<LLScrollListItem*>::const_iterator selectedItemIter = selectedItems.begin();
+ selectedItemIter != selectedItems.end(); ++selectedItemIter)
+ {
+ const LLScrollListItem *selectedItem = *selectedItemIter;
+
+ const std::string &objectName = selectedItem->getColumn(0)->getValue().asString();
+
+ LLViewerObject *viewerObject = gObjectList.findObject(selectedItem->getUUID());
+ if (viewerObject != NULL)
+ {
+ gObjectList.addDebugBeacon(viewerObject->getPositionAgent(), objectName, LLColor4(0.f, 0.f, 1.f, 0.8f), LLColor4(1.f, 1.f, 1.f, 1.f), 6);
+ }
+ }
+ }
+ }
+
+ LLFloater::draw();
+}
+
//---------------------------------------------------------------------------
// CharactersGetResponder
//---------------------------------------------------------------------------