aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfloaterdirectory.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:46 -0500
committerJacek Antonelli2008-08-15 23:44:46 -0500
commit38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch)
treeadca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llfloaterdirectory.cpp
parentREADME.txt (diff)
downloadmeta-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 'linden/indra/newview/llfloaterdirectory.cpp')
-rw-r--r--linden/indra/newview/llfloaterdirectory.cpp488
1 files changed, 488 insertions, 0 deletions
diff --git a/linden/indra/newview/llfloaterdirectory.cpp b/linden/indra/newview/llfloaterdirectory.cpp
new file mode 100644
index 0000000..ab2e873
--- /dev/null
+++ b/linden/indra/newview/llfloaterdirectory.cpp
@@ -0,0 +1,488 @@
1/**
2 * @file llfloaterdirectory.cpp
3 * @brief The "Find" floater. Should be llfloaterfind.
4 *
5 * Copyright (c) 2002-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 "llfloaterdirectory.h"
31
32#include "llpaneldirfind.h"
33#include "llpaneldirevents.h"
34#include "llpaneldirland.h"
35#include "llpaneldirpeople.h"
36#include "llpaneldirpopular.h"
37#include "llpaneldirgroups.h"
38#include "llpaneldirplaces.h"
39#include "llpaneldirclassified.h"
40#include "llresizehandle.h"
41#include "llresmgr.h"
42#include "llscrollbar.h"
43#include "llbutton.h"
44
45#include "llkeyboard.h"
46#include "llscrollcontainer.h"
47#include "llcheckboxctrl.h"
48#include "lluiconstants.h"
49#include "llviewercontrol.h"
50
51LLFloaterDirectory* LLFloaterDirectory::sInstance = NULL;
52
53//////////////////////////////////////////////
54// LLFloaterDirectory
55
56const S32 MIN_WIDTH = 400;
57const S32 MIN_HEIGHT = 200;
58
59#include "llagent.h"
60#include "llpanelavatar.h"
61#include "llpanelevent.h"
62#include "llpanelclassified.h"
63#include "llpanelgroup.h"
64#include "llpanelpick.h"
65#include "llpanelplace.h"
66#include "llpaneldirland.h"
67#include "llfloateravatarinfo.h"
68#include "lldir.h"
69#include "llvieweruictrlfactory.h"
70
71LLFloaterDirectory::LLFloaterDirectory(const std::string& name)
72: LLFloater(name, "FloaterFindRect2", "")
73{
74 sInstance = this;
75
76 // INITIALIZE SUBPANELS TO NULL
77 mClassifiedPanel = NULL;
78 mEventsPanel = NULL;
79 mPopularPanel = NULL;
80 mPlacesPanel = NULL;
81 mLandPanel = NULL;
82 mPeoplePanel = NULL;
83 mGroupsPanel = NULL;
84 mFindPanel = NULL;
85
86 mPanelAvatarp = NULL;
87 mPanelEventp = NULL;
88 mPanelGroupp = NULL;
89 mPanelGroupHolderp = NULL;
90 mPanelPlacep = NULL;
91 mPanelPlaceSmallp = NULL;
92 mPanelClassifiedp = NULL;
93
94 // Build the floater with our tab panel classes
95
96 LLCallbackMap::map_t factory_map;
97 factory_map["classified_panel"] = LLCallbackMap(createClassified, this);
98 factory_map["events_panel"] = LLCallbackMap(createEvents, this);
99 factory_map["popular_panel"] = LLCallbackMap(createPopular, this);
100 factory_map["places_panel"] = LLCallbackMap(createPlaces, this);
101 factory_map["land_sales_panel"] = LLCallbackMap(createLand, this);
102 factory_map["people_panel"] = LLCallbackMap(createPeople, this);
103 factory_map["groups_panel"] = LLCallbackMap(createGroups, this);
104 factory_map["all_panel"] = LLCallbackMap(createFind, this);
105
106 factory_map["classified_details_panel"] = LLCallbackMap(createClassifiedDetail, this);
107 factory_map["event_details_panel"] = LLCallbackMap(createEventDetail, this);
108 factory_map["group_details_panel"] = LLCallbackMap(createGroupDetail, this);
109 factory_map["group_details_panel_holder"] = LLCallbackMap(createGroupDetailHolder, this);
110 factory_map["place_details_panel"] = LLCallbackMap(createPlaceDetail, this);
111 factory_map["place_details_small_panel"] = LLCallbackMap(createPlaceDetailSmall, this);
112
113 factory_map["Panel Avatar"] = LLCallbackMap(createPanelAvatar, this);
114
115 gUICtrlFactory->buildFloater(this, "floater_directory.xml", &factory_map);
116
117 if(mPanelAvatarp)
118 {
119 mPanelAvatarp->selectTab(0);
120 }
121
122 childSetTabChangeCallback("Directory Tabs", "classified_panel", onTabChanged, this);
123 childSetTabChangeCallback("Directory Tabs", "events_panel", onTabChanged, this);
124 childSetTabChangeCallback("Directory Tabs", "popular_panel", onTabChanged, this);
125 childSetTabChangeCallback("Directory Tabs", "places_panel", onTabChanged, this);
126 childSetTabChangeCallback("Directory Tabs", "land_sales_panel", onTabChanged, this);
127 childSetTabChangeCallback("Directory Tabs", "people_panel", onTabChanged, this);
128 childSetTabChangeCallback("Directory Tabs", "groups_panel", onTabChanged, this);
129 childSetTabChangeCallback("Directory Tabs", "all_panel", onTabChanged, this);
130}
131
132// static
133void* LLFloaterDirectory::createClassified(void* userdata)
134{
135 LLFloaterDirectory *self = (LLFloaterDirectory*)userdata;
136 self->mClassifiedPanel = new LLPanelDirClassified("classified_panel", self);
137 return self->mClassifiedPanel;
138}
139
140// static
141void* LLFloaterDirectory::createEvents(void* userdata)
142{
143 LLFloaterDirectory *self = (LLFloaterDirectory*)userdata;
144 self->mEventsPanel = new LLPanelDirEvents("events_panel", self);
145 return self->mEventsPanel;
146}
147
148// static
149void* LLFloaterDirectory::createPopular(void* userdata)
150{
151 LLFloaterDirectory *self = (LLFloaterDirectory*)userdata;
152 self->mPopularPanel = new LLPanelDirPopular("popular_panel", self);
153 return self->mPopularPanel;
154}
155
156// static
157void* LLFloaterDirectory::createPlaces(void* userdata)
158{
159 LLFloaterDirectory *self = (LLFloaterDirectory*)userdata;
160 self->mPlacesPanel = new LLPanelDirPlaces("places_panel", self);
161 return self->mPlacesPanel;
162}
163
164// static
165void* LLFloaterDirectory::createLand(void* userdata)
166{
167 LLFloaterDirectory *self = (LLFloaterDirectory*)userdata;
168 self->mLandPanel = new LLPanelDirLand("land_panel", self);
169 return self->mLandPanel;
170}
171
172
173// static
174void* LLFloaterDirectory::createPeople(void* userdata)
175{
176 LLFloaterDirectory *self = (LLFloaterDirectory*)userdata;
177 self->mPeoplePanel = new LLPanelDirPeople("people_panel", self);
178 return self->mPeoplePanel;
179}
180
181// static
182void* LLFloaterDirectory::createGroups(void* userdata)
183{
184 LLFloaterDirectory *self = (LLFloaterDirectory*)userdata;
185 self->mGroupsPanel = new LLPanelDirGroups("groups_panel", self);
186 return self->mGroupsPanel;
187}
188
189// static
190void *LLFloaterDirectory::createFind(void* userdata)
191{
192 LLFloaterDirectory *self = (LLFloaterDirectory*)userdata;
193 self->mFindPanel = new LLPanelDirFind("find_panel", self);
194 return self->mFindPanel;
195}
196
197// static
198void* LLFloaterDirectory::createClassifiedDetail(void* userdata)
199{
200 LLFloaterDirectory *self = (LLFloaterDirectory*)userdata;
201 self->mPanelClassifiedp = new LLPanelClassified(TRUE);
202 self->mPanelClassifiedp->setVisible(FALSE);
203 return self->mPanelClassifiedp;
204}
205
206//----------------------------------------------------------------------------
207
208void* LLFloaterDirectory::createPanelAvatar(void* data)
209{
210 LLFloaterDirectory* self = (LLFloaterDirectory*)data;
211 self->mPanelAvatarp = new LLPanelAvatar("Avatar", LLRect(), TRUE); // allow edit self
212 self->mPanelAvatarp->setVisible(FALSE);
213 return self->mPanelAvatarp;
214
215}
216
217
218//----------------------------------------------------------------------------
219
220// static
221void* LLFloaterDirectory::createEventDetail(void* userdata)
222{
223 LLFloaterDirectory *self = (LLFloaterDirectory*)userdata;
224 self->mPanelEventp = new LLPanelEvent();
225 gUICtrlFactory->buildPanel(self->mPanelEventp, "panel_event.xml");
226 self->mPanelEventp->setVisible(FALSE);
227 return self->mPanelEventp;
228}
229
230// static
231void* LLFloaterDirectory::createGroupDetail(void* userdata)
232{
233 LLFloaterDirectory *self = (LLFloaterDirectory*)userdata;
234 self->mPanelGroupp = new LLPanelGroup("panel_group.xml",
235 "PanelGroup",
236 gAgent.getGroupID());
237 self->mPanelGroupp->setAllowEdit(FALSE);
238 self->mPanelGroupp->setVisible(FALSE);
239 return self->mPanelGroupp;
240}
241
242// static
243void* LLFloaterDirectory::createGroupDetailHolder(void* userdata)
244{
245 LLFloaterDirectory *self = (LLFloaterDirectory*)userdata;
246 self->mPanelGroupHolderp = new LLPanel("PanelGroupHolder");
247 self->mPanelGroupHolderp->setVisible(FALSE);
248 return self->mPanelGroupHolderp;
249}
250
251// static
252void* LLFloaterDirectory::createPlaceDetail(void* userdata)
253{
254 LLFloaterDirectory *self = (LLFloaterDirectory*)userdata;
255 self->mPanelPlacep = new LLPanelPlace();
256 gUICtrlFactory->buildPanel(self->mPanelPlacep, "panel_place.xml");
257 self->mPanelPlacep->setVisible(FALSE);
258 return self->mPanelPlacep;
259}
260
261// static
262void* LLFloaterDirectory::createPlaceDetailSmall(void* userdata)
263{
264 LLFloaterDirectory *self = (LLFloaterDirectory*)userdata;
265 self->mPanelPlaceSmallp = new LLPanelPlace();
266 gUICtrlFactory->buildPanel(self->mPanelPlaceSmallp, "panel_place_small.xml");
267 self->mPanelPlaceSmallp->setVisible(FALSE);
268 return self->mPanelPlaceSmallp;
269}
270
271// static
272void LLFloaterDirectory::requestClassifieds()
273{
274 if (sInstance && sInstance->mClassifiedPanel)
275 {
276 sInstance->mClassifiedPanel->performQuery();
277 }
278}
279
280void LLFloaterDirectory::showClassified(const LLUUID& classified_id)
281{
282 showPanel("classified_panel");
283
284 if (sInstance->mClassifiedPanel)
285 {
286 sInstance->mClassifiedPanel->selectByUUID(classified_id);
287 }
288}
289
290
291// static
292void LLFloaterDirectory::showEvents(S32 event_id)
293{
294 showPanel("events_panel");
295
296 if (sInstance->mEventsPanel)
297 {
298 // HACK: force query for today's events
299 sInstance->mEventsPanel->setDay(0);
300 sInstance->mEventsPanel->performQuery();
301 if (event_id != 0)
302 {
303 sInstance->mEventsPanel->selectEventByID(event_id);
304 }
305 }
306}
307
308// static
309void LLFloaterDirectory::showPopular(const LLUUID& parcel_id)
310{
311 showPanel("popular_panel");
312
313 if (sInstance->mPopularPanel)
314 {
315 sInstance->mPopularPanel->selectByUUID(parcel_id);
316 }
317}
318
319// static
320void LLFloaterDirectory::showLandForSale(const LLUUID& parcel_id)
321{
322 showPanel("land_sales_panel");
323
324 if (sInstance->mLandPanel)
325 {
326 sInstance->mLandPanel->selectByUUID(parcel_id);
327 }
328}
329
330// static
331void LLFloaterDirectory::showGroups()
332{
333 showPanel("groups_panel");
334}
335
336// static
337void LLFloaterDirectory::refreshGroup(const LLUUID& group_id)
338{
339 if (sInstance && sInstance->mPanelGroupp
340 && (sInstance->mPanelGroupp->getID() == group_id) )
341 {
342 sInstance->mPanelGroupp->refreshData();
343 }
344}
345
346LLFloaterDirectory::~LLFloaterDirectory()
347{
348 sInstance = NULL;
349 delete mPanelAvatarp;
350 delete mPanelEventp;
351 delete mPanelGroupp;
352 delete mPanelGroupHolderp;
353 delete mPanelPlacep;
354 delete mPanelPlaceSmallp;
355 delete mPanelClassifiedp;
356 gSavedSettings.setBOOL("ShowDirectory", FALSE);
357}
358
359void LLFloaterDirectory::focusCurrentPanel()
360{
361 LLTabContainerCommon* tabs = LLUICtrlFactory::getTabContainerByName(this, "Directory Tabs");
362 if (!tabs) return;
363
364 LLPanel* panel = tabs->getCurrentPanel();
365 if (!panel) return;
366
367 panel->setFocus(TRUE);
368}
369
370// static
371void LLFloaterDirectory::show(void *)
372{
373#ifndef LL_RELEASE_FOR_DOWNLOAD
374 delete sInstance;
375 sInstance = NULL;
376#endif
377 if (!sInstance)
378 {
379 sInstance = new LLFloaterDirectory("directory");
380 }
381
382 sInstance->open();
383 sInstance->focusCurrentPanel();
384}
385
386// static
387void LLFloaterDirectory::showPanel(const LLString& tabname)
388{
389 show(NULL);
390 sInstance->childShowTab("Directory Tabs", tabname);
391 sInstance->focusCurrentPanel();
392}
393
394// static
395void LLFloaterDirectory::toggleFind(void*)
396{
397#ifndef LL_RELEASE_FOR_DOWNLOAD
398 delete sInstance;
399 sInstance = NULL;
400#endif
401 if (!sInstance)
402 {
403 LLString panel = gSavedSettings.getString("LastFindPanel");
404 showPanel(panel);
405
406 // HACK: force query for today's events
407 if (sInstance->mEventsPanel)
408 {
409 sInstance->mEventsPanel->setDay(0);
410 //sInstance->mEventsPanel->performQuery(); // Temporary change to help DB - Sabin
411 }
412 return;
413 }
414
415 BOOL panel_visible = sInstance->getVisible();
416 if (!panel_visible)
417 {
418 sInstance->open();
419 sInstance->focusCurrentPanel();
420 }
421 else
422 {
423 sInstance->close();
424 }
425}
426
427// static
428void LLFloaterDirectory::toggleEvents(void*)
429{
430 if (!sInstance)
431 {
432 showEvents(0);
433 return;
434 }
435
436 BOOL panel_visible = sInstance->getVisible();
437 if (!panel_visible)
438 {
439 sInstance->open();
440 sInstance->showEvents(0);
441 }
442 else
443 {
444 LLPanel *current_panel = sInstance->childGetVisibleTab("Directory Tabs");
445 if (current_panel == sInstance->mEventsPanel)
446 {
447 sInstance->close();
448 }
449 else
450 {
451 sInstance->showEvents(0);
452 }
453 }
454}
455
456// static
457void LLFloaterDirectory::hide(void*)
458{
459 if (sInstance)
460 {
461 sInstance->close();
462 }
463}
464
465// virtual
466void LLFloaterDirectory::setVisible(BOOL visible)
467{
468 gSavedSettings.setBOOL("ShowDirectory", visible);
469 LLFloater::setVisible(visible);
470}
471
472void LLFloaterDirectory::onClose(bool app_quitting)
473{
474 setVisible(FALSE);
475}
476
477// static
478void LLFloaterDirectory::onTabChanged(void* data, bool from_click)
479{
480 LLFloaterDirectory* self = (LLFloaterDirectory*)data;
481 if (!self) return;
482
483 LLPanel *panel = self->childGetVisibleTab("Directory Tabs");
484 if (panel)
485 {
486 gSavedSettings.setString("LastFindPanel", panel->getName());
487 }
488}