Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
How to access settings with ConfigManager
scarphin:
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"));
--- End code ---
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?
scarphin:
Another try:
--- Code: --- EditorColourSet* ecs = Manager::Get()->GetEditorManager()->GetColourSet();
HighlightLanguage hl = ecs->GetHighlightLanguage(wxSCI_LEX_CPP);
--- End code ---
Code above gives me the 'HighlightLanguage' for 'Ogre compositor script'!? What am I missing here?
Alpha:
--- Code: ---EditorColourSet* ecs = Manager::Get()->GetEditorManager()->GetColourSet();
HighlightLanguage hl = ecs->GetHighlightLanguage(wxT("C/C++"));
--- End code ---
or
--- Code: ---cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor();
HighlightLanguage hl = ed->GetLanguage();
--- End code ---
then
--- Code: ---OptionColour* col = ecs->GetOptionByIndex(hl, 0); // or GetOptionByName(hl, wxT("String"))
// col->fore
// col->back
--- End code ---
scarphin:
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?!
oBFusCATed:
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.
Navigation
[0] Message Index
[#] Next page
Go to full version