Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

Customizing colors into dark

<< < (3/4) > >>

oBFusCATed:
Here is a patch that allows the user to change the colours of line numbers and the margin.
Anyone willing to test it or provide feedback?


--- Code: ---Index: src/sdk/cbeditor.cpp
===================================================================
--- src/sdk/cbeditor.cpp        (revision 9363)
+++ src/sdk/cbeditor.cpp        (working copy)
@@ -1288,11 +1288,17 @@ void cbEditor::InternalSetEditorStyleBeforeFileOpen(cbStyledTextCtrl* control)
         control->SetCaretWidth(mgr->ReadInt(_T("/caret/width"), 1));
     else
         control->SetCaretWidth(1);
-    control->SetCaretForeground(Manager::Get()->GetColourManager()->GetColour(wxT("editor_caret")));
+
+    ColourManager *colours = Manager::Get()->GetColourManager();
+
+    control->SetCaretForeground(colours->GetColour(wxT("editor_caret")));
     control->SetCaretPeriod(mgr->ReadInt(_T("/caret/period"), 500));
     control->SetCaretLineVisible(mgr->ReadBool(_T("/highlight_caret_line"), false));
     control->SetCaretLineBackground(GetOptionColour(_T("/highlight_caret_line_colour"), wxColour(0xFF, 0xFF, 0x00)));

+    control->SetFoldMarginColour(true, colours->GetColour(wxT("editor_margin_chrome")));
+    control->SetFoldMarginHiColour(true, colours->GetColour(wxT("editor_margin_chrome_highlight")));
+
     // setup for "CamelCase selection"
     if (mgr->ReadBool(_T("/camel_case"), false))
     {
Index: src/sdk/editorcolourset.cpp
===================================================================
--- src/sdk/editorcolourset.cpp (revision 9363)
+++ src/sdk/editorcolourset.cpp (working copy)
@@ -25,6 +25,7 @@
 #include <wx/txtstrm.h>  // wxTextInputStream
 #include <wx/wfstream.h> // wxFileInputStream

+#include "cbcolourmanager.h"
 #include "cbstyledtextctrl.h"

 #include "editorcolourset.h"
@@ -534,10 +535,11 @@ void EditorColourSet::Apply(HighlightLanguage lang, cbStyledTextCtrl* control, b
                 DoApplyStyle(control, i, defaults);
         }
     }
-    // for some strange reason, when switching styles, the line numbering changes colour
-    // too, though we didn't ask it to...
-    // this makes sure it stays the correct colour
-    control->StyleSetForeground(wxSCI_STYLE_LINENUMBER, wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT));
+
+    // Calling StyleClearAll above clears the style for the line numbers, so we have to re-apply it.
+    ColourManager *colours = Manager::Get()->GetColourManager();
+    control->StyleSetForeground(wxSCI_STYLE_LINENUMBER, colours->GetColour(wxT("editor_linenumbers_fg")));
+    control->StyleSetBackground(wxSCI_STYLE_LINENUMBER, colours->GetColour(wxT("editor_linenumbers_bg")));

     for (unsigned int i = 0; i < mset.m_Colours.GetCount(); ++i)
     {
Index: src/sdk/editormanager.cpp
===================================================================
--- src/sdk/editormanager.cpp   (revision 9363)
+++ src/sdk/editormanager.cpp   (working copy)
@@ -166,6 +166,16 @@ EditorManager::EditorManager()
     ColourManager *colours = Manager::Get()->GetColourManager();
     colours->RegisterColour(_("Editor"), _("Caret"), wxT("editor_caret"), *wxBLACK);
     colours->RegisterColour(_("Editor"), _("Right margin"), wxT("editor_gutter"), *wxLIGHT_GREY);
+    colours->RegisterColour(_("Editor"), _("Line numbers foreground colour"), wxT("editor_linenumbers_fg"),
+                            wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT));
+    colours->RegisterColour(_("Editor"), _("Line numbers background colour"), wxT("editor_linenumbers_bg"),
+                            wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
+
+    // These two are taken from Platform::Chrome() and Platform::ChromeHightlight()
+    colours->RegisterColour(_("Editor"), _("Margin chrome colour"), wxT("editor_margin_chrome"),
+                            wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
+    colours->RegisterColour(_("Editor"), _("Margin chrome highlight colour"), wxT("editor_margin_chrome_highlight"),
+                            wxSystemSettings::GetColour(wxSYS_COLOUR_3DHIGHLIGHT));
 }

 EditorManager::~EditorManager()

--- End code ---

oBFusCATed:
@eranif: Are you using a 1px wide margin for the vertical line after the line numbers in your screenshot?

eranif:

--- Quote ---@eranif: Are you using a 1px wide margin for the vertical line after the line numbers in your screenshot?
--- End quote ---
Yes, I am using margin of type MARGIN_FORE:



--- Code: ---    
SetMarginType(SYMBOLS_MARGIN_SEP_ID, wxSTC_MARGIN_FORE);
SetMarginMask(SYMBOLS_MARGIN_SEP_ID, 0);
--- End code ---

Where SYMBOLS_MARGIN_SEP_ID is the margin number (in my case its 3 )

EDIT: there is another margin in that screenshot: the symbols margin (where you place the debugger current line marker, breakpoints, bookmarks etc)

Eran

neurocore:
Please, make a color customizable version of Code::Blocks if it not difficult. Thanks.

Jenna:

--- Quote from: neurocore on October 19, 2013, 02:20:43 pm ---Please, make a color customizable version of Code::Blocks if it not difficult. Thanks.

--- End quote ---
If it is not difficult and you really need it, please provide a patch.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version