public UCText( ) { InitializeComponent( ); ChangeEventHelper = new ChangeEventHelper(this.rtb); UndoRedoHelper = new UndoRedoHelper(this.rtb); WhitespaceAdorner = new WhitespaceAdorner(rtb, ChangeEventHelper); LocalUnderliningAdorner = new UnderliningAdorner(rtb); ExternalUnderliningAdorner = new UnderliningAdorner(rtb); NormalStyleInfo = new StyleInfo("TextNormal"); HighlightStyleInfos = new[] { new StyleInfo("MatchHighlight_0"), new StyleInfo("MatchHighlight_1"), new StyleInfo("MatchHighlight_2") }; RecolouringLoop = new ResumableLoop(RecolouringThreadProc, 333, 555); LocalUnderliningLoop = new ResumableLoop(LocalUnderliningThreadProc, 222, 444); ExternalUnderliningLoop = new ResumableLoop(ExternalUnderliningThreadProc, 333, 555); pnlDebug.Visibility = Visibility.Collapsed; #if !DEBUG pnlDebug.Visibility = Visibility.Collapsed; #endif //WhitespaceAdorner.IsDbgDisabled = true; //LocalUnderliningAdorner.IsDbgDisabled = true; //ExternalUnderliningAdorner.IsDbgDisabled = true; }
public TextBox() { var horizontalScrollBarVisibility = Observable.CombineLatest( this.GetObservable(AcceptsReturnProperty), this.GetObservable(TextWrappingProperty), (acceptsReturn, wrapping) => { if (acceptsReturn) { return(wrapping == TextWrapping.NoWrap ? ScrollBarVisibility.Auto : ScrollBarVisibility.Disabled); } else { return(ScrollBarVisibility.Hidden); } }); Bind( ScrollViewer.HorizontalScrollBarVisibilityProperty, horizontalScrollBarVisibility, BindingPriority.Style); _undoRedoHelper = new UndoRedoHelper <UndoRedoState>(this); }
public TextBox() { this.GetObservable(TextWrappingProperty) .Select(x => x == TextWrapping.NoWrap) .Subscribe(x => CanScrollHorizontally = x); var horizontalScrollBarVisibility = this.GetObservable(AcceptsReturnProperty) .Select(x => x ? ScrollBarVisibility.Auto : ScrollBarVisibility.Hidden); Bind( ScrollViewer.HorizontalScrollBarVisibilityProperty, horizontalScrollBarVisibility, BindingPriority.Style); _undoRedoHelper = new UndoRedoHelper <UndoRedoState>(this); }
public TextBox() { var canScrollHorizontally = GetObservable(AcceptsReturnProperty) .Select(x => !x); Bind( ScrollViewer.CanScrollHorizontallyProperty, canScrollHorizontally, BindingPriority.Style); var horizontalScrollBarVisibility = GetObservable(AcceptsReturnProperty) .Select(x => x ? ScrollBarVisibility.Auto : ScrollBarVisibility.Hidden); Bind( ScrollViewer.HorizontalScrollBarVisibilityProperty, horizontalScrollBarVisibility, BindingPriority.Style); _undoRedoHelper = new UndoRedoHelper <UndoRedoState>(this); }
public void UpdateItemsSource() { if (RecipeItemsSource != null) { _lastSelectedNode = null; _mRecipe = RecipeItemsSource; if (_undoRedoHelper?.IsPaused != true) { _undoRedoHelper = new UndoRedoHelper <MRecipe>(ref _mRecipe); MRecipe.BeginGetNodes(_mRecipe, (baseNode) => { _undoRedoHelper.SaveStateOnPropertyChange(baseNode); }); _undoRedoHelper.SaveState(); } NotifyPropertyChanged(nameof(MRecipe)); } }
public UCPattern( ) { InitializeComponent( ); ChangeEventHelper = new ChangeEventHelper(this.rtb); UndoRedoHelper = new UndoRedoHelper(this.rtb); WhitespaceAdorner = new WhitespaceAdorner(rtb, ChangeEventHelper); PatternNormalStyleInfo = new StyleInfo("PatternNormal"); PatternParaHighlightStyleInfo = new StyleInfo("PatternParaHighlight"); PatternGroupNameStyleInfo = new StyleInfo("PatternGroupName"); PatternEscapeStyleInfo = new StyleInfo("PatternEscape"); PatternCharGroupBracketHighlightStyleInfo = new StyleInfo("PatternCharGroupHighlight"); PatternRangeCurlyBraceHighlightStyleInfo = PatternCharGroupBracketHighlightStyleInfo; PatternCommentStyleInfo = new StyleInfo("PatternComment"); RecolouringLoop = new ResumableLoop(RecolouringThreadProc, 222, 444); HighlightingLoop = new ResumableLoop(HighlightingThreadProc, 111, 444); //WhitespaceAdorner.IsDbgDisabled = true; }
public TextBox() { var horizontalScrollBarVisibility = Observable.CombineLatest( this.GetObservable(AcceptsReturnProperty), this.GetObservable(TextWrappingProperty), (acceptsReturn, wrapping) => { if (wrapping != TextWrapping.NoWrap) { return(ScrollBarVisibility.Disabled); } return(acceptsReturn ? ScrollBarVisibility.Auto : ScrollBarVisibility.Hidden); }); this.Bind( ScrollViewer.HorizontalScrollBarVisibilityProperty, horizontalScrollBarVisibility, BindingPriority.Style); _undoRedoHelper = new UndoRedoHelper <UndoRedoState>(this); _selectedTextChangesMadeSinceLastUndoSnapshot = 0; _hasDoneSnapshotOnce = false; UpdatePseudoclasses(); }