Implement multi-line edge feature

Close #3128
This commit is contained in:
Don HO 2020-04-04 04:55:45 +02:00
parent bf2cd8e05a
commit cc2c9b7740
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E
14 changed files with 239 additions and 68 deletions

View File

@ -816,6 +816,39 @@ std::vector<generic_string> stringSplit(const generic_string& input, const gener
} }
bool str2numberVector(generic_string str2convert, std::vector<size_t>& numVect)
{
numVect.clear();
for (auto i : str2convert)
{
switch (i)
{
case ' ':
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
{
// correct. do nothing
}
break;
default:
return false;
}
}
std::vector<generic_string> v = stringSplit(str2convert, TEXT(" "));
for (auto i : v)
{
// Don't treat empty string and the number greater than 9999
if (!i.empty() && i.length() < 5)
{
numVect.push_back(std::stoi(i));
}
}
return true;
}
generic_string stringJoin(const std::vector<generic_string>& strings, const generic_string& separator) generic_string stringJoin(const std::vector<generic_string>& strings, const generic_string& separator)
{ {
generic_string joined; generic_string joined;

View File

@ -179,6 +179,7 @@ generic_string stringToUpper(generic_string strToConvert);
generic_string stringToLower(generic_string strToConvert); generic_string stringToLower(generic_string strToConvert);
generic_string stringReplace(generic_string subject, const generic_string& search, const generic_string& replace); generic_string stringReplace(generic_string subject, const generic_string& search, const generic_string& replace);
std::vector<generic_string> stringSplit(const generic_string& input, const generic_string& delimiter); std::vector<generic_string> stringSplit(const generic_string& input, const generic_string& delimiter);
bool str2numberVector(generic_string str2convert, std::vector<size_t>& numVect);
generic_string stringJoin(const std::vector<generic_string>& strings, const generic_string& separator); generic_string stringJoin(const std::vector<generic_string>& strings, const generic_string& separator);
generic_string stringTakeWhileAdmissable(const generic_string& input, const generic_string& admissable); generic_string stringTakeWhileAdmissable(const generic_string& input, const generic_string& admissable);
double stodLocale(const generic_string& str, _locale_t loc, size_t* idx = NULL); double stodLocale(const generic_string& str, _locale_t loc, size_t* idx = NULL);

View File

@ -295,6 +295,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
_mainEditView.execute(SCI_SETEDGEMODE, svp1._edgeMode); _mainEditView.execute(SCI_SETEDGEMODE, svp1._edgeMode);
_subEditView.execute(SCI_SETEDGECOLUMN, svp1._edgeNbColumn); _subEditView.execute(SCI_SETEDGECOLUMN, svp1._edgeNbColumn);
_subEditView.execute(SCI_SETEDGEMODE, svp1._edgeMode); _subEditView.execute(SCI_SETEDGEMODE, svp1._edgeMode);
::SendMessage(hwnd, NPPM_INTERNAL_EDGEMULTISETSIZE, 0, 0);
_mainEditView.showEOL(svp1._eolShow); _mainEditView.showEOL(svp1._eolShow);
_subEditView.showEOL(svp1._eolShow); _subEditView.showEOL(svp1._eolShow);

View File

@ -2337,7 +2337,69 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
break; break;
} }
case NPPM_INTERNAL_SETTING_EDGE_SIZE: case NPPM_INTERNAL_EDGEBACKGROUND:
case NPPM_INTERNAL_EDGELINE:
case NPPM_INTERNAL_EDGENONE:
{
int mode;
switch (message)
{
case NPPM_INTERNAL_EDGELINE:
{
mode = EDGE_LINE;
break;
}
case NPPM_INTERNAL_EDGEBACKGROUND:
{
mode = EDGE_BACKGROUND;
break;
}
default:
mode = EDGE_NONE;
}
_mainEditView.execute(SCI_SETEDGEMODE, mode);
_subEditView.execute(SCI_SETEDGEMODE, mode);
}
break;
case NPPM_INTERNAL_EDGEMULTILINE:
{
_mainEditView.execute(SCI_SETEDGEMODE, EDGE_MULTILINE);
_subEditView.execute(SCI_SETEDGEMODE, EDGE_MULTILINE);
}
break;
case NPPM_INTERNAL_EDGEMULTISETSIZE:
{
_mainEditView.execute(SCI_MULTIEDGECLEARALL);
_subEditView.execute(SCI_MULTIEDGECLEARALL);
ScintillaViewParams & svp = (ScintillaViewParams &)nppParam.getSVP();
StyleArray & stylers = NppParameters::getInstance().getMiscStylerArray();
COLORREF multiEdgeColor = liteGrey;
int i = stylers.getStylerIndexByName(TEXT("Edge colour"));
if (i != -1)
{
Style & style = stylers.getStyler(i);
multiEdgeColor = style._fgColor;
}
const size_t twoPower13 = 8192;
for (auto i : svp._edgeMultiColumnPos)
{
// it's absurd to set columns beyon 8000, even it's a long line.
// So let's ignore all the number greater than 2^13
if (i > twoPower13)
continue;
_mainEditView.execute(SCI_MULTIEDGEADDLINE, i, multiEdgeColor);
_subEditView.execute(SCI_MULTIEDGEADDLINE, i, multiEdgeColor);
}
}
break;
case NPPM_INTERNAL_EDGESETSIZE:
{ {
ScintillaViewParams & svp = (ScintillaViewParams &)(NppParameters::getInstance()).getSVP(); ScintillaViewParams & svp = (ScintillaViewParams &)(NppParameters::getInstance()).getSVP();
_mainEditView.execute(SCI_SETEDGECOLUMN, svp._edgeNbColumn); _mainEditView.execute(SCI_SETEDGECOLUMN, svp._edgeNbColumn);

View File

@ -3269,31 +3269,6 @@ void Notepad_plus::command(int id)
} }
break; break;
case IDM_VIEW_EDGEBACKGROUND:
case IDM_VIEW_EDGELINE:
case IDM_VIEW_EDGENONE:
{
int mode;
switch (id)
{
case IDM_VIEW_EDGELINE:
{
mode = EDGE_LINE;
break;
}
case IDM_VIEW_EDGEBACKGROUND:
{
mode = EDGE_BACKGROUND;
break;
}
default:
mode = EDGE_NONE;
}
_mainEditView.execute(SCI_SETEDGEMODE, mode);
_subEditView.execute(SCI_SETEDGEMODE, mode);
}
break;
case IDM_VIEW_LWDEF: case IDM_VIEW_LWDEF:
case IDM_VIEW_LWALIGN: case IDM_VIEW_LWALIGN:
case IDM_VIEW_LWINDENT: case IDM_VIEW_LWINDENT:

View File

@ -5273,6 +5273,8 @@ void NppParameters::feedScintillaParam(TiXmlNode *node)
_svp._edgeMode = EDGE_BACKGROUND; _svp._edgeMode = EDGE_BACKGROUND;
else if (!lstrcmp(nm, TEXT("line"))) else if (!lstrcmp(nm, TEXT("line")))
_svp._edgeMode = EDGE_LINE; _svp._edgeMode = EDGE_LINE;
else if (!lstrcmp(nm, TEXT("multiColumn")))
_svp._edgeMode = EDGE_MULTILINE;
else else
_svp._edgeMode = EDGE_NONE; _svp._edgeMode = EDGE_NONE;
} }
@ -5294,6 +5296,13 @@ void NppParameters::feedScintillaParam(TiXmlNode *node)
_svp._edgeNbColumn = val; _svp._edgeNbColumn = val;
} }
nm = element->Attribute(TEXT("edgeMultiColumnPos"));
if (nm)
{
str2numberVector(nm, _svp._edgeMultiColumnPos);
}
nm = element->Attribute(TEXT("zoom"), &val); nm = element->Attribute(TEXT("zoom"), &val);
if (nm) if (nm)
{ {
@ -5474,14 +5483,25 @@ bool NppParameters::writeScintillaParams()
(scintNode->ToElement())->SetAttribute(TEXT("borderEdge"), _svp._showBorderEdge ? TEXT("yes") : TEXT("no")); (scintNode->ToElement())->SetAttribute(TEXT("borderEdge"), _svp._showBorderEdge ? TEXT("yes") : TEXT("no"));
const TCHAR *edgeStr; const TCHAR *edgeStr;
if (_svp._edgeMode == EDGE_NONE) if (_svp._edgeMode == EDGE_LINE)
edgeStr = TEXT("no");
else if (_svp._edgeMode == EDGE_LINE)
edgeStr = TEXT("line"); edgeStr = TEXT("line");
else else if (_svp._edgeMode == EDGE_BACKGROUND)
edgeStr = TEXT("background"); edgeStr = TEXT("background");
else if (_svp._edgeMode == EDGE_MULTILINE)
edgeStr = TEXT("multiColumn");
else
edgeStr = TEXT("no");
generic_string edgeColumnPosStr;
for (auto i : _svp._edgeMultiColumnPos)
{
std::string s = std::to_string(i);
edgeColumnPosStr += generic_string(s.begin(), s.end());
edgeColumnPosStr += TEXT(" ");
}
(scintNode->ToElement())->SetAttribute(TEXT("edge"), edgeStr); (scintNode->ToElement())->SetAttribute(TEXT("edge"), edgeStr);
(scintNode->ToElement())->SetAttribute(TEXT("edgeNbColumn"), _svp._edgeNbColumn); (scintNode->ToElement())->SetAttribute(TEXT("edgeNbColumn"), _svp._edgeNbColumn);
(scintNode->ToElement())->SetAttribute(TEXT("edgeMultiColumnPos"), edgeColumnPosStr);
(scintNode->ToElement())->SetAttribute(TEXT("zoom"), _svp._zoom); (scintNode->ToElement())->SetAttribute(TEXT("zoom"), _svp._zoom);
(scintNode->ToElement())->SetAttribute(TEXT("zoom2"), _svp._zoom2); (scintNode->ToElement())->SetAttribute(TEXT("zoom2"), _svp._zoom2);
(scintNode->ToElement())->SetAttribute(TEXT("whiteSpaceShow"), _svp._whiteSpaceShow?TEXT("show"):TEXT("hide")); (scintNode->ToElement())->SetAttribute(TEXT("whiteSpaceShow"), _svp._whiteSpaceShow?TEXT("show"):TEXT("hide"));

View File

@ -922,6 +922,7 @@ struct ScintillaViewParams
bool _doWrap = false; bool _doWrap = false;
int _edgeMode = EDGE_NONE; int _edgeMode = EDGE_NONE;
int _edgeNbColumn = 80; int _edgeNbColumn = 80;
std::vector<size_t> _edgeMultiColumnPos;
int _zoom = 0; int _zoom = 0;
int _zoom2 = 0; int _zoom2 = 0;
bool _whiteSpaceShow = false; bool _whiteSpaceShow = false;

View File

@ -2596,6 +2596,7 @@ void ScintillaEditView::performGlobalStyles()
edgeColor = style._fgColor; edgeColor = style._fgColor;
} }
execute(SCI_SETEDGECOLOUR, edgeColor); execute(SCI_SETEDGECOLOUR, edgeColor);
::SendMessage(_hParent, NPPM_INTERNAL_EDGEMULTISETSIZE, 0, 0);
COLORREF foldMarginColor = grey; COLORREF foldMarginColor = grey;
COLORREF foldMarginHiColor = white; COLORREF foldMarginHiColor = white;

View File

@ -83,11 +83,13 @@ BEGIN
CONTROL "None",IDC_RADIO_FOLDMARGENONE,"Button",BS_AUTORADIOBUTTON,55,115,61,10 CONTROL "None",IDC_RADIO_FOLDMARGENONE,"Button",BS_AUTORADIOBUTTON,55,115,61,10
CONTROL "Box tree",IDC_RADIO_BOX,"Button",BS_AUTORADIOBUTTON,55,100,61,10 CONTROL "Box tree",IDC_RADIO_BOX,"Button",BS_AUTORADIOBUTTON,55,100,61,10
CONTROL "Show vertical edge",IDC_CHECK_SHOWVERTICALEDGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,153,56,122,10 CONTROL "Show vertical edge",IDC_CHECK_SHOWVERTICALEDGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,153,56,122,10
RTEXT "Number of columns :",IDC_NBCOLONE_STATIC,148,104,83,8
LTEXT "0",IDC_COLONENUMBER_STATIC,238,103,18,8,WS_TABSTOP LTEXT "0",IDC_COLONENUMBER_STATIC,238,103,18,8,WS_TABSTOP
GROUPBOX "Vertical Edge Settings",IDC_VES_GB_STATIC,142,44,148,77,BS_CENTER GROUPBOX "Vertical Edge Settings",IDC_VES_GB_STATIC,142,44,148,135,BS_CENTER
CONTROL "Line mode",IDC_RADIO_LNMODE,"Button",BS_AUTORADIOBUTTON,156,72,91,10 CONTROL "Line mode",IDC_RADIO_LNMODE,"Button",BS_AUTORADIOBUTTON,156,72,91,10
CONTROL "Background mode",IDC_RADIO_BGMODE,"Button",BS_AUTORADIOBUTTON,156,86,91,10 CONTROL "Background mode",IDC_RADIO_BGMODE,"Button",BS_AUTORADIOBUTTON,156,86,91,10
CONTROL "Multi-line mode",IDC_RADIO_MULTILNMODE,"Button",BS_AUTORADIOBUTTON,156,121,122,10
RTEXT "Number of columns :",IDC_NBCOLONE_STATIC,148,104,83,8
EDITTEXT IDC_COLUMNPOS_EDIT,165,137,110,36,ES_MULTILINE
GROUPBOX "Caret Settings",IDC_CARETSETTING_STATIC,46,1,199,40,BS_CENTER GROUPBOX "Caret Settings",IDC_CARETSETTING_STATIC,46,1,199,40,BS_CENTER
LTEXT "Width :",IDC_WIDTH_STATIC,50,20,37,8,0,WS_EX_RIGHT LTEXT "Width :",IDC_WIDTH_STATIC,50,20,37,8,0,WS_EX_RIGHT
COMBOBOX IDC_WIDTH_COMBO,89,18,40,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_WIDTH_COMBO,89,18,40,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
@ -96,22 +98,21 @@ BEGIN
LTEXT "S",IDC_CARETBLINKRATE_S_STATIC,225,25,12,8 LTEXT "S",IDC_CARETBLINKRATE_S_STATIC,225,25,12,8
LTEXT "F",IDC_CARETBLINKRATE_F_STATIC,144,25,12,8,0,WS_EX_RIGHT LTEXT "F",IDC_CARETBLINKRATE_F_STATIC,144,25,12,8,0,WS_EX_RIGHT
GROUPBOX "Multi-Editing Settings",IDC_MULTISELECTION_GB_STATIC,253,1,140,40,BS_CENTER GROUPBOX "Multi-Editing Settings",IDC_MULTISELECTION_GB_STATIC,253,1,140,40,BS_CENTER
CONTROL "Enable (Ctrl+Mouse click/selection)",IDC_CHECK_MULTISELECTION, CONTROL "Enable (Ctrl+Mouse click/selection)",IDC_CHECK_MULTISELECTION, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,261,18,130,10
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,261,18,130,10
GROUPBOX "Line Wrap",IDC_LW_GB_STATIC,301,44,92,56,BS_CENTER GROUPBOX "Line Wrap",IDC_LW_GB_STATIC,301,44,92,56,BS_CENTER
CONTROL "Default",IDC_RADIO_LWDEF,"Button",BS_AUTORADIOBUTTON | WS_GROUP,311,57,59,10 CONTROL "Default",IDC_RADIO_LWDEF,"Button",BS_AUTORADIOBUTTON | WS_GROUP,311,57,59,10
CONTROL "Aligned",IDC_RADIO_LWALIGN,"Button",BS_AUTORADIOBUTTON,311,71,60,10 CONTROL "Aligned",IDC_RADIO_LWALIGN,"Button",BS_AUTORADIOBUTTON,311,71,60,10
CONTROL "Indent",IDC_RADIO_LWINDENT,"Button",BS_AUTORADIOBUTTON,311,85,62,10 CONTROL "Indent",IDC_RADIO_LWINDENT,"Button",BS_AUTORADIOBUTTON,311,85,62,10
GROUPBOX "Border Width",IDC_BORDERWIDTH_STATIC,142,122,148,30,BS_CENTER GROUPBOX "Border Width",IDC_BORDERWIDTH_STATIC,45,135,85,45,BS_CENTER
CONTROL "",IDC_BORDERWIDTH_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,145,135,67,13 CONTROL "",IDC_BORDERWIDTH_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,48,148,67,13
LTEXT "0",IDC_BORDERWIDTHVAL_STATIC,213,135,12,8 LTEXT "0",IDC_BORDERWIDTHVAL_STATIC,116,148,12,8
CONTROL "No edge",IDC_CHECK_NOEDGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,228,135,60,10 CONTROL "No edge",IDC_CHECK_NOEDGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,53,165,60,10
CONTROL "Display line number",IDC_CHECK_LINENUMBERMARGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,298,107,141,10 CONTROL "Display line number",IDC_CHECK_LINENUMBERMARGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,298,107,141,10
CONTROL "Display bookmark",IDC_CHECK_BOOKMARKMARGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,298,120,150,10 CONTROL "Display bookmark",IDC_CHECK_BOOKMARKMARGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,298,120,150,10
CONTROL "Enable current line highlighting",IDC_CHECK_CURRENTLINEHILITE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,298,133,129,10 CONTROL "Enable current line highlighting",IDC_CHECK_CURRENTLINEHILITE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,298,133,129,10
CONTROL "Enable smooth font",IDC_CHECK_SMOOTHFONT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,298,146,129,10 CONTROL "Enable smooth font",IDC_CHECK_SMOOTHFONT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,298,146,129,10
CONTROL "Enable scrolling beyond last line",IDC_CHECK_SCROLLBEYONDLASTLINE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,298,159,139,10 CONTROL "Enable scrolling beyond last line",IDC_CHECK_SCROLLBEYONDLASTLINE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,298,159,139,10
CONTROL "Disable advanced scrolling feature\r(if you have touchpad problem)",IDC_CHECK_DISABLEADVANCEDSCROLL, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,298,172,139,18 CONTROL "Disable advanced scrolling feature\r(if you have touchpad problem)",IDC_CHECK_DISABLEADVANCEDSCROLL,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,298,172,139,18
END END
IDD_PREFERENCE_SETTING_BOX DIALOGEX 0, 0, 455, 185 IDD_PREFERENCE_SETTING_BOX DIALOGEX 0, 0, 455, 185

View File

@ -572,6 +572,22 @@ INT_PTR CALLBACK BarsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
return FALSE; return FALSE;
} }
static WNDPROC oldFunclstToolbarProc = NULL;
static LRESULT CALLBACK editNumSpaceProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_CHAR:
{
// All non decimal numbers and non white space and non backspace are ignored
if ((wParam != 8 && wParam != 32 && wParam < 48) || wParam > 57)
{
return TRUE;
}
}
}
return oldFunclstToolbarProc(hwnd, message, wParam, lParam);
}
void MarginsDlg::initScintParam() void MarginsDlg::initScintParam()
{ {
@ -630,16 +646,33 @@ void MarginsDlg::initScintParam()
::SendDlgItemMessage(_hSelf, IDC_CHECK_SHOWVERTICALEDGE, BM_SETCHECK, isEnable, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_SHOWVERTICALEDGE, BM_SETCHECK, isEnable, 0);
::SendDlgItemMessage(_hSelf, IDC_RADIO_LNMODE, BM_SETCHECK, (svp._edgeMode == EDGE_LINE), 0); ::SendDlgItemMessage(_hSelf, IDC_RADIO_LNMODE, BM_SETCHECK, (svp._edgeMode == EDGE_LINE), 0);
::SendDlgItemMessage(_hSelf, IDC_RADIO_BGMODE, BM_SETCHECK, (svp._edgeMode == EDGE_BACKGROUND), 0); ::SendDlgItemMessage(_hSelf, IDC_RADIO_BGMODE, BM_SETCHECK, (svp._edgeMode == EDGE_BACKGROUND), 0);
::SendDlgItemMessage(_hSelf, IDC_RADIO_MULTILNMODE, BM_SETCHECK, (svp._edgeMode == EDGE_MULTILINE), 0);
generic_string edgeColumnPosStr;
for (auto i : svp._edgeMultiColumnPos)
{
std::string s = std::to_string(i);
edgeColumnPosStr += generic_string(s.begin(), s.end());
edgeColumnPosStr += TEXT(" ");
}
::SendDlgItemMessage(_hSelf, IDC_COLUMNPOS_EDIT, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(edgeColumnPosStr.c_str()));
::EnableWindow(::GetDlgItem(_hSelf, IDC_RADIO_LNMODE), isEnable); ::EnableWindow(::GetDlgItem(_hSelf, IDC_RADIO_LNMODE), isEnable);
::EnableWindow(::GetDlgItem(_hSelf, IDC_RADIO_BGMODE), isEnable); ::EnableWindow(::GetDlgItem(_hSelf, IDC_RADIO_BGMODE), isEnable);
::EnableWindow(::GetDlgItem(_hSelf, IDC_NBCOLONE_STATIC), isEnable); ::EnableWindow(::GetDlgItem(_hSelf, IDC_RADIO_MULTILNMODE), isEnable);
::EnableWindow(::GetDlgItem(_hSelf, IDC_NBCOLONE_STATIC), isEnable && !isCheckedOrNot(IDC_RADIO_MULTILNMODE));
::EnableWindow(::GetDlgItem(_hSelf, IDC_COLUMNPOS_EDIT), isEnable && isCheckedOrNot(IDC_RADIO_MULTILNMODE));
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string radioboxTip = pNativeSpeaker->getLocalizedStrFromID("multi-edge-radio-tip", TEXT("Add your column marker by indicating its position with a decimal number.\nYou can define several column markers by using white space to seperate the different positions."));
_multiEdgeTip = CreateToolTip(IDC_RADIO_MULTILNMODE, _hSelf, _hInst, const_cast<PTSTR>(radioboxTip.c_str()));
oldFunclstToolbarProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(::GetDlgItem(_hSelf, IDC_COLUMNPOS_EDIT), GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(editNumSpaceProc)));
::SetDlgItemInt(_hSelf, IDC_COLONENUMBER_STATIC, svp._edgeNbColumn, FALSE); ::SetDlgItemInt(_hSelf, IDC_COLONENUMBER_STATIC, svp._edgeNbColumn, FALSE);
::ShowWindow(::GetDlgItem(_hSelf, IDC_COLONENUMBER_STATIC), isEnable); ::ShowWindow(::GetDlgItem(_hSelf, IDC_COLONENUMBER_STATIC), isEnable);
} }
INT_PTR CALLBACK MarginsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) INT_PTR CALLBACK MarginsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
{ {
NppParameters& nppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
@ -773,37 +806,57 @@ INT_PTR CALLBACK MarginsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPa
case IDC_CHECK_SHOWVERTICALEDGE: case IDC_CHECK_SHOWVERTICALEDGE:
{ {
int modeID = 0; int modeMsg = 0;
bool isChecked = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECK_SHOWVERTICALEDGE, BM_GETCHECK, 0, 0)); bool isChecked = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECK_SHOWVERTICALEDGE, BM_GETCHECK, 0, 0));
if (isChecked) if (isChecked)
{ {
::SendDlgItemMessage(_hSelf, IDC_RADIO_LNMODE, BM_SETCHECK, TRUE, 0); ::SendDlgItemMessage(_hSelf, IDC_RADIO_LNMODE, BM_SETCHECK, TRUE, 0);
svp._edgeMode = EDGE_LINE; svp._edgeMode = EDGE_LINE;
modeID = IDM_VIEW_EDGELINE; modeMsg = NPPM_INTERNAL_EDGELINE;
} }
else else
{ {
::SendDlgItemMessage(_hSelf, IDC_RADIO_LNMODE, BM_SETCHECK, FALSE, 0); ::SendDlgItemMessage(_hSelf, IDC_RADIO_LNMODE, BM_SETCHECK, FALSE, 0);
::SendDlgItemMessage(_hSelf, IDC_RADIO_BGMODE, BM_SETCHECK, FALSE, 0); ::SendDlgItemMessage(_hSelf, IDC_RADIO_BGMODE, BM_SETCHECK, FALSE, 0);
::SendDlgItemMessage(_hSelf, IDC_RADIO_MULTILNMODE, BM_SETCHECK, FALSE, 0);
svp._edgeMode = EDGE_NONE; svp._edgeMode = EDGE_NONE;
modeID = IDM_VIEW_EDGENONE; modeMsg = IDM_VIEW_EDGENONE;
} }
::EnableWindow(::GetDlgItem(_hSelf, IDC_RADIO_LNMODE), isChecked); ::EnableWindow(::GetDlgItem(_hSelf, IDC_RADIO_LNMODE), isChecked);
::EnableWindow(::GetDlgItem(_hSelf, IDC_RADIO_BGMODE), isChecked); ::EnableWindow(::GetDlgItem(_hSelf, IDC_RADIO_BGMODE), isChecked);
::EnableWindow(::GetDlgItem(_hSelf, IDC_NBCOLONE_STATIC), isChecked); ::EnableWindow(::GetDlgItem(_hSelf, IDC_RADIO_MULTILNMODE), isChecked);
::ShowWindow(::GetDlgItem(_hSelf, IDC_COLONENUMBER_STATIC), isChecked);
::SendMessage(_hParent, WM_COMMAND, modeID, 0); ::EnableWindow(::GetDlgItem(_hSelf, IDC_NBCOLONE_STATIC), isChecked && !isCheckedOrNot(IDC_RADIO_MULTILNMODE));
::ShowWindow(::GetDlgItem(_hSelf, IDC_COLONENUMBER_STATIC), isChecked && !isCheckedOrNot(IDC_RADIO_MULTILNMODE));
::EnableWindow(::GetDlgItem(_hSelf, IDC_COLUMNPOS_EDIT), isChecked && isCheckedOrNot(IDC_RADIO_MULTILNMODE));
::SendMessage(::GetParent(_hParent), modeMsg, 0, 0);
return TRUE; return TRUE;
} }
case IDC_RADIO_LNMODE: case IDC_RADIO_LNMODE:
svp._edgeMode = EDGE_LINE; svp._edgeMode = EDGE_LINE;
::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_EDGELINE, 0); ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_EDGELINE, 0, 0);
::EnableWindow(::GetDlgItem(_hSelf, IDC_NBCOLONE_STATIC), TRUE);
::ShowWindow(::GetDlgItem(_hSelf, IDC_COLONENUMBER_STATIC), TRUE);
::EnableWindow(::GetDlgItem(_hSelf, IDC_COLUMNPOS_EDIT), FALSE);
return TRUE; return TRUE;
case IDC_RADIO_BGMODE: case IDC_RADIO_BGMODE:
svp._edgeMode = EDGE_BACKGROUND; svp._edgeMode = EDGE_BACKGROUND;
::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_EDGEBACKGROUND, 0); ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_EDGEBACKGROUND, 0, 0);
::EnableWindow(::GetDlgItem(_hSelf, IDC_NBCOLONE_STATIC), TRUE);
::ShowWindow(::GetDlgItem(_hSelf, IDC_COLONENUMBER_STATIC), TRUE);
::EnableWindow(::GetDlgItem(_hSelf, IDC_COLUMNPOS_EDIT), FALSE);
return TRUE;
case IDC_RADIO_MULTILNMODE:
svp._edgeMode = EDGE_MULTILINE;
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_EDGEMULTILINE, 0, 0);
::EnableWindow(::GetDlgItem(_hSelf, IDC_NBCOLONE_STATIC), FALSE);
::ShowWindow(::GetDlgItem(_hSelf, IDC_COLONENUMBER_STATIC), FALSE);
::EnableWindow(::GetDlgItem(_hSelf, IDC_COLUMNPOS_EDIT), TRUE);
return TRUE; return TRUE;
case IDC_COLONENUMBER_STATIC: case IDC_COLONENUMBER_STATIC:
@ -825,7 +878,7 @@ INT_PTR CALLBACK MarginsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPa
::SetDlgItemInt(_hSelf, IDC_COLONENUMBER_STATIC, svp._edgeNbColumn, FALSE); ::SetDlgItemInt(_hSelf, IDC_COLONENUMBER_STATIC, svp._edgeNbColumn, FALSE);
// Execute modified value // Execute modified value
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_SETTING_EDGE_SIZE, 0, 0); ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_EDGESETSIZE, 0, 0);
} }
return TRUE; return TRUE;
} }
@ -850,18 +903,30 @@ INT_PTR CALLBACK MarginsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPa
{ {
case CBN_SELCHANGE : // == case LBN_SELCHANGE : case CBN_SELCHANGE : // == case LBN_SELCHANGE :
{ {
switch (LOWORD(wParam)) if (LOWORD(wParam) == IDC_WIDTH_COMBO)
{ {
case IDC_WIDTH_COMBO: nppGUI._caretWidth = static_cast<int32_t>(::SendDlgItemMessage(_hSelf, IDC_WIDTH_COMBO, CB_GETCURSEL, 0, 0));
{ ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_SETCARETWIDTH, 0, 0);
nppGUI._caretWidth = static_cast<int32_t>(::SendDlgItemMessage(_hSelf, IDC_WIDTH_COMBO, CB_GETCURSEL, 0, 0)); return TRUE;
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_SETCARETWIDTH, 0, 0);
return TRUE;
}
default:
break;
} }
} }
break;
case EN_CHANGE :
{
if (LOWORD(wParam) == IDC_COLUMNPOS_EDIT)
{
TCHAR text[MAX_PATH];
::SendDlgItemMessage(_hSelf, IDC_COLUMNPOS_EDIT, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(text));
if (str2numberVector(text, svp._edgeMultiColumnPos))
{
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_EDGEMULTISETSIZE, 0, 0);
return TRUE;
}
}
}
break;
} }
} }
} }

View File

@ -58,10 +58,13 @@ public :
MarginsDlg() = default; MarginsDlg() = default;
virtual void destroy() { virtual void destroy() {
_verticalEdgeLineNbColVal.destroy(); _verticalEdgeLineNbColVal.destroy();
if (_multiEdgeTip)
::DestroyWindow(_multiEdgeTip);
}; };
private : private :
URLCtrl _verticalEdgeLineNbColVal; URLCtrl _verticalEdgeLineNbColVal;
HWND _multiEdgeTip = nullptr;
INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
void initScintParam(); void initScintParam();
}; };

View File

@ -123,6 +123,9 @@
#define IDC_CHECK_NOEDGE (IDD_PREFERENCE_MARGEIN_BOX + 35) #define IDC_CHECK_NOEDGE (IDD_PREFERENCE_MARGEIN_BOX + 35)
#define IDC_CHECK_SCROLLBEYONDLASTLINE (IDD_PREFERENCE_MARGEIN_BOX + 36) #define IDC_CHECK_SCROLLBEYONDLASTLINE (IDD_PREFERENCE_MARGEIN_BOX + 36)
#define IDC_RADIO_MULTILNMODE (IDD_PREFERENCE_MARGEIN_BOX + 37)
#define IDC_COLUMNPOS_EDIT (IDD_PREFERENCE_MARGEIN_BOX + 38)
#define IDD_PREFERENCE_DELIMITERSETTINGS_BOX 6250 //(IDD_PREFERENCE_BOX + 250) #define IDD_PREFERENCE_DELIMITERSETTINGS_BOX 6250 //(IDD_PREFERENCE_BOX + 250)
#define IDC_DELIMITERSETTINGS_GB_STATIC (IDD_PREFERENCE_DELIMITERSETTINGS_BOX + 1) #define IDC_DELIMITERSETTINGS_GB_STATIC (IDD_PREFERENCE_DELIMITERSETTINGS_BOX + 1)
#define IDD_STATIC_OPENDELIMITER (IDD_PREFERENCE_DELIMITERSETTINGS_BOX + 2) #define IDD_STATIC_OPENDELIMITER (IDD_PREFERENCE_DELIMITERSETTINGS_BOX + 2)

View File

@ -280,8 +280,8 @@
#define IDM_VIEW_ZOOMOUT (IDM_VIEW + 24) #define IDM_VIEW_ZOOMOUT (IDM_VIEW + 24)
#define IDM_VIEW_TAB_SPACE (IDM_VIEW + 25) #define IDM_VIEW_TAB_SPACE (IDM_VIEW + 25)
#define IDM_VIEW_EOL (IDM_VIEW + 26) #define IDM_VIEW_EOL (IDM_VIEW + 26)
#define IDM_VIEW_EDGELINE (IDM_VIEW + 27) //#define IDM_VIEW_EDGELINE (IDM_VIEW + 27)
#define IDM_VIEW_EDGEBACKGROUND (IDM_VIEW + 28) //#define IDM_VIEW_EDGEBACKGROUND (IDM_VIEW + 28)
#define IDM_VIEW_TOGGLE_UNFOLDALL (IDM_VIEW + 29) #define IDM_VIEW_TOGGLE_UNFOLDALL (IDM_VIEW + 29)
#define IDM_VIEW_FOLD_CURRENT (IDM_VIEW + 30) #define IDM_VIEW_FOLD_CURRENT (IDM_VIEW + 30)
#define IDM_VIEW_UNFOLD_CURRENT (IDM_VIEW + 31) #define IDM_VIEW_UNFOLD_CURRENT (IDM_VIEW + 31)

View File

@ -419,7 +419,7 @@
#define NPPM_INTERNAL_RELOADNATIVELANG (NOTEPADPLUS_USER_INTERNAL + 25) #define NPPM_INTERNAL_RELOADNATIVELANG (NOTEPADPLUS_USER_INTERNAL + 25)
#define NPPM_INTERNAL_PLUGINSHORTCUTMOTIFIED (NOTEPADPLUS_USER_INTERNAL + 26) #define NPPM_INTERNAL_PLUGINSHORTCUTMOTIFIED (NOTEPADPLUS_USER_INTERNAL + 26)
#define NPPM_INTERNAL_SCINTILLAFINFERCLEARALL (NOTEPADPLUS_USER_INTERNAL + 27) #define NPPM_INTERNAL_SCINTILLAFINFERCLEARALL (NOTEPADPLUS_USER_INTERNAL + 27)
#define NPPM_INTERNAL_SETTING_EDGE_SIZE (NOTEPADPLUS_USER_INTERNAL + 28) //#define NPPM_INTERNAL_ (NOTEPADPLUS_USER_INTERNAL + 28)
#define NPPM_INTERNAL_SETTING_TAB_REPLCESPACE (NOTEPADPLUS_USER_INTERNAL + 29) #define NPPM_INTERNAL_SETTING_TAB_REPLCESPACE (NOTEPADPLUS_USER_INTERNAL + 29)
#define NPPM_INTERNAL_SETTING_TAB_SIZE (NOTEPADPLUS_USER_INTERNAL + 30) #define NPPM_INTERNAL_SETTING_TAB_SIZE (NOTEPADPLUS_USER_INTERNAL + 30)
#define NPPM_INTERNAL_RELOADSTYLERS (NOTEPADPLUS_USER_INTERNAL + 31) #define NPPM_INTERNAL_RELOADSTYLERS (NOTEPADPLUS_USER_INTERNAL + 31)
@ -441,7 +441,12 @@
#define NPPM_INTERNAL_PRNTANDQUIT (NOTEPADPLUS_USER_INTERNAL + 47) #define NPPM_INTERNAL_PRNTANDQUIT (NOTEPADPLUS_USER_INTERNAL + 47)
#define NPPM_INTERNAL_SAVEBACKUP (NOTEPADPLUS_USER_INTERNAL + 48) #define NPPM_INTERNAL_SAVEBACKUP (NOTEPADPLUS_USER_INTERNAL + 48)
#define NPPM_INTERNAL_STOPMONITORING (NOTEPADPLUS_USER_INTERNAL + 49) // Used by Monitoring feature #define NPPM_INTERNAL_STOPMONITORING (NOTEPADPLUS_USER_INTERNAL + 49) // Used by Monitoring feature
#define NPPM_INTERNAL_EDGENONE (NOTEPADPLUS_USER_INTERNAL + 50)
#define NPPM_INTERNAL_EDGELINE (NOTEPADPLUS_USER_INTERNAL + 51)
#define NPPM_INTERNAL_EDGEBACKGROUND (NOTEPADPLUS_USER_INTERNAL + 52)
#define NPPM_INTERNAL_EDGEMULTILINE (NOTEPADPLUS_USER_INTERNAL + 53)
#define NPPM_INTERNAL_EDGESETSIZE (NOTEPADPLUS_USER_INTERNAL + 54)
#define NPPM_INTERNAL_EDGEMULTISETSIZE (NOTEPADPLUS_USER_INTERNAL + 55)
//wParam: 0 //wParam: 0
//lParam: document new index //lParam: document new index
// See Notepad_plus_msgs.h // See Notepad_plus_msgs.h