예제 #1
0
        public OptionsDialog(MonoDevelop.Components.Window parentWindow, object dataObject, string extensionPath, bool removeEmptySections)
        {
            buttonCancel = new Gtk.Button(Gtk.Stock.Cancel);
            AddActionWidget(this.buttonCancel, ResponseType.Cancel);

            buttonOk = new Gtk.Button(Gtk.Stock.Ok);
            this.ActionArea.PackStart(buttonOk);
            buttonOk.Clicked += OnButtonOkClicked;

            mainHBox = new HBox();
            tree     = new TreeView();
            var sw = new ScrolledWindow();

            sw.Add(tree);
            sw.HscrollbarPolicy = PolicyType.Never;
            sw.VscrollbarPolicy = PolicyType.Automatic;
            sw.ShadowType       = ShadowType.None;

            var fboxTree = new HeaderBox();

            fboxTree.SetMargins(0, 1, 0, 1);
            fboxTree.SetPadding(0, 0, 0, 0);
            fboxTree.BackgroundColor = new Gdk.Color(255, 255, 255);
            fboxTree.Add(sw);
            mainHBox.PackStart(fboxTree, false, false, 0);

            Realized += delegate {
                fboxTree.BackgroundColor = tree.Style.Base(Gtk.StateType.Normal);
            };

            var vbox = new VBox();

            mainHBox.PackStart(vbox, true, true, 0);
            var headerBox = new HBox(false, 6);

            labelTitle        = new Label();
            labelTitle.Xalign = 0;
            textHeader        = new Alignment(0, 0, 1, 1);
            textHeader.Add(labelTitle);
            textHeader.BorderWidth = 12;
            headerBox.PackStart(textHeader, true, true, 0);

            imageHeader = new OptionsDialogHeader();
            imageHeader.Hide();
            headerBox.PackStart(imageHeader.ToGtkWidget());

            var fboxHeader = new HeaderBox();

            fboxHeader.SetMargins(0, 1, 0, 0);
            fboxHeader.Add(headerBox);
//			fbox.GradientBackround = true;
//			fbox.BackgroundColor = new Gdk.Color (255, 255, 255);
            Realized += delegate {
                var c = Style.Background(Gtk.StateType.Normal).ToXwtColor();
                c.Light += 0.09;
                fboxHeader.BackgroundColor = c.ToGdkColor();
            };
            StyleSet += delegate {
                if (IsRealized)
                {
                    var c = Style.Background(Gtk.StateType.Normal).ToXwtColor();
                    c.Light += 0.09;
                    fboxHeader.BackgroundColor = c.ToGdkColor();
                }
            };
            vbox.PackStart(fboxHeader, false, false, 0);

            pageFrame = new HBox();
            var fbox = new HeaderBox();

            fbox.SetMargins(0, 1, 0, 0);
            fbox.ShowTopShadow = true;
            fbox.Add(pageFrame);
            vbox.PackStart(fbox, true, true, 0);

            this.VBox.PackStart(mainHBox, true, true, 0);

            this.removeEmptySections = removeEmptySections;
            extensionContext         = AddinManager.CreateExtensionContext();

            this.mainDataObject = dataObject;
            this.extensionPath  = extensionPath;

            if (parentWindow != null)
            {
                TransientFor = parentWindow;
            }

            ImageService.EnsureStockIconIsLoaded(emptyCategoryIcon);

            store               = new TreeStore(typeof(OptionsDialogSection));
            tree.Model          = store;
            tree.HeadersVisible = false;

            // Column 0 is used to add some padding at the left of the expander
            TreeViewColumn col0 = new TreeViewColumn();

            col0.MinWidth = 6;
            tree.AppendColumn(col0);

            TreeViewColumn col = new TreeViewColumn();
            var            crp = new CellRendererImage();

            col.PackStart(crp, false);
            col.SetCellDataFunc(crp, PixbufCellDataFunc);
            var crt = new CellRendererText();

            col.PackStart(crt, true);
            col.SetCellDataFunc(crt, TextCellDataFunc);
            tree.AppendColumn(col);

            tree.ExpanderColumn = col;

            tree.Selection.Changed += OnSelectionChanged;

            Child.ShowAll();

            InitializeContext(extensionContext);

            FillTree();
            ExpandCategories();
            RestoreLastPanel();
            this.DefaultResponse = Gtk.ResponseType.Ok;

            buttonOk.CanDefault = true;
            buttonOk.GrabDefault();

            DefaultWidth  = 960;
            DefaultHeight = 680;
        }
예제 #2
0
        protected override bool OnExposeEvent(Gdk.EventExpose evnt)
        {
            Gdk.Rectangle rect = Allocation;

            //Gdk.Rectangle.Right and Bottom are inconsistent
            int right = rect.X + rect.Width, bottom = rect.Y + rect.Height;

            var bcolor = backgroundColorSet ? BackgroundColor : Style.Background(Gtk.StateType.Normal);

            using (Cairo.Context cr = Gdk.CairoHelper.Create(evnt.Window)) {
                if (GradientBackround)
                {
                    cr.NewPath();
                    cr.MoveTo(rect.X, rect.Y);
                    cr.RelLineTo(rect.Width, 0);
                    cr.RelLineTo(0, rect.Height);
                    cr.RelLineTo(-rect.Width, 0);
                    cr.RelLineTo(0, -rect.Height);
                    cr.ClosePath();

                    // FIXME: VV: Remove gradient features
                    using (Cairo.Gradient pat = new Cairo.LinearGradient(rect.X, rect.Y, rect.X, bottom)) {
                        pat.AddColorStop(0, bcolor.ToCairoColor());
                        Xwt.Drawing.Color gcol = bcolor.ToXwtColor();
                        gcol.Light -= 0.1;
                        if (gcol.Light < 0)
                        {
                            gcol.Light = 0;
                        }
                        pat.AddColorStop(1, gcol.ToCairoColor());
                        cr.SetSource(pat);
                        cr.Fill();
                    }
                }
                else
                {
                    if (backgroundColorSet)
                    {
                        Gdk.GC gc = new Gdk.GC(GdkWindow);
                        gc.RgbFgColor = bcolor;
                        evnt.Window.DrawRectangle(gc, true, rect.X, rect.Y, rect.Width, rect.Height);
                        gc.Dispose();
                    }
                }
            }
            base.OnExposeEvent(evnt);

            using (Cairo.Context cr = Gdk.CairoHelper.Create(evnt.Window)) {
                cr.SetSourceColor(BorderColor.ToCairoColor());

                double y = rect.Y + topMargin / 2d;
                cr.LineWidth = topMargin;
                cr.Line(rect.X, y, right, y);
                cr.Stroke();

                y            = bottom - bottomMargin / 2d;
                cr.LineWidth = bottomMargin;
                cr.Line(rect.X, y, right, y);
                cr.Stroke();

                double x = rect.X + leftMargin / 2d;
                cr.LineWidth = leftMargin;
                cr.Line(x, rect.Y, x, bottom);
                cr.Stroke();

                x            = right - rightMargin / 2d;
                cr.LineWidth = rightMargin;
                cr.Line(x, rect.Y, x, bottom);
                cr.Stroke();

                return(false);
            }
        }
예제 #3
0
        protected override bool OnExposeEvent(Gdk.EventExpose evnt)
        {
            if (State == StateType.Prelight)
            {
                int    w = Allocation.Width, h = Allocation.Height;
                double x = Allocation.Left, y = Allocation.Top, r = 3;
                x += 0.5; y += 0.5; h -= 1; w -= 1;

                using (Cairo.Context ctx = Gdk.CairoHelper.Create(GdkWindow)) {
                    HslColor c  = new HslColor(Style.Background(Gtk.StateType.Normal));
                    HslColor c1 = c;
                    HslColor c2 = c;
                    if (State != StateType.Prelight)
                    {
                        c1.L *= 0.8;
                        c2.L *= 0.95;
                    }
                    else
                    {
                        c1.L *= 1.1;
                        c2.L *= 1;
                    }
                    Cairo.Gradient pat;
                    switch (bar.Position)
                    {
                    case PositionType.Top: pat = new Cairo.LinearGradient(x, y, x, y + h); break;

                    case PositionType.Bottom: pat = new Cairo.LinearGradient(x, y, x, y + h); break;

                    case PositionType.Left: pat = new Cairo.LinearGradient(x + w, y, x, y); break;

                    default: pat = new Cairo.LinearGradient(x, y, x + w, y); break;
                    }
                    pat.AddColorStop(0, c1);
                    pat.AddColorStop(1, c2);
                    ctx.NewPath();
                    ctx.Arc(x + r, y + r, r, 180 * (Math.PI / 180), 270 * (Math.PI / 180));
                    ctx.LineTo(x + w - r, y);
                    ctx.Arc(x + w - r, y + r, r, 270 * (Math.PI / 180), 360 * (Math.PI / 180));
                    ctx.LineTo(x + w, y + h);
                    ctx.LineTo(x, y + h);
                    ctx.ClosePath();
                    ctx.Pattern = pat;
                    ctx.FillPreserve();
                    c1            = c;
                    c1.L         *= 0.7;
                    ctx.LineWidth = 1;
                    ctx.Color     = c1;
                    ctx.Stroke();

                    // Inner line
                    ctx.NewPath();
                    ctx.Arc(x + r + 1, y + r + 1, r, 180 * (Math.PI / 180), 270 * (Math.PI / 180));
                    ctx.LineTo(x + w - r - 1, y + 1);
                    ctx.Arc(x + w - r - 1, y + r + 1, r, 270 * (Math.PI / 180), 360 * (Math.PI / 180));
                    ctx.LineTo(x + w - 1, y + h - 1);
                    ctx.LineTo(x + 1, y + h - 1);
                    ctx.ClosePath();
                    c1 = c;
                    //c1.L *= 0.9;
                    ctx.LineWidth = 1;
                    ctx.Color     = c1;
                    ctx.Stroke();
                }
            }

            bool res = base.OnExposeEvent(evnt);

            return(res);
        }
		protected override bool OnExposeEvent (Gdk.EventExpose evnt)
		{
			Gdk.Rectangle rect;
			
			if (GradientBackground) {
				rect = new Gdk.Rectangle (Allocation.X, Allocation.Y, Allocation.Width, Allocation.Height);
				var gcol = Style.Background (Gtk.StateType.Normal).ToXwtColor ();
				
				using (Cairo.Context cr = Gdk.CairoHelper.Create (GdkWindow)) {
					cr.NewPath ();
					cr.MoveTo (rect.X, rect.Y);
					cr.RelLineTo (rect.Width, 0);
					cr.RelLineTo (0, rect.Height);
					cr.RelLineTo (-rect.Width, 0);
					cr.RelLineTo (0, -rect.Height);
					cr.ClosePath ();
					using (Cairo.Gradient pat = new Cairo.LinearGradient (rect.X, rect.Y, rect.X, rect.Bottom)) {
						pat.AddColorStop (0, gcol.ToCairoColor ());
						gcol.Light -= 0.1;
						if (gcol.Light < 0)
							gcol.Light = 0;
						pat.AddColorStop (1, gcol.ToCairoColor ());
						cr.SetSource (pat);
						cr.FillPreserve ();
					}
				}
			} else if (BackgroundColor != null) {
				using (Cairo.Context cr = Gdk.CairoHelper.Create (GdkWindow)) {
					cr.Rectangle (Allocation.X, Allocation.Y, Allocation.Width, Allocation.Height);
					cr.SetSourceColor (BackgroundColor.Value.ToCairoColor ());
					cr.Fill ();
				}
			} else if (useChildBackgroundColor && Child != null) {
				using (Cairo.Context cr = Gdk.CairoHelper.Create (GdkWindow)) {
					cr.Rectangle (Allocation.X, Allocation.Y, Allocation.Width, Allocation.Height);
					cr.SetSourceColor (Child.Style.Base (StateType.Normal).ToCairoColor ());
					cr.Fill ();
				}
			}
			
			bool res = base.OnExposeEvent (evnt);
			
			var borderColor = new Gdk.GC (GdkWindow);
			borderColor.RgbFgColor = BorderColor != null ? BorderColor.Value : Style.Dark (Gtk.StateType.Normal);

			rect = Allocation;
			for (int n=0; n<topMargin; n++)
				GdkWindow.DrawLine (borderColor, rect.X, rect.Y + n, rect.Right - 1, rect.Y + n);
			
			for (int n=0; n<bottomMargin; n++)
				GdkWindow.DrawLine (borderColor, rect.X, rect.Bottom - n, rect.Right, rect.Bottom - n);
			
			for (int n=0; n<leftMargin; n++)
				GdkWindow.DrawLine (borderColor, rect.X + n, rect.Y, rect.X + n, rect.Bottom);
			
			for (int n=0; n<rightMargin; n++)
				GdkWindow.DrawLine (borderColor, rect.Right - n, rect.Y, rect.Right - n, rect.Bottom);

			if (showTopShadow) {
				using (Cairo.Context cr = Gdk.CairoHelper.Create (GdkWindow)) {
					cr.Rectangle (Allocation.X, Allocation.Y, Allocation.Width, shadowSize);
					using (Cairo.Gradient pat = new Cairo.LinearGradient (rect.X, rect.Y, rect.X, rect.Y + shadowSize)) {
						pat.AddColorStop (0, new Cairo.Color (0, 0, 0, shadowStrengh));
						pat.AddColorStop (1, new Cairo.Color (0, 0, 0, 0));
						cr.SetSource (pat);
						cr.Fill ();
					}
				}
			}

			borderColor.Dispose ();
			return res;
		}
예제 #5
0
 protected override void OnStyleSet(Style previous_style)
 {
     base.OnStyleSet(previous_style);
     name_renderer.CellBackgroundGdk = Style.Background(StateType.Normal);
 }
예제 #6
0
        public void UpdateContent(string html)
        {
            Thread thread = new Thread(new ThreadStart(delegate {
                if (html == null)
                {
                    html = Controller.HTML;
                }

                if (html == null)
                {
                    return;
                }

                html = html.Replace("<!-- $body-font-size -->", (double)(Style.FontDescription.Size / 1024 + 3) + "px");
                html = html.Replace("<!-- $day-entry-header-font-size -->", (Style.FontDescription.Size / 1024 + 3) + "px");
                html = html.Replace("<!-- $a-color -->", "#0085cf");
                html = html.Replace("<!-- $a-hover-color -->", "#009ff8");
                html = html.Replace("<!-- $body-font-family -->", "\"" + Style.FontDescription.Family + "\"");
                html = html.Replace("<!-- $body-color -->", SparkleUIHelpers.GdkColorToHex(Style.Foreground(StateType.Normal)));
                html = html.Replace("<!-- $body-background-color -->", SparkleUIHelpers.GdkColorToHex(new TreeView().Style.Base(StateType.Normal)));
                html = html.Replace("<!-- $day-entry-header-background-color -->", SparkleUIHelpers.GdkColorToHex(Style.Background(StateType.Normal)));
                html = html.Replace("<!-- $secondary-font-color -->", SparkleUIHelpers.GdkColorToHex(Style.Foreground(StateType.Insensitive)));
                html = html.Replace("<!-- $small-color -->", SparkleUIHelpers.GdkColorToHex(Style.Foreground(StateType.Insensitive)));
                html = html.Replace("<!-- $no-buddy-icon-background-image -->", "file://" +
                                    new string [] { SparkleUI.AssetsPath, "icons",
                                                    "hicolor", "32x32", "status", "avatar-default.png" }.Combine());
                html = html.Replace("<!-- $document-added-background-image -->", "file://" +
                                    new string [] { SparkleUI.AssetsPath, "icons",
                                                    "hicolor", "12x12", "status", "document-added.png" }.Combine());
                html = html.Replace("<!-- $document-edited-background-image -->", "file://" +
                                    new string [] { SparkleUI.AssetsPath, "icons",
                                                    "hicolor", "12x12", "status", "document-edited.png" }.Combine());
                html = html.Replace("<!-- $document-deleted-background-image -->", "file://" +
                                    new string [] { SparkleUI.AssetsPath, "icons",
                                                    "hicolor", "12x12", "status", "document-deleted.png" }.Combine());
                html = html.Replace("<!-- $document-moved-background-image -->", "file://" +
                                    new string [] { SparkleUI.AssetsPath, "icons",
                                                    "hicolor", "12x12", "status", "document-moved.png" }.Combine());

                Application.Invoke(delegate {
                    this.spinner.Stop();
                    this.web_view.LoadString(html, null, null, "file:///");
                    this.content_wrapper.Remove(this.content_wrapper.Child);
                    this.content_wrapper.Add(this.scrolled_window);
                    this.content_wrapper.ShowAll();
                });
            }));

            thread.Start();
        }
예제 #7
0
 private void PreparePlot(Context context)
 {
     context.Rectangle(0, 0, VirtualSize.Width, VirtualSize.Height);
     context.Color = Style.Background(StateType.Normal).ToCairoColor();
     context.Fill();
 }
예제 #8
0
        private void Redraw(Cairo.Context cr)
        {
            // Clear the background
            cr.Rectangle(0, 0, Allocation.Width, Allocation.Height);
            Gdk.CairoHelper.SetSourceColor(cr, Style.Base(State));
            cr.Fill();

            if (model == null)
            {
                if (hadj != null)
                {
                    hadj.Upper = hadj.Lower = 0;
                    hadj.Change();
                }

                if (vadj != null)
                {
                    vadj.Upper = 0;
                    vadj.Change();
                }
                return;
            }

            if (rows == 0 || cols == 0)
            {
                return;
            }

            Gdk.Rectangle background_area = cell_size;
            background_area.Width  += padding;
            background_area.Height += padding;

            TreeIter iter;

            if (model.GetIterFirst(out iter))
            {
                do
                {
                    TreePath path = model.GetPath(iter);

                    int x, y;
                    GetCellPosition(path.Indices[0], out x, out y);

                    if (hadj != null &&
                        (x + cell_size.Width < hadj.Value ||
                         x > hadj.Value + hadj.PageSize))
                    {
                        continue;
                    }

                    if (vadj != null &&
                        (y + cell_size.Height < vadj.Value ||
                         y > vadj.Value + vadj.PageSize))
                    {
                        continue;
                    }

                    if (data_func != null)
                    {
                        data_func(this, renderer, model, iter);
                    }

                    cell_size.X = x;
                    cell_size.Y = y;

                    if (hadj != null)
                    {
                        cell_size.X -= (int)hadj.Value;
                    }

                    if (vadj != null)
                    {
                        cell_size.Y -= (int)vadj.Value;
                    }

                    background_area.X = cell_size.X - (padding / 2);
                    background_area.Y = cell_size.Y - (padding / 2);

                    cr.Rectangle(background_area.X, background_area.Y,
                                 background_area.Width, background_area.Height);
                    cr.Clip();

                    renderer.Render(cr, this, background_area,
                                    cell_size, GetCellState(path));

                    cr.ResetClip();
                } while (model.IterNext(ref iter));
            }

            if (have_rubberband_selection)
            {
                int hadj_val = (hadj != null) ? (int)hadj.Value : 0;
                int vadj_val = (vadj != null) ? (int)vadj.Value : 0;

                cr.Rectangle(sel_rect.X - hadj_val + 0.5f, sel_rect.Y - vadj_val + 0.5f,
                             sel_rect.Width, sel_rect.Height);

                Cairo.Color sel_cairo_color = CairoHelper.GetCairoColor(Style.Background(StateType.Selected));



                //cr.Color = sel_cairo_color;
                cr.SetSourceRGBA(sel_cairo_color.R, sel_cairo_color.G, sel_cairo_color.B, sel_cairo_color.A);

                cr.LineWidth = 1.0f;
                cr.StrokePreserve();

                sel_cairo_color.A = 0.3f;
                //cr.Color = sel_cairo_color;
                cr.SetSourceRGBA(sel_cairo_color.R, sel_cairo_color.G, sel_cairo_color.B, sel_cairo_color.A);

                cr.Fill();
            }
        }
예제 #9
0
        protected override bool OnExposeEvent(Gdk.EventExpose evnt)
        {
            Gdk.Rectangle rect = Allocation;

            //Gdk.Rectangle.Right and Bottom are inconsistent
            int right = rect.X + rect.Width, bottom = rect.Y + rect.Height;

            if (GradientBackround)
            {
                HslColor gcol = Style.Background(Gtk.StateType.Normal);

                using (Cairo.Context cr = Gdk.CairoHelper.Create(evnt.Window)) {
                    cr.NewPath();
                    cr.MoveTo(rect.X, rect.Y);
                    cr.RelLineTo(rect.Width, 0);
                    cr.RelLineTo(0, rect.Height);
                    cr.RelLineTo(-rect.Width, 0);
                    cr.RelLineTo(0, -rect.Height);
                    cr.ClosePath();
                    Cairo.Gradient pat    = new Cairo.LinearGradient(rect.X, rect.Y, rect.X, bottom);
                    Cairo.Color    color1 = gcol;
                    pat.AddColorStop(0, color1);
                    gcol.L -= 0.1;
                    if (gcol.L < 0)
                    {
                        gcol.L = 0;
                    }
                    pat.AddColorStop(1, gcol);
                    cr.Pattern = pat;
                    cr.FillPreserve();
                }
            }

            bool res = base.OnExposeEvent(evnt);

            using (Cairo.Context cr = Gdk.CairoHelper.Create(evnt.Window)) {
                cr.Color = (HslColor)Style.Dark(Gtk.StateType.Normal);

                double y = rect.Y + topMargin / 2d;
                cr.LineWidth = topMargin;
                cr.Line(rect.X, y, right, y);
                cr.Stroke();

                y            = bottom - bottomMargin / 2d;
                cr.LineWidth = bottomMargin;
                cr.Line(rect.X, y, right, y);
                cr.Stroke();

                double x = rect.X + leftMargin / 2d;
                cr.LineWidth = leftMargin;
                cr.Line(x, rect.Y, x, bottom);
                cr.Stroke();

                x            = right - rightMargin / 2d;
                cr.LineWidth = rightMargin;
                cr.Line(x, rect.Y, x, bottom);
                cr.Stroke();
            }

            return(res);
        }
예제 #10
0
        protected override bool OnExposeEvent(Gdk.EventExpose evnt)
        {
            Gdk.Rectangle rect;

            if (DrawBackground)
            {
                GdkWindow.DrawRectangle(Style.BackgroundGC(Gtk.StateType.Normal), true, Allocation.X, Allocation.Y, Allocation.Width - 1, Allocation.Height - 1);
            }

            if (GradientBackround)
            {
                rect = new Gdk.Rectangle(Allocation.X, Allocation.Y, Allocation.Width, Allocation.Height);
                Color gcol = Util.ToXwtColor(Style.Background(Gtk.StateType.Normal));

                using (Cairo.Context cr = Gdk.CairoHelper.Create(GdkWindow)) {
                    cr.NewPath();
                    cr.MoveTo(rect.X, rect.Y);
                    cr.RelLineTo(rect.Width, 0);
                    cr.RelLineTo(0, rect.Height);
                    cr.RelLineTo(-rect.Width, 0);
                    cr.RelLineTo(0, -rect.Height);
                    cr.ClosePath();
                    Cairo.Gradient pat    = new Cairo.LinearGradient(rect.X, rect.Y, rect.X, rect.Bottom);
                    Cairo.Color    color1 = gcol.ToCairoColor();
                    pat.AddColorStop(0, color1);
                    gcol.Light -= 0.1;
                    pat.AddColorStop(1, gcol.ToCairoColor());
                    cr.Pattern = pat;
                    cr.FillPreserve();
                }
            }

            bool res = base.OnExposeEvent(evnt);

            Gdk.GC borderColor;
            if (color != null)
            {
                borderColor            = new Gdk.GC(GdkWindow);
                borderColor.RgbFgColor = Util.ToGdkColor(color.Value);
            }
            else
            {
                borderColor = Style.DarkGC(Gtk.StateType.Normal);
            }

            rect = Allocation;
            for (int n = 0; n < topMargin; n++)
            {
                GdkWindow.DrawLine(borderColor, rect.X, rect.Y + n, rect.Right, rect.Y + n);
            }

            for (int n = 0; n < bottomMargin; n++)
            {
                GdkWindow.DrawLine(borderColor, rect.X, rect.Bottom - n, rect.Right, rect.Bottom - n);
            }

            for (int n = 0; n < leftMargin; n++)
            {
                GdkWindow.DrawLine(borderColor, rect.X + n, rect.Y, rect.X + n, rect.Bottom);
            }

            for (int n = 0; n < rightMargin; n++)
            {
                GdkWindow.DrawLine(borderColor, rect.Right - n, rect.Y, rect.Right - n, rect.Bottom);
            }

            if (color != null)
            {
                borderColor.Dispose();
            }

            return(res);
        }
예제 #11
0
        protected override bool OnExposeEvent(Gdk.EventExpose evnt)
        {
            Gdk.Rectangle rect = Allocation;

            if (GradientBackround)
            {
                HslColor gcol = Style.Background(Gtk.StateType.Normal);

                using (Cairo.Context cr = Gdk.CairoHelper.Create(GdkWindow)) {
                    cr.NewPath();
                    cr.MoveTo(rect.X, rect.Y);
                    cr.RelLineTo(rect.Width, 0);
                    cr.RelLineTo(0, rect.Height);
                    cr.RelLineTo(-rect.Width, 0);
                    cr.RelLineTo(0, -rect.Height);
                    cr.ClosePath();
                    Cairo.Gradient pat    = new Cairo.LinearGradient(rect.X, rect.Y, rect.X, rect.Bottom);
                    Cairo.Color    color1 = gcol;
                    pat.AddColorStop(0, color1);
                    gcol.L -= 0.1;
                    if (gcol.L < 0)
                    {
                        gcol.L = 0;
                    }
                    pat.AddColorStop(1, gcol);
                    cr.Pattern = pat;
                    cr.FillPreserve();
                }
            }

            bool res = base.OnExposeEvent(evnt);

            //for some reason we seem to need to paint a sightly bigger box to align with the header
            //even though the allocation appears to be the same
            rect.Width  += 1;
            rect.Height += 1;

            using (Cairo.Context cr = Gdk.CairoHelper.Create(GdkWindow)) {
                cr.Color = (HslColor)Style.Dark(Gtk.StateType.Normal);

                double y = rect.Y + topMargin / 2d;
                cr.LineWidth = topMargin;
                cr.Line(rect.X, y, rect.Right, y);
                cr.Stroke();

                y            = rect.Bottom - bottomMargin / 2d;
                cr.LineWidth = bottomMargin;
                cr.Line(rect.X, y, rect.Right, y);
                cr.Stroke();

                double x = rect.X + leftMargin / 2d;
                cr.LineWidth = leftMargin;
                cr.Line(x, rect.Y, x, rect.Bottom);
                cr.Stroke();

                x            = rect.Right - rightMargin / 2d;
                cr.LineWidth = rightMargin;
                cr.Line(x, rect.Y, x, rect.Bottom);
                cr.Stroke();
            }

            return(res);
        }
예제 #12
0
        public void UpdateContent(string html)
        {
            string pixmaps_path = IO.Path.Combine(SparkleUI.AssetsPath, "pixmaps");
            string icons_path = new string [] { SparkleUI.AssetsPath, "icons", "hicolor", "12x12", "status" }.Combine();

            html = html.Replace("<!-- $body-font-size -->", (double)(Style.FontDescription.Size / 1024 + 3) + "px");
            html = html.Replace("<!-- $day-entry-header-font-size -->", (Style.FontDescription.Size / 1024 + 3) + "px");
            html = html.Replace("<!-- $a-color -->", "#0085cf");
            html = html.Replace("<!-- $a-hover-color -->", "#009ff8");
            html = html.Replace("<!-- $body-font-family -->", "\"" + Style.FontDescription.Family + "\"");
            html = html.Replace("<!-- $body-color -->", SparkleUIHelpers.GdkColorToHex(Style.Foreground(StateType.Normal)));
            html = html.Replace("<!-- $body-background-color -->", SparkleUIHelpers.GdkColorToHex(new TreeView().Style.Base(StateType.Normal)));
            html = html.Replace("<!-- $day-entry-header-background-color -->", SparkleUIHelpers.GdkColorToHex(Style.Background(StateType.Normal)));
            html = html.Replace("<!-- $secondary-font-color -->", SparkleUIHelpers.GdkColorToHex(Style.Foreground(StateType.Insensitive)));
            html = html.Replace("<!-- $small-color -->", SparkleUIHelpers.GdkColorToHex(Style.Foreground(StateType.Insensitive)));
            html = html.Replace("<!-- $small-font-size -->", "85%");
            html = html.Replace("<!-- $pixmaps-path -->", pixmaps_path);
            html = html.Replace("<!-- $document-added-background-image -->", "file://" + IO.Path.Combine(icons_path, "document-added.png"));
            html = html.Replace("<!-- $document-edited-background-image -->", "file://" + IO.Path.Combine(icons_path, "document-edited.png"));
            html = html.Replace("<!-- $document-deleted-background-image -->", "file://" + IO.Path.Combine(icons_path, "document-deleted.png"));
            html = html.Replace("<!-- $document-moved-background-image -->", "file://" + IO.Path.Combine(icons_path, "document-moved.png"));

            this.spinner.Stop();

            this.web_view.NavigationRequested -= WebViewNavigationRequested;
            this.web_view.LoadHtmlString(html, "file://");
            this.web_view.NavigationRequested += WebViewNavigationRequested;

            this.content_wrapper.Remove(this.content_wrapper.Child);
            this.content_wrapper.Add(this.scrolled_window);
            this.content_wrapper.ShowAll();
        }
예제 #13
0
        private void GenerateHTML()
        {
            HTML = SparkleShare.Controller.GetHTMLLog(System.IO.Path.GetFileName(LocalPath));

            HTML = HTML.Replace("<!-- $body-font-size -->", (double)(Style.FontDescription.Size / 1024 + 3) + "px");
            HTML = HTML.Replace("<!-- $day-entry-header-font-size -->", (Style.FontDescription.Size / 1024 + 3) + "px");
            HTML = HTML.Replace("<!-- $a-color -->", "#0085cf");
            HTML = HTML.Replace("<!-- $a-hover-color -->", "#009ff8");
            HTML = HTML.Replace("<!-- $body-font-family -->", "\"" + Style.FontDescription.Family + "\"");
            HTML = HTML.Replace("<!-- $body-color -->", SparkleUIHelpers.GdkColorToHex(Style.Foreground(StateType.Normal)));
            HTML = HTML.Replace("<!-- $body-background-color -->", SparkleUIHelpers.GdkColorToHex(new TreeView().Style.Base(StateType.Normal)));
            HTML = HTML.Replace("<!-- $day-entry-header-background-color -->", SparkleUIHelpers.GdkColorToHex(Style.Background(StateType.Normal)));
            HTML = HTML.Replace("<!-- $secondary-font-color -->", SparkleUIHelpers.GdkColorToHex(Style.Foreground(StateType.Insensitive)));
            HTML = HTML.Replace("<!-- $small-color -->", SparkleUIHelpers.GdkColorToHex(Style.Foreground(StateType.Insensitive)));
            HTML = HTML.Replace("<!-- $no-buddy-icon-background-image -->", "file://" +
                                SparkleHelpers.CombineMore(Defines.PREFIX, "share", "sparkleshare", "icons",
                                                           "hicolor", "32x32", "status", "avatar-default.png"));
        }