diff --git a/indra/llmath/xform.h b/indra/llmath/xform.h index d3be28f41..072a73147 100644 --- a/indra/llmath/xform.h +++ b/indra/llmath/xform.h @@ -38,7 +38,7 @@ const F32 MAX_OBJECT_Z = 4096.f; // should match REGION_HEIGHT_METERS, Pre-havok4: 768.f const F32 MIN_OBJECT_Z = -256.f; -const F32 DEFAULT_MAX_PRIM_SCALE = 10.f; +const F32 DEFAULT_MAX_PRIM_SCALE = 256.f; const F32 MIN_PRIM_SCALE = 0.01f; const F32 MAX_PRIM_SCALE = 65536.f; // something very high but not near FLT_MAX diff --git a/indra/newview/llfloaterdirectory.cpp b/indra/newview/llfloaterdirectory.cpp index 98659af2b..4e0edb763 100644 --- a/indra/newview/llfloaterdirectory.cpp +++ b/indra/newview/llfloaterdirectory.cpp @@ -65,6 +65,8 @@ #include "lldir.h" #include "lluictrlfactory.h" +#include "hippogridmanager.h" + LLFloaterDirectory* LLFloaterDirectory::sInstance = NULL; //static S32 LLFloaterDirectory::sOldSearchCount = 0; // debug @@ -91,16 +93,26 @@ LLFloaterDirectory::LLFloaterDirectory(const std::string& name) mPanelClassifiedp = NULL; // Build the floater with our tab panel classes + + bool isInSecondLife = gHippoGridManager->getConnectedGrid()->isSecondLife(); LLCallbackMap::map_t factory_map; - factory_map["find_all_panel"] = LLCallbackMap(createFindAll, this); factory_map["classified_panel"] = LLCallbackMap(createClassified, this); factory_map["events_panel"] = LLCallbackMap(createEvents, this); - factory_map["showcase_panel"] = LLCallbackMap(createShowcase, this); factory_map["places_panel"] = LLCallbackMap(createPlaces, this); factory_map["land_sales_panel"] = LLCallbackMap(createLand, this); factory_map["people_panel"] = LLCallbackMap(createPeople, this); factory_map["groups_panel"] = LLCallbackMap(createGroups, this); + if (isInSecondLife) + { + // web search and showcase only for SecondLife + factory_map["find_all_panel"] = LLCallbackMap(createFindAll, this); + factory_map["showcase_panel"] = LLCallbackMap(createShowcase, this); + } + else + { + factory_map["find_all_old_panel"] = LLCallbackMap(createFindAllOld, this); + } factory_map["classified_details_panel"] = LLCallbackMap(createClassifiedDetail, this); factory_map["event_details_panel"] = LLCallbackMap(createEventDetail, this); @@ -111,7 +123,14 @@ LLFloaterDirectory::LLFloaterDirectory(const std::string& name) factory_map["Panel Avatar"] = LLCallbackMap(createPanelAvatar, this); - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_directory.xml", &factory_map); + if (isInSecondLife) + { + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_directory.xml", &factory_map); + } + else + { + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_directory2.xml", &factory_map); + } moveResizeHandlesToFront(); if(mPanelAvatarp) @@ -119,14 +138,22 @@ LLFloaterDirectory::LLFloaterDirectory(const std::string& name) mPanelAvatarp->selectTab(0); } - childSetTabChangeCallback("Directory Tabs", "find_all_panel", onTabChanged, this); childSetTabChangeCallback("Directory Tabs", "classified_panel", onTabChanged, this); childSetTabChangeCallback("Directory Tabs", "events_panel", onTabChanged, this); - childSetTabChangeCallback("Directory Tabs", "showcase_panel", onTabChanged, this); childSetTabChangeCallback("Directory Tabs", "places_panel", onTabChanged, this); childSetTabChangeCallback("Directory Tabs", "land_sales_panel", onTabChanged, this); childSetTabChangeCallback("Directory Tabs", "people_panel", onTabChanged, this); childSetTabChangeCallback("Directory Tabs", "groups_panel", onTabChanged, this); + if (isInSecondLife) + { + // web search and showcase for SecondLife + childSetTabChangeCallback("Directory Tabs", "find_all_panel", onTabChanged, this); + childSetTabChangeCallback("Directory Tabs", "showcase_panel", onTabChanged, this); + } + else + { + childSetTabChangeCallback("Directory Tabs", "find_all_old_panel", onTabChanged, this); + } } LLFloaterDirectory::~LLFloaterDirectory() @@ -206,7 +233,14 @@ void* LLFloaterDirectory::createPeople(void* userdata) void* LLFloaterDirectory::createGroups(void* userdata) { LLFloaterDirectory *self = (LLFloaterDirectory*)userdata; - return new LLPanelDirGroups("people_groups", self); + return new LLPanelDirGroups("groups_panel", self); +} + +// static +void *LLFloaterDirectory::createFindAllOld(void* userdata) +{ + LLFloaterDirectory *self = (LLFloaterDirectory*)userdata; + return new LLPanelDirFindAllOld("find_all_old_panel", self); } // static @@ -384,13 +418,15 @@ void LLFloaterDirectory::showPanel(const std::string& tabname) // static void LLFloaterDirectory::toggleFind(void*) { -#ifndef LL_RELEASE_FOR_DOWNLOAD - delete sInstance; - sInstance = NULL; -#endif if (!sInstance) { std::string panel = gSavedSettings.getString("LastFindPanel"); + if (!gHippoGridManager->getConnectedGrid()->isSecondLife() + && (panel == "find_all_panel" || panel == "showcase_panel")) + { + // No web search neither showcase for OpenSim grids... + panel = "find_all_old_panel"; + } showPanel(panel); // HACK: force query for today's events diff --git a/indra/newview/llfloaterdirectory.h b/indra/newview/llfloaterdirectory.h index d8f839988..e43968624 100644 --- a/indra/newview/llfloaterdirectory.h +++ b/indra/newview/llfloaterdirectory.h @@ -106,6 +106,7 @@ private: static void* createLand(void* userdata); static void* createPeople(void* userdata); static void* createGroups(void* userdata); + static void* createFindAllOld(void* userdata); static void* createClassifiedDetail(void* userdata); static void* createAvatarDetail(void* userdata); diff --git a/indra/newview/llpaneldirfind.cpp b/indra/newview/llpaneldirfind.cpp index 9695fbdb3..55756a971 100644 --- a/indra/newview/llpaneldirfind.cpp +++ b/indra/newview/llpaneldirfind.cpp @@ -526,3 +526,133 @@ void LLPanelDirFindAllInterface::focus(LLPanelDirFindAll* panel) panel->focus(); } +//--------------------------------------------------------------------------- +// LLPanelDirFindAllOld - deprecated if new Google search works out. JC +//--------------------------------------------------------------------------- + +LLPanelDirFindAllOld::LLPanelDirFindAllOld(const std::string& name, LLFloaterDirectory* floater) + : LLPanelDirBrowser(name, floater) +{ + mMinSearchChars = 3; +} + +BOOL LLPanelDirFindAllOld::postBuild() +{ + LLPanelDirBrowser::postBuild(); + + childSetKeystrokeCallback("name", &LLPanelDirBrowser::onKeystrokeName, this); + + childSetAction("Search", onClickSearch, this); + childDisable("Search"); + setDefaultBtn( "Search" ); + + return TRUE; +} + +LLPanelDirFindAllOld::~LLPanelDirFindAllOld() +{ + // Children all cleaned up by default view destructor. +} + +// virtual +void LLPanelDirFindAllOld::draw() +{ + updateMaturityCheckbox(); + LLPanelDirBrowser::draw(); +} + +// static +void LLPanelDirFindAllOld::onCommitScope(LLUICtrl* ctrl, void* data) +{ + LLPanelDirFindAllOld* self = (LLPanelDirFindAllOld*)data; + self->setFocus(TRUE); +} + +// static +void LLPanelDirFindAllOld::onClickSearch(void *userdata) +{ + LLPanelDirFindAllOld *self = (LLPanelDirFindAllOld *)userdata; + + if (self->childGetValue("name").asString().length() < self->mMinSearchChars) + { + return; + }; + + BOOL inc_pg = self->childGetValue("incpg").asBoolean(); + BOOL inc_mature = self->childGetValue("incmature").asBoolean(); + BOOL inc_adult = self->childGetValue("incadult").asBoolean(); + if (!(inc_pg || inc_mature || inc_adult)) + { + LLNotifications::instance().add("NoContentToSearch"); + return; + } + + self->setupNewSearch(); + + // Figure out scope + U32 scope = 0x0; + scope |= DFQ_PEOPLE; // people (not just online = 0x01 | 0x02) + // places handled below + scope |= DFQ_EVENTS; // events + scope |= DFQ_GROUPS; // groups + if (inc_pg) + { + scope |= DFQ_INC_PG; + } + if (inc_mature) + { + scope |= DFQ_INC_MATURE; + } + if (inc_adult) + { + scope |= DFQ_INC_ADULT; + } + + // send the message + LLMessageSystem *msg = gMessageSystem; + S32 start_row = 0; + sendDirFindQuery(msg, self->mSearchID, self->childGetValue("name").asString(), scope, start_row); + + // Also look up classified ads. JC 12/2005 + BOOL filter_auto_renew = FALSE; + U32 classified_flags = pack_classified_flags_request(filter_auto_renew, inc_pg, inc_mature, inc_adult); + msg->newMessage("DirClassifiedQuery"); + msg->nextBlock("AgentData"); + msg->addUUID("AgentID", gAgent.getID()); + msg->addUUID("SessionID", gAgent.getSessionID()); + msg->nextBlock("QueryData"); + msg->addUUID("QueryID", self->mSearchID); + msg->addString("QueryText", self->childGetValue("name").asString()); + msg->addU32("QueryFlags", classified_flags); + msg->addU32("Category", 0); // all categories + msg->addS32("QueryStart", 0); + gAgent.sendReliableMessage(); + + // Need to use separate find places query because places are + // sent using the more compact DirPlacesReply message. + U32 query_flags = DFQ_DWELL_SORT; + if (inc_pg) + { + query_flags |= DFQ_INC_PG; + } + if (inc_mature) + { + query_flags |= DFQ_INC_MATURE; + } + if (inc_adult) + { + query_flags |= DFQ_INC_ADULT; + } + msg->newMessage("DirPlacesQuery"); + msg->nextBlock("AgentData"); + msg->addUUID("AgentID", gAgent.getID() ); + msg->addUUID("SessionID", gAgent.getSessionID()); + msg->nextBlock("QueryData"); + msg->addUUID("QueryID", self->mSearchID ); + msg->addString("QueryText", self->childGetValue("name").asString()); + msg->addU32("QueryFlags", query_flags ); + msg->addS32("QueryStart", 0 ); // Always get the first 100 when using find ALL + msg->addS8("Category", LLParcel::C_ANY); + msg->addString("SimName", NULL); + gAgent.sendReliableMessage(); +} diff --git a/indra/newview/llpaneldirfind.h b/indra/newview/llpaneldirfind.h index 9f4fe813a..95b28036d 100644 --- a/indra/newview/llpaneldirfind.h +++ b/indra/newview/llpaneldirfind.h @@ -88,4 +88,20 @@ public: static void focus(LLPanelDirFindAll* panel); }; + +class LLPanelDirFindAllOld : public LLPanelDirBrowser +{ +public: + LLPanelDirFindAllOld(const std::string& name, LLFloaterDirectory* floater); + /*virtual*/ ~LLPanelDirFindAllOld(); + + /*virtual*/ BOOL postBuild(); + + /*virtual*/ void draw(); + + static void onClickSearch(void *userdata); + static void onCommitScope(LLUICtrl* ctrl, void* data); + static void onKeystrokeName(LLLineEditor* line, void* data); +}; + #endif diff --git a/indra/newview/llpaneldirgroups.cpp b/indra/newview/llpaneldirgroups.cpp index 84ec36c5e..5345304ec 100644 --- a/indra/newview/llpaneldirgroups.cpp +++ b/indra/newview/llpaneldirgroups.cpp @@ -33,20 +33,69 @@ #include "llviewerprecompiledheaders.h" #include "llpaneldirgroups.h" -#include "llnotifications.h" -#include "llmediactrl.h" +// linden library includes +#include "llagent.h" +//#include "llfontgl.h" +#include "message.h" +#include "llqueryflags.h" +#include "llviewercontrol.h" +#include "llviewerwindow.h" LLPanelDirGroups::LLPanelDirGroups(const std::string& name, LLFloaterDirectory* floater) - : LLPanelDirFind(name, floater, "groups_browser") + : LLPanelDirBrowser(name, floater) { + mMinSearchChars = 3; } -void LLPanelDirGroups::search(const std::string& search_text) +BOOL LLPanelDirGroups::postBuild() { - if (!search_text.empty()) + LLPanelDirBrowser::postBuild(); + + childSetKeystrokeCallback("name", &LLPanelDirBrowser::onKeystrokeName, this); + + childSetAction("Search", &LLPanelDirBrowser::onClickSearchCore, this); + childDisable("Search"); + setDefaultBtn( "Search" ); + + return TRUE; +} + +LLPanelDirGroups::~LLPanelDirGroups() +{ + // Children all cleaned up by default view destructor. +} + +// virtual +void LLPanelDirGroups::draw() +{ + updateMaturityCheckbox(); + LLPanelDirBrowser::draw(); +} + + +// virtual +void LLPanelDirGroups::performQuery() +{ + std::string group_name = childGetValue("name").asString(); + if (group_name.length() < mMinSearchChars) { + return; + } + + // "hi " is three chars but not a long-enough search + std::string query_string = group_name; + LLStringUtil::trim( query_string ); + bool query_was_filtered = (query_string != group_name); + + // possible we threw away all the short words in the query so check length + if ( query_string.length() < mMinSearchChars ) + { + LLNotifications::instance().add("SeachFilteredOnShortWordsEmpty"); + return; + }; + BOOL inc_pg = childGetValue("incpg").asBoolean(); BOOL inc_mature = childGetValue("incmature").asBoolean(); BOOL inc_adult = childGetValue("incadult").asBoolean(); @@ -56,24 +105,39 @@ void LLPanelDirGroups::search(const std::string& search_text) return; } - std::string selected_collection = "Groups"; - std::string url = buildSearchURL(search_text, selected_collection, inc_pg, inc_mature, inc_adult, true); - if (mWebBrowser) - { - mWebBrowser->navigateTo(url); - } - } - else + // if we filtered something out, display a popup + if ( query_was_filtered ) { - // empty search text - navigateToDefaultPage(); + LLSD args; + args["[FINALQUERY]"] = query_string; + LLNotifications::instance().add("SeachFilteredOnShortWords", args); + }; + + setupNewSearch(); + + // groups + U32 scope = DFQ_GROUPS; + if (inc_pg) + { + scope |= DFQ_INC_PG; + } + if (inc_mature) + { + scope |= DFQ_INC_MATURE; + } + if (inc_adult) + { + scope |= DFQ_INC_ADULT; } - childSetText("search_editor", search_text); -} + mCurrentSortColumn = "score"; + mCurrentSortAscending = FALSE; -void LLPanelDirGroups::draw() -{ - updateMaturityCheckbox(); - LLPanelDirBrowser::draw(); + // send the message + sendDirFindQuery( + gMessageSystem, + mSearchID, + query_string, + scope, + mSearchStart); } diff --git a/indra/newview/llpaneldirgroups.h b/indra/newview/llpaneldirgroups.h index d1248c0bf..75e557ee7 100644 --- a/indra/newview/llpaneldirgroups.h +++ b/indra/newview/llpaneldirgroups.h @@ -33,15 +33,21 @@ #ifndef LLPANELDIRGROUPS_H #define LLPANELDIRGROUPS_H -#include "llpaneldirfind.h" +#include "llpaneldirbrowser.h" -class LLPanelDirGroups : public LLPanelDirFind +class LLPanelDirGroups : public LLPanelDirBrowser { public: LLPanelDirGroups(const std::string& name, LLFloaterDirectory* floater); + virtual ~LLPanelDirGroups(); - /*virtual*/ void search(const std::string& search_text); /*virtual*/ void draw(); + + /*virtual*/ BOOL postBuild(); + + /*virtual*/ void performQuery(); + + static void onClickSearch(void *userdata); }; #endif diff --git a/indra/newview/skins/default/xui/en-us/floater_directory.xml b/indra/newview/skins/default/xui/en-us/floater_directory.xml index ee3cdec52..c7adfbd60 100644 --- a/indra/newview/skins/default/xui/en-us/floater_directory.xml +++ b/indra/newview/skins/default/xui/en-us/floater_directory.xml @@ -613,74 +613,58 @@ To buy direct, visit the land and click on the place name in the title bar. mouse_opaque="true" name="< Prev" right="244" width="80" /> - Searching... - None Found. + + Searching... + + + None Found. + +