Author Topic: Custom Margin Zero  (Read 4863 times)

Offline MadBoat

  • Multiple posting newcomer
  • *
  • Posts: 11
Custom Margin Zero
« on: August 06, 2015, 06:06:26 am »
I'm working on a plugin to provide support for a debugger for an experimental architecture we're working on. This is only important because the notion of a "breakpoint" is a little more complicated than it would be for a typical program, and as such, it requires more screen real estate to represent properly. I was hoping to re-purpose margin zero in each pages' scintilla (margin zero currently holds line number information). After my modifications it would do the following:

"If a breakpoint is present on a line, display extended breakpoint information (as much as can be fit). If a breakpoint is not present on the line, display line number as usual."

These are the troubles in pursuit of that goal that I've been unable to resolve myself.

  • Margin Zero's properties need to be under my control. The main conflict I've hit thus far is over the margin's width, which is also modified by cbeditor.cpp.
     
    • Responding directly to a cbEVT_EDITOR_OPEN event and modifying the margin width of the new window causes a crash... I don't know the cause.
    • Responding to a cbEVT_EDITOR_OPEN after a delay (80 ms) does not cause this crash. My best guess is this is due to multiple event handlers trying to change this field (or possibly the scintilla?) at the same time. But my understanding of the Event system would suggest this is impossible... unless an event handler explicitly calls Skip(), no other handlers should get called. So I don't really know what is going on there.
    • The cbEditor class will still edit the debugger margins in response to modification events (adding a character to the editor window, for example). I've disabled this by hacking cbeditor (in particular the SetLineNumberColWidth function) to do nothing when my plugin is loaded. I'd prefer a solution that didn't require hacks to code I don't really understand... can I provide other event handlers to over-ride some/all of the ones that cbEditor uses?