From 2276229a3972ee60171e9f878f5b7bfd8d75d5fa Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Tue, 7 Oct 2014 10:45:21 +0200 Subject: [PATCH] Adjusted and applied backgroundcolors.patch Based on TortoiseSVN revision #26086. 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 3abc72bc6..3ef70f23c 100644 --- a/ext/scintilla/include/Scintilla.h +++ b/ext/scintilla/include/Scintilla.h @@ -1036,6 +1036,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCN_HOTSPOTRELEASECLICK 2027 #define SCN_FOCUSIN 2028 #define SCN_FOCUSOUT 2029 +#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 11c7fed33..50d2488ea 100644 --- a/ext/scintilla/src/EditView.cxx +++ b/ext/scintilla/src/EditView.cxx @@ -47,6 +47,7 @@ #include "EditModel.h" #include "MarginView.h" #include "EditView.h" +#include "Editor.h" #ifdef SCI_NAMESPACE using namespace Scintilla; @@ -189,6 +190,7 @@ EditView::EditView() { tabArrowHeight = 4; customDrawTabArrow = NULL; customDrawWrapMarker = NULL; + editor = NULL; } EditView::~EditView() { @@ -1640,7 +1642,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 83483625c..d667f67cd 100644 --- a/ext/scintilla/src/EditView.h +++ b/ext/scintilla/src/EditView.h @@ -76,6 +76,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 f9dfc6c37..376b32e5c 100644 --- a/ext/scintilla/src/Editor.cxx +++ b/ext/scintilla/src/Editor.cxx @@ -100,6 +100,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 132204ae4..934d77554 100644 --- a/ext/scintilla/src/Editor.h +++ b/ext/scintilla/src/Editor.h @@ -560,6 +560,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 4eec5b44a..a472d12f2 100644 --- a/ext/scintilla/win32/ScintillaWin.cxx +++ b/ext/scintilla/win32/ScintillaWin.cxx @@ -265,6 +265,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); @@ -1703,6 +1704,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