andrej@1511: #!/usr/bin/env python andrej@1511: # -*- coding: utf-8 -*- andrej@1511: andrej@1511: # This file is part of Beremiz, a Integrated Development Environment for andrej@1511: # programming IEC 61131-3 automates supporting plcopen standard and CanFestival. andrej@1511: # andrej@1511: # Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD andrej@1511: # andrej@1511: # See COPYING file for copyrights details. andrej@1511: # andrej@1511: # This program is free software; you can redistribute it and/or andrej@1511: # modify it under the terms of the GNU General Public License andrej@1511: # as published by the Free Software Foundation; either version 2 andrej@1511: # of the License, or (at your option) any later version. andrej@1511: # andrej@1511: # This program is distributed in the hope that it will be useful, andrej@1511: # but WITHOUT ANY WARRANTY; without even the implied warranty of andrej@1511: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the andrej@1511: # GNU General Public License for more details. andrej@1511: # andrej@1511: # You should have received a copy of the GNU General Public License andrej@1511: # along with this program; if not, write to the Free Software andrej@1511: # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 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@1138: CONFNODEEDITOR_TABS = [ Laurent@1138: (_("C code"), "_create_CodePanel")] Laurent@1138: CODE_EDITOR = CppEditor Laurent@1096: Laurent@1097: Laurent@1138: