Beispiel #1
0
        public CodeEditorContent(CodeEditorExtension extension, OpenedFile sourceFile)
            : base(extension)
        {
            this.AssociatedFile = sourceFile;
            this.AssociatedFile.FilePathChanged += AssociatedFile_FilePathChanged;

            _extensionHost = extension.ExtensionHost;

            this.Text    = sourceFile.FilePath.FileName + sourceFile.FilePath.Extension;
            this.Control = _editorControl = new CodeEditorControl(this, sourceFile)
            {
                Dock = DockStyle.Fill,
            };
        }
        public CodeEditorContent(CodeEditorExtension extension, OpenedFile sourceFile)
            : base(extension)
        {
            this.AssociatedFile = sourceFile;
            this.AssociatedFile.FilePathChanged += AssociatedFile_FilePathChanged;

            _extensionHost = extension.ExtensionHost;

            this.Text = sourceFile.FilePath.FileName + sourceFile.FilePath.Extension;
            this.Control = _editorControl = new CodeEditorControl(this, sourceFile)
            {
                Dock = DockStyle.Fill,
            };
        }
Beispiel #3
0
        public CodeEditorControl(CodeEditorContent content, OpenedFile file)
        {
            InitializeComponent();

            _content   = content;
            _extension = (CodeEditorExtension)content.ParentExtension;
            _file      = file;

            SetupTextBox();
            _errorStyle   = new ErrorStyle(_extension.StyleMap.DefaultText.Description);
            _warningStyle = new WarningStyle(_extension.StyleMap.DefaultText.Description);

            contextMenuStrip1.Renderer = _extension.ExtensionHost.ControlManager.MenuRenderer;

            _componentMuiIdentifiers = new Dictionary <object, string>()
            {
                { this.cutToolStripMenuItem, "CodeEditorControl.ContextMenu.Cut" },
                { this.copyToolStripMenuItem, "CodeEditorControl.ContextMenu.Copy" },
                { this.pasteToolStripMenuItem, "CodeEditorControl.ContextMenu.Paste" },
                { this.selectAllToolStripMenuItem, "CodeEditorControl.ContextMenu.SelectAll" },
            };

            _extension.ExtensionHost.UILanguageChanged += ExtensionHost_UILanguageChanged;
            _extension.ExtensionHost.BookmarkManager.Bookmarks.InsertedItem += Bookmarks_InsertedItem;
            _extension.ExtensionHost.BookmarkManager.Bookmarks.RemovedItem  += Bookmarks_RemovedItem;
            _extension.ExtensionHost.ErrorManager.Errors.InsertedItem       += Errors_InsertedItem;
            _extension.ExtensionHost.ErrorManager.Errors.RemovedItem        += Errors_RemovedItem;
            _extension.ExtensionHost.ErrorManager.Errors.ClearedCollection  += Errors_ClearedCollection;
            _extension.ExtensionHost.DebugStarted += ExtensionHost_DebugStarted;
            _extension.ExtensionHost.DebugStopped += ExtensionHost_DebugStopped;

            _instructionPointer = new CodeEditorInstructionPointer(TextBox, _extension.StyleMap.InstructionPointerStyle);

            if (_extension.ExtensionHost.IsDebugging)
            {
                ExtensionHost_DebugStarted(null, null);
            }

            ExtensionHost_UILanguageChanged(null, null);

            _extension.AppliedSettings += extension_AppliedSettings;
            extension_AppliedSettings(null, null);

            file.HasUnsavedDataChanged += file_HasUnsavedDataChanged;
        }