Esempio n. 1
0
        internal CodeEditor(
            ICommandManager commandManager
            , IEditorView editorView
            , IEditorViewHost editorViewHost
            , IEditorCommands editorCommands
            , IUndoManager undoManager
            , IFindLogic findLogic
            , CodeOptionsModel codeOptionsModel
            )
        {
            this.commandManager = commandManager;
            this.editorView     = editorView;
            this.editorViewHost = editorViewHost;
            this.findLogic      = findLogic;
            this.editorCommands = editorCommands;
            this.undoManager    = undoManager;
            FrameworkElement element = this.Element;

            element.PreviewLostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.Editor_LostFocus);
            element.LostFocus += new RoutedEventHandler(this.Editor_LostFocus);
            if (this.commandManager != null)
            {
                this.commandManager.CommandExecuting += new CommandExecutionEventHandler(this.Editor_LostFocus);
            }
            this.editorView.Background = Brushes.White;
            TextFormattingRunProperties.DefaultProperties.SetTypeface(new Typeface(FontName));
            TextFormattingRunProperties.DefaultProperties.SetFontRenderingEmSize(FontSize);
            this.editorViewHost.LineNumberGutterForegroundColor = Colors.Black;
            this.editorViewHost.LineNumberGutterTypeface        = new Typeface(FontName);
            this.editorViewHost.LineNumberGutterFontSize        = FontSize;
            this.editorView.Invalidate();
            this.codeOptionsModel = codeOptionsModel;
            this.codeOptionsModel.PropertyChanged += new PropertyChangedEventHandler(this.CodeOptionsModel_PropertyChanged);
            this.UpdateOptions();
        }
Esempio n. 2
0
		internal CodeEditor(
			ICommandManager commandManager
			, IEditorView editorView
			, IEditorViewHost editorViewHost
			, IEditorCommands editorCommands
			, IUndoManager undoManager
			, IFindLogic findLogic
			, CodeOptionsModel codeOptionsModel
			)
		{
			this.commandManager = commandManager;
			this.editorView = editorView;
			this.editorViewHost = editorViewHost;
			this.findLogic = findLogic;
			this.editorCommands = editorCommands;
			this.undoManager = undoManager;
			FrameworkElement element = this.Element;
			element.PreviewLostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.Editor_LostFocus);
			element.LostFocus += new RoutedEventHandler(this.Editor_LostFocus);
			if (this.commandManager != null)
			{
				this.commandManager.CommandExecuting += new CommandExecutionEventHandler(this.Editor_LostFocus);
			}
			this.editorView.Background = Brushes.White;
			TextFormattingRunProperties.DefaultProperties.SetTypeface(new Typeface(FontName));
			TextFormattingRunProperties.DefaultProperties.SetFontRenderingEmSize(FontSize);
			this.editorViewHost.LineNumberGutterForegroundColor = Colors.Black;
			this.editorViewHost.LineNumberGutterTypeface = new Typeface(FontName);
			this.editorViewHost.LineNumberGutterFontSize = FontSize;
			this.editorView.Invalidate();
			this.codeOptionsModel = codeOptionsModel;
			this.codeOptionsModel.PropertyChanged += new PropertyChangedEventHandler(this.CodeOptionsModel_PropertyChanged);
			this.UpdateOptions();
		}
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EditorView"/> class.
        /// </summary>
        public EditorView(IEditorArea editorArea)
        {
            if (editorArea == null)
            {
                throw new ArgumentNullException("editorArea");
            }

            _editorArea = editorArea;

            _editorCommands     = EditorConnector.CreateEditorCommands(_editorArea);
            _editorKeyBinding   = new EditorKeyBinding(this);
            _editorMouseBinding = new EditorMouseBinding(this);

            InitializeComponent();
        }
Esempio n. 4
0
        public static IEditorCommands CreateEditorCommands(ITextArea textView)
        {
            if (textView == null)
            {
                throw new ArgumentNullException("textView");
            }

            IPropertyOwner  owner    = textView;
            IEditorCommands property = null;

            if (!owner.TryGetProperty <IEditorCommands>("IEditorCommandsProvider", out property))
            {
                property = new EditorCommands(textView);
                owner.AddProperty("IEditorCommandsProvider", property);
            }

            return(property);
        }
Esempio n. 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EditorView"/> class.
        /// </summary>
        public EditorView(IEditorArea editorArea)
        {
            if (editorArea == null)
            {
                throw new ArgumentNullException("editorArea");
            }

            _editorArea = editorArea;

            _editorCommands = EditorConnector.CreateEditorCommands(_editorArea);
            _editorKeyBinding = new EditorKeyBinding(this);
            _editorMouseBinding = new EditorMouseBinding(this);

            InitializeComponent();
        }