Patch #2596 2008-11-15 17:40

gryphon

Add ChangeBar patched scintilla to CodeBlocks
Download
2596-Add_ChangeBar.patch (231.1 KB)
Category
Application::FeatureAdd
Status
Closed
Close date
2009-01-19 06:14
Assigned to
jenslody
Index: src/sdk/cbeditor.cpp
===================================================================
--- src/sdk/cbeditor.cpp    (revision 5311)
+++ src/sdk/cbeditor.cpp    (working copy)
@@ -43,20 +43,27 @@
 
 const wxString g_EditorModified = _T("*");
 
-#define ERROR_MARKER        1
-#define ERROR_STYLE            wxSCI_MARK_SMALLRECT
+#define ERROR_MARKER            1
+#define ERROR_STYLE             wxSCI_MARK_SMALLRECT
 
-#define BOOKMARK_MARKER        2
-#define BOOKMARK_STYLE         wxSCI_MARK_ARROW
+#define BOOKMARK_MARKER         2
+#define BOOKMARK_STYLE          wxSCI_MARK_ARROW
 
-#define BREAKPOINT_MARKER    3
-#define BREAKPOINT_STYLE     wxSCI_MARK_CIRCLE
+#define BREAKPOINT_MARKER       3
+#define BREAKPOINT_STYLE        wxSCI_MARK_CIRCLE
 
-#define DEBUG_MARKER        4
-#define DEBUG_STYLE         wxSCI_MARK_ARROW
+#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.
@@ -1044,7 +1051,7 @@
     control->SetMarginMask(1, (1 << BOOKMARK_MARKER) |
                                  (1 << BREAKPOINT_MARKER) |
                                  (1 << DEBUG_MARKER) |
-                                 (1 << ERROR_MARKER));
+                                 (1 << ERROR_MARKER) );
     control->MarkerDefine(BOOKMARK_MARKER, BOOKMARK_STYLE);
     control->MarkerSetBackground(BOOKMARK_MARKER, wxColour(0xA0, 0xA0, 0xFF));
     control->MarkerDefine(BREAKPOINT_MARKER, BREAKPOINT_STYLE);
@@ -1059,6 +1066,15 @@
 
     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->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"));
@@ -1068,10 +1084,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);
@@ -1098,7 +1114,7 @@
         */
     }
     else
-        control->SetMarginWidth(2, 0);
+        control->SetMarginWidth(foldingMargin, 0);
 }
 
 // static
@@ -2264,7 +2280,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);
@@ -2490,7 +2507,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/PlatWX.cpp
===================================================================
--- src/sdk/wxscintilla/src/PlatWX.cpp    (revision 5311)
+++ src/sdk/wxscintilla/src/PlatWX.cpp    (working copy)
@@ -44,6 +44,7 @@
                     (unsigned char)cd.GetBlue());
 }
 
+
 //----------------------------------------------------------------------
 
 Palette::Palette() {
@@ -735,6 +736,10 @@
 }
 
 
+PRectangle Window::GetMonitorRect(Point pt) {
+    return P
download for full patch...
jenslody 2009-01-19 06:14

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