![]() |
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/tags.h"
#include "control/control.h"
#include "develop/develop.h"
#include "gui/styles.h"
#include <libxml/encoding.h>
#include <libxml/xmlwriter.h>
#include <glib.h>
#include <stdio.h>
#include <string.h>
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) |
static 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_styles_apply_to_list (const char *name, const GList *list, gboolean duplicate) |
void | dt_multiple_styles_apply_to_list (GList *styles, const GList *list, gboolean duplicate) |
void | dt_styles_create_from_list (const GList *list) |
void | dt_styles_apply_style_item (dt_develop_t *dev, dt_style_item_t *style_item, GList **modules_used) |
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) |
Variables | |
static GMarkupParser | dt_style_parser |
#define DT_IOP_ORDER_INFO (darktable.unmuted & DT_DEBUG_IOPORDER) |
|
static |
References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_INT, and DT_DEBUG_SQLITE3_PREPARE_V2.
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_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().
void dt_multiple_styles_apply_to_list | ( | GList * | styles, |
const GList * | list, | ||
gboolean | duplicate | ||
) |
applies list of styles to selection of images
References darktable, darktable_t::develop, dt_control_log(), DT_DEBUG_CONTROL_SIGNAL_RAISE, dt_dev_write_history(), DT_SIGNAL_TAG_CHANGED, dt_styles_apply_to_image(), dt_undo_end_group(), DT_UNDO_LT_HISTORY, dt_undo_start_group(), DT_VIEW_DARKROOM, dt_view_manager_get_current_view(), darktable_t::signals, darktable_t::undo, and darktable_t::view_manager.
Referenced by apply_clicked().
|
static |
References dt_exif_xmp_encode().
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, and dt_style_t::name.
Referenced by _darkroom_ui_apply_style_popupmenu(), _gui_styles_update_view(), _lib_export_styles_changed_callback(), 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_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(), dt_styles_apply_to_image(), 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(), 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, | ||
GList ** | modules_used | ||
) |
applies the item style to dev->history
References dt_style_item_t::blendop_params, dt_style_item_t::blendop_params_size, dt_style_item_t::blendop_version, dt_control_log(), dt_develop_blend_legacy_params(), dt_develop_blend_version(), dt_history_merge_module_into_history(), dt_iop_cleanup_module(), dt_iop_get_module_by_op_priority(), dt_iop_load_module(), dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), FALSE, dt_develop_t::history_mutex, dt_develop_t::iop, dt_style_item_t::module_version, dt_style_item_t::multi_name, dt_style_item_t::operation, dt_style_item_t::params, dt_style_item_t::params_size, dt_iop_module_t::so, and TRUE.
Referenced by _apply_style_before_export(), and dt_styles_apply_to_image().
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 dt_undo_lt_history_t::after, dt_undo_lt_history_t::after_history_end, dt_undo_lt_history_t::before, dt_undo_lt_history_t::before_history_end, dt_style_item_t::blendop_params, dt_style_item_t::blendop_params_size, dt_style_item_t::blendop_version, darktable, darktable_t::db, darktable_t::develop, dt_control_save_xmp(), dt_database_get(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_PREPARE_V2, dt_dev_append_changed_tag(), dt_dev_cleanup(), dt_dev_get_history_end(), dt_dev_init(), dt_dev_is_current_image(), dt_dev_pop_history_items_ext(), dt_dev_read_history_ext(), dt_dev_reload_history_items(), dt_dev_write_history_ext(), dt_history_copy_and_paste_on_image(), dt_history_snapshot_item_init(), dt_history_snapshot_undo_create(), dt_history_snapshot_undo_lt_history_data_free(), dt_history_snapshot_undo_pop(), dt_image_duplicate(), dt_iop_load_modules_ext(), DT_IOP_ORDER_INFO, dt_ioppr_check_iop_order(), dt_ioppr_extract_multi_instances_list(), dt_ioppr_get_iop_order_list(), dt_ioppr_merge_multi_instance_iop_order_list(), dt_ioppr_update_for_style_items(), dt_ioppr_write_iop_order_list(), dt_mipmap_cache_remove(), dt_style_item_free(), dt_styles_apply_style_item(), dt_styles_get_id_by_name(), dt_styles_module_order_list(), dt_thumbtable_refresh_thumbnail, dt_undo_end_group(), DT_UNDO_LT_HISTORY, dt_undo_record(), dt_undo_start_group(), dt_style_item_t::enabled, FALSE, darktable_t::gui, dt_image_t::id, dt_develop_t::image_storage, dt_undo_lt_history_t::imgid, dt_develop_t::iop, dt_style_item_t::iop_order, darktable_t::mipmap_cache, 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, dt_ui_t::thumbtable_lighttable, TRUE, dt_gui_gtk_t::ui, darktable_t::undo, and UNKNOWN_IMAGE.
Referenced by _darkroom_ui_apply_style_activate_callback(), dt_lua_style_apply(), dt_multiple_styles_apply_to_list(), and dt_styles_apply_to_list().
void dt_styles_apply_to_list | ( | const char * | name, |
const GList * | list, | ||
gboolean | duplicate | ||
) |
applies the style to selection of images
References darktable, darktable_t::develop, dt_control_log(), DT_DEBUG_CONTROL_SIGNAL_RAISE, dt_dev_write_history(), DT_SIGNAL_TAG_CHANGED, dt_styles_apply_to_image(), dt_undo_end_group(), DT_UNDO_LT_HISTORY, dt_undo_start_group(), DT_VIEW_DARKROOM, dt_view_manager_get_current_view(), FALSE, name, darktable_t::signals, TRUE, darktable_t::undo, and darktable_t::view_manager.
Referenced by _styles_row_activated_callback(), and entry_activated().
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_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_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().
|
static |
References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, and name.
Referenced by dt_style_save(), dt_styles_apply_to_image(), 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_style_item_free(), dt_styles_get_item_list(), dt_util_glist_to_str(), FALSE, items, name, and dt_style_item_t::name.
Referenced by _darkroom_ui_apply_style_popupmenu(), and _gui_styles_update_view().
GList * dt_styles_get_list | ( | const char * | filter | ) |
get a list of styles based on filter string
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 _darkroom_ui_apply_style_popupmenu(), _gui_styles_update_view(), _lib_export_styles_changed_callback(), 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_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, 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_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_import_from_file().