[gimp] plug-ins: make curve-bend build again, and undeprecate it a bit



commit 582c69201025d6b5389d7dd9fae29970f9da8e78
Author: Michael Natterer <mitch gimp org>
Date:   Mon Oct 22 15:04:07 2018 +0200

    plug-ins: make curve-bend build again, and undeprecate it a bit

 plug-ins/common/.gitignore     |  2 ++
 plug-ins/common/Makefile.am    | 19 +++++++++++++++++
 plug-ins/common/curve-bend.c   | 47 +++++++++++++++++++++---------------------
 plug-ins/common/gimprc.common  |  1 +
 plug-ins/common/plugin-defs.pl |  2 +-
 po-plug-ins/POTFILES.in        |  2 +-
 6 files changed, 47 insertions(+), 26 deletions(-)
---
diff --git a/plug-ins/common/.gitignore b/plug-ins/common/.gitignore
index 3ce94ed5f6..404be7ec19 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -34,6 +34,8 @@
 /contrast-retinex.exe
 /crop-zealous
 /crop-zealous.exe
+/curve-bend
+/curve-bend.exe
 /decompose
 /decompose.exe
 /depth-merge
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index 0d9ffc2dfb..3538c7158f 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -62,6 +62,7 @@ compose_libexecdir = $(gimpplugindir)/plug-ins/compose
 contrast_normalize_libexecdir = $(gimpplugindir)/plug-ins/contrast-normalize
 contrast_retinex_libexecdir = $(gimpplugindir)/plug-ins/contrast-retinex
 crop_zealous_libexecdir = $(gimpplugindir)/plug-ins/crop-zealous
+curve_bend_libexecdir = $(gimpplugindir)/plug-ins/curve-bend
 decompose_libexecdir = $(gimpplugindir)/plug-ins/decompose
 depth_merge_libexecdir = $(gimpplugindir)/plug-ins/depth-merge
 despeckle_libexecdir = $(gimpplugindir)/plug-ins/despeckle
@@ -153,6 +154,7 @@ compose_libexec_PROGRAMS = compose
 contrast_normalize_libexec_PROGRAMS = contrast-normalize
 contrast_retinex_libexec_PROGRAMS = contrast-retinex
 crop_zealous_libexec_PROGRAMS = crop-zealous
+curve_bend_libexec_PROGRAMS = curve-bend
 decompose_libexec_PROGRAMS = decompose
 depth_merge_libexec_PROGRAMS = depth-merge
 despeckle_libexec_PROGRAMS = despeckle
@@ -522,6 +524,23 @@ crop_zealous_LDADD = \
        $(INTLLIBS)             \
        $(crop_zealous_RC)
 
+curve_bend_SOURCES = \
+       curve-bend.c
+
+curve_bend_LDADD = \
+       $(libgimpui)            \
+       $(libgimpwidgets)       \
+       $(libgimpmodule)        \
+       $(libgimp)              \
+       $(libgimpmath)          \
+       $(libgimpconfig)        \
+       $(libgimpcolor)         \
+       $(libgimpbase)          \
+       $(GTK_LIBS)             \
+       $(RT_LIBS)              \
+       $(INTLLIBS)             \
+       $(curve_bend_RC)
+
 decompose_SOURCES = \
        decompose.c
 
diff --git a/plug-ins/common/curve-bend.c b/plug-ins/common/curve-bend.c
index 5f9963b661..2878932c9e 100644
--- a/plug-ins/common/curve-bend.c
+++ b/plug-ins/common/curve-bend.c
@@ -132,7 +132,6 @@ struct _BenderDialog
   GtkWidget *pv_widget;
   GtkWidget *graph;
   GtkAdjustment *rotate_data;
-  GdkPixmap *pixmap;
   GtkWidget *filechooser;
 
   GdkCursor *cursor_busy;
@@ -261,6 +260,9 @@ static void            bender_save_callback           (GtkWidget *,
                                                        BenderDialog *);
 static gint            bender_graph_events            (GtkWidget *, GdkEvent *,
                                                        BenderDialog *);
+static gint            bender_graph_draw              (GtkWidget *,
+                                                       cairo_t *,
+                                                       BenderDialog *);
 static void            bender_CR_compose              (CRMatrix, CRMatrix,
                                                        CRMatrix);
 static void            bender_init_min_max            (BenderDialog *, gint32);
@@ -1145,7 +1147,6 @@ do_dialog (GimpDrawable *drawable)
   bender_update (cd, UP_GRAPH | UP_DRAW | UP_PREVIEW_EXPOSE);
 
   gtk_main ();
-  gdk_display_flush (gtk_widget_get_display (cd->shell));
 
   gimp_image_delete(cd->preview_image_id);
   cd->preview_image_id = -1;
@@ -1167,7 +1168,6 @@ bender_new_dialog (GimpDrawable *drawable)
   GtkWidget    *vbox;
   GtkWidget    *hbox;
   GtkWidget    *vbox2;
-  GtkWidget    *abox;
   GtkWidget    *frame;
   GtkWidget    *upper, *lower;
   GtkWidget    *smooth, *freew;
@@ -1182,7 +1182,6 @@ bender_new_dialog (GimpDrawable *drawable)
 
   cd->preview = FALSE;
   cd->curve_type = SMOOTH;
-  cd->pixmap = NULL;
   cd->filechooser = NULL;
   cd->outline = OUTLINE_UPPER;
   cd->show_progress = FALSE;
@@ -1265,14 +1264,12 @@ bender_new_dialog (GimpDrawable *drawable)
   gtk_container_add (GTK_CONTAINER (frame), vbox2);
   gtk_widget_show (vbox2);
 
-  abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
-  gtk_box_pack_start (GTK_BOX (vbox2), abox, FALSE, FALSE, 0);
-  gtk_widget_show (abox);
-
   /*  The range drawing area  */
   frame = gtk_frame_new (NULL);
+  gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
+  gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
   gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
-  gtk_container_add (GTK_CONTAINER (abox), frame);
+  gtk_box_pack_start (GTK_BOX (vbox2), frame, FALSE, FALSE, 0);
   gtk_widget_show (frame);
 
   cd->pv_widget = gimp_preview_area_new ();
@@ -1376,21 +1373,22 @@ bender_new_dialog (GimpDrawable *drawable)
   gtk_container_add (GTK_CONTAINER (frame), vbox);
   gtk_widget_show (vbox);
 
-  abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
-  gtk_box_pack_start (GTK_BOX (vbox), abox, FALSE, FALSE, 0);
-  gtk_widget_show (abox);
-
   cd->graph = gtk_drawing_area_new ();
+  gtk_widget_set_halign (cd->graph, GTK_ALIGN_CENTER);
+  gtk_widget_set_valign (cd->graph, GTK_ALIGN_CENTER);
   gtk_widget_set_size_request (cd->graph,
                                GRAPH_WIDTH + RADIUS * 2,
                                GRAPH_HEIGHT + RADIUS * 2);
   gtk_widget_set_events (cd->graph, GRAPH_MASK);
-  gtk_container_add (GTK_CONTAINER (abox), cd->graph);
+  gtk_box_pack_start (GTK_BOX (vbox), cd->graph, FALSE, FALSE, 0);
   gtk_widget_show (cd->graph);
 
   g_signal_connect (cd->graph, "event",
                     G_CALLBACK (bender_graph_events),
                     cd);
+  g_signal_connect (cd->graph, "draw",
+                    G_CALLBACK (bender_graph_draw),
+                    cd);
 
   hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
   gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
@@ -1551,7 +1549,7 @@ bender_update (BenderDialog *cd,
       if (update & UP_DRAW)
         gtk_widget_queue_draw (cd->pv_widget);
     }
-  if ((update & UP_GRAPH) && (update & UP_DRAW) && cd->pixmap != NULL)
+  if ((update & UP_GRAPH) && (update & UP_DRAW))
     {
       cairo_t *cr;
 
@@ -2187,15 +2185,6 @@ bender_graph_events (GtkWidget    *widget,
 
   switch (event->type)
     {
-    case GDK_EXPOSE:
-      if (cd->pixmap == NULL)
-        cd->pixmap = gdk_pixmap_new (gtk_widget_get_window (cd->graph),
-                                     GRAPH_WIDTH + RADIUS * 2,
-                                     GRAPH_HEIGHT + RADIUS * 2, -1);
-
-      bender_update (cd, UP_GRAPH | UP_DRAW);
-      break;
-
     case GDK_BUTTON_PRESS:
       new_type = GDK_TCROSS;
 
@@ -2335,6 +2324,16 @@ bender_graph_events (GtkWidget    *widget,
   return FALSE;
 }
 
+static gboolean
+bender_graph_draw (GtkWidget    *widget,
+                   cairo_t      *cr,
+                   BenderDialog *cd)
+{
+  bender_update (cd, UP_GRAPH | UP_DRAW);
+
+  return FALSE;
+}
+
 static void
 bender_CR_compose (CRMatrix a,
                    CRMatrix b,
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index 111427e2d4..d910e7db8b 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -14,6 +14,7 @@ compose_RC = compose.rc.o
 contrast_normalize_RC = contrast-normalize.rc.o
 contrast_retinex_RC = contrast-retinex.rc.o
 crop_zealous_RC = crop-zealous.rc.o
+curve_bend_RC = curve-bend.rc.o
 decompose_RC = decompose.rc.o
 depth_merge_RC = depth-merge.rc.o
 despeckle_RC = despeckle.rc.o
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index c806a553cc..e5d2214e2b 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -16,7 +16,7 @@
     'contrast-normalize' => {},
     'contrast-retinex' => { ui => 1 },
     'crop-zealous' => { gegl => 1 },
-# FIXME 'curve-bend' => { ui => 1 },
+    'curve-bend' => { ui => 1 },
     'decompose' => { ui => 1, gegl => 1 },
     'depth-merge' => { ui => 1 },
     'despeckle' => { ui => 1 },
diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in
index 4a47a30046..a6347acc7d 100644
--- a/po-plug-ins/POTFILES.in
+++ b/po-plug-ins/POTFILES.in
@@ -20,7 +20,7 @@ plug-ins/common/compose.c
 plug-ins/common/contrast-normalize.c
 plug-ins/common/contrast-retinex.c
 plug-ins/common/crop-zealous.c
-#plug-ins/common/curve-bend.c
+plug-ins/common/curve-bend.c
 plug-ins/common/decompose.c
 plug-ins/common/depth-merge.c
 plug-ins/common/despeckle.c


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