File open tweaks

- Remove *.* from AppleSingle filter spec, since "all files" now
  works just fine.
- Make "all files" the default if nothing is configured.
This commit is contained in:
Andy McFadden 2015-01-13 22:08:58 -08:00
parent b40054bf26
commit cc93d4ab92
2 changed files with 11 additions and 4 deletions

View File

@ -67,7 +67,7 @@ const WCHAR MainWindow::kOpenBinaryII[] =
const WCHAR MainWindow::kOpenACU[] =
L"ACU Archives" /* (.acu)*/ L"|*.acu|";
const WCHAR MainWindow::kOpenAppleSingle[] =
L"AppleSingle files" /* (.as *.*)*/ L"|*.as;*.*|";
L"AppleSingle files" /* (.as)*/ L"|*.as|";
const WCHAR MainWindow::kOpenDiskImage[] =
L"Disk Images" /* (.shk .sdk .dsk .po .do .d13 .2mg .img .nib .nb2 .raw .hdv .dc .dc6 .ddd .app .fdi .iso .gz .zip)*/ L"|"
L"*.shk;*.sdk;*.dsk;*.po;*.do;*.d13;*.2mg;*.img;*.nib;*.nb2;*.raw;*.hdv;*.dc;*.dc6;*.ddd;*.app;*.fdi;*.iso;*.gz;*.zip|";
@ -1200,7 +1200,12 @@ void MainWindow::OnFileOpen(void)
CFileDialog dlg(TRUE, L"shk", NULL,
OFN_FILEMUSTEXIST, openFilters, this);
dlg.m_ofn.nFilterIndex = fPreferences.GetPrefLong(kPrLastOpenFilterIndex);
DWORD savedIndex = fPreferences.GetPrefLong(kPrLastOpenFilterIndex);
if (savedIndex < kFilterIndexFIRST || savedIndex > kFilterIndexMAX) {
// default to *.* if not set (zero) or out of range
savedIndex = kFilterIndexGeneric;
}
dlg.m_ofn.nFilterIndex = savedIndex;
dlg.m_ofn.lpstrInitialDir = fPreferences.GetPrefString(kPrOpenArchiveFolder);
if (dlg.DoModal() != IDOK)
@ -1974,7 +1979,7 @@ int MainWindow::LoadArchive(const WCHAR* fileName, const WCHAR* extension,
/*
* That didn't work. Try the others.
*/
for (int i = kFilterIndexFIRST; i <= kFilterIndexLAST; i++) {
for (int i = kFilterIndexFIRST; i <= kFilterIndexLASTNG; i++) {
if (i == filterIndex) continue;
pOpenArchive = CreateArchiveInstance((FilterIndex) i);

View File

@ -25,6 +25,8 @@
#define WMU_LATE_INIT (WM_USER+0)
#define WMU_START (WM_USER+1) // used by ActionProgressDialog
// The filter index is saved in the registry, so if you reorder this list
// you will briefly annoy existing users.
enum FilterIndex {
kFilterIndexFIRST = 1, // first index, must be non-Generic
kFilterIndexNuFX = 1,
@ -32,7 +34,7 @@ enum FilterIndex {
kFilterIndexACU = 3,
kFilterIndexAppleSingle = 4,
kFilterIndexDiskImage = 5,
kFilterIndexLAST = 5, // last non-Generic index
kFilterIndexLASTNG = 5, // last non-Generic index
kFilterIndexGeneric = 6, // *.* filter used
kFilterIndexMAX = 6 // highest valid number