Author Topic: How to access settings with ConfigManager  (Read 3634 times)

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
How to access settings with ConfigManager
« 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?

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: How to access settings with ConfigManager
« Reply #1 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?

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: How to access settings with ConfigManager
« Reply #2 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

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: How to access settings with ConfigManager
« Reply #3 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?!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13438
    • Travis build status
Re: How to access settings with ConfigManager
« Reply #4 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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: How to access settings with ConfigManager
« Reply #5 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/

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: How to access settings with ConfigManager
« Reply #6 on: January 04, 2015, 05:56:27 pm »
Looks marvelous thanks! Can you also export that to pdf, chm or some offline format?

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: How to access settings with ConfigManager
« Reply #7 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.

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: How to access settings with ConfigManager
« Reply #8 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

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: How to access settings with ConfigManager
« Reply #9 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.