From 7690f7729bbc2bc9f71d324bd702ffe487c66532 Mon Sep 17 00:00:00 2001 From: spacy51 Date: Tue, 9 Sep 2008 12:48:44 +0000 Subject: [PATCH] ADDED "Quick Open ROM..." menu entry git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@711 a31d4220-a93d-0410-bf67-fe4944624d44 --- src/win32/MainWnd.cpp | 22 ++++++++++------------ src/win32/MainWnd.h | 1 + src/win32/MainWndFile.cpp | 7 +++++++ src/win32/VBA.rc | 20 +++++++++++--------- src/win32/resource.h | 5 +++-- 5 files changed, 32 insertions(+), 23 deletions(-) diff --git a/src/win32/MainWnd.cpp b/src/win32/MainWnd.cpp index 978324e0..04f81772 100644 --- a/src/win32/MainWnd.cpp +++ b/src/win32/MainWnd.cpp @@ -418,6 +418,7 @@ BEGIN_MESSAGE_MAP(MainWnd, CWnd) ON_WM_ENTERSIZEMOVE() ON_COMMAND(ID_AUDIO_CORE_SETTINGS, &MainWnd::OnAudioCoreSettings) ON_UPDATE_COMMAND_UI(ID_AUDIO_CORE_SETTINGS, &MainWnd::OnUpdateAudioCoreSettings) + ON_COMMAND(ID_FILE_QUICKOPENROM, &MainWnd::OnFileQuickopenrom) END_MESSAGE_MAP() @@ -1027,32 +1028,30 @@ bool MainWnd::fileOpenSelect( int system ) { theApp.dir = _T(""); CString initialDir; - int selectedFilter = 0; LPCTSTR exts[] = { _T(""), _T(""), _T(""), _T("") }; CString filter; CString title; switch( system ) { + case 100: + // Quick Open File + initialDir = regQueryStringValue( _T("QuickOpenFileLastDir"), _T(".") ); + filter = winLoadFilter( IDS_FILTER_ALLROM ); + break; case 0: // GBA initialDir = regQueryStringValue( _T("romdir"), _T(".") ); - selectedFilter = regQueryDwordValue( _T("selectedFilter"), 0); - if( (selectedFilter < 0) || (selectedFilter > 2) ) { - selectedFilter = 0; - } filter = winLoadFilter( IDS_FILTER_GBAROM ); break; case 1: // GBC initialDir = regQueryStringValue( _T("gbcromdir"), _T(".") ); - // TODO: memorize selected filter for GBC as well filter = winLoadFilter( IDS_FILTER_GBCROM ); break; case 2: // GB initialDir = regQueryStringValue( _T("gbromdir"), _T(".") ); - // TODO: memorize selected filter for GB as well filter = winLoadFilter( IDS_FILTER_GBROM ); break; } @@ -1077,19 +1076,18 @@ bool MainWnd::fileOpenSelect( int system ) theApp.szFile = _T(""); - FileDlg dlg( this, _T(""), filter, selectedFilter, _T(""), exts, theApp.dir, title, false); + FileDlg dlg( this, _T(""), filter, 0, _T(""), exts, theApp.dir, title, false); if( dlg.DoModal() == IDOK ) { - if( system == 0 ) { - regSetDwordValue( _T("selectedFilter"), dlg.m_ofn.nFilterIndex ); - } theApp.szFile = dlg.GetPathName(); theApp.dir = theApp.szFile.Left( dlg.m_ofn.nFileOffset ); if( (theApp.dir.GetLength() > 3) && (theApp.dir[theApp.dir.GetLength()-1] == _T('\\')) ) { theApp.dir = theApp.dir.Left( theApp.dir.GetLength() - 1 ); } SetCurrentDirectory( theApp.dir ); - regSetStringValue( _T("lastDir"), theApp.dir ); + if( system == 100 ) { + regSetStringValue( _T("QuickOpenFileLastDir"), theApp.dir ); + } return true; } return false; diff --git a/src/win32/MainWnd.h b/src/win32/MainWnd.h index 82b189b2..557d2ec9 100644 --- a/src/win32/MainWnd.h +++ b/src/win32/MainWnd.h @@ -78,6 +78,7 @@ protected: afx_msg void OnClose(); afx_msg void OnHelpAbout(); afx_msg void OnHelpFaq(); + afx_msg void OnFileQuickopenrom(); afx_msg void OnFileOpenGBA(); afx_msg void OnFileOpenGBC(); afx_msg void OnFileOpenGB(); diff --git a/src/win32/MainWndFile.cpp b/src/win32/MainWndFile.cpp index a530c53c..4a443887 100644 --- a/src/win32/MainWndFile.cpp +++ b/src/win32/MainWndFile.cpp @@ -41,6 +41,13 @@ extern void remoteCleanUp(); extern void InterframeCleanup(); +void MainWnd::OnFileQuickopenrom() +{ + if( fileOpenSelect( 100 ) ) { + FileRun(); + } +} + void MainWnd::OnFileOpenGBA() { if( fileOpenSelect( 0 ) ) { diff --git a/src/win32/VBA.rc b/src/win32/VBA.rc index b3963d80..4dd03d2a 100644 --- a/src/win32/VBA.rc +++ b/src/win32/VBA.rc @@ -1611,9 +1611,19 @@ IDR_MENU MENU BEGIN POPUP "&File" BEGIN + MENUITEM "Quick Open ROM...", ID_FILE_QUICKOPENROM + MENUITEM SEPARATOR MENUITEM "Open GBA...", ID_FILE_OPEN_GBA MENUITEM "Open GBC...", ID_FILE_OPEN_GBC MENUITEM "Open GB...", ID_FILE_OPEN_GB + MENUITEM "Close", ID_FILE_CLOSE + MENUITEM SEPARATOR + POPUP "Recent" + BEGIN + MENUITEM "&Reset", ID_FILE_RECENT_RESET + MENUITEM "&Freeze", ID_FILE_RECENT_FREEZE + MENUITEM SEPARATOR + END MENUITEM SEPARATOR MENUITEM "Load...", ID_FILE_LOAD MENUITEM "Save...", ID_FILE_SAVE @@ -1653,13 +1663,6 @@ BEGIN MENUITEM "Pause", ID_FILE_PAUSE MENUITEM "Reset", ID_FILE_RESET MENUITEM SEPARATOR - POPUP "Recent" - BEGIN - MENUITEM "&Reset", ID_FILE_RECENT_RESET - MENUITEM "&Freeze", ID_FILE_RECENT_FREEZE - MENUITEM SEPARATOR - END - MENUITEM SEPARATOR POPUP "Import" BEGIN MENUITEM "&Battery file...", ID_FILE_IMPORT_BATTERYFILE @@ -1676,8 +1679,6 @@ BEGIN MENUITEM "ROM Information...", ID_FILE_ROMINFORMATION MENUITEM "Toggle Fullscreen", ID_FILE_TOGGLEMENU MENUITEM SEPARATOR - MENUITEM "Close", ID_FILE_CLOSE - MENUITEM SEPARATOR MENUITEM "Exit", ID_FILE_EXIT END POPUP "&Options" @@ -2216,6 +2217,7 @@ BEGIN IDS_TOOLTIP_ENHANCE_SOUND "Enable the following sound enhancements." IDS_TOOLTIP_SURROUND "Inverts the phase of some channels, making it sound as if sound is coming from behind." IDS_TOOLTIP_DECLICKING "When enabled, clicks are reduced by using GBA sound hardware. Note that clicks are normal for GB and GBC sound hardware." + IDS_FILTER_ALLROM "All ROMs (*.GBA;*.AGB;*.BIN;*.ELF;*.MB;*.GBC;*.CGB;*.GB;*.SGB;*.ZIP;*.7Z;*.Z;*.GZ)_*.GBA;*.AGB;*.BIN;*.ELF;*.MB;*.GBC;*.CGB;*.GB;*.SGB;*.ZIP;*.7Z;*.Z;*.GZ_All Files (*.*)_*.*__" END STRINGTABLE diff --git a/src/win32/resource.h b/src/win32/resource.h index 79c1d99a..ed0c12e3 100644 --- a/src/win32/resource.h +++ b/src/win32/resource.h @@ -50,7 +50,7 @@ #define IDS_TOOLTIP_ENHANCE_SOUND 43 #define IDS_TOOLTIP_SURROUND 44 #define IDS_TOOLTIP_DECLICKING 45 -#define IDS_FILTER_COMPRESSED_FILES 46 +#define IDS_FILTER_ALLROM 46 #define IDI_MAINICON 101 #define IDD_REGISTERS 102 #define IDD_DEBUG 103 @@ -866,13 +866,14 @@ #define ID_OUTPUTAPI_XAUDIO2CONFIG 40364 #define ID_AUDIO_CORE_SETTINGS 40365 #define ID_FILE_OPEN_GBA 40366 +#define ID_FILE_QUICKOPENROM 40367 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 165 -#define _APS_NEXT_COMMAND_VALUE 40367 +#define _APS_NEXT_COMMAND_VALUE 40368 #define _APS_NEXT_CONTROL_VALUE 1297 #define _APS_NEXT_SYMED_VALUE 103 #endif