50 const char *
v = (
const char *)sqlite3_column_text(stmt, col);
51 return g_strdup(
v ?
v :
"");
58 const char *
v = (
const char *)sqlite3_column_text(stmt, col);
59 return v ? g_strdup(
v) : NULL;
64 const int n = sqlite3_column_bytes(stmt, col);
65 const void *src = sqlite3_column_blob(stmt, col);
69 void *
copy = g_malloc(
n);
79 sqlite3_stmt *stmt = NULL;
82 "SELECT op_params, blendop_params, name, description, operation,"
83 " autoapply, model, maker, lens, iso_min, iso_max, exposure_min,"
84 " exposure_max, aperture_min, aperture_max, focal_length_min,"
85 " focal_length_max, op_version, blendop_version, enabled,"
86 " multi_priority, multi_name, filter, def, format "
94 if(sqlite3_step(stmt) == SQLITE_ROW)
100 p->blendop_params =
_column_blob(stmt, 1, &
p->blendop_params_size);
104 p->autoapply = sqlite3_column_int(stmt, 5);
108 p->iso_min = sqlite3_column_double(stmt, 9);
109 p->iso_max = sqlite3_column_double(stmt, 10);
110 p->exposure_min = sqlite3_column_double(stmt, 11);
111 p->exposure_max = sqlite3_column_double(stmt, 12);
112 p->aperture_min = sqlite3_column_double(stmt, 13);
113 p->aperture_max = sqlite3_column_double(stmt, 14);
115 p->focal_length_min = sqlite3_column_double(stmt, 15);
116 p->focal_length_max = sqlite3_column_double(stmt, 16);
117 p->op_version = sqlite3_column_int(stmt, 17);
118 p->blendop_version = sqlite3_column_int(stmt, 18);
119 p->enabled = sqlite3_column_int(stmt, 19);
120 p->multi_priority = sqlite3_column_int(stmt, 20);
122 p->filter = sqlite3_column_double(stmt, 22);
123 p->def = sqlite3_column_double(stmt, 23);
124 p->format = sqlite3_column_double(stmt, 24);
127 sqlite3_finalize(stmt);
144 sqlite3_stmt *stmt = NULL;
149 " (name, description, operation, autoapply,"
150 " model, maker, lens, iso_min, iso_max, exposure_min, exposure_max,"
151 " aperture_min, aperture_max, focal_length_min, focal_length_max,"
152 " op_params, op_version, blendop_params, blendop_version, enabled,"
153 " multi_priority, multi_name, filter, def, format, writeprotect)"
154 " VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, "
155 " ?15, ?16, ?17, ?18, ?19, ?20, ?21, ?22, ?23, ?24, ?25, 0)",
185 const gboolean ok = (sqlite3_step(stmt) == SQLITE_DONE);
186 sqlite3_finalize(stmt);
203#define _PRESET_COLUMNS \
204 "(name, description, operation, op_version, op_params, blendop_params, " \
205 " blendop_version, enabled, model, maker, lens, iso_min, iso_max, exposure_min, " \
206 " exposure_max, aperture_min, aperture_max, focal_length_min, focal_length_max, " \
207 " writeprotect, autoapply, filter, def, format)"
223 const gboolean with_description,
224 const gboolean shipped_first)
226 sqlite3_stmt *stmt = NULL;
232 query = g_strdup_printf(
"SELECT name, op_params, writeprotect, description"
234 " WHERE operation=?1 AND op_version=?2"
235 " ORDER BY writeprotect %s, LOWER(name), rowid",
236 shipped_first ?
"DESC" :
"ASC");
244 "SELECT name, op_params, writeprotect FROM data.presets"
245 " WHERE operation=?1 AND op_version=?2",
258 GList *presets = NULL;
259 while(sqlite3_step(stmt) == SQLITE_ROW)
266 p->writeprotect = sqlite3_column_int(stmt, 2) != 0;
267 p->description = with_description ?
_column_text(stmt, 3) : g_strdup(
"");
268 p->op_version = op_version;
270 presets = g_list_prepend(presets,
p);
274 sqlite3_finalize(stmt);
277 return g_list_reverse(presets);
282 sqlite3_stmt *stmt = NULL;
285 "SELECT rowid, op_version, op_params, name FROM data.presets"
286 " WHERE operation=?1"
287 " ORDER BY writeprotect DESC, LOWER(name), rowid",
292 GList *presets = NULL;
293 while(sqlite3_step(stmt) == SQLITE_ROW)
298 p->rowid = sqlite3_column_int(stmt, 0);
299 p->op_version = sqlite3_column_int(stmt, 1);
302 p->description = g_strdup(
"");
303 presets = g_list_prepend(presets,
p);
306 sqlite3_finalize(stmt);
310 return g_list_reverse(presets);
315 sqlite3_stmt *stmt = NULL;
318 "SELECT rowid, op_version, op_params, name FROM data.presets"
319 " WHERE operation=?1 AND op_version=?2"
320 " ORDER BY writeprotect DESC, LOWER(name), rowid",
326 GList *presets = NULL;
327 while(sqlite3_step(stmt) == SQLITE_ROW)
332 p->rowid = sqlite3_column_int(stmt, 0);
333 p->op_version = sqlite3_column_int(stmt, 1);
336 p->description = g_strdup(
"");
337 presets = g_list_prepend(presets,
p);
340 sqlite3_finalize(stmt);
344 return g_list_reverse(presets);
350 sqlite3_stmt *stmt = NULL;
353 "SELECT name FROM data.presets"
354 " WHERE operation = ?1 AND op_version = ?2 AND name = ?3",
361 const gboolean found = (sqlite3_step(stmt) == SQLITE_ROW);
362 sqlite3_finalize(stmt);
368 sqlite3_stmt *stmt = NULL;
371 "SELECT rowid FROM data.presets"
372 " WHERE name = ?1 AND operation = ?2 AND op_version = ?3",
380 if(sqlite3_step(stmt) == SQLITE_ROW) rowid = sqlite3_column_int(stmt, 0);
381 sqlite3_finalize(stmt);
388 sqlite3_stmt *stmt = NULL;
391 "SELECT op_params, writeprotect FROM data.presets"
392 " WHERE operation = ?1 AND op_version = ?2 AND name = ?3",
400 if(sqlite3_step(stmt) == SQLITE_ROW)
406 p->writeprotect = sqlite3_column_int(stmt, 1) != 0;
407 p->name = g_strdup(
name);
408 p->description = g_strdup(
"");
409 p->op_version = op_version;
413 sqlite3_finalize(stmt);
418 const int op_version,
const void *
params,
421 sqlite3_stmt *stmt = NULL;
425 " VALUES (?1, '', ?2, ?3, ?4, NULL, 0, 1, '%', '%', '%', 0, "
426 " 340282346638528859812000000000000000000, 0, 100000000, 0, 100000000, "
427 " 0, 1000, 0, 0, 0, 0, 0)",
435 sqlite3_finalize(stmt);
439 const int op_version,
const void *
params,
442 sqlite3_stmt *stmt = NULL;
446 " VALUES (?1, '', ?2, ?3, ?4, NULL, 0, 1, '%', '%', '%', 0, "
447 " 340282346638528859812000000000000000000, 0, 10000000, 0, 100000000, "
448 " 0, 1000, ?5, 0, 0, 0, 0)",
459 sqlite3_finalize(stmt);
463 const int op_version,
const void *
params,
466 sqlite3_stmt *stmt = NULL;
469 "UPDATE data.presets SET op_version=?2, op_params=?3"
470 " WHERE name=?4 AND operation=?1",
478 sqlite3_finalize(stmt);
482 const int op_version)
484 sqlite3_stmt *stmt = NULL;
486 "UPDATE data.presets SET op_version=?1 WHERE operation=?2 AND name=?3",
494 sqlite3_finalize(stmt);
498 const int blendop_version,
const void *blend_params,
499 const int blend_params_size)
501 sqlite3_stmt *stmt = NULL;
504 "SET blendop_version=?1, blendop_params=?2 "
505 "WHERE operation=?3 AND name=?4",
515 sqlite3_finalize(stmt);
520 sqlite3_stmt *stmt = NULL;
524 "SELECT name, op_version, op_params, blendop_version, blendop_params FROM data.presets WHERE operation = ?1",
531 GList *presets = NULL;
532 while(sqlite3_step(stmt) == SQLITE_ROW)
537 p->op_version = sqlite3_column_int(stmt, 1);
539 p->blendop_version = sqlite3_column_int(stmt, 3);
540 p->blendop_params =
_column_blob(stmt, 4, &
p->blendop_params_size);
541 p->description = g_strdup(
"");
542 presets = g_list_prepend(presets,
p);
544 sqlite3_finalize(stmt);
546 return g_list_reverse(presets);
550 const char *old_name,
const char *new_name,
554 sqlite3_stmt *stmt = NULL;
557 "UPDATE data.presets SET name = ?1, description = ?2, op_params = ?3"
558 " WHERE operation = ?4 AND op_version = ?5 AND name = ?6",
568 sqlite3_finalize(stmt);
572 const char *
name,
const char *new_name)
574 sqlite3_stmt *stmt = NULL;
578 " SELECT ?1, description, operation, op_version, op_params, blendop_params,"
579 " blendop_version, enabled, model, maker, lens, iso_min, iso_max,"
580 " exposure_min, exposure_max, aperture_min, aperture_max,"
581 " focal_length_min, focal_length_max, 0, autoapply, filter, def, format"
583 " WHERE operation = ?2 AND op_version = ?3 AND name = ?4",
591 sqlite3_finalize(stmt);
597 sqlite3_stmt *stmt = NULL;
600 "DELETE FROM data.presets"
601 " WHERE name=?1 AND operation=?2 AND op_version=?3 AND writeprotect=0",
610 sqlite3_finalize(stmt);
615 sqlite3_stmt *stmt = NULL;
618 "DELETE FROM data.presets WHERE operation=?1",
625 sqlite3_finalize(stmt);
631 sqlite3_stmt *stmt = NULL;
634 "UPDATE data.presets SET op_version=?1, op_params=?2 WHERE rowid=?3",
641 sqlite3_finalize(stmt);
646 sqlite3_stmt *stmt = NULL;
649 "DELETE FROM data.presets WHERE rowid=?1", -1, &stmt, NULL);
653 sqlite3_finalize(stmt);
667 " SET iso_min=?1, iso_max=?2"
668 " WHERE operation=?3 AND op_version=?4 AND name=?5",
670 " SET aperture_min=?1, aperture_max=?2"
671 " WHERE operation=?3 AND op_version=?4 AND name=?5",
673 " SET exposure_min=?1, exposure_max=?2"
674 " WHERE operation=?3 AND op_version=?4 AND name=?5",
676 " SET focal_length_min=?1, focal_length_max=?2"
677 " WHERE operation=?3 AND op_version=?4 AND name=?5",
683 " WHERE operation=?2 AND op_version=?3 AND name=?4",
686 " WHERE operation=?2 AND op_version=?3 AND name=?4",
689 " WHERE operation=?2 AND op_version=?3 AND name=?4",
694 const double min,
const double max)
702 sqlite3_stmt *stmt = NULL;
713 sqlite3_finalize(stmt);
723 sqlite3_stmt *stmt = NULL;
733 sqlite3_finalize(stmt);
737 const char *
maker,
const char *
model,
const char *lens)
739 sqlite3_stmt *stmt = NULL;
742 "UPDATE data.presets"
743 " SET maker='%' || ?1 || '%', model=?2, lens=?3"
744 " WHERE operation=?4 AND op_version=?5 AND name=?6",
758 sqlite3_finalize(stmt);
769#define _PRESET_MATCH_PREDICATE \
770 "((?2 LIKE model AND ?3 LIKE maker) OR (?4 LIKE model AND ?5 LIKE maker))" \
771 " AND ?6 LIKE lens" \
772 " AND ?7 BETWEEN iso_min AND iso_max" \
773 " AND ?8 BETWEEN exposure_min AND exposure_max" \
774 " AND ?9 BETWEEN aperture_min AND aperture_max" \
775 " AND ?10 BETWEEN focal_length_min AND focal_length_max" \
776 " AND (format = 0 OR (format&?11 != 0 AND ~format&?12 != 0))"
819 p->writeprotect = sqlite3_column_int(stmt, 2) != 0;
824 p->blendop_params =
_column_blob(stmt, 4, &
p->blendop_params_size);
825 p->op_version = sqlite3_column_int(stmt, 5);
826 p->enabled = sqlite3_column_int(stmt, 6);
830 p->description = g_strdup(
"");
831 p->blendop_params =
_column_blob(stmt, 3, &
p->blendop_params_size);
832 p->enabled = sqlite3_column_int(stmt, 4);
839 const void *blend_params,
const int blend_params_size,
840 const int blendop_version,
const int enabled)
842 sqlite3_stmt *stmt = NULL;
846 " INTO data.presets (name, description, operation, op_version, op_params, enabled,"
847 " blendop_params, blendop_version, multi_priority, multi_name,"
848 " model, maker, lens, iso_min, iso_max, exposure_min, exposure_max,"
849 " aperture_min, aperture_max, focal_length_min, focal_length_max,"
850 " writeprotect, autoapply, filter, def, format)"
851 " VALUES (?1, '', ?2, ?3, ?4, ?5, ?6, ?7, 0, '', '%', '%', '%', 0,"
852 " 340282346638528859812000000000000000000, 0, 10000000, 0, 100000000, 0,"
853 " 1000, 1, 0, 0, 0, 0)",
866 sqlite3_finalize(stmt);
871 sqlite3_stmt *stmt = NULL;
877 "SELECT name, op_params, writeprotect, blendop_params, enabled"
879 " WHERE operation=?1 AND op_version=?2"
880 " ORDER BY writeprotect ASC, LOWER(name), rowid",
886 GList *presets = NULL;
887 while(sqlite3_step(stmt) == SQLITE_ROW)
892 p->op_version = op_version;
893 presets = g_list_prepend(presets,
p);
896 sqlite3_finalize(stmt);
897 return g_list_reverse(presets);
901 const gboolean shipped_first)
903 sqlite3_stmt *stmt = NULL;
909 query = g_strdup_printf(
910 "SELECT name, op_params, writeprotect, description, blendop_params, "
911 " op_version, enabled"
913 " WHERE operation=?1"
917 " ORDER BY writeprotect %s, LOWER(name), rowid",
918 shipped_first ?
"DESC" :
"ASC");
925 query = g_strdup_printf(
926 "SELECT name, op_params, writeprotect, "
927 " description, blendop_params, op_version, enabled"
929 " WHERE operation=?1"
930 " ORDER BY writeprotect %s, LOWER(name), rowid",
931 shipped_first ?
"DESC" :
"ASC");
940 GList *presets = NULL;
941 while(sqlite3_step(stmt) == SQLITE_ROW)
944 if(
p) presets = g_list_prepend(presets,
p);
946 sqlite3_finalize(stmt);
947 return g_list_reverse(presets);
953 sqlite3_stmt *stmt = NULL;
956 "SELECT op_params, enabled, blendop_params, blendop_version, writeprotect"
958 " WHERE operation = ?1 AND op_version = ?2 AND name = ?3",
966 if(sqlite3_step(stmt) == SQLITE_ROW)
972 p->name = g_strdup(
name);
973 p->description = g_strdup(
"");
974 p->op_version = op_version;
976 p->enabled = sqlite3_column_int(stmt, 1);
977 p->blendop_params =
_column_blob(stmt, 2, &
p->blendop_params_size);
978 p->blendop_version = sqlite3_column_int(stmt, 3);
979 p->writeprotect = sqlite3_column_int(stmt, 4) != 0;
982 sqlite3_finalize(stmt);
991 sqlite3_stmt *stmt = NULL;
999 " WHERE operation = ?1"
1000 " AND ((autoapply=1"
1002 " AND operation NOT IN"
1003 " ('ioporder', 'metadata', 'export', 'tagging', 'collect', 'basecurve'))"
1004 " OR (name = ?13)) AND op_version = ?14",
1012 GList *
names = NULL;
1013 while(sqlite3_step(stmt) == SQLITE_ROW)
1014 names = g_list_prepend(
names, g_strdup((
const char *)sqlite3_column_text(stmt, 0)));
1015 sqlite3_finalize(stmt);
1016 return g_list_reverse(
names);
1040 sqlite3_stmt *stmt = NULL;
1043 "SELECT rowid, description, model, maker, lens, iso_min, iso_max, "
1044 " exposure_min, exposure_max, aperture_min, aperture_max, focal_length_min, "
1045 " focal_length_max, autoapply, filter, format"
1046 " FROM data.presets"
1047 " WHERE name = ?1 AND operation = ?2 AND op_version = ?3",
1054 gboolean found =
FALSE;
1055 if(sqlite3_step(stmt) == SQLITE_ROW)
1058 *rowid = sqlite3_column_int(stmt, 0);
1059 c->name = g_strdup(
name);
1064 c->iso_min = sqlite3_column_double(stmt, 5);
1065 c->iso_max = sqlite3_column_double(stmt, 6);
1066 c->exposure_min = sqlite3_column_double(stmt, 7);
1067 c->exposure_max = sqlite3_column_double(stmt, 8);
1068 c->aperture_min = sqlite3_column_double(stmt, 9);
1069 c->aperture_max = sqlite3_column_double(stmt, 10);
1070 c->focal_length_min = sqlite3_column_double(stmt, 11);
1071 c->focal_length_max = sqlite3_column_double(stmt, 12);
1072 c->autoapply = sqlite3_column_int(stmt, 13);
1073 c->filter = sqlite3_column_int(stmt, 14);
1074 c->format = sqlite3_column_int(stmt, 15);
1076 sqlite3_finalize(stmt);
1106 sqlite3_stmt *stmt = NULL;
1112 "UPDATE data.presets "
1114 " name=?1, description=?2,"
1115 " model=?3, maker=?4, lens=?5, iso_min=?6, iso_max=?7, exposure_min=?8,"
1116 " exposure_max=?9, aperture_min=?10,"
1117 " aperture_max=?11, focal_length_min=?12, focal_length_max=?13, autoapply=?14,"
1118 " filter=?15, format=?16 "
1125 sqlite3_finalize(stmt);
1129 const char *operation,
const int op_version,
1132 const void *blend_params,
const int blend_params_size,
1133 const int blendop_version)
1137 sqlite3_stmt *stmt = NULL;
1140 "INSERT INTO data.presets"
1141 " (name, description, "
1142 " model, maker, lens, iso_min, iso_max, exposure_min, exposure_max, aperture_min,"
1143 " aperture_max, focal_length_min, focal_length_max, autoapply,"
1144 " filter, format, def, writeprotect, operation, op_version, op_params, enabled,"
1145 " blendop_params, blendop_version, multi_priority, multi_name) "
1147 " (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15, ?16, 0, 0, ?17,"
1148 " ?18, ?19, ?20, ?21, ?22, 0, '')",
1159 sqlite3_finalize(stmt);
1168 sqlite3_stmt *stmt = NULL;
1171 "SELECT operation, op_version FROM data.presets WHERE rowid = ?1",
1176 gboolean found =
FALSE;
1177 if(sqlite3_step(stmt) == SQLITE_ROW)
1181 *op_version = sqlite3_column_int(stmt, 1);
1183 sqlite3_finalize(stmt);
1188 const int op_version,
1191 const void *blend_params,
const int blend_params_size,
1192 const int blendop_version)
1194 sqlite3_stmt *stmt = NULL;
1197 "UPDATE data.presets"
1198 " SET op_version=?2, op_params=?3, enabled=?4,"
1199 " blendop_params=?5, blendop_version=?6"
1200 " WHERE name=?7 AND operation=?1",
1211 sqlite3_finalize(stmt);
1216 sqlite3_stmt *stmt = NULL;
1219 "DELETE FROM data.presets WHERE rowid=?1 AND writeprotect=0",
1224 sqlite3_finalize(stmt);
1230 "DELETE FROM data.presets WHERE writeprotect = 1", NULL, NULL, NULL);
1248 sqlite3_stmt *stmt = NULL;
1251 "SELECT rowid, name, operation, autoapply, model, maker, lens, iso_min, "
1252 "iso_max, exposure_min, exposure_max, aperture_min, aperture_max, "
1253 "focal_length_min, focal_length_max, writeprotect FROM data.presets ORDER BY "
1259 while(sqlite3_step(stmt) == SQLITE_ROW)
1263 row->rowid = sqlite3_column_int(stmt, 0);
1269 row->autoapply = (sqlite3_column_int(stmt, 3) == 0 ?
FALSE :
TRUE);
1273 row->iso_min = sqlite3_column_double(stmt, 7);
1274 row->iso_max = sqlite3_column_double(stmt, 8);
1275 row->exposure_min = sqlite3_column_double(stmt, 9);
1276 row->exposure_max = sqlite3_column_double(stmt, 10);
1277 row->aperture_min = sqlite3_column_double(stmt, 11);
1278 row->aperture_max = sqlite3_column_double(stmt, 12);
1279 row->focal_length_min = sqlite3_column_double(stmt, 13);
1280 row->focal_length_max = sqlite3_column_double(stmt, 14);
1281 row->writeprotect = (sqlite3_column_int(stmt, 15) == 0 ?
FALSE :
TRUE);
1282 rows = g_list_prepend(rows,
row);
1284 sqlite3_finalize(stmt);
1288 return g_list_reverse(rows);
1303 sqlite3_stmt *stmt = NULL;
1305 "SELECT rowid, name, operation FROM data.presets WHERE writeprotect = 0",
1309 while(sqlite3_step(stmt) == SQLITE_ROW)
1313 row->rowid = sqlite3_column_int(stmt, 0);
1316 rows = g_list_prepend(rows,
row);
1318 sqlite3_finalize(stmt);
1320 return g_list_reverse(rows);
const char ** description(struct dt_iop_module_t *self)
size_t params_size(dt_imageio_module_format_t *self)
static const float const float const float min
sqlite3 * dt_database_get_sqlite3_global(void)
memcpy(roundtrip, origin, sizeof(roundtrip))
struct dt_iop_tonecurve_params_t preset
static const dt_iop_drawlayer_params_t * params
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
#define dt_free(ptr)
g_free() ptr and set it to NULL, skipping both if it is already NULL.
static float clamp(float f, float m, float M)
gboolean dt_preset_repository_insert(const dt_preset_t *preset)
Insert preset, replacing any row that collides with it.
void dt_preset_repository_delete_module_preset(const char *operation, const int op_version, const char *name)
Delete (operation, op_version, name) unless it is write-protected.
void dt_preset_repository_add_iop_preset(const char *name, const char *operation, const int op_version, const void *params, const int params_size, const void *blend_params, const int blend_params_size, const int blendop_version, const int enabled)
Store an IOP preset, blend parameters included, replacing any of the same name.
void dt_module_preset_free(gpointer data)
Release one dt_module_preset_t. Suits g_list_free_full().
GList * dt_preset_repository_list_all(void)
Every preset, ordered by (operation, name) – the grouping the tree relies on to start a new module no...
GList * dt_preset_repository_list_all_versions(const char *operation)
Every preset of operation at ANY version, with rowid and op_version filled in, SHIPPED FIRST then by ...
static dt_module_preset_t * _iop_row(sqlite3_stmt *stmt, const gboolean with_description)
static gchar * _column_text_or_null(sqlite3_stmt *stmt, const int col)
void dt_preset_row_free(gpointer data)
Free one dt_preset_row_t. Suits g_list_free_full().
static void * _column_blob(sqlite3_stmt *stmt, const int col, int *size)
void dt_preset_repository_update_range(const char *operation, const int op_version, const char *name, const dt_preset_range_t range, const double min, const double max)
Set the <range>_min / <range>_max pair of (operation, op_version, name).
GList * dt_preset_repository_list_for_module(const char *operation, const int op_version, const gboolean with_description, const gboolean shipped_first)
Every preset of (operation, op_version).
void dt_preset_repository_delete_shipped(void)
Delete every write-protected preset – the auto-generated ones, dropped at startup so module code can ...
void dt_preset_repository_cleanup(void)
Finalise the cached statements. See dt_colorlabel_repository_cleanup().
void dt_preset_repository_update_iop_params(const char *operation, const char *name, const int op_version, const void *params, const int params_size, const int enabled, const void *blend_params, const int blend_params_size, const int blendop_version)
Replace the module payload of (operation, name), at any version.
dt_module_preset_t * dt_preset_repository_get_iop_preset(const char *operation, const int op_version, const char *name)
One IOP preset by name, blend parameters included, or NULL.
dt_preset_t * dt_preset_repository_get_by_rowid(const int rowid)
The preset at rowid, or NULL when there is none. Free with dt_preset_free().
dt_module_preset_t * dt_preset_repository_get_module_preset(const char *operation, const int op_version, const char *name)
One preset by name, or NULL. Free with dt_module_preset_free().
void dt_preset_repository_update_conditions(const int rowid, const dt_preset_conditions_t *c)
Overwrite the conditions of the row at rowid.
GList * dt_preset_repository_list_for_menu(const char *operation, const dt_preset_match_t *match, const gboolean shipped_first)
Presets of operation to offer in a menu, in display order.
GList * dt_preset_repository_list_editable(void)
Every preset the user may edit (writeprotect = 0), in row order.
void dt_preset_repository_update_params_by_rowid(const int rowid, const int op_version, const void *params, const int params_size)
Replace the parameters of one row, by rowid.
GList * dt_preset_repository_list_for_upgrade(const char *operation)
Every preset of operation at any version, with both parameter blobs.
int dt_preset_repository_find_rowid(const char *operation, const int op_version, const char *name)
rowid of (operation, op_version, name), or -1.
static gchar * _column_text(sqlite3_stmt *stmt, const int col)
void dt_preset_repository_update_camera(const char *operation, const int op_version, const char *name, const char *maker, const char *model, const char *lens)
Set the camera match of (operation, op_version, name).
void dt_preset_repository_update_module_params(const char *operation, const char *name, const int op_version, const void *params, const int params_size)
Replace the parameters (and version) of (operation, name).
static const char *const _flag_query[DT_PRESET_FLAG_LAST]
void dt_preset_identity_free(gpointer data)
Free one dt_preset_identity_t. Suits g_list_free_full().
void dt_preset_repository_add_module_preset(const char *name, const char *operation, const int op_version, const void *params, const int params_size)
Create an empty user preset holding params, as the "new preset" menu item does.
GList * dt_preset_repository_list_for_version(const char *operation, const int op_version)
As above, restricted to one op_version. Same columns, same order.
void dt_preset_repository_delete_by_rowid(const int rowid)
Delete one row by rowid.
gboolean dt_preset_repository_get_conditions(const char *operation, const int op_version, const char *name, dt_preset_conditions_t *c, int *rowid)
Read the conditions of (operation, op_version, name).
static void _bind_conditions(sqlite3_stmt *stmt, const dt_preset_conditions_t *c)
static void _bind_text(sqlite3_stmt *stmt, const int idx, const char *value)
void dt_preset_repository_delete_all_for_module(const char *operation)
Delete every preset of operation, whatever its version or protection.
void dt_preset_free(dt_preset_t *preset)
Release a dt_preset_t and everything it owns. NULL-safe.
gboolean dt_preset_repository_module_preset_exists(const char *operation, const int op_version, const char *name)
TRUE when (operation, op_version, name) exists.
GList * dt_preset_repository_list_for_iop(const char *operation, const int op_version)
Every preset of (operation, op_version), with blend parameters.
void dt_preset_repository_rename_module_preset(const char *operation, const int op_version, const char *old_name, const char *new_name, const char *description, const void *params, const int params_size)
Replace name, description and parameters of (operation, op_version, old_name).
void dt_preset_repository_set_module_version(const char *operation, const char *name, const int op_version)
Set ONLY the version of (operation, name), leaving the parameters alone.
void dt_preset_repository_set_blend_params(const char *operation, const char *name, const int blendop_version, const void *blend_params, const int blend_params_size)
Replace the blend parameters (and blend version) of (operation, name), at any version....
void dt_preset_repository_delete_by_rowid_unprotected(const int rowid)
Delete the row at rowid unless it is write-protected.
void dt_preset_conditions_free(dt_preset_conditions_t *c)
Release the strings owned by c (not c itself).
gboolean dt_preset_repository_get_identity(const int rowid, gchar **operation, int *op_version)
The (operation, op_version) a rowid belongs to. Returns FALSE if there is none; *operation is newly a...
void dt_preset_repository_add_shipped_preset(const char *name, const char *operation, const int op_version, const void *params, const int params_size, const int writeprotect)
Create a preset from code rather than from the menu – the built-in presets a module registers at star...
void dt_preset_repository_update_flag(const char *operation, const int op_version, const char *name, const dt_preset_flag_t flag, const int value)
Set one integer condition of (operation, op_version, name).
static const char *const _range_query[DT_PRESET_RANGE_LAST]
void dt_preset_repository_insert_with_conditions(const dt_preset_conditions_t *c, const char *operation, const int op_version, const void *params, const int params_size, const int enabled, const void *blend_params, const int blend_params_size, const int blendop_version)
Create a preset from a full condition set plus its module payload.
void dt_preset_repository_duplicate_module_preset(const char *operation, const int op_version, const char *name, const char *new_name)
Copy (operation, op_version, name) to new_name, unprotected.
GList * dt_preset_repository_find_autoapply(const char *operation, const int op_version, const dt_preset_match_t *match, const char *always_name)
Names of the presets that should be applied to this image automatically.
#define _PRESET_MATCH_PREDICATE
static void _bind_match(sqlite3_stmt *stmt, const dt_preset_match_t *m, const gboolean clamp)
data.presets: a module's saved parameters, with the conditions under which it auto-applies.
@ DT_PRESET_FLAG_AUTOAPPLY
@ DT_PRESET_RANGE_FOCAL_LENGTH
@ DT_PRESET_RANGE_APERTURE
@ DT_PRESET_RANGE_EXPOSURE
void copy(double *dest, double *source, size_t num_el)
Copy a flat buffer used to initialize test matrices.
Checked wrappers around the sqlite3_* calls: trace the statement, assert the return code,...
#define DT_DEBUG_SQLITE3_EXEC(a, b, c, d, e)
#define DT_DEBUG_SQLITE3_BIND_BLOB(a, b, c, d, e)
#define DT_DEBUG_SQLITE3_PREPARE_V2(a, b, c, d, e)
#define DT_DEBUG_SQLITE3_BIND_TEXT(a, b, c, d, e)
#define DT_DEBUG_SQLITE3_BIND_INT(a, b, c)
#define DT_DEBUG_SQLITE3_BIND_DOUBLE(a, b, c)
Identity of one preset, for callers listing rather than loading.
The facts about one image that decide whether a preset matches it.
One row of the Preferences preset tree, with its auto-apply conditions.
One row of data.presets, owned by the caller.