Fix narrow splitter under a high DPI environment problem
Also add flage [-udl="My UDL Name"] into Command line argument help dialog box.pull/10220/head
parent
264e1924b0
commit
1182976cc3
|
@ -377,8 +377,9 @@ LRESULT Notepad_plus::init(HWND hwnd)
|
|||
//--Splitter Section--//
|
||||
bool isVertical = (nppGUI._splitterPos == POS_VERTICAL);
|
||||
|
||||
int splitterSizeDyn = nppParam._dpiManager.scaleX(splitterSize);
|
||||
_subSplitter.init(_pPublicInterface->getHinst(), hwnd);
|
||||
_subSplitter.create(&_mainDocTab, &_subDocTab, 8, SplitterMode::DYNAMIC, 50, isVertical);
|
||||
_subSplitter.create(&_mainDocTab, &_subDocTab, splitterSizeDyn, SplitterMode::DYNAMIC, 50, isVertical);
|
||||
|
||||
//--Status Bar Section--//
|
||||
bool willBeShown = nppGUI._statusBarShow;
|
||||
|
@ -4165,8 +4166,8 @@ void Notepad_plus::dockUserDlg()
|
|||
pWindow = &_subSplitter;
|
||||
else
|
||||
pWindow = _pDocTab;
|
||||
|
||||
_pMainSplitter->create(pWindow, ScintillaEditView::getUserDefineDlg(), 8, SplitterMode::RIGHT_FIX, 45);
|
||||
int splitterSizeDyn = NppParameters::getInstance()._dpiManager.scaleX(splitterSize);
|
||||
_pMainSplitter->create(pWindow, ScintillaEditView::getUserDefineDlg(), splitterSizeDyn, SplitterMode::RIGHT_FIX, 45);
|
||||
}
|
||||
|
||||
if (bothActive())
|
||||
|
|
|
@ -16,9 +16,11 @@
|
|||
#pragma once
|
||||
#include "Notepad_plus.h"
|
||||
|
||||
const int splitterSize = 8;
|
||||
|
||||
const TCHAR COMMAND_ARG_HELP[] = TEXT("Usage :\r\
|
||||
\r\
|
||||
notepad++ [--help] [-multiInst] [-noPlugin] [-lLanguage] [-LlangCode] [-nLineNumber] [-cColumnNumber] [-pPosition] [-xLeftPos] [-yTopPos] [-nosession] [-notabbar] [-ro] [-systemtray] [-loadingTime] [-alwaysOnTop] [-openSession] [-r] [-qn=\"Easter egg name\" | -qt=\"a text to display.\" | -qf=\"D:\\my quote.txt\"] [-qSpeed1|2|3] [-quickPrint] [-settingsDir=\"d:\\your settings dir\\\"] [-openFoldersAsWorkspace] [-titleAdd=\"additional title bar text\"][filePath]\r\
|
||||
notepad++ [--help] [-multiInst] [-noPlugin] [-lLanguage] [-udl=\"My UDL Name\"] [-LlangCode] [-nLineNumber] [-cColumnNumber] [-pPosition] [-xLeftPos] [-yTopPos] [-nosession] [-notabbar] [-ro] [-systemtray] [-loadingTime] [-alwaysOnTop] [-openSession] [-r] [-qn=\"Easter egg name\" | -qt=\"a text to display.\" | -qf=\"D:\\my quote.txt\"] [-qSpeed1|2|3] [-quickPrint] [-settingsDir=\"d:\\your settings dir\\\"] [-openFoldersAsWorkspace] [-titleAdd=\"additional title bar text\"][filePath]\r\
|
||||
\r\
|
||||
--help : This help message\r\
|
||||
-multiInst : Launch another Notepad++ instance\r\
|
||||
|
|
|
@ -1545,8 +1545,8 @@ void Notepad_plus::command(int id)
|
|||
pWindow = &_subSplitter;
|
||||
else
|
||||
pWindow = _pDocTab;
|
||||
|
||||
_pMainSplitter->create(pWindow, ScintillaEditView::getUserDefineDlg(), 8, SplitterMode::RIGHT_FIX, 45);
|
||||
int splitterSizeDyn = NppParameters::getInstance()._dpiManager.scaleX(splitterSize);
|
||||
_pMainSplitter->create(pWindow, ScintillaEditView::getUserDefineDlg(), splitterSizeDyn, SplitterMode::RIGHT_FIX, 45);
|
||||
}
|
||||
|
||||
_pMainWindow = _pMainSplitter;
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <stdexcept>
|
||||
#include <windows.h>
|
||||
#include "Splitter.h"
|
||||
#include "Parameters.h"
|
||||
#include "NppDarkMode.h"
|
||||
|
||||
bool Splitter::_isHorizontalRegistered = false;
|
||||
|
@ -541,7 +542,9 @@ void Splitter::drawSplitter()
|
|||
hBrushTop = ::GetSysColorBrush(COLOR_3DSHADOW);
|
||||
}
|
||||
|
||||
if ((_splitterSize >= 4) && (_dwFlags & SV_RESIZEWTHPERCNT))
|
||||
DPIManager& dpiMgr = NppParameters::getInstance()._dpiManager;
|
||||
|
||||
if ((_splitterSize >= dpiMgr.scaleX(4)) && (_dwFlags & SV_RESIZEWTHPERCNT))
|
||||
{
|
||||
adjustZoneToDraw(TLrc, ZONE_TYPE::topLeft);
|
||||
adjustZoneToDraw(BRrc, ZONE_TYPE::bottomRight);
|
||||
|
@ -551,18 +554,18 @@ void Splitter::drawSplitter()
|
|||
if (isVertical())
|
||||
{
|
||||
rcToDraw2.top = (_dwFlags & SV_RESIZEWTHPERCNT) ? _clickZone2TL.bottom : 0;
|
||||
rcToDraw2.bottom = rcToDraw2.top + 2;
|
||||
rcToDraw2.bottom = rcToDraw2.top + dpiMgr.scaleX(2);
|
||||
|
||||
rcToDraw1.top = rcToDraw2.top + 1;
|
||||
rcToDraw1.bottom = rcToDraw1.top + 2;
|
||||
rcToDraw1.top = rcToDraw2.top + dpiMgr.scaleX(1);
|
||||
rcToDraw1.bottom = rcToDraw1.top + dpiMgr.scaleX(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
rcToDraw2.top = 1;
|
||||
rcToDraw2.bottom = 3;
|
||||
rcToDraw2.top = dpiMgr.scaleX(1);
|
||||
rcToDraw2.bottom = dpiMgr.scaleX(3);
|
||||
|
||||
rcToDraw1.top = 2;
|
||||
rcToDraw1.bottom = 4;
|
||||
rcToDraw1.top = dpiMgr.scaleX(2);
|
||||
rcToDraw1.bottom = dpiMgr.scaleX(4);
|
||||
}
|
||||
|
||||
int bottom = 0;
|
||||
|
@ -575,39 +578,40 @@ void Splitter::drawSplitter()
|
|||
{
|
||||
if (isVertical())
|
||||
{
|
||||
rcToDraw2.left = 1;
|
||||
rcToDraw2.right = 3;
|
||||
rcToDraw2.left = dpiMgr.scaleX(1);
|
||||
rcToDraw2.right = dpiMgr.scaleX(3);
|
||||
|
||||
rcToDraw1.left = 2;
|
||||
rcToDraw1.right = 4;
|
||||
rcToDraw1.left = dpiMgr.scaleX(2);
|
||||
rcToDraw1.right = dpiMgr.scaleX(4);
|
||||
}
|
||||
else
|
||||
{
|
||||
rcToDraw2.left = _clickZone2TL.right;
|
||||
rcToDraw2.right = rcToDraw2.left + 2;
|
||||
rcToDraw2.right = rcToDraw2.left + dpiMgr.scaleX(2);
|
||||
|
||||
rcToDraw1.left = rcToDraw2.left;
|
||||
rcToDraw1.right = rcToDraw1.left + 2;
|
||||
rcToDraw1.right = rcToDraw1.left + dpiMgr.scaleX(2);
|
||||
}
|
||||
|
||||
int n = dpiMgr.scaleX(4);
|
||||
while (rcToDraw1.right <= (isVertical() ? rc.right : rc.right - _clickZone2BR.right))
|
||||
{
|
||||
::FillRect(hdc, &rcToDraw1, hBrush);
|
||||
::FillRect(hdc, &rcToDraw2, hBrushTop);
|
||||
|
||||
rcToDraw2.left += 4;
|
||||
rcToDraw2.right += 4;
|
||||
rcToDraw1.left += 4;
|
||||
rcToDraw1.right += 4;
|
||||
rcToDraw2.left += n;
|
||||
rcToDraw2.right += n;
|
||||
rcToDraw1.left += n;
|
||||
rcToDraw1.right += n;
|
||||
}
|
||||
|
||||
rcToDraw2.top += 4;
|
||||
rcToDraw2.bottom += 4;
|
||||
rcToDraw1.top += 4;
|
||||
rcToDraw1.bottom += 4;
|
||||
rcToDraw2.top += n;
|
||||
rcToDraw2.bottom += n;
|
||||
rcToDraw1.top += n;
|
||||
rcToDraw1.bottom += n;
|
||||
}
|
||||
|
||||
if ((_splitterSize >= 4) && (_dwFlags & SV_RESIZEWTHPERCNT))
|
||||
if ((_splitterSize >= dpiMgr.scaleX(4)) && (_dwFlags & SV_RESIZEWTHPERCNT))
|
||||
paintArrow(hdc, BRrc, isVertical() ? Arrow::right : Arrow::down);
|
||||
|
||||
if (isDarkMode)
|
||||
|
@ -648,8 +652,10 @@ void Splitter::rotate()
|
|||
void Splitter::paintArrow(HDC hdc, const RECT &rect, Arrow arrowDir)
|
||||
{
|
||||
RECT rc;
|
||||
rc.left = rect.left; rc.top = rect.top;
|
||||
rc.right = rect.right; rc.bottom = rect.bottom;
|
||||
rc.left = rect.left;
|
||||
rc.top = rect.top;
|
||||
rc.right = rect.right;
|
||||
rc.bottom = rect.bottom;
|
||||
|
||||
switch (arrowDir)
|
||||
{
|
||||
|
@ -658,7 +664,6 @@ void Splitter::paintArrow(HDC hdc, const RECT &rect, Arrow arrowDir)
|
|||
int x = rc.right;
|
||||
int y = rc.top;
|
||||
|
||||
//::MoveToEx(hdc, x, y, NULL);
|
||||
for (; (x > rc.left) && (y != rc.bottom) ; --x)
|
||||
{
|
||||
::MoveToEx(hdc, x, y++, NULL);
|
||||
|
@ -672,7 +677,6 @@ void Splitter::paintArrow(HDC hdc, const RECT &rect, Arrow arrowDir)
|
|||
int x = rc.left;
|
||||
int y = rc.top;
|
||||
|
||||
//::MoveToEx(hdc, x, y, NULL);
|
||||
for (; (x < rc.right) && (y != rc.bottom) ; ++x)
|
||||
{
|
||||
::MoveToEx(hdc, x, y++, NULL);
|
||||
|
@ -686,7 +690,6 @@ void Splitter::paintArrow(HDC hdc, const RECT &rect, Arrow arrowDir)
|
|||
int x = rc.left;
|
||||
int y = rc.bottom;
|
||||
|
||||
//::MoveToEx(hdc, x, y, NULL);
|
||||
for (; (y > rc.top) && (x != rc.right) ; --y)
|
||||
{
|
||||
::MoveToEx(hdc, x++, y, NULL);
|
||||
|
@ -700,7 +703,6 @@ void Splitter::paintArrow(HDC hdc, const RECT &rect, Arrow arrowDir)
|
|||
int x = rc.left;
|
||||
int y = rc.top;
|
||||
|
||||
//::MoveToEx(hdc, x, y, NULL);
|
||||
for (; (y < rc.bottom) && (x != rc.right) ; ++y)
|
||||
{
|
||||
::MoveToEx(hdc, x++, y, NULL);
|
||||
|
|
|
@ -38,7 +38,7 @@ class SplitterContainer : public Window
|
|||
public :
|
||||
virtual ~SplitterContainer() = default;
|
||||
|
||||
void create(Window *pWin0, Window *pWin1, int splitterSize = 4,
|
||||
void create(Window *pWin0, Window *pWin1, int splitterSize,
|
||||
SplitterMode mode = SplitterMode::DYNAMIC, int ratio = 50, bool _isVertical = true);
|
||||
|
||||
void destroy();
|
||||
|
|
Loading…
Reference in New Issue