2006-12-09 13:33:38 -08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
1997-11-24 14:05:25 -08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
|
*
|
2009-01-17 14:28:01 -08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
1997-11-24 14:05:25 -08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-17 14:28:01 -08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
1997-11-24 14:05:25 -08:00
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2018-07-11 14:27:07 -07:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
1997-11-24 14:05:25 -08:00
|
|
|
*/
|
2000-12-29 07:22:01 -08:00
|
|
|
|
2018-04-13 15:52:20 -07:00
|
|
|
#ifndef __GIMP_GRADIENT_TOOL_H__
|
|
|
|
|
#define __GIMP_GRADIENT_TOOL_H__
|
2001-03-11 12:01:14 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "gimpdrawtool.h"
|
1997-11-24 14:05:25 -08:00
|
|
|
|
2016-02-01 15:38:26 -08:00
|
|
|
|
2018-04-13 15:52:20 -07:00
|
|
|
#define GIMP_TYPE_GRADIENT_TOOL (gimp_gradient_tool_get_type ())
|
|
|
|
|
#define GIMP_GRADIENT_TOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_GRADIENT_TOOL, GimpGradientTool))
|
|
|
|
|
#define GIMP_GRADIENT_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_GRADIENT_TOOL, GimpGradientToolClass))
|
|
|
|
|
#define GIMP_IS_GRADIENT_TOOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_GRADIENT_TOOL))
|
|
|
|
|
#define GIMP_IS_GRADIENT_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_GRADIENT_TOOL))
|
|
|
|
|
#define GIMP_GRADIENT_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_GRADIENT_TOOL, GimpGradientToolClass))
|
2001-03-11 12:01:14 -08:00
|
|
|
|
2018-04-13 15:52:20 -07:00
|
|
|
#define GIMP_GRADIENT_TOOL_GET_OPTIONS(t) (GIMP_GRADIENT_OPTIONS (gimp_tool_get_options (GIMP_TOOL (t))))
|
2006-09-05 11:25:31 -07:00
|
|
|
|
2001-03-11 12:01:14 -08:00
|
|
|
|
2018-04-13 15:52:20 -07:00
|
|
|
typedef struct _GimpGradientTool GimpGradientTool;
|
|
|
|
|
typedef struct _GimpGradientToolClass GimpGradientToolClass;
|
2001-03-11 12:01:14 -08:00
|
|
|
|
2018-04-13 15:52:20 -07:00
|
|
|
struct _GimpGradientTool
|
2001-03-11 12:01:14 -08:00
|
|
|
{
|
2016-02-01 15:38:26 -08:00
|
|
|
GimpDrawTool parent_instance;
|
|
|
|
|
|
|
|
|
|
GimpGradient *gradient;
|
2017-10-06 09:11:45 -07:00
|
|
|
GimpGradient *tentative_gradient;
|
2014-06-07 20:18:29 -07:00
|
|
|
|
2016-02-01 15:38:26 -08:00
|
|
|
gdouble start_x; /* starting x coord */
|
|
|
|
|
gdouble start_y; /* starting y coord */
|
|
|
|
|
gdouble end_x; /* ending x coord */
|
|
|
|
|
gdouble end_y; /* ending y coord */
|
2011-03-28 02:08:40 -07:00
|
|
|
|
2017-06-27 13:50:50 -07:00
|
|
|
GimpToolWidget *widget;
|
2017-06-10 14:54:11 -07:00
|
|
|
GimpToolWidget *grab_widget;
|
2014-10-18 16:05:56 -07:00
|
|
|
|
2016-02-01 15:38:26 -08:00
|
|
|
GeglNode *graph;
|
|
|
|
|
GeglNode *render_node;
|
|
|
|
|
#if 0
|
|
|
|
|
GeglNode *subtract_node;
|
|
|
|
|
GeglNode *divide_node;
|
|
|
|
|
#endif
|
|
|
|
|
GeglNode *dist_node;
|
|
|
|
|
GeglBuffer *dist_buffer;
|
2016-05-11 16:49:53 -07:00
|
|
|
GimpDrawableFilter *filter;
|
2017-08-01 06:18:50 -07:00
|
|
|
|
|
|
|
|
/* editor */
|
|
|
|
|
|
|
|
|
|
gint block_handlers_count;
|
2017-08-02 13:31:10 -07:00
|
|
|
|
app: implement tool undo for gradient editing in the blend tool
Move the tool undo functionality of the blend tool to the editor,
and add support for undoing gradient edit operations. Each undo
step that affects the gradient holds, in addition to the line
endpoint poisitions, a copy of the gradient at the beginning of the
operation, as well as necessary information to allow the selection
to "follow" undo. When undoing the operation, the saved gradient
is copied back to the active gradient.
To avoid all kinds of complex scenarios, when the active gradient
changes, or when the gradient is modified externally (e.g., by the
(old) gradient editor), all undo steps that affect the gradient are
deleted from the history, while those that affect only the endpoint
positions are kept.
2017-08-03 16:59:21 -07:00
|
|
|
gint edit_count;
|
|
|
|
|
GSList *undo_stack;
|
|
|
|
|
GSList *redo_stack;
|
|
|
|
|
|
|
|
|
|
guint flush_idle_id;
|
|
|
|
|
|
2017-08-02 13:31:10 -07:00
|
|
|
GimpToolGui *gui;
|
2017-08-02 22:05:44 -07:00
|
|
|
GtkWidget *endpoint_editor;
|
|
|
|
|
GtkWidget *endpoint_se;
|
|
|
|
|
GtkWidget *endpoint_color_panel;
|
|
|
|
|
GtkWidget *endpoint_type_combo;
|
2017-08-03 06:15:43 -07:00
|
|
|
GtkWidget *stop_editor;
|
|
|
|
|
GtkWidget *stop_se;
|
|
|
|
|
GtkWidget *stop_left_color_panel;
|
|
|
|
|
GtkWidget *stop_left_type_combo;
|
|
|
|
|
GtkWidget *stop_right_color_panel;
|
|
|
|
|
GtkWidget *stop_right_type_combo;
|
|
|
|
|
GtkWidget *stop_chain_button;
|
2017-08-03 10:42:09 -07:00
|
|
|
GtkWidget *midpoint_editor;
|
|
|
|
|
GtkWidget *midpoint_se;
|
|
|
|
|
GtkWidget *midpoint_type_combo;
|
|
|
|
|
GtkWidget *midpoint_color_combo;
|
|
|
|
|
GtkWidget *midpoint_new_stop_button;
|
|
|
|
|
GtkWidget *midpoint_center_button;
|
2001-03-11 12:01:14 -08:00
|
|
|
};
|
|
|
|
|
|
2018-04-13 15:52:20 -07:00
|
|
|
struct _GimpGradientToolClass
|
2001-03-11 12:01:14 -08:00
|
|
|
{
|
|
|
|
|
GimpDrawToolClass parent_class;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2018-04-13 15:52:20 -07:00
|
|
|
void gimp_gradient_tool_register (GimpToolRegisterCallback callback,
|
|
|
|
|
gpointer data);
|
2001-11-09 08:54:56 -08:00
|
|
|
|
2018-04-13 15:52:20 -07:00
|
|
|
GType gimp_gradient_tool_get_type (void) G_GNUC_CONST;
|
2017-10-06 09:11:45 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/* protected functions */
|
|
|
|
|
|
2018-04-13 15:52:20 -07:00
|
|
|
void gimp_gradient_tool_set_tentative_gradient (GimpGradientTool *gradient_tool,
|
|
|
|
|
GimpGradient *gradient);
|
2001-03-11 12:01:14 -08:00
|
|
|
|
|
|
|
|
|
2018-04-13 15:52:20 -07:00
|
|
|
#endif /* __GIMP_GRADIENT_TOOL_H__ */
|