Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
thumbnail.h
Go to the documentation of this file.
1/*
2 This file is part of darktable,
3 Copyright (C) 2010-2011 Henrik Andersson.
4 Copyright (C) 2010, 2012 johannes hanika.
5 Copyright (C) 2012 Richard Wonka.
6 Copyright (C) 2013, 2021 Pascal Obry.
7 Copyright (C) 2014, 2016, 2020 Tobias Ellinghaus.
8 Copyright (C) 2018 Rick Yorgason.
9 Copyright (C) 2019 Philippe Weyland.
10 Copyright (C) 2020-2021 Aldric Renaudin.
11 Copyright (C) 2020 Hanno Schwalm.
12 Copyright (C) 2020 Tianhao Chai.
13 Copyright (C) 2021 Fabio Heer.
14 Copyright (C) 2021 luzpaz.
15 Copyright (C) 2022-2023, 2025-2026 Aurélien PIERRE.
16 Copyright (C) 2022 Martin Bařinka.
17 Copyright (C) 2022 Nicolas Auffray.
18
19 darktable is free software: you can redistribute it and/or modify
20 it under the terms of the GNU General Public License as published by
21 the Free Software Foundation, either version 3 of the License, or
22 (at your option) any later version.
23
24 darktable is distributed in the hope that it will be useful,
25 but WITHOUT ANY WARRANTY; without even the implied warranty of
26 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 GNU General Public License for more details.
28
29 You should have received a copy of the GNU General Public License
30 along with darktable. If not, see <http://www.gnu.org/licenses/>.
31*/
34#ifndef DT_GUI_DTGTK_THUMBNAIL_H
35#define DT_GUI_DTGTK_THUMBNAIL_H
36
37#include "system/atomic.h"
38#include "common/debug.h"
39#include "common/logging.h"
41
42#include <glib.h>
43#include <gtk/gtk.h>
44
45#define MAX_STARS 5
46
47struct dt_thumbtable_t;
48
57
65
66
67typedef struct
68{
69 int32_t rowid;
70 int width, height; // current thumb size (with the background and the border)
71 int x, y; // current position at screen
72 int img_width, img_height; // current image size (can be greater than the image box in case of zoom)
73
74 gboolean mouse_over;
75 gboolean selected;
76
78
79 // all widget components
80 GtkWidget *widget; // GtkEventbox -- parent of all others
81 GtkWidget *w_main; // GtkOverlay --
82 GtkWidget *w_background; // GtkBox, because a GtkOverlay can't get styling apparently
83 GtkWidget *w_ext; // GtkLabel -- thumbnail extension
84
85 GtkWidget *w_image; // GtkDrawingArea -- thumbnail image
86 cairo_surface_t *img_surf; // cached surface at exact dimensions to speed up redraw
87
88 GtkWidget *w_cursor; // GtkDrawingArea -- triangle to show current image(s) in filmstrip
89 GtkWidget *w_bottom_eb; // GtkEventBox -- background of the bottom infos area (contains w_bottom)
90 GtkWidget *w_reject; // GtkDarktableThumbnailBtn -- Reject icon
91 GtkWidget *w_stars[MAX_STARS]; // GtkDarktableThumbnailBtn -- Stars icons
92 GtkWidget *w_color; // GtkDarktableThumbnailBtn -- Colorlabels "flower" icon
93
95 GtkWidget *w_local_copy; // GtkDarktableThumbnailBtn -- localcopy triangle
96 GtkWidget *w_altered; // GtkDarktableThumbnailBtn -- Altered icon
97 GtkWidget *w_group; // GtkDarktableThumbnailBtn -- Grouping icon
98 GtkWidget *w_audio; // GtkDarktableThumbnailBtn -- Audio sidecar icon
99
100 GtkWidget *w_alternative; // alternative overlay
101
102 dt_thumbnail_border_t group_borders; // which group borders should be drawn
103
104 gboolean disable_mouseover; // do we allow to change mouseoverid by mouse move
105 gboolean disable_actions; // do we allow to change rating/etc...
106
107 dt_thumbnail_overlay_t over; // type of overlays
108
109 // difference between the global zoom values and the value to apply to this specific thumbnail
110 double zoomx; // zoom panning of the image
111 double zoomy; //
114 gboolean dragging;
115
116 struct dt_thumbtable_t *table; // convenience reference to the parent
117
118 // Set FALSE when the thumbnail size changed, set TRUE when we have a Cairo image surface for that size
119 gboolean image_inited;
120
130
131 dt_pthread_mutex_t lock;
132 struct _dt_job_t *job;
135
136 // Thumbnail actual image sizes (bounding box of GUI widget)
137 int img_w;
138 int img_h;
139
141
143 dt_image_t *info);
146void dt_thumbnail_resize(dt_thumbnail_t *thumb, int width, int height);
148void dt_thumbnail_set_mouseover(dt_thumbnail_t *thumb, gboolean over);
150
151// set if the thumbnail should react (mouse_over) to drag and drop
152// note that it's just cosmetic as dropping occurs in thumbtable in any case
153void dt_thumbnail_set_drop(dt_thumbnail_t *thumb, gboolean accept_drop);
154
155// Resync cached image info for this thumbnail with any arbitrary new info
156void dt_thumbnail_resync_info(dt_thumbnail_t *thumb, const dt_image_t *const info);
157
158// Full update of the image information and update icons accordingly, using the image cache
160
161// check if the image is selected and set its state and background
163
164// force image recomputing
166#define dt_thumbnail_image_refresh(thumb) DT_DEBUG_TRACE_WRAPPER(DT_DEBUG_LIGHTTABLE, dt_thumbnail_image_refresh_real, (thumb))
167
169
170// If prefetching, Gtk won't redraw the invisible thumbnails so we need to manually call this ahead.
171// Return 1 on error.
173
178
179#endif // DT_GUI_DTGTK_THUMBNAIL_H
180
181// clang-format off
182// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
183// vim: shiftwidth=2 expandtab tabstop=2 cindent
184// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
185// clang-format on
atomic_int dt_atomic_int
Definition atomic.h:68
struct _GtkWidget GtkWidget
GtkWidget, opaque, spelled exactly as GTK spells it.
Definition colorspaces.h:98
Call tracing for functions you do not want to edit every caller of.
GHashTable * selected
set of checked row labels, mirrored to conf on every change
static gboolean enable(const dt_image_t *image)
Definition highlights.c:879
uint32_t width
Definition mipmap_cache.c:0
uint32_t height
Definition mipmap_cache.c:1
gboolean mouse_over
Definition thumbnail.h:74
GtkWidget * w_color
Definition thumbnail.h:92
dt_pthread_mutex_t lock
Definition thumbnail.h:131
GtkWidget * w_alternative
Definition thumbnail.h:100
GtkWidget * w_local_copy
Definition thumbnail.h:95
GtkWidget * w_folder
Definition thumbnail.h:129
gboolean dragging
Definition thumbnail.h:114
gboolean disable_actions
Definition thumbnail.h:105
GtkWidget * w_exposure_bias
Definition thumbnail.h:123
dt_image_t info
Definition thumbnail.h:77
dt_atomic_int ref_count
Definition thumbnail.h:134
GtkWidget * w_ext
Definition thumbnail.h:83
GtkWidget * w_datetime
Definition thumbnail.h:126
dt_atomic_int destroying
Definition thumbnail.h:133
GtkWidget * w_camera
Definition thumbnail.h:124
GtkWidget * w_main
Definition thumbnail.h:81
gboolean selected
Definition thumbnail.h:75
dt_thumbnail_border_t group_borders
Definition thumbnail.h:102
struct _dt_job_t * job
Definition thumbnail.h:132
int32_t rowid
Definition thumbnail.h:69
GtkWidget * w_group
Definition thumbnail.h:97
gboolean image_inited
Definition thumbnail.h:119
GtkWidget * w_exposure
Definition thumbnail.h:122
gboolean alternative_mode
Definition thumbnail.h:121
GtkWidget * w_audio
Definition thumbnail.h:98
GtkWidget * w_focal
Definition thumbnail.h:128
GtkWidget * w_background
Definition thumbnail.h:82
GtkWidget * w_top_eb
Definition thumbnail.h:94
GtkWidget * w_reject
Definition thumbnail.h:90
GtkWidget * w_lens
Definition thumbnail.h:127
double drag_x_start
Definition thumbnail.h:112
struct dt_thumbtable_t * table
Definition thumbnail.h:116
double drag_y_start
Definition thumbnail.h:113
GtkWidget * w_image
Definition thumbnail.h:85
dt_thumbnail_overlay_t over
Definition thumbnail.h:107
cairo_surface_t * img_surf
Definition thumbnail.h:86
GtkWidget * widget
Definition thumbnail.h:80
GtkWidget * w_altered
Definition thumbnail.h:96
GtkWidget * w_bottom_eb
Definition thumbnail.h:89
GtkWidget * w_cursor
Definition thumbnail.h:88
GtkWidget * w_filename
Definition thumbnail.h:125
gboolean disable_mouseover
Definition thumbnail.h:104
#define MIN(a, b)
Definition thinplate.c:32
void dt_thumbnail_set_drop(dt_thumbnail_t *thumb, gboolean accept_drop)
Definition thumbnail.c:1693
static dt_thumbnail_overlay_t sanitize_overlays(dt_thumbnail_overlay_t overlays)
Definition thumbnail.h:174
#define MAX_STARS
Definition thumbnail.h:45
dt_thumbnail_border_t
Definition thumbnail.h:50
@ DT_THUMBNAIL_BORDER_BOTTOM
Definition thumbnail.h:55
@ DT_THUMBNAIL_BORDER_NONE
Definition thumbnail.h:51
@ DT_THUMBNAIL_BORDER_TOP
Definition thumbnail.h:53
@ DT_THUMBNAIL_BORDER_RIGHT
Definition thumbnail.h:54
@ DT_THUMBNAIL_BORDER_LEFT
Definition thumbnail.h:52
dt_thumbnail_t * dt_thumbnail_new(int rowid, dt_thumbnail_overlay_t over, struct dt_thumbtable_t *table, dt_image_t *info)
Definition thumbnail.c:1391
void dt_thumbnail_set_mouseover(dt_thumbnail_t *thumb, gboolean over)
Definition thumbnail.c:1676
GtkWidget * dt_thumbnail_create_widget(dt_thumbnail_t *thumb)
Definition thumbnail.c:1165
void dt_thumbnail_resync_info(dt_thumbnail_t *thumb, const dt_image_t *const info)
Definition thumbnail.c:1371
void dt_thumbnail_set_overlay(dt_thumbnail_t *thumb, dt_thumbnail_overlay_t mode)
Definition thumbnail.c:1508
void dt_thumbnail_set_group_border(dt_thumbnail_t *thumb, dt_thumbnail_border_t border)
Definition thumbnail.c:1651
int dt_thumbnail_destroy(dt_thumbnail_t *thumb)
Definition thumbnail.c:1419
int dt_thumbnail_image_refresh_real(dt_thumbnail_t *thumb)
Definition thumbnail.c:1704
void dt_thumbnail_update_gui(dt_thumbnail_t *thumb)
Definition thumbnail.c:1494
void dt_thumbnail_update_selection(dt_thumbnail_t *thumb, gboolean selected)
Definition thumbnail.c:923
void dt_thumbnail_alternative_mode(dt_thumbnail_t *thumb, gboolean enable)
Definition thumbnail.c:964
dt_thumbnail_overlay_t
Definition thumbnail.h:59
@ DT_THUMBNAIL_OVERLAYS_HOVER_NORMAL
Definition thumbnail.h:61
@ DT_THUMBNAIL_OVERLAYS_ALWAYS_NORMAL
Definition thumbnail.h:62
@ DT_THUMBNAIL_OVERLAYS_NONE
Definition thumbnail.h:60
@ DT_THUMBNAIL_OVERLAYS_LAST
Definition thumbnail.h:63
void dt_thumbnail_resize(dt_thumbnail_t *thumb, int width, int height)
Definition thumbnail.c:1606
int dt_thumbnail_get_image_buffer(dt_thumbnail_t *thumb)
Definition thumbnail.c:618