diff options
-rw-r--r-- | indra/newview/llfloaterpathfindingcharacters.cpp | 96 | ||||
-rw-r--r-- | indra/newview/llfloaterpathfindingcharacters.h | 5 | ||||
-rw-r--r-- | indra/newview/llviewermenu.cpp | 1 | ||||
-rw-r--r-- | indra/newview/llviewermenu.h | 7 |
4 files changed, 84 insertions, 25 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
//---------------------------------------------------------------------------
diff --git a/indra/newview/llfloaterpathfindingcharacters.h b/indra/newview/llfloaterpathfindingcharacters.h index 689d2ff418..1e4acd084e 100644 --- a/indra/newview/llfloaterpathfindingcharacters.h +++ b/indra/newview/llfloaterpathfindingcharacters.h @@ -64,6 +64,8 @@ public: virtual BOOL postBuild();
virtual void onOpen(const LLSD& pKey);
+ virtual void onClose(bool app_quitting);
+ virtual void draw();
EMessagingState getMessagingState() const;
BOOL isMessagingInProgress() const;
@@ -85,7 +87,7 @@ private: LLButton *mReturnBtn;
LLButton *mDeleteBtn;
LLButton *mTeleportBtn;
- LLObjectSelectionHandle mSelection;
+ LLObjectSelectionHandle mCharacterSelection;
// Does its own instance management, so clients not allowed
// to allocate or destroy.
@@ -107,7 +109,6 @@ private: void onRefreshCharactersClicked();
void onSelectAllCharactersClicked();
void onSelectNoneCharactersClicked();
- void onShowBeaconToggled();
void onTakeCharactersClicked();
void onTakeCopyCharactersClicked();
void onReturnCharactersClicked();
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 99540ccce9..d2c441ce73 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -197,7 +197,6 @@ void near_sit_object(); BOOL is_selection_buy_not_take(); S32 selection_price(); BOOL enable_take(); -void handle_take(); void handle_object_show_inspector(); void handle_avatar_show_inspector(); bool confirm_take(const LLSD& notification, const LLSD& response); diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h index 87cb4efbc4..6316141e75 100644 --- a/indra/newview/llviewermenu.h +++ b/indra/newview/llviewermenu.h @@ -93,11 +93,18 @@ void handle_object_touch(); bool enable_object_open(); void handle_object_open(); +bool visible_take_object(); +bool tools_visible_take_object(); +bool enable_object_take_copy(); +bool enable_object_delete(); + // Buy either contents or object itself void handle_buy(); +void handle_take(); void handle_take_copy(); void handle_look_at_selection(const LLSD& param); void handle_zoom_to_object(LLUUID object_id); +void handle_object_delete(); void handle_buy_land(); |