TextAreaInputHandler that registers all search-related commands.
상속: ICSharpCode.AvalonEdit.Editing.TextAreaInputHandler
예제 #1
0
        public XamlPage()
        {
            InitializeComponent();

            textEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("XML");
            TextEditorOptions options = textEditor.Options;
            if (options != null)
            {
                //options.AllowScrollBelowDocument = true;
                options.EnableHyperlinks = true;
                options.EnableEmailHyperlinks = true;
                //options.ShowSpaces = true;
                //options.ShowTabs = true;
                //options.ShowEndOfLine = true;
            }
            textEditor.ShowLineNumbers = true;

            _foldingManager  = FoldingManager.Install(textEditor.TextArea);
            _foldingStrategy = new XmlFoldingStrategy();

            textEditor.CommandBindings.Add(new CommandBinding(
                ApplicationCommands.Print, OnPrint, OnCanExecuteTextEditorCommand));
            textEditor.CommandBindings.Add(new CommandBinding(
                ApplicationCommands.PrintPreview, OnPrintPreview, OnCanExecuteTextEditorCommand));

            _searchHandler = new SearchInputHandler(textEditor.TextArea);
            textEditor.TextArea.DefaultInputHandler.NestedInputHandlers.Add(_searchHandler);
        }
        public ContentViewerPane()
        {
            InitializeComponent();

            SyntaxHighlightingHelper.RegisterHightingExtensions();

            // set the Syntax Highlighting definitions
            LanguageBox.ItemsSource = HighlightingManager.Instance.HighlightingDefinitions;

            // disable unnecessary editor features
            contentBox.Options.CutCopyWholeLine = false;
            contentBox.Options.EnableEmailHyperlinks = false;
            contentBox.Options.EnableHyperlinks = false;
            contentBox.TextArea.SelectionCornerRadius = 0;

            var searchInput = new SearchInputHandler(contentBox.TextArea);
            _findCommand = searchInput.CommandBindings.FirstOrDefault(binding => binding.Command == ApplicationCommands.Find);
            contentBox.TextArea.DefaultInputHandler.NestedInputHandlers.Add(searchInput);
        }
        public FileEditor()
        {
            InitializeComponent();

            SyntaxHighlightingHelper.RegisterHightingExtensions();

            // set the Syntax Highlighting definitions
            SyntaxDefinitions.ItemsSource = HighlightingManager.Instance.HighlightingDefinitions;

            // Set the initial Font Family to Consolas
            FontChoice.ItemsSource = Fonts.SystemFontFamilies.OrderBy(p => p.Source);
            FontChoice.SelectedItem = ConsolasFont;

            // disable unnecessary editor features
            Editor.Options.CutCopyWholeLine = false;
            Editor.Options.EnableEmailHyperlinks = false;
            Editor.Options.EnableHyperlinks = false;
            Editor.Options.ConvertTabsToSpaces = true;

            Editor.TextArea.SelectionCornerRadius = 0;

            var searchInput = new SearchInputHandler(Editor.TextArea);
            Editor.TextArea.DefaultInputHandler.NestedInputHandlers.Add(searchInput);
        }
예제 #4
0
		public override void Detach()
		{
			if (handler != null) {
				handler.SearchOptionsChanged -= SearchOptionsChanged;
			}
			handler = null;
		}
예제 #5
0
		public override void Attach(ITextEditor editor)
		{
			TextArea textArea = editor.GetService(typeof(TextArea)) as TextArea;
			if (textArea == null) return;
			handler = new SearchInputHandler(textArea);
			textArea.DefaultInputHandler.NestedInputHandlers.Add(handler);
			handler.SearchOptionsChanged += SearchOptionsChanged;
		}
예제 #6
0
		public override void Detach()
		{
			base.Detach();
			if (textArea != null) {
				textArea.DefaultInputHandler.NestedInputHandlers.Remove(handler);
				textArea = null;
				handler = null;
			}
		}