void QgsColorRampButton::saveColorRamp() { QgsStyleSaveDialog saveDlg( this, QgsStyle::ColorrampEntity ); if ( !saveDlg.exec() || saveDlg.name().isEmpty() ) { return; } // check if there is no symbol with same name if ( mStyle->symbolNames().contains( saveDlg.name() ) ) { int res = QMessageBox::warning( this, tr( "Save color ramp" ), tr( "Color ramp with name '%1' already exists. Overwrite?" ) .arg( saveDlg.name() ), QMessageBox::Yes | QMessageBox::No ); if ( res != QMessageBox::Yes ) { return; } mStyle->removeColorRamp( saveDlg.name() ); } QStringList colorRampTags = saveDlg.tags().split( ',' ); // add new symbol to style and re-populate the list QgsColorRamp *ramp = colorRamp(); mStyle->addColorRamp( saveDlg.name(), ramp ); mStyle->saveColorRamp( saveDlg.name(), ramp, saveDlg.isFavorite(), colorRampTags ); setColorRampName( saveDlg.name() ); }
void QgsSymbolsListWidget::saveSymbol() { QgsStyleSaveDialog saveDlg( this ); if ( !saveDlg.exec() ) return; if ( saveDlg.name().isEmpty() ) return; // check if there is no symbol with same name if ( mStyle->symbolNames().contains( saveDlg.name() ) ) { int res = QMessageBox::warning( this, tr( "Save Symbol" ), tr( "Symbol with name '%1' already exists. Overwrite?" ) .arg( saveDlg.name() ), QMessageBox::Yes | QMessageBox::No ); if ( res != QMessageBox::Yes ) { return; } mStyle->removeSymbol( saveDlg.name() ); } QStringList symbolTags = saveDlg.tags().split( ',' ); // add new symbol to style and re-populate the list mStyle->addSymbol( saveDlg.name(), mSymbol->clone() ); // make sure the symbol is stored mStyle->saveSymbol( saveDlg.name(), mSymbol->clone(), saveDlg.isFavorite(), symbolTags ); }
void ChoiceForm::SaveScheduleButton_Clicked(GraphicsUI::UI_Base *) { auto schedule = GenerateSchedule(existingChoices, additionalAttribs); FileDialog saveDlg(this->ownerForm); saveDlg.DefaultEXT = L"txt"; saveDlg.Filter = L"Text File|*.txt"; if (saveDlg.ShowSave()) { File::WriteAllText(saveDlg.FileName, schedule); } }
void CImpactChildFrame::OnSaveReport() { CFileDialog saveDlg(FALSE,"htm","Impact Analysis Report",OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "HTML files (*.htm) |*.htm ||", this); CString to; if(saveDlg.DoModal()==IDOK) { to = saveDlg.GetPathName(); m_pwndImpact->SaveReportTo(to); } }
void SIM_PLOT_FRAME::menuSaveImage( wxCommandEvent& event ) { if( !CurrentPlot() ) return; wxFileDialog saveDlg( this, _( "Save plot as image" ), "", "", _( "PNG file (*.png)|*.png" ), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); if( saveDlg.ShowModal() == wxID_CANCEL ) return; CurrentPlot()->SaveScreenshot( saveDlg.GetPath(), wxBITMAP_TYPE_PNG ); }
void SIM_PLOT_FRAME::menuSaveWorkbook( wxCommandEvent& event ) { if( !CurrentPlot() ) return; wxFileDialog saveDlg( this, _( "Save simulation workbook" ), "", "", _( "Workbook file (*.wbk)|*.wbk" ), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); if( saveDlg.ShowModal() == wxID_CANCEL ) return; if( !saveWorkbook( saveDlg.GetPath() ) ) DisplayError( this, _( "There was an error while saving the workbook file" ) ); }
//--------------------------------------------------------------------------------------- // Callback will run every time the user want to copy report from the PSETHOME/reports.qa // to some specified location and name. //--------------------------------------------------------------------------------------- void CQAChildFrame::OnSaveReport() { CFileDialog saveDlg(FALSE,"htm","Quality Analyser Report",OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "HTML files (*.htm) |*.htm |Text files (*.txt) |*.txt||", this); CQATree* tree = (CQATree*)m_wndSplitter.GetPane(0,0); CString to; if(saveDlg.DoModal()==IDOK) { to = saveDlg.GetPathName(); DeleteFile(to); tree->GenerateReport(to); } }
void iMenuView::Start() { while (1) { iMainMenuDlg mdlg(&gApp.ViewMgr()); sint32 res = mdlg.DoModal(); if (res == 100) { // Start new game iScenListDlg sldlg(&gApp.ViewMgr()); res = sldlg.DoModal(); if (res == DRC_OK) { iMapInfo scenProps = sldlg.SelScen(); iScenPropsDlg spdlg(&gApp.ViewMgr(), scenProps, false); if (spdlg.DoModal() == DRC_OK) { scenProps.ReorderPlayers(); gGame.StartNewGame(scenProps, true); break; } } else { continue; } } else if (res == 101) { // Load saved game iSaveDlg saveDlg(&gApp.ViewMgr(), false); res = saveDlg.DoModal(); if (res == DRC_OK) { iMapInfo scenProps = saveDlg.SelScenario(); iScenPropsDlg spdlg(&gApp.ViewMgr(), scenProps, true); if (spdlg.DoModal() == DRC_OK) { scenProps.ReorderPlayers(); gGame.StartNewGame(scenProps, false); break; } } else { continue; } } else if (res == 102) { iDlg_HallOfFame dlg(&gApp.ViewMgr(), gRootPath + _T("PalmHeroes.hsc")); dlg.DoModal(); } else if (res == 103) { StartCredits(); break; } else if (res == 104) { // Quit to WM200x gGame.Quit(); break; } } }
void SIM_PLOT_FRAME::menuSaveWorkbook( wxCommandEvent& event ) { if( !CurrentPlot() ) return; wxFileDialog saveDlg( this, _( "Save Simulation Workbook" ), m_savedWorkbooksPath, "", WorkbookFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); if( saveDlg.ShowModal() == wxID_CANCEL ) return; m_savedWorkbooksPath = saveDlg.GetDirectory(); if( !saveWorkbook( saveDlg.GetPath() ) ) DisplayError( this, _( "There was an error while saving the workbook file" ) ); }
void CCALCViewWinDoc::OnFileSaveAs() { CFileDialog saveDlg( false, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "Text Files (*.txt)|*.txt|All Files (*.*)|*.*||", NULL, 0 ); if (saveDlg.DoModal() == IDOK) { SaveFile(saveDlg.GetPathName()); } }
void SIM_PLOT_FRAME::menuSaveCsv( wxCommandEvent& event ) { if( !CurrentPlot() ) return; const wxChar SEPARATOR = ';'; wxFileDialog saveDlg( this, _( "Save plot data" ), "", "", "CSV file (*.csv)|*.csv", wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); if( saveDlg.ShowModal() == wxID_CANCEL ) return; wxFile out( saveDlg.GetPath(), wxFile::write ); bool timeWritten = false; for( const auto& t : CurrentPlot()->GetTraces() ) { const TRACE* trace = t.second; if( !timeWritten ) { out.Write( wxString::Format( "Time%c", SEPARATOR ) ); for( double v : trace->GetDataX() ) out.Write( wxString::Format( "%f%c", v, SEPARATOR ) ); out.Write( "\r\n" ); timeWritten = true; } out.Write( wxString::Format( "%s%c", t.first, SEPARATOR ) ); for( double v : trace->GetDataY() ) out.Write( wxString::Format( "%f%c", v, SEPARATOR ) ); out.Write( "\r\n" ); } out.Close(); }
//打开文件模块 void CSailorGraphView::OnFileOpen() { // TODO: 在此添加命令处理程序代码 CFileDialog saveDlg(TRUE); CString pathname;//路径 CString ext; if (saveDlg.DoModal()==IDOK) { isClick=1;//设定成点击状态 isDbc=0;//不是多边形 pathname=saveDlg.GetPathName(); ext=saveDlg.GetFileExt(); if (ext=="1line") { tempLine.getView(this); pBase=&tempLine; } if (ext=="1cir") { temp1Circle.getView(this); pBase=&temp1Circle; } if (ext=="1rec") { temp1Rect.getView(this); pBase=&temp1Rect; } if (ext=="2dda") { temp2dda.getView(this); pBase=&temp2dda; } if (ext=="2brel") { temp2brel.getView(this); pBase=&temp2brel; } if (ext=="2ddac") { temp2dcir.getView(this); pBase=&temp2dcir; } if (ext=="2brec") { temp2bcir.getView(this); pBase=&temp2bcir; } if (ext=="2midc") { temp2mcir.getView(this); pBase=&temp2mcir; } if (ext=="dbc") { temp1dbx.getView(this); pBase=&temp1dbx; isDbc=1; } if (ext=="4dbc") { temp4dbx.getView(this); pBase=&temp4dbx; isDbc=1; } if (ext=="5line") { temp5line.getView(this); pBase=&temp5line; } if (ext=="5dbx") { temp5line.getView(this); pBase=&temp5line; } if (ext=="bez") { temp6pt.getView(this); pBase=&temp6pt; } pBase->OnFileOpen(pathname); } Invalidate(); UpdateWindow(); }
void PointCloudLODGenerator::SetSceneData(osgViewer::CompositeViewer* viewer) { setlocale(LC_ALL, "chs"); AfxMessageBox("第一步:选择待生成LOD的点云文件"); CFileDialog dlg(TRUE, "选择待生成LOD的点云文件", NULL, 0, "All(*.*)|*.*|"); if(dlg.DoModal()!=IDOK) { AfxMessageBox("没有选择文件,工作流结束!"); return; } CString strFileName = dlg.GetPathName(); AfxMessageBox("第二步:保存为osg\\ive格式场景文件"); CFileDialog saveDlg(FALSE, "选择保存文件名", NULL, 0, "osg文件(*.osg)|*.osg|ive文件(*.ive)|*.ive|"); if(saveDlg.DoModal()!=IDOK) { AfxMessageBox("没有选择保存文件名, 工作流结束!"); return; } CString strSaveFileName = saveDlg.GetPathName(); #ifndef _DEBUG AFX_MANAGE_STATE(AfxGetStaticModuleState()); #endif AfxMessageBox("第三步,设置参数"); LODParaSetter setter; float sampleRatio=0.001; unsigned int targetNumOnLeaf = 10000; double maxVisibleRange=800; double minVisibleRange=100; if(setter.DoModal()==IDOK) { sampleRatio = setter.m_sampleRatio; targetNumOnLeaf = setter.m_targetNumOnLeaf; maxVisibleRange = setter.maxBoundVisibleRange; minVisibleRange = setter.minBoundVisibleRange; } AfxMessageBox("第三步:读取点云文件并进行转换,请耐心等待..."); setWorkingPath(); CString cmd = "PointsDividor.exe"; CString par; par.Format("\"%s\" \"%s\" %d %f %d %lf", strFileName, strSaveFileName, 16, sampleRatio, targetNumOnLeaf, maxVisibleRange, minVisibleRange); //AfxMessageBox(par); SHELLEXECUTEINFO shellinfo = runConsole(cmd, par); if(shellinfo.hProcess==NULL) { AfxMessageBox("无法打开应用程序:PointsDividor.exe!工作流结束!"); return; } #ifndef _DEBUG //AFX_MANAGE_STATE(AfxGetStaticModuleState()); CWaitDialog* pWaitDlg = new CWaitDialog; pWaitDlg->Create(IDD_DIALOG_WAIT, NULL); pWaitDlg->ShowWindow(SW_SHOW); #endif while (true) { DWORD signal = WaitForSingleObject(shellinfo.hProcess, 10); if ( signal == WAIT_OBJECT_0 || shellinfo.hProcess==NULL ) { break; } MSG msg; GetMessage(&msg, NULL, 0, 0); if (&msg!=NULL) { TranslateMessage(&msg); DispatchMessage(&msg); } #ifndef _DEBUG pWaitDlg->m_progBar.StepIt(); #endif } #ifndef _DEBUG pWaitDlg->DestroyWindow(); delete pWaitDlg; #endif osg::Node* ret = osgDB::readNodeFile(string(strSaveFileName)); sceneRoot = ret; if(ret==0) { AfxMessageBox("无法读取该文件!"); return; } osg::Group* root = viewer->getView(0)->getSceneData()->asGroup(); root->addChild(ret); }
QString QgsStyleManagerDialog::addColorRampStatic( QWidget *parent, QgsStyle *style, QString rampType ) { // let the user choose the color ramp type if rampType is not given bool ok = true; if ( rampType.isEmpty() ) { QStringList rampTypes; rampTypes << tr( "Gradient" ) << tr( "Color presets" ) << tr( "Random" ) << tr( "Catalog: cpt-city" ); rampTypes << tr( "Catalog: ColorBrewer" ); rampType = QInputDialog::getItem( parent, tr( "Color Ramp Type" ), tr( "Please select color ramp type:" ), rampTypes, 0, false, &ok ); } if ( !ok || rampType.isEmpty() ) return QString(); QString name = tr( "new ramp" ); std::unique_ptr< QgsColorRamp > ramp; if ( rampType == tr( "Gradient" ) ) { QgsGradientColorRampDialog dlg( QgsGradientColorRamp(), parent ); if ( !dlg.exec() ) { return QString(); } ramp.reset( dlg.ramp().clone() ); name = tr( "new gradient ramp" ); } else if ( rampType == tr( "Random" ) ) { QgsLimitedRandomColorRampDialog dlg( QgsLimitedRandomColorRamp(), parent ); if ( !dlg.exec() ) { return QString(); } ramp.reset( dlg.ramp().clone() ); name = tr( "new random ramp" ); } else if ( rampType == tr( "Catalog: ColorBrewer" ) ) { QgsColorBrewerColorRampDialog dlg( QgsColorBrewerColorRamp(), parent ); if ( !dlg.exec() ) { return QString(); } ramp.reset( dlg.ramp().clone() ); name = dlg.ramp().schemeName() + QString::number( dlg.ramp().colors() ); } else if ( rampType == tr( "Color presets" ) ) { QgsPresetColorRampDialog dlg( QgsPresetSchemeColorRamp(), parent ); if ( !dlg.exec() ) { return QString(); } ramp.reset( dlg.ramp().clone() ); name = tr( "new preset ramp" ); } else if ( rampType == tr( "Catalog: cpt-city" ) ) { QgsCptCityColorRampDialog dlg( QgsCptCityColorRamp( QLatin1String( "" ), QLatin1String( "" ) ), parent ); if ( !dlg.exec() ) { return QString(); } // name = dlg.selectedName(); name = QFileInfo( dlg.ramp().schemeName() ).baseName() + dlg.ramp().variantName(); if ( dlg.saveAsGradientRamp() ) { ramp.reset( dlg.ramp().cloneGradientRamp() ); } else { ramp.reset( dlg.ramp().clone() ); } } else { // Q_ASSERT( 0 && "invalid ramp type" ); // bailing out is rather harsh! QgsDebugMsg( "invalid ramp type " + rampType ); return QString(); } QgsStyleSaveDialog saveDlg( parent, QgsStyle::ColorrampEntity ); if ( !saveDlg.exec() ) { return QString(); } name = saveDlg.name(); // get valid/unique name bool nameInvalid = true; while ( nameInvalid ) { // validate name if ( name.isEmpty() ) { QMessageBox::warning( parent, tr( "Save Color Ramp" ), tr( "Cannot save color ramp without name. Enter a name." ) ); } else if ( style->colorRampNames().contains( name ) ) { int res = QMessageBox::warning( parent, tr( "Save Color Ramp" ), tr( "Color ramp with name '%1' already exists. Overwrite?" ) .arg( name ), QMessageBox::Yes | QMessageBox::No ); if ( res == QMessageBox::Yes ) { nameInvalid = false; } } else { // valid name nameInvalid = false; } if ( nameInvalid ) { bool ok; name = QInputDialog::getText( parent, tr( "Color Ramp Name" ), tr( "Please enter a name for new color ramp:" ), QLineEdit::Normal, name, &ok ); if ( !ok ) { return QString(); } } } QStringList colorRampTags = saveDlg.tags().split( ',' ); QgsColorRamp *r = ramp.release(); // add new symbol to style and re-populate the list style->addColorRamp( name, r ); style->saveColorRamp( name, r, saveDlg.isFavorite(), colorRampTags ); return name; }
bool QgsStyleManagerDialog::addSymbol() { // create new symbol with current type QgsSymbol *symbol = nullptr; QString name = tr( "new symbol" ); switch ( currentItemType() ) { case QgsSymbol::Marker: symbol = new QgsMarkerSymbol(); name = tr( "new marker" ); break; case QgsSymbol::Line: symbol = new QgsLineSymbol(); name = tr( "new line" ); break; case QgsSymbol::Fill: symbol = new QgsFillSymbol(); name = tr( "new fill symbol" ); break; default: Q_ASSERT( false && "unknown symbol type" ); return false; } // get symbol design // NOTE : Set the parent widget as "this" to notify the Symbol selector // that, it is being called by Style Manager, so recursive calling // of style manager and symbol selector can be arrested // See also: editSymbol() QgsSymbolSelectorDialog dlg( symbol, mStyle, nullptr, this ); if ( dlg.exec() == 0 ) { delete symbol; return false; } QgsStyleSaveDialog saveDlg( this ); if ( !saveDlg.exec() ) { delete symbol; return false; } name = saveDlg.name(); // request valid/unique name bool nameInvalid = true; while ( nameInvalid ) { // validate name if ( name.isEmpty() ) { QMessageBox::warning( this, tr( "Save Symbol" ), tr( "Cannot save symbol without name. Enter a name." ) ); } else if ( mStyle->symbolNames().contains( name ) ) { int res = QMessageBox::warning( this, tr( "Save Symbol" ), tr( "Symbol with name '%1' already exists. Overwrite?" ) .arg( name ), QMessageBox::Yes | QMessageBox::No ); if ( res == QMessageBox::Yes ) { mStyle->removeSymbol( name ); nameInvalid = false; } } else { // valid name nameInvalid = false; } if ( nameInvalid ) { bool ok; name = QInputDialog::getText( this, tr( "Symbol Name" ), tr( "Please enter a name for new symbol:" ), QLineEdit::Normal, name, &ok ); if ( !ok ) { delete symbol; return false; } } } QStringList symbolTags = saveDlg.tags().split( ',' ); // add new symbol to style and re-populate the list mStyle->addSymbol( name, symbol ); mStyle->saveSymbol( name, symbol, saveDlg.isFavorite(), symbolTags ); mModified = true; return true; }