Win32 - Debugger - fix issue with invalid child sizes

This commit is contained in:
adelikat 2008-12-16 15:25:20 +00:00
parent b7c47221c7
commit 35ea920c3c
2 changed files with 38 additions and 16 deletions

View File

@ -1,4 +1,5 @@
---version 2.0.4 yet to be released---
16-dec-2008 - adelikat - win32 - debugger - fixed SF2073113 - Debugger now has a minimum valid size
15-dec-2008 - adelikat - win32 - cheats - number of active cheats listed, freezing ram addresses in hex editor automatically updates cheats dialog
15-dec-2008 - adelikat - win32 - hexeditor - added minimize & maximize buttons
14-dec-2008 - adelikat - win32 - memwatch - frozen addresses will display as blue

View File

@ -856,17 +856,17 @@ static RECT newDebuggerRect;
//used to move all child items in the dialog when you resize (except for the dock fill controls which are resized)
BOOL CALLBACK DebuggerEnumWindowsProc(HWND hwnd, LPARAM lParam)
{
int dx = (newDebuggerRect.right-newDebuggerRect.left)-(currDebuggerRect.right-currDebuggerRect.left);
int dy = (newDebuggerRect.bottom-newDebuggerRect.top)-(currDebuggerRect.bottom-currDebuggerRect.top);
int dx = (newDebuggerRect.right-newDebuggerRect.left)-(currDebuggerRect.right-currDebuggerRect.left); //Calculate & store difference in width of old size vs new size
int dy = (newDebuggerRect.bottom-newDebuggerRect.top)-(currDebuggerRect.bottom-currDebuggerRect.top); //ditto wtih height
HWND editbox = GetDlgItem(hDebug,IDC_DEBUGGER_DISASSEMBLY);
HWND icontray = GetDlgItem(hDebug,IDC_DEBUGGER_ICONTRAY);
HWND addrline = GetDlgItem(hDebug,IDC_DEBUGGER_ADDR_LINE);
HWND vscr = GetDlgItem(hDebug,IDC_DEBUGGER_DISASSEMBLY_VSCR);
HWND editbox = GetDlgItem(hDebug,IDC_DEBUGGER_DISASSEMBLY); //Get handle for Disassembly list box (large guy on the left)
HWND icontray = GetDlgItem(hDebug,IDC_DEBUGGER_ICONTRAY); //Get handle for IContray, vertical column to the left of disassembly
HWND addrline = GetDlgItem(hDebug,IDC_DEBUGGER_ADDR_LINE); //Get handle of address line (text area under the disassembly
HWND vscr = GetDlgItem(hDebug,IDC_DEBUGGER_DISASSEMBLY_VSCR); //Get handle for disassembly Vertical Scrollbar
RECT crect;
GetWindowRect(hwnd,&crect);
ScreenToClient(hDebug,(LPPOINT)&crect);
GetWindowRect(hwnd,&crect); //Get rect of current child to be resized
ScreenToClient(hDebug,(LPPOINT)&crect); //Convert rect coordinates to client area coordinates
ScreenToClient(hDebug,((LPPOINT)&crect)+1);
if(hwnd == editbox) {
@ -889,6 +889,7 @@ BOOL CALLBACK DebuggerEnumWindowsProc(HWND hwnd, LPARAM lParam)
SetWindowPos(hwnd,0,crect.left,crect.top,crect.right-crect.left,crect.bottom-crect.top,SWP_NOZORDER);
} else {
crect.left += dx;
//if (crect.left < 256) crect.left = 256; //Limit how far left the remaining child windows will move
SetWindowPos(hwnd,0,crect.left,crect.top,0,0,SWP_NOZORDER | SWP_NOSIZE);
}
return TRUE;
@ -985,16 +986,36 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
}
case WM_SIZE: {
if(wParam == SIZE_RESTORED)
if(wParam == SIZE_RESTORED) //If dialog was resized
{
GetWindowRect(hwndDlg,&newDebuggerRect);
DbgSizeX = newDebuggerRect.right-newDebuggerRect.left;
GetWindowRect(hwndDlg,&newDebuggerRect); //Get new size
//Force a minimum Dialog size-------------------------------
if (newDebuggerRect.right - newDebuggerRect.left < 368 || newDebuggerRect.bottom - newDebuggerRect.top < 150) //If either x or y is too small run the force size routine
{
if (newDebuggerRect.right - newDebuggerRect.left < 367) //If width is too small reset to previous width
{
newDebuggerRect.right = currDebuggerRect.right;
newDebuggerRect.left = currDebuggerRect.left;
}
if (newDebuggerRect.bottom - newDebuggerRect.top < 150) //If heigth is too small reset to previous height
{
newDebuggerRect.top = currDebuggerRect.top;
newDebuggerRect.bottom = currDebuggerRect.bottom;
}
SetWindowPos(hwndDlg,HWND_TOPMOST,newDebuggerRect.left,newDebuggerRect.top,(newDebuggerRect.right-newDebuggerRect.left),(newDebuggerRect.bottom-newDebuggerRect.top),SWP_SHOWWINDOW);
}
//Else run normal resizing procedure-------------------------
else
{
DbgSizeX = newDebuggerRect.right-newDebuggerRect.left; //Store new size (this will be used to store in the .cfg file)
DbgSizeY = newDebuggerRect.bottom-newDebuggerRect.top;
EnumChildWindows(hwndDlg,DebuggerEnumWindowsProc,0);
currDebuggerRect = newDebuggerRect;
EnumChildWindows(hwndDlg,DebuggerEnumWindowsProc,0); //Initiate callback for resizing child windows
currDebuggerRect = newDebuggerRect; //Store current debugger window size (for future calculations in EnumChildWindows
InvalidateRect(hwndDlg,0,TRUE);
UpdateWindow(hwndDlg);
}
}
break;
}