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
160
161typedef struct dt_gui_gtk_t
162{
163
165
167
168 cairo_surface_t *surface;
171
172 int32_t reset;
174
175 int32_t center_tooltip; // 0 = no tooltip, 1 = new tooltip, 2 = old tooltip
176
177 struct {
180 float velocity[2];
182 gboolean enabled;
185
186 // Culling mode is a special case of collection filter that is restricted to user selection
187 gboolean culling_mode;
188
189 // Track if the current selection has pushed on the backup copy
190 // see common/selection.h:dt_selection_push()
192
193 // Global accelerators for main menu, needed for GtkMenu mnemonics.
195
197
199
201
202 // Resolved root font size (1em) in device-independent px, read from the active
203 // theme/font by dt_gui_update_em(). Drives DT_GUI_BOX_SPACING so inner gutters
204 // track the font size like em-based CSS margins. 0.0 until first resolved.
205 double em;
206
207
208 struct {
209 // Raw mouse hit-test radius in display pixels
211 // Mouse hit-test radius coordinates, clamped for usable overlay selection.
213 gboolean is_dragging;
215
216 int icon_size; // size of top panel icons
217
218 // store which gtkrc we loaded:
220
221 GtkWidget *scroll_to[2]; // one for left, one for right
222 GtkWidget *scroll_to_header_once; // one-shot: module expander that should scroll to its header once
223
225
226 // scrolling focus
227 // This emulates the same feature as Gtk focus, but to capture scrolling events
229
230 cairo_filter_t filter_image; // filtering used for all modules expect darkroom
231 cairo_filter_t dr_filter_image; // filtering used in the darkroom
232
233 // Export popup window
234 struct {
236 GtkWidget *module;
238 struct {
240 GtkWidget *module;
242
243 dt_pthread_mutex_t mutex;
245
247{
248 GtkBox *parent; // the parent widget
249 const char *confname; // configuration name for the toggle status
250 GtkWidget *toggle; // toggle button
251 GtkWidget *expander; // the expanded
252 GtkBox *container; // the container for all widgets into the section
253 GtkWidget *label; // The section label
255
257{
258 // Auto-fit: the area shrinks to its content (up to the user/max height). Best for widgets
259 // updated rarely; their height following content is helpful, not disruptive.
261 // Fixed: the area keeps the user-set (or default) height regardless of content, so it never
262 // shifts the surrounding layout when its content changes. Best for widgets that refresh on
263 // hover/selection (tags, notes, metadata) and the collection/library list.
266
268{
269 char *config_str; // conf key persisting the user-chosen height (px); owned
270 int min_size; // minimum height floor in device pixels
271 int last_height; // last applied bare (pre-padding) height, shared with the drag handle
273 GtkTreeModel *model;
274 GtkTextBuffer *buffer;
283
284
285#ifdef _DEBUG
293void dt_gtk_widget_queue_draw_ext(GtkWidget *widget, const char *name, const char *file, const int line);
294#define dt_gtk_widget_queue_draw(widget) dt_gtk_widget_queue_draw_ext((GtkWidget *)(widget), #widget, __FILE__, __LINE__)
295#define gtk_widget_queue_draw(widget) dt_gtk_widget_queue_draw(widget)
296
303void dt_gtk_toggle_button_set_active_ext(GtkToggleButton *toggle_button, const char *name, const gboolean active,
304 const char *file, const int line);
305#define dt_gtk_toggle_button_set_active(toggle_button, active) \
306 dt_gtk_toggle_button_set_active_ext((GtkToggleButton *)(toggle_button), #toggle_button, active, __FILE__, __LINE__)
307#define gtk_toggle_button_set_active(toggle_button, active) \
308 dt_gtk_toggle_button_set_active(toggle_button, active)
309
310#else
311#define dt_gtk_widget_queue_draw(widget) gtk_widget_queue_draw(widget)
312#define dt_gtk_toggle_button_set_active(toggle_button, active) gtk_toggle_button_set_active(toggle_button, active)
313#endif
314
315
316static inline cairo_surface_t *dt_cairo_image_surface_create(cairo_format_t format, int width, int height) {
317 cairo_surface_t *cst = cairo_image_surface_create(format, width * darktable.gui->ppd, height * darktable.gui->ppd);
318 cairo_surface_set_device_scale(cst, darktable.gui->ppd, darktable.gui->ppd);
319 return cst;
320}
321
322static inline cairo_surface_t *dt_cairo_image_surface_create_for_data(unsigned char *data, cairo_format_t format, int width, int height, int stride) {
323 cairo_surface_t *cst = cairo_image_surface_create_for_data(data, format, width, height, stride);
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_from_png(const char *filename) {
329 cairo_surface_t *cst = cairo_image_surface_create_from_png(filename);
330 cairo_surface_set_device_scale(cst, darktable.gui->ppd, darktable.gui->ppd);
331 return cst;
332}
333
334static inline int dt_cairo_image_surface_get_width(cairo_surface_t *surface) {
335 return cairo_image_surface_get_width(surface) / darktable.gui->ppd;
336}
337
338static inline int dt_cairo_image_surface_get_height(cairo_surface_t *surface) {
339 return cairo_image_surface_get_height(surface) / darktable.gui->ppd;
340}
341
342static inline cairo_surface_t *dt_gdk_cairo_surface_create_from_pixbuf(const GdkPixbuf *pixbuf, int scale, GdkWindow *for_window) {
343 cairo_surface_t *cst = gdk_cairo_surface_create_from_pixbuf(pixbuf, scale, for_window);
344 cairo_surface_set_device_scale(cst, darktable.gui->ppd, darktable.gui->ppd);
345 return cst;
346}
347
348static inline GdkPixbuf *dt_gdk_pixbuf_new_from_file_at_size(const char *filename, int width, int height, GError **error) {
349 return gdk_pixbuf_new_from_file_at_size(filename, width * darktable.gui->ppd, height * darktable.gui->ppd, error);
350}
351
352// 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)
353void dt_gui_add_class(GtkWidget *widget, const gchar *class_name);
354void dt_gui_remove_class(GtkWidget *widget, const gchar *class_name);
355
358void dt_gui_gtk_quit();
359void dt_gui_store_last_preset(const char *name);
362void dt_gui_gtk_set_source_rgba(cairo_t *cr, dt_gui_color_t, float opacity_coef);
363double dt_get_system_gui_ppd(GtkWidget *widget);
364
365/* Return requested scroll delta(s) from event. If delta_x or delta_y
366 * is NULL, do not return that delta. Return TRUE if requested deltas
367 * can be retrieved. Handles both GDK_SCROLL_UP/DOWN/LEFT/RIGHT and
368 * GDK_SCROLL_SMOOTH style scroll events. */
369gboolean dt_gui_get_scroll_deltas(const GdkEventScroll *event, gdouble *delta_x, gdouble *delta_y);
370/* Same as above, except accumulate smooth scrolls deltas of < 1 and
371 * only set deltas and return TRUE once scrolls accumulate to >= 1.
372 * Effectively makes smooth scroll events act like old-style unit
373 * scroll events. */
374gboolean dt_gui_get_scroll_unit_deltas(const GdkEventScroll *event, int *delta_x, int *delta_y);
375
376/* Note that on macOS Shift+vertical scroll can be reported as Shift+horizontal scroll.
377 * So if Shift changes scrolling effect, both scrolls should be handled the same.
378 * For this case (or if it's otherwise useful) use the following 2 functions. */
379
380/* Return sum of scroll deltas from event. Return TRUE if any deltas
381 * can be retrieved. Handles both GDK_SCROLL_UP/DOWN/LEFT/RIGHT and
382 * GDK_SCROLL_SMOOTH style scroll events. */
383gboolean dt_gui_get_scroll_delta(const GdkEventScroll *event, gdouble *delta);
384/* Same as above, except accumulate smooth scrolls deltas of < 1 and
385 * only set delta and return TRUE once scrolls accumulate to >= 1.
386 * Effectively makes smooth scroll events act like old-style unit
387 * scroll events. */
388gboolean dt_gui_get_scroll_unit_delta(const GdkEventScroll *event, int *delta);
389
393void dt_ui_container_foreach(dt_ui_t *ui, const dt_ui_container_t c, GtkCallback callback);
397void dt_ui_panel_show(dt_ui_t *ui, const dt_ui_panel_t, gboolean show, gboolean write);
401void dt_ui_notify_user();
403gboolean dt_ui_panel_visible(dt_ui_t *ui, const dt_ui_panel_t);
407gboolean dt_ui_panel_ancestor(dt_ui_t *ui, const dt_ui_panel_t p, GtkWidget *w);
413
418
419GtkBox *dt_ui_get_container(dt_ui_t *ui, const dt_ui_container_t c);
420
421/* activate ellipsization of the combox entries */
422void dt_ellipsize_combo(GtkComboBox *cbox);
423
424// capitalize strings. Because grammar says sentences start with a capital,
425// and typography says it makes it easier to extract the structure of the text.
426void dt_capitalize_label(gchar *text);
427
428#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)
429
430#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)
431
432#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)
433
434#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)
435
436#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)
437
438#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)
439
440#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)
441
442
443static inline void dt_ui_section_label_set(GtkWidget *label)
444{
445 gtk_widget_set_halign(label, GTK_ALIGN_FILL); // make it span the whole available width
446 gtk_label_set_xalign (GTK_LABEL(label), 0.5f);
447 gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END); // ellipsize labels
448 dt_gui_add_class(label, "dt_section_label"); // make sure that we can style these easily
449}
450
451static inline GtkWidget *dt_ui_section_label_new(const gchar *str)
452{
453 gchar *str_cpy = g_strdup(str);
454 dt_capitalize_label(str_cpy);
455 GtkWidget *label = gtk_label_new(str_cpy);
456 dt_free(str_cpy);
458 return label;
459};
460
461static inline GtkWidget *dt_ui_label_new(const gchar *str)
462{
463 gchar *str_cpy = g_strdup(str);
464 dt_capitalize_label(str_cpy);
465 GtkWidget *label = gtk_label_new(str_cpy);
466 dt_free(str_cpy);
467 gtk_widget_set_halign(label, GTK_ALIGN_START);
468 gtk_label_set_xalign (GTK_LABEL(label), 0.0f);
469 gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END);
470 return label;
471};
472
473GtkNotebook *dt_ui_notebook_new();
474
475GtkWidget *dt_ui_notebook_page(GtkNotebook *notebook, const char *text, const char *tooltip);
476
477// show a dialog box with 2 buttons in case some user interaction is required BEFORE dt's gui is initialised.
478// this expects gtk_init() to be called already which should be the case during most of dt's init phase.
479gboolean dt_gui_show_standalone_yes_no_dialog(const char *title, const char *markup, const char *no_text,
480 const char *yes_text);
481
482// similar to the one above. this one asks the user for some string. the hint is shown in the empty entry box
483char *dt_gui_show_standalone_string_dialog(const char *title, const char *markup, const char *placeholder,
484 const char *no_text, const char *yes_text);
485
486void dt_gui_add_help_link(GtkWidget *widget, char *link);
487
488// load a CSS theme
489void dt_gui_load_theme(const char *theme);
490
491// reload GUI scalings
493
494// Recompute the cached 1em size (darktable.gui->em) from the main window's resolved
495// font. Call after the theme/font or the screen DPI changes. Also re-applies the standard
496// inter-child spacing (DT_GUI_BOX_SPACING) to existing containers so the change is live.
497void dt_gui_update_em(void);
498
499// Set a PangoLayout's resolution to the screen DPI for crisp cairo-drawn text. Use this
500// instead of hand-writing pango_cairo_context_set_resolution(..., darktable.gui->dpi).
501void dt_gui_set_pango_resolution(PangoLayout *layout);
502
503// Apply the system's text-rendering options (anti-aliasing, hinting, subpixel order,
504// hint-metrics/kerning) to a Cairo context, sourced from @p widget's Pango context (the same
505// settings native GTK widgets use). Call on any off-screen/scratch Cairo surface before drawing
506// text so it matches the rest of the UI instead of Cairo's defaults. @p widget may be NULL (falls
507// back to the main window, then the screen). Pair with dt_gui_set_pango_resolution() for the DPI.
508void dt_gui_cairo_set_font_options(cairo_t *cr, GtkWidget *widget);
509
510// return modifier keys currently pressed, independent of any key event
511GdkModifierType dt_key_modifier_state();
512
513
528GtkWidget *dt_ui_scroll_wrap(GtkWidget *w, gint min_size, char *config_str, dt_ui_resize_mode_t mode);
529
534
548GtkWidget *dt_ui_resizable_drawing_area(GtkWidget *area, char *config_str, int default_height, int min_height);
549
559void dt_gui_textview_set_padding(GtkTextView *textview);
560// check whether the given container has any user-added children
561gboolean dt_gui_container_has_children(GtkContainer *container);
562// return a count of the user-added children in the given container
564// return the first child of the given container
566// return the requested child of the given container, or NULL if it has fewer children
567GtkWidget *dt_gui_container_nth_child(GtkContainer *container, int which);
568
569// remove all of the children we've added to the container. Any which no longer have any references will
570// be destroyed.
572
573// delete all of the children we've added to the container. Use this function only if you are SURE
574// there are no other references to any of the children (if in doubt, use dt_gui_container_remove_children
575// instead; it's a bit slower but safer).
577
578void dt_gui_menu_popup(GtkMenu *menu, GtkWidget *button, GdkGravity widget_anchor, GdkGravity menu_anchor);
579
593
594void dt_gui_draw_rounded_rectangle(cairo_t *cr, float width, float height, float x, float y);
595
596// event handler for "key-press-event" of GtkTreeView to decide if focus switches to GtkSearchEntry
597gboolean dt_gui_search_start(GtkWidget *widget, GdkEventKey *event, GtkSearchEntry *entry);
598
599// event handler for "stop-search" of GtkSearchEntry
600void dt_gui_search_stop(GtkSearchEntry *entry, GtkWidget *widget);
601
615 const char *confname, const char *label,
616 GtkBox *parent, GtkPackType pack);
617// routine to be called from gui_update
619
620// routine to hide the collapsible section
622
631GtkBox *attach_popover(GtkWidget *widget, const char *icon, GtkWidget *content);
632
645GtkBox *attach_help_popover(GtkWidget *widget, const char *label);
646
647
655
656// Get the top-most window attached to a widget.
657// This is a dynamic get that takes into account destroyed widgets and such.
658static inline GtkWindow *dt_gtk_get_window(GtkWidget *widget)
659{
660 if(IS_NULL_PTR(widget)) return NULL;
661 GtkWidget *toplevel = gtk_widget_get_toplevel(widget);
662 if(toplevel && gtk_widget_is_toplevel(toplevel)) return GTK_WINDOW(toplevel);
663 return NULL;
664}
665
666
667// Give back the focus to the main/center widget, either
668// image in darkroom or thumbtable in lighttable
670
671#ifdef __cplusplus
672}
673#endif
674
675// clang-format off
676// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
677// vim: shiftwidth=2 expandtab tabstop=2 cindent
678// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
679// 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:181
#define dt_free(ptr)
Definition darktable.h:456
#define PATH_MAX
Definition darktable.h:1062
#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:281
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:159
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:442
GtkBox * attach_help_popover(GtkWidget *widget, const char *label)
Definition gtk.c:3194
void dt_gui_menu_popup(GtkMenu *menu, GtkWidget *button, GdkGravity widget_anchor, GdkGravity menu_anchor)
Definition gtk.c:2953
void dt_gui_cairo_set_font_options(cairo_t *cr, GtkWidget *widget)
Definition gtk.c:1475
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:1733
gboolean dt_gui_get_scroll_delta(const GdkEventScroll *event, gdouble *delta)
Definition gtk.c:302
void dt_gui_container_remove_children(GtkContainer *container)
Definition gtk.c:2907
gboolean dt_gui_get_scroll_unit_deltas(const GdkEventScroll *event, int *delta_x, int *delta_y)
Definition gtk.c:219
@ TREE_LIST_MIN_ROWS
Definition gtk.h:114
@ TREE_LIST_MAX_ROWS
Definition gtk.h:115
static cairo_surface_t * dt_cairo_image_surface_create_from_png(const char *filename)
Definition gtk.h:328
gboolean dt_gui_get_scroll_unit_delta(const GdkEventScroll *event, int *delta)
Definition gtk.c:313
void dt_gui_search_stop(GtkSearchEntry *entry, GtkWidget *widget)
Definition gtk.c:3016
void dt_gui_hide_collapsible_section(dt_gui_collapsible_section_t *cs)
Definition gtk.c:3095
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:158
@ 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_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:2836
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:3102
GtkWidget * dt_ui_notebook_page(GtkNotebook *notebook, const char *text, const char *tooltip)
Definition gtk.c:2259
GtkNotebook * dt_ui_notebook_new()
Definition gtk.c:2254
static GtkWindow * dt_gtk_get_window(GtkWidget *widget)
Definition gtk.h:658
static GdkPixbuf * dt_gdk_pixbuf_new_from_file_at_size(const char *filename, int width, int height, GError **error)
Definition gtk.h:348
static cairo_surface_t * dt_cairo_image_surface_create(cairo_format_t format, int width, int height)
Definition gtk.h:316
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:1739
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:1939
int dt_gui_container_num_children(GtkContainer *container)
Definition gtk.c:2872
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:2992
GtkWidget * dt_gui_container_nth_child(GtkContainer *container, int which)
Definition gtk.c:2892
static cairo_surface_t * dt_gdk_cairo_surface_create_from_pixbuf(const GdkPixbuf *pixbuf, int scale, GdkWindow *for_window)
Definition gtk.h:342
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:3080
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:2687
void dt_gui_load_theme(const char *theme)
Definition gtk.c:2029
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:2775
void dt_capitalize_label(gchar *text)
Definition gtk.c:3150
int dt_gui_gtk_write_config()
Definition gtk.c:386
void dt_gui_store_last_preset(const char *name)
Definition gtk.c:475
void dt_ellipsize_combo(GtkComboBox *cbox)
Definition gtk.c:1814
GdkModifierType dt_key_modifier_state()
Definition gtk.c:2186
void dt_configure_ppd_dpi(dt_gui_gtk_t *gui)
Definition gtk.c:1348
void dt_gui_gtk_quit()
Definition gtk.c:454
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
gboolean dt_gui_search_start(GtkWidget *widget, GdkEventKey *event, GtkSearchEntry *entry)
Definition gtk.c:3005
double dt_get_system_gui_ppd(GtkWidget *widget)
Definition gtk.c:1331
void dt_gui_container_destroy_children(GtkContainer *container)
Definition gtk.c:2919
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:2022
void dt_ui_notify_user()
draw user's attention
Definition gtk.c:1744
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:1855
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:2925
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:1102
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:451
gboolean dt_gui_container_has_children(GtkContainer *container)
Definition gtk.c:2862
static int dt_cairo_image_surface_get_width(cairo_surface_t *surface)
Definition gtk.h:334
void dt_gui_refocus_center()
Definition gtk.c:3234
dt_ui_resize_mode_t
Definition gtk.h:257
@ DT_UI_RESIZE_STATIC
Definition gtk.h:264
@ DT_UI_RESIZE_DYNAMIC
Definition gtk.h:260
void dt_gui_gtk_set_source_rgba(cairo_t *cr, dt_gui_color_t, float opacity_coef)
Definition gtk.c:448
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:322
void dt_gui_set_pango_resolution(PangoLayout *layout)
Definition gtk.c:1467
GtkBox * attach_popover(GtkWidget *widget, const char *icon, GtkWidget *content)
Definition gtk.c:3164
static void dt_ui_section_label_set(GtkWidget *label)
Definition gtk.h:443
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:2713
void dt_gui_gtk_run(dt_gui_gtk_t *gui)
Definition gtk.c:1290
GtkWidget * dt_gui_container_first_child(GtkContainer *container)
Definition gtk.c:2882
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:3225
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:461
static int dt_cairo_image_surface_get_height(cairo_surface_t *surface)
Definition gtk.h:338
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:1723
void dt_gui_update_em(void)
Definition gtk.c:1441
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
struct _GtkWidget GtkWidget
Definition splash.h:29
const char * confname
Definition gtk.h:249
GtkWidget * toggle
Definition gtk.h:250
GtkWidget * expander
Definition gtk.h:251
GtkWidget * label
Definition gtk.h:253
struct dt_gui_gtk_t * gui
Definition darktable.h:775
double dpi
Definition gtk.h:200
gboolean block_normal_pan
Definition gtk.h:183
double ppd
Definition gtk.h:200
gint scroll_mask
Definition gtk.h:224
gboolean is_dragging
Definition gtk.h:213
double overlay_contrast
Definition gtk.h:198
int32_t center_tooltip
Definition gtk.h:175
cairo_surface_t * surface
Definition gtk.h:168
int32_t reset
Definition gtk.h:172
dt_accels_t * accels
Definition gtk.h:194
struct dt_gui_gtk_t::@47 mouse
float effect_radius
Definition gtk.h:210
double overlay_red
Definition gtk.h:198
GtkMenu * presets_popup_menu
Definition gtk.h:169
GtkWidget * has_scroll_focus
Definition gtk.h:228
double overlay_green
Definition gtk.h:198
double dpi_factor
Definition gtk.h:200
dt_ui_t * ui
Definition gtk.h:164
GtkWidget * scroll_to[2]
Definition gtk.h:221
float effect_radius_clamped
Definition gtk.h:212
double overlay_blue
Definition gtk.h:198
dt_pthread_mutex_t mutex
Definition gtk.h:243
gboolean culling_mode
Definition gtk.h:187
int icon_size
Definition gtk.h:216
struct dt_gui_gtk_t::@48 export_popup
cairo_filter_t dr_filter_image
Definition gtk.h:231
gint64 last_time_us
Definition gtk.h:181
gboolean enabled
Definition gtk.h:182
struct dt_gui_gtk_t::@49 styles_popup
GtkWidget * scroll_to_header_once
Definition gtk.h:222
guint timeout_source
Definition gtk.h:178
gboolean selection_stacked
Definition gtk.h:191
float velocity[2]
Definition gtk.h:180
char gtkrc[PATH_MAX]
Definition gtk.h:219
GtkWidget * window
Definition gtk.h:235
struct dt_view_t * view
Definition gtk.h:179
cairo_filter_t filter_image
Definition gtk.h:230
char * last_preset
Definition gtk.h:170
double em
Definition gtk.h:205
struct dt_gui_gtk_t::@46 pan_edge
dt_gui_widgets_t widgets
Definition gtk.h:166
GList * input_devices
Definition gtk.h:196
GdkRGBA colors[DT_GUI_COLOR_LAST]
Definition gtk.h:173
dt_ui_resize_mode_t mode
Definition gtk.h:272
GtkTreeModel * model
Definition gtk.h:273
GtkTextBuffer * buffer
Definition gtk.h:274
GtkGrid * panel_right
Definition gtk.h:122
GtkGrid * panel_left
Definition gtk.h:121
A widget to manage and display image thumbnails in Ansel's lighttable and filmstrip views.
dt_ui_container_t
dt_ui_panel_t