[gimp/gtk3-port: 117/130] app: port the colormap editor to GTK+ 3.0
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gtk3-port: 117/130] app: port the colormap editor to GTK+ 3.0
- Date: Sun, 14 Nov 2010 22:13:03 +0000 (UTC)
commit 401ad2987b67fe5e546af17c0a94e247c2780933
Author: Michael Natterer <mitch gimp org>
Date: Thu Oct 28 02:30:42 2010 +0200
app: port the colormap editor to GTK+ 3.0
app/widgets/gimpcolormapeditor.c | 28 ++++++++--------------------
1 files changed, 8 insertions(+), 20 deletions(-)
---
diff --git a/app/widgets/gimpcolormapeditor.c b/app/widgets/gimpcolormapeditor.c
index e98b4c0..4fe89e3 100644
--- a/app/widgets/gimpcolormapeditor.c
+++ b/app/widgets/gimpcolormapeditor.c
@@ -75,8 +75,8 @@ static PangoLayout *
static void gimp_colormap_editor_update_entries (GimpColormapEditor *editor);
-static gboolean gimp_colormap_preview_expose (GtkWidget *widget,
- GdkEventExpose *event,
+static gboolean gimp_colormap_preview_draw (GtkWidget *widget,
+ cairo_t *cr,
GimpColormapEditor *editor);
static void gimp_colormap_editor_entry_clicked (GimpPaletteView *view,
@@ -151,7 +151,6 @@ gimp_colormap_editor_init (GimpColormapEditor *editor)
{
GtkWidget *frame;
GtkWidget *table;
- GtkObject *adj;
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
@@ -167,8 +166,8 @@ gimp_colormap_editor_init (GimpColormapEditor *editor)
gtk_container_add (GTK_CONTAINER (frame), editor->view);
gtk_widget_show (editor->view);
- g_signal_connect (editor->view, "expose-event",
- G_CALLBACK (gimp_colormap_preview_expose),
+ g_signal_connect (editor->view, "draw",
+ G_CALLBACK (gimp_colormap_preview_draw),
editor);
g_signal_connect (editor->view, "entry-clicked",
@@ -194,9 +193,8 @@ gimp_colormap_editor_init (GimpColormapEditor *editor)
gtk_box_pack_end (GTK_BOX (editor), table, FALSE, FALSE, 0);
gtk_widget_show (table);
- editor->index_spinbutton = gimp_spin_button_new (&adj,
+ editor->index_spinbutton = gimp_spin_button_new (&editor->index_adjustment,
0, 0, 0, 1, 10, 0, 1.0, 0);
- editor->index_adjustment = GTK_ADJUSTMENT (adj);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Color index:"), 0.0, 0.5,
editor->index_spinbutton, 1, TRUE);
@@ -489,13 +487,12 @@ gimp_colormap_editor_create_layout (GtkWidget *widget)
}
static gboolean
-gimp_colormap_preview_expose (GtkWidget *widget,
- GdkEventExpose *event,
- GimpColormapEditor *editor)
+gimp_colormap_preview_draw (GtkWidget *widget,
+ cairo_t *cr,
+ GimpColormapEditor *editor)
{
GimpImageEditor *image_editor = GIMP_IMAGE_EDITOR (editor);
GtkStyle *style;
- cairo_t *cr;
GtkAllocation allocation;
gint width, height;
gint y;
@@ -504,18 +501,11 @@ gimp_colormap_preview_expose (GtkWidget *widget,
gimp_image_base_type (image_editor->image) == GIMP_INDEXED)
return FALSE;
- cr = gdk_cairo_create (event->window);
- gdk_cairo_region (cr, event->region);
- cairo_clip (cr);
-
style = gtk_widget_get_style (widget);
gdk_cairo_set_source_color (cr, &style->fg[gtk_widget_get_state (widget)]);
gtk_widget_get_allocation (widget, &allocation);
- if (! gtk_widget_get_has_window (widget))
- cairo_translate (cr, allocation.x, allocation.y);
-
if (! editor->layout)
editor->layout = gimp_colormap_editor_create_layout (editor->view);
@@ -529,8 +519,6 @@ gimp_colormap_preview_expose (GtkWidget *widget,
cairo_move_to (cr, BORDER, MAX (y, 0));
pango_cairo_show_layout (cr, editor->layout);
- cairo_destroy (cr);
-
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]