Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
gtk.c File Reference
#include "common/darktable.h"
#include "common/collection.h"
#include "common/colorspaces.h"
#include "common/l10n.h"
#include "common/file_location.h"
#include "common/ratings.h"
#include "common/image.h"
#include "common/image_cache.h"
#include "gui/guides.h"
#include "bauhaus/bauhaus.h"
#include "develop/develop.h"
#include "develop/imageop.h"
#include "dtgtk/button.h"
#include "dtgtk/expander.h"
#include "dtgtk/sidepanel.h"
#include "gui/gtk.h"
#include "common/styles.h"
#include "control/conf.h"
#include "control/control.h"
#include "control/jobs.h"
#include "control/signal.h"
#include "gui/presets.h"
#include "views/view.h"
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
+ Include dependency graph for gtk.c:

Data Structures

struct  result_t
 

Typedefs

typedef struct result_t result_t
 

Functions

static void _ui_widget_redraw_callback (gpointer instance, GtkWidget *widget)
 
static void _ui_log_redraw_callback (gpointer instance, GtkWidget *widget)
 
static void _ui_toast_redraw_callback (gpointer instance, GtkWidget *widget)
 
void dt_gui_add_class (GtkWidget *widget, const gchar *class_name)
 
void dt_gui_remove_class (GtkWidget *widget, const gchar *class_name)
 
static void _init_widgets (dt_gui_gtk_t *gui)
 
gboolean dt_gui_get_scroll_deltas (const GdkEventScroll *event, gdouble *delta_x, gdouble *delta_y)
 
gboolean dt_gui_get_scroll_unit_deltas (const GdkEventScroll *event, int *delta_x, int *delta_y)
 
gboolean dt_gui_get_scroll_delta (const GdkEventScroll *event, gdouble *delta)
 
gboolean dt_gui_get_scroll_unit_delta (const GdkEventScroll *event, int *delta)
 
static gboolean _draw (GtkWidget *da, cairo_t *cr, gpointer user_data)
 
static gboolean _scrolled (GtkWidget *widget, GdkEventScroll *event, gpointer user_data)
 
int dt_gui_gtk_write_config ()
 
void dt_gui_gtk_set_source_rgb (cairo_t *cr, dt_gui_color_t color)
 
void dt_gui_gtk_set_source_rgba (cairo_t *cr, dt_gui_color_t color, float opacity_coef)
 
void dt_gui_gtk_quit ()
 
gboolean dt_gui_quit_callback (GtkWidget *widget, GdkEvent *event, gpointer user_data)
 
void dt_gui_store_last_preset (const char *name)
 
static gboolean _configure (GtkWidget *da, GdkEventConfigure *event, gpointer user_data)
 
static gboolean _window_configure (GtkWidget *da, GdkEvent *event, gpointer user_data)
 
static gboolean _button_pressed (GtkWidget *w, GdkEventButton *event, gpointer user_data)
 
static gboolean _button_released (GtkWidget *w, GdkEventButton *event, gpointer user_data)
 
static gboolean _mouse_moved (GtkWidget *w, GdkEventMotion *event, gpointer user_data)
 
static gboolean _key_pressed (GtkWidget *w, GdkEventKey *event)
 
static gboolean _center_leave (GtkWidget *widget, GdkEventCrossing *event, gpointer user_data)
 
static gboolean _center_enter (GtkWidget *widget, GdkEventCrossing *event, gpointer user_data)
 
static const char * _get_source_name (int pos)
 
static const char * _get_mode_name (int pos)
 
static const char * _get_axis_name (int pos)
 
int dt_gui_gtk_init (dt_gui_gtk_t *gui)
 
void dt_gui_gtk_run (dt_gui_gtk_t *gui)
 
double dt_get_system_gui_ppd (GtkWidget *widget)
 
void dt_configure_ppd_dpi (dt_gui_gtk_t *gui)
 
static gboolean _focus_in_out_event (GtkWidget *widget, GdkEvent *event, gpointer user_data)
 
static gboolean _ui_log_button_press_event (GtkWidget *widget, GdkEvent *event, gpointer user_data)
 
static gboolean _ui_toast_button_press_event (GtkWidget *widget, GdkEvent *event, gpointer user_data)
 
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
 
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
 
void dt_ui_container_destroy_children (dt_ui_t *ui, const dt_ui_container_t c)
 destroy all child widgets from container
 
void dt_ui_notify_user ()
 draw user's attention
 
void dt_ellipsize_combo (GtkComboBox *cbox)
 
static void _yes_no_button_handler (GtkButton *button, gpointer data)
 
gboolean dt_gui_show_standalone_yes_no_dialog (const char *title, const char *markup, const char *no_text, const char *yes_text)
 
char * dt_gui_show_standalone_string_dialog (const char *title, const char *markup, const char *placeholder, const char *no_text, const char *yes_text)
 
void dt_gui_add_help_link (GtkWidget *widget, const char *link)
 
void dt_gui_load_theme (const char *theme)
 
GdkModifierType dt_key_modifier_state ()
 
static void _notebook_size_callback (GtkNotebook *notebook, GdkRectangle *allocation, gpointer *data)
 
static gboolean _notebook_motion_notify_callback (GtkWidget *widget, GdkEventMotion *event, gpointer user_data)
 
GtkNotebook * dt_ui_notebook_new ()
 
GtkWidget * dt_ui_notebook_page (GtkNotebook *notebook, const char *text, const char *tooltip)
 
static gint _get_container_row_heigth (GtkWidget *w)
 
static gboolean _scroll_wrap_resize (GtkWidget *w, void *cr, const char *config_str)
 
static gboolean _scroll_wrap_scroll (GtkScrolledWindow *sw, GdkEventScroll *event, const char *config_str)
 
GtkWidget * dt_ui_scroll_wrap (GtkWidget *w, gint min_size, char *config_str)
 
gboolean dt_gui_container_has_children (GtkContainer *container)
 
int dt_gui_container_num_children (GtkContainer *container)
 
GtkWidget * dt_gui_container_first_child (GtkContainer *container)
 
GtkWidget * dt_gui_container_nth_child (GtkContainer *container, int which)
 
static void _remove_child (GtkWidget *widget, gpointer data)
 
void dt_gui_container_remove_children (GtkContainer *container)
 
static void _delete_child (GtkWidget *widget, gpointer data)
 
void dt_gui_container_destroy_children (GtkContainer *container)
 
void dt_gui_menu_popup (GtkMenu *menu, GtkWidget *button, GdkGravity widget_anchor, GdkGravity menu_anchor)
 
void dt_gui_draw_rounded_rectangle (cairo_t *cr, float width, float height, float x, float y)
 
gboolean dt_gui_search_start (GtkWidget *widget, GdkEventKey *event, GtkSearchEntry *entry)
 
void dt_gui_search_stop (GtkSearchEntry *entry, GtkWidget *widget)
 
static void _collapsible_set_states (dt_gui_collapsible_section_t *cs, gboolean active)
 
static void _coeffs_button_changed (GtkDarktableToggleButton *widget, gpointer user_data)
 
static void _coeffs_expander_click (GtkWidget *widget, GdkEventButton *e, gpointer user_data)
 
void dt_gui_update_collapsible_section (dt_gui_collapsible_section_t *cs)
 
void dt_gui_hide_collapsible_section (dt_gui_collapsible_section_t *cs)
 
void dt_gui_new_collapsible_section (dt_gui_collapsible_section_t *cs, const char *confname, const char *label, GtkBox *parent)
 
void dt_capitalize_label (gchar *text)
 
GtkBox * attach_popover (GtkWidget *widget, const char *icon, GtkWidget *content)
 
GtkBox * attach_help_popover (GtkWidget *widget, const char *label)
 
static gboolean _text_entry_focus_in_event (GtkWidget *self, GdkEventFocus event, gpointer user_data)
 
static gboolean _text_entry_focus_out_event (GtkWidget *self, GdkEventFocus event, gpointer user_data)
 
static gboolean _text_entry_key_pressed (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
 
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. This helps dealing with one-key shortcuts.
 
void dt_gui_refocus_center ()
 

Typedef Documentation

◆ result_t

typedef struct result_t result_t

Function Documentation

◆ _button_pressed()

static gboolean _button_pressed ( GtkWidget *  w,
GdkEventButton *  event,
gpointer  user_data 
)
static

◆ _button_released()

static gboolean _button_released ( GtkWidget *  w,
GdkEventButton *  event,
gpointer  user_data 
)
static

◆ _center_enter()

static gboolean _center_enter ( GtkWidget *  widget,
GdkEventCrossing *  event,
gpointer  user_data 
)
static

References dt_control_mouse_enter(), and TRUE.

Referenced by dt_gui_gtk_init().

◆ _center_leave()

static gboolean _center_leave ( GtkWidget *  widget,
GdkEventCrossing *  event,
gpointer  user_data 
)
static

References dt_control_mouse_leave(), and TRUE.

Referenced by dt_gui_gtk_init().

◆ _coeffs_button_changed()

◆ _coeffs_expander_click()

static void _coeffs_expander_click ( GtkWidget *  widget,
GdkEventButton *  e,
gpointer  user_data 
)
static

◆ _collapsible_set_states()

◆ _configure()

static gboolean _configure ( GtkWidget *  da,
GdkEventConfigure *  event,
gpointer  user_data 
)
static

◆ _delete_child()

static void _delete_child ( GtkWidget *  widget,
gpointer  data 
)
static

References void().

Referenced by dt_gui_container_destroy_children().

◆ _draw()

static gboolean _draw ( GtkWidget *  da,
cairo_t *  cr,
gpointer  user_data 
)
static

◆ _focus_in_out_event()

static gboolean _focus_in_out_event ( GtkWidget *  widget,
GdkEvent *  event,
gpointer  user_data 
)
static

References FALSE.

Referenced by _init_widgets().

◆ _get_axis_name()

static const char * _get_axis_name ( int  pos)
static

Referenced by dt_gui_gtk_init().

◆ _get_container_row_heigth()

static gint _get_container_row_heigth ( GtkWidget *  w)
static

◆ _get_mode_name()

static const char * _get_mode_name ( int  pos)
static

Referenced by dt_gui_gtk_init().

◆ _get_source_name()

static const char * _get_source_name ( int  pos)
static

Referenced by dt_gui_gtk_init().

◆ _init_widgets()

◆ _key_pressed()

static gboolean _key_pressed ( GtkWidget *  w,
GdkEventKey *  event 
)
static

◆ _mouse_moved()

static gboolean _mouse_moved ( GtkWidget *  w,
GdkEventMotion *  event,
gpointer  user_data 
)
static

◆ _notebook_motion_notify_callback()

static gboolean _notebook_motion_notify_callback ( GtkWidget *  widget,
GdkEventMotion *  event,
gpointer  user_data 
)
static

References FALSE.

Referenced by dt_ui_notebook_page().

◆ _notebook_size_callback()

static void _notebook_size_callback ( GtkNotebook *  notebook,
GdkRectangle *  allocation,
gpointer *  data 
)
static

Referenced by dt_ui_notebook_page().

◆ _remove_child()

static void _remove_child ( GtkWidget *  widget,
gpointer  data 
)
static

◆ _scroll_wrap_resize()

static gboolean _scroll_wrap_resize ( GtkWidget *  w,
void cr,
const char *  config_str 
)
static

◆ _scroll_wrap_scroll()

static gboolean _scroll_wrap_scroll ( GtkScrolledWindow *  sw,
GdkEventScroll *  event,
const char *  config_str 
)
static

◆ _scrolled()

static gboolean _scrolled ( GtkWidget *  widget,
GdkEventScroll *  event,
gpointer  user_data 
)
static

◆ _text_entry_focus_in_event()

static gboolean _text_entry_focus_in_event ( GtkWidget *  self,
GdkEventFocus  event,
gpointer  user_data 
)
static

◆ _text_entry_focus_out_event()

static gboolean _text_entry_focus_out_event ( GtkWidget *  self,
GdkEventFocus  event,
gpointer  user_data 
)
static

◆ _text_entry_key_pressed()

static gboolean _text_entry_key_pressed ( GtkWidget *  widget,
GdkEventKey *  event,
gpointer  user_data 
)
static

◆ _ui_log_button_press_event()

static gboolean _ui_log_button_press_event ( GtkWidget *  widget,
GdkEvent *  event,
gpointer  user_data 
)
static

References TRUE.

Referenced by _init_widgets().

◆ _ui_log_redraw_callback()

static void _ui_log_redraw_callback ( gpointer  instance,
GtkWidget *  widget 
)
static

◆ _ui_toast_button_press_event()

static gboolean _ui_toast_button_press_event ( GtkWidget *  widget,
GdkEvent *  event,
gpointer  user_data 
)
static

References TRUE.

Referenced by _init_widgets().

◆ _ui_toast_redraw_callback()

◆ _ui_widget_redraw_callback()

static void _ui_widget_redraw_callback ( gpointer  instance,
GtkWidget *  widget 
)
static

Referenced by _init_widgets().

◆ _window_configure()

static gboolean _window_configure ( GtkWidget *  da,
GdkEvent *  event,
gpointer  user_data 
)
static

◆ _yes_no_button_handler()

static void _yes_no_button_handler ( GtkButton *  button,
gpointer  data 
)
static

◆ attach_help_popover()

GtkBox * attach_help_popover ( GtkWidget *  widget,
const char *  label 
)

Add an help button triggering a popover label next to an arbitrary widget, to document its action. This is a better take at help tooltips that most people don't see, unless they know about them. Also tooltips window positionning is wonky (can easily overflow viewport), line breaks are added manually (ugly hack), and they appear and disappear on hover (not available on touch screens), so it's flimsy UI.

Parameters
widgetthe original widget to document. DON'T add it to a container.
labelthe in-app "docstring" for the widget
Returns
the GtkBox containing both the original widget and its popover button. That's what you will need to add it to your container.

References attach_popover(), and TRUE.

Referenced by gui_init().

◆ attach_popover()

GtkBox * attach_popover ( GtkWidget *  widget,
const char *  icon,
GtkWidget *  content 
)

Add an arbitrary button next to the widget that opens a popover with arbitrary content.

Parameters
widgetthe original widget next to which the popover button will be added. DON'T add it to a container.
iconthe Freedesktop icon name to put in the button
contentthe widget that will fit inside the popover
Returns
the GtkBox containing both the original widget and its popover button. That's what you will need to add it to your container.

References DT_PIXEL_APPLY_DPI, and FALSE.

Referenced by attach_help_popover(), and gui_init().

◆ dt_accels_disconnect_on_text_input()

◆ dt_capitalize_label()

◆ dt_configure_ppd_dpi()

◆ dt_ellipsize_combo()

void dt_ellipsize_combo ( GtkComboBox *  cbox)

◆ dt_get_system_gui_ppd()

double dt_get_system_gui_ppd ( GtkWidget *  widget)

◆ dt_gui_add_class()

◆ dt_gui_add_help_link()

◆ dt_gui_container_destroy_children()

void dt_gui_container_destroy_children ( GtkContainer *  container)

◆ dt_gui_container_first_child()

GtkWidget * dt_gui_container_first_child ( GtkContainer *  container)

References container().

Referenced by _get_container_row_heigth(), and gui_init().

◆ dt_gui_container_has_children()

gboolean dt_gui_container_has_children ( GtkContainer *  container)

References container(), and FALSE.

Referenced by _destroyed_gui_thread().

◆ dt_gui_container_nth_child()

GtkWidget * dt_gui_container_nth_child ( GtkContainer *  container,
int  which 
)

◆ dt_gui_container_num_children()

int dt_gui_container_num_children ( GtkContainer *  container)

References container(), and FALSE.

Referenced by container_len().

◆ dt_gui_container_remove_children()

void dt_gui_container_remove_children ( GtkContainer *  container)

◆ dt_gui_draw_rounded_rectangle()

void dt_gui_draw_rounded_rectangle ( cairo_t *  cr,
float  width,
float  height,
float  x,
float  y 
)

References height, M_PI, and width.

Referenced by gui_draw_sym(), gui_post_expose(), and gui_post_expose().

◆ dt_gui_get_scroll_delta()

gboolean dt_gui_get_scroll_delta ( const GdkEventScroll *  event,
gdouble *  delta 
)

◆ dt_gui_get_scroll_deltas()

gboolean dt_gui_get_scroll_deltas ( const GdkEventScroll *  event,
gdouble *  delta_x,
gdouble *  delta_y 
)

◆ dt_gui_get_scroll_unit_delta()

gboolean dt_gui_get_scroll_unit_delta ( const GdkEventScroll *  event,
int *  delta 
)

◆ dt_gui_get_scroll_unit_deltas()

◆ dt_gui_gtk_init()

◆ dt_gui_gtk_quit()

◆ dt_gui_gtk_run()

◆ dt_gui_gtk_set_source_rgb()

◆ dt_gui_gtk_set_source_rgba()

void dt_gui_gtk_set_source_rgba ( cairo_t *  cr,
dt_gui_color_t  color,
float  opacity_coef 
)

◆ dt_gui_gtk_write_config()

◆ dt_gui_hide_collapsible_section()

◆ dt_gui_load_theme()

◆ dt_gui_menu_popup()

◆ dt_gui_new_collapsible_section()

◆ dt_gui_quit_callback()

gboolean dt_gui_quit_callback ( GtkWidget *  widget,
GdkEvent *  event,
gpointer  user_data 
)

References dt_control_quit(), and TRUE.

Referenced by _init_widgets().

◆ dt_gui_refocus_center()

◆ dt_gui_remove_class()

◆ dt_gui_search_start()

gboolean dt_gui_search_start ( GtkWidget *  widget,
GdkEventKey *  event,
GtkSearchEntry *  entry 
)

References FALSE, and TRUE.

Referenced by init_tab_presets().

◆ dt_gui_search_stop()

void dt_gui_search_stop ( GtkSearchEntry *  entry,
GtkWidget *  widget 
)

Referenced by init_tab_presets().

◆ dt_gui_show_standalone_string_dialog()

char * dt_gui_show_standalone_string_dialog ( const char *  title,
const char *  markup,
const char *  placeholder,
const char *  no_text,
const char *  yes_text 
)

◆ dt_gui_show_standalone_yes_no_dialog()

gboolean dt_gui_show_standalone_yes_no_dialog ( const char *  title,
const char *  markup,
const char *  no_text,
const char *  yes_text 
)

◆ dt_gui_store_last_preset()

void dt_gui_store_last_preset ( const char *  name)

◆ dt_gui_update_collapsible_section()

◆ dt_key_modifier_state()

GdkModifierType dt_key_modifier_state ( )
Todo:
double check correct way of doing this (merge conflict with Input System NG 20210319) GdkKeymap *keymap = gdk_keymap_get_for_display(gdk_display_get_default()); return gdk_keymap_get_modifier_state(keymap) & gdk_keymap_get_modifier_mask(keymap, GDK_MODIFIER_INTENT_DEFAULT_MOD_MASK);

References darktable, dt_ui_main_window(), darktable_t::gui, and dt_gui_gtk_t::ui.

Referenced by _color_picker_callback_button_press(), blend_color_picker_apply(), and color_picker_apply().

◆ dt_ui_container_destroy_children()

void dt_ui_container_destroy_children ( dt_ui_t ui,
const dt_ui_container_t  c 
)

destroy all child widgets from container

References dt_ui_t::containers, and dt_gui_container_destroy_children().

Referenced by dt_view_manager_switch_by_view().

◆ dt_ui_container_focus_widget()

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

References dt_ui_t::containers.

Referenced by _gui_set_single_expanded().

◆ dt_ui_container_foreach()

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

References dt_ui_t::containers.

Referenced by dt_view_manager_switch_by_view().

◆ dt_ui_notebook_new()

GtkNotebook * dt_ui_notebook_new ( )

Referenced by gui_init(), gui_init(), and gui_init().

◆ dt_ui_notebook_page()

GtkWidget * dt_ui_notebook_page ( GtkNotebook *  notebook,
const char *  text,
const char *  tooltip 
)

◆ dt_ui_notify_user()

void dt_ui_notify_user ( )

◆ dt_ui_scroll_wrap()

GtkWidget * dt_ui_scroll_wrap ( GtkWidget *  w,
gint  min_size,
char *  config_str 
)