public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { if (tag == null || !(tag is ToDoTag)) { return(null); } ToDoTag tags = tag as ToDoTag; if (tags.HightText == "todo") { return(new Ellipse { Fill = Brushes.Orange, StrokeThickness = 1.2, Stroke = Brushes.OrangeRed, Height = _height, Width = _width }); } else { return(new Rectangle { //Fill = new SolidColorBrush(Colors.GreenYellow), Fill = new SolidColorBrush(Colors.DarkOrchid), StrokeThickness = 1.0, Stroke = Brushes.Black, Height = _height, Width = _width }); } }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { // Ensure we can draw a glyph for this marker. if (tag == null || !(tag is ClippyTag)) { return(null); } var clippy = tag as ClippyTag; // Debug.WriteLine("Creating Glyph: " + clippy.GetDefinition().Line); //Debug.WriteLine("Drawing Glyph: {0} - {1}", clippy.GetDefinition().Line, clippy.GetDefinition().Type); var grid = clippy.GetEllipses(); //grid.SetValue(Grid.ZIndexProperty, 999); ////grid.AddHandler(new RoutedEvent().HandlerType == ) //grid.AddHandler(Grid.ContextMenuOpeningEvent, new RoutedEventHandler(OnOpen)); //grid.AddHandler(Grid.PreviewMouseRightButtonUpEvent, new RoutedEventHandler(OnOpen)); return(grid); }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { // Ensure we can draw a glyph for this marker. if (tag == null || !(tag is ClippyTag)) { return null; } var clippy = tag as ClippyTag; // Debug.WriteLine("Creating Glyph: " + clippy.GetDefinition().Line); //Debug.WriteLine("Drawing Glyph: {0} - {1}", clippy.GetDefinition().Line, clippy.GetDefinition().Type); var grid = clippy.GetEllipses(); //grid.SetValue(Grid.ZIndexProperty, 999); ////grid.AddHandler(new RoutedEvent().HandlerType == ) //grid.AddHandler(Grid.ContextMenuOpeningEvent, new RoutedEventHandler(OnOpen)); //grid.AddHandler(Grid.PreviewMouseRightButtonUpEvent, new RoutedEventHandler(OnOpen)); return grid; }
/// <summary> /// Create the glyph element. /// </summary> /// <param name="line">Editor line to create the glyph for.</param> /// <param name="tag">The corresponding tag.</param> /// <returns></returns> public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { // get the coverage info for the current line LineCoverageState state = GetLineCoverageState(line); // no coverage info found -> exit here if (state == LineCoverageState.Unknown) { return(null); } var brush = GetBrushForState(state); if (brush == null) { return(null); } System.Windows.Shapes.Ellipse ellipse = new Ellipse(); ellipse.Fill = brush; ellipse.Height = _glyphSize; ellipse.Width = _glyphSize; ellipse.ToolTip = GetToolTipText(state); if (state == LineCoverageState.Partly) { ellipse.MouseEnter += OnGlyphMouseEnter; ellipse.MouseLeave += OnGlyphMouseLeave; ellipse.Tag = line; } return(ellipse); }
public UIElement?GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { if (tag is not InheritanceMarginTag inheritanceMarginTag) { return(null); } // The life cycle of the glyphs in Indicator Margin is controlled by the editor, // so in order to get the glyphs removed when FeatureOnOffOptions.InheritanceMarginCombinedWithIndicatorMargin is off, // we need // 1. Generate tags when this option changes. // 2. Always return null here to force the editor to remove the glyphs. if (!_globalOptions.GetOption(FeatureOnOffOptions.InheritanceMarginCombinedWithIndicatorMargin)) { return(null); } if (_textView.TextBuffer.GetWorkspace() == null) { return(null); } var membersOnLine = inheritanceMarginTag.MembersOnLine; Contract.ThrowIfTrue(membersOnLine.IsEmpty); return(new InheritanceMarginGlyph( _threadingContext, _streamingFindUsagesPresenter, _classificationTypeMap, _classificationFormatMap, _operationExecutor, inheritanceMarginTag, _textView, _listener)); }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { ErrorGlyphTag errorDetails = tag as ErrorGlyphTag; if (errorDetails == null) { return(null); } BitmapImage glyphImage = null; switch (errorDetails.ErrorLevel) { case vsBuildErrorLevel.vsBuildErrorLevelHigh: glyphImage = _errorIcon; break; case vsBuildErrorLevel.vsBuildErrorLevelMedium: glyphImage = _warningIcon; break; case vsBuildErrorLevel.vsBuildErrorLevelLow: glyphImage = _infoIcon; break; } Image glyphIcon = new Image(); glyphIcon.Width = 16; glyphIcon.Height = 16; glyphIcon.Source = glyphImage; return(glyphIcon); }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { if (tag == null || !(tag is Tag)) { return(null); } var digit = new TextBlock(); digit.Text = (tag as Tag).Number.ToString(); digit.FontFamily = new FontFamily("Verdana"); digit.FontSize = 12; digit.FontWeight = FontWeights.ExtraBold; digit.HorizontalAlignment = HorizontalAlignment.Center; digit.VerticalAlignment = VerticalAlignment.Center; digit.Width = _GlyphSize; digit.Height = _GlyphSize; digit.Foreground = new SolidColorBrush(GetCurrentThemeColor()); VSColorTheme.ThemeChanged += (e) => { digit.Foreground = new SolidColorBrush(GetCurrentThemeColor()); }; return(digit); }
/// <summary> /// Create the glyph element. /// </summary> /// <param name="line">Editor line to create the glyph for.</param> /// <param name="tag">The corresponding tag.</param> /// <returns></returns> public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { // get the coverage info for the current line LineCoverageState state = GetLineCoverageState(line); // no coverage info found -> exit here if (state == LineCoverageState.Unknown) return null; var brush = GetBrushForState(state); if (brush == null) return null; System.Windows.Shapes.Ellipse ellipse = new Ellipse(); ellipse.Fill = brush; ellipse.Height = _glyphSize; ellipse.Width = _glyphSize; ellipse.ToolTip = GetToolTipText(state); if (state == LineCoverageState.Partly) { ellipse.MouseEnter += OnGlyphMouseEnter; ellipse.MouseLeave += OnGlyphMouseLeave; ellipse.Tag = line; } return ellipse; }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { try { // Ensure we can draw a glyph for this marker.) if (tag == null || !(tag is RiskTag)) { return null; } var riskTag = tag as RiskTag; MarginUIElement element; if (riskTag.Signature.StringSignature == null) return null; if (cache.TryGetValue(riskTag.Signature.StringSignature, out element)) { element.Detach(); } var g = new MarginUIElement(riskTag, line); g.Height = _glyphSize; g.Width = _glyphSize; g.SetUIElements(); cache.Remove(riskTag.Signature.StringSignature); cache.Add(riskTag.Signature.StringSignature, g); return g; } catch (Exception exception) { Logger.Write("RiskGlyphFactory Exception"); Logger.Write(exception); return null; } }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { var docTag = tag as DocumentationTag; var documentedText = (docTag.TrackingSpan.GetText(docTag.TextBuffer.CurrentSnapshot)); var numOfLines = documentedText.Split('\n').Count(); var lineHeight = line.Height; var grid = new System.Windows.Controls.Grid() { Width = lineHeight, Height = lineHeight * numOfLines }; var rectangle = new Rectangle() { Fill = new SolidColorBrush(Color.FromRgb(240, 222, 2)), Stroke = Brushes.Gray, Width = lineHeight / 3, Height = lineHeight * numOfLines, HorizontalAlignment = HorizontalAlignment.Right }; grid.Children.Add(rectangle); return(grid); }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { NumberedBookmarkTag nTag = tag as NumberedBookmarkTag; // Ensure we can draw a glyph for this marker. if (nTag == null) { return(null); } Border b = new Border(); b.Background = Brushes.LightBlue; b.CornerRadius = new CornerRadius(4); b.BorderThickness = new Thickness(1.0); b.BorderBrush = Brushes.DarkBlue; b.Width = 12; b.Height = m_glyphSize; b.Child = new TextBlock() { Text = nTag.Numbers.First().ToString(), HorizontalAlignment = HorizontalAlignment.Center }; //if more than one number on same line, add a shadow if (nTag.Numbers.Length > 1) { var effect = new DropShadowEffect(); effect.BlurRadius = 3; effect.Direction = 0; effect.ShadowDepth = 3; effect.Color = Colors.LightBlue; b.Effect = effect; b.ToolTip = string.Format("There is several bookmarks at this line : {0}", string.Join("..", nTag.Numbers.Select(x => x.ToString()))); } return(b); }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { try { // Ensure we can draw a glyph for this marker.) if (tag == null || !(tag is RiskTag)) { return(null); } var riskTag = tag as RiskTag; MarginUIElement element; if (riskTag.Signature.StringSignature == null) { return(null); } if (cache.TryGetValue(riskTag.Signature.StringSignature, out element)) { element.Detach(); } var g = new MarginUIElement(riskTag, line); g.Height = _glyphSize; g.Width = _glyphSize; g.SetUIElements(); cache.Remove(riskTag.Signature.StringSignature); cache.Add(riskTag.Signature.StringSignature, g); return(g); } catch (Exception exception) { Logger.Write("RiskGlyphFactory Exception"); Logger.Write(exception); return(null); } }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { ScoreGlyphTag scoreTag = tag as ScoreGlyphTag; if (scoreTag == null) { return(null); } var lineHeight = line.Height; var grid = new System.Windows.Controls.Grid() { Width = lineHeight, Height = lineHeight }; grid.Children.Add(new Rectangle() { Fill = Common.Colors.GetSeverityBrush(scoreTag.Value.Severity), Width = lineHeight / 3, Height = lineHeight, HorizontalAlignment = HorizontalAlignment.Right }); return(grid); }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { if (tag == null || !(tag is PlayGlyphTag)) { return(null); } return(new PlayGlyph()); }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { InheritanceTag inheritanceTag = tag as InheritanceTag; if (inheritanceTag == null) { return(null); } string imageName; switch (inheritanceTag.Glyph) { case InheritanceGlyph.HasImplementations: imageName = "has-implementations"; break; case InheritanceGlyph.Implements: imageName = "implements"; break; case InheritanceGlyph.ImplementsAndHasImplementations: imageName = "override-is-overridden-combined"; break; case InheritanceGlyph.ImplementsAndOverridden: imageName = "override-is-overridden-combined"; break; case InheritanceGlyph.Overridden: imageName = "is-overridden"; break; case InheritanceGlyph.Overrides: imageName = "overrides"; break; case InheritanceGlyph.OverridesAndOverridden: imageName = "override-is-overridden-combined"; break; default: return(null); } BitmapSource source = new BitmapImage(new Uri("pack://application:,,,/Tvl.VisualStudio.InheritanceMargin;component/Resources/" + imageName + ".png")); Image image = new Image() { Source = source }; image.CommandBindings.Add(new CommandBinding(InheritanceMarginPackage.InheritanceTargetsList, inheritanceTag.HandleExecutedInheritanceTargetsList, inheritanceTag.HandleCanExecuteInheritanceTargetsList)); inheritanceTag.MarginGlyph = image; return(image); }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { // Ensure we can draw a glyph for this marker. if (tag == null || !(tag is TodoTag)) { return(null); } return(new TodoGlyph()); }
/// <summary> /// Generates a new glyph visual for the given line. /// </summary> /// <param name="line">The line that this glyph will be placed on.</param><param name="tag">Information about the glyph for which the visual is being generated.</param> /// <returns> /// The visual element for the given tag. /// </returns> public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { if (tag == null || !(tag is TestTag)) { return null; } return new MarginTestGlyph() { Width = 16, Height = 16 }; }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { if (tag == null || !(tag is PlayGlyphTag)) { return null; } return new PlayGlyph(); }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { return(new Button() { Width = 16, Height = 16, Content = 1 }); }
public UIElement /*!*/ GenerateGlyph(IWpfTextViewLine /*!*/ line, IGlyphTag tag) { TextBlock block = new TextBlock(); block.Text = _promptProvider.Prompt; block.Foreground = _promptProvider.HostControl.Foreground; block.FontSize = _promptProvider.HostControl.FontSize; block.FontFamily = _Consolas; // TODO: get the font family from the editor? return(block); }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { var glyphTag = tag as GlyphTextMarkerGlyphTag; if (glyphTag == null) { return(null); } return(service.GenerateGlyph(line, glyphTag)); }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { // Ensure we can draw a glyph for this marker. if (tag == null || !(tag is ChartPointTag)) { return(null); } ChartPointTag theTag = tag as ChartPointTag; return(new ChartGlyph(theTag.lineMask)); }
/// <summary> /// Generates a new glyph visual for the given line. /// </summary> /// <param name = "line">The line that this glyph will be placed on.</param> /// <param name = "tag">Information about the glyph for which the visual is being generated.</param> /// <returns> /// The visual element for the given tag. /// </returns> public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { if (tag == null || !(tag is TTokenTag)) { return(null); } var tokenTag = (TTokenTag)tag; return(CreateGlyph(line, tokenTag)); }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { if (tag is BreakLineGlyphTag breakLine) { return new Image { Source = Glyph, Width = 11, Height = 11, Margin = new Thickness(1, 2.5, 0, 0), ToolTip = breakLine.ToolTip } } ; return(null); } }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { if (tag == null || !(tag is MarkerTag)) { return(null); } return(new Image() { Source = new BitmapImage(new Uri(LogoResource)) }); }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { if (tag == null || !(tag is MarkerTag)) { return null; } return new Image() { Source = new BitmapImage(new Uri(LogoResource)) }; }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { var versionControlTag = tag as IVersionControlTag; // Ensure we can draw a glyph for this marker. if (versionControlTag == null) { return(null); } var border = new Border { Height = m_glyphSize, Width = m_glyphSize, BorderThickness = new Thickness(2), BorderBrush = Brushes.Black }; var rectangle = new Rectangle { Height = m_glyphSize, Width = m_glyphSize, }; border.Child = rectangle; versionControlTag.Update(t => { rectangle.Dispatcher.Invoke(() => { switch (t) { case IssueStatus.Closed: rectangle.Fill = Brushes.Green; break; case IssueStatus.Open: rectangle.Fill = Brushes.Red; break; case IssueStatus.Unavailable: rectangle.Fill = Brushes.CadetBlue; break; case IssueStatus.RateLimited: rectangle.Fill = Brushes.AliceBlue; break; } }); }); return(border); }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { InheritanceTag inheritanceTag = tag as InheritanceTag; if (inheritanceTag == null) return null; string imageName; switch (inheritanceTag.Glyph) { case InheritanceGlyph.HasImplementations: imageName = "has-implementations"; break; case InheritanceGlyph.Implements: imageName = "implements"; break; case InheritanceGlyph.ImplementsAndHasImplementations: imageName = "override-is-overridden-combined"; break; case InheritanceGlyph.ImplementsAndOverridden: imageName = "override-is-overridden-combined"; break; case InheritanceGlyph.Overridden: imageName = "is-overridden"; break; case InheritanceGlyph.Overrides: imageName = "overrides"; break; case InheritanceGlyph.OverridesAndOverridden: imageName = "override-is-overridden-combined"; break; default: return null; } BitmapSource source = new BitmapImage(new Uri("pack://application:,,,/Tvl.VisualStudio.InheritanceMargin;component/Resources/" + imageName + ".png")); Image image = new Image() { Source = source }; image.CommandBindings.Add(new CommandBinding(InheritanceMarginPackage.InheritanceTargetsList, inheritanceTag.HandleExecutedInheritanceTargetsList, inheritanceTag.HandleCanExecuteInheritanceTargetsList)); inheritanceTag.MarginGlyph = image; return image; }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { if (tag == null || !(tag is JiraIssueLineGlyphTag)) { return(null); } Image image = new Image { Source = PlvsUtils.bitmapSourceFromPngImage(Resources.tab_jira) }; return(image); }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { if (tag == null || !(tag is NugetPackageTag)) { return null; } var glyphIcon = new Image(); glyphIcon.Width = GlyphSize; glyphIcon.Height = GlyphSize; glyphIcon.Source = ImageHelper.GetImageSource(KnownMonikers.NuGet); return glyphIcon; }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { // Ensure we can draw a glyph for this marker. if (tag == null || !(tag is BookmarkTag)) { return(null); } return(new Polyline { Points = points, Fill = Brush, StrokeThickness = 0 }); }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { if (tag == null || !(tag is NugetPackageTag)) { return(null); } var glyphIcon = new Image(); glyphIcon.Width = GlyphSize; glyphIcon.Height = GlyphSize; glyphIcon.Source = ImageHelper.GetImageSource(KnownMonikers.NuGet); return(glyphIcon); }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { if (!(tag is MatchTag)) { return(null); } return(new Rectangle { Fill = new SolidColorBrush(Colors.GreenYellow), StrokeThickness = 1.0, Stroke = Brushes.Black, Height = 10.0, Width = 10.0 }); }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { var pgt = tag as ProgressGlyphTag; if (pgt == null) { return(null); } return(new Rectangle() { Fill = pgt.Val == 0 ? Brushes.Violet : Brushes.DarkOrange, Height = 18.0, Width = 3.0 }); }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) // TODO: consider drawing bookmarks directly { if (!(tag is BookmarkTag)) { return(null); } var bookmarkTag = (BookmarkTag)tag; var prefix = bookmarkTag.Type == BookmarkType.Global ? "Global" : string.Empty; var image = new Image { Width = 16, Height = 16 }; image.Source = new BitmapImage(new Uri(string.Format(IMAGE_RESOURCE, prefix, bookmarkTag.Number))); return(image); }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { // Ensure we can draw a glyph for this marker. if (tag == null || !(tag is TodoTag)) { return(null); } System.Windows.Shapes.Ellipse ellipse = new Ellipse(); ellipse.Fill = Brushes.LightBlue; ellipse.StrokeThickness = 2; ellipse.Stroke = Brushes.DarkBlue; ellipse.Height = m_glyphSize; ellipse.Width = m_glyphSize; return(ellipse); }
public UIElement GenerateGlyph(IWpfTextViewLine textViewLine, IGlyphTag glyphTag) { if (!(glyphTag is CoverageLineGlyphTag tag)) { return(null); } var coverageType = tag.CoverageLine.GetCoverageType(); var result = new Rectangle(); result.Width = 3; result.Height = 16; result.Fill = GetBrush(coverageType); return(result); }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { OutliningGlyphTag ourTag = tag as OutliningGlyphTag; if (ourTag == null) { return(null); } const double minSize = 16.0; double size = line != null ? Math.Min(minSize, line.TextHeight) : minSize; TextBlock tb = CreateGlyphElement(minSize); return(tb); }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { const double m_glyphSize = 16.0; System.Windows.Shapes.Polygon polygon = new Polygon(); polygon.Fill = Brushes.Blue; polygon.StrokeThickness = 0; polygon.Points.Add(new Point(0, 5)); polygon.Points.Add(new Point(12, 5)); polygon.Points.Add(new Point(16, 8)); polygon.Points.Add(new Point(12, 11)); polygon.Points.Add(new Point(0, 11)); polygon.Width = m_glyphSize; polygon.Height = m_glyphSize; return polygon; }
/// <summary> /// The generate glyph. /// </summary> /// <param name="line"> /// The line. /// </param> /// <param name="tag"> /// The tag. /// </param> /// <returns> /// The System.Windows.UIElement. /// </returns> public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { if (tag == null || !(tag is SonarGlyphTag)) { return null; } var ellipse = new Rectangle { Fill = Brushes.Green, StrokeThickness = 1, Stroke = Brushes.Red, Height = GlyphSize, Width = GlyphSize }; return ellipse; }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { // Ensure a glyph can be drawn for this marker if (tag == null || !(tag is AccentBoxOccurrences)) { return null; } IEditorFormatMap map = FormatMapService.GetEditorFormatMap(View); ResourceDictionary dict = map.GetProperties(Constants.GLYPH_FORMAT_NAME); System.Windows.Shapes.Ellipse ellipse = new Ellipse(); ellipse.Fill = (SolidColorBrush)dict[EditorFormatDefinition.BackgroundBrushId]; ellipse.StrokeThickness = 2; ellipse.Stroke = (SolidColorBrush)dict[EditorFormatDefinition.ForegroundBrushId]; ellipse.Height = glyphSize; ellipse.Width = glyphSize; return ellipse; }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { return new TodoGlyph(); }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { OutliningGlyphTag ourTag = tag as OutliningGlyphTag; if ( ourTag == null ) { return null; } const double minSize = 16.0; double size = line != null ? Math.Min(minSize, line.TextHeight) : minSize; TextBlock tb = CreateGlyphElement(minSize); return tb; }