![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "views/dev_toolbox.h"#include "common/paths.h"#include "widgets/bauhaus.h"#include "colorprofiles/colorspaces.h"#include "common/file_location.h"#include "common/usermanual_url.h"#include "common/conf.h"#include "control/redraw.h"#include "control/signal.h"#include "develop/develop.h"#include "develop/dev_pixelpipe.h"#include "widgets/button.h"#include "widgets/paint.h"#include "widgets/togglebutton.h"#include "widgets/accelerators.h"#include "gui/application.h"#include <limits.h>#include "widgets/popup.h"
Include dependency graph for dev_toolbox.c:Go to the source code of this file.
Macros | |
| #define | DT_DEV_TOOLBOX_BUTTON_TYPE_KEY "dt-dev-toolbox-button-type" |
| #define | DT_DEV_TOOLBOX_PRESHOW_FN_KEY "dt-dev-toolbox-popover-preshow-fn" |
| #define | DT_DEV_TOOLBOX_PRESHOW_DATA_KEY "dt-dev-toolbox-popover-preshow-data" |
| #define DT_DEV_TOOLBOX_BUTTON_TYPE_KEY "dt-dev-toolbox-button-type" |
Definition at line 37 of file dev_toolbox.c.
| #define DT_DEV_TOOLBOX_PRESHOW_DATA_KEY "dt-dev-toolbox-popover-preshow-data" |
Definition at line 65 of file dev_toolbox.c.
| #define DT_DEV_TOOLBOX_PRESHOW_FN_KEY "dt-dev-toolbox-popover-preshow-fn" |
Definition at line 64 of file dev_toolbox.c.
|
static |
Definition at line 549 of file dev_toolbox.c.
References _display_borders_callback(), _display_brightness_callback(), dt_develop_t::button, dt_develop_t::display, dt_bauhaus_get_global(), dt_bauhaus_slider_new_with_range(), dt_bauhaus_slider_set(), dt_bauhaus_slider_set_format(), dt_bauhaus_widget_set_label(), dt_conf_get_int(), dt_dev_toolbox_connect_popover(), DT_DEV_TOOLBOX_POPOVER_KEY, DT_GUI_BOX_SPACING, DT_GUI_MODULE, DT_PIXEL_APPLY_DPI, dt_develop_t::floating_window, and TRUE.
Referenced by dt_dev_toolbox_create().
|
static |
Definition at line 337 of file dev_toolbox.c.
References _overexposed_colorscheme_callback(), _overexposed_lower_callback(), _overexposed_mode_callback(), _overexposed_upper_callback(), dt_develop_t::button, dt_develop_t::colorscheme, DT_BAUHAUS_COMBOBOX_NEW_FULL, dt_bauhaus_get_global(), dt_bauhaus_slider_new_with_range(), dt_bauhaus_slider_set(), dt_bauhaus_slider_set_format(), dt_bauhaus_widget_set_label(), dt_dev_toolbox_connect_popover(), DT_DEV_TOOLBOX_POPOVER_KEY, dt_get_help_url(), dt_gui_add_help_link(), DT_GUI_BOX_SPACING, DT_GUI_MODULE, dt_develop_t::floating_window, dt_develop_t::lower, dt_develop_t::mode, dt_develop_t::overexposed, TRUE, and dt_develop_t::upper.
Referenced by dt_dev_toolbox_create().
|
static |
Definition at line 413 of file dev_toolbox.c.
References _rawoverexposed_colorscheme_callback(), _rawoverexposed_mode_callback(), _rawoverexposed_threshold_callback(), dt_develop_t::button, dt_develop_t::colorscheme, dt_bauhaus_combobox_add(), dt_bauhaus_combobox_new(), DT_BAUHAUS_COMBOBOX_NEW_FULL, dt_bauhaus_combobox_set(), dt_bauhaus_get_global(), dt_bauhaus_slider_new_with_range(), dt_bauhaus_slider_set(), dt_bauhaus_widget_set_label(), dt_dev_toolbox_connect_popover(), DT_DEV_TOOLBOX_POPOVER_KEY, dt_get_help_url(), dt_gui_add_help_link(), DT_GUI_BOX_SPACING, DT_GUI_MODULE, dt_develop_t::floating_window, dt_develop_t::mode, dt_develop_t::rawoverexposed, threshold, dt_develop_t::threshold, and TRUE.
Referenced by dt_dev_toolbox_create().
|
static |
Definition at line 481 of file dev_toolbox.c.
References _softproof_profile_callback(), dt_bauhaus_combobox_add(), dt_bauhaus_combobox_new(), dt_bauhaus_combobox_set(), dt_bauhaus_combobox_set_entries_ellipsis(), dt_bauhaus_get_global(), dt_bauhaus_widget_set_label(), dt_colorprofiles_get_settings(), dt_colorspaces_enumerate_profiles(), dt_colorspaces_profile_index(), dt_dev_toolbox_connect_popover(), DT_DEV_TOOLBOX_POPOVER_KEY, dt_free, dt_free_align, dt_get_help_url(), dt_gui_add_help_link(), DT_GUI_BOX_SPACING, DT_GUI_MODULE, dt_loc_get_datadir(), dt_loc_get_user_config_dir(), DT_PATH_MAX, DT_PROFILE_ROLE_OUTPUT, dt_develop_t::floating_window, dt_develop_t::gamut_button, k, name, dt_develop_t::profile, dt_develop_t::softproof_button, dt_colorprofiles_settings_t::softproof_filename, dt_colorprofiles_settings_t::softproof_type, tooltip, and TRUE.
Referenced by dt_dev_toolbox_create().
Definition at line 255 of file dev_toolbox.c.
References _update_softproof_gamut_checking(), dt_colorprofiles_toggle_mode(), dt_control_queue_redraw_center(), dt_dev_pixelpipe_resync_history_main, dt_dev_toolbox_apply_iso_12646_size(), DT_DEV_TOOLBOX_BUTTON_TYPE_KEY, 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, DT_PROFILE_GAMUTCHECK, DT_PROFILE_SOFTPROOF, dt_develop_t::enabled, dt_develop_t::gui_attached, dt_develop_t::iso_12646, dt_develop_t::overexposed, dt_develop_t::rawoverexposed, and type.
Referenced by _create_one_button(), and _update_softproof_gamut_checking().
|
static |
Definition at line 582 of file dev_toolbox.c.
References _button_clicked(), dt_develop_t::button, dt_develop_t::display, DT_DEV_TOOLBOX_BUTTON_TYPE_KEY, 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, dt_view_manager_get_global(), dt_view_manager_module_toolbox_add(), dtgtk_button_new(), dtgtk_cairo_paint_bulb(), dtgtk_cairo_paint_display(), dtgtk_cairo_paint_gamut_check(), dtgtk_cairo_paint_overexposed(), dtgtk_cairo_paint_rawoverexposed(), dtgtk_cairo_paint_softproof(), dtgtk_togglebutton_new(), dt_develop_t::gamut_button, dt_develop_t::iso_12646, dt_develop_t::overexposed, dt_develop_t::profile, dt_develop_t::rawoverexposed, dt_develop_t::softproof_button, tooltip, type, and views().
Referenced by dt_dev_toolbox_create().
Definition at line 540 of file dev_toolbox.c.
References dt_bauhaus_slider_get(), dt_conf_set_int(), dt_control_signal_get_global(), DT_DEBUG_CONTROL_SIGNAL_RAISE, dt_dev_pixelpipe_change_zoom_main(), dt_dev_toolbox_apply_iso_12646_size(), and DT_SIGNAL_DARKROOM_UI_CHANGED.
Referenced by _build_display_popover().
Definition at line 533 of file dev_toolbox.c.
References dt_bauhaus_slider_get(), dt_conf_set_int(), dt_control_queue_redraw_center(), dt_control_signal_get_global(), DT_DEBUG_CONTROL_SIGNAL_RAISE, and DT_SIGNAL_DARKROOM_UI_CHANGED.
Referenced by _build_display_popover().
Definition at line 313 of file dev_toolbox.c.
References dt_develop_t::button, dt_develop_t::colorscheme, dt_bauhaus_combobox_get(), dt_dev_pixelpipe_resync_history_main, dt_develop_t::enabled, FALSE, and dt_develop_t::overexposed.
Referenced by _build_overexposed_popover().
Definition at line 321 of file dev_toolbox.c.
References dt_develop_t::button, dt_bauhaus_slider_get(), dt_dev_pixelpipe_resync_history_main, dt_develop_t::enabled, FALSE, dt_develop_t::lower, and dt_develop_t::overexposed.
Referenced by _build_overexposed_popover().
Definition at line 305 of file dev_toolbox.c.
References dt_develop_t::button, dt_bauhaus_combobox_get(), dt_dev_pixelpipe_update_history_main, dt_develop_t::enabled, FALSE, dt_develop_t::mode, and dt_develop_t::overexposed.
Referenced by _build_overexposed_popover().
Definition at line 329 of file dev_toolbox.c.
References dt_develop_t::button, dt_bauhaus_slider_get(), dt_dev_pixelpipe_resync_history_main, dt_develop_t::enabled, FALSE, dt_develop_t::overexposed, and dt_develop_t::upper.
Referenced by _build_overexposed_popover().
|
static |
Definition at line 112 of file dev_toolbox.c.
References dt_dev_toolbox_show_popup(), FALSE, and TRUE.
Referenced by dt_dev_toolbox_connect_popover().
Definition at line 397 of file dev_toolbox.c.
References dt_develop_t::button, dt_develop_t::colorscheme, dt_bauhaus_combobox_get(), dt_dev_pixelpipe_resync_history_main, dt_develop_t::enabled, FALSE, and dt_develop_t::rawoverexposed.
Referenced by _build_rawoverexposed_popover().
Definition at line 389 of file dev_toolbox.c.
References dt_develop_t::button, dt_bauhaus_combobox_get(), dt_dev_pixelpipe_resync_history_main, dt_develop_t::enabled, FALSE, dt_develop_t::mode, and dt_develop_t::rawoverexposed.
Referenced by _build_rawoverexposed_popover().
Definition at line 405 of file dev_toolbox.c.
References dt_develop_t::button, dt_bauhaus_slider_get(), dt_dev_pixelpipe_resync_history_main, dt_develop_t::enabled, FALSE, dt_develop_t::rawoverexposed, and dt_develop_t::threshold.
Referenced by _build_rawoverexposed_popover().
Definition at line 455 of file dev_toolbox.c.
References dt_bauhaus_combobox_get(), dt_bauhaus_combobox_get_text(), dt_colorprofiles_set_softproof_profile_choice(), DT_COLORSPACE_SRGB, dt_colorspaces_profile_at(), DT_COLORSPACES_PROFILE_TYPE_SOFTPROOF, dt_control_signal_get_global(), DT_DEBUG_CONTROL_SIGNAL_RAISE, dt_dev_pixelpipe_resync_history_main, DT_PROFILE_ROLE_OUTPUT, DT_SIGNAL_CONTROL_PROFILE_USER_CHANGED, FALSE, dt_colorprofile_desc_t::filename, profile_changed(), and dt_colorprofile_desc_t::type.
Referenced by _build_softproof_gamut_popover().
|
static |
Definition at line 238 of file dev_toolbox.c.
References _button_clicked(), dt_colorprofiles_get_settings(), DT_PROFILE_GAMUTCHECK, DT_PROFILE_SOFTPROOF, dt_develop_t::gamut_button, dt_colorprofiles_settings_t::mode, dt_develop_t::profile, and dt_develop_t::softproof_button.
Referenced by _button_clicked(), and dt_dev_toolbox_create().
| 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 148 of file dev_toolbox.c.
References FALSE, IS_NULL_PTR, and TRUE.
Referenced by dt_dev_toolbox_add_accels(), and gui_init().
| 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 dt_gui_get_accels()->darkroom_accels and N_("Darkroom/Toolbox"); Studio Capture passes dt_gui_get_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 173 of file dev_toolbox.c.
References dt_develop_t::button, 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, dt_gui_get_accels(), FALSE, dt_develop_t::gamut_button, 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().
| void dt_dev_toolbox_apply_iso_12646_size | ( | struct dt_develop_t * | dev | ) |
Re-apply dt_dev_viewport_border_size(dev) 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 39 of file dev_toolbox.c.
References dt_conf_get_int(), dt_dev_configure, dt_dev_viewport_border_size(), dt_dev_viewport_set_border(), dt_dev_viewport_widget_height(), dt_dev_viewport_widget_width(), DT_PIXEL_APPLY_DPI, dt_develop_t::enabled, dt_develop_t::iso_12646, and MIN.
Referenced by _button_clicked(), _display_borders_callback(), _studio_configure_dev_roi(), and configure().
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 135 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().
| 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 633 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().
| gboolean dt_dev_toolbox_focus_accel | ( | GtkAccelGroup * | accel_group, |
| GObject * | accelerable, | ||
| guint | keyval, | ||
| GdkModifierType | modifier, | ||
| gpointer | data | ||
| ) |
Definition at line 158 of file dev_toolbox.c.
References DT_DEV_TOOLBOX_POPOVER_KEY, dt_dev_toolbox_show_popup(), FALSE, IS_NULL_PTR, and TRUE.
Referenced by dt_dev_toolbox_add_accels(), and gui_init().
| 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 67 of file dev_toolbox.c.
References DT_DEV_TOOLBOX_PRESHOW_DATA_KEY, and DT_DEV_TOOLBOX_PRESHOW_FN_KEY.
Referenced by gui_init().
| 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 73 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().