[gimp: 5/7] Bug 795230 - Rename Blend tool and provide PDB compatibility
- From: N/A <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp: 5/7] Bug 795230 - Rename Blend tool and provide PDB compatibility
- Date: Sun, 15 Apr 2018 07:32:01 +0000 (UTC)
commit 92330425c8f5350cac0bed8ea146f135029e4aca
Author: Michael Natterer <mitch gimp org>
Date: Sat Apr 14 00:52:20 2018 +0200
Bug 795230 - Rename Blend tool and provide PDB compatibility
Redo the part of commits b0beb0197a4bd2c14ded20da976d4affd0c94729,
c3f98cccbdb6a154ca6efea043e46c9c532a407c,
6b0f5136e09f64a830b65037f48493fc0040674f,
and 3736bfd189c53637f04fb751ed8d02070e6289fb, reverted by commit
e30a32d56e123a9e221102cc2707fd697f1d7945.
app/tools/gimpgradienttool-editor.c | 1437 +++++++++++++++++------------------
app/tools/gimpgradienttool-editor.h | 38 +-
app/tools/gimpgradienttool.c | 837 ++++++++++----------
3 files changed, 1156 insertions(+), 1156 deletions(-)
---
diff --git a/app/tools/gimpgradienttool-editor.c b/app/tools/gimpgradienttool-editor.c
index 9f1b1dc..ab284c9 100644
--- a/app/tools/gimpgradienttool-editor.c
+++ b/app/tools/gimpgradienttool-editor.c
@@ -43,9 +43,9 @@
#include "display/gimptoolgui.h"
#include "display/gimptoolline.h"
-#include "gimpblendoptions.h"
-#include "gimpblendtool.h"
-#include "gimpblendtool-editor.h"
+#include "gimpgradientoptions.h"
+#include "gimpgradienttool.h"
+#include "gimpgradienttool-editor.h"
#include "gimp-intl.h"
@@ -69,7 +69,7 @@ typedef struct
gdouble end_x;
gdouble end_y;
- /* copy of the gradient at the beginning of the operation, owned by the blend
+ /* copy of the gradient at the beginning of the operation, owned by the gradient
* info, or NULL, if the gradient isn't affected
*/
GimpGradient *gradient;
@@ -80,151 +80,151 @@ typedef struct
gint removed_handle;
/* selected handle at the end of the operation, or HANDLE_NONE */
gint selected_handle;
-} BlendInfo;
+} GradientInfo;
/* 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_prepare_to_remove_slider (GimpToolLine
*line,
- gint
slider,
- gboolean
remove,
- 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_clicked (GimpColorButton
*button,
- 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_color_response (GimpColorButton
*button,
- GimpColorDialogState
state,
- 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_se_value_changed (GimpSizeEntry *se,
- GimpBlendTool
*blend_tool);
-
-static void gimp_blend_tool_editor_stop_delete_clicked (GtkWidget
*button,
- GimpBlendTool
*blend_tool);
-
-static void gimp_blend_tool_editor_midpoint_se_value_changed (GimpSizeEntry *se,
- GimpBlendTool
*blend_tool);
-
-static void gimp_blend_tool_editor_midpoint_type_changed (GtkComboBox
*combo,
- GimpBlendTool
*blend_tool);
-
-static void gimp_blend_tool_editor_midpoint_color_changed (GtkComboBox
*combo,
- GimpBlendTool
*blend_tool);
-
-static void gimp_blend_tool_editor_midpoint_new_stop_clicked (GtkWidget
*button,
- GimpBlendTool
*blend_tool);
-static void gimp_blend_tool_editor_midpoint_center_clicked (GtkWidget
*button,
- GimpBlendTool
*blend_tool);
-
-static gboolean gimp_blend_tool_editor_flush_idle (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 gint gimp_blend_tool_editor_midpoint_to_stop (GimpBlendTool
*blend_tool,
- gint
slider);
-
-static void gimp_blend_tool_editor_update_sliders (GimpBlendTool
*blend_tool);
-
-static void gimp_blend_tool_editor_purge_gradient_history (GSList
**stack);
-static void gimp_blend_tool_editor_purge_gradient (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_init_midpoint_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_midpoint_gui (GimpBlendTool
*blend_tool,
- gint
selection);
-static void gimp_blend_tool_editor_update_gui (GimpBlendTool
*blend_tool);
-
-static BlendInfo * gimp_blend_tool_editor_blend_info_new (GimpBlendTool
*blend_tool);
-static void gimp_blend_tool_editor_blend_info_free (BlendInfo
*info);
-static void gimp_blend_tool_editor_blend_info_apply (GimpBlendTool
*blend_tool,
- const BlendInfo
*info,
- gboolean
set_selection);
-static gboolean gimp_blend_tool_editor_blend_info_is_trivial (GimpBlendTool
*blend_tool,
- const BlendInfo
*info);
+static gboolean gimp_gradient_tool_editor_line_can_add_slider (GimpToolLine
*line,
+ gdouble
value,
+ GimpGradientTool
*gradient_tool);
+static gint gimp_gradient_tool_editor_line_add_slider (GimpToolLine
*line,
+ gdouble
value,
+ GimpGradientTool
*gradient_tool);
+static void gimp_gradient_tool_editor_line_prepare_to_remove_slider (GimpToolLine
*line,
+ gint
slider,
+ gboolean
remove,
+ GimpGradientTool
*gradient_tool);
+static void gimp_gradient_tool_editor_line_remove_slider (GimpToolLine
*line,
+ gint
slider,
+ GimpGradientTool
*gradient_tool);
+static void gimp_gradient_tool_editor_line_selection_changed (GimpToolLine
*line,
+ GimpGradientTool
*gradient_tool);
+static gboolean gimp_gradient_tool_editor_line_handle_clicked (GimpToolLine
*line,
+ gint
handle,
+ GdkModifierType
state,
+ GimpButtonPressType
press_type,
+ GimpGradientTool
*gradient_tool);
+
+static void gimp_gradient_tool_editor_gui_response (GimpToolGui
*gui,
+ gint
response_id,
+ GimpGradientTool
*gradient_tool);
+
+static void gimp_gradient_tool_editor_color_entry_color_clicked (GimpColorButton
*button,
+ GimpGradientTool
*gradient_tool);
+static void gimp_gradient_tool_editor_color_entry_color_changed (GimpColorButton
*button,
+ GimpGradientTool
*gradient_tool);
+static void gimp_gradient_tool_editor_color_entry_color_response (GimpColorButton
*button,
+ GimpColorDialogState
state,
+ GimpGradientTool
*gradient_tool);
+
+static void gimp_gradient_tool_editor_color_entry_type_changed (GtkComboBox
*combo,
+ GimpGradientTool
*gradient_tool);
+
+static void gimp_gradient_tool_editor_endpoint_se_value_changed (GimpSizeEntry
*se,
+ GimpGradientTool
*gradient_tool);
+
+static void gimp_gradient_tool_editor_stop_se_value_changed (GimpSizeEntry
*se,
+ GimpGradientTool
*gradient_tool);
+
+static void gimp_gradient_tool_editor_stop_delete_clicked (GtkWidget
*button,
+ GimpGradientTool
*gradient_tool);
+
+static void gimp_gradient_tool_editor_midpoint_se_value_changed (GimpSizeEntry
*se,
+ GimpGradientTool
*gradient_tool);
+
+static void gimp_gradient_tool_editor_midpoint_type_changed (GtkComboBox
*combo,
+ GimpGradientTool
*gradient_tool);
+
+static void gimp_gradient_tool_editor_midpoint_color_changed (GtkComboBox
*combo,
+ GimpGradientTool
*gradient_tool);
+
+static void gimp_gradient_tool_editor_midpoint_new_stop_clicked (GtkWidget
*button,
+ GimpGradientTool
*gradient_tool);
+static void gimp_gradient_tool_editor_midpoint_center_clicked (GtkWidget
*button,
+ GimpGradientTool
*gradient_tool);
+
+static gboolean gimp_gradient_tool_editor_flush_idle (GimpGradientTool
*gradient_tool);
+
+static gboolean gimp_gradient_tool_editor_is_gradient_editable (GimpGradientTool
*gradient_tool);
+
+static gboolean gimp_gradient_tool_editor_handle_is_endpoint (GimpGradientTool
*gradient_tool,
+ gint
handle);
+static gboolean gimp_gradient_tool_editor_handle_is_stop (GimpGradientTool
*gradient_tool,
+ gint
handle);
+static gboolean gimp_gradient_tool_editor_handle_is_midpoint (GimpGradientTool
*gradient_tool,
+ gint
handle);
+static GimpGradientSegment * gimp_gradient_tool_editor_handle_get_segment (GimpGradientTool
*gradient_tool,
+ gint
handle);
+
+static void gimp_gradient_tool_editor_block_handlers (GimpGradientTool
*gradient_tool);
+static void gimp_gradient_tool_editor_unblock_handlers (GimpGradientTool
*gradient_tool);
+static gboolean gimp_gradient_tool_editor_are_handlers_blocked (GimpGradientTool
*gradient_tool);
+
+static void gimp_gradient_tool_editor_freeze_gradient (GimpGradientTool
*gradient_tool);
+static void gimp_gradient_tool_editor_thaw_gradient (GimpGradientTool
*gradient_tool);
+
+static gint gimp_gradient_tool_editor_add_stop (GimpGradientTool
*gradient_tool,
+ gdouble
value);
+static void gimp_gradient_tool_editor_delete_stop (GimpGradientTool
*gradient_tool,
+ gint
slider);
+static gint gimp_gradient_tool_editor_midpoint_to_stop (GimpGradientTool
*gradient_tool,
+ gint
slider);
+
+static void gimp_gradient_tool_editor_update_sliders (GimpGradientTool
*gradient_tool);
+
+static void gimp_gradient_tool_editor_purge_gradient_history (GSList
**stack);
+static void gimp_gradient_tool_editor_purge_gradient (GimpGradientTool
*gradient_tool);
+
+static GtkWidget * gimp_gradient_tool_editor_color_entry_new (GimpGradientTool
*gradient_tool,
+ const gchar
*title,
+ Direction
direction,
+ GtkWidget
*chain_button,
+ GtkWidget
**color_panel,
+ GtkWidget
**type_combo);
+static void gimp_gradient_tool_editor_init_endpoint_gui (GimpGradientTool
*gradient_tool);
+static void gimp_gradient_tool_editor_init_stop_gui (GimpGradientTool
*gradient_tool);
+static void gimp_gradient_tool_editor_init_midpoint_gui (GimpGradientTool
*gradient_tool);
+static void gimp_gradient_tool_editor_update_endpoint_gui (GimpGradientTool
*gradient_tool,
+ gint
selection);
+static void gimp_gradient_tool_editor_update_stop_gui (GimpGradientTool
*gradient_tool,
+ gint
selection);
+static void gimp_gradient_tool_editor_update_midpoint_gui (GimpGradientTool
*gradient_tool,
+ gint
selection);
+static void gimp_gradient_tool_editor_update_gui (GimpGradientTool
*gradient_tool);
+
+static GradientInfo * gimp_gradient_tool_editor_gradient_info_new (GimpGradientTool
*gradient_tool);
+static void gimp_gradient_tool_editor_gradient_info_free (GradientInfo
*info);
+static void gimp_gradient_tool_editor_gradient_info_apply (GimpGradientTool
*gradient_tool,
+ const GradientInfo
*info,
+ gboolean
set_selection);
+static gboolean gimp_gradient_tool_editor_gradient_info_is_trivial (GimpGradientTool
*gradient_tool,
+ const GradientInfo
*info);
/* private functions */
static gboolean
-gimp_blend_tool_editor_line_can_add_slider (GimpToolLine *line,
- gdouble value,
- GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_line_can_add_slider (GimpToolLine *line,
+ gdouble value,
+ GimpGradientTool *gradient_tool)
{
- GimpBlendOptions *options = GIMP_BLEND_TOOL_GET_OPTIONS (blend_tool);
- gdouble offset = options->offset / 100.0;
+ GimpGradientOptions *options = GIMP_GRADIENT_TOOL_GET_OPTIONS (gradient_tool);
+ gdouble offset = options->offset / 100.0;
- return gimp_blend_tool_editor_is_gradient_editable (blend_tool) &&
+ return gimp_gradient_tool_editor_is_gradient_editable (gradient_tool) &&
value >= offset;
}
static gint
-gimp_blend_tool_editor_line_add_slider (GimpToolLine *line,
- gdouble value,
- GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_line_add_slider (GimpToolLine *line,
+ gdouble value,
+ GimpGradientTool *gradient_tool)
{
- GimpBlendOptions *options = GIMP_BLEND_TOOL_GET_OPTIONS (blend_tool);
- GimpPaintOptions *paint_options = GIMP_PAINT_OPTIONS (options);
- gdouble offset = options->offset / 100.0;
+ GimpGradientOptions *options = GIMP_GRADIENT_TOOL_GET_OPTIONS (gradient_tool);
+ GimpPaintOptions *paint_options = GIMP_PAINT_OPTIONS (options);
+ gdouble offset = options->offset / 100.0;
/* adjust slider value according to the offset */
value = (value - offset) / (1.0 - offset);
@@ -233,29 +233,29 @@ gimp_blend_tool_editor_line_add_slider (GimpToolLine *line,
if (paint_options->gradient_options->gradient_reverse)
value = 1.0 - value;
- return gimp_blend_tool_editor_add_stop (blend_tool, value);
+ return gimp_gradient_tool_editor_add_stop (gradient_tool, value);
}
static void
-gimp_blend_tool_editor_line_prepare_to_remove_slider (GimpToolLine *line,
- gint slider,
- gboolean remove,
- GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_line_prepare_to_remove_slider (GimpToolLine *line,
+ gint slider,
+ gboolean remove,
+ GimpGradientTool *gradient_tool)
{
if (remove)
{
- BlendInfo *info;
+ GradientInfo *info;
GimpGradient *tentative_gradient;
/* show a tentative gradient, demonstrating the result of actually
* removing the slider
*/
- info = blend_tool->undo_stack->data;
+ info = gradient_tool->undo_stack->data;
if (info->added_handle == slider)
{
- /* see comment in gimp_blend_tool_editor_delete_stop() */
+ /* see comment in gimp_gradient_tool_editor_delete_stop() */
gimp_assert (info->gradient != NULL);
@@ -267,12 +267,12 @@ gimp_blend_tool_editor_line_prepare_to_remove_slider (GimpToolLine *line,
gint i;
tentative_gradient =
- GIMP_GRADIENT (gimp_data_duplicate (GIMP_DATA (blend_tool->gradient)));
+ GIMP_GRADIENT (gimp_data_duplicate (GIMP_DATA (gradient_tool->gradient)));
- seg = gimp_blend_tool_editor_handle_get_segment (blend_tool, slider);
+ seg = gimp_gradient_tool_editor_handle_get_segment (gradient_tool, slider);
- i = gimp_gradient_segment_range_get_n_segments (blend_tool->gradient,
- blend_tool->gradient->segments,
+ i = gimp_gradient_segment_range_get_n_segments (gradient_tool->gradient,
+ gradient_tool->gradient->segments,
seg) - 1;
seg = gimp_gradient_segment_get_nth (tentative_gradient->segments, i);
@@ -281,55 +281,55 @@ gimp_blend_tool_editor_line_prepare_to_remove_slider (GimpToolLine *line,
seg, seg->next, NULL, NULL);
}
- gimp_blend_tool_set_tentative_gradient (blend_tool, tentative_gradient);
+ gimp_gradient_tool_set_tentative_gradient (gradient_tool, tentative_gradient);
g_object_unref (tentative_gradient);
}
else
{
- gimp_blend_tool_set_tentative_gradient (blend_tool, NULL);
+ gimp_gradient_tool_set_tentative_gradient (gradient_tool, NULL);
}
}
static void
-gimp_blend_tool_editor_line_remove_slider (GimpToolLine *line,
- gint slider,
- GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_line_remove_slider (GimpToolLine *line,
+ gint slider,
+ GimpGradientTool *gradient_tool)
{
- gimp_blend_tool_editor_delete_stop (blend_tool, slider);
- gimp_blend_tool_set_tentative_gradient (blend_tool, NULL);
+ gimp_gradient_tool_editor_delete_stop (gradient_tool, slider);
+ gimp_gradient_tool_set_tentative_gradient (gradient_tool, NULL);
}
static void
-gimp_blend_tool_editor_line_selection_changed (GimpToolLine *line,
- GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_line_selection_changed (GimpToolLine *line,
+ GimpGradientTool *gradient_tool)
{
gint selection;
selection =
- gimp_tool_line_get_selection (GIMP_TOOL_LINE (blend_tool->widget));
+ gimp_tool_line_get_selection (GIMP_TOOL_LINE (gradient_tool->widget));
- if (blend_tool->gui)
+ if (gradient_tool->gui)
{
/* hide all color dialogs */
gimp_color_panel_dialog_response (
- GIMP_COLOR_PANEL (blend_tool->endpoint_color_panel),
+ GIMP_COLOR_PANEL (gradient_tool->endpoint_color_panel),
GIMP_COLOR_DIALOG_OK);
gimp_color_panel_dialog_response (
- GIMP_COLOR_PANEL (blend_tool->stop_left_color_panel),
+ GIMP_COLOR_PANEL (gradient_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_PANEL (gradient_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))
+ if (gimp_gradient_tool_editor_handle_is_stop (gradient_tool, selection))
{
const GimpGradientSegment *seg;
gboolean homogeneous;
- seg = gimp_blend_tool_editor_handle_get_segment (blend_tool,
- selection);
+ seg = gimp_gradient_tool_editor_handle_get_segment (gradient_tool,
+ selection);
homogeneous = seg->right_color.r == seg->next->left_color.r &&
seg->right_color.g == seg->next->left_color.g &&
@@ -338,28 +338,28 @@ gimp_blend_tool_editor_line_selection_changed (GimpToolLine *line,
seg->right_color_type == seg->next->left_color_type;
gimp_chain_button_set_active (
- GIMP_CHAIN_BUTTON (blend_tool->stop_chain_button), homogeneous);
+ GIMP_CHAIN_BUTTON (gradient_tool->stop_chain_button), homogeneous);
}
}
- gimp_blend_tool_editor_update_gui (blend_tool);
+ gimp_gradient_tool_editor_update_gui (gradient_tool);
}
static gboolean
-gimp_blend_tool_editor_line_handle_clicked (GimpToolLine *line,
- gint handle,
- GdkModifierType state,
- GimpButtonPressType press_type,
- GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_line_handle_clicked (GimpToolLine *line,
+ gint handle,
+ GdkModifierType state,
+ GimpButtonPressType press_type,
+ GimpGradientTool *gradient_tool)
{
- if (gimp_blend_tool_editor_handle_is_midpoint (blend_tool, handle))
+ if (gimp_gradient_tool_editor_handle_is_midpoint (gradient_tool, handle))
{
if (press_type == GIMP_BUTTON_PRESS_DOUBLE &&
- gimp_blend_tool_editor_is_gradient_editable (blend_tool))
+ gimp_gradient_tool_editor_is_gradient_editable (gradient_tool))
{
gint stop;
- stop = gimp_blend_tool_editor_midpoint_to_stop (blend_tool, handle);
+ stop = gimp_gradient_tool_editor_midpoint_to_stop (gradient_tool, handle);
gimp_tool_line_set_selection (line, stop);
@@ -373,31 +373,31 @@ gimp_blend_tool_editor_line_handle_clicked (GimpToolLine *line,
static void
-gimp_blend_tool_editor_gui_response (GimpToolGui *gui,
- gint response_id,
- GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_gui_response (GimpToolGui *gui,
+ gint response_id,
+ GimpGradientTool *gradient_tool)
{
switch (response_id)
{
default:
- gimp_tool_line_set_selection (GIMP_TOOL_LINE (blend_tool->widget),
+ gimp_tool_line_set_selection (GIMP_TOOL_LINE (gradient_tool->widget),
GIMP_TOOL_LINE_HANDLE_NONE);
break;
}
}
static void
-gimp_blend_tool_editor_color_entry_color_clicked (GimpColorButton *button,
- GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_color_entry_color_clicked (GimpColorButton *button,
+ GimpGradientTool *gradient_tool)
{
- gimp_blend_tool_editor_start_edit (blend_tool);
+ gimp_gradient_tool_editor_start_edit (gradient_tool);
}
static void
-gimp_blend_tool_editor_color_entry_color_changed (GimpColorButton *button,
- GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_color_entry_color_changed (GimpColorButton *button,
+ GimpGradientTool *gradient_tool)
{
- GimpBlendOptions *options = GIMP_BLEND_TOOL_GET_OPTIONS (blend_tool);
+ GimpGradientOptions *options = GIMP_GRADIENT_TOOL_GET_OPTIONS (gradient_tool);
GimpPaintOptions *paint_options = GIMP_PAINT_OPTIONS (options);
gint selection;
GimpRGB color;
@@ -405,22 +405,22 @@ gimp_blend_tool_editor_color_entry_color_changed (GimpColorButton *button,
GtkWidget *chain_button;
GimpGradientSegment *seg;
- if (gimp_blend_tool_editor_are_handlers_blocked (blend_tool))
+ if (gimp_gradient_tool_editor_are_handlers_blocked (gradient_tool))
return;
selection =
- gimp_tool_line_get_selection (GIMP_TOOL_LINE (blend_tool->widget));
+ gimp_tool_line_get_selection (GIMP_TOOL_LINE (gradient_tool->widget));
gimp_color_button_get_color (button, &color);
direction =
GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button),
- "gimp-blend-tool-editor-direction"));
+ "gimp-gradient-tool-editor-direction"));
chain_button = g_object_get_data (G_OBJECT (button),
- "gimp-blend-tool-editor-chain-button");
+ "gimp-gradient-tool-editor-chain-button");
- gimp_blend_tool_editor_start_edit (blend_tool);
- gimp_blend_tool_editor_freeze_gradient (blend_tool);
+ gimp_gradient_tool_editor_start_edit (gradient_tool);
+ gimp_gradient_tool_editor_freeze_gradient (gradient_tool);
/* swap the endpoint handles, if necessary */
if (paint_options->gradient_options->gradient_reverse)
@@ -437,7 +437,7 @@ gimp_blend_tool_editor_color_entry_color_changed (GimpColorButton *button,
}
}
- seg = gimp_blend_tool_editor_handle_get_segment (blend_tool, selection);
+ seg = gimp_gradient_tool_editor_handle_get_segment (gradient_tool, selection);
switch (selection)
{
@@ -469,23 +469,23 @@ gimp_blend_tool_editor_color_entry_color_changed (GimpColorButton *button,
}
}
- gimp_blend_tool_editor_thaw_gradient (blend_tool);
- gimp_blend_tool_editor_end_edit (blend_tool, FALSE);
+ gimp_gradient_tool_editor_thaw_gradient (gradient_tool);
+ gimp_gradient_tool_editor_end_edit (gradient_tool, FALSE);
}
static void
-gimp_blend_tool_editor_color_entry_color_response (GimpColorButton *button,
- GimpColorDialogState state,
- GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_color_entry_color_response (GimpColorButton *button,
+ GimpColorDialogState state,
+ GimpGradientTool *gradient_tool)
{
- gimp_blend_tool_editor_end_edit (blend_tool, FALSE);
+ gimp_gradient_tool_editor_end_edit (gradient_tool, FALSE);
}
static void
-gimp_blend_tool_editor_color_entry_type_changed (GtkComboBox *combo,
- GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_color_entry_type_changed (GtkComboBox *combo,
+ GimpGradientTool *gradient_tool)
{
- GimpBlendOptions *options = GIMP_BLEND_TOOL_GET_OPTIONS (blend_tool);
+ GimpGradientOptions *options = GIMP_GRADIENT_TOOL_GET_OPTIONS (gradient_tool);
GimpPaintOptions *paint_options = GIMP_PAINT_OPTIONS (options);
gint selection;
gint color_type;
@@ -493,23 +493,23 @@ gimp_blend_tool_editor_color_entry_type_changed (GtkComboBox *combo,
GtkWidget *chain_button;
GimpGradientSegment *seg;
- if (gimp_blend_tool_editor_are_handlers_blocked (blend_tool))
+ if (gimp_gradient_tool_editor_are_handlers_blocked (gradient_tool))
return;
selection =
- gimp_tool_line_get_selection (GIMP_TOOL_LINE (blend_tool->widget));
+ gimp_tool_line_get_selection (GIMP_TOOL_LINE (gradient_tool->widget));
if (! gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (combo), &color_type))
return;
direction =
GPOINTER_TO_INT (g_object_get_data (G_OBJECT (combo),
- "gimp-blend-tool-editor-direction"));
+ "gimp-gradient-tool-editor-direction"));
chain_button = g_object_get_data (G_OBJECT (combo),
- "gimp-blend-tool-editor-chain-button");
+ "gimp-gradient-tool-editor-chain-button");
- gimp_blend_tool_editor_start_edit (blend_tool);
- gimp_blend_tool_editor_freeze_gradient (blend_tool);
+ gimp_gradient_tool_editor_start_edit (gradient_tool);
+ gimp_gradient_tool_editor_freeze_gradient (gradient_tool);
/* swap the endpoint handles, if necessary */
if (paint_options->gradient_options->gradient_reverse)
@@ -526,7 +526,7 @@ gimp_blend_tool_editor_color_entry_type_changed (GtkComboBox *combo,
}
}
- seg = gimp_blend_tool_editor_handle_get_segment (blend_tool, selection);
+ seg = gimp_gradient_tool_editor_handle_get_segment (gradient_tool, selection);
switch (selection)
{
@@ -554,41 +554,41 @@ gimp_blend_tool_editor_color_entry_type_changed (GtkComboBox *combo,
}
}
- gimp_blend_tool_editor_thaw_gradient (blend_tool);
- gimp_blend_tool_editor_end_edit (blend_tool, FALSE);
+ gimp_gradient_tool_editor_thaw_gradient (gradient_tool);
+ gimp_gradient_tool_editor_end_edit (gradient_tool, FALSE);
}
static void
-gimp_blend_tool_editor_endpoint_se_value_changed (GimpSizeEntry *se,
- GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_endpoint_se_value_changed (GimpSizeEntry *se,
+ GimpGradientTool *gradient_tool)
{
gint selection;
gdouble x;
gdouble y;
- if (gimp_blend_tool_editor_are_handlers_blocked (blend_tool))
+ if (gimp_gradient_tool_editor_are_handlers_blocked (gradient_tool))
return;
selection =
- gimp_tool_line_get_selection (GIMP_TOOL_LINE (blend_tool->widget));
+ gimp_tool_line_get_selection (GIMP_TOOL_LINE (gradient_tool->widget));
x = gimp_size_entry_get_refval (se, 0);
y = gimp_size_entry_get_refval (se, 1);
- gimp_blend_tool_editor_start_edit (blend_tool);
- gimp_blend_tool_editor_block_handlers (blend_tool);
+ gimp_gradient_tool_editor_start_edit (gradient_tool);
+ gimp_gradient_tool_editor_block_handlers (gradient_tool);
switch (selection)
{
case GIMP_TOOL_LINE_HANDLE_START:
- g_object_set (blend_tool->widget,
+ g_object_set (gradient_tool->widget,
"x1", x,
"y1", y,
NULL);
break;
case GIMP_TOOL_LINE_HANDLE_END:
- g_object_set (blend_tool->widget,
+ g_object_set (gradient_tool->widget,
"x2", x,
"y2", y,
NULL);
@@ -598,241 +598,241 @@ gimp_blend_tool_editor_endpoint_se_value_changed (GimpSizeEntry *se,
gimp_assert_not_reached ();
}
- gimp_blend_tool_editor_unblock_handlers (blend_tool);
- gimp_blend_tool_editor_end_edit (blend_tool, FALSE);
+ gimp_gradient_tool_editor_unblock_handlers (gradient_tool);
+ gimp_gradient_tool_editor_end_edit (gradient_tool, FALSE);
}
static void
-gimp_blend_tool_editor_stop_se_value_changed (GimpSizeEntry *se,
- GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_stop_se_value_changed (GimpSizeEntry *se,
+ GimpGradientTool *gradient_tool)
{
gint selection;
gdouble value;
GimpGradientSegment *seg;
- if (gimp_blend_tool_editor_are_handlers_blocked (blend_tool))
+ if (gimp_gradient_tool_editor_are_handlers_blocked (gradient_tool))
return;
selection =
- gimp_tool_line_get_selection (GIMP_TOOL_LINE (blend_tool->widget));
+ gimp_tool_line_get_selection (GIMP_TOOL_LINE (gradient_tool->widget));
if (selection == GIMP_TOOL_LINE_HANDLE_NONE)
return;
value = gimp_size_entry_get_refval (se, 0) / 100.0;
- gimp_blend_tool_editor_start_edit (blend_tool);
- gimp_blend_tool_editor_freeze_gradient (blend_tool);
+ gimp_gradient_tool_editor_start_edit (gradient_tool);
+ gimp_gradient_tool_editor_freeze_gradient (gradient_tool);
- seg = gimp_blend_tool_editor_handle_get_segment (blend_tool, selection);
+ seg = gimp_gradient_tool_editor_handle_get_segment (gradient_tool, selection);
- gimp_gradient_segment_range_compress (blend_tool->gradient,
+ gimp_gradient_segment_range_compress (gradient_tool->gradient,
seg, seg,
seg->left, value);
- gimp_gradient_segment_range_compress (blend_tool->gradient,
+ gimp_gradient_segment_range_compress (gradient_tool->gradient,
seg->next, seg->next,
value, seg->next->right);
- gimp_blend_tool_editor_thaw_gradient (blend_tool);
- gimp_blend_tool_editor_end_edit (blend_tool, FALSE);
+ gimp_gradient_tool_editor_thaw_gradient (gradient_tool);
+ gimp_gradient_tool_editor_end_edit (gradient_tool, FALSE);
}
static void
-gimp_blend_tool_editor_stop_delete_clicked (GtkWidget *button,
- GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_stop_delete_clicked (GtkWidget *button,
+ GimpGradientTool *gradient_tool)
{
gint selection;
selection =
- gimp_tool_line_get_selection (GIMP_TOOL_LINE (blend_tool->widget));
+ gimp_tool_line_get_selection (GIMP_TOOL_LINE (gradient_tool->widget));
- gimp_blend_tool_editor_delete_stop (blend_tool, selection);
+ gimp_gradient_tool_editor_delete_stop (gradient_tool, selection);
}
static void
-gimp_blend_tool_editor_midpoint_se_value_changed (GimpSizeEntry *se,
- GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_midpoint_se_value_changed (GimpSizeEntry *se,
+ GimpGradientTool *gradient_tool)
{
gint selection;
gdouble value;
GimpGradientSegment *seg;
- if (gimp_blend_tool_editor_are_handlers_blocked (blend_tool))
+ if (gimp_gradient_tool_editor_are_handlers_blocked (gradient_tool))
return;
selection =
- gimp_tool_line_get_selection (GIMP_TOOL_LINE (blend_tool->widget));
+ gimp_tool_line_get_selection (GIMP_TOOL_LINE (gradient_tool->widget));
if (selection == GIMP_TOOL_LINE_HANDLE_NONE)
return;
value = gimp_size_entry_get_refval (se, 0) / 100.0;
- gimp_blend_tool_editor_start_edit (blend_tool);
- gimp_blend_tool_editor_freeze_gradient (blend_tool);
+ gimp_gradient_tool_editor_start_edit (gradient_tool);
+ gimp_gradient_tool_editor_freeze_gradient (gradient_tool);
- seg = gimp_blend_tool_editor_handle_get_segment (blend_tool, selection);
+ seg = gimp_gradient_tool_editor_handle_get_segment (gradient_tool, selection);
seg->middle = value;
- gimp_blend_tool_editor_thaw_gradient (blend_tool);
- gimp_blend_tool_editor_end_edit (blend_tool, FALSE);
+ gimp_gradient_tool_editor_thaw_gradient (gradient_tool);
+ gimp_gradient_tool_editor_end_edit (gradient_tool, FALSE);
}
static void
-gimp_blend_tool_editor_midpoint_type_changed (GtkComboBox *combo,
- GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_midpoint_type_changed (GtkComboBox *combo,
+ GimpGradientTool *gradient_tool)
{
gint selection;
gint type;
GimpGradientSegment *seg;
- if (gimp_blend_tool_editor_are_handlers_blocked (blend_tool))
+ if (gimp_gradient_tool_editor_are_handlers_blocked (gradient_tool))
return;
selection =
- gimp_tool_line_get_selection (GIMP_TOOL_LINE (blend_tool->widget));
+ gimp_tool_line_get_selection (GIMP_TOOL_LINE (gradient_tool->widget));
if (! gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (combo), &type))
return;
- gimp_blend_tool_editor_start_edit (blend_tool);
- gimp_blend_tool_editor_freeze_gradient (blend_tool);
+ gimp_gradient_tool_editor_start_edit (gradient_tool);
+ gimp_gradient_tool_editor_freeze_gradient (gradient_tool);
- seg = gimp_blend_tool_editor_handle_get_segment (blend_tool, selection);
+ seg = gimp_gradient_tool_editor_handle_get_segment (gradient_tool, selection);
seg->type = type;
- gimp_blend_tool_editor_thaw_gradient (blend_tool);
- gimp_blend_tool_editor_end_edit (blend_tool, FALSE);
+ gimp_gradient_tool_editor_thaw_gradient (gradient_tool);
+ gimp_gradient_tool_editor_end_edit (gradient_tool, FALSE);
}
static void
-gimp_blend_tool_editor_midpoint_color_changed (GtkComboBox *combo,
- GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_midpoint_color_changed (GtkComboBox *combo,
+ GimpGradientTool *gradient_tool)
{
gint selection;
gint color;
GimpGradientSegment *seg;
- if (gimp_blend_tool_editor_are_handlers_blocked (blend_tool))
+ if (gimp_gradient_tool_editor_are_handlers_blocked (gradient_tool))
return;
selection =
- gimp_tool_line_get_selection (GIMP_TOOL_LINE (blend_tool->widget));
+ gimp_tool_line_get_selection (GIMP_TOOL_LINE (gradient_tool->widget));
if (! gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (combo), &color))
return;
- gimp_blend_tool_editor_start_edit (blend_tool);
- gimp_blend_tool_editor_freeze_gradient (blend_tool);
+ gimp_gradient_tool_editor_start_edit (gradient_tool);
+ gimp_gradient_tool_editor_freeze_gradient (gradient_tool);
- seg = gimp_blend_tool_editor_handle_get_segment (blend_tool, selection);
+ seg = gimp_gradient_tool_editor_handle_get_segment (gradient_tool, selection);
seg->color = color;
- gimp_blend_tool_editor_thaw_gradient (blend_tool);
- gimp_blend_tool_editor_end_edit (blend_tool, FALSE);
+ gimp_gradient_tool_editor_thaw_gradient (gradient_tool);
+ gimp_gradient_tool_editor_end_edit (gradient_tool, FALSE);
}
static void
-gimp_blend_tool_editor_midpoint_new_stop_clicked (GtkWidget *button,
- GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_midpoint_new_stop_clicked (GtkWidget *button,
+ GimpGradientTool *gradient_tool)
{
gint selection;
gint stop;
selection =
- gimp_tool_line_get_selection (GIMP_TOOL_LINE (blend_tool->widget));
+ gimp_tool_line_get_selection (GIMP_TOOL_LINE (gradient_tool->widget));
- stop = gimp_blend_tool_editor_midpoint_to_stop (blend_tool, selection);
+ stop = gimp_gradient_tool_editor_midpoint_to_stop (gradient_tool, selection);
- gimp_tool_line_set_selection (GIMP_TOOL_LINE (blend_tool->widget), stop);
+ gimp_tool_line_set_selection (GIMP_TOOL_LINE (gradient_tool->widget), stop);
}
static void
-gimp_blend_tool_editor_midpoint_center_clicked (GtkWidget *button,
- GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_midpoint_center_clicked (GtkWidget *button,
+ GimpGradientTool *gradient_tool)
{
gint selection;
GimpGradientSegment *seg;
selection =
- gimp_tool_line_get_selection (GIMP_TOOL_LINE (blend_tool->widget));
+ gimp_tool_line_get_selection (GIMP_TOOL_LINE (gradient_tool->widget));
- gimp_blend_tool_editor_start_edit (blend_tool);
- gimp_blend_tool_editor_freeze_gradient (blend_tool);
+ gimp_gradient_tool_editor_start_edit (gradient_tool);
+ gimp_gradient_tool_editor_freeze_gradient (gradient_tool);
- seg = gimp_blend_tool_editor_handle_get_segment (blend_tool, selection);
+ seg = gimp_gradient_tool_editor_handle_get_segment (gradient_tool, selection);
- gimp_gradient_segment_range_recenter_handles (blend_tool->gradient, seg, seg);
+ gimp_gradient_segment_range_recenter_handles (gradient_tool->gradient, seg, seg);
- gimp_blend_tool_editor_thaw_gradient (blend_tool);
- gimp_blend_tool_editor_end_edit (blend_tool, FALSE);
+ gimp_gradient_tool_editor_thaw_gradient (gradient_tool);
+ gimp_gradient_tool_editor_end_edit (gradient_tool, FALSE);
}
static gboolean
-gimp_blend_tool_editor_flush_idle (GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_flush_idle (GimpGradientTool *gradient_tool)
{
- GimpDisplay *display = GIMP_TOOL (blend_tool)->display;
+ GimpDisplay *display = GIMP_TOOL (gradient_tool)->display;
gimp_image_flush (gimp_display_get_image (display));
- blend_tool->flush_idle_id = 0;
+ gradient_tool->flush_idle_id = 0;
return G_SOURCE_REMOVE;
}
static gboolean
-gimp_blend_tool_editor_is_gradient_editable (GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_is_gradient_editable (GimpGradientTool *gradient_tool)
{
- GimpBlendOptions *options = GIMP_BLEND_TOOL_GET_OPTIONS (blend_tool);
+ GimpGradientOptions *options = GIMP_GRADIENT_TOOL_GET_OPTIONS (gradient_tool);
return ! options->modify_active ||
- gimp_data_is_writable (GIMP_DATA (blend_tool->gradient));
+ gimp_data_is_writable (GIMP_DATA (gradient_tool->gradient));
}
static gboolean
-gimp_blend_tool_editor_handle_is_endpoint (GimpBlendTool *blend_tool,
- gint handle)
+gimp_gradient_tool_editor_handle_is_endpoint (GimpGradientTool *gradient_tool,
+ gint handle)
{
return handle == GIMP_TOOL_LINE_HANDLE_START ||
handle == GIMP_TOOL_LINE_HANDLE_END;
}
static gboolean
-gimp_blend_tool_editor_handle_is_stop (GimpBlendTool *blend_tool,
- gint handle)
+gimp_gradient_tool_editor_handle_is_stop (GimpGradientTool *gradient_tool,
+ gint handle)
{
gint n_sliders;
- gimp_tool_line_get_sliders (GIMP_TOOL_LINE (blend_tool->widget), &n_sliders);
+ gimp_tool_line_get_sliders (GIMP_TOOL_LINE (gradient_tool->widget), &n_sliders);
return handle >= 0 && handle < n_sliders / 2;
}
static gboolean
-gimp_blend_tool_editor_handle_is_midpoint (GimpBlendTool *blend_tool,
- gint handle)
+gimp_gradient_tool_editor_handle_is_midpoint (GimpGradientTool *gradient_tool,
+ gint handle)
{
gint n_sliders;
- gimp_tool_line_get_sliders (GIMP_TOOL_LINE (blend_tool->widget), &n_sliders);
+ gimp_tool_line_get_sliders (GIMP_TOOL_LINE (gradient_tool->widget), &n_sliders);
return handle >= n_sliders / 2;
}
static GimpGradientSegment *
-gimp_blend_tool_editor_handle_get_segment (GimpBlendTool *blend_tool,
- gint handle)
+gimp_gradient_tool_editor_handle_get_segment (GimpGradientTool *gradient_tool,
+ gint handle)
{
switch (handle)
{
case GIMP_TOOL_LINE_HANDLE_START:
- return blend_tool->gradient->segments;
+ return gradient_tool->gradient->segments;
case GIMP_TOOL_LINE_HANDLE_END:
- return gimp_gradient_segment_get_last (blend_tool->gradient->segments);
+ return gimp_gradient_segment_get_last (gradient_tool->gradient->segments);
default:
{
@@ -840,55 +840,55 @@ gimp_blend_tool_editor_handle_get_segment (GimpBlendTool *blend_tool,
gint n_sliders;
gint seg_i;
- sliders = gimp_tool_line_get_sliders (GIMP_TOOL_LINE (blend_tool->widget),
+ sliders = gimp_tool_line_get_sliders (GIMP_TOOL_LINE (gradient_tool->widget),
&n_sliders);
gimp_assert (handle >= 0 && handle < n_sliders);
seg_i = GPOINTER_TO_INT (sliders[handle].data);
- return gimp_gradient_segment_get_nth (blend_tool->gradient->segments,
+ return gimp_gradient_segment_get_nth (gradient_tool->gradient->segments,
seg_i);
}
}
}
static void
-gimp_blend_tool_editor_block_handlers (GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_block_handlers (GimpGradientTool *gradient_tool)
{
- blend_tool->block_handlers_count++;
+ gradient_tool->block_handlers_count++;
}
static void
-gimp_blend_tool_editor_unblock_handlers (GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_unblock_handlers (GimpGradientTool *gradient_tool)
{
- gimp_assert (blend_tool->block_handlers_count > 0);
+ gimp_assert (gradient_tool->block_handlers_count > 0);
- blend_tool->block_handlers_count--;
+ gradient_tool->block_handlers_count--;
}
static gboolean
-gimp_blend_tool_editor_are_handlers_blocked (GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_are_handlers_blocked (GimpGradientTool *gradient_tool)
{
- return blend_tool->block_handlers_count > 0;
+ return gradient_tool->block_handlers_count > 0;
}
static void
-gimp_blend_tool_editor_freeze_gradient (GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_freeze_gradient (GimpGradientTool *gradient_tool)
{
- GimpBlendOptions *options = GIMP_BLEND_TOOL_GET_OPTIONS (blend_tool);
- GimpGradient *custom;
- BlendInfo *info;
+ GimpGradientOptions *options = GIMP_GRADIENT_TOOL_GET_OPTIONS (gradient_tool);
+ GimpGradient *custom;
+ GradientInfo *info;
- gimp_blend_tool_editor_block_handlers (blend_tool);
+ gimp_gradient_tool_editor_block_handlers (gradient_tool);
custom = gimp_gradients_get_custom (GIMP_CONTEXT (options)->gimp);
- if (blend_tool->gradient == custom || options->modify_active)
+ if (gradient_tool->gradient == custom || options->modify_active)
{
- gimp_assert (gimp_blend_tool_editor_is_gradient_editable (blend_tool));
+ gimp_assert (gimp_gradient_tool_editor_is_gradient_editable (gradient_tool));
- gimp_data_freeze (GIMP_DATA (blend_tool->gradient));
+ gimp_data_freeze (GIMP_DATA (gradient_tool->gradient));
}
else
{
@@ -897,81 +897,81 @@ gimp_blend_tool_editor_freeze_gradient (GimpBlendTool *blend_tool)
*/
gimp_data_freeze (GIMP_DATA (custom));
- gimp_data_copy (GIMP_DATA (custom), GIMP_DATA (blend_tool->gradient));
+ gimp_data_copy (GIMP_DATA (custom), GIMP_DATA (gradient_tool->gradient));
gimp_context_set_gradient (GIMP_CONTEXT (options), custom);
- gimp_assert (blend_tool->gradient == custom);
- gimp_assert (gimp_blend_tool_editor_is_gradient_editable (blend_tool));
+ gimp_assert (gradient_tool->gradient == custom);
+ gimp_assert (gimp_gradient_tool_editor_is_gradient_editable (gradient_tool));
}
- if (blend_tool->edit_count > 0)
+ if (gradient_tool->edit_count > 0)
{
- info = blend_tool->undo_stack->data;
+ info = gradient_tool->undo_stack->data;
if (! info->gradient)
{
info->gradient =
- GIMP_GRADIENT (gimp_data_duplicate (GIMP_DATA (blend_tool->gradient)));
+ GIMP_GRADIENT (gimp_data_duplicate (GIMP_DATA (gradient_tool->gradient)));
}
}
}
static void
-gimp_blend_tool_editor_thaw_gradient(GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_thaw_gradient (GimpGradientTool *gradient_tool)
{
- gimp_data_thaw (GIMP_DATA (blend_tool->gradient));
+ gimp_data_thaw (GIMP_DATA (gradient_tool->gradient));
- gimp_blend_tool_editor_update_sliders (blend_tool);
- gimp_blend_tool_editor_update_gui (blend_tool);
+ gimp_gradient_tool_editor_update_sliders (gradient_tool);
+ gimp_gradient_tool_editor_update_gui (gradient_tool);
- gimp_blend_tool_editor_unblock_handlers (blend_tool);
+ gimp_gradient_tool_editor_unblock_handlers (gradient_tool);
}
static gint
-gimp_blend_tool_editor_add_stop (GimpBlendTool *blend_tool,
- gdouble value)
+gimp_gradient_tool_editor_add_stop (GimpGradientTool *gradient_tool,
+ gdouble value)
{
- GimpBlendOptions *options = GIMP_BLEND_TOOL_GET_OPTIONS (blend_tool);
+ GimpGradientOptions *options = GIMP_GRADIENT_TOOL_GET_OPTIONS (gradient_tool);
GimpPaintOptions *paint_options = GIMP_PAINT_OPTIONS (options);
GimpGradientSegment *seg;
gint stop;
- BlendInfo *info;
+ GradientInfo *info;
- gimp_blend_tool_editor_start_edit (blend_tool);
- gimp_blend_tool_editor_freeze_gradient (blend_tool);
+ gimp_gradient_tool_editor_start_edit (gradient_tool);
+ gimp_gradient_tool_editor_freeze_gradient (gradient_tool);
- gimp_gradient_split_at (blend_tool->gradient,
+ gimp_gradient_split_at (gradient_tool->gradient,
GIMP_CONTEXT (options), NULL, value,
paint_options->gradient_options->gradient_blend_color_space,
&seg, NULL);
stop =
- gimp_gradient_segment_range_get_n_segments (blend_tool->gradient,
- blend_tool->gradient->segments,
+ gimp_gradient_segment_range_get_n_segments (gradient_tool->gradient,
+ gradient_tool->gradient->segments,
seg) - 1;
- info = blend_tool->undo_stack->data;
+ info = gradient_tool->undo_stack->data;
info->added_handle = stop;
- gimp_blend_tool_editor_thaw_gradient (blend_tool);
- gimp_blend_tool_editor_end_edit (blend_tool, FALSE);
+ gimp_gradient_tool_editor_thaw_gradient (gradient_tool);
+ gimp_gradient_tool_editor_end_edit (gradient_tool, FALSE);
return stop;
}
static void
-gimp_blend_tool_editor_delete_stop (GimpBlendTool *blend_tool,
- gint slider)
+gimp_gradient_tool_editor_delete_stop (GimpGradientTool *gradient_tool,
+ gint slider)
{
- BlendInfo *info;
+ GradientInfo *info;
- gimp_assert (gimp_blend_tool_editor_handle_is_stop (blend_tool, slider));
+ gimp_assert (gimp_gradient_tool_editor_handle_is_stop (gradient_tool, slider));
- gimp_blend_tool_editor_start_edit (blend_tool);
- gimp_blend_tool_editor_freeze_gradient (blend_tool);
+ gimp_gradient_tool_editor_start_edit (gradient_tool);
+ gimp_gradient_tool_editor_freeze_gradient (gradient_tool);
- info = blend_tool->undo_stack->data;
+ info = gradient_tool->undo_stack->data;
if (info->added_handle == slider)
{
@@ -987,7 +987,7 @@ gimp_blend_tool_editor_delete_stop (GimpBlendTool *blend_tool,
gimp_assert (info->gradient != NULL);
- gimp_data_copy (GIMP_DATA (blend_tool->gradient),
+ gimp_data_copy (GIMP_DATA (gradient_tool->gradient),
GIMP_DATA (info->gradient));
g_clear_object (&info->gradient);
@@ -998,27 +998,27 @@ gimp_blend_tool_editor_delete_stop (GimpBlendTool *blend_tool,
{
GimpGradientSegment *seg;
- seg = gimp_blend_tool_editor_handle_get_segment (blend_tool, slider);
+ seg = gimp_gradient_tool_editor_handle_get_segment (gradient_tool, slider);
- gimp_gradient_segment_range_merge (blend_tool->gradient,
+ gimp_gradient_segment_range_merge (gradient_tool->gradient,
seg, seg->next, NULL, NULL);
info->removed_handle = slider;
}
- gimp_blend_tool_editor_thaw_gradient (blend_tool);
- gimp_blend_tool_editor_end_edit (blend_tool, FALSE);
+ gimp_gradient_tool_editor_thaw_gradient (gradient_tool);
+ gimp_gradient_tool_editor_end_edit (gradient_tool, FALSE);
}
static gint
-gimp_blend_tool_editor_midpoint_to_stop (GimpBlendTool *blend_tool,
- gint slider)
+gimp_gradient_tool_editor_midpoint_to_stop (GimpGradientTool *gradient_tool,
+ gint slider)
{
const GimpControllerSlider *sliders;
- gimp_assert (gimp_blend_tool_editor_handle_is_midpoint (blend_tool, slider));
+ gimp_assert (gimp_gradient_tool_editor_handle_is_midpoint (gradient_tool, slider));
- sliders = gimp_tool_line_get_sliders (GIMP_TOOL_LINE (blend_tool->widget),
+ sliders = gimp_tool_line_get_sliders (GIMP_TOOL_LINE (gradient_tool->widget),
NULL);
if (sliders[slider].value > sliders[slider].min + EPSILON &&
@@ -1026,13 +1026,13 @@ gimp_blend_tool_editor_midpoint_to_stop (GimpBlendTool *blend_tool,
{
const GimpGradientSegment *seg;
gint stop;
- BlendInfo *info;
+ GradientInfo *info;
- seg = gimp_blend_tool_editor_handle_get_segment (blend_tool, slider);
+ seg = gimp_gradient_tool_editor_handle_get_segment (gradient_tool, slider);
- stop = gimp_blend_tool_editor_add_stop (blend_tool, seg->middle);
+ stop = gimp_gradient_tool_editor_add_stop (gradient_tool, seg->middle);
- info = blend_tool->undo_stack->data;
+ info = gradient_tool->undo_stack->data;
info->removed_handle = slider;
slider = stop;
@@ -1042,9 +1042,9 @@ gimp_blend_tool_editor_midpoint_to_stop (GimpBlendTool *blend_tool,
}
static void
-gimp_blend_tool_editor_update_sliders (GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_update_sliders (GimpGradientTool *gradient_tool)
{
- GimpBlendOptions *options = GIMP_BLEND_TOOL_GET_OPTIONS (blend_tool);
+ GimpGradientOptions *options = GIMP_GRADIENT_TOOL_GET_OPTIONS (gradient_tool);
GimpPaintOptions *paint_options = GIMP_PAINT_OPTIONS (options);
gdouble offset = options->offset / 100.0;
gboolean editable;
@@ -1055,13 +1055,13 @@ gimp_blend_tool_editor_update_sliders (GimpBlendTool *blend_tool)
GimpControllerSlider *slider;
gint i;
- if (! blend_tool->widget || options->instant)
+ if (! gradient_tool->widget || options->instant)
return;
- editable = gimp_blend_tool_editor_is_gradient_editable (blend_tool);
+ editable = gimp_gradient_tool_editor_is_gradient_editable (gradient_tool);
n_segments = gimp_gradient_segment_range_get_n_segments (
- blend_tool->gradient, blend_tool->gradient->segments, NULL);
+ gradient_tool->gradient, gradient_tool->gradient->segments, NULL);
n_sliders = (n_segments - 1) + /* gradient stops, between each adjacent
* pair of segments */
@@ -1072,7 +1072,7 @@ gimp_blend_tool_editor_update_sliders (GimpBlendTool *blend_tool)
slider = sliders;
/* initialize the gradient-stop sliders */
- for (seg = blend_tool->gradient->segments, i = 0;
+ for (seg = gradient_tool->gradient->segments, i = 0;
seg->next;
seg = seg->next, i++)
{
@@ -1091,7 +1091,7 @@ gimp_blend_tool_editor_update_sliders (GimpBlendTool *blend_tool)
}
/* initialize the midpoint sliders */
- for (seg = blend_tool->gradient->segments, i = 0;
+ for (seg = gradient_tool->gradient->segments, i = 0;
seg;
seg = seg->next, i++)
{
@@ -1138,30 +1138,30 @@ gimp_blend_tool_editor_update_sliders (GimpBlendTool *blend_tool)
sliders[i].max = (1.0 - offset) * sliders[i].max + offset;
}
- /* avoid updating the gradient in gimp_blend_tool_editor_line_changed() */
- gimp_blend_tool_editor_block_handlers (blend_tool);
+ /* avoid updating the gradient in gimp_gradient_tool_editor_line_changed() */
+ gimp_gradient_tool_editor_block_handlers (gradient_tool);
- gimp_tool_line_set_sliders (GIMP_TOOL_LINE (blend_tool->widget),
+ gimp_tool_line_set_sliders (GIMP_TOOL_LINE (gradient_tool->widget),
sliders, n_sliders);
- gimp_blend_tool_editor_unblock_handlers (blend_tool);
+ gimp_gradient_tool_editor_unblock_handlers (gradient_tool);
g_free (sliders);
}
static void
-gimp_blend_tool_editor_purge_gradient_history (GSList **stack)
+gimp_gradient_tool_editor_purge_gradient_history (GSList **stack)
{
GSList *link;
/* eliminate all history steps that modify the gradient */
while ((link = *stack))
{
- BlendInfo *info = link->data;
+ GradientInfo *info = link->data;
if (info->gradient)
{
- gimp_blend_tool_editor_blend_info_free (info);
+ gimp_gradient_tool_editor_gradient_info_free (info);
*stack = g_slist_delete_link (*stack, link);
}
@@ -1173,29 +1173,29 @@ gimp_blend_tool_editor_purge_gradient_history (GSList **stack)
}
static void
-gimp_blend_tool_editor_purge_gradient (GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_purge_gradient (GimpGradientTool *gradient_tool)
{
- if (blend_tool->widget)
+ if (gradient_tool->widget)
{
- gimp_blend_tool_editor_update_sliders (blend_tool);
+ gimp_gradient_tool_editor_update_sliders (gradient_tool);
- gimp_tool_line_set_selection (GIMP_TOOL_LINE (blend_tool->widget),
+ gimp_tool_line_set_selection (GIMP_TOOL_LINE (gradient_tool->widget),
GIMP_TOOL_LINE_HANDLE_NONE);
}
- gimp_blend_tool_editor_purge_gradient_history (&blend_tool->undo_stack);
- gimp_blend_tool_editor_purge_gradient_history (&blend_tool->redo_stack);
+ gimp_gradient_tool_editor_purge_gradient_history (&gradient_tool->undo_stack);
+ gimp_gradient_tool_editor_purge_gradient_history (&gradient_tool->redo_stack);
}
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)
+gimp_gradient_tool_editor_color_entry_new (GimpGradientTool *gradient_tool,
+ const gchar *title,
+ Direction direction,
+ GtkWidget *chain_button,
+ GtkWidget **color_panel,
+ GtkWidget **type_combo)
{
- GimpContext *context = GIMP_CONTEXT (GIMP_BLEND_TOOL_GET_OPTIONS (blend_tool));
+ GimpContext *context = GIMP_CONTEXT (GIMP_GRADIENT_TOOL_GET_OPTIONS (gradient_tool));
GtkWidget *hbox;
GtkWidget *button;
GtkWidget *combo;
@@ -1213,21 +1213,21 @@ gimp_blend_tool_editor_color_entry_new (GimpBlendTool *blend_tool,
gtk_widget_show (button);
g_object_set_data (G_OBJECT (button),
- "gimp-blend-tool-editor-direction",
+ "gimp-gradient-tool-editor-direction",
GINT_TO_POINTER (direction));
g_object_set_data (G_OBJECT (button),
- "gimp-blend-tool-editor-chain-button",
+ "gimp-gradient-tool-editor-chain-button",
chain_button);
g_signal_connect (button, "clicked",
- G_CALLBACK (gimp_blend_tool_editor_color_entry_color_clicked),
- blend_tool);
+ G_CALLBACK (gimp_gradient_tool_editor_color_entry_color_clicked),
+ gradient_tool);
g_signal_connect (button, "color-changed",
- G_CALLBACK (gimp_blend_tool_editor_color_entry_color_changed),
- blend_tool);
+ G_CALLBACK (gimp_gradient_tool_editor_color_entry_color_changed),
+ gradient_tool);
g_signal_connect (button, "response",
- G_CALLBACK (gimp_blend_tool_editor_color_entry_color_response),
- blend_tool);
+ G_CALLBACK (gimp_gradient_tool_editor_color_entry_color_response),
+ gradient_tool);
/* the color type combo */
*type_combo = combo = gimp_enum_combo_box_new (GIMP_TYPE_GRADIENT_COLOR);
@@ -1235,23 +1235,23 @@ gimp_blend_tool_editor_color_entry_new (GimpBlendTool *blend_tool,
gtk_widget_show (combo);
g_object_set_data (G_OBJECT (combo),
- "gimp-blend-tool-editor-direction",
+ "gimp-gradient-tool-editor-direction",
GINT_TO_POINTER (direction));
g_object_set_data (G_OBJECT (combo),
- "gimp-blend-tool-editor-chain-button",
+ "gimp-gradient-tool-editor-chain-button",
chain_button);
g_signal_connect (combo, "changed",
- G_CALLBACK (gimp_blend_tool_editor_color_entry_type_changed),
- blend_tool);
+ G_CALLBACK (gimp_gradient_tool_editor_color_entry_type_changed),
+ gradient_tool);
return hbox;
}
static void
-gimp_blend_tool_editor_init_endpoint_gui (GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_init_endpoint_gui (GimpGradientTool *gradient_tool)
{
- GimpDisplay *display = GIMP_TOOL (blend_tool)->display;
+ GimpDisplay *display = GIMP_TOOL (gradient_tool)->display;
GimpDisplayShell *shell = gimp_display_get_shell (display);
GimpImage *image = gimp_display_get_image (display);
gdouble xres;
@@ -1267,9 +1267,9 @@ gimp_blend_tool_editor_init_endpoint_gui (GimpBlendTool *blend_tool)
gimp_image_get_resolution (image, &xres, &yres);
/* the endpoint editor */
- blend_tool->endpoint_editor =
- editor = gimp_editor_new ();
- gtk_box_pack_start (GTK_BOX (gimp_tool_gui_get_vbox (blend_tool->gui)),
+ gradient_tool->endpoint_editor =
+ editor = gimp_editor_new ();
+ gtk_box_pack_start (GTK_BOX (gimp_tool_gui_get_vbox (gradient_tool->gui)),
editor, FALSE, TRUE, 0);
/* the main table */
@@ -1297,10 +1297,10 @@ gimp_blend_tool_editor_init_endpoint_gui (GimpBlendTool *blend_tool)
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 6);
- blend_tool->endpoint_se =
- se = gimp_size_entry_new (1, GIMP_UNIT_PIXEL, "%a",
- TRUE, TRUE, FALSE, 6,
- GIMP_SIZE_ENTRY_UPDATE_SIZE);
+ gradient_tool->endpoint_se =
+ se = gimp_size_entry_new (1, GIMP_UNIT_PIXEL, "%a",
+ TRUE, TRUE, FALSE, 6,
+ GIMP_SIZE_ENTRY_UPDATE_SIZE);
gtk_table_set_row_spacings (GTK_TABLE (se), 4);
gtk_table_set_col_spacings (GTK_TABLE (se), 2);
@@ -1333,8 +1333,8 @@ gimp_blend_tool_editor_init_endpoint_gui (GimpBlendTool *blend_tool)
0, gimp_image_get_height (image));
g_signal_connect (se, "value-changed",
- G_CALLBACK (gimp_blend_tool_editor_endpoint_se_value_changed),
- blend_tool);
+ G_CALLBACK (gimp_gradient_tool_editor_endpoint_se_value_changed),
+ gradient_tool);
row += 2;
@@ -1346,9 +1346,9 @@ gimp_blend_tool_editor_init_endpoint_gui (GimpBlendTool *blend_tool)
gtk_widget_show (label);
/* the color entry */
- hbox = gimp_blend_tool_editor_color_entry_new (
- blend_tool, _("Change Endpoint Color"), DIRECTION_NONE, NULL,
- &blend_tool->endpoint_color_panel, &blend_tool->endpoint_type_combo);
+ hbox = gimp_gradient_tool_editor_color_entry_new (
+ gradient_tool, _("Change Endpoint Color"), DIRECTION_NONE, NULL,
+ &gradient_tool->endpoint_color_panel, &gradient_tool->endpoint_type_combo);
gtk_table_attach (GTK_TABLE (table), hbox, 1, 2, row, row + 1,
GTK_SHRINK | GTK_FILL | GTK_EXPAND,
GTK_SHRINK | GTK_FILL,
@@ -1359,7 +1359,7 @@ gimp_blend_tool_editor_init_endpoint_gui (GimpBlendTool *blend_tool)
}
static void
-gimp_blend_tool_editor_init_stop_gui (GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_init_stop_gui (GimpGradientTool *gradient_tool)
{
GtkWidget *editor;
GtkWidget *table;
@@ -1372,9 +1372,9 @@ gimp_blend_tool_editor_init_stop_gui (GimpBlendTool *blend_tool)
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)),
+ gradient_tool->stop_editor =
+ editor = gimp_editor_new ();
+ gtk_box_pack_start (GTK_BOX (gimp_tool_gui_get_vbox (gradient_tool->gui)),
editor, FALSE, TRUE, 0);
/* the main table */
@@ -1392,10 +1392,10 @@ gimp_blend_tool_editor_init_stop_gui (GimpBlendTool *blend_tool)
gtk_widget_show (label);
/* the position size entry */
- blend_tool->stop_se =
- se = gimp_size_entry_new (1, GIMP_UNIT_PERCENT, "%a",
- FALSE, TRUE, FALSE, 6,
- GIMP_SIZE_ENTRY_UPDATE_SIZE);
+ gradient_tool->stop_se =
+ se = gimp_size_entry_new (1, GIMP_UNIT_PERCENT, "%a",
+ FALSE, TRUE, FALSE, 6,
+ GIMP_SIZE_ENTRY_UPDATE_SIZE);
gimp_size_entry_show_unit_menu (GIMP_SIZE_ENTRY (se), FALSE);
gtk_table_attach (GTK_TABLE (table), se, 1, 2, row, row + 1,
GTK_SHRINK | GTK_FILL | GTK_EXPAND,
@@ -1404,8 +1404,8 @@ gimp_blend_tool_editor_init_stop_gui (GimpBlendTool *blend_tool)
gtk_widget_show (se);
g_signal_connect (se, "value-changed",
- G_CALLBACK (gimp_blend_tool_editor_stop_se_value_changed),
- blend_tool);
+ G_CALLBACK (gimp_gradient_tool_editor_stop_se_value_changed),
+ gradient_tool);
row++;
@@ -1433,8 +1433,8 @@ gimp_blend_tool_editor_init_stop_gui (GimpBlendTool *blend_tool)
gtk_widget_show (table2);
/* the color entries chain button */
- blend_tool->stop_chain_button =
- button = gimp_chain_button_new (GIMP_CHAIN_RIGHT);
+ gradient_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,
@@ -1442,18 +1442,18 @@ gimp_blend_tool_editor_init_stop_gui (GimpBlendTool *blend_tool)
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);
+ hbox = gimp_gradient_tool_editor_color_entry_new (
+ gradient_tool, _("Change Stop Color"), DIRECTION_LEFT, button,
+ &gradient_tool->stop_left_color_panel, &gradient_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);
+ hbox = gimp_gradient_tool_editor_color_entry_new (
+ gradient_tool, _("Change Stop Color"), DIRECTION_RIGHT, button,
+ &gradient_tool->stop_right_color_panel, &gradient_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,
@@ -1476,12 +1476,12 @@ gimp_blend_tool_editor_init_stop_gui (GimpBlendTool *blend_tool)
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);
+ G_CALLBACK (gimp_gradient_tool_editor_stop_delete_clicked),
+ NULL, gradient_tool);
}
static void
-gimp_blend_tool_editor_init_midpoint_gui (GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_init_midpoint_gui (GimpGradientTool *gradient_tool)
{
GtkWidget *editor;
GtkWidget *table;
@@ -1492,9 +1492,9 @@ gimp_blend_tool_editor_init_midpoint_gui (GimpBlendTool *blend_tool)
gint row = 0;
/* the stop editor */
- blend_tool->midpoint_editor =
- editor = gimp_editor_new ();
- gtk_box_pack_start (GTK_BOX (gimp_tool_gui_get_vbox (blend_tool->gui)),
+ gradient_tool->midpoint_editor =
+ editor = gimp_editor_new ();
+ gtk_box_pack_start (GTK_BOX (gimp_tool_gui_get_vbox (gradient_tool->gui)),
editor, FALSE, TRUE, 0);
/* the main table */
@@ -1512,10 +1512,10 @@ gimp_blend_tool_editor_init_midpoint_gui (GimpBlendTool *blend_tool)
gtk_widget_show (label);
/* the position size entry */
- blend_tool->midpoint_se =
- se = gimp_size_entry_new (1, GIMP_UNIT_PERCENT, "%a",
- FALSE, TRUE, FALSE, 6,
- GIMP_SIZE_ENTRY_UPDATE_SIZE);
+ gradient_tool->midpoint_se =
+ se = gimp_size_entry_new (1, GIMP_UNIT_PERCENT, "%a",
+ FALSE, TRUE, FALSE, 6,
+ GIMP_SIZE_ENTRY_UPDATE_SIZE);
gimp_size_entry_show_unit_menu (GIMP_SIZE_ENTRY (se), FALSE);
gtk_table_attach (GTK_TABLE (table), se, 1, 2, row, row + 1,
GTK_SHRINK | GTK_FILL | GTK_EXPAND,
@@ -1524,8 +1524,8 @@ gimp_blend_tool_editor_init_midpoint_gui (GimpBlendTool *blend_tool)
gtk_widget_show (se);
g_signal_connect (se, "value-changed",
- G_CALLBACK (gimp_blend_tool_editor_midpoint_se_value_changed),
- blend_tool);
+ G_CALLBACK (gimp_gradient_tool_editor_midpoint_se_value_changed),
+ gradient_tool);
row++;
@@ -1537,8 +1537,8 @@ gimp_blend_tool_editor_init_midpoint_gui (GimpBlendTool *blend_tool)
gtk_widget_show (label);
/* the type combo */
- blend_tool->midpoint_type_combo =
- combo = gimp_enum_combo_box_new (GIMP_TYPE_GRADIENT_SEGMENT_TYPE);
+ gradient_tool->midpoint_type_combo =
+ combo = gimp_enum_combo_box_new (GIMP_TYPE_GRADIENT_SEGMENT_TYPE);
gtk_table_attach (GTK_TABLE (table), combo, 1, 2, row, row + 1,
GTK_SHRINK | GTK_FILL | GTK_EXPAND,
GTK_SHRINK | GTK_FILL,
@@ -1546,8 +1546,8 @@ gimp_blend_tool_editor_init_midpoint_gui (GimpBlendTool *blend_tool)
gtk_widget_show (combo);
g_signal_connect (combo, "changed",
- G_CALLBACK (gimp_blend_tool_editor_midpoint_type_changed),
- blend_tool);
+ G_CALLBACK (gimp_gradient_tool_editor_midpoint_type_changed),
+ gradient_tool);
row++;
@@ -1559,8 +1559,8 @@ gimp_blend_tool_editor_init_midpoint_gui (GimpBlendTool *blend_tool)
gtk_widget_show (label);
/* the color combo */
- blend_tool->midpoint_color_combo =
- combo = gimp_enum_combo_box_new (GIMP_TYPE_GRADIENT_SEGMENT_COLOR);
+ gradient_tool->midpoint_color_combo =
+ combo = gimp_enum_combo_box_new (GIMP_TYPE_GRADIENT_SEGMENT_COLOR);
gtk_table_attach (GTK_TABLE (table), combo, 1, 2, row, row + 1,
GTK_SHRINK | GTK_FILL | GTK_EXPAND,
GTK_SHRINK | GTK_FILL,
@@ -1568,8 +1568,8 @@ gimp_blend_tool_editor_init_midpoint_gui (GimpBlendTool *blend_tool)
gtk_widget_show (combo);
g_signal_connect (combo, "changed",
- G_CALLBACK (gimp_blend_tool_editor_midpoint_color_changed),
- blend_tool);
+ G_CALLBACK (gimp_gradient_tool_editor_midpoint_color_changed),
+ gradient_tool);
row++;
@@ -1584,27 +1584,27 @@ gimp_blend_tool_editor_init_midpoint_gui (GimpBlendTool *blend_tool)
row++;
/* the new stop button */
- blend_tool->midpoint_new_stop_button =
+ gradient_tool->midpoint_new_stop_button =
gimp_editor_add_button (GIMP_EDITOR (editor),
GIMP_ICON_DOCUMENT_NEW, _("New stop at midpoint"),
NULL,
- G_CALLBACK (gimp_blend_tool_editor_midpoint_new_stop_clicked),
- NULL, blend_tool);
+ G_CALLBACK (gimp_gradient_tool_editor_midpoint_new_stop_clicked),
+ NULL, gradient_tool);
/* the center button */
- blend_tool->midpoint_center_button =
+ gradient_tool->midpoint_center_button =
gimp_editor_add_button (GIMP_EDITOR (editor),
GIMP_ICON_CENTER_HORIZONTAL, _("Center midpoint"),
NULL,
- G_CALLBACK (gimp_blend_tool_editor_midpoint_center_clicked),
- NULL, blend_tool);
+ G_CALLBACK (gimp_gradient_tool_editor_midpoint_center_clicked),
+ NULL, gradient_tool);
}
static void
-gimp_blend_tool_editor_update_endpoint_gui (GimpBlendTool *blend_tool,
- gint selection)
+gimp_gradient_tool_editor_update_endpoint_gui (GimpGradientTool *gradient_tool,
+ gint selection)
{
- GimpBlendOptions *options = GIMP_BLEND_TOOL_GET_OPTIONS (blend_tool);
+ GimpGradientOptions *options = GIMP_GRADIENT_TOOL_GET_OPTIONS (gradient_tool);
GimpPaintOptions *paint_options = GIMP_PAINT_OPTIONS (options);
GimpContext *context = GIMP_CONTEXT (options);
gboolean editable;
@@ -1615,19 +1615,19 @@ gimp_blend_tool_editor_update_endpoint_gui (GimpBlendTool *blend_tool,
GimpRGB color;
GimpGradientColor color_type;
- editable = gimp_blend_tool_editor_is_gradient_editable (blend_tool);
+ editable = gimp_gradient_tool_editor_is_gradient_editable (gradient_tool);
switch (selection)
{
case GIMP_TOOL_LINE_HANDLE_START:
- g_object_get (blend_tool->widget,
+ g_object_get (gradient_tool->widget,
"x1", &x,
"y1", &y,
NULL);
break;
case GIMP_TOOL_LINE_HANDLE_END:
- g_object_get (blend_tool->widget,
+ g_object_get (gradient_tool->widget,
"x2", &x,
"y2", &y,
NULL);
@@ -1652,14 +1652,14 @@ gimp_blend_tool_editor_update_endpoint_gui (GimpBlendTool *blend_tool,
}
}
- seg = gimp_blend_tool_editor_handle_get_segment (blend_tool, selection);
+ seg = gimp_gradient_tool_editor_handle_get_segment (gradient_tool, selection);
switch (selection)
{
case GIMP_TOOL_LINE_HANDLE_START:
title = _("Start Endpoint");
- gimp_gradient_segment_get_left_flat_color (blend_tool->gradient, context,
+ gimp_gradient_segment_get_left_flat_color (gradient_tool->gradient, context,
seg, &color);
color_type = seg->left_color_type;
break;
@@ -1667,7 +1667,7 @@ gimp_blend_tool_editor_update_endpoint_gui (GimpBlendTool *blend_tool,
case GIMP_TOOL_LINE_HANDLE_END:
title = _("End Endpoint");
- gimp_gradient_segment_get_right_flat_color (blend_tool->gradient, context,
+ gimp_gradient_segment_get_right_flat_color (gradient_tool->gradient, context,
seg, &color);
color_type = seg->right_color_type;
break;
@@ -1676,27 +1676,27 @@ gimp_blend_tool_editor_update_endpoint_gui (GimpBlendTool *blend_tool,
gimp_assert_not_reached ();
}
- gimp_tool_gui_set_title (blend_tool->gui, title);
+ gimp_tool_gui_set_title (gradient_tool->gui, title);
- gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (blend_tool->endpoint_se), 0, x);
- gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (blend_tool->endpoint_se), 1, y);
+ gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (gradient_tool->endpoint_se), 0, x);
+ gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (gradient_tool->endpoint_se), 1, y);
gimp_color_button_set_color (
- GIMP_COLOR_BUTTON (blend_tool->endpoint_color_panel), &color);
+ GIMP_COLOR_BUTTON (gradient_tool->endpoint_color_panel), &color);
gimp_int_combo_box_set_active (
- GIMP_INT_COMBO_BOX (blend_tool->endpoint_type_combo), color_type);
+ GIMP_INT_COMBO_BOX (gradient_tool->endpoint_type_combo), color_type);
- gtk_widget_set_sensitive (blend_tool->endpoint_color_panel, editable);
- gtk_widget_set_sensitive (blend_tool->endpoint_type_combo, editable);
+ gtk_widget_set_sensitive (gradient_tool->endpoint_color_panel, editable);
+ gtk_widget_set_sensitive (gradient_tool->endpoint_type_combo, editable);
- gtk_widget_show (blend_tool->endpoint_editor);
+ gtk_widget_show (gradient_tool->endpoint_editor);
}
static void
-gimp_blend_tool_editor_update_stop_gui (GimpBlendTool *blend_tool,
- gint selection)
+gimp_gradient_tool_editor_update_stop_gui (GimpGradientTool *gradient_tool,
+ gint selection)
{
- GimpBlendOptions *options = GIMP_BLEND_TOOL_GET_OPTIONS (blend_tool);
+ GimpGradientOptions *options = GIMP_GRADIENT_TOOL_GET_OPTIONS (gradient_tool);
GimpContext *context = GIMP_CONTEXT (options);
gboolean editable;
GimpGradientSegment *seg;
@@ -1710,12 +1710,12 @@ gimp_blend_tool_editor_update_stop_gui (GimpBlendTool *blend_tool,
GimpRGB right_color;
GimpGradientColor right_color_type;
- editable = gimp_blend_tool_editor_is_gradient_editable (blend_tool);
+ editable = gimp_gradient_tool_editor_is_gradient_editable (gradient_tool);
- seg = gimp_blend_tool_editor_handle_get_segment (blend_tool, selection);
+ seg = gimp_gradient_tool_editor_handle_get_segment (gradient_tool, selection);
index = GPOINTER_TO_INT (
- gimp_tool_line_get_sliders (GIMP_TOOL_LINE (blend_tool->widget),
+ gimp_tool_line_get_sliders (GIMP_TOOL_LINE (gradient_tool->widget),
NULL)[selection].data);
title = g_strdup_printf (_("Stop %d"), index + 1);
@@ -1724,49 +1724,49 @@ gimp_blend_tool_editor_update_stop_gui (GimpBlendTool *blend_tool,
max = seg->next->right;
value = seg->right;
- gimp_gradient_segment_get_right_flat_color (blend_tool->gradient, context,
+ gimp_gradient_segment_get_right_flat_color (gradient_tool->gradient, context,
seg, &left_color);
left_color_type = seg->right_color_type;
- gimp_gradient_segment_get_left_flat_color (blend_tool->gradient, context,
+ gimp_gradient_segment_get_left_flat_color (gradient_tool->gradient, context,
seg->next, &right_color);
right_color_type = seg->next->left_color_type;
- gimp_tool_gui_set_title (blend_tool->gui, title);
+ gimp_tool_gui_set_title (gradient_tool->gui, title);
- gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (blend_tool->stop_se),
+ gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (gradient_tool->stop_se),
0, 100.0 * min, 100.0 * max);
- gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (blend_tool->stop_se),
+ gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (gradient_tool->stop_se),
0, 100.0 * value);
gimp_color_button_set_color (
- GIMP_COLOR_BUTTON (blend_tool->stop_left_color_panel), &left_color);
+ GIMP_COLOR_BUTTON (gradient_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_INT_COMBO_BOX (gradient_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_COLOR_BUTTON (gradient_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_se, 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);
+ GIMP_INT_COMBO_BOX (gradient_tool->stop_right_type_combo), right_color_type);
+
+ gtk_widget_set_sensitive (gradient_tool->stop_se, editable);
+ gtk_widget_set_sensitive (gradient_tool->stop_left_color_panel, editable);
+ gtk_widget_set_sensitive (gradient_tool->stop_left_type_combo, editable);
+ gtk_widget_set_sensitive (gradient_tool->stop_right_color_panel, editable);
+ gtk_widget_set_sensitive (gradient_tool->stop_right_type_combo, editable);
+ gtk_widget_set_sensitive (gradient_tool->stop_chain_button, editable);
gtk_widget_set_sensitive (
- GTK_WIDGET (gimp_editor_get_button_box (GIMP_EDITOR (blend_tool->stop_editor))),
+ GTK_WIDGET (gimp_editor_get_button_box (GIMP_EDITOR (gradient_tool->stop_editor))),
editable);
g_free (title);
- gtk_widget_show (blend_tool->stop_editor);
+ gtk_widget_show (gradient_tool->stop_editor);
}
static void
-gimp_blend_tool_editor_update_midpoint_gui (GimpBlendTool *blend_tool,
- gint selection)
+gimp_gradient_tool_editor_update_midpoint_gui (GimpGradientTool *gradient_tool,
+ gint selection)
{
gboolean editable;
const GimpGradientSegment *seg;
@@ -1778,12 +1778,12 @@ gimp_blend_tool_editor_update_midpoint_gui (GimpBlendTool *blend_tool,
GimpGradientSegmentType type;
GimpGradientSegmentColor color;
- editable = gimp_blend_tool_editor_is_gradient_editable (blend_tool);
+ editable = gimp_gradient_tool_editor_is_gradient_editable (gradient_tool);
- seg = gimp_blend_tool_editor_handle_get_segment (blend_tool, selection);
+ seg = gimp_gradient_tool_editor_handle_get_segment (gradient_tool, selection);
index = GPOINTER_TO_INT (
- gimp_tool_line_get_sliders (GIMP_TOOL_LINE (blend_tool->widget),
+ gimp_tool_line_get_sliders (GIMP_TOOL_LINE (gradient_tool->widget),
NULL)[selection].data);
title = g_strdup_printf (_("Midpoint %d"), index + 1);
@@ -1794,58 +1794,58 @@ gimp_blend_tool_editor_update_midpoint_gui (GimpBlendTool *blend_tool,
type = seg->type;
color = seg->color;
- gimp_tool_gui_set_title (blend_tool->gui, title);
+ gimp_tool_gui_set_title (gradient_tool->gui, title);
- gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (blend_tool->midpoint_se),
+ gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (gradient_tool->midpoint_se),
0, 100.0 * min, 100.0 * max);
- gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (blend_tool->midpoint_se),
+ gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (gradient_tool->midpoint_se),
0, 100.0 * value);
gimp_int_combo_box_set_active (
- GIMP_INT_COMBO_BOX (blend_tool->midpoint_type_combo), type);
+ GIMP_INT_COMBO_BOX (gradient_tool->midpoint_type_combo), type);
gimp_int_combo_box_set_active (
- GIMP_INT_COMBO_BOX (blend_tool->midpoint_color_combo), color);
+ GIMP_INT_COMBO_BOX (gradient_tool->midpoint_color_combo), color);
- gtk_widget_set_sensitive (blend_tool->midpoint_new_stop_button,
+ gtk_widget_set_sensitive (gradient_tool->midpoint_new_stop_button,
value > min + EPSILON && value < max - EPSILON);
- gtk_widget_set_sensitive (blend_tool->midpoint_center_button,
+ gtk_widget_set_sensitive (gradient_tool->midpoint_center_button,
fabs (value - (min + max) / 2.0) > EPSILON);
- gtk_widget_set_sensitive (blend_tool->midpoint_se, editable);
- gtk_widget_set_sensitive (blend_tool->midpoint_type_combo, editable);
- gtk_widget_set_sensitive (blend_tool->midpoint_color_combo, editable);
+ gtk_widget_set_sensitive (gradient_tool->midpoint_se, editable);
+ gtk_widget_set_sensitive (gradient_tool->midpoint_type_combo, editable);
+ gtk_widget_set_sensitive (gradient_tool->midpoint_color_combo, editable);
gtk_widget_set_sensitive (
- GTK_WIDGET (gimp_editor_get_button_box (GIMP_EDITOR (blend_tool->midpoint_editor))),
+ GTK_WIDGET (gimp_editor_get_button_box (GIMP_EDITOR (gradient_tool->midpoint_editor))),
editable);
g_free (title);
- gtk_widget_show (blend_tool->midpoint_editor);
+ gtk_widget_show (gradient_tool->midpoint_editor);
}
static void
-gimp_blend_tool_editor_update_gui (GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_update_gui (GimpGradientTool *gradient_tool)
{
- GimpBlendOptions *options = GIMP_BLEND_TOOL_GET_OPTIONS (blend_tool);
+ GimpGradientOptions *options = GIMP_GRADIENT_TOOL_GET_OPTIONS (gradient_tool);
- if (blend_tool->gradient && blend_tool->widget && ! options->instant)
+ if (gradient_tool->gradient && gradient_tool->widget && ! options->instant)
{
gint selection;
selection =
- gimp_tool_line_get_selection (GIMP_TOOL_LINE (blend_tool->widget));
+ gimp_tool_line_get_selection (GIMP_TOOL_LINE (gradient_tool->widget));
if (selection != GIMP_TOOL_LINE_HANDLE_NONE)
{
- if (! blend_tool->gui)
+ if (! gradient_tool->gui)
{
GimpDisplayShell *shell;
- shell = gimp_tool_widget_get_shell (blend_tool->widget);
+ shell = gimp_tool_widget_get_shell (gradient_tool->widget);
- blend_tool->gui =
- gimp_tool_gui_new (GIMP_TOOL (blend_tool)->tool_info,
+ gradient_tool->gui =
+ gimp_tool_gui_new (GIMP_TOOL (gradient_tool)->tool_info,
NULL, NULL, NULL, NULL,
gtk_widget_get_screen (GTK_WIDGET (shell)),
gimp_widget_get_monitor (GTK_WIDGET (shell)),
@@ -1855,58 +1855,58 @@ gimp_blend_tool_editor_update_gui (GimpBlendTool *blend_tool)
NULL);
- gimp_tool_gui_set_shell (blend_tool->gui, shell);
- gimp_tool_gui_set_viewable (blend_tool->gui,
- GIMP_VIEWABLE (blend_tool->gradient));
- gimp_tool_gui_set_auto_overlay (blend_tool->gui, TRUE);
+ gimp_tool_gui_set_shell (gradient_tool->gui, shell);
+ gimp_tool_gui_set_viewable (gradient_tool->gui,
+ GIMP_VIEWABLE (gradient_tool->gradient));
+ gimp_tool_gui_set_auto_overlay (gradient_tool->gui, TRUE);
- g_signal_connect (blend_tool->gui, "response",
- G_CALLBACK (gimp_blend_tool_editor_gui_response),
- blend_tool);
+ g_signal_connect (gradient_tool->gui, "response",
+ G_CALLBACK (gimp_gradient_tool_editor_gui_response),
+ gradient_tool);
- gimp_blend_tool_editor_init_endpoint_gui (blend_tool);
- gimp_blend_tool_editor_init_stop_gui (blend_tool);
- gimp_blend_tool_editor_init_midpoint_gui (blend_tool);
+ gimp_gradient_tool_editor_init_endpoint_gui (gradient_tool);
+ gimp_gradient_tool_editor_init_stop_gui (gradient_tool);
+ gimp_gradient_tool_editor_init_midpoint_gui (gradient_tool);
}
- gimp_blend_tool_editor_block_handlers (blend_tool);
+ gimp_gradient_tool_editor_block_handlers (gradient_tool);
- if (gimp_blend_tool_editor_handle_is_endpoint (blend_tool, selection))
- gimp_blend_tool_editor_update_endpoint_gui (blend_tool, selection);
+ if (gimp_gradient_tool_editor_handle_is_endpoint (gradient_tool, selection))
+ gimp_gradient_tool_editor_update_endpoint_gui (gradient_tool, selection);
else
- gtk_widget_hide (blend_tool->endpoint_editor);
+ gtk_widget_hide (gradient_tool->endpoint_editor);
- if (gimp_blend_tool_editor_handle_is_stop (blend_tool, selection))
- gimp_blend_tool_editor_update_stop_gui (blend_tool, selection);
+ if (gimp_gradient_tool_editor_handle_is_stop (gradient_tool, selection))
+ gimp_gradient_tool_editor_update_stop_gui (gradient_tool, selection);
else
- gtk_widget_hide (blend_tool->stop_editor);
+ gtk_widget_hide (gradient_tool->stop_editor);
- if (gimp_blend_tool_editor_handle_is_midpoint (blend_tool, selection))
- gimp_blend_tool_editor_update_midpoint_gui (blend_tool, selection);
+ if (gimp_gradient_tool_editor_handle_is_midpoint (gradient_tool, selection))
+ gimp_gradient_tool_editor_update_midpoint_gui (gradient_tool, selection);
else
- gtk_widget_hide (blend_tool->midpoint_editor);
+ gtk_widget_hide (gradient_tool->midpoint_editor);
- gimp_blend_tool_editor_unblock_handlers (blend_tool);
+ gimp_gradient_tool_editor_unblock_handlers (gradient_tool);
- gimp_tool_gui_show (blend_tool->gui);
+ gimp_tool_gui_show (gradient_tool->gui);
return;
}
}
- if (blend_tool->gui)
- gimp_tool_gui_hide (blend_tool->gui);
+ if (gradient_tool->gui)
+ gimp_tool_gui_hide (gradient_tool->gui);
}
-static BlendInfo *
-gimp_blend_tool_editor_blend_info_new (GimpBlendTool *blend_tool)
+static GradientInfo *
+gimp_gradient_tool_editor_gradient_info_new (GimpGradientTool *gradient_tool)
{
- BlendInfo *info = g_slice_new (BlendInfo);
+ GradientInfo *info = g_slice_new (GradientInfo);
- info->start_x = blend_tool->start_x;
- info->start_y = blend_tool->start_y;
- info->end_x = blend_tool->end_x;
- info->end_y = blend_tool->end_y;
+ info->start_x = gradient_tool->start_x;
+ info->start_y = gradient_tool->start_y;
+ info->end_x = gradient_tool->end_x;
+ info->end_y = gradient_tool->end_y;
info->gradient = NULL;
@@ -1918,23 +1918,23 @@ gimp_blend_tool_editor_blend_info_new (GimpBlendTool *blend_tool)
}
static void
-gimp_blend_tool_editor_blend_info_free (BlendInfo *info)
+gimp_gradient_tool_editor_gradient_info_free (GradientInfo *info)
{
if (info->gradient)
g_object_unref (info->gradient);
- g_slice_free (BlendInfo, info);
+ g_slice_free (GradientInfo, info);
}
static void
-gimp_blend_tool_editor_blend_info_apply (GimpBlendTool *blend_tool,
- const BlendInfo *info,
- gboolean set_selection)
+gimp_gradient_tool_editor_gradient_info_apply (GimpGradientTool *gradient_tool,
+ const GradientInfo *info,
+ gboolean set_selection)
{
gint selection;
- gimp_assert (blend_tool->widget != NULL);
- gimp_assert (blend_tool->gradient != NULL);
+ gimp_assert (gradient_tool->widget != NULL);
+ gimp_assert (gradient_tool->gradient != NULL);
/* pick the handle to select */
if (info->gradient)
@@ -1949,14 +1949,14 @@ gimp_blend_tool_editor_blend_info_apply (GimpBlendTool *blend_tool,
else if (info->added_handle != GIMP_TOOL_LINE_HANDLE_NONE)
{
/* we're undoing a stop addition operation */
- gimp_assert (gimp_blend_tool_editor_handle_is_stop (blend_tool,
- info->added_handle));
+ gimp_assert (gimp_gradient_tool_editor_handle_is_stop (gradient_tool,
+ info->added_handle));
selection =
- gimp_tool_line_get_selection (GIMP_TOOL_LINE (blend_tool->widget));
+ gimp_tool_line_get_selection (GIMP_TOOL_LINE (gradient_tool->widget));
/* if the selected handle is a stop... */
- if (gimp_blend_tool_editor_handle_is_stop (blend_tool, selection))
+ if (gimp_gradient_tool_editor_handle_is_stop (gradient_tool, selection))
{
/* if the added handle is selected, clear the selection */
if (selection == info->added_handle)
@@ -1968,13 +1968,13 @@ gimp_blend_tool_editor_blend_info_apply (GimpBlendTool *blend_tool,
selection--;
}
/* otherwise, if the selected handle is a midpoint... */
- else if (gimp_blend_tool_editor_handle_is_midpoint (blend_tool, selection))
+ else if (gimp_gradient_tool_editor_handle_is_midpoint (gradient_tool, selection))
{
const GimpControllerSlider *sliders;
gint seg_i;
sliders =
- gimp_tool_line_get_sliders (GIMP_TOOL_LINE (blend_tool->widget),
+ gimp_tool_line_get_sliders (GIMP_TOOL_LINE (gradient_tool->widget),
NULL);
seg_i = GPOINTER_TO_INT (sliders[selection].data);
@@ -2022,20 +2022,20 @@ gimp_blend_tool_editor_blend_info_apply (GimpBlendTool *blend_tool,
set_selection = FALSE;
}
}
- else if ((info->start_x != blend_tool->start_x ||
- info->start_y != blend_tool->start_y) &&
- (info->end_x == blend_tool->end_x &&
- info->end_y == blend_tool->end_y))
+ else if ((info->start_x != gradient_tool->start_x ||
+ info->start_y != gradient_tool->start_y) &&
+ (info->end_x == gradient_tool->end_x &&
+ info->end_y == gradient_tool->end_y))
{
/* we're undoing a start-endpoint move operation; select the start
* endpoint
*/
selection = GIMP_TOOL_LINE_HANDLE_START;
}
- else if ((info->end_x != blend_tool->end_x ||
- info->end_y != blend_tool->end_y) &&
- (info->start_x == blend_tool->start_x &&
- info->start_y == blend_tool->start_y))
+ else if ((info->end_x != gradient_tool->end_x ||
+ info->end_y != gradient_tool->end_y) &&
+ (info->start_x == gradient_tool->start_x &&
+ info->start_y == gradient_tool->start_y))
{
/* we're undoing am end-endpoint move operation; select the end
@@ -2049,9 +2049,9 @@ gimp_blend_tool_editor_blend_info_apply (GimpBlendTool *blend_tool,
set_selection = FALSE;
}
- gimp_blend_tool_editor_block_handlers (blend_tool);
+ gimp_gradient_tool_editor_block_handlers (gradient_tool);
- g_object_set (blend_tool->widget,
+ g_object_set (gradient_tool->widget,
"x1", info->start_x,
"y1", info->start_y,
"x2", info->end_x,
@@ -2060,43 +2060,43 @@ gimp_blend_tool_editor_blend_info_apply (GimpBlendTool *blend_tool,
if (info->gradient)
{
- gimp_blend_tool_editor_freeze_gradient (blend_tool);
+ gimp_gradient_tool_editor_freeze_gradient (gradient_tool);
- gimp_data_copy (GIMP_DATA (blend_tool->gradient),
+ gimp_data_copy (GIMP_DATA (gradient_tool->gradient),
GIMP_DATA (info->gradient));
- gimp_blend_tool_editor_thaw_gradient (blend_tool);
+ gimp_gradient_tool_editor_thaw_gradient (gradient_tool);
}
if (set_selection)
{
- gimp_tool_line_set_selection (GIMP_TOOL_LINE (blend_tool->widget),
+ gimp_tool_line_set_selection (GIMP_TOOL_LINE (gradient_tool->widget),
selection);
}
- gimp_blend_tool_editor_update_gui (blend_tool);
+ gimp_gradient_tool_editor_update_gui (gradient_tool);
- gimp_blend_tool_editor_unblock_handlers (blend_tool);
+ gimp_gradient_tool_editor_unblock_handlers (gradient_tool);
}
static gboolean
-gimp_blend_tool_editor_blend_info_is_trivial (GimpBlendTool *blend_tool,
- const BlendInfo *info)
+gimp_gradient_tool_editor_gradient_info_is_trivial (GimpGradientTool *gradient_tool,
+ const GradientInfo *info)
{
const GimpGradientSegment *seg1;
const GimpGradientSegment *seg2;
- if (info->start_x != blend_tool->start_x ||
- info->start_y != blend_tool->start_y ||
- info->end_x != blend_tool->end_x ||
- info->end_y != blend_tool->end_y)
+ if (info->start_x != gradient_tool->start_x ||
+ info->start_y != gradient_tool->start_y ||
+ info->end_x != gradient_tool->end_x ||
+ info->end_y != gradient_tool->end_y)
{
return FALSE;
}
if (info->gradient)
{
- for (seg1 = info->gradient->segments, seg2 = blend_tool->gradient->segments;
+ for (seg1 = info->gradient->segments, seg2 = gradient_tool->gradient->segments;
seg1 && seg2;
seg1 = seg1->next, seg2 = seg2->next)
{
@@ -2114,105 +2114,104 @@ gimp_blend_tool_editor_blend_info_is_trivial (GimpBlendTool *blend_tool,
/* public functions */
-
void
-gimp_blend_tool_editor_options_notify (GimpBlendTool *blend_tool,
- GimpToolOptions *options,
- const GParamSpec *pspec)
+gimp_gradient_tool_editor_options_notify (GimpGradientTool *gradient_tool,
+ GimpToolOptions *options,
+ const GParamSpec *pspec)
{
if (! strcmp (pspec->name, "modify-active"))
{
- gimp_blend_tool_editor_update_sliders (blend_tool);
- gimp_blend_tool_editor_update_gui (blend_tool);
+ gimp_gradient_tool_editor_update_sliders (gradient_tool);
+ gimp_gradient_tool_editor_update_gui (gradient_tool);
}
else if (! strcmp (pspec->name, "gradient-reverse"))
{
- gimp_blend_tool_editor_update_sliders (blend_tool);
+ gimp_gradient_tool_editor_update_sliders (gradient_tool);
/* if an endpoint is selected, swap the selected endpoint */
- if (blend_tool->widget)
+ if (gradient_tool->widget)
{
gint selection;
selection =
- gimp_tool_line_get_selection (GIMP_TOOL_LINE (blend_tool->widget));
+ gimp_tool_line_get_selection (GIMP_TOOL_LINE (gradient_tool->widget));
switch (selection)
{
case GIMP_TOOL_LINE_HANDLE_START:
- gimp_tool_line_set_selection (GIMP_TOOL_LINE (blend_tool->widget),
+ gimp_tool_line_set_selection (GIMP_TOOL_LINE (gradient_tool->widget),
GIMP_TOOL_LINE_HANDLE_END);
break;
case GIMP_TOOL_LINE_HANDLE_END:
- gimp_tool_line_set_selection (GIMP_TOOL_LINE (blend_tool->widget),
+ gimp_tool_line_set_selection (GIMP_TOOL_LINE (gradient_tool->widget),
GIMP_TOOL_LINE_HANDLE_START);
break;
}
}
}
- else if (blend_tool->render_node &&
- gegl_node_find_property (blend_tool->render_node, pspec->name))
+ else if (gradient_tool->render_node &&
+ gegl_node_find_property (gradient_tool->render_node, pspec->name))
{
- gimp_blend_tool_editor_update_sliders (blend_tool);
+ gimp_gradient_tool_editor_update_sliders (gradient_tool);
}
}
void
-gimp_blend_tool_editor_start (GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_start (GimpGradientTool *gradient_tool)
{
- g_signal_connect (blend_tool->widget, "can-add-slider",
- G_CALLBACK (gimp_blend_tool_editor_line_can_add_slider),
- 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, "prepare-to-remove-slider",
- G_CALLBACK (gimp_blend_tool_editor_line_prepare_to_remove_slider),
- blend_tool);
- g_signal_connect (blend_tool->widget, "remove-slider",
- G_CALLBACK (gimp_blend_tool_editor_line_remove_slider),
- blend_tool);
- g_signal_connect (blend_tool->widget, "selection-changed",
- G_CALLBACK (gimp_blend_tool_editor_line_selection_changed),
- blend_tool);
- g_signal_connect (blend_tool->widget, "handle-clicked",
- G_CALLBACK (gimp_blend_tool_editor_line_handle_clicked),
- blend_tool);
+ g_signal_connect (gradient_tool->widget, "can-add-slider",
+ G_CALLBACK (gimp_gradient_tool_editor_line_can_add_slider),
+ gradient_tool);
+ g_signal_connect (gradient_tool->widget, "add-slider",
+ G_CALLBACK (gimp_gradient_tool_editor_line_add_slider),
+ gradient_tool);
+ g_signal_connect (gradient_tool->widget, "prepare-to-remove-slider",
+ G_CALLBACK (gimp_gradient_tool_editor_line_prepare_to_remove_slider),
+ gradient_tool);
+ g_signal_connect (gradient_tool->widget, "remove-slider",
+ G_CALLBACK (gimp_gradient_tool_editor_line_remove_slider),
+ gradient_tool);
+ g_signal_connect (gradient_tool->widget, "selection-changed",
+ G_CALLBACK (gimp_gradient_tool_editor_line_selection_changed),
+ gradient_tool);
+ g_signal_connect (gradient_tool->widget, "handle-clicked",
+ G_CALLBACK (gimp_gradient_tool_editor_line_handle_clicked),
+ gradient_tool);
}
void
-gimp_blend_tool_editor_halt (GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_halt (GimpGradientTool *gradient_tool)
{
- g_clear_object (&blend_tool->gui);
+ g_clear_object (&gradient_tool->gui);
- blend_tool->edit_count = 0;
+ gradient_tool->edit_count = 0;
- if (blend_tool->undo_stack)
+ if (gradient_tool->undo_stack)
{
- g_slist_free_full (blend_tool->undo_stack,
- (GDestroyNotify) gimp_blend_tool_editor_blend_info_free);
- blend_tool->undo_stack = NULL;
+ g_slist_free_full (gradient_tool->undo_stack,
+ (GDestroyNotify) gimp_gradient_tool_editor_gradient_info_free);
+ gradient_tool->undo_stack = NULL;
}
- if (blend_tool->redo_stack)
+ if (gradient_tool->redo_stack)
{
- g_slist_free_full (blend_tool->redo_stack,
- (GDestroyNotify) gimp_blend_tool_editor_blend_info_free);
- blend_tool->redo_stack = NULL;
+ g_slist_free_full (gradient_tool->redo_stack,
+ (GDestroyNotify) gimp_gradient_tool_editor_gradient_info_free);
+ gradient_tool->redo_stack = NULL;
}
- if (blend_tool->flush_idle_id)
+ if (gradient_tool->flush_idle_id)
{
- g_source_remove (blend_tool->flush_idle_id);
- blend_tool->flush_idle_id = 0;
+ g_source_remove (gradient_tool->flush_idle_id);
+ gradient_tool->flush_idle_id = 0;
}
}
gboolean
-gimp_blend_tool_editor_line_changed (GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_line_changed (GimpGradientTool *gradient_tool)
{
- GimpBlendOptions *options = GIMP_BLEND_TOOL_GET_OPTIONS (blend_tool);
+ GimpGradientOptions *options = GIMP_GRADIENT_TOOL_GET_OPTIONS (gradient_tool);
GimpPaintOptions *paint_options = GIMP_PAINT_OPTIONS (options);
gdouble offset = options->offset / 100.0;
const GimpControllerSlider *sliders;
@@ -2221,13 +2220,13 @@ gimp_blend_tool_editor_line_changed (GimpBlendTool *blend_tool)
GimpGradientSegment *seg;
gboolean changed = FALSE;
- if (gimp_blend_tool_editor_are_handlers_blocked (blend_tool))
+ if (gimp_gradient_tool_editor_are_handlers_blocked (gradient_tool))
return FALSE;
- if (! blend_tool->gradient || offset == 1.0)
+ if (! gradient_tool->gradient || offset == 1.0)
return FALSE;
- sliders = gimp_tool_line_get_sliders (GIMP_TOOL_LINE (blend_tool->widget),
+ sliders = gimp_tool_line_get_sliders (GIMP_TOOL_LINE (gradient_tool->widget),
&n_sliders);
if (n_sliders == 0)
@@ -2236,7 +2235,7 @@ gimp_blend_tool_editor_line_changed (GimpBlendTool *blend_tool)
/* update the midpoints first, since moving the gradient stops may change the
* gradient's midpoints w.r.t. the sliders, but not the other way around.
*/
- for (seg = blend_tool->gradient->segments, i = n_sliders / 2;
+ for (seg = gradient_tool->gradient->segments, i = n_sliders / 2;
seg;
seg = seg->next, i++)
{
@@ -2255,11 +2254,11 @@ gimp_blend_tool_editor_line_changed (GimpBlendTool *blend_tool)
{
if (! changed)
{
- gimp_blend_tool_editor_start_edit (blend_tool);
- gimp_blend_tool_editor_freeze_gradient (blend_tool);
+ gimp_gradient_tool_editor_start_edit (gradient_tool);
+ gimp_gradient_tool_editor_freeze_gradient (gradient_tool);
/* refetch the segment, since the gradient might have changed */
- seg = gimp_blend_tool_editor_handle_get_segment (blend_tool, i);
+ seg = gimp_gradient_tool_editor_handle_get_segment (gradient_tool, i);
changed = TRUE;
}
@@ -2269,7 +2268,7 @@ gimp_blend_tool_editor_line_changed (GimpBlendTool *blend_tool)
}
/* update the gradient stops */
- for (seg = blend_tool->gradient->segments, i = 0;
+ for (seg = gradient_tool->gradient->segments, i = 0;
seg->next;
seg = seg->next, i++)
{
@@ -2288,19 +2287,19 @@ gimp_blend_tool_editor_line_changed (GimpBlendTool *blend_tool)
{
if (! changed)
{
- gimp_blend_tool_editor_start_edit (blend_tool);
- gimp_blend_tool_editor_freeze_gradient (blend_tool);
+ gimp_gradient_tool_editor_start_edit (gradient_tool);
+ gimp_gradient_tool_editor_freeze_gradient (gradient_tool);
/* refetch the segment, since the gradient might have changed */
- seg = gimp_blend_tool_editor_handle_get_segment (blend_tool, i);
+ seg = gimp_gradient_tool_editor_handle_get_segment (gradient_tool, i);
changed = TRUE;
}
- gimp_gradient_segment_range_compress (blend_tool->gradient,
+ gimp_gradient_segment_range_compress (gradient_tool->gradient,
seg, seg,
seg->left, value);
- gimp_gradient_segment_range_compress (blend_tool->gradient,
+ gimp_gradient_segment_range_compress (gradient_tool->gradient,
seg->next, seg->next,
value, seg->next->right);
}
@@ -2308,94 +2307,94 @@ gimp_blend_tool_editor_line_changed (GimpBlendTool *blend_tool)
if (changed)
{
- gimp_blend_tool_editor_thaw_gradient (blend_tool);
- gimp_blend_tool_editor_end_edit (blend_tool, FALSE);
+ gimp_gradient_tool_editor_thaw_gradient (gradient_tool);
+ gimp_gradient_tool_editor_end_edit (gradient_tool, FALSE);
}
- gimp_blend_tool_editor_update_gui (blend_tool);
+ gimp_gradient_tool_editor_update_gui (gradient_tool);
return changed;
}
void
-gimp_blend_tool_editor_fg_bg_changed (GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_fg_bg_changed (GimpGradientTool *gradient_tool)
{
- gimp_blend_tool_editor_update_gui (blend_tool);
+ gimp_gradient_tool_editor_update_gui (gradient_tool);
}
void
-gimp_blend_tool_editor_gradient_dirty (GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_gradient_dirty (GimpGradientTool *gradient_tool)
{
- if (gimp_blend_tool_editor_are_handlers_blocked (blend_tool))
+ if (gimp_gradient_tool_editor_are_handlers_blocked (gradient_tool))
return;
- gimp_blend_tool_editor_purge_gradient (blend_tool);
+ gimp_gradient_tool_editor_purge_gradient (gradient_tool);
}
void
-gimp_blend_tool_editor_gradient_changed (GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_gradient_changed (GimpGradientTool *gradient_tool)
{
- GimpBlendOptions *options = GIMP_BLEND_TOOL_GET_OPTIONS (blend_tool);
- GimpContext *context = GIMP_CONTEXT (options);
+ GimpGradientOptions *options = GIMP_GRADIENT_TOOL_GET_OPTIONS (gradient_tool);
+ GimpContext *context = GIMP_CONTEXT (options);
if (options->modify_active_frame)
{
gtk_widget_set_sensitive (options->modify_active_frame,
- blend_tool->gradient !=
+ gradient_tool->gradient !=
gimp_gradients_get_custom (context->gimp));
}
if (options->modify_active_hint)
{
gtk_widget_set_visible (options->modify_active_hint,
- blend_tool->gradient &&
- ! gimp_data_is_writable (GIMP_DATA (blend_tool->gradient)));
+ gradient_tool->gradient &&
+ ! gimp_data_is_writable (GIMP_DATA (gradient_tool->gradient)));
}
- if (gimp_blend_tool_editor_are_handlers_blocked (blend_tool))
+ if (gimp_gradient_tool_editor_are_handlers_blocked (gradient_tool))
return;
- gimp_blend_tool_editor_purge_gradient (blend_tool);
+ gimp_gradient_tool_editor_purge_gradient (gradient_tool);
}
const gchar *
-gimp_blend_tool_editor_can_undo (GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_can_undo (GimpGradientTool *gradient_tool)
{
- if (! blend_tool->undo_stack || blend_tool->edit_count > 0)
+ if (! gradient_tool->undo_stack || gradient_tool->edit_count > 0)
return NULL;
- return _("Blend Step");
+ return _("Gradient Step");
}
const gchar *
-gimp_blend_tool_editor_can_redo (GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_can_redo (GimpGradientTool *gradient_tool)
{
- if (! blend_tool->redo_stack || blend_tool->edit_count > 0)
+ if (! gradient_tool->redo_stack || gradient_tool->edit_count > 0)
return NULL;
- return _("Blend Step");
+ return _("Gradient Step");
}
gboolean
-gimp_blend_tool_editor_undo (GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_undo (GimpGradientTool *gradient_tool)
{
- GimpTool *tool = GIMP_TOOL (blend_tool);
- BlendInfo *info;
- BlendInfo *new_info;
+ GimpTool *tool = GIMP_TOOL (gradient_tool);
+ GradientInfo *info;
+ GradientInfo *new_info;
- gimp_assert (blend_tool->undo_stack != NULL);
- gimp_assert (blend_tool->edit_count == 0);
+ gimp_assert (gradient_tool->undo_stack != NULL);
+ gimp_assert (gradient_tool->edit_count == 0);
- info = blend_tool->undo_stack->data;
+ info = gradient_tool->undo_stack->data;
- new_info = gimp_blend_tool_editor_blend_info_new (blend_tool);
+ new_info = gimp_gradient_tool_editor_gradient_info_new (gradient_tool);
if (info->gradient)
{
new_info->gradient =
- GIMP_GRADIENT (gimp_data_duplicate (GIMP_DATA (blend_tool->gradient)));
+ GIMP_GRADIENT (gimp_data_duplicate (GIMP_DATA (gradient_tool->gradient)));
- /* swap the added and removed handles, so that blend_info_apply() does
+ /* swap the added and removed handles, so that gradient_info_apply() does
* the right thing on redo
*/
new_info->added_handle = info->removed_handle;
@@ -2403,38 +2402,38 @@ gimp_blend_tool_editor_undo (GimpBlendTool *blend_tool)
new_info->selected_handle = info->selected_handle;
}
- blend_tool->undo_stack = g_slist_remove (blend_tool->undo_stack, info);
- blend_tool->redo_stack = g_slist_prepend (blend_tool->redo_stack, new_info);
+ gradient_tool->undo_stack = g_slist_remove (gradient_tool->undo_stack, info);
+ gradient_tool->redo_stack = g_slist_prepend (gradient_tool->redo_stack, new_info);
- gimp_blend_tool_editor_blend_info_apply (blend_tool, info, TRUE);
- gimp_blend_tool_editor_blend_info_free (info);
+ gimp_gradient_tool_editor_gradient_info_apply (gradient_tool, info, TRUE);
+ gimp_gradient_tool_editor_gradient_info_free (info);
- /* the initial state of the blend tool is not useful; we might as well halt */
- if (! blend_tool->undo_stack)
+ /* the initial state of the gradient tool is not useful; we might as well halt */
+ if (! gradient_tool->undo_stack)
gimp_tool_control (tool, GIMP_TOOL_ACTION_HALT, tool->display);
return TRUE;
}
gboolean
-gimp_blend_tool_editor_redo (GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_redo (GimpGradientTool *gradient_tool)
{
- BlendInfo *info;
- BlendInfo *new_info;
+ GradientInfo *info;
+ GradientInfo *new_info;
- gimp_assert (blend_tool->redo_stack != NULL);
- gimp_assert (blend_tool->edit_count == 0);
+ gimp_assert (gradient_tool->redo_stack != NULL);
+ gimp_assert (gradient_tool->edit_count == 0);
- info = blend_tool->redo_stack->data;
+ info = gradient_tool->redo_stack->data;
- new_info = gimp_blend_tool_editor_blend_info_new (blend_tool);
+ new_info = gimp_gradient_tool_editor_gradient_info_new (gradient_tool);
if (info->gradient)
{
new_info->gradient =
- GIMP_GRADIENT (gimp_data_duplicate (GIMP_DATA (blend_tool->gradient)));
+ GIMP_GRADIENT (gimp_data_duplicate (GIMP_DATA (gradient_tool->gradient)));
- /* swap the added and removed handles, so that blend_info_apply() does
+ /* swap the added and removed handles, so that gradient_info_apply() does
* the right thing on undo
*/
new_info->added_handle = info->removed_handle;
@@ -2442,77 +2441,77 @@ gimp_blend_tool_editor_redo (GimpBlendTool *blend_tool)
new_info->selected_handle = info->selected_handle;
}
- blend_tool->redo_stack = g_slist_remove (blend_tool->redo_stack, info);
- blend_tool->undo_stack = g_slist_prepend (blend_tool->undo_stack, new_info);
+ gradient_tool->redo_stack = g_slist_remove (gradient_tool->redo_stack, info);
+ gradient_tool->undo_stack = g_slist_prepend (gradient_tool->undo_stack, new_info);
- gimp_blend_tool_editor_blend_info_apply (blend_tool, info, TRUE);
- gimp_blend_tool_editor_blend_info_free (info);
+ gimp_gradient_tool_editor_gradient_info_apply (gradient_tool, info, TRUE);
+ gimp_gradient_tool_editor_gradient_info_free (info);
return TRUE;
}
void
-gimp_blend_tool_editor_start_edit (GimpBlendTool *blend_tool)
+gimp_gradient_tool_editor_start_edit (GimpGradientTool *gradient_tool)
{
- if (blend_tool->edit_count++ == 0)
+ if (gradient_tool->edit_count++ == 0)
{
- BlendInfo *info;
+ GradientInfo *info;
- info = gimp_blend_tool_editor_blend_info_new (blend_tool);
+ info = gimp_gradient_tool_editor_gradient_info_new (gradient_tool);
- blend_tool->undo_stack = g_slist_prepend (blend_tool->undo_stack, info);
+ gradient_tool->undo_stack = g_slist_prepend (gradient_tool->undo_stack, info);
/* update the undo actions / menu items */
- if (! blend_tool->flush_idle_id)
+ if (! gradient_tool->flush_idle_id)
{
- blend_tool->flush_idle_id =
- g_idle_add ((GSourceFunc) gimp_blend_tool_editor_flush_idle,
- blend_tool);
+ gradient_tool->flush_idle_id =
+ g_idle_add ((GSourceFunc) gimp_gradient_tool_editor_flush_idle,
+ gradient_tool);
}
}
}
void
-gimp_blend_tool_editor_end_edit (GimpBlendTool *blend_tool,
- gboolean cancel)
+gimp_gradient_tool_editor_end_edit (GimpGradientTool *gradient_tool,
+ gboolean cancel)
{
/* can happen when halting using esc */
- if (blend_tool->edit_count == 0)
+ if (gradient_tool->edit_count == 0)
return;
- if (--blend_tool->edit_count == 0)
+ if (--gradient_tool->edit_count == 0)
{
- BlendInfo *info = blend_tool->undo_stack->data;
+ GradientInfo *info = gradient_tool->undo_stack->data;
info->selected_handle =
- gimp_tool_line_get_selection (GIMP_TOOL_LINE (blend_tool->widget));
+ gimp_tool_line_get_selection (GIMP_TOOL_LINE (gradient_tool->widget));
if (cancel ||
- gimp_blend_tool_editor_blend_info_is_trivial (blend_tool, info))
+ gimp_gradient_tool_editor_gradient_info_is_trivial (gradient_tool, info))
{
/* if the edit is canceled, or if nothing changed, undo the last
* step
*/
- gimp_blend_tool_editor_blend_info_apply (blend_tool, info, FALSE);
+ gimp_gradient_tool_editor_gradient_info_apply (gradient_tool, info, FALSE);
- blend_tool->undo_stack = g_slist_remove (blend_tool->undo_stack,
+ gradient_tool->undo_stack = g_slist_remove (gradient_tool->undo_stack,
info);
- gimp_blend_tool_editor_blend_info_free (info);
+ gimp_gradient_tool_editor_gradient_info_free (info);
}
else
{
/* otherwise, blow the redo stack */
- g_slist_free_full (blend_tool->redo_stack,
- (GDestroyNotify) gimp_blend_tool_editor_blend_info_free);
- blend_tool->redo_stack = NULL;
+ g_slist_free_full (gradient_tool->redo_stack,
+ (GDestroyNotify) gimp_gradient_tool_editor_gradient_info_free);
+ gradient_tool->redo_stack = NULL;
}
/* update the undo actions / menu items */
- if (! blend_tool->flush_idle_id)
+ if (! gradient_tool->flush_idle_id)
{
- blend_tool->flush_idle_id =
- g_idle_add ((GSourceFunc) gimp_blend_tool_editor_flush_idle,
- blend_tool);
+ gradient_tool->flush_idle_id =
+ g_idle_add ((GSourceFunc) gimp_gradient_tool_editor_flush_idle,
+ gradient_tool);
}
}
}
diff --git a/app/tools/gimpgradienttool-editor.h b/app/tools/gimpgradienttool-editor.h
index 3388371..d27a2fd 100644
--- a/app/tools/gimpgradienttool-editor.h
+++ b/app/tools/gimpgradienttool-editor.h
@@ -15,34 +15,34 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __GIMP_BLEND_TOOL_EDITOR_H__
-#define __GIMP_BLEND_TOOL_EDITOR_H__
+#ifndef __GIMP_GRADIENT_TOOL_EDITOR_H__
+#define __GIMP_GRADIENT_TOOL_EDITOR_H__
-void gimp_blend_tool_editor_options_notify (GimpBlendTool *blend_tool,
- GimpToolOptions *options,
- const GParamSpec *pspec);
+void gimp_gradient_tool_editor_options_notify (GimpGradientTool *gradient_tool,
+ GimpToolOptions *options,
+ const GParamSpec *pspec);
-void gimp_blend_tool_editor_start (GimpBlendTool *blend_tool);
-void gimp_blend_tool_editor_halt (GimpBlendTool *blend_tool);
+void gimp_gradient_tool_editor_start (GimpGradientTool *gradient_tool);
+void gimp_gradient_tool_editor_halt (GimpGradientTool *gradient_tool);
-gboolean gimp_blend_tool_editor_line_changed (GimpBlendTool *blend_tool);
+gboolean gimp_gradient_tool_editor_line_changed (GimpGradientTool *gradient_tool);
-void gimp_blend_tool_editor_fg_bg_changed (GimpBlendTool *blend_tool);
+void gimp_gradient_tool_editor_fg_bg_changed (GimpGradientTool *gradient_tool);
-void gimp_blend_tool_editor_gradient_dirty (GimpBlendTool *blend_tool);
+void gimp_gradient_tool_editor_gradient_dirty (GimpGradientTool *gradient_tool);
-void gimp_blend_tool_editor_gradient_changed (GimpBlendTool *blend_tool);
+void gimp_gradient_tool_editor_gradient_changed (GimpGradientTool *gradient_tool);
-const gchar * gimp_blend_tool_editor_can_undo (GimpBlendTool *blend_tool);
-const gchar * gimp_blend_tool_editor_can_redo (GimpBlendTool *blend_tool);
+const gchar * gimp_gradient_tool_editor_can_undo (GimpGradientTool *gradient_tool);
+const gchar * gimp_gradient_tool_editor_can_redo (GimpGradientTool *gradient_tool);
-gboolean gimp_blend_tool_editor_undo (GimpBlendTool *blend_tool);
-gboolean gimp_blend_tool_editor_redo (GimpBlendTool *blend_tool);
+gboolean gimp_gradient_tool_editor_undo (GimpGradientTool *gradient_tool);
+gboolean gimp_gradient_tool_editor_redo (GimpGradientTool *gradient_tool);
-void gimp_blend_tool_editor_start_edit (GimpBlendTool *blend_tool);
-void gimp_blend_tool_editor_end_edit (GimpBlendTool *blend_tool,
- gboolean cancel);
+void gimp_gradient_tool_editor_start_edit (GimpGradientTool *gradient_tool);
+void gimp_gradient_tool_editor_end_edit (GimpGradientTool *gradient_tool,
+ gboolean cancel);
-#endif /* __GIMP_BLEND_TOOL_EDITOR_H__ */
+#endif /* __GIMP_GRADIENT_TOOL_EDITOR_H__ */
diff --git a/app/tools/gimpgradienttool.c b/app/tools/gimpgradienttool.c
index 851d8eb..b66b15b 100644
--- a/app/tools/gimpgradienttool.c
+++ b/app/tools/gimpgradienttool.c
@@ -31,7 +31,7 @@
#include "operations/gimp-operation-config.h"
#include "core/gimpdrawable.h"
-#include "core/gimpdrawable-blend.h"
+#include "core/gimpdrawable-gradient.h"
#include "core/gimpdrawablefilter.h"
#include "core/gimperror.h"
#include "core/gimpgradient.h"
@@ -45,9 +45,9 @@
#include "display/gimpdisplay.h"
#include "display/gimptoolline.h"
-#include "gimpblendoptions.h"
-#include "gimpblendtool.h"
-#include "gimpblendtool-editor.h"
+#include "gimpgradientoptions.h"
+#include "gimpgradienttool.h"
+#include "gimpgradienttool-editor.h"
#include "gimptoolcontrol.h"
#include "gimp-intl.h"
@@ -55,139 +55,139 @@
/* local function prototypes */
-static void gimp_blend_tool_dispose (GObject *object);
-
-static gboolean gimp_blend_tool_initialize (GimpTool *tool,
- GimpDisplay *display,
- GError **error);
-static void gimp_blend_tool_control (GimpTool *tool,
- GimpToolAction action,
- GimpDisplay *display);
-static void gimp_blend_tool_button_press (GimpTool *tool,
- const GimpCoords *coords,
- guint32 time,
- GdkModifierType state,
- GimpButtonPressType press_type,
- GimpDisplay *display);
-static void gimp_blend_tool_button_release (GimpTool *tool,
- const GimpCoords *coords,
- guint32 time,
- GdkModifierType state,
- GimpButtonReleaseType release_type,
- GimpDisplay *display);
-static void gimp_blend_tool_motion (GimpTool *tool,
- const GimpCoords *coords,
- guint32 time,
- GdkModifierType state,
- GimpDisplay *display);
-static gboolean gimp_blend_tool_key_press (GimpTool *tool,
- GdkEventKey *kevent,
- GimpDisplay *display);
-static void gimp_blend_tool_modifier_key (GimpTool *tool,
- GdkModifierType key,
- gboolean press,
- GdkModifierType state,
- GimpDisplay *display);
-static void gimp_blend_tool_cursor_update (GimpTool *tool,
- const GimpCoords *coords,
- GdkModifierType state,
- GimpDisplay *display);
-static const gchar * gimp_blend_tool_can_undo (GimpTool *tool,
- GimpDisplay *display);
-static const gchar * gimp_blend_tool_can_redo (GimpTool *tool,
- GimpDisplay *display);
-static gboolean gimp_blend_tool_undo (GimpTool *tool,
- GimpDisplay *display);
-static gboolean gimp_blend_tool_redo (GimpTool *tool,
- GimpDisplay *display);
-static void gimp_blend_tool_options_notify (GimpTool *tool,
- GimpToolOptions *options,
- const GParamSpec *pspec);
-
-static void gimp_blend_tool_start (GimpBlendTool *blend_tool,
- const GimpCoords *coords,
- GimpDisplay *display);
-static void gimp_blend_tool_halt (GimpBlendTool *blend_tool);
-static void gimp_blend_tool_commit (GimpBlendTool *blend_tool);
-
-static void gimp_blend_tool_line_changed (GimpToolWidget *widget,
- GimpBlendTool *blend_tool);
-static void gimp_blend_tool_line_response (GimpToolWidget *widget,
- gint response_id,
- GimpBlendTool *blend_tool);
-
-static void gimp_blend_tool_precalc_shapeburst (GimpBlendTool *blend_tool);
-
-static void gimp_blend_tool_create_graph (GimpBlendTool *blend_tool);
-static void gimp_blend_tool_update_graph (GimpBlendTool *blend_tool);
-
-static void gimp_blend_tool_fg_bg_changed (GimpBlendTool *blend_tool);
-
-static void gimp_blend_tool_gradient_dirty (GimpBlendTool *blend_tool);
-static void gimp_blend_tool_set_gradient (GimpBlendTool *blend_tool,
- GimpGradient *gradient);
-
-static gboolean gimp_blend_tool_is_shapeburst (GimpBlendTool *blend_tool);
-
-static void gimp_blend_tool_create_filter (GimpBlendTool *blend_tool,
- GimpDrawable *drawable);
-static void gimp_blend_tool_filter_flush (GimpDrawableFilter *filter,
- GimpTool *tool);
-
-
-G_DEFINE_TYPE (GimpBlendTool, gimp_blend_tool, GIMP_TYPE_DRAW_TOOL)
-
-#define parent_class gimp_blend_tool_parent_class
+static void gimp_gradient_tool_dispose (GObject *object);
+
+static gboolean gimp_gradient_tool_initialize (GimpTool *tool,
+ GimpDisplay *display,
+ GError **error);
+static void gimp_gradient_tool_control (GimpTool *tool,
+ GimpToolAction action,
+ GimpDisplay *display);
+static void gimp_gradient_tool_button_press (GimpTool *tool,
+ const GimpCoords *coords,
+ guint32 time,
+ GdkModifierType state,
+ GimpButtonPressType press_type,
+ GimpDisplay *display);
+static void gimp_gradient_tool_button_release (GimpTool *tool,
+ const GimpCoords *coords,
+ guint32 time,
+ GdkModifierType state,
+ GimpButtonReleaseType release_type,
+ GimpDisplay *display);
+static void gimp_gradient_tool_motion (GimpTool *tool,
+ const GimpCoords *coords,
+ guint32 time,
+ GdkModifierType state,
+ GimpDisplay *display);
+static gboolean gimp_gradient_tool_key_press (GimpTool *tool,
+ GdkEventKey *kevent,
+ GimpDisplay *display);
+static void gimp_gradient_tool_modifier_key (GimpTool *tool,
+ GdkModifierType key,
+ gboolean press,
+ GdkModifierType state,
+ GimpDisplay *display);
+static void gimp_gradient_tool_cursor_update (GimpTool *tool,
+ const GimpCoords *coords,
+ GdkModifierType state,
+ GimpDisplay *display);
+static const gchar * gimp_gradient_tool_can_undo (GimpTool *tool,
+ GimpDisplay *display);
+static const gchar * gimp_gradient_tool_can_redo (GimpTool *tool,
+ GimpDisplay *display);
+static gboolean gimp_gradient_tool_undo (GimpTool *tool,
+ GimpDisplay *display);
+static gboolean gimp_gradient_tool_redo (GimpTool *tool,
+ GimpDisplay *display);
+static void gimp_gradient_tool_options_notify (GimpTool *tool,
+ GimpToolOptions *options,
+ const GParamSpec *pspec);
+
+static void gimp_gradient_tool_start (GimpGradientTool *gradient_tool,
+ const GimpCoords *coords,
+ GimpDisplay *display);
+static void gimp_gradient_tool_halt (GimpGradientTool *gradient_tool);
+static void gimp_gradient_tool_commit (GimpGradientTool *gradient_tool);
+
+static void gimp_gradient_tool_line_changed (GimpToolWidget *widget,
+ GimpGradientTool *gradient_tool);
+static void gimp_gradient_tool_line_response (GimpToolWidget *widget,
+ gint response_id,
+ GimpGradientTool *gradient_tool);
+
+static void gimp_gradient_tool_precalc_shapeburst (GimpGradientTool *gradient_tool);
+
+static void gimp_gradient_tool_create_graph (GimpGradientTool *gradient_tool);
+static void gimp_gradient_tool_update_graph (GimpGradientTool *gradient_tool);
+
+static void gimp_gradient_tool_fg_bg_changed (GimpGradientTool *gradient_tool);
+
+static void gimp_gradient_tool_gradient_dirty (GimpGradientTool *gradient_tool);
+static void gimp_gradient_tool_set_gradient (GimpGradientTool *gradient_tool,
+ GimpGradient *gradient);
+
+static gboolean gimp_gradient_tool_is_shapeburst (GimpGradientTool *gradient_tool);
+
+static void gimp_gradient_tool_create_filter (GimpGradientTool *gradient_tool,
+ GimpDrawable *drawable);
+static void gimp_gradient_tool_filter_flush (GimpDrawableFilter *filter,
+ GimpTool *tool);
+
+
+G_DEFINE_TYPE (GimpGradientTool, gimp_gradient_tool, GIMP_TYPE_DRAW_TOOL)
+
+#define parent_class gimp_gradient_tool_parent_class
void
-gimp_blend_tool_register (GimpToolRegisterCallback callback,
- gpointer data)
+gimp_gradient_tool_register (GimpToolRegisterCallback callback,
+ gpointer data)
{
- (* callback) (GIMP_TYPE_BLEND_TOOL,
- GIMP_TYPE_BLEND_OPTIONS,
- gimp_blend_options_gui,
+ (* callback) (GIMP_TYPE_GRADIENT_TOOL,
+ GIMP_TYPE_GRADIENT_OPTIONS,
+ gimp_gradient_options_gui,
GIMP_CONTEXT_PROP_MASK_FOREGROUND |
GIMP_CONTEXT_PROP_MASK_BACKGROUND |
GIMP_CONTEXT_PROP_MASK_OPACITY |
GIMP_CONTEXT_PROP_MASK_PAINT_MODE |
GIMP_CONTEXT_PROP_MASK_GRADIENT,
- "gimp-blend-tool",
- _("Blend"),
- _("Blend Tool: Fill selected area with a color gradient"),
- N_("Blen_d"), "L",
- NULL, GIMP_HELP_TOOL_BLEND,
+ "gimp-gradient-tool",
+ _("Gradient"),
+ _("Gradient Tool: Fill selected area with a color gradient"),
+ N_("Gra_dient"), "G",
+ NULL, GIMP_HELP_TOOL_GRADIENT,
GIMP_ICON_TOOL_GRADIENT,
data);
}
static void
-gimp_blend_tool_class_init (GimpBlendToolClass *klass)
+gimp_gradient_tool_class_init (GimpGradientToolClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
- object_class->dispose = gimp_blend_tool_dispose;
-
- tool_class->initialize = gimp_blend_tool_initialize;
- tool_class->control = gimp_blend_tool_control;
- tool_class->button_press = gimp_blend_tool_button_press;
- tool_class->button_release = gimp_blend_tool_button_release;
- tool_class->motion = gimp_blend_tool_motion;
- tool_class->key_press = gimp_blend_tool_key_press;
- tool_class->modifier_key = gimp_blend_tool_modifier_key;
- tool_class->cursor_update = gimp_blend_tool_cursor_update;
- tool_class->can_undo = gimp_blend_tool_can_undo;
- tool_class->can_redo = gimp_blend_tool_can_redo;
- tool_class->undo = gimp_blend_tool_undo;
- tool_class->redo = gimp_blend_tool_redo;
- tool_class->options_notify = gimp_blend_tool_options_notify;
+ object_class->dispose = gimp_gradient_tool_dispose;
+
+ tool_class->initialize = gimp_gradient_tool_initialize;
+ tool_class->control = gimp_gradient_tool_control;
+ tool_class->button_press = gimp_gradient_tool_button_press;
+ tool_class->button_release = gimp_gradient_tool_button_release;
+ tool_class->motion = gimp_gradient_tool_motion;
+ tool_class->key_press = gimp_gradient_tool_key_press;
+ tool_class->modifier_key = gimp_gradient_tool_modifier_key;
+ tool_class->cursor_update = gimp_gradient_tool_cursor_update;
+ tool_class->can_undo = gimp_gradient_tool_can_undo;
+ tool_class->can_redo = gimp_gradient_tool_can_redo;
+ tool_class->undo = gimp_gradient_tool_undo;
+ tool_class->redo = gimp_gradient_tool_redo;
+ tool_class->options_notify = gimp_gradient_tool_options_notify;
}
static void
-gimp_blend_tool_init (GimpBlendTool *blend_tool)
+gimp_gradient_tool_init (GimpGradientTool *gradient_tool)
{
- GimpTool *tool = GIMP_TOOL (blend_tool);
+ GimpTool *tool = GIMP_TOOL (gradient_tool);
gimp_tool_control_set_scroll_lock (tool->control, TRUE);
gimp_tool_control_set_preserve (tool->control, FALSE);
@@ -214,23 +214,23 @@ gimp_blend_tool_init (GimpBlendTool *blend_tool)
}
static void
-gimp_blend_tool_dispose (GObject *object)
+gimp_gradient_tool_dispose (GObject *object)
{
- GimpBlendTool *blend_tool = GIMP_BLEND_TOOL (object);
+ GimpGradientTool *gradient_tool = GIMP_GRADIENT_TOOL (object);
- gimp_blend_tool_set_gradient (blend_tool, NULL);
+ gimp_gradient_tool_set_gradient (gradient_tool, NULL);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static gboolean
-gimp_blend_tool_initialize (GimpTool *tool,
- GimpDisplay *display,
- GError **error)
+gimp_gradient_tool_initialize (GimpTool *tool,
+ GimpDisplay *display,
+ GError **error)
{
- GimpImage *image = gimp_display_get_image (display);
- GimpDrawable *drawable = gimp_image_get_active_drawable (image);
- GimpBlendOptions *options = GIMP_BLEND_TOOL_GET_OPTIONS (tool);
+ GimpImage *image = gimp_display_get_image (display);
+ GimpDrawable *drawable = gimp_image_get_active_drawable (image);
+ GimpGradientOptions *options = GIMP_GRADIENT_TOOL_GET_OPTIONS (tool);
if (! GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error))
{
@@ -269,11 +269,11 @@ gimp_blend_tool_initialize (GimpTool *tool,
}
static void
-gimp_blend_tool_control (GimpTool *tool,
- GimpToolAction action,
- GimpDisplay *display)
+gimp_gradient_tool_control (GimpTool *tool,
+ GimpToolAction action,
+ GimpDisplay *display)
{
- GimpBlendTool *blend_tool = GIMP_BLEND_TOOL (tool);
+ GimpGradientTool *gradient_tool = GIMP_GRADIENT_TOOL (tool);
switch (action)
{
@@ -282,11 +282,11 @@ gimp_blend_tool_control (GimpTool *tool,
break;
case GIMP_TOOL_ACTION_HALT:
- gimp_blend_tool_halt (blend_tool);
+ gimp_gradient_tool_halt (gradient_tool);
break;
case GIMP_TOOL_ACTION_COMMIT:
- gimp_blend_tool_commit (blend_tool);
+ gimp_gradient_tool_commit (gradient_tool);
break;
}
@@ -294,23 +294,23 @@ gimp_blend_tool_control (GimpTool *tool,
}
static void
-gimp_blend_tool_button_press (GimpTool *tool,
- const GimpCoords *coords,
- guint32 time,
- GdkModifierType state,
- GimpButtonPressType press_type,
- GimpDisplay *display)
+gimp_gradient_tool_button_press (GimpTool *tool,
+ const GimpCoords *coords,
+ guint32 time,
+ GdkModifierType state,
+ GimpButtonPressType press_type,
+ GimpDisplay *display)
{
- GimpBlendTool *blend_tool = GIMP_BLEND_TOOL (tool);
+ GimpGradientTool *gradient_tool = GIMP_GRADIENT_TOOL (tool);
if (tool->display && display != tool->display)
gimp_tool_control (tool, GIMP_TOOL_ACTION_HALT, tool->display);
- if (! blend_tool->widget)
+ if (! gradient_tool->widget)
{
- gimp_blend_tool_start (blend_tool, coords, display);
+ gimp_gradient_tool_start (gradient_tool, coords, display);
- gimp_tool_widget_hover (blend_tool->widget, coords, state, TRUE);
+ gimp_tool_widget_hover (gradient_tool->widget, coords, state, TRUE);
}
/* call start_edit() before widget_button_press(), because we need to record
@@ -319,12 +319,12 @@ gimp_blend_tool_button_press (GimpTool *tool,
* step is created.
*/
if (press_type == GIMP_BUTTON_PRESS_NORMAL)
- gimp_blend_tool_editor_start_edit (blend_tool);
+ gimp_gradient_tool_editor_start_edit (gradient_tool);
- if (gimp_tool_widget_button_press (blend_tool->widget, coords, time, state,
+ if (gimp_tool_widget_button_press (gradient_tool->widget, coords, time, state,
press_type))
{
- blend_tool->grab_widget = blend_tool->widget;
+ gradient_tool->grab_widget = gradient_tool->widget;
}
if (press_type == GIMP_BUTTON_PRESS_NORMAL)
@@ -332,25 +332,25 @@ gimp_blend_tool_button_press (GimpTool *tool,
}
static void
-gimp_blend_tool_button_release (GimpTool *tool,
- const GimpCoords *coords,
- guint32 time,
- GdkModifierType state,
- GimpButtonReleaseType release_type,
- GimpDisplay *display)
+gimp_gradient_tool_button_release (GimpTool *tool,
+ const GimpCoords *coords,
+ guint32 time,
+ GdkModifierType state,
+ GimpButtonReleaseType release_type,
+ GimpDisplay *display)
{
- GimpBlendTool *blend_tool = GIMP_BLEND_TOOL (tool);
- GimpBlendOptions *options = GIMP_BLEND_TOOL_GET_OPTIONS (tool);
+ GimpGradientTool *gradient_tool = GIMP_GRADIENT_TOOL (tool);
+ GimpGradientOptions *options = GIMP_GRADIENT_TOOL_GET_OPTIONS (tool);
gimp_tool_pop_status (tool, display);
gimp_tool_control_halt (tool->control);
- if (blend_tool->grab_widget)
+ if (gradient_tool->grab_widget)
{
- gimp_tool_widget_button_release (blend_tool->grab_widget,
+ gimp_tool_widget_button_release (gradient_tool->grab_widget,
coords, time, state, release_type);
- blend_tool->grab_widget = NULL;
+ gradient_tool->grab_widget = NULL;
if (options->instant)
{
@@ -363,35 +363,35 @@ gimp_blend_tool_button_release (GimpTool *tool,
if (! options->instant)
{
- gimp_blend_tool_editor_end_edit (blend_tool,
- release_type ==
- GIMP_BUTTON_RELEASE_CANCEL);
+ gimp_gradient_tool_editor_end_edit (gradient_tool,
+ release_type ==
+ GIMP_BUTTON_RELEASE_CANCEL);
}
}
static void
-gimp_blend_tool_motion (GimpTool *tool,
- const GimpCoords *coords,
- guint32 time,
- GdkModifierType state,
- GimpDisplay *display)
+gimp_gradient_tool_motion (GimpTool *tool,
+ const GimpCoords *coords,
+ guint32 time,
+ GdkModifierType state,
+ GimpDisplay *display)
{
- GimpBlendTool *blend_tool = GIMP_BLEND_TOOL (tool);
+ GimpGradientTool *gradient_tool = GIMP_GRADIENT_TOOL (tool);
- if (blend_tool->grab_widget)
+ if (gradient_tool->grab_widget)
{
- gimp_tool_widget_motion (blend_tool->grab_widget, coords, time, state);
+ gimp_tool_widget_motion (gradient_tool->grab_widget, coords, time, state);
}
}
static gboolean
-gimp_blend_tool_key_press (GimpTool *tool,
- GdkEventKey *kevent,
- GimpDisplay *display)
+gimp_gradient_tool_key_press (GimpTool *tool,
+ GdkEventKey *kevent,
+ GimpDisplay *display)
{
- GimpBlendTool *blend_tool = GIMP_BLEND_TOOL (tool);
- GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
- gboolean result;
+ GimpGradientTool *gradient_tool = GIMP_GRADIENT_TOOL (tool);
+ GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
+ gboolean result;
/* call start_edit() before widget_key_press(), because we need to record the
* undo state before widget_key_press() potentially changes it. note that if
@@ -399,24 +399,24 @@ gimp_blend_tool_key_press (GimpTool *tool,
* created.
*/
if (display == draw_tool->display)
- gimp_blend_tool_editor_start_edit (blend_tool);
+ gimp_gradient_tool_editor_start_edit (gradient_tool);
result = GIMP_TOOL_CLASS (parent_class)->key_press (tool, kevent, display);
if (display == draw_tool->display)
- gimp_blend_tool_editor_end_edit (blend_tool, FALSE);
+ gimp_gradient_tool_editor_end_edit (gradient_tool, FALSE);
return result;
}
static void
-gimp_blend_tool_modifier_key (GimpTool *tool,
- GdkModifierType key,
- gboolean press,
- GdkModifierType state,
- GimpDisplay *display)
+gimp_gradient_tool_modifier_key (GimpTool *tool,
+ GdkModifierType key,
+ gboolean press,
+ GdkModifierType state,
+ GimpDisplay *display)
{
- GimpBlendOptions *options = GIMP_BLEND_TOOL_GET_OPTIONS (tool);
+ GimpGradientOptions *options = GIMP_GRADIENT_TOOL_GET_OPTIONS (tool);
if (key == gimp_get_extend_selection_mask ())
{
@@ -431,10 +431,10 @@ gimp_blend_tool_modifier_key (GimpTool *tool,
}
static void
-gimp_blend_tool_cursor_update (GimpTool *tool,
- const GimpCoords *coords,
- GdkModifierType state,
- GimpDisplay *display)
+gimp_gradient_tool_cursor_update (GimpTool *tool,
+ const GimpCoords *coords,
+ GdkModifierType state,
+ GimpDisplay *display)
{
GimpImage *image = gimp_display_get_image (display);
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
@@ -454,50 +454,50 @@ gimp_blend_tool_cursor_update (GimpTool *tool,
}
static const gchar *
-gimp_blend_tool_can_undo (GimpTool *tool,
- GimpDisplay *display)
+gimp_gradient_tool_can_undo (GimpTool *tool,
+ GimpDisplay *display)
{
- return gimp_blend_tool_editor_can_undo (GIMP_BLEND_TOOL (tool));
+ return gimp_gradient_tool_editor_can_undo (GIMP_GRADIENT_TOOL (tool));
}
static const gchar *
-gimp_blend_tool_can_redo (GimpTool *tool,
- GimpDisplay *display)
+gimp_gradient_tool_can_redo (GimpTool *tool,
+ GimpDisplay *display)
{
- return gimp_blend_tool_editor_can_redo (GIMP_BLEND_TOOL (tool));
+ return gimp_gradient_tool_editor_can_redo (GIMP_GRADIENT_TOOL (tool));
}
static gboolean
-gimp_blend_tool_undo (GimpTool *tool,
- GimpDisplay *display)
+gimp_gradient_tool_undo (GimpTool *tool,
+ GimpDisplay *display)
{
- return gimp_blend_tool_editor_undo (GIMP_BLEND_TOOL (tool));
+ return gimp_gradient_tool_editor_undo (GIMP_GRADIENT_TOOL (tool));
}
static gboolean
-gimp_blend_tool_redo (GimpTool *tool,
- GimpDisplay *display)
+gimp_gradient_tool_redo (GimpTool *tool,
+ GimpDisplay *display)
{
- return gimp_blend_tool_editor_redo (GIMP_BLEND_TOOL (tool));
+ return gimp_gradient_tool_editor_redo (GIMP_GRADIENT_TOOL (tool));
}
static void
-gimp_blend_tool_options_notify (GimpTool *tool,
- GimpToolOptions *options,
- const GParamSpec *pspec)
+gimp_gradient_tool_options_notify (GimpTool *tool,
+ GimpToolOptions *options,
+ const GParamSpec *pspec)
{
GimpContext *context = GIMP_CONTEXT (options);
- GimpBlendTool *blend_tool = GIMP_BLEND_TOOL (tool);
+ GimpGradientTool *gradient_tool = GIMP_GRADIENT_TOOL (tool);
if (! strcmp (pspec->name, "gradient"))
{
- gimp_blend_tool_set_gradient (blend_tool, context->gradient);
+ gimp_gradient_tool_set_gradient (gradient_tool, context->gradient);
- if (blend_tool->filter)
- gimp_drawable_filter_apply (blend_tool->filter, NULL);
+ if (gradient_tool->filter)
+ gimp_drawable_filter_apply (gradient_tool->filter, NULL);
}
- else if (blend_tool->render_node &&
- gegl_node_find_property (blend_tool->render_node, pspec->name))
+ else if (gradient_tool->render_node &&
+ gegl_node_find_property (gradient_tool->render_node, pspec->name))
{
/* Sync any property changes on the config object that match the op */
GValue value = G_VALUE_INIT;
@@ -505,7 +505,7 @@ gimp_blend_tool_options_notify (GimpTool *tool,
g_value_init (&value, pspec->value_type);
g_object_get_property (G_OBJECT (options), pspec->name, &value);
- gegl_node_set_property (blend_tool->render_node, pspec->name, &value);
+ gegl_node_set_property (gradient_tool->render_node, pspec->name, &value);
g_value_unset (&value);
@@ -516,8 +516,8 @@ gimp_blend_tool_options_notify (GimpTool *tool,
GimpGradientType gradient_type;
gradient_repeat = GIMP_PAINT_OPTIONS (options)->gradient_options->gradient_repeat;
- gradient_type = GIMP_BLEND_OPTIONS (options)->gradient_type;
- gegl_node_get (blend_tool->render_node,
+ gradient_type = GIMP_GRADIENT_OPTIONS (options)->gradient_type;
+ gegl_node_get (gradient_tool->render_node,
"gradient-repeat", &node_repeat,
NULL);
@@ -525,73 +525,73 @@ gimp_blend_tool_options_notify (GimpTool *tool,
{
/* These gradient types are only meant to work with repeat
* value of "none" so these are the only ones where we
- * don't keep the render node and the blend options in
+ * don't keep the render node and the gradient options in
* sync.
* We could instead reset the "gradient-repeat" value on
- * GimpBlendOptions, but I assume one would want to revert
+ * GimpGradientOptions, but I assume one would want to revert
* back to the last set value if changing back the
* gradient type. So instead we just make the option
* insensitive (both in GUI and in render).
*/
if (node_repeat != GIMP_REPEAT_NONE)
- gegl_node_set (blend_tool->render_node,
+ gegl_node_set (gradient_tool->render_node,
"gradient-repeat", GIMP_REPEAT_NONE,
NULL);
}
else if (node_repeat != gradient_repeat)
{
- gegl_node_set (blend_tool->render_node,
+ gegl_node_set (gradient_tool->render_node,
"gradient-repeat", gradient_repeat,
NULL);
}
- if (gimp_blend_tool_is_shapeburst (blend_tool))
- gimp_blend_tool_precalc_shapeburst (blend_tool);
+ if (gimp_gradient_tool_is_shapeburst (gradient_tool))
+ gimp_gradient_tool_precalc_shapeburst (gradient_tool);
- gimp_blend_tool_update_graph (blend_tool);
+ gimp_gradient_tool_update_graph (gradient_tool);
}
- gimp_drawable_filter_apply (blend_tool->filter, NULL);
+ gimp_drawable_filter_apply (gradient_tool->filter, NULL);
}
- else if (blend_tool->render_node &&
- gimp_blend_tool_is_shapeburst (blend_tool) &&
+ else if (gradient_tool->render_node &&
+ gimp_gradient_tool_is_shapeburst (gradient_tool) &&
g_strcmp0 (pspec->name, "distance-metric") == 0)
{
- g_clear_object (&blend_tool->dist_buffer);
- gimp_blend_tool_precalc_shapeburst (blend_tool);
- gimp_blend_tool_update_graph (blend_tool);
- gimp_drawable_filter_apply (blend_tool->filter, NULL);
+ g_clear_object (&gradient_tool->dist_buffer);
+ gimp_gradient_tool_precalc_shapeburst (gradient_tool);
+ gimp_gradient_tool_update_graph (gradient_tool);
+ gimp_drawable_filter_apply (gradient_tool->filter, NULL);
}
- else if (blend_tool->filter &&
+ else if (gradient_tool->filter &&
! strcmp (pspec->name, "opacity"))
{
- gimp_drawable_filter_set_opacity (blend_tool->filter,
+ gimp_drawable_filter_set_opacity (gradient_tool->filter,
gimp_context_get_opacity (context));
}
- else if (blend_tool->filter &&
+ else if (gradient_tool->filter &&
! strcmp (pspec->name, "paint-mode"))
{
- gimp_drawable_filter_set_mode (blend_tool->filter,
+ gimp_drawable_filter_set_mode (gradient_tool->filter,
gimp_context_get_paint_mode (context),
GIMP_LAYER_COLOR_SPACE_AUTO,
GIMP_LAYER_COLOR_SPACE_AUTO,
GIMP_LAYER_COMPOSITE_AUTO);
}
- gimp_blend_tool_editor_options_notify (blend_tool, options, pspec);
+ gimp_gradient_tool_editor_options_notify (gradient_tool, options, pspec);
}
static void
-gimp_blend_tool_start (GimpBlendTool *blend_tool,
- const GimpCoords *coords,
- GimpDisplay *display)
+gimp_gradient_tool_start (GimpGradientTool *gradient_tool,
+ const GimpCoords *coords,
+ GimpDisplay *display)
{
- GimpTool *tool = GIMP_TOOL (blend_tool);
- GimpDisplayShell *shell = gimp_display_get_shell (display);
- GimpImage *image = gimp_display_get_image (display);
- GimpDrawable *drawable = gimp_image_get_active_drawable (image);
- GimpBlendOptions *options = GIMP_BLEND_TOOL_GET_OPTIONS (blend_tool);
- GimpContext *context = GIMP_CONTEXT (options);
+ GimpTool *tool = GIMP_TOOL (gradient_tool);
+ GimpDisplayShell *shell = gimp_display_get_shell (display);
+ GimpImage *image = gimp_display_get_image (display);
+ GimpDrawable *drawable = gimp_image_get_active_drawable (image);
+ GimpGradientOptions *options = GIMP_GRADIENT_TOOL_GET_OPTIONS (gradient_tool);
+ GimpContext *context = GIMP_CONTEXT (options);
if (options->instant_toggle)
gtk_widget_set_sensitive (options->instant_toggle, FALSE);
@@ -599,109 +599,109 @@ gimp_blend_tool_start (GimpBlendTool *blend_tool,
tool->display = display;
tool->drawable = drawable;
- blend_tool->start_x = coords->x;
- blend_tool->start_y = coords->y;
- blend_tool->end_x = coords->x;
- blend_tool->end_y = coords->y;
+ gradient_tool->start_x = coords->x;
+ gradient_tool->start_y = coords->y;
+ gradient_tool->end_x = coords->x;
+ gradient_tool->end_y = coords->y;
- blend_tool->widget = gimp_tool_line_new (shell,
- blend_tool->start_x,
- blend_tool->start_y,
- blend_tool->end_x,
- blend_tool->end_y);
+ gradient_tool->widget = gimp_tool_line_new (shell,
+ gradient_tool->start_x,
+ gradient_tool->start_y,
+ gradient_tool->end_x,
+ gradient_tool->end_y);
- g_object_set (blend_tool->widget,
- "status-title", _("Blend: "),
+ g_object_set (gradient_tool->widget,
+ "status-title", _("Gradient: "),
NULL);
- gimp_draw_tool_set_widget (GIMP_DRAW_TOOL (tool), blend_tool->widget);
+ gimp_draw_tool_set_widget (GIMP_DRAW_TOOL (tool), gradient_tool->widget);
- g_signal_connect (blend_tool->widget, "changed",
- G_CALLBACK (gimp_blend_tool_line_changed),
- blend_tool);
- g_signal_connect (blend_tool->widget, "response",
- G_CALLBACK (gimp_blend_tool_line_response),
- blend_tool);
+ g_signal_connect (gradient_tool->widget, "changed",
+ G_CALLBACK (gimp_gradient_tool_line_changed),
+ gradient_tool);
+ g_signal_connect (gradient_tool->widget, "response",
+ G_CALLBACK (gimp_gradient_tool_line_response),
+ gradient_tool);
g_signal_connect_swapped (context, "background-changed",
- G_CALLBACK (gimp_blend_tool_fg_bg_changed),
- blend_tool);
+ G_CALLBACK (gimp_gradient_tool_fg_bg_changed),
+ gradient_tool);
g_signal_connect_swapped (context, "foreground-changed",
- G_CALLBACK (gimp_blend_tool_fg_bg_changed),
- blend_tool);
+ G_CALLBACK (gimp_gradient_tool_fg_bg_changed),
+ gradient_tool);
- gimp_blend_tool_create_filter (blend_tool, drawable);
+ gimp_gradient_tool_create_filter (gradient_tool, drawable);
/* Initially sync all of the properties */
gimp_operation_config_sync_node (G_OBJECT (options),
- blend_tool->render_node);
+ gradient_tool->render_node);
/* We don't allow repeat values for some shapes. */
if (options->gradient_type >= GIMP_GRADIENT_SHAPEBURST_ANGULAR)
- gegl_node_set (blend_tool->render_node,
+ gegl_node_set (gradient_tool->render_node,
"gradient-repeat", GIMP_REPEAT_NONE,
NULL);
/* Connect signal handlers for the gradient */
- gimp_blend_tool_set_gradient (blend_tool, context->gradient);
+ gimp_gradient_tool_set_gradient (gradient_tool, context->gradient);
- if (gimp_blend_tool_is_shapeburst (blend_tool))
- gimp_blend_tool_precalc_shapeburst (blend_tool);
+ if (gimp_gradient_tool_is_shapeburst (gradient_tool))
+ gimp_gradient_tool_precalc_shapeburst (gradient_tool);
- gimp_draw_tool_start (GIMP_DRAW_TOOL (blend_tool), display);
+ gimp_draw_tool_start (GIMP_DRAW_TOOL (gradient_tool), display);
- gimp_blend_tool_editor_start (blend_tool);
+ gimp_gradient_tool_editor_start (gradient_tool);
}
static void
-gimp_blend_tool_halt (GimpBlendTool *blend_tool)
+gimp_gradient_tool_halt (GimpGradientTool *gradient_tool)
{
- GimpTool *tool = GIMP_TOOL (blend_tool);
- GimpBlendOptions *options = GIMP_BLEND_TOOL_GET_OPTIONS (blend_tool);
- GimpContext *context = GIMP_CONTEXT (options);
+ GimpTool *tool = GIMP_TOOL (gradient_tool);
+ GimpGradientOptions *options = GIMP_GRADIENT_TOOL_GET_OPTIONS (gradient_tool);
+ GimpContext *context = GIMP_CONTEXT (options);
- gimp_blend_tool_editor_halt (blend_tool);
+ gimp_gradient_tool_editor_halt (gradient_tool);
- if (blend_tool->graph)
+ if (gradient_tool->graph)
{
- g_clear_object (&blend_tool->graph);
- blend_tool->render_node = NULL;
+ g_clear_object (&gradient_tool->graph);
+ gradient_tool->render_node = NULL;
#if 0
- blend_tool->subtract_node = NULL;
- blend_tool->divide_node = NULL;
+ gradient_tool->subtract_node = NULL;
+ gradient_tool->divide_node = NULL;
#endif
- blend_tool->dist_node = NULL;
+ gradient_tool->dist_node = NULL;
}
- g_clear_object (&blend_tool->dist_buffer);
+ g_clear_object (&gradient_tool->dist_buffer);
- if (blend_tool->filter)
+ if (gradient_tool->filter)
{
gimp_tool_control_push_preserve (tool->control, TRUE);
- gimp_drawable_filter_abort (blend_tool->filter);
- g_object_unref (blend_tool->filter);
- blend_tool->filter = NULL;
+ gimp_drawable_filter_abort (gradient_tool->filter);
+ g_object_unref (gradient_tool->filter);
+ gradient_tool->filter = NULL;
gimp_tool_control_pop_preserve (tool->control);
gimp_image_flush (gimp_display_get_image (tool->display));
}
- gimp_blend_tool_set_tentative_gradient (blend_tool, NULL);
+ gimp_gradient_tool_set_tentative_gradient (gradient_tool, NULL);
g_signal_handlers_disconnect_by_func (context,
- G_CALLBACK (gimp_blend_tool_fg_bg_changed),
- blend_tool);
+ G_CALLBACK (gimp_gradient_tool_fg_bg_changed),
+ gradient_tool);
if (tool->display)
gimp_tool_pop_status (tool, tool->display);
- if (gimp_draw_tool_is_active (GIMP_DRAW_TOOL (blend_tool)))
- gimp_draw_tool_stop (GIMP_DRAW_TOOL (blend_tool));
+ if (gimp_draw_tool_is_active (GIMP_DRAW_TOOL (gradient_tool)))
+ gimp_draw_tool_stop (GIMP_DRAW_TOOL (gradient_tool));
gimp_draw_tool_set_widget (GIMP_DRAW_TOOL (tool), NULL);
- g_clear_object (&blend_tool->widget);
+ g_clear_object (&gradient_tool->widget);
tool->display = NULL;
tool->drawable = NULL;
@@ -711,17 +711,17 @@ gimp_blend_tool_halt (GimpBlendTool *blend_tool)
}
static void
-gimp_blend_tool_commit (GimpBlendTool *blend_tool)
+gimp_gradient_tool_commit (GimpGradientTool *gradient_tool)
{
- GimpTool *tool = GIMP_TOOL (blend_tool);
+ GimpTool *tool = GIMP_TOOL (gradient_tool);
- if (blend_tool->filter)
+ if (gradient_tool->filter)
{
gimp_tool_control_push_preserve (tool->control, TRUE);
- gimp_drawable_filter_commit (blend_tool->filter,
+ gimp_drawable_filter_commit (gradient_tool->filter,
GIMP_PROGRESS (tool), FALSE);
- g_clear_object (&blend_tool->filter);
+ g_clear_object (&gradient_tool->filter);
gimp_tool_control_pop_preserve (tool->control);
@@ -730,8 +730,8 @@ gimp_blend_tool_commit (GimpBlendTool *blend_tool)
}
static void
-gimp_blend_tool_line_changed (GimpToolWidget *widget,
- GimpBlendTool *blend_tool)
+gimp_gradient_tool_line_changed (GimpToolWidget *widget,
+ GimpGradientTool *gradient_tool)
{
gdouble start_x;
gdouble start_y;
@@ -746,35 +746,35 @@ gimp_blend_tool_line_changed (GimpToolWidget *widget,
"y2", &end_y,
NULL);
- if (start_x != blend_tool->start_x ||
- start_y != blend_tool->start_y ||
- end_x != blend_tool->end_x ||
- end_y != blend_tool->end_y)
+ if (start_x != gradient_tool->start_x ||
+ start_y != gradient_tool->start_y ||
+ end_x != gradient_tool->end_x ||
+ end_y != gradient_tool->end_y)
{
- blend_tool->start_x = start_x;
- blend_tool->start_y = start_y;
- blend_tool->end_x = end_x;
- blend_tool->end_y = end_y;
+ gradient_tool->start_x = start_x;
+ gradient_tool->start_y = start_y;
+ gradient_tool->end_x = end_x;
+ gradient_tool->end_y = end_y;
update = TRUE;
}
- if (gimp_blend_tool_editor_line_changed (blend_tool))
+ if (gimp_gradient_tool_editor_line_changed (gradient_tool))
update = TRUE;
if (update)
{
- gimp_blend_tool_update_graph (blend_tool);
- gimp_drawable_filter_apply (blend_tool->filter, NULL);
+ gimp_gradient_tool_update_graph (gradient_tool);
+ gimp_drawable_filter_apply (gradient_tool->filter, NULL);
}
}
static void
-gimp_blend_tool_line_response (GimpToolWidget *widget,
- gint response_id,
- GimpBlendTool *blend_tool)
+gimp_gradient_tool_line_response (GimpToolWidget *widget,
+ gint response_id,
+ GimpGradientTool *gradient_tool)
{
- GimpTool *tool = GIMP_TOOL (blend_tool);
+ GimpTool *tool = GIMP_TOOL (gradient_tool);
switch (response_id)
{
@@ -789,118 +789,119 @@ gimp_blend_tool_line_response (GimpToolWidget *widget,
}
static void
-gimp_blend_tool_precalc_shapeburst (GimpBlendTool *blend_tool)
+gimp_gradient_tool_precalc_shapeburst (GimpGradientTool *gradient_tool)
{
- GimpBlendOptions *options = GIMP_BLEND_TOOL_GET_OPTIONS (blend_tool);
- GimpTool *tool = GIMP_TOOL (blend_tool);
- gint x, y, width, height;
+ GimpGradientOptions *options = GIMP_GRADIENT_TOOL_GET_OPTIONS (gradient_tool);
+ GimpTool *tool = GIMP_TOOL (gradient_tool);
+ gint x, y, width, height;
- if (blend_tool->dist_buffer || ! tool->drawable)
+ if (gradient_tool->dist_buffer || ! tool->drawable)
return;
if (! gimp_item_mask_intersect (GIMP_ITEM (tool->drawable),
&x, &y, &width, &height))
return;
- blend_tool->dist_buffer =
- gimp_drawable_blend_shapeburst_distmap (tool->drawable, options->distance_metric,
- GEGL_RECTANGLE (x, y, width, height),
- GIMP_PROGRESS (blend_tool));
+ gradient_tool->dist_buffer =
+ gimp_drawable_gradient_shapeburst_distmap (tool->drawable,
+ options->distance_metric,
+ GEGL_RECTANGLE (x, y, width, height),
+ GIMP_PROGRESS (gradient_tool));
- if (blend_tool->dist_node)
- gegl_node_set (blend_tool->dist_node,
- "buffer", blend_tool->dist_buffer,
+ if (gradient_tool->dist_node)
+ gegl_node_set (gradient_tool->dist_node,
+ "buffer", gradient_tool->dist_buffer,
NULL);
- gimp_progress_end (GIMP_PROGRESS (blend_tool));
+ gimp_progress_end (GIMP_PROGRESS (gradient_tool));
}
/* gegl graph stuff */
static void
-gimp_blend_tool_create_graph (GimpBlendTool *blend_tool)
+gimp_gradient_tool_create_graph (GimpGradientTool *gradient_tool)
{
- GimpBlendOptions *options = GIMP_BLEND_TOOL_GET_OPTIONS (blend_tool);
- GimpContext *context = GIMP_CONTEXT (options);
- GeglNode *output;
+ GimpGradientOptions *options = GIMP_GRADIENT_TOOL_GET_OPTIONS (gradient_tool);
+ GimpContext *context = GIMP_CONTEXT (options);
+ GeglNode *output;
/* render_node is not supposed to be recreated */
- g_return_if_fail (blend_tool->graph == NULL);
+ g_return_if_fail (gradient_tool->graph == NULL);
- blend_tool->graph = gegl_node_new ();
+ gradient_tool->graph = gegl_node_new ();
- blend_tool->dist_node =
- gegl_node_new_child (blend_tool->graph,
+ gradient_tool->dist_node =
+ gegl_node_new_child (gradient_tool->graph,
"operation", "gegl:buffer-source",
- "buffer", blend_tool->dist_buffer,
+ "buffer", gradient_tool->dist_buffer,
NULL);
#if 0
- blend_tool->subtract_node =
- gegl_node_new_child (blend_tool->graph,
+ gradient_tool->subtract_node =
+ gegl_node_new_child (gradient_tool->graph,
"operation", "gegl:subtract",
NULL);
- blend_tool->divide_node =
- gegl_node_new_child (blend_tool->graph,
+ gradient_tool->divide_node =
+ gegl_node_new_child (gradient_tool->graph,
"operation", "gegl:divide",
NULL);
#endif
- blend_tool->render_node =
- gegl_node_new_child (blend_tool->graph,
+ gradient_tool->render_node =
+ gegl_node_new_child (gradient_tool->graph,
"operation", "gimp:gradient",
"context", context,
NULL);
- output = gegl_node_get_output_proxy (blend_tool->graph, "output");
+ output = gegl_node_get_output_proxy (gradient_tool->graph, "output");
- gegl_node_link_many (blend_tool->dist_node,
+ gegl_node_link_many (gradient_tool->dist_node,
#if 0
- blend_tool->subtract_node,
- blend_tool->divide_node,
+ gradient_tool->subtract_node,
+ gradient_tool->divide_node,
#endif
- blend_tool->render_node,
+ gradient_tool->render_node,
output,
NULL);
- gimp_blend_tool_update_graph (blend_tool);
+ gimp_gradient_tool_update_graph (gradient_tool);
}
static void
-gimp_blend_tool_update_graph (GimpBlendTool *blend_tool)
+gimp_gradient_tool_update_graph (GimpGradientTool *gradient_tool)
{
- GimpTool *tool = GIMP_TOOL (blend_tool);
+ GimpTool *tool = GIMP_TOOL (gradient_tool);
gint off_x, off_y;
gimp_item_get_offset (GIMP_ITEM (tool->drawable), &off_x, &off_y);
#if 0
- if (gimp_blend_tool_is_shapeburst (blend_tool))
+ if (gimp_gradient_tool_is_shapeburst (gradient_tool))
{
gfloat start, end;
- gegl_buffer_get (blend_tool->dist_buffer,
- GEGL_RECTANGLE (blend_tool->start_x - off_x,
- blend_tool->start_y - off_y,
+ gegl_buffer_get (gradient_tool->dist_buffer,
+ GEGL_RECTANGLE (gradient_tool->start_x - off_x,
+ gradient_tool->start_y - off_y,
1, 1),
1.0, babl_format("Y float"), &start,
GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_NONE);
- gegl_buffer_get (blend_tool->dist_buffer,
- GEGL_RECTANGLE (blend_tool->end_x - off_x,
- blend_tool->end_y - off_y,
+ gegl_buffer_get (gradient_tool->dist_buffer,
+ GEGL_RECTANGLE (gradient_tool->end_x - off_x,
+ gradient_tool->end_y - off_y,
1, 1),
1.0, babl_format("Y float"), &end,
GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_NONE);
if (start != end)
{
- gegl_node_set (blend_tool->subtract_node,
+ gegl_node_set (gradient_tool->subtract_node,
"value", (gdouble) start,
NULL);
- gegl_node_set (blend_tool->divide_node,
+ gegl_node_set (gradient_tool->divide_node,
"value", (gdouble) (end - start),
NULL);
}
@@ -908,91 +909,91 @@ gimp_blend_tool_update_graph (GimpBlendTool *blend_tool)
else
#endif
{
- gegl_node_set (blend_tool->render_node,
- "start_x", blend_tool->start_x - off_x,
- "start_y", blend_tool->start_y - off_y,
- "end_x", blend_tool->end_x - off_x,
- "end_y", blend_tool->end_y - off_y,
+ gegl_node_set (gradient_tool->render_node,
+ "start_x", gradient_tool->start_x - off_x,
+ "start_y", gradient_tool->start_y - off_y,
+ "end_x", gradient_tool->end_x - off_x,
+ "end_y", gradient_tool->end_y - off_y,
NULL);
}
}
static void
-gimp_blend_tool_fg_bg_changed (GimpBlendTool *blend_tool)
+gimp_gradient_tool_fg_bg_changed (GimpGradientTool *gradient_tool)
{
- if (! blend_tool->filter || ! blend_tool->gradient)
+ if (! gradient_tool->filter || ! gradient_tool->gradient)
return;
- if (gimp_gradient_has_fg_bg_segments (blend_tool->gradient))
+ if (gimp_gradient_has_fg_bg_segments (gradient_tool->gradient))
{
/* Set a property on the node. Otherwise it will cache and refuse to update */
- gegl_node_set (blend_tool->render_node,
- "gradient", blend_tool->gradient,
+ gegl_node_set (gradient_tool->render_node,
+ "gradient", gradient_tool->gradient,
NULL);
/* Update the filter */
- gimp_drawable_filter_apply (blend_tool->filter, NULL);
+ gimp_drawable_filter_apply (gradient_tool->filter, NULL);
- gimp_blend_tool_editor_fg_bg_changed (blend_tool);
+ gimp_gradient_tool_editor_fg_bg_changed (gradient_tool);
}
}
static void
-gimp_blend_tool_gradient_dirty (GimpBlendTool *blend_tool)
+gimp_gradient_tool_gradient_dirty (GimpGradientTool *gradient_tool)
{
- if (! blend_tool->filter)
+ if (! gradient_tool->filter)
return;
- if (! blend_tool->tentative_gradient)
+ if (! gradient_tool->tentative_gradient)
{
/* Set a property on the node. Otherwise it will cache and refuse to update */
- gegl_node_set (blend_tool->render_node,
- "gradient", blend_tool->gradient,
+ gegl_node_set (gradient_tool->render_node,
+ "gradient", gradient_tool->gradient,
NULL);
/* Update the filter */
- gimp_drawable_filter_apply (blend_tool->filter, NULL);
+ gimp_drawable_filter_apply (gradient_tool->filter, NULL);
}
- gimp_blend_tool_editor_gradient_dirty (blend_tool);
+ gimp_gradient_tool_editor_gradient_dirty (gradient_tool);
}
static void
-gimp_blend_tool_set_gradient (GimpBlendTool *blend_tool,
- GimpGradient *gradient)
+gimp_gradient_tool_set_gradient (GimpGradientTool *gradient_tool,
+ GimpGradient *gradient)
{
- if (blend_tool->gradient)
+ if (gradient_tool->gradient)
{
- g_signal_handlers_disconnect_by_func (blend_tool->gradient,
- G_CALLBACK (gimp_blend_tool_gradient_dirty),
- blend_tool);
+ g_signal_handlers_disconnect_by_func (gradient_tool->gradient,
+ G_CALLBACK (gimp_gradient_tool_gradient_dirty),
+ gradient_tool);
- g_object_unref (blend_tool->gradient);
+ g_object_unref (gradient_tool->gradient);
}
- blend_tool->gradient = gradient;
+ gradient_tool->gradient = gradient;
- if (blend_tool->gradient)
+ if (gradient_tool->gradient)
{
g_object_ref (gradient);
- g_signal_connect_swapped (blend_tool->gradient, "dirty",
- G_CALLBACK (gimp_blend_tool_gradient_dirty),
- blend_tool);
+ g_signal_connect_swapped (gradient_tool->gradient, "dirty",
+ G_CALLBACK (gimp_gradient_tool_gradient_dirty),
+ gradient_tool);
- if (blend_tool->render_node)
- gegl_node_set (blend_tool->render_node,
- "gradient", blend_tool->gradient,
+ if (gradient_tool->render_node)
+ gegl_node_set (gradient_tool->render_node,
+ "gradient", gradient_tool->gradient,
NULL);
}
- gimp_blend_tool_editor_gradient_changed (blend_tool);
+ gimp_gradient_tool_editor_gradient_changed (gradient_tool);
}
static gboolean
-gimp_blend_tool_is_shapeburst (GimpBlendTool *blend_tool)
+gimp_gradient_tool_is_shapeburst (GimpGradientTool *gradient_tool)
{
- GimpBlendOptions *options = GIMP_BLEND_TOOL_GET_OPTIONS (blend_tool);
+ GimpGradientOptions *options = GIMP_GRADIENT_TOOL_GET_OPTIONS (gradient_tool);
return options->gradient_type >= GIMP_GRADIENT_SHAPEBURST_ANGULAR &&
options->gradient_type <= GIMP_GRADIENT_SHAPEBURST_DIMPLED;
@@ -1002,38 +1003,38 @@ gimp_blend_tool_is_shapeburst (GimpBlendTool *blend_tool)
/* image map stuff */
static void
-gimp_blend_tool_create_filter (GimpBlendTool *blend_tool,
- GimpDrawable *drawable)
+gimp_gradient_tool_create_filter (GimpGradientTool *gradient_tool,
+ GimpDrawable *drawable)
{
- GimpBlendOptions *options = GIMP_BLEND_TOOL_GET_OPTIONS (blend_tool);
- GimpContext *context = GIMP_CONTEXT (options);
+ GimpGradientOptions *options = GIMP_GRADIENT_TOOL_GET_OPTIONS (gradient_tool);
+ GimpContext *context = GIMP_CONTEXT (options);
- if (! blend_tool->graph)
- gimp_blend_tool_create_graph (blend_tool);
+ if (! gradient_tool->graph)
+ gimp_gradient_tool_create_graph (gradient_tool);
- blend_tool->filter = gimp_drawable_filter_new (drawable,
- C_("undo-type", "Blend"),
- blend_tool->graph,
+ gradient_tool->filter = gimp_drawable_filter_new (drawable,
+ C_("undo-type", "Gradient"),
+ gradient_tool->graph,
GIMP_ICON_TOOL_GRADIENT);
- gimp_drawable_filter_set_region (blend_tool->filter,
+ gimp_drawable_filter_set_region (gradient_tool->filter,
GIMP_FILTER_REGION_DRAWABLE);
- gimp_drawable_filter_set_opacity (blend_tool->filter,
+ gimp_drawable_filter_set_opacity (gradient_tool->filter,
gimp_context_get_opacity (context));
- gimp_drawable_filter_set_mode (blend_tool->filter,
+ gimp_drawable_filter_set_mode (gradient_tool->filter,
gimp_context_get_paint_mode (context),
GIMP_LAYER_COLOR_SPACE_AUTO,
GIMP_LAYER_COLOR_SPACE_AUTO,
GIMP_LAYER_COMPOSITE_AUTO);
- g_signal_connect (blend_tool->filter, "flush",
- G_CALLBACK (gimp_blend_tool_filter_flush),
- blend_tool);
+ g_signal_connect (gradient_tool->filter, "flush",
+ G_CALLBACK (gimp_gradient_tool_filter_flush),
+ gradient_tool);
}
static void
-gimp_blend_tool_filter_flush (GimpDrawableFilter *filter,
- GimpTool *tool)
+gimp_gradient_tool_filter_flush (GimpDrawableFilter *filter,
+ GimpTool *tool)
{
GimpImage *image = gimp_display_get_image (tool->display);
@@ -1045,28 +1046,28 @@ gimp_blend_tool_filter_flush (GimpDrawableFilter *filter,
void
-gimp_blend_tool_set_tentative_gradient (GimpBlendTool *blend_tool,
- GimpGradient *gradient)
+gimp_gradient_tool_set_tentative_gradient (GimpGradientTool *gradient_tool,
+ GimpGradient *gradient)
{
- g_return_if_fail (GIMP_IS_BLEND_TOOL (blend_tool));
+ g_return_if_fail (GIMP_IS_GRADIENT_TOOL (gradient_tool));
g_return_if_fail (gradient == NULL || GIMP_IS_GRADIENT (gradient));
- if (gradient != blend_tool->tentative_gradient)
+ if (gradient != gradient_tool->tentative_gradient)
{
- g_clear_object (&blend_tool->tentative_gradient);
+ g_clear_object (&gradient_tool->tentative_gradient);
- blend_tool->tentative_gradient = gradient;
+ gradient_tool->tentative_gradient = gradient;
if (gradient)
g_object_ref (gradient);
- if (blend_tool->render_node)
+ if (gradient_tool->render_node)
{
- gegl_node_set (blend_tool->render_node,
- "gradient", gradient ? gradient : blend_tool->gradient,
+ gegl_node_set (gradient_tool->render_node,
+ "gradient", gradient ? gradient : gradient_tool->gradient,
NULL);
- gimp_drawable_filter_apply (blend_tool->filter, NULL);
+ gimp_drawable_filter_apply (gradient_tool->filter, NULL);
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]