// static - 'Sell to Anyone' clicked, throw up a confirmation dialog void LLFloaterAuction::onClickSellToAnyone(void* data) { LLFloaterAuction* self = (LLFloaterAuction*)(data); if (self) { LLParcel* parcelp = self->mParcelp->getParcel(); // Do a confirmation S32 sale_price = parcelp->getArea(); // Selling for L$1 per meter S32 area = parcelp->getArea(); std::string type_currency = LLGridManager::getInstance()->getCurrency(); LLSD args; args["LAND_SIZE"] = llformat("%d", area); args["SALE_PRICE"] = llformat("%d", sale_price); args["NAME"] = LLTrans::getString("Anyone"); args["CUR"] = type_currency; LLNotification::Params params("ConfirmLandSaleChange"); // Re-use existing dialog params.substitutions(args) .functor.function(boost::bind(&LLFloaterAuction::onSellToAnyoneConfirmed, self, _1, _2)); params.name("ConfirmLandSaleToAnyoneChange"); // ask away LLNotifications::instance().add(params); } }
// static void LLFloaterSellLandUI::doSellLand(void *userdata) { LLFloaterSellLandUI* self = (LLFloaterSellLandUI*)userdata; LLParcel* parcel = self->mParcelSelection->getParcel(); // Do a confirmation S32 sale_price = self->getChild<LLUICtrl>("price")->getValue(); S32 area = parcel->getArea(); std::string authorizedBuyerName = LLTrans::getString("Anyone"); bool sell_to_anyone = true; if ("user" == self->getChild<LLUICtrl>("sell_to")->getValue().asString()) { authorizedBuyerName = self->getChild<LLUICtrl>("sell_to_agent")->getValue().asString(); sell_to_anyone = false; } // must sell to someone if indicating sale to anyone if (!parcel->getForSale() && (sale_price == 0) && sell_to_anyone) { LLSD args; std::string type_currency = LLGridManager::getInstance()->getCurrency(); args["CUR"] = type_currency; LLNotificationsUtil::add("SalePriceRestriction", args); return; } std::string type_currency = LLGridManager::getInstance()->getCurrency(); LLSD args; args["LAND_SIZE"] = llformat("%d",area); args["SALE_PRICE"] = llformat("%d",sale_price); args["NAME"] = authorizedBuyerName; args["CUR"] = type_currency; LLNotification::Params params("ConfirmLandSaleChange"); params.substitutions(args) .functor.function(boost::bind(&LLFloaterSellLandUI::onConfirmSale, self, _1, _2)); if (sell_to_anyone) { params.name("ConfirmLandSaleToAnyoneChange"); } if (parcel->getForSale()) { // parcel already for sale, so ignore this question LLNotifications::instance().forceResponse(params, -1); } else { // ask away LLNotifications::instance().add(params); } }
void LLFloaterSellLandUI::updateParcelInfo() { LLParcel* parcelp = mParcelSelection->getParcel(); if (!parcelp) return; mParcelActualArea = parcelp->getArea(); mParcelIsForSale = parcelp->getForSale(); if (mParcelIsForSale) { mChoseSellTo = true; } mParcelPrice = mParcelIsForSale ? parcelp->getSalePrice() : 0; mParcelSoldWithObjects = parcelp->getSellWithObjects(); if (mParcelIsForSale) { childSetValue("price", mParcelPrice); if (mParcelSoldWithObjects) { childSetValue("sell_objects", "yes"); } else { childSetValue("sell_objects", "no"); } } else { childSetValue("price", ""); childSetValue("sell_objects", "none"); } mParcelSnapshot = parcelp->getSnapshotID(); mAuthorizedBuyer = parcelp->getAuthorizedBuyerID(); mSellToBuyer = mAuthorizedBuyer.notNull(); if(mSellToBuyer) { std::string name; gCacheName->getFullName(mAuthorizedBuyer, name); childSetText("sell_to_agent", name); } }
void LLFloaterSellLandUI::updateParcelInfo() { LLParcel* parcelp = mParcelSelection->getParcel(); if (!parcelp) return; mParcelActualArea = parcelp->getArea(); mParcelIsForSale = parcelp->getForSale(); if (mParcelIsForSale) { mChoseSellTo = true; } mParcelPrice = mParcelIsForSale ? parcelp->getSalePrice() : 0; mParcelSoldWithObjects = parcelp->getSellWithObjects(); if (mParcelIsForSale) { getChild<LLUICtrl>("price")->setValue(mParcelPrice); if (mParcelSoldWithObjects) { getChild<LLUICtrl>("sell_objects")->setValue("yes"); } else { getChild<LLUICtrl>("sell_objects")->setValue("no"); } } else { getChild<LLUICtrl>("price")->setValue(""); getChild<LLUICtrl>("sell_objects")->setValue("none"); } mParcelSnapshot = parcelp->getSnapshotID(); mAuthorizedBuyer = parcelp->getAuthorizedBuyerID(); mSellToBuyer = mAuthorizedBuyer.notNull(); if(mSellToBuyer) { LLAvatarNameCache::get(mAuthorizedBuyer, boost::bind(&LLFloaterSellLandUI::onBuyerNameCache, this, _2)); } }
// Reset all the values for the parcel in preparation for a sale void LLFloaterAuction::doSellToAnyone() { LLParcel* parcelp = mParcelp->getParcel(); LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion(); if (parcelp && region && !mParcelUpdateCapUrl.empty()) { LLSD body; std::string empty; // request new properties update from simulator U32 message_flags = 0x01; body["flags"] = ll_sd_from_U32(message_flags); // Set all the default parcel properties for auction body["local_id"] = parcelp->getLocalID(); // Set 'for sale' flag U32 parcel_flags = parcelp->getParcelFlags() | PF_FOR_SALE; // Ensure objects not included parcel_flags &= ~PF_FOR_SALE_OBJECTS; body["parcel_flags"] = ll_sd_from_U32(parcel_flags); body["sale_price"] = parcelp->getArea(); // Sell for L$1 per square meter body["auth_buyer_id"] = LLUUID::null; // To anyone // <FS:AW opensim currency support> // llinfos << "Sending parcel update to sell to anyone for L$1 via capability to: " llinfos << Tea::wrapCurrency("Sending parcel update to sell to anyone for L$1 via capability to: ") // <FS:AW opensim currency support> << mParcelUpdateCapUrl << llendl; LLHTTPClient::post(mParcelUpdateCapUrl, body, new LLHTTPClient::Responder()); // clean up floater, and get out cleanupAndClose(); } }
// Reset all the values for the parcel in preparation for a sale void LLFloaterAuction::doResetParcel() { LLParcel* parcelp = mParcelp->getParcel(); LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion(); if (parcelp && region && !mParcelUpdateCapUrl.empty()) { LLSD body; std::string empty; // request new properties update from simulator U32 message_flags = 0x01; body["flags"] = ll_sd_from_U32(message_flags); // Set all the default parcel properties for auction body["local_id"] = parcelp->getLocalID(); U32 parcel_flags = PF_ALLOW_LANDMARK | PF_ALLOW_FLY | PF_CREATE_GROUP_OBJECTS | PF_ALLOW_ALL_OBJECT_ENTRY | PF_ALLOW_GROUP_OBJECT_ENTRY | PF_ALLOW_GROUP_SCRIPTS | PF_RESTRICT_PUSHOBJECT | PF_SOUND_LOCAL | PF_ALLOW_VOICE_CHAT | PF_USE_ESTATE_VOICE_CHAN; body["parcel_flags"] = ll_sd_from_U32(parcel_flags); // Build a parcel name like "Ahern (128,128) PG 4032m" std::ostringstream parcel_name; LLVector3 center_point( parcelp->getCenterpoint() ); center_point.snap(0); // Get rid of fractions parcel_name << region->getName() << " (" << (S32) center_point.mV[VX] << "," << (S32) center_point.mV[VY] << ") " << region->getSimAccessString() << " " << parcelp->getArea() << "m"; std::string new_name(parcel_name.str().c_str()); body["name"] = new_name; getChild<LLUICtrl>("parcel_text")->setValue(new_name); // Set name in dialog as well, since it won't get updated otherwise body["sale_price"] = (S32) 0; body["description"] = empty; body["music_url"] = empty; body["media_url"] = empty; body["media_desc"] = empty; body["media_type"] = LLMIMETypes::getDefaultMimeType(); body["media_width"] = (S32) 0; body["media_height"] = (S32) 0; body["auto_scale"] = (S32) 0; body["media_loop"] = (S32) 0; body["obscure_media"] = (S32) 0; // OBSOLETE - no longer used body["obscure_music"] = (S32) 0; // OBSOLETE - no longer used body["media_id"] = LLUUID::null; body["group_id"] = MAINTENANCE_GROUP_ID; // Use maintenance group body["pass_price"] = (S32) 10; // Defaults to $10 body["pass_hours"] = 0.0f; body["category"] = (U8) LLParcel::C_NONE; body["auth_buyer_id"] = LLUUID::null; body["snapshot_id"] = LLUUID::null; body["user_location"] = ll_sd_from_vector3( LLVector3::zero ); body["user_look_at"] = ll_sd_from_vector3( LLVector3::zero ); body["landing_type"] = (U8) LLParcel::L_DIRECT; llinfos << "Sending parcel update to reset for auction via capability to: " << mParcelUpdateCapUrl << llendl; LLHTTPClient::post(mParcelUpdateCapUrl, body, new LLHTTPClient::Responder()); // Send a message to clear the object return time LLMessageSystem *msg = gMessageSystem; msg->newMessageFast(_PREHASH_ParcelSetOtherCleanTime); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ParcelData); msg->addS32Fast(_PREHASH_LocalID, parcelp->getLocalID()); msg->addS32Fast(_PREHASH_OtherCleanTime, 5); // 5 minute object auto-return msg->sendReliable(region->getHost()); // Clear the access lists clearParcelAccessLists(parcelp, region); } }
void LLFloaterBuyLandUI::updateParcelInfo() { LLParcel* parcel = mParcel->getParcel(); mParcelValid = parcel && mRegion; mParcelIsForSale = false; mParcelIsGroupLand = false; mParcelGroupContribution = 0; mParcelPrice = 0; mParcelActualArea = 0; mParcelBillableArea = 0; mParcelSupportedObjects = 0; mParcelSoldWithObjects = false; mParcelLocation = ""; mParcelSnapshot.setNull(); mParcelSellerName = ""; mCanBuy = false; mCannotBuyIsError = false; if (!mParcelValid) { mCannotBuyReason = getString("no_land_selected"); return; } if (mParcel->getMultipleOwners()) { mCannotBuyReason = getString("multiple_parcels_selected"); return; } const LLUUID& parcelOwner = parcel->getOwnerID(); mIsClaim = parcel->isPublic(); if (!mIsClaim) { mParcelActualArea = parcel->getArea(); mParcelIsForSale = parcel->getForSale(); mParcelIsGroupLand = parcel->getIsGroupOwned(); mParcelPrice = mParcelIsForSale ? parcel->getSalePrice() : 0; if (mParcelIsGroupLand) { LLUUID group_id = parcel->getGroupID(); mParcelGroupContribution = gAgent.getGroupContribution(group_id); } } else { mParcelActualArea = mParcel->getClaimableArea(); mParcelIsForSale = true; mParcelPrice = mParcelActualArea * parcel->getClaimPricePerMeter(); } mParcelBillableArea = llround(mRegion->getBillableFactor() * mParcelActualArea); mParcelSupportedObjects = llround( parcel->getMaxPrimCapacity() * parcel->getParcelPrimBonus()); // Can't have more than region max tasks, regardless of parcel // object bonus factor. LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion(); if(region) { S32 max_tasks_per_region = (S32)region->getMaxTasks(); mParcelSupportedObjects = llmin( mParcelSupportedObjects, max_tasks_per_region); } mParcelSoldWithObjects = parcel->getSellWithObjects(); LLVector3 center = parcel->getCenterpoint(); mParcelLocation = llformat("%s %d,%d", mRegion->getName().c_str(), (int)center[VX], (int)center[VY] ); mParcelSnapshot = parcel->getSnapshotID(); updateNames(); bool haveEnoughCash = mParcelPrice <= mAgentCashBalance; S32 cashBuy = haveEnoughCash ? 0 : (mParcelPrice - mAgentCashBalance); mCurrency.setAmount(cashBuy, true); mCurrency.setZeroMessage(haveEnoughCash ? getString("none_needed") : LLStringUtil::null); // checks that we can buy the land if(mIsForGroup && !gAgent.hasPowerInActiveGroup(GP_LAND_DEED)) { mCannotBuyReason = getString("cant_buy_for_group"); return; } if (!mIsClaim) { const LLUUID& authorizedBuyer = parcel->getAuthorizedBuyerID(); const LLUUID buyer = gAgent.getID(); const LLUUID newOwner = mIsForGroup ? gAgent.getGroupID() : buyer; if (!mParcelIsForSale || (mParcelPrice == 0 && authorizedBuyer.isNull())) { mCannotBuyReason = getString("parcel_not_for_sale"); return; } if (parcelOwner == newOwner) { if (mIsForGroup) { mCannotBuyReason = getString("group_already_owns"); } else { mCannotBuyReason = getString("you_already_own"); } return; } if (!authorizedBuyer.isNull() && buyer != authorizedBuyer) { // Maybe the parcel is set for sale to a group we are in. bool authorized_group = gAgent.hasPowerInGroup(authorizedBuyer,GP_LAND_DEED) && gAgent.hasPowerInGroup(authorizedBuyer,GP_LAND_SET_SALE_INFO); if (!authorized_group) { mCannotBuyReason = getString("set_to_sell_to_other"); return; } } } else { if (mParcelActualArea == 0) { mCannotBuyReason = getString("no_public_land"); return; } if (mParcel->hasOthersSelected()) { // Policy: Must not have someone else's land selected mCannotBuyReason = getString("not_owned_by_you"); return; } } mCanBuy = true; }
// 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); // Let's not have to reformat time everywhere, shall we? -- MC gViewerTime->refresh(); mTextTime->setText(gViewerTime->getCurTimeStr()); mTextTime->setToolTip(gViewerTime->getCurDateStr()); 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(); } // TODO: disable buy land button when connected to non-SL grids // that don't support currency. // TODO: make this brandable -- MC 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; // Don't toggle this visibility while in mouselook -- MC if (!gAgent.cameraMouselook()) { // 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); } 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); }
// 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); }