mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-15 15:49:36 +02:00
Fix for bug #983
Now we know why the "automatically add extension" stuff was commented on in the FileDialog at least. :-)
This commit is contained in:
parent
5c67bc38b3
commit
e5f6a44656
2
lib-src/FileDialog/FileDialog.h
Normal file → Executable file
2
lib-src/FileDialog/FileDialog.h
Normal file → Executable file
@ -50,6 +50,8 @@ DECLARE_EVENT_TYPE(EVT_FILEDIALOG_SELECTION_CHANGED, -1);
|
|||||||
DECLARE_EVENT_TYPE(EVT_FILEDIALOG_FILTER_CHANGED, -1);
|
DECLARE_EVENT_TYPE(EVT_FILEDIALOG_FILTER_CHANGED, -1);
|
||||||
DECLARE_EVENT_TYPE(EVT_FILEDIALOG_ADD_CONTROLS, -1);
|
DECLARE_EVENT_TYPE(EVT_FILEDIALOG_ADD_CONTROLS, -1);
|
||||||
|
|
||||||
|
#define FD_NO_ADD_EXTENSION 0x0400
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// wxFileDialog convenience functions
|
// wxFileDialog convenience functions
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -327,6 +327,8 @@ wxString FileDialog::GetPath() const
|
|||||||
g_free(f);
|
g_free(f);
|
||||||
|
|
||||||
if (!path.HasExt())
|
if (!path.HasExt())
|
||||||
|
{
|
||||||
|
if (!(m_dialogStyle & FD_NO_ADD_EXTENSION))
|
||||||
{
|
{
|
||||||
int filterIndex = GetFilterIndex();
|
int filterIndex = GetFilterIndex();
|
||||||
if (filterIndex != -1)
|
if (filterIndex != -1)
|
||||||
@ -343,6 +345,7 @@ wxString FileDialog::GetPath() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return path.GetFullPath();
|
return path.GetFullPath();
|
||||||
}
|
}
|
||||||
|
@ -743,6 +743,8 @@ int FileDialog::ShowModal()
|
|||||||
|
|
||||||
wxFileName fn = ConvertSlashInFileName(thePath);
|
wxFileName fn = ConvertSlashInFileName(thePath);
|
||||||
if (!fn.HasExt())
|
if (!fn.HasExt())
|
||||||
|
{
|
||||||
|
if (!(m_dialogStyle & FD_NO_ADD_EXTENSION))
|
||||||
{
|
{
|
||||||
wxStringTokenizer tokenizer( myData.extensions[m_filterIndex], wxT(";"));
|
wxStringTokenizer tokenizer( myData.extensions[m_filterIndex], wxT(";"));
|
||||||
if (tokenizer.HasMoreTokens())
|
if (tokenizer.HasMoreTokens())
|
||||||
@ -755,6 +757,7 @@ int FileDialog::ShowModal()
|
|||||||
fn.SetExt(extension);
|
fn.SetExt(extension);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
m_path = fn.GetFullPath();
|
m_path = fn.GetFullPath();
|
||||||
m_paths.Add(m_path);
|
m_paths.Add(m_path);
|
||||||
m_fileName = wxFileNameFromPath(m_path);
|
m_fileName = wxFileNameFromPath(m_path);
|
||||||
|
3
lib-src/FileDialog/win/FileDialogPrivate.cpp
Normal file → Executable file
3
lib-src/FileDialog/win/FileDialogPrivate.cpp
Normal file → Executable file
@ -845,6 +845,8 @@ int FileDialog::ShowModal()
|
|||||||
//=== Adding the correct extension >>=================================
|
//=== Adding the correct extension >>=================================
|
||||||
m_filterIndex = (int)of.nFilterIndex - 1;
|
m_filterIndex = (int)of.nFilterIndex - 1;
|
||||||
|
|
||||||
|
if (!(m_dialogStyle & FD_NO_ADD_EXTENSION))
|
||||||
|
{
|
||||||
if ( !of.nFileExtension ||
|
if ( !of.nFileExtension ||
|
||||||
(of.nFileExtension && fileNameBuffer[of.nFileExtension] == wxT('\0')) )
|
(of.nFileExtension && fileNameBuffer[of.nFileExtension] == wxT('\0')) )
|
||||||
{
|
{
|
||||||
@ -859,6 +861,7 @@ int FileDialog::ShowModal()
|
|||||||
wxStrncpy(fileNameBuffer, m_fileName.c_str(), wxMin(m_fileName.Len(), wxMAXPATH-1));
|
wxStrncpy(fileNameBuffer, m_fileName.c_str(), wxMin(m_fileName.Len(), wxMAXPATH-1));
|
||||||
fileNameBuffer[wxMin(m_fileName.Len(), wxMAXPATH-1)] = wxT('\0');
|
fileNameBuffer[wxMin(m_fileName.Len(), wxMAXPATH-1)] = wxT('\0');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_path = fileNameBuffer;
|
m_path = fileNameBuffer;
|
||||||
m_fileName = wxFileNameFromPath(fileNameBuffer);
|
m_fileName = wxFileNameFromPath(fileNameBuffer);
|
||||||
|
2
src/export/Export.cpp
Normal file → Executable file
2
src/export/Export.cpp
Normal file → Executable file
@ -550,7 +550,7 @@ bool Exporter::GetFilename()
|
|||||||
mFilename.GetPath(),
|
mFilename.GetPath(),
|
||||||
mFilename.GetFullName(),
|
mFilename.GetFullName(),
|
||||||
maskString,
|
maskString,
|
||||||
wxFD_SAVE | wxRESIZE_BORDER);
|
wxFD_SAVE | wxRESIZE_BORDER | FD_NO_ADD_EXTENSION);
|
||||||
mDialog = &fd;
|
mDialog = &fd;
|
||||||
|
|
||||||
fd.SetFilterIndex(mFilterIndex);
|
fd.SetFilterIndex(mFilterIndex);
|
||||||
|
@ -325,7 +325,7 @@ public:
|
|||||||
Tags *metadata = NULL,
|
Tags *metadata = NULL,
|
||||||
int subformat = 0);
|
int subformat = 0);
|
||||||
// optional
|
// optional
|
||||||
wxString GetExtension(int index = 0);
|
wxString GetExtension(int index = WXSIZEOF(kFormats));
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -911,7 +911,7 @@ bool ExportPCM::DisplayOptions(wxWindow *parent, int format)
|
|||||||
|
|
||||||
wxString ExportPCM::GetExtension(int index)
|
wxString ExportPCM::GetExtension(int index)
|
||||||
{
|
{
|
||||||
if (index == 0) {
|
if (index == WXSIZEOF(kFormats)) {
|
||||||
// get extension libsndfile thinks is correct for currently selected format
|
// get extension libsndfile thinks is correct for currently selected format
|
||||||
return sf_header_extension(ReadExportFormatPref());
|
return sf_header_extension(ReadExportFormatPref());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user