[gimp/gtk3-port: 197/226] plug-ins: port map-object to GTK+ 3.x



commit d2d0b90da0b62b64acabf22f5300368788234f3f
Author: Michael Natterer <mitch gimp org>
Date:   Wed Feb 16 22:03:09 2011 +0100

    plug-ins: port map-object to GTK+ 3.x

 plug-ins/map-object/map-object-preview.c |   12 +---
 plug-ins/map-object/map-object-preview.h |    4 +-
 plug-ins/map-object/map-object-ui.c      |   92 +++++++++++++++---------------
 3 files changed, 50 insertions(+), 58 deletions(-)
---
diff --git a/plug-ins/map-object/map-object-preview.c b/plug-ins/map-object/map-object-preview.c
index e9e2c9b..bc94daf 100644
--- a/plug-ins/map-object/map-object-preview.c
+++ b/plug-ins/map-object/map-object-preview.c
@@ -299,22 +299,16 @@ compute_preview_image (void)
 }
 
 gboolean
-preview_expose (GtkWidget      *widget,
-                GdkEventExpose *eevent)
+preview_draw (GtkWidget *widget,
+              cairo_t   *cr)
 {
   gint startx, starty, pw, ph;
-  cairo_t *cr;
-
-  cr = gdk_cairo_create (eevent->window);
 
   pw = PREVIEW_WIDTH * mapvals.zoom;
   ph = PREVIEW_HEIGHT * mapvals.zoom;
   startx = (PREVIEW_WIDTH - pw) / 2;
   starty = (PREVIEW_HEIGHT - ph) / 2;
 
-  if (pw != PREVIEW_WIDTH || ph != PREVIEW_HEIGHT)
-    gdk_window_clear (gtk_widget_get_window (previewarea));
-
   cairo_set_source_surface (cr, preview_surface, startx, starty);
   cairo_rectangle (cr, startx, starty, pw, ph);
   cairo_clip (cr);
@@ -329,8 +323,6 @@ preview_expose (GtkWidget      *widget,
   cairo_reset_clip (cr);
   draw_lights (cr, startx, starty, pw, ph);
 
-  cairo_destroy (cr);
-
   return FALSE;
 }
 
diff --git a/plug-ins/map-object/map-object-preview.h b/plug-ins/map-object/map-object-preview.h
index 400b767..c1653ea 100644
--- a/plug-ins/map-object/map-object-preview.h
+++ b/plug-ins/map-object/map-object-preview.h
@@ -16,8 +16,8 @@ extern gint       lightx,lighty;
 /* ============================ */
 
 void     compute_preview_image  (void);
-gboolean preview_expose         (GtkWidget      *widget,
-                                 GdkEventExpose *eevent);
+gboolean preview_draw           (GtkWidget *widget,
+                                 cairo_t   *cr);
 gint     check_light_hit        (gint            xpos,
                                  gint            ypos);
 void     update_light           (gint            xpos,
diff --git a/plug-ins/map-object/map-object-ui.c b/plug-ins/map-object/map-object-ui.c
index 461c185..79233b1 100644
--- a/plug-ins/map-object/map-object-ui.c
+++ b/plug-ins/map-object/map-object-ui.c
@@ -26,7 +26,7 @@ static GtkNotebook *options_note_book = NULL;
 static GtkWidget *pointlightwid;
 static GtkWidget *dirlightwid;
 
-static GtkObject *xadj, *yadj, *zadj;
+static GtkAdjustment *xadj, *yadj, *zadj;
 
 static GtkWidget *box_page      = NULL;
 static GtkWidget *cylinder_page = NULL;
@@ -393,16 +393,16 @@ preview_events (GtkWidget *area,
 static GtkWidget *
 create_options_page (void)
 {
-  GtkWidget *page;
-  GtkWidget *frame;
-  GtkWidget *vbox;
-  GtkWidget *hbox;
-  GtkWidget *label;
-  GtkWidget *combo;
-  GtkWidget *toggle;
-  GtkWidget *table;
-  GtkWidget *spinbutton;
-  GtkObject *adj;
+  GtkWidget     *page;
+  GtkWidget     *frame;
+  GtkWidget     *vbox;
+  GtkWidget     *hbox;
+  GtkWidget     *label;
+  GtkWidget     *combo;
+  GtkWidget     *toggle;
+  GtkWidget     *table;
+  GtkWidget     *spinbutton;
+  GtkAdjustment *adj;
 
   page = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
   gtk_container_set_border_width (GTK_CONTAINER (page), 12);
@@ -559,13 +559,13 @@ create_options_page (void)
 static GtkWidget *
 create_light_page (void)
 {
-  GtkWidget *page;
-  GtkWidget *frame;
-  GtkWidget *table;
-  GtkWidget *combo;
-  GtkWidget *colorbutton;
-  GtkWidget *spinbutton;
-  GtkObject *adj;
+  GtkWidget     *page;
+  GtkWidget     *frame;
+  GtkWidget     *table;
+  GtkWidget     *combo;
+  GtkWidget     *colorbutton;
+  GtkWidget     *spinbutton;
+  GtkAdjustment *adj;
 
   page = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
   gtk_container_set_border_width (GTK_CONTAINER (page), 12);
@@ -728,15 +728,15 @@ create_light_page (void)
 static GtkWidget *
 create_material_page (void)
 {
-  GtkSizeGroup *group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-  GtkWidget    *page;
-  GtkWidget    *frame;
-  GtkWidget    *table;
-  GtkWidget    *label;
-  GtkWidget    *hbox;
-  GtkWidget    *spinbutton;
-  GtkWidget    *image;
-  GtkObject    *adj;
+  GtkSizeGroup  *group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+  GtkWidget     *page;
+  GtkWidget     *frame;
+  GtkWidget     *table;
+  GtkWidget     *label;
+  GtkWidget     *hbox;
+  GtkWidget     *spinbutton;
+  GtkWidget     *image;
+  GtkAdjustment *adj;
 
   page = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
   gtk_container_set_border_width (GTK_CONTAINER (page), 12);
@@ -928,11 +928,11 @@ create_material_page (void)
 static GtkWidget *
 create_orientation_page (void)
 {
-  GtkSizeGroup *group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-  GtkWidget    *page;
-  GtkWidget    *frame;
-  GtkWidget    *table;
-  GtkObject    *adj;
+  GtkSizeGroup  *group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+  GtkWidget     *page;
+  GtkWidget     *frame;
+  GtkWidget     *table;
+  GtkAdjustment *adj;
 
   page = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
   gtk_container_set_border_width (GTK_CONTAINER (page), 12);
@@ -1039,12 +1039,12 @@ create_orientation_page (void)
 static GtkWidget *
 create_box_page (void)
 {
-  GtkWidget *page;
-  GtkWidget *frame;
-  GtkWidget *vbox;
-  GtkWidget *table;
-  GtkObject *adj;
-  gint       i;
+  GtkWidget     *page;
+  GtkWidget     *frame;
+  GtkWidget     *vbox;
+  GtkWidget     *table;
+  GtkAdjustment *adj;
+  gint           i;
 
   static gchar *labels[] =
   {
@@ -1137,12 +1137,12 @@ create_box_page (void)
 static GtkWidget *
 create_cylinder_page (void)
 {
-  GtkSizeGroup *group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-  GtkWidget    *page;
-  GtkWidget    *frame;
-  GtkWidget    *table;
-  GtkObject    *adj;
-  gint          i;
+  GtkSizeGroup  *group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+  GtkWidget     *page;
+  GtkWidget     *frame;
+  GtkWidget     *table;
+  GtkAdjustment *adj;
+  gint           i;
 
   static const gchar *labels[] = { N_("_Top:"), N_("_Bottom:") };
 
@@ -1337,8 +1337,8 @@ main_dialog (GimpDrawable *drawable)
                     G_CALLBACK (preview_events),
                     previewarea);
 
-  g_signal_connect (previewarea, "expose-event",
-                    G_CALLBACK (preview_expose),
+  g_signal_connect (previewarea, "draw",
+                    G_CALLBACK (preview_draw),
                     previewarea);
 
   hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]