From 6e9cf957600f540ecf79ef79edd8793980190ff7 Mon Sep 17 00:00:00 2001 From: adelikat Date: Thu, 25 Jun 2009 02:56:18 +0000 Subject: [PATCH] Win32 - memory watch - option to bind to main window, if checked it gives GENS dialog style control, where there is no extra task bar item, and it minimizes when FCEUX is minimized --- changelog.txt | 3 ++- src/drivers/win/config.cpp | 1 + src/drivers/win/memwatch.cpp | 16 +++++++++++++++- src/drivers/win/memwatch.h | 1 + src/drivers/win/res.rc | 2 ++ src/drivers/win/resource.h | 3 ++- 6 files changed, 23 insertions(+), 3 deletions(-) diff --git a/changelog.txt b/changelog.txt index b89cb223..2d18326a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,5 @@ -24-jun-2009 - adelikat - win32 - +24-jun-2009 - adelikat - win32 - memory watch - option to bind to main window, if checked it gives GENS dialog style control, where there is no extra task bar item, and it minimizes when FCEUX is minimized +24-jun-2009 - adelikat - win32 - palette commandline options 24-jun-2009 - adelikat - win32 - Sound Dialog - cleanup, when sound is off, all controls are grayed out 24-jun-2009 - adelikat - win32 - Hex Editor - Drag & Drop for .tbl files 24-jun-2009 - adelikat - win32 - Drag & Drop for .fcm, it converts and then loads the converted movie automatically diff --git a/src/drivers/win/config.cpp b/src/drivers/win/config.cpp index 14e8ee0e..57c278ff 100644 --- a/src/drivers/win/config.cpp +++ b/src/drivers/win/config.cpp @@ -206,6 +206,7 @@ static CFGSTRUCT fceuconfig[] = { AC(MemWatchLoadOnStart), AC(MemWatchLoadFileOnStart), AC(MemWCollapsed), + AC(BindToMain), AC(EnableAutosave), AC(frameAdvanceLagSkip), diff --git a/src/drivers/win/memwatch.cpp b/src/drivers/win/memwatch.cpp index 9d74979c..5c0693f2 100644 --- a/src/drivers/win/memwatch.cpp +++ b/src/drivers/win/memwatch.cpp @@ -28,6 +28,7 @@ #include "help.h" #include #include "main.h" +#include "window.h" //adelikat: For GetMainHWDN() using namespace std; @@ -57,6 +58,7 @@ char memwLastFilename[2048]; //Last watch file used by memwatch bool fileChanged = false; //Determines if Save Changes should appear bool MemWatchLoadOnStart = false; //Load on Start Flag bool MemWatchLoadFileOnStart = false; //Load last file Flag +bool BindToMain = false; //Whether or not FCEUX is in control of this dialog (by default all dialogs in FCEUX aren't) string memwhelp = "{01ABA5FD-D54A-44EF-961A-42C7AA586D95}"; //Name of memory watch chapter in .chm (sure would be nice to get better names for these!" @@ -785,6 +787,7 @@ static BOOL CALLBACK MemWatchCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA case WM_INITMENU: CheckMenuItem(memwmenu, MEMW_OPTIONS_LOADSTART, MemWatchLoadOnStart ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(memwmenu, MEMW_OPTIONS_LOADLASTFILE, MemWatchLoadFileOnStart ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem(memwmenu, ID_OPTIONS_BINDTOMAINWINDOW, BindToMain ? MF_CHECKED : MF_UNCHECKED); break; case WM_CLOSE: case WM_QUIT: @@ -861,6 +864,11 @@ static BOOL CALLBACK MemWatchCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA CheckMenuItem(memwmenu, MEMW_OPTIONS_LOADLASTFILE, MemWatchLoadFileOnStart ? MF_CHECKED : MF_UNCHECKED); break; + case ID_OPTIONS_BINDTOMAINWINDOW: //adelikat: This option will attach/detach memwatch from the main window, if attached it doesn't not have its own taskbar item and will minimize when FCEUX is minimized + BindToMain ^= 1; + CheckMenuItem(memwmenu, ID_OPTIONS_BINDTOMAINWINDOW, BindToMain ? MF_CHECKED : MF_UNCHECKED); + break; + case MEMW_HELP_WCOMMANDS: OpenHelpWindow(memwhelp); break; @@ -968,7 +976,13 @@ void CreateMemWatch() } //Create - hwndMemWatch=CreateDialog(fceu_hInstance,"MEMWATCH",NULL,MemWatchCallB); + HWND Parent; + if (BindToMain) + Parent = GetMainHWND(); + else + Parent = NULL; + + hwndMemWatch=CreateDialog(fceu_hInstance,"MEMWATCH",Parent,MemWatchCallB); memwmenu=GetMenu(hwndMemWatch); UpdateMemWatch(); memwrecentmenu = CreateMenu(); diff --git a/src/drivers/win/memwatch.h b/src/drivers/win/memwatch.h index 757ee19a..d5c7663f 100644 --- a/src/drivers/win/memwatch.h +++ b/src/drivers/win/memwatch.h @@ -10,3 +10,4 @@ extern char *memw_recent_files[]; extern HWND memw_pwindow; extern bool RamChangeInitialize; extern bool MemWCollapsed; +extern bool BindToMain; diff --git a/src/drivers/win/res.rc b/src/drivers/win/res.rc index 7301b10d..c57c969f 100644 --- a/src/drivers/win/res.rc +++ b/src/drivers/win/res.rc @@ -298,6 +298,8 @@ BEGIN MENUITEM "Load Last &File on Startup", MEMW_OPTIONS_LOADLASTFILE MENUITEM SEPARATOR MENUITEM "&Collapse to 1 column", MEMW_OPTIONS_EXPANDCOLLAPSE + MENUITEM SEPARATOR + MENUITEM "Bind to Main Window", ID_OPTIONS_BINDTOMAINWINDOW END POPUP "&Help" BEGIN diff --git a/src/drivers/win/resource.h b/src/drivers/win/resource.h index d03f8fba..4f7cb552 100644 --- a/src/drivers/win/resource.h +++ b/src/drivers/win/resource.h @@ -689,6 +689,7 @@ #define FCEUX_CONTEXT_SAVEMOVIEAS 40358 #define ID_FILE_RECENT40359 40359 #define ID_TASEDIT_FILE_RECENT 40360 +#define ID_OPTIONS_BINDTOMAINWINDOW 40361 #define IDC_DEBUGGER_ICONTRAY 55535 #define MW_ValueLabel2 65423 #define MW_ValueLabel1 65426 @@ -698,7 +699,7 @@ #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 125 -#define _APS_NEXT_COMMAND_VALUE 40361 +#define _APS_NEXT_COMMAND_VALUE 40362 #define _APS_NEXT_CONTROL_VALUE 1205 #define _APS_NEXT_SYMED_VALUE 101 #endif