[gegl] bin: refactor towards being able to to viewer thumbbar in lua



commit 38a655c346754e41ecaa49478cc521c756986126
Author: Øyvind Kolås <pippin gimp org>
Date:   Sat Apr 20 18:49:02 2019 +0200

    bin: refactor towards being able to to viewer thumbbar in lua

 bin/lua/viewer.lua | 18 +++++++++++++-----
 bin/ui-core.c      |  1 -
 bin/ui.h           |  2 +-
 3 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/bin/lua/viewer.lua b/bin/lua/viewer.lua
index cae2bffbe..bce20d1c1 100644
--- a/bin/lua/viewer.lua
+++ b/bin/lua/viewer.lua
@@ -326,6 +326,16 @@ function pdf_prev_page()
   source:set_property('page', GObject.Value(GObject.Type.INT, page - 1))
 end
 
+function draw_thumb_bar()
+  local cr=mrg:cr()
+  cr:set_source_rgba(1,1,1,.1)
+  cr:rectangle(0, mrg:height()*0.8, mrg:width(), mrg:height()*0.2)
+  mrg:listen(Mrg.MOTION, function(e)
+    print('a') end)
+  cr:fill()
+  mrg:print("thumbbar")
+end
+
 mrg:add_binding("page-up", NULL, "previous image",
   function() ffi.C.argvs_eval ("prev") end)
 
@@ -373,11 +383,9 @@ if path:find(".pdf$") or path:find('.PDF$') then
   mrg:add_binding("page-down", NULL, "next page",
     function(e) pdf_next_page() e:stop_propagate() end)
 
-
-
-
 end
 
+draw_thumb_bar()
 
 mrg:add_binding("alt-right", NULL, "next image",
   function() ffi.C.argvs_eval ("next") end)
@@ -425,7 +433,7 @@ if o.show_controls ~= 0 then
     for i=1,stars do
       mrg:text_listen(Mrg.PRESS, function(e)
           ffi.C.argvs_eval('star ' .. i)
-          print('star ' .. i)
+          e:stop_propagate()
       end)
       mrg:print('★')
       mrg:text_listen_done()
@@ -434,7 +442,7 @@ if o.show_controls ~= 0 then
     for i=stars+1,5 do
       mrg:text_listen(Mrg.PRESS, function(e)
           ffi.C.argvs_eval('star ' .. i)
-          print('star ' .. i)
+          e:stop_propagate()
       end)
       mrg:print('★')
       mrg:text_listen_done()
diff --git a/bin/ui-core.c b/bin/ui-core.c
index 9990edbb0..7e722ebaf 100644
--- a/bin/ui-core.c
+++ b/bin/ui-core.c
@@ -725,7 +725,6 @@ static void populate_path_list (GeState *o)
     o->paths = g_list_concat (o->paths, temp);
   }
 
-
   for (int i = 0; i < n;i++)
     free(namelist[i]);
   free (namelist);
diff --git a/bin/ui.h b/bin/ui.h
index 811c8dc1c..adef7c476 100644
--- a/bin/ui.h
+++ b/bin/ui.h
@@ -31,7 +31,7 @@ typedef struct _GeStateClass         GeStateClass;
 
 typedef struct _IndexItem IndexItem;
 
-#define INDEX_MAX_ATTRIBUTES  8
+#define INDEX_MAX_ATTRIBUTES  16
 
 struct _IndexItem {
   char *name;


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