summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterparcel.cpp
diff options
context:
space:
mode:
authorJosh Bell <josh@lindenlab.com>2007-11-01 22:02:35 +0000
committerJosh Bell <josh@lindenlab.com>2007-11-01 22:02:35 +0000
commit7afa8058aae0d5363cc19c7df1e6d2d7ec3bf7ac (patch)
tree52f41bda3e57a58e968421212a8a48eead6f653d /indra/newview/llfloaterparcel.cpp
parent833e8d5c2a1dd48fd89b8b438dbe56572697bb76 (diff)
svn merge -r 72652:72881 svn+ssh://svn.lindenlab.com/svn/linden/branches/sl-search-11 --> release
QAR-11: pair-reviewed the merge w/ Sam.
Diffstat (limited to 'indra/newview/llfloaterparcel.cpp')
-rw-r--r--indra/newview/llfloaterparcel.cpp120
1 files changed, 120 insertions, 0 deletions
diff --git a/indra/newview/llfloaterparcel.cpp b/indra/newview/llfloaterparcel.cpp
new file mode 100644
index 0000000000..61b7176153
--- /dev/null
+++ b/indra/newview/llfloaterparcel.cpp
@@ -0,0 +1,120 @@
+/**
+ * @file llfloaterparcel.cpp
+ * @brief LLFloaterParcel class implementation
+ * Parcel information as shown in a floating window from secondlife:// command
+ * handler.
+ *
+ * Copyright (c) 2002-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+#include "llviewerprecompiledheaders.h"
+
+#include "llfloaterparcel.h"
+
+// viewer project includes
+#include "llcommandhandler.h"
+#include "llpanelplace.h"
+#include "llvieweruictrlfactory.h"
+
+// linden library includes
+#include "lluuid.h"
+
+//-----------------------------------------------------------------------------
+// Globals
+//-----------------------------------------------------------------------------
+
+LLMap< const LLUUID, LLFloaterParcelInfo* > gPlaceInfoInstances;
+
+class LLParcelHandler : public LLCommandHandler
+{
+public:
+ LLParcelHandler() : LLCommandHandler("parcel") { }
+ bool handle(const std::vector<std::string>& params)
+ {
+ if (params.size() < 2)
+ {
+ return false;
+ }
+ LLUUID parcel_id;
+ if (!parcel_id.set(params[0], FALSE))
+ {
+ return false;
+ }
+ if (params[1] == "about")
+ {
+ LLFloaterParcelInfo::show(parcel_id);
+ return true;
+ }
+ return false;
+ }
+};
+LLParcelHandler gParcelHandler;
+
+//-----------------------------------------------------------------------------
+// Member functions
+//-----------------------------------------------------------------------------
+
+//----------------------------------------------------------------------------
+
+void* LLFloaterParcelInfo::createPanelPlace(void* data)
+{
+ LLFloaterParcelInfo* self = (LLFloaterParcelInfo*)data;
+ self->mPanelParcelp = new LLPanelPlace(); // allow edit self
+ gUICtrlFactory->buildPanel(self->mPanelParcelp, "panel_place.xml");
+ return self->mPanelParcelp;
+}
+
+//----------------------------------------------------------------------------
+
+
+LLFloaterParcelInfo::LLFloaterParcelInfo(const std::string& name, const LLUUID &parcel_id)
+: LLFloater(name),
+ mParcelID( parcel_id )
+{
+ mFactoryMap["place_details_panel"] = LLCallbackMap(LLFloaterParcelInfo::createPanelPlace, this);
+ gUICtrlFactory->buildFloater(this, "floater_preview_url.xml", &getFactoryMap());
+ gPlaceInfoInstances.addData(parcel_id, this);
+}
+
+// virtual
+LLFloaterParcelInfo::~LLFloaterParcelInfo()
+{
+ // child views automatically deleted
+ gPlaceInfoInstances.removeData(mParcelID);
+
+}
+
+void LLFloaterParcelInfo::displayParcelInfo(const LLUUID& parcel_id)
+{
+ mPanelParcelp->setParcelID(parcel_id);
+}
+
+// static
+LLFloaterParcelInfo* LLFloaterParcelInfo::show(const LLUUID &parcel_id)
+{
+ if (parcel_id.isNull())
+ {
+ return NULL;
+ }
+
+ LLFloaterParcelInfo *floater;
+ if (gPlaceInfoInstances.checkData(parcel_id))
+ {
+ // ...bring that window to front
+ floater = gPlaceInfoInstances.getData(parcel_id);
+ floater->open(); /*Flawfinder: ignore*/
+ floater->setFrontmost(true);
+ }
+ else
+ {
+ floater = new LLFloaterParcelInfo("parcelinfo", parcel_id );
+ floater->center();
+ floater->open(); /*Flawfinder: ignore*/
+ floater->displayParcelInfo(parcel_id);
+ floater->setFrontmost(true);
+ }
+
+ return floater;
+}
+
+