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 Copyright (C) 2026 Guillaume Stutin.
28
29 darktable is free software: you can redistribute it and/or modify
30 it under the terms of the GNU General Public License as published by
31 the Free Software Foundation, either version 3 of the License, or
32 (at your option) any later version.
33
34 darktable is distributed in the hope that it will be useful,
35 but WITHOUT ANY WARRANTY; without even the implied warranty of
36 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
37 GNU General Public License for more details.
38
39 You should have received a copy of the GNU General Public License
40 along with darktable. If not, see <http://www.gnu.org/licenses/>.
41*/
42
43#ifndef DT_CONTROL_SIGNAL_H
44#define DT_CONTROL_SIGNAL_H
45
46#include "common/logging.h"
47#include <glib-object.h>
48#include <stdint.h>
49
50G_BEGIN_DECLS
51
57typedef enum dt_signal_t
58{
64
69
74
79
86
93
100
108
116
127
132
135
137 // when imgs <> NULL these images have some geotag changes
138 // when IS_NULL_PTR(imgs) locations have changed
139 // if locid <> 0 it the new selected location on map
141
144
147 // TODO check if tag and metadata could be included there
149
152
155
161
164
165 /* \brief This signal is raised when a preset is created/updated/deleted */
167
174
179
184
190
196
204
209
214
220
223
226
229
236
241
247
253
266
272
278
283
288
293
298
307
308 /* \brief This signal is raised when metadata view needs update */
310
311 /* \brief This signal is raised when the user choses a new location from map (module location)*/
313
314 /* Raised when a mask form is selected/deselected */
318
319 /* Raised when mask creation mode is entered, so every shape toolbar re-reads which shape is
320 being created and presses the matching button -- the toolbars are not the only way in. */
322
323 /* Raised when the focused darkroom module changes or its masks/blending GUI needs refresh */
325
334
339
340 /* do not touch !*/
343
352
353/* read-only accessors for the signal-debugging options, parsed once from the
354 * command line at startup and never mutated afterwards (implemented in
355 * darktable.c, next to dt_get_debug_flags()). */
356int32_t dt_get_signal_debug_acts(void);
357gboolean dt_get_signal_debug(const int signal);
358
359/* inititialize the signal framework */
361
362/* The application-wide signal bus. Unlike the other service handles, this is
363 * global by nature (a process-wide broadcast bus with no per-call context to
364 * ride on), so this accessor is the intended end state, not an interim step —
365 * same shape as the fully-encapsulated dt_conf_* API. Implemented by the
366 * orchestrator (darktable.c). */
368/* cleanup the signal framework */
374void dt_control_signal_raise(const struct dt_control_signal_t *ctlsig, const dt_signal_t signal, ...);
375/* connects a callback to a signal */
376void dt_control_signal_connect(const struct dt_control_signal_t *ctlsig, const dt_signal_t signal,
377 GCallback cb, gpointer user_data);
378/* disconnects a callback from a sink */
379void dt_control_signal_disconnect(const struct dt_control_signal_t *ctlsig, GCallback cb, gpointer user_data);
380/* disconnects every handler registered with user_data, on any signal and any callback function.
381 Safety net for module teardown: guarantees no dangling instance can still be invoked by a
382 later signal broadcast, even if the caller's own gui_cleanup() forgot (or was skipped for) one
383 of several signals it connected in gui_init(). */
384void dt_control_signal_disconnect_all(const struct dt_control_signal_t *ctlsig, gpointer user_data);
385/* blocks a callback */
386void dt_control_signal_block_by_func(const struct dt_control_signal_t *ctlsig, GCallback cb, gpointer user_data);
387/* unblocks a callback */
388void dt_control_signal_unblock_by_func(const struct dt_control_signal_t *ctlsig, GCallback cb, gpointer user_data);
389
390#define DT_DEBUG_CONTROL_SIGNAL_RAISE(ctlsig, signal, ...) \
391 do \
392 { \
393 if((dt_get_signal_debug_acts() & DT_DEBUG_SIGNAL_ACT_RAISE) && dt_get_signal_debug(signal)) \
394 { \
395 dt_print(DT_DEBUG_SIGNAL, "[signal] %s:%d, function %s(): raise signal %s\n", __FILE__, __LINE__, __FUNCTION__, #signal); \
396 } \
397 dt_control_signal_raise(ctlsig, signal, ##__VA_ARGS__); \
398 } while (0)
399
400#define DT_DEBUG_CONTROL_SIGNAL_CONNECT(ctlsig, signal, cb, user_data) \
401 do \
402 { \
403 if((dt_get_signal_debug_acts() & DT_DEBUG_SIGNAL_ACT_CONNECT) && dt_get_signal_debug(signal)) \
404 { \
405 dt_print(DT_DEBUG_SIGNAL, "[signal] %s:%d, function: %s() connect handler %s to signal %s\n", __FILE__, __LINE__, \
406 __FUNCTION__, #cb, #signal); \
407 } \
408 dt_control_signal_connect(ctlsig, signal, cb, user_data); \
409 } while (0)
410
411#define DT_DEBUG_CONTROL_SIGNAL_DISCONNECT(ctlsig, cb, user_data) \
412 do \
413 { \
414 if(dt_get_signal_debug_acts() & DT_DEBUG_SIGNAL_ACT_DISCONNECT) \
415 { \
416 dt_print(DT_DEBUG_SIGNAL, "[signal] %s:%d, function: %s() disconnect handler %s\n", __FILE__, __LINE__, __FUNCTION__, #cb);\
417 } \
418 dt_control_signal_disconnect(ctlsig, cb, user_data); \
419 } while (0)
420
421#define DT_DEBUG_CONTROL_SIGNAL_DISCONNECT_ALL(ctlsig, user_data) \
422 do \
423 { \
424 if(dt_get_signal_debug_acts() & DT_DEBUG_SIGNAL_ACT_DISCONNECT) \
425 { \
426 dt_print(DT_DEBUG_SIGNAL, "[signal] %s:%d, function: %s() disconnect all handlers for %p\n", __FILE__, __LINE__, \
427 __FUNCTION__, (void *)(user_data)); \
428 } \
429 dt_control_signal_disconnect_all(ctlsig, user_data); \
430 } while (0)
431
432G_END_DECLS
433
434#endif // DT_CONTROL_SIGNAL_H
435
436// clang-format off
437// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
438// vim: shiftwidth=2 expandtab tabstop=2 cindent
439// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
440// clang-format on
void dt_control_signal_cleanup(struct dt_control_signal_t *ctlsig)
Definition signal.c:293
struct dt_control_signal_t * dt_control_signal_init()
Definition signal.c:260
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:541
dt_debug_signal_action_t
Definition signal.h:345
@ DT_DEBUG_SIGNAL_ACT_DISCONNECT
Definition signal.h:349
@ DT_DEBUG_SIGNAL_ACT_CONNECT
Definition signal.h:348
@ DT_DEBUG_SIGNAL_ACT_RAISE
Definition signal.h:347
@ DT_DEBUG_SIGNAL_ACT_PRINT_TRACE
Definition signal.h:350
void dt_control_signal_raise(const struct dt_control_signal_t *ctlsig, const dt_signal_t signal,...)
Raise signal with its arguments. The four signals with a destructor (collection, geotag,...
void dt_control_signal_disconnect_all(const struct dt_control_signal_t *ctlsig, gpointer user_data)
Definition signal.c:520
void dt_control_signal_disconnect(const struct dt_control_signal_t *ctlsig, GCallback cb, gpointer user_data)
Definition signal.c:508
struct dt_control_signal_t * dt_control_signal_get_global(void)
Definition darktable.c:619
int32_t dt_get_signal_debug_acts(void)
Definition darktable.c:2099
gboolean dt_get_signal_debug(const int signal)
Definition darktable.c:2104
dt_signal_t
enum of signals to listen for in darktable.
Definition signal.h:58
@ DT_SIGNAL_DEVELOP_INITIALIZE
This signal is raised when darktable.develop is initialized.
Definition signal.h:173
@ DT_SIGNAL_METADATA_CHANGED
This signal is raised when metadata status (shown/hidden) or value has changed.
Definition signal.h:143
@ DT_SIGNAL_VIEWMANAGER_THUMBTABLE_ACTIVATE
Definition signal.h:99
@ DT_SIGNAL_FILELIST_CHANGED
Raised when the recursive file crawler returns. no params, return :
Definition signal.h:333
@ 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:68
@ DT_SIGNAL_CONTROL_REDRAW_ALL
This signal is raised when dt_control_queue_redraw() is called. no param, no returned value.
Definition signal.h:73
@ DT_SIGNAL_MASK_CHANGED
Definition signal.h:316
@ DT_SIGNAL_FOLDER_SURVEY_CHANGED
Raised when the folder survey starts or stops monitoring. no param, no returned value.
Definition signal.h:338
@ DT_SIGNAL_DEVELOP_HISTORY_CHANGE
This signal is raised when develop history is changed no param, no returned value.
Definition signal.h:208
@ DT_SIGNAL_DEVELOP_IMAGE_CHANGED
This signal is raised when image is changed in darkroom.
Definition signal.h:225
@ 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:246
@ 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:265
@ DT_SIGNAL_IMAGES_ORDER_CHANGE
This signal is raised to request image order change.
Definition signal.h:154
@ 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:178
@ DT_SIGNAL_STYLE_CHANGED
This signal is raised when a style is added/deleted/changed
Definition signal.h:151
@ DT_SIGNAL_HISTORY_RESYNC
This signal is raised once darkroom history has been resynchronized into all live pipelines....
Definition signal.h:213
@ 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:189
@ DT_SIGNAL_DARKROOM_UI_CHANGED
Signal that the darkroom GUI color changed.
Definition signal.h:228
@ 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:183
@ DT_SIGNAL_FILMROLLS_CHANGED
This signal is raised when a filmroll is deleted/changed but not imported.
Definition signal.h:160
@ DT_SIGNAL_GEOTAG_CHANGED
This signal is raised when a geotag is added/deleted/changed
Definition signal.h:140
@ 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:63
@ DT_SIGNAL_CONTROL_TOAST_REDRAW
This signal is raised when dt_control_toast_redraw() is called. no param, no returned value.
Definition signal.h:292
@ DT_SIGNAL_DEVELOP_MODULE_MOVED
This signal is raised when order of modules in pipeline is changed.
Definition signal.h:222
@ DT_SIGNAL_IMAGE_INFO_CHANGED
This signal is raised when any of image info has changed
Definition signal.h:148
@ DT_SIGNAL_PREFERENCES_CHANGE
This signal is raised after preferences have been changed no parameters no return.
Definition signal.h:277
@ 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:78
@ DT_SIGNAL_DEVELOP_MODULEGROUPS_SET
This signal is raised to request a modulegroups update. 1 : dt_iop_module_t *module,...
Definition signal.h:195
@ DT_SIGNAL_FILMROLLS_REMOVED
This signal is raised only when a filmroll is removed.
Definition signal.h:163
@ DT_SIGNAL_TAG_CHANGED
This signal is raised when a tag is added/deleted/changed
Definition signal.h:134
@ DT_SIGNAL_IMAGEIO_STORAGE_CHANGE
This signal is raised when a new storage module is loaded noparameters no return.
Definition signal.h:271
@ DT_SIGNAL_MASK_SHAPE_BUTTONS_SYNC
Definition signal.h:321
@ 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:107
@ 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:219
@ 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:92
@ DT_SIGNAL_IMAGE_LOADED
This signal is raised when an asynchronous darkroom image load finishes. 1 : uint32_t the load reques...
Definition signal.h:235
@ DT_SIGNAL_MASK_SELECTION_CHANGED
Definition signal.h:315
@ DT_SIGNAL_DEVELOP_MASKS_GUI_CHANGED
Definition signal.h:324
@ DT_SIGNAL_SELECTION_CHANGED
This signal is raised when the selection is changed no param, no returned value.
Definition signal.h:131
@ DT_SIGNAL_PRESETS_CHANGED
Definition signal.h:166
@ DT_SIGNAL_MASK_SHAPE_BUTTONS_DEACTIVATE
Definition signal.h:317
@ 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:306
@ DT_SIGNAL_CONTROL_PICKERDATA_READY
This signal is raised when new color picker data are available in darkroom. no param,...
Definition signal.h:297
@ DT_SIGNAL_CONTROL_PROFILE_CHANGED
This signal is raised when the screen profile has changed no param, no returned value.
Definition signal.h:240
@ DT_SIGNAL_COUNT
Definition signal.h:341
@ 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:115
@ 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:252
@ DT_SIGNAL_COLLECTION_CHANGED
This signal is raised when collection changed. To avoid leaking the list, dt_collection_t is connecte...
Definition signal.h:126
@ DT_SIGNAL_CONTROL_LOG_REDRAW
This signal is raised when dt_control_log_redraw() is called. no param, no returned value.
Definition signal.h:287
@ DT_SIGNAL_CONTROL_NAVIGATION_REDRAW
This signal is raised when dt_control_navigation_redraw() is called. no param, no returned value.
Definition signal.h:282
@ DT_SIGNAL_METADATA_UPDATE
Definition signal.h:309
@ 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:203
@ 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:85
@ DT_SIGNAL_LOCATION_CHANGED
Definition signal.h:312
void dt_control_signal_block_by_func(const struct dt_control_signal_t *ctlsig, GCallback cb, gpointer user_data)
Definition signal.c:535