![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
The interactive half of the masks subsystem: the editing state (dt_masks_form_gui_t), hit-testing, event dispatchers, drawing helpers, shape buttons, menus and dialogs. More...
Include dependency graph for masks_gui.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Data Structures | |
| struct | dt_masks_form_gui_points_t |
| struct | dt_masks_form_gui_t |
| struct | dt_masks_preview_buffers_t |
| struct | dt_masks_gui_center_point_t |
| struct | dt_masks_shape_buttons_config_t |
Macros | |
| #define | menu_item_set_fake_accel(menu_item, keyval, mods) |
Enumerations | |
| enum | dt_masks_shape_button_index_t { DT_MASKS_SHAPE_INDEX_GRADIENT = 0 , DT_MASKS_SHAPE_INDEX_POLYGON = 1 , DT_MASKS_SHAPE_INDEX_ELLIPSE = 2 , DT_MASKS_SHAPE_INDEX_CIRCLE = 3 , DT_MASKS_SHAPE_INDEX_BRUSH = 4 } |
| enum | dt_masks_shape_buttons_flags_t { DT_MASKS_SHAPE_BUTTONS_NONE = 0 , DT_MASKS_SHAPE_BUTTONS_CIRCLE = 1 << 0 , DT_MASKS_SHAPE_BUTTONS_ELLIPSE = 1 << 1 , DT_MASKS_SHAPE_BUTTONS_POLYGON = 1 << 2 , DT_MASKS_SHAPE_BUTTONS_BRUSH = 1 << 3 , DT_MASKS_SHAPE_BUTTONS_GRADIENT = 1 << 4 , DT_MASKS_SHAPE_BUTTONS_ALL } |
The interactive half of the masks subsystem: the editing state (dt_masks_form_gui_t), hit-testing, event dispatchers, drawing helpers, shape buttons, menus and dialogs.
Cut out of develop/masks.h so that the data model and the rasterisation API no longer feed widgets/draw.h (and GTK behind it) to every consumer that only wants get_mask() – which was every IOP that includes blend.h. This header is what the darkroom view, libs/masks.c, blend_gui.c and the shape editors include.
Definition in file masks_gui.h.
Contextual menu
Definition at line 785 of file masks_gui.h.
| typedef gboolean(* dt_masks_border_handle_fn) (const dt_masks_form_gui_points_t *gui_points, int node_count, int node_index, float *handle_x, float *handle_y, void *user_data) |
Shape-specific callback to fetch a node's border handle in GUI space.
Definition at line 730 of file masks_gui.h.
| typedef void(* dt_masks_curve_handle_fn) (const dt_masks_form_gui_points_t *gui_points, int node_index, float *handle_x, float *handle_y, void *user_data) |
Shape-specific callback to fetch a node's curve handle in GUI space.
The handle is only queried for non-cusp nodes; implementations may assume that.
Definition at line 737 of file masks_gui.h.
| typedef void(* dt_masks_distance_fn) (float pointer_x, float pointer_y, float cursor_radius, dt_masks_form_gui_t *mask_gui, int form_index, int node_count, int *inside, int *inside_border, int *near_handle, int *inside_source, float *dist, void *user_data) |
Shape-specific callback for inside/border/segment hit testing.
This mirrors the per-shape *_get_distance() APIs and returns the same outputs. The dist output is a squared distance in absolute output-image coordinates.
Definition at line 752 of file masks_gui.h.
structure used to define all the gui points to draw in viewport
structure used to display a form
| typedef void(* dt_masks_node_position_fn) (const dt_masks_form_gui_points_t *gui_points, int node_index, float *node_x, float *node_y, void *user_data) |
Shape-specific callback to fetch a node's position in GUI space.
When NULL, the common helper assumes Bezier-like layout at points[k*6+2].
Definition at line 744 of file masks_gui.h.
| typedef void(* dt_masks_post_select_fn) (dt_masks_form_gui_t *mask_gui, int inside, int inside_border, int inside_source, void *user_data) |
Optional hook to customize selection flags after inside/border/source resolution.
Definition at line 759 of file masks_gui.h.
| typedef void(* dt_masks_shape_buttons_notify_f) (GtkWidget *button, dt_iop_module_t *module, dt_masks_type_t type, gpointer user_data) |
Definition at line 454 of file masks_gui.h.
| typedef gboolean(* dt_masks_shape_buttons_start_f) (GtkWidget *button, dt_iop_module_t *module, dt_masks_type_t type, gpointer user_data) |
Definition at line 450 of file masks_gui.h.
| typedef dt_masks_type_t(* dt_masks_shape_buttons_type_f) (dt_iop_module_t *module, dt_masks_type_t type, gpointer user_data) |
Definition at line 452 of file masks_gui.h.
| Enumerator | |
|---|---|
| DT_MASKS_SHAPE_INDEX_GRADIENT | |
| DT_MASKS_SHAPE_INDEX_POLYGON | |
| DT_MASKS_SHAPE_INDEX_ELLIPSE | |
| DT_MASKS_SHAPE_INDEX_CIRCLE | |
| DT_MASKS_SHAPE_INDEX_BRUSH | |
Definition at line 421 of file masks_gui.h.
Definition at line 430 of file masks_gui.h.
Definition at line 560 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_gui_t::group_selected, IS_NULL_PTR, L, dt_masks_form_gui_t::node_dragging, dt_masks_form_gui_t::node_hovered, and TRUE.
Referenced by _polygon_populate_context_menu(), and dt_masks_create_menu().
| void apply_operation | ( | struct dt_masks_form_group_t * | group_entry, |
| const dt_masks_state_t | apply_state | ||
| ) |
Apply a mask state operation on a group entry.
Inverse toggles its flag, combine operations replace the combine bits.
Definition at line 4190 of file masks_gui.c.
References DT_MASKS_STATE_INVERSE, DT_MASKS_STATE_IS_COMBINE_OP, IS_NULL_PTR, and L.
Referenced by _blendop_masks_group_operation_callback(), _masks_operation_callback(), _tree_difference(), _tree_exclusion(), _tree_intersection(), _tree_inverse(), and _tree_union().
| void dt_group_events_post_expose | ( | cairo_t * | cr, |
| float | zoom_scale, | ||
| dt_masks_form_t * | form, | ||
| dt_masks_form_gui_t * | gui | ||
| ) |
Definition at line 141 of file group.c.
References _group_events_post_expose_draw(), dt_masks_form_gui_t::group_selected, and L.
Referenced by dt_masks_events_post_expose().
| void dt_masks_append_form | ( | dt_develop_t * | dev, |
| dt_masks_form_t * | form | ||
| ) |
Definition at line 2333 of file masks_gui.c.
References dt_masks_form_ref(), dt_pthread_rwlock_unlock(), dt_pthread_rwlock_wrlock(), dt_develop_t::forms, L, and dt_develop_t::masks_mutex.
Referenced by _blendop_masks_group_create(), _group_create(), dt_masks_form_duplicate(), and dt_masks_gui_form_save_creation().
| float dt_masks_apply_increment | ( | float | current, |
| float | amount, | ||
| dt_masks_increment_t | increment, | ||
| int | flow | ||
| ) |
Apply a scroll increment to a scalar value.
Definition at line 3731 of file masks_gui.c.
References DT_MASKS_INCREMENT_ABSOLUTE, DT_MASKS_INCREMENT_OFFSET, DT_MASKS_INCREMENT_SCALE, and L.
Referenced by _change_curvature(), _change_extent(), _change_hardness(), _change_hardness(), _change_opacity(), _change_rotation(), _change_rotation(), _change_size(), _change_size(), and dt_masks_get_set_conf_value().
| float dt_masks_apply_increment_precomputed | ( | float | current, |
| float | amount, | ||
| float | scale_amount, | ||
| float | offset_amount, | ||
| dt_masks_increment_t | increment | ||
| ) |
Apply a scroll increment using precomputed scale/offset factors.
Definition at line 3745 of file masks_gui.c.
References DT_MASKS_INCREMENT_ABSOLUTE, DT_MASKS_INCREMENT_OFFSET, DT_MASKS_INCREMENT_SCALE, and L.
Referenced by _change_hardness(), _change_hardness(), and _change_size().
|
inlinestatic |
Definition at line 342 of file masks_gui.h.
References dt_dev_coordinates_image_abs_to_raw_abs(), dt_dev_coordinates_raw_norm_to_raw_abs(), and L.
Referenced by _brush_events_mouse_moved(), and _polygon_events_mouse_moved().
| void dt_masks_calculate_source_pos_origin | ( | dt_masks_form_gui_t * | mask_gui, |
| const float | initial_xpos, | ||
| const float | initial_ypos, | ||
| const float | xpos, | ||
| const float | ypos, | ||
| float * | pos_x, | ||
| float * | pos_y, | ||
| const int | adding | ||
| ) |
Compute preview-space source position for drawing the clone indicator.
This uses the stored source positioning mode and can follow the cursor while adding.
Definition at line 4043 of file masks_gui.c.
References dt_dev_geometry_snapshot(), dt_masks_get_visible_form(), DT_MASKS_SOURCE_POS_ABSOLUTE, DT_MASKS_SOURCE_POS_RELATIVE, DT_MASKS_SOURCE_POS_RELATIVE_TEMP, IS_NULL_PTR, L, dt_dev_image_geometry_t::raw_height, and dt_dev_image_geometry_t::raw_width.
Referenced by _circle_get_creation_preview(), _ellipse_get_creation_preview(), and dt_masks_draw_source_preview().
| int dt_masks_center_view_on_form | ( | struct dt_develop_t * | dev, |
| const struct dt_masks_form_t * | form | ||
| ) |
| void dt_masks_change_form_gui | ( | dt_develop_t * | dev, |
| dt_masks_form_t * | newform | ||
| ) |
function used to manipulate forms for masks
Definition at line 3337 of file masks_gui.c.
References dt_develop_t::allforms, dt_masks_clear_form_gui(), dt_masks_free_form(), dt_masks_get_visible_form(), dt_masks_set_visible_form(), dt_pthread_rwlock_rdlock(), dt_pthread_rwlock_unlock(), FALSE, dt_develop_t::forms, IS_NULL_PTR, L, dt_develop_t::masks_mutex, and TRUE.
Referenced by _blendop_masks_all_delete(), _blendop_masks_all_selection_changed(), _blendop_masks_group_delete(), _blendop_masks_group_move_callback(), _blendop_masks_group_unlink(), _brush_events_button_released(), _edit_masks(), _masks_remove_or_delete_finish(), _masks_remove_shape(), _reset_form_creation(), _tree_delete_shape(), _tree_movedown(), _tree_moveup(), _tree_selection_change(), dt_masks_cleanup_unused(), dt_masks_creation_mode_enter(), dt_masks_form_exit_creation(), dt_masks_reset_form_gui(), dt_masks_set_edit_mode(), gui_focus(), rt_edit_masks_callback(), and rt_show_forms_for_current_scale().
| void dt_masks_clear_form_gui | ( | dt_develop_t * | dev | ) |
Definition at line 3287 of file masks_gui.c.
References dt_masks_form_gui_t::border_selected, dt_masks_form_gui_t::border_toggling, dt_masks_form_gui_t::creation_closing_form, dt_masks_form_gui_t::creation_formids, dt_masks_form_gui_t::creation_last_formid, dt_masks_form_gui_t::creation_module, dt_masks_form_gui_t::creation_type, dt_masks_form_gui_t::delta, dt_masks_creation_mode_quit(), dt_masks_dynbuf_free(), DT_MASKS_EDIT_OFF, dt_masks_form_gui_points_free(), DT_MASKS_NONE, DT_MASKS_PRESSURE_OFF, dt_masks_select_form(), DT_PIXELPIPE_CACHE_HASH_INVALID, dt_masks_form_gui_t::edit_mode, FALSE, dt_masks_form_gui_t::form_dragging, dt_develop_t::form_gui, dt_masks_form_gui_t::form_rotating, dt_masks_form_gui_t::form_selected, dt_masks_form_gui_t::formid, dt_masks_form_gui_t::gradient_toggling, dt_masks_form_gui_t::group_selected, dt_masks_form_gui_t::guipoints, dt_masks_form_gui_t::guipoints_count, dt_masks_form_gui_t::guipoints_payload, dt_masks_form_gui_t::handle_border_dragging, dt_masks_form_gui_t::handle_border_hovered, dt_masks_form_gui_t::handle_border_selected, dt_masks_form_gui_t::handle_dragging, dt_masks_form_gui_t::handle_hovered, dt_masks_form_gui_t::handle_selected, IS_NULL_PTR, L, dt_masks_form_gui_t::last_hit_test_pos, dt_masks_form_gui_t::last_rebuild_pos, dt_masks_form_gui_t::last_rebuild_ts, dt_masks_form_gui_t::node_dragging, dt_masks_form_gui_t::node_hovered, dt_masks_form_gui_t::node_selected, dt_masks_form_gui_t::node_selected_idx, dt_masks_form_gui_t::pipe_hash, dt_masks_form_gui_t::pivot_selected, dt_masks_form_gui_t::points, dt_masks_form_gui_t::pressure_sensitivity, dt_masks_form_gui_t::rebuild_pending, dt_masks_form_gui_t::scrollx, dt_masks_form_gui_t::scrolly, dt_masks_form_gui_t::seg_dragging, dt_masks_form_gui_t::seg_hovered, dt_masks_form_gui_t::seg_selected, dt_masks_form_gui_t::source_dragging, and dt_masks_form_gui_t::source_selected.
Referenced by _masks_remove_or_delete_finish(), _masks_remove_shape(), dt_masks_change_form_gui(), dt_masks_gui_cleanup(), and dt_masks_gui_init().
| GtkWidget * dt_masks_create_menu | ( | dt_masks_form_gui_t * | gui, |
| dt_masks_form_t * | form, | ||
| const dt_masks_form_group_t * | fpt, | ||
| const float | pzx, | ||
| const float | pzy | ||
| ) |
Definition at line 741 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_develop_t::gui_module, IS_NULL_PTR, k, L, masks_gtk_menu_item_new_bold, MAX, menu_item_set_fake_accel, dt_masks_form_gui_t::node_hovered, dt_masks_form_gui_t::node_selected, dt_masks_form_gui_t::seg_hovered, state, TRUE, and width.
Referenced by dt_masks_events_button_pressed().
| gboolean dt_masks_creation_mode_enter | ( | dt_develop_t * | dev, |
| dt_iop_module_t * | module, | ||
| const dt_masks_type_t | type | ||
| ) |
Enter mask creation mode for a given shape type.
NOTE: this does quite the same as _menu_add_shape.
Definition at line 4163 of file masks_gui.c.
References dt_masks_form_gui_t::creation, dt_masks_form_gui_t::creation_formids, dt_masks_form_gui_t::creation_last_formid, dt_masks_form_gui_t::creation_module, dt_masks_form_gui_t::creation_type, dt_gui_center_widget(), dt_iop_request_focus(), DT_MASKS_ALL, dt_masks_change_form_gui(), dt_masks_create(), FALSE, dt_develop_t::form_gui, IS_NULL_PTR, L, TRUE, and type.
Referenced by _add_shape(), _masks_shape_button_pressed(), _menu_add_shape(), _tree_add_brush(), _tree_add_circle(), _tree_add_ellipse(), _tree_add_gradient(), _tree_add_polygon(), and rt_select_algorithm_callback().
| void dt_masks_creation_mode_quit | ( | dt_masks_form_gui_t * | mask_gui | ) |
Exit mask creation mode, restoring cursor visibility and resetting GUI state.
| mask_gui | The GUI state of the mask form |
Definition at line 4151 of file masks_gui.c.
References FALSE, IS_NULL_PTR, and L.
Referenced by dt_masks_clear_form_gui(), and dt_masks_form_exit_creation().
| gboolean dt_masks_delete_shape | ( | struct dt_iop_module_t * | module, |
| dt_masks_form_t * | sel, | ||
| int | parent_id, | ||
| dt_masks_form_gui_t * | mask_gui, | ||
| int | form_id | ||
| ) |
Permanently delete the form from every group and from dev->forms. Gated by dt_masks_gui_confirm_permanent_delete() (itself gated by the "ask_before_delete_mask_shape" pref).
Definition at line 2131 of file masks_gui.c.
References _masks_remove_or_delete_finish(), dt_masks_gui_confirm_permanent_delete(), FALSE, IS_NULL_PTR, and L.
Referenced by _masks_gui_full_delete_callback().
| void dt_masks_draw_path_seg_by_seg | ( | cairo_t * | cr, |
| dt_masks_form_gui_t * | gui, | ||
| const int | index, | ||
| const float * | points, | ||
| const int | points_count, | ||
| const int | node_count, | ||
| const float | zoom_scale | ||
| ) |
Definition at line 3114 of file masks_gui.c.
References dt_draw_stroke_line(), DT_MASKS_DASH_ROUND, dt_masks_gui_selected_segment_index(), dt_masks_is_anything_selected(), DT_MASKS_NO_DASH, FALSE, IS_NULL_PTR, and L.
Referenced by _brush_events_post_expose(), and _polygon_events_post_expose().
|
inlinestatic |
Definition at line 358 of file masks_gui.h.
References dt_develop_t::border, dt_draw_shape_lines(), DT_MASKS_DASH_STICK, DT_MASKS_NO_DASH, FALSE, and L.
Referenced by _circle_events_post_expose(), _ellipse_events_post_expose(), and _gradient_events_post_expose().
| void dt_masks_draw_source | ( | cairo_t * | cr, |
| dt_masks_form_gui_t * | gui, | ||
| const int | index, | ||
| const int | nb, | ||
| const float | zoom_scale, | ||
| struct dt_masks_gui_center_point_t * | center_point, | ||
| const shape_draw_function_t * | draw_shape_func | ||
| ) |
Draw the source for a correction mask.
| cr | the cairo context to draw into |
| gui | the GUI state of the mask form |
| index | the index of the mask form |
| nb | the number of coord for that shape |
| zoom_scale | the current zoom scale of the image |
| shape_function | the function to draw the shape |
Definition at line 2999 of file masks_gui.c.
References _dt_masks_find_best_attachment_point(), DT_DEBUG_MASKS, dt_draw_arrow(), dt_draw_source_shape(), dt_get_debug_flags(), DT_MASKS_BRUSH, DT_MASKS_DASH_ROUND, DT_MASKS_ELLIPSE, DT_MASKS_IS_CLOSED_SHAPE, DT_MASKS_IS_OPEN_SHAPE, DT_MASKS_IS_PATH_SHAPE, dt_masks_point_in_form_exact(), DT_PIXEL_APPLY_DPI, IS_NULL_PTR, L, M_PI, main(), dt_masks_form_gui_points_t::source, and TRUE.
Referenced by _brush_events_post_expose(), _circle_events_post_expose(), _ellipse_events_post_expose(), and _polygon_events_post_expose().
|
inlinestatic |
Definition at line 601 of file masks_gui.h.
References dt_draw_cross(), dt_masks_calculate_source_pos_origin(), and L.
Referenced by _brush_events_post_expose(), _circle_events_post_expose(), _ellipse_events_post_expose(), and _polygon_events_post_expose().
| int dt_masks_events_button_pressed | ( | dt_develop_t * | dev, |
| struct dt_iop_module_t * | module, | ||
| double | x, | ||
| double | y, | ||
| double | pressure, | ||
| int | which, | ||
| int | type, | ||
| uint32_t | state | ||
| ) |
Definition at line 2727 of file masks_gui.c.
References _apply_gui_button_pressed_state(), _dt_masks_events_get_dispatch_form(), _dt_masks_events_group_update_selection(), _dt_masks_events_set_current_pos(), _dt_masks_events_update_hover(), _set_cursor_shape(), _set_hinter_message(), dt_develop_t::darkroom_skip_mouse_events, dt_masks_cow_touch(), dt_masks_create_menu(), dt_masks_get_visible_form(), DT_MASKS_GROUP, dt_masks_is_anything_hovered(), dt_masks_is_anything_selected(), dt_masks_select_form(), FALSE, dt_develop_t::form_gui, IS_NULL_PTR, L, state, TRUE, and x.
Referenced by button_pressed().
| int dt_masks_events_button_released | ( | dt_develop_t * | dev, |
| struct dt_iop_module_t * | module, | ||
| double | x, | ||
| double | y, | ||
| int | which, | ||
| uint32_t | state | ||
| ) |
Definition at line 2679 of file masks_gui.c.
References _dt_masks_events_flush_rebuild_if_needed(), _dt_masks_events_get_dispatch_form(), _dt_masks_events_set_current_pos(), _set_cursor_shape(), _set_hinter_message(), dt_develop_t::darkroom_skip_mouse_events, dt_dev_masks_selection_change(), dt_masks_cow_touch(), dt_masks_form_get_selected_group_live(), dt_masks_get_visible_form(), DT_MASKS_GROUP, dt_masks_gui_reset_dragging(), FALSE, dt_develop_t::form_gui, IS_NULL_PTR, L, state, and x.
Referenced by button_released().
| int dt_masks_events_key_pressed | ( | dt_develop_t * | dev, |
| struct dt_iop_module_t * | module, | ||
| GdkEventKey * | event | ||
| ) |
Definition at line 2799 of file masks_gui.c.
References _dt_masks_events_get_dispatch_form(), dt_keys_mainpad_alternatives(), dt_masks_cow_touch(), dt_masks_form_exit_creation(), dt_masks_form_get_selected_group(), dt_masks_get_from_id(), dt_masks_get_visible_form(), DT_MASKS_GROUP, dt_masks_gui_remove(), FALSE, dt_develop_t::form_gui, IS_NULL_PTR, key, and L.
Referenced by key_pressed().
| int dt_masks_events_mouse_enter | ( | struct dt_iop_module_t * | module | ) |
Definition at line 2481 of file masks_gui.c.
Referenced by mouse_enter().
| int dt_masks_events_mouse_leave | ( | struct dt_iop_module_t * | module | ) |
Definition at line 2476 of file masks_gui.c.
Referenced by mouse_leave().
| int dt_masks_events_mouse_moved | ( | dt_develop_t * | dev, |
| struct dt_iop_module_t * | module, | ||
| double | x, | ||
| double | y, | ||
| double | pressure, | ||
| int | which | ||
| ) |
Definition at line 2634 of file masks_gui.c.
References _dt_masks_events_get_dispatch_form(), _dt_masks_events_group_blocks_motion(), _dt_masks_events_set_current_pos(), _dt_masks_events_should_update_hover_on_move(), _dt_masks_events_update_hover(), _set_cursor_shape(), _set_hinter_message(), dt_develop_t::darkroom_skip_mouse_events, dt_masks_cow_touch(), dt_masks_get_visible_form(), DT_MASKS_GROUP, dt_develop_t::form_gui, IS_NULL_PTR, L, and x.
Referenced by mouse_moved().
| int dt_masks_events_mouse_scrolled | ( | dt_develop_t * | dev, |
| struct dt_iop_module_t * | module, | ||
| double | x, | ||
| double | y, | ||
| int | up, | ||
| uint32_t | state, | ||
| int | delta_y | ||
| ) |
Definition at line 2860 of file masks_gui.c.
References _dt_masks_events_cursor_over_form(), _dt_masks_events_get_dispatch_form(), _dt_masks_events_set_current_pos(), _dt_masks_events_update_hover(), _set_hinter_message(), dt_develop_t::darkroom_skip_mouse_events, DT_DEBUG_INPUT, dt_mask_scroll_increases(), dt_masks_cow_touch(), dt_masks_get_visible_form(), DT_MASKS_INTERACTION_UNDEF, dt_masks_is_anything_selected(), dt_print(), dt_develop_t::form_gui, IS_NULL_PTR, L, and x.
Referenced by scrolled().
| void dt_masks_events_post_expose | ( | dt_develop_t * | dev, |
| struct dt_iop_module_t * | module, | ||
| cairo_t * | cr, | ||
| int32_t | width, | ||
| int32_t | height, | ||
| int32_t | pointerx, | ||
| int32_t | pointery | ||
| ) |
Definition at line 3213 of file masks_gui.c.
References _masks_draw_creation_session_forms(), dt_dev_get_processed_size(), dt_dev_get_zoom_level(), dt_dev_rescale_roi_to_input(), dt_group_events_post_expose(), dt_masks_get_visible_form(), DT_MASKS_GROUP, dt_masks_gui_form_test_create(), DT_MASKS_IS_PRIMITIVE_SHAPE, dt_develop_t::form_gui, height, IS_NULL_PTR, L, and width.
Referenced by expose().
| int dt_masks_find_closest_handle_common | ( | dt_masks_form_t * | mask_form, |
| dt_masks_form_gui_t * | mask_gui, | ||
| int | form_index, | ||
| int | node_count_override, | ||
| dt_masks_border_handle_fn | border_handle_cb, | ||
| dt_masks_curve_handle_fn | curve_handle_cb, | ||
| dt_masks_node_position_fn | node_position_cb, | ||
| dt_masks_distance_fn | distance_cb, | ||
| dt_masks_post_select_fn | post_select_cb, | ||
| void * | user_data | ||
| ) |
Shared selection logic for node/handle/segment hit testing.
The shape-specific callbacks supply handles and distance tests while this function performs common selection bookkeeping on dt_masks_form_gui_t.
The cached cursor in mask_gui->pos is authoritative for hit testing.
Shared selection logic for node/handle/segment hit testing.
This function:
node_count_override can be used for shapes that don't expose nodes via GList (e.g. gradient/ellipse control points). Pass -1 to use g_list_length().
Callers provide shape-specific callbacks for handles and distance tests.
The cached cursor in mask_gui->pos is authoritative for hit testing.
Definition at line 1059 of file masks_gui.c.
References DT_GUI_MOUSE_EFFECT_RADIUS, dt_masks_gui_selected_node_index(), dt_masks_gui_was_anything_selected(), dt_masks_node_is_cusp(), dt_masks_point_is_within_radius(), FALSE, IS_NULL_PTR, L, and TRUE.
Referenced by _find_closest_handle(), _find_closest_handle(), _find_closest_handle(), _find_closest_handle(), and _find_closest_handle().
| gboolean dt_masks_form_exit_creation | ( | dt_iop_module_t * | module, |
| dt_masks_form_gui_t * | gui | ||
| ) |
Definition at line 2139 of file masks_gui.c.
References dt_iop_module_gui_t::blend_data, dt_dev_masks_selection_change(), dt_masks_change_form_gui(), dt_masks_creation_mode_quit(), dt_masks_dynbuf_free(), DT_MASKS_EDIT_FULL, dt_masks_free_form(), dt_masks_get_from_id(), dt_masks_get_visible_form(), dt_masks_group_index_from_formid(), dt_masks_iop_update(), DT_MASKS_NONE, dt_masks_set_edit_mode(), dt_masks_set_visible_form(), dt_masks_form_gui_t::edit_mode, FALSE, dt_develop_t::form_gui, dt_masks_form_gui_t::form_selected, dt_masks_form_gui_t::group_selected, dt_iop_module_t::gui, IS_NULL_PTR, L, dt_iop_gui_blend_data_t::masks_edit, dt_iop_gui_blend_data_t::masks_shown, and TRUE.
Referenced by _group_events_key_pressed(), _masks_gui_delete_node_callback(), _masks_gui_exit_creation_callback(), _masks_shape_button_pressed(), _polygon_events_key_pressed(), dt_masks_events_key_pressed(), dt_masks_gui_cleanup(), dt_masks_gui_form_save_creation(), and dt_masks_gui_remove().
| gboolean dt_masks_form_get_gravity_center | ( | dt_develop_t * | dev, |
| const struct dt_masks_form_t * | form, | ||
| float | center[2], | ||
| float * | area | ||
| ) |
| float dt_masks_form_get_interaction_value | ( | dt_develop_t * | dev, |
| dt_masks_form_group_t * | form_group, | ||
| dt_masks_interaction_t | interaction | ||
| ) |
Definition at line 3613 of file masks_gui.c.
References dt_masks_get_from_id(), DT_MASKS_INTERACTION_OPACITY, dt_masks_form_group_t::formid, IS_NULL_PTR, L, and dt_masks_form_group_t::opacity.
Referenced by _set_hinter_message(), and dt_masks_gui_populate_interaction_sliders().
| dt_masks_form_group_t * dt_masks_form_get_selected_group | ( | const struct dt_masks_form_t * | form, |
| const struct dt_masks_form_gui_t * | gui | ||
| ) |
| dt_masks_form_group_t * dt_masks_form_get_selected_group_live | ( | const struct dt_masks_form_t * | form, |
| const struct dt_masks_form_gui_t * | gui | ||
| ) |
Return the currently selected group entry, resolving to the live form group when the GUI is operating on a temporary copy (for example the visible group created for editing).
The selection is taken from gui->group_selected. If the selected entry belongs to a temporary group (non-zero parentid), the function resolves and returns the corresponding entry from the real group in dev->forms.
| dt_masks_form_group_t * dt_masks_form_group_find_any | ( | dt_develop_t * | dev, |
| int | form_id, | ||
| int * | out_parentid | ||
| ) |
Find any group that currently references formid, searching every top-level group in dev->forms and their nested subgroups (first match wins – a shape used by more than one module has no single "correct" answer). Meant for UI listings that show a shape without already knowing which group (if any) it belongs to, e.g. a flat "all shapes" row.
| out_parentid | if non-NULL, receives the owning group's formid (0 if none found). |
Find any group that currently references formid, searching every top-level group in dev->forms and their nested subgroups (first match wins – a shape used by more than one module has no single "correct" answer). Meant for UI listings that show a shape without already knowing which group (if any) it belongs to, e.g. a flat "all shapes" row.
| out_parentid | if non-NULL, receives the owning group's formid (0 if none found). |
Definition at line 1419 of file masks_gui.c.
References _masks_find_any_parent_group(), dt_masks_cow_touch(), dt_masks_form_group_find_entry(), IS_NULL_PTR, and L.
Referenced by _tree_context_menu().
| dt_masks_form_group_t * dt_masks_form_group_find_entry | ( | dt_masks_form_t * | group_form, |
| const int | form_id, | ||
| int * | out_index | ||
| ) |
Find the group-membership entry for formid inside group_form's own points list (not recursive into subgroups) – the shared primitive behind every "find this shape's row
within its parent group" call site.
| out_index | if non-NULL, receives the entry's position in the list (-1 if not found). |
Find the group-membership entry for formid inside group_form's own points list (not recursive into subgroups) – the shared primitive behind every "find this shape's row
within its parent group" call site.
Assumption: only valid for DT_MASKS_GROUP forms.
| out_index | if non-NULL, receives the entry's position in the list (-1 if not found). |
Definition at line 1244 of file masks_gui.c.
References DT_MASKS_GROUP, IS_NULL_PTR, and L.
Referenced by _blendop_masks_all_toggled(), _blendop_masks_group_ctx_menu(), _blendop_masks_group_update_row(), _blendop_masks_refresh_lists(), _tree_context_menu(), dt_masks_form_change_opacity(), dt_masks_form_group_find_any(), and dt_masks_form_group_from_parentid().
| dt_masks_form_group_t * dt_masks_form_group_from_parentid | ( | dt_develop_t * | dev, |
| int | parent_id, | ||
| int | form_id | ||
| ) |
Return the group entry for a (parent, form) pair.
Getters and setters for direct GUI interaction
Caveat: returns NULL if parent isn't a group or the entry is missing.
Definition at line 1365 of file masks_gui.c.
References dt_masks_form_group_find_entry(), dt_masks_get_from_id(), DT_MASKS_GROUP, IS_NULL_PTR, and L.
Referenced by dt_masks_create_menu(), and dt_masks_form_get_selected_group_live().
| void dt_masks_form_invalidate_gravity_center | ( | struct dt_masks_form_t * | form | ) |
Marks gravity_center/area stale instead of recomputing them right away. Use for bulk paths (loading history, undo/redo) that swap in many forms at once; the one GUI hit-testing read site recomputes lazily on first actual use.
Definition at line 1087 of file develop/masks/masks.c.
References FALSE, IS_NULL_PTR, and L.
Referenced by dt_masks_replace_current_forms().
| float dt_masks_form_set_interaction_value | ( | dt_masks_form_group_t * | form_group, |
| dt_masks_interaction_t | interaction, | ||
| float | value, | ||
| dt_masks_increment_t | increment, | ||
| int | flow, | ||
| struct dt_masks_form_gui_t * | gui, | ||
| struct dt_iop_module_t * | module | ||
| ) |
Definition at line 3669 of file masks_gui.c.
References _change_opacity(), dt_masks_cow_touch(), dt_masks_form_update_gravity_center(), dt_masks_get_from_id(), DT_MASKS_INTERACTION_OPACITY, dt_masks_form_group_t::formid, IS_NULL_PTR, L, and value.
Referenced by _masks_gui_interaction_apply_value(), and dt_masks_form_change_opacity().
| void dt_masks_form_update_gravity_center | ( | dt_develop_t * | dev, |
| struct dt_masks_form_t * | form | ||
| ) |
Definition at line 1069 of file develop/masks/masks.c.
References DT_DEBUG_MASKS, dt_masks_form_get_gravity_center(), dt_print(), IS_NULL_PTR, L, and TRUE.
Referenced by _dt_masks_events_group_update_selection(), dt_masks_form_delete(), dt_masks_form_set_interaction_value(), dt_masks_group_add_form(), dt_masks_group_ungroup(), dt_masks_gui_form_create(), and dt_masks_gui_form_save_creation().
| GdkModifierType dt_masks_get_accel_mods | ( | dt_masks_interaction_t | interaction | ) |
Definition at line 220 of file masks_gui.h.
References IS_NULL_PTR, and L.
Referenced by _brush_get_interaction_value(), and _polygon_get_interaction_value().
| float dt_masks_get_set_conf_value | ( | dt_masks_form_t * | form, |
| char * | feature, | ||
| float | new_value, | ||
| float | v_min, | ||
| float | v_max, | ||
| dt_masks_increment_t | increment, | ||
| const int | flow | ||
| ) |
Change a numerical property of a mask shape, either by in/de-crementing the current value or setting it in an absolute fashion, then save it to configuration.
| form | the shape to change. We will read its type internally |
| feature | the propertie to change:Â hardness, size, curvature (for gradients) |
| new_value | if increment is set to absolute, this is directly the updated value. if increment is offset, the updated value is old_value + new_value. if increment is scale, the updated value is old value * new_value. |
| v_min | minimum acceptable value of the property for sanitization |
| v_max | maximum acceptable value of the property for sanitization |
| increment | the increment type: absolute, offset or scale. |
| flow | the value of the scroll distance that can be postive or negative. |
Definition at line 3760 of file masks_gui.c.
References _get_mask_plugin(), _get_mask_type(), dt_conf_get_float(), dt_conf_set_float(), dt_free, dt_masks_apply_increment(), L, MAX, and MIN.
Referenced by _brush_events_button_pressed(), _brush_events_button_released(), _brush_events_post_expose(), _change_hardness(), _change_size(), _init_hardness(), _init_size(), and dt_masks_get_set_conf_value_with_toast().
| float dt_masks_get_set_conf_value_with_toast | ( | dt_masks_form_t * | form, |
| const char * | feature, | ||
| float | amount, | ||
| float | v_min, | ||
| float | v_max, | ||
| dt_masks_increment_t | increment, | ||
| int | flow, | ||
| const char * | toast_fmt, | ||
| float | toast_scale | ||
| ) |
Update a mask configuration value and emit a toast message.
This is a convenience wrapper around dt_masks_get_set_conf_value() that keeps UI feedback consistent across mask types.
Definition at line 3790 of file masks_gui.c.
References dt_masks_get_set_conf_value(), dt_toast_log(), IS_NULL_PTR, L, and value.
Referenced by _init_curvature(), _init_extent(), _init_hardness(), _init_hardness(), _init_hardness(), _init_opacity(), _init_opacity(), _init_opacity(), _init_opacity(), _init_rotation(), _init_rotation(), _init_size(), and _init_size().
| dt_masks_form_t * dt_masks_get_visible_form | ( | const struct dt_develop_t * | dev | ) |
| dt_masks_form_group_t * dt_masks_group_add_form | ( | dt_develop_t * | dev, |
| dt_masks_form_t * | grp, | ||
| dt_masks_form_t * | form | ||
| ) |
Definition at line 3802 of file masks_gui.c.
References _find_in_group(), dt_conf_get_float(), dt_control_log(), dt_masks_form_update_gravity_center(), DT_MASKS_GROUP, DT_MASKS_STATE_SHOW, DT_MASKS_STATE_UNION, DT_MASKS_STATE_USE, and L.
Referenced by _blendop_masks_all_toggled(), _menu_add_exist(), _tree_add_exist(), dt_masks_form_duplicate_in_group(), and dt_masks_iop_use_same_as().
| int dt_masks_group_index_from_formid | ( | const dt_masks_form_t * | group_form, |
| int | formid | ||
| ) |
Definition at line 1264 of file masks_gui.c.
References DT_MASKS_GROUP, IS_NULL_PTR, and L.
Referenced by _blendop_masks_group_selection_changed(), and dt_masks_form_exit_creation().
| void dt_masks_group_ungroup | ( | dt_develop_t * | dev, |
| dt_masks_form_t * | dest_grp, | ||
| dt_masks_form_t * | grp | ||
| ) |
Definition at line 3825 of file masks_gui.c.
References dt_masks_cow_touch(), dt_masks_form_update_gravity_center(), dt_masks_get_from_id(), DT_MASKS_GROUP, dt_masks_group_ungroup(), dt_masks_form_group_t::formid, IS_NULL_PTR, and L.
Referenced by _tree_selection_change(), dt_masks_group_ungroup(), dt_masks_set_edit_mode(), and rt_show_forms_for_current_scale().
| void dt_masks_group_update_name | ( | dt_iop_module_t * | module | ) |
Definition at line 3447 of file masks_gui.c.
References _group_from_module(), _set_group_name_from_module(), dt_masks_iop_update(), IS_NULL_PTR, and L.
Referenced by _rename_module_key_press().
| 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, | ||
| struct 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 403 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, L, 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().
|
inlinestatic |
Definition at line 211 of file masks_gui.h.
References dt_masks_gui_selected_node_index(), IS_NULL_PTR, L, and TRUE.
Referenced by _change_hardness(), _change_hardness(), _change_size(), and _change_size().
| void dt_masks_gui_cleanup | ( | struct dt_develop_t * | dev | ) |
Definition at line 1312 of file masks_gui.c.
References dt_free, dt_masks_clear_form_gui(), dt_masks_form_exit_creation(), dt_masks_set_visible_form(), dt_develop_t::form_gui, IS_NULL_PTR, and L.
Referenced by _studio_dev_teardown(), and leave().
| int dt_masks_gui_confirm_delete_form_dialog | ( | const char * | form_name | ) |
Definition at line 459 of file masks_gui.c.
References dt_gui_get_global(), dt_gui_get_ui(), dt_gui_main_window(), IS_NULL_PTR, and L.
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 483 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, L, and TRUE.
Referenced by _blendop_masks_all_delete(), _blendop_masks_group_delete(), and dt_masks_delete_shape().
|
inlinestatic |
Definition at line 260 of file masks_gui.h.
References dt_dev_coordinates_raw_abs_to_raw_norm(), and dt_masks_form_gui_t::raw_pos.
Referenced by _add_node_to_segment(), _add_node_to_segment(), _circle_get_creation_preview(), _circle_init_new(), _ellipse_get_creation_preview(), _ellipse_init_new(), _gradient_get_creation_preview(), _gradient_init_new(), and _polygon_events_button_pressed().
|
inlinestatic |
Definition at line 283 of file masks_gui.h.
References dt_masks_gui_delta_to_raw_norm(), and L.
Referenced by _brush_events_mouse_moved(), and _polygon_events_mouse_moved().
|
inlinestatic |
Definition at line 275 of file masks_gui.h.
References dt_masks_form_gui_t::delta, and dt_masks_form_gui_t::pos.
Referenced by _brush_events_mouse_moved(), and _polygon_events_mouse_moved().
|
inlinestatic |
Definition at line 268 of file masks_gui.h.
References dt_masks_form_gui_t::delta, dt_dev_coordinates_image_abs_to_raw_norm(), and dt_masks_form_gui_t::pos.
Referenced by _brush_events_mouse_moved(), _circle_events_mouse_moved(), _ellipse_events_mouse_moved(), _gradient_events_mouse_moved(), _polygon_events_mouse_moved(), and dt_masks_gui_delta_from_raw_anchor().
| void dt_masks_gui_form_create | ( | dt_masks_form_t * | form, |
| dt_masks_form_gui_t * | gui, | ||
| int | index, | ||
| struct dt_iop_module_t * | module | ||
| ) |
functions used to manipulate gui data
Definition at line 1829 of file masks_gui.c.
References dt_dev_backbuf_get_hash(), DT_MASKS_CLONE, dt_masks_form_update_gravity_center(), dt_masks_get_points_border(), dt_masks_gui_form_remove(), IS_NULL_PTR, L, dt_masks_form_gui_points_t::points, and TRUE.
Referenced by _add_node_to_segment(), _add_node_to_segment(), _brush_events_mouse_moved(), _change_curvature(), _change_extent(), _change_hardness(), _change_hardness(), _change_hardness(), _change_hardness(), _change_rotation(), _change_rotation(), _change_size(), _change_size(), _change_size(), _change_size(), _circle_events_mouse_moved(), _dt_masks_events_flush_rebuild_if_needed(), _ellipse_events_button_released(), _ellipse_events_mouse_moved(), _gradient_events_button_pressed(), _gradient_events_button_released(), _gradient_events_mouse_moved(), _polygon_events_button_pressed(), _polygon_events_mouse_moved(), dt_masks_gui_form_create_throttled(), dt_masks_gui_form_test_create(), dt_masks_remove_node(), dt_masks_reset_bezier_ctrl_points(), and dt_masks_toggle_bezier_node_type().
| gboolean dt_masks_gui_form_create_throttled | ( | dt_masks_form_t * | form, |
| dt_masks_form_gui_t * | gui, | ||
| int | index, | ||
| struct dt_iop_module_t * | module, | ||
| float | posx, | ||
| float | posy | ||
| ) |
Definition at line 1869 of file masks_gui.c.
References dt_dev_pixelpipe_t::backbuf, dt_dev_backbuf_get_hash(), dt_get_wtime(), dt_masks_gui_form_create(), FALSE, IS_NULL_PTR, L, dt_develop_t::preview_pipe, and TRUE.
Referenced by _brush_events_mouse_moved(), and _polygon_events_mouse_moved().
| void dt_masks_gui_form_remove | ( | dt_masks_form_t * | form, |
| dt_masks_form_gui_t * | gui, | ||
| int | index | ||
| ) |
Definition at line 2277 of file masks_gui.c.
References dt_pixelpipe_cache_free_align, DT_PIXELPIPE_CACHE_HASH_INVALID, IS_NULL_PTR, L, and dt_masks_form_gui_points_t::points_count.
Referenced by dt_masks_gui_form_create().
| void dt_masks_gui_form_save_creation | ( | dt_develop_t * | dev, |
| struct dt_iop_module_t * | module, | ||
| dt_masks_form_t * | form, | ||
| dt_masks_form_gui_t * | gui | ||
| ) |
Save the form creation right after a shape has been finished drawing.
| dev | the develop structure |
| module | the module owning the mask |
| form | the form to save |
| gui | the GUI state of the form |
Definition at line 2353 of file masks_gui.c.
References _check_id(), _group_create(), _group_from_module(), dt_conf_get_float(), dt_control_signal_get_global(), DT_DEBUG_CONTROL_SIGNAL_RAISE, dt_dev_add_history_item, dt_masks_append_form(), DT_MASKS_CLONE, dt_masks_cow_touch(), dt_masks_create(), dt_masks_dynbuf_free(), DT_MASKS_EVENT_ADD, dt_masks_form_exit_creation(), dt_masks_form_gui_points_free(), dt_masks_form_update_gravity_center(), DT_MASKS_GROUP, dt_masks_iop_update(), DT_MASKS_NON_CLONE, dt_masks_set_visible_form(), dt_masks_soft_reset_form_gui(), DT_MASKS_STATE_SHOW, DT_MASKS_STATE_UNION, DT_MASKS_STATE_USE, DT_PIXELPIPE_CACHE_HASH_INVALID, dt_pthread_rwlock_rdlock(), dt_pthread_rwlock_unlock(), DT_SIGNAL_MASK_CHANGED, FALSE, dt_develop_t::forms, IS_NULL_PTR, L, dt_develop_t::masks_mutex, and TRUE.
Referenced by _brush_events_button_released(), _circle_events_button_pressed(), _ellipse_events_button_pressed(), _gradient_events_button_pressed(), _polygon_creation_closing_form(), and legacy_params().
| void dt_masks_gui_form_test_create | ( | dt_masks_form_t * | form, |
| dt_masks_form_gui_t * | gui, | ||
| struct dt_iop_module_t * | module | ||
| ) |
Definition at line 2296 of file masks_gui.c.
References dt_dev_backbuf_get_hash(), dt_masks_form_gui_points_free(), dt_masks_get_from_id(), DT_MASKS_GROUP, dt_masks_gui_form_create(), DT_PIXELPIPE_CACHE_HASH_INVALID, IS_NULL_PTR, and L.
Referenced by _masks_draw_creation_session_forms(), and dt_masks_events_post_expose().
| void dt_masks_gui_init | ( | struct dt_develop_t * | dev | ) |
Definition at line 1296 of file masks_gui.c.
References dt_masks_clear_form_gui(), dt_masks_init_form_gui(), dt_masks_set_visible_form(), DT_PIXELPIPE_CACHE_HASH_INVALID, dt_develop_t::form_gui, dt_masks_form_gui_t::formid, IS_NULL_PTR, L, and dt_masks_form_gui_t::pipe_hash.
Referenced by _studio_dev_setup(), and enter().
| gboolean dt_masks_gui_is_dragging | ( | const dt_masks_form_gui_t * | gui | ) |
Definition at line 1351 of file masks_gui.c.
References dt_control_mouse_is_dragging(), FALSE, dt_masks_form_gui_t::form_dragging, dt_masks_form_gui_t::handle_border_dragging, dt_masks_form_gui_t::handle_dragging, IS_NULL_PTR, dt_masks_form_gui_t::node_dragging, dt_masks_form_gui_t::seg_dragging, and dt_masks_form_gui_t::source_dragging.
Referenced by _brush_events_button_released(), _dt_masks_events_flush_rebuild_if_needed(), _dt_masks_events_should_update_hover_on_move(), and _polygon_events_button_released().
| 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, | ||
| struct 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 679 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 L.
Referenced by _blendop_masks_group_ctx_menu(), _tree_context_menu(), and dt_masks_create_menu().
| gboolean dt_masks_gui_remove | ( | struct dt_iop_module_t * | module, |
| dt_masks_form_t * | form, | ||
| dt_masks_form_gui_t * | gui, | ||
| const int | parentid | ||
| ) |
remove a mask shape or node form from the GUI. This function is used with a popupmenu "Delete" action.
| module | The module owning the mask |
| form | The form to remove |
| gui | The GUI state of the form |
| parentid | The parent ID of the form |
Definition at line 2247 of file masks_gui.c.
References _masks_remove_shape(), DT_MASKS_EDIT_FULL, dt_masks_form_exit_creation(), DT_MASKS_IS_PATH_SHAPE, dt_masks_remove_node(), dt_masks_remove_or_delete(), FALSE, g_list_shorter_than(), L, and TRUE.
Referenced by _group_events_key_pressed(), and dt_masks_events_key_pressed().
| void dt_masks_gui_reset_dragging | ( | dt_masks_form_gui_t * | gui | ) |
Definition at line 1339 of file masks_gui.c.
References FALSE, dt_masks_form_gui_t::form_dragging, dt_masks_form_gui_t::handle_border_dragging, dt_masks_form_gui_t::handle_dragging, IS_NULL_PTR, dt_masks_form_gui_t::node_dragging, dt_masks_form_gui_t::seg_dragging, and dt_masks_form_gui_t::source_dragging.
Referenced by dt_masks_events_button_released().
|
inlinestatic |
Definition at line 201 of file masks_gui.h.
References dt_masks_form_gui_t::handle_border_hovered, and dt_masks_form_gui_t::handle_border_selected.
Referenced by _brush_events_post_expose(), and _polygon_events_post_expose().
|
inlinestatic |
Definition at line 196 of file masks_gui.h.
References dt_masks_form_gui_t::handle_hovered, and dt_masks_form_gui_t::handle_selected.
Referenced by _brush_events_post_expose(), _brush_reset_round_node_callback(), _polygon_events_post_expose(), and _polygon_reset_round_node_callback().
|
inlinestatic |
Definition at line 191 of file masks_gui.h.
References dt_masks_form_gui_t::node_selected, and dt_masks_form_gui_t::node_selected_idx.
Referenced by _brush_events_post_expose(), _brush_switch_node_callback(), _ellipse_draw_handles(), _polygon_events_post_expose(), _polygon_switch_node_callback(), dt_masks_find_closest_handle_common(), and dt_masks_gui_change_affects_selected_node_or_all().
|
inlinestatic |
Definition at line 206 of file masks_gui.h.
References dt_masks_form_gui_t::seg_hovered.
Referenced by _add_node_to_segment(), _add_node_to_segment(), _brush_events_post_expose(), and dt_masks_draw_path_seg_by_seg().
| void dt_masks_gui_set_dragging | ( | dt_masks_form_gui_t * | gui | ) |
Definition at line 1325 of file masks_gui.c.
References dt_masks_form_gui_t::form_dragging, dt_masks_form_gui_t::form_selected, dt_masks_form_gui_t::handle_border_dragging, dt_masks_form_gui_t::handle_border_hovered, dt_masks_form_gui_t::handle_border_selected, dt_masks_form_gui_t::handle_dragging, dt_masks_form_gui_t::handle_hovered, dt_masks_form_gui_t::handle_selected, IS_NULL_PTR, dt_masks_form_gui_t::node_dragging, dt_masks_form_gui_t::node_hovered, dt_masks_form_gui_t::node_selected, dt_masks_form_gui_t::seg_dragging, dt_masks_form_gui_t::seg_hovered, dt_masks_form_gui_t::seg_selected, dt_masks_form_gui_t::source_dragging, dt_masks_form_gui_t::source_selected, and TRUE.
Referenced by _apply_gui_button_pressed_state().
|
inlinestatic |
Definition at line 244 of file masks_gui.h.
References DT_GUI_MOUSE_EFFECT_RADIUS, FALSE, L, dt_masks_form_gui_t::last_hit_test_pos, dt_masks_form_gui_t::pos, and TRUE.
Referenced by _dt_masks_events_should_update_hover_on_move().
|
inlinestatic |
Definition at line 186 of file masks_gui.h.
References dt_masks_form_gui_t::border_selected, dt_masks_form_gui_t::form_selected, dt_masks_form_gui_t::pivot_selected, and dt_masks_form_gui_t::source_selected.
Referenced by dt_masks_find_closest_handle_common().
| void dt_masks_init_form_gui | ( | dt_develop_t * | dev, |
| dt_masks_form_gui_t * | gui | ||
| ) |
Reset a form GUI state and bind it to its owning develop instance (gui->dev).
Definition at line 1776 of file masks_gui.c.
References DT_MASKS_SOURCE_POS_RELATIVE_TEMP, FALSE, and L.
Referenced by _masks_draw_creation_session_forms(), and dt_masks_gui_init().
Definition at line 3459 of file masks_gui.c.
References _group_from_module(), dt_bauhaus_combobox_add(), dt_bauhaus_combobox_length(), dt_bauhaus_combobox_remove_at(), dt_free, dt_history_item_get_name(), dt_iop_request_focus(), DT_MASKS_CLONE, DT_MASKS_GROUP, DT_MASKS_NON_CLONE, dt_pthread_rwlock_rdlock(), dt_pthread_rwlock_unlock(), IOP_FLAGS_NO_MASKS, IOP_FLAGS_SUPPORTS_BLENDING, L, dt_iop_gui_blend_data_t::masks_combo, and dt_iop_gui_blend_data_t::masks_combo_ids.
| void dt_masks_iop_value_changed_callback | ( | GtkWidget * | widget, |
| struct dt_iop_module_t * | module | ||
| ) |
Definition at line 3543 of file masks_gui.c.
References _menu_add_exist(), _menu_add_shape(), _menu_no_masks(), dt_bauhaus_combobox_get(), dt_dev_add_history_item, DT_MASKS_BRUSH, DT_MASKS_CIRCLE, DT_MASKS_EDIT_FULL, DT_MASKS_ELLIPSE, DT_MASKS_GRADIENT, dt_masks_iop_update(), dt_masks_iop_use_same_as(), DT_MASKS_POLYGON, dt_masks_set_edit_mode(), L, dt_iop_gui_blend_data_t::masks_combo, dt_iop_gui_blend_data_t::masks_combo_ids, and TRUE.
| gboolean dt_masks_is_anything_hovered | ( | const dt_masks_form_gui_t * | mask_gui | ) |
Returns TRUE if anything in the mask is hovered at all, regardless of what it is.
Definition at line 2496 of file masks_gui.c.
References L.
Referenced by _dt_masks_events_group_update_selection(), _set_cursor_shape(), and dt_masks_events_button_pressed().
| gboolean dt_masks_is_anything_selected | ( | const dt_masks_form_gui_t * | mask_gui | ) |
Returns TRUE if anything in the mask is selected at all, regardless of what it is.
Definition at line 2486 of file masks_gui.c.
References L.
Referenced by _brush_events_mouse_scrolled(), _polygon_events_mouse_scrolled(), _set_cursor_shape(), dt_masks_draw_path_seg_by_seg(), dt_masks_events_button_pressed(), and dt_masks_events_mouse_scrolled().
| gboolean dt_masks_node_is_cusp | ( | const dt_masks_form_gui_points_t * | gpt, |
| const int | index | ||
| ) |
returns wether a node is a corner or not. A node is a corner if its 2 control handles are at the same position, else it's a curve.
| gpt | the GUI points of the mask form |
| index | the index of the node to test |
| nb | the number of coord by node |
| coord_offset | the offset of the coordinates in the points array |
Definition at line 2913 of file masks_gui.c.
References FALSE, IS_NULL_PTR, and L.
Referenced by _brush_events_button_pressed(), _brush_events_post_expose(), _brush_populate_context_menu(), _polygon_events_button_pressed(), _polygon_events_post_expose(), _polygon_populate_context_menu(), dt_masks_find_closest_handle_common(), dt_masks_reset_bezier_ctrl_points(), and dt_masks_toggle_bezier_node_type().
| int dt_masks_point_in_form_exact | ( | const float * | test_points, |
| int | test_point_count, | ||
| const float * | form_points, | ||
| int | form_points_start, | ||
| int | form_points_count | ||
| ) |
Check whether any 2D point in pts[] lies inside the form points[].
utils functions
We use the ray casting algorithm for each tested point.
| pts | Flat array of tested points [x0, y0, x1, y1, ...]. |
| num_pts | Number of tested points in pts. |
| points | The array of form vertices. |
| points_start | The starting index of the form vertices in the array. |
| points_count | The total number of vertices in the form. |
Definition at line 3872 of file masks_gui.c.
References i, IS_NULL_PTR, and L.
Referenced by _circle_get_distance(), _ellipse_get_distance(), _polygon_get_distance(), and dt_masks_draw_source().
| gboolean dt_masks_point_is_within_radius | ( | const float | point_x, |
| const float | point_y, | ||
| const float | center_x, | ||
| const float | center_y, | ||
| const float | squared_radius | ||
| ) |
Check if a point (px,py) is inside a radius from a center point (cx,cy)
| px | x coord of the point to test |
| py | y coord of the point to test |
| cx | center x coord |
| cy | center y coord |
| radius | the radius from center |
Check if a point (px,py) is inside a radius from a center point (cx,cy)
Assumptions/caveats:
Definition at line 1033 of file masks_gui.c.
References L.
Referenced by dt_masks_find_closest_handle_common().
|
inlinestatic |
Definition at line 390 of file masks_gui.h.
References dt_masks_preview_buffers_t::border, dt_pixelpipe_cache_free_align, dt_masks_preview_buffers_t::points, and dt_masks_preview_buffers_t::source_points.
Referenced by _circle_events_post_expose(), _circle_get_creation_preview(), _ellipse_events_post_expose(), _ellipse_get_creation_preview(), and _gradient_events_post_expose().
|
inlinestatic |
Definition at line 317 of file masks_gui.h.
References L.
Referenced by _brush_events_mouse_moved(), and _polygon_events_mouse_moved().
| void dt_masks_remove_form | ( | dt_develop_t * | dev, |
| dt_masks_form_t * | form | ||
| ) |
Definition at line 2343 of file masks_gui.c.
References dt_masks_form_unref(), dt_pthread_rwlock_unlock(), dt_pthread_rwlock_wrlock(), dt_develop_t::forms, L, and dt_develop_t::masks_mutex.
Referenced by dt_masks_form_delete().
| void dt_masks_remove_node | ( | struct dt_iop_module_t * | module, |
| dt_masks_form_t * | form, | ||
| int | parentid, | ||
| dt_masks_form_gui_t * | gui, | ||
| int | index, | ||
| int | node_index | ||
| ) |
Definition at line 1909 of file masks_gui.c.
References dt_free, dt_masks_cow_touch(), dt_masks_gui_form_create(), FALSE, IS_NULL_PTR, and L.
Referenced by _masks_gui_delete_node_callback(), _polygon_events_key_pressed(), and dt_masks_gui_remove().
| gboolean dt_masks_remove_or_delete | ( | struct dt_iop_module_t * | module, |
| dt_masks_form_t * | sel, | ||
| int | parent_id, | ||
| dt_masks_form_gui_t * | mask_gui, | ||
| int | form_id | ||
| ) |
If the form to remove is used once, ask to the user if he wants to delete it from the list or just remove and keep for later reuse.
| module | The module owning the mask |
| sel | The form to remove |
| parent_id | The parent ID of the form |
| mask_gui | The GUI state of the form |
| form_id | The form ID of the form to remove |
Definition at line 2103 of file masks_gui.c.
References _masks_gui_form_group_use_count(), _masks_remove_or_delete_finish(), dt_masks_gui_confirm_delete_form_dialog(), FALSE, IS_NULL_PTR, and L.
Referenced by dt_masks_gui_remove().
| gboolean dt_masks_remove_shape_from_group | ( | struct dt_iop_module_t * | module, |
| dt_masks_form_t * | sel, | ||
| int | parent_id, | ||
| dt_masks_form_gui_t * | mask_gui, | ||
| int | form_id | ||
| ) |
Remove the form from its current group only, keeping it around unused for potential reuse. Never asks for confirmation, since nothing is destroyed.
Definition at line 2124 of file masks_gui.c.
References _masks_remove_or_delete_finish(), FALSE, IS_NULL_PTR, L, and TRUE.
Referenced by _masks_gui_remove_from_group_callback().
| gboolean dt_masks_reset_bezier_ctrl_points | ( | struct dt_iop_module_t * | module, |
| struct dt_masks_form_t * | mask_form, | ||
| struct dt_masks_form_gui_t * | mask_gui, | ||
| const int | form_index, | ||
| const struct dt_masks_form_gui_points_t * | gui_points, | ||
| const int | node_index, | ||
| dt_masks_points_states_t * | state | ||
| ) |
Definition at line 999 of file masks_gui.c.
References dt_masks_gui_form_create(), dt_masks_node_is_cusp(), DT_MASKS_POINT_STATE_NORMAL, FALSE, IS_NULL_PTR, L, state, and TRUE.
Referenced by _brush_reset_round_node_callback(), and _polygon_reset_round_node_callback().
| void dt_masks_reset_form_gui | ( | dt_develop_t * | dev | ) |
Definition at line 3373 of file masks_gui.c.
References dt_masks_change_form_gui(), DT_MASKS_EDIT_OFF, dt_masks_shape_buttons_deactivate_all(), IOP_FLAGS_NO_MASKS, IOP_FLAGS_SUPPORTS_BLENDING, IS_NULL_PTR, L, dt_iop_gui_blend_data_t::masks_edit, and dt_iop_gui_blend_data_t::masks_shown.
Referenced by dt_iop_request_focus(), and gui_reset().
| void dt_masks_reset_show_masks_icons | ( | dt_develop_t * | dev | ) |
Definition at line 3388 of file masks_gui.c.
References DT_MASKS_EDIT_OFF, dt_masks_shape_buttons_deactivate_all(), FALSE, dt_develop_t::iop, IOP_FLAGS_SUPPORTS_BLENDING, IS_NULL_PTR, and L.
Referenced by _tree_selection_change().
| float dt_masks_rotate_with_anchor | ( | dt_develop_t * | develop, |
| const float | anchor[2], | ||
| const float | center[2], | ||
| dt_masks_form_gui_t * | mask_gui | ||
| ) |
Rotate a mask shape around its center. WARNING: gui->delta will be updated with the new position after rotation.
| dev | the develop structure |
| anchor | the current cursor position in absolute output-image coordinates. |
| center | the origin point of rotation in absolute output-image coordinates. |
| gui | the GUI form structure |
Rotate a mask shape around its center. WARNING: gui->delta will be updated with the new position after rotation.
anchor, center, and mask_gui->delta are absolute output-image coordinates. The angle accounts for possible axis inversion due to distortion transforms. Updates mask_gui->delta to store the last anchor position.
Definition at line 4107 of file masks_gui.c.
References dt_dev_coordinates_image_abs_to_raw_abs(), L, and M_PI.
Referenced by _ellipse_events_mouse_moved(), and _gradient_events_mouse_moved().
| void dt_masks_select_form | ( | dt_develop_t * | dev, |
| struct dt_iop_module_t * | module, | ||
| dt_masks_form_t * | selected_form | ||
| ) |
Select or clear the current mask form, notifying the owning module if needed.
allow to select a shape inside an iop
Passing NULL clears the selection.
Definition at line 3928 of file masks_gui.c.
References IS_NULL_PTR, and L.
Referenced by _brush_events_button_released(), _masks_remove_or_delete_finish(), dt_masks_clear_form_gui(), and dt_masks_events_button_pressed().
| void dt_masks_set_source_pos_initial_state | ( | dt_masks_form_gui_t * | mask_gui, |
| const uint32_t | key_state | ||
| ) |
Decide initial source positioning mode for clone masks.
utils for selecting the source of a clone mask while creating it
Uses key modifiers to choose absolute vs. relative positioning, and stores the reference position in preview coordinates. The current implementation caches that reference in absolute output-image coordinates.
Definition at line 3946 of file masks_gui.c.
References DT_MASKS_SOURCE_POS_ABSOLUTE, DT_MASKS_SOURCE_POS_RELATIVE_TEMP, dt_modifier_is(), and L.
Referenced by _brush_events_button_pressed(), _circle_events_button_pressed(), _ellipse_events_button_pressed(), and _polygon_events_button_pressed().
| void dt_masks_set_source_pos_initial_value | ( | dt_masks_form_gui_t * | mask_gui, |
| dt_masks_form_t * | mask_form | ||
| ) |
Initialize the clone source position based on current GUI state.
Handles first-time relative positioning, existing relative offsets, and absolute coordinates. Updates mask_form->source accordingly. mask_gui->rel_pos is the normalized output-image cursor, while mask_gui->pos_source stores either an absolute output-image position or an absolute output-image delta depending on the current source mode.
Definition at line 3971 of file masks_gui.c.
References dt_dev_coordinates_image_abs_to_raw_abs(), dt_dev_coordinates_image_abs_to_raw_norm(), dt_dev_coordinates_raw_abs_to_raw_norm(), dt_dev_geometry_snapshot(), DT_MASKS_SOURCE_POS_ABSOLUTE, DT_MASKS_SOURCE_POS_RELATIVE, DT_MASKS_SOURCE_POS_RELATIVE_TEMP, L, dt_dev_image_geometry_t::raw_height, and dt_dev_image_geometry_t::raw_width.
Referenced by _brush_events_button_pressed(), _circle_init_new(), _ellipse_init_new(), and _polygon_events_button_pressed().
| void dt_masks_set_visible_form | ( | struct dt_develop_t * | dev, |
| dt_masks_form_t * | form | ||
| ) |
Definition at line 1290 of file masks_gui.c.
References dt_develop_t::form_gui, dt_masks_form_gui_t::form_visible, IS_NULL_PTR, and L.
Referenced by _lib_masks_handler_callback(), dt_masks_change_form_gui(), dt_masks_form_exit_creation(), dt_masks_gui_cleanup(), dt_masks_gui_form_save_creation(), and dt_masks_gui_init().
| 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 200 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_data_t::buttons, dt_masks_shape_buttons_config_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, L, 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_data_t::types, and dt_masks_shape_buttons_config_t::types.
Referenced by _blendop_masks_create_shape_buttons(), gui_init(), and gui_init().
Definition at line 103 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().
| void dt_masks_soft_reset_form_gui | ( | dt_masks_form_gui_t * | gui | ) |
Definition at line 1805 of file masks_gui.c.
Referenced by _dt_masks_events_group_update_selection(), and dt_masks_gui_form_save_creation().
| gboolean dt_masks_toggle_bezier_node_type | ( | struct dt_iop_module_t * | module, |
| struct dt_masks_form_t * | mask_form, | ||
| struct dt_masks_form_gui_t * | mask_gui, | ||
| const int | form_index, | ||
| const struct dt_masks_form_gui_points_t * | gui_points, | ||
| const int | node_index, | ||
| float | node[2], | ||
| float | ctrl1[2], | ||
| float | ctrl2[2], | ||
| dt_masks_points_states_t * | state | ||
| ) |
Definition at line 971 of file masks_gui.c.
References dt_masks_gui_form_create(), dt_masks_node_is_cusp(), DT_MASKS_POINT_STATE_NORMAL, DT_MASKS_POINT_STATE_USER, FALSE, IS_NULL_PTR, L, state, and TRUE.
Referenced by _brush_events_button_pressed(), _brush_switch_node_callback(), _polygon_events_button_pressed(), and _polygon_switch_node_callback().