Scintilla 4.0.3
[TortoiseGit.git] / ext / scintilla / backgroundcolors.patch
blob30b542a2499dacb22e46fe6b22dbca65bb398540
1 ext/scintilla/include/Scintilla.h | 1 +
2 ext/scintilla/src/EditView.cxx | 14 +++++++++++++-
3 ext/scintilla/src/EditView.h | 1 +
4 ext/scintilla/src/Editor.cxx | 1 +
5 ext/scintilla/src/Editor.h | 1 +
6 ext/scintilla/win32/ScintillaWin.cxx | 8 ++++++++
7 6 files changed, 25 insertions(+), 1 deletion(-)
9 diff --git a/ext/scintilla/include/Scintilla.h b/ext/scintilla/include/Scintilla.h
10 index 8c8490c29..2ba34425a 100644
11 --- a/ext/scintilla/include/Scintilla.h
12 +++ b/ext/scintilla/include/Scintilla.h
13 @@ -1099,6 +1099,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
14 #define SCN_AUTOCCOMPLETED 2030
15 #define SCN_MARGINRIGHTCLICK 2031
16 #define SCN_AUTOCSELECTIONCHANGE 2032
17 /* --Autogenerated -- end of section automatically generated from Scintilla.iface */
18 +#define SCN_GETBKCOLOR 5000
20 /* These structures are defined to be exactly the same shape as the Win32
21 diff --git a/ext/scintilla/src/EditView.cxx b/ext/scintilla/src/EditView.cxx
22 index 7eec93104..f0b5feb64 100644
23 --- a/ext/scintilla/src/EditView.cxx
24 +++ b/ext/scintilla/src/EditView.cxx
25 @@ -49,6 +49,7 @@
26 #include "EditModel.h"
27 #include "MarginView.h"
28 #include "EditView.h"
29 +#include "Editor.h"
31 #ifdef SCI_NAMESPACE
32 using namespace Scintilla;
33 @@ -192,6 +193,7 @@ EditView::EditView() {
34 tabArrowHeight = 4;
35 customDrawTabArrow = NULL;
36 customDrawWrapMarker = NULL;
37 + editor = NULL;
40 EditView::~EditView() {
41 @@ -1832,7 +1834,17 @@ void EditView::DrawLine(Surface *surface, const EditModel &model, const ViewStyl
44 // See if something overrides the line background color.
45 - const ColourOptional background = vsDraw.Background(model.pdoc->GetMark(line), model.caret.active, ll->containsCaret);
46 + ColourOptional background = vsDraw.Background(model.pdoc->GetMark(line), model.caret.active, ll->containsCaret);
47 + SCNotification scn = { 0 };
48 + scn.nmhdr.code = SCN_GETBKCOLOR;
49 + scn.line = line;
50 + scn.lParam = -1;
51 + if (editor)
52 + ((Editor*)editor)->NotifyParent(&scn);
53 + if (scn.lParam != -1) {
54 + background.Set(scn.lParam);
55 + background.isSet = true;
56 + }
58 const int posLineStart = model.pdoc->LineStart(line);
60 diff --git a/ext/scintilla/src/EditView.h b/ext/scintilla/src/EditView.h
61 index c6838c238..d5a18d5ca 100644
62 --- a/ext/scintilla/src/EditView.h
63 +++ b/ext/scintilla/src/EditView.h
64 @@ -77,6 +77,7 @@ public:
65 std::unique_ptr<Surface> pixmapLine;
66 std::unique_ptr<Surface> pixmapIndentGuide;
67 std::unique_ptr<Surface> pixmapIndentGuideHighlight;
68 + void *editor;
70 LineLayoutCache llc;
71 PositionCache posCache;
72 diff --git a/ext/scintilla/src/Editor.cxx b/ext/scintilla/src/Editor.cxx
73 index d0725cb13..548c71ced 100644
74 --- a/ext/scintilla/src/Editor.cxx
75 +++ b/ext/scintilla/src/Editor.cxx
76 @@ -101,6 +101,7 @@ static inline bool IsAllSpacesOrTabs(const char *s, unsigned int len) {
79 Editor::Editor() {
80 + view.editor = this;
81 ctrlID = 0;
83 stylesValid = false;
84 diff --git a/ext/scintilla/src/Editor.h b/ext/scintilla/src/Editor.h
85 index aab80aafe..8b5abbd29 100644
86 --- a/ext/scintilla/src/Editor.h
87 +++ b/ext/scintilla/src/Editor.h
88 @@ -585,6 +585,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
89 static sptr_t BytesResult(sptr_t lParam, const unsigned char *val, size_t len);
91 public:
92 + virtual void NotifyParent(SCNotification* scn) = 0;
93 // Public so the COM thunks can access it.
94 bool IsUnicodeMode() const;
95 // Public so scintilla_send_message can use it.
96 diff --git a/ext/scintilla/win32/ScintillaWin.cxx b/ext/scintilla/win32/ScintillaWin.cxx
97 index cc4b19737..894ded74b 100644
98 --- a/ext/scintilla/win32/ScintillaWin.cxx
99 +++ b/ext/scintilla/win32/ScintillaWin.cxx
100 @@ -334,6 +334,7 @@ class ScintillaWin :
101 void SetCtrlID(int identifier) override;
102 int GetCtrlID() override;
103 void NotifyParent(SCNotification scn) override;
104 + void NotifyParent(SCNotification* scn) override;
105 void NotifyDoubleClick(Point pt, int modifiers) override;
106 CaseFolder *CaseFolderForEncoding() override;
107 std::string CaseMapString(const std::string &s, int caseMapping) override;
108 @@ -1984,6 +1985,13 @@ void ScintillaWin::NotifyParent(SCNotification scn) {
109 GetCtrlID(), reinterpret_cast<LPARAM>(&scn));
112 +void ScintillaWin::NotifyParent(SCNotification* scn) {
113 + scn->nmhdr.hwndFrom = MainHWND();
114 + scn->nmhdr.idFrom = GetCtrlID();
115 + ::SendMessage(::GetParent(MainHWND()), WM_NOTIFY,
116 + GetCtrlID(), reinterpret_cast<LPARAM>(scn));
119 void ScintillaWin::NotifyDoubleClick(Point pt, int modifiers) {
120 //Platform::DebugPrintf("ScintillaWin Double click 0\n");
121 ScintillaBase::NotifyDoubleClick(pt, modifiers);