116 self.StyleSetSpec(STC_PLC_NUMBER, "fore:#007F7F,size:%(size)d" % faces) |
116 self.StyleSetSpec(STC_PLC_NUMBER, "fore:#007F7F,size:%(size)d" % faces) |
117 self.StyleSetSpec(STC_PLC_JUMP, "fore:#007F00,size:%(size)d" % faces) |
117 self.StyleSetSpec(STC_PLC_JUMP, "fore:#007F00,size:%(size)d" % faces) |
118 |
118 |
119 # Indicators styles |
119 # Indicators styles |
120 self.IndicatorSetStyle(0, wx.stc.STC_INDIC_SQUIGGLE) |
120 self.IndicatorSetStyle(0, wx.stc.STC_INDIC_SQUIGGLE) |
121 self.IndicatorSetForeground(0, wx.RED) |
121 if window and controler: |
|
122 self.IndicatorSetForeground(0, wx.RED) |
|
123 else: |
|
124 self.IndicatorSetForeground(0, wx.WHITE) |
122 |
125 |
123 # Line numbers in the margin |
126 # Line numbers in the margin |
124 self.SetMarginType(1, wx.stc.STC_MARGIN_NUMBER) |
127 self.SetMarginType(1, wx.stc.STC_MARGIN_NUMBER) |
125 self.SetMarginWidth(1, 50) |
128 self.SetMarginWidth(1, 50) |
126 |
129 |
135 self.TextChanged = False |
138 self.TextChanged = False |
136 self.DisableEvents = True |
139 self.DisableEvents = True |
137 self.TextSyntax = "ST" |
140 self.TextSyntax = "ST" |
138 self.CurrentAction = None |
141 self.CurrentAction = None |
139 |
142 |
140 self.Parent = window |
143 self.ParentWindow = window |
141 self.Controler = controler |
144 self.Controler = controler |
142 |
145 |
143 self.SetModEventMask(wx.stc.STC_MOD_BEFOREINSERT|wx.stc.STC_MOD_BEFOREDELETE) |
146 self.SetModEventMask(wx.stc.STC_MOD_BEFOREINSERT|wx.stc.STC_MOD_BEFOREDELETE) |
144 |
147 |
145 self.Bind(wx.stc.EVT_STC_STYLENEEDED, self.OnStyleNeeded, id=ID_TEXTVIEWER) |
148 self.Bind(wx.stc.EVT_STC_STYLENEEDED, self.OnStyleNeeded, id=ID_TEXTVIEWER) |
146 if window and controler : |
149 if window and controler: |
147 self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown) |
150 self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown) |
148 self.Bind(wx.stc.EVT_STC_DO_DROP, self.OnDoDrop, id=ID_TEXTVIEWER) |
151 self.Bind(wx.stc.EVT_STC_DO_DROP, self.OnDoDrop, id=ID_TEXTVIEWER) |
149 self.Bind(wx.EVT_KILL_FOCUS, self.OnKillFocus) |
152 self.Bind(wx.EVT_KILL_FOCUS, self.OnKillFocus) |
150 self.Bind(wx.stc.EVT_STC_MODIFIED, self.OnModification, id=ID_TEXTVIEWER) |
153 self.Bind(wx.stc.EVT_STC_MODIFIED, self.OnModification, id=ID_TEXTVIEWER) |
151 |
154 |
205 self.Colourise(0, -1) |
208 self.Colourise(0, -1) |
206 |
209 |
207 # Buffer the last model state |
210 # Buffer the last model state |
208 def RefreshBuffer(self): |
211 def RefreshBuffer(self): |
209 self.Controler.BufferProject() |
212 self.Controler.BufferProject() |
210 self.Parent.RefreshTitle() |
213 self.ParentWindow.RefreshTitle() |
211 self.Parent.RefreshEditMenu() |
214 self.ParentWindow.RefreshEditMenu() |
212 |
215 |
213 def StartBuffering(self): |
216 def StartBuffering(self): |
214 self.Controler.StartBuffering() |
217 self.Controler.StartBuffering() |
215 self.Parent.RefreshTitle() |
218 self.ParentWindow.RefreshTitle() |
216 self.Parent.RefreshEditMenu() |
219 self.ParentWindow.RefreshEditMenu() |
217 |
220 |
218 def ResetBuffer(self): |
221 def ResetBuffer(self): |
219 if self.CurrentAction != None: |
222 if self.CurrentAction != None: |
220 self.Controler.EndBuffering() |
223 self.Controler.EndBuffering() |
221 self.CurrentAction = None |
224 self.CurrentAction = None |