Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Add AUDACITY_FILE_SUFFIX_EVENT to ExportPCM
This signals a change in the file suffix, and it is received by the Exporter.
However, there is currently no way to change the displayed filename in
the file selection dialog.
This was a step towards a fix for Bug 1355 - "Other uncompressed files" does not (visually) update target file extension according to the chosen "Header" type
Loading branch information
Showing
3 changed files
with
34 additions
and
0 deletions .
+21
−0
src/export/Export.cpp
+5
−0
src/export/Export.h
+8
−0
src/export/ExportPCM.cpp
@@ -266,8 +266,12 @@ void ExportPlugin::InitProgress(std::unique_ptr<ProgressDialog> &pDialog,
// Export
// ----------------------------------------------------------------------------
wxDEFINE_EVENT (AUDACITY_FILE_SUFFIX_EVENT, wxCommandEvent);
BEGIN_EVENT_TABLE (Exporter, wxEvtHandler)
EVT_FILECTRL_FILTERCHANGED(wxID_ANY, Exporter::OnFilterChanged)
EVT_COMMAND( wxID_ANY, AUDACITY_FILE_SUFFIX_EVENT, Exporter::OnExtensionChanged)
END_EVENT_TABLE()
Exporter::Exporter()
@@ -305,6 +309,23 @@ Exporter::~Exporter()
{
}
// Beginnings of a fix for bug 1355.
// 'Other Uncompressed Files' Header option updates do not update
// the extension shown in the file dialog.
// Unfortunately, although we get the new extension here, we
// can't do anything with it as the FileDialog does not provide
// methods for setting its standard controls.
// We would need OS specific code that 'knows' about the system
// dialogs.
void Exporter::OnExtensionChanged (wxCommandEvent &Evt) {
wxString ext = Evt.GetString ();
ext = ext.BeforeFirst (' ' ).Lower ();
wxLogDebug (" Extension changed to '.%s'" , ext);
// wxString Name = mDialog->GetFilename();
// Name = Name.BeforeLast('.')+ext;
// mDialog->SetFilename(Name);
}
void Exporter::SetFileDialogTitle ( const wxString & DialogTitle )
{
// The default title is "Export File"
@@ -152,6 +152,10 @@ WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxWindow *, WindowPtrArray, class AUDACITY_DLL
// ----------------------------------------------------------------------------
// Exporter
// ----------------------------------------------------------------------------
// For a file suffix change from the options.
wxDECLARE_EVENT (AUDACITY_FILE_SUFFIX_EVENT, wxCommandEvent);
class AUDACITY_DLL_API Exporter final : public wxEvtHandler
{
public:
@@ -188,6 +192,7 @@ class AUDACITY_DLL_API Exporter final : public wxEvtHandler
int GetAutoExportSubFormat ();
int GetAutoExportFilterIndex ();
wxFileName GetAutoExportFileName ();
void OnExtensionChanged (wxCommandEvent &Evt);
private:
bool ExamineTracks ();
@@ -280,6 +280,14 @@ void ExportPCMOptions::OnHeaderChoice(wxCommandEvent & WXUNUSED(evt))
ValidatePair (GetFormat ());
TransferDataFromWindow ();
// Send the event indicating a file suffix change.
// We pass the entire header string, which starts with the suffix.
wxCommandEvent event (AUDACITY_FILE_SUFFIX_EVENT, GetId ());
event.SetEventObject (this );
event.SetString (mHeaderChoice ->GetString (mHeaderChoice ->GetSelection ()));
ProcessWindowEvent (event);
}
int ExportPCMOptions::GetFormat ()
Toggle all file notes
Toggle all file annotations