Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
gtk.h
Go to the documentation of this file.
1/*
2 This file is part of darktable,
3 Copyright (C) 2009-2014 johannes hanika.
4 Copyright (C) 2010-2011, 2013 Henrik Andersson.
5 Copyright (C) 2011 Robert Bieber.
6 Copyright (C) 2011-2019 Tobias Ellinghaus.
7 Copyright (C) 2011, 2015 Ulrich Pegelow.
8 Copyright (C) 2012, 2014, 2019-2022 Aldric Renaudin.
9 Copyright (C) 2012 Richard Wonka.
10 Copyright (C) 2013, 2015, 2018-2022 Pascal Obry.
11 Copyright (C) 2013-2016, 2020 Roman Lebedev.
12 Copyright (C) 2013 Simon Spannagel.
13 Copyright (C) 2014 Mikhail Trishchenkov.
14 Copyright (C) 2014-2016, 2019 parafin.
15 Copyright (C) 2015, 2017 Jérémy Rosen.
16 Copyright (C) 2015 Pedro Côrte-Real.
17 Copyright (C) 2016-2017 Peter Budai.
18 Copyright (C) 2017-2018 Dan Torop.
19 Copyright (C) 2017-2018 Matthieu Moy.
20 Copyright (C) 2018 Heiko Bauke.
21 Copyright (C) 2018 Rikard Öxler.
22 Copyright (C) 2019-2020, 2022-2023, 2025 Aurélien PIERRE.
23 Copyright (C) 2019 Kevin Daudt.
24 Copyright (C) 2020 Bill Ferguson.
25 Copyright (C) 2020-2022 Chris Elston.
26 Copyright (C) 2020-2022 Diederik Ter Rahe.
27 Copyright (C) 2020 Hanno Schwalm.
28 Copyright (C) 2020 Harold le Clément de Saint-Marcq.
29 Copyright (C) 2020 Hubert Kowalski.
30 Copyright (C) 2020 Mark-64.
31 Copyright (C) 2020-2021 Philippe Weyland.
32 Copyright (C) 2021 Ralf Brown.
33 Copyright (C) 2022 luzpaz.
34 Copyright (C) 2022 Martin Bařinka.
35 Copyright (C) 2022 Nicolas Auffray.
36 Copyright (C) 2023 Luca Zulberti.
37 Copyright (C) 2025 Alynx Zhou.
38 Copyright (C) 2026 Guillaume Stutin.
39
40 darktable is free software: you can redistribute it and/or modify
41 it under the terms of the GNU General Public License as published by
42 the Free Software Foundation, either version 3 of the License, or
43 (at your option) any later version.
44
45 darktable is distributed in the hope that it will be useful,
46 but WITHOUT ANY WARRANTY; without even the implied warranty of
47 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
48 GNU General Public License for more details.
49
50 You should have received a copy of the GNU General Public License
51 along with darktable. If not, see <http://www.gnu.org/licenses/>.
52*/
53
54#pragma once
55
56#include "common/darktable.h"
57#include "common/dtpthread.h"
58#include "dtgtk/thumbtable.h"
59#include "gui/window_manager.h"
60#include "gui/accelerators.h"
61
62#include <gtk/gtk.h>
63#include <stdint.h>
64
65#ifdef __cplusplus
66extern "C" {
67#endif
68
69// Mouse hit-test radius in darkroom image space, clamped for usable overlay selection.
70#define DT_GUI_MOUSE_EFFECT_RADIUS darktable.gui->mouse.effect_radius_clamped
71
72/* Pixel scaling - two intents, chosen by the *destination sink* (not by platform).
73 * See doc/gui.md "Pixel scaling" for the full rationale.
74 *
75 * DT_UI_SCALE_UI: logical-px GUI sinks (gtk_widget_set_size_request, window default
76 * size, anything fed to a GTK widget geometry setter). GTK already multiplies these
77 * by the integer scale-factor (ppd) at render time, so we must NOT pre-apply ppd here;
78 * we only add the font/UI zoom carried by dpi_factor (the X11 Xft.dpi path).
79 *
80 * DT_UI_SCALE_DEVICE: raw device-pixel buffers (cairo image surfaces, pixbuf-at-size,
81 * mouse hit-test radii). The toolkit does not auto-scale these, so we carry both the
82 * UI zoom (dpi_factor) and the integer scale-factor (ppd) ourselves.
83 *
84 * Input values are device-independent pixels at the 96 DPI baseline. */
85#define DT_UI_SCALE_UI(value) ((value) * darktable.gui->dpi_factor)
86#define DT_UI_SCALE_DEVICE(value) ((value) * darktable.gui->dpi_factor * darktable.gui->ppd)
87
88/* Deprecated spellings kept so the existing call sites keep compiling. Prefer the
89 * intent-named macros above in new code. */
90#define DT_PIXEL_APPLY_DPI(value) DT_UI_SCALE_UI(value)
91#define DT_PIXEL_APPLY_DPI_DPP(value) DT_UI_SCALE_DEVICE(value)
92
93/* Spacing between children widgets within Gtk boxes/grids/flowboxes cannot be set from
94 * CSS (margins/paddings on the children would recess the ones sitting on the container
95 * edges relative to the inner ones). GTK exposes a "spacing" property for this, but only
96 * from code - so it is centralized here, in ONE place, for the whole app.
97 *
98 * It is expressed as a fraction of 1em (the resolved root font size, cached in
99 * darktable.gui->em by dt_gui_update_em()), so the inner gutters scale with the user's
100 * font size exactly like the em-based margins/paddings in ansel.css. 0.625em == 10px at
101 * the 16px reference font. Because the font's point->px conversion already folds in the
102 * screen DPI, this needs NO DT_PIXEL_APPLY_DPI on top.
103 *
104 * Falls back to the 10px reference before the GUI exists or before gui->em has
105 * been resolved. Standalone dialogs may run after gtk_init() but before the
106 * main Ansel GUI allocation when startup needs user input. */
107#define DT_GUI_EM_SIZE ((gint)((!IS_NULL_PTR(darktable.gui) && darktable.gui->em > 0.0) ? darktable.gui->em : 16.0))
108#define DT_GUI_BOX_SPACING_EM 0.625
109#define DT_GUI_BOX_SPACING \
110 ((gint)(DT_GUI_EM_SIZE * DT_GUI_BOX_SPACING_EM + 0.5))
111
112enum
113{
117
118typedef struct dt_gui_widgets_t
119{
120 /* left panel */
121 GtkGrid *panel_left; // panel grid 3 rows, top,center,bottom and file on center
122 GtkGrid *panel_right;
124
161
162typedef struct dt_gui_gtk_t
163{
164
166
168
169 cairo_surface_t *surface;
172
173 // Widget-callback suppression depth. PRIVATE: never touch directly -- go through
174 // dt_gui_freeze_begin()/end() / dt_gui_widget_freeze() / dt_gui_widgets_suppressed()
175 // (declared in common/darktable.h). Those manage it centrally: GUI-thread-only, clamped
176 // at >= 0, and unbalanced ends are logged instead of silently drifting the counter.
179
180 int32_t center_tooltip; // 0 = no tooltip, 1 = new tooltip, 2 = old tooltip
181
182 struct {
185 float velocity[2];
187 gboolean enabled;
190
191 // Culling mode is a special case of collection filter that is restricted to user selection
192 gboolean culling_mode;
193
194 // Track if the current selection has pushed on the backup copy
195 // see common/selection.h:dt_selection_push()
197
198 // Global accelerators for main menu, needed for GtkMenu mnemonics.
200
202
204
206
207 // Resolved root font size (1em) in device-independent px, read from the active
208 // theme/font by dt_gui_update_em(). Drives DT_GUI_BOX_SPACING so inner gutters
209 // track the font size like em-based CSS margins. 0.0 until first resolved.
210 double em;
211
212
213 struct {
214 // Raw mouse hit-test radius in display pixels
216 // Mouse hit-test radius coordinates, clamped for usable overlay selection.
218 gboolean is_dragging;
219 gboolean is_painting;
221
222 int icon_size; // size of top panel icons
223
224 // store which gtkrc we loaded:
226
227 GtkWidget *scroll_to[2]; // one for left, one for right
228 GtkWidget *scroll_to_header_once; // one-shot: module expander that should scroll to its header once
229
231
232 // scrolling focus
233 // This emulates the same feature as Gtk focus, but to capture scrolling events
235
236 cairo_filter_t filter_image; // filtering used for all modules expect darkroom
237 cairo_filter_t dr_filter_image; // filtering used in the darkroom
238
239 // Export popup window
240 struct {
242 GtkWidget *module;
244 struct {
246 GtkWidget *module;
248
249 dt_pthread_mutex_t mutex;
251
253{
254 GtkBox *parent; // the parent widget
255 const char *confname; // configuration name for the toggle status
256 GtkWidget *toggle; // toggle button
257 GtkWidget *expander; // the expanded
258 GtkBox *container; // the container for all widgets into the section
259 GtkWidget *label; // The section label
261
263{
264 // Auto-fit: the area shrinks to its content (up to the user/max height). Best for widgets
265 // updated rarely; their height following content is helpful, not disruptive.
267 // Fixed: the area keeps the user-set (or default) height regardless of content, so it never
268 // shifts the surrounding layout when its content changes. Best for widgets that refresh on
269 // hover/selection (tags, notes, metadata) and the collection/library list.
272
274{
275 char *config_str; // conf key persisting the user-chosen height (px); owned
276 int min_size; // minimum height floor in device pixels
277 int last_height; // last applied bare (pre-padding) height, shared with the drag handle
279 GtkTreeModel *model;
280 GtkTextBuffer *buffer;
289
290
291#ifdef _DEBUG
299void dt_gtk_widget_queue_draw_ext(GtkWidget *widget, const char *name, const char *file, const int line);
300#define dt_gtk_widget_queue_draw(widget) dt_gtk_widget_queue_draw_ext((GtkWidget *)(widget), #widget, __FILE__, __LINE__)
301#define gtk_widget_queue_draw(widget) dt_gtk_widget_queue_draw(widget)
302
309void dt_gtk_toggle_button_set_active_ext(GtkToggleButton *toggle_button, const char *name, const gboolean active,
310 const char *file, const int line);
311#define dt_gtk_toggle_button_set_active(toggle_button, active) \
312 dt_gtk_toggle_button_set_active_ext((GtkToggleButton *)(toggle_button), #toggle_button, active, __FILE__, __LINE__)
313#define gtk_toggle_button_set_active(toggle_button, active) \
314 dt_gtk_toggle_button_set_active(toggle_button, active)
315
316#else
317#define dt_gtk_widget_queue_draw(widget) gtk_widget_queue_draw(widget)
318#define dt_gtk_toggle_button_set_active(toggle_button, active) gtk_toggle_button_set_active(toggle_button, active)
319#endif
320
321
322static inline cairo_surface_t *dt_cairo_image_surface_create(cairo_format_t format, int width, int height) {
323 cairo_surface_t *cst = cairo_image_surface_create(format, width * darktable.gui->ppd, height * darktable.gui->ppd);
324 cairo_surface_set_device_scale(cst, darktable.gui->ppd, darktable.gui->ppd);
325 return cst;
326}
327
328static inline cairo_surface_t *dt_cairo_image_surface_create_for_data(unsigned char *data, cairo_format_t format, int width, int height, int stride) {
329 cairo_surface_t *cst = cairo_image_surface_create_for_data(data, format, width, height, stride);
330 cairo_surface_set_device_scale(cst, darktable.gui->ppd, darktable.gui->ppd);
331 return cst;
332}
333
334static inline cairo_surface_t *dt_cairo_image_surface_create_from_png(const char *filename) {
335 cairo_surface_t *cst = cairo_image_surface_create_from_png(filename);
336 cairo_surface_set_device_scale(cst, darktable.gui->ppd, darktable.gui->ppd);
337 return cst;
338}
339
340static inline int dt_cairo_image_surface_get_width(cairo_surface_t *surface) {
341 return cairo_image_surface_get_width(surface) / darktable.gui->ppd;
342}
343
344static inline int dt_cairo_image_surface_get_height(cairo_surface_t *surface) {
345 return cairo_image_surface_get_height(surface) / darktable.gui->ppd;
346}
347
348static inline cairo_surface_t *dt_gdk_cairo_surface_create_from_pixbuf(const GdkPixbuf *pixbuf, int scale, GdkWindow *for_window) {
349 cairo_surface_t *cst = gdk_cairo_surface_create_from_pixbuf(pixbuf, scale, for_window);
350 cairo_surface_set_device_scale(cst, darktable.gui->ppd, darktable.gui->ppd);
351 return cst;
352}
353
354static inline GdkPixbuf *dt_gdk_pixbuf_new_from_file_at_size(const char *filename, int width, int height, GError **error) {
355 return gdk_pixbuf_new_from_file_at_size(filename, width * darktable.gui->ppd, height * darktable.gui->ppd, error);
356}
357
358// call class function to add or remove CSS classes (need to be set on top of this file as first function is used in this file)
359void dt_gui_add_class(GtkWidget *widget, const gchar *class_name);
360void dt_gui_remove_class(GtkWidget *widget, const gchar *class_name);
361
372void dt_gui_set_symbolic_icon(GtkWidget *image, const char *icon_name, GtkIconSize size, const GdkRGBA *color);
373
376void dt_gui_gtk_quit();
377void dt_gui_store_last_preset(const char *name);
380void dt_gui_gtk_set_source_rgba(cairo_t *cr, dt_gui_color_t, float opacity_coef);
381double dt_get_system_gui_ppd(GtkWidget *widget);
382
383/* Return requested scroll delta(s) from event. If delta_x or delta_y
384 * is NULL, do not return that delta. Return TRUE if requested deltas
385 * can be retrieved. Handles both GDK_SCROLL_UP/DOWN/LEFT/RIGHT and
386 * GDK_SCROLL_SMOOTH style scroll events. */
387gboolean dt_gui_get_scroll_deltas(const GdkEventScroll *event, gdouble *delta_x, gdouble *delta_y);
388/* Same as above, except accumulate smooth scrolls deltas of < 1 and
389 * only set deltas and return TRUE once scrolls accumulate to >= 1.
390 * Effectively makes smooth scroll events act like old-style unit
391 * scroll events. */
392gboolean dt_gui_get_scroll_unit_deltas(const GdkEventScroll *event, int *delta_x, int *delta_y);
393
394/* Note that on macOS Shift+vertical scroll can be reported as Shift+horizontal scroll.
395 * So if Shift changes scrolling effect, both scrolls should be handled the same.
396 * For this case (or if it's otherwise useful) use the following 2 functions. */
397
398/* Return sum of scroll deltas from event. Return TRUE if any deltas
399 * can be retrieved. Handles both GDK_SCROLL_UP/DOWN/LEFT/RIGHT and
400 * GDK_SCROLL_SMOOTH style scroll events. */
401gboolean dt_gui_get_scroll_delta(const GdkEventScroll *event, gdouble *delta);
402/* Same as above, except accumulate smooth scrolls deltas of < 1 and
403 * only set delta and return TRUE once scrolls accumulate to >= 1.
404 * Effectively makes smooth scroll events act like old-style unit
405 * scroll events. */
406gboolean dt_gui_get_scroll_unit_delta(const GdkEventScroll *event, int *delta);
407
411void dt_ui_container_foreach(dt_ui_t *ui, const dt_ui_container_t c, GtkCallback callback);
415void dt_ui_panel_show(dt_ui_t *ui, const dt_ui_panel_t, gboolean show, gboolean write);
419void dt_ui_notify_user();
421gboolean dt_ui_panel_visible(dt_ui_t *ui, const dt_ui_panel_t);
425gboolean dt_ui_panel_ancestor(dt_ui_t *ui, const dt_ui_panel_t p, GtkWidget *w);
431
436
437GtkBox *dt_ui_get_container(dt_ui_t *ui, const dt_ui_container_t c);
438
439/* activate ellipsization of the combox entries */
440void dt_ellipsize_combo(GtkComboBox *cbox);
441
442// capitalize strings. Because grammar says sentences start with a capital,
443// and typography says it makes it easier to extract the structure of the text.
444void dt_capitalize_label(gchar *text);
445
446#define dt_accels_new_global_action(a, b, c, d, e, f, g) dt_accels_new_action_shortcut(darktable.gui->accels, a, b, darktable.gui->accels->global_accels, c, d, e, f, FALSE, g)
447
448#define dt_accels_new_darkroom_action(a, b, c, d, e, f, g) dt_accels_new_action_shortcut(darktable.gui->accels, a, b, darktable.gui->accels->darkroom_accels, c, d, e, f, FALSE, g)
449
450#define dt_accels_new_lighttable_action(a, b, c, d, e, f, g) dt_accels_new_action_shortcut(darktable.gui->accels, a, b, darktable.gui->accels->lighttable_accels, c, d, e, f, FALSE, g)
451
452#define dt_accels_new_map_action(a, b, c, d, e, f, g) dt_accels_new_action_shortcut(darktable.gui->accels, a, b, darktable.gui->accels->map_accels, c, d, e, f, FALSE, g)
453
454#define dt_accels_new_print_action(a, b, c, d, e, f, g) dt_accels_new_action_shortcut(darktable.gui->accels, a, b, darktable.gui->accels->print_accels, c, d, e, f, FALSE, g)
455
456#define dt_accels_new_slideshow_action(a, b, c, d, e, f, g) dt_accels_new_action_shortcut(darktable.gui->accels, a, b, darktable.gui->accels->slideshow_accels, c, d, e, f, FALSE, g)
457
458#define dt_accels_new_darkroom_locked_action(a, b, c, d, e, f, g) dt_accels_new_action_shortcut(darktable.gui->accels, a, b, darktable.gui->accels->darkroom_accels, c, d, e, f, TRUE, g)
459
460
461static inline void dt_ui_section_label_set(GtkWidget *label)
462{
463 gtk_widget_set_halign(label, GTK_ALIGN_FILL); // make it span the whole available width
464 gtk_label_set_xalign (GTK_LABEL(label), 0.5f);
465 gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END); // ellipsize labels
466 dt_gui_add_class(label, "dt_section_label"); // make sure that we can style these easily
467}
468
469static inline GtkWidget *dt_ui_section_label_new(const gchar *str)
470{
471 gchar *str_cpy = g_strdup(str);
472 dt_capitalize_label(str_cpy);
473 GtkWidget *label = gtk_label_new(str_cpy);
474 dt_free(str_cpy);
476 return label;
477};
478
479static inline GtkWidget *dt_ui_label_new(const gchar *str)
480{
481 gchar *str_cpy = g_strdup(str);
482 dt_capitalize_label(str_cpy);
483 GtkWidget *label = gtk_label_new(str_cpy);
484 dt_free(str_cpy);
485 gtk_widget_set_halign(label, GTK_ALIGN_START);
486 gtk_label_set_xalign (GTK_LABEL(label), 0.0f);
487 gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END);
488 return label;
489};
490
491GtkNotebook *dt_ui_notebook_new();
492
493GtkWidget *dt_ui_notebook_page(GtkNotebook *notebook, const char *text, const char *tooltip);
494
504void dt_ui_notebook_set_picker_owner(GtkNotebook *notebook, gpointer owner);
505
506// show a dialog box with 2 buttons in case some user interaction is required BEFORE dt's gui is initialised.
507// this expects gtk_init() to be called already which should be the case during most of dt's init phase.
508gboolean dt_gui_show_standalone_yes_no_dialog(const char *title, const char *markup, const char *no_text,
509 const char *yes_text);
510
511// same as above, but with 3 buttons: returns 0 for first_text, 1 for second_text, 2 for third_text.
512int dt_gui_show_standalone_three_choice_dialog(const char *title, const char *markup, const char *first_text,
513 const char *second_text, const char *third_text);
514
515// similar to the one above. this one asks the user for some string. the hint is shown in the empty entry box
516char *dt_gui_show_standalone_string_dialog(const char *title, const char *markup, const char *placeholder,
517 const char *no_text, const char *yes_text);
518
519void dt_gui_add_help_link(GtkWidget *widget, char *link);
520
521// load a CSS theme
522void dt_gui_load_theme(const char *theme);
523
524// reload GUI scalings
526
527// Recompute the cached 1em size (darktable.gui->em) from the main window's resolved
528// font. Call after the theme/font or the screen DPI changes. Also re-applies the standard
529// inter-child spacing (DT_GUI_BOX_SPACING) to existing containers so the change is live.
530void dt_gui_update_em(void);
531
532// Set a PangoLayout's resolution to the screen DPI for crisp cairo-drawn text. Use this
533// instead of hand-writing pango_cairo_context_set_resolution(..., darktable.gui->dpi).
534void dt_gui_set_pango_resolution(PangoLayout *layout);
535
536// Apply the system's text-rendering options (anti-aliasing, hinting, subpixel order,
537// hint-metrics/kerning) to a Cairo context, sourced from @p widget's Pango context (the same
538// settings native GTK widgets use). Call on any off-screen/scratch Cairo surface before drawing
539// text so it matches the rest of the UI instead of Cairo's defaults. @p widget may be NULL (falls
540// back to the main window, then the screen). Pair with dt_gui_set_pango_resolution() for the DPI.
541void dt_gui_cairo_set_font_options(cairo_t *cr, GtkWidget *widget);
542
543// return modifier keys currently pressed, independent of any key event
544GdkModifierType dt_key_modifier_state();
545
546
561GtkWidget *dt_ui_scroll_wrap(GtkWidget *w, gint min_size, char *config_str, dt_ui_resize_mode_t mode);
562
567
581GtkWidget *dt_ui_resizable_drawing_area(GtkWidget *area, char *config_str, int default_height, int min_height);
582
592void dt_gui_textview_set_padding(GtkTextView *textview);
593// check whether the given container has any user-added children
594gboolean dt_gui_container_has_children(GtkContainer *container);
595// return a count of the user-added children in the given container
597// return the first child of the given container
599// return the requested child of the given container, or NULL if it has fewer children
600GtkWidget *dt_gui_container_nth_child(GtkContainer *container, int which);
601
602// remove all of the children we've added to the container. Any which no longer have any references will
603// be destroyed.
605
606// delete all of the children we've added to the container. Use this function only if you are SURE
607// there are no other references to any of the children (if in doubt, use dt_gui_container_remove_children
608// instead; it's a bit slower but safer).
610
611void dt_gui_menu_popup(GtkMenu *menu, GtkWidget *button, GdkGravity widget_anchor, GdkGravity menu_anchor);
612
626
627void dt_gui_draw_rounded_rectangle(cairo_t *cr, float width, float height, float x, float y);
628
629// event handler for "key-press-event" of GtkTreeView to decide if focus switches to GtkSearchEntry
630gboolean dt_gui_search_start(GtkWidget *widget, GdkEventKey *event, GtkSearchEntry *entry);
631
632// event handler for "stop-search" of GtkSearchEntry
633void dt_gui_search_stop(GtkSearchEntry *entry, GtkWidget *widget);
634
648 const char *confname, const char *label,
649 GtkBox *parent, GtkPackType pack);
650// routine to be called from gui_update
652
653// routine to hide the collapsible section
655
664GtkBox *attach_popover(GtkWidget *widget, const char *icon, GtkWidget *content);
665
678GtkBox *attach_help_popover(GtkWidget *widget, const char *label);
679
680
688
689// Get the top-most window attached to a widget.
690// This is a dynamic get that takes into account destroyed widgets and such.
691static inline GtkWindow *dt_gtk_get_window(GtkWidget *widget)
692{
693 if(IS_NULL_PTR(widget)) return NULL;
694 GtkWidget *toplevel = gtk_widget_get_toplevel(widget);
695 if(toplevel && gtk_widget_is_toplevel(toplevel)) return GTK_WINDOW(toplevel);
696 return NULL;
697}
698
699
700// Give back the focus to the main/center widget, either
701// image in darkroom or thumbtable in lighttable
703
704#ifdef __cplusplus
705}
706#endif
707
708// clang-format off
709// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
710// vim: shiftwidth=2 expandtab tabstop=2 cindent
711// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
712// clang-format on
Handle default and user-set shortcuts (accelerators)
static void error(char *msg)
Definition ashift_lsd.c:202
uint32_t container(dt_lib_module_t *self)
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
const float delta
char * name
darktable_t darktable
Definition darktable.c:183
#define dt_free(ptr)
Definition darktable.h:468
#define PATH_MAX
Definition darktable.h:1179
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
Definition darktable.h:293
GtkWidget * dt_ui_toast_msg(dt_ui_t *ui)
get the toast message widget
gboolean dt_gui_get_scroll_deltas(const GdkEventScroll *event, gdouble *delta_x, gdouble *delta_y)
Definition gtk.c:240
GtkWidget * dt_ui_center(dt_ui_t *ui)
get the center drawable widget
void dt_gui_gtk_set_source_rgb(cairo_t *cr, dt_gui_color_t)
Definition gtk.c:523
GtkBox * attach_help_popover(GtkWidget *widget, const char *label)
Definition gtk.c:3411
void dt_gui_menu_popup(GtkMenu *menu, GtkWidget *button, GdkGravity widget_anchor, GdkGravity menu_anchor)
Definition gtk.c:3169
void dt_gui_cairo_set_font_options(cairo_t *cr, GtkWidget *widget)
Definition gtk.c:1556
void dt_ui_container_foreach(dt_ui_t *ui, const dt_ui_container_t c, GtkCallback callback)
calls a callback on all children widgets from container
Definition gtk.c:1814
gboolean dt_gui_get_scroll_delta(const GdkEventScroll *event, gdouble *delta)
Definition gtk.c:383
void dt_gui_container_remove_children(GtkContainer *container)
Definition gtk.c:3123
gboolean dt_gui_get_scroll_unit_deltas(const GdkEventScroll *event, int *delta_x, int *delta_y)
Definition gtk.c:300
static cairo_surface_t * dt_cairo_image_surface_create_from_png(const char *filename)
Definition gtk.h:334
gboolean dt_gui_get_scroll_unit_delta(const GdkEventScroll *event, int *delta)
Definition gtk.c:394
void dt_gui_search_stop(GtkSearchEntry *entry, GtkWidget *widget)
Definition gtk.c:3232
void dt_gui_hide_collapsible_section(dt_gui_collapsible_section_t *cs)
Definition gtk.c:3311
void dt_gui_remove_class(GtkWidget *widget, const gchar *class_name)
Definition gtk.c:143
dt_gui_color_t
Definition gtk.h:126
@ DT_GUI_COLOR_BG
Definition gtk.h:127
@ DT_GUI_COLOR_DARKROOM_PREVIEW_BG
Definition gtk.h:129
@ DT_GUI_COLOR_LIGHTTABLE_FONT
Definition gtk.h:132
@ DT_GUI_COLOR_MAP_LOC_SHAPE_HIGH
Definition gtk.h:155
@ DT_GUI_COLOR_LOG_FG
Definition gtk.h:151
@ DT_GUI_COLOR_BRUSH_CURSOR
Definition gtk.h:134
@ DT_GUI_COLOR_LAST
Definition gtk.h:159
@ DT_GUI_COLOR_THUMBNAIL_FONT
Definition gtk.h:143
@ DT_GUI_COLOR_THUMBNAIL_SELECTED_BG
Definition gtk.h:138
@ DT_GUI_COLOR_MAP_COUNT_BG
Definition gtk.h:154
@ DT_GUI_COLOR_LOG_BG
Definition gtk.h:150
@ DT_GUI_COLOR_THUMBNAIL_SELECTED_BORDER
Definition gtk.h:147
@ DT_GUI_COLOR_THUMBNAIL_OUTLINE
Definition gtk.h:140
@ DT_GUI_COLOR_MAP_LOC_SHAPE_LOW
Definition gtk.h:156
@ DT_GUI_COLOR_LIGHTTABLE_BG
Definition gtk.h:130
@ DT_GUI_COLOR_BUTTON_FG
Definition gtk.h:136
@ DT_GUI_COLOR_DARKROOM_BG
Definition gtk.h:128
@ DT_GUI_COLOR_THUMBNAIL_BORDER
Definition gtk.h:146
@ DT_GUI_COLOR_LIGHTTABLE_PREVIEW_BG
Definition gtk.h:131
@ DT_GUI_COLOR_WARNING
Definition gtk.h:158
@ DT_GUI_COLOR_MAP_COUNT_SAME_LOC
Definition gtk.h:152
@ DT_GUI_COLOR_MAP_COUNT_DIFF_LOC
Definition gtk.h:153
@ DT_GUI_COLOR_THUMBNAIL_BG
Definition gtk.h:137
@ DT_GUI_COLOR_PREVIEW_HOVER_BORDER
Definition gtk.h:149
@ DT_GUI_COLOR_FILMSTRIP_BG
Definition gtk.h:148
@ DT_GUI_COLOR_BRUSH_TRACE
Definition gtk.h:135
@ DT_GUI_COLOR_THUMBNAIL_SELECTED_FONT
Definition gtk.h:144
@ DT_GUI_COLOR_THUMBNAIL_SELECTED_OUTLINE
Definition gtk.h:141
@ DT_GUI_COLOR_THUMBNAIL_HOVER_BG
Definition gtk.h:139
@ DT_GUI_COLOR_PRINT_BG
Definition gtk.h:133
@ DT_GUI_COLOR_MAP_LOC_SHAPE_DEF
Definition gtk.h:157
@ DT_GUI_COLOR_THUMBNAIL_HOVER_FONT
Definition gtk.h:145
@ DT_GUI_COLOR_THUMBNAIL_HOVER_OUTLINE
Definition gtk.h:142
struct _gui_collapsible_section_t dt_gui_collapsible_section_t
GtkWidget * dt_ui_resizable_drawing_area(GtkWidget *area, char *config_str, int default_height, int min_height)
Make a self-drawing widget (typically a GtkDrawingArea graph or scope) vertically resizable.
Definition gtk.c:3052
void dt_gui_new_collapsible_section(dt_gui_collapsible_section_t *cs, const char *confname, const char *label, GtkBox *parent, GtkPackType pack)
Create a collapsible section and pack it into the parent box.
Definition gtk.c:3318
GtkWidget * dt_ui_notebook_page(GtkNotebook *notebook, const char *text, const char *tooltip)
Definition gtk.c:2454
GtkNotebook * dt_ui_notebook_new()
Definition gtk.c:2449
static GtkWindow * dt_gtk_get_window(GtkWidget *widget)
Definition gtk.h:691
static GdkPixbuf * dt_gdk_pixbuf_new_from_file_at_size(const char *filename, int width, int height, GError **error)
Definition gtk.h:354
static cairo_surface_t * dt_cairo_image_surface_create(cairo_format_t format, int width, int height)
Definition gtk.h:322
void dt_ui_container_destroy_children(dt_ui_t *ui, const dt_ui_container_t c)
destroy all child widgets from container
Definition gtk.c:1820
char * dt_gui_show_standalone_string_dialog(const char *title, const char *markup, const char *placeholder, const char *no_text, const char *yes_text)
Definition gtk.c:2133
int dt_gui_container_num_children(GtkContainer *container)
Definition gtk.c:3088
int dt_ui_panel_get_size(dt_ui_t *ui, const dt_ui_panel_t p)
get width of right, left, or bottom panel
void dt_gui_draw_rounded_rectangle(cairo_t *cr, float width, float height, float x, float y)
Definition gtk.c:3208
GtkWidget * dt_gui_container_nth_child(GtkContainer *container, int which)
Definition gtk.c:3108
static cairo_surface_t * dt_gdk_cairo_surface_create_from_pixbuf(const GdkPixbuf *pixbuf, int scale, GdkWindow *for_window)
Definition gtk.h:348
gboolean dt_ui_panel_visible(dt_ui_t *ui, const dt_ui_panel_t)
get visible state of panel
Definition display.c:211
void dt_gui_update_collapsible_section(dt_gui_collapsible_section_t *cs)
Definition gtk.c:3296
gboolean dt_ui_panel_ancestor(dt_ui_t *ui, const dt_ui_panel_t p, GtkWidget *w)
is the panel ancestor of widget
void dt_gui_textview_set_padding(GtkTextView *textview)
Apply the standard recessed-input text padding to a GtkTextView.
Definition gtk.c:2903
void dt_gui_load_theme(const char *theme)
Definition gtk.c:2223
GtkWidget * dt_ui_scroll_wrap_get_scrolled_window(GtkWidget *wrapper)
Return the inner GtkScrolledWindow of a dt_ui_scroll_wrap() wrapper, or NULL.
Definition gtk.c:2991
int dt_gui_show_standalone_three_choice_dialog(const char *title, const char *markup, const char *first_text, const char *second_text, const char *third_text)
Definition gtk.c:2041
void dt_capitalize_label(gchar *text)
Definition gtk.c:3366
int dt_gui_gtk_write_config()
Definition gtk.c:467
void dt_gui_store_last_preset(const char *name)
Definition gtk.c:556
void dt_ellipsize_combo(GtkComboBox *cbox)
Definition gtk.c:1895
GdkModifierType dt_key_modifier_state()
Definition gtk.c:2381
void dt_configure_ppd_dpi(dt_gui_gtk_t *gui)
Definition gtk.c:1429
void dt_gui_gtk_quit()
Definition gtk.c:535
void dt_ui_toggle_panels_visibility(dt_ui_t *ui)
toggle view of panels eg. collapse/expands to previous view state
Definition display.c:112
void dt_gui_set_symbolic_icon(GtkWidget *image, const char *icon_name, GtkIconSize size, const GdkRGBA *color)
Set a symbolic icon on an image widget, optionally forcing a specific color.
Definition gtk.c:153
gboolean dt_gui_search_start(GtkWidget *widget, GdkEventKey *event, GtkSearchEntry *entry)
Definition gtk.c:3221
double dt_get_system_gui_ppd(GtkWidget *widget)
Definition gtk.c:1412
void dt_gui_container_destroy_children(GtkContainer *container)
Definition gtk.c:3135
GtkWidget * dt_ui_log_msg(dt_ui_t *ui)
get the log message widget
void dt_gui_add_help_link(GtkWidget *widget, char *link)
Definition gtk.c:2216
void dt_ui_notify_user()
draw user's attention
Definition gtk.c:1825
gboolean dt_gui_show_standalone_yes_no_dialog(const char *title, const char *markup, const char *no_text, const char *yes_text)
Definition gtk.c:1936
GtkWidget * dt_gui_get_popup_relative_widget(GtkWidget *widget, GdkRectangle *rect)
Resolve the widget used as parent for nested popups on Wayland.
Definition gtk.c:3141
void dt_ui_panel_show(dt_ui_t *ui, const dt_ui_panel_t, gboolean show, gboolean write)
shows/hide a panel
Definition display.c:124
int dt_gui_gtk_init(dt_gui_gtk_t *gui)
Definition gtk.c:1183
GtkWidget * dt_ui_main_window(dt_ui_t *ui)
get the main window widget
static GtkWidget * dt_ui_section_label_new(const gchar *str)
Definition gtk.h:469
gboolean dt_gui_container_has_children(GtkContainer *container)
Definition gtk.c:3078
static int dt_cairo_image_surface_get_width(cairo_surface_t *surface)
Definition gtk.h:340
void dt_gui_refocus_center()
Definition gtk.c:3451
dt_ui_resize_mode_t
Definition gtk.h:263
@ DT_UI_RESIZE_STATIC
Definition gtk.h:270
@ DT_UI_RESIZE_DYNAMIC
Definition gtk.h:266
void dt_gui_gtk_set_source_rgba(cairo_t *cr, dt_gui_color_t, float opacity_coef)
Definition gtk.c:529
static cairo_surface_t * dt_cairo_image_surface_create_for_data(unsigned char *data, cairo_format_t format, int width, int height, int stride)
Definition gtk.h:328
void dt_gui_set_pango_resolution(PangoLayout *layout)
Definition gtk.c:1548
GtkBox * attach_popover(GtkWidget *widget, const char *icon, GtkWidget *content)
Definition gtk.c:3380
static void dt_ui_section_label_set(GtkWidget *label)
Definition gtk.h:461
GtkWidget * dt_ui_scroll_wrap(GtkWidget *w, gint min_size, char *config_str, dt_ui_resize_mode_t mode)
Wrap a scrollable widget in a recessed, vertically resizable scrolled window with a drag handle.
Definition gtk.c:2929
void dt_gui_gtk_run(dt_gui_gtk_t *gui)
Definition gtk.c:1371
GtkWidget * dt_gui_container_first_child(GtkContainer *container)
Definition gtk.c:3098
GtkWidget * dt_ui_center_base(dt_ui_t *ui)
void dt_accels_disconnect_on_text_input(GtkWidget *widget)
Disconnects accels when a text or search entry gets the focus, and reconnects them when it looses it....
Definition gtk.c:3442
void dt_gui_add_class(GtkWidget *widget, const gchar *class_name)
Definition gtk.c:133
static GtkWidget * dt_ui_label_new(const gchar *str)
Definition gtk.h:479
void dt_ui_notebook_set_picker_owner(GtkNotebook *notebook, gpointer owner)
Register an opaque owner for a GtkNotebook's page switches, and relay every "switch_page" as DT_SIGNA...
Definition gtk.c:2484
static int dt_cairo_image_surface_get_height(cairo_surface_t *surface)
Definition gtk.h:344
void dt_ui_container_focus_widget(dt_ui_t *ui, const dt_ui_container_t c, GtkWidget *w)
gives a widget focus in the container
Definition gtk.c:1804
@ TREE_LIST_MIN_ROWS
Definition gtk.h:114
@ TREE_LIST_MAX_ROWS
Definition gtk.h:115
void dt_gui_update_em(void)
Definition gtk.c:1522
GtkBox * dt_ui_get_container(dt_ui_t *ui, const dt_ui_container_t c)
const char * tooltip
Definition image.h:251
static const float x
size_t size
Definition mipmap_cache.c:3
struct _GtkWidget GtkWidget
Definition splash.h:29
const char * confname
Definition gtk.h:255
GtkWidget * toggle
Definition gtk.h:256
GtkWidget * expander
Definition gtk.h:257
GtkWidget * label
Definition gtk.h:259
struct dt_gui_gtk_t * gui
Definition darktable.h:793
double dpi
Definition gtk.h:205
gboolean block_normal_pan
Definition gtk.h:188
int32_t _widget_suppress_depth
Definition gtk.h:177
double ppd
Definition gtk.h:205
gint scroll_mask
Definition gtk.h:230
struct dt_gui_gtk_t::@50 export_popup
gboolean is_dragging
Definition gtk.h:218
double overlay_contrast
Definition gtk.h:203
int32_t center_tooltip
Definition gtk.h:180
cairo_surface_t * surface
Definition gtk.h:169
dt_accels_t * accels
Definition gtk.h:199
struct dt_gui_gtk_t::@51 styles_popup
float effect_radius
Definition gtk.h:215
double overlay_red
Definition gtk.h:203
GtkMenu * presets_popup_menu
Definition gtk.h:170
GtkWidget * has_scroll_focus
Definition gtk.h:234
gboolean is_painting
Definition gtk.h:219
double overlay_green
Definition gtk.h:203
double dpi_factor
Definition gtk.h:205
dt_ui_t * ui
Definition gtk.h:165
GtkWidget * scroll_to[2]
Definition gtk.h:227
float effect_radius_clamped
Definition gtk.h:217
double overlay_blue
Definition gtk.h:203
dt_pthread_mutex_t mutex
Definition gtk.h:249
gboolean culling_mode
Definition gtk.h:192
int icon_size
Definition gtk.h:222
cairo_filter_t dr_filter_image
Definition gtk.h:237
gint64 last_time_us
Definition gtk.h:186
gboolean enabled
Definition gtk.h:187
GtkWidget * scroll_to_header_once
Definition gtk.h:228
guint timeout_source
Definition gtk.h:183
gboolean selection_stacked
Definition gtk.h:196
float velocity[2]
Definition gtk.h:185
struct dt_gui_gtk_t::@49 mouse
char gtkrc[PATH_MAX]
Definition gtk.h:225
GtkWidget * window
Definition gtk.h:241
struct dt_view_t * view
Definition gtk.h:184
cairo_filter_t filter_image
Definition gtk.h:236
char * last_preset
Definition gtk.h:171
double em
Definition gtk.h:210
dt_gui_widgets_t widgets
Definition gtk.h:167
GList * input_devices
Definition gtk.h:201
struct dt_gui_gtk_t::@48 pan_edge
GdkRGBA colors[DT_GUI_COLOR_LAST]
Definition gtk.h:178
dt_ui_resize_mode_t mode
Definition gtk.h:278
GtkTreeModel * model
Definition gtk.h:279
GtkTextBuffer * buffer
Definition gtk.h:280
GtkGrid * panel_right
Definition gtk.h:122
GtkGrid * panel_left
Definition gtk.h:121
GtkWidget * notebook
A widget to manage and display image thumbnails in Ansel's lighttable and filmstrip views.
dt_ui_container_t
dt_ui_panel_t