diff --git a/PowerEditor/src/MISC/md5/md5Dlgs.cpp b/PowerEditor/src/MISC/md5/md5Dlgs.cpp index 1a0ae959e..02de5735e 100644 --- a/PowerEditor/src/MISC/md5/md5Dlgs.cpp +++ b/PowerEditor/src/MISC/md5/md5Dlgs.cpp @@ -87,7 +87,7 @@ intptr_t CALLBACK HashFromFilesDlg::run_dlgProc(UINT message, WPARAM wParam, LPA case WM_DPICHANGED: { - DPIManagerV2::setDpiWP(wParam); + _dpiManager.setDpiWP(wParam); destroy(); _hFont = createFont(L"Courier New", 9, false, _hSelf); @@ -535,7 +535,7 @@ intptr_t CALLBACK HashFromTextDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR case WM_DPICHANGED: { - DPIManagerV2::setDpiWP(wParam); + _dpiManager.setDpiWP(wParam); destroy(); _hFont = createFont(L"Courier New", 9, false, _hSelf); diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp index 1b39165cc..875048816 100644 --- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp @@ -1089,7 +1089,7 @@ intptr_t CALLBACK FindInFinderDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR case WM_DPICHANGED: { - DPIManagerV2::setDpiWP(wParam); + _dpiManager.setDpiWP(wParam); setPositionDpi(lParam); return TRUE; diff --git a/PowerEditor/src/ScintillaComponent/GoToLineDlg.cpp b/PowerEditor/src/ScintillaComponent/GoToLineDlg.cpp index 0364dcb6b..2ddbcfc86 100644 --- a/PowerEditor/src/ScintillaComponent/GoToLineDlg.cpp +++ b/PowerEditor/src/ScintillaComponent/GoToLineDlg.cpp @@ -71,7 +71,7 @@ intptr_t CALLBACK GoToLineDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM l case WM_DPICHANGED: { - DPIManagerV2::setDpiWP(wParam); + _dpiManager.setDpiWP(wParam); setPositionDpi(lParam); return TRUE; diff --git a/PowerEditor/src/ScintillaComponent/UserDefineDialog.cpp b/PowerEditor/src/ScintillaComponent/UserDefineDialog.cpp index fe8e8b28f..c37a7082f 100644 --- a/PowerEditor/src/ScintillaComponent/UserDefineDialog.cpp +++ b/PowerEditor/src/ScintillaComponent/UserDefineDialog.cpp @@ -1156,7 +1156,7 @@ intptr_t CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPA case WM_DPICHANGED: { - DPIManagerV2::setDpiWP(wParam); + _dpiManager.setDpiWP(wParam); setPositionDpi(lParam); return TRUE; @@ -1643,7 +1643,7 @@ intptr_t CALLBACK StringDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPa case WM_DPICHANGED: { - DPIManagerV2::setDpiWP(wParam); + _dpiManager.setDpiWP(wParam); setPositionDpi(lParam); return TRUE; diff --git a/PowerEditor/src/ScintillaComponent/columnEditor.cpp b/PowerEditor/src/ScintillaComponent/columnEditor.cpp index 643c529bd..83995b167 100644 --- a/PowerEditor/src/ScintillaComponent/columnEditor.cpp +++ b/PowerEditor/src/ScintillaComponent/columnEditor.cpp @@ -150,7 +150,7 @@ intptr_t CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR case WM_DPICHANGED: { - DPIManagerV2::setDpiWP(wParam); + _dpiManager.setDpiWP(wParam); setPositionDpi(lParam); return TRUE; diff --git a/PowerEditor/src/WinControls/AboutDlg/AboutDlg.cpp b/PowerEditor/src/WinControls/AboutDlg/AboutDlg.cpp index 1e378aec5..8c0b04dec 100644 --- a/PowerEditor/src/WinControls/AboutDlg/AboutDlg.cpp +++ b/PowerEditor/src/WinControls/AboutDlg/AboutDlg.cpp @@ -95,7 +95,7 @@ intptr_t CALLBACK AboutDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPar case WM_DPICHANGED: { - DPIManagerV2::setDpiWP(wParam); + _dpiManager.setDpiWP(wParam); destroy(); //setPositionDpi(lParam); getClientRect(_rc); @@ -105,7 +105,7 @@ intptr_t CALLBACK AboutDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPar case WM_DRAWITEM: { - const int iconSize = DPIManagerV2::scale(80); + const int iconSize = _dpiManager.scale(80); if (_hIcon == nullptr) { DPIManagerV2::loadIcon(_hInst, MAKEINTRESOURCE(NppDarkMode::isEnabled() ? IDI_CHAMELEON_DM : IDI_CHAMELEON), iconSize, iconSize, &_hIcon); @@ -380,7 +380,7 @@ intptr_t CALLBACK DebugInfoDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM case WM_DPICHANGED: { - DPIManagerV2::setDpiWP(wParam); + _dpiManager.setDpiWP(wParam); getClientRect(_rc); setPositionDpi(lParam); @@ -521,7 +521,7 @@ intptr_t CALLBACK DoSaveOrNotBox::run_dlgProc(UINT message, WPARAM wParam, LPARA case WM_DPICHANGED: { - DPIManagerV2::setDpiWP(wParam); + _dpiManager.setDpiWP(wParam); setPositionDpi(lParam); return TRUE; @@ -639,7 +639,7 @@ intptr_t CALLBACK DoSaveAllBox::run_dlgProc(UINT message, WPARAM wParam, LPARAM case WM_DPICHANGED: { - DPIManagerV2::setDpiWP(wParam); + _dpiManager.setDpiWP(wParam); setPositionDpi(lParam); return TRUE; diff --git a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp index 17c8f1314..b62aa946f 100644 --- a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp +++ b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp @@ -137,7 +137,7 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM _pBgColour->init(_hInst, _hSelf); setDpi(); - const int cpDynamicalSize = DPIManagerV2::scale(25); + const int cpDynamicalSize = _dpiManager.scale(25); move2CtrlRight(IDC_FG_STATIC, _pFgColour->getHSelf(), cpDynamicalSize, cpDynamicalSize); move2CtrlRight(IDC_BG_STATIC, _pBgColour->getHSelf(), cpDynamicalSize, cpDynamicalSize); @@ -268,11 +268,11 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM case WM_DPICHANGED: { - DPIManagerV2::setDpiWP(wParam); + _dpiManager.setDpiWP(wParam); _goToSettings.destroy(); - const int cpDynamicalSize = DPIManagerV2::scale(25); + const int cpDynamicalSize = _dpiManager.scale(25); move2CtrlRight(IDC_FG_STATIC, _pFgColour->getHSelf(), cpDynamicalSize, cpDynamicalSize); move2CtrlRight(IDC_BG_STATIC, _pBgColour->getHSelf(), cpDynamicalSize, cpDynamicalSize); @@ -583,7 +583,7 @@ void WordStyleDlg::move2CtrlRight(int ctrlID, HWND handle2Move, int handle2MoveW RECT rc{}; ::GetWindowRect(::GetDlgItem(_hSelf, ctrlID), &rc); - p.x = rc.right + DPIManagerV2::scale(5); + p.x = rc.right + _dpiManager.scale(5); p.y = rc.top + ((rc.bottom - rc.top) / 2) - handle2MoveHeight / 2; ::ScreenToClient(_hSelf, &p); diff --git a/PowerEditor/src/WinControls/FindCharsInRange/FindCharsInRange.cpp b/PowerEditor/src/WinControls/FindCharsInRange/FindCharsInRange.cpp index 0bd4c12b6..1df910009 100644 --- a/PowerEditor/src/WinControls/FindCharsInRange/FindCharsInRange.cpp +++ b/PowerEditor/src/WinControls/FindCharsInRange/FindCharsInRange.cpp @@ -97,7 +97,7 @@ intptr_t CALLBACK FindCharsInRangeDlg::run_dlgProc(UINT message, WPARAM wParam, case WM_DPICHANGED: { - DPIManagerV2::setDpiWP(wParam); + _dpiManager.setDpiWP(wParam); setPositionDpi(lParam); return TRUE; diff --git a/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.cpp b/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.cpp index 9b4574eed..d5269975b 100644 --- a/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.cpp +++ b/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.cpp @@ -146,7 +146,7 @@ void PluginsAdminDlg::create(int dialogID, bool isRTL, bool msgDestParent) getMappedChildRect(IDC_PLUGINADM_EDIT, rcDesc); const long margeX = ::GetSystemMetrics(SM_CXEDGE); - const long margeY = DPIManagerV2::scale(13); + const long margeY = _dpiManager.scale(13); rect.bottom = rcDesc.bottom + margeY; _tab.reSizeTo(rect); @@ -170,7 +170,7 @@ void PluginsAdminDlg::create(int dialogID, bool isRTL, bool msgDestParent) const COLORREF fgColor = nppParam.getCurrentDefaultFgColor(); const COLORREF bgColor = nppParam.getCurrentDefaultBgColor(); - const size_t szColVer = DPIManagerV2::scale(100); + const size_t szColVer = _dpiManager.scale(100); const size_t szColName = szColVer * 2; auto initListView = [&](PluginViewList& list) -> void { @@ -1177,10 +1177,10 @@ intptr_t CALLBACK PluginsAdminDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR case WM_DPICHANGED: { - DPIManagerV2::setDpiWP(wParam); + _dpiManager.setDpiWP(wParam); _repoLink.destroy(); - const size_t szColVer = DPIManagerV2::scale(100); + const size_t szColVer = _dpiManager.scale(100); const size_t szColName = szColVer * 2; auto setListViewSize = [&](PluginViewList& list) -> void { diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index db55410cb..d687c7559 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -368,26 +368,26 @@ intptr_t CALLBACK PreferenceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM case WM_DPICHANGED: { - DPIManagerV2::setDpiWP(wParam); - _generalSubDlg.setDpiWP(wParam); - _editingSubDlg.setDpiWP(wParam); - _editing2SubDlg.setDpiWP(wParam); - _darkModeSubDlg.setDpiWP(wParam); - _marginsBorderEdgeSubDlg.setDpiWP(wParam); - _miscSubDlg.setDpiWP(wParam); - _fileAssocDlg.setDpiWP(wParam); - _languageSubDlg.setDpiWP(wParam); - _highlightingSubDlg.setDpiWP(wParam); - _printSubDlg.setDpiWP(wParam); - _searchingSubDlg.setDpiWP(wParam); - _newDocumentSubDlg.setDpiWP(wParam); - _defaultDirectorySubDlg.setDpiWP(wParam); - _recentFilesHistorySubDlg.setDpiWP(wParam); - _backupSubDlg.setDpiWP(wParam); - _autoCompletionSubDlg.setDpiWP(wParam); - _multiInstanceSubDlg.setDpiWP(wParam); - _delimiterSubDlg.setDpiWP(wParam); - _performanceSubDlg.setDpiWP(wParam); + _dpiManager.setDpiWP(wParam); + _generalSubDlg.dpiManager().setDpiWP(wParam); + _editingSubDlg.dpiManager().setDpiWP(wParam); + _editing2SubDlg.dpiManager().setDpiWP(wParam); + _darkModeSubDlg.dpiManager().setDpiWP(wParam); + _marginsBorderEdgeSubDlg.dpiManager().setDpiWP(wParam); + _miscSubDlg.dpiManager().setDpiWP(wParam); + _fileAssocDlg.dpiManager().setDpiWP(wParam); + _languageSubDlg.dpiManager().setDpiWP(wParam); + _highlightingSubDlg.dpiManager().setDpiWP(wParam); + _printSubDlg.dpiManager().setDpiWP(wParam); + _searchingSubDlg.dpiManager().setDpiWP(wParam); + _newDocumentSubDlg.dpiManager().setDpiWP(wParam); + _defaultDirectorySubDlg.dpiManager().setDpiWP(wParam); + _recentFilesHistorySubDlg.dpiManager().setDpiWP(wParam); + _backupSubDlg.dpiManager().setDpiWP(wParam); + _autoCompletionSubDlg.dpiManager().setDpiWP(wParam); + _multiInstanceSubDlg.dpiManager().setDpiWP(wParam); + _delimiterSubDlg.dpiManager().setDpiWP(wParam); + _performanceSubDlg.dpiManager().setDpiWP(wParam); setPositionDpi(lParam); @@ -1460,9 +1460,9 @@ void DarkModeSubDlg::move2CtrlLeft(int ctrlID, HWND handle2Move, int handle2Move NppParameters& nppParam = NppParameters::getInstance(); if(nppParam.getNativeLangSpeaker()->isRTL()) - p.x = rc.right + DPIManagerV2::scale(5) + handle2MoveWidth; + p.x = rc.right + _dpiManager.scale(5) + handle2MoveWidth; else - p.x = rc.left - DPIManagerV2::scale(5) - handle2MoveWidth; + p.x = rc.left - _dpiManager.scale(5) - handle2MoveWidth; p.y = rc.top + ((rc.bottom - rc.top) / 2) - handle2MoveHeight / 2; @@ -1542,8 +1542,8 @@ intptr_t CALLBACK DarkModeSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA _pHotEdgeColorPicker->init(_hInst, _hSelf); _pDisabledEdgeColorPicker->init(_hInst, _hSelf); - DPIManagerV2::setDpi(_hSelf); - const int cpDynamicalSize = DPIManagerV2::scale(25); + _dpiManager.setDpi(_hSelf); + const int cpDynamicalSize = _dpiManager.scale(25); move2CtrlLeft(IDD_CUSTOMIZED_COLOR1_STATIC, _pPureBackgroundColorPicker->getHSelf(), cpDynamicalSize, cpDynamicalSize); move2CtrlLeft(IDD_CUSTOMIZED_COLOR2_STATIC, _pHotBackgroundColorPicker->getHSelf(), cpDynamicalSize, cpDynamicalSize); @@ -1659,7 +1659,7 @@ intptr_t CALLBACK DarkModeSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA case WM_DPICHANGED_AFTERPARENT: { - const int cpDynamicalSize = DPIManagerV2::scale(25); + const int cpDynamicalSize = _dpiManager.scale(25); move2CtrlLeft(IDD_CUSTOMIZED_COLOR1_STATIC, _pPureBackgroundColorPicker->getHSelf(), cpDynamicalSize, cpDynamicalSize); move2CtrlLeft(IDD_CUSTOMIZED_COLOR2_STATIC, _pHotBackgroundColorPicker->getHSelf(), cpDynamicalSize, cpDynamicalSize); diff --git a/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp b/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp index ae60278f5..057655662 100644 --- a/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp +++ b/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp @@ -1372,7 +1372,7 @@ intptr_t CALLBACK FileRelocalizerDlg::run_dlgProc(UINT Message, WPARAM wParam, L case WM_DPICHANGED: { - DPIManagerV2::setDpiWP(wParam); + _dpiManager.setDpiWP(wParam); setPositionDpi(lParam); return TRUE; diff --git a/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.cpp b/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.cpp index 2b4269aff..c2d90112b 100644 --- a/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.cpp +++ b/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.cpp @@ -313,7 +313,7 @@ intptr_t CALLBACK RunDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam case WM_DPICHANGED: { - DPIManagerV2::setDpiWP(wParam); + _dpiManager.setDpiWP(wParam); setPositionDpi(lParam); return TRUE; diff --git a/PowerEditor/src/WinControls/StaticDialog/StaticDialog.h b/PowerEditor/src/WinControls/StaticDialog/StaticDialog.h index de3a8f290..aa968edec 100644 --- a/PowerEditor/src/WinControls/StaticDialog/StaticDialog.h +++ b/PowerEditor/src/WinControls/StaticDialog/StaticDialog.h @@ -38,7 +38,7 @@ struct DLGTEMPLATEEX // The structure has more fields but are variable length }; -class StaticDialog : public Window, public DPIManagerV2 +class StaticDialog : public Window { public : virtual ~StaticDialog(); @@ -72,7 +72,7 @@ public : } void setDpi() { - DPIManagerV2::setDpi(_hSelf); + _dpiManager.setDpi(_hSelf); } void setPositionDpi(LPARAM lParam, UINT flags = SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE) { @@ -85,8 +85,12 @@ public : void destroy() override; + DPIManagerV2& dpiManager() { return _dpiManager; } + protected: RECT _rc{}; + DPIManagerV2 _dpiManager; + static intptr_t CALLBACK dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); virtual intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) = 0; diff --git a/PowerEditor/src/WinControls/shortcut/RunMacroDlg.cpp b/PowerEditor/src/WinControls/shortcut/RunMacroDlg.cpp index a35032bcd..4456af590 100644 --- a/PowerEditor/src/WinControls/shortcut/RunMacroDlg.cpp +++ b/PowerEditor/src/WinControls/shortcut/RunMacroDlg.cpp @@ -115,7 +115,7 @@ intptr_t CALLBACK RunMacroDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM l case WM_DPICHANGED: { - DPIManagerV2::setDpiWP(wParam); + _dpiManager.setDpiWP(wParam); setPositionDpi(lParam); return TRUE; diff --git a/PowerEditor/src/WinControls/shortcut/shortcut.cpp b/PowerEditor/src/WinControls/shortcut/shortcut.cpp index f6205225c..a55b2f1d0 100644 --- a/PowerEditor/src/WinControls/shortcut/shortcut.cpp +++ b/PowerEditor/src/WinControls/shortcut/shortcut.cpp @@ -447,7 +447,7 @@ intptr_t CALLBACK Shortcut::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar case WM_DPICHANGED: { - DPIManagerV2::setDpiWP(wParam); + _dpiManager.setDpiWP(wParam); setPositionDpi(lParam); return TRUE; @@ -1129,7 +1129,7 @@ intptr_t CALLBACK ScintillaKeyMap::run_dlgProc(UINT Message, WPARAM wParam, LPAR case WM_DPICHANGED: { - DPIManagerV2::setDpiWP(wParam); + _dpiManager.setDpiWP(wParam); setPositionDpi(lParam); return TRUE; diff --git a/PowerEditor/src/dpiManagerV2.h b/PowerEditor/src/dpiManagerV2.h index 421916011..03db49130 100644 --- a/PowerEditor/src/dpiManagerV2.h +++ b/PowerEditor/src/dpiManagerV2.h @@ -110,22 +110,6 @@ public: return unscale(x, _dpi); } - int scaleX(int x) { - return scale(x); - } - - int unscaleX(int x) { - return unscale(x); - } - - int scaleY(int y) { - return scale(y); - } - - int unscaleY(int y) { - return unscale(y); - } - static int scaleFont(int pt, UINT dpi) { return -(scale(pt, dpi, 72)); }