mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-25 08:38:39 +02:00
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
This commit is contained in:
parent
7a56858f38
commit
cf442759b4
@ -266,8 +266,12 @@ void ExportPlugin::InitProgress(std::unique_ptr<ProgressDialog> &pDialog,
|
|||||||
// Export
|
// Export
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
wxDEFINE_EVENT(AUDACITY_FILE_SUFFIX_EVENT, wxCommandEvent);
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(Exporter, wxEvtHandler)
|
BEGIN_EVENT_TABLE(Exporter, wxEvtHandler)
|
||||||
EVT_FILECTRL_FILTERCHANGED(wxID_ANY, Exporter::OnFilterChanged)
|
EVT_FILECTRL_FILTERCHANGED(wxID_ANY, Exporter::OnFilterChanged)
|
||||||
|
EVT_COMMAND( wxID_ANY, AUDACITY_FILE_SUFFIX_EVENT, Exporter::OnExtensionChanged)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
Exporter::Exporter()
|
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 )
|
void Exporter::SetFileDialogTitle( const wxString & DialogTitle )
|
||||||
{
|
{
|
||||||
// The default title is "Export File"
|
// The default title is "Export File"
|
||||||
|
@ -152,6 +152,10 @@ WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxWindow *, WindowPtrArray, class AUDACITY_DLL
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Exporter
|
// Exporter
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// For a file suffix change from the options.
|
||||||
|
wxDECLARE_EVENT(AUDACITY_FILE_SUFFIX_EVENT, wxCommandEvent);
|
||||||
|
|
||||||
class AUDACITY_DLL_API Exporter final : public wxEvtHandler
|
class AUDACITY_DLL_API Exporter final : public wxEvtHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -188,6 +192,7 @@ public:
|
|||||||
int GetAutoExportSubFormat();
|
int GetAutoExportSubFormat();
|
||||||
int GetAutoExportFilterIndex();
|
int GetAutoExportFilterIndex();
|
||||||
wxFileName GetAutoExportFileName();
|
wxFileName GetAutoExportFileName();
|
||||||
|
void OnExtensionChanged(wxCommandEvent &Evt);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool ExamineTracks();
|
bool ExamineTracks();
|
||||||
|
@ -280,6 +280,14 @@ void ExportPCMOptions::OnHeaderChoice(wxCommandEvent & WXUNUSED(evt))
|
|||||||
ValidatePair(GetFormat());
|
ValidatePair(GetFormat());
|
||||||
|
|
||||||
TransferDataFromWindow();
|
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()
|
int ExportPCMOptions::GetFormat()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user