Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
views/view.h
Go to the documentation of this file.
1/*
2 This file is part of darktable,
3 Copyright (C) 2009-2011, 2013, 2015 johannes hanika.
4 Copyright (C) 2010-2012, 2014 Henrik Andersson.
5 Copyright (C) 2011 Omari Stephens.
6 Copyright (C) 2011 Robert Bieber.
7 Copyright (C) 2011 Simon Spannagel.
8 Copyright (C) 2011-2017 Tobias Ellinghaus.
9 Copyright (C) 2012-2013 José Carlos García Sogo.
10 Copyright (C) 2012, 2014-2015 Jérémy Rosen.
11 Copyright (C) 2012 Mika Boström.
12 Copyright (C) 2012 Richard Wonka.
13 Copyright (C) 2013 Benjamin Cahill.
14 Copyright (C) 2013 Gaspard Jankowiak.
15 Copyright (C) 2013-2015, 2018-2021 Pascal Obry.
16 Copyright (C) 2013-2014 Ronny Kahl.
17 Copyright (C) 2016 Roman Lebedev.
18 Copyright (C) 2017 luzpaz.
19 Copyright (C) 2018 Rikard Öxler.
20 Copyright (C) 2019-2022 Aldric Renaudin.
21 Copyright (C) 2019, 2022-2023, 2025 Aurélien PIERRE.
22 Copyright (C) 2019 Edgardo Hoszowski.
23 Copyright (C) 2019 Marcello Mamino.
24 Copyright (C) 2019 vacaboja.
25 Copyright (C) 2020-2021 Diederik Ter Rahe.
26 Copyright (C) 2020 Hanno Schwalm.
27 Copyright (C) 2020-2021 Philippe Weyland.
28 Copyright (C) 2021 Ralf Brown.
29 Copyright (C) 2022 Chris Elston.
30 Copyright (C) 2022 Martin Bařinka.
31 Copyright (C) 2025 Guillaume Stutin.
32
33 darktable is free software: you can redistribute it and/or modify
34 it under the terms of the GNU General Public License as published by
35 the Free Software Foundation, either version 3 of the License, or
36 (at your option) any later version.
37
38 darktable is distributed in the hope that it will be useful,
39 but WITHOUT ANY WARRANTY; without even the implied warranty of
40 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
41 GNU General Public License for more details.
42
43 You should have received a copy of the GNU General Public License
44 along with darktable. If not, see <http://www.gnu.org/licenses/>.
45*/
46
47#pragma once
48
49#include "common/act_on.h"
50#include "common/atomic.h"
51
52#include "common/history.h"
53#include "common/image.h"
54#include "common/dtpthread.h"
55#ifdef HAVE_PRINT
56#include "common/cups_print.h"
57#include "common/printing.h"
58#endif
59#ifdef HAVE_MAP
60#include "common/geo.h"
62#include <osm-gps-map.h>
63#endif
64#include <cairo.h>
65#include <gmodule.h>
66#include <gui/gtk.h>
67#include <inttypes.h>
68#include <sqlite3.h>
69#ifdef USE_LUA
70#include "lua/call.h"
71#include "lua/events.h"
72#include "lua/modules.h"
73#include "lua/types.h"
74#include "lua/view.h"
75#endif
76
82typedef enum
83{
86 DT_VIEW_MAP = 1 << 3,
88 DT_VIEW_PRINT = 1 << 5,
90
91// flags that a view can set in flags()
92typedef enum dt_view_flags_t
93{
95 VIEW_FLAGS_HIDDEN = 1 << 0, // Hide the view from userinterface
97
105
106
107// flags that a view can set in flags()
113
114typedef struct _dt_job_t dt_job_t;
115
144
145#define DT_VIEW_ALL \
146 (DT_VIEW_LIGHTTABLE | DT_VIEW_DARKROOM | DT_VIEW_TETHERING | DT_VIEW_MAP | DT_VIEW_SLIDESHOW | \
147 DT_VIEW_PRINT)
148
149/* maximum zoom factor for the lighttable */
150#define DT_LIGHTTABLE_MAX_ZOOM 12
151
155typedef struct dt_view_t
156{
157#define INCLUDE_API_FROM_MODULE_H
158#include "views/view_api.h"
159
160 char module_name[64];
161 // dlopened module
162 GModule *module;
163 // custom data for module
164 void *data;
165 // width and height of allocation
166 uint32_t width, height;
167 // scroll bar control
171
187
189char* dt_view_extend_modes_str(const char * name, const gboolean is_hdr, const gboolean is_bw, const gboolean is_bw_flow);
191dt_view_surface_value_t dt_view_image_get_surface(int32_t imgid, int width, int height, cairo_surface_t **surface,
192 int zoom);
197 int width, int height, cairo_surface_t **target,
198 GtkWidget *widget, int zoom);
199
200
205typedef struct dt_view_manager_t
206{
207 GList *views;
209
210 // images currently active in the main view (there can be more than 1 in culling)
212
213 // copy/paste history structure
215
216 // The imgid of the image for which we currently show the image info
218
219 struct
220 {
221 GPid audio_player_pid; // the pid of the child process
222 int32_t audio_player_id; // the imgid of the image the audio is played for
225
226 // toggle button for guides (in the module toolbox)
228
229 /*
230 * Proxy
231 */
232 struct
233 {
234 /* module toolbox proxy object */
235 struct
236 {
237 struct dt_lib_module_t *module;
240
241 /* module collection proxy object */
242 struct
243 {
244 struct dt_lib_module_t *module;
247
248 /* darkroom view proxy object */
249 struct
250 {
254
255/* map view proxy object */
256#ifdef HAVE_MAP
257 struct
258 {
259 struct dt_view_t *view;
260 void (*center_on_location)(const dt_view_t *view, gdouble lon, gdouble lat, double zoom);
261 void (*center_on_bbox)(const dt_view_t *view, gdouble lon1, gdouble lat1, gdouble lon2, gdouble lat2);
262 void (*show_osd)(const dt_view_t *view);
263 void (*set_map_source)(const dt_view_t *view, OsmGpsMapSource_t map_source);
264 GObject *(*add_marker)(const dt_view_t *view, dt_geo_map_display_t type, GList *points);
265 gboolean (*remove_marker)(const dt_view_t *view, dt_geo_map_display_t type, GObject *marker);
266 void (*add_location)(const dt_view_t *view, dt_map_location_data_t *p, const guint posid);
267 void (*location_action)(const dt_view_t *view, const int action);
268 gboolean (*redraw)(gpointer user_data);
269 } map;
270#endif
271
272 /* map view proxy object */
273#ifdef HAVE_PRINT
274 struct
275 {
276 struct dt_view_t *view;
277 void (*print_settings)(const dt_view_t *view, dt_print_info_t *pinfo, dt_images_box *imgs);
278 } print;
279#endif
281
282
284
288
292int dt_view_manager_switch(dt_view_manager_t *vm, const char *view_name);
295void dt_view_manager_expose(dt_view_manager_t *vm, cairo_t *cr, int32_t width, int32_t height,
296 int32_t pointerx, int32_t pointery);
301
304void dt_view_manager_mouse_moved(dt_view_manager_t *vm, double x, double y, double pressure, int which);
305int dt_view_manager_button_released(dt_view_manager_t *vm, double x, double y, int which, uint32_t state);
306int dt_view_manager_button_pressed(dt_view_manager_t *vm, double x, double y, double pressure, int which,
307 int type, uint32_t state);
308int dt_view_manager_key_pressed(dt_view_manager_t *vm, GdkEventKey *event);
310int dt_view_manager_scrolled(dt_view_manager_t *vm, double x, double y, int up, int state, int delta_y);
311
314
315void dt_view_image_info_update(const int32_t imgid);
316
317// active images functions
318void dt_view_active_images_reset(gboolean raise);
319void dt_view_active_images_set(GList *images, gboolean raise);
320void dt_view_active_images_add(int32_t imgid, gboolean raise);
321void dt_view_active_images_remove(int32_t imgid, gboolean raise);
322gboolean dt_view_active_images_has_imgid(int32_t imgid);
323
326
329
330/* audio */
331void dt_view_audio_start(dt_view_manager_t *vm, int32_t imgid);
333
334/*
335 * Map View Proxy
336 */
337#ifdef HAVE_MAP
338void dt_view_map_center_on_location(const dt_view_manager_t *vm, gdouble lon, gdouble lat, gdouble zoom);
339void dt_view_map_center_on_bbox(const dt_view_manager_t *vm, gdouble lon1, gdouble lat1, gdouble lon2, gdouble lat2);
340void dt_view_map_show_osd(const dt_view_manager_t *vm);
341void dt_view_map_set_map_source(const dt_view_manager_t *vm, OsmGpsMapSource_t map_source);
342GObject *dt_view_map_add_marker(const dt_view_manager_t *vm, dt_geo_map_display_t type, GList *points);
343gboolean dt_view_map_remove_marker(const dt_view_manager_t *vm, dt_geo_map_display_t type, GObject *marker);
344void dt_view_map_add_location(const dt_view_manager_t *vm, dt_map_location_data_t *p, const guint posid);
345void dt_view_map_location_action(const dt_view_manager_t *vm, const int action);
346void dt_view_map_redraw(const dt_view_manager_t *vm);
347#endif
348
349/*
350 * Print View Proxy
351 */
352#ifdef HAVE_PRINT
353void dt_view_print_settings(const dt_view_manager_t *vm, dt_print_info_t *pinfo, dt_images_box *imgs);
354#endif
355
356// clang-format off
357// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
358// vim: shiftwidth=2 expandtab tabstop=2 cindent
359// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
360// clang-format on
atomic_int dt_atomic_int
Definition atomic.h:66
int width
Definition bilateral.h:1
int height
Definition bilateral.h:1
static const dt_aligned_pixel_simd_t const dt_adaptation_t const float p
Definition chromatic_adaptation.h:309
typedef void((*dt_cache_allocate_t)(void *userdata, dt_cache_entry_t *entry))
int type
Definition common/metadata.c:62
char * name
Definition common/metadata.c:61
uint32_t view(const dt_view_t *self)
Definition darkroom.c:208
dt_geo_map_display_t
Definition geo.h:25
static const float x
Definition iop_profile.h:235
float lat
Definition location.c:3
float lon
Definition location.c:2
struct _GtkWidget GtkWidget
Definition splash.h:29
const float uint32_t state[4]
Definition src/develop/noise_generator.h:72
Definition jobs.c:51
Definition history.h:48
Definition printing.h:71
Definition libs/lib.h:78
Definition map_locations.h:46
Definition cups_print.h:70
Track one asynchronous Cairo surface fetch request for a GUI widget.
Definition views/view.h:124
dt_pthread_mutex_t lock
Definition views/view.h:125
int cached_height
Definition views/view.h:135
GWeakRef widget_ref
Definition views/view.h:127
int width
Definition views/view.h:130
gboolean commit_pending
Definition views/view.h:140
guint request_id
Definition views/view.h:138
int zoom
Definition views/view.h:132
gboolean job_queued
Definition views/view.h:141
int32_t imgid
Definition views/view.h:129
int height
Definition views/view.h:131
cairo_surface_t ** target
Definition views/view.h:128
gboolean destroying
Definition views/view.h:142
int cached_width
Definition views/view.h:134
int cached_zoom
Definition views/view.h:136
dt_atomic_int shutdown
Definition views/view.h:137
guint queued_request_id
Definition views/view.h:139
int32_t cached_imgid
Definition views/view.h:133
pthread_cond_t cond
Definition views/view.h:126
Definition views/view.h:206
GPid audio_player_pid
Definition views/view.h:221
guint audio_player_event_source
Definition views/view.h:223
dt_view_t * current_view
Definition views/view.h:208
int32_t audio_player_id
Definition views/view.h:222
GtkWidget * guides_popover
Definition views/view.h:227
int32_t image_info_id
Definition views/view.h:217
dt_darkroom_layout_t(* get_layout)(struct dt_view_t *view)
Definition views/view.h:252
struct dt_view_manager_t::@62 audio
GList * views
Definition views/view.h:207
struct dt_view_t * view
Definition views/view.h:251
struct dt_view_manager_t::@63::@66 darkroom
GtkWidget * guides_colors
Definition views/view.h:227
GtkWidget * guides
Definition views/view.h:227
struct dt_lib_module_t *void(* update)(struct dt_lib_module_t *)
Definition views/view.h:245
struct dt_view_manager_t::@63 proxy
GtkWidget * guides_toggle
Definition views/view.h:227
dt_history_copy_item_t copy_paste
Definition views/view.h:214
struct dt_view_manager_t::@63::@65 module_collect
GtkWidget * guides_contrast
Definition views/view.h:227
struct dt_view_manager_t::@63::@64 module_toolbox
struct dt_lib_module_t *void(* add)(struct dt_lib_module_t *, GtkWidget *, dt_view_type_flags_t)
Definition views/view.h:238
GList * active_images
Definition views/view.h:211
Definition views/view.h:156
float vscroll_viewport_size
Definition views/view.h:168
float vscroll_size
Definition views/view.h:168
float vscroll_pos
Definition views/view.h:168
uint32_t height
Definition views/view.h:166
float hscroll_size
Definition views/view.h:169
float vscroll_lower
Definition views/view.h:168
float hscroll_pos
Definition views/view.h:169
GModule *void * data
Definition views/view.h:164
uint32_t width
Definition views/view.h:166
char module_name[64]
Definition views/view.h:160
float hscroll_viewport_size
Definition views/view.h:169
float hscroll_lower
Definition views/view.h:169
void dt_view_image_surface_fetcher_invalidate(dt_view_image_surface_fetcher_t *fetcher, cairo_surface_t **target)
Definition views/view.c:866
dt_view_type_flags_t
Definition views/view.h:83
@ DT_VIEW_LIGHTTABLE
Definition views/view.h:84
@ DT_VIEW_PRINT
Definition views/view.h:88
@ DT_VIEW_SLIDESHOW
Definition views/view.h:87
@ DT_VIEW_MAP
Definition views/view.h:86
@ DT_VIEW_DARKROOM
Definition views/view.h:85
void dt_view_manager_cleanup(dt_view_manager_t *vm)
Definition views/view.c:131
void dt_view_image_surface_fetcher_cleanup(dt_view_image_surface_fetcher_t *fetcher)
Definition views/view.c:842
void dt_view_manager_mouse_moved(dt_view_manager_t *vm, double x, double y, double pressure, int which)
Definition views/view.c:520
const char * dt_view_manager_name(dt_view_manager_t *vm)
Definition views/view.c:436
dt_view_flags_t
Definition views/view.h:93
@ VIEW_FLAGS_NONE
Definition views/view.h:94
@ VIEW_FLAGS_HIDDEN
Definition views/view.h:95
void dt_view_manager_mouse_enter(dt_view_manager_t *vm)
Definition views/view.c:514
void dt_view_manager_configure(dt_view_manager_t *vm, int width, int height)
Definition views/view.c:628
void dt_view_manager_module_toolbox_add(dt_view_manager_t *vm, GtkWidget *tool, dt_view_type_flags_t view)
Definition views/view.c:1197
void dt_view_manager_reset(dt_view_manager_t *vm)
Definition views/view.c:486
void dt_view_image_surface_fetcher_init(dt_view_image_surface_fetcher_t *fetcher)
Definition views/view.c:831
gboolean dt_view_active_images_has_imgid(int32_t imgid)
Definition views/view.c:1173
int dt_view_manager_button_released(dt_view_manager_t *vm, double x, double y, int which, uint32_t state)
Definition views/view.c:569
void dt_view_manager_expose(dt_view_manager_t *vm, cairo_t *cr, int32_t width, int32_t height, int32_t pointerx, int32_t pointery)
Definition views/view.c:445
int dt_view_manager_key_pressed(dt_view_manager_t *vm, GdkEventKey *event)
Definition views/view.c:542
dt_view_surface_value_t dt_view_image_get_surface_async(dt_view_image_surface_fetcher_t *fetcher, int32_t imgid, int width, int height, cairo_surface_t **target, GtkWidget *widget, int zoom)
Definition views/view.c:881
dt_darkroom_layout_t
Definition views/view.h:99
@ DT_DARKROOM_LAYOUT_FIRST
Definition views/view.h:100
@ DT_DARKROOM_LAYOUT_LAST
Definition views/view.h:103
@ DT_DARKROOM_LAYOUT_COLOR_ASSESMENT
Definition views/view.h:102
@ DT_DARKROOM_LAYOUT_EDITING
Definition views/view.h:101
void dt_view_image_info_update(const int32_t imgid)
Definition views/view.c:1341
void dt_view_audio_start(dt_view_manager_t *vm, int32_t imgid)
Definition views/view.c:1285
int dt_view_manager_switch_by_view(dt_view_manager_t *vm, const dt_view_t *new_view)
Definition views/view.c:261
void dt_view_active_images_add(int32_t imgid, gboolean raise)
Definition views/view.c:1153
void dt_view_manager_init(dt_view_manager_t *vm)
Definition views/view.c:114
void dt_view_active_images_reset(gboolean raise)
Definition views/view.c:1144
dt_view_surface_value_t
Definition views/view.h:109
@ DT_VIEW_SURFACE_OK
Definition views/view.h:110
@ DT_VIEW_SURFACE_KO
Definition views/view.h:111
void dt_view_active_images_remove(int32_t imgid, gboolean raise)
Definition views/view.c:1161
int dt_view_manager_button_pressed(dt_view_manager_t *vm, double x, double y, double pressure, int which, int type, uint32_t state)
Definition views/view.c:596
GList * dt_view_active_images_get_all()
Definition views/view.c:1178
void dt_view_manager_gui_init(dt_view_manager_t *vm)
Definition views/view.c:122
dt_view_image_over_t
Definition views/view.h:173
@ DT_VIEW_STAR_4
Definition views/view.h:179
@ DT_VIEW_GROUP
Definition views/view.h:182
@ DT_VIEW_REJECT
Definition views/view.h:181
@ DT_VIEW_AUDIO
Definition views/view.h:183
@ DT_VIEW_STAR_5
Definition views/view.h:180
@ DT_VIEW_ERR
Definition views/view.h:174
@ DT_VIEW_STAR_3
Definition views/view.h:178
@ DT_VIEW_STAR_1
Definition views/view.h:176
@ DT_VIEW_STAR_2
Definition views/view.h:177
@ DT_VIEW_END
Definition views/view.h:185
@ DT_VIEW_ALTERED
Definition views/view.h:184
@ DT_VIEW_DESERT
Definition views/view.h:175
void dt_view_audio_stop(dt_view_manager_t *vm)
Definition views/view.c:1317
int dt_view_manager_switch(dt_view_manager_t *vm, const char *view_name)
Definition views/view.c:239
dt_view_surface_value_t dt_view_image_get_surface(int32_t imgid, int width, int height, cairo_surface_t **surface, int zoom)
Definition views/view.c:1092
int dt_view_manager_scrolled(dt_view_manager_t *vm, double x, double y, int up, int state, int delta_y)
Definition views/view.c:640
void dt_view_manager_mouse_leave(dt_view_manager_t *vm)
Definition views/view.c:492
void dt_view_active_images_set(GList *images, gboolean raise)
Definition views/view.c:1189
int32_t dt_view_active_images_get_first()
Definition views/view.c:1183
dt_darkroom_layout_t dt_view_darkroom_get_layout(dt_view_manager_t *vm)
Definition views/view.c:1203
const dt_view_t * dt_view_manager_get_current_view(dt_view_manager_t *vm)
Definition views/view.c:140
char * dt_view_extend_modes_str(const char *name, const gboolean is_hdr, const gboolean is_bw, const gboolean is_bw_flow)
Definition views/view.c:1098