On 28 Apr 2005 at 12:52, Robert Roessler wrote:

> Armel Asselin wrote:
> 
> >> Neil Hodgson wrote:
> >>
> >>> Robert Roessler:
> >>>
> >>>
> >>>> In the simplest case, I am doing exactly a start_styling with
> >>>> INDICS_MASK (0xe0), followed by a set_styling for the required length
> >>>> - all with default settings for the indicator styles and colors.
> >>>>
> >>>> This works fine... if I only use indicator #2!  If I use either #0 or
> >>>> #1, my displayed text has its styling messed up when I *overwrite*
> >>>> indicators.
> >>>
> >>>
> >>>
> >>>    You need to set the mask to one of INDIC0_MASK, INDIC1_MASK, or
> >>> INDIC2_MASK depending on which bit you want to write or clear. If you
> >>> want to write all three bits in one pass then you will have to
> >>> maintain your own bit set.
> >>
> >>
> >> I think we are not communicating... I am doing just what the doc says:
> >>
> >> "The indicators are set using SCI_STARTSTYLING with a INDICS_MASK mask 
> >> and SCI_SETSTYLING with the values INDIC0_MASK, INDIC1_MASK and 
> >> INDIC2_MASK."
> >>
> >> So that is exactly what I do... my use of the shorthand "indicator #2" 
> >> etc may have obscured this.  :(  I really do a SCI_STARTSTYLING with 
> >> INDICS_MASK and a SCI_SETSTYLING with ONE of INDIC0_MASK, INDIC1_MASK, 
> >> or INDIC2_MASK... but only the last one actually works properly - in 
> >> the sense of not messing up in the way I describe in my initial mail.
> >>

It's possible to use ALL indicators on exactly the same text
if needed, not very pretty however but..


> >> So am I still not getting something?
> > 
> > Hum, if I understand well what you say, you're doing wrong: you're 
> > explicitly telling you use INDICS_MASK (which means overwrite ALL 
> > indicators), then you set only the one you want with SCI_SETSTYLING... 
> > so each time you put stuff for one of them you loose previously set 
> > indicators.
> > 
> > You have to specify : SCI_STARTSTYLING (INDIC0_MASK) for example, then 
> > continue with: SCI_SETSTYLING(0) to remove this particular flag or 
> > SCI_SETSTYLING(INDIC0_MASK) to put it.
> > This is just binary stuff, the new indicators are: (old_indicators AND 
> > NOT mask) OR (new_indicators AND MASK). Does it help?
> > 
> > This is what I understood from the doc.
> 
> Thanks for looking into this Armel, but overwriting any and all 
> existing indicators is (in this case) exactly what I want to do! :)
> 
> And since I am only using ONE indicator anyway, this should appear 
> exactly the same as if the new indicator was being ORed with any 
> existing ones, right?
> 
> In any case, I *can* make the "indicators" feature work for me - but 
> only for ONE indicator - indicator #2... so something does look broken. :(
> 
> Here are two pictures - the ONLY difference between them is the "BAD" 
> one uses indicator #1 (0x40) instead of #2 (0x80).  Both use the full 
> indicator mask (0xe0), and both use the style INDIC_DIAGONAL, color 
> 0xff00ff.
> 
> The first indicator use covers the first 4 lines - the second 
> indicator use ONLY over-writes 7 chars (starting with the third one) 
> of the FOURTH line... the BAD picture shows what happens.
> 
> One more data point: I can do a SCI_GETSTYLEDTEXT call to see what has 
> been placed in the style bytes... and they look FINE.  In the GOOD 
> case, I get a bunch of 0x8X bytes, and in the BAD case I get 0x4X 
> bytes (with the same lower 5 bits).  Oh, and SCI_GETSTYLEBITS returns 
> - as expected - 5.
> 

Every indicator works as it should do, but you need to set the proper indicator 
mask.
If you'd like to ONLY set/get the indicator 0: Then use the INDIC0_MASK as the 
mask
sent to SCI_STARTSTYLING. 

If you'd like to get/set ALL indicatorvalues in one go, then if you'd like 
to set one of the indicators for say 10 chars AND keep the originals
then you'll need to use SCI_GETSTYLEAT with the position, get the currently
set indicators (mask), or'ing with the new, then set the modified style
with SCI_SETSTYLING.

Searching for indicators is rather easy actually, since it's accessible with
SCI_GETSTYLEAT. You could do it with a simple loop over the document.

To unset an indicator you use SCI_STARTSTYLING(position,mask) with the
mask of the indicators you'd like to remove, then just call 
SCI_SETSTYLING(length,0).

It's kind of logical, when you ask for ALL indicators, then you must expect to
handle all, and all changes which doesn't contain the existing indicators, 
erases them.

An example:

SCI_STARTSTYLING(0,INDICS_MASK)
SCI_SETSTYLING(20,INDIC0_MASK)
SCI_STARTSTYLING(oldstylepos,oldstylemask)

This would set the indicator 0 for the 20 next characters,
and if indicator 1 or 2 also was defined in those chars, then those
indicators would be removed for that length.
i.e the last indicator set for a length would be the ONLY indicator.

IBut if you use the INDIC0_MASK for the SCI_STARTSTYLING, THEN
you would just modify that indicator, and not the rest if any.

I had a little trouble with it myself, but found a solution, and it works..

Jan Martin
====>>>> Delphi Scintilla Interface Components 
(http://delphisci.sourceforge.net) <<<<====


_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest

Reply via email to