aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfloaterdirectory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llfloaterdirectory.cpp')
-rw-r--r--linden/indra/newview/llfloaterdirectory.cpp134
1 files changed, 83 insertions, 51 deletions
diff --git a/linden/indra/newview/llfloaterdirectory.cpp b/linden/indra/newview/llfloaterdirectory.cpp
index 1c06ed1..3b7142e 100644
--- a/linden/indra/newview/llfloaterdirectory.cpp
+++ b/linden/indra/newview/llfloaterdirectory.cpp
@@ -52,14 +52,6 @@
52#include "lluiconstants.h" 52#include "lluiconstants.h"
53#include "llviewercontrol.h" 53#include "llviewercontrol.h"
54 54
55LLFloaterDirectory* LLFloaterDirectory::sInstance = NULL;
56
57//////////////////////////////////////////////
58// LLFloaterDirectory
59
60const S32 MIN_WIDTH = 400;
61const S32 MIN_HEIGHT = 200;
62
63#include "llagent.h" 55#include "llagent.h"
64#include "llpanelavatar.h" 56#include "llpanelavatar.h"
65#include "llpanelevent.h" 57#include "llpanelevent.h"
@@ -72,20 +64,18 @@ const S32 MIN_HEIGHT = 200;
72#include "lldir.h" 64#include "lldir.h"
73#include "llvieweruictrlfactory.h" 65#include "llvieweruictrlfactory.h"
74 66
67LLFloaterDirectory* LLFloaterDirectory::sInstance = NULL;
68
75LLFloaterDirectory::LLFloaterDirectory(const std::string& name) 69LLFloaterDirectory::LLFloaterDirectory(const std::string& name)
76: LLFloater(name, "FloaterFindRect2", "") 70: LLFloater(name, "FloaterFindRect2", "")
77{ 71{
78 sInstance = this; 72 sInstance = this;
79 73
80 // INITIALIZE SUBPANELS TO NULL 74 mFindAllPanel = NULL;
81 mClassifiedPanel = NULL; 75 mClassifiedPanel = NULL;
82 mEventsPanel = NULL; 76 mEventsPanel = NULL;
83 mPopularPanel = NULL; 77 mPopularPanel = NULL;
84 mPlacesPanel = NULL;
85 mLandPanel = NULL; 78 mLandPanel = NULL;
86 mPeoplePanel = NULL;
87 mGroupsPanel = NULL;
88 mFindPanel = NULL;
89 79
90 mPanelAvatarp = NULL; 80 mPanelAvatarp = NULL;
91 mPanelEventp = NULL; 81 mPanelEventp = NULL;
@@ -98,6 +88,7 @@ LLFloaterDirectory::LLFloaterDirectory(const std::string& name)
98 // Build the floater with our tab panel classes 88 // Build the floater with our tab panel classes
99 89
100 LLCallbackMap::map_t factory_map; 90 LLCallbackMap::map_t factory_map;
91 factory_map["find_all_panel"] = LLCallbackMap(createFindAll, this);
101 factory_map["classified_panel"] = LLCallbackMap(createClassified, this); 92 factory_map["classified_panel"] = LLCallbackMap(createClassified, this);
102 factory_map["events_panel"] = LLCallbackMap(createEvents, this); 93 factory_map["events_panel"] = LLCallbackMap(createEvents, this);
103 factory_map["popular_panel"] = LLCallbackMap(createPopular, this); 94 factory_map["popular_panel"] = LLCallbackMap(createPopular, this);
@@ -105,7 +96,7 @@ LLFloaterDirectory::LLFloaterDirectory(const std::string& name)
105 factory_map["land_sales_panel"] = LLCallbackMap(createLand, this); 96 factory_map["land_sales_panel"] = LLCallbackMap(createLand, this);
106 factory_map["people_panel"] = LLCallbackMap(createPeople, this); 97 factory_map["people_panel"] = LLCallbackMap(createPeople, this);
107 factory_map["groups_panel"] = LLCallbackMap(createGroups, this); 98 factory_map["groups_panel"] = LLCallbackMap(createGroups, this);
108 factory_map["all_panel"] = LLCallbackMap(createFind, this); 99 factory_map["find_all_old_panel"] = LLCallbackMap(createFindAllOld, this);
109 100
110 factory_map["classified_details_panel"] = LLCallbackMap(createClassifiedDetail, this); 101 factory_map["classified_details_panel"] = LLCallbackMap(createClassifiedDetail, this);
111 factory_map["event_details_panel"] = LLCallbackMap(createEventDetail, this); 102 factory_map["event_details_panel"] = LLCallbackMap(createEventDetail, this);
@@ -117,12 +108,14 @@ LLFloaterDirectory::LLFloaterDirectory(const std::string& name)
117 factory_map["Panel Avatar"] = LLCallbackMap(createPanelAvatar, this); 108 factory_map["Panel Avatar"] = LLCallbackMap(createPanelAvatar, this);
118 109
119 gUICtrlFactory->buildFloater(this, "floater_directory.xml", &factory_map); 110 gUICtrlFactory->buildFloater(this, "floater_directory.xml", &factory_map);
111 moveResizeHandlesToFront();
120 112
121 if(mPanelAvatarp) 113 if(mPanelAvatarp)
122 { 114 {
123 mPanelAvatarp->selectTab(0); 115 mPanelAvatarp->selectTab(0);
124 } 116 }
125 117
118 childSetTabChangeCallback("Directory Tabs", "find_all_panel", onTabChangedFindAll, this);
126 childSetTabChangeCallback("Directory Tabs", "classified_panel", onTabChanged, this); 119 childSetTabChangeCallback("Directory Tabs", "classified_panel", onTabChanged, this);
127 childSetTabChangeCallback("Directory Tabs", "events_panel", onTabChanged, this); 120 childSetTabChangeCallback("Directory Tabs", "events_panel", onTabChanged, this);
128 childSetTabChangeCallback("Directory Tabs", "popular_panel", onTabChanged, this); 121 childSetTabChangeCallback("Directory Tabs", "popular_panel", onTabChanged, this);
@@ -130,7 +123,28 @@ LLFloaterDirectory::LLFloaterDirectory(const std::string& name)
130 childSetTabChangeCallback("Directory Tabs", "land_sales_panel", onTabChanged, this); 123 childSetTabChangeCallback("Directory Tabs", "land_sales_panel", onTabChanged, this);
131 childSetTabChangeCallback("Directory Tabs", "people_panel", onTabChanged, this); 124 childSetTabChangeCallback("Directory Tabs", "people_panel", onTabChanged, this);
132 childSetTabChangeCallback("Directory Tabs", "groups_panel", onTabChanged, this); 125 childSetTabChangeCallback("Directory Tabs", "groups_panel", onTabChanged, this);
133 childSetTabChangeCallback("Directory Tabs", "all_panel", onTabChanged, this); 126 childSetTabChangeCallback("Directory Tabs", "find_all_old_panel", onTabChanged, this);
127}
128
129LLFloaterDirectory::~LLFloaterDirectory()
130{
131 sInstance = NULL;
132 delete mPanelAvatarp; mPanelAvatarp = NULL;
133 delete mPanelEventp; mPanelEventp = NULL;
134 delete mPanelGroupp; mPanelGroupp = NULL;
135 delete mPanelGroupHolderp; mPanelGroupHolderp = NULL;
136 delete mPanelPlacep; mPanelPlacep = NULL;
137 delete mPanelPlaceSmallp; mPanelPlaceSmallp = NULL;
138 delete mPanelClassifiedp; mPanelClassifiedp = NULL;
139 gSavedSettings.setBOOL("ShowDirectory", FALSE);
140}
141
142// static
143void *LLFloaterDirectory::createFindAll(void* userdata)
144{
145 LLFloaterDirectory *self = (LLFloaterDirectory*)userdata;
146 self->mFindAllPanel = LLPanelDirFindAllInterface::create(self);
147 return self->mFindAllPanel;
134} 148}
135 149
136// static 150// static
@@ -161,8 +175,7 @@ void* LLFloaterDirectory::createPopular(void* userdata)
161void* LLFloaterDirectory::createPlaces(void* userdata) 175void* LLFloaterDirectory::createPlaces(void* userdata)
162{ 176{
163 LLFloaterDirectory *self = (LLFloaterDirectory*)userdata; 177 LLFloaterDirectory *self = (LLFloaterDirectory*)userdata;
164 self->mPlacesPanel = new LLPanelDirPlaces("places_panel", self); 178 return new LLPanelDirPlaces("places_panel", self);
165 return self->mPlacesPanel;
166} 179}
167 180
168// static 181// static
@@ -178,24 +191,21 @@ void* LLFloaterDirectory::createLand(void* userdata)
178void* LLFloaterDirectory::createPeople(void* userdata) 191void* LLFloaterDirectory::createPeople(void* userdata)
179{ 192{
180 LLFloaterDirectory *self = (LLFloaterDirectory*)userdata; 193 LLFloaterDirectory *self = (LLFloaterDirectory*)userdata;
181 self->mPeoplePanel = new LLPanelDirPeople("people_panel", self); 194 return new LLPanelDirPeople("people_panel", self);
182 return self->mPeoplePanel;
183} 195}
184 196
185// static 197// static
186void* LLFloaterDirectory::createGroups(void* userdata) 198void* LLFloaterDirectory::createGroups(void* userdata)
187{ 199{
188 LLFloaterDirectory *self = (LLFloaterDirectory*)userdata; 200 LLFloaterDirectory *self = (LLFloaterDirectory*)userdata;
189 self->mGroupsPanel = new LLPanelDirGroups("groups_panel", self); 201 return new LLPanelDirGroups("groups_panel", self);
190 return self->mGroupsPanel;
191} 202}
192 203
193// static 204// static
194void *LLFloaterDirectory::createFind(void* userdata) 205void *LLFloaterDirectory::createFindAllOld(void* userdata)
195{ 206{
196 LLFloaterDirectory *self = (LLFloaterDirectory*)userdata; 207 LLFloaterDirectory *self = (LLFloaterDirectory*)userdata;
197 self->mFindPanel = new LLPanelDirFind("find_panel", self); 208 return new LLPanelDirFindAllOld("find_all_old_panel", self);
198 return self->mFindPanel;
199} 209}
200 210
201// static 211// static
@@ -282,6 +292,13 @@ void LLFloaterDirectory::requestClassifieds()
282 } 292 }
283} 293}
284 294
295void LLFloaterDirectory::showFindAll(const std::string& search_text)
296{
297 showPanel("find_all_panel");
298 LLPanelDirFindAllInterface::search(sInstance->mFindAllPanel, search_text);
299}
300
301
285void LLFloaterDirectory::showClassified(const LLUUID& classified_id) 302void LLFloaterDirectory::showClassified(const LLUUID& classified_id)
286{ 303{
287 showPanel("classified_panel"); 304 showPanel("classified_panel");
@@ -348,19 +365,6 @@ void LLFloaterDirectory::refreshGroup(const LLUUID& group_id)
348 } 365 }
349} 366}
350 367
351LLFloaterDirectory::~LLFloaterDirectory()
352{
353 sInstance = NULL;
354 delete mPanelAvatarp; mPanelAvatarp = NULL;
355 delete mPanelEventp; mPanelEventp = NULL;
356 delete mPanelGroupp; mPanelGroupp = NULL;
357 delete mPanelGroupHolderp; mPanelGroupHolderp = NULL;
358 delete mPanelPlacep; mPanelPlacep = NULL;
359 delete mPanelPlaceSmallp; mPanelPlaceSmallp = NULL;
360 delete mPanelClassifiedp; mPanelClassifiedp = NULL;
361 gSavedSettings.setBOOL("ShowDirectory", FALSE);
362}
363
364void LLFloaterDirectory::focusCurrentPanel() 368void LLFloaterDirectory::focusCurrentPanel()
365{ 369{
366 LLTabContainerCommon* tabs = LLUICtrlFactory::getTabContainerByName(this, "Directory Tabs"); 370 LLTabContainerCommon* tabs = LLUICtrlFactory::getTabContainerByName(this, "Directory Tabs");
@@ -373,25 +377,16 @@ void LLFloaterDirectory::focusCurrentPanel()
373} 377}
374 378
375// static 379// static
376void LLFloaterDirectory::show(void *) 380void LLFloaterDirectory::showPanel(const std::string& tabname)
377{ 381{
378#ifndef LL_RELEASE_FOR_DOWNLOAD 382 // This function gets called when web browser clicks are processed,
379 delete sInstance; 383 // so we don't delete the existing panel, which would delete the
380 sInstance = NULL; 384 // web browser instance currently handling the click. JC
381#endif
382 if (!sInstance) 385 if (!sInstance)
383 { 386 {
384 sInstance = new LLFloaterDirectory("directory"); 387 sInstance = new LLFloaterDirectory("directory");
385 } 388 }
386
387 sInstance->open(); /*Flawfinder: ignore*/ 389 sInstance->open(); /*Flawfinder: ignore*/
388 sInstance->focusCurrentPanel();
389}
390
391// static
392void LLFloaterDirectory::showPanel(const LLString& tabname)
393{
394 show(NULL);
395 sInstance->childShowTab("Directory Tabs", tabname); 390 sInstance->childShowTab("Directory Tabs", tabname);
396 sInstance->focusCurrentPanel(); 391 sInstance->focusCurrentPanel();
397} 392}
@@ -474,6 +469,21 @@ void LLFloaterDirectory::setVisible(BOOL visible)
474 LLFloater::setVisible(visible); 469 LLFloater::setVisible(visible);
475} 470}
476 471
472// virtual
473void LLFloaterDirectory::reshape(S32 width, S32 height, BOOL called_from_parent)
474{
475 // Don't let this floater go below its minimum width and height, ever.
476 if (width < getMinWidth())
477 {
478 width = getMinWidth();
479 }
480 if (height < getMinHeight())
481 {
482 height = getMinHeight();
483 }
484 LLFloater::reshape(width, height, called_from_parent);
485}
486
477void LLFloaterDirectory::onClose(bool app_quitting) 487void LLFloaterDirectory::onClose(bool app_quitting)
478{ 488{
479 setVisible(FALSE); 489 setVisible(FALSE);
@@ -491,3 +501,25 @@ void LLFloaterDirectory::onTabChanged(void* data, bool from_click)
491 gSavedSettings.setString("LastFindPanel", panel->getName()); 501 gSavedSettings.setString("LastFindPanel", panel->getName());
492 } 502 }
493} 503}
504
505// static
506void LLFloaterDirectory::onTabChangedFindAll(void* data, bool from_click)
507{
508 LLFloaterDirectory* self = (LLFloaterDirectory*)data;
509 if (!self) return;
510
511 self->hideAllDetailPanels();
512 LLPanelDirFindAllInterface::focus(self->mFindAllPanel);
513 onTabChanged(data, from_click);
514}
515
516void LLFloaterDirectory::hideAllDetailPanels()
517{
518 if (mPanelAvatarp) mPanelAvatarp->setVisible(FALSE);
519 if (mPanelEventp) mPanelEventp->setVisible(FALSE);
520 if (mPanelGroupp) mPanelGroupp->setVisible(FALSE);
521 if (mPanelGroupHolderp) mPanelGroupHolderp->setVisible(FALSE);
522 if (mPanelPlacep) mPanelPlacep->setVisible(FALSE);
523 if (mPanelPlaceSmallp) mPanelPlaceSmallp->setVisible(FALSE);
524 if (mPanelClassifiedp) mPanelClassifiedp->setVisible(FALSE);
525}