On Kate Colorschemes and custom highlighting

Milian Wolff mail at milianw.de
Fri Jan 8 13:57:18 UTC 2010


Hey guys!

I spent some time to fix the Kate interfaces in order to access the used 
foreground- & background color. This should now make it possible to properly 
support things like "Dark KDE-Scheme & Bright Kate Scheme" (or vice versa). 
Afaik there is a bug about this, but I'm sure there were at least two to three 
people complaining about the current state on IRC.

I had a look at it and wanted to finally implement the required code in 
KDevelop, but I fear the current API-design makes it very ugly. Let me 
explain:

- the default background color (all we need for KDevelop) can be accessed via:

(ConfigInterface of a KTextEditor::View)->configValue("background-color")

- the above shows that - theoretically - the return value depends on the used 
KTextEditor::View, but at least for Kate this is not the case (i.e. each view 
will return the same)

- KDevelop only highlights the DUChain, i.e. the associated SmartRanges and 
does not know anything about Documents/Views in the highlighting classes

- the color cache that generates our custom colors is a singleton, currently 
it only listens to changes in the global KDE color scheme and adapts properly


Now my problem is: How should I connect these two? It's two totally different 
APIs... One supports MDI, the other is a singleton...

I could hack something together like:

- in the singleton listen to
- new document created, then listen to
- view created => check background color
  - if  valid value returned (i.e. we use KDE 4.4), adapt colors
  - if invalid value returned, take global color scheme...
- also listen to configChanged signals of the Views

I mean this would probably work (and would have a fallback for KDE 4.3) but 
imo it's rather ugly...

Any ideas? Feedback?
-- 
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20100108/0d5ed750/attachment.sig>


More information about the KDevelop-devel mailing list