[gimp/wip/gradient-edit: 30/39] app: add support for removing gradient stops to the blend tool
- From: N/A <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/wip/gradient-edit: 30/39] app: add support for removing gradient stops to the blend tool
- Date: Sat, 12 Aug 2017 18:12:12 +0000 (UTC)
commit ce49f6836870bfee682ca3234be1218ed596839f
Author: Ell <ell_se yahoo com>
Date: Tue Aug 1 17:34:31 2017 -0400
app: add support for removing gradient stops to the blend tool
... by responding to the line's remove-slider signal.
app/tools/gimpblendtool-editor.c | 42 +++++++++++++++++++++++++++++++++----
1 files changed, 37 insertions(+), 5 deletions(-)
---
diff --git a/app/tools/gimpblendtool-editor.c b/app/tools/gimpblendtool-editor.c
index 097dc51..e57f389 100644
--- a/app/tools/gimpblendtool-editor.c
+++ b/app/tools/gimpblendtool-editor.c
@@ -55,6 +55,9 @@ static gboolean gimp_blend_tool_editor_line_can_add_slider (GimpTo
static gint gimp_blend_tool_editor_line_add_slider (GimpToolLine *line,
gdouble value,
GimpBlendTool *blend_tool);
+static void gimp_blend_tool_editor_line_remove_slider (GimpToolLine *line,
+ gint slider,
+ GimpBlendTool *blend_tool);
static gboolean gimp_blend_tool_editor_is_gradient_editable (GimpBlendTool *blend_tool);
@@ -123,6 +126,31 @@ gimp_blend_tool_editor_line_add_slider (GimpToolLine *line,
return slider;
}
+static void
+gimp_blend_tool_editor_line_remove_slider (GimpToolLine *line,
+ gint slider,
+ GimpBlendTool *blend_tool)
+{
+ GimpGradientSegment *seg;
+
+ g_assert (! blend_tool->modifying);
+
+ blend_tool->modifying = TRUE;
+
+ gimp_blend_tool_editor_freeze_gradient (blend_tool);
+
+ seg = gimp_blend_tool_editor_handle_get_segment (blend_tool, slider);
+
+ gimp_gradient_segment_range_merge (blend_tool->gradient,
+ seg, seg->next, NULL, NULL);
+
+ gimp_blend_tool_editor_thaw_gradient (blend_tool);
+
+ blend_tool->modifying = FALSE;
+
+ gimp_blend_tool_editor_update_sliders (blend_tool);
+}
+
static gboolean
gimp_blend_tool_editor_is_gradient_editable (GimpBlendTool *blend_tool)
{
@@ -238,13 +266,14 @@ gimp_blend_tool_editor_update_sliders (GimpBlendTool *blend_tool)
{
*slider = GIMP_CONTROLLER_SLIDER_DEFAULT;
- slider->value = seg->right;
- slider->min = seg->left;
- slider->max = seg->next->right;
+ slider->value = seg->right;
+ slider->min = seg->left;
+ slider->max = seg->next->right;
- slider->movable = editable;
+ slider->movable = editable;
+ slider->removable = editable;
- slider->data = GINT_TO_POINTER (i);
+ slider->data = GINT_TO_POINTER (i);
slider++;
}
@@ -360,6 +389,9 @@ gimp_blend_tool_editor_start (GimpBlendTool *blend_tool)
g_signal_connect (blend_tool->widget, "add-slider",
G_CALLBACK (gimp_blend_tool_editor_line_add_slider),
blend_tool);
+ g_signal_connect (blend_tool->widget, "remove-slider",
+ G_CALLBACK (gimp_blend_tool_editor_line_remove_slider),
+ blend_tool);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]