Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
conf.h
Go to the documentation of this file.
1/*
2 This file is part of darktable,
3 Copyright (C) 2010-2011, 2014 Henrik Andersson.
4 Copyright (C) 2010-2013 johannes hanika.
5 Copyright (C) 2010, 2012-2017 Tobias Ellinghaus.
6 Copyright (C) 2012 Christian Tellefsen.
7 Copyright (C) 2012 Jérémy Rosen.
8 Copyright (C) 2012 Richard Wonka.
9 Copyright (C) 2012 Simon Spannagel.
10 Copyright (C) 2012, 2014 Ulrich Pegelow.
11 Copyright (C) 2013 Jean-Sébastien Pédron.
12 Copyright (C) 2013 Jesper Pedersen.
13 Copyright (C) 2014 parafin.
14 Copyright (C) 2014, 2020-2021 Pascal Obry.
15 Copyright (C) 2014, 2016 Roman Lebedev.
16 Copyright (C) 2016-2018 Peter Budai.
17 Copyright (C) 2019 jakubfi.
18 Copyright (C) 2020 Hubert Kowalski.
19 Copyright (C) 2020 Philippe Weyland.
20 Copyright (C) 2021 Marco Carrarini.
21 Copyright (C) 2021 Mark-64.
22 Copyright (C) 2021 Ralf Brown.
23 Copyright (C) 2022 Hanno Schwalm.
24 Copyright (C) 2022 Martin Bařinka.
25 Copyright (C) 2025 Alynx Zhou.
26
27 darktable is free software: you can redistribute it and/or modify
28 it under the terms of the GNU General Public License as published by
29 the Free Software Foundation, either version 3 of the License, or
30 (at your option) any later version.
31
32 darktable is distributed in the hope that it will be useful,
33 but WITHOUT ANY WARRANTY; without even the implied warranty of
34 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
35 GNU General Public License for more details.
36
37 You should have received a copy of the GNU General Public License
38 along with darktable. If not, see <http://www.gnu.org/licenses/>.
39*/
40
41#pragma once
42
43#ifdef HAVE_CONFIG_H
44#include "config.h"
45#endif
46
47#include "common/dtpthread.h"
48
49#include <glib.h>
50#include <gtk/gtk.h>
51#include <inttypes.h>
52
53#ifdef __cplusplus
54extern "C" {
55#endif
56
67
78
79typedef struct dt_conf_t
80{
81 dt_pthread_mutex_t mutex;
83 GHashTable *table;
84 GHashTable *x_confgen;
85 GHashTable *override_entries;
87
93
101
102void dt_conf_set_int(const char *name, int val);
103void dt_conf_set_int64(const char *name, int64_t val);
104void dt_conf_set_float(const char *name, float val);
105void dt_conf_set_bool(const char *name, int val);
106void dt_conf_set_string(const char *name, const char *val);
107void dt_conf_set_folder_from_file_chooser(const char *name, GtkFileChooser *chooser);
108int dt_conf_get_int_fast(const char *name);
109int dt_conf_get_int(const char *name);
110int64_t dt_conf_get_int64_fast(const char *name);
111int64_t dt_conf_get_int64(const char *name);
112float dt_conf_get_float_fast(const char *name);
113float dt_conf_get_float(const char *name);
114int dt_conf_get_and_sanitize_int(const char *name, int min, int max);
115int64_t dt_conf_get_and_sanitize_int64(const char *name, int64_t min, int64_t max);
116float dt_conf_get_and_sanitize_float(const char *name, float min, float max);
117int dt_conf_get_bool(const char *name);
118// get the configuration string without duplicating it; the returned string will be invalidated by any
119// subsequent dt_conf_set_string call
120const char *dt_conf_get_string_const(const char *name);
121// get a freshly-allocated duplicate of the configuration string; safe to use even if calling dt_conf_set_string
122gchar *dt_conf_get_string(const char *name);
123gboolean dt_conf_get_folder_to_file_chooser(const char *name, GtkFileChooser *chooser);
124gboolean dt_conf_is_equal(const char *name, const char *value);
125void dt_conf_init(dt_conf_t *cf, const char *filename, GSList *override_entries);
126void dt_conf_cleanup(dt_conf_t *cf);
127void dt_conf_save(dt_conf_t *cf);
128int dt_conf_key_exists(const char *key);
129gboolean dt_conf_key_not_empty(const char *key);
130GSList *dt_conf_all_string_entries(const char *dir);
131void dt_conf_string_entry_free(gpointer data);
132
133#define DT_CONF_SET_SANITIZED_INT(name, val, min, max) dt_conf_set_int(name, CLAMPS(val, min,max));
134#define DT_CONF_SET_SANITIZED_INT6464(name, val, min, max) dt_conf_set_int(name, CLAMPS(val, min,max));
135#define DT_CONF_SET_SANITIZED_FLOAT(name, val, min, max) dt_conf_set_float(name, CLAMPS(val, min,max));
136
137// conf generated from darktable config XML
138
139gboolean dt_confgen_exists(const char *name);
141
143
148const char *dt_confgen_get(const char *name, dt_confgen_value_kind_t kind);
149
150const char *dt_confgen_get_label(const char *name);
151const char *dt_confgen_get_tooltip(const char *name);
152
153gboolean dt_conf_is_default(const char *name);
154gchar* dt_conf_expand_default_dir(const char *dir);
155
156#ifdef __cplusplus
157}
158#endif
159
160// clang-format off
161// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
162// vim: shiftwidth=2 expandtab tabstop=2 cindent
163// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
164// clang-format on
165
static const dt_adaptation_t kind
static const float const float const float min
const float max
char * key
char * name
void dt_conf_cleanup(dt_conf_t *cf)
void dt_conf_string_entry_free(gpointer data)
void dt_conf_set_bool(const char *name, int val)
int dt_conf_get_bool(const char *name)
gboolean dt_conf_key_not_empty(const char *key)
int dt_conf_key_exists(const char *key)
float dt_confgen_get_float(const char *name, dt_confgen_value_kind_t kind)
int64_t dt_conf_get_int64_fast(const char *name)
void dt_conf_init(dt_conf_t *cf, const char *filename, GSList *override_entries)
void dt_conf_set_float(const char *name, float val)
float dt_conf_get_float(const char *name)
const char * dt_confgen_get_tooltip(const char *name)
gchar * dt_conf_get_string(const char *name)
int dt_conf_get_int_fast(const char *name)
int dt_conf_get_and_sanitize_int(const char *name, int min, int max)
void dt_conf_set_int(const char *name, int val)
gboolean dt_confgen_get_bool(const char *name, dt_confgen_value_kind_t kind)
void dt_conf_set_int64(const char *name, int64_t val)
gchar * dt_conf_expand_default_dir(const char *dir)
GSList * dt_conf_all_string_entries(const char *dir)
gboolean dt_conf_is_default(const char *name)
dt_confgen_value_kind_t
Definition conf.h:95
@ DT_DEFAULT
Definition conf.h:96
@ DT_MAX
Definition conf.h:98
@ DT_MIN
Definition conf.h:97
@ DT_VALUES
Definition conf.h:99
int dt_conf_get_int(const char *name)
int64_t dt_conf_get_int64(const char *name)
gboolean dt_confgen_value_exists(const char *name, dt_confgen_value_kind_t kind)
int64_t dt_confgen_get_int64(const char *name, dt_confgen_value_kind_t kind)
gboolean dt_confgen_exists(const char *name)
int dt_confgen_get_int(const char *name, dt_confgen_value_kind_t kind)
void dt_conf_set_string(const char *name, const char *val)
float dt_conf_get_float_fast(const char *name)
const char * dt_conf_get_string_const(const char *name)
const char * dt_confgen_get(const char *name, dt_confgen_value_kind_t kind)
void dt_conf_save(dt_conf_t *cf)
int64_t dt_conf_get_and_sanitize_int64(const char *name, int64_t min, int64_t max)
void dt_conf_set_folder_from_file_chooser(const char *name, GtkFileChooser *chooser)
dt_confgen_type_t dt_confgen_type(const char *name)
gboolean dt_conf_is_equal(const char *name, const char *value)
const char * dt_confgen_get_label(const char *name)
gboolean dt_conf_get_folder_to_file_chooser(const char *name, GtkFileChooser *chooser)
float dt_conf_get_and_sanitize_float(const char *name, float min, float max)
dt_confgen_type_t
Definition conf.h:58
@ DT_BOOL
Definition conf.h:62
@ DT_STRING
Definition conf.h:64
@ DT_FLOAT
Definition conf.h:61
@ DT_INT64
Definition conf.h:60
@ DT_ENUM
Definition conf.h:65
@ DT_PATH
Definition conf.h:63
@ DT_INT
Definition conf.h:59
static const dt_aligned_pixel_simd_t value
Definition darktable.h:577
#define PATH_MAX
Definition darktable.h:1062
Definition conf.h:89
char * key
Definition conf.h:90
char * value
Definition conf.h:91
GHashTable * override_entries
Definition conf.h:85
char filename[PATH_MAX]
Definition conf.h:82
dt_pthread_mutex_t mutex
Definition conf.h:81
GHashTable * x_confgen
Definition conf.h:84
GHashTable * table
Definition conf.h:83
char * enum_values
Definition conf.h:74
char * shortdesc
Definition conf.h:75
dt_confgen_type_t type
Definition conf.h:70
char * longdesc
Definition conf.h:76