app/gimage.c app/tools.c Added a field in the Tools struct, preserve.

Tue Mar 31 02:21:15 EST 1998 Matthew Wilson <msw@gimp.org>

	* app/gimage.c
	* app/tools.c
	* app/tools.h: Added a field in the Tools struct, preserve.
	During gimage_dirty, if this flag is not set the tool will be
	reset.  This is good for tools that keep a copy of the image
	in cache for local manipulation like transform_core.

	* app/bezier_select.c
	* app/blend.c
	* app/brightness_contrast.c
	* app/bucket_fill.c
	* app/color_balance.c
	* app/color_picker.c
	* app/crop.c
	* app/curves.c
	* app/ellipse_select.c
	* app/free_select.c
	* app/histogram_tool.c
	* app/hue_saturation.c
	* app/levels.c
	* app/move.c
	* app/paint_core.c
	* app/posterize.c
	* app/rect_select.c
	* app/text_tool.c
	* app/transform_core.c: Set the preserve flag to the correct
	values in the new functions and wrapped calls to functions that
	dirty the gimage to prevent tool restarts.

	* app/disp_callbacks.c
	* app/menus.c: Removed Nether's tool patch.

--phew.  Matt
This commit is contained in:
EST 1998 Matthew Wilson 1998-03-31 07:23:50 +00:00 committed by Matt Wilson
parent bd6b3ae4b9
commit 7dcd8e85ab
70 changed files with 387 additions and 364 deletions

View File

@ -1,3 +1,38 @@
Tue Mar 31 02:21:15 EST 1998 Matthew Wilson <msw@gimp.org>
* app/gimage.c
* app/tools.c
* app/tools.h: Added a field in the Tools struct, preserve.
During gimage_dirty, if this flag is not set the tool will be
reset. This is good for tools that keep a copy of the image
in cache for local manipulation like transform_core.
* app/bezier_select.c
* app/blend.c
* app/brightness_contrast.c
* app/bucket_fill.c
* app/color_balance.c
* app/color_picker.c
* app/crop.c
* app/curves.c
* app/ellipse_select.c
* app/free_select.c
* app/histogram_tool.c
* app/hue_saturation.c
* app/levels.c
* app/move.c
* app/paint_core.c
* app/posterize.c
* app/rect_select.c
* app/text_tool.c
* app/transform_core.c: Set the preserve flag to the correct
values in the new functions and wrapped calls to functions that
dirty the gimage to prevent tool restarts.
* app/disp_callbacks.c
* app/menus.c: Removed Nether's tool patch.
Mon Mar 30 21:58:34 PST 1998 Manish Singh <yosh@gimp.org>
* app/brush_select.c

View File

@ -251,7 +251,9 @@ color_balance_control (Tool *tool,
case HALT :
if (color_balance_dialog)
{
active_tool->preserve = TRUE;
image_map_abort (color_balance_dialog->image_map);
active_tool->preserve = FALSE;
color_balance_dialog->image_map = NULL;
color_balance_cancel_callback (NULL, (gpointer) color_balance_dialog);
}
@ -283,6 +285,7 @@ tools_new_color_balance ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = color_balance_cursor_update;
tool->control_func = color_balance_control;
tool->preserve = FALSE;
return tool;
}
@ -613,7 +616,9 @@ color_balance_preview (ColorBalanceDialog *cbd)
{
if (!cbd->image_map)
g_warning ("No image map");
active_tool->preserve = TRUE;
image_map_apply (cbd->image_map, color_balance, (void *) cbd);
active_tool->preserve = FALSE;
}
static void
@ -626,6 +631,8 @@ color_balance_ok_callback (GtkWidget *widget,
if (GTK_WIDGET_VISIBLE (cbd->shell))
gtk_widget_hide (cbd->shell);
active_tool->preserve = TRUE;
if (!cbd->preview)
image_map_apply (cbd->image_map, color_balance, (void *) cbd);
@ -633,6 +640,8 @@ color_balance_ok_callback (GtkWidget *widget,
if (cbd->image_map)
image_map_commit (cbd->image_map);
active_tool->preserve = FALSE;
cbd->image_map = NULL;
}
@ -658,7 +667,9 @@ color_balance_cancel_callback (GtkWidget *widget,
if (cbd->image_map)
{
active_tool->preserve = TRUE;
image_map_abort (cbd->image_map);
active_tool->preserve = FALSE;
gdisplays_flush ();
}

View File

@ -252,7 +252,9 @@ curves_control (Tool *tool,
case HALT :
if (curves_dialog)
{
active_tool->preserve = TRUE;
image_map_abort (curves_dialog->image_map);
active_tool->preserve = FALSE;
curves_dialog->image_map = NULL;
curves_cancel_callback (NULL, (gpointer) curves_dialog);
}
@ -284,6 +286,7 @@ tools_new_curves ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = curves_cursor_update;
tool->control_func = curves_control;
tool->preserve = TRUE;
return tool;
}
@ -400,7 +403,9 @@ curves_free ()
{
if (curves_dialog->image_map)
{
active_tool->preserve = TRUE;
image_map_abort (curves_dialog->image_map);
active_tool->preserve = FALSE;
curves_dialog->image_map = NULL;
}
if (curves_dialog->pixmap)
@ -804,7 +809,12 @@ curves_preview (CurvesDialog *cd)
{
if (!cd->image_map)
g_warning ("No image map");
active_tool->preserve = TRUE; /* Going to dirty the display... */
image_map_apply (cd->image_map, curves, (void *) cd);
active_tool->preserve = FALSE; /* All done */
}
static void
@ -966,12 +976,16 @@ curves_ok_callback (GtkWidget *widget,
if (GTK_WIDGET_VISIBLE (cd->shell))
gtk_widget_hide (cd->shell);
active_tool->preserve = TRUE; /* We're about to dirty... */
if (!cd->preview)
image_map_apply (cd->image_map, curves, (void *) cd);
if (cd->image_map)
image_map_commit (cd->image_map);
active_tool->preserve = FALSE;
cd->image_map = NULL;
}
@ -987,7 +1001,9 @@ curves_cancel_callback (GtkWidget *widget,
if (cd->image_map)
{
active_tool->preserve = TRUE;
image_map_abort (cd->image_map);
active_tool->preserve = FALSE;
gdisplays_flush ();
}
@ -1010,7 +1026,7 @@ curves_preview_update (GtkWidget *w,
CurvesDialog *cd;
cd = (CurvesDialog *) data;
if (GTK_TOGGLE_BUTTON (w)->active)
{
cd->preview = TRUE;

View File

@ -295,7 +295,9 @@ hue_saturation_control (Tool *tool,
case HALT :
if (hue_saturation_dialog)
{
active_tool->preserve = TRUE;
image_map_abort (hue_saturation_dialog->image_map);
active_tool->preserve = FALSE;
hue_saturation_dialog->image_map = NULL;
hue_saturation_cancel_callback (NULL, (gpointer) hue_saturation_dialog);
}
@ -327,6 +329,7 @@ tools_new_hue_saturation ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = hue_saturation_cursor_update;
tool->control_func = hue_saturation_control;
tool->preserve = FALSE;
return tool;
}
@ -385,7 +388,9 @@ hue_saturation_free ()
{
if (hue_saturation_dialog->image_map)
{
active_tool->preserve = TRUE;
image_map_abort (hue_saturation_dialog->image_map);
active_tool->preserve = FALSE;
hue_saturation_dialog->image_map = NULL;
}
gtk_widget_destroy (hue_saturation_dialog->shell);
@ -724,7 +729,9 @@ hue_saturation_preview (HueSaturationDialog *hsd)
{
if (!hsd->image_map)
g_warning ("No image map");
active_tool->preserve = TRUE;
image_map_apply (hsd->image_map, hue_saturation, (void *) hsd);
active_tool->preserve = FALSE;
}
static void
@ -738,12 +745,16 @@ hue_saturation_ok_callback (GtkWidget *widget,
if (GTK_WIDGET_VISIBLE (hsd->shell))
gtk_widget_hide (hsd->shell);
active_tool->preserve = TRUE;
if (!hsd->preview)
image_map_apply (hsd->image_map, hue_saturation, (void *) hsd);
if (hsd->image_map)
image_map_commit (hsd->image_map);
active_tool->preserve = FALSE;
hsd->image_map = NULL;
}
@ -769,7 +780,9 @@ hue_saturation_cancel_callback (GtkWidget *widget,
if (hsd->image_map)
{
active_tool->preserve = TRUE;
image_map_abort (hsd->image_map);
active_tool->preserve = FALSE;
gdisplays_flush ();
}

View File

@ -139,6 +139,7 @@ tools_new_bezier_select ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = bezier_select_control;
tool->preserve = TRUE;
return tool;
}
@ -246,9 +247,10 @@ bezier_select_button_press (Tool *tool,
grab_pointer = 0;
/* If the tool was being used in another image...reset it */
if (tool->state == ACTIVE && gdisp_ptr != tool->gdisp_ptr)
if (tool->state == ACTIVE && gdisp_ptr != tool->gdisp_ptr) {
printf("Reset!\n");
bezier_select_reset (bezier_sel);
}
gdisplay_untransform_coords (gdisp, bevent->x, bevent->y, &x, &y, TRUE, 0);
/* get halfwidth in image coord */

View File

@ -1657,6 +1657,7 @@ tools_new_blend ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = blend_cursor_update;
tool->control_func = blend_control;
tool->preserve = TRUE;
return tool;
}

View File

@ -217,7 +217,9 @@ brightness_contrast_control (Tool *tool,
case HALT :
if (brightness_contrast_dialog)
{
active_tool->preserve = TRUE;
image_map_abort (brightness_contrast_dialog->image_map);
active_tool->preserve = TRUE;
brightness_contrast_dialog->image_map = NULL;
brightness_contrast_cancel_callback (NULL, (gpointer) brightness_contrast_dialog);
}
@ -250,6 +252,7 @@ tools_new_brightness_contrast ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = brightness_contrast_cursor_update;
tool->control_func = brightness_contrast_control;
tool->preserve = FALSE;
return tool;
}
@ -475,7 +478,9 @@ brightness_contrast_preview (BrightnessContrastDialog *bcd)
{
if (!bcd->image_map)
g_warning ("No image map");
active_tool->preserve = TRUE;
image_map_apply (bcd->image_map, brightness_contrast, (void *) bcd);
active_tool->preserve = FALSE;
}
static void
@ -489,12 +494,16 @@ brightness_contrast_ok_callback (GtkWidget *widget,
if (GTK_WIDGET_VISIBLE (bcd->shell))
gtk_widget_hide (bcd->shell);
active_tool->preserve = TRUE;
if (!bcd->preview)
image_map_apply (bcd->image_map, brightness_contrast, (void *) bcd);
if (bcd->image_map)
image_map_commit (bcd->image_map);
active_tool->preserve = FALSE;
bcd->image_map = NULL;
}
@ -520,7 +529,9 @@ brightness_contrast_cancel_callback (GtkWidget *widget,
if (bcd->image_map)
{
active_tool->preserve = TRUE;
image_map_abort (bcd->image_map);
active_tool->preserve = FALSE;
gdisplays_flush ();
}

View File

@ -673,6 +673,7 @@ tools_new_bucket_fill ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = bucket_fill_cursor_update;
tool->control_func = bucket_fill_control;
tool->preserve = TRUE;
return tool;
}

View File

@ -251,7 +251,9 @@ color_balance_control (Tool *tool,
case HALT :
if (color_balance_dialog)
{
active_tool->preserve = TRUE;
image_map_abort (color_balance_dialog->image_map);
active_tool->preserve = FALSE;
color_balance_dialog->image_map = NULL;
color_balance_cancel_callback (NULL, (gpointer) color_balance_dialog);
}
@ -283,6 +285,7 @@ tools_new_color_balance ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = color_balance_cursor_update;
tool->control_func = color_balance_control;
tool->preserve = FALSE;
return tool;
}
@ -613,7 +616,9 @@ color_balance_preview (ColorBalanceDialog *cbd)
{
if (!cbd->image_map)
g_warning ("No image map");
active_tool->preserve = TRUE;
image_map_apply (cbd->image_map, color_balance, (void *) cbd);
active_tool->preserve = FALSE;
}
static void
@ -626,6 +631,8 @@ color_balance_ok_callback (GtkWidget *widget,
if (GTK_WIDGET_VISIBLE (cbd->shell))
gtk_widget_hide (cbd->shell);
active_tool->preserve = TRUE;
if (!cbd->preview)
image_map_apply (cbd->image_map, color_balance, (void *) cbd);
@ -633,6 +640,8 @@ color_balance_ok_callback (GtkWidget *widget,
if (cbd->image_map)
image_map_commit (cbd->image_map);
active_tool->preserve = FALSE;
cbd->image_map = NULL;
}
@ -658,7 +667,9 @@ color_balance_cancel_callback (GtkWidget *widget,
if (cbd->image_map)
{
active_tool->preserve = TRUE;
image_map_abort (cbd->image_map);
active_tool->preserve = FALSE;
gdisplays_flush ();
}

View File

@ -456,6 +456,7 @@ tools_new_color_picker ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = color_picker_cursor_update;
tool->control_func = color_picker_control;
tool->preserve = TRUE;
return tool;
}

View File

@ -1657,6 +1657,7 @@ tools_new_blend ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = blend_cursor_update;
tool->control_func = blend_control;
tool->preserve = TRUE;
return tool;
}

View File

@ -524,6 +524,7 @@ tools_new_crop ()
tool->arrow_keys_func = crop_arrow_keys_func;
tool->cursor_update_func = crop_cursor_update;
tool->control_func = crop_control;
tool->preserve = TRUE; /* XXX Check me */
return tool;
}

View File

@ -252,7 +252,9 @@ curves_control (Tool *tool,
case HALT :
if (curves_dialog)
{
active_tool->preserve = TRUE;
image_map_abort (curves_dialog->image_map);
active_tool->preserve = FALSE;
curves_dialog->image_map = NULL;
curves_cancel_callback (NULL, (gpointer) curves_dialog);
}
@ -284,6 +286,7 @@ tools_new_curves ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = curves_cursor_update;
tool->control_func = curves_control;
tool->preserve = TRUE;
return tool;
}
@ -400,7 +403,9 @@ curves_free ()
{
if (curves_dialog->image_map)
{
active_tool->preserve = TRUE;
image_map_abort (curves_dialog->image_map);
active_tool->preserve = FALSE;
curves_dialog->image_map = NULL;
}
if (curves_dialog->pixmap)
@ -804,7 +809,12 @@ curves_preview (CurvesDialog *cd)
{
if (!cd->image_map)
g_warning ("No image map");
active_tool->preserve = TRUE; /* Going to dirty the display... */
image_map_apply (cd->image_map, curves, (void *) cd);
active_tool->preserve = FALSE; /* All done */
}
static void
@ -966,12 +976,16 @@ curves_ok_callback (GtkWidget *widget,
if (GTK_WIDGET_VISIBLE (cd->shell))
gtk_widget_hide (cd->shell);
active_tool->preserve = TRUE; /* We're about to dirty... */
if (!cd->preview)
image_map_apply (cd->image_map, curves, (void *) cd);
if (cd->image_map)
image_map_commit (cd->image_map);
active_tool->preserve = FALSE;
cd->image_map = NULL;
}
@ -987,7 +1001,9 @@ curves_cancel_callback (GtkWidget *widget,
if (cd->image_map)
{
active_tool->preserve = TRUE;
image_map_abort (cd->image_map);
active_tool->preserve = FALSE;
gdisplays_flush ();
}
@ -1010,7 +1026,7 @@ curves_preview_update (GtkWidget *w,
CurvesDialog *cd;
cd = (CurvesDialog *) data;
if (GTK_TOGGLE_BUTTON (w)->active)
{
cd->preview = TRUE;

View File

@ -138,8 +138,6 @@ gdisplay_canvas_events (GtkWidget *canvas,
{
case 1:
gtk_grab_add (canvas);
if (!active_tool)
active_tool_control (RECREATE, gdisp);
if (active_tool && ((active_tool->type == MOVE) ||
!gimage_is_empty (gdisp->gimage)))
{
@ -149,12 +147,6 @@ gdisplay_canvas_events (GtkWidget *canvas,
bevent->x = tx;
bevent->y = ty;
}
if (gimage_get_active_layer (gdisp->gimage) != active_tool_layer)
{
active_tool_control (RECREATE, gdisp);
active_tool_layer = gimage_get_active_layer (gdisp->gimage);
}
(* active_tool->button_press_func) (active_tool, bevent, gdisp);
}
break;
@ -344,9 +336,6 @@ gdisplay_hruler_button_press (GtkWidget *widget,
{
gdisp = data;
if (!active_tool)
active_tool_control (RECREATE, gdisp);
gtk_widget_activate (tool_widgets[tool_info[(int) MOVE].toolbar_position]);
move_tool_start_hguide (active_tool, gdisp);
gtk_grab_add (gdisp->canvas);
@ -366,9 +355,6 @@ gdisplay_vruler_button_press (GtkWidget *widget,
{
gdisp = data;
if (!active_tool)
active_tool_control (RECREATE, gdisp);
gtk_widget_activate (tool_widgets[tool_info[(int) MOVE].toolbar_position]);
move_tool_start_vguide (active_tool, gdisp);
gtk_grab_add (gdisp->canvas);

View File

@ -138,8 +138,6 @@ gdisplay_canvas_events (GtkWidget *canvas,
{
case 1:
gtk_grab_add (canvas);
if (!active_tool)
active_tool_control (RECREATE, gdisp);
if (active_tool && ((active_tool->type == MOVE) ||
!gimage_is_empty (gdisp->gimage)))
{
@ -149,12 +147,6 @@ gdisplay_canvas_events (GtkWidget *canvas,
bevent->x = tx;
bevent->y = ty;
}
if (gimage_get_active_layer (gdisp->gimage) != active_tool_layer)
{
active_tool_control (RECREATE, gdisp);
active_tool_layer = gimage_get_active_layer (gdisp->gimage);
}
(* active_tool->button_press_func) (active_tool, bevent, gdisp);
}
break;
@ -344,9 +336,6 @@ gdisplay_hruler_button_press (GtkWidget *widget,
{
gdisp = data;
if (!active_tool)
active_tool_control (RECREATE, gdisp);
gtk_widget_activate (tool_widgets[tool_info[(int) MOVE].toolbar_position]);
move_tool_start_hguide (active_tool, gdisp);
gtk_grab_add (gdisp->canvas);
@ -366,9 +355,6 @@ gdisplay_vruler_button_press (GtkWidget *widget,
{
gdisp = data;
if (!active_tool)
active_tool_control (RECREATE, gdisp);
gtk_widget_activate (tool_widgets[tool_info[(int) MOVE].toolbar_position]);
move_tool_start_vguide (active_tool, gdisp);
gtk_grab_add (gdisp->canvas);

View File

@ -138,8 +138,6 @@ gdisplay_canvas_events (GtkWidget *canvas,
{
case 1:
gtk_grab_add (canvas);
if (!active_tool)
active_tool_control (RECREATE, gdisp);
if (active_tool && ((active_tool->type == MOVE) ||
!gimage_is_empty (gdisp->gimage)))
{
@ -149,12 +147,6 @@ gdisplay_canvas_events (GtkWidget *canvas,
bevent->x = tx;
bevent->y = ty;
}
if (gimage_get_active_layer (gdisp->gimage) != active_tool_layer)
{
active_tool_control (RECREATE, gdisp);
active_tool_layer = gimage_get_active_layer (gdisp->gimage);
}
(* active_tool->button_press_func) (active_tool, bevent, gdisp);
}
break;
@ -344,9 +336,6 @@ gdisplay_hruler_button_press (GtkWidget *widget,
{
gdisp = data;
if (!active_tool)
active_tool_control (RECREATE, gdisp);
gtk_widget_activate (tool_widgets[tool_info[(int) MOVE].toolbar_position]);
move_tool_start_hguide (active_tool, gdisp);
gtk_grab_add (gdisp->canvas);
@ -366,9 +355,6 @@ gdisplay_vruler_button_press (GtkWidget *widget,
{
gdisp = data;
if (!active_tool)
active_tool_control (RECREATE, gdisp);
gtk_widget_activate (tool_widgets[tool_info[(int) MOVE].toolbar_position]);
move_tool_start_vguide (active_tool, gdisp);
gtk_grab_add (gdisp->canvas);

View File

@ -129,6 +129,7 @@ tools_new_ellipse_select ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = rect_select_control;
tool->preserve = TRUE;
return tool;
}

View File

@ -468,6 +468,7 @@ tools_new_free_select (void)
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = free_select_control;
tool->preserve = TRUE;
return tool;
}

View File

@ -35,6 +35,7 @@
#include "paint_funcs.h"
#include "palette.h"
#include "plug_in.h"
#include "tools.h"
#include "undo.h"
#include "tile_manager_pvt.h" /* ick. */
@ -2623,10 +2624,18 @@ gimage_disable_undo (GImage *gimage)
int
gimage_dirty (GImage *gimage)
{
GDisplay *gdisp;
if (gimage->dirty < 0)
gimage->dirty = 2;
else
gimage->dirty ++;
if (active_tool) {
gdisp = active_tool->gdisp_ptr;
if (gdisp)
if ((gdisp->gimage == gimage) && (!active_tool->preserve))
tools_select (active_tool->type);
}
return gimage->dirty;
}

View File

@ -43,8 +43,6 @@ static gint menus_install_accel (GtkWidget *widget,
static void menus_remove_accel (GtkWidget *widget,
gchar *signal_name,
gchar *path);
static void menus_activate_callback (GtkWidget *widget,
GtkMenuEntry *entry);
static GtkMenuEntry menu_items[] =
{
@ -299,9 +297,6 @@ menus_create (GtkMenuEntry *entries,
gtk_signal_connect (GTK_OBJECT (entries[i].widget), "remove_accelerator",
(GtkSignalFunc) menus_remove_accel,
entries[i].path);
gtk_signal_connect (GTK_OBJECT (entries[i].widget), "activate",
(GtkSignalFunc) menus_activate_callback,
&entries[i]);
}
}
@ -491,72 +486,3 @@ menus_remove_accel (GtkWidget *widget,
}
}
static void
menus_activate_callback (GtkWidget *widget,
GtkMenuEntry *entry)
{
/* These are the functions upon which we won't destroy the
tool... "safe", so to say. All the others are expected to alter
the image, so the tool must be destroyed */
const GtkMenuCallback ignore[]={
image_posterize_cmd_callback,
image_threshold_cmd_callback,
image_color_balance_cmd_callback,
image_brightness_contrast_cmd_callback,
image_hue_saturation_cmd_callback,
image_curves_cmd_callback,
image_levels_cmd_callback,
image_histogram_cmd_callback,
tools_select_cmd_callback,
about_dialog_cmd_callback,
tips_dialog_cmd_callback,
file_new_cmd_callback,
file_open_cmd_callback,
file_save_cmd_callback,
file_save_as_cmd_callback,
file_pref_cmd_callback,
file_close_cmd_callback,
file_quit_cmd_callback,
view_zoomin_cmd_callback,
view_zoomout_cmd_callback,
view_zoom_16_1_callback,
view_zoom_8_1_callback,
view_zoom_4_1_callback,
view_zoom_2_1_callback,
view_zoom_1_1_callback,
view_zoom_1_2_callback,
view_zoom_1_4_callback,
view_zoom_1_8_callback,
view_zoom_1_16_callback,
view_window_info_cmd_callback,
view_toggle_rulers_cmd_callback,
view_toggle_guides_cmd_callback,
view_snap_to_guides_cmd_callback,
channel_ops_duplicate_cmd_callback,
dialogs_lc_cmd_callback,
dialogs_brushes_cmd_callback,
dialogs_patterns_cmd_callback,
dialogs_palette_cmd_callback,
dialogs_gradient_editor_cmd_callback,
dialogs_lc_cmd_callback,
dialogs_indexed_palette_cmd_callback,
dialogs_tools_options_cmd_callback,
file_load_by_extension_callback,
file_save_by_extension_callback
};
int i;
if (active_tool){
for (i=0; i<sizeof(ignore)/sizeof(*ignore); i++)
if (entry->callback == ignore[i])
return;
if (active_tool->gdisp_ptr == NULL)
active_tool_control (RECREATE, active_tool->gdisp_ptr);
else {
GDisplay *gdisp;
gdisp = gdisplay_active ();
if (gdisp == NULL || ((GDisplay*)active_tool->gdisp_ptr)->gimage == gdisp->gimage)
active_tool_control (RECREATE, active_tool->gdisp_ptr);
}
}
}

View File

@ -356,6 +356,7 @@ tools_new_histogram_tool ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = histogram_tool_cursor_update;
tool->control_func = histogram_tool_control;
tool->preserve = FALSE;
return tool;
}

View File

@ -295,7 +295,9 @@ hue_saturation_control (Tool *tool,
case HALT :
if (hue_saturation_dialog)
{
active_tool->preserve = TRUE;
image_map_abort (hue_saturation_dialog->image_map);
active_tool->preserve = FALSE;
hue_saturation_dialog->image_map = NULL;
hue_saturation_cancel_callback (NULL, (gpointer) hue_saturation_dialog);
}
@ -327,6 +329,7 @@ tools_new_hue_saturation ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = hue_saturation_cursor_update;
tool->control_func = hue_saturation_control;
tool->preserve = FALSE;
return tool;
}
@ -385,7 +388,9 @@ hue_saturation_free ()
{
if (hue_saturation_dialog->image_map)
{
active_tool->preserve = TRUE;
image_map_abort (hue_saturation_dialog->image_map);
active_tool->preserve = FALSE;
hue_saturation_dialog->image_map = NULL;
}
gtk_widget_destroy (hue_saturation_dialog->shell);
@ -724,7 +729,9 @@ hue_saturation_preview (HueSaturationDialog *hsd)
{
if (!hsd->image_map)
g_warning ("No image map");
active_tool->preserve = TRUE;
image_map_apply (hsd->image_map, hue_saturation, (void *) hsd);
active_tool->preserve = FALSE;
}
static void
@ -738,12 +745,16 @@ hue_saturation_ok_callback (GtkWidget *widget,
if (GTK_WIDGET_VISIBLE (hsd->shell))
gtk_widget_hide (hsd->shell);
active_tool->preserve = TRUE;
if (!hsd->preview)
image_map_apply (hsd->image_map, hue_saturation, (void *) hsd);
if (hsd->image_map)
image_map_commit (hsd->image_map);
active_tool->preserve = FALSE;
hsd->image_map = NULL;
}
@ -769,7 +780,9 @@ hue_saturation_cancel_callback (GtkWidget *widget,
if (hsd->image_map)
{
active_tool->preserve = TRUE;
image_map_abort (hsd->image_map);
active_tool->preserve = FALSE;
gdisplays_flush ();
}

View File

@ -346,7 +346,9 @@ levels_control (Tool *tool,
case HALT :
if (levels_dialog)
{
active_tool->preserve = TRUE;
image_map_abort (levels_dialog->image_map);
active_tool->preserve = FALSE;
levels_dialog->image_map = NULL;
levels_cancel_callback (NULL, (gpointer) levels_dialog);
}
@ -378,6 +380,7 @@ tools_new_levels ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = levels_cursor_update;
tool->control_func = levels_control;
tool->preserve = FALSE;
return tool;
}
@ -477,7 +480,9 @@ levels_free ()
{
if (levels_dialog->image_map)
{
active_tool->preserve = TRUE;
image_map_abort (levels_dialog->image_map);
active_tool->preserve = FALSE;
levels_dialog->image_map = NULL;
}
gtk_widget_destroy (levels_dialog->shell);
@ -895,7 +900,9 @@ levels_preview (LevelsDialog *ld)
{
if (!ld->image_map)
g_warning ("No image map");
active_tool->preserve = TRUE;
image_map_apply (ld->image_map, levels, (void *) ld);
active_tool->preserve = FALSE;
}
static void
@ -1074,12 +1081,16 @@ levels_ok_callback (GtkWidget *widget,
if (GTK_WIDGET_VISIBLE (ld->shell))
gtk_widget_hide (ld->shell);
active_tool->preserve = TRUE;
if (!ld->preview)
image_map_apply (ld->image_map, levels, (void *) ld);
if (ld->image_map)
image_map_commit (ld->image_map);
active_tool->preserve = FALSE;
ld->image_map = NULL;
}
@ -1105,7 +1116,9 @@ levels_cancel_callback (GtkWidget *widget,
if (ld->image_map)
{
active_tool->preserve = TRUE;
image_map_abort (ld->image_map);
active_tool->preserve = TRUE;
gdisplays_flush ();
}

View File

@ -43,8 +43,6 @@ static gint menus_install_accel (GtkWidget *widget,
static void menus_remove_accel (GtkWidget *widget,
gchar *signal_name,
gchar *path);
static void menus_activate_callback (GtkWidget *widget,
GtkMenuEntry *entry);
static GtkMenuEntry menu_items[] =
{
@ -299,9 +297,6 @@ menus_create (GtkMenuEntry *entries,
gtk_signal_connect (GTK_OBJECT (entries[i].widget), "remove_accelerator",
(GtkSignalFunc) menus_remove_accel,
entries[i].path);
gtk_signal_connect (GTK_OBJECT (entries[i].widget), "activate",
(GtkSignalFunc) menus_activate_callback,
&entries[i]);
}
}
@ -491,72 +486,3 @@ menus_remove_accel (GtkWidget *widget,
}
}
static void
menus_activate_callback (GtkWidget *widget,
GtkMenuEntry *entry)
{
/* These are the functions upon which we won't destroy the
tool... "safe", so to say. All the others are expected to alter
the image, so the tool must be destroyed */
const GtkMenuCallback ignore[]={
image_posterize_cmd_callback,
image_threshold_cmd_callback,
image_color_balance_cmd_callback,
image_brightness_contrast_cmd_callback,
image_hue_saturation_cmd_callback,
image_curves_cmd_callback,
image_levels_cmd_callback,
image_histogram_cmd_callback,
tools_select_cmd_callback,
about_dialog_cmd_callback,
tips_dialog_cmd_callback,
file_new_cmd_callback,
file_open_cmd_callback,
file_save_cmd_callback,
file_save_as_cmd_callback,
file_pref_cmd_callback,
file_close_cmd_callback,
file_quit_cmd_callback,
view_zoomin_cmd_callback,
view_zoomout_cmd_callback,
view_zoom_16_1_callback,
view_zoom_8_1_callback,
view_zoom_4_1_callback,
view_zoom_2_1_callback,
view_zoom_1_1_callback,
view_zoom_1_2_callback,
view_zoom_1_4_callback,
view_zoom_1_8_callback,
view_zoom_1_16_callback,
view_window_info_cmd_callback,
view_toggle_rulers_cmd_callback,
view_toggle_guides_cmd_callback,
view_snap_to_guides_cmd_callback,
channel_ops_duplicate_cmd_callback,
dialogs_lc_cmd_callback,
dialogs_brushes_cmd_callback,
dialogs_patterns_cmd_callback,
dialogs_palette_cmd_callback,
dialogs_gradient_editor_cmd_callback,
dialogs_lc_cmd_callback,
dialogs_indexed_palette_cmd_callback,
dialogs_tools_options_cmd_callback,
file_load_by_extension_callback,
file_save_by_extension_callback
};
int i;
if (active_tool){
for (i=0; i<sizeof(ignore)/sizeof(*ignore); i++)
if (entry->callback == ignore[i])
return;
if (active_tool->gdisp_ptr == NULL)
active_tool_control (RECREATE, active_tool->gdisp_ptr);
else {
GDisplay *gdisp;
gdisp = gdisplay_active ();
if (gdisp == NULL || ((GDisplay*)active_tool->gdisp_ptr)->gimage == gdisp->gimage)
active_tool_control (RECREATE, active_tool->gdisp_ptr);
}
}
}

View File

@ -43,8 +43,6 @@ static gint menus_install_accel (GtkWidget *widget,
static void menus_remove_accel (GtkWidget *widget,
gchar *signal_name,
gchar *path);
static void menus_activate_callback (GtkWidget *widget,
GtkMenuEntry *entry);
static GtkMenuEntry menu_items[] =
{
@ -299,9 +297,6 @@ menus_create (GtkMenuEntry *entries,
gtk_signal_connect (GTK_OBJECT (entries[i].widget), "remove_accelerator",
(GtkSignalFunc) menus_remove_accel,
entries[i].path);
gtk_signal_connect (GTK_OBJECT (entries[i].widget), "activate",
(GtkSignalFunc) menus_activate_callback,
&entries[i]);
}
}
@ -491,72 +486,3 @@ menus_remove_accel (GtkWidget *widget,
}
}
static void
menus_activate_callback (GtkWidget *widget,
GtkMenuEntry *entry)
{
/* These are the functions upon which we won't destroy the
tool... "safe", so to say. All the others are expected to alter
the image, so the tool must be destroyed */
const GtkMenuCallback ignore[]={
image_posterize_cmd_callback,
image_threshold_cmd_callback,
image_color_balance_cmd_callback,
image_brightness_contrast_cmd_callback,
image_hue_saturation_cmd_callback,
image_curves_cmd_callback,
image_levels_cmd_callback,
image_histogram_cmd_callback,
tools_select_cmd_callback,
about_dialog_cmd_callback,
tips_dialog_cmd_callback,
file_new_cmd_callback,
file_open_cmd_callback,
file_save_cmd_callback,
file_save_as_cmd_callback,
file_pref_cmd_callback,
file_close_cmd_callback,
file_quit_cmd_callback,
view_zoomin_cmd_callback,
view_zoomout_cmd_callback,
view_zoom_16_1_callback,
view_zoom_8_1_callback,
view_zoom_4_1_callback,
view_zoom_2_1_callback,
view_zoom_1_1_callback,
view_zoom_1_2_callback,
view_zoom_1_4_callback,
view_zoom_1_8_callback,
view_zoom_1_16_callback,
view_window_info_cmd_callback,
view_toggle_rulers_cmd_callback,
view_toggle_guides_cmd_callback,
view_snap_to_guides_cmd_callback,
channel_ops_duplicate_cmd_callback,
dialogs_lc_cmd_callback,
dialogs_brushes_cmd_callback,
dialogs_patterns_cmd_callback,
dialogs_palette_cmd_callback,
dialogs_gradient_editor_cmd_callback,
dialogs_lc_cmd_callback,
dialogs_indexed_palette_cmd_callback,
dialogs_tools_options_cmd_callback,
file_load_by_extension_callback,
file_save_by_extension_callback
};
int i;
if (active_tool){
for (i=0; i<sizeof(ignore)/sizeof(*ignore); i++)
if (entry->callback == ignore[i])
return;
if (active_tool->gdisp_ptr == NULL)
active_tool_control (RECREATE, active_tool->gdisp_ptr);
else {
GDisplay *gdisp;
gdisp = gdisplay_active ();
if (gdisp == NULL || ((GDisplay*)active_tool->gdisp_ptr)->gimage == gdisp->gimage)
active_tool_control (RECREATE, active_tool->gdisp_ptr);
}
}
}

View File

@ -434,6 +434,7 @@ tools_new_move_tool ()
tool->arrow_keys_func = edit_sel_arrow_keys_func;
tool->cursor_update_func = move_tool_cursor_update;
tool->control_func = move_tool_control;
tool->preserve = TRUE;
private->layer = NULL;
private->guide = NULL;

View File

@ -336,6 +336,7 @@ paint_core_new (type)
tool->auto_snap_to = TRUE;
tool->gdisp_ptr = NULL;
tool->private = (void *) private;
tool->preserve = TRUE;
tool->button_press_func = paint_core_button_press;
tool->button_release_func = paint_core_button_release;

View File

@ -176,7 +176,9 @@ posterize_control (Tool *tool,
case HALT :
if (posterize_dialog)
{
active_tool->preserve = TRUE;
image_map_abort (posterize_dialog->image_map);
active_tool->preserve = FALSE;
posterize_dialog->image_map = NULL;
posterize_cancel_callback (NULL, (gpointer) posterize_dialog);
}
@ -215,6 +217,7 @@ tools_new_posterize ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = posterize_cursor_update;
tool->control_func = posterize_control;
tool->preserve = FALSE;
return tool;
}
@ -348,7 +351,9 @@ posterize_preview (PosterizeDialog *pd)
{
if (!pd->image_map)
g_warning ("No image map");
active_tool->preserve = TRUE;
image_map_apply (pd->image_map, posterize, (void *) pd);
active_tool->preserve = FALSE;
}
static void
@ -362,12 +367,16 @@ posterize_ok_callback (GtkWidget *widget,
if (GTK_WIDGET_VISIBLE (pd->shell))
gtk_widget_hide (pd->shell);
active_tool->preserve = TRUE;
if (!pd->preview)
image_map_apply (pd->image_map, posterize, (void *) pd);
if (pd->image_map)
image_map_commit (pd->image_map);
active_tool->preserve = FALSE;
pd->image_map = NULL;
}
@ -391,7 +400,9 @@ posterize_cancel_callback (GtkWidget *widget,
if (pd->image_map)
{
active_tool->preserve = TRUE;
image_map_abort (pd->image_map);
active_tool->preserve = FALSE;
gdisplays_flush ();
}

View File

@ -531,6 +531,7 @@ tools_new_rect_select ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = rect_select_control;
tool->preserve = TRUE;
return tool;
}

View File

@ -249,6 +249,7 @@ tools_new_text ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = text_cursor_update;
tool->control_func = text_control;
tool->preserve = TRUE;
return tool;
}

View File

@ -406,8 +406,6 @@ tools_options_dialog_show ()
cases. if the user tries to bring up the options before
switching tools, the dialog will be empty. recreate the active
tool here if necessary to avoid this behavior */
if (!active_tool)
active_tool_control (RECREATE, gdisplay_active());
if (!GTK_WIDGET_VISIBLE(options_shell))
{
@ -505,17 +503,11 @@ active_tool_control (int action,
active_tool->state = INACTIVE;
(* active_tool->control_func) (active_tool, action, gdisp_ptr);
break;
case DESTROY :
active_tool_free();
gtk_widget_hide (options_shell);
break;
}
}
else if (action == HALT)
active_tool->state = INACTIVE;
}
if (action == RECREATE && active_tool_type >= 0)
tools_select (active_tool_type);
}

View File

@ -110,6 +110,8 @@ struct _tool
void * gdisp_ptr; /* pointer to currently active gdisp */
int ID; /* unique tool ID */
int preserve; /* Perserve this tool through the current image changes */
/* Action functions */
ButtonPressFunc button_press_func;
ButtonReleaseFunc button_release_func;

View File

@ -139,6 +139,7 @@ tools_new_bezier_select ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = bezier_select_control;
tool->preserve = TRUE;
return tool;
}
@ -246,9 +247,10 @@ bezier_select_button_press (Tool *tool,
grab_pointer = 0;
/* If the tool was being used in another image...reset it */
if (tool->state == ACTIVE && gdisp_ptr != tool->gdisp_ptr)
if (tool->state == ACTIVE && gdisp_ptr != tool->gdisp_ptr) {
printf("Reset!\n");
bezier_select_reset (bezier_sel);
}
gdisplay_untransform_coords (gdisp, bevent->x, bevent->y, &x, &y, TRUE, 0);
/* get halfwidth in image coord */

View File

@ -1657,6 +1657,7 @@ tools_new_blend ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = blend_cursor_update;
tool->control_func = blend_control;
tool->preserve = TRUE;
return tool;
}

View File

@ -217,7 +217,9 @@ brightness_contrast_control (Tool *tool,
case HALT :
if (brightness_contrast_dialog)
{
active_tool->preserve = TRUE;
image_map_abort (brightness_contrast_dialog->image_map);
active_tool->preserve = TRUE;
brightness_contrast_dialog->image_map = NULL;
brightness_contrast_cancel_callback (NULL, (gpointer) brightness_contrast_dialog);
}
@ -250,6 +252,7 @@ tools_new_brightness_contrast ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = brightness_contrast_cursor_update;
tool->control_func = brightness_contrast_control;
tool->preserve = FALSE;
return tool;
}
@ -475,7 +478,9 @@ brightness_contrast_preview (BrightnessContrastDialog *bcd)
{
if (!bcd->image_map)
g_warning ("No image map");
active_tool->preserve = TRUE;
image_map_apply (bcd->image_map, brightness_contrast, (void *) bcd);
active_tool->preserve = FALSE;
}
static void
@ -489,12 +494,16 @@ brightness_contrast_ok_callback (GtkWidget *widget,
if (GTK_WIDGET_VISIBLE (bcd->shell))
gtk_widget_hide (bcd->shell);
active_tool->preserve = TRUE;
if (!bcd->preview)
image_map_apply (bcd->image_map, brightness_contrast, (void *) bcd);
if (bcd->image_map)
image_map_commit (bcd->image_map);
active_tool->preserve = FALSE;
bcd->image_map = NULL;
}
@ -520,7 +529,9 @@ brightness_contrast_cancel_callback (GtkWidget *widget,
if (bcd->image_map)
{
active_tool->preserve = TRUE;
image_map_abort (bcd->image_map);
active_tool->preserve = FALSE;
gdisplays_flush ();
}

View File

@ -673,6 +673,7 @@ tools_new_bucket_fill ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = bucket_fill_cursor_update;
tool->control_func = bucket_fill_control;
tool->preserve = TRUE;
return tool;
}

View File

@ -251,7 +251,9 @@ color_balance_control (Tool *tool,
case HALT :
if (color_balance_dialog)
{
active_tool->preserve = TRUE;
image_map_abort (color_balance_dialog->image_map);
active_tool->preserve = FALSE;
color_balance_dialog->image_map = NULL;
color_balance_cancel_callback (NULL, (gpointer) color_balance_dialog);
}
@ -283,6 +285,7 @@ tools_new_color_balance ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = color_balance_cursor_update;
tool->control_func = color_balance_control;
tool->preserve = FALSE;
return tool;
}
@ -613,7 +616,9 @@ color_balance_preview (ColorBalanceDialog *cbd)
{
if (!cbd->image_map)
g_warning ("No image map");
active_tool->preserve = TRUE;
image_map_apply (cbd->image_map, color_balance, (void *) cbd);
active_tool->preserve = FALSE;
}
static void
@ -626,6 +631,8 @@ color_balance_ok_callback (GtkWidget *widget,
if (GTK_WIDGET_VISIBLE (cbd->shell))
gtk_widget_hide (cbd->shell);
active_tool->preserve = TRUE;
if (!cbd->preview)
image_map_apply (cbd->image_map, color_balance, (void *) cbd);
@ -633,6 +640,8 @@ color_balance_ok_callback (GtkWidget *widget,
if (cbd->image_map)
image_map_commit (cbd->image_map);
active_tool->preserve = FALSE;
cbd->image_map = NULL;
}
@ -658,7 +667,9 @@ color_balance_cancel_callback (GtkWidget *widget,
if (cbd->image_map)
{
active_tool->preserve = TRUE;
image_map_abort (cbd->image_map);
active_tool->preserve = FALSE;
gdisplays_flush ();
}

View File

@ -456,6 +456,7 @@ tools_new_color_picker ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = color_picker_cursor_update;
tool->control_func = color_picker_control;
tool->preserve = TRUE;
return tool;
}

View File

@ -524,6 +524,7 @@ tools_new_crop ()
tool->arrow_keys_func = crop_arrow_keys_func;
tool->cursor_update_func = crop_cursor_update;
tool->control_func = crop_control;
tool->preserve = TRUE; /* XXX Check me */
return tool;
}

View File

@ -252,7 +252,9 @@ curves_control (Tool *tool,
case HALT :
if (curves_dialog)
{
active_tool->preserve = TRUE;
image_map_abort (curves_dialog->image_map);
active_tool->preserve = FALSE;
curves_dialog->image_map = NULL;
curves_cancel_callback (NULL, (gpointer) curves_dialog);
}
@ -284,6 +286,7 @@ tools_new_curves ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = curves_cursor_update;
tool->control_func = curves_control;
tool->preserve = TRUE;
return tool;
}
@ -400,7 +403,9 @@ curves_free ()
{
if (curves_dialog->image_map)
{
active_tool->preserve = TRUE;
image_map_abort (curves_dialog->image_map);
active_tool->preserve = FALSE;
curves_dialog->image_map = NULL;
}
if (curves_dialog->pixmap)
@ -804,7 +809,12 @@ curves_preview (CurvesDialog *cd)
{
if (!cd->image_map)
g_warning ("No image map");
active_tool->preserve = TRUE; /* Going to dirty the display... */
image_map_apply (cd->image_map, curves, (void *) cd);
active_tool->preserve = FALSE; /* All done */
}
static void
@ -966,12 +976,16 @@ curves_ok_callback (GtkWidget *widget,
if (GTK_WIDGET_VISIBLE (cd->shell))
gtk_widget_hide (cd->shell);
active_tool->preserve = TRUE; /* We're about to dirty... */
if (!cd->preview)
image_map_apply (cd->image_map, curves, (void *) cd);
if (cd->image_map)
image_map_commit (cd->image_map);
active_tool->preserve = FALSE;
cd->image_map = NULL;
}
@ -987,7 +1001,9 @@ curves_cancel_callback (GtkWidget *widget,
if (cd->image_map)
{
active_tool->preserve = TRUE;
image_map_abort (cd->image_map);
active_tool->preserve = FALSE;
gdisplays_flush ();
}
@ -1010,7 +1026,7 @@ curves_preview_update (GtkWidget *w,
CurvesDialog *cd;
cd = (CurvesDialog *) data;
if (GTK_TOGGLE_BUTTON (w)->active)
{
cd->preview = TRUE;

View File

@ -129,6 +129,7 @@ tools_new_ellipse_select ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = rect_select_control;
tool->preserve = TRUE;
return tool;
}

View File

@ -468,6 +468,7 @@ tools_new_free_select (void)
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = free_select_control;
tool->preserve = TRUE;
return tool;
}

View File

@ -1657,6 +1657,7 @@ tools_new_blend ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = blend_cursor_update;
tool->control_func = blend_control;
tool->preserve = TRUE;
return tool;
}

View File

@ -217,7 +217,9 @@ brightness_contrast_control (Tool *tool,
case HALT :
if (brightness_contrast_dialog)
{
active_tool->preserve = TRUE;
image_map_abort (brightness_contrast_dialog->image_map);
active_tool->preserve = TRUE;
brightness_contrast_dialog->image_map = NULL;
brightness_contrast_cancel_callback (NULL, (gpointer) brightness_contrast_dialog);
}
@ -250,6 +252,7 @@ tools_new_brightness_contrast ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = brightness_contrast_cursor_update;
tool->control_func = brightness_contrast_control;
tool->preserve = FALSE;
return tool;
}
@ -475,7 +478,9 @@ brightness_contrast_preview (BrightnessContrastDialog *bcd)
{
if (!bcd->image_map)
g_warning ("No image map");
active_tool->preserve = TRUE;
image_map_apply (bcd->image_map, brightness_contrast, (void *) bcd);
active_tool->preserve = FALSE;
}
static void
@ -489,12 +494,16 @@ brightness_contrast_ok_callback (GtkWidget *widget,
if (GTK_WIDGET_VISIBLE (bcd->shell))
gtk_widget_hide (bcd->shell);
active_tool->preserve = TRUE;
if (!bcd->preview)
image_map_apply (bcd->image_map, brightness_contrast, (void *) bcd);
if (bcd->image_map)
image_map_commit (bcd->image_map);
active_tool->preserve = FALSE;
bcd->image_map = NULL;
}
@ -520,7 +529,9 @@ brightness_contrast_cancel_callback (GtkWidget *widget,
if (bcd->image_map)
{
active_tool->preserve = TRUE;
image_map_abort (bcd->image_map);
active_tool->preserve = FALSE;
gdisplays_flush ();
}

View File

@ -673,6 +673,7 @@ tools_new_bucket_fill ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = bucket_fill_cursor_update;
tool->control_func = bucket_fill_control;
tool->preserve = TRUE;
return tool;
}

View File

@ -251,7 +251,9 @@ color_balance_control (Tool *tool,
case HALT :
if (color_balance_dialog)
{
active_tool->preserve = TRUE;
image_map_abort (color_balance_dialog->image_map);
active_tool->preserve = FALSE;
color_balance_dialog->image_map = NULL;
color_balance_cancel_callback (NULL, (gpointer) color_balance_dialog);
}
@ -283,6 +285,7 @@ tools_new_color_balance ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = color_balance_cursor_update;
tool->control_func = color_balance_control;
tool->preserve = FALSE;
return tool;
}
@ -613,7 +616,9 @@ color_balance_preview (ColorBalanceDialog *cbd)
{
if (!cbd->image_map)
g_warning ("No image map");
active_tool->preserve = TRUE;
image_map_apply (cbd->image_map, color_balance, (void *) cbd);
active_tool->preserve = FALSE;
}
static void
@ -626,6 +631,8 @@ color_balance_ok_callback (GtkWidget *widget,
if (GTK_WIDGET_VISIBLE (cbd->shell))
gtk_widget_hide (cbd->shell);
active_tool->preserve = TRUE;
if (!cbd->preview)
image_map_apply (cbd->image_map, color_balance, (void *) cbd);
@ -633,6 +640,8 @@ color_balance_ok_callback (GtkWidget *widget,
if (cbd->image_map)
image_map_commit (cbd->image_map);
active_tool->preserve = FALSE;
cbd->image_map = NULL;
}
@ -658,7 +667,9 @@ color_balance_cancel_callback (GtkWidget *widget,
if (cbd->image_map)
{
active_tool->preserve = TRUE;
image_map_abort (cbd->image_map);
active_tool->preserve = FALSE;
gdisplays_flush ();
}

View File

@ -524,6 +524,7 @@ tools_new_crop ()
tool->arrow_keys_func = crop_arrow_keys_func;
tool->cursor_update_func = crop_cursor_update;
tool->control_func = crop_control;
tool->preserve = TRUE; /* XXX Check me */
return tool;
}

View File

@ -252,7 +252,9 @@ curves_control (Tool *tool,
case HALT :
if (curves_dialog)
{
active_tool->preserve = TRUE;
image_map_abort (curves_dialog->image_map);
active_tool->preserve = FALSE;
curves_dialog->image_map = NULL;
curves_cancel_callback (NULL, (gpointer) curves_dialog);
}
@ -284,6 +286,7 @@ tools_new_curves ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = curves_cursor_update;
tool->control_func = curves_control;
tool->preserve = TRUE;
return tool;
}
@ -400,7 +403,9 @@ curves_free ()
{
if (curves_dialog->image_map)
{
active_tool->preserve = TRUE;
image_map_abort (curves_dialog->image_map);
active_tool->preserve = FALSE;
curves_dialog->image_map = NULL;
}
if (curves_dialog->pixmap)
@ -804,7 +809,12 @@ curves_preview (CurvesDialog *cd)
{
if (!cd->image_map)
g_warning ("No image map");
active_tool->preserve = TRUE; /* Going to dirty the display... */
image_map_apply (cd->image_map, curves, (void *) cd);
active_tool->preserve = FALSE; /* All done */
}
static void
@ -966,12 +976,16 @@ curves_ok_callback (GtkWidget *widget,
if (GTK_WIDGET_VISIBLE (cd->shell))
gtk_widget_hide (cd->shell);
active_tool->preserve = TRUE; /* We're about to dirty... */
if (!cd->preview)
image_map_apply (cd->image_map, curves, (void *) cd);
if (cd->image_map)
image_map_commit (cd->image_map);
active_tool->preserve = FALSE;
cd->image_map = NULL;
}
@ -987,7 +1001,9 @@ curves_cancel_callback (GtkWidget *widget,
if (cd->image_map)
{
active_tool->preserve = TRUE;
image_map_abort (cd->image_map);
active_tool->preserve = FALSE;
gdisplays_flush ();
}
@ -1010,7 +1026,7 @@ curves_preview_update (GtkWidget *w,
CurvesDialog *cd;
cd = (CurvesDialog *) data;
if (GTK_TOGGLE_BUTTON (w)->active)
{
cd->preview = TRUE;

View File

@ -129,6 +129,7 @@ tools_new_ellipse_select ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = rect_select_control;
tool->preserve = TRUE;
return tool;
}

View File

@ -468,6 +468,7 @@ tools_new_free_select (void)
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = free_select_control;
tool->preserve = TRUE;
return tool;
}

View File

@ -356,6 +356,7 @@ tools_new_histogram_tool ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = histogram_tool_cursor_update;
tool->control_func = histogram_tool_control;
tool->preserve = FALSE;
return tool;
}

View File

@ -295,7 +295,9 @@ hue_saturation_control (Tool *tool,
case HALT :
if (hue_saturation_dialog)
{
active_tool->preserve = TRUE;
image_map_abort (hue_saturation_dialog->image_map);
active_tool->preserve = FALSE;
hue_saturation_dialog->image_map = NULL;
hue_saturation_cancel_callback (NULL, (gpointer) hue_saturation_dialog);
}
@ -327,6 +329,7 @@ tools_new_hue_saturation ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = hue_saturation_cursor_update;
tool->control_func = hue_saturation_control;
tool->preserve = FALSE;
return tool;
}
@ -385,7 +388,9 @@ hue_saturation_free ()
{
if (hue_saturation_dialog->image_map)
{
active_tool->preserve = TRUE;
image_map_abort (hue_saturation_dialog->image_map);
active_tool->preserve = FALSE;
hue_saturation_dialog->image_map = NULL;
}
gtk_widget_destroy (hue_saturation_dialog->shell);
@ -724,7 +729,9 @@ hue_saturation_preview (HueSaturationDialog *hsd)
{
if (!hsd->image_map)
g_warning ("No image map");
active_tool->preserve = TRUE;
image_map_apply (hsd->image_map, hue_saturation, (void *) hsd);
active_tool->preserve = FALSE;
}
static void
@ -738,12 +745,16 @@ hue_saturation_ok_callback (GtkWidget *widget,
if (GTK_WIDGET_VISIBLE (hsd->shell))
gtk_widget_hide (hsd->shell);
active_tool->preserve = TRUE;
if (!hsd->preview)
image_map_apply (hsd->image_map, hue_saturation, (void *) hsd);
if (hsd->image_map)
image_map_commit (hsd->image_map);
active_tool->preserve = FALSE;
hsd->image_map = NULL;
}
@ -769,7 +780,9 @@ hue_saturation_cancel_callback (GtkWidget *widget,
if (hsd->image_map)
{
active_tool->preserve = TRUE;
image_map_abort (hsd->image_map);
active_tool->preserve = FALSE;
gdisplays_flush ();
}

View File

@ -346,7 +346,9 @@ levels_control (Tool *tool,
case HALT :
if (levels_dialog)
{
active_tool->preserve = TRUE;
image_map_abort (levels_dialog->image_map);
active_tool->preserve = FALSE;
levels_dialog->image_map = NULL;
levels_cancel_callback (NULL, (gpointer) levels_dialog);
}
@ -378,6 +380,7 @@ tools_new_levels ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = levels_cursor_update;
tool->control_func = levels_control;
tool->preserve = FALSE;
return tool;
}
@ -477,7 +480,9 @@ levels_free ()
{
if (levels_dialog->image_map)
{
active_tool->preserve = TRUE;
image_map_abort (levels_dialog->image_map);
active_tool->preserve = FALSE;
levels_dialog->image_map = NULL;
}
gtk_widget_destroy (levels_dialog->shell);
@ -895,7 +900,9 @@ levels_preview (LevelsDialog *ld)
{
if (!ld->image_map)
g_warning ("No image map");
active_tool->preserve = TRUE;
image_map_apply (ld->image_map, levels, (void *) ld);
active_tool->preserve = FALSE;
}
static void
@ -1074,12 +1081,16 @@ levels_ok_callback (GtkWidget *widget,
if (GTK_WIDGET_VISIBLE (ld->shell))
gtk_widget_hide (ld->shell);
active_tool->preserve = TRUE;
if (!ld->preview)
image_map_apply (ld->image_map, levels, (void *) ld);
if (ld->image_map)
image_map_commit (ld->image_map);
active_tool->preserve = FALSE;
ld->image_map = NULL;
}
@ -1105,7 +1116,9 @@ levels_cancel_callback (GtkWidget *widget,
if (ld->image_map)
{
active_tool->preserve = TRUE;
image_map_abort (ld->image_map);
active_tool->preserve = TRUE;
gdisplays_flush ();
}

View File

@ -434,6 +434,7 @@ tools_new_move_tool ()
tool->arrow_keys_func = edit_sel_arrow_keys_func;
tool->cursor_update_func = move_tool_cursor_update;
tool->control_func = move_tool_control;
tool->preserve = TRUE;
private->layer = NULL;
private->guide = NULL;

View File

@ -176,7 +176,9 @@ posterize_control (Tool *tool,
case HALT :
if (posterize_dialog)
{
active_tool->preserve = TRUE;
image_map_abort (posterize_dialog->image_map);
active_tool->preserve = FALSE;
posterize_dialog->image_map = NULL;
posterize_cancel_callback (NULL, (gpointer) posterize_dialog);
}
@ -215,6 +217,7 @@ tools_new_posterize ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = posterize_cursor_update;
tool->control_func = posterize_control;
tool->preserve = FALSE;
return tool;
}
@ -348,7 +351,9 @@ posterize_preview (PosterizeDialog *pd)
{
if (!pd->image_map)
g_warning ("No image map");
active_tool->preserve = TRUE;
image_map_apply (pd->image_map, posterize, (void *) pd);
active_tool->preserve = FALSE;
}
static void
@ -362,12 +367,16 @@ posterize_ok_callback (GtkWidget *widget,
if (GTK_WIDGET_VISIBLE (pd->shell))
gtk_widget_hide (pd->shell);
active_tool->preserve = TRUE;
if (!pd->preview)
image_map_apply (pd->image_map, posterize, (void *) pd);
if (pd->image_map)
image_map_commit (pd->image_map);
active_tool->preserve = FALSE;
pd->image_map = NULL;
}
@ -391,7 +400,9 @@ posterize_cancel_callback (GtkWidget *widget,
if (pd->image_map)
{
active_tool->preserve = TRUE;
image_map_abort (pd->image_map);
active_tool->preserve = FALSE;
gdisplays_flush ();
}

View File

@ -531,6 +531,7 @@ tools_new_rect_select ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = rect_select_control;
tool->preserve = TRUE;
return tool;
}

View File

@ -249,6 +249,7 @@ tools_new_text ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = text_cursor_update;
tool->control_func = text_control;
tool->preserve = TRUE;
return tool;
}

View File

@ -356,6 +356,7 @@ tools_new_histogram_tool ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = histogram_tool_cursor_update;
tool->control_func = histogram_tool_control;
tool->preserve = FALSE;
return tool;
}

View File

@ -295,7 +295,9 @@ hue_saturation_control (Tool *tool,
case HALT :
if (hue_saturation_dialog)
{
active_tool->preserve = TRUE;
image_map_abort (hue_saturation_dialog->image_map);
active_tool->preserve = FALSE;
hue_saturation_dialog->image_map = NULL;
hue_saturation_cancel_callback (NULL, (gpointer) hue_saturation_dialog);
}
@ -327,6 +329,7 @@ tools_new_hue_saturation ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = hue_saturation_cursor_update;
tool->control_func = hue_saturation_control;
tool->preserve = FALSE;
return tool;
}
@ -385,7 +388,9 @@ hue_saturation_free ()
{
if (hue_saturation_dialog->image_map)
{
active_tool->preserve = TRUE;
image_map_abort (hue_saturation_dialog->image_map);
active_tool->preserve = FALSE;
hue_saturation_dialog->image_map = NULL;
}
gtk_widget_destroy (hue_saturation_dialog->shell);
@ -724,7 +729,9 @@ hue_saturation_preview (HueSaturationDialog *hsd)
{
if (!hsd->image_map)
g_warning ("No image map");
active_tool->preserve = TRUE;
image_map_apply (hsd->image_map, hue_saturation, (void *) hsd);
active_tool->preserve = FALSE;
}
static void
@ -738,12 +745,16 @@ hue_saturation_ok_callback (GtkWidget *widget,
if (GTK_WIDGET_VISIBLE (hsd->shell))
gtk_widget_hide (hsd->shell);
active_tool->preserve = TRUE;
if (!hsd->preview)
image_map_apply (hsd->image_map, hue_saturation, (void *) hsd);
if (hsd->image_map)
image_map_commit (hsd->image_map);
active_tool->preserve = FALSE;
hsd->image_map = NULL;
}
@ -769,7 +780,9 @@ hue_saturation_cancel_callback (GtkWidget *widget,
if (hsd->image_map)
{
active_tool->preserve = TRUE;
image_map_abort (hsd->image_map);
active_tool->preserve = FALSE;
gdisplays_flush ();
}

View File

@ -346,7 +346,9 @@ levels_control (Tool *tool,
case HALT :
if (levels_dialog)
{
active_tool->preserve = TRUE;
image_map_abort (levels_dialog->image_map);
active_tool->preserve = FALSE;
levels_dialog->image_map = NULL;
levels_cancel_callback (NULL, (gpointer) levels_dialog);
}
@ -378,6 +380,7 @@ tools_new_levels ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = levels_cursor_update;
tool->control_func = levels_control;
tool->preserve = FALSE;
return tool;
}
@ -477,7 +480,9 @@ levels_free ()
{
if (levels_dialog->image_map)
{
active_tool->preserve = TRUE;
image_map_abort (levels_dialog->image_map);
active_tool->preserve = FALSE;
levels_dialog->image_map = NULL;
}
gtk_widget_destroy (levels_dialog->shell);
@ -895,7 +900,9 @@ levels_preview (LevelsDialog *ld)
{
if (!ld->image_map)
g_warning ("No image map");
active_tool->preserve = TRUE;
image_map_apply (ld->image_map, levels, (void *) ld);
active_tool->preserve = FALSE;
}
static void
@ -1074,12 +1081,16 @@ levels_ok_callback (GtkWidget *widget,
if (GTK_WIDGET_VISIBLE (ld->shell))
gtk_widget_hide (ld->shell);
active_tool->preserve = TRUE;
if (!ld->preview)
image_map_apply (ld->image_map, levels, (void *) ld);
if (ld->image_map)
image_map_commit (ld->image_map);
active_tool->preserve = FALSE;
ld->image_map = NULL;
}
@ -1105,7 +1116,9 @@ levels_cancel_callback (GtkWidget *widget,
if (ld->image_map)
{
active_tool->preserve = TRUE;
image_map_abort (ld->image_map);
active_tool->preserve = TRUE;
gdisplays_flush ();
}

View File

@ -434,6 +434,7 @@ tools_new_move_tool ()
tool->arrow_keys_func = edit_sel_arrow_keys_func;
tool->cursor_update_func = move_tool_cursor_update;
tool->control_func = move_tool_control;
tool->preserve = TRUE;
private->layer = NULL;
private->guide = NULL;

View File

@ -336,6 +336,7 @@ paint_core_new (type)
tool->auto_snap_to = TRUE;
tool->gdisp_ptr = NULL;
tool->private = (void *) private;
tool->preserve = TRUE;
tool->button_press_func = paint_core_button_press;
tool->button_release_func = paint_core_button_release;

View File

@ -176,7 +176,9 @@ posterize_control (Tool *tool,
case HALT :
if (posterize_dialog)
{
active_tool->preserve = TRUE;
image_map_abort (posterize_dialog->image_map);
active_tool->preserve = FALSE;
posterize_dialog->image_map = NULL;
posterize_cancel_callback (NULL, (gpointer) posterize_dialog);
}
@ -215,6 +217,7 @@ tools_new_posterize ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = posterize_cursor_update;
tool->control_func = posterize_control;
tool->preserve = FALSE;
return tool;
}
@ -348,7 +351,9 @@ posterize_preview (PosterizeDialog *pd)
{
if (!pd->image_map)
g_warning ("No image map");
active_tool->preserve = TRUE;
image_map_apply (pd->image_map, posterize, (void *) pd);
active_tool->preserve = FALSE;
}
static void
@ -362,12 +367,16 @@ posterize_ok_callback (GtkWidget *widget,
if (GTK_WIDGET_VISIBLE (pd->shell))
gtk_widget_hide (pd->shell);
active_tool->preserve = TRUE;
if (!pd->preview)
image_map_apply (pd->image_map, posterize, (void *) pd);
if (pd->image_map)
image_map_commit (pd->image_map);
active_tool->preserve = FALSE;
pd->image_map = NULL;
}
@ -391,7 +400,9 @@ posterize_cancel_callback (GtkWidget *widget,
if (pd->image_map)
{
active_tool->preserve = TRUE;
image_map_abort (pd->image_map);
active_tool->preserve = FALSE;
gdisplays_flush ();
}

View File

@ -531,6 +531,7 @@ tools_new_rect_select ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = rect_select_control;
tool->preserve = TRUE;
return tool;
}

View File

@ -249,6 +249,7 @@ tools_new_text ()
tool->arrow_keys_func = standard_arrow_keys_func;
tool->cursor_update_func = text_cursor_update;
tool->control_func = text_control;
tool->preserve = TRUE;
return tool;
}

View File

@ -406,8 +406,6 @@ tools_options_dialog_show ()
cases. if the user tries to bring up the options before
switching tools, the dialog will be empty. recreate the active
tool here if necessary to avoid this behavior */
if (!active_tool)
active_tool_control (RECREATE, gdisplay_active());
if (!GTK_WIDGET_VISIBLE(options_shell))
{
@ -505,17 +503,11 @@ active_tool_control (int action,
active_tool->state = INACTIVE;
(* active_tool->control_func) (active_tool, action, gdisp_ptr);
break;
case DESTROY :
active_tool_free();
gtk_widget_hide (options_shell);
break;
}
}
else if (action == HALT)
active_tool->state = INACTIVE;
}
if (action == RECREATE && active_tool_type >= 0)
tools_select (active_tool_type);
}

View File

@ -110,6 +110,8 @@ struct _tool
void * gdisp_ptr; /* pointer to currently active gdisp */
int ID; /* unique tool ID */
int preserve; /* Perserve this tool through the current image changes */
/* Action functions */
ButtonPressFunc button_press_func;
ButtonReleaseFunc button_release_func;

View File

@ -221,6 +221,12 @@ transform_core_button_release (tool, bevent, gdisp_ptr)
/* if the 3rd button isn't pressed, transform the selected mask */
if (! (bevent->state & GDK_BUTTON3_MASK))
{
/* We're going to dirty this image, but we want to keep the tool
around
*/
tool->preserve = TRUE;
/* Start a transform undo group */
undo_push_group_start (gdisp->gimage, TRANSFORM_CORE_UNDO);
@ -232,7 +238,7 @@ transform_core_button_release (tool, bevent, gdisp_ptr)
* the transform tool's private selection pointer, so that the
* original source can be repeatedly modified.
*/
if (first_transform)
if (first_transform)
transform_core->original = transform_core_cut (gdisp->gimage,
gimage_active_drawable (gdisp->gimage),
&new_layer);
@ -266,6 +272,12 @@ transform_core_button_release (tool, bevent, gdisp_ptr)
/* push the undo group end */
undo_push_group_end (gdisp->gimage);
/* We're done dirtying the image, and would like to be restarted
if the image gets dirty while the tool exists
*/
tool->preserve = FALSE;
/* Flush the gdisplays */
if (gdisp->disp_xoffset || gdisp->disp_yoffset)
{
@ -508,6 +520,8 @@ transform_core_new (type, interactive)
tool->gdisp_ptr = NULL;
tool->private = (void *) private;
tool->preserve = FALSE; /* Destroy when the image is dirtied. */
tool->button_press_func = transform_core_button_press;
tool->button_release_func = transform_core_button_release;
tool->motion_func = transform_core_motion;

View File

@ -221,6 +221,12 @@ transform_core_button_release (tool, bevent, gdisp_ptr)
/* if the 3rd button isn't pressed, transform the selected mask */
if (! (bevent->state & GDK_BUTTON3_MASK))
{
/* We're going to dirty this image, but we want to keep the tool
around
*/
tool->preserve = TRUE;
/* Start a transform undo group */
undo_push_group_start (gdisp->gimage, TRANSFORM_CORE_UNDO);
@ -232,7 +238,7 @@ transform_core_button_release (tool, bevent, gdisp_ptr)
* the transform tool's private selection pointer, so that the
* original source can be repeatedly modified.
*/
if (first_transform)
if (first_transform)
transform_core->original = transform_core_cut (gdisp->gimage,
gimage_active_drawable (gdisp->gimage),
&new_layer);
@ -266,6 +272,12 @@ transform_core_button_release (tool, bevent, gdisp_ptr)
/* push the undo group end */
undo_push_group_end (gdisp->gimage);
/* We're done dirtying the image, and would like to be restarted
if the image gets dirty while the tool exists
*/
tool->preserve = FALSE;
/* Flush the gdisplays */
if (gdisp->disp_xoffset || gdisp->disp_yoffset)
{
@ -508,6 +520,8 @@ transform_core_new (type, interactive)
tool->gdisp_ptr = NULL;
tool->private = (void *) private;
tool->preserve = FALSE; /* Destroy when the image is dirtied. */
tool->button_press_func = transform_core_button_press;
tool->button_release_func = transform_core_button_release;
tool->motion_func = transform_core_motion;

View File

@ -43,8 +43,6 @@ static gint menus_install_accel (GtkWidget *widget,
static void menus_remove_accel (GtkWidget *widget,
gchar *signal_name,
gchar *path);
static void menus_activate_callback (GtkWidget *widget,
GtkMenuEntry *entry);
static GtkMenuEntry menu_items[] =
{
@ -299,9 +297,6 @@ menus_create (GtkMenuEntry *entries,
gtk_signal_connect (GTK_OBJECT (entries[i].widget), "remove_accelerator",
(GtkSignalFunc) menus_remove_accel,
entries[i].path);
gtk_signal_connect (GTK_OBJECT (entries[i].widget), "activate",
(GtkSignalFunc) menus_activate_callback,
&entries[i]);
}
}
@ -491,72 +486,3 @@ menus_remove_accel (GtkWidget *widget,
}
}
static void
menus_activate_callback (GtkWidget *widget,
GtkMenuEntry *entry)
{
/* These are the functions upon which we won't destroy the
tool... "safe", so to say. All the others are expected to alter
the image, so the tool must be destroyed */
const GtkMenuCallback ignore[]={
image_posterize_cmd_callback,
image_threshold_cmd_callback,
image_color_balance_cmd_callback,
image_brightness_contrast_cmd_callback,
image_hue_saturation_cmd_callback,
image_curves_cmd_callback,
image_levels_cmd_callback,
image_histogram_cmd_callback,
tools_select_cmd_callback,
about_dialog_cmd_callback,
tips_dialog_cmd_callback,
file_new_cmd_callback,
file_open_cmd_callback,
file_save_cmd_callback,
file_save_as_cmd_callback,
file_pref_cmd_callback,
file_close_cmd_callback,
file_quit_cmd_callback,
view_zoomin_cmd_callback,
view_zoomout_cmd_callback,
view_zoom_16_1_callback,
view_zoom_8_1_callback,
view_zoom_4_1_callback,
view_zoom_2_1_callback,
view_zoom_1_1_callback,
view_zoom_1_2_callback,
view_zoom_1_4_callback,
view_zoom_1_8_callback,
view_zoom_1_16_callback,
view_window_info_cmd_callback,
view_toggle_rulers_cmd_callback,
view_toggle_guides_cmd_callback,
view_snap_to_guides_cmd_callback,
channel_ops_duplicate_cmd_callback,
dialogs_lc_cmd_callback,
dialogs_brushes_cmd_callback,
dialogs_patterns_cmd_callback,
dialogs_palette_cmd_callback,
dialogs_gradient_editor_cmd_callback,
dialogs_lc_cmd_callback,
dialogs_indexed_palette_cmd_callback,
dialogs_tools_options_cmd_callback,
file_load_by_extension_callback,
file_save_by_extension_callback
};
int i;
if (active_tool){
for (i=0; i<sizeof(ignore)/sizeof(*ignore); i++)
if (entry->callback == ignore[i])
return;
if (active_tool->gdisp_ptr == NULL)
active_tool_control (RECREATE, active_tool->gdisp_ptr);
else {
GDisplay *gdisp;
gdisp = gdisplay_active ();
if (gdisp == NULL || ((GDisplay*)active_tool->gdisp_ptr)->gimage == gdisp->gimage)
active_tool_control (RECREATE, active_tool->gdisp_ptr);
}
}
}