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



commit 0bf36de4a330763c895e5f8c75af543f2d515406
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 |   16 +----
 plug-ins/map-object/map-object-preview.h |   12 ++--
 plug-ins/map-object/map-object-ui.c      |   92 +++++++++++++++---------------
 3 files changed, 56 insertions(+), 64 deletions(-)
---
diff --git a/plug-ins/map-object/map-object-preview.c b/plug-ins/map-object/map-object-preview.c
index eae0cca..9caa0f3 100644
--- a/plug-ins/map-object/map-object-preview.c
+++ b/plug-ins/map-object/map-object-preview.c
@@ -315,14 +315,11 @@ compute_preview_image (void)
 }
 
 gboolean
-preview_expose (GtkWidget      *widget,
-                GdkEventExpose *eevent)
+preview_draw (GtkWidget *widget,
+              cairo_t   *cr)
 {
-  gint startx, starty, pw, ph;
-  GdkColor  color;
-  cairo_t *cr;
-
-  cr = gdk_cairo_create (eevent->window);
+  gint     startx, starty, pw, ph;
+  GdkColor color;
 
   color.red   = 0xFFFF;
   color.green = 0xFFFF;
@@ -334,9 +331,6 @@ preview_expose (GtkWidget      *widget,
   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);
@@ -345,7 +339,5 @@ preview_expose (GtkWidget      *widget,
 
   draw_lights (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 bd2b20c..87d2f28 100644
--- a/plug-ins/map-object/map-object-preview.h
+++ b/plug-ins/map-object/map-object-preview.h
@@ -14,11 +14,11 @@ extern gint       lightx,lighty;
 /* ============================ */
 
 void     compute_preview_image  (void);
-gboolean preview_expose         (GtkWidget      *widget,
-                                 GdkEventExpose *eevent);
-gint     check_light_hit        (gint            xpos,
-                                 gint            ypos);
-void     update_light           (gint            xpos,
-                                 gint            ypos);
+gboolean preview_draw           (GtkWidget *widget,
+                                 cairo_t   *cr);
+gint     check_light_hit        (gint       xpos,
+                                 gint       ypos);
+void     update_light           (gint       xpos,
+                                 gint       ypos);
 
 #endif  /* __MAPOBJECT_PREVIEW_H__ */
diff --git a/plug-ins/map-object/map-object-ui.c b/plug-ins/map-object/map-object-ui.c
index 5bbff17..cafc50d 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;
@@ -387,16 +387,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);
@@ -539,13 +539,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);
@@ -708,15 +708,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);
@@ -908,11 +908,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);
@@ -1019,12 +1019,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[] =
   {
@@ -1117,12 +1117,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:") };
 
@@ -1315,8 +1315,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]