public PreviewPopup(QuickTaskOverviewMode strip, Mono.TextEditor.TextSegment segment, int w, int y)
 {
     this.strip   = strip;
     this.segment = segment;
     this.w       = w;
     this.y       = y;
 }
        protected override bool OnMotionNotifyEvent(EventMotion evnt)
        {
            RemovePreviewPopupTimeout();

            if (IsInGrab())
            {
                var yDelta = evnt.Y - grabY;
                MovePosition(grabCenter + yDelta);
            }
            else
            {
                UpdatePrelightState(evnt.X, evnt.Y);
            }

            const ModifierType buttonMask = ModifierType.Button1Mask | ModifierType.Button2Mask |
                                            ModifierType.Button3Mask | ModifierType.Button4Mask | ModifierType.Button5Mask;

            if ((evnt.State & ModifierType.ShiftMask) == ModifierType.ShiftMask)
            {
                int line = YToLine(evnt.Y);

                line = Math.Max(1, line - 2);
                int lastLine = Math.Min(TextEditor.LineCount, line + 5);
                var start    = TextEditor.GetLine(line);
                var end      = TextEditor.GetLine(lastLine);
                if (start == null || end == null)
                {
                    return(base.OnMotionNotifyEvent(evnt));
                }
                var showSegment = new Mono.TextEditor.TextSegment(start.Offset, end.Offset + end.Length - start.Offset);

                if (previewWindow != null)
                {
                    previewWindow.SetSegment(showSegment, false);
                    PositionPreviewWindow((int)evnt.Y);
                }
                else
                {
                    var popup = new PreviewPopup(this, showSegment, TextEditor.Allocation.Width * 4 / 7, (int)evnt.Y);
                    previewPopupTimeout = GLib.Timeout.Add(450, new GLib.TimeoutHandler(popup.Run));
                }
            }
            else
            {
                RemovePreviewPopupTimeout();
                DestroyPreviewWindow();
            }
            return(base.OnMotionNotifyEvent(evnt));
        }
		protected override bool OnMotionNotifyEvent (EventMotion evnt)
		{
			RemovePreviewPopupTimeout ();

			if (IsInGrab ()) {
				var yDelta = evnt.Y - grabY;
				MovePosition (grabCenter + yDelta);
			} else {
				UpdatePrelightState (evnt.X, evnt.Y);
			}

			const ModifierType buttonMask = ModifierType.Button1Mask | ModifierType.Button2Mask |
				ModifierType.Button3Mask | ModifierType.Button4Mask | ModifierType.Button5Mask;
			if ((evnt.State & ModifierType.ShiftMask) == ModifierType.ShiftMask) {
				int line = YToLine (evnt.Y);

				line = Math.Max (1, line - 2);
				int lastLine = Math.Min (TextEditor.LineCount, line + 5);
				var start = TextEditor.GetLine (line);
				var end = TextEditor.GetLine (lastLine);
				if (start == null || end == null) {
					return base.OnMotionNotifyEvent (evnt);
				}
				var showSegment = new Mono.TextEditor.TextSegment (start.Offset, end.Offset + end.Length - start.Offset);

				if (previewWindow != null) {
					previewWindow.SetSegment (showSegment, false);
					PositionPreviewWindow ((int)evnt.Y);
				} else {
					var popup = new PreviewPopup (this, showSegment, TextEditor.Allocation.Width * 4 / 7, (int)evnt.Y);
					previewPopupTimeout = GLib.Timeout.Add (450, new GLib.TimeoutHandler (popup.Run));
				}
			} else {
				RemovePreviewPopupTimeout ();
				DestroyPreviewWindow ();
			}
			return base.OnMotionNotifyEvent (evnt);
		}
			public PreviewPopup (QuickTaskOverviewMode strip, Mono.TextEditor.TextSegment segment, int w, int y)
			{
				this.strip = strip;
				this.segment = segment;
				this.w = w;
				this.y = y;
			}
Beispiel #5
0
 public void Remove(TextSegment removeSegment)
 {
     textArea.Remove(removeSegment);
 }
Beispiel #6
0
 public TooltipItem(object item, TextSegment itemSegment)
 {
     this.ItemSegment = itemSegment;
     this.Item        = item;
 }
 public UnderlineTextSegmentMarker(string colorName, TextSegment textSegment) : base(textSegment)
 {
     this.ColorName = colorName;
     this.Wave      = true;
 }
Beispiel #8
0
 public string GetTextAt(TextSegment segment)
 {
     return(Document.GetTextAt(segment));
 }
 public TextSegmentMarker(TextSegment textSegment) : base(textSegment)
 {
 }
 public UnderlineTextSegmentMarker(Cairo.Color color, TextSegment textSegment) : base(textSegment)
 {
     this.Color = color;
     this.Wave  = true;
 }
        public CodeSegmentPreviewWindow(MonoTextEditor editor, bool hideCodeSegmentPreviewInformString, TextSegment segment, int width, int height, bool removeIndent = true) : base(Gtk.WindowType.Popup)
        {
            this.HideCodeSegmentPreviewInformString = hideCodeSegmentPreviewInformString;
            this.Segment                 = segment;
            this.editor                  = editor;
            this.AppPaintable            = true;
            this.SkipPagerHint           = this.SkipTaskbarHint = true;
            this.TypeHint                = WindowTypeHint.Menu;
            layout                       = PangoUtil.CreateLayout(this);
            informLayout                 = PangoUtil.CreateLayout(this);
            fontInform                   = Pango.FontDescription.FromString(editor.Options.FontName);
            fontInform.Size              = (int)(fontInform.Size * 0.7f);
            informLayout.FontDescription = fontInform;
            informLayout.SetText(CodeSegmentPreviewInformString);

            fontDescription        = Pango.FontDescription.FromString(editor.Options.FontName);
            fontDescription.Size   = (int)(fontDescription.Size * 0.8f);
            layout.FontDescription = fontDescription;
            layout.Ellipsize       = Pango.EllipsizeMode.End;
            // setting a max size for the segment (40 lines should be enough),
            // no need to markup thousands of lines for a preview window
            SetSegment(segment, removeIndent);
            CalculateSize(width);
        }
 public CodeSegmentPreviewWindow(MonoTextEditor editor, bool hideCodeSegmentPreviewInformString, TextSegment segment, bool removeIndent = true) : this(editor, hideCodeSegmentPreviewInformString, segment, DefaultPreviewWindowWidth, DefaultPreviewWindowHeight, removeIndent)
 {
 }
Beispiel #13
0
 public bool Contains(TextSegment segment)
 {
     return(Offset <= segment.Offset && segment.EndOffset <= EndOffset);
 }
Beispiel #14
0
 public TreeSegment(TextSegment segment) : this(segment.Offset, segment.Length)
 {
 }
Beispiel #15
0
 /// <summary>
 /// Determines whether this line contains the specified segment.
 /// </summary>
 /// <returns>
 /// <c>true</c> if this line contains the specified segment (upper bound inclusive); otherwise, <c>false</c>.
 /// </returns>
 /// <param name='segment'>
 /// The segment.
 /// </param>
 public bool Contains(TextSegment segment)
 {
     return(Offset <= segment.Offset && segment.EndOffset <= EndOffsetIncludingDelimiter);
 }