![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "common/darktable.h"
#include "develop/blend.h"
#include "develop/imageop.h"
#include <glib.h>
#include <inttypes.h>
#include <sqlite3.h>
Go to the source code of this file.
Data Structures | |
struct | dt_style_t |
struct | dt_style_item_t |
Typedefs | |
typedef struct dt_style_t | dt_style_t |
typedef enum dt_style_applymode_t | dt_style_applymode_t |
typedef struct dt_style_item_t | dt_style_item_t |
Enumerations | |
enum | dt_style_applymode_t { DT_STYLE_HISTORY_APPEND = 0 , DT_STYLE_HISTORY_OVERWRITE = 1 } |
Functions | |
void | dt_style_free (gpointer data) |
void | dt_style_item_free (gpointer data) |
gboolean | dt_styles_create_from_image (const char *name, const char *description, const int32_t imgid, GList *items, gboolean copy_iop_order) |
void | dt_styles_create_from_list (const GList *list) |
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) |
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) |
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_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) |
dt_style_t * | dt_styles_get_by_name (const char *name) |
gboolean | dt_styles_exists (const char *name) |
gboolean | dt_styles_has_module_order (const char *name) |
GList * | dt_styles_get_list (const char *filter) |
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) |
gchar * | dt_styles_get_description (const char *name) |
void | dt_styles_save_to_file (const char *style_name, const char *filedir, gboolean overwrite) |
void | dt_styles_import_from_file (const char *style_path) |
typedef enum dt_style_applymode_t dt_style_applymode_t |
typedef struct dt_style_item_t dt_style_item_t |
typedef struct dt_style_t dt_style_t |
The definition of styles are copied historystack to reproduce an development style such as sepia, cross process etc.
enum dt_style_applymode_t |
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().
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().
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().
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().
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().
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().
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().
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().