Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
history_repository.h
Go to the documentation of this file.
1/*
2 This file is part of darktable,
3 Copyright (C) 2009-2011 johannes hanika.
4 Copyright (C) 2010 Henrik Andersson.
5 Copyright (C) 2011, 2014-2016 Tobias Ellinghaus.
6 Copyright (C) 2012, 2019-2022 Pascal Obry.
7 Copyright (C) 2018 Edgardo Hoszowski.
8 Copyright (C) 2025-2026 Aurélien PIERRE.
9
10 darktable is free software: you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation, either version 3 of the License, or
13 (at your option) any later version.
14
15 darktable is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with darktable. If not, see <http://www.gnu.org/licenses/>.
22*/
23
24#ifndef DT_DATABASE_HISTORY_REPOSITORY_H
25#define DT_DATABASE_HISTORY_REPOSITORY_H
26
27#include <glib.h>
28#include <inttypes.h>
29
30#include "common/image.h"
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
54/* ---------------------------------------------------------------------------------------------
55 * history_end (main.images.history_end)
56 * ------------------------------------------------------------------------------------------ */
57
59int32_t dt_history_repository_get_end(const int32_t imgid);
60
62gboolean dt_history_repository_set_end(const int32_t imgid, const int32_t history_end);
63
64/* ---------------------------------------------------------------------------------------------
65 * writing history items
66 * ------------------------------------------------------------------------------------------ */
67
69int32_t dt_history_repository_get_next_num(const int32_t imgid);
70
72gboolean dt_history_repository_shift_nums(const int32_t imgid, const int delta);
73
75gboolean dt_history_repository_write_item(const int32_t imgid, const int num, const char *operation,
76 const void *op_params, const int op_params_size,
77 const int module_version, const gboolean enabled,
78 const void *blendop_params, const int blendop_params_size,
79 const int blendop_version, const int multi_priority,
80 const char *multi_name);
81
82/* ---------------------------------------------------------------------------------------------
83 * deleting
84 * ------------------------------------------------------------------------------------------ */
85
86gboolean dt_history_repository_delete_history(const int32_t imgid);
87gboolean dt_history_repository_delete_masks_history(const int32_t imgid);
88
90gboolean dt_history_repository_delete_dev_history(const int32_t imgid);
91
94gboolean dt_history_repository_delete_all_for_image(const int32_t imgid);
95
96/* ---------------------------------------------------------------------------------------------
97 * reading history rows
98 * ------------------------------------------------------------------------------------------ */
99
102typedef void (*dt_history_repository_row_cb)(void *user_data,
103 const int32_t imgid,
104 const int num,
105 const int module_version,
106 const char *operation,
107 const void *op_params,
108 const int op_params_len,
109 const gboolean enabled,
110 const void *blendop_params,
111 const int blendop_params_len,
112 const int blendop_version,
113 const int multi_priority,
114 const char *multi_name,
115 const char *preset_name);
116
119 void *user_data);
120
124void dt_history_repository_foreach_auto_preset_row(const int32_t imgid, const struct dt_image_t *image,
125 const char *workflow_preset, const int iformat,
126 const int excluded, dt_history_repository_row_cb cb,
127 void *user_data);
128
131 const struct dt_image_t *image,
132 const int iformat, const int excluded,
133 void **params, int32_t *params_len);
134
137int dt_history_repository_count_items(const int32_t imgid);
138
142gboolean dt_history_repository_get_last_enabled_params(const int32_t imgid, const char *operation,
143 void **params, int32_t *params_len);
144
146gboolean dt_history_repository_module_exists(const int32_t imgid, const char *operation);
147
148/* ---------------------------------------------------------------------------------------------
149 * listing history items for display
150 * ------------------------------------------------------------------------------------------ */
151
154typedef void (*dt_history_repository_item_cb)(void *user_data, const int num, const char *operation,
155 const gboolean enabled, const char *multi_name);
156
159void dt_history_repository_foreach_last_item(const int32_t imgid, const gboolean enabled,
160 dt_history_repository_item_cb cb, void *user_data);
161
164 void *user_data);
165
166/* ---------------------------------------------------------------------------------------------
167 * main.masks_history
168 *
169 * The drawn shapes a development refers to, one row per (history step, form). Persisted beside
170 * main.history and read back with it, so it lives in the same repository.
171 * ------------------------------------------------------------------------------------------ */
172
179gboolean dt_history_repository_write_mask_item(const int32_t imgid, const int num, const int formid,
180 const int form, const char *name, const int version,
181 const void *points, const int points_len,
182 const int points_count, const void *source,
183 const int source_len);
184
186int dt_history_repository_count_mask_items(const int32_t imgid);
187
189typedef void (*dt_history_repository_mask_cb)(void *user_data, const int num, const int formid,
190 const int form, const char *name, const int version,
191 const void *points, const int points_len,
192 const int points_count, const void *source,
193 const int source_len);
194
196void dt_history_repository_foreach_mask_item(const int32_t imgid,
197 dt_history_repository_mask_cb cb, void *user_data);
198
209int dt_history_repository_find_version_for_params(const char *operation, const void *op_params,
210 const int op_params_size);
211
213typedef void (*dt_history_repository_active_module_cb)(void *user_data, const int num,
214 const char *operation, const char *multi_name);
215
222void dt_history_repository_foreach_active_module(const int32_t imgid,
224 void *user_data);
225
226/* ------------------------------------------------------------------------------------------
227 * main.module_order
228 *
229 * Which order the modules run in for one image: a version from ::dt_iop_order_t, plus -- when
230 * that version is CUSTOM, or when the image carries multiple instances of a module -- the
231 * serialized list itself. One row per image, or no row at all, which is a meaningful state:
232 * it means nobody has chosen, and the caller picks a built-in default from the image's kind.
233 * ------------------------------------------------------------------------------------------ */
234
239gboolean dt_history_repository_get_module_order_version(const int32_t imgid, int *version);
240
245gboolean dt_history_repository_has_module_order(const int32_t imgid);
246
248gboolean dt_history_repository_has_custom_module_order(const int32_t imgid);
249
256
259
262
269gboolean dt_history_repository_set_module_order(const int32_t imgid, const int version,
270 const char *iop_list);
271
274
275#ifdef __cplusplus
276}
277#endif
278
279#endif // DT_DATABASE_HISTORY_REPOSITORY_H
280
281// clang-format off
282// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
283// vim: shiftwidth=2 expandtab tabstop=2 cindent
284// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
285// clang-format on
typedef void((*dt_cache_allocate_t)(void *userdata, dt_cache_entry_t *entry))
static const int row
const float delta
gboolean dt_history_repository_get_module_order(const int32_t imgid, dt_module_order_row_t *row)
Read imgid's row. FALSE when there is none, and row is then left zeroed.
void dt_history_repository_foreach_last_item(const int32_t imgid, const gboolean enabled, dt_history_repository_item_cb cb, void *user_data)
void dt_history_repository_foreach_mask_item(const int32_t imgid, dt_history_repository_mask_cb cb, void *user_data)
gboolean dt_history_repository_get_last_enabled_params(const int32_t imgid, const char *operation, void **params, int32_t *params_len)
gboolean dt_history_repository_delete_dev_history(const int32_t imgid)
gboolean dt_history_repository_shift_nums(const int32_t imgid, const int delta)
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)
void dt_history_repository_foreach_auto_preset_row(const int32_t imgid, const struct dt_image_t *image, const char *workflow_preset, const int iformat, const int excluded, dt_history_repository_row_cb cb, void *user_data)
void(* dt_history_repository_active_module_cb)(void *user_data, const int num, const char *operation, const char *multi_name)
gboolean dt_history_repository_write_mask_item(const int32_t imgid, const int num, const int formid, const int form, const char *name, const int version, const void *points, const int points_len, const int points_count, const void *source, const int source_len)
int dt_history_repository_count_mask_items(const int32_t imgid)
void dt_history_repository_cleanup(void)
gboolean dt_history_repository_module_exists(const int32_t imgid, const char *operation)
gboolean dt_history_repository_delete_masks_history(const int32_t imgid)
gboolean dt_history_repository_delete_all_for_image(const int32_t imgid)
void dt_module_order_row_cleanup(dt_module_order_row_t *row)
Release what dt_history_repository_get_module_order() allocated.
gboolean dt_history_repository_set_module_order(const int32_t imgid, const int version, const char *iop_list)
Store imgid's order: version, and iop_list serialized or NULL.
void dt_history_repository_foreach_item(const int32_t imgid, dt_history_repository_item_cb cb, void *user_data)
int dt_history_repository_find_version_for_params(const char *operation, const void *op_params, const int op_params_size)
The module version some image's history recorded for this exact parameter blob.
gboolean dt_history_repository_delete_history(const int32_t imgid)
gboolean dt_history_repository_get_autoapply_ioporder_params(const int32_t imgid, const struct dt_image_t *image, const int iformat, const int excluded, void **params, int32_t *params_len)
int dt_history_repository_count_items(const int32_t imgid)
gboolean dt_history_repository_set_end(const int32_t imgid, const int32_t history_end)
gboolean dt_history_repository_has_custom_module_order(const int32_t imgid)
Whether imgid's row stores a serialized list, i.e. iop_list IS NOT NULL.
gboolean dt_history_repository_get_module_order_version(const int32_t imgid, int *version)
imgid's stored order version.
void(* dt_history_repository_item_cb)(void *user_data, const int num, const char *operation, const gboolean enabled, const char *multi_name)
gboolean dt_history_repository_has_module_order(const int32_t imgid)
Whether imgid has a main.module_order row at all, whatever it says.
void(* dt_history_repository_mask_cb)(void *user_data, const int num, const int formid, const int form, const char *name, const int version, const void *points, const int points_len, const int points_count, const void *source, const int source_len)
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_row_cb)(void *user_data, const int32_t imgid, const int num, const int module_version, const char *operation, const void *op_params, const int op_params_len, const gboolean enabled, const void *blendop_params, const int blendop_params_len, const int blendop_version, const int multi_priority, const char *multi_name, const char *preset_name)
void dt_history_repository_foreach_active_module(const int32_t imgid, dt_history_repository_active_module_cb cb, void *user_data)
Every module an image has enabled, once each, in the order they run.
void dt_history_repository_foreach_row(const int32_t imgid, dt_history_repository_row_cb cb, void *user_data)
const char * name
Definition pdf.h:90
One main.module_order row.