Merge pull request #1 from donho/master

Sync with master repository
This commit is contained in:
MAPJe71 2015-05-01 20:47:22 +02:00
commit f43a4025be
5 changed files with 52 additions and 44 deletions

View File

@ -347,8 +347,9 @@ LRESULT Notepad_plus::init(HWND hwnd)
::SendMessage(_subDocTab.getHSelf(), WM_SETFONT, (WPARAM)hf, MAKELPARAM(TRUE, 0)); ::SendMessage(_subDocTab.getHSelf(), WM_SETFONT, (WPARAM)hf, MAKELPARAM(TRUE, 0));
} }
int tabDpiDynamicalHeight = NppParameters::getInstance()->_dpiManager.scaleY(20); int tabDpiDynamicalHeight = NppParameters::getInstance()->_dpiManager.scaleY(20);
TabCtrl_SetItemSize(_mainDocTab.getHSelf(), 45, tabDpiDynamicalHeight); int tabDpiDynamicalWidth = NppParameters::getInstance()->_dpiManager.scaleX(45);
TabCtrl_SetItemSize(_subDocTab.getHSelf(), 45, tabDpiDynamicalHeight); TabCtrl_SetItemSize(_mainDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight);
TabCtrl_SetItemSize(_subDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight);
} }
_mainDocTab.display(); _mainDocTab.display();

View File

@ -1269,9 +1269,10 @@ void Notepad_plus::command(int id)
int iconDpiDynamicalSize = NppParameters::getInstance()->_dpiManager.scaleY(_toReduceTabBar?12:18); int iconDpiDynamicalSize = NppParameters::getInstance()->_dpiManager.scaleY(_toReduceTabBar?12:18);
//Resize the tab height //Resize the tab height
int tabDpiDynamicalWidth = NppParameters::getInstance()->_dpiManager.scaleX(45);
int tabDpiDynamicalHeight = NppParameters::getInstance()->_dpiManager.scaleY(_toReduceTabBar?20:25); int tabDpiDynamicalHeight = NppParameters::getInstance()->_dpiManager.scaleY(_toReduceTabBar?20:25);
TabCtrl_SetItemSize(_mainDocTab.getHSelf(), 45, tabDpiDynamicalHeight); TabCtrl_SetItemSize(_mainDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight);
TabCtrl_SetItemSize(_subDocTab.getHSelf(), 45, tabDpiDynamicalHeight); TabCtrl_SetItemSize(_subDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight);
_docTabIconList.setIconSize(iconDpiDynamicalSize); _docTabIconList.setIconSize(iconDpiDynamicalSize);
//change the font //change the font
@ -1297,7 +1298,6 @@ void Notepad_plus::command(int id)
{ {
bool isDrag = TabBarPlus::doDragNDropOrNot(); bool isDrag = TabBarPlus::doDragNDropOrNot();
TabBarPlus::doDragNDrop(!isDrag); TabBarPlus::doDragNDrop(!isDrag);
//checkMenuItem(IDM_VIEW_LOCKTABBAR, isDrag);
break; break;
} }
@ -1305,7 +1305,6 @@ void Notepad_plus::command(int id)
case IDM_VIEW_DRAWTABBAR_INACIVETAB: case IDM_VIEW_DRAWTABBAR_INACIVETAB:
{ {
TabBarPlus::setDrawInactiveTab(!TabBarPlus::drawInactiveTab()); TabBarPlus::setDrawInactiveTab(!TabBarPlus::drawInactiveTab());
//TabBarPlus::setDrawInactiveTab(!TabBarPlus::drawInactiveTab(), _subDocTab.getHSelf());
break; break;
} }
case IDM_VIEW_DRAWTABBAR_TOPBAR: case IDM_VIEW_DRAWTABBAR_TOPBAR:
@ -1321,8 +1320,9 @@ void Notepad_plus::command(int id)
// This part is just for updating (redraw) the tabs // This part is just for updating (redraw) the tabs
{ {
int tabDpiDynamicalHeight = NppParameters::getInstance()->_dpiManager.scaleY(TabBarPlus::drawTabCloseButton()?21:20); int tabDpiDynamicalHeight = NppParameters::getInstance()->_dpiManager.scaleY(TabBarPlus::drawTabCloseButton()?21:20);
TabCtrl_SetItemSize(_mainDocTab.getHSelf(), 45, tabDpiDynamicalHeight); int tabDpiDynamicalWidth = NppParameters::getInstance()->_dpiManager.scaleX(TabBarPlus::drawTabCloseButton() ? 60:45);
TabCtrl_SetItemSize(_subDocTab.getHSelf(), 45, tabDpiDynamicalHeight); TabCtrl_SetItemSize(_mainDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight);
TabCtrl_SetItemSize(_subDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight);
} }
::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0); ::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0);
break; break;

View File

@ -348,8 +348,9 @@ void TabBarPlus::doOwnerDrawTab()
::SetWindowLongPtr(_hwndArray[i], GWL_STYLE, style); ::SetWindowLongPtr(_hwndArray[i], GWL_STYLE, style);
::InvalidateRect(_hwndArray[i], NULL, TRUE); ::InvalidateRect(_hwndArray[i], NULL, TRUE);
const int base = 6; const int paddingSizeDynamicW = NppParameters::getInstance()->_dpiManager.scaleX(6);
::SendMessage(_hwndArray[i], TCM_SETPADDING, 0, MAKELPARAM(_drawTabCloseButton?base+3:base, 0)); 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<LPARAM>(&tci))) if (!::SendMessage(_hSelf, TCM_GETITEM, nTab, reinterpret_cast<LPARAM>(&tci)))
{ {
::MessageBox(NULL, TEXT("! TCM_GETITEM"), TEXT(""), MB_OK); ::MessageBox(NULL, TEXT("! TCM_GETITEM"), TEXT(""), MB_OK);
//return ::CallWindowProc(_tabBarDefaultProc, hwnd, Message, wParam, lParam);
} }
HDC hDC = pDrawItemStruct->hDC; HDC hDC = pDrawItemStruct->hDC;
@ -681,16 +681,17 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct)
if (_drawTopBar) if (_drawTopBar)
{ {
RECT barRect = rect; RECT barRect = rect;
int paddingDynamicSix = NppParameters::getInstance()->_dpiManager.scaleX(6);
int paddingDynamicTwo = NppParameters::getInstance()->_dpiManager.scaleX(2);
if (_isVertical) if (_isVertical)
{ {
barRect.right = barRect.left + 6; barRect.right = barRect.left + paddingDynamicSix;
rect.left += 2; rect.left += paddingDynamicTwo;
} }
else else
{ {
barRect.bottom = barRect.top + 6; barRect.bottom = barRect.top + paddingDynamicSix;
rect.top += 2; rect.top += paddingDynamicTwo;
} }
if (::SendMessage(_hParent, NPPM_INTERNAL_ISFOCUSEDTAB, 0, (LPARAM)_hSelf)) if (::SendMessage(_hParent, NPPM_INTERNAL_ISFOCUSEDTAB, 0, (LPARAM)_hSelf))
@ -721,7 +722,6 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct)
{ {
if (!_isVertical) if (!_isVertical)
{ {
//closeButtonRect.top += 2;
closeButtonRect.left -= 2; closeButtonRect.left -= 2;
} }
} }
@ -729,6 +729,8 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct)
{ {
if (_isVertical) if (_isVertical)
closeButtonRect.left += 2; closeButtonRect.left += 2;
else
closeButtonRect.left += NppParameters::getInstance()->_dpiManager.scaleX(2);
} }
@ -750,15 +752,17 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct)
BITMAP bmp; BITMAP bmp;
::GetObject(hBmp, sizeof(bmp), &bmp); ::GetObject(hBmp, sizeof(bmp), &bmp);
int bmDpiDynamicalWidth = NppParameters::getInstance()->_dpiManager.scaleX(bmp.bmWidth);
int bmDpiDynamicalHeight = NppParameters::getInstance()->_dpiManager.scaleY(bmp.bmHeight);
if (_isVertical) if (_isVertical)
rect.top = closeButtonRect.top + bmp.bmHeight; rect.top = closeButtonRect.top + bmDpiDynamicalHeight;
else else
rect.right = closeButtonRect.left; rect.right = closeButtonRect.left;
int bmDpiDynamicalWidth = NppParameters::getInstance()->_dpiManager.scaleX(bmp.bmWidth);
int bmDpiDynamicalHeight = NppParameters::getInstance()->_dpiManager.scaleY(bmp.bmHeight);
::SelectObject(hdcMemory, hBmp); ::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); ::DeleteDC(hdcMemory);
::DeleteObject(hBmp); ::DeleteObject(hBmp);
} }
@ -781,13 +785,10 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct)
RECT & imageRect = info.rcImage; RECT & imageRect = info.rcImage;
if (_isVertical) 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 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; marge = spaceUnit;
if (_isVertical) if (_isVertical)
@ -861,8 +862,8 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct)
if (_isVertical) if (_isVertical)
{ {
rect.bottom -= 2; rect.bottom -= NppParameters::getInstance()->_dpiManager.scaleY(2);
rect.left += ::GetSystemMetrics(SM_CXEDGE) + 4; rect.left += ::GetSystemMetrics(SM_CXEDGE) + NppParameters::getInstance()->_dpiManager.scaleX(4);
rect.top += (_drawTabCloseButton)?spaceUnit:0; rect.top += (_drawTabCloseButton)?spaceUnit:0;
Flags |= DT_BOTTOM; Flags |= DT_BOTTOM;
@ -870,7 +871,7 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct)
else else
{ {
rect.top -= ::GetSystemMetrics(SM_CYEDGE); rect.top -= ::GetSystemMetrics(SM_CYEDGE);
rect.top += 3; rect.top += NppParameters::getInstance()->_dpiManager.scaleY(3);
rect.left += _drawTabCloseButton?spaceUnit:0; rect.left += _drawTabCloseButton?spaceUnit:0;
Flags |= DT_VCENTER; Flags |= DT_VCENTER;
@ -881,9 +882,9 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct)
::SetTextColor(hDC, _inactiveTextColour); ::SetTextColor(hDC, _inactiveTextColour);
if (_isVertical) if (_isVertical)
{ {
rect.top += 2; rect.top += NppParameters::getInstance()->_dpiManager.scaleY(2);
rect.bottom += 4; rect.bottom += NppParameters::getInstance()->_dpiManager.scaleY(4);
rect.left += ::GetSystemMetrics(SM_CXEDGE) + 2; rect.left += ::GetSystemMetrics(SM_CXEDGE) + NppParameters::getInstance()->_dpiManager.scaleX(2);
} }
else 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 bool CloseButtonZone::isHit(int x, int y, const RECT & testZone) const
{ {
if (((x + _width + _fromRight) < testZone.right) || (x > (testZone.right - _fromRight))) if (((x + _width + _fromRight) < testZone.right) || (x > (testZone.right - _fromRight)))

View File

@ -129,7 +129,7 @@ protected:
struct CloseButtonZone { struct CloseButtonZone {
CloseButtonZone(): _width(11), _hight(11), _fromTop(5), _fromRight(3){}; CloseButtonZone();
bool isHit(int x, int y, const RECT & testZone) const; bool isHit(int x, int y, const RECT & testZone) const;
RECT getButtonRectFrom(const RECT & tabItemRect) const; RECT getButtonRectFrom(const RECT & tabItemRect) const;

View File

@ -12,25 +12,23 @@ There should be several ways to generate Notepad++ binaries, here we show you on
* SciLexer.dll: Visual Studio 2013 (with nmake) * SciLexer.dll: Visual Studio 2013 (with nmake)
notepad++.exe: 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: SciLexer.dll:
From version 6.0, SciLexer.dll comes with release contains boost's PCRE (Perl Compatible Regular Expressions) feature. 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. 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++: 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\" 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: 2. Go to `scintilla\boostregex\` then run BuildBoost.bat with your boost path. In my case: `BuildBoost.bat C:\sources\boost_1_55_0`
BuildBoost.bat C:\sources\boost_1_55_0 3. Go in `scintilla\win32\` then run `nmake -f scintilla.mak`
3. go in Notepad++\trunk\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. 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: To build SciLexer.dll without PCRE support:
1. Go in Notepad++\trunk\scintilla\win32 1. Go in `scintilla\win32\`
2. Run nmake with an option: 2. Run nmake with an option `nmake NOBOOST=1 -f scintilla.mak`
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. 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 "notepad++\PowerEditor\bin" in order to launch notepad++.exe 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: