Exemplo n.º 1
0
/**
 * OpenDVD
 *
 * Function to load a DVD directory and display to user.
 */
int
OpenDVD ()
{
    int romsdiroffset = 0;
    
    loadtype = LOAD_DVD;
    
    if (!getpvd())
    {
        ShowAction((char*) "Mounting DVD ... Wait");
        DVD_Mount();             /* mount the DVD unit again */
        havedir = 0;             /* this may be a new DVD: content need to be parsed again */
        if (!getpvd())
            return 0; /* no correct ISO9660 DVD */
    }
    
    if (havedir == 0)
    {
        offset = selection = 0; /* reset file selector */
        haveSDdir = 0;  /* prevent conflicts with SDCARD, USB file selector */
		haveUSBdir = 0;
        
        if ((maxfiles = parsedirectory ()))
        {
            if ( romsdiroffset = SNESROMSOffset() )
            {
                rootdir = filelist[romsdiroffset].offset;
                rootdirlength = filelist[romsdiroffset].length;
                offset = selection = 0;
                maxfiles = parsedirectory ();
            }
            
            int ret = FileSelector ();
            havedir = 1;
            return ret;
        }
    }
    
    else
        return FileSelector ();
    
    return 0;
}
Exemplo n.º 2
0
/**
 * OpenSMB
 *
 * Function to load from an SMB share
 */
int
OpenSMB ()
{
    loadtype = LOAD_SMB;
    
    if ((maxfiles = parseSMBDirectory ()))
    {
        char txt[80];
        sprintf(txt,"maxfiles = %d", maxfiles);
        
        return FileSelector ();
    }
    return 0;
}
Exemplo n.º 3
0
void TagsEditor::OnLoad(wxCommandEvent & event)
{
   wxString fn;

   // Ask the user for the real name
   fn = FileSelector(_("Load Metadata As:"),
                     FileNames::DataDir(),
                     wxT("Tags.xml"),
                     wxT("xml"),
                     wxT("*.xml"),
                     wxFD_OPEN | wxRESIZE_BORDER,
                     this);

   // User canceled...
   if (fn.IsEmpty()) {
      return;
   }

   // Remember title and track in case they're read only
   wxString title = mLocal.GetTag(TAG_TITLE);
   wxString track = mLocal.GetTag(TAG_TRACK);

   // Clear current contents
   mLocal.Clear();

   // Load the metadata
   XMLFileReader reader;
   if (!reader.Parse(&mLocal, fn)) {
      // Inform user of load failure
      wxMessageBox(reader.GetErrorStr(),
                   _("Error Loading Metadata"),
                   wxOK | wxCENTRE,
                   this);
   }

   // Restore title
   if (!mEditTitle) {
      mLocal.SetTag(TAG_TITLE, title);
   }

   // Restore track
   if (!mEditTrack) {
      mLocal.SetTag(TAG_TRACK, track);
   }

   // Go fill up the window
   TransferDataToWindow();

   return;
}
Exemplo n.º 4
0
/**
 * OpenSD
 *
 * Function to load from an SD Card
 */
int
OpenSD (int slot)
{
    char msg[80];
	char buf[50] = "";
    
    loadtype = LOAD_SDC;
    
    if (haveSDdir == 0)
    {
        /* don't mess with DVD entries */
        havedir = 0;	// gamecube only
        
        /* get current SDCARD directory */
        sprintf ( currSDdir, getcwd(buf,50) );	// FIX: necessary?
		
        
        /* Parse initial root directory and get entries list */
        if ((maxfiles = parseSDdirectory ()))
        {
            /* Select an entry */
            return FileSelector ();
        }
        else
        {
            /* no entries found */
            sprintf (msg, "SNESROMS not found on SDCARD");		// FIX: update error msg
            WaitPrompt (msg);
            return 0;
        }
    }
    /* Retrieve previous entries list and made a new selection */
    else
        return FileSelector ();
    
    return 0;
}
Exemplo n.º 5
0
void FreqWindow::OnExport(wxCommandEvent & WXUNUSED(event))
{
   wxString fName = _("spectrum.txt");

   fName = FileSelector(_("Export Spectral Data As:"),
                        NULL, fName, wxT("txt"), wxT("*.txt"), wxFD_SAVE | wxRESIZE_BORDER, this);

   if (fName == wxT(""))
      return;

   wxTextFile f(fName);
#ifdef __WXMAC__
   wxFile *temp = new wxFile();
   temp->Create(fName);
   delete temp;
#else
   f.Create();
#endif
   f.Open();
   if (!f.IsOpened()) {
      wxMessageBox(_("Couldn't write to file: ") + fName);
      return;
   }

   if (mAlgChoice->GetSelection() == 0) {
      f.AddLine(_("Frequency (Hz)\tLevel (dB)"));
      for (int i = 1; i < mProcessedSize; i++)
         f.AddLine(wxString::
                   Format(wxT("%f\t%f"), i * mRate / mWindowSize,
                          mProcessed[i]));
   } else {
      f.AddLine(_("Lag (seconds)\tFrequency (Hz)\tLevel"));
      for (int i = 1; i < mProcessedSize; i++)
         f.AddLine(wxString::Format(wxT("%f\t%f\t%f"),
                                    i / mRate, mRate / i, mProcessed[i]));
   }

#ifdef __WXMAC__
   f.Write(wxTextFileType_Mac);
#else
   f.Write();
#endif
   f.Close();
}
Exemplo n.º 6
0
void LabelDialog::OnImport(wxCommandEvent & WXUNUSED(event))
{
   wxString path = gPrefs->Read(wxT("/DefaultOpenPath"),::wxGetCwd());

   // Ask user for a filename
   wxString fileName =
       FileSelector(_("Select a text file containing labels..."),
                    path,     // Path
                    wxT(""),       // Name
                    wxT(".txt"),   // Extension
                    _("Text files (*.txt)|*.txt|All files|*"),
                    wxRESIZE_BORDER, // Flags
                    this);    // Parent

   // They gave us one...
   if (fileName != wxT("")) {
      path =::wxPathOnly(fileName);
      gPrefs->Write(wxT("/DefaultOpenPath"), path);
      gPrefs->Flush();

      wxTextFile f;

      // Get at the data
      f.Open(fileName);
      if (!f.IsOpened()) {
         wxMessageBox(_("Could not open file: ") + fileName);
      }
      else {
         // Create a temporary label track and load the labels
         // into it
         LabelTrack *lt = new LabelTrack(mDirManager);
         lt->Import(f);

         // Add the labesls to our collection
         AddLabels(lt);

         // Done with the temporary track
         delete lt;
     }

      // Repopulate the grid
      TransferDataToWindow();
   }
}
Exemplo n.º 7
0
/****************************************************************************
 * OpenDVD
 *
 * Function to load a DVD directory and display to user.
****************************************************************************/
int
OpenDVD (int method)
{
	if (!getpvd())
	{
		ShowAction((char*) "Loading DVD...");
		#ifdef HW_DOL
		DVD_Mount(); // mount the DVD unit again
		#elif WII_DVD
		u32 val;
		DI_GetCoverRegister(&val);
		if(val & 0x1)	// True if no disc inside, use (val & 0x2) for true if disc inside.
		{
			WaitPrompt((char *)"No disc inserted!");
			return 0;
		}
		DI_Mount();
		while(DI_GetStatus() & DVD_INIT);
		#endif

		if (!getpvd())
		{
			WaitPrompt ((char *)"Invalid DVD.");
			return 0; // not a ISO9660 DVD
		}
	}

	maxfiles = ParseDVDdirectory(); // load root folder

	// switch to rom folder
	SwitchDVDFolder(GCSettings.LoadFolder);

	if (maxfiles > 0)
	{
		return FileSelector (method);
	}
	else
	{
		// no entries found
		WaitPrompt ((char *)"No Files Found!");
		return 0;
	}
}
Exemplo n.º 8
0
void MainFrame::OnBtnFileDstClick(wxCommandEvent& event)
{
  wxString filename = FileSelector();
  if (filename.IsEmpty() || SameConfig(filename, txtFileSrc))
    return;

  if (!LoadConfig(filename, &mCfgDst) || !mCfgDst)
  {
    mCfgDstValid = false;
    return;
  }

  mFileDst = filename;
  txtFileDst->SetValue(filename);
  mCfgDstValid = true;

  // put configuration to wxListBox
  OfferConfig(mCfgDst, lstCfgDst, &mNodesDst);
}// OnBtnFileDstClick
Exemplo n.º 9
0
void MainFrame::OnBtnFileSrcClick(wxCommandEvent& /*event*/)
{
  wxString filename = FileSelector();
  if (filename.IsEmpty() || SameConfig(filename, txtFileDst))
    return;

  if (!LoadConfig(filename, &mCfgSrc) || !mCfgSrc)
  {
    mCfgSrcValid = false;
    return;
  }

  mFileSrc = filename;
  txtFileSrc->SetValue(filename);
  mCfgSrcValid = true;

  // put configuration to wxCheckListBox
  OfferConfig(mCfgSrc, (wxListBox*)clbCfgSrc, &mNodesSrc);
}// OnBtnFileSrcClick
Exemplo n.º 10
0
   void OnBrowse(wxCommandEvent & WXUNUSED(event))
   {
      wxString question;
      /* i18n-hint: It's asking for the location of a file, for
      example, "Where is lame_enc.dll?" - you could translate
      "Where would I find the file '%s'?" instead if you want. */
      question.Printf(_("Where is '%s'?"), mName.c_str());

      wxString path = FileSelector(question,
         mLibPath.GetPath(),
         mLibPath.GetName(),
         wxT(""),
         mType,
         wxFD_OPEN | wxRESIZE_BORDER,
         this);
      if (!path.IsEmpty()) {
         mLibPath = path;
         mPathText->SetValue(path);
      }
   }
Exemplo n.º 11
0
/****************************************************************************
 * OpenSMB
 *
 * Function to load from an SMB share
****************************************************************************/
int
OpenSMB (int method)
{
	// Connect to network share
	if(ConnectShare (NOTSILENT))
	{
		// change current dir to root dir
		sprintf(currentdir, "/%s", GCSettings.LoadFolder);

		maxfiles = ParseSMBdirectory ();
		if (maxfiles > 0)
		{
			return FileSelector (method);
		}
		else
		{
			// no entries found
			WaitPrompt ((char *)"No Files Found!");
			return 0;
		}
	}
	return 0;
}
Exemplo n.º 12
0
void MainFrame::OnBtnFileDstClick(wxCommandEvent& /*event*/)
{
  wxString filename = FileSelector();
  if (filename.IsEmpty() || SameConfig(filename, txtFileSrc))
    return;

  if (!LoadConfig(filename, &mCfgDst) || !mCfgDst)
  {
    wxMessageBox(wxT("Hint: To backup (export) your configuration use the \"Export\" button,\n"
                     "to transfer to an existing (valid Code::Blocks) configuration file,\n"
                     "use the \"Transfer\" button."),
                 wxT("Information"), wxICON_INFORMATION | wxOK);
    mCfgDstValid = false;
    return;
  }

  mFileDst = filename;
  txtFileDst->SetValue(filename);
  mCfgDstValid = true;

  // put configuration to wxListBox
  OfferConfig(mCfgDst, lstCfgDst, &mNodesDst);
}// OnBtnFileDstClick
Exemplo n.º 13
0
void KeyConfigPrefs::OnSave(wxCommandEvent& event)
{
   Apply();

   wxString fName = wxT("Audacity-keys.xml");
   wxString path = gPrefs->Read(wxT("/DefaultExportPath"),
                                ::wxGetCwd());

   fName = FileSelector(_("Export Keyboard Shortcuts As:"),
                        NULL,
                        fName,
                        wxT("xml"),
                        wxT("*.xml"),
                        wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER,
                        this);

   if (!fName)
      return;

   path = wxPathOnly(fName);
   gPrefs->Write(wxT("/DefaultExportPath"), path);

   XMLFileWriter prefFile;
   
   prefFile.Open(fName, wxT("wb"));

   if (!prefFile.IsOpened()) {
      wxMessageBox(_("Couldn't write to file: ") + fName,
                   _("Error saving keyboard shortcuts"),
                   wxOK | wxCENTRE, this);
      return;
   }

   mManager->WriteXML(prefFile);

   prefFile.Close();
}
Exemplo n.º 14
0
void KeyConfigPrefs::OnExport(wxCommandEvent & WXUNUSED(event))
{
   wxString file = wxT("Audacity-keys.xml");
   wxString path = gPrefs->Read(wxT("/DefaultExportPath"),
                                ::wxGetCwd());

   file = FileSelector(_("Export Keyboard Shortcuts As:"),
                       path,
                       file,
                       wxT("xml"),
                       _("XML files (*.xml)|*.xml|All files|*"),
                       wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER,
                       this);

   if (!file) {
      return;
   }

   path = wxPathOnly(file);
   gPrefs->Write(wxT("/DefaultExportPath"), path);
   gPrefs->Flush();

   XMLFileWriter prefFile;

   try
   {
      prefFile.Open(file, wxT("wb"));
      mManager->WriteXML(prefFile);
      prefFile.Close();
   }
   catch (const XMLFileWriterException &)
   {
      wxMessageBox(_("Couldn't write to file: ") + file,
                   _("Error Exporting Keyboard Shortcuts"),
                   wxOK | wxCENTRE, this);
   }
}
Exemplo n.º 15
0
void AudacityLogger::OnSave(wxCommandEvent & WXUNUSED(e))
{
   wxString fName = _("log.txt");

   fName = FileSelector(_("Save log to:"),
                        wxEmptyString,
                        fName,
                        wxT("txt"),
                        wxT("*.txt"),
                        wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER,
                        mFrame);

   if (fName == wxEmptyString) {
      return;
   }

   if (!mText->SaveFile(fName)) {
      wxMessageBox(_("Couldn't save log to file: ") + fName,
                   _("Warning"),
                   wxICON_EXCLAMATION,
                   mFrame);
      return;
   }
}
Exemplo n.º 16
0
/****************************************************************************
 * OpenFAT
 *
 * Function to load from FAT
 ****************************************************************************/
int
OpenFAT (int method)
{
	if(ChangeFATInterface(method, NOTSILENT))
	{
		// change current dir to snes roms directory
		sprintf ( currentdir, "%s/%s", ROOTFATDIR, GCSettings.LoadFolder );

		// Parse initial root directory and get entries list
		maxfiles = ParseFATdirectory (method);
		if (maxfiles > 0)
		{
			// Select an entry
			return FileSelector (method);
		}
		else
		{
			// no entries found
			WaitPrompt ((char *)"No Files Found!");
			return 0;
		}
	}
	return 0;
}
Exemplo n.º 17
0
bool FileSelectorLoad(char *filename, FileType type, const char *title)
{
	return FileSelector(filename, type, title, GTK_FILE_CHOOSER_ACTION_OPEN);
}
Exemplo n.º 18
0
void LabelDialog::OnExport(wxCommandEvent & WXUNUSED(event))
{
   int cnt = mData.size();

   // Silly user (could just disable the button, but that's a hassle ;-))
   if (cnt == 0) {
      wxMessageBox(_("No labels to export."));
      return;
   }

   // Extract the actual name.
   wxString fName = mTrackNames[mTrackNames.GetCount() - 1].AfterFirst(wxT('-')).Mid(1);

   fName = FileSelector(_("Export Labels As:"),
      wxEmptyString,
      fName.c_str(),
      wxT("txt"),
      wxT("*.txt"),
      wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER,
      this);

   if (fName == wxT(""))
      return;

   // Move existing files out of the way.  Otherwise wxTextFile will
   // append to (rather than replace) the current file.

   if (wxFileExists(fName)) {
#ifdef __WXGTK__
      wxString safetyFileName = fName + wxT("~");
#else
      wxString safetyFileName = fName + wxT(".bak");
#endif

      if (wxFileExists(safetyFileName))
         wxRemoveFile(safetyFileName);

      wxRename(fName, safetyFileName);
   }

   wxTextFile f(fName);
#ifdef __WXMAC__
   wxFile{}.Create(fName);
#else
   f.Create();
#endif
   f.Open();
   if (!f.IsOpened()) {
      wxMessageBox(_("Couldn't write to file: ") + fName);
      return;
   }

   // Transfer our collection to a temporary label track
   auto lt = mFactory.NewLabelTrack();
   int i;

   for (i = 0; i < cnt; i++) {
      RowData &rd = mData[i];

      lt->AddLabel(rd.selectedRegion, rd.title);
   }

   // Export them and clean
   lt->Export(f);

#ifdef __WXMAC__
   f.Write(wxTextFileType_Mac);
#else
   f.Write();
#endif
   f.Close();
}
Exemplo n.º 19
0
void LabelDialog::OnExport(wxCommandEvent &event)
{
   int cnt = mData.GetCount();

   // Silly user (could just disable the button, but that's a hassle ;-))
   if (cnt == 0) {
      wxMessageBox(_("No labels to export."));
      return;
   }

   wxString fName;

   fName = FileSelector(_("Export Labels As:"),
                        NULL,
                        _("labels.txt"),
                        wxT("txt"),
                        wxT("*.txt"),
                        wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER,
                        this);

   if (fName == wxT(""))
      return;

   // Move existing files out of the way.  Otherwise wxTextFile will
   // append to (rather than replace) the current file.

   if (wxFileExists(fName)) {
#ifdef __WXGTK__
      wxString safetyFileName = fName + wxT("~");
#else
      wxString safetyFileName = fName + wxT(".bak");
#endif

      if (wxFileExists(safetyFileName))
         wxRemoveFile(safetyFileName);

      wxRename(fName, safetyFileName);
   }

   wxTextFile f(fName);
#ifdef __WXMAC__
   wxFile *temp = new wxFile();
   temp->Create(fName);
   delete temp;
#else
   f.Create();
#endif
   f.Open();
   if (!f.IsOpened()) {
      wxMessageBox(_("Couldn't write to file: ") + fName);
      return;
   }

   // Transfer our collection to a temporary label track
   LabelTrack *lt = new LabelTrack(mDirManager);
   int i;

   for (i = 0; i < cnt; i++) {
      RowData *rd = mData[i];

      lt->AddLabel(rd->stime, rd->etime, rd->title);
   }

   // Export them and clean
   lt->Export(f);
   delete lt;

#ifdef __WXMAC__
   f.Write(wxTextFileType_Mac);
#else
   f.Write();
#endif
   f.Close();
}
Exemplo n.º 20
0
void ContrastDialog::OnExport(wxCommandEvent & WXUNUSED(event))
{
   // TODO: Handle silence checks better (-infinity dB)
   AudacityProject * project = GetActiveProject();
   wxString fName = wxT("contrast.txt");

   fName = FileSelector(_("Export Contrast Result As:"),
                        wxEmptyString,
                        fName,
                        wxT("txt"),
                        wxT("*.txt"),
                        wxFD_SAVE | wxRESIZE_BORDER,
                        this);

   if (fName == wxT(""))
      return;

   wxTextFile f(fName);
#ifdef __WXMAC__
   wxFile{}.Create(fName);
#else
   f.Create();
#endif
   f.Open();
   if (!f.IsOpened()) {
      wxMessageBox(_("Couldn't write to file: ") + fName);
      return;
   }

   f.AddLine(wxT("==================================="));
   f.AddLine(_("WCAG 2.0 Success Criteria 1.4.7 Contrast Results"));
   f.AddLine(wxT(""));
   f.AddLine(wxString::Format(_("Filename = %s."), project->GetFileName().c_str() ));
   f.AddLine(wxT(""));
   f.AddLine(_("Foreground"));
   float t = (float)mForegroundStartT->GetValue();
   int h = (int)(t/3600);  // there must be a standard function for this!
   int m = (int)((t - h*3600)/60);
   float s = t - h*3600.0 - m*60.0;
   f.AddLine(wxString::Format(_("Time started = %2d hour(s), %2d minute(s), %.2f seconds."), h, m, s ));
   t = (float)mForegroundEndT->GetValue();
   h = (int)(t/3600);
   m = (int)((t - h*3600)/60);
   s = t - h*3600.0 - m*60.0;
   f.AddLine(wxString::Format(_("Time ended = %2d hour(s), %2d minute(s), %.2f seconds."), h, m, s ));
   if(mForegroundIsDefined)
      if( fabs(foregrounddB) != std::numeric_limits<float>::infinity() )
         f.AddLine(wxString::Format(_("Average RMS = %.2f dB."), foregrounddB ));
      else
         f.AddLine(wxString::Format(_("Average RMS = zero.") ));
   else
      f.AddLine(wxString::Format(_("Average RMS =  dB.")));
   f.AddLine(wxT(""));
   f.AddLine(_("Background"));
   t = (float)mBackgroundStartT->GetValue();
   h = (int)(t/3600);
   m = (int)((t - h*3600)/60);
   s = t - h*3600.0 - m*60.0;
   f.AddLine(wxString::Format(_("Time started = %2d hour(s), %2d minute(s), %.2f seconds."), h, m, s ));
   t = (float)mBackgroundEndT->GetValue();
   h = (int)(t/3600);
   m = (int)((t - h*3600)/60);
   s = t - h*3600.0 - m*60.0;
   f.AddLine(wxString::Format(_("Time ended = %2d hour(s), %2d minute(s), %.2f seconds."), h, m, s ));
   if(mBackgroundIsDefined)
      if( fabs(backgrounddB) != std::numeric_limits<float>::infinity() )
         f.AddLine(wxString::Format(_("Average RMS = %.2f dB."), backgrounddB ));
      else
         f.AddLine(wxString::Format(_("Average RMS = zero.") ));
   else
      f.AddLine(wxString::Format(_("Average RMS =  dB.")));
   f.AddLine(wxT(""));
   f.AddLine(_("Results"));
   float diffdB = foregrounddB - backgrounddB;
   if( diffdB != diffdB ) //test for NaN, reliant on IEEE implementation
      f.AddLine(wxString::Format(_("Difference is indeterminate.") ));
   else
      if( fabs(diffdB) != std::numeric_limits<float>::infinity() )
         f.AddLine(wxString::Format(_("Difference = %.2f Average RMS dB."), diffdB ));
      else
         f.AddLine(wxString::Format(_("Difference = infinite Average RMS dB.")));
   if( diffdB > 20. )
      f.AddLine(_("Success Criteria 1.4.7 of WCAG 2.0: Pass"));
   else
      f.AddLine(_("Success Criteria 1.4.7 of WCAG 2.0: Fail"));

   f.AddLine(wxT(""));
   f.AddLine(_("Data gathered"));
   wxString sNow;
   wxDateTime now = wxDateTime::Now();
   int year = now.GetYear();
   wxDateTime::Month month = now.GetMonth();
   wxString monthName = now.GetMonthName(month);
   int dom = now.GetDay();
   int hour = now.GetHour();
   int minute = now.GetMinute();
   int second = now.GetSecond();
   sNow = wxString::Format(wxT("%d %s %02d %02dh %02dm %02ds"),
        dom, monthName.c_str(), year, hour, minute, second);
   f.AddLine(sNow);

   f.AddLine(wxT("==================================="));
   f.AddLine(wxT(""));

#ifdef __WXMAC__
   f.Write(wxTextFileType_Mac);
#else
   f.Write();
#endif
   f.Close();
}
Exemplo n.º 21
0
void TagsEditor::OnSave(wxCommandEvent & event)
{
   wxString fn;

   // Refresh tags
   TransferDataFromWindow();

   // Ask the user for the real name
   fn = FileSelector(_("Save Metadata As:"),
                     FileNames::DataDir(),
                     wxT("Tags.xml"),
                     wxT("xml"),
                     wxT("*.xml"),
                     wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER,
                     this);

   // User canceled...
   if (fn.IsEmpty()) {
      return;
   }

   // Create/Open the file
   XMLFileWriter writer;

   try
   {
      writer.Open(fn, wxT("wb"));

      // Remember title and track in case they're read only
      wxString title = mLocal.GetTag(TAG_TITLE);
      wxString track = mLocal.GetTag(TAG_TRACK);

      // Clear title
      if (!mEditTitle) {
         mLocal.SetTag(TAG_TITLE, wxEmptyString);
      }

      // Clear track
      if (!mEditTrack) {
         mLocal.SetTag(TAG_TRACK, wxEmptyString);
      }

      // Write the metadata
      mLocal.WriteXML(writer);

      // Restore title
      if (!mEditTitle) {
         mLocal.SetTag(TAG_TITLE, title);
      }

      // Restore track
      if (!mEditTrack) {
         mLocal.SetTag(TAG_TRACK, track);
      }

      // Close the file
      writer.Close();
   }
   catch (XMLFileWriterException* pException)
   {
      wxMessageBox(wxString::Format(
         _("Couldn't write to file \"%s\": %s"),
         fn.c_str(), pException->GetMessage().c_str()),
         _("Error Saving Tags File"), wxICON_ERROR, this);

      delete pException;
   }
}
Exemplo n.º 22
0
void VSTEffectDialog::OnSave(wxCommandEvent & evt)
{
   int i = mProgram->GetCurrentSelection();
   wxString fn;

   // Ask the user for the real name
   fn = FileSelector(_("Save VST Program As:"),
                     FileNames::DataDir(),
                     mProgram->GetValue() + wxT(".xml"),
                     wxT("xml"),
                     wxT("*.xml"),
                     wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER,
                     this);

   // User canceled...
   if (fn.IsEmpty()) {
      return;
   }

   XMLFileWriter xmlFile;

   // Create/Open the file
   xmlFile.Open(fn, wxT("wb"));

   xmlFile.StartTag(wxT("vstprogrampersistence"));
   xmlFile.WriteAttr(wxT("version"), wxT("1"));

   i = mEffect->callDispatcher(effGetVendorVersion, 0, 0, NULL, 0.0);
   xmlFile.StartTag(wxT("effect"));
   xmlFile.WriteAttr(wxT("name"), mEffect->GetEffectIdentifier());
   xmlFile.WriteAttr(wxT("version"), i);

   xmlFile.StartTag(wxT("program"));
   xmlFile.WriteAttr(wxT("name"), mProgram->GetValue());

   long clen = 0;
   if (mAEffect->flags & effFlagsProgramChunks) {
      void *chunk = NULL;

      clen = mEffect->callDispatcher(effGetChunk, 1, 0, &chunk, 0.0);
      if (clen != 0) {
         xmlFile.StartTag(wxT("chunk"));
         xmlFile.WriteSubTree(b64encode(chunk, clen) + wxT('\n'));
         xmlFile.EndTag(wxT("chunk"));
      }
   }

   if (clen == 0) {
      for (i = 0; i < mAEffect->numParams; i++) {
         xmlFile.StartTag(wxT("param"));

         xmlFile.WriteAttr(wxT("index"), i);
         xmlFile.WriteAttr(wxT("name"),
                           mEffect->GetString(effGetParamName, i));
         xmlFile.WriteAttr(wxT("value"),
                           wxString::Format(wxT("%f"),
                           mEffect->callGetParameter(i)));

         xmlFile.EndTag(wxT("param"));
      }
   }

   xmlFile.EndTag(wxT("program"));

   xmlFile.EndTag(wxT("effect"));

   xmlFile.EndTag(wxT("vstprogrampersistence"));

   // Close the file
   xmlFile.Close();
}
Exemplo n.º 23
0
bool FileSelectorSave(char *filename, FileType type)
{
	return FileSelector(filename, type, "Save...", GTK_FILE_CHOOSER_ACTION_SAVE);
}
Exemplo n.º 24
0
int TAP_Main (void)
{
  AddTime(0, 0);
  BMP_WriteHeader(NULL, 0, 0);
  BootReason();
  BuildWindowBorder();
  BuildWindowInfo();
  BuildWindowLine();
  BuildWindowLineSelected();
  BuildWindowScrollBar();
  BuildWindowTitle();
  busyWait();
  CalcAbsSectorFromFAT(NULL, 0);
  CalcPrepare();
  CalcTopIndex(0, 0);
  Callback(0, NULL, 0, 0, 0, 0);
  CallbackHelper(NULL, NULL, 0, 0, 0, 0);
  CallBIOS(0, 0, 0, 0, 0);
  CallFirmware(0, 0, 0, 0, 0);
  CallTraceEnable(FALSE);
  CallTraceEnter(NULL);
  CallTraceExit(NULL);
  CallTraceInit();
  CaptureScreen(0, 0, 0, NULL, 0, 0);
  ChangeDirRoot();
  CheckSelectable(0, 0);
  combineVfdData(NULL, NULL);
  compact(NULL, 0);
  CompressBlock(NULL, 0, NULL);
  CompressedTFDSize(NULL, 0, NULL);
  CompressTFD(NULL, 0, NULL, 0, 0, NULL);
  CRC16(0, NULL, 0);
  CRC32 (0, NULL, 0);
  Delay(0);
  DialogEvent(NULL, NULL, NULL);
  DialogMsgBoxButtonAdd(NULL, FALSE);
  DialogMsgBoxExit();
  DialogMsgBoxInit(NULL, NULL, NULL, NULL);
  DialogMsgBoxShow();
  DialogMsgBoxShowInfo(0);
  DialogMsgBoxShowOK();
  DialogMsgBoxShowOKCancel(0);
  DialogMsgBoxShowYesNo(0);
  DialogMsgBoxShowYesNoCancel(0);
  DialogMsgBoxTitleSet(NULL, NULL);
  DialogProfileChange(NULL);
  DialogProfileCheck(NULL, NULL, FALSE);
  DialogProfileLoad(NULL);
  DialogProfileLoadDefault();
  DialogProfileLoadMy(NULL, FALSE);
  DialogProfileSave(NULL);
  DialogProfileSaveDefault();
  DialogProfileScrollBehaviourChange(FALSE, FALSE);
  DialogProgressBarExit();
  DialogProgressBarInit(NULL, NULL, 0, 0, NULL, 0, 0);
  DialogProgressBarSet(0, 0);
  DialogProgressBarShow();
  DialogProgressBarTitleSet(NULL);
  DialogWindowChange(NULL, FALSE);
  DialogWindowCursorChange(FALSE);
  DialogWindowCursorSet(0);
  DialogWindowExit();
  DialogWindowHide();
  DialogWindowInfoAddIcon(0, 0, NULL);
  DialogWindowInfoAddS(0, 0, 0, NULL, 0, 0, 0, 0, 0);
  DialogWindowInfoDeleteAll();
  DialogWindowInit(NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, 0, 0, 0);
  DialogWindowItemAdd(NULL, 0, NULL, 0, FALSE, FALSE, 0, NULL);
  DialogWindowItemAddSeparator();
  DialogWindowItemChangeFlags(0, FALSE, FALSE);
  DialogWindowItemChangeIcon(0, 0, NULL);
  DialogWindowItemChangeParameter(0, NULL, 0);
  DialogWindowItemChangeValue(0, NULL, 0);
  DialogWindowItemDelete(0);
  DialogWindowItemDeleteAll();
  DialogWindowRefresh();
  DialogWindowReInit(0, 0, 0, 0, 0, 0);
  DialogWindowScrollDown();
  DialogWindowScrollDownPage();
  DialogWindowScrollUp();
  DialogWindowScrollUpPage();
  DialogWindowShow();
  DialogWindowTabulatorSet(0, 0);
  DialogWindowTitleChange(NULL, NULL, NULL);
  DialogWindowTypeChange(0);
  DrawMsgBoxButtons();
  DrawMsgBoxTitle();
  DrawOSDLine(0, 0, 0, 0, 0, 0);
  DrawProgressBarBar(0, 0);
  DrawProgressBarTitle();
  DrawWindowBorder();
  DrawWindowInfo();
  DrawWindowLine(0);
  DrawWindowLines();
  DrawWindowScrollBar();
  DrawWindowTitle();
  EndMessageWin();
  exitHook();
  ExtractLine(NULL, NULL);
  FileSelector(NULL, NULL, NULL, 0);
  FileSelectorKey(0, 0);
  FindDBTrack();
  FindInstructionSequence(NULL, NULL, 0, 0, 0, 0);
  findSendToVfdDisplay(0, 0);
  FlashAddFavourite(NULL, 0, FALSE);
  FlashDeleteFavourites();
  FlashFindEndOfServiceNameTableAddress();
  FlashFindEndOfServiceTableAddress(0);
  FlashFindServiceAddress(0, 0, 0, 0);
  FlashFindTransponderIndex(0, 0, 0);
  FlashGetBlockStartAddress(0);
  FlashGetChannelNumber(0, 0, 0, 0);
  FlashGetSatelliteByIndex(0);
  FlashGetServiceByIndex(0, FALSE);
  FlashGetServiceByName (NULL, FALSE);
  FlashGetTransponderCByIndex(0);
  FlashGetTransponderSByIndex(0, 0);
  FlashGetTransponderTByIndex(0);
  FlashGetTrueLocalTime(0, 0);
  FlashGetType();
  FlashInitialize(0);
  FlashProgram();
  FlashReindexFavourites(0, 0, 0);
  FlashReindexTimers(0, 0, 0);
  FlashRemoveCASServices(FALSE);
  FlashRemoveServiceByIndex(0, FALSE);
  FlashRemoveServiceByIndexString(NULL, FALSE);
  FlashRemoveServiceByLCN(NULL, FALSE);
  FlashRemoveServiceByName(NULL, FALSE);
  FlashRemoveServiceByPartOfName(NULL, FALSE);
  FlashRemoveServiceByUHF(NULL, FALSE, FALSE);
  FlashServiceAddressToServiceIndex(NULL);
  FlashWrite(NULL, NULL, 0, NULL);
  FlushCache(NULL, 0);
  FreeOSDRegion(0);
  fwHook(0);
  GetAudioTrackPID(0, NULL);
  GetClusterPointer(0);
  GetCurrentEvent(NULL);
  GetEEPROMAddress();
  GetEEPROMPin();
  GetFrameBufferPixel(0, 0);
  GetFrameSize(0, 0);
  GetFWInfo(0, 0, 0, 0, 0, 0, 0, 0);
  GetHeapParameter(NULL, 0);
  GetLine(NULL, 0);
  GetOSDMapAddress();
  GetOSDRegionHeight(0);
  GetOSDRegionWidth(0);
  GetPinStatus();
  GetPIPPosition(NULL, NULL, NULL, NULL);
  getRECSlotAddress();
  GetSysOsdControl(0);
  GetToppyString(0);
  HasEnoughItemMemory();
  HDD_AAM_Disable();
  HDD_AAM_Enable(0);
  HDD_APM_Disable();
  HDD_APM_Enable(0);
  HDD_BigFile_Read(NULL, 0, 0, NULL);
  HDD_BigFile_Size(NULL);
  HDD_BigFile_Write(NULL, 0, 0, NULL);
  HDD_ChangeDir(NULL);
  HDD_DecodeRECHeader(NULL, NULL);
  HDD_EncodeRECHeader(NULL, NULL, 0);
  HDD_FappendOpen(NULL);
  HDD_FappendWrite(NULL, NULL);
  HDD_FindPCR(NULL, 0);
  HDD_FindPMT(NULL, 0, NULL);
  HDD_FreeSize();
  HDD_GetClusterSize();
  HDD_GetFileDir(NULL, 0, NULL);
  HDD_GetFirmwareDirCluster();
  HDD_GetHddID(NULL, NULL, NULL);
  HDD_IdentifyDevice(NULL);
  HDD_isAnyRecording();
  HDD_isCryptedStream(NULL, 0);
  HDD_isRecording(0);
  HDD_LiveFS_GetChainLength(0);
  HDD_LiveFS_GetFAT1Address();
  HDD_LiveFS_GetFAT2Address();
  HDD_LiveFS_GetFirstCluster(0);
  HDD_LiveFS_GetLastCluster(0);
  HDD_LiveFS_GetNextCluster(0);
  HDD_LiveFS_GetPreviousCluster(0);
  HDD_LiveFS_GetRootDirAddress();
  HDD_LiveFS_GetSuperBlockAddress();
  HDD_MakeNewRecName(NULL, 0);
  HDD_Move(NULL, NULL, NULL);
  HDD_ReadClusterDMA(0, NULL);
  HDD_ReadSector(0, 0);
  HDD_ReadSectorDMA(0, 0, NULL);
  HDD_RECSlotGetAddress(0);
  HDD_RECSlotIsPaused(0);
  HDD_RECSlotPause(0, FALSE);
  HDD_RECSlotSetDuration(0, 0);
  HDD_SetCryptFlag(NULL, 0);
  HDD_SetFileDateTime(NULL, 0, 0, 0);
  HDD_SetSkipFlag (NULL, FALSE);
  HDD_SetStandbyTimer(0);
  HDD_Smart_DisableAttributeAutoSave();
  HDD_Smart_DisableOperations();
  HDD_Smart_EnableAttributeAutoSave();
  HDD_Smart_EnableOperations();
  HDD_Smart_ExecuteOfflineImmediate(0);
  HDD_Smart_ReadData(0);
  HDD_Smart_ReadThresholdData(0);
  HDD_Smart_ReturnStatus();
  HDD_Stop();
  HDD_TAP_Callback(0, NULL, 0, 0, 0, 0);
  HDD_TAP_Disable(0, 0);
  HDD_TAP_DisableAll(0);
  HDD_TAP_DisabledEventHandler(0, 0, 0);
  HDD_TAP_GetCurrentDir(NULL);
  HDD_TAP_GetCurrentDirCluster();
  HDD_TAP_GetIDByFileName(NULL);
  HDD_TAP_GetIDByIndex(0);
  HDD_TAP_GetIndexByID(0);
  HDD_TAP_GetInfo(0, NULL);
  HDD_TAP_GetStartParameter();
  HDD_TAP_isAnyRunning();
  HDD_TAP_isBatchMode();
  HDD_TAP_isDisabled(0);
  HDD_TAP_isDisabledAll();
  HDD_TAP_isRunning(0);
  HDD_TAP_SendEvent(0, FALSE, 0, 0, 0);
  HDD_TAP_SetCurrentDirCluster(0);
  HDD_TAP_Start(NULL, FALSE, NULL, NULL);
  HDD_TAP_StartedByTAP();
  HDD_TAP_Terminate(0);
  HDD_TouchFile(NULL);
  HDD_TranslateDirCluster(0, NULL);
  HDD_TruncateFile(NULL, 0);
  HDD_Write(NULL, 0, NULL);
  HDD_WriteClusterDMA(0, NULL);
  HDD_WriteSectorDMA(0, 0, NULL);
  HookEnable(0, 0);
  HookExit();
  HookIsEnabled(0);
  HookMIPS_Clear(0, 0, 0);
  HookMIPS_Set(0, 0, 0);
  HookSet(0, 0);
  IMEM_Alloc(0);
  IMEM_Init(0);
  IMEM_isInitialized();
  IMEM_Compact();
  IMEM_Free(NULL);
  IMEM_GetInfo(NULL, NULL);
  IMEM_Kill();
  InfoTestGrid();
  INICloseFile();
  INIFindStartEnd(NULL, NULL, NULL, 0);
  INIGetARGB(NULL, NULL, NULL, NULL, NULL, 0);
  INIGetHexByte(NULL, 0, 0, 0);
  INIGetHexDWord(NULL, 0, 0, 0);
  INIGetHexWord(NULL, 0, 0, 0);
  INIGetInt(NULL, 0, 0, 0);
  INIGetString(NULL, NULL, NULL, 0);
  INIKillKey(NULL);
  INIOpenFile(NULL);
  INISaveFile(NULL);
  INISetARGB(NULL, 0, 0, 0, 0);
  INISetComment(NULL);
  INISetHexByte(NULL, 0);
  INISetHexDWord(NULL, 0);
  INISetHexWord(NULL, 0);
  INISetInt(NULL, 0);
  INISetString(NULL, NULL);
  initCodeWrapper(0);
  InitTAPAPIFix();
  InitTAPex();
  InteractiveGetStatus();
  InteractiveSetStatus(FALSE);
  intLock();
  intUnlock(0);
  isAnyOSDVisible(0, 0, 0, 0);
  isLegalChar(0, 0);
  isMasterpiece();
  isMPMenu();
  iso639_1(0);
  isOSDRegionAlive(0);
  isValidChannel(NULL);
  LangGetString(0);
  LangLoadStrings(NULL, 0, 0);
  LangUnloadStrings();
  Log(NULL, NULL, FALSE, 0, NULL);
  LowerCase(NULL);
  MakeValidFileName(NULL, 0);
  MHEG_Status();
  MPDisplayClearDisplay();
  MPDisplayClearSegments(0, 0);
  MPDisplayDisplayLongString(NULL);
  MPDisplayDisplayShortString(NULL);
  MPDisplayGetDisplayByte(0);
  MPDisplayGetDisplayMask(0);
  MPDisplayInstallMPDisplayFwHook();
  MPDisplaySetAmFlag(0);
  MPDisplaySetColonFlag(0);
  MPDisplaySetDisplayByte(0, 0);
  MPDisplaySetDisplayMask(0, 0);
  MPDisplaySetDisplayMemory(NULL);
  MPDisplaySetDisplayMode(0);
  MPDisplaySetPmFlag(0);
  MPDisplaySetSegments(0, 0);
  MPDisplayToggleSegments(0, 0);
  MPDisplayUninstallMPDisplayFwHook();
  MPDisplayUpdateDisplay();
  Now(NULL);
  OSDCopy(0, 0, 0, 0, 0, 0, 0);
  OSDLinesForeDirty(FALSE);
  ParseLine(NULL, NULL, 0);
  ProfileDirty();
  ProfileInit();
  ProfileLoad(NULL, FALSE);
  ProfileMayReload();
  ReadEEPROM(0, 0, NULL);
  ReadIICRegister(0, 0, 0, 0, NULL);
  Reboot(0);
  ReceiveSector(0);
  RTrim(NULL);
  SaveBitmap(NULL, 0, 0, NULL);
  SendEvent(0, 0, 0, 0);
  SendEventHelper(NULL, 0, 0, 0);
  SendHDDCommand(0, 0, 0, 0, 0, 0, 0);
  SendToFP(NULL);
  SeparatePathComponents(NULL, NULL, NULL, NULL);
  SetCrashBehaviour(0);
  setSymbol14(0, 0);
  setSymbol17(0, 0);
  ShowMessageWin(NULL, NULL, NULL, 0);
  ShowMessageWindow(NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  Shutdown(0);
  SoundSinus(0, 0, 0);
  StrEndsWith(NULL, NULL);
  stricstr(NULL, NULL);
  SubtitleGetStatus();
  SubtitleSetStatus(FALSE);
  SuppressedAutoStart();
  SwapDWords(0);
  SwapWords(0);
  TAP_Osd_PutFreeColorGd(0, 0, 0, NULL, FALSE, 0);
  TAPCOM_CloseChannel(NULL);
  TAPCOM_Finish(NULL, 0);
  TAPCOM_GetChannel(0, NULL, NULL, NULL, NULL);
  TAPCOM_GetReturnValue(NULL);
  TAPCOM_GetStatus(NULL);
  TAPCOM_LastAlive(NULL);
  TAPCOM_OpenChannel(0, 0, 0, NULL);
  TAPCOM_Reject(NULL);
  TAPCOM_StillAlive(NULL);
  TFDSize(NULL);
  TimeDiff(0, 0);
  TimeFormat(0, 0, 0);
  TunerGet(0);
  TunerSet(0);
  UncompressBlock(NULL, 0, NULL, 0);
  UncompressedFirmwareSize(NULL);
  UncompressedLoaderSize(NULL);
  UncompressedTFDSize(NULL);
  UncompressFirmware(NULL, NULL, NULL);
  UncompressLoader(NULL, NULL, NULL);
  UncompressTFD(NULL, NULL, NULL);
  UpperCase(NULL);
  ValidFileName(NULL, 0);
  WindowDirty();
  WriteIICRegister(0, 0, 0, 0, NULL);
  YUV2RGB(0, 0, 0, NULL, NULL, NULL);
  YUV2RGB2(0, 0, 0, NULL, NULL, NULL);

  return 0;
}