[gegl] gegl binary: permit dragging and zooming in more ui states



commit 30367570b2eb8ca959cc1f611bfd9712e54b5523
Author: Øyvind Kolås <pippin gimp org>
Date:   Sun Mar 27 21:46:24 2016 +0200

    gegl binary: permit dragging and zooming in more ui states

 bin/ui.c                        |   93 ++++++++++++++++++++-------------------
 operations/common/exp-combine.c |    1 -
 operations/common/wind.c        |    6 ++-
 3 files changed, 52 insertions(+), 48 deletions(-)
---
diff --git a/bin/ui.c b/bin/ui.c
index ab492ed..d7884ca 100644
--- a/bin/ui.c
+++ b/bin/ui.c
@@ -209,49 +209,44 @@ static void load_path (State *o);
 
 static void go_next (State *o);
 static void go_prev (State *o);
-static void go_parent (State *o);
-
-static void get_coords (State *o, float screen_x, float screen_y, float *gegl_x, float *gegl_y);
-static void leave_editor (State *o);
-static void drag_preview (MrgEvent *e);
-static void load_into_buffer (State *o, const char *path);
-static GeglNode *locate_node (State *o, const char *op_name);
-static void zoom_to_fit (State *o);
-static void center (State *o);
-static void zoom_to_fit_buffer (State *o);
-
-static void go_next_cb   (MrgEvent *event, void *data1, void *data2);
-static void go_prev_cb   (MrgEvent *event, void *data1, void *data2);
-static void go_parent_cb (MrgEvent *event, void *data1, void *data2);
-static void zoom_fit_cb  (MrgEvent *e, void *data1, void *data2);
-static void pan_left_cb  (MrgEvent *event, void *data1, void *data2);
-static void pan_right_cb (MrgEvent *event, void *data1, void *data2);
-static void pan_down_cb  (MrgEvent *event, void *data1, void *data2);
-static void pan_up_cb    (MrgEvent *event, void *data1, void *data2);
-static void preview_more_cb (MrgEvent *event, void *data1, void *data2);
-static void preview_less_cb (MrgEvent *event, void *data1, void *data2);
-static void zoom_1_cb               (MrgEvent *event, void *data1, void *data2);
-static void zoom_in_cb              (MrgEvent *event, void *data1, void *data2);
-static void zoom_out_cb             (MrgEvent *event, void *data1, void *data2);
-static void toggle_actions_cb       (MrgEvent *event, void *data1, void *data2);
-static void toggle_fullscreen_cb    (MrgEvent *event, void *data1, void *data2);
-static void activate_op_cb          (MrgEvent *event, void *data1, void *data2);
-static void disable_filter_cb       (MrgEvent *event, void *data1, void *data2);
-static void apply_filter_cb         (MrgEvent *event, void *data1, void *data2);
-static void discard_cb              (MrgEvent *event, void *data1, void *data2);
-static void save_cb                 (MrgEvent *event, void *data1, void *data2);
-static void toggle_show_controls_cb (MrgEvent *event, void *data1, void *data2);
-
-static void gegl_ui       (Mrg *mrg, void *data);
-int         mrg_ui_main   (int argc, char **argv, char **ops);
-void        gegl_meta_set (const char *path, const char *meta_data);
-char *      gegl_meta_get (const char *path); 
-
-
-static void on_viewer_motion (MrgEvent *e, void *data1, void *data2);
-
-int gegl_str_has_image_suffix (char *path);
-int gegl_str_has_video_suffix (char *path);
+static void go_parent                 (State *o);
+static void get_coords                (State *o, float  screen_x, float screen_y,
+                                                 float *gegl_x,   float *gegl_y);
+static void leave_editor              (State *o);
+static void drag_preview              (MrgEvent *e);
+static void load_into_buffer          (State *o, const char *path);
+static GeglNode *locate_node          (State *o, const char *op_name);
+static void zoom_to_fit               (State *o);
+static void center                    (State *o);
+static void zoom_to_fit_buffer        (State *o);
+static void go_next_cb                (MrgEvent *event, void *data1, void *data2);
+static void go_prev_cb                (MrgEvent *event, void *data1, void *data2);
+static void go_parent_cb              (MrgEvent *event, void *data1, void *data2);
+static void zoom_fit_cb               (MrgEvent *e, void *data1, void *data2);
+static void pan_left_cb               (MrgEvent *event, void *data1, void *data2);
+static void pan_right_cb              (MrgEvent *event, void *data1, void *data2);
+static void pan_down_cb               (MrgEvent *event, void *data1, void *data2);
+static void pan_up_cb                 (MrgEvent *event, void *data1, void *data2);
+static void preview_more_cb           (MrgEvent *event, void *data1, void *data2);
+static void preview_less_cb           (MrgEvent *event, void *data1, void *data2);
+static void zoom_1_cb                 (MrgEvent *event, void *data1, void *data2);
+static void zoom_in_cb                (MrgEvent *event, void *data1, void *data2);
+static void zoom_out_cb               (MrgEvent *event, void *data1, void *data2);
+static void toggle_actions_cb         (MrgEvent *event, void *data1, void *data2);
+static void toggle_fullscreen_cb      (MrgEvent *event, void *data1, void *data2);
+static void activate_op_cb            (MrgEvent *event, void *data1, void *data2);
+static void disable_filter_cb         (MrgEvent *event, void *data1, void *data2);
+static void apply_filter_cb           (MrgEvent *event, void *data1, void *data2);
+static void discard_cb                (MrgEvent *event, void *data1, void *data2);
+static void save_cb                   (MrgEvent *event, void *data1, void *data2);
+static void toggle_show_controls_cb   (MrgEvent *event, void *data1, void *data2);
+static void gegl_ui                   (Mrg *mrg, void *data);
+int         mrg_ui_main               (int argc, char **argv, char **ops);
+void        gegl_meta_set             (const char *path, const char *meta_data);
+char *      gegl_meta_get             (const char *path); 
+static void on_viewer_motion          (MrgEvent *e, void *data1, void *data2);
+int         gegl_str_has_image_suffix (char *path);
+int         gegl_str_has_video_suffix (char *path);
 
 static int str_has_visual_suffix (char *path)
 {
@@ -378,7 +373,6 @@ int mrg_ui_main (int argc, char **argv, char **ops)
       return -1;
     }
 
-
   load_path (&o);
   mrg_set_ui (mrg, gegl_ui, &o);
   hack_state = &o;  
@@ -433,6 +427,7 @@ static void on_pan_drag (MrgEvent *e, void *data1, void *data2)
     o->v -= (e->delta_y );
     mrg_queue_draw (e->mrg, NULL);
   }
+  mrg_event_stop_propagate (e);
   drag_preview (e);
 }
 
@@ -449,6 +444,7 @@ static void prop_double_drag_cb (MrgEvent *e, void *data1, void *data2)
   gegl_node_set (node, pspec->name, value, NULL);
    
   drag_preview (e);
+  mrg_event_stop_propagate (e);
 
   mrg_queue_draw (e->mrg, NULL);
 }
@@ -871,10 +867,11 @@ static void ui_viewer (State *o)
   Mrg *mrg = o->mrg;
   cairo_t *cr = mrg_cr (mrg);
   cairo_rectangle (cr, 0,0, mrg_width(mrg), mrg_height(mrg));
+#if 0
   mrg_listen (mrg, MRG_DRAG, on_pan_drag, o, NULL);
   mrg_listen (mrg, MRG_MOTION, on_viewer_motion, o, NULL);
-
   mrg_listen (mrg, MRG_SCROLL, scroll_cb, o, NULL);
+#endif
 
   cairo_scale (cr, mrg_width(mrg), mrg_height(mrg));
   cairo_new_path (cr);
@@ -1030,6 +1027,12 @@ static void gegl_ui (Mrg *mrg, void *data)
 #endif
   }
 
+  cairo_rectangle (mrg_cr (mrg), 0,0, mrg_width(mrg), mrg_height(mrg));
+  mrg_listen (mrg, MRG_DRAG, on_pan_drag, o, NULL);
+  mrg_listen (mrg, MRG_MOTION, on_viewer_motion, o, NULL);
+  mrg_listen (mrg, MRG_SCROLL, scroll_cb, o, NULL);
+  cairo_new_path (mrg_cr (mrg));
+
   if (o->show_actions)
   {
     ui_actions (o);
diff --git a/operations/common/exp-combine.c b/operations/common/exp-combine.c
index 23116b9..41bb301 100644
--- a/operations/common/exp-combine.c
+++ b/operations/common/exp-combine.c
@@ -63,7 +63,6 @@ GEGL_DEFINE_DYNAMIC_OPERATION(GEGL_TYPE_OPERATION_FILTER)
 #include "graph/gegl-node-private.h"
 #include "graph/gegl-pad.h"
 
-
 static const gchar *PAD_FORMAT = "R'G'B' float";
 static const gchar *EXP_PREFIX = "exposure-";
 
diff --git a/operations/common/wind.c b/operations/common/wind.c
index 1397e5e..55aaa79 100644
--- a/operations/common/wind.c
+++ b/operations/common/wind.c
@@ -71,7 +71,6 @@ property_int (strength, _("Strength"), 10)
 #define GEGL_OP_C_SOURCE wind.c
 
 #include "gegl-op.h"
-#include "gegl-config.h"
 #include <math.h>
 
 #define COMPARE_WIDTH    3
@@ -98,6 +97,8 @@ thread_process (gpointer thread_data, gpointer unused)
   g_atomic_int_add (data->pending, -1);
 }
 
+int gegl_config_threads (void);
+
 static GThreadPool *
 thread_pool (void)
 {
@@ -441,6 +442,7 @@ get_required_for_output (GeglOperation       *operation,
   return result;
 }
 
+
 static gboolean
 operation_process (GeglOperation        *operation,
                    GeglOperationContext *context,
@@ -471,7 +473,7 @@ operation_process (GeglOperation        *operation,
   {
     gint threads = gegl_config_threads ();
     GThreadPool *pool = thread_pool ();
-    ThreadData thread_data[GEGL_MAX_THREADS];
+    ThreadData thread_data[32];
     gint pending = threads;
 
     if (o->direction == GEGL_WIND_DIRECTION_LEFT ||


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