[gimp/wip/gradient-edit: 34/39] app: implement blend tool gui for gradient stops



commit 9b2c922b21e35ffcba31db1ddfd907b5b096e587
Author: Ell <ell_se yahoo com>
Date:   Thu Aug 3 09:15:43 2017 -0400

    app: implement blend tool gui for gradient stops
    
    Allows setting the stop's position, and its left and right colors
    and color types.  A chain button can be used to modify the two
    colors (and color types) together.
    
    The stop can be deleted through an editor button.

 app/tools/gimpblendtool-editor.c |  439 +++++++++++++++++++++++++++++++-------
 app/tools/gimpblendtool.h        |    7 +
 2 files changed, 373 insertions(+), 73 deletions(-)
---
diff --git a/app/tools/gimpblendtool-editor.c b/app/tools/gimpblendtool-editor.c
index 67a085c..2d6ebe8 100644
--- a/app/tools/gimpblendtool-editor.c
+++ b/app/tools/gimpblendtool-editor.c
@@ -63,69 +63,80 @@ typedef enum
 
 /*  local function prototypes  */
 
-static gboolean              gimp_blend_tool_editor_line_can_add_slider        (GimpToolLine         *line,
-                                                                                gdouble               value,
-                                                                                GimpBlendTool        
*blend_tool);
-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 void                  gimp_blend_tool_editor_line_selection_changed     (GimpToolLine         *line,
-                                                                                GimpBlendTool        
*blend_tool);
-static gboolean              gimp_blend_tool_editor_line_handle_clicked        (GimpToolLine         *line,
-                                                                                gint                  handle,
-                                                                                GdkModifierType       state,
-                                                                                GimpButtonPressType   
press_type,
-                                                                                GimpBlendTool        
*blend_tool);
-
-static void                  gimp_blend_tool_editor_gui_response               (GimpToolGui          *gui,
-                                                                                gint                  
response_id,
-                                                                                GimpBlendTool        
*blend_tool);
-
-static void                  gimp_blend_tool_editor_color_entry_color_changed  (GimpColorButton       
*button,
-                                                                                GimpBlendTool         
*blend_tool);
-
-static void                  gimp_blend_tool_editor_color_entry_type_changed   (GtkComboBox           *combo,
-                                                                                GimpBlendTool         
*blend_tool);
-
-static void                  gimp_blend_tool_editor_endpoint_se_value_changed  (GimpSizeEntry         *se,
-                                                                                GimpBlendTool         
*blend_tool);
-
-static gboolean              gimp_blend_tool_editor_is_gradient_editable       (GimpBlendTool        
*blend_tool);
-
-static gboolean              gimp_blend_tool_editor_handle_is_endpoint         (GimpBlendTool        
*blend_tool,
-                                                                                gint                  
handle);
-static gboolean              gimp_blend_tool_editor_handle_is_stop             (GimpBlendTool        
*blend_tool,
-                                                                                gint                  
handle);
-static gboolean              gimp_blend_tool_editor_handle_is_midpoint         (GimpBlendTool        
*blend_tool,
-                                                                                gint                  
handle);
-static GimpGradientSegment * gimp_blend_tool_editor_handle_get_segment         (GimpBlendTool        
*blend_tool,
-                                                                                gint                  
handle);
-
-static void                  gimp_blend_tool_editor_block_handlers             (GimpBlendTool        
*blend_tool);
-static void                  gimp_blend_tool_editor_unblock_handlers           (GimpBlendTool        
*blend_tool);
-static gboolean              gimp_blend_tool_editor_are_handlers_blocked       (GimpBlendTool        
*blend_tool);
-
-static void                  gimp_blend_tool_editor_freeze_gradient            (GimpBlendTool        
*blend_tool);
-static void                  gimp_blend_tool_editor_thaw_gradient              (GimpBlendTool        
*blend_tool);
-
-static gint                  gimp_blend_tool_editor_add_stop                   (GimpBlendTool        
*blend_tool,
-                                                                                gdouble               value);
-
-static void                  gimp_blend_tool_editor_update_sliders             (GimpBlendTool        
*blend_tool);
-
-static GtkWidget           * gimp_blend_tool_editor_color_entry_new            (GimpBlendTool        
*blend_tool,
-                                                                                const gchar          *title,
-                                                                                Direction             
direction,
-                                                                                GtkWidget            
*chain_button,
-                                                                                GtkWidget           
**color_panel,
-                                                                                GtkWidget           
**type_combo);
-static void                  gimp_blend_tool_editor_init_endpoint_gui          (GimpBlendTool        
*blend_tool);
-static void                  gimp_blend_tool_editor_update_endpoint_gui        (GimpBlendTool        
*blend_tool,
-                                                                                gint                  
selection);
-static void                  gimp_blend_tool_editor_update_gui                 (GimpBlendTool        
*blend_tool);
+static gboolean              gimp_blend_tool_editor_line_can_add_slider           (GimpToolLine         
*line,
+                                                                                   gdouble               
value,
+                                                                                   GimpBlendTool        
*blend_tool);
+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 void                  gimp_blend_tool_editor_line_selection_changed        (GimpToolLine         
*line,
+                                                                                   GimpBlendTool        
*blend_tool);
+static gboolean              gimp_blend_tool_editor_line_handle_clicked           (GimpToolLine         
*line,
+                                                                                   gint                  
handle,
+                                                                                   GdkModifierType       
state,
+                                                                                   GimpButtonPressType   
press_type,
+                                                                                   GimpBlendTool        
*blend_tool);
+
+static void                  gimp_blend_tool_editor_gui_response                  (GimpToolGui          *gui,
+                                                                                   gint                  
response_id,
+                                                                                   GimpBlendTool        
*blend_tool);
+
+static void                  gimp_blend_tool_editor_color_entry_color_changed     (GimpColorButton      
*button,
+                                                                                   GimpBlendTool        
*blend_tool);
+
+static void                  gimp_blend_tool_editor_color_entry_type_changed      (GtkComboBox          
*combo,
+                                                                                   GimpBlendTool        
*blend_tool);
+
+static void                  gimp_blend_tool_editor_endpoint_se_value_changed     (GimpSizeEntry        *se,
+                                                                                   GimpBlendTool        
*blend_tool);
+
+static void                  gimp_blend_tool_editor_stop_spinbutton_value_changed (GtkAdjustment        
*adjustment,
+                                                                                   GimpBlendTool        
*blend_tool);
+
+static void                  gimp_blend_tool_editor_stop_delete_clicked           (GtkWidget            
*button,
+                                                                                   GimpBlendTool        
*blend_tool);
+
+static gboolean              gimp_blend_tool_editor_is_gradient_editable          (GimpBlendTool        
*blend_tool);
+
+static gboolean              gimp_blend_tool_editor_handle_is_endpoint            (GimpBlendTool        
*blend_tool,
+                                                                                   gint                  
handle);
+static gboolean              gimp_blend_tool_editor_handle_is_stop                (GimpBlendTool        
*blend_tool,
+                                                                                   gint                  
handle);
+static gboolean              gimp_blend_tool_editor_handle_is_midpoint            (GimpBlendTool        
*blend_tool,
+                                                                                   gint                  
handle);
+static GimpGradientSegment * gimp_blend_tool_editor_handle_get_segment            (GimpBlendTool        
*blend_tool,
+                                                                                   gint                  
handle);
+
+static void                  gimp_blend_tool_editor_block_handlers                (GimpBlendTool        
*blend_tool);
+static void                  gimp_blend_tool_editor_unblock_handlers              (GimpBlendTool        
*blend_tool);
+static gboolean              gimp_blend_tool_editor_are_handlers_blocked          (GimpBlendTool        
*blend_tool);
+
+static void                  gimp_blend_tool_editor_freeze_gradient               (GimpBlendTool        
*blend_tool);
+static void                  gimp_blend_tool_editor_thaw_gradient                 (GimpBlendTool        
*blend_tool);
+
+static gint                  gimp_blend_tool_editor_add_stop                      (GimpBlendTool        
*blend_tool,
+                                                                                   gdouble               
value);
+static void                  gimp_blend_tool_editor_delete_stop                   (GimpBlendTool        
*blend_tool,
+                                                                                   gint                  
slider);
+
+static void                  gimp_blend_tool_editor_update_sliders                (GimpBlendTool        
*blend_tool);
+
+static GtkWidget           * gimp_blend_tool_editor_color_entry_new               (GimpBlendTool        
*blend_tool,
+                                                                                   const gchar          
*title,
+                                                                                   Direction             
direction,
+                                                                                   GtkWidget            
*chain_button,
+                                                                                   GtkWidget           
**color_panel,
+                                                                                   GtkWidget           
**type_combo);
+static void                  gimp_blend_tool_editor_init_endpoint_gui             (GimpBlendTool        
*blend_tool);
+static void                  gimp_blend_tool_editor_init_stop_gui                 (GimpBlendTool        
*blend_tool);
+static void                  gimp_blend_tool_editor_update_endpoint_gui           (GimpBlendTool        
*blend_tool,
+                                                                                   gint                  
selection);
+static void                  gimp_blend_tool_editor_update_stop_gui               (GimpBlendTool        
*blend_tool,
+                                                                                   gint                  
selection);
+static void                  gimp_blend_tool_editor_update_gui                    (GimpBlendTool        
*blend_tool);
 
 
 /*  private functions  */
@@ -167,28 +178,49 @@ gimp_blend_tool_editor_line_remove_slider (GimpToolLine  *line,
                                            gint           slider,
                                            GimpBlendTool *blend_tool)
 {
-  GimpGradientSegment *seg;
-
-  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);
+  gimp_blend_tool_editor_delete_stop (blend_tool, slider);
 }
 
 static void
 gimp_blend_tool_editor_line_selection_changed (GimpToolLine  *line,
                                                GimpBlendTool *blend_tool)
 {
+  gint selection;
+
+  selection =
+    gimp_tool_line_get_selection (GIMP_TOOL_LINE (blend_tool->widget));
+
   if (blend_tool->gui)
     {
       /* hide all color dialogs */
       gimp_color_panel_dialog_response (
         GIMP_COLOR_PANEL (blend_tool->endpoint_color_panel),
         GIMP_COLOR_DIALOG_OK);
+      gimp_color_panel_dialog_response (
+        GIMP_COLOR_PANEL (blend_tool->stop_left_color_panel),
+        GIMP_COLOR_DIALOG_OK);
+      gimp_color_panel_dialog_response (
+        GIMP_COLOR_PANEL (blend_tool->stop_right_color_panel),
+        GIMP_COLOR_DIALOG_OK);
+
+      /* reset the stop colors chain button */
+      if (gimp_blend_tool_editor_handle_is_stop (blend_tool, selection))
+        {
+          const GimpGradientSegment *seg;
+          gboolean                   homogeneous;
+
+          seg = gimp_blend_tool_editor_handle_get_segment (blend_tool,
+                                                           selection);
+
+          homogeneous = seg->right_color.r    == seg->next->left_color.r &&
+                        seg->right_color.g    == seg->next->left_color.g &&
+                        seg->right_color.b    == seg->next->left_color.b &&
+                        seg->right_color.a    == seg->next->left_color.a &&
+                        seg->right_color_type == seg->next->left_color_type;
+
+          gimp_chain_button_set_active (
+            GIMP_CHAIN_BUTTON (blend_tool->stop_chain_button), homogeneous);
+        }
     }
 
   gimp_blend_tool_editor_update_gui (blend_tool);
@@ -438,6 +470,48 @@ gimp_blend_tool_editor_endpoint_se_value_changed (GimpSizeEntry *se,
   gimp_blend_tool_editor_unblock_handlers (blend_tool);
 }
 
+static void
+gimp_blend_tool_editor_stop_spinbutton_value_changed (GtkAdjustment *adjustment,
+                                                      GimpBlendTool *blend_tool)
+{
+  gint                 selection;
+  gdouble              value;
+  GimpGradientSegment *seg;
+
+  if (gimp_blend_tool_editor_are_handlers_blocked (blend_tool))
+    return;
+
+  selection =
+    gimp_tool_line_get_selection (GIMP_TOOL_LINE (blend_tool->widget));
+
+  value = gtk_adjustment_get_value (adjustment) / 100.0;
+
+  gimp_blend_tool_editor_freeze_gradient (blend_tool);
+
+  seg = gimp_blend_tool_editor_handle_get_segment (blend_tool, selection);
+
+  gimp_gradient_segment_range_compress (blend_tool->gradient,
+                                        seg, seg,
+                                        seg->left, value);
+  gimp_gradient_segment_range_compress (blend_tool->gradient,
+                                        seg->next, seg->next,
+                                        value, seg->next->right);
+
+  gimp_blend_tool_editor_thaw_gradient (blend_tool);
+}
+
+static void
+gimp_blend_tool_editor_stop_delete_clicked (GtkWidget     *button,
+                                            GimpBlendTool *blend_tool)
+{
+  gint selection;
+
+  selection =
+    gimp_tool_line_get_selection (GIMP_TOOL_LINE (blend_tool->widget));
+
+  gimp_blend_tool_editor_delete_stop (blend_tool, selection);
+}
+
 static gboolean
 gimp_blend_tool_editor_is_gradient_editable (GimpBlendTool *blend_tool)
 {
@@ -595,6 +669,22 @@ gimp_blend_tool_editor_add_stop (GimpBlendTool *blend_tool,
 }
 
 static void
+gimp_blend_tool_editor_delete_stop (GimpBlendTool *blend_tool,
+                                    gint           slider)
+{
+  GimpGradientSegment *seg;
+
+  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);
+}
+
+static void
 gimp_blend_tool_editor_update_sliders (GimpBlendTool *blend_tool)
 {
   GimpBlendOptions     *options       = GIMP_BLEND_TOOL_GET_OPTIONS (blend_tool);
@@ -868,6 +958,131 @@ gimp_blend_tool_editor_init_endpoint_gui (GimpBlendTool *blend_tool)
 }
 
 static void
+gimp_blend_tool_editor_init_stop_gui (GimpBlendTool *blend_tool)
+{
+  GtkWidget *editor;
+  GtkWidget *table;
+  GtkWidget *label;
+  GtkWidget *spinbutton;
+  GtkWidget *table2;
+  GtkWidget *button;
+  GtkWidget *hbox;
+  GtkWidget *separator;
+  gint       row = 0;
+
+  /* the stop editor */
+  blend_tool->stop_editor =
+  editor                  = gimp_editor_new ();
+  gtk_box_pack_start (GTK_BOX (gimp_tool_gui_get_vbox (blend_tool->gui)),
+                      editor, FALSE, TRUE, 0);
+
+  /* the main table */
+  table = gtk_table_new (1, 2, FALSE);
+  gtk_table_set_row_spacings (GTK_TABLE (table), 4);
+  gtk_table_set_col_spacings (GTK_TABLE (table), 4);
+  gtk_box_pack_start (GTK_BOX (editor), table, FALSE, TRUE, 0);
+  gtk_widget_show (table);
+
+  /* the position label */
+  label = gtk_label_new (_("Position:"));
+  gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+  gtk_table_attach (GTK_TABLE (table), label, 0, 1, row, row + 1,
+                    GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
+  gtk_widget_show (label);
+
+  /* the position spin button */
+  blend_tool->stop_spinbutton =
+  spinbutton                  = gtk_spin_button_new_with_range (0.0, 100.0,
+                                                                1.0);
+  gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 6);
+  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
+  gtk_spin_button_set_digits (GTK_SPIN_BUTTON (spinbutton), 2);
+  gtk_table_attach (GTK_TABLE (table), spinbutton, 1, 2, row, row + 1,
+                    GTK_SHRINK | GTK_FILL | GTK_EXPAND,
+                    GTK_SHRINK | GTK_FILL,
+                    0, 0);
+  gtk_widget_show (spinbutton);
+
+  g_signal_connect (
+    gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spinbutton)),
+    "value-changed",
+    G_CALLBACK (gimp_blend_tool_editor_stop_spinbutton_value_changed),
+    blend_tool);
+
+  row++;
+
+  /* the color labels */
+  label = gtk_label_new (_("Left color:"));
+  gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+  gtk_table_attach (GTK_TABLE (table), label, 0, 1, row, row + 1,
+                    GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
+  gtk_widget_show (label);
+
+  label = gtk_label_new (_("Right color:"));
+  gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+  gtk_table_attach (GTK_TABLE (table), label, 0, 1, row + 1, row + 2,
+                    GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
+  gtk_widget_show (label);
+
+  /* the color entries table */
+  table2 = gtk_table_new (1, 2, FALSE);
+  gtk_table_set_row_spacings (GTK_TABLE (table2), 4);
+  gtk_table_set_col_spacings (GTK_TABLE (table2), 2);
+  gtk_table_attach (GTK_TABLE (table), table2, 1, 2, row, row + 2,
+                    GTK_SHRINK | GTK_FILL | GTK_EXPAND,
+                    GTK_SHRINK | GTK_FILL,
+                    0, 0);
+  gtk_widget_show (table2);
+
+  /* the color entries chain button */
+  blend_tool->stop_chain_button =
+  button                        = gimp_chain_button_new (GIMP_CHAIN_RIGHT);
+  gtk_table_attach (GTK_TABLE (table2), button, 1, 2, 0, 2,
+                    GTK_SHRINK | GTK_FILL,
+                    GTK_SHRINK | GTK_FILL | GTK_EXPAND,
+                    0, 0);
+  gtk_widget_show (button);
+
+  /* the color entries */
+  hbox = gimp_blend_tool_editor_color_entry_new (
+    blend_tool, _("Change Stop Color"), DIRECTION_LEFT, button,
+    &blend_tool->stop_left_color_panel, &blend_tool->stop_left_type_combo);
+  gtk_table_attach (GTK_TABLE (table2), hbox, 0, 1, 0, 1,
+                    GTK_SHRINK | GTK_FILL | GTK_EXPAND,
+                    GTK_SHRINK | GTK_FILL,
+                    0, 0);
+  gtk_widget_show (hbox);
+
+  hbox = gimp_blend_tool_editor_color_entry_new (
+    blend_tool, _("Change Stop Color"), DIRECTION_RIGHT, button,
+    &blend_tool->stop_right_color_panel, &blend_tool->stop_right_type_combo);
+  gtk_table_attach (GTK_TABLE (table2), hbox, 0, 1, 1, 2,
+                    GTK_SHRINK | GTK_FILL | GTK_EXPAND,
+                    GTK_SHRINK | GTK_FILL,
+                    0, 0);
+  gtk_widget_show (hbox);
+
+  row += 2;
+
+  /* the action buttons separator */
+  separator = gtk_hseparator_new ();
+  gtk_table_attach (GTK_TABLE (table), separator, 0, 2, row, row + 1,
+                    GTK_SHRINK | GTK_FILL | GTK_EXPAND,
+                    GTK_SHRINK | GTK_FILL,
+                    0, 0);
+  gtk_widget_show (separator);
+
+  row++;
+
+  /* the delete button */
+  gimp_editor_add_button (GIMP_EDITOR (editor),
+                          GIMP_ICON_EDIT_DELETE, _("Delete stop"),
+                          NULL,
+                          G_CALLBACK (gimp_blend_tool_editor_stop_delete_clicked),
+                          NULL, blend_tool);
+}
+
+static void
 gimp_blend_tool_editor_update_endpoint_gui (GimpBlendTool *blend_tool,
                                             gint           selection)
 {
@@ -960,6 +1175,78 @@ gimp_blend_tool_editor_update_endpoint_gui (GimpBlendTool *blend_tool,
 }
 
 static void
+gimp_blend_tool_editor_update_stop_gui (GimpBlendTool *blend_tool,
+                                        gint           selection)
+{
+  GimpBlendOptions    *options = GIMP_BLEND_TOOL_GET_OPTIONS (blend_tool);
+  GimpContext         *context = GIMP_CONTEXT (options);
+  gboolean             editable;
+  GimpGradientSegment *seg;
+  gint                 index;
+  gchar               *title;
+  gdouble              min;
+  gdouble              max;
+  gdouble              value;
+  GimpRGB              left_color;
+  GimpGradientColor    left_color_type;
+  GimpRGB              right_color;
+  GimpGradientColor    right_color_type;
+
+  editable = gimp_blend_tool_editor_is_gradient_editable (blend_tool);
+
+  seg = gimp_blend_tool_editor_handle_get_segment (blend_tool, selection);
+
+  index = GPOINTER_TO_INT (
+    gimp_tool_line_get_sliders (GIMP_TOOL_LINE (blend_tool->widget),
+                                NULL)[selection].data);
+
+  title = g_strdup_printf (_("Stop %d"), index + 1);
+
+  min   = seg->left;
+  max   = seg->next->right;
+  value = seg->right;
+
+  gimp_gradient_segment_get_right_flat_color (blend_tool->gradient, context,
+                                              seg, &left_color);
+  left_color_type = seg->right_color_type;
+
+  gimp_gradient_segment_get_left_flat_color (blend_tool->gradient, context,
+                                             seg->next, &right_color);
+  right_color_type = seg->next->left_color_type;
+
+  gimp_tool_gui_set_title (blend_tool->gui, title);
+
+  gtk_spin_button_set_range (GTK_SPIN_BUTTON (blend_tool->stop_spinbutton),
+                             100.0 * min, 100.0 * max);
+  gtk_spin_button_set_value (GTK_SPIN_BUTTON (blend_tool->stop_spinbutton),
+                             100.0 * value);
+
+  gimp_color_button_set_color (
+    GIMP_COLOR_BUTTON (blend_tool->stop_left_color_panel), &left_color);
+  gimp_int_combo_box_set_active (
+    GIMP_INT_COMBO_BOX (blend_tool->stop_left_type_combo), left_color_type);
+
+  gimp_color_button_set_color (
+    GIMP_COLOR_BUTTON (blend_tool->stop_right_color_panel), &right_color);
+  gimp_int_combo_box_set_active (
+    GIMP_INT_COMBO_BOX (blend_tool->stop_right_type_combo), right_color_type);
+
+  gtk_widget_set_sensitive (blend_tool->stop_spinbutton,        editable);
+  gtk_widget_set_sensitive (blend_tool->stop_left_color_panel,  editable);
+  gtk_widget_set_sensitive (blend_tool->stop_left_type_combo,   editable);
+  gtk_widget_set_sensitive (blend_tool->stop_right_color_panel, editable);
+  gtk_widget_set_sensitive (blend_tool->stop_right_type_combo,  editable);
+  gtk_widget_set_sensitive (blend_tool->stop_chain_button,      editable);
+  gtk_widget_set_sensitive (
+    GTK_WIDGET (gimp_editor_get_button_box (GIMP_EDITOR (blend_tool->stop_editor))),
+    editable);
+
+  g_free (title);
+
+  gtk_widget_show (blend_tool->stop_editor);
+}
+
+static void
 gimp_blend_tool_editor_update_gui (GimpBlendTool *blend_tool)
 {
   GimpBlendOptions *options = GIMP_BLEND_TOOL_GET_OPTIONS (blend_tool);
@@ -1000,6 +1287,7 @@ gimp_blend_tool_editor_update_gui (GimpBlendTool *blend_tool)
                                 blend_tool);
 
               gimp_blend_tool_editor_init_endpoint_gui (blend_tool);
+              gimp_blend_tool_editor_init_stop_gui     (blend_tool);
             }
 
           gimp_blend_tool_editor_block_handlers (blend_tool);
@@ -1009,6 +1297,11 @@ gimp_blend_tool_editor_update_gui (GimpBlendTool *blend_tool)
           else
             gtk_widget_hide (blend_tool->endpoint_editor);
 
+          if (gimp_blend_tool_editor_handle_is_stop (blend_tool, selection))
+            gimp_blend_tool_editor_update_stop_gui (blend_tool, selection);
+          else
+            gtk_widget_hide (blend_tool->stop_editor);
+
           gimp_blend_tool_editor_unblock_handlers (blend_tool);
 
           gimp_tool_gui_show (blend_tool->gui);
diff --git a/app/tools/gimpblendtool.h b/app/tools/gimpblendtool.h
index 0eedb7d..7b6bb3d 100644
--- a/app/tools/gimpblendtool.h
+++ b/app/tools/gimpblendtool.h
@@ -71,6 +71,13 @@ struct _GimpBlendTool
   GtkWidget          *endpoint_se;
   GtkWidget          *endpoint_color_panel;
   GtkWidget          *endpoint_type_combo;
+  GtkWidget          *stop_editor;
+  GtkWidget          *stop_spinbutton;
+  GtkWidget          *stop_left_color_panel;
+  GtkWidget          *stop_left_type_combo;
+  GtkWidget          *stop_right_color_panel;
+  GtkWidget          *stop_right_type_combo;
+  GtkWidget          *stop_chain_button;
 };
 
 struct _GimpBlendToolClass


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]