1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-10 16:43:33 +02:00

Preliminary changes for wxWidgets 3.0.1

We can't go to 3.0.1 yet as there are still build issues on
Linux and OSX.  You can get Windows to build, but there's
still some display issues.

These changes should work with wxWidgets 2.8.12 as well, so
we can take our time to get things working properly before
switching over.
This commit is contained in:
lllucius
2014-10-06 08:10:50 +00:00
parent 0933da5b60
commit bdcefb4850
54 changed files with 252 additions and 220 deletions

View File

@@ -49,16 +49,16 @@ void FileDialog::ClickButton(int index)
// FileDialog convenience functions
//----------------------------------------------------------------------------
wxString FileSelector(const wxChar *title,
const wxChar *defaultDir,
const wxChar *defaultFileName,
const wxChar *defaultExtension,
const wxChar *filter,
wxString FileSelector(const wxString & title,
const wxString & defaultDir,
const wxString & defaultFileName,
const wxString & defaultExtension,
const wxString & filter,
int flags,
wxWindow *parent,
wxString label, fdCallback cb, void *cbdata)
{
// The defaultExtension, if non-NULL, is
// The defaultExtension, if non-empty, is
// appended to the filename if the user fails to type an extension. The new
// implementation (taken from wxFileSelectorEx) appends the extension
// automatically, by looking at the filter specification. In fact this
@@ -70,21 +70,13 @@ wxString FileSelector(const wxChar *title,
// suitable filter.
wxString filter2;
if (defaultExtension && !filter)
if (!defaultExtension.empty() && filter.empty())
filter2 = wxString(wxT("*.")) + defaultExtension;
else if (filter)
else if (!filter.empty())
filter2 = filter;
wxString defaultDirString;
if (defaultDir)
defaultDirString = defaultDir;
wxString defaultFilenameString;
if (defaultFileName)
defaultFilenameString = defaultFileName;
FileDialog fileDialog(parent, title, defaultDirString,
defaultFilenameString, filter2,
FileDialog fileDialog(parent, title, defaultDir,
defaultFileName, filter2,
flags);
// Enable the extra button if desired
@@ -94,7 +86,7 @@ wxString FileSelector(const wxChar *title,
}
// if filter is of form "All files (*)|*|..." set correct filter index
if ((wxStrlen(defaultExtension) != 0) && (filter2.Find(wxT('|')) != wxNOT_FOUND))
if (!defaultExtension.empty() && filter2.find(wxT('|')) != wxString::npos)
{
int filterIndex = 0;

View File

@@ -43,11 +43,11 @@ typedef void (*fdCallback)(void *, int);
//----------------------------------------------------------------------------
wxString
FileSelector(const wxChar *message = wxFileSelectorPromptStr,
const wxChar *default_path = NULL,
const wxChar *default_filename = NULL,
const wxChar *default_extension = NULL,
const wxChar *wildcard = wxFileSelectorDefaultWildcardStr,
FileSelector(const wxString & message = wxFileSelectorPromptStr,
const wxString & default_path = wxEmptyString,
const wxString & default_filename = wxEmptyString,
const wxString & default_extension = wxEmptyString,
const wxString & wildcard = wxFileSelectorDefaultWildcardStr,
int flags = 0,
wxWindow *parent = NULL,
wxString label = wxEmptyString,

View File

@@ -209,7 +209,7 @@ FileDialogHookFunction(HWND hDlg,
{
CommDlg_OpenSave_SetControlText( hwndDialog,
pshHelp,
(LPTSTR)me->m_buttonlabel.c_str());
(LPCTSTR)me->m_buttonlabel.c_str());
}
}
else if (CDN_HELP == (pNotifyCode->hdr).code)
@@ -515,7 +515,7 @@ void FileDialog::GetFilenames(wxArrayString& files) const
void FileDialog::SetPath(const wxString& path)
{
wxString ext;
wxSplitPath(path, &m_dir, &m_fileName, &ext);
wxFileName::SplitPath(path, &m_dir, &m_fileName, &ext);
if ( !ext.empty() )
m_fileName << wxT('.') << ext;
}
@@ -717,7 +717,7 @@ int FileDialog::ShowModal()
}
}
of.lpstrFilter = (LPTSTR)filterBuffer.c_str();
of.lpstrFilter = (LPCTSTR)filterBuffer.c_str();
of.nFilterIndex = m_filterIndex + 1;
ParseFilter(of.nFilterIndex);