Add an option for displying constant line number width

1. Add an option for displying constant line number width in Preferences dialog.
   This option set the line number constant width according the total line number in the document (minimun 4 digits).
   It ensures no unexpected visual effect while scrolling content vertically.
   If the document content is modified and the total number of lines is increased or decreased, more digits will be added or removed according the number of digits in total number of lines.

2. Add new plugin messages NPPM_GETLINENUMBERWIDTHMODE & NPPM_SETLINENUMBERWIDTHMODE for getting or setting LINENUMWIDTH_DYNAMIC / LINENUMWIDTH_CONSTANT.
   So plugins may send NPPM_SETLINENUMBERWIDTHMODE message with LINENUMWIDTH_CONSTANT to Notepad++ for avoiding some unexpected visual effect (while scrolling).

Fix #5670
This commit is contained in:
Don HO 2020-12-06 16:38:53 +01:00
parent fefdbc9cad
commit c9c2d1e376
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E
17 changed files with 156 additions and 55 deletions

View File

@ -838,7 +838,10 @@ The comments are here for explanation, it's not necessary to translate them.
<Item id="6204" name="Circle tree"/>
<Item id="6205" name="Box tree"/>
<Item id="6226" name="None"/>
<Item id="6206" name="Display line number"/>
<Item id="6291" name="Line Number"/>
<Item id="6206" name="Display"/>
<Item id="6292" name="Dynamic width"/>
<Item id="6293" name="Constant width"/>
<Item id="6207" name="Display bookmark"/>
<Item id="6211" name="Vertical Edge Settings"/>
<Item id="6213" name="Background mode"/>

View File

@ -835,7 +835,10 @@
<Item id="6204" name="Circle tree"/>
<Item id="6205" name="Box tree"/>
<Item id="6226" name="None"/>
<Item id="6206" name="Display line number"/>
<Item id="6291" name="Line Number"/>
<Item id="6206" name="Display"/>
<Item id="6292" name="Dynamic width"/>
<Item id="6293" name="Constant width"/>
<Item id="6207" name="Display bookmark"/>
<Item id="6211" name="Vertical Edge Settings"/>
<Item id="6213" name="Background mode"/>

View File

@ -800,20 +800,23 @@
</Scintillas>
<MarginsBorderEdge title="Marges et Bordure">
<Item id="6206" name="Afficher la numérotation des lignes"/>
<Item id="6207" name="Afficher la marge de signet"/>
<Item id="6211" name="Marqueur de colonne"/>
<Item id="6213" name="Colorer larrière-plan"/>
<Item id="6237" name="Ajoutez votre marqueur de colonne en indiquant sa position avec un nombre entier.
Vous pouvez définir plusieurs marqueurs de colonne en utilisant un espace pour séparer les différents nombres."/>
<Item id="6201" name="Contrôle de repli de bloc"/>
<Item id="6202" name="Simple"/>
<Item id="6203" name="Flèche"/>
<Item id="6204" name="Cercle"/>
<Item id="6205" name="Carré"/>
<Item id="6226" name="Aucun"/>
<Item id="6211" name="Marqueur de colonne"/>
<Item id="6213" name="Colorer larrière-plan"/>
<Item id="6237" name="Ajoutez votre marqueur de colonne en indiquant sa position avec un nombre entier.
Vous pouvez définir plusieurs marqueurs de colonne en utilisant un espace pour séparer les différents nombres."/>
<Item id="6231" name="Largeur de la bordure"/>
<Item id="6235" name="Pas de bordure"/>
<Item id="6291" name="Numérotation des lignes"/>
<Item id="6206" name="Afficher"/>
<Item id="6292" name="Largeur dynamique"/>
<Item id="6293" name="Largeur constante"/>
<Item id="6207" name="Afficher la marge de signet"/>
</MarginsBorderEdge>
<NewDoc title="Nouveau document">

View File

@ -813,7 +813,10 @@
<Item id="6204" name="圓形"/>
<Item id="6205" name="方形"/>
<Item id="6226" name="無"/>
<Item id="6206" name="顯示行號"/>
<Item id="6291" name="行號"/>
<Item id="6206" name="顯示"/>
<Item id="6292" name="動態寬度"/>
<Item id="6293" name="恆定寬度"/>
<Item id="6207" name="顯示標記"/>
<Item id="6211" name="行界線設定"/>
<Item id="6213" name="背景色模式"/>

View File

@ -1340,4 +1340,27 @@ void trim(generic_string& str)
if (pos != generic_string::npos) str.erase(0, pos);
}
else str.erase(str.begin(), str.end());
};
}
int nbDigitsFromNbLines(size_t nbLines)
{
int nbDigits = 0; // minimum number of digit should be 4
if (nbLines < 10) nbDigits = 1;
else if (nbLines < 100) nbDigits = 2;
else if (nbLines < 1000) nbDigits = 3;
else if (nbLines < 10000) nbDigits = 4;
else if (nbLines < 100000) nbDigits = 5;
else if (nbLines < 1000000) nbDigits = 6;
else // rare case
{
nbDigits = 7;
nbLines /= 1000000;
while (nbLines)
{
nbLines /= 10;
++nbDigits;
}
}
return nbDigits;
}

View File

@ -235,3 +235,5 @@ template<typename T> size_t vecRemoveDuplicates(std::vector<T>& vec, bool isSort
}
void trim(generic_string& str);
int nbDigitsFromNbLines(size_t nbLines);

View File

@ -436,6 +436,19 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64 };
// Users should call it with settingsCloudPath be NULL to get the required number of TCHAR (not including the terminating nul character),
// allocate settingsCloudPath buffer with the return value + 1, then call it again to get the path.
#define NPPM_SETLINENUMBERWIDTHMODE (NPPMSG + 99)
#define LINENUMWIDTH_DYNAMIC 0
#define LINENUMWIDTH_CONSTANT 1
// BOOL NPPM_SETLINENUMBERWIDTHMODE(0, INT widthMode)
// Set line number margin width in dynamic width mode (LINENUMWIDTH_DYNAMIC) or constant width mode (LINENUMWIDTH_CONSTANT)
// It may help some plugins to disable non-dynamic line number margins width to have a smoothly visual effect while vertical scrolling the content in Notepad++
// If calling is successful return TRUE, otherwise return FALSE.
#define NPPM_GETLINENUMBERWIDTHMODE (NPPMSG + 100)
// INT NPPM_GETLINENUMBERWIDTHMODE(0, 0)
// Get line number margin width in dynamic width mode (LINENUMWIDTH_DYNAMIC) or constant width mode (LINENUMWIDTH_CONSTANT)
#define VAR_NOT_RECOGNIZED 0
#define FULL_CURRENT_PATH 1
#define CURRENT_DIRECTORY 2

View File

@ -2639,7 +2639,7 @@ bool isUrlSchemeSupported(INTERNET_SCHEME s, TCHAR *url)
case INTERNET_SCHEME_FILE:
return true;
}
generic_string const mySchemes = (NppParameters::getInstance()).getNppGUI()._uriShemes + TEXT(" ");
generic_string const mySchemes = (NppParameters::getInstance()).getNppGUI()._uriSchemes + TEXT(" ");
TCHAR *p = (TCHAR *)mySchemes.c_str();
while (*p)
{

View File

@ -1429,7 +1429,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_INTERNAL_SCROLLBEYONDLASTLINE:
{
const bool endAtLastLine = not (nppParam.getSVP())._scrollBeyondLastLine;
const bool endAtLastLine = !(nppParam.getSVP())._scrollBeyondLastLine;
_mainEditView.execute(SCI_SETENDATLASTLINE, endAtLastLine);
_subEditView.execute(SCI_SETENDATLASTLINE, endAtLastLine);
return TRUE;
@ -2124,6 +2124,24 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
return settingsOnCloudPath.length();
}
case NPPM_SETLINENUMBERWIDTHMODE:
{
if (lParam != LINENUMWIDTH_DYNAMIC || lParam != LINENUMWIDTH_CONSTANT)
return FALSE;
ScintillaViewParams &svp = const_cast<ScintillaViewParams &>(nppParam.getSVP());
svp._lineNumberMarginDynamicWidth = lParam == LINENUMWIDTH_DYNAMIC;
::SendMessage(hwnd, WM_COMMAND, IDM_VIEW_LINENUMBER, 0);
return TRUE;
}
case NPPM_GETLINENUMBERWIDTHMODE:
{
const ScintillaViewParams &svp = nppParam.getSVP();
return svp._lineNumberMarginDynamicWidth ? LINENUMWIDTH_DYNAMIC : LINENUMWIDTH_CONSTANT;
}
case NPPM_MSGTOPLUGIN :
{
return _pluginsManager.relayPluginMessages(message, wParam, lParam);
@ -2387,7 +2405,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
_mainEditView.execute(SCI_MULTIEDGECLEARALL);
_subEditView.execute(SCI_MULTIEDGECLEARALL);
ScintillaViewParams & svp = (ScintillaViewParams &)nppParam.getSVP();
ScintillaViewParams &svp = const_cast<ScintillaViewParams &>(nppParam.getSVP());
StyleArray & stylers = NppParameters::getInstance().getMiscStylerArray();
COLORREF multiEdgeColor = liteGrey;

View File

@ -1012,7 +1012,9 @@ BOOL Notepad_plus::notify(SCNotification *notification)
_subEditView.restoreCurrentPosPreStep();
_subEditView.setWrapRestoreNeeded(false);
}
notifyView->updateLineNumberWidth();
if (_syncInfo.doSync())
doSynScorll(HWND(notification->nmhdr.hwndFrom));

View File

@ -4449,7 +4449,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
{
const TCHAR* val = n->Value();
if (val)
_nppGUI._uriShemes = val;
_nppGUI._uriSchemes = val;
}
}
@ -5270,6 +5270,16 @@ void NppParameters::feedScintillaParam(TiXmlNode *node)
_svp._lineNumberMarginShow = false;
}
// Line Number Margin dynamic width
nm = element->Attribute(TEXT("lineNumberDynamicWidth"));
if (nm)
{
if (!lstrcmp(nm, TEXT("yes")))
_svp._lineNumberMarginDynamicWidth = true;
else if (!lstrcmp(nm, TEXT("no")))
_svp._lineNumberMarginDynamicWidth = false;
}
// Bookmark Margin
nm = element->Attribute(TEXT("bookMarkMargin"));
if (nm)
@ -5671,6 +5681,7 @@ bool NppParameters::writeScintillaParams()
}
(scintNode->ToElement())->SetAttribute(TEXT("lineNumberMargin"), _svp._lineNumberMarginShow?TEXT("show"):TEXT("hide"));
(scintNode->ToElement())->SetAttribute(TEXT("lineNumberDynamicWidth"), _svp._lineNumberMarginDynamicWidth ?TEXT("yes"):TEXT("no"));
(scintNode->ToElement())->SetAttribute(TEXT("bookMarkMargin"), _svp._bookMarkMarginShow?TEXT("show"):TEXT("hide"));
(scintNode->ToElement())->SetAttribute(TEXT("indentGuideLine"), _svp._indentGuideLineShow?TEXT("show"):TEXT("hide"));
const TCHAR *pFolderStyleStr = (_svp._folderStyle == FOLDER_STYLE_SIMPLE)?TEXT("simple"):
@ -6013,7 +6024,7 @@ void NppParameters::createXmlTreeFromGUIParams()
{
TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement();
GUIConfigElement->SetAttribute(TEXT("name"), TEXT("uriCustomizedSchemes"));
GUIConfigElement->InsertEndChild(TiXmlText(_nppGUI._uriShemes.c_str()));
GUIConfigElement->InsertEndChild(TiXmlText(_nppGUI._uriSchemes.c_str()));
}
// <GUIConfig name = "globalOverride" fg = "no" bg = "no" font = "no" fontSize = "no" bold = "no" italic = "no" underline = "no" / >
{

View File

@ -849,7 +849,7 @@ struct NppGUI final
bool _isWordCharDefault = true;
std::string _customWordChars;
urlMode _styleURL = urlUnderLineFg;
generic_string _uriShemes = TEXT("svn:// cvs:// git:// imap:// irc:// irc6:// ircs:// ldap:// ldaps:// news: telnet:// gopher:// ssh:// sftp:// smb:// skype: snmp:// spotify: steam:// sms: slack:// chrome:// bitcoin:");
generic_string _uriSchemes = TEXT("svn:// cvs:// git:// imap:// irc:// irc6:// ircs:// ldap:// ldaps:// news: telnet:// gopher:// ssh:// sftp:// smb:// skype: snmp:// spotify: steam:// sms: slack:// chrome:// bitcoin:");
NewDocDefaultSettings _newDocDefaultSettings;
@ -919,6 +919,7 @@ struct NppGUI final
struct ScintillaViewParams
{
bool _lineNumberMarginShow = true;
bool _lineNumberMarginDynamicWidth = true;
bool _bookMarkMarginShow = true;
folderStyle _folderStyle = FOLDER_STYLE_BOX; //"simple", "arrow", "circle", "box" and "none"
lineWrapMethod _lineWrapMethod = LINEWRAP_ALIGNED;
@ -935,7 +936,7 @@ struct ScintillaViewParams
bool _whiteSpaceShow = false;
bool _eolShow = false;
int _borderWidth = 2;
bool _scrollBeyondLastLine = false;
bool _scrollBeyondLastLine = true;
bool _rightClickKeepsSelection = false;
bool _disableAdvancedScrolling = false;
bool _doSmoothFont = false;

View File

@ -2731,38 +2731,37 @@ void ScintillaEditView::setLineIndent(int line, int indent) const
void ScintillaEditView::updateLineNumberWidth()
{
if (_lineNumbersShown)
const ScintillaViewParams& svp = NppParameters::getInstance().getSVP();
if (svp._lineNumberMarginShow)
{
auto linesVisible = execute(SCI_LINESONSCREEN);
if (linesVisible)
{
auto firstVisibleLineVis = execute(SCI_GETFIRSTVISIBLELINE);
auto lastVisibleLineVis = linesVisible + firstVisibleLineVis + 1;
int nbDigits = 0;
auto lastVisibleLineDoc = execute(SCI_DOCLINEFROMVISIBLE, lastVisibleLineVis);
int nbDigits = 3; // minimum number of digit should be 3
if (lastVisibleLineDoc < 1000) {} //nbDigits = 3;
else if (lastVisibleLineDoc < 10000) nbDigits = 4;
else if (lastVisibleLineDoc < 100000) nbDigits = 5;
else if (lastVisibleLineDoc < 1000000) nbDigits = 6;
else // rare case
if (svp._lineNumberMarginDynamicWidth)
{
nbDigits = 7;
lastVisibleLineDoc /= 1000000;
auto firstVisibleLineVis = execute(SCI_GETFIRSTVISIBLELINE);
auto lastVisibleLineVis = linesVisible + firstVisibleLineVis + 1;
auto lastVisibleLineDoc = execute(SCI_DOCLINEFROMVISIBLE, lastVisibleLineVis);
while (lastVisibleLineDoc)
{
lastVisibleLineDoc /= 10;
++nbDigits;
}
nbDigits = nbDigitsFromNbLines(lastVisibleLineDoc);
nbDigits = nbDigits < 3 ? 3 : nbDigits;
}
else
{
auto nbLines = execute(SCI_GETLINECOUNT);
nbDigits = nbDigitsFromNbLines(nbLines);
nbDigits = nbDigits < 4 ? 4 : nbDigits;
}
auto pixelWidth = 8 + nbDigits * execute(SCI_TEXTWIDTH, STYLE_LINENUMBER, reinterpret_cast<LPARAM>("8"));
execute(SCI_SETMARGINWIDTHN, _SC_MARGE_LINENUMBER, pixelWidth);
}
}
}
const char * ScintillaEditView::getCompleteKeywordList(std::basic_string<char> & kwl, LangType langType, int keywordIndex)
{
kwl += " ";

View File

@ -326,7 +326,7 @@ public:
void showMargin(int whichMarge, bool willBeShowed = true) {
if (whichMarge == _SC_MARGE_LINENUMBER)
showLineNumbersMargin(willBeShowed);
updateLineNumbersMargin();
else
{
int width = 3;
@ -473,11 +473,9 @@ public:
void setLineIndent(int line, int indent) const;
void showLineNumbersMargin(bool show)
{
if (show == _lineNumbersShown) return;
_lineNumbersShown = show;
if (show)
void updateLineNumbersMargin() {
const ScintillaViewParams& svp = NppParameters::getInstance().getSVP();
if (svp._lineNumberMarginShow)
{
updateLineNumberWidth();
}
@ -488,6 +486,7 @@ public:
}
void updateLineNumberWidth();
void setCurrentLineHiLiting(bool isHiliting, COLORREF bgColor) const {
execute(SCI_SETCARETLINEVISIBLE, isHiliting);
@ -666,7 +665,6 @@ protected:
Buffer * _currentBuffer = nullptr;
int _codepage = CP_ACP;
bool _lineNumbersShown = false;
bool _wrapRestoreNeeded = false;
bool _positionRestoreNeeded = false;
uint32_t _restorePositionRetryCount = 0;

View File

@ -91,15 +91,16 @@ BEGIN
CONTROL "Default",IDC_RADIO_LWDEF,"Button",BS_AUTORADIOBUTTON | WS_GROUP,275,21,59,10
CONTROL "Aligned",IDC_RADIO_LWALIGN,"Button",BS_AUTORADIOBUTTON,275,36,60,10
CONTROL "Indent",IDC_RADIO_LWINDENT,"Button",BS_AUTORADIOBUTTON,275,51,62,10
CONTROL "Enable Multi-Editing (Ctrl+Mouse click/selection)",IDC_CHECK_MULTISELECTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,90,230,10
CONTROL "Enable current line highlighting",IDC_CHECK_CURRENTLINEHILITE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,103,160,10
CONTROL "Enable smooth font",IDC_CHECK_SMOOTHFONT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,116,130,10
CONTROL "Enable scrolling beyond last line",IDC_CHECK_SCROLLBEYONDLASTLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,129,160,10
CONTROL "Keep selection when right-click outside of selection",IDC_CHECK_RIGHTCLICKKEEPSSELECTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,142,230,10
CONTROL "Enable Multi-Editing (Ctrl+Mouse click/selection)",IDC_CHECK_MULTISELECTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,90,270,10
CONTROL "Enable current line highlighting",IDC_CHECK_CURRENTLINEHILITE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,103,270,10
CONTROL "Enable smooth font",IDC_CHECK_SMOOTHFONT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,116,250,10
CONTROL "Enable scrolling beyond last line",IDC_CHECK_SCROLLBEYONDLASTLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,129,270,10
CONTROL "Keep selection when right-click outside of selection",IDC_CHECK_RIGHTCLICKKEEPSSELECTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,142,270,10
CONTROL "Disable advanced scrolling feature due to touchpad issue",IDC_CHECK_DISABLEADVANCEDSCROLL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,155,270,10
END
IDD_PREFERENCE_SUB_MARGING_BORDER_EDGE DIALOGEX 0, 0, 455, 185
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x1
@ -110,16 +111,19 @@ 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,118,21,148,135,BS_CENTER
CONTROL "Background mode",IDC_CHECK_EDGEBGMODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,129,138,122,10
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,126,36,134,55
EDITTEXT IDC_COLUMNPOS_EDIT,128,93,125,36,ES_MULTILINE
GROUPBOX "Vertical Edge Settings",IDC_VES_GB_STATIC,116,21,148,135,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
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
CONTROL "No edge",IDC_CHECK_NOEDGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,29,142,60,10
CONTROL "Display line number",IDC_CHECK_LINENUMBERMARGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,283,27,141,10
CONTROL "Display bookmark",IDC_CHECK_BOOKMARKMARGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,283,39,150,10
GROUPBOX "Line Number",IDC_LINENUMBERMARGE_GB_STATIC,275,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
END

View File

@ -786,6 +786,11 @@ void MarginsBorderEdgeSubDlg::initScintParam()
::SendDlgItemMessage(_hSelf, id, BM_SETCHECK, TRUE, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_LINENUMBERMARGE, BM_SETCHECK, svp._lineNumberMarginShow, 0);
::SendDlgItemMessage(_hSelf, IDC_RADIO_DYNAMIC, BM_SETCHECK, svp._lineNumberMarginDynamicWidth, 0);
::SendDlgItemMessage(_hSelf, IDC_RADIO_CONSTANT, BM_SETCHECK, !svp._lineNumberMarginDynamicWidth, 0);
::EnableWindow(::GetDlgItem(_hSelf, IDC_RADIO_DYNAMIC), svp._lineNumberMarginShow);
::EnableWindow(::GetDlgItem(_hSelf, IDC_RADIO_CONSTANT), svp._lineNumberMarginShow);
::SendDlgItemMessage(_hSelf, IDC_CHECK_BOOKMARKMARGE, BM_SETCHECK, svp._bookMarkMarginShow, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_NOEDGE, BM_SETCHECK, !svp._showBorderEdge, 0);
@ -857,6 +862,16 @@ INT_PTR CALLBACK MarginsBorderEdgeSubDlg::run_dlgProc(UINT message, WPARAM wPara
{
case IDC_CHECK_LINENUMBERMARGE:
svp._lineNumberMarginShow = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECK_LINENUMBERMARGE, BM_GETCHECK, 0, 0));
::EnableWindow(::GetDlgItem(_hSelf, IDC_RADIO_DYNAMIC), svp._lineNumberMarginShow);
::EnableWindow(::GetDlgItem(_hSelf, IDC_RADIO_CONSTANT), svp._lineNumberMarginShow);
::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_LINENUMBER, 0);
return TRUE;
case IDC_RADIO_DYNAMIC:
svp._lineNumberMarginDynamicWidth = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_RADIO_DYNAMIC, BM_GETCHECK, 0, 0));
::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_LINENUMBER, 0);
return TRUE;
case IDC_RADIO_CONSTANT:
svp._lineNumberMarginDynamicWidth = !(BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_RADIO_CONSTANT, BM_GETCHECK, 0, 0));
::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_LINENUMBER, 0);
return TRUE;
@ -3346,7 +3361,7 @@ INT_PTR CALLBACK CloudAndLinkSubDlg::run_dlgProc(UINT message, WPARAM wParam, LP
{
TCHAR uriScheme[uriSchemesMaxLength] = { '\0' };
::SendDlgItemMessage(_hSelf, IDC_URISCHEMES_EDIT, WM_GETTEXT, uriSchemesMaxLength, reinterpret_cast<LPARAM>(uriScheme));
nppGUI._uriShemes = uriScheme;
nppGUI._uriSchemes = uriScheme;
HWND grandParent = ::GetParent(_hParent);
::SendMessage(grandParent, NPPM_INTERNAL_UPDATECLICKABLELINKS, 0, 0);
return TRUE;
@ -3380,7 +3395,7 @@ INT_PTR CALLBACK CloudAndLinkSubDlg::run_dlgProc(UINT message, WPARAM wParam, LP
BOOL dontUnderline = (nppGUI._styleURL == urlNoUnderLineFg) || (nppGUI._styleURL == urlNoUnderLineBg);
BOOL roundBoxMode = (nppGUI._styleURL == urlNoUnderLineBg) || (nppGUI._styleURL == urlUnderLineBg);
::SendDlgItemMessage(_hSelf, IDC_URISCHEMES_EDIT, EM_SETLIMITTEXT, uriSchemesMaxLength, 0);
::SetWindowText(::GetDlgItem(_hSelf, IDC_URISCHEMES_EDIT), nppGUI._uriShemes.c_str());
::SetWindowText(::GetDlgItem(_hSelf, IDC_URISCHEMES_EDIT), nppGUI._uriSchemes.c_str());
::SendDlgItemMessage(_hSelf, IDC_CHECK_CLICKABLELINK_ENABLE, BM_SETCHECK, linkEnable, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_CLICKABLELINK_NOUNDERLINE, BM_SETCHECK, dontUnderline, 0);

View File

@ -161,6 +161,9 @@
#define IDC_SEARCHENGINE_STACKOVERFLOW_RADIO (IDD_PREFERENCE_SUB_SEARCHENGINE + 9)
#define IDD_PREFERENCE_SUB_MARGING_BORDER_EDGE 6290 //(IDD_PREFERENCE_BOX + 290)
#define IDC_LINENUMBERMARGE_GB_STATIC (IDD_PREFERENCE_SUB_MARGING_BORDER_EDGE + 1)
#define IDC_RADIO_DYNAMIC (IDD_PREFERENCE_SUB_MARGING_BORDER_EDGE + 2)
#define IDC_RADIO_CONSTANT (IDD_PREFERENCE_SUB_MARGING_BORDER_EDGE + 3)
#define IDD_PREFERENCE_SUB_MISC 6300 //(IDD_PREFERENCE_BOX + 300)
#define IDC_TABSETTING_GB_STATIC (IDD_PREFERENCE_SUB_MISC + 1)