def RegisterWithStc(self, stc): """Register this compound marker with the given StyledTextCtrl""" ids = self.GetIds() stc.MarkerDefineBitmap(ids[0], self.Bitmap) stc.MarkerDefine(ids[1], wx.stc.STC_MARK_BACKGROUND, # foreground=self.Foreground, #TODO background=self.Foreground)
def RegisterWithStc(self, stc): """Setup the STC to use this marker""" ids = self.GetIds() if self.Bitmap.IsNull(): symbols = self.GetSymbols() if len(ids) == len(symbols): markers = zip(ids, symbols) for marker, symbol in markers: stc.MarkerDefine(marker, symbol, self.Foreground, self.Background) elif len(ids) == 1 and not self.Bitmap.IsNull(): stc.MarkerDefineBitmap(ids[0], self.Bitmap) else: assert False, "Invalid Marker!"
def buildSheet(self, name): p = wx.Panel(self.notebookEditor, -1, style=wx.NO_FULL_REPAINT_ON_RESIZE) self.onglet.append(p) stc = wx.stc.StyledTextCtrl( id=wx.NewId(), name='styledTextCtrl1', parent=p, # pos=wx.Point(0, 35), size=wx.Size(-1, -1), style=wx.SUNKEN_BORDER) stc.SetUseTabs(False) self.loadConfig() try: tabSize = self.getConfig("Source", "tabSize") stc.SetTabWidth(tabSize) except: tabSize = 4 self.setConfig("Source", "tabSize", tabSize) stc.SetTabWidth(tabSize) self.saveConfig() stc.SetLexer(wx.stc.STC_LEX_CPP) stc.SetMargins(2, 2) stc.SetMarginType(1, wx.stc.STC_MARGIN_NUMBER) stc.SetMarginWidth(1, 40) stc.SetMarginWidth(2, 10) stc.StyleSetSpec(wx.stc.STC_STYLE_LINENUMBER, "fore:#000000,back:#afc8e1ff,size:500") stc.SetMarginSensitive(1, True) stc.SetMarginSensitive(2, True) stc.SetMarginType(3, wx.stc.STC_MARGIN_SYMBOL) stc.SetMarginMask(3, wx.stc.STC_MASK_FOLDERS) stc.SetMarginSensitive(3, True) stc.SetMarginWidth(3, 12) stc.SetProperty("fold", "1") stc.SetProperty("tab.timmy.whinge.level", "1") stc.MarkerDefine(wx.stc.STC_MARKNUM_FOLDEROPEN, wx.stc.STC_MARK_BOXMINUS, "white", "#808080") stc.MarkerDefine(wx.stc.STC_MARKNUM_FOLDER, wx.stc.STC_MARK_BOXPLUS, "white", "#808080") stc.MarkerDefine(wx.stc.STC_MARKNUM_FOLDERSUB, wx.stc.STC_MARK_VLINE, "white", "#808080") stc.MarkerDefine(wx.stc.STC_MARKNUM_FOLDERTAIL, wx.stc.STC_MARK_LCORNER, "white", "#808080") stc.MarkerDefine(wx.stc.STC_MARKNUM_FOLDEREND, wx.stc.STC_MARK_BOXPLUSCONNECTED, "white", "#808080") stc.MarkerDefine(wx.stc.STC_MARKNUM_FOLDEROPENMID, wx.stc.STC_MARK_BOXMINUSCONNECTED, "white", "#808080") stc.MarkerDefine(wx.stc.STC_MARKNUM_FOLDERMIDTAIL, wx.stc.STC_MARK_TCORNER, "white", "#808080") self.stcpage.append(stc) stc.SetMinSize(wx.Size(-1, -1)) p.SetAutoLayout(True) p.Layout() boxSizer = wx.BoxSizer(orient=wx.VERTICAL) boxSizer.Fit(p) boxSizer.SetSizeHints(p) p.SetSizer(boxSizer) boxSizer.AddWindow(stc, 1, border=0, flag=wx.EXPAND | wx.ADJUST_MINSIZE) self.notebookEditor.AddPage(p, os.path.split(name)[1]) self.SendSizeEvent() # self._mgr.Update() self.panelEditor.Layout() self.sheetFunctions.append({})