void LLFloaterFeed::onClickPost() { if (mPNGImage.notNull()) { static LLCachedControl<bool> add_location("SnapshotFeedAddLocation"); const std::string caption = childGetValue("caption").asString(); LLWebProfile::setImageUploadResultCallback(boost::bind(&LLFloaterSnapshot::saveFeedDone, _1, mPNGImage)); LLWebProfile::uploadImage(mPNGImage, caption, add_location); // give user feedback of the event gViewerWindow->playSnapshotAnimAndSound(); // don't destroy the window until the upload is done // this way we keep the information in the form setVisible(FALSE); // remove any dependency on snapshot floater // so we outlive it during the upload. LLFloater* dependee = getDependee(); if (dependee) { dependee->removeDependentFloater(this); } } else { LLNotificationsUtil::add("ErrorProcessingSnapshot"); } }
void export_test_floaters() { // Convert all test floaters to new XML format std::string delim = gDirUtilp->getDirDelimiter(); std::string xui_dir = get_xui_dir() + "en" + delim; std::string filename; LLDirIterator iter(xui_dir, "floater_test_*.xml"); while (iter.next(filename)) { if (filename.find("_new.xml") != std::string::npos) { // don't re-export other test floaters continue; } llinfos << "Converting " << filename << llendl; // Build a floater and output new attributes LLXMLNodePtr output_node = new LLXMLNode(); LLFloater* floater = new LLFloater(LLSD()); floater->buildFromFile( filename, // FALSE, // don't open floater output_node); std::string out_filename = xui_dir + filename; std::string::size_type extension_pos = out_filename.rfind(".xml"); out_filename.resize(extension_pos); out_filename += "_new.xml"; llinfos << "Output: " << out_filename << llendl; LLFILE* floater_file = LLFile::fopen(out_filename.c_str(), "w"); LLXMLNode::writeHeaderToFile(floater_file); output_node->writeToFile(floater_file); fclose(floater_file); } }
LLFloater* LLFloaterReg::getLastFloaterCascading() { LLRect candidate_rect; candidate_rect.mTop = 100000; LLFloater* candidate_floater = NULL; std::map<std::string,std::string>::const_iterator it = sGroupMap.begin(), it_end = sGroupMap.end(); for( ; it != it_end; ++it) { const std::string& group_name = it->second; instance_list_t& instances = sInstanceMap[group_name]; for (instance_list_t::const_iterator iter = instances.begin(); iter != instances.end(); ++iter) { LLFloater* inst = *iter; if (inst->getVisible() && inst->isPositioning(LLFloaterEnums::OPEN_POSITIONING_CASCADING)) { if (candidate_rect.mTop > inst->getRect().mTop) { candidate_floater = inst; candidate_rect = inst->getRect(); } } } } return candidate_floater; }
void LLTextureCtrl::showPicker(BOOL take_focus) { // show hourglass cursor when loading inventory window // because inventory construction is slooow getWindow()->setCursor(UI_CURSOR_WAIT); LLFloater* floaterp = mFloaterHandle.get(); // Show the dialog if( floaterp ) { floaterp->openFloater(); } else { floaterp = new LLFloaterTexturePicker( this, mLabel, mImmediateFilterPermMask, mNonImmediateFilterPermMask, mCanApplyImmediately, mFallbackImage); mFloaterHandle = floaterp->getHandle(); LLFloater* root_floater = gFloaterView->getParentFloater(this); if (root_floater) root_floater->addDependentFloater(floaterp); floaterp->openFloater(); } if (take_focus) { floaterp->setFocus(TRUE); } }
void LLColorSwatchCtrl::showPicker(BOOL take_focus) { LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)mPickerHandle.get(); if (!pickerp) { pickerp = new LLFloaterColorPicker(this, mCanApplyImmediately); LLFloater* parent = gFloaterView->getParentFloater(this); if (parent) { parent->addDependentFloater(pickerp); } mPickerHandle = pickerp->getHandle(); } // initialize picker with current color pickerp->initUI ( mColor.mV [ VRED ], mColor.mV [ VGREEN ], mColor.mV [ VBLUE ] ); // display it pickerp->showUI (); if (take_focus) { pickerp->setFocus(TRUE); } }
//static bool LLAvatarActions::profileVisible(const LLUUID& id) { LLSD sd; sd["id"] = id; LLFloater* browser = getProfileFloater(id); return browser && browser->isShown(); }
//static void LLAvatarActions::hideProfile(const LLUUID& id) { LLFloater* browser = getProfileFloater(id); if (browser) { browser->close(); } }
//static // returns true if the instance exists bool LLFloaterReg::hideInstance(const std::string& name, const LLSD& key) { LLFloater* instance = findInstance(name, key); if (instance) { instance->closeHostedFloater(); } return (instance != NULL); }
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { LLFloater* top = gFloaterView->getFrontmost(); if (top) { top->saveAsType(true); } return true; }
void LLFacebookCheckinPanel::clearAndClose() { mMessageTextEditor->setValue(""); LLFloater* floater = getParentByType<LLFloater>(); if (floater) { floater->closeFloater(); } }
//----------------------------------------------------------------------------- // getBuiltFloater() //----------------------------------------------------------------------------- LLFloater* LLUICtrlFactory::getBuiltFloater(const std::string name) const { for (built_floater_t::const_iterator i = mBuiltFloaters.begin(); i != mBuiltFloaters.end(); ++i) { LLFloater* floater = i->first.get(); if (floater && floater->getName() == name) return floater; } return NULL; }
// static void LLPreviewAnim::endAnimCallback( void *userdata ) { LLHandle<LLFloater>* handlep = ((LLHandle<LLFloater>*)userdata); LLFloater* self = handlep->get(); delete handlep; // done with the handle if (self) { self->childSetValue("Anim play btn", FALSE); self->childSetValue("Anim audition btn", FALSE); } }
//static LLFloater* LLFloaterReg::getInstance(const std::string& name, const LLSD& key) { LLFloater* res = findInstance(name, key); if (!res) { const LLFloaterBuildFunc& build_func = sBuildMap[name].mFunc; // const std::string& xui_file = sBuildMap[name].mFile; // [SL:KB] - Patch: UI-Base | Checked: 2010-12-01 (Catznip-3.0.0a) | Added: Catznip-2.5.0a const std::string& xui_file = (!sBuildMap[name].mFileFunc) ? sBuildMap[name].mFile : sBuildMap[name].mFileFunc(); // [/SL:KB] if (build_func) { const std::string& groupname = sGroupMap[name]; if (!groupname.empty()) { instance_list_t& list = sInstanceMap[groupname]; res = build_func(key); if (!res) { LL_WARNS() << "Failed to build floater type: '" << name << "'." << LL_ENDL; return NULL; } bool success = res->buildFromFile(xui_file); if (!success) { LL_WARNS() << "Failed to build floater type: '" << name << "'." << LL_ENDL; return NULL; } // Note: key should eventually be a non optional LLFloater arg; for now, set mKey to be safe if (res->mKey.isUndefined()) { res->mKey = key; } res->setInstanceName(name); LLFloater *last_floater = (list.empty() ? NULL : list.back()); res->applyControlsAndPosition(last_floater); gFloaterView->adjustToFitScreen(res, false); list.push_back(res); } } if (!res) { LL_WARNS() << "Floater type: '" << name << "' not registered." << LL_ENDL; } } return res; }
//static // returns true if the instance is visible when completed bool LLFloaterReg::toggleInstance(const std::string& name, const LLSD& key) { LLFloater* instance = findInstance(name, key); if (LLFloater::isShown(instance)) { instance->closeHostedFloater(); return false; } else { return showInstance(name, key, TRUE) ? true : false; } }
//static void LLFloaterReg::restoreVisibleInstances() { // Iterate through all active instances and restore visibility for (instance_map_t::iterator iter = sInstanceMap.begin(); iter != sInstanceMap.end(); ++iter) { instance_list_t& list = iter->second; for (instance_list_t::iterator iter = list.begin(); iter != list.end(); ++iter) { LLFloater* floater = *iter; floater->popVisible(); } } }
void LLFacebookPhotoPanel::clearAndClose() { mCaptionTextBox->setValue(""); LLFloater* floater = getParentByType<LLFloater>(); if (floater) { floater->closeFloater(); if (mBigPreviewFloater) { mBigPreviewFloater->closeOnFloaterOwnerClosing(floater); } } }
void LLPanelGroup::close() { // Pass this to the parent, if it is a floater. LLView* viewp = getParent(); LLFloater* floaterp = dynamic_cast<LLFloater*>(viewp); if (floaterp) { // First, set the force close flag, since the floater // will be asking us whether it can close. mForceClose = TRUE; // Tell the parent floater to close. floaterp->close(); } }
//static void KVFloaterFlickrUpload::onClickUpload(void* data) { if(!data) return; KVFloaterFlickrUpload *self = (KVFloaterFlickrUpload*)data; self->uploadSnapshot(); self->saveSettings(); self->setVisible(false); // Make sure that, if we were attached to anything, that we detach from it. // Otherwise bad things happen. LLFloater *dependee = self->getDependee(); if(dependee) dependee->removeDependentFloater(self); }
//static LLFloater* LLFloaterReg::showInstance(const std::string& name, const LLSD& key, BOOL focus) { if( sBlockShowFloaters // see EXT-7090 && sAlwaysShowableList.find(name) == sAlwaysShowableList.end()) return 0;// LLFloater* instance = getInstance(name, key); if (instance) { instance->openFloater(key); if (focus) instance->setFocus(TRUE); } return instance; }
//static void LLFloaterReg::hideVisibleInstances(const std::set<std::string>& exceptions) { // Iterate through alll active instances and hide them for (instance_map_t::iterator iter = sInstanceMap.begin(); iter != sInstanceMap.end(); ++iter) { const std::string& name = iter->first; if (exceptions.find(name) != exceptions.end()) continue; instance_list_t& list = iter->second; for (instance_list_t::iterator iter = list.begin(); iter != list.end(); ++iter) { LLFloater* floater = *iter; floater->pushVisible(FALSE); } } }
//static // returns true if the instance is visible when completed bool LLFloaterReg::toggleInstance(const std::string& name, const LLSD& key) { LLFloater* instance = findInstance(name, key); if (LLFloater::isShown(instance)) { // When toggling *visibility*, close the host instead of the floater when hosted if (instance->getHost()) instance->getHost()->closeFloater(); else instance->closeFloater(); return false; } else { return showInstance(name, key, TRUE) ? true : false; } }
void LLTextureCtrl::showPicker(BOOL take_focus) { LLFloater* floaterp = mFloaterHandle.get(); // Show the dialog if( floaterp ) { floaterp->open( ); /* Flawfinder: ignore */ } else { if( !mLastFloaterLeftTop.mX && !mLastFloaterLeftTop.mY ) { gFloaterView->getNewFloaterPosition(&mLastFloaterLeftTop.mX, &mLastFloaterLeftTop.mY); } LLRect rect = gSavedSettings.getRect("TexturePickerRect"); rect.translate( mLastFloaterLeftTop.mX - rect.mLeft, mLastFloaterLeftTop.mY - rect.mTop ); floaterp = new LLFloaterTexturePicker( this, rect, mLabel, mImmediateFilterPermMask, mDnDFilterPermMask, mNonImmediateFilterPermMask, mCanApplyImmediately, mFallbackImageName); mFloaterHandle = floaterp->getHandle(); LLFloaterTexturePicker* texture_floaterp = dynamic_cast<LLFloaterTexturePicker*>(floaterp); if (texture_floaterp && mOnTextureSelectedCallback) { texture_floaterp->setTextureSelectedCallback(mOnTextureSelectedCallback); } gFloaterView->getParentFloater(this)->addDependentFloater(floaterp); floaterp->open(); /* Flawfinder: ignore */ } if (take_focus) { floaterp->setFocus(TRUE); } }
//static LLFloater* LLFloaterReg::showInstance(const std::string& name, const LLSD& key, BOOL focus) { // if( sBlockShowFloaters // // see EXT-7090 // && sAlwaysShowableList.find(name) == sAlwaysShowableList.end()) // [RLVa:KB] - Checked: 2010-02-28 (RLVa-1.2.0a) | Modified: RLVa-1.2.0a if ( (sBlockShowFloaters && sAlwaysShowableList.find(name) == sAlwaysShowableList.end()) || (!mValidateSignal(name, key)) ) // [/RLVa:KB] return 0;// LLFloater* instance = getInstance(name, key); if (instance) { instance->openFloater(key); if (focus) instance->setFocus(TRUE); } return instance; }
void LLMultiFloater::computeResizeLimits(S32& new_min_width, S32& new_min_height) { static LLUICachedControl<S32> tabcntr_close_btn_size ("UITabCntrCloseBtnSize", 0); const LLFloater::Params& default_params = LLFloater::getDefaultParams(); S32 floater_header_size = default_params.header_height; S32 tabcntr_header_height = LLPANEL_BORDER_WIDTH + tabcntr_close_btn_size; // possibly increase minimum size constraint due to children's minimums. for (S32 tab_idx = 0; tab_idx < mTabContainer->getTabCount(); ++tab_idx) { LLFloater* floaterp = (LLFloater*)mTabContainer->getPanelByIndex(tab_idx); if (floaterp) { new_min_width = llmax(new_min_width, floaterp->getMinWidth() + LLPANEL_BORDER_WIDTH * 2); new_min_height = llmax(new_min_height, floaterp->getMinHeight() + floater_header_size + tabcntr_header_height); } } }
//static LLFloater* LLFloaterReg::findInstance(const std::string& name, const LLSD& key) { LLFloater* res = NULL; const std::string& groupname = sGroupMap[name]; if (!groupname.empty()) { instance_list_t& list = sInstanceMap[groupname]; for (instance_list_t::iterator iter = list.begin(); iter != list.end(); ++iter) { LLFloater* inst = *iter; if (inst->matchesKey(key)) { res = inst; break; } } } return res; }
//static void LLPanelGroupInvite::impl::callbackClickAdd(void* userdata) { LLPanelGroupInvite* panelp = (LLPanelGroupInvite*) userdata; if ( panelp ) { //Right now this is hard coded with some knowledge that it is part //of a floater since the avatar picker needs to be added as a dependent //floater to the parent floater. //Soon the avatar picker will be embedded into this panel //instead of being it's own separate floater. But that is next week. //This will do for now. -jwolk May 10, 2006 LLFloater* parentp; parentp = gFloaterView->getParentFloater(panelp); parentp->addDependentFloater(LLFloaterAvatarPicker::show(callbackAddUsers, panelp->mImplementation, TRUE)); } }
//static LLFloater* LLFloaterReg::getInstance(const std::string& name, const LLSD& key) { LLFloater* res = findInstance(name, key); if (!res) { const LLFloaterBuildFunc& build_func = sBuildMap[name].mFunc; const std::string& xui_file = sBuildMap[name].mFile; if (build_func) { const std::string& groupname = sGroupMap[name]; if (!groupname.empty()) { instance_list_t& list = sInstanceMap[groupname]; int index = list.size(); res = build_func(key); bool success = res->buildFromFile(xui_file, NULL); if (!success) { llwarns << "Failed to build floater type: '" << name << "'." << llendl; return NULL; } // Note: key should eventually be a non optional LLFloater arg; for now, set mKey to be safe res->mKey = key; res->setInstanceName(name); res->applySavedVariables(); // Can't apply rect and dock state until setting instance name if (res->mAutoTile && !res->getHost() && index > 0) { const LLRect& cur_rect = res->getRect(); LLRect next_rect = getFloaterRect(groupname); next_rect.setLeftTopAndSize(next_rect.mLeft, next_rect.mTop, cur_rect.getWidth(), cur_rect.getHeight()); res->setRect(next_rect); res->setRectControl(LLStringUtil::null); // don't save rect of tiled floaters gFloaterView->adjustToFitScreen(res, true); } else { gFloaterView->adjustToFitScreen(res, false); } list.push_back(res); } } if (!res) { llwarns << "Floater type: '" << name << "' not registered." << llendl; } } return res; }
//----------------------------------------------------------------------------- // rebuild() //----------------------------------------------------------------------------- void LLUICtrlFactory::rebuild() { built_panel_t built_panels = mBuiltPanels; mBuiltPanels.clear(); built_panel_t::iterator built_panel_it; for (built_panel_it = built_panels.begin(); built_panel_it != built_panels.end(); ++built_panel_it) { std::string filename = built_panel_it->second; LLPanel* panelp = built_panel_it->first.get(); if (!panelp) { continue; } llinfos << "Rebuilding UI panel " << panelp->getName() << " from " << filename << llendl; BOOL visible = panelp->getVisible(); panelp->setVisible(FALSE); panelp->setFocus(FALSE); panelp->deleteAllChildren(); buildPanel(panelp, filename.c_str(), &panelp->getFactoryMap()); panelp->setVisible(visible); } built_floater_t::iterator built_floater_it; for (built_floater_it = mBuiltFloaters.begin(); built_floater_it != mBuiltFloaters.end(); ++built_floater_it) { LLFloater* floaterp = built_floater_it->first.get(); if (!floaterp) { continue; } std::string filename = built_floater_it->second; llinfos << "Rebuilding UI floater " << floaterp->getName() << " from " << filename << llendl; BOOL visible = floaterp->getVisible(); floaterp->setVisible(FALSE); floaterp->setFocus(FALSE); floaterp->deleteAllChildren(); gFloaterView->removeChild(floaterp); buildFloater(floaterp, filename, &floaterp->getFactoryMap()); floaterp->setVisible(visible); } }
void LLFloaterPostcard::sendPostcard() { mTransactionID.generate(); mAssetID = mTransactionID.makeAssetID(gAgent.getSecureSessionID()); LLVFile::writeFile(mJPEGImage->getData(), mJPEGImage->getDataSize(), gVFS, mAssetID, LLAssetType::AT_IMAGE_JPEG); // upload the image std::string url = gAgent.getRegion()->getCapability("SendPostcard"); if(!url.empty()) { llinfos << "Send Postcard via capability" << llendl; LLSD body = LLSD::emptyMap(); // the capability already encodes: agent ID, region ID body["pos-global"] = mPosTakenGlobal.getValue(); body["to"] = getChild<LLUICtrl>("to_form")->getValue().asString(); body["from"] = getChild<LLUICtrl>("from_form")->getValue().asString(); body["name"] = getChild<LLUICtrl>("name_form")->getValue().asString(); body["subject"] = getChild<LLUICtrl>("subject_form")->getValue().asString(); body["msg"] = getChild<LLUICtrl>("msg_form")->getValue().asString(); LLHTTPClient::post(url, body, new LLSendPostcardResponder(body, mAssetID, LLAssetType::AT_IMAGE_JPEG)); } else { gAssetStorage->storeAssetData(mTransactionID, LLAssetType::AT_IMAGE_JPEG, &uploadCallback, (void *)this, FALSE); } // give user feedback of the event gViewerWindow->playSnapshotAnimAndSound(); LLUploadDialog::modalUploadDialog(getString("upload_message")); // don't destroy the window until the upload is done // this way we keep the information in the form setVisible(FALSE); // also remove any dependency on another floater // so that we can be sure to outlive it while we // need to. LLFloater* dependee = getDependee(); if (dependee) dependee->removeDependentFloater(this); }
//static LLFloater* LLFloaterReg::getLastFloaterInGroup(const std::string& name) { const std::string& groupname = sGroupMap[name]; if (!groupname.empty()) { instance_list_t& list = sInstanceMap[groupname]; if (!list.empty()) { for (instance_list_t::reverse_iterator iter = list.rbegin(); iter != list.rend(); ++iter) { LLFloater* inst = *iter; if (inst->getVisible() && !inst->isMinimized()) { return inst; } } } } return NULL; }