Ejemplo n.º 1
0
        private void HeaderExpose(object ob, Gtk.ExposeEventArgs a)
        {
            Gdk.Rectangle rect = new Gdk.Rectangle(0, 0, header.Allocation.Width - 1, header.Allocation.Height);
            HslColor      gcol = frame.Style.Background(Gtk.StateType.Normal);

            if (pointerHover)
            {
                gcol.L *= 1.05;
            }
            gcol.L = Math.Min(1, gcol.L);

            using (Cairo.Context cr = Gdk.CairoHelper.Create(a.Event.Window)) {
                cr.NewPath();
                cr.MoveTo(0, 0);
                cr.RelLineTo(rect.Width, 0);
                cr.RelLineTo(0, rect.Height);
                cr.RelLineTo(-rect.Width, 0);
                cr.RelLineTo(0, -rect.Height);
                cr.ClosePath();
                Cairo.SolidPattern solidPattern = new Cairo.SolidPattern(gcol);
                cr.Pattern = solidPattern;
                cr.FillPreserve();
                solidPattern.Destroy();
            }

            header.GdkWindow.DrawRectangle(frame.Style.DarkGC(Gtk.StateType.Normal), false, rect);

            foreach (Widget child in header.Children)
            {
                header.PropagateExpose(child, a.Event);
            }
        }
        void DrawBackground(Cairo.Context cr, Gdk.Rectangle allocation)
        {
            cr.LineWidth = 1;
            cr.Rectangle(0, 0, allocation.Width, allocation.Height);

            if (TextEditor.ColorStyle != null)
            {
                if (MonoDevelop.Core.Platform.IsWindows)
                {
                    using (var pattern = new Cairo.SolidPattern(win81Background)) {
                        cr.SetSource(pattern);
                        cr.Fill();
                    }
                }
                else
                {
                    var col = TextEditor.ColorStyle.PlainText.Background.ToXwtColor();
                    col.Light *= 0.948;
                    using (var grad = new Cairo.LinearGradient(0, 0, allocation.Width, 0)) {
                        grad.AddColorStop(0, col.ToCairoColor());
                        grad.AddColorStop(0.7, TextEditor.ColorStyle.PlainText.Background);
                        grad.AddColorStop(1, col.ToCairoColor());
                        cr.SetSource(grad);
                        cr.Fill();
                    }
                }
            }
            DrawLeftBorder(cr);
        }
Ejemplo n.º 3
0
 protected virtual void ShapeSurface(Cairo.Context cr, Cairo.Color color)
 {
     cr.Operator = Cairo.Operator.Source;
     Cairo.Pattern pattern = new Cairo.SolidPattern(color, false);
     cr.Source = pattern;
     pattern.Destroy();
     cr.Paint();
 }
Ejemplo n.º 4
0
 protected virtual void ShapeSurface(Cairo.Context cr, Cairo.Color color)
 {
     cr.Operator = Cairo.Operator.Source;
     using (var pattern = new Cairo.SolidPattern(color, false)) {
         cr.SetSource(pattern);
         cr.Paint();
     }
 }
Ejemplo n.º 5
0
        protected override bool OnExposeEvent(Gdk.EventExpose e)
        {
            if (TextEditor == null)
            {
                return(true);
            }
            using (Cairo.Context cr = Gdk.CairoHelper.Create(e.Window)) {
                cr.LineWidth = 1;
                cr.Rectangle(0, 0, Allocation.Width, Allocation.Height);

                if (TextEditor.ColorStyle != null)
                {
                    if (Platform.IsWindows)
                    {
                        using (var pattern = new Cairo.SolidPattern(win81Background)) {
                            cr.SetSource(pattern);
                        }
                    }
                    else
                    {
                        var col = new Cairo.Color(229 / 255.0, 229 / 255.0, 229 / 255.0);
                        using (var grad = new Cairo.LinearGradient(0, 0, Allocation.Width, 0)) {
                            grad.AddColorStop(0, col);
                            grad.AddColorStop(0.5, new Cairo.Color(1, 1, 1));
                            grad.AddColorStop(1, col);
                            cr.SetSource(grad);
                        }
                    }
                }
                cr.Fill();

                if (TextEditor == null)
                {
                    return(true);
                }

                if (TextEditor.HighlightSearchPattern)
                {
                    DrawSearchResults(cr);
                    DrawSearchIndicator(cr);
                }
                else
                {
                    if (!Debugger.DebuggingService.IsDebugging)
                    {
                        var severity = DrawQuickTasks(cr);
                        DrawIndicator(cr, severity);
                    }
                }
                DrawCaret(cr);

                DrawBar(cr);
                DrawLeftBorder(cr);
            }

            return(true);
        }
        void DrawBackground(Cairo.Context cr, Gdk.Rectangle allocation)
        {
            cr.LineWidth = 1;
            cr.Rectangle(0, 0, allocation.Width, allocation.Height);

            if (TextEditor.ColorStyle != null)
            {
                if (MonoDevelop.Core.Platform.IsWindows)
                {
                    using (var pattern = new Cairo.SolidPattern(TextEditor.ColorStyle.PlainText.Background)) {
                        cr.SetSource(pattern);
                        cr.Fill();
                    }
                }
                else
                {
                    cr.SetSourceColor(TextEditor.ColorStyle.PlainText.Background);
                    cr.Fill();
                }
            }
            DrawLeftBorder(cr);
        }
        protected void DrawSearchIndicator(Cairo.Context cr)
        {
            int diameter = Math.Min(Allocation.Width, (int)IndicatorHeight) - indicatorPadding * 2;
            var x1       = Math.Round(Allocation.Width / 2d);
            var y1       = Allocation.Height - Math.Floor(IndicatorHeight / 2d);

            if (diameter % 2 == 0)
            {
                x1 += 0.5;
                y1 += 0.5;
            }

            cr.Arc(x1, y1, diameter / 2d, 0, 2 * Math.PI);

            var darkColor = (HslColor)TextEditor.ColorStyle.SearchResult.Color;

            darkColor.L *= 0.5;

            if (flatStyle)
            {
                using (var pattern = new Cairo.SolidPattern(TextEditor.ColorStyle.SearchResultMain.Color)) {
                    cr.Pattern = pattern;
                    cr.FillPreserve();
                }
            }
            else
            {
                using (var pattern = new Cairo.RadialGradient(x1, y1, Allocation.Width / 2, x1 - Allocation.Width, y1 - Allocation.Width, Allocation.Width)) {
                    pattern.AddColorStop(0, darkColor);
                    pattern.AddColorStop(1, TextEditor.ColorStyle.SearchResultMain.Color);
                    cr.Pattern = pattern;
                    cr.FillPreserve();
                }
            }

            cr.Color = darkColor;
            cr.Stroke();
        }
Ejemplo n.º 8
0
        void DrawBackground(Cairo.Context cr, Gdk.Rectangle allocation)
        {
            cr.LineWidth = 1;
            cr.Rectangle(0, 0, allocation.Width, allocation.Height);

            if (TextEditor.EditorTheme != null)
            {
                var bgColor = SyntaxHighlightingService.GetColor(TextEditor.EditorTheme, EditorThemeColors.Background);
                if (MonoDevelop.Core.Platform.IsWindows)
                {
                    using (var pattern = new Cairo.SolidPattern(bgColor)) {
                        cr.SetSource(pattern);
                        cr.Fill();
                    }
                }
                else
                {
                    cr.SetSourceColor(bgColor);
                    cr.Fill();
                }
            }
            DrawLeftBorder(cr);
        }
Ejemplo n.º 9
0
        void DrawIndicator(Cairo.Context cr, Cairo.Color color, Cairo.Color borderColor)
        {
            var width = Allocation.Width;

            int    diameter = Math.Min(width, (int)IndicatorHeight) - indicatorPadding * 2;
            var    x1       = Math.Round(width / 2d);
            double y1       = indicatorPadding + diameter / 2;

            if (diameter % 2 == 0)
            {
                x1 += 0.5;
                y1 += 0.5;
            }

            cr.Arc(x1, y1, diameter / 2d, 0, 2 * Math.PI);

            if (Platform.IsWindows)
            {
                using (var pattern = new Cairo.SolidPattern(color)) {
                    cr.SetSource(pattern);
                    cr.FillPreserve();
                }
            }
            else
            {
                using (var pattern = new Cairo.RadialGradient(x1, y1, width / 2, x1 - width, y1 - width, width)) {
                    pattern.AddColorStop(0, borderColor);
                    pattern.AddColorStop(1, color);
                    cr.SetSource(pattern);
                    cr.FillPreserve();
                }
            }

            cr.SetSourceColor(borderColor);
            cr.Stroke();
        }
Ejemplo n.º 10
0
		private void HeaderExpose (object ob, Gtk.ExposeEventArgs a)
		{
			Gdk.Rectangle rect = new Gdk.Rectangle (0, 0, header.Allocation.Width - 1, header.Allocation.Height);
			HslColor gcol = frame.Style.Background (Gtk.StateType.Normal);
			
			if (pointerHover)
				gcol.L *= 1.05;
			gcol.L = Math.Min (1, gcol.L);
				
			using (Cairo.Context cr = Gdk.CairoHelper.Create (a.Event.Window)) {
				cr.NewPath ();
				cr.MoveTo (0, 0);
				cr.RelLineTo (rect.Width, 0);
				cr.RelLineTo (0, rect.Height);
				cr.RelLineTo (-rect.Width, 0);
				cr.RelLineTo (0, -rect.Height);
				cr.ClosePath ();
				Cairo.SolidPattern solidPattern = new Cairo.SolidPattern (gcol);
				cr.Pattern = solidPattern;
				cr.FillPreserve ();
				solidPattern.Destroy ();
			}
			
			header.GdkWindow.DrawRectangle (frame.Style.DarkGC (Gtk.StateType.Normal), false, rect);
			
			foreach (Widget child in header.Children)
				header.PropagateExpose (child, a.Event);
		}
Ejemplo n.º 11
0
		void DrawBackground (Cairo.Context cr, Gdk.Rectangle allocation)
		{
			cr.LineWidth = 1;
			cr.Rectangle (0, 0, allocation.Width, allocation.Height);

			if (TextEditor.ColorStyle != null) {
				if (MonoDevelop.Core.Platform.IsWindows) {
					using (var pattern = new Cairo.SolidPattern (win81Background)) {
						cr.SetSource (pattern);
						cr.Fill ();
					}
				} else {
					var col = TextEditor.ColorStyle.PlainText.Background.ToXwtColor ();
					col.Light *= 0.948;
					using (var grad = new Cairo.LinearGradient (0, 0, allocation.Width, 0)) {
						grad.AddColorStop (0, col.ToCairoColor ());
						grad.AddColorStop (0.7, TextEditor.ColorStyle.PlainText.Background);
						grad.AddColorStop (1, col.ToCairoColor ());
						cr.SetSource (grad);
						cr.Fill ();
					}
				}
			}
			DrawLeftBorder (cr);
		}
        protected override bool OnExposeEvent(Gdk.EventExpose e)
        {
            if (TextEditor == null)
            {
                return(true);
            }
            using (Cairo.Context cr = Gdk.CairoHelper.Create(e.Window)) {
                cr.LineWidth = 1;
                cr.Rectangle(0, 0, Allocation.Width, Allocation.Height);

                if (TextEditor.ColorStyle != null)
                {
                    var col = (HslColor)TextEditor.ColorStyle.PlainText.Background;
                    col.L *= 0.95;
                    if (flatStyle)
                    {
                        using (var pattern = new Cairo.SolidPattern(col)) {
                            cr.Pattern = pattern;
                        }
                    }
                    else
                    {
                        using (var grad = new Cairo.LinearGradient(0, 0, Allocation.Width, 0)) {
                            grad.AddColorStop(0, col);
                            grad.AddColorStop(0.7, TextEditor.ColorStyle.PlainText.Background);
                            grad.AddColorStop(1, col);
                            cr.Pattern = grad;
                        }
                    }
                }
                cr.Fill();

                /*
                 * cr.Color = (HslColor)Style.Dark (State);
                 * cr.MoveTo (-0.5, 0.5);
                 * cr.LineTo (Allocation.Width, 0.5);
                 *
                 * cr.MoveTo (-0.5, Allocation.Height - 0.5);
                 * cr.LineTo (Allocation.Width, Allocation.Height - 0.5);
                 * cr.Stroke ();*/

                if (TextEditor == null)
                {
                    return(true);
                }

                if (TextEditor.HighlightSearchPattern)
                {
                    DrawSearchResults(cr);
                    DrawSearchIndicator(cr);
                }
                else
                {
                    if (!Debugger.DebuggingService.IsDebugging)
                    {
                        var severity = DrawQuickTasks(cr);
                        DrawIndicator(cr, severity);
                    }
                }
                DrawCaret(cr);

                DrawBar(cr);
                DrawLeftBorder(cr);
            }

            return(true);
        }
		protected override bool OnExposeEvent (Gdk.EventExpose e)
		{
			if (TextEditor == null)
				return true;
			using (Cairo.Context cr = Gdk.CairoHelper.Create (e.Window)) {
				cr.LineWidth = 1;
				cr.Rectangle (0, 0, Allocation.Width, Allocation.Height);
				
				if (TextEditor.ColorStyle != null) {
					var col = (HslColor)TextEditor.ColorStyle.PlainText.Background;
					col.L *= 0.95;
					if (flatStyle) {
						using (var pattern = new Cairo.SolidPattern (col)) {
							cr.Pattern = pattern;
						}
					} else {
						using (var grad = new Cairo.LinearGradient (0, 0, Allocation.Width, 0)) {
							grad.AddColorStop (0, col);
							grad.AddColorStop (0.7, TextEditor.ColorStyle.PlainText.Background);
							grad.AddColorStop (1, col);
							cr.Pattern = grad;
						}
					}
				}
				cr.Fill ();

				/*
				cr.Color = (HslColor)Style.Dark (State);
				cr.MoveTo (-0.5, 0.5);
				cr.LineTo (Allocation.Width, 0.5);

				cr.MoveTo (-0.5, Allocation.Height - 0.5);
				cr.LineTo (Allocation.Width, Allocation.Height - 0.5);
				cr.Stroke ();*/

				if (TextEditor == null)
					return true;
				
				if (TextEditor.HighlightSearchPattern) {
					DrawSearchResults (cr);
					DrawSearchIndicator (cr);
				} else {
					if (!Debugger.DebuggingService.IsDebugging) {
						var severity = DrawQuickTasks (cr);
						DrawIndicator (cr, severity);
					}
				}
				DrawCaret (cr);
				
				DrawBar (cr);
				DrawLeftBorder (cr);
			}
			
			return true;
		}
		protected void DrawSearchIndicator (Cairo.Context cr)
		{
			int diameter = Math.Min (Allocation.Width, (int)IndicatorHeight) - indicatorPadding * 2;
			var x1 = Math.Round (Allocation.Width / 2d);
			double y1 = indicatorPadding;
			if (diameter % 2 == 0) {
				x1 += 0.5;
				y1 += 0.5;
			}

			cr.Arc (x1, y1, diameter / 2d, 0, 2 * Math.PI);
			
			var darkColor = (HslColor)TextEditor.ColorStyle.SearchResult.Color;
			darkColor.L *= 0.5;

			if (flatStyle) {
				using (var pattern = new Cairo.SolidPattern (TextEditor.ColorStyle.SearchResultMain.Color)) {
					cr.Pattern = pattern;
					cr.FillPreserve ();
				}
			} else {
				using (var pattern = new Cairo.RadialGradient (x1, y1, Allocation.Width / 2, x1 - Allocation.Width, y1 - Allocation.Width, Allocation.Width)) {
					pattern.AddColorStop (0, darkColor);
					pattern.AddColorStop (1, TextEditor.ColorStyle.SearchResultMain.Color);
					cr.Pattern = pattern;
					cr.FillPreserve ();
				}
			}
			
			cr.Color = darkColor;
			cr.Stroke ();
		}
		void DrawBackground (Cairo.Context cr, Gdk.Rectangle allocation)
		{
			cr.LineWidth = 1;
			cr.Rectangle (0, 0, allocation.Width, allocation.Height);

			if (TextEditor.ColorStyle != null) {
				if (MonoDevelop.Core.Platform.IsWindows) {
					using (var pattern = new Cairo.SolidPattern (TextEditor.ColorStyle.PlainText.Background)) {
						cr.SetSource (pattern);
						cr.Fill ();
					}
				} else {
					cr.SetSourceColor (TextEditor.ColorStyle.PlainText.Background);
					cr.Fill ();
				}
			}
			DrawLeftBorder (cr);
		}
Ejemplo n.º 16
0
		void DrawIndicator (Cairo.Context cr, Cairo.Color color, Cairo.Color borderColor)
		{
			var width = Allocation.Width;

			int diameter = Math.Min (width, (int)IndicatorHeight) - indicatorPadding * 2;
			var x1 = Math.Round (width / 2d);
			double y1 = indicatorPadding + diameter / 2;
			if (diameter % 2 == 0) {
				x1 += 0.5;
				y1 += 0.5;
			}

			cr.Arc (x1, y1, diameter / 2d, 0, 2 * Math.PI);

			if (Platform.IsWindows) {
				using (var pattern = new Cairo.SolidPattern (color)) {
					cr.SetSource (pattern);
					cr.FillPreserve ();
				}
			} else {
				using (var pattern = new Cairo.RadialGradient (x1, y1, width / 2, x1 - width, y1 - width, width)) {
					pattern.AddColorStop (0, borderColor);
					pattern.AddColorStop (1, color);
					cr.SetSource (pattern);
					cr.FillPreserve ();
				}
			}
			
			cr.SetSourceColor (borderColor);
			cr.Stroke ();
		}
Ejemplo n.º 17
0
 protected virtual void ShapeSurface (Cairo.Context cr, Cairo.Color color)
 {
     cr.Operator = Cairo.Operator.Source;
     Cairo.Pattern pattern = new Cairo.SolidPattern (color, false);
     cr.Source = pattern;
     pattern.Destroy ();
     cr.Paint ();
 }
Ejemplo n.º 18
0
		protected override bool OnExposeEvent (Gdk.EventExpose e)
		{
			if (TextEditor == null)
				return true;
			using (Cairo.Context cr = Gdk.CairoHelper.Create (e.Window)) {
				cr.LineWidth = 1;
				cr.Rectangle (0, 0, Allocation.Width, Allocation.Height);
				
				if (TextEditor.ColorStyle != null) {
					if (Platform.IsWindows) {
						using (var pattern = new Cairo.SolidPattern (win81Background)) {
							cr.SetSource (pattern);
						}
					} else {
						var col = new Cairo.Color (229 / 255.0, 229 / 255.0, 229 / 255.0);
						using (var grad = new Cairo.LinearGradient (0, 0, Allocation.Width, 0)) {
							grad.AddColorStop (0, col);
							grad.AddColorStop (0.5, new Cairo.Color (1, 1, 1));
							grad.AddColorStop (1, col);
							cr.SetSource (grad);
						}
					}
				}
				cr.Fill ();

				if (TextEditor == null)
					return true;
				
				if (TextEditor.HighlightSearchPattern) {
					DrawSearchResults (cr);
					DrawSearchIndicator (cr);
				} else {
					if (!Debugger.DebuggingService.IsDebugging) {
						var severity = DrawQuickTasks (cr);
						DrawIndicator (cr, severity);
					}
				}
				DrawCaret (cr);
				
				DrawBar (cr);
				DrawLeftBorder (cr);
			}
			
			return true;
		}
Ejemplo n.º 19
0
 protected virtual void ShapeSurface(Cairo.Context cr, Cairo.Color color)
 {
     cr.Operator = Cairo.Operator.Source;
     using (var pattern = new Cairo.SolidPattern (color, false)) {
         cr.SetSource (pattern);
         cr.Paint ();
     }
 }