/// <summary> /// Creates a new SearchInputHandler and registers the search-related commands. /// </summary> public SearchInputHandler(TextArea textArea) : base(textArea) { RegisterCommands(this.CommandBindings); panel = new SearchPanel(); panel.Attach(TextArea); }
public void Attach(ITextEditor editor) { TextArea textArea = editor.GetService(typeof(TextArea)) as TextArea; if (textArea != null) { panel = SearchPanel.Install(textArea); panel.SearchOptionsChanged += SearchOptionsChanged; } }
public void Detach() { if (panel != null) { panel.SearchOptionsChanged -= SearchOptionsChanged; panel.Uninstall(); panel = null; } }
void ExecuteFind(object sender, ExecutedRoutedEventArgs e) { if (panel == null || panel.IsClosed) { panel = new SearchPanel(); panel.Attach(TextArea); } Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Input, (Action)delegate { panel.Reactivate(); }); }
static void SearchPatternChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (d is SearchPanel) { SearchPanel panel = d as SearchPanel; panel.ValidateSearchText(); panel.UpdateSearch(); } }
static void MarkerBrushChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) { SearchPanel panel = d as SearchPanel; if (panel != null) { panel.renderer.MarkerBrush = (Brush)e.NewValue; } }
void ExecuteFind(object sender, ExecutedRoutedEventArgs e) { if (panel == null || panel.IsClosed) { panel = new SearchPanel(); panel.Attach(TextArea); } panel.SearchPattern = TextArea.Selection.GetText(); Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Input, (Action) delegate { panel.Reactivate(); }); }
/// <summary> /// Creates a SearchPanel and installs it to the TextArea. /// </summary> public static SearchPanel Install(TextArea textArea) { if (textArea == null) { throw new ArgumentNullException("textArea"); } #pragma warning disable 618 SearchPanel panel = new SearchPanel(); panel.AttachInternal(textArea); panel.handler = new SearchInputHandler(textArea, panel); textArea.DefaultInputHandler.NestedInputHandlers.Add(panel.handler); return(panel); }
private void ExecuteFindImpl(string pattern, bool setFocusToSearchBox, bool isBackward) { if (this.panel == null || this.panel.IsClosed) { this.panel = new SearchPanel(); this.panel.Attach(TextArea); } var currentPos = TextArea.Caret.Position; panel.SearchPattern = pattern; if (setFocusToSearchBox) Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Input, (Action) delegate { this.panel.Reactivate(); }); if (isBackward) { TextArea.Caret.Position = currentPos; this.panel.FindPrevious(); } }
private void SearchHandler(object sender, ExecutedRoutedEventArgs e) { var sp = new SearchPanel(); sp.Attach(textEditor.TextArea); sp.Dispatcher.BeginInvoke(DispatcherPriority.Input, (Action)sp.Reactivate); }
static void SearchPatternChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) { SearchPanel panel = d as SearchPanel; panel?.ValidateAndUpdateSearch(); }
public override void Detach() { base.Detach(); if (panel != null) { panel.SearchOptionsChanged -= SearchOptionsChanged; panel.Uninstall(); panel = null; } }
internal SearchInputHandler(TextArea textArea, SearchPanel panel) : base(textArea) { RegisterCommands(this.CommandBindings); this.panel = panel; }
void ExecuteCloseSearchPanel(object sender, ExecutedRoutedEventArgs e) { if (panel != null) panel.Close(); panel = null; }
public SearchPanelAdorner(TextArea textArea, SearchPanel panel) : base(textArea) { this.panel = panel; AddVisualChild(panel); }
private void ExecuteCloseSearchPanel(object sender, ExecutedRoutedEventArgs e) { if (this.panel != null) this.panel.Close(); this.panel = null; }
public NewTextEditor(IThemeManager themeManager, ITextEditorSettings textEditorSettings) { this.themeManager = themeManager; this.textEditorSettings = textEditorSettings; this.textEditorSettings.PropertyChanged += TextEditorSettings_PropertyChanged; this.themeManager.ThemeChanged += ThemeManager_ThemeChanged; Options.AllowToggleOverstrikeMode = true; Options.RequireControlModifierForHyperlinkClick = false; UpdateColors(false); searchPanel = SearchPanel.Install(TextArea); searchPanel.RegisterCommands(this.CommandBindings); searchPanel.Localization = new AvalonEditSearchPanelLocalization(); TextArea.SelectionCornerRadius = 0; TextArea.PreviewKeyDown += TextArea_PreviewKeyDown; TextArea.InputBindings.Add(new KeyBinding(new RelayCommand(a => PageUp()), Key.PageUp, ModifierKeys.Control)); TextArea.InputBindings.Add(new KeyBinding(new RelayCommand(a => PageDown()), Key.PageDown, ModifierKeys.Control)); TextArea.InputBindings.Add(new KeyBinding(new RelayCommand(a => UpDownLine(false)), Key.Down, ModifierKeys.Control)); TextArea.InputBindings.Add(new KeyBinding(new RelayCommand(a => UpDownLine(true)), Key.Up, ModifierKeys.Control)); this.AddHandler(GotKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(OnGotKeyboardFocus), true); this.AddHandler(LostKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(OnLostKeyboardFocus), true); TextArea.MouseRightButtonDown += (s, e) => GoToMousePosition(); SetBinding(FontFamilyProperty, new Binding { Source = textEditorSettings, Path = new PropertyPath("FontFamily"), Mode = BindingMode.OneWay, }); SetBinding(FontSizeProperty, new Binding { Source = textEditorSettings, Path = new PropertyPath("FontSize"), Mode = BindingMode.OneWay, }); SetBinding(WordWrapProperty, new Binding { Source = textEditorSettings, Path = new PropertyPath("WordWrap"), Mode = BindingMode.OneWay, }); OnHighlightCurrentLineChanged(); OnShowLineNumbersChanged(); }
public SearchInputHandler(TextArea textArea) : base(textArea) { RegisterCommands(this.CommandBindings); panel = SearchPanel.Install(textArea); }
/// <summary> /// Creates a SearchPanel and installs it to the TextArea. /// </summary> public static SearchPanel Install(TextArea textArea) { if (textArea == null) throw new ArgumentNullException("textArea"); #pragma warning disable 618 SearchPanel panel = new SearchPanel(); panel.AttachInternal(textArea); panel.handler = new SearchInputHandler(textArea, panel); textArea.DefaultInputHandler.NestedInputHandlers.Add(panel.handler); return panel; }
private void SearchButton_Click(object sender, RoutedEventArgs e) { SearchPanel sPanel = new SearchPanel(); sPanel.Attach(SqlTextBox.TextArea); }
public TextEditor() { InitializeComponent(); editor = new AvalonEditorWPF(); attachWpfEditor(editor); ContextMenuStrip = contextMenuEditor; foldingManager = FoldingManager.Install(_.TextArea); searchPanel = SearchPanel.Install(_.TextArea); init(); }
void search_SearchOptionsChanged(object sender, SearchOptionsChangedEventArgs e) { searchPanel = sender as SearchPanel; }