Merge pull request #1547 from oddMLan/debugger-ux-improvements

Debugger ux improvements
This commit is contained in:
zilmar 2019-01-14 08:11:20 +11:00 committed by GitHub
commit 31c2c16f52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 335 additions and 0 deletions

View File

@ -64,6 +64,38 @@ void RegisterUISettings (void)
g_Settings->AddHandler((SettingID)(FirstUISettings + File_RecentGameFileIndex), new CSettingTypeApplicationIndex("Recent File", "Recent Rom", Default_None));
g_Settings->AddHandler((SettingID)(FirstUISettings + SupportWindows_RunCount), new CSettingTypeApplication("Support Project64", "Run Count", (uint32_t)0));
//Debugger UI
g_Settings->AddHandler((SettingID)(FirstUISettings + MemorySearch_Top), new CSettingTypeApplication("Debugger", "Memory Search Top", Default_None));
g_Settings->AddHandler((SettingID)(FirstUISettings + MemorySearch_Left), new CSettingTypeApplication("Debugger", "Memory Search Left", Default_None));
g_Settings->AddHandler((SettingID)(FirstUISettings + ViewMemory_Top), new CSettingTypeApplication("Debugger", "View Memory Top", Default_None));
g_Settings->AddHandler((SettingID)(FirstUISettings + ViewMemory_Left), new CSettingTypeApplication("Debugger", "View Memory Left", Default_None));
g_Settings->AddHandler((SettingID)(FirstUISettings + TLB_Top), new CSettingTypeApplication("Debugger", "TLB Top", Default_None));
g_Settings->AddHandler((SettingID)(FirstUISettings + TLB_Left), new CSettingTypeApplication("Debugger", "TLB Left", Default_None));
g_Settings->AddHandler((SettingID)(FirstUISettings + Commands_Top), new CSettingTypeApplication("Debugger", "Commands Top", Default_None));
g_Settings->AddHandler((SettingID)(FirstUISettings + Commands_Left), new CSettingTypeApplication("Debugger", "Commands Left", Default_None));
g_Settings->AddHandler((SettingID)(FirstUISettings + Commands_Width), new CSettingTypeApplication("Debugger", "Commands Width", (uint32_t)489));
g_Settings->AddHandler((SettingID)(FirstUISettings + Commands_Height), new CSettingTypeApplication("Debugger", "Commands Height", (uint32_t)327));
g_Settings->AddHandler((SettingID)(FirstUISettings + Scripts_Top), new CSettingTypeApplication("Debugger", "Scripts Top", Default_None));
g_Settings->AddHandler((SettingID)(FirstUISettings + Scripts_Left), new CSettingTypeApplication("Debugger", "Scripts Left", Default_None));
g_Settings->AddHandler((SettingID)(FirstUISettings + Scripts_Width), new CSettingTypeApplication("Debugger", "Scripts Width", (uint32_t)337));
g_Settings->AddHandler((SettingID)(FirstUISettings + Scripts_Height), new CSettingTypeApplication("Debugger", "Scripts Height", (uint32_t)170));
g_Settings->AddHandler((SettingID)(FirstUISettings + Symbols_Top), new CSettingTypeApplication("Debugger", "Symbols Top", Default_None));
g_Settings->AddHandler((SettingID)(FirstUISettings + Symbols_Left), new CSettingTypeApplication("Debugger", "Symbols Left", Default_None));
g_Settings->AddHandler((SettingID)(FirstUISettings + Symbols_Width), new CSettingTypeApplication("Debugger", "Symbols Width", (uint32_t)313));
g_Settings->AddHandler((SettingID)(FirstUISettings + Symbols_Height), new CSettingTypeApplication("Debugger", "Symbols Height", (uint32_t)141));
g_Settings->AddHandler((SettingID)(FirstUISettings + DMALogView_Top), new CSettingTypeApplication("Debugger", "DMA Log View Top", Default_None));
g_Settings->AddHandler((SettingID)(FirstUISettings + DMALogView_Left), new CSettingTypeApplication("Debugger", "DMA Log View Left", Default_None));
g_Settings->AddHandler((SettingID)(FirstUISettings + DMALogView_Width), new CSettingTypeApplication("Debugger", "DMA Log View Width", (uint32_t)309));
g_Settings->AddHandler((SettingID)(FirstUISettings + DMALogView_Height), new CSettingTypeApplication("Debugger", "DMA Log View Height", (uint32_t)215));
g_Settings->AddHandler((SettingID)(FirstUISettings + StackView_Top), new CSettingTypeApplication("Debugger", "Stack View Top", Default_None));
g_Settings->AddHandler((SettingID)(FirstUISettings + StackView_Left), new CSettingTypeApplication("Debugger", "Stack View Left", Default_None));
g_Settings->AddHandler((SettingID)(FirstUISettings + StackView_Width), new CSettingTypeApplication("Debugger", "Stack View Width", (uint32_t)197));
g_Settings->AddHandler((SettingID)(FirstUISettings + StackView_Height), new CSettingTypeApplication("Debugger", "Stack View Height", (uint32_t)212));
g_Settings->AddHandler((SettingID)(FirstUISettings + StackTrace_Top), new CSettingTypeApplication("Debugger", "Stack Trace Top", Default_None));
g_Settings->AddHandler((SettingID)(FirstUISettings + StackTrace_Left), new CSettingTypeApplication("Debugger", "Stack Trace Left", Default_None));
g_Settings->AddHandler((SettingID)(FirstUISettings + StackTrace_Width), new CSettingTypeApplication("Debugger", "Stack Trace Width", (uint32_t)223));
g_Settings->AddHandler((SettingID)(FirstUISettings + StackTrace_Height), new CSettingTypeApplication("Debugger", "Stack Trace Height", (uint32_t)221));
}
void UISettingsSaveBool(UISettingID Type, bool Value)

View File

@ -61,6 +61,38 @@ enum UISettingID
//Support Window
SupportWindows_RunCount,
//Debugger UI positions and sizes
MemorySearch_Top,
MemorySearch_Left,
ViewMemory_Top,
ViewMemory_Left,
TLB_Top,
TLB_Left,
Commands_Top,
Commands_Left,
Commands_Width,
Commands_Height,
Scripts_Top,
Scripts_Left,
Scripts_Width,
Scripts_Height,
Symbols_Top,
Symbols_Left,
Symbols_Width,
Symbols_Height,
DMALogView_Top,
DMALogView_Left,
DMALogView_Width,
DMALogView_Height,
StackView_Top,
StackView_Left,
StackView_Width,
StackView_Height,
StackTrace_Top,
StackTrace_Left,
StackTrace_Width,
StackTrace_Height,
};
void RegisterUISettings (void);

View File

@ -1,5 +1,6 @@
#pragma once
#include <Project64-core/Settings/SettingType/SettingsType-Application.h>
template <class T>
class CDebugDialog :
public CDialogImpl < T >
@ -39,6 +40,100 @@ public:
}
}
enum { Timer_SetWindowPos = 1 };
//Get Information about the window
int GetHeight(void) {
if (!m_hWnd) { return 0; }
RECT rect;
GetWindowRect(m_hWnd, &rect);
return rect.bottom - rect.top;
}
int GetWidth(void) {
if (!m_hWnd) { return 0; }
RECT rect;
GetWindowRect(m_hWnd, &rect);
return rect.right - rect.left;
}
int GetX(CRect WinRect) {
return (GetSystemMetrics(SM_CXSCREEN) - (WinRect.right - WinRect.left)) / 2;
}
int GetY(CRect WinRect) {
return (GetSystemMetrics(SM_CYSCREEN) - (WinRect.bottom - WinRect.top)) / 2;
}
//Manipulate the state of the window
void SetPos(int X, int Y) { //Move the window to this screen location
::SetWindowPos(m_hWnd, NULL, X, Y, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
}
void SaveWindowLoc(UISettingID SettingID_Top, UISettingID SettingID_Left) {
RECT WinRect;
::GetWindowRect(m_hWnd, &WinRect);
//save the location of the window
if (m_hWnd)
{
m_SaveWnd = true;
m_SaveWndTop = WinRect.top;
m_SaveWndLeft = WinRect.left;
}
::KillTimer(m_hWnd, Timer_SetWindowPos);
::SetTimer(m_hWnd, Timer_SetWindowPos, 1000, NULL);
bool flush = false;
if (m_SaveWnd)
{
m_SaveWnd = false;
UISettingsSaveDword(SettingID_Top, m_SaveWndTop);
UISettingsSaveDword(SettingID_Left, m_SaveWndLeft);
flush = true;
}
if (flush)
{
CSettingTypeApplication::Flush();
}
}
void SetSize(int Width, int Height) { //Set window Height and Width
RECT rcClient;
rcClient.top = 0;
rcClient.bottom = Height;
rcClient.left = 0;
rcClient.right = Width;
::AdjustWindowRect(&rcClient, ::GetWindowLong(m_hWnd, GWL_STYLE), true);
int32_t WindowHeight = rcClient.bottom - rcClient.top;
int32_t WindowWidth = rcClient.right - rcClient.left;
::SetWindowPos(m_hWnd, NULL, 0, 0, WindowWidth, WindowHeight, SWP_NOMOVE | SWP_NOZORDER);
}
void SaveSize(UISettingID SettingID_X, UISettingID SettingID_Y) {
//Get the current window size
RECT rect;
GetWindowRect(m_hWnd, &rect);
int32_t WindowHeight = rect.bottom - rect.top;
int32_t WindowWidth = rect.right - rect.left;
if (UISettingsLoadDword(SettingID_X) != WindowWidth)
{
UISettingsSaveDword(SettingID_X, WindowWidth);
}
if (UISettingsLoadDword(SettingID_Y) != WindowHeight)
{
UISettingsSaveDword(SettingID_Y, WindowHeight);
}
}
void HideWindow(void)
{
if (m_hWnd && ::IsWindow(m_hWnd))
@ -72,7 +167,14 @@ public:
}
if (m_hWnd)
{
if (::IsIconic((HWND)m_hWnd)) {
SendMessage(m_hWnd, WM_SYSCOMMAND, SC_RESTORE, NULL);
}
SetForegroundWindow((HWND)m_hWnd);
}
}
private:
bool m_SaveWnd;
LONG m_SaveWndTop;
LONG m_SaveWndLeft;
};

View File

@ -89,6 +89,46 @@ LRESULT CDebugCommandsView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARA
GetWindowRect(&m_DefaultWindowRect);
//We find the middle position of the screen, we use this if theres no setting
int32_t X = GetX(m_DefaultWindowRect);
int32_t Y = GetY(m_DefaultWindowRect);
//Load the value from settings, if none is available, default to above
UISettingsLoadDword(Commands_Top, (uint32_t &)Y);
UISettingsLoadDword(Commands_Left, (uint32_t &)X);
SetPos(X, Y);
int32_t Width = UISettingsLoadDword(Commands_Width);
int32_t Height = UISettingsLoadDword(Commands_Height);
SetSize(Width, Height);
//Fix sizing (duplicate code of CDebugCommandsView:OnSizing) -- FIXME
CRect listRect;
m_CommandList.GetWindowRect(listRect);
CRect headRect;
CHeaderCtrl listHead = m_CommandList.GetHeader();
listHead.GetWindowRect(&headRect);
int rowsHeight = listRect.Height() - headRect.Height();
int nRows = (rowsHeight / m_RowHeight);
if (m_CommandListRows != nRows)
{
m_CommandListRows = nRows;
ShowAddress(m_StartAddress, TRUE);
}
m_RegisterTabs.RedrawCurrentTab();
// Fix cmd list header
listHead.ResizeClient(listRect.Width(), headRect.Height());
// Setup address input
m_AddressEdit.SetDisplayType(CEditNumber32::DisplayHex);
m_AddressEdit.SetLimitText(8);

View File

@ -146,6 +146,24 @@ LRESULT CDebugDMALogView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM
{
DlgResize_Init(false, true);
CRect m_DefaultWindowRect;
GetWindowRect(&m_DefaultWindowRect);
//We find the middle position of the screen, we use this if theres no setting
int32_t X = GetX(m_DefaultWindowRect);
int32_t Y = GetY(m_DefaultWindowRect);
//Load the value from settings, if none is available, default to above
UISettingsLoadDword(DMALogView_Top, (uint32_t &)Y);
UISettingsLoadDword(DMALogView_Left, (uint32_t &)X);
SetPos(X, Y);
int32_t Width = UISettingsLoadDword(DMALogView_Width);
int32_t Height = UISettingsLoadDword(DMALogView_Height);
SetSize(Width, Height);
m_bConvertingAddress = false;
m_nLastStartIndex = 0;

View File

@ -40,6 +40,19 @@ void CDebugMemorySearch::AddAlignmentOptions(CComboBox & ctrl)
LRESULT CDebugMemorySearch::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
CRect m_DefaultWindowRect;
GetWindowRect(&m_DefaultWindowRect);
//We find the middle position of the screen, we use this if theres no setting
int32_t X = GetX(m_DefaultWindowRect);
int32_t Y = GetY(m_DefaultWindowRect);
//Load the value from settings, if none is available, default to above
UISettingsLoadDword(MemorySearch_Top, (uint32_t &)Y);
UISettingsLoadDword(MemorySearch_Left, (uint32_t &)X);
SetPos(X, Y);
m_PAddrStart.Attach(GetDlgItem(IDC_PADDR_START));
m_PAddrStart.SetDisplayType(CEditNumber32::DisplayHex);
m_SearchLen.Attach(GetDlgItem(IDC_ADDR_END));

View File

@ -31,6 +31,24 @@ LRESULT CDebugScripts::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*l
{
DlgResize_Init(false, true);
CRect m_DefaultWindowRect;
GetWindowRect(&m_DefaultWindowRect);
//We find the middle position of the screen, we use this if theres no setting
int32_t X = GetX(m_DefaultWindowRect);
int32_t Y = GetY(m_DefaultWindowRect);
//Load the value from settings, if none is available, default to above
UISettingsLoadDword(Scripts_Top, (uint32_t &)Y);
UISettingsLoadDword(Scripts_Left, (uint32_t &)X);
SetPos(X, Y);
int32_t Width = UISettingsLoadDword(Scripts_Width);
int32_t Height = UISettingsLoadDword(Scripts_Height);
SetSize(Width, Height);
HFONT monoFont = CreateFont(-11, 0, 0, 0,
FW_DONTCARE, FALSE, FALSE, FALSE, DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,

View File

@ -49,6 +49,24 @@ void CDebugStackTrace::ClearEntries()
LRESULT CDebugStackTrace::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
DlgResize_Init();
CRect m_DefaultWindowRect;
GetWindowRect(&m_DefaultWindowRect);
//We find the middle position of the screen, we use this if theres no setting
int32_t X = GetX(m_DefaultWindowRect);
int32_t Y = GetY(m_DefaultWindowRect);
//Load the value from settings, if none is available, default to above
UISettingsLoadDword(StackTrace_Top, (uint32_t &)Y);
UISettingsLoadDword(StackTrace_Left, (uint32_t &)X);
SetPos(X, Y);
int32_t Width = UISettingsLoadDword(StackTrace_Width);
int32_t Height = UISettingsLoadDword(StackTrace_Height);
SetSize(Width, Height);
m_List.Attach(GetDlgItem(IDC_STACKTRACE_LIST));
m_List.AddColumn("Caller", 0);

View File

@ -26,6 +26,24 @@ LRESULT CDebugStackView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /
{
DlgResize_Init(false, true);
CRect m_DefaultWindowRect;
GetWindowRect(&m_DefaultWindowRect);
//We find the middle position of the screen, we use this if theres no setting
int32_t X = GetX(m_DefaultWindowRect);
int32_t Y = GetY(m_DefaultWindowRect);
//Load the value from settings, if none is available, default to above
UISettingsLoadDword(StackView_Top, (uint32_t &)Y);
UISettingsLoadDword(StackView_Left, (uint32_t &)X);
SetPos(X, Y);
int32_t Width = UISettingsLoadDword(StackView_Width);
int32_t Height = UISettingsLoadDword(StackView_Height);
SetSize(Width, Height);
m_StackList.Attach(GetDlgItem(IDC_STACK_LIST));
m_StackList.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER);
m_StackList.AddColumn("#", 0);

View File

@ -26,6 +26,24 @@ LRESULT CDebugSymbols::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*l
{
DlgResize_Init(false, true);
CRect m_DefaultWindowRect;
GetWindowRect(&m_DefaultWindowRect);
//We find the middle position of the screen, we use this if theres no setting
int32_t X = GetX(m_DefaultWindowRect);
int32_t Y = GetY(m_DefaultWindowRect);
//Load the value from settings, if none is available, default to above
UISettingsLoadDword(Symbols_Top, (uint32_t &)Y);
UISettingsLoadDword(Symbols_Left, (uint32_t &)X);
SetPos(X, Y);
int32_t Width = UISettingsLoadDword(Symbols_Width);
int32_t Height = UISettingsLoadDword(Symbols_Height);
SetSize(Width, Height);
m_SymbolsListView.Attach(GetDlgItem(IDC_SYMBOLS_LIST));
m_SymbolsListView.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER);

View File

@ -23,6 +23,19 @@ CDebugTlb::~CDebugTlb()
LRESULT CDebugTlb::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
CRect m_DefaultWindowRect;
GetWindowRect(&m_DefaultWindowRect);
//We find the middle position of the screen, we use this if theres no setting
int32_t X = GetX(m_DefaultWindowRect);
int32_t Y = GetY(m_DefaultWindowRect);
//Load the value from settings, if none is available, default to above
UISettingsLoadDword(TLB_Top, (uint32_t &)Y);
UISettingsLoadDword(TLB_Left, (uint32_t &)X);
SetPos(X, Y);
LV_COLUMN col;
col.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;

View File

@ -38,6 +38,19 @@ CDebugMemoryView::~CDebugMemoryView()
LRESULT CDebugMemoryView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
CRect m_DefaultWindowRect;
GetWindowRect(&m_DefaultWindowRect);
//We find the middle position of the screen, we use this if theres no setting
int32_t X = GetX(m_DefaultWindowRect);
int32_t Y = GetY(m_DefaultWindowRect);
//Load the value from settings, if none is available, default to above
UISettingsLoadDword(ViewMemory_Top, (uint32_t &)Y);
UISettingsLoadDword(ViewMemory_Left, (uint32_t &)X);
SetPos(X, Y);
m_SymbolColorStride = 0;
m_SymbolColorPhase = 0;
m_DataStartLoc = (DWORD)-1;