[gegl] gcut: visualize global overlays



commit 45f0be900ed99d74b797a1382f6c43fbcc12d209
Author: Øyvind Kolås <pippin gimp org>
Date:   Mon Aug 14 14:17:59 2017 +0200

    gcut: visualize global overlays

 gcut/default.edl     |    2 +-
 gcut/default.edl.inc |    2 +-
 gcut/gcut-ui.c       |   42 +++++++++++++++++++++++++-----------------
 gcut/gcut.c          |    1 +
 gcut/gcut.h          |    2 ++
 5 files changed, 30 insertions(+), 19 deletions(-)
---
diff --git a/gcut/default.edl b/gcut/default.edl
index 56becfc..d19d2cc 100644
--- a/gcut/default.edl
+++ b/gcut/default.edl
@@ -10,6 +10,7 @@ frame-scale=0.398424
 t0=56.702866
 frame-pos=0.000
 
+-- 21.000s 23.000s pixelize x-size=0.1rel y-size=0.1rel
 gegl:color value=black gegl:crop width=400 height=400 1.240s 2.000s -- 
 gegl:color opi=0:0 gegl:crop opi=0:0 width=400 height=400 0.000s 2.000s -- [fade=1.040s] svg:src-over 
opi=0:0 aux=[  gegl:text opi=0:0 string='note: this is a gcut video\nproject for testing features\nit relies 
on synthetic GEGL\npatterns instead of\nvideo footage\nto be to minimie size\nfor inclusion in gcut 
sources\nbeing able to create this project \nfrom scratch in the gcut ui\nis a current goal.' 
size=0.071811296045780182rel color='rgb(1.0000, 1.0000, 1.0000)' width=3 height=1 gegl:translate opi=0:0 
x=0.10000000000000001rel y=0.051874876022338867rel ]
 gegl:color opi=0:0 gegl:crop opi=0:0 width=400 height=400 reset-origin=true 0.000s 3.200s -- svg:src-over 
opi=0:0 aux=[  gegl:text opi=0:0 string='gcut' font='sans' size=0.20000000000000001rel color='rgb(1.0000, 
1.0000, 1.0000)' width=1 height=1 gegl:gaussian-blur opi=0:0 std-dev-x={  0.000000=0.400000rel  
2.560000=0.000084rel  }  std-dev-y={  0.000000=0.200000rel  }  clip-extent=false gegl:translate opi=0:0 
x=0.10000000000000001rel y=0.3304142951965332rel ]  gegl:lens-flare opi=0:0 pos-x={  0.000000=-2.000000  
2.400000=0.293004  4.000000=2.000000  }  pos-y={  0.000000=0.100000  2.400000=0.360697  25.000000=0.910000  }
@@ -27,6 +28,5 @@ gegl:noise-solid opi=0:0 y-size=4.6258320808410645 seed=668093247 gegl:crop opi=
 gegl:noise-solid opi=0:0 gegl:crop opi=0:0 width=400 height=400 0.000s 1.000s -- [fade=1.440s] svg:src-over 
opi=0:0 aux=[  gegl:text opi=0:0 string='crash recovery by default' size=0.081632360816001892rel 
color='rgb(1.0000, 1.0000, 0.0000)' width=1 height=1 gegl:translate opi=0:0 x=0.10000000000000001rel 
y=0.42925620079040527rel ]
 gegl:noise-solid opi=0:0 gegl:crop opi=0:0 width=400 height=400 0.000s 1.000s -- [fade=1.360s] svg:src-over 
opi=0:0 aux=[  gegl:text opi=0:0 string='overlays:audio filter' size=0.10000000000000001rel 
color='rgb(1.0000, 1.0000, 0.0000)' width=1 height=1 gegl:translate opi=0:0 x=0.10000000000000001rel 
y=0.48208630084991455rel ]
 gegl:noise-solid gegl:crop width=400 height=400 0.000s 1.000s -- [fade=1.360s] over aux=[ text size=0.1rel 
string='network rendering' color=yellow translate x=0.1rel y=0.8rel ]
---           #end titles
 gegl:color opi=0:0 gegl:crop opi=0:0 width=400 height=400 0.000s 18.960s -- svg:src-over opi=0:0 aux=[  
gegl:text opi=0:0 string='end titles\n\nfull of newlines\n\nand some images and more\n\nmost of the 
time\n\n\nthough\n\nusing an image that one pans\nwill provide better typographic control\nperhaps based on a 
pdf/svg\n\nthis is is also where I should stick misc info' size=0.040000000000000001rel color='rgb(1.0000, 
1.0000, 1.0000)' width=1 height=8 gegl:translate opi=0:0 x=0.10000000000000001rel y={  0.000000=1.000000rel  
32.000000=-2.000000rel  }  ]
 -----
diff --git a/gcut/default.edl.inc b/gcut/default.edl.inc
index 6606a43..8054cdb 100644
--- a/gcut/default.edl.inc
+++ b/gcut/default.edl.inc
@@ -10,6 +10,7 @@
 "t0=56.702866\n"
 "frame-pos=0.000\n"
 "\n"
+"-- 21.000s 23.000s pixelize x-size=0.1rel y-size=0.1rel\n"
 "gegl:color value=black gegl:crop width=400 height=400 1.240s 2.000s -- \n"
 "gegl:color opi=0:0 gegl:crop opi=0:0 width=400 height=400 0.000s 2.000s -- [fade=1.040s] svg:src-over 
opi=0:0 aux=[  gegl:text opi=0:0 string='note: this is a gcut video\\nproject for testing features\\nit 
relies on synthetic GEGL\\npatterns instead of\\nvideo footage\\nto be to minimie size\\nfor inclusion in 
gcut sources\\nbeing able to create this project \\nfrom scratch in the gcut ui\\nis a current goal.' 
size=0.071811296045780182rel color='rgb(1.0000, 1.0000, 1.0000)' width=3 height=1 gegl:translate opi=0:0 
x=0.10000000000000001rel y=0.051874876022338867rel ]\n"
 "gegl:color opi=0:0 gegl:crop opi=0:0 width=400 height=400 reset-origin=true 0.000s 3.200s -- svg:src-over 
opi=0:0 aux=[  gegl:text opi=0:0 string='gcut' font='sans' size=0.20000000000000001rel color='rgb(1.0000, 
1.0000, 1.0000)' width=1 height=1 gegl:gaussian-blur opi=0:0 std-dev-x={  0.000000=0.400000rel  
2.560000=0.000084rel  }  std-dev-y={  0.000000=0.200000rel  }  clip-extent=false gegl:translate opi=0:0 
x=0.10000000000000001rel y=0.3304142951965332rel ]  gegl:lens-flare opi=0:0 pos-x={  0.000000=-2.000000  
2.400000=0.293004  4.000000=2.000000  }  pos-y={  0.000000=0.100000  2.400000=0.360697  25.000000=0.910000  
}\n"
@@ -27,6 +28,5 @@
 "gegl:noise-solid opi=0:0 gegl:crop opi=0:0 width=400 height=400 0.000s 1.000s -- [fade=1.440s] svg:src-over 
opi=0:0 aux=[  gegl:text opi=0:0 string='crash recovery by default' size=0.081632360816001892rel 
color='rgb(1.0000, 1.0000, 0.0000)' width=1 height=1 gegl:translate opi=0:0 x=0.10000000000000001rel 
y=0.42925620079040527rel ]\n"
 "gegl:noise-solid opi=0:0 gegl:crop opi=0:0 width=400 height=400 0.000s 1.000s -- [fade=1.360s] svg:src-over 
opi=0:0 aux=[  gegl:text opi=0:0 string='overlays:audio filter' size=0.10000000000000001rel 
color='rgb(1.0000, 1.0000, 0.0000)' width=1 height=1 gegl:translate opi=0:0 x=0.10000000000000001rel 
y=0.48208630084991455rel ]\n"
 "gegl:noise-solid gegl:crop width=400 height=400 0.000s 1.000s -- [fade=1.360s] over aux=[ text size=0.1rel 
string='network rendering' color=yellow translate x=0.1rel y=0.8rel ]\n"
-"--           #end titles\n"
 "gegl:color opi=0:0 gegl:crop opi=0:0 width=400 height=400 0.000s 18.960s -- svg:src-over opi=0:0 aux=[  
gegl:text opi=0:0 string='end titles\\n\\nfull of newlines\\n\\nand some images and more\\n\\nmost of the 
time\\n\\n\\nthough\\n\\nusing an image that one pans\\nwill provide better typographic control\\nperhaps 
based on a pdf/svg\\n\\nthis is is also where I should stick misc info' size=0.040000000000000001rel 
color='rgb(1.0000, 1.0000, 1.0000)' width=1 height=8 gegl:translate opi=0:0 x=0.10000000000000001rel y={  
0.000000=1.000000rel  32.000000=-2.000000rel  }  ]\n"
 "-----\n"
diff --git a/gcut/gcut-ui.c b/gcut/gcut-ui.c
index adc94cf..096bc86 100644
--- a/gcut/gcut-ui.c
+++ b/gcut/gcut-ui.c
@@ -272,6 +272,19 @@ static void drag_dropped (MrgEvent *ev, void *data1, void *data2)
 }
 static void scroll_to_fit (GeglEDL *edl, Mrg *mrg);
 
+static void clicked_overlay (MrgEvent *e, void *data1, void *data2)
+{
+  Clip *clip = data1;
+  GeglEDL *edl = data2;
+
+  edl->frame_pos_ui = e->x;
+  gcut_snap_ui_pos (edl);
+  edl->active_overlay = clip;
+  edl->playing = 0;
+  scroll_to_fit (edl, e->mrg);
+  mrg_event_stop_propagate (e);
+  mrg_queue_draw (e->mrg, NULL);
+}
 
 static void clicked_clip (MrgEvent *e, void *data1, void *data2)
 {
@@ -283,6 +296,7 @@ static void clicked_clip (MrgEvent *e, void *data1, void *data2)
   edl->selection_start = edl->frame_pos_ui;
   edl->selection_end = edl->frame_pos_ui;
   edl->active_clip = clip;
+  edl->active_overlay = NULL;
   edl->playing = 0;
   scroll_to_fit (edl, e->mrg);
   mrg_queue_draw (e->mrg, NULL);
@@ -569,12 +583,10 @@ static void clip_remove (Clip *clip)
 }
 
 static GeglNode *selected_node = NULL;
-static int       selected_expanded = 0;
 
 static void select_no_node (void)
 {
   selected_node = 0;
-  selected_expanded = 0;
 }
 
 static void remove_clip (MrgEvent *event, void *data1, void *data2)
@@ -2080,7 +2092,7 @@ static float print_props (Mrg *mrg, GeglEDL *edl, GeglNode *node, float x, float
     if (str)
     {
       g_free (str);
-      y -= mrg_em (mrg) * 1.2;
+      y += mrg_em (mrg) * 1.2;
     }
 
     if (g_object_get_qdata (G_OBJECT (node), rel_quark))
@@ -2194,19 +2206,10 @@ static void select_node (MrgEvent *e, void *data1, void *data2)
 {
   if (selected_node == data1)
   {
-    if (selected_expanded)
-    {
-      selected_expanded = 0;
-    }
-    else
-    {
-      selected_expanded = 1;
-    }
   }
   else
   {
     selected_node = data1;
-    selected_expanded = 0;
   }
   snode = NULL;
   sprop = NULL;
@@ -2458,10 +2461,9 @@ static float print_nodes (Mrg *mrg, GeglEDL *edl, GeglNode *node, float x, float
           y -= mrg_em (mrg) * 1.15;
         }
 
-        if ((node == selected_node) && selected_expanded)
+        if ((node == selected_node))
         {
-          y = print_props (mrg, edl, node, x + mrg_em(mrg) * 1.0, y);
-          y -= mrg_em (mrg) * 0.15;
+          print_props (mrg, edl, node, mrg_em(mrg) * 1.0, mrg_em(mrg) * 1.8);
         }
         y -= mrg_em (mrg) * 0.1;
 
@@ -2906,9 +2908,15 @@ static void gcut_draw (Mrg     *mrg,
       cairo_restore (cr);
 #endif
       cairo_rectangle (cr, clip->start, y + VID_HEIGHT * 0.25, clip->end - clip->start, VID_HEIGHT * 0.1);
+      mrg_listen (mrg, MRG_PRESS, clicked_overlay, clip, edl);
+      //YYY
 
       cairo_save (cr);
-      cairo_set_source_rgba (cr, 1, 1, 1, 0.5);
+
+      if (clip == edl->active_overlay)
+        cairo_set_source_rgba (cr, 1, 1, 0, 1.0);
+      else
+        cairo_set_source_rgba (cr, 1, 1, 1, 0.5);
       cairo_identity_matrix (cr);
       cairo_stroke (cr);
       cairo_restore (cr);
@@ -3344,7 +3352,7 @@ int gcut_ui_main (GeglEDL *edl)
 
   mrg_add_timeout (mrg, 10100, save_idle, edl);
 
-  if (1)
+  if (0)
   {
     cache_renderer_iteration (mrg, edl);
     mrg_add_timeout (mrg, 90 /* seconds */  * 1000, cache_renderer_iteration, edl);
diff --git a/gcut/gcut.c b/gcut/gcut.c
index 43e6435..81e111e 100644
--- a/gcut/gcut.c
+++ b/gcut/gcut.c
@@ -909,6 +909,7 @@ static void gcut_reread (GeglEDL *edl)
   edl->clips = new_edl->clips;
   new_edl->clips = l;
   edl->active_clip = NULL; // XXX: better to resolve?
+  edl->active_overlay = NULL;
 
   for (l = edl->clips; l; l = l->next)
   {
diff --git a/gcut/gcut.h b/gcut/gcut.h
index 9528a13..a3730d3 100644
--- a/gcut/gcut.h
+++ b/gcut/gcut.h
@@ -227,6 +227,8 @@ struct _GeglEDL
   double        t0;
   Clip         *active_clip;
 
+  Clip         *active_overlay;
+
   void         *mrg;
 
   char         *clip_query;


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