![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "system/macros.h"#include "system/mem_alloc.h"#include "develop/masks.h"#include "widgets/bauhaus.h"#include "common/conf.h"#include "control/signal.h"#include "develop/imageop_gui.h"#include "widgets/paint.h"#include "gui/actions/menu.h"#include "widgets/draw.h"#include "gui/application.h"#include <math.h>#include <stdlib.h>
Include dependency graph for masks_gui.c:Go to the source code of this file.
Data Structures | |
| struct | dt_masks_shape_button_def_t |
| struct | dt_masks_shape_buttons_data_t |
| struct | dt_masks_gui_interaction_slider_t |
Macros | |
| #define | DT_MASKS_SHAPE_BUTTON_COUNT 5 |
| #define | masks_gtk_menu_item_new_bold(label, selected, state, icon) |
Typedefs | |
| typedef struct dt_masks_shape_button_def_t | dt_masks_shape_button_def_t |
| typedef struct dt_masks_shape_buttons_data_t | dt_masks_shape_buttons_data_t |
| typedef struct dt_masks_gui_interaction_slider_t | dt_masks_gui_interaction_slider_t |
Functions | |
| static void | _masks_shape_buttons_deactivate (GtkWidget *active_button, dt_masks_shape_buttons_data_t *data) |
| static void | _masks_shape_buttons_deactivate_signal (gpointer instance, GtkWidget *active_button, dt_masks_shape_buttons_data_t *data) |
| void | dt_masks_shape_buttons_deactivate_all (GtkWidget *active_button) |
| static int | _masks_shape_button_index (const dt_masks_shape_buttons_data_t *data, GtkWidget *button) |
| static gboolean | _masks_shape_button_is_current_creation (dt_develop_t *dev, const dt_masks_shape_buttons_data_t *data, const int button_index) |
| static gboolean | _masks_shape_button_pressed (GtkWidget *button, GdkEventButton *event, gpointer user_data) |
| static void | _masks_shape_buttons_destroy (GtkWidget *widget, dt_masks_shape_buttons_data_t *data) |
| GtkWidget * | dt_masks_shape_buttons_create (const dt_masks_shape_buttons_config_t *config) |
| Build a synchronized toolbar for creating masks shapes. | |
| static void | _masks_gui_interaction_commit (dt_masks_gui_interaction_slider_t *data) |
| static void | _masks_gui_interaction_apply_value (dt_masks_gui_interaction_slider_t *data, float value) |
| static void | _masks_gui_menu_item_block_activate (GtkWidget *widget, gpointer user_data) |
| static gboolean | _masks_gui_menu_item_forward_event (GtkWidget *widget, GdkEvent *event, gpointer user_data) |
| static void | _masks_gui_interaction_slider_changed (GtkWidget *widget, gpointer user_data) |
| GtkWidget * | dt_masks_gui_add_interaction_slider (GtkWidget *menu, const char *label, dt_masks_form_group_t *form_group, dt_masks_interaction_t interaction, dt_masks_increment_t increment, float min, float max, float step, float value, int digits, const char *format, float factor, dt_masks_form_gui_t *gui, dt_iop_module_t *module) |
| Append a bauhaus-slider menu item to a mask context menu, bound to one shape interaction (size, fading/hardness, rotation, opacity). Shared by the darkroom canvas context menu (dt_masks_create_menu) and the blend module's own shape-list context menus, so both stay in sync. | |
| int | dt_masks_gui_confirm_delete_form_dialog (const char *form_name) |
| gboolean | dt_masks_gui_confirm_permanent_delete (const char *form_name) |
| Ask the user to confirm a permanent shape deletion, gated by the "ask_before_delete_mask_shape" pref. Shows a "Always ask" checkbox that writes back to the pref regardless of the response. Returns TRUE immediately without showing anything when the pref is off. | |
| static gboolean | _masks_gui_resolve_selected_shape (dt_masks_form_gui_t *gui, dt_iop_module_t **module, dt_masks_form_t **sel, int *parentid, int *formid) |
| static void | _masks_gui_remove_from_group_callback (GtkWidget *menu, gpointer user_data) |
| static void | _masks_gui_full_delete_callback (GtkWidget *menu, gpointer user_data) |
| void | _masks_gui_delete_node_callback (GtkWidget *menu, gpointer user_data) |
| static void | _masks_gui_exit_creation_callback (GtkWidget *menu, gpointer user_data) |
| static void | _masks_move_up_down_callback (gpointer user_data, const int up) |
| static void | _masks_moveup_callback (GtkWidget *menu, gpointer user_data) |
| static void | _masks_movedown_callback (GtkWidget *menu, gpointer user_data) |
| static void | _masks_operation_callback (GtkWidget *menu, gpointer user_data) |
| void | dt_masks_gui_populate_interaction_sliders (GtkWidget *menu, dt_develop_t *dev, dt_masks_form_t *form, dt_masks_form_group_t *op_form, dt_masks_form_gui_t *gui, dt_iop_module_t *module) |
Append the full set of shape-parameter sliders (size/fading/rotation or curvature/fade/rotation depending on shape type, plus opacity) for form/op_form to menu. op_form is the group-membership entry the sliders read/write (see dt_masks_form_group_t) and must already be a live, COW-safe pointer into the owning group's points list. | |
| GtkWidget * | dt_masks_create_menu (dt_masks_form_gui_t *gui, dt_masks_form_t *form, const dt_masks_form_group_t *formgroup, const float pzx, const float pzy) |
Variables | |
| static const dt_masks_shape_button_def_t | _masks_shape_button_defs [] |
| #define DT_MASKS_SHAPE_BUTTON_COUNT 5 |
Definition at line 34 of file masks_gui.c.
| #define masks_gtk_menu_item_new_bold | ( | label, | |
| selected, | |||
| state, | |||
| icon | |||
| ) |
Definition at line 644 of file masks_gui.c.
| typedef struct dt_masks_shape_button_def_t dt_masks_shape_button_def_t |
| typedef struct dt_masks_shape_buttons_data_t dt_masks_shape_buttons_data_t |
Definition at line 543 of file masks_gui.c.
References dt_masks_form_gui_t::creation, dt_masks_form_gui_t::dev, dt_dev_add_history_item, dt_masks_form_exit_creation(), dt_masks_form_get_selected_group(), dt_masks_get_from_id(), dt_masks_get_visible_form(), dt_masks_remove_node(), dt_masks_form_group_t::formid, dt_masks_form_gui_t::group_selected, IS_NULL_PTR, dt_masks_form_gui_t::node_dragging, dt_masks_form_gui_t::node_hovered, dt_masks_form_group_t::parentid, and TRUE.
Referenced by _polygon_populate_context_menu(), and dt_masks_create_menu().
Definition at line 580 of file masks_gui.c.
References dt_masks_form_exit_creation(), and IS_NULL_PTR.
Referenced by dt_masks_create_menu().
Definition at line 532 of file masks_gui.c.
References _masks_gui_resolve_selected_shape(), and dt_masks_delete_shape().
Referenced by dt_masks_create_menu().
|
static |
Definition at line 274 of file masks_gui.c.
References _masks_gui_interaction_commit(), delta, dt_masks_form_set_interaction_value(), DT_MASKS_INCREMENT_ABSOLUTE, DT_MASKS_INCREMENT_SCALE, dt_masks_gui_interaction_slider_t::form_group, dt_masks_gui_interaction_slider_t::gui, dt_masks_gui_interaction_slider_t::increment, dt_masks_gui_interaction_slider_t::interaction, IS_NULL_PTR, dt_masks_gui_interaction_slider_t::last_value, and value.
Referenced by _masks_gui_interaction_slider_changed().
|
static |
Definition at line 264 of file masks_gui.c.
References dt_masks_form_gui_t::dev, dt_control_signal_get_global(), DT_DEBUG_CONTROL_SIGNAL_RAISE, dt_dev_add_history_item, DT_MASKS_EVENT_UPDATE, DT_SIGNAL_MASK_CHANGED, dt_masks_gui_interaction_slider_t::form_group, dt_masks_form_group_t::formid, dt_masks_gui_interaction_slider_t::gui, IS_NULL_PTR, dt_masks_form_group_t::parentid, and TRUE.
Referenced by _masks_gui_interaction_apply_value().
Definition at line 378 of file masks_gui.c.
References _masks_gui_interaction_apply_value(), dt_bauhaus_slider_get(), dt_masks_gui_interaction_slider_t::form_group, and IS_NULL_PTR.
Referenced by dt_masks_gui_add_interaction_slider().
Definition at line 298 of file masks_gui.c.
Referenced by dt_masks_gui_add_interaction_slider().
|
static |
Definition at line 303 of file masks_gui.c.
References copy(), FALSE, IS_NULL_PTR, dt_masks_gui_interaction_slider_t::slider, TRUE, and x.
Referenced by dt_masks_gui_add_interaction_slider().
Definition at line 520 of file masks_gui.c.
References _masks_gui_resolve_selected_shape(), and dt_masks_remove_shape_from_group().
Referenced by dt_masks_create_menu().
|
static |
Definition at line 498 of file masks_gui.c.
References dt_masks_form_gui_t::dev, dt_masks_form_get_selected_group(), dt_masks_get_from_id(), dt_masks_get_visible_form(), FALSE, dt_masks_form_group_t::formid, dt_masks_form_gui_t::group_selected, dt_develop_t::gui_module, IS_NULL_PTR, dt_masks_form_group_t::parentid, and TRUE.
Referenced by _masks_gui_full_delete_callback(), and _masks_gui_remove_from_group_callback().
|
static |
Definition at line 588 of file masks_gui.c.
References dt_masks_form_gui_t::dev, dt_control_signal_get_global(), DT_DEBUG_CONTROL_SIGNAL_RAISE, dt_masks_cow_touch(), DT_MASKS_EVENT_CHANGE, dt_masks_form_get_selected_group(), dt_masks_form_move(), dt_masks_get_from_id(), dt_masks_get_visible_form(), DT_MASKS_GROUP, DT_SIGNAL_MASK_CHANGED, dt_masks_form_group_t::formid, dt_masks_form_gui_t::group_selected, IS_NULL_PTR, dt_masks_form_group_t::parentid, and dt_masks_form_t::type.
Referenced by _masks_movedown_callback(), and _masks_moveup_callback().
Definition at line 615 of file masks_gui.c.
References _masks_move_up_down_callback().
Referenced by dt_masks_create_menu().
Definition at line 610 of file masks_gui.c.
References _masks_move_up_down_callback().
Referenced by dt_masks_create_menu().
Contextual menu
Definition at line 622 of file masks_gui.c.
References apply_operation(), dt_control_log(), dt_control_signal_get_global(), DT_DEBUG_CONTROL_SIGNAL_RAISE, DT_MASKS_EVENT_UPDATE, DT_MASKS_STATE_IS_COMBINE_OP, DT_SIGNAL_MASK_CHANGED, dt_masks_form_group_t::formid, IS_NULL_PTR, and dt_masks_form_group_t::parentid.
|
static |
Definition at line 91 of file masks_gui.c.
References dt_masks_shape_buttons_data_t::buttons, DT_MASKS_SHAPE_BUTTON_COUNT, i, and IS_NULL_PTR.
Referenced by _masks_shape_button_pressed().
|
static |
Definition at line 102 of file masks_gui.c.
References dt_masks_shape_buttons_data_t::config, dt_masks_form_gui_t::creation, dt_masks_form_gui_t::creation_module, dt_masks_shape_buttons_config_t::creation_module, dt_masks_get_visible_form(), dt_develop_t::form_gui, IS_NULL_PTR, dt_masks_form_t::type, and dt_masks_shape_buttons_data_t::types.
Referenced by _masks_shape_button_pressed().
|
static |
Definition at line 115 of file masks_gui.c.
References _masks_shape_button_index(), _masks_shape_button_is_current_creation(), dt_masks_shape_buttons_config_t::can_start, dt_masks_shape_buttons_data_t::config, dt_control_queue_redraw_center(), dt_gui_center_widget(), dt_gui_widgets_suppressed(), dt_masks_creation_mode_enter(), dt_masks_form_exit_creation(), dt_masks_shape_buttons_deactivate_all(), dt_masks_shape_buttons_config_t::exited, FALSE, dt_masks_shape_buttons_config_t::form_type, IS_NULL_PTR, dt_masks_shape_buttons_config_t::started, TRUE, type, dt_masks_shape_buttons_data_t::types, and dt_masks_shape_buttons_config_t::user_data.
Referenced by dt_masks_shape_buttons_create().
|
static |
Definition at line 67 of file masks_gui.c.
References dt_masks_shape_buttons_data_t::buttons, DT_MASKS_SHAPE_BUTTON_COUNT, FALSE, i, and IS_NULL_PTR.
Referenced by _masks_shape_buttons_deactivate_signal().
|
static |
Definition at line 80 of file masks_gui.c.
References _masks_shape_buttons_deactivate().
Referenced by _masks_shape_buttons_destroy(), and dt_masks_shape_buttons_create().
|
static |
Definition at line 169 of file masks_gui.c.
References _masks_shape_buttons_deactivate_signal(), dt_control_signal_get_global(), DT_DEBUG_CONTROL_SIGNAL_DISCONNECT, and dt_free.
Referenced by dt_masks_shape_buttons_create().
| GtkWidget * dt_masks_create_menu | ( | dt_masks_form_gui_t * | gui, |
| dt_masks_form_t * | form, | ||
| const dt_masks_form_group_t * | formgroup, | ||
| const float | pzx, | ||
| const float | pzy | ||
| ) |
Definition at line 724 of file masks_gui.c.
References _masks_gui_delete_node_callback(), _masks_gui_exit_creation_callback(), _masks_gui_full_delete_callback(), _masks_gui_remove_from_group_callback(), _masks_movedown_callback(), _masks_moveup_callback(), dt_masks_form_gui_t::creation, ctx_gtk_menu_item_new_with_markup(), ctx_gtk_menu_item_new_with_markup_and_pixbuf(), dt_masks_form_gui_t::dev, dt_draw_get_pixbuf_from_cairo(), dt_free, DT_MASKS_BRUSH, DT_MASKS_CIRCLE, DT_MASKS_ELLIPSE, dt_masks_form_group_from_parentid(), dt_masks_get_from_id(), DT_MASKS_GRADIENT, DT_MASKS_GROUP, dt_masks_gui_populate_interaction_sliders(), DT_MASKS_IS_RETOUCHE, DT_MASKS_POLYGON, DT_MASKS_STATE_DIFFERENCE, DT_MASKS_STATE_EXCLUSION, DT_MASKS_STATE_INTERSECTION, DT_MASKS_STATE_INVERSE, DT_MASKS_STATE_IS_COMBINE_OP, DT_MASKS_STATE_UNION, DT_PIXEL_APPLY_DPI, dtgtk_cairo_paint_masks_difference(), dtgtk_cairo_paint_masks_exclusion(), dtgtk_cairo_paint_masks_intersection(), dtgtk_cairo_paint_masks_inverse(), dtgtk_cairo_paint_masks_union(), FALSE, dt_masks_form_gui_t::form_selected, dt_masks_form_group_t::formid, dt_masks_form_t::formid, dt_masks_form_t::functions, dt_develop_t::gui_module, IS_NULL_PTR, k, masks_gtk_menu_item_new_bold, MAX, menu_item_set_fake_accel, dt_masks_form_t::name, dt_masks_form_gui_t::node_hovered, dt_masks_form_gui_t::node_selected, dt_masks_form_group_t::parentid, dt_masks_form_t::points, dt_masks_functions_t::populate_context_menu, dt_masks_form_gui_t::seg_hovered, dt_masks_form_group_t::state, state, TRUE, dt_masks_form_t::type, and width.
Referenced by dt_masks_events_button_pressed().
| GtkWidget * dt_masks_gui_add_interaction_slider | ( | GtkWidget * | menu, |
| const char * | label, | ||
| dt_masks_form_group_t * | form_group, | ||
| dt_masks_interaction_t | interaction, | ||
| dt_masks_increment_t | increment, | ||
| float | min, | ||
| float | max, | ||
| float | step, | ||
| float | value, | ||
| int | digits, | ||
| const char * | format, | ||
| float | factor, | ||
| dt_masks_form_gui_t * | gui, | ||
| dt_iop_module_t * | module | ||
| ) |
Append a bauhaus-slider menu item to a mask context menu, bound to one shape interaction (size, fading/hardness, rotation, opacity). Shared by the darkroom canvas context menu (dt_masks_create_menu) and the blend module's own shape-list context menus, so both stay in sync.
Definition at line 386 of file masks_gui.c.
References _masks_gui_interaction_slider_changed(), _masks_gui_menu_item_block_activate(), _masks_gui_menu_item_forward_event(), dt_bauhaus_get_global(), dt_bauhaus_slider_new_with_range(), dt_bauhaus_slider_set(), dt_bauhaus_slider_set_digits(), dt_bauhaus_slider_set_factor(), dt_bauhaus_slider_set_format(), DT_BAUHAUS_WIDGET, dt_bauhaus_widget_set_label(), DT_GUI_BOX_SPACING, DT_GUI_MODULE, DT_PIXEL_APPLY_DPI, factor, FALSE, dt_masks_gui_interaction_slider_t::form_group, dt_masks_gui_interaction_slider_t::gui, dt_masks_gui_interaction_slider_t::increment, dt_masks_gui_interaction_slider_t::interaction, dt_masks_gui_interaction_slider_t::last_value, max, min, dt_masks_gui_interaction_slider_t::slider, TRUE, and value.
Referenced by dt_masks_gui_populate_interaction_sliders().
| int dt_masks_gui_confirm_delete_form_dialog | ( | const char * | form_name | ) |
Dialogs
Definition at line 442 of file masks_gui.c.
References dt_gui_get_global(), dt_gui_get_ui(), dt_gui_main_window(), and IS_NULL_PTR.
Referenced by dt_masks_remove_or_delete().
| gboolean dt_masks_gui_confirm_permanent_delete | ( | const char * | form_name | ) |
Ask the user to confirm a permanent shape deletion, gated by the "ask_before_delete_mask_shape" pref. Shows a "Always ask" checkbox that writes back to the pref regardless of the response. Returns TRUE immediately without showing anything when the pref is off.
Definition at line 466 of file masks_gui.c.
References dt_conf_get_bool(), dt_conf_set_bool(), dt_gui_get_global(), dt_gui_get_ui(), dt_gui_main_window(), FALSE, IS_NULL_PTR, and TRUE.
Referenced by _blendop_masks_all_delete(), _blendop_masks_group_delete(), and dt_masks_delete_shape().
| void dt_masks_gui_populate_interaction_sliders | ( | GtkWidget * | menu, |
| dt_develop_t * | dev, | ||
| dt_masks_form_t * | form, | ||
| dt_masks_form_group_t * | op_form, | ||
| dt_masks_form_gui_t * | gui, | ||
| dt_iop_module_t * | module | ||
| ) |
Append the full set of shape-parameter sliders (size/fading/rotation or curvature/fade/rotation depending on shape type, plus opacity) for form/op_form to menu. op_form is the group-membership entry the sliders read/write (see dt_masks_form_group_t) and must already be a live, COW-safe pointer into the owning group's points list.
Definition at line 662 of file masks_gui.c.
References DT_MASKS_ELLIPSE, dt_masks_form_get_interaction_value(), DT_MASKS_GRADIENT, dt_masks_gui_add_interaction_slider(), DT_MASKS_INCREMENT_ABSOLUTE, DT_MASKS_INCREMENT_SCALE, DT_MASKS_INTERACTION_HARDNESS, DT_MASKS_INTERACTION_OPACITY, DT_MASKS_INTERACTION_ROTATION, DT_MASKS_INTERACTION_SIZE, IS_NULL_PTR, and dt_masks_form_t::type.
Referenced by _blendop_masks_group_ctx_menu(), _tree_context_menu(), and dt_masks_create_menu().
| GtkWidget * dt_masks_shape_buttons_create | ( | const dt_masks_shape_buttons_config_t * | config | ) |
Build a synchronized toolbar for creating masks shapes.
The buttons all use the same creation callback and listen to a process-wide deactivation signal. This keeps multiple mask toolbars, such as blending, retouch and the shape manager, from showing stale active buttons after another toolbar starts or exits a shape creation.
Definition at line 183 of file masks_gui.c.
References _masks_shape_button_defs, _masks_shape_button_pressed(), _masks_shape_buttons_deactivate_signal(), _masks_shape_buttons_destroy(), dt_masks_shape_buttons_config_t::action_section, dt_masks_shape_buttons_data_t::box, dt_masks_shape_buttons_config_t::buttons, dt_masks_shape_buttons_data_t::buttons, dt_masks_shape_buttons_data_t::config, dt_masks_shape_button_def_t::ctrl_label, dt_control_signal_get_global(), DT_DEBUG_CONTROL_SIGNAL_CONNECT, DT_GUI_BOX_SPACING, dt_iop_togglebutton_new(), dt_iop_togglebutton_new_no_register(), DT_SIGNAL_MASK_SHAPE_BUTTONS_DEACTIVATE, dtgtk_togglebutton_new(), FALSE, dt_masks_shape_button_def_t::flag, dt_masks_shape_buttons_config_t::flags, i, dt_masks_shape_button_def_t::index, IS_NULL_PTR, dt_masks_shape_button_def_t::label, dt_masks_shape_buttons_config_t::local, dt_masks_shape_buttons_config_t::owner_module, dt_masks_shape_button_def_t::paint, dt_masks_shape_buttons_config_t::register_flags, dt_masks_shape_button_def_t::type, dt_masks_shape_buttons_config_t::types, and dt_masks_shape_buttons_data_t::types.
Referenced by _blendop_masks_create_shape_buttons(), gui_init(), and gui_init().
Definition at line 86 of file masks_gui.c.
References dt_control_signal_get_global(), DT_DEBUG_CONTROL_SIGNAL_RAISE, and DT_SIGNAL_MASK_SHAPE_BUTTONS_DEACTIVATE.
Referenced by _blendop_masks_show_and_edit(), _lib_masks_recreate_list(), _masks_shape_button_pressed(), dt_iop_gui_blending_lose_focus(), dt_iop_gui_update_blending(), dt_masks_reset_form_gui(), dt_masks_reset_show_masks_icons(), gui_focus(), and rt_edit_masks_callback().
|
static |
Definition at line 54 of file masks_gui.c.
Referenced by dt_masks_shape_buttons_create().