[gimp] app: manage the preview opacity with an object binding too



commit 055ca325f2b7a2a6ccf8641ab8991ffa94c55ad4
Author: Michael Natterer <mitch gimp org>
Date:   Mon Jun 19 23:39:37 2017 +0200

    app: manage the preview opacity with an object binding too

 app/display/gimpcanvastransformpreview.c |    4 +---
 app/display/gimpcanvastransformpreview.h |    3 +--
 app/tools/gimpdrawtool.c                 |    5 ++---
 app/tools/gimpdrawtool.h                 |    3 +--
 app/tools/gimptransformtool.c            |   15 ++++++---------
 5 files changed, 11 insertions(+), 19 deletions(-)
---
diff --git a/app/display/gimpcanvastransformpreview.c b/app/display/gimpcanvastransformpreview.c
index b209a27..6d592a1 100644
--- a/app/display/gimpcanvastransformpreview.c
+++ b/app/display/gimpcanvastransformpreview.c
@@ -576,8 +576,7 @@ gimp_canvas_transform_preview_new (GimpDisplayShell  *shell,
                                    gdouble            y1,
                                    gdouble            x2,
                                    gdouble            y2,
-                                   gboolean           perspective,
-                                   gdouble            opacity)
+                                   gboolean           perspective)
 {
   g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
   g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
@@ -592,7 +591,6 @@ gimp_canvas_transform_preview_new (GimpDisplayShell  *shell,
                        "x2",          x2,
                        "y2",          y2,
                        "perspective", perspective,
-                       "opacity",     CLAMP (opacity, 0.0, 1.0),
                        NULL);
 }
 
diff --git a/app/display/gimpcanvastransformpreview.h b/app/display/gimpcanvastransformpreview.h
index e49e0f9..a27b0c8 100644
--- a/app/display/gimpcanvastransformpreview.h
+++ b/app/display/gimpcanvastransformpreview.h
@@ -56,8 +56,7 @@ GimpCanvasItem * gimp_canvas_transform_preview_new      (GimpDisplayShell  *shel
                                                          gdouble            y1,
                                                          gdouble            x2,
                                                          gdouble            y2,
-                                                         gboolean           perspective,
-                                                         gdouble            opacity);
+                                                         gboolean           perspective);
 
 
 #endif /* __GIMP_CANVAS_TRANSFORM_PREVIEW_H__ */
diff --git a/app/tools/gimpdrawtool.c b/app/tools/gimpdrawtool.c
index 2a751a9..6a8f1ee 100644
--- a/app/tools/gimpdrawtool.c
+++ b/app/tools/gimpdrawtool.c
@@ -960,8 +960,7 @@ gimp_draw_tool_add_transform_preview (GimpDrawTool      *draw_tool,
                                       gdouble            y1,
                                       gdouble            x2,
                                       gdouble            y2,
-                                      gboolean           perspective,
-                                      gdouble            opacity)
+                                      gboolean           perspective)
 {
   GimpCanvasItem *item;
 
@@ -972,7 +971,7 @@ gimp_draw_tool_add_transform_preview (GimpDrawTool      *draw_tool,
   item = gimp_canvas_transform_preview_new (gimp_display_get_shell (draw_tool->display),
                                             drawable, transform,
                                             x1, y1, x2, y2,
-                                            perspective, opacity);
+                                            perspective);
 
   gimp_draw_tool_add_preview (draw_tool, item);
   g_object_unref (item);
diff --git a/app/tools/gimpdrawtool.h b/app/tools/gimpdrawtool.h
index 940e9c3..bfa53af 100644
--- a/app/tools/gimpdrawtool.h
+++ b/app/tools/gimpdrawtool.h
@@ -150,8 +150,7 @@ GimpCanvasItem * gimp_draw_tool_add_transform_preview(GimpDrawTool     *draw_too
                                                       gdouble           y1,
                                                       gdouble           x2,
                                                       gdouble           y2,
-                                                      gboolean          perspective,
-                                                      gdouble            opacity);
+                                                      gboolean          perspective);
 
 GimpCanvasItem * gimp_draw_tool_add_handle           (GimpDrawTool     *draw_tool,
                                                       GimpHandleType    type,
diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c
index 72b3751..1f78465 100644
--- a/app/tools/gimptransformtool.c
+++ b/app/tools/gimptransformtool.c
@@ -782,13 +782,6 @@ gimp_transform_tool_options_notify (GimpTool         *tool,
           gimp_canvas_item_set_visible (tr_tool->preview, show_preview);
         }
     }
-  else if (! strcmp (pspec->name, "preview-opacity"))
-    {
-      if (tr_tool->preview)
-        g_object_set (tr_tool->preview,
-                      "opacity", tr_options->preview_opacity,
-                      NULL);
-    }
   else if (g_str_has_prefix (pspec->name, "constrain-") ||
            g_str_has_prefix (pspec->name, "frompivot-") ||
            ! strcmp (pspec->name, "fixedpivot") ||
@@ -823,13 +816,17 @@ gimp_transform_tool_draw (GimpDrawTool *draw_tool)
                                               tr_tool->y1,
                                               tr_tool->x2,
                                               tr_tool->y2,
-                                              tr_tool->does_perspective,
-                                              options->preview_opacity);
+                                              tr_tool->does_perspective);
       g_object_add_weak_pointer (G_OBJECT (tr_tool->preview),
                                  (gpointer) &tr_tool->preview);
 
       gimp_canvas_item_set_visible (tr_tool->preview, show_preview);
 
+      g_object_bind_property (G_OBJECT (options),          "preview-opacity",
+                              G_OBJECT (tr_tool->preview), "opacity",
+                              G_BINDING_SYNC_CREATE |
+                              G_BINDING_BIDIRECTIONAL);
+
       item = gimp_tool_widget_get_item (tr_tool->widget);
 
       gimp_draw_tool_add_item (draw_tool, item);


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