summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterinspect.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloaterinspect.cpp')
-rw-r--r--indra/newview/llfloaterinspect.cpp146
1 files changed, 60 insertions, 86 deletions
diff --git a/indra/newview/llfloaterinspect.cpp b/indra/newview/llfloaterinspect.cpp
index 4b29a304ac..691f1b206c 100644
--- a/indra/newview/llfloaterinspect.cpp
+++ b/indra/newview/llfloaterinspect.cpp
@@ -2,31 +2,25 @@
* @file llfloaterinspect.cpp
* @brief Floater for object inspection tool
*
- * $LicenseInfo:firstyear=2006&license=viewergpl$
- *
- * Copyright (c) 2006-2009, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,7 +30,7 @@
#include "llfloaterreg.h"
#include "llfloatertools.h"
-#include "llfriendactions.h"
+#include "llavataractions.h"
#include "llcachename.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
@@ -47,13 +41,27 @@
#include "llviewerobject.h"
#include "lluictrlfactory.h"
-LLFloaterInspect* LLFloaterInspect::sInstance = NULL;
+//LLFloaterInspect* LLFloaterInspect::sInstance = NULL;
-LLFloaterInspect::LLFloaterInspect(void)
- : LLFloater(),
+LLFloaterInspect::LLFloaterInspect(const LLSD& key)
+ : LLFloater(key),
mDirty(FALSE)
{
- LLUICtrlFactory::getInstance()->buildFloater(this, "floater_inspect.xml");
+ mCommitCallbackRegistrar.add("Inspect.OwnerProfile", boost::bind(&LLFloaterInspect::onClickOwnerProfile, this));
+ mCommitCallbackRegistrar.add("Inspect.CreatorProfile", boost::bind(&LLFloaterInspect::onClickCreatorProfile, this));
+ mCommitCallbackRegistrar.add("Inspect.SelectObject", boost::bind(&LLFloaterInspect::onSelectObject, this));
+}
+
+BOOL LLFloaterInspect::postBuild()
+{
+ mObjectList = getChild<LLScrollListCtrl>("object_list");
+// childSetAction("button owner",onClickOwnerProfile, this);
+// childSetAction("button creator",onClickCreatorProfile, this);
+// childSetCommitCallback("object_list", onSelectObject, NULL);
+
+ refresh();
+
+ return TRUE;
}
LLFloaterInspect::~LLFloaterInspect(void)
@@ -71,42 +79,24 @@ LLFloaterInspect::~LLFloaterInspect(void)
{
LLFloaterReg::showInstance("build", LLSD(), TRUE);
}
- sInstance = NULL;
-}
-
-BOOL LLFloaterInspect::isVisible()
-{
- return (!!sInstance);
+ //sInstance = NULL;
}
-void LLFloaterInspect::show(void* ignored)
+void LLFloaterInspect::onOpen(const LLSD& key)
{
- // setForceSelection ensures that the pie menu does not deselect things when it
- // looses the focus (this can happen with "select own objects only" enabled
- // VWR-1471
BOOL forcesel = LLSelectMgr::getInstance()->setForceSelection(TRUE);
-
- if (!sInstance) // first use
- {
- sInstance = new LLFloaterInspect;
- }
-
- sInstance->openFloater();
LLToolMgr::getInstance()->setTransientTool(LLToolCompInspect::getInstance());
LLSelectMgr::getInstance()->setForceSelection(forcesel); // restore previouis value
-
- sInstance->mObjectSelection = LLSelectMgr::getInstance()->getSelection();
- sInstance->refresh();
+ mObjectSelection = LLSelectMgr::getInstance()->getSelection();
+ refresh();
}
-
-void LLFloaterInspect::onClickCreatorProfile(void* ctrl)
+void LLFloaterInspect::onClickCreatorProfile()
{
- if(sInstance->mObjectList->getAllSelected().size() == 0)
+ if(mObjectList->getAllSelected().size() == 0)
{
return;
}
- LLScrollListItem* first_selected =
- sInstance->mObjectList->getFirstSelected();
+ LLScrollListItem* first_selected =mObjectList->getFirstSelected();
if (first_selected)
{
@@ -119,19 +109,18 @@ void LLFloaterInspect::onClickCreatorProfile(void* ctrl)
return (obj_id == node->getObject()->getID());
}
} func(first_selected->getUUID());
- LLSelectNode* node = sInstance->mObjectSelection->getFirstNode(&func);
+ LLSelectNode* node = mObjectSelection->getFirstNode(&func);
if(node)
{
- LLFriendActions::showProfile(node->mPermissions->getCreator());
+ LLAvatarActions::showProfile(node->mPermissions->getCreator());
}
}
}
-void LLFloaterInspect::onClickOwnerProfile(void* ctrl)
+void LLFloaterInspect::onClickOwnerProfile()
{
- if(sInstance->mObjectList->getAllSelected().size() == 0) return;
- LLScrollListItem* first_selected =
- sInstance->mObjectList->getFirstSelected();
+ if(mObjectList->getAllSelected().size() == 0) return;
+ LLScrollListItem* first_selected =mObjectList->getFirstSelected();
if (first_selected)
{
@@ -145,46 +134,34 @@ void LLFloaterInspect::onClickOwnerProfile(void* ctrl)
return (obj_id == node->getObject()->getID());
}
} func(selected_id);
- LLSelectNode* node = sInstance->mObjectSelection->getFirstNode(&func);
+ LLSelectNode* node = mObjectSelection->getFirstNode(&func);
if(node)
{
const LLUUID& owner_id = node->mPermissions->getOwner();
- LLFriendActions::showProfile(owner_id);
+ LLAvatarActions::showProfile(owner_id);
}
}
}
-BOOL LLFloaterInspect::postBuild()
-{
- mObjectList = getChild<LLScrollListCtrl>("object_list");
- childSetAction("button owner",onClickOwnerProfile, this);
- childSetAction("button creator",onClickCreatorProfile, this);
- childSetCommitCallback("object_list", onSelectObject, NULL);
- return TRUE;
-}
-
-void LLFloaterInspect::onSelectObject(LLUICtrl* ctrl, void* user_data)
+void LLFloaterInspect::onSelectObject()
{
if(LLFloaterInspect::getSelectedUUID() != LLUUID::null)
{
- sInstance->childSetEnabled("button owner", true);
- sInstance->childSetEnabled("button creator", true);
+ getChildView("button owner")->setEnabled(true);
+ getChildView("button creator")->setEnabled(true);
}
}
LLUUID LLFloaterInspect::getSelectedUUID()
{
- if(sInstance)
+ if(mObjectList->getAllSelected().size() > 0)
{
- if(sInstance->mObjectList->getAllSelected().size() > 0)
+ LLScrollListItem* first_selected =mObjectList->getFirstSelected();
+ if (first_selected)
{
- LLScrollListItem* first_selected =
- sInstance->mObjectList->getFirstSelected();
- if (first_selected)
- {
- return first_selected->getUUID();
- }
+ return first_selected->getUUID();
}
+
}
return LLUUID::null;
}
@@ -194,8 +171,8 @@ void LLFloaterInspect::refresh()
LLUUID creator_id;
std::string creator_name;
S32 pos = mObjectList->getScrollPos();
- childSetEnabled("button owner", false);
- childSetEnabled("button creator", false);
+ getChildView("button owner")->setEnabled(false);
+ getChildView("button creator")->setEnabled(false);
LLUUID selected_uuid;
S32 selected_index = mObjectList->getFirstSelectedIndex();
if(selected_index > -1)
@@ -262,7 +239,7 @@ void LLFloaterInspect::refresh()
{
mObjectList->selectNthItem(0);
}
- onSelectObject(this, NULL);
+ onSelectObject();
mObjectList->setScrollPos(pos);
}
@@ -274,10 +251,7 @@ void LLFloaterInspect::onFocusReceived()
void LLFloaterInspect::dirty()
{
- if(sInstance)
- {
- sInstance->setDirty();
- }
+ setDirty();
}
void LLFloaterInspect::draw()