diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llpanelplace.cpp | |
parent | README.txt (diff) | |
download | meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2 meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz |
Second Life viewer sources 1.13.2.12
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llpanelplace.cpp | 290 |
1 files changed, 290 insertions, 0 deletions
diff --git a/linden/indra/newview/llpanelplace.cpp b/linden/indra/newview/llpanelplace.cpp new file mode 100644 index 0000000..4f316c9 --- /dev/null +++ b/linden/indra/newview/llpanelplace.cpp | |||
@@ -0,0 +1,290 @@ | |||
1 | /** | ||
2 | * @file llpanelplace.cpp | ||
3 | * @brief Display of a place in the Find directory. | ||
4 | * | ||
5 | * Copyright (c) 2004-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
8 | * to you under the terms of the GNU General Public License, version 2.0 | ||
9 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
10 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
11 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
12 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
13 | * | ||
14 | * There are special exceptions to the terms and conditions of the GPL as | ||
15 | * it is applied to this Source Code. View the full text of the exception | ||
16 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
17 | * online at http://secondlife.com/developers/opensource/flossexception | ||
18 | * | ||
19 | * By copying, modifying or distributing this software, you acknowledge | ||
20 | * that you have read and understood your obligations described above, | ||
21 | * and agree to abide by those obligations. | ||
22 | * | ||
23 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
24 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
25 | * COMPLETENESS OR PERFORMANCE. | ||
26 | */ | ||
27 | |||
28 | #include "llviewerprecompiledheaders.h" | ||
29 | |||
30 | #include "llpanelplace.h" | ||
31 | |||
32 | #include "llviewercontrol.h" | ||
33 | #include "llqueryflags.h" | ||
34 | #include "message.h" | ||
35 | #include "llui.h" | ||
36 | #include "llsecondlifeurls.h" | ||
37 | |||
38 | #include "llagent.h" | ||
39 | #include "llviewerwindow.h" | ||
40 | #include "llbutton.h" | ||
41 | #include "llfloaterworldmap.h" | ||
42 | #include "lllineeditor.h" | ||
43 | #include "lluiconstants.h" | ||
44 | #include "lltextbox.h" | ||
45 | #include "llviewertexteditor.h" | ||
46 | #include "lltexturectrl.h" | ||
47 | #include "llworldmap.h" | ||
48 | #include "llviewerregion.h" | ||
49 | #include "llvieweruictrlfactory.h" | ||
50 | //#include "llviewermenu.h" // create_landmark() | ||
51 | #include "llweb.h" | ||
52 | |||
53 | //static | ||
54 | LLLinkedList<LLPanelPlace> LLPanelPlace::sAllPanels; | ||
55 | |||
56 | LLPanelPlace::LLPanelPlace() | ||
57 | : LLPanel("Places Panel"), | ||
58 | mParcelID(), | ||
59 | mPosGlobal(), | ||
60 | mAuctionID(0) | ||
61 | { | ||
62 | sAllPanels.addData(this); | ||
63 | } | ||
64 | |||
65 | |||
66 | LLPanelPlace::~LLPanelPlace() | ||
67 | { | ||
68 | sAllPanels.removeData(this); | ||
69 | } | ||
70 | |||
71 | |||
72 | BOOL LLPanelPlace::postBuild() | ||
73 | { | ||
74 | // Since this is only used in the directory browser, always | ||
75 | // disable the snapshot control. Otherwise clicking on it will | ||
76 | // open a texture picker. | ||
77 | mSnapshotCtrl = LLViewerUICtrlFactory::getTexturePickerByName(this, "snapshot_ctrl"); | ||
78 | mSnapshotCtrl->setEnabled(FALSE); | ||
79 | |||
80 | mNameEditor = LLViewerUICtrlFactory::getLineEditorByName(this, "name_editor"); | ||
81 | |||
82 | mDescEditor = LLUICtrlFactory::getTextEditorByName(this, "desc_editor"); | ||
83 | |||
84 | mInfoEditor = LLViewerUICtrlFactory::getLineEditorByName(this, "info_editor"); | ||
85 | |||
86 | mLocationEditor = LLViewerUICtrlFactory::getLineEditorByName(this, "location_editor"); | ||
87 | |||
88 | mTeleportBtn = LLViewerUICtrlFactory::getButtonByName(this, "teleport_btn"); | ||
89 | mTeleportBtn->setClickedCallback(onClickTeleport); | ||
90 | mTeleportBtn->setCallbackUserData(this); | ||
91 | |||
92 | mMapBtn = LLViewerUICtrlFactory::getButtonByName(this, "map_btn"); | ||
93 | mMapBtn->setClickedCallback(onClickMap); | ||
94 | mMapBtn->setCallbackUserData(this); | ||
95 | |||
96 | //mLandmarkBtn = LLViewerUICtrlFactory::getButtonByName(this, "landmark_btn"); | ||
97 | //mLandmarkBtn->setClickedCallback(onClickLandmark); | ||
98 | //mLandmarkBtn->setCallbackUserData(this); | ||
99 | |||
100 | mAuctionBtn = LLViewerUICtrlFactory::getButtonByName(this, "auction_btn"); | ||
101 | mAuctionBtn->setClickedCallback(onClickAuction); | ||
102 | mAuctionBtn->setCallbackUserData(this); | ||
103 | |||
104 | // Default to no auction button. We'll show it if we get an auction id | ||
105 | mAuctionBtn->setVisible(FALSE); | ||
106 | |||
107 | return TRUE; | ||
108 | } | ||
109 | |||
110 | |||
111 | |||
112 | void LLPanelPlace::setParcelID(const LLUUID& parcel_id) | ||
113 | { | ||
114 | mParcelID = parcel_id; | ||
115 | } | ||
116 | |||
117 | |||
118 | void LLPanelPlace::sendParcelInfoRequest() | ||
119 | { | ||
120 | LLMessageSystem *msg = gMessageSystem; | ||
121 | |||
122 | if (mParcelID != mRequestedID) | ||
123 | { | ||
124 | msg->newMessage("ParcelInfoRequest"); | ||
125 | msg->nextBlockFast(_PREHASH_AgentData); | ||
126 | msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); | ||
127 | msg->addUUID("SessionID", gAgent.getSessionID()); | ||
128 | msg->nextBlock("Data"); | ||
129 | msg->addUUID("ParcelID", mParcelID); | ||
130 | gAgent.sendReliableMessage(); | ||
131 | mRequestedID = mParcelID; | ||
132 | } | ||
133 | } | ||
134 | |||
135 | |||
136 | //static | ||
137 | void LLPanelPlace::processParcelInfoReply(LLMessageSystem *msg, void **) | ||
138 | { | ||
139 | LLUUID agent_id; | ||
140 | LLUUID parcel_id; | ||
141 | LLUUID owner_id; | ||
142 | char name[MAX_STRING]; | ||
143 | char desc[MAX_STRING]; | ||
144 | S32 actual_area; | ||
145 | S32 billable_area; | ||
146 | U8 flags; | ||
147 | F32 global_x; | ||
148 | F32 global_y; | ||
149 | F32 global_z; | ||
150 | char sim_name[MAX_STRING]; | ||
151 | LLUUID snapshot_id; | ||
152 | F32 dwell; | ||
153 | S32 sale_price; | ||
154 | S32 auction_id; | ||
155 | char buffer[256]; | ||
156 | |||
157 | msg->getUUID("AgentData", "AgentID", agent_id ); | ||
158 | msg->getUUID("Data", "ParcelID", parcel_id); | ||
159 | |||
160 | // look up all panels which have this avatar | ||
161 | LLPanelPlace *self = NULL; | ||
162 | |||
163 | for (self = sAllPanels.getFirstData(); self; self = sAllPanels.getNextData()) | ||
164 | { | ||
165 | if (self->mParcelID != parcel_id) | ||
166 | { | ||
167 | continue; | ||
168 | } | ||
169 | |||
170 | msg->getUUID ("Data", "OwnerID", owner_id); | ||
171 | msg->getString ("Data", "Name", MAX_STRING, name); | ||
172 | msg->getString ("Data", "Desc", MAX_STRING, desc); | ||
173 | msg->getS32 ("Data", "ActualArea", actual_area); | ||
174 | msg->getS32 ("Data", "BillableArea", billable_area); | ||
175 | msg->getU8 ("Data", "Flags", flags); | ||
176 | msg->getF32 ("Data", "GlobalX", global_x); | ||
177 | msg->getF32 ("Data", "GlobalY", global_y); | ||
178 | msg->getF32 ("Data", "GlobalZ", global_z); | ||
179 | msg->getString ("Data", "SimName", MAX_STRING, sim_name); | ||
180 | msg->getUUID ("Data", "SnapshotID", snapshot_id); | ||
181 | msg->getF32 ("Data", "Dwell", dwell); | ||
182 | msg->getS32 ("Data", "SalePrice", sale_price); | ||
183 | msg->getS32 ("Data", "AuctionID", auction_id); | ||
184 | |||
185 | self->mPosGlobal.setVec(global_x, global_y, global_z); | ||
186 | |||
187 | self->mAuctionID = auction_id; | ||
188 | |||
189 | self->mSnapshotCtrl->setImageAssetID(snapshot_id); | ||
190 | |||
191 | self->mNameEditor->setText(name); | ||
192 | |||
193 | self->mDescEditor->setText(desc); | ||
194 | |||
195 | LLString info; | ||
196 | sprintf(buffer, "Traffic: %.0f, Area: %d sq. m.", dwell, actual_area); | ||
197 | info.append(buffer); | ||
198 | if (flags & DFQ_FOR_SALE) | ||
199 | { | ||
200 | sprintf(buffer, ", For Sale for L$%d", sale_price); | ||
201 | info.append(buffer); | ||
202 | } | ||
203 | if (auction_id != 0) | ||
204 | { | ||
205 | sprintf(buffer, ", Auction ID %010d", auction_id); | ||
206 | info.append(buffer); | ||
207 | } | ||
208 | self->mInfoEditor->setText(info); | ||
209 | |||
210 | S32 region_x = llround(global_x) % REGION_WIDTH_UNITS; | ||
211 | S32 region_y = llround(global_y) % REGION_WIDTH_UNITS; | ||
212 | S32 region_z = llround(global_z); | ||
213 | |||
214 | // HACK: Flag 0x1 == mature region, otherwise assume PG | ||
215 | const char* rating = LLViewerRegion::accessToString(SIM_ACCESS_PG); | ||
216 | if (flags & 0x1) | ||
217 | { | ||
218 | rating = LLViewerRegion::accessToString(SIM_ACCESS_MATURE); | ||
219 | } | ||
220 | |||
221 | sprintf(buffer, "%s %d, %d, %d (%s)", | ||
222 | sim_name, region_x, region_y, region_z, rating); | ||
223 | self->mLocationEditor->setText(buffer); | ||
224 | |||
225 | BOOL show_auction = (auction_id > 0); | ||
226 | self->mAuctionBtn->setVisible(show_auction); | ||
227 | } | ||
228 | } | ||
229 | |||
230 | |||
231 | // static | ||
232 | void LLPanelPlace::onClickTeleport(void* data) | ||
233 | { | ||
234 | LLPanelPlace* self = (LLPanelPlace*)data; | ||
235 | |||
236 | if (!self->mPosGlobal.isExactlyZero()) | ||
237 | { | ||
238 | gAgent.teleportViaLocation(self->mPosGlobal); | ||
239 | gFloaterWorldMap->trackLocation(self->mPosGlobal); | ||
240 | } | ||
241 | } | ||
242 | |||
243 | // static | ||
244 | void LLPanelPlace::onClickMap(void* data) | ||
245 | { | ||
246 | LLPanelPlace* self = (LLPanelPlace*)data; | ||
247 | |||
248 | if (!self->mPosGlobal.isExactlyZero()) | ||
249 | { | ||
250 | gFloaterWorldMap->trackLocation(self->mPosGlobal); | ||
251 | LLFloaterWorldMap::show(NULL, TRUE); | ||
252 | } | ||
253 | } | ||
254 | |||
255 | // static | ||
256 | /* | ||
257 | void LLPanelPlace::onClickLandmark(void* data) | ||
258 | { | ||
259 | LLPanelPlace* self = (LLPanelPlace*)data; | ||
260 | |||
261 | create_landmark(self->mNameEditor->getText(), "", self->mPosGlobal); | ||
262 | } | ||
263 | */ | ||
264 | |||
265 | |||
266 | // static | ||
267 | void LLPanelPlace::onClickAuction(void* data) | ||
268 | { | ||
269 | LLPanelPlace* self = (LLPanelPlace*)data; | ||
270 | |||
271 | gViewerWindow->alertXml("GoToAuctionPage", | ||
272 | callbackAuctionWebPage, | ||
273 | self); | ||
274 | } | ||
275 | |||
276 | // static | ||
277 | void LLPanelPlace::callbackAuctionWebPage(S32 option, void* data) | ||
278 | { | ||
279 | LLPanelPlace* self = (LLPanelPlace*)data; | ||
280 | |||
281 | if (0 == option) | ||
282 | { | ||
283 | char url[256]; | ||
284 | sprintf(url, "%s%010d", AUCTION_URL, self->mAuctionID); | ||
285 | |||
286 | llinfos << "Loading auction page " << url << llendl; | ||
287 | |||
288 | LLWeb::loadURL(url); | ||
289 | } | ||
290 | } | ||