Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: sethjackson on January 03, 2006, 03:42:44 pm

Title: EditorColorSet
Post by: sethjackson 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........
 
Title: Re: EditorColorSet
Post by: mandrav 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.
Title: Re: EditorColorSet
Post by: sethjackson 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:
Title: Re: EditorColorSet
Post by: sethjackson 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.
Title: Re: EditorColorSet
Post by: mandrav on January 03, 2006, 09:11:52 pm
EditorColorSet is a property of EditorManager.
Use this:


EditorColorSet* theme = Manager::Get()->GetEditorManager()->GetColorSet();
Title: Re: EditorColorSet
Post by: sethjackson 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. :)