void LLFloaterBump::add(LLScrollListCtrl* list, LLMeanCollisionData* mcd) { if (!sInstance) { new LLFloaterBump(); } if (mcd->mFirstName.empty() || list->getItemCount() >= 20) { return; } // There's only one internal tm buffer. struct tm* timep; // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. timep = utc_to_pacific_time(mcd->mTime, gPacificDaylightTime); std::string time = llformat("[%d:%02d]", timep->tm_hour, timep->tm_min); std::string action; switch(mcd->mType) { case MEAN_BUMP: action = "bump"; break; case MEAN_LLPUSHOBJECT: action = "llpushobject"; break; case MEAN_SELECTED_OBJECT_COLLIDE: action = "selected_object_collide"; break; case MEAN_SCRIPTED_OBJECT_COLLIDE: action = "scripted_object_collide"; break; case MEAN_PHYSICAL_OBJECT_COLLIDE: action = "physical_object_collide"; break; default: llinfos << "LLFloaterBump::add unknown mean collision type " << mcd->mType << llendl; return; } // All above action strings are in XML file LLUIString text = sInstance->getString(action); text.setArg("[TIME]", time); text.setArg("[FIRST]", mcd->mFirstName); text.setArg("[LAST]", mcd->mLastName); LLSD row; row["id"] = mcd->mPerp; row["columns"][0]["value"] = text; row["columns"][0]["font"] = "SansSerifBold"; list->addElement(row); //@hook OnBump(action,time,firstname,lastname) You were bumped by something LUA_CALL("OnBump") << action << time << mcd->mFirstName << mcd->mLastName << LUA_END; }
std::string LLViewerTextEditor::appendTime(bool prepend_newline) { time_t utc_time; utc_time = time_corrected(); // There's only one internal tm buffer. struct tm* timep; // PDT/PDS is totally irrelevant static const LLCachedControl<bool> use_local_time("RtyChatUsesLocalTime"); if(use_local_time) { // use local time timep = std::localtime(&utc_time); } else { // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. timep = utc_to_pacific_time(utc_time, gPacificDaylightTime); } static const LLCachedControl<bool> show_seconds("SecondsInChatAndIMs"); static const LLCachedControl<std::string> format_long("LongTimeFormat"); static const LLCachedControl<std::string> format_short("ShortTimeFormat"); std::string format = show_seconds ? format_long : format_short; std::string text; timeStructToFormattedString(timep, format, text); text = "[" + text + "] "; appendColoredText(text, false, prepend_newline, LLColor4::grey); return text; }
std::string LLViewerTextEditor::appendTime(bool prepend_newline) { time_t utc_time; utc_time = time_corrected(); // There's only one internal tm buffer. struct tm* timep; // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. timep = utc_to_pacific_time(utc_time, gPacificDaylightTime); std::string format = ""; if (gSavedSettings.getBOOL("SecondsInChatAndIMs")) { format = gSavedSettings.getString("LongTimeFormat"); } else { format = gSavedSettings.getString("ShortTimeFormat"); } std::string text; timeStructToFormattedString(timep, format, text); text = "[" + text + "] "; appendColoredText(text, false, prepend_newline, LLColor4::grey); return text; }
void LLFloaterTeleportHistory::addPendingEntry(std::string regionName, S16 x, S16 y, S16 z) { // [RLVa:KB] if(gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) return; // [/RLVa:KB] // Set pending entry timestamp struct tm* internal_time = utc_to_pacific_time(time_corrected(), gPacificDaylightTime); timeStructToFormattedString(internal_time, gSavedSettings.getString("ShortDateFormat") + gSavedSettings.getString("LongTimeFormat"), mPendingTimeString); // check if we are in daylight savings time mPendingTimeString += gPacificDaylightTime ? " PDT" : " PST"; // Set pending region name mPendingRegionName = regionName; // Set pending position mPendingPosition = llformat("%d, %d, %d", x, y, z); LLSLURL slurl(regionName, LLVector3(x, y, z)); // prepare simstring for later parsing mPendingSimString = LLWeb::escapeURL(slurl.getLocationString()); // Prepare the SLURL mPendingSLURL = slurl.getSLURLString(); }
std::string LLLogChat::timestamp(bool withdate) { time_t utc_time; utc_time = time_corrected(); // There's only one internal tm buffer. struct tm* timep; // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. timep = utc_to_pacific_time(utc_time, gPacificDaylightTime); std::string format = ""; if (withdate) format = gSavedSettings.getString("ShortDateFormat") + " "; if (gSavedSettings.getBOOL("SecondsInChatAndIMs")) { format += gSavedSettings.getString("LongTimeFormat"); } else { format += gSavedSettings.getString("ShortTimeFormat"); } std::string text; timeStructToFormattedString(timep, format, text); text = "[" + text + "] "; return text; }
std::string LLLogChat::timestamp(bool withdate) { time_t utc_time; utc_time = time_corrected(); // There's only one internal tm buffer. struct tm* timep; // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. timep = utc_to_pacific_time(utc_time, gPacificDaylightTime); static LLCachedControl<bool> withseconds("SecondsInLog"); std::string text; if (withdate) if (withseconds) text = llformat("[%d-%02d-%02d %02d:%02d:%02d] ", (timep->tm_year-100)+2000, timep->tm_mon+1, timep->tm_mday, timep->tm_hour, timep->tm_min, timep->tm_sec); else text = llformat("[%d/%02d/%02d %02d:%02d] ", (timep->tm_year-100)+2000, timep->tm_mon+1, timep->tm_mday, timep->tm_hour, timep->tm_min); else if (withseconds) text = llformat("[%02d:%02d:%02d] ", timep->tm_hour, timep->tm_min, timep->tm_sec); else text = llformat("[%02d:%02d] ", timep->tm_hour, timep->tm_min); return text; }
LLEventInfo::LLEventInfo(F32 global_x, F32 global_y, const char* name, U32 id, S32 unix_time, U32 event_flags) : mName( name ), mID( id ), mPosGlobal( global_x, global_y, 40.0 ), mUnixTime( unix_time ), mEventFlags(event_flags), mSelected( FALSE ) { struct tm* timep; // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. timep = utc_to_pacific_time(unix_time, gPacificDaylightTime); S32 display_hour = timep->tm_hour % 12; if (display_hour == 0) display_hour = 12; mTimeStr = llformat("% 2d/% 2d % 2d:%02d %s", timep->tm_mon+1, timep->tm_year-100, display_hour, timep->tm_min, (timep->tm_hour < 12 ? "AM" : "PM") ); }
void LLFloaterBump::add(LLScrollListCtrl* list, LLMeanCollisionData* mcd) { if (mcd->mFullName.empty() || list->getItemCount() >= 20) { return; } // There's only one internal tm buffer. // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. tm* timep = utc_to_pacific_time(mcd->mTime, gPacificDaylightTime); std::string timeStr = llformat("[%d:%02d]", timep->tm_hour, timep->tm_min); std::string action; switch(mcd->mType) { case MEAN_BUMP: action = "bump"; break; case MEAN_LLPUSHOBJECT: action = "llpushobject"; break; case MEAN_SELECTED_OBJECT_COLLIDE: action = "selected_object_collide"; break; case MEAN_SCRIPTED_OBJECT_COLLIDE: action = "scripted_object_collide"; break; case MEAN_PHYSICAL_OBJECT_COLLIDE: action = "physical_object_collide"; break; default: LL_INFOS() << "LLFloaterBump::add unknown mean collision type " << mcd->mType << LL_ENDL; return; } // All above action strings are in XML file LLUIString text = getString(action); text.setArg("[TIME]", timeStr); text.setArg("[NAME]", mcd->mFullName); LLSD row; row["id"] = mcd->mPerp; row["columns"][0]["value"] = text; row["columns"][0]["font"] = "SansSerifBold"; list->addElement(row); }
std::string LLViewerTextEditor::appendTime(bool prepend_newline) { time_t utc_time; utc_time = time_corrected(); // There's only one internal tm buffer. struct tm* timep; // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. timep = utc_to_pacific_time(utc_time, gPacificDaylightTime); std::string text = llformat("[%d:%02d] ", timep->tm_hour, timep->tm_min); appendColoredText(text, false, prepend_newline, LLColor4::grey); return text; }
void LLPanelDirEvents::setDay(S32 day) { mDay = day; // Get time UTC time_t utc_time = time_corrected(); // Correct for offset utc_time += day * 24 * 60 * 60; // There's only one internal tm buffer. struct tm* internal_time; // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. internal_time = utc_to_pacific_time(utc_time, gPacificDaylightTime); std::string date; timeStructToFormattedString(internal_time, "%m-%d", date); childSetValue("date_text", date); }
void LLPanelDirEvents::setDay(S32 day) { mDay = day; // Get time UTC time_t utc_time = time_corrected(); // Correct for offset utc_time += day * 24 * 60 * 60; // There's only one internal tm buffer. struct tm* internal_time; // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. internal_time = utc_to_pacific_time(utc_time, gPacificDaylightTime); std::string buffer = llformat("%d/%d", 1 + internal_time->tm_mon, // Jan = 0 internal_time->tm_mday); // 2001 = 101 childSetValue("date_text", buffer); }
void LLFloaterTeleportHistory::addPendingEntry(std::string regionName, S16 x, S16 y, S16 z) { // [RLVa:KB] if(gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) return; // [/RLVa:KB] // Set pending entry timestamp U32 utc_time; utc_time = time_corrected(); struct tm* internal_time; internal_time = utc_to_pacific_time(utc_time, gPacificDaylightTime); // check if we are in daylight savings time std::string timeZone = " PST"; if (gPacificDaylightTime) { timeZone = " PDT"; } #ifdef LOCALIZED_TIME timeStructToFormattedString(internal_time, gSavedSettings.getString("LongTimeFormat"), mPendingTimeString); mPendingTimeString += timeZone; #else mPendingTimeString = llformat("%02d:%02d:%02d", internal_time->tm_hour, internal_time->tm_min, internal_time->tm_sec) + timeZone; #endif // Set pending region name mPendingRegionName = regionName; // Set pending position mPendingPosition = llformat("%d, %d, %d", x, y, z); // prepare simstring for later parsing mPendingSimString = regionName + llformat("/%d/%d/%d", x, y, z); mPendingSimString = LLWeb::escapeURL(mPendingSimString); // Prepare the SLURL mPendingSLURL = LLURLDispatcher::buildSLURL(regionName, x, y, z); }
// public static void LLWorldMap::processMapItemReply(LLMessageSystem* msg, void**) { U32 type; msg->getU32Fast(_PREHASH_RequestData, _PREHASH_ItemType, type); S32 num_blocks = msg->getNumberOfBlocks("Data"); for (S32 block=0; block<num_blocks; ++block) { U32 X, Y; std::string name; S32 extra, extra2; LLUUID uuid; msg->getU32Fast(_PREHASH_Data, _PREHASH_X, X, block); msg->getU32Fast(_PREHASH_Data, _PREHASH_Y, Y, block); msg->getStringFast(_PREHASH_Data, _PREHASH_Name, name, block); msg->getUUIDFast(_PREHASH_Data, _PREHASH_ID, uuid, block); msg->getS32Fast(_PREHASH_Data, _PREHASH_Extra, extra, block); msg->getS32Fast(_PREHASH_Data, _PREHASH_Extra2, extra2, block); F32 world_x = (F32)X; X /= REGION_WIDTH_UNITS; F32 world_y = (F32)Y; Y /= REGION_WIDTH_UNITS; LLItemInfo new_item(world_x, world_y, name, uuid, extra, extra2); LLSimInfo* siminfo = LLWorldMap::getInstance()->simInfoFromHandle(new_item.mRegionHandle); switch (type) { case MAP_ITEM_TELEHUB: // telehubs { // Telehub color, store in extra as 4 U8's U8 *color = (U8 *)&new_item.mExtra; F32 red = fmod((F32)X * 0.11f, 1.f) * 0.8f; F32 green = fmod((F32)Y * 0.11f, 1.f) * 0.8f; F32 blue = fmod(1.5f * (F32)(X + Y) * 0.11f, 1.f) * 0.8f; F32 add_amt = (X % 2) ? 0.15f : -0.15f; add_amt += (Y % 2) ? -0.15f : 0.15f; color[0] = U8((red + add_amt) * 255); color[1] = U8((green + add_amt) * 255); color[2] = U8((blue + add_amt) * 255); color[3] = 255; // extra2 specifies whether this is an infohub or a telehub. if (extra2) { LLWorldMap::getInstance()->mInfohubs.push_back(new_item); } else { LLWorldMap::getInstance()->mTelehubs.push_back(new_item); } break; } case MAP_ITEM_PG_EVENT: // events case MAP_ITEM_MATURE_EVENT: case MAP_ITEM_ADULT_EVENT: { struct tm* timep; // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. timep = utc_to_pacific_time(extra, gPacificDaylightTime); S32 display_hour = timep->tm_hour % 12; if (display_hour == 0) display_hour = 12; new_item.mToolTip = llformat( "%d:%02d %s", display_hour, timep->tm_min, (timep->tm_hour < 12 ? "AM" : "PM") ); // HACK: store Z in extra2 new_item.mPosGlobal.mdV[VZ] = (F64)extra2; if (type == MAP_ITEM_PG_EVENT) { LLWorldMap::getInstance()->mPGEvents.push_back(new_item); } else if (type == MAP_ITEM_MATURE_EVENT) { LLWorldMap::getInstance()->mMatureEvents.push_back(new_item); } else if (type == MAP_ITEM_ADULT_EVENT) { LLWorldMap::getInstance()->mAdultEvents.push_back(new_item); } break; } case MAP_ITEM_LAND_FOR_SALE: // land for sale case MAP_ITEM_LAND_FOR_SALE_ADULT: // adult land for sale { new_item.mToolTip = llformat("%d sq. m. %s%d", new_item.mExtra, gHippoGridManager->getConnectedGrid()->getCurrencySymbol().c_str(), new_item.mExtra2); if (type == MAP_ITEM_LAND_FOR_SALE) { LLWorldMap::getInstance()->mLandForSale.push_back(new_item); } else if (type == MAP_ITEM_LAND_FOR_SALE_ADULT) { LLWorldMap::getInstance()->mLandForSaleAdult.push_back(new_item); } break; } case MAP_ITEM_CLASSIFIED: // classifieds { //DEPRECATED: no longer used break; } case MAP_ITEM_AGENT_LOCATIONS: // agent locations { if (!siminfo) { llinfos << "siminfo missing for " << new_item.mPosGlobal.mdV[0] << ", " << new_item.mPosGlobal.mdV[1] << llendl; break; } // llinfos << "New Location " << new_item.mName << llendl; item_info_list_t& agentcounts = LLWorldMap::getInstance()->mAgentLocationsMap[new_item.mRegionHandle]; // Find the last item in the list with a different name and erase them item_info_list_t::iterator lastiter; for (lastiter = agentcounts.begin(); lastiter!=agentcounts.end(); ++lastiter) { const LLItemInfo& info = *lastiter; if (info.mName == new_item.mName) { break; } } if (lastiter != agentcounts.begin()) { agentcounts.erase(agentcounts.begin(), lastiter); } // Now append the new location if (new_item.mExtra > 0) { agentcounts.push_back(new_item); } break; } default: break; }; } }
void LLPanelDirEvents::performQueryOrDelete(U32 event_id) { S32 relative_day = mDay; // Update the date field to show the date IN THE SERVER'S // TIME ZONE, as that is what will be displayed in each event // Get time UTC time_t utc_time = time_corrected(); // Correct for offset utc_time += relative_day * 24 * 60 * 60; // There's only one internal tm buffer. struct tm* internal_time; // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. internal_time = utc_to_pacific_time(utc_time, gPacificDaylightTime); std::string date; timeStructToFormattedString(internal_time, "%m-%d", date); childSetValue("date_text", date); // Record the relative day so back and forward buttons // offset from this day. mDay = relative_day; mDoneQuery = TRUE; U32 scope = DFQ_DATE_EVENTS; if ( gAgent.wantsPGOnly()) scope |= DFQ_PG_SIMS_ONLY; if ( childGetValue("incpg").asBoolean() ) scope |= DFQ_INC_PG; if ( childGetValue("incmature").asBoolean() ) scope |= DFQ_INC_MATURE; if ( childGetValue("incadult").asBoolean() ) scope |= DFQ_INC_ADULT; if (childGetValue("filter_gaming").asBoolean()) scope |= DFQ_FILTER_GAMING; // Add old query flags in case we are talking to an old server if ( childGetValue("incpg").asBoolean() && !childGetValue("incmature").asBoolean()) { scope |= DFQ_PG_EVENTS_ONLY; } if ( !( scope & (DFQ_INC_PG | DFQ_INC_MATURE | DFQ_INC_ADULT ))) { LLNotificationsUtil::add("NoContentToSearch"); return; } setupNewSearch(); std::ostringstream params; // Date mode for the search if ("current" == childGetValue("date_mode").asString()) { params << "u|"; } else { params << mDay << "|"; } // Categories are stored in the database in table indra.event_category // XML must match. U32 cat_id = childGetValue("category combo").asInteger(); params << cat_id << "|"; params << childGetValue("event_search_text").asString(); // send the message if (0 == event_id) { sendDirFindQuery(gMessageSystem, mSearchID, params.str(), scope, mSearchStart); } else { // This delete will also perform a query. LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_EventGodDelete); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_EventData); msg->addU32Fast(_PREHASH_EventID, event_id); msg->nextBlockFast(_PREHASH_QueryData); msg->addUUIDFast(_PREHASH_QueryID, mSearchID); msg->addStringFast(_PREHASH_QueryText, params.str()); msg->addU32Fast(_PREHASH_QueryFlags, scope); msg->addS32Fast(_PREHASH_QueryStart, mSearchStart); gAgent.sendReliableMessage(); } }
void LLPanelDirBrowser::processDirEventsReply(LLMessageSystem* msg, void**) { LLUUID agent_id; LLUUID query_id; LLUUID owner_id; std::string name; std::string date; BOOL show_pg = gSavedSettings.getBOOL("ShowPGEvents"); BOOL show_mature = gSavedSettings.getBOOL("ShowMatureEvents"); BOOL show_adult = gSavedSettings.getBOOL("ShowAdultEvents"); msg->getUUID("AgentData", "AgentID", agent_id); msg->getUUID("QueryData", "QueryID", query_id ); LLPanelDirBrowser* self; self = gDirBrowserInstances.getIfThere(query_id); if (!self) { return; } if (msg->getNumberOfBlocks("StatusData")) { U32 status; msg->getU32("StatusData", "Status", status); if (status & STATUS_SEARCH_EVENTS_BANNEDWORD) { LLNotificationsUtil::add("SearchWordBanned"); } } self->mHaveSearchResults = TRUE; LLScrollListCtrl* list = self->findChild<LLScrollListCtrl>("results"); if (!list) return; if (!list->getCanSelect()) { list->operateOnAll(LLCtrlListInterface::OP_DELETE); self->mResultsContents = LLSD(); } S32 rows = msg->getNumberOfBlocks("QueryReplies"); self->mResultsReceived += rows; rows = self->showNextButton(rows); for (S32 i = 0; i < rows; i++) { U32 event_id; U32 unix_time; U32 event_flags; msg->getUUID("QueryReplies", "OwnerID", owner_id, i); msg->getString("QueryReplies", "Name", name, i); msg->getU32("QueryReplies", "EventID", event_id, i); // msg->getString("QueryReplies", "Date", date, i); msg->getU32("QueryReplies", "UnixTime", unix_time, i); msg->getU32("QueryReplies", "EventFlags", event_flags, i); // Skip empty events if (owner_id.isNull()) { //RN: should this check event_id instead? llwarns << "skipped event due to owner_id null, event_id " << event_id << llendl; continue; } // skip events that don't match the flags // there's no PG flag, so we make sure neither adult nor mature is set if (((event_flags & (EVENT_FLAG_ADULT | EVENT_FLAG_MATURE)) == EVENT_FLAG_NONE) && !show_pg) { //llwarns << "Skipped pg event because we're not showing pg, event_id " << event_id << llendl; continue; } if ((event_flags & EVENT_FLAG_MATURE) && !show_mature) { //llwarns << "Skipped mature event because we're not showing mature, event_id " << event_id << llendl; continue; } if ((event_flags & EVENT_FLAG_ADULT) && !show_adult) { //llwarns << "Skipped adult event because we're not showing adult, event_id " << event_id << llendl; continue; } LLSD content; content["type"] = EVENT_CODE; content["name"] = name; content["event_id"] = (S32)event_id; LLSD row; row["id"] = llformat("%u", event_id); // Column 0 - event icon LLUUID image_id; if (event_flags == EVENT_FLAG_ADULT) { row["columns"][0]["column"] = "icon"; row["columns"][0]["type"] = "icon"; row["columns"][0]["value"] = "icon_event_adult.tga"; } else if (event_flags == EVENT_FLAG_MATURE) { row["columns"][0]["column"] = "icon"; row["columns"][0]["type"] = "icon"; row["columns"][0]["value"] = "icon_event_mature.tga"; } else { row["columns"][0]["column"] = "icon"; row["columns"][0]["type"] = "icon"; row["columns"][0]["value"] = "icon_event.tga"; } row["columns"][1]["column"] = "name"; row["columns"][1]["value"] = name; row["columns"][1]["font"] = "SANSSERIF"; struct tm* t = utc_to_pacific_time(unix_time, gPacificDaylightTime); std::string format = "%m-%d "; format += gSavedSettings.getString("ShortTimeFormat"); timeStructToFormattedString(t, format, date); row["columns"][2]["column"] = "date"; row["columns"][2]["value"] = date; row["columns"][2]["font"] = "SANSSERIF_SMALL"; row["columns"][3]["column"] = "time"; row["columns"][3]["value"] = llformat("%u", unix_time); row["columns"][3]["font"] = "SANSSERIF_SMALL"; list->addElement(row, ADD_SORTED); std::string id_str = llformat("%u", event_id); self->mResultsContents[id_str] = content; } list->sortByColumn(self->mCurrentSortColumn, self->mCurrentSortAscending); self->updateResultCount(); // Poke the result received timer self->mLastResultTimer.reset(); self->mDidAutoSelect = FALSE; }
void LLPanelDirEvents::performQueryOrDelete(U32 event_id) { S32 relative_day = mDay; // Update the date field to show the date IN THE SERVER'S // TIME ZONE, as that is what will be displayed in each event // Get time UTC time_t utc_time = time_corrected(); // Correct for offset utc_time += relative_day * 24 * 60 * 60; // There's only one internal tm buffer. struct tm* internal_time; // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. internal_time = utc_to_pacific_time(utc_time, gPacificDaylightTime); std::string buffer = llformat("%d/%d", 1 + internal_time->tm_mon, // Jan = 0 internal_time->tm_mday); // 2001 = 101 childSetValue("date_text", buffer); // Record the relative day so back and forward buttons // offset from this day. mDay = relative_day; mDoneQuery = TRUE; setupNewSearch(); U32 scope = DFQ_DATE_EVENTS; if ( !childGetValue("incmature").asBoolean() ) scope |= DFQ_PG_EVENTS_ONLY; std::ostringstream params; // Date mode for the search if ("current" == childGetValue("date_mode").asString()) { params << "u|"; } else { params << mDay << "|"; } // Categories are stored in the database in table indra.event_category // XML must match. U32 cat_id = childGetValue("category combo").asInteger(); params << cat_id << "|"; params << childGetValue("event_search_text").asString(); // send the message if (0 == event_id) { sendDirFindQuery(gMessageSystem, mSearchID, params.str(), scope, mSearchStart); } else { // This delete will also perform a query. LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_EventGodDelete); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_EventData); msg->addU32Fast(_PREHASH_EventID, event_id); msg->nextBlockFast(_PREHASH_QueryData); msg->addUUIDFast(_PREHASH_QueryID, mSearchID); msg->addStringFast(_PREHASH_QueryText, params.str()); msg->addU32Fast(_PREHASH_QueryFlags, scope); msg->addS32Fast(_PREHASH_QueryStart, mSearchStart); gAgent.sendReliableMessage(); } }
// static public // Insert an item in the relevant region map // returns true if item inserted, false otherwise bool LLWorldMap::insertItem(U32 x_world, U32 y_world, std::string& name, LLUUID& uuid, U32 type, S32 extra, S32 extra2) { // Create an item record for the received object LLItemInfo new_item((F32)x_world, (F32)y_world, name, uuid); // Compute a region handle based on the objects coordinates LLVector3d pos((F32)x_world, (F32)y_world, 40.0); U64 handle = to_region_handle(pos); // Get the region record for that handle or NULL if we haven't browsed it yet LLSimInfo* siminfo = LLWorldMap::getInstance()->simInfoFromHandle(handle); if (siminfo == NULL) { siminfo = LLWorldMap::getInstance()->createSimInfoFromHandle(handle); } //LL_INFOS("World Map") << "Process item : type = " << type << LL_ENDL; switch (type) { case MAP_ITEM_TELEHUB: // telehubs { /* Merov: we are not using the hub color anymore for display so commenting that out // Telehub color U32 X = x_world / REGION_WIDTH_UNITS; U32 Y = y_world / REGION_WIDTH_UNITS; F32 red = fmod((F32)X * 0.11f, 1.f) * 0.8f; F32 green = fmod((F32)Y * 0.11f, 1.f) * 0.8f; F32 blue = fmod(1.5f * (F32)(X + Y) * 0.11f, 1.f) * 0.8f; F32 add_amt = (X % 2) ? 0.15f : -0.15f; add_amt += (Y % 2) ? -0.15f : 0.15f; LLColor4 color(red + add_amt, green + add_amt, blue + add_amt); new_item.setColor(color); */ // extra2 specifies whether this is an infohub or a telehub. if (extra2) { siminfo->insertInfoHub(new_item); } else { siminfo->insertTeleHub(new_item); } break; } case MAP_ITEM_PG_EVENT: // events case MAP_ITEM_MATURE_EVENT: case MAP_ITEM_ADULT_EVENT: { struct tm* timep; // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. timep = utc_to_pacific_time(extra, gPacificDaylightTime); S32 display_hour = timep->tm_hour % 12; if (display_hour == 0) display_hour = 12; std::string tooltip = llformat( "%d:%02d %s", display_hour, timep->tm_min, (timep->tm_hour < 12 ? "AM" : "PM") ); new_item.setTooltip(tooltip); // HACK: store Z in extra2 new_item.setElevation((F64)extra2); if (type == MAP_ITEM_PG_EVENT) { siminfo->insertPGEvent(new_item); } else if (type == MAP_ITEM_MATURE_EVENT) { siminfo->insertMatureEvent(new_item); } else if (type == MAP_ITEM_ADULT_EVENT) { siminfo->insertAdultEvent(new_item); } break; } case MAP_ITEM_LAND_FOR_SALE: // land for sale case MAP_ITEM_LAND_FOR_SALE_ADULT: // adult land for sale { F32 cost_per_sqm = 0.0f; if (extra > 0) { cost_per_sqm = (F32)extra2 / (F32)extra; } std::string tooltip = llformat("%d sq.m. L$%d (L$ %.1f/sq.m.)", extra, extra2, cost_per_sqm); new_item.setTooltip(tooltip); if (type == MAP_ITEM_LAND_FOR_SALE) { siminfo->insertLandForSale(new_item); } else if (type == MAP_ITEM_LAND_FOR_SALE_ADULT) { siminfo->insertLandForSaleAdult(new_item); } break; } case MAP_ITEM_CLASSIFIED: // classifieds { //DEPRECATED: no longer used break; } case MAP_ITEM_AGENT_LOCATIONS: // agent locations { // LL_INFOS("World Map") << "New Location " << new_item.mName << LL_ENDL; if (extra > 0) { new_item.setCount(extra); siminfo->insertAgentLocation(new_item); } break; } default: break; } return true; }
// Per-frame updates of visibility void LLStatusBar::refresh() { F32 bwtotal = gViewerThrottle.getMaxBandwidth() / 1000.f; mSGBandwidth->setMin(0.f); mSGBandwidth->setMax(bwtotal*1.25f); mSGBandwidth->setThreshold(0, bwtotal*0.75f); mSGBandwidth->setThreshold(1, bwtotal); mSGBandwidth->setThreshold(2, bwtotal); // Get current UTC time, adjusted for the user's clock // being off. U32 utc_time; utc_time = time_corrected(); // There's only one internal tm buffer. struct tm* internal_time; // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. internal_time = utc_to_pacific_time(utc_time, gPacificDaylightTime); S32 hour = internal_time->tm_hour; S32 min = internal_time->tm_min; std::string am_pm = "AM"; if (hour > 11) { hour -= 12; am_pm = "PM"; } std::string tz = "PST"; if (gPacificDaylightTime) { tz = "PDT"; } // Zero hour is 12 AM if (hour == 0) hour = 12; std::ostringstream t; t << std::setfill(' ') << std::setw(2) << hour << ":" << std::setfill('0') << std::setw(2) << min << " " << am_pm << " " << tz; mTextTime->setText(t.str().c_str()); LLRect r; const S32 MENU_RIGHT = gMenuBarView->getRightmostMenuEdge(); S32 x = MENU_RIGHT + MENU_PARCEL_SPACING; S32 y = 0; // reshape menu bar to its content's width if (MENU_RIGHT != gMenuBarView->getRect().getWidth()) { gMenuBarView->reshape(MENU_RIGHT, gMenuBarView->getRect().getHeight()); } LLViewerRegion *region = gAgent.getRegion(); LLParcel *parcel = gParcelMgr->getAgentParcel(); LLRect buttonRect; if (LLHUDIcon::iconsNearby()) { childGetRect( "scriptout", buttonRect ); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); mBtnScriptOut->setRect(r); mBtnScriptOut->setVisible(TRUE); x += buttonRect.getWidth(); } else { mBtnScriptOut->setVisible(FALSE); } if ((region && region->getAllowDamage()) || (parcel && parcel->getAllowDamage()) ) { // set visibility based on flashing if( mHealthTimer->hasExpired() ) { mBtnHealth->setVisible( TRUE ); } else { BOOL flash = S32(mHealthTimer->getElapsedSeconds() * ICON_FLASH_FREQUENCY) & 1; mBtnHealth->setVisible( flash ); } mTextHealth->setVisible(TRUE); // Health childGetRect( "health", buttonRect ); r.setOriginAndSize( x, y-GRAPHIC_FUDGE, buttonRect.getWidth(), buttonRect.getHeight()); mBtnHealth->setRect(r); x += buttonRect.getWidth(); const S32 health_width = S32( LLFontGL::sSansSerifSmall->getWidth("100%") ); r.set(x, y+TEXT_HEIGHT - 2, x+health_width, y); mTextHealth->setRect(r); x += health_width; } else { // invisible if region doesn't allow damage mBtnHealth->setVisible(FALSE); mTextHealth->setVisible(FALSE); } if ((region && region->getBlockFly()) || (parcel && !parcel->getAllowFly()) ) { // No Fly Zone childGetRect( "fly", buttonRect ); mBtnFly->setVisible(TRUE); r.setOriginAndSize( x, y-GRAPHIC_FUDGE, buttonRect.getWidth(), buttonRect.getHeight()); mBtnFly->setRect(r); x += buttonRect.getWidth(); } else { mBtnFly->setVisible(FALSE); } BOOL no_build = parcel && !parcel->getAllowModify(); mBtnBuild->setVisible( no_build ); if (no_build) { childGetRect( "build", buttonRect ); // No Build Zone r.setOriginAndSize( x, y-GRAPHIC_FUDGE, buttonRect.getWidth(), buttonRect.getHeight()); mBtnBuild->setRect(r); x += buttonRect.getWidth(); } BOOL no_scripts = FALSE; if((region && ((region->getRegionFlags() & REGION_FLAGS_SKIP_SCRIPTS) || (region->getRegionFlags() & REGION_FLAGS_ESTATE_SKIP_SCRIPTS))) || (parcel && !parcel->getAllowOtherScripts())) { no_scripts = TRUE; } mBtnScripts->setVisible( no_scripts ); if (no_scripts) { // No scripts childGetRect( "scripts", buttonRect ); r.setOriginAndSize( x, y-GRAPHIC_FUDGE, buttonRect.getWidth(), buttonRect.getHeight()); mBtnScripts->setRect(r); x += buttonRect.getWidth(); } BOOL no_region_push = (region && region->getRestrictPushObject()); BOOL no_push = no_region_push || (parcel && parcel->getRestrictPushObject()); mBtnPush->setVisible( no_push ); if (no_push) { childGetRect( "restrictpush", buttonRect ); // No Push Zone r.setOriginAndSize( x, y-GRAPHIC_FUDGE, buttonRect.getWidth(), buttonRect.getHeight()); mBtnPush->setRect(r); x += buttonRect.getWidth(); } BOOL canBuyLand = parcel && !parcel->isPublic() && gParcelMgr->canAgentBuyParcel(parcel, false); mBtnBuyLand->setVisible(canBuyLand); if (canBuyLand) { childGetRect( "buyland", buttonRect ); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); mBtnBuyLand->setRect(r); x += buttonRect.getWidth(); } LLString location_name; if (region) { const LLVector3& agent_pos_region = gAgent.getPositionAgent(); S32 pos_x = lltrunc( agent_pos_region.mV[VX] ); S32 pos_y = lltrunc( agent_pos_region.mV[VY] ); S32 pos_z = lltrunc( agent_pos_region.mV[VZ] ); // Round the numbers based on the velocity LLVector3 agent_velocity = gAgent.getVelocity(); F32 velocity_mag_sq = agent_velocity.magVecSquared(); const F32 FLY_CUTOFF = 6.f; // meters/sec const F32 FLY_CUTOFF_SQ = FLY_CUTOFF * FLY_CUTOFF; const F32 WALK_CUTOFF = 1.5f; // meters/sec const F32 WALK_CUTOFF_SQ = WALK_CUTOFF * WALK_CUTOFF; if (velocity_mag_sq > FLY_CUTOFF_SQ) { pos_x -= pos_x % 4; pos_y -= pos_y % 4; } else if (velocity_mag_sq > WALK_CUTOFF_SQ) { pos_x -= pos_x % 2; pos_y -= pos_y % 2; } if (parcel && parcel->getName()) { location_name = region->getName() + llformat(" %d, %d, %d (%s) - %s", pos_x, pos_y, pos_z, region->getSimAccessString(), parcel->getName()); } else { location_name = region->getName() + llformat(" %d, %d, %d (%s)", pos_x, pos_y, pos_z, region->getSimAccessString()); } } else { // no region location_name = "(Unknown)"; } mTextParcelName->setText(location_name); // Adjust region name and parcel name x += 4; const S32 PARCEL_RIGHT = llmin(mTextTime->getRect().mLeft, mTextParcelName->getTextPixelWidth() + x + 5); r.set(x+4, mRect.getHeight() - 2, PARCEL_RIGHT, 0); mTextParcelName->setRect(r); }
// Per-frame updates of visibility void LLStatusBar::refresh() { if(gDisconnected) return; //or crash if the sim crashes; because: already ~LLMenuBarGL() // Adding Net Stat Meter back in F32 bwtotal = gViewerThrottle.getMaxBandwidth() / 1000.f; mSGBandwidth->setMin(0.f); mSGBandwidth->setMax(bwtotal*1.25f); mSGBandwidth->setThreshold(0, bwtotal*0.75f); mSGBandwidth->setThreshold(1, bwtotal); mSGBandwidth->setThreshold(2, bwtotal); // *TODO: Localize / translate time // Get current UTC time, adjusted for the user's clock // being off. time_t utc_time; utc_time = time_corrected(); // There's only one internal tm buffer. struct tm* internal_time; // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. internal_time = utc_to_pacific_time(utc_time, gPacificDaylightTime); std::string t; timeStructToFormattedString(internal_time, gSavedSettings.getString("ShortTimeFormat"), t); if (gPacificDaylightTime) { t += " PDT"; } else { t += " PST"; } mTextTime->setText(t); std::string date; timeStructToFormattedString(internal_time, gSavedSettings.getString("LongDateFormat"), date); mTextTime->setToolTip(date); LLRect r; const S32 MENU_RIGHT = gMenuBarView->getRightmostMenuEdge(); S32 x = MENU_RIGHT + MENU_PARCEL_SPACING; S32 y = 0; bool search_visible = gSavedSettings.getBOOL("ShowSearchBar"); // reshape menu bar to its content's width if (MENU_RIGHT != gMenuBarView->getRect().getWidth()) { gMenuBarView->reshape(MENU_RIGHT, gMenuBarView->getRect().getHeight()); } LLViewerRegion *region = gAgent.getRegion(); LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); LLRect buttonRect; if (LLHUDIcon::iconsNearby()) { childGetRect( "scriptout", buttonRect ); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); childSetRect("scriptout",r); childSetVisible("scriptout", true); x += buttonRect.getWidth(); } else { childSetVisible("scriptout", false); } if ((region && region->getAllowDamage()) || (parcel && parcel->getAllowDamage()) ) { // set visibility based on flashing if( mHealthTimer->hasExpired() ) { childSetVisible("health", true); } else { BOOL flash = S32(mHealthTimer->getElapsedSeconds() * ICON_FLASH_FREQUENCY) & 1; childSetVisible("health", flash); } mTextHealth->setVisible(TRUE); // Health childGetRect( "health", buttonRect ); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); childSetRect("health", r); x += buttonRect.getWidth(); const S32 health_width = S32( LLFontGL::getFontSansSerifSmall()->getWidth(std::string("100%")) ); r.set(x, y+TEXT_HEIGHT - 2, x+health_width, y); mTextHealth->setRect(r); x += health_width; } else { // invisible if region doesn't allow damage childSetVisible("health", false); mTextHealth->setVisible(FALSE); } if ((region && region->getBlockFly()) || (parcel && !parcel->getAllowFly()) ) { // No Fly Zone childGetRect( "no_fly", buttonRect ); childSetVisible( "no_fly", true ); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); childSetRect( "no_fly", r ); x += buttonRect.getWidth(); } else { // Fly Zone childSetVisible("no_fly", false); } BOOL no_build = parcel && !parcel->getAllowModify(); if (no_build) { childSetVisible("no_build", TRUE); childGetRect( "no_build", buttonRect ); // No Build Zone r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); childSetRect( "no_build", r ); x += buttonRect.getWidth(); } else { childSetVisible("no_build", FALSE); } BOOL no_scripts = FALSE; if((region && (region->getRegionFlag(REGION_FLAGS_SKIP_SCRIPTS) || region->getRegionFlag(REGION_FLAGS_ESTATE_SKIP_SCRIPTS))) || (parcel && !parcel->getAllowOtherScripts())) { no_scripts = TRUE; } if (no_scripts) { // No scripts childSetVisible("no_scripts", TRUE); childGetRect( "no_scripts", buttonRect ); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); childSetRect( "no_scripts", r ); x += buttonRect.getWidth(); } else { // Yes scripts childSetVisible("no_scripts", FALSE); } BOOL no_region_push = (region && region->getRestrictPushObject()); BOOL no_push = no_region_push || (parcel && parcel->getRestrictPushObject()); if (no_push) { childSetVisible("restrictpush", TRUE); childGetRect( "restrictpush", buttonRect ); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); childSetRect( "restrictpush", r ); x += buttonRect.getWidth(); } else { childSetVisible("restrictpush", FALSE); } BOOL have_voice = parcel && parcel->getParcelFlagAllowVoice(); if (have_voice) { childSetVisible("status_no_voice", FALSE); } else { childSetVisible("status_no_voice", TRUE); childGetRect( "status_no_voice", buttonRect ); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); childSetRect( "status_no_voice", r ); x += buttonRect.getWidth(); } bool no_see_avs = parcel && !parcel->getSeeAVs(); childSetVisible("status_SeeAV", no_see_avs); if (no_see_avs) { childGetRect( "status_SeeAV", buttonRect ); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); childSetRect( "status_SeeAV", r ); x += buttonRect.getWidth(); } if (region) { bool pf_disabled = !region->dynamicPathfindingEnabled(); getChild<LLUICtrl>("pf_dirty")->setVisible(!pf_disabled && mIsNavMeshDirty); getChild<LLUICtrl>("pf_disabled")->setVisible(pf_disabled); const std::string pf_icon = pf_disabled ? "pf_disabled" : mIsNavMeshDirty ? "pf_dirty" : ""; if (!pf_icon.empty()) { x += 6; childGetRect(pf_icon, buttonRect); r.setOriginAndSize(x, y, buttonRect.getWidth(), buttonRect.getHeight()); childSetRect(pf_icon, r); x += buttonRect.getWidth(); } } BOOL canBuyLand = parcel && !parcel->isPublic() && LLViewerParcelMgr::getInstance()->canAgentBuyParcel(parcel, false); childSetVisible("buyland", canBuyLand); if (canBuyLand) { //HACK: layout tweak until this is all xml x += 9; childGetRect( "buyland", buttonRect ); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); childSetRect( "buyland", r ); x += buttonRect.getWidth(); } std::string location_name; if (region) { const LLVector3& agent_pos_region = gAgent.getPositionAgent(); S32 pos_x = lltrunc( agent_pos_region.mV[VX] ); S32 pos_y = lltrunc( agent_pos_region.mV[VY] ); S32 pos_z = lltrunc( agent_pos_region.mV[VZ] ); // Round the numbers based on the velocity LLVector3 agent_velocity = gAgent.getVelocity(); F32 velocity_mag_sq = agent_velocity.magVecSquared(); const F32 FLY_CUTOFF = 6.f; // meters/sec const F32 FLY_CUTOFF_SQ = FLY_CUTOFF * FLY_CUTOFF; const F32 WALK_CUTOFF = 1.5f; // meters/sec const F32 WALK_CUTOFF_SQ = WALK_CUTOFF * WALK_CUTOFF; if (velocity_mag_sq > FLY_CUTOFF_SQ) { pos_x -= pos_x % 4; pos_y -= pos_y % 4; } else if (velocity_mag_sq > WALK_CUTOFF_SQ) { pos_x -= pos_x % 2; pos_y -= pos_y % 2; } if (parcel) { if (!LLAgentUI::buildLocationString(location_name, LLAgentUI::LOCATION_FORMAT_FULL)) { location_name = "???"; } } else { location_name = region->getName() + llformat(" %d, %d, %d (%s)", pos_x, pos_y, pos_z, region->getSimAccessString().c_str()); } static LLCachedControl<bool> show_channel("ShowSimChannel"); if (show_channel && !gLastVersionChannel.empty()) location_name += " - " + gLastVersionChannel; } else { // no region location_name = "(Unknown)"; } // [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) | Modified: RLVa-1.0.0a if ( (region) && (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ) // region == NULL if we lose our connection to the grid { location_name = llformat("%s (%s) - %s", RlvStrings::getString(RLV_STRING_HIDDEN_REGION).c_str(), region->getSimAccessString().c_str(), RlvStrings::getString(RLV_STRING_HIDDEN).c_str()); } // [/RLVa:KB] mTextParcelName->setText(location_name); // x = right edge // loop through: stat graphs, search btn, search text editor, money, buy money, clock // adjust rect // finally adjust parcel name rect S32 new_right = getRect().getWidth(); if (search_visible) { childGetRect("search_btn", r); //r.translate( new_right - r.mRight, 0); //childSetRect("search_btn", r); new_right -= r.getWidth(); childGetRect("search_editor", r); //r.translate( new_right - r.mRight, 0); //childSetRect("search_editor", r); new_right -= r.getWidth() + 6; } else { childGetRect("stat_btn", r); r.translate( new_right - r.mRight, 0); childSetRect("stat_btn", r); new_right -= r.getWidth() + 6; } // Set rects of money, buy money, time if (mUPCSupported) { childGetRect("UPCText", r); r.translate( new_right - r.mRight, 0); childSetRect("UPCText", r); new_right -= r.getWidth() - 18; } childGetRect("BalanceText", r); r.translate( new_right - r.mRight, 0); childSetRect("BalanceText", r); new_right -= r.getWidth() - 18; childGetRect("buycurrency", r); r.translate( new_right - r.mRight, 0); childSetRect("buycurrency", r); new_right -= r.getWidth() + 6; childGetRect("TimeText", r); // mTextTime->getTextPixelWidth(); r.translate( new_right - r.mRight, 0); childSetRect("TimeText", r); // new_right -= r.getWidth() + MENU_PARCEL_SPACING; // Adjust region name and parcel name x += 8; const S32 PARCEL_RIGHT = llmin(mTextTime->getRect().mLeft, mTextParcelName->getTextPixelWidth() + x + 5); r.set(x+4, getRect().getHeight() - 2, PARCEL_RIGHT, 0); mTextParcelName->setRect(r); // Set search bar visibility childSetVisible("search_editor", search_visible); childSetVisible("search_btn", search_visible); childSetVisible("menubar_search_bevel_bg", search_visible); mSGBandwidth->setVisible(! search_visible); mSGPacketLoss->setVisible(! search_visible); childSetEnabled("stat_btn", ! search_visible); }
// Per-frame updates of visibility void LLStatusBar::refresh() { if(gDisconnected) return; //or crash if the sim crashes; because: already ~LLMenuBarGL() // Adding Net Stat Meter back in F32 bwtotal = gViewerThrottle.getMaxBandwidth() / 1000.f; mSGBandwidth->setMin(0.f); mSGBandwidth->setMax(bwtotal*1.25f); mSGBandwidth->setThreshold(0, bwtotal*0.75f); mSGBandwidth->setThreshold(1, bwtotal); mSGBandwidth->setThreshold(2, bwtotal); // Singu Note: Use system's time if the user desires, otherwise use server time static const LLCachedControl<bool> show_local_time("LiruLocalTime"); // Get current UTC time, adjusted for the user's clock // being off. time_t utc_time = show_local_time ? time(NULL) : time_corrected(); // There's only one internal tm buffer. struct tm* internal_time; // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. internal_time = show_local_time ? std::localtime(&utc_time) : utc_to_pacific_time(utc_time, gPacificDaylightTime); static const LLCachedControl<std::string> short_time_fmt(gSavedSettings, "ShortTimeFormat"); std::string t; timeStructToFormattedString(internal_time, short_time_fmt, t); if (show_local_time) { static const std::string local(" " + getString("Local")); t += local; } else if (gPacificDaylightTime) { t += " PDT"; } else { t += " PST"; } mTextTime->setText(t); static const LLCachedControl<std::string> long_date_fmt(gSavedSettings, "LongDateFormat"); std::string date; timeStructToFormattedString(internal_time, long_date_fmt, date); mTextTime->setToolTip(date); LLRect r; const S32 MENU_RIGHT = gMenuBarView->getRightmostMenuEdge(); S32 x = MENU_RIGHT + MENU_PARCEL_SPACING; S32 y = 0; // reshape menu bar to its content's width if (MENU_RIGHT != gMenuBarView->getRect().getWidth()) { gMenuBarView->reshape(MENU_RIGHT, gMenuBarView->getRect().getHeight()); } LLViewerRegion *region = gAgent.getRegion(); LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (LLHUDIcon::iconsNearby()) { const LLRect& buttonRect = mScriptOut->getRect(); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); mScriptOut->setRect(r); mScriptOut->setVisible(true); x += buttonRect.getWidth(); } else { mScriptOut->setVisible(false); } if ((region && region->getAllowDamage()) || (parcel && parcel->getAllowDamage()) ) { // set visibility based on flashing mHealthV->setVisible(mHealthTimer->hasExpired() || S32(mHealthTimer->getElapsedSeconds() * ICON_FLASH_FREQUENCY) & 1); mTextHealth->setVisible(TRUE); // Health const LLRect& buttonRect = mHealthV->getRect(); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); mHealthV->setRect(r); x += buttonRect.getWidth(); const S32 health_width = S32( LLFontGL::getFontSansSerifSmall()->getWidth(std::string("100%")) ); r.set(x, y+TEXT_HEIGHT - 2, x+health_width, y); mTextHealth->setRect(r); x += health_width; } else { // invisible if region doesn't allow damage mHealthV->setVisible(false); mTextHealth->setVisible(FALSE); } if ((region && region->getBlockFly()) || (parcel && !parcel->getAllowFly()) ) { // No Fly Zone mNoFly->setVisible(true); const LLRect& buttonRect(mNoFly->getRect()); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); mNoFly->setRect(r); x += buttonRect.getWidth(); } else { // Fly Zone mNoFly->setVisible(false); } if (parcel && !parcel->getAllowModify()) { // No Build Zone mNoBuild->setVisible(true); const LLRect& buttonRect(mNoBuild->getRect()); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); mNoBuild->setRect(r); x += buttonRect.getWidth(); } else { mNoBuild->setVisible(false); } if ((region && (region->getRegionFlag(REGION_FLAGS_SKIP_SCRIPTS) || region->getRegionFlag(REGION_FLAGS_ESTATE_SKIP_SCRIPTS))) || (parcel && !parcel->getAllowOtherScripts())) { // No scripts mNoScripts->setVisible(true); const LLRect& buttonRect(mNoScripts->getRect()); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); mNoScripts->setRect(r); x += buttonRect.getWidth(); } else { // Yes scripts mNoScripts->setVisible(false); } if ((region && region->getRestrictPushObject()) || (parcel && parcel->getRestrictPushObject())) { mRestrictPush->setVisible(true); const LLRect& buttonRect(mRestrictPush->getRect()); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); mRestrictPush->setRect(r); x += buttonRect.getWidth(); } else { mRestrictPush->setVisible(false); } if (parcel && parcel->getParcelFlagAllowVoice()) { mStatusNoVoice->setVisible(false); } else { mStatusNoVoice->setVisible(true); const LLRect& buttonRect(mStatusNoVoice->getRect()); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); mStatusNoVoice->setRect(r); x += buttonRect.getWidth(); } if (parcel && !parcel->getSeeAVs()) { mStatusSeeAV->setVisible(true); const LLRect& buttonRect(mStatusSeeAV->getRect()); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); mStatusSeeAV->setRect(r); x += buttonRect.getWidth(); } else mStatusSeeAV->setVisible(false); if (region) { bool pf_disabled = !region->dynamicPathfindingEnabled(); mPFDirty->setVisible(!pf_disabled && mIsNavMeshDirty); mPFDisabled->setVisible(pf_disabled); if (LLView* pf_icon = pf_disabled ? mPFDisabled : mIsNavMeshDirty ? mPFDirty : NULL) { x += 6; const LLRect& buttonRect(pf_icon->getRect()); r.setOriginAndSize(x, y, buttonRect.getWidth(), buttonRect.getHeight()); pf_icon->setRect(r); x += buttonRect.getWidth(); } } if (parcel && !parcel->isPublic() && LLViewerParcelMgr::getInstance()->canAgentBuyParcel(parcel, false)) { mBuyLand->setVisible(true); //HACK: layout tweak until this is all xml x += 9; const LLRect& buttonRect(mBuyLand->getRect()); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); mBuyLand->setRect(r); x += buttonRect.getWidth(); } else mBuyLand->setVisible(false); std::string location_name; if (region && parcel) { // [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) | Modified: RLVa-1.0.0a if (RlvActions::hasBehaviour(RLV_BHVR_SHOWLOC)) { location_name = llformat("%s (%s) - %s", RlvStrings::getString(RLV_STRING_HIDDEN_REGION).c_str(), region->getSimAccessString().c_str(), RlvStrings::getString(RLV_STRING_HIDDEN).c_str()); } else // [/RLVa:KB] if (!LLAgentUI::buildLocationString(location_name, LLAgentUI::LOCATION_FORMAT_FULL)) location_name = "???"; else { const std::string& grid(LFSimFeatureHandler::instance().gridName()); if (!grid.empty()) location_name += ", " + grid; } static const LLCachedControl<bool> show_channel("ShowSimChannel"); if (show_channel && !gLastVersionChannel.empty()) location_name += " - " + gLastVersionChannel; } else { // no region location_name = "(Unknown)"; } mTextParcelName->setText(location_name); // x = right edge // loop through: stat graphs, search btn, search text editor, money, buy money, clock // adjust rect // finally adjust parcel name rect S32 new_right = getRect().getWidth(); static const LLCachedControl<bool> search_visible(gSavedSettings, "ShowSearchBar"); if (search_visible) { new_right -= mSearchBtn->getRect().getWidth(); new_right -= mSearchEditor->getRect().getWidth() + 6; } else { r = mStatBtn->getRect(); r.translate( new_right - r.mRight, 0); mStatBtn->setRect(r); new_right -= r.getWidth() + 6; } // Set search bar visibility mSearchEditor->setVisible(search_visible); mSearchBtn->setVisible(search_visible); mSearchBevel->setVisible(search_visible); mSGBandwidth->setVisible(! search_visible); mSGPacketLoss->setVisible(! search_visible); mStatBtn->setEnabled(!search_visible); // Set rects of money, buy money, time if (mUPCSupported) { r = mTextUPC->getRect(); r.translate( new_right - r.mRight, 0); mTextUPC->setRect(r); new_right -= r.getWidth() - 18; } r = mTextBalance->getRect(); r.translate( new_right - r.mRight, 0); mTextBalance->setRect(r); new_right -= r.getWidth() - 18; r = mBuyCurrency->getRect(); r.translate( new_right - r.mRight, 0); mBuyCurrency->setRect(r); new_right -= r.getWidth() + 6; r = mTextTime->getRect(); r.translate( new_right - r.mRight, 0); mTextTime->setRect(r); // Adjust region name and parcel name x += 8; const S32 PARCEL_RIGHT = llmin(mTextTime->getRect().mLeft, mTextParcelName->getTextPixelWidth() + x + 5); r.set(x+4, getRect().getHeight() - 2, PARCEL_RIGHT, 0); mTextParcelName->setRect(r); }
// Per-frame updates of visibility void LLStatusBar::refresh() { // Adding Net Stat Meter back in F32 bwtotal = gViewerThrottle.getMaxBandwidth() / 1000.f; mSGBandwidth->setMin(0.f); mSGBandwidth->setMax(bwtotal*1.25f); mSGBandwidth->setThreshold(0, bwtotal*0.75f); mSGBandwidth->setThreshold(1, bwtotal); mSGBandwidth->setThreshold(2, bwtotal); // *TODO: Localize / translate time // Get current UTC time, adjusted for the user's clock // being off. time_t utc_time; utc_time = time_corrected(); // There's only one internal tm buffer. struct tm* internal_time; // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. internal_time = utc_to_pacific_time(utc_time, gPacificDaylightTime); S32 hour = internal_time->tm_hour; S32 min = internal_time->tm_min; std::string am_pm = "AM"; if (hour > 11) { hour -= 12; am_pm = "PM"; } std::string tz = "PST"; if (gPacificDaylightTime) { tz = "PDT"; } // Zero hour is 12 AM if (hour == 0) hour = 12; std::ostringstream t; t << std::setfill(' ') << std::setw(2) << hour << ":" << std::setfill('0') << std::setw(2) << min << " " << am_pm << " " << tz; mTextTime->setText(t.str()); // Year starts at 1900, set the tooltip to have the date std::ostringstream date; date << sDays[internal_time->tm_wday] << ", " << std::setfill('0') << std::setw(2) << internal_time->tm_mday << " " << sMonths[internal_time->tm_mon] << " " << internal_time->tm_year + 1900; mTextTime->setToolTip(date.str()); LLRect r; const S32 MENU_RIGHT = gMenuBarView->getRightmostMenuEdge(); S32 x = MENU_RIGHT + MENU_PARCEL_SPACING; S32 y = 0; bool search_visible = gSavedSettings.getBOOL("ShowSearchBar"); // reshape menu bar to its content's width if (MENU_RIGHT != gMenuBarView->getRect().getWidth()) { gMenuBarView->reshape(MENU_RIGHT, gMenuBarView->getRect().getHeight()); } LLViewerRegion *region = gAgent.getRegion(); LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); LLRect buttonRect; if (LLHUDIcon::iconsNearby()) { childGetRect( "scriptout", buttonRect ); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); childSetRect("scriptout",r); childSetVisible("scriptout", true); x += buttonRect.getWidth(); } else { childSetVisible("scriptout", false); } if ((region && region->getAllowDamage()) || (parcel && parcel->getAllowDamage()) ) { // set visibility based on flashing if( mHealthTimer->hasExpired() ) { childSetVisible("health", true); } else { BOOL flash = S32(mHealthTimer->getElapsedSeconds() * ICON_FLASH_FREQUENCY) & 1; childSetVisible("health", flash); } mTextHealth->setVisible(TRUE); // Health childGetRect( "health", buttonRect ); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); childSetRect("health", r); x += buttonRect.getWidth(); const S32 health_width = S32( LLFontGL::getFontSansSerifSmall()->getWidth(std::string("100%")) ); r.set(x, y+TEXT_HEIGHT - 2, x+health_width, y); mTextHealth->setRect(r); x += health_width; } else { // invisible if region doesn't allow damage childSetVisible("health", false); mTextHealth->setVisible(FALSE); } if ((region && region->getBlockFly()) || (parcel && !parcel->getAllowFly()) ) { // No Fly Zone childGetRect( "no_fly", buttonRect ); childSetVisible( "no_fly", true ); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); childSetRect( "no_fly", r ); x += buttonRect.getWidth(); } else { // Fly Zone childSetVisible("no_fly", false); } BOOL no_build = parcel && !parcel->getAllowModify(); if (no_build) { childSetVisible("no_build", TRUE); childGetRect( "no_build", buttonRect ); // No Build Zone r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); childSetRect( "no_build", r ); x += buttonRect.getWidth(); } else { childSetVisible("no_build", FALSE); } BOOL no_scripts = FALSE; if((region && ((region->getRegionFlags() & REGION_FLAGS_SKIP_SCRIPTS) || (region->getRegionFlags() & REGION_FLAGS_ESTATE_SKIP_SCRIPTS))) || (parcel && !parcel->getAllowOtherScripts())) { no_scripts = TRUE; } if (no_scripts) { // No scripts childSetVisible("no_scripts", TRUE); childGetRect( "no_scripts", buttonRect ); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); childSetRect( "no_scripts", r ); x += buttonRect.getWidth(); } else { // Yes scripts childSetVisible("no_scripts", FALSE); } BOOL no_region_push = (region && region->getRestrictPushObject()); BOOL no_push = no_region_push || (parcel && parcel->getRestrictPushObject()); if (no_push) { childSetVisible("restrictpush", TRUE); childGetRect( "restrictpush", buttonRect ); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); childSetRect( "restrictpush", r ); x += buttonRect.getWidth(); } else { childSetVisible("restrictpush", FALSE); } BOOL have_voice = parcel && parcel->getParcelFlagAllowVoice(); if (have_voice) { childSetVisible("status_no_voice", FALSE); } else { childSetVisible("status_no_voice", TRUE); childGetRect( "status_no_voice", buttonRect ); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); childSetRect( "status_no_voice", r ); x += buttonRect.getWidth(); } BOOL canBuyLand = parcel && !parcel->isPublic() && LLViewerParcelMgr::getInstance()->canAgentBuyParcel(parcel, false); childSetVisible("buyland", canBuyLand); if (canBuyLand) { //HACK: layout tweak until this is all xml x += 9; childGetRect( "buyland", buttonRect ); r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight()); childSetRect( "buyland", r ); x += buttonRect.getWidth(); } std::string location_name; if (region) { const LLVector3& agent_pos_region = gAgent.getPositionAgent(); S32 pos_x = lltrunc( agent_pos_region.mV[VX] ); S32 pos_y = lltrunc( agent_pos_region.mV[VY] ); S32 pos_z = lltrunc( agent_pos_region.mV[VZ] ); // Round the numbers based on the velocity LLVector3 agent_velocity = gAgent.getVelocity(); F32 velocity_mag_sq = agent_velocity.magVecSquared(); const F32 FLY_CUTOFF = 6.f; // meters/sec const F32 FLY_CUTOFF_SQ = FLY_CUTOFF * FLY_CUTOFF; const F32 WALK_CUTOFF = 1.5f; // meters/sec const F32 WALK_CUTOFF_SQ = WALK_CUTOFF * WALK_CUTOFF; if (velocity_mag_sq > FLY_CUTOFF_SQ) { pos_x -= pos_x % 4; pos_y -= pos_y % 4; } else if (velocity_mag_sq > WALK_CUTOFF_SQ) { pos_x -= pos_x % 2; pos_y -= pos_y % 2; } mRegionDetails.mTime = mTextTime->getText(); mRegionDetails.mBalance = mBalance; mRegionDetails.mAccessString = region->getSimAccessString(); mRegionDetails.mPing = region->getNetDetailsForLCD(); if (parcel) { location_name = region->getName() + llformat(" %d, %d, %d (%s) - %s", pos_x, pos_y, pos_z, region->getSimAccessString().c_str(), parcel->getName().c_str()); // keep these around for the LCD to use mRegionDetails.mRegionName = region->getName(); mRegionDetails.mParcelName = parcel->getName(); mRegionDetails.mX = pos_x; mRegionDetails.mY = pos_y; mRegionDetails.mZ = pos_z; mRegionDetails.mArea = parcel->getArea(); mRegionDetails.mForSale = parcel->getForSale(); mRegionDetails.mTraffic = LLViewerParcelMgr::getInstance()->getDwelling(); if (parcel->isPublic()) { mRegionDetails.mOwner = "Public"; } else { if (parcel->getIsGroupOwned()) { if(!parcel->getGroupID().isNull()) { gCacheName->getGroupName(parcel->getGroupID(), mRegionDetails.mOwner); } else { mRegionDetails.mOwner = "Group Owned"; } } else { // Figure out the owner's name gCacheName->getFullName(parcel->getOwnerID(), mRegionDetails.mOwner); } } } else { location_name = region->getName() + llformat(" %d, %d, %d (%s)", pos_x, pos_y, pos_z, region->getSimAccessString().c_str()); // keep these around for the LCD to use mRegionDetails.mRegionName = region->getName(); mRegionDetails.mParcelName = "Unknown"; mRegionDetails.mX = pos_x; mRegionDetails.mY = pos_y; mRegionDetails.mZ = pos_z; mRegionDetails.mArea = 0; mRegionDetails.mForSale = FALSE; mRegionDetails.mOwner = "Unknown"; mRegionDetails.mTraffic = 0.0f; } } else { // no region location_name = "(Unknown)"; // keep these around for the LCD to use mRegionDetails.mRegionName = "Unknown"; mRegionDetails.mParcelName = "Unknown"; mRegionDetails.mAccessString = "Unknown"; mRegionDetails.mX = 0; mRegionDetails.mY = 0; mRegionDetails.mZ = 0; mRegionDetails.mArea = 0; mRegionDetails.mForSale = FALSE; mRegionDetails.mOwner = "Unknown"; mRegionDetails.mTraffic = 0.0f; } // [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) | Modified: RLVa-1.0.0a if ( (region) && (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ) // region == NULL if we loose our connection to the grid { // TODO-RLVa: find out whether the LCD code is still used because if so then we need to filter that as well location_name = llformat("%s (%s) - %s", rlv_handler_t::cstrHiddenRegion.c_str(), region->getSimAccessString().c_str(), rlv_handler_t::cstrHidden.c_str()); } // [/RLVa:KB] mTextParcelName->setText(location_name); // x = right edge // loop through: stat graphs, search btn, search text editor, money, buy money, clock // adjust rect // finally adjust parcel name rect S32 new_right = getRect().getWidth(); if (search_visible) { childGetRect("search_btn", r); //r.translate( new_right - r.mRight, 0); //childSetRect("search_btn", r); new_right -= r.getWidth(); childGetRect("search_editor", r); //r.translate( new_right - r.mRight, 0); //childSetRect("search_editor", r); new_right -= r.getWidth() + 6; } else { childGetRect("stat_btn", r); r.translate( new_right - r.mRight, 0); childSetRect("stat_btn", r); new_right -= r.getWidth() + 6; } // Set rects of money, buy money, time childGetRect("BalanceText", r); r.translate( new_right - r.mRight, 0); childSetRect("BalanceText", r); new_right -= r.getWidth() - 18; childGetRect("buycurrency", r); r.translate( new_right - r.mRight, 0); childSetRect("buycurrency", r); new_right -= r.getWidth() + 6; childGetRect("TimeText", r); // mTextTime->getTextPixelWidth(); r.translate( new_right - r.mRight, 0); childSetRect("TimeText", r); // new_right -= r.getWidth() + MENU_PARCEL_SPACING; // Adjust region name and parcel name x += 8; const S32 PARCEL_RIGHT = llmin(mTextTime->getRect().mLeft, mTextParcelName->getTextPixelWidth() + x + 5); r.set(x+4, getRect().getHeight() - 2, PARCEL_RIGHT, 0); mTextParcelName->setRect(r); // Set search bar visibility childSetVisible("search_editor", search_visible); childSetVisible("search_btn", search_visible); childSetVisible("menubar_search_bevel_bg", search_visible); mSGBandwidth->setVisible(! search_visible); mSGPacketLoss->setVisible(! search_visible); childSetEnabled("stat_btn", ! search_visible); }