Hello All,
I'm writing a debugger, where a StyledTextCtrl is used to display sources.
I'd like to color the line number margin in a different color from the
margin I place breakpoint markers.
Any idea how to do that?
Currently the code is:
class SrcPanel(StyledTextCtrl):
'''Assembler view control'''
def __init__(self, parent, filename):
StyledTextCtrl.__init__(self, parent, -1, size=(250,250),
style=wx.BORDER_NONE)
# Line numbers margin
self.SetMarginType(0, STC_MARGIN_NUMBER)
self.SetMarginWidth(0, 40)
# Breakpoints margin
# FIXME: Do we want different marker for HW/SW breakpoints?
self.bp_mark = 1 # Breakpoint indicator
self.src_mark = 2 # Source indicator
self.pc_mark = 3 # PC indicator
# Make line and symbol margins sensitive to clicks
self.SetMarginSensitive(0, 1)
self.SetMarginSensitive(1, 1)
# Symbols for breakpoint, pc and source indicator
# FIXME: Find better markers
self.SetMarginType(1, STC_MARGIN_SYMBOL)
self.MarkerDefine(self.bp_mark, STC_MARK_ROUNDRECT, "RED", "RED")
self.MarkerDefine(self.src_mark, STC_MARK_ARROWS, "BLACK", "BLACK")
self.MarkerDefine(self.pc_mark, STC_MARK_SHORTARROW, "BLUE",
"BLUE")
# Font selection
# FIXME: Configurable
self.StyleSetSpec(STC_STYLE_DEFAULT, "size:10,face:Courier New")
self.StyleClearAll()
self.StyleSetSpec(STC_STYLE_DEFAULT, "size:10,face:Courier New")
self.StyleSetSpec(STC_STYLE_LINENUMBER,
"back:#8080FF,size:8,face:Courier New")
# Tab size
# FIXME: Make configurable
self.SetTabWidth(4)
# Much more code snipped ...
but this colors all the margin in the same color.
Bye.
···
--
------------------------------------------------------------------------
Miki Tebeka <miki.tebeka@zoran.com>
http://tebeka.bizhat.com
The only difference between children and adults is the price of the toys