[gimp/gtk3-port: 193/226] app: add style property and default CSS for GimpHistogramView's grid-color
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gtk3-port: 193/226] app: add style property and default CSS for GimpHistogramView's grid-color
- Date: Tue, 21 Feb 2012 00:33:24 +0000 (UTC)
commit e225197c6936aa388cce53c821de6cafe06904d9
Author: Michael Natterer <mitch gimp org>
Date: Mon Feb 7 22:18:15 2011 +0100
app: add style property and default CSS for GimpHistogramView's grid-color
app/widgets/gimphistogramview.c | 29 +++++++++++++++++++++++------
1 files changed, 23 insertions(+), 6 deletions(-)
---
diff --git a/app/widgets/gimphistogramview.c b/app/widgets/gimphistogramview.c
index 3eecf6a..55dfdeb 100644
--- a/app/widgets/gimphistogramview.c
+++ b/app/widgets/gimphistogramview.c
@@ -28,6 +28,7 @@
#include "core/gimpmarshal.h"
#include "gimphistogramview.h"
+#include "gimpwidgets-utils.h"
#define MIN_WIDTH 64
@@ -155,15 +156,33 @@ gimp_histogram_view_class_init (GimpHistogramViewClass *klass)
1, 64, 5,
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
+
+ gtk_widget_class_install_style_property (widget_class,
+ g_param_spec_boxed ("grid-color",
+ NULL, NULL,
+ GDK_TYPE_RGBA,
+ GIMP_PARAM_READABLE));
}
static void
gimp_histogram_view_init (GimpHistogramView *view)
{
+ GtkCssProvider *css;
+
view->histogram = NULL;
view->bg_histogram = NULL;
view->start = 0;
view->end = 255;
+
+ css = gtk_css_provider_new ();
+ gtk_css_provider_load_from_data (css,
+ "GimpHistogramView {\n"
+ " -GimpHistogramView-grid-color: darker (@bg_color);\n"
+ "}\n", -1, NULL);
+ gtk_style_context_add_provider (gtk_widget_get_style_context (GTK_WIDGET (view)),
+ GTK_STYLE_PROVIDER (css),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ g_object_unref (css);
}
static void
@@ -343,6 +362,7 @@ gimp_histogram_view_draw (GtkWidget *widget,
gdouble max = 0.0;
gdouble bg_max = 0.0;
gint xstop;
+ GdkRGBA grid_color;
GdkRGBA color;
GdkRGBA light;
GdkRGBA dark;
@@ -371,8 +391,8 @@ gimp_histogram_view_draw (GtkWidget *widget,
cairo_translate (cr, 0.5, 0.5);
/* Draw the outer border */
- gimp_gdk_rgba_shade (&color, 0.7, &dark);
- gdk_cairo_set_source_rgba (cr, &dark);
+ gimp_get_style_color (widget, "grid-color", &grid_color);
+ gdk_cairo_set_source_rgba (cr, &grid_color);
cairo_rectangle (cr, border, border, width - 1, height - 1);
cairo_stroke (cr);
@@ -438,10 +458,7 @@ gimp_histogram_view_draw (GtkWidget *widget,
if (view->subdivisions > 1 && x >= (xstop * width / view->subdivisions))
{
- gtk_style_context_get_background_color (style, 0, &color);
- gimp_gdk_rgba_shade (&color, 0.7, &dark);
-
- gdk_cairo_set_source_rgba (cr, &dark);
+ gdk_cairo_set_source_rgba (cr, &grid_color);
cairo_move_to (cr, x + border, border);
cairo_line_to (cr, x + border, border + height - 1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]