Commit 2db88815 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

app/airbrush.[ch] app/bezier_select.c app/bezier_selectP.h app/blend.[ch]

2000-12-31  Michael Natterer  <mitch@gimp.org>

	* app/airbrush.[ch]
	* app/bezier_select.c
	* app/bezier_selectP.h
	* app/blend.[ch]
	* app/boundary.h
	* app/brightness_contrast.[ch]
	* app/bucket_fill.c
	* app/by_color_select.c
	* app/clone.[ch]
	* app/color_balance.c
	* app/color_picker.c
	* app/commands.c
	* app/convolve.[ch]
	* app/crop.c
	* app/crop.h
	* app/curves.c
	* app/dodgeburn.[ch]
	* app/edit_selection.[ch]
	* app/ellipse_select.c
	* app/eraser.[ch]
	* app/flip_tool.[ch]
	* app/free_select.[ch]
	* app/fuzzy_select.[ch]
	* app/gdisplay.c
	* app/gimage.c
	* app/histogram_tool.[ch]
	* app/hue_saturation.[ch]
	* app/image_map.[ch]
	* app/ink.[ch]
	* app/iscissors.c
	* app/levels.c
	* app/magnify.[ch]
	* app/move.c
	* app/nav_window.[ch]
	* app/paint_core.[ch]
	* app/paintbrush.[ch]
	* app/path_bezier.[ch]
	* app/path_tool.c
	* app/pencil.[ch]
	* app/perspective_tool.[ch]
	* app/posterize.c
	* app/rect_select.[ch]
	* app/rotate_tool.[ch]
	* app/scale_tool.[ch]
	* app/selection.[ch]
	* app/shear_tool.[ch]
	* app/smudge.[ch]
	* app/text_tool.[ch]
	* app/threshold.c
	* app/tools.[ch]
	* app/transform_core.[ch]: removed the "gdisp_ptr" madness and
	useless casts all over the place. Introduced a "PaintState" enum
	instead of #define's. Various cleanups.
parent 5e18bba9
2000-12-31 Michael Natterer <mitch@gimp.org>
* app/airbrush.[ch]
* app/bezier_select.c
* app/bezier_selectP.h
* app/blend.[ch]
* app/boundary.h
* app/brightness_contrast.[ch]
* app/bucket_fill.c
* app/by_color_select.c
* app/clone.[ch]
* app/color_balance.c
* app/color_picker.c
* app/commands.c
* app/convolve.[ch]
* app/crop.c
* app/crop.h
* app/curves.c
* app/dodgeburn.[ch]
* app/edit_selection.[ch]
* app/ellipse_select.c
* app/eraser.[ch]
* app/flip_tool.[ch]
* app/free_select.[ch]
* app/fuzzy_select.[ch]
* app/gdisplay.c
* app/gimage.c
* app/histogram_tool.[ch]
* app/hue_saturation.[ch]
* app/image_map.[ch]
* app/ink.[ch]
* app/iscissors.c
* app/levels.c
* app/magnify.[ch]
* app/move.c
* app/nav_window.[ch]
* app/paint_core.[ch]
* app/paintbrush.[ch]
* app/path_bezier.[ch]
* app/path_tool.c
* app/pencil.[ch]
* app/perspective_tool.[ch]
* app/posterize.c
* app/rect_select.[ch]
* app/rotate_tool.[ch]
* app/scale_tool.[ch]
* app/selection.[ch]
* app/shear_tool.[ch]
* app/smudge.[ch]
* app/text_tool.[ch]
* app/threshold.c
* app/tools.[ch]
* app/transform_core.[ch]: removed the "gdisp_ptr" madness and
useless casts all over the place. Introduced a "PaintState" enum
instead of #define's. Various cleanups.
2000-12-30 Michael Natterer <mitch@gimp.org>
One more 17C3 commit ...
......
......@@ -1080,11 +1080,12 @@ tools_select_cmd_callback (GtkWidget *widget,
gpointer callback_data,
guint callback_action)
{
ToolType tool_type;
GDisplay *gdisp;
gdisp = gdisplay_active ();
ToolType tool_type;
GDisplay *gdisp;
tool_type = (ToolType) callback_action;
gdisp = gdisplay_active ();
gimp_context_set_tool (gimp_context_get_user (), tool_type);
......@@ -1101,12 +1102,12 @@ tools_select_cmd_callback (GtkWidget *widget,
active_tool->drawable = gimp_image_active_drawable (gdisp->gimage);
}
/* setting the gdisp_ptr here is a HACK to allow the tools'
/* setting the tool->gdisp here is a HACK to allow the tools'
* dialog windows being hidden if the tool was selected from
* a tear-off-menu and there was no mouse click in the display
* before deleting it
*/
active_tool->gdisp_ptr = gdisp;
active_tool->gdisp = gdisp;
}
/***** Filters *****/
......
......@@ -77,6 +77,16 @@ struct _AirbrushOptions
};
/* local function prototypes */
static gpointer airbrush_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
PaintState state);
static gpointer airbrush_non_gui_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
PaintState state);
/* the airbrush tool options */
static AirbrushOptions *airbrush_options = NULL;
......@@ -189,13 +199,13 @@ tools_new_airbrush (void)
return tool;
}
void *
static gpointer
airbrush_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
PaintState state)
{
GimpBrush *brush;
gdouble rate;
gdouble rate;
if (!drawable)
return NULL;
......@@ -357,10 +367,10 @@ airbrush_motion (PaintCore *paint_core,
SOFT, scale, mode);
}
static void *
static gpointer
airbrush_non_gui_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
PaintState state)
{
airbrush_motion (paint_core, drawable, &non_gui_pressure_options,
non_gui_pressure, non_gui_incremental);
......@@ -370,8 +380,8 @@ airbrush_non_gui_paint_func (PaintCore *paint_core,
gboolean
airbrush_non_gui_default (GimpDrawable *drawable,
int num_strokes,
double *stroke_array)
gint num_strokes,
gdouble *stroke_array)
{
AirbrushOptions *options = airbrush_options;
gdouble pressure = AIRBRUSH_PRESSURE_DEFAULT;
......@@ -384,11 +394,11 @@ airbrush_non_gui_default (GimpDrawable *drawable,
gboolean
airbrush_non_gui (GimpDrawable *drawable,
double pressure,
int num_strokes,
double *stroke_array)
gdouble pressure,
gint num_strokes,
gdouble *stroke_array)
{
int i;
gint i;
if (paint_core_init (&non_gui_paint_core, drawable,
stroke_array[0], stroke_array[1]))
......@@ -419,8 +429,9 @@ airbrush_non_gui (GimpDrawable *drawable,
/* Cleanup */
paint_core_cleanup ();
return TRUE;
}
else
return FALSE;
return FALSE;
}
......@@ -20,18 +20,16 @@
#define __AIRBRUSH_H__
void * airbrush_paint_func (PaintCore *,
GimpDrawable *,
gint);
gboolean airbrush_non_gui (GimpDrawable *,
gdouble,
gint,
gdouble *);
gboolean airbrush_non_gui_default (GimpDrawable *,
gint,
gdouble *);
gboolean airbrush_non_gui (GimpDrawable *drawable,
gdouble pressure,
gint num_strokes,
gdouble *stroke_array);
gboolean airbrush_non_gui_default (GimpDrawable *drawable,
gint num_strokes,
gdouble *stroke_array);
Tool * tools_new_airbrush (void);
void tools_free_airbrush (Tool *);
void tools_free_airbrush (Tool *tool);
#endif /* __AIRBRUSH_H__ */
......@@ -20,9 +20,6 @@
#define __BOUNDARY_H__
#include "paint_funcs.h"
typedef enum
{
WithinBounds,
......
......@@ -62,21 +62,33 @@ static ColorBalanceDialog *color_balance_dialog = NULL;
/* color balance action functions */
static void color_balance_control (Tool *, ToolAction, gpointer);
static void color_balance_control (Tool *tool,
ToolAction action,
GDisplay *gdisp);
static ColorBalanceDialog * color_balance_dialog_new (void);
static void color_balance_update (ColorBalanceDialog *, int);
static void color_balance_preview (ColorBalanceDialog *);
static void color_balance_reset_callback (GtkWidget *, gpointer);
static void color_balance_ok_callback (GtkWidget *, gpointer);
static void color_balance_cancel_callback (GtkWidget *, gpointer);
static void color_balance_range_callback (GtkWidget *, gpointer);
static void color_balance_preserve_update (GtkWidget *, gpointer);
static void color_balance_preview_update (GtkWidget *, gpointer);
static void color_balance_cr_adjustment_update (GtkAdjustment *, gpointer);
static void color_balance_mg_adjustment_update (GtkAdjustment *, gpointer);
static void color_balance_yb_adjustment_update (GtkAdjustment *, gpointer);
static void color_balance_update (ColorBalanceDialog *cbd,
gint );
static void color_balance_preview (ColorBalanceDialog *cbd);
static void color_balance_reset_callback (GtkWidget *widget,
gpointer data);
static void color_balance_ok_callback (GtkWidget *widget,
gpointer data);
static void color_balance_cancel_callback (GtkWidget *widget,
gpointer data);
static void color_balance_range_callback (GtkWidget *widget,
gpointer data);
static void color_balance_preserve_update (GtkWidget *widget,
gpointer data);
static void color_balance_preview_update (GtkWidget *widget,
gpointer data);
static void color_balance_cr_adjustment_update (GtkAdjustment *adj,
gpointer data);
static void color_balance_mg_adjustment_update (GtkAdjustment *adj,
gpointer data);
static void color_balance_yb_adjustment_update (GtkAdjustment *adj,
gpointer data);
/* color balance machinery */
......@@ -86,12 +98,12 @@ color_balance (PixelRegion *srcPR,
void *data)
{
ColorBalanceDialog *cbd;
guchar *src, *s;
guchar *dest, *d;
gint alpha;
gint r, g, b;
gint r_n, g_n, b_n;
gint w, h;
guchar *src, *s;
guchar *dest, *d;
gboolean alpha;
gint r, g, b;
gint r_n, g_n, b_n;
gint w, h;
cbd = (ColorBalanceDialog *) data;
......@@ -143,7 +155,7 @@ color_balance (PixelRegion *srcPR,
static void
color_balance_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
ColorBalance * color_bal;
......@@ -599,7 +611,7 @@ color_balance_ok_callback (GtkWidget *widget,
cbd->image_map = NULL;
active_tool->gdisp_ptr = NULL;
active_tool->gdisp = NULL;
active_tool->drawable = NULL;
}
......@@ -623,7 +635,7 @@ color_balance_cancel_callback (GtkWidget *widget,
cbd->image_map = NULL;
}
active_tool->gdisp_ptr = NULL;
active_tool->gdisp = NULL;
active_tool->drawable = NULL;
}
......
......@@ -108,40 +108,72 @@ static CRMatrix CR_basis =
/* curves action functions */
static void curves_button_press (Tool *, GdkEventButton *, gpointer);
static void curves_button_release (Tool *, GdkEventButton *, gpointer);
static void curves_motion (Tool *, GdkEventMotion *, gpointer);
static void curves_control (Tool *, ToolAction, gpointer);
static CurvesDialog * curves_dialog_new (void);
static void curves_update (CurvesDialog *, int);
static void curves_plot_curve (CurvesDialog *, int, int, int, int);
static void curves_preview (CurvesDialog *);
static void curves_channel_callback (GtkWidget *, gpointer);
static void curves_smooth_callback (GtkWidget *, gpointer);
static void curves_free_callback (GtkWidget *, gpointer);
static void curves_channel_reset (int);
static void curves_reset_callback (GtkWidget *, gpointer);
static void curves_ok_callback (GtkWidget *, gpointer);
static void curves_cancel_callback (GtkWidget *, gpointer);
static void curves_load_callback (GtkWidget *, gpointer);
static void curves_save_callback (GtkWidget *, gpointer);
static void curves_preview_update (GtkWidget *, gpointer);
static gint curves_xrange_events (GtkWidget *, GdkEvent *, CurvesDialog *);
static gint curves_yrange_events (GtkWidget *, GdkEvent *, CurvesDialog *);
static gint curves_graph_events (GtkWidget *, GdkEvent *, CurvesDialog *);
static void curves_CR_compose (CRMatrix, CRMatrix, CRMatrix);
static void file_dialog_create (GtkWidget *);
static void file_dialog_ok_callback (GtkWidget *, gpointer);
static void file_dialog_cancel_callback (GtkWidget *, gpointer);
static gboolean curves_read_from_file (FILE *f);
static void curves_write_to_file (FILE *f);
static void curves_button_press (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void curves_button_release (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void curves_motion (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
static void curves_control (Tool *tool,
ToolAction action,
GDisplay *gdisp);
static CurvesDialog * curves_dialog_new (void);
static void curves_update (CurvesDialog *cd,
gint );
static void curves_plot_curve (CurvesDialog *cd,
gint ,
gint ,
gint ,
gint );
static void curves_preview (CurvesDialog *cd);
static void curves_channel_callback (GtkWidget *widget,
gpointer data);
static void curves_smooth_callback (GtkWidget *widget,
gpointer data);
static void curves_free_callback (GtkWidget *widget,
gpointer data);
static void curves_channel_reset (gint );
static void curves_reset_callback (GtkWidget *widget,
gpointer data);
static void curves_ok_callback (GtkWidget *widget,
gpointer data);
static void curves_cancel_callback (GtkWidget *widget,
gpointer data);
static void curves_load_callback (GtkWidget *widget,
gpointer data);
static void curves_save_callback (GtkWidget *widget,
gpointer data);
static void curves_preview_update (GtkWidget *widget,
gpointer data);
static gint curves_xrange_events (GtkWidget *widget,
GdkEvent *event,
CurvesDialog *cd);
static gint curves_yrange_events (GtkWidget *widget,
GdkEvent *event,
CurvesDialog *cd);
static gint curves_graph_events (GtkWidget *widget,
GdkEvent *event,
CurvesDialog *cd);
static void curves_CR_compose (CRMatrix ,
CRMatrix ,
CRMatrix );
static void file_dialog_create (GtkWidget *widget);
static void file_dialog_ok_callback (GtkWidget *widget,
gpointer data);
static void file_dialog_cancel_callback (GtkWidget *widget,
gpointer data);
static gboolean curves_read_from_file (FILE *f);
static void curves_write_to_file (FILE *f);
/* curves machinery */
......@@ -152,10 +184,10 @@ curves_lut_func (CurvesDialog *cd,
gint channel,
gfloat value)
{
gfloat f;
gint index;
gfloat f;
gint index;
gdouble inten;
gint j;
gint j;
if (nchannels == 1)
j = 0;
......@@ -197,15 +229,15 @@ curves_colour_update (Tool *tool,
gint x,
gint y)
{
guchar *color;
gint offx;
gint offy;
gint maxval;
guchar *color;
gint offx;
gint offy;
gint maxval;
gboolean has_alpha;
gboolean is_indexed;
GimpImageType sample_type;
if(!tool || tool->state != ACTIVE)
if (!tool || tool->state != ACTIVE)
return;
drawable_offsets (drawable, &offx, &offy);
......@@ -213,7 +245,7 @@ curves_colour_update (Tool *tool,
x -= offx;
y -= offy;
if (!(color = image_map_get_color_at(curves_dialog->image_map, x, y)))
if (!(color = image_map_get_color_at (curves_dialog->image_map, x, y)))
return;
sample_type = gimp_drawable_type (drawable);
......@@ -283,16 +315,14 @@ curves_add_point (GimpDrawable *drawable,
static void
curves_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
gint x, y;
GDisplay *gdisp;
gint x, y;
GimpDrawable *drawable;
gdisp = gdisp_ptr;
drawable = gimp_image_active_drawable (gdisp->gimage);
tool->gdisp_ptr = gdisp;
tool->gdisp = gdisp;
if (drawable != tool->drawable)
{
......@@ -318,20 +348,18 @@ curves_button_press (Tool *tool,
static void
curves_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
gint x, y;
gint x, y;
GimpDrawable *drawable;
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
if(!curves_dialog ||
!gdisp ||
!(drawable = gimp_image_active_drawable (gdisp->gimage)))
if (! curves_dialog ||
! gdisp ||
! (drawable = gimp_image_active_drawable (gdisp->gimage)))
return;
gdisplay_untransform_coords (gdisp, bevent->x, bevent->y, &x, &y, FALSE, FALSE);
gdisplay_untransform_coords (gdisp, bevent->x, bevent->y, &x, &y,
FALSE, FALSE);
curves_colour_update (tool, gdisp, drawable, x, y);
if (bevent->state & GDK_SHIFT_MASK)
......@@ -355,14 +383,11 @@ curves_button_release (Tool *tool,
static void
curves_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
gint x, y;
GDisplay *gdisp;
gint x, y;
GimpDrawable *drawable;
gdisp = (GDisplay *) gdisp_ptr;
if (! curves_dialog ||
! gdisp ||
! (drawable = gimp_image_active_drawable (gdisp->gimage)))
......@@ -376,7 +401,7 @@ curves_motion (Tool *tool,
static void
curves_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
switch (action)
{
......@@ -1279,7 +1304,7 @@ curves_ok_callback (GtkWidget *widget,
cd->image_map = NULL;
active_tool->gdisp_ptr = NULL;
active_tool->gdisp = NULL;
active_tool->drawable = NULL;
}
......@@ -1303,7 +1328,7 @@ curves_cancel_callback (GtkWidget *widget,
cd->image_map = NULL;
}
active_tool->gdisp_ptr = NULL;
active_tool->gdisp = NULL;
active_tool->drawable = NULL;
}
......
......@@ -43,8 +43,8 @@
#define HUE_PARTITION_MASK GDK_EXPOSURE_MASK | GDK_ENTER_NOTIFY_MASK
#define SLIDER_WIDTH 200
#define DA_WIDTH 40
#define DA_HEIGHT 20
#define DA_WIDTH 40
#define DA_HEIGHT 20
#define HUE_PARTITION 0x0
#define HUE_SLIDER 0x1
......@@ -62,6 +62,38 @@ struct _HueSaturation