Exemple #1
0
int dt_lua_init_early_lib(lua_State *L)
{

#if 0
  luaA_enum(L,dt_ui_container_t);
  luaA_enum_value(L,dt_ui_container_t,DT_UI_CONTAINER_PANEL_LEFT_TOP);
  luaA_enum_value(L,dt_ui_container_t,DT_UI_CONTAINER_PANEL_LEFT_CENTER);
  luaA_enum_value(L,dt_ui_container_t,DT_UI_CONTAINER_PANEL_LEFT_BOTTOM);
  luaA_enum_value(L,dt_ui_container_t,DT_UI_CONTAINER_PANEL_RIGHT_TOP);
  luaA_enum_value(L,dt_ui_container_t,DT_UI_CONTAINER_PANEL_RIGHT_CENTER);
  luaA_enum_value(L,dt_ui_container_t,DT_UI_CONTAINER_PANEL_RIGHT_BOTTOM);
  luaA_enum_value(L,dt_ui_container_t,DT_UI_CONTAINER_PANEL_TOP_LEFT);
  luaA_enum_value(L,dt_ui_container_t,DT_UI_CONTAINER_PANEL_TOP_CENTER);
  luaA_enum_value(L,dt_ui_container_t,DT_UI_CONTAINER_PANEL_TOP_RIGHT);
  luaA_enum_value(L,dt_ui_container_t,DT_UI_CONTAINER_PANEL_CENTER_TOP_LEFT);
  luaA_enum_value(L,dt_ui_container_t,DT_UI_CONTAINER_PANEL_CENTER_TOP_CENTER);
  luaA_enum_value(L,dt_ui_container_t,DT_UI_CONTAINER_PANEL_CENTER_TOP_RIGHT);
  luaA_enum_value(L,dt_ui_container_t,DT_UI_CONTAINER_PANEL_CENTER_BOTTOM_LEFT);
  luaA_enum_value(L,dt_ui_container_t,DT_UI_CONTAINER_PANEL_CENTER_BOTTOM_CENTER);
  luaA_enum_value(L,dt_ui_container_t,DT_UI_CONTAINER_PANEL_CENTER_BOTTOM_RIGHT);
  luaA_enum_value(L,dt_ui_container_t,DT_UI_CONTAINER_PANEL_BOTTOM);
#endif

  dt_lua_init_type(L, dt_lib_module_t);
  lua_pushcfunction(L, lib_reset);
  lua_pushcclosure(L, dt_lua_type_member_common, 1);
  dt_lua_type_register_const(L, dt_lib_module_t, "reset");
  lua_pushcfunction(L, version_member);
  dt_lua_type_register_const(L, dt_lib_module_t, "version");
  lua_pushcfunction(L, id_member);
  dt_lua_type_register_const(L, dt_lib_module_t, "id");
  lua_pushcfunction(L, name_member);
  dt_lua_type_register_const(L, dt_lib_module_t, "name");
  lua_pushcfunction(L, expandable_member);
  dt_lua_type_register_const(L, dt_lib_module_t, "expandable");
  lua_pushcfunction(L, expanded_member);
  lua_pushcclosure(L,dt_lua_gtk_wrap,1);
  dt_lua_type_register(L, dt_lib_module_t, "expanded");
#if 0
  lua_pushcfunction(L,position_member);
  dt_lua_type_register_const(L,dt_lib_module_t,"position");
  lua_pushcfunction(L,container_member);
  dt_lua_type_register_const(L,dt_lib_module_t,"container");
  lua_pushcfunction(L,views_member);
  dt_lua_type_register_const(L,dt_lib_module_t,"views");
#endif
  lua_pushcfunction(L, visible_member);
  lua_pushcclosure(L,dt_lua_gtk_wrap,1);
  dt_lua_type_register(L, dt_lib_module_t, "visible");
  lua_pushcfunction(L, on_screen_member);
  dt_lua_type_register_const(L, dt_lib_module_t, "on_screen");

  dt_lua_module_new(L, "lib"); // special case : will be attached to dt.gui in lua/gui.c:dt_lua_init_gui
  return 0;
}
Exemple #2
0
int dt_lua_init_early_view(lua_State *L)
{

  dt_lua_init_type(L, dt_lua_view_t);
  lua_pushcfunction(L, id_member);
  dt_lua_type_register_const(L, dt_lua_view_t, "id");
  lua_pushcfunction(L, name_member);
  dt_lua_type_register_const(L, dt_lua_view_t, "name");

  dt_lua_module_new(L, "view"); // special case : will be attached to dt.gui in lua/gui.c:dt_lua_init_gui


  return 0;
}
Exemple #3
0
int dt_lua_init_widget(lua_State* L)
{

  lua_newtable(L);
  lua_setfield(L, LUA_REGISTRYINDEX,"dt_lua_widget_bind_table");

  dt_lua_module_new(L,"widget");

  widget_type.associated_type = dt_lua_init_gpointer_type(L,lua_widget);
  lua_pushcfunction(L,tooltip_member);
  dt_lua_gtk_wrap(L);
  dt_lua_type_register(L, lua_widget, "tooltip");
  lua_pushcfunction(L,widget_gc);
  dt_lua_gtk_wrap(L);
  dt_lua_type_setmetafield(L,lua_widget,"__gc");
  lua_pushcfunction(L,reset_member);
  dt_lua_type_register(L, lua_widget, "reset_callback");
  lua_pushcfunction(L,widget_call);
  dt_lua_type_setmetafield(L,lua_widget,"__call");
  lua_pushcfunction(L,sensitive_member);
  dt_lua_gtk_wrap(L);
  dt_lua_type_register(L, lua_widget, "sensitive");
  lua_pushcfunction(L, dt_lua_widget_tostring_member);
  dt_lua_gtk_wrap(L);
  dt_lua_type_setmetafield(L,lua_widget,"__tostring");

  dt_lua_init_widget_container(L);

  dt_lua_init_widget_box(L);
  dt_lua_init_widget_button(L);
  dt_lua_init_widget_check_button(L);
  dt_lua_init_widget_combobox(L);
  dt_lua_init_widget_label(L);
  dt_lua_init_widget_entry(L);
  dt_lua_init_widget_file_chooser_button(L);
  dt_lua_init_widget_separator(L);
  dt_lua_init_widget_slider(L);
  dt_lua_init_widget_stack(L);
  dt_lua_init_widget_text_view(L);

  dt_lua_push_darktable_lib(L);
  lua_pushstring(L, "new_widget");
  lua_pushcfunction(L, &new_widget);
  lua_settable(L, -3);
  lua_pop(L, 1);
  return 0;
}
Exemple #4
0
int dt_lua_init_widget(lua_State* L)
{
  dt_lua_module_new(L,"widget");

  widget_type.associated_type = dt_lua_init_gpointer_type(L,lua_widget);
  lua_pushcfunction(L,tooltip_member);
  lua_pushcclosure(L,dt_lua_gtk_wrap,1);
  dt_lua_type_register(L, lua_widget, "tooltip");
  lua_pushcfunction(L,widget_gc);
  lua_pushcclosure(L,dt_lua_gtk_wrap,1);
  dt_lua_type_setmetafield(L,lua_widget,"__gc");
  lua_pushcfunction(L,reset_member);
  dt_lua_type_register(L, lua_widget, "reset_callback");
  lua_pushcfunction(L,widget_call);
  dt_lua_type_setmetafield(L,lua_widget,"__call");
  lua_pushcfunction(L,sensitive_member);
  lua_pushcclosure(L,dt_lua_gtk_wrap,1);
  dt_lua_type_register(L, lua_widget, "sensitive");
  
  dt_lua_init_widget_container(L);

  dt_lua_init_widget_box(L);
  dt_lua_init_widget_button(L);
  dt_lua_init_widget_check_button(L);
  dt_lua_init_widget_combobox(L);
  dt_lua_init_widget_label(L);
  dt_lua_init_widget_entry(L);
  dt_lua_init_widget_file_chooser_button(L);
  dt_lua_init_widget_separator(L);
  dt_lua_init_widget_slider(L);
  dt_lua_init_widget_stack(L);

  luaA_enum(L,dt_lua_orientation_t);
  luaA_enum_value_name(L,dt_lua_orientation_t,GTK_ORIENTATION_HORIZONTAL,"horizontal");
  luaA_enum_value_name(L,dt_lua_orientation_t,GTK_ORIENTATION_VERTICAL,"vertical");



  dt_lua_push_darktable_lib(L);
  lua_pushstring(L, "new_widget");
  lua_pushcfunction(L, &new_widget);
  lua_settable(L, -3);
  lua_pop(L, 1);
  return 0;
}