diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 3285ef4be..157872891 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -347,8 +347,9 @@ LRESULT Notepad_plus::init(HWND hwnd) ::SendMessage(_subDocTab.getHSelf(), WM_SETFONT, (WPARAM)hf, MAKELPARAM(TRUE, 0)); } int tabDpiDynamicalHeight = NppParameters::getInstance()->_dpiManager.scaleY(20); - TabCtrl_SetItemSize(_mainDocTab.getHSelf(), 45, tabDpiDynamicalHeight); - TabCtrl_SetItemSize(_subDocTab.getHSelf(), 45, tabDpiDynamicalHeight); + int tabDpiDynamicalWidth = NppParameters::getInstance()->_dpiManager.scaleX(45); + TabCtrl_SetItemSize(_mainDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight); + TabCtrl_SetItemSize(_subDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight); } _mainDocTab.display(); diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index bd75c272f..9eb78abbe 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -1269,9 +1269,10 @@ void Notepad_plus::command(int id) int iconDpiDynamicalSize = NppParameters::getInstance()->_dpiManager.scaleY(_toReduceTabBar?12:18); //Resize the tab height + int tabDpiDynamicalWidth = NppParameters::getInstance()->_dpiManager.scaleX(45); int tabDpiDynamicalHeight = NppParameters::getInstance()->_dpiManager.scaleY(_toReduceTabBar?20:25); - TabCtrl_SetItemSize(_mainDocTab.getHSelf(), 45, tabDpiDynamicalHeight); - TabCtrl_SetItemSize(_subDocTab.getHSelf(), 45, tabDpiDynamicalHeight); + TabCtrl_SetItemSize(_mainDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight); + TabCtrl_SetItemSize(_subDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight); _docTabIconList.setIconSize(iconDpiDynamicalSize); //change the font @@ -1297,7 +1298,6 @@ void Notepad_plus::command(int id) { bool isDrag = TabBarPlus::doDragNDropOrNot(); TabBarPlus::doDragNDrop(!isDrag); - //checkMenuItem(IDM_VIEW_LOCKTABBAR, isDrag); break; } @@ -1305,7 +1305,6 @@ void Notepad_plus::command(int id) case IDM_VIEW_DRAWTABBAR_INACIVETAB: { TabBarPlus::setDrawInactiveTab(!TabBarPlus::drawInactiveTab()); - //TabBarPlus::setDrawInactiveTab(!TabBarPlus::drawInactiveTab(), _subDocTab.getHSelf()); break; } case IDM_VIEW_DRAWTABBAR_TOPBAR: @@ -1321,8 +1320,9 @@ void Notepad_plus::command(int id) // This part is just for updating (redraw) the tabs { int tabDpiDynamicalHeight = NppParameters::getInstance()->_dpiManager.scaleY(TabBarPlus::drawTabCloseButton()?21:20); - TabCtrl_SetItemSize(_mainDocTab.getHSelf(), 45, tabDpiDynamicalHeight); - TabCtrl_SetItemSize(_subDocTab.getHSelf(), 45, tabDpiDynamicalHeight); + int tabDpiDynamicalWidth = NppParameters::getInstance()->_dpiManager.scaleX(TabBarPlus::drawTabCloseButton() ? 60:45); + TabCtrl_SetItemSize(_mainDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight); + TabCtrl_SetItemSize(_subDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight); } ::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0); break; diff --git a/PowerEditor/src/WinControls/TabBar/TabBar.cpp b/PowerEditor/src/WinControls/TabBar/TabBar.cpp index 2c80de0da..6e9e24a4b 100644 --- a/PowerEditor/src/WinControls/TabBar/TabBar.cpp +++ b/PowerEditor/src/WinControls/TabBar/TabBar.cpp @@ -348,8 +348,9 @@ void TabBarPlus::doOwnerDrawTab() ::SetWindowLongPtr(_hwndArray[i], GWL_STYLE, style); ::InvalidateRect(_hwndArray[i], NULL, TRUE); - const int base = 6; - ::SendMessage(_hwndArray[i], TCM_SETPADDING, 0, MAKELPARAM(_drawTabCloseButton?base+3:base, 0)); + const int paddingSizeDynamicW = NppParameters::getInstance()->_dpiManager.scaleX(6); + const int paddingSizePlusClosebuttonDynamicW = NppParameters::getInstance()->_dpiManager.scaleX(9); + ::SendMessage(_hwndArray[i], TCM_SETPADDING, 0, MAKELPARAM(_drawTabCloseButton ? paddingSizePlusClosebuttonDynamicW : paddingSizeDynamicW, 0)); } } } @@ -665,7 +666,6 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct) if (!::SendMessage(_hSelf, TCM_GETITEM, nTab, reinterpret_cast(&tci))) { ::MessageBox(NULL, TEXT("! TCM_GETITEM"), TEXT(""), MB_OK); - //return ::CallWindowProc(_tabBarDefaultProc, hwnd, Message, wParam, lParam); } HDC hDC = pDrawItemStruct->hDC; @@ -681,16 +681,17 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct) if (_drawTopBar) { RECT barRect = rect; - + int paddingDynamicSix = NppParameters::getInstance()->_dpiManager.scaleX(6); + int paddingDynamicTwo = NppParameters::getInstance()->_dpiManager.scaleX(2); if (_isVertical) { - barRect.right = barRect.left + 6; - rect.left += 2; + barRect.right = barRect.left + paddingDynamicSix; + rect.left += paddingDynamicTwo; } else { - barRect.bottom = barRect.top + 6; - rect.top += 2; + barRect.bottom = barRect.top + paddingDynamicSix; + rect.top += paddingDynamicTwo; } if (::SendMessage(_hParent, NPPM_INTERNAL_ISFOCUSEDTAB, 0, (LPARAM)_hSelf)) @@ -721,7 +722,6 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct) { if (!_isVertical) { - //closeButtonRect.top += 2; closeButtonRect.left -= 2; } } @@ -729,6 +729,8 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct) { if (_isVertical) closeButtonRect.left += 2; + else + closeButtonRect.left += NppParameters::getInstance()->_dpiManager.scaleX(2); } @@ -750,15 +752,17 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct) BITMAP bmp; ::GetObject(hBmp, sizeof(bmp), &bmp); + int bmDpiDynamicalWidth = NppParameters::getInstance()->_dpiManager.scaleX(bmp.bmWidth); + int bmDpiDynamicalHeight = NppParameters::getInstance()->_dpiManager.scaleY(bmp.bmHeight); + if (_isVertical) - rect.top = closeButtonRect.top + bmp.bmHeight; + rect.top = closeButtonRect.top + bmDpiDynamicalHeight; else rect.right = closeButtonRect.left; - int bmDpiDynamicalWidth = NppParameters::getInstance()->_dpiManager.scaleX(bmp.bmWidth); - int bmDpiDynamicalHeight = NppParameters::getInstance()->_dpiManager.scaleY(bmp.bmHeight); + ::SelectObject(hdcMemory, hBmp); - ::BitBlt(hDC, closeButtonRect.left, closeButtonRect.top, bmDpiDynamicalWidth, bmDpiDynamicalHeight, hdcMemory, 0, 0, SRCCOPY); + ::StretchBlt(hDC, closeButtonRect.left, closeButtonRect.top, bmDpiDynamicalWidth, bmDpiDynamicalHeight, hdcMemory, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY); ::DeleteDC(hdcMemory); ::DeleteObject(hBmp); } @@ -781,13 +785,10 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct) RECT & imageRect = info.rcImage; if (_isVertical) - xPos = (rect.left + (rect.right - rect.left)/2 + 2) - (imageRect.right - imageRect.left)/2; + xPos = (rect.left + (rect.right - rect.left) / 2 + NppParameters::getInstance()->_dpiManager.scaleX(2)) - (imageRect.right - imageRect.left) / 2; else - yPos = (rect.top + (rect.bottom - rect.top)/2 + (isSelected?0:2)) - (imageRect.bottom - imageRect.top)/2; + yPos = (rect.top + (rect.bottom - rect.top) / 2 + (isSelected ? 0 : NppParameters::getInstance()->_dpiManager.scaleX(2))) - (imageRect.bottom - imageRect.top) / 2; - if (isSelected) - marge = spaceUnit*2; - else marge = spaceUnit; if (_isVertical) @@ -861,8 +862,8 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct) if (_isVertical) { - rect.bottom -= 2; - rect.left += ::GetSystemMetrics(SM_CXEDGE) + 4; + rect.bottom -= NppParameters::getInstance()->_dpiManager.scaleY(2); + rect.left += ::GetSystemMetrics(SM_CXEDGE) + NppParameters::getInstance()->_dpiManager.scaleX(4); rect.top += (_drawTabCloseButton)?spaceUnit:0; Flags |= DT_BOTTOM; @@ -870,7 +871,7 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct) else { rect.top -= ::GetSystemMetrics(SM_CYEDGE); - rect.top += 3; + rect.top += NppParameters::getInstance()->_dpiManager.scaleY(3); rect.left += _drawTabCloseButton?spaceUnit:0; Flags |= DT_VCENTER; @@ -881,9 +882,9 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct) ::SetTextColor(hDC, _inactiveTextColour); if (_isVertical) { - rect.top += 2; - rect.bottom += 4; - rect.left += ::GetSystemMetrics(SM_CXEDGE) + 2; + rect.top += NppParameters::getInstance()->_dpiManager.scaleY(2); + rect.bottom += NppParameters::getInstance()->_dpiManager.scaleY(4); + rect.left += ::GetSystemMetrics(SM_CXEDGE) + NppParameters::getInstance()->_dpiManager.scaleX(2); } else { @@ -984,6 +985,14 @@ void TabBarPlus::exchangeItemData(POINT point) } +CloseButtonZone::CloseButtonZone() +{ + _width = NppParameters::getInstance()->_dpiManager.scaleX(11); + _hight = NppParameters::getInstance()->_dpiManager.scaleY(11); + _fromTop = NppParameters::getInstance()->_dpiManager.scaleY(5); + _fromRight = NppParameters::getInstance()->_dpiManager.scaleX(3); +} + bool CloseButtonZone::isHit(int x, int y, const RECT & testZone) const { if (((x + _width + _fromRight) < testZone.right) || (x > (testZone.right - _fromRight))) diff --git a/PowerEditor/src/WinControls/TabBar/TabBar.h b/PowerEditor/src/WinControls/TabBar/TabBar.h index 62ff21a87..ab2567c82 100644 --- a/PowerEditor/src/WinControls/TabBar/TabBar.h +++ b/PowerEditor/src/WinControls/TabBar/TabBar.h @@ -129,7 +129,7 @@ protected: struct CloseButtonZone { - CloseButtonZone(): _width(11), _hight(11), _fromTop(5), _fromRight(3){}; + CloseButtonZone(); bool isHit(int x, int y, const RECT & testZone) const; RECT getButtonRectFrom(const RECT & tabItemRect) const; diff --git a/readme.md b/readme.md index 559b912dc..a1e69d5d6 100644 --- a/readme.md +++ b/readme.md @@ -12,28 +12,26 @@ There should be several ways to generate Notepad++ binaries, here we show you on * SciLexer.dll: Visual Studio 2013 (with nmake) notepad++.exe: -Double click on Notepad++\trunk\PowerEditor\visual.net\notepadPlus.vcproj to launch Notepad++ project in Visual Studio, then build it with the mode you want, that's it. +Double click on `PowerEditor\visual.net\notepadPlus.vcproj` to launch Notepad++ project in Visual Studio, then build it with the mode you want, that's it. SciLexer.dll: From version 6.0, SciLexer.dll comes with release contains boost's PCRE (Perl Compatible Regular Expressions) feature. Therefore Boost (http://www.boost.org/) is needed to compile Scintilla in order to have PCRE support. Here are the instructions to build SciLexer.dll for Notepad++: -1. Download source code of Boost from Boost site (http://www.boost.org/). v1.55 should be used with VS 2013. Then unzip it. In my case, "boost_1_55_0" is copied in "C:\sources\" -2. go to Notepad++\trunk\scintilla\boostregex\ then run BuildBoost.bat with your boost path. In my case: - BuildBoost.bat C:\sources\boost_1_55_0 -3. go in Notepad++\trunk\scintilla\win32\ then run "nmake -f scintilla.mak" + 1. Download source code of Boost from Boost site (http://www.boost.org/). v1.55 should be used with VS 2013. Then unzip it. In my case, "boost_1_55_0" is copied in `C:\sources\` + 2. Go to `scintilla\boostregex\` then run BuildBoost.bat with your boost path. In my case: `BuildBoost.bat C:\sources\boost_1_55_0` + 3. Go in `scintilla\win32\` then run `nmake -f scintilla.mak` You can build SciLexer.dll without Boost, ie. with its default POSIX regular expression support instead boost's PCRE one. It will work with notepad++.exe, however some functionalities in Notepad++ may be broken. To build SciLexer.dll without PCRE support: -1. Go in Notepad++\trunk\scintilla\win32 -2. Run nmake with an option: - nmake NOBOOST=1 -f scintilla.mak + 1. Go in `scintilla\win32\` + 2. Run nmake with an option `nmake NOBOOST=1 -f scintilla.mak` -Notepad++ Unicode release binary (notepad++.exe) and Scintilla release binary (SciLexer.dll) will be built in the directories "notepad++\trunk\PowerEditor\bin" and "notepad++\trunk\scintilla\bin" respectively. -You have to copy SciLexer.dll in "notepad++\PowerEditor\bin" in order to launch notepad++.exe +Notepad++ Unicode release binary (notepad++.exe) and Scintilla release binary (SciLexer.dll) will be built in the directories `PowerEditor\bin\` and `scintilla\bin\` respectively. +You have to copy SciLexer.dll in `PowerEditor\bin\` in order to launch notepad++.exe -Go to Notepad++ official site for more information : +Go to Notepad++ official site for more information: http://notepad-plus-plus.org/