[Debugger] Make Debugger DPI-Aware

Thanks @Shygoo for the class code
This commit is contained in:
oddMLan 2019-04-18 14:10:04 -07:00
parent b42e61f505
commit d83c8597b6
12 changed files with 35 additions and 15 deletions

View File

@ -123,3 +123,23 @@ private:
LONG m_SaveWndTop; LONG m_SaveWndTop;
LONG m_SaveWndLeft; LONG m_SaveWndLeft;
}; };
class CListViewCtrlVarDPI : public CListViewCtrl
{
private:
float m_ScaleX;
public:
CListViewCtrlVarDPI() :
CListViewCtrl()
{
HDC screen = ::GetDC(0);
m_ScaleX = GetDeviceCaps(screen, LOGPIXELSX) / 96.0f;
::ReleaseDC(0, screen);
}
BOOL SetColumnWidth(int nColumn, int nWidth)
{
return CListViewCtrl::SetColumnWidth(nColumn, nWidth * m_ScaleX);
}
};

View File

@ -412,7 +412,7 @@ void CDebugCPULogView::Export(void)
// util // util
int CDebugCPULogView::GetNumVisibleRows(CListViewCtrl& list) int CDebugCPULogView::GetNumVisibleRows(CListViewCtrlVarDPI& list)
{ {
CHeaderCtrl header = list.GetHeader(); CHeaderCtrl header = list.GetHeader();
CRect listRect, headRect; CRect listRect, headRect;

View File

@ -22,7 +22,7 @@ private:
int m_RowHeight; int m_RowHeight;
int m_LogStartIndex; int m_LogStartIndex;
CListViewCtrl m_CPUListView; CListViewCtrlVarDPI m_CPUListView;
CEdit m_StateInfoEdit; CEdit m_StateInfoEdit;
CEditNumber32 m_BuffSizeEdit; CEditNumber32 m_BuffSizeEdit;
CButton m_EnabledChk; CButton m_EnabledChk;
@ -50,7 +50,7 @@ private:
void ShowRegStates(size_t stateIndex); void ShowRegStates(size_t stateIndex);
void Export(void); void Export(void);
int GetNumVisibleRows(CListViewCtrl& list); int GetNumVisibleRows(CListViewCtrlVarDPI& list);
bool MouseHovering(WORD ctrlId, int xMargin = 0, int yMargin = 0); bool MouseHovering(WORD ctrlId, int xMargin = 0, int yMargin = 0);
BEGIN_MSG_MAP_EX(CDebugCPULogView) BEGIN_MSG_MAP_EX(CDebugCPULogView)

View File

@ -21,7 +21,7 @@
void CCommandList::Attach(HWND hWndNew) void CCommandList::Attach(HWND hWndNew)
{ {
CListViewCtrl::Attach(hWndNew); CListViewCtrlVarDPI::Attach(hWndNew);
ModifyStyle(LVS_OWNERDRAWFIXED, 0, 0); ModifyStyle(LVS_OWNERDRAWFIXED, 0, 0);
SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER | LVS_EX_LABELTIP); SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER | LVS_EX_LABELTIP);

View File

@ -18,7 +18,7 @@
#include <Project64/UserInterface/WTLControls/TooltipDialog.h> #include <Project64/UserInterface/WTLControls/TooltipDialog.h>
class CCommandList : class CCommandList :
public CWindowImpl<CCommandList, CListViewCtrl> public CWindowImpl<CCommandList, CListViewCtrlVarDPI>
{ {
public: public:
enum enum

View File

@ -44,7 +44,7 @@ private:
// Return true if entry meets requirements // Return true if entry meets requirements
bool FilterEntry(int dmaLogIndex); bool FilterEntry(int dmaLogIndex);
CListViewCtrl m_DMAList; CListViewCtrlVarDPI m_DMAList;
CEdit m_DMARamEdit; CEdit m_DMARamEdit;
CEdit m_DMARomEdit; CEdit m_DMARomEdit;
CStatic m_BlockInfo; CStatic m_BlockInfo;

View File

@ -1487,7 +1487,7 @@ void CDebugMemorySearch::SeparatorMoveCtrl(WORD ctrlId, int yChange, bool bResiz
::InvalidateRect(hControl, NULL, true); ::InvalidateRect(hControl, NULL, true);
} }
int CDebugMemorySearch::GetNumVisibleRows(CListViewCtrl& list) int CDebugMemorySearch::GetNumVisibleRows(CListViewCtrlVarDPI& list)
{ {
CHeaderCtrl header = list.GetHeader(); CHeaderCtrl header = list.GetHeader();
CRect listRect, headRect; CRect listRect, headRect;
@ -2139,7 +2139,7 @@ void CDebugMemorySearch::LoadWatchList(void)
} }
void CDebugMemorySearch::FixListHeader(CListViewCtrl& listCtrl) void CDebugMemorySearch::FixListHeader(CListViewCtrlVarDPI& listCtrl)
{ {
CRect listRect, headRect; CRect listRect, headRect;
CHeaderCtrl listHead = listCtrl.GetHeader(); CHeaderCtrl listHead = listCtrl.GetHeader();

View File

@ -241,10 +241,10 @@ private:
CPath GetWatchListPath(void); CPath GetWatchListPath(void);
/* generic ui util */ /* generic ui util */
void FixListHeader(CListViewCtrl& listCtrl); void FixListHeader(CListViewCtrlVarDPI& listCtrl);
void SetComboBoxSelByData(CComboBox& cb, DWORD_PTR data); void SetComboBoxSelByData(CComboBox& cb, DWORD_PTR data);
bool MouseHovering(WORD ctrlId, int hMargin = 0, int vMargin = 0); bool MouseHovering(WORD ctrlId, int hMargin = 0, int vMargin = 0);
int GetNumVisibleRows(CListViewCtrl& list); int GetNumVisibleRows(CListViewCtrlVarDPI& list);
/*******************/ /*******************/
bool m_bJalSelected; bool m_bJalSelected;
@ -261,7 +261,7 @@ private:
CEditMixed m_SearchValue; CEditMixed m_SearchValue;
CEditNumber32 m_AddrStart, m_AddrEnd; CEditNumber32 m_AddrStart, m_AddrEnd;
CComboBox m_SearchTypeOptions, m_ValueTypeOptions; CComboBox m_SearchTypeOptions, m_ValueTypeOptions;
CListViewCtrl m_ResultsListCtrl, m_WatchListCtrl; CListViewCtrlVarDPI m_ResultsListCtrl, m_WatchListCtrl;
CScrollBar m_ResultsScrollbar, m_WatchListScrollbar; CScrollBar m_ResultsScrollbar, m_WatchListScrollbar;
CButton m_PhysicalCheckbox, m_HexCheckbox; CButton m_PhysicalCheckbox, m_HexCheckbox;
CButton m_UnsignedCheckbox, m_IgnoreCaseCheckbox, m_UnkEncodingCheckbox; CButton m_UnsignedCheckbox, m_IgnoreCaseCheckbox, m_UnkEncodingCheckbox;

View File

@ -13,7 +13,7 @@
#include "DebuggerUI.h" #include "DebuggerUI.h"
#include "ScriptSystem.h" #include "ScriptSystem.h"
class CScriptList : public CListViewCtrl class CScriptList : public CListViewCtrlVarDPI
{ {
public: public:
BEGIN_MSG_MAP_EX(CScriptList) BEGIN_MSG_MAP_EX(CScriptList)

View File

@ -44,7 +44,7 @@ private:
HANDLE m_AutoRefreshThread; HANDLE m_AutoRefreshThread;
static DWORD WINAPI AutoRefreshProc(void* _this); static DWORD WINAPI AutoRefreshProc(void* _this);
CListViewCtrl m_List; CListViewCtrlVarDPI m_List;
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); LRESULT OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);

View File

@ -24,7 +24,7 @@ public:
void Refresh(); void Refresh();
private: private:
CListViewCtrl m_StackList; CListViewCtrlVarDPI m_StackList;
CStatic m_SPStatic; CStatic m_SPStatic;
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);

View File

@ -20,7 +20,7 @@ class CDebugSymbols :
public CDialogResize<CDebugSymbols> public CDialogResize<CDebugSymbols>
{ {
private: private:
CListViewCtrl m_SymbolsListView; CListViewCtrlVarDPI m_SymbolsListView;
CAddSymbolDlg m_AddSymbolDlg; CAddSymbolDlg m_AddSymbolDlg;
HANDLE m_AutoRefreshThread; HANDLE m_AutoRefreshThread;