本文整理汇总了C#中IWpfTextViewMargin类的典型用法代码示例。如果您正苦于以下问题:C# IWpfTextViewMargin类的具体用法?C# IWpfTextViewMargin怎么用?C# IWpfTextViewMargin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IWpfTextViewMargin类属于命名空间,在下文中一共展示了IWpfTextViewMargin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GlyphTextMarkerServiceMouseProcessor
public GlyphTextMarkerServiceMouseProcessor(IGlyphTextMarkerServiceImpl glyphTextMarkerServiceImpl, IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin margin) {
if (glyphTextMarkerServiceImpl == null)
throw new ArgumentNullException(nameof(glyphTextMarkerServiceImpl));
if (wpfTextViewHost == null)
throw new ArgumentNullException(nameof(wpfTextViewHost));
if (margin == null)
throw new ArgumentNullException(nameof(margin));
glyphTextViewMarkerService = GlyphTextViewMarkerService.GetOrCreate(glyphTextMarkerServiceImpl, wpfTextViewHost.TextView);
this.wpfTextViewHost = wpfTextViewHost;
this.margin = margin;
toolTipDispatcherTimer = new DispatcherTimer(DispatcherPriority.Normal, margin.VisualElement.Dispatcher);
popup = new Popup { AllowsTransparency = true };
var list = new List<IGlyphTextMarkerMouseProcessor>();
foreach (var lazy in glyphTextMarkerServiceImpl.GlyphTextMarkerMouseProcessorProviders) {
if (lazy.Metadata.TextViewRoles != null && !wpfTextViewHost.TextView.Roles.ContainsAny(lazy.Metadata.TextViewRoles))
continue;
var mouseProcessor = lazy.Value.GetAssociatedMouseProcessor(wpfTextViewHost, margin);
if (mouseProcessor != null)
list.Add(mouseProcessor);
}
glyphTextMarkerMouseProcessors = list.ToArray();
wpfTextViewHost.TextView.Closed += TextView_Closed;
wpfTextViewHost.TextView.LayoutChanged += TextView_LayoutChanged;
toolTipDispatcherTimer.Tick += ToolTipDispatcherTimer_Tick;
popup.Closed += Popup_Closed;
glyphTextViewMarkerService.AddGlyphTextMarkerListener(this);
}
示例2: CreateMargin
public IWpfTextViewMargin CreateMargin(IWpfTextViewHost view_host, IWpfTextViewMargin container_margin)
{
IWpfTextView text_view = view_host.TextView;
try
{
Utils.VSVersion = Assembly.GetCallingAssembly().GetName().Version.Major.ToString();
}
catch { }
if (!PresenceSent)
{
PresenceSent = true;
MonitoringService.SendPresense();
}
if (!SettingsLoaded)
ReadSettings(OptionsService.GlobalOptions);
RemoveVerticalScrollBar(container_margin);
var navigator = TextStructureNavigatorService.GetTextStructureNavigator(text_view.TextBuffer);
var format = FormatMapService.GetEditorFormatMap(text_view);
var tagger = HighlightWordTagger.Instance(text_view, format, TextSearchService, navigator);
var marks_enumerator = new MarksEnumerator(AggregatorFactoryService, text_view);
var change_enumerator = new ChangeEnumerator(AggregatorFactoryService, text_view);
var words_enumerator = new HighlightedWordsEnumerator(text_view, tagger);
return new RockMargin(text_view, marks_enumerator, change_enumerator, words_enumerator, tagger);
}
示例3: CreateMargin
public IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin)
{
int iErrStat;
//_contentTypeRegistryService = ContentTypeRegistryService;
//_textBufferFactoryService = TextBufferFactoryService;
//DTE2 dte = (DTE2)serviceProvider.GetService(typeof(DTE));
//iErrStat = GetHiddenTextManager(serviceProvider);
//IComponentModel componentModel = (IComponentModel)ServiceProvider.GlobalProvider.GetService(typeof(SComponentModel));
//IVsEditorAdaptersFactoryService adapterFactoryService = componentModel.GetService<IVsEditorAdaptersFactoryService>();
////System.Diagnostics.Trace.WriteLine(":" + _textBufferFactoryService.TextContentType.ToString());
//_curTextBuf = _textBufferFactoryService.CreateTextBuffer("test", _textBufferFactoryService.PlaintextContentType);
foreach (IViewTaggerProvider vtp in viewTaggerProviderCollection)
{
if (vtp is TextInvisTaggerProvider)
{
_titp = vtp as TextInvisTaggerProvider;
break;
}
}
if (_titp == null)
{
System.Diagnostics.Trace.WriteLine("no valid tagger, exit");
return null;
}
return new TestMargin(textViewHost.TextView, _titp.GetThyTagger());
}
示例4: LinkBanner
IWpfTextViewMargin IWpfTextViewMarginProvider.CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer)
{
// If the notification has occured then there is nothing else to do. We are done
if (_vimApplicationSettings.HaveNotifiedBackspaceSetting)
{
return null;
}
// On the very first IVimBuffer creation the vimrc will be loaded. Go ahead and
// attempt to get / create the buffer to ensure the vimrc load has been attempted
var wpfTextView = wpfTextViewHost.TextView;
IVimBuffer vimBuffer;
if (!_vim.TryGetOrCreateVimBufferForHost(wpfTextView, out vimBuffer))
{
return null;
}
// If there is no vimrc or the load does allow backspace over start then there
// is no need to display the warning
if (_vim.GlobalSettings.IsBackspaceStart || _vimApplicationSettings.UseEditorTabAndBackspace)
{
return null;
}
var editorFormatMap = _editorFormatMapService.GetEditorFormatMap(wpfTextView);
var linkBanner = new LinkBanner();
linkBanner.MarginName = Name;
linkBanner.LinkAddress = "https://github.com/jaredpar/VsVim/wiki/FAQ#wiki-backspace";
linkBanner.LinkText = "FAQ";
linkBanner.BannerText = "You may want to change the backspace setting in your vimrc";
linkBanner.Background = editorFormatMap.GetBackgroundBrush(EditorFormatDefinitionNames.Margin, MarginFormatDefinition.DefaultColor);
linkBanner.CloseClicked += (sender, e) => { _vimApplicationSettings.HaveNotifiedBackspaceSetting = true; };
return linkBanner;
}
示例5: SimpleScrollBar
public SimpleScrollBar(IWpfTextViewHost host, IWpfTextViewMargin containerMargin, FrameworkElement container,
IScrollMapFactoryService scrollMapFactoryService)
{
_textView = host.TextView;
_realScrollBarMargin =
containerMargin.GetTextViewMargin(PredefinedMarginNames.VerticalScrollBar) as IWpfTextViewMargin;
if (_realScrollBarMargin != null)
{
_realScrollBar = _realScrollBarMargin as IVerticalScrollBar;
if (_realScrollBar != null)
{
_realScrollBarMargin.VisualElement.IsVisibleChanged += OnScrollBarIsVisibleChanged;
_realScrollBar.TrackSpanChanged += OnScrollBarTrackSpanChanged;
}
}
ResetTrackSpan();
_scrollMapFactory = scrollMapFactoryService;
_useElidedCoordinates = false;
ResetScrollMap();
_scrollMap.MappingChanged += delegate { RaiseTrackChangedEvent(); };
container.SizeChanged += OnContainerSizeChanged;
}
示例6: GlyphMouseProcessor
public GlyphMouseProcessor(IWpfTextViewHost host, IWpfTextViewMargin margin, ITagAggregator<IGlyphTag> aggregator)
{
this.theHost = host;
this.theMargin = margin;
this.tagAggregator = aggregator;
this.theHost.Closed += OnTextViewHostClosed;
}
示例7: CreateMargin
public IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin)
{
string source = textViewHost.TextView.TextBuffer.CurrentSnapshot.GetText();
ITextDocument document;
if (TextDocumentFactoryService.TryGetTextDocument(textViewHost.TextView.TextDataModel.DocumentBuffer, out document))
{
switch (textViewHost.TextView.TextBuffer.ContentType.DisplayName.ToLowerInvariant())
{
case "less":
bool showLess = WESettings.GetBoolean(WESettings.Keys.ShowLessPreviewWindow);
return new LessMargin("CSS", source, showLess, document);
case "coffeescript":
bool showCoffee = WESettings.GetBoolean(WESettings.Keys.ShowCoffeeScriptPreviewWindow);
return new CoffeeScriptMargin("JavaScript", source, showCoffee, document);
case "markdown":
bool showMarkdown = WESettings.GetBoolean(WESettings.Keys.MarkdownShowPreviewWindow);
return new MarkdownMargin("text", source, showMarkdown, document);
}
}
return null;
}
示例8: CreateMargin
public IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin)
{
IWpfTextView view = textViewHost.TextView;
// Files larger than 1 MB should be skipped to avoid hangs.
if (view.TextSnapshot.Length > (1024 * 1024))
return null;
ITextDocument document;
if (!_TextDocumentFactoryService.TryGetTextDocument(view.TextDataModel.DocumentBuffer, out document))
return null;
IVsExtensionManager manager = _serviceProvider.GetService(typeof(SVsExtensionManager)) as IVsExtensionManager;
if (manager == null)
return null;
IInstalledExtension extension;
manager.TryGetInstalledExtension("FixMixedTabs", out extension);
if (extension != null)
return null;
ITextUndoHistory history;
if (!_UndoHistoryRegistry.TryGetHistory(view.TextBuffer, out history))
{
Debug.Fail("Unexpected: couldn't get an undo history for the given text buffer");
return null;
}
return new InformationBarMargin(view, document, _OperationsFactory.GetEditorOperations(view), history);
}
示例9: CreateMargin
public IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin)
{
string source = textViewHost.TextView.TextBuffer.CurrentSnapshot.GetText();
ITextDocument document;
if (textViewHost.TextView.TextDataModel.DocumentBuffer.Properties.TryGetProperty(typeof(ITextDocument), out document))
{
switch (textViewHost.TextView.TextBuffer.ContentType.DisplayName)
{
case "LESS":
bool showLess = WESettings.GetBoolean(WESettings.Keys.ShowLessPreviewWindow);
return new LessMargin("CSS", source, showLess, document);
//case "scss":
// return new ScssMargin("CSS", source, true, document);
case "CoffeeScript":
bool showCoffee = WESettings.GetBoolean(WESettings.Keys.ShowCoffeeScriptPreviewWindow);
return new CoffeeScriptMargin("JavaScript", source, showCoffee, document);
//case "TypeScript":
// if (!document.FilePath.EndsWith(".d.ts"))
// {
// bool showType = WESettings.GetBoolean(WESettings.Keys.ShowTypeScriptPreviewWindow);
// return new TypeScriptMargin("TypeScript", source, showType, document);
// }
// break;
case "markdown":
return new MarkdownMargin("text", source, true, document);
}
}
return null;
}
示例10: CreateMargin
public IWpfTextViewMargin CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer)
{
if (!ExtensibilityToolsPackage.Options.ShowBottomMargin)
return null;
return new BottomMargin(wpfTextViewHost.TextView, _classifierService, _documentService);
}
示例11: GetAssociatedMouseProcessor
public IMouseProcessor GetAssociatedMouseProcessor(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin margin)
{
return new GlyphMouseProcessor(
wpfTextViewHost, margin,
aggregatorFactory.CreateTagAggregator<IGlyphTag>(wpfTextViewHost.TextView.TextBuffer)
);
}
示例12: CreateMargin
public IWpfTextViewMargin CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer)
{
string fileName = GetFileNameFromTextBuffer(wpfTextViewHost.TextView.TextBuffer);
IEnumerable<SonarIssue> issues = _sonarIssuesService.GetIssuesForFile(fileName);
return new SonarIssueTextViewMargin(issues, wpfTextViewHost, marginContainer, _scrollMapFactoryService);
}
示例13: CreateMargin
public IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin)
{
if (!VisualDHelper.setFactory(editorFactory))
return null;
//MessageBox.Show("CreateMargin");
return new CoverageMargin(textViewHost.TextView, FormatMapService.GetEditorFormatMap(textViewHost.TextView));
}
示例14: CreateMargin
public override IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin)
{
var marginCore = TryGetMarginCore(textViewHost);
if (marginCore == null)
return null;
return new EditorDiffMargin(textViewHost.TextView, marginCore);
}
示例15: GetGlyphFactory
public IGlyphFactory GetGlyphFactory(IWpfTextView view, IWpfTextViewMargin margin)
{
AccentGlyphFactory factory = new AccentGlyphFactory();
factory.View = view;
factory.FormatMapService = FormatMapService;
return factory;
}