public SearchService(IWpfTextView wpfTextView, ITextSearchService2 textSearchService2, ISearchSettings searchSettings, IMessageBoxManager messageBoxManager, ITextStructureNavigator textStructureNavigator, Lazy<IReplaceListenerProvider>[] replaceListenerProviders) { if (wpfTextView == null) throw new ArgumentNullException(nameof(wpfTextView)); if (textSearchService2 == null) throw new ArgumentNullException(nameof(textSearchService2)); if (searchSettings == null) throw new ArgumentNullException(nameof(searchSettings)); if (messageBoxManager == null) throw new ArgumentNullException(nameof(messageBoxManager)); if (textStructureNavigator == null) throw new ArgumentNullException(nameof(textStructureNavigator)); if (replaceListenerProviders == null) throw new ArgumentNullException(nameof(replaceListenerProviders)); this.wpfTextView = wpfTextView; this.textSearchService2 = textSearchService2; this.searchSettings = searchSettings; this.messageBoxManager = messageBoxManager; this.textStructureNavigator = textStructureNavigator; this.replaceListenerProviders = replaceListenerProviders; this.listeners = new List<ITextMarkerListener>(); this.searchString = string.Empty; this.replaceString = string.Empty; this.searchKind = SearchKind.None; this.searchControlPosition = SearchControlPosition.Default; wpfTextView.VisualElement.CommandBindings.Add(new CommandBinding(ApplicationCommands.Find, (s, e) => ShowFind())); wpfTextView.VisualElement.CommandBindings.Add(new CommandBinding(ApplicationCommands.Replace, (s, e) => ShowReplace())); wpfTextView.Closed += WpfTextView_Closed; UseGlobalSettings(true); }
void CloseSearchControl() { if (layer == null || layer.IsEmpty) { Debug.Assert(searchKind == SearchKind.None && searchControlPosition == SearchControlPosition.Default); return; } CleanUpIncrementalSearch(); layer.RemoveAllAdornments(); wpfTextView.LayoutChanged -= WpfTextView_LayoutChanged; findResultCollection = null; RefreshAllTags(); wpfTextView.VisualElement.Focus(); searchKind = SearchKind.None; searchControlPosition = SearchControlPosition.Default; SaveSettings(); }
void PositionSearchControl(SearchControlPosition position) { switch (position) { case SearchControlPosition.TopRight: searchControlPosition = position; PositionSearchControl(TopRightRect); break; case SearchControlPosition.BottomRight: searchControlPosition = position; PositionSearchControl(BottomRightRect); break; default: throw new InvalidOperationException(); } }
public PositionInfo(SearchControlPosition position, Rect rect) { Position = position; Rect = rect; IntersectsSpan = false; }
public SearchService(IWpfTextView wpfTextView, ITextSearchService2 textSearchService2, ISearchSettings searchSettings, IMessageBoxService messageBoxService, ITextStructureNavigator textStructureNavigator, Lazy<IReplaceListenerProvider>[] replaceListenerProviders, IEditorOperationsFactoryService editorOperationsFactoryService) { if (wpfTextView == null) throw new ArgumentNullException(nameof(wpfTextView)); if (textSearchService2 == null) throw new ArgumentNullException(nameof(textSearchService2)); if (searchSettings == null) throw new ArgumentNullException(nameof(searchSettings)); if (messageBoxService == null) throw new ArgumentNullException(nameof(messageBoxService)); if (textStructureNavigator == null) throw new ArgumentNullException(nameof(textStructureNavigator)); if (replaceListenerProviders == null) throw new ArgumentNullException(nameof(replaceListenerProviders)); this.wpfTextView = wpfTextView; editorOperations = editorOperationsFactoryService.GetEditorOperations(wpfTextView); this.textSearchService2 = textSearchService2; this.searchSettings = searchSettings; this.messageBoxService = messageBoxService; this.textStructureNavigator = textStructureNavigator; this.replaceListenerProviders = replaceListenerProviders; listeners = new List<ITextMarkerListener>(); searchString = string.Empty; replaceString = string.Empty; searchKind = SearchKind.None; searchControlPosition = SearchControlPosition.Default; wpfTextView.VisualElement.CommandBindings.Add(new CommandBinding(ApplicationCommands.Find, (s, e) => ShowFind())); wpfTextView.VisualElement.CommandBindings.Add(new CommandBinding(ApplicationCommands.Replace, (s, e) => ShowReplace())); wpfTextView.Closed += WpfTextView_Closed; UseGlobalSettings(true); }
void CloseSearchControl() { if (layer == null || layer.IsEmpty) { Debug.Assert(searchKind == SearchKind.None && searchControlPosition == SearchControlPosition.Default); return; } CancelAsyncSearch(); CleanUpIncrementalSearch(); layer.RemoveAllAdornments(); wpfHexView.LayoutChanged -= WpfHexView_LayoutChanged; wpfHexView.BufferLinesChanged -= WpfHexView_BufferLinesChanged; wpfHexView.Buffer.BufferSpanInvalidated -= Buffer_BufferSpanInvalidated; hexMarkerSearchService = null; RefreshAllTags(); wpfHexView.VisualElement.Focus(); searchKind = SearchKind.None; searchControlPosition = SearchControlPosition.Default; SaveSettings(); }
public HexViewSearchServiceImpl(WpfHexView wpfHexView, HexSearchServiceFactory hexSearchServiceFactory, SearchSettings searchSettings, IMessageBoxService messageBoxService, HexEditorOperationsFactoryService editorOperationsFactoryService) { if (wpfHexView == null) throw new ArgumentNullException(nameof(wpfHexView)); if (hexSearchServiceFactory == null) throw new ArgumentNullException(nameof(hexSearchServiceFactory)); if (searchSettings == null) throw new ArgumentNullException(nameof(searchSettings)); if (messageBoxService == null) throw new ArgumentNullException(nameof(messageBoxService)); if (editorOperationsFactoryService == null) throw new ArgumentNullException(nameof(editorOperationsFactoryService)); dataKinds = new ObservableCollection<DataKindVM>(dataKindVMList); selectedDataKindVM = dataKinds.First(); this.wpfHexView = wpfHexView; editorOperations = editorOperationsFactoryService.GetEditorOperations(wpfHexView); this.hexSearchServiceFactory = hexSearchServiceFactory; this.searchSettings = searchSettings; this.messageBoxService = messageBoxService; listeners = new List<IHexMarkerListener>(); searchString = string.Empty; replaceString = string.Empty; searchKind = SearchKind.None; searchControlPosition = SearchControlPosition.Default; wpfHexView.VisualElement.CommandBindings.Add(new CommandBinding(ApplicationCommands.Find, (s, e) => ShowFind())); wpfHexView.VisualElement.CommandBindings.Add(new CommandBinding(ApplicationCommands.Replace, (s, e) => ShowReplace())); wpfHexView.Closed += WpfHexView_Closed; UseGlobalSettings(true); }