Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
lib.c File Reference
#include "common/sentry.h"
#include "widgets/widget_settings.h"
#include "common/telemetry.h"
#include "widgets/gdkkeys.h"
#include "libs/lib.h"
#include "views/view.h"
#include "database/preset_repository.h"
#include "system/macros.h"
#include "common/module.h"
#include "common/module_versioning.h"
#include "common/conf.h"
#include "control/control.h"
#include "develop/develop.h"
#include "widgets/button.h"
#include "widgets/expander.h"
#include "gui/color_picker_proxy.h"
#include "libs/colorpicker.h"
#include "gui/application.h"
#include "gui/presets.h"
#include <stdbool.h>
#include <stdlib.h>
#include "widgets/label.h"
#include "widgets/popup.h"
#include "widgets/widget_style.h"
#include "control/signal.h"
#include "libs/lib_api.h"
+ Include dependency graph for lib.c:

Go to the source code of this file.

Data Structures

struct  dt_lib_module_info_t
 
struct  dt_lib_presets_edit_dialog_t
 

Macros

#define INCLUDE_API_FROM_MODULE_LOAD   "lib_load_module"
 

Typedefs

typedef enum dt_action_element_lib_t dt_action_element_lib_t
 
typedef struct dt_lib_module_info_t dt_lib_module_info_t
 
typedef struct dt_lib_presets_edit_dialog_t dt_lib_presets_edit_dialog_t
 

Enumerations

enum  dt_action_element_lib_t {
  DT_ACTION_ELEMENT_SHOW = 0 ,
  DT_ACTION_ELEMENT_RESET = 1 ,
  DT_ACTION_ELEMENT_PRESETS = 2
}
 

Functions

gboolean dt_lib_is_visible_in_view (dt_lib_module_t *module, const dt_view_t *view)
 
static void dt_lib_unload_module (dt_lib_module_t *module)
 
static gchar * get_active_preset_name (dt_lib_module_info_t *minfo)
 
static void edit_preset (const char *name_in, dt_lib_module_info_t *minfo)
 
static void menuitem_update_preset (GtkMenuItem *menuitem, dt_lib_module_info_t *minfo)
 
static void menuitem_new_preset (GtkMenuItem *menuitem, dt_lib_module_info_t *minfo)
 
static void menuitem_edit_preset (GtkMenuItem *menuitem, dt_lib_module_info_t *minfo)
 
static void menuitem_manage_presets (GtkMenuItem *menuitem, dt_lib_module_info_t *minfo)
 
static void menuitem_delete_preset (GtkMenuItem *menuitem, dt_lib_module_info_t *minfo)
 
gchar * dt_lib_presets_duplicate (const gchar *preset, const gchar *module_name, int module_version)
 
void dt_lib_presets_remove (const gchar *preset, const gchar *module_name, int module_version)
 
gboolean dt_lib_presets_apply (const gchar *preset, const gchar *module_name, int module_version)
 
void dt_lib_presets_update (const gchar *preset, const gchar *module_name, int module_version, const gchar *newname, const gchar *desc, const void *params, const int32_t params_size)
 
static void pick_callback (GtkMenuItem *menuitem, dt_lib_module_info_t *minfo)
 
static void free_module_info (GtkWidget *widget, gpointer user_data)
 
static void dt_lib_presets_popup_menu_show (dt_lib_module_info_t *minfo)
 
gint dt_lib_sort_plugins (gconstpointer a, gconstpointer b)
 
static gboolean default_expandable (dt_lib_module_t *self)
 
static gboolean default_preset_autoapply (dt_lib_module_t *self)
 
int default_lib_focus (dt_gui_module_t *m, gboolean toogle)
 
static int _lib_plugin_body_button_press (GtkWidget *w, GdkEventButton *e, gpointer user_data)
 
static int dt_lib_load_module (void *m, const char *libname, const char *module_name)
 
static void * _update_params (dt_lib_module_t *module, const void *const old_params, size_t old_params_size, int old_version, int target_version, size_t *new_size)
 
void dt_lib_init_presets (dt_lib_module_t *module)
 
static gboolean _lib_plugin_focus_accel (GtkAccelGroup *accel_group, GObject *accelerable, guint keyval, GdkModifierType modifier, gpointer data)
 
static void dt_lib_init_module (void *m)
 
static void dt_lib_gui_reset_callback (GtkButton *button, gpointer user_data)
 
static void presets_popup_callback (GtkButton *button, dt_lib_module_t *module)
 
static void _lib_module_expander_gone (gpointer user_data, GObject *where_the_object_was)
 
void dt_lib_gui_set_expanded (dt_lib_module_t *module, gboolean expanded)
 
gboolean dt_lib_gui_get_expanded (dt_lib_module_t *module)
 
static void _toggle_expanded (dt_lib_module_t *module, gboolean close_all)
 
static void _scroll_to_module (dt_lib_module_t *module)
 Queue the module's expander as the scroll target of the panel that holds it.
 
static void expand_callback (GtkButton *button, dt_lib_module_t *module)
 
static gboolean _lib_plugin_header_button_press (GtkWidget *w, GdkEventButton *e, gpointer user_data)
 
GtkWidget * dt_lib_gui_get_expander (dt_lib_module_t *module)
 
void dt_lib_init (dt_lib_t *lib)
 
void dt_lib_cleanup (dt_lib_t *lib)
 
void dt_lib_presets_add (const char *name, const char *plugin_name, const int32_t version, const void *params, const int32_t params_size, gboolean readonly)
 
static gchar * _get_lib_view_path (dt_lib_module_t *module, char *suffix)
 
gboolean dt_lib_is_visible (dt_lib_module_t *module)
 
void dt_lib_set_visible (dt_lib_module_t *module, gboolean visible)
 
gchar * dt_lib_get_localized_name (const gchar *plugin_name)
 
void dt_lib_colorpicker_set_box_area (dt_lib_t *lib, const dt_boundingbox_t box)
 
void dt_lib_colorpicker_set_point (dt_lib_t *lib, const float pos[2])
 
dt_lib_module_t * dt_lib_get_module (const char *name)
 
static gboolean _postponed_update (gpointer data)
 
void dt_lib_queue_postponed_update (dt_lib_module_t *mod, void(*update_fn)(dt_lib_module_t *self))
 
void dt_lib_cancel_postponed_update (dt_lib_module_t *mod)
 
gboolean dt_lib_presets_can_autoapply (dt_lib_module_t *mod)
 
gboolean dt_handle_dialog_enter (GtkWidget *widget, GdkEventKey *event, gpointer data)
 
GtkWidget * dt_action_button_new (dt_lib_module_t *self, const gchar *label, gpointer callback, gpointer data, const gchar *tooltip, guint accel_key, GdkModifierType mods)
 

Macro Definition Documentation

◆ INCLUDE_API_FROM_MODULE_LOAD

#define INCLUDE_API_FROM_MODULE_LOAD   "lib_load_module"

Typedef Documentation

◆ dt_action_element_lib_t

◆ dt_lib_module_info_t

◆ dt_lib_presets_edit_dialog_t

Enumeration Type Documentation

◆ dt_action_element_lib_t

Enumerator
DT_ACTION_ELEMENT_SHOW 
DT_ACTION_ELEMENT_RESET 
DT_ACTION_ELEMENT_PRESETS 

Definition at line 87 of file lib.c.

Function Documentation

◆ _get_lib_view_path()

static gchar * _get_lib_view_path ( dt_lib_module_t *  module,
char *  suffix 
)
static

◆ _lib_module_expander_gone()

static void _lib_module_expander_gone ( gpointer  user_data,
GObject *  where_the_object_was 
)
static

Definition at line 839 of file lib.c.

References dt_gui_get_global(), IS_NULL_PTR, and dt_gui_gtk_t::scroll_to.

Referenced by dt_lib_gui_get_expander().

◆ _lib_plugin_body_button_press()

static int _lib_plugin_body_button_press ( GtkWidget *  w,
GdkEventButton *  e,
gpointer  user_data 
)
static

Definition at line 521 of file lib.c.

References dt_widget_set_scroll_focus(), and FALSE.

Referenced by dt_lib_gui_get_expander().

◆ _lib_plugin_focus_accel()

static gboolean _lib_plugin_focus_accel ( GtkAccelGroup *  accel_group,
GObject *  accelerable,
guint  keyval,
GdkModifierType  modifier,
gpointer  data 
)
static

Definition at line 680 of file lib.c.

References FALSE.

Referenced by dt_lib_init_module().

◆ _lib_plugin_header_button_press()

static gboolean _lib_plugin_header_button_press ( GtkWidget *  w,
GdkEventButton *  e,
gpointer  user_data 
)
static

◆ _postponed_update()

static gboolean _postponed_update ( gpointer  data)
static

◆ _scroll_to_module()

static void _scroll_to_module ( dt_lib_module_t *  module)
static

Queue the module's expander as the scroll target of the panel that holds it.

The panel scrolls to it once its size has changed, that is once the module has expanded or collapsed. dt_lib_gui_set_expanded() only queues the right panel, so a click that toggles a module of the left panel has to name its panel here, before toggling.

Definition at line 983 of file lib.c.

References container(), dt_gui_get_global(), DT_UI_CONTAINER_PANEL_LEFT_CENTER, DT_UI_CONTAINER_PANEL_RIGHT_CENTER, and dt_gui_gtk_t::scroll_to.

Referenced by _lib_plugin_header_button_press(), and expand_callback().

◆ _toggle_expanded()

◆ _update_params()

static void * _update_params ( dt_lib_module_t *  module,
const void *const  old_params,
size_t  old_params_size,
int  old_version,
int  target_version,
size_t *  new_size 
)
static

Definition at line 596 of file lib.c.

References dt_free, IS_NULL_PTR, params, and size.

Referenced by dt_lib_init_presets().

◆ default_expandable()

static gboolean default_expandable ( dt_lib_module_t *  self)
static

Definition at line 503 of file lib.c.

References TRUE.

◆ default_lib_focus()

int default_lib_focus ( dt_gui_module_t *  m,
gboolean  toogle 
)

Definition at line 514 of file lib.c.

References dt_lib_gui_get_expanded(), and dt_lib_gui_set_expanded().

◆ default_preset_autoapply()

static gboolean default_preset_autoapply ( dt_lib_module_t *  self)
static

Definition at line 509 of file lib.c.

References FALSE.

◆ dt_action_button_new()

GtkWidget * dt_action_button_new ( dt_lib_module_t *  self,
const gchar *  label,
gpointer  callback,
gpointer  data,
const gchar *  tooltip,
guint  accel_key,
GdkModifierType  mods 
)
Todo:
: figure out where to handle that

Definition at line 1347 of file lib.c.

References dt_capitalize_label(), dt_free, FALSE, and tooltip.

Referenced by gui_init(), gui_init(), and gui_init().

◆ dt_handle_dialog_enter()

gboolean dt_handle_dialog_enter ( GtkWidget *  widget,
GdkEventKey *  event,
gpointer  data 
)

handle Enter key for dialog. Note it uses GTK_RESPONSE_ACCEPT code

Definition at line 1335 of file lib.c.

References dt_keys_mainpad_alternatives(), FALSE, key, and TRUE.

Referenced by _add_tag_button_clicked(), _ask_text(), _ioporder_add_preset(), _menuitem_preferences(), and dt_lib_export_metadata_configuration_dialog().

◆ dt_lib_cancel_postponed_update()

void dt_lib_cancel_postponed_update ( dt_lib_module_t *  mod)

cancel any previously-queued callback

Definition at line 1320 of file lib.c.

References dt_lib_module_t::_postponed_update, and dt_lib_module_t::timeout_handle.

Referenced by _update(), _update(), _update(), _update_atdetach_buttons(), and gui_cleanup().

◆ dt_lib_cleanup()

◆ dt_lib_colorpicker_set_box_area()

◆ dt_lib_colorpicker_set_point()

◆ dt_lib_get_localized_name()

gchar * dt_lib_get_localized_name ( const gchar *  plugin_name)

returns the localized plugin name for a given plugin_name. must not be freed.

Definition at line 1223 of file lib.c.

References dt_lib_get_global(), IS_NULL_PTR, and dt_lib_module_t::plugin_name.

◆ dt_lib_get_module()

dt_lib_module_t * dt_lib_get_module ( const char *  name)

return the plugin with the given name

Definition at line 1283 of file lib.c.

References dt_lib_get_global(), name, and dt_lib_module_t::plugin_name.

◆ dt_lib_gui_get_expanded()

◆ dt_lib_gui_get_expander()

◆ dt_lib_gui_reset_callback()

static void dt_lib_gui_reset_callback ( GtkButton *  button,
gpointer  user_data 
)
static

Definition at line 812 of file lib.c.

Referenced by dt_lib_gui_get_expander().

◆ dt_lib_gui_set_expanded()

◆ dt_lib_init()

◆ dt_lib_init_module()

◆ dt_lib_init_presets()

◆ dt_lib_is_visible()

gboolean dt_lib_is_visible ( dt_lib_module_t *  module)

get the visible state of a plugin

Definition at line 1189 of file lib.c.

References _get_lib_view_path(), dt_conf_get_bool(), dt_conf_key_exists(), dt_free, key, and TRUE.

Referenced by dt_view_manager_switch_by_view().

◆ dt_lib_is_visible_in_view()

gboolean dt_lib_is_visible_in_view ( dt_lib_module_t *  module,
const dt_view_t *  view 
)

◆ dt_lib_load_module()

static int dt_lib_load_module ( void *  m,
const char *  libname,
const char *  module_name 
)
static

Definition at line 530 of file lib.c.

References dt_view_t::data, dt_view_manager_get_global(), FALSE, TRUE, view, and dt_view_manager_t::views.

Referenced by dt_lib_init().

◆ dt_lib_presets_add()

void dt_lib_presets_add ( const char *  name,
const char *  plugin_name,
const int32_t  version,
const void *  params,
const int32_t  params_size,
gboolean  readonly 
)

preset stuff for lib add or replace a preset for this operation.

Definition at line 1163 of file lib.c.

References dt_lib_presets_remove(), dt_preset_repository_add_shipped_preset(), name, params, and params_size().

Referenced by _ioporder_add_preset(), add_rights_preset(), and init_presets().

◆ dt_lib_presets_apply()

gboolean dt_lib_presets_apply ( const gchar *  preset,
const gchar *  module_name,
int  module_version 
)

◆ dt_lib_presets_can_autoapply()

gboolean dt_lib_presets_can_autoapply ( dt_lib_module_t *  mod)

Definition at line 1330 of file lib.c.

Referenced by _presets_can_autoapply().

◆ dt_lib_presets_duplicate()

gchar * dt_lib_presets_duplicate ( const gchar *  preset,
const gchar *  module_name,
int  module_version 
)

◆ dt_lib_presets_popup_menu_show()

◆ dt_lib_presets_remove()

void dt_lib_presets_remove ( const gchar *  preset,
const gchar *  module_name,
int  module_version 
)

◆ dt_lib_presets_update()

void dt_lib_presets_update ( const gchar *  preset,
const gchar *  module_name,
int  module_version,
const gchar *  newname,
const gchar *  desc,
const void *  params,
const int32_t  params_size 
)

Definition at line 331 of file lib.c.

References dt_preset_repository_rename_module_preset(), params, params_size(), and preset.

◆ dt_lib_queue_postponed_update()

void dt_lib_queue_postponed_update ( dt_lib_module_t *  mod,
void(*)(dt_lib_module_t *self)  update_fn 
)

queue a delayed call of update function after user interaction

Definition at line 1308 of file lib.c.

References _postponed_update(), dt_lib_module_t::_postponed_update, dt_conf_get_int(), and dt_lib_module_t::timeout_handle.

Referenced by _lib_tagging_redraw_callback(), and _mouse_over_image_callback().

◆ dt_lib_set_visible()

void dt_lib_set_visible ( dt_lib_module_t *  module,
gboolean  visible 
)

set the visible state of a plugin

Definition at line 1199 of file lib.c.

References _get_lib_view_path(), dt_conf_set_bool(), dt_free, dt_lib_module_t::expander, key, and dt_lib_module_t::widget.

Referenced by dt_view_manager_switch_by_view().

◆ dt_lib_sort_plugins()

gint dt_lib_sort_plugins ( gconstpointer  a,
gconstpointer  b 
)

sorter callback to add a lib in the list of libs after init

Definition at line 493 of file lib.c.

Referenced by dt_lib_init().

◆ dt_lib_unload_module()

void dt_lib_unload_module ( dt_lib_module_t *  module)
static

◆ edit_preset()

◆ expand_callback()

static void expand_callback ( GtkButton *  button,
dt_lib_module_t *  module 
)
static

Definition at line 992 of file lib.c.

References _scroll_to_module(), _toggle_expanded(), and FALSE.

Referenced by dt_lib_gui_get_expander().

◆ free_module_info()

static void free_module_info ( GtkWidget *  widget,
gpointer  user_data 
)
static

◆ get_active_preset_name()

◆ menuitem_delete_preset()

◆ menuitem_edit_preset()

static void menuitem_edit_preset ( GtkMenuItem *  menuitem,
dt_lib_module_info_t *  minfo 
)
static

Definition at line 225 of file lib.c.

References edit_preset().

Referenced by dt_lib_presets_popup_menu_show().

◆ menuitem_manage_presets()

static void menuitem_manage_presets ( GtkMenuItem *  menuitem,
dt_lib_module_info_t *  minfo 
)
static

Definition at line 230 of file lib.c.

Referenced by dt_lib_presets_popup_menu_show().

◆ menuitem_new_preset()

◆ menuitem_update_preset()

◆ pick_callback()

◆ presets_popup_callback()