mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-15 15:49:36 +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
|
||||
{
|
||||
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);
|
||||
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
|
||||
@ -395,9 +414,7 @@ void FileDialog::SetFilename(const wxString& name)
|
||||
|
||||
wxString FileDialog::GetFilename() const
|
||||
{
|
||||
char *f = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(m_widget));
|
||||
wxFileName name(wxConvFileName->cMB2WX(f));
|
||||
g_free(f);
|
||||
wxFileName name = GetPath();
|
||||
return name.GetFullName();
|
||||
}
|
||||
|
||||
@ -432,7 +449,8 @@ void FileDialog::SetWildcard(const wxString& wildCard)
|
||||
{
|
||||
GtkFileFilter* filter = gtk_file_filter_new();
|
||||
gtk_file_filter_set_name(filter, wxGTK_CONV(wildDescriptions[n]));
|
||||
|
||||
|
||||
m_patterns.Add(wildFilters[n]);
|
||||
wxStringTokenizer exttok(wildFilters[n], wxT(";"));
|
||||
while (exttok.HasMoreTokens())
|
||||
{
|
||||
|
@ -75,6 +75,7 @@ private:
|
||||
wxString m_buttonlabel;
|
||||
fdCallback m_callback;
|
||||
void *m_cbdata;
|
||||
wxArrayString m_patterns;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user