Exemplo n.º 1
0
 public MarkdownBar(IWpfTextView view, ITextSearchService2 textSearch)
 {
     _View          = view;
     _TextSearch    = textSearch;
     _ListContainer = _View.Properties.GetOrCreateSingletonProperty(() => new ExternalAdornment(view));
     _Tags          = _View.Properties.GetProperty <TaggerResult>(typeof(TaggerResult));
     Name           = nameof(MarkdownBar);
     this.SetBackgroundForCrispImage(ThemeHelper.TitleBackgroundColor);
     view.Properties.AddProperty(nameof(NaviBar), this);
     view.Selection.SelectionChanged += Update;
     view.TextBuffer.PostChanged     += Update;
     view.Closed += View_Closed;
     Resources    = SharedDictionaryManager.Menu;
     SetResourceReference(BackgroundProperty, VsBrushes.CommandBarMenuBackgroundGradientKey);
     SetResourceReference(ForegroundProperty, VsBrushes.CommandBarTextInactiveKey);
     _ActiveTitleLabel     = new ThemedToolBarText(DefaultActiveTitle);
     Items.Add(_ActiveItem = new ThemedButton(new StackPanel {
         Orientation = Orientation.Horizontal,
         Children    = { ThemeHelper.GetImage(KnownImageIds.PageHeader), _ActiveTitleLabel }
     }, null, ShowTitleList)
     {
         Padding = WpfHelper.SmallMargin
     });
     //AddItem(KnownImageIds.Bold, ToggleBold);
     //AddItem(KnownImageIds.Italic, ToggleItalic);
     //AddItem(KnownImageIds.MarkupTag, ToggleCode);
     //AddItem(KnownImageIds.HyperLink, ToggleHyperLink);
     //AddItem(KnownImageIds.StrikeThrough, ToggleStrikeThrough);
 }
Exemplo n.º 2
0
 public MarkdownBar(IWpfTextView view, ITextSearchService2 textSearch) : base(view)
 {
     _TextSearch = textSearch;
     _Tags       = view.Properties.GetProperty <TaggerResult>(typeof(TaggerResult));
     Name        = nameof(MarkdownBar);
     BindView(view);
     _ActiveTitleLabel  = new ThemedToolBarText(DefaultActiveTitle);
     _ActiveItem        = new ThemedImageButton(IconIds.Headings, _ActiveTitleLabel);
     _ActiveItem.Click += ShowTitleList;
     Items.Add(_ActiveItem);
     //AddItem(KnownImageIds.Bold, ToggleBold);
     //AddItem(KnownImageIds.Italic, ToggleItalic);
     //AddItem(KnownImageIds.MarkupTag, ToggleCode);
     //AddItem(KnownImageIds.HyperLink, ToggleHyperLink);
     //AddItem(KnownImageIds.StrikeThrough, ToggleStrikeThrough);
 }
Exemplo n.º 3
0
        public LineNumberMargin(IWpfTextView textView, IVerticalScrollBar scrollBar)
        {
            _TextView = textView;

            IsHitTestVisible = false;

            _ScrollBar       = scrollBar;
            _Tags            = textView.Properties.GetOrCreateSingletonProperty(() => new TaggerResult());
            _EditorFormatMap = ServicesHelper.Instance.EditorFormatMap.GetEditorFormatMap(textView);

            Width = 0;

            Visibility      = Config.Instance.MarkerOptions.MatchFlags(MarkerOptions.LineNumber) ? Visibility.Visible : Visibility.Collapsed;
            Config.Updated += Config_Updated;
            _TextView.TextBuffer.Changed += TextView_TextBufferChanged;
            _ScrollBar.TrackSpanChanged  += OnMappingChanged;
            _TextView.Closed             += (s, args) => Dispose();
        }
Exemplo n.º 4
0
        public CommentMargin(IWpfTextView textView, IVerticalScrollBar verticalScrollbar)
        {
            _TextView = textView;

            IsHitTestVisible = false;

            _ScrollBar       = verticalScrollbar;
            _Tags            = textView.Properties.GetOrCreateSingletonProperty(() => new TaggerResult());
            _EditorFormatMap = ServicesHelper.Instance.EditorFormatMap.GetEditorFormatMap(textView);

            Width = MarkSize + MarkPadding + MarkPadding + /*extra padding*/ 2 * MarkPadding;

            Visibility      = Config.Instance.MarkerOptions.HasAnyFlag(MarkerOptions.CodeMarginMask) ? Visibility.Visible : Visibility.Collapsed;
            Config.Updated += Config_Updated;
            //subscribe to change events and use them to update the markers
            _TextView.TextBuffer.Changed += TextView_TextBufferChanged;
            IsVisibleChanged             += OnViewOrMarginVisiblityChanged;
            //_TextView.VisualElement.IsVisibleChanged += OnViewOrMarginVisiblityChanged;
            _ScrollBar.TrackSpanChanged += OnMappingChanged;
        }