Win32 - memwatch - dialog now collapsable to 1 column

This commit is contained in:
adelikat 2008-12-14 21:09:16 +00:00
parent 2e872ed36b
commit 403a5c8b56
6 changed files with 54 additions and 6 deletions

View File

@ -1,4 +1,5 @@
---version 2.0.4 yet to be released--- ---version 2.0.4 yet to be released---
14-dec-2008 - adelikat - win32 - memwatch - collapsable to 1 column
08-dec-2008 - adelikat - win32 - stop lua menu item gray if no lua script is running 08-dec-2008 - adelikat - win32 - stop lua menu item gray if no lua script is running
08-dec-2008 - adelikat - win32 - fix bug where no sound + mute turbo caused chirps when toggling 08-dec-2008 - adelikat - win32 - fix bug where no sound + mute turbo caused chirps when toggling
08-dec-2008 - adelikat - win32 - sound dialog - disabling sound disabled sound options 08-dec-2008 - adelikat - win32 - sound dialog - disabling sound disabled sound options

View File

@ -165,6 +165,7 @@ static CFGSTRUCT fceuconfig[] = {
AC(EnableBackgroundInput), AC(EnableBackgroundInput),
AC(MemWatchLoadOnStart), AC(MemWatchLoadOnStart),
AC(MemWatchLoadFileOnStart), AC(MemWatchLoadFileOnStart),
AC(MemWCollapsed),
AC(EnableAutosave), AC(EnableAutosave),
AC(frameAdvanceLagSkip), AC(frameAdvanceLagSkip),

View File

@ -38,6 +38,7 @@ static HMENU memwrecentmenu;//Handle to Recent Files Menu
int MemWatch_wndx=0, MemWatch_wndy=0; //Window Position int MemWatch_wndx=0, MemWatch_wndy=0; //Window Position
bool MemWCollapsed = false; //Flag to determine if window is currently collapsed
//Memory Watch globals----------------------------------------- //Memory Watch globals-----------------------------------------
const int NUMWATCHES = 24; //Maximum Number of Watches const int NUMWATCHES = 24; //Maximum Number of Watches
const int LABELLENGTH = 64; //Maximum Length of a Watch label const int LABELLENGTH = 64; //Maximum Length of a Watch label
@ -60,7 +61,6 @@ const unsigned int MEMW_MENU_FIRST_RECENT_FILE = 600;
const unsigned int MEMW_MAX_NUMBER_OF_RECENT_FILES = sizeof(memw_recent_files)/sizeof(*memw_recent_files); const unsigned int MEMW_MAX_NUMBER_OF_RECENT_FILES = sizeof(memw_recent_files)/sizeof(*memw_recent_files);
//Ram change monitor globals----------------------------------- //Ram change monitor globals-----------------------------------
bool RamChangeInitialize = false; //Set true during memw WM_INIT bool RamChangeInitialize = false; //Set true during memw WM_INIT
const int MAX_RAMMONITOR = 4; //Maximum number of Ram values that can be monitored const int MAX_RAMMONITOR = 4; //Maximum number of Ram values that can be monitored
@ -71,7 +71,9 @@ int editnow[MAX_RAMMONITOR]; //current address value
unsigned int editcount[MAX_RAMMONITOR]; //Current counter value unsigned int editcount[MAX_RAMMONITOR]; //Current counter value
char editchangem[MAX_RAMMONITOR][5]; //counter converted to string char editchangem[MAX_RAMMONITOR][5]; //counter converted to string
void RamChangeReset(int x); //Prototypes
void RamChangeReset(int x); //Called when user hits reset button
void CollapseWindow(void); //Called when user collapses or expands window
//------------------------------------------------- //-------------------------------------------------
void UpdateMemw_RMenu(HMENU menu, char **strs, unsigned int mitem, unsigned int baseid) void UpdateMemw_RMenu(HMENU menu, char **strs, unsigned int mitem, unsigned int baseid)
@ -686,6 +688,13 @@ static BOOL CALLBACK MemWatchCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
SelectObject (hdc, debugSystem->hFixedFont); SelectObject (hdc, debugSystem->hFixedFont);
SetTextAlign(hdc,TA_UPDATECP | TA_TOP | TA_LEFT); SetTextAlign(hdc,TA_UPDATECP | TA_TOP | TA_LEFT);
//Collapse window if necesasry
if (MemWCollapsed)
{
MemWCollapsed = false; //This is necessary in order for CollapseWindow to collapse properly
CollapseWindow(); //If flagged as collapsed mode collapse
}
//find the positions where we should draw string values //find the positions where we should draw string values
for(int i=0;i<MWNUM;i++) { for(int i=0;i<MWNUM;i++) {
int col=0; int col=0;
@ -783,6 +792,11 @@ static BOOL CALLBACK MemWatchCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
case MEMW_HELP_WCOMMANDS: case MEMW_HELP_WCOMMANDS:
OpenHelpWindow(memwhelp); OpenHelpWindow(memwhelp);
break; break;
case MEMW_EXPANDCOLLAPSE:
CollapseWindow();
break;
case MEMW_EDIT00RESET: case MEMW_EDIT00RESET:
RamChangeReset(0); RamChangeReset(0);
break; break;
@ -899,8 +913,14 @@ void CreateMemWatch()
SetDlgItemText(hwndMemWatch,MW_NAME(i),(LPTSTR) labels[i]); SetDlgItemText(hwndMemWatch,MW_NAME(i),(LPTSTR) labels[i]);
} }
} }
if (MemWatchLoadFileOnStart) OpenMemwatchRecentFile(0); if (MemWatchLoadFileOnStart) OpenMemwatchRecentFile(0);
else fileChanged = false; else fileChanged = false;
if (MemWCollapsed)
{
MemWCollapsed = false; //This is necessary in order for CollapseWindow to collapse properly
CollapseWindow(); //If flagged as collapsed mode collapse
}
} }
void AddMemWatch(char memaddress[32]) void AddMemWatch(char memaddress[32])
{ {
@ -999,3 +1019,26 @@ void RamChangeReset(int x)
sprintf(editchangem[x], "%d", editcount[x]); //Convert counter to text sprintf(editchangem[x], "%d", editcount[x]); //Convert counter to text
SetDlgItemText(hwndMemWatch, EDIT00_RESULTS+x, editchangem[x]); //Display text in results box SetDlgItemText(hwndMemWatch, EDIT00_RESULTS+x, editchangem[x]); //Display text in results box
} }
void CollapseWindow(void)
{
RECT wrect;
int left,right,top,bottom;
GetWindowRect(hwndMemWatch,&wrect); //Get currect window size
if (!MemWCollapsed) //If window is full size collapse it
{
wrect.right = (wrect.right - ((wrect.right-wrect.left)/2));
MemWCollapsed = true;
SetDlgItemText(hwndMemWatch, MEMW_EXPANDCOLLAPSE, ">"); //Put Address value
}
else
{
wrect.right = (wrect.right + (wrect.right-wrect.left));
MemWCollapsed = false;
SetDlgItemText(hwndMemWatch, MEMW_EXPANDCOLLAPSE, "<"); //Put Address value
}
SetWindowPos(hwndMemWatch,HWND_TOPMOST,MemWatch_wndx,MemWatch_wndy,(wrect.right-wrect.left),(wrect.bottom-wrect.top),SWP_SHOWWINDOW);
}

View File

@ -9,3 +9,4 @@ extern bool MemWatchLoadFileOnStart;
extern char *memw_recent_files[]; extern char *memw_recent_files[];
extern HWND memw_pwindow; extern HWND memw_pwindow;
extern bool RamChangeInitialize; extern bool RamChangeInitialize;
extern bool MemWCollapsed;

View File

@ -849,7 +849,7 @@ BEGIN
LTEXT "Type a key, or press Escape to disable.",65429,53,14,125,8 LTEXT "Type a key, or press Escape to disable.",65429,53,14,125,8
END END
MEMWATCH DIALOGEX 0, 0, 261, 263 MEMWATCH DIALOGEX 0, 0, 261, 270
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Memory Watch" CAPTION "Memory Watch"
MENU MEMWATCHMENU MENU MEMWATCHMENU
@ -937,6 +937,7 @@ BEGIN
PUSHBUTTON " ",MEMW_EDIT03RESET,242,241,11,7 PUSHBUTTON " ",MEMW_EDIT03RESET,242,241,11,7
GROUPBOX "Memory Change Monitoring",IDC_STATIC,131,202,129,57,BS_CENTER GROUPBOX "Memory Change Monitoring",IDC_STATIC,131,202,129,57,BS_CENTER
LTEXT "Count",IDC_STATIC,217,213,20,8 LTEXT "Count",IDC_STATIC,217,213,20,8
PUSHBUTTON "<",MEMW_EXPANDCOLLAPSE,1,259,11,10
END END
DEBUGGER DIALOGEX 54, 74, 548, 305 DEBUGGER DIALOGEX 54, 74, 548, 305
@ -1503,7 +1504,7 @@ BEGIN
"MEMWATCH", DIALOG "MEMWATCH", DIALOG
BEGIN BEGIN
RIGHTMARGIN, 260 RIGHTMARGIN, 260
BOTTOMMARGIN, 262 BOTTOMMARGIN, 269
END END
"DEBUGGER", DIALOG "DEBUGGER", DIALOG

View File

@ -347,6 +347,7 @@
#define IDC_HACKYEXPORT 1133 #define IDC_HACKYEXPORT 1133
#define IDC_BUTTON1 1133 #define IDC_BUTTON1 1133
#define TASEDIT_REWIND 1133 #define TASEDIT_REWIND 1133
#define MEMW_EXPANDCOLLAPSE 1133
#define IDC_BUTTON2 1134 #define IDC_BUTTON2 1134
#define TASEDIT_FOWARD 1134 #define TASEDIT_FOWARD 1134
#define IDC_BUTTON3 1135 #define IDC_BUTTON3 1135