c_ext/CFileEditor.py
changeset 1784 64beb9e9c749
parent 1782 5b6ad7a7fd9d
child 1881 091005ec69c4
equal deleted inserted replaced
1729:31e63e25b4cc 1784:64beb9e9c749
    25 import wx.stc as stc
    25 import wx.stc as stc
    26 
    26 
    27 from controls.CustomStyledTextCtrl import faces
    27 from controls.CustomStyledTextCtrl import faces
    28 from editors.CodeFileEditor import CodeFileEditor, CodeEditor
    28 from editors.CodeFileEditor import CodeFileEditor, CodeEditor
    29 
    29 
       
    30 
    30 class CppEditor(CodeEditor):
    31 class CppEditor(CodeEditor):
    31 
    32 
    32     KEYWORDS = ["asm", "auto", "bool", "break", "case", "catch", "char", "class", 
    33     KEYWORDS = ["asm", "auto", "bool", "break", "case", "catch", "char", "class",
    33         "const", "const_cast", "continue", "default", "delete", "do", "double", 
    34                 "const", "const_cast", "continue", "default", "delete", "do", "double",
    34         "dynamic_cast", "else", "enum", "explicit", "export", "extern", "false", 
    35                 "dynamic_cast", "else", "enum", "explicit", "export", "extern", "false",
    35         "float", "for", "friend", "goto", "if", "inline", "int", "long", "mutable", 
    36                 "float", "for", "friend", "goto", "if", "inline", "int", "long", "mutable",
    36         "namespace", "new", "operator", "private", "protected", "public", "register", 
    37                 "namespace", "new", "operator", "private", "protected", "public", "register",
    37         "reinterpret_cast", "return", "short", "signed", "sizeof", "static", 
    38                 "reinterpret_cast", "return", "short", "signed", "sizeof", "static",
    38         "static_cast", "struct", "switch", "template", "this", "throw", "true", "try",
    39                 "static_cast", "struct", "switch", "template", "this", "throw", "true", "try",
    39         "typedef", "typeid", "typename", "union", "unsigned", "using", "virtual", 
    40                 "typedef", "typeid", "typename", "union", "unsigned", "using", "virtual",
    40         "void", "volatile", "wchar_t", "while"]
    41                 "void", "volatile", "wchar_t", "while"]
    41     COMMENT_HEADER = "/"
    42     COMMENT_HEADER = "/"
    42     
    43 
    43     def SetCodeLexer(self):
    44     def SetCodeLexer(self):
    44         self.SetLexer(stc.STC_LEX_CPP)
    45         self.SetLexer(stc.STC_LEX_CPP)
    45         
    46 
    46         self.StyleSetSpec(stc.STC_C_COMMENT, 'fore:#408060,size:%(size)d' % faces)
    47         self.StyleSetSpec(stc.STC_C_COMMENT, 'fore:#408060,size:%(size)d' % faces)
    47         self.StyleSetSpec(stc.STC_C_COMMENTLINE, 'fore:#408060,size:%(size)d' % faces)
    48         self.StyleSetSpec(stc.STC_C_COMMENTLINE, 'fore:#408060,size:%(size)d' % faces)
    48         self.StyleSetSpec(stc.STC_C_COMMENTDOC, 'fore:#408060,size:%(size)d' % faces)
    49         self.StyleSetSpec(stc.STC_C_COMMENTDOC, 'fore:#408060,size:%(size)d' % faces)
    49         self.StyleSetSpec(stc.STC_C_NUMBER, 'fore:#0076AE,size:%(size)d' % faces)
    50         self.StyleSetSpec(stc.STC_C_NUMBER, 'fore:#0076AE,size:%(size)d' % faces)
    50         self.StyleSetSpec(stc.STC_C_WORD, 'bold,fore:#800056,size:%(size)d' % faces)
    51         self.StyleSetSpec(stc.STC_C_WORD, 'bold,fore:#800056,size:%(size)d' % faces)
    51         self.StyleSetSpec(stc.STC_C_STRING, 'fore:#2a00ff,size:%(size)d' % faces)
    52         self.StyleSetSpec(stc.STC_C_STRING, 'fore:#2a00ff,size:%(size)d' % faces)
    52         self.StyleSetSpec(stc.STC_C_PREPROCESSOR, 'bold,fore:#800056,size:%(size)d' % faces)
    53         self.StyleSetSpec(stc.STC_C_PREPROCESSOR, 'bold,fore:#800056,size:%(size)d' % faces)
    53         self.StyleSetSpec(stc.STC_C_OPERATOR, 'bold,size:%(size)d' % faces)
    54         self.StyleSetSpec(stc.STC_C_OPERATOR, 'bold,size:%(size)d' % faces)
    54         self.StyleSetSpec(stc.STC_C_STRINGEOL, 'back:#FFD5FF,size:%(size)d' % faces)
    55         self.StyleSetSpec(stc.STC_C_STRINGEOL, 'back:#FFD5FF,size:%(size)d' % faces)
    55 
    56 
    56 #-------------------------------------------------------------------------------
       
    57 #                          CFileEditor Main Frame Class
       
    58 #-------------------------------------------------------------------------------
       
    59 
    57 
    60 class CFileEditor(CodeFileEditor):
    58 class CFileEditor(CodeFileEditor):
    61     
    59     """
       
    60     CFileEditor Main Frame Class
       
    61     """
       
    62 
    62     CONFNODEEDITOR_TABS = [
    63     CONFNODEEDITOR_TABS = [
    63         (_("C code"), "_create_CodePanel")]
    64         (_("C code"), "_create_CodePanel")]
    64     CODE_EDITOR = CppEditor
    65     CODE_EDITOR = CppEditor
    65 
       
    66 
       
    67