From b1e950be203aaaf5107c2c171d976ceec7b33578 Mon Sep 17 00:00:00 2001 From: oddMLan Date: Fri, 19 Apr 2019 16:48:53 -0700 Subject: [PATCH] Move CListViewCtrlVarDPI class code into ATL --- Source/3rdParty/WTL/atlctrls.h | 6 ++++-- .../UserInterface/Debugger/DebugDialog.h | 20 ------------------- .../Debugger/Debugger-CPULogView.cpp | 2 +- .../Debugger/Debugger-CPULogView.h | 4 ++-- .../Debugger/Debugger-Commands.cpp | 2 +- .../Debugger/Debugger-Commands.h | 2 +- .../Debugger/Debugger-DMALogView.h | 2 +- .../Debugger/Debugger-MemorySearch.cpp | 4 ++-- .../Debugger/Debugger-MemorySearch.h | 6 +++--- .../UserInterface/Debugger/Debugger-Scripts.h | 2 +- .../Debugger/Debugger-StackTrace.h | 2 +- .../Debugger/Debugger-StackView.h | 2 +- .../UserInterface/Debugger/Debugger-Symbols.h | 2 +- 13 files changed, 19 insertions(+), 37 deletions(-) diff --git a/Source/3rdParty/WTL/atlctrls.h b/Source/3rdParty/WTL/atlctrls.h index cfa5e7f18..dca3df58c 100644 --- a/Source/3rdParty/WTL/atlctrls.h +++ b/Source/3rdParty/WTL/atlctrls.h @@ -656,8 +656,9 @@ public: // Settable only attributes void SetColumnWidth(int cxWidth) { + float DPIScale = CClientDC(m_hWnd).GetDeviceCaps(LOGPIXELSX) / 96.0f; ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LB_SETCOLUMNWIDTH, cxWidth, 0L); + ::SendMessage(m_hWnd, LB_SETCOLUMNWIDTH, int (cxWidth * DPIScale), 0L); } BOOL SetTabStops(int nTabStops, LPINT rgTabStops) @@ -3068,8 +3069,9 @@ public: BOOL SetColumnWidth(int nCol, int cx) { + float DPIScale = CClientDC(m_hWnd).GetDeviceCaps(LOGPIXELSX) / 96.0f; ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETCOLUMNWIDTH, nCol, MAKELPARAM(cx, 0)); + return (BOOL)::SendMessage(m_hWnd, LVM_SETCOLUMNWIDTH, nCol, MAKELPARAM(int(cx * DPIScale), 0)); } BOOL GetViewRect(LPRECT lpRect) const diff --git a/Source/Project64/UserInterface/Debugger/DebugDialog.h b/Source/Project64/UserInterface/Debugger/DebugDialog.h index e0fdb898f..69067e33d 100644 --- a/Source/Project64/UserInterface/Debugger/DebugDialog.h +++ b/Source/Project64/UserInterface/Debugger/DebugDialog.h @@ -132,24 +132,4 @@ private: bool m_SaveWnd; LONG m_SaveWndTop; 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, int (nWidth * m_ScaleX)); - } }; \ No newline at end of file diff --git a/Source/Project64/UserInterface/Debugger/Debugger-CPULogView.cpp b/Source/Project64/UserInterface/Debugger/Debugger-CPULogView.cpp index ecddce9e0..87a5c4e19 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-CPULogView.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-CPULogView.cpp @@ -412,7 +412,7 @@ void CDebugCPULogView::Export(void) // util -int CDebugCPULogView::GetNumVisibleRows(CListViewCtrlVarDPI& list) +int CDebugCPULogView::GetNumVisibleRows(CListViewCtrl& list) { CHeaderCtrl header = list.GetHeader(); CRect listRect, headRect; diff --git a/Source/Project64/UserInterface/Debugger/Debugger-CPULogView.h b/Source/Project64/UserInterface/Debugger/Debugger-CPULogView.h index e1a0767aa..f54d449ae 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-CPULogView.h +++ b/Source/Project64/UserInterface/Debugger/Debugger-CPULogView.h @@ -22,7 +22,7 @@ private: int m_RowHeight; int m_LogStartIndex; - CListViewCtrlVarDPI m_CPUListView; + CListViewCtrl m_CPUListView; CEdit m_StateInfoEdit; CEditNumber32 m_BuffSizeEdit; CButton m_EnabledChk; @@ -50,7 +50,7 @@ private: void ShowRegStates(size_t stateIndex); void Export(void); - int GetNumVisibleRows(CListViewCtrlVarDPI& list); + int GetNumVisibleRows(CListViewCtrl& list); bool MouseHovering(WORD ctrlId, int xMargin = 0, int yMargin = 0); BEGIN_MSG_MAP_EX(CDebugCPULogView) diff --git a/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp b/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp index 6bbde1fc8..f1795b108 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp @@ -21,7 +21,7 @@ void CCommandList::Attach(HWND hWndNew) { - CListViewCtrlVarDPI::Attach(hWndNew); + CListViewCtrl::Attach(hWndNew); ModifyStyle(LVS_OWNERDRAWFIXED, 0, 0); SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER | LVS_EX_LABELTIP); diff --git a/Source/Project64/UserInterface/Debugger/Debugger-Commands.h b/Source/Project64/UserInterface/Debugger/Debugger-Commands.h index ed2550ce8..0841a5e35 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-Commands.h +++ b/Source/Project64/UserInterface/Debugger/Debugger-Commands.h @@ -18,7 +18,7 @@ #include class CCommandList : - public CWindowImpl + public CWindowImpl { public: enum diff --git a/Source/Project64/UserInterface/Debugger/Debugger-DMALogView.h b/Source/Project64/UserInterface/Debugger/Debugger-DMALogView.h index 07f3e56ad..d3a07a817 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-DMALogView.h +++ b/Source/Project64/UserInterface/Debugger/Debugger-DMALogView.h @@ -44,7 +44,7 @@ private: // Return true if entry meets requirements bool FilterEntry(int dmaLogIndex); - CListViewCtrlVarDPI m_DMAList; + CListViewCtrl m_DMAList; CEdit m_DMARamEdit; CEdit m_DMARomEdit; CStatic m_BlockInfo; diff --git a/Source/Project64/UserInterface/Debugger/Debugger-MemorySearch.cpp b/Source/Project64/UserInterface/Debugger/Debugger-MemorySearch.cpp index 0343e41cd..a4c3a5e9e 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-MemorySearch.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-MemorySearch.cpp @@ -1487,7 +1487,7 @@ void CDebugMemorySearch::SeparatorMoveCtrl(WORD ctrlId, int yChange, bool bResiz ::InvalidateRect(hControl, NULL, true); } -int CDebugMemorySearch::GetNumVisibleRows(CListViewCtrlVarDPI& list) +int CDebugMemorySearch::GetNumVisibleRows(CListViewCtrl& list) { CHeaderCtrl header = list.GetHeader(); CRect listRect, headRect; @@ -2139,7 +2139,7 @@ void CDebugMemorySearch::LoadWatchList(void) } -void CDebugMemorySearch::FixListHeader(CListViewCtrlVarDPI& listCtrl) +void CDebugMemorySearch::FixListHeader(CListViewCtrl& listCtrl) { CRect listRect, headRect; CHeaderCtrl listHead = listCtrl.GetHeader(); diff --git a/Source/Project64/UserInterface/Debugger/Debugger-MemorySearch.h b/Source/Project64/UserInterface/Debugger/Debugger-MemorySearch.h index 61b38efe9..035f32e64 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-MemorySearch.h +++ b/Source/Project64/UserInterface/Debugger/Debugger-MemorySearch.h @@ -241,10 +241,10 @@ private: CPath GetWatchListPath(void); /* generic ui util */ - void FixListHeader(CListViewCtrlVarDPI& listCtrl); + void FixListHeader(CListViewCtrl& listCtrl); void SetComboBoxSelByData(CComboBox& cb, DWORD_PTR data); bool MouseHovering(WORD ctrlId, int hMargin = 0, int vMargin = 0); - int GetNumVisibleRows(CListViewCtrlVarDPI& list); + int GetNumVisibleRows(CListViewCtrl& list); /*******************/ bool m_bJalSelected; @@ -261,7 +261,7 @@ private: CEditMixed m_SearchValue; CEditNumber32 m_AddrStart, m_AddrEnd; CComboBox m_SearchTypeOptions, m_ValueTypeOptions; - CListViewCtrlVarDPI m_ResultsListCtrl, m_WatchListCtrl; + CListViewCtrl m_ResultsListCtrl, m_WatchListCtrl; CScrollBar m_ResultsScrollbar, m_WatchListScrollbar; CButton m_PhysicalCheckbox, m_HexCheckbox; CButton m_UnsignedCheckbox, m_IgnoreCaseCheckbox, m_UnkEncodingCheckbox; diff --git a/Source/Project64/UserInterface/Debugger/Debugger-Scripts.h b/Source/Project64/UserInterface/Debugger/Debugger-Scripts.h index 4377a65bd..c65d343b5 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-Scripts.h +++ b/Source/Project64/UserInterface/Debugger/Debugger-Scripts.h @@ -13,7 +13,7 @@ #include "DebuggerUI.h" #include "ScriptSystem.h" -class CScriptList : public CListViewCtrlVarDPI +class CScriptList : public CListViewCtrl { public: BEGIN_MSG_MAP_EX(CScriptList) diff --git a/Source/Project64/UserInterface/Debugger/Debugger-StackTrace.h b/Source/Project64/UserInterface/Debugger/Debugger-StackTrace.h index dea72b697..a7f3f5681 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-StackTrace.h +++ b/Source/Project64/UserInterface/Debugger/Debugger-StackTrace.h @@ -44,7 +44,7 @@ private: HANDLE m_AutoRefreshThread; static DWORD WINAPI AutoRefreshProc(void* _this); - CListViewCtrlVarDPI m_List; + CListViewCtrl m_List; LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); LRESULT OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); diff --git a/Source/Project64/UserInterface/Debugger/Debugger-StackView.h b/Source/Project64/UserInterface/Debugger/Debugger-StackView.h index 479fe634a..f1b1fe3f9 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-StackView.h +++ b/Source/Project64/UserInterface/Debugger/Debugger-StackView.h @@ -24,7 +24,7 @@ public: void Refresh(); private: - CListViewCtrlVarDPI m_StackList; + CListViewCtrl m_StackList; CStatic m_SPStatic; LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); diff --git a/Source/Project64/UserInterface/Debugger/Debugger-Symbols.h b/Source/Project64/UserInterface/Debugger/Debugger-Symbols.h index bfbc90176..06ccb71e5 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-Symbols.h +++ b/Source/Project64/UserInterface/Debugger/Debugger-Symbols.h @@ -20,7 +20,7 @@ class CDebugSymbols : public CDialogResize { private: - CListViewCtrlVarDPI m_SymbolsListView; + CListViewCtrl m_SymbolsListView; CAddSymbolDlg m_AddSymbolDlg; HANDLE m_AutoRefreshThread;