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-2021 darktable developers.
4
5 darktable is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 darktable is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with darktable. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#pragma once
20
21#include "common/act_on.h"
22
23#include "common/history.h"
24#include "common/image.h"
25#ifdef HAVE_PRINT
26#include "common/cups_print.h"
27#include "common/printing.h"
28#endif
29#ifdef HAVE_MAP
30#include "common/geo.h"
32#include <osm-gps-map.h>
33#endif
34#include <cairo.h>
35#include <gmodule.h>
36#include <gui/gtk.h>
37#include <inttypes.h>
38#include <sqlite3.h>
39#ifdef USE_LUA
40#include "lua/call.h"
41#include "lua/events.h"
42#include "lua/modules.h"
43#include "lua/types.h"
44#include "lua/view.h"
45#endif
46
52typedef enum
53{
56 DT_VIEW_MAP = 1 << 3,
58 DT_VIEW_PRINT = 1 << 5,
60
61// flags that a view can set in flags()
62typedef enum dt_view_flags_t
63{
65 VIEW_FLAGS_HIDDEN = 1 << 0, // Hide the view from userinterface
67
75
76
77// flags that a view can set in flags()
83
84#define DT_VIEW_ALL \
85 (DT_VIEW_LIGHTTABLE | DT_VIEW_DARKROOM | DT_VIEW_TETHERING | DT_VIEW_MAP | DT_VIEW_SLIDESHOW | \
86 DT_VIEW_PRINT)
87
88/* maximum zoom factor for the lighttable */
89#define DT_LIGHTTABLE_MAX_ZOOM 12
90
94typedef struct dt_view_t
95{
96#define INCLUDE_API_FROM_MODULE_H
97#include "views/view_api.h"
98
99 char module_name[64];
100 // dlopened module
101 GModule *module;
102 // custom data for module
103 void *data;
104 // width and height of allocation
105 uint32_t width, height;
106 // scroll bar control
110
126
128char* dt_view_extend_modes_str(const char * name, const gboolean is_hdr, const gboolean is_bw, const gboolean is_bw_flow);
130dt_view_surface_value_t dt_view_image_get_surface(int32_t imgid, int width, int height, cairo_surface_t **surface,
131 int zoom);
132
133
138typedef struct dt_view_manager_t
139{
140 GList *views;
142
143 // images currently active in the main view (there can be more than 1 in culling)
145
146 // copy/paste history structure
148
149 // The imgid of the image for which we currently show the image info
151
152 struct
153 {
154 GPid audio_player_pid; // the pid of the child process
155 int32_t audio_player_id; // the imgid of the image the audio is played for
158
159 // toggle button for guides (in the module toolbox)
161
162 /*
163 * Proxy
164 */
165 struct
166 {
167 /* module toolbox proxy object */
168 struct
169 {
170 struct dt_lib_module_t *module;
171 void (*add)(struct dt_lib_module_t *, GtkWidget *, dt_view_type_flags_t);
173
174 /* module collection proxy object */
175 struct
176 {
177 struct dt_lib_module_t *module;
180
181 /* darkroom view proxy object */
182 struct
183 {
187
188/* map view proxy object */
189#ifdef HAVE_MAP
190 struct
191 {
192 struct dt_view_t *view;
193 void (*center_on_location)(const dt_view_t *view, gdouble lon, gdouble lat, double zoom);
194 void (*center_on_bbox)(const dt_view_t *view, gdouble lon1, gdouble lat1, gdouble lon2, gdouble lat2);
195 void (*show_osd)(const dt_view_t *view);
196 void (*set_map_source)(const dt_view_t *view, OsmGpsMapSource_t map_source);
197 GObject *(*add_marker)(const dt_view_t *view, dt_geo_map_display_t type, GList *points);
198 gboolean (*remove_marker)(const dt_view_t *view, dt_geo_map_display_t type, GObject *marker);
199 void (*add_location)(const dt_view_t *view, dt_map_location_data_t *p, const guint posid);
200 void (*location_action)(const dt_view_t *view, const int action);
201 void (*drag_set_icon)(const dt_view_t *view, GdkDragContext *context, const int32_t imgid, const int count);
202 gboolean (*redraw)(gpointer user_data);
203 gboolean (*display_selected)(gpointer user_data);
204 } map;
205#endif
206
207 /* map view proxy object */
208#ifdef HAVE_PRINT
209 struct
210 {
211 struct dt_view_t *view;
212 void (*print_settings)(const dt_view_t *view, dt_print_info_t *pinfo, dt_images_box *imgs);
213 } print;
214#endif
216
217
219
223
227int dt_view_manager_switch(dt_view_manager_t *vm, const char *view_name);
230void dt_view_manager_expose(dt_view_manager_t *vm, cairo_t *cr, int32_t width, int32_t height,
231 int32_t pointerx, int32_t pointery);
236
239void dt_view_manager_mouse_moved(dt_view_manager_t *vm, double x, double y, double pressure, int which);
240int dt_view_manager_button_released(dt_view_manager_t *vm, double x, double y, int which, uint32_t state);
241int dt_view_manager_button_pressed(dt_view_manager_t *vm, double x, double y, double pressure, int which,
242 int type, uint32_t state);
243int dt_view_manager_key_pressed(dt_view_manager_t *vm, GdkEventKey *event);
245int dt_view_manager_scrolled(dt_view_manager_t *vm, double x, double y, int up, int state);
246
249
250void dt_view_image_info_update(const int32_t imgid);
251
252// active images functions
253void dt_view_active_images_reset(gboolean raise);
254void dt_view_active_images_set(GList *images, gboolean raise);
255void dt_view_active_images_add(int32_t imgid, gboolean raise);
256void dt_view_active_images_remove(int32_t imgid, gboolean raise);
257gboolean dt_view_active_images_has_imgid(int32_t imgid);
258
261
264
265/* audio */
266void dt_view_audio_start(dt_view_manager_t *vm, int32_t imgid);
268
269/*
270 * Map View Proxy
271 */
272#ifdef HAVE_MAP
273void dt_view_map_center_on_location(const dt_view_manager_t *vm, gdouble lon, gdouble lat, gdouble zoom);
274void dt_view_map_center_on_bbox(const dt_view_manager_t *vm, gdouble lon1, gdouble lat1, gdouble lon2, gdouble lat2);
275void dt_view_map_show_osd(const dt_view_manager_t *vm);
276void dt_view_map_set_map_source(const dt_view_manager_t *vm, OsmGpsMapSource_t map_source);
277GObject *dt_view_map_add_marker(const dt_view_manager_t *vm, dt_geo_map_display_t type, GList *points);
278gboolean dt_view_map_remove_marker(const dt_view_manager_t *vm, dt_geo_map_display_t type, GObject *marker);
279void dt_view_map_add_location(const dt_view_manager_t *vm, dt_map_location_data_t *p, const guint posid);
280void dt_view_map_location_action(const dt_view_manager_t *vm, const int action);
281void dt_view_map_drag_set_icon(const dt_view_manager_t *vm, GdkDragContext *context, const int32_t imgid, const int count);
282#endif
283
284/*
285 * Print View Proxy
286 */
287#ifdef HAVE_PRINT
288void dt_view_print_settings(const dt_view_manager_t *vm, dt_print_info_t *pinfo, dt_images_box *imgs);
289#endif
290
291// clang-format off
292// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
293// vim: shiftwidth=2 expandtab tabstop=2 cindent
294// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
295// clang-format on
int width
Definition bilateral.h:1
int height
Definition bilateral.h:1
typedef void((*dt_cache_allocate_t)(void *userdata, dt_cache_entry_t *entry))
int type
Definition common/metadata.c:42
char * name
Definition common/metadata.c:41
uint32_t view(const dt_view_t *self)
Definition darkroom.c:114
dt_geo_map_display_t
Definition geo.h:22
float lat
Definition location.c:3
float lon
Definition location.c:2
Definition history.h:53
Definition printing.h:63
Definition libs/lib.h:75
Definition map_locations.h:42
Definition cups_print.h:65
Definition views/view.h:139
GPid audio_player_pid
Definition views/view.h:154
guint audio_player_event_source
Definition views/view.h:156
dt_view_t * current_view
Definition views/view.h:141
int32_t audio_player_id
Definition views/view.h:155
GtkWidget * guides_popover
Definition views/view.h:160
struct dt_view_manager_t::@57 proxy
int32_t image_info_id
Definition views/view.h:150
dt_darkroom_layout_t(* get_layout)(struct dt_view_t *view)
Definition views/view.h:185
GList * views
Definition views/view.h:140
struct dt_view_manager_t::@57::@58 module_toolbox
struct dt_view_t * view
Definition views/view.h:184
GtkWidget * guides_colors
Definition views/view.h:160
GtkWidget * guides
Definition views/view.h:160
struct dt_lib_module_t *void(* update)(struct dt_lib_module_t *)
Definition views/view.h:178
GtkWidget * guides_toggle
Definition views/view.h:160
dt_history_copy_item_t copy_paste
Definition views/view.h:147
GtkWidget * guides_contrast
Definition views/view.h:160
struct dt_lib_module_t *void(* add)(struct dt_lib_module_t *, GtkWidget *, dt_view_type_flags_t)
Definition views/view.h:171
struct dt_view_manager_t::@57::@60 darkroom
struct dt_view_manager_t::@56 audio
struct dt_view_manager_t::@57::@59 module_collect
GList * active_images
Definition views/view.h:144
Definition views/view.h:95
float vscroll_viewport_size
Definition views/view.h:107
float vscroll_size
Definition views/view.h:107
float vscroll_pos
Definition views/view.h:107
uint32_t height
Definition views/view.h:105
float hscroll_size
Definition views/view.h:108
float vscroll_lower
Definition views/view.h:107
float hscroll_pos
Definition views/view.h:108
GModule *void * data
Definition views/view.h:103
uint32_t width
Definition views/view.h:105
char module_name[64]
Definition views/view.h:99
float hscroll_viewport_size
Definition views/view.h:108
float hscroll_lower
Definition views/view.h:108
dt_view_type_flags_t
Definition views/view.h:53
@ DT_VIEW_LIGHTTABLE
Definition views/view.h:54
@ DT_VIEW_PRINT
Definition views/view.h:58
@ DT_VIEW_SLIDESHOW
Definition views/view.h:57
@ DT_VIEW_MAP
Definition views/view.h:56
@ DT_VIEW_DARKROOM
Definition views/view.h:55
void dt_view_manager_cleanup(dt_view_manager_t *vm)
Definition views/view.c:88
void dt_view_manager_mouse_moved(dt_view_manager_t *vm, double x, double y, double pressure, int which)
Definition views/view.c:478
const char * dt_view_manager_name(dt_view_manager_t *vm)
Definition views/view.c:394
dt_view_flags_t
Definition views/view.h:63
@ VIEW_FLAGS_NONE
Definition views/view.h:64
@ VIEW_FLAGS_HIDDEN
Definition views/view.h:65
void dt_view_manager_mouse_enter(dt_view_manager_t *vm)
Definition views/view.c:472
void dt_view_manager_configure(dt_view_manager_t *vm, int width, int height)
Definition views/view.c:586
void dt_view_manager_module_toolbox_add(dt_view_manager_t *vm, GtkWidget *tool, dt_view_type_flags_t view)
Definition views/view.c:890
void dt_view_manager_reset(dt_view_manager_t *vm)
Definition views/view.c:444
gboolean dt_view_active_images_has_imgid(int32_t imgid)
Definition views/view.c:866
int dt_view_manager_button_released(dt_view_manager_t *vm, double x, double y, int which, uint32_t state)
Definition views/view.c:527
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:403
int dt_view_manager_key_pressed(dt_view_manager_t *vm, GdkEventKey *event)
Definition views/view.c:500
dt_darkroom_layout_t
Definition views/view.h:69
@ DT_DARKROOM_LAYOUT_FIRST
Definition views/view.h:70
@ DT_DARKROOM_LAYOUT_LAST
Definition views/view.h:73
@ DT_DARKROOM_LAYOUT_COLOR_ASSESMENT
Definition views/view.h:72
@ DT_DARKROOM_LAYOUT_EDITING
Definition views/view.h:71
void dt_view_image_info_update(const int32_t imgid)
Definition views/view.c:1034
void dt_view_audio_start(dt_view_manager_t *vm, int32_t imgid)
Definition views/view.c:978
int dt_view_manager_switch_by_view(dt_view_manager_t *vm, const dt_view_t *new_view)
Definition views/view.c:219
void dt_view_active_images_add(int32_t imgid, gboolean raise)
Definition views/view.c:846
void dt_view_manager_init(dt_view_manager_t *vm)
Definition views/view.c:59
void dt_view_active_images_reset(gboolean raise)
Definition views/view.c:837
dt_view_surface_value_t
Definition views/view.h:79
@ DT_VIEW_SURFACE_OK
Definition views/view.h:80
@ DT_VIEW_SURFACE_KO
Definition views/view.h:81
void dt_view_active_images_remove(int32_t imgid, gboolean raise)
Definition views/view.c:854
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:554
GList * dt_view_active_images_get_all()
Definition views/view.c:871
void dt_view_manager_gui_init(dt_view_manager_t *vm)
Definition views/view.c:79
dt_view_image_over_t
Definition views/view.h:112
@ DT_VIEW_STAR_4
Definition views/view.h:118
@ DT_VIEW_GROUP
Definition views/view.h:121
@ DT_VIEW_REJECT
Definition views/view.h:120
@ DT_VIEW_AUDIO
Definition views/view.h:122
@ DT_VIEW_STAR_5
Definition views/view.h:119
@ DT_VIEW_ERR
Definition views/view.h:113
@ DT_VIEW_STAR_3
Definition views/view.h:117
@ DT_VIEW_STAR_1
Definition views/view.h:115
@ DT_VIEW_STAR_2
Definition views/view.h:116
@ DT_VIEW_END
Definition views/view.h:124
@ DT_VIEW_ALTERED
Definition views/view.h:123
@ DT_VIEW_DESERT
Definition views/view.h:114
void dt_view_audio_stop(dt_view_manager_t *vm)
Definition views/view.c:1010
int dt_view_manager_switch(dt_view_manager_t *vm, const char *view_name)
Definition views/view.c:197
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:606
int dt_view_manager_scrolled(dt_view_manager_t *vm, double x, double y, int up, int state)
Definition views/view.c:598
void dt_view_manager_mouse_leave(dt_view_manager_t *vm)
Definition views/view.c:450
void dt_view_active_images_set(GList *images, gboolean raise)
Definition views/view.c:882
int32_t dt_view_active_images_get_first()
Definition views/view.c:876
dt_darkroom_layout_t dt_view_darkroom_get_layout(dt_view_manager_t *vm)
Definition views/view.c:896
const dt_view_t * dt_view_manager_get_current_view(dt_view_manager_t *vm)
Definition views/view.c:96
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:791