Author Topic: EditorColorSet  (Read 7058 times)

sethjackson

  • Guest
EditorColorSet
« on: January 03, 2006, 03:42:44 pm »
Excuse my stupidity, but I get

Code
-------------- Build: AutoRevision in Code::Blocks (wx2.6) ---------------
Target is up to date.

-------------- Build: ConsoleRunner in Code::Blocks (wx2.6) ---------------
Target is up to date.

-------------- Build: tinyXML in Code::Blocks (wx2.6) ---------------
Target is up to date.

-------------- Build: AngelScript in Code::Blocks (wx2.6) ---------------
Target is up to date.

-------------- Build: scintilla in Code::Blocks (wx2.6) ---------------
Target is up to date.

-------------- Build: wxPropertyGrid in Code::Blocks (wx2.6) ---------------
Target is up to date.

-------------- Build: sdk in Code::Blocks (wx2.6) ---------------
Running target pre-build steps
tools/autorevision/autorevision +wx +int +t . sdk/autorevision.h
Target is up to date.

-------------- Build: wxAUI in Code::Blocks (wx2.6) ---------------
Target is up to date.

-------------- Build: src in Code::Blocks (wx2.6) ---------------
Compiling: src\main.cpp
src\main.cpp: In member function `void MainFrame::OnLanguageCCpp(wxCommandEvent&)':
src\main.cpp:2115: error: invalid use of undefined type `struct EditorColorSet'
sdk/cbeditor.h:18: error: forward declaration of `struct EditorColorSet'
Process terminated with status 1 (0 minutes, 9 seconds)
2 errors, 0 warnings

with this code. Yeah it is probably all wrong, but anyways....

Code
void MainFrame::OnLanguageCCpp(wxCommandEvent& event)
{
    cbEditor* ed = EDMAN()->GetBuiltinActiveEditor();

    if (ed)
    {
        EditorColorSet* theme = ed->GetColorSet();

        // Load the lexer somehow.....
    }
}

Sorry I'm confused on how the SetColorSet works........
 
« Last Edit: January 03, 2006, 04:09:06 pm by sethjackson »

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: EditorColorSet
« Reply #1 on: January 03, 2006, 03:53:04 pm »
Although there is no such code in main.cpp (I assume you 're writing it yourself?), the error you 're getting is very descriptive. Read it again. If you still don't understand what it means, add #include <editorcolorset.h> at the top of the file.
Be patient!
This bug will be fixed soon...

sethjackson

  • Guest
Re: EditorColorSet
« Reply #2 on: January 03, 2006, 03:56:20 pm »
Although there is no such code in main.cpp (I assume you 're writing it yourself?), the error you 're getting is very descriptive. Read it again. If you still don't understand what it means, add #include <editorcolorset.h> at the top of the file.

Ah ok. I though it got included with editormanager.h or something. :oops:

Thanks for helping the idiot of the day. :lol:

sethjackson

  • Guest
Re: EditorColorSet
« Reply #3 on: January 03, 2006, 08:58:33 pm »
K one more question....

here is some code.

Code
cbEditor* ed = EDMAN()->GetBuiltinActiveEditor();

    if (ed)
    {
        EditorColorSet* theme;
        HighlightLanguage lang = theme->GetHighlightLanguage(wxSCI_LEX_NULL);
        theme->Apply(lang, ed->GetControl());
    }

Of course that won't work because theme is 0 (corret me if I'm wrong). So how do I accomplish this.

I tried

Code
EditorColorSet* theme = ed->GetColorSet();

but that didn't work either. It crashed in some situations. So how do I propagate theme? Thanks.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: EditorColorSet
« Reply #4 on: January 03, 2006, 09:11:52 pm »
EditorColorSet is a property of EditorManager.
Use this:


EditorColorSet* theme = Manager::Get()->GetEditorManager()->GetColorSet();
Be patient!
This bug will be fixed soon...

sethjackson

  • Guest
Re: EditorColorSet
« Reply #5 on: January 03, 2006, 09:18:34 pm »
EditorColorSet is a property of EditorManager.
Use this:


EditorColorSet* theme = Manager::Get()->GetEditorManager()->GetColorSet();


Hmm still no go. Start C::B. Create new file. Click Language -> Text. C::B crash.........

Yes I know Language isn't a submenu, but I made one anyways. :)

Wait a sec I think it crashes with wxSCI_LEX_NULL...... Hmm. anyways thanks madrav. :)
« Last Edit: January 03, 2006, 09:20:24 pm by sethjackson »