Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
dev_history.h
Go to the documentation of this file.
1#include "common/history.h"
2
3#include <glib.h>
4
5#pragma once
6
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20#ifndef DT_IOP_PARAMS_T
21#define DT_IOP_PARAMS_T
22typedef void dt_iop_params_t;
23#endif
24
25struct dt_iop_module_t;
27struct dt_develop_t;
28
30{
31 struct dt_iop_module_t *module; // pointer to image operation module
32 gboolean enabled; // switched respective module on/off
33 dt_iop_params_t *params; // parameters for this operation
35 char op_name[32];
38 char multi_name[128];
39 GList *forms; // snapshot of dt_develop_t->forms
40 int num; // num of history on database
41
42 uint64_t hash; // module params hash.
44
45
48
50void dt_dev_free_history_item(gpointer data);
51
64gboolean dt_dev_add_history_item_ext(struct dt_develop_t *dev, struct dt_iop_module_t *module, gboolean enable, gboolean force_new_item,
65 gboolean no_image, gboolean include_masks);
66
67// Locks dev->history_mutex, calls `dt_dev_add_history_item_ext()`, invalidates darkroom pipelines,
68// triggers pipe recomputation and queue an history auto-save for the next 15 seconds.
69void dt_dev_add_history_item_real(struct dt_develop_t *dev, struct dt_iop_module_t *module, gboolean enable);
70
71// Debug helper to follow calls to `dt_dev_add_history_item_real()`, but mostly to follow useless pipe recomputations.
72#define dt_dev_add_history_item(dev, module, enable) DT_DEBUG_TRACE_WRAPPER(DT_DEBUG_DEV, dt_dev_add_history_item_real, (dev), (module), (enable))
73
74
75// Locks darktable.database_threadsafe in write mode,
76// write dev->history GList into DB and XMP
77void dt_dev_write_history_ext(struct dt_develop_t *dev, const int32_t imgid);
78
79// Locks dev->history_mutex and calls dt_dev_write_history_ext()
80void dt_dev_write_history(struct dt_develop_t *dev);
81
82// Locks darktable.database_threadsafe in read mode,
83// get history (module params) and masks from DB,
84// apply default modules, auto-presets and mandatory modules,
85// then populate dev->history GList.
86void dt_dev_read_history_ext(struct dt_develop_t *dev, const int32_t imgid, gboolean no_image);;
87
88// Read dev->history state, up to dev->history_end,
89// and write it into the params/blendops of modules from dev->iop.
90// dev->history_end should be set before, see `dt_dev_set_history_end()`.
91// This doesn't update GUI. See `dt_dev_pop_history_items()`
93
94// Locks dev->history_mutex and calls `dt_dev_pop_history_items_ext()`
95// Then update module GUI
97
98
99// Free exisiting history, re-read it from database, update GUI and rebuild darkroom pipeline nodes.
100// Locks dev->history_mutex
102
103
104// Removes the reference to `*module` from history entries
105// FIXME: why is that needed ?
106void dt_dev_invalidate_history_module(GList *list, struct dt_iop_module_t *module);
107
115
125
126
127// We allow pipelines to run partial histories, up to a certain index
128// stored privately in dev->history_end. Use these getter/setters
129// that will check validity, instead of directly reading/writing the private data.
130
131// Get the index of the last active history element from a GUI perspective.
132// It means that dev->history_end is shifted by a +1 offset, so index 0 is the raw image,
133// therefore outside of the actual dev->history list, then dev->history_end = 1 is
134// actually the first element of history, and dev->history_end = length(dev->history) is the last.
135// Note: the value is sanitized with the actual history size.
136// It needs to run after dev->history is fully populated
137int32_t dt_dev_get_history_end(struct dt_develop_t *dev);
138
139// Set the index of the last active history element from a GUI perspective.
140// It means that dev->history_end is shifted by a +1 offset, so index 0 is the raw image,
141// therefore outside of the actual dev->history list, then dev->history_end = 1 is
142// actually the first element of history, and dev->history_end = length(dev->history) is the last.
143// Note: the value is sanitized with the actual history size.
144// It needs to run after dev->history is fully populated
145void dt_dev_set_history_end(struct dt_develop_t *dev, const uint32_t index);
146
147gboolean dt_history_module_skip_copy(const int flags);
148
150int 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, GList **_modules_used);
151
152
154int dt_history_copy_and_paste_on_image(int32_t imgid, int32_t dest_imgid, GList *ops, gboolean copy_iop_order, const gboolean copy_full);
155
156
164void dt_dev_history_compress(struct dt_develop_t *dev);
165
166#ifdef __cplusplus
167}
168#endif
void dt_dev_history_free_history(struct dt_develop_t *dev)
Definition dev_history.c:769
gboolean dt_dev_add_history_item_ext(struct dt_develop_t *dev, struct dt_iop_module_t *module, gboolean enable, gboolean force_new_item, gboolean no_image, gboolean include_masks)
Append a new history item on dev->history, at dev->history_end position. If history items exist after...
Definition dev_history.c:506
int dt_history_copy_and_paste_on_image(int32_t imgid, int32_t dest_imgid, GList *ops, gboolean copy_iop_order, const gboolean copy_full)
Definition dev_history.c:374
void dt_dev_pop_history_items(struct dt_develop_t *dev)
Definition dev_history.c:861
void dt_dev_free_history_item(gpointer data)
Definition dev_history.c:754
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, GList **_modules_used)
Definition dev_history.c:90
int dt_dev_history_auto_save(struct dt_develop_t *dev)
Write history to DB and XMP only if the integrety hash has changed since first reading history,...
Definition dev_history.c:646
void dt_dev_pop_history_items_ext(struct dt_develop_t *dev)
Definition dev_history.c:823
void dt_dev_write_history_ext(struct dt_develop_t *dev, const int32_t imgid)
Definition dev_history.c:1006
void dt_dev_add_history_item_real(struct dt_develop_t *dev, struct dt_iop_module_t *module, gboolean enable)
Definition dev_history.c:689
void dt_dev_read_history_ext(struct dt_develop_t *dev, const int32_t imgid, gboolean no_image)
Definition dev_history.c:1496
gboolean dt_history_module_skip_copy(const int flags)
Definition dev_history.c:1639
void dt_iop_params_t
Definition dev_history.h:22
void dt_dev_invalidate_history_module(GList *list, struct dt_iop_module_t *module)
Definition dev_history.c:1627
int32_t dt_dev_get_history_end(struct dt_develop_t *dev)
Definition develop.c:1439
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....
Definition dev_history.c:1649
void dt_dev_write_history(struct dt_develop_t *dev)
Definition dev_history.c:1052
void dt_dev_set_history_end(struct dt_develop_t *dev, const uint32_t index)
Definition develop.c:1445
void dt_dev_reload_history_items(struct dt_develop_t *dev)
Definition dev_history.c:775
uint64_t dt_dev_history_get_hash(struct dt_develop_t *dev)
Get the integrity checksum of the whole history stack.
Definition dev_history.c:632
dt_mipmap_buffer_dsc_flags flags
Definition mipmap_cache.c:4
unsigned __int64 uint64_t
Definition strptime.c:71
Definition dev_history.h:30
int num
Definition dev_history.h:40
uint64_t hash
Definition dev_history.h:42
dt_iop_params_t * params
Definition dev_history.h:33
char multi_name[128]
Definition dev_history.h:38
struct dt_develop_blend_params_t * blend_params
Definition dev_history.h:34
struct dt_iop_module_t *gboolean enabled
Definition dev_history.h:31
int multi_priority
Definition dev_history.h:37
int iop_order
Definition dev_history.h:36
GList * forms
Definition dev_history.h:39
char op_name[32]
Definition dev_history.h:35
Definition blend.h:180
Definition develop.h:143
Definition imageop.h:182