コード例 #1
0
        public CodeEditor(FileData aModelData)
        {
            InitializeComponent();
            aModelData.AttachEditor(editor);
            this.data = aModelData;
            editor.ShowLineNumbers = true;
            editor.Options.ConvertTabsToSpaces = true;
            editor.Options.IndentationSize = 4;
            editor.Foreground = new SolidColorBrush(Colors.White);
            editor.SyntaxHighlighting = AvalonExtensions.LoadHighlightingDefinition("Debugger.Resources.Angelscript.xshd");
            editor.Text = data.Code;
            editor.FontFamily = new FontFamily("Consolas");
            editor.TextArea.TextView.CurrentLineBackground = new SolidColorBrush(Colors.LightGray);
            editor.TextArea.TextView.BackgroundRenderers.Add(new LineHighlighter());
            editor.TextArea.LeftMargins.Insert(0, bpMargin = new BreakpointMargin(aModelData));
            SearchPanel panel = SearchPanel.Install(editor.TextArea);
            aModelData.PropertyChanged += aModelData_PropertyChanged;
            foldingManager = FoldingManager.Install(editor.TextArea);
            codeFolding = new BraceFoldingStrategy();
            UpdateFolding();

            // If using IDE data then give ourselves an IntellisenseSource
            if (Debug.SessionData.inst().Settings.UseIDEData)
                intelSource = IDE.Intellisense.Sources.SourceBuilder.GetSourceForExtension(System.IO.Path.GetExtension(aModelData.SectionName));

            depthScanner = new IDE.Intellisense.DepthScanner();
            depthScanner.Process(editor.Text);

            editor.MouseHover += editor_MouseHover;
            editor.TextArea.MouseWheel += editor_MouseWheel;
            editor.KeyUp += editor_KeyUp;
            editor.TextChanged += editor_TextChanged;

            t = new System.Timers.Timer();
            t.Interval = 175;
            t.Elapsed += t_Elapsed;
            t.Start();
        }