コード例 #1
0
        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);
        }
コード例 #2
0
            public ManagedGtkNSViewHostControl(ICocoaTextViewHost textViewHost)
            {
                if (textViewHost == null)
                {
                    throw new ArgumentNullException(nameof(textViewHost));
                }

                GtkView = new Gtk.GtkNSViewHost(textViewHost.HostControl);
                GtkView.Show();
            }
コード例 #3
0
            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)));
 }
コード例 #5
0
 protected override void OnDispose()
 {
     if (TextBuffer != null)
     {
         TextBuffer.ContentTypeChanged -= TextBuffer_ContentTypeChanged;
     }
     base.OnDispose();
     if (textViewHost != null)
     {
         textViewHost.Close();
         textViewHost = null;
     }
 }
コード例 #6
0
        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;
            };
        }
コード例 #8
0
 public ICocoaTextViewMargin CreateMargin(ICocoaTextViewHost textViewHost, ICocoaTextViewMargin marginContainer)
 {
     return(new EvenOddMargin(textViewHost.TextView));
 }
コード例 #9
0
 public ICocoaTextViewMargin CreateMargin(ICocoaTextViewHost textViewHost, ICocoaTextViewMargin marginContainer)
 {
     return(new CodeCoverageMargin(textViewHost.TextView));
 }