Okay so basically KeywordSet2 allows me to color only one additionnal keyword set ?
On Sun, Nov 7, 2010 at 00:17, Phil Thompson <[email protected]> wrote: > On Sat, 6 Nov 2010 21:49:47 +0100, "Jonas O." <[email protected]> wrote: >> Now I'm sad. >> >> How can I use keywordset2 to use a different set of keywords then ? > > Read my original reply (see below). > > Phil > >> On Sat, Nov 6, 2010 at 21:10, Phil Thompson > <[email protected]> >> wrote: >>> On Sat, 6 Nov 2010 20:44:27 +0100, "Jonas O." <[email protected]> > wrote: >>>> On Sat, Nov 6, 2010 at 19:04, Phil Thompson >>> <[email protected]> >>>> wrote: >>>>> On Sat, 6 Nov 2010 18:38:12 +0100, "Jonas O." <[email protected]> >>> wrote: >>>>>> Hello, and first thanks for bringing Scintilla to Qt ! I'm quite > happy >>>>>> to see all those nifty features made that much simple to implement >>>>>> (current line highlight, margin numbers, select line form left click >>>>>> in the margin, etc). >>>>>> >>>>>> However I'm having one little problem, I want to color some keyword >>>>>> sets with a different than other keyword sets. >>>>>> I created my own lexer by duplicating the QsciLexerCPP files, but I >>>>>> need some starting point to see how I can do that; the SendScintilla >>>>>> function is not very documented and does not forward to any > scintilla >>>>>> doc (I also read it's useless to ask here to learn how to create a >>>>>> lexer, but I just want to color certain separately, not create my > own >>>>>> language). >>>>>> >>>>>> I hope someone could help me at least a little, I guess someone have >>>>>> to know how to do it, the creator of QScintilla maybe ? The > QScintilla >>>>>> lexer classes did not appear magically... >>>>> >>>>> You don't need to create a new lexer - just subclass QsciLexerCPP and >>>>> reimplement the keywords() method to handle the case where the > keyword >>>>> set >>>>> is 2 (see QsciLexerCPP::KeywordSet2). You need to return a string for >>>>> set 2 >>>>> containing the keywords you want coloured differently. If some of > these >>>>> appear in the default set 1 then you will also need to handle that > set >>> by >>>>> returning a string that doesn't contain those keywords. >>>>> >>>>> You may also want to reimplement defaultColor(), defaultFont() etc. > to >>>>> provide different defaults for the KeywordSet2 style. >>>>> >>>>> Phil >>>>> >>>> >>>> I see, but I want to create several sets with each one having a >>>> different color, the set 2 will only give me one color, how can it >>>> select a different color for each set ? >>> >>> The underlying Scintilla C++ lexer only supports a limited number of >>> keyword sets. You will need to modify that (or take a copy) to add >>> support >>> for more. >>> >>> Phil >>> > _______________________________________________ QScintilla mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/qscintilla
