Commit 170a9cbc authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

All tools are back :)

2001-05-25  Michael Natterer  <mitch@gimp.org>

	All tools are back :)

	* app/tools/Makefile.am
	* app/tools/brightness_contrast.[ch]
	* app/tools/color_balance.[ch]
	* app/tools/curves.[ch]
	* app/tools/histogram_tool.[ch]
	* app/tools/hue_saturation.[ch]
	* app/tools/levels.[ch]
	* app/tools/posterize.[ch]
	* app/tools/threshold.[ch]: removed...

	* app/tools/gimpbrightnesscontrasttool.[ch]
	* app/tools/gimpcolorbalancetool.[ch]
	* app/tools/gimpcurvestool.[ch]
	* app/tools/gimphistogramtool.[ch]
	* app/tools/gimphuesaturationtool.[ch]
	* app/tools/gimplevelstool.[ch]
	* app/tools/gimpposterizetool.[ch]
	* app/tools/gimpthresholdtool.[ch]: ...and ported to the new tool
	system. Yes, the toolbox looks strange right now.

	* app/tools/gimpimagemaptool.[ch]: base class for all image_map
	tools. Does nothing at all right now.

	* app/tools/gimpbucketfilltool.h: removed _new() function
	declaration.

	* app/tools/gimptool.c: removed obsolete stuff and STUB()s.

	* app/tools/tools.c: register the new tools.

	* app/menus.c: removed the #if 0 around the code which reorders
	the color tool menu entries.

	* app/app_procs.c
	* tools/pdbgen/Makefile.am
	* tools/pdbgen/enums.pl
	* tools/pdbgen/pdb/color.pdb
	* app/pdb/color_cmds.c
	* po/POTFILES.in: changed accordingly.
parent 80ad288c
2001-05-25 Michael Natterer <mitch@gimp.org>
All tools are back :)
* app/tools/Makefile.am
* app/tools/brightness_contrast.[ch]
* app/tools/color_balance.[ch]
* app/tools/curves.[ch]
* app/tools/histogram_tool.[ch]
* app/tools/hue_saturation.[ch]
* app/tools/levels.[ch]
* app/tools/posterize.[ch]
* app/tools/threshold.[ch]: removed...
* app/tools/gimpbrightnesscontrasttool.[ch]
* app/tools/gimpcolorbalancetool.[ch]
* app/tools/gimpcurvestool.[ch]
* app/tools/gimphistogramtool.[ch]
* app/tools/gimphuesaturationtool.[ch]
* app/tools/gimplevelstool.[ch]
* app/tools/gimpposterizetool.[ch]
* app/tools/gimpthresholdtool.[ch]: ...and ported to the new tool
system. Yes, the toolbox looks strange right now.
* app/tools/gimpimagemaptool.[ch]: base class for all image_map
tools. Does nothing at all right now.
* app/tools/gimpbucketfilltool.h: removed _new() function
declaration.
* app/tools/gimptool.c: removed obsolete stuff and STUB()s.
* app/tools/tools.c: register the new tools.
* app/menus.c: removed the #if 0 around the code which reorders
the color tool menu entries.
* app/app_procs.c
* tools/pdbgen/Makefile.am
* tools/pdbgen/enums.pl
* tools/pdbgen/pdb/color.pdb
* app/pdb/color_cmds.c
* po/POTFILES.in: changed accordingly.
2001-05-24 Michael Natterer <mitch@gimp.org>
* config.guess
......
......@@ -37,9 +37,9 @@
#include "pdb/internal_procs.h"
#include "tools/curves.h"
#include "tools/hue_saturation.h"
#include "tools/levels.h"
#include "tools/gimpcurvestool.h"
#include "tools/gimphuesaturationtool.h"
#include "tools/gimplevelstool.h"
#include "gui/color-notebook.h"
#include "gui/file-open-dialog.h"
......
......@@ -24,49 +24,47 @@
#include "libgimpmath/gimpmath.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "apptypes.h"
#include "tools-types.h"
#include "base/pixel-region.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "gimpcolorbalancetool.h"
#include "tool_manager.h"
#include "tool_options.h"
#include "color_transfer.h"
#include "drawable.h"
#include "gdisplay.h"
#include "gimpimage.h"
#include "gimpui.h"
#include "image_map.h"
#include "pixel_region.h"
#include "color_balance.h"
#include "tool_options.h"
#include "tools.h"
#include "libgimp/gimpintl.h"
#define WANT_ADJUSTMENT_BITS
#include "icons.h"
#define CYAN_RED 0x1
#define MAGENTA_GREEN 0x2
#define YELLOW_BLUE 0x4
#define ALL (CYAN_RED | MAGENTA_GREEN | YELLOW_BLUE)
/* the color balance structures */
typedef struct _ColorBalance ColorBalance;
struct _ColorBalance
{
gint x, y; /* coords for last mouse click */
};
/* the color balance tool options */
static ToolOptions *color_balance_options = NULL;
/* the color balance dialog */
static ColorBalanceDialog *color_balance_dialog = NULL;
/* local function prototypes */
static void gimp_color_balance_tool_class_init (GimpColorBalanceToolClass *klass);
static void gimp_color_balance_tool_init (GimpColorBalanceTool *bc_tool);
/* color balance action functions */
static void gimp_color_balance_tool_destroy (GtkObject *object);
static void color_balance_control (Tool *tool,
ToolAction action,
GDisplay *gdisp);
static void gimp_color_balance_tool_initialize (GimpTool *tool,
GDisplay *gdisp);
static void gimp_color_balance_tool_control (GimpTool *tool,
ToolAction action,
GDisplay *gdisp);
static ColorBalanceDialog * color_balance_dialog_new (void);
......@@ -92,6 +90,163 @@ static void color_balance_mg_adjustment_update (GtkAdjustment *adj,
static void color_balance_yb_adjustment_update (GtkAdjustment *adj,
gpointer data);
/* the color balance tool options */
static ToolOptions *color_balance_options = NULL;
/* the color balance dialog */
static ColorBalanceDialog *color_balance_dialog = NULL;
static GimpImageMapToolClass *parent_class = NULL;
/* functions */
void
gimp_color_balance_tool_register (void)
{
tool_manager_register_tool (GIMP_TYPE_COLOR_BALANCE_TOOL,
FALSE,
"gimp:color_balance_tool",
_("Color Balance"),
_("Adjust color balance"),
N_("/Image/Colors/Color Balance..."), NULL,
NULL, "tools/color_balance.html",
(const gchar **) adjustment_bits);
}
GtkType
gimp_color_balance_tool_get_type (void)
{
static GtkType tool_type = 0;
if (! tool_type)
{
GtkTypeInfo tool_info =
{
"GimpColorBalanceTool",
sizeof (GimpColorBalanceTool),
sizeof (GimpColorBalanceToolClass),
(GtkClassInitFunc) gimp_color_balance_tool_class_init,
(GtkObjectInitFunc) gimp_color_balance_tool_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
tool_type = gtk_type_unique (GIMP_TYPE_IMAGE_MAP_TOOL, &tool_info);
}
return tool_type;
}
static void
gimp_color_balance_tool_class_init (GimpColorBalanceToolClass *klass)
{
GtkObjectClass *object_class;
GimpToolClass *tool_class;
object_class = (GtkObjectClass *) klass;
tool_class = (GimpToolClass *) klass;
parent_class = gtk_type_class (GIMP_TYPE_IMAGE_MAP_TOOL);
object_class->destroy = gimp_color_balance_tool_destroy;
tool_class->initialize = gimp_color_balance_tool_initialize;
tool_class->control = gimp_color_balance_tool_control;
}
static void
gimp_color_balance_tool_init (GimpColorBalanceTool *bc_tool)
{
GimpTool *tool;
tool = GIMP_TOOL (bc_tool);
if (! color_balance_options)
{
color_balance_options = tool_options_new ();
tool_manager_register_tool_options (GIMP_TYPE_COLOR_BALANCE_TOOL,
(ToolOptions *) color_balance_options);
}
}
static void
gimp_color_balance_tool_destroy (GtkObject *object)
{
color_balance_dialog_hide ();
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
gimp_color_balance_tool_initialize (GimpTool *tool,
GDisplay *gdisp)
{
gint i;
if (! gdisp)
{
color_balance_dialog_hide ();
return;
}
if (! gimp_drawable_is_rgb (gimp_image_active_drawable (gdisp->gimage)))
{
g_message (_("Color balance operates only on RGB color drawables."));
return;
}
/* The color balance dialog */
if (!color_balance_dialog)
color_balance_dialog = color_balance_dialog_new ();
else
if (!GTK_WIDGET_VISIBLE (color_balance_dialog->shell))
gtk_widget_show (color_balance_dialog->shell);
for (i = 0; i < 3; i++)
{
color_balance_dialog->cyan_red[i] = 0.0;
color_balance_dialog->magenta_green[i] = 0.0;
color_balance_dialog->yellow_blue[i] = 0.0;
}
color_balance_dialog->drawable = gimp_image_active_drawable (gdisp->gimage);
color_balance_dialog->image_map =
image_map_create (gdisp, color_balance_dialog->drawable);
color_balance_update (color_balance_dialog, ALL);
}
static void
gimp_color_balance_tool_control (GimpTool *tool,
ToolAction action,
GDisplay *gdisp)
{
switch (action)
{
case PAUSE:
break;
case RESUME:
break;
case HALT:
color_balance_dialog_hide ();
break;
default:
break;
}
if (GIMP_TOOL_CLASS (parent_class)->control)
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
}
/* color balance machinery */
void
......@@ -152,60 +307,6 @@ color_balance (PixelRegion *srcPR,
}
}
/* color balance action functions */
static void
color_balance_control (Tool *tool,
ToolAction action,
GDisplay *gdisp)
{
ColorBalance * color_bal;
color_bal = (ColorBalance *) tool->private;
switch (action)
{
case PAUSE:
break;
case RESUME:
break;
case HALT:
color_balance_dialog_hide ();
break;
default:
break;
}
}
Tool *
tools_new_color_balance (void)
{
Tool * tool;
ColorBalance * private;
/* The tool options */
if (!color_balance_options)
{
color_balance_options = tool_options_new (_("Color Balance"));
tools_register (COLOR_BALANCE, color_balance_options);
}
tool = tools_new_tool (COLOR_BALANCE);
private = g_new0 (ColorBalance, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->preserve = FALSE; /* Don't preserve on drawable change */
tool->private = (void *) private;
tool->control_func = color_balance_control;
return tool;
}
void
color_balance_dialog_hide (void)
{
......@@ -213,51 +314,6 @@ color_balance_dialog_hide (void)
color_balance_cancel_callback (NULL, (gpointer) color_balance_dialog);
}
void
tools_free_color_balance (Tool *tool)
{
ColorBalance * color_bal;
color_bal = (ColorBalance *) tool->private;
/* Close the color select dialog */
color_balance_dialog_hide ();
g_free (color_bal);
}
void
color_balance_initialize (GDisplay *gdisp)
{
gint i;
if (! gimp_drawable_is_rgb (gimp_image_active_drawable (gdisp->gimage)))
{
g_message (_("Color balance operates only on RGB color drawables."));
return;
}
/* The color balance dialog */
if (!color_balance_dialog)
color_balance_dialog = color_balance_dialog_new ();
else
if (!GTK_WIDGET_VISIBLE (color_balance_dialog->shell))
gtk_widget_show (color_balance_dialog->shell);
for (i = 0; i < 3; i++)
{
color_balance_dialog->cyan_red[i] = 0.0;
color_balance_dialog->magenta_green[i] = 0.0;
color_balance_dialog->yellow_blue[i] = 0.0;
}
color_balance_dialog->drawable = gimp_image_active_drawable (gdisp->gimage);
color_balance_dialog->image_map =
image_map_create (gdisp, color_balance_dialog->drawable);
color_balance_update (color_balance_dialog, ALL);
}
/**************************/
/* Color Balance dialog */
/**************************/
......@@ -294,7 +350,7 @@ color_balance_dialog_new (void)
/* The shell and main vbox */
cbd->shell = gimp_dialog_new (_("Color Balance"), "color_balance",
tools_help_func, NULL,
tool_manager_help_func, NULL,
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
......
......@@ -16,8 +16,11 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __COLOR_BALANCE_H__
#define __COLOR_BALANCE_H__
#ifndef __GIMP_COLOR_BALANCE_DIALOG_H__
#define __GIMP_COLOR_BALANCE_DIALOG_H__
#include "gimpimagemaptool.h"
typedef enum
......@@ -27,6 +30,28 @@ typedef enum
HIGHLIGHTS
} TransferMode;
#define GIMP_TYPE_COLOR_BALANCE_TOOL (gimp_color_balance_tool_get_type ())
#define GIMP_COLOR_BALANCE_TOOL(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_COLOR_BALANCE_TOOL, GimpColorBalanceTool))
#define GIMP_IS_COLOR_BALANCE_TOOL(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_COLOR_BALANCE_TOOL))
#define GIMP_COLOR_BALANCE_TOOL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_COLOR_BALANCE_TOOL, GimpColorBalanceToolClass))
#define GIMP_IS_COLOR_BALANCE_TOOL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_COLOR_BALANCE_TOOL))
typedef struct _GimpColorBalanceTool GimpColorBalanceTool;
typedef struct _GimpColorBalanceToolClass GimpColorBalanceToolClass;
struct _GimpColorBalanceTool
{
GimpImageMapTool parent_instance;
};
struct _GimpColorBalanceToolClass
{
GimpImageMapToolClass parent_class;
};
typedef struct _ColorBalanceDialog ColorBalanceDialog;
struct _ColorBalanceDialog
......@@ -53,10 +78,12 @@ struct _ColorBalanceDialog
TransferMode application_mode;
};
Tool * tools_new_color_balance (void);
void tools_free_color_balance (Tool *tool);
void color_balance_initialize (GDisplay *gdisp);
void gimp_color_balance_tool_register (void);
GtkType gimp_color_balance_tool_get_type (void);
void color_balance_dialog_hide (void);
void color_balance (PixelRegion *srcPR,
PixelRegion *destPR,
......@@ -65,4 +92,4 @@ void color_balance (PixelRegion *srcPR,
void color_balance_create_lookup_tables (ColorBalanceDialog *cbd);
#endif /* __COLOR_BALANCE_H__ */
#endif /* __GIMP_COLOR_BALANCE_GIMP_H__ */
......@@ -28,23 +28,30 @@
#include "libgimpbase/gimpbase.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "apptypes.h"
#include "tools-types.h"
#include "base/gimphistogram.h"
#include "base/gimplut.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "widgets/gimpcursor.h"
#include "gimpcurvestool.h"
#include "tool_manager.h"
#include "tool_options.h"
#include "cursorutil.h"
#include "drawable.h"
#include "gdisplay.h"
#include "gimphistogram.h"
#include "gimpimage.h"
#include "gimpui.h"
#include "gimplut.h"
#include "image_map.h"
#include "curves.h"
#include "tool_options.h"
#include "tools.h"
#include "libgimp/gimpintl.h"
#define WANT_CURVES_BITS
#include "icons.h"
#define GRAPH 0x1
#define XRANGE_TOP 0x2
......@@ -76,52 +83,41 @@
GDK_BUTTON_RELEASE_MASK | \
GDK_BUTTON1_MOTION_MASK
/* the curves structures */
typedef struct _Curves Curves;
struct _Curves
{
gint x, y; /* coords for last mouse click */
};
typedef gdouble CRMatrix[4][4];
/* the curves tool options */
static ToolOptions * curves_options = NULL;
/* the curves dialog */
static CurvesDialog * curves_dialog = NULL;
/* the curves file dialog */
static GtkWidget *file_dlg = NULL;
static gboolean load_save;
static GtkWidget *channel_items[5];
static CRMatrix CR_basis =
{
{ -0.5, 1.5, -1.5, 0.5 },
{ 1.0, -2.5, 2.0, -0.5 },
{ -0.5, 0.0, 0.5, 0.0 },
{ 0.0, 1.0, 0.0, 0.0 },
};
/* curves action functions */
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);
/* local function prototypes */
static void gimp_curves_tool_class_init (GimpCurvesToolClass *klass);
static void gimp_curves_tool_init (GimpCurvesTool *bc_tool);
static void gimp_curves_tool_destroy (GtkObject *object);
static void gimp_curves_tool_initialize (GimpTool *tool,
GDisplay *gdisp);
static void gimp_curves_tool_control (GimpTool *tool,
ToolAction action,
GDisplay *gdisp);
static void gimp_curves_tool_button_press (GimpTool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void gimp_curves_tool_button_release (GimpTool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void gimp_curves_tool_motion (GimpTool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
static void curves_colour_update (GimpTool *tool,
GDisplay *gdisp,
GimpDrawable *drawable,
gint x,
gint y);
static void curves_add_point (GimpDrawable *drawable,
gint x,
gint y,
gint cchan);
static CurvesDialog * curves_dialog_new (void);
......@@ -178,6 +174,295 @@ static gboolean curves_read_from_file (FILE *f);
static void curves_write_to_file (FILE *f);
/* the curves tool options */
static ToolOptions * curves_options = NULL;
/* the curves dialog */
static CurvesDialog * curves_dialog = NULL;
static GimpImageMapToolClass *parent_class = NULL;
/* the curves file dialog */
static GtkWidget *file_dlg = NULL;
static gboolean load_save;
static GtkWidget *channel_items[5];
static CRMatrix CR_basis =
{
{ -0.5, 1.5, -1.5, 0.5 },
{ 1.0, -2.5, 2.0, -0.5 },
{ -0.5, 0.0, 0.5, 0.0 },
{ 0.0, 1.0, 0.0, 0.0 },
};
/* functions */
void
gimp_curves_tool_register (void)
{
tool_manager_register_tool (GIMP_TYPE_CURVES_TOOL,
FALSE,
"gimp:curves_tool",
_("Curves"),
_("Adjust color curves"),
N_("/Image/Colors/Curves..."), NULL,
NULL, "tools/curves.html",
(const gchar **) curves_bits);
}
GtkType
gimp_curves_tool_get_type (void)
{
static GtkType tool_type = 0;
if (! tool_type)
{
GtkTypeInfo tool_info =
{
"GimpCurvesTool",
sizeof (GimpCurvesTool),
sizeof (GimpCurvesToolClass),
(GtkClassInitFunc) gimp_curves_tool_class_init,
(GtkObjectInitFunc) gimp_curves_tool_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
tool_type = gtk_type_unique (GIMP_TYPE_IMAGE_MAP_TOOL, &tool_info);
}
return tool_type;
}
static void
gimp_curves_tool_class_init (GimpCurvesToolClass *klass)
{
GtkObjectClass *object_class;
GimpToolClass *tool_class;
object_class = (GtkObjectClass *) klass;
tool_class = (GimpToolClass *) klass;
parent_class = gtk_type_class (GIMP_TYPE_IMAGE_MAP_TOOL);
object_class->destroy = gimp_curves_tool_destroy;
tool_class->initialize = gimp_curves_tool_initialize;
tool_class->control = gimp_curves_tool_control;
tool_class->button_press = gimp_curves_tool_button_press;
tool_class->button_release = gimp_curves_tool_button_release;
tool_class->motion = gimp_curves_tool_motion;
}
static void
gimp_curves_tool_init (GimpCurvesTool *bc_tool)
{
GimpTool *tool;
tool = GIMP_TOOL (bc_tool);
if (! curves_options)
{
curves_options = tool_options_new ();
tool_manager_register_tool_options (GIMP_TYPE_CURVES_TOOL,
(ToolOptions *) curves_options);
}
}
static void
gimp_curves_tool_destroy (GtkObject *object)
{
curves_dialog_hide ();
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
gimp_curves_tool_initialize (GimpTool *tool,
GDisplay *gdisp)
{
gint i, j;
if (! gdisp)
{
curves_dialog_hide ();
return;
}
if (gimp_drawable_is_indexed (gimp_image_active_drawable (gdisp->gimage)))
{
g_message (_("Curves for indexed drawables cannot be adjusted."));
return;
}
/* The curves dialog */
if (!curves_dialog)
{
curves_dialog = curves_dialog_new ();