Search found 38 matches

by TobiasA
Thu Nov 02, 2017 5:50 am
Forum: C++ Development
Topic: Custom folding in a custom lexer with LEX_CONTAINER
Replies: 31
Views: 3769

Re: Custom folding in a custom lexer with LEX_CONTAINER

Nope. I am officially a spambot and I'm not allowed to edit the wiki anymore :cry:
by TobiasA
Wed Nov 01, 2017 7:20 pm
Forum: C++ Development
Topic: Custom folding in a custom lexer with LEX_CONTAINER
Replies: 31
Views: 3769

Re: Custom folding in a custom lexer with LEX_CONTAINER

Well, here comes the raw text... Maybe I can upload it tomorrow or something. I'd like to, but the wiki identifies me as a spambot. <h2>Introduction</h2> This article describes how to write a custom "lexer" to a wxStyledTextCtrl (refered as "STC" in the article) including a sample for text folding.<...
by TobiasA
Wed Nov 01, 2017 7:00 pm
Forum: C++ Development
Topic: Custom folding in a custom lexer with LEX_CONTAINER
Replies: 31
Views: 3769

Re: Custom folding in a custom lexer with LEX_CONTAINER

https://wiki.wxwidgets.org/index.php?title=Adding_a_custom_lexer_with_syntax_highlighting_and_folding_to_a_WxStyledTextCtrl This wiki is driving me nuts... I finished formatting and stuff, explanation, all source additions including highlighting... And there comes the message "*** Forbidden. Browser...
by TobiasA
Tue Oct 31, 2017 8:54 pm
Forum: C++ Development
Topic: Custom folding in a custom lexer with LEX_CONTAINER
Replies: 31
Views: 3769

Re: Custom folding in a custom lexer with LEX_CONTAINER

The fun thing is: I found the help function after I added the page... You just enter a new link in the browser like https://wiki.wxwidgets.org/TestPage and then it offers you to edit this page... Which ultimately creates it. I was a bit frightened that I'd mess up the wiki and delete the internet, b...
by TobiasA
Tue Oct 31, 2017 7:54 pm
Forum: C++ Development
Topic: Custom folding in a custom lexer with LEX_CONTAINER
Replies: 31
Views: 3769

Re: Custom folding in a custom lexer with LEX_CONTAINER

Finally I got it... I hope to have an article done by the end of the week.
by TobiasA
Tue Oct 31, 2017 4:54 pm
Forum: C++ Development
Topic: Custom folding in a custom lexer with LEX_CONTAINER
Replies: 31
Views: 3769

Re: Custom folding in a custom lexer with LEX_CONTAINER

Yeah, exactly. I somehow can't find the button "create new article" or something like that.
Since I am registered I could edit an existing article but I don't know how to add a new one.
by TobiasA
Tue Oct 31, 2017 1:36 pm
Forum: C++ Development
Topic: Custom folding in a custom lexer with LEX_CONTAINER
Replies: 31
Views: 3769

Re: Custom folding in a custom lexer with LEX_CONTAINER

This may be a noob question... But how do you create a new article? Is there a short howto on it?
Thank you!
by TobiasA
Wed Oct 04, 2017 7:44 pm
Forum: C++ Development
Topic: Collapsing all folds in STC
Replies: 5
Views: 1233

Re: Collapsing all folds in STC

Digging all through the search function to find a "collapse all" function, I found out that you need to collapse the header and hide the lines by your own. for(size_t i=0;i<m_activeSTC->GetLineCount();i++){ int foldlevel=m_activeSTC->GetFoldLevel(i); bool is_header=foldlevel & wxSTC_FOLDLEVELHEADERF...
by TobiasA
Mon Oct 02, 2017 12:52 pm
Forum: C++ Development
Topic: Custom folding in a custom lexer with LEX_CONTAINER
Replies: 31
Views: 3769

Re: Custom folding in a custom lexer with LEX_CONTAINER

To throw in some code... The following code seems to work as an example: // For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif // for all others, include the necessary headers (this file is usually all you // need because ...
by TobiasA
Fri Sep 29, 2017 5:32 pm
Forum: C++ Development
Topic: Custom folding in a custom lexer with LEX_CONTAINER
Replies: 31
Views: 3769

Re: Custom folding in a custom lexer with LEX_CONTAINER

Well... Seems I have to test some more. I found out that relying on styleneeded for the folding is not that relyable because you might have to change the line in front of it... I ended up in pulling the fold levels in a background threat and apply them during the next wxEVT_STC_UPDATEUI event. I hav...
by TobiasA
Thu Sep 28, 2017 10:36 am
Forum: C++ Development
Topic: Custom folding in a custom lexer with LEX_CONTAINER
Replies: 31
Views: 3769

Re: Custom folding in a custom lexer with LEX_CONTAINER

This example should make it into some wiki or FAQ article. I believe your whole experience would merit a Wiki article. If you can document how to add custom lexer using LEX_CONTAINER would be great. Actually I think it should be added to Intro to wxSTC in official documentation This sounds like a g...
by TobiasA
Thu Sep 28, 2017 7:12 am
Forum: C++ Development
Topic: Custom folding in a custom lexer with LEX_CONTAINER
Replies: 31
Views: 3769

Re: Custom folding in a custom lexer with LEX_CONTAINER

Folding is somewhat complicated. Here's a sample that shows how to set up the folding you described above. I'm using margin 2 for the fold margin, but you can use any margin you want. // For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ #pragm...
by TobiasA
Wed Sep 27, 2017 2:14 pm
Forum: C++ Development
Topic: Custom folding in a custom lexer with LEX_CONTAINER
Replies: 31
Views: 3769

Re: Custom folding in a custom lexer with LEX_CONTAINER

The basics do work, I already included syntax highlighting based on the events provided by the container and it works great.
So the lexer itself can't have any major problems, it is just the folding that won't work.
by TobiasA
Wed Sep 27, 2017 1:56 pm
Forum: C++ Development
Topic: Custom folding in a custom lexer with LEX_CONTAINER
Replies: 31
Views: 3769

Re: Custom folding in a custom lexer with LEX_CONTAINER

It's not really that kind of a lexer. I am doing all the things a lexer does in my GUI, using the events by LEX_CONTAINER which technically is a custom lexer. It is just not included in the framework as a lexer. Sorry and please correct me if this is the wrong term, English is not my first language....
by TobiasA
Wed Sep 27, 2017 10:44 am
Forum: C++ Development
Topic: Custom folding in a custom lexer with LEX_CONTAINER
Replies: 31
Views: 3769

Custom folding in a custom lexer with LEX_CONTAINER

Hi, has anyone here working with custom folding in a custom lexer? I have a wxstyledtextctrl which is highlighted by a custom lexer to highlight and parse NC cycles. There's a bit more than actually highlighting the code, now I'm trying hard to integrate custom folding. When I switch to a CPP lexer,...