~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MessageBubbleTextMarker.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
                }
55
55
        }
56
56
 
57
 
        public class MessageBubbleTextMarker : TextMarker, IBackgroundMarker, IIconBarMarker, IExtendingTextMarker, IDisposable, IActionTextMarker
 
57
        public class MessageBubbleTextMarker : TextLineMarker, IBackgroundMarker, IIconBarMarker, IExtendingTextLineMarker, IDisposable, IActionTextLineMarker
58
58
        {
59
59
                MessageBubbleCache cache;
60
60
                
180
180
                        this.IsVisible = true;
181
181
                        this.lineSegment = lineSegment;
182
182
                        this.initialText = editor.Document.GetTextAt (lineSegment);
183
 
                        this.Flags = TextMarkerFlags.DrawsSelection;
 
183
                        this.Flags = TextLineMarkerFlags.DrawsSelection;
184
184
                        AddError (isError, errorMessage);
185
185
//                      cache.Changed += (sender, e) => CalculateLineFit (editor, lineSegment);
186
186
                }
330
330
                
331
331
                public bool DrawBackground (TextEditor editor, Cairo.Context g, TextViewMargin.LayoutWrapper layout2, int selectionStart, int selectionEnd, int startOffset, int endOffset, double y, double startXPos, double endXPos, ref bool drawBg)
332
332
                {
333
 
                        if (!IsVisible || DebuggingService.IsDebugging)
 
333
                        if (!IsVisible)
334
334
                                return true;
335
335
                        EnsureLayoutCreated (editor);
336
336
                        double x = editor.TextViewMargin.XOffset;
353
353
                        if (!fitsInSameLine) {
354
354
                                if (isEolSelected) {
355
355
                                        x -= (int)editor.HAdjustment.Value;
356
 
                                        editor.TextViewMargin.DrawRectangleWithRuler (g, x, new Cairo.Rectangle (x, y + editor.LineHeight, editor.TextViewMargin.TextStartPosition, editor.LineHeight), editor.ColorStyle.Default.CairoBackgroundColor, true);
357
 
                                        editor.TextViewMargin.DrawRectangleWithRuler (g, x + editor.TextViewMargin.TextStartPosition, new Cairo.Rectangle (x + editor.TextViewMargin.TextStartPosition, y + editor.LineHeight, editor.Allocation.Width + (int)editor.HAdjustment.Value, editor.LineHeight), editor.ColorStyle.Selection.CairoBackgroundColor, true);
 
356
                                        editor.TextViewMargin.DrawRectangleWithRuler (g, x, new Cairo.Rectangle (x, y + editor.LineHeight, editor.TextViewMargin.TextStartPosition, editor.LineHeight), editor.ColorStyle.PlainText.Background, true);
 
357
                                        editor.TextViewMargin.DrawRectangleWithRuler (g, x + editor.TextViewMargin.TextStartPosition, new Cairo.Rectangle (x + editor.TextViewMargin.TextStartPosition, y + editor.LineHeight, editor.Allocation.Width + (int)editor.HAdjustment.Value, editor.LineHeight), editor.ColorStyle.SelectedText.Background, true);
358
358
                                        x += (int)editor.HAdjustment.Value;
359
359
                                } else {
360
 
                                        editor.TextViewMargin.DrawRectangleWithRuler (g, x, new Cairo.Rectangle (x, y + editor.LineHeight, x2, editor.LineHeight), editor.ColorStyle.Default.CairoBackgroundColor, true);
 
360
                                        editor.TextViewMargin.DrawRectangleWithRuler (g, x, new Cairo.Rectangle (x, y + editor.LineHeight, x2, editor.LineHeight), editor.ColorStyle.PlainText.Background, true);
361
361
                                }
362
362
                        }
363
363
                        DrawRectangle (g, x, y, right, topSize);
580
580
//                              x2 = System.Math.Max (x2, fitsInSameLine ? editor.TextViewMargin.XOffset + editor.LineHeight / 2 : editor.TextViewMargin.XOffset);
581
581
                                
582
582
                                if (i > 0) {
583
 
                                        editor.TextViewMargin.DrawRectangleWithRuler (g, x, new Cairo.Rectangle (x, y, right, editor.LineHeight), isEolSelected ? editor.ColorStyle.Selection.CairoBackgroundColor : editor.ColorStyle.Default.CairoBackgroundColor, true);
 
583
                                        editor.TextViewMargin.DrawRectangleWithRuler (g, x, new Cairo.Rectangle (x, y, right, editor.LineHeight), isEolSelected ? editor.ColorStyle.SelectedText.Background : editor.ColorStyle.PlainText.Background, true);
584
584
                                        g.MoveTo (new Cairo.PointD (x2 + 0.5, y));
585
585
                                        g.LineTo (new Cairo.PointD (x2 + 0.5, y + editor.LineHeight));
586
586
                                        g.LineTo (new Cairo.PointD (right, y + editor.LineHeight));
632
632
                }
633
633
                #region IIconBarMarker implementation
634
634
 
635
 
                public void DrawIcon (Mono.TextEditor.TextEditor editor, Cairo.Context cr, DocumentLine line, int lineNumber, double x, double y, double width, double height)
 
635
                public void DrawIcon (TextEditor editor, Cairo.Context cr, DocumentLine line, int lineNumber, double x, double y, double width, double height)
636
636
                {
637
 
                        if (DebuggingService.IsDebugging)
638
 
                                return;
639
 
                        editor.GdkWindow.DrawPixbuf (cache.editor.Style.BaseGC (Gtk.StateType.Normal), 
640
 
                                errors.Any (e => e.IsError) ? cache.errorPixbuf : cache.warningPixbuf, 
641
 
                                0, 0, 
642
 
                                (int)(x + (width - cache.errorPixbuf.Width) / 2), 
643
 
                                (int)(y + (height - cache.errorPixbuf.Height) / 2), 
644
 
                                cache.errorPixbuf.Width, cache.errorPixbuf.Height, 
645
 
                                Gdk.RgbDither.None, 0, 0);
 
637
                        Gdk.CairoHelper.SetSourcePixbuf (
 
638
                                cr,
 
639
                                errors.Any (e => e.IsError) ? cache.errorPixbuf : cache.warningPixbuf,
 
640
                                (int)(x + (width - cache.errorPixbuf.Width) / 2),
 
641
                                (int)(y + (height - cache.errorPixbuf.Height) / 2));
 
642
                        cr.Paint ();
646
643
                }
647
644
 
648
645
                public void MousePress (MarginMouseEventArgs args)
670
667
                        get {
671
668
                                int lineNumber = editor.Document.OffsetToLineNumber (lineSegment.Offset);
672
669
                                
673
 
                                double y = editor.LineToY (lineNumber) - (int)editor.VAdjustment.Value;
 
670
                                double y = editor.Allocation.Y + editor.LineToY (lineNumber) - (int)editor.VAdjustment.Value;
674
671
                                double height = editor.LineHeight * errors.Count;
675
672
                                if (!fitsInSameLine)
676
673
                                        y += editor.LineHeight;
767
764
 
768
765
                bool oldIsOver = false;
769
766
 
770
 
                public void MouseHover (TextEditor editor, MarginMouseEventArgs args, TextMarkerHoverResult result)
 
767
                public void MouseHover (TextEditor editor, MarginMouseEventArgs args, TextLineMarkerHoverResult result)
771
768
                {
772
769
                        if (this.LineSegment == null)
773
770
                                return;
778
775
                        
779
776
                        int errorNumber = MouseIsOverError (editor, args);
780
777
                        if (errorNumber >= 0) {
781
 
                                result.Cursor = cache.arrowCursor;
 
778
                                result.Cursor = null;
782
779
                                if (!isOver)
783
780
                                        // don't show tooltip when hovering over error counter layout.
784
781
                                        result.TooltipMarkup = GLib.Markup.EscapeText (errors[errorNumber].ErrorMessage);
856
853
                        g.ShowLayout (layout.Layout);
857
854
                        g.Restore ();
858
855
                        
859
 
//                      if (ShowIconsInBubble)
860
 
//                              win.DrawPixbuf (editor.Style.BaseGC (Gtk.StateType.Normal), errors[errorNumber].IsError ? errorPixbuf : warningPixbuf, 0, 0, x2, y + (editor.LineHeight - errorPixbuf.Height) / 2, errorPixbuf.Width, errorPixbuf.Height, Gdk.RgbDither.None, 0, 0);
 
856
                        if (ShowIconsInBubble) {
 
857
                                var pixbuf = errors [errorNumber].IsError ? cache.errorPixbuf: cache.warningPixbuf;
 
858
                                Gdk.CairoHelper.SetSourcePixbuf (g, pixbuf, x2, y + (editor.LineHeight - cache.errorPixbuf.Height) / 2);
 
859
                                g.Paint ();
 
860
                        }
861
861
                }
862
862
                
863
863
                #endregion