Audacity 3.2.0
Classes | Namespaces | Macros | Functions | Variables
win/FileDialogPrivate.cpp File Reference
#include "wx/wxprec.h"
#include <wx/msw/wrapcdlg.h>
#include <wx/msw/missing.h>
#include <wx/utils.h>
#include <wx/msgdlg.h>
#include <wx/filefn.h>
#include <wx/intl.h>
#include <wx/log.h>
#include <wx/app.h>
#include <wx/math.h>
#include <stdlib.h>
#include <string.h>
#include <wx/dynlib.h>
#include <wx/filename.h>
#include <wx/scopeguard.h>
#include <wx/sizer.h>
#include <wx/tokenzr.h>
#include <wx/modalhook.h>
#include <wx/filectrl.h>
#include "../FileDialog.h"
#include <shlobj.h>
Include dependency graph for win/FileDialogPrivate.cpp:

Go to the source code of this file.

Classes

struct  wxOPENFILENAME
 

Namespaces

namespace  anonymous_namespace{FileDialogPrivate.cpp}
 

Macros

#define wxMAXPATH   1024
 
#define wxMAXFILE   1024
 
#define wxMAXEXT   5
 
#define WM_GETISHELLBROWSER   WM_USER + 7
 
#define wxTRY_SMALLER_OPENFILENAME
 

Functions

static wxRect gs_rectDialog (0, 0, 428, 266)
 
void anonymous_namespace{FileDialogPrivate.cpp}::ChangeExceptionPolicy ()
 
void anonymous_namespace{FileDialogPrivate.cpp}::RestoreExceptionPolicy ()
 
static bool DoShowCommFileDialog (OPENFILENAME *of, long style, DWORD *err)
 
static bool ShowCommFileDialog (OPENFILENAME *of, long style)
 

Variables

static const DWORD wxOPENFILENAME_V5_SIZE = 88
 
static const DWORD wxOPENFILENAME_V4_SIZE = 76
 
static DWORD gs_ofStructSize = wxOPENFILENAME_V5_SIZE
 

Macro Definition Documentation

◆ WM_GETISHELLBROWSER

#define WM_GETISHELLBROWSER   WM_USER + 7

Definition at line 455 of file win/FileDialogPrivate.cpp.

◆ wxMAXEXT

#define wxMAXEXT   5

Definition at line 68 of file win/FileDialogPrivate.cpp.

◆ wxMAXFILE

#define wxMAXFILE   1024

Definition at line 66 of file win/FileDialogPrivate.cpp.

◆ wxMAXPATH

#define wxMAXPATH   1024

Definition at line 63 of file win/FileDialogPrivate.cpp.

◆ wxTRY_SMALLER_OPENFILENAME

#define wxTRY_SMALLER_OPENFILENAME

Definition at line 826 of file win/FileDialogPrivate.cpp.

Function Documentation

◆ DoShowCommFileDialog()

static bool DoShowCommFileDialog ( OPENFILENAME *  of,
long  style,
DWORD *  err 
)
static

Definition at line 801 of file win/FileDialogPrivate.cpp.

802{
803 if (style & wxFD_SAVE ? GetSaveFileName(of) : GetOpenFileName(of))
804 return true;
805
806 if (err)
807 {
808 *err = CommDlgExtendedError();
809 }
810
811 return false;
812}

References anonymous_namespace{AudacityDontAskAgainMessageDialog.cpp}::style.

Referenced by ShowCommFileDialog().

Here is the caller graph for this function:

◆ gs_rectDialog()

static wxRect gs_rectDialog ( ,
,
428  ,
266   
)
static

Referenced by FileDialog::DoGetPosition(), FileDialog::DoGetSize(), FileDialog::DoMoveWindow(), FileDialog::Init(), FileDialog::MSWOnDestroy(), and FileDialog::MSWOnInitDone().

Here is the caller graph for this function:

◆ ShowCommFileDialog()

static bool ShowCommFileDialog ( OPENFILENAME *  of,
long  style 
)
static

Definition at line 848 of file win/FileDialogPrivate.cpp.

849{
850 DWORD errCode;
851 bool success = DoShowCommFileDialog(of, style, &errCode);
852
853#ifdef wxTRY_SMALLER_OPENFILENAME
854 // the system might be too old to support the new version file dialog
855 // boxes, try with the old size
856 if (!success && errCode == CDERR_STRUCTSIZE &&
857 of->lStructSize != wxOPENFILENAME_V4_SIZE)
858 {
859 of->lStructSize = wxOPENFILENAME_V4_SIZE;
860
861 success = DoShowCommFileDialog(of, style, &errCode);
862
863 if (success || !errCode)
864 {
865 // use this struct size for subsequent dialogs
866 gs_ofStructSize = of->lStructSize;
867 }
868 }
869#endif // wxTRY_SMALLER_OPENFILENAME
870
871 if (!success && errCode == FNERR_INVALIDFILENAME && of->lpstrFile[0])
872 {
873 // this can happen if the default file name is invalid, try without it
874 // now
875 of->lpstrFile[0] = wxT('\0');
876 success = DoShowCommFileDialog(of, style, &errCode);
877 }
878
879 if (!success)
880 {
881 // common dialog failed - why?
882 if (errCode != 0)
883 {
884 wxLogError(wxT("File dialog failed with error code %0lx."), errCode);
885 }
886 //else: it was just cancelled
887
888 return false;
889 }
890
891 return true;
892}
wxT("CloseDown"))
static bool DoShowCommFileDialog(OPENFILENAME *of, long style, DWORD *err)
static const DWORD wxOPENFILENAME_V4_SIZE
static DWORD gs_ofStructSize

References DoShowCommFileDialog(), gs_ofStructSize, anonymous_namespace{AudacityDontAskAgainMessageDialog.cpp}::style, wxOPENFILENAME_V4_SIZE, and wxT().

Here is the call graph for this function:

Variable Documentation

◆ gs_ofStructSize

DWORD gs_ofStructSize = wxOPENFILENAME_V5_SIZE
static

Definition at line 845 of file win/FileDialogPrivate.cpp.

Referenced by ShowCommFileDialog().

◆ wxOPENFILENAME_V4_SIZE

const DWORD wxOPENFILENAME_V4_SIZE = 76
static

Definition at line 842 of file win/FileDialogPrivate.cpp.

Referenced by ShowCommFileDialog().

◆ wxOPENFILENAME_V5_SIZE

const DWORD wxOPENFILENAME_V5_SIZE = 88
static

Definition at line 839 of file win/FileDialogPrivate.cpp.