![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "common/styles.h"#include "common/collection.h"#include "common/darktable.h"#include "common/debug.h"#include "common/exif.h"#include "common/file_location.h"#include "common/history.h"#include "common/history_snapshot.h"#include "common/image_cache.h"#include "common/imageio.h"#include "common/iop_order.h"#include "common/tags.h"#include "control/control.h"#include "develop/develop.h"#include "develop/dev_history.h"#include "gui/styles.h"#include <libxml/encoding.h>#include <libxml/xmlwriter.h>#include <glib.h>#include <stdio.h>#include <string.h>
Include dependency graph for common/styles.c:Data Structures | |
| struct | StyleInfoData |
| struct | StylePluginData |
| struct | StyleData |
Macros | |
| #define | DT_IOP_ORDER_INFO (darktable.unmuted & DT_DEBUG_IOPORDER) |
Functions | |
| void | dt_style_free (gpointer data) |
| void | dt_style_item_free (gpointer data) |
| int32_t | dt_styles_get_id_by_name (const char *name) |
| gboolean | dt_styles_exists (const char *name) |
| static void | _dt_style_cleanup_multi_instance (int id) |
| gboolean | dt_styles_has_module_order (const char *name) |
| GList * | dt_styles_module_order_list (const char *name) |
| static gboolean | dt_styles_create_style_header (const char *name, const char *description, GList *iop_list) |
| static void | _dt_style_update_from_image (int id, int32_t imgid, GList *filter, GList *update) |
| static void | _dt_style_update_iop_order (const gchar *name, const int id, const int32_t imgid, const gboolean copy_iop_order, const gboolean update_iop_order) |
| void | dt_styles_update (const char *name, const char *newname, const char *newdescription, GList *filter, const int32_t imgid, GList *update, const gboolean copy_iop_order, const gboolean update_iop_order) |
| void | dt_styles_create_from_style (const char *name, const char *newname, const char *description, GList *filter, const int32_t imgid, GList *update, const gboolean copy_iop_order, const gboolean update_iop_order) |
| gboolean | dt_styles_create_from_image (const char *name, const char *description, const int32_t imgid, GList *filter, gboolean copy_iop_order) |
| void | dt_multiple_styles_apply_to_list (GList *styles, const GList *list, gboolean duplicate) |
| void | dt_styles_create_from_list (const GList *list) |
| static const char * | _dt_styles_normalize_multi_name (const char *multi_name) |
| static gboolean | _dt_styles_apply_item_to_module (dt_iop_module_t *module, const dt_style_item_t *style_item) |
| static dt_iop_module_t * | _dt_styles_get_or_create_module_instance (dt_develop_t *dev, const dt_style_item_t *style_item) |
| static dt_iop_module_t * | _dt_styles_tmp_module_from_style_item (dt_develop_t *dev, const dt_style_item_t *style_item) |
| static GList * | _dt_styles_get_apply_items (const int style_id) |
| static GList * | _dt_styles_build_mod_list_from_history (dt_develop_t *dev, GHashTable *style_ids) |
| static void | _dt_styles_tmp_module_free (dt_iop_module_t *module) |
| static int | _styles_init_source_dev (dt_develop_t *dev_src, const char *name, const int32_t imgid) |
| static GList * | _styles_collect_applied_items (dt_develop_t *dev_src, GList *si_list, GHashTable *style_ids) |
| static void | _styles_sync_pipeline_from_items (dt_develop_t *dev_src, GList *applied_items) |
| static int | _styles_rebuild_history_from_items (dt_develop_t *dev_src, GList *applied_items) |
| static int | _styles_prepare_source_dev (dt_develop_t *dev_src, const char *name, const int style_id, const int32_t imgid, GList **out_si_list, GHashTable **out_style_ids, GList **out_mod_list) |
| int | dt_styles_apply_to_image_merge (const char *name, const int style_id, const int32_t newimgid, const dt_history_merge_strategy_t mode) |
| void | dt_styles_apply_style_item (dt_develop_t *dev, dt_style_item_t *style_item) |
| void | dt_styles_apply_to_image (const char *name, const gboolean duplicate, const int32_t imgid) |
| void | dt_styles_delete_by_name_adv (const char *name, const gboolean raise) |
| void | dt_styles_delete_by_name (const char *name) |
| GList * | dt_styles_get_item_list (const char *name, gboolean params, int32_t imgid) |
| char * | dt_styles_get_item_list_as_string (const char *name) |
| GList * | dt_styles_get_list (const char *filter) |
| static char * | dt_style_encode (sqlite3_stmt *stmt, int row) |
| void | dt_styles_save_to_file (const char *style_name, const char *filedir, gboolean overwrite) |
| static StyleData * | dt_styles_style_data_new () |
| static StylePluginData * | dt_styles_style_plugin_new () |
| static void | dt_styles_style_data_free (StyleData *style, gboolean free_segments) |
| static void | dt_styles_start_tag_handler (GMarkupParseContext *context, const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values, gpointer user_data, GError **error) |
| static void | dt_styles_end_tag_handler (GMarkupParseContext *context, const gchar *element_name, gpointer user_data, GError **error) |
| static void | dt_styles_style_text_handler (GMarkupParseContext *context, const gchar *text, gsize text_len, gpointer user_data, GError **error) |
| static void | dt_style_plugin_save (StylePluginData *plugin, gpointer styleId) |
| static void | dt_style_save (StyleData *style) |
| void | dt_styles_import_from_file (const char *style_path) |
| gchar * | dt_styles_get_description (const char *name) |
| dt_style_t * | dt_styles_get_by_name (const char *name) |
| void | dt_styles_cleanup (void) |
Variables | |
| static sqlite3_stmt * | _styles_get_list_stmt = NULL |
| static sqlite3_stmt * | _styles_apply_items_stmt = NULL |
| static GMarkupParser | dt_style_parser |
| #define DT_IOP_ORDER_INFO (darktable.unmuted & DT_DEBUG_IOPORDER) |
|
static |
References d, darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_PREPARE_V2, and dt_free_gpointer().
Referenced by dt_styles_create_from_image(), dt_styles_create_from_style(), and dt_styles_update().
|
static |
References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_EXEC, UNKNOWN_IMAGE, and update().
Referenced by dt_styles_create_from_style(), and dt_styles_update().
|
static |
References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, dt_free, dt_free_gpointer(), dt_ioppr_get_iop_order_list(), dt_ioppr_serialize_text_iop_order_list(), dt_styles_module_order_list(), FALSE, and name.
Referenced by dt_styles_create_from_style(), and dt_styles_update().
|
static |
References _dt_styles_normalize_multi_name(), dt_iop_module_t::blend_params, dt_style_item_t::blendop_params, dt_style_item_t::blendop_params_size, dt_style_item_t::blendop_version, dt_iop_module_t::default_blendop_params, dt_iop_module_t::default_params, dt_control_log(), dt_develop_blend_legacy_params(), dt_develop_blend_version(), dt_iop_module_t::enabled, FALSE, dt_style_item_t::module_version, dt_style_item_t::multi_name, dt_iop_module_t::multi_name, dt_iop_module_t::op, dt_style_item_t::operation, dt_style_item_t::params, dt_iop_module_t::params, dt_style_item_t::params_size, dt_iop_module_t::params_size, and TRUE.
Referenced by _dt_styles_tmp_module_from_style_item(), and _styles_collect_applied_items().
|
static |
References dt_free, h, dt_develop_t::history, dt_dev_history_item_t::multi_name, and dt_dev_history_item_t::op_name.
Referenced by _styles_prepare_source_dev().
|
static |
References _styles_apply_items_stmt, dt_style_item_t::blendop_params, dt_style_item_t::blendop_params_size, dt_style_item_t::blendop_version, darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_PREPARE_V2, dt_style_item_t::enabled, dt_style_item_t::iop_order, dt_style_item_t::module_version, dt_style_item_t::multi_name, dt_style_item_t::multi_priority, dt_style_item_t::name, dt_style_item_t::num, dt_style_item_t::operation, dt_style_item_t::params, dt_style_item_t::params_size, and dt_style_item_t::selimg_num.
Referenced by _styles_prepare_source_dev().
|
static |
References _dt_styles_normalize_multi_name(), and dt_style_item_t::multi_name.
|
static |
|
static |
References dt_free, and dt_iop_cleanup_module().
Referenced by dt_styles_apply_style_item().
|
static |
|
static |
References _dt_styles_apply_item_to_module(), _dt_styles_normalize_multi_name(), dt_style_item_t::multi_name, and dt_style_item_t::operation.
Referenced by _styles_prepare_source_dev().
|
static |
|
static |
References _dt_styles_build_mod_list_from_history(), _dt_styles_get_apply_items(), _styles_collect_applied_items(), _styles_init_source_dev(), _styles_rebuild_history_from_items(), _styles_sync_pipeline_from_items(), dt_free_gpointer(), dt_style_item_free(), and name.
Referenced by dt_styles_apply_to_image_merge().
|
static |
References _dt_styles_normalize_multi_name(), dt_dev_history_compress_ext(), dt_dev_history_free_history(), dt_dev_history_item_update_from_params(), dt_dev_pop_history_items_ext(), dt_dev_set_history_end_ext(), dt_dev_history_item_t::enabled, FALSE, dt_develop_t::history, and dt_style_item_t::multi_name.
Referenced by _styles_prepare_source_dev().
|
static |
References _dt_styles_normalize_multi_name(), dt_ioppr_resync_pipeline(), dt_ioppr_update_for_style_items(), FALSE, and dt_style_item_t::multi_name.
Referenced by _styles_prepare_source_dev().
| void dt_multiple_styles_apply_to_list | ( | GList * | styles, |
| const GList * | list, | ||
| gboolean | duplicate | ||
| ) |
applies the style to selection of images applies list of styles to selection of images
References darktable, dt_control_log(), dt_history_style_on_image(), dt_undo_end_group(), DT_UNDO_LT_HISTORY, dt_undo_start_group(), and darktable_t::undo.
Referenced by apply_clicked().
|
static |
References dt_exif_xmp_encode(), and row.
Referenced by dt_styles_save_to_file().
| void dt_style_free | ( | gpointer | data | ) |
helpers that free a style or style_item. can be used in g_list_free_full()
References dt_style_t::description, dt_free, and dt_style_t::name.
Referenced by _gui_styles_update_view(), _lib_export_styles_changed_callback(), append_styles(), dt_lua_style_create_from_image(), gui_init(), and gui_reset().
| void dt_style_item_free | ( | gpointer | data | ) |
References dt_style_item_t::blendop_params, dt_free, dt_style_item_t::multi_name, dt_style_item_t::name, dt_style_item_t::operation, and dt_style_item_t::params.
Referenced by _apply_style_before_export(), _gui_styles_dialog_run(), _styles_prepare_source_dev(), dt_styles_apply_to_image_merge(), dt_styles_get_item_list_as_string(), style_getnumber(), and style_length().
|
static |
References StylePluginData::blendop_params, StylePluginData::blendop_version, darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_BLOB, DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, dt_exif_xmp_decode(), dt_free, StylePluginData::enabled, StylePluginData::multi_name, StylePluginData::multi_priority, StylePluginData::num, StylePluginData::op_params, and StylePluginData::operation.
Referenced by dt_style_save().
| void dt_styles_apply_style_item | ( | dt_develop_t * | dev, |
| dt_style_item_t * | style_item | ||
| ) |
applies the item style to dev->history
References _dt_styles_tmp_module_free(), dt_dev_pop_history_items_ext(), dt_history_merge_module_into_history(), dt_ioppr_resync_pipeline(), dt_pthread_rwlock_unlock, dt_pthread_rwlock_wrlock, FALSE, and dt_develop_t::history_mutex.
Referenced by _apply_style_before_export().
| void dt_styles_apply_to_image | ( | const char * | name, |
| const gboolean | duplicate, | ||
| const int32_t | imgid | ||
| ) |
applies the style to image by imgid, takes care of overwrite and duplicate modes
References darktable, dt_history_style_on_image(), dt_undo_end_group(), DT_UNDO_LT_HISTORY, dt_undo_start_group(), name, and darktable_t::undo.
Referenced by dt_lua_style_apply().
| int dt_styles_apply_to_image_merge | ( | const char * | name, |
| const int | style_id, | ||
| const int32_t | newimgid, | ||
| const dt_history_merge_strategy_t | mode | ||
| ) |
internal helper used by history actions
References _styles_prepare_source_dev(), dt_conf_get_bool(), dt_dev_cleanup(), dt_dev_get_history_end_ext(), dt_dev_merge_history_into_image(), dt_dev_replace_history_on_image(), DT_HISTORY_MERGE_REPLACE, DT_IOP_ORDER_INFO, dt_style_item_free(), name, and TRUE.
Referenced by _history_style_apply().
cleanup cached statements
References _styles_apply_items_stmt, and _styles_get_list_stmt.
Referenced by dt_cleanup().
| gboolean dt_styles_create_from_image | ( | const char * | name, |
| const char * | description, | ||
| const int32_t | imgid, | ||
| GList * | items, | ||
| gboolean | copy_iop_order | ||
| ) |
creates a new style from specified image, items are the history stack number of items to include in style
References _dt_style_cleanup_multi_instance(), darktable, darktable_t::db, description(), dt_database_get(), DT_DEBUG_CONTROL_SIGNAL_RAISE, DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_PREPARE_V2, dt_free_gpointer(), dt_ioppr_get_iop_order_list(), DT_SIGNAL_STYLE_CHANGED, dt_styles_create_style_header(), dt_styles_get_id_by_name(), dt_styles_save_to_file(), FALSE, name, darktable_t::signals, and TRUE.
Referenced by _gui_styles_new_style_response(), and dt_lua_style_create_from_image().
| void dt_styles_create_from_list | ( | const GList * | list | ) |
creates styles from selection
References dt_control_log(), dt_gui_styles_dialog_new(), FALSE, and TRUE.
Referenced by create_clicked().
| void dt_styles_create_from_style | ( | const char * | name, |
| const char * | newname, | ||
| const char * | description, | ||
| GList * | filter, | ||
| const int32_t | imgid, | ||
| GList * | update, | ||
| gboolean | copy_iop_order, | ||
| const gboolean | update_iop_order | ||
| ) |
creates a new style from specified style, items are the style number of items to include in style
References _dt_style_cleanup_multi_instance(), _dt_style_update_from_image(), _dt_style_update_iop_order(), darktable, darktable_t::db, description(), dt_control_log(), dt_database_get(), DT_DEBUG_CONTROL_SIGNAL_RAISE, DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_PREPARE_V2, DT_SIGNAL_STYLE_CHANGED, dt_styles_create_style_header(), dt_styles_get_id_by_name(), dt_styles_save_to_file(), FALSE, name, darktable_t::signals, and update().
Referenced by _gui_styles_edit_style_response(), and style_duplicate().
|
static |
References darktable, darktable_t::db, description(), dt_control_log(), dt_database_get(), DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, dt_free, dt_ioppr_serialize_text_iop_order_list(), dt_styles_get_id_by_name(), FALSE, name, and TRUE.
Referenced by dt_style_save(), dt_styles_create_from_image(), and dt_styles_create_from_style().
| void dt_styles_delete_by_name | ( | const char * | name | ) |
delete a style by name, raise signal
References dt_styles_delete_by_name_adv(), name, and TRUE.
Referenced by _gui_styles_new_style_response(), import_clicked(), and style_delete().
| void dt_styles_delete_by_name_adv | ( | const char * | name, |
| const gboolean | raise | ||
| ) |
delete a style by name
References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_CONTROL_SIGNAL_RAISE, DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_PREPARE_V2, DT_SIGNAL_STYLE_CHANGED, dt_styles_get_id_by_name(), name, and darktable_t::signals.
Referenced by delete_clicked(), dt_styles_delete_by_name(), and gui_reset().
|
static |
References FALSE, and StyleData::in_plugin.
| gboolean dt_styles_exists | ( | const char * | name | ) |
check if style exists by name
References dt_styles_get_id_by_name(), FALSE, name, and TRUE.
Referenced by _gui_styles_dialog_run(), _gui_styles_new_style_response(), dt_styles_save_to_file(), and import_clicked().
| dt_style_t * dt_styles_get_by_name | ( | const char * | name | ) |
get a style object by name, the object needs to be freed by the caller
References darktable, darktable_t::db, dt_style_t::description, description(), dt_database_get(), DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, name, and dt_style_t::name.
Referenced by style_table_index().
| gchar * dt_styles_get_description | ( | const char * | name | ) |
get a description of a named style
References darktable, darktable_t::db, description(), dt_database_get(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_PREPARE_V2, dt_styles_get_id_by_name(), and name.
Referenced by _gui_styles_dialog_run(), dt_styles_save_to_file(), and dt_styles_update().
| int32_t dt_styles_get_id_by_name | ( | const char * | name | ) |
get a style id by name
References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, and name.
Referenced by dt_history_style_on_image(), dt_history_style_on_list(), dt_style_save(), dt_styles_create_from_image(), dt_styles_create_from_style(), dt_styles_create_style_header(), dt_styles_delete_by_name_adv(), dt_styles_exists(), dt_styles_get_description(), dt_styles_get_item_list(), dt_styles_save_to_file(), and dt_styles_update().
| GList * dt_styles_get_item_list | ( | const char * | name, |
| gboolean | params, | ||
| int32_t | imgid | ||
| ) |
get a list of items for a named style if imgid != UNKNOWN_IMAGE, then styles from the corresponding image are also reported if they are not already part of the style
References dt_style_item_t::blendop_params, dt_style_item_t::blendop_params_size, dt_style_item_t::blendop_version, darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_PREPARE_V2, dt_iop_get_localized_name(), dt_styles_get_id_by_name(), dt_style_item_t::enabled, dt_style_item_t::iop_order, dt_style_item_t::module_version, dt_style_item_t::multi_name, dt_style_item_t::multi_priority, name, dt_style_item_t::name, dt_style_item_t::num, dt_style_item_t::operation, dt_style_item_t::params, dt_style_item_t::params_size, dt_style_item_t::selimg_num, and UNKNOWN_IMAGE.
Referenced by _apply_style_before_export(), _gui_styles_dialog_run(), dt_styles_get_item_list_as_string(), style_getnumber(), and style_length().
| char * dt_styles_get_item_list_as_string | ( | const char * | name | ) |
get list of items for a named style as a nice string
References dt_free_gpointer(), dt_style_item_free(), dt_styles_get_item_list(), dt_util_glist_to_str(), FALSE, items, name, and dt_style_item_t::name.
Referenced by _gui_styles_update_view(), and _styles_build_tooltip().
| GList * dt_styles_get_list | ( | const char * | filter | ) |
get a list of styles based on filter string
References _styles_get_list_stmt, darktable, darktable_t::db, dt_style_t::description, description(), dt_database_get(), DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, name, and dt_style_t::name.
Referenced by _gui_styles_update_view(), _lib_export_styles_changed_callback(), append_styles(), dt_lua_style_create_from_image(), gui_init(), and gui_reset().
| gboolean dt_styles_has_module_order | ( | const char * | name | ) |
returns TRUE if the style has a module order defined
References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, and name.
Referenced by _gui_styles_dialog_run().
| void dt_styles_import_from_file | ( | const char * | style_path | ) |
load style from file
References darktable, dt_control_log(), DT_DEBUG_CONTROL_SIGNAL_RAISE, DT_SIGNAL_STYLE_CHANGED, dt_style_parser, dt_style_save(), dt_styles_style_data_free(), dt_styles_style_data_new(), darktable_t::signals, and TRUE.
Referenced by dt_lua_style_import(), and import_clicked().
| GList * dt_styles_module_order_list | ( | const char * | name | ) |
| void dt_styles_save_to_file | ( | const char * | style_name, |
| const char * | filedir, | ||
| gboolean | overwrite | ||
| ) |
save style to file
References darktable, darktable_t::db, dt_control_log(), dt_database_get(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_PREPARE_V2, dt_free, dt_free_gpointer(), dt_ioppr_serialize_text_iop_order_list(), dt_loc_get_user_config_dir(), dt_style_encode(), dt_styles_exists(), dt_styles_get_description(), dt_styles_get_id_by_name(), dt_styles_module_order_list(), PATH_MAX, and TRUE.
Referenced by dt_lua_style_export(), dt_styles_create_from_image(), dt_styles_create_from_style(), dt_styles_update(), and export_clicked().
|
static |
References dt_styles_style_plugin_new(), StyleData::in_plugin, StyleData::plugins, and TRUE.
References StyleInfoData::description, dt_free, dt_free_gpointer(), StyleData::info, StyleInfoData::iop_list, StyleInfoData::name, and StyleData::plugins.
Referenced by dt_styles_import_from_file().
|
static |
References StyleInfoData::description, FALSE, StyleData::in_plugin, StyleData::info, StyleInfoData::name, and StyleData::plugins.
Referenced by dt_styles_import_from_file().
|
static |
|
static |
References StylePluginData::blendop_params, StylePluginData::blendop_version, StyleInfoData::description, dt_ioppr_deserialize_text_iop_order_list(), StylePluginData::enabled, StyleData::in_plugin, StyleData::info, StyleInfoData::iop_list, StylePluginData::iop_order, StylePluginData::multi_name, StylePluginData::multi_priority, StyleInfoData::name, StylePluginData::num, StylePluginData::op_params, StylePluginData::operation, and StyleData::plugins.
| void dt_styles_update | ( | const char * | name, |
| const char * | newname, | ||
| const char * | description, | ||
| GList * | filter, | ||
| const int32_t | imgid, | ||
| GList * | update, | ||
| const gboolean | copy_iop_order, | ||
| const gboolean | update_iop_order | ||
| ) |
update a style
References _dt_style_cleanup_multi_instance(), _dt_style_update_from_image(), _dt_style_update_iop_order(), darktable, darktable_t::db, dt_database_get(), DT_DEBUG_CONTROL_SIGNAL_RAISE, DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, dt_free, DT_SIGNAL_STYLE_CHANGED, dt_styles_get_description(), dt_styles_get_id_by_name(), dt_styles_save_to_file(), name, darktable_t::signals, TRUE, and update().
Referenced by _gui_styles_edit_style_response(), description_member(), and name_member().
|
static |
Referenced by _dt_styles_get_apply_items(), and dt_styles_cleanup().
|
static |
Referenced by dt_styles_cleanup(), and dt_styles_get_list().
|
static |
Referenced by dt_styles_import_from_file().