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



commit eb21fd18de534eb9f67285c4e77e76e163de2be5
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 e3319ac..06f3b4a 100644
--- a/plug-ins/map-object/map-object-preview.c
+++ b/plug-ins/map-object/map-object-preview.c
@@ -307,22 +307,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);
@@ -337,8 +331,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 2193bae..21cea03 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_vbox_new (FALSE, 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_vbox_new (FALSE, 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_vbox_new (FALSE, 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_vbox_new (FALSE, 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_hbox_new (FALSE, 6);



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