コード例 #1
0
 /// <summary>
 /// On layout change add the adornment to any reformatted lines
 /// </summary>
 private void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
 {
     foreach (ITextViewLine line in e.NewOrReformattedLines)
     {
         this.CreateVisuals(line);
     }
 }
コード例 #2
0
 private void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
 {
     if (e.VerticalTranslation || e.NewOrReformattedLines.Count > 0)
     {
         ApplyNumbers();
     }
 }
コード例 #3
0
 void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e) {
   if (once && fooCounter > 10) {
     OnLayoutSettled(null, null);
     once = false;
   }
   fooCounter++;
 }
コード例 #4
0
        private void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
        {
            //Get all of the posts that intersect any of the new or reformatted lines of text.
            List<PostAdornment> newPosts = new List<PostAdornment>();

            //The event args contain a list of modified lines and a NormalizedSpanCollection of the spans of the modified lines.
            //Use the latter to find the posts that intersect the new or reformatted lines of text.
            foreach (Span span in e.NewOrReformattedSpans)
             {
                newPosts.AddRange(this.provider.GetPosts(new SnapshotSpan(this.view.TextSnapshot, span)));
            }

            //It is possible to get duplicates in this list if a post spanned 3 lines, and the first and last lines were modified but the middle line was not.
            //Sort the list and skip duplicates.
            newPosts.Sort(delegate(PostAdornment a, PostAdornment b) { return a.GetHashCode().CompareTo(b.GetHashCode()); });

            PostAdornment lastPost = null;
            foreach (PostAdornment post in newPosts)
            {
                if (post != lastPost)
                {
                    lastPost = post;
                    this.DrawPost(post);
                }
            }
        }
コード例 #5
0
        private void OnTextViewLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
        {
            CheckThread();

            var bufferToPreviousVisibleSpansLocal = this.bufferToPreviousVisibleSpans;
            var bufferToCurrentVisibleSpansLocal = new Dictionary<ITextBuffer, NormalizedSnapshotSpanCollection>(bufferToPreviousVisibleSpansLocal.Count);
            foreach (var subjectBuffer in bufferToPreviousVisibleSpansLocal.Keys)
            {
                bufferToCurrentVisibleSpansLocal.Add(subjectBuffer, ComputePossiblyVisibleSnapshotSpans(textView, subjectBuffer.CurrentSnapshot));
            }

            this.bufferToPreviousVisibleSpans = bufferToCurrentVisibleSpansLocal;

            var visibleSpansChanged = VisibleSpansChanged;
            if (visibleSpansChanged == null)
            {
                return;
            }

            foreach (var subjectBuffer in bufferToCurrentVisibleSpansLocal.Keys)
            {
                var previous = bufferToPreviousVisibleSpansLocal[subjectBuffer];
                var current = bufferToCurrentVisibleSpansLocal[subjectBuffer];

                if (previous != current)
                {
#pragma warning disable 618
                    visibleSpansChanged(this, new VisibleSpansChangedEventArgs(subjectBuffer, current));
#pragma warning restore 618
                }
            }
        }
コード例 #6
0
 private void CreateLineVisuals(TextViewLayoutChangedEventArgs e)
 {
     foreach (ITextViewLine line in e.NewOrReformattedLines)
     {
         this.CreateVisuals(line);
     }
 }
コード例 #7
0
ファイル: NewLineDisplay.cs プロジェクト: Yzzl/VsVim
 private void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
 {
     if (_vimAppOptions.DisplayNewLines)
     {
         CreateVisuals();
     }
 }
コード例 #8
0
        /// <summary>
        /// Handles whenever the text displayed in the view changes by adding the adornment to any reformatted lines
        /// </summary>
        /// <remarks><para>This event is raised whenever the rendered text displayed in the <see cref="ITextView"/> changes.</para>
        /// <para>It is raised whenever the view does a layout (which happens when DisplayTextLineContainingBufferPosition is called or in response to text or classification changes).</para>
        /// <para>It is also raised whenever the view scrolls horizontally or when its size changes.</para>
        /// </remarks>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        internal void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
        {
            var sensitiveSyntaxNodes = CollectSensitiveSyntaxNodes(e.NewSnapshot);
            var sensitiveTextSpans = GetTextSpans(sensitiveSyntaxNodes, e.NewSnapshot);

            CreateSensitiveCodeMarkerVisuals(sensitiveTextSpans, e.NewSnapshot);
        }
コード例 #9
0
ファイル: ScrollMap.cs プロジェクト: manojdjoshi/dnSpy
		void TextView_LayoutChanged(object sender, TextViewLayoutChangedEventArgs e) {
			bool update = false;
			if (e.OldViewState.ViewportHeight != e.NewViewState.ViewportHeight)
				update = true;
			if (IsWordWrap && e.OldViewState.ViewportWidth != e.NewViewState.ViewportWidth)
				update = true;
			if (update)
				UpdateCachedState();
		}
コード例 #10
0
 private void TextViewOnLayoutChanged(object sender, TextViewLayoutChangedEventArgs textViewLayoutChangedEventArgs)
 {
     // ReSharper disable once CompareOfFloatsByEqualityOperator
     if (_oldViewportTop != _textView.ViewportTop)
     {
         _oldViewportTop = _textView.ViewportTop;
         _translatedCanvas.RenderTransform = new TranslateTransform(0.0, -_textView.ViewportTop);
     }
     Update();
 }
コード例 #11
0
 void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e) {
   try {
     if (VSServiceProvider.Current.ExtensionHasFailed) return;
     _layoutChangedCounter++;
     if (_timer != null) {
       _timer.Interval = 2000;
       _timer.Enabled = true;
     }
   } catch (Exception exn) {
     VSServiceProvider.Current.Logger.PublicEntryException(exn, "OnLayoutChanged");
   }
 }
コード例 #12
0
 void TextView_LayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
 {
     if (wpfTextView != null && oldZoomLevel != wpfTextView.ZoomLevel)
     {
         oldZoomLevel = wpfTextView.ZoomLevel;
         HideToolTip();
     }
     if (e.HorizontalTranslation || e.VerticalTranslation)
     {
         HideToolTip();
     }
 }
コード例 #13
0
        private void OnTextViewLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
        {
            Parts parts = 0;

            if (e.NewViewState.EditSnapshot != e.OldViewState.EditSnapshot ||
                e.NewViewState.VisualSnapshot != e.OldViewState.VisualSnapshot)
            {
                parts |= Parts.TextContent;
            }

            Invalidate(parts);
        }
コード例 #14
0
        private void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
        {
            var isVisibleAreaChanged = IsVisibleAreaChanged(e);

            if (isVisibleAreaChanged && e.OldSnapshot != e.NewSnapshot)
            {
                return;
            }
            var textSnapshot = view.TextSnapshot;

            RepaintComplexity(textSnapshot);
        }
コード例 #15
0
        private void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
        {
            if (!IsEnabled)
            {
                return;
            }

            foreach (ITextViewLine line in e.NewOrReformattedLines)
            {
                UpdateLine(line);
            }
        }
コード例 #16
0
        private void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
        {
            if (TagsChanged == null || e.OldSnapshot == e.NewSnapshot)
            {
                return;
            }

            foreach (var span in e.NewOrReformattedSpans)
            {
                TagsChanged(this, new SnapshotSpanEventArgs(span));
            }
        }
コード例 #17
0
 private void OnTextViewLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
 {
     if ( this.theView != null ) {
     this.theView.LayoutChanged -= OnTextViewLayoutChanged;
     // we can't do anything here because the LayoutChanged
     // event fires while the view is still in layout
     // so attempting to scroll it will cause an exception.
     // Instead, fire a timer and check if the view is still in layout
     // before attempting the operation
     this.timer.Start();
       }
 }
コード例 #18
0
        /// <summary>
        /// On layout change add the adornment to any reformatted lines
        /// </summary>
        private void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
        {
            CoverageState[] currentFile = new CoverageState[0];
            ProfileVector   currentProf = new Data.ProfileVector(0);

            string activeFilename = GetActiveFilename();

            if (activeFilename != null)
            {
                Tuple <BitVector, ProfileVector> activeReport = null;
                DateTime activeFileLastWrite = File.GetLastWriteTimeUtc(activeFilename);

                var dataProvider = Data.ReportManagerSingleton.Instance(dte);
                if (dataProvider != null)
                {
                    var coverageData = dataProvider.UpdateData();
                    if (coverageData != null && activeFilename != null)
                    {
                        if (coverageData.FileDate >= activeFileLastWrite)
                        {
                            activeReport = coverageData.GetData(activeFilename);
                        }
                    }
                }

                if (activeReport != null)
                {
                    currentProf = activeReport.Item2;
                    currentFile = new CoverageState[activeReport.Item1.Count];

                    foreach (var item in activeReport.Item1.Enumerate())
                    {
                        if (item.Value)
                        {
                            currentFile[item.Key] = CoverageState.Covered;
                        }
                        else
                        {
                            currentFile[item.Key] = CoverageState.Uncovered;
                        }
                    }
                }
            }

            this.currentCoverage = currentFile;
            this.currentProfile  = currentProf;

            foreach (ITextViewLine line in e.NewOrReformattedLines)
            {
                HighlightCoverage(currentCoverage, currentProfile, line);
            }
        }
コード例 #19
0
    internal void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
    {
        var res = this.textDocumentFactory.TryGetTextDocument(this.view.TextBuffer, out this.TextDocument);

        if (res)
        {
            //this.TextDocument.FilePath;
        }
        else
        {
            //ERROR
        }
    }
コード例 #20
0
        private static bool IsVisibleAreaChanged(TextViewLayoutChangedEventArgs e)
        {
            ViewState newState             = e.NewViewState;
            ViewState oldState             = e.OldViewState;
            bool      isVisibleAreaChanged = newState.ViewportBottom == oldState.ViewportBottom &&
                                             newState.ViewportHeight == oldState.ViewportHeight &&
                                             newState.ViewportLeft == oldState.ViewportLeft &&
                                             newState.ViewportRight == oldState.ViewportRight &&
                                             newState.ViewportTop == oldState.ViewportTop &&
                                             newState.ViewportWidth == oldState.ViewportWidth;

            return(isVisibleAreaChanged);
        }
コード例 #21
0
ファイル: SearchService.cs プロジェクト: 331564533/dnSpy
		void WpfTextView_LayoutChanged(object sender, TextViewLayoutChangedEventArgs e) {
			Debug.Assert(IsSearchControlVisible);
			if (!IsSearchControlVisible)
				return;
			if (e.OldViewState.ViewportWidth != e.NewViewState.ViewportWidth)
				RepositionControl(true);
			else if (e.OldViewState.ViewportHeight != e.NewViewState.ViewportHeight)
				RepositionControl(true);
			if (e.OldSnapshot != e.NewSnapshot) {
				CancelIncrementalSearch();
				UpdateTextMarkerSearch();
			}
		}
 void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
 {
     IWpfTextView textView = (IWpfTextView)sender;
     if (e.OldSnapshot != e.NewSnapshot && e.OldSnapshot.Version.Changes.IncludesLineChanges)
     {
         this.alternatingLineColorLayer.RemoveAllAdornments();
         Refresh(textView, textView.TextViewLines);
     }
     else
     {
         Refresh(textView, e.NewOrReformattedLines);
     }
 }
コード例 #23
0
        //void OnViewportWidthChanged(object sender, EventArgs e)
        //{
        //    IWpfTextView textView = (IWpfTextView)sender;
        //    foreach (var r in this._highlightAdornmentLayer.Elements)
        //    {
        //        ((Rectangle)r.Adornment).Width = textView.ViewportWidth;
        //    }
        //}

        private void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
        {
            if (!(sender is IWpfTextView textView))
            {
                return;
            }

            // the ITextView disposes its ITextViewLineCollection and all the ITextViewLines it
            // contains every time it generates a new layout
            //...so we can't cache them.
            _highlightAdornmentLayer.RemoveAllAdornments();
            CreateLineInfos(textView, textView.TextViewLines);
        }
コード例 #24
0
        void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
        {
            SnapshotPoint caret = this.view.Caret.Position.BufferPosition;

            foreach (var line in e.NewOrReformattedLines)
            {
                if (line.ContainsBufferPosition(caret))
                {
                    this.CreateVisuals(line);
                    break;
                }
            }
        }
コード例 #25
0
 /// <summary>
 /// Handler for layout changed events.
 /// </summary>
 private void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
 {
     if (AnyTextChanges(e.OldViewState.EditSnapshot.Version, e.NewViewState.EditSnapshot.Version))
     {
         //There were text changes so we need to recompute possible matches
         this.UpdateMatches();
     }
     else
     {
         //No text changes so just redraw adornments from previous matches.
         this.RedrawAdornments(e.NewOrReformattedLines, e.NewViewState.ViewportLeft, e.NewViewState.ViewportRight);
     }
 }
コード例 #26
0
 private void OnTextViewLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
 {
     if (this.theView != null)
     {
         this.theView.LayoutChanged -= OnTextViewLayoutChanged;
         // we can't do anything here because the LayoutChanged
         // event fires while the view is still in layout
         // so attempting to scroll it will cause an exception.
         // Instead, fire a timer and check if the view is still in layout
         // before attempting the operation
         this.timer.Start();
     }
 }
コード例 #27
0
        private void OnTextViewLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
        {
            // get new visible span
            var visibleSpan = GetVisibleSpan(_TextView);

            if (visibleSpan == null || !visibleSpan.HasValue)
            {
                return;
            }

            // only if new visible span is different from old
            if (!_VisibleSpan.HasValue ||
                _VisibleSpan.Value.Start != visibleSpan.Value.Start ||
                _VisibleSpan.Value.End < visibleSpan.Value.End)
            {
                // invalidate new and/or old visible span
                List <Span> invalidSpans = new List <Span>();
                var         newSpan      = visibleSpan.Value;
                if (!_VisibleSpan.HasValue)
                {
                    invalidSpans.Add(newSpan);
                }
                else
                {
                    var oldSpan = _VisibleSpan.Value;
                    // invalidate two spans if old and new do not overlap
                    if (newSpan.Start > oldSpan.End || newSpan.End < oldSpan.Start)
                    {
                        invalidSpans.Add(newSpan);
                        invalidSpans.Add(oldSpan);
                    }
                    else
                    {
                        // invalidate one big span (old and new joined)
                        invalidSpans.Add(newSpan.Join(oldSpan));
                    }
                }

                _VisibleSpan = visibleSpan;

                // refresh tags
                foreach (var span in invalidSpans)
                {
                    if (CBETagPackage.CBEVisibilityMode != (int)CBEOptionPage.VisibilityModes.Always)
                    {
                        InvalidateSpan(span, false);
                    }
                }
            }
        }
コード例 #28
0
        void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
        {
            IWpfTextView textView = (IWpfTextView)sender;

            if (e.OldSnapshot != e.NewSnapshot && e.OldSnapshot.Version.Changes.IncludesLineChanges)
            {
                this.alternatingLineColorLayer.RemoveAllAdornments();
                Refresh(textView, textView.TextViewLines);
            }
            else
            {
                Refresh(textView, e.NewOrReformattedLines);
            }
        }
コード例 #29
0
 void textView_LayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
 {
     lock (_disposeLock)
     {
         if (!_disposed && e.NewSnapshot != e.OldSnapshot)
         {
             _lastCaretPosition = textView.Caret.Position;
             if (_timer != null)
             {
                 _timer.Change(Delay, Timeout.Infinite);
             }
         }
     }
 }
コード例 #30
0
 private void ViewLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
 {
     try {
         // If a new snapshot wasn't generated, then skip this layout
         if (e.NewSnapshot != e.OldSnapshot)
         {
             UpdateAtCaretPosition(View.Caret.Position);
         }
     }
     catch (Exception ec)
     {
         //MessageBox.Show("1 - e : " + ec.Message + " \r\n " + ec.StackTrace);
     }
 }
コード例 #31
0
        void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
        {
            visualManager.SetSnapshotAndUpdate(textView.TextSnapshot, e.NewOrReformattedLines, e.VerticalTranslation ? (IList <ITextViewLine>)textView.TextViewLines : e.TranslatedLines);

            var lines = refreshAllGlyphs ? (IList <ITextViewLine>)textView.TextViewLines : e.NewOrReformattedLines;

            foreach (var line in lines)
            {
                visualManager.RemoveGlyphsByVisualSpan(line.Extent);
                RefreshGlyphsOver(line);
            }

            refreshAllGlyphs = false;
        }
 /// <summary>
 /// Force an update if the view layout changes
 /// </summary>
 private void OnViewLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
 {
     // If a new snapshot is generated, clear the tooltip.
     if (e.NewViewState.EditSnapshot != e.OldViewState.EditSnapshot ||
         (_isTooltipShown && ActiveTagData.Current == null))
     {
         ClearTooltip();
     }
     else if (ActiveTagData.Current != null
              // if tooltip is not shown, or if the view port width changes.
              && (!_isTooltipShown || e.NewViewState.ViewportWidth != e.OldViewState.ViewportWidth))
     {
         ShowOrUpdateToolTip();
     }
 }
コード例 #33
0
        private void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
        {
            if (!IsInitialized)
            {
                CleanUp();
                CreateAdornment();
                IsInitialized = true;
            }

            // HACK: 5.3. OnLayoutChanged. レイアウトの変更イベント
            RightMarginAdornment?.OnLayoutChanged(sender, e);
            LineBreaksAdornment?.OnLayoutChanged(sender, e);
            LineIndicator?.OnLayoutChanged(sender, e);
            ColumnIndicator?.OnLayoutChanged(sender, e);
        }
        /// <summary>
        /// Handles whenever the text displayed in the view changes by adding the adornment to any reformatted lines.
        /// </summary>
        /// <remarks><para>This event is raised whenever the rendered text displayed in the <see cref="ITextView"/> changes.</para>
        /// <para>It is raised whenever the view does a layout (which happens when DisplayTextLineContainingBufferPosition is called or in response to text or classification changes).</para>
        /// <para>It is also raised whenever the view scrolls horizontally or when its size changes.</para>
        /// </remarks>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        internal async void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
        {
            try
            {
                var codeBlocks = await CollectBlockSyntaxNodesAsync(e.NewSnapshot);

                AnalyzeCodeBlockOccurrences(codeBlocks);
                CreateBackgroundVisualsForCodeBlocks();
            }
            catch
            {
                // [RS] Maybe we should handle this exception a bit more faithfully. For now, we ignore the exceptions here
                //      and wait for the next LayoutChanged event
            }
        }
コード例 #35
0
    //</Snippet9>

    //<Snippet10>
    private void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
    {
        ITextSnapshot snapshot = e.NewSnapshot;

        //don't do anything if this is just a change in case
        if (!snapshot.GetText().ToLower().Equals(e.OldSnapshot.GetText().ToLower()))
        {
            SnapshotSpan span = new SnapshotSpan(snapshot, new Span(0, snapshot.Length));
            EventHandler <SnapshotSpanEventArgs> handler = this.TagsChanged;
            if (handler != null)
            {
                handler(this, new SnapshotSpanEventArgs(span));
            }
        }
    }
コード例 #36
0
        void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
        {
            // If the view did a vertical translation then we can generally assume the screen position of every line changed.
            _visualManager.SetSnapshotAndUpdate(
                _textView.TextSnapshot,
                e.NewOrReformattedLines,
                e.VerticalTranslation ? ((IList <ITextViewLine>)_textView.TextViewLines) : e.TranslatedLines
                );

            foreach (ITextViewLine line in e.NewOrReformattedLines)
            {
                _visualManager.RemoveGlyphsByVisualSpan(line.Extent);
                RefreshGlyphsOver(line);
            }
        }
コード例 #37
0
        /// <summary>
        /// Handles whenever the text displayed in the view changes by adding the adornment to any reformatted lines.
        /// </summary>
        /// <remarks><para>This event is raised whenever the rendered text displayed in the <see cref="ITextView"/> changes.</para>
        /// <para>It is raised whenever the view does a layout (which happens when DisplayTextLineContainingBufferPosition is called or in response to text or classification changes).</para>
        /// <para>It is also raised whenever the view scrolls horizontally or when its size changes.</para>
        /// </remarks>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        internal async void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
        {
            try
            {
                var methodDeclarations = await CollectMethodDeclarationSyntaxNodes(e.NewSnapshot);

                AnalyzeAndCacheLongMethodOccurrences(methodDeclarations);
                CreateVisualsForLongMethods();
            }
            catch
            {
                // [RS] Maybe we should handle this exception a bit more faithfully. For now, we ignore the exceptions here
                //      and wait for the next LayoutChanged event
            }
        }
コード例 #38
0
        private void View_LayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
        {
            if (textDocument == null && textDocumentFactory.TryGetTextDocument(view.TextBuffer, out textDocument))
            {
                fileExtension = Path.GetExtension(textDocument.FilePath);

                RefreshSettings();
                if (generalSettings.ExcludedFileTypesList.Contains(fileExtension))
                {
                    streakCounterAdornment.Cleanup(adornmentLayer, view);
                    screenShakeAdornment.Cleanup(adornmentLayer, view);
                    particlesAdornment.Cleanup(adornmentLayer, view);
                }
            }
        }
コード例 #39
0
        /// <summary>
        /// On layout change add the adornment and tags to any reformatted lines
        /// </summary>
        private void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
        {
            var spans = GetWhitespace(e.NewOrReformattedLines);

            RenderVisuals(spans, e.NewSnapshot);

            // signal that tags need changing, with the old (removed) and the new (added) spans
            if (TagsChanged != null)
            {
                foreach (var span in spans)
                {
                    TagsChanged(this, new SnapshotSpanEventArgs(span));
                }
            }
        }
コード例 #40
0
 // Step 4: The event handlers both call the UpdateAtCaretPosition method.
 void ViewLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
 {
     // If a new snapshot wasn't generated, then skip this layout 
     if (e.NewSnapshot != e.OldSnapshot)
     {
         UpdateAtCaretPosition(View.Caret.Position);
         string thisFile = VerilogLanguage.VerilogGlobals.GetDocumentPath(View.TextSnapshot);
         //VerilogGlobals.ParseStatus_EnsureExists(thisFile);
         //VerilogGlobals.ParseStatus[thisFile].NeedReparse = true;
         // VerilogGlobals.ParseStatus_NeedReparse_SetValue(thisFile, true);
         ParseStatusController.NeedReparse_SetValue(thisFile, true);
         //VerilogGlobals.NeedReparse = true;
         VerilogGlobals.Reparse(SourceBuffer, thisFile);
     }
 }
コード例 #41
0
        private void HandleLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
        {
            SnapshotSpan visibleSpan = this.view.TextViewLines.FormattedSpan;

            // Filter out the adornments that are no longer visible.
            List <SnapshotSpan> toRemove = new List <SnapshotSpan>(
                from keyValuePair
                in this.adornmentCache
                where !keyValuePair.Key.TranslateTo(visibleSpan.Snapshot, SpanTrackingMode.EdgeExclusive).IntersectsWith(visibleSpan)
                select keyValuePair.Key);

            foreach (var span in toRemove)
            {
                this.adornmentCache.Remove(span);
            }
        }
コード例 #42
0
 void TextView_LayoutChanged(object?sender, TextViewLayoutChangedEventArgs e)
 {
     if (useDisplayMode != wpfTextViewHost.TextView.FormattedLineSource.UseDisplayMode)
     {
         OnTextPropertiesChanged();
     }
     if (e.VerticalTranslation)
     {
         SetTop(textLayer, -e.NewViewState.ViewportTop);
     }
     if (e.OldViewState.ViewportHeight != e.NewViewState.ViewportHeight)
     {
         UpdateLineNumberLayerSize();
     }
     UpdateLines(e.NewOrReformattedLines, e.TranslatedLines);
 }
コード例 #43
0
		void WpfTextView_LayoutChanged(object sender, TextViewLayoutChangedEventArgs e) {
			if (Width != wpfTextView.VisualElement.ActualWidth || Height != wpfTextView.VisualElement.ActualHeight) {
				Width = wpfTextView.VisualElement.ActualWidth;
				Height = wpfTextView.VisualElement.ActualHeight;
				if (layerKind == LayerKind.Normal) {
					// Needed when HW acceleration isn't enabled (virtual machine or remote desktop).
					// https://msdn.microsoft.com/en-us/library/system.windows.media.visual.visualscrollableareaclip(VS.100).aspx
					// It's ignored if HW acceleration is enabled.
					// This will reduce the number of bytes sent over the network and should speed up the display
					// if it's a slow connection.
					VisualScrollableAreaClip = new Rect(0, 0, Width, Height);
				}
			}

			if (layerKind == LayerKind.Normal) {
				foreach (var layer in adornmentLayers)
					layer.OnLayoutChanged(e);
			}
		}
コード例 #44
0
        private void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e) {
            if (_layer.TextView.ViewportRight > _lastWidth) {
                // View width has changed - reprocess the entire view
                OnViewWidthChanged();
                return;
            }

            if (_reprocessFrom >= 0) {
                for (int i = 0; i < _view.TextViewLines.Count; i++) {
                    var line = _view.TextViewLines[i];
                    if (_reprocessFrom > line.End.Position) {
                        continue;
                    }
                    ProcessLine(line);
                }
                _reprocessFrom = -1;
            } else {
                foreach (var line in e.NewOrReformattedLines) {
                    ProcessLine(line);
                }
            }
        }
コード例 #45
0
        void ViewLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
        {
            IWpfTextView view = sender as IWpfTextView;
            var adornmentLayer = view.GetAdornmentLayer("HighlightLines");

            foreach (var line in e.NewOrReformattedLines)
            {
                if (line.Extent.GetText().StartsWith("logger.", StringComparison.OrdinalIgnoreCase))
                {
                    Rectangle rect = new Rectangle()
                        {
                            Width = view.ViewportWidth + view.MaxTextRightCoordinate,
                            Height = line.Height,
                            Fill = Brushes.AliceBlue
                        };

                    Canvas.SetTop(rect, line.Top);
                    Canvas.SetLeft(rect, 0);
                    adornmentLayer.AddAdornment(line.Extent, null, rect);
                }
            }
        }
コード例 #46
0
            private void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
            {
                _foregroundObject.AssertIsForeground();
                // The formatted span refers to the span of the textview's buffer that is visible.
                // If it changes, then we want to reclassify.  Note: the span might not change if
                // text were overwritten.  However, in the case of text-edits, we'll hear about 
                // through other means as we have an EventSource for that purpose.  This event
                // source is for knowing if the user moves the view around.  This handles direct
                // moves using the caret/scrollbar, as well as moves that happen because someone
                // jumped directly to a location using goto-def.  It also handles view changes
                // caused by the user collapsing an outlining region.

                var lastSpan = _span;
                var lastViewTextSnapshot = _viewTextSnapshot;
                var lastViewVisualSnapshot = _viewVisualSnapshot;

                _span = _textView.TextViewLines.FormattedSpan.Span;
                _viewTextSnapshot = _textView.TextSnapshot;
                _viewVisualSnapshot = _textView.VisualSnapshot;

                if (_span != lastSpan)
                {
                    // The span changed.  This could have happened for a few different reasons.  
                    // If none of the view's text snapshots changed, then it was because of scrolling.

                    if (_viewTextSnapshot == lastViewTextSnapshot &&
                        _viewVisualSnapshot == lastViewVisualSnapshot)
                    {
                        // We scrolled.
                        RaiseChanged(_scrollChangeDelay);
                    }
                    else
                    {
                        // text changed in some way.
                        RaiseChanged(_textChangeDelay);
                    }
                }
            }
コード例 #47
0
 /// <summary>
 /// A layout change will occur when tags are changed in the ITextBuffer.  We use it as a clue that 
 /// we need to look for external edit tags on markers
 /// </summary>
 private void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
 {
     QueueCheck(CheckKind.Markers);
 }
コード例 #48
0
ファイル: SearchService.cs プロジェクト: manojdjoshi/dnSpy
		void WpfTextView_LayoutChanged(object sender, TextViewLayoutChangedEventArgs e) {
			Debug.Assert(IsSearchControlVisible);
			if (!IsSearchControlVisible)
				return;
			if (e.OldViewState.ViewportWidth != e.NewViewState.ViewportWidth)
				RepositionControl(true);
			else if (e.OldViewState.ViewportHeight != e.NewViewState.ViewportHeight)
				RepositionControl(true);
			if (e.OldSnapshot != e.NewSnapshot) {
				CancelIncrementalSearch();
				UpdateTextMarkerSearch();
			}
		}
コード例 #49
0
 /// <summary>
 /// Layout Update
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void textView_LayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
 {
     this.ParseFile();
 }
コード例 #50
0
        private void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
        {
            foreach (var item in e.NewOrReformattedLines)
            {
                if (item.GetText().ToLower().Contains("approve"))
                    break;
            }

            foreach (var item in e.NewOrReformattedSpans)
            {

                if (item.GetText().ToLower().Contains("approve"))
                    break;
            }
            //List<ImageAdornment> imageAdornmentsToBeShown = new List<ImageAdornment>();

            //// Detect which images should be shown again based on the new or reformatted spans
            //foreach (Span span in e.NewOrReformattedSpans)
            //{
            //    imageAdornmentsToBeShown.AddRange(this.ImagesAdornmentsRepository.Images.Where(image => image.TrackingSpan.GetSpan(this.View.TextSnapshot).OverlapsWith(span)));
            //}

            //foreach (ImageAdornment imageAdornment in imageAdornmentsToBeShown)
            //{
            //    SnapshotSpan imageSnaphotSpan = imageAdornment.TrackingSpan.GetSpan(this.View.TextSnapshot);
            //    // Get the text view line associated with the image span
            //    ITextViewLine newOrReformattedLine = e.NewOrReformattedLines.FirstOrDefault(line =>
            //        line.ContainsBufferPosition(imageSnaphotSpan.Start) && line.ContainsBufferPosition(imageSnaphotSpan.End));
            //    if (newOrReformattedLine != null)
            //    {
            //        // Use the top of the text view line to set image top location. And finally adjust the final location using the delta Y.
            //        Canvas.SetTop(imageAdornment.VisualElement, newOrReformattedLine.Top + imageAdornment.TextViewLineDelta.Y);
            //        Show(imageAdornment, newOrReformattedLine);
            //    }
            //}
        }
コード例 #51
0
ファイル: ColorAdornment.cs プロジェクト: mhusen/Eto
		/// <summary>
		/// On layout change add the adornment to any reformatted lines
		/// </summary>
		void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
		{
			if (hasUsing == null)
				UpdateUsing();

			foreach (ITextViewLine line in e.NewOrReformattedLines)
			{
				if (usingSpan.IntersectsWith(Span.FromBounds(line.Start, line.End)))
					UpdateUsing();
				CreateVisuals(line);
			}
		}
コード例 #52
0
		void TextView_LayoutChanged(object sender, TextViewLayoutChangedEventArgs e) {
			if (e.OldSnapshot != e.NewSnapshot)
				SetNewSelection();
			else if (e.NewOrReformattedLines.Count > 0 || e.TranslatedLines.Count > 0 || e.VerticalTranslation)
				SetNewSelection();
		}
コード例 #53
0
        private void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
        {
            List<ITextViewLine> lines = new List<ITextViewLine>();
            foreach (ITextViewLine line in e.NewOrReformattedLines)
                lines.Add(line);
            if (lines.Count > 0 && lines[0].Start.Position > 0)
            {
                lines.Insert(0, _view.GetTextViewLineContainingBufferPosition(new SnapshotPoint(lines[0].Snapshot, lines[0].Start.Position - 1)));
            }

            foreach (ITextViewLine line in lines)
            {
                int lookahead = 2;
                ITextViewLine nextLine = line;
                while (lookahead >= 0 && nextLine != null && !this.CreateVisuals(line, nextLine))
                {
                    lookahead--;
                    try
                    {
                        ITextViewLine oldNextLine = nextLine;
                        nextLine = _view.GetTextViewLineContainingBufferPosition(new SnapshotPoint(nextLine.Snapshot, nextLine.EndIncludingLineBreak));
                        if (oldNextLine == nextLine)
                            nextLine = null;

                        // Check to see if a new comment starts at the beginning of the line
                        string start = nextLine.Snapshot.GetText(new Span(nextLine.Start.Position, 2));
                        if (start == "//" || start == "/*")
                            nextLine = null;
                    }
                    catch { nextLine = null; }
                }
            }
        }
コード例 #54
0
 /// <summary>
 /// On layout change figure out where all the colours are
 /// </summary>
 private void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
 {
     /*
      * #(([0-9A-F]{6})|([0-9A-F]{8})|([0-9A-F]{3}))[\"<;]
      * starts with #
      * has 6 xor 8 xor 3 characters which match a hexidecimal digit
      * ends with ", < or ;
      */
     _colourPositions = new List<Tuple<int, int, Color>>();
     var matches = Regex.Matches(_view.TextSnapshot.GetText(), "#(([0-9A-F]{6})|([0-9A-F]{8})|([0-9A-F]{3}))[\"<;]", RegexOptions.IgnoreCase);
     foreach(var m in matches)
     {
         var match = m as Match;
         var mgrp = match.Groups[1] as Group;
         var colourbytes = BytesFromColourString(mgrp.Value);
         var colour = Color.FromArgb(colourbytes.Item1, colourbytes.Item2, colourbytes.Item3, colourbytes.Item4);
         _colourPositions.Add(new Tuple<int,int,Color>(mgrp.Index, mgrp.Index + mgrp.Length, colour));
     }
 }
コード例 #55
0
		void TextView_LayoutChanged(object sender, TextViewLayoutChangedEventArgs e) {
			if (wpfTextView != null && oldZoomLevel != wpfTextView.ZoomLevel) {
				oldZoomLevel = wpfTextView.ZoomLevel;
				HideToolTip();
			}
			if (e.HorizontalTranslation || e.VerticalTranslation)
				HideToolTip();
		}
コード例 #56
0
 private void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e) {
     if (_layer.TextView.ViewportRight > _lastWidth) {
         _lastWidth = _layer.TextView.ViewportRight + 100;
         Redraw();
     } else if (e.NewOrReformattedLines.Any()) {
         Redraw();
     }
 }
コード例 #57
0
 private void RefreshDiffViewModelPositions(bool approximate, TextViewLayoutChangedEventArgs e)
 {
     foreach (var diffViewModel in DiffViewModels)
         diffViewModel.RefreshPosition(approximate, e);
 }
コード例 #58
0
        private void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
        {
            RefreshDiffViewModelPositions(true, e);

            Action action = RefreshDiffViewModelPositions;
            _margin.VisualElement.Dispatcher.BeginInvoke(action, DispatcherPriority.ApplicationIdle);
        }
コード例 #59
0
        /// <summary>
        /// On layout change add the adornment to any reformatted lines.
        /// </summary>
        /// <param name="sender">
        /// Oggetto che lancia l'evento.
        /// </param>
        /// <param name="e">
        /// Parametri dell'evento.
        /// </param>
        private void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
        {
            // ottimizzazione! controllo i prerequisiti
            if (!Enable || Violations == null || Violations.Count == 0)
            {
                return;
            }

            // check for active document
            if (AlmaStyleFixPackage.Dte == null)
            {
                return;        // noDTE
            }

            var theDoc = AlmaStyleFixPackage.Dte.ActiveDocument;
            if (theDoc == null)
            {
                return;         // no Document
            }

            var filePath = theDoc.FullName;
            if (!Violations.ContainsKey(filePath))
            {
                return;         // no violations
            }

            this.SetColor();     // set highLighter con ultime impostazioni
            foreach (ITextViewLine line in e.NewOrReformattedLines)
            {
                this.CreateVisuals(line, filePath);
            }
        }
コード例 #60
0
		void TextView_LayoutChanged(object sender, TextViewLayoutChangedEventArgs e) {
			if (useDisplayMode != wpfTextViewHost.TextView.FormattedLineSource.UseDisplayMode)
				OnTextPropertiesChanged();
			if (e.VerticalTranslation)
				SetTop(textLayer, -e.NewViewState.ViewportTop);
			if (e.OldViewState.ViewportHeight != e.NewViewState.ViewportHeight)
				UpdateLineNumberLayerSize();
			UpdateLines(e.NewOrReformattedLines, e.TranslatedLines);
		}