Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
signal.h
Go to the documentation of this file.
1/*
2 This file is part of darktable,
3 Copyright (C) 2011-2012 Henrik Andersson.
4 Copyright (C) 2011 johannes hanika.
5 Copyright (C) 2012 Ivan Tarozzi.
6 Copyright (C) 2012 José Carlos García Sogo.
7 Copyright (C) 2012-2015 Jérémy Rosen.
8 Copyright (C) 2012 Richard Wonka.
9 Copyright (C) 2012-2016 Tobias Ellinghaus.
10 Copyright (C) 2013 Simon Spannagel.
11 Copyright (C) 2014, 2016, 2019-2021 Pascal Obry.
12 Copyright (C) 2014 Ronny Kahl.
13 Copyright (C) 2018-2019 Edgardo Hoszowski.
14 Copyright (C) 2018 Rikard Öxler.
15 Copyright (C) 2019-2021 Aldric Renaudin.
16 Copyright (C) 2019 luzpaz.
17 Copyright (C) 2019 Ulrich Pegelow.
18 Copyright (C) 2020 Chris Elston.
19 Copyright (C) 2020 Hanno Schwalm.
20 Copyright (C) 2020 Hubert Kowalski.
21 Copyright (C) 2020-2021 Philippe Weyland.
22 Copyright (C) 2021 Dan Torop.
23 Copyright (C) 2022-2023, 2025 Aurélien PIERRE.
24 Copyright (C) 2022 Martin Bařinka.
25 Copyright (C) 2023 Luca Zulberti.
26 Copyright (C) 2025 Alynx Zhou.
27
28 darktable is free software: you can redistribute it and/or modify
29 it under the terms of the GNU General Public License as published by
30 the Free Software Foundation, either version 3 of the License, or
31 (at your option) any later version.
32
33 darktable is distributed in the hope that it will be useful,
34 but WITHOUT ANY WARRANTY; without even the implied warranty of
35 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36 GNU General Public License for more details.
37
38 You should have received a copy of the GNU General Public License
39 along with darktable. If not, see <http://www.gnu.org/licenses/>.
40*/
41
42#ifndef DT_CONTROL_SIGNAL_H
43#define DT_CONTROL_SIGNAL_H
44
45#include "common/logging.h"
46#include <glib-object.h>
47#include <stdint.h>
48
49G_BEGIN_DECLS
50
56typedef enum dt_signal_t
57{
63
68
73
78
85
92
99
107
115
126
131
134
136 // when imgs <> NULL these images have some geotag changes
137 // when IS_NULL_PTR(imgs) locations have changed
138 // if locid <> 0 it the new selected location on map
140
143
146 // TODO check if tag and metadata could be included there
148
151
154
160
163
164 /* \brief This signal is raised when a preset is created/updated/deleted */
166
173
178
183
189
195
203
208
213
219
222
225
228
235
240
246
252
265
271
277
282
287
292
297
306
307 /* \brief This signal is raised when metadata view needs update */
309
310 /* \brief This signal is raised when the user choses a new location from map (module location)*/
312
313 /* Raised when a mask form is selected/deselected */
317
318 /* Raised when mask creation mode is entered, so every shape toolbar re-reads which shape is
319 being created and presses the matching button -- the toolbars are not the only way in. */
321
322 /* Raised when the focused darkroom module changes or its masks/blending GUI needs refresh */
324
333
338
339 /* do not touch !*/
342
351
352/* read-only accessors for the signal-debugging options, parsed once from the
353 * command line at startup and never mutated afterwards (implemented in
354 * darktable.c, next to dt_get_debug_flags()). */
355int32_t dt_get_signal_debug_acts(void);
356gboolean dt_get_signal_debug(const int signal);
357
358/* inititialize the signal framework */
360
361/* The application-wide signal bus. Unlike the other service handles, this is
362 * global by nature (a process-wide broadcast bus with no per-call context to
363 * ride on), so this accessor is the intended end state, not an interim step —
364 * same shape as the fully-encapsulated dt_conf_* API. Implemented by the
365 * orchestrator (darktable.c). */
367/* cleanup the signal framework */
369/* raises a signal */
370void dt_control_signal_raise(const struct dt_control_signal_t *ctlsig, const dt_signal_t signal, ...);
371/* connects a callback to a signal */
372void dt_control_signal_connect(const struct dt_control_signal_t *ctlsig, const dt_signal_t signal,
373 GCallback cb, gpointer user_data);
374/* disconnects a callback from a sink */
375void dt_control_signal_disconnect(const struct dt_control_signal_t *ctlsig, GCallback cb, gpointer user_data);
376/* disconnects every handler registered with user_data, on any signal and any callback function.
377 Safety net for module teardown: guarantees no dangling instance can still be invoked by a
378 later signal broadcast, even if the caller's own gui_cleanup() forgot (or was skipped for) one
379 of several signals it connected in gui_init(). */
380void dt_control_signal_disconnect_all(const struct dt_control_signal_t *ctlsig, gpointer user_data);
381/* blocks a callback */
382void dt_control_signal_block_by_func(const struct dt_control_signal_t *ctlsig, GCallback cb, gpointer user_data);
383/* unblocks a callback */
384void dt_control_signal_unblock_by_func(const struct dt_control_signal_t *ctlsig, GCallback cb, gpointer user_data);
385
386#define DT_DEBUG_CONTROL_SIGNAL_RAISE(ctlsig, signal, ...) \
387 do \
388 { \
389 if((dt_get_signal_debug_acts() & DT_DEBUG_SIGNAL_ACT_RAISE) && dt_get_signal_debug(signal)) \
390 { \
391 dt_print(DT_DEBUG_SIGNAL, "[signal] %s:%d, function %s(): raise signal %s\n", __FILE__, __LINE__, __FUNCTION__, #signal); \
392 } \
393 dt_control_signal_raise(ctlsig, signal, ##__VA_ARGS__); \
394 } while (0)
395
396#define DT_DEBUG_CONTROL_SIGNAL_CONNECT(ctlsig, signal, cb, user_data) \
397 do \
398 { \
399 if((dt_get_signal_debug_acts() & DT_DEBUG_SIGNAL_ACT_CONNECT) && dt_get_signal_debug(signal)) \
400 { \
401 dt_print(DT_DEBUG_SIGNAL, "[signal] %s:%d, function: %s() connect handler %s to signal %s\n", __FILE__, __LINE__, \
402 __FUNCTION__, #cb, #signal); \
403 } \
404 dt_control_signal_connect(ctlsig, signal, cb, user_data); \
405 } while (0)
406
407#define DT_DEBUG_CONTROL_SIGNAL_DISCONNECT(ctlsig, cb, user_data) \
408 do \
409 { \
410 if(dt_get_signal_debug_acts() & DT_DEBUG_SIGNAL_ACT_DISCONNECT) \
411 { \
412 dt_print(DT_DEBUG_SIGNAL, "[signal] %s:%d, function: %s() disconnect handler %s\n", __FILE__, __LINE__, __FUNCTION__, #cb);\
413 } \
414 dt_control_signal_disconnect(ctlsig, cb, user_data); \
415 } while (0)
416
417#define DT_DEBUG_CONTROL_SIGNAL_DISCONNECT_ALL(ctlsig, user_data) \
418 do \
419 { \
420 if(dt_get_signal_debug_acts() & DT_DEBUG_SIGNAL_ACT_DISCONNECT) \
421 { \
422 dt_print(DT_DEBUG_SIGNAL, "[signal] %s:%d, function: %s() disconnect all handlers for %p\n", __FILE__, __LINE__, \
423 __FUNCTION__, (void *)(user_data)); \
424 } \
425 dt_control_signal_disconnect_all(ctlsig, user_data); \
426 } while (0)
427
428G_END_DECLS
429
430#endif // DT_CONTROL_SIGNAL_H
431
432// clang-format off
433// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
434// vim: shiftwidth=2 expandtab tabstop=2 cindent
435// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
436// clang-format on
void dt_control_signal_cleanup(struct dt_control_signal_t *ctlsig)
Definition signal.c:292
struct dt_control_signal_t * dt_control_signal_init()
Definition signal.c:259
void dt_control_signal_connect(const struct dt_control_signal_t *ctlsig, const dt_signal_t signal, GCallback cb, gpointer user_data)
void dt_control_signal_unblock_by_func(const struct dt_control_signal_t *ctlsig, GCallback cb, gpointer user_data)
Definition signal.c:512
dt_debug_signal_action_t
Definition signal.h:344
@ DT_DEBUG_SIGNAL_ACT_DISCONNECT
Definition signal.h:348
@ DT_DEBUG_SIGNAL_ACT_CONNECT
Definition signal.h:347
@ DT_DEBUG_SIGNAL_ACT_RAISE
Definition signal.h:346
@ DT_DEBUG_SIGNAL_ACT_PRINT_TRACE
Definition signal.h:349
void dt_control_signal_raise(const struct dt_control_signal_t *ctlsig, const dt_signal_t signal,...)
void dt_control_signal_disconnect_all(const struct dt_control_signal_t *ctlsig, gpointer user_data)
Definition signal.c:491
void dt_control_signal_disconnect(const struct dt_control_signal_t *ctlsig, GCallback cb, gpointer user_data)
Definition signal.c:479
struct dt_control_signal_t * dt_control_signal_get_global(void)
Definition darktable.c:616
int32_t dt_get_signal_debug_acts(void)
Definition darktable.c:2090
gboolean dt_get_signal_debug(const int signal)
Definition darktable.c:2095
dt_signal_t
enum of signals to listen for in darktable.
Definition signal.h:57
@ DT_SIGNAL_DEVELOP_INITIALIZE
This signal is raised when darktable.develop is initialized.
Definition signal.h:172
@ DT_SIGNAL_METADATA_CHANGED
This signal is raised when metadata status (shown/hidden) or value has changed.
Definition signal.h:142
@ DT_SIGNAL_VIEWMANAGER_THUMBTABLE_ACTIVATE
Definition signal.h:98
@ DT_SIGNAL_FILELIST_CHANGED
Raised when the recursive file crawler returns. no params, return :
Definition signal.h:332
@ DT_SIGNAL_ACTIVE_IMAGES_CHANGE
This signal is raised when image shown in the main view change no param, no returned value.
Definition signal.h:67
@ DT_SIGNAL_CONTROL_REDRAW_ALL
This signal is raised when dt_control_queue_redraw() is called. no param, no returned value.
Definition signal.h:72
@ DT_SIGNAL_MASK_CHANGED
Definition signal.h:315
@ DT_SIGNAL_FOLDER_SURVEY_CHANGED
Raised when the folder survey starts or stops monitoring. no param, no returned value.
Definition signal.h:337
@ DT_SIGNAL_DEVELOP_HISTORY_CHANGE
This signal is raised when develop history is changed no param, no returned value.
Definition signal.h:207
@ DT_SIGNAL_DEVELOP_IMAGE_CHANGED
This signal is raised when image is changed in darkroom.
Definition signal.h:224
@ DT_SIGNAL_CONTROL_PROFILE_USER_CHANGED
This signal is raised when a profile is changed by the user 1 uint32_t : the profile type that has ch...
Definition signal.h:245
@ DT_SIGNAL_IMAGE_EXPORT_TMPFILE
This signal is raised after an image has been exported to a file, but before it is sent to facebook/p...
Definition signal.h:264
@ DT_SIGNAL_IMAGES_ORDER_CHANGE
This signal is raised to request image order change.
Definition signal.h:153
@ DT_SIGNAL_DEVELOP_PREVIEW_PIPE_FINISHED
This signal is raised when develop preview pipe process is finished no param, no returned value.
Definition signal.h:177
@ DT_SIGNAL_STYLE_CHANGED
This signal is raised when a style is added/deleted/changed
Definition signal.h:150
@ DT_SIGNAL_HISTORY_RESYNC
This signal is raised once darkroom history has been resynchronized into all live pipelines....
Definition signal.h:212
@ DT_SIGNAL_CACHELINE_READY
This signal is raised when one cacheline write lock is released. 1 : uint64_t cacheline hash no retur...
Definition signal.h:188
@ DT_SIGNAL_DARKROOM_UI_CHANGED
Signal that the darkroom GUI color changed.
Definition signal.h:227
@ DT_SIGNAL_DEVELOP_UI_PIPE_FINISHED
This signal is raised when pipe is finished and the gui is attached no param, no returned value.
Definition signal.h:182
@ DT_SIGNAL_FILMROLLS_CHANGED
This signal is raised when a filmroll is deleted/changed but not imported.
Definition signal.h:159
@ DT_SIGNAL_GEOTAG_CHANGED
This signal is raised when a geotag is added/deleted/changed
Definition signal.h:139
@ DT_SIGNAL_MOUSE_OVER_IMAGE_CHANGE
This signal is raised when mouse hovers over image thumbs both on lighttable and in the filmstrip....
Definition signal.h:62
@ DT_SIGNAL_CONTROL_TOAST_REDRAW
This signal is raised when dt_control_toast_redraw() is called. no param, no returned value.
Definition signal.h:291
@ DT_SIGNAL_DEVELOP_MODULE_MOVED
This signal is raised when order of modules in pipeline is changed.
Definition signal.h:221
@ DT_SIGNAL_IMAGE_INFO_CHANGED
This signal is raised when any of image info has changed
Definition signal.h:147
@ DT_SIGNAL_PREFERENCES_CHANGE
This signal is raised after preferences have been changed no parameters no return.
Definition signal.h:276
@ DT_SIGNAL_CONTROL_REDRAW_CENTER
This signal is raised when dt_control_queue_redraw_center() is called. no param, no returned value.
Definition signal.h:77
@ DT_SIGNAL_DEVELOP_MODULEGROUPS_SET
This signal is raised to request a modulegroups update. 1 : dt_iop_module_t *module,...
Definition signal.h:194
@ DT_SIGNAL_FILMROLLS_REMOVED
This signal is raised only when a filmroll is removed.
Definition signal.h:162
@ DT_SIGNAL_TAG_CHANGED
This signal is raised when a tag is added/deleted/changed
Definition signal.h:133
@ DT_SIGNAL_IMAGEIO_STORAGE_CHANGE
This signal is raised when a new storage module is loaded noparameters no return.
Definition signal.h:270
@ DT_SIGNAL_MASK_SHAPE_BUTTONS_SYNC
Definition signal.h:320
@ DT_SIGNAL_VIEWMANAGER_FILMSTRIP_ACTIVATE
This signal is raised when a thumb is single-clicked in the filmstrip. Views that want filmstrip clic...
Definition signal.h:106
@ DT_SIGNAL_DEVELOP_MODULE_REMOVE
This signal is raised when a module is removed from the history stack 1 module no returned value.
Definition signal.h:218
@ DT_SIGNAL_VIEWMANAGER_VIEW_CANNOT_CHANGE
This signal is raised by viewmanager when a view has changed. 1 : dt_view_t * the old view 2 : dt_vie...
Definition signal.h:91
@ DT_SIGNAL_IMAGE_LOADED
This signal is raised when an asynchronous darkroom image load finishes. 1 : uint32_t the load reques...
Definition signal.h:234
@ DT_SIGNAL_MASK_SELECTION_CHANGED
Definition signal.h:314
@ DT_SIGNAL_DEVELOP_MASKS_GUI_CHANGED
Definition signal.h:323
@ DT_SIGNAL_SELECTION_CHANGED
This signal is raised when the selection is changed no param, no returned value.
Definition signal.h:130
@ DT_SIGNAL_PRESETS_CHANGED
Definition signal.h:165
@ DT_SIGNAL_MASK_SHAPE_BUTTONS_DEACTIVATE
Definition signal.h:316
@ DT_SIGNAL_CONTROL_NOTEBOOK_TAB_CHANGED
This signal is raised when a GtkNotebook created/registered via dt_ui_notebook_set_picker_owner() swi...
Definition signal.h:305
@ DT_SIGNAL_CONTROL_PICKERDATA_READY
This signal is raised when new color picker data are available in darkroom. no param,...
Definition signal.h:296
@ DT_SIGNAL_CONTROL_PROFILE_CHANGED
This signal is raised when the screen profile has changed no param, no returned value.
Definition signal.h:239
@ DT_SIGNAL_COUNT
Definition signal.h:340
@ DT_SIGNAL_VIEWMANAGER_FILMSTRIP_DRAG_BEGIN
This signal is raised when a drag starts from the filmstrip. Views that need filmstrip drags to commi...
Definition signal.h:114
@ DT_SIGNAL_IMAGE_IMPORT
This signal is raised when a new image is imported (not cloned) 1 uint32_t : the new image id no retu...
Definition signal.h:251
@ DT_SIGNAL_COLLECTION_CHANGED
This signal is raised when collection changed. To avoid leaking the list, dt_collection_t is connecte...
Definition signal.h:125
@ DT_SIGNAL_CONTROL_LOG_REDRAW
This signal is raised when dt_control_log_redraw() is called. no param, no returned value.
Definition signal.h:286
@ DT_SIGNAL_CONTROL_NAVIGATION_REDRAW
This signal is raised when dt_control_navigation_redraw() is called. no param, no returned value.
Definition signal.h:281
@ DT_SIGNAL_METADATA_UPDATE
Definition signal.h:308
@ DT_SIGNAL_DEVELOP_HISTORY_WILL_CHANGE
This signal is raised when develop history is about to be changed 1 : GList * the current history 2 :...
Definition signal.h:202
@ DT_SIGNAL_VIEWMANAGER_VIEW_CHANGED
This signal is raised by viewmanager when a view has changed. 1 : dt_view_t * the old view 2 : dt_vie...
Definition signal.h:84
@ DT_SIGNAL_LOCATION_CHANGED
Definition signal.h:311
void dt_control_signal_block_by_func(const struct dt_control_signal_t *ctlsig, GCallback cb, gpointer user_data)
Definition signal.c:506