91 const int modversion,
const char *operation,
const void *
module_params,
94 const char *multi_name,
const char *preset_name,
int *
legacy_params,
95 const gboolean presets);
130 const int blendop_version,
const int multi_priority,
const char *multi_name,
131 const char *preset_name)
135 blendop_params,
bl_length, blendop_version, multi_priority, multi_name, preset_name,
136 ctx->legacy_params,
ctx->presets);
147 if(hist->module ==
module)
163 if(hist->module ==
module)
197 module->enabled = enabled;
199 hist->module =
module;
228 hist->
hash =
module->hash;
239 if(
strcmp(
m->op, op))
continue;
246 const int multi_priority)
248 const char *
name = (multi_name && *multi_name) ? multi_name :
NULL;
249 dt_iop_module_t *
module = dt_iop_get_module_by_instance_name(dev->iop, op, name);
251 module = dt_iop_get_module_by_op_priority(dev->iop, op, multi_priority);
253 module = dt_iop_get_module_by_op_priority(dev->iop, op, 0);
267 dt_iop_module_t *
module = (dt_iop_module_t *)calloc(1, sizeof(dt_iop_module_t));
272 fprintf(
stderr,
"[dt_dev_create_module_instance] can't load module %s\n", op);
277 module->instance = base->instance;
278 module->enabled = FALSE;
279 module->multi_priority = use_next_priority ? dt_dev_next_multi_priority_for_op(dev, op) : multi_priority;
280 g_strlcpy(
module->multi_name, multi_name ? multi_name :
"",
sizeof(
module->multi_name));
314 "[dt_dev_history_item_from_source_history_item] invalid input: hist=%s hist_module=%s dest=%s out=%s\n",
324 "[dt_dev_history_item_from_source_history_item] allocation failed: src=%s multi='%s'\n",
332 "[dt_dev_history_item_from_source_history_item] Forms copy failed: src=%s multi='%s'\n",
350 "[dt_dev_history_item_from_source_history_item] %s '%s' uses drawn mask but there is no destination mask forms to snapshot\n",
363 "[dt_dev_history_item_from_source_history_item] params update failed: src=%s multi='%s' "
364 "dest=%s multi='%s' src_params=%d dest_params=%d\n",
432 if(!hist || !hist->module)
continue;
466 = dt_dev_get_module_instance(dev_dest, mod_src->op, mod_src->multi_name, mod_src->multi_priority);
471 module = dt_iop_get_module_by_op_priority(dev_dest->iop, mod_src->op, -1);
479 module = dt_dev_create_module_instance(dev_dest, mod_src->op, mod_src->multi_name, mod_src->multi_priority, FALSE);
491 dt_iop_module_t *
module = _history_merge_resolve_dest_instance(dev_dest, mod_src, &created, &reused_base);
496 dt_print(
DT_DEBUG_HISTORY,
"[dt_history_merge_module_into_history] %s (%s) will be overriden in target history by parameters from source history\n",
501 dt_print(
DT_DEBUG_HISTORY,
"[dt_history_merge_module_into_history] %s (%s) will be inserted as a new instance in target history\n",
506 dt_print(
DT_DEBUG_HISTORY,
"[dt_history_merge_module_into_history] %s (%s) will be enabled in target history with parameters from source history\n",
537 dt_iop_module_t *
module = (old->module) ? old->module : dt_iop_get_module(old->op_name);
539 if(
old->params &&
old->params_size > 0)
546 fprintf(
stderr,
"[_duplicate_history] can't find base module for %s\n",
old->op_name);
548 if(
old->blend_params &&
old->blendop_params_size > 0)
550 new->blend_params =
malloc(
old->blendop_params_size);
551 memcpy(
new->blend_params,
old->blend_params,
old->blendop_params_size);
665 GList *iop_order_list
730 if(dev->undo_history_depth == 0)
733 dev->undo_history_before_snapshot =
NULL;
735 dev->undo_history_before_iop_order_list =
NULL;
736 dev->undo_history_before_end = 0;
743 dev->undo_history_depth++;
756 if(
IS_NULL_PTR(dev) || dev->undo_history_depth <= 0)
return;
758 dev->undo_history_depth--;
759 if(dev->undo_history_depth != 0)
return;
761 if(
IS_NULL_PTR(dev->undo_history_before_snapshot))
return;
765 hist->
before_end = dev->undo_history_before_end;
767 dev->undo_history_before_snapshot =
NULL;
768 dev->undo_history_before_end = 0;
769 dev->undo_history_before_iop_order_list =
NULL;
808 "[dt_dev_add_history_item_ext] archival history item %s at %i is past history limit (%i) and will be kept\n",
822 if((hist->module->hide_enable_button || hist->module->default_enabled))
829 if(
prior_hist->module->so == hist->module->so)
839 GList *link = history;
843 if((!hist->module->hide_enable_button && !hist->module->default_enabled)
874 module = dt_masks_get_mask_manager(dev);
891 if(
enable)
module->enabled = TRUE;
981 module->multi_name,
module->iop_order, hist->
num, dev->image_storage.id,
989 module->multi_name,
module->iop_order, hist->
num, dev->image_storage.id,
994 module->multi_name,
module->iop_order, hist->
num, dev->image_storage.id,
1036 "[dt_dev_add_history_item_real] tid %lu (GUI thread) blocked %.2f ms acquiring history_mutex\n",
1082 const gboolean
has_raster =
module && dt_iop_module_has_raster_mask(module);
1170 if(
old->params &&
old->params_size > 0)
1177 if(
old->blend_params &&
old->blendop_params_size > 0)
1249 snapshot->items =
NULL;
1250 snapshot->history_end = 0;
1269 snapshot->items =
NULL;
1270 snapshot->history_end = 0;
1289 dev->history =
NULL;
1334 module->enabled = module->default_enabled;
1336 if(
module->multi_priority == 0)
1337 module->iop_order = dt_ioppr_get_iop_order(dev->iop_order_list, module->op, module->multi_priority);
1339 module->iop_order = INT_MAX;
1344 module->enabled = (module->force_enable(module, module->enabled) != 0);
1347 if(
module->default_enabled == 1 &&
module->hide_enable_button == 1)
1348 module->enabled = TRUE;
1366 module->enabled = (hist->enabled != 0);
1369 module->iop_order = hist->iop_order;
1407 for(
int i = 0;
i < history_end && history;
i++)
1433 if(
module->commit_proxy)
module->commit_proxy(module);
1535 "Consider compressing history and removing unused masks to keep reads/writes manageable."),
1552 dt_print(
DT_DEBUG_HISTORY,
"[dt_dev_write_history_item] writing history for module %s (%s) (enabled %i) at pipe position %i for image %i\n",
1555 const char *operation = h->module ? h->module->op : h->
op_name;
1557 const int module_version = h->module ? h->module->version() : h->
module_version;
1558 const int blendop_params_size
1560 const int blendop_version
1665 const int32_t imgid =
d->image_storage.id;
1688 "[_dt_dev_write_history_job_run] tid %lu held history_mutex for %.2f ms to snapshot image %i\n",
1696 "[_dt_dev_write_history_job_run] tid %lu full history+masks rewrite for image %i took %.2f ms, lock-free\n",
1780 int32_t params_len = 0;
1848 module->enabled = TRUE;
1861 module->enabled = TRUE;
1869 dt_print(
DT_DEBUG_HISTORY,
"[history] Image history seems older than Darktable 3.0, we will insert white balance.\n");
1888 module->enabled = TRUE;
1967 hist->module =
module;
1979 if(!hist->module && match)
2023 else if(blendop_params
2050 const int modversion,
int *
legacy_params,
const char *preset_name)
2064 if(!hist->module->legacy_params
2066 hist->
params,
labs(hist->module->version())))
2071 fprintf(
stderr,
"[dev_read_history] module `%s' %s version mismatch: history is %d, dt %d.\n", hist->module->op,
2072 preset, modversion, hist->module->version());
2075 preset, hist->module->version(), modversion);
2086 if(!
strcmp(hist->module->op,
"spots") && modversion == 1)
2103 if(!
strcmp(hist->module->op,
"flip") && hist->
enabled == 0 &&
labs(modversion) == 1)
2138 const int modversion,
const char *operation,
const void *
module_params,
2140 const int bl_length,
const int blendop_version,
const int multi_priority,
2141 const char *multi_name,
const char *preset_name,
int *
legacy_params,
2142 const gboolean presets)
REQUIRES(dev->history_mutex)
2150 fprintf(
stderr,
"[dev_read_history] database history for image `%s' seems to be corrupted!\n",
2151 dev->image_storage.filename);
2166 hist->module =
NULL;
2197 "[dev_read_history] the module `%s' requested by image `%s' is not installed on this computer!\n",
2198 operation, dev->image_storage.filename);
2259 if(hist->module->force_enable)
2260 hist->
enabled = (hist->module->force_enable(hist->module, hist->
enabled) != 0);
2263 if(hist->module->default_enabled ==
TRUE && hist->module->hide_enable_button ==
TRUE)
2270 && !
IS_NULL_PTR(hist->module->default_blendop_params))
2283 hist->
iop_order, hist->
enabled, (presets) ?
"preset" :
"database", (presets) ? preset_name :
"");
2376 fprintf(
stderr,
"[dt_dev_read_history_ext] we have no history item. This is not normal.\n");
2379 else if(!hist->module)
2410 dev->forms_changed =
FALSE;
2456 return module->default_enabled || (module->force_enable && module->force_enable(module, module->enabled));
2467 return module->has_defaults ? module->has_defaults(module) : TRUE;
2518 return module->enabled && _module_is_default_or_forced_enabled(module);
2526 return module->enabled && !_module_is_default_or_forced_enabled(module)
2527 && _module_params_are_default(module);
2535 return module->enabled && !_module_is_default_or_forced_enabled(module)
2536 && !_module_params_are_default(module);
2544 return !
module->enabled
2545 && (module->default_enabled || module->workflow_enabled || _module_has_nondefault_internal_params(module));
2687 if(
mod->multi_priority == 0)
2716 "[_check_deleted_instances] found duplicate module %s %s (%i) and %s %s (%i) both in history\n",
2722 "[_check_deleted_instances] found duplicate module %s %s (%i) and %s %s (%i) none in history\n",
2785 if(
hitem->module &&
hitem->module->multi_priority !=
hitem->multi_priority)
2809 hit->module =
module;
2858 fprintf(
stderr,
"[_create_deleted_modules] can't find base module for %s\n",
hitem->op_name);
2865 dt_iop_module_t *
module = (dt_iop_module_t *)calloc(1, sizeof(dt_iop_module_t));
2870 module->instance = base_module->instance;
2875 module->iop_order = hitem->iop_order;
2891 hitem->module =
module;
2907 GList *iop_list = *iop;
2947 const void *blend_params,
const size_t blend_size)
3023 gboolean ok =
FALSE;
void reload_defaults(dt_iop_module_t *module)
void dt_atomic_set_int(dt_atomic_int *var, int value)
int dt_atomic_get_int(dt_atomic_int *var)
int dt_atomic_sub_int(dt_atomic_int *var, int decr)
int dt_atomic_add_int(dt_atomic_int *var, int incr)
int dt_atomic_exch_int(dt_atomic_int *var, int value)
static void * dt_atomic_exch_ptr(dt_atomic_ptr *var, void *value)
static void * dt_atomic_get_ptr(const dt_atomic_ptr *var)
size_t params_size(dt_imageio_module_format_t *self)
int dt_develop_blend_version(void)
int dt_develop_blend_legacy_params(dt_iop_module_t *module, const void *const old_params, const int old_version, void *new_params, const int new_version, const int length)
typedef void((*dt_cache_allocate_t)(void *userdata, dt_cache_entry_t *entry))
void dt_conf_set_string(const char *name, const char *val)
gboolean dt_image_is_matrix_correction_supported(const dt_image_t *img)
gboolean dt_image_is_raw(const dt_image_t *img)
int dt_image_monochrome_flags(const dt_image_t *img)
gboolean dt_image_is_hdr(const dt_image_t *img)
gboolean dt_image_needs_rawprepare(const dt_image_t *img)
void dt_image_history_changed(const int32_t imgid, const gboolean refresh_filmstrip)
struct dt_control_t * dt_control_get_global(void)
struct dt_develop_t * dt_dev_get_global(void)
struct dt_gui_gtk_t * dt_gui_get_global(void)
static void _remove_history_leaks(dt_develop_t *dev) REQUIRES(dev -> history_mutex)
Remove history items past history_end when allowed.
void dt_apply_dev_history_update(dt_develop_t *dev)
Reload the current darkroom history and refresh every dependent GUI.
static gboolean _module_blend_params_are_default(dt_iop_module_t *module)
Check if blend params match defaults.
void dt_dev_history_set_commit_gui_handler(dt_dev_history_commit_gui_handler_t handler)
gboolean dt_dev_transient_params_get(dt_develop_t *dev, const dt_iop_module_t *module, void *out_params, const size_t out_params_size, void *out_blend, const size_t out_blend_size, gboolean *out_has_blend, uint64_t *out_serial)
static int _rebuild_multi_priority(GList *history_list)
Resync module multi_priority values from history.
int dt_dev_write_history_item(const int32_t imgid, dt_dev_history_item_t *h, int32_t num)
void dt_dev_history_compress_or_truncate(dt_develop_t *dev) REQUIRES_SHARED(dev -> history_mutex)
Compress history if history_end is at top, otherwise truncate.
static void _history_to_module(const dt_dev_history_item_t *const hist, dt_iop_module_t *module, GList *current_forms)
Apply a history item to a module instance.
int dt_dev_next_multi_priority_for_op(dt_develop_t *dev, const char *op)
Return the next available multi_priority for an operation.
static void _dt_dev_modules_reload_defaults(dt_develop_t *dev)
Reset every module to its (already-computed) default params before history is overlaid.
static int _check_deleted_instances(dt_develop_t *dev, GList **_iop_list, GList *history_list, GList **removed_gui_modules)
Detect and handle module instances that exist in iop list but not in history.
static void _dev_history_add_filtered(dt_develop_t *dev, dt_iop_module_filter_t filter) REQUIRES(dev -> history_mutex)
Append history items for modules that pass a filter.
static void _undo_items_cb(gpointer user_data, dt_undo_type_t type, dt_undo_data_t data)
Undo iterator callback to fix module pointers in snapshots.
void dt_dev_pop_history_items_ext(dt_develop_t *dev) REQUIRES_SHARED(dev -> history_mutex)
Apply history items to module params up to dev->history_end.
static void _history_invalidate_cb(gpointer user_data, dt_undo_type_t type, dt_undo_data_t item)
Undo iterator callback to invalidate module pointers in snapshots.
static gboolean _compress_enabled_user_nondefault_params(dt_iop_module_t *module)
Filter: enabled modules with non-default params (user edits).
void dt_dev_history_snapshot_release(dt_dev_history_snapshot_t *snapshot)
Release every reference a snapshot holds and reset it. Needs no lock.
static dt_dev_history_item_t * _search_history_by_op(dt_develop_t *dev, const dt_iop_module_t *module) REQUIRES_SHARED(dev -> history_mutex)
Find the first history item matching a module operation name.
void dt_dev_history_set_undo_restore_gui_handler(dt_dev_history_undo_restore_gui_handler_t handler)
static void _dev_history_db_row_cb(void *user_data, const int32_t id, const int num, const int modversion, const char *operation, const void *module_params, const int param_length, const gboolean enabled, const void *blendop_params, const int bl_length, const int blendop_version, const int multi_priority, const char *multi_name, const char *preset_name)
Adapter callback for history DB rows.
static void _find_so_for_history_entry(dt_develop_t *dev, dt_dev_history_item_t *hist)
Bind a history entry to a module instance (.so) in dev->iop.
static gboolean _module_params_are_default(dt_iop_module_t *module)
Check if module params match defaults.
gboolean dt_dev_read_history_ext(dt_develop_t *dev, const int32_t imgid) REQUIRES(dev -> history_mutex)
Read history and masks from DB and populate dev->history.
static gboolean _module_is_default_or_forced_enabled(dt_iop_module_t *module)
Check if a module is enabled by default or force-enabled.
static void _pop_undo(gpointer user_data, dt_undo_type_t type, dt_undo_data_t data, dt_undo_action_t action, GList **imgs) NO_THREAD_SAFETY_ANALYSIS
Apply an undo/redo history snapshot to a develop context.
static dt_iop_module_t * _history_merge_resolve_dest_instance(dt_develop_t *dev_dest, const dt_iop_module_t *mod_src, gboolean *created, gboolean *reused_base) REQUIRES_SHARED(dev_dest -> history_mutex)
Resolve or create the destination module instance for history merge.
static void _process_history_db_entry(dt_develop_t *dev, const int32_t imgid, const int id, const int num, const int modversion, const char *operation, const void *module_params, const int param_length, const gboolean enabled, const void *blendop_params, const int bl_length, const int blendop_version, const int multi_priority, const char *multi_name, const char *preset_name, int *legacy_params, const gboolean presets)
Build a history item from DB row data and append it to dev->history.
static int _sync_params(dt_dev_history_item_t *hist, const void *module_params, const int param_length, const int modversion, int *legacy_params, const char *preset_name)
Load or convert module params into a history item.
gboolean _module_leaves_no_history(dt_iop_module_t *module)
Return whether a module never writes history entries.
void dt_dev_history_undo_end_record_locked(dt_develop_t *dev) REQUIRES(dev -> history_mutex)
Finish an undo record with history_mutex already locked.
dt_dev_history_item_t * dt_dev_history_item_create(void)
Allocate a fresh, blank history item with refcount 1.
int dt_dev_replace_history_on_image(dt_develop_t *dev_src, const int32_t dest_imgid, const gboolean reload_defaults, const char *msg)
Replace an image history with the content of dev_src.
static int _create_deleted_modules(GList **_iop_list, GList *history_list)
Recreate missing module instances referenced by history.
static void _history_write_state_release(_history_write_state_t *state)
void dt_dev_transient_params_clear(dt_iop_module_t *module)
Drop the transient slot if it belongs to module.
void dt_dev_history_cleanup(void)
Cleanup cached statements or state used by history I/O.
dt_iop_module_t * dt_dev_get_module_instance(dt_develop_t *dev, const char *op, const char *multi_name, const int multi_priority)
Find a module instance by op name and instance metadata.
void dt_dev_transient_params_set(dt_iop_module_t *module, const void *params, const size_t params_size, const void *blend_params, const size_t blend_size)
Out-of-history transient param channel.
int dt_history_merge_module_into_history(dt_develop_t *dev_dest, dt_develop_t *dev_src, dt_iop_module_t *mod_src) REQUIRES(dev_dest -> history_mutex)
Merge a single module instance into a destination history.
void dt_dev_free_history_item(gpointer data)
Release a reference to a history item (used as GList free callback).
gboolean dt_dev_history_item_update_from_params(dt_develop_t *dev, dt_dev_history_item_t *hist, dt_iop_module_t *module, const gboolean enabled, const void *params, const int32_t params_size, const dt_develop_blend_params_t *blend_params, GList *forms)
dt_iop_module_t * dt_dev_create_module_instance(dt_develop_t *dev, const char *op, const char *multi_name, const int multi_priority, gboolean use_next_priority)
Create a new module instance from an existing base .so.
GList * dt_history_duplicate(GList *hist)
Deep-copy a history list.
static dt_dev_history_item_t * _dt_dev_history_item_duplicate_one(const dt_dev_history_item_t *old)
int dt_dev_copy_module_contents(dt_develop_t *dev_dest, dt_develop_t *dev_src, dt_iop_module_t *mod_dest, const dt_iop_module_t *mod_src)
int dt_dev_history_refresh_nodes_ext(dt_develop_t *dev, GList **iop, GList *history, GList **removed_gui_modules)
Refresh GUI module nodes to match history state.
void dt_dev_history_free_history(dt_develop_t *dev) REQUIRES(dev -> history_mutex)
Free the whole history list attached to dev->history.
static void _history_undo_data_free(gpointer data)
Free an undo history snapshot structure.
void dt_dev_history_compress_ext(dt_develop_t *dev, gboolean write_history)
Variant of history compression that optionally skips DB writeback.
gboolean dt_dev_add_history_item_ext(dt_develop_t *dev, struct dt_iop_module_t *module, gboolean enable, gboolean force_new_item) REQUIRES(dev -> history_mutex)
Append or update a history item for a module.
gboolean(* dt_iop_module_filter_t)(dt_iop_module_t *module)
void dt_dev_history_undo_invalidate_module(dt_iop_module_t *module)
Invalidate a module pointer inside undo snapshots.
void dt_dev_history_compress(dt_develop_t *dev)
Compress an history from a loaded pipeline, aka simply take a snapshot of all modules parameters....
uint64_t dt_dev_history_compute_hash(dt_develop_t *dev) REQUIRES_SHARED(dev -> history_mutex)
Get the integrity checksum of the whole history stack. This should be done ONLY when history is chang...
dt_dev_history_item_t * dt_dev_history_item_ref(dt_dev_history_item_t *item)
Take a reference on a history item. Pair with dt_dev_free_history_item().
gboolean dt_dev_history_is_image_in_dev(GList *imgs)
Check whether any image of the list is the one currently loaded in the darkroom.
static void _insert_default_modules(dt_develop_t *dev, dt_iop_module_t *module, gboolean is_inited) REQUIRES(dev -> history_mutex)
Insert default modules into history when needed.
void dt_dev_history_snapshot_take(dt_develop_t *dev, dt_dev_history_snapshot_t *snapshot) REQUIRES_SHARED(dev -> history_mutex)
Take a snapshot of dev->history. Caller holds history_mutex (reader suffices).
int dt_dev_history_item_from_source_history_item(dt_develop_t *dev_dest, dt_develop_t *dev_src, const dt_dev_history_item_t *hist_src, dt_iop_module_t *mod_dest, dt_dev_history_item_t **out_hist)
int dt_dev_merge_history_into_image(dt_develop_t *dev_src, int32_t dest_imgid, const GList *mod_list, gboolean merge_iop_order, const dt_history_merge_strategy_t mode, const gboolean paste_instances, const char *source_label, dt_hm_batch_state_t *batch)
Merge a list of modules into a destination image history via dt_history_merge().
void dt_dev_pop_history_items(dt_develop_t *dev)
Thread-safe wrapper around dt_dev_pop_history_items_ext(), then update GUI.
void dt_dev_write_history(dt_develop_t *dev, gboolean async)
Thread-safe wrapper around dt_dev_write_history_ext() for dev->image_storage.id.
void dt_dev_history_truncate(dt_develop_t *dev, const int32_t imgid)
static gboolean _compress_enabled_default_or_forced(dt_iop_module_t *module)
Filter: enabled modules that are default/forced enabled.
static void _reset_module_instance(GList *hist, dt_iop_module_t *module, int multi_priority)
Rebind history items to a module instance after recreation.
static dt_dev_history_undo_restore_gui_handler_t _undo_restore_gui_handler
dt_dev_history_item_t * dt_dev_history_get_last_item_by_module(GList *history_list, dt_iop_module_t *module, int history_end)
Find the last history item referencing a module up to history_end.
gboolean dt_dev_transient_params_active(dt_develop_t *dev, const dt_iop_module_t *module)
static void _dt_dev_history_compress_internal(dt_develop_t *dev, const gboolean write_history)
Rebuild history from current pipeline state.
static void _cleanup_history(const int32_t imgid)
Delete all history entries for an image from the DB.
void dt_dev_history_undo_end_record(dt_develop_t *dev)
Finish an undo record for history changes.
gboolean dt_dev_init_default_history(dt_develop_t *dev, const int32_t imgid, gboolean apply_auto_presets)
Initialize module defaults and insert required default modules.
gboolean dt_history_module_skip_copy(const int flags)
Determine whether a module should be skipped during history copy.
guint dt_dev_mask_history_overload(GList *dev_history, guint threshold)
static int _dt_dev_write_history_job_run(dt_job_t *job)
void dt_dev_history_pixelpipe_update(dt_develop_t *dev, gboolean rebuild)
Rebuild or resync pixelpipes after backend history changes.
void dt_dev_history_undo_start_record(dt_develop_t *dev)
Start an undo record for history changes.
static dt_dev_history_commit_gui_handler_t _commit_gui_handler
void dt_dev_history_commit_item_now(dt_develop_t *dev, dt_iop_module_t *module, gboolean enable)
Commit one history item immediately – record undo, take history_mutex as writer, write through,...
static void _sync_blendop_params(dt_dev_history_item_t *hist, const void *blendop_params, const int bl_length, const int blendop_version, int *legacy_params)
Load or convert blendop params into a history item.
void dt_dev_history_undo_start_record_locked(dt_develop_t *dev) REQUIRES(dev -> history_mutex)
Start an undo record with history_mutex already locked.
static void _write_history_from_state(const _history_write_state_t *state, const int32_t imgid)
void dt_dev_invalidate_history_module(GList *list, dt_iop_module_t *module)
Remove a module pointer from a history list.
void dt_dev_history_notify_change(dt_develop_t *dev, const int32_t imgid)
Notify the rest of the app that history changes were written.
gboolean dt_dev_reload_history_items(dt_develop_t *dev, const int32_t imgid)
Reload history from DB and rebuild pipelines/GUI state.
static gboolean _compress_disabled_with_history(dt_iop_module_t *module)
Filter: disabled modules that still need history entries.
static void _history_write_state_take(dt_develop_t *dev, _history_write_state_t *state) REQUIRES_SHARED(dev -> history_mutex)
static gboolean _compress_enabled_user_default_params(dt_iop_module_t *module)
Filter: enabled modules with default params (user enabled).
static gboolean _dev_auto_apply_presets(dt_develop_t *dev, int32_t imgid)
Apply auto-presets and default iop order for a fresh history.
static gboolean _module_has_nondefault_internal_params(dt_iop_module_t *module)
Check if any module params (including blend params) are non-default.
dt_dev_history_item_t * dt_dev_history_get_first_item_by_module(GList *history_list, dt_iop_module_t *module)
Find the first history item referencing a module.
dt_dev_history_item_t * dt_dev_history_cow_touch(dt_develop_t *dev, dt_dev_history_item_t *hist)
Copy-on-write gate for mutating a history item in place.
void dt_dev_write_history_ext(dt_develop_t *dev, const int32_t imgid) REQUIRES_SHARED(dev -> history_mutex)
Write dev->history to DB and XMP for a given image id.
void(* dt_dev_history_commit_gui_handler_t)(struct dt_develop_t *dev, struct dt_iop_module_t *module)
Post-commit presentation work: viewport-size refresh for geometry-changing modules,...
void dt_dev_set_history_end_ext(struct dt_develop_t *dev, const uint32_t index)
Set the history end index (GUI perspective).
void dt_dev_history_gui_update(struct dt_develop_t *dev)
Apply history-loaded params to module GUIs.
int32_t dt_dev_get_history_end_ext(struct dt_develop_t *dev)
Get the current history end index (GUI perspective).
void(* dt_dev_history_undo_restore_gui_handler_t)(struct dt_develop_t *dev, int mask_edit_mode, int request_mask_display)
Restores the presentation half of an undo record: the blending panel's mask toggles for the focused m...
#define dt_dev_pixelpipe_resync_history_all(dev)
#define dt_dev_pixelpipe_rebuild_all(dev)
#define dt_dev_pixelpipe_update_history_all(dev)
void dt_dev_signal_modules_moved(dt_develop_t *dev)
void dt_dev_masks_list_change(dt_develop_t *dev)
int dt_dev_get_thumbnail_size(dt_develop_t *dev)
void dt_dev_cleanup(dt_develop_t *dev)
void dt_dev_init(dt_develop_t *dev, int32_t gui_attached)
void dt_dev_undo_start_record(dt_develop_t *dev)
GList * dt_dev_load_modules(dt_develop_t *dev)
void dt_dev_masks_update_hash(dt_develop_t *dev)
void dt_dev_undo_end_record(dt_develop_t *dev)
dt_dev_image_storage_t dt_dev_ensure_image_storage(dt_develop_t *dev, const int32_t imgid)
void dt_dev_masks_list_update(dt_develop_t *dev)
static uint64_t dt_dev_get_history_hash(const dt_develop_t *dev)
dt_dev_pixelpipe_display_mask_t
@ DT_DEV_PIXELPIPE_DISPLAY_NONE
static void dt_dev_set_history_hash(dt_develop_t *dev, const uint64_t history_hash)
gboolean enabled
–doc was passed on the command line
static int rwlock NO_THREAD_SAFETY_ANALYSIS
static int dt_pthread_rwlock_wrlock(dt_pthread_rwlock_t *rwlock) ACQUIRE(rwlock) NO_THREAD_SAFETY_ANALYSIS
static int dt_pthread_rwlock_unlock(dt_pthread_rwlock_t *rwlock) RELEASE_GENERIC(rwlock) NO_THREAD_SAFETY_ANALYSIS
static int dt_pthread_rwlock_rdlock(dt_pthread_rwlock_t *rwlock) ACQUIRE_SHARED(rwlock) NO_THREAD_SAFETY_ANALYSIS
static int dt_pthread_mutex_unlock(dt_pthread_mutex_t *mutex) RELEASE(mutex) NO_THREAD_SAFETY_ANALYSIS
static int dt_pthread_mutex_lock(dt_pthread_mutex_t *mutex) ACQUIRE(mutex) NO_THREAD_SAFETY_ANALYSIS
void * legacy_params(dt_imageio_module_format_t *self, const void *const old_params, const size_t old_params_size, const int old_version, const int new_version, size_t *new_size)
static uint64_t dt_hash(uint64_t hash, const char *str, size_t size)
static gboolean enable(const dt_image_t *image)
void dt_history_toast(const char *format,...)
void dt_history_message(const char *format,...)
void dt_history_changed(const dt_history_change_t what)
Raise it. Internal to this code.
Everything the history, styles and presets code says to the outside world: messages for the user,...
@ DT_HISTORY_CHANGE_DEVELOP
int dt_history_merge(dt_develop_t *dev_dest, dt_develop_t *dev_src, const int32_t dest_imgid, const GList *mod_list, const gboolean merge_iop_order, const dt_history_merge_strategy_t strategy, const gboolean force_new_modules, const char *source_label, dt_hm_batch_state_t *batch)
Merge a list of modules into a destination image, solving pipeline topologies for proper insertion of...
dt_history_merge_strategy_t
void dt_history_repository_foreach_auto_preset_row(const int32_t imgid, const dt_image_t *image, const char *workflow_preset, const int iformat, const int excluded, dt_history_repository_row_cb cb, void *user_data)
gboolean dt_history_repository_delete_dev_history(const int32_t imgid)
gboolean dt_history_repository_write_item(const int32_t imgid, const int num, const char *operation, const void *op_params, const int op_params_size, const int module_version, const gboolean enabled, const void *blendop_params, const int blendop_params_size, const int blendop_version, const int multi_priority, const char *multi_name)
gboolean dt_history_repository_module_exists(const int32_t imgid, const char *operation)
gboolean dt_history_repository_get_autoapply_ioporder_params(const int32_t imgid, const dt_image_t *image, const int iformat, const int excluded, void **params, int32_t *params_len)
gboolean dt_history_repository_set_end(const int32_t imgid, const int32_t history_end)
int32_t dt_history_repository_get_end(const int32_t imgid)
int32_t dt_history_repository_get_next_num(const int32_t imgid)
void dt_history_repository_foreach_row(const int32_t imgid, dt_history_repository_row_cb cb, void *user_data)
@ DT_IMAGE_NO_LEGACY_PRESETS
@ DT_IMAGE_AUTO_PRESETS_APPLIED
void dt_image_cache_write_release(dt_image_t *img, dt_image_cache_write_mode_t mode)
dt_image_t * dt_image_cache_get(const int32_t imgid, char mode)
void dt_image_cache_read_release(const dt_image_t *img)
dt_iop_module_t * dt_iop_get_module_from_list(GList *iop_list, const char *op)
gboolean dt_iop_module_needs_mask_history_ext(const dt_iop_module_t *module, gboolean *raster, gboolean *drawn, gboolean *parametric)
void dt_iop_load_default_params(dt_iop_module_t *module)
void dt_iop_compute_module_hash(dt_iop_module_t *module, GList *masks)
void dt_iop_reload_defaults(dt_iop_module_t *module)
void dt_iop_commit_blend_params(dt_iop_module_t *module, const dt_develop_blend_params_t *blendop_params)
int dt_iop_load_module(dt_iop_module_t *module, dt_iop_module_so_t *module_so, dt_develop_t *dev)
gboolean dt_iop_module_needs_mask_history(const dt_iop_module_t *module)
gboolean dt_iop_check_modules_equal(dt_iop_module_t *mod_1, dt_iop_module_t *mod_2)
dt_iop_module_t * dt_iop_get_module_by_op_priority(GList *modules, const char *operation, const int multi_priority)
void dt_iop_update_multi_priority(dt_iop_module_t *module, int new_priority)
@ IOP_FLAGS_NO_HISTORY_STACK
struct dt_iop_tonecurve_params_t preset
gboolean dt_ioppr_has_iop_order_list(int32_t imgid)
Check whether the image has an explicit order list stored in DB.
GList * dt_ioppr_get_iop_order_list_version(dt_iop_order_t version)
Return the built-in order list for a given version.
gint dt_sort_iop_by_order(gconstpointer a, gconstpointer b)
Compare two module instances by iop_order for sorting.
GList * dt_ioppr_iop_order_copy_deep(GList *iop_order_list)
Deep-copy an order list.
gboolean dt_ioppr_write_iop_order_list(GList *iop_order_list, const int32_t imgid)
Persist an order list to the DB for a given image.
int dt_ioppr_get_iop_order(GList *iop_order_list, const char *op_name, const int multi_priority)
Return the iop_order for a given operation/instance pair.
void dt_ioppr_set_default_iop_order(dt_develop_t *dev, const int32_t imgid)
Set dev->iop_order_list to the default order for a given image.
void dt_ioppr_resync_pipeline(dt_develop_t *dev, const int32_t imgid, const char *msg, gboolean check_duplicates)
Resynchronize pipeline order and related structures.
GList * dt_ioppr_deserialize_iop_order_list(const char *buf, size_t size)
Deserialize an order list from a binary blob.
dt_job_t * dt_control_job_create(dt_job_execute_callback execute, const char *msg,...)
int dt_control_add_job(dt_control_t *control, dt_job_queue_t queue_id, _dt_job_t *job)
void * dt_control_job_get_params(const _dt_job_t *job)
void dt_control_job_set_params(_dt_job_t *job, void *params, dt_job_destroy_callback callback)
void dt_control_job_dispose(_dt_job_t *job)
static const dt_iop_drawlayer_params_t * params
_lib_location_type_t type
void dt_print(dt_debug_thread_t thread, const char *msg,...) __attribute__((format(printf
Print to stdout when thread is enabled, prefixed with seconds since startup.
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
void dt_masks_read_masks_history(dt_develop_t *dev, const int32_t imgid)
void dt_masks_write_masks_history_item(const int32_t imgid, const int num, dt_masks_form_t *form)
dt_masks_form_t * dt_masks_get_from_id(dt_develop_t *dev, int id)
dt_masks_edit_mode_t dt_masks_get_edit_mode(struct dt_iop_module_t *module)
void dt_masks_set_edit_mode(struct dt_iop_module_t *module, dt_masks_edit_mode_t value)
int dt_masks_copy_used_forms_for_module(dt_develop_t *dev_dest, dt_develop_t *dev_src, const struct dt_iop_module_t *mod_src)
GList * dt_masks_snapshot_current_forms(dt_develop_t *dev, gboolean reset_changed)
void dt_masks_replace_current_forms(dt_develop_t *dev, GList *forms)
dt_masks_form_t * dt_masks_form_ref(dt_masks_form_t *form)
void dt_masks_form_unref(dt_masks_form_t *form)
static void dt_free_gpointer(gpointer ptr)
g_free() one pointer, with the signature GDestroyNotify wants.
#define dt_free(ptr)
g_free() ptr and set it to NULL, skipping both if it is already NULL.
dt_mipmap_buffer_dsc_flags flags
#define DT_PIXELPIPE_CACHE_HASH_INVALID
static void dt_dev_pixelpipe_or_changed(dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_change_t flags)
const float uint32_t state[4]
unsigned __int64 uint64_t
dt_iop_module_t *int multi_priority
dt_dev_history_snapshot_t snapshot
struct dt_develop_blend_params_t * blend_params
struct dt_iop_module_t *gboolean enabled
A reference-sharing snapshot of dev->history, for readers that outlive a lock.
struct dt_develop_t::@12 transient_params
struct dt_iop_module_t * gui_module
dt_pthread_rwlock_t history_mutex
struct dt_dev_pixelpipe_t * preview_pipe
struct dt_iop_module_t *void * params
dt_atomic_int history_write_pending
dt_pthread_mutex_t transient_params_mutex
struct dt_dev_pixelpipe_t * pipe
GTimeSpan change_timestamp
dt_dev_pixelpipe_display_mask_t request_mask_display
GList * before_iop_order_list
GList * after_iop_order_list
dt_masks_edit_mode_t mask_edit_mode
void dt_supervisor_rekey(const uint64_t old_hash, const uint64_t new_hash)
void dt_supervisor_history(const dt_sv_op_t op, const uint64_t param_hash, const char *op_name, const int multi_priority, const char *multi_name, const int iop_order, const int history_index, const int32_t imgid, const gboolean enabled, const dt_iop_module_t *module, const void *params, const dt_develop_blend_params_t *blend_params, GList *forms)
static gboolean dt_supervisor_active(void)
static double dt_get_wtime(void)
void dt_undo_iterate_internal(dt_undo_t *self, uint32_t filter, gpointer user_data, void(*apply)(gpointer user_data, dt_undo_type_t type, dt_undo_data_t item))
void dt_undo_record(dt_undo_t *self, gpointer user_data, dt_undo_type_t type, dt_undo_data_t data, void(*undo)(gpointer user_data, dt_undo_type_t type, dt_undo_data_t item, dt_undo_action_t action, GList **imgs), void(*free_data)(gpointer data))
dt_undo_t * dt_undo_get_global(void)