@Jens: I uploaded a patch against the scintilla branch here:
https://developer.berlios.de/patch/index.php?func=detailpatch&patch_id=2597&group_id=5358
I am not putting this forward as a patch similar to yours - I only uploaded it so you could see a change I made to scintilla that allows any margin to have the folding background. I noticed when I used the newer version of scintilla with the changebar in a separate margin it used the normal margin colour. I guess 1.7.5 had a bug in it which meant the margin colour matched the folding margin even when it shouldn't have.
I wanted it to look the same as the folding margin so made this patch quickly to try out the idea. I thought you may find that aspect of the patch useful and worth incorporating into your own patch.
gryphon
If I see it right (after a short look over your patch without replying it), the main difference to my patch is, apart from making it easy to swap the folding- and changebar-margin at compile-time, that you set the margins background explicitely and created a function and an event for this purpose.
This makes the background-chosing more flexible, but it is not needed if we use scintillas standard-behaviour.
You need to do that, because you did not change "SC_MASK_FOLDERS" and "wxSCI_MASK_FOLDERS" to "0xFF800000". The unpatched scintilla uses this mask to decide which background colour is chosen:
If (mask & wxSCI_MASK_FOLDERS)==0, the margin background colour is controlled by style 33 (wxSCI_STYLE_LINENUMBER).
Quote from the scintilla api-reference (you find it in "src/sdk/wxscintilla/website/reference.html" inside the C::B source-tree).
That's the cause, why I have to explicitely change the mask for the folder-margin, to make it not show the changebar.
The main problem with the whole changebar-patch, is that it seems not to be easy to switch it on and off (not only to make the changebar-visible or not).