1
/* The GIMP -- an image manipulation program
2
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
4
* Gradient editor module copyight (C) 1996-1997 Federico Mena Quintero
5
* federico@nuclecu.unam.mx
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2 of the License, or
10
* (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
#ifndef __GIMP_GRADIENT_EDITOR_H__
23
#define __GIMP_GRADIENT_EDITOR_H__
26
#include "gimpdataeditor.h"
29
#define GRAD_NUM_COLORS 10
38
} GradientEditorDragMode;
41
#define GIMP_TYPE_GRADIENT_EDITOR (gimp_gradient_editor_get_type ())
42
#define GIMP_GRADIENT_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_GRADIENT_EDITOR, GimpGradientEditor))
43
#define GIMP_GRADIENT_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_GRADIENT_EDITOR, GimpGradientEditorClass))
44
#define GIMP_IS_GRADIENT_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_GRADIENT_EDITOR))
45
#define GIMP_IS_GRADIENT_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_GRADIENT_EDITOR))
46
#define GIMP_GRADIENT_EDITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_GRADIENT_EDITOR, GimpGradientEditorClass))
49
typedef struct _GimpGradientEditorClass GimpGradientEditorClass;
51
struct _GimpGradientEditor
53
GimpDataEditor parent_instance;
55
GtkWidget *hint_label1;
56
GtkWidget *hint_label2;
57
GtkWidget *hint_label3;
58
GtkWidget *hint_label4;
63
/* Zoom and scrollbar */
65
GtkObject *scroll_data;
68
gboolean instant_update;
71
GtkWidget *color_dialog;
73
/* Gradient preview */
75
gboolean preview_button_down;
77
/* Gradient control */
78
GdkPixmap *control_pixmap;
79
GimpGradientSegment *control_drag_segment; /* Segment which is being dragged */
80
GimpGradientSegment *control_sel_l; /* Left segment of selection */
81
GimpGradientSegment *control_sel_r; /* Right segment of selection */
82
GradientEditorDragMode control_drag_mode; /* What is being dragged? */
83
guint32 control_click_time; /* Time when mouse was pressed */
84
gboolean control_compress; /* Compressing/expanding handles */
85
gint control_last_x; /* Last mouse position when dragging */
86
gdouble control_last_gx; /* Last position (wrt gradient) when dragging */
87
gdouble control_orig_pos; /* Original click position when dragging */
89
/* Split uniformly dialog */
92
/* Replicate dialog */
96
GimpRGB saved_colors[GRAD_NUM_COLORS];
99
GimpGradientSegment *left_saved_segments;
100
gboolean left_saved_dirty;
102
GimpGradientSegment *right_saved_segments;
103
gboolean right_saved_dirty;
106
struct _GimpGradientEditorClass
108
GimpDataEditorClass parent_class;
112
GType gimp_gradient_editor_get_type (void) G_GNUC_CONST;
114
GtkWidget * gimp_gradient_editor_new (Gimp *gimp,
115
GimpMenuFactory *menu_factory);
117
void gimp_gradient_editor_update (GimpGradientEditor *editor);
118
void gimp_gradient_editor_zoom (GimpGradientEditor *editor,
119
GimpZoomType zoom_type);
122
#endif /* __GIMP_GRADIENT_EDITOR_H__ */