wxScintilla - max highlighing
BlitzMax Forums/Brucey's Modules/wxScintilla - max highlighing
| ||
Can anyone post an example using wxScintilla for blitzmax highlighting? (maybe the almighty brucey ;) I looked at the sample for wxScintilla, as far as I can tell it contains no keyword highlighting functionality. (I can barely tell whats going on in the c++ code near the bottom of it aswell) |
| ||
I've only got as far as creating the skeleton lexer (copied from another one), which should give some basic highlighting. But... I haven't actually tried it yet :-p However, I am using highlighting with my SQL app, and it's working great. Here are some code snippets I'm using to get it working, based on wxCodeGen generating the basic stuff : The codegen block: Keywords (a loooong string) : Const SQL_KEYWORDS:String = "absolute action add admin after aggregate " + .. "alias all allocate alter and any are array as asc " + .. .. etc Some implementation : These two lines : txtEditor.SetLexer(wxSCI_LEX_SQL) txtEditor.SetKeywords(0, SQL_KEYWORDS) are important. They tell wxScintilla what lexer to use, and give it the keywords to colour. That's about as far as I've gone with it to date. It's a big, complicated beast, extremely powerful, but with lots to get your head around. The developers say you should look at the SciTE source, which they say is a reference implementation of Scintilla. Which is all very well if you can work out what's going on! Perhaps we can all work it out together ;-) |
| ||
Here's what I've come up with: Pardon the text colors, thats how I have them in BLIde. Theres only a few things wrong with this, its using a blitzbasic lexer (comments are ; instead of ' etc) instead of a blitzmax lexer (I couldn't find it in wxscintilla source, though I did notice LexMax.cxx), and I was unable to find the style const for the caret position so its invisible (black) with the background. |
| ||
its using a blitzbasic lexer It's not really. I *borrowed* the Id for SCLEX_BLITZBASIC to use with my hacked lexer, which is still essentially the original basic lexer. I've committed the comment character fix. For the caret, how's about : SetCaretForeground(New wxColour.CreateNamedColour("WHITE")) LexMax.cxx is the file that will need changing for lexing properly. I imagine it will need quite a bit of work to get it just right. |