Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
events.c File Reference
#include "lua/events.h"
#include "common/darktable.h"
#include "common/file_location.h"
#include "common/imageio_module.h"
#include "control/control.h"
#include "control/jobs/control_jobs.h"
#include "lua/call.h"
#include "lua/image.h"
+ Include dependency graph for events.c:

Functions

void dt_lua_event_trigger (lua_State *L, const char *event, int nargs)
 
int dt_lua_event_trigger_wrapper (lua_State *L)
 
void dt_lua_event_add (lua_State *L, const char *evt_name)
 
int dt_lua_event_keyed_register (lua_State *L)
 
int dt_lua_event_keyed_destroy (lua_State *L)
 
int dt_lua_event_keyed_trigger (lua_State *L)
 
int dt_lua_event_multiinstance_register (lua_State *L)
 
int dt_lua_event_multiinstance_destroy (lua_State *L)
 
int dt_lua_event_multiinstance_trigger (lua_State *L)
 
static int lua_register_event (lua_State *L)
 
static int lua_destroy_event (lua_State *L)
 
int dt_lua_init_early_events (lua_State *L)
 
int dt_lua_init_events (lua_State *L)
 

Function Documentation

◆ dt_lua_event_add()

void dt_lua_event_add ( lua_State L,
const char *  evt_name 
)

Add a new event to the lua API evt_name : the id to use for the event EXPECTED STACK -3 : closure to be called on darktable.register_event in charge of saving the info that will be needed when the event triggers including the actual callbacks to use can raise lua_error 1 : a table to save info for the event (including the callback to user) 2 : a table to save the indexing information 3 : index name 4 : event name 5 : callback to use 6+ : extra parameters given in register_event should not return anything -2 : closure to be called on darktable.destroy_event in charge of removing the saved info so the callback wont be used the next time the event is triggered can raise lua error 1 : a table containing info for the event (including the callback to user) 2 : a table to save the indexing information 3 : index name 4 : event name should not return anything -1 : closure to be called when event is triggered, in charge of using the data provided by the register function to call the callbacks 1 : the table filled by the registration function ... : extra parameters passed when the event was triggered

References DT_DEBUG_LUA, and dt_print().

Referenced by dt_lua_init_database(), dt_lua_init_events(), dt_lua_init_gui(), dt_lua_init_init(), dt_lua_init_view(), and init().

◆ dt_lua_event_keyed_destroy()

int dt_lua_event_keyed_destroy ( lua_State L)

◆ dt_lua_event_keyed_register()

int dt_lua_event_keyed_register ( lua_State L)

KEYED EVENT an event that is registered with a string key. It can be registered only once per key.

the register function wants one extra parameter from lua : the key to register with

the destroy function wants one extra parameter from lua : the key to destroy

the trigger function wants the bottom most arg to be the key to trigger

◆ dt_lua_event_keyed_trigger()

int dt_lua_event_keyed_trigger ( lua_State L)

References dt_lua_treated_pcall().

Referenced by dt_lua_init_events().

◆ dt_lua_event_multiinstance_destroy()

int dt_lua_event_multiinstance_destroy ( lua_State L)

◆ dt_lua_event_multiinstance_register()

int dt_lua_event_multiinstance_register ( lua_State L)

MULTIINSTANCE EVENT an event that can be registered (by the lua side) multiple times. All callbacks will be called when the event is triggered

the register function does not expect any extra parameter from the lua side

the destroy function does not expect any extra parameter from the lua side

the trigger will pass the arguments as is to the lua callback

add the index

Referenced by dt_lua_init_database(), dt_lua_init_events(), dt_lua_init_gui(), dt_lua_init_init(), dt_lua_init_view(), and init().

◆ dt_lua_event_multiinstance_trigger()

int dt_lua_event_multiinstance_trigger ( lua_State L)

◆ dt_lua_event_trigger()

void dt_lua_event_trigger ( lua_State L,
const char *  event,
int  nargs 
)

Trigger an event that has been previously added event : the id the event was registered under nargs : the number of significant items on the stack. these items will be passed as extra parameters to the event's callback

References dt_lua_redraw_screen(), and dt_lua_treated_pcall().

Referenced by _export_apply_lua_actions(), _film_import1(), _image_import_internal(), dt_lua_event_trigger_wrapper(), and dt_lua_finalize_early().

◆ dt_lua_event_trigger_wrapper()

int dt_lua_event_trigger_wrapper ( lua_State L)

wrapper for the previous function to use with dt_lua_async_call first parameter is the event name other parameters will be passed to the event handler

References dt_lua_event_trigger().

Referenced by _on_mouse_over_image_changed(), enter(), and on_view_changed().

◆ dt_lua_init_early_events()

int dt_lua_init_early_events ( lua_State L)

initialize events, called at DT start

References dt_lua_push_darktable_lib(), lua_destroy_event(), and lua_register_event().

◆ dt_lua_init_events()

◆ lua_destroy_event()

static int lua_destroy_event ( lua_State L)
static

◆ lua_register_event()

static int lua_register_event ( lua_State L)
static