Commit 69ccb4d3 authored by Nate Summers's avatar Nate Summers

massive tool plugin changes

parent 0855bfce
......@@ -116,8 +116,8 @@ INCLUDES = @STRIP_BEGIN@ \
gimp_1_3_LDADD = @STRIP_BEGIN@ \
gui/libappgui.a \
tools/libapptools.a \
display/libappdisplay.a \
tools/libapptools.a \
widgets/libappwidgets.a \
core/libappcore.a \
pdb/libapppdb.a \
......@@ -133,6 +133,7 @@ gimp_1_3_LDADD = @STRIP_BEGIN@ \
$(top_builddir)/libgimpmath/libgimpmath-$(LT_RELEASE).la \
$(top_builddir)/libgimpbase/libgimpbase-$(LT_RELEASE).la \
$(top_builddir)/libgimpwidgets/libgimpwidgets-$(LT_RELEASE).la \
$(top_builddir)/libgimptool/libgimptool-$(LT_RELEASE).la \
$(GTK_LIBS) \
$(PANGOFT2_LIBS) \
$(LIBART_LIBS) \
......
......@@ -29,7 +29,7 @@
#include "display/gimpdisplay.h"
#include "tools/gimptool.h"
#include "libgimptool/gimptool.h"
#include "tools/tool_manager.h"
......
......@@ -24,7 +24,9 @@
#include "libgimpmath/gimpmath.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "tools-types.h"
#include "core/core-types.h"
#include "display/display-types.h"
#include "libgimptool/gimptooltypes.h"
#include "base/pixel-region.h"
......@@ -97,11 +99,10 @@ static GimpImageMapToolClass *parent_class = NULL;
/* functions */
void
gimp_color_balance_tool_register (Gimp *gimp,
GimpToolRegisterCallback callback)
gimp_color_balance_tool_register (GimpToolRegisterCallback callback,
Gimp *gimp)
{
(* callback) (gimp,
GIMP_TYPE_COLOR_BALANCE_TOOL,
(* callback) (GIMP_TYPE_COLOR_BALANCE_TOOL,
NULL,
FALSE,
"gimp-color-balance-tool",
......@@ -109,7 +110,8 @@ gimp_color_balance_tool_register (Gimp *gimp,
_("Adjust color balance"),
N_("/Layer/Colors/Color Balance..."), NULL,
NULL, "tools/color_balance.html",
GIMP_STOCK_TOOL_COLOR_BALANCE);
GIMP_STOCK_TOOL_COLOR_BALANCE,
gimp);
}
GType
......@@ -158,6 +160,17 @@ gimp_color_balance_tool_class_init (GimpColorBalanceToolClass *klass)
static void
gimp_color_balance_tool_init (GimpColorBalanceTool *bc_tool)
{
GIMP_TOOL(bc_tool)->control = gimp_tool_control_new (FALSE, /* scroll_lock */
TRUE, /* auto_snap_to */
TRUE, /* preserve */
FALSE, /* handle_empty_image */
FALSE, /* perfectmouse */
GIMP_MOUSE_CURSOR, /* cursor */
GIMP_TOOL_CURSOR_NONE, /* tool_cursor */
GIMP_CURSOR_MODIFIER_NONE, /* cursor_modifier */
GIMP_MOUSE_CURSOR, /* toggle_cursor */
GIMP_TOOL_CURSOR_NONE, /* toggle_tool_cursor */
GIMP_CURSOR_MODIFIER_NONE /* toggle_cursor_modifier */);
}
static void
......@@ -541,10 +554,10 @@ color_balance_preview (ColorBalanceDialog *cbd)
return;
}
active_tool->preserve = TRUE;
gimp_tool_control_set_preserve(active_tool->control, TRUE);
color_balance_create_lookup_tables (cbd);
image_map_apply (cbd->image_map, color_balance, (void *) cbd);
active_tool->preserve = FALSE;
gimp_tool_control_set_preserve(active_tool->control, FALSE);
}
static void
......@@ -578,7 +591,7 @@ color_balance_ok_callback (GtkWidget *widget,
active_tool = tool_manager_get_active (the_gimp);
active_tool->preserve = TRUE;
gimp_tool_control_set_preserve(active_tool->control, TRUE);
if (!cbd->preview)
image_map_apply (cbd->image_map, color_balance, (void *) cbd);
......@@ -586,7 +599,7 @@ color_balance_ok_callback (GtkWidget *widget,
if (cbd->image_map)
image_map_commit (cbd->image_map);
active_tool->preserve = FALSE;
gimp_tool_control_set_preserve(active_tool->control, FALSE);
cbd->image_map = NULL;
......@@ -609,9 +622,9 @@ color_balance_cancel_callback (GtkWidget *widget,
if (cbd->image_map)
{
active_tool->preserve = TRUE;
gimp_tool_control_set_preserve(active_tool->control, TRUE);
image_map_abort (cbd->image_map);
active_tool->preserve = FALSE;
gimp_tool_control_set_preserve(active_tool->control, FALSE);
gdisplays_flush ();
cbd->image_map = NULL;
......@@ -670,9 +683,9 @@ color_balance_preview_update (GtkWidget *widget,
{
active_tool = tool_manager_get_active (the_gimp);
active_tool->preserve = TRUE;
gimp_tool_control_set_preserve(active_tool->control, TRUE);
image_map_clear (cbd->image_map);
active_tool->preserve = FALSE;
gimp_tool_control_set_preserve(active_tool->control, FALSE);
gdisplays_flush ();
}
}
......
......@@ -73,8 +73,8 @@ struct _ColorBalanceDialog
};
void gimp_color_balance_tool_register (Gimp *gimp,
GimpToolRegisterCallback callback);
void gimp_color_balance_tool_register (GimpToolRegisterCallback callback,
Gimp *gimp);
GType gimp_color_balance_tool_get_type (void) G_GNUC_CONST;
......
......@@ -33,7 +33,9 @@
#include "libgimpbase/gimpbase.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "tools-types.h"
#include "core/core-types.h"
#include "display/display-types.h"
#include "libgimptool/gimptooltypes.h"
#include "base/gimphistogram.h"
#include "base/gimplut.h"
......@@ -205,11 +207,10 @@ static GimpImageMapToolClass *parent_class = NULL;
/* public functions */
void
gimp_curves_tool_register (Gimp *gimp,
GimpToolRegisterCallback callback)
gimp_curves_tool_register (GimpToolRegisterCallback callback,
Gimp *gimp)
{
(* callback) (gimp,
GIMP_TYPE_CURVES_TOOL,
(* callback) (GIMP_TYPE_CURVES_TOOL,
NULL,
FALSE,
"gimp-curves-tool",
......@@ -217,7 +218,8 @@ gimp_curves_tool_register (Gimp *gimp,
_("Adjust color curves"),
N_("/Layer/Colors/Curves..."), NULL,
NULL, "tools/curves.html",
GIMP_STOCK_TOOL_CURVES);
GIMP_STOCK_TOOL_CURVES,
gimp);
}
GType
......@@ -267,6 +269,17 @@ gimp_curves_tool_class_init (GimpCurvesToolClass *klass)
static void
gimp_curves_tool_init (GimpCurvesTool *bc_tool)
{
GIMP_TOOL(bc_tool)->control = gimp_tool_control_new (FALSE, /* scroll_lock */
TRUE, /* auto_snap_to */
TRUE, /* preserve */
FALSE, /* handle_empty_image */
FALSE, /* perfectmouse */
GIMP_MOUSE_CURSOR, /* cursor */
GIMP_TOOL_CURSOR_NONE, /* tool_cursor */
GIMP_CURSOR_MODIFIER_NONE, /* cursor_modifier */
GIMP_MOUSE_CURSOR, /* toggle_cursor */
GIMP_TOOL_CURSOR_NONE, /* toggle_tool_cursor */
GIMP_CURSOR_MODIFIER_NONE /* toggle_cursor_modifier */);
}
static void
......@@ -367,9 +380,9 @@ gimp_curves_tool_button_press (GimpTool *tool,
if (drawable != tool->drawable)
{
tool->preserve = TRUE;
gimp_tool_control_set_preserve(tool->control, TRUE);
image_map_abort (curves_dialog->image_map);
tool->preserve = FALSE;
gimp_tool_control_set_preserve(tool->control, FALSE);
tool->drawable = drawable;
......@@ -383,7 +396,7 @@ gimp_curves_tool_button_press (GimpTool *tool,
curves_dialog);
}
tool->state = ACTIVE;
gimp_tool_control_activate(tool->control);
curves_color_update (tool, gdisp, drawable, coords->x, coords->y);
curves_update (curves_dialog, GRAPH | DRAW);
......@@ -501,7 +514,7 @@ curves_color_update (GimpTool *tool,
gboolean is_indexed;
GimpImageType sample_type;
if (!tool || tool->state != ACTIVE)
if (!tool || !gimp_tool_control_is_active(tool->control))
return;
gimp_drawable_offsets (drawable, &offx, &offy);
......@@ -585,9 +598,9 @@ curves_free (void)
{
active_tool = tool_manager_get_active (the_gimp);
active_tool->preserve = TRUE;
gimp_tool_control_set_preserve(active_tool->control, TRUE);
image_map_abort (curves_dialog->image_map);
active_tool->preserve = FALSE;
gimp_tool_control_set_preserve(active_tool->control, FALSE);
curves_dialog->image_map = NULL;
}
......@@ -1219,10 +1232,10 @@ curves_preview (CurvesDialog *cd)
active_tool = tool_manager_get_active (the_gimp);
active_tool->preserve = TRUE;
gimp_tool_control_set_preserve(active_tool->control, TRUE);
image_map_apply (cd->image_map, (ImageMapApplyFunc)gimp_lut_process_2,
(void *) cd->lut);
active_tool->preserve = FALSE;
gimp_tool_control_set_preserve(active_tool->control, FALSE);
}
static void
......@@ -1376,7 +1389,7 @@ curves_ok_callback (GtkWidget *widget,
active_tool = tool_manager_get_active (the_gimp);
active_tool->preserve = TRUE; /* We're about to dirty... */
gimp_tool_control_set_preserve(active_tool->control, TRUE); /* We're about to dirty... */
if (!cd->preview)
image_map_apply (cd->image_map, (ImageMapApplyFunc)gimp_lut_process_2,
......@@ -1385,7 +1398,7 @@ curves_ok_callback (GtkWidget *widget,
if (cd->image_map)
image_map_commit (cd->image_map);
active_tool->preserve = FALSE;
gimp_tool_control_set_preserve(active_tool->control, FALSE);
cd->image_map = NULL;
......@@ -1408,9 +1421,9 @@ curves_cancel_callback (GtkWidget *widget,
if (cd->image_map)
{
active_tool->preserve = TRUE;
gimp_tool_control_set_preserve(active_tool->control, TRUE);
image_map_abort (cd->image_map);
active_tool->preserve = FALSE;
gimp_tool_control_set_preserve(active_tool->control, FALSE);
gdisplays_flush ();
cd->image_map = NULL;
......@@ -1471,9 +1484,9 @@ curves_preview_update (GtkWidget *widget,
{
active_tool = tool_manager_get_active (the_gimp);
active_tool->preserve = TRUE;
gimp_tool_control_set_preserve(active_tool->control, TRUE);
image_map_clear (cd->image_map);
active_tool->preserve = FALSE;
gimp_tool_control_set_preserve(active_tool->control, FALSE);
gdisplays_flush ();
}
}
......
......@@ -85,8 +85,8 @@ struct _CurvesDialog
};
void gimp_curves_tool_register (Gimp *gimp,
GimpToolRegisterCallback callback);
void gimp_curves_tool_register (GimpToolRegisterCallback callback,
Gimp *gimp);
GType gimp_curves_tool_get_type (void) G_GNUC_CONST;
......
......@@ -29,7 +29,9 @@
#include "libgimpmath/gimpmath.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "tools-types.h"
#include "core/core-types.h"
#include "display/display-types.h"
#include "libgimptool/gimptooltypes.h"
#include "base/pixel-region.h"
......@@ -123,11 +125,10 @@ static GimpImageMapToolClass *parent_class = NULL;
/* public functions */
void
gimp_hue_saturation_tool_register (Gimp *gimp,
GimpToolRegisterCallback callback)
gimp_hue_saturation_tool_register (GimpToolRegisterCallback callback,
Gimp *gimp)
{
(* callback) (gimp,
GIMP_TYPE_HUE_SATURATION_TOOL,
(* callback) (GIMP_TYPE_HUE_SATURATION_TOOL,
NULL,
FALSE,
"gimp-hue-saturation-tool",
......@@ -135,7 +136,8 @@ gimp_hue_saturation_tool_register (Gimp *gimp,
_("Adjust hue and saturation"),
N_("/Layer/Colors/Hue-Saturation..."), NULL,
NULL, "tools/hue_saturation.html",
GIMP_STOCK_TOOL_HUE_SATURATION);
GIMP_STOCK_TOOL_HUE_SATURATION,
gimp);
}
GType
......@@ -180,8 +182,19 @@ gimp_hue_saturation_tool_class_init (GimpHueSaturationToolClass *klass)
}
static void
gimp_hue_saturation_tool_init (GimpHueSaturationTool *bc_tool)
gimp_hue_saturation_tool_init (GimpHueSaturationTool *tool)
{
GIMP_TOOL(tool)->control = gimp_tool_control_new (FALSE, /* scroll_lock */
TRUE, /* auto_snap_to */
TRUE, /* preserve */
FALSE, /* handle_empty_image */
FALSE, /* perfectmouse */
GIMP_MOUSE_CURSOR, /* cursor */
GIMP_TOOL_CURSOR_NONE, /* tool_cursor */
GIMP_CURSOR_MODIFIER_NONE, /* cursor_modifier */
GIMP_MOUSE_CURSOR, /* toggle_cursor */
GIMP_TOOL_CURSOR_NONE, /* toggle_tool_cursor */
GIMP_CURSOR_MODIFIER_NONE /* toggle_cursor_modifier */);
}
static void
......@@ -375,9 +388,9 @@ hue_saturation_free (void)
{
if (hue_saturation_dialog->image_map)
{
active_tool->preserve = TRUE;
gimp_tool_control_set_preserve(active_tool->control, TRUE);
image_map_abort (hue_saturation_dialog->image_map);
active_tool->preserve = FALSE;
gimp_tool_control_set_preserve(active_tool->control, FALSE);
hue_saturation_dialog->image_map = NULL;
}
......@@ -716,9 +729,9 @@ hue_saturation_preview (HueSaturationDialog *hsd)
return;
}
active_tool->preserve = TRUE;
gimp_tool_control_set_preserve(active_tool->control, TRUE);
image_map_apply (hsd->image_map, hue_saturation, (void *) hsd);
active_tool->preserve = FALSE;
gimp_tool_control_set_preserve(active_tool->control, FALSE);
}
static void
......@@ -752,7 +765,7 @@ hue_saturation_ok_callback (GtkWidget *widget,
active_tool = tool_manager_get_active (the_gimp);
active_tool->preserve = TRUE;
gimp_tool_control_set_preserve(active_tool->control, TRUE);
if (!hsd->preview)
image_map_apply (hsd->image_map, hue_saturation, (gpointer) hsd);
......@@ -760,7 +773,7 @@ hue_saturation_ok_callback (GtkWidget *widget,
if (hsd->image_map)
image_map_commit (hsd->image_map);
active_tool->preserve = FALSE;
gimp_tool_control_set_preserve(active_tool->control, FALSE);
hsd->image_map = NULL;
......@@ -783,9 +796,9 @@ hue_saturation_cancel_callback (GtkWidget *widget,
if (hsd->image_map)
{
active_tool->preserve = TRUE;
gimp_tool_control_set_preserve(active_tool->control, TRUE);
image_map_abort (hsd->image_map);
active_tool->preserve = FALSE;
gimp_tool_control_set_preserve(active_tool->control, FALSE);
gdisplays_flush ();
hsd->image_map = NULL;
......@@ -832,9 +845,9 @@ hue_saturation_preview_update (GtkWidget *widget,
{
active_tool = tool_manager_get_active (the_gimp);
active_tool->preserve = TRUE;
gimp_tool_control_set_preserve(active_tool->control, TRUE);
image_map_clear (hsd->image_map);
active_tool->preserve = FALSE;
gimp_tool_control_set_preserve(active_tool->control, FALSE);
gdisplays_flush ();
}
}
......
......@@ -81,8 +81,8 @@ struct _HueSaturationDialog
};
void gimp_hue_saturation_tool_register (Gimp *gimp,
GimpToolRegisterCallback callback);
void gimp_hue_saturation_tool_register (GimpToolRegisterCallback callback,
Gimp *gimp);
GType gimp_hue_saturation_tool_get_type (void) G_GNUC_CONST;
......
......@@ -22,7 +22,9 @@
#include "libgimpwidgets/gimpwidgets.h"
#include "tools-types.h"
#include "core/core-types.h"
#include "display/display-types.h"
#include "libgimptool/gimptooltypes.h"
#include "base/gimphistogram.h"
#include "base/pixel-region.h"
......@@ -103,11 +105,10 @@ static GimpImageMapToolClass *parent_class = NULL;
/* functions */
void
gimp_threshold_tool_register (Gimp *gimp,
GimpToolRegisterCallback callback)
gimp_threshold_tool_register (GimpToolRegisterCallback callback,
Gimp *gimp)
{
(* callback) (gimp,
GIMP_TYPE_THRESHOLD_TOOL,
(* callback) (GIMP_TYPE_THRESHOLD_TOOL,
NULL,
FALSE,
"gimp-threshold-tool",
......@@ -115,7 +116,8 @@ gimp_threshold_tool_register (Gimp *gimp,
_("Reduce image to two colors using a threshold"),
N_("/Layer/Colors/Threshold..."), NULL,
NULL, "tools/threshold.html",
GIMP_STOCK_TOOL_THRESHOLD);
GIMP_STOCK_TOOL_THRESHOLD,
gimp);
}
GType
......@@ -462,9 +464,9 @@ threshold_preview (ThresholdDialog *td)
active_tool = tool_manager_get_active (the_gimp);
active_tool->preserve = TRUE;
gimp_tool_control_set_preserve(active_tool->control, TRUE);
image_map_apply (td->image_map, threshold, td);
active_tool->preserve = FALSE;
gimp_tool_control_set_preserve(active_tool->control, FALSE);
}
static void
......@@ -497,7 +499,7 @@ threshold_ok_callback (GtkWidget *widget,
active_tool = tool_manager_get_active (the_gimp);
active_tool->preserve = TRUE;
gimp_tool_control_set_preserve(active_tool->control, TRUE);
if (!td->preview)
image_map_apply (td->image_map, threshold, (gpointer) td);
......@@ -505,7 +507,7 @@ threshold_ok_callback (GtkWidget *widget,
if (td->image_map)
image_map_commit (td->image_map);
active_tool->preserve = FALSE;
gimp_tool_control_set_preserve(active_tool->control, FALSE);
td->image_map = NULL;
......@@ -528,9 +530,9 @@ threshold_cancel_callback (GtkWidget *widget,
if (td->image_map)
{
active_tool->preserve = TRUE;
gimp_tool_control_set_preserve(active_tool->control, TRUE);
image_map_abort (td->image_map);
active_tool->preserve = FALSE;
gimp_tool_control_set_preserve(active_tool->control, FALSE);
td->image_map = NULL;
gdisplays_flush ();
......@@ -561,9 +563,9 @@ threshold_preview_update (GtkWidget *widget,
{
active_tool = tool_manager_get_active (the_gimp);
active_tool->preserve = TRUE;
gimp_tool_control_set_preserve(active_tool->control, TRUE);
image_map_clear (td->image_map);
active_tool->preserve = FALSE;
gimp_tool_control_set_preserve(active_tool->control, FALSE);
gdisplays_flush ();
}
}
......
......@@ -68,8 +68,8 @@ struct _ThresholdDialog
};
void gimp_threshold_tool_register (Gimp *gimp,
GimpToolRegisterCallback callback);
void gimp_threshold_tool_register (GimpToolRegisterCallback callback,
Gimp *gimp);
GType gimp_threshold_tool_get_type (void) G_GNUC_CONST;
......
......@@ -16,21 +16,25 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*< proxy-skip >*/
#ifndef __CORE_ENUMS_H__
#define __CORE_ENUMS_H__
#if 0
This file is parsed by two scripts, enumgen.pl in tools/pdbgen
and gimp-mkenums. All enums that are not marked with /*< pdb-skip >*/
are exported to libgimp and the PDB. Enums that are not marked with
/*< skip >*/ are registered with the GType system. If you want the
enum to be skipped by both scripts, you have to use /*< pdb-skip >*/
_before_ /*< skip >*/.
This file is parsed by three scripts, enumgen.pl in tools/pdbgen,
gimp-mkenums, and gimp-mkproxy. All enums that are not marked with
/*< pdb-skip >*/ are exported to libgimp and the PDB. Enums that are
not marked with /*< skip >*/ are registered with the GType system.
If you want the enum to be skipped by both scripts, you have to use
/*< pdb-skip >*/ _before_ /*< skip >*/.
All enum values that are marked with /*< skip >*/ are skipped for
both targets.
#endif
Anything not between proxy-skip and proxy-resume
pairs will be copied into libgimpproxy by gimp-mkproxy.
#endif
/*
* these enums that are registered with the type system
......@@ -194,7 +198,7 @@ typedef enum /*< pdb-skip >*/
* non-registered enums; register them if needed
*/