mirror of
https://github.com/cookiengineer/audacity
synced 2025-09-15 07:50:22 +02:00
Append selected extension to filenames for bug #387 on Linux.
This commit is contained in:
parent
e18175142a
commit
74f6c0d802
@ -323,9 +323,28 @@ void FileDialog::DoSetSize(int x, int y, int width, int height, int sizeFlags )
|
|||||||
wxString FileDialog::GetPath() const
|
wxString FileDialog::GetPath() const
|
||||||
{
|
{
|
||||||
char *f = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(m_widget));
|
char *f = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(m_widget));
|
||||||
wxString path = wxConvFileName->cMB2WX(f);
|
wxFileName path(wxConvFileName->cMB2WX(f));
|
||||||
g_free(f);
|
g_free(f);
|
||||||
return path;
|
|
||||||
|
if (!path.HasExt())
|
||||||
|
{
|
||||||
|
int filterIndex = GetFilterIndex();
|
||||||
|
if (filterIndex != -1)
|
||||||
|
{
|
||||||
|
wxStringTokenizer tokenizer(m_patterns[filterIndex], wxT(";"));
|
||||||
|
if (tokenizer.HasMoreTokens())
|
||||||
|
{
|
||||||
|
wxString extension = tokenizer.GetNextToken().AfterFirst(wxT('.'));
|
||||||
|
if (extension.Right(2) == wxT("*"))
|
||||||
|
{
|
||||||
|
extension = wxEmptyString;
|
||||||
|
}
|
||||||
|
path.SetExt(extension);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return path.GetFullPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileDialog::GetFilenames(wxArrayString& files) const
|
void FileDialog::GetFilenames(wxArrayString& files) const
|
||||||
@ -395,9 +414,7 @@ void FileDialog::SetFilename(const wxString& name)
|
|||||||
|
|
||||||
wxString FileDialog::GetFilename() const
|
wxString FileDialog::GetFilename() const
|
||||||
{
|
{
|
||||||
char *f = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(m_widget));
|
wxFileName name = GetPath();
|
||||||
wxFileName name(wxConvFileName->cMB2WX(f));
|
|
||||||
g_free(f);
|
|
||||||
return name.GetFullName();
|
return name.GetFullName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -432,7 +449,8 @@ void FileDialog::SetWildcard(const wxString& wildCard)
|
|||||||
{
|
{
|
||||||
GtkFileFilter* filter = gtk_file_filter_new();
|
GtkFileFilter* filter = gtk_file_filter_new();
|
||||||
gtk_file_filter_set_name(filter, wxGTK_CONV(wildDescriptions[n]));
|
gtk_file_filter_set_name(filter, wxGTK_CONV(wildDescriptions[n]));
|
||||||
|
|
||||||
|
m_patterns.Add(wildFilters[n]);
|
||||||
wxStringTokenizer exttok(wildFilters[n], wxT(";"));
|
wxStringTokenizer exttok(wildFilters[n], wxT(";"));
|
||||||
while (exttok.HasMoreTokens())
|
while (exttok.HasMoreTokens())
|
||||||
{
|
{
|
||||||
|
@ -75,6 +75,7 @@ private:
|
|||||||
wxString m_buttonlabel;
|
wxString m_buttonlabel;
|
||||||
fdCallback m_callback;
|
fdCallback m_callback;
|
||||||
void *m_cbdata;
|
void *m_cbdata;
|
||||||
|
wxArrayString m_patterns;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user