Replace GetSystemMetrics with new dpi manager's ones

- remove unneeded declarations in NppDarkMode.h
ref 5123016#r142224732

ref #14959

Close #15171
pull/15173/head
ozone10 2024-05-21 19:17:59 +02:00 committed by Don Ho
parent 49340a8707
commit 4ad57c1dd1
4 changed files with 9 additions and 14 deletions

View File

@ -2576,7 +2576,7 @@ namespace NppDarkMode
} }
} }
LRESULT darkToolBarNotifyCustomDraw(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, bool isPlugin) static LRESULT darkToolBarNotifyCustomDraw(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, bool isPlugin)
{ {
auto nmtbcd = reinterpret_cast<LPNMTBCUSTOMDRAW>(lParam); auto nmtbcd = reinterpret_cast<LPNMTBCUSTOMDRAW>(lParam);
static int roundCornerValue = 0; static int roundCornerValue = 0;
@ -2672,7 +2672,7 @@ namespace NppDarkMode
return ::DefSubclassProc(hWnd, uMsg, wParam, lParam); return ::DefSubclassProc(hWnd, uMsg, wParam, lParam);
} }
LRESULT darkListViewNotifyCustomDraw(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, bool isPlugin) static LRESULT darkListViewNotifyCustomDraw(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, bool isPlugin)
{ {
auto lplvcd = reinterpret_cast<LPNMLVCUSTOMDRAW>(lParam); auto lplvcd = reinterpret_cast<LPNMLVCUSTOMDRAW>(lParam);
@ -2732,7 +2732,7 @@ namespace NppDarkMode
return ::DefSubclassProc(hWnd, uMsg, wParam, lParam); return ::DefSubclassProc(hWnd, uMsg, wParam, lParam);
} }
LRESULT darkTreeViewNotifyCustomDraw(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, bool isPlugin) static LRESULT darkTreeViewNotifyCustomDraw(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, bool isPlugin)
{ {
auto lptvcd = reinterpret_cast<LPNMTVCUSTOMDRAW>(lParam); auto lptvcd = reinterpret_cast<LPNMTVCUSTOMDRAW>(lParam);
@ -3311,7 +3311,7 @@ namespace NppDarkMode
} }
} }
BOOL CALLBACK enumAutocompleteProc(HWND hwnd, LPARAM /*lParam*/) static BOOL CALLBACK enumAutocompleteProc(HWND hwnd, LPARAM /*lParam*/)
{ {
constexpr size_t classNameLen = 16; constexpr size_t classNameLen = 16;
TCHAR className[classNameLen]{}; TCHAR className[classNameLen]{};
@ -3330,7 +3330,7 @@ namespace NppDarkMode
// set dark scrollbar for autocomplete list // set dark scrollbar for autocomplete list
void setDarkAutoCompletion() void setDarkAutoCompletion()
{ {
::EnumThreadWindows(::GetCurrentThreadId(), (WNDENUMPROC)enumAutocompleteProc, 0); ::EnumThreadWindows(::GetCurrentThreadId(), enumAutocompleteProc, 0);
} }
LRESULT onCtlColor(HDC hdc) LRESULT onCtlColor(HDC hdc)

View File

@ -215,10 +215,6 @@ namespace NppDarkMode
void autoSubclassAndThemeChildControls(HWND hwndParent, bool subclass = true, bool theme = true); void autoSubclassAndThemeChildControls(HWND hwndParent, bool subclass = true, bool theme = true);
void autoThemeChildControls(HWND hwndParent); void autoThemeChildControls(HWND hwndParent);
static LRESULT darkToolBarNotifyCustomDraw(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, bool isPlugin);
static LRESULT darkListViewNotifyCustomDraw(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, bool isPlugin);
static LRESULT darkTreeViewNotifyCustomDraw(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, bool isPlugin);
void autoSubclassAndThemePluginDockWindow(HWND hwnd); void autoSubclassAndThemePluginDockWindow(HWND hwnd);
ULONG autoSubclassAndThemePlugin(HWND hwnd, ULONG dmFlags); ULONG autoSubclassAndThemePlugin(HWND hwnd, ULONG dmFlags);
void autoSubclassAndThemeWindowNotify(HWND hwnd); void autoSubclassAndThemeWindowNotify(HWND hwnd);
@ -236,7 +232,6 @@ namespace NppDarkMode
bool isThemeDark(); bool isThemeDark();
void setBorder(HWND hwnd, bool border = true); void setBorder(HWND hwnd, bool border = true);
BOOL CALLBACK enumAutocompleteProc(HWND hwnd, LPARAM lParam);
void setDarkAutoCompletion(); void setDarkAutoCompletion();
LRESULT onCtlColor(HDC hdc); LRESULT onCtlColor(HDC hdc);

View File

@ -145,7 +145,7 @@ void PluginsAdminDlg::create(int dialogID, bool isRTL, bool msgDestParent)
RECT rcDesc{}; RECT rcDesc{};
getMappedChildRect(IDC_PLUGINADM_EDIT, rcDesc); getMappedChildRect(IDC_PLUGINADM_EDIT, rcDesc);
const long margeX = ::GetSystemMetrics(SM_CXEDGE); const long margeX = _dpiManager.getSystemMetricsForDpi(SM_CXEDGE);
const long margeY = _dpiManager.scale(13); const long margeY = _dpiManager.scale(13);
rect.bottom = rcDesc.bottom + margeY; rect.bottom = rcDesc.bottom + margeY;
@ -158,7 +158,7 @@ void PluginsAdminDlg::create(int dialogID, bool isRTL, bool msgDestParent)
RECT listRect{ RECT listRect{
rcDesc.left - margeX, rcDesc.left - margeX,
rcSearch.bottom + margeY, rcSearch.bottom + margeY,
rcDesc.right + ::GetSystemMetrics(SM_CXVSCROLL) + margeX, rcDesc.right + _dpiManager.getSystemMetricsForDpi(SM_CXVSCROLL) + margeX,
rcDesc.top - margeY rcDesc.top - margeY
}; };

View File

@ -5113,8 +5113,8 @@ void DelimiterSubDlg::calcCtrlsPos()
getMappedChildRect(IDD_STATIC_OPENDELIMITER, rcOpen); getMappedChildRect(IDD_STATIC_OPENDELIMITER, rcOpen);
getMappedChildRect(IDC_EDIT_OPENDELIMITER, rcOpenEdit); getMappedChildRect(IDC_EDIT_OPENDELIMITER, rcOpenEdit);
_gapEditHor = (rcBlabla.left - rcOpenEdit.right) - ::GetSystemMetrics(SM_CXEDGE); _gapEditHor = (rcBlabla.left - rcOpenEdit.right) - _dpiManager.getSystemMetricsForDpi(SM_CXEDGE);
_gapEditVer = (rcBlabla.top - rcOpenEdit.top) + ::GetSystemMetrics(SM_CYEDGE); _gapEditVer = (rcBlabla.top - rcOpenEdit.top) + _dpiManager.getSystemMetricsForDpi(SM_CYEDGE);
_gapText = (rcBlabla.left - rcOpen.right); _gapText = (rcBlabla.left - rcOpen.right);
} }