本文整理汇总了C#中IWpfTextViewHost类的典型用法代码示例。如果您正苦于以下问题:C# IWpfTextViewHost类的具体用法?C# IWpfTextViewHost怎么用?C# IWpfTextViewHost使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IWpfTextViewHost类属于命名空间,在下文中一共展示了IWpfTextViewHost类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: OverviewMarkMargin
/// <summary>
/// Constructor for the OverviewChangeTrackingMargin.
/// </summary>
private OverviewMarkMargin(
IWpfTextViewHost textViewHost,
IVerticalScrollBar scrollBar,
OverviewMarkMarginProvider provider)
{
_markMarginElement = new MarkMarginElement(textViewHost.TextView, scrollBar, provider);
}
示例3: GlyphMouseProcessor
public GlyphMouseProcessor(IWpfTextViewHost host, IWpfTextViewMargin margin, ITagAggregator<IGlyphTag> aggregator)
{
this.theHost = host;
this.theMargin = margin;
this.tagAggregator = aggregator;
this.theHost.Closed += OnTextViewHostClosed;
}
示例4: CreateMargin
public IWpfTextViewMargin CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer)
{
if (!ExtensibilityToolsPackage.Options.ShowBottomMargin)
return null;
return new BottomMargin(wpfTextViewHost.TextView, _classifierService, _documentService);
}
示例5: 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;
}
示例6: GetAssociatedMouseProcessor
public IMouseProcessor GetAssociatedMouseProcessor(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin margin)
{
return new GlyphMouseProcessor(
wpfTextViewHost, margin,
aggregatorFactory.CreateTagAggregator<IGlyphTag>(wpfTextViewHost.TextView.TextBuffer)
);
}
示例7: 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);
}
示例8: TryGetMarginCore
protected IMarginCore TryGetMarginCore(IWpfTextViewHost textViewHost)
{
MarginCore marginCore;
if (textViewHost.TextView.Properties.TryGetProperty(typeof(MarginCore), out marginCore))
return marginCore;
// play nice with other source control providers
ITextView textView = textViewHost.TextView;
ITextDataModel textDataModel = textView != null ? textView.TextDataModel : null;
ITextBuffer documentBuffer = textDataModel != null ? textDataModel.DocumentBuffer : null;
if (documentBuffer == null)
return null;
ITextDocument textDocument;
if (!TextDocumentFactoryService.TryGetTextDocument(documentBuffer, out textDocument))
return null;
//var filename = textDocument.FilePath;
//var repositoryPath = GitCommands.GetGitRepository(Path.GetFullPath(filename));
//if (repositoryPath == null)
// return null;
return textViewHost.TextView.Properties.GetOrCreateSingletonProperty(
() => new MarginCore(textViewHost.TextView, ClassificationFormatMapService, EditorFormatMapService));
}
示例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: 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;
}
示例11: 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);
}
示例12: 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;
}
示例13: 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());
}
示例14: PlayMouseProcessor
public PlayMouseProcessor(IWpfTextViewHost wpfTextViewHost, IViewTagAggregatorFactoryService viewTagAggregatorFactoryService)
{
_wpfTextViewHost = wpfTextViewHost;
_viewTagAggregatorFactoryService = viewTagAggregatorFactoryService;
_createTagAggregator = _viewTagAggregatorFactoryService.CreateTagAggregator<PlayGlyphTag>(_wpfTextViewHost.TextView);
}
示例15: CreateControls
protected override void CreateControls(IWpfTextViewHost host, string source)
{
int width = WESettings.GetInt(SettingsKey);
width = width == -1 ? 400 : width;
_browser = new WebBrowser();
_browser.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
Grid grid = new Grid();
grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(0, GridUnitType.Star) });
grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(5, GridUnitType.Pixel) });
grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(width) });
grid.RowDefinitions.Add(new RowDefinition());
grid.Children.Add(_browser);
this.Children.Add(grid);
Grid.SetColumn(_browser, 2);
Grid.SetRow(_browser, 0);
GridSplitter splitter = new GridSplitter();
splitter.Width = 5;
splitter.ResizeDirection = GridResizeDirection.Columns;
splitter.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
splitter.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
splitter.DragCompleted += splitter_DragCompleted;
grid.Children.Add(splitter);
Grid.SetColumn(splitter, 1);
Grid.SetRow(splitter, 0);
}