Make Change History margin colour configurable

Ref: https://github.com/notepad-plus-plus/notepad-plus-plus/pull/12165#issuecomment-1250899679
This commit is contained in:
Don Ho 2022-09-19 19:24:57 +02:00
parent ead6fb6b8f
commit 6a801cc0a4
5 changed files with 23 additions and 2 deletions

View File

@ -3741,7 +3741,6 @@ void Notepad_plus::command(int id)
case IDM_VIEW_LINENUMBER:
case IDM_VIEW_SYMBOLMARGIN:
case IDM_VIEW_DOCCHANGEMARGIN:
{
int margin;
if (id == IDM_VIEW_LINENUMBER)

View File

@ -3632,6 +3632,7 @@ bool NppParameters::feedStylerArray(TiXmlNode *node)
_widgetStyleArray.addStyler(styleID, childNode);
}
}
const Style* pStyle = _widgetStyleArray.findByName(TEXT("EOL custom color"));
if (!pStyle)
{
@ -3643,6 +3644,17 @@ bool NppParameters::feedStylerArray(TiXmlNode *node)
_widgetStyleArray.addStyler(0, eolColorkNode);
}
pStyle = _widgetStyleArray.findByName(TEXT("Change History margin"));
if (!pStyle)
{
TiXmlNode* changeHistoryNode = globalStyleRoot->InsertEndChild(TiXmlElement(TEXT("WidgetStyle")));
changeHistoryNode->ToElement()->SetAttribute(TEXT("name"), TEXT("Change History margin"));
changeHistoryNode->ToElement()->SetAttribute(TEXT("styleID"), TEXT("0"));
changeHistoryNode->ToElement()->SetAttribute(TEXT("bgColor"), TEXT("E0E0E0"));
_widgetStyleArray.addStyler(0, changeHistoryNode);
}
return true;
}

View File

@ -2741,6 +2741,15 @@ void ScintillaEditView::performGlobalStyles()
execute(SCI_SETMARGINTYPEN, _SC_MARGE_SYMBOL, SC_MARGIN_COLOUR);
execute(SCI_SETMARGINBACKN, _SC_MARGE_SYMBOL, bookmarkMarginColor);
COLORREF changeHistoryMarginColor = veryLiteGrey;
pStyle = stylers.findByName(TEXT("Change History margin"));
if (pStyle)
{
changeHistoryMarginColor = pStyle->_bgColor;
}
execute(SCI_SETMARGINTYPEN, _SC_MARGE_CHANGEHISTORY, SC_MARGIN_COLOUR);
execute(SCI_SETMARGINBACKN, _SC_MARGE_CHANGEHISTORY, changeHistoryMarginColor);
COLORREF urlHoveredFG = grey;
pStyle = stylers.findByName(TEXT("URL hovered"));
if (pStyle)

View File

@ -302,7 +302,7 @@
#define IDM_VIEW_HIDELINES (IDM_VIEW + 42)
#define IDM_VIEW_DRAWTABBAR_VERTICAL (IDM_VIEW + 43)
#define IDM_VIEW_DRAWTABBAR_MULTILINE (IDM_VIEW + 44)
#define IDM_VIEW_DOCCHANGEMARGIN (IDM_VIEW + 45)
//#define IDM_VIEW_DOCCHANGEMARGIN (IDM_VIEW + 45)
#define IDM_VIEW_LWDEF (IDM_VIEW + 46)
#define IDM_VIEW_LWALIGN (IDM_VIEW + 47)
#define IDM_VIEW_LWINDENT (IDM_VIEW + 48)

View File

@ -1413,6 +1413,7 @@
<WidgetStyle name="Edge colour" styleID="0" fgColor="80FFFF" />
<WidgetStyle name="Line number margin" styleID="33" fgColor="808080" bgColor="E4E4E4" fontName="" fontStyle="0" fontSize="" />
<WidgetStyle name="Bookmark margin" styleID="0" bgColor="E0E0E0" />
<WidgetStyle name="Change History margin" styleID="0" bgColor="E0E0E0" />
<WidgetStyle name="Fold" styleID="0" fgColor="808080" bgColor="F3F3F3" />
<WidgetStyle name="Fold active" styleID="0" fgColor="FF0000" />
<WidgetStyle name="Fold margin" styleID="0" fgColor="FFFFFF" bgColor="E9E9E9" />