ActionProc(sUIActionNotify_base * anBase) { sUIActionNotify_2params * an = (anBase->s_size>=sizeof(sUIActionNotify_2params))?static_cast<sUIActionNotify_2params*>(anBase):0; if ((anBase->act.id & IMIB_) == IMIB_CFG) return ActionCfgProc(anBase); switch (anBase->act.id) { case IMIA_MAIN_CFG_EXPIMP_ECFG: ACTIONONLY(anBase); DoExport(DTCFG); break; case IMIA_MAIN_CFG_EXPIMP_ECNT: ACTIONONLY(anBase); DoExport(DTCNT); break; case IMIA_MAIN_CFG_EXPIMP_ECNTSEL: { ACTIONONLY(anBase); int c = ICMessage(IMI_LST_SELCOUNT); tAllowIDs allow; for (int i=0; i<c; i++) { int id = ICMessage(IMI_LST_GETSELPOS , i); allow.push_back(id); } DoExport(DTCNT , allow); break;} case IMIA_MAIN_CFG_EXPIMP_IMPORT: ACTIONONLY(anBase); DoImport(); break; } return 0; }
void MainWnd_OnExport(HWND hwnd) { OPENFILENAMEW ofn = {0}; WCHAR szFile[MAX_PATH] = L""; WCHAR szExportTitle[MAX_STRING]; WCHAR szCannotExport[MAX_STRING]; WCHAR szExportFilter[MAX_STRING]; LoadStringW(g_hInstance, IDS_EXPORT, szExportTitle, _countof(szExportTitle)); LoadStringW(g_hInstance, IDS_CANTEXPORT, szCannotExport, _countof(szCannotExport)); LoadStringW(g_hInstance, IDS_OUTFILTER, szExportFilter, _countof(szExportFilter)); MakeFilter(szExportFilter); ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; ofn.hwndOwner = hwnd; ofn.lpstrFilter = szExportFilter; ofn.lpstrFile = szFile; ofn.nMaxFile = _countof(szFile); ofn.lpstrTitle = szExportTitle; ofn.Flags = OFN_DONTADDTORECENT | OFN_ENABLESIZING | OFN_EXPLORER | OFN_HIDEREADONLY | OFN_LONGNAMES | OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT; ofn.lpstrDefExt = L"reg"; if (GetSaveFileNameW(&ofn)) { if (!DoExport(hwnd, szFile)) { MessageBoxW(hwnd, szCannotExport, g_szTitle, MB_ICONERROR); } } }
INT_PTR ExportBirthdaysService(WPARAM, LPARAM) { TCHAR fileName[1024] = { 0 }; OPENFILENAME of = { 0 }; of.lStructSize = sizeof(OPENFILENAME); //of.hInstance = hInstance; TCHAR filter[MAX_PATH]; mir_sntprintf(filter, _T("%s (*") _T(BIRTHDAY_EXTENSION) _T(")%c*") _T(BIRTHDAY_EXTENSION) _T("%c%s (*.*)%c*.*%c"), TranslateT("Birthdays files"), 0, 0, TranslateT("All Files"), 0, 0); of.lpstrFilter = filter; of.lpstrFile = fileName; of.nMaxFile = _countof(fileName); of.lpstrTitle = TranslateT("Please select a file to export birthdays to..."); if (GetSaveFileName(&of)) { TCHAR buffer[2048]; TCHAR *fn = _tcsrchr(fileName, _T('\\')) + 1; if (!_tcschr(fn, _T('.'))) mir_tstrcat(fileName, _T(BIRTHDAY_EXTENSION)); mir_sntprintf(buffer, TranslateT("Exporting birthdays to file: %s"), fileName); ShowPopupMessage(TranslateT("WhenWasIt"), buffer, hExportBirthdays); DoExport(fileName); ShowPopupMessage(TranslateT("WhenWasIt"), TranslateT("Done exporting birthdays"), hExportBirthdays); } return 0; }
//----------------------------------------------------------------------------- // Re-do the command //----------------------------------------------------------------------------- MStatus CVstSmdIOCmd::redoIt() { MStatus retVal; const MArgDatabase &mArgDatabase( m_undo.ArgDatabase() ); if ( mArgDatabase.isFlagSet( kOptHelp ) ) { PrintHelp(); } else if ( mArgDatabase.isFlagSet( kOptExport ) ) { retVal = DoExport( mArgDatabase ); } else if ( mArgDatabase.isFlagSet( kOptImport ) ) { retVal = DoImport( mArgDatabase ); } else { MGlobal::displayError( "None of -help, -export or -import specified... nothing to do" ); retVal = MS::kFailure; } return retVal; }
bool wxRegKey::Export(wxOutputStream& ostr) const { // write out the header if ( !WriteAsciiString(ostr, "REGEDIT4\n\n") ) return false; return DoExport(ostr); }
void CContactPage::OnExport(wxCommandEvent&) { wxFileDialog dlg(this, _("Save CSV File"), wxEmptyString, wxEmptyString, _("CSV Files (*.csv;*.txt)|*.csv;*.txt||"), wxFD_SAVE|wxFD_OVERWRITE_PROMPT); if (dlg.ShowModal() == wxID_OK) { DoExport(dlg.GetPath()); } }
void CExport::PreviewDebug(CApplication* pApplication, int layoutid) { ProgressDlg.Start("Loading debug"); m_bScreensaver = false; application = pApplication; LayoutBlock.allocator = &g_allocator; eventBlock.allocator = &g_allocator; appBlock.allocator = &g_allocator; imageBlock.allocator = &g_allocator; hlslBlock.allocator = &g_allocator; menuBlock.allocator = &g_allocator; CPath path; path.SetToAppDataDirectory("Scirra"); CString OutPath = GetTempExeFile(path.GetFullPath()); CString iniPath; iniPath.Format("%sConstruct.ini", path.GetFullPath()); CIni ini; ini.SetPathName(iniPath); path.SetToCurrentDirectory(); ini.WriteString("Path", "Install", path.GetFullPath()); CString DataEXE; if (application->runtime == CApplication::rt_application) DataEXE.Format("%sData\\App_pd", path.GetFullPath()); else if (application->runtime == CApplication::rt_directx) DataEXE.Format("%sData\\DX9_pd", path.GetFullPath()); if (application->game_information.use_python) DataEXE += "s"; // script enabled DataEXE += ".exe"; // Copy runtime.exe to the target file CopyFile(DataEXE, OutPath, false); // File copied, assume 10% ProgressDlg.SetProgress(10); DoExport(true, OutPath, false, layoutid); // Execute temp ShellExecute(NULL, "open", OutPath, NULL, NULL, SW_SHOW); // Done ProgressDlg.Finish(); }
bool ExportPlugin::Export(AudacityProject *project, int channels, wxString fName, bool selectedOnly, double t0, double t1, MixerSpec *mixerSpec, Tags *metadata) { if (project == NULL) { project = GetActiveProject(); } return DoExport(project, channels, fName, selectedOnly, t0, t1, mixerSpec); }
int CommodityClassMgr::Export(const string &sOutputFile) { FILE *fp = fopen(sOutputFile.c_str(), "w"); if(NULL == fp) { BOSS_ERROR("open %s error %s", sOutputFile.c_str(), strerror(errno)); return -1; } map<u_int32_t, map<u_int32_t, string> > mapClassName; if(m_cDBOptr.GetClassNameMap(mapClassName) != 0) return -1; CommodityClassFullPath cCommodityClassFullPath; int iRet = DoExport(0, 1, cCommodityClassFullPath, mapClassName, fp); fclose(fp); return iRet; }
int CommodityClassMgr::DoExport(u_int32_t uiParentID, u_int32_t uiClassLevel, CommodityClassFullPath cCommodityClassFullPath, map<u_int32_t, map<u_int32_t, string> > &mapClassName, FILE *fp) { assert(fp); if(mapClassName[uiParentID].size() == 0) return 0; for(map<u_int32_t, string>::iterator i = mapClassName[uiParentID].begin(); i != mapClassName[uiParentID].end(); i++) { u_int32_t uiClassID = i->first; string sClassName = i->second; CommodityClassFullPath cCurrentPath = cCommodityClassFullPath; cCurrentPath.m_uiClassLevel = uiClassLevel; switch(uiClassLevel) { case 1: cCurrentPath.m_uiClassIDL1 = uiClassID; break; case 2: cCurrentPath.m_uiClassIDL2 = uiClassID; break; case 3: cCurrentPath.m_uiClassIDL3 = uiClassID; break; case 4: cCurrentPath.m_uiClassIDL4 = uiClassID; break; case 5: cCurrentPath.m_uiClassIDL5 = uiClassID; break; default: BOSS_ERROR("类目级别最多为五级"); return -1; } if('\0' == cCurrentPath.m_sFullClassName[0]) { snprintf(cCurrentPath.m_sFullClassName, sizeof(cCurrentPath.m_sFullClassName), "%s", sClassName.c_str()); } else { strncat(cCurrentPath.m_sFullClassName, ">>", sizeof(cCurrentPath.m_sFullClassName) - strlen(cCurrentPath.m_sFullClassName) - 1); strncat(cCurrentPath.m_sFullClassName, sClassName.c_str(), sizeof(cCurrentPath.m_sFullClassName) - strlen(cCurrentPath.m_sFullClassName) - 1); } if(mapClassName.find(uiClassID) == mapClassName.end()) { cCurrentPath.m_uiLeafID = uiClassID; } fprintf(fp, "%u,%u,%u,%u,%u,%u,%u\n", uiClassID, cCurrentPath.m_uiClassIDL1, cCurrentPath.m_uiClassIDL2, cCurrentPath.m_uiClassIDL3, cCurrentPath.m_uiClassIDL4, cCurrentPath.m_uiClassIDL5, cCurrentPath.m_uiClassLevel); if(DoExport(uiClassID, uiClassLevel + 1, cCurrentPath, mapClassName, fp) != 0) return -1; } return 0; }
void CExport::ExportToEXE(CApplication* pApplication) { application = pApplication; // Prepare allocators LayoutBlock.allocator = &g_allocator; eventBlock.allocator = &g_allocator; appBlock.allocator = &g_allocator; imageBlock.allocator = &g_allocator; hlslBlock.allocator = &g_allocator; menuBlock.allocator = &g_allocator; // Open export wizard CExportWizardDlg Dlg; Dlg.application = pApplication; if (Dlg.DoModal() != IDOK) return; // Transfer settings m_bInstaller = Dlg.m_bInstaller; m_License = Dlg.m_License; m_InstallPath = Dlg.m_InstallPath; m_OS = Dlg.m_OS; m_bScreensaver = Dlg.m_bScreensaver; // Make paths CPath Path; Path.SetToCurrentDirectory(); CString OutPath; // Application if (application->runtime == CApplication::rt_application) OutPath.Format("%sData\\App", Path.GetFullPath()); // Direct-X else if (application->runtime == CApplication::rt_directx) OutPath.Format("%sData\\DX9", Path.GetFullPath()); // Append _s for scripting (python) if (application->game_information.use_python) OutPath += "_s"; // script enabled OutPath += ".exe"; // Copy runtime.exe to the target file CopyFile(OutPath, Dlg.m_OutputPath, false); // File copied, assume 10% progress ProgressDlg.Start("Exporting"); ProgressDlg.SetProgress(10); // Transfer path m_Out = Dlg.m_OutputPath; // Screensaver //if (m_bScreensaver) // Dlg.m_OutputPath.Replace(".exe", ".scr"); DoExport(false, Dlg.m_OutputPath, false); ProgressDlg.Finish(); // Python reminder if (application->game_information.use_python) { MessageBox(NULL, "Your application has scripting enabled and requires Python26.dll to run. This file has been " "copied to the same directory as your EXE - remember to include it when sending or distributing your game!", "Export EXE reminder", MB_ICONINFORMATION | MB_OK); } }
PDFExportDialog::PDFExportDialog( QWidget* parent, const QString & docFileName, const QMap<QString, int > & DocFonts, ScribusView *currView, PDFOptions & pdfOptions, const QList<PDFPresentationData> & Eff, const ProfilesL & PDFXProfiles, const SCFonts &AllFonts, double unitRatio, const ProfilesL & printerProfiles) : QDialog( parent ), doc(currView->Doc), EffVal(Eff), Opts(pdfOptions), docUnitRatio(unitRatio), cmsDescriptorName(""), components(3), appPrinterProfiles(printerProfiles) { setModal(true); setWindowTitle( tr( "Save as PDF" ) ); setWindowIcon(loadIcon("AppIcon.png")); PDFExportLayout = new QVBoxLayout( this ); PDFExportLayout->setSpacing( 5 ); PDFExportLayout->setMargin( 10 ); Name = new QGroupBox( this ); Name->setTitle( tr( "O&utput to File:" ) ); NameLayout = new QGridLayout( Name ); NameLayout->setSpacing( 5 ); NameLayout->setMargin( 10 ); NameLayout->setAlignment( Qt::AlignTop ); fileNameLineEdit = new QLineEdit( Name ); fileNameLineEdit->setMinimumSize( QSize( 268, 22 ) ); if (!Opts.fileName.isEmpty()) fileNameLineEdit->setText( QDir::toNativeSeparators(Opts.fileName) ); else { QFileInfo fi(docFileName); if (fi.exists()) { QString fileName(fi.path()+"/"+fi.baseName()+".pdf"); fileNameLineEdit->setText( QDir::toNativeSeparators(fileName) ); } else { PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs"); QString pdfdir = dirs->get("pdf", fi.path()); if (pdfdir.right(1) != "/") pdfdir += "/"; QString fileName(pdfdir+fi.baseName()+".pdf"); fileNameLineEdit->setText( QDir::toNativeSeparators(fileName) ); } } NameLayout->addWidget( fileNameLineEdit, 0, 0 ); FileC = new QToolButton( Name ); FileC->setText( tr( "Cha&nge..." ) ); FileC->setMinimumSize( QSize( 88, 24 ) ); NameLayout->addWidget( FileC, 0, 1 ); multiFile = new QCheckBox( tr( "Output one file for eac&h page" ), Name ); multiFile->setChecked(Opts.doMultiFile); NameLayout->addWidget( multiFile, 1, 0 ); PDFExportLayout->addWidget( Name ); Options = new TabPDFOptions( this, pdfOptions, AllFonts, PDFXProfiles, DocFonts, Eff, currView->Doc->unitIndex(), currView->Doc->pageHeight, currView->Doc->pageWidth, currView->Doc, true ); PDFExportLayout->addWidget( Options ); Layout7 = new QHBoxLayout; Layout7->setSpacing( 5 ); Layout7->setMargin( 0 ); QSpacerItem* spacer_2 = new QSpacerItem( 2, 2, QSizePolicy::Expanding, QSizePolicy::Minimum ); Layout7->addItem( spacer_2 ); OK = new QPushButton( tr( "&Save" ), this ); OK->setAutoDefault( true ); OK->setDefault( true ); Layout7->addWidget( OK ); Cancel = new QPushButton( CommonStrings::tr_Cancel, this ); Layout7->addWidget( Cancel ); PDFExportLayout->addLayout( Layout7 ); if ((Opts.Version == PDFOptions::PDFVersion_X3) && (Options->InfoString->text().isEmpty())) OK->setEnabled(false); resize(sizeHint()); // setMaximumSize( sizeHint() ); //tooltips multiFile->setToolTip( "<qt>" + tr( "This enables exporting one individually named PDF file for each page in the document. Page numbers are added automatically. This is most useful for imposing PDF for commercial printing.") + "</qt>" ); OK->setToolTip( "<qt>" + tr( "The save button will be disabled if you are trying to export PDF/X-3 and the info string is missing from the PDF/X-3 tab.") + "</qt>" ); // signals and slots connections connect( FileC, SIGNAL( clicked() ), this, SLOT( ChangeFile() ) ); connect( OK, SIGNAL( clicked() ), this, SLOT( DoExport() ) ); connect( Cancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); connect( fileNameLineEdit, SIGNAL( editingFinished() ), this, SLOT( fileNameChanged() ) ); connect( Options, SIGNAL(noInfo()), this, SLOT(disableSave())); connect( Options, SIGNAL(hasInfo()), this, SLOT(enableSave())); }
PDFExportDialog::PDFExportDialog( QWidget* parent, const QString & docFileName, const QMap<QString, int > & DocFonts, ScribusView *currView, PDFOptions & pdfOptions, const ProfilesL & PDFXProfiles, const SCFonts &AllFonts, const ProfilesL & printerProfiles) : QDialog( parent ), m_doc(currView->Doc), m_opts(pdfOptions), m_unitRatio(currView->Doc->unitRatio()), m_cmsDescriptor(""), m_components(3), m_printerProfiles(printerProfiles) { setModal(true); setWindowTitle( tr( "Save as PDF" ) ); setWindowIcon(loadIcon("AppIcon.png")); PDFExportLayout = new QVBoxLayout( this ); PDFExportLayout->setSpacing( 5 ); PDFExportLayout->setMargin( 10 ); Name = new QGroupBox( this ); Name->setTitle( tr( "O&utput to File:" ) ); NameLayout = new QGridLayout( Name ); NameLayout->setSpacing( 5 ); NameLayout->setMargin( 10 ); NameLayout->setAlignment( Qt::AlignTop ); fileNameLineEdit = new QLineEdit( Name ); fileNameLineEdit->setMinimumSize( QSize( 268, 22 ) ); if (!m_opts.fileName.isEmpty()) fileNameLineEdit->setText( QDir::toNativeSeparators(m_opts.fileName) ); else { QFileInfo fi(docFileName); QString completeBaseName = fi.completeBaseName(); if (completeBaseName.endsWith(".sla", Qt::CaseInsensitive)) if (completeBaseName.length() > 4) completeBaseName.chop(4); if (completeBaseName.endsWith(".gz", Qt::CaseInsensitive)) if (completeBaseName.length() > 3) completeBaseName.chop(3); if (fi.exists()) { QString fileName(fi.path() + "/" + completeBaseName + ".pdf"); fileNameLineEdit->setText( QDir::toNativeSeparators(fileName) ); } else { PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs"); QString pdfdir = dirs->get("pdf", fi.path()); if (pdfdir.right(1) != "/") pdfdir += "/"; QString fileName(pdfdir + completeBaseName + ".pdf"); fileNameLineEdit->setText( QDir::toNativeSeparators(fileName) ); } } NameLayout->addWidget( fileNameLineEdit, 0, 0 ); changeButton = new QPushButton( Name ); changeButton->setText( tr( "Cha&nge..." ) ); changeButton->setMinimumSize( QSize( 88, 24 ) ); NameLayout->addWidget( changeButton, 0, 1 ); multiFile = new QCheckBox( tr( "Output one file for eac&h page" ), Name ); multiFile->setChecked(m_opts.doMultiFile); NameLayout->addWidget( multiFile, 1, 0 ); openAfterExportCheckBox = new QCheckBox( tr( "Open PDF after Export" ), Name ); openAfterExportCheckBox->setChecked(m_opts.openAfterExport); NameLayout->addWidget( openAfterExportCheckBox, 2, 0 ); PDFExportLayout->addWidget( Name ); Options = new TabPDFOptions( this, pdfOptions, AllFonts, PDFXProfiles, DocFonts, currView->Doc->unitIndex(), currView->Doc->pageHeight(), currView->Doc->pageWidth(), currView->Doc, true ); PDFExportLayout->addWidget( Options ); Layout7 = new QHBoxLayout; Layout7->setSpacing( 5 ); Layout7->setMargin( 0 ); QSpacerItem* spacer_2 = new QSpacerItem( 2, 2, QSizePolicy::Expanding, QSizePolicy::Minimum ); Layout7->addItem( spacer_2 ); okButton = new QPushButton( tr( "&Save" ), this ); okButton->setAutoDefault( true ); okButton->setDefault( true ); Layout7->addWidget( okButton ); cancelButton = new QPushButton( CommonStrings::tr_Cancel, this ); Layout7->addWidget( cancelButton ); PDFExportLayout->addLayout( Layout7 ); if ((m_opts.Version == PDFOptions::PDFVersion_X3) && (Options->InfoString->text().isEmpty())) okButton->setEnabled(false); resize(sizeHint()); // setMaximumSize( sizeHint() ); //tooltips multiFile->setToolTip( "<qt>" + tr( "This enables exporting one individually named PDF file for each page in the document. Page numbers are added automatically. This is most useful for imposing PDF for commercial printing.") + "</qt>" ); openAfterExportCheckBox->setToolTip( "<qt>" + tr( "Open the exported PDF with the PDF viewer as set in External Tools preferences, when not exporting to a multi-file export destination.") + "</qt>" ); okButton->setToolTip( "<qt>" + tr( "The save button will be disabled if you are trying to export PDF/X and the info string is missing from the PDF/X tab.") + "</qt>" ); // signals and slots connections connect( changeButton, SIGNAL( clicked() ), this, SLOT( ChangeFile() ) ); connect( okButton, SIGNAL( clicked() ), this, SLOT( DoExport() ) ); connect( cancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) ); connect( fileNameLineEdit, SIGNAL( editingFinished() ), this, SLOT( fileNameChanged() ) ); connect( Options, SIGNAL(noInfo()), this, SLOT(disableSave())); connect( Options, SIGNAL(hasInfo()), this, SLOT(enableSave())); }
static bool Run(const wxCmdLineParser& parser) { // Read the various global flags s_bDoProgress = parser.Found(_T("g")); s_bDoVerbose = parser.Found(_T("v")); s_bDoCompress = parser.Found(_T("z")); bool bPrepareExport = parser.Found(_T("p")); bool bExport = parser.Found(_T("e")); bool bCanImport = parser.Found(_T("c")); bool bImport = parser.Found(_T("i")); bool bOnlyOneError = false; bool bRetVal = true; // There is almost certainly a much nicer way of doing this // When I find it or get around to deriving my own wxCmdLineParser // then I'll change it if (bPrepareExport) { if (bExport || bCanImport || bImport) { bOnlyOneError = true; } else { bRetVal = DoPrepareExport(parser); } } else if (bExport) { if (bCanImport || bImport) { bOnlyOneError = true; } else { bRetVal = DoExport(parser); } } else if (bCanImport) { if (bImport) { bOnlyOneError = true; } else { bRetVal = DoCanImport(parser); } } else if (bImport) { bRetVal = DoImport(parser); } else { bOnlyOneError = true; } if (bOnlyOneError) { ReportError(_T("Exactly one of -p, -e, -c or -i must be specified")); bRetVal = false; } return bRetVal; }
bool ExportMultiple::ExportMultipleByTrack(bool byName, wxString prefix) { Track *tr, *tr2; double t0, t1; bool stereo; bool ok = true; int i=0; wxString name; wxArrayString otherNames; wxArrayPtrVoid selected; // Remember which tracks were selected and set to unselected for (tr = mIterator.First(mTracks); tr != NULL; tr = mIterator.Next()) { if (tr->GetKind() != Track::Wave) { continue; } if (tr->GetSelected()) { selected.Add(tr); tr->SetSelected(false); } } // Examine all tracks for (tr = mIterator.First(mTracks); tr != NULL; tr = mIterator.Next()) { // Only want wave tracks if (tr->GetKind() != Track::Wave) { continue; } // Get the times for the track t0 = tr->GetStartTime(); t1 = tr->GetEndTime(); // Select the track tr->SetSelected(true); // Check for a linked track tr2 = NULL; if (tr->GetLinked()) { tr2 = mIterator.Next(); if (tr2) { // Select it also tr2->SetSelected(true); // Make sure it gets included if (tr2->GetStartTime() < t0) { t0 = tr2->GetStartTime(); } if (tr2->GetEndTime() > t1) { t1 = tr2->GetEndTime(); } } } // Stereo or mono stereo = !(tr2 == NULL && tr->GetChannel() == WaveTrack::MonoChannel && ((WaveTrack *)tr)->GetPan() == 0.0); // Get name base if (byName) { name = tr->GetName(); } else { name.Printf(wxT("%s-%d"), prefix.c_str(), i+1); } // Make sure it's unique MakeNameUnique(otherNames, name); // Go export it ok = DoExport(stereo, name, true, t0, t1, i+1); // Reset selection state tr->SetSelected(false); if (tr2) { tr2->SetSelected(false); } // Stop if an error occurred if (!ok) { break; } i++; } // Restore the selection states for (size_t i = 0; i < mSelected.GetCount(); i++) { ((Track *) selected[i])->SetSelected(true); } // Give 'em the result ::wxMessageBox(wxString::Format(ok ? _("Successfully exported %d file(s).") : _("Something went wrong after exporting %d file(s)."), i), _("Export Multiple"), wxOK | wxCENTRE, this); return ok; }
bool ExportMultiple::ExportMultipleByTrack(bool byName, wxString prefix) { wxASSERT(mProject); bool tagsPrompt = mProject->GetShowId3Dialog(); Track *tr, *tr2; int channels = 0; // how many channels export? int l = 0; // track counter bool ok = true; wxArrayString otherNames; wxArrayPtrVoid selected; /**< Array of pointers to the tracks which were selected when we started */ ExportKitArray exportSettings; // dynamic array we will use to store the // settings needed to do the exports with in exportSettings.Alloc(mNumLabels); // allocated some guessed space to use ExportKit setting; // the current batch of settings setting.destfile.SetPath(mDir->GetValue()); setting.destfile.SetExt(mPlugins[mFormatIndex]->GetExtension()); wxString name; // used to hold file name whilst we mess with it wxString title; // un-messed-with title of file for tagging with /* Remember which tracks were selected, and set them to unselected */ for (tr = mIterator.First(mTracks); tr != NULL; tr = mIterator.Next()) { if (tr->GetKind() != Track::Wave) { continue; } if (tr->GetSelected()) { selected.Add(tr); tr->SetSelected(false); } } /* Examine all tracks in turn, collecting export information */ for (tr = mIterator.First(mTracks); tr != NULL; tr = mIterator.Next()) { // Only want wave tracks if (tr->GetKind() != Track::Wave) { continue; } // Get the times for the track setting.t0 = tr->GetStartTime(); setting.t1 = tr->GetEndTime(); // Check for a linked track tr2 = NULL; if (tr->GetLinked()) { tr2 = mIterator.Next(); if (tr2) { // Make sure it gets included if (tr2->GetStartTime() < setting.t0) { setting.t0 = tr2->GetStartTime(); } if (tr2->GetEndTime() > setting.t1) { setting.t1 = tr2->GetEndTime(); } } } // number of export channels? if (tr2 == NULL && tr->GetChannel() == WaveTrack::MonoChannel && ((WaveTrack *)tr)->GetPan() == 0.0) channels = 1; else channels = 2; // Get name and title title = tr->GetName(); if (byName) { name = title; } else { name = (wxString::Format(wxT("%s-%d"), prefix.c_str(), l+1)); } // store sanitised and user checked name in object setting.destfile.SetName(MakeFileName(name)); if (setting.destfile.GetName().IsEmpty()) { // user cancelled dialogue, or deleted everything in feild. // either way, cancel return false; } wxASSERT(setting.destfile.IsOk()); // scream if file name is broke // Make sure the (final) file name is unique within the set of exports FileNames::MakeNameUnique(otherNames, setting.destfile); /* do the metadata for this file */ // copy project metadata to start with setting.filetags = *(mProject->GetTags()); // over-ride with values setting.filetags.SetTag(TAG_TITLE, title); setting.filetags.SetTag(TAG_TRACK, l+1); // let the user have a crack at editing it, exit if cancelled if (!setting.filetags.ShowEditDialog(mProject,_("Edit metadata"), tagsPrompt)) return false; /* add the settings to the array of settings to be used for export */ exportSettings.Add(setting); l++; // next label, count up one } // end of user-interactive data gathering loop, start of export processing // loop int count = 0; // count the number of sucessful runs ExportKit activeSetting; // pointer to the settings in use for this export for (tr = mIterator.First(mTracks); tr != NULL; tr = mIterator.Next()) { // Only want wave tracks if (tr->GetKind() != Track::Wave) { continue; } /* Select the track */ tr->SetSelected(true); // Check for a linked track tr2 = NULL; if (tr->GetLinked()) { tr2 = mIterator.Next(); if (tr2) { // Select it also tr2->SetSelected(true); } } /* get the settings to use for the export from the array */ activeSetting = exportSettings[count]; // export data ok = DoExport(channels, activeSetting.destfile, true, activeSetting.t0, activeSetting.t1, activeSetting.filetags); // Reset selection state tr->SetSelected(false); if (tr2) { tr2->SetSelected(false); } // Stop if an error occurred if (!ok) { break; } // increment export counter count++; } // Restore the selection states for (size_t i = 0; i < mSelected.GetCount(); i++) { ((Track *) selected[i])->SetSelected(true); } // Give 'em the result ::wxMessageBox(wxString::Format(ok ? _("Successfully exported %d file(s).") : _("Something went wrong after exporting %d file(s)."), count), _("Export Multiple"), wxOK | wxCENTRE, this); return ok; }
bool ExportMultiple::ExportMultipleByLabel(bool byName, wxString prefix) { wxASSERT(mProject); bool tagsPrompt = mProject->GetShowId3Dialog(); int numFiles = mNumLabels; int l = 0; // counter for files done ExportKitArray exportSettings; // dynamic array we will use to store the // settings needed to do the exports with in exportSettings.Alloc(numFiles); // allocated some guessed space to use // Account for exporting before first label if (mFirst->GetValue()) { l--; numFiles++; } // Figure out how many channels we should export int channels = (mTracks->GetNumExportChannels(false)); wxArrayString otherNames; // keep track of file names we will use, so we // don't duplicate them ExportKit setting; // the current batch of settings setting.destfile.SetPath(mDir->GetValue()); setting.destfile.SetExt(mPlugins[mFormatIndex]->GetExtension()); wxString name; // used to hold file name whilst we mess with it wxString title; // un-messed-with title of file for tagging with const LabelStruct *info = NULL; /* Examine all labels a first time, sort out all data but don't do any * exporting yet (so this run is quick but interactive) */ while (l < mNumLabels) { // Get file name and starting time if (l < 0) { // create wxFileName for output file name = (mFirstFileName->GetValue()); setting.t0 = 0.0; } else { info = mLabels->GetLabel(l); name = (info->title); setting.t0 = info->t; } // Figure out the ending time if (info && info->t < info->t1) { setting.t1 = info->t1; } else if (l < mNumLabels-1) { const LabelStruct *info1 = mLabels->GetLabel(l+1); setting.t1 = info1->t; } else { setting.t1 = mTracks->GetEndTime(); } // store title of label to use in tags title = name; // Numbering files... if (!byName) { name.Printf(wxT("%s-%d"), prefix.c_str(), l+1); } // store sanitised and user checjed name in object setting.destfile.SetName(MakeFileName(name)); if (setting.destfile.GetName().IsEmpty()) { // user cancelled dialogue, or deleted everything in feild. // either way, cancel return false; } wxASSERT(setting.destfile.IsOk()); // scream if file name is broke // Make sure the (final) file name is unique within the set of exports FileNames::MakeNameUnique(otherNames, setting.destfile); /* do the metadata for this file */ // copy project metadata to start with setting.filetags = *(mProject->GetTags()); // over-ride with values setting.filetags.SetTag(TAG_TITLE, title); setting.filetags.SetTag(TAG_TRACK, l+1); // let the user have a crack at editing it, exit if cancelled if (!setting.filetags.ShowEditDialog(mProject,_("Edit metadata"), tagsPrompt)) return false; /* add the settings to the array of settings to be used for export */ exportSettings.Add(setting); l++; // next label, count up one } bool ok = true; // did it work? int count = 0; // count the number of sucessful runs ExportKit activeSetting; // pointer to the settings in use for this export /* Go round again and do the exporting (so this run is slow but * non-interactive) */ for(count = 0; count < (numFiles); count++) { /* get the settings to use for the export from the array */ activeSetting = exportSettings[count]; // Export it ok = DoExport(channels, activeSetting.destfile, false, activeSetting.t0, activeSetting.t1, activeSetting.filetags); if (!ok) { break; } } // Give 'em the result ::wxMessageBox(wxString::Format(ok ? _("Successfully exported %d file(s).") : _("Something went wrong after exporting %d file(s)."), count), _("Export Multiple"), wxOK | wxCENTRE, this); return ok; }
int32 UInternationalizationExportCommandlet::Main( const FString& Params ) { TArray<FString> Tokens; TArray<FString> Switches; TMap<FString, FString> ParamVals; UCommandlet::ParseCommandLine(*Params, Tokens, Switches, ParamVals); const FString* ParamVal = ParamVals.Find(FString(TEXT("Config"))); if ( ParamVal ) { ConfigPath = *ParamVal; } else { UE_LOG(LogInternationalizationExportCommandlet, Error, TEXT("No config specified.")); return -1; } //Set config section ParamVal = ParamVals.Find(FString(TEXT("Section"))); if ( ParamVal ) { SectionName = *ParamVal; } else { UE_LOG(LogInternationalizationExportCommandlet, Error, TEXT("No config section specified.")); return -1; } FString SourcePath; // Source path to the root folder that manifest/archive files live in. if( !GetPathFromConfig( *SectionName, TEXT("SourcePath"), SourcePath, ConfigPath ) ) { UE_LOG( LogInternationalizationExportCommandlet, Error, TEXT("No source path specified.") ); return -1; } FString DestinationPath; // Destination path that we will write files to. if( !GetPathFromConfig( *SectionName, TEXT("DestinationPath"), DestinationPath, ConfigPath ) ) { UE_LOG( LogInternationalizationExportCommandlet, Error, TEXT("No destination path specified.") ); return -1; } FString Filename; // Name of the file to read or write from if (!GetStringFromConfig(*SectionName, TEXT("PortableObjectName"), Filename, ConfigPath)) { UE_LOG(LogInternationalizationExportCommandlet, Error, TEXT("No portable object name specified.")); return -1; } // Get cultures to generate. if( GetStringArrayFromConfig(*SectionName, TEXT("CulturesToGenerate"), CulturesToGenerate, ConfigPath) == 0 ) { UE_LOG(LogInternationalizationExportCommandlet, Error, TEXT("No cultures specified for generation.")); return -1; } bool bDoExport = false; bool bDoImport = false; ShouldPersistComments = false; GetBoolFromConfig( *SectionName, TEXT("bImportLoc"), bDoImport, ConfigPath ); GetBoolFromConfig( *SectionName, TEXT("bExportLoc"), bDoExport, ConfigPath ); GetBoolFromConfig(*SectionName, TEXT("ShouldPersistComments"), ShouldPersistComments, ConfigPath); // Reject the ShouldPersistComments flag and warn if not exporting - we're not writing to anything, so we can't persist. if (ShouldPersistComments && !bDoExport) { UE_LOG(LogInternationalizationExportCommandlet, Warning, TEXT("ShouldPersistComments is true, but bExportLoc is false - can't persist comments if not writing PO files.")); ShouldPersistComments = false; } if( !bDoImport && !bDoExport ) { UE_LOG(LogInternationalizationExportCommandlet, Error, TEXT("Import/Export operation not detected. Use bExportLoc or bImportLoc in config section.")); return -1; } if( bDoImport ) { if (!DoImport(SourcePath, DestinationPath, Filename)) { UE_LOG(LogInternationalizationExportCommandlet, Error, TEXT("Failed to import localization files.")); return -1; } } if( bDoExport ) { if (!DoExport(SourcePath, DestinationPath, Filename)) { UE_LOG(LogInternationalizationExportCommandlet, Error, TEXT("Failed to export localization files.")); return -1; } } return 0; }
bool ExportMultiple::ExportMultipleByLabel(bool byName, wxString prefix) { Track *tr; int numFiles = mNumLabels; int l = 0; int numLeft = 0; int numRight = 0; int numMono = 0; // Account for exporting before first label if (mFirst->GetValue()) { l--; numFiles++; } // Figure out if we're exporting stereo or mono for (tr = mIterator.First(mTracks); tr != NULL; tr = mIterator.Next()) { // Only want wave tracks if (!tr->GetKind() == Track::Wave) { continue; } // Found a left channel if (tr->GetChannel() == Track::LeftChannel) { numLeft++; } // Found a right channel else if (tr->GetChannel() == Track::RightChannel) { numRight++; } // Found a mono channel, but it may be panned else if (tr->GetChannel() == Track::MonoChannel) { float pan = ((WaveTrack*)tr)->GetPan(); // Figure out what kind of channel it should be if (pan == -1.0) { numLeft++; } else if (pan == 1.0) { numRight++; } else if (pan == 0) { numMono++; } else { numLeft++; numRight++; } } } // We we have a stereo or mono mix? bool stereo = false; if (numRight > 0 || numLeft > 0) { stereo = true; } wxArrayString otherNames; wxString name; double t0, t1; int count = 0; bool ok = true; // Examine all labels while (l < mNumLabels) { const LabelStruct *info = NULL; // Get file name and starting time if (l < 0) { name = mFirstFileName->GetValue(); t0 = 0.0; } else { info = mLabels->GetLabel(l); name = info->title; t0 = info->t; } // Figure out the ending time if (info && info->t < info->t1) { t1 = info->t1; } else if (l < mNumLabels-1) { const LabelStruct *info1 = mLabels->GetLabel(l+1); t1 = info1->t; } else { t1 = mTracks->GetEndTime(); } // Numbering files... if (!byName) { name.Printf(wxT("%s-%d"), prefix.c_str(), count+1); } // Make sure the file name is unique within the directory MakeNameUnique(otherNames, name); // Export it ok = DoExport(stereo, name, false, t0, t1, count+1); if (!ok) { break; } count++; l++; } // Give 'em the result ::wxMessageBox(wxString::Format(ok ? _("Successfully exported %d file(s).") : _("Something went wrong after exporting %d file(s)."), count), _("Export Multiple"), wxOK | wxCENTRE, this); return ok; }
// ----------------------------------------------------------------------------------- // Implementation of the assimp extract utility int Assimp_Extract (const char* const* params, unsigned int num) { const char* const invalid = "assimp extract: Invalid number of arguments. See \'assimp extract --help\'\n"; if (num < 1) { printf(invalid); return 1; } // --help if (!strcmp( params[0], "-h") || !strcmp( params[0], "--help") || !strcmp( params[0], "-?") ) { printf("%s",AICMD_MSG_DUMP_HELP_E); return 0; } // asssimp extract in out [options] if (num < 1) { printf(invalid); return 1; } std::string in = std::string(params[0]); std::string out = (num > 1 ? std::string(params[1]) : "-"); // get import flags ImportData import; ProcessStandardArguments(import,params+1,num-1); bool nosuffix = false; unsigned int texIdx = 0xffffffff, flags = 0; // process other flags std::string extension = "bmp"; for (unsigned int i = (out[0] == '-' ? 1 : 2); i < num;++i) { if (!params[i]) { continue; } if (!strncmp( params[i], "-f",2)) { extension = std::string(params[i]+2); } else if ( !strncmp( params[i], "--format=",9)) { extension = std::string(params[i]+9); } else if ( !strcmp( params[i], "--nosuffix") || !strcmp(params[i],"-s")) { nosuffix = true; } else if ( !strncmp( params[i], "--texture=",10)) { texIdx = Assimp::strtoul10(params[i]+10); } else if ( !strncmp( params[i], "-t",2)) { texIdx = Assimp::strtoul10(params[i]+2); } else if ( !strcmp( params[i], "-ba") || !strcmp( params[i], "--bmp-with-alpha")) { flags |= AI_EXTRACT_WRITE_BMP_ALPHA; } #if 0 else { printf("Unknown parameter: %s\n",params[i]); return 10; } #endif } std::transform(extension.begin(),extension.end(),extension.begin(),::tolower); if (out[0] == '-') { // take file name from input file std::string::size_type s = in.find_last_of('.'); if (s == std::string::npos) s = in.length(); out = in.substr(0,s); } // take file extension from file name, if given std::string::size_type s = out.find_last_of('.'); if (s != std::string::npos) { extension = out.substr(s+1,in.length()-(s+1)); out = out.substr(0,s); } // import the main model const aiScene* scene = ImportModel(import,in); if (!scene) { printf("assimp extract: Unable to load input file %s\n",in.c_str()); return 5; } // get the texture(s) to be exported if (texIdx != 0xffffffff) { // check whether the requested texture is existing if (texIdx >= scene->mNumTextures) { ::printf("assimp extract: Texture %i requested, but there are just %i textures\n", texIdx, scene->mNumTextures); return 6; } } else { ::printf("assimp extract: Exporting %i textures\n",scene->mNumTextures); } // now write all output textures for (unsigned int i = 0; i < scene->mNumTextures;++i) { if (texIdx != 0xffffffff && texIdx != i) { continue; } const aiTexture* tex = scene->mTextures[i]; std::string out_cpy = out, out_ext = extension; // append suffix if necessary - always if all textures are exported if (!nosuffix || (texIdx == 0xffffffff)) { out_cpy.append ("_img"); char tmp[10]; Assimp::ASSIMP_itoa10(tmp,i); out_cpy.append(std::string(tmp)); } // if the texture is a compressed one, we'll export // it to its native file format if (!tex->mHeight) { printf("assimp extract: Texture %i is compressed (%s). Writing native file format.\n", i,tex->achFormatHint); // modify file extension out_ext = std::string(tex->achFormatHint); } out_cpy.append("."+out_ext); // open output file FILE* p = ::fopen(out_cpy.c_str(),"wb"); if (!p) { printf("assimp extract: Unable to open output file %s\n",out_cpy.c_str()); return 7; } int m; if (!tex->mHeight) { m = (1 != fwrite(tex->pcData,tex->mWidth,1,p)); } else m = DoExport(tex,p,extension,flags); ::fclose(p); printf("assimp extract: Wrote texture %i to %s\n",i, out_cpy.c_str()); if (texIdx != 0xffffffff) return m; } return 0; }
void cAppliTiepRed::DoReduceBox() { DoLoadTiePoints(); DoFilterCamAnLinks(); // == OK // merge topological tie point // Create an empty merging struct mMergeStruct = new tMergeStr(mVecCam.size(),true); // for each link do the mergin for (std::list<cLnk2ImTiepRed *>::const_iterator itL=mLnk2Im.begin() ; itL!=mLnk2Im.end() ; itL++) { (*itL)->Add2Merge(mMergeStruct); } mMergeStruct->DoExport(); // "Compile" to make the point usable mLMerge = & mMergeStruct->ListMerged(); // Get the merged multiple points std::vector<int> aVHist(mVecCam.size()+1,0); // Compute the average double aSzTileAver = sqrt(mBoxLoc.surf()/mLMerge->size()); // Quod tree for spatial indexation mQT = new tTiePRed_QT ( mPMul2Gr, mBoxLoc, 5 /* 5 obj max box */, 2*aSzTileAver); // Heap for priority management // OK // give ground coord to multiple point and put them in quod-tree and heap { std::vector<double> aVPrec; mVPM.reserve(mLMerge->size()); for (std::list<tMerge *>::const_iterator itM=mLMerge->begin() ; itM!=mLMerge->end() ; itM++) { cPMulTiepRed * aPM = new cPMulTiepRed(*itM,*this); if (mBoxLoc.inside(aPM->Pt())) { mVPM.push_back(aPM); aVPrec.push_back(aPM->Prec()); ELISE_ASSERT((*itM)->NbSom()<int(aVHist.size()),"JJJJJJJJJJJJJJJJJJJJ"); aVHist[(*itM)->NbSom()] ++; mQT->insert(aPM); } else { delete aPM; } } if (aVPrec.size() ==0) { return; } mStdPrec = MedianeSup(aVPrec); mHeap = new tTiePRed_Heap(mPMulCmp); // The gain can be computed once we know the standard precision for (int aKP=0 ; aKP<int(mVPM.size()) ; aKP++) { mVPM[aKP]->InitGain(*this); mHeap->push(mVPM[aKP]); } } int aNbInit = mHeap->nb(); // PAs OK tPMulTiepRedPtr aPMPtr; while (mHeap->pop(aPMPtr)) { mListSel.push_back(aPMPtr); aPMPtr->Remove(); aPMPtr->SetSelected(); std::set<tPMulTiepRedPtr> aSetNeigh; // = *(new std::set<tPMulTiepRedPtr>); double aDist= mDistPMul * mResol; mQT->RVoisins(aSetNeigh,aPMPtr->Pt(),aDist); for (std::set<tPMulTiepRedPtr>::const_iterator itS=aSetNeigh.begin() ; itS!=aSetNeigh.end() ; itS++) { // tPMulTiepRedPtr aNeigh = aSetNeigh[aK]; tPMulTiepRedPtr aNeigh = *itS; if (! aNeigh->Removed()) { aNeigh->UpdateNewSel(aPMPtr,*this); if (aNeigh->Removable()) { aNeigh->Remove(); mQT->remove(aNeigh); mHeap->Sortir(aNeigh); } } } /* std::cout << " GAIN " << aPMPtr->Gain() << " " << aPMPtr->Merge()->NbArc() << " " << aPMPtr->Merge()->NbSom() << " " << aSetNeigh.size() << " " << mHeap->nb() << "\n"; */ } VonGruber(); // PAOK std::cout << "NBPTS " << aNbInit << " => " << mListSel.size() << "\n"; DoExport(); }