Commit 434915b0 authored by Michael Natterer's avatar Michael Natterer Committed by Michael Natterer
Browse files

mysteriously, using the new tool constructor fixed the crop tool redraw

1999-07-09  Michael Natterer  <mitschel@cs.tu-berlin.de>

	* app/crop.c: mysteriously, using the new tool constructor fixed
	the crop tool redraw problem.

	* app/gdisplay.c: clode cleanup

	* app/info_dialog.c: never emit signals when updating the info
	fields. Fixes some more transform tool grid redraw bugs.
parent 810a3db5
1999-07-09 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/crop.c: mysteriously, using the new tool constructor fixed
the crop tool redraw problem.
* app/gdisplay.c: clode cleanup
* app/info_dialog.c: never emit signals when updating the info
fields. Fixes some more transform tool grid redraw bugs.
1999-07-09 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/commands.c (view_toggle_rulers_cmd_callback): set the
......
......@@ -289,7 +289,6 @@ gdisplay_format_title (GDisplay *gdisp,
static void
gdisplay_delete (GDisplay *gdisp)
{
GDisplay *tool_gdisp;
GimpContext *context;
g_hash_table_remove (display_ht, gdisp->shell);
......@@ -299,15 +298,11 @@ gdisplay_delete (GDisplay *gdisp)
active_tool_control (HALT, (void *) gdisp);
/* clear out the pointer to this gdisp from the active tool */
if (active_tool && active_tool->gdisp_ptr)
if (active_tool &&
active_tool->gdisp_ptr == gdisp)
{
tool_gdisp = active_tool->gdisp_ptr;
if (gdisp == tool_gdisp)
{
active_tool->drawable = NULL;
active_tool->gdisp_ptr = NULL;
}
active_tool->drawable = NULL;
active_tool->gdisp_ptr = NULL;
}
/* free the selection structure */
......@@ -337,7 +332,7 @@ gdisplay_delete (GDisplay *gdisp)
if (gdisp->window_info_dialog)
info_window_free (gdisp->window_info_dialog);
/* set the active display to NULL */
/* set the active display to NULL if it was this display */
context = gimp_context_get_user ();
if (gimp_context_get_display (context) == gdisp)
gimp_context_set_display (context, NULL);
......
......@@ -742,30 +742,24 @@ tools_new_crop ()
tools_register (CROP, (ToolOptions *) crop_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (Crop *) g_malloc (sizeof (Crop));
tool = tools_new_tool (CROP);
private = g_new (Crop, 1);
private->core = draw_core_new (crop_draw);
private->startx = private->starty = 0;
private->function = CREATING;
tool->type = CROP;
tool->state = INACTIVE;
tool->scroll_lock = 0; /* Allow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = FALSE; /* XXX Check me */
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = crop_button_press;
tool->button_press_func = crop_button_press;
tool->button_release_func = crop_button_release;
tool->motion_func = crop_motion;
tool->arrow_keys_func = crop_arrow_keys_func;
tool->modifier_key_func = crop_modifier_key_func;
tool->cursor_update_func = crop_cursor_update;
tool->control_func = crop_control;
tool->motion_func = crop_motion;
tool->arrow_keys_func = crop_arrow_keys_func;
tool->modifier_key_func = crop_modifier_key_func;
tool->cursor_update_func = crop_cursor_update;
tool->control_func = crop_control;
return tool;
}
......
......@@ -88,6 +88,10 @@ update_field (InfoField *field)
if (field->value_ptr == NULL)
return;
if (field->field_type != INFO_LABEL)
gtk_signal_handler_block_by_data (GTK_OBJECT (field->obj),
field->client_data);
switch (field->field_type)
{
case INFO_LABEL:
......@@ -110,28 +114,19 @@ update_field (InfoField *field)
case INFO_SIZEENTRY:
num = GIMP_SIZE_ENTRY (field->obj)->number_of_fields;
/* without blocking the first (num - 1) fields, a signal would
* be emitted along with every gimp_size_entry_set_refval()...
*/
gtk_signal_handler_block_by_data (GTK_OBJECT (field->obj),
field->client_data);
for (i = 0; i < (num - 1); i++)
for (i = 0; i < num; i++)
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (field->obj), i,
((gdouble*) field->value_ptr)[i]);
gtk_signal_handler_unblock_by_data (GTK_OBJECT (field->obj),
field->client_data);
/* ...so block them and emit the signal for the last field only
*/
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (field->obj), num - 1,
((gdouble*) field->value_ptr)[num - 1]);
break;
default:
g_warning (_("Unknown info_dialog field type."));
break;
}
if (field->field_type != INFO_LABEL)
gtk_signal_handler_unblock_by_data (GTK_OBJECT (field->obj),
field->client_data);
}
static gint
......
......@@ -289,7 +289,6 @@ gdisplay_format_title (GDisplay *gdisp,
static void
gdisplay_delete (GDisplay *gdisp)
{
GDisplay *tool_gdisp;
GimpContext *context;
g_hash_table_remove (display_ht, gdisp->shell);
......@@ -299,15 +298,11 @@ gdisplay_delete (GDisplay *gdisp)
active_tool_control (HALT, (void *) gdisp);
/* clear out the pointer to this gdisp from the active tool */
if (active_tool && active_tool->gdisp_ptr)
if (active_tool &&
active_tool->gdisp_ptr == gdisp)
{
tool_gdisp = active_tool->gdisp_ptr;
if (gdisp == tool_gdisp)
{
active_tool->drawable = NULL;
active_tool->gdisp_ptr = NULL;
}
active_tool->drawable = NULL;
active_tool->gdisp_ptr = NULL;
}
/* free the selection structure */
......@@ -337,7 +332,7 @@ gdisplay_delete (GDisplay *gdisp)
if (gdisp->window_info_dialog)
info_window_free (gdisp->window_info_dialog);
/* set the active display to NULL */
/* set the active display to NULL if it was this display */
context = gimp_context_get_user ();
if (gimp_context_get_display (context) == gdisp)
gimp_context_set_display (context, NULL);
......
......@@ -289,7 +289,6 @@ gdisplay_format_title (GDisplay *gdisp,
static void
gdisplay_delete (GDisplay *gdisp)
{
GDisplay *tool_gdisp;
GimpContext *context;
g_hash_table_remove (display_ht, gdisp->shell);
......@@ -299,15 +298,11 @@ gdisplay_delete (GDisplay *gdisp)
active_tool_control (HALT, (void *) gdisp);
/* clear out the pointer to this gdisp from the active tool */
if (active_tool && active_tool->gdisp_ptr)
if (active_tool &&
active_tool->gdisp_ptr == gdisp)
{
tool_gdisp = active_tool->gdisp_ptr;
if (gdisp == tool_gdisp)
{
active_tool->drawable = NULL;
active_tool->gdisp_ptr = NULL;
}
active_tool->drawable = NULL;
active_tool->gdisp_ptr = NULL;
}
/* free the selection structure */
......@@ -337,7 +332,7 @@ gdisplay_delete (GDisplay *gdisp)
if (gdisp->window_info_dialog)
info_window_free (gdisp->window_info_dialog);
/* set the active display to NULL */
/* set the active display to NULL if it was this display */
context = gimp_context_get_user ();
if (gimp_context_get_display (context) == gdisp)
gimp_context_set_display (context, NULL);
......
......@@ -88,6 +88,10 @@ update_field (InfoField *field)
if (field->value_ptr == NULL)
return;
if (field->field_type != INFO_LABEL)
gtk_signal_handler_block_by_data (GTK_OBJECT (field->obj),
field->client_data);
switch (field->field_type)
{
case INFO_LABEL:
......@@ -110,28 +114,19 @@ update_field (InfoField *field)
case INFO_SIZEENTRY:
num = GIMP_SIZE_ENTRY (field->obj)->number_of_fields;
/* without blocking the first (num - 1) fields, a signal would
* be emitted along with every gimp_size_entry_set_refval()...
*/
gtk_signal_handler_block_by_data (GTK_OBJECT (field->obj),
field->client_data);
for (i = 0; i < (num - 1); i++)
for (i = 0; i < num; i++)
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (field->obj), i,
((gdouble*) field->value_ptr)[i]);
gtk_signal_handler_unblock_by_data (GTK_OBJECT (field->obj),
field->client_data);
/* ...so block them and emit the signal for the last field only
*/
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (field->obj), num - 1,
((gdouble*) field->value_ptr)[num - 1]);
break;
default:
g_warning (_("Unknown info_dialog field type."));
break;
}
if (field->field_type != INFO_LABEL)
gtk_signal_handler_unblock_by_data (GTK_OBJECT (field->obj),
field->client_data);
}
static gint
......
......@@ -88,6 +88,10 @@ update_field (InfoField *field)
if (field->value_ptr == NULL)
return;
if (field->field_type != INFO_LABEL)
gtk_signal_handler_block_by_data (GTK_OBJECT (field->obj),
field->client_data);
switch (field->field_type)
{
case INFO_LABEL:
......@@ -110,28 +114,19 @@ update_field (InfoField *field)
case INFO_SIZEENTRY:
num = GIMP_SIZE_ENTRY (field->obj)->number_of_fields;
/* without blocking the first (num - 1) fields, a signal would
* be emitted along with every gimp_size_entry_set_refval()...
*/
gtk_signal_handler_block_by_data (GTK_OBJECT (field->obj),
field->client_data);
for (i = 0; i < (num - 1); i++)
for (i = 0; i < num; i++)
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (field->obj), i,
((gdouble*) field->value_ptr)[i]);
gtk_signal_handler_unblock_by_data (GTK_OBJECT (field->obj),
field->client_data);
/* ...so block them and emit the signal for the last field only
*/
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (field->obj), num - 1,
((gdouble*) field->value_ptr)[num - 1]);
break;
default:
g_warning (_("Unknown info_dialog field type."));
break;
}
if (field->field_type != INFO_LABEL)
gtk_signal_handler_unblock_by_data (GTK_OBJECT (field->obj),
field->client_data);
}
static gint
......
......@@ -742,30 +742,24 @@ tools_new_crop ()
tools_register (CROP, (ToolOptions *) crop_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (Crop *) g_malloc (sizeof (Crop));
tool = tools_new_tool (CROP);
private = g_new (Crop, 1);
private->core = draw_core_new (crop_draw);
private->startx = private->starty = 0;
private->function = CREATING;
tool->type = CROP;
tool->state = INACTIVE;
tool->scroll_lock = 0; /* Allow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = FALSE; /* XXX Check me */
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = crop_button_press;
tool->button_press_func = crop_button_press;
tool->button_release_func = crop_button_release;
tool->motion_func = crop_motion;
tool->arrow_keys_func = crop_arrow_keys_func;
tool->modifier_key_func = crop_modifier_key_func;
tool->cursor_update_func = crop_cursor_update;
tool->control_func = crop_control;
tool->motion_func = crop_motion;
tool->arrow_keys_func = crop_arrow_keys_func;
tool->modifier_key_func = crop_modifier_key_func;
tool->cursor_update_func = crop_cursor_update;
tool->control_func = crop_control;
return tool;
}
......
......@@ -742,30 +742,24 @@ tools_new_crop ()
tools_register (CROP, (ToolOptions *) crop_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (Crop *) g_malloc (sizeof (Crop));
tool = tools_new_tool (CROP);
private = g_new (Crop, 1);
private->core = draw_core_new (crop_draw);
private->startx = private->starty = 0;
private->function = CREATING;
tool->type = CROP;
tool->state = INACTIVE;
tool->scroll_lock = 0; /* Allow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = FALSE; /* XXX Check me */
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = crop_button_press;
tool->button_press_func = crop_button_press;
tool->button_release_func = crop_button_release;
tool->motion_func = crop_motion;
tool->arrow_keys_func = crop_arrow_keys_func;
tool->modifier_key_func = crop_modifier_key_func;
tool->cursor_update_func = crop_cursor_update;
tool->control_func = crop_control;
tool->motion_func = crop_motion;
tool->arrow_keys_func = crop_arrow_keys_func;
tool->modifier_key_func = crop_modifier_key_func;
tool->cursor_update_func = crop_cursor_update;
tool->control_func = crop_control;
return tool;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment