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
51#include "common/history.h"
52#include "common/image.h"
53#ifdef HAVE_PRINT
54#include "common/cups_print.h"
55#include "common/printing.h"
56#endif
57#ifdef HAVE_MAP
58#include "common/geo.h"
60#include <osm-gps-map.h>
61#endif
62#include <cairo.h>
63#include <gmodule.h>
64#include <gui/gtk.h>
65#include <inttypes.h>
66#include <sqlite3.h>
67#ifdef USE_LUA
68#include "lua/call.h"
69#include "lua/events.h"
70#include "lua/modules.h"
71#include "lua/types.h"
72#include "lua/view.h"
73#endif
74
80typedef enum
81{
84 DT_VIEW_MAP = 1 << 3,
86 DT_VIEW_PRINT = 1 << 5,
88
89// flags that a view can set in flags()
90typedef enum dt_view_flags_t
91{
93 VIEW_FLAGS_HIDDEN = 1 << 0, // Hide the view from userinterface
95
103
104
105// flags that a view can set in flags()
111
112#define DT_VIEW_ALL \
113 (DT_VIEW_LIGHTTABLE | DT_VIEW_DARKROOM | DT_VIEW_TETHERING | DT_VIEW_MAP | DT_VIEW_SLIDESHOW | \
114 DT_VIEW_PRINT)
115
116/* maximum zoom factor for the lighttable */
117#define DT_LIGHTTABLE_MAX_ZOOM 12
118
122typedef struct dt_view_t
123{
124#define INCLUDE_API_FROM_MODULE_H
125#include "views/view_api.h"
126
127 char module_name[64];
128 // dlopened module
129 GModule *module;
130 // custom data for module
131 void *data;
132 // width and height of allocation
133 uint32_t width, height;
134 // scroll bar control
138
154
156char* dt_view_extend_modes_str(const char * name, const gboolean is_hdr, const gboolean is_bw, const gboolean is_bw_flow);
158dt_view_surface_value_t dt_view_image_get_surface(int32_t imgid, int width, int height, cairo_surface_t **surface,
159 int zoom);
160
161
166typedef struct dt_view_manager_t
167{
168 GList *views;
170
171 // images currently active in the main view (there can be more than 1 in culling)
173
174 // copy/paste history structure
176
177 // The imgid of the image for which we currently show the image info
179
180 struct
181 {
182 GPid audio_player_pid; // the pid of the child process
183 int32_t audio_player_id; // the imgid of the image the audio is played for
186
187 // toggle button for guides (in the module toolbox)
189
190 /*
191 * Proxy
192 */
193 struct
194 {
195 /* module toolbox proxy object */
196 struct
197 {
198 struct dt_lib_module_t *module;
201
202 /* module collection proxy object */
203 struct
204 {
205 struct dt_lib_module_t *module;
208
209 /* darkroom view proxy object */
210 struct
211 {
215
216/* map view proxy object */
217#ifdef HAVE_MAP
218 struct
219 {
220 struct dt_view_t *view;
221 void (*center_on_location)(const dt_view_t *view, gdouble lon, gdouble lat, double zoom);
222 void (*center_on_bbox)(const dt_view_t *view, gdouble lon1, gdouble lat1, gdouble lon2, gdouble lat2);
223 void (*show_osd)(const dt_view_t *view);
224 void (*set_map_source)(const dt_view_t *view, OsmGpsMapSource_t map_source);
225 GObject *(*add_marker)(const dt_view_t *view, dt_geo_map_display_t type, GList *points);
226 gboolean (*remove_marker)(const dt_view_t *view, dt_geo_map_display_t type, GObject *marker);
227 void (*add_location)(const dt_view_t *view, dt_map_location_data_t *p, const guint posid);
228 void (*location_action)(const dt_view_t *view, const int action);
229 void (*drag_set_icon)(const dt_view_t *view, GdkDragContext *context, const int32_t imgid, const int count);
230 gboolean (*redraw)(gpointer user_data);
231 gboolean (*display_selected)(gpointer user_data);
232 } map;
233#endif
234
235 /* map view proxy object */
236#ifdef HAVE_PRINT
237 struct
238 {
239 struct dt_view_t *view;
240 void (*print_settings)(const dt_view_t *view, dt_print_info_t *pinfo, dt_images_box *imgs);
241 } print;
242#endif
244
245
247
251
255int dt_view_manager_switch(dt_view_manager_t *vm, const char *view_name);
258void dt_view_manager_expose(dt_view_manager_t *vm, cairo_t *cr, int32_t width, int32_t height,
259 int32_t pointerx, int32_t pointery);
264
267void dt_view_manager_mouse_moved(dt_view_manager_t *vm, double x, double y, double pressure, int which);
268int dt_view_manager_button_released(dt_view_manager_t *vm, double x, double y, int which, uint32_t state);
269int dt_view_manager_button_pressed(dt_view_manager_t *vm, double x, double y, double pressure, int which,
270 int type, uint32_t state);
271int dt_view_manager_key_pressed(dt_view_manager_t *vm, GdkEventKey *event);
273int dt_view_manager_scrolled(dt_view_manager_t *vm, double x, double y, int up, int state, int delta_y);
274
277
278void dt_view_image_info_update(const int32_t imgid);
279
280// active images functions
281void dt_view_active_images_reset(gboolean raise);
282void dt_view_active_images_set(GList *images, gboolean raise);
283void dt_view_active_images_add(int32_t imgid, gboolean raise);
284void dt_view_active_images_remove(int32_t imgid, gboolean raise);
285gboolean dt_view_active_images_has_imgid(int32_t imgid);
286
289
292
293/* audio */
294void dt_view_audio_start(dt_view_manager_t *vm, int32_t imgid);
296
297/*
298 * Map View Proxy
299 */
300#ifdef HAVE_MAP
301void dt_view_map_center_on_location(const dt_view_manager_t *vm, gdouble lon, gdouble lat, gdouble zoom);
302void dt_view_map_center_on_bbox(const dt_view_manager_t *vm, gdouble lon1, gdouble lat1, gdouble lon2, gdouble lat2);
303void dt_view_map_show_osd(const dt_view_manager_t *vm);
304void dt_view_map_set_map_source(const dt_view_manager_t *vm, OsmGpsMapSource_t map_source);
305GObject *dt_view_map_add_marker(const dt_view_manager_t *vm, dt_geo_map_display_t type, GList *points);
306gboolean dt_view_map_remove_marker(const dt_view_manager_t *vm, dt_geo_map_display_t type, GObject *marker);
307void dt_view_map_add_location(const dt_view_manager_t *vm, dt_map_location_data_t *p, const guint posid);
308void dt_view_map_location_action(const dt_view_manager_t *vm, const int action);
309void dt_view_map_drag_set_icon(const dt_view_manager_t *vm, GdkDragContext *context, const int32_t imgid, const int count);
310#endif
311
312/*
313 * Print View Proxy
314 */
315#ifdef HAVE_PRINT
316void dt_view_print_settings(const dt_view_manager_t *vm, dt_print_info_t *pinfo, dt_images_box *imgs);
317#endif
318
319// clang-format off
320// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
321// vim: shiftwidth=2 expandtab tabstop=2 cindent
322// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
323// clang-format on
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:315
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:194
dt_geo_map_display_t
Definition geo.h:25
static const float x
Definition iop_profile.h:239
float lat
Definition location.c:3
float lon
Definition location.c:2
struct _GtkWidget GtkWidget
Definition splash.h:29
Definition history.h:48
Definition printing.h:71
Definition libs/lib.h:78
Definition map_locations.h:46
Definition cups_print.h:70
Definition views/view.h:167
GPid audio_player_pid
Definition views/view.h:182
guint audio_player_event_source
Definition views/view.h:184
dt_view_t * current_view
Definition views/view.h:169
int32_t audio_player_id
Definition views/view.h:183
GtkWidget * guides_popover
Definition views/view.h:188
struct dt_view_manager_t::@64::@65 module_toolbox
struct dt_view_manager_t::@64::@67 darkroom
int32_t image_info_id
Definition views/view.h:178
dt_darkroom_layout_t(* get_layout)(struct dt_view_t *view)
Definition views/view.h:213
GList * views
Definition views/view.h:168
struct dt_view_t * view
Definition views/view.h:212
GtkWidget * guides_colors
Definition views/view.h:188
GtkWidget * guides
Definition views/view.h:188
struct dt_lib_module_t *void(* update)(struct dt_lib_module_t *)
Definition views/view.h:206
GtkWidget * guides_toggle
Definition views/view.h:188
dt_history_copy_item_t copy_paste
Definition views/view.h:175
GtkWidget * guides_contrast
Definition views/view.h:188
struct dt_view_manager_t::@63 audio
struct dt_view_manager_t::@64 proxy
struct dt_view_manager_t::@64::@66 module_collect
struct dt_lib_module_t *void(* add)(struct dt_lib_module_t *, GtkWidget *, dt_view_type_flags_t)
Definition views/view.h:199
GList * active_images
Definition views/view.h:172
Definition views/view.h:123
float vscroll_viewport_size
Definition views/view.h:135
float vscroll_size
Definition views/view.h:135
float vscroll_pos
Definition views/view.h:135
uint32_t height
Definition views/view.h:133
float hscroll_size
Definition views/view.h:136
float vscroll_lower
Definition views/view.h:135
float hscroll_pos
Definition views/view.h:136
GModule *void * data
Definition views/view.h:131
uint32_t width
Definition views/view.h:133
char module_name[64]
Definition views/view.h:127
float hscroll_viewport_size
Definition views/view.h:136
float hscroll_lower
Definition views/view.h:136
dt_view_type_flags_t
Definition views/view.h:81
@ DT_VIEW_LIGHTTABLE
Definition views/view.h:82
@ DT_VIEW_PRINT
Definition views/view.h:86
@ DT_VIEW_SLIDESHOW
Definition views/view.h:85
@ DT_VIEW_MAP
Definition views/view.h:84
@ DT_VIEW_DARKROOM
Definition views/view.h:83
void dt_view_manager_cleanup(dt_view_manager_t *vm)
Definition views/view.c:130
void dt_view_manager_mouse_moved(dt_view_manager_t *vm, double x, double y, double pressure, int which)
Definition views/view.c:519
const char * dt_view_manager_name(dt_view_manager_t *vm)
Definition views/view.c:435
dt_view_flags_t
Definition views/view.h:91
@ VIEW_FLAGS_NONE
Definition views/view.h:92
@ VIEW_FLAGS_HIDDEN
Definition views/view.h:93
void dt_view_manager_mouse_enter(dt_view_manager_t *vm)
Definition views/view.c:513
void dt_view_manager_configure(dt_view_manager_t *vm, int width, int height)
Definition views/view.c:627
void dt_view_manager_module_toolbox_add(dt_view_manager_t *vm, GtkWidget *tool, dt_view_type_flags_t view)
Definition views/view.c:910
void dt_view_manager_reset(dt_view_manager_t *vm)
Definition views/view.c:485
gboolean dt_view_active_images_has_imgid(int32_t imgid)
Definition views/view.c:886
int dt_view_manager_button_released(dt_view_manager_t *vm, double x, double y, int which, uint32_t state)
Definition views/view.c:568
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:444
int dt_view_manager_key_pressed(dt_view_manager_t *vm, GdkEventKey *event)
Definition views/view.c:541
dt_darkroom_layout_t
Definition views/view.h:97
@ DT_DARKROOM_LAYOUT_FIRST
Definition views/view.h:98
@ DT_DARKROOM_LAYOUT_LAST
Definition views/view.h:101
@ DT_DARKROOM_LAYOUT_COLOR_ASSESMENT
Definition views/view.h:100
@ DT_DARKROOM_LAYOUT_EDITING
Definition views/view.h:99
void dt_view_image_info_update(const int32_t imgid)
Definition views/view.c:1054
void dt_view_audio_start(dt_view_manager_t *vm, int32_t imgid)
Definition views/view.c:998
int dt_view_manager_switch_by_view(dt_view_manager_t *vm, const dt_view_t *new_view)
Definition views/view.c:260
void dt_view_active_images_add(int32_t imgid, gboolean raise)
Definition views/view.c:866
void dt_view_manager_init(dt_view_manager_t *vm)
Definition views/view.c:113
void dt_view_active_images_reset(gboolean raise)
Definition views/view.c:857
dt_view_surface_value_t
Definition views/view.h:107
@ DT_VIEW_SURFACE_OK
Definition views/view.h:108
@ DT_VIEW_SURFACE_KO
Definition views/view.h:109
void dt_view_active_images_remove(int32_t imgid, gboolean raise)
Definition views/view.c:874
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:595
GList * dt_view_active_images_get_all()
Definition views/view.c:891
void dt_view_manager_gui_init(dt_view_manager_t *vm)
Definition views/view.c:121
dt_view_image_over_t
Definition views/view.h:140
@ DT_VIEW_STAR_4
Definition views/view.h:146
@ DT_VIEW_GROUP
Definition views/view.h:149
@ DT_VIEW_REJECT
Definition views/view.h:148
@ DT_VIEW_AUDIO
Definition views/view.h:150
@ DT_VIEW_STAR_5
Definition views/view.h:147
@ DT_VIEW_ERR
Definition views/view.h:141
@ DT_VIEW_STAR_3
Definition views/view.h:145
@ DT_VIEW_STAR_1
Definition views/view.h:143
@ DT_VIEW_STAR_2
Definition views/view.h:144
@ DT_VIEW_END
Definition views/view.h:152
@ DT_VIEW_ALTERED
Definition views/view.h:151
@ DT_VIEW_DESERT
Definition views/view.h:142
void dt_view_audio_stop(dt_view_manager_t *vm)
Definition views/view.c:1030
int dt_view_manager_switch(dt_view_manager_t *vm, const char *view_name)
Definition views/view.c:238
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:647
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:639
void dt_view_manager_mouse_leave(dt_view_manager_t *vm)
Definition views/view.c:491
void dt_view_active_images_set(GList *images, gboolean raise)
Definition views/view.c:902
int32_t dt_view_active_images_get_first()
Definition views/view.c:896
dt_darkroom_layout_t dt_view_darkroom_get_layout(dt_view_manager_t *vm)
Definition views/view.c:916
const dt_view_t * dt_view_manager_get_current_view(dt_view_manager_t *vm)
Definition views/view.c:139
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:811