[gegl] bin: add basename/dirname/entry_no accessors



commit b3564469874d1475d12a07de4366bc2a813067b6
Author: Øyvind Kolås <pippin gimp org>
Date:   Sun May 5 12:45:36 2019 +0200

    bin: add basename/dirname/entry_no accessors

 bin/lua/init.lua   | 15 +++++++++++++--
 bin/lua/viewer.lua |  6 +++---
 bin/ui.h           | 11 +++++++----
 3 files changed, 23 insertions(+), 9 deletions(-)
---
diff --git a/bin/lua/init.lua b/bin/lua/init.lua
index 03a6cc275..c1319eb13 100644
--- a/bin/lua/init.lua
+++ b/bin/lua/init.lua
@@ -248,8 +248,16 @@ meta_swap_children (GeState    *state,
                     int         child_no2,
                     const char *child_name2);
 
-char *meta_child_no_path (GeState *o, const char *path, int child_no);
 
+int         ui_items_count         (GeState *o);
+
+
+char *get_item_dir     (GeState *o);  /* current dir */
+int   get_item_no      (GeState *o);  /* current no */
+char *get_item_path    (GeState *o);  /* currently selected path */
+char *get_item_path_no (GeState *o, int child_no);
+
+void g_free (void *data);
 
 ]]
 
@@ -258,7 +266,10 @@ mrg = o.mrg
 
 ffi.metatype('GeState', {__index = {
    get_key_int = function(...) return ffi.C.meta_get_key_int(...) end;
-   --get_n_paths = function(...) return ffi.C.get_state_get_n_paths(...) end;
+   items_count = function(...) return ffi.C.ui_items_count(...) end;
+   item_no = function(...) return ffi.C.get_item_no(...) end;
+   item_path = function(...) new = ffi.C.get_item_path(...); local ret = ffi.string(new) ; 
ffi.C.g_free(new); return ret; end;
+   item_path_no = function(...) new = ffi.C.get_item_path_no(...); local ret = ffi.string(new) ; 
ffi.C.g_free(new); return ret; end;
  }})
 
 function touch_point(x, y)
diff --git a/bin/lua/viewer.lua b/bin/lua/viewer.lua
index 63d5a57d5..43e082c71 100644
--- a/bin/lua/viewer.lua
+++ b/bin/lua/viewer.lua
@@ -314,7 +314,7 @@ if o.is_video ~= 0 then
 end
 
 
-if 0 ~= 0 then -- hack for testing animation scrubbing
+if 1 ~= 0 then
 
   local frame = o.pos;
   local frames = o.duration;
@@ -366,9 +366,9 @@ function draw_thumb_bar()
   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)
-    end)
+    print('a') end)
   cr:fill()
-  mrg:print("thumbbar")
+  mrg:print("thumbbar" .. o:item_no() .. '' .. o:item_path())
 end
 
 mrg:add_binding("page-up", NULL, "previous image",
diff --git a/bin/ui.h b/bin/ui.h
index 8dd5c6cc7..dc063b365 100644
--- a/bin/ui.h
+++ b/bin/ui.h
@@ -282,7 +282,6 @@ meta_swap_children (GeState    *state,
                     int         child_no2,
                     const char *child_name2);
 
-char *get_item_path_no (GeState *o, int child_no);
 
 void   ui_viewer           (GeState *o);
 void   ui_collection       (GeState *o);
@@ -296,11 +295,15 @@ void   ui_queue_thumb      (const char *path);
 void   ui_contrasty_stroke (cairo_t *cr);
 
 void ui_run_command (MrgEvent *event_or_null, void *commandline, void *ignored);
-char *get_item_dir (GeState *o);
-int get_item_no (GeState *o);
-char *get_item_path (GeState *o);
+
+
+char *get_item_dir     (GeState *o);  /* current dir */
+int   get_item_no      (GeState *o);  /* current no */
+char *get_item_path    (GeState *o);  /* currently selected path */
+char *get_item_path_no (GeState *o, int child_no);
 
 GeState *global_state;
+
 void populate_path_list (GeState *o);
 
 #endif


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