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.
This commit is contained in:
Michael Natterer 1999-07-09 12:24:36 +00:00 committed by Michael Natterer
parent 810a3db516
commit 434915b03d
10 changed files with 76 additions and 114 deletions

View File

@ -1,3 +1,13 @@
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> 1999-07-09 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/commands.c (view_toggle_rulers_cmd_callback): set the * app/commands.c (view_toggle_rulers_cmd_callback): set the

View File

@ -289,7 +289,6 @@ gdisplay_format_title (GDisplay *gdisp,
static void static void
gdisplay_delete (GDisplay *gdisp) gdisplay_delete (GDisplay *gdisp)
{ {
GDisplay *tool_gdisp;
GimpContext *context; GimpContext *context;
g_hash_table_remove (display_ht, gdisp->shell); g_hash_table_remove (display_ht, gdisp->shell);
@ -299,15 +298,11 @@ gdisplay_delete (GDisplay *gdisp)
active_tool_control (HALT, (void *) gdisp); active_tool_control (HALT, (void *) gdisp);
/* clear out the pointer to this gdisp from the active tool */ /* 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; active_tool->drawable = NULL;
active_tool->gdisp_ptr = NULL;
if (gdisp == tool_gdisp)
{
active_tool->drawable = NULL;
active_tool->gdisp_ptr = NULL;
}
} }
/* free the selection structure */ /* free the selection structure */
@ -337,7 +332,7 @@ gdisplay_delete (GDisplay *gdisp)
if (gdisp->window_info_dialog) if (gdisp->window_info_dialog)
info_window_free (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 (); context = gimp_context_get_user ();
if (gimp_context_get_display (context) == gdisp) if (gimp_context_get_display (context) == gdisp)
gimp_context_set_display (context, NULL); gimp_context_set_display (context, NULL);

View File

@ -742,30 +742,24 @@ tools_new_crop ()
tools_register (CROP, (ToolOptions *) crop_options); tools_register (CROP, (ToolOptions *) crop_options);
} }
tool = (Tool *) g_malloc (sizeof (Tool)); tool = tools_new_tool (CROP);
private = (Crop *) g_malloc (sizeof (Crop)); private = g_new (Crop, 1);
private->core = draw_core_new (crop_draw); private->core = draw_core_new (crop_draw);
private->startx = private->starty = 0; private->startx = private->starty = 0;
private->function = CREATING; 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->private = (void *) private;
tool->preserve = FALSE; /* XXX Check me */ 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->button_release_func = crop_button_release;
tool->motion_func = crop_motion; tool->motion_func = crop_motion;
tool->arrow_keys_func = crop_arrow_keys_func; tool->arrow_keys_func = crop_arrow_keys_func;
tool->modifier_key_func = crop_modifier_key_func; tool->modifier_key_func = crop_modifier_key_func;
tool->cursor_update_func = crop_cursor_update; tool->cursor_update_func = crop_cursor_update;
tool->control_func = crop_control; tool->control_func = crop_control;
return tool; return tool;
} }

View File

@ -88,6 +88,10 @@ update_field (InfoField *field)
if (field->value_ptr == NULL) if (field->value_ptr == NULL)
return; return;
if (field->field_type != INFO_LABEL)
gtk_signal_handler_block_by_data (GTK_OBJECT (field->obj),
field->client_data);
switch (field->field_type) switch (field->field_type)
{ {
case INFO_LABEL: case INFO_LABEL:
@ -110,28 +114,19 @@ update_field (InfoField *field)
case INFO_SIZEENTRY: case INFO_SIZEENTRY:
num = GIMP_SIZE_ENTRY (field->obj)->number_of_fields; num = GIMP_SIZE_ENTRY (field->obj)->number_of_fields;
for (i = 0; i < num; i++)
/* 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++)
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (field->obj), i, gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (field->obj), i,
((gdouble*) field->value_ptr)[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; break;
default: default:
g_warning (_("Unknown info_dialog field type.")); g_warning (_("Unknown info_dialog field type."));
break; break;
} }
if (field->field_type != INFO_LABEL)
gtk_signal_handler_unblock_by_data (GTK_OBJECT (field->obj),
field->client_data);
} }
static gint static gint

View File

@ -289,7 +289,6 @@ gdisplay_format_title (GDisplay *gdisp,
static void static void
gdisplay_delete (GDisplay *gdisp) gdisplay_delete (GDisplay *gdisp)
{ {
GDisplay *tool_gdisp;
GimpContext *context; GimpContext *context;
g_hash_table_remove (display_ht, gdisp->shell); g_hash_table_remove (display_ht, gdisp->shell);
@ -299,15 +298,11 @@ gdisplay_delete (GDisplay *gdisp)
active_tool_control (HALT, (void *) gdisp); active_tool_control (HALT, (void *) gdisp);
/* clear out the pointer to this gdisp from the active tool */ /* 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; active_tool->drawable = NULL;
active_tool->gdisp_ptr = NULL;
if (gdisp == tool_gdisp)
{
active_tool->drawable = NULL;
active_tool->gdisp_ptr = NULL;
}
} }
/* free the selection structure */ /* free the selection structure */
@ -337,7 +332,7 @@ gdisplay_delete (GDisplay *gdisp)
if (gdisp->window_info_dialog) if (gdisp->window_info_dialog)
info_window_free (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 (); context = gimp_context_get_user ();
if (gimp_context_get_display (context) == gdisp) if (gimp_context_get_display (context) == gdisp)
gimp_context_set_display (context, NULL); gimp_context_set_display (context, NULL);

View File

@ -289,7 +289,6 @@ gdisplay_format_title (GDisplay *gdisp,
static void static void
gdisplay_delete (GDisplay *gdisp) gdisplay_delete (GDisplay *gdisp)
{ {
GDisplay *tool_gdisp;
GimpContext *context; GimpContext *context;
g_hash_table_remove (display_ht, gdisp->shell); g_hash_table_remove (display_ht, gdisp->shell);
@ -299,15 +298,11 @@ gdisplay_delete (GDisplay *gdisp)
active_tool_control (HALT, (void *) gdisp); active_tool_control (HALT, (void *) gdisp);
/* clear out the pointer to this gdisp from the active tool */ /* 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; active_tool->drawable = NULL;
active_tool->gdisp_ptr = NULL;
if (gdisp == tool_gdisp)
{
active_tool->drawable = NULL;
active_tool->gdisp_ptr = NULL;
}
} }
/* free the selection structure */ /* free the selection structure */
@ -337,7 +332,7 @@ gdisplay_delete (GDisplay *gdisp)
if (gdisp->window_info_dialog) if (gdisp->window_info_dialog)
info_window_free (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 (); context = gimp_context_get_user ();
if (gimp_context_get_display (context) == gdisp) if (gimp_context_get_display (context) == gdisp)
gimp_context_set_display (context, NULL); gimp_context_set_display (context, NULL);

View File

@ -88,6 +88,10 @@ update_field (InfoField *field)
if (field->value_ptr == NULL) if (field->value_ptr == NULL)
return; return;
if (field->field_type != INFO_LABEL)
gtk_signal_handler_block_by_data (GTK_OBJECT (field->obj),
field->client_data);
switch (field->field_type) switch (field->field_type)
{ {
case INFO_LABEL: case INFO_LABEL:
@ -110,28 +114,19 @@ update_field (InfoField *field)
case INFO_SIZEENTRY: case INFO_SIZEENTRY:
num = GIMP_SIZE_ENTRY (field->obj)->number_of_fields; num = GIMP_SIZE_ENTRY (field->obj)->number_of_fields;
for (i = 0; i < num; i++)
/* 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++)
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (field->obj), i, gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (field->obj), i,
((gdouble*) field->value_ptr)[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; break;
default: default:
g_warning (_("Unknown info_dialog field type.")); g_warning (_("Unknown info_dialog field type."));
break; break;
} }
if (field->field_type != INFO_LABEL)
gtk_signal_handler_unblock_by_data (GTK_OBJECT (field->obj),
field->client_data);
} }
static gint static gint

View File

@ -88,6 +88,10 @@ update_field (InfoField *field)
if (field->value_ptr == NULL) if (field->value_ptr == NULL)
return; return;
if (field->field_type != INFO_LABEL)
gtk_signal_handler_block_by_data (GTK_OBJECT (field->obj),
field->client_data);
switch (field->field_type) switch (field->field_type)
{ {
case INFO_LABEL: case INFO_LABEL:
@ -110,28 +114,19 @@ update_field (InfoField *field)
case INFO_SIZEENTRY: case INFO_SIZEENTRY:
num = GIMP_SIZE_ENTRY (field->obj)->number_of_fields; num = GIMP_SIZE_ENTRY (field->obj)->number_of_fields;
for (i = 0; i < num; i++)
/* 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++)
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (field->obj), i, gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (field->obj), i,
((gdouble*) field->value_ptr)[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; break;
default: default:
g_warning (_("Unknown info_dialog field type.")); g_warning (_("Unknown info_dialog field type."));
break; break;
} }
if (field->field_type != INFO_LABEL)
gtk_signal_handler_unblock_by_data (GTK_OBJECT (field->obj),
field->client_data);
} }
static gint static gint

View File

@ -742,30 +742,24 @@ tools_new_crop ()
tools_register (CROP, (ToolOptions *) crop_options); tools_register (CROP, (ToolOptions *) crop_options);
} }
tool = (Tool *) g_malloc (sizeof (Tool)); tool = tools_new_tool (CROP);
private = (Crop *) g_malloc (sizeof (Crop)); private = g_new (Crop, 1);
private->core = draw_core_new (crop_draw); private->core = draw_core_new (crop_draw);
private->startx = private->starty = 0; private->startx = private->starty = 0;
private->function = CREATING; 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->private = (void *) private;
tool->preserve = FALSE; /* XXX Check me */ 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->button_release_func = crop_button_release;
tool->motion_func = crop_motion; tool->motion_func = crop_motion;
tool->arrow_keys_func = crop_arrow_keys_func; tool->arrow_keys_func = crop_arrow_keys_func;
tool->modifier_key_func = crop_modifier_key_func; tool->modifier_key_func = crop_modifier_key_func;
tool->cursor_update_func = crop_cursor_update; tool->cursor_update_func = crop_cursor_update;
tool->control_func = crop_control; tool->control_func = crop_control;
return tool; return tool;
} }

View File

@ -742,30 +742,24 @@ tools_new_crop ()
tools_register (CROP, (ToolOptions *) crop_options); tools_register (CROP, (ToolOptions *) crop_options);
} }
tool = (Tool *) g_malloc (sizeof (Tool)); tool = tools_new_tool (CROP);
private = (Crop *) g_malloc (sizeof (Crop)); private = g_new (Crop, 1);
private->core = draw_core_new (crop_draw); private->core = draw_core_new (crop_draw);
private->startx = private->starty = 0; private->startx = private->starty = 0;
private->function = CREATING; 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->private = (void *) private;
tool->preserve = FALSE; /* XXX Check me */ 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->button_release_func = crop_button_release;
tool->motion_func = crop_motion; tool->motion_func = crop_motion;
tool->arrow_keys_func = crop_arrow_keys_func; tool->arrow_keys_func = crop_arrow_keys_func;
tool->modifier_key_func = crop_modifier_key_func; tool->modifier_key_func = crop_modifier_key_func;
tool->cursor_update_func = crop_cursor_update; tool->cursor_update_func = crop_cursor_update;
tool->control_func = crop_control; tool->control_func = crop_control;
return tool; return tool;
} }