void LLIMMgr::addSystemMessage(const LLUUID& session_id, const std::string& message_name, const LLSD& args) { LLUIString message; // null session id means near me (chat history) if (session_id.isNull()) { LLFloaterChat* floaterp = LLFloaterChat::getInstance(); message = floaterp->getString(message_name); message.setArgs(args); LLChat chat(message); chat.mSourceType = CHAT_SOURCE_SYSTEM; LLFloaterChat::getInstance()->addChatHistory(chat); } else // going to IM session { LLFloaterIMPanel* floaterp = findFloaterBySession(session_id); if (floaterp) { message = floaterp->getString(message_name); message.setArgs(args); gIMMgr->addMessage(session_id, LLUUID::null, SYSTEM_FROM, message.getString()); } } }
void LLButton::resize(LLUIString label) { // get label length S32 label_width = mGLFont->getWidth(label.getString()); // get current btn length S32 btn_width =getRect().getWidth(); // check if it need resize if (mAutoResize == TRUE) { if (btn_width - (mRightHPad + mLeftHPad) < label_width) { setRect(LLRect( getRect().mLeft, getRect().mTop, getRect().mLeft + label_width + mLeftHPad + mRightHPad , getRect().mBottom)); } } }
void LLPreview::refreshFromItem() { const LLInventoryItem* item = getItem(); if (!item) { return; } if (hasString("Title")) { LLStringUtil::format_map_t args; args["[NAME]"] = item->getName(); LLUIString title = getString("Title", args); setTitle(title.getString()); } getChild<LLUICtrl>("desc")->setValue(item->getDescription()); getChildView("desc")->setEnabled(canModify(mObjectUUID, item)); }
void LLPreview::refreshFromItem() { const LLInventoryItem* item = getItem(); if (!item) { return; } if (hasString("Title")) { LLStringUtil::format_map_t args; args["[NAME]"] = item->getName(); LLUIString title = getString("Title", args); setTitle(title.getString()); } getChild<LLUICtrl>("desc")->setValue(item->getDescription()); BOOL can_agent_manipulate = item->getPermissions().allowModifyBy(gAgent.getID()); getChildView("desc")->setEnabled(can_agent_manipulate); }
void LLViewerTextEditor::openEmbeddedTexture( LLInventoryItem* item, llwchar wc ) { // *NOTE: Just for embedded Texture , we should use getAssetUUID(), // not getUUID(), because LLPreviewTexture pass in AssetUUID into // LLPreview constructor ItemUUID parameter. if (!item) return; LLPreviewTexture* preview = LLFloaterReg::showTypedInstance<LLPreviewTexture>("preview_texture", LLSD(item->getAssetUUID()), TAKE_FOCUS_YES); if (preview) { preview->setAuxItem( item ); preview->setNotecardInfo(mNotecardInventoryID, mObjectID); if (preview->hasString("Title")) { LLStringUtil::format_map_t args; args["[NAME]"] = item->getName(); LLUIString title = preview->getString("Title", args); preview->setTitle(title.getString()); } preview->getChild<LLUICtrl>("desc")->setValue(item->getDescription()); } }
void LLButton::resize(LLUIString label) { // get label length S32 label_width = mGLFont->getWidth(label.getString()); // get current btn length S32 btn_width =getRect().getWidth(); // check if it need resize if (mAutoResize) { S32 min_width = label_width + mLeftHPad + mRightHPad; if (mImageOverlay) { S32 overlay_width = mImageOverlay->getWidth(); F32 scale_factor = (getRect().getHeight() - (mImageOverlayBottomPad + mImageOverlayTopPad)) / (F32)mImageOverlay->getHeight(); overlay_width = ll_round((F32)overlay_width * scale_factor); switch(mImageOverlayAlignment) { case LLFontGL::LEFT: case LLFontGL::RIGHT: min_width += overlay_width + mImgOverlayLabelSpace; break; case LLFontGL::HCENTER: min_width = llmax(min_width, overlay_width + mLeftHPad + mRightHPad); break; default: // draw nothing break; } } if (btn_width < min_width) { reshape(min_width, getRect().getHeight()); } } }
// static void LLPanelClassifiedInfo::setClickThrough( const LLUUID& classified_id, S32 teleport, S32 map, S32 profile, bool from_new_table) { LL_INFOS() << "Click-through data for classified " << classified_id << " arrived: [" << teleport << ", " << map << ", " << profile << "] (" << (from_new_table ? "new" : "old") << ")" << LL_ENDL; for (panel_list_t::iterator iter = sAllPanels.begin(); iter != sAllPanels.end(); ++iter) { LLPanelClassifiedInfo* self = *iter; if (self->getClassifiedId() != classified_id) { continue; } // *HACK: Skip LLPanelClassifiedEdit instances: they don't display clicks data. // Those instances should not be in the list at all. if (typeid(*self) != typeid(LLPanelClassifiedInfo)) { continue; } LL_INFOS() << "Updating classified info panel" << LL_ENDL; // We need to check to see if the data came from the new stat_table // or the old classified table. We also need to cache the data from // the two separate sources so as to display the aggregate totals. if (from_new_table) { self->mTeleportClicksNew = teleport; self->mMapClicksNew = map; self->mProfileClicksNew = profile; } else { self->mTeleportClicksOld = teleport; self->mMapClicksOld = map; self->mProfileClicksOld = profile; } static LLUIString ct_str = self->getString("click_through_text_fmt"); ct_str.setArg("[TELEPORT]", llformat("%d", self->mTeleportClicksNew + self->mTeleportClicksOld)); ct_str.setArg("[MAP]", llformat("%d", self->mMapClicksNew + self->mMapClicksOld)); ct_str.setArg("[PROFILE]", llformat("%d", self->mProfileClicksNew + self->mProfileClicksOld)); self->getChild<LLUICtrl>("click_through_text")->setValue(ct_str.getString()); // *HACK: remove this when there is enough room for click stats in the info panel self->getChildView("click_through_text")->setToolTip(ct_str.getString()); LL_INFOS() << "teleport: " << llformat("%d", self->mTeleportClicksNew + self->mTeleportClicksOld) << ", map: " << llformat("%d", self->mMapClicksNew + self->mMapClicksOld) << ", profile: " << llformat("%d", self->mProfileClicksNew + self->mProfileClicksOld) << LL_ENDL; } }
void LLPanelGroupVoting::impl::setEnableVoteProposal() { if (!gAgent.hasPowerInGroup(mGroupID, GP_PROPOSAL_VOTE)) return; LLScrollListItem *item = mProposals->getFirstSelected(); if (item) { std::string already_voted; std::string vote_cast; mProposalID = item->getUUID(); // col 0: index id LLScrollListCell * proposal_cell = item->getColumn(1); if ( proposal_cell ) { //proposal text mProposalText->setText(proposal_cell->getValue().asString()); } else { // Something's wrong... should have some text mProposalText->setText(LLStringUtil::null); } proposal_cell = item->getColumn(2); if (proposal_cell) { //end date mEndDate->setText(proposal_cell->getValue().asString()); } else { // Something's wrong... should have some text mEndDate->setText(LLStringUtil::null); } // col 3: Vote Type proposal_cell = item->getColumn(3); if (proposal_cell) { //already voted already_voted = proposal_cell->getValue().asString(); } else { // Something's wrong... should have some text already_voted = ""; } proposal_cell = item->getColumn(5); if (proposal_cell) { //start date mStartDate->setText(proposal_cell->getValue().asString()); } else { // Something's wrong... should have some text mStartDate->setText(LLStringUtil::null); } proposal_cell = item->getColumn(6); if (proposal_cell) { // Vote Cast vote_cast = proposal_cell->getValue().asString(); } // col 8: Vote Initiator proposal_cell = item->getColumn(8); if (proposal_cell) { //quorum mQuorum->set( (F32)atoi(proposal_cell->getValue().asString().c_str())); } else { mQuorum->set(0); } F32 majority = 0.0f; proposal_cell = item->getColumn(9); if (proposal_cell) { //majority majority = (F32)atof(proposal_cell->getValue().asString().c_str()); } if(majority == 0.0f) { // Select the Simple Majority mMajority->setSelectedIndex(0); } else if (majority == 1.0f) { //Select Unanimous mMajority->setSelectedIndex(2); } else { //Select 2/3 Majority mMajority->setSelectedIndex(1); } if (already_voted == "Yes") { LLUIString votestr = mPanel.getString("proposals_header_voted_inst"); votestr.setArg("[VOTE]", vote_cast); mPanel.childSetText("proposal_instructions", votestr.getString()); mBtnYes->setEnabled(FALSE); mBtnNo->setEnabled(FALSE); mBtnAbstain->setEnabled(FALSE); } else { mPanel.childSetText("proposal_instructions", mPanel.getString("proposals_header_vote_inst")); mBtnYes->setEnabled(TRUE); mBtnNo->setEnabled(TRUE); mBtnAbstain->setEnabled(TRUE); } mPanel.childSetText("proposal_header", mPanel.getString("proposals_header_vote_txt")); mPanel.childSetVisible("proposal_lbl", TRUE); mPanel.childSetVisible("proposal_voting_lbl", FALSE); mProposals->setVisible(FALSE); mProposalText->setEnabled(FALSE); mProposalText->setVisible(TRUE); mBtnYes->setVisible(TRUE); mBtnNo->setVisible(TRUE); mBtnAbstain->setVisible(TRUE); mBtnSubmitProposal->setEnabled(FALSE); mBtnSubmitProposal->setVisible(FALSE); mBtnCreateProposal->setEnabled(FALSE); mBtnCreateProposal->setVisible(FALSE); mBtnCancelProposal->setEnabled(FALSE); mBtnCancelProposal->setVisible(FALSE); mBtnViewProposalItem->setEnabled(FALSE); mBtnViewProposalItem->setVisible(FALSE); mBtnViewProposalList->setEnabled(TRUE); mBtnViewProposalList->setVisible(TRUE); mQuorumLbl->setVisible(TRUE); mQuorum->setEnabled(FALSE); mQuorum->setVisible(TRUE); mPanel.childSetVisible("quorum_text", TRUE); mDurationLbl->setVisible(FALSE); mDuration->setEnabled(FALSE); mDuration->setVisible(FALSE); mDurationText->setVisible(FALSE); mMajorityLbl->setVisible(TRUE); mMajority->setEnabled(FALSE); mMajority->setVisible(TRUE); mStartLbl->setVisible(TRUE); mStartDate->setVisible(TRUE); mEndLbl->setVisible(TRUE); mEndDate->setVisible(TRUE); } }
// 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: { std::string timeStr = "["+ LLTrans::getString ("TimeHour")+"]:[" +LLTrans::getString ("TimeMin")+"] [" +LLTrans::getString ("TimeAMPM")+"]"; LLSD substitution; substitution["datetime"] = (S32) extra; LLStringUtil::format (timeStr, substitution); new_item.setTooltip(timeStr); // 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 { static LLUIString tooltip_fmt = LLTrans::getString("worldmap_item_tooltip_format"); std::string type_currency = LLGridManager::getInstance()->getCurrency(); tooltip_fmt.setArg("[AREA]", llformat("%d", extra)); tooltip_fmt.setArg("[PRICE]", llformat("%d", extra2)); tooltip_fmt.setArg("[CUR]", type_currency); new_item.setTooltip(tooltip_fmt.getString()); 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; }