mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-10 16:43:33 +02:00
Round 4 of wx3 changes
This gets FileDialog updated and working on Windows. It also removes removes the "wx3" build configurations and makes the default Debug and Release builds wx3-only. Still need to get VSTs updated.
This commit is contained in:
@@ -59,21 +59,6 @@ void FileDialogBase::CreateUserPane(wxWindow *parent)
|
||||
}
|
||||
}
|
||||
|
||||
void FileDialogBase::EnableButton(wxString label, fdCallback cb, void *data)
|
||||
{
|
||||
m_buttonlabel = label;
|
||||
m_callback = cb;
|
||||
m_cbdata = data;
|
||||
}
|
||||
|
||||
void FileDialogBase::ClickButton(int index)
|
||||
{
|
||||
if (m_callback)
|
||||
{
|
||||
m_callback(m_cbdata, index);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// FileDialog convenience functions
|
||||
//----------------------------------------------------------------------------
|
||||
|
@@ -37,10 +37,6 @@ typedef void (*fdCallback)(void *, int);
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DECLARE_EVENT_TYPE(EVT_FILEDIALOG_SELECTION_CHANGED, -1);
|
||||
DECLARE_EVENT_TYPE(EVT_FILEDIALOG_FILTER_CHANGED, -1);
|
||||
DECLARE_EVENT_TYPE(EVT_FILEDIALOG_ADD_CONTROLS, -1);
|
||||
|
||||
#define FD_NO_ADD_EXTENSION 0x0400
|
||||
|
||||
class FileDialogBase : public wxFileDialogBase
|
||||
@@ -56,9 +52,6 @@ public:
|
||||
virtual bool HasUserPaneCreator() const;
|
||||
virtual void SetUserPaneCreator(UserPaneCreatorFunction creator, wxUIntPtr userdata);
|
||||
|
||||
virtual void EnableButton(wxString label, fdCallback cb, void *cbdata);
|
||||
virtual void ClickButton(int index);
|
||||
|
||||
protected:
|
||||
void CreateUserPane(wxWindow *parent);
|
||||
|
||||
@@ -75,7 +68,7 @@ protected:
|
||||
#elif defined(__WXMAC__)
|
||||
#include "mac/FileDialog.h"
|
||||
#elif defined(__WXMSW__)
|
||||
#include "win/FileDialog.h"
|
||||
#include "win/FileDialogPrivate.h"
|
||||
#else
|
||||
#error Unknown implementation
|
||||
#endif
|
||||
|
@@ -71,7 +71,6 @@ public:
|
||||
// implementation only
|
||||
|
||||
#if wxOSX_USE_COCOA
|
||||
void DoSendFileActivatedEvent(void* panel);
|
||||
void DoSendFolderChangedEvent(void* panel, const wxString& path);
|
||||
void DoSendSelectionChangedEvent(void* panel);
|
||||
#endif
|
||||
|
@@ -50,7 +50,6 @@
|
||||
@interface OSPanelDelegate : NSObject wxOSX_10_6_AND_LATER(<NSOpenSavePanelDelegate>)
|
||||
{
|
||||
FileDialog* _dialog;
|
||||
BOOL _didActivate;
|
||||
}
|
||||
|
||||
- (FileDialog*) fileDialog;
|
||||
@@ -68,7 +67,6 @@
|
||||
{
|
||||
self = [super init];
|
||||
_dialog = NULL;
|
||||
_didActivate = NO;
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -82,17 +80,6 @@
|
||||
_dialog = dialog;
|
||||
}
|
||||
|
||||
- (BOOL)panel:(id)sender validateURL:(NSURL *)url error:(NSError **)outError AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
|
||||
{
|
||||
if (_didActivate == NO)
|
||||
{
|
||||
_dialog->DoSendFileActivatedEvent( sender );
|
||||
_didActivate = YES;
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)panel:(id)sender didChangeToDirectoryURL:(NSURL *)url AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
|
||||
{
|
||||
wxString path = wxCFStringRef::AsStringWithNormalizationFormC( [url path] );
|
||||
@@ -343,26 +330,6 @@ void FileDialog::OnFilterSelected( wxCommandEvent &WXUNUSED(event) )
|
||||
DoOnFilterSelected( m_filterChoice->GetSelection() );
|
||||
}
|
||||
|
||||
void FileDialog::DoSendFileActivatedEvent(void* panel)
|
||||
{
|
||||
wxFileCtrlEvent event( wxEVT_FILECTRL_FILEACTIVATED, this, GetId() );
|
||||
|
||||
event.SetDirectory( m_dir );
|
||||
|
||||
if ( HasFlag( wxFD_SAVE ) )
|
||||
{
|
||||
wxArrayString filenames;
|
||||
filenames.Add( m_fileName );
|
||||
event.SetFiles( filenames );
|
||||
}
|
||||
else
|
||||
{
|
||||
event.SetFiles( m_fileNames );
|
||||
}
|
||||
|
||||
GetEventHandler()->ProcessEvent( event );
|
||||
}
|
||||
|
||||
void FileDialog::DoSendFolderChangedEvent(void* panel, const wxString & path)
|
||||
{
|
||||
m_dir = wxPathOnly( path );
|
||||
@@ -384,6 +351,7 @@ void FileDialog::DoSendSelectionChangedEvent(void* panel)
|
||||
m_path = wxCFStringRef::AsStringWithNormalizationFormC( path );
|
||||
m_fileName = wxFileNameFromPath( m_path );
|
||||
m_dir = wxPathOnly( m_path );
|
||||
m_fileNames.Add( m_fileName );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -438,7 +406,7 @@ void FileDialog::SetupExtraControls(WXWindow nativeWindow)
|
||||
if ( m_useFileTypeFilter || HasUserPaneCreator() )
|
||||
{
|
||||
wxBoxSizer *verticalSizer = new wxBoxSizer( wxVERTICAL );
|
||||
m_filterPanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize );
|
||||
m_filterPanel = new wxPanel( this, wxID_ANY );
|
||||
|
||||
if ( m_useFileTypeFilter )
|
||||
{
|
||||
@@ -462,7 +430,7 @@ void FileDialog::SetupExtraControls(WXWindow nativeWindow)
|
||||
|
||||
if ( HasUserPaneCreator() )
|
||||
{
|
||||
wxPanel *extrapanel = new wxPanel( m_filterPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize );
|
||||
wxPanel *extrapanel = new wxPanel( m_filterPanel, wxID_ANY );
|
||||
CreateUserPane( extrapanel );
|
||||
|
||||
wxBoxSizer *horizontalSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -16,49 +16,75 @@
|
||||
#define _FILEDIALOGMSW_H_
|
||||
|
||||
#include <windows.h>
|
||||
#include <wx/msw/winundef.h>
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// wxFileDialog
|
||||
// FileDialog
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
class FileDialog: public wxFileDialogBase
|
||||
class FileDialog : public FileDialogBase
|
||||
{
|
||||
public:
|
||||
FileDialog(wxWindow *parent,
|
||||
const wxString& message = wxFileSelectorPromptStr,
|
||||
const wxString& defaultDir = wxEmptyString,
|
||||
const wxString& defaultFile = wxEmptyString,
|
||||
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
||||
long style = 0,
|
||||
const wxPoint& pos = wxDefaultPosition);
|
||||
|
||||
virtual void SetPath(const wxString& path);
|
||||
FileDialog();
|
||||
FileDialog(wxWindow *parent,
|
||||
const wxString& message = wxFileSelectorPromptStr,
|
||||
const wxString& defaultDir = wxEmptyString,
|
||||
const wxString& defaultFile = wxEmptyString,
|
||||
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
||||
long style = wxFD_DEFAULT_STYLE,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& sz = wxDefaultSize,
|
||||
const wxString& name = wxFileDialogNameStr);
|
||||
|
||||
virtual void GetPaths(wxArrayString& paths) const;
|
||||
virtual void GetFilenames(wxArrayString& files) const;
|
||||
|
||||
void OnSize(wxSizeEvent & e);
|
||||
virtual int ShowModal();
|
||||
|
||||
virtual void EnableButton(wxString label, fdCallback cb, void *cbdata);
|
||||
virtual void ClickButton(int index);
|
||||
|
||||
virtual void FilterFiles(HWND hDlg, bool refresh);
|
||||
virtual void ParseFilter(int index);
|
||||
wxString m_buttonlabel;
|
||||
|
||||
protected:
|
||||
// -----------------------------------------
|
||||
// wxMSW-specific implementation from now on
|
||||
// -----------------------------------------
|
||||
|
||||
//
|
||||
virtual UINT_PTR MSWDialogHook(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam, OPENFILENAME *pOfn);
|
||||
|
||||
//
|
||||
virtual UINT_PTR MSWParentHook(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam, OPENFILENAME *pOfn);
|
||||
|
||||
protected:
|
||||
|
||||
#if !(defined(__SMARTPHONE__) && defined(__WXWINCE__))
|
||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||
virtual void DoGetSize( int *width, int *height ) const;
|
||||
virtual void DoGetPosition( int *x, int *y ) const;
|
||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||
virtual void DoCentre(int dir);
|
||||
virtual void DoGetSize(int *width, int *height) const;
|
||||
virtual void DoGetPosition(int *x, int *y) const;
|
||||
#endif // !(__SMARTPHONE__ && __WXWINCE__)
|
||||
|
||||
|
||||
private:
|
||||
void Init();
|
||||
|
||||
wxString GetFullPath(HWND hwnd, int itm);
|
||||
void FilterFiles(HWND hwnd, bool refresh);
|
||||
void ParseFilter(int index);
|
||||
|
||||
// Message handlers for the child dialog
|
||||
virtual void MSWOnInitDialog(HWND hwnd, LPOPENFILENAME pOfn);
|
||||
virtual void MSWOnDestroy(HWND hwnd, LPOPENFILENAME pOfn);
|
||||
virtual void MSWOnInitDone(HWND hwnd, LPOPENFILENAME pOfn);
|
||||
virtual void MSWOnFolderChange(HWND hwnd, LPOPENFILENAME pOfn);
|
||||
virtual void MSWOnSelChange(HWND hwnd, LPOPENFILENAME pOfn);
|
||||
virtual void MSWOnTypeChange(HWND hwnd, LPOPENFILENAME pOfn);
|
||||
|
||||
// Message handlers for the child dialog
|
||||
virtual void MSWOnSize(HWND hwnd, LPOPENFILENAME pOfn);
|
||||
|
||||
private:
|
||||
wxArrayString m_fileNames;
|
||||
|
||||
// remember if our SetPosition() or Centre() (which requires special
|
||||
// treatment) was called
|
||||
bool m_bMovedWindow;
|
||||
long m_dialogStyle;
|
||||
|
||||
int m_centreDir; // nothing to do if 0
|
||||
|
||||
wxArrayString m_FilterGroups;
|
||||
wxArrayString m_Filters;
|
||||
wxChar *m_NameBuf;
|
||||
@@ -67,6 +93,12 @@ private:
|
||||
fdCallback m_callback;
|
||||
void *m_cbdata;
|
||||
|
||||
HWND mParentDlg;
|
||||
HWND mChildDlg;
|
||||
WNDPROC mParentProc;
|
||||
|
||||
wxPanel *mRoot;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(FileDialog)
|
||||
DECLARE_NO_COPY_CLASS(FileDialog)
|
||||
};
|
||||
|
Reference in New Issue
Block a user