예제 #1
0
		ReplEditorOptions CopyTo(ReplEditorOptions other) {
			other.PromptText = PromptText;
			other.ContinueText = ContinueText;
			other.TextEditorCommandGuid = TextEditorCommandGuid;
			other.TextAreaCommandGuid = TextAreaCommandGuid;
			other.MenuGuid = MenuGuid;
			return other;
		}
예제 #2
0
 ReplEditorOptions CopyTo(ReplEditorOptions other)
 {
     other.PromptText            = PromptText;
     other.ContinueText          = ContinueText;
     other.TextEditorCommandGuid = TextEditorCommandGuid;
     other.TextAreaCommandGuid   = TextAreaCommandGuid;
     other.MenuGuid = MenuGuid;
     return(other);
 }
예제 #3
0
		protected ScriptContent(IThemeManager themeManager, IReplEditorCreator replEditorCreator, ReplEditorOptions replOpts, IServiceLocator serviceLocator) {
			this.replEditorUI = replEditorCreator.Create(replOpts);
			this.scriptControl = new ScriptControl();
			this.scriptControl.SetTextEditorObject(this.replEditorUI.UIObject);
			this.scriptControlVM = CreateScriptControlVM(this.replEditorUI, serviceLocator);
			this.scriptControlVM.OnCommandExecuted += ScriptControlVM_OnCommandExecuted;
			this.replEditorUI.Tag = this;
			this.scriptControl.DataContext = this.scriptControlVM;
			themeManager.ThemeChanged += ThemeManager_ThemeChanged;
		}
예제 #4
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));
		}
예제 #5
0
		public IReplEditorUI Create(ReplEditorOptions options) {
			return new ReplEditorUI(options, themeManager, wpfCommandManager, menuManager, textEditorSettings);
		}