Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
dev_toolbox.h File Reference
#include <stddef.h>
#include "views/view.h"
+ Include dependency graph for dev_toolbox.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define DT_DEV_TOOLBOX_POPOVER_KEY   "dt-dev-toolbox-popover"
 

Typedefs

typedef enum dt_dev_toolbox_button_t dt_dev_toolbox_button_t
 

Enumerations

enum  dt_dev_toolbox_button_t {
  DT_DEV_TOOLBOX_ISO_12646 ,
  DT_DEV_TOOLBOX_OVEREXPOSED ,
  DT_DEV_TOOLBOX_RAWOVEREXPOSED ,
  DT_DEV_TOOLBOX_SOFTPROOF ,
  DT_DEV_TOOLBOX_GAMUT ,
  DT_DEV_TOOLBOX_DISPLAY
}
 

Functions

void dt_dev_toolbox_create (struct dt_develop_t *dev, dt_view_type_flags_t views, const dt_dev_toolbox_button_t *buttons, size_t n_buttons)
 
void dt_dev_toolbox_add_accels (struct dt_develop_t *dev, GtkAccelGroup *accel_group, const char *category, const dt_dev_toolbox_button_t *buttons, size_t n_buttons)
 
gboolean dt_dev_toolbox_activate_accel (GtkAccelGroup *accel_group, GObject *accelerable, guint keyval, GdkModifierType modifier, gpointer data)
 
gboolean dt_dev_toolbox_focus_accel (GtkAccelGroup *accel_group, GObject *accelerable, guint keyval, GdkModifierType modifier, gpointer data)
 
void dt_dev_toolbox_apply_iso_12646_size (struct dt_develop_t *dev)
 
void dt_dev_toolbox_connect_popover (GtkWidget *button, GtkWidget *popover)
 
gboolean dt_dev_toolbox_show_popup (gpointer popover)
 
void dt_dev_toolbox_popover_set_preshow (GtkWidget *popover, void(*preshow)(gpointer user_data), gpointer user_data)
 

Macro Definition Documentation

◆ DT_DEV_TOOLBOX_POPOVER_KEY

#define DT_DEV_TOOLBOX_POPOVER_KEY   "dt-dev-toolbox-popover"

The g_object_data key dt_dev_toolbox_connect_popover() and dt_dev_toolbox_create() tag a button with, pointing to its popover — use it to look a button's popover back up (e.g. a "focus this popover" accelerator).

Definition at line 114 of file dev_toolbox.h.

Typedef Documentation

◆ dt_dev_toolbox_button_t

Bottom-toolbar quick-access buttons shared by any view owning its own dt_develop_t (darkroom, Studio Capture...).

Enumeration Type Documentation

◆ dt_dev_toolbox_button_t

Bottom-toolbar quick-access buttons shared by any view owning its own dt_develop_t (darkroom, Studio Capture...).

Enumerator
DT_DEV_TOOLBOX_ISO_12646 
DT_DEV_TOOLBOX_OVEREXPOSED 
DT_DEV_TOOLBOX_RAWOVEREXPOSED 
DT_DEV_TOOLBOX_SOFTPROOF 
DT_DEV_TOOLBOX_GAMUT 
DT_DEV_TOOLBOX_DISPLAY 

Definition at line 26 of file dev_toolbox.h.

Function Documentation

◆ dt_dev_toolbox_activate_accel()

gboolean dt_dev_toolbox_activate_accel ( GtkAccelGroup *  accel_group,
GObject *  accelerable,
guint  keyval,
GdkModifierType  modifier,
gpointer  data 
)

Generic accelerator callbacks: reused by dt_dev_toolbox_add_accels(), and directly usable by any view wiring its own popover-anchored button outside this button set (darkroom's guides and auto-set buttons, for instance). "Activate" simulates a click on data (the button widget); "focus" grabs it and shows its popover (looked up via DT_DEV_TOOLBOX_POPOVER_KEY).

Definition at line 147 of file dev_toolbox.c.

References FALSE, IS_NULL_PTR, and TRUE.

Referenced by dt_dev_toolbox_add_accels(), and gui_init().

◆ dt_dev_toolbox_add_accels()

void dt_dev_toolbox_add_accels ( struct dt_develop_t dev,
GtkAccelGroup *  accel_group,
const char *  category,
const dt_dev_toolbox_button_t buttons,
size_t  n_buttons 
)

Add the same "activate this button" (and, for buttons with a popover, "focus its popover") keyboard accelerators for every button in buttons, on accel_group/category. The action names ("Toggle clipping indication", "Focus softproof options"...) are the same regardless of which view/accel group they're bound to, since the buttons themselves are shared — only the accelerator group and category differ per caller (e.g. darkroom passes darktable.gui->accels->darkroom_accels and N_("Darkroom/Toolbox"); Studio Capture passes darktable.gui->accels->lighttable_accels, the group it actually connects, and its own category). Call after dt_dev_toolbox_create() so the buttons (and popovers) already exist.

Definition at line 172 of file dev_toolbox.c.

References dt_gui_gtk_t::accels, dt_develop_t::button, darktable, dt_develop_t::display, dt_accels_new_action_shortcut(), dt_dev_toolbox_activate_accel(), DT_DEV_TOOLBOX_DISPLAY, dt_dev_toolbox_focus_accel(), DT_DEV_TOOLBOX_GAMUT, DT_DEV_TOOLBOX_ISO_12646, DT_DEV_TOOLBOX_OVEREXPOSED, DT_DEV_TOOLBOX_RAWOVEREXPOSED, DT_DEV_TOOLBOX_SOFTPROOF, FALSE, dt_develop_t::gamut_button, darktable_t::gui, i, dt_develop_t::iso_12646, dt_develop_t::overexposed, dt_develop_t::profile, dt_develop_t::rawoverexposed, and dt_develop_t::softproof_button.

Referenced by gui_init().

◆ dt_dev_toolbox_apply_iso_12646_size()

void dt_dev_toolbox_apply_iso_12646_size ( struct dt_develop_t dev)

Re-apply dev->roi.border_size from dev->iso_12646.enabled and the "plugins/darkroom/ui/border_size" conf key, then dt_dev_configure() the result. Called by the ISO 12646 toggle, and by any view that needs to resize on iso_12646 changes from its own configure()/resize handling.

Definition at line 38 of file dev_toolbox.c.

References dt_develop_t::border_size, dt_conf_get_int(), dt_dev_configure, DT_PIXEL_APPLY_DPI, dt_develop_t::enabled, dt_develop_t::iso_12646, MIN, dt_develop_t::orig_height, dt_develop_t::orig_width, and dt_develop_t::roi.

Referenced by _button_clicked(), _display_borders_callback(), _studio_configure_dev_roi(), and configure().

◆ dt_dev_toolbox_connect_popover()

void dt_dev_toolbox_connect_popover ( GtkWidget button,
GtkWidget popover 
)

Anchor popover to button: right-click, or releasing after a long press, shows it near the pointer. Generic — used for every popover built by dt_dev_toolbox_create(), and reusable for view-owned popovers outside this button set (e.g. darkroom's guides and auto-set popovers).

Definition at line 134 of file dev_toolbox.c.

References _quickbutton_press_release().

Referenced by _build_display_popover(), _build_overexposed_popover(), _build_rawoverexposed_popover(), _build_softproof_gamut_popover(), and gui_init().

◆ dt_dev_toolbox_create()

void dt_dev_toolbox_create ( struct dt_develop_t dev,
dt_view_type_flags_t  views,
const dt_dev_toolbox_button_t buttons,
size_t  n_buttons 
)

Create every button listed in buttons for dev, register each into the module toolbox for the given view flag(s), and wire every one of them to a single shared click handler that dispatches by which button fired the event (a g_object_set_data tag, not one callback per button). Each button is stored in its matching dt_develop_t field as it always was (dev->iso_12646.button, dev->overexposed.button, dev->profile.softproof_button...).

Buttons with an options popover (everything except ISO 12646) also get one built here, anchored via dt_dev_toolbox_connect_popover() and filled with the controls generic enough to make sense for any view (thresholds, mode/colorscheme, profile picker, background brightness/margins). The popover's content box is a plain GtkBox, retrievable with gtk_bin_get_child(GTK_BIN(dev->X.floating_window)): a caller wanting extra, view-specific controls (e.g. darkroom's rendering-size and mask-preview-checkerboard additions to Picture display's popover) packs them into that same box and calls gtk_widget_show_all() itself once done — this function does not call it, so callers control when the popover is considered fully assembled. Softproof and gamut still share one popover, built only once both are present in the same call.

Accelerators are NOT wired here — see dt_dev_toolbox_add_accels() — so callers needing them call it separately, after this one.

Definition at line 641 of file dev_toolbox.c.

References _build_display_popover(), _build_overexposed_popover(), _build_rawoverexposed_popover(), _build_softproof_gamut_popover(), _create_one_button(), _update_softproof_gamut_checking(), DT_DEV_TOOLBOX_DISPLAY, DT_DEV_TOOLBOX_GAMUT, DT_DEV_TOOLBOX_ISO_12646, DT_DEV_TOOLBOX_OVEREXPOSED, DT_DEV_TOOLBOX_RAWOVEREXPOSED, DT_DEV_TOOLBOX_SOFTPROOF, FALSE, i, TRUE, and views().

Referenced by gui_init().

◆ dt_dev_toolbox_focus_accel()

gboolean dt_dev_toolbox_focus_accel ( GtkAccelGroup *  accel_group,
GObject *  accelerable,
guint  keyval,
GdkModifierType  modifier,
gpointer  data 
)

◆ dt_dev_toolbox_popover_set_preshow()

void dt_dev_toolbox_popover_set_preshow ( GtkWidget popover,
void(*)(gpointer user_data)  preshow,
gpointer  user_data 
)

Run preshow (with user_data) right before dt_dev_toolbox_show_popup() shows popover — e.g. to refresh the popover's content from state that changed since it was built. Optional; a popover with none just shows as-is.

Definition at line 66 of file dev_toolbox.c.

References DT_DEV_TOOLBOX_PRESHOW_DATA_KEY, and DT_DEV_TOOLBOX_PRESHOW_FN_KEY.

Referenced by gui_init().

◆ dt_dev_toolbox_show_popup()

gboolean dt_dev_toolbox_show_popup ( gpointer  popover)

Position and show popover (passed as a bare GtkWidget* so this can be used directly as a glib timeout/idle callback). Exposed so a caller can trigger the same show/anchor path from an accelerator (keyboard-activated "focus this popover" actions, for instance).

Definition at line 72 of file dev_toolbox.c.

References DT_DEV_TOOLBOX_PRESHOW_DATA_KEY, DT_DEV_TOOLBOX_PRESHOW_FN_KEY, dt_gui_get_popup_relative_widget(), FALSE, void(), x, rect::x, and rect::y.

Referenced by _quickbutton_press_release(), and dt_dev_toolbox_focus_accel().