mirror of https://github.com/GNOME/gimp.git
Wed Apr 1 11:10:15 EST 1998 Matthew Wilson <msw@gimp.org
* app/brightness_contrast.c * app/by_color_select.c * app/color_balance.c * app/color_picker.c * app/curves.c * app/histogram_tool.c * app/hue_saturation.c * app/levels.c * app/posterize.c * app/threshold.c * app/transform_core.c: modified to call the cancel callback instead of the ok callback when freed. modified to save the last used drawable so that we might be able to check later and restart the tool if need be. * app/disp_callbacks.c * app/gimage.c: modified tool restart/destruction code * app/tools.c * app/tools.h: added tools_initialize, made changes to be able save the last used drawable in the tool. --Matt
This commit is contained in:
parent
97297cb810
commit
f75645a26c
24
ChangeLog
24
ChangeLog
|
@ -1,3 +1,27 @@
|
|||
Wed Apr 1 11:10:15 EST 1998 Matthew Wilson <msw@gimp.org
|
||||
|
||||
* app/brightness_contrast.c
|
||||
* app/by_color_select.c
|
||||
* app/color_balance.c
|
||||
* app/color_picker.c
|
||||
* app/curves.c
|
||||
* app/histogram_tool.c
|
||||
* app/hue_saturation.c
|
||||
* app/levels.c
|
||||
* app/posterize.c
|
||||
* app/threshold.c
|
||||
* app/transform_core.c: modified to call the cancel callback
|
||||
instead of the ok callback when freed. modified to save the
|
||||
last used drawable so that we might be able to check later
|
||||
and restart the tool if need be.
|
||||
|
||||
* app/disp_callbacks.c
|
||||
* app/gimage.c: modified tool restart/destruction code
|
||||
|
||||
* app/tools.c
|
||||
* app/tools.h: added tools_initialize, made changes to
|
||||
be able save the last used drawable in the tool.
|
||||
|
||||
Wed Apr 1 23:14:42 MEST 1998 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* configure.in: added checks for print-systems as suggested by
|
||||
|
|
|
@ -206,6 +206,10 @@ color_balance_button_press (Tool *tool,
|
|||
GdkEventButton *bevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisp_ptr;
|
||||
tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -286,6 +290,8 @@ tools_new_color_balance ()
|
|||
tool->cursor_update_func = color_balance_cursor_update;
|
||||
tool->control_func = color_balance_control;
|
||||
tool->preserve = FALSE;
|
||||
tool->gdisp_ptr = NULL;
|
||||
tool->drawable = NULL;
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
@ -299,7 +305,7 @@ tools_free_color_balance (Tool *tool)
|
|||
|
||||
/* Close the color select dialog */
|
||||
if (color_balance_dialog)
|
||||
color_balance_ok_callback (NULL, (gpointer) color_balance_dialog);
|
||||
color_balance_cancel_callback (NULL, (gpointer) color_balance_dialog);
|
||||
|
||||
g_free (color_bal);
|
||||
}
|
||||
|
|
|
@ -207,6 +207,10 @@ curves_button_press (Tool *tool,
|
|||
GdkEventButton *bevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisp_ptr;
|
||||
tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -287,6 +291,8 @@ tools_new_curves ()
|
|||
tool->cursor_update_func = curves_cursor_update;
|
||||
tool->control_func = curves_control;
|
||||
tool->preserve = TRUE;
|
||||
tool->gdisp_ptr = NULL;
|
||||
tool->drawable = NULL;
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
@ -300,7 +306,7 @@ tools_free_curves (Tool *tool)
|
|||
|
||||
/* Close the color select dialog */
|
||||
if (curves_dialog)
|
||||
curves_ok_callback (NULL, (gpointer) curves_dialog);
|
||||
curves_cancel_callback (NULL, (gpointer) curves_dialog);
|
||||
|
||||
g_free (_curves);
|
||||
}
|
||||
|
|
|
@ -250,6 +250,10 @@ hue_saturation_button_press (Tool *tool,
|
|||
GdkEventButton *bevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisp_ptr;
|
||||
tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -330,6 +334,8 @@ tools_new_hue_saturation ()
|
|||
tool->cursor_update_func = hue_saturation_cursor_update;
|
||||
tool->control_func = hue_saturation_control;
|
||||
tool->preserve = FALSE;
|
||||
tool->gdisp_ptr = NULL;
|
||||
tool->drawable = NULL;
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
@ -343,7 +349,7 @@ tools_free_hue_saturation (Tool *tool)
|
|||
|
||||
/* Close the color select dialog */
|
||||
if (hue_saturation_dialog)
|
||||
hue_saturation_ok_callback (NULL, (gpointer) hue_saturation_dialog);
|
||||
hue_saturation_cancel_callback (NULL, (gpointer) hue_saturation_dialog);
|
||||
|
||||
g_free (color_bal);
|
||||
}
|
||||
|
|
|
@ -225,6 +225,10 @@ threshold_button_press (Tool *tool,
|
|||
GdkEventButton *bevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisp_ptr;
|
||||
tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -270,7 +274,9 @@ threshold_control (Tool *tool,
|
|||
case HALT :
|
||||
if (threshold_dialog)
|
||||
{
|
||||
active_tool->preserve = TRUE;
|
||||
image_map_abort (threshold_dialog->image_map);
|
||||
active_tool->preserve = FALSE;
|
||||
threshold_dialog->image_map = NULL;
|
||||
threshold_cancel_callback (NULL, (gpointer) threshold_dialog);
|
||||
}
|
||||
|
@ -309,6 +315,7 @@ tools_new_threshold ()
|
|||
tool->arrow_keys_func = standard_arrow_keys_func;
|
||||
tool->cursor_update_func = threshold_cursor_update;
|
||||
tool->control_func = threshold_control;
|
||||
tool->preserve = FALSE;
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
@ -322,7 +329,7 @@ tools_free_threshold (Tool *tool)
|
|||
|
||||
/* Close the color select dialog */
|
||||
if (threshold_dialog)
|
||||
threshold_ok_callback (NULL, (gpointer) threshold_dialog);
|
||||
threshold_cancel_callback (NULL, (gpointer) threshold_dialog);
|
||||
|
||||
g_free (thresh);
|
||||
}
|
||||
|
@ -496,12 +503,15 @@ threshold_ok_callback (GtkWidget *widget,
|
|||
if (GTK_WIDGET_VISIBLE (td->shell))
|
||||
gtk_widget_hide (td->shell);
|
||||
|
||||
active_tool->preserve = TRUE;
|
||||
|
||||
if (!td->preview)
|
||||
image_map_apply (td->image_map, threshold, (void *) td);
|
||||
|
||||
if (td->image_map)
|
||||
image_map_commit (td->image_map);
|
||||
|
||||
active_tool->preserve = FALSE;
|
||||
|
||||
td->image_map = NULL;
|
||||
}
|
||||
|
||||
|
@ -527,7 +537,9 @@ threshold_cancel_callback (GtkWidget *widget,
|
|||
|
||||
if (td->image_map)
|
||||
{
|
||||
active_tool->preserve = TRUE;
|
||||
image_map_abort (td->image_map);
|
||||
active_tool->preserve = FALSE;
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
|
|
|
@ -176,6 +176,10 @@ brightness_contrast_button_press (Tool *tool,
|
|||
GdkEventButton *bevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisp_ptr;
|
||||
tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -253,6 +257,8 @@ tools_new_brightness_contrast ()
|
|||
tool->cursor_update_func = brightness_contrast_cursor_update;
|
||||
tool->control_func = brightness_contrast_control;
|
||||
tool->preserve = FALSE;
|
||||
tool->gdisp_ptr = NULL;
|
||||
tool->drawable = NULL;
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
@ -266,7 +272,7 @@ tools_free_brightness_contrast (Tool *tool)
|
|||
|
||||
/* Close the color select dialog */
|
||||
if (brightness_contrast_dialog)
|
||||
brightness_contrast_ok_callback (NULL, (gpointer) brightness_contrast_dialog);
|
||||
brightness_contrast_cancel_callback (NULL, (gpointer) brightness_contrast_dialog);
|
||||
|
||||
g_free (bc);
|
||||
}
|
||||
|
|
|
@ -292,6 +292,8 @@ by_color_select_button_press (Tool *tool,
|
|||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
by_color_sel = (ByColorSelect *) tool->private;
|
||||
|
||||
tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
|
||||
if (!by_color_dialog)
|
||||
return;
|
||||
|
||||
|
@ -477,6 +479,8 @@ tools_new_by_color_select ()
|
|||
tool->arrow_keys_func = standard_arrow_keys_func;
|
||||
tool->cursor_update_func = by_color_select_cursor_update;
|
||||
tool->control_func = by_color_select_control;
|
||||
tool->gdisp_ptr = NULL;
|
||||
tool->drawable = NULL;
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
|
|
@ -206,6 +206,10 @@ color_balance_button_press (Tool *tool,
|
|||
GdkEventButton *bevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisp_ptr;
|
||||
tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -286,6 +290,8 @@ tools_new_color_balance ()
|
|||
tool->cursor_update_func = color_balance_cursor_update;
|
||||
tool->control_func = color_balance_control;
|
||||
tool->preserve = FALSE;
|
||||
tool->gdisp_ptr = NULL;
|
||||
tool->drawable = NULL;
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
@ -299,7 +305,7 @@ tools_free_color_balance (Tool *tool)
|
|||
|
||||
/* Close the color select dialog */
|
||||
if (color_balance_dialog)
|
||||
color_balance_ok_callback (NULL, (gpointer) color_balance_dialog);
|
||||
color_balance_cancel_callback (NULL, (gpointer) color_balance_dialog);
|
||||
|
||||
g_free (color_bal);
|
||||
}
|
||||
|
|
|
@ -207,6 +207,10 @@ curves_button_press (Tool *tool,
|
|||
GdkEventButton *bevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisp_ptr;
|
||||
tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -287,6 +291,8 @@ tools_new_curves ()
|
|||
tool->cursor_update_func = curves_cursor_update;
|
||||
tool->control_func = curves_control;
|
||||
tool->preserve = TRUE;
|
||||
tool->gdisp_ptr = NULL;
|
||||
tool->drawable = NULL;
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
@ -300,7 +306,7 @@ tools_free_curves (Tool *tool)
|
|||
|
||||
/* Close the color select dialog */
|
||||
if (curves_dialog)
|
||||
curves_ok_callback (NULL, (gpointer) curves_dialog);
|
||||
curves_cancel_callback (NULL, (gpointer) curves_dialog);
|
||||
|
||||
g_free (_curves);
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ gint
|
|||
gdisplay_canvas_events (GtkWidget *canvas,
|
||||
GdkEvent *event)
|
||||
{
|
||||
GDisplay *gdisp, *tool_gdisp;
|
||||
GDisplay *gdisp;
|
||||
GdkEventExpose *eevent;
|
||||
GdkEventMotion *mevent;
|
||||
GdkEventButton *bevent;
|
||||
|
@ -147,11 +147,13 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
bevent->x = tx;
|
||||
bevent->y = ty;
|
||||
}
|
||||
/* Reset the current tool if we're changing displays... */
|
||||
tool_gdisp = active_tool->gdisp_ptr;
|
||||
if (tool_gdisp)
|
||||
if (tool_gdisp->ID != gdisp->ID && !active_tool->preserve)
|
||||
tools_select(active_tool->type);
|
||||
/* Reset the current tool if we're changing drawables... */
|
||||
|
||||
if (active_tool->drawable)
|
||||
if ((drawable_ID(gimage_active_drawable(gdisp->gimage)) !=
|
||||
drawable_ID(GIMP_DRAWABLE(active_tool->drawable))) &&
|
||||
!active_tool->preserve)
|
||||
tools_initialize (active_tool->type, gdisp);
|
||||
(* active_tool->button_press_func) (active_tool, bevent, gdisp);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -66,7 +66,7 @@ gint
|
|||
gdisplay_canvas_events (GtkWidget *canvas,
|
||||
GdkEvent *event)
|
||||
{
|
||||
GDisplay *gdisp, *tool_gdisp;
|
||||
GDisplay *gdisp;
|
||||
GdkEventExpose *eevent;
|
||||
GdkEventMotion *mevent;
|
||||
GdkEventButton *bevent;
|
||||
|
@ -147,11 +147,13 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
bevent->x = tx;
|
||||
bevent->y = ty;
|
||||
}
|
||||
/* Reset the current tool if we're changing displays... */
|
||||
tool_gdisp = active_tool->gdisp_ptr;
|
||||
if (tool_gdisp)
|
||||
if (tool_gdisp->ID != gdisp->ID && !active_tool->preserve)
|
||||
tools_select(active_tool->type);
|
||||
/* Reset the current tool if we're changing drawables... */
|
||||
|
||||
if (active_tool->drawable)
|
||||
if ((drawable_ID(gimage_active_drawable(gdisp->gimage)) !=
|
||||
drawable_ID(GIMP_DRAWABLE(active_tool->drawable))) &&
|
||||
!active_tool->preserve)
|
||||
tools_initialize (active_tool->type, gdisp);
|
||||
(* active_tool->button_press_func) (active_tool, bevent, gdisp);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -66,7 +66,7 @@ gint
|
|||
gdisplay_canvas_events (GtkWidget *canvas,
|
||||
GdkEvent *event)
|
||||
{
|
||||
GDisplay *gdisp, *tool_gdisp;
|
||||
GDisplay *gdisp;
|
||||
GdkEventExpose *eevent;
|
||||
GdkEventMotion *mevent;
|
||||
GdkEventButton *bevent;
|
||||
|
@ -147,11 +147,13 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
bevent->x = tx;
|
||||
bevent->y = ty;
|
||||
}
|
||||
/* Reset the current tool if we're changing displays... */
|
||||
tool_gdisp = active_tool->gdisp_ptr;
|
||||
if (tool_gdisp)
|
||||
if (tool_gdisp->ID != gdisp->ID && !active_tool->preserve)
|
||||
tools_select(active_tool->type);
|
||||
/* Reset the current tool if we're changing drawables... */
|
||||
|
||||
if (active_tool->drawable)
|
||||
if ((drawable_ID(gimage_active_drawable(gdisp->gimage)) !=
|
||||
drawable_ID(GIMP_DRAWABLE(active_tool->drawable))) &&
|
||||
!active_tool->preserve)
|
||||
tools_initialize (active_tool->type, gdisp);
|
||||
(* active_tool->button_press_func) (active_tool, bevent, gdisp);
|
||||
}
|
||||
break;
|
||||
|
|
14
app/gimage.c
14
app/gimage.c
|
@ -2625,16 +2625,20 @@ int
|
|||
gimage_dirty (GImage *gimage)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
|
||||
if (gimage->dirty < 0)
|
||||
gimage->dirty = 2;
|
||||
else
|
||||
gimage->dirty ++;
|
||||
if (active_tool) {
|
||||
if (active_tool && !active_tool->preserve) {
|
||||
gdisp = active_tool->gdisp_ptr;
|
||||
if (gdisp)
|
||||
if ((gdisp->gimage == gimage) && (!active_tool->preserve))
|
||||
tools_select (active_tool->type);
|
||||
if (gdisp)
|
||||
if (gdisp->gimage->ID == gimage->ID)
|
||||
tools_initialize (active_tool->type, gdisp);
|
||||
else
|
||||
active_tool_control(DESTROY, gdisp);
|
||||
else
|
||||
active_tool_control(DESTROY, gdisp);
|
||||
}
|
||||
return gimage->dirty;
|
||||
}
|
||||
|
|
|
@ -287,6 +287,10 @@ histogram_tool_button_press (Tool *tool,
|
|||
GdkEventButton *bevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisp_ptr;
|
||||
tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -370,7 +374,7 @@ tools_free_histogram_tool (Tool *tool)
|
|||
|
||||
/* Close the histogram dialog */
|
||||
if (histogram_tool_dialog)
|
||||
histogram_tool_ok_callback (NULL, (gpointer) histogram_tool_dialog);
|
||||
histogram_tool_cancel_callback (NULL, (gpointer) histogram_tool_dialog);
|
||||
|
||||
g_free (hist);
|
||||
}
|
||||
|
|
|
@ -250,6 +250,10 @@ hue_saturation_button_press (Tool *tool,
|
|||
GdkEventButton *bevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisp_ptr;
|
||||
tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -330,6 +334,8 @@ tools_new_hue_saturation ()
|
|||
tool->cursor_update_func = hue_saturation_cursor_update;
|
||||
tool->control_func = hue_saturation_control;
|
||||
tool->preserve = FALSE;
|
||||
tool->gdisp_ptr = NULL;
|
||||
tool->drawable = NULL;
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
@ -343,7 +349,7 @@ tools_free_hue_saturation (Tool *tool)
|
|||
|
||||
/* Close the color select dialog */
|
||||
if (hue_saturation_dialog)
|
||||
hue_saturation_ok_callback (NULL, (gpointer) hue_saturation_dialog);
|
||||
hue_saturation_cancel_callback (NULL, (gpointer) hue_saturation_dialog);
|
||||
|
||||
g_free (color_bal);
|
||||
}
|
||||
|
|
|
@ -301,6 +301,10 @@ levels_button_press (Tool *tool,
|
|||
GdkEventButton *bevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisp_ptr;
|
||||
tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -381,6 +385,8 @@ tools_new_levels ()
|
|||
tool->cursor_update_func = levels_cursor_update;
|
||||
tool->control_func = levels_control;
|
||||
tool->preserve = FALSE;
|
||||
tool->gdisp_ptr = NULL;
|
||||
tool->drawable = NULL;
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
@ -394,7 +400,7 @@ tools_free_levels (Tool *tool)
|
|||
|
||||
/* Close the color select dialog */
|
||||
if (levels_dialog)
|
||||
levels_ok_callback (NULL, (gpointer) levels_dialog);
|
||||
levels_cancel_callback (NULL, (gpointer) levels_dialog);
|
||||
|
||||
g_free (_levels);
|
||||
}
|
||||
|
|
|
@ -131,6 +131,10 @@ posterize_button_press (Tool *tool,
|
|||
GdkEventButton *bevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisp_ptr;
|
||||
tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -218,6 +222,8 @@ tools_new_posterize ()
|
|||
tool->cursor_update_func = posterize_cursor_update;
|
||||
tool->control_func = posterize_control;
|
||||
tool->preserve = FALSE;
|
||||
tool->gdisp_ptr = NULL;
|
||||
tool->drawable = NULL;
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
@ -231,7 +237,7 @@ tools_free_posterize (Tool *tool)
|
|||
|
||||
/* Close the color select dialog */
|
||||
if (posterize_dialog)
|
||||
posterize_ok_callback (NULL, (gpointer) posterize_dialog);
|
||||
posterize_cancel_callback (NULL, (gpointer) posterize_dialog);
|
||||
|
||||
g_free (post);
|
||||
}
|
||||
|
|
|
@ -225,6 +225,10 @@ threshold_button_press (Tool *tool,
|
|||
GdkEventButton *bevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisp_ptr;
|
||||
tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -270,7 +274,9 @@ threshold_control (Tool *tool,
|
|||
case HALT :
|
||||
if (threshold_dialog)
|
||||
{
|
||||
active_tool->preserve = TRUE;
|
||||
image_map_abort (threshold_dialog->image_map);
|
||||
active_tool->preserve = FALSE;
|
||||
threshold_dialog->image_map = NULL;
|
||||
threshold_cancel_callback (NULL, (gpointer) threshold_dialog);
|
||||
}
|
||||
|
@ -309,6 +315,7 @@ tools_new_threshold ()
|
|||
tool->arrow_keys_func = standard_arrow_keys_func;
|
||||
tool->cursor_update_func = threshold_cursor_update;
|
||||
tool->control_func = threshold_control;
|
||||
tool->preserve = FALSE;
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
@ -322,7 +329,7 @@ tools_free_threshold (Tool *tool)
|
|||
|
||||
/* Close the color select dialog */
|
||||
if (threshold_dialog)
|
||||
threshold_ok_callback (NULL, (gpointer) threshold_dialog);
|
||||
threshold_cancel_callback (NULL, (gpointer) threshold_dialog);
|
||||
|
||||
g_free (thresh);
|
||||
}
|
||||
|
@ -496,12 +503,15 @@ threshold_ok_callback (GtkWidget *widget,
|
|||
if (GTK_WIDGET_VISIBLE (td->shell))
|
||||
gtk_widget_hide (td->shell);
|
||||
|
||||
active_tool->preserve = TRUE;
|
||||
|
||||
if (!td->preview)
|
||||
image_map_apply (td->image_map, threshold, (void *) td);
|
||||
|
||||
if (td->image_map)
|
||||
image_map_commit (td->image_map);
|
||||
|
||||
active_tool->preserve = FALSE;
|
||||
|
||||
td->image_map = NULL;
|
||||
}
|
||||
|
||||
|
@ -527,7 +537,9 @@ threshold_cancel_callback (GtkWidget *widget,
|
|||
|
||||
if (td->image_map)
|
||||
{
|
||||
active_tool->preserve = TRUE;
|
||||
image_map_abort (td->image_map);
|
||||
active_tool->preserve = FALSE;
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
|
|
147
app/tools.c
147
app/tools.c
|
@ -363,10 +363,153 @@ tools_select (ToolType type)
|
|||
*/
|
||||
active_tool->paused_count = 0;
|
||||
active_tool->gdisp_ptr = NULL;
|
||||
active_tool->drawable = NULL;
|
||||
active_tool->ID = global_tool_ID++;
|
||||
active_tool_type = active_tool->type;
|
||||
}
|
||||
|
||||
void
|
||||
tools_initialize (ToolType type, GDisplay *gdisp_ptr)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
/* If you're wondering... only these dialog type tools have init functions */
|
||||
gdisp = gdisp_ptr;
|
||||
|
||||
if (active_tool)
|
||||
active_tool_free ();
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case RECT_SELECT:
|
||||
active_tool = tools_new_rect_select ();
|
||||
break;
|
||||
case ELLIPSE_SELECT:
|
||||
active_tool = tools_new_ellipse_select ();
|
||||
break;
|
||||
case FREE_SELECT:
|
||||
active_tool = tools_new_free_select ();
|
||||
break;
|
||||
case FUZZY_SELECT:
|
||||
active_tool = tools_new_fuzzy_select ();
|
||||
break;
|
||||
case BEZIER_SELECT:
|
||||
active_tool = tools_new_bezier_select ();
|
||||
break;
|
||||
case ISCISSORS:
|
||||
active_tool = tools_new_iscissors ();
|
||||
break;
|
||||
case MOVE:
|
||||
active_tool = tools_new_move_tool ();
|
||||
break;
|
||||
case MAGNIFY:
|
||||
active_tool = tools_new_magnify ();
|
||||
break;
|
||||
case CROP:
|
||||
active_tool = tools_new_crop ();
|
||||
break;
|
||||
case ROTATE:
|
||||
active_tool = tools_new_transform_tool ();
|
||||
break;
|
||||
case SCALE:
|
||||
active_tool = tools_new_transform_tool ();
|
||||
break;
|
||||
case SHEAR:
|
||||
active_tool = tools_new_transform_tool ();
|
||||
break;
|
||||
case PERSPECTIVE:
|
||||
active_tool = tools_new_transform_tool ();
|
||||
break;
|
||||
case FLIP_HORZ:
|
||||
active_tool = tools_new_flip ();
|
||||
break;
|
||||
case FLIP_VERT:
|
||||
active_tool = tools_new_flip ();
|
||||
break;
|
||||
case TEXT:
|
||||
active_tool = tools_new_text ();
|
||||
break;
|
||||
case COLOR_PICKER:
|
||||
active_tool = tools_new_color_picker ();
|
||||
break;
|
||||
case BUCKET_FILL:
|
||||
active_tool = tools_new_bucket_fill ();
|
||||
break;
|
||||
case BLEND:
|
||||
active_tool = tools_new_blend ();
|
||||
break;
|
||||
case PENCIL:
|
||||
active_tool = tools_new_pencil ();
|
||||
break;
|
||||
case PAINTBRUSH:
|
||||
active_tool = tools_new_paintbrush ();
|
||||
break;
|
||||
case ERASER:
|
||||
active_tool = tools_new_eraser ();
|
||||
break;
|
||||
case AIRBRUSH:
|
||||
active_tool = tools_new_airbrush ();
|
||||
break;
|
||||
case CLONE:
|
||||
active_tool = tools_new_clone ();
|
||||
break;
|
||||
case CONVOLVE:
|
||||
active_tool = tools_new_convolve ();
|
||||
break;
|
||||
case BY_COLOR_SELECT:
|
||||
active_tool = tools_new_by_color_select ();
|
||||
by_color_select_initialize (gdisp);
|
||||
break;
|
||||
case COLOR_BALANCE:
|
||||
active_tool = tools_new_color_balance ();
|
||||
color_balance_initialize (gdisp);
|
||||
break;
|
||||
case BRIGHTNESS_CONTRAST:
|
||||
active_tool = tools_new_brightness_contrast ();
|
||||
brightness_contrast_initialize (gdisp);
|
||||
break;
|
||||
case HUE_SATURATION:
|
||||
active_tool = tools_new_hue_saturation ();
|
||||
hue_saturation_initialize (gdisp);
|
||||
break;
|
||||
case POSTERIZE:
|
||||
active_tool = tools_new_posterize ();
|
||||
posterize_initialize (gdisp);
|
||||
break;
|
||||
case THRESHOLD:
|
||||
active_tool = tools_new_threshold ();
|
||||
threshold_initialize (gdisp);
|
||||
break;
|
||||
case CURVES:
|
||||
active_tool = tools_new_curves ();
|
||||
curves_initialize (gdisp);
|
||||
break;
|
||||
case LEVELS:
|
||||
active_tool = tools_new_levels ();
|
||||
levels_initialize (gdisp);
|
||||
break;
|
||||
case HISTOGRAM:
|
||||
active_tool = tools_new_histogram_tool ();
|
||||
histogram_tool_initialize (gdisp);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
/* Show the options for the active tool
|
||||
*/
|
||||
if (tool_info[(int) active_tool->type].tool_options)
|
||||
gtk_widget_show (tool_info[(int) active_tool->type].tool_options);
|
||||
|
||||
gtk_container_enable_resize (GTK_CONTAINER (options_shell));
|
||||
|
||||
/* Set the paused count variable to 0
|
||||
*/
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
active_tool->gdisp_ptr = NULL;
|
||||
active_tool->ID = global_tool_ID++;
|
||||
active_tool_type = active_tool->type;
|
||||
}
|
||||
|
||||
void
|
||||
tools_options_dialog_new ()
|
||||
|
@ -503,6 +646,10 @@ 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)
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#define __TOOLS_H__
|
||||
|
||||
#include "layer.h"
|
||||
|
||||
#include "gdisplay.h"
|
||||
|
||||
/* The possible states for tools */
|
||||
#define INACTIVE 0
|
||||
|
@ -108,6 +108,8 @@ struct _tool
|
|||
int auto_snap_to; /* should the mouse snap to guides automatically */
|
||||
void * private; /* Tool-specific information */
|
||||
void * gdisp_ptr; /* pointer to currently active gdisp */
|
||||
void * drawable; /* pointer to the drawable that was
|
||||
active when the tool was created */
|
||||
int ID; /* unique tool ID */
|
||||
|
||||
int preserve; /* Perserve this tool through the current image changes */
|
||||
|
@ -139,6 +141,7 @@ extern ToolInfo tool_info[];
|
|||
/* Function declarations */
|
||||
|
||||
void tools_select (ToolType);
|
||||
void tools_initialize (ToolType, GDisplay *);
|
||||
void tools_options_dialog_new (void);
|
||||
void tools_options_dialog_show (void);
|
||||
void tools_options_dialog_free (void);
|
||||
|
|
|
@ -176,6 +176,10 @@ brightness_contrast_button_press (Tool *tool,
|
|||
GdkEventButton *bevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisp_ptr;
|
||||
tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -253,6 +257,8 @@ tools_new_brightness_contrast ()
|
|||
tool->cursor_update_func = brightness_contrast_cursor_update;
|
||||
tool->control_func = brightness_contrast_control;
|
||||
tool->preserve = FALSE;
|
||||
tool->gdisp_ptr = NULL;
|
||||
tool->drawable = NULL;
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
@ -266,7 +272,7 @@ tools_free_brightness_contrast (Tool *tool)
|
|||
|
||||
/* Close the color select dialog */
|
||||
if (brightness_contrast_dialog)
|
||||
brightness_contrast_ok_callback (NULL, (gpointer) brightness_contrast_dialog);
|
||||
brightness_contrast_cancel_callback (NULL, (gpointer) brightness_contrast_dialog);
|
||||
|
||||
g_free (bc);
|
||||
}
|
||||
|
|
|
@ -292,6 +292,8 @@ by_color_select_button_press (Tool *tool,
|
|||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
by_color_sel = (ByColorSelect *) tool->private;
|
||||
|
||||
tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
|
||||
if (!by_color_dialog)
|
||||
return;
|
||||
|
||||
|
@ -477,6 +479,8 @@ tools_new_by_color_select ()
|
|||
tool->arrow_keys_func = standard_arrow_keys_func;
|
||||
tool->cursor_update_func = by_color_select_cursor_update;
|
||||
tool->control_func = by_color_select_control;
|
||||
tool->gdisp_ptr = NULL;
|
||||
tool->drawable = NULL;
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
|
|
@ -206,6 +206,10 @@ color_balance_button_press (Tool *tool,
|
|||
GdkEventButton *bevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisp_ptr;
|
||||
tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -286,6 +290,8 @@ tools_new_color_balance ()
|
|||
tool->cursor_update_func = color_balance_cursor_update;
|
||||
tool->control_func = color_balance_control;
|
||||
tool->preserve = FALSE;
|
||||
tool->gdisp_ptr = NULL;
|
||||
tool->drawable = NULL;
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
@ -299,7 +305,7 @@ tools_free_color_balance (Tool *tool)
|
|||
|
||||
/* Close the color select dialog */
|
||||
if (color_balance_dialog)
|
||||
color_balance_ok_callback (NULL, (gpointer) color_balance_dialog);
|
||||
color_balance_cancel_callback (NULL, (gpointer) color_balance_dialog);
|
||||
|
||||
g_free (color_bal);
|
||||
}
|
||||
|
|
|
@ -207,6 +207,10 @@ curves_button_press (Tool *tool,
|
|||
GdkEventButton *bevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisp_ptr;
|
||||
tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -287,6 +291,8 @@ tools_new_curves ()
|
|||
tool->cursor_update_func = curves_cursor_update;
|
||||
tool->control_func = curves_control;
|
||||
tool->preserve = TRUE;
|
||||
tool->gdisp_ptr = NULL;
|
||||
tool->drawable = NULL;
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
@ -300,7 +306,7 @@ tools_free_curves (Tool *tool)
|
|||
|
||||
/* Close the color select dialog */
|
||||
if (curves_dialog)
|
||||
curves_ok_callback (NULL, (gpointer) curves_dialog);
|
||||
curves_cancel_callback (NULL, (gpointer) curves_dialog);
|
||||
|
||||
g_free (_curves);
|
||||
}
|
||||
|
|
|
@ -176,6 +176,10 @@ brightness_contrast_button_press (Tool *tool,
|
|||
GdkEventButton *bevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisp_ptr;
|
||||
tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -253,6 +257,8 @@ tools_new_brightness_contrast ()
|
|||
tool->cursor_update_func = brightness_contrast_cursor_update;
|
||||
tool->control_func = brightness_contrast_control;
|
||||
tool->preserve = FALSE;
|
||||
tool->gdisp_ptr = NULL;
|
||||
tool->drawable = NULL;
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
@ -266,7 +272,7 @@ tools_free_brightness_contrast (Tool *tool)
|
|||
|
||||
/* Close the color select dialog */
|
||||
if (brightness_contrast_dialog)
|
||||
brightness_contrast_ok_callback (NULL, (gpointer) brightness_contrast_dialog);
|
||||
brightness_contrast_cancel_callback (NULL, (gpointer) brightness_contrast_dialog);
|
||||
|
||||
g_free (bc);
|
||||
}
|
||||
|
|
|
@ -292,6 +292,8 @@ by_color_select_button_press (Tool *tool,
|
|||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
by_color_sel = (ByColorSelect *) tool->private;
|
||||
|
||||
tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
|
||||
if (!by_color_dialog)
|
||||
return;
|
||||
|
||||
|
@ -477,6 +479,8 @@ tools_new_by_color_select ()
|
|||
tool->arrow_keys_func = standard_arrow_keys_func;
|
||||
tool->cursor_update_func = by_color_select_cursor_update;
|
||||
tool->control_func = by_color_select_control;
|
||||
tool->gdisp_ptr = NULL;
|
||||
tool->drawable = NULL;
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
|
|
@ -206,6 +206,10 @@ color_balance_button_press (Tool *tool,
|
|||
GdkEventButton *bevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisp_ptr;
|
||||
tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -286,6 +290,8 @@ tools_new_color_balance ()
|
|||
tool->cursor_update_func = color_balance_cursor_update;
|
||||
tool->control_func = color_balance_control;
|
||||
tool->preserve = FALSE;
|
||||
tool->gdisp_ptr = NULL;
|
||||
tool->drawable = NULL;
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
@ -299,7 +305,7 @@ tools_free_color_balance (Tool *tool)
|
|||
|
||||
/* Close the color select dialog */
|
||||
if (color_balance_dialog)
|
||||
color_balance_ok_callback (NULL, (gpointer) color_balance_dialog);
|
||||
color_balance_cancel_callback (NULL, (gpointer) color_balance_dialog);
|
||||
|
||||
g_free (color_bal);
|
||||
}
|
||||
|
|
|
@ -207,6 +207,10 @@ curves_button_press (Tool *tool,
|
|||
GdkEventButton *bevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisp_ptr;
|
||||
tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -287,6 +291,8 @@ tools_new_curves ()
|
|||
tool->cursor_update_func = curves_cursor_update;
|
||||
tool->control_func = curves_control;
|
||||
tool->preserve = TRUE;
|
||||
tool->gdisp_ptr = NULL;
|
||||
tool->drawable = NULL;
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
@ -300,7 +306,7 @@ tools_free_curves (Tool *tool)
|
|||
|
||||
/* Close the color select dialog */
|
||||
if (curves_dialog)
|
||||
curves_ok_callback (NULL, (gpointer) curves_dialog);
|
||||
curves_cancel_callback (NULL, (gpointer) curves_dialog);
|
||||
|
||||
g_free (_curves);
|
||||
}
|
||||
|
|
|
@ -287,6 +287,10 @@ histogram_tool_button_press (Tool *tool,
|
|||
GdkEventButton *bevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisp_ptr;
|
||||
tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -370,7 +374,7 @@ tools_free_histogram_tool (Tool *tool)
|
|||
|
||||
/* Close the histogram dialog */
|
||||
if (histogram_tool_dialog)
|
||||
histogram_tool_ok_callback (NULL, (gpointer) histogram_tool_dialog);
|
||||
histogram_tool_cancel_callback (NULL, (gpointer) histogram_tool_dialog);
|
||||
|
||||
g_free (hist);
|
||||
}
|
||||
|
|
|
@ -250,6 +250,10 @@ hue_saturation_button_press (Tool *tool,
|
|||
GdkEventButton *bevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisp_ptr;
|
||||
tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -330,6 +334,8 @@ tools_new_hue_saturation ()
|
|||
tool->cursor_update_func = hue_saturation_cursor_update;
|
||||
tool->control_func = hue_saturation_control;
|
||||
tool->preserve = FALSE;
|
||||
tool->gdisp_ptr = NULL;
|
||||
tool->drawable = NULL;
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
@ -343,7 +349,7 @@ tools_free_hue_saturation (Tool *tool)
|
|||
|
||||
/* Close the color select dialog */
|
||||
if (hue_saturation_dialog)
|
||||
hue_saturation_ok_callback (NULL, (gpointer) hue_saturation_dialog);
|
||||
hue_saturation_cancel_callback (NULL, (gpointer) hue_saturation_dialog);
|
||||
|
||||
g_free (color_bal);
|
||||
}
|
||||
|
|
|
@ -301,6 +301,10 @@ levels_button_press (Tool *tool,
|
|||
GdkEventButton *bevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisp_ptr;
|
||||
tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -381,6 +385,8 @@ tools_new_levels ()
|
|||
tool->cursor_update_func = levels_cursor_update;
|
||||
tool->control_func = levels_control;
|
||||
tool->preserve = FALSE;
|
||||
tool->gdisp_ptr = NULL;
|
||||
tool->drawable = NULL;
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
@ -394,7 +400,7 @@ tools_free_levels (Tool *tool)
|
|||
|
||||
/* Close the color select dialog */
|
||||
if (levels_dialog)
|
||||
levels_ok_callback (NULL, (gpointer) levels_dialog);
|
||||
levels_cancel_callback (NULL, (gpointer) levels_dialog);
|
||||
|
||||
g_free (_levels);
|
||||
}
|
||||
|
|
|
@ -131,6 +131,10 @@ posterize_button_press (Tool *tool,
|
|||
GdkEventButton *bevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisp_ptr;
|
||||
tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -218,6 +222,8 @@ tools_new_posterize ()
|
|||
tool->cursor_update_func = posterize_cursor_update;
|
||||
tool->control_func = posterize_control;
|
||||
tool->preserve = FALSE;
|
||||
tool->gdisp_ptr = NULL;
|
||||
tool->drawable = NULL;
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
@ -231,7 +237,7 @@ tools_free_posterize (Tool *tool)
|
|||
|
||||
/* Close the color select dialog */
|
||||
if (posterize_dialog)
|
||||
posterize_ok_callback (NULL, (gpointer) posterize_dialog);
|
||||
posterize_cancel_callback (NULL, (gpointer) posterize_dialog);
|
||||
|
||||
g_free (post);
|
||||
}
|
||||
|
|
|
@ -225,6 +225,10 @@ threshold_button_press (Tool *tool,
|
|||
GdkEventButton *bevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisp_ptr;
|
||||
tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -270,7 +274,9 @@ threshold_control (Tool *tool,
|
|||
case HALT :
|
||||
if (threshold_dialog)
|
||||
{
|
||||
active_tool->preserve = TRUE;
|
||||
image_map_abort (threshold_dialog->image_map);
|
||||
active_tool->preserve = FALSE;
|
||||
threshold_dialog->image_map = NULL;
|
||||
threshold_cancel_callback (NULL, (gpointer) threshold_dialog);
|
||||
}
|
||||
|
@ -309,6 +315,7 @@ tools_new_threshold ()
|
|||
tool->arrow_keys_func = standard_arrow_keys_func;
|
||||
tool->cursor_update_func = threshold_cursor_update;
|
||||
tool->control_func = threshold_control;
|
||||
tool->preserve = FALSE;
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
@ -322,7 +329,7 @@ tools_free_threshold (Tool *tool)
|
|||
|
||||
/* Close the color select dialog */
|
||||
if (threshold_dialog)
|
||||
threshold_ok_callback (NULL, (gpointer) threshold_dialog);
|
||||
threshold_cancel_callback (NULL, (gpointer) threshold_dialog);
|
||||
|
||||
g_free (thresh);
|
||||
}
|
||||
|
@ -496,12 +503,15 @@ threshold_ok_callback (GtkWidget *widget,
|
|||
if (GTK_WIDGET_VISIBLE (td->shell))
|
||||
gtk_widget_hide (td->shell);
|
||||
|
||||
active_tool->preserve = TRUE;
|
||||
|
||||
if (!td->preview)
|
||||
image_map_apply (td->image_map, threshold, (void *) td);
|
||||
|
||||
if (td->image_map)
|
||||
image_map_commit (td->image_map);
|
||||
|
||||
active_tool->preserve = FALSE;
|
||||
|
||||
td->image_map = NULL;
|
||||
}
|
||||
|
||||
|
@ -527,7 +537,9 @@ threshold_cancel_callback (GtkWidget *widget,
|
|||
|
||||
if (td->image_map)
|
||||
{
|
||||
active_tool->preserve = TRUE;
|
||||
image_map_abort (td->image_map);
|
||||
active_tool->preserve = FALSE;
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
|
|
|
@ -287,6 +287,10 @@ histogram_tool_button_press (Tool *tool,
|
|||
GdkEventButton *bevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisp_ptr;
|
||||
tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -370,7 +374,7 @@ tools_free_histogram_tool (Tool *tool)
|
|||
|
||||
/* Close the histogram dialog */
|
||||
if (histogram_tool_dialog)
|
||||
histogram_tool_ok_callback (NULL, (gpointer) histogram_tool_dialog);
|
||||
histogram_tool_cancel_callback (NULL, (gpointer) histogram_tool_dialog);
|
||||
|
||||
g_free (hist);
|
||||
}
|
||||
|
|
|
@ -250,6 +250,10 @@ hue_saturation_button_press (Tool *tool,
|
|||
GdkEventButton *bevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisp_ptr;
|
||||
tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -330,6 +334,8 @@ tools_new_hue_saturation ()
|
|||
tool->cursor_update_func = hue_saturation_cursor_update;
|
||||
tool->control_func = hue_saturation_control;
|
||||
tool->preserve = FALSE;
|
||||
tool->gdisp_ptr = NULL;
|
||||
tool->drawable = NULL;
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
@ -343,7 +349,7 @@ tools_free_hue_saturation (Tool *tool)
|
|||
|
||||
/* Close the color select dialog */
|
||||
if (hue_saturation_dialog)
|
||||
hue_saturation_ok_callback (NULL, (gpointer) hue_saturation_dialog);
|
||||
hue_saturation_cancel_callback (NULL, (gpointer) hue_saturation_dialog);
|
||||
|
||||
g_free (color_bal);
|
||||
}
|
||||
|
|
|
@ -301,6 +301,10 @@ levels_button_press (Tool *tool,
|
|||
GdkEventButton *bevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisp_ptr;
|
||||
tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -381,6 +385,8 @@ tools_new_levels ()
|
|||
tool->cursor_update_func = levels_cursor_update;
|
||||
tool->control_func = levels_control;
|
||||
tool->preserve = FALSE;
|
||||
tool->gdisp_ptr = NULL;
|
||||
tool->drawable = NULL;
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
@ -394,7 +400,7 @@ tools_free_levels (Tool *tool)
|
|||
|
||||
/* Close the color select dialog */
|
||||
if (levels_dialog)
|
||||
levels_ok_callback (NULL, (gpointer) levels_dialog);
|
||||
levels_cancel_callback (NULL, (gpointer) levels_dialog);
|
||||
|
||||
g_free (_levels);
|
||||
}
|
||||
|
|
|
@ -131,6 +131,10 @@ posterize_button_press (Tool *tool,
|
|||
GdkEventButton *bevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisp_ptr;
|
||||
tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -218,6 +222,8 @@ tools_new_posterize ()
|
|||
tool->cursor_update_func = posterize_cursor_update;
|
||||
tool->control_func = posterize_control;
|
||||
tool->preserve = FALSE;
|
||||
tool->gdisp_ptr = NULL;
|
||||
tool->drawable = NULL;
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
@ -231,7 +237,7 @@ tools_free_posterize (Tool *tool)
|
|||
|
||||
/* Close the color select dialog */
|
||||
if (posterize_dialog)
|
||||
posterize_ok_callback (NULL, (gpointer) posterize_dialog);
|
||||
posterize_cancel_callback (NULL, (gpointer) posterize_dialog);
|
||||
|
||||
g_free (post);
|
||||
}
|
||||
|
|
|
@ -225,6 +225,10 @@ threshold_button_press (Tool *tool,
|
|||
GdkEventButton *bevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisp_ptr;
|
||||
tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -270,7 +274,9 @@ threshold_control (Tool *tool,
|
|||
case HALT :
|
||||
if (threshold_dialog)
|
||||
{
|
||||
active_tool->preserve = TRUE;
|
||||
image_map_abort (threshold_dialog->image_map);
|
||||
active_tool->preserve = FALSE;
|
||||
threshold_dialog->image_map = NULL;
|
||||
threshold_cancel_callback (NULL, (gpointer) threshold_dialog);
|
||||
}
|
||||
|
@ -309,6 +315,7 @@ tools_new_threshold ()
|
|||
tool->arrow_keys_func = standard_arrow_keys_func;
|
||||
tool->cursor_update_func = threshold_cursor_update;
|
||||
tool->control_func = threshold_control;
|
||||
tool->preserve = FALSE;
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
@ -322,7 +329,7 @@ tools_free_threshold (Tool *tool)
|
|||
|
||||
/* Close the color select dialog */
|
||||
if (threshold_dialog)
|
||||
threshold_ok_callback (NULL, (gpointer) threshold_dialog);
|
||||
threshold_cancel_callback (NULL, (gpointer) threshold_dialog);
|
||||
|
||||
g_free (thresh);
|
||||
}
|
||||
|
@ -496,12 +503,15 @@ threshold_ok_callback (GtkWidget *widget,
|
|||
if (GTK_WIDGET_VISIBLE (td->shell))
|
||||
gtk_widget_hide (td->shell);
|
||||
|
||||
active_tool->preserve = TRUE;
|
||||
|
||||
if (!td->preview)
|
||||
image_map_apply (td->image_map, threshold, (void *) td);
|
||||
|
||||
if (td->image_map)
|
||||
image_map_commit (td->image_map);
|
||||
|
||||
active_tool->preserve = FALSE;
|
||||
|
||||
td->image_map = NULL;
|
||||
}
|
||||
|
||||
|
@ -527,7 +537,9 @@ threshold_cancel_callback (GtkWidget *widget,
|
|||
|
||||
if (td->image_map)
|
||||
{
|
||||
active_tool->preserve = TRUE;
|
||||
image_map_abort (td->image_map);
|
||||
active_tool->preserve = FALSE;
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
|
|
|
@ -363,10 +363,153 @@ tools_select (ToolType type)
|
|||
*/
|
||||
active_tool->paused_count = 0;
|
||||
active_tool->gdisp_ptr = NULL;
|
||||
active_tool->drawable = NULL;
|
||||
active_tool->ID = global_tool_ID++;
|
||||
active_tool_type = active_tool->type;
|
||||
}
|
||||
|
||||
void
|
||||
tools_initialize (ToolType type, GDisplay *gdisp_ptr)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
/* If you're wondering... only these dialog type tools have init functions */
|
||||
gdisp = gdisp_ptr;
|
||||
|
||||
if (active_tool)
|
||||
active_tool_free ();
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case RECT_SELECT:
|
||||
active_tool = tools_new_rect_select ();
|
||||
break;
|
||||
case ELLIPSE_SELECT:
|
||||
active_tool = tools_new_ellipse_select ();
|
||||
break;
|
||||
case FREE_SELECT:
|
||||
active_tool = tools_new_free_select ();
|
||||
break;
|
||||
case FUZZY_SELECT:
|
||||
active_tool = tools_new_fuzzy_select ();
|
||||
break;
|
||||
case BEZIER_SELECT:
|
||||
active_tool = tools_new_bezier_select ();
|
||||
break;
|
||||
case ISCISSORS:
|
||||
active_tool = tools_new_iscissors ();
|
||||
break;
|
||||
case MOVE:
|
||||
active_tool = tools_new_move_tool ();
|
||||
break;
|
||||
case MAGNIFY:
|
||||
active_tool = tools_new_magnify ();
|
||||
break;
|
||||
case CROP:
|
||||
active_tool = tools_new_crop ();
|
||||
break;
|
||||
case ROTATE:
|
||||
active_tool = tools_new_transform_tool ();
|
||||
break;
|
||||
case SCALE:
|
||||
active_tool = tools_new_transform_tool ();
|
||||
break;
|
||||
case SHEAR:
|
||||
active_tool = tools_new_transform_tool ();
|
||||
break;
|
||||
case PERSPECTIVE:
|
||||
active_tool = tools_new_transform_tool ();
|
||||
break;
|
||||
case FLIP_HORZ:
|
||||
active_tool = tools_new_flip ();
|
||||
break;
|
||||
case FLIP_VERT:
|
||||
active_tool = tools_new_flip ();
|
||||
break;
|
||||
case TEXT:
|
||||
active_tool = tools_new_text ();
|
||||
break;
|
||||
case COLOR_PICKER:
|
||||
active_tool = tools_new_color_picker ();
|
||||
break;
|
||||
case BUCKET_FILL:
|
||||
active_tool = tools_new_bucket_fill ();
|
||||
break;
|
||||
case BLEND:
|
||||
active_tool = tools_new_blend ();
|
||||
break;
|
||||
case PENCIL:
|
||||
active_tool = tools_new_pencil ();
|
||||
break;
|
||||
case PAINTBRUSH:
|
||||
active_tool = tools_new_paintbrush ();
|
||||
break;
|
||||
case ERASER:
|
||||
active_tool = tools_new_eraser ();
|
||||
break;
|
||||
case AIRBRUSH:
|
||||
active_tool = tools_new_airbrush ();
|
||||
break;
|
||||
case CLONE:
|
||||
active_tool = tools_new_clone ();
|
||||
break;
|
||||
case CONVOLVE:
|
||||
active_tool = tools_new_convolve ();
|
||||
break;
|
||||
case BY_COLOR_SELECT:
|
||||
active_tool = tools_new_by_color_select ();
|
||||
by_color_select_initialize (gdisp);
|
||||
break;
|
||||
case COLOR_BALANCE:
|
||||
active_tool = tools_new_color_balance ();
|
||||
color_balance_initialize (gdisp);
|
||||
break;
|
||||
case BRIGHTNESS_CONTRAST:
|
||||
active_tool = tools_new_brightness_contrast ();
|
||||
brightness_contrast_initialize (gdisp);
|
||||
break;
|
||||
case HUE_SATURATION:
|
||||
active_tool = tools_new_hue_saturation ();
|
||||
hue_saturation_initialize (gdisp);
|
||||
break;
|
||||
case POSTERIZE:
|
||||
active_tool = tools_new_posterize ();
|
||||
posterize_initialize (gdisp);
|
||||
break;
|
||||
case THRESHOLD:
|
||||
active_tool = tools_new_threshold ();
|
||||
threshold_initialize (gdisp);
|
||||
break;
|
||||
case CURVES:
|
||||
active_tool = tools_new_curves ();
|
||||
curves_initialize (gdisp);
|
||||
break;
|
||||
case LEVELS:
|
||||
active_tool = tools_new_levels ();
|
||||
levels_initialize (gdisp);
|
||||
break;
|
||||
case HISTOGRAM:
|
||||
active_tool = tools_new_histogram_tool ();
|
||||
histogram_tool_initialize (gdisp);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
/* Show the options for the active tool
|
||||
*/
|
||||
if (tool_info[(int) active_tool->type].tool_options)
|
||||
gtk_widget_show (tool_info[(int) active_tool->type].tool_options);
|
||||
|
||||
gtk_container_enable_resize (GTK_CONTAINER (options_shell));
|
||||
|
||||
/* Set the paused count variable to 0
|
||||
*/
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
active_tool->gdisp_ptr = NULL;
|
||||
active_tool->ID = global_tool_ID++;
|
||||
active_tool_type = active_tool->type;
|
||||
}
|
||||
|
||||
void
|
||||
tools_options_dialog_new ()
|
||||
|
@ -503,6 +646,10 @@ 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)
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#define __TOOLS_H__
|
||||
|
||||
#include "layer.h"
|
||||
|
||||
#include "gdisplay.h"
|
||||
|
||||
/* The possible states for tools */
|
||||
#define INACTIVE 0
|
||||
|
@ -108,6 +108,8 @@ struct _tool
|
|||
int auto_snap_to; /* should the mouse snap to guides automatically */
|
||||
void * private; /* Tool-specific information */
|
||||
void * gdisp_ptr; /* pointer to currently active gdisp */
|
||||
void * drawable; /* pointer to the drawable that was
|
||||
active when the tool was created */
|
||||
int ID; /* unique tool ID */
|
||||
|
||||
int preserve; /* Perserve this tool through the current image changes */
|
||||
|
@ -139,6 +141,7 @@ extern ToolInfo tool_info[];
|
|||
/* Function declarations */
|
||||
|
||||
void tools_select (ToolType);
|
||||
void tools_initialize (ToolType, GDisplay *);
|
||||
void tools_options_dialog_new (void);
|
||||
void tools_options_dialog_show (void);
|
||||
void tools_options_dialog_free (void);
|
||||
|
|
|
@ -83,6 +83,8 @@ transform_core_button_press (tool, bevent, gdisp_ptr)
|
|||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
|
||||
/* Save the current transformation info */
|
||||
for (i = 0; i < TRAN_INFO_SIZE; i++)
|
||||
old_trans_info [i] = transform_core->trans_info [i];
|
||||
|
@ -517,7 +519,6 @@ transform_core_new (type, interactive)
|
|||
tool->state = INACTIVE;
|
||||
tool->scroll_lock = 1; /* Do not allow scrolling */
|
||||
tool->auto_snap_to = TRUE;
|
||||
tool->gdisp_ptr = NULL;
|
||||
tool->private = (void *) private;
|
||||
|
||||
tool->preserve = FALSE; /* Destroy when the image is dirtied. */
|
||||
|
|
|
@ -83,6 +83,8 @@ transform_core_button_press (tool, bevent, gdisp_ptr)
|
|||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
|
||||
/* Save the current transformation info */
|
||||
for (i = 0; i < TRAN_INFO_SIZE; i++)
|
||||
old_trans_info [i] = transform_core->trans_info [i];
|
||||
|
@ -517,7 +519,6 @@ transform_core_new (type, interactive)
|
|||
tool->state = INACTIVE;
|
||||
tool->scroll_lock = 1; /* Do not allow scrolling */
|
||||
tool->auto_snap_to = TRUE;
|
||||
tool->gdisp_ptr = NULL;
|
||||
tool->private = (void *) private;
|
||||
|
||||
tool->preserve = FALSE; /* Destroy when the image is dirtied. */
|
||||
|
|
Loading…
Reference in New Issue