From d1fe5e25acbc757f6035444c60f4c6a5bdf5d2bf Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Sun, 11 Jun 2017 18:56:14 +0200 Subject: [PATCH] Applied backgroundcolors.patch Signed-off-by: Sven Strickroth --- ext/scintilla/include/Scintilla.h | 1 + ext/scintilla/src/EditView.cxx | 14 +++++++++++++- ext/scintilla/src/EditView.h | 1 + ext/scintilla/src/Editor.cxx | 1 + ext/scintilla/src/Editor.h | 1 + ext/scintilla/win32/ScintillaWin.cxx | 8 ++++++++ 6 files changed, 25 insertions(+), 1 deletion(-) diff --git a/ext/scintilla/include/Scintilla.h b/ext/scintilla/include/Scintilla.h index 3c1ca527b..304dde9b1 100644 --- a/ext/scintilla/include/Scintilla.h +++ b/ext/scintilla/include/Scintilla.h @@ -1102,6 +1102,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCN_FOCUSOUT 2029 #define SCN_AUTOCCOMPLETED 2030 #define SCN_MARGINRIGHTCLICK 2031 +#define SCN_GETBKCOLOR 5000 /* --Autogenerated -- end of section automatically generated from Scintilla.iface */ /* These structures are defined to be exactly the same shape as the Win32 diff --git a/ext/scintilla/src/EditView.cxx b/ext/scintilla/src/EditView.cxx index a2bc47db9..047157d72 100644 --- a/ext/scintilla/src/EditView.cxx +++ b/ext/scintilla/src/EditView.cxx @@ -52,6 +52,7 @@ #include "EditModel.h" #include "MarginView.h" #include "EditView.h" +#include "Editor.h" #ifdef SCI_NAMESPACE using namespace Scintilla; @@ -191,6 +192,7 @@ EditView::EditView() { tabArrowHeight = 4; customDrawTabArrow = NULL; customDrawWrapMarker = NULL; + editor = NULL; } EditView::~EditView() { @@ -1874,7 +1876,17 @@ void EditView::DrawLine(Surface *surface, const EditModel &model, const ViewStyl } // See if something overrides the line background color. - const ColourOptional background = vsDraw.Background(model.pdoc->GetMark(line), model.caret.active, ll->containsCaret); + ColourOptional background = vsDraw.Background(model.pdoc->GetMark(line), model.caret.active, ll->containsCaret); + SCNotification scn = { 0 }; + scn.nmhdr.code = SCN_GETBKCOLOR; + scn.line = line; + scn.lParam = -1; + if (editor) + ((Editor*)editor)->NotifyParent(&scn); + if (scn.lParam != -1) { + background.Set(scn.lParam); + background.isSet = true; + } const Sci::Position posLineStart = model.pdoc->LineStart(line); diff --git a/ext/scintilla/src/EditView.h b/ext/scintilla/src/EditView.h index 3bf2a2cc1..bd45db230 100644 --- a/ext/scintilla/src/EditView.h +++ b/ext/scintilla/src/EditView.h @@ -77,6 +77,7 @@ public: std::unique_ptr pixmapLine; std::unique_ptr pixmapIndentGuide; std::unique_ptr pixmapIndentGuideHighlight; + void *editor; LineLayoutCache llc; PositionCache posCache; diff --git a/ext/scintilla/src/Editor.cxx b/ext/scintilla/src/Editor.cxx index ea76195f4..a48ab7b18 100644 --- a/ext/scintilla/src/Editor.cxx +++ b/ext/scintilla/src/Editor.cxx @@ -104,6 +104,7 @@ static inline bool IsAllSpacesOrTabs(const char *s, unsigned int len) { } Editor::Editor() { + view.editor = this; ctrlID = 0; stylesValid = false; diff --git a/ext/scintilla/src/Editor.h b/ext/scintilla/src/Editor.h index df0eae475..22df02c18 100644 --- a/ext/scintilla/src/Editor.h +++ b/ext/scintilla/src/Editor.h @@ -585,6 +585,7 @@ protected: // ScintillaBase subclass needs access to much of Editor static sptr_t BytesResult(sptr_t lParam, const unsigned char *val, size_t len); public: + virtual void NotifyParent(SCNotification* scn) = 0; // Public so the COM thunks can access it. bool IsUnicodeMode() const; // Public so scintilla_send_message can use it. diff --git a/ext/scintilla/win32/ScintillaWin.cxx b/ext/scintilla/win32/ScintillaWin.cxx index c7458c40f..63c70a7f5 100644 --- a/ext/scintilla/win32/ScintillaWin.cxx +++ b/ext/scintilla/win32/ScintillaWin.cxx @@ -337,6 +337,7 @@ class ScintillaWin : void SetCtrlID(int identifier) override; int GetCtrlID() override; void NotifyParent(SCNotification scn) override; + void NotifyParent(SCNotification* scn) override; void NotifyDoubleClick(Point pt, int modifiers) override; CaseFolder *CaseFolderForEncoding() override; std::string CaseMapString(const std::string &s, int caseMapping) override; @@ -1987,6 +1988,13 @@ void ScintillaWin::NotifyParent(SCNotification scn) { GetCtrlID(), reinterpret_cast(&scn)); } +void ScintillaWin::NotifyParent(SCNotification* scn) { + scn->nmhdr.hwndFrom = MainHWND(); + scn->nmhdr.idFrom = GetCtrlID(); + ::SendMessage(::GetParent(MainHWND()), WM_NOTIFY, + GetCtrlID(), reinterpret_cast(scn)); +} + void ScintillaWin::NotifyDoubleClick(Point pt, int modifiers) { //Platform::DebugPrintf("ScintillaWin Double click 0\n"); ScintillaBase::NotifyDoubleClick(pt, modifiers); -- 2.11.4.GIT