lbessard@145: laurent@630: import wx.stc as stc laurent@630: Laurent@1096: from controls.CustomStyledTextCtrl import faces Laurent@1096: from editors.CodeFileEditor import CodeFileEditor, CodeEditor lbessard@145: Laurent@1096: class CppEditor(CodeEditor): lbessard@145: Laurent@1096: KEYWORDS = ["asm", "auto", "bool", "break", "case", "catch", "char", "class", Laurent@1096: "const", "const_cast", "continue", "default", "delete", "do", "double", Laurent@1096: "dynamic_cast", "else", "enum", "explicit", "export", "extern", "false", Laurent@1096: "float", "for", "friend", "goto", "if", "inline", "int", "long", "mutable", Laurent@1096: "namespace", "new", "operator", "private", "protected", "public", "register", Laurent@1096: "reinterpret_cast", "return", "short", "signed", "sizeof", "static", Laurent@1096: "static_cast", "struct", "switch", "template", "this", "throw", "true", "try", Laurent@1096: "typedef", "typeid", "typename", "union", "unsigned", "using", "virtual", Laurent@1096: "void", "volatile", "wchar_t", "while"] Laurent@1110: COMMENT_HEADER = "/" lbessard@145: Laurent@1096: def SetCodeLexer(self): lbessard@145: self.SetLexer(stc.STC_LEX_CPP) lbessard@145: Laurent@1060: self.StyleSetSpec(stc.STC_C_COMMENT, 'fore:#408060,size:%(size)d' % faces) Laurent@1060: self.StyleSetSpec(stc.STC_C_COMMENTLINE, 'fore:#408060,size:%(size)d' % faces) Laurent@1060: self.StyleSetSpec(stc.STC_C_COMMENTDOC, 'fore:#408060,size:%(size)d' % faces) Laurent@1060: self.StyleSetSpec(stc.STC_C_NUMBER, 'fore:#0076AE,size:%(size)d' % faces) Laurent@1060: self.StyleSetSpec(stc.STC_C_WORD, 'bold,fore:#800056,size:%(size)d' % faces) Laurent@1060: self.StyleSetSpec(stc.STC_C_STRING, 'fore:#2a00ff,size:%(size)d' % faces) Laurent@1060: self.StyleSetSpec(stc.STC_C_PREPROCESSOR, 'bold,fore:#800056,size:%(size)d' % faces) Laurent@1060: self.StyleSetSpec(stc.STC_C_OPERATOR, 'bold,size:%(size)d' % faces) Laurent@1060: self.StyleSetSpec(stc.STC_C_STRINGEOL, 'back:#FFD5FF,size:%(size)d' % faces) lbessard@145: lbessard@145: #------------------------------------------------------------------------------- Laurent@1096: # CFileEditor Main Frame Class lbessard@145: #------------------------------------------------------------------------------- lbessard@145: Laurent@1096: class CFileEditor(CodeFileEditor): laurent@651: Laurent@1096: CONFNODEEDITOR_TABS = CodeFileEditor.CONFNODEEDITOR_TABS + [ Laurent@920: (_("C code"), "_create_CCodeEditor")] Laurent@920: Laurent@920: def _create_CCodeEditor(self, prnt): Laurent@1096: self.CCodeEditor = CppEditor(prnt, self.ParentWindow, self.Controler) Laurent@920: Laurent@920: return self.CCodeEditor Laurent@1096: Laurent@1096: def RefreshView(self): Laurent@1096: CodeFileEditor.RefreshView(self) laurent@630: Laurent@1096: self.CCodeEditor.RefreshView() Laurent@1097: Laurent@1097: def Find(self, direction, search_params): Laurent@1097: self.CCodeEditor.Find(direction, search_params)