protected override Control CreateControl()
        {
            textViewHost        = Imports.TextEditorFactoryService.CreateTextViewHost(TextView, setFocus: true);
            textViewHostControl = textViewHost.HostControl;

            if (!useLegacyGtkNSViewHost.Value)
            {
                embeddedControl = new ManagedGtkNSViewHostControl(textViewHost);

                TextView.GotAggregateFocus += (sender, e)
                                              => embeddedControl.GtkView.GrabFocus();
            }
            else
            {
                var legacyEmbeddedControl = new LegacyGtkNSViewHostControl(textViewHost);
                embeddedControl = legacyEmbeddedControl;

                TextView.GotAggregateFocus += (sender, e) => {
                    if (!legacyEmbeddedControl.IsGrabbingFocus)
                    {
                        embeddedControl.GtkView.GrabFocus();
                    }
                };
            }

            TextView.Properties.AddProperty(typeof(Gtk.Widget), embeddedControl.GtkView);
            TextBuffer.ContentTypeChanged += TextBuffer_ContentTypeChanged;
            return(embeddedControl);
        }
            public ManagedGtkNSViewHostControl(ICocoaTextViewHost textViewHost)
            {
                if (textViewHost == null)
                {
                    throw new ArgumentNullException(nameof(textViewHost));
                }

                GtkView = new Gtk.GtkNSViewHost(textViewHost.HostControl);
                GtkView.Show();
            }
            public LegacyGtkNSViewHostControl(ICocoaTextViewHost textViewHost)
            {
                this.textViewHost = textViewHost ?? throw new ArgumentNullException(nameof(textViewHost));
                this.nsView       = textViewHost.HostControl;

                GtkView          = this.GetNativeWidget <Gtk.Widget> ();
                GtkView.CanFocus = true;

                textViewHost.HostControlMovedToWindow += OnNativeViewMovedToWindow;
            }
示例#4
0
 public ICocoaMouseProcessor GetAssociatedMouseProcessor(
     ICocoaTextViewHost wpfTextViewHost,
     ICocoaTextViewMargin margin)
 {
     return(new BreakpointGlyphMouseProcessor(
                wpfTextViewHost,
                margin,
                viewTagAggregatorService.CreateTagAggregator <IGlyphTag> (wpfTextViewHost.TextView),
                editorPrimitivesFactoryService.GetViewPrimitives(wpfTextViewHost.TextView)));
 }
 protected override void OnDispose()
 {
     if (TextBuffer != null)
     {
         TextBuffer.ContentTypeChanged -= TextBuffer_ContentTypeChanged;
     }
     base.OnDispose();
     if (textViewHost != null)
     {
         textViewHost.Close();
         textViewHost = null;
     }
 }
        public ICocoaTextViewMargin CreateMargin(
            ICocoaTextViewHost wpfTextViewHost,
            ICocoaTextViewMargin marginContainer)
        {
            var textView = wpfTextViewHost?.TextView
                           ?? throw new ArgumentNullException(nameof(wpfTextViewHost));

            var vimBuffer = _vim.GetOrCreateVimBuffer(textView);

            var formatMap = _formatMapService.GetClassificationFormatMap(textView);

            return(new RelativeLineNumbersMargin(
                       textView,
                       formatMap,
                       _typeRegistryService,
                       vimBuffer.LocalSettings));
        }
示例#7
0
        public BreakpointGlyphMouseProcessor(
            ICocoaTextViewHost wpfTextViewHost,
            ICocoaTextViewMargin margin,
            ITagAggregator <IGlyphTag> tagAggregator,
            IViewPrimitives viewPrimitives)
        {
            this.textViewHost       = wpfTextViewHost;
            this.glyphMargin        = margin;
            this.glyphTagAggregator = tagAggregator;
            this.viewPrimitives     = viewPrimitives;

            // Setup the UI
            //TODO:MAC
            //popup = new Popup();
            //popup.IsOpen = false;
            //popup.Visibility = Visibility.Hidden;

            textViewHost.Closed += delegate {
                glyphTagAggregator.Dispose();
                glyphTagAggregator = null;
            };
        }
 public ICocoaTextViewMargin CreateMargin(ICocoaTextViewHost textViewHost, ICocoaTextViewMargin marginContainer)
 {
     return(new EvenOddMargin(textViewHost.TextView));
 }
 public ICocoaTextViewMargin CreateMargin(ICocoaTextViewHost textViewHost, ICocoaTextViewMargin marginContainer)
 {
     return(new CodeCoverageMargin(textViewHost.TextView));
 }