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

massive tool plugin changes

parent 0855bfce
...@@ -116,8 +116,8 @@ INCLUDES = @STRIP_BEGIN@ \ ...@@ -116,8 +116,8 @@ INCLUDES = @STRIP_BEGIN@ \
gimp_1_3_LDADD = @STRIP_BEGIN@ \ gimp_1_3_LDADD = @STRIP_BEGIN@ \
gui/libappgui.a \ gui/libappgui.a \
tools/libapptools.a \
display/libappdisplay.a \ display/libappdisplay.a \
tools/libapptools.a \
widgets/libappwidgets.a \ widgets/libappwidgets.a \
core/libappcore.a \ core/libappcore.a \
pdb/libapppdb.a \ pdb/libapppdb.a \
...@@ -133,6 +133,7 @@ gimp_1_3_LDADD = @STRIP_BEGIN@ \ ...@@ -133,6 +133,7 @@ gimp_1_3_LDADD = @STRIP_BEGIN@ \
$(top_builddir)/libgimpmath/libgimpmath-$(LT_RELEASE).la \ $(top_builddir)/libgimpmath/libgimpmath-$(LT_RELEASE).la \
$(top_builddir)/libgimpbase/libgimpbase-$(LT_RELEASE).la \ $(top_builddir)/libgimpbase/libgimpbase-$(LT_RELEASE).la \
$(top_builddir)/libgimpwidgets/libgimpwidgets-$(LT_RELEASE).la \ $(top_builddir)/libgimpwidgets/libgimpwidgets-$(LT_RELEASE).la \
$(top_builddir)/libgimptool/libgimptool-$(LT_RELEASE).la \
$(GTK_LIBS) \ $(GTK_LIBS) \
$(PANGOFT2_LIBS) \ $(PANGOFT2_LIBS) \
$(LIBART_LIBS) \ $(LIBART_LIBS) \
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "display/gimpdisplay.h" #include "display/gimpdisplay.h"
#include "tools/gimptool.h" #include "libgimptool/gimptool.h"
#include "tools/tool_manager.h" #include "tools/tool_manager.h"
......
...@@ -24,7 +24,9 @@ ...@@ -24,7 +24,9 @@
#include "libgimpmath/gimpmath.h" #include "libgimpmath/gimpmath.h"
#include "libgimpwidgets/gimpwidgets.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" #include "base/pixel-region.h"
...@@ -97,11 +99,10 @@ static GimpImageMapToolClass *parent_class = NULL; ...@@ -97,11 +99,10 @@ static GimpImageMapToolClass *parent_class = NULL;
/* functions */ /* functions */
void void
gimp_color_balance_tool_register (Gimp *gimp, gimp_color_balance_tool_register (GimpToolRegisterCallback callback,
GimpToolRegisterCallback callback) Gimp *gimp)
{ {
(* callback) (gimp, (* callback) (GIMP_TYPE_COLOR_BALANCE_TOOL,
GIMP_TYPE_COLOR_BALANCE_TOOL,
NULL, NULL,
FALSE, FALSE,
"gimp-color-balance-tool", "gimp-color-balance-tool",
...@@ -109,7 +110,8 @@ gimp_color_balance_tool_register (Gimp *gimp, ...@@ -109,7 +110,8 @@ gimp_color_balance_tool_register (Gimp *gimp,
_("Adjust color balance"), _("Adjust color balance"),
N_("/Layer/Colors/Color Balance..."), NULL, N_("/Layer/Colors/Color Balance..."), NULL,
NULL, "tools/color_balance.html", NULL, "tools/color_balance.html",
GIMP_STOCK_TOOL_COLOR_BALANCE); GIMP_STOCK_TOOL_COLOR_BALANCE,
gimp);
} }
GType GType
...@@ -158,6 +160,17 @@ gimp_color_balance_tool_class_init (GimpColorBalanceToolClass *klass) ...@@ -158,6 +160,17 @@ gimp_color_balance_tool_class_init (GimpColorBalanceToolClass *klass)
static void static void
gimp_color_balance_tool_init (GimpColorBalanceTool *bc_tool) 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 static void
...@@ -541,10 +554,10 @@ color_balance_preview (ColorBalanceDialog *cbd) ...@@ -541,10 +554,10 @@ color_balance_preview (ColorBalanceDialog *cbd)
return; return;
} }
active_tool->preserve = TRUE; gimp_tool_control_set_preserve(active_tool->control, TRUE);
color_balance_create_lookup_tables (cbd); color_balance_create_lookup_tables (cbd);
image_map_apply (cbd->image_map, color_balance, (void *) 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 static void
...@@ -578,7 +591,7 @@ color_balance_ok_callback (GtkWidget *widget, ...@@ -578,7 +591,7 @@ color_balance_ok_callback (GtkWidget *widget,
active_tool = tool_manager_get_active (the_gimp); active_tool = tool_manager_get_active (the_gimp);
active_tool->preserve = TRUE; gimp_tool_control_set_preserve(active_tool->control, TRUE);
if (!cbd->preview) if (!cbd->preview)
image_map_apply (cbd->image_map, color_balance, (void *) cbd); image_map_apply (cbd->image_map, color_balance, (void *) cbd);
...@@ -586,7 +599,7 @@ color_balance_ok_callback (GtkWidget *widget, ...@@ -586,7 +599,7 @@ color_balance_ok_callback (GtkWidget *widget,
if (cbd->image_map) if (cbd->image_map)
image_map_commit (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; cbd->image_map = NULL;
...@@ -609,9 +622,9 @@ color_balance_cancel_callback (GtkWidget *widget, ...@@ -609,9 +622,9 @@ color_balance_cancel_callback (GtkWidget *widget,
if (cbd->image_map) if (cbd->image_map)
{ {
active_tool->preserve = TRUE; gimp_tool_control_set_preserve(active_tool->control, TRUE);
image_map_abort (cbd->image_map); image_map_abort (cbd->image_map);
active_tool->preserve = FALSE; gimp_tool_control_set_preserve(active_tool->control, FALSE);
gdisplays_flush (); gdisplays_flush ();
cbd->image_map = NULL; cbd->image_map = NULL;
...@@ -670,9 +683,9 @@ color_balance_preview_update (GtkWidget *widget, ...@@ -670,9 +683,9 @@ color_balance_preview_update (GtkWidget *widget,
{ {
active_tool = tool_manager_get_active (the_gimp); 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); image_map_clear (cbd->image_map);
active_tool->preserve = FALSE; gimp_tool_control_set_preserve(active_tool->control, FALSE);
gdisplays_flush (); gdisplays_flush ();
} }
} }
......
...@@ -73,8 +73,8 @@ struct _ColorBalanceDialog ...@@ -73,8 +73,8 @@ struct _ColorBalanceDialog
}; };
void gimp_color_balance_tool_register (Gimp *gimp, void gimp_color_balance_tool_register (GimpToolRegisterCallback callback,
GimpToolRegisterCallback callback); Gimp *gimp);
GType gimp_color_balance_tool_get_type (void) G_GNUC_CONST; GType gimp_color_balance_tool_get_type (void) G_GNUC_CONST;
......
...@@ -33,7 +33,9 @@ ...@@ -33,7 +33,9 @@
#include "libgimpbase/gimpbase.h" #include "libgimpbase/gimpbase.h"
#include "libgimpwidgets/gimpwidgets.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/gimphistogram.h"
#include "base/gimplut.h" #include "base/gimplut.h"
...@@ -205,11 +207,10 @@ static GimpImageMapToolClass *parent_class = NULL; ...@@ -205,11 +207,10 @@ static GimpImageMapToolClass *parent_class = NULL;
/* public functions */ /* public functions */
void void
gimp_curves_tool_register (Gimp *gimp, gimp_curves_tool_register (GimpToolRegisterCallback callback,
GimpToolRegisterCallback callback) Gimp *gimp)
{ {
(* callback) (gimp, (* callback) (GIMP_TYPE_CURVES_TOOL,
GIMP_TYPE_CURVES_TOOL,
NULL, NULL,
FALSE, FALSE,
"gimp-curves-tool", "gimp-curves-tool",
...@@ -217,7 +218,8 @@ gimp_curves_tool_register (Gimp *gimp, ...@@ -217,7 +218,8 @@ gimp_curves_tool_register (Gimp *gimp,
_("Adjust color curves"), _("Adjust color curves"),
N_("/Layer/Colors/Curves..."), NULL, N_("/Layer/Colors/Curves..."), NULL,
NULL, "tools/curves.html", NULL, "tools/curves.html",
GIMP_STOCK_TOOL_CURVES); GIMP_STOCK_TOOL_CURVES,
gimp);
} }
GType GType
...@@ -267,6 +269,17 @@ gimp_curves_tool_class_init (GimpCurvesToolClass *klass) ...@@ -267,6 +269,17 @@ gimp_curves_tool_class_init (GimpCurvesToolClass *klass)
static void static void
gimp_curves_tool_init (GimpCurvesTool *bc_tool) 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 static void
...@@ -367,9 +380,9 @@ gimp_curves_tool_button_press (GimpTool *tool, ...@@ -367,9 +380,9 @@ gimp_curves_tool_button_press (GimpTool *tool,
if (drawable != tool->drawable) if (drawable != tool->drawable)
{ {
tool->preserve = TRUE; gimp_tool_control_set_preserve(tool->control, TRUE);
image_map_abort (curves_dialog->image_map); image_map_abort (curves_dialog->image_map);
tool->preserve = FALSE; gimp_tool_control_set_preserve(tool->control, FALSE);
tool->drawable = drawable; tool->drawable = drawable;
...@@ -383,7 +396,7 @@ gimp_curves_tool_button_press (GimpTool *tool, ...@@ -383,7 +396,7 @@ gimp_curves_tool_button_press (GimpTool *tool,
curves_dialog); curves_dialog);
} }
tool->state = ACTIVE; gimp_tool_control_activate(tool->control);
curves_color_update (tool, gdisp, drawable, coords->x, coords->y); curves_color_update (tool, gdisp, drawable, coords->x, coords->y);
curves_update (curves_dialog, GRAPH | DRAW); curves_update (curves_dialog, GRAPH | DRAW);
...@@ -501,7 +514,7 @@ curves_color_update (GimpTool *tool, ...@@ -501,7 +514,7 @@ curves_color_update (GimpTool *tool,
gboolean is_indexed; gboolean is_indexed;
GimpImageType sample_type; GimpImageType sample_type;
if (!tool || tool->state != ACTIVE) if (!tool || !gimp_tool_control_is_active(tool->control))
return; return;
gimp_drawable_offsets (drawable, &offx, &offy); gimp_drawable_offsets (drawable, &offx, &offy);
...@@ -585,9 +598,9 @@ curves_free (void) ...@@ -585,9 +598,9 @@ curves_free (void)
{ {
active_tool = tool_manager_get_active (the_gimp); 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); 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; curves_dialog->image_map = NULL;
} }
...@@ -1219,10 +1232,10 @@ curves_preview (CurvesDialog *cd) ...@@ -1219,10 +1232,10 @@ curves_preview (CurvesDialog *cd)
active_tool = tool_manager_get_active (the_gimp); 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, image_map_apply (cd->image_map, (ImageMapApplyFunc)gimp_lut_process_2,
(void *) cd->lut); (void *) cd->lut);
active_tool->preserve = FALSE; gimp_tool_control_set_preserve(active_tool->control, FALSE);
} }
static void static void
...@@ -1376,7 +1389,7 @@ curves_ok_callback (GtkWidget *widget, ...@@ -1376,7 +1389,7 @@ curves_ok_callback (GtkWidget *widget,
active_tool = tool_manager_get_active (the_gimp); 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) if (!cd->preview)
image_map_apply (cd->image_map, (ImageMapApplyFunc)gimp_lut_process_2, image_map_apply (cd->image_map, (ImageMapApplyFunc)gimp_lut_process_2,
...@@ -1385,7 +1398,7 @@ curves_ok_callback (GtkWidget *widget, ...@@ -1385,7 +1398,7 @@ curves_ok_callback (GtkWidget *widget,
if (cd->image_map) if (cd->image_map)
image_map_commit (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; cd->image_map = NULL;
...@@ -1408,9 +1421,9 @@ curves_cancel_callback (GtkWidget *widget, ...@@ -1408,9 +1421,9 @@ curves_cancel_callback (GtkWidget *widget,
if (cd->image_map) if (cd->image_map)
{ {
active_tool->preserve = TRUE; gimp_tool_control_set_preserve(active_tool->control, TRUE);
image_map_abort (cd->image_map); image_map_abort (cd->image_map);
active_tool->preserve = FALSE; gimp_tool_control_set_preserve(active_tool->control, FALSE);
gdisplays_flush (); gdisplays_flush ();
cd->image_map = NULL; cd->image_map = NULL;
...@@ -1471,9 +1484,9 @@ curves_preview_update (GtkWidget *widget, ...@@ -1471,9 +1484,9 @@ curves_preview_update (GtkWidget *widget,
{ {
active_tool = tool_manager_get_active (the_gimp); 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); image_map_clear (cd->image_map);
active_tool->preserve = FALSE; gimp_tool_control_set_preserve(active_tool->control, FALSE);
gdisplays_flush (); gdisplays_flush ();
} }
} }
......
...@@ -85,8 +85,8 @@ struct _CurvesDialog ...@@ -85,8 +85,8 @@ struct _CurvesDialog
}; };
void gimp_curves_tool_register (Gimp *gimp, void gimp_curves_tool_register (GimpToolRegisterCallback callback,
GimpToolRegisterCallback callback); Gimp *gimp);
GType gimp_curves_tool_get_type (void) G_GNUC_CONST; GType gimp_curves_tool_get_type (void) G_GNUC_CONST;
......
...@@ -29,7 +29,9 @@ ...@@ -29,7 +29,9 @@
#include "libgimpmath/gimpmath.h" #include "libgimpmath/gimpmath.h"
#include "libgimpwidgets/gimpwidgets.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" #include "base/pixel-region.h"
...@@ -123,11 +125,10 @@ static GimpImageMapToolClass *parent_class = NULL; ...@@ -123,11 +125,10 @@ static GimpImageMapToolClass *parent_class = NULL;
/* public functions */ /* public functions */
void void
gimp_hue_saturation_tool_register (Gimp *gimp, gimp_hue_saturation_tool_register (GimpToolRegisterCallback callback,
GimpToolRegisterCallback callback) Gimp *gimp)
{ {
(* callback) (gimp, (* callback) (GIMP_TYPE_HUE_SATURATION_TOOL,
GIMP_TYPE_HUE_SATURATION_TOOL,
NULL, NULL,
FALSE, FALSE,
"gimp-hue-saturation-tool", "gimp-hue-saturation-tool",
...@@ -135,7 +136,8 @@ gimp_hue_saturation_tool_register (Gimp *gimp, ...@@ -135,7 +136,8 @@ gimp_hue_saturation_tool_register (Gimp *gimp,
_("Adjust hue and saturation"), _("Adjust hue and saturation"),
N_("/Layer/Colors/Hue-Saturation..."), NULL, N_("/Layer/Colors/Hue-Saturation..."), NULL,
NULL, "tools/hue_saturation.html", NULL, "tools/hue_saturation.html",
GIMP_STOCK_TOOL_HUE_SATURATION); GIMP_STOCK_TOOL_HUE_SATURATION,
gimp);
} }
GType GType
...@@ -180,8 +182,19 @@ gimp_hue_saturation_tool_class_init (GimpHueSaturationToolClass *klass) ...@@ -180,8 +182,19 @@ gimp_hue_saturation_tool_class_init (GimpHueSaturationToolClass *klass)
} }
static void 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 static void
...@@ -375,9 +388,9 @@ hue_saturation_free (void) ...@@ -375,9 +388,9 @@ hue_saturation_free (void)
{ {
if (hue_saturation_dialog->image_map) 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); 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; hue_saturation_dialog->image_map = NULL;
} }
...@@ -716,9 +729,9 @@ hue_saturation_preview (HueSaturationDialog *hsd) ...@@ -716,9 +729,9 @@ hue_saturation_preview (HueSaturationDialog *hsd)
return; return;
} }
active_tool->preserve = TRUE; gimp_tool_control_set_preserve(active_tool->control, TRUE);
image_map_apply (hsd->image_map, hue_saturation, (void *) hsd); 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 static void
...@@ -752,7 +765,7 @@ hue_saturation_ok_callback (GtkWidget *widget, ...@@ -752,7 +765,7 @@ hue_saturation_ok_callback (GtkWidget *widget,
active_tool = tool_manager_get_active (the_gimp); active_tool = tool_manager_get_active (the_gimp);
active_tool->preserve = TRUE; gimp_tool_control_set_preserve(active_tool->control, TRUE);
if (!hsd->preview) if (!hsd->preview)
image_map_apply (hsd->image_map, hue_saturation, (gpointer) hsd); image_map_apply (hsd->image_map, hue_saturation, (gpointer) hsd);
...@@ -760,7 +773,7 @@ hue_saturation_ok_callback (GtkWidget *widget, ...@@ -760,7 +773,7 @@ hue_saturation_ok_callback (GtkWidget *widget,
if (hsd->image_map) if (hsd->image_map)
image_map_commit (hsd->image_map); image_map_commit (hsd->image_map);
active_tool->preserve = FALSE;