Tom Zaffran wrote:
Try the "GTK+" sample referenced at the front of the Scintilla doc
file (ScintillaDoc.html) - it is called "bait". While not for the
"wx" world specifically, it does contain a minimal set of Scintilla
API calls for showing that your local install is working (I use it
when I move Scintilla to a new platform).
Okay, i looked at bait and i've tried thevStyleSetForeground
(wxSCI_STYLE_DEFAULT, wxColour (_T("BLUE"))); call but i still got the
text showing up in black. wxSCI_STYLE_DEFAULT should be displaying all
text as blue right ? If not then which value should I put in ? Funny
thing is if i do the exact same call using the Background fonction, that
works fine. So it doesn't really make any sense to me.
Also how many values like wxSCI_STYLE_DEFAULT are there and what are
they ? because in the API it says something about bytes 0 to 31 being
used to set text attributes and predefinied styles starting at 32. I'm
not sure i understand what that all means.
I'm sorry if this all sounds silly or whatever, i'm still in school and
therefore a newbee (and I'm french by the way so reading english written
documentation, while not that hard for me, can sometimes be difficult).
Thank you for anyone who will be willing to explain to me about the
whole syntaxe colouring step by step. Hope it's not too much to ask.
Well, a few tips could help.
Scintilla maps "styles" to sets of "text attributes".
Styles are just [8-bit] integer values that are associated with every
character in a document - the default layout is to allocate the low 5
style bits for normal styling (or "syntax coloring"), and reserve the
high 3 bits for "indicators" (which will typically be used for
temporary text attributes such as underlining errors in compiler output).
Text attributes are just the usual font name, point size, bold/italic,
and the foreground and background colors of the text.
A language "lexer" for Scintilla is able to examine text in a document
and separate it into different types of syntactic tokens according to
the rules of the language it handles. When it has done this, it can
then go ahead and assign the "style" integers to each character
accordingly. In turn, these style values directly map to whatever
text attributes have been associated with them... and the document is
now styled - the each character shows up in the colors of the language
element they represent.
The "default styles" are used to communicate with Scintilla about
styling values outside of those handled by individual language lexers,
like line number and brace-matching colors.
How to put this all together? Bait is about as simple as it gets. :)
1) the SCI_STYLECLEARALL just forces the buffer *text* to be empty -
it can also set all of the buffer *style* values to duplicate the text
attributes of the default style (32). So if you want to have all of
your text default to "bold" on a pink background, then you would do a
SCI_STYLESETBOLD and SCI_STYLESETBACK of style 32 BEFORE doing the
SCI_STYLECLEARALL.
2) the SCI_SETLEXER just tells Scintilla which lexer to pass the
coloring duties off to.
3) the SCI_SETKEYWORDS lets you specify some number of arrays of
space-separated "words" which the lexer will recognize as language
elements.
4) the SCI_STYLESETFORE assigns the actual colors to be used for the
foregrounds of the given styles (recall that we already said earlier
that all of the backgrounds would be pink - well, we could have, but
bait doesn't actually do the pink thing).
5) then we just insert some text et voila, the lexer colors everything
according to the values we just assigned!
Neil or someone else might be able to make this sound easier... :)
Robert Roessler
[EMAIL PROTECTED]
http://www.rftp.com
_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest