From d3e77c0e6f454374ad5e803da4c35fde9ce7ef45 Mon Sep 17 00:00:00 2001 From: Shridhar Kumar <45252729+shriprem@users.noreply.github.com> Date: Wed, 13 Apr 2022 21:00:50 -0400 Subject: [PATCH] Add "Framed current line" option beside of "Highlight current line background" The related GUI in Preferences dialog has been organized in the adapted way for the new option. Fix #11501, close #11534 --- PowerEditor/src/NppBigSwitch.cpp | 7 ++ PowerEditor/src/NppCommands.cpp | 20 ++++- PowerEditor/src/Parameters.cpp | 39 ++++++++- PowerEditor/src/Parameters.h | 3 +- .../ScintillaComponent/ScintillaEditView.cpp | 7 +- .../ScintillaComponent/ScintillaEditView.h | 9 -- .../src/ScintillaComponent/ScintillaRef.h | 1 + .../src/WinControls/Preference/preference.rc | 53 +++++++----- .../WinControls/Preference/preferenceDlg.cpp | 84 +++++++++++++++++-- .../WinControls/Preference/preferenceDlg.h | 1 + .../WinControls/Preference/preference_rc.h | 15 +++- PowerEditor/src/resource.h | 1 + 12 files changed, 190 insertions(+), 50 deletions(-) diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index 73a7d3cfe..f2f5e8e04 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -1563,6 +1563,13 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa return TRUE; } + case NPPM_INTERNAL_CARETLINEFRAME: + { + _mainEditView.execute(SCI_SETCARETLINEFRAME, lParam); + _subEditView.execute(SCI_SETCARETLINEFRAME, lParam); + return TRUE; + } + case NPPM_SETEDITORBORDEREDGE: { bool withBorderEdge = (lParam == 1); diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index ba1017eb4..c4dc88d15 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -3745,12 +3745,24 @@ void Notepad_plus::command(int id) case IDM_VIEW_CURLINE_HILITING: { NppParameters& nppParams = NppParameters::getInstance(); + const ScintillaViewParams& svp = nppParams.getSVP(); - COLORREF colour{ nppParams.getCurLineHilitingColour() }; - bool hilite{ nppParams.getSVP()._currentLineHilitingShow }; + const COLORREF bgColour { nppParams.getCurLineHilitingColour() }; + const LPARAM frameWidth { (svp._currentLineHiliteMode == LINEHILITE_FRAME) ? svp._currentLineFrameWidth : 0 }; - _mainEditView.setCurrentLineHiLiting(hilite, colour); - _subEditView.setCurrentLineHiLiting(hilite, colour); + if (svp._currentLineHiliteMode != LINEHILITE_NONE) + { + _mainEditView.execute(SCI_SETELEMENTCOLOUR, SC_ELEMENT_CARET_LINE_BACK, bgColour); + _subEditView.execute(SCI_SETELEMENTCOLOUR, SC_ELEMENT_CARET_LINE_BACK, bgColour); + } + else + { + _mainEditView.execute(SCI_RESETELEMENTCOLOUR, SC_ELEMENT_CARET_LINE_BACK, NULL); + _subEditView.execute(SCI_RESETELEMENTCOLOUR, SC_ELEMENT_CARET_LINE_BACK, NULL); + } + + _mainEditView.execute(SCI_SETCARETLINEFRAME, frameWidth); + _subEditView.execute(SCI_SETCARETLINEFRAME, frameWidth); } break; diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index f4703c4b6..3c62693e5 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -5671,9 +5671,38 @@ void NppParameters::feedScintillaParam(TiXmlNode *node) if (nm) { if (!lstrcmp(nm, TEXT("show"))) - _svp._currentLineHilitingShow = true; - else if (!lstrcmp(nm, TEXT("hide"))) - _svp._currentLineHilitingShow = false; + _svp._currentLineHiliteMode = LINEHILITE_HILITE; + else + _svp._currentLineHiliteMode = LINEHILITE_NONE; + } + else + { + const TCHAR* currentLineModeStr = element->Attribute(TEXT("currentLineIndicator")); + if (currentLineModeStr && currentLineModeStr[0]) + { + if (lstrcmp(currentLineModeStr, TEXT("1")) == 0) + _svp._currentLineHiliteMode = LINEHILITE_HILITE; + else if (lstrcmp(currentLineModeStr, TEXT("2")) == 0) + _svp._currentLineHiliteMode = LINEHILITE_FRAME; + else + _svp._currentLineHiliteMode = LINEHILITE_NONE; + } + } + + // Current Line Frame Width + nm = element->Attribute(TEXT("currentLineFrameWidth")); + if (nm) + { + unsigned char frameWidth{ 1 }; + try + { + frameWidth = static_cast(std::stoi(nm)); + } + catch (...) + { + // do nothing. frameWidth is already set to '1'. + } + _svp._currentLineFrameWidth = (frameWidth < 1) ? 1 : (frameWidth > 6) ? 6 : frameWidth; } // Virtual Space @@ -6062,7 +6091,9 @@ bool NppParameters::writeScintillaParams() (_svp._lineWrapMethod == LINEWRAP_INDENT)?TEXT("indent"):TEXT("default"); (scintNode->ToElement())->SetAttribute(TEXT("lineWrapMethod"), pWrapMethodStr); - (scintNode->ToElement())->SetAttribute(TEXT("currentLineHilitingShow"), _svp._currentLineHilitingShow?TEXT("show"):TEXT("hide")); + (scintNode->ToElement())->SetAttribute(TEXT("currentLineIndicator"), _svp._currentLineHiliteMode); + (scintNode->ToElement())->SetAttribute(TEXT("currentLineFrameWidth"), _svp._currentLineFrameWidth); + (scintNode->ToElement())->SetAttribute(TEXT("virtualSpace"), _svp._virtualSpace?TEXT("yes"):TEXT("no")); (scintNode->ToElement())->SetAttribute(TEXT("scrollBeyondLastLine"), _svp._scrollBeyondLastLine?TEXT("yes"):TEXT("no")); (scintNode->ToElement())->SetAttribute(TEXT("rightClickKeepsSelection"), _svp._rightClickKeepsSelection ? TEXT("yes") : TEXT("no")); diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index afa18f6d0..7b4e412b3 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -887,7 +887,8 @@ struct ScintillaViewParams lineWrapMethod _lineWrapMethod = LINEWRAP_ALIGNED; bool _foldMarginShow = true; bool _indentGuideLineShow = true; - bool _currentLineHilitingShow = true; + lineHiliteMode _currentLineHiliteMode = LINEHILITE_HILITE; + unsigned char _currentLineFrameWidth = 1; // 1-6 pixel bool _wrapSymbolShow = false; bool _doWrap = false; bool _isEdgeBgMode = false; diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp index a799800e7..55b88d859 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp @@ -2568,10 +2568,12 @@ void ScintillaEditView::expand(size_t& line, bool doExpand, bool force, intptr_t void ScintillaEditView::performGlobalStyles() { NppParameters& nppParams = NppParameters::getInstance(); + const ScintillaViewParams& svp = nppParams.getSVP(); + StyleArray& stylers = nppParams.getMiscStylerArray(); const Style* pStyle{}; - if (nppParams.getSVP()._currentLineHilitingShow) + if (svp._currentLineHiliteMode != LINEHILITE_NONE) { pStyle = stylers.findByName(TEXT("Current line background colour")); if (pStyle) @@ -2580,6 +2582,8 @@ void ScintillaEditView::performGlobalStyles() } } + execute(SCI_SETCARETLINEFRAME, (svp._currentLineHiliteMode == LINEHILITE_FRAME) ? svp._currentLineFrameWidth : 0); + COLORREF selectColorBack = grey; COLORREF selectColorFore = black; pStyle = stylers.findByName(TEXT("Selected text colour")); @@ -2649,7 +2653,6 @@ void ScintillaEditView::performGlobalStyles() COLORREF foldfgColor = white, foldbgColor = grey, activeFoldFgColor = red; getFoldColor(foldfgColor, foldbgColor, activeFoldFgColor); - ScintillaViewParams & svp = (ScintillaViewParams &)nppParams.getSVP(); for (int j = 0 ; j < NB_FOLDER_STATE ; ++j) defineMarker(_markersArray[FOLDER_TYPE][j], _markersArray[svp._folderStyle][j], foldfgColor, foldbgColor, activeFoldFgColor); diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.h b/PowerEditor/src/ScintillaComponent/ScintillaEditView.h index ebcc4350e..05112c4bf 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.h @@ -466,15 +466,6 @@ public: } void updateLineNumberWidth(); - - - void setCurrentLineHiLiting(bool isHiliting, COLORREF bgColor) const { - if (isHiliting) - execute(SCI_SETELEMENTCOLOUR, SC_ELEMENT_CARET_LINE_BACK, bgColor); - else - execute(SCI_RESETELEMENTCOLOUR, SC_ELEMENT_CARET_LINE_BACK, NULL); - }; - void performGlobalStyles(); void expand(size_t& line, bool doExpand, bool force = false, intptr_t visLevels = 0, intptr_t level = -1); diff --git a/PowerEditor/src/ScintillaComponent/ScintillaRef.h b/PowerEditor/src/ScintillaComponent/ScintillaRef.h index d126a38e3..9852a49c0 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaRef.h +++ b/PowerEditor/src/ScintillaComponent/ScintillaRef.h @@ -20,5 +20,6 @@ enum folderStyle {FOLDER_TYPE, FOLDER_STYLE_SIMPLE, FOLDER_STYLE_ARROW, FOLDER_STYLE_CIRCLE, FOLDER_STYLE_BOX, FOLDER_STYLE_NONE}; enum lineWrapMethod {LINEWRAP_DEFAULT, LINEWRAP_ALIGNED, LINEWRAP_INDENT}; +enum lineHiliteMode {LINEHILITE_NONE, LINEHILITE_HILITE, LINEHILITE_FRAME}; #endif //SCINTILLA_REF_H diff --git a/PowerEditor/src/WinControls/Preference/preference.rc b/PowerEditor/src/WinControls/Preference/preference.rc index 420cb9e60..82218a116 100644 --- a/PowerEditor/src/WinControls/Preference/preference.rc +++ b/PowerEditor/src/WinControls/Preference/preference.rc @@ -68,31 +68,44 @@ BEGIN END - -IDD_PREFERENCE_SUB_EDITING DIALOGEX 0, 0, 455, 185 +IDD_PREFERENCE_SUB_EDITING DIALOGEX 0, 0, 455, 203 STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - GROUPBOX "Caret Settings",IDC_CARETSETTING_STATIC,53,6,186,67,BS_CENTER - LTEXT "Width :",IDC_WIDTH_STATIC,81,27,37,8,0,WS_EX_RIGHT - COMBOBOX IDC_WIDTH_COMBO,125,25,40,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - RTEXT "Blink rate :",IDC_BLINKRATE_STATIC,57,52,60,8 - CONTROL "",IDC_CARETBLINKRATE_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | TBS_NOTICKS | TBS_TRANSPARENTBKGND | WS_TABSTOP,134,52,67,13 - LTEXT "S",IDC_CARETBLINKRATE_S_STATIC,203,52,12,8 - LTEXT "F",IDC_CARETBLINKRATE_F_STATIC,122,52,12,8,0,WS_EX_RIGHT - GROUPBOX "Line Wrap",IDC_LW_GB_STATIC,265,6,92,66,BS_CENTER - 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,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 virtual space",IDC_CHECK_VIRTUALSPACE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,129,270,10 - CONTROL "Enable scrolling beyond last line",IDC_CHECK_SCROLLBEYONDLASTLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,142,270,10 - CONTROL "Keep selection when right-click outside of selection",IDC_CHECK_RIGHTCLICKKEEPSSELECTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,155,270,10 - CONTROL "Disable advanced scrolling feature due to touchpad issue",IDC_CHECK_DISABLEADVANCEDSCROLL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,168,270,10 + GROUPBOX "Caret Settings",IDC_CARETSETTING_STATIC,25,6,156,67,BS_CENTER + LTEXT "Width :",IDC_WIDTH_STATIC,53,27,37,8,0,WS_EX_RIGHT + COMBOBOX IDC_WIDTH_COMBO,97,25,40,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + RTEXT "Blink rate :",IDC_BLINKRATE_STATIC,28,52,60,8 + CONTROL "",IDC_CARETBLINKRATE_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | TBS_NOTICKS | TBS_TRANSPARENTBKGND | WS_TABSTOP,105,52,57,13 + LTEXT "S",IDC_CARETBLINKRATE_S_STATIC,166,52,12,8 + LTEXT "F",IDC_CARETBLINKRATE_F_STATIC,93,52,12,8,0,WS_EX_RIGHT + + GROUPBOX "Line Wrap",IDC_LW_GB_STATIC,193,6,78,67,BS_CENTER + CONTROL "Default",IDC_RADIO_LWDEF,"Button",BS_AUTORADIOBUTTON | WS_GROUP,203,21,59,10 + CONTROL "Aligned",IDC_RADIO_LWALIGN,"Button",BS_AUTORADIOBUTTON,203,36,60,10 + CONTROL "Indent",IDC_RADIO_LWINDENT,"Button",BS_AUTORADIOBUTTON,203,51,62,10 + + GROUPBOX "Current Line Indicator",IDC_CURRENTLINEMARK_STATIC,284,6,129,83,BS_CENTER + CONTROL "None",IDC_RADIO_CLM_NONE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,307,22,100,10 + CONTROL "Highlight Background",IDC_RADIO_CLM_HILITE,"Button",BS_AUTORADIOBUTTON,307,37,100,10 + CONTROL "Frame",IDC_RADIO_CLM_FRAME,"Button",BS_AUTORADIOBUTTON,307,52,100,10 + LTEXT "Width :",IDC_CARETLINEFRAME_WIDTH_STATIC,299,67,37,8,0,WS_EX_RIGHT + CONTROL "",IDC_CARETLINEFRAME_WIDTH_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | TBS_NOTICKS | TBS_TRANSPARENTBKGND | WS_TABSTOP,337,67,57,13 + LTEXT "1",IDC_CARETLINEFRAME_WIDTH_DISPLAY,396,67,12,8 + + CONTROL "Enable Multi-Editing (Ctrl+Mouse click/selection)",IDC_CHECK_MULTISELECTION, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,26,114,270,10 + CONTROL "Enable smooth font",IDC_CHECK_SMOOTHFONT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,26,129,250,10 + CONTROL "Enable virtual space",IDC_CHECK_VIRTUALSPACE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,26,142,270,10 + CONTROL "Enable scrolling beyond last line",IDC_CHECK_SCROLLBEYONDLASTLINE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,26,155,270,10 + CONTROL "Keep selection when right-click outside of selection",IDC_CHECK_RIGHTCLICKKEEPSSELECTION, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,26,168,270,10 + CONTROL "Disable advanced scrolling feature due to touchpad issue",IDC_CHECK_DISABLEADVANCEDSCROLL, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,26,181,270,10 END + IDD_PREFERENCE_SUB_DARKMODE DIALOGEX 0, 0, 455, 185 STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD FONT 8, "MS Shell Dlg", 0, 0, 0x1 diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index ee2164ada..e43bd8642 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -28,6 +28,10 @@ const int BLINKRATE_FASTEST = 50; const int BLINKRATE_SLOWEST = 2500; const int BLINKRATE_INTERVAL = 50; +const int CARETLINEFRAME_SMALLEST = 1; +const int CARETLINEFRAME_LARGEST = 6; +const int CARETLINEFRAME_INTERVAL = 1; + const int BORDERWIDTH_SMALLEST = 0; const int BORDERWIDTH_LARGEST = 30; const int BORDERWIDTH_INTERVAL = 1; @@ -699,13 +703,35 @@ void EditingSubDlg::initScintParam() ::SendDlgItemMessage(_hSelf, id, BM_SETCHECK, TRUE, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_SMOOTHFONT, BM_SETCHECK, svp._doSmoothFont, 0); - ::SendDlgItemMessage(_hSelf, IDC_CHECK_CURRENTLINEHILITE, BM_SETCHECK, svp._currentLineHilitingShow, 0); + + int lineHilite = 0; + switch (svp._currentLineHiliteMode) + { + case LINEHILITE_NONE: + lineHilite = IDC_RADIO_CLM_NONE; + break; + case LINEHILITE_FRAME: + lineHilite = IDC_RADIO_CLM_FRAME; + break; + default : // LINEHILITE_HILITE + lineHilite = IDC_RADIO_CLM_HILITE; + } + ::SendDlgItemMessage(_hSelf, lineHilite, BM_SETCHECK, TRUE, 0); + ::EnableWindow(::GetDlgItem(_hSelf, IDC_CARETLINEFRAME_WIDTH_SLIDER), (svp._currentLineHiliteMode == LINEHILITE_FRAME)); + ::SendDlgItemMessage(_hSelf, IDC_CHECK_VIRTUALSPACE, BM_SETCHECK, svp._virtualSpace, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_SCROLLBEYONDLASTLINE, BM_SETCHECK, svp._scrollBeyondLastLine, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_RIGHTCLICKKEEPSSELECTION, BM_SETCHECK, svp._rightClickKeepsSelection, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_DISABLEADVANCEDSCROLL, BM_SETCHECK, svp._disableAdvancedScrolling, 0); } +void EditingSubDlg::changeLineHiliteMode(bool enableSlider) +{ + ::EnableWindow(::GetDlgItem(_hSelf, IDC_CARETLINEFRAME_WIDTH_SLIDER), enableSlider); + redraw(); + ::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_CURLINE_HILITING, 0); +} + static WNDPROC oldFunclstToolbarProc = NULL; static LRESULT CALLBACK editNumSpaceProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { @@ -728,7 +754,9 @@ intptr_t CALLBACK EditingSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM { NppParameters& nppParam = NppParameters::getInstance(); NppGUI & nppGUI = nppParam.getNppGUI(); - switch (message) + ScintillaViewParams& svp = (ScintillaViewParams&)nppParam.getSVP(); + + switch (message) { case WM_INITDIALOG : { @@ -748,6 +776,11 @@ intptr_t CALLBACK EditingSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM int blinkRate = (nppGUI._caretBlinkRate==0)?BLINKRATE_SLOWEST:nppGUI._caretBlinkRate; ::SendMessage(::GetDlgItem(_hSelf, IDC_CARETBLINKRATE_SLIDER),TBM_SETPOS, TRUE, blinkRate); + ::SendMessage(::GetDlgItem(_hSelf, IDC_CARETLINEFRAME_WIDTH_SLIDER), TBM_SETRANGEMIN, TRUE, CARETLINEFRAME_SMALLEST); + ::SendMessage(::GetDlgItem(_hSelf, IDC_CARETLINEFRAME_WIDTH_SLIDER), TBM_SETRANGEMAX, TRUE, CARETLINEFRAME_LARGEST); + ::SendMessage(::GetDlgItem(_hSelf, IDC_CARETLINEFRAME_WIDTH_SLIDER), TBM_SETPAGESIZE, 0, CARETLINEFRAME_INTERVAL); + ::SendMessage(::GetDlgItem(_hSelf, IDC_CARETLINEFRAME_WIDTH_SLIDER), TBM_SETPOS, TRUE, svp._currentLineFrameWidth); + ::SetDlgItemInt(_hSelf, IDC_CARETLINEFRAME_WIDTH_DISPLAY, svp._currentLineFrameWidth, FALSE); initScintParam(); @@ -764,8 +797,24 @@ intptr_t CALLBACK EditingSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM } case WM_CTLCOLORDLG: + { + if (NppDarkMode::isEnabled()) + { + return NppDarkMode::onCtlColorDarker(reinterpret_cast(wParam)); + } + break; + } + case WM_CTLCOLORSTATIC: { + int dlgCtrlID = ::GetDlgCtrlID(reinterpret_cast(lParam)); + + // handle blurry text with disabled states for the affected static controls + if (dlgCtrlID == IDC_CARETLINEFRAME_WIDTH_STATIC || dlgCtrlID == IDC_CARETLINEFRAME_WIDTH_DISPLAY) + { + return NppDarkMode::onCtlColorDarkerBGStaticText(reinterpret_cast(wParam), (svp._currentLineHiliteMode == LINEHILITE_FRAME)); + } + if (NppDarkMode::isEnabled()) { return NppDarkMode::onCtlColorDarker(reinterpret_cast(wParam)); @@ -784,16 +833,25 @@ intptr_t CALLBACK EditingSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM case WM_HSCROLL: { - HWND hCaretBlikRateSlider = ::GetDlgItem(_hSelf, IDC_CARETBLINKRATE_SLIDER); - if (reinterpret_cast(lParam) == hCaretBlikRateSlider) + HWND hCaretBlinkRateSlider = ::GetDlgItem(_hSelf, IDC_CARETBLINKRATE_SLIDER); + HWND hCaretLineFrameSlider = ::GetDlgItem(_hSelf, IDC_CARETLINEFRAME_WIDTH_SLIDER); + + if (reinterpret_cast(lParam) == hCaretBlinkRateSlider) { - auto blinkRate = ::SendMessage(hCaretBlikRateSlider, TBM_GETPOS, 0, 0); + auto blinkRate = ::SendMessage(hCaretBlinkRateSlider, TBM_GETPOS, 0, 0); if (blinkRate == BLINKRATE_SLOWEST) blinkRate = 0; nppGUI._caretBlinkRate = static_cast(blinkRate); ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_SETCARETBLINKRATE, 0, 0); } + else if (reinterpret_cast(lParam) == hCaretLineFrameSlider) + { + svp._currentLineFrameWidth = static_cast(::SendMessage(hCaretLineFrameSlider, TBM_GETPOS, 0, 0)); + ::SetDlgItemInt(_hSelf, IDC_CARETLINEFRAME_WIDTH_DISPLAY, svp._currentLineFrameWidth, FALSE); + ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_CARETLINEFRAME, NULL, svp._currentLineFrameWidth); + } + return 0; //return zero when handled } @@ -807,9 +865,19 @@ intptr_t CALLBACK EditingSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM ::SendMessage(::GetParent(_hParent), NPPM_SETSMOOTHFONT, 0, svp._doSmoothFont); return TRUE; - case IDC_CHECK_CURRENTLINEHILITE: - svp._currentLineHilitingShow = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECK_CURRENTLINEHILITE, BM_GETCHECK, 0, 0)); - ::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_CURLINE_HILITING, 0); + case IDC_RADIO_CLM_NONE: + svp._currentLineHiliteMode = LINEHILITE_NONE; + changeLineHiliteMode(false); + return TRUE; + + case IDC_RADIO_CLM_HILITE: + svp._currentLineHiliteMode = LINEHILITE_HILITE; + changeLineHiliteMode(false); + return TRUE; + + case IDC_RADIO_CLM_FRAME: + svp._currentLineHiliteMode = LINEHILITE_FRAME; + changeLineHiliteMode(true); return TRUE; case IDC_CHECK_VIRTUALSPACE: diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.h b/PowerEditor/src/WinControls/Preference/preferenceDlg.h index ae21d3f8d..3327d7301 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.h +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.h @@ -52,6 +52,7 @@ public : private : intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); void initScintParam(); + void changeLineHiliteMode(bool enableSlider); }; class DarkModeSubDlg : public StaticDialog diff --git a/PowerEditor/src/WinControls/Preference/preference_rc.h b/PowerEditor/src/WinControls/Preference/preference_rc.h index c8779572a..2f884482d 100644 --- a/PowerEditor/src/WinControls/Preference/preference_rc.h +++ b/PowerEditor/src/WinControls/Preference/preference_rc.h @@ -97,7 +97,7 @@ #define IDC_VES_GB_STATIC (IDD_PREFERENCE_SUB_EDITING + 11) #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_CURRENTLINEHILITE (IDD_PREFERENCE_SUB_EDITING + 14) #define IDC_CHECK_SMOOTHFONT (IDD_PREFERENCE_SUB_EDITING + 15) #define IDC_CARETSETTING_STATIC (IDD_PREFERENCE_SUB_EDITING + 16) @@ -107,7 +107,7 @@ #define IDC_CARETBLINKRATE_SLIDER (IDD_PREFERENCE_SUB_EDITING + 20) #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_CHECK_DOCCHANGESTATEMARGE (IDD_PREFERENCE_SUB_EDITING + 23) #define IDC_DISTRACTIONFREE_SLIDER (IDD_PREFERENCE_SUB_EDITING + 24) #define IDC_CHECK_MULTISELECTION (IDD_PREFERENCE_SUB_EDITING + 25) @@ -136,6 +136,7 @@ #define IDC_CHECK_VIRTUALSPACE (IDD_PREFERENCE_SUB_EDITING + 45) + #define IDD_PREFERENCE_SUB_DELIMITER 6250 //(IDD_PREFERENCE_BOX + 250) #define IDC_DELIMITERSETTINGS_GB_STATIC (IDD_PREFERENCE_SUB_DELIMITER + 1) #define IDD_STATIC_OPENDELIMITER (IDD_PREFERENCE_SUB_DELIMITER + 2) @@ -279,6 +280,7 @@ #define IDC_CHECK_DEFAULTTABVALUE (IDD_PREFERENCE_SUB_LANGUAGE + 10) #define IDC_GR_TABVALUE_STATIC (IDD_PREFERENCE_SUB_LANGUAGE + 11) #define IDC_TABSIZEVAL_DISABLE_STATIC (IDD_PREFERENCE_SUB_LANGUAGE + 12) + #define IDD_PREFERENCE_SUB_HIGHLIGHTING 6550 //(IDD_PREFERENCE_BOX + 500) #define IDD_PREFERENCE_SUB_PRINT 6600 //(IDD_PREFERENCE_BOX + 600) @@ -298,6 +300,15 @@ #define IDC_MR_STATIC (IDD_PREFERENCE_SUB_PRINT + 14) #define IDC_MB_STATIC (IDD_PREFERENCE_SUB_PRINT + 15) +#define IDD_PREFERENCE_SUB_EXT 6650 //(IDD_PREFERENCE_BOX + 650) : For all items with no room + #define IDC_CURRENTLINEMARK_STATIC (IDD_PREFERENCE_SUB_EXT + 1) + #define IDC_RADIO_CLM_NONE (IDD_PREFERENCE_SUB_EXT + 2) + #define IDC_RADIO_CLM_HILITE (IDD_PREFERENCE_SUB_EXT + 3) + #define IDC_RADIO_CLM_FRAME (IDD_PREFERENCE_SUB_EXT + 4) + #define IDC_CARETLINEFRAME_WIDTH_STATIC (IDD_PREFERENCE_SUB_EXT + 5) + #define IDC_CARETLINEFRAME_WIDTH_SLIDER (IDD_PREFERENCE_SUB_EXT + 6) + #define IDC_CARETLINEFRAME_WIDTH_DISPLAY (IDD_PREFERENCE_SUB_EXT + 7) + #define IDD_PREFERENCE_PRINT2_BOX 6700 //(IDD_PREFERENCE_BOX + 700) #define IDC_EDIT_HLEFT (IDD_PREFERENCE_PRINT2_BOX + 1) #define IDC_EDIT_HMIDDLE (IDD_PREFERENCE_PRINT2_BOX + 2) diff --git a/PowerEditor/src/resource.h b/PowerEditor/src/resource.h index 06fdda4c3..75f71489a 100644 --- a/PowerEditor/src/resource.h +++ b/PowerEditor/src/resource.h @@ -636,6 +636,7 @@ #define NPPM_INTERNAL_SCINTILLAFINDERCOPYPATHS (NOTEPADPLUS_USER_INTERNAL + 60) #define NPPM_INTERNAL_REFRESHWORKDIR (NOTEPADPLUS_USER_INTERNAL + 61) #define NPPM_INTERNAL_VIRTUALSPACE (NOTEPADPLUS_USER_INTERNAL + 62) + #define NPPM_INTERNAL_CARETLINEFRAME (NOTEPADPLUS_USER_INTERNAL + 63) // See Notepad_plus_msgs.h //#define NOTEPADPLUS_USER (WM_USER + 1000)