Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
dev_history.h File Reference
#include "common/history.h"
#include "common/history_merge.h"
#include <glib.h>
+ Include dependency graph for dev_history.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  dt_dev_history_item_t
 

Macros

#define DT_IOP_PARAMS_T
 
#define dt_dev_add_history_item(dev, module, enable, redraw)   DT_DEBUG_TRACE_WRAPPER(DT_DEBUG_DEV, dt_dev_add_history_item_real, (dev), (module), (enable), (redraw))
 

Typedefs

typedef void dt_iop_params_t
 
typedef struct dt_dev_history_item_t dt_dev_history_item_t
 

Functions

void dt_dev_history_free_history (struct dt_develop_t *dev)
 Free the whole history list attached to dev->history.
 
void dt_dev_free_history_item (gpointer data)
 Free a single history item (used as GList free callback).
 
gboolean dt_dev_history_item_update_from_params (struct dt_develop_t *dev, dt_dev_history_item_t *hist, struct dt_iop_module_t *module, gboolean enabled, const void *params, const int32_t params_size, const struct dt_develop_blend_params_t *blend_params, GList *forms)
 Fill/refresh a history item from explicit params and apply them to the module.
 
int dt_dev_next_multi_priority_for_op (struct dt_develop_t *dev, const char *op)
 Return the next available multi_priority for an operation.
 
struct dt_iop_module_tdt_dev_get_module_instance (struct 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.
 
struct dt_iop_module_tdt_dev_create_module_instance (struct 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.
 
int dt_dev_copy_module_contents (struct dt_develop_t *dev_dest, struct dt_develop_t *dev_src, struct dt_iop_module_t *mod_dest, const struct dt_iop_module_t *mod_src)
 Copy params/blend params from one module instance to another.
 
int dt_dev_history_item_from_source_history_item (struct dt_develop_t *dev_dest, struct dt_develop_t *dev_src, const struct dt_dev_history_item_t *hist_src, struct dt_iop_module_t *mod_dest, struct dt_dev_history_item_t **out_hist)
 Create a history item from another history item, using a destination module.
 
int dt_dev_merge_history_into_image (struct 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)
 Merge a list of modules into a destination image history via dt_history_merge().
 
int dt_dev_replace_history_on_image (struct 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.
 
gboolean dt_dev_add_history_item_ext (struct dt_develop_t *dev, struct dt_iop_module_t *module, gboolean enable, gboolean force_new_item)
 Append or update a history item for a module.
 
void dt_dev_add_history_item_real (struct dt_develop_t *dev, struct dt_iop_module_t *module, gboolean enable, gboolean redraw)
 Thread-safe wrapper around dt_dev_add_history_item_ext().
 
void dt_dev_write_history_ext (struct dt_develop_t *dev, const int32_t imgid)
 Write dev->history to DB and XMP for a given image id.
 
void dt_dev_write_history (struct dt_develop_t *dev)
 Thread-safe wrapper around dt_dev_write_history_ext() for dev->image_storage.id.
 
void dt_dev_history_gui_update (struct dt_develop_t *dev)
 Apply history-loaded params to module GUIs.
 
void dt_dev_history_pixelpipe_update (struct dt_develop_t *dev, gboolean rebuild)
 Rebuild or resync pixelpipes after backend history changes.
 
void dt_dev_history_notify_change (struct dt_develop_t *dev, const int32_t imgid)
 Notify the rest of the app that history changes were written.
 
void dt_dev_history_undo_start_record (struct dt_develop_t *dev)
 Start an undo record for history changes.
 
void dt_dev_history_undo_end_record (struct dt_develop_t *dev)
 Finish an undo record for history changes.
 
void dt_dev_history_undo_start_record_locked (struct dt_develop_t *dev)
 Start an undo record with history_mutex already locked.
 
void dt_dev_history_undo_end_record_locked (struct dt_develop_t *dev)
 Finish an undo record with history_mutex already locked.
 
void dt_dev_history_undo_invalidate_module (struct dt_iop_module_t *module)
 Invalidate a module pointer inside undo snapshots.
 
gboolean dt_dev_read_history_ext (struct dt_develop_t *dev, const int32_t imgid)
 Read history and masks from DB and populate dev->history.
 
void dt_dev_pop_history_items_ext (struct dt_develop_t *dev)
 Apply history items to module params up to dev->history_end.
 
void dt_dev_pop_history_items (struct dt_develop_t *dev)
 Thread-safe wrapper around dt_dev_pop_history_items_ext(), then update GUI.
 
void dt_dev_reload_history_items (struct dt_develop_t *dev, const int32_t imgid)
 Reload history from DB and rebuild pipelines/GUI state.
 
void dt_dev_invalidate_history_module (GList *list, struct dt_iop_module_t *module)
 Remove a module pointer from a history list.
 
uint64_t dt_dev_history_compute_hash (struct dt_develop_t *dev)
 Get the integrity checksum of the whole history stack. This should be done ONLY when history is changed, read or written.
 
int32_t dt_dev_get_history_end_ext (struct dt_develop_t *dev)
 Get the current history end index (GUI perspective).
 
void dt_dev_set_history_end_ext (struct dt_develop_t *dev, const uint32_t index)
 Set the history end index (GUI perspective).
 
gboolean dt_history_module_skip_copy (const int flags)
 Determine whether a module should be skipped during history copy.
 
int dt_history_merge_module_into_history (struct dt_develop_t *dev_dest, struct dt_develop_t *dev_src, struct dt_iop_module_t *mod_src)
 Merge a single module instance into a destination history.
 
void dt_dev_history_compress (struct dt_develop_t *dev)
 Compress an history from a loaded pipeline, aka simply take a snapshot of all modules parameters. This assumes the history end is properly set, which always happens after calling _pop_history_item.
 
void dt_dev_history_compress_ext (struct dt_develop_t *dev, gboolean write_history)
 Variant of history compression that optionally skips DB writeback.
 
void dt_dev_history_compress_or_truncate (struct dt_develop_t *dev)
 Compress history if history_end is at top, otherwise truncate.
 
void dt_dev_history_cleanup (void)
 Cleanup cached statements or state used by history I/O.
 
gboolean dt_dev_init_default_history (struct dt_develop_t *dev, const int32_t imgid, gboolean apply_auto_presets)
 Initialize module defaults and insert required default modules.
 
dt_dev_history_item_tdt_dev_history_get_first_item_by_module (GList *history_list, struct dt_iop_module_t *module)
 Find the first history item referencing a module.
 
dt_dev_history_item_tdt_dev_history_get_last_item_by_module (GList *history_list, struct dt_iop_module_t *module, int history_end)
 Find the last history item referencing a module up to history_end.
 
int dt_dev_history_refresh_nodes_ext (struct dt_develop_t *dev, GList *iop, GList *history)
 Refresh GUI module nodes to match history state.
 
void dt_dev_history_truncate (struct dt_develop_t *dev, const int32_t imgid)
 

Detailed Description

The common/history.h defines methods to handle histories from/to database. They work out of any GUI or development stack, so they don't care about modules .so. This file defines binders between that and the GUI/dev objects.

Macro Definition Documentation

◆ dt_dev_add_history_item

#define dt_dev_add_history_item (   dev,
  module,
  enable,
  redraw 
)    DT_DEBUG_TRACE_WRAPPER(DT_DEBUG_DEV, dt_dev_add_history_item_real, (dev), (module), (enable), (redraw))

◆ DT_IOP_PARAMS_T

#define DT_IOP_PARAMS_T

Typedef Documentation

◆ dt_dev_history_item_t

◆ dt_iop_params_t

Function Documentation

◆ dt_dev_add_history_item_ext()

gboolean dt_dev_add_history_item_ext ( struct dt_develop_t dev,
struct dt_iop_module_t module,
gboolean  enable,
gboolean  force_new_item 
)

Append or update a history item for a module.

If the last history item matches the module and force_new_item is FALSE, the existing item is reused. Otherwise a new entry is appended. If history items exist after dev->history_end, they may be removed depending on module rules (see dev_history.c).

Parameters
dev
module
enable
force_new_item
Returns
TRUE if the pipeline topology may need to be updated (new module node).
Todo:
: this copies ALL drawn masks AND masks groups used by all modules to any module history using masks.

References _remove_history_leaks(), dt_iop_module_t::blend_params, DT_DEBUG_HISTORY, dt_dev_history_get_last_item_by_module(), dt_dev_history_item_update_from_params(), dt_dev_set_history_end_ext(), dt_iop_check_modules_equal(), dt_iop_module_needs_mask_history(), dt_masks_snapshot_current_forms(), dt_print(), enable(), dt_dev_history_item_t::enabled, dt_iop_module_t::enabled, FALSE, dt_dev_history_item_t::forms, dt_develop_t::history, dt_dev_history_item_t::num, dt_iop_module_t::params, dt_iop_module_t::params_size, and TRUE.

Referenced by _dev_history_add_filtered(), _insert_default_modules(), _publish_backend_progress(), dt_dev_add_history_item_real(), dt_drawlayer_commit_dabs(), dt_history_merge_module_into_history(), and gui_focus().

◆ dt_dev_add_history_item_real()

◆ dt_dev_copy_module_contents()

int dt_dev_copy_module_contents ( struct dt_develop_t dev_dest,
struct dt_develop_t dev_src,
struct dt_iop_module_t mod_dest,
const struct dt_iop_module_t mod_src 
)

Copy params/blend params from one module instance to another.

Optionally copies the drawn masks used by mod_src from dev_src into dev_dest (if dev_src is non-NULL).

Parameters
dev_destDestination develop context.
dev_srcSource develop context (may be NULL to skip mask copy).
mod_destDestination module instance.
mod_srcSource module instance.
Returns
0 on success, non-zero on allocation failure.

◆ dt_dev_create_module_instance()

struct dt_iop_module_t * dt_dev_create_module_instance ( struct 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.

Parameters
devDevelop context.
opOperation name.
multi_nameInstance name (may be NULL/empty).
multi_priorityInstance priority.
use_next_priorityIf TRUE, auto-pick the next priority for this op.
Returns
New module instance or NULL on failure.

References dt_free, dt_iop_get_module_by_op_priority(), dt_iop_load_module(), dt_develop_t::iop, IOP_FLAGS_ONE_INSTANCE, and dt_iop_module_t::so.

Referenced by _hm_topo_apply_solution().

◆ dt_dev_free_history_item()

◆ dt_dev_get_history_end_ext()

◆ dt_dev_get_module_instance()

struct dt_iop_module_t * dt_dev_get_module_instance ( struct 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.

Tries multi_name first, then falls back to matching multi_priority.

Parameters
devDevelop context.
opOperation name.
multi_nameInstance name (may be NULL/empty).
multi_priorityInstance priority.
Returns
Matching module instance or NULL.

References name.

Referenced by _hm_topo_apply_solution(), and dt_history_merge().

◆ dt_dev_history_cleanup()

void dt_dev_history_cleanup ( void  )

Cleanup cached statements or state used by history I/O.

Referenced by dt_cleanup().

◆ dt_dev_history_compress()

void dt_dev_history_compress ( struct dt_develop_t dev)

Compress an history from a loaded pipeline, aka simply take a snapshot of all modules parameters. This assumes the history end is properly set, which always happens after calling _pop_history_item.

Parameters
dev

References _dt_dev_history_compress_internal(), and TRUE.

Referenced by dt_dev_history_compress_or_truncate().

◆ dt_dev_history_compress_ext()

void dt_dev_history_compress_ext ( struct dt_develop_t dev,
gboolean  write_history 
)

Variant of history compression that optionally skips DB writeback.

Parameters
devDevelop context.
write_historyIf TRUE, write history to DB/XMP after compression.

References _dt_dev_history_compress_internal().

Referenced by _styles_rebuild_history_from_items().

◆ dt_dev_history_compress_or_truncate()

void dt_dev_history_compress_or_truncate ( struct dt_develop_t dev)

Compress history if history_end is at top, otherwise truncate.

Parameters
devDevelop context.

References dt_dev_get_history_end_ext(), dt_dev_history_compress(), dt_dev_history_truncate(), dt_develop_t::history, dt_image_t::id, and dt_develop_t::image_storage.

Referenced by _history_compress_apply().

◆ dt_dev_history_compute_hash()

uint64_t dt_dev_history_compute_hash ( struct dt_develop_t dev)

Get the integrity checksum of the whole history stack. This should be done ONLY when history is changed, read or written.

Parameters
dev
Returns
uint64_t

References DT_DEBUG_HISTORY, dt_dev_get_history_end_ext(), dt_hash(), dt_print(), dt_dev_history_item_t::hash, and dt_develop_t::history.

Referenced by _publish_backend_progress(), dt_dev_add_history_item_real(), dt_dev_pop_history_items_ext(), dt_dev_set_history_end_ext(), dt_dev_write_history_ext(), dt_drawlayer_commit_dabs(), and gui_focus().

◆ dt_dev_history_free_history()

void dt_dev_history_free_history ( struct dt_develop_t dev)

Free the whole history list attached to dev->history.

Frees each history item and clears the list pointer.

Parameters
devDevelop context.

References dt_dev_free_history_item(), and dt_develop_t::history.

Referenced by _dt_dev_history_compress_internal(), _hm_restore_dest_from_backup(), _pop_undo(), _styles_rebuild_history_from_items(), dt_dev_read_history_ext(), and leave().

◆ dt_dev_history_get_first_item_by_module()

dt_dev_history_item_t * dt_dev_history_get_first_item_by_module ( GList *  history_list,
struct dt_iop_module_t module 
)

Find the first history item referencing a module.

Parameters
history_listHistory list.
moduleModule instance.
Returns
First matching history item or NULL.

Referenced by _check_deleted_instances(), and _get_user_mod_list().

◆ dt_dev_history_get_last_item_by_module()

dt_dev_history_item_t * dt_dev_history_get_last_item_by_module ( GList *  history_list,
struct dt_iop_module_t module,
int  history_end 
)

Find the last history item referencing a module up to history_end.

Parameters
history_listHistory list.
moduleModule instance.
history_endUpper bound index (GUI perspective).
Returns
Last matching history item or NULL.

Referenced by _hm_build_last_history_by_id(), _hm_build_override_map(), dt_dev_add_history_item_ext(), and dt_history_merge().

◆ dt_dev_history_gui_update()

◆ dt_dev_history_item_from_source_history_item()

int dt_dev_history_item_from_source_history_item ( struct dt_develop_t dev_dest,
struct dt_develop_t dev_src,
const struct dt_dev_history_item_t hist_src,
struct dt_iop_module_t mod_dest,
struct dt_dev_history_item_t **  out_hist 
)

Create a history item from another history item, using a destination module.

Copies params/blend params, updates module ordering metadata, and snapshots masks if needed by the source module.

Parameters
dev_destDestination develop context (receives masks).
dev_srcSource develop context (provides masks).
hist_srcSource history item.
mod_destDestination module instance.
out_histOutput history item (allocated on success).
Returns
0 on success, non-zero on allocation failure.

◆ dt_dev_history_item_update_from_params()

gboolean dt_dev_history_item_update_from_params ( struct dt_develop_t dev,
dt_dev_history_item_t hist,
struct dt_iop_module_t module,
gboolean  enabled,
const void params,
const int32_t  params_size,
const struct dt_develop_blend_params_t blend_params,
GList *  forms 
)

Fill/refresh a history item from explicit params and apply them to the module.

This helper exists to share code between regular history edits and history merge logic. It will:

  • allocate hist->params and hist->blend_params if needed,
  • free and replace hist->forms with forms (ownership transferred),
  • sync history metadata from module (op_name, multi_name, iop_order, multi_priority),
  • copy params/blend_params into the history buffers (params size is clamped),
  • apply params/blend_params to the module and recompute the hash.
Parameters
devdevelop context (currently unused, reserved for future).
histhistory item to update (must be non-NULL).
moduledestination module instance (must be non-NULL).
enabledenabled state to store/apply.
paramsparams buffer (if NULL, uses module->params).
params_sizesize of params in bytes (ignored if params is NULL).
blend_paramsblend params buffer (if NULL, uses module->blend_params).
formsmask forms snapshot for this history item (ownership transferred; may be NULL).
Returns
TRUE on success, FALSE on allocation failure/invalid args.

Populate a history item from module parameters and recompute hashes.

This allocates the history buffers if needed, copies params/blend params, assigns module metadata (op name, instance data), applies the values back to the module to keep hashes in sync, and computes the history hash using the provided mask snapshot.

Parameters
devDevelop context (currently unused, reserved for future use).
histHistory item to update.
moduleDestination module instance.
enabledEnabled state to store.
paramsOptional params buffer (NULL uses module->params).
params_sizeSize of params in bytes (ignored if params is NULL).
blend_paramsOptional blend params buffer (NULL uses module->blend_params).
formsMask snapshot to attach (ownership transferred, may be NULL).
Returns
TRUE on success, FALSE on allocation/argument failure.

◆ dt_dev_history_notify_change()

void dt_dev_history_notify_change ( struct dt_develop_t dev,
const int32_t  imgid 
)

◆ dt_dev_history_pixelpipe_update()

void dt_dev_history_pixelpipe_update ( struct dt_develop_t dev,
gboolean  rebuild 
)

Rebuild or resync pixelpipes after backend history changes.

Parameters
devDevelop context.
rebuildTRUE to rebuild pipeline topology, FALSE to resync only.

References dt_dev_pixelpipe_rebuild_all, dt_dev_pixelpipe_resync_history_all, and dt_develop_t::gui_attached.

Referenced by _history_apply_history_end(), _pop_undo(), dt_ioppr_migrate_iop_order(), dt_lightroom_import(), and dt_menu_apply_dev_history_update().

◆ dt_dev_history_refresh_nodes_ext()

int dt_dev_history_refresh_nodes_ext ( struct dt_develop_t dev,
GList *  iop,
GList *  history 
)

Refresh GUI module nodes to match history state.

Removes modules without history, creates missing instances, and reorders the GUI list according to history/pipeline ordering.

Parameters
devDevelop context.
iopModule list.
historyHistory list.
Returns
0 on success, non-zero on error.

References _check_deleted_instances(), _create_deleted_modules(), _rebuild_multi_priority(), _reorder_gui_module_list(), and dt_sort_iop_by_order().

Referenced by dt_dev_history_gui_update().

◆ dt_dev_history_truncate()

void dt_dev_history_truncate ( struct dt_develop_t dev,
const int32_t  imgid 
)

◆ dt_dev_history_undo_end_record()

void dt_dev_history_undo_end_record ( struct dt_develop_t dev)

Finish an undo record for history changes.

Parameters
devDevelop context.

References dt_dev_history_undo_end_record_locked(), dt_pthread_rwlock_rdlock, dt_pthread_rwlock_unlock, and dt_develop_t::history_mutex.

Referenced by dt_dev_undo_end_record().

◆ dt_dev_history_undo_end_record_locked()

◆ dt_dev_history_undo_invalidate_module()

void dt_dev_history_undo_invalidate_module ( struct dt_iop_module_t module)

Invalidate a module pointer inside undo snapshots.

Used when module instances are destroyed or replaced.

Parameters
moduleModule to invalidate.

References _history_invalidate_cb(), darktable, DT_UNDO_HISTORY, dt_undo_iterate_internal(), and darktable_t::undo.

Referenced by dt_dev_module_remove().

◆ dt_dev_history_undo_start_record()

void dt_dev_history_undo_start_record ( struct dt_develop_t dev)

Start an undo record for history changes.

Called by the develop undo framework.

Parameters
devDevelop context.

References dt_dev_history_undo_start_record_locked(), dt_pthread_rwlock_rdlock, dt_pthread_rwlock_unlock, and dt_develop_t::history_mutex.

Referenced by dt_dev_undo_start_record().

◆ dt_dev_history_undo_start_record_locked()

◆ dt_dev_init_default_history()

gboolean dt_dev_init_default_history ( struct dt_develop_t dev,
const int32_t  imgid,
gboolean  apply_auto_presets 
)

Initialize module defaults and insert required default modules.

This does not read the database history. It only loads defaults and optionally applies auto-presets, mirroring the internal init path used by dt_dev_read_history_ext().

Parameters
devDevelop context.
imgidImage id.
apply_auto_presetsWhether to apply auto-presets.
Returns
TRUE if this was the first initialization for the image.

References _dev_auto_apply_presets(), _insert_default_modules(), dt_conf_set_string(), DT_DEBUG_HISTORY, DT_IMAGE_AUTO_PRESETS_APPLIED, dt_iop_reload_defaults(), dt_print(), dt_image_t::flags, dt_develop_t::image_storage, and dt_develop_t::iop.

Referenced by _styles_init_source_dev(), dt_dev_read_history_ext(), and dt_dev_replace_history_on_image().

◆ dt_dev_invalidate_history_module()

void dt_dev_invalidate_history_module ( GList *  list,
struct dt_iop_module_t module 
)

Remove a module pointer from a history list.

Used when modules are deleted or re-instantiated.

Parameters
listHistory list.
moduleModule to invalidate.

Referenced by _history_invalidate_cb().

◆ dt_dev_merge_history_into_image()

int dt_dev_merge_history_into_image ( struct 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 
)

Merge a list of modules into a destination image history via dt_history_merge().

Parameters
dev_srcSource develop context (provides module params).
dest_imgidDestination image id.
mod_listList of module instances to merge.
merge_iop_orderWhether to merge pipeline order (TRUE) or preserve destination (FALSE).
modeMerge strategy for history entries.
paste_instancesWhether to paste module instances.
Returns
0 on success, non-zero on failure.

References dt_dev_cleanup(), dt_dev_init(), dt_dev_pop_history_items_ext(), dt_dev_reload_history_items(), dt_dev_write_history(), dt_history_merge(), and FALSE.

Referenced by _history_copy_and_paste_on_image_merge(), and dt_styles_apply_to_image_merge().

◆ dt_dev_next_multi_priority_for_op()

int dt_dev_next_multi_priority_for_op ( struct dt_develop_t dev,
const char *  op 
)

Return the next available multi_priority for an operation.

Parameters
devDevelop context.
opOperation name.
Returns
Next available instance priority (>= 1).

References dt_develop_t::iop, m, and MAX.

◆ dt_dev_pop_history_items()

◆ dt_dev_pop_history_items_ext()

◆ dt_dev_read_history_ext()

gboolean dt_dev_read_history_ext ( struct dt_develop_t dev,
const int32_t  imgid 
)

◆ dt_dev_reload_history_items()

void dt_dev_reload_history_items ( struct dt_develop_t dev,
const int32_t  imgid 
)

Reload history from DB and rebuild pipelines/GUI state.

Frees existing history, re-reads from DB, applies to modules, and updates GUI and pipelines. Locks history mutex.

Parameters
devDevelop context.
imgidImage id.

References darktable, dt_dev_pop_history_items_ext(), dt_dev_read_history_ext(), dt_pthread_rwlock_unlock, dt_pthread_rwlock_wrlock, darktable_t::gui, dt_develop_t::gui_attached, dt_develop_t::history_mutex, and dt_gui_gtk_t::reset.

Referenced by _history_compress_apply(), _history_copy_and_paste_on_image_merge(), dt_dev_merge_history_into_image(), dt_ioppr_migrate_iop_order(), dt_lightroom_import(), and dt_menu_apply_dev_history_update().

◆ dt_dev_replace_history_on_image()

int dt_dev_replace_history_on_image ( struct 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.

Optionally reloads default modules before writing to DB. This is used by history replace and style replace paths.

Parameters
dev_srcSource develop context.
dest_imgidDestination image id.
reload_defaultsWhether to reload default modules before writing.
msgOptional debug message.
Returns
0 on success, non-zero on failure.

References dt_dev_ensure_image_storage(), dt_dev_init_default_history(), dt_dev_pop_history_items_ext(), dt_dev_write_history(), dt_ioppr_resync_pipeline(), FALSE, and reload_defaults().

Referenced by _history_copy_and_paste_on_image_merge(), and dt_styles_apply_to_image_merge().

◆ dt_dev_set_history_end_ext()

void dt_dev_set_history_end_ext ( struct dt_develop_t dev,
const uint32_t  index 
)

Set the history end index (GUI perspective).

The index is 1-based with 0 representing the raw input image. The value is sanitized against the actual history length.

Parameters
devDevelop context.
indexNew history end index.

References dt_dev_history_compute_hash(), dt_dev_set_history_hash(), dt_develop_t::history, and dt_develop_t::history_end.

Referenced by _dt_dev_history_compress_internal(), _history_apply_history_end(), _hm_restore_dest_from_backup(), _pop_undo(), _styles_rebuild_history_from_items(), dt_dev_add_history_item_ext(), dt_dev_module_remove(), dt_dev_read_history_ext(), and dt_history_merge().

◆ dt_dev_write_history()

◆ dt_dev_write_history_ext()

◆ dt_history_merge_module_into_history()

int dt_history_merge_module_into_history ( struct dt_develop_t dev_dest,
struct dt_develop_t dev_src,
struct dt_iop_module_t mod_src 
)

Merge a single module instance into a destination history.

Creates or reuses a destination module instance and copies its parameters. This does not resync the pipeline or pop history; callers should batch multiple merges and resync once.

Parameters
dev_destDestination develop context.
dev_srcSource develop context (may be NULL to skip mask copy).
mod_srcSource module instance.
Returns
1 on success, 0 on failure.

References DT_DEBUG_HISTORY, dt_dev_add_history_item_ext(), dt_dev_copy_module_contents(), dt_print(), FALSE, IOP_FLAGS_ONE_INSTANCE, and dt_iop_module_t::multi_name.

Referenced by dt_styles_apply_style_item().

◆ dt_history_module_skip_copy()

gboolean dt_history_module_skip_copy ( const int  flags)

Determine whether a module should be skipped during history copy.

Evaluates module flags such as deprecated/unsafe/hidden.

Parameters
flagsModule flags.
Returns
TRUE if module should be skipped, FALSE otherwise.

References flags, IOP_FLAGS_DEPRECATED, IOP_FLAGS_HIDDEN, and IOP_FLAGS_UNSAFE_COPY.

Referenced by _get_user_mod_list(), and dt_gui_hist_dialog_new().