Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: scarphin on December 31, 2014, 12:39:02 am

Title: How to access settings with ConfigManager
Post by: scarphin on December 31, 2014, 12:39:02 am
I can't seem to find the solution by myself. How do I access a color setting in 'default.conf' through code? Say I want to access 'editor/colour_sets/default/cc/'->default background color. I've tried this:
Code
ConfigManager *cfg = Manager::Get()->GetConfigManager(_T("editor"));
wxString key = _T("/colour_sets/default/cc");
wxColour back = cfg->ReadColour(key + _T("/default/back"));
and numerous variations of that to no avail. I always read a black color (0, 0, 0) which I think is the default return value. Can someone please show me the way to do it? Or better yet how can I access settings the editor currently uses?
Title: Re: How to access settings with ConfigManager
Post by: scarphin on January 03, 2015, 05:03:17 pm
Another try:
Code
    EditorColourSet* ecs = Manager::Get()->GetEditorManager()->GetColourSet();
    HighlightLanguage hl = ecs->GetHighlightLanguage(wxSCI_LEX_CPP);
Code above gives me the 'HighlightLanguage' for 'Ogre compositor script'!? What am I missing here?
Title: Re: How to access settings with ConfigManager
Post by: Alpha on January 03, 2015, 08:10:58 pm
Code
EditorColourSet* ecs = Manager::Get()->GetEditorManager()->GetColourSet();
HighlightLanguage hl = ecs->GetHighlightLanguage(wxT("C/C++"));
or
Code
cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor();
HighlightLanguage hl = ed->GetLanguage();

then
Code
OptionColour* col = ecs->GetOptionByIndex(hl, 0); // or GetOptionByName(hl, wxT("String"))
// col->fore
// col->back
Title: Re: How to access settings with ConfigManager
Post by: scarphin on January 04, 2015, 12:01:23 am
Thnx that did the trick. Btw is there any kind of documentation I can consult for these kind of stuff? The SDK documentation link (Berlios) is dead for sure, maybe someone can upload it to somewhere else?!
Title: Re: How to access settings with ConfigManager
Post by: oBFusCATed on January 04, 2015, 12:33:15 am
Read the source code. You can probably generate the documentation yourself using doxygen, but I've never done it on the cb's source code, so I don't know the exact commands.
Title: Re: How to access settings with ConfigManager
Post by: Alpha on January 04, 2015, 05:49:04 pm
The SDK documentation link (Berlios) is dead for sure, maybe someone can upload it to somewhere else?!
Self built; hopefully it works.  http://alpha0010.github.io/cb-docs/ (http://alpha0010.github.io/cb-docs/)
Title: Re: How to access settings with ConfigManager
Post by: scarphin on January 04, 2015, 05:56:27 pm
Looks marvelous thanks! Can you also export that to pdf, chm or some offline format?
Title: Re: How to access settings with ConfigManager
Post by: Alpha on January 04, 2015, 06:26:44 pm
You can clone it to access the html offline.
Code
git clone https://github.com/alpha0010/cb-docs.git

I will try building a pdf later.
Title: Re: How to access settings with ConfigManager
Post by: Alpha on January 05, 2015, 02:11:17 am
Well, pdf compilation dies partway through interlinking the indicies, leaving it quite difficult to navigate.  I am not on Windows right now, so I did not try building a chm, but from my memory, chm only supports png (not svg), so it will be at least another 100 MB, unless diagrams are disabled (for reference, the site is 5 MB compressed, and the partial pdf is 17 MB).  I suppose doxygen could be restricted to only read headers, to reduce total size (and potential for whatever is causing generation to fail), but then call reference and some other information will be lost.

If anyone wants to do further experimentation, my changes are attached.  Run: doxygen sdk.doxy
Title: Re: How to access settings with ConfigManager
Post by: scarphin on January 05, 2015, 05:15:33 pm
I managed to generate a .chm but no luck with pdf either. I think that will do for the moment. Thanks.