int dt_lua_init_database(lua_State *L) { /* database type */ dt_lua_push_darktable_lib(L); luaA_Type type_id = dt_lua_init_singleton(L, "image_database", NULL); lua_setfield(L, -2, "database"); lua_pop(L, 1); lua_pushcfunction(L, database_len); lua_pushcfunction(L, database_numindex); dt_lua_type_register_number_const_type(L, type_id); lua_pushcfunction(L, dt_lua_duplicate_image); lua_pushcclosure(L, dt_lua_type_member_common, 1); dt_lua_type_register_const_type(L, type_id, "duplicate"); lua_pushcfunction(L, dt_lua_delete_image); lua_pushcclosure(L, dt_lua_type_member_common, 1); dt_lua_type_register_const_type(L, type_id, "delete"); lua_pushcfunction(L, import_images); lua_pushcclosure(L, dt_lua_type_member_common, 1); dt_lua_type_register_const_type(L, type_id, "import"); lua_pushcfunction(L, dt_lua_move_image); lua_pushcclosure(L, dt_lua_type_member_common, 1); dt_lua_type_register_const_type(L, type_id, "move_image"); lua_pushcfunction(L, dt_lua_copy_image); lua_pushcclosure(L, dt_lua_type_member_common, 1); dt_lua_type_register_const_type(L, type_id, "copy_image"); /* database type */ dt_lua_push_darktable_lib(L); type_id = dt_lua_init_singleton(L, "image_collection", NULL); lua_setfield(L, -2, "collection"); lua_pop(L, 1); lua_pushcfunction(L, collection_len); lua_pushcfunction(L, collection_numindex); dt_lua_type_register_number_const_type(L, type_id); lua_pushcfunction(L, dt_lua_event_multiinstance_register); lua_pushcfunction(L, dt_lua_event_multiinstance_trigger); dt_lua_event_add(L, "post-import-film"); dt_control_signal_connect(darktable.signals, DT_SIGNAL_FILMROLLS_IMPORTED, G_CALLBACK(on_film_imported), NULL); lua_pushcfunction(L, dt_lua_event_multiinstance_register); lua_pushcfunction(L, dt_lua_event_multiinstance_trigger); dt_lua_event_add(L, "post-import-image"); dt_control_signal_connect(darktable.signals, DT_SIGNAL_IMAGE_IMPORT, G_CALLBACK(on_image_imported), NULL); return 0; }
static int dt_lua_init_init(lua_State*L) { lua_pushcfunction(L, dt_lua_event_multiinstance_register); lua_pushcfunction(L, dt_lua_event_multiinstance_trigger); dt_lua_event_add(L,"exit"); return 0; }
int dt_lua_init_view(lua_State *L) { lua_pushcfunction(L, dt_lua_event_multiinstance_register); lua_pushcfunction(L, dt_lua_event_multiinstance_trigger); dt_lua_event_add(L, "view-changed"); dt_control_signal_connect(darktable.signals, DT_SIGNAL_VIEWMANAGER_VIEW_CHANGED, G_CALLBACK(on_view_changed), NULL); return 0; }
void init(struct dt_lib_module_t *self) { lua_State *L = darktable.lua_state.state; int my_type = dt_lua_module_entry_get_type(L, "lib", self->plugin_name); lua_pushcfunction(L, grouping_member); lua_pushcclosure(L,dt_lua_gtk_wrap,1); dt_lua_type_register_type(L, my_type, "grouping"); lua_pushcfunction(L, show_overlays_member); lua_pushcclosure(L,dt_lua_gtk_wrap,1); dt_lua_type_register_type(L, my_type, "show_overlays"); lua_pushcfunction(L, dt_lua_event_multiinstance_register); lua_pushcfunction(L, dt_lua_event_multiinstance_trigger); dt_lua_event_add(L, "global_toolbox-grouping_toggle"); lua_pushcfunction(L, dt_lua_event_multiinstance_register); lua_pushcfunction(L, dt_lua_event_multiinstance_trigger); dt_lua_event_add(L, "global_toolbox-overlay_toggle"); }
int dt_lua_init_gui(lua_State *L) { if(darktable.gui != NULL) { /* images */ dt_lua_push_darktable_lib(L); luaA_Type type_id = dt_lua_init_singleton(L, "gui_lib", NULL); lua_setfield(L, -2, "gui"); lua_pop(L, 1); lua_pushcfunction(L, selection_cb); lua_pushcclosure(L,dt_lua_gtk_wrap,1); lua_pushcclosure(L, dt_lua_type_member_common, 1); dt_lua_type_register_const_type(L, type_id, "selection"); lua_pushcfunction(L, hovered_cb); dt_lua_type_register_const_type(L, type_id, "hovered"); lua_pushcfunction(L, act_on_cb); dt_lua_type_register_const_type(L, type_id, "action_images"); lua_pushcfunction(L, current_view_cb); lua_pushcclosure(L, dt_lua_type_member_common, 1); dt_lua_type_register_const_type(L, type_id, "current_view"); lua_pushcfunction(L, lua_create_job); lua_pushcclosure(L, dt_lua_type_member_common, 1); dt_lua_type_register_const_type(L, type_id, "create_job"); dt_lua_module_push(L, "lib"); lua_pushcclosure(L, dt_lua_type_member_common, 1); dt_lua_type_register_const_type(L, type_id, "libs"); dt_lua_module_push(L, "view"); lua_pushcclosure(L, dt_lua_type_member_common, 1); dt_lua_type_register_const_type(L, type_id, "views"); // create a type describing a job object int job_type = dt_lua_init_gpointer_type(L, dt_lua_backgroundjob_t); lua_pushcfunction(L, lua_job_progress); dt_lua_type_register_type(L, job_type, "percent"); lua_pushcfunction(L, lua_job_valid); dt_lua_type_register_type(L, job_type, "valid"); // allow to react to highlighting an image lua_pushcfunction(L, dt_lua_event_multiinstance_register); lua_pushcfunction(L, dt_lua_event_multiinstance_trigger); dt_lua_event_add(L, "mouse-over-image-changed"); dt_control_signal_connect(darktable.signals, DT_SIGNAL_MOUSE_OVER_IMAGE_CHANGE, G_CALLBACK(on_mouse_over_image_changed), NULL); } return 0; }