Add padding options in the edit zonze

Fix #2323
pull/9778/head
Don HO 4 years ago
parent cbf3d2c9cb
commit 1a9307b02d

@ -865,6 +865,10 @@ The comments are here for explanation, it's not necessary to translate them.
You can define several column markers by using white space to separate the different numbers."/>
<Item id="6231" name="Border Width"/>
<Item id="6235" name="No edge"/>
<Item id="6208" name="Padding"/>
<Item id="6209" name="Left"/>
<Item id="6210" name="Right"/>
<Item id="6212" name="Distraction Free"/>
</MarginsBorderEdge>
<NewDoc title="New Document">

@ -822,6 +822,10 @@ Vous pouvez définir plusieurs marqueurs de colonne en utilisant un espace pour
<Item id="6292" name="Largeur dynamique"/>
<Item id="6293" name="Largeur constante"/>
<Item id="6207" name="Afficher la marge de signet"/>
<Item id="6208" name="Padding"/>
<Item id="6209" name="Gauche"/>
<Item id="6210" name="Droite"/>
<Item id="6212" name="Sans distraction"/>
</MarginsBorderEdge>
<NewDoc title="Nouveau document">

@ -829,6 +829,10 @@
使用空格分隔不同數字來定義多個列標記。"/>
<Item id="6231" name="邊框寬度"/>
<Item id="6235" name="無邊框"/>
<Item id="6208" name="填充"/>
<Item id="6209" name="左"/>
<Item id="6210" name="右"/>
<Item id="6212" name="免干擾模式"/>
</MarginsBorderEdge>
<NewDoc title="新文件預設設定">

@ -219,7 +219,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
_mainWindowStatus = WindowMainActive;
_activeView = MAIN_VIEW;
const ScintillaViewParams & svp1 = nppParam.getSVP();
const ScintillaViewParams & svp = nppParam.getSVP();
int tabBarStatus = nppGUI._tabStatus;
@ -243,13 +243,13 @@ LRESULT Notepad_plus::init(HWND hwnd)
_invisibleEditView.wrap(false); // Make sure no slow down
// Configuration of 2 scintilla views
_mainEditView.showMargin(ScintillaEditView::_SC_MARGE_LINENUMBER, svp1._lineNumberMarginShow);
_subEditView.showMargin(ScintillaEditView::_SC_MARGE_LINENUMBER, svp1._lineNumberMarginShow);
_mainEditView.showMargin(ScintillaEditView::_SC_MARGE_SYBOLE, svp1._bookMarkMarginShow);
_subEditView.showMargin(ScintillaEditView::_SC_MARGE_SYBOLE, svp1._bookMarkMarginShow);
_mainEditView.showMargin(ScintillaEditView::_SC_MARGE_LINENUMBER, svp._lineNumberMarginShow);
_subEditView.showMargin(ScintillaEditView::_SC_MARGE_LINENUMBER, svp._lineNumberMarginShow);
_mainEditView.showMargin(ScintillaEditView::_SC_MARGE_SYBOLE, svp._bookMarkMarginShow);
_subEditView.showMargin(ScintillaEditView::_SC_MARGE_SYBOLE, svp._bookMarkMarginShow);
_mainEditView.showIndentGuideLine(svp1._indentGuideLineShow);
_subEditView.showIndentGuideLine(svp1._indentGuideLineShow);
_mainEditView.showIndentGuideLine(svp._indentGuideLineShow);
_subEditView.showIndentGuideLine(svp._indentGuideLineShow);
::SendMessage(hwnd, NPPM_INTERNAL_SETCARETWIDTH, 0, 0);
::SendMessage(hwnd, NPPM_INTERNAL_SETCARETBLINKRATE, 0, 0);
@ -259,53 +259,53 @@ LRESULT Notepad_plus::init(HWND hwnd)
_pluginsAdminDlg.init(_pPublicInterface->getHinst(), hwnd);
//Marker Margin config
_mainEditView.setMakerStyle(svp1._folderStyle);
_subEditView.setMakerStyle(svp1._folderStyle);
_mainEditView.setMakerStyle(svp._folderStyle);
_subEditView.setMakerStyle(svp._folderStyle);
_mainEditView.defineDocType(_mainEditView.getCurrentBuffer()->getLangType());
_subEditView.defineDocType(_subEditView.getCurrentBuffer()->getLangType());
//Line wrap method
_mainEditView.setWrapMode(svp1._lineWrapMethod);
_subEditView.setWrapMode(svp1._lineWrapMethod);
_mainEditView.setWrapMode(svp._lineWrapMethod);
_subEditView.setWrapMode(svp._lineWrapMethod);
_mainEditView.execute(SCI_SETCARETLINEVISIBLE, svp1._currentLineHilitingShow);
_subEditView.execute(SCI_SETCARETLINEVISIBLE, svp1._currentLineHilitingShow);
_mainEditView.execute(SCI_SETCARETLINEVISIBLE, svp._currentLineHilitingShow);
_subEditView.execute(SCI_SETCARETLINEVISIBLE, svp._currentLineHilitingShow);
_mainEditView.execute(SCI_SETENDATLASTLINE, !svp1._scrollBeyondLastLine);
_subEditView.execute(SCI_SETENDATLASTLINE, !svp1._scrollBeyondLastLine);
_mainEditView.execute(SCI_SETENDATLASTLINE, !svp._scrollBeyondLastLine);
_subEditView.execute(SCI_SETENDATLASTLINE, !svp._scrollBeyondLastLine);
if (svp1._doSmoothFont)
if (svp._doSmoothFont)
{
_mainEditView.execute(SCI_SETFONTQUALITY, SC_EFF_QUALITY_LCD_OPTIMIZED);
_subEditView.execute(SCI_SETFONTQUALITY, SC_EFF_QUALITY_LCD_OPTIMIZED);
}
_mainEditView.setBorderEdge(svp1._showBorderEdge);
_subEditView.setBorderEdge(svp1._showBorderEdge);
_mainEditView.setBorderEdge(svp._showBorderEdge);
_subEditView.setBorderEdge(svp._showBorderEdge);
_mainEditView.execute(SCI_SETCARETLINEVISIBLEALWAYS, true);
_subEditView.execute(SCI_SETCARETLINEVISIBLEALWAYS, true);
_mainEditView.wrap(svp1._doWrap);
_subEditView.wrap(svp1._doWrap);
_mainEditView.wrap(svp._doWrap);
_subEditView.wrap(svp._doWrap);
::SendMessage(hwnd, NPPM_INTERNAL_EDGEMULTISETSIZE, 0, 0);
_mainEditView.showEOL(svp1._eolShow);
_subEditView.showEOL(svp1._eolShow);
_mainEditView.showEOL(svp._eolShow);
_subEditView.showEOL(svp._eolShow);
_mainEditView.showWSAndTab(svp1._whiteSpaceShow);
_subEditView.showWSAndTab(svp1._whiteSpaceShow);
_mainEditView.showWSAndTab(svp._whiteSpaceShow);
_subEditView.showWSAndTab(svp._whiteSpaceShow);
_mainEditView.showWrapSymbol(svp1._wrapSymbolShow);
_subEditView.showWrapSymbol(svp1._wrapSymbolShow);
_mainEditView.showWrapSymbol(svp._wrapSymbolShow);
_subEditView.showWrapSymbol(svp._wrapSymbolShow);
_mainEditView.performGlobalStyles();
_subEditView.performGlobalStyles();
_zoomOriginalValue = static_cast<int32_t>(_pEditView->execute(SCI_GETZOOM));
_mainEditView.execute(SCI_SETZOOM, svp1._zoom);
_subEditView.execute(SCI_SETZOOM, svp1._zoom2);
_mainEditView.execute(SCI_SETZOOM, svp._zoom);
_subEditView.execute(SCI_SETZOOM, svp._zoom2);
::SendMessage(hwnd, NPPM_INTERNAL_SETMULTISELCTION, 0, 0);
@ -329,6 +329,12 @@ LRESULT Notepad_plus::init(HWND hwnd)
_mainEditView.execute(SCI_SETAUTOMATICFOLD, SC_AUTOMATICFOLD_SHOW);
_subEditView.execute(SCI_SETAUTOMATICFOLD, SC_AUTOMATICFOLD_SHOW);
// Set padding info
_mainEditView.execute(SCI_SETMARGINLEFT, 0, svp._paddingLeft);
_mainEditView.execute(SCI_SETMARGINRIGHT, 0, svp._paddingRight);
_subEditView.execute(SCI_SETMARGINLEFT, 0, svp._paddingLeft);
_subEditView.execute(SCI_SETMARGINRIGHT, 0, svp._paddingRight);
TabBarPlus::doDragNDrop(true);
if (_toReduceTabBar)
@ -5474,14 +5480,7 @@ void Notepad_plus::distractionFreeToggle()
else
{
// enable it
const int defaultDiviser = 4;
int diviser = svp._distractionFreeDivPart > 2 ? svp._distractionFreeDivPart : defaultDiviser;
int w = _pEditView->getWidth();
int paddingLen = w / diviser;
if (paddingLen <= 0)
paddingLen = w / defaultDiviser;
paddingLeft = paddingRight = paddingLen;
paddingLeft = paddingRight = svp.getDistractionFreePadding(_pEditView->getWidth());;
_restoreButton.setButtonStatus(buttonStatus_distractionFree);
}

@ -333,7 +333,7 @@ private:
// make sure we don't recursively call doClose when closing the last file with -quitOnEmpty
bool _isAttemptingCloseOnQuit = false;
// For FullScreen/PostIt features
// For FullScreen/PostIt/DistractionFree features
VisibleGUIConf _beforeSpecialView;
void fullScreenToggle();
void postItToggle();

@ -2542,6 +2542,25 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
}
}
case NPPM_INTERNAL_UPDATETEXTZONEPADDING:
{
ScintillaViewParams &svp = const_cast<ScintillaViewParams &>(nppParam.getSVP());
if (_beforeSpecialView._isDistractionFree)
{
int paddingLen = svp.getDistractionFreePadding(_pEditView->getWidth());
_pEditView->execute(SCI_SETMARGINLEFT, 0, paddingLen);
_pEditView->execute(SCI_SETMARGINRIGHT, 0, paddingLen);
}
else
{
_mainEditView.execute(SCI_SETMARGINLEFT, 0, svp._paddingLeft);
_mainEditView.execute(SCI_SETMARGINRIGHT, 0, svp._paddingRight);
_subEditView.execute(SCI_SETMARGINLEFT, 0, svp._paddingLeft);
_subEditView.execute(SCI_SETMARGINRIGHT, 0, svp._paddingRight);
}
return TRUE;
}
default:
{
if (message == WDN_NOTIFY)

@ -2027,8 +2027,8 @@ void Notepad_plus::command(int id)
case IDM_VIEW_DISTRACTIONFREE:
{
if (((_beforeSpecialView._isDistractionFree && _beforeSpecialView._isFullScreen && _beforeSpecialView._isPostIt)) ||
((!_beforeSpecialView._isDistractionFree && !_beforeSpecialView._isFullScreen && !_beforeSpecialView._isPostIt)))
if ((_beforeSpecialView._isDistractionFree && _beforeSpecialView._isFullScreen && _beforeSpecialView._isPostIt) ||
(!_beforeSpecialView._isDistractionFree && !_beforeSpecialView._isFullScreen && !_beforeSpecialView._isPostIt))
distractionFreeToggle();
}
break;

@ -5533,22 +5533,22 @@ void NppParameters::feedScintillaParam(TiXmlNode *node)
nm = element->Attribute(TEXT("paddingLeft"), &val);
if (nm)
{
if (val >= 0 && val <= 9)
if (val >= 0 && val <= 30)
_svp._paddingLeft = static_cast<unsigned char>(val);
}
nm = element->Attribute(TEXT("paddingRight"), &val);
if (nm)
{
if (val >= 0 && val <= 9)
if (val >= 0 && val <= 30)
_svp._paddingRight = static_cast<unsigned char>(val);
}
nm = element->Attribute(TEXT("distractionFreeDivPart"), &val);
if (nm)
{
if (val >= 3 && val <= 255)
_svp._borderWidth = static_cast<unsigned char>(val);
if (val >= 3 && val <= 9)
_svp._distractionFreeDivPart = static_cast<unsigned char>(val);
}
}

@ -941,7 +941,16 @@ struct ScintillaViewParams
// distractionFreeDivPart is used for divising the fullscreen pixel width.
// the result of division will be the left & right padding in Distraction Free mode
unsigned char _distractionFreeDivPart = 4; // 3-255 parts
unsigned char _distractionFreeDivPart = 4; // 3-9 parts
int getDistractionFreePadding(int editViewWidth) const {
const int defaultDiviser = 4;
int diviser = _distractionFreeDivPart > 2 ? _distractionFreeDivPart : defaultDiviser;
int paddingLen = editViewWidth / diviser;
if (paddingLen <= 0)
paddingLen = editViewWidth / defaultDiviser;
return paddingLen;
};
};
const int NB_LIST = 20;

@ -3755,6 +3755,19 @@ void ScintillaEditView::getFoldColor(COLORREF& fgColor, COLORREF& bgColor, COLOR
}
}
int ScintillaEditView::getTextZoneWidth() const
{
RECT editorRect;
getClientRect(editorRect);
int marginWidths = 0;
for (int m = 0; m < 4; ++m)
{
marginWidths += static_cast<int32_t>(execute(SCI_GETMARGINWIDTHN, m));
}
return editorRect.right - editorRect.left - marginWidths;
}
pair<int, int> ScintillaEditView::getSelectedCharsAndLinesCount(int maxSelectionsForLineCount /* = -1 */) const
{
pair<int, int> selectedCharsAndLines(0, 0);

@ -429,6 +429,8 @@ public:
return long(execute(SCI_TEXTHEIGHT));
};
int getTextZoneWidth() const;
void gotoLine(int line){
if (line < execute(SCI_GETLINECOUNT))
execute(SCI_GOTOLINE,line);

@ -86,7 +86,7 @@ bool DocumentMap::needToRecomputeWith(const ScintillaEditView *editView)
if (_displayZoom != currentZoom)
return true;
int currentTextZoneWidth = getEditorTextZoneWidth(editView);
int currentTextZoneWidth = pEditView->getTextZoneWidth();
if (_displayWidth != currentTextZoneWidth)
return true;
@ -163,7 +163,7 @@ void DocumentMap::wrapMap(const ScintillaEditView *editView)
if (pEditView->isWrap())
{
// get current scintilla width W1
int editZoneWidth = getEditorTextZoneWidth(editView);
int editZoneWidth = pEditView->getTextZoneWidth();
// update the wrap needed data
_displayWidth = editZoneWidth;
@ -179,23 +179,18 @@ void DocumentMap::wrapMap(const ScintillaEditView *editView)
// sync wrapping indent mode
_pMapView->execute(SCI_SETWRAPINDENTMODE, pEditView->execute(SCI_GETWRAPINDENTMODE));
}
doMove();
}
int DocumentMap::getEditorTextZoneWidth(const ScintillaEditView *editView)
{
const ScintillaEditView *pEditView = editView ? editView : *_ppEditView;
const ScintillaViewParams& svp = NppParameters::getInstance().getSVP();
RECT editorRect;
pEditView->getClientRect(editorRect);
int marginWidths = 0;
for (int m = 0; m < 4; ++m)
{
marginWidths += static_cast<int32_t>(pEditView->execute(SCI_GETMARGINWIDTHN, m));
if (svp._paddingLeft || svp._paddingRight)
{
int paddingMapLeft = static_cast<int>(svp._paddingLeft / (editZoneWidth / docMapWidth));
int paddingMapRight = static_cast<int>(svp._paddingRight / (editZoneWidth / docMapWidth));
_pMapView->execute(SCI_SETMARGINLEFT, 0, paddingMapLeft);
_pMapView->execute(SCI_SETMARGINRIGHT, 0, paddingMapRight);
}
}
return editorRect.right - editorRect.left - marginWidths;
doMove();
}
void DocumentMap::scrollMap()

@ -127,7 +127,6 @@ public:
protected:
virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
bool needToRecomputeWith(const ScintillaEditView *editView = nullptr);
int getEditorTextZoneWidth(const ScintillaEditView *editView = nullptr);
private:
ScintillaEditView **_ppEditView = nullptr;

@ -77,7 +77,7 @@ void DocumentPeeker::syncDisplay(Buffer *buf, ScintillaEditView & scintSource)
MapPosition mp = buf->getMapPosition();
if (mp.isValid() && mp.canScroll())
{
scrollSnapshotWith(mp);
scrollSnapshotWith(mp, scintSource.getTextZoneWidth());
}
Buffer *buf = _pPeekerView->getCurrentBuffer();
@ -94,7 +94,7 @@ void DocumentPeeker::syncDisplay(Buffer *buf, ScintillaEditView & scintSource)
}
void DocumentPeeker::scrollSnapshotWith(const MapPosition & mapPos)
void DocumentPeeker::scrollSnapshotWith(const MapPosition & mapPos, int textZoneWidth)
{
if (_pPeekerView)
{
@ -120,6 +120,19 @@ void DocumentPeeker::scrollSnapshotWith(const MapPosition & mapPos)
_pPeekerView->wrap(mapPos._isWrap);
_pPeekerView->execute(SCI_SETWRAPINDENTMODE, mapPos._wrapIndentMode);
//
// Add padding
//
const ScintillaViewParams& svp = NppParameters::getInstance().getSVP();
if (svp._paddingLeft || svp._paddingRight)
{
int docPeekerWidth = _pPeekerView->getTextZoneWidth();
int paddingMapLeft = static_cast<int>(svp._paddingLeft / (textZoneWidth / docPeekerWidth));
int paddingMapRight = static_cast<int>(svp._paddingRight / (textZoneWidth / docPeekerWidth));
_pPeekerView->execute(SCI_SETMARGINLEFT, 0, paddingMapLeft);
_pPeekerView->execute(SCI_SETMARGINRIGHT, 0, paddingMapRight);
}
//
// Reset to zero
//

@ -40,7 +40,7 @@ public:
_hParent = parent2set;
};
void scrollSnapshotWith(const MapPosition & mapPos);
void scrollSnapshotWith(const MapPosition & mapPos, int textZoneWidth);
void saveCurrentSnapshot(ScintillaEditView & editView);
protected:

@ -100,19 +100,29 @@ BEGIN
CONTROL "Circle tree",IDC_RADIO_CIRCLE,"Button",BS_AUTORADIOBUTTON,31,63,62,10
CONTROL "None",IDC_RADIO_FOLDMARGENONE,"Button",BS_AUTORADIOBUTTON,31,92,61,10
CONTROL "Box tree",IDC_RADIO_BOX,"Button",BS_AUTORADIOBUTTON,31,77,61,10
GROUPBOX "Vertical Edge Settings",IDC_VES_GB_STATIC,116,21,148,135,BS_CENTER
GROUPBOX "Vertical Edge Settings",IDC_VES_GB_STATIC,116,21,148,136,BS_CENTER
LTEXT "Add your column marker by indicating its position with a decimal number.\nYou can define several column markers by using white space to separate the different numbers.",IDC_STATIC_MULTILNMODE_TIP,124,36,134,55
EDITTEXT IDC_COLUMNPOS_EDIT,126,93,125,36,ES_MULTILINE
CONTROL "Background mode",IDC_CHECK_EDGEBGMODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,127,138,122,10
GROUPBOX "Border Width",IDC_BORDERWIDTH_STATIC,21,112,85,45,BS_CENTER
GROUPBOX "Border Width",IDC_BORDERWIDTH_STATIC,22,112,83,45,BS_CENTER
CONTROL "",IDC_BORDERWIDTH_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,24,125,67,13
LTEXT "0",IDC_BORDERWIDTHVAL_STATIC,92,125,12,8
LTEXT "0",IDC_BORDERWIDTHVAL_STATIC,92,126,12,8
CONTROL "No edge",IDC_CHECK_NOEDGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,29,142,60,10
GROUPBOX "Line Number",IDC_LINENUMBERMARGE_GB_STATIC,275,21,135,66,BS_CENTER
GROUPBOX "Line Number",IDC_LINENUMBERMARGE_GB_STATIC,274,21,135,66,BS_CENTER
CONTROL "Display",IDC_CHECK_LINENUMBERMARGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,281,35,85,10
CONTROL "Dynamic width",IDC_RADIO_DYNAMIC,"Button",BS_AUTORADIOBUTTON | WS_GROUP,293,51,110,10
CONTROL "Constant width",IDC_RADIO_CONSTANT,"Button",BS_AUTORADIOBUTTON,293,65,108,10
CONTROL "Display bookmark",IDC_CHECK_BOOKMARKMARGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,281,97,150,10
CONTROL "Display bookmark",IDC_CHECK_BOOKMARKMARGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,281,163,150,10
GROUPBOX "Padding",IDC_PADDING_STATIC,274,94,135,63,BS_CENTER
RTEXT "Left",IDC_PADDINGLEFT_STATIC,280,108,45,8
CONTROL "",IDC_PADDINGLEFT_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,328,107,67,13
LTEXT "0",IDC_PADDINGLEFTVAL_STATIC,396,108,12,8
RTEXT "Right",IDC_PADDINGRIGHT_STATIC,282,124,43,8
CONTROL "",IDC_PADDINGRIGHT_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,328,123,67,13
LTEXT "0",IDC_PADDINGRIGHTVAL_STATIC,396,124,12,8
RTEXT "Distraction Free",IDC_DISTRACTIONFREE_STATIC,275,140,72,8
CONTROL "",IDC_DISTRACTIONFREE_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,348,139,47,13
LTEXT "0",IDC_DISTRACTIONFREEVAL_STATIC,396,140,12,8
END

@ -34,6 +34,14 @@ const int BORDERWIDTH_SMALLEST = 0;
const int BORDERWIDTH_LARGEST = 30;
const int BORDERWIDTH_INTERVAL = 1;
const int PADDING_SMALLEST = 0;
const int PADDING_LARGEST = 30;
const int PADDING_INTERVAL = 1;
const int DISTRACTIONFREE_SMALLEST = 3;
const int DISTRACTIONFREE_LARGEST = 9;
const int DISTRACTIONFREE_INTERVAL = 1;
// This int encoding array is built from "EncodingUnit encodings[]" (see EncodingMapper.cpp)
// And NewDocumentSubDlg will use "int encoding array" to get more info from "EncodingUnit encodings[]"
static int encodings[] = {
@ -814,14 +822,32 @@ INT_PTR CALLBACK MarginsBorderEdgeSubDlg::run_dlgProc(UINT message, WPARAM wPara
switch (message)
{
case WM_INITDIALOG :
{
{
const ScintillaViewParams & svp = nppParam.getSVP();
::SendMessage(::GetDlgItem(_hSelf, IDC_BORDERWIDTH_SLIDER),TBM_SETRANGEMIN, TRUE, BORDERWIDTH_SMALLEST);
::SendMessage(::GetDlgItem(_hSelf, IDC_BORDERWIDTH_SLIDER),TBM_SETRANGEMAX, TRUE, BORDERWIDTH_LARGEST);
::SendMessage(::GetDlgItem(_hSelf, IDC_BORDERWIDTH_SLIDER),TBM_SETPAGESIZE, 0, BORDERWIDTH_INTERVAL);
const ScintillaViewParams & svp = nppParam.getSVP();
::SendMessage(::GetDlgItem(_hSelf, IDC_BORDERWIDTH_SLIDER),TBM_SETPOS, TRUE, svp._borderWidth);
::SetDlgItemInt(_hSelf, IDC_BORDERWIDTHVAL_STATIC, svp._borderWidth, FALSE);
::SendMessage(::GetDlgItem(_hSelf, IDC_PADDINGLEFT_SLIDER), TBM_SETRANGEMIN, TRUE, PADDING_SMALLEST);
::SendMessage(::GetDlgItem(_hSelf, IDC_PADDINGLEFT_SLIDER), TBM_SETRANGEMAX, TRUE, PADDING_LARGEST);
::SendMessage(::GetDlgItem(_hSelf, IDC_PADDINGLEFT_SLIDER), TBM_SETPAGESIZE, 0, PADDING_INTERVAL);
::SendMessage(::GetDlgItem(_hSelf, IDC_PADDINGLEFT_SLIDER), TBM_SETPOS, TRUE, svp._paddingLeft);
::SetDlgItemInt(_hSelf, IDC_PADDINGLEFTVAL_STATIC, svp._paddingLeft, FALSE);
::SendMessage(::GetDlgItem(_hSelf, IDC_PADDINGRIGHT_SLIDER), TBM_SETRANGEMIN, TRUE, PADDING_SMALLEST);
::SendMessage(::GetDlgItem(_hSelf, IDC_PADDINGRIGHT_SLIDER), TBM_SETRANGEMAX, TRUE, PADDING_LARGEST);
::SendMessage(::GetDlgItem(_hSelf, IDC_PADDINGRIGHT_SLIDER), TBM_SETPAGESIZE, 0, PADDING_INTERVAL);
::SendMessage(::GetDlgItem(_hSelf, IDC_PADDINGRIGHT_SLIDER), TBM_SETPOS, TRUE, svp._paddingRight);
::SetDlgItemInt(_hSelf, IDC_PADDINGRIGHTVAL_STATIC, svp._paddingRight, FALSE);
::SendMessage(::GetDlgItem(_hSelf, IDC_DISTRACTIONFREE_SLIDER), TBM_SETRANGEMIN, TRUE, DISTRACTIONFREE_SMALLEST);
::SendMessage(::GetDlgItem(_hSelf, IDC_DISTRACTIONFREE_SLIDER), TBM_SETRANGEMAX, TRUE, DISTRACTIONFREE_LARGEST);
::SendMessage(::GetDlgItem(_hSelf, IDC_DISTRACTIONFREE_SLIDER), TBM_SETPAGESIZE, 0, DISTRACTIONFREE_INTERVAL);
::SendMessage(::GetDlgItem(_hSelf, IDC_DISTRACTIONFREE_SLIDER), TBM_SETPOS, TRUE, svp._distractionFreeDivPart);
::SetDlgItemInt(_hSelf, IDC_DISTRACTIONFREEVAL_STATIC, svp._distractionFreeDivPart, FALSE);
initScintParam();
ETDTProc enableDlgTheme = (ETDTProc)nppParam.getEnableThemeDlgTexture();
@ -832,15 +858,37 @@ INT_PTR CALLBACK MarginsBorderEdgeSubDlg::run_dlgProc(UINT message, WPARAM wPara
case WM_HSCROLL:
{
ScintillaViewParams & svp = (ScintillaViewParams &)nppParam.getSVP();
HWND hBorderWidthSlider = ::GetDlgItem(_hSelf, IDC_BORDERWIDTH_SLIDER);
HWND hPaddingLeftSlider = ::GetDlgItem(_hSelf, IDC_PADDINGLEFT_SLIDER);
HWND hPaddingRightSlider = ::GetDlgItem(_hSelf, IDC_PADDINGRIGHT_SLIDER);
HWND hDistractionFreeSlider = ::GetDlgItem(_hSelf, IDC_DISTRACTIONFREE_SLIDER);
if (reinterpret_cast<HWND>(lParam) == hBorderWidthSlider)
{
auto borderWidth = ::SendMessage(hBorderWidthSlider, TBM_GETPOS, 0, 0);
ScintillaViewParams & svp = (ScintillaViewParams &)nppParam.getSVP();
svp._borderWidth = static_cast<int>(borderWidth);
::SetDlgItemInt(_hSelf, IDC_BORDERWIDTHVAL_STATIC, static_cast<UINT>(borderWidth), FALSE);
::SendMessage(::GetParent(_hParent), WM_SIZE, 0, 0);
}
else if (reinterpret_cast<HWND>(lParam) == hPaddingLeftSlider)
{
svp._paddingLeft = static_cast<unsigned char>(::SendMessage(hPaddingLeftSlider, TBM_GETPOS, 0, 0));
::SetDlgItemInt(_hSelf, IDC_PADDINGLEFTVAL_STATIC, static_cast<UINT>(svp._paddingLeft), FALSE);
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_UPDATETEXTZONEPADDING, 0, 0);
}
else if (reinterpret_cast<HWND>(lParam) == hPaddingRightSlider)
{
svp._paddingRight = static_cast<unsigned char>(::SendMessage(hPaddingRightSlider, TBM_GETPOS, 0, 0));
::SetDlgItemInt(_hSelf, IDC_PADDINGRIGHTVAL_STATIC, static_cast<UINT>(svp._paddingRight), FALSE);
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_UPDATETEXTZONEPADDING, 0, 0);
}
else if (reinterpret_cast<HWND>(lParam) == hDistractionFreeSlider)
{
svp._distractionFreeDivPart = static_cast<unsigned char>(::SendMessage(hDistractionFreeSlider, TBM_GETPOS, 0, 0));
::SetDlgItemInt(_hSelf, IDC_DISTRACTIONFREEVAL_STATIC, static_cast<UINT>(svp._distractionFreeDivPart), FALSE);
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_UPDATETEXTZONEPADDING, 0, 0);
}
return 0; //return zero when handled
}

@ -78,12 +78,12 @@
#define IDC_CHECK_LINENUMBERMARGE (IDD_PREFERENCE_SUB_EDITING + 6)
#define IDC_CHECK_BOOKMARKMARGE (IDD_PREFERENCE_SUB_EDITING + 7)
//#define IDC_CHECK_SHOWVERTICALEDGE (IDD_PREFERENCE_SUB_EDITING + 8)
//#define IDC_NBCOLONE_STATIC (IDD_PREFERENCE_SUB_EDITING + 9)
//#define IDC_COLONENUMBER_STATIC (IDD_PREFERENCE_SUB_EDITING + 10)
#define IDC_PADDING_STATIC (IDD_PREFERENCE_SUB_EDITING + 8)
#define IDC_PADDINGLEFT_STATIC (IDD_PREFERENCE_SUB_EDITING + 9)
#define IDC_PADDINGRIGHT_STATIC (IDD_PREFERENCE_SUB_EDITING + 10)
#define IDC_VES_GB_STATIC (IDD_PREFERENCE_SUB_EDITING + 11)
//#define IDC_RADIO_LNMODE (IDD_PREFERENCE_SUB_EDITING + 12)
#define IDC_DISTRACTIONFREE_STATIC (IDD_PREFERENCE_SUB_EDITING + 12)
#define IDC_CHECK_EDGEBGMODE (IDD_PREFERENCE_SUB_EDITING + 13)
#define IDC_CHECK_CURRENTLINEHILITE (IDD_PREFERENCE_SUB_EDITING + 14)
#define IDC_CHECK_SMOOTHFONT (IDD_PREFERENCE_SUB_EDITING + 15)
@ -96,7 +96,7 @@
#define IDC_CARETBLINKRATE_F_STATIC (IDD_PREFERENCE_SUB_EDITING + 21)
#define IDC_CARETBLINKRATE_S_STATIC (IDD_PREFERENCE_SUB_EDITING + 22)
#define IDC_CHECK_DOCCHANGESTATEMARGE (IDD_PREFERENCE_SUB_EDITING + 23)
//#define IDC_MULTISELECTION_GB_STATIC (IDD_PREFERENCE_SUB_EDITING + 24)
#define IDC_DISTRACTIONFREE_SLIDER (IDD_PREFERENCE_SUB_EDITING + 24)
#define IDC_CHECK_MULTISELECTION (IDD_PREFERENCE_SUB_EDITING + 25)
#define IDC_RADIO_FOLDMARGENONE (IDD_PREFERENCE_SUB_EDITING + 26)
@ -116,6 +116,11 @@
#define IDC_STATIC_MULTILNMODE_TIP (IDD_PREFERENCE_SUB_EDITING + 37)
#define IDC_COLUMNPOS_EDIT (IDD_PREFERENCE_SUB_EDITING + 38)
#define IDC_CHECK_RIGHTCLICKKEEPSSELECTION (IDD_PREFERENCE_SUB_EDITING + 39)
#define IDC_PADDINGLEFT_SLIDER (IDD_PREFERENCE_SUB_EDITING + 40)
#define IDC_PADDINGRIGHT_SLIDER (IDD_PREFERENCE_SUB_EDITING + 41)
#define IDC_PADDINGLEFTVAL_STATIC (IDD_PREFERENCE_SUB_EDITING + 42)
#define IDC_PADDINGRIGHTVAL_STATIC (IDD_PREFERENCE_SUB_EDITING + 43)
#define IDC_DISTRACTIONFREEVAL_STATIC (IDD_PREFERENCE_SUB_EDITING + 44)
#define IDD_PREFERENCE_SUB_DELIMITER 6250 //(IDD_PREFERENCE_BOX + 250)
#define IDC_DELIMITERSETTINGS_GB_STATIC (IDD_PREFERENCE_SUB_DELIMITER + 1)

@ -445,6 +445,7 @@
#define NPPM_INTERNAL_SCINTILLAFINDERCOPYVERBATIM (NOTEPADPLUS_USER_INTERNAL + 55)
#define NPPM_INTERNAL_FINDINPROJECTS (NOTEPADPLUS_USER_INTERNAL + 56)
#define NPPM_INTERNAL_SCINTILLAFINDERPURGE (NOTEPADPLUS_USER_INTERNAL + 57)
#define NPPM_INTERNAL_UPDATETEXTZONEPADDING (NOTEPADPLUS_USER_INTERNAL + 58)
// See Notepad_plus_msgs.h
//#define NOTEPADPLUS_USER (WM_USER + 1000)

Loading…
Cancel
Save