diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llfloaterparcel.cpp | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/linden/indra/newview/llfloaterparcel.cpp b/linden/indra/newview/llfloaterparcel.cpp new file mode 100644 index 0000000..a63987a --- /dev/null +++ b/linden/indra/newview/llfloaterparcel.cpp | |||
@@ -0,0 +1,133 @@ | |||
1 | /** | ||
2 | * @file llfloaterparcel.cpp | ||
3 | * @brief LLFloaterParcel class implementation | ||
4 | * Parcel information as shown in a floating window from secondlife:// command | ||
5 | * handler. | ||
6 | * | ||
7 | * $LicenseInfo:firstyear=2002&license=internal$ | ||
8 | * | ||
9 | * Copyright (c) 2002-2007, Linden Research, Inc. | ||
10 | * | ||
11 | * The following source code is PROPRIETARY AND CONFIDENTIAL. Use of | ||
12 | * this source code is governed by the Linden Lab Source Code Disclosure | ||
13 | * Agreement ("Agreement") previously entered between you and Linden | ||
14 | * Lab. By accessing, using, copying, modifying or distributing this | ||
15 | * software, you acknowledge that you have been informed of your | ||
16 | * obligations under the Agreement and agree to abide by those obligations. | ||
17 | * | ||
18 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
19 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
20 | * COMPLETENESS OR PERFORMANCE. | ||
21 | * $/LicenseInfo$ | ||
22 | */ | ||
23 | #include "llviewerprecompiledheaders.h" | ||
24 | |||
25 | #include "llfloaterparcel.h" | ||
26 | |||
27 | // viewer project includes | ||
28 | #include "llcommandhandler.h" | ||
29 | #include "llpanelplace.h" | ||
30 | #include "llvieweruictrlfactory.h" | ||
31 | |||
32 | // linden library includes | ||
33 | #include "lluuid.h" | ||
34 | |||
35 | //----------------------------------------------------------------------------- | ||
36 | // Globals | ||
37 | //----------------------------------------------------------------------------- | ||
38 | |||
39 | LLMap< const LLUUID, LLFloaterParcelInfo* > gPlaceInfoInstances; | ||
40 | |||
41 | class LLParcelHandler : public LLCommandHandler | ||
42 | { | ||
43 | public: | ||
44 | LLParcelHandler() : LLCommandHandler("parcel") { } | ||
45 | bool handle(const std::vector<std::string>& params) | ||
46 | { | ||
47 | if (params.size() < 2) | ||
48 | { | ||
49 | return false; | ||
50 | } | ||
51 | LLUUID parcel_id; | ||
52 | if (!parcel_id.set(params[0], FALSE)) | ||
53 | { | ||
54 | return false; | ||
55 | } | ||
56 | if (params[1] == "about") | ||
57 | { | ||
58 | LLFloaterParcelInfo::show(parcel_id); | ||
59 | return true; | ||
60 | } | ||
61 | return false; | ||
62 | } | ||
63 | }; | ||
64 | LLParcelHandler gParcelHandler; | ||
65 | |||
66 | //----------------------------------------------------------------------------- | ||
67 | // Member functions | ||
68 | //----------------------------------------------------------------------------- | ||
69 | |||
70 | //---------------------------------------------------------------------------- | ||
71 | |||
72 | void* LLFloaterParcelInfo::createPanelPlace(void* data) | ||
73 | { | ||
74 | LLFloaterParcelInfo* self = (LLFloaterParcelInfo*)data; | ||
75 | self->mPanelParcelp = new LLPanelPlace(); // allow edit self | ||
76 | gUICtrlFactory->buildPanel(self->mPanelParcelp, "panel_place.xml"); | ||
77 | return self->mPanelParcelp; | ||
78 | } | ||
79 | |||
80 | //---------------------------------------------------------------------------- | ||
81 | |||
82 | |||
83 | LLFloaterParcelInfo::LLFloaterParcelInfo(const std::string& name, const LLUUID &parcel_id) | ||
84 | : LLFloater(name), | ||
85 | mParcelID( parcel_id ) | ||
86 | { | ||
87 | mFactoryMap["place_details_panel"] = LLCallbackMap(LLFloaterParcelInfo::createPanelPlace, this); | ||
88 | gUICtrlFactory->buildFloater(this, "floater_preview_url.xml", &getFactoryMap()); | ||
89 | gPlaceInfoInstances.addData(parcel_id, this); | ||
90 | } | ||
91 | |||
92 | // virtual | ||
93 | LLFloaterParcelInfo::~LLFloaterParcelInfo() | ||
94 | { | ||
95 | // child views automatically deleted | ||
96 | gPlaceInfoInstances.removeData(mParcelID); | ||
97 | |||
98 | } | ||
99 | |||
100 | void LLFloaterParcelInfo::displayParcelInfo(const LLUUID& parcel_id) | ||
101 | { | ||
102 | mPanelParcelp->setParcelID(parcel_id); | ||
103 | } | ||
104 | |||
105 | // static | ||
106 | LLFloaterParcelInfo* LLFloaterParcelInfo::show(const LLUUID &parcel_id) | ||
107 | { | ||
108 | if (parcel_id.isNull()) | ||
109 | { | ||
110 | return NULL; | ||
111 | } | ||
112 | |||
113 | LLFloaterParcelInfo *floater; | ||
114 | if (gPlaceInfoInstances.checkData(parcel_id)) | ||
115 | { | ||
116 | // ...bring that window to front | ||
117 | floater = gPlaceInfoInstances.getData(parcel_id); | ||
118 | floater->open(); /*Flawfinder: ignore*/ | ||
119 | floater->setFrontmost(true); | ||
120 | } | ||
121 | else | ||
122 | { | ||
123 | floater = new LLFloaterParcelInfo("parcelinfo", parcel_id ); | ||
124 | floater->center(); | ||
125 | floater->open(); /*Flawfinder: ignore*/ | ||
126 | floater->displayParcelInfo(parcel_id); | ||
127 | floater->setFrontmost(true); | ||
128 | } | ||
129 | |||
130 | return floater; | ||
131 | } | ||
132 | |||
133 | |||