예제 #1
0
        public ReplEditorUI(ReplEditorOptions options, IThemeManager themeManager, IWpfCommandManager wpfCommandManager, IMenuManager menuManager, ITextEditorSettings textEditorSettings)
        {
            this.dispatcher = Dispatcher.CurrentDispatcher;
            this.options    = (options ?? new ReplEditorOptions()).Clone();
            this.textEditor = new NewTextEditor(themeManager, textEditorSettings);
            this.textEditor.TextArea.Document = new TextDocument();
            this.textEditor.TextArea.Document.UndoStack.SizeLimit = 100;
            this.textEditor.TextArea.LeftMargins.Insert(0, new FrameworkElement {
                Margin = new Thickness(LEFT_MARGIN, 0, 0, 0)
            });
            this.textEditor.TextArea.TextEntering   += TextArea_TextEntering;
            this.textEditor.TextArea.PreviewKeyDown += TextArea_PreviewKeyDown;
            AddBinding(ApplicationCommands.Paste, (s, e) => Paste(), (s, e) => e.CanExecute      = CanPaste && IsAtEditingPosition);
            AddBinding(ApplicationCommands.Cut, (s, e) => CutSelection(), (s, e) => e.CanExecute = CanCutSelection && IsAtEditingPosition);

            if (this.options.TextEditorCommandGuid != null)
            {
                wpfCommandManager.Add(this.options.TextEditorCommandGuid.Value, textEditor);
            }
            if (this.options.TextAreaCommandGuid != null)
            {
                wpfCommandManager.Add(this.options.TextAreaCommandGuid.Value, textEditor.TextArea);
            }
            if (this.options.MenuGuid != null)
            {
                menuManager.InitializeContextMenu(this.textEditor, this.options.MenuGuid.Value, new GuidObjectsCreator(this), new ContextMenuInitializer(textEditor, textEditor));
            }
        }
예제 #2
0
		public ReplEditorUI(ReplEditorOptions options, IThemeManager themeManager, IWpfCommandManager wpfCommandManager, IMenuManager menuManager, ITextEditorSettings textEditorSettings) {
			this.dispatcher = Dispatcher.CurrentDispatcher;
			this.options = (options ?? new ReplEditorOptions()).Clone();
			this.textEditor = new NewTextEditor(themeManager, textEditorSettings);
			this.textEditor.TextArea.AllowDrop = false;
			this.textEditor.TextArea.Document = new TextDocument();
			this.textEditor.TextArea.Document.UndoStack.SizeLimit = 100;
			this.textEditor.TextArea.LeftMargins.Insert(0, new FrameworkElement { Margin = new Thickness(LEFT_MARGIN, 0, 0, 0) });
			this.textEditor.TextArea.TextEntering += TextArea_TextEntering;
			this.textEditor.TextArea.PreviewKeyDown += TextArea_PreviewKeyDown;
			AddBinding(ApplicationCommands.Paste, (s, e) => Paste(), (s, e) => e.CanExecute = CanPaste && IsAtEditingPosition);
			AddBinding(ApplicationCommands.Cut, (s, e) => CutSelection(), (s, e) => e.CanExecute = CanCutSelection && IsAtEditingPosition);

			if (this.options.TextEditorCommandGuid != null)
				wpfCommandManager.Add(this.options.TextEditorCommandGuid.Value, textEditor);
			if (this.options.TextAreaCommandGuid != null)
				wpfCommandManager.Add(this.options.TextAreaCommandGuid.Value, textEditor.TextArea);
			if (this.options.MenuGuid != null)
				menuManager.InitializeContextMenu(this.textEditor, this.options.MenuGuid.Value, new GuidObjectsCreator(this), new ContextMenuInitializer(textEditor, textEditor));
		}
예제 #3
0
			public NewHighlighter(NewTextEditor textEditor, TextDocument document) {
				this.textEditor = textEditor;
				this.document = document;
			}
예제 #4
0
			public NewHighlightingColorizer(NewTextEditor textEditor) {
				this.textEditor = textEditor;
			}
예제 #5
0
 public ContextMenuInitializer(Control ctrl, NewTextEditor textEditor)
 {
     this.ctrl       = ctrl;
     this.textEditor = textEditor;
 }
예제 #6
0
 public NewHighlighter(NewTextEditor textEditor, TextDocument document)
 {
     this.textEditor = textEditor;
     this.document   = document;
 }
예제 #7
0
 public NewHighlightingColorizer(NewTextEditor textEditor)
 {
     this.textEditor = textEditor;
 }
예제 #8
0
		public ContextMenuInitializer(Control ctrl, NewTextEditor textEditor) {
			this.ctrl = ctrl;
			this.textEditor = textEditor;
		}