On 25/08/2014 10:50 am, Matic Kukovec wrote:
As for the hotspot API, I think something like the indicators use
would be the best and the most consistent.
Scintilla uses only a single hotspot, so if adding multiple styles is
not an option, scratch that idea.

Setting up a hotspot style:

   int        setHotspotForeColor(QColor color, int hotspotNumber)
   QColor hotspotForeColor(int hotspotNumber)
   int        sethotspotForeColorEnabled(bool useForegroundColor, int
   hotspotNumber)
   bool     hotspotForeColorEnabled(int hotspotNumber)

   int        setHotspotBackColor(bool useBackgroundColor, QColor
   color, int hotspotNumber)
   QColor hotspotBackColor(int hotspotNumber)
   int        sethotspotBackColorEnabled(bool useBackgroundColor, int
   hotspotNumber)
   bool     hotspotBackColorEnabled(int hotspotNumber)

   int        setHotspotUnderline(bool underline, int hotspotNumber)
   bool     hotspotUnderline(int hotspotNumber)

   int        setHotspotSingleLine(bool singleLine, int hotspotNumber)
   bool     hotspotSingleLine(int hotspotNumber)

I've added setHotspotForegroundColor(), resetHotspotForegroundColor(), setHotspotBackgroundColor() and resetHotspotBackgroundColor() which are similar to how the selection foreground and background are handled.

I've also added setHotspotUnderline() and setHotspotWrap(). Note that these are all global - Scintilla doesn't support different values for different styles.

Styling with a hotspot:

   fillHotspotRange(int lineFrom, int indexFrom, int lineTo, int
   indexTo, int hotspotNumber)
   clearHotspotRange(int lineFrom, int indexFrom, int lineTo, int
   indexTo, int hotspotNumber)

Hotspots are implemented as styles and the normal way to apply a style is via a lexer. If you use calls like the above and you have a lexer installed then they are going to fight about what the style of individual characters should be. If you don't have a lexer installed than you can write a QsciLexerCustom sub-class that will apply a QsciStyle with hotspot enabled wherever you want. Using the custom lexer also has the advantage that Scintilla decides what needs styling and when according to how the user is moving around and updating the document.

Given that, do you still need something like fillHotspotRange()?

Phil
_______________________________________________
QScintilla mailing list
QScintilla@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/qscintilla

Reply via email to