From f3fdea387b6e8cc04972502362068d2253faad39 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Tue, 7 Oct 2014 10:45:21 +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 c74253441..695d44afe 100644 --- a/ext/scintilla/include/Scintilla.h +++ b/ext/scintilla/include/Scintilla.h @@ -1069,6 +1069,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCN_FOCUSIN 2028 #define SCN_FOCUSOUT 2029 #define SCN_AUTOCCOMPLETED 2030 +#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 96fb33b66..0dc2dcd4d 100644 --- a/ext/scintilla/src/EditView.cxx +++ b/ext/scintilla/src/EditView.cxx @@ -48,6 +48,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() { @@ -1684,7 +1686,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 int posLineStart = model.pdoc->LineStart(line); diff --git a/ext/scintilla/src/EditView.h b/ext/scintilla/src/EditView.h index abb8835eb..967ccd772 100644 --- a/ext/scintilla/src/EditView.h +++ b/ext/scintilla/src/EditView.h @@ -77,6 +77,7 @@ public: Surface *pixmapLine; Surface *pixmapIndentGuide; Surface *pixmapIndentGuideHighlight; + void *editor; LineLayoutCache llc; PositionCache posCache; diff --git a/ext/scintilla/src/Editor.cxx b/ext/scintilla/src/Editor.cxx index d8b8ac6ab..b92789b58 100644 --- a/ext/scintilla/src/Editor.cxx +++ b/ext/scintilla/src/Editor.cxx @@ -101,6 +101,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 ccb5fd00f..e1bccb05e 100644 --- a/ext/scintilla/src/Editor.h +++ b/ext/scintilla/src/Editor.h @@ -579,6 +579,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 fa25b3f77..e5347d16d 100644 --- a/ext/scintilla/win32/ScintillaWin.cxx +++ b/ext/scintilla/win32/ScintillaWin.cxx @@ -334,6 +334,7 @@ class ScintillaWin : virtual void SetCtrlID(int identifier); virtual int GetCtrlID(); virtual void NotifyParent(SCNotification scn); + virtual void NotifyParent(SCNotification * scn); virtual void NotifyDoubleClick(Point pt, int modifiers); virtual CaseFolder *CaseFolderForEncoding(); virtual std::string CaseMapString(const std::string &s, int caseMapping); @@ -1959,6 +1960,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