Пример #1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            OpenedForms.Init();
            Application.ApplicationExit += new EventHandler(Application_ApplicationExit);

            try { AppOptions.Load("./config.cfg"); }
            catch { AppOptions.Default(); MessageBox.Show("Cannot load config file. Loading factory default ...", "IO Error", MessageBoxButtons.OK, MessageBoxIcon.Information); }

            Application.Run(new TextEditor());
        }
Пример #2
0
        public TextEditor()
        {
            OpenedForms.NewForm = this;
            AppOptions.Default();
            InitializeComponent();

            opts.Owner = this;

            string version = Assembly.GetExecutingAssembly().GetName().Version.Major.ToString() + "." + Assembly.GetExecutingAssembly().GetName().Version.Minor.ToString();

            filename = "";

            InitAutoComplete();

            // Set up Scintilla
            Editor.Lexing.Lexer = Lexer.CppNoCase;
            string arg1 = "";

            foreach (string arg in args1)
            {
                arg1 += arg + " ";
            }
            string arg2 = "";

            foreach (string arg in args2)
            {
                arg2 += arg + " ";
            }
            string arg3 = "";

            Editor.Lexing.SetKeywords(0, arg1);
            Editor.Lexing.SetKeywords(1, arg2);
            Editor.Lexing.SetKeywords(2, arg3);
            Editor.Lexing.LineCommentPrefix = "//";

            Editor.Styles[Editor.Lexing.StyleNameMap["DOCUMENT_DEFAULT"]].ForeColor = System.Drawing.Color.Black;
            Editor.Styles[Editor.Lexing.StyleNameMap["NUMBER"]].ForeColor           = System.Drawing.Color.Orange;
            Editor.Styles[Editor.Lexing.StyleNameMap["WORD"]].ForeColor             = System.Drawing.Color.Blue;
            Editor.Styles[Editor.Lexing.StyleNameMap["WORD2"]].ForeColor            = System.Drawing.Color.Purple;
            Editor.Styles[Editor.Lexing.StyleNameMap["STRING"]].ForeColor           = System.Drawing.Color.FromArgb(200, 0, 0);
            Editor.Styles[Editor.Lexing.StyleNameMap["CHARACTER"]].ForeColor        = System.Drawing.Color.Red;
            Editor.Styles[Editor.Lexing.StyleNameMap["PREPROCESSOR"]].ForeColor     = System.Drawing.Color.Brown;
            Editor.Styles[Editor.Lexing.StyleNameMap["OPERATOR"]].ForeColor         = System.Drawing.Color.Black;
            Editor.Styles[Editor.Lexing.StyleNameMap["IDENTIFIER"]].ForeColor       = System.Drawing.Color.Black;
            Editor.Styles[Editor.Lexing.StyleNameMap["COMMENT"]].ForeColor          = System.Drawing.Color.Green;

            Editor.AutoComplete.List                   = KeysAndVars;
            Editor.AutoComplete.MaxHeight              = 15;
            Editor.AutoComplete.MaxWidth               = 40;
            Editor.AutoComplete.IsCaseSensitive        = false;
            Editor.AutoComplete.DropRestOfWord         = false;
            Editor.AutoComplete.AutoHide               = false;
            Editor.AutoComplete.AutomaticLengthEntered = true;
            Editor.AutoComplete.StopCharacters         = "{SPACE}";
            Editor.AutoComplete.FillUpCharacters       = "{TAB}:.";

            Editor.Indentation.BackspaceUnindents = true;
            Editor.Indentation.IndentWidth        = 4;
            Editor.Indentation.SmartIndentType    = SmartIndent.CPP2;
            Editor.Indentation.TabIndents         = true;
            Editor.Indentation.TabWidth           = 4;
            Editor.Indentation.UseTabs            = true;
            Editor.Indentation.ShowGuides         = true;
        }