bool ODConfig::ExportGPXODPoints( wxWindow* parent, ODPointList *pODPoints, const wxString suggestedName ) { wxFileDialog saveDialog( NULL, _( "Export GPX file" ), m_gpx_path, suggestedName, wxT ( "GPX files (*.gpx)|*.gpx" ), wxFD_SAVE ); int response = saveDialog.ShowModal(); wxString path = saveDialog.GetPath(); wxFileName fn( path ); m_gpx_path = fn.GetPath(); if( response == wxID_OK ) { fn.SetExt( _T ( "gpx" ) ); if( wxFileExists( fn.GetFullPath() ) ) { int answer = OCPNMessageBox_PlugIn(NULL, _("Overwrite existing file?"), _("Confirm"), wxICON_QUESTION | wxYES_NO | wxCANCEL ); if( answer != wxID_YES ) return false; } ODNavObjectChanges *pgpx = new ODNavObjectChanges; pgpx->AddGPXODPointsList( pODPoints ); pgpx->SaveFile(fn.GetFullPath()); delete pgpx; return true; } else return false; }
void MainWindow::closeEvent(QCloseEvent *event) { bool accept_exit = Data::instance()->hasChanged(); // has the mesh changed? if (accept_exit) { // ask to save or not int choice = QMessageBox::question( this, "Save old project?", "Do you want to save befor exiting?", (QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel), QMessageBox::Yes); if (choice == QMessageBox::Yes) { QString path = Data::instance()->getSaveFile(); if(path == "") path = saveDialog(); // check if a file was chosen accept_exit = path != ".mesh"; // save to file if (accept_exit) saveFile(path); } else if (choice == QMessageBox::No) // if user does not want to save, exit is ok accept_exit = true; } else accept_exit = true; // if exit action is still ok, accept it. if (accept_exit) event->accept(); else event->ignore(); }
void BoatDialog::OnSaveFile ( wxCommandEvent& event ) { long index = SelectedPolar(); if(index < 0) return; wxFileConfig *pConf = GetOCPNConfigObject(); pConf->SetPath ( _T( "/PlugIns/WeatherRouting/BoatDialog" ) ); wxString path; pConf->Read ( _T ( "FilePath" ), &path, weather_routing_pi::StandardPath()); wxFileDialog saveDialog( this, _( "Select Polar" ), path, wxT ( "" ), wxT ( "Boat Polar files (*.file)|*.FILE;*.file|All files (*.*)|*.*" ), wxFD_SAVE ); if( saveDialog.ShowModal() == wxID_OK ) { wxString filename = saveDialog.GetPath(); pConf->SetPath ( _T( "/PlugIns/WeatherRouting/BoatDialog" ) ); pConf->Write ( _T ( "FILEPath" ), wxFileName(filename).GetPath() ); Polar &polar = m_Boat.Polars[index]; if(!polar.Save(saveDialog.GetPath().mb_str())) { wxMessageDialog md(this, _("Failed saving boat polar to file"), _("OpenCPN Weather Routing Plugin"), wxICON_ERROR | wxOK ); md.ShowModal(); } } }
////////////////////////////////////////////////////////////////////////// // Event handler for the save button void AllAssignedUI::on_saveButton(const Glib::ustring& data){ string cn = "./AppSummaries/AllAssignedApps"; int i = 0; // Create an output file ofstream outFile(cn.c_str(), ios::out); if (!outFile) cout << "Could not open file" << endl; // Output application information to permanent storage outFile << "*NEW SUMMARY OF ALL ASSIGNED APPLICATIONS*" << endl; for ( i =0; i< summary.size(); i++){ outFile << endl; if (summary.get_text(i,0) == "--------") continue; outFile << summary.get_text(i,0) << endl; outFile << summary.get_text(i,1) << endl; outFile << summary.get_text(i,2) << endl; outFile << summary.get_text(i,3) << endl; outFile << summary.get_text(i,4) << endl; outFile << summary.get_text(i,5) << endl; outFile << summary.get_text(i,6) << endl; outFile << summary.get_text(i,7) << endl; outFile << summary.get_text(i,8) << endl; outFile << summary.get_text(i,9) << endl; } outFile << endl; saveDialog(); }
void MainWindow::on_actionSave_triggered() { if(mSaveLocation == QString()) saveDialog(); else{ auto project = mProjectView->getProject(); if(!project) return; project->save(); } }
void WxIrrMainWindow::OnSaveSimulation(wxCommandEvent &event) { wxFileDialog saveDialog(this, _("Save Simulation file"), "", "", "Simulation files (*.sim)|*.sim", wxFD_SAVE|wxFD_OVERWRITE_PROMPT); if (saveDialog.ShowModal() == wxID_CANCEL) return; OnSaveSimulationFunctionPointer(saveDialog.GetPath()); }
void MainForm::OnToolsNormalmapfromtexture() { CFileDialog fileDialog( true, "*.*", NULL, 0, "All Files (*.*)|*.*||", this ); // setup browsing from resource directory char currentDir[1024]; GetCurrentDirectory( 1024, currentDir ); std::string initialDir = currentDir; initialDir += "\\res"; fileDialog.m_ofn.lpstrInitialDir = initialDir.c_str(); if( fileDialog.DoModal() == IDOK ) { // back to application current directory SetCurrentDirectory( currentDir ); std::string resourceName1 = fileDialog.GetPathName(); makeEngineCompatiblePath( resourceName1 ); CFileDialog saveDialog( false, "*.bmp", NULL, 0, "Windows bitmap (*.bmp)|*.bmp||", this ); // setup browsing from resource directory GetCurrentDirectory( 1024, currentDir ); std::string initialDir = currentDir; initialDir += "\\res"; saveDialog.m_ofn.lpstrInitialDir = initialDir.c_str(); if( saveDialog.DoModal() == IDOK ) { // back to application current directory SetCurrentDirectory( currentDir ); std::string resourceName2 = saveDialog.GetPathName(); makeEngineCompatiblePath( resourceName2 ); import::IImport* iImport; queryInterfaceT( "Import", &iImport ); iImport->createNormalMap( resourceName1.c_str(), resourceName2.c_str(), 1.0f ); } } }
void MainWindow::saveFileAs() { QFileDialog saveDialog(this); saveDialog.setWindowTitle("Save File"); saveDialog.setNameFilters(QStringList() << "Rail Files (*.rail)" << "Text Files (*.txt)" << "All Files (*.*)"); if(saveDialog.exec() && !saveDialog.selectedFiles().isEmpty()) { save(saveDialog.selectedFiles().first()); } }
void WeatherRouting::OnSave( wxCommandEvent& event ) { wxString error; wxFileDialog saveDialog ( this, _( "Select Configuration" ), _("~"), wxT ( "" ), wxT ( "XML files (*.xml)|*.XML;*.xml|All files (*.*)|*.*" ), wxFD_SAVE ); if( saveDialog.ShowModal() == wxID_OK ) SaveXML(saveDialog.GetPath()); }
void MainWindow::on_actionSave_triggered() { QString fileName = Data::instance()->getSaveFile(); if (fileName == "") { fileName = saveDialog(); if (fileName != "") Data::instance()->setSaveFile(fileName); else return; } saveFile(fileName); }
wxString ControlPanel::saveFileDialog(const wxString& prompt, const wxString& wildcard) { wxString path = wxEmptyString; wxFileDialog saveDialog(this, wxT("Save Playfile"), wxGetCwd(), "", wildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT); if (saveDialog.ShowModal() != wxID_CANCEL) { wxFileOutputStream save_stream(saveDialog.GetPath()); if (!save_stream.IsOk()) { wxLogError("Could not save to selected file"); } else { path = saveDialog.GetPath(); } } return path; }
void QCrmlGenerator::saveFileAs() { if (m_editorWidget->verifyContents()) { QFileDialog saveDialog(this, tr("Save As"), QString(), tr("QCrml (*.qcrml);;Any Files (*)")); saveDialog.setDefaultSuffix(QLatin1String("qcrml")); saveDialog.setFileMode(QFileDialog::AnyFile); saveDialog.setAcceptMode(QFileDialog::AcceptSave); if (saveDialog.exec() == QDialog::Accepted) { if (saveDialog.selectedFiles().count() > 0) { m_saveFile = saveDialog.selectedFiles().at(0); m_editorWidget->save(m_saveFile); } } } }
void MyFrame1::OnSave(wxCommandEvent &WXUNUSED(event)) { wxFileDialog saveDialog(this, wxT("Save tga file"), "", "", "bmp and tga file (*.tga;*.bmp)|*.bmp;*.tga", wxFD_SAVE | wxFD_OVERWRITE_PROMPT); if (saveDialog.ShowModal() == wxID_CANCEL) return; wxString fileName = saveDialog.GetPath(); if (fileName.AfterLast('.').CmpNoCase(wxT("bmp")) == 0) { Controller::Get().SaveToBmpFile(fileName); } else { Controller::Get().SaveToTgaFile(fileName); } }
bool TextEdit::processQuit() { bool quit = true; if (textChanged) { SaveDialog saveDialog(this); saveDialog.create(); saveDialog.doModal(); if (saveDialog.buttonPressed == SaveDialog::BUTTON_YES) { onSave(); } else if (saveDialog.buttonPressed == SaveDialog::BUTTON_NO) { // Nothing to do. } else if (saveDialog.buttonPressed == SaveDialog::BUTTON_CANCEL) { quit = false; } } return quit; }
void KinectViewer::saveStreamsCallback(GLMotif::ToggleButton::ValueChangedCallbackData* cbData) { if(cbData->set) { if(saveStreamsFileSelectionDialog==0) { try { /* Create a file selection dialog to select a file name: */ Misc::SelfDestructPointer<GLMotif::FileSelectionDialog> saveDialog(new GLMotif::FileSelectionDialog(Vrui::getWidgetManager(),"Save Streams...",saveStreamsDirectory,"SavedStreams",".color;.depth")); saveDialog->getOKCallbacks().add(this,&KinectViewer::saveStreamsOKCallback); saveDialog->getCancelCallbacks().add(this,&KinectViewer::saveStreamsCancelCallback); /* Show the file selection dialog: */ Vrui::popupPrimaryWidget(saveDialog.getTarget()); /* Remember the file selection dialog: */ saveStreamsFileSelectionDialog=saveDialog.releaseTarget(); } catch(std::runtime_error err) { /* Show an error message: */ Misc::formattedUserError("Save Streams...: Could not select file name due to exception %s",err.what()); } } } else { if(saveStreamsFileSelectionDialog!=0) { /* Close the file selection dialog: */ saveStreamsFileSelectionDialog->close(); saveStreamsFileSelectionDialog=0; } else { /* Stop saving 3D video streams: */ for(size_t i=0;i<streamers.size();++i) streamers[i]->setFrameSaver(0); /* Stop recording audio: */ soundRecorder->stop(); delete soundRecorder; soundRecorder=0; } } }
//----------------------------------------------------------------------- void MaterialTab::OnSaveMaterial(wxCommandEvent& event) { #ifdef PU_FULL_VERSION if (mMaterialListBox) { wxString filename = mMaterialListBox->GetStringSelection(); wxFileDialog saveDialog(this, _("Save the material"), wxT(""), filename, _("material scripts (*.material;*.osm)|*.material;*.osm"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT, wxDefaultPosition, wxDefaultSize, _("Save")); if (saveDialog.ShowModal() == wxID_OK) { SetCursor(*wxHOURGLASS_CURSOR); wxString materialName = mMaterialListBox->GetStringSelection(); Ogre::String name = wx2ogre(materialName); Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().getByName(name); if (!material.isNull()) { // User has pressed ok, so save the material Ogre::MaterialSerializer ms; Ogre::String path = wx2ogre(saveDialog.GetPath()); Ogre::String baseName; Ogre::String extension; Ogre::String dir; Ogre::StringUtil::splitFullFilename(path, baseName, extension, dir); ms.exportMaterial(material, path); // Save the selected material + resource locations of material and texture ParticleUniverseEditorFrame* frame = static_cast<ParticleUniverseEditorFrame*>(mRootParent); mResourceLocationMaterial = ogre2wx(dir); frame->addResourcePathToConfig(mResourceLocationMaterial); frame->addResourcePathToConfig(mResourceLocationTexture); } SetCursor(wxNullCursor); } } #endif // PU_FULL_VERSION }
void BoatDialog::SaveBoat() { while(m_CrossOverGenerationThread) { wxYield(); wxThread::Sleep(10); } if(m_boatpath.empty()) { wxFileConfig *pConf = GetOCPNConfigObject(); pConf->SetPath ( _T( "/PlugIns/WeatherRouting/BoatDialog" ) ); wxString path; pConf->Read ( _T ( "Path" ), &path, weather_routing_pi::StandardPath()); wxFileDialog saveDialog( this, _( "Select Boat" ), path, wxT ( "" ), wxT ( "Boat files (*.xml)|*.XML;*.xml|All files (*.*)|*.*" ), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); if( saveDialog.ShowModal() == wxID_OK ) { wxString filename = wxFileDialog::AppendExtension(saveDialog.GetPath(), _T("*.xml")); pConf->SetPath ( _T( "/PlugIns/WeatherRouting/BoatDialog" ) ); pConf->Write ( _T ( "Path" ), wxFileName(filename).GetPath() ); m_boatpath = filename; SetTitle(m_boatpath); } else return; } wxString error = m_Boat.SaveXML(m_boatpath); if(error.empty()) { m_WeatherRouting.m_ConfigurationDialog.SetBoatFilename(m_boatpath); /* update any configurations that use this boat */ m_WeatherRouting.UpdateBoatFilename(m_boatpath); Update(); Hide(); } else { wxMessageDialog md(this, error, _("OpenCPN Weather Routing Plugin"), wxICON_ERROR | wxOK ); md.ShowModal(); } }
////////////////////////////////////////////////////////////////////////// // Event handler for the save button void OnePendingUI::on_saveButton(const Glib::ustring& data){ string cn = "./AppSummaries/ByCourse/" + course; int i =0; // Create an output file ofstream outFile(cn.c_str(), ios::out); if (!outFile) cout << "Could not open file" << endl; // Output application information to permanent storage outFile << "*NEW SUMMARY OF PENDING APPLICATIONS FOR "<< course << "*" << endl; for ( i =0; i< summary.size(); i++){ if (summary.get_text(i,0) == "UNDERGRADS") { outFile << endl; outFile << "-------- UNDERGRADS --------"; outFile << endl; continue; } if (summary.get_text(i,0) == "GRADS") { outFile << endl; outFile << "---------- GRADS -----------"; outFile << endl; continue; } if (summary.get_text(i,0) == "No Undergrad applications for this course." || summary.get_text(i,0) == "No Grad applications for this course." ) { outFile << endl; outFile << summary.get_text(i,0) << endl; outFile << endl; continue; } outFile << endl; outFile << summary.get_text(i,0) << endl; outFile << summary.get_text(i,1) << endl; outFile << summary.get_text(i,2) << endl; outFile << summary.get_text(i,3) << endl; outFile << summary.get_text(i,4) << endl; outFile << summary.get_text(i,5) << endl; outFile << summary.get_text(i,6) << endl; outFile << summary.get_text(i,7) << endl; } outFile << endl; saveDialog(); }
bool MainWindow::saveOnDanger(bool onExit) { bool returnVal = true; auto project = mProjectView->getProject(); if(!project) return returnVal; if(!mProjectView->getModified()) return returnVal; QMessageBox msg; msg.setWindowTitle("Save File?"); msg.setText("You have unsaved changes."); msg.setInformativeText("Do you want to save your changes?"); QMessageBox::StandardButtons btns = QMessageBox::Save | QMessageBox::Discard; if(!onExit) btns |= QMessageBox::Cancel; msg.setStandardButtons(btns); msg.setDefaultButton(QMessageBox::Save); int ret = msg.exec(); switch(ret){ case QMessageBox::Save: { bool success = true; do{ if(!saveDialog()){ int ret2 = QMessageBox::warning(this, tr("Saveing failed!"), tr("Do you want to try again?"), QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok); if(ret2 == QMessageBox::Ok) success = false; else{ returnVal = false; success = true; } } } while(!success); break; } case QMessageBox::Cancel: { returnVal = false; break; } } return returnVal; }
void MainWindow::on_actionNew_triggered() { bool accept_exit = Data::instance()->hasChanged(); // has the mesh changed? if (accept_exit) { // ask to save or not int choice = QMessageBox::question( this, "Save old project?", "You attemted creating a new project.\n Do you want to save your " "current project?", (QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel), QMessageBox::Yes); if (choice == QMessageBox::Yes) { QString path = Data::instance()->getSaveFile(); if(path == "") path = saveDialog(); // check if a file was chosen accept_exit = path != ".mesh"; // save to file if (accept_exit) saveFile(path); } else if (choice == QMessageBox::No) // if user does not want to save, exit is ok accept_exit = true; } else accept_exit = true; if (accept_exit) Data::instance()->newMeshProject(); }
void VRShopEditorDlg::slotSaveScene() { QString qstrFileName = saveDialog("*.txt"); }
void MainWindow::on_actionSave_As_triggered() { saveDialog(); }
void MainWindow::on_actionSave_as_triggered() { QString fileName = saveDialog(); saveFile(fileName); }
LRESULT CALLBACK WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam) { int nItemCount; int nSelected; int *nIndexes; BOOL bFlag; WCHAR *pszFile; WCHAR *handle; WCHAR *token; Image *imgCurrent; Image out; switch (iMessage) { case WM_CREATE: HANDLE hToken; viewer.changeCaption(L"Preview"); //Create Controls hListLayer = CreateWindow(L"ListBox", NULL, WS_CHILD | WS_VISIBLE | WS_VSCROLL | LBS_EXTENDEDSEL | LBS_HASSTRINGS | LBS_NOTIFY | LBS_MULTIPLESEL | LBS_NOINTEGRALHEIGHT, 0, 80, 240, 420, hWnd, (HMENU)ID_LAYER_LIST, ((LPCREATESTRUCT)lParam)->hInstance, NULL); hButtonStart = CreateWindow(L"Button", L"Start", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 0, 0, 80, 40, hWnd, (HMENU)ID_START_BUTTON, ((LPCREATESTRUCT)lParam)->hInstance, NULL); hButtonSave = CreateWindow(L"Button", L"Save Selected in merged file", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | BS_MULTILINE, 80, 0, 80, 40, hWnd, (HMENU)ID_SAVE_BUTTON, ((LPCREATESTRUCT)lParam)->hInstance, NULL); hButtonSaveAll = CreateWindow(L"Button", L"Save All in individual file", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | BS_MULTILINE, 160, 0, 80, 40, hWnd, (HMENU)ID_SAVE_ALL, ((LPCREATESTRUCT)lParam)->hInstance, NULL); hButtonResetAll = CreateWindow(L"Button", L"Erase All", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | BS_MULTILINE, 0, 40, 80, 40, hWnd, (HMENU)ID_RESET_ALL, ((LPCREATESTRUCT)lParam)->hInstance, NULL); hButtonResetSelected = CreateWindow(L"Button", L"Erase Selected", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | BS_MULTILINE, 80, 40, 80, 40, hWnd, (HMENU)ID_RESET_SEL, ((LPCREATESTRUCT)lParam)->hInstance, NULL); hButtonResetUnselected = CreateWindow(L"Button", L"Erase Unelected", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | BS_MULTILINE, 160, 40, 80, 40, hWnd, (HMENU)ID_RESET_UNSEL, ((LPCREATESTRUCT)lParam)->hInstance, NULL); hFont = CreateFont(16, 0, 0, 0, 400, 0, 0, 0, DEFAULT_CHARSET, 3, 2, 1, FF_ROMAN, L"Segoe UI"); SendMessage(hListLayer, WM_SETFONT, (WPARAM)hFont, TRUE); SendMessage(hButtonStart, WM_SETFONT, (WPARAM)hFont, TRUE); SendMessage(hButtonSave, WM_SETFONT, (WPARAM)hFont, TRUE); SendMessage(hButtonSaveAll, WM_SETFONT, (WPARAM)hFont, TRUE); SendMessage(hButtonResetAll, WM_SETFONT, (WPARAM)hFont, TRUE); SendMessage(hButtonResetSelected, WM_SETFONT, (WPARAM)hFont, TRUE); SendMessage(hButtonResetUnselected, WM_SETFONT, (WPARAM)hFont, TRUE); //Create Events hAttachSucceeded = CreateEvent(NULL, TRUE, FALSE, NULL); hDebugEnd = CreateEvent(NULL, TRUE, FALSE, NULL); hDebugInit = CreateEvent(NULL, TRUE, FALSE, NULL); //Adjust Privileges if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) { if (SetPrivilege(hToken, SE_DEBUG_NAME, TRUE)) return 0; else MessageBox(hWnd, L"Fail to get debug privilege!!", L"Error", MB_OK | MB_ICONERROR); } else MessageBox(hWnd, L"Fail to get process token!!", L"Error", MB_OK | MB_ICONERROR); SendMessage(hWnd, WM_DESTROY, 0, 0); return 0; case WM_ACTIVATE: if (wParam == WA_CLICKACTIVE) { viewer.foreground(); SetForegroundWindow(hWnd); SetFocus(hListLayer); } return 0; case WM_COMMAND: switch (LOWORD(wParam)) { case ID_START_BUTTON: if (!bStarted) { hAokanaWnd = FindAokana(&dwThreadID, &dwProcessID); if (dwThreadID != 0) { hDebugThread = CreateThread(NULL, 0, DebugThread, NULL, 0, NULL); WaitForSingleObject(hDebugInit, INFINITE); if (WaitForSingleObject(hAttachSucceeded, 0) != WAIT_OBJECT_0) { SetEvent(hDebugEnd); MessageBox(hWnd, L"Fail to attach process!!", L"Error", MB_OK | MB_ICONERROR); break; } SendMessage(hButtonStart, WM_SETTEXT, 0, (LPARAM)L"Stop"); bStarted = TRUE; } } else { SetEvent(hDebugEnd); WaitForSingleObject(hDebugThread, INFINITE); ResetEvent(hDebugEnd); ResetEvent(hDebugInit); ResetEvent(hAttachSucceeded); CloseHandle(hDebugThread); SendMessage(hButtonStart, WM_SETTEXT, 0, (LPARAM)L"Start"); bStarted = FALSE; } break; case ID_SAVE_BUTTON: nItemCount = SendMessage(hListLayer, LB_GETCOUNT, 0, 0); nSelected = SendMessage(hListLayer, LB_GETSELCOUNT, 0, 0); if (nSelected > 0) { nIndexes = (int *)calloc(nSelected, sizeof(int)); SendMessage(hListLayer, LB_GETSELITEMS, nSelected, (LPARAM)nIndexes); memset(&out, 0, sizeof(Image)); for (int i = nSelected - 1; i >= 0; i--) { imgCurrent = (Image *)SendMessage(hListLayer, LB_GETITEMDATA, nIndexes[i], 0); if (imgCurrent == NULL) continue; if (i == nSelected - 1) { out.data = (PIXEL *)calloc(imgCurrent->width * imgCurrent->height, sizeof(PIXEL)); out.width = imgCurrent->width; out.height = imgCurrent->height; } if (imgCurrent->width == out.width && imgCurrent->height == out.height) pixeloverlay(out.width, out.height, out.data, imgCurrent->data, out.data); } saveDialog(hWnd, out); free(nIndexes); free(out.data); } break; case ID_SAVE_ALL: nItemCount = SendMessage(hListLayer, LB_GETCOUNT, 0, 0); if (nItemCount > 0) { if (selectFolder(hWnd, pszFolder)) { pszFile = (WCHAR *)calloc(256, sizeof(WCHAR)); for (int i = nItemCount - 1; i >= 0; i--) { imgCurrent = (Image *)SendMessage(hListLayer, LB_GETITEMDATA, i, 0); SendMessage(hListLayer, LB_GETTEXT, i, (LPARAM)pszFile); token = wcstok_s(pszFile, L" ", &handle); token = wcstok_s(NULL, L" ", &handle); if (pszFolder[wcslen(pszFolder) - 1] != '\\') wcscat_s(pszFolder, L"\\"); nSelected = wcslen(pszFolder); //Position of '\' + 1 wcscat_s(pszFolder, token); wcscat_s(pszFolder, L".png"); saveImage(*imgCurrent, pszFolder); pszFolder[nSelected] = 0; } free(pszFile); } } break; case ID_LAYER_LIST: if (HIWORD(wParam) == LBN_SELCHANGE) { nItemCount = SendMessage(hListLayer, LB_GETCOUNT, 0, 0); nSelected = SendMessage(hListLayer, LB_GETSELCOUNT, 0, 0); if (nSelected > 0) { nIndexes = (int *)calloc(nSelected, sizeof(int)); SendMessage(hListLayer, LB_GETSELITEMS, nSelected, (LPARAM)nIndexes); for (int i = nSelected - 1; i >= 0; i--) { imgCurrent = (Image *)SendMessage(hListLayer, LB_GETITEMDATA, nIndexes[i], 0); if (imgCurrent == NULL) continue; if (i == nSelected - 1) viewer.create(imgCurrent->width, imgCurrent->height); if (imgCurrent->width == viewer.getwidth() && imgCurrent->height == viewer.getheight()) viewer.overlay(imgCurrent->data); } viewer.show(); free(nIndexes); } else viewer.hide(); } break; case ID_RESET_ALL: nItemCount = SendMessage(hListLayer, LB_GETCOUNT, 0, 0); for (int i = 0; i < nItemCount; i++) { imgCurrent = (Image *)SendMessage(hListLayer, LB_GETITEMDATA, i, 0); free(imgCurrent->data); free(imgCurrent); } SendMessage(hListLayer, LB_RESETCONTENT, 0, 0); viewer.hide(); break; case ID_RESET_SEL: nItemCount = SendMessage(hListLayer, LB_GETCOUNT, 0, 0); nSelected = SendMessage(hListLayer, LB_GETSELCOUNT, 0, 0); if (nSelected > 0) { nIndexes = (int *)calloc(nSelected, sizeof(int)); SendMessage(hListLayer, LB_GETSELITEMS, nSelected, (LPARAM)nIndexes); for (int i = nSelected - 1; i >= 0; i--) { imgCurrent = (Image *)SendMessage(hListLayer, LB_GETITEMDATA, nIndexes[i], 0); free(imgCurrent->data); free(imgCurrent); SendMessage(hListLayer, LB_DELETESTRING, nIndexes[i], 0); } free(nIndexes); viewer.hide(); } break; case ID_RESET_UNSEL: nItemCount = SendMessage(hListLayer, LB_GETCOUNT, 0, 0); nSelected = SendMessage(hListLayer, LB_GETSELCOUNT, 0, 0); if (nSelected > 0) { nIndexes = (int *)calloc(nSelected, sizeof(int)); SendMessage(hListLayer, LB_GETSELITEMS, nSelected, (LPARAM)nIndexes); for (int i = nItemCount - 1; i >= 0; i--) { bFlag = FALSE; for (int j = nSelected - 1; j >= 0; j--) if (i == nIndexes[j]) bFlag = TRUE; if (!bFlag) { imgCurrent = (Image *)SendMessage(hListLayer, LB_GETITEMDATA, i, 0); free(imgCurrent->data); free(imgCurrent); SendMessage(hListLayer, LB_DELETESTRING, i, 0); } } free(nIndexes); } break; } return 0; case WM_DESTROY: if (bStarted) SendMessage(hWnd, WM_COMMAND, ID_START_BUTTON, 0); SendMessage(hWnd, WM_COMMAND, ID_RESET_ALL, 0); CloseHandle(hAttachSucceeded); CloseHandle(hDebugEnd); DeleteObject(hFont); PostQuitMessage(0); return 0; } return DefWindowProc(hWnd, iMessage, wParam, lParam); }
void ODConfig::ExportGPX( wxWindow* parent, bool bviz_only, bool blayer ) { wxFileDialog saveDialog( NULL, _( "Export GPX file" ), m_gpx_path, wxT ( "" ), wxT ( "GPX files (*.gpx)|*.gpx" ), wxFD_SAVE ); int response = saveDialog.ShowModal(); wxString path = saveDialog.GetPath(); wxFileName fn( path ); m_gpx_path = fn.GetPath(); if( response == wxID_OK ) { fn.SetExt( _T ( "gpx" ) ); if( wxFileExists( fn.GetFullPath() ) ) { int answer = OCPNMessageBox_PlugIn( NULL, _("Overwrite existing file?"), _("Confirm"), wxICON_QUESTION | wxYES_NO | wxCANCEL ); if( answer != wxID_YES ) return; } ::wxBeginBusyCursor(); ODNavObjectChanges *pgpx = new ODNavObjectChanges; wxProgressDialog *pprog = NULL; int count = g_pODPointMan->GetODPointList()->GetCount(); if( count > 200) { pprog = new wxProgressDialog( _("Export GPX file"), _T("0/0"), count, NULL, wxPD_APP_MODAL | wxPD_SMOOTH | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME | wxPD_REMAINING_TIME ); pprog->SetSize( 400, wxDefaultCoord ); pprog->Centre(); } //Points int ic = 0; wxODPointListNode *node = g_pODPointMan->GetODPointList()->GetFirst(); ODPoint *pr; while( node ) { if(pprog) { wxString msg; msg.Printf(_T("%d/%d"), ic, count); pprog->Update( ic, msg ); ic++; } pr = node->GetData(); bool b_add = true; if( bviz_only && !pr->m_bIsVisible ) b_add = false; if( pr->m_bIsInLayer && !blayer ) b_add = false; if( b_add) { if( pr->m_bKeepXPath || !ODPointIsInPathList( pr ) ) pgpx->AddGPXODPoint( pr); } node = node->GetNext(); } //Paths wxPathListNode *node1 = g_pPathList->GetFirst(); while( node1 ) { ODPath *pPath = node1->GetData(); bool b_add = true; if( bviz_only && !pPath->IsVisible() ) b_add = false; if( pPath->m_bIsInLayer && !blayer ) b_add = false; if( b_add ) { pgpx->AddGPXPath( pPath ); } node1 = node1->GetNext(); } pgpx->SaveFile( fn.GetFullPath() ); delete pgpx; ::wxEndBusyCursor(); if( pprog) delete pprog; } }
void MainForm::OnToolsCreatebumpmap() { CFileDialog fileDialog( true, "*.dds", NULL, 0, "DirectX texture (*.dds)|*.dds|All Files (*.*)|*.*||", this ); // setup browsing from resource directory char currentDir[1024]; GetCurrentDirectory( 1024, currentDir ); std::string initialDir = currentDir; initialDir += "\\res"; fileDialog.m_ofn.lpstrInitialDir = initialDir.c_str(); if( fileDialog.DoModal() == IDOK ) { // back to application current directory SetCurrentDirectory( currentDir ); std::string fileName = fileDialog.GetPathName(); makeEngineCompatiblePath( fileName ); // load texture engine::IEngine* iEngine; queryInterfaceT( "Engine", &iEngine ); engine::ITexture* texture = iEngine->createTexture( fileName.c_str(), false ); assert( texture ); // create DUDV engine::ITexture* dudv = iEngine->createDUDVFromNormalMap( texture, "DUDVTEMP" ); CFileDialog saveDialog( false, "*.dds", NULL, 0, "DirectX texture (*.dds)|*.dds|All Files (*.*)|*.*||", this ); // setup browsing from resource directory GetCurrentDirectory( 1024, currentDir ); std::string initialDir = currentDir; initialDir += "\\res"; saveDialog.m_ofn.lpstrInitialDir = initialDir.c_str(); if( saveDialog.DoModal() == IDOK ) { // back to application current directory SetCurrentDirectory( currentDir ); fileName = saveDialog.GetPathName(); makeEngineCompatiblePath( fileName ); dudv->save( fileName.c_str() ); } dudv->release(); texture->release(); } }