Patch #2597 2008-11-18 01:54

gryphon

Changebar patch for scintilla branch
Download
2597-Changebar_patc.patch (34.5 KB)
Category
Application::FeatureAdd
Status
Closed
Close date
2009-01-19 06:16
Assigned to
jenslody
Index: src/sdk/cbeditor.cpp
===================================================================
--- src/sdk/cbeditor.cpp    (revision 5311)
+++ src/sdk/cbeditor.cpp    (working copy)
@@ -55,8 +55,15 @@
 #define DEBUG_MARKER        4
 #define DEBUG_STYLE         wxSCI_MARK_ARROW
 
+#define CHANGEUNSAVED_MARKER    23
+#define CHANGEUNSAVED_STYLE     wxSCI_MARK_LEFTRECT
 
+#define CHANGESAVED_MARKER      24
+#define CHANGESAVED_STYLE       wxSCI_MARK_LEFTRECT
 
+static const int foldingMargin   = 2;
+static const int changebarMargin = 3;
+
 /* This struct holds private data for the cbEditor class.
  * It's a paradigm to avoid rebuilding the entire project (as cbEditor is a basic dependency)
  * for just adding a private var or method.
@@ -1064,6 +1071,16 @@
 
     control->SetEOLMode(mgr->ReadInt(_T("/eol/eolmode"), default_eol));
 
+    control->SetMarginType(changebarMargin,  wxSCI_MARGIN_SYMBOL);
+    control->SetMarginWidth(changebarMargin, 4);
+    control->SetMarginMask(changebarMargin, (1 << CHANGEUNSAVED_MARKER) | (1 << CHANGESAVED_MARKER) );
+    control->SetMarginUseFoldingBackground(changebarMargin, true);
+
+    control->MarkerDefine(CHANGEUNSAVED_MARKER, CHANGEUNSAVED_STYLE);
+    control->MarkerSetBackground(CHANGEUNSAVED_MARKER, wxColour(0xFF, 0xE6, 0x04));
+    control->MarkerDefine(CHANGESAVED_MARKER, CHANGESAVED_STYLE);
+    control->MarkerSetBackground(CHANGESAVED_MARKER, wxColour(0x04, 0xFF, 0x50));
+
     // folding margin
     control->SetProperty(_T("fold"), mgr->ReadBool(_T("/folding/show_folds"), true) ? _T("1") : _T("0"));
     control->SetProperty(_T("fold.html"), mgr->ReadBool(_T("/folding/fold_xml"), true) ? _T("1") : _T("0"));
@@ -1073,10 +1090,10 @@
     if (mgr->ReadBool(_T("/folding/show_folds"), true))
     {
         control->SetFoldFlags(16);
-        control->SetMarginType(2, wxSCI_MARGIN_SYMBOL);
-        control->SetMarginWidth(2, 16);
-        control->SetMarginMask(2, wxSCI_MASK_FOLDERS);
-        control->SetMarginSensitive(2, 1);
+        control->SetMarginType(foldingMargin, wxSCI_MARGIN_SYMBOL);
+        control->SetMarginWidth(foldingMargin, 16);
+        control->SetMarginMask(foldingMargin, wxSCI_MASK_FOLDERS);
+        control->SetMarginSensitive(foldingMargin, 1);
 
         /*Default behaviour
         control->MarkerDefine(wxSCI_MARKNUM_FOLDEROPEN, wxSCI_MARK_BOXMINUS);
@@ -1103,7 +1120,7 @@
         */
     }
     else
-        control->SetMarginWidth(2, 0);
+        control->SetMarginWidth(foldingMargin, 0);
 }
 
 // static
@@ -2269,7 +2286,8 @@
         wxPoint clientpos(ScreenToClient(position));
         const int margin = m_pControl->GetMarginWidth(0) + // numbers, if present
                            m_pControl->GetMarginWidth(1) + // breakpoints, bookmarks... if present
-                           m_pControl->GetMarginWidth(2);  // folding, if present
+                           m_pControl->GetMarginWidth(changebarMargin) +
+                           m_pControl->GetMarginWidth(foldingMargin);  // folding, if present
         wxRect r = m_pControl->GetRect();
 
         bool inside1 = r.Contains(clientpos);
@@ -2495,7 +2513,7 @@
             ToggleBreakpoint(line);
             break;
         }
-        case 2: // folding margin
+        case foldingMargin: // folding margin
         {
             int lineYpix = event.GetPosition();
             int line = GetControl()->LineFromPosition(lineYpix);
Index: src/sdk/wxscintilla/src/scintilla/include/Scintilla.h
===================================================================
--- src/sdk/wxscintilla/src/scintilla/include/Scintilla.h    (revision 5311)
+++ src/sdk/wxscintilla/src/scintilla/include/Scintilla.h    (working copy)
@@ -120,6 +120,8 @@
 #define SC_MARK_FULLRECT 26
 #define SC_MARK_LEFTRECT 27
 #define SC_MARK_CHARACTER 10000
+#define SC_MARKNUM_CHANGEUNSAVED 23
+#define SC_MARKNUM_CHANGESAVED 24
 #define SC_MARKNUM_FOLDEREND 25
 #define SC_MARKNUM_FOLDEROPENMID 26
 #define SC_MARKNUM_FOLDERMIDTAIL 27
@@ -144,6 +146,7 @@
 #define SC_MARGIN_NUMBER 1
 #define SC_MARGIN_BACK 2
 #define SC_MARGIN_FORE 3
+#define SC_MARGIN_CHANGED 4
 #define SCI_SETMARGINTYPEN 2240
 #define SCI_GETMARGINTYPEN 2241
 #define SCI_SETMARGINWIDTHN 2242
@@ -470,6 +473,7 @@
 #define SCI_LINESSPLIT 2289
 #define SCI_SETFOLDMARGINCOLOUR 2290
 #define SCI_SETFOLDMARGINHICOLOUR 2291
+#define SCI_SETMARGINUSEFOLDINGBACKGROUND 2292
 #define SCI_LINEDOWN 2300
 #define SCI_LINEDOWNEXTEND 2301
 #define SCI_LINEUP 2302
Index: src/sdk/wxscintilla/src/scintilla/include/Scintilla.iface
===================================================================
--- src/sdk/wxscintilla/src/scintilla/include/Scintilla.iface    (revision 5311)
+++ src/sdk/wxscintilla/src/scintilla/include/Scintilla.iface    (working copy)
@@ -273,7 +273,9 @@
 val SC_MARK_CHARACTER=10000
 
 enu MarkerOutline=SC_MARKNUM_
-# Markers used for outlining column.
+# Markers used for outlining and changed column.
+val SC_MARKNUM_CHANGEUNSAVED=23
+val SC_MARKNUM_CHANGE
download for full patch...
jenslody 2009-01-19 06:16

It's added to trunk in modified form. Thanks for the contribution.