示例#1
0
        /// <summary>
        /// Loads the content of a source file in the editor
        /// </summary>
        public TypeCobolEditor(CobolFile sourceFile)
        {
            TextView textView = TextArea.TextView;

            // Default text style
            FontFamily = new FontFamily("Consolas");
            FontSize   = 13;

            // Show line numbers
            ShowLineNumbers = true;

            // Activate search box
            SearchPanel.Install(this);

            // Plug in TypeCobol syntax highlighting
            syntaxHighlighter = new SyntaxHighlighter();
            textView.LineTransformers.Add(syntaxHighlighter);

            // Plug in TypeCobol error marker
            errorMarker = new ErrorMarker(this);
            textView.BackgroundRenderers.Add(errorMarker);
            textView.LineTransformers.Add(errorMarker);

            // Tooltip management
            tooltipManager               = new TooltipManager(this, errorMarker);
            textView.MouseHover         += tooltipManager.MouseHover;
            textView.MouseHoverStopped  += tooltipManager.MouseHoverStopped;
            textView.VisualLinesChanged += tooltipManager.VisualLinesChanged;

            // Initial load of the cobol file if necessary
            if (sourceFile != null)
            {
                Document = new ICSharpCode.AvalonEdit.Document.TextDocument(sourceFile.ReadChars());
            }

            // Wrap the AvalonEdit.Document in a ITextDocument interface
            textDocument = new AvalonEditTextDocument(Document, IBMCodePages.GetDotNetEncodingFromIBMCCSID(1147), ColumnsLayout.CobolReferenceFormat);
        }
示例#2
-1
        /// <summary>
        /// Loads the content of a source file in the editor
        /// </summary>
        public TypeCobolEditor(CobolFile sourceFile)
        {
            TextView textView = TextArea.TextView;

            // Default text style
            FontFamily = new FontFamily("Consolas");
            FontSize = 13;

            // Show line numbers
            ShowLineNumbers = true;

            // Activate search box
            SearchPanel.Install(this);

            // Plug in TypeCobol syntax highlighting
            syntaxHighlighter = new SyntaxHighlighter();
            textView.LineTransformers.Add(syntaxHighlighter);

            // Plug in TypeCobol error marker
            errorMarker = new ErrorMarker(this);
            textView.BackgroundRenderers.Add(errorMarker);
            textView.LineTransformers.Add(errorMarker);

            // Tooltip management
            tooltipManager = new TooltipManager(this, errorMarker);
            textView.MouseHover += tooltipManager.MouseHover;
            textView.MouseHoverStopped += tooltipManager.MouseHoverStopped;
            textView.VisualLinesChanged += tooltipManager.VisualLinesChanged;

            // Initial load of the cobol file if necessary
            if (sourceFile != null)
            {
                Document = new ICSharpCode.AvalonEdit.Document.TextDocument(sourceFile.ReadChars());
            }

            // Wrap the AvalonEdit.Document in a ITextDocument interface
            textDocument = new AvalonEditTextDocument(Document, IBMCodePages.GetDotNetEncodingFromIBMCCSID(1147), ColumnsLayout.CobolReferenceFormat);
        }