From b94b9d8c61f6eb737ae521f45c744afb108a0720 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Wed, 12 Feb 2014 10:14:22 +0000 Subject: [PATCH] [NEW_FEATURE] Make DPI-aware for Shortcutmapper and Preference Dialog. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1174 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/WinControls/Grid/ShortcutMapper.cpp | 10 ++++++++++ PowerEditor/src/WinControls/Grid/ShortcutMapper.h | 8 +------- .../src/WinControls/Preference/preferenceDlg.cpp | 7 ++++--- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/PowerEditor/src/WinControls/Grid/ShortcutMapper.cpp b/PowerEditor/src/WinControls/Grid/ShortcutMapper.cpp index d7c3b57b7..002d48bcb 100644 --- a/PowerEditor/src/WinControls/Grid/ShortcutMapper.cpp +++ b/PowerEditor/src/WinControls/Grid/ShortcutMapper.cpp @@ -49,6 +49,16 @@ void ShortcutMapper::initTabs() { TabCtrl_SetCurSel(_hTabCtrl, int(_currentState)); } +void ShortcutMapper::getClientRect(RECT & rc) const +{ + Window::getClientRect(rc); + + rc.top += NppParameters::getInstance()->_dpiManager.scaleY(40); + rc.bottom -= NppParameters::getInstance()->_dpiManager.scaleY(20); + rc.left += NppParameters::getInstance()->_dpiManager.scaleX(5); + +} + void ShortcutMapper::translateTab(int index, const TCHAR * newname) { if (index < 0 || index > 4) return; diff --git a/PowerEditor/src/WinControls/Grid/ShortcutMapper.h b/PowerEditor/src/WinControls/Grid/ShortcutMapper.h index bb691e38c..5a41b30f3 100644 --- a/PowerEditor/src/WinControls/Grid/ShortcutMapper.h +++ b/PowerEditor/src/WinControls/Grid/ShortcutMapper.h @@ -75,13 +75,7 @@ public: else ::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_SHORTCUTMAPPER_DLG), _hParent, (DLGPROC)dlgProc, (LPARAM)this); }; - void getClientRect(RECT & rc) const { - Window::getClientRect(rc); - rc.top += 40; - rc.bottom -= 20; - rc.left += 5; - }; - + void getClientRect(RECT & rc) const; void translateTab(int index, const TCHAR * newname); protected : diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index d14bd74ce..8fc8c8f40 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -158,9 +158,10 @@ BOOL CALLBACK PreferenceDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPa makeCategoryList(); RECT rc; getClientRect(rc); - rc.top += 10; - rc.bottom -= 50; - rc.left += 150; + + rc.top += NppParameters::getInstance()->_dpiManager.scaleY(10); + rc.bottom -= NppParameters::getInstance()->_dpiManager.scaleY(50); + rc.left += NppParameters::getInstance()->_dpiManager.scaleX(150); _barsDlg.reSizeTo(rc); _marginsDlg.reSizeTo(rc);